@zat-design/sisyphus-react 3.3.0 → 3.3.1-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 +36 -11
- package/es/ProEditTable/components/RenderField/index.js +13 -10
- package/es/ProEditTable/index.js +47 -18
- package/es/ProEditTable/style/index.less +5 -0
- package/es/ProEnum/hooks/useEnumRequest.js +13 -1
- package/es/ProEnum/index.js +7 -18
- package/es/ProEnum/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/es/ProForm/components/combination/FormList/index.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +3 -4
- package/es/ProForm/components/combination/Group/style/index.less +26 -21
- package/es/ProForm/components/combination/Group/utils.d.ts +0 -2
- package/es/ProForm/components/combination/Group/utils.js +0 -13
- package/es/ProForm/components/combination/ProModalSelect/index.js +24 -27
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +9 -2
- package/es/ProForm/components/render/Render.js +19 -25
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/style/index.less +5 -4
- package/es/ProForm/utils/contrastOriginal.d.ts +0 -1
- package/es/ProForm/utils/contrastOriginal.js +0 -1
- package/es/ProForm/utils/rulesCreator.js +2 -1
- package/es/ProForm/utils/useChanged.d.ts +7 -14
- package/es/ProForm/utils/useChanged.js +13 -20
- package/es/ProForm/utils/useForm.js +15 -7
- package/es/ProForm/utils/useListChanged.d.ts +16 -0
- package/es/ProForm/utils/useListChanged.js +81 -0
- package/es/ProForm/utils/useRules.js +6 -5
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
- package/es/ProLayout/components/Layout/Menu/index.js +13 -10
- package/es/ProLayout/propTypes.d.ts +2 -0
- package/es/ProStep/index.js +2 -2
- package/es/ProTable/style/index.less +7 -6
- package/es/ProTooltip/index.js +14 -1
- package/es/ProTreeModal/components/Trigger.d.ts +1 -0
- package/es/ProTreeModal/components/Trigger.js +19 -8
- package/es/ProTreeModal/index.js +15 -5
- package/es/ProTreeModal/style/index.less +85 -84
- package/es/ProUpload/components/ImageRender.js +19 -10
- package/es/locale/en_US.d.ts +2 -0
- package/es/locale/en_US.js +3 -1
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +4 -1
- package/lib/ProEditTable/components/RenderField/index.js +13 -10
- package/lib/ProEditTable/index.js +46 -17
- package/lib/ProEditTable/style/index.less +5 -0
- package/lib/ProEnum/hooks/useEnumRequest.js +13 -1
- package/lib/ProEnum/index.js +6 -17
- package/lib/ProEnum/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/lib/ProForm/components/combination/FormList/index.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +2 -3
- package/lib/ProForm/components/combination/Group/style/index.less +26 -21
- package/lib/ProForm/components/combination/Group/utils.d.ts +0 -2
- package/lib/ProForm/components/combination/Group/utils.js +1 -14
- package/lib/ProForm/components/combination/ProModalSelect/index.js +23 -26
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +9 -2
- package/lib/ProForm/components/render/Render.js +19 -25
- package/lib/ProForm/components/render/RenderFields.js +6 -2
- package/lib/ProForm/style/index.less +5 -4
- package/lib/ProForm/utils/contrastOriginal.d.ts +0 -1
- package/lib/ProForm/utils/contrastOriginal.js +0 -1
- package/lib/ProForm/utils/rulesCreator.js +2 -1
- package/lib/ProForm/utils/useChanged.d.ts +7 -14
- package/lib/ProForm/utils/useChanged.js +13 -20
- package/lib/ProForm/utils/useForm.js +15 -7
- package/lib/ProForm/utils/useListChanged.d.ts +16 -0
- package/lib/ProForm/utils/useListChanged.js +86 -0
- package/lib/ProForm/utils/useRules.js +5 -4
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +13 -5
- package/lib/ProLayout/components/Layout/Menu/index.js +13 -10
- package/lib/ProLayout/propTypes.d.ts +2 -0
- package/lib/ProStep/index.js +1 -1
- package/lib/ProTable/style/index.less +7 -6
- package/lib/ProTooltip/index.js +14 -1
- package/lib/ProTreeModal/components/Trigger.d.ts +1 -0
- package/lib/ProTreeModal/components/Trigger.js +18 -7
- package/lib/ProTreeModal/index.js +15 -5
- package/lib/ProTreeModal/style/index.less +85 -84
- package/lib/ProUpload/components/ImageRender.js +18 -9
- package/lib/locale/en_US.d.ts +2 -0
- package/lib/locale/en_US.js +3 -1
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.js +4 -1
- package/package.json +1 -1
|
@@ -249,9 +249,10 @@ var Render = function Render(props) {
|
|
|
249
249
|
((_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((0, _toConsumableArray2.default)(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat((0, _toConsumableArray2.default)(_args))));
|
|
250
250
|
return false;
|
|
251
251
|
}
|
|
252
|
-
// Group默认校验,
|
|
252
|
+
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
253
253
|
if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
|
|
254
254
|
setTimeout(function () {
|
|
255
|
+
form.setFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames, form.getFieldValue(formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames));
|
|
255
256
|
form.validateFields([formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames]);
|
|
256
257
|
}, 60);
|
|
257
258
|
}
|
|
@@ -361,13 +362,13 @@ var Render = function Render(props) {
|
|
|
361
362
|
};
|
|
362
363
|
}
|
|
363
364
|
// 需要过滤掉的form_item的key
|
|
364
|
-
var filterFormItemKey = ['onFieldChange',
|
|
365
|
-
// 'shouldUpdate',
|
|
366
|
-
'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
365
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
367
366
|
if (type === 'FormList') {
|
|
368
367
|
lastComponentProps.disabled = lastDisabled;
|
|
369
368
|
var lessMode = lastComponentProps.mode === 'less';
|
|
370
|
-
child = (0, _jsxRuntime.jsx)(_antd.Form.List, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
369
|
+
child = (0, _jsxRuntime.jsx)(_antd.Form.List, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
370
|
+
name: _otherFormItemProps.name
|
|
371
|
+
}, (0, _lodash.omit)(_otherFormItemProps, ['rules'])), {}, {
|
|
371
372
|
children: function children(fields, operation, meta) {
|
|
372
373
|
return (0, _jsxRuntime.jsx)(AutoComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(lastComponentProps, ['onFieldChange', 'disabledStrictly'])), {}, {
|
|
373
374
|
otherProps: otherProps,
|
|
@@ -387,31 +388,24 @@ var Render = function Render(props) {
|
|
|
387
388
|
span: 24 // 默认占一行
|
|
388
389
|
});
|
|
389
390
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
// return (
|
|
393
|
-
// <Form.Item shouldUpdate={_otherFormItemProps.shouldUpdate} noStyle>
|
|
394
|
-
// {() => {
|
|
395
|
-
// return (
|
|
396
|
-
// <Form.Item
|
|
397
|
-
// {...omit(_otherFormItemProps, filterFormItemKey)}
|
|
398
|
-
// // @ts-ignore
|
|
399
|
-
// _internalItemRender={internalItemRender}
|
|
400
|
-
// className={_className}
|
|
401
|
-
// >
|
|
402
|
-
// {child}
|
|
403
|
-
// </Form.Item>
|
|
404
|
-
// );
|
|
405
|
-
// }}
|
|
406
|
-
// </Form.Item>
|
|
407
|
-
// );
|
|
408
|
-
// }
|
|
409
|
-
var formItem = (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
391
|
+
|
|
392
|
+
var orgFormItem = (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(_otherFormItemProps, filterFormItemKey)), {}, {
|
|
410
393
|
// @ts-ignore
|
|
411
394
|
_internalItemRender: internalItemRender,
|
|
412
395
|
className: _className,
|
|
413
396
|
children: child
|
|
414
397
|
}));
|
|
398
|
+
var formItem = orgFormItem;
|
|
399
|
+
// 当存在shouldUpdate时捕获所有form变更(防止表单onchange设置form值时无法更新的问题)
|
|
400
|
+
if (_otherFormItemProps.shouldUpdate) {
|
|
401
|
+
formItem = (0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
402
|
+
shouldUpdate: _otherFormItemProps.shouldUpdate,
|
|
403
|
+
noStyle: true,
|
|
404
|
+
children: function children() {
|
|
405
|
+
return orgFormItem;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
415
409
|
// 不渲染tooltip
|
|
416
410
|
if (!originalTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
417
411
|
return formItem;
|
|
@@ -137,7 +137,11 @@ var RenderFields = function RenderFields(props) {
|
|
|
137
137
|
dataSource: dataSource,
|
|
138
138
|
type: _type
|
|
139
139
|
});
|
|
140
|
-
var
|
|
140
|
+
var placeholderHandle = function placeholderHandle() {
|
|
141
|
+
var _label = (0, _lodash.isString)(label) ? label : '';
|
|
142
|
+
var _formLabel = (0, _lodash.isString)(formLabel) ? formLabel : '';
|
|
143
|
+
return placeholder || "".concat(_isSelect ? "".concat(_locale.default.ProForm.selectPlaceHolder) : "".concat(_locale.default.ProForm.inputPlaceholder)).concat(_label || _formLabel || '');
|
|
144
|
+
};
|
|
141
145
|
// 表单组件Props 兼容2.0版本
|
|
142
146
|
var _fieldProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, formItemChildProps), fieldProps);
|
|
143
147
|
if ((0, _lodash.isBoolean)(formDisabled)) {
|
|
@@ -145,7 +149,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
145
149
|
}
|
|
146
150
|
var componentProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
147
151
|
disabledStrictly: true,
|
|
148
|
-
placeholder:
|
|
152
|
+
placeholder: placeholderHandle()
|
|
149
153
|
}, _fieldProps), {}, {
|
|
150
154
|
disabled: _disabled
|
|
151
155
|
});
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
visibility: unset;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.@{ant-prefix}-input-affix-wrapper:hover
|
|
59
|
+
.@{ant-prefix}-input-affix-wrapper:hover
|
|
60
|
+
span.@{ant-prefix}-input-clear-icon[class~='ant-input-clear-icon-hidden'] {
|
|
60
61
|
display: unset;
|
|
61
62
|
visibility: hidden;
|
|
62
63
|
}
|
|
@@ -140,9 +141,9 @@
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
.@{ant-prefix}-form-item-control-input-content >
|
|
144
|
-
background: @zaui-contract-bg;
|
|
144
|
+
.@{ant-prefix}-form-item-control-input-content > .pro-form-view-container {
|
|
145
145
|
padding: 4px 8px;
|
|
146
|
+
background: @zaui-contract-bg;
|
|
146
147
|
border-radius: 4px;
|
|
147
148
|
}
|
|
148
149
|
}
|
|
@@ -306,7 +307,7 @@
|
|
|
306
307
|
|
|
307
308
|
div.pro-form-custom-footer {
|
|
308
309
|
width: unset !important;
|
|
309
|
-
height:32px;
|
|
310
|
+
height: 32px;
|
|
310
311
|
margin-bottom: calc(var(--zaui-height-size-md, 16px) * var(--zaui-size, 1));
|
|
311
312
|
|
|
312
313
|
&.pro-form-custom-footer-hidden {
|
|
@@ -8,7 +8,6 @@ var _lodash = require("lodash");
|
|
|
8
8
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
9
9
|
var contrastOriginal = exports.contrastOriginal = function contrastOriginal(params) {
|
|
10
10
|
var originalValue = params.originalValue,
|
|
11
|
-
originalValues = params.originalValues,
|
|
12
11
|
value = params.value,
|
|
13
12
|
equalWith = params.equalWith;
|
|
14
13
|
// 支持传入自定义比较事件
|
|
@@ -7,11 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.rulesCreator = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
var _utils = require("@zat-design/utils");
|
|
10
|
+
var _lodash = require("lodash");
|
|
10
11
|
var _index = require("./index");
|
|
11
12
|
var _locale = _interopRequireDefault(require("../../locale"));
|
|
12
13
|
var rulesCreator = exports.rulesCreator = function rulesCreator(rules, label, isSelect) {
|
|
13
14
|
var _result;
|
|
14
|
-
var message = "".concat(isSelect ? "".concat(_locale.default.ProForm.selectPlaceHolder) : "".concat(_locale.default.ProForm.inputPlaceholder)).concat(_locale.default.ProForm.ruleText).concat(label
|
|
15
|
+
var message = "".concat(isSelect ? "".concat(_locale.default.ProForm.selectPlaceHolder) : "".concat(_locale.default.ProForm.inputPlaceholder)).concat(_locale.default.ProForm.ruleText).concat((0, _lodash.isString)(label) ? label : '');
|
|
15
16
|
var result = [];
|
|
16
17
|
result = rules.map(function (ruleItem) {
|
|
17
18
|
var rule = (0, _objectSpread2.default)({}, ruleItem);
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
names?: NamePath[];
|
|
6
|
-
namesStr?: NamePath;
|
|
7
|
-
originalName?: NamePath;
|
|
8
|
-
originalNames?: NamePath[];
|
|
9
|
-
originalNameStr?: NamePath;
|
|
1
|
+
export declare const useChanged: ({ name, names, namesStr, originalValues, form, equalWith }: {
|
|
2
|
+
name: any;
|
|
3
|
+
names: any;
|
|
4
|
+
namesStr: any;
|
|
10
5
|
originalValues: any;
|
|
11
|
-
form:
|
|
12
|
-
equalWith
|
|
13
|
-
}
|
|
14
|
-
export declare const useChanged: (params: Params) => any[];
|
|
15
|
-
export {};
|
|
6
|
+
form: any;
|
|
7
|
+
equalWith: any;
|
|
8
|
+
}) => any[];
|
|
@@ -7,30 +7,23 @@ exports.useChanged = void 0;
|
|
|
7
7
|
var _antd = require("antd");
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
9
|
var _contrastOriginal = require("./contrastOriginal");
|
|
10
|
-
var useChanged = exports.useChanged = function useChanged(
|
|
11
|
-
var name =
|
|
12
|
-
names =
|
|
13
|
-
namesStr =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
equalWith = params.equalWith;
|
|
21
|
-
var _form = form;
|
|
22
|
-
var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
23
|
-
return (0, _lodash.get)(originalValues, originalName);
|
|
24
|
-
}) : (0, _lodash.get)(originalValues, originalName);
|
|
10
|
+
var useChanged = exports.useChanged = function useChanged(_ref) {
|
|
11
|
+
var name = _ref.name,
|
|
12
|
+
names = _ref.names,
|
|
13
|
+
namesStr = _ref.namesStr,
|
|
14
|
+
originalValues = _ref.originalValues,
|
|
15
|
+
form = _ref.form,
|
|
16
|
+
equalWith = _ref.equalWith;
|
|
17
|
+
var originalValue = (names === null || names === void 0 ? void 0 : names.length) ? names.map(function (name) {
|
|
18
|
+
return (0, _lodash.get)(originalValues, name);
|
|
19
|
+
}) : (0, _lodash.get)(originalValues, name);
|
|
25
20
|
var notWatch = !originalValues || originalValue === undefined;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var value = _antd.Form.useWatch(namesStr || name, _form);
|
|
21
|
+
if (notWatch) form = [];
|
|
22
|
+
var value = _antd.Form.useWatch(namesStr || name, form);
|
|
29
23
|
if (notWatch) return [false];
|
|
30
24
|
var changed = (0, _contrastOriginal.contrastOriginal)({
|
|
31
|
-
value: value,
|
|
32
25
|
originalValue: originalValue,
|
|
33
|
-
|
|
26
|
+
value: value,
|
|
34
27
|
form: form,
|
|
35
28
|
equalWith: equalWith
|
|
36
29
|
});
|
|
@@ -53,23 +53,31 @@ var useForm = exports.useForm = function useForm(originForm) {
|
|
|
53
53
|
};
|
|
54
54
|
var _validateFields = /*#__PURE__*/function () {
|
|
55
55
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(nameList) {
|
|
56
|
-
var
|
|
56
|
+
var _len,
|
|
57
|
+
rest,
|
|
58
|
+
_key,
|
|
59
|
+
values,
|
|
60
|
+
_values,
|
|
61
|
+
_args = arguments;
|
|
57
62
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
58
63
|
while (1) switch (_context.prev = _context.next) {
|
|
59
64
|
case 0:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
for (_len = _args.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
66
|
+
rest[_key - 1] = _args[_key];
|
|
67
|
+
}
|
|
68
|
+
_context.next = 3;
|
|
69
|
+
return validateFields.apply(void 0, [nameList].concat(rest));
|
|
70
|
+
case 3:
|
|
63
71
|
values = _context.sent;
|
|
64
72
|
if (!nameList) {
|
|
65
|
-
_context.next =
|
|
73
|
+
_context.next = 6;
|
|
66
74
|
break;
|
|
67
75
|
}
|
|
68
76
|
return _context.abrupt("return", values);
|
|
69
|
-
case
|
|
77
|
+
case 6:
|
|
70
78
|
_values = _getFieldsValue();
|
|
71
79
|
return _context.abrupt("return", _values);
|
|
72
|
-
case
|
|
80
|
+
case 8:
|
|
73
81
|
case "end":
|
|
74
82
|
return _context.stop();
|
|
75
83
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
|
|
3
|
+
interface Params {
|
|
4
|
+
name?: NamePath;
|
|
5
|
+
names?: NamePath[];
|
|
6
|
+
namesStr?: NamePath;
|
|
7
|
+
originalName?: NamePath;
|
|
8
|
+
originalNames?: NamePath[];
|
|
9
|
+
originalNameStr?: NamePath;
|
|
10
|
+
originalValues: any;
|
|
11
|
+
form: FormInstance;
|
|
12
|
+
rowKeyPath?: InternalNamePath;
|
|
13
|
+
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const useListChanged: (params: Params) => any[];
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useListChanged = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _lodash = require("lodash");
|
|
9
|
+
var _contrastOriginal = require("./contrastOriginal");
|
|
10
|
+
var toNamePath = function toNamePath(name) {
|
|
11
|
+
if (Array.isArray(name)) {
|
|
12
|
+
return name;
|
|
13
|
+
}
|
|
14
|
+
return [name];
|
|
15
|
+
};
|
|
16
|
+
var toNamePaths = function toNamePaths(names) {
|
|
17
|
+
return names.map(function (name) {
|
|
18
|
+
return toNamePath(name);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var getOriginalValue = function getOriginalValue(_ref) {
|
|
22
|
+
var namePath = _ref.namePath,
|
|
23
|
+
originalName = _ref.originalName,
|
|
24
|
+
originalNames = _ref.originalNames,
|
|
25
|
+
originalValues = _ref.originalValues,
|
|
26
|
+
rowKeyPath = _ref.rowKeyPath,
|
|
27
|
+
form = _ref.form;
|
|
28
|
+
if (!originalValues) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (rowKeyPath) {
|
|
32
|
+
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
|
33
|
+
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
|
34
|
+
var rowValue = form.getFieldValue(rowValueNamePath);
|
|
35
|
+
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
|
36
|
+
if (!keyValue) return undefined;
|
|
37
|
+
var originalValueList = (0, _lodash.get)(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
|
38
|
+
var originalValueRow = originalValueList.find(function (item) {
|
|
39
|
+
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
40
|
+
});
|
|
41
|
+
var originalValue = (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
42
|
+
return (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
43
|
+
}) : (0, _lodash.get)(originalValueRow, originalName.slice(rowKeyPath.length - 1));
|
|
44
|
+
return originalValue;
|
|
45
|
+
}
|
|
46
|
+
return (originalNames === null || originalNames === void 0 ? void 0 : originalNames.length) ? originalNames.map(function (originalName) {
|
|
47
|
+
return (0, _lodash.get)(originalValues, originalName);
|
|
48
|
+
}) : (0, _lodash.get)(originalValues, originalName);
|
|
49
|
+
};
|
|
50
|
+
var useListChanged = exports.useListChanged = function useListChanged(params) {
|
|
51
|
+
var name = params.name,
|
|
52
|
+
names = params.names,
|
|
53
|
+
namesStr = params.namesStr,
|
|
54
|
+
_params$originalName = params.originalName,
|
|
55
|
+
originalName = _params$originalName === void 0 ? name : _params$originalName,
|
|
56
|
+
_params$originalNames = params.originalNames,
|
|
57
|
+
originalNames = _params$originalNames === void 0 ? names : _params$originalNames,
|
|
58
|
+
originalValues = params.originalValues,
|
|
59
|
+
form = params.form,
|
|
60
|
+
equalWith = params.equalWith,
|
|
61
|
+
rowKeyPath = params.rowKeyPath;
|
|
62
|
+
// let _form = form;
|
|
63
|
+
var namePath = toNamePath(namesStr || name);
|
|
64
|
+
var originalNamePath = toNamePath(originalName);
|
|
65
|
+
var originalNamePaths = originalNames && toNamePaths(originalNames);
|
|
66
|
+
var originalValue = getOriginalValue({
|
|
67
|
+
namePath: namePath,
|
|
68
|
+
originalName: originalNamePath,
|
|
69
|
+
originalNames: originalNamePaths,
|
|
70
|
+
originalValues: originalValues,
|
|
71
|
+
rowKeyPath: rowKeyPath,
|
|
72
|
+
form: form
|
|
73
|
+
});
|
|
74
|
+
var notWatch = !originalValues || originalValue === undefined;
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
// if (notWatch) _form = [];
|
|
77
|
+
var value = _antd.Form.useWatch(namePath, form);
|
|
78
|
+
if (notWatch) return [false];
|
|
79
|
+
var changed = (0, _contrastOriginal.contrastOriginal)({
|
|
80
|
+
value: value,
|
|
81
|
+
originalValue: originalValue,
|
|
82
|
+
form: form,
|
|
83
|
+
equalWith: equalWith
|
|
84
|
+
});
|
|
85
|
+
return [changed, originalValue];
|
|
86
|
+
};
|
|
@@ -19,6 +19,7 @@ var useRules = function useRules(props) {
|
|
|
19
19
|
names = props.names,
|
|
20
20
|
labelRequired = props.labelRequired,
|
|
21
21
|
type = props.type;
|
|
22
|
+
var _label = (0, _lodash.isString)(label) ? label : '';
|
|
22
23
|
// 根据 required 添加 rules, names 字段会添加数组的必填校验
|
|
23
24
|
var internalRule = (0, _react.useMemo)(function () {
|
|
24
25
|
var result = {
|
|
@@ -29,7 +30,7 @@ var useRules = function useRules(props) {
|
|
|
29
30
|
return 'required' in rule;
|
|
30
31
|
}));
|
|
31
32
|
if (!requiredRule) {
|
|
32
|
-
var message = isSelect ? "".concat(_locale.default.ProForm.selectPlaceHolder).concat(
|
|
33
|
+
var message = isSelect ? "".concat(_locale.default.ProForm.selectPlaceHolder).concat(_label) : "".concat(_locale.default.ProForm.inputPlaceholder).concat(_label);
|
|
33
34
|
var rule = {
|
|
34
35
|
required: required,
|
|
35
36
|
message: message
|
|
@@ -38,7 +39,7 @@ var useRules = function useRules(props) {
|
|
|
38
39
|
if (names === null || names === void 0 ? void 0 : names.length) {
|
|
39
40
|
rule.validator = function (_, value) {
|
|
40
41
|
if (!value || (0, _index.isNullArray)(value)) {
|
|
41
|
-
return Promise.reject(new Error("".concat(_locale.default.ProForm.inputPlaceholder).concat(
|
|
42
|
+
return Promise.reject(new Error("".concat(_locale.default.ProForm.inputPlaceholder).concat(_label)));
|
|
42
43
|
}
|
|
43
44
|
return Promise.resolve();
|
|
44
45
|
};
|
|
@@ -49,7 +50,7 @@ var useRules = function useRules(props) {
|
|
|
49
50
|
return result;
|
|
50
51
|
}, [rules, required]);
|
|
51
52
|
// type转换为内置rules
|
|
52
|
-
internalRule.rules = internalRule.rules && (0, _rulesCreator.rulesCreator)(internalRule.rules,
|
|
53
|
+
internalRule.rules = internalRule.rules && (0, _rulesCreator.rulesCreator)(internalRule.rules, _label, isSelect);
|
|
53
54
|
(0, _react.useEffect)(function () {
|
|
54
55
|
// 添加完整性校验
|
|
55
56
|
if (names && !(0, _lodash.isBoolean)(labelRequired) || type === 'Group' && Array.isArray(names) && required) {
|
|
@@ -57,7 +58,7 @@ var useRules = function useRules(props) {
|
|
|
57
58
|
validator: function validator(rules, value) {
|
|
58
59
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
|
59
60
|
if (Array.isArray(value) && !(0, _index.isNullArray)(value) && (0, _index.isNotFullArray)(value, names.length)) {
|
|
60
|
-
return Promise.reject(new Error("".concat(_locale.default.ProForm.completeText).concat(
|
|
61
|
+
return Promise.reject(new Error("".concat(_locale.default.ProForm.completeText).concat(_label)));
|
|
61
62
|
}
|
|
62
63
|
return Promise.resolve();
|
|
63
64
|
}
|
|
@@ -30,7 +30,8 @@ var FoldMenu = function FoldMenu(props) {
|
|
|
30
30
|
'pro-layout-menu-tooltip-nav-open': collapsed
|
|
31
31
|
});
|
|
32
32
|
var _useContext = (0, _react.useContext)(_index2.LayoutContext),
|
|
33
|
-
selectedPath = _useContext.selectedPath
|
|
33
|
+
selectedPath = _useContext.selectedPath,
|
|
34
|
+
onSelected = _useContext.onSelected;
|
|
34
35
|
return (0, _jsxRuntime.jsx)("div", {
|
|
35
36
|
className: "pro-layout-menu-fold",
|
|
36
37
|
style: (0, _objectSpread2.default)({}, style),
|
|
@@ -98,10 +99,17 @@ var FoldMenu = function FoldMenu(props) {
|
|
|
98
99
|
}, "".concat(id, "-").concat(name)) : !collapsed ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
99
100
|
placement: "right",
|
|
100
101
|
title: name,
|
|
101
|
-
children: (0, _jsxRuntime.jsx)(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
children: (0, _jsxRuntime.jsx)("span", {
|
|
103
|
+
onClick: function onClick() {
|
|
104
|
+
onSelected({
|
|
105
|
+
selectedPath: toPath
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
children: (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
|
|
109
|
+
to: toPath,
|
|
110
|
+
children: LiNode
|
|
111
|
+
}, toPath)
|
|
112
|
+
})
|
|
105
113
|
}, toPath) : (0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
|
|
106
114
|
to: toPath,
|
|
107
115
|
children: LiNode
|
|
@@ -11,14 +11,17 @@ var _OpenMenu = _interopRequireDefault(require("./OpenMenu"));
|
|
|
11
11
|
var _FoldMenu = _interopRequireDefault(require("./FoldMenu"));
|
|
12
12
|
// 折叠后菜单
|
|
13
13
|
var Menu = function Menu(props) {
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
var _ref = props || {},
|
|
15
|
+
headerHeight = _ref.headerHeight,
|
|
16
|
+
dataSource = _ref.dataSource,
|
|
17
|
+
iconfontUrl = _ref.iconfontUrl,
|
|
18
|
+
collapsed = _ref.collapsed,
|
|
19
|
+
notice = _ref.notice,
|
|
20
|
+
onToggle = _ref.onToggle,
|
|
21
|
+
pure = _ref.pure,
|
|
22
|
+
theme = _ref.theme,
|
|
23
|
+
sideMenuFooterRender = _ref.sideMenuFooterRender,
|
|
24
|
+
sideMenuHeaderRender = _ref.sideMenuHeaderRender;
|
|
22
25
|
var menus = [];
|
|
23
26
|
var menuCls = (0, _classnames.default)({
|
|
24
27
|
'pro-layout-menu': true,
|
|
@@ -37,7 +40,7 @@ var Menu = function Menu(props) {
|
|
|
37
40
|
style: {
|
|
38
41
|
top: notice ? 80 + headerHeight - 48 : headerHeight
|
|
39
42
|
},
|
|
40
|
-
children: [(0, _jsxRuntime.jsx)(_OpenMenu.default, {
|
|
43
|
+
children: [sideMenuHeaderRender, (0, _jsxRuntime.jsx)(_OpenMenu.default, {
|
|
41
44
|
dataSource: {
|
|
42
45
|
menus: menus,
|
|
43
46
|
iconfontUrl: iconfontUrl,
|
|
@@ -60,7 +63,7 @@ var Menu = function Menu(props) {
|
|
|
60
63
|
display: collapsed ? 'none' : 'block',
|
|
61
64
|
height: "calc(100vh - ".concat(headerHeight + (notice ? 32 : 0) + 48 || 0, "px)")
|
|
62
65
|
}
|
|
63
|
-
}), (0, _jsxRuntime.jsx)("div", {
|
|
66
|
+
}), sideMenuFooterRender || (0, _jsxRuntime.jsx)("div", {
|
|
64
67
|
className: "pro-layout-menu-collapsed",
|
|
65
68
|
onClick: onToggle,
|
|
66
69
|
children: (0, _jsxRuntime.jsx)("div", {
|
|
@@ -36,6 +36,8 @@ export interface ProLayoutProps {
|
|
|
36
36
|
rightContentRender?: ReactNode;
|
|
37
37
|
headerContentRender?: ReactNode;
|
|
38
38
|
headerTitleRender?: ReactNode;
|
|
39
|
+
sideMenuHeaderRender?: ReactNode;
|
|
40
|
+
sideMenuFooterRender?: ReactNode;
|
|
39
41
|
headerNotice?: ReactNode | string;
|
|
40
42
|
notice?: ReactNode | string;
|
|
41
43
|
title?: string;
|
package/lib/ProStep/index.js
CHANGED
|
@@ -170,7 +170,7 @@ var ProStep = function ProStep(_ref) {
|
|
|
170
170
|
|
|
171
171
|
observer.observe(targetElement, config);
|
|
172
172
|
};
|
|
173
|
-
(0,
|
|
173
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
174
174
|
var errorModuleKeys = Object.keys(errorCollection).reverse();
|
|
175
175
|
if (errorModuleKeys === null || errorModuleKeys === void 0 ? void 0 : errorModuleKeys.length) {
|
|
176
176
|
var _dataSource$find;
|
|
@@ -64,13 +64,14 @@
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.@{ant-prefix}-table-body {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
.@{ant-prefix}-table-tbody .@{ant-prefix}-table-row:nth-child(odd).new-cell {
|
|
68
|
+
background: #d2fff4 !important;
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
td {
|
|
71
|
+
background: #d2fff4 !important;
|
|
72
|
+
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
74
75
|
|
|
75
76
|
.@{ant-prefix}-table-cell .varied-cell {
|
|
76
77
|
margin-left: -8px;
|
package/lib/ProTooltip/index.js
CHANGED
|
@@ -143,10 +143,23 @@ var ProTooltip = function ProTooltip(props) {
|
|
|
143
143
|
};
|
|
144
144
|
(0, _react.useEffect)(function () {
|
|
145
145
|
if (isResponsiveWidth && parentElement) {
|
|
146
|
+
var _contentDom$style$wid;
|
|
146
147
|
var cWidth = parentElement.clientWidth - 32;
|
|
147
148
|
var contentDom = childRef.current;
|
|
149
|
+
var flag = false;
|
|
150
|
+
var styleWidth = Number((_contentDom$style$wid = contentDom.style.width) === null || _contentDom$style$wid === void 0 ? void 0 : _contentDom$style$wid.replace('px', ''));
|
|
151
|
+
if (contentDom.offsetWidth < styleWidth) {
|
|
152
|
+
flag = contentDom.scrollWidth > styleWidth;
|
|
153
|
+
} else if (contentDom.offsetWidth === styleWidth && contentDom.scrollWidth === styleWidth && contentDom.clientWidth === styleWidth) {
|
|
154
|
+
flag = false;
|
|
155
|
+
} else {
|
|
156
|
+
flag = contentDom.scrollWidth > contentDom.clientWidth;
|
|
157
|
+
}
|
|
158
|
+
if (parentElement.scrollWidth > parentElement.clientWidth) {
|
|
159
|
+
flag = true;
|
|
160
|
+
}
|
|
148
161
|
setState({
|
|
149
|
-
isShowToolTip:
|
|
162
|
+
isShowToolTip: flag,
|
|
150
163
|
localWidth: cWidth
|
|
151
164
|
});
|
|
152
165
|
}
|
|
@@ -20,6 +20,7 @@ var _view = _interopRequireDefault(require("../../assets/view.svg"));
|
|
|
20
20
|
function Trigger(props) {
|
|
21
21
|
var _locale$ProTreeModal2, _locale$ProTreeModal3;
|
|
22
22
|
var value = props.value,
|
|
23
|
+
label = props.label,
|
|
23
24
|
disabled = props.disabled,
|
|
24
25
|
isView = props.isView,
|
|
25
26
|
triggerStyle = props.triggerStyle,
|
|
@@ -37,7 +38,7 @@ function Trigger(props) {
|
|
|
37
38
|
state = _useSetState2[0],
|
|
38
39
|
setState = _useSetState2[1];
|
|
39
40
|
(0, _react.useEffect)(function () {
|
|
40
|
-
if (
|
|
41
|
+
if (allValue === value && appoint) {
|
|
41
42
|
setState({
|
|
42
43
|
mode: 'all'
|
|
43
44
|
});
|
|
@@ -54,7 +55,9 @@ function Trigger(props) {
|
|
|
54
55
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
55
56
|
className: "pro-tree-modal-isView",
|
|
56
57
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
57
|
-
children: checkedValues.length === 0 ? '-' :
|
|
58
|
+
children: checkedValues.length === 0 ? '-' : state.mode === 'all' ? (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : _locale.default.ProTreeModal.checkAll1, {
|
|
59
|
+
all: label
|
|
60
|
+
}) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal = _locale.default.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.checkNumber, {
|
|
58
61
|
num: checkedValues.length
|
|
59
62
|
})
|
|
60
63
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
@@ -81,16 +84,22 @@ function Trigger(props) {
|
|
|
81
84
|
if (appoint) {
|
|
82
85
|
return (0, _jsxRuntime.jsxs)(_antd.Space.Compact, {
|
|
83
86
|
block: true,
|
|
87
|
+
style: (0, _objectSpread2.default)({}, triggerStyle),
|
|
84
88
|
children: [(0, _jsxRuntime.jsxs)(_antd.Select, {
|
|
89
|
+
style: {
|
|
90
|
+
width: 'auto'
|
|
91
|
+
},
|
|
92
|
+
disabled: disabled,
|
|
93
|
+
className: (0, _classnames.default)(disabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
|
|
85
94
|
defaultValue: "appoint",
|
|
86
95
|
value: state.mode,
|
|
87
96
|
onChange: onAppointChange,
|
|
88
97
|
children: [(0, _jsxRuntime.jsx)(_antd.Select.Option, {
|
|
89
98
|
value: "all",
|
|
90
|
-
children:
|
|
99
|
+
children: _locale.default === null || _locale.default === void 0 ? void 0 : _locale.default.ProTreeModal.specifyMode[0]
|
|
91
100
|
}), (0, _jsxRuntime.jsx)(_antd.Select.Option, {
|
|
92
101
|
value: "appoint",
|
|
93
|
-
children:
|
|
102
|
+
children: _locale.default === null || _locale.default === void 0 ? void 0 : _locale.default.ProTreeModal.specifyMode[1]
|
|
94
103
|
})]
|
|
95
104
|
}), props.children]
|
|
96
105
|
});
|
|
@@ -101,10 +110,12 @@ function Trigger(props) {
|
|
|
101
110
|
children: (0, _jsxRuntime.jsx)(_antd.Input, {
|
|
102
111
|
className: (0, _classnames.default)(disabled ? 'trigger-no-hover' : '', appoint ? 'pro-tree-modal-input-appoint' : ''),
|
|
103
112
|
onClick: handleClick,
|
|
104
|
-
value: checkedValues.length === 0 ? null :
|
|
113
|
+
value: checkedValues.length === 0 ? null : state.mode === 'all' ? (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : _locale.default.ProTreeModal.checkAll1, {
|
|
114
|
+
all: label
|
|
115
|
+
}) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal2 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal2 === void 0 ? void 0 : _locale$ProTreeModal2.checkNumber, {
|
|
105
116
|
num: checkedValues.length
|
|
106
117
|
}),
|
|
107
|
-
addonAfter: (0, _jsxRuntime.jsxs)("div", {
|
|
118
|
+
addonAfter: state.mode === 'all' ? null : (0, _jsxRuntime.jsxs)("div", {
|
|
108
119
|
className: "pro-enum-input-addonAfter",
|
|
109
120
|
children: [checkedValues.length > 0 && !disabled && (0, _jsxRuntime.jsx)("span", {
|
|
110
121
|
className: "close-icon",
|
|
@@ -118,7 +129,7 @@ function Trigger(props) {
|
|
|
118
129
|
})]
|
|
119
130
|
}),
|
|
120
131
|
placeholder: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProTreeModal3 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal3 === void 0 ? void 0 : _locale$ProTreeModal3.select,
|
|
121
|
-
disabled: disabled ||
|
|
132
|
+
disabled: disabled || state.mode === 'all',
|
|
122
133
|
style: (0, _objectSpread2.default)({}, triggerStyle)
|
|
123
134
|
})
|
|
124
135
|
});
|