@zat-design/sisyphus-react 3.4.2 → 3.4.3-beta.2
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 +303 -267
- package/dist/less.esm.css +5024 -0
- package/dist/less.esm.js +3 -0
- package/es/ProConfigProvider/index.d.ts +1 -1
- package/es/ProConfigProvider/index.js +24 -2
- package/es/ProEditLabel/style/index.less +1 -2
- package/es/ProEditTable/components/RenderField/index.js +32 -21
- package/es/ProEditTable/index.js +3 -3
- package/es/ProEditTable/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +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 +2 -0
- package/es/ProEnum/components/Group.js +20 -19
- package/es/ProEnum/index.js +4 -3
- package/es/ProEnum/style/index.less +12 -3
- package/es/ProForm/components/base/DatePicker/index.js +2 -2
- package/es/ProForm/components/combination/FormList/index.js +6 -3
- package/es/ProForm/components/combination/FormList/utils.d.ts +2 -1
- package/es/ProForm/components/combination/FormList/utils.js +5 -3
- package/es/ProForm/components/combination/Group/index.js +31 -17
- package/es/ProForm/components/combination/Group/propsType.d.ts +6 -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/index.js +8 -2
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/es/ProForm/components/index.d.ts +0 -1
- package/es/ProForm/components/index.js +1 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +21 -13
- package/es/ProForm/components/render/RenderFields.d.ts +3 -2
- package/es/ProForm/components/render/RenderFields.js +7 -3
- package/es/ProForm/components/render/propsType.d.ts +2 -5
- package/es/ProForm/index.js +12 -11
- package/es/ProForm/propsType.d.ts +7 -3
- package/es/ProForm/style/index.less +17 -13
- 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 +2 -2
- package/es/ProForm/utils/index.js +7 -2
- package/es/ProForm/utils/rulesCreator.d.ts +7 -1
- package/es/ProForm/utils/rulesCreator.js +33 -3
- package/es/ProForm/utils/transformNames.d.ts +1 -1
- package/es/ProForm/utils/transformNames.js +11 -4
- package/es/ProForm/utils/transformValue.js +2 -2
- package/es/ProForm/utils/useChanged.js +4 -3
- package/es/ProForm/utils/useListChanged.d.ts +1 -1
- package/es/ProForm/utils/useListChanged.js +5 -3
- package/es/ProForm/utils/useRules.js +36 -11
- package/es/ProForm/utils/useShouldUpdate.js +4 -4
- package/es/ProForm/utils/valueType.d.ts +10 -5
- package/es/ProForm/utils/valueType.js +20 -10
- package/es/ProIcon/config/index.d.ts +2 -1
- package/es/ProIcon/config/index.js +191 -133
- package/es/ProIcon/index.d.ts +0 -1
- package/es/ProIcon/index.js +21 -36
- package/es/ProIcon/propsTypes.d.ts +2 -1
- package/es/ProLayout/components/Layout/Header/style/index.less +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +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 -0
- package/es/ProLayout/components/ProCollapse/index.js +45 -4
- package/es/ProLayout/components/ProCollapse/style/index.less +29 -11
- 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 +6 -5
- 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/style/index.less +2 -2
- 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 +14 -28
- package/es/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/es/ProThemeTools/index.js +21 -29
- package/es/ProThemeTools/propsType.d.ts +1 -1
- package/es/ProThemeTools/style/index.less +25 -8
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +7 -11
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.d.ts +1 -1
- package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +1 -1
- package/es/ProTree/index.js +1 -1
- package/es/ProTree/style/index.less +5 -0
- package/es/ProTreeModal/style/index.less +2 -2
- package/es/ProUpload/style/fileItem.less +2 -2
- package/es/ProUpload/style/index.less +2 -2
- package/es/assets/catalog.svg +30 -1
- package/es/assets/fold.svg +27 -0
- package/es/assets/setting.svg +14 -0
- package/es/locale/en_US.d.ts +4 -0
- package/es/locale/en_US.js +4 -0
- package/es/locale/zh_CN.d.ts +4 -0
- package/es/locale/zh_CN.js +4 -0
- package/es/style/components.less +0 -1
- package/es/style/less.less +2 -0
- package/es/style/theme/antd.less +14 -29
- package/es/style/theme/index.less +2 -2
- package/es/style/theme/tokens.less +2 -2
- package/es/tokens.js +2 -2
- package/lib/ProConfigProvider/index.d.ts +1 -1
- package/lib/ProConfigProvider/index.js +23 -1
- package/lib/ProEditLabel/style/index.less +1 -2
- package/lib/ProEditTable/components/RenderField/index.js +31 -20
- package/lib/ProEditTable/index.js +3 -3
- package/lib/ProEditTable/propsType.d.ts +1 -1
- package/lib/ProEditTable/style/index.less +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 +2 -0
- package/lib/ProEnum/components/Group.js +20 -19
- package/lib/ProEnum/index.js +4 -3
- package/lib/ProEnum/style/index.less +12 -3
- package/lib/ProForm/components/base/DatePicker/index.js +1 -1
- package/lib/ProForm/components/combination/FormList/index.js +6 -3
- package/lib/ProForm/components/combination/FormList/utils.d.ts +2 -1
- package/lib/ProForm/components/combination/FormList/utils.js +5 -3
- package/lib/ProForm/components/combination/Group/index.js +28 -14
- package/lib/ProForm/components/combination/Group/propsType.d.ts +6 -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/index.js +7 -1
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +1 -1
- package/lib/ProForm/components/index.d.ts +0 -1
- package/lib/ProForm/components/index.js +0 -7
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +21 -13
- package/lib/ProForm/components/render/RenderFields.d.ts +3 -2
- package/lib/ProForm/components/render/RenderFields.js +7 -3
- package/lib/ProForm/components/render/propsType.d.ts +2 -5
- package/lib/ProForm/index.js +11 -10
- package/lib/ProForm/propsType.d.ts +7 -3
- package/lib/ProForm/style/index.less +17 -13
- 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 +2 -2
- package/lib/ProForm/utils/index.js +8 -3
- package/lib/ProForm/utils/rulesCreator.d.ts +7 -1
- package/lib/ProForm/utils/rulesCreator.js +33 -2
- package/lib/ProForm/utils/transformNames.d.ts +1 -1
- package/lib/ProForm/utils/transformNames.js +10 -3
- package/lib/ProForm/utils/transformValue.js +1 -1
- package/lib/ProForm/utils/useChanged.js +4 -3
- package/lib/ProForm/utils/useListChanged.d.ts +1 -1
- package/lib/ProForm/utils/useListChanged.js +5 -3
- package/lib/ProForm/utils/useRules.js +36 -11
- package/lib/ProForm/utils/useShouldUpdate.js +4 -4
- package/lib/ProForm/utils/valueType.d.ts +10 -5
- package/lib/ProForm/utils/valueType.js +20 -10
- package/lib/ProIcon/config/index.d.ts +2 -1
- package/lib/ProIcon/config/index.js +191 -133
- package/lib/ProIcon/index.d.ts +0 -1
- package/lib/ProIcon/index.js +21 -37
- package/lib/ProIcon/propsTypes.d.ts +2 -1
- package/lib/ProLayout/components/Layout/Header/style/index.less +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +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 -0
- package/lib/ProLayout/components/ProCollapse/index.js +43 -4
- package/lib/ProLayout/components/ProCollapse/style/index.less +29 -11
- 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 +6 -5
- 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/style/index.less +2 -2
- 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 +14 -28
- package/lib/ProThemeTools/component/PrdTools/style/index.less +1 -1
- package/lib/ProThemeTools/index.js +19 -28
- package/lib/ProThemeTools/propsType.d.ts +1 -1
- package/lib/ProThemeTools/style/index.less +25 -8
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.js +7 -11
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.d.ts +1 -1
- package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/style/index.less +1 -1
- package/lib/ProTree/index.js +1 -1
- package/lib/ProTree/style/index.less +5 -0
- package/lib/ProTreeModal/style/index.less +2 -2
- package/lib/ProUpload/style/fileItem.less +2 -2
- package/lib/ProUpload/style/index.less +2 -2
- package/lib/assets/catalog.svg +30 -1
- package/lib/assets/fold.svg +27 -0
- package/lib/assets/setting.svg +14 -0
- package/lib/locale/en_US.d.ts +4 -0
- package/lib/locale/en_US.js +4 -0
- package/lib/locale/zh_CN.d.ts +4 -0
- package/lib/locale/zh_CN.js +4 -0
- package/lib/style/components.less +0 -1
- package/lib/style/less.less +2 -0
- package/lib/style/theme/antd.less +14 -29
- package/lib/style/theme/index.less +2 -2
- package/lib/style/theme/tokens.less +2 -2
- package/lib/tokens.js +2 -2
- package/package.json +1 -1
- package/es/ProForm/utils/contrastOriginal.js +0 -24
- package/es/ProIcon/symbolIcon.js +0 -43
- package/lib/ProForm/utils/contrastOriginal.js +0 -30
- package/lib/ProIcon/symbolIcon.js +0 -45
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/es/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/index.d.ts +0 -0
- /package/lib/{ProTreeSelect → ProTree/components/ProTreeSelect}/propsType.js +0 -0
|
@@ -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(
|
|
@@ -24,7 +24,6 @@ export { default as Container } from './combination/Container';
|
|
|
24
24
|
export { default as ProEnum } from '../../ProEnum';
|
|
25
25
|
export { default as ProSelect } from '../../ProSelect';
|
|
26
26
|
export { default as ProUpload } from '../../ProUpload';
|
|
27
|
-
export { default as ProTreeSelect } from '../../ProTreeSelect';
|
|
28
27
|
export { default as ProTreeModal } from '../../ProTreeModal';
|
|
29
28
|
export { default as ProTree } from '../../ProTree';
|
|
30
29
|
export { default as FormFooter } from './FormFooter';
|
|
@@ -167,12 +167,6 @@ Object.defineProperty(exports, "ProTreeModal", {
|
|
|
167
167
|
return _ProTreeModal.default;
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
|
-
Object.defineProperty(exports, "ProTreeSelect", {
|
|
171
|
-
enumerable: true,
|
|
172
|
-
get: function get() {
|
|
173
|
-
return _ProTreeSelect.default;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
170
|
Object.defineProperty(exports, "ProUpload", {
|
|
177
171
|
enumerable: true,
|
|
178
172
|
get: function get() {
|
|
@@ -252,7 +246,6 @@ var _Container = _interopRequireDefault(require("./combination/Container"));
|
|
|
252
246
|
var _ProEnum = _interopRequireDefault(require("../../ProEnum"));
|
|
253
247
|
var _ProSelect = _interopRequireDefault(require("../../ProSelect"));
|
|
254
248
|
var _ProUpload = _interopRequireDefault(require("../../ProUpload"));
|
|
255
|
-
var _ProTreeSelect = _interopRequireDefault(require("../../ProTreeSelect"));
|
|
256
249
|
var _ProTreeModal = _interopRequireDefault(require("../../ProTreeModal"));
|
|
257
250
|
var _ProTree = _interopRequireDefault(require("../../ProTree"));
|
|
258
251
|
var _FormFooter = _interopRequireDefault(require("./FormFooter"));
|
|
@@ -39,7 +39,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
if ((0, _lodash.isObject)(confirmProps)) {
|
|
42
|
-
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultConfirmProps), confirmProps), {}, {
|
|
42
|
+
_antd.Modal.confirm((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, 'title' in confirmProps || 'content' in confirmProps ? {} : defaultConfirmProps), confirmProps), {}, {
|
|
43
43
|
onOk: function onOk() {
|
|
44
44
|
var _confirmProps$onOk;
|
|
45
45
|
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
@@ -32,7 +32,7 @@ var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className",
|
|
|
32
32
|
/* eslint-disable prefer-destructuring */
|
|
33
33
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
34
34
|
var Render = function Render(props) {
|
|
35
|
-
var _ref2, _ref3, _otherProps$names2;
|
|
35
|
+
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
36
36
|
var component = props.component,
|
|
37
37
|
originComponent = props.originComponent,
|
|
38
38
|
_props$formItemProps = props.formItemProps,
|
|
@@ -50,8 +50,9 @@ var Render = function Render(props) {
|
|
|
50
50
|
originalValues = props.originalValues,
|
|
51
51
|
equalWith = props.equalWith,
|
|
52
52
|
requiredOnView = props.requiredOnView,
|
|
53
|
-
|
|
54
|
-
confirm = props.confirm
|
|
53
|
+
originalDiffTip = props.originalDiffTip,
|
|
54
|
+
confirm = props.confirm,
|
|
55
|
+
globalControl = props.globalControl;
|
|
55
56
|
var colProps = props.colProps;
|
|
56
57
|
// 剔除一些不是FormItem的属性, 防止控制台报warning
|
|
57
58
|
var labelWidth = formItemProps.labelWidth,
|
|
@@ -147,7 +148,7 @@ var Render = function Render(props) {
|
|
|
147
148
|
*/
|
|
148
149
|
var transforms = Array.isArray(otherProps === null || otherProps === void 0 ? void 0 : otherProps.names) ? (0, _transformNames.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, otherFormItemProps), valueTypeTransform()),
|
|
149
150
|
// 合并valueType的transform
|
|
150
|
-
form, otherProps.names, namesStr) : valueTypeTransform();
|
|
151
|
+
form, otherProps.names, namesStr, otherProps.type) : valueTypeTransform();
|
|
151
152
|
// ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
|
|
152
153
|
Object.assign(otherFormItemProps, transforms, {
|
|
153
154
|
names: otherProps.names
|
|
@@ -167,8 +168,12 @@ var Render = function Render(props) {
|
|
|
167
168
|
}
|
|
168
169
|
/** 移除多余参数,防止透传给formItem报错 */
|
|
169
170
|
var _otherFormItemProps = (0, _lodash.omit)(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
/**
|
|
172
|
+
* globalControl 全局控制优先
|
|
173
|
+
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
174
|
+
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
|
175
|
+
*/
|
|
176
|
+
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
|
|
172
177
|
/**
|
|
173
178
|
* 最新fieldProps: 更新后的组件Props
|
|
174
179
|
*/
|
|
@@ -196,8 +201,8 @@ var Render = function Render(props) {
|
|
|
196
201
|
var functionArgs = function functionArgs(args) {
|
|
197
202
|
var _otherFormItemProps$n;
|
|
198
203
|
var _args = (0, _toConsumableArray2.default)(args);
|
|
199
|
-
var
|
|
200
|
-
valueType =
|
|
204
|
+
var _ref6 = otherProps || {},
|
|
205
|
+
valueType = _ref6.valueType;
|
|
201
206
|
_args[1] = form.getFieldsValue();
|
|
202
207
|
_args[2] = {
|
|
203
208
|
form: form
|
|
@@ -264,7 +269,7 @@ var Render = function Render(props) {
|
|
|
264
269
|
}, 60);
|
|
265
270
|
}
|
|
266
271
|
// ProTreeSelect返回option
|
|
267
|
-
if (['
|
|
272
|
+
if (['ProTree'].includes(type)) {
|
|
268
273
|
var _args2, _args2$;
|
|
269
274
|
_args[2].option = (0, _index.findOptionByValue)(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0]);
|
|
270
275
|
}
|
|
@@ -274,7 +279,7 @@ var Render = function Render(props) {
|
|
|
274
279
|
* onBlur参数重置 (value, record, { form, index, namePath, option }) => void
|
|
275
280
|
*/
|
|
276
281
|
var handleBlur = /*#__PURE__*/function () {
|
|
277
|
-
var
|
|
282
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
278
283
|
var _len2,
|
|
279
284
|
args,
|
|
280
285
|
_key2,
|
|
@@ -301,7 +306,7 @@ var Render = function Render(props) {
|
|
|
301
306
|
}, _callee);
|
|
302
307
|
}));
|
|
303
308
|
return function handleBlur() {
|
|
304
|
-
return
|
|
309
|
+
return _ref7.apply(this, arguments);
|
|
305
310
|
};
|
|
306
311
|
}();
|
|
307
312
|
var renderItem = function renderItem() {
|
|
@@ -378,7 +383,7 @@ var Render = function Render(props) {
|
|
|
378
383
|
};
|
|
379
384
|
}
|
|
380
385
|
// 需要过滤掉的form_item的key
|
|
381
|
-
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after'];
|
|
386
|
+
var filterFormItemKey = ['onFieldChange', 'shouldUpdate', 'namePath', 'isView', 'parentNames', 'space', 'before', 'after', 'globalControl'];
|
|
382
387
|
if (type === 'FormList') {
|
|
383
388
|
lastComponentProps.disabled = lastDisabled;
|
|
384
389
|
var lessMode = lastComponentProps.mode === 'less';
|
|
@@ -427,7 +432,7 @@ var Render = function Render(props) {
|
|
|
427
432
|
});
|
|
428
433
|
}
|
|
429
434
|
// 不渲染tooltip
|
|
430
|
-
if (!
|
|
435
|
+
if (!originalDiffTip || ['FormList', 'ProEditTable'].includes(type)) {
|
|
431
436
|
return formItem;
|
|
432
437
|
}
|
|
433
438
|
var title = (0, _jsxRuntime.jsxs)(_antd.Space, {
|
|
@@ -440,6 +445,9 @@ var Render = function Render(props) {
|
|
|
440
445
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
441
446
|
title: title,
|
|
442
447
|
visible: changed ? undefined : false,
|
|
448
|
+
getPopupContainer: function getPopupContainer(target) {
|
|
449
|
+
return target.parentElement;
|
|
450
|
+
},
|
|
443
451
|
children: formItem
|
|
444
452
|
});
|
|
445
453
|
};
|
|
@@ -16,8 +16,9 @@ interface Props<T = any> {
|
|
|
16
16
|
originalValues?: ProFormProps<T>['originalValues'];
|
|
17
17
|
clearNotShow?: boolean;
|
|
18
18
|
requiredOnView?: boolean;
|
|
19
|
-
required?: boolean | (() => boolean);
|
|
20
|
-
|
|
19
|
+
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
|
20
|
+
originalDiffTip?: boolean;
|
|
21
|
+
globalControl?: boolean;
|
|
21
22
|
}
|
|
22
23
|
declare const RenderFields: React.FC<Props>;
|
|
23
24
|
export default RenderFields;
|
|
@@ -33,7 +33,8 @@ 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
|
+
globalControl = props.globalControl;
|
|
37
38
|
// 是否包含隐藏字段
|
|
38
39
|
var hiddenData = columns.filter(function (item) {
|
|
39
40
|
return Array.isArray(item.hiddenNames);
|
|
@@ -183,7 +184,9 @@ var RenderFields = function RenderFields(props) {
|
|
|
183
184
|
form: form,
|
|
184
185
|
type: _type,
|
|
185
186
|
hiddenNames: column.hiddenNames,
|
|
186
|
-
colProps: _colProps
|
|
187
|
+
colProps: _colProps,
|
|
188
|
+
mode: componentProps.mode,
|
|
189
|
+
namePath: column.namePath
|
|
187
190
|
};
|
|
188
191
|
if (outerClearNotShow !== false && show === false && (column === null || column === void 0 ? void 0 : column.name) && form.getFieldValue(column === null || column === void 0 ? void 0 : column.name)) {
|
|
189
192
|
setTimeout(function () {
|
|
@@ -212,7 +215,8 @@ var RenderFields = function RenderFields(props) {
|
|
|
212
215
|
originalValues: originalValues,
|
|
213
216
|
equalWith: equalWith,
|
|
214
217
|
requiredOnView: requiredOnView,
|
|
215
|
-
|
|
218
|
+
originalDiffTip: originalDiffTip,
|
|
219
|
+
globalControl: globalControl
|
|
216
220
|
})
|
|
217
221
|
}, "".concat(_formItemProps.name || _formItemProps.label).concat(index));
|
|
218
222
|
});
|
|
@@ -26,7 +26,6 @@ import { Props as ProRangeLimitProps } from '../combination/ProRangeLimit';
|
|
|
26
26
|
import { CheckboxPropsMap, ProEnum, PropProSelectsMap, PropRadioPropsMap } from '../../../ProEnum/propsType';
|
|
27
27
|
import { PropSelectProps as ProSelectProps } from '../../../ProSelect/propsType';
|
|
28
28
|
import { ProEditTableProps } from '../../../ProEditTable/propsType';
|
|
29
|
-
import { PropTreeSelectProps } from '../../../ProTreeSelect/propsType';
|
|
30
29
|
import { ProTreeModalProps } from '../../../ProTreeModal/propsType';
|
|
31
30
|
import { ProUploadProps } from '../../../ProUpload/propsType';
|
|
32
31
|
import { ProTreeProps } from '../../../ProTree/propsType';
|
|
@@ -150,9 +149,6 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
150
149
|
} | {
|
|
151
150
|
type?: 'ProEditTable';
|
|
152
151
|
fieldProps?: FieldProps<ProEditTableProps, Values, T>;
|
|
153
|
-
} | {
|
|
154
|
-
type?: 'ProTreeSelect';
|
|
155
|
-
fieldProps?: FieldProps<PropTreeSelectProps, Values, T>;
|
|
156
152
|
} | {
|
|
157
153
|
type?: 'ProTreeModal';
|
|
158
154
|
fieldProps?: FieldProps<ProTreeModalProps, Values, T>;
|
|
@@ -210,7 +206,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
210
206
|
hiddenNames?: string[] | any[];
|
|
211
207
|
rules?: ProRule[] | ReactiveFunction<Values, ProRule[]>;
|
|
212
208
|
equalWith?: (originValue: any, currentValue: any) => boolean;
|
|
213
|
-
required?: boolean | ReactiveFunction<Values, boolean>;
|
|
209
|
+
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
214
210
|
labelRequired?: boolean;
|
|
215
211
|
toISOString?: boolean;
|
|
216
212
|
clearNotShow?: boolean;
|
|
@@ -270,6 +266,7 @@ export interface RenderProps<Values = any> {
|
|
|
270
266
|
originalValues?: Values;
|
|
271
267
|
requiredOnView?: boolean;
|
|
272
268
|
confirm?: ProFormColumnProps['confirm'];
|
|
269
|
+
globalControl?: boolean;
|
|
273
270
|
[name: string]: any;
|
|
274
271
|
}
|
|
275
272
|
export {};
|
package/lib/ProForm/index.js
CHANGED
|
@@ -25,9 +25,9 @@ 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
|
-
var _forms$formKey, _localStorage;
|
|
30
|
+
var _forms$formKey, _localStorage, _ref;
|
|
31
31
|
var _props$mode = props.mode,
|
|
32
32
|
mode = _props$mode === void 0 ? 'search' : _props$mode,
|
|
33
33
|
span = props.span,
|
|
@@ -50,8 +50,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
50
50
|
expandOpenChange = props.expandOpenChange,
|
|
51
51
|
_props$viewEmpty = props.viewEmpty,
|
|
52
52
|
viewEmpty = _props$viewEmpty === void 0 ? '-' : _props$viewEmpty,
|
|
53
|
-
|
|
54
|
-
labelAlign = _props$labelAlign === void 0 ? 'left' : _props$labelAlign,
|
|
53
|
+
labelAlign = props.labelAlign,
|
|
55
54
|
labelWidth = props.labelWidth,
|
|
56
55
|
onValuesChange = props.onValuesChange,
|
|
57
56
|
onFinish = props.onFinish,
|
|
@@ -64,9 +63,10 @@ var ProForm = function ProForm(props, ref) {
|
|
|
64
63
|
requiredOnView = _props$requiredOnView === void 0 ? true : _props$requiredOnView,
|
|
65
64
|
formId = props.formId,
|
|
66
65
|
required = props.required,
|
|
67
|
-
_props$
|
|
68
|
-
|
|
66
|
+
_props$originalDiffTi = props.originalDiffTip,
|
|
67
|
+
originalDiffTip = _props$originalDiffTi === void 0 ? true : _props$originalDiffTi,
|
|
69
68
|
formKey = props.formKey,
|
|
69
|
+
globalControl = props.globalControl,
|
|
70
70
|
otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
71
71
|
var _useProConfig = (0, _ProConfigProvider.useProConfig)(),
|
|
72
72
|
state = _useProConfig.state,
|
|
@@ -231,9 +231,9 @@ var ProForm = function ProForm(props, ref) {
|
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
className: cls,
|
|
234
|
-
form: form
|
|
235
|
-
labelAlign: labelAlign
|
|
234
|
+
form: form
|
|
236
235
|
}, formProps), config), otherProps), {}, {
|
|
236
|
+
labelAlign: (_ref = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref !== void 0 ? _ref : 'left',
|
|
237
237
|
onValuesChange: handleValuesChange,
|
|
238
238
|
onFinish: handleFinish,
|
|
239
239
|
initialValues: _initialValues,
|
|
@@ -254,7 +254,8 @@ var ProForm = function ProForm(props, ref) {
|
|
|
254
254
|
clearNotShow: clearNotShow,
|
|
255
255
|
requiredOnView: requiredOnView,
|
|
256
256
|
required: required,
|
|
257
|
-
|
|
257
|
+
originalDiffTip: originalDiffTip,
|
|
258
|
+
globalControl: globalControl
|
|
258
259
|
}), children, footerRender()]
|
|
259
260
|
}))
|
|
260
261
|
}));
|
|
@@ -319,7 +320,7 @@ ProFormForward.ProNumberRange = _components.ProNumberRange;
|
|
|
319
320
|
ProFormForward.ProModalSelect = _components.ProModalSelect;
|
|
320
321
|
ProFormForward.ProTimeLimit = _components.ProTimeLimit;
|
|
321
322
|
ProFormForward.ProUpload = _components.ProUpload;
|
|
322
|
-
ProFormForward.ProTreeSelect =
|
|
323
|
+
// ProFormForward.ProTreeSelect = ProTreeSelect;
|
|
323
324
|
ProFormForward.ProTreeModal = _components.ProTreeModal;
|
|
324
325
|
ProFormForward.ProTree = _components.ProTree;
|
|
325
326
|
// 待废弃
|
|
@@ -38,10 +38,14 @@ 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
|
+
mode?: string;
|
|
43
|
+
namePath?: any[] | string | number;
|
|
42
44
|
}
|
|
43
45
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
44
46
|
disabled?: boolean;
|
|
47
|
+
/** 全局控制优先 */
|
|
48
|
+
globalControl?: boolean;
|
|
45
49
|
mode?: ModeEnum;
|
|
46
50
|
formKey?: string;
|
|
47
51
|
/** 是否查看 */
|
|
@@ -66,8 +70,8 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
|
66
70
|
clearNotShow?: boolean;
|
|
67
71
|
requiredOnView?: boolean;
|
|
68
72
|
formId?: string;
|
|
69
|
-
required?: boolean;
|
|
70
|
-
|
|
73
|
+
required?: boolean | boolean[];
|
|
74
|
+
originalDiffTip?: boolean;
|
|
71
75
|
}
|
|
72
76
|
export interface Transform<T = any> {
|
|
73
77
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
|
@@ -31,16 +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
|
-
.pro-collapse-level2 {
|
|
39
|
-
.@{ant-prefix}-collapse-item {
|
|
40
|
-
margin-bottom: 0 !important;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
34
|
.@{ant-prefix}-form-item-control-input {
|
|
45
35
|
flex-grow: 1;
|
|
46
36
|
max-width: 100%;
|
|
@@ -135,7 +125,7 @@
|
|
|
135
125
|
background: @zaui-contract-bg !important;
|
|
136
126
|
|
|
137
127
|
input {
|
|
138
|
-
background:
|
|
128
|
+
background: transparent;
|
|
139
129
|
}
|
|
140
130
|
.@{ant-prefix}-select-selection-placeholder {
|
|
141
131
|
z-index: 9;
|
|
@@ -147,8 +137,22 @@
|
|
|
147
137
|
border-radius: 4px;
|
|
148
138
|
}
|
|
149
139
|
|
|
150
|
-
//
|
|
151
|
-
.@{ant-prefix}-form-item-control-input-content
|
|
140
|
+
// 地址组件
|
|
141
|
+
.@{ant-prefix}-form-item-control-input-content {
|
|
142
|
+
& > .pro-address {
|
|
143
|
+
.ant-select-selector,
|
|
144
|
+
.ant-input-affix-wrapper,
|
|
145
|
+
.ant-input-disabled {
|
|
146
|
+
background: @zaui-contract-bg;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
& > .ant-input-group {
|
|
150
|
+
.forever-checkbox {
|
|
151
|
+
background: @zaui-contract-bg;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
152
156
|
.pro-form-view-container {
|
|
153
157
|
padding: 4px 8px;
|
|
154
158
|
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[];
|
|
@@ -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 值
|
|
@@ -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
|
});
|
|
@@ -187,10 +187,15 @@ var isNullValue = exports.isNullValue = function isNullValue(value) {
|
|
|
187
187
|
* @param arr 值
|
|
188
188
|
* @returns boole
|
|
189
189
|
*/
|
|
190
|
-
var isNotFullArray = exports.isNotFullArray = function isNotFullArray(arr, length) {
|
|
190
|
+
var isNotFullArray = exports.isNotFullArray = function isNotFullArray(arr, length, required) {
|
|
191
191
|
if (!Array.isArray(arr)) {
|
|
192
192
|
return false;
|
|
193
193
|
}
|
|
194
|
+
if (Array.isArray(required) && required.some(function (item) {
|
|
195
|
+
return item === false;
|
|
196
|
+
})) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
194
199
|
if (arr.length < length) return true;
|
|
195
200
|
return arr.some(function (item) {
|
|
196
201
|
if (item === undefined || item === null) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
@@ -9,9 +10,23 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
9
10
|
var _utils = require("@zat-design/utils");
|
|
10
11
|
var _lodash = require("lodash");
|
|
11
12
|
var _index = require("./index");
|
|
12
|
-
var _locale =
|
|
13
|
-
var
|
|
13
|
+
var _locale = _interopRequireWildcard(require("../../locale"));
|
|
14
|
+
var getNonEmptyValuesByIndex = function getNonEmptyValuesByIndex(required, valueArray) {
|
|
15
|
+
var result = [];
|
|
16
|
+
required.forEach(function (item, index) {
|
|
17
|
+
if (item && !valueArray[index] && !(0, _lodash.isNumber)(valueArray[index])) {
|
|
18
|
+
result.push(index + 1);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
var rulesCreator = exports.rulesCreator = function rulesCreator(_ref) {
|
|
14
24
|
var _result;
|
|
25
|
+
var rules = _ref.rules,
|
|
26
|
+
label = _ref.label,
|
|
27
|
+
isSelect = _ref.isSelect,
|
|
28
|
+
names = _ref.names,
|
|
29
|
+
required = _ref.required;
|
|
15
30
|
var message = "".concat(isSelect ? "".concat(_locale.default.ProForm.selectPlaceHolder) : "".concat(_locale.default.ProForm.inputPlaceholder)).concat(_locale.default.ProForm.ruleText).concat((0, _lodash.isString)(label) ? label : '');
|
|
16
31
|
var result = [];
|
|
17
32
|
result = rules.map(function (ruleItem) {
|
|
@@ -36,6 +51,22 @@ var rulesCreator = exports.rulesCreator = function rulesCreator(rules, label, is
|
|
|
36
51
|
}
|
|
37
52
|
return rule;
|
|
38
53
|
});
|
|
54
|
+
if ((names === null || names === void 0 ? void 0 : names.length) && (required === null || required === void 0 ? void 0 : required.length)) {
|
|
55
|
+
var customRequired = {
|
|
56
|
+
validator: function validator(rules, value) {
|
|
57
|
+
var errorIndexes = getNonEmptyValuesByIndex(required, value);
|
|
58
|
+
// 校验为true的值是否存在
|
|
59
|
+
if (Array.isArray(value) && (errorIndexes === null || errorIndexes === void 0 ? void 0 : errorIndexes.length)) {
|
|
60
|
+
var _locale$ProForm;
|
|
61
|
+
return Promise.reject(new Error("".concat((0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProForm = _locale.default.ProForm) === null || _locale$ProForm === void 0 ? void 0 : _locale$ProForm.halfRuleText, {
|
|
62
|
+
total: errorIndexes === null || errorIndexes === void 0 ? void 0 : errorIndexes.join(',')
|
|
63
|
+
}))));
|
|
64
|
+
}
|
|
65
|
+
return Promise.resolve();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
result.push(customRequired);
|
|
69
|
+
}
|
|
39
70
|
if (!((_result = result) === null || _result === void 0 ? void 0 : _result.length)) {
|
|
40
71
|
result = [{
|
|
41
72
|
required: false
|
|
@@ -6,5 +6,5 @@ interface TransformProps extends FormItemProps {
|
|
|
6
6
|
namePath: any[];
|
|
7
7
|
}
|
|
8
8
|
type TransformFun = 'normalize' | 'getValueProps' | 'shouldUpdate' | 'name';
|
|
9
|
-
declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string) => Pick<TransformProps, TransformFun>;
|
|
9
|
+
declare const transformNames: (formItem: TransformProps, form: FormInstance, names: NamePath[], fieldName: string, type?: string) => Pick<TransformProps, TransformFun>;
|
|
10
10
|
export default transformNames;
|
|
@@ -6,17 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _lodash = require("lodash");
|
|
8
8
|
var _transformValue2 = require("./transformValue");
|
|
9
|
-
var transformNames = function transformNames(formItem, form, names, fieldName) {
|
|
9
|
+
var transformNames = function transformNames(formItem, form, names, fieldName, type) {
|
|
10
|
+
var _names2, _names3, _names3$;
|
|
10
11
|
var _ref = formItem || {},
|
|
11
12
|
normalize = _ref.normalize,
|
|
12
13
|
getValueProps = _ref.getValueProps,
|
|
13
14
|
_shouldUpdate2 = _ref.shouldUpdate;
|
|
14
|
-
|
|
15
|
+
var _names = names;
|
|
16
|
+
if (!((_names2 = _names) === null || _names2 === void 0 ? void 0 : _names2.length)) {
|
|
15
17
|
return {};
|
|
16
18
|
}
|
|
17
19
|
// 当在formList场景下,给transformValue函数的setFiledProps的name, 需要全namePath
|
|
18
20
|
var _fieldName = Array.isArray(formItem === null || formItem === void 0 ? void 0 : formItem.name) ? (0, _lodash.union)(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, formItem === null || formItem === void 0 ? void 0 : formItem.name) : fieldName;
|
|
19
|
-
|
|
21
|
+
if (type === 'Group' && (0, _lodash.isNumber)((_names3 = _names) === null || _names3 === void 0 ? void 0 : (_names3$ = _names3[0]) === null || _names3$ === void 0 ? void 0 : _names3$[0])) {
|
|
22
|
+
_names = _names.map(function (item) {
|
|
23
|
+
return (0, _lodash.union)(formItem === null || formItem === void 0 ? void 0 : formItem.namePath, item);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var _transformValue = (0, _transformValue2.transformValue)(_names, form, _fieldName, normalize, getValueProps),
|
|
20
27
|
_normalize = _transformValue.normalize,
|
|
21
28
|
_getValueProps = _transformValue.getValueProps,
|
|
22
29
|
_shouldUpdate = _transformValue.shouldUpdate;
|
|
@@ -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
|
};
|