From 3536478102f7d09f0743ba51d21563155b813da3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 7 Jan 2022 16:09:13 +0530 Subject: [PATCH] fix: keep options when switching between single/multi select Signed-off-by: Pranav C --- .../spreadsheet/components/editColumn.vue | 25 +++++++++++++++++++ packages/nocodb/package-lock.json | 14 +++++------ packages/nocodb/package.json | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue index 26f310992b..5bb5b25ca2 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue @@ -104,6 +104,21 @@ + + + + + Changing MultiSelect to SingleSelect can lead to errors when there are multiple values associated with a cell + @@ -607,6 +622,11 @@ export default { this.newColumn.dtx = 'specificType' + const selectTypes = [UITypes.MultiSelect, UITypes.SingleSelect] + if (this.column && selectTypes.includes(this.newColumn.uidt) && selectTypes.includes(this.column.uidt)) { + this.newColumn.dtxp = this.column.dtxp + } + // this.$set(this.newColumn, 'uidt', this.sqlUi.getUIType(this.newColumn)); this.newColumn.altered = this.newColumn.altered || 2 @@ -627,6 +647,11 @@ export default { this.newColumn.dtxp = this.sqlUi.getDefaultLengthForDatatype(this.newColumn.dt) this.newColumn.dtxs = this.sqlUi.getDefaultScaleForDatatype(this.newColumn.dt) + const selectTypes = [UITypes.MultiSelect, UITypes.SingleSelect] + if (this.column && selectTypes.includes(this.newColumn.uidt) && selectTypes.includes(this.column.uidt)) { + this.newColumn.dtxp = this.column.dtxp + } + this.newColumn.altered = this.newColumn.altered || 2 }, focusInput() { diff --git a/packages/nocodb/package-lock.json b/packages/nocodb/package-lock.json index 087b913da3..b5e91fca8a 100644 --- a/packages/nocodb/package-lock.json +++ b/packages/nocodb/package-lock.json @@ -66,7 +66,7 @@ "mysql2": "^2.2.5", "nanoid": "^3.1.20", "nc-common": "0.0.6", - "nc-help": "^0.2.22", + "nc-help": "^0.2.23", "nc-lib-gui": "0.84.1", "nc-plugin": "^0.1.1", "ncp": "^2.0.0", @@ -15850,9 +15850,9 @@ } }, "node_modules/nc-help": { - "version": "0.2.22", - "resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.22.tgz", - "integrity": "sha512-VCcXlPJm4EqtAqlN3FCXgJauqENRgAe+qMlrfn4aKxN6ey31l8wr00Mg4WalGjgjV2ZxiA8qORYWlYog5NxpGg==", + "version": "0.2.23", + "resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.23.tgz", + "integrity": "sha512-4enEuzR9EhslpuSVh/uk04ti4euo6qOh+rvkRHbJbgAX7CEu/c8mHGWTEFDoZCIFZ0S3maVpCGDWp9RzonzEbA==", "dependencies": { "axios": "^0.21.1", "boxen": "^4.2.0", @@ -37147,9 +37147,9 @@ "integrity": "sha512-3AryS9uwa5NfISLxMciUonrH7YfXp+nlahB9T7girXIsLQrmwX4MdnuKs32akduCOGpKmjTJSWmATULbuMkbfw==" }, "nc-help": { - "version": "0.2.22", - "resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.22.tgz", - "integrity": "sha512-VCcXlPJm4EqtAqlN3FCXgJauqENRgAe+qMlrfn4aKxN6ey31l8wr00Mg4WalGjgjV2ZxiA8qORYWlYog5NxpGg==", + "version": "0.2.23", + "resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.23.tgz", + "integrity": "sha512-4enEuzR9EhslpuSVh/uk04ti4euo6qOh+rvkRHbJbgAX7CEu/c8mHGWTEFDoZCIFZ0S3maVpCGDWp9RzonzEbA==", "requires": { "axios": "^0.21.1", "boxen": "^4.2.0", diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json index 4873335e90..5071bfdacb 100644 --- a/packages/nocodb/package.json +++ b/packages/nocodb/package.json @@ -147,7 +147,7 @@ "mysql2": "^2.2.5", "nanoid": "^3.1.20", "nc-common": "0.0.6", - "nc-help": "^0.2.22", + "nc-help": "^0.2.23", "nc-lib-gui": "0.84.1", "nc-plugin": "^0.1.1", "ncp": "^2.0.0",