@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
@@ -8,11 +8,14 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
9
9
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
10
10
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
11
|
+
import _isFunction from "lodash/isFunction";
|
12
|
+
import _uniq from "lodash/uniq";
|
13
|
+
import _isObject from "lodash/isObject";
|
14
|
+
import _omit from "lodash/omit";
|
11
15
|
var _excluded = ["format", "disabled", "foreverDate", "foreverText", "valueType", "otherProps", "limit"],
|
12
16
|
_excluded2 = ["mode"];
|
13
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
14
18
|
import classNames from 'classnames';
|
15
|
-
import { omit, isObject, uniq, isFunction } from 'lodash';
|
16
19
|
import moment from 'moment';
|
17
20
|
import { useMemo } from 'react';
|
18
21
|
import { useProConfig } from '../../../../ProConfigProvider';
|
@@ -44,10 +47,10 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
44
47
|
var _foreverDate = foreverDate || (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.foreverDate);
|
45
48
|
var _viewFormat = Array.isArray(format) ? format[0] : format;
|
46
49
|
var tempFormat = Array.isArray(format) ? format : [format];
|
47
|
-
if (
|
50
|
+
if (_isFunction(format)) {
|
48
51
|
tempFormat = [];
|
49
52
|
}
|
50
|
-
var _format =
|
53
|
+
var _format = _uniq([].concat(_toConsumableArray(tempFormat), ['YYYY-MM-DD', 'YYYYMMDD', 'YYYY/MM/DD', 'YYYY_MM_DD', 'YYYY.MM.DD'])).filter(function (formatKey) {
|
51
54
|
return !!formatKey;
|
52
55
|
});
|
53
56
|
// dateTime模式下默认开启time选择
|
@@ -80,7 +83,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
80
83
|
value = _useControlled2[0],
|
81
84
|
onChange = _useControlled2[1];
|
82
85
|
var isForever = useMemo(function () {
|
83
|
-
if (
|
86
|
+
if (_isObject(value)) {
|
84
87
|
return foreverMoment.format(format) === value.format(format);
|
85
88
|
}
|
86
89
|
return false;
|
@@ -100,7 +103,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
100
103
|
children: foreverText
|
101
104
|
});
|
102
105
|
}
|
103
|
-
if (
|
106
|
+
if (_isObject(value)) {
|
104
107
|
return _jsx(Container, {
|
105
108
|
viewEmpty: viewEmpty,
|
106
109
|
children: value.format(_viewFormat)
|
@@ -114,7 +117,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
114
117
|
if (_rest.showTime === true) {
|
115
118
|
_rest.showTime = _objectSpread({}, _defaultShowTime);
|
116
119
|
}
|
117
|
-
if (
|
120
|
+
if (_isObject(_rest.showTime)) {
|
118
121
|
_rest.showTime = Object.assign(_defaultShowTime, _rest.showTime);
|
119
122
|
}
|
120
123
|
var className = classNames({
|
@@ -127,7 +130,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
127
130
|
className: "pro-time-limit",
|
128
131
|
children: [_jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({
|
129
132
|
disabled: disabled || isForever
|
130
|
-
}, initialConfig),
|
133
|
+
}, initialConfig), _omit(_rest, ['placeholder'])), {}, {
|
131
134
|
format: _format,
|
132
135
|
value: value,
|
133
136
|
onChange: onChange
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
+
import _isEqual from "lodash/isEqual";
|
4
5
|
import { usePrevious, useRequest } from 'ahooks';
|
5
|
-
import { isEqual } from 'lodash';
|
6
6
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
7
7
|
var defaultTransform = function defaultTransform(data) {
|
8
8
|
return data === null || data === void 0 ? void 0 : data.list;
|
@@ -57,7 +57,7 @@ export default function useRequestList(service, options, useRequestOptions) {
|
|
57
57
|
var prevParams = usePrevious(params);
|
58
58
|
var prevSearchValues = usePrevious(searchValues);
|
59
59
|
useEffect(function () {
|
60
|
-
if (prevParams && !
|
60
|
+
if (prevParams && !_isEqual(prevParams, params)) {
|
61
61
|
// @ts-ignore
|
62
62
|
run(params);
|
63
63
|
}
|
@@ -70,7 +70,7 @@ export default function useRequestList(service, options, useRequestOptions) {
|
|
70
70
|
});
|
71
71
|
}, [onPageChange]);
|
72
72
|
var onSearch = useCallback(function (values) {
|
73
|
-
if (!
|
73
|
+
if (!_isEqual(prevSearchValues, values)) {
|
74
74
|
setSearchValues(function (p) {
|
75
75
|
return _objectSpread(_objectSpread(_objectSpread({}, p), values), {}, {
|
76
76
|
timestamp: Date.now()
|
@@ -9,13 +9,13 @@ import "antd/es/form/style";
|
|
9
9
|
import _Form from "antd/es/form";
|
10
10
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
12
|
+
import _cloneDeep from "lodash/cloneDeep";
|
12
13
|
var _excluded = ["value", "onChange", "disabled", "readOnly", "suffix", "handleFormat", "configOption", "proformmode"],
|
13
14
|
_excluded2 = ["title", "onOk"],
|
14
15
|
_excluded3 = ["rowKey", "columns"];
|
15
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
16
17
|
import { CloseOutlined } from '@ant-design/icons';
|
17
18
|
import { useSetState } from 'ahooks';
|
18
|
-
import { cloneDeep } from 'lodash';
|
19
19
|
import { forwardRef, useEffect } from 'react';
|
20
20
|
import { ReactSVG } from 'react-svg';
|
21
21
|
import ProForm from '../../../../ProForm';
|
@@ -137,8 +137,8 @@ var EnumSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
137
137
|
// 点击行进行勾选
|
138
138
|
var handleClickRow = function handleClickRow(record) {
|
139
139
|
var selectedValue = record[rowKey];
|
140
|
-
var tempSelectedRows =
|
141
|
-
var tempSelectedRowKeys =
|
140
|
+
var tempSelectedRows = _cloneDeep(state.selectedRows);
|
141
|
+
var tempSelectedRowKeys = _cloneDeep(state.selectedRowKeys);
|
142
142
|
if (isMultiple) {
|
143
143
|
var rowIndex = tempSelectedRows.findIndex(function (item) {
|
144
144
|
return item[rowKey] === selectedValue;
|
@@ -6,10 +6,10 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
7
7
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
9
|
+
import _get from "lodash/get";
|
9
10
|
var _excluded = ["name", "names", "namesStr", "form", "onDiff", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps", "viewRender"];
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
11
12
|
import classNames from 'classnames';
|
12
|
-
import { get } from 'lodash';
|
13
13
|
import React, { useMemo } from 'react';
|
14
14
|
import { diffOriginal } from '../../utils/diffOriginal';
|
15
15
|
import { useProConfig } from '../../../ProConfigProvider';
|
@@ -41,8 +41,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
41
41
|
var toolTip = (_diffConfig$toolTip = diffConfig.toolTip) !== null && _diffConfig$toolTip !== void 0 ? _diffConfig$toolTip : true;
|
42
42
|
var isWatch = toolTip && !['FormList', 'ProEditTable'].includes(type);
|
43
43
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
44
|
-
return
|
45
|
-
}) :
|
44
|
+
return _get(originalValues, name);
|
45
|
+
}) : _get(originalValues, name);
|
46
46
|
var noChange = !onDiff && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
|
47
47
|
var diffType = useMemo(function () {
|
48
48
|
if (!isWatch || noChange) return 'same';
|
@@ -4,9 +4,10 @@ import "antd/es/modal/style";
|
|
4
4
|
import _Modal from "antd/es/modal";
|
5
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
7
|
+
import _isObject from "lodash/isObject";
|
8
|
+
import _isFunction from "lodash/isFunction";
|
7
9
|
var _excluded = ["onChange", "children", "confirm", "otherProps"];
|
8
10
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
9
|
-
import { isFunction, isObject } from 'lodash';
|
10
11
|
import React from 'react';
|
11
12
|
import ProForm from '../../index';
|
12
13
|
var defaultConfirmProps = {
|
@@ -36,7 +37,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
36
37
|
other[_key - 1] = _args2[_key];
|
37
38
|
}
|
38
39
|
_value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
|
39
|
-
if (!
|
40
|
+
if (!_isFunction(confirm)) {
|
40
41
|
_context2.next = 8;
|
41
42
|
break;
|
42
43
|
}
|
@@ -68,7 +69,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
68
69
|
}
|
69
70
|
}));
|
70
71
|
}
|
71
|
-
if (
|
72
|
+
if (_isObject(confirmProps)) {
|
72
73
|
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
|
73
74
|
onOk: function () {
|
74
75
|
var _onOk = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
@@ -12,6 +12,11 @@ import _Form from "antd/es/form";
|
|
12
12
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
13
13
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
14
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
15
|
+
import _debounce from "lodash/debounce";
|
16
|
+
import _set from "lodash/set";
|
17
|
+
import _omit from "lodash/omit";
|
18
|
+
import _isString from "lodash/isString";
|
19
|
+
import _isFunction from "lodash/isFunction";
|
15
20
|
var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className", "rules", "required", "labelRequired", "tooltip", "validateFirst"];
|
16
21
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
17
22
|
/* eslint-disable prefer-destructuring */
|
@@ -19,7 +24,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
19
24
|
import React, { useMemo } from 'react';
|
20
25
|
import classNames from 'classnames';
|
21
26
|
import { ReactSVG } from 'react-svg';
|
22
|
-
import { isFunction, isString, omit, set, debounce } from 'lodash';
|
23
27
|
import useShouldUpdate from '../../utils/useShouldUpdate';
|
24
28
|
import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../utils/index';
|
25
29
|
import { useProConfig } from '../../../ProConfigProvider';
|
@@ -131,7 +135,7 @@ var Render = function Render(props) {
|
|
131
135
|
return {};
|
132
136
|
}
|
133
137
|
var params = _objectSpread(_objectSpread({}, otherProps), otherFormItemProps);
|
134
|
-
return
|
138
|
+
return _isFunction(valueTypeMap[valueType]) ? valueTypeMap[valueType](params) : {};
|
135
139
|
};
|
136
140
|
/**
|
137
141
|
* transform对象
|
@@ -171,7 +175,7 @@ var Render = function Render(props) {
|
|
171
175
|
};
|
172
176
|
}
|
173
177
|
/** 移除多余参数,防止透传给formItem报错 */
|
174
|
-
var _otherFormItemProps =
|
178
|
+
var _otherFormItemProps = _omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow', 'dependNames']);
|
175
179
|
/**
|
176
180
|
* 最新fieldProps: 更新后的组件Props
|
177
181
|
*/
|
@@ -259,7 +263,7 @@ var Render = function Render(props) {
|
|
259
263
|
// FormList 和 Group场景 对比值改变的话, 回显到表单上
|
260
264
|
if (inList && changeKey === 'onFieldChange') {
|
261
265
|
var values = form.getFieldsValue();
|
262
|
-
var newValues =
|
266
|
+
var newValues = _set(values, _otherFormItemProps.namePath, _args[1]);
|
263
267
|
form.setFieldsValue(newValues);
|
264
268
|
}
|
265
269
|
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
@@ -277,7 +281,7 @@ var Render = function Render(props) {
|
|
277
281
|
}
|
278
282
|
(_lastComponentProps$c2 = lastComponentProps[changeKey]) === null || _lastComponentProps$c2 === void 0 ? void 0 : _lastComponentProps$c2.call.apply(_lastComponentProps$c2, [lastComponentProps].concat(_toConsumableArray(_args)));
|
279
283
|
};
|
280
|
-
var debouncedHandleChange =
|
284
|
+
var debouncedHandleChange = _debounce(defaultHandleChange, lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.debounceWait);
|
281
285
|
var handleChange = function handleChange() {
|
282
286
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
283
287
|
args[_key2] = arguments[_key2];
|
@@ -335,7 +339,7 @@ var Render = function Render(props) {
|
|
335
339
|
// 移除多余字段,group保留onFieldChange
|
336
340
|
var lastComponentPropsFilter = ['onFieldChange', 'disabledStrictly'];
|
337
341
|
// 表单渲染 start
|
338
|
-
var childProps = _objectSpread(_objectSpread(_objectSpread({}, AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props),
|
342
|
+
var childProps = _objectSpread(_objectSpread(_objectSpread({}, AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props), _omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
339
343
|
// @ts-ignore
|
340
344
|
otherProps: otherProps,
|
341
345
|
onChange: handleChange,
|
@@ -384,7 +388,7 @@ var Render = function Render(props) {
|
|
384
388
|
if (originComponent) {
|
385
389
|
delete childProps.otherProps;
|
386
390
|
}
|
387
|
-
var child = /*#__PURE__*/React.isValidElement(AutoComponent) ? (/*#__PURE__*/React.cloneElement(AutoComponent, childProps)) : _jsx(AutoComponent, _objectSpread(_objectSpread({},
|
391
|
+
var child = /*#__PURE__*/React.isValidElement(AutoComponent) ? (/*#__PURE__*/React.cloneElement(AutoComponent, childProps)) : _jsx(AutoComponent, _objectSpread(_objectSpread({}, _omit(lastComponentProps, [].concat(lastComponentPropsFilter, ['debounceWait']))), {}, {
|
388
392
|
otherProps: _objectSpread(_objectSpread({}, otherProps), {}, {
|
389
393
|
show: show,
|
390
394
|
disabled: lastDisabled,
|
@@ -403,8 +407,8 @@ var Render = function Render(props) {
|
|
403
407
|
// 表单提示
|
404
408
|
if (tooltip) {
|
405
409
|
_otherFormItemProps.tooltip = {
|
406
|
-
title:
|
407
|
-
icon:
|
410
|
+
title: _isString(tooltip) ? tooltip : tooltip.title,
|
411
|
+
icon: _isString(tooltip) ? _jsx(ReactSVG, {
|
408
412
|
className: "pro-icon-tip",
|
409
413
|
src: tipSvg
|
410
414
|
}) : tooltip.icon
|
@@ -418,15 +422,15 @@ var Render = function Render(props) {
|
|
418
422
|
colProps = _objectSpread(_objectSpread({}, colProps), {}, {
|
419
423
|
span: lessMode ? colProps.span : 24 // 默认占一行
|
420
424
|
});
|
421
|
-
return _jsx(_Form.Item, _objectSpread(_objectSpread({},
|
425
|
+
return _jsx(_Form.Item, _objectSpread(_objectSpread({}, _omit(_otherFormItemProps, filterFormItemKey)), {}, {
|
422
426
|
// @ts-ignore
|
423
427
|
_internalItemRender: internalItemRender,
|
424
428
|
className: _className,
|
425
429
|
children: _jsx(_Form.List, _objectSpread(_objectSpread({
|
426
430
|
name: _otherFormItemProps.name
|
427
|
-
},
|
431
|
+
}, _omit(_otherFormItemProps, ['rules'])), {}, {
|
428
432
|
children: function children(fields, operation, meta) {
|
429
|
-
return _jsx(AutoComponent, _objectSpread(_objectSpread({},
|
433
|
+
return _jsx(AutoComponent, _objectSpread(_objectSpread({}, _omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
430
434
|
otherProps: otherProps,
|
431
435
|
fields: fields,
|
432
436
|
operation: operation,
|
@@ -460,7 +464,7 @@ var Render = function Render(props) {
|
|
460
464
|
children: child
|
461
465
|
});
|
462
466
|
}
|
463
|
-
return _jsx(_Form.Item, _objectSpread(_objectSpread({},
|
467
|
+
return _jsx(_Form.Item, _objectSpread(_objectSpread({}, _omit(_otherFormItemProps, filterFormItemKey)), {}, {
|
464
468
|
// @ts-ignore
|
465
469
|
_internalItemRender: internalItemRender,
|
466
470
|
className: _className,
|
@@ -1,9 +1,12 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
import _isString from "lodash/isString";
|
4
|
+
import _union from "lodash/union";
|
5
|
+
import _isFunction from "lodash/isFunction";
|
6
|
+
import _isBoolean from "lodash/isBoolean";
|
3
7
|
var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "onDiff", "clearNotShow", "required", "confirm", "desensitization", "span"];
|
4
8
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
5
9
|
import React from 'react';
|
6
|
-
import { isBoolean, isFunction, union, isString } from 'lodash';
|
7
10
|
import Render from './Render';
|
8
11
|
import { getDefaultProps } from '../../utils/getDefaultProps';
|
9
12
|
import * as componentMap from '../index';
|
@@ -104,7 +107,7 @@ var RenderFields = function RenderFields(props) {
|
|
104
107
|
// FormList场景
|
105
108
|
if (Array.isArray(column === null || column === void 0 ? void 0 : column.namePath) && (column === null || column === void 0 ? void 0 : (_column$namePath = column.namePath) === null || _column$namePath === void 0 ? void 0 : _column$namePath.length)) {
|
106
109
|
// @ts-ignore
|
107
|
-
value = form.getFieldValue(
|
110
|
+
value = form.getFieldValue(_union(column.namePath, (column === null || column === void 0 ? void 0 : column.name) || []));
|
108
111
|
record = form.getFieldValue(column.namePath);
|
109
112
|
index = column === null || column === void 0 ? void 0 : column.index;
|
110
113
|
}
|
@@ -142,13 +145,13 @@ var RenderFields = function RenderFields(props) {
|
|
142
145
|
type: _type
|
143
146
|
});
|
144
147
|
var placeholderHandle = function placeholderHandle() {
|
145
|
-
var _label =
|
146
|
-
var _formLabel =
|
148
|
+
var _label = _isString(label) ? label : '';
|
149
|
+
var _formLabel = _isString(formLabel) ? formLabel : '';
|
147
150
|
return placeholder || "".concat(_isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(_label || _formLabel || '');
|
148
151
|
};
|
149
152
|
// 表单组件Props 兼容2.0版本
|
150
153
|
var _fieldProps = _objectSpread(_objectSpread({}, formItemChildProps), fieldProps);
|
151
|
-
if (
|
154
|
+
if (_isBoolean(formDisabled)) {
|
152
155
|
_fieldProps.disabled = formDisabled;
|
153
156
|
}
|
154
157
|
var componentProps = _objectSpread(_objectSpread({
|
@@ -215,7 +218,7 @@ var RenderFields = function RenderFields(props) {
|
|
215
218
|
colProps: _colProps,
|
216
219
|
componentProps: componentProps,
|
217
220
|
otherProps: otherProps,
|
218
|
-
fieldProps:
|
221
|
+
fieldProps: _isFunction(fieldProps) ? fieldProps : null,
|
219
222
|
isSelect: _isSelect,
|
220
223
|
diffConfig: diffConfig,
|
221
224
|
onDiff: onDiff,
|
package/es/ProForm/index.js
CHANGED
@@ -11,12 +11,14 @@ import "antd/es/space/style";
|
|
11
11
|
import _Space from "antd/es/space";
|
12
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
14
|
+
import _omit from "lodash/omit";
|
15
|
+
import _merge from "lodash/merge";
|
16
|
+
import _isObject from "lodash/isObject";
|
14
17
|
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "desensitizationKey", "stopOnFirstError"];
|
15
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
16
19
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
17
20
|
import classnames from 'classnames';
|
18
21
|
import React, { forwardRef, useImperativeHandle, useMemo, useEffect } from 'react';
|
19
|
-
import { isObject, merge, omit } from 'lodash';
|
20
22
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
21
23
|
import RenderFields from './components/render/RenderFields';
|
22
24
|
import { useProConfig } from '../ProConfigProvider';
|
@@ -178,7 +180,7 @@ var ProForm = function ProForm(props, ref) {
|
|
178
180
|
}
|
179
181
|
return {};
|
180
182
|
});
|
181
|
-
onValuesChange(filterInternalFields(
|
183
|
+
onValuesChange(filterInternalFields(_merge.apply(void 0, [changedValue].concat(_toConsumableArray(values))), optimize), form.getFieldsValue());
|
182
184
|
}
|
183
185
|
};
|
184
186
|
// 包装一层兼容 names 改变
|
@@ -200,7 +202,7 @@ var ProForm = function ProForm(props, ref) {
|
|
200
202
|
} else if (/*#__PURE__*/React.isValidElement(footer)) {
|
201
203
|
// 传入组件渲染组件
|
202
204
|
footerEle = footer;
|
203
|
-
} else if (footer === undefined || footer ||
|
205
|
+
} else if (footer === undefined || footer || _isObject(footer)) {
|
204
206
|
// 不传或者传入对象 渲染默认
|
205
207
|
footerEle = defaultFooter(footer);
|
206
208
|
}
|
@@ -234,7 +236,7 @@ var ProForm = function ProForm(props, ref) {
|
|
234
236
|
},
|
235
237
|
className: cls,
|
236
238
|
form: form
|
237
|
-
}, formProps),
|
239
|
+
}, formProps), _omit(config, ['isDiffAll'])), otherProps), {}, {
|
238
240
|
labelAlign: (_ref3 = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref3 !== void 0 ? _ref3 : 'left',
|
239
241
|
onValuesChange: handleValuesChange,
|
240
242
|
onFinish: handleFinish,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "antd/es/form/style";
|
2
2
|
import _Form from "antd/es/form";
|
3
|
-
import
|
3
|
+
import _get from "lodash/get";
|
4
4
|
import { diffOriginal } from './diffOriginal';
|
5
5
|
export var useChanged = function useChanged(_ref) {
|
6
6
|
var name = _ref.name,
|
@@ -10,8 +10,8 @@ export var useChanged = function useChanged(_ref) {
|
|
10
10
|
form = _ref.form,
|
11
11
|
onDiff = _ref.onDiff;
|
12
12
|
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
13
|
-
return
|
14
|
-
}) :
|
13
|
+
return _get(originalValues, name);
|
14
|
+
}) : _get(originalValues, name);
|
15
15
|
var notWatch = !onDiff && (!originalValues || originalValue === undefined);
|
16
16
|
if (notWatch) return [false];
|
17
17
|
var value = _Form.useWatch(namesStr || name, form);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "antd/es/form/style";
|
2
2
|
import _Form from "antd/es/form";
|
3
|
-
import
|
3
|
+
import _get from "lodash/get";
|
4
4
|
import { diffOriginal } from './diffOriginal';
|
5
5
|
var toNamePath = function toNamePath(name) {
|
6
6
|
if (Array.isArray(name)) {
|
@@ -30,14 +30,14 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
30
30
|
if (!rowValue) return undefined;
|
31
31
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
32
32
|
if (!keyValue) return undefined;
|
33
|
-
var originalValueList =
|
33
|
+
var originalValueList = _get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
34
34
|
var originalValueRow = originalValueList.find(function (item) {
|
35
35
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
36
36
|
});
|
37
37
|
var originalValue;
|
38
38
|
if (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) {
|
39
39
|
var originalNamesValue = originalNames.map(function (originalName) {
|
40
|
-
return
|
40
|
+
return _get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
41
41
|
});
|
42
42
|
// 有可能出现数组中全是undefined的情况 视为没有值
|
43
43
|
var fillUndefined = originalNamesValue.every(function (valItem) {
|
@@ -45,14 +45,14 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
45
45
|
});
|
46
46
|
originalValue = fillUndefined ? undefined : originalNamesValue;
|
47
47
|
} else {
|
48
|
-
originalValue =
|
48
|
+
originalValue = _get(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
49
49
|
}
|
50
50
|
return originalValue;
|
51
51
|
}
|
52
52
|
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
53
53
|
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
54
|
-
return
|
55
|
-
}) :
|
54
|
+
return _get(originalValues, originalName);
|
55
|
+
}) : _get(originalValues, originalName);
|
56
56
|
};
|
57
57
|
export var useListChanged = function useListChanged(params) {
|
58
58
|
var name = params.name,
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import
|
1
|
+
import _isObject from "lodash/isObject";
|
2
|
+
import _isFunction from "lodash/isFunction";
|
3
|
+
import _isEqual from "lodash/isEqual";
|
2
4
|
import { isEmpty } from '../../utils';
|
3
5
|
// 过滤对象中undefined字段
|
4
6
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
5
7
|
var filterObject = function filterObject(data) {
|
6
|
-
if (!
|
8
|
+
if (!_isObject(data) || data === null) return data;
|
7
9
|
// ['1', undefined] ['1', ''] 视为相等
|
8
10
|
if (Array.isArray(data)) {
|
9
11
|
// 数组中全是empty值的话 视为null
|
@@ -32,7 +34,7 @@ export var diffOriginal = function diffOriginal(params) {
|
|
32
34
|
value = params.value,
|
33
35
|
onDiff = params.onDiff;
|
34
36
|
// 支持传入自定义比较事件
|
35
|
-
if (
|
37
|
+
if (_isFunction(onDiff)) {
|
36
38
|
var diffRes = onDiff(originalValue, value);
|
37
39
|
// 如果返回undefined走内置比较逻辑
|
38
40
|
if (diffRes !== undefined) {
|
@@ -50,5 +52,5 @@ export var diffOriginal = function diffOriginal(params) {
|
|
50
52
|
if (isEmptyOrg && isEmptyVal) return 'same';
|
51
53
|
// 如果原始值为空 且当前有值的话 视为新增
|
52
54
|
if (isEmptyOrg && !isEmptyVal) return 'add';
|
53
|
-
return
|
55
|
+
return _isEqual(_value, _originalValue) ? 'same' : 'changed';
|
54
56
|
};
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import _isEqual from "lodash/isEqual";
|
2
|
+
import _get from "lodash/get";
|
2
3
|
var defaultPropsMap = {
|
3
4
|
ProSelect: function ProSelect(props) {
|
4
5
|
var fieldProps = props.fieldProps,
|
@@ -12,13 +13,13 @@ var defaultPropsMap = {
|
|
12
13
|
var _listName = namePath.slice(0, -1);
|
13
14
|
var _namePath = name.slice(1);
|
14
15
|
defaultProps.shouldUpdate = function (preValues, curValues) {
|
15
|
-
var preListValue =
|
16
|
-
return
|
16
|
+
var preListValue = _get(preValues, _listName).map(function (item) {
|
17
|
+
return _get(item, _namePath);
|
17
18
|
});
|
18
|
-
var curListValue =
|
19
|
-
return
|
19
|
+
var curListValue = _get(curValues, _listName).map(function (item) {
|
20
|
+
return _get(item, _namePath);
|
20
21
|
});
|
21
|
-
return !
|
22
|
+
return !_isEqual(preListValue, curListValue);
|
22
23
|
};
|
23
24
|
}
|
24
25
|
return defaultProps;
|
@@ -2,9 +2,14 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIt
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
import _isNaN from "lodash/isNaN";
|
6
|
+
import _omit from "lodash/omit";
|
7
|
+
import _set from "lodash/set";
|
8
|
+
import _get from "lodash/get";
|
9
|
+
import _isFunction from "lodash/isFunction";
|
10
|
+
import _isObject from "lodash/isObject";
|
5
11
|
import React, { useState } from 'react';
|
6
12
|
import moment from 'moment';
|
7
|
-
import _, { isObject, isFunction, get, set, omit, isNaN } from 'lodash';
|
8
13
|
export var getLayout = function getLayout(params) {
|
9
14
|
var _params$span = params.span,
|
10
15
|
span = _params$span === void 0 ? 8 : _params$span,
|
@@ -110,7 +115,7 @@ export var weedOutProps = function weedOutProps(data, keys) {
|
|
110
115
|
// 对比字段变化
|
111
116
|
export var diffField = function diffField(prevValues, curValues, names) {
|
112
117
|
return names.some(function (name) {
|
113
|
-
return
|
118
|
+
return _get(prevValues, name) !== _get(curValues, name);
|
114
119
|
});
|
115
120
|
};
|
116
121
|
// 表单name展开
|
@@ -137,7 +142,7 @@ var _filterInternalFields = function filterInternalFields(values, optimize) {
|
|
137
142
|
return _filterInternalFields(item);
|
138
143
|
});
|
139
144
|
}
|
140
|
-
if (
|
145
|
+
if (_isObject(nextValues)) {
|
141
146
|
var result = {};
|
142
147
|
Object.keys(nextValues).forEach(function (key) {
|
143
148
|
if (key.includes('-')) return;
|
@@ -161,7 +166,7 @@ var _getAllNamePath = function getAllNamePath(object) {
|
|
161
166
|
}));
|
162
167
|
}
|
163
168
|
// 深度获取对象key
|
164
|
-
if (
|
169
|
+
if (_isObject(value)) {
|
165
170
|
resultKeys.concat(_getAllNamePath(value, [].concat(_toConsumableArray(currentPath), [key])));
|
166
171
|
}
|
167
172
|
resultKeys.push([].concat(_toConsumableArray(currentPath), [key]));
|
@@ -268,9 +273,9 @@ export function initialValuesToNames() {
|
|
268
273
|
}).join('-');
|
269
274
|
var formInitialValue = item.names.map(function (name, index) {
|
270
275
|
if (item.initialValue) {
|
271
|
-
|
276
|
+
_set(values, name, item.initialValue[index]);
|
272
277
|
}
|
273
|
-
return
|
278
|
+
return _get(values, name);
|
274
279
|
});
|
275
280
|
// 过滤掉不存在的初始值 防止names字段值为空数组
|
276
281
|
var namesInitialValue = formInitialValue.filter(function (item) {
|
@@ -281,7 +286,7 @@ export function initialValuesToNames() {
|
|
281
286
|
}
|
282
287
|
}
|
283
288
|
// 给FormList默认增加一行
|
284
|
-
if (item.type === 'FormList' && !item.initialValue && !
|
289
|
+
if (item.type === 'FormList' && !item.initialValue && !_get(values, item.name)) {
|
285
290
|
item.initialValue = [{}];
|
286
291
|
}
|
287
292
|
});
|
@@ -299,7 +304,7 @@ export function getArrayBeforeNumber(arr) {
|
|
299
304
|
}
|
300
305
|
// 自定义深比对 如果两边都是函数类型则认为相等
|
301
306
|
export var customEqualForFun = function customEqualForFun(value, other) {
|
302
|
-
if (
|
307
|
+
if (_isFunction(value) && _isFunction(other) || /*#__PURE__*/React.isValidElement(value) && /*#__PURE__*/React.isValidElement(other)) {
|
303
308
|
return true;
|
304
309
|
}
|
305
310
|
};
|
@@ -370,18 +375,18 @@ export var deleteForPath = function deleteForPath(values, namePath) {
|
|
370
375
|
* @returns {}
|
371
376
|
*/
|
372
377
|
var _findOptionByValue = function findOptionByValue(treeData, value, fieldNames) {
|
373
|
-
if (
|
378
|
+
if (_isObject(value)) {
|
374
379
|
return value;
|
375
380
|
}
|
376
381
|
for (var i = 0; i < (treeData === null || treeData === void 0 ? void 0 : treeData.length); i++) {
|
377
382
|
var node = treeData[i];
|
378
383
|
if (node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value'] === value) {
|
379
|
-
return
|
384
|
+
return _omit(node, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
380
385
|
}
|
381
386
|
if (node.children) {
|
382
387
|
var foundNode = _findOptionByValue(node[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], value, fieldNames);
|
383
388
|
if (foundNode) {
|
384
|
-
return
|
389
|
+
return _omit(foundNode, ['children', fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]);
|
385
390
|
}
|
386
391
|
}
|
387
392
|
}
|
@@ -393,8 +398,8 @@ export { _findOptionByValue as findOptionByValue };
|
|
393
398
|
export var equalDependencies = function equalDependencies(dependencies, prevValues, currentValues) {
|
394
399
|
if (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) {
|
395
400
|
return dependencies.some(function (namePath) {
|
396
|
-
var prevValue =
|
397
|
-
var currentValue =
|
401
|
+
var prevValue = _get(prevValues, namePath);
|
402
|
+
var currentValue = _get(currentValues, namePath);
|
398
403
|
return prevValue !== currentValue;
|
399
404
|
});
|
400
405
|
}
|
@@ -404,12 +409,12 @@ export var equalDependencies = function equalDependencies(dependencies, prevValu
|
|
404
409
|
export var parseNamePath = function parseNamePath(input) {
|
405
410
|
var parts = input.split('_');
|
406
411
|
if (parts.every(function (item) {
|
407
|
-
return
|
412
|
+
return _isNaN(Number(item));
|
408
413
|
})) {
|
409
414
|
return [input];
|
410
415
|
}
|
411
416
|
var result = parts.map(function (item) {
|
412
|
-
return
|
417
|
+
return _isNaN(Number(item)) ? item : Number(item);
|
413
418
|
});
|
414
419
|
return [result];
|
415
420
|
};
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _isNumber from "lodash/isNumber";
|
3
|
+
import _isString from "lodash/isString";
|
2
4
|
import { validate, regExp } from '@zat-design/utils';
|
3
|
-
import { isString, isNumber } from 'lodash';
|
4
5
|
import { isNullValue } from './index';
|
5
6
|
import locale, { formatMessage } from '../../locale';
|
6
7
|
var getNonEmptyValuesByIndex = function getNonEmptyValuesByIndex(required, valueArray) {
|
7
8
|
var result = [];
|
8
9
|
required.forEach(function (item, index) {
|
9
|
-
if (item && !(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index]) && !
|
10
|
+
if (item && !(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index]) && !_isNumber(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index])) {
|
10
11
|
result.push(index + 1);
|
11
12
|
}
|
12
13
|
});
|
@@ -20,7 +21,7 @@ export var rulesCreator = function rulesCreator(_ref) {
|
|
20
21
|
isSelect = _ref.isSelect,
|
21
22
|
names = _ref.names,
|
22
23
|
required = _ref.required;
|
23
|
-
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(
|
24
|
+
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(_isString(label) ? label : '');
|
24
25
|
var result = [];
|
25
26
|
if (Array.isArray(rules)) {
|
26
27
|
result = rules.map(function (ruleItem) {
|