@zat-design/sisyphus-react 3.4.7 → 3.4.8-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +19 -1
- package/dist/less.esm.css +10 -1
- package/es/ProEditTable/components/RenderField/index.js +4 -8
- package/es/ProEditTable/style/index.less +1 -1
- package/es/ProForm/components/base/TextArea/index.d.ts +1 -0
- package/es/ProForm/components/base/TextArea/index.js +4 -2
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +1 -1
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- package/es/ProForm/components/combination/FormList/propsType.d.ts +1 -1
- package/es/ProForm/components/combination/FormList/utils.js +2 -3
- package/es/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.js +2 -2
- package/es/ProForm/components/combination/Group/index.d.ts +8 -2
- package/es/ProForm/components/combination/Group/index.js +57 -77
- package/es/ProForm/components/combination/Group/propsType.d.ts +27 -14
- package/es/ProForm/components/combination/Group/utils.d.ts +60 -7
- package/es/ProForm/components/combination/Group/utils.js +209 -19
- package/es/ProForm/components/combination/ProModalSelect/index.js +35 -29
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +6 -1
- package/es/ProForm/components/combination/_Group/index.d.ts +4 -0
- package/es/ProForm/components/combination/_Group/index.js +109 -0
- package/es/ProForm/components/combination/_Group/propsType.d.ts +35 -0
- package/es/ProForm/components/combination/_Group/utils.d.ts +10 -0
- package/es/ProForm/components/combination/_Group/utils.js +46 -0
- package/es/ProForm/components/render/ConfirmWrapper.js +68 -33
- package/es/ProForm/components/render/Render.js +10 -8
- package/es/ProForm/components/render/propsType.d.ts +2 -2
- package/es/ProForm/index.d.ts +3 -1
- package/es/ProForm/index.js +13 -12
- package/es/ProForm/style/index.less +7 -0
- package/es/ProForm/utils/diffOriginal.js +2 -1
- package/es/ProForm/utils/index.d.ts +3 -1
- package/es/ProForm/utils/index.js +22 -1
- package/es/ProForm/utils/rulesCreator.js +1 -1
- package/es/ProForm/utils/transformNames.js +3 -10
- package/es/ProForm/utils/useDeepCompareMemo.d.ts +2 -0
- package/es/ProForm/utils/useDeepCompareMemo.js +14 -0
- package/es/ProForm/utils/useForm.js +34 -17
- package/es/ProForm/utils/useListChanged.js +2 -2
- package/es/ProForm/utils/useRules.js +2 -20
- package/es/ProLayout/components/ProCollapse/index.js +5 -1
- package/es/ProStep/components/Listener/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.js +3 -2
- package/es/ProStep/index.d.ts +1 -1
- package/es/global.less +27 -8
- package/es/locale/zh_CN.js +1 -1
- package/es/style/theme/antd.less +16 -1
- package/lib/ProEditTable/components/RenderField/index.js +4 -8
- package/lib/ProEditTable/style/index.less +1 -1
- package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
- package/lib/ProForm/components/base/TextArea/index.js +4 -2
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +1 -1
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +1 -1
- package/lib/ProForm/components/combination/FormList/utils.js +2 -3
- package/lib/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.js +2 -2
- package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
- package/lib/ProForm/components/combination/Group/index.js +55 -73
- package/lib/ProForm/components/combination/Group/propsType.d.ts +27 -14
- package/lib/ProForm/components/combination/Group/utils.d.ts +60 -7
- package/lib/ProForm/components/combination/Group/utils.js +210 -20
- package/lib/ProForm/components/combination/ProModalSelect/index.js +35 -29
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +6 -1
- package/lib/ProForm/components/combination/_Group/index.d.ts +4 -0
- package/lib/ProForm/components/combination/_Group/index.js +113 -0
- package/lib/ProForm/components/combination/_Group/propsType.d.ts +35 -0
- package/lib/ProForm/components/combination/_Group/utils.d.ts +10 -0
- package/lib/ProForm/components/combination/_Group/utils.js +53 -0
- package/lib/ProForm/components/render/ConfirmWrapper.js +68 -33
- package/lib/ProForm/components/render/Render.js +9 -7
- package/lib/ProForm/components/render/propsType.d.ts +2 -2
- package/lib/ProForm/index.d.ts +3 -1
- package/lib/ProForm/index.js +14 -13
- package/lib/ProForm/style/index.less +7 -0
- package/lib/ProForm/utils/diffOriginal.js +2 -1
- package/lib/ProForm/utils/index.d.ts +3 -1
- package/lib/ProForm/utils/index.js +25 -2
- package/lib/ProForm/utils/rulesCreator.js +1 -1
- package/lib/ProForm/utils/transformNames.js +2 -9
- package/lib/ProForm/utils/useDeepCompareMemo.d.ts +2 -0
- package/lib/ProForm/utils/useDeepCompareMemo.js +20 -0
- package/lib/ProForm/utils/useForm.js +34 -17
- package/lib/ProForm/utils/useListChanged.js +1 -1
- package/lib/ProForm/utils/useRules.js +2 -20
- package/lib/ProLayout/components/ProCollapse/index.js +5 -1
- package/lib/ProStep/components/Listener/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.js +3 -2
- package/lib/ProStep/index.d.ts +1 -1
- package/lib/global.less +27 -8
- package/lib/locale/zh_CN.js +1 -1
- package/lib/style/theme/antd.less +16 -1
- package/package.json +1 -1
- package/es/ProForm/components/combination/GroupCopy/index.d.ts +0 -10
- package/es/ProForm/components/combination/GroupCopy/index.js +0 -84
- package/es/ProForm/components/combination/GroupCopy/propsType.d.ts +0 -47
- package/es/ProForm/components/combination/GroupCopy/utils.d.ts +0 -53
- package/es/ProForm/components/combination/GroupCopy/utils.js +0 -180
- package/lib/ProForm/components/combination/GroupCopy/index.d.ts +0 -10
- package/lib/ProForm/components/combination/GroupCopy/index.js +0 -91
- package/lib/ProForm/components/combination/GroupCopy/propsType.d.ts +0 -47
- package/lib/ProForm/components/combination/GroupCopy/utils.d.ts +0 -53
- package/lib/ProForm/components/combination/GroupCopy/utils.js +0 -187
- /package/es/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.d.ts +0 -0
- /package/es/ProForm/components/combination/{GroupCopy → _Group}/propsType.js +0 -0
- /package/es/ProForm/components/combination/{GroupCopy → _Group}/style/index.less +0 -0
- /package/lib/ProForm/components/combination/{GroupCopy → Group}/component/ComRender.d.ts +0 -0
- /package/lib/ProForm/components/combination/{GroupCopy → _Group}/propsType.js +0 -0
- /package/lib/ProForm/components/combination/{GroupCopy → _Group}/style/index.less +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import "antd/es/modal/style";
|
|
3
4
|
import _Modal from "antd/es/modal";
|
|
5
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
7
|
var _excluded = ["onChange", "children", "confirm", "otherProps"];
|
|
6
8
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -19,40 +21,73 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
19
21
|
rest = _objectWithoutProperties(props, _excluded);
|
|
20
22
|
var _ProForm$useFieldProp = ProForm.useFieldProps(),
|
|
21
23
|
form = _ProForm$useFieldProp.form;
|
|
22
|
-
var handleChange = function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
var handleChange = /*#__PURE__*/function () {
|
|
25
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
|
|
26
|
+
var _len,
|
|
27
|
+
other,
|
|
28
|
+
_key,
|
|
29
|
+
_value,
|
|
30
|
+
confirmProps,
|
|
31
|
+
_args = arguments;
|
|
32
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
33
|
+
while (1) switch (_context.prev = _context.next) {
|
|
34
|
+
case 0:
|
|
35
|
+
for (_len = _args.length, other = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
36
|
+
other[_key - 1] = _args[_key];
|
|
37
|
+
}
|
|
38
|
+
_value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
|
|
39
|
+
if (!isFunction(confirm)) {
|
|
40
|
+
_context.next = 8;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
_context.next = 5;
|
|
44
|
+
return confirm(value, form.getFieldsValue(), {
|
|
45
|
+
option: other[0],
|
|
46
|
+
form: form,
|
|
47
|
+
namePath: otherProps.namePath,
|
|
48
|
+
index: otherProps.index
|
|
49
|
+
});
|
|
50
|
+
case 5:
|
|
51
|
+
_context.t0 = _context.sent;
|
|
52
|
+
_context.next = 9;
|
|
53
|
+
break;
|
|
54
|
+
case 8:
|
|
55
|
+
_context.t0 = confirm;
|
|
56
|
+
case 9:
|
|
57
|
+
confirmProps = _context.t0;
|
|
58
|
+
// 只处理 false, true 和 对象的情况
|
|
59
|
+
if (confirmProps === false) {
|
|
60
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
61
|
+
}
|
|
62
|
+
if (confirmProps === true) {
|
|
63
|
+
_Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
|
|
64
|
+
onOk: function onOk() {
|
|
65
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
66
|
+
}
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
if (isObject(confirmProps)) {
|
|
70
|
+
_Modal.confirm(_objectSpread(_objectSpread(_objectSpread({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
|
|
71
|
+
onOk: function onOk() {
|
|
72
|
+
var _confirmProps$onOk;
|
|
73
|
+
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
74
|
+
arg[_key2] = arguments[_key2];
|
|
75
|
+
}
|
|
76
|
+
(_confirmProps$onOk = confirmProps.onOk) === null || _confirmProps$onOk === void 0 ? void 0 : _confirmProps$onOk.call.apply(_confirmProps$onOk, [confirmProps].concat(arg));
|
|
77
|
+
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
case 13:
|
|
82
|
+
case "end":
|
|
83
|
+
return _context.stop();
|
|
37
84
|
}
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _confirmProps$onOk;
|
|
45
|
-
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
46
|
-
arg[_key2] = arguments[_key2];
|
|
47
|
-
}
|
|
48
|
-
(_confirmProps$onOk = confirmProps.onOk) === null || _confirmProps$onOk === void 0 ? void 0 : _confirmProps$onOk.call.apply(_confirmProps$onOk, [confirmProps].concat(arg));
|
|
49
|
-
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
50
|
-
}
|
|
51
|
-
}));
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [_value].concat(other));
|
|
55
|
-
};
|
|
85
|
+
}, _callee);
|
|
86
|
+
}));
|
|
87
|
+
return function handleChange(_x) {
|
|
88
|
+
return _ref.apply(this, arguments);
|
|
89
|
+
};
|
|
90
|
+
}();
|
|
56
91
|
return _jsx(_Fragment, {
|
|
57
92
|
children: /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, rest), {}, {
|
|
58
93
|
// @ts-ignore
|
|
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
22
22
|
import React, { useMemo } from 'react';
|
|
23
23
|
import classNames from 'classnames';
|
|
24
24
|
import { ReactSVG } from 'react-svg';
|
|
25
|
-
import { isFunction, isString, omit } from 'lodash';
|
|
25
|
+
import { isFunction, isString, omit, set } from 'lodash';
|
|
26
26
|
import useShouldUpdate from '../../utils/useShouldUpdate';
|
|
27
27
|
import { isTrim, isUpperCase, findOptionByValue, parseNamePath } from '../../utils/index';
|
|
28
28
|
import { useProConfig } from '../../../ProConfigProvider';
|
|
@@ -242,7 +242,7 @@ var Render = function Render(props) {
|
|
|
242
242
|
* onChange参数重置 (value, record, { form, index, namePath, option }) => void
|
|
243
243
|
*/
|
|
244
244
|
var handleChange = function handleChange() {
|
|
245
|
-
var _lastComponentProps$c2;
|
|
245
|
+
var _otherFormItemProps$n3, _lastComponentProps$c2;
|
|
246
246
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
247
247
|
args[_key] = arguments[_key];
|
|
248
248
|
}
|
|
@@ -255,16 +255,18 @@ var Render = function Render(props) {
|
|
|
255
255
|
if (changeKey === 'onFieldChange') {
|
|
256
256
|
_args = functionArgs([].concat(args));
|
|
257
257
|
}
|
|
258
|
+
var inList = _otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : (_otherFormItemProps$n3 = _otherFormItemProps.namePath) === null || _otherFormItemProps$n3 === void 0 ? void 0 : _otherFormItemProps$n3.length;
|
|
258
259
|
if ( /*#__PURE__*/React.isValidElement(AutoComponent)) {
|
|
259
260
|
var _AutoComponent$props$, _AutoComponent$props, _lastComponentProps$c;
|
|
260
261
|
((_AutoComponent$props$ = (_AutoComponent$props = AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props)[changeKey]) === null || _AutoComponent$props$ === void 0 ? void 0 : _AutoComponent$props$.call.apply(_AutoComponent$props$, [_AutoComponent$props].concat(_toConsumableArray(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat(_toConsumableArray(_args))));
|
|
261
262
|
return false;
|
|
262
263
|
}
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
264
|
+
// FormList 和 Group场景 对比值改变的话, 回显到表单上
|
|
265
|
+
if (inList && changeKey === 'onFieldChange') {
|
|
266
|
+
var values = form.getFieldsValue();
|
|
267
|
+
var newValues = set(values, _otherFormItemProps.namePath, _args[1]);
|
|
268
|
+
form.setFieldsValue(newValues);
|
|
269
|
+
}
|
|
268
270
|
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
269
271
|
if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
|
|
270
272
|
setTimeout(function () {
|
|
@@ -316,7 +318,7 @@ var Render = function Render(props) {
|
|
|
316
318
|
}();
|
|
317
319
|
var renderItem = function renderItem() {
|
|
318
320
|
// 移除多余字段,group保留onFieldChange
|
|
319
|
-
var lastComponentPropsFilter =
|
|
321
|
+
var lastComponentPropsFilter = ['onFieldChange', 'disabledStrictly'];
|
|
320
322
|
// 表单渲染 start
|
|
321
323
|
var childProps = _objectSpread(_objectSpread(_objectSpread({}, AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props), omit(lastComponentProps, lastComponentPropsFilter)), {}, {
|
|
322
324
|
// @ts-ignore
|
|
@@ -28,7 +28,7 @@ import { ProEditTableProps } from '../../../ProEditTable/propsType';
|
|
|
28
28
|
import { ProTreeModalProps } from '../../../ProTreeModal/propsType';
|
|
29
29
|
import { ProUploadProps } from '../../../ProUpload/propsType';
|
|
30
30
|
import { ProTreeProps } from '../../../ProTree/propsType';
|
|
31
|
-
import { GroupProps } from '../combination/Group/propsType';
|
|
31
|
+
import { GroupProps as GroupCopyProps } from '../combination/Group/propsType';
|
|
32
32
|
import { ProCollapseProps } from '../../../ProLayout/components/ProCollapse/PropTypes';
|
|
33
33
|
import { DistributiveOmit } from '../../propsType';
|
|
34
34
|
export type ComponentMap = keyof typeof componentMap;
|
|
@@ -159,7 +159,7 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
159
159
|
fieldProps?: FieldProps<ProTreeProps, Values, T>;
|
|
160
160
|
} | {
|
|
161
161
|
type?: 'Group';
|
|
162
|
-
fieldProps?:
|
|
162
|
+
fieldProps?: GroupCopyProps | ReactiveFunction<Values, GroupCopyProps>;
|
|
163
163
|
} | {
|
|
164
164
|
type?: 'ProCollapse';
|
|
165
165
|
fieldProps?: ProCollapseProps | ReactiveFunction<Values, ProCollapseProps>;
|
package/es/ProForm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Form, FormInstance } from 'antd';
|
|
2
|
-
import { ForwardRefRenderFunction } from 'react';
|
|
2
|
+
import React, { ForwardRefRenderFunction } from 'react';
|
|
3
|
+
import { FormProviderProps } from 'antd/es/form/context';
|
|
3
4
|
import { ProFormProps } from './propsType';
|
|
4
5
|
interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, ProFormProps<T>> {
|
|
5
6
|
useForm: typeof Form.useForm;
|
|
@@ -7,4 +8,5 @@ interface IProForm<T = any> extends ForwardRefRenderFunction<FormInstance<T>, Pr
|
|
|
7
8
|
[key: string]: any;
|
|
8
9
|
}
|
|
9
10
|
declare const ProFormForward: IProForm;
|
|
11
|
+
export declare const ProFormProvider: React.FC<FormProviderProps>;
|
|
10
12
|
export default ProFormForward;
|
package/es/ProForm/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
2
1
|
import "antd/es/row/style";
|
|
3
2
|
import _Row from "antd/es/row";
|
|
4
3
|
import "antd/es/form/style";
|
|
@@ -282,30 +281,32 @@ ProFormForward.useWatch = function (watchValue, form) {
|
|
|
282
281
|
}
|
|
283
282
|
return _Form.useWatch([], form);
|
|
284
283
|
};
|
|
285
|
-
var ProFormProvider = function ProFormProvider(props) {
|
|
284
|
+
export var ProFormProvider = function ProFormProvider(props) {
|
|
286
285
|
var onFormChange = props.onFormChange,
|
|
287
286
|
onFormFinish = props.onFormFinish,
|
|
288
287
|
children = props.children;
|
|
289
|
-
var handleFormChange = function handleFormChange(
|
|
288
|
+
var handleFormChange = function handleFormChange(formName, info) {
|
|
290
289
|
var changedFields = info.changedFields;
|
|
291
290
|
var _changedFields = changedFields.flatMap(function (item) {
|
|
292
|
-
var
|
|
293
|
-
_item$value = item.value,
|
|
291
|
+
var _item$value = item.value,
|
|
294
292
|
value = _item$value === void 0 ? [] : _item$value;
|
|
295
|
-
var
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
var
|
|
299
|
-
|
|
293
|
+
var name = item.name;
|
|
294
|
+
var namesStr = name[name.length - 1];
|
|
295
|
+
// name中的最后一位如果包含 '-' 则是names组件
|
|
296
|
+
var isNames = String(namesStr).includes('-');
|
|
297
|
+
if (!isNames) return item; // 不是names组件直接返回
|
|
298
|
+
var namesList = splitNameStr(String(namesStr)); // 拆解出name列表
|
|
299
|
+
var prefix = name.slice(0, name.length - 1);
|
|
300
|
+
return namesList.map(function (nameItem, index) {
|
|
300
301
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
301
|
-
name:
|
|
302
|
+
name: [].concat(_toConsumableArray(prefix), _toConsumableArray(nameItem)),
|
|
302
303
|
value: value[index]
|
|
303
304
|
});
|
|
304
305
|
});
|
|
305
306
|
});
|
|
306
307
|
info.changedFields = _changedFields;
|
|
307
308
|
// @ts-ignore
|
|
308
|
-
onFormChange(
|
|
309
|
+
onFormChange(formName, info);
|
|
309
310
|
};
|
|
310
311
|
return _jsx(_Form.Provider, {
|
|
311
312
|
onFormChange: onFormChange ? handleFormChange : undefined,
|
|
@@ -140,6 +140,13 @@
|
|
|
140
140
|
|
|
141
141
|
// 地址组件
|
|
142
142
|
.@{ant-prefix}-form-item-control-input-content {
|
|
143
|
+
// 查看模式
|
|
144
|
+
& > span {
|
|
145
|
+
border-radius: 4px;
|
|
146
|
+
padding: 5px 8px;
|
|
147
|
+
background: @zaui-contract-bg;
|
|
148
|
+
}
|
|
149
|
+
|
|
143
150
|
& > .pro-address {
|
|
144
151
|
.@{ant-prefix}-select-selector,
|
|
145
152
|
.@{ant-prefix}-input-affix-wrapper,
|
|
@@ -40,7 +40,8 @@ export var diffOriginal = function diffOriginal(params) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
43
|
-
|
|
43
|
+
var res = !isEqual(value, originalValue);
|
|
44
|
+
return res;
|
|
44
45
|
}
|
|
45
46
|
return false;
|
|
46
47
|
};
|
|
@@ -27,7 +27,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
|
|
|
27
27
|
export declare const isUpperCase: (type: string, upperCase: boolean) => any;
|
|
28
28
|
export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
|
|
29
29
|
export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
|
|
30
|
-
export declare const splitNameStr: (name: string) =>
|
|
30
|
+
export declare const splitNameStr: (name: string) => string[][];
|
|
31
31
|
export declare const filterInternalFields: (values: any) => any;
|
|
32
32
|
export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
|
|
33
33
|
export declare const isNullValue: (value: any) => boolean;
|
|
@@ -95,4 +95,6 @@ export declare const findOptionByValue: (treeData: any[], value: string | number
|
|
|
95
95
|
export declare const equalDependencies: (dependencies: any, prevValues: any, currentValues: any) => any;
|
|
96
96
|
/** 解析namePath */
|
|
97
97
|
export declare const parseNamePath: (input: string) => any;
|
|
98
|
+
/** 解析namePath */
|
|
99
|
+
export declare function findNamesKeyInArray(arr: string[], key: string): string | null;
|
|
98
100
|
export {};
|
|
@@ -434,4 +434,25 @@ export var parseNamePath = function parseNamePath(input) {
|
|
|
434
434
|
return isNaN(Number(item)) ? item : Number(item);
|
|
435
435
|
});
|
|
436
436
|
return [result];
|
|
437
|
-
};
|
|
437
|
+
};
|
|
438
|
+
/** 解析namePath */
|
|
439
|
+
export function findNamesKeyInArray(arr, key) {
|
|
440
|
+
var _iterator2 = _createForOfIteratorHelper(arr),
|
|
441
|
+
_step2;
|
|
442
|
+
try {
|
|
443
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
444
|
+
var item = _step2.value;
|
|
445
|
+
if (!item.includes('_')) {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
if (item.split('_')[0].includes(key)) {
|
|
449
|
+
return item;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
} catch (err) {
|
|
453
|
+
_iterator2.e(err);
|
|
454
|
+
} finally {
|
|
455
|
+
_iterator2.f();
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
@@ -6,7 +6,7 @@ import locale, { formatMessage } from '../../locale';
|
|
|
6
6
|
var getNonEmptyValuesByIndex = function getNonEmptyValuesByIndex(required, valueArray) {
|
|
7
7
|
var result = [];
|
|
8
8
|
required.forEach(function (item, index) {
|
|
9
|
-
if (item && !valueArray[index] && !isNumber(valueArray[index])) {
|
|
9
|
+
if (item && !(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index]) && !isNumber(valueArray === null || valueArray === void 0 ? void 0 : valueArray[index])) {
|
|
10
10
|
result.push(index + 1);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
import { union
|
|
1
|
+
import { union } from 'lodash';
|
|
2
2
|
import { transformValue } from './transformValue';
|
|
3
3
|
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
|
4
|
-
var _names2, _names3, _names3$;
|
|
5
4
|
var _ref = formItem || {},
|
|
6
5
|
normalize = _ref.normalize,
|
|
7
6
|
getValueProps = _ref.getValueProps,
|
|
8
7
|
_shouldUpdate2 = _ref.shouldUpdate;
|
|
9
|
-
|
|
10
|
-
if (!((_names2 = _names) === null || _names2 === void 0 ? void 0 : _names2.length)) {
|
|
8
|
+
if (!(names === null || names === void 0 ? void 0 : names.length)) {
|
|
11
9
|
return {};
|
|
12
10
|
}
|
|
13
11
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
|
14
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;
|
|
15
|
-
|
|
16
|
-
_names = _names.map(function (item) {
|
|
17
|
-
return union(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, item);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
var _transformValue = transformValue(_names, form, _fieldName, normalize, getValueProps),
|
|
13
|
+
var _transformValue = transformValue(names, form, _fieldName, normalize, getValueProps),
|
|
21
14
|
_normalize = _transformValue.normalize,
|
|
22
15
|
_getValueProps = _transformValue.getValueProps,
|
|
23
16
|
_shouldUpdate = _transformValue.shouldUpdate;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { isEqualWith } from 'lodash';
|
|
3
|
+
import { customEqualForFun } from '.';
|
|
4
|
+
/** 深度比较依赖变化memo */
|
|
5
|
+
export var useDeepCompareMemo = function useDeepCompareMemo(fun, depList) {
|
|
6
|
+
var lastDependency = useRef(); // 上一次的依赖
|
|
7
|
+
var lastRes = useRef(); // 上一次的结果
|
|
8
|
+
if (!isEqualWith(depList, lastDependency.current, customEqualForFun)) {
|
|
9
|
+
var res = fun();
|
|
10
|
+
lastRes.current = res;
|
|
11
|
+
}
|
|
12
|
+
lastDependency.current = depList;
|
|
13
|
+
return lastRes.current;
|
|
14
|
+
};
|
|
@@ -21,11 +21,15 @@ export var useForm = function useForm(originForm) {
|
|
|
21
21
|
};
|
|
22
22
|
var _validateFields = /*#__PURE__*/function () {
|
|
23
23
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
|
|
24
|
-
var
|
|
24
|
+
var _rest$,
|
|
25
|
+
_len,
|
|
25
26
|
rest,
|
|
26
27
|
_key,
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
isRecursive,
|
|
29
|
+
validateNames,
|
|
30
|
+
_form$getInternalHook,
|
|
31
|
+
getFields,
|
|
32
|
+
fieldsList,
|
|
29
33
|
_error$errorFields,
|
|
30
34
|
_error$errorFields$,
|
|
31
35
|
_args = arguments;
|
|
@@ -36,20 +40,33 @@ export var useForm = function useForm(originForm) {
|
|
|
36
40
|
for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
37
41
|
rest[_key - 1] = _args[_key];
|
|
38
42
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
_context.next = 7;
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
isRecursive = rest === null || rest === void 0 ? void 0 : (_rest$ = rest[0]) === null || _rest$ === void 0 ? void 0 : _rest$.recursive;
|
|
45
|
+
validateNames = []; // 前缀校验模式
|
|
46
|
+
if (!isRecursive) {
|
|
47
|
+
_context.next = 10;
|
|
45
48
|
break;
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
_form$getInternalHook = form.getInternalHooks('RC_FORM_INTERNAL_HOOKS'), getFields = _form$getInternalHook.getFields;
|
|
52
|
+
fieldsList = getFields();
|
|
53
|
+
fieldsList.forEach(function (item) {
|
|
54
|
+
var _item$name, _item$name2, _item$name2$;
|
|
55
|
+
if (nameList[0] === ((_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name[0]) || ((_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : (_item$name2$ = _item$name2[0]) === null || _item$name2$ === void 0 ? void 0 : _item$name2$.startsWith("".concat(nameList[0], "_")))) {
|
|
56
|
+
validateNames.push(item.name);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
delete rest[0].recursive;
|
|
61
|
+
return _context.abrupt("return", validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
|
|
62
|
+
return filterInternalFields(values);
|
|
63
|
+
}));
|
|
64
|
+
case 10:
|
|
65
|
+
return _context.abrupt("return", validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
|
|
66
|
+
return nameList ? values : _getFieldsValue();
|
|
67
|
+
}));
|
|
68
|
+
case 13:
|
|
69
|
+
_context.prev = 13;
|
|
53
70
|
_context.t0 = _context["catch"](0);
|
|
54
71
|
if (_context.t0 && (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields)) {
|
|
55
72
|
form === null || form === void 0 ? void 0 : form.scrollToField(_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$errorFields = _context.t0.errorFields) === null || _error$errorFields === void 0 ? void 0 : (_error$errorFields$ = _error$errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
|
|
@@ -58,11 +75,11 @@ export var useForm = function useForm(originForm) {
|
|
|
58
75
|
});
|
|
59
76
|
}
|
|
60
77
|
throw _context.t0;
|
|
61
|
-
case
|
|
78
|
+
case 17:
|
|
62
79
|
case "end":
|
|
63
80
|
return _context.stop();
|
|
64
81
|
}
|
|
65
|
-
}, _callee, null, [[0,
|
|
82
|
+
}, _callee, null, [[0, 13]]);
|
|
66
83
|
}));
|
|
67
84
|
return function _validateFields(_x) {
|
|
68
85
|
return _ref.apply(this, arguments);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "antd/es/form/style";
|
|
2
2
|
import _Form from "antd/es/form";
|
|
3
|
-
import { get } from 'lodash';
|
|
3
|
+
import { get, isString } from 'lodash';
|
|
4
4
|
import { diffOriginal } from './diffOriginal';
|
|
5
5
|
var toNamePath = function toNamePath(name) {
|
|
6
6
|
if (Array.isArray(name)) {
|
|
@@ -87,7 +87,7 @@ export var useListChanged = function useListChanged(params) {
|
|
|
87
87
|
originalValue: originalValue,
|
|
88
88
|
form: form,
|
|
89
89
|
equalWith: equalWith,
|
|
90
|
-
name: namesStr || name
|
|
90
|
+
name: isString(namesStr) ? namesStr : originalName || name
|
|
91
91
|
});
|
|
92
92
|
return [changed, originalValue];
|
|
93
93
|
};
|
|
@@ -24,10 +24,6 @@ var useRules = function useRules(props) {
|
|
|
24
24
|
var result = {
|
|
25
25
|
rules: rules || []
|
|
26
26
|
};
|
|
27
|
-
// Group required: true时,直接走完整校验
|
|
28
|
-
if (allRequired && type === 'Group') {
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
27
|
if (allRequired) {
|
|
32
28
|
if (!requiredRule) {
|
|
33
29
|
var message = isSelect ? "".concat(locale.ProForm.selectPlaceHolder).concat(_label) : "".concat(locale.ProForm.inputPlaceholder).concat(_label);
|
|
@@ -58,23 +54,9 @@ var useRules = function useRules(props) {
|
|
|
58
54
|
required: required
|
|
59
55
|
});
|
|
60
56
|
useEffect(function () {
|
|
61
|
-
if (type === 'Group' && (allRequired || requiredRule)) {
|
|
62
|
-
var customRequired = {
|
|
63
|
-
validator: function validator(rules, value) {
|
|
64
|
-
// 完整性校验, 数组有值且值不完整则校验不通过
|
|
65
|
-
if (Array.isArray(value) && isNotFullArray(value, names.length, required)) {
|
|
66
|
-
return Promise.reject(new Error("".concat(locale.ProForm.completeText).concat(_label)));
|
|
67
|
-
}
|
|
68
|
-
return Promise.resolve();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
// 插入rules第一条,完整性校验大于自定义
|
|
72
|
-
internalRule.rules.unshift(customRequired);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
57
|
// 添加完整性校验
|
|
76
58
|
if (names && !isBoolean(labelRequired)) {
|
|
77
|
-
var
|
|
59
|
+
var customRequired = {
|
|
78
60
|
validator: function validator(rules, value) {
|
|
79
61
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
|
80
62
|
if (Array.isArray(value) && !isNullArray(value) && isNotFullArray(value, names.length, required)) {
|
|
@@ -83,7 +65,7 @@ var useRules = function useRules(props) {
|
|
|
83
65
|
return Promise.resolve();
|
|
84
66
|
}
|
|
85
67
|
};
|
|
86
|
-
internalRule.rules.unshift(
|
|
68
|
+
internalRule.rules.unshift(customRequired);
|
|
87
69
|
}
|
|
88
70
|
}, [internalRule]);
|
|
89
71
|
return internalRule;
|
|
@@ -119,12 +119,16 @@ var ProCollapse = function ProCollapse(props) {
|
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
var proCollapseNoTitles = proCollapseContent.querySelectorAll('.pro-collapse-no-level1-title');
|
|
122
|
+
var proFooterNode = proCollapseContent.querySelector('.pro-footer');
|
|
122
123
|
var proCollapses = proCollapseContent.querySelectorAll('.pro-collapse');
|
|
123
|
-
if (proCollapseNoTitles.length === 1 && proCollapses.length === 1) {
|
|
124
|
+
if ((proCollapseNoTitles === null || proCollapseNoTitles === void 0 ? void 0 : proCollapseNoTitles.length) === 1 && proCollapses.length === 1) {
|
|
124
125
|
var rect = proCollapseNoTitles[0].getBoundingClientRect();
|
|
125
126
|
if ((rect === null || rect === void 0 ? void 0 : rect.height) < window.innerHeight - rect.top) {
|
|
126
127
|
proCollapseNoTitles[0].style.minHeight = "calc(100vh - ".concat(rect.top + 16, "px)");
|
|
127
128
|
}
|
|
129
|
+
if (proFooterNode) {
|
|
130
|
+
proCollapseNoTitles[0].style.minHeight = "calc(100vh - ".concat(rect.top + proFooterNode.offsetHeight + 16, "px)");
|
|
131
|
+
}
|
|
128
132
|
}
|
|
129
133
|
return function () {
|
|
130
134
|
if (proCollapseNoTitles.length === 1 && proCollapses.length === 1) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: ({ children, }: any) => React.DetailedReactHTMLElement<{
|
|
2
|
+
declare const _default: ({ children, delayTime, }: any) => React.DetailedReactHTMLElement<{
|
|
3
3
|
onClick: import("lodash").DebouncedFunc<() => Promise<void>>;
|
|
4
4
|
}, HTMLElement>;
|
|
5
5
|
export default _default;
|
|
@@ -4,7 +4,8 @@ import { throttle } from 'lodash';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useStep } from '../../index';
|
|
6
6
|
export default (function (_ref) {
|
|
7
|
-
var children = _ref.children
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
delayTime = _ref.delayTime;
|
|
8
9
|
var _useStep = useStep(),
|
|
9
10
|
notify = _useStep.notify;
|
|
10
11
|
return /*#__PURE__*/React.cloneElement(children, {
|
|
@@ -24,7 +25,7 @@ export default (function (_ref) {
|
|
|
24
25
|
var _children$props, _children$props$onCli;
|
|
25
26
|
children === null || children === void 0 ? void 0 : (_children$props = children.props) === null || _children$props === void 0 ? void 0 : (_children$props$onCli = _children$props.onClick) === null || _children$props$onCli === void 0 ? void 0 : _children$props$onCli.call(_children$props, values);
|
|
26
27
|
}
|
|
27
|
-
}, 0);
|
|
28
|
+
}, delayTime !== null && delayTime !== void 0 ? delayTime : 0);
|
|
28
29
|
case 5:
|
|
29
30
|
case "end":
|
|
30
31
|
return _context.stop();
|
package/es/ProStep/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const ProStep: {
|
|
|
7
7
|
({ children, ...resetProps }: ProStepPropsType): JSX.Element;
|
|
8
8
|
useStep: () => any;
|
|
9
9
|
Item: ({ id, title, collapse: collapseItem, children, ...restProps }: import("./propsType").ProStepItem) => JSX.Element;
|
|
10
|
-
Listener: ({ children, }: any) => import("react").DetailedReactHTMLElement<{
|
|
10
|
+
Listener: ({ children, delayTime, }: any) => import("react").DetailedReactHTMLElement<{
|
|
11
11
|
onClick: import("lodash").DebouncedFunc<() => Promise<void>>;
|
|
12
12
|
}, HTMLElement>;
|
|
13
13
|
};
|
package/es/global.less
CHANGED
|
@@ -9,13 +9,21 @@ pre {
|
|
|
9
9
|
scrollbar-face-color: #d2d3d7;
|
|
10
10
|
scrollbar-highlight-color: #979797;
|
|
11
11
|
scrollbar-3dlight-color: #979797;
|
|
12
|
+
|
|
12
13
|
::-webkit-scrollbar {
|
|
13
14
|
width: 16px;
|
|
15
|
+
background: transparent;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
//
|
|
17
|
-
::-webkit-scrollbar-
|
|
18
|
-
background-color: #
|
|
18
|
+
// 轨道
|
|
19
|
+
::-webkit-scrollbar-track {
|
|
20
|
+
background-color: #fff;
|
|
21
|
+
border-radius: 10px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 悬浮轨道
|
|
25
|
+
::-webkit-scrollbar-thumb:hover {
|
|
26
|
+
background-color: #979797;
|
|
19
27
|
background-clip: padding-box;
|
|
20
28
|
border-color: transparent;
|
|
21
29
|
border-style: dashed;
|
|
@@ -24,14 +32,25 @@ pre {
|
|
|
24
32
|
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
:hover::-webkit-scrollbar-track {
|
|
36
|
+
background: transparent;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:hover::-webkit-scrollbar-thumb {
|
|
40
|
+
background-color: #d2d3d7;
|
|
41
|
+
background-clip: padding-box;
|
|
42
|
+
border-color: transparent;
|
|
43
|
+
border-style: dashed;
|
|
44
|
+
border-width: 4px;
|
|
30
45
|
border-radius: 10px;
|
|
46
|
+
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0);
|
|
31
47
|
}
|
|
32
48
|
|
|
33
|
-
|
|
34
|
-
::-webkit-scrollbar-thumb:hover {
|
|
49
|
+
:hover::-webkit-scrollbar-thumb:hover {
|
|
35
50
|
background-color: #979797;
|
|
36
51
|
}
|
|
52
|
+
|
|
53
|
+
:hover::-webkit-scrollbar-track {
|
|
54
|
+
background-color: #fff;
|
|
55
|
+
}
|
|
37
56
|
}
|