@zat-design/sisyphus-react 3.13.8 → 3.13.10-deta.1
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/ProAction/index.js +2 -2
- package/es/ProDownload/index.js +4 -3
- package/es/ProDownload/utils.js +5 -4
- package/es/ProDrawerForm/components/ProDrawer/index.js +2 -2
- package/es/ProDrawerForm/components/ProModal/index.js +2 -2
- package/es/ProEditLabel/components/RenderProForm.js +3 -3
- package/es/ProEditLabel/index.js +2 -2
- package/es/ProEditTable/components/ActionButton/index.js +9 -8
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +6 -6
- package/es/ProEditTable/components/RenderField/index.js +20 -16
- package/es/ProEditTable/index.js +10 -7
- package/es/ProEditTable/utils/config.js +3 -3
- package/es/ProEditTable/utils/diffOriginal.js +6 -4
- package/es/ProEditTable/utils/getDefaultProps.js +8 -7
- package/es/ProEditTable/utils/index.js +21 -18
- package/es/ProEditTable/utils/tools.js +32 -24
- package/es/ProEditTable/utils/useEditTableError.js +2 -2
- package/es/ProEnum/index.js +16 -11
- package/es/ProEnum/utils/eventCenter.js +2 -2
- package/es/ProEnum/utils/getEnumLabel.js +5 -4
- package/es/ProEnum/utils/index.js +3 -2
- package/es/ProForm/components/base/DatePicker/index.js +11 -8
- package/es/ProForm/components/base/Input/index.js +3 -3
- package/es/ProForm/components/base/InputNumber/index.js +6 -4
- package/es/ProForm/components/base/RangePicker/index.js +12 -8
- package/es/ProForm/components/base/Select/index.js +2 -2
- package/es/ProForm/components/base/Switch/index.js +3 -2
- package/es/ProForm/components/base/SwitchCheckbox/index.js +3 -2
- package/es/ProForm/components/base/TextArea/index.js +2 -2
- package/es/ProForm/components/combination/Container/index.js +2 -2
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +7 -6
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +2 -2
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +2 -2
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +5 -4
- package/es/ProForm/components/combination/FormList/index.js +2 -2
- package/es/ProForm/components/combination/FormList/utils.js +2 -2
- package/es/ProForm/components/combination/Group/hooks/index.js +4 -3
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/Group/utils.js +6 -6
- package/es/ProForm/components/combination/ProCascader/index.js +6 -4
- package/es/ProForm/components/combination/ProCascader/utils/index.js +2 -2
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +13 -10
- package/es/ProForm/components/combination/ProNumberRange/index.js +2 -2
- package/es/ProForm/components/combination/ProRangeLimit/index.js +8 -5
- package/es/ProForm/components/combination/ProTimeLimit/index.js +10 -7
- package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.js +3 -3
- package/es/ProForm/components/old/EnumSelect/index.js +3 -3
- package/es/ProForm/components/render/ChangedWrapper.js +3 -3
- package/es/ProForm/components/render/ConfirmWrapper.js +4 -3
- package/es/ProForm/components/render/Render.js +17 -13
- package/es/ProForm/components/render/RenderFields.js +9 -6
- package/es/ProForm/index.js +6 -4
- package/es/ProForm/utils/_useChanged.js +3 -3
- package/es/ProForm/utils/_useListChanged.js +6 -6
- package/es/ProForm/utils/diffOriginal.js +6 -4
- package/es/ProForm/utils/getDefaultProps.js +7 -6
- package/es/ProForm/utils/index.js +20 -15
- package/es/ProForm/utils/rulesCreator.js +4 -3
- package/es/ProForm/utils/transformNames.js +2 -2
- package/es/ProForm/utils/transformValue.js +3 -3
- package/es/ProForm/utils/useDeepCompareMemo.js +2 -2
- package/es/ProForm/utils/useRules.js +4 -3
- package/es/ProForm/utils/useShouldUpdate.js +23 -21
- package/es/ProForm/utils/useWatch.js +2 -2
- package/es/ProForm/utils/valueType.js +2 -2
- package/es/ProIcon/index.js +2 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +2 -2
- package/es/ProLayout/components/ProCollapse/index.js +2 -2
- package/es/ProLayout/components/ProHeader/index.js +12 -9
- package/es/ProLayout/utils/index.js +3 -2
- package/es/ProSelect/index.js +11 -7
- package/es/ProSelect/utils/index.js +5 -3
- package/es/ProStep/components/Item/index.js +2 -2
- package/es/ProStep/components/Listener/index.js +2 -2
- package/es/ProStep/components/Step/index.js +2 -2
- package/es/ProStep/index.js +2 -2
- package/es/ProStep/utils/index.js +4 -3
- package/es/ProStepTab/index.js +3 -3
- package/es/ProTable/components/FormatColumn/index.js +16 -12
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +3 -3
- package/es/ProTable/components/RenderColumn/index.js +2 -2
- package/es/ProTable/components/RenderSummary/index.js +3 -3
- package/es/ProTable/hooks/useAntdTable.js +15 -10
- package/es/ProTable/index.js +12 -7
- package/es/ProTable/utils/index.js +5 -4
- package/es/ProTabs/index.js +2 -2
- package/es/ProThemeTools/index.js +2 -2
- package/es/ProTree/components/ProTree.js +5 -4
- package/es/ProTree/components/ProTreeSelect/index.js +6 -5
- package/es/ProTreeModal/index.js +5 -4
- package/es/ProUpload/components/ImageRender.js +2 -2
- package/es/ProUpload/index.js +5 -4
- package/es/old/ProEditableTable/index.js +7 -7
- package/es/old/ProEditableTable/utils.js +2 -2
- package/lib/ProAction/index.js +8 -5
- package/lib/ProConfigProvider/index.js +3 -2
- package/lib/ProDownload/index.js +7 -6
- package/lib/ProDownload/utils.js +9 -7
- package/lib/ProDrawerForm/components/ProDrawer/index.js +12 -7
- package/lib/ProDrawerForm/components/ProModal/index.js +12 -7
- package/lib/ProEditLabel/components/RenderProForm.js +6 -5
- package/lib/ProEditLabel/index.js +15 -8
- package/lib/ProEditTable/components/ActionButton/index.js +15 -11
- package/lib/ProEditTable/components/RcTable/BaseTable.js +6 -3
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +3 -2
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +14 -11
- package/lib/ProEditTable/components/RenderField/index.js +25 -20
- package/lib/ProEditTable/components/RenderToolbar/index.js +3 -2
- package/lib/ProEditTable/components/Summary/index.js +8 -5
- package/lib/ProEditTable/components/Validator/index.js +7 -3
- package/lib/ProEditTable/index.js +20 -12
- package/lib/ProEditTable/utils/config.js +8 -7
- package/lib/ProEditTable/utils/diffOriginal.js +7 -4
- package/lib/ProEditTable/utils/getDefaultProps.js +8 -7
- package/lib/ProEditTable/utils/index.js +27 -21
- package/lib/ProEditTable/utils/tools.js +32 -24
- package/lib/ProEditTable/utils/useEditTableError.js +2 -2
- package/lib/ProEnum/index.js +31 -19
- package/lib/ProEnum/utils/eventCenter.js +2 -2
- package/lib/ProEnum/utils/getEnumLabel.js +5 -4
- package/lib/ProEnum/utils/index.js +3 -2
- package/lib/ProForm/components/Container.js +3 -2
- package/lib/ProForm/components/FormFooter/index.js +7 -4
- package/lib/ProForm/components/base/Checkbox/index.js +4 -3
- package/lib/ProForm/components/base/DatePicker/index.js +14 -10
- package/lib/ProForm/components/base/Input/index.js +6 -5
- package/lib/ProForm/components/base/InputNumber/index.js +12 -7
- package/lib/ProForm/components/base/Radio/index.js +4 -3
- package/lib/ProForm/components/base/RangePicker/index.js +15 -10
- package/lib/ProForm/components/base/Select/index.js +5 -4
- package/lib/ProForm/components/base/Switch/index.js +6 -4
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +6 -4
- package/lib/ProForm/components/base/TextArea/index.js +5 -4
- package/lib/ProForm/components/base/TimePicker/index.js +3 -2
- package/lib/ProForm/components/combination/Container/index.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +16 -10
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +8 -5
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +3 -2
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +10 -6
- package/lib/ProForm/components/combination/FormList/index.js +5 -4
- package/lib/ProForm/components/combination/FormList/utils.js +2 -2
- package/lib/ProForm/components/combination/Group/hooks/index.js +4 -3
- package/lib/ProForm/components/combination/Group/index.js +6 -5
- package/lib/ProForm/components/combination/Group/utils.js +10 -9
- package/lib/ProForm/components/combination/ProCascader/index.js +14 -7
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +2 -2
- package/lib/ProForm/components/combination/ProCombination/index.js +9 -4
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +3 -3
- package/lib/ProForm/components/combination/ProModalSelect/index.js +35 -19
- package/lib/ProForm/components/combination/ProNumberRange/index.js +17 -10
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -9
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +19 -11
- package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.js +3 -3
- package/lib/ProForm/components/old/EnumSelect/index.js +15 -8
- package/lib/ProForm/components/old/InputRange/index.js +8 -5
- package/lib/ProForm/components/old/InputWithSuffix/index.js +4 -3
- package/lib/ProForm/components/old/ProAddress/index.js +18 -11
- package/lib/ProForm/components/old/ProCertNo/index.js +12 -7
- package/lib/ProForm/components/old/ProCertValidity/index.js +11 -6
- package/lib/ProForm/components/old/ProRangeBox/index.js +21 -12
- package/lib/ProForm/components/render/ChangedWrapper.js +11 -8
- package/lib/ProForm/components/render/ConfirmWrapper.js +8 -6
- package/lib/ProForm/components/render/Render.js +34 -23
- package/lib/ProForm/components/render/RenderFields.js +9 -6
- package/lib/ProForm/index.js +21 -12
- package/lib/ProForm/utils/_useChanged.js +7 -5
- package/lib/ProForm/utils/_useListChanged.js +10 -8
- package/lib/ProForm/utils/diffOriginal.js +7 -4
- package/lib/ProForm/utils/getDefaultProps.js +8 -6
- package/lib/ProForm/utils/index.js +20 -15
- package/lib/ProForm/utils/rulesCreator.js +4 -3
- package/lib/ProForm/utils/transformNames.js +3 -2
- package/lib/ProForm/utils/transformValue.js +3 -3
- package/lib/ProForm/utils/useDeepCompareMemo.js +3 -2
- package/lib/ProForm/utils/useForm.js +3 -2
- package/lib/ProForm/utils/useRules.js +4 -3
- package/lib/ProForm/utils/useShouldUpdate.js +23 -21
- package/lib/ProForm/utils/useWatch.js +2 -2
- package/lib/ProForm/utils/valueType.js +2 -2
- package/lib/ProIcon/index.js +13 -8
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +6 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +5 -4
- package/lib/ProLayout/components/ProCollapse/index.js +13 -8
- package/lib/ProLayout/components/ProFooter/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +3 -2
- package/lib/ProLayout/components/ProHeader/index.js +37 -25
- package/lib/ProLayout/index.js +3 -2
- package/lib/ProLayout/utils/index.js +2 -2
- package/lib/ProSelect/components/AdaptiveTooltip.js +3 -2
- package/lib/ProSelect/index.js +25 -14
- package/lib/ProSelect/utils/index.js +4 -4
- package/lib/ProStep/components/Anchor/index.js +3 -2
- package/lib/ProStep/components/Item/index.js +2 -2
- package/lib/ProStep/components/Listener/index.js +2 -2
- package/lib/ProStep/components/Step/index.js +2 -2
- package/lib/ProStep/index.js +2 -2
- package/lib/ProStep/utils/index.js +4 -3
- package/lib/ProStepTab/index.js +3 -3
- package/lib/ProTable/components/FormatColumn/index.js +26 -21
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +3 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +3 -3
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +3 -2
- package/lib/ProTable/components/RenderColumn/index.js +17 -12
- package/lib/ProTable/components/RenderSummary/index.js +8 -7
- package/lib/ProTable/components/RenderTableHeader/index.js +5 -3
- package/lib/ProTable/components/RenderTabs/index.js +6 -3
- package/lib/ProTable/components/TooltipTitle/index.js +3 -2
- package/lib/ProTable/hooks/useAntdTable.js +21 -13
- package/lib/ProTable/index.js +12 -7
- package/lib/ProTable/utils/index.js +5 -4
- package/lib/ProTabs/components/Card/index.js +11 -5
- package/lib/ProTabs/index.js +5 -4
- package/lib/ProThemeTools/component/ProTools/index.js +19 -12
- package/lib/ProThemeTools/index.js +12 -9
- package/lib/ProThemeTools/utils/index.js +3 -2
- package/lib/ProTooltip/index.js +5 -4
- package/lib/ProTree/components/AdaptiveTooltip.js +4 -2
- package/lib/ProTree/components/List.js +4 -3
- package/lib/ProTree/components/ProTree.js +17 -9
- package/lib/ProTree/components/ProTreeSelect/index.js +22 -14
- package/lib/ProTree/components/Tree.js +6 -3
- package/lib/ProTreeModal/components/Cascader.js +4 -3
- package/lib/ProTreeModal/components/List.js +14 -9
- package/lib/ProTreeModal/components/SortableItem.js +3 -2
- package/lib/ProTreeModal/components/Tree.js +4 -3
- package/lib/ProTreeModal/components/Trigger.js +11 -6
- package/lib/ProTreeModal/index.js +21 -13
- package/lib/ProUpload/components/ButtonRender.js +6 -3
- package/lib/ProUpload/components/DragRender.js +3 -2
- package/lib/ProUpload/components/FileItem.js +15 -10
- package/lib/ProUpload/components/ImageRender.js +19 -10
- package/lib/ProUpload/index.js +9 -7
- package/lib/ProViewer/index.js +9 -4
- package/lib/old/ProCertValidity/index.js +11 -6
- package/lib/old/ProEditableTable/index.js +36 -23
- package/lib/old/ProEditableTable/utils.js +35 -18
- package/package.json +4 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import _union from "lodash/union";
|
2
2
|
import { transformValue } from './transformValue';
|
3
3
|
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
4
4
|
var _ref = formItem || {},
|
@@ -9,7 +9,7 @@ var transformNames = function transformNames(formItem, form, names, fieldName, t
|
|
9
9
|
return {};
|
10
10
|
}
|
11
11
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
12
|
-
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ?
|
12
|
+
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? _union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
|
13
13
|
var _transformValue = transformValue(names, form, _fieldName, normalize, getValueProps),
|
14
14
|
_normalize = _transformValue.normalize,
|
15
15
|
_getValueProps = _transformValue.getValueProps,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import
|
2
|
+
import _set from "lodash/set";
|
3
3
|
import { diffField } from '../utils';
|
4
4
|
import { isEmpty } from '../../utils';
|
5
5
|
export var transformValue = function transformValue(names, form, fieldName, _normalize, _getValueProps) {
|
@@ -15,7 +15,7 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
15
15
|
}
|
16
16
|
names.forEach(function (name, index) {
|
17
17
|
var _value2;
|
18
|
-
|
18
|
+
_set(form.getFieldsValue(true), name, (_value2 = _value) === null || _value2 === void 0 ? void 0 : _value2[index]);
|
19
19
|
});
|
20
20
|
return _value;
|
21
21
|
},
|
@@ -45,7 +45,7 @@ export var transformValue = function transformValue(names, form, fieldName, _nor
|
|
45
45
|
}
|
46
46
|
// 如果来源是比对且有names场景, 则不更新表单值
|
47
47
|
if (!isOrigin) {
|
48
|
-
|
48
|
+
_set(form.getFieldsValue(true), fieldName, curValue);
|
49
49
|
}
|
50
50
|
// 如果表单里的值和组合得到的值不全等 更新表单里的值、
|
51
51
|
return _objectSpread(_objectSpread({}, res), {}, {
|
@@ -1,11 +1,11 @@
|
|
1
|
+
import _isEqualWith from "lodash/isEqualWith";
|
1
2
|
import { useRef } from 'react';
|
2
|
-
import { isEqualWith } from 'lodash';
|
3
3
|
import { customEqualForFun } from '.';
|
4
4
|
/** 深度比较依赖变化memo */
|
5
5
|
export var useDeepCompareMemo = function useDeepCompareMemo(fun, changedCb, depList) {
|
6
6
|
var lastDependency = useRef(); // 上一次的依赖
|
7
7
|
var lastRes = useRef(); // 上一次的结果
|
8
|
-
if (!
|
8
|
+
if (!_isEqualWith(depList, lastDependency.current, customEqualForFun)) {
|
9
9
|
var res = fun();
|
10
10
|
changedCb === null || changedCb === void 0 ? void 0 : changedCb(lastRes.current, res);
|
11
11
|
lastRes.current = res;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
+
import _isString from "lodash/isString";
|
3
|
+
import _isBoolean from "lodash/isBoolean";
|
2
4
|
import { useEffect, useMemo } from 'react';
|
3
|
-
import { isBoolean, isString } from 'lodash';
|
4
5
|
import { rulesCreator } from './rulesCreator';
|
5
6
|
import { isNotFullArray, isNullArray } from './index';
|
6
7
|
import locale from '../../locale';
|
@@ -12,7 +13,7 @@ var useRules = function useRules(props) {
|
|
12
13
|
names = props.names,
|
13
14
|
labelRequired = props.labelRequired,
|
14
15
|
type = props.type;
|
15
|
-
var _label =
|
16
|
+
var _label = _isString(label) ? label : '';
|
16
17
|
var requiredRule = Array.isArray(rules) && (rules === null || rules === void 0 ? void 0 : rules.find(function (rule) {
|
17
18
|
return rule.required === true;
|
18
19
|
}));
|
@@ -63,7 +64,7 @@ var useRules = function useRules(props) {
|
|
63
64
|
});
|
64
65
|
useEffect(function () {
|
65
66
|
// 添加完整性校验
|
66
|
-
if (names && !
|
67
|
+
if (names && !_isBoolean(labelRequired)) {
|
67
68
|
var customRequired = {
|
68
69
|
validator: function validator(rules, value) {
|
69
70
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
import _get from "lodash/get";
|
3
|
+
import _isEqualWith from "lodash/isEqualWith";
|
4
|
+
import _isFunction from "lodash/isFunction";
|
2
5
|
import { useRef, useState } from 'react';
|
3
|
-
import { isFunction, isEqualWith, get } from 'lodash';
|
4
6
|
import { customEqualForFun } from './index';
|
5
7
|
/** FormList中被删除的行也会再触发一次响应式函数 排除这种场景 */
|
6
8
|
var isDeleteLine = function isDeleteLine(form, namePath) {
|
@@ -46,7 +48,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
46
48
|
reRender = _useState2[1];
|
47
49
|
var values = {};
|
48
50
|
// 不是动态函数直接返回
|
49
|
-
if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !
|
51
|
+
if (!(dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) && !_isFunction(show) && !_isFunction(disabled) && !_isFunction(required) && !_isFunction(rules) && !_isFunction(fieldProps) && !_isFunction(originComponent) && !_isFunction(desensitization)) {
|
50
52
|
return {
|
51
53
|
shouldUpdate: _shouldUpdate,
|
52
54
|
show: show,
|
@@ -64,7 +66,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
64
66
|
} else {
|
65
67
|
values = form.getFieldsValue(true);
|
66
68
|
}
|
67
|
-
if (
|
69
|
+
if (_isFunction(show)) {
|
68
70
|
showRef.current = Boolean(show(values, {
|
69
71
|
form: form,
|
70
72
|
index: index,
|
@@ -73,7 +75,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
73
75
|
} else {
|
74
76
|
showRef.current = show;
|
75
77
|
}
|
76
|
-
if (
|
78
|
+
if (_isFunction(desensitization)) {
|
77
79
|
desensitizationRef.current = desensitization(values, {
|
78
80
|
form: form,
|
79
81
|
index: index,
|
@@ -82,7 +84,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
82
84
|
} else {
|
83
85
|
desensitizationRef.current = desensitization;
|
84
86
|
}
|
85
|
-
if (
|
87
|
+
if (_isFunction(disabled)) {
|
86
88
|
// RangePicker返回数组时,特殊处理
|
87
89
|
if (['Group', 'RangePicker', 'ProCascader'].includes(type) && Array.isArray(disabled(values, {
|
88
90
|
form: form,
|
@@ -104,7 +106,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
104
106
|
} else {
|
105
107
|
disabledRef.current = disabled;
|
106
108
|
}
|
107
|
-
if (
|
109
|
+
if (_isFunction(required)) {
|
108
110
|
requiredRef.current = required(values, {
|
109
111
|
form: form,
|
110
112
|
index: index,
|
@@ -113,7 +115,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
113
115
|
} else {
|
114
116
|
requiredRef.current = required;
|
115
117
|
}
|
116
|
-
if (
|
118
|
+
if (_isFunction(rules)) {
|
117
119
|
rulesRef.current = rules(values, {
|
118
120
|
form: form,
|
119
121
|
index: index,
|
@@ -122,7 +124,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
122
124
|
} else {
|
123
125
|
rulesRef.current = rules;
|
124
126
|
}
|
125
|
-
if (
|
127
|
+
if (_isFunction(originComponent)) {
|
126
128
|
originComponentRef.current = originComponent(values, {
|
127
129
|
form: form,
|
128
130
|
index: index,
|
@@ -131,7 +133,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
131
133
|
} else {
|
132
134
|
originComponentRef.current = newComponent;
|
133
135
|
}
|
134
|
-
if (
|
136
|
+
if (_isFunction(fieldProps)) {
|
135
137
|
fieldPropsRef.current = fieldProps(values, {
|
136
138
|
form: form,
|
137
139
|
index: index,
|
@@ -142,7 +144,7 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
142
144
|
}
|
143
145
|
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
144
146
|
dependNamesRef.current = dependNames.map(function (name) {
|
145
|
-
return
|
147
|
+
return _get(values, name);
|
146
148
|
});
|
147
149
|
}
|
148
150
|
return {
|
@@ -150,9 +152,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
150
152
|
// @ts-ignore formList场景取当前行数据,不取shouldUpdate变更后值
|
151
153
|
if (dependNames === null || dependNames === void 0 ? void 0 : dependNames.length) {
|
152
154
|
var curDependNamesValue = dependNames.map(function (name) {
|
153
|
-
return
|
155
|
+
return _get(currentValues, name);
|
154
156
|
});
|
155
|
-
var dependNamesChanged = !
|
157
|
+
var dependNamesChanged = !_isEqualWith(dependNamesRef.current, curDependNamesValue, customEqualForFun);
|
156
158
|
dependNamesRef.current = curDependNamesValue;
|
157
159
|
if (!dependNamesChanged) return false;
|
158
160
|
}
|
@@ -163,32 +165,32 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
163
165
|
} else {
|
164
166
|
_currentValues = form.getFieldsValue(true);
|
165
167
|
}
|
166
|
-
var _show =
|
168
|
+
var _show = _isFunction(show) ? Boolean(show(_currentValues, {
|
167
169
|
form: form,
|
168
170
|
index: index,
|
169
171
|
namePath: namePath
|
170
172
|
})) : show;
|
171
|
-
var _disabled =
|
173
|
+
var _disabled = _isFunction(disabled) ? Boolean(disabled(_currentValues, {
|
172
174
|
form: form,
|
173
175
|
index: index,
|
174
176
|
namePath: namePath
|
175
177
|
})) : disabled;
|
176
|
-
var _required =
|
178
|
+
var _required = _isFunction(required) ? required(_currentValues, {
|
177
179
|
form: form,
|
178
180
|
index: index,
|
179
181
|
namePath: namePath
|
180
182
|
}) : required;
|
181
|
-
var _rules =
|
183
|
+
var _rules = _isFunction(rules) ? rules(_currentValues, {
|
182
184
|
form: form,
|
183
185
|
index: index,
|
184
186
|
namePath: namePath
|
185
187
|
}) : rules;
|
186
|
-
var _fieldProps =
|
188
|
+
var _fieldProps = _isFunction(fieldProps) ? fieldProps(_currentValues, {
|
187
189
|
form: form,
|
188
190
|
index: index,
|
189
191
|
namePath: namePath
|
190
192
|
}) : fieldProps;
|
191
|
-
var _desensitization =
|
193
|
+
var _desensitization = _isFunction(desensitization) ? desensitization(_currentValues, {
|
192
194
|
form: form,
|
193
195
|
index: index,
|
194
196
|
namePath: namePath
|
@@ -216,9 +218,9 @@ var useShouldUpdate = function useShouldUpdate(props) {
|
|
216
218
|
clearTimeout(timerRef.current);
|
217
219
|
}
|
218
220
|
}
|
219
|
-
var equalRes =
|
220
|
-
var proEqualRes =
|
221
|
-
var desensitizationRes =
|
221
|
+
var equalRes = _isEqualWith(rulesRef.current, _rules, customEqualForFun);
|
222
|
+
var proEqualRes = _isEqualWith(fieldPropsRef.current, _fieldProps, customEqualForFun);
|
223
|
+
var desensitizationRes = _isEqualWith(desensitizationRef.current, _desensitization);
|
222
224
|
if (_show !== showRef.current || _disabled !== disabledRef.current || _required !== requiredRef.current || !equalRes || !proEqualRes || !desensitizationRes || (_fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
|
223
225
|
) {
|
224
226
|
showRef.current = _show;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import
|
3
|
+
import _debounce from "lodash/debounce";
|
4
4
|
import warning from 'rc-util/lib/warning';
|
5
5
|
import { useState, useEffect, useRef, useMemo } from 'react';
|
6
6
|
import isEqual from 'lodash/isEqual';
|
@@ -100,7 +100,7 @@ function useWatch(dependencies, form, wait) {
|
|
100
100
|
// 保存防抖函数引用,避免重复创建
|
101
101
|
var debouncedFn = useMemo(function () {
|
102
102
|
if (wait) {
|
103
|
-
return
|
103
|
+
return _debounce(function (value) {
|
104
104
|
// 只在值真正变化时才更新状态
|
105
105
|
if (!isEqual(prevStateRef.current, value)) {
|
106
106
|
prevStateRef.current = _objectSpread({}, value);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
import _isEqual from "lodash/isEqual";
|
3
4
|
import Big from 'big.js';
|
4
|
-
import { isEqual } from 'lodash';
|
5
5
|
import { transforms } from '@zat-design/utils';
|
6
6
|
var transformDate = transforms.transformDate,
|
7
7
|
transformSwitch = transforms.transformSwitch;
|
@@ -33,7 +33,7 @@ var transformRatio = function transformRatio(_ref) {
|
|
33
33
|
value: []
|
34
34
|
};
|
35
35
|
}
|
36
|
-
if (
|
36
|
+
if (_isEqual(ref, value)) {
|
37
37
|
return {
|
38
38
|
value: [(value[0] || value[0] === 0) && Number.isFinite(value[0] - 0) ? Big(value[0] - 0).times(Math.pow(10, precision)).toNumber() : null, (value[1] || value[1] === 0) && Number.isFinite(value[1] - 0) ? Big(value[1] - 0).times(Math.pow(10, precision)).toNumber() : null]
|
39
39
|
};
|
package/es/ProIcon/index.js
CHANGED
@@ -7,11 +7,11 @@ import _Tooltip from "antd/es/tooltip";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
9
9
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
10
|
+
import _uniqBy from "lodash/uniqBy";
|
10
11
|
var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip", "buttonIcon"];
|
11
12
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
12
13
|
import { useLocalStorageState, useSetState, useDeepCompareLayoutEffect } from 'ahooks';
|
13
14
|
import classNames from 'classnames';
|
14
|
-
import { uniqBy } from 'lodash';
|
15
15
|
import { ReactSVG } from 'react-svg';
|
16
16
|
import { useEffect } from 'react';
|
17
17
|
import { useProConfig } from '../ProConfigProvider';
|
@@ -97,7 +97,7 @@ var ProIcon = function ProIcon(props) {
|
|
97
97
|
var targetTextFill = "text-".concat(language); // text-cn text-en
|
98
98
|
var isIconMode = _mode === 'icon';
|
99
99
|
var isExtendButtonMode = !isIconMode || isIconMode && disabled;
|
100
|
-
var mergedMapList =
|
100
|
+
var mergedMapList = _uniqBy(mapList.concat(iconMap), targetTextFill);
|
101
101
|
var _type = type;
|
102
102
|
var _text = children;
|
103
103
|
// svg图标对应文本
|
@@ -2,13 +2,13 @@ import "antd/es/menu/style";
|
|
2
2
|
import _Menu from "antd/es/menu";
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
import _cloneDeep from "lodash/cloneDeep";
|
5
6
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
6
7
|
import { useMemo, useRef, useContext } from 'react';
|
7
8
|
import { useDeepCompareEffect, useSetState } from 'ahooks';
|
8
9
|
import { CaretDownOutlined } from '@ant-design/icons';
|
9
10
|
import classnames from 'classnames';
|
10
11
|
import { Link } from 'react-router-dom';
|
11
|
-
import { cloneDeep } from 'lodash';
|
12
12
|
import { LayoutContext } from '../../../../index';
|
13
13
|
import { getIdsByPathName } from '../../../../utils';
|
14
14
|
import { Icon } from '../../index';
|
@@ -47,7 +47,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
47
47
|
return String(item);
|
48
48
|
})) || [];
|
49
49
|
var itemsTransform = useMemo(function () {
|
50
|
-
var result =
|
50
|
+
var result = _cloneDeep(menus);
|
51
51
|
if (!Array.isArray(result) || !result.length) {
|
52
52
|
return [];
|
53
53
|
}
|
@@ -6,11 +6,11 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
7
7
|
import "antd/es/collapse/style";
|
8
8
|
import _Collapse from "antd/es/collapse";
|
9
|
+
import _isBoolean from "lodash/isBoolean";
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
10
11
|
import { useLayoutEffect } from 'react';
|
11
12
|
import { CaretRightOutlined } from '@ant-design/icons';
|
12
13
|
import classNames from 'classnames';
|
13
|
-
import { isBoolean } from 'lodash';
|
14
14
|
import foldSvg from '../../../assets/fold.svg';
|
15
15
|
import ProIcon from '../../../ProIcon/index';
|
16
16
|
var Panel = _Collapse.Panel;
|
@@ -88,7 +88,7 @@ var ProCollapse = function ProCollapse(props) {
|
|
88
88
|
align: "center",
|
89
89
|
children: [_jsx("div", {
|
90
90
|
className: "pro-collapse-icon",
|
91
|
-
children:
|
91
|
+
children: _isBoolean(icon) ? _jsx(ProIcon, {
|
92
92
|
src: foldSvg,
|
93
93
|
actionMap: {
|
94
94
|
fill: []
|
@@ -11,6 +11,10 @@ import _Tooltip from "antd/es/tooltip";
|
|
11
11
|
import "antd/es/space/style";
|
12
12
|
import _Space from "antd/es/space";
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
14
|
+
import _isString from "lodash/isString";
|
15
|
+
import _isNumber from "lodash/isNumber";
|
16
|
+
import _isEmpty from "lodash/isEmpty";
|
17
|
+
import _isFunction from "lodash/isFunction";
|
14
18
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
15
19
|
/* eslint-disable react/no-array-index-key */
|
16
20
|
|
@@ -19,7 +23,6 @@ import { tools } from '@zat-design/utils';
|
|
19
23
|
import classnames from 'classnames';
|
20
24
|
import moment from 'moment';
|
21
25
|
import { useToggle, useSize } from 'ahooks';
|
22
|
-
import { isFunction, isEmpty, isNumber, isString } from 'lodash';
|
23
26
|
import { ReactSVG } from 'react-svg';
|
24
27
|
import foldSvg from '../../../assets/arrow.svg';
|
25
28
|
import { Copy, ProBackBtn } from './components';
|
@@ -145,7 +148,7 @@ var ProHeader = function ProHeader(props) {
|
|
145
148
|
rel: "noopener noreferrer",
|
146
149
|
target: "_blank",
|
147
150
|
children: parmas === null || parmas === void 0 ? void 0 : parmas.value
|
148
|
-
}) : parmas === null || parmas === void 0 ? void 0 : parmas.value, (parmas === null || parmas === void 0 ? void 0 : parmas.copyable) &&
|
151
|
+
}) : parmas === null || parmas === void 0 ? void 0 : parmas.value, (parmas === null || parmas === void 0 ? void 0 : parmas.copyable) && _isString(parmas === null || parmas === void 0 ? void 0 : parmas.value) ? _jsx(Copy, {
|
149
152
|
text: parmas.value
|
150
153
|
}) : null, tagRender({
|
151
154
|
tag: parmas === null || parmas === void 0 ? void 0 : parmas.tag
|
@@ -191,7 +194,7 @@ var ProHeader = function ProHeader(props) {
|
|
191
194
|
};
|
192
195
|
var tagCls = classnames({
|
193
196
|
'pro-header-only-tag': onlyTag,
|
194
|
-
'pro-header-describe-items-calc':
|
197
|
+
'pro-header-describe-items-calc': _isString(width) ? width.includes('calc') : false
|
195
198
|
});
|
196
199
|
return _jsx("li", {
|
197
200
|
className: tagCls,
|
@@ -242,7 +245,7 @@ var ProHeader = function ProHeader(props) {
|
|
242
245
|
case 'thousandth':
|
243
246
|
case 'money':
|
244
247
|
// 千分位
|
245
|
-
result = value ||
|
248
|
+
result = value || _isNumber(value) ? formatAmount(value, precision) : '-';
|
246
249
|
break;
|
247
250
|
case 'enumName':
|
248
251
|
// 枚举-展示name
|
@@ -284,7 +287,7 @@ var ProHeader = function ProHeader(props) {
|
|
284
287
|
}),
|
285
288
|
children: actionRender.map(function (item, index) {
|
286
289
|
var _item$props;
|
287
|
-
if (
|
290
|
+
if (_isFunction(item === null || item === void 0 ? void 0 : item.type)) {
|
288
291
|
return _jsx("div", {
|
289
292
|
children: item
|
290
293
|
}, index);
|
@@ -439,10 +442,10 @@ var ProHeader = function ProHeader(props) {
|
|
439
442
|
'pro-header-fixed': fixedTop,
|
440
443
|
'pro-header-shadow': showShadow,
|
441
444
|
'pro-header-no-back': !backState,
|
442
|
-
'pro-header-has-describe': !
|
443
|
-
'pro-header-no-describe':
|
445
|
+
'pro-header-has-describe': !_isEmpty(_subDescribeColumns) || !_isEmpty(describeColumns) || !_isEmpty(describeColumns),
|
446
|
+
'pro-header-no-describe': _isEmpty(_subDescribeColumns) && _isEmpty(describeColumns) || _isEmpty(describeColumns)
|
444
447
|
}, "".concat(className), className));
|
445
|
-
if (title && !
|
448
|
+
if (title && !_isEmpty(_breadcrumbColumns)) {
|
446
449
|
console.error('warning: The title and the breadcrumbList cannot be used together');
|
447
450
|
}
|
448
451
|
// title默认不显示返回按钮,只有showBack设置为true时才显示
|
@@ -500,7 +503,7 @@ var ProHeader = function ProHeader(props) {
|
|
500
503
|
className: "pro-header-right",
|
501
504
|
children: actionsRender()
|
502
505
|
})]
|
503
|
-
}), describeRender(describeColumns), !
|
506
|
+
}), describeRender(describeColumns), !_isEmpty(_subDescribeColumns) ? _jsxs("div", {
|
504
507
|
className: classnames({
|
505
508
|
'pro-header-nav': true,
|
506
509
|
'pro-header-nav-open': fold,
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
3
|
+
import _isPlainObject from "lodash/isPlainObject";
|
3
4
|
/* eslint-disable prefer-destructuring */
|
4
5
|
/* eslint-disable no-mixed-operators */
|
5
|
-
|
6
|
+
|
6
7
|
/**
|
7
8
|
* 通过URL获取对应keyIdPath
|
8
9
|
* @param menus 菜单数据
|
@@ -88,7 +89,7 @@ export var transformMenu = function transformMenu(menuData, pathPrefix) {
|
|
88
89
|
* @returns []
|
89
90
|
*/
|
90
91
|
export var transformMenus = function transformMenus(data, pathPrefix) {
|
91
|
-
if (
|
92
|
+
if (_isPlainObject(data)) {
|
92
93
|
// @ts-ignore
|
93
94
|
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.menus)) {
|
94
95
|
return [];
|
package/es/ProSelect/index.js
CHANGED
@@ -9,11 +9,15 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
10
10
|
import "antd/es/select/style";
|
11
11
|
import _Select from "antd/es/select";
|
12
|
+
import _isNumber from "lodash/isNumber";
|
13
|
+
import _omit from "lodash/omit";
|
14
|
+
import _isString from "lodash/isString";
|
15
|
+
import _isObject from "lodash/isObject";
|
16
|
+
import _isFunction from "lodash/isFunction";
|
12
17
|
var _excluded = ["dataSource", "defaultDisableValue", "useRequest", "fieldNames", "tooltip", "otherProps", "labelInValue", "filterInList", "scrollFollowParent", "defaultOne", "onSearch", "optionRender", "onChange", "updateDataSource", "transformResponse", "getValueProps", "isView"];
|
13
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
19
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
15
20
|
import React, { useImperativeHandle, useState, forwardRef, isValidElement, useCallback } from 'react';
|
16
|
-
import { isFunction, isObject, isString, omit, isNumber } from 'lodash';
|
17
21
|
import { useProConfig } from '../ProConfigProvider';
|
18
22
|
import Container from '../ProForm/components/Container';
|
19
23
|
import AdaptiveTooltip from './components/AdaptiveTooltip';
|
@@ -223,7 +227,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
223
227
|
})
|
224
228
|
});
|
225
229
|
};
|
226
|
-
return
|
230
|
+
return _isFunction(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join(',');
|
227
231
|
};
|
228
232
|
if (isView || props.isView) {
|
229
233
|
if (Array.isArray(value)) {
|
@@ -235,7 +239,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
235
239
|
}
|
236
240
|
return _jsx(Container, {
|
237
241
|
viewEmpty: viewEmpty,
|
238
|
-
children: value ||
|
242
|
+
children: value || _isNumber(value) ? transToLabel([value]) : null
|
239
243
|
});
|
240
244
|
}
|
241
245
|
var TooltipOption = function TooltipOption(props) {
|
@@ -281,7 +285,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
281
285
|
*/
|
282
286
|
var transformValue = function transformValue() {
|
283
287
|
if (labelInValue && !selectProps.mode) {
|
284
|
-
if (!
|
288
|
+
if (!_isObject(value)) {
|
285
289
|
return undefined;
|
286
290
|
}
|
287
291
|
return (value === null || value === void 0 ? void 0 : value[code]) || (value === null || value === void 0 ? void 0 : value.value);
|
@@ -337,9 +341,9 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
337
341
|
// optionLabelProp={otherProps?.isDiffChange ? 'label' : 'children'} // 解决warning报错,添加默认值
|
338
342
|
// optionLabelProp="label" // 解决warning报错,添加默认值
|
339
343
|
showSearch: true,
|
340
|
-
filterOption:
|
344
|
+
filterOption: _isFunction(_onSearch) ? false : function (input, option) {
|
341
345
|
var _option$children, _option$children$prop;
|
342
|
-
var value =
|
346
|
+
var value = _isString(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
|
343
347
|
return value.toLowerCase().includes(input.toLowerCase());
|
344
348
|
},
|
345
349
|
onSearch: function onSearch(value) {
|
@@ -348,7 +352,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
348
352
|
getPopupContainer: function getPopupContainer(trigger) {
|
349
353
|
return scrollFollowParent ? trigger.parentElement : document.body;
|
350
354
|
}
|
351
|
-
},
|
355
|
+
}, _omit(_objectSpread({}, selectProps), ['isView', 'showCodeName', 'form', 'name', 'style', 'onFieldChange'])), {}, {
|
352
356
|
value: transformValue(),
|
353
357
|
children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
|
354
358
|
return _jsx(Option, {
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
3
|
+
import _difference from "lodash/difference";
|
4
|
+
import _isNumber from "lodash/isNumber";
|
3
5
|
/* eslint-disable no-restricted-syntax */
|
4
|
-
|
6
|
+
|
5
7
|
/**
|
6
8
|
* 查找选择器名称的值
|
7
9
|
* @param list 表单列表
|
@@ -45,7 +47,7 @@ var findSelectNameValues = function findSelectNameValues(_ref) {
|
|
45
47
|
selectValues.push(result);
|
46
48
|
}
|
47
49
|
});
|
48
|
-
var diffList =
|
50
|
+
var diffList = _difference(selectValues, mode === 'multiple' ? value : [value]);
|
49
51
|
return dataSource.filter(function (item) {
|
50
52
|
return !diffList.includes(labelInValue ? item : item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] || (item === null || item === void 0 ? void 0 : item.value));
|
51
53
|
});
|
@@ -67,7 +69,7 @@ export var getSelectList = function getSelectList(_ref2) {
|
|
67
69
|
listName = otherProps.listName,
|
68
70
|
form = otherProps.form;
|
69
71
|
// 修复formlist无法过滤的问题
|
70
|
-
var _name = Array.isArray(name) &&
|
72
|
+
var _name = Array.isArray(name) && _isNumber(name[0]) ? listName : name;
|
71
73
|
var firstNumberIndex = listName.lastIndexOf(listName.findLast(function (item) {
|
72
74
|
return typeof item === 'number';
|
73
75
|
}));
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
import _isBoolean from "lodash/isBoolean";
|
3
4
|
var _excluded = ["id", "title", "collapse", "children", "lazyLoad", "order"];
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
5
6
|
import { useEffect } from 'react';
|
6
7
|
import LazyLoad, { forceCheck } from 'react-lazyload';
|
7
|
-
import { isBoolean } from 'lodash';
|
8
8
|
import { useStep } from '../../index';
|
9
9
|
import ProCollapse from '../../../ProLayout/components/ProCollapse';
|
10
10
|
// 默认的懒加载配置
|
@@ -44,7 +44,7 @@ var ProStepItem = function ProStepItem(_ref) {
|
|
44
44
|
}, [id, title, order, lazyLoad, restProps, register]);
|
45
45
|
var renderChildren = function renderChildren() {
|
46
46
|
if (lazyLoad) {
|
47
|
-
var lazyLoadProps =
|
47
|
+
var lazyLoadProps = _isBoolean(lazyLoad) ? defaultLazyLoadConfig : lazyLoad;
|
48
48
|
return _jsx(LazyLoad, _objectSpread(_objectSpread({}, lazyLoadProps), {}, {
|
49
49
|
classNamePrefix: id,
|
50
50
|
children: children
|
@@ -2,8 +2,8 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
+
import _throttle from "lodash/throttle";
|
5
6
|
var _excluded = ["children", "delayTime", "excludes"];
|
6
|
-
import { throttle } from 'lodash';
|
7
7
|
import React from 'react';
|
8
8
|
import { forceVisible } from 'react-lazyload';
|
9
9
|
import { useStep } from '../../index';
|
@@ -27,7 +27,7 @@ var Listener = function Listener(_ref) {
|
|
27
27
|
notify = _useStep.notify,
|
28
28
|
registerMap = _useStep.registerMap;
|
29
29
|
return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
30
|
-
onClick:
|
30
|
+
onClick: _throttle(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
31
31
|
var loadedMap, loaded, values;
|
32
32
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
33
33
|
while (1) switch (_context.prev = _context.next) {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
+
import _cloneDeep from "lodash/cloneDeep";
|
3
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
4
5
|
import React, { useMemo, useState } from 'react';
|
5
|
-
import { cloneDeep } from 'lodash';
|
6
6
|
import ProIcon from '../../../ProIcon/index';
|
7
7
|
import catalogSvg from '../../../assets/catalog.svg';
|
8
8
|
import Anchor from '../Anchor';
|
@@ -22,7 +22,7 @@ export var Step = function Step(_ref) {
|
|
22
22
|
onOff = _useState2[0],
|
23
23
|
setOnOff = _useState2[1];
|
24
24
|
var options = useMemo(function () {
|
25
|
-
var nextDataSource =
|
25
|
+
var nextDataSource = _cloneDeep(dataSource);
|
26
26
|
var activeIndex;
|
27
27
|
if (activeKey) {
|
28
28
|
activeIndex = nextDataSource.findIndex(function (item) {
|
package/es/ProStep/index.js
CHANGED
@@ -3,11 +3,11 @@ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
6
|
+
import _debounce from "lodash/debounce";
|
6
7
|
var _excluded = ["children"],
|
7
8
|
_excluded2 = ["id", "form", "title", "validator", "order", "disabled", "lazyLoad"];
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
9
10
|
import { createContext, useCallback, useContext, useMemo, useRef, useState } from 'react';
|
10
|
-
import { debounce } from 'lodash';
|
11
11
|
import { useSetState, useLocalStorageState } from 'ahooks';
|
12
12
|
import { handleScroll, handleScrollError } from './utils';
|
13
13
|
import Step from './components/Step';
|
@@ -64,7 +64,7 @@ var ProStep = function ProStep(_ref) {
|
|
64
64
|
return pre.order - next.order;
|
65
65
|
});
|
66
66
|
}, [resetProps === null || resetProps === void 0 ? void 0 : resetProps.dataSource, registerMap.current, ids]);
|
67
|
-
var debounceReRender = useCallback(
|
67
|
+
var debounceReRender = useCallback(_debounce(function () {
|
68
68
|
return reRender({});
|
69
69
|
}, 500), []);
|
70
70
|
// 用来注册form匹配到对应的模块id
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import
|
2
|
+
import _pick from "lodash/pick";
|
3
|
+
import _debounce from "lodash/debounce";
|
3
4
|
/**
|
4
5
|
* 滚动到错误位置, 延迟200ms解决ProForm错误还未生成
|
5
6
|
*/
|
@@ -34,7 +35,7 @@ export var handleScroll = function handleScroll(id, options) {
|
|
34
35
|
handleScrollError(errorDom);
|
35
36
|
} else {
|
36
37
|
// 如果没有错误表单项,则滚动到指定元素位置
|
37
|
-
setTimeout(
|
38
|
+
setTimeout(_debounce(function () {
|
38
39
|
window.scrollTo({
|
39
40
|
top: dom.offsetTop - targetOffset,
|
40
41
|
behavior: 'smooth'
|
@@ -53,7 +54,7 @@ export var getLoadedMap = function getLoadedMap(registerMap) {
|
|
53
54
|
return [];
|
54
55
|
}
|
55
56
|
var stepList = Object.values(registerMap === null || registerMap === void 0 ? void 0 : registerMap.current).map(function (item) {
|
56
|
-
return _objectSpread(_objectSpread({},
|
57
|
+
return _objectSpread(_objectSpread({}, _pick(item, ['id', 'order', 'title'])), {}, {
|
57
58
|
loaded: !document.querySelector(".".concat(item === null || item === void 0 ? void 0 : item.id, "-placeholder"))
|
58
59
|
});
|
59
60
|
});
|