From 48626d7a37a2dfde733bcb5301a4d900e1c2bdf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Wed, 16 Nov 2022 00:35:24 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(table):=20=E4=BC=98=E5=8C=96=20defaul?= =?UTF-8?q?t-toolbar=20=E5=B1=9E=E6=80=A7=E6=94=AF=E6=8C=81=20array=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8C=87=E5=AE=9A=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/table/index.vue | 31 +++++++++++++++---- package/component/src/component/tag/index.vue | 4 ++- .../src/document/zh-CN/components/table.md | 2 +- .../src/document/zh-CN/guide/changelog.md | 3 +- package/document-component/src/view/index.vue | 2 +- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index 64e002af..c9224061 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -32,7 +32,7 @@ export interface TableProps { page?: Recordable; columns: Recordable[]; dataSource: Recordable[]; - defaultToolbar?: boolean | Recordable[]; + defaultToolbar?: boolean | any[]; selectedKey?: string; selectedKeys?: Recordable[]; indentSize?: number; @@ -60,6 +60,7 @@ const props = withDefaults(defineProps(), { childrenColumnName: "children", dataSource: () => [], selectedKeys: () => [], + defaultToolbar: false, selectedKey: "", maxHeight: "auto", even: false, @@ -518,7 +519,6 @@ const childrenExpandSpace = computed(() => { ); }); - const renderFixedStyle = (column: any, columnIndex: number) => { if (column.fixed) { if (column.fixed == "left") { @@ -564,7 +564,11 @@ const renderFixedStyle = (column: any, columnIndex: number) => { /** * @remark 排除 hide 列 */ -const renderHeadFixedStyle = (column: any, columnIndex: number, tableHeadColumn: any[]) => { +const renderHeadFixedStyle = ( + column: any, + columnIndex: number, + tableHeadColumn: any[] +) => { if (column.fixed) { if (column.fixed == "left") { var left = 0; @@ -671,6 +675,13 @@ const totalRowMethod = (column: any, dataSource: any[]) => { return total; }; +const showToolbar = (toolbarName: string) => { + if(props.defaultToolbar instanceof Array) { + return props.defaultToolbar.includes(toolbarName) + } + return props.defaultToolbar; +} + onBeforeUnmount(() => { window.onresize = null; }); @@ -685,7 +696,8 @@ onBeforeUnmount(() => {
- + +
@@ -703,7 +715,9 @@ onBeforeUnmount(() => {
+
{ >
-
+ +
@@ -782,7 +797,11 @@ onBeforeUnmount(() => { { textAlign: column.align, }, - renderHeadFixedStyle(column, columnIndex, tableHeadColumn), + renderHeadFixedStyle( + column, + columnIndex, + tableHeadColumn + ), ]" >