Browse Source

fix: use withDefaults for setting default prop value

pull/7335/head
Pranav C 1 year ago
parent
commit
781a3cd9b3
  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 showValidationError?: boolean
} }
const { modelValue, showValidationError = true } = defineProps<Props>() const { modelValue, showValidationError } = withDefaults(defineProps<Props>(), { showValidationError: true })
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])

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

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

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

@ -45,7 +45,7 @@ interface Props {
importDataOnly?: boolean 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']) const emit = defineEmits(['update:modelValue'])

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

@ -22,7 +22,12 @@ interface Emits {
(event: 'open'): void (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>() const emits = defineEmits<Emits>()

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

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

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

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

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

@ -14,7 +14,11 @@ interface Props {
readOnly?: boolean 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']) const emits = defineEmits(['update:modelValue'])

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

@ -22,7 +22,14 @@ interface Props {
readonly?: boolean 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']) const emit = defineEmits(['unlink'])

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

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

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

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

Loading…
Cancel
Save