From b77b5d4a91aaf6f7e229c80350ea0d6ee656ff30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=9F=E8=B4=A4?= Date: Wed, 1 Nov 2023 14:38:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(table):=20=E4=BF=AE=E5=A4=8D=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E5=8D=95=E7=8B=AC=E5=B1=95=E7=A4=BA=20filter=20?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/WaterMark/demos/frontend.tsx | 45 +++-- .../src/components/ListToolBar/index.tsx | 5 +- tests/layout/__snapshots__/demo.test.ts.snap | 178 +++++++++++++++++- tests/table/__snapshots__/demo.test.ts.snap | 75 ++++++++ 4 files changed, 284 insertions(+), 19 deletions(-) diff --git a/packages/layout/src/components/WaterMark/demos/frontend.tsx b/packages/layout/src/components/WaterMark/demos/frontend.tsx index cc2cad339efe..a32ab72f81f0 100644 --- a/packages/layout/src/components/WaterMark/demos/frontend.tsx +++ b/packages/layout/src/components/WaterMark/demos/frontend.tsx @@ -1,6 +1,12 @@ /** Title: 前置水印 */ import type { ProColumns } from '@ant-design/pro-components'; -import { ProTable, TableDropdown, WaterMark } from '@ant-design/pro-components'; +import { + LightFilter, + ProFormDatePicker, + ProTable, + TableDropdown, + WaterMark, +} from '@ant-design/pro-components'; const valueEnum = { 0: 'close', @@ -103,18 +109,27 @@ const columns: ProColumns[] = [ ]; export default () => ( - - - columns={columns} - dataSource={tableListDataSource} - rowKey="key" - pagination={{ - showQuickJumper: true, - }} - search={false} - dateFormatter="string" - headerTitle="表格标题" - toolBarRender={false} - /> - + <> + + + columns={columns} + dataSource={tableListDataSource} + rowKey="key" + pagination={{ + showQuickJumper: true, + }} + toolbar={{ + title: '标签', + multipleLine: true, + filter: ( + + + + ), + }} + search={false} + dateFormatter="string" + /> + + ); diff --git a/packages/table/src/components/ListToolBar/index.tsx b/packages/table/src/components/ListToolBar/index.tsx index 91fe4514a000..10b9f9e2e448 100644 --- a/packages/table/src/components/ListToolBar/index.tsx +++ b/packages/table/src/components/ListToolBar/index.tsx @@ -114,10 +114,9 @@ const ListToolBarTabBar: React.FC<{ tabs: ListToolBarProps['tabs']; }> = ({ prefixCls, tabs, multipleLine, filtersNode }) => { if (!multipleLine) return null; - if (!tabs) return null; return (
- {tabs.items && tabs.items.length ? ( + {tabs?.items && tabs?.items.length ? ( = ({ }, [actions]); const hasRight = useMemo(() => { - return ( + return !!( (hasTitle && searchNode) || (!multipleLine && filtersNode) || actionDom || diff --git a/tests/layout/__snapshots__/demo.test.ts.snap b/tests/layout/__snapshots__/demo.test.ts.snap index e52c4a5d5818..3c6134bc282e 100644 --- a/tests/layout/__snapshots__/demo.test.ts.snap +++ b/tests/layout/__snapshots__/demo.test.ts.snap @@ -2056,8 +2056,184 @@ exports[`layout demos > 📸 renders ./packages/layout/src/components/WaterMark/ >
+
+
+
+
+ 标签 +
+
+
+
+
+ + + + + +
+
+ + + + + +
+
+ + + +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + 响应日期 + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/table/__snapshots__/demo.test.ts.snap b/tests/table/__snapshots__/demo.test.ts.snap index 9e667162a1fc..18b810b65d9e 100644 --- a/tests/table/__snapshots__/demo.test.ts.snap +++ b/tests/table/__snapshots__/demo.test.ts.snap @@ -12642,6 +12642,81 @@ exports[`table demos > 📸 renders ./packages/table/src/demos/ListToolBar/multi
+
+
+
+ +
+
+
+
+
+
+
+
+
+ + 响应日期 + + + + +
+
+
+
+
+
+
+
+
+
+
+