@zat-design/sisyphus-react 4.5.9 → 4.5.10-beta.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/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/FormsProvider/index.js +14 -21
- package/es/ProAction/components/CheckModalContent/index.js +12 -26
- package/es/ProAction/index.js +79 -83
- package/es/ProAction/propsType.js +0 -1
- package/es/ProConfigProvider/index.js +63 -110
- package/es/ProConfigProvider/propsType.js +0 -1
- package/es/ProDownload/index.d.ts +2 -1
- package/es/ProDownload/index.js +74 -69
- package/es/ProDownload/propsType.js +0 -1
- package/es/ProDownload/utils.d.ts +10 -5
- package/es/ProDownload/utils.js +63 -95
- package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
- package/es/ProDrawerForm/components/ProModal/index.js +77 -108
- package/es/ProDrawerForm/components/index.js +6 -2
- package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
- package/es/ProDrawerForm/index.js +29 -38
- package/es/ProDrawerForm/propsType.js +0 -1
- package/es/ProDrawerForm/utils/index.js +18 -36
- package/es/ProEditLabel/components/RenderProForm.js +45 -49
- package/es/ProEditLabel/index.js +126 -163
- package/es/ProEditLabel/propsType.js +0 -1
- package/es/ProEditLabel/utils/index.js +5 -8
- package/es/ProEditTable/components/ActionButton/index.js +111 -119
- package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
- package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
- package/es/ProEditTable/components/RcTable/index.js +6 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
- package/es/ProEditTable/components/RenderField/index.js +490 -587
- package/es/ProEditTable/components/RenderField/propsType.js +0 -1
- package/es/ProEditTable/components/RenderField/tools.js +115 -112
- package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
- package/es/ProEditTable/components/Summary/index.js +38 -64
- package/es/ProEditTable/components/Validator/index.js +46 -46
- package/es/ProEditTable/components/index.js +12 -5
- package/es/ProEditTable/index.js +456 -378
- package/es/ProEditTable/propsType.js +0 -1
- package/es/ProEditTable/utils/config.js +60 -122
- package/es/ProEditTable/utils/diffOriginal.js +45 -82
- package/es/ProEditTable/utils/getDefaultProps.js +19 -24
- package/es/ProEditTable/utils/index.js +154 -235
- package/es/ProEditTable/utils/tools.js +149 -286
- package/es/ProEditTable/utils/transform.js +25 -30
- package/es/ProEditTable/utils/useEditTableError.js +30 -43
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
- package/es/ProEditTable/utils/validateAll.js +87 -154
- package/es/ProEnum/components/Group.js +38 -30
- package/es/ProEnum/components/Tag.js +22 -26
- package/es/ProEnum/hooks/useEnum.js +48 -116
- package/es/ProEnum/hooks/useEnumRequest.js +182 -212
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
- package/es/ProEnum/index.js +162 -172
- package/es/ProEnum/propsType.js +0 -1
- package/es/ProEnum/utils/eventCenter.js +10 -12
- package/es/ProEnum/utils/frequentEnum.js +35 -92
- package/es/ProEnum/utils/getEnum.js +32 -90
- package/es/ProEnum/utils/getEnumLabel.js +44 -49
- package/es/ProEnum/utils/index.js +93 -207
- package/es/ProForm/components/Container.js +13 -28
- package/es/ProForm/components/FormFooter/index.js +36 -44
- package/es/ProForm/components/FormFooter/propsType.js +0 -1
- package/es/ProForm/components/base/Checkbox/index.js +32 -59
- package/es/ProForm/components/base/DatePicker/index.js +49 -71
- package/es/ProForm/components/base/Input/index.js +63 -97
- package/es/ProForm/components/base/Input/propsType.js +0 -1
- package/es/ProForm/components/base/InputNumber/index.js +118 -172
- package/es/ProForm/components/base/Radio/index.js +39 -52
- package/es/ProForm/components/base/RangePicker/index.js +109 -127
- package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
- package/es/ProForm/components/base/Select/index.js +63 -89
- package/es/ProForm/components/base/Switch/index.js +27 -35
- package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
- package/es/ProForm/components/base/TextArea/index.js +30 -41
- package/es/ProForm/components/base/TimePicker/index.js +27 -37
- package/es/ProForm/components/combination/Container/index.js +37 -47
- package/es/ProForm/components/combination/Container/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
- package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
- package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
- package/es/ProForm/components/combination/FormList/index.js +151 -161
- package/es/ProForm/components/combination/FormList/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/style/index.less +6 -0
- package/es/ProForm/components/combination/FormList/utils.js +22 -38
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
- package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
- package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
- package/es/ProForm/components/combination/Group/index.js +87 -126
- package/es/ProForm/components/combination/Group/propsType.js +0 -1
- package/es/ProForm/components/combination/Group/utils/index.js +124 -239
- package/es/ProForm/components/combination/ProCascader/index.js +156 -199
- package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
- package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
- package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
- package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
- package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
- package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
- package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
- package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
- package/es/ProForm/components/index.js +56 -34
- package/es/ProForm/components/render/ChangedWrapper.js +85 -94
- package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
- package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
- package/es/ProForm/components/render/Render.js +223 -329
- package/es/ProForm/components/render/RenderFields.js +76 -113
- package/es/ProForm/components/render/propsType.js +0 -1
- package/es/ProForm/hooks/useControlled.js +8 -10
- package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
- package/es/ProForm/hooks/useFieldProps.js +8 -4
- package/es/ProForm/hooks/useForm.js +50 -110
- package/es/ProForm/hooks/useRules.js +17 -33
- package/es/ProForm/hooks/useShouldUpdate.js +77 -152
- package/es/ProForm/hooks/useWatch.js +62 -134
- package/es/ProForm/index.js +157 -194
- package/es/ProForm/propsType.js +15 -7
- package/es/ProForm/utils/buildFormItemProps.js +51 -58
- package/es/ProForm/utils/diffOriginal.js +43 -73
- package/es/ProForm/utils/getDefaultProps.js +18 -24
- package/es/ProForm/utils/index.js +160 -235
- package/es/ProForm/utils/processDependencies.js +21 -60
- package/es/ProForm/utils/reactiveValues.js +20 -34
- package/es/ProForm/utils/rulesCreator.js +42 -40
- package/es/ProForm/utils/transformNames.js +10 -13
- package/es/ProForm/utils/transformValue.js +16 -29
- package/es/ProForm/utils/valueType.js +96 -178
- package/es/ProIcon/config/index.js +340 -274
- package/es/ProIcon/index.js +135 -209
- package/es/ProIcon/propsTypes.js +0 -1
- package/es/ProIcon/utils/index.js +24 -39
- package/es/ProLayout/components/Layout/Header/index.js +108 -141
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
- package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
- package/es/ProLayout/components/Layout/Menu/index.js +92 -89
- package/es/ProLayout/components/Layout/Notice/index.js +13 -27
- package/es/ProLayout/components/Layout/index.js +8 -3
- package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
- package/es/ProLayout/components/ProCollapse/index.js +89 -111
- package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
- package/es/ProLayout/components/ProFooter/index.js +27 -24
- package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
- package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
- package/es/ProLayout/components/ProHeader/components/index.js +6 -2
- package/es/ProLayout/components/ProHeader/index.js +216 -356
- package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
- package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
- package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
- package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
- package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
- package/es/ProLayout/components/TabsManager/index.js +407 -351
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
- package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
- package/es/ProLayout/components/TabsManager/style/index.less +1 -1
- package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
- package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
- package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
- package/es/ProLayout/components/index.js +8 -3
- package/es/ProLayout/index.js +173 -228
- package/es/ProLayout/propTypes.d.ts +28 -1
- package/es/ProLayout/propTypes.js +12 -52
- package/es/ProLayout/utils/index.js +48 -128
- package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
- package/es/ProSelect/index.js +187 -223
- package/es/ProSelect/propsType.js +0 -1
- package/es/ProSelect/style/index.less +13 -0
- package/es/ProSelect/utils/index.js +100 -146
- package/es/ProStep/components/Anchor/index.js +71 -82
- package/es/ProStep/components/Item/index.js +49 -56
- package/es/ProStep/components/LazyLoad/index.js +23 -29
- package/es/ProStep/components/Listener/index.js +20 -33
- package/es/ProStep/components/Step/index.js +31 -38
- package/es/ProStep/constants.js +4 -1
- package/es/ProStep/index.js +166 -153
- package/es/ProStep/propsType.js +0 -1
- package/es/ProStep/style/index.less +1 -1
- package/es/ProStep/utils/index.js +29 -55
- package/es/ProStepTab/index.js +83 -138
- package/es/ProStepTab/propsType.js +0 -1
- package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
- package/es/ProTable/components/EditableCell/index.js +37 -71
- package/es/ProTable/components/EditableCell/propsType.js +0 -1
- package/es/ProTable/components/FormatColumn/index.js +209 -340
- package/es/ProTable/components/FormatColumn/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
- package/es/ProTable/components/RcTable/index.js +6 -4
- package/es/ProTable/components/RenderColumn/index.js +158 -186
- package/es/ProTable/components/RenderEmptyText/index.js +12 -21
- package/es/ProTable/components/RenderFooter/index.js +15 -15
- package/es/ProTable/components/RenderSummary/index.js +33 -50
- package/es/ProTable/components/RenderTableHeader/index.js +44 -46
- package/es/ProTable/components/RenderTabs/index.js +47 -51
- package/es/ProTable/components/TableResizable/index.js +56 -72
- package/es/ProTable/components/TooltipTitle/index.js +13 -21
- package/es/ProTable/components/index.js +16 -36
- package/es/ProTable/hooks/useAntdTable.js +191 -224
- package/es/ProTable/index.js +232 -249
- package/es/ProTable/propsType.js +0 -1
- package/es/ProTable/utils/columnStorage.js +63 -88
- package/es/ProTable/utils/index.js +57 -90
- package/es/ProTabs/components/Card/index.js +20 -48
- package/es/ProTabs/components/index.js +4 -1
- package/es/ProTabs/index.js +41 -58
- package/es/ProTabs/propType.js +0 -1
- package/es/ProThemeTools/component/ProTools/index.js +106 -158
- package/es/ProThemeTools/component/index.js +4 -1
- package/es/ProThemeTools/context/ThemeContext.js +67 -146
- package/es/ProThemeTools/index.js +103 -156
- package/es/ProThemeTools/propsType.js +0 -1
- package/es/ProThemeTools/utils/index.js +60 -109
- package/es/ProTooltip/index.js +132 -168
- package/es/ProTooltip/propsType.js +0 -1
- package/es/ProTree/components/AdaptiveTooltip.js +15 -17
- package/es/ProTree/components/CloseIcon.js +18 -26
- package/es/ProTree/components/List.js +28 -47
- package/es/ProTree/components/ProTree.js +152 -211
- package/es/ProTree/components/ProTreeSelect/index.js +255 -459
- package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
- package/es/ProTree/components/SearchTitle.js +23 -42
- package/es/ProTree/components/Tree.js +147 -195
- package/es/ProTree/components/index.js +10 -5
- package/es/ProTree/index.js +12 -16
- package/es/ProTree/propsType.js +0 -1
- package/es/ProTree/utils.js +46 -118
- package/es/ProTreeModal/components/Cascader.js +56 -64
- package/es/ProTreeModal/components/CloseIcon.js +18 -26
- package/es/ProTreeModal/components/List.js +114 -180
- package/es/ProTreeModal/components/SearchTitle.js +15 -18
- package/es/ProTreeModal/components/SortableItem.js +29 -58
- package/es/ProTreeModal/components/Tree.js +99 -113
- package/es/ProTreeModal/components/Trigger.js +87 -121
- package/es/ProTreeModal/components/index.js +14 -6
- package/es/ProTreeModal/index.js +397 -438
- package/es/ProTreeModal/propsType.js +0 -1
- package/es/ProTreeModal/utils.js +52 -95
- package/es/ProUpload/components/ButtonRender.js +44 -54
- package/es/ProUpload/components/DragRender.js +94 -148
- package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
- package/es/ProUpload/components/Example.js +27 -31
- package/es/ProUpload/components/FileItem.js +69 -163
- package/es/ProUpload/components/ImageRender.js +134 -170
- package/es/ProUpload/index.js +68 -100
- package/es/ProUpload/propsType.js +0 -1
- package/es/ProUpload/uitls.js +8 -4
- package/es/ProUtils/utils/index.js +17 -13
- package/es/ProViewer/index.js +154 -175
- package/es/ProViewer/propsType.js +0 -5
- package/es/ProWaterMark/index.js +9 -16
- package/es/ProWaterMark/propsType.js +0 -1
- package/es/hooks/useDraggableRow.js +25 -53
- package/es/index.js +57 -77
- package/es/locale/en_US.js +153 -142
- package/es/locale/index.js +23 -36
- package/es/locale/zh_CN.js +145 -142
- package/es/tokens.js +84 -83
- package/es/utils/index.js +24 -51
- package/package.json +4 -2
- package/es/ProConfigProvider/demo/locale.js +0 -58
|
@@ -1,45 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _isFunction from "lodash/isFunction";
|
|
4
|
-
import _transform from "lodash/transform";
|
|
5
|
-
import _isEqual from "lodash/isEqual";
|
|
6
|
-
import _isObject from "lodash/isObject";
|
|
7
|
-
import _isString from "lodash/isString";
|
|
8
|
-
import _cloneDeepWith from "lodash/cloneDeepWith";
|
|
9
|
-
import _cloneDeep from "lodash/cloneDeep";
|
|
10
|
-
/* eslint-disable no-await-in-loop */
|
|
11
|
-
/* eslint-disable no-restricted-syntax */
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { tools, validate } from '@zat-design/utils';
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { tools, validate } from "@zat-design/utils";
|
|
14
3
|
import { generateId } from "../../utils";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (userKey != null && !Number.isNaN(userKey) && userKey !== '') {
|
|
4
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
5
|
+
import cloneDeepWith from "lodash/cloneDeepWith";
|
|
6
|
+
import isString from "lodash/isString";
|
|
7
|
+
import isObject from "lodash/isObject";
|
|
8
|
+
import isEqual from "lodash/isEqual";
|
|
9
|
+
import transform from "lodash/transform";
|
|
10
|
+
import isFunction from "lodash/isFunction";
|
|
11
|
+
import isBoolean from "lodash/isBoolean";
|
|
12
|
+
import get from "lodash/get";
|
|
13
|
+
const getRandom = () => generateId();
|
|
14
|
+
const buildTableRowKey = (rowKey) => {
|
|
15
|
+
return (record) => {
|
|
16
|
+
if (!rowKey)
|
|
17
|
+
return String(record.rowKey || "");
|
|
18
|
+
const userKey = typeof rowKey === "function" ? rowKey(record) : record[rowKey];
|
|
19
|
+
if (userKey != null && !Number.isNaN(userKey) && userKey !== "") {
|
|
32
20
|
return String(userKey);
|
|
33
21
|
}
|
|
34
|
-
return String(record.rowKey ||
|
|
22
|
+
return String(record.rowKey || "");
|
|
35
23
|
};
|
|
36
24
|
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 表格行数据的浅比较:仅比较第一层字段引用/值,避免虚拟滚动时整行深比较开销。
|
|
40
|
-
* 行对象在本组件场景通常为扁平标量字段;同引用时由调用方另行处理。
|
|
41
|
-
*/
|
|
42
|
-
export const isRecordShallowEqual = (a, b) => {
|
|
25
|
+
const isRecordShallowEqual = (a, b) => {
|
|
43
26
|
if (a === b) {
|
|
44
27
|
return true;
|
|
45
28
|
}
|
|
@@ -51,163 +34,95 @@ export const isRecordShallowEqual = (a, b) => {
|
|
|
51
34
|
if (aKeys.length !== bKeys.length) {
|
|
52
35
|
return false;
|
|
53
36
|
}
|
|
54
|
-
return aKeys.every(key => a[key] === b[key]);
|
|
37
|
+
return aKeys.every((key) => a[key] === b[key]);
|
|
55
38
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* @returns 差异对象
|
|
62
|
-
*/
|
|
63
|
-
export const difference = (object, base) => {
|
|
64
|
-
const changes = (object, base) => {
|
|
65
|
-
return _transform(object, (result, value, key) => {
|
|
66
|
-
if (!_isEqual(value, base?.[key])) {
|
|
67
|
-
result[key] = _isObject(value) && _isObject(base?.[key]) ? changes(value, base?.[key]) : value;
|
|
39
|
+
const difference = (object, base) => {
|
|
40
|
+
const changes = (object2, base2) => {
|
|
41
|
+
return transform(object2, (result, value, key) => {
|
|
42
|
+
if (!isEqual(value, base2 == null ? void 0 : base2[key])) {
|
|
43
|
+
result[key] = isObject(value) && isObject(base2 == null ? void 0 : base2[key]) ? changes(value, base2 == null ? void 0 : base2[key]) : value;
|
|
68
44
|
}
|
|
69
45
|
});
|
|
70
46
|
};
|
|
71
47
|
return changes(object, base);
|
|
72
48
|
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* 数组字段循环校验,解决validateFields无法批量校验的问题
|
|
76
|
-
* @param validateKeys 校验键数组
|
|
77
|
-
* @param form 表单实例
|
|
78
|
-
* @param rowName 行名称路径
|
|
79
|
-
* @returns 校验结果Promise
|
|
80
|
-
*/
|
|
81
|
-
export const customValidate = (validateKeys, form, rowName) => {
|
|
49
|
+
const customValidate = (validateKeys, form, rowName) => {
|
|
82
50
|
const array = [];
|
|
83
|
-
validateKeys.forEach(key => {
|
|
84
|
-
array.push([...
|
|
51
|
+
validateKeys.forEach((key) => {
|
|
52
|
+
array.push([...Array.isArray(rowName) ? rowName : [rowName], key]);
|
|
85
53
|
});
|
|
86
54
|
return form.validateFields(array);
|
|
87
55
|
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* 拆解数组names
|
|
91
|
-
* @param names 名称数组
|
|
92
|
-
* @returns 拆解后的字符串
|
|
93
|
-
*/
|
|
94
|
-
export const splitNames = names => {
|
|
56
|
+
const splitNames = (names) => {
|
|
95
57
|
let result;
|
|
96
58
|
const resultArray = [];
|
|
97
|
-
if (
|
|
98
|
-
result = names.join(
|
|
59
|
+
if (isString(names[0])) {
|
|
60
|
+
result = names.join("-");
|
|
99
61
|
return result;
|
|
100
62
|
}
|
|
101
|
-
names.forEach(item => {
|
|
102
|
-
if (
|
|
63
|
+
names.forEach((item) => {
|
|
64
|
+
if (isString(item[0])) {
|
|
103
65
|
resultArray.push(`${item[0]}_${item[1]}`);
|
|
104
66
|
}
|
|
105
67
|
});
|
|
106
|
-
result = resultArray.join(
|
|
68
|
+
result = resultArray.join("-");
|
|
107
69
|
return result;
|
|
108
70
|
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 判断值是否为空
|
|
112
|
-
* @param value 需要判断的值
|
|
113
|
-
* @returns 是否为空
|
|
114
|
-
*/
|
|
115
|
-
const isNull = value => {
|
|
71
|
+
const isNull = (value) => {
|
|
116
72
|
if (Array.isArray(value) && value.length) {
|
|
117
|
-
return value.some(item => isNull(item));
|
|
73
|
+
return value.some((item) => isNull(item));
|
|
118
74
|
}
|
|
119
|
-
return value ===
|
|
75
|
+
return value === "" || value === void 0 || value === null || Array.isArray(value) && value.length === 0;
|
|
120
76
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
* 用于行数据被联动改写(兄弟列 onFieldChange 回填)后,按真实字段名重校验与清理常驻报错,
|
|
128
|
-
* 修复 group 列旧报错不清的问题。
|
|
129
|
-
*/
|
|
130
|
-
export const resolveChangedFields = (changedKeys, columns = []) => {
|
|
131
|
-
const result = new Set();
|
|
132
|
-
(changedKeys || []).forEach(key => {
|
|
133
|
-
const groupCol = columns?.find?.(col => Array.isArray(col?.names) && col.names.includes(key));
|
|
77
|
+
const resolveChangedFields = (changedKeys, columns = []) => {
|
|
78
|
+
const result = /* @__PURE__ */ new Set();
|
|
79
|
+
(changedKeys || []).forEach((key) => {
|
|
80
|
+
var _a;
|
|
81
|
+
const groupCol = (_a = columns == null ? void 0 : columns.find) == null ? void 0 : _a.call(columns, (col) => Array.isArray(col == null ? void 0 : col.names) && col.names.includes(key));
|
|
134
82
|
result.add(groupCol ? splitNames(groupCol.names) : key);
|
|
135
83
|
});
|
|
136
84
|
return Array.from(result);
|
|
137
85
|
};
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* 把联动回填后的子键,重新组合并写回 names 组合列的合并字段(store)。
|
|
141
|
-
*
|
|
142
|
-
* 背景:names 组合列真正被校验的是合并字段(splitNames(names),如 certType-certNo),
|
|
143
|
-
* 其值仅在渲染期由 getValueProps 从子键组合后写回 store。联动回填(兄弟列 onFieldChange)
|
|
144
|
-
* 只直接写入子键,不经过该字段的 normalize/渲染,导致合并字段 store 值未更新 →
|
|
145
|
-
* 按合并名校验时读到旧空值、红字不清。这里按当前行子键即时组合并写回,确保 validateFields 读到最新值。
|
|
146
|
-
*/
|
|
147
|
-
export const syncGroupCombinedValues = (form, rowPath, changedKeys, columns = []) => {
|
|
86
|
+
const syncGroupCombinedValues = (form, rowPath, changedKeys, columns = []) => {
|
|
148
87
|
const row = form.getFieldValue(rowPath) || {};
|
|
149
|
-
(columns || []).forEach(col => {
|
|
150
|
-
if (!Array.isArray(col
|
|
88
|
+
(columns || []).forEach((col) => {
|
|
89
|
+
if (!Array.isArray(col == null ? void 0 : col.names)) {
|
|
151
90
|
return;
|
|
152
91
|
}
|
|
153
|
-
const touched = col.names.some(key => changedKeys.includes(key));
|
|
92
|
+
const touched = col.names.some((key) => changedKeys.includes(key));
|
|
154
93
|
if (!touched) {
|
|
155
94
|
return;
|
|
156
95
|
}
|
|
157
|
-
const combined = col.names.map(key =>
|
|
158
|
-
const isAllEmpty = combined.every(item => isNull(item));
|
|
159
|
-
form.setFieldValue([...rowPath, splitNames(col.names)], isAllEmpty ?
|
|
96
|
+
const combined = col.names.map((key) => get(row, key));
|
|
97
|
+
const isAllEmpty = combined.every((item) => isNull(item));
|
|
98
|
+
form.setFieldValue([...rowPath, splitNames(col.names)], isAllEmpty ? void 0 : combined);
|
|
160
99
|
});
|
|
161
100
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
* 获取中间formItem的name
|
|
165
|
-
* @param name 名称路径
|
|
166
|
-
* @param virtualKey 虚拟键
|
|
167
|
-
* @returns 完整名称路径数组
|
|
168
|
-
*/
|
|
169
|
-
export const getNamePath = (name, virtualKey) => {
|
|
170
|
-
const nextName = _cloneDeep(Array.isArray(name) ? name : [name]);
|
|
101
|
+
const getNamePath = (name, virtualKey) => {
|
|
102
|
+
const nextName = cloneDeep(Array.isArray(name) ? name : [name]);
|
|
171
103
|
const lastIndex = nextName.length - 1;
|
|
172
|
-
|
|
173
|
-
nextName[lastIndex] = `${nextName[lastIndex]}${virtualKey ? `-${virtualKey}` : ''}`;
|
|
104
|
+
nextName[lastIndex] = `${nextName[lastIndex]}${virtualKey ? `-${virtualKey}` : ""}`;
|
|
174
105
|
return nextName;
|
|
175
106
|
};
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* 删除操作
|
|
179
|
-
* @param params 删除参数
|
|
180
|
-
*/
|
|
181
|
-
export const onDelete = ({
|
|
107
|
+
const onDelete = ({
|
|
182
108
|
name,
|
|
183
109
|
form,
|
|
184
110
|
virtualKey,
|
|
185
111
|
selectedRowKeys
|
|
186
112
|
}) => {
|
|
187
|
-
// 正常的form数据流处理
|
|
188
|
-
// 行可能为 undefined/null(单行编辑下虚拟数组多轮增删改后残留的空位),过滤时需先做空值守卫
|
|
189
113
|
let dataSource = form.getFieldValue(name);
|
|
190
|
-
dataSource = dataSource.filter(row => row && !selectedRowKeys.includes(row.rowKey));
|
|
114
|
+
dataSource = dataSource.filter((row) => row && !selectedRowKeys.includes(row.rowKey));
|
|
191
115
|
form.setFieldValue(name, dataSource);
|
|
192
|
-
// 单行模式数据流处理 重置中间正在编辑状态单行数据
|
|
193
116
|
if (virtualKey) {
|
|
194
117
|
const namePath = getNamePath(name, virtualKey);
|
|
195
118
|
let virtualList = form.getFieldValue(namePath);
|
|
196
|
-
if (virtualList
|
|
197
|
-
virtualList = virtualList.filter(row => row && !selectedRowKeys.includes(row.rowKey));
|
|
119
|
+
if (virtualList == null ? void 0 : virtualList.length) {
|
|
120
|
+
virtualList = virtualList.filter((row) => row && !selectedRowKeys.includes(row.rowKey));
|
|
198
121
|
form.setFieldValue(namePath, virtualList);
|
|
199
122
|
}
|
|
200
123
|
}
|
|
201
124
|
};
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* 获取最终的disabled, 两种模式【子级优先,全局优先】
|
|
205
|
-
* 全局优先:globalControl为true时,全局控制
|
|
206
|
-
* 子级优先:globalControl为false时,子级控制
|
|
207
|
-
* @param params 禁用参数
|
|
208
|
-
* @returns 是否禁用
|
|
209
|
-
*/
|
|
210
|
-
export const getDisabled = ({
|
|
125
|
+
const getDisabled = ({
|
|
211
126
|
globalControl,
|
|
212
127
|
formDisabled,
|
|
213
128
|
column,
|
|
@@ -216,11 +131,11 @@ export const getDisabled = ({
|
|
|
216
131
|
params,
|
|
217
132
|
rowDisabled
|
|
218
133
|
}) => {
|
|
219
|
-
const convertToBoolean = value => {
|
|
134
|
+
const convertToBoolean = (value) => {
|
|
220
135
|
if (Array.isArray(value)) {
|
|
221
136
|
return Boolean(value.length);
|
|
222
137
|
}
|
|
223
|
-
if (value === null || value ===
|
|
138
|
+
if (value === null || value === void 0 || value === "") {
|
|
224
139
|
return false;
|
|
225
140
|
}
|
|
226
141
|
if (value === 0) {
|
|
@@ -228,21 +143,14 @@ export const getDisabled = ({
|
|
|
228
143
|
}
|
|
229
144
|
return Boolean(value);
|
|
230
145
|
};
|
|
231
|
-
|
|
232
|
-
// 新格式:params = [values, { form, index, namePath }]
|
|
233
146
|
const [values, reactiveParams] = params;
|
|
234
|
-
|
|
235
|
-
// 判断是否有column的disabled属性
|
|
236
147
|
const noColumnDisabled = () => {
|
|
237
|
-
if (
|
|
148
|
+
if (isFunction(column == null ? void 0 : column.disabled) || isFunction(columnFieldProps == null ? void 0 : columnFieldProps.disabled) || isBoolean(column == null ? void 0 : column.disabled) || isBoolean(columnFieldProps == null ? void 0 : columnFieldProps.disabled)) {
|
|
238
149
|
return false;
|
|
239
150
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
disabled
|
|
244
|
-
} = columnFieldProps(values, reactiveParams);
|
|
245
|
-
if (_isFunction(disabled) || _isBoolean(disabled)) {
|
|
151
|
+
if (isFunction(columnFieldProps)) {
|
|
152
|
+
const { disabled } = columnFieldProps(values, reactiveParams);
|
|
153
|
+
if (isFunction(disabled) || isBoolean(disabled)) {
|
|
246
154
|
return false;
|
|
247
155
|
}
|
|
248
156
|
}
|
|
@@ -251,60 +159,42 @@ export const getDisabled = ({
|
|
|
251
159
|
if (globalControl) {
|
|
252
160
|
return convertToBoolean(formDisabled) || convertToBoolean(tabledDisabled);
|
|
253
161
|
}
|
|
254
|
-
if (rowDisabled ===
|
|
162
|
+
if (rowDisabled === "empty") {
|
|
255
163
|
return false;
|
|
256
164
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
if (Array.isArray(columnFieldProps?.disabled)) {
|
|
261
|
-
return columnFieldProps?.disabled;
|
|
165
|
+
if (["RangePicker", "ProNumberRange", "Group"].includes(column.type)) {
|
|
166
|
+
if (Array.isArray(columnFieldProps == null ? void 0 : columnFieldProps.disabled)) {
|
|
167
|
+
return columnFieldProps == null ? void 0 : columnFieldProps.disabled;
|
|
262
168
|
}
|
|
263
|
-
if (Array.isArray(column
|
|
169
|
+
if (Array.isArray(column == null ? void 0 : column.disabled)) {
|
|
264
170
|
return column.disabled;
|
|
265
171
|
}
|
|
266
|
-
if (
|
|
267
|
-
return column
|
|
172
|
+
if (isFunction(column == null ? void 0 : column.disabled)) {
|
|
173
|
+
return column == null ? void 0 : column.disabled(values, reactiveParams);
|
|
268
174
|
}
|
|
269
175
|
}
|
|
270
|
-
|
|
271
|
-
// 当表单含有diabled属性时,优先使用表单的disabled
|
|
272
|
-
if (_isFunction(rowDisabled) && noColumnDisabled()) {
|
|
176
|
+
if (isFunction(rowDisabled) && noColumnDisabled()) {
|
|
273
177
|
return rowDisabled(values);
|
|
274
178
|
}
|
|
275
|
-
if (
|
|
276
|
-
return convertToBoolean(column
|
|
179
|
+
if (isFunction(column == null ? void 0 : column.disabled)) {
|
|
180
|
+
return convertToBoolean(column == null ? void 0 : column.disabled(values, reactiveParams));
|
|
277
181
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const {
|
|
282
|
-
disabled
|
|
283
|
-
} = columnFieldProps(values, reactiveParams);
|
|
284
|
-
if (_isFunction(disabled)) {
|
|
182
|
+
if (isFunction(columnFieldProps)) {
|
|
183
|
+
const { disabled } = columnFieldProps(values, reactiveParams);
|
|
184
|
+
if (isFunction(disabled)) {
|
|
285
185
|
return convertToBoolean(disabled(values, reactiveParams));
|
|
286
186
|
}
|
|
287
|
-
if (
|
|
187
|
+
if (isBoolean(disabled)) {
|
|
288
188
|
return convertToBoolean(disabled);
|
|
289
189
|
}
|
|
290
190
|
}
|
|
291
|
-
if (
|
|
292
|
-
return convertToBoolean(columnFieldProps
|
|
191
|
+
if (isFunction(columnFieldProps == null ? void 0 : columnFieldProps.disabled)) {
|
|
192
|
+
return convertToBoolean(columnFieldProps == null ? void 0 : columnFieldProps.disabled(values, reactiveParams));
|
|
293
193
|
}
|
|
294
|
-
return convertToBoolean(column
|
|
194
|
+
return convertToBoolean((column == null ? void 0 : column.disabled) ?? (columnFieldProps == null ? void 0 : columnFieldProps.disabled) ?? tabledDisabled);
|
|
295
195
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* 判断单元格是否为「左固定列」。
|
|
299
|
-
* antd6 固定列类名为 *-cell-fix-start(逻辑属性,支持 RTL),不再是旧版的 *-cell-fix-left;
|
|
300
|
-
* 兼容两者,避免漏算固定列宽导致报错单元格被固定列遮挡。
|
|
301
|
-
*/
|
|
302
|
-
const isFixStartCell = el => /table-cell-fix-(start|left)/.test(el.className || '');
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* 表格自动滚动到报错位置
|
|
306
|
-
*/
|
|
307
|
-
export const handleScrollToError = () => {
|
|
196
|
+
const isFixStartCell = (el) => /table-cell-fix-(start|left)/.test(el.className || "");
|
|
197
|
+
const handleScrollToError = () => {
|
|
308
198
|
setTimeout(() => {
|
|
309
199
|
const errorDom = document.querySelector('[class*="form-item-has-error"]');
|
|
310
200
|
if (errorDom) {
|
|
@@ -318,9 +208,7 @@ export const handleScrollToError = () => {
|
|
|
318
208
|
let childOffsetTop = 0;
|
|
319
209
|
while (previousSibling) {
|
|
320
210
|
if (previousSibling.nodeType === 1) {
|
|
321
|
-
const {
|
|
322
|
-
width = 0
|
|
323
|
-
} = previousSibling.getBoundingClientRect() || {};
|
|
211
|
+
const { width = 0 } = previousSibling.getBoundingClientRect() || {};
|
|
324
212
|
childOffsetLeft += width;
|
|
325
213
|
if (isFixStartCell(previousSibling)) {
|
|
326
214
|
childFixedLeft += width;
|
|
@@ -329,70 +217,49 @@ export const handleScrollToError = () => {
|
|
|
329
217
|
previousSibling = previousSibling.previousElementSibling;
|
|
330
218
|
}
|
|
331
219
|
if (tableRow) {
|
|
332
|
-
let
|
|
333
|
-
while (
|
|
334
|
-
if (
|
|
335
|
-
const {
|
|
336
|
-
height = 0
|
|
337
|
-
} = previousSibling.getBoundingClientRect() || {};
|
|
220
|
+
let previousSibling2 = tableRow.previousElementSibling;
|
|
221
|
+
while (previousSibling2) {
|
|
222
|
+
if (previousSibling2.nodeType === 1) {
|
|
223
|
+
const { height = 0 } = previousSibling2.getBoundingClientRect() || {};
|
|
338
224
|
childOffsetTop += height;
|
|
339
225
|
}
|
|
340
|
-
|
|
226
|
+
previousSibling2 = previousSibling2.previousElementSibling;
|
|
341
227
|
}
|
|
342
228
|
}
|
|
343
229
|
tableBody.scrollTo({
|
|
344
230
|
top: childOffsetTop,
|
|
345
231
|
left: childOffsetLeft - childFixedLeft,
|
|
346
|
-
behavior:
|
|
232
|
+
behavior: "smooth"
|
|
347
233
|
});
|
|
348
234
|
}
|
|
349
235
|
}
|
|
350
236
|
}, 0);
|
|
351
237
|
};
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
* 列序 = [选择列?(hasSelection 时占位 1), ...用户列];names 列的 cellKey 用 splitNames 结果。
|
|
356
|
-
* @returns 表头 th 下标;未命中返回 -1
|
|
357
|
-
*/
|
|
358
|
-
export const resolveErrorColumnIndex = (columns = [], cellKey, hasSelection) => {
|
|
359
|
-
const idx = (columns || []).findIndex(col => {
|
|
360
|
-
if (Array.isArray(col?.names)) {
|
|
238
|
+
const resolveErrorColumnIndex = (columns = [], cellKey, hasSelection) => {
|
|
239
|
+
const idx = (columns || []).findIndex((col) => {
|
|
240
|
+
if (Array.isArray(col == null ? void 0 : col.names)) {
|
|
361
241
|
return splitNames(col.names) === cellKey;
|
|
362
242
|
}
|
|
363
|
-
return String(col
|
|
243
|
+
return String((col == null ? void 0 : col.name) ?? (col == null ? void 0 : col.dataIndex) ?? (col == null ? void 0 : col.key)) === cellKey;
|
|
364
244
|
});
|
|
365
245
|
if (idx < 0) {
|
|
366
246
|
return -1;
|
|
367
247
|
}
|
|
368
248
|
return hasSelection ? idx + 1 : idx;
|
|
369
249
|
};
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
* 背景:rc-table 虚拟表格对「列」也做了虚拟化(BodyGrid 仅渲染横向视口内的列),
|
|
375
|
-
* 保存校验失败时报错列可能根本未渲染进 body DOM,无法用单元格测量定位(旧实现据此失效)。
|
|
376
|
-
* 而表头(thead)不被列虚拟化——渲染全部列且为真实测量宽度,故改以表头为列宽来源:
|
|
377
|
-
* 累加报错列之前各列宽、减去 fixed-left 列宽(固定列悬浮,不占滚动偏移)得目标 scrollLeft。
|
|
378
|
-
*
|
|
379
|
-
* 注意:ref.nativeElement 仅为 body 滚动容器,表头在其外层 table-container 内,需向上查找。
|
|
380
|
-
*/
|
|
381
|
-
export const scrollVirtualToErrorColumn = (tableRef, columns, cellKey) => {
|
|
382
|
-
const ref = tableRef?.current;
|
|
383
|
-
const root = ref?.nativeElement;
|
|
384
|
-
if (!ref?.scrollTo || !root || !cellKey) {
|
|
250
|
+
const scrollVirtualToErrorColumn = (tableRef, columns, cellKey) => {
|
|
251
|
+
const ref = tableRef == null ? void 0 : tableRef.current;
|
|
252
|
+
const root = ref == null ? void 0 : ref.nativeElement;
|
|
253
|
+
if (!(ref == null ? void 0 : ref.scrollTo) || !root || !cellKey) {
|
|
385
254
|
return;
|
|
386
255
|
}
|
|
387
|
-
// body 容器在外层 table-container 内,表头与其同级,需从 container 取表头
|
|
388
256
|
const container = root.closest('[class*="table-container"]') || root.parentElement;
|
|
389
|
-
const headerCells = container
|
|
390
|
-
if (!headerCells
|
|
257
|
+
const headerCells = container == null ? void 0 : container.querySelectorAll('thead [class*="table-cell"]');
|
|
258
|
+
if (!(headerCells == null ? void 0 : headerCells.length)) {
|
|
391
259
|
return;
|
|
392
260
|
}
|
|
393
|
-
const hasSelection = !!container
|
|
261
|
+
const hasSelection = !!(container == null ? void 0 : container.querySelector('thead [class*="selection-column"]'));
|
|
394
262
|
const targetIndex = resolveErrorColumnIndex(columns, cellKey, hasSelection);
|
|
395
|
-
// -1 未命中 / 0 为首列(含 fixed-left),无需横向滚动
|
|
396
263
|
if (targetIndex <= 0 || targetIndex >= headerCells.length) {
|
|
397
264
|
return;
|
|
398
265
|
}
|
|
@@ -400,63 +267,51 @@ export const scrollVirtualToErrorColumn = (tableRef, columns, cellKey) => {
|
|
|
400
267
|
let fixedLeft = 0;
|
|
401
268
|
for (let i = 0; i < targetIndex; i += 1) {
|
|
402
269
|
const cell = headerCells[i];
|
|
403
|
-
const {
|
|
404
|
-
width = 0
|
|
405
|
-
} = cell.getBoundingClientRect() || {};
|
|
270
|
+
const { width = 0 } = cell.getBoundingClientRect() || {};
|
|
406
271
|
offsetLeft += width;
|
|
407
272
|
if (isFixStartCell(cell)) {
|
|
408
273
|
fixedLeft += width;
|
|
409
274
|
}
|
|
410
275
|
}
|
|
411
|
-
ref.scrollTo({
|
|
412
|
-
left: Math.max(0, offsetLeft - fixedLeft)
|
|
413
|
-
});
|
|
276
|
+
ref.scrollTo({ left: Math.max(0, offsetLeft - fixedLeft) });
|
|
414
277
|
};
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
* @param value 需要深拷贝的对象
|
|
419
|
-
* @returns 深拷贝后的对象,其中的React节点会被保留
|
|
420
|
-
*/
|
|
421
|
-
export function cloneDeepFilterNode(value) {
|
|
422
|
-
return _cloneDeepWith(value, val => {
|
|
423
|
-
if ( /*#__PURE__*/React.isValidElement(val)) {
|
|
278
|
+
function cloneDeepFilterNode(value) {
|
|
279
|
+
return cloneDeepWith(value, (val) => {
|
|
280
|
+
if (React.isValidElement(val)) {
|
|
424
281
|
return val;
|
|
425
282
|
}
|
|
426
283
|
});
|
|
427
284
|
}
|
|
428
285
|
const handleCheckCellValue = async (column, record) => {
|
|
286
|
+
var _a, _b;
|
|
429
287
|
let value = null;
|
|
430
288
|
if (column.name) {
|
|
431
|
-
value =
|
|
289
|
+
value = get(record, column.name);
|
|
432
290
|
}
|
|
433
|
-
if (column.names
|
|
434
|
-
value = column.names.map(key => {
|
|
435
|
-
return
|
|
291
|
+
if ((_a = column.names) == null ? void 0 : _a.length) {
|
|
292
|
+
value = column.names.map((key) => {
|
|
293
|
+
return get(record, key);
|
|
436
294
|
});
|
|
437
295
|
}
|
|
438
296
|
let _required = column.required;
|
|
439
297
|
let _rules = column.rules;
|
|
440
298
|
let _labelRequired = column.labelRequired;
|
|
441
|
-
if (
|
|
299
|
+
if (isFunction(column.required)) {
|
|
442
300
|
_required = column.required(value, record);
|
|
443
301
|
}
|
|
444
|
-
if (
|
|
302
|
+
if (isFunction(column.rules)) {
|
|
445
303
|
_rules = column.rules(value, record);
|
|
446
304
|
}
|
|
447
|
-
if (
|
|
305
|
+
if (isFunction(column.labelRequired)) {
|
|
448
306
|
_labelRequired = column.labelRequired(value, record);
|
|
449
307
|
}
|
|
450
|
-
if (column.names
|
|
308
|
+
if (((_b = column.names) == null ? void 0 : _b.length) && _labelRequired !== null && _labelRequired !== void 0 && isNull(value)) {
|
|
451
309
|
return false;
|
|
452
310
|
}
|
|
453
|
-
|
|
454
|
-
// 校验必填
|
|
455
311
|
if (_required && isNull(value)) {
|
|
456
312
|
return false;
|
|
457
313
|
}
|
|
458
|
-
|
|
459
|
-
if (_rules?.length) {
|
|
314
|
+
if (_rules == null ? void 0 : _rules.length) {
|
|
460
315
|
let res = true;
|
|
461
316
|
for (const rule of _rules) {
|
|
462
317
|
if (!res) {
|
|
@@ -465,9 +320,9 @@ const handleCheckCellValue = async (column, record) => {
|
|
|
465
320
|
if (rule.required && isNull(value)) {
|
|
466
321
|
res = false;
|
|
467
322
|
}
|
|
468
|
-
if (
|
|
323
|
+
if (isFunction(rule.validator)) {
|
|
469
324
|
try {
|
|
470
|
-
await rule.validator(
|
|
325
|
+
await rule.validator("", value);
|
|
471
326
|
} catch (error) {
|
|
472
327
|
res = false;
|
|
473
328
|
}
|
|
@@ -480,11 +335,7 @@ const handleCheckCellValue = async (column, record) => {
|
|
|
480
335
|
}
|
|
481
336
|
return true;
|
|
482
337
|
};
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* 分页校验
|
|
486
|
-
*/
|
|
487
|
-
export const onPageCheck = async ({
|
|
338
|
+
const onPageCheck = async ({
|
|
488
339
|
form,
|
|
489
340
|
name,
|
|
490
341
|
value,
|
|
@@ -495,26 +346,22 @@ export const onPageCheck = async ({
|
|
|
495
346
|
isView,
|
|
496
347
|
disabled
|
|
497
348
|
}) => {
|
|
498
|
-
// 分页校验,在查看模式下不生效,在禁用模式下不生效
|
|
499
349
|
if (pagination && !isView && !disabled) {
|
|
500
|
-
const {
|
|
501
|
-
|
|
502
|
-
pageSize
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
length: Math.ceil(tools.calc(value.length, '/', pageSize))
|
|
506
|
-
}, (_, i) => i + 1);
|
|
350
|
+
const { pageNum, pageSize } = page;
|
|
351
|
+
const pageArr = Array.from(
|
|
352
|
+
{ length: Math.ceil(tools.calc(value.length, "/", pageSize)) },
|
|
353
|
+
(_, i) => i + 1
|
|
354
|
+
);
|
|
507
355
|
let flag = false;
|
|
508
356
|
let errorNum = 0;
|
|
509
357
|
let errorPageNum = 0;
|
|
510
358
|
for (const item of pageArr) {
|
|
511
|
-
if (flag)
|
|
359
|
+
if (flag)
|
|
360
|
+
break;
|
|
512
361
|
errorNum = 0;
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
const
|
|
516
|
-
const end = tools.calc(start, '+', pageSize);
|
|
517
|
-
const nextValues = value?.slice(start, end);
|
|
362
|
+
const start = tools.calc(item - 1, "*", pageSize);
|
|
363
|
+
const end = tools.calc(start, "+", pageSize);
|
|
364
|
+
const nextValues = value == null ? void 0 : value.slice(start, end);
|
|
518
365
|
for (const record of nextValues) {
|
|
519
366
|
for (const column of columns) {
|
|
520
367
|
try {
|
|
@@ -544,12 +391,28 @@ export const onPageCheck = async ({
|
|
|
544
391
|
}
|
|
545
392
|
setState(nextState);
|
|
546
393
|
try {
|
|
547
|
-
await form.validateFields([name], {
|
|
548
|
-
recursive: true
|
|
549
|
-
});
|
|
394
|
+
await form.validateFields([name], { recursive: true });
|
|
550
395
|
} catch (error) {
|
|
551
396
|
handleScrollToError();
|
|
552
397
|
}
|
|
553
398
|
}
|
|
554
399
|
}
|
|
555
|
-
};
|
|
400
|
+
};
|
|
401
|
+
export {
|
|
402
|
+
buildTableRowKey,
|
|
403
|
+
cloneDeepFilterNode,
|
|
404
|
+
customValidate,
|
|
405
|
+
difference,
|
|
406
|
+
getDisabled,
|
|
407
|
+
getNamePath,
|
|
408
|
+
getRandom,
|
|
409
|
+
handleScrollToError,
|
|
410
|
+
isRecordShallowEqual,
|
|
411
|
+
onDelete,
|
|
412
|
+
onPageCheck,
|
|
413
|
+
resolveChangedFields,
|
|
414
|
+
resolveErrorColumnIndex,
|
|
415
|
+
scrollVirtualToErrorColumn,
|
|
416
|
+
splitNames,
|
|
417
|
+
syncGroupCombinedValues
|
|
418
|
+
};
|