@zat-design/sisyphus-react 3.4.2-beta.24 → 3.4.2-beta.26
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 +1 -4
- package/dist/less.esm.css +1 -4
- package/es/ProEditTable/components/RenderField/index.js +13 -5
- package/es/ProForm/components/combination/Group/index.js +10 -4
- package/es/ProForm/components/combination/Group/propsType.d.ts +5 -0
- package/es/ProForm/components/render/Render.js +3 -0
- package/es/ProForm/style/index.less +1 -5
- package/lib/ProEditTable/components/RenderField/index.js +13 -5
- package/lib/ProForm/components/combination/Group/index.js +10 -4
- package/lib/ProForm/components/combination/Group/propsType.d.ts +5 -0
- package/lib/ProForm/components/render/Render.js +3 -0
- package/lib/ProForm/style/index.less +1 -5
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -2611,9 +2611,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2611
2611
|
-ms-flex-align: normal;
|
|
2612
2612
|
align-items: normal;
|
|
2613
2613
|
}
|
|
2614
|
-
.pro-form.ant-form {
|
|
2615
|
-
margin-bottom: calc(var(--zaui-space-size-md, 16px) * var(--zaui-size, 1));
|
|
2616
|
-
}
|
|
2617
2614
|
.pro-form .pro-collapse-level2 .ant-collapse-item {
|
|
2618
2615
|
margin-bottom: 0 !important;
|
|
2619
2616
|
}
|
|
@@ -2694,7 +2691,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2694
2691
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector input,
|
|
2695
2692
|
.pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
|
|
2696
2693
|
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
|
|
2697
|
-
background:
|
|
2694
|
+
background: transparent;
|
|
2698
2695
|
}
|
|
2699
2696
|
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
2700
2697
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
package/dist/less.esm.css
CHANGED
|
@@ -2611,9 +2611,6 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2611
2611
|
-ms-flex-align: normal;
|
|
2612
2612
|
align-items: normal;
|
|
2613
2613
|
}
|
|
2614
|
-
.pro-form.ant-form {
|
|
2615
|
-
margin-bottom: calc(var(--zaui-space-size-md, 16px) * var(--zaui-size, 1));
|
|
2616
|
-
}
|
|
2617
2614
|
.pro-form .pro-collapse-level2 .ant-collapse-item {
|
|
2618
2615
|
margin-bottom: 0 !important;
|
|
2619
2616
|
}
|
|
@@ -2694,7 +2691,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2694
2691
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector input,
|
|
2695
2692
|
.pro-form .ant-form-item.pro-form-item-changed .ant-picker input,
|
|
2696
2693
|
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number input {
|
|
2697
|
-
background:
|
|
2694
|
+
background: transparent;
|
|
2698
2695
|
}
|
|
2699
2696
|
.pro-form .ant-form-item.pro-form-item-changed span.ant-input-affix-wrapper .ant-select-selection-placeholder,
|
|
2700
2697
|
.pro-form .ant-form-item.pro-form-item-changed .ant-select-selector .ant-select-selection-placeholder,
|
|
@@ -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,
|
|
@@ -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,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
481
483
|
isView: isView
|
|
482
484
|
}
|
|
483
485
|
});
|
|
486
|
+
if (type !== 'Group') {
|
|
487
|
+
componentProps = omit(componentProps, ['onFieldChange', 'index']);
|
|
488
|
+
}
|
|
484
489
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
485
490
|
if (isCell) {
|
|
486
491
|
record["".concat(dataIndex, "-Disabled")] = _disabled;
|
|
@@ -506,11 +511,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
506
511
|
}
|
|
507
512
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
508
513
|
var originalTitle = originalDiffTip ? _jsxs(_Space, {
|
|
509
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({},
|
|
514
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
510
515
|
isView: true,
|
|
511
516
|
value: originalValue,
|
|
512
517
|
checked: type === 'Switch' ? originalValue : undefined
|
|
513
|
-
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({},
|
|
518
|
+
}))) : _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
514
519
|
isView: true,
|
|
515
520
|
value: originalValue,
|
|
516
521
|
checked: type === 'Switch' ? originalValue : undefined
|
|
@@ -521,15 +526,18 @@ var RenderField = function RenderField(_ref) {
|
|
|
521
526
|
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
522
527
|
className: _className,
|
|
523
528
|
name: cellName,
|
|
524
|
-
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent,
|
|
529
|
+
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
525
530
|
})) : _jsx(Container, {
|
|
526
531
|
viewEmpty: viewEmpty
|
|
527
532
|
});
|
|
528
533
|
return _jsx(FieldProvider, {
|
|
529
|
-
value: componentProps === null ||
|
|
534
|
+
value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
|
|
530
535
|
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
|
|
531
536
|
title: originalTitle,
|
|
532
537
|
open: changed ? undefined : false,
|
|
538
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
539
|
+
return target.parentElement;
|
|
540
|
+
},
|
|
533
541
|
children: FormItem
|
|
534
542
|
})
|
|
535
543
|
});
|
|
@@ -23,7 +23,9 @@ var Group = function Group(props) {
|
|
|
23
23
|
id = props.id,
|
|
24
24
|
value = props.value,
|
|
25
25
|
isView = props.isView,
|
|
26
|
-
|
|
26
|
+
index = props.index,
|
|
27
|
+
onFieldChange = props.onFieldChange,
|
|
28
|
+
namePath = props.namePath;
|
|
27
29
|
var _ref = ProForm.useFieldProps() || {},
|
|
28
30
|
names = _ref.names,
|
|
29
31
|
name = _ref.name,
|
|
@@ -39,7 +41,8 @@ var Group = function Group(props) {
|
|
|
39
41
|
}, item), {}, {
|
|
40
42
|
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
41
43
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
42
|
-
parentNames: id
|
|
44
|
+
parentNames: id,
|
|
45
|
+
namePath: namePath
|
|
43
46
|
});
|
|
44
47
|
});
|
|
45
48
|
var node = _jsx(_Button, {
|
|
@@ -67,8 +70,11 @@ var Group = function Group(props) {
|
|
|
67
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) || '';
|
|
68
71
|
// 模拟change,初始化不执行onFieldChange
|
|
69
72
|
if (isFunction(onFieldChange) && form.isFieldsTouched(names) && transformNamesString(names).includes(touchName)) {
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
var record = namePath ? form.getFieldValue(namePath) : form.getFieldsValue();
|
|
74
|
+
onFieldChange(value, record, {
|
|
75
|
+
form: form,
|
|
76
|
+
namePath: namePath,
|
|
77
|
+
index: index
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
}, [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
|
/**
|
|
@@ -24,7 +25,11 @@ export interface GroupProps {
|
|
|
24
25
|
id?: string;
|
|
25
26
|
disabled?: boolean | (() => void);
|
|
26
27
|
isView?: boolean;
|
|
28
|
+
namePath?: NamePath;
|
|
29
|
+
index?: number;
|
|
27
30
|
onFieldChange?: (value: any[] | null, record: any, { form, }: {
|
|
28
31
|
form: FormInstance;
|
|
32
|
+
namePath?: NamePath;
|
|
33
|
+
index?: number;
|
|
29
34
|
}) => any;
|
|
30
35
|
}
|
|
@@ -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
|
};
|
|
@@ -31,10 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
&.@{ant-prefix}-form {
|
|
35
|
-
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
34
|
.pro-collapse-level2 {
|
|
39
35
|
.@{ant-prefix}-collapse-item {
|
|
40
36
|
margin-bottom: 0 !important;
|
|
@@ -135,7 +131,7 @@
|
|
|
135
131
|
background: @zaui-contract-bg !important;
|
|
136
132
|
|
|
137
133
|
input {
|
|
138
|
-
background:
|
|
134
|
+
background: transparent;
|
|
139
135
|
}
|
|
140
136
|
.@{ant-prefix}-select-selection-placeholder {
|
|
141
137
|
z-index: 9;
|
|
@@ -32,7 +32,7 @@ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "e
|
|
|
32
32
|
/* eslint-disable prefer-destructuring */
|
|
33
33
|
/* eslint-disable prefer-const */
|
|
34
34
|
var RenderField = function RenderField(_ref) {
|
|
35
|
-
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4;
|
|
35
|
+
var _type, _type$replace, _fieldProps2, _fieldProps3, _fieldProps4, _names, _TargetComponent4, _componentProps;
|
|
36
36
|
var value = _ref.text,
|
|
37
37
|
record = _ref.record,
|
|
38
38
|
index = _ref.index,
|
|
@@ -472,9 +472,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
472
472
|
form: form,
|
|
473
473
|
name: cellName
|
|
474
474
|
}, _fieldProps), (_TargetComponent4 = TargetComponent) === null || _TargetComponent4 === void 0 ? void 0 : _TargetComponent4.props), {}, {
|
|
475
|
+
namePath: [].concat((0, _toConsumableArray2.default)(namePath), [index]),
|
|
475
476
|
disabled: _disabled,
|
|
476
477
|
onChange: _onchange,
|
|
477
478
|
onBlur: _onblur,
|
|
479
|
+
index: index,
|
|
478
480
|
otherProps: {
|
|
479
481
|
form: form,
|
|
480
482
|
names: names,
|
|
@@ -484,6 +486,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
484
486
|
isView: isView
|
|
485
487
|
}
|
|
486
488
|
});
|
|
489
|
+
if (type !== 'Group') {
|
|
490
|
+
componentProps = (0, _lodash.omit)(componentProps, ['onFieldChange', 'index']);
|
|
491
|
+
}
|
|
487
492
|
// 单元格编辑时,设置各个单元格disabled属性
|
|
488
493
|
if (isCell) {
|
|
489
494
|
record["".concat(dataIndex, "-Disabled")] = _disabled;
|
|
@@ -509,11 +514,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
509
514
|
}
|
|
510
515
|
var _className = (0, _classnames.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, className, className), 'pro-form-item-changed', changed));
|
|
511
516
|
var originalTitle = originalDiffTip ? (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
512
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({},
|
|
517
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
513
518
|
isView: true,
|
|
514
519
|
value: originalValue,
|
|
515
520
|
checked: type === 'Switch' ? originalValue : undefined
|
|
516
|
-
}))) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({},
|
|
521
|
+
}))) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
|
517
522
|
isView: true,
|
|
518
523
|
value: originalValue,
|
|
519
524
|
checked: type === 'Switch' ? originalValue : undefined
|
|
@@ -524,15 +529,18 @@ var RenderField = function RenderField(_ref) {
|
|
|
524
529
|
}, (0, _lodash.omit)(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
525
530
|
className: _className,
|
|
526
531
|
name: cellName,
|
|
527
|
-
children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent,
|
|
532
|
+
children: /*#__PURE__*/_react.default.isValidElement(TargetComponent) ? ( /*#__PURE__*/_react.default.cloneElement(TargetComponent, componentProps)) : (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)({}, componentProps))
|
|
528
533
|
})) : (0, _jsxRuntime.jsx)(_Container.default, {
|
|
529
534
|
viewEmpty: viewEmpty
|
|
530
535
|
});
|
|
531
536
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
532
|
-
value: componentProps === null ||
|
|
537
|
+
value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
|
|
533
538
|
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
534
539
|
title: originalTitle,
|
|
535
540
|
open: changed ? undefined : false,
|
|
541
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
542
|
+
return target.parentElement;
|
|
543
|
+
},
|
|
536
544
|
children: FormItem
|
|
537
545
|
})
|
|
538
546
|
});
|
|
@@ -27,7 +27,9 @@ var Group = function Group(props) {
|
|
|
27
27
|
id = props.id,
|
|
28
28
|
value = props.value,
|
|
29
29
|
isView = props.isView,
|
|
30
|
-
|
|
30
|
+
index = props.index,
|
|
31
|
+
onFieldChange = props.onFieldChange,
|
|
32
|
+
namePath = props.namePath;
|
|
31
33
|
var _ref = _ProForm.default.useFieldProps() || {},
|
|
32
34
|
names = _ref.names,
|
|
33
35
|
name = _ref.name,
|
|
@@ -43,7 +45,8 @@ var Group = function Group(props) {
|
|
|
43
45
|
}, item), {}, {
|
|
44
46
|
isView: isView !== null && isView !== void 0 ? isView : item.isView,
|
|
45
47
|
noStyle: (space === null || space === void 0 ? void 0 : space.compact) || (space === null || space === void 0 ? void 0 : space.separator),
|
|
46
|
-
parentNames: id
|
|
48
|
+
parentNames: id,
|
|
49
|
+
namePath: namePath
|
|
47
50
|
});
|
|
48
51
|
});
|
|
49
52
|
var node = (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
@@ -71,8 +74,11 @@ var Group = function Group(props) {
|
|
|
71
74
|
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
75
|
// 模拟change,初始化不执行onFieldChange
|
|
73
76
|
if ((0, _lodash.isFunction)(onFieldChange) && form.isFieldsTouched(names) && (0, _utils.transformNamesString)(names).includes(touchName)) {
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
var record = namePath ? form.getFieldValue(namePath) : form.getFieldsValue();
|
|
78
|
+
onFieldChange(value, record, {
|
|
79
|
+
form: form,
|
|
80
|
+
namePath: namePath,
|
|
81
|
+
index: index
|
|
76
82
|
});
|
|
77
83
|
}
|
|
78
84
|
}, [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
|
/**
|
|
@@ -24,7 +25,11 @@ export interface GroupProps {
|
|
|
24
25
|
id?: string;
|
|
25
26
|
disabled?: boolean | (() => void);
|
|
26
27
|
isView?: boolean;
|
|
28
|
+
namePath?: NamePath;
|
|
29
|
+
index?: number;
|
|
27
30
|
onFieldChange?: (value: any[] | null, record: any, { form, }: {
|
|
28
31
|
form: FormInstance;
|
|
32
|
+
namePath?: NamePath;
|
|
33
|
+
index?: number;
|
|
29
34
|
}) => any;
|
|
30
35
|
}
|
|
@@ -445,6 +445,9 @@ var Render = function Render(props) {
|
|
|
445
445
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
446
446
|
title: title,
|
|
447
447
|
visible: changed ? undefined : false,
|
|
448
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
449
|
+
return target.parentElement;
|
|
450
|
+
},
|
|
448
451
|
children: formItem
|
|
449
452
|
});
|
|
450
453
|
};
|
|
@@ -31,10 +31,6 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
&.@{ant-prefix}-form {
|
|
35
|
-
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
34
|
.pro-collapse-level2 {
|
|
39
35
|
.@{ant-prefix}-collapse-item {
|
|
40
36
|
margin-bottom: 0 !important;
|
|
@@ -135,7 +131,7 @@
|
|
|
135
131
|
background: @zaui-contract-bg !important;
|
|
136
132
|
|
|
137
133
|
input {
|
|
138
|
-
background:
|
|
134
|
+
background: transparent;
|
|
139
135
|
}
|
|
140
136
|
.@{ant-prefix}-select-selection-placeholder {
|
|
141
137
|
z-index: 9;
|