@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,259 @@
|
|
|
1
|
+
import { TableProps } from "antd";
|
|
2
|
+
import { ComponentType, Key, ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/pisellRecordBoard/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 布局类型:一种 layout 对应一种「视图的集合」
|
|
7
|
+
* - grid: 搜索 + 表格 + 分页
|
|
8
|
+
* - card: 搜索 + 卡片列表 + 分页
|
|
9
|
+
* 后续可扩展 list、kanban 等
|
|
10
|
+
*/
|
|
11
|
+
type RecordBoardLayoutType = 'grid' | 'card';
|
|
12
|
+
/**
|
|
13
|
+
* 列字段类型:对应 Pisell 表单组件,传入列 type 时用该组件自动渲染列(只读)与筛选项(编辑)
|
|
14
|
+
*/
|
|
15
|
+
type RecordBoardFieldType = 'singleLineText' | 'longText' | 'email' | 'phone' | 'url' | 'number' | 'currency' | 'percent' | 'rating' | 'singleSelect' | 'multipleSelect' | 'dateTime';
|
|
16
|
+
/** 无 type 时筛选项可传入自定义组件,需支持 value / onChange 以接入 Form */
|
|
17
|
+
type RecordBoardFilterComponentProps = {
|
|
18
|
+
value?: any;
|
|
19
|
+
onChange?: (value: any) => void;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
/** 选项格式,用于 getOptions / options;color 用于只读态 Tag 展示 */
|
|
23
|
+
type RecordBoardOptionItem = {
|
|
24
|
+
label: string;
|
|
25
|
+
value: any; /** 只读态 Tag 颜色,如 '#e6f7ff' 或 antd 预设 'blue' */
|
|
26
|
+
color?: string;
|
|
27
|
+
};
|
|
28
|
+
/** 同步或异步返回选项列表,singleSelect/multipleSelect 的 fieldProps.getOptions 或 filter.getOptions 使用 */
|
|
29
|
+
type RecordBoardGetOptions = (() => RecordBoardOptionItem[]) | (() => Promise<RecordBoardOptionItem[]>);
|
|
30
|
+
/** 列筛选配置:不传列 type 时使用。可配置 type + options/props,或传入 component(接收 value/onChange)。 */
|
|
31
|
+
interface RecordBoardColumnFilterConfig {
|
|
32
|
+
type?: 'single' | 'input' | 'datePicker' | 'rangePicker' | 'search';
|
|
33
|
+
label?: string;
|
|
34
|
+
options?: RecordBoardOptionItem[];
|
|
35
|
+
/** 同步或异步获取选项,与 options 二选一;支持 singleSelect/multipleSelect 及无 type 时 type:'single' */
|
|
36
|
+
getOptions?: RecordBoardGetOptions;
|
|
37
|
+
props?: Record<string, any>;
|
|
38
|
+
/** 放在快速筛选(true)还是高级筛选(false) */
|
|
39
|
+
quickFilter?: boolean;
|
|
40
|
+
/** 无 type 时可用:自定义筛选组件,由 Form 注入 value/onChange */
|
|
41
|
+
component?: ComponentType<RecordBoardFilterComponentProps>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* RecordBoard 列类型扩展(与 antd Table Column 兼容,仅增加可选字段)。
|
|
45
|
+
*
|
|
46
|
+
* 有 type(如 singleLineText)时:
|
|
47
|
+
* - 表格:自动用对应 Pisell 组件只读渲染;传入 render 则优先使用(覆盖)。
|
|
48
|
+
* - 筛选:自动用对应组件编辑态;传入 filter(type 或 component)则优先使用(覆盖)。
|
|
49
|
+
* - 排序:自动从组件 SortOptions 派生;传入 sort 则优先使用(覆盖)。
|
|
50
|
+
*
|
|
51
|
+
* 无 type 时:
|
|
52
|
+
* - 表格:无 render 则纯文本;可自定义 render。
|
|
53
|
+
* - 筛选:需配置 filterable + filter(type 或 component,component 需 value/onChange)。
|
|
54
|
+
* - 排序:需配置 sortable + sort(type 或 getSortItems)。
|
|
55
|
+
*/
|
|
56
|
+
interface RecordBoardColumnType<RecordType = any> {
|
|
57
|
+
title?: ReactNode;
|
|
58
|
+
dataIndex?: string | string[];
|
|
59
|
+
key?: string;
|
|
60
|
+
width?: number | string;
|
|
61
|
+
align?: 'left' | 'right' | 'center';
|
|
62
|
+
fixed?: 'left' | 'right' | boolean;
|
|
63
|
+
ellipsis?: boolean;
|
|
64
|
+
/** 列渲染;无 type 时必靠此或默认纯文本;有 type 时可选,传入则覆盖自动派生 */
|
|
65
|
+
render?: (value: any, record: RecordType, index: number) => ReactNode;
|
|
66
|
+
/** 其他 antd 列属性 */
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
/** 字段类型;传入则表格/筛选/排序自动派生,可被 render/filter/sort 覆盖 */
|
|
69
|
+
type?: RecordBoardFieldType;
|
|
70
|
+
/**
|
|
71
|
+
* 传给 Pisell 组件的额外 props(type 存在且未用 filter/render 覆盖时生效)。
|
|
72
|
+
* singleSelect/multipleSelect 时支持 options 或 getOptions(同步/异步返回选项列表)。
|
|
73
|
+
*/
|
|
74
|
+
fieldProps?: Record<string, any>;
|
|
75
|
+
/** 是否参与筛选;false 时不生成筛项;有 type 时默认 true */
|
|
76
|
+
filterable?: boolean;
|
|
77
|
+
/** 筛选配置;无 type 时必传 type 或 component;有 type 时可选,传入则覆盖自动派生 */
|
|
78
|
+
filter?: RecordBoardColumnFilterConfig;
|
|
79
|
+
/** 是否参与排序;false 时不生成排序项;有 type 时默认 true */
|
|
80
|
+
sortable?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* 排序配置;无 type 时需 sortable + sort;有 type 时可选,传入则覆盖自动派生。
|
|
83
|
+
* - type:内置排序子项(string/number/option 等)。
|
|
84
|
+
* - getSortItems:(fieldKey) => [{ key, label }]。
|
|
85
|
+
*/
|
|
86
|
+
sort?: {
|
|
87
|
+
type?: 'date' | 'string' | 'number' | 'option';
|
|
88
|
+
label?: string;
|
|
89
|
+
isHidden?: boolean; /** 自定义排序子项,优先于 type;fieldKey 为列 key/dataIndex */
|
|
90
|
+
getSortItems?: (fieldKey: string) => Array<{
|
|
91
|
+
key: string;
|
|
92
|
+
label: string;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 分页状态(与容器内部一致)
|
|
98
|
+
*/
|
|
99
|
+
interface RecordBoardPaginationState {
|
|
100
|
+
pageNumber: number;
|
|
101
|
+
pageSize: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* RecordBoard 容器 Context 值
|
|
105
|
+
* 与具体 layout 类型无关,所有 layout 共用同一套数据与操作
|
|
106
|
+
*/
|
|
107
|
+
interface RecordBoardContextValue {
|
|
108
|
+
/** 当前列表数据 */
|
|
109
|
+
data: any[];
|
|
110
|
+
/** 加载态 */
|
|
111
|
+
loading: boolean;
|
|
112
|
+
/** 总数(用于分页) */
|
|
113
|
+
total: number;
|
|
114
|
+
/** 分页状态 */
|
|
115
|
+
pagination: RecordBoardPaginationState;
|
|
116
|
+
/** 分页变更 */
|
|
117
|
+
onPageChange: (pageNumber: number, pageSize: number) => void;
|
|
118
|
+
/** 搜索/筛选参数 */
|
|
119
|
+
searchParams: Record<string, any>;
|
|
120
|
+
/** 触发搜索(会重置到第一页) */
|
|
121
|
+
onSearch: (params: Record<string, any>) => void;
|
|
122
|
+
/** 重置搜索 */
|
|
123
|
+
onReset?: () => void;
|
|
124
|
+
/** 当前布局类型,供子组件按需做差异化 */
|
|
125
|
+
layoutType: RecordBoardLayoutType;
|
|
126
|
+
/** 多选:当前选中的 key 列表 */
|
|
127
|
+
selectedKeys: Key[];
|
|
128
|
+
/** 多选:当前选中的行数据 */
|
|
129
|
+
selectedRows: any[];
|
|
130
|
+
/** 多选:选择变更回调(表格/卡片勾选、BatchActionBar 全选/清空/反选时调用) */
|
|
131
|
+
onSelectionChange: (keys: Key[], rows: any[]) => void;
|
|
132
|
+
/** 行主键,用于多选与列表渲染,如 'id' 或 (record) => record.id */
|
|
133
|
+
rowKey?: string | ((record: any) => Key);
|
|
134
|
+
/**
|
|
135
|
+
* 列显示隐藏状态(仅影响表格/卡片列展示,不影响 filter/sort 配置)。
|
|
136
|
+
* key 为列 key/dataIndex,value 为是否显示;未出现的列默认显示。
|
|
137
|
+
*/
|
|
138
|
+
columnVisibility?: Record<string, boolean>;
|
|
139
|
+
/** 列显示隐藏变更回调 */
|
|
140
|
+
onColumnVisibilityChange?: (visibility: Record<string, boolean>) => void;
|
|
141
|
+
/** 各子组件透传 props,由 Provider 注入 */
|
|
142
|
+
childComponentProps?: RecordBoardChildComponentProps;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 各 layout 下子组件的可选透传配置(类似 ChildComponentProps)
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* BatchActionBar 透传配置,与 PisellBatchActionBar 的 props 对齐。
|
|
149
|
+
* 具体类型见 PisellBatchActionBarProps,此处仅做透传用。
|
|
150
|
+
*/
|
|
151
|
+
type RecordBoardBatchActionBarProps = Record<string, any>;
|
|
152
|
+
/** Filter 透传配置,与 PisellFilter 的 props 对齐 */
|
|
153
|
+
type RecordBoardFilterProps = Record<string, any>;
|
|
154
|
+
/**
|
|
155
|
+
* ToolBar 透传配置。
|
|
156
|
+
* - 继承 PisellToolBar 的 slots:topLeft、topRight、bottomLeft、bottomRight、tabs。
|
|
157
|
+
* - search:默认在工具栏内渲染 PisellFind;为对象时透传为 PisellFind 的 props;为 false 时不渲染搜索。
|
|
158
|
+
* - filter:默认在工具栏右侧渲染 PisellFilter;为对象时透传 PisellFilter props;为 false 时不渲染。筛选值绑定 searchParams.filter,变更触发 onSearch。
|
|
159
|
+
*/
|
|
160
|
+
interface RecordBoardToolBarProps {
|
|
161
|
+
className?: string;
|
|
162
|
+
style?: React.CSSProperties;
|
|
163
|
+
tabs?: React.ReactNode;
|
|
164
|
+
topLeft?: React.ReactNode;
|
|
165
|
+
topRight?: React.ReactNode;
|
|
166
|
+
bottomLeft?: React.ReactNode;
|
|
167
|
+
bottomRight?: React.ReactNode;
|
|
168
|
+
/** 在 ToolBar 内渲染搜索:默认 PisellFind;对象透传 PisellFind props;false 不渲染 */
|
|
169
|
+
search?: boolean | RecordBoardSearchProps;
|
|
170
|
+
/** 在 ToolBar 右侧渲染筛选:默认 PisellFilter;对象透传 PisellFilter props;false 不渲染。值存于 searchParams.filter */
|
|
171
|
+
filter?: boolean | RecordBoardFilterProps;
|
|
172
|
+
/** 在 ToolBar 内、筛选左侧渲染排序:默认 Sort;对象可传 list、placement 等;false 不渲染。值存于 searchParams.sort */
|
|
173
|
+
sort?: boolean | Record<string, any>;
|
|
174
|
+
/**
|
|
175
|
+
* 在 ToolBar 左侧展示内联快速筛选(替代 Filter 弹层内的 quickFilter)。
|
|
176
|
+
* 为 true 时使用 columns 派生的 quickFilter 列表;为对象时可传 filterList、formFiltersPrefix、size 等。
|
|
177
|
+
* 启用后建议对 filter 传 hiddenQuickFilter: true,弹层内仅保留高级筛选。
|
|
178
|
+
*/
|
|
179
|
+
quickFilter?: boolean | Record<string, any>;
|
|
180
|
+
/** 列显示隐藏设置入口;默认 true(有 grid.columns 时显示);false 时不渲染 */
|
|
181
|
+
columnSetting?: boolean;
|
|
182
|
+
}
|
|
183
|
+
/** Search 透传配置,与 PisellFind 的 props 对齐 */
|
|
184
|
+
type RecordBoardSearchProps = Record<string, any>;
|
|
185
|
+
/**
|
|
186
|
+
* Grid 布局透传配置,对应 RecordBoardGridView 的 props(useRecordBoardContext('grid') 会将其合并到 context)。
|
|
187
|
+
* 基于 antd TableProps,省略由 context 注入或组件自管的项(dataSource、loading、pagination、columns、scroll、size、rowSelection)。
|
|
188
|
+
* 多选用 selectedKeys/selectedRows/onSelectionChange;其余 Table props(如 onRow、onHeaderRow、expandable、rowClassName、summary)透传。
|
|
189
|
+
*/
|
|
190
|
+
type RecordBoardGridProps = {
|
|
191
|
+
/** 列配置;ToolBar 据此派生筛选与排序,ColumnSetting 据此做列显示隐藏 */columns?: RecordBoardColumnType[]; /** 默认隐藏的列 key 列表(对应 columns 的 key 或 dataIndex),用于初始化列显隐状态 */
|
|
192
|
+
defaultHiddenColumnKeys?: string[]; /** 表格滚动配置,同 antd Table scroll */
|
|
193
|
+
scroll?: {
|
|
194
|
+
x?: number | string;
|
|
195
|
+
y?: number | string;
|
|
196
|
+
}; /** 表格尺寸 */
|
|
197
|
+
size?: 'small' | 'middle' | 'default'; /** 当前选中的行 key 列表(多选) */
|
|
198
|
+
selectedKeys?: Key[]; /** 当前选中的行数据(多选) */
|
|
199
|
+
selectedRows?: unknown[]; /** 多选变更回调 */
|
|
200
|
+
onSelectionChange?: (keys: Key[], rows: unknown[]) => void;
|
|
201
|
+
} & Omit<TableProps<unknown>, 'dataSource' | 'loading' | 'pagination' | 'columns' | 'scroll' | 'size' | 'rowSelection'>;
|
|
202
|
+
interface RecordBoardChildComponentProps {
|
|
203
|
+
/** 搜索配置,透传给 PisellFind;关键词绑定 searchParams.keyword */
|
|
204
|
+
search?: RecordBoardSearchProps;
|
|
205
|
+
/** 工具栏配置,透传给 PisellToolBar;内置搜索会接 context.searchParams/onSearch */
|
|
206
|
+
toolBar?: RecordBoardToolBarProps;
|
|
207
|
+
pagination?: Record<string, any>;
|
|
208
|
+
/** Grid 布局配置:列、滚动、尺寸等,透传给 RecordBoardGridView */
|
|
209
|
+
grid?: RecordBoardGridProps;
|
|
210
|
+
cardList?: Record<string, any>;
|
|
211
|
+
/** 多选操作栏配置,透传给 PisellBatchActionBar */
|
|
212
|
+
batchActionBar?: RecordBoardBatchActionBarProps;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* RecordBoard 容器 Props。
|
|
216
|
+
* 仅打散传参:列表/分页/搜索/多选/列显隐、以及 grid/toolBar/search/paginationConfig/batchActionBar/cardList 独立传入。
|
|
217
|
+
*/
|
|
218
|
+
interface RecordBoardProps {
|
|
219
|
+
/** 子节点,一般为某种 Layout 或自定义组合 */
|
|
220
|
+
children?: ReactNode;
|
|
221
|
+
/** 当前使用的布局类型 */
|
|
222
|
+
layoutType?: RecordBoardLayoutType;
|
|
223
|
+
/** 行主键,用于多选与列表 */
|
|
224
|
+
rowKey?: string | ((record: any) => Key);
|
|
225
|
+
/** 当前列表数据 */
|
|
226
|
+
data?: any[];
|
|
227
|
+
/** 加载态 */
|
|
228
|
+
loading?: boolean;
|
|
229
|
+
/** 总数(用于分页) */
|
|
230
|
+
total?: number;
|
|
231
|
+
/** 分页状态 */
|
|
232
|
+
pagination?: RecordBoardPaginationState;
|
|
233
|
+
/** 分页变更 */
|
|
234
|
+
onPageChange?: (pageNumber: number, pageSize: number) => void;
|
|
235
|
+
/** 搜索/筛选参数 */
|
|
236
|
+
searchParams?: Record<string, any>;
|
|
237
|
+
/** 触发搜索(会重置到第一页) */
|
|
238
|
+
onSearch?: (params: Record<string, any>) => void;
|
|
239
|
+
/** 重置搜索 */
|
|
240
|
+
onReset?: () => void;
|
|
241
|
+
/** Grid 配置:列、滚动、尺寸等 */
|
|
242
|
+
grid?: RecordBoardGridProps;
|
|
243
|
+
/** 工具栏配置 */
|
|
244
|
+
toolBar?: RecordBoardToolBarProps;
|
|
245
|
+
/** 搜索配置,透传给 PisellFind */
|
|
246
|
+
search?: RecordBoardSearchProps;
|
|
247
|
+
/** 分页组件透传配置(与 pagination 状态区分,此处为 Pagination 组件 props) */
|
|
248
|
+
paginationConfig?: Record<string, any>;
|
|
249
|
+
/** 多选操作栏配置 */
|
|
250
|
+
batchActionBar?: RecordBoardBatchActionBarProps;
|
|
251
|
+
/** 卡片列表配置 */
|
|
252
|
+
cardList?: Record<string, any>;
|
|
253
|
+
/** 是否启用分页(与 pagination 状态区分) */
|
|
254
|
+
enablePagination?: boolean;
|
|
255
|
+
/** 其他 */
|
|
256
|
+
[key: string]: any;
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
export { RecordBoardChildComponentProps, RecordBoardColumnFilterConfig, RecordBoardColumnType, RecordBoardContextValue, RecordBoardFieldType, RecordBoardGetOptions, RecordBoardGridProps, RecordBoardLayoutType, RecordBoardOptionItem, RecordBoardProps, RecordBoardToolBarProps };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_objectSpread2 = require('../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
|
|
3
|
+
const require_PisellSingleLineText = require('../../pisellSingleLineText/PisellSingleLineText.js');
|
|
4
|
+
const require_PisellLongText = require('../../pisellLongText/PisellLongText.js');
|
|
5
|
+
const require_PisellEmail = require('../../pisellEmail/PisellEmail.js');
|
|
6
|
+
const require_PisellPhone = require('../../pisellPhone/PisellPhone.js');
|
|
7
|
+
const require_PisellUrl = require('../../pisellUrl/PisellUrl.js');
|
|
8
|
+
const require_PisellNumber = require('../../pisellNumber/PisellNumber.js');
|
|
9
|
+
const require_PisellCurrency = require('../../pisellCurrency/PisellCurrency.js');
|
|
10
|
+
const require_PisellPercent = require('../../pisellPercent/PisellPercent.js');
|
|
11
|
+
const require_PisellRating = require('../../pisellRating/PisellRating.js');
|
|
12
|
+
const require_PisellSingleSelect = require('../../pisellSingleSelect/PisellSingleSelect.js');
|
|
13
|
+
const require_PisellMultipleSelect = require('../../pisellMultipleSelect/PisellMultipleSelect.js');
|
|
14
|
+
const require_PisellDateTimeDisplay = require('../../pisellDateTimeDisplay/PisellDateTimeDisplay.js');
|
|
15
|
+
let react = require("react");
|
|
16
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
17
|
+
|
|
18
|
+
//#region src/components/pisellRecordBoard/utils/recordBoardColumns.tsx
|
|
19
|
+
const FIELD_TYPE_TO_READ_COMPONENT = {
|
|
20
|
+
singleLineText: require_PisellSingleLineText.default,
|
|
21
|
+
longText: require_PisellLongText.default,
|
|
22
|
+
email: require_PisellEmail.default,
|
|
23
|
+
phone: require_PisellPhone.default,
|
|
24
|
+
url: require_PisellUrl.default,
|
|
25
|
+
number: require_PisellNumber.default,
|
|
26
|
+
currency: require_PisellCurrency.default,
|
|
27
|
+
percent: require_PisellPercent.default,
|
|
28
|
+
rating: require_PisellRating.default,
|
|
29
|
+
singleSelect: require_PisellSingleSelect.default,
|
|
30
|
+
multipleSelect: require_PisellMultipleSelect.default,
|
|
31
|
+
dateTime: require_PisellDateTimeDisplay.default
|
|
32
|
+
};
|
|
33
|
+
/** 列 type 对应排序类型默认值(组件未导出 SortOptions 时使用) */
|
|
34
|
+
const FIELD_TYPE_TO_SORT_OPTIONS_DEFAULT = {
|
|
35
|
+
singleLineText: { type: "string" },
|
|
36
|
+
longText: { type: "string" },
|
|
37
|
+
email: { type: "string" },
|
|
38
|
+
phone: { type: "string" },
|
|
39
|
+
url: { type: "string" },
|
|
40
|
+
number: { type: "number" },
|
|
41
|
+
currency: { type: "number" },
|
|
42
|
+
percent: { type: "number" },
|
|
43
|
+
rating: { type: "number" },
|
|
44
|
+
singleSelect: { type: "option" },
|
|
45
|
+
multipleSelect: { type: "option" },
|
|
46
|
+
dateTime: { type: "date" }
|
|
47
|
+
};
|
|
48
|
+
/** 从组件或默认值取排序配置;组件可挂载 SortOptions.getSortItems(内置完整排序项)或 SortOptions.type */
|
|
49
|
+
function getSortOptionForFieldType(fieldType) {
|
|
50
|
+
const Com = FIELD_TYPE_TO_READ_COMPONENT[fieldType];
|
|
51
|
+
const fromComponent = Com && Com.SortOptions;
|
|
52
|
+
const fallback = FIELD_TYPE_TO_SORT_OPTIONS_DEFAULT[fieldType];
|
|
53
|
+
const opts = fromComponent !== null && fromComponent !== void 0 ? fromComponent : fallback;
|
|
54
|
+
return opts ? require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, fallback), opts) : null;
|
|
55
|
+
}
|
|
56
|
+
/** 列 type 对应到 FilterItem 的 type(用于不传 type 时的手动 filter 或派生筛选项的兼容形态) */
|
|
57
|
+
const FIELD_TYPE_TO_FILTER_TYPE = {
|
|
58
|
+
singleLineText: "input",
|
|
59
|
+
longText: "input",
|
|
60
|
+
email: "input",
|
|
61
|
+
phone: "input",
|
|
62
|
+
url: "input",
|
|
63
|
+
number: "input",
|
|
64
|
+
currency: "input",
|
|
65
|
+
percent: "input",
|
|
66
|
+
rating: "single",
|
|
67
|
+
singleSelect: "single",
|
|
68
|
+
multipleSelect: "single",
|
|
69
|
+
dateTime: "rangePicker"
|
|
70
|
+
};
|
|
71
|
+
function getColumnKey(column) {
|
|
72
|
+
var _column$key;
|
|
73
|
+
const key = (_column$key = column.key) !== null && _column$key !== void 0 ? _column$key : Array.isArray(column.dataIndex) ? column.dataIndex.join(".") : column.dataIndex;
|
|
74
|
+
return typeof key === "string" ? key : "";
|
|
75
|
+
}
|
|
76
|
+
/** 获取列唯一 key,供列显示隐藏等使用 */
|
|
77
|
+
function getRecordBoardColumnKey(column) {
|
|
78
|
+
return getColumnKey(column);
|
|
79
|
+
}
|
|
80
|
+
function getColumnLabel(column) {
|
|
81
|
+
const title = column.title;
|
|
82
|
+
if (typeof title === "string") return title;
|
|
83
|
+
return getColumnKey(column) || "";
|
|
84
|
+
}
|
|
85
|
+
function normalizeOptions(list) {
|
|
86
|
+
if (!Array.isArray(list)) return [];
|
|
87
|
+
return list.map((item) => item && typeof item === "object" && "label" in item && "value" in item ? {
|
|
88
|
+
label: String(item.label),
|
|
89
|
+
value: item.value
|
|
90
|
+
} : {
|
|
91
|
+
label: String(item),
|
|
92
|
+
value: item
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 只读单元格:当列使用 getOptions(异步)时,先解析选项再渲染 Pisell 只读组件。
|
|
97
|
+
*/
|
|
98
|
+
function AsyncOptionsReadCell({ getOptions, value, fieldType, fieldProps }) {
|
|
99
|
+
const [options, setOptions] = (0, react.useState)([]);
|
|
100
|
+
const Com = FIELD_TYPE_TO_READ_COMPONENT[fieldType];
|
|
101
|
+
(0, react.useEffect)(() => {
|
|
102
|
+
const result = getOptions();
|
|
103
|
+
Promise.resolve(result).then((list) => setOptions(normalizeOptions(list)));
|
|
104
|
+
}, [getOptions]);
|
|
105
|
+
if (Com == null) return value;
|
|
106
|
+
const common = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({ value }, fieldProps), {}, { options });
|
|
107
|
+
if (fieldType === "singleSelect" || fieldType === "multipleSelect") return /* @__PURE__ */ react.default.createElement(Com, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, common), {}, { readOnly: true }));
|
|
108
|
+
return /* @__PURE__ */ react.default.createElement(Com, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, common), {}, { mode: "read" }));
|
|
109
|
+
}
|
|
110
|
+
/** 为带 type 的列生成只读态渲染函数(Pisell 组件) */
|
|
111
|
+
function createReadRender(column, fieldType) {
|
|
112
|
+
var _column$fieldProps;
|
|
113
|
+
const Com = FIELD_TYPE_TO_READ_COMPONENT[fieldType];
|
|
114
|
+
const fieldProps = (_column$fieldProps = column.fieldProps) !== null && _column$fieldProps !== void 0 ? _column$fieldProps : {};
|
|
115
|
+
const getOptions = fieldProps.getOptions;
|
|
116
|
+
const useAsyncOptions = (fieldType === "singleSelect" || fieldType === "multipleSelect") && typeof getOptions === "function";
|
|
117
|
+
return (value) => {
|
|
118
|
+
if (Com == null) return value;
|
|
119
|
+
if (useAsyncOptions) return /* @__PURE__ */ react.default.createElement(AsyncOptionsReadCell, {
|
|
120
|
+
getOptions,
|
|
121
|
+
value,
|
|
122
|
+
fieldType,
|
|
123
|
+
fieldProps
|
|
124
|
+
});
|
|
125
|
+
const common = require_objectSpread2._objectSpread2({ value }, fieldProps);
|
|
126
|
+
if (fieldType === "singleSelect" || fieldType === "multipleSelect") return /* @__PURE__ */ react.default.createElement(Com, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, common), {}, { readOnly: true }));
|
|
127
|
+
if (fieldType === "dateTime") return /* @__PURE__ */ react.default.createElement(Com, common);
|
|
128
|
+
return /* @__PURE__ */ react.default.createElement(Com, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, common), {}, { mode: "read" }));
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* 处理列配置:对带 type 的列注入基于 Pisell 组件的 render,其余列保持不变。
|
|
133
|
+
* 有 type 时若列上传入了 render 则优先使用(覆盖自动派生)。
|
|
134
|
+
*/
|
|
135
|
+
function processColumnsForGrid(columns) {
|
|
136
|
+
if (!Array.isArray(columns) || columns.length === 0) return columns !== null && columns !== void 0 ? columns : [];
|
|
137
|
+
return columns.map((col) => {
|
|
138
|
+
const fieldType = col.type;
|
|
139
|
+
if (!fieldType || !FIELD_TYPE_TO_READ_COMPONENT[fieldType]) return col;
|
|
140
|
+
const existingRender = col.render;
|
|
141
|
+
const readRender = createReadRender(col, fieldType);
|
|
142
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, col), {}, { render: existingRender !== null && existingRender !== void 0 ? existingRender : ((value, record, index) => readRender(value, record, index)) });
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** 从列配置生成筛选项(FilterItemProps);有 type 时可由 filter 覆盖,无 type 时需传 filter */
|
|
146
|
+
function columnToFilterItem(column) {
|
|
147
|
+
var _f$label2, _f$props2, _f$options;
|
|
148
|
+
const key = getColumnKey(column);
|
|
149
|
+
const label = getColumnLabel(column);
|
|
150
|
+
if (!key) return null;
|
|
151
|
+
if (column.filterable === false) return null;
|
|
152
|
+
const hasExplicitFilter = column.filter && (column.filter.type != null || column.filter.component);
|
|
153
|
+
if (column.type && !hasExplicitFilter) {
|
|
154
|
+
var _column$fieldProps2, _fieldProps$options, _fieldProps$placehold;
|
|
155
|
+
const fieldType = column.type;
|
|
156
|
+
const filterType$1 = FIELD_TYPE_TO_FILTER_TYPE[fieldType];
|
|
157
|
+
const fieldProps = (_column$fieldProps2 = column.fieldProps) !== null && _column$fieldProps2 !== void 0 ? _column$fieldProps2 : {};
|
|
158
|
+
const hasGetOptions$1 = typeof fieldProps.getOptions === "function";
|
|
159
|
+
const options = fieldType === "singleSelect" || fieldType === "multipleSelect" || fieldType === "rating" ? (_fieldProps$options = fieldProps.options) !== null && _fieldProps$options !== void 0 ? _fieldProps$options : fieldType === "rating" ? [
|
|
160
|
+
1,
|
|
161
|
+
2,
|
|
162
|
+
3,
|
|
163
|
+
4,
|
|
164
|
+
5
|
|
165
|
+
].map((v) => ({
|
|
166
|
+
label: String(v),
|
|
167
|
+
value: v
|
|
168
|
+
})) : hasGetOptions$1 ? void 0 : [] : void 0;
|
|
169
|
+
return {
|
|
170
|
+
type: filterType$1,
|
|
171
|
+
key,
|
|
172
|
+
name: key,
|
|
173
|
+
label,
|
|
174
|
+
props: filterType$1 === "single" ? require_objectSpread2._objectSpread2({
|
|
175
|
+
options: options !== null && options !== void 0 ? options : [],
|
|
176
|
+
getOptions: fieldProps.getOptions
|
|
177
|
+
}, fieldProps) : require_objectSpread2._objectSpread2({ placeholder: (_fieldProps$placehold = fieldProps.placeholder) !== null && _fieldProps$placehold !== void 0 ? _fieldProps$placehold : `请输入${label}` }, fieldProps),
|
|
178
|
+
other: require_objectSpread2._objectSpread2({
|
|
179
|
+
fieldType,
|
|
180
|
+
getOptions: fieldProps.getOptions
|
|
181
|
+
}, fieldProps)
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (!column.filter) return null;
|
|
185
|
+
const f = column.filter;
|
|
186
|
+
if (f.component) {
|
|
187
|
+
var _f$label, _f$props;
|
|
188
|
+
return {
|
|
189
|
+
type: "custom",
|
|
190
|
+
key,
|
|
191
|
+
name: key,
|
|
192
|
+
label: (_f$label = f.label) !== null && _f$label !== void 0 ? _f$label : label,
|
|
193
|
+
props: (_f$props = f.props) !== null && _f$props !== void 0 ? _f$props : {},
|
|
194
|
+
other: require_objectSpread2._objectSpread2({ component: f.component }, f.props || {})
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
const filterType = f.type;
|
|
198
|
+
if (!filterType) return null;
|
|
199
|
+
const hasGetOptions = typeof f.getOptions === "function";
|
|
200
|
+
return {
|
|
201
|
+
type: filterType,
|
|
202
|
+
key,
|
|
203
|
+
name: key,
|
|
204
|
+
label: (_f$label2 = f.label) !== null && _f$label2 !== void 0 ? _f$label2 : label,
|
|
205
|
+
props: (_f$props2 = f.props) !== null && _f$props2 !== void 0 ? _f$props2 : filterType === "single" ? {
|
|
206
|
+
options: (_f$options = f.options) !== null && _f$options !== void 0 ? _f$options : [],
|
|
207
|
+
getOptions: f.getOptions
|
|
208
|
+
} : {},
|
|
209
|
+
other: filterType === "single" && hasGetOptions ? { getOptions: f.getOptions } : {}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/** 从列配置生成排序项(SortItemProps);有 type 时可由 sort 覆盖,无 type 时需传 sortable + sort */
|
|
213
|
+
function columnToSortItem(column) {
|
|
214
|
+
var _s$label;
|
|
215
|
+
const key = getColumnKey(column);
|
|
216
|
+
const label = getColumnLabel(column);
|
|
217
|
+
if (!key) return null;
|
|
218
|
+
if (column.sortable === false) return null;
|
|
219
|
+
const hasExplicitSort = column.sort && (column.sort.type != null || typeof column.sort.getSortItems === "function");
|
|
220
|
+
if (column.type && !hasExplicitSort) {
|
|
221
|
+
var _opts$label;
|
|
222
|
+
const fieldType = column.type;
|
|
223
|
+
if (!FIELD_TYPE_TO_READ_COMPONENT[fieldType]) return null;
|
|
224
|
+
const opts = getSortOptionForFieldType(fieldType);
|
|
225
|
+
if (!opts) return null;
|
|
226
|
+
const hasGetSortItems$1 = "getSortItems" in opts && typeof opts.getSortItems === "function";
|
|
227
|
+
return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, hasGetSortItems$1 ? {} : { type: "type" in opts ? opts.type : void 0 }), hasGetSortItems$1 && "getSortItems" in opts ? { getSortItems: opts.getSortItems } : {}), {}, {
|
|
228
|
+
name: key,
|
|
229
|
+
label: "label" in opts ? (_opts$label = opts.label) !== null && _opts$label !== void 0 ? _opts$label : label : label,
|
|
230
|
+
isCustom: false
|
|
231
|
+
}, "localFilter" in opts && opts.localFilter !== void 0 && { localFilter: opts.localFilter }), "isHidden" in opts && opts.isHidden !== void 0 && { isHidden: opts.isHidden });
|
|
232
|
+
}
|
|
233
|
+
if (!column.type && column.sortable !== true) return null;
|
|
234
|
+
if (!column.sort) return null;
|
|
235
|
+
const s = column.sort;
|
|
236
|
+
const hasGetSortItems = typeof s.getSortItems === "function";
|
|
237
|
+
const sortItem = require_objectSpread2._objectSpread2({
|
|
238
|
+
name: key,
|
|
239
|
+
label: (_s$label = s.label) !== null && _s$label !== void 0 ? _s$label : label,
|
|
240
|
+
isCustom: false
|
|
241
|
+
}, s.isHidden !== void 0 && { isHidden: s.isHidden });
|
|
242
|
+
if (hasGetSortItems && s.getSortItems) sortItem.getSortItems = s.getSortItems;
|
|
243
|
+
else if (s.type != null) sortItem.type = s.type;
|
|
244
|
+
return sortItem;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* 从 columns 派生排序列表(SortItemProps[])。
|
|
248
|
+
* 有 type 的列:根据组件 SortOptions(或默认)生成;无 type 的列:根据 sortable + sort 生成。
|
|
249
|
+
*/
|
|
250
|
+
function deriveSortFromColumns(columns) {
|
|
251
|
+
if (!Array.isArray(columns) || columns.length === 0) return [];
|
|
252
|
+
const list = [];
|
|
253
|
+
for (const col of columns) {
|
|
254
|
+
if (Boolean(col.type && FIELD_TYPE_TO_READ_COMPONENT[col.type]) && col.sortable === false) continue;
|
|
255
|
+
const item = columnToSortItem(col);
|
|
256
|
+
if (item) list.push(item);
|
|
257
|
+
}
|
|
258
|
+
return list;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* 从 columns 派生 filter 列表(quickFilter + otherFilter)。
|
|
262
|
+
* 有 type 的列:根据 type + fieldProps 生成筛选项;无 type 的列:根据 filterable + filter 生成。
|
|
263
|
+
*/
|
|
264
|
+
function deriveFilterFromColumns(columns) {
|
|
265
|
+
const quickFilter = [];
|
|
266
|
+
const otherFilter = [];
|
|
267
|
+
if (!Array.isArray(columns) || columns.length === 0) return {
|
|
268
|
+
quickFilter,
|
|
269
|
+
otherFilter
|
|
270
|
+
};
|
|
271
|
+
for (const col of columns) {
|
|
272
|
+
var _col$filter, _col$filter2;
|
|
273
|
+
if (!getColumnKey(col)) continue;
|
|
274
|
+
const hasType = Boolean(col.type && FIELD_TYPE_TO_READ_COMPONENT[col.type]);
|
|
275
|
+
if (hasType && col.filterable === false) continue;
|
|
276
|
+
const useQuick = hasType ? ((_col$filter = col.filter) === null || _col$filter === void 0 ? void 0 : _col$filter.quickFilter) === true : Boolean(col.filterable && ((_col$filter2 = col.filter) === null || _col$filter2 === void 0 ? void 0 : _col$filter2.quickFilter));
|
|
277
|
+
const item = columnToFilterItem(col);
|
|
278
|
+
if (!item) continue;
|
|
279
|
+
if (useQuick) quickFilter.push(item);
|
|
280
|
+
else otherFilter.push(item);
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
quickFilter,
|
|
284
|
+
otherFilter
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
//#endregion
|
|
289
|
+
exports.deriveFilterFromColumns = deriveFilterFromColumns;
|
|
290
|
+
exports.deriveSortFromColumns = deriveSortFromColumns;
|
|
291
|
+
exports.getRecordBoardColumnKey = getRecordBoardColumnKey;
|
|
292
|
+
exports.processColumnsForGrid = processColumnsForGrid;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PisellShellFrameProps } from "./types.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./PisellShellFrame.less";
|
|
4
|
+
|
|
5
|
+
//#region src/components/pisellShellFrame/PisellShellFrame.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* PisellShellFrame:通用壳层布局组件。
|
|
8
|
+
* 支持通过 config 控制各区域显隐,不同展示类型(表格/看板/日历/楼层图等)复用同一壳层。
|
|
9
|
+
*
|
|
10
|
+
* - 顶部:标题区(标题/副标题/辅助信息)、工具区(Toolbar)、统计区(Statistic List,可选折叠)
|
|
11
|
+
* - 中间:滚动承载(可选)+ Layout 插槽(children)
|
|
12
|
+
* - 底部:批量操作条(按选中状态出现)、状态提示区(加载/错误/同步提示等)
|
|
13
|
+
*/
|
|
14
|
+
declare const PisellShellFrame: React.FC<PisellShellFrameProps>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { PisellShellFrame };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.js');
|
|
2
|
+
const require_objectSpread2 = require('../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
|
|
3
|
+
const require_index = require('../../locales/index.js');
|
|
4
|
+
let antd = require("antd");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_rolldown_runtime.__toESM(react);
|
|
7
|
+
require("./PisellShellFrame.less");
|
|
8
|
+
|
|
9
|
+
//#region src/components/pisellShellFrame/PisellShellFrame.tsx
|
|
10
|
+
const defaultConfig = {
|
|
11
|
+
showTitle: false,
|
|
12
|
+
showToolbar: false,
|
|
13
|
+
showStatistic: false,
|
|
14
|
+
statisticCollapsible: false,
|
|
15
|
+
scroll: false,
|
|
16
|
+
showBatchActionBar: false,
|
|
17
|
+
showStatusArea: false
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* PisellShellFrame:通用壳层布局组件。
|
|
21
|
+
* 支持通过 config 控制各区域显隐,不同展示类型(表格/看板/日历/楼层图等)复用同一壳层。
|
|
22
|
+
*
|
|
23
|
+
* - 顶部:标题区(标题/副标题/辅助信息)、工具区(Toolbar)、统计区(Statistic List,可选折叠)
|
|
24
|
+
* - 中间:滚动承载(可选)+ Layout 插槽(children)
|
|
25
|
+
* - 底部:批量操作条(按选中状态出现)、状态提示区(加载/错误/同步提示等)
|
|
26
|
+
*/
|
|
27
|
+
const PisellShellFrame = (props) => {
|
|
28
|
+
const { className, style, config: configProp, title, subtitle, titleExtra, toolbar, statisticList, children, batchActionBar, statusArea } = props;
|
|
29
|
+
const config = require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, defaultConfig), configProp);
|
|
30
|
+
const [statisticCollapsed, setStatisticCollapsed] = (0, react.useState)(false);
|
|
31
|
+
const hasTitle = config.showTitle && (title != null || subtitle != null || titleExtra != null);
|
|
32
|
+
const hasToolbar = config.showToolbar && toolbar != null;
|
|
33
|
+
const hasStatistic = config.showStatistic && statisticList != null;
|
|
34
|
+
const hasBatchBar = config.showBatchActionBar && batchActionBar != null;
|
|
35
|
+
const hasStatus = config.showStatusArea && statusArea != null;
|
|
36
|
+
const scrollConfig = config.scroll;
|
|
37
|
+
const useScroll = scrollConfig === true || typeof scrollConfig === "object" && scrollConfig != null;
|
|
38
|
+
const scrollOpts = typeof scrollConfig === "object" && scrollConfig != null ? scrollConfig : null;
|
|
39
|
+
const scrollStyle = scrollOpts === null || scrollOpts === void 0 ? void 0 : scrollOpts.style;
|
|
40
|
+
const scrollClassName = scrollOpts === null || scrollOpts === void 0 ? void 0 : scrollOpts.className;
|
|
41
|
+
return /* @__PURE__ */ react.default.createElement("div", {
|
|
42
|
+
className: `pisell-shell-frame ${className !== null && className !== void 0 ? className : ""}`.trim(),
|
|
43
|
+
style,
|
|
44
|
+
"data-shell-frame": true
|
|
45
|
+
}, /* @__PURE__ */ react.default.createElement("header", { className: "pisell-shell-frame-header" }, hasTitle && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-title" }, /* @__PURE__ */ react.default.createElement("span", null, title != null && /* @__PURE__ */ react.default.createElement("span", { className: "pisell-shell-frame-title-main" }, title), subtitle != null && /* @__PURE__ */ react.default.createElement("span", { className: "pisell-shell-frame-title-sub" }, subtitle)), titleExtra != null && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-title-extra" }, titleExtra)), hasToolbar && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-toolbar" }, toolbar), hasStatistic && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-statistic" }, config.statisticCollapsible ? /* @__PURE__ */ react.default.createElement(antd.Collapse, {
|
|
46
|
+
ghost: true,
|
|
47
|
+
activeKey: statisticCollapsed ? [] : ["statistic"],
|
|
48
|
+
onChange: (keys) => setStatisticCollapsed(keys.length === 0),
|
|
49
|
+
items: [{
|
|
50
|
+
key: "statistic",
|
|
51
|
+
label: /* @__PURE__ */ react.default.createElement("span", { className: "pisell-shell-frame-statistic-collapse-header" }, statisticCollapsed ? require_index.getText("shell-frame-statistic-expand") : require_index.getText("shell-frame-statistic-collapse")),
|
|
52
|
+
children: statisticList
|
|
53
|
+
}]
|
|
54
|
+
}) : statisticList)), /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-body" }, useScroll ? /* @__PURE__ */ react.default.createElement("div", {
|
|
55
|
+
className: `pisell-shell-frame-scroll ${scrollClassName !== null && scrollClassName !== void 0 ? scrollClassName : ""}`.trim(),
|
|
56
|
+
style: scrollStyle
|
|
57
|
+
}, children) : children), /* @__PURE__ */ react.default.createElement("footer", { className: "pisell-shell-frame-footer" }, hasBatchBar && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-batch-bar" }, batchActionBar), hasStatus && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-shell-frame-status" }, statusArea)));
|
|
58
|
+
};
|
|
59
|
+
PisellShellFrame.displayName = "PisellShellFrame";
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.PisellShellFrame = PisellShellFrame;
|