Browse Source

fix: use withDefaults for setting default prop value

pull/7276/head
Pranav C 11 months ago committed by Ramesh Mane
parent
commit
b862043ce2
  1. 2
      packages/nc-gui/components/cell/Duration.vue
  2. 2
      packages/nc-gui/components/cell/YearPicker.vue
  3. 2
      packages/nc-gui/components/dlg/QuickImport.vue
  4. 7
      packages/nc-gui/components/general/Overlay.vue
  5. 17
      packages/nc-gui/components/general/Share.vue
  6. 2
      packages/nc-gui/components/general/Sponsors.vue
  7. 2
      packages/nc-gui/components/general/TruncateText.vue
  8. 6
      packages/nc-gui/components/monaco/Editor.vue
  9. 9
      packages/nc-gui/components/virtual-cell/components/ItemChip.vue
  10. 4
      packages/nc-gui/pages/projects/index/index.vue
  11. 4
      packages/nc-gui/pages/projects/index/list.vue

2
packages/nc-gui/components/cell/Duration.vue

@ -20,7 +20,7 @@ interface Props {
showValidationError?: boolean
}
const { modelValue, showValidationError = true } = defineProps<Props>()
const { modelValue, showValidationError } = withDefaults(defineProps<Props>(), { showValidationError: true })
const emit = defineEmits(['update:modelValue'])

2
packages/nc-gui/components/cell/YearPicker.vue

@ -18,7 +18,7 @@ interface Props {
isPk?: boolean
}
const { modelValue, isPk = false } = defineProps<Props>()
const { modelValue, isPk = false } = withDefaults(defineProps<Props>(), { isPk: false })
const emit = defineEmits(['update:modelValue'])

2
packages/nc-gui/components/dlg/QuickImport.vue

@ -45,7 +45,7 @@ interface Props {
importDataOnly?: boolean
}
const { importType, importDataOnly = false, sourceId, ...rest } = defineProps<Props>()
const { importType, importDataOnly, sourceId, ...rest } = withDefaults(defineProps<Props>(), { importDataOnly: false })
const emit = defineEmits(['update:modelValue'])

7
packages/nc-gui/components/general/Overlay.vue

@ -22,7 +22,12 @@ interface Emits {
(event: 'open'): void
}
const { transition = true, teleportDisabled = false, inline = false, target, zIndex = 100, ...rest } = defineProps<Props>()
const { transition, teleportDisabled, inline, target, zIndex, ...rest } = withDefaults(defineProps<Props>(), {
transition: true,
teleportDisabled: false,
inline: false,
zIndex: 100,
})
const emits = defineEmits<Emits>()

17
packages/nc-gui/components/general/Share.vue

@ -12,16 +12,13 @@ interface Props {
width?: string
}
const {
url,
socialMedias,
title = 'NocoDB',
summary,
hashTags = '',
css = '',
iconClass = '',
width = '45px',
} = defineProps<Props>()
const { url, socialMedias, title, summary, hashTags, css, iconClass, width } = withDefaults(defineProps<Props>(), {
title: 'NocoDB',
hashTags: '',
css: '',
iconClass: '',
width: '45px',
})
const summaryArr = [
'Instant #Rest & #GraphQL APIs on any #SQL Database (Supports : MySQL, PostgresSQL, MsSQL, SQLite, MariaDB) #nocodb ',

2
packages/nc-gui/components/general/Sponsors.vue

@ -3,7 +3,7 @@ interface Props {
nav?: boolean
}
const { nav = false } = defineProps<Props>()
const { nav } = withDefaults(defineProps<Props>(), { nav: false })
</script>
<template>

2
packages/nc-gui/components/general/TruncateText.vue

@ -18,7 +18,7 @@ interface Props {
length?: number
}
const { placement = 'bottom', length = 20 } = defineProps<Props>()
const { placement, length } = withDefaults(defineProps<Props>(), { placement: 'bottom', length: 20 })
const text = ref<HTMLDivElement>()

6
packages/nc-gui/components/monaco/Editor.vue

@ -14,7 +14,11 @@ interface Props {
readOnly?: boolean
}
const { hideMinimap, lang = 'json', validate = true, disableDeepCompare = false, modelValue, readOnly } = defineProps<Props>()
const { hideMinimap, lang, validate, disableDeepCompare, modelValue, readOnly } = withDefaults(defineProps<Props>(), {
lang: 'json',
validate: true,
disableDeepCompare: false,
})
const emits = defineEmits(['update:modelValue'])

9
packages/nc-gui/components/virtual-cell/components/ItemChip.vue

@ -22,7 +22,14 @@ interface Props {
readonly?: boolean
}
const { value, item, column, showUnlinkButton, border = true, readonly: readonlyProp } = defineProps<Props>()
const {
value,
item,
column,
showUnlinkButton,
border,
readonly: readonlyProp,
} = withDefaults(defineProps<Props>(), { border: true })
const emit = defineEmits(['unlink'])

4
packages/nc-gui/pages/projects/index/index.vue

@ -6,7 +6,9 @@ interface Props {
bases?: BaseType[]
}
const { bases = [] } = defineProps<Props>()
const { bases } = withDefaults(defineProps<Props>(), {
bases: () => [],
})
const emit = defineEmits(['delete-base'])

4
packages/nc-gui/pages/projects/index/list.vue

@ -6,7 +6,9 @@ interface Props {
bases?: BaseType[]
}
const { bases = [] } = defineProps<Props>()
const { bases } = withDefaults(defineProps<Props>(), {
bases: () => [],
})
const emit = defineEmits(['delete-base'])

Loading…
Cancel
Save