@zat-design/sisyphus-react 4.5.1 → 4.5.2
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/es/ProEditTable/components/Summary/index.js +3 -2
- package/es/ProEditTable/utils/tools.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/render/RenderFields.js +3 -1
- package/es/ProForm/hooks/useWatch.js +8 -10
- package/es/ProLayout/components/ProHeader/index.js +28 -15
- package/es/ProSelect/index.js +74 -187
- package/es/ProSelect/utils/index.js +174 -0
- package/es/ProTree/components/ProTreeSelect/index.js +17 -3
- package/es/ProUpload/components/DragRender.js +2 -1
- package/es/ProUpload/index.js +1 -1
- package/package.json +1 -1
- package/es/FormsProvider/index.d.ts +0 -18
- package/es/ProAction/components/CheckModalContent/index.d.ts +0 -8
- package/es/ProAction/index.d.ts +0 -7
- package/es/ProAction/propsType.d.ts +0 -45
- package/es/ProConfigProvider/index.d.ts +0 -9
- package/es/ProConfigProvider/propsType.d.ts +0 -78
- package/es/ProDownload/index.d.ts +0 -6
- package/es/ProDownload/propsType.d.ts +0 -71
- package/es/ProDownload/utils.d.ts +0 -60
- package/es/ProDrawerForm/components/ProDrawer/index.d.ts +0 -7
- package/es/ProDrawerForm/components/ProModal/index.d.ts +0 -7
- package/es/ProDrawerForm/components/index.d.ts +0 -2
- package/es/ProDrawerForm/hooks/useConfirmClose.d.ts +0 -25
- package/es/ProDrawerForm/index.d.ts +0 -6
- package/es/ProDrawerForm/propsType.d.ts +0 -111
- package/es/ProDrawerForm/utils/index.d.ts +0 -25
- package/es/ProEditLabel/components/RenderProForm.d.ts +0 -4
- package/es/ProEditLabel/index.d.ts +0 -4
- package/es/ProEditLabel/propsType.d.ts +0 -163
- package/es/ProEditLabel/utils/index.d.ts +0 -7
- package/es/ProEditTable/components/ActionButton/index.d.ts +0 -2
- package/es/ProEditTable/components/RcTable/BaseTable.d.ts +0 -6
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +0 -7
- package/es/ProEditTable/components/RcTable/index.d.ts +0 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.d.ts +0 -4
- package/es/ProEditTable/components/RenderField/index.d.ts +0 -3
- package/es/ProEditTable/components/RenderField/propsType.d.ts +0 -30
- package/es/ProEditTable/components/RenderField/tools.d.ts +0 -22
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +0 -2
- package/es/ProEditTable/components/Summary/index.d.ts +0 -12
- package/es/ProEditTable/components/Validator/index.d.ts +0 -19
- package/es/ProEditTable/components/index.d.ts +0 -5
- package/es/ProEditTable/index.d.ts +0 -4
- package/es/ProEditTable/propsType.d.ts +0 -437
- package/es/ProEditTable/utils/config.d.ts +0 -25
- package/es/ProEditTable/utils/diffOriginal.d.ts +0 -22
- package/es/ProEditTable/utils/getDefaultProps.d.ts +0 -1
- package/es/ProEditTable/utils/index.d.ts +0 -23
- package/es/ProEditTable/utils/tools.d.ts +0 -128
- package/es/ProEditTable/utils/transform.d.ts +0 -13
- package/es/ProEditTable/utils/useEditTableError.d.ts +0 -7
- package/es/ProEditTable/utils/useShouldUpdateForTable.d.ts +0 -16
- package/es/ProEditTable/utils/validateAll.d.ts +0 -89
- package/es/ProEnum/components/Group.d.ts +0 -10
- package/es/ProEnum/components/Tag.d.ts +0 -7
- package/es/ProEnum/hooks/useEnum.d.ts +0 -29
- package/es/ProEnum/hooks/useEnumRequest.d.ts +0 -4
- package/es/ProEnum/hooks/useFrequentEnumRequest.d.ts +0 -14
- package/es/ProEnum/index.d.ts +0 -10
- package/es/ProEnum/propsType.d.ts +0 -310
- package/es/ProEnum/utils/eventCenter.d.ts +0 -1
- package/es/ProEnum/utils/frequentEnum.d.ts +0 -39
- package/es/ProEnum/utils/getEnum.d.ts +0 -47
- package/es/ProEnum/utils/getEnumLabel.d.ts +0 -2
- package/es/ProEnum/utils/index.d.ts +0 -84
- package/es/ProForm/components/Container.d.ts +0 -9
- package/es/ProForm/components/FormFooter/index.d.ts +0 -5
- package/es/ProForm/components/FormFooter/propsType.d.ts +0 -22
- package/es/ProForm/components/base/Checkbox/index.d.ts +0 -14
- package/es/ProForm/components/base/DatePicker/index.d.ts +0 -11
- package/es/ProForm/components/base/Input/index.d.ts +0 -3
- package/es/ProForm/components/base/Input/propsType.d.ts +0 -21
- package/es/ProForm/components/base/InputNumber/index.d.ts +0 -11
- package/es/ProForm/components/base/Radio/index.d.ts +0 -15
- package/es/ProForm/components/base/RangePicker/index.d.ts +0 -19
- package/es/ProForm/components/base/RangePicker/useDateRange.d.ts +0 -15
- package/es/ProForm/components/base/Select/index.d.ts +0 -11
- package/es/ProForm/components/base/Switch/index.d.ts +0 -10
- package/es/ProForm/components/base/SwitchCheckbox/index.d.ts +0 -10
- package/es/ProForm/components/base/TextArea/index.d.ts +0 -11
- package/es/ProForm/components/base/TimePicker/index.d.ts +0 -13
- package/es/ProForm/components/combination/Container/index.d.ts +0 -4
- package/es/ProForm/components/combination/Container/propsType.d.ts +0 -13
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +0 -24
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +0 -23
- package/es/ProForm/components/combination/FormList/components/Empty.d.ts +0 -13
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +0 -20
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.d.ts +0 -12
- package/es/ProForm/components/combination/FormList/index.d.ts +0 -4
- package/es/ProForm/components/combination/FormList/propsType.d.ts +0 -69
- package/es/ProForm/components/combination/FormList/utils.d.ts +0 -18
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.d.ts +0 -9
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +0 -28
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +0 -10
- package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -34
- package/es/ProForm/components/combination/Group/index.d.ts +0 -9
- package/es/ProForm/components/combination/Group/propsType.d.ts +0 -99
- package/es/ProForm/components/combination/Group/utils/index.d.ts +0 -154
- package/es/ProForm/components/combination/ProCascader/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +0 -48
- package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +0 -14
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.d.ts +0 -33
- package/es/ProForm/components/combination/ProModalSelect/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +0 -106
- package/es/ProForm/components/combination/ProModalSelect/utils/index.d.ts +0 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/mergeSelectedRows.d.ts +0 -14
- package/es/ProForm/components/combination/ProNumberRange/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +0 -85
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +0 -4
- package/es/ProForm/components/combination/ProRangeLimit/propsType.d.ts +0 -23
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +0 -9
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +0 -33
- package/es/ProForm/components/index.d.ts +0 -29
- package/es/ProForm/components/render/ChangedWrapper.d.ts +0 -17
- package/es/ProForm/components/render/ConfirmWrapper.d.ts +0 -10
- package/es/ProForm/components/render/CustomComponentViewWrapper.d.ts +0 -30
- package/es/ProForm/components/render/Render.d.ts +0 -4
- package/es/ProForm/components/render/RenderFields.d.ts +0 -26
- package/es/ProForm/components/render/propsType.d.ts +0 -279
- package/es/ProForm/hooks/useControlled.d.ts +0 -1
- package/es/ProForm/hooks/useDeepCompareMemo.d.ts +0 -2
- package/es/ProForm/hooks/useFieldProps.d.ts +0 -4
- package/es/ProForm/hooks/useForm.d.ts +0 -8
- package/es/ProForm/hooks/useRules.d.ts +0 -16
- package/es/ProForm/hooks/useShouldUpdate.d.ts +0 -31
- package/es/ProForm/hooks/useWatch.d.ts +0 -22
- package/es/ProForm/index.d.ts +0 -6
- package/es/ProForm/propsType.d.ts +0 -143
- package/es/ProForm/utils/buildFormItemProps.d.ts +0 -25
- package/es/ProForm/utils/diffOriginal.d.ts +0 -10
- package/es/ProForm/utils/getDefaultProps.d.ts +0 -1
- package/es/ProForm/utils/index.d.ts +0 -109
- package/es/ProForm/utils/processDependencies.d.ts +0 -29
- package/es/ProForm/utils/reactiveValues.d.ts +0 -34
- package/es/ProForm/utils/rulesCreator.d.ts +0 -7
- package/es/ProForm/utils/transformNames.d.ts +0 -10
- package/es/ProForm/utils/transformValue.d.ts +0 -6
- package/es/ProForm/utils/valueType.d.ts +0 -70
- package/es/ProIcon/config/index.d.ts +0 -19
- package/es/ProIcon/index.d.ts +0 -4
- package/es/ProIcon/propsTypes.d.ts +0 -175
- package/es/ProIcon/utils/index.d.ts +0 -6
- package/es/ProLayout/components/Layout/Header/index.d.ts +0 -4
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.d.ts +0 -3
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +0 -3
- package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.d.ts +0 -15
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.d.ts +0 -3
- package/es/ProLayout/components/Layout/Menu/index.d.ts +0 -4
- package/es/ProLayout/components/Layout/Notice/index.d.ts +0 -4
- package/es/ProLayout/components/Layout/index.d.ts +0 -3
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +0 -98
- package/es/ProLayout/components/ProCollapse/index.d.ts +0 -3
- package/es/ProLayout/components/ProFooter/PropTypes.d.ts +0 -27
- package/es/ProLayout/components/ProFooter/index.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/PropTypes.d.ts +0 -206
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.d.ts +0 -9
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/components/index.d.ts +0 -2
- package/es/ProLayout/components/ProHeader/index.d.ts +0 -4
- package/es/ProLayout/components/ProHeader/utils/index.d.ts +0 -5
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +0 -7
- package/es/ProLayout/components/TabsManager/components/TabItem.d.ts +0 -26
- package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +0 -6
- package/es/ProLayout/components/TabsManager/components/TabsHeader.d.ts +0 -10
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +0 -6
- package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.d.ts +0 -25
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +0 -18
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +0 -31
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +0 -5
- package/es/ProLayout/components/TabsManager/index.d.ts +0 -7
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +0 -89
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +0 -47
- package/es/ProLayout/components/index.d.ts +0 -3
- package/es/ProLayout/index.d.ts +0 -20
- package/es/ProLayout/propTypes.d.ts +0 -533
- package/es/ProLayout/utils/index.d.ts +0 -43
- package/es/ProSelect/components/AdaptiveTooltip.d.ts +0 -4
- package/es/ProSelect/index.d.ts +0 -5
- package/es/ProSelect/propsType.d.ts +0 -162
- package/es/ProSelect/utils/index.d.ts +0 -4
- package/es/ProStep/components/Anchor/index.d.ts +0 -4
- package/es/ProStep/components/Item/index.d.ts +0 -3
- package/es/ProStep/components/LazyLoad/index.d.ts +0 -19
- package/es/ProStep/components/Listener/index.d.ts +0 -4
- package/es/ProStep/components/Step/index.d.ts +0 -5
- package/es/ProStep/index.d.ts +0 -11
- package/es/ProStep/propsType.d.ts +0 -224
- package/es/ProStep/utils/index.d.ts +0 -22
- package/es/ProStepTab/index.d.ts +0 -22
- package/es/ProStepTab/propsType.d.ts +0 -114
- package/es/ProTable/components/EditableCell/EditIcon.d.ts +0 -6
- package/es/ProTable/components/EditableCell/index.d.ts +0 -4
- package/es/ProTable/components/EditableCell/propsType.d.ts +0 -24
- package/es/ProTable/components/FormatColumn/index.d.ts +0 -22
- package/es/ProTable/components/FormatColumn/propsType.d.ts +0 -29
- package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +0 -3
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +0 -18
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.d.ts +0 -8
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.d.ts +0 -61
- package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +0 -3
- package/es/ProTable/components/RcTable/index.d.ts +0 -4
- package/es/ProTable/components/RenderColumn/index.d.ts +0 -22
- package/es/ProTable/components/RenderEmptyText/index.d.ts +0 -3
- package/es/ProTable/components/RenderFooter/index.d.ts +0 -2
- package/es/ProTable/components/RenderSummary/index.d.ts +0 -3
- package/es/ProTable/components/RenderTableHeader/index.d.ts +0 -2
- package/es/ProTable/components/RenderTabs/index.d.ts +0 -4
- package/es/ProTable/components/TableResizable/index.d.ts +0 -13
- package/es/ProTable/components/TooltipTitle/index.d.ts +0 -11
- package/es/ProTable/components/index.d.ts +0 -31
- package/es/ProTable/hooks/useAntdTable.d.ts +0 -7
- package/es/ProTable/index.d.ts +0 -17
- package/es/ProTable/propsType.d.ts +0 -792
- package/es/ProTable/utils/columnStorage.d.ts +0 -35
- package/es/ProTable/utils/index.d.ts +0 -52
- package/es/ProTabs/components/Card/index.d.ts +0 -3
- package/es/ProTabs/components/index.d.ts +0 -1
- package/es/ProTabs/index.d.ts +0 -4
- package/es/ProTabs/propType.d.ts +0 -94
- package/es/ProThemeTools/component/ProTools/index.d.ts +0 -3
- package/es/ProThemeTools/component/index.d.ts +0 -1
- package/es/ProThemeTools/context/ThemeContext.d.ts +0 -43
- package/es/ProThemeTools/index.d.ts +0 -9
- package/es/ProThemeTools/propsType.d.ts +0 -170
- package/es/ProThemeTools/utils/index.d.ts +0 -51
- package/es/ProTooltip/index.d.ts +0 -3
- package/es/ProTooltip/propsType.d.ts +0 -57
- package/es/ProTree/components/AdaptiveTooltip.d.ts +0 -4
- package/es/ProTree/components/CloseIcon.d.ts +0 -2
- package/es/ProTree/components/List.d.ts +0 -17
- package/es/ProTree/components/ProTree.d.ts +0 -3
- package/es/ProTree/components/ProTreeSelect/index.d.ts +0 -5
- package/es/ProTree/components/ProTreeSelect/propsType.d.ts +0 -445
- package/es/ProTree/components/SearchTitle.d.ts +0 -11
- package/es/ProTree/components/Tree.d.ts +0 -27
- package/es/ProTree/components/index.d.ts +0 -4
- package/es/ProTree/index.d.ts +0 -3
- package/es/ProTree/propsType.d.ts +0 -818
- package/es/ProTree/utils.d.ts +0 -62
- package/es/ProTreeModal/components/Cascader.d.ts +0 -14
- package/es/ProTreeModal/components/CloseIcon.d.ts +0 -2
- package/es/ProTreeModal/components/List.d.ts +0 -21
- package/es/ProTreeModal/components/SearchTitle.d.ts +0 -7
- package/es/ProTreeModal/components/SortableItem.d.ts +0 -12
- package/es/ProTreeModal/components/Tree.d.ts +0 -25
- package/es/ProTreeModal/components/Trigger.d.ts +0 -21
- package/es/ProTreeModal/components/index.d.ts +0 -6
- package/es/ProTreeModal/index.d.ts +0 -4
- package/es/ProTreeModal/propsType.d.ts +0 -298
- package/es/ProTreeModal/utils.d.ts +0 -39
- package/es/ProUpload/components/ButtonRender.d.ts +0 -20
- package/es/ProUpload/components/DragRender.d.ts +0 -21
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +0 -2
- package/es/ProUpload/components/Example.d.ts +0 -10
- package/es/ProUpload/components/FileItem.d.ts +0 -33
- package/es/ProUpload/components/ImageRender.d.ts +0 -19
- package/es/ProUpload/index.d.ts +0 -4
- package/es/ProUpload/propsType.d.ts +0 -264
- package/es/ProUpload/uitls.d.ts +0 -3
- package/es/ProUtils/utils/index.d.ts +0 -6
- package/es/ProViewer/index.d.ts +0 -4
- package/es/ProViewer/propsType.d.ts +0 -37
- package/es/ProWaterMark/index.d.ts +0 -4
- package/es/ProWaterMark/propsType.d.ts +0 -6
- package/es/hooks/useDraggableRow.d.ts +0 -34
- package/es/index.d.ts +0 -58
- package/es/locale/en_US.d.ts +0 -176
- package/es/locale/index.d.ts +0 -15
- package/es/locale/zh_CN.d.ts +0 -176
- package/es/tokens.d.ts +0 -83
- package/es/utils/index.d.ts +0 -20
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import type { FormInstance } from 'antd';
|
|
2
|
-
import type { NamePath } from 'antd/es/form/interface';
|
|
3
|
-
/**
|
|
4
|
-
* 单元格规则装配 + 全量数据真实校验(脱离 DOM)。
|
|
5
|
-
*
|
|
6
|
-
* 背景:antd6 虚拟表格滚动时视口外的行会被卸载,其 Form.Item 字段未注册,
|
|
7
|
-
* form.validateFields 无法覆盖;本模块用 form store 里的全量数据 + 真实规则
|
|
8
|
-
* 逐行逐列离屏校验,解决「统一校验」缺口,并产出可常驻的真实报错文案。
|
|
9
|
-
*/
|
|
10
|
-
interface BuildCellRulesParams {
|
|
11
|
-
column: any;
|
|
12
|
-
rowData: any;
|
|
13
|
-
index: number;
|
|
14
|
-
form: FormInstance;
|
|
15
|
-
name: (string | number)[];
|
|
16
|
-
config: any;
|
|
17
|
-
}
|
|
18
|
-
interface BuiltCellRule {
|
|
19
|
-
/** 单元格 Form.Item 的 namePath(用于定位/messageVariables) */
|
|
20
|
-
namePath: (string | number)[];
|
|
21
|
-
/** 列在行内的稳定标识(与 transformColumns 的 dataIndex/key 一致),用于错误存储归集 */
|
|
22
|
-
cellKey: string;
|
|
23
|
-
/** 待校验值(names 列为组合数组) */
|
|
24
|
-
value: any;
|
|
25
|
-
/** 真实规则集合 */
|
|
26
|
-
rules: any[];
|
|
27
|
-
/** 字段 label,供 ${label} 文案插值 */
|
|
28
|
-
label: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 为单行单列装配真实校验规则与取值。
|
|
32
|
-
* 当该单元格处于查看/禁用态、或无任何规则时返回 null(跳过校验)。
|
|
33
|
-
*/
|
|
34
|
-
export declare const buildCellRules: ({ column, rowData, index, form, name, config, }: BuildCellRulesParams) => BuiltCellRule | null;
|
|
35
|
-
interface ValidateAllParams {
|
|
36
|
-
form: FormInstance;
|
|
37
|
-
name: NamePath;
|
|
38
|
-
columns: any[];
|
|
39
|
-
config: any;
|
|
40
|
-
}
|
|
41
|
-
export interface ValidateAllResult {
|
|
42
|
-
hasError: boolean;
|
|
43
|
-
/** rowKey -> { cellKey -> 错误文案数组 } */
|
|
44
|
-
errorMap: Record<string, Record<string, string[]>>;
|
|
45
|
-
/** 首个错误单元格的 namePath(用于滚动定位),无错误为 null */
|
|
46
|
-
firstErrorPath: (string | number)[] | null;
|
|
47
|
-
/** 首个错误行的 rowKey(用于横向滚动时定位错误行 DOM),无错误为 null */
|
|
48
|
-
firstErrorRowKey: string | null;
|
|
49
|
-
/** 首个错误列的 cellKey(names 列为 splitNames,普通列为列名),用于横向滚动定位列,无错误为 null */
|
|
50
|
-
firstErrorColumnKey: string | null;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 对 form store 中 name 路径下的全量数组数据,逐行逐列用真实规则校验(脱离 DOM)。
|
|
54
|
-
*/
|
|
55
|
-
export declare const validateAllRows: ({ form, name, columns, config, }: ValidateAllParams) => Promise<ValidateAllResult>;
|
|
56
|
-
/**
|
|
57
|
-
* 外部错误存储:以 rowKey + cellKey 为键持久化真实报错文案。
|
|
58
|
-
* 它是「报错常驻」的真实来源——脱离 antd Field 实体生命周期,
|
|
59
|
-
* 行卸载后仍保留,重新挂载时回填显示。
|
|
60
|
-
*/
|
|
61
|
-
export interface ErrorStore {
|
|
62
|
-
/** 读取某单元格错误文案 */
|
|
63
|
-
get(rowKey: string | number, cellKey: string): string[] | undefined;
|
|
64
|
-
/** 读取整行错误 */
|
|
65
|
-
getRow(rowKey: string | number): Record<string, string[]> | undefined;
|
|
66
|
-
/** 全量替换(来自一次完整校验) */
|
|
67
|
-
setAll(errorMap: Record<string, Record<string, string[]>>): void;
|
|
68
|
-
/** 清理某单元格(用户修正后调用),整行清空时移除该行 */
|
|
69
|
-
clearCell(rowKey: string | number, cellKey: string): void;
|
|
70
|
-
/** 清空所有 */
|
|
71
|
-
clearAll(): void;
|
|
72
|
-
/** 是否为空 */
|
|
73
|
-
isEmpty(): boolean;
|
|
74
|
-
}
|
|
75
|
-
export declare const createErrorStore: () => ErrorStore;
|
|
76
|
-
interface RunUnifiedParams extends ValidateAllParams {
|
|
77
|
-
errorStore: ErrorStore;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 统一校验入口:对全量数据跑真实规则,写入 errorStore,返回是否有错与首个错误行索引。
|
|
81
|
-
* 供隐藏聚合校验字段在 form.validateFields() 时调用,从而覆盖视口外未挂载的行。
|
|
82
|
-
*/
|
|
83
|
-
export declare const runUnifiedValidation: ({ form, name, columns, config, errorStore, }: RunUnifiedParams) => Promise<{
|
|
84
|
-
hasError: boolean;
|
|
85
|
-
firstErrorIndex: number | null;
|
|
86
|
-
firstErrorRowKey: string | null;
|
|
87
|
-
firstErrorColumnKey: string | null;
|
|
88
|
-
}>;
|
|
89
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ProEnumType } from '../propsType';
|
|
2
|
-
interface Props extends Pick<ProEnumType, 'id' | 'value' | 'onChange' | 'dataSource'> {
|
|
3
|
-
fieldValue: string;
|
|
4
|
-
fieldLabel: string;
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
allowClear?: boolean;
|
|
7
|
-
button?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const Group: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export default Group;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ProEnumType } from '../propsType';
|
|
2
|
-
interface Props extends Pick<ProEnumType, 'id' | 'value' | 'onChange' | 'dataSource'> {
|
|
3
|
-
fieldValue: string;
|
|
4
|
-
fieldLabel: string;
|
|
5
|
-
}
|
|
6
|
-
declare const ProEnumTag: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default ProEnumTag;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { DataOptionType } from '../propsType';
|
|
2
|
-
/**
|
|
3
|
-
* input code output [DataOption[],getEnumLabel]
|
|
4
|
-
* @param code
|
|
5
|
-
* const [options,fn] = useEnum("code")
|
|
6
|
-
*/
|
|
7
|
-
declare function useEnum(code: string): [DataOptionType[], (val: string, showCodeName?: boolean) => string];
|
|
8
|
-
/**
|
|
9
|
-
* input codes output { code1:DataOption[],code2:DataOption[] }
|
|
10
|
-
* @param codes
|
|
11
|
-
* const dicsMap = useEnum(["code1","code2"])
|
|
12
|
-
*/
|
|
13
|
-
declare function useEnum(codes: string[]): Record<string, DataOptionType[]>;
|
|
14
|
-
/**
|
|
15
|
-
* input code、value output label
|
|
16
|
-
* @param code
|
|
17
|
-
* @param value
|
|
18
|
-
* @param compose 展示 value-label
|
|
19
|
-
*/
|
|
20
|
-
declare function useEnum(code: string, value?: string, compose?: boolean): [string, DataOptionType];
|
|
21
|
-
/**
|
|
22
|
-
* input code、values array output [labels array, options array]
|
|
23
|
-
* @param code
|
|
24
|
-
* @param values 值数组
|
|
25
|
-
* @param compose 展示 value-label
|
|
26
|
-
* @returns [标签数组, 选项数组]
|
|
27
|
-
*/
|
|
28
|
-
declare function useEnum(code: string, values: (string | number)[], compose?: boolean): [string[], DataOptionType[]];
|
|
29
|
-
export default useEnum;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { FrequentEnumConfig } from '../propsType';
|
|
2
|
-
type StorageType = 'localStorage' | 'sessionStorage' | 'indexedDB';
|
|
3
|
-
interface UseFrequentEnumRequestProps {
|
|
4
|
-
frequentEnums?: FrequentEnumConfig;
|
|
5
|
-
fieldNames: any;
|
|
6
|
-
clear: boolean;
|
|
7
|
-
storage: StorageType;
|
|
8
|
-
cacheKey: string;
|
|
9
|
-
dispatch: any;
|
|
10
|
-
dics: any;
|
|
11
|
-
dataSource: any;
|
|
12
|
-
}
|
|
13
|
-
declare const useFrequentEnumRequest: (props: UseFrequentEnumRequestProps, dispatch: any) => import("ahooks/lib/useRequest/src/types").Result<any, any>;
|
|
14
|
-
export default useFrequentEnumRequest;
|
package/es/ProEnum/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import useEnum from './hooks/useEnum';
|
|
2
|
-
import getEnum from './utils/getEnum';
|
|
3
|
-
import type { ProEnumType } from './propsType';
|
|
4
|
-
declare const ProEnum: {
|
|
5
|
-
(props: ProEnumType): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
useEnum: typeof useEnum;
|
|
8
|
-
getEnum: typeof getEnum;
|
|
9
|
-
};
|
|
10
|
-
export default ProEnum;
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { RadioProps, CheckboxProps } from 'antd';
|
|
3
|
-
import { Service, Options } from 'ahooks/lib/useRequest/src/types';
|
|
4
|
-
import type { ProFormOtherType } from '../ProForm/propsType';
|
|
5
|
-
import type { PropSelectType } from '../ProSelect/propsType';
|
|
6
|
-
/**
|
|
7
|
-
* @description 数据选项类型
|
|
8
|
-
*/
|
|
9
|
-
export interface DataOptionType {
|
|
10
|
-
/**
|
|
11
|
-
* @description 展示标签
|
|
12
|
-
* @default -
|
|
13
|
-
*/
|
|
14
|
-
label?: string;
|
|
15
|
-
/**
|
|
16
|
-
* @description 选项值
|
|
17
|
-
* @default -
|
|
18
|
-
*/
|
|
19
|
-
value?: string;
|
|
20
|
-
/**
|
|
21
|
-
* @description 是否禁用
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* @description 允许扩展字段
|
|
27
|
-
*/
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @description 频繁变动的枚举配置
|
|
32
|
-
*/
|
|
33
|
-
export interface FrequentEnumConfig {
|
|
34
|
-
/**
|
|
35
|
-
* @description 需要替换的缓存枚举code列表
|
|
36
|
-
*/
|
|
37
|
-
enums: string[];
|
|
38
|
-
/**
|
|
39
|
-
* @description 请求服务函数
|
|
40
|
-
*/
|
|
41
|
-
service: Service<any, any>;
|
|
42
|
-
/**
|
|
43
|
-
* @description 请求选项配置
|
|
44
|
-
*/
|
|
45
|
-
options?: Options<any, any>;
|
|
46
|
-
/**
|
|
47
|
-
* @description 对频繁枚举返回数据进行格式化(独立于全局transformResponse)
|
|
48
|
-
* @param data 后台返回的数据
|
|
49
|
-
* @returns 格式化后的枚举数据
|
|
50
|
-
* @default -
|
|
51
|
-
*/
|
|
52
|
-
transformResponse?: (data: any) => Record<string, DataOptionType[]> | Promise<Record<string, DataOptionType[]>>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @description ProEnum配置类型
|
|
56
|
-
*/
|
|
57
|
-
export interface ProEnumConfigType {
|
|
58
|
-
/**
|
|
59
|
-
* @description 是否枚举主入口
|
|
60
|
-
* @default false
|
|
61
|
-
*/
|
|
62
|
-
main?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* @description 是否使用主入口枚举
|
|
65
|
-
* @default false
|
|
66
|
-
*/
|
|
67
|
-
share?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* @description 是否开启调试 log
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
debugger?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* @description 是否对数据进行清洗
|
|
75
|
-
* @default false
|
|
76
|
-
*/
|
|
77
|
-
clear?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* @description 字段别名
|
|
80
|
-
* @default { label: 'label', value: 'value', children: 'children' }
|
|
81
|
-
*/
|
|
82
|
-
fieldNames?: {
|
|
83
|
-
label?: string;
|
|
84
|
-
value?: string;
|
|
85
|
-
children?: string;
|
|
86
|
-
[key: string]: string | undefined;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* @description 缓存的key、默认 zat-design-pro-component-cacheKey
|
|
90
|
-
* @default "zat-design-pro-component-cacheKey"
|
|
91
|
-
*/
|
|
92
|
-
cacheKey: string;
|
|
93
|
-
/**
|
|
94
|
-
* @description 刷新请求、设置后每次进入都会重新请求
|
|
95
|
-
* @default false
|
|
96
|
-
*/
|
|
97
|
-
requestRefresh: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* @description 存储位置、不设置、默认读取 globalConfig 里面的
|
|
100
|
-
* @default "localStorage"
|
|
101
|
-
*/
|
|
102
|
-
storage: 'localStorage' | 'sessionStorage' | 'indexedDB';
|
|
103
|
-
/**
|
|
104
|
-
* @description 默认静态枚举数据
|
|
105
|
-
* @default {}
|
|
106
|
-
*/
|
|
107
|
-
dataSource: Record<string, DataOptionType[]>;
|
|
108
|
-
/**
|
|
109
|
-
* @description 对后台返回数据进行格式化
|
|
110
|
-
* @param data 后台返回的数据
|
|
111
|
-
* @returns 格式化后的枚举数据
|
|
112
|
-
* @default -
|
|
113
|
-
*/
|
|
114
|
-
transformResponse?: (data: {
|
|
115
|
-
data: Record<string, DataOptionType[]>;
|
|
116
|
-
}) => Record<string, DataOptionType[]> | Promise<Record<string, DataOptionType[]>>;
|
|
117
|
-
/**
|
|
118
|
-
* @description 批量请求枚举接口
|
|
119
|
-
* @default -
|
|
120
|
-
*/
|
|
121
|
-
useRequest?: {
|
|
122
|
-
/**
|
|
123
|
-
* @description 请求服务函数
|
|
124
|
-
*/
|
|
125
|
-
service: Service<any, any>;
|
|
126
|
-
/**
|
|
127
|
-
* @description 请求选项配置
|
|
128
|
-
*/
|
|
129
|
-
options?: Options<any, any> & {
|
|
130
|
-
/**
|
|
131
|
-
* @description 指定请求的枚举码
|
|
132
|
-
*/
|
|
133
|
-
codes?: string[];
|
|
134
|
-
/**
|
|
135
|
-
* @description 忽略的枚举码
|
|
136
|
-
*/
|
|
137
|
-
ignoreCodes?: string[];
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* @description 频繁变动的枚举配置
|
|
142
|
-
* @default -
|
|
143
|
-
*/
|
|
144
|
-
frequentEnums?: FrequentEnumConfig;
|
|
145
|
-
/**
|
|
146
|
-
* @description 字典数据
|
|
147
|
-
* @default {}
|
|
148
|
-
*/
|
|
149
|
-
dics: Record<string, DataOptionType[]>;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* @description 枚举组件类型枚举
|
|
153
|
-
*/
|
|
154
|
-
type EnumComponentType = 'ProSelect' | 'Radio' | 'Checkbox' | 'Tag' | 'Group';
|
|
155
|
-
/**
|
|
156
|
-
* @description ProEnum基础属性类型
|
|
157
|
-
*/
|
|
158
|
-
export interface ProEnumBaseType {
|
|
159
|
-
/**
|
|
160
|
-
* @description 组件展示类型、默认 ProSelect
|
|
161
|
-
* @default "ProSelect"
|
|
162
|
-
*/
|
|
163
|
-
type?: EnumComponentType;
|
|
164
|
-
/**
|
|
165
|
-
* @description 用于自定义组件
|
|
166
|
-
* @default -
|
|
167
|
-
*/
|
|
168
|
-
component?: ReactNode;
|
|
169
|
-
/**
|
|
170
|
-
* @description 用于提交 code
|
|
171
|
-
* @default -
|
|
172
|
-
*/
|
|
173
|
-
code?: string | string[];
|
|
174
|
-
/**
|
|
175
|
-
* @description 字段别名
|
|
176
|
-
* @default -
|
|
177
|
-
*/
|
|
178
|
-
fieldNames?: Record<string, string>;
|
|
179
|
-
/**
|
|
180
|
-
* @description 是否查看模式
|
|
181
|
-
* @default false
|
|
182
|
-
*/
|
|
183
|
-
isView?: boolean;
|
|
184
|
-
/**
|
|
185
|
-
* @description 数据源
|
|
186
|
-
* @default -
|
|
187
|
-
*/
|
|
188
|
-
dataSource?: DataOptionType[];
|
|
189
|
-
/**
|
|
190
|
-
* @description 当前值
|
|
191
|
-
* @default -
|
|
192
|
-
*/
|
|
193
|
-
value: any;
|
|
194
|
-
/**
|
|
195
|
-
* @description 值变化回调
|
|
196
|
-
* @default -
|
|
197
|
-
*/
|
|
198
|
-
onChange?: (value: any) => void;
|
|
199
|
-
/**
|
|
200
|
-
* @description 远程请求接口
|
|
201
|
-
* @default -
|
|
202
|
-
*/
|
|
203
|
-
useRequest?: {
|
|
204
|
-
/**
|
|
205
|
-
* @description 请求服务函数
|
|
206
|
-
*/
|
|
207
|
-
service: Service<any, any>;
|
|
208
|
-
/**
|
|
209
|
-
* @description 请求选项
|
|
210
|
-
*/
|
|
211
|
-
options?: Options<any, any>;
|
|
212
|
-
};
|
|
213
|
-
/**
|
|
214
|
-
* @description 对后台返回数据进行格式化
|
|
215
|
-
* @param data 后台返回的数据
|
|
216
|
-
* @returns 格式化后的选项数据
|
|
217
|
-
* @default -
|
|
218
|
-
*/
|
|
219
|
-
transformResponse?: (data: any) => DataOptionType[];
|
|
220
|
-
/**
|
|
221
|
-
* @description 是否合并数据
|
|
222
|
-
* @default false
|
|
223
|
-
*/
|
|
224
|
-
merge?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* @description 查看模式下为空展示
|
|
227
|
-
* @default "-"
|
|
228
|
-
*/
|
|
229
|
-
viewEmpty?: React.ReactNode;
|
|
230
|
-
/**
|
|
231
|
-
* @description 自定义选项渲染
|
|
232
|
-
* @default -
|
|
233
|
-
*/
|
|
234
|
-
optionRender?: any;
|
|
235
|
-
/**
|
|
236
|
-
* @description 显示 code-value 形式
|
|
237
|
-
* @default false
|
|
238
|
-
*/
|
|
239
|
-
showCodeName?: boolean;
|
|
240
|
-
/**
|
|
241
|
-
* @description 支持 {label:xx, value: xx} 形式
|
|
242
|
-
* @default false
|
|
243
|
-
*/
|
|
244
|
-
labelInValue?: boolean;
|
|
245
|
-
/**
|
|
246
|
-
* @description 其他表单属性
|
|
247
|
-
* @default -
|
|
248
|
-
*/
|
|
249
|
-
otherProps?: ProFormOtherType;
|
|
250
|
-
/**
|
|
251
|
-
* @description 是否允许清除
|
|
252
|
-
* @default false
|
|
253
|
-
*/
|
|
254
|
-
allowClear?: boolean;
|
|
255
|
-
/**
|
|
256
|
-
* @description 组件ID
|
|
257
|
-
* @default -
|
|
258
|
-
*/
|
|
259
|
-
id?: string;
|
|
260
|
-
/**
|
|
261
|
-
* @description 默认值
|
|
262
|
-
* @default -
|
|
263
|
-
*/
|
|
264
|
-
defaultValue?: any;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* @description ProSelect类型映射
|
|
268
|
-
*/
|
|
269
|
-
export type PropProSelectsMapType = {
|
|
270
|
-
/**
|
|
271
|
-
* @description 类型为ProSelect
|
|
272
|
-
* @default "ProSelect"
|
|
273
|
-
*/
|
|
274
|
-
type?: 'ProSelect';
|
|
275
|
-
} & PropSelectType;
|
|
276
|
-
/**
|
|
277
|
-
* @description Radio类型映射
|
|
278
|
-
*/
|
|
279
|
-
export type PropRadioPropsMapType = {
|
|
280
|
-
/**
|
|
281
|
-
* @description 类型为Radio
|
|
282
|
-
* @default "Radio"
|
|
283
|
-
*/
|
|
284
|
-
type?: 'Radio';
|
|
285
|
-
} & RadioProps;
|
|
286
|
-
/**
|
|
287
|
-
* @description Checkbox类型映射
|
|
288
|
-
*/
|
|
289
|
-
export type CheckboxPropsMapType = {
|
|
290
|
-
/**
|
|
291
|
-
* @description 类型为Checkbox
|
|
292
|
-
* @default "Checkbox"
|
|
293
|
-
*/
|
|
294
|
-
type?: 'Checkbox';
|
|
295
|
-
} & CheckboxProps;
|
|
296
|
-
/**
|
|
297
|
-
* @description Tag类型映射
|
|
298
|
-
*/
|
|
299
|
-
export interface TagPropsMapType {
|
|
300
|
-
/**
|
|
301
|
-
* @description 类型为Tag或Group
|
|
302
|
-
* @default -
|
|
303
|
-
*/
|
|
304
|
-
type?: 'Tag' | 'Group';
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* @description ProEnum组件属性类型
|
|
308
|
-
*/
|
|
309
|
-
export type ProEnumType = Omit<ProEnumBaseType, 'type'> & (PropProSelectsMapType | PropRadioPropsMapType | CheckboxPropsMapType | TagPropsMapType);
|
|
310
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { StorageType } from './index';
|
|
2
|
-
import type { FrequentEnumConfig } from '../propsType';
|
|
3
|
-
/**
|
|
4
|
-
* 替换频繁枚举缓存数据的参数接口
|
|
5
|
-
*/
|
|
6
|
-
export interface ReplaceFrequentEnumCacheParams {
|
|
7
|
-
/** 存储类型 */
|
|
8
|
-
storage: StorageType;
|
|
9
|
-
/** 缓存key */
|
|
10
|
-
cacheKey: string;
|
|
11
|
-
/** 需要替换的枚举code列表 */
|
|
12
|
-
enums: string[];
|
|
13
|
-
/** 新的枚举数据 */
|
|
14
|
-
newData: any;
|
|
15
|
-
/** 字段映射 */
|
|
16
|
-
fieldNames: any;
|
|
17
|
-
/** 是否清洗数据 */
|
|
18
|
-
clear: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 替换频繁枚举缓存数据
|
|
22
|
-
* @param params 参数对象
|
|
23
|
-
* @returns 更新后的缓存数据
|
|
24
|
-
*/
|
|
25
|
-
export declare function replaceFrequentEnumCache(params: ReplaceFrequentEnumCacheParams): any | Promise<any>;
|
|
26
|
-
/**
|
|
27
|
-
* 验证频繁枚举配置
|
|
28
|
-
* @param config 频繁枚举配置
|
|
29
|
-
* @returns 是否有效
|
|
30
|
-
*/
|
|
31
|
-
export declare function validateFrequentEnumConfig(config: FrequentEnumConfig): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* 合并频繁枚举数据到全局状态
|
|
34
|
-
* @param cacheData 缓存数据
|
|
35
|
-
* @param dics 现有字典数据
|
|
36
|
-
* @param dataSource 数据源
|
|
37
|
-
* @returns 合并后的数据
|
|
38
|
-
*/
|
|
39
|
-
export declare function mergeFrequentEnumData(cacheData: any, dics: any, dataSource: any): any;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { StorageType } from './index';
|
|
2
|
-
export interface GetEnumParams {
|
|
3
|
-
/** 单个枚举 code */
|
|
4
|
-
code?: string;
|
|
5
|
-
/** 多个枚举 code,与 code 互斥 */
|
|
6
|
-
codes?: string[];
|
|
7
|
-
/** 单值查询,返回 [label, option],与 values 互斥 */
|
|
8
|
-
value?: string | number;
|
|
9
|
-
/** 多值查询,返回 [labels[], options[]],与 value 互斥 */
|
|
10
|
-
values?: (string | number)[];
|
|
11
|
-
/** 为 true 时返回 value-label 组合形式 */
|
|
12
|
-
compose?: boolean;
|
|
13
|
-
/** 存储类型,默认 indexedDB */
|
|
14
|
-
storage?: StorageType;
|
|
15
|
-
/** 缓存 key,默认 zat-design-pro-component-cacheKey */
|
|
16
|
-
cacheKey?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 在函数/回调中获取枚举数据,无需在 React 组件内使用。
|
|
20
|
-
*
|
|
21
|
-
* 枚举数据由 ProConfigProvider 初始化时写入 storage。
|
|
22
|
-
*
|
|
23
|
-
* **同步优先策略**:
|
|
24
|
-
* - 内存缓存命中时直接返回值,无需 `await`
|
|
25
|
-
* - localStorage/sessionStorage 首次调用同步读取并预热内存缓存
|
|
26
|
-
* - indexedDB 首次调用(内存未命中)返回 Promise,需 `await` 兜底
|
|
27
|
-
*
|
|
28
|
-
* 典型用法:在 ProConfigProvider 初始化完成后,事件回调/工具函数中直接调用无需 await:
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* // 获取全部枚举(内存命中时同步返回)
|
|
32
|
-
* const allEnums = getEnum(config);
|
|
33
|
-
*
|
|
34
|
-
* // 获取单个枚举 options
|
|
35
|
-
* const [cityOptions, getLabel] = getEnum({ code: 'city', ...config });
|
|
36
|
-
*
|
|
37
|
-
* // 获取多个枚举
|
|
38
|
-
* const { city, status } = getEnum({ codes: ['city', 'status'], ...config });
|
|
39
|
-
*
|
|
40
|
-
* // 根据值查询 label
|
|
41
|
-
* const [label, option] = getEnum({ code: 'city', value: 'sh', ...config });
|
|
42
|
-
*
|
|
43
|
-
* // indexedDB 首次加载时兜底(数据未预热时需 await)
|
|
44
|
-
* const allEnums = await getEnum(config);
|
|
45
|
-
*/
|
|
46
|
-
declare function getEnum(params?: GetEnumParams): any;
|
|
47
|
-
export default getEnum;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { DataOptionType } from '../propsType';
|
|
2
|
-
export type StorageType = 'localStorage' | 'sessionStorage' | 'indexedDB';
|
|
3
|
-
export declare const baseCacheKey = "zat-design-pro-component-cacheKey";
|
|
4
|
-
/** v4 默认存储类型 */
|
|
5
|
-
export declare const baseStorage: StorageType;
|
|
6
|
-
/** 模块级内存缓存,key 为 cacheKey,替代原单例 baseEnumStorage 变量 */
|
|
7
|
-
export declare const enumMemoryCache: Map<string, any>;
|
|
8
|
-
/**
|
|
9
|
-
* 从 IndexedDB 读取数据
|
|
10
|
-
*/
|
|
11
|
-
interface EnumRes {
|
|
12
|
-
data: Record<string, DataOptionType[]>;
|
|
13
|
-
dataLength?: number;
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
}
|
|
16
|
-
export declare function normalizeEnumCacheData(cacheData: any): EnumRes;
|
|
17
|
-
/**
|
|
18
|
-
* 获取枚举数据
|
|
19
|
-
* @param storage
|
|
20
|
-
* @param cacheKey
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export declare function getEnumData(storage: StorageType, cacheKey: string): EnumRes | Promise<EnumRes>;
|
|
24
|
-
/**
|
|
25
|
-
* 设置枚举数据
|
|
26
|
-
* @param storage
|
|
27
|
-
* @param cacheKey
|
|
28
|
-
* @param data
|
|
29
|
-
*/
|
|
30
|
-
export declare function setEnumData(storage: StorageType, cacheKey: string, data: any): void | Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* 删除枚举缓存数据
|
|
33
|
-
* @param storage
|
|
34
|
-
* @param cacheKey
|
|
35
|
-
*/
|
|
36
|
-
export declare function removeEnumData(storage: StorageType, cacheKey: string): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* 从内存缓存或同步存储中同步读取枚举数据,不触发任何异步 I/O。
|
|
39
|
-
* - 内存缓存命中时直接返回
|
|
40
|
-
* - localStorage/sessionStorage 同步读取并预热内存缓存
|
|
41
|
-
* - indexedDB 未命中时返回 undefined(需异步兜底)
|
|
42
|
-
*/
|
|
43
|
-
export declare function getEnumDataSync(storage: StorageType, cacheKey: string): EnumRes | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* 判断枚举列表是否存在
|
|
46
|
-
* @param storage
|
|
47
|
-
* @param cacheKey
|
|
48
|
-
* @param code
|
|
49
|
-
* @returns
|
|
50
|
-
*/
|
|
51
|
-
export declare function hasEnumList(storage: StorageType, cacheKey: string, code: string): false | DataOptionType[];
|
|
52
|
-
/**
|
|
53
|
-
* 判断是否是对象
|
|
54
|
-
* @param obj
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
export declare function isObject(obj: any): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* 合并枚举数据
|
|
60
|
-
* @param storage
|
|
61
|
-
* @param code
|
|
62
|
-
* @param cacheKey
|
|
63
|
-
* @param responseData
|
|
64
|
-
*/
|
|
65
|
-
export declare function mergeCacheData(storage: StorageType, code: string, cacheKey: string, responseData: any): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* diff code 差异
|
|
68
|
-
* @param cacheCodes
|
|
69
|
-
* @param codes
|
|
70
|
-
* @returns
|
|
71
|
-
*/
|
|
72
|
-
export declare function diffCode(cacheCodes: string[], codes: string[]): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* 缓存fieldNames制定的值
|
|
75
|
-
* @param fieldNames 保留映射值
|
|
76
|
-
* @param dataSource 需要筛选的数据源
|
|
77
|
-
* @returns {}
|
|
78
|
-
*/
|
|
79
|
-
export declare function cacheFieldNames(fieldNames: {
|
|
80
|
-
[key: string]: string;
|
|
81
|
-
}, dataSource: {
|
|
82
|
-
[key: string]: any;
|
|
83
|
-
}): any;
|
|
84
|
-
export {};
|