From 3549043f372e8d80a2aa7cc747bd58a8308d4f52 Mon Sep 17 00:00:00 2001 From: vben Date: Mon, 28 Dec 2020 23:33:23 +0800 Subject: [PATCH] wip(table): perf table --- CHANGELOG.zh_CN.md | 3 + src/components/Drawer/src/BasicDrawer.vue | 4 + src/components/Icon/src/index.vue | 4 +- src/components/Modal/src/index.less | 4 + src/components/Table/src/BasicTable.vue | 209 ++++++++--------- src/components/Table/src/const.ts | 6 + src/components/Table/src/hooks/useColumns.ts | 215 ++++++++++-------- .../Table/src/hooks/useCustomRow.ts | 90 ++++++++ .../Table/src/hooks/useDataSource.ts | 103 +++++---- src/components/Table/src/hooks/useLoading.ts | 31 +-- .../Table/src/hooks/usePagination.tsx | 48 ++-- src/components/Table/src/hooks/useProps.ts | 21 -- .../Table/src/hooks/useRowSelection.ts | 16 +- src/components/Table/src/hooks/useTable.ts | 9 +- .../Table/src/hooks/useTableScroll.ts | 78 +++---- .../Table/src/hooks/useTableStyle.ts | 18 ++ src/components/Table/src/props.ts | 2 +- src/components/Table/src/style/index.less | 14 -- src/components/Table/src/types/table.ts | 10 +- src/views/demo/table/Basic.vue | 6 +- src/views/demo/table/FixedColumn.vue | 4 +- src/views/demo/table/TreeTable.vue | 1 - src/views/demo/table/UseTable.vue | 3 +- src/views/demo/table/tableData.tsx | 8 +- 24 files changed, 520 insertions(+), 387 deletions(-) create mode 100644 src/components/Table/src/hooks/useCustomRow.ts delete mode 100644 src/components/Table/src/hooks/useProps.ts create mode 100644 src/components/Table/src/hooks/useTableStyle.ts diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index cfc48dc9..f8d18692 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -12,10 +12,13 @@ - form: 新增远程下拉`ApiSelect`及示例 - form: 新增`autoFocusFirstItem`配置。用于配置是否聚焦表单第一个输入框 - useForm: 支持动态改变参数。可以传入`Ref`类型与`Computed`类型进行动态更改 +- table: 新增`clickToRowSelect`属性。用于控制点击行是否选中勾选狂 +- table: 监听行点击事件 ### ⚡ Performance Improvements - 优化`modal`与`drawer`滚动条组件 +- table: 移除 `isTreeTable`属性 ### 🎫 Chores diff --git a/src/components/Drawer/src/BasicDrawer.vue b/src/components/Drawer/src/BasicDrawer.vue index 8ff8c525..54735cff 100644 --- a/src/components/Drawer/src/BasicDrawer.vue +++ b/src/components/Drawer/src/BasicDrawer.vue @@ -225,6 +225,10 @@ padding: 16px !important; margin-bottom: 0 !important; } + + > .scrollbar > .scrollbar__bar.is-horizontal { + display: none; + } } } diff --git a/src/components/Icon/src/index.vue b/src/components/Icon/src/index.vue index f26503a2..9e48335f 100644 --- a/src/components/Icon/src/index.vue +++ b/src/components/Icon/src/index.vue @@ -43,7 +43,7 @@ if (el) { await nextTick(); const icon = unref(getIconRef); - + if (!icon) return; const svg = Iconify.renderSVG(icon, {}); if (svg) { @@ -74,7 +74,7 @@ } ); - watch(() => props.icon, update, { flush: 'post' }); + // watch(() => props.icon, update, { flush: 'post' }); onMounted(update); diff --git a/src/components/Modal/src/index.less b/src/components/Modal/src/index.less index ddf8173f..a5f0e39b 100644 --- a/src/components/Modal/src/index.less +++ b/src/components/Modal/src/index.less @@ -40,6 +40,10 @@ .ant-modal-body { padding: 0; + + > .scrollbar > .scrollbar__bar.is-horizontal { + display: none; + } } &-large { diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index 4b9023f5..c3995de1 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -11,7 +11,7 @@ :submitOnReset="true" v-bind="getFormProps" v-if="getBindValues.useSearchForm" - :submitButtonOptions="{ loading }" + :submitButtonOptions="{ loading: getLoading }" :tableAction="tableAction" @register="registerForm" @submit="handleSearchInfoChange" @@ -35,18 +35,10 @@