From 54754af8157c3b5b9e0543be0780ad981128b446 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 1 Jun 2023 14:18:50 +0530 Subject: [PATCH 1/9] fix: set default value for inject Signed-off-by: Pranav C --- packages/nc-gui/components/cell/Currency.vue | 2 +- packages/nc-gui/components/cell/Decimal.vue | 2 +- packages/nc-gui/components/cell/Duration.vue | 2 +- packages/nc-gui/components/cell/Email.vue | 2 +- packages/nc-gui/components/cell/Float.vue | 2 +- packages/nc-gui/components/cell/Integer.vue | 2 +- packages/nc-gui/components/cell/Percent.vue | 2 +- packages/nc-gui/components/cell/Text.vue | 2 +- packages/nc-gui/components/cell/TextArea.vue | 2 +- packages/nc-gui/components/cell/Url.vue | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui/components/cell/Currency.vue b/packages/nc-gui/components/cell/Currency.vue index 2d14a432b9..04071a9630 100644 --- a/packages/nc-gui/components/cell/Currency.vue +++ b/packages/nc-gui/components/cell/Currency.vue @@ -53,7 +53,7 @@ const currency = computed(() => { } }) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Decimal.vue b/packages/nc-gui/components/cell/Decimal.vue index 25011a9ad9..1034b5ee1a 100644 --- a/packages/nc-gui/components/cell/Decimal.vue +++ b/packages/nc-gui/components/cell/Decimal.vue @@ -36,7 +36,7 @@ const vModel = computed({ }, }) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Duration.vue b/packages/nc-gui/components/cell/Duration.vue index 7b374e3b37..f8783d2aba 100644 --- a/packages/nc-gui/components/cell/Duration.vue +++ b/packages/nc-gui/components/cell/Duration.vue @@ -74,7 +74,7 @@ const submitDuration = () => { isEdited.value = false } -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Email.vue b/packages/nc-gui/components/cell/Email.vue index 49f742ec31..45541ecfac 100644 --- a/packages/nc-gui/components/cell/Email.vue +++ b/packages/nc-gui/components/cell/Email.vue @@ -35,7 +35,7 @@ const vModel = computed({ const validEmail = computed(() => vModel.value && validateEmail(vModel.value)) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Float.vue b/packages/nc-gui/components/cell/Float.vue index 2854ec3189..13995a58e3 100644 --- a/packages/nc-gui/components/cell/Float.vue +++ b/packages/nc-gui/components/cell/Float.vue @@ -36,7 +36,7 @@ const vModel = computed({ }, }) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Integer.vue b/packages/nc-gui/components/cell/Integer.vue index 7e643524d0..d539600d87 100644 --- a/packages/nc-gui/components/cell/Integer.vue +++ b/packages/nc-gui/components/cell/Integer.vue @@ -36,7 +36,7 @@ const vModel = computed({ }, }) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Percent.vue b/packages/nc-gui/components/cell/Percent.vue index 6bf2e1cdb0..574b2d64cc 100644 --- a/packages/nc-gui/components/cell/Percent.vue +++ b/packages/nc-gui/components/cell/Percent.vue @@ -27,7 +27,7 @@ const vModel = computed({ }, }) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/Text.vue b/packages/nc-gui/components/cell/Text.vue index 6c333f878a..b5ff374cad 100644 --- a/packages/nc-gui/components/cell/Text.vue +++ b/packages/nc-gui/components/cell/Text.vue @@ -23,7 +23,7 @@ const readonly = inject(ReadonlyInj, ref(false)) const vModel = useVModel(props, 'modelValue', emits) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() diff --git a/packages/nc-gui/components/cell/TextArea.vue b/packages/nc-gui/components/cell/TextArea.vue index 7407f03eed..36392bf015 100644 --- a/packages/nc-gui/components/cell/TextArea.vue +++ b/packages/nc-gui/components/cell/TextArea.vue @@ -19,7 +19,7 @@ const { showNull } = useGlobal() const vModel = useVModel(props, 'modelValue', emits, { defaultValue: '' }) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLTextAreaElement)?.focus() diff --git a/packages/nc-gui/components/cell/Url.vue b/packages/nc-gui/components/cell/Url.vue index d781d3b28c..9efa16d4cb 100644 --- a/packages/nc-gui/components/cell/Url.vue +++ b/packages/nc-gui/components/cell/Url.vue @@ -63,7 +63,7 @@ const url = computed(() => { const { cellUrlOptions } = useCellUrlConfig(url) -const isExpandedFormOpen = inject(IsExpandedFormOpenInj)! +const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() From 5c5c80d83139835ff1b32d945ed6fa4687c98350 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 1 Jun 2023 14:19:26 +0530 Subject: [PATCH 2/9] fix: handle scenarios in which `dt` is not defined Signed-off-by: Pranav C --- packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts | 2 +- packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts | 2 +- packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts | 2 +- packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts | 2 +- packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts index 905695c5d9..16eb82d90f 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/MssqlUi.ts @@ -832,7 +832,7 @@ export class MssqlUi { } static getAbstractType(col): any { - switch ((col.dt || col.dt).toLowerCase()) { + switch (col.dt?.toLowerCase()) { case 'bigint': case 'smallint': case 'bit': diff --git a/packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts index 0e0d56b61b..8275d76495 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/MysqlUi.ts @@ -871,7 +871,7 @@ export class MysqlUi { } static getAbstractType(col): any { - switch (col.dt.toLowerCase()) { + switch (col.dt?.toLowerCase()) { case 'int': case 'smallint': case 'mediumint': diff --git a/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts index 7038ffa3ad..6f1747fa8c 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/OracleUi.ts @@ -689,7 +689,7 @@ export class OracleUi { } static getAbstractType(col): any { - switch ((col.dt || col.dt).toLowerCase()) { + switch (col.dt?.toLowerCase()) { case 'integer': return 'integer'; case 'bfile': diff --git a/packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts index ea958b8030..1a67fc44b2 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/PgUi.ts @@ -1358,7 +1358,7 @@ export class PgUi { } static getAbstractType(col): any { - switch ((col.dt || col.dt).toLowerCase()) { + switch (col.dt?.toLowerCase()) { case 'anyenum': return 'enum'; case 'anynonarray': diff --git a/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts b/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts index 086c4c731c..acee3ab5e4 100644 --- a/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts +++ b/packages/nocodb-sdk/src/lib/sqlUi/SnowflakeUi.ts @@ -572,7 +572,7 @@ export class SnowflakeUi { } static getAbstractType(col): any { - switch (col.dt.toUpperCase()) { + switch (col.dt?.toUpperCase()) { case 'NUMBER': case 'DECIMAL': case 'NUMERIC': From 6cf0de21f86e487761450e28f21d8a4287a3c059 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 1 Jun 2023 19:13:13 +0530 Subject: [PATCH 3/9] fix: make `isUpdatedFromCopyNPaste` optional Signed-off-by: Pranav C --- packages/nc-gui/components/cell/DateTimePicker.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/cell/DateTimePicker.vue b/packages/nc-gui/components/cell/DateTimePicker.vue index 737056ff3e..0395901bbf 100644 --- a/packages/nc-gui/components/cell/DateTimePicker.vue +++ b/packages/nc-gui/components/cell/DateTimePicker.vue @@ -18,7 +18,7 @@ import { interface Props { modelValue?: string | null isPk?: boolean - isUpdatedFromCopyNPaste: Record + isUpdatedFromCopyNPaste?: Record } const { modelValue, isPk, isUpdatedFromCopyNPaste } = defineProps() From 00979908e62258cd821701aa248c1c010bbc3f61 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 1 Jun 2023 19:13:57 +0530 Subject: [PATCH 4/9] fix: remove `GeoDataOptions` from template since the component doesn't exist Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/column/EditOrAdd.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue index 89e860e045..6e697e0cfa 100644 --- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue +++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue @@ -188,7 +188,6 @@ useEventListener('keydown', (e: KeyboardEvent) => { - From 515c6078205a990a1fa71197720e7e72761a625d Mon Sep 17 00:00:00 2001 From: DIWAKAR Date: Thu, 1 Jun 2023 20:47:50 +0530 Subject: [PATCH 5/9] eyeSlash icon --- packages/nc-gui/components/smartsheet/Form.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index 05a26b2304..68179cdf2d 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -599,7 +599,7 @@ watch(view, (nextView) => { > From faca1e9f68fa5d74050f4927c5400ece0797b7e0 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 1 Jun 2023 23:17:56 +0530 Subject: [PATCH 6/9] fix: access reactive variable value using `value` prop Signed-off-by: Pranav C --- packages/nc-gui/components/cell/Currency.vue | 2 +- packages/nc-gui/components/cell/Decimal.vue | 2 +- packages/nc-gui/components/cell/Duration.vue | 2 +- packages/nc-gui/components/cell/Email.vue | 2 +- packages/nc-gui/components/cell/Float.vue | 2 +- packages/nc-gui/components/cell/Integer.vue | 2 +- packages/nc-gui/components/cell/Percent.vue | 2 +- packages/nc-gui/components/cell/Text.vue | 2 +- packages/nc-gui/components/cell/TextArea.vue | 2 +- packages/nc-gui/components/cell/Url.vue | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui/components/cell/Currency.vue b/packages/nc-gui/components/cell/Currency.vue index 04071a9630..09c605ead3 100644 --- a/packages/nc-gui/components/cell/Currency.vue +++ b/packages/nc-gui/components/cell/Currency.vue @@ -55,7 +55,7 @@ const currency = computed(() => { const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! -const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() +const focus: VNodeRef = (el) => !isExpandedFormOpen.value && (el as HTMLInputElement)?.focus() const submitCurrency = () => { if (lastSaved.value !== vModel.value) { diff --git a/packages/nc-gui/components/cell/Decimal.vue b/packages/nc-gui/components/cell/Decimal.vue index 1034b5ee1a..11392f6d08 100644 --- a/packages/nc-gui/components/cell/Decimal.vue +++ b/packages/nc-gui/components/cell/Decimal.vue @@ -38,7 +38,7 @@ const vModel = computed({ const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! -const focus: VNodeRef = (el) => !isExpandedFormOpen && (el as HTMLInputElement)?.focus() +const focus: VNodeRef = (el) => !isExpandedFormOpen.value && (el as HTMLInputElement)?.focus()