From 739caf1476531120db66e003c0421b243e1d5e69 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 29 Dec 2023 16:39:32 +0530 Subject: [PATCH 1/8] fix: set the default value using withDefault --- packages/nc-gui/components/general/NocoIcon.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/general/NocoIcon.vue b/packages/nc-gui/components/general/NocoIcon.vue index 4cf83b214a..79e812abcc 100644 --- a/packages/nc-gui/components/general/NocoIcon.vue +++ b/packages/nc-gui/components/general/NocoIcon.vue @@ -6,7 +6,7 @@ interface Props { animate?: boolean } -const { size = 90, animate = false } = defineProps() +const { size, animate } = withDefaults(defineProps(), { size: 90, animate: false }) const ping = autoResetRef(false, 1000) From 781a3cd9b3d1db9bc2fc3ae32d40914656b11bca Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 29 Dec 2023 17:12:22 +0530 Subject: [PATCH 2/8] fix: use withDefaults for setting default prop value --- packages/nc-gui/components/cell/Duration.vue | 2 +- packages/nc-gui/components/cell/YearPicker.vue | 2 +- packages/nc-gui/components/dlg/QuickImport.vue | 2 +- packages/nc-gui/components/general/Overlay.vue | 7 ++++++- packages/nc-gui/components/general/Share.vue | 17 +++++++---------- packages/nc-gui/components/general/Sponsors.vue | 2 +- .../nc-gui/components/general/TruncateText.vue | 2 +- packages/nc-gui/components/monaco/Editor.vue | 6 +++++- .../virtual-cell/components/ItemChip.vue | 9 ++++++++- packages/nc-gui/pages/projects/index/index.vue | 4 +++- packages/nc-gui/pages/projects/index/list.vue | 4 +++- 11 files changed, 37 insertions(+), 20 deletions(-) diff --git a/packages/nc-gui/components/cell/Duration.vue b/packages/nc-gui/components/cell/Duration.vue index b4bf77263c..84d2c9e407 100644 --- a/packages/nc-gui/components/cell/Duration.vue +++ b/packages/nc-gui/components/cell/Duration.vue @@ -20,7 +20,7 @@ interface Props { showValidationError?: boolean } -const { modelValue, showValidationError = true } = defineProps() +const { modelValue, showValidationError } = withDefaults(defineProps(), { showValidationError: true }) const emit = defineEmits(['update:modelValue']) diff --git a/packages/nc-gui/components/cell/YearPicker.vue b/packages/nc-gui/components/cell/YearPicker.vue index 69e3302912..ad70fa1767 100644 --- a/packages/nc-gui/components/cell/YearPicker.vue +++ b/packages/nc-gui/components/cell/YearPicker.vue @@ -18,7 +18,7 @@ interface Props { isPk?: boolean } -const { modelValue, isPk = false } = defineProps() +const { modelValue, isPk = false } = withDefaults(defineProps(), { isPk: false }) const emit = defineEmits(['update:modelValue']) diff --git a/packages/nc-gui/components/dlg/QuickImport.vue b/packages/nc-gui/components/dlg/QuickImport.vue index d49f72f209..c38a48cb08 100644 --- a/packages/nc-gui/components/dlg/QuickImport.vue +++ b/packages/nc-gui/components/dlg/QuickImport.vue @@ -45,7 +45,7 @@ interface Props { importDataOnly?: boolean } -const { importType, importDataOnly = false, sourceId, ...rest } = defineProps() +const { importType, importDataOnly, sourceId, ...rest } = withDefaults(defineProps(), { importDataOnly: false }) const emit = defineEmits(['update:modelValue']) diff --git a/packages/nc-gui/components/general/Overlay.vue b/packages/nc-gui/components/general/Overlay.vue index 2c1ac4f157..b202c4add8 100644 --- a/packages/nc-gui/components/general/Overlay.vue +++ b/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() +const { transition, teleportDisabled, inline, target, zIndex, ...rest } = withDefaults(defineProps(), { + transition: true, + teleportDisabled: false, + inline: false, + zIndex: 100, +}) const emits = defineEmits() diff --git a/packages/nc-gui/components/general/Share.vue b/packages/nc-gui/components/general/Share.vue index db92bdd0ee..018a578089 100644 --- a/packages/nc-gui/components/general/Share.vue +++ b/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() +const { url, socialMedias, title, summary, hashTags, css, iconClass, width } = withDefaults(defineProps(), { + title: 'NocoDB', + hashTags: '', + css: '', + iconClass: '', + width: '45px', +}) const summaryArr = [ 'Instant #Rest & #GraphQL APIs on any #SQL Database (Supports : MySQL, PostgresSQL, MsSQL, SQLite, MariaDB) #nocodb ', diff --git a/packages/nc-gui/components/general/Sponsors.vue b/packages/nc-gui/components/general/Sponsors.vue index 5885217b57..6f502c72a9 100644 --- a/packages/nc-gui/components/general/Sponsors.vue +++ b/packages/nc-gui/components/general/Sponsors.vue @@ -3,7 +3,7 @@ interface Props { nav?: boolean } -const { nav = false } = defineProps() +const { nav } = withDefaults(defineProps(), { nav: false })