@zat-design/sisyphus-react 3.4.2-beta.2 → 3.4.2-beta.21
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 +257 -127
- package/dist/less.esm.css +5028 -0
- package/dist/less.esm.js +3 -0
- package/es/ProEditTable/components/RenderField/index.js +13 -15
- 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/ProEditTable/utils/tools.js +3 -1
- package/es/ProEnum/components/Group.d.ts +1 -0
- package/es/ProEnum/components/Group.js +21 -8
- package/es/ProEnum/index.js +4 -2
- package/es/ProEnum/style/index.less +12 -3
- package/es/ProForm/components/combination/Group/index.js +8 -9
- package/es/ProForm/components/combination/Group/propsType.d.ts +1 -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/style/index.less +1 -1
- package/es/ProForm/components/render/Render.js +2 -2
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/RenderFields.js +2 -2
- package/es/ProForm/index.js +4 -4
- package/es/ProForm/propsType.d.ts +1 -1
- package/es/ProForm/style/index.less +16 -2
- 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/ProIcon/index.d.ts +0 -1
- package/es/ProIcon/index.js +7 -29
- 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 -5
- package/es/ProLayout/components/ProCollapse/index.js +22 -6
- package/es/ProLayout/components/ProCollapse/style/index.less +24 -21
- 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 +2 -1
- 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/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/index.js +21 -28
- package/es/ProThemeTools/propsType.d.ts +1 -1
- package/es/ProThemeTools/style/index.less +25 -8
- package/es/assets/catalog.svg +30 -1
- package/es/assets/fold.svg +27 -0
- package/es/assets/setting.svg +14 -0
- package/es/style/less.less +2 -0
- package/es/style/theme/antd.less +0 -1
- package/lib/ProEditTable/components/RenderField/index.js +12 -14
- 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/ProEditTable/utils/tools.js +3 -1
- package/lib/ProEnum/components/Group.d.ts +1 -0
- package/lib/ProEnum/components/Group.js +21 -8
- package/lib/ProEnum/index.js +4 -2
- package/lib/ProEnum/style/index.less +12 -3
- package/lib/ProForm/components/combination/Group/index.js +6 -7
- package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -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/style/index.less +1 -1
- package/lib/ProForm/components/render/Render.js +2 -2
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/RenderFields.js +2 -2
- package/lib/ProForm/index.js +4 -4
- package/lib/ProForm/propsType.d.ts +1 -1
- package/lib/ProForm/style/index.less +16 -2
- 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/ProIcon/index.d.ts +0 -1
- package/lib/ProIcon/index.js +7 -30
- 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 -5
- package/lib/ProLayout/components/ProCollapse/index.js +20 -6
- package/lib/ProLayout/components/ProCollapse/style/index.less +24 -21
- 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 +2 -1
- 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/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/index.js +19 -27
- package/lib/ProThemeTools/propsType.d.ts +1 -1
- package/lib/ProThemeTools/style/index.less +25 -8
- package/lib/assets/catalog.svg +30 -1
- package/lib/assets/fold.svg +27 -0
- package/lib/assets/setting.svg +14 -0
- package/lib/style/less.less +2 -0
- package/lib/style/theme/antd.less +0 -1
- 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
|
@@ -89,40 +89,77 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
89
89
|
index = _utils.tools.calc(firstIndex, '+', index);
|
|
90
90
|
rowName = [].concat((0, _toConsumableArray2.default)(virtualRowName), [index]);
|
|
91
91
|
if (!(type === 'save')) {
|
|
92
|
-
_context.next =
|
|
92
|
+
_context.next = 12;
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
|
-
_context.
|
|
95
|
+
_context.prev = 3;
|
|
96
|
+
_context.next = 6;
|
|
96
97
|
return (0, _tools.customValidate)(validateKeys, form, rowName);
|
|
97
|
-
case
|
|
98
|
+
case 6:
|
|
99
|
+
_context.next = 12;
|
|
100
|
+
break;
|
|
101
|
+
case 8:
|
|
102
|
+
_context.prev = 8;
|
|
103
|
+
_context.t0 = _context["catch"](3);
|
|
104
|
+
setTimeout(function () {
|
|
105
|
+
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
106
|
+
if (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
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, 0);
|
|
133
|
+
return _context.abrupt("return", Promise.reject(_context.t0));
|
|
134
|
+
case 12:
|
|
98
135
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
|
99
136
|
_record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
|
|
100
137
|
onEvent = onClick || onHandle;
|
|
101
|
-
_context.next =
|
|
138
|
+
_context.next = 16;
|
|
102
139
|
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
|
|
103
140
|
form: form,
|
|
104
141
|
namePath: virtualRowName
|
|
105
142
|
});
|
|
106
|
-
case
|
|
107
|
-
_context.
|
|
108
|
-
_context.
|
|
109
|
-
if (!_context.
|
|
110
|
-
_context.next =
|
|
143
|
+
case 16:
|
|
144
|
+
_context.t2 = _yield$onEvent = _context.sent;
|
|
145
|
+
_context.t1 = _context.t2 !== null;
|
|
146
|
+
if (!_context.t1) {
|
|
147
|
+
_context.next = 20;
|
|
111
148
|
break;
|
|
112
149
|
}
|
|
113
|
-
_context.
|
|
114
|
-
case
|
|
115
|
-
if (!_context.
|
|
116
|
-
_context.next =
|
|
150
|
+
_context.t1 = _yield$onEvent !== void 0;
|
|
151
|
+
case 20:
|
|
152
|
+
if (!_context.t1) {
|
|
153
|
+
_context.next = 24;
|
|
117
154
|
break;
|
|
118
155
|
}
|
|
119
|
-
_context.
|
|
120
|
-
_context.next =
|
|
156
|
+
_context.t3 = _yield$onEvent;
|
|
157
|
+
_context.next = 25;
|
|
121
158
|
break;
|
|
122
|
-
case
|
|
123
|
-
_context.
|
|
124
|
-
case
|
|
125
|
-
result = _context.
|
|
159
|
+
case 24:
|
|
160
|
+
_context.t3 = true;
|
|
161
|
+
case 25:
|
|
162
|
+
result = _context.t3;
|
|
126
163
|
if (result && type !== 'custom') {
|
|
127
164
|
_config.actions[type]((0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
|
|
128
165
|
rowName: [].concat((0, _toConsumableArray2.default)(name), [index]),
|
|
@@ -132,11 +169,11 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
132
169
|
validateKeys: validateKeys
|
|
133
170
|
}));
|
|
134
171
|
}
|
|
135
|
-
case
|
|
172
|
+
case 27:
|
|
136
173
|
case "end":
|
|
137
174
|
return _context.stop();
|
|
138
175
|
}
|
|
139
|
-
}, _callee);
|
|
176
|
+
}, _callee, null, [[3, 8]]);
|
|
140
177
|
}));
|
|
141
178
|
return function (_x, _x2) {
|
|
142
179
|
return _ref.apply(this, arguments);
|
|
@@ -214,10 +251,10 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
214
251
|
if (typeof columnTitle === 'string') {
|
|
215
252
|
item.originTitle = columnTitle;
|
|
216
253
|
if (tooltip) {
|
|
217
|
-
var
|
|
218
|
-
tooltipTitle =
|
|
219
|
-
icon =
|
|
220
|
-
resetProps = (0, _objectWithoutProperties2.default)(
|
|
254
|
+
var _ref3 = tooltip || {},
|
|
255
|
+
tooltipTitle = _ref3.title,
|
|
256
|
+
icon = _ref3.icon,
|
|
257
|
+
resetProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
221
258
|
item.title = (0, _jsxRuntime.jsxs)("span", {
|
|
222
259
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
|
223
260
|
children: [before, columnTitle, (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
@@ -284,7 +321,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
284
321
|
(_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
|
|
285
322
|
}
|
|
286
323
|
var _render = function _render(text, record, index) {
|
|
287
|
-
var isEditing = !virtualKey || editingKeys.includes(record.rowKey);
|
|
324
|
+
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
|
288
325
|
var namePath = (0, _lodash.isArray)(name) ? name : [name];
|
|
289
326
|
if (virtualKey && editingKeys.includes(record.rowKey)) {
|
|
290
327
|
namePath = (0, _tools.getNamePath)(name, virtualKey);
|
|
@@ -369,13 +406,13 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
369
406
|
// cacheMap 用来存储缓存值,若有值后不再请求
|
|
370
407
|
if (JSON.stringify(cacheMap.current) === '{}') {
|
|
371
408
|
Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
|
|
372
|
-
var
|
|
373
|
-
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;
|
|
374
411
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
375
412
|
while (1) switch (_context2.prev = _context2.next) {
|
|
376
413
|
case 0:
|
|
377
414
|
_item = (0, _slicedToArray2.default)(item, 2), key = _item[0], value = _item[1];
|
|
378
|
-
|
|
415
|
+
_ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
|
|
379
416
|
if (!service) {
|
|
380
417
|
_context2.next = 8;
|
|
381
418
|
break;
|
|
@@ -395,7 +432,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
395
432
|
}, _callee2);
|
|
396
433
|
}));
|
|
397
434
|
return function (_x3) {
|
|
398
|
-
return
|
|
435
|
+
return _ref4.apply(this, arguments);
|
|
399
436
|
};
|
|
400
437
|
}())).then(function (res) {
|
|
401
438
|
res.forEach(function (item) {
|
|
@@ -12,7 +12,9 @@ var getRandom = exports.getRandom = function getRandom() {
|
|
|
12
12
|
var difference = exports.difference = function difference(object, base) {
|
|
13
13
|
var changes = function changes(object, base) {
|
|
14
14
|
return (0, _lodash.transform)(object, function (result, value, key) {
|
|
15
|
-
if (
|
|
15
|
+
if (key.indexOf('-') > -1) {
|
|
16
|
+
result[key] = true;
|
|
17
|
+
} else if (!(0, _lodash.isEqual)(value, base[key])) {
|
|
16
18
|
result[key] = (0, _lodash.isObject)(value) && (0, _lodash.isObject)(base[key]) ? changes(value, base[key]) : value;
|
|
17
19
|
}
|
|
18
20
|
});
|
|
@@ -15,7 +15,8 @@ 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;
|
|
19
20
|
var idx = (0, _react.useRef)(-1);
|
|
20
21
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
21
22
|
checked: ''
|
|
@@ -27,13 +28,25 @@ var Group = function Group(props) {
|
|
|
27
28
|
setState({
|
|
28
29
|
checked: value
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
setState({
|
|
33
|
-
checked: val
|
|
31
|
+
var index = dataSource.findIndex(function (item) {
|
|
32
|
+
return item[fieldValue] === value;
|
|
34
33
|
});
|
|
35
34
|
idx.current = index;
|
|
36
|
-
|
|
35
|
+
}, [value]);
|
|
36
|
+
var handleClick = function handleClick(val, index) {
|
|
37
|
+
if (state.checked === val) {
|
|
38
|
+
setState({
|
|
39
|
+
checked: ''
|
|
40
|
+
});
|
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('');
|
|
42
|
+
idx.current = -1;
|
|
43
|
+
} else {
|
|
44
|
+
setState({
|
|
45
|
+
checked: val
|
|
46
|
+
});
|
|
47
|
+
idx.current = index;
|
|
48
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(val);
|
|
49
|
+
}
|
|
37
50
|
};
|
|
38
51
|
if (dataSource.length === 0) {
|
|
39
52
|
return (0, _jsxRuntime.jsx)("span", {
|
|
@@ -41,11 +54,11 @@ var Group = function Group(props) {
|
|
|
41
54
|
});
|
|
42
55
|
}
|
|
43
56
|
return (0, _jsxRuntime.jsx)("div", {
|
|
44
|
-
className:
|
|
57
|
+
className: (0, _classnames.default)('pro-enum-group-root', disabled ? 'pro-enum-group-root-disabled' : ''),
|
|
45
58
|
children: dataSource.map(function (item, index) {
|
|
46
59
|
return (0, _jsxRuntime.jsx)("div", {
|
|
47
60
|
onClick: function onClick() {
|
|
48
|
-
if (!item.disabled) {
|
|
61
|
+
if (!item.disabled && !disabled) {
|
|
49
62
|
handleClick(item[fieldValue], index);
|
|
50
63
|
}
|
|
51
64
|
},
|
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,
|
|
@@ -213,7 +214,8 @@ var ProEnum = function ProEnum(props) {
|
|
|
213
214
|
onChange: onChange,
|
|
214
215
|
fieldLabel: label,
|
|
215
216
|
fieldValue: fieldValue,
|
|
216
|
-
dataSource: list
|
|
217
|
+
dataSource: list,
|
|
218
|
+
disabled: disabled
|
|
217
219
|
});
|
|
218
220
|
default:
|
|
219
221
|
return null;
|
|
@@ -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
|
}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
11
|
var _antd = require("antd");
|
|
13
12
|
var _react = require("react");
|
|
@@ -27,11 +26,8 @@ var Group = function Group(props) {
|
|
|
27
26
|
} : _props$space,
|
|
28
27
|
id = props.id,
|
|
29
28
|
value = props.value,
|
|
29
|
+
isView = props.isView,
|
|
30
30
|
onFieldChange = props.onFieldChange;
|
|
31
|
-
var _useCounter = (0, _ahooks.useCounter)(0),
|
|
32
|
-
_useCounter2 = (0, _slicedToArray2.default)(_useCounter, 2),
|
|
33
|
-
num = _useCounter2[0],
|
|
34
|
-
inc = _useCounter2[1].inc;
|
|
35
31
|
var _ref = _ProForm.default.useFieldProps() || {},
|
|
36
32
|
names = _ref.names,
|
|
37
33
|
name = _ref.name,
|
|
@@ -45,6 +41,7 @@ var Group = function Group(props) {
|
|
|
45
41
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
46
42
|
disabled: Boolean(props === null || props === void 0 ? void 0 : props.disabled)
|
|
47
43
|
}, item), {}, {
|
|
44
|
+
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
48
45
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
49
46
|
parentNames: id
|
|
50
47
|
});
|
|
@@ -69,13 +66,15 @@ var Group = function Group(props) {
|
|
|
69
66
|
})
|
|
70
67
|
}, "".concat(className), className));
|
|
71
68
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
69
|
+
var _document, _document$activeEleme;
|
|
70
|
+
// 焦点激活的表单
|
|
71
|
+
var touchName = ((_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.id) || '';
|
|
72
72
|
// 模拟change,初始化不执行onFieldChange
|
|
73
|
-
if ((0, _lodash.isFunction)(onFieldChange) &&
|
|
73
|
+
if ((0, _lodash.isFunction)(onFieldChange) && form.isFieldsTouched(names) && (0, _utils.transformNamesString)(names).includes(touchName)) {
|
|
74
74
|
onFieldChange(value, form.getFieldsValue(), {
|
|
75
75
|
form: form
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
inc();
|
|
79
78
|
}, [value]);
|
|
80
79
|
return (0, _jsxRuntime.jsx)("div", {
|
|
81
80
|
className: _className,
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.start-radius() {
|
|
12
|
-
border-start-start-radius:
|
|
13
|
-
border-end-start-radius:
|
|
12
|
+
border-start-start-radius: 4px;
|
|
13
|
+
border-end-start-radius: 4px;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.end-radius() {
|
|
17
|
-
border-start-end-radius:
|
|
18
|
-
border-end-end-radius:
|
|
17
|
+
border-start-end-radius: 4px;
|
|
18
|
+
border-end-end-radius: 4px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.pro-group {
|
|
@@ -6,3 +6,5 @@ import { SpaceType } from './propsType';
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
export declare const insertSeparator: (columns: any, space?: SpaceType, separatorNode?: ReactNode, otherProps?: any) => any;
|
|
9
|
+
/** 转换names */
|
|
10
|
+
export declare const transformNamesString: (arr: (string | string[])[]) => (string | string[])[];
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.insertSeparator = void 0;
|
|
7
|
+
exports.transformNamesString = exports.insertSeparator = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
9
|
/**
|
|
10
10
|
* 插入间隔符
|
|
@@ -40,4 +40,14 @@ var insertSeparator = exports.insertSeparator = function insertSeparator(columns
|
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
}, []);
|
|
43
|
+
};
|
|
44
|
+
/** 转换names */
|
|
45
|
+
var transformNamesString = exports.transformNamesString = function transformNamesString(arr) {
|
|
46
|
+
var result = arr.map(function (subArr) {
|
|
47
|
+
if (Array.isArray(subArr)) {
|
|
48
|
+
return subArr.join('_');
|
|
49
|
+
}
|
|
50
|
+
return subArr;
|
|
51
|
+
});
|
|
52
|
+
return result;
|
|
43
53
|
};
|
|
@@ -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(
|
|
@@ -50,7 +50,7 @@ var Render = function Render(props) {
|
|
|
50
50
|
originalValues = props.originalValues,
|
|
51
51
|
equalWith = props.equalWith,
|
|
52
52
|
requiredOnView = props.requiredOnView,
|
|
53
|
-
|
|
53
|
+
originalDiffTip = props.originalDiffTip,
|
|
54
54
|
confirm = props.confirm,
|
|
55
55
|
globalControl = props.globalControl;
|
|
56
56
|
var colProps = props.colProps;
|
|
@@ -432,7 +432,7 @@ var Render = function Render(props) {
|
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
434
|
// 不渲染tooltip
|
|
435
|
-
if (!
|
|
435
|
+
if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
436
436
|
return formItem;
|
|
437
437
|
}
|
|
438
438
|
var title = (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
@@ -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>;
|
|
@@ -33,7 +33,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
33
33
|
outerClearNotShow = props.clearNotShow,
|
|
34
34
|
requiredOnView = props.requiredOnView,
|
|
35
35
|
required = props.required,
|
|
36
|
-
|
|
36
|
+
originalDiffTip = props.originalDiffTip,
|
|
37
37
|
globalControl = props.globalControl;
|
|
38
38
|
// 是否包含隐藏字段
|
|
39
39
|
var hiddenData = columns.filter(function (item) {
|
|
@@ -213,7 +213,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
213
213
|
originalValues: originalValues,
|
|
214
214
|
equalWith: equalWith,
|
|
215
215
|
requiredOnView: requiredOnView,
|
|
216
|
-
|
|
216
|
+
originalDiffTip: originalDiffTip,
|
|
217
217
|
globalControl: globalControl
|
|
218
218
|
})
|
|
219
219
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
package/lib/ProForm/index.js
CHANGED
|
@@ -25,7 +25,7 @@ var _index = require("./utils/index");
|
|
|
25
25
|
var _useForm3 = require("./utils/useForm");
|
|
26
26
|
var _useFieldProps = require("./utils/useFieldProps");
|
|
27
27
|
var _locale = _interopRequireDefault(require("../locale"));
|
|
28
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "
|
|
28
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "originalValues", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "originalDiffTip", "formKey", "globalControl"];
|
|
29
29
|
var ProForm = function ProForm(props, ref) {
|
|
30
30
|
var _forms$formKey, _localStorage;
|
|
31
31
|
var _props$mode = props.mode,
|
|
@@ -64,8 +64,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
64
64
|
requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
|
|
65
65
|
formId = props.formId,
|
|
66
66
|
required = props.required,
|
|
67
|
-
_props$
|
|
68
|
-
|
|
67
|
+
_props$originalDiffTi = props.originalDiffTip,
|
|
68
|
+
originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
|
|
69
69
|
formKey = props.formKey,
|
|
70
70
|
globalControl = props.globalControl,
|
|
71
71
|
otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
@@ -255,7 +255,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
255
255
|
clearNotShow: clearNotShow,
|
|
256
256
|
requiredOnView: requiredOnView,
|
|
257
257
|
required: required,
|
|
258
|
-
|
|
258
|
+
originalDiffTip: originalDiffTip,
|
|
259
259
|
globalControl: globalControl
|
|
260
260
|
}), children, footerRender()]
|
|
261
261
|
}))
|
|
@@ -69,7 +69,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
69
69
|
requiredOnView?: boolean;
|
|
70
70
|
formId?: string;
|
|
71
71
|
required?: boolean;
|
|
72
|
-
|
|
72
|
+
originalDiffTip?: boolean;
|
|
73
73
|
}
|
|
74
74
|
export interface Transform<T = any> {
|
|
75
75
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
|
@@ -147,8 +147,22 @@
|
|
|
147
147
|
border-radius: 4px;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
//
|
|
151
|
-
.@{ant-prefix}-form-item-control-input-content
|
|
150
|
+
// 地址组件
|
|
151
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
152
|
+
& > .pro-address {
|
|
153
|
+
.ant-select-selector,
|
|
154
|
+
.ant-input-affix-wrapper,
|
|
155
|
+
.ant-input-disabled {
|
|
156
|
+
background: @zaui-contract-bg;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
& > .ant-input-group {
|
|
160
|
+
.forever-checkbox {
|
|
161
|
+
background: @zaui-contract-bg;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
152
166
|
.pro-form-view-container {
|
|
153
167
|
padding: 4px 8px;
|
|
154
168
|
background: @zaui-contract-bg;
|
|
@@ -3,7 +3,8 @@ interface Params {
|
|
|
3
3
|
originalValue: any;
|
|
4
4
|
value: any;
|
|
5
5
|
form: FormInstance;
|
|
6
|
+
name?: string | any[];
|
|
6
7
|
equalWith?: (originalValue: any, currentValue: any) => boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const
|
|
9
|
+
export declare const diffOriginal: (params: Params) => boolean;
|
|
9
10
|
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.diffOriginal = void 0;
|
|
8
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
9
|
+
var _lodash = require("lodash");
|
|
10
|
+
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
11
|
+
var extractValue = function extractValue(obj, path) {
|
|
12
|
+
var value = obj || {};
|
|
13
|
+
if (!Object.keys(obj)) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(path),
|
|
17
|
+
_step;
|
|
18
|
+
try {
|
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
+
var key = _step.value;
|
|
21
|
+
if (value && value.hasOwnProperty(key)) {
|
|
22
|
+
value = value[key];
|
|
23
|
+
} else {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
_iterator.e(err);
|
|
29
|
+
} finally {
|
|
30
|
+
_iterator.f();
|
|
31
|
+
}
|
|
32
|
+
return Object.values(value);
|
|
33
|
+
};
|
|
34
|
+
/** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
|
|
35
|
+
var extractValues = function extractValues(data, pathString) {
|
|
36
|
+
if (pathString.includes('_')) {
|
|
37
|
+
var namePrefixes = pathString.split('-')[0].split('_').slice(0, -1);
|
|
38
|
+
return extractValue(data, namePrefixes);
|
|
39
|
+
}
|
|
40
|
+
return pathString.split('-').map(function (item) {
|
|
41
|
+
return data[item];
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
45
|
+
var originalValue = params.originalValue,
|
|
46
|
+
_value = params.value,
|
|
47
|
+
equalWith = params.equalWith,
|
|
48
|
+
form = params.form,
|
|
49
|
+
name = params.name;
|
|
50
|
+
var value = !(name === null || name === void 0 ? void 0 : name.includes('-')) ? _value : extractValues(form.getFieldsValue(), name);
|
|
51
|
+
// 支持传入自定义比较事件
|
|
52
|
+
if ((0, _lodash.isFunction)(equalWith)) {
|
|
53
|
+
return !equalWith(originalValue, value);
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(originalValue)) {
|
|
56
|
+
return originalValue.some(function (valueItem, index) {
|
|
57
|
+
// 如果两个值有一个不是空值, 则进行深比较
|
|
58
|
+
if (!nullValue.includes(value === null || value === void 0 ? void 0 : value[index]) || !nullValue.includes(valueItem)) {
|
|
59
|
+
return !(0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (!nullValue.includes(value) || !nullValue.includes(originalValue)) {
|
|
65
|
+
return !(0, _lodash.isEqual)(value, originalValue);
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
};
|
|
@@ -26,7 +26,7 @@ export declare const isTrim: (type: string, trim: boolean, configData: any) => a
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const isUpperCase: (type: string, upperCase: boolean) => any;
|
|
28
28
|
export declare const weedOutProps: (data: Record<string, any>, keys: string[]) => {}[];
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const diffField: (prevValues: any, curValues: any, names: NamePath[]) => boolean;
|
|
30
30
|
export declare const splitNameStr: (name: string) => NamePath[];
|
|
31
31
|
export declare const filterInternalFields: (values: any) => any;
|
|
32
32
|
export declare const getAllNamePath: (object: Record<string, any>, currentPath?: InternalNamePath) => InternalNamePath[];
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.getAllNamePath = exports.findOptionByValue = exports.filterInternalFields = exports.equalDependencies = exports.
|
|
8
|
+
exports.getAllNamePath = exports.findOptionByValue = exports.filterInternalFields = exports.equalDependencies = exports.diffField = exports.deleteForPath = exports.customEqualForFun = void 0;
|
|
9
9
|
exports.getArrayBeforeNumber = getArrayBeforeNumber;
|
|
10
10
|
exports.hasRowKey = exports.getLayout = exports.getDecimalDigits = void 0;
|
|
11
11
|
exports.initialValuesToNames = initialValuesToNames;
|
|
@@ -124,7 +124,7 @@ var weedOutProps = exports.weedOutProps = function weedOutProps(data, keys) {
|
|
|
124
124
|
return [obj, weedOut];
|
|
125
125
|
};
|
|
126
126
|
// 对比字段变化
|
|
127
|
-
var
|
|
127
|
+
var diffField = exports.diffField = function diffField(prevValues, curValues, names) {
|
|
128
128
|
return names.some(function (name) {
|
|
129
129
|
return _lodash.default.get(prevValues, name) !== _lodash.default.get(curValues, name);
|
|
130
130
|
});
|
|
@@ -48,7 +48,7 @@ var transformValue = exports.transformValue = function transformValue(names, for
|
|
|
48
48
|
}, cusRest);
|
|
49
49
|
},
|
|
50
50
|
shouldUpdate: function shouldUpdate(prevValues, curValues) {
|
|
51
|
-
return (0, _utils.
|
|
51
|
+
return (0, _utils.diffField)(prevValues, curValues, names);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
};
|