@zat-design/sisyphus-react 3.4.2-beta.3 → 3.4.2-beta.31
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 +136 -64
- package/dist/less.esm.css +5025 -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/index.js +3 -3
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/utils/config.js +5 -5
- package/es/ProEditTable/utils/index.js +67 -30
- 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/combination/FormList/index.js +4 -2
- package/es/ProForm/components/combination/Group/index.js +11 -4
- 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/Render.js +5 -2
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/RenderFields.js +4 -3
- package/es/ProForm/index.js +4 -4
- package/es/ProForm/propsType.d.ts +2 -1
- package/es/ProForm/style/index.less +17 -7
- 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/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 +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/Layout/Menu/OpenMenu/style/index.less +0 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/es/ProLayout/components/Layout/Menu/style/index.less +2 -2
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -5
- package/es/ProLayout/components/ProCollapse/index.js +22 -6
- package/es/ProLayout/components/ProCollapse/style/index.less +24 -27
- 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 +4 -3
- package/es/ProLayout/style/index.less +83 -5
- 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/utils.js +9 -9
- package/es/ProTabs/style/index.less +3 -1
- 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 -2
- package/lib/ProConfigProvider/index.js +2 -1
- package/lib/ProEditTable/components/RenderField/index.js +20 -10
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/utils/config.js +5 -5
- package/lib/ProEditTable/utils/index.js +67 -30
- 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/combination/FormList/index.js +4 -2
- package/lib/ProForm/components/combination/Group/index.js +11 -4
- 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/Render.js +5 -2
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/RenderFields.js +4 -3
- package/lib/ProForm/index.js +4 -4
- package/lib/ProForm/propsType.d.ts +2 -1
- package/lib/ProForm/style/index.less +17 -7
- 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/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 +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/Layout/Menu/OpenMenu/style/index.less +0 -1
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +25 -20
- package/lib/ProLayout/components/Layout/Menu/style/index.less +2 -2
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +5 -5
- package/lib/ProLayout/components/ProCollapse/index.js +20 -6
- package/lib/ProLayout/components/ProCollapse/style/index.less +24 -27
- 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 +4 -3
- package/lib/ProLayout/style/index.less +83 -5
- 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/utils.js +9 -9
- package/lib/ProTabs/style/index.less +3 -1
- 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 -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/dist/less.esm.js
ADDED
|
@@ -29,7 +29,7 @@ import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
|
29
29
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
30
|
import { isSelect } from '../../../ProForm/utils';
|
|
31
31
|
var RenderField = function RenderField(_ref) {
|
|
32
|
-
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4;
|
|
32
|
+
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4, _componentProps;
|
|
33
33
|
var value = _ref.text,
|
|
34
34
|
record = _ref.record,
|
|
35
35
|
index = _ref.index,
|
|
@@ -72,7 +72,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
72
72
|
virtualKey = config.virtualKey,
|
|
73
73
|
viewEmpty = config.viewEmpty,
|
|
74
74
|
originalValues = config.originalValues,
|
|
75
|
-
|
|
75
|
+
originalDiffTip = config.originalDiffTip;
|
|
76
76
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
77
77
|
var _rules = rules || [];
|
|
78
78
|
var _required = required;
|
|
@@ -300,7 +300,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
300
300
|
}
|
|
301
301
|
_args = [].concat(args);
|
|
302
302
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
303
|
-
row = form.getFieldValue(rowPath, true);
|
|
303
|
+
row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
|
|
304
304
|
orgRow = cloneDeep(row);
|
|
305
305
|
if (!onFieldChange) {
|
|
306
306
|
_context.next = 18;
|
|
@@ -345,7 +345,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
345
345
|
return onChange.apply(void 0, _toConsumableArray(_args));
|
|
346
346
|
case 27:
|
|
347
347
|
// 判断属性是否变动
|
|
348
|
-
form.setFieldValue(rowPath, row);
|
|
348
|
+
type !== 'Group' && form.setFieldValue(rowPath, row);
|
|
349
349
|
if (!isEqual(orgRow, row)) {
|
|
350
350
|
diff = difference(row, orgRow) || {};
|
|
351
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) {
|
|
@@ -469,9 +469,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
469
469
|
form: form,
|
|
470
470
|
name: cellName
|
|
471
471
|
}, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
|
|
472
|
+
namePath: [].concat(_toConsumableArray(namePath), [index]),
|
|
472
473
|
disabled: _disabled,
|
|
473
474
|
onChange: _onchange,
|
|
474
475
|
onBlur: _onblur,
|
|
476
|
+
index: index,
|
|
475
477
|
otherProps: {
|
|
476
478
|
form: form,
|
|
477
479
|
names: names,
|
|
@@ -481,6 +483,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
481
483
|
isView: isView
|
|
482
484
|
}
|
|
483
485
|
});
|
|
486
|
+
if (type === 'Group') {
|
|
487
|
+
componentProps.onFieldChange = _onchange;
|
|
488
|
+
} else {
|
|
489
|
+
componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
|
|
490
|
+
}
|
|
484
491
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
485
492
|
if (isCell) {
|
|
486
493
|
record["".concat(dataIndex, "-Disabled")] = _disabled;
|
|
@@ -505,12 +512,12 @@ var RenderField = function RenderField(_ref) {
|
|
|
505
512
|
delete _formItemProps.rules;
|
|
506
513
|
}
|
|
507
514
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
508
|
-
var originalTitle =
|
|
509
|
-
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), {}, {
|
|
510
517
|
isView: true,
|
|
511
518
|
value: originalValue,
|
|
512
519
|
checked: type === 'Switch' ? originalValue : undefined
|
|
513
|
-
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({},
|
|
520
|
+
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
514
521
|
isView: true,
|
|
515
522
|
value: originalValue,
|
|
516
523
|
checked: type === 'Switch' ? originalValue : undefined
|
|
@@ -521,15 +528,18 @@ var RenderField = function RenderField(_ref) {
|
|
|
521
528
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
522
529
|
className: _className,
|
|
523
530
|
name: cellName,
|
|
524
|
-
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent,
|
|
531
|
+
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
525
532
|
})) : _jsx(Container, {
|
|
526
533
|
viewEmpty: viewEmpty
|
|
527
534
|
});
|
|
528
535
|
return _jsx(FieldProvider, {
|
|
529
|
-
value: componentProps === null ||
|
|
530
|
-
children: !
|
|
536
|
+
value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
|
|
537
|
+
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
|
|
531
538
|
title: originalTitle,
|
|
532
539
|
open: changed ? undefined : false,
|
|
540
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
541
|
+
return target.parentElement;
|
|
542
|
+
},
|
|
533
543
|
children: FormItem
|
|
534
544
|
})
|
|
535
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) {
|
|
@@ -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
|
}
|
|
@@ -43,15 +43,17 @@ var FormList = function FormList(props, ref) {
|
|
|
43
43
|
names: item === null || item === void 0 ? void 0 : item.names,
|
|
44
44
|
prefixNamePath: namePath
|
|
45
45
|
})] : [fieldName].concat(_toConsumableArray(toArray(item.name)));
|
|
46
|
-
|
|
46
|
+
var column = _objectSpread(_objectSpread({}, item), {}, {
|
|
47
47
|
name: _name,
|
|
48
48
|
names: (item === null || item === void 0 ? void 0 : item.names) ? item.names.map(function (nameItem) {
|
|
49
|
-
|
|
49
|
+
// 传给Group的names会被渲染成真实FormItem 不能传完整name
|
|
50
|
+
return item.type === 'Group' ? [fieldName].concat(_toConsumableArray(toArray(nameItem))) : [].concat(_toConsumableArray(namePath), _toConsumableArray(toArray(nameItem)));
|
|
50
51
|
}) : item.names,
|
|
51
52
|
index: fieldName,
|
|
52
53
|
namePath: namePath,
|
|
53
54
|
label: mode === 'less' ? undefined : item.label
|
|
54
55
|
});
|
|
56
|
+
return column;
|
|
55
57
|
});
|
|
56
58
|
}, [columns]);
|
|
57
59
|
useImperativeHandle(ref, function () {
|
|
@@ -22,7 +22,10 @@ var Group = function Group(props) {
|
|
|
22
22
|
} : _props$space,
|
|
23
23
|
id = props.id,
|
|
24
24
|
value = props.value,
|
|
25
|
-
|
|
25
|
+
isView = props.isView,
|
|
26
|
+
index = props.index,
|
|
27
|
+
onFieldChange = props.onFieldChange,
|
|
28
|
+
namePath = props.namePath;
|
|
26
29
|
var _ref = ProForm.useFieldProps() || {},
|
|
27
30
|
names = _ref.names,
|
|
28
31
|
name = _ref.name,
|
|
@@ -36,8 +39,10 @@ var Group = function Group(props) {
|
|
|
36
39
|
return _objectSpread(_objectSpread({
|
|
37
40
|
disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
|
|
38
41
|
}, item), {}, {
|
|
42
|
+
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
39
43
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
40
|
-
parentNames: id
|
|
44
|
+
parentNames: id,
|
|
45
|
+
namePath: namePath
|
|
41
46
|
});
|
|
42
47
|
});
|
|
43
48
|
var node = _jsx(_Button, {
|
|
@@ -65,8 +70,10 @@ var Group = function Group(props) {
|
|
|
65
70
|
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
66
71
|
// 模拟change,初始化不执行onFieldChange
|
|
67
72
|
if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
|
|
68
|
-
onFieldChange(value, form.getFieldsValue(), {
|
|
69
|
-
form: form
|
|
73
|
+
onFieldChange(value, namePath ? form.getFieldValue(namePath, true) : form.getFieldsValue(), {
|
|
74
|
+
form: form,
|
|
75
|
+
namePath: namePath,
|
|
76
|
+
index: index
|
|
70
77
|
});
|
|
71
78
|
}
|
|
72
79
|
}, [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(
|
|
@@ -52,7 +52,7 @@ var Render = function Render(props) {
|
|
|
52
52
|
originalValues = props.originalValues,
|
|
53
53
|
equalWith = props.equalWith,
|
|
54
54
|
requiredOnView = props.requiredOnView,
|
|
55
|
-
|
|
55
|
+
originalDiffTip = props.originalDiffTip,
|
|
56
56
|
confirm = props.confirm,
|
|
57
57
|
globalControl = props.globalControl;
|
|
58
58
|
var colProps = props.colProps;
|
|
@@ -434,7 +434,7 @@ var Render = function Render(props) {
|
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
436
|
// 不渲染tooltip
|
|
437
|
-
if (!
|
|
437
|
+
if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
438
438
|
return formItem;
|
|
439
439
|
}
|
|
440
440
|
var title = _jsxs(_Space, {
|
|
@@ -447,6 +447,9 @@ var Render = function Render(props) {
|
|
|
447
447
|
return _jsx(_Tooltip, {
|
|
448
448
|
title: title,
|
|
449
449
|
visible: changed ? undefined : false,
|
|
450
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
451
|
+
return target.parentElement;
|
|
452
|
+
},
|
|
450
453
|
children: formItem
|
|
451
454
|
});
|
|
452
455
|
};
|
|
@@ -17,7 +17,7 @@ interface Props<T = any> {
|
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
19
|
required?: boolean | (() => boolean);
|
|
20
|
-
|
|
20
|
+
originalDiffTip?: boolean;
|
|
21
21
|
globalControl?: boolean;
|
|
22
22
|
}
|
|
23
23
|
declare const RenderFields: React.FC<Props>;
|
|
@@ -25,7 +25,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
25
25
|
outerClearNotShow = props.clearNotShow,
|
|
26
26
|
requiredOnView = props.requiredOnView,
|
|
27
27
|
required = props.required,
|
|
28
|
-
|
|
28
|
+
originalDiffTip = props.originalDiffTip,
|
|
29
29
|
globalControl = props.globalControl;
|
|
30
30
|
// 是否包含隐藏字段
|
|
31
31
|
var hiddenData = columns.filter(function (item) {
|
|
@@ -176,7 +176,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
176
176
|
form: form,
|
|
177
177
|
type: _type,
|
|
178
178
|
hiddenNames: column.hiddenNames,
|
|
179
|
-
colProps: _colProps
|
|
179
|
+
colProps: _colProps,
|
|
180
|
+
mode: componentProps.mode
|
|
180
181
|
};
|
|
181
182
|
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)) {
|
|
182
183
|
setTimeout(function () {
|
|
@@ -205,7 +206,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
205
206
|
originalValues: originalValues,
|
|
206
207
|
equalWith: equalWith,
|
|
207
208
|
requiredOnView: requiredOnView,
|
|
208
|
-
|
|
209
|
+
originalDiffTip: originalDiffTip,
|
|
209
210
|
globalControl: globalControl
|
|
210
211
|
})
|
|
211
212
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|