@pisell/materials 1.0.1034 → 1.0.1035
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +17 -17
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +18 -23
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +27 -32
- package/es/components/Pagination/index.js +1 -1
- package/es/components/PisellCards/index.d.ts +6 -6
- package/es/components/calendar/index.d.ts +2 -2
- package/es/components/checkbox/index.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Input.Email/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +3 -3
- package/es/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/date-picker/index.d.ts +2 -2
- package/es/components/filter/components/Dropdown/index.js +6 -2
- package/es/components/filter/components/FilterButton/index.js +3 -2
- package/es/components/filter/components/FilterButton/types.d.ts +5 -2
- package/es/components/filter/components/FilterItem/AsyncOptionsSelectWrapper.js +67 -0
- package/es/components/filter/components/FilterItem/index.js +105 -6
- package/es/components/filter/components/FilterItem/index.less +90 -0
- package/es/components/filter/types.d.ts +4 -2
- package/es/components/input/index.d.ts +2 -2
- package/es/components/pisell-config-provider/context.d.ts +2 -2
- package/es/components/pisellCurrency/PisellCurrency.less +163 -25
- package/es/components/pisellDatePicker/index.d.ts +2 -2
- package/es/components/pisellDateTimeDisplay/PisellDateTimeDisplay.js +11 -10
- package/es/components/pisellDateTimeDisplay/types.d.ts +5 -0
- package/es/components/pisellEmail/PisellEmail.d.ts +2 -33
- package/es/components/pisellEmail/PisellEmail.js +1 -1
- package/es/components/pisellEmail/PisellEmail.less +119 -10
- package/es/components/pisellEmail/index.d.ts +1 -1
- package/es/components/pisellFilter/docs/PisellFilter.md +289 -232
- package/es/components/pisellFilter/index.js +66 -11
- package/es/components/pisellLongText/PisellLongText.less +72 -4
- package/es/components/pisellLookup/PisellLookup.js +3 -3
- package/es/components/pisellLookup/PisellLookup.less +14 -9
- package/es/components/pisellLookup/components/LookupTrigger.js +6 -2
- package/es/components/pisellMetricCard/PisellMetricCard.d.ts +38 -0
- package/es/components/pisellMetricCard/PisellMetricCard.js +136 -0
- package/es/components/pisellMetricCard/components/MetricComparison.js +54 -0
- package/es/components/pisellMetricCard/components/MetricTitle.js +41 -0
- package/es/components/pisellMetricCard/components/MetricValue.js +26 -0
- package/es/components/pisellMetricCard/components/TrendIcon.js +26 -0
- package/es/components/pisellMetricCard/docs/pisellMetricCard.$tab-design.md +2 -6
- package/es/components/pisellMetricCard/index.d.ts +2 -0
- package/es/components/pisellMetricCard/types.d.ts +143 -0
- package/es/components/pisellMetricCard/utils/calculateTrend.js +22 -0
- package/es/components/pisellMetricCard/utils/formatMetricValue.js +52 -0
- package/es/components/pisellMultipleSelect/PisellMultipleSelect.less +151 -124
- package/es/components/pisellMultipleSelect/components/EditView.js +8 -1
- package/es/components/pisellMultipleSelect/components/ReadOnlyView.js +18 -6
- package/es/components/pisellNumber/PisellNumber.less +135 -17
- package/es/components/pisellPercent/PisellPercent.less +142 -24
- package/es/components/pisellPhone/PisellPhone.less +122 -27
- package/es/components/pisellPhone/components/EditView.js +1 -1
- package/es/components/pisellPhone/components/ReadOnlyView.js +15 -5
- package/es/components/pisellPhone/utils/countryCodeHelper.js +1 -10
- package/es/components/pisellRating/PisellRating.less +20 -12
- package/es/components/pisellRecordBoard/PisellRecordBoard.js +148 -0
- package/es/components/pisellRecordBoard/README.md +183 -0
- package/es/components/pisellRecordBoard/context/RecordBoardContext.js +7 -0
- package/es/components/pisellRecordBoard/context/RecordBoardProvider.js +14 -0
- package/es/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-design.md +128 -0
- package/es/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-dev.md +82 -0
- package/es/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-test.md +70 -0
- package/es/components/pisellRecordBoard/docs/PisellRecordBoard.md +552 -0
- package/es/components/pisellRecordBoard/hooks/useRecordBoardContext.d.ts +20 -0
- package/es/components/pisellRecordBoard/hooks/useRecordBoardContext.js +16 -0
- package/es/components/pisellRecordBoard/index.d.ts +40 -0
- package/es/components/pisellRecordBoard/index.js +28 -0
- package/es/components/pisellRecordBoard/layouts/CardLayout/CardList.d.ts +15 -0
- package/es/components/pisellRecordBoard/layouts/CardLayout/CardList.js +24 -0
- package/es/components/pisellRecordBoard/layouts/CardLayout/index.d.ts +15 -0
- package/es/components/pisellRecordBoard/layouts/CardLayout/index.js +21 -0
- package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.d.ts +17 -0
- package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.js +105 -0
- package/es/components/pisellRecordBoard/layouts/GridLayout/Grid.less +13 -0
- package/es/components/pisellRecordBoard/layouts/GridLayout/index.d.ts +15 -0
- package/es/components/pisellRecordBoard/layouts/GridLayout/index.js +21 -0
- package/es/components/pisellRecordBoard/shellFrame/BatchActionBar/index.d.ts +12 -0
- package/es/components/pisellRecordBoard/shellFrame/BatchActionBar/index.js +69 -0
- package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/ColumnSettingPopover.js +40 -0
- package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/index.js +60 -0
- package/es/components/pisellRecordBoard/shellFrame/ColumnSetting/index.less +2 -0
- package/es/components/pisellRecordBoard/shellFrame/Pagination/index.d.ts +17 -0
- package/es/components/pisellRecordBoard/shellFrame/Pagination/index.js +52 -0
- package/es/components/pisellRecordBoard/shellFrame/Pagination/index.less +61 -0
- package/es/components/pisellRecordBoard/shellFrame/Search/index.d.ts +13 -0
- package/es/components/pisellRecordBoard/shellFrame/Search/index.js +34 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +77 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +14 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +136 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBarQuickFilter/index.d.ts +2 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBarQuickFilter/index.js +62 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.d.ts +2 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +45 -0
- package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.less +41 -0
- package/es/components/pisellRecordBoard/shellFrame/index.d.ts +27 -0
- package/es/components/pisellRecordBoard/shellFrame/index.js +38 -0
- package/es/components/pisellRecordBoard/types.d.ts +259 -0
- package/es/components/pisellRecordBoard/utils/recordBoardColumns.js +287 -0
- package/es/components/pisellShellFrame/PisellShellFrame.d.ts +16 -0
- package/es/components/pisellShellFrame/PisellShellFrame.js +60 -0
- package/es/components/pisellShellFrame/PisellShellFrame.less +73 -0
- package/es/components/pisellShellFrame/README.md +58 -0
- package/es/components/pisellShellFrame/index.d.ts +2 -0
- package/es/components/pisellShellFrame/types.d.ts +60 -0
- package/es/components/pisellSingleSelect/PisellSingleSelect.less +88 -46
- package/es/components/pisellSingleSelect/components/EditView.js +8 -1
- package/es/components/pisellSingleSelect/components/ReadOnlyView.js +8 -2
- package/es/components/pisellUrl/PisellUrl.d.ts +2 -33
- package/es/components/pisellUrl/PisellUrl.js +1 -1
- package/es/components/pisellUrl/PisellUrl.less +120 -11
- package/es/components/pisellUrl/index.d.ts +1 -1
- package/es/components/radio/index.d.ts +2 -2
- package/es/components/section-footers/index.d.ts +2 -2
- package/es/components/skeleton/index.d.ts +2 -2
- package/es/components/sort/index.js +12 -1
- package/es/components/sort/types.d.ts +8 -2
- package/es/components/time-picker/index.d.ts +2 -2
- package/es/index.d.ts +19 -11
- package/es/index.js +19 -15
- package/es/locales/en-US.js +16 -2
- package/es/locales/zh-CN.js +18 -4
- package/es/locales/zh-TW.js +18 -4
- package/es/utils/tagColor.js +31 -0
- package/lib/components/Pagination/index.js +1 -1
- package/lib/components/checkbox/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/filter/components/Dropdown/index.js +6 -2
- package/lib/components/filter/components/FilterButton/index.js +3 -2
- package/lib/components/filter/components/FilterButton/types.d.ts +5 -2
- package/lib/components/filter/components/FilterItem/AsyncOptionsSelectWrapper.js +69 -0
- package/lib/components/filter/components/FilterItem/index.js +106 -6
- package/lib/components/filter/components/FilterItem/index.less +90 -0
- package/lib/components/filter/types.d.ts +4 -2
- package/lib/components/input/index.d.ts +2 -2
- package/lib/components/pisell-config-provider/context.d.ts +2 -2
- package/lib/components/pisellCurrency/PisellCurrency.less +163 -25
- package/lib/components/pisellDatePicker/index.d.ts +2 -2
- package/lib/components/pisellDateTimeDisplay/PisellDateTimeDisplay.js +11 -10
- package/lib/components/pisellDateTimeDisplay/types.d.ts +5 -0
- package/lib/components/pisellEmail/PisellEmail.d.ts +2 -33
- package/lib/components/pisellEmail/PisellEmail.js +1 -1
- package/lib/components/pisellEmail/PisellEmail.less +119 -10
- package/lib/components/pisellEmail/index.d.ts +1 -1
- package/lib/components/pisellFilter/docs/PisellFilter.md +289 -232
- package/lib/components/pisellFilter/index.js +65 -10
- package/lib/components/pisellLongText/PisellLongText.less +72 -4
- package/lib/components/pisellLookup/PisellLookup.js +3 -3
- package/lib/components/pisellLookup/PisellLookup.less +14 -9
- package/lib/components/pisellLookup/components/LookupTrigger.js +6 -2
- package/lib/components/pisellMetricCard/PisellMetricCard.d.ts +38 -0
- package/lib/components/pisellMetricCard/PisellMetricCard.js +138 -0
- package/lib/components/pisellMetricCard/components/MetricComparison.js +56 -0
- package/lib/components/pisellMetricCard/components/MetricTitle.js +43 -0
- package/lib/components/pisellMetricCard/components/MetricValue.js +28 -0
- package/lib/components/pisellMetricCard/components/TrendIcon.js +28 -0
- package/lib/components/pisellMetricCard/docs/pisellMetricCard.$tab-design.md +2 -6
- package/lib/components/pisellMetricCard/index.d.ts +2 -0
- package/lib/components/pisellMetricCard/types.d.ts +143 -0
- package/lib/components/pisellMetricCard/utils/calculateTrend.js +23 -0
- package/lib/components/pisellMetricCard/utils/formatMetricValue.js +53 -0
- package/lib/components/pisellMultipleSelect/PisellMultipleSelect.less +151 -124
- package/lib/components/pisellMultipleSelect/components/EditView.js +7 -0
- package/lib/components/pisellMultipleSelect/components/ReadOnlyView.js +17 -5
- package/lib/components/pisellNumber/PisellNumber.less +135 -17
- package/lib/components/pisellPercent/PisellPercent.less +142 -24
- package/lib/components/pisellPhone/PisellPhone.less +122 -27
- package/lib/components/pisellPhone/components/EditView.js +1 -1
- package/lib/components/pisellPhone/components/ReadOnlyView.js +15 -5
- package/lib/components/pisellPhone/utils/countryCodeHelper.js +0 -10
- package/lib/components/pisellRating/PisellRating.less +20 -12
- package/lib/components/pisellRecordBoard/PisellRecordBoard.js +150 -0
- package/lib/components/pisellRecordBoard/README.md +183 -0
- package/lib/components/pisellRecordBoard/context/RecordBoardContext.js +8 -0
- package/lib/components/pisellRecordBoard/context/RecordBoardProvider.js +16 -0
- package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-design.md +128 -0
- package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-dev.md +82 -0
- package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.$tab-test.md +70 -0
- package/lib/components/pisellRecordBoard/docs/PisellRecordBoard.md +552 -0
- package/lib/components/pisellRecordBoard/hooks/useRecordBoardContext.d.ts +20 -0
- package/lib/components/pisellRecordBoard/hooks/useRecordBoardContext.js +17 -0
- package/lib/components/pisellRecordBoard/index.d.ts +40 -0
- package/lib/components/pisellRecordBoard/index.js +28 -0
- package/lib/components/pisellRecordBoard/layouts/CardLayout/CardList.d.ts +15 -0
- package/lib/components/pisellRecordBoard/layouts/CardLayout/CardList.js +26 -0
- package/lib/components/pisellRecordBoard/layouts/CardLayout/index.d.ts +15 -0
- package/lib/components/pisellRecordBoard/layouts/CardLayout/index.js +23 -0
- package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.d.ts +17 -0
- package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.js +107 -0
- package/lib/components/pisellRecordBoard/layouts/GridLayout/Grid.less +13 -0
- package/lib/components/pisellRecordBoard/layouts/GridLayout/index.d.ts +15 -0
- package/lib/components/pisellRecordBoard/layouts/GridLayout/index.js +23 -0
- package/lib/components/pisellRecordBoard/shellFrame/BatchActionBar/index.d.ts +12 -0
- package/lib/components/pisellRecordBoard/shellFrame/BatchActionBar/index.js +71 -0
- package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/ColumnSettingPopover.js +43 -0
- package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/index.js +62 -0
- package/lib/components/pisellRecordBoard/shellFrame/ColumnSetting/index.less +2 -0
- package/lib/components/pisellRecordBoard/shellFrame/Pagination/index.d.ts +17 -0
- package/lib/components/pisellRecordBoard/shellFrame/Pagination/index.js +54 -0
- package/lib/components/pisellRecordBoard/shellFrame/Pagination/index.less +61 -0
- package/lib/components/pisellRecordBoard/shellFrame/Search/index.d.ts +13 -0
- package/lib/components/pisellRecordBoard/shellFrame/Search/index.js +36 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +77 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.d.ts +14 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +139 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBarQuickFilter/index.js +64 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.d.ts +2 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +47 -0
- package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.less +41 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.d.ts +26 -0
- package/lib/components/pisellRecordBoard/shellFrame/index.js +40 -0
- package/lib/components/pisellRecordBoard/types.d.ts +259 -0
- package/lib/components/pisellRecordBoard/utils/recordBoardColumns.js +292 -0
- package/lib/components/pisellShellFrame/PisellShellFrame.d.ts +16 -0
- package/lib/components/pisellShellFrame/PisellShellFrame.js +62 -0
- package/lib/components/pisellShellFrame/PisellShellFrame.less +73 -0
- package/lib/components/pisellShellFrame/README.md +58 -0
- package/lib/components/pisellShellFrame/index.d.ts +2 -0
- package/lib/components/pisellShellFrame/types.d.ts +60 -0
- package/lib/components/pisellSingleSelect/PisellSingleSelect.less +88 -46
- package/lib/components/pisellSingleSelect/components/EditView.js +7 -0
- package/lib/components/pisellSingleSelect/components/ReadOnlyView.js +8 -2
- package/lib/components/pisellUrl/PisellUrl.d.ts +2 -33
- package/lib/components/pisellUrl/PisellUrl.js +1 -1
- package/lib/components/pisellUrl/PisellUrl.less +120 -11
- package/lib/components/pisellUrl/index.d.ts +1 -1
- package/lib/components/radio/index.d.ts +2 -2
- package/lib/components/section-footers/index.d.ts +2 -2
- package/lib/components/skeleton/index.d.ts +2 -2
- package/lib/components/sort/index.js +12 -1
- package/lib/components/sort/types.d.ts +8 -2
- package/lib/components/time-picker/index.d.ts +2 -2
- package/lib/components/upload/index.d.ts +2 -2
- package/lib/index.d.ts +19 -11
- package/lib/index.js +33 -25
- package/lib/locales/en-US.js +16 -2
- package/lib/locales/zh-CN.js +18 -4
- package/lib/locales/zh-TW.js +18 -4
- package/lib/utils/tagColor.js +32 -0
- package/package.json +3 -3
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: 组件
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: Data Display
|
|
7
|
+
order: 1
|
|
8
|
+
title: PisellRecordBoard
|
|
9
|
+
order: 1
|
|
10
|
+
category: pro
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# PisellRecordBoard 记录看板
|
|
14
|
+
|
|
15
|
+
记录看板容器组件,提供统一的列表数据、分页、搜索/筛选/排序、多选等上下文,支持 Grid(表格)与 Card 两种布局。
|
|
16
|
+
|
|
17
|
+
## 组件介绍
|
|
18
|
+
|
|
19
|
+
PisellRecordBoard 是列表类页面的**容器**,不直接渲染表格或卡片,而是通过 Context 向子组件提供 `data`、`pagination`、
|
|
20
|
+
`searchParams`、`onSearch`、多选等。ToolBar 左侧为快速筛选(QuickFilter)+ 搜索(PisellFind),右侧为排序、筛选弹层、重置;列配置(
|
|
21
|
+
`grid.columns`)可驱动筛选项与排序项,无需单独维护 filter 列表。
|
|
22
|
+
|
|
23
|
+
**核心特性**:
|
|
24
|
+
|
|
25
|
+
- 统一上下文(data、分页、搜索参数、多选)
|
|
26
|
+
- 列驱动筛选/排序(有 type 自动派生,无 type 可自定义 filter/sort)
|
|
27
|
+
- 支持有 type 时用 render/filter/sort 覆盖
|
|
28
|
+
- 快速筛选(左侧内联)+ 高级筛选(右侧弹层)
|
|
29
|
+
- 多选与 BatchActionBar
|
|
30
|
+
|
|
31
|
+
## 何时使用
|
|
32
|
+
|
|
33
|
+
- 列表页需要统一的搜索、筛选、排序、分页
|
|
34
|
+
- 希望用列配置自动生成筛选项与排序项,减少重复配置
|
|
35
|
+
- 需要表格 + 工具栏 + 多选操作栏 + 分页的完整布局
|
|
36
|
+
- 需要 Grid 与 Card 两种布局切换或单独使用
|
|
37
|
+
|
|
38
|
+
## 代码演示
|
|
39
|
+
|
|
40
|
+
### 基础用法(ShellFrame + GridLayout)
|
|
41
|
+
|
|
42
|
+
受控用法:由上层注入 `value`,子组件通过 Context 消费。
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import React, { useState } from 'react';
|
|
46
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
47
|
+
|
|
48
|
+
const list = [{ id: '1', orderNo: 'ORD001', status: 'enabled' }];
|
|
49
|
+
const columns = [
|
|
50
|
+
{ title: '订单号', dataIndex: 'orderNo', key: 'orderNo' },
|
|
51
|
+
{ title: '状态', dataIndex: 'status', key: 'status' },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export default () => {
|
|
55
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
56
|
+
const value = {
|
|
57
|
+
data: list,
|
|
58
|
+
loading: false,
|
|
59
|
+
total: 100,
|
|
60
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
61
|
+
onPageChange: () => {},
|
|
62
|
+
searchParams,
|
|
63
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
64
|
+
layoutType: 'grid' as const,
|
|
65
|
+
rowKey: 'id',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<PisellRecordBoard rowKey="id" {...value} grid={{ columns }}>
|
|
70
|
+
<PisellRecordBoard.ShellFrame>
|
|
71
|
+
<PisellRecordBoard.GridLayout />
|
|
72
|
+
</PisellRecordBoard.ShellFrame>
|
|
73
|
+
</PisellRecordBoard>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
列配置通过 `grid.columns` 传入;ToolBar 会根据 columns 自动派生筛选与排序。
|
|
79
|
+
|
|
80
|
+
### 列配置:有 type(自动派生)
|
|
81
|
+
|
|
82
|
+
传入 `type` 时,表格用对应 Pisell 组件只读渲染,筛选用编辑态,排序从组件 SortOptions 派生。
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import React, { useState } from 'react';
|
|
86
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
87
|
+
|
|
88
|
+
const list = [{ id: '1', orderNo: 'ORD001', status: 'enabled', createTime: '2024-01-01 12:00' }];
|
|
89
|
+
const columns = [
|
|
90
|
+
{ title: '订单号', dataIndex: 'orderNo', key: 'orderNo', width: 160, type: 'singleLineText' },
|
|
91
|
+
{
|
|
92
|
+
title: '状态',
|
|
93
|
+
dataIndex: 'status',
|
|
94
|
+
key: 'status',
|
|
95
|
+
type: 'singleSelect',
|
|
96
|
+
fieldProps: {
|
|
97
|
+
options: [
|
|
98
|
+
{ label: '全部', value: 'all' },
|
|
99
|
+
{ label: '启用', value: 'enabled' },
|
|
100
|
+
{ label: '禁用', value: 'disabled' },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
title: '下单时间',
|
|
106
|
+
dataIndex: 'createTime',
|
|
107
|
+
key: 'createTime',
|
|
108
|
+
type: 'dateTime',
|
|
109
|
+
fieldProps: { customFormat: 'YYYY-MM-DD HH:mm' },
|
|
110
|
+
filterable: true,
|
|
111
|
+
filter: { quickFilter: true },
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
export default () => {
|
|
116
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
117
|
+
const value = {
|
|
118
|
+
data: list,
|
|
119
|
+
loading: false,
|
|
120
|
+
total: 1,
|
|
121
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
122
|
+
onPageChange: () => {},
|
|
123
|
+
searchParams,
|
|
124
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
125
|
+
layoutType: 'grid' as const,
|
|
126
|
+
rowKey: 'id',
|
|
127
|
+
};
|
|
128
|
+
return (
|
|
129
|
+
<PisellRecordBoard
|
|
130
|
+
rowKey="id"
|
|
131
|
+
{...value}
|
|
132
|
+
grid={{ columns, scroll: { x: 1200 } }}
|
|
133
|
+
toolBar={{ search: true, quickFilter: true, filter: { hiddenQuickFilter: true } }}
|
|
134
|
+
>
|
|
135
|
+
<PisellRecordBoard.ShellFrame>
|
|
136
|
+
<PisellRecordBoard.GridLayout />
|
|
137
|
+
</PisellRecordBoard.ShellFrame>
|
|
138
|
+
</PisellRecordBoard>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 列配置:无 type(自定义 render / filter / sort)
|
|
144
|
+
|
|
145
|
+
不传 `type` 时,表格无自定义 render 则纯文本;筛选需配置 `filterable` + `filter`(type 或 component);排序需配置
|
|
146
|
+
`sortable` + `sort`。
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import React, { useState } from 'react';
|
|
150
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
151
|
+
|
|
152
|
+
const list = [{ id: '1', status: 'enabled' }];
|
|
153
|
+
const columns = [
|
|
154
|
+
{
|
|
155
|
+
title: '状态',
|
|
156
|
+
dataIndex: 'status',
|
|
157
|
+
key: 'status',
|
|
158
|
+
render: (val: string) => (val === 'enabled' ? '启用' : '禁用'),
|
|
159
|
+
filterable: true,
|
|
160
|
+
filter: {
|
|
161
|
+
type: 'single',
|
|
162
|
+
options: [
|
|
163
|
+
{ label: '全部', value: 'all' },
|
|
164
|
+
{ label: '启用', value: 'enabled' },
|
|
165
|
+
{ label: '禁用', value: 'disabled' },
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
sortable: true,
|
|
169
|
+
sort: {
|
|
170
|
+
getSortItems: (key: string) => [
|
|
171
|
+
{ key: `${key}:asc`, label: 'A-Z' },
|
|
172
|
+
{ key: `${key}:desc`, label: 'Z-A' },
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
|
|
178
|
+
export default () => {
|
|
179
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
180
|
+
const value = {
|
|
181
|
+
data: list,
|
|
182
|
+
loading: false,
|
|
183
|
+
total: 1,
|
|
184
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
185
|
+
onPageChange: () => {},
|
|
186
|
+
searchParams,
|
|
187
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
188
|
+
layoutType: 'grid' as const,
|
|
189
|
+
rowKey: 'id',
|
|
190
|
+
};
|
|
191
|
+
const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
|
|
192
|
+
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
193
|
+
return (
|
|
194
|
+
<PisellRecordBoard
|
|
195
|
+
rowKey="id"
|
|
196
|
+
{...value}
|
|
197
|
+
grid={{
|
|
198
|
+
columns,
|
|
199
|
+
selectedKeys,
|
|
200
|
+
selectedRows,
|
|
201
|
+
onSelectionChange: (keys, rows) => {
|
|
202
|
+
setSelectedKeys(keys);
|
|
203
|
+
setSelectedRows(rows);
|
|
204
|
+
},
|
|
205
|
+
}}
|
|
206
|
+
>
|
|
207
|
+
<PisellRecordBoard.ShellFrame>
|
|
208
|
+
<PisellRecordBoard.GridLayout />
|
|
209
|
+
</PisellRecordBoard.ShellFrame>
|
|
210
|
+
</PisellRecordBoard>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 无 type + 自定义筛选组件
|
|
216
|
+
|
|
217
|
+
筛选可传入 `filter.component`,组件需实现 `value` 与 `onChange`,由 Form 注入。
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import React, { useState } from 'react';
|
|
221
|
+
import { Input } from 'antd';
|
|
222
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
223
|
+
|
|
224
|
+
const MyFilterInput = ({
|
|
225
|
+
value,
|
|
226
|
+
onChange,
|
|
227
|
+
}: {
|
|
228
|
+
value?: string;
|
|
229
|
+
onChange?: (v: string) => void;
|
|
230
|
+
}) => (
|
|
231
|
+
<Input
|
|
232
|
+
{...value}
|
|
233
|
+
onChange={(e) => onChange?.(e.target.value)}
|
|
234
|
+
placeholder="自定义筛选"
|
|
235
|
+
/>
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
const list = [{ id: '1', remark: '备注内容' }];
|
|
239
|
+
const columns = [
|
|
240
|
+
{
|
|
241
|
+
title: '备注',
|
|
242
|
+
dataIndex: 'remark',
|
|
243
|
+
key: 'remark',
|
|
244
|
+
filterable: true,
|
|
245
|
+
filter: { component: MyFilterInput },
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
export default () => {
|
|
250
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
251
|
+
const value = {
|
|
252
|
+
data: list,
|
|
253
|
+
loading: false,
|
|
254
|
+
total: 1,
|
|
255
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
256
|
+
onPageChange: () => {},
|
|
257
|
+
searchParams,
|
|
258
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
259
|
+
layoutType: 'grid' as const,
|
|
260
|
+
rowKey: 'id',
|
|
261
|
+
};
|
|
262
|
+
const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
|
|
263
|
+
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
264
|
+
return (
|
|
265
|
+
<PisellRecordBoard
|
|
266
|
+
rowKey="id"
|
|
267
|
+
{...value}
|
|
268
|
+
grid={{
|
|
269
|
+
columns,
|
|
270
|
+
selectedKeys,
|
|
271
|
+
selectedRows,
|
|
272
|
+
onSelectionChange: (keys, rows) => {
|
|
273
|
+
setSelectedKeys(keys);
|
|
274
|
+
setSelectedRows(rows);
|
|
275
|
+
},
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
<PisellRecordBoard.ShellFrame>
|
|
279
|
+
<PisellRecordBoard.GridLayout />
|
|
280
|
+
</PisellRecordBoard.ShellFrame>
|
|
281
|
+
</PisellRecordBoard>
|
|
282
|
+
);
|
|
283
|
+
};
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### 有 type 时覆盖(render / filter / sort)
|
|
287
|
+
|
|
288
|
+
有 type 时也可传入 `render`、`filter`、`sort`,优先使用传入配置,覆盖自动派生。
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import React, { useState } from 'react';
|
|
292
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
293
|
+
|
|
294
|
+
const list = [{ id: '1', amount: 99.5 }];
|
|
295
|
+
const columns = [
|
|
296
|
+
{
|
|
297
|
+
title: '金额',
|
|
298
|
+
dataIndex: 'amount',
|
|
299
|
+
key: 'amount',
|
|
300
|
+
type: 'currency',
|
|
301
|
+
fieldProps: { precision: 2, currencySymbol: '¥' },
|
|
302
|
+
render: (val: number) => <span style={{ color: 'red' }}>¥{val}</span>,
|
|
303
|
+
},
|
|
304
|
+
];
|
|
305
|
+
|
|
306
|
+
export default () => {
|
|
307
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
308
|
+
const value = {
|
|
309
|
+
data: list,
|
|
310
|
+
loading: false,
|
|
311
|
+
total: 1,
|
|
312
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
313
|
+
onPageChange: () => {},
|
|
314
|
+
searchParams,
|
|
315
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
316
|
+
layoutType: 'grid' as const,
|
|
317
|
+
rowKey: 'id',
|
|
318
|
+
};
|
|
319
|
+
const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
|
|
320
|
+
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
321
|
+
return (
|
|
322
|
+
<PisellRecordBoard
|
|
323
|
+
rowKey="id"
|
|
324
|
+
{...value}
|
|
325
|
+
grid={{
|
|
326
|
+
columns,
|
|
327
|
+
selectedKeys,
|
|
328
|
+
selectedRows,
|
|
329
|
+
onSelectionChange: (keys, rows) => {
|
|
330
|
+
setSelectedKeys(keys);
|
|
331
|
+
setSelectedRows(rows);
|
|
332
|
+
},
|
|
333
|
+
}}
|
|
334
|
+
>
|
|
335
|
+
<PisellRecordBoard.ShellFrame>
|
|
336
|
+
<PisellRecordBoard.GridLayout />
|
|
337
|
+
</PisellRecordBoard.ShellFrame>
|
|
338
|
+
</PisellRecordBoard>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### 工具栏透传(搜索、QuickFilter、slots)
|
|
344
|
+
|
|
345
|
+
通过 `toolBar` 配置搜索、快速筛选、筛选弹层、排序,以及 `topLeft` / `topRight` 插槽。
|
|
346
|
+
|
|
347
|
+
```tsx
|
|
348
|
+
import React, { useState } from 'react';
|
|
349
|
+
import { Button } from 'antd';
|
|
350
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
351
|
+
|
|
352
|
+
const list = [{ id: '1', name: '示例' }];
|
|
353
|
+
const columns = [{ title: '名称', dataIndex: 'name', key: 'name' }];
|
|
354
|
+
|
|
355
|
+
export default () => {
|
|
356
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
357
|
+
const value = {
|
|
358
|
+
data: list,
|
|
359
|
+
loading: false,
|
|
360
|
+
total: 1,
|
|
361
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
362
|
+
onPageChange: () => {},
|
|
363
|
+
searchParams,
|
|
364
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
365
|
+
layoutType: 'grid' as const,
|
|
366
|
+
rowKey: 'id',
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
return (
|
|
370
|
+
<PisellRecordBoard
|
|
371
|
+
rowKey="id"
|
|
372
|
+
{...value}
|
|
373
|
+
grid={{ columns }}
|
|
374
|
+
toolBar={{
|
|
375
|
+
search: true,
|
|
376
|
+
quickFilter: true,
|
|
377
|
+
filter: { hiddenQuickFilter: true },
|
|
378
|
+
sort: true,
|
|
379
|
+
topLeft: <Button type="primary">新建</Button>,
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
<PisellRecordBoard.ShellFrame>
|
|
383
|
+
<PisellRecordBoard.GridLayout />
|
|
384
|
+
</PisellRecordBoard.ShellFrame>
|
|
385
|
+
</PisellRecordBoard>
|
|
386
|
+
);
|
|
387
|
+
};
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### 自定义组合(不用 ShellFrame)
|
|
391
|
+
|
|
392
|
+
可单独使用 ToolBar、BatchActionBar、Grid、Pagination 自由组合。
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
import React, { useState } from 'react';
|
|
396
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
397
|
+
|
|
398
|
+
const list = [{ id: '1', name: '示例' }];
|
|
399
|
+
const columns = [{ title: '名称', dataIndex: 'name', key: 'name' }];
|
|
400
|
+
|
|
401
|
+
export default () => {
|
|
402
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
403
|
+
const value = {
|
|
404
|
+
data: list,
|
|
405
|
+
loading: false,
|
|
406
|
+
total: 1,
|
|
407
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
408
|
+
onPageChange: () => {},
|
|
409
|
+
searchParams,
|
|
410
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
411
|
+
layoutType: 'grid' as const,
|
|
412
|
+
rowKey: 'id',
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
return (
|
|
416
|
+
<PisellRecordBoard rowKey="id" {...value} grid={{ columns }}>
|
|
417
|
+
<PisellRecordBoard.ToolBar />
|
|
418
|
+
<PisellRecordBoard.BatchActionBar />
|
|
419
|
+
<PisellRecordBoard.Grid />
|
|
420
|
+
<PisellRecordBoard.Pagination />
|
|
421
|
+
</PisellRecordBoard>
|
|
422
|
+
);
|
|
423
|
+
};
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### grid 透传 antd Table props
|
|
427
|
+
|
|
428
|
+
`grid` 类型为 **RecordBoardGridProps**,在自有字段(columns、scroll、size、selectedKeys、selectedRows、onSelectionChange)基础上,与 antd **TableProps** 做交叉类型并省略由 context 或组件自管的项(dataSource、loading、pagination、columns、scroll、size、rowSelection),因此支持 Table 其余 props 透传,如 `onRow`、`onHeaderRow`、`expandable`、`rowClassName`、`summary` 等。
|
|
429
|
+
|
|
430
|
+
### 自定义表格行点击(grid.onRow.onClick)
|
|
431
|
+
|
|
432
|
+
通过 `grid.onRow` 传入行属性,在 `onClick` 中处理行点击(如跳转详情、打开抽屉等)。下例为自包含示例,点击表格行会弹出当前行数据。
|
|
433
|
+
|
|
434
|
+
```tsx
|
|
435
|
+
import React, { useState } from 'react';
|
|
436
|
+
import { PisellRecordBoard } from '@pisell/materials';
|
|
437
|
+
|
|
438
|
+
type RowRecord = { id: string; orderNo: string; status: string; amount: number };
|
|
439
|
+
|
|
440
|
+
const list: RowRecord[] = [
|
|
441
|
+
{ id: '1', orderNo: 'ORD001', status: '已支付', amount: 99.9 },
|
|
442
|
+
{ id: '2', orderNo: 'ORD002', status: '待发货', amount: 199 },
|
|
443
|
+
{ id: '3', orderNo: 'ORD003', status: '已取消', amount: 0 },
|
|
444
|
+
];
|
|
445
|
+
|
|
446
|
+
const columns = [
|
|
447
|
+
{ title: '订单号', dataIndex: 'orderNo', key: 'orderNo' },
|
|
448
|
+
{ title: '状态', dataIndex: 'status', key: 'status' },
|
|
449
|
+
{ title: '金额', dataIndex: 'amount', key: 'amount' },
|
|
450
|
+
];
|
|
451
|
+
|
|
452
|
+
export default function TableOnRowClickExample() {
|
|
453
|
+
const [searchParams, setSearchParams] = useState<Record<string, unknown>>({});
|
|
454
|
+
const [selectedKeys, setSelectedKeys] = useState<React.Key[]>([]);
|
|
455
|
+
const [selectedRows, setSelectedRows] = useState<RowRecord[]>([]);
|
|
456
|
+
|
|
457
|
+
const value = {
|
|
458
|
+
data: list,
|
|
459
|
+
loading: false,
|
|
460
|
+
total: list.length,
|
|
461
|
+
pagination: { pageNumber: 1, pageSize: 10 },
|
|
462
|
+
onPageChange: () => {},
|
|
463
|
+
searchParams,
|
|
464
|
+
onSearch: (params: Record<string, unknown>) => setSearchParams(params),
|
|
465
|
+
onReset: () => setSearchParams({}),
|
|
466
|
+
layoutType: 'grid' as const,
|
|
467
|
+
rowKey: 'id',
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
return (
|
|
471
|
+
<PisellRecordBoard rowKey="id" {...value} grid={{
|
|
472
|
+
columns,
|
|
473
|
+
selectedKeys,
|
|
474
|
+
selectedRows,
|
|
475
|
+
onSelectionChange: (keys, rows) => {
|
|
476
|
+
setSelectedKeys(keys);
|
|
477
|
+
setSelectedRows(rows as RowRecord[]);
|
|
478
|
+
},
|
|
479
|
+
onRow: (record: RowRecord) => ({
|
|
480
|
+
onClick: () => {
|
|
481
|
+
// 自定义行点击:如跳转详情、打开抽屉等
|
|
482
|
+
console.log('行点击', record);
|
|
483
|
+
alert(`点击订单:${record.orderNo},状态:${record.status},金额:¥${record.amount}`);
|
|
484
|
+
},
|
|
485
|
+
}),
|
|
486
|
+
}}>
|
|
487
|
+
<PisellRecordBoard.ShellFrame>
|
|
488
|
+
<PisellRecordBoard.GridLayout />
|
|
489
|
+
</PisellRecordBoard.ShellFrame>
|
|
490
|
+
</PisellRecordBoard>
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## API
|
|
496
|
+
|
|
497
|
+
### PisellRecordBoard Props
|
|
498
|
+
|
|
499
|
+
| 属性 | 类型 | 说明 |
|
|
500
|
+
|----------|-----------------------------|------|
|
|
501
|
+
| rowKey | string \| (record) => Key | 行主键 |
|
|
502
|
+
| layoutType | 'grid' \| 'card' | 布局类型 |
|
|
503
|
+
| data / loading / total / pagination / onPageChange / searchParams / onSearch / onReset | 各自类型 | 打散的数据与回调 |
|
|
504
|
+
| grid / toolBar / search / paginationConfig / batchActionBar / cardList | 各自类型 | 打散的子组件配置。**grid** 类型为 RecordBoardGridProps(基于 TableProps 省略 dataSource/loading/pagination/columns/scroll/size/rowSelection),多选在 grid 内;支持 Table 透传:onRow、onHeaderRow、expandable、rowClassName、summary 等 |
|
|
505
|
+
|
|
506
|
+
### 子组件
|
|
507
|
+
|
|
508
|
+
| 子组件 | 说明 |
|
|
509
|
+
|-----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
|
510
|
+
| PisellRecordBoard.ShellFrame | 外壳:ToolBar + BatchActionBar + children(Layout) + Pagination;ToolBar 右侧可选列设置入口;分页使用定制样式(record-board-shell-frame-pagination) |
|
|
511
|
+
| PisellRecordBoard.GridLayout | 表格布局 |
|
|
512
|
+
| PisellRecordBoard.CardLayout | 卡片布局 |
|
|
513
|
+
| PisellRecordBoard.ToolBar | 工具栏(含搜索、QuickFilter、Sort、Filter、列设置、Reset、slots) |
|
|
514
|
+
| PisellRecordBoard.Search | 搜索槽 |
|
|
515
|
+
| PisellRecordBoard.Pagination | 分页槽 |
|
|
516
|
+
| PisellRecordBoard.Grid | 表格视图(支持 columnVisibility 列显示隐藏) |
|
|
517
|
+
| PisellRecordBoard.CardList | 卡片列表视图 |
|
|
518
|
+
| PisellRecordBoard.BatchActionBar | 多选操作栏 |
|
|
519
|
+
| PisellRecordBoard.useRecordBoardContext | 消费上下文的 Hook |
|
|
520
|
+
|
|
521
|
+
### 列配置(RecordBoardColumnType)
|
|
522
|
+
|
|
523
|
+
与 antd Table Column 兼容,额外支持:
|
|
524
|
+
|
|
525
|
+
| 属性 | 类型 | 说明 |
|
|
526
|
+
|------------|-------------------------------|----------------------------------------------------------------------------------------|
|
|
527
|
+
| type | RecordBoardFieldType | 字段类型,有则表格/筛选/排序自动派生 |
|
|
528
|
+
| fieldProps | object | 传给 Pisell 组件的 props;singleSelect/multipleSelect 支持 `options` 或 `getOptions`(同步/异步返回选项) |
|
|
529
|
+
| filterable | boolean | 是否参与筛选 |
|
|
530
|
+
| filter | RecordBoardColumnFilterConfig | 筛选配置(type 或 component);type 为 single 时支持 `options` 或 `getOptions` |
|
|
531
|
+
| sortable | boolean | 是否参与排序 |
|
|
532
|
+
| sort | { type?, getSortItems? } | 排序配置 |
|
|
533
|
+
|
|
534
|
+
- **选项类型**:`RecordBoardOptionItem` 为 `{ label, value, color? }`,只读态 Tag 可使用 `color`。`RecordBoardGetOptions`
|
|
535
|
+
为同步或异步返回选项列表的函数类型。
|
|
536
|
+
- **列显示隐藏**:`columnVisibility`、`onColumnVisibilityChange` 由容器内部维护并注入 Context;ToolBar 通过 `toolBar.columnSetting`(默认 true)控制是否展示列设置入口,Grid/CardList 按可见列渲染。不通过 props 传入。
|
|
537
|
+
|
|
538
|
+
### 列 type 与能力对照
|
|
539
|
+
|
|
540
|
+
| 能力 | 有 type | 无 type |
|
|
541
|
+
|------|---------------------------|-----------------------|
|
|
542
|
+
| 表格展示 | 自动只读组件;可传 render 覆盖 | 纯文本或自定义 render |
|
|
543
|
+
| 筛选 | 自动编辑态;可传 filter 覆盖 | 需 filterable + filter |
|
|
544
|
+
| 排序 | 自动 SortOptions;可传 sort 覆盖 | 需 sortable + sort |
|
|
545
|
+
|
|
546
|
+
## 相关文档
|
|
547
|
+
|
|
548
|
+
- [架构说明](./architecture.md)
|
|
549
|
+
- [列与筛选/排序绑定](./columns-filter-binding.md)
|
|
550
|
+
- [设计文档](./PisellRecordBoard.$tab-design.md)
|
|
551
|
+
- [开发文档](./PisellRecordBoard.$tab-dev.md)
|
|
552
|
+
- [测试文档](./PisellRecordBoard.$tab-test.md)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RecordBoardChildComponentProps, RecordBoardContextValue, RecordBoardGridProps } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/components/pisellRecordBoard/hooks/useRecordBoardContext.d.ts
|
|
4
|
+
interface UseRecordBoardContextOptions {
|
|
5
|
+
/** 子组件 displayName,用于从 childComponentProps 中取对应 props */
|
|
6
|
+
displayName?: keyof RecordBoardChildComponentProps;
|
|
7
|
+
/** 上层传入的 childComponentProps(若 Context 未提供则从参数传入) */
|
|
8
|
+
childComponentProps?: RecordBoardChildComponentProps;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 消费 RecordBoard 上下文,供各 layout 内子组件(Search / ToolBar / Grid / CardList / Pagination)使用。
|
|
12
|
+
* 若传入 displayName,返回会合并 childComponentProps[displayName] 便于透传。
|
|
13
|
+
* 当 displayName 为 'grid' 时,返回类型包含 RecordBoardGridProps(columns、scroll、size)。
|
|
14
|
+
*/
|
|
15
|
+
declare function useRecordBoardContext(options: UseRecordBoardContextOptions & {
|
|
16
|
+
displayName: 'grid';
|
|
17
|
+
}): RecordBoardContextValue & RecordBoardGridProps;
|
|
18
|
+
declare function useRecordBoardContext(options?: UseRecordBoardContextOptions): RecordBoardContextValue;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { useRecordBoardContext };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
2
|
+
import { RecordBoardContext } from "../context/RecordBoardContext.js";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/pisellRecordBoard/hooks/useRecordBoardContext.ts
|
|
6
|
+
function useRecordBoardContext(options = {}) {
|
|
7
|
+
const ctx = useContext(RecordBoardContext);
|
|
8
|
+
if (!ctx) throw new Error("useRecordBoardContext 必须在 PisellRecordBoard(或 RecordBoardProvider)下使用");
|
|
9
|
+
const { displayName, childComponentProps } = options;
|
|
10
|
+
const mergedChildProps = childComponentProps !== null && childComponentProps !== void 0 ? childComponentProps : ctx.childComponentProps;
|
|
11
|
+
if (displayName && (mergedChildProps === null || mergedChildProps === void 0 ? void 0 : mergedChildProps[displayName])) return _objectSpread2(_objectSpread2({}, ctx), mergedChildProps[displayName]);
|
|
12
|
+
return ctx;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { useRecordBoardContext };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RecordBoardChildComponentProps, RecordBoardColumnFilterConfig, RecordBoardColumnType, RecordBoardContextValue, RecordBoardFieldType, RecordBoardGetOptions, RecordBoardGridProps, RecordBoardLayoutType, RecordBoardOptionItem, RecordBoardProps } from "./types.js";
|
|
2
|
+
import { RecordBoardGridView } from "./layouts/GridLayout/Grid.js";
|
|
3
|
+
import { GridLayout } from "./layouts/GridLayout/index.js";
|
|
4
|
+
import { RecordBoardCardList } from "./layouts/CardLayout/CardList.js";
|
|
5
|
+
import { CardLayout } from "./layouts/CardLayout/index.js";
|
|
6
|
+
import { RecordBoardToolBar } from "./shellFrame/ToolBar/index.js";
|
|
7
|
+
import { RecordBoardBatchActionBar } from "./shellFrame/BatchActionBar/index.js";
|
|
8
|
+
import { RecordBoardPagination } from "./shellFrame/Pagination/index.js";
|
|
9
|
+
import { RecordBoardSearch } from "./shellFrame/Search/index.js";
|
|
10
|
+
import { RecordBoardShellFrame } from "./shellFrame/index.js";
|
|
11
|
+
import { useRecordBoardContext } from "./hooks/useRecordBoardContext.js";
|
|
12
|
+
import React from "react";
|
|
13
|
+
|
|
14
|
+
//#region src/components/pisellRecordBoard/index.d.ts
|
|
15
|
+
/** RecordBoard 复合组件类型 */
|
|
16
|
+
interface PisellRecordBoardType extends React.FC<RecordBoardProps> {
|
|
17
|
+
/** Shell Frame:对 Layout 的扩展,提供 ToolBar + BatchActionBar + children(Layout) */
|
|
18
|
+
ShellFrame: typeof RecordBoardShellFrame;
|
|
19
|
+
/** Grid 布局:仅内容区(表格 + 分页),需配合 ShellFrame 使用 */
|
|
20
|
+
GridLayout: typeof GridLayout;
|
|
21
|
+
/** 卡片布局:仅内容区(卡片列表 + 分页),需配合 ShellFrame 使用 */
|
|
22
|
+
CardLayout: typeof CardLayout;
|
|
23
|
+
/** 单独使用:搜索槽(PisellFind,绑定 searchParams.keyword / onSearch) */
|
|
24
|
+
Search: typeof RecordBoardSearch;
|
|
25
|
+
/** 单独使用:工具栏(PisellToolBar,含搜索/导出,可透传 topLeft/topRight 等) */
|
|
26
|
+
ToolBar: typeof RecordBoardToolBar;
|
|
27
|
+
/** 单独使用:分页槽 */
|
|
28
|
+
Pagination: typeof RecordBoardPagination;
|
|
29
|
+
/** 单独使用:Grid 视图(表格) */
|
|
30
|
+
Grid: typeof RecordBoardGridView;
|
|
31
|
+
/** 单独使用:卡片列表视图 */
|
|
32
|
+
CardList: typeof RecordBoardCardList;
|
|
33
|
+
/** 多选操作栏(基于 PisellBatchActionBar,有选中项时展示) */
|
|
34
|
+
BatchActionBar: typeof RecordBoardBatchActionBar;
|
|
35
|
+
/** 消费 RecordBoard 上下文 */
|
|
36
|
+
useRecordBoardContext: typeof useRecordBoardContext;
|
|
37
|
+
}
|
|
38
|
+
declare const PisellRecordBoard: PisellRecordBoardType;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { PisellRecordBoard };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import PisellRecordBoard_default from "./PisellRecordBoard.js";
|
|
2
|
+
import { useRecordBoardContext } from "./hooks/useRecordBoardContext.js";
|
|
3
|
+
import Grid_default from "./layouts/GridLayout/Grid.js";
|
|
4
|
+
import GridLayout_default from "./layouts/GridLayout/index.js";
|
|
5
|
+
import CardList_default from "./layouts/CardLayout/CardList.js";
|
|
6
|
+
import CardLayout_default from "./layouts/CardLayout/index.js";
|
|
7
|
+
import ToolBar_default from "./shellFrame/ToolBar/index.js";
|
|
8
|
+
import BatchActionBar_default from "./shellFrame/BatchActionBar/index.js";
|
|
9
|
+
import Pagination_default from "./shellFrame/Pagination/index.js";
|
|
10
|
+
import Search_default from "./shellFrame/Search/index.js";
|
|
11
|
+
import shellFrame_default from "./shellFrame/index.js";
|
|
12
|
+
|
|
13
|
+
//#region src/components/pisellRecordBoard/index.tsx
|
|
14
|
+
const PisellRecordBoard = PisellRecordBoard_default;
|
|
15
|
+
PisellRecordBoard.ShellFrame = shellFrame_default;
|
|
16
|
+
PisellRecordBoard.GridLayout = GridLayout_default;
|
|
17
|
+
PisellRecordBoard.CardLayout = CardLayout_default;
|
|
18
|
+
PisellRecordBoard.Search = Search_default;
|
|
19
|
+
PisellRecordBoard.ToolBar = ToolBar_default;
|
|
20
|
+
PisellRecordBoard.Pagination = Pagination_default;
|
|
21
|
+
PisellRecordBoard.Grid = Grid_default;
|
|
22
|
+
PisellRecordBoard.CardList = CardList_default;
|
|
23
|
+
PisellRecordBoard.BatchActionBar = BatchActionBar_default;
|
|
24
|
+
PisellRecordBoard.useRecordBoardContext = useRecordBoardContext;
|
|
25
|
+
var pisellRecordBoard_default = PisellRecordBoard;
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { pisellRecordBoard_default as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RecordBoardContextValue } from "../../types.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/pisellRecordBoard/layouts/CardLayout/CardList.d.ts
|
|
5
|
+
interface RecordBoardCardListProps extends Partial<Pick<RecordBoardContextValue, 'data' | 'loading'>> {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
render?: (ctx: RecordBoardContextValue) => React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Card 布局下的数据视图:从 context 取 data / loading。
|
|
12
|
+
*/
|
|
13
|
+
declare const RecordBoardCardList: React.FC<RecordBoardCardListProps>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { RecordBoardCardList };
|