@zat-design/sisyphus-react 3.4.2-beta.9 → 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 +55 -36
- package/dist/less.esm.css +5022 -0
- package/dist/less.esm.js +3 -0
- package/es/ProConfigProvider/index.js +2 -1
- package/es/ProEditTable/components/RenderField/index.js +20 -10
- package/es/ProEditTable/utils/config.js +5 -5
- package/es/ProEditTable/utils/index.js +32 -9
- 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 +11 -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 +23 -7
- package/es/ProForm/components/combination/Group/propsType.d.ts +6 -0
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +4 -1
- package/es/ProForm/components/render/RenderFields.js +3 -1
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProForm/style/index.less +17 -13
- package/es/ProForm/utils/transformNames.d.ts +1 -1
- package/es/ProForm/utils/transformNames.js +11 -4
- package/es/ProForm/utils/useListChanged.js +1 -0
- 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 +17 -36
- package/es/ProIcon/propsTypes.d.ts +2 -1
- package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
- 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 +19 -4
- package/es/ProLayout/components/ProHeader/style/index.less +2 -2
- package/es/ProLayout/style/index.less +5 -3
- package/es/ProStep/components/Item/index.js +2 -1
- package/es/ProStep/style/index.less +71 -70
- package/es/ProTree/components/ProTreeSelect/index.js +5 -9
- package/es/assets/catalog.svg +30 -1
- package/es/assets/fold.svg +27 -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/less.less +2 -0
- package/es/style/theme/antd.less +1 -1
- package/lib/ProConfigProvider/index.js +2 -1
- package/lib/ProEditTable/components/RenderField/index.js +19 -9
- package/lib/ProEditTable/utils/config.js +5 -5
- package/lib/ProEditTable/utils/index.js +32 -9
- 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 +11 -2
- 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 +22 -6
- package/lib/ProForm/components/combination/Group/propsType.d.ts +6 -0
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +4 -1
- package/lib/ProForm/components/render/RenderFields.js +3 -1
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProForm/style/index.less +17 -13
- package/lib/ProForm/utils/transformNames.d.ts +1 -1
- package/lib/ProForm/utils/transformNames.js +10 -3
- package/lib/ProForm/utils/useListChanged.js +1 -0
- 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 +17 -37
- package/lib/ProIcon/propsTypes.d.ts +2 -1
- package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
- 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 +19 -4
- package/lib/ProLayout/components/ProHeader/style/index.less +2 -2
- package/lib/ProLayout/style/index.less +5 -3
- package/lib/ProStep/components/Item/index.js +2 -1
- package/lib/ProStep/style/index.less +71 -70
- package/lib/ProTree/components/ProTreeSelect/index.js +5 -9
- package/lib/assets/catalog.svg +30 -1
- package/lib/assets/fold.svg +27 -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/less.less +2 -0
- package/lib/style/theme/antd.less +1 -1
- package/package.json +1 -1
- package/es/ProIcon/symbolIcon.js +0 -43
- package/lib/ProIcon/symbolIcon.js +0 -45
|
@@ -32,7 +32,7 @@ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "e
|
|
|
32
32
|
/* eslint-disable prefer-destructuring */
|
|
33
33
|
/* eslint-disable prefer-const */
|
|
34
34
|
var RenderField = function RenderField(_ref) {
|
|
35
|
-
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4;
|
|
35
|
+
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4, _componentProps;
|
|
36
36
|
var value = _ref.text,
|
|
37
37
|
record = _ref.record,
|
|
38
38
|
index = _ref.index,
|
|
@@ -88,7 +88,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
88
88
|
type = ((_type = type) === null || _type === void 0 ? void 0 : (_type$replace = _type.replace) === null || _type$replace === void 0 ? void 0 : _type$replace.call(_type, type[0], type[0].toUpperCase())) || 'Input';
|
|
89
89
|
// 单行正在编辑时,临时生成一套formItem用来存储中间值,点击取消时候重置回上一次状态
|
|
90
90
|
var namePath = (0, _tools.getNamePath)(name, virtualKey);
|
|
91
|
-
var rowData =
|
|
91
|
+
var rowData = form.getFieldValue([].concat((0, _toConsumableArray2.default)(namePath), [index])) || record || {};
|
|
92
92
|
var currentValue = dataIndex ? rowData === null || rowData === void 0 ? void 0 : rowData[dataIndex] : null;
|
|
93
93
|
// 第三个参数
|
|
94
94
|
var options = {
|
|
@@ -213,7 +213,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
213
213
|
if (valueType) {
|
|
214
214
|
transform = valueTypeTransform();
|
|
215
215
|
}
|
|
216
|
-
return (0, _transformNames.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _formItemProps), transform), form, names, namesStr);
|
|
216
|
+
return (0, _transformNames.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, _formItemProps), transform), form, names, namesStr, type);
|
|
217
217
|
};
|
|
218
218
|
if (!_editRender && typeof type === 'string') {
|
|
219
219
|
var _componentMap$type;
|
|
@@ -303,7 +303,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
303
303
|
}
|
|
304
304
|
_args = [].concat(args);
|
|
305
305
|
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
306
|
-
row = form.getFieldValue(rowPath, true);
|
|
306
|
+
row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
|
|
307
307
|
orgRow = (0, _lodash.cloneDeep)(row);
|
|
308
308
|
if (!onFieldChange) {
|
|
309
309
|
_context.next = 18;
|
|
@@ -348,7 +348,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
348
348
|
return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
349
349
|
case 27:
|
|
350
350
|
// 判断属性是否变动
|
|
351
|
-
form.setFieldValue(rowPath, row);
|
|
351
|
+
type !== 'Group' && form.setFieldValue(rowPath, row);
|
|
352
352
|
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
353
353
|
diff = (0, _tools.difference)(row, orgRow) || {};
|
|
354
354
|
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) {
|
|
@@ -472,9 +472,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
472
472
|
form: form,
|
|
473
473
|
name: cellName
|
|
474
474
|
}, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
|
|
475
|
+
namePath: [].concat((0, _toConsumableArray2.default)(namePath), [index]),
|
|
475
476
|
disabled: _disabled,
|
|
476
477
|
onChange: _onchange,
|
|
477
478
|
onBlur: _onblur,
|
|
479
|
+
index: index,
|
|
478
480
|
otherProps: {
|
|
479
481
|
form: form,
|
|
480
482
|
names: names,
|
|
@@ -484,6 +486,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
484
486
|
isView: isView
|
|
485
487
|
}
|
|
486
488
|
});
|
|
489
|
+
if (type === 'Group') {
|
|
490
|
+
componentProps.onFieldChange = _onchange;
|
|
491
|
+
} else {
|
|
492
|
+
componentProps = (0, _lodash.omit)(componentProps, ['onFieldChange', 'namePath', 'index']);
|
|
493
|
+
}
|
|
487
494
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
488
495
|
if (isCell) {
|
|
489
496
|
record["".concat(dataIndex, "-Disabled")] = _disabled;
|
|
@@ -509,11 +516,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
509
516
|
}
|
|
510
517
|
var _className = (0, _classnames.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, className, className), 'pro-form-item-changed', changed));
|
|
511
518
|
var originalTitle = originalDiffTip ? (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
512
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({},
|
|
519
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
513
520
|
isView: true,
|
|
514
521
|
value: originalValue,
|
|
515
522
|
checked: type === 'Switch' ? originalValue : undefined
|
|
516
|
-
}))) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({},
|
|
523
|
+
}))) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
517
524
|
isView: true,
|
|
518
525
|
value: originalValue,
|
|
519
526
|
checked: type === 'Switch' ? originalValue : undefined
|
|
@@ -524,15 +531,18 @@ var RenderField = function RenderField(_ref) {
|
|
|
524
531
|
}, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
525
532
|
className: _className,
|
|
526
533
|
name: cellName,
|
|
527
|
-
children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent,
|
|
534
|
+
children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
|
|
528
535
|
})) : (0, _jsxRuntime.jsx)(_Container.default, {
|
|
529
536
|
viewEmpty: viewEmpty
|
|
530
537
|
});
|
|
531
538
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
532
|
-
value: componentProps === null ||
|
|
539
|
+
value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
|
|
533
540
|
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
534
541
|
title: originalTitle,
|
|
535
542
|
open: changed ? undefined : false,
|
|
543
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
544
|
+
return target.parentElement;
|
|
545
|
+
},
|
|
536
546
|
children: FormItem
|
|
537
547
|
})
|
|
538
548
|
});
|
|
@@ -196,11 +196,6 @@ var actions = exports.actions = {
|
|
|
196
196
|
addData.isEditing = true;
|
|
197
197
|
}
|
|
198
198
|
insertType === 'before' ? nextData.unshift(addData) : nextData.push(addData);
|
|
199
|
-
form.setFieldValue(name, nextData);
|
|
200
|
-
(_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, {
|
|
201
|
-
top: 10000,
|
|
202
|
-
behavior: 'smooth'
|
|
203
|
-
});
|
|
204
199
|
// 当单选情况下,存储正在编辑值
|
|
205
200
|
if (virtualKey) {
|
|
206
201
|
nextEditingKeys = (0, _toConsumableArray2.default)(editingKeys); // 开启编辑状态
|
|
@@ -210,6 +205,11 @@ var actions = exports.actions = {
|
|
|
210
205
|
editingKeys: nextEditingKeys
|
|
211
206
|
});
|
|
212
207
|
}
|
|
208
|
+
form.setFieldValue(name, nextData);
|
|
209
|
+
(_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, {
|
|
210
|
+
top: insertType === 'before' ? -10000 : 10000,
|
|
211
|
+
behavior: 'smooth'
|
|
212
|
+
});
|
|
213
213
|
_context2.next = 14;
|
|
214
214
|
return form.validateFields([name]);
|
|
215
215
|
case 14:
|
|
@@ -104,7 +104,30 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
104
104
|
setTimeout(function () {
|
|
105
105
|
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
106
106
|
if (errorDom) {
|
|
107
|
-
errorDom.
|
|
107
|
+
var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
|
|
108
|
+
var tableCell = errorDom.closest('.ant-table-cell');
|
|
109
|
+
if (tableBody && tableCell) {
|
|
110
|
+
var previousSibling = tableCell.previousElementSibling;
|
|
111
|
+
var childOffsetLeft = 0;
|
|
112
|
+
var childFixedLeft = 0;
|
|
113
|
+
while (previousSibling) {
|
|
114
|
+
if (previousSibling.nodeType === 1) {
|
|
115
|
+
var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
|
|
116
|
+
var _ref2 = previousSibling.getBoundingClientRect() || {},
|
|
117
|
+
_ref2$width = _ref2.width,
|
|
118
|
+
width = _ref2$width === void 0 ? 0 : _ref2$width;
|
|
119
|
+
childOffsetLeft += width;
|
|
120
|
+
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')) {
|
|
121
|
+
childFixedLeft += width;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
previousSibling = previousSibling.previousElementSibling;
|
|
125
|
+
}
|
|
126
|
+
tableBody.scrollTo({
|
|
127
|
+
left: childOffsetLeft - childFixedLeft,
|
|
128
|
+
behavior: 'smooth'
|
|
129
|
+
});
|
|
130
|
+
}
|
|
108
131
|
}
|
|
109
132
|
}, 0);
|
|
110
133
|
return _context.abrupt("return", Promise.reject(_context.t0));
|
|
@@ -228,10 +251,10 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
228
251
|
if (typeof columnTitle === 'string') {
|
|
229
252
|
item.originTitle = columnTitle;
|
|
230
253
|
if (tooltip) {
|
|
231
|
-
var
|
|
232
|
-
tooltipTitle =
|
|
233
|
-
icon =
|
|
234
|
-
resetProps = (0, _objectWithoutProperties2.default)(
|
|
254
|
+
var _ref3 = tooltip || {},
|
|
255
|
+
tooltipTitle = _ref3.title,
|
|
256
|
+
icon = _ref3.icon,
|
|
257
|
+
resetProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
235
258
|
item.title = (0, _jsxRuntime.jsxs)("span", {
|
|
236
259
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
|
237
260
|
children: [before, columnTitle, (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
@@ -383,13 +406,13 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
383
406
|
// cacheMap 用来存储缓存值,若有值后不再请求
|
|
384
407
|
if (JSON.stringify(cacheMap.current) === '{}') {
|
|
385
408
|
Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
|
|
386
|
-
var
|
|
387
|
-
var _item, key, value,
|
|
409
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(item) {
|
|
410
|
+
var _item, key, value, _ref5, service, option;
|
|
388
411
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
389
412
|
while (1) switch (_context2.prev = _context2.next) {
|
|
390
413
|
case 0:
|
|
391
414
|
_item = (0, _slicedToArray2.default)(item, 2), key = _item[0], value = _item[1];
|
|
392
|
-
|
|
415
|
+
_ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
|
|
393
416
|
if (!service) {
|
|
394
417
|
_context2.next = 8;
|
|
395
418
|
break;
|
|
@@ -409,7 +432,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
409
432
|
}, _callee2);
|
|
410
433
|
}));
|
|
411
434
|
return function (_x3) {
|
|
412
|
-
return
|
|
435
|
+
return _ref4.apply(this, arguments);
|
|
413
436
|
};
|
|
414
437
|
}())).then(function (res) {
|
|
415
438
|
res.forEach(function (item) {
|
|
@@ -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;
|
|
@@ -15,7 +15,10 @@ var Group = function Group(props) {
|
|
|
15
15
|
onChange = props.onChange,
|
|
16
16
|
dataSource = props.dataSource,
|
|
17
17
|
fieldValue = props.fieldValue,
|
|
18
|
-
fieldLabel = props.fieldLabel
|
|
18
|
+
fieldLabel = props.fieldLabel,
|
|
19
|
+
disabled = props.disabled,
|
|
20
|
+
_props$allowClear = props.allowClear,
|
|
21
|
+
allowClear = _props$allowClear === void 0 ? true : _props$allowClear;
|
|
19
22
|
var idx = (0, _react.useRef)(-1);
|
|
20
23
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
21
24
|
checked: ''
|
|
@@ -27,13 +30,28 @@ var Group = function Group(props) {
|
|
|
27
30
|
setState({
|
|
28
31
|
checked: value
|
|
29
32
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
setState({
|
|
33
|
-
checked: val
|
|
33
|
+
var index = dataSource.findIndex(function (item) {
|
|
34
|
+
return item[fieldValue] === value;
|
|
34
35
|
});
|
|
35
36
|
idx.current = index;
|
|
36
|
-
|
|
37
|
+
}, [value]);
|
|
38
|
+
var handleClick = function handleClick(val, index) {
|
|
39
|
+
if (state.checked === val) {
|
|
40
|
+
if (!allowClear) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
setState({
|
|
44
|
+
checked: ''
|
|
45
|
+
});
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('');
|
|
47
|
+
idx.current = -1;
|
|
48
|
+
} else {
|
|
49
|
+
setState({
|
|
50
|
+
checked: val
|
|
51
|
+
});
|
|
52
|
+
idx.current = index;
|
|
53
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
54
|
+
}
|
|
37
55
|
};
|
|
38
56
|
if (dataSource.length === 0) {
|
|
39
57
|
return (0, _jsxRuntime.jsx)("span", {
|
|
@@ -41,11 +59,11 @@ var Group = function Group(props) {
|
|
|
41
59
|
});
|
|
42
60
|
}
|
|
43
61
|
return (0, _jsxRuntime.jsx)("div", {
|
|
44
|
-
className:
|
|
62
|
+
className: (0, _classnames.default)('pro-enum-group-root', disabled ? 'pro-enum-group-root-disabled' : ''),
|
|
45
63
|
children: dataSource.map(function (item, index) {
|
|
46
64
|
return (0, _jsxRuntime.jsx)("div", {
|
|
47
65
|
onClick: function onClick() {
|
|
48
|
-
if (!item.disabled) {
|
|
66
|
+
if (!item.disabled && !disabled) {
|
|
49
67
|
handleClick(item[fieldValue], index);
|
|
50
68
|
}
|
|
51
69
|
},
|
package/lib/ProEnum/index.js
CHANGED
|
@@ -42,7 +42,8 @@ var ProEnum = function ProEnum(props) {
|
|
|
42
42
|
enumProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
43
43
|
var _ref = otherProps || {},
|
|
44
44
|
isView = _ref.isView,
|
|
45
|
-
viewEmpty = _ref.viewEmpty
|
|
45
|
+
viewEmpty = _ref.viewEmpty,
|
|
46
|
+
disabled = _ref.disabled;
|
|
46
47
|
var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
|
|
47
48
|
fieldNames = _ref2.fieldNames,
|
|
48
49
|
_ref2$clear = _ref2.clear,
|
|
@@ -208,13 +209,13 @@ var ProEnum = function ProEnum(props) {
|
|
|
208
209
|
dataSource: list
|
|
209
210
|
});
|
|
210
211
|
case 'Group':
|
|
211
|
-
return (0, _jsxRuntime.jsx)(_Group.default, {
|
|
212
|
+
return (0, _jsxRuntime.jsx)(_Group.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
|
|
212
213
|
value: value,
|
|
213
214
|
onChange: onChange,
|
|
214
215
|
fieldLabel: label,
|
|
215
216
|
fieldValue: fieldValue,
|
|
216
217
|
dataSource: list
|
|
217
|
-
});
|
|
218
|
+
}));
|
|
218
219
|
default:
|
|
219
220
|
return null;
|
|
220
221
|
}
|
|
@@ -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);
|
|
@@ -71,8 +76,8 @@
|
|
|
71
76
|
|
|
72
77
|
.pro-enum-group-item-selected {
|
|
73
78
|
color: var(--zaui-brand);
|
|
74
|
-
border: 1px solid var(--zaui-brand);
|
|
75
79
|
background: #fff;
|
|
80
|
+
border: 1px solid var(--zaui-brand);
|
|
76
81
|
&::after {
|
|
77
82
|
background: transparent;
|
|
78
83
|
}
|
|
@@ -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
|
}
|
|
@@ -47,17 +47,20 @@ var FormList = function FormList(props, ref) {
|
|
|
47
47
|
// names的name处理
|
|
48
48
|
var _name = Array.isArray(item === null || item === void 0 ? void 0 : item.names) ? [fieldName, (0, _utils2.namesPathTransform)({
|
|
49
49
|
names: item === null || item === void 0 ? void 0 : item.names,
|
|
50
|
-
prefixNamePath: namePath
|
|
50
|
+
prefixNamePath: namePath,
|
|
51
|
+
type: item.type
|
|
51
52
|
})] : [fieldName].concat((0, _toConsumableArray2.default)((0, _utils.toArray)(item.name)));
|
|
52
|
-
|
|
53
|
+
var column = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
53
54
|
name: _name,
|
|
54
55
|
names: (item === null || item === void 0 ? void 0 : item.names) ? item.names.map(function (nameItem) {
|
|
55
|
-
|
|
56
|
+
// 传给Group的names会被渲染成真实FormItem 不能传完整name
|
|
57
|
+
return item.type === 'Group' ? [fieldName].concat((0, _toConsumableArray2.default)((0, _utils.toArray)(nameItem))) : [].concat((0, _toConsumableArray2.default)(namePath), (0, _toConsumableArray2.default)((0, _utils.toArray)(nameItem)));
|
|
56
58
|
}) : item.names,
|
|
57
59
|
index: fieldName,
|
|
58
60
|
namePath: namePath,
|
|
59
61
|
label: mode === 'less' ? undefined : item.label
|
|
60
62
|
});
|
|
63
|
+
return column;
|
|
61
64
|
});
|
|
62
65
|
}, [columns]);
|
|
63
66
|
(0, _react.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;
|
|
@@ -12,12 +12,14 @@ exports.namesPathTransform = void 0;
|
|
|
12
12
|
*/
|
|
13
13
|
var namesPathTransform = exports.namesPathTransform = function namesPathTransform(_ref) {
|
|
14
14
|
var names = _ref.names,
|
|
15
|
-
prefixNamePath = _ref.prefixNamePath
|
|
16
|
-
|
|
15
|
+
prefixNamePath = _ref.prefixNamePath,
|
|
16
|
+
type = _ref.type;
|
|
17
|
+
if (!Array.isArray(names) || type !== 'Group' && !Array.isArray(prefixNamePath)) {
|
|
17
18
|
return '';
|
|
18
19
|
}
|
|
20
|
+
var _prefixNamePath = type === 'Group' ? '' : prefixNamePath;
|
|
19
21
|
var newNamePath = names.map(function (val) {
|
|
20
|
-
return
|
|
22
|
+
return _prefixNamePath.concat(val);
|
|
21
23
|
});
|
|
22
24
|
return newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.map(function (name) {
|
|
23
25
|
return Array.isArray(name) ? name.join('_') : name;
|
|
@@ -26,11 +26,16 @@ var Group = function Group(props) {
|
|
|
26
26
|
} : _props$space,
|
|
27
27
|
id = props.id,
|
|
28
28
|
value = props.value,
|
|
29
|
-
|
|
29
|
+
isView = props.isView,
|
|
30
|
+
index = props.index,
|
|
31
|
+
onFieldChange = props.onFieldChange,
|
|
32
|
+
namePath = props.namePath;
|
|
30
33
|
var _ref = _ProForm.default.useFieldProps() || {},
|
|
31
34
|
names = _ref.names,
|
|
32
35
|
name = _ref.name,
|
|
33
|
-
form = _ref.form
|
|
36
|
+
form = _ref.form,
|
|
37
|
+
_namePath = _ref.namePath;
|
|
38
|
+
var newNamePath = namePath || _namePath || [];
|
|
34
39
|
if (!Array.isArray(names)) {
|
|
35
40
|
console.error('Warning: Composite form components whose type is Group must be configured with names');
|
|
36
41
|
}
|
|
@@ -40,8 +45,10 @@ var Group = function Group(props) {
|
|
|
40
45
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
41
46
|
disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
|
|
42
47
|
}, item), {}, {
|
|
48
|
+
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
43
49
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
44
|
-
parentNames: id
|
|
50
|
+
parentNames: id,
|
|
51
|
+
namePath: newNamePath
|
|
45
52
|
});
|
|
46
53
|
});
|
|
47
54
|
var node = (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
@@ -63,14 +70,23 @@ var Group = function Group(props) {
|
|
|
63
70
|
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
64
71
|
})
|
|
65
72
|
}, "".concat(className), className));
|
|
73
|
+
// 用于formList场景下names移除掉了前缀,需要再次合并回来
|
|
74
|
+
var _names = names.map(function (item) {
|
|
75
|
+
if ((0, _lodash.isNumber)(item === null || item === void 0 ? void 0 : item[0])) {
|
|
76
|
+
return (0, _lodash.union)(newNamePath, item);
|
|
77
|
+
}
|
|
78
|
+
return item;
|
|
79
|
+
});
|
|
66
80
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
67
81
|
var _document, _document$activeEleme;
|
|
68
82
|
// 焦点激活的表单
|
|
69
83
|
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
70
84
|
// 模拟change,初始化不执行onFieldChange
|
|
71
|
-
if ((0, _lodash.isFunction)(onFieldChange) && form.isFieldsTouched(
|
|
72
|
-
onFieldChange(value, form.getFieldsValue(), {
|
|
73
|
-
form: form
|
|
85
|
+
if ((0, _lodash.isFunction)(onFieldChange) && form.isFieldsTouched(_names) && (0, _utils.transformNamesString)(_names).includes(touchName)) {
|
|
86
|
+
onFieldChange(value, (newNamePath === null || newNamePath === void 0 ? void 0 : newNamePath.length) ? form.getFieldValue(newNamePath, true) : form.getFieldsValue(), {
|
|
87
|
+
form: form,
|
|
88
|
+
namePath: newNamePath,
|
|
89
|
+
index: index
|
|
74
90
|
});
|
|
75
91
|
}
|
|
76
92
|
}, [value]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RowProps, SpaceProps } from 'antd';
|
|
3
3
|
import { FormInstance } from 'antd/es/form/Form';
|
|
4
|
+
import { NamePath } from 'antd/lib/form/interface';
|
|
4
5
|
import { ProColumnProps, ProFormOtherProps } from '../../../propsType';
|
|
5
6
|
export interface SpaceType extends SpaceProps {
|
|
6
7
|
/**
|
|
@@ -23,7 +24,12 @@ export interface GroupProps {
|
|
|
23
24
|
value?: any;
|
|
24
25
|
id?: string;
|
|
25
26
|
disabled?: boolean | (() => void);
|
|
27
|
+
isView?: boolean;
|
|
28
|
+
namePath?: NamePath;
|
|
29
|
+
index?: number;
|
|
26
30
|
onFieldChange?: (value: any[] | null, record: any, { form, }: {
|
|
27
31
|
form: FormInstance;
|
|
32
|
+
namePath?: NamePath;
|
|
33
|
+
index?: number;
|
|
28
34
|
}) => any;
|
|
29
35
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
~ .forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
7
7
|
.@{ant-prefix}-input-borderless
|
|
8
8
|
).@{ant-prefix}-input {
|
|
9
|
-
background: @zaui-base-bg;
|
|
9
|
+
// background: @zaui-base-bg;
|
|
10
10
|
border-color: var(--ant-error-color);
|
|
11
11
|
}
|
|
12
12
|
.forever-checkbox:not(.@{ant-prefix}-input-disabled):not(
|
|
@@ -39,7 +39,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
if ((0, _lodash.isObject)(confirmProps)) {
|
|
42
|
-
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultConfirmProps), confirmProps), {}, {
|
|
42
|
+
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
|
|
43
43
|
onOk: function onOk() {
|
|
44
44
|
var _confirmProps$onOk;
|
|
45
45
|
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
@@ -148,7 +148,7 @@ var Render = function Render(props) {
|
|
|
148
148
|
*/
|
|
149
149
|
var transforms = Array.isArray(otherProps === null || otherProps === void 0 ? void 0 : otherProps.names) ? (0, _transformNames.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, otherFormItemProps), valueTypeTransform()),
|
|
150
150
|
// 合并valueType的transform
|
|
151
|
-
form, otherProps.names, namesStr) : valueTypeTransform();
|
|
151
|
+
form, otherProps.names, namesStr, otherProps.type) : valueTypeTransform();
|
|
152
152
|
// ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
|
|
153
153
|
Object.assign(otherFormItemProps, transforms, {
|
|
154
154
|
names: otherProps.names
|
|
@@ -445,6 +445,9 @@ var Render = function Render(props) {
|
|
|
445
445
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
446
446
|
title: title,
|
|
447
447
|
visible: changed ? undefined : false,
|
|
448
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
449
|
+
return target.parentElement;
|
|
450
|
+
},
|
|
448
451
|
children: formItem
|
|
449
452
|
});
|
|
450
453
|
};
|
|
@@ -184,7 +184,9 @@ var RenderFields = function RenderFields(props) {
|
|
|
184
184
|
form: form,
|
|
185
185
|
type: _type,
|
|
186
186
|
hiddenNames: column.hiddenNames,
|
|
187
|
-
colProps: _colProps
|
|
187
|
+
colProps: _colProps,
|
|
188
|
+
mode: componentProps.mode,
|
|
189
|
+
namePath: column.namePath
|
|
188
190
|
};
|
|
189
191
|
if (outerClearNotShow !== false && show === false && (column === null || column === void 0 ? void 0 : column.name) && form.getFieldValue(column === null || column === void 0 ? void 0 : column.name)) {
|
|
190
192
|
setTimeout(function () {
|
|
@@ -39,6 +39,8 @@ export interface ProFormOtherProps {
|
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
show?: boolean | (() => boolean);
|
|
41
41
|
required?: boolean | (() => boolean);
|
|
42
|
+
mode?: string;
|
|
43
|
+
namePath?: any[] | string | number;
|
|
42
44
|
}
|
|
43
45
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
44
46
|
disabled?: boolean;
|
|
@@ -31,16 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
&.@{ant-prefix}-form {
|
|
35
|
-
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.pro-collapse-level2 {
|
|
39
|
-
.@{ant-prefix}-collapse-item {
|
|
40
|
-
margin-bottom: 0 !important;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
34
|
.@{ant-prefix}-form-item-control-input {
|
|
45
35
|
flex-grow: 1;
|
|
46
36
|
max-width: 100%;
|
|
@@ -135,7 +125,7 @@
|
|
|
135
125
|
background: @zaui-contract-bg !important;
|
|
136
126
|
|
|
137
127
|
input {
|
|
138
|
-
background:
|
|
128
|
+
background: transparent;
|
|
139
129
|
}
|
|
140
130
|
.@{ant-prefix}-select-selection-placeholder {
|
|
141
131
|
z-index: 9;
|
|
@@ -147,8 +137,22 @@
|
|
|
147
137
|
border-radius: 4px;
|
|
148
138
|
}
|
|
149
139
|
|
|
150
|
-
//
|
|
151
|
-
.@{ant-prefix}-form-item-control-input-content
|
|
140
|
+
// 地址组件
|
|
141
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
142
|
+
& > .pro-address {
|
|
143
|
+
.ant-select-selector,
|
|
144
|
+
.ant-input-affix-wrapper,
|
|
145
|
+
.ant-input-disabled {
|
|
146
|
+
background: @zaui-contract-bg;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
& > .ant-input-group {
|
|
150
|
+
.forever-checkbox {
|
|
151
|
+
background: @zaui-contract-bg;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
.pro-form-view-container {
|
|
153
157
|
padding: 4px 8px;
|
|
154
158
|
background: @zaui-contract-bg;
|
|
@@ -6,5 +6,5 @@ interface TransformProps extends FormItemProps {
|
|
|
6
6
|
namePath: any[];
|
|
7
7
|
}
|
|
8
8
|
type TransformFun = 'normalize' | 'getValueProps' | 'shouldUpdate' | 'name';
|
|
9
|
-
declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string) => Pick<TransformProps, TransformFun>;
|
|
9
|
+
declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string, type?: string) => Pick<TransformProps, TransformFun>;
|
|
10
10
|
export default transformNames;
|
|
@@ -6,17 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
8
|
var _transformValue2 = require("./transformValue");
|
|
9
|
-
var transformNames = function transformNames(formItem, form, names, fieldName) {
|
|
9
|
+
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
|
10
|
+
var _names2, _names3, _names3$;
|
|
10
11
|
var _ref = formItem || {},
|
|
11
12
|
normalize = _ref.normalize,
|
|
12
13
|
getValueProps = _ref.getValueProps,
|
|
13
14
|
_shouldUpdate2 = _ref.shouldUpdate;
|
|
14
|
-
|
|
15
|
+
var _names = names;
|
|
16
|
+
if (!((_names2 = _names) === null || _names2 === void 0 ? void 0 : _names2.length)) {
|
|
15
17
|
return {};
|
|
16
18
|
}
|
|
17
19
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
|
18
20
|
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? (0, _lodash.union)(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
|
|
19
|
-
|
|
21
|
+
if (type === 'Group' && (0, _lodash.isNumber)((_names3 = _names) === null || _names3 === void 0 ? void 0 : (_names3$ = _names3[0]) === null || _names3$ === void 0 ? void 0 : _names3$[0])) {
|
|
22
|
+
_names = _names.map(function (item) {
|
|
23
|
+
return (0, _lodash.union)(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, item);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var _transformValue = (0, _transformValue2.transformValue)(_names, form, _fieldName, normalize, getValueProps),
|
|
20
27
|
_normalize = _transformValue.normalize,
|
|
21
28
|
_getValueProps = _transformValue.getValueProps,
|
|
22
29
|
_shouldUpdate = _transformValue.shouldUpdate;
|
|
@@ -32,6 +32,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
32
32
|
var rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1); // 表单中变动值所在行
|
|
33
33
|
var rowKeyName = rowKeyPath[rowKeyPath.length - 1]; // rowKey在行内的name
|
|
34
34
|
var rowValue = form.getFieldValue(rowValueNamePath);
|
|
35
|
+
if (!rowValue) return undefined;
|
|
35
36
|
var keyValue = rowValue[rowKeyName]; // 获取表单中rowKey值
|
|
36
37
|
if (!keyValue) return undefined;
|
|
37
38
|
var originalValueList = (0, _lodash.get)(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|