From 21b4ab4f7a2fba43eeb0d67edd735fe11542eba1 Mon Sep 17 00:00:00 2001 From: gudaoxuri Date: Wed, 29 Nov 2023 18:32:19 +0800 Subject: [PATCH] Add row adding function. --- components.d.ts | 3 +- docs/TableDemo.vue | 27 +++++++++- src/assets/locales/en.json | 3 ++ src/assets/locales/zh-CN.json | 5 +- src/components/events.ts | 66 +++++++++---------------- src/components/layout/list/CellEdit.vue | 5 +- src/components/layout/list/List.vue | 3 ++ src/components/layout/list/RowAdd.vue | 24 +++++++++ src/components/props.ts | 2 +- 9 files changed, 89 insertions(+), 49 deletions(-) create mode 100644 src/components/layout/list/RowAdd.vue diff --git a/components.d.ts b/components.d.ts index 400b592..ea922ab 100644 --- a/components.d.ts +++ b/components.d.ts @@ -22,7 +22,7 @@ declare module 'vue' { ColumnRename: typeof import('./src/components/layout/list/ColumnRename.vue')['default'] ColumnResize: typeof import('./src/components/layout/list/ColumnResize.vue')['default'] ColumnSort: typeof import('./src/components/layout/list/ColumnSort.vue')['default'] - copy: typeof import('./src/components/layout/list/RowSelect copy.vue')['default'] + copy: typeof import('./src/components/layout/list/RowDelete copy.vue')['default'] Filter: typeof import('./src/components/function/Filter.vue')['default'] Group: typeof import('./src/components/function/Group.vue')['default'] Header: typeof import('./src/components/layout/list/Header.vue')['default'] @@ -30,6 +30,7 @@ declare module 'vue' { List: typeof import('./src/components/layout/list/List.vue')['default'] Menu: typeof import('./src/components/common/Menu.vue')['default'] Resize: typeof import('./src/components/function/Resize.vue')['default'] + RowAdd: typeof import('./src/components/layout/list/RowAdd.vue')['default'] RowDelete: typeof import('./src/components/layout/list/RowDelete.vue')['default'] Rows: typeof import('./src/components/layout/list/Rows.vue')['default'] RowSelect: typeof import('./src/components/layout/list/RowSelect.vue')['default'] diff --git a/docs/TableDemo.vue b/docs/TableDemo.vue index 3a4db7f..ca5299c 100644 --- a/docs/TableDemo.vue +++ b/docs/TableDemo.vue @@ -1,6 +1,7 @@ + + diff --git a/src/components/props.ts b/src/components/props.ts index d3aef2f..0c3ad10 100644 --- a/src/components/props.ts +++ b/src/components/props.ts @@ -188,7 +188,7 @@ export interface TableEventProps { group?: TableDataGroupReq, aggs?: { [key: string]: AggregateKind }, slice?: TableDataSliceReq) => Promise - saveData?: (changedRecords: { [key: string]: any }[]) => Promise + saveData?: (changedRecords: { [key: string]: any }[]) => Promise<{ [key: string]: any }[]> deleteData?: (deletedPks: any[]) => Promise newColumn?: (newColumnProps: TableColumnProps, fromColumnName?: string) => Promise