From 7b0a39bccce15543990844ebf41733b41bd0ed90 Mon Sep 17 00:00:00 2001 From: Pranav C <61551451+pranavxc@users.noreply.github.com> Date: Wed, 23 Jun 2021 20:10:29 +0530 Subject: [PATCH] feat: many to many - child listing Signed-off-by: Pranav C <61551451+pranavxc@users.noreply.github.com> --- .../project/spreadsheet/apis/restApi.js | 14 +- .../spreadsheet/components/virtualCell.vue | 25 +++ .../virtualCell/components/listChildItems.vue | 165 ++++++++++++++++++ .../virtualCell/components/listItems.vue | 59 +++++-- .../components/virtualCell/hasManyCell.vue | 48 +++-- .../components/virtualCell/manyToManyCell.vue | 63 ++++--- .../lib/dataMapper/lib/sql/BaseModelSql.ts | 58 +++++- packages/nocodb/src/lib/noco/rest/RestCtrl.ts | 24 +++ .../code/routes/xc-ts/ExpressXcTsRoutes.ts | 11 ++ 9 files changed, 413 insertions(+), 54 deletions(-) create mode 100644 packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue diff --git a/packages/nc-gui/components/project/spreadsheet/apis/restApi.js b/packages/nc-gui/components/project/spreadsheet/apis/restApi.js index a150417fb5..593e8debb9 100644 --- a/packages/nc-gui/components/project/spreadsheet/apis/restApi.js +++ b/packages/nc-gui/components/project/spreadsheet/apis/restApi.js @@ -48,7 +48,19 @@ export default class RestApi { async paginatedList(params) { // const list = await this.list(params); // const count = (await this.count({where: params.where || ''})).count; - const [list, {count}] = await Promise.all([this.list(params), this.count({where: params.where || ''})]); + const [list, {count}] = await Promise.all([this.list(params), this.count({ + where: params.where || '', + conditionGraph: params.conditionGraph + })]); + return {list, count}; + } + + async paginatedM2mNotChildrenList(params, assoc, pid) { + ///api/v1/Film/m2mNotChildren/film_actor/44 + // const list = await this.list(params); + // const count = (await this.count({where: params.where || ''})).count; + const {list, info: {count}} = (await this.get(`/nc/${this.$ctx.$route.params.project_id}/api/v1/${this.table}/m2mNotChildren/${assoc}/${pid}`, params)).data + debugger return {list, count}; } diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell.vue index d0b71d5f57..999e88b5b4 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell.vue @@ -24,6 +24,7 @@ :active="active" :is-new="isNew" v-on="$listeners" + :api="api" /> + 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 new file mode 100644 index 0000000000..2e469cbf5e --- /dev/null +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listChildItems.vue @@ -0,0 +1,165 @@ + + + + + + + diff --git a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue index 6cbfc48c31..214ac27714 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/virtualCell/components/listItems.vue @@ -52,14 +52,14 @@ - + @@ -68,12 +68,13 @@