@zat-design/sisyphus-react 3.4.3-beta.1 → 3.4.3-beta.11
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 +19 -2
- package/dist/less.esm.css +19 -2
- package/es/ProEditTable/components/DndWrapper/index.js +1 -1
- package/es/ProEditTable/components/RenderField/index.js +16 -13
- package/es/ProEditTable/index.js +17 -10
- package/es/ProForm/components/base/DatePicker/index.js +3 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +9 -8
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +4 -0
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +3 -2
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/render/Render.js +10 -9
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/propsType.d.ts +1 -1
- package/es/ProForm/propsType.d.ts +2 -2
- package/es/ProForm/style/index.less +23 -5
- package/es/ProForm/utils/diffOriginal.js +17 -32
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +15 -5
- package/es/ProForm/utils/rulesCreator.d.ts +7 -1
- package/es/ProForm/utils/rulesCreator.js +45 -3
- package/es/ProForm/utils/useRules.js +36 -11
- package/es/ProForm/utils/useShouldUpdate.js +4 -4
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +0 -24
- package/es/ProTree/components/ProTreeSelect/style/index.less +1 -1
- package/es/ProTree/style/index.less +5 -0
- package/es/ProUpload/style/index.less +1 -1
- package/es/locale/en_US.d.ts +4 -2
- package/es/locale/en_US.js +4 -2
- package/es/locale/zh_CN.d.ts +4 -2
- package/es/locale/zh_CN.js +4 -2
- package/es/style/components.less +0 -3
- package/es/style/theme/antd.less +4 -4
- package/lib/ProEditTable/components/DndWrapper/index.js +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +14 -11
- package/lib/ProEditTable/index.js +17 -10
- package/lib/ProForm/components/base/DatePicker/index.js +3 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +9 -8
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +4 -0
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/render/Render.js +10 -9
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/propsType.d.ts +1 -1
- package/lib/ProForm/propsType.d.ts +2 -2
- package/lib/ProForm/style/index.less +23 -5
- package/lib/ProForm/utils/diffOriginal.js +16 -31
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +15 -5
- package/lib/ProForm/utils/rulesCreator.d.ts +7 -1
- package/lib/ProForm/utils/rulesCreator.js +45 -2
- package/lib/ProForm/utils/useRules.js +36 -11
- package/lib/ProForm/utils/useShouldUpdate.js +4 -4
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +0 -24
- package/lib/ProTree/components/ProTreeSelect/style/index.less +1 -1
- package/lib/ProTree/style/index.less +5 -0
- package/lib/ProUpload/style/index.less +1 -1
- package/lib/locale/en_US.d.ts +4 -2
- package/lib/locale/en_US.js +4 -2
- package/lib/locale/zh_CN.d.ts +4 -2
- package/lib/locale/zh_CN.js +4 -2
- package/lib/style/components.less +0 -3
- package/lib/style/theme/antd.less +4 -4
- package/package.json +2 -2
package/dist/index.esm.css
CHANGED
|
@@ -689,7 +689,7 @@
|
|
|
689
689
|
display: block !important;
|
|
690
690
|
}
|
|
691
691
|
.pro-collapse.ant-collapse .pro-collapse-panel {
|
|
692
|
-
margin-bottom:
|
|
692
|
+
margin-bottom: 16px;
|
|
693
693
|
}
|
|
694
694
|
.pro-collapse .ant-collapse-header {
|
|
695
695
|
-webkit-box-align: center !important;
|
|
@@ -2696,7 +2696,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2696
2696
|
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
2697
2697
|
z-index: 9;
|
|
2698
2698
|
}
|
|
2699
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle,
|
|
2699
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
2700
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
2700
2701
|
background: var(--zaui-contract-bg, #fffaa1);
|
|
2701
2702
|
border-radius: 4px;
|
|
2702
2703
|
}
|
|
@@ -2850,6 +2851,19 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2850
2851
|
.pro-form .delete-icon {
|
|
2851
2852
|
width: 18px;
|
|
2852
2853
|
}
|
|
2854
|
+
.pro-form .pro-form-list-tool-btn {
|
|
2855
|
+
margin-left: 8px;
|
|
2856
|
+
padding: 0;
|
|
2857
|
+
cursor: pointer;
|
|
2858
|
+
}
|
|
2859
|
+
.pro-form .pro-form-list-tool-btn .anticon {
|
|
2860
|
+
color: var(--zaui-text-weak, #a0a0a0);
|
|
2861
|
+
font-size: 16px;
|
|
2862
|
+
vertical-align: middle;
|
|
2863
|
+
}
|
|
2864
|
+
.pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
|
|
2865
|
+
width: auto;
|
|
2866
|
+
}
|
|
2853
2867
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
2854
2868
|
background: #F8F9FA;
|
|
2855
2869
|
border-radius: var(--zaui-border-radius, 8px);
|
|
@@ -3864,6 +3878,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3864
3878
|
.pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
|
|
3865
3879
|
height: 16px !important;
|
|
3866
3880
|
}
|
|
3881
|
+
.ant-select-dropdown.pro-tree-select-drop-down-container.checkable-tree {
|
|
3882
|
+
overflow: hidden!important;
|
|
3883
|
+
}
|
|
3867
3884
|
.pro-drawer .pro-drawer-close {
|
|
3868
3885
|
position: absolute;
|
|
3869
3886
|
top: 6px;
|
package/dist/less.esm.css
CHANGED
|
@@ -689,7 +689,7 @@
|
|
|
689
689
|
display: block !important;
|
|
690
690
|
}
|
|
691
691
|
.pro-collapse.ant-collapse .pro-collapse-panel {
|
|
692
|
-
margin-bottom:
|
|
692
|
+
margin-bottom: 16px;
|
|
693
693
|
}
|
|
694
694
|
.pro-collapse .ant-collapse-header {
|
|
695
695
|
-webkit-box-align: center !important;
|
|
@@ -2696,7 +2696,8 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2696
2696
|
.pro-form .ant-form-item.pro-form-item-changed .ant-input-number .ant-select-selection-placeholder {
|
|
2697
2697
|
z-index: 9;
|
|
2698
2698
|
}
|
|
2699
|
-
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle,
|
|
2699
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-switch-handle),
|
|
2700
|
+
.pro-form .ant-form-item.pro-form-item-changed .ant-form-item-control:has(.ant-checkbox-wrapper-in-form-item) {
|
|
2700
2701
|
background: var(--zaui-contract-bg, #fffaa1);
|
|
2701
2702
|
border-radius: 4px;
|
|
2702
2703
|
}
|
|
@@ -2850,6 +2851,19 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2850
2851
|
.pro-form .delete-icon {
|
|
2851
2852
|
width: 18px;
|
|
2852
2853
|
}
|
|
2854
|
+
.pro-form .pro-form-list-tool-btn {
|
|
2855
|
+
margin-left: 8px;
|
|
2856
|
+
padding: 0;
|
|
2857
|
+
cursor: pointer;
|
|
2858
|
+
}
|
|
2859
|
+
.pro-form .pro-form-list-tool-btn .anticon {
|
|
2860
|
+
color: var(--zaui-text-weak, #a0a0a0);
|
|
2861
|
+
font-size: 16px;
|
|
2862
|
+
vertical-align: middle;
|
|
2863
|
+
}
|
|
2864
|
+
.pro-form .pro-form-list-mode-block .pro-collapse-content .ant-row {
|
|
2865
|
+
width: auto;
|
|
2866
|
+
}
|
|
2853
2867
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
2854
2868
|
background: #F8F9FA;
|
|
2855
2869
|
border-radius: var(--zaui-border-radius, 8px);
|
|
@@ -3864,6 +3878,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3864
3878
|
.pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox * {
|
|
3865
3879
|
height: 16px !important;
|
|
3866
3880
|
}
|
|
3881
|
+
.ant-select-dropdown.pro-tree-select-drop-down-container.checkable-tree {
|
|
3882
|
+
overflow: hidden!important;
|
|
3883
|
+
}
|
|
3867
3884
|
.pro-drawer .pro-drawer-close {
|
|
3868
3885
|
position: absolute;
|
|
3869
3886
|
top: 6px;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "antd/es/tooltip/style";
|
|
2
2
|
import _Tooltip from "antd/es/tooltip";
|
|
3
|
-
import "antd/es/form/style";
|
|
4
|
-
import _Form from "antd/es/form";
|
|
5
3
|
import "antd/es/space/style";
|
|
6
4
|
import _Space from "antd/es/space";
|
|
5
|
+
import "antd/es/form/style";
|
|
6
|
+
import _Form from "antd/es/form";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
8
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
@@ -72,7 +72,9 @@ var RenderField = function RenderField(_ref) {
|
|
|
72
72
|
virtualKey = config.virtualKey,
|
|
73
73
|
viewEmpty = config.viewEmpty,
|
|
74
74
|
originalValues = config.originalValues,
|
|
75
|
-
|
|
75
|
+
formNamePath = config.namePath,
|
|
76
|
+
_config$originalDiffT = config.originalDiffTip,
|
|
77
|
+
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT;
|
|
76
78
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
77
79
|
var _rules = rules || [];
|
|
78
80
|
var _required = required;
|
|
@@ -515,7 +517,16 @@ var RenderField = function RenderField(_ref) {
|
|
|
515
517
|
delete _formItemProps.rules;
|
|
516
518
|
}
|
|
517
519
|
var _className = classNames(_defineProperty(_defineProperty({}, className, className), 'pro-form-item-changed', changed));
|
|
518
|
-
var
|
|
520
|
+
var FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
521
|
+
validateFirst: true
|
|
522
|
+
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
523
|
+
className: _className,
|
|
524
|
+
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
|
|
525
|
+
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
526
|
+
})) : _jsx(Container, {
|
|
527
|
+
viewEmpty: viewEmpty
|
|
528
|
+
});
|
|
529
|
+
var originalTitle = originalDiffTip && originalValues ? _jsxs(_Space, {
|
|
519
530
|
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
520
531
|
isView: true,
|
|
521
532
|
value: originalValue,
|
|
@@ -526,19 +537,11 @@ var RenderField = function RenderField(_ref) {
|
|
|
526
537
|
checked: type === 'Switch' ? originalValue : undefined
|
|
527
538
|
}))]
|
|
528
539
|
}) : null;
|
|
529
|
-
var FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
|
530
|
-
validateFirst: true
|
|
531
|
-
}, omit(_formItemProps, ['render', 'cache', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
|
532
|
-
className: _className,
|
|
533
|
-
name: cellName,
|
|
534
|
-
children: /*#__PURE__*/React.isValidElement(TargetComponent) ? ( /*#__PURE__*/React.cloneElement(TargetComponent, componentProps)) : _jsx(TargetComponent, _objectSpread({}, componentProps))
|
|
535
|
-
})) : _jsx(Container, {
|
|
536
|
-
viewEmpty: viewEmpty
|
|
537
|
-
});
|
|
538
540
|
return _jsx(FieldProvider, {
|
|
539
541
|
value: (_componentProps = componentProps) === null || _componentProps === void 0 ? void 0 : _componentProps.otherProps,
|
|
540
542
|
children: !originalDiffTip || ['FormList', 'ProEditTable'].includes(type) ? FormItem : _jsx(_Tooltip, {
|
|
541
543
|
title: originalTitle,
|
|
544
|
+
placement: "topLeft",
|
|
542
545
|
open: changed ? undefined : false,
|
|
543
546
|
getPopupContainer: function getPopupContainer(target) {
|
|
544
547
|
return target.parentElement;
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -7,10 +7,11 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
import "antd/es/config-provider/style";
|
|
9
9
|
import _ConfigProvider from "antd/es/config-provider";
|
|
10
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
10
11
|
import "antd/es/form/style";
|
|
11
12
|
import _Form from "antd/es/form";
|
|
12
13
|
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", "
|
|
14
|
+
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey"];
|
|
14
15
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
16
17
|
import { get, isArray } from 'lodash';
|
|
@@ -19,6 +20,7 @@ import classnames from 'classnames';
|
|
|
19
20
|
import { transformColumns } from './utils';
|
|
20
21
|
import { getRandom, getNamePath } from './utils/tools';
|
|
21
22
|
import { DndWrapper, Row, Validator, Summary, RenderToolbar } from './components';
|
|
23
|
+
import ProForm from '../ProForm';
|
|
22
24
|
import Empty from '../assets/empty.png';
|
|
23
25
|
import locale, { formatMessage } from '../locale';
|
|
24
26
|
var ProEditTable = function ProEditTable(_ref, ref) {
|
|
@@ -41,8 +43,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
41
43
|
onlyOneLineMsg = _ref.onlyOneLineMsg,
|
|
42
44
|
deletePoConfirmMsg = _ref.deletePoConfirmMsg,
|
|
43
45
|
mulDeletePoConfirmMsg = _ref.mulDeletePoConfirmMsg,
|
|
44
|
-
_ref$otherProps = _ref.otherProps,
|
|
45
|
-
otherProps = _ref$otherProps === void 0 ? {} : _ref$otherProps,
|
|
46
46
|
configRequiredAlign = _ref.requiredAlign,
|
|
47
47
|
summary = _ref.summary,
|
|
48
48
|
max = _ref.max,
|
|
@@ -54,17 +54,23 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
54
54
|
resetProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
55
|
// 上下文form
|
|
56
56
|
var contentForm = _Form.useFormInstance();
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
var formFieldProps = ProForm.useFieldProps() || {};
|
|
58
|
+
var form = contentForm || (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.form) || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.form);
|
|
59
|
+
var name = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.name) || (resetProps === null || resetProps === void 0 ? void 0 : resetProps.name) || (resetProps === null || resetProps === void 0 ? void 0 : (_resetProps$id = resetProps.id) === null || _resetProps$id === void 0 ? void 0 : (_resetProps$id$split = _resetProps$id.split) === null || _resetProps$id$split === void 0 ? void 0 : _resetProps$id$split.call(_resetProps$id, '_'));
|
|
60
|
+
var _formFieldProps$isVie = formFieldProps.isView,
|
|
61
|
+
isView = _formFieldProps$isVie === void 0 ? false : _formFieldProps$isVie,
|
|
62
|
+
_formFieldProps$viewE = formFieldProps.viewEmpty,
|
|
63
|
+
viewEmpty = _formFieldProps$viewE === void 0 ? '-' : _formFieldProps$viewE,
|
|
64
|
+
namePath = formFieldProps.namePath;
|
|
65
|
+
// 判断是否在formList内
|
|
66
|
+
if (namePath === null || namePath === void 0 ? void 0 : namePath.length) {
|
|
67
|
+
name = [].concat(_toConsumableArray(namePath), _toConsumableArray(name.slice(1)));
|
|
68
|
+
}
|
|
63
69
|
var tableRef = useRef(null);
|
|
64
70
|
var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
|
|
65
71
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
66
72
|
var prefixCls = getPrefixCls();
|
|
67
|
-
disabled = (
|
|
73
|
+
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled;
|
|
68
74
|
var _useLocalStorageState = useLocalStorageState('themeConfig'),
|
|
69
75
|
_useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
|
|
70
76
|
themeConfig = _useLocalStorageState2[0];
|
|
@@ -146,6 +152,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
146
152
|
virtualKey: virtualKey,
|
|
147
153
|
requiredAlign: requiredAlign,
|
|
148
154
|
name: isArray(name) ? name : [name],
|
|
155
|
+
namePath: namePath,
|
|
149
156
|
tableRef: tableRef,
|
|
150
157
|
max: max,
|
|
151
158
|
tableLength: value === null || value === void 0 ? void 0 : value.length,
|
|
@@ -56,7 +56,9 @@ var DatePicker = function DatePicker(props) {
|
|
|
56
56
|
disabled: true
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
return _jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({}, initialConfig),
|
|
59
|
+
return _jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({}, initialConfig), {}, {
|
|
60
|
+
format: format
|
|
61
|
+
}, _rest), {}, {
|
|
60
62
|
className: _className
|
|
61
63
|
}));
|
|
62
64
|
};
|
|
@@ -27,7 +27,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
27
27
|
add(undefined, index + 1);
|
|
28
28
|
},
|
|
29
29
|
type: 'text',
|
|
30
|
-
label: "".concat(locale.ProForm.
|
|
30
|
+
label: "".concat(locale.ProForm.formListActions[0]),
|
|
31
31
|
icon: _jsx(PlusSquareOutlined, {})
|
|
32
32
|
},
|
|
33
33
|
delete: {
|
|
@@ -39,7 +39,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
39
39
|
remove(index);
|
|
40
40
|
},
|
|
41
41
|
type: 'text',
|
|
42
|
-
label: "".concat(locale.ProForm.
|
|
42
|
+
label: "".concat(locale.ProForm.formListActions[1]),
|
|
43
43
|
icon: mode === 'less' ? _jsx(ProIcon, {
|
|
44
44
|
type: "solid-close",
|
|
45
45
|
className: "single-delete"
|
|
@@ -56,7 +56,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
56
56
|
add(record, index + 1);
|
|
57
57
|
},
|
|
58
58
|
type: 'text',
|
|
59
|
-
label: "".concat(locale.ProForm.
|
|
59
|
+
label: "".concat(locale.ProForm.formListActions[2]),
|
|
60
60
|
icon: _jsx(CopyOutlined, {})
|
|
61
61
|
},
|
|
62
62
|
moveUp: {
|
|
@@ -68,7 +68,7 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
68
68
|
move(index, index - 1);
|
|
69
69
|
},
|
|
70
70
|
type: 'text',
|
|
71
|
-
label: "".concat(locale.ProForm.
|
|
71
|
+
label: "".concat(locale.ProForm.formListActions[3]),
|
|
72
72
|
icon: _jsx(UpSquareOutlined, {})
|
|
73
73
|
},
|
|
74
74
|
moveDown: {
|
|
@@ -80,13 +80,14 @@ var getDefaultActions = function getDefaultActions(mode) {
|
|
|
80
80
|
move(index, index + 1);
|
|
81
81
|
},
|
|
82
82
|
type: 'text',
|
|
83
|
-
label: "".concat(locale.ProForm.
|
|
83
|
+
label: "".concat(locale.ProForm.formListActions[4]),
|
|
84
84
|
icon: _jsx(DownSquareOutlined, {})
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
if (mode === 'block') {
|
|
88
88
|
Object.keys(originActions).forEach(function (key) {
|
|
89
|
-
originActions[key].type = '
|
|
89
|
+
originActions[key].type = 'text';
|
|
90
|
+
originActions[key].className = 'pro-form-list-tool-btn';
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
if (mode === 'line') {
|
|
@@ -188,7 +189,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
188
189
|
return false;
|
|
189
190
|
}
|
|
190
191
|
return _needConfirm ? _jsx(_Popconfirm, _objectSpread(_objectSpread({
|
|
191
|
-
title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.
|
|
192
|
+
title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.formListConfirmMessage),
|
|
192
193
|
onCancel: function onCancel(e) {
|
|
193
194
|
return e.stopPropagation();
|
|
194
195
|
},
|
|
@@ -211,7 +212,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
211
212
|
}), "".concat(item === null || item === void 0 ? void 0 : item.actionType).concat(index));
|
|
212
213
|
}
|
|
213
214
|
return needConfirm ? _jsx(_Popconfirm, _objectSpread(_objectSpread({
|
|
214
|
-
title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.
|
|
215
|
+
title: title !== null && title !== void 0 ? title : "".concat(locale.ProForm.formListConfirmMessage),
|
|
215
216
|
onCancel: function onCancel(e) {
|
|
216
217
|
return e.stopPropagation();
|
|
217
218
|
},
|
|
@@ -2,9 +2,11 @@ import "antd/es/row/style";
|
|
|
2
2
|
import _Row from "antd/es/row";
|
|
3
3
|
import "antd/es/space/style";
|
|
4
4
|
import _Space from "antd/es/space";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
import { useMemo } from 'react';
|
|
7
8
|
import { isFunction } from 'lodash';
|
|
9
|
+
import classNames from 'classnames';
|
|
8
10
|
import ActionButton from './ActionButton';
|
|
9
11
|
import RenderFields from '../../../render/RenderFields';
|
|
10
12
|
import ProCollapse from '../../../../../ProLayout/components/ProCollapse';
|
|
@@ -34,8 +36,10 @@ var BlockFields = function BlockFields(props) {
|
|
|
34
36
|
}
|
|
35
37
|
return title;
|
|
36
38
|
}, [title, index]);
|
|
39
|
+
var cls = classNames(_defineProperty({}, "pro-form-list-mode-".concat(mode), mode === 'block' || mode === 'line' || mode === 'less'));
|
|
37
40
|
return _jsx(_Space, {
|
|
38
41
|
direction: "vertical",
|
|
42
|
+
className: cls,
|
|
39
43
|
children: _jsx(ProCollapse, {
|
|
40
44
|
title: _title,
|
|
41
45
|
index: index,
|
|
@@ -86,13 +86,14 @@ var Group = function Group(props) {
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
}, [value]);
|
|
89
|
+
var _otherProps = omit(otherProps, ['colProps', 'required']);
|
|
89
90
|
return _jsx("div", {
|
|
90
91
|
className: _className,
|
|
91
92
|
children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
|
|
92
93
|
children: _jsx(RenderFields, _objectSpread({
|
|
93
94
|
columns: data.columns,
|
|
94
95
|
form: form
|
|
95
|
-
},
|
|
96
|
+
}, _otherProps))
|
|
96
97
|
}) : _jsx(_Space, _objectSpread(_objectSpread({
|
|
97
98
|
align: "start"
|
|
98
99
|
}, omit(space, ['separator', 'compact'])), {}, {
|
|
@@ -100,7 +101,7 @@ var Group = function Group(props) {
|
|
|
100
101
|
return _jsx(RenderFields, _objectSpread({
|
|
101
102
|
columns: [column],
|
|
102
103
|
form: form
|
|
103
|
-
},
|
|
104
|
+
}, _otherProps), (column === null || column === void 0 ? void 0 : column.name) || index);
|
|
104
105
|
})
|
|
105
106
|
}))
|
|
106
107
|
});
|
|
@@ -154,9 +154,9 @@ var Render = function Render(props) {
|
|
|
154
154
|
// ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
|
|
155
155
|
Object.assign(otherFormItemProps, transforms, {
|
|
156
156
|
names: otherProps.names
|
|
157
|
-
}, internalRule,
|
|
158
|
-
required: labelRequired
|
|
159
|
-
}
|
|
157
|
+
}, internalRule, {
|
|
158
|
+
required: typeof labelRequired === 'boolean' ? labelRequired : _required
|
|
159
|
+
}, otherProps.isView && !requiredOnView ? {
|
|
160
160
|
required: false
|
|
161
161
|
} : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
|
|
162
162
|
_objectSpread({}, isUpperCase(type, upperCase)), {
|
|
@@ -222,12 +222,8 @@ var Render = function Render(props) {
|
|
|
222
222
|
if (valueType) {
|
|
223
223
|
_args[2].transformValue = form.getFieldValue(_otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : _otherFormItemProps.name) || undefined;
|
|
224
224
|
}
|
|
225
|
+
_args[2].option = args[1];
|
|
225
226
|
switch (type) {
|
|
226
|
-
case 'ProSelect':
|
|
227
|
-
case 'ProModalSelect':
|
|
228
|
-
case 'ProEnum':
|
|
229
|
-
_args[2].option = args[1];
|
|
230
|
-
break;
|
|
231
227
|
case 'ProAddressBar':
|
|
232
228
|
_args[2].selectedOptions = args[1];
|
|
233
229
|
break;
|
|
@@ -244,7 +240,7 @@ var Render = function Render(props) {
|
|
|
244
240
|
* onChange参数重置 (value, record, { form, index, namePath, option }) => void
|
|
245
241
|
*/
|
|
246
242
|
var handleChange = function handleChange() {
|
|
247
|
-
var _lastComponentProps$c2;
|
|
243
|
+
var _otherFormItemProps$n3, _lastComponentProps$c2;
|
|
248
244
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
249
245
|
args[_key] = arguments[_key];
|
|
250
246
|
}
|
|
@@ -262,6 +258,11 @@ var Render = function Render(props) {
|
|
|
262
258
|
((_AutoComponent$props$ = (_AutoComponent$props = AutoComponent === null || AutoComponent === void 0 ? void 0 : AutoComponent.props)[changeKey]) === null || _AutoComponent$props$ === void 0 ? void 0 : _AutoComponent$props$.call.apply(_AutoComponent$props$, [_AutoComponent$props].concat(_toConsumableArray(_args)))) || ((_lastComponentProps$c = lastComponentProps[changeKey]) === null || _lastComponentProps$c === void 0 ? void 0 : _lastComponentProps$c.call.apply(_lastComponentProps$c, [lastComponentProps].concat(_toConsumableArray(_args))));
|
|
263
259
|
return false;
|
|
264
260
|
}
|
|
261
|
+
var inList = _otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : (_otherFormItemProps$n3 = _otherFormItemProps.namePath) === null || _otherFormItemProps$n3 === void 0 ? void 0 : _otherFormItemProps$n3.length;
|
|
262
|
+
// FormList 和 Group场景 对比值改变的话, 回显到表单上
|
|
263
|
+
if (inList) {
|
|
264
|
+
form.setFieldsValue(_args[1]);
|
|
265
|
+
}
|
|
265
266
|
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
266
267
|
if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
|
|
267
268
|
setTimeout(function () {
|
|
@@ -16,7 +16,7 @@ interface Props<T = any> {
|
|
|
16
16
|
originalValues?: ProFormProps<T>['originalValues'];
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
|
-
required?: boolean | (() => boolean);
|
|
19
|
+
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
|
20
20
|
originalDiffTip?: boolean;
|
|
21
21
|
globalControl?: boolean;
|
|
22
22
|
}
|
|
@@ -206,7 +206,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
206
206
|
hiddenNames?: string[] | any[];
|
|
207
207
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
|
208
208
|
equalWith?: (originValue: any, currentValue: any) => boolean;
|
|
209
|
-
required?: boolean | ReactiveFunction<Values, boolean>;
|
|
209
|
+
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
210
210
|
labelRequired?: boolean;
|
|
211
211
|
toISOString?: boolean;
|
|
212
212
|
clearNotShow?: boolean;
|
|
@@ -38,7 +38,7 @@ export interface ProFormOtherProps {
|
|
|
38
38
|
colProps: ColProps;
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
show?: boolean | (() => boolean);
|
|
41
|
-
required?: boolean | (() => boolean);
|
|
41
|
+
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
|
42
42
|
mode?: string;
|
|
43
43
|
namePath?: any[] | string | number;
|
|
44
44
|
}
|
|
@@ -70,7 +70,7 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
70
70
|
clearNotShow?: boolean;
|
|
71
71
|
requiredOnView?: boolean;
|
|
72
72
|
formId?: string;
|
|
73
|
-
required?: boolean;
|
|
73
|
+
required?: boolean | boolean[];
|
|
74
74
|
originalDiffTip?: boolean;
|
|
75
75
|
}
|
|
76
76
|
export interface Transform<T = any> {
|
|
@@ -132,7 +132,8 @@
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-switch-handle),
|
|
136
|
+
.@{ant-prefix}-form-item-control:has(.@{ant-prefix}-checkbox-wrapper-in-form-item) {
|
|
136
137
|
background: @zaui-contract-bg;
|
|
137
138
|
border-radius: 4px;
|
|
138
139
|
}
|
|
@@ -140,13 +141,13 @@
|
|
|
140
141
|
// 地址组件
|
|
141
142
|
.@{ant-prefix}-form-item-control-input-content {
|
|
142
143
|
& > .pro-address {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
.@{ant-prefix}-select-selector,
|
|
145
|
+
.@{ant-prefix}-input-affix-wrapper,
|
|
146
|
+
.@{ant-prefix}-input-disabled {
|
|
146
147
|
background: @zaui-contract-bg;
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
|
-
& >
|
|
150
|
+
& > .@{ant-prefix}-input-group {
|
|
150
151
|
.forever-checkbox {
|
|
151
152
|
background: @zaui-contract-bg;
|
|
152
153
|
}
|
|
@@ -346,4 +347,21 @@
|
|
|
346
347
|
.delete-icon {
|
|
347
348
|
width: 18px;
|
|
348
349
|
}
|
|
350
|
+
.pro-form-list-tool-btn {
|
|
351
|
+
margin-left: 8px;
|
|
352
|
+
padding: 0;
|
|
353
|
+
cursor: pointer;
|
|
354
|
+
.anticon {
|
|
355
|
+
color: var(--zaui-text-weak, #a0a0a0);
|
|
356
|
+
font-size: 16px;
|
|
357
|
+
vertical-align: middle;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
.pro-form-list-mode-block{
|
|
361
|
+
.pro-collapse-content{
|
|
362
|
+
.@{ant-prefix}-row{
|
|
363
|
+
width: auto;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
349
367
|
}
|
|
@@ -1,46 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isEqual, isFunction } from 'lodash';
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { isEqual, isFunction, isString } from 'lodash';
|
|
3
3
|
var nullValue = [null, undefined, '']; // 输入框空值时可能存在的三种值 视为相等
|
|
4
|
-
var extractValue = function extractValue(obj, path) {
|
|
5
|
-
var value = obj || {};
|
|
6
|
-
if (!Object.keys(obj)) {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
var _iterator = _createForOfIteratorHelper(path),
|
|
10
|
-
_step;
|
|
11
|
-
try {
|
|
12
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
13
|
-
var key = _step.value;
|
|
14
|
-
if (value && value.hasOwnProperty(key)) {
|
|
15
|
-
value = value[key];
|
|
16
|
-
} else {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
} catch (err) {
|
|
21
|
-
_iterator.e(err);
|
|
22
|
-
} finally {
|
|
23
|
-
_iterator.f();
|
|
24
|
-
}
|
|
25
|
-
return Object.values(value);
|
|
26
|
-
};
|
|
27
4
|
/** 将解构后的name值,反向转回names,例如 formData {a:1, b:2} names ['a', 'b'] 返回 [1,2] */
|
|
28
|
-
var extractValues = function extractValues(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
var extractValues = function extractValues(form, pathString) {
|
|
6
|
+
var _pathString;
|
|
7
|
+
var result = [];
|
|
8
|
+
var PrefixesName = isString(pathString) ? [] : pathString.slice(0, -1);
|
|
9
|
+
if (isString(pathString)) {
|
|
10
|
+
pathString.split('-').forEach(function (item) {
|
|
11
|
+
result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
|
|
12
|
+
});
|
|
13
|
+
return result;
|
|
32
14
|
}
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
(_pathString = pathString[pathString.length - 1]) === null || _pathString === void 0 ? void 0 : _pathString.split('-').forEach(function (item) {
|
|
16
|
+
result.push(form.getFieldValue([].concat(_toConsumableArray(PrefixesName), [item])));
|
|
35
17
|
});
|
|
18
|
+
return result;
|
|
36
19
|
};
|
|
37
20
|
export var diffOriginal = function diffOriginal(params) {
|
|
21
|
+
var _name$join;
|
|
38
22
|
var originalValue = params.originalValue,
|
|
39
23
|
_value = params.value,
|
|
40
24
|
equalWith = params.equalWith,
|
|
41
25
|
form = params.form,
|
|
42
26
|
name = params.name;
|
|
43
|
-
var
|
|
27
|
+
var isNames = Array.isArray(name) && ((_name$join = name.join(',')) === null || _name$join === void 0 ? void 0 : _name$join.includes('-')) || (name === null || name === void 0 ? void 0 : name.includes('-'));
|
|
28
|
+
var value = !isNames ? _value : extractValues(form, name);
|
|
44
29
|
// 支持传入自定义比较事件
|
|
45
30
|
if (isFunction(equalWith)) {
|
|
46
31
|
return !equalWith(originalValue, value);
|
|
@@ -36,7 +36,7 @@ export declare const isNullValue: (value: any) => boolean;
|
|
|
36
36
|
* @param arr 值
|
|
37
37
|
* @returns boole
|
|
38
38
|
*/
|
|
39
|
-
export declare const isNotFullArray: (arr: any, length: any) => boolean;
|
|
39
|
+
export declare const isNotFullArray: (arr: any, length: any, required: any) => boolean;
|
|
40
40
|
/**
|
|
41
41
|
* 判断数组中值是否都为空 全部为空则为true
|
|
42
42
|
* @param arr 值
|