From 37c626398b34e71c871892fbe090af94cd799535 Mon Sep 17 00:00:00 2001 From: Pranav C <61551451+pranavxc@users.noreply.github.com> Date: Sat, 24 Jul 2021 19:21:33 +0530 Subject: [PATCH] feat: Lookup - Handle reference column delete Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com> --- .../spreadsheet/components/editColumn.vue | 1 + .../components/editColumn/lookupOptions.vue | 4 +- .../components/virtualCell/belogsToCell.vue | 1 + .../virtualCell/components/listChildItems.vue | 9 +- .../components/listChildItemsModal.vue | 2 + .../components/virtualCell/hasManyCell.vue | 1 + .../components/virtualCell/lookupCell.vue | 87 ++++++++++++++++++- .../components/virtualCell/manyToManyCell.vue | 2 + .../components/virtualHeaderCell.vue | 8 +- .../src/lib/noco/common/BaseApiBuilder.ts | 54 +++++++++++- 10 files changed, 157 insertions(+), 12 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue index b456e3396a..cac07c1947 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn.vue @@ -32,6 +32,7 @@ label="Column name" dense outlined + :disabled="isLookup" @input="newColumn.altered = newColumn.altered || 8" /> diff --git a/packages/nc-gui/components/project/spreadsheet/components/editColumn/lookupOptions.vue b/packages/nc-gui/components/project/spreadsheet/components/editColumn/lookupOptions.vue index a2337555f9..e8de4dbf3e 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/editColumn/lookupOptions.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/editColumn/lookupOptions.vue @@ -95,10 +95,10 @@ export default { const meta = JSON.parse(JSON.stringify(this.$store.state.meta.metas[this.meta.tn])) meta.v.push({ - _cn: this.alias, + // _cn: this.alias, lookup: true, ...this.lookup.table, - cn: this.lookup.column.cn + ...this.lookup.column }) await this.$store.dispatch('sqlMgr/ActSqlOp', [{ diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue index 5cbd8e9e38..ce99707cc0 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/belogsToCell.vue @@ -141,6 +141,7 @@ export default { parentMeta() { return this.$store.state.meta.metas[this.bt.rtn] }, + // todo : optimize parentApi() { return this.parentMeta && this.parentMeta._tn ? ApiFactory.create(this.$store.getters['project/GtrProjectType'], diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue index a20d567daf..1e677ba1c3 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue @@ -8,6 +8,7 @@ mdi-reload
-
+
@@ -28,6 +29,7 @@ export default { name: 'ListChildItemsModal', components: { ListChildItems }, props: { + readOnly: Boolean, localState: Array, isNew: Boolean, value: Boolean, diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue index f9e578638f..63572cde4a 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/hasManyCell.vue @@ -176,6 +176,7 @@ export default { childMeta() { return this.$store.state.meta.metas[this.hm.tn] }, + // todo : optimize childApi() { return this.childMeta && this.childMeta._tn ? ApiFactory.create(this.$store.getters['project/GtrProjectType'], diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue index 2c86f9bcf1..021ca1012c 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/lookupCell.vue @@ -10,16 +10,39 @@ :readonly="true" /> + more... +
+