From 81bc459835e7a1d4ffe4b60826ba29b48c8a8f5d Mon Sep 17 00:00:00 2001 From: mertmit Date: Sun, 24 Jul 2022 12:21:31 +0300 Subject: [PATCH] fix(ui): allow select columns with no options Re #2764 Signed-off-by: mertmit --- .../project/spreadsheet/components/cell/EnumCell.vue | 4 +++- .../project/spreadsheet/components/cell/SetListCell.vue | 4 +++- .../components/editableCell/EnumListEditableCell.vue | 4 +++- .../components/editableCell/SetListEditableCell.vue | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/cell/EnumCell.vue b/packages/nc-gui/components/project/spreadsheet/components/cell/EnumCell.vue index e0506b2852..cacbb43ee7 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/cell/EnumCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/cell/EnumCell.vue @@ -17,7 +17,9 @@ export default { props: ['value', 'column'], computed: { enumValues() { - const opts = this.column.colOptions.options || []; + const opts = (this.column.colOptions) + ? this.column.colOptions.options.filter(el => el.title !== '') || [] + : []; for (const op of opts.filter(el => el.order === null)) { op.title = op.title.replace(/^'/, '').replace(/'$/, ''); } diff --git a/packages/nc-gui/components/project/spreadsheet/components/cell/SetListCell.vue b/packages/nc-gui/components/project/spreadsheet/components/cell/SetListCell.vue index 678391e35e..717554417b 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/cell/SetListCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/cell/SetListCell.vue @@ -19,7 +19,9 @@ export default { props: ['value', 'column'], computed: { setValues() { - const opts = this.column.colOptions.options || []; + const opts = (this.column.colOptions) + ? this.column.colOptions.options.filter(el => el.title !== '') || [] + : []; for (const op of opts.filter(el => el.order === null)) { op.title = op.title.replace(/^'/, '').replace(/'$/, ''); } diff --git a/packages/nc-gui/components/project/spreadsheet/components/editableCell/EnumListEditableCell.vue b/packages/nc-gui/components/project/spreadsheet/components/editableCell/EnumListEditableCell.vue index f536cecf81..e9f1dd000f 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editableCell/EnumListEditableCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editableCell/EnumListEditableCell.vue @@ -55,7 +55,9 @@ export default { }, }, enumValues() { - const opts = this.column.colOptions.options || []; + const opts = (this.column.colOptions) + ? this.column.colOptions.options.filter(el => el.title !== '') || [] + : []; for (const op of opts.filter(el => el.order === null)) { op.title = op.title.replace(/^'/, '').replace(/'$/, ''); } diff --git a/packages/nc-gui/components/project/spreadsheet/components/editableCell/SetListEditableCell.vue b/packages/nc-gui/components/project/spreadsheet/components/editableCell/SetListEditableCell.vue index 7e3b3ef062..8ff31570a3 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editableCell/SetListEditableCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editableCell/SetListEditableCell.vue @@ -59,7 +59,9 @@ export default { }, }, setValues() { - const opts = this.column.colOptions.options || []; + const opts = (this.column.colOptions) + ? this.column.colOptions.options.filter(el => el.title !== '') || [] + : []; for (const op of opts.filter(el => el.order === null)) { op.title = op.title.replace(/^'/, '').replace(/'$/, ''); }