@zat-design/sisyphus-react 3.4.2 → 3.4.3
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 +286 -240
- package/dist/less.esm.css +5022 -0
- package/dist/less.esm.js +3 -0
- package/es/ProConfigProvider/index.js +2 -1
- package/es/ProEditLabel/style/index.less +1 -1
- package/es/ProEditTable/components/RenderField/index.js +28 -20
- package/es/ProEditTable/index.js +3 -3
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +1 -1
- package/es/ProEditTable/utils/config.js +5 -5
- package/es/ProEditTable/utils/index.js +67 -30
- package/es/ProEditTable/utils/tools.js +3 -1
- package/es/ProEnum/components/Group.d.ts +2 -0
- package/es/ProEnum/components/Group.js +26 -8
- package/es/ProEnum/index.js +4 -3
- package/es/ProEnum/style/index.less +12 -3
- package/es/ProForm/components/base/DatePicker/index.js +2 -2
- package/es/ProForm/components/combination/FormList/index.js +6 -3
- package/es/ProForm/components/combination/FormList/utils.d.ts +2 -1
- package/es/ProForm/components/combination/FormList/utils.js +5 -3
- package/es/ProForm/components/combination/Group/index.js +28 -15
- package/es/ProForm/components/combination/Group/propsType.d.ts +6 -0
- package/es/ProForm/components/combination/Group/style/index.less +4 -4
- package/es/ProForm/components/combination/Group/utils.d.ts +2 -0
- package/es/ProForm/components/combination/Group/utils.js +10 -0
- package/es/ProForm/components/combination/ProTimeLimit/index.js +8 -2
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/es/ProForm/components/index.d.ts +0 -1
- package/es/ProForm/components/index.js +1 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +21 -13
- package/es/ProForm/components/render/RenderFields.d.ts +2 -1
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/components/render/propsType.d.ts +1 -4
- package/es/ProForm/index.js +8 -6
- package/es/ProForm/propsType.d.ts +5 -1
- package/es/ProForm/style/index.less +17 -13
- package/es/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
- package/es/ProForm/utils/diffOriginal.js +61 -0
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +1 -1
- package/es/ProForm/utils/transformNames.d.ts +1 -1
- package/es/ProForm/utils/transformNames.js +11 -4
- package/es/ProForm/utils/transformValue.js +2 -2
- package/es/ProForm/utils/useChanged.js +4 -3
- package/es/ProForm/utils/useListChanged.d.ts +1 -1
- package/es/ProForm/utils/useListChanged.js +5 -3
- package/es/ProForm/utils/valueType.d.ts +10 -5
- package/es/ProForm/utils/valueType.js +20 -10
- package/es/ProIcon/config/index.d.ts +2 -1
- package/es/ProIcon/config/index.js +191 -133
- package/es/ProIcon/index.d.ts +0 -1
- package/es/ProIcon/index.js +21 -36
- package/es/ProIcon/propsTypes.d.ts +2 -1
- package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/es/ProLayout/components/Layout/Menu/style/index.less +52 -56
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
- package/es/ProLayout/components/ProCollapse/index.js +22 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +29 -11
- package/es/ProLayout/components/ProFooter/index.js +1 -1
- package/es/ProLayout/components/ProFooter/style/index.less +1 -1
- package/es/ProLayout/components/ProHeader/style/index.less +6 -5
- package/es/ProLayout/style/index.less +176 -88
- package/es/ProStep/components/Item/index.js +2 -1
- package/es/ProStep/style/index.less +71 -70
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/es/ProTable/components/RenderColumn/index.js +3 -3
- package/es/ProTable/propsType.d.ts +1 -1
- package/es/ProTable/style/index.less +2 -2
- package/es/ProTable/utils.js +9 -9
- package/es/ProTabs/style/index.less +3 -1
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +2 -2
- package/es/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/es/ProThemeTools/index.js +21 -28
- package/es/ProThemeTools/propsType.d.ts +1 -1
- package/es/ProThemeTools/style/index.less +25 -8
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +7 -11
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.d.ts +1 -1
- package/es/ProTree/index.js +1 -1
- package/es/ProTreeModal/style/index.less +2 -2
- package/es/ProUpload/style/fileItem.less +2 -2
- package/es/ProUpload/style/index.less +2 -2
- package/es/assets/catalog.svg +30 -1
- package/es/assets/fold.svg +27 -0
- package/es/assets/setting.svg +14 -0
- package/es/locale/en_US.d.ts +3 -0
- package/es/locale/en_US.js +3 -0
- package/es/locale/zh_CN.d.ts +3 -0
- package/es/locale/zh_CN.js +3 -0
- package/es/style/components.less +0 -1
- package/es/style/less.less +2 -0
- package/es/style/theme/antd.less +1 -2
- package/es/style/theme/index.less +2 -2
- package/es/style/theme/tokens.less +2 -2
- package/es/tokens.js +2 -2
- package/lib/ProConfigProvider/index.js +2 -1
- package/lib/ProEditLabel/style/index.less +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +27 -19
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +1 -1
- package/lib/ProEditTable/utils/config.js +5 -5
- package/lib/ProEditTable/utils/index.js +67 -30
- package/lib/ProEditTable/utils/tools.js +3 -1
- package/lib/ProEnum/components/Group.d.ts +2 -0
- package/lib/ProEnum/components/Group.js +26 -8
- package/lib/ProEnum/index.js +4 -3
- package/lib/ProEnum/style/index.less +12 -3
- package/lib/ProForm/components/base/DatePicker/index.js +1 -1
- package/lib/ProForm/components/combination/FormList/index.js +6 -3
- package/lib/ProForm/components/combination/FormList/utils.d.ts +2 -1
- package/lib/ProForm/components/combination/FormList/utils.js +5 -3
- package/lib/ProForm/components/combination/Group/index.js +25 -12
- package/lib/ProForm/components/combination/Group/propsType.d.ts +6 -0
- package/lib/ProForm/components/combination/Group/style/index.less +4 -4
- package/lib/ProForm/components/combination/Group/utils.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/utils.js +11 -1
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +7 -1
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/lib/ProForm/components/index.d.ts +0 -1
- package/lib/ProForm/components/index.js +0 -7
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +21 -13
- package/lib/ProForm/components/render/RenderFields.d.ts +2 -1
- package/lib/ProForm/components/render/RenderFields.js +7 -3
- package/lib/ProForm/components/render/propsType.d.ts +1 -4
- package/lib/ProForm/index.js +7 -5
- package/lib/ProForm/propsType.d.ts +5 -1
- package/lib/ProForm/style/index.less +17 -13
- package/lib/ProForm/utils/{contrastOriginal.d.ts → diffOriginal.d.ts} +2 -1
- package/lib/ProForm/utils/diffOriginal.js +68 -0
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +2 -2
- package/lib/ProForm/utils/transformNames.d.ts +1 -1
- package/lib/ProForm/utils/transformNames.js +10 -3
- package/lib/ProForm/utils/transformValue.js +1 -1
- package/lib/ProForm/utils/useChanged.js +4 -3
- package/lib/ProForm/utils/useListChanged.d.ts +1 -1
- package/lib/ProForm/utils/useListChanged.js +5 -3
- package/lib/ProForm/utils/valueType.d.ts +10 -5
- package/lib/ProForm/utils/valueType.js +20 -10
- package/lib/ProIcon/config/index.d.ts +2 -1
- package/lib/ProIcon/config/index.js +191 -133
- package/lib/ProIcon/index.d.ts +0 -1
- package/lib/ProIcon/index.js +21 -37
- package/lib/ProIcon/propsTypes.d.ts +2 -1
- package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +58 -55
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/lib/ProLayout/components/Layout/Menu/style/index.less +52 -56
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -0
- package/lib/ProLayout/components/ProCollapse/index.js +20 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +29 -11
- package/lib/ProLayout/components/ProFooter/index.js +1 -1
- package/lib/ProLayout/components/ProFooter/style/index.less +1 -1
- package/lib/ProLayout/components/ProHeader/style/index.less +6 -5
- package/lib/ProLayout/style/index.less +176 -88
- package/lib/ProStep/components/Item/index.js +2 -1
- package/lib/ProStep/style/index.less +71 -70
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -1
- package/lib/ProTable/components/RenderColumn/index.js +3 -3
- package/lib/ProTable/propsType.d.ts +1 -1
- package/lib/ProTable/style/index.less +2 -2
- package/lib/ProTable/utils.js +9 -9
- package/lib/ProTabs/style/index.less +3 -1
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +2 -2
- package/lib/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/lib/ProThemeTools/index.js +19 -27
- package/lib/ProThemeTools/propsType.d.ts +1 -1
- package/lib/ProThemeTools/style/index.less +25 -8
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +7 -11
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.d.ts +1 -1
- package/lib/ProTree/index.js +1 -1
- package/lib/ProTreeModal/style/index.less +2 -2
- package/lib/ProUpload/style/fileItem.less +2 -2
- package/lib/ProUpload/style/index.less +2 -2
- package/lib/assets/catalog.svg +30 -1
- package/lib/assets/fold.svg +27 -0
- package/lib/assets/setting.svg +14 -0
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.js +3 -0
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.js +3 -0
- package/lib/style/components.less +0 -1
- package/lib/style/less.less +2 -0
- package/lib/style/theme/antd.less +1 -2
- package/lib/style/theme/index.less +2 -2
- package/lib/style/theme/tokens.less +2 -2
- package/lib/tokens.js +2 -2
- package/package.json +1 -1
- package/es/ProForm/utils/contrastOriginal.js +0 -24
- package/es/ProIcon/symbolIcon.js +0 -43
- package/lib/ProForm/utils/contrastOriginal.js +0 -30
- package/lib/ProIcon/symbolIcon.js +0 -45
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +0 -0
package/dist/less.esm.js
ADDED
|
@@ -17,7 +17,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
18
18
|
import React, { useCallback, useEffect } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import { cloneDeep, isEqual, debounce, omit, isFunction
|
|
20
|
+
import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
23
|
import { getNamePath, difference } from '../../utils/tools';
|
|
@@ -28,9 +28,8 @@ import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
|
|
|
28
28
|
import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
29
29
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
30
|
import { isSelect } from '../../../ProForm/utils';
|
|
31
|
-
import locale from '../../../locale';
|
|
32
31
|
var RenderField = function RenderField(_ref) {
|
|
33
|
-
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names,
|
|
32
|
+
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4, _componentProps;
|
|
34
33
|
var value = _ref.text,
|
|
35
34
|
record = _ref.record,
|
|
36
35
|
index = _ref.index,
|
|
@@ -73,7 +72,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
73
72
|
virtualKey = config.virtualKey,
|
|
74
73
|
viewEmpty = config.viewEmpty,
|
|
75
74
|
originalValues = config.originalValues,
|
|
76
|
-
|
|
75
|
+
originalDiffTip = config.originalDiffTip;
|
|
77
76
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
78
77
|
var _rules = rules || [];
|
|
79
78
|
var _required = required;
|
|
@@ -141,7 +140,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
141
140
|
var formItemChildProps = _objectSpread({}, _fieldProps);
|
|
142
141
|
// 允许formItem的属性放在column最外层
|
|
143
142
|
var _formItemProps = _objectSpread(_objectSpread({}, resetProps), internalRule);
|
|
144
|
-
if (['Switch', '
|
|
143
|
+
if (['Switch', 'SwitchCheckbox'].includes(type)) {
|
|
145
144
|
_formItemProps.valuePropName = 'checked';
|
|
146
145
|
valueType = 'switch';
|
|
147
146
|
}
|
|
@@ -211,7 +210,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
211
210
|
if (valueType) {
|
|
212
211
|
transform = valueTypeTransform();
|
|
213
212
|
}
|
|
214
|
-
return transformNames(_objectSpread(_objectSpread({}, _formItemProps), transform), form, names, namesStr);
|
|
213
|
+
return transformNames(_objectSpread(_objectSpread({}, _formItemProps), transform), form, names, namesStr, type);
|
|
215
214
|
};
|
|
216
215
|
if (!_editRender && typeof type === 'string') {
|
|
217
216
|
var _componentMap$type;
|
|
@@ -241,8 +240,6 @@ var RenderField = function RenderField(_ref) {
|
|
|
241
240
|
TargetComponent = viewRender;
|
|
242
241
|
}
|
|
243
242
|
}
|
|
244
|
-
var defaultPlaceholder = ['Select', 'EnumSelect', 'DatePicker', 'RangePicker', 'Cascader', 'ProSelect', 'ProEnum', 'ProTimeLimit'].includes(type) ? "".concat(locale.ProEditTable.select).concat(isString(label) ? label || title : '') : "".concat(locale.ProEditTable.enter).concat(isString(label) ? label || title : '');
|
|
245
|
-
var _placeholder = (_formItemChildProps$p = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.placeholder) !== null && _formItemChildProps$p !== void 0 ? _formItemChildProps$p : defaultPlaceholder;
|
|
246
243
|
var onChange = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onChange;
|
|
247
244
|
var onFieldChange = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onFieldChange;
|
|
248
245
|
var onBlur = formItemChildProps === null || formItemChildProps === void 0 ? void 0 : formItemChildProps.onBlur;
|
|
@@ -303,7 +300,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
303
300
|
}
|
|
304
301
|
_args = [].concat(args);
|
|
305
302
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
306
|
-
row = form.getFieldValue(rowPath);
|
|
303
|
+
row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
|
|
307
304
|
orgRow = cloneDeep(row);
|
|
308
305
|
if (!onFieldChange) {
|
|
309
306
|
_context.next = 18;
|
|
@@ -348,14 +345,16 @@ var RenderField = function RenderField(_ref) {
|
|
|
348
345
|
return onChange.apply(void 0, _toConsumableArray(_args));
|
|
349
346
|
case 27:
|
|
350
347
|
// 判断属性是否变动
|
|
351
|
-
form.setFieldValue(rowPath, row);
|
|
348
|
+
type !== 'Group' && form.setFieldValue(rowPath, row);
|
|
352
349
|
if (!isEqual(orgRow, row)) {
|
|
353
350
|
diff = difference(row, orgRow) || {};
|
|
354
351
|
validateFieldKeys = (_Object$keys = Object.keys(diff)) === null || _Object$keys === void 0 ? void 0 : (_Object$keys$map = _Object$keys.map) === null || _Object$keys$map === void 0 ? void 0 : _Object$keys$map.call(_Object$keys, function (key) {
|
|
355
352
|
return [].concat(_toConsumableArray(rowPath), [key]);
|
|
356
353
|
});
|
|
357
354
|
if (validateFieldKeys === null || validateFieldKeys === void 0 ? void 0 : validateFieldKeys.length) {
|
|
358
|
-
|
|
355
|
+
setTimeout(function () {
|
|
356
|
+
form.validateFields(validateFieldKeys);
|
|
357
|
+
}, 100);
|
|
359
358
|
}
|
|
360
359
|
}
|
|
361
360
|
setState({
|
|
@@ -468,12 +467,13 @@ var RenderField = function RenderField(_ref) {
|
|
|
468
467
|
originalValue = _useListChanged2[1];
|
|
469
468
|
var componentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
470
469
|
form: form,
|
|
471
|
-
name: cellName
|
|
472
|
-
placeholder: _placeholder
|
|
470
|
+
name: cellName
|
|
473
471
|
}, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
|
|
472
|
+
namePath: [].concat(_toConsumableArray(namePath), [index]),
|
|
474
473
|
disabled: _disabled,
|
|
475
474
|
onChange: _onchange,
|
|
476
475
|
onBlur: _onblur,
|
|
476
|
+
index: index,
|
|
477
477
|
otherProps: {
|
|
478
478
|
form: form,
|
|
479
479
|
names: names,
|
|
@@ -483,11 +483,16 @@ var RenderField = function RenderField(_ref) {
|
|
|
483
483
|
isView: isView
|
|
484
484
|
}
|
|
485
485
|
});
|
|
486
|
+
if (type === 'Group') {
|
|
487
|
+
componentProps.onFieldChange = _onchange;
|
|
488
|
+
} else {
|
|
489
|
+
componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
|
|
490
|
+
}
|
|
486
491
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
487
492
|
if (isCell) {
|
|
488
493
|
record["".concat(dataIndex, "-Disabled")] = _disabled;
|
|
489
494
|
}
|
|
490
|
-
if (['Switch', '
|
|
495
|
+
if (['Switch', 'SwitchCheckbox'].includes(type)) {
|
|
491
496
|
_formItemProps.valuePropName = 'checked';
|
|
492
497
|
}
|
|
493
498
|
useEffect(function () {
|
|
@@ -507,12 +512,12 @@ var RenderField = function RenderField(_ref) {
|
|
|
507
512
|
delete _formItemProps.rules;
|
|
508
513
|
}
|
|
509
514
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
510
|
-
var originalTitle =
|
|
511
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({},
|
|
515
|
+
var originalTitle = originalDiffTip ? _jsxs(_Space, {
|
|
516
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
512
517
|
isView: true,
|
|
513
518
|
value: originalValue,
|
|
514
519
|
checked: type === 'Switch' ? originalValue : undefined
|
|
515
|
-
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({},
|
|
520
|
+
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
516
521
|
isView: true,
|
|
517
522
|
value: originalValue,
|
|
518
523
|
checked: type === 'Switch' ? originalValue : undefined
|
|
@@ -523,15 +528,18 @@ var RenderField = function RenderField(_ref) {
|
|
|
523
528
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
524
529
|
className: _className,
|
|
525
530
|
name: cellName,
|
|
526
|
-
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent,
|
|
531
|
+
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
527
532
|
})) : _jsx(Container, {
|
|
528
533
|
viewEmpty: viewEmpty
|
|
529
534
|
});
|
|
530
535
|
return _jsx(FieldProvider, {
|
|
531
|
-
value: componentProps === null ||
|
|
532
|
-
children: !
|
|
536
|
+
value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
|
|
537
|
+
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
|
|
533
538
|
title: originalTitle,
|
|
534
539
|
open: changed ? undefined : false,
|
|
540
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
541
|
+
return target.parentElement;
|
|
542
|
+
},
|
|
535
543
|
children: FormItem
|
|
536
544
|
})
|
|
537
545
|
});
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import _ConfigProvider from "antd/es/config-provider";
|
|
|
10
10
|
import "antd/es/form/style";
|
|
11
11
|
import _Form from "antd/es/form";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
|
-
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "
|
|
13
|
+
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "otherProps", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey"];
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
16
16
|
import { get, isArray } from 'lodash';
|
|
@@ -49,7 +49,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
49
49
|
headerRender = _ref.headerRender,
|
|
50
50
|
pagination = _ref.pagination,
|
|
51
51
|
originalValues = _ref.originalValues,
|
|
52
|
-
|
|
52
|
+
originalDiffTip = _ref.originalDiffTip,
|
|
53
53
|
rowKey = _ref.rowKey,
|
|
54
54
|
resetProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
55
|
// 上下文form
|
|
@@ -151,7 +151,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
151
151
|
tableLength: value === null || value === void 0 ? void 0 : value.length,
|
|
152
152
|
page: page,
|
|
153
153
|
originalValues: originalValues,
|
|
154
|
-
|
|
154
|
+
originalDiffTip: originalDiffTip,
|
|
155
155
|
prefixCls: prefixCls
|
|
156
156
|
};
|
|
157
157
|
// 编辑行设置下样式
|
|
@@ -130,7 +130,7 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
|
|
|
130
130
|
* @description 原始数据源,是否tooltip显示
|
|
131
131
|
* @default -
|
|
132
132
|
*/
|
|
133
|
-
|
|
133
|
+
originalDiffTip?: boolean;
|
|
134
134
|
/**
|
|
135
135
|
* @description 可编辑表格的类型,单行、多行、单元格编辑
|
|
136
136
|
* @default false
|
|
@@ -190,11 +190,6 @@ export var actions = {
|
|
|
190
190
|
addData.isEditing = true;
|
|
191
191
|
}
|
|
192
192
|
insertType === 'before' ? nextData.unshift(addData) : nextData.push(addData);
|
|
193
|
-
form.setFieldValue(name, nextData);
|
|
194
|
-
(_tableRef$current$que = tableRef.current.querySelector(".".concat(prefixCls, "-table-body"))) === null || _tableRef$current$que === void 0 ? void 0 : (_tableRef$current$que2 = _tableRef$current$que.scrollTo) === null || _tableRef$current$que2 === void 0 ? void 0 : _tableRef$current$que2.call(_tableRef$current$que, {
|
|
195
|
-
top: 10000,
|
|
196
|
-
behavior: 'smooth'
|
|
197
|
-
});
|
|
198
193
|
// 当单选情况下,存储正在编辑值
|
|
199
194
|
if (virtualKey) {
|
|
200
195
|
nextEditingKeys = _toConsumableArray(editingKeys); // 开启编辑状态
|
|
@@ -204,6 +199,11 @@ export var actions = {
|
|
|
204
199
|
editingKeys: nextEditingKeys
|
|
205
200
|
});
|
|
206
201
|
}
|
|
202
|
+
form.setFieldValue(name, nextData);
|
|
203
|
+
(_tableRef$current$que = tableRef.current.querySelector(".".concat(prefixCls, "-table-body"))) === null || _tableRef$current$que === void 0 ? void 0 : (_tableRef$current$que2 = _tableRef$current$que.scrollTo) === null || _tableRef$current$que2 === void 0 ? void 0 : _tableRef$current$que2.call(_tableRef$current$que, {
|
|
204
|
+
top: insertType === 'before' ? -10000 : 10000,
|
|
205
|
+
behavior: 'smooth'
|
|
206
|
+
});
|
|
207
207
|
_context2.next = 14;
|
|
208
208
|
return form.validateFields([name]);
|
|
209
209
|
case 14:
|
|
@@ -85,40 +85,77 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
85
85
|
index = tools.calc(firstIndex, '+', index);
|
|
86
86
|
rowName = [].concat(_toConsumableArray(virtualRowName), [index]);
|
|
87
87
|
if (!(type === 'save')) {
|
|
88
|
-
_context.next =
|
|
88
|
+
_context.next = 12;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
|
-
_context.
|
|
91
|
+
_context.prev = 3;
|
|
92
|
+
_context.next = 6;
|
|
92
93
|
return customValidate(validateKeys, form, rowName);
|
|
93
|
-
case
|
|
94
|
+
case 6:
|
|
95
|
+
_context.next = 12;
|
|
96
|
+
break;
|
|
97
|
+
case 8:
|
|
98
|
+
_context.prev = 8;
|
|
99
|
+
_context.t0 = _context["catch"](3);
|
|
100
|
+
setTimeout(function () {
|
|
101
|
+
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
102
|
+
if (errorDom) {
|
|
103
|
+
var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
|
|
104
|
+
var tableCell = errorDom.closest('.ant-table-cell');
|
|
105
|
+
if (tableBody && tableCell) {
|
|
106
|
+
var previousSibling = tableCell.previousElementSibling;
|
|
107
|
+
var childOffsetLeft = 0;
|
|
108
|
+
var childFixedLeft = 0;
|
|
109
|
+
while (previousSibling) {
|
|
110
|
+
if (previousSibling.nodeType === 1) {
|
|
111
|
+
var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
|
|
112
|
+
var _ref2 = previousSibling.getBoundingClientRect() || {},
|
|
113
|
+
_ref2$width = _ref2.width,
|
|
114
|
+
width = _ref2$width === void 0 ? 0 : _ref2$width;
|
|
115
|
+
childOffsetLeft += width;
|
|
116
|
+
if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
|
|
117
|
+
childFixedLeft += width;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
previousSibling = previousSibling.previousElementSibling;
|
|
121
|
+
}
|
|
122
|
+
tableBody.scrollTo({
|
|
123
|
+
left: childOffsetLeft - childFixedLeft,
|
|
124
|
+
behavior: 'smooth'
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, 0);
|
|
129
|
+
return _context.abrupt("return", Promise.reject(_context.t0));
|
|
130
|
+
case 12:
|
|
94
131
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
|
95
132
|
_record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
|
|
96
133
|
onEvent = onClick || onHandle;
|
|
97
|
-
_context.next =
|
|
134
|
+
_context.next = 16;
|
|
98
135
|
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
|
|
99
136
|
form: form,
|
|
100
137
|
namePath: virtualRowName
|
|
101
138
|
});
|
|
102
|
-
case
|
|
103
|
-
_context.
|
|
104
|
-
_context.
|
|
105
|
-
if (!_context.
|
|
106
|
-
_context.next =
|
|
139
|
+
case 16:
|
|
140
|
+
_context.t2 = _yield$onEvent = _context.sent;
|
|
141
|
+
_context.t1 = _context.t2 !== null;
|
|
142
|
+
if (!_context.t1) {
|
|
143
|
+
_context.next = 20;
|
|
107
144
|
break;
|
|
108
145
|
}
|
|
109
|
-
_context.
|
|
110
|
-
case
|
|
111
|
-
if (!_context.
|
|
112
|
-
_context.next =
|
|
146
|
+
_context.t1 = _yield$onEvent !== void 0;
|
|
147
|
+
case 20:
|
|
148
|
+
if (!_context.t1) {
|
|
149
|
+
_context.next = 24;
|
|
113
150
|
break;
|
|
114
151
|
}
|
|
115
|
-
_context.
|
|
116
|
-
_context.next =
|
|
152
|
+
_context.t3 = _yield$onEvent;
|
|
153
|
+
_context.next = 25;
|
|
117
154
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context.
|
|
120
|
-
case
|
|
121
|
-
result = _context.
|
|
155
|
+
case 24:
|
|
156
|
+
_context.t3 = true;
|
|
157
|
+
case 25:
|
|
158
|
+
result = _context.t3;
|
|
122
159
|
if (result && type !== 'custom') {
|
|
123
160
|
actions[type](_objectSpread(_objectSpread({}, config), {}, {
|
|
124
161
|
rowName: [].concat(_toConsumableArray(name), [index]),
|
|
@@ -128,11 +165,11 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
128
165
|
validateKeys: validateKeys
|
|
129
166
|
}));
|
|
130
167
|
}
|
|
131
|
-
case
|
|
168
|
+
case 27:
|
|
132
169
|
case "end":
|
|
133
170
|
return _context.stop();
|
|
134
171
|
}
|
|
135
|
-
}, _callee);
|
|
172
|
+
}, _callee, null, [[3, 8]]);
|
|
136
173
|
}));
|
|
137
174
|
return function (_x, _x2) {
|
|
138
175
|
return _ref.apply(this, arguments);
|
|
@@ -210,10 +247,10 @@ export var transformColumns = function transformColumns() {
|
|
|
210
247
|
if (typeof columnTitle === 'string') {
|
|
211
248
|
item.originTitle = columnTitle;
|
|
212
249
|
if (tooltip) {
|
|
213
|
-
var
|
|
214
|
-
tooltipTitle =
|
|
215
|
-
icon =
|
|
216
|
-
resetProps = _objectWithoutProperties(
|
|
250
|
+
var _ref3 = tooltip || {},
|
|
251
|
+
tooltipTitle = _ref3.title,
|
|
252
|
+
icon = _ref3.icon,
|
|
253
|
+
resetProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
217
254
|
item.title = _jsxs("span", {
|
|
218
255
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
|
219
256
|
children: [before, columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
@@ -280,7 +317,7 @@ export var transformColumns = function transformColumns() {
|
|
|
280
317
|
(_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
|
|
281
318
|
}
|
|
282
319
|
var _render = function _render(text, record, index) {
|
|
283
|
-
var isEditing = !virtualKey || editingKeys.includes(record.rowKey);
|
|
320
|
+
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
|
284
321
|
var namePath = isArray(name) ? name : [name];
|
|
285
322
|
if (virtualKey && editingKeys.includes(record.rowKey)) {
|
|
286
323
|
namePath = getNamePath(name, virtualKey);
|
|
@@ -365,13 +402,13 @@ export var transformColumns = function transformColumns() {
|
|
|
365
402
|
// cacheMap 用来存储缓存值,若有值后不再请求
|
|
366
403
|
if (JSON.stringify(cacheMap.current) === '{}') {
|
|
367
404
|
Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
|
|
368
|
-
var
|
|
369
|
-
var _item, key, value,
|
|
405
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
|
|
406
|
+
var _item, key, value, _ref5, service, option;
|
|
370
407
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
371
408
|
while (1) switch (_context2.prev = _context2.next) {
|
|
372
409
|
case 0:
|
|
373
410
|
_item = _slicedToArray(item, 2), key = _item[0], value = _item[1];
|
|
374
|
-
|
|
411
|
+
_ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
|
|
375
412
|
if (!service) {
|
|
376
413
|
_context2.next = 8;
|
|
377
414
|
break;
|
|
@@ -391,7 +428,7 @@ export var transformColumns = function transformColumns() {
|
|
|
391
428
|
}, _callee2);
|
|
392
429
|
}));
|
|
393
430
|
return function (_x3) {
|
|
394
|
-
return
|
|
431
|
+
return _ref4.apply(this, arguments);
|
|
395
432
|
};
|
|
396
433
|
}())).then(function (res) {
|
|
397
434
|
res.forEach(function (item) {
|
|
@@ -6,7 +6,9 @@ export var getRandom = function getRandom() {
|
|
|
6
6
|
export var difference = function difference(object, base) {
|
|
7
7
|
var changes = function changes(object, base) {
|
|
8
8
|
return transform(object, function (result, value, key) {
|
|
9
|
-
if (
|
|
9
|
+
if (key.indexOf('-') > -1) {
|
|
10
|
+
result[key] = true;
|
|
11
|
+
} else if (!isEqual(value, base[key])) {
|
|
10
12
|
result[key] = isObject(value) && isObject(base[key]) ? changes(value, base[key]) : value;
|
|
11
13
|
}
|
|
12
14
|
});
|
|
@@ -2,6 +2,8 @@ import { ProEnum } from '../propsType';
|
|
|
2
2
|
interface Props extends Pick<ProEnum, 'value' | 'onChange' | 'dataSource'> {
|
|
3
3
|
fieldValue: string;
|
|
4
4
|
fieldLabel: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
allowClear?: boolean;
|
|
5
7
|
}
|
|
6
8
|
declare const Group: (props: Props) => JSX.Element;
|
|
7
9
|
export default Group;
|
|
@@ -8,7 +8,10 @@ var Group = function Group(props) {
|
|
|
8
8
|
onChange = props.onChange,
|
|
9
9
|
dataSource = props.dataSource,
|
|
10
10
|
fieldValue = props.fieldValue,
|
|
11
|
-
fieldLabel = props.fieldLabel
|
|
11
|
+
fieldLabel = props.fieldLabel,
|
|
12
|
+
disabled = props.disabled,
|
|
13
|
+
_props$allowClear = props.allowClear,
|
|
14
|
+
allowClear = _props$allowClear === void 0 ? true : _props$allowClear;
|
|
12
15
|
var idx = useRef(-1);
|
|
13
16
|
var _useSetState = useSetState({
|
|
14
17
|
checked: ''
|
|
@@ -20,13 +23,28 @@ var Group = function Group(props) {
|
|
|
20
23
|
setState({
|
|
21
24
|
checked: value
|
|
22
25
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
setState({
|
|
26
|
-
checked: val
|
|
26
|
+
var index = dataSource.findIndex(function (item) {
|
|
27
|
+
return item[fieldValue] === value;
|
|
27
28
|
});
|
|
28
29
|
idx.current = index;
|
|
29
|
-
|
|
30
|
+
}, [value]);
|
|
31
|
+
var handleClick = function handleClick(val, index) {
|
|
32
|
+
if (state.checked === val) {
|
|
33
|
+
if (!allowClear) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
setState({
|
|
37
|
+
checked: ''
|
|
38
|
+
});
|
|
39
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('');
|
|
40
|
+
idx.current = -1;
|
|
41
|
+
} else {
|
|
42
|
+
setState({
|
|
43
|
+
checked: val
|
|
44
|
+
});
|
|
45
|
+
idx.current = index;
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
47
|
+
}
|
|
30
48
|
};
|
|
31
49
|
if (dataSource.length === 0) {
|
|
32
50
|
return _jsx("span", {
|
|
@@ -34,11 +52,11 @@ var Group = function Group(props) {
|
|
|
34
52
|
});
|
|
35
53
|
}
|
|
36
54
|
return _jsx("div", {
|
|
37
|
-
className:
|
|
55
|
+
className: classNames('pro-enum-group-root', disabled ? 'pro-enum-group-root-disabled' : ''),
|
|
38
56
|
children: dataSource.map(function (item, index) {
|
|
39
57
|
return _jsx("div", {
|
|
40
58
|
onClick: function onClick() {
|
|
41
|
-
if (!item.disabled) {
|
|
59
|
+
if (!item.disabled && !disabled) {
|
|
42
60
|
handleClick(item[fieldValue], index);
|
|
43
61
|
}
|
|
44
62
|
},
|
package/es/ProEnum/index.js
CHANGED
|
@@ -41,7 +41,8 @@ var ProEnum = function ProEnum(props) {
|
|
|
41
41
|
enumProps = _objectWithoutProperties(props, _excluded);
|
|
42
42
|
var _ref = otherProps || {},
|
|
43
43
|
isView = _ref.isView,
|
|
44
|
-
viewEmpty = _ref.viewEmpty
|
|
44
|
+
viewEmpty = _ref.viewEmpty,
|
|
45
|
+
disabled = _ref.disabled;
|
|
45
46
|
var _ref2 = useProConfig('ProEnum') || {},
|
|
46
47
|
fieldNames = _ref2.fieldNames,
|
|
47
48
|
_ref2$clear = _ref2.clear,
|
|
@@ -207,13 +208,13 @@ var ProEnum = function ProEnum(props) {
|
|
|
207
208
|
dataSource: list
|
|
208
209
|
});
|
|
209
210
|
case 'Group':
|
|
210
|
-
return _jsx(ProEnumGroup, {
|
|
211
|
+
return _jsx(ProEnumGroup, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
211
212
|
value: value,
|
|
212
213
|
onChange: onChange,
|
|
213
214
|
fieldLabel: label,
|
|
214
215
|
fieldValue: fieldValue,
|
|
215
216
|
dataSource: list
|
|
216
|
-
});
|
|
217
|
+
}));
|
|
217
218
|
default:
|
|
218
219
|
return null;
|
|
219
220
|
}
|
|
@@ -7,12 +7,17 @@
|
|
|
7
7
|
flex-direction: row;
|
|
8
8
|
flex-wrap: wrap;
|
|
9
9
|
}
|
|
10
|
+
&-group-root-disabled {
|
|
11
|
+
color: rgba(0, 0, 0, 0.25);
|
|
12
|
+
.pro-enum-group-item{
|
|
13
|
+
cursor: not-allowed !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
10
16
|
&-tag-item {
|
|
11
17
|
display: flex;
|
|
12
18
|
align-items: center;
|
|
13
19
|
justify-content: center;
|
|
14
20
|
margin-right: var(--zaui-space-size-sm);
|
|
15
|
-
margin-bottom: calc(var(--zaui-space-size-sm; 8px) * var(--zaui-size; 1));
|
|
16
21
|
padding: var(--zaui-space-size-xs) 10px;
|
|
17
22
|
background-color: #f5f5f5;
|
|
18
23
|
border-radius: var(--zaui-space-size-xs);
|
|
@@ -38,8 +43,7 @@
|
|
|
38
43
|
display: flex;
|
|
39
44
|
align-items: center;
|
|
40
45
|
justify-content: center;
|
|
41
|
-
|
|
42
|
-
padding: var(--zaui-space-size-sm) var(--zaui-space-border);
|
|
46
|
+
padding: 6px var(--zaui-space-border);
|
|
43
47
|
line-height: 18px;
|
|
44
48
|
background-color: #f1f3f6ff;
|
|
45
49
|
border: 1px solid transparent;
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
|
|
73
77
|
.pro-enum-group-item-selected {
|
|
74
78
|
color: var(--zaui-brand);
|
|
79
|
+
background: #fff;
|
|
75
80
|
border: 1px solid var(--zaui-brand);
|
|
76
81
|
&::after {
|
|
77
82
|
background: transparent;
|
|
@@ -88,4 +93,8 @@
|
|
|
88
93
|
cursor: not-allowed;
|
|
89
94
|
}
|
|
90
95
|
}
|
|
96
|
+
|
|
97
|
+
&-group-root-disabled {
|
|
98
|
+
opacity: 0.7;
|
|
99
|
+
}
|
|
91
100
|
}
|
|
@@ -5,7 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
6
|
var _excluded = ["className", "format"];
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { isFunction, isString } from 'lodash';
|
|
8
|
+
import { isFunction, isString, isObject } from 'lodash';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import moment from 'moment';
|
|
11
11
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
@@ -30,7 +30,7 @@ var DatePicker = function DatePicker(props) {
|
|
|
30
30
|
var viewChildren = null;
|
|
31
31
|
if (!value) {
|
|
32
32
|
viewChildren = null;
|
|
33
|
-
} else if (typeof format === 'string' &&
|
|
33
|
+
} else if (typeof format === 'string' && isObject(value)) {
|
|
34
34
|
viewChildren = value.format(format);
|
|
35
35
|
} else if (isFunction(format)) {
|
|
36
36
|
viewChildren = format(value);
|
|
@@ -41,17 +41,20 @@ var FormList = function FormList(props, ref) {
|
|
|
41
41
|
// names的name处理
|
|
42
42
|
var _name = Array.isArray(item === null || item === void 0 ? void 0 : item.names) ? [fieldName, namesPathTransform({
|
|
43
43
|
names: item === null || item === void 0 ? void 0 : item.names,
|
|
44
|
-
prefixNamePath: namePath
|
|
44
|
+
prefixNamePath: namePath,
|
|
45
|
+
type: item.type
|
|
45
46
|
})] : [fieldName].concat(_toConsumableArray(toArray(item.name)));
|
|
46
|
-
|
|
47
|
+
var column = _objectSpread(_objectSpread({}, item), {}, {
|
|
47
48
|
name: _name,
|
|
48
49
|
names: (item === null || item === void 0 ? void 0 : item.names) ? item.names.map(function (nameItem) {
|
|
49
|
-
|
|
50
|
+
// 传给Group的names会被渲染成真实FormItem 不能传完整name
|
|
51
|
+
return item.type === 'Group' ? [fieldName].concat(_toConsumableArray(toArray(nameItem))) : [].concat(_toConsumableArray(namePath), _toConsumableArray(toArray(nameItem)));
|
|
50
52
|
}) : item.names,
|
|
51
53
|
index: fieldName,
|
|
52
54
|
namePath: namePath,
|
|
53
55
|
label: mode === 'less' ? undefined : item.label
|
|
54
56
|
});
|
|
57
|
+
return column;
|
|
55
58
|
});
|
|
56
59
|
}, [columns]);
|
|
57
60
|
useImperativeHandle(ref, function () {
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @param prefixNamePath formList的name前缀
|
|
5
5
|
* @returns list_0_min-list_0_max
|
|
6
6
|
*/
|
|
7
|
-
export declare const namesPathTransform: ({ names, prefixNamePath, }: {
|
|
7
|
+
export declare const namesPathTransform: ({ names, prefixNamePath, type, }: {
|
|
8
8
|
names: any[];
|
|
9
9
|
prefixNamePath: any[];
|
|
10
|
+
type: string;
|
|
10
11
|
}) => string;
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export var namesPathTransform = function namesPathTransform(_ref) {
|
|
8
8
|
var names = _ref.names,
|
|
9
|
-
prefixNamePath = _ref.prefixNamePath
|
|
10
|
-
|
|
9
|
+
prefixNamePath = _ref.prefixNamePath,
|
|
10
|
+
type = _ref.type;
|
|
11
|
+
if (!Array.isArray(names) || type !== 'Group' && !Array.isArray(prefixNamePath)) {
|
|
11
12
|
return '';
|
|
12
13
|
}
|
|
14
|
+
var _prefixNamePath = type === 'Group' ? '' : prefixNamePath;
|
|
13
15
|
var newNamePath = names.map(function (val) {
|
|
14
|
-
return
|
|
16
|
+
return _prefixNamePath.concat(val);
|
|
15
17
|
});
|
|
16
18
|
return newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.map(function (name) {
|
|
17
19
|
return Array.isArray(name) ? name.join('_') : name;
|