@zat-design/sisyphus-react 3.4.5 → 3.4.6-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +151 -35
- package/dist/less.esm.css +151 -35
- package/es/ProConfigProvider/index.d.ts +2 -2
- package/es/ProConfigProvider/index.js +0 -3
- package/es/ProEditTable/components/RenderField/index.js +56 -48
- package/es/ProEditTable/index.js +3 -3
- package/es/ProEditTable/style/index.less +5 -7
- package/es/ProEditTable/utils/tools.d.ts +12 -0
- package/es/ProEditTable/utils/tools.js +79 -2
- package/es/ProForm/components/base/RangePicker/index.js +9 -9
- package/es/ProForm/components/base/TextArea/index.d.ts +1 -0
- package/es/ProForm/components/base/TextArea/index.js +4 -2
- package/es/ProForm/components/combination/Container/index.js +3 -2
- package/es/ProForm/components/combination/Container/style/index.less +5 -1
- package/es/ProForm/components/combination/FormList/index.js +1 -0
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProCascader/index.js +256 -0
- package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
- package/es/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
- package/es/ProForm/components/combination/ProCascader/utils/index.js +26 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +47 -33
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
- package/es/ProForm/components/combination/ProRangeLimit/index.js +17 -10
- package/es/ProForm/components/index.d.ts +1 -2
- package/es/ProForm/components/index.js +1 -4
- package/es/ProForm/components/render/Render.js +25 -20
- package/es/ProForm/components/render/RenderFields.js +4 -1
- package/es/ProForm/components/render/propsType.d.ts +5 -8
- package/es/ProForm/index.js +6 -2
- package/es/ProForm/propsType.d.ts +3 -0
- package/es/ProForm/style/index.less +2 -1
- package/es/ProForm/utils/index.d.ts +6 -1
- package/es/ProForm/utils/index.js +9 -6
- package/es/ProForm/utils/useChanged.js +1 -2
- package/es/ProForm/utils/useForm.js +19 -6
- package/es/ProForm/utils/useListChanged.js +1 -3
- package/es/ProIcon/config/index.d.ts +2 -0
- package/es/ProIcon/config/index.js +4 -2
- package/es/ProIcon/index.js +148 -81
- package/es/ProIcon/propsTypes.d.ts +6 -1
- package/es/ProIcon/utils/index.d.ts +5 -0
- package/es/ProIcon/utils/index.js +60 -0
- package/es/ProLayout/components/ProCollapse/index.js +6 -3
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProSelect/index.js +15 -3
- package/es/ProSelect/propsType.d.ts +2 -0
- package/es/ProSelect/utils/index.d.ts +9 -0
- package/es/ProSelect/utils/index.js +60 -0
- package/es/ProStep/components/Step/index.js +4 -3
- package/es/ProStep/style/index.less +37 -0
- package/es/ProTable/utils.js +6 -3
- package/es/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +16 -6
- package/es/ProThemeTools/component/PrdTools/style/index.less +56 -48
- package/es/ProTree/components/ProTree.js +96 -74
- package/es/ProTree/components/ProTreeSelect/index.js +5 -9
- package/es/ProTree/components/ProTreeSelect/style/index.less +6 -8
- package/es/ProTree/components/Tree.js +63 -41
- package/es/ProTree/style/index.less +38 -16
- package/es/ProUpload/index.js +11 -13
- package/es/ProUpload/propsType.d.ts +8 -3
- package/es/assets/view.svg +2 -2
- package/es/global.less +37 -28
- package/lib/ProConfigProvider/index.d.ts +2 -2
- package/lib/ProConfigProvider/index.js +0 -3
- package/lib/ProEditTable/components/RenderField/index.js +54 -46
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/style/index.less +5 -7
- package/lib/ProEditTable/utils/tools.d.ts +12 -0
- package/lib/ProEditTable/utils/tools.js +80 -2
- package/lib/ProForm/components/base/RangePicker/index.js +9 -9
- package/lib/ProForm/components/base/TextArea/index.d.ts +1 -0
- package/lib/ProForm/components/base/TextArea/index.js +4 -2
- package/lib/ProForm/components/combination/Container/index.js +3 -2
- package/lib/ProForm/components/combination/Container/style/index.less +5 -1
- package/lib/ProForm/components/combination/FormList/index.js +1 -0
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProCascader/index.js +256 -0
- package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.d.ts +9 -6
- package/lib/ProForm/components/combination/ProCascader/utils/index.d.ts +14 -0
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +33 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +46 -32
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +23 -0
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +2 -2
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +17 -10
- package/lib/ProForm/components/index.d.ts +1 -2
- package/lib/ProForm/components/index.js +1 -8
- package/lib/ProForm/components/render/Render.js +25 -20
- package/lib/ProForm/components/render/RenderFields.js +4 -1
- package/lib/ProForm/components/render/propsType.d.ts +5 -8
- package/lib/ProForm/index.js +5 -1
- package/lib/ProForm/propsType.d.ts +3 -0
- package/lib/ProForm/style/index.less +2 -1
- package/lib/ProForm/utils/index.d.ts +6 -1
- package/lib/ProForm/utils/index.js +9 -6
- package/lib/ProForm/utils/useChanged.js +1 -2
- package/lib/ProForm/utils/useForm.js +19 -6
- package/lib/ProForm/utils/useListChanged.js +1 -3
- package/lib/ProIcon/config/index.d.ts +2 -0
- package/lib/ProIcon/config/index.js +4 -2
- package/lib/ProIcon/index.js +144 -77
- package/lib/ProIcon/propsTypes.d.ts +6 -1
- package/lib/ProIcon/utils/index.d.ts +5 -0
- package/lib/ProIcon/utils/index.js +62 -1
- package/lib/ProLayout/components/ProCollapse/index.js +6 -3
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProSelect/index.js +15 -3
- package/lib/ProSelect/propsType.d.ts +2 -0
- package/lib/ProSelect/utils/index.d.ts +9 -0
- package/lib/ProSelect/utils/index.js +68 -0
- package/lib/ProStep/components/Step/index.js +4 -3
- package/lib/ProStep/style/index.less +37 -0
- package/lib/ProTable/utils.js +6 -3
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +16 -6
- package/lib/ProThemeTools/component/PrdTools/style/index.less +56 -48
- package/lib/ProTree/components/ProTree.js +96 -74
- package/lib/ProTree/components/ProTreeSelect/index.js +5 -9
- package/lib/ProTree/components/ProTreeSelect/style/index.less +6 -8
- package/lib/ProTree/components/Tree.js +63 -41
- package/lib/ProTree/style/index.less +38 -16
- package/lib/ProUpload/index.js +10 -12
- package/lib/ProUpload/propsType.d.ts +8 -3
- package/lib/assets/view.svg +2 -2
- package/lib/global.less +37 -28
- package/package.json +2 -2
- package/es/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/es/ProForm/components/base/ProCascader/index.js +0 -72
- package/es/ProForm/components/combination/ProAddressBar/index.js +0 -437
- package/lib/ProForm/components/base/ProCascader/index.d.ts +0 -14
- package/lib/ProForm/components/base/ProCascader/index.js +0 -78
- package/lib/ProForm/components/combination/ProAddressBar/index.js +0 -437
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
- /package/es/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/propsType.js +0 -0
- /package/lib/ProForm/components/combination/{ProAddressBar → ProCascader}/style/index.less +0 -0
|
@@ -11,7 +11,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
11
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
12
12
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
|
-
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className"];
|
|
14
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim"];
|
|
15
15
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
/* eslint-disable prefer-destructuring */
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
@@ -20,16 +20,17 @@ import classNames from 'classnames';
|
|
|
20
20
|
import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
|
-
import { getNamePath, difference } from '../../utils/tools';
|
|
23
|
+
import { getNamePath, difference, getDisabled } from '../../utils/tools';
|
|
24
24
|
import * as componentMap from '../../../ProForm/components';
|
|
25
|
+
import { useProConfig } from '../../../ProConfigProvider';
|
|
25
26
|
import Container from '../../../ProForm/components/Container';
|
|
26
27
|
import transformNames from '../../../ProForm/utils/transformNames';
|
|
27
28
|
import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
|
|
28
29
|
import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
29
30
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
|
-
import { isSelect } from '../../../ProForm/utils';
|
|
31
|
+
import { isSelect, isTrim } from '../../../ProForm/utils';
|
|
31
32
|
var RenderField = function RenderField(_ref) {
|
|
32
|
-
var _type, _type$replace, _fieldProps2,
|
|
33
|
+
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
|
|
33
34
|
var value = _ref.text,
|
|
34
35
|
record = _ref.record,
|
|
35
36
|
index = _ref.index,
|
|
@@ -56,6 +57,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
56
57
|
rules = _column$rules === void 0 ? [] : _column$rules,
|
|
57
58
|
equalWith = column.equalWith,
|
|
58
59
|
className = column.className,
|
|
60
|
+
trim = column.trim,
|
|
59
61
|
resetProps = _objectWithoutProperties(column, _excluded);
|
|
60
62
|
// editRender弃用使用component同ProForm
|
|
61
63
|
var _editRender = component || editRender;
|
|
@@ -75,7 +77,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
75
77
|
formNamePath = config.namePath,
|
|
76
78
|
_config$originalDiffT = config.originalDiffTip,
|
|
77
79
|
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT,
|
|
78
|
-
rowDisabled = config.rowDisabled
|
|
80
|
+
rowDisabled = config.rowDisabled,
|
|
81
|
+
otherProps = config.otherProps;
|
|
79
82
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
80
83
|
var _rules = rules || [];
|
|
81
84
|
var _required = required;
|
|
@@ -96,35 +99,41 @@ var RenderField = function RenderField(_ref) {
|
|
|
96
99
|
form: form,
|
|
97
100
|
namePath: [].concat(_toConsumableArray(namePath), [index])
|
|
98
101
|
};
|
|
102
|
+
// 行参数
|
|
103
|
+
var rowParams = [currentValue, rowData, options];
|
|
99
104
|
if (typeof isEditable === 'function') {
|
|
100
|
-
isEditable = isEditable(
|
|
105
|
+
isEditable = isEditable.apply(void 0, rowParams);
|
|
101
106
|
}
|
|
107
|
+
// 获取最终的disabled
|
|
108
|
+
_disabled = getDisabled({
|
|
109
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
110
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
111
|
+
column: column,
|
|
112
|
+
tabledDisabled: config === null || config === void 0 ? void 0 : config.disabled,
|
|
113
|
+
columnFieldProps: _fieldProps,
|
|
114
|
+
params: rowParams
|
|
115
|
+
});
|
|
102
116
|
// 是否只读文本
|
|
103
|
-
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || (
|
|
117
|
+
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || getDisabled({
|
|
118
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
119
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
120
|
+
column: column,
|
|
121
|
+
tabledDisabled: config === null || config === void 0 ? void 0 : config.disabled,
|
|
122
|
+
columnFieldProps: _fieldProps,
|
|
123
|
+
params: rowParams,
|
|
124
|
+
rowDisabled: rowDisabled || 'empty'
|
|
125
|
+
});
|
|
104
126
|
// 只读文本时,采用当前formItem的name,单行编辑时,使用生成的虚拟的name
|
|
105
127
|
var baseName = isView ? name : namePath;
|
|
106
128
|
var TargetComponent;
|
|
107
|
-
if (
|
|
108
|
-
_required = required(
|
|
109
|
-
}
|
|
110
|
-
if (typeof fieldProps === 'function') {
|
|
111
|
-
_fieldProps = fieldProps(currentValue, rowData, options);
|
|
112
|
-
}
|
|
113
|
-
if (typeof ((_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.disabled) === 'function') {
|
|
114
|
-
_disabled = _fieldProps.disabled(currentValue, rowData, options);
|
|
115
|
-
} else if (((_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.disabled) === true) {
|
|
116
|
-
_disabled = _fieldProps.disabled;
|
|
117
|
-
}
|
|
118
|
-
if (typeof column.disabled === 'function') {
|
|
119
|
-
_disabled = column.disabled(currentValue, rowData, options);
|
|
120
|
-
} else if (column.disabled === true) {
|
|
121
|
-
_disabled = column.disabled;
|
|
129
|
+
if (isFunction(required)) {
|
|
130
|
+
_required = required.apply(void 0, rowParams);
|
|
122
131
|
}
|
|
123
|
-
if ((
|
|
124
|
-
|
|
132
|
+
if (isFunction(fieldProps)) {
|
|
133
|
+
_fieldProps = fieldProps.apply(void 0, rowParams);
|
|
125
134
|
}
|
|
126
|
-
if (
|
|
127
|
-
_rules = rules(
|
|
135
|
+
if (isFunction(rules)) {
|
|
136
|
+
_rules = rules.apply(void 0, rowParams);
|
|
128
137
|
}
|
|
129
138
|
// 设置校验规则
|
|
130
139
|
var internalRule = useRules({
|
|
@@ -134,7 +143,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
134
143
|
required: !isView && _required,
|
|
135
144
|
rules: isEditing ? _rules : [],
|
|
136
145
|
isSelect: isSelect({
|
|
137
|
-
dataSource: (
|
|
146
|
+
dataSource: (_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.dataSource,
|
|
138
147
|
type: type
|
|
139
148
|
}),
|
|
140
149
|
type: type
|
|
@@ -169,7 +178,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
169
178
|
* @returns {}
|
|
170
179
|
*/
|
|
171
180
|
var valueTypeTransform = useCallback(function () {
|
|
172
|
-
var
|
|
181
|
+
var _fieldProps3;
|
|
173
182
|
// 不存在valueType返回空
|
|
174
183
|
if (!valueType) {
|
|
175
184
|
return {};
|
|
@@ -179,7 +188,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
179
188
|
valueType = 'switch';
|
|
180
189
|
}
|
|
181
190
|
var params = _objectSpread(_objectSpread({}, column), {}, {
|
|
182
|
-
mode: (
|
|
191
|
+
mode: (_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.mode
|
|
183
192
|
});
|
|
184
193
|
return isFunction(valueTypeMap[valueType]) ? valueTypeMap[valueType](params) : {};
|
|
185
194
|
}, [valueType]);
|
|
@@ -224,7 +233,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
224
233
|
}
|
|
225
234
|
if (isEditable && isEditing) {
|
|
226
235
|
if (typeof _editRender === 'function') {
|
|
227
|
-
TargetComponent = _editRender(
|
|
236
|
+
TargetComponent = _editRender.apply(void 0, rowParams);
|
|
228
237
|
}
|
|
229
238
|
if ( /*#__PURE__*/React.isValidElement(_editRender)) {
|
|
230
239
|
TargetComponent = _editRender;
|
|
@@ -266,7 +275,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
266
275
|
case 'ProEnum':
|
|
267
276
|
nextArgs[2].option = _args[1];
|
|
268
277
|
break;
|
|
269
|
-
case '
|
|
278
|
+
case 'ProCascader':
|
|
270
279
|
nextArgs[2].selectedOptions = _args[1];
|
|
271
280
|
break;
|
|
272
281
|
case 'DatePicker':
|
|
@@ -377,13 +386,13 @@ var RenderField = function RenderField(_ref) {
|
|
|
377
386
|
var _onblur = /*#__PURE__*/function () {
|
|
378
387
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
379
388
|
var _TargetComponent3, _TargetComponent3$pro, _TargetComponent$prop4;
|
|
380
|
-
var
|
|
381
|
-
row,
|
|
382
|
-
orgRow,
|
|
383
|
-
_len3,
|
|
389
|
+
var _len3,
|
|
384
390
|
args,
|
|
385
391
|
_key3,
|
|
386
392
|
_args,
|
|
393
|
+
rowPath,
|
|
394
|
+
row,
|
|
395
|
+
orgRow,
|
|
387
396
|
_Object$keys2,
|
|
388
397
|
_Object$keys2$map,
|
|
389
398
|
diff,
|
|
@@ -392,13 +401,13 @@ var RenderField = function RenderField(_ref) {
|
|
|
392
401
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
393
402
|
while (1) switch (_context2.prev = _context2.next) {
|
|
394
403
|
case 0:
|
|
395
|
-
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
396
|
-
row = form.getFieldValue(rowPath);
|
|
397
|
-
orgRow = cloneDeep(row);
|
|
398
404
|
for (_len3 = _args3.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
399
405
|
args[_key3] = _args3[_key3];
|
|
400
406
|
}
|
|
401
|
-
_args = formatArgs(args);
|
|
407
|
+
_args = formatArgs([].concat(args));
|
|
408
|
+
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
409
|
+
row = type === 'Group' ? _args[1] : form.getFieldValue(rowPath, true);
|
|
410
|
+
orgRow = cloneDeep(row);
|
|
402
411
|
_args[1] = row;
|
|
403
412
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
404
413
|
if (!_context2.t0) {
|
|
@@ -438,14 +447,12 @@ var RenderField = function RenderField(_ref) {
|
|
|
438
447
|
cellNamePath: []
|
|
439
448
|
});
|
|
440
449
|
case 20:
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
});
|
|
448
|
-
}
|
|
450
|
+
// 单行编辑时需要 强制更新视图
|
|
451
|
+
setState({
|
|
452
|
+
forceUpdate: {
|
|
453
|
+
d: Date.now()
|
|
454
|
+
}
|
|
455
|
+
});
|
|
449
456
|
case 21:
|
|
450
457
|
case "end":
|
|
451
458
|
return _context2.stop();
|
|
@@ -484,6 +491,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
484
491
|
form: form,
|
|
485
492
|
names: names,
|
|
486
493
|
name: cellName,
|
|
494
|
+
listName: cellName,
|
|
487
495
|
viewEmpty: viewEmpty,
|
|
488
496
|
valueType: valueType,
|
|
489
497
|
isView: isView
|
|
@@ -512,7 +520,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
512
520
|
if (['Select', 'ProSelect', 'ProEnum'].includes(type)) {
|
|
513
521
|
componentProps.scrollFollowParent = false;
|
|
514
522
|
}
|
|
515
|
-
Object.assign(_formItemProps, _objectSpread(_objectSpread(_objectSpread({}, defaultTransform()), valueTypeTransform()), namesTransform()));
|
|
523
|
+
Object.assign(_formItemProps, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultTransform()), valueTypeTransform()), namesTransform()), isTrim(type, trim, useProConfig())));
|
|
516
524
|
// 编辑&保存模式,在查看状态下移除表单的rules不做校验
|
|
517
525
|
if (!isEditing) {
|
|
518
526
|
delete _formItemProps.rules;
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -66,12 +66,12 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
66
66
|
// 判断是否在formList内
|
|
67
67
|
if (namePath === null || namePath === void 0 ? void 0 : namePath.length) {
|
|
68
68
|
name = [].concat(_toConsumableArray(namePath), _toConsumableArray(name.slice(1)));
|
|
69
|
+
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled; // formFieldProps?.disabled可能是函数??
|
|
69
70
|
}
|
|
70
71
|
var tableRef = useRef(null);
|
|
71
72
|
var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
|
|
72
73
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
73
74
|
var prefixCls = getPrefixCls();
|
|
74
|
-
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled;
|
|
75
75
|
var _useLocalStorageState = useLocalStorageState('themeConfig'),
|
|
76
76
|
_useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
|
|
77
77
|
themeConfig = _useLocalStorageState2[0];
|
|
@@ -129,7 +129,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
129
129
|
return getRowKey(item) === getRowKey(record);
|
|
130
130
|
}));
|
|
131
131
|
};
|
|
132
|
-
var config = {
|
|
132
|
+
var config = _objectSpread({
|
|
133
133
|
form: form,
|
|
134
134
|
mode: mode,
|
|
135
135
|
isView: isView,
|
|
@@ -162,7 +162,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
162
162
|
originalDiffTip: originalDiffTip,
|
|
163
163
|
prefixCls: prefixCls,
|
|
164
164
|
rowDisabled: rowDisabled
|
|
165
|
-
};
|
|
165
|
+
}, resetProps);
|
|
166
166
|
// 编辑行设置下样式
|
|
167
167
|
var _rowClassName = function _rowClassName(record) {
|
|
168
168
|
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
@import (reference) '~antd/es/style/themes/index.less';
|
|
3
3
|
|
|
4
4
|
.pro-edit-table {
|
|
5
|
+
td[rowspan]{
|
|
6
|
+
vertical-align: middle !important;
|
|
7
|
+
}
|
|
5
8
|
.pro-edit-table-tooltip {
|
|
6
9
|
display : inline-flex;
|
|
7
10
|
align-items: center;
|
|
@@ -62,7 +65,7 @@
|
|
|
62
65
|
|
|
63
66
|
.drag-wrapper {
|
|
64
67
|
display: flex;
|
|
65
|
-
.
|
|
68
|
+
.anticon {
|
|
66
69
|
margin-right: var(--zaui-space-size-md, 16px);
|
|
67
70
|
margin-left: var(--zaui-space-size-xs, 4px);
|
|
68
71
|
cursor: pointer;
|
|
@@ -87,11 +90,6 @@
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
.@{ant-prefix}-table-header>table .@{ant-prefix}-table-thead>tr>th.@{ant-prefix}-table-selection-column {
|
|
91
|
-
padding-left: var(--zaui-space-size-md, 16px);
|
|
92
|
-
padding-right: var(--zaui-space-size-md, 16px);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
93
|
.@{ant-prefix}-table-header>table .@{ant-prefix}-table-thead>tr>th:not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan]).is-required {
|
|
96
94
|
&.is-required-right {
|
|
97
95
|
.pro-edit-table-title {
|
|
@@ -142,7 +140,7 @@
|
|
|
142
140
|
.@{ant-prefix}-table-cell-fix-left,
|
|
143
141
|
.@{ant-prefix}-table-cell-fix-right {
|
|
144
142
|
background-color: var(--zaui-table-header-bg, #f2f3f5);
|
|
145
|
-
|
|
143
|
+
|
|
146
144
|
}
|
|
147
145
|
}
|
|
148
146
|
|
|
@@ -14,3 +14,15 @@ export declare const onDelete: ({ name, form, virtualKey, selectedRowKeys }: {
|
|
|
14
14
|
virtualKey: any;
|
|
15
15
|
selectedRowKeys: any;
|
|
16
16
|
}) => void;
|
|
17
|
+
/** 获取最终的disabled, 两张模式【子级优先,全局优先】
|
|
18
|
+
* 全局优先:globalControl为true时,全局控制
|
|
19
|
+
* 子级优先:globalControl为false时,子级控制
|
|
20
|
+
* @param globalControl 全局控制
|
|
21
|
+
* @param formDisabled 表单的disabled
|
|
22
|
+
* @param column 当前列
|
|
23
|
+
* @param tabledDisabled 表格的disabled
|
|
24
|
+
* @param columnFieldProps 当前列的fieldProps
|
|
25
|
+
* @param params 当前列的参数
|
|
26
|
+
* @param rowDisabled 行禁用参数
|
|
27
|
+
*/
|
|
28
|
+
export declare const getDisabled: ({ globalControl, formDisabled, column, tabledDisabled, columnFieldProps, params, rowDisabled }: any) => any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { cloneDeep, isString, isObject, isEqual, transform, isFunction, isBoolean } from 'lodash';
|
|
2
3
|
export var getRandom = function getRandom() {
|
|
3
4
|
return Math.random().toString(36).slice(-6);
|
|
4
5
|
};
|
|
@@ -6,7 +7,8 @@ export var getRandom = function getRandom() {
|
|
|
6
7
|
export var difference = function difference(object, base) {
|
|
7
8
|
var changes = function changes(object, base) {
|
|
8
9
|
return transform(object, function (result, value, key) {
|
|
9
|
-
|
|
10
|
+
var _key$indexOf;
|
|
11
|
+
if ((key === null || key === void 0 ? void 0 : (_key$indexOf = key.indexOf) === null || _key$indexOf === void 0 ? void 0 : _key$indexOf.call(key, '-')) > -1) {
|
|
10
12
|
result[key] = true;
|
|
11
13
|
} else if (!isEqual(value, base[key])) {
|
|
12
14
|
result[key] = isObject(value) && isObject(base[key]) ? changes(value, base[key]) : value;
|
|
@@ -74,4 +76,79 @@ export var onDelete = function onDelete(_ref) {
|
|
|
74
76
|
form.setFieldValue(namePath, virtualList);
|
|
75
77
|
}
|
|
76
78
|
}
|
|
79
|
+
};
|
|
80
|
+
/** 获取最终的disabled, 两张模式【子级优先,全局优先】
|
|
81
|
+
* 全局优先:globalControl为true时,全局控制
|
|
82
|
+
* 子级优先:globalControl为false时,子级控制
|
|
83
|
+
* @param globalControl 全局控制
|
|
84
|
+
* @param formDisabled 表单的disabled
|
|
85
|
+
* @param column 当前列
|
|
86
|
+
* @param tabledDisabled 表格的disabled
|
|
87
|
+
* @param columnFieldProps 当前列的fieldProps
|
|
88
|
+
* @param params 当前列的参数
|
|
89
|
+
* @param rowDisabled 行禁用参数
|
|
90
|
+
*/
|
|
91
|
+
export var getDisabled = function getDisabled(_ref2) {
|
|
92
|
+
var globalControl = _ref2.globalControl,
|
|
93
|
+
formDisabled = _ref2.formDisabled,
|
|
94
|
+
column = _ref2.column,
|
|
95
|
+
tabledDisabled = _ref2.tabledDisabled,
|
|
96
|
+
columnFieldProps = _ref2.columnFieldProps,
|
|
97
|
+
params = _ref2.params,
|
|
98
|
+
rowDisabled = _ref2.rowDisabled;
|
|
99
|
+
var convertToBoolean = function convertToBoolean(value) {
|
|
100
|
+
if (Array.isArray(value)) {
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
if (value === null || value === undefined || value === '') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (value === 0) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
return Boolean(value);
|
|
110
|
+
};
|
|
111
|
+
// 判断是否有column的disabled属性
|
|
112
|
+
var noColumnDisabled = function noColumnDisabled() {
|
|
113
|
+
if (isFunction(column === null || column === void 0 ? void 0 : column.disabled) || isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || isBoolean(column === null || column === void 0 ? void 0 : column.disabled) || isBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
// 判断FieldProps是否有disabled属性
|
|
117
|
+
if (isFunction(columnFieldProps)) {
|
|
118
|
+
var _columnFieldProps = columnFieldProps.apply(void 0, _toConsumableArray(params)),
|
|
119
|
+
disabled = _columnFieldProps.disabled;
|
|
120
|
+
if (isFunction(disabled) || isBoolean(disabled)) {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
};
|
|
126
|
+
if (globalControl) {
|
|
127
|
+
return convertToBoolean(formDisabled) || convertToBoolean(tabledDisabled);
|
|
128
|
+
}
|
|
129
|
+
if (rowDisabled === 'empty') {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
// 当表单含有diabled属性时,优先使用表单的disabled
|
|
133
|
+
if (isFunction(rowDisabled) && noColumnDisabled()) {
|
|
134
|
+
return rowDisabled(params[1]);
|
|
135
|
+
}
|
|
136
|
+
if (isFunction(column === null || column === void 0 ? void 0 : column.disabled)) {
|
|
137
|
+
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, _toConsumableArray(params)));
|
|
138
|
+
}
|
|
139
|
+
// 表单FieldProps为函数时
|
|
140
|
+
if (isFunction(columnFieldProps)) {
|
|
141
|
+
var _columnFieldProps2 = columnFieldProps.apply(void 0, _toConsumableArray(params)),
|
|
142
|
+
disabled = _columnFieldProps2.disabled;
|
|
143
|
+
if (isFunction(disabled)) {
|
|
144
|
+
return convertToBoolean(disabled.apply(void 0, _toConsumableArray(params)));
|
|
145
|
+
}
|
|
146
|
+
if (isBoolean(disabled)) {
|
|
147
|
+
return convertToBoolean(disabled);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
|
|
151
|
+
return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, _toConsumableArray(params)));
|
|
152
|
+
}
|
|
153
|
+
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || convertToBoolean(tabledDisabled);
|
|
77
154
|
};
|
|
@@ -25,9 +25,16 @@ var RangePicker = function RangePicker(props) {
|
|
|
25
25
|
viewEmpty = _ref.viewEmpty,
|
|
26
26
|
valueType = _ref.valueType;
|
|
27
27
|
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon;
|
|
28
|
+
var _res = _objectSpread(_objectSpread({}, rest), {}, {
|
|
29
|
+
showTime: !rest.showTime && valueType === 'dateTime' || rest.showTime
|
|
30
|
+
});
|
|
31
|
+
// 字符串时间格式兼容
|
|
32
|
+
if (Array.isArray(_res.value) && isString(_res.value[0]) && isString(_res.value[1])) {
|
|
33
|
+
_res.value = [moment(_res.value[0]), moment(_res.value[1])];
|
|
34
|
+
}
|
|
28
35
|
if (isView) {
|
|
29
|
-
var
|
|
30
|
-
value =
|
|
36
|
+
var _res$value = _res.value,
|
|
37
|
+
value = _res$value === void 0 ? [] : _res$value;
|
|
31
38
|
var viewChildren = null;
|
|
32
39
|
if (!value || !value[0] || !value[1]) {
|
|
33
40
|
viewChildren = null;
|
|
@@ -49,13 +56,6 @@ var RangePicker = function RangePicker(props) {
|
|
|
49
56
|
children: viewChildren
|
|
50
57
|
});
|
|
51
58
|
}
|
|
52
|
-
var _res = _objectSpread(_objectSpread({}, rest), {}, {
|
|
53
|
-
showTime: !rest.showTime && valueType === 'dateTime' || rest.showTime
|
|
54
|
-
});
|
|
55
|
-
// 字符串时间格式兼容
|
|
56
|
-
if (Array.isArray(_res.value) && isString(_res.value[0]) && isString(_res.value[1])) {
|
|
57
|
-
_res.value = [moment(_res.value[0]), moment(_res.value[1])];
|
|
58
|
-
}
|
|
59
59
|
return _jsx(AntRangePicker, _objectSpread(_objectSpread({}, initialConfig), omit(_res, ['separator'])));
|
|
60
60
|
};
|
|
61
61
|
export default RangePicker;
|
|
@@ -3,7 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import "antd/es/input/style";
|
|
5
5
|
import _Input from "antd/es/input";
|
|
6
|
-
var _excluded = ["placeholder", "otherProps", "className"];
|
|
6
|
+
var _excluded = ["placeholder", "otherProps", "className", "tooltip"];
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { omit } from 'lodash';
|
|
9
9
|
import classnames from 'classnames';
|
|
@@ -17,6 +17,8 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
|
17
17
|
var placeholder = props.placeholder,
|
|
18
18
|
otherProps = props.otherProps,
|
|
19
19
|
className = props.className,
|
|
20
|
+
_props$tooltip = props.tooltip,
|
|
21
|
+
tooltip = _props$tooltip === void 0 ? true : _props$tooltip,
|
|
20
22
|
rest = _objectWithoutProperties(props, _excluded);
|
|
21
23
|
var _ref = ProForm.useFieldProps() || {},
|
|
22
24
|
label = _ref.label,
|
|
@@ -27,7 +29,7 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
|
27
29
|
if (isView) {
|
|
28
30
|
return _jsx(Container, {
|
|
29
31
|
nowrap: false,
|
|
30
|
-
tooltip:
|
|
32
|
+
tooltip: tooltip,
|
|
31
33
|
viewEmpty: viewEmpty,
|
|
32
34
|
children: rest.value
|
|
33
35
|
});
|
|
@@ -21,10 +21,11 @@ var Container = function Container(props) {
|
|
|
21
21
|
disabled = _ref.disabled;
|
|
22
22
|
var _className = classnames(_defineProperty({
|
|
23
23
|
'pro-container': true,
|
|
24
|
-
'pro-container-diy': type === 'Container'
|
|
24
|
+
'pro-container-diy': type === 'Container',
|
|
25
|
+
'pro-container-empty': !(children === null || children === void 0 ? void 0 : children.length)
|
|
25
26
|
}, "".concat(className), className));
|
|
26
27
|
var _children = useMemo(function () {
|
|
27
|
-
var result = children.map(function (item) {
|
|
28
|
+
var result = children === null || children === void 0 ? void 0 : children.map(function (item) {
|
|
28
29
|
return _objectSpread({
|
|
29
30
|
clearNotShow: clearNotShow,
|
|
30
31
|
show: show,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props:
|
|
2
|
+
import { ProCascaderProps } from './propsType';
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|