@zat-design/sisyphus-react 3.4.3 → 3.4.4
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 +35 -31
- package/dist/less.esm.css +20 -4
- package/es/ProConfigProvider/index.d.ts +1 -1
- package/es/ProConfigProvider/index.js +22 -1
- package/es/ProEditLabel/style/index.less +0 -1
- package/es/ProEditTable/components/DndWrapper/index.js +1 -1
- package/es/ProEditTable/components/RenderField/index.js +20 -14
- package/es/ProEditTable/index.js +17 -10
- package/es/ProEnum/components/Group.js +2 -19
- package/es/ProForm/components/base/DatePicker/index.js +3 -1
- package/es/ProForm/components/base/TextArea/index.js +4 -4
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
- package/es/ProForm/components/combination/Group/index.js +3 -2
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +116 -63
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +8 -2
- package/es/ProForm/components/render/Render.js +12 -9
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/propsType.d.ts +4 -4
- package/es/ProForm/index.js +4 -5
- 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 +14 -4
- 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/index.js +23 -1
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +12 -50
- package/es/ProThemeTools/index.js +0 -1
- 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/assets/view.svg +20 -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 +14 -28
- package/lib/ProConfigProvider/index.d.ts +1 -1
- package/lib/ProConfigProvider/index.js +21 -0
- package/lib/ProEditLabel/style/index.less +0 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +18 -12
- package/lib/ProEditTable/index.js +17 -10
- package/lib/ProEnum/components/Group.js +2 -19
- package/lib/ProForm/components/base/DatePicker/index.js +3 -1
- package/lib/ProForm/components/base/TextArea/index.js +5 -5
- package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +12 -10
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +6 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -5
- package/lib/ProForm/components/combination/Group/index.js +3 -2
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +2 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +123 -74
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +2 -2
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -1
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/render/ConfirmWrapper.js +8 -2
- package/lib/ProForm/components/render/Render.js +12 -9
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/propsType.d.ts +4 -4
- package/lib/ProForm/index.js +4 -5
- 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 +14 -4
- 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/index.js +23 -1
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +12 -50
- package/lib/ProThemeTools/index.js +0 -1
- 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/assets/view.svg +20 -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 +14 -28
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ var actions = {
|
|
|
20
20
|
namePath = _ref.namePath;
|
|
21
21
|
operation.add();
|
|
22
22
|
},
|
|
23
|
-
label: "".concat(locale.ProForm.
|
|
23
|
+
label: "".concat(locale.ProForm.formListActions[5]),
|
|
24
24
|
type: 'link',
|
|
25
25
|
icon: _jsx(PlusOutlined, {})
|
|
26
26
|
}
|
|
@@ -59,9 +59,6 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
59
59
|
operation.add(data);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
if (disabled || isView) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
62
|
return _jsx(_Space, {
|
|
66
63
|
align: "start",
|
|
67
64
|
className: "pro-form-list-toolbar",
|
|
@@ -80,7 +77,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
80
77
|
rest = _objectWithoutProperties(item, _excluded);
|
|
81
78
|
var _onClick = _onClick2 || onHandle;
|
|
82
79
|
if (['add'].includes(actionType)) {
|
|
83
|
-
if (disabled) return _jsx(_Fragment, {});
|
|
80
|
+
if (disabled || isView) return _jsx(_Fragment, {});
|
|
84
81
|
var _actions$actionType = actions[actionType],
|
|
85
82
|
internalOnClick = _actions$actionType.onClick,
|
|
86
83
|
defaultLabel = _actions$actionType.label,
|
|
@@ -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
|
});
|
|
@@ -47,7 +47,8 @@ export function useRequestList(service, options, useRequestOptions) {
|
|
|
47
47
|
onPageChange = _useDefaultOptions.onPageChange,
|
|
48
48
|
transformParams = _useDefaultOptions.transformParams,
|
|
49
49
|
transformResponse = _useDefaultOptions.transformResponse;
|
|
50
|
-
var
|
|
50
|
+
var _ref2 = useRequestOptions || {},
|
|
51
|
+
defaultParams = _ref2.defaultParams;
|
|
51
52
|
// 搜索表单里的值
|
|
52
53
|
var _useState3 = useState(),
|
|
53
54
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import "antd/es/tooltip/style";
|
|
2
2
|
import _Tooltip from "antd/es/tooltip";
|
|
3
|
+
import "antd/es/button/style";
|
|
4
|
+
import _Button from "antd/es/button";
|
|
3
5
|
import "antd/es/input/style";
|
|
4
6
|
import _Input from "antd/es/input";
|
|
7
|
+
import "antd/es/space/style";
|
|
8
|
+
import _Space from "antd/es/space";
|
|
5
9
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
10
|
import "antd/es/message/style";
|
|
7
11
|
import _message from "antd/es/message";
|
|
@@ -16,12 +20,13 @@ var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames",
|
|
|
16
20
|
_excluded2 = ["onOk"],
|
|
17
21
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
|
18
22
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
-
import {
|
|
23
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
20
24
|
import { useMount, useSetState } from 'ahooks';
|
|
21
|
-
import {
|
|
25
|
+
import { useRequest as useUmiRequest } from 'umi';
|
|
26
|
+
import { cloneDeep, debounce, isArray, isEqual, isFunction, omit } from 'lodash';
|
|
22
27
|
import { ReactSVG } from 'react-svg';
|
|
23
28
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo } from 'react';
|
|
24
|
-
import { ProForm, ProDrawerForm, ProTable, useProConfig } from '../../../../index';
|
|
29
|
+
import { ProForm, ProDrawerForm, ProTable, useProConfig, ProSelect } from '../../../../index';
|
|
25
30
|
import Container from '../../Container';
|
|
26
31
|
import viewSvg from '../../../../assets/view.svg';
|
|
27
32
|
import useRequestList from './hooks/useRequestList';
|
|
@@ -49,7 +54,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
49
54
|
isTooltip = props.isTooltip,
|
|
50
55
|
searchForm = props.searchForm,
|
|
51
56
|
defaultOne = props.defaultOne,
|
|
52
|
-
|
|
57
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
53
58
|
var contentForm = _Form.useFormInstance();
|
|
54
59
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
|
55
60
|
throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
|
|
@@ -102,6 +107,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
102
107
|
onOff: false,
|
|
103
108
|
visible: false,
|
|
104
109
|
open: false,
|
|
110
|
+
options: (tableProps === null || tableProps === void 0 ? void 0 : tableProps.dataSource) || [],
|
|
105
111
|
selectedRows: [],
|
|
106
112
|
selectedRowKeys: []
|
|
107
113
|
}),
|
|
@@ -112,6 +118,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
112
118
|
onOff = _useSetState2$.onOff,
|
|
113
119
|
visible = _useSetState2$.visible,
|
|
114
120
|
open = _useSetState2$.open,
|
|
121
|
+
options = _useSetState2$.options,
|
|
115
122
|
_selectedRows = _useSetState2$.selectedRows,
|
|
116
123
|
_selectedRowKeys = _useSetState2$.selectedRowKeys,
|
|
117
124
|
setState = _useSetState2[1];
|
|
@@ -120,13 +127,23 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
120
127
|
form = _Form$useForm2[0];
|
|
121
128
|
var selectedRows = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRows) || _selectedRows;
|
|
122
129
|
var selectedRowKeys = (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
|
|
130
|
+
var _useUmiRequest = useUmiRequest(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
|
131
|
+
manual: true,
|
|
132
|
+
onSuccess: function onSuccess(data) {
|
|
133
|
+
var list = withPagination ? data === null || data === void 0 ? void 0 : data.list : data;
|
|
134
|
+
setState({
|
|
135
|
+
options: list
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
})),
|
|
139
|
+
run = _useUmiRequest.run;
|
|
123
140
|
var _useRequestList = useRequestList(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, {
|
|
124
141
|
withPagination: withPagination,
|
|
125
142
|
transformParams: transformParams,
|
|
126
143
|
transformResponse: transformResponse
|
|
127
144
|
}, _objectSpread({
|
|
128
145
|
manual: true,
|
|
129
|
-
ready: (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) ||
|
|
146
|
+
ready: ((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne) && !readOnly || visible
|
|
130
147
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
|
|
131
148
|
data = _useRequestList.data,
|
|
132
149
|
loading = _useRequestList.loading,
|
|
@@ -207,14 +224,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
207
224
|
});
|
|
208
225
|
}
|
|
209
226
|
};
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
onChange(undefined, {});
|
|
213
|
-
setState({
|
|
214
|
-
_value: undefined,
|
|
215
|
-
selectedRowKeys: [],
|
|
216
|
-
selectedRows: []
|
|
217
|
-
});
|
|
227
|
+
var handleSelectValue = function handleSelectValue(val, option) {
|
|
228
|
+
onChange(val, option);
|
|
218
229
|
};
|
|
219
230
|
var handleClick = /*#__PURE__*/function () {
|
|
220
231
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -317,7 +328,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
317
328
|
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? _data : getNextValues(_data), _data);
|
|
318
329
|
// 更新内部展示值
|
|
319
330
|
setState({
|
|
320
|
-
_value: _data
|
|
331
|
+
_value: _data,
|
|
332
|
+
options: isArray(_data) ? _data : [_data]
|
|
321
333
|
});
|
|
322
334
|
handleClose();
|
|
323
335
|
}
|
|
@@ -586,9 +598,30 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
586
598
|
}, [onOff, visible, value]);
|
|
587
599
|
useEffect(function () {
|
|
588
600
|
if (value && !visible && isInit) {
|
|
589
|
-
|
|
601
|
+
if (readOnly) {
|
|
602
|
+
// 加定时器 修复依赖数据同步更新未取到问题
|
|
603
|
+
setTimeout(function () {
|
|
604
|
+
var _useRequest$options7, _useRequest$options8;
|
|
605
|
+
var initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams;
|
|
606
|
+
if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
|
|
607
|
+
var _contentForm$getField2;
|
|
608
|
+
initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField2 = contentForm.getFieldsValue) === null || _contentForm$getField2 === void 0 ? void 0 : _contentForm$getField2.call(contentForm));
|
|
609
|
+
}
|
|
610
|
+
var params = withPagination ? {
|
|
611
|
+
pageNum: 1,
|
|
612
|
+
pageSize: 50,
|
|
613
|
+
queryBean: _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.defaultParams), initParams)
|
|
614
|
+
} : _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options8 = useRequest.options) === null || _useRequest$options8 === void 0 ? void 0 : _useRequest$options8.defaultParams), initParams);
|
|
615
|
+
run(params);
|
|
616
|
+
setState({
|
|
617
|
+
isInit: false
|
|
618
|
+
});
|
|
619
|
+
}, 300);
|
|
620
|
+
} else {
|
|
621
|
+
getInitValues();
|
|
622
|
+
}
|
|
590
623
|
}
|
|
591
|
-
}, [value, visible, isInit]);
|
|
624
|
+
}, [value, visible, isInit, useRequest]);
|
|
592
625
|
useEffect(function () {
|
|
593
626
|
if (!value) {
|
|
594
627
|
if (defaultOne) {
|
|
@@ -601,59 +634,79 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
601
634
|
});
|
|
602
635
|
}
|
|
603
636
|
}
|
|
604
|
-
if (
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
637
|
+
if (!readOnly) {
|
|
638
|
+
if (labelInValue && _value && !isEqual(value, _value)) {
|
|
639
|
+
setState({
|
|
640
|
+
_value: value,
|
|
641
|
+
selectedRowKeys: [],
|
|
642
|
+
selectedRows: []
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
if (!labelInValue && (_value === null || _value === void 0 ? void 0 : _value[valueKey]) && !isEqual(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
|
|
646
|
+
setState({
|
|
647
|
+
_value: value,
|
|
648
|
+
selectedRowKeys: [],
|
|
649
|
+
selectedRows: []
|
|
650
|
+
});
|
|
651
|
+
}
|
|
617
652
|
}
|
|
618
653
|
}, [value, _value]);
|
|
619
|
-
var defaultAddonAfter = _jsxs("div", {
|
|
620
|
-
className: "pro-enum-input-addonAfter",
|
|
621
|
-
children: [value && !disabled && _jsx("span", {
|
|
622
|
-
className: "close-icon",
|
|
623
|
-
children: _jsx(CloseOutlined, {
|
|
624
|
-
onClick: handleClearValue
|
|
625
|
-
})
|
|
626
|
-
}), _jsx(ReactSVG, {
|
|
627
|
-
className: "viewSvg",
|
|
628
|
-
src: viewSvg,
|
|
629
|
-
onClick: handleClick
|
|
630
|
-
})]
|
|
631
|
-
});
|
|
632
|
-
var forceAddonAfterRender = function forceAddonAfterRender() {
|
|
633
|
-
if (isView || disabled) {
|
|
634
|
-
return;
|
|
635
|
-
}
|
|
636
|
-
if (addonAfter) {
|
|
637
|
-
return _jsx("div", {
|
|
638
|
-
onClick: handleClick,
|
|
639
|
-
children: addonAfter
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
return defaultAddonAfter;
|
|
643
|
-
};
|
|
644
654
|
// 加个中间状态Input
|
|
645
|
-
var initRender = _jsxs(
|
|
646
|
-
|
|
655
|
+
var initRender = _jsxs(_Space.Compact, {
|
|
656
|
+
style: {
|
|
657
|
+
width: '100%'
|
|
658
|
+
},
|
|
659
|
+
block: true,
|
|
660
|
+
children: [readOnly ? _jsx(ProSelect, _objectSpread({
|
|
661
|
+
value: value,
|
|
662
|
+
onChange: handleSelectValue,
|
|
663
|
+
disabled: disabled,
|
|
664
|
+
fieldNames: fieldNames,
|
|
665
|
+
showCodeName: showCodeName,
|
|
666
|
+
labelInValue: labelInValue,
|
|
667
|
+
dataSource: options,
|
|
668
|
+
scrollFollowParent: false,
|
|
669
|
+
onClick: function onClick() {
|
|
670
|
+
// 没有值的时候,初始化点击默认查询前五十条
|
|
671
|
+
if (!value && isInit || !(options === null || options === void 0 ? void 0 : options.length)) {
|
|
672
|
+
var _useRequest$options9;
|
|
673
|
+
var queryBean = useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options9 = useRequest.options) === null || _useRequest$options9 === void 0 ? void 0 : _useRequest$options9.defaultParams;
|
|
674
|
+
var params = withPagination ? {
|
|
675
|
+
pageNum: 1,
|
|
676
|
+
pageSize: 50,
|
|
677
|
+
queryBean: queryBean
|
|
678
|
+
} : queryBean;
|
|
679
|
+
run(params);
|
|
680
|
+
setState({
|
|
681
|
+
isInit: false
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
onSearch: debounce(function (val) {
|
|
686
|
+
var _useRequest$options10;
|
|
687
|
+
var queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options10 = useRequest.options) === null || _useRequest$options10 === void 0 ? void 0 : _useRequest$options10.defaultParams), {}, _defineProperty({}, labelKey, val));
|
|
688
|
+
var params = withPagination ? {
|
|
689
|
+
pageNum: 1,
|
|
690
|
+
pageSize: 50,
|
|
691
|
+
queryBean: queryBean
|
|
692
|
+
} : queryBean;
|
|
693
|
+
run(params);
|
|
694
|
+
}, 800),
|
|
695
|
+
style: {
|
|
696
|
+
width: isView || disabled ? '100%' : 'calc(100% - 30px)'
|
|
697
|
+
}
|
|
698
|
+
}, omit(restProps, ['otherProps']))) : _jsx(_Input, _objectSpread({
|
|
647
699
|
value: viewText,
|
|
648
|
-
readOnly: readOnly,
|
|
649
|
-
onClick: readOnly ? handleClick : undefined,
|
|
650
700
|
onChange: handleChangeValue,
|
|
651
701
|
disabled: disabled,
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
}, omit(
|
|
655
|
-
|
|
656
|
-
|
|
702
|
+
autoComplete: "off",
|
|
703
|
+
allowClear: true
|
|
704
|
+
}, omit(restProps, ['otherProps']))), isView || disabled ? null : _jsx(_Button, {
|
|
705
|
+
icon: _jsx(ReactSVG, {
|
|
706
|
+
className: "viewSvg",
|
|
707
|
+
src: viewSvg,
|
|
708
|
+
onClick: handleClick
|
|
709
|
+
})
|
|
657
710
|
})]
|
|
658
711
|
});
|
|
659
712
|
if (customRender && /*#__PURE__*/React.isValidElement(customRender)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormInstance, InputProps, ModalProps } from 'antd';
|
|
1
|
+
import { FormInstance, InputProps, SelectProps, ModalProps } from 'antd';
|
|
2
2
|
import { Service, Options } from 'ahooks/lib/useRequest/src/types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ProColumnProps } from '../../render/propsType';
|
|
@@ -43,5 +43,5 @@ interface ProModalPropsType {
|
|
|
43
43
|
showCodeName?: boolean;
|
|
44
44
|
searchForm?: FormInstance;
|
|
45
45
|
}
|
|
46
|
-
export declare type ProModalSelectPropsType = InputProps & ProModalPropsType;
|
|
46
|
+
export declare type ProModalSelectPropsType = SelectProps & InputProps & ProModalPropsType;
|
|
47
47
|
export {};
|
|
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import "antd/es/modal/style";
|
|
3
3
|
import _Modal from "antd/es/modal";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["onChange", "children", "confirm"];
|
|
5
|
+
var _excluded = ["onChange", "children", "confirm", "otherProps"];
|
|
6
6
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { isFunction, isObject } from 'lodash';
|
|
8
8
|
import React from 'react';
|
|
@@ -15,6 +15,7 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
15
15
|
var onChange = props.onChange,
|
|
16
16
|
children = props.children,
|
|
17
17
|
confirm = props.confirm,
|
|
18
|
+
otherProps = props.otherProps,
|
|
18
19
|
rest = _objectWithoutProperties(props, _excluded);
|
|
19
20
|
var _ProForm$useFieldProp = ProForm.useFieldProps(),
|
|
20
21
|
form = _ProForm$useFieldProp.form;
|
|
@@ -23,7 +24,12 @@ var ConfirmWrapper = function ConfirmWrapper(props) {
|
|
|
23
24
|
other[_key - 1] = arguments[_key];
|
|
24
25
|
}
|
|
25
26
|
var _value = (value === null || value === void 0 ? void 0 : value.target) ? value.target.value : value;
|
|
26
|
-
var confirmProps = isFunction(confirm) ? confirm(form.getFieldsValue()
|
|
27
|
+
var confirmProps = isFunction(confirm) ? confirm(value, form.getFieldsValue(), {
|
|
28
|
+
option: other[0],
|
|
29
|
+
form: form,
|
|
30
|
+
namePath: otherProps.namePath,
|
|
31
|
+
index: otherProps.index
|
|
32
|
+
}) : confirm;
|
|
27
33
|
if (confirmProps === true) {
|
|
28
34
|
_Modal.confirm(_objectSpread(_objectSpread({}, defaultConfirmProps), {}, {
|
|
29
35
|
onOk: function onOk() {
|
|
@@ -154,9 +154,11 @@ 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 || (rules === null || rules === void 0 ? void 0 : rules.some(function (item) {
|
|
159
|
+
return item === null || item === void 0 ? void 0 : item.required;
|
|
160
|
+
}))
|
|
161
|
+
}, otherProps.isView && !requiredOnView ? {
|
|
160
162
|
required: false
|
|
161
163
|
} : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
|
|
162
164
|
_objectSpread({}, isUpperCase(type, upperCase)), {
|
|
@@ -222,12 +224,8 @@ var Render = function Render(props) {
|
|
|
222
224
|
if (valueType) {
|
|
223
225
|
_args[2].transformValue = form.getFieldValue(_otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : _otherFormItemProps.name) || undefined;
|
|
224
226
|
}
|
|
227
|
+
_args[2].option = args[1];
|
|
225
228
|
switch (type) {
|
|
226
|
-
case 'ProSelect':
|
|
227
|
-
case 'ProModalSelect':
|
|
228
|
-
case 'ProEnum':
|
|
229
|
-
_args[2].option = args[1];
|
|
230
|
-
break;
|
|
231
229
|
case 'ProAddressBar':
|
|
232
230
|
_args[2].selectedOptions = args[1];
|
|
233
231
|
break;
|
|
@@ -244,7 +242,7 @@ var Render = function Render(props) {
|
|
|
244
242
|
* onChange参数重置 (value, record, { form, index, namePath, option }) => void
|
|
245
243
|
*/
|
|
246
244
|
var handleChange = function handleChange() {
|
|
247
|
-
var _lastComponentProps$c2;
|
|
245
|
+
var _otherFormItemProps$n3, _lastComponentProps$c2;
|
|
248
246
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
249
247
|
args[_key] = arguments[_key];
|
|
250
248
|
}
|
|
@@ -262,6 +260,11 @@ var Render = function Render(props) {
|
|
|
262
260
|
((_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
261
|
return false;
|
|
264
262
|
}
|
|
263
|
+
var inList = _otherFormItemProps === null || _otherFormItemProps === void 0 ? void 0 : (_otherFormItemProps$n3 = _otherFormItemProps.namePath) === null || _otherFormItemProps$n3 === void 0 ? void 0 : _otherFormItemProps$n3.length;
|
|
264
|
+
// FormList 和 Group场景 对比值改变的话, 回显到表单上
|
|
265
|
+
if (inList) {
|
|
266
|
+
form.setFieldsValue(_args[1]);
|
|
267
|
+
}
|
|
265
268
|
// Group默认校验, 延时与重新setFieldValue,为了解决校验值未同步最新的问题,
|
|
266
269
|
if (formItemProps === null || formItemProps === void 0 ? void 0 : formItemProps.parentNames) {
|
|
267
270
|
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
|
}
|
|
@@ -52,12 +52,12 @@ interface ControlProps {
|
|
|
52
52
|
/**
|
|
53
53
|
* 扩展函数的参数
|
|
54
54
|
*/
|
|
55
|
-
type FunctionArgs<Values> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
|
|
55
|
+
type FunctionArgs<Values, R = any> = (value: any, record: any, { form, index, namePath, option, selectedOptions, dateString, }: {
|
|
56
56
|
form: FormInstance<Values>;
|
|
57
57
|
index?: number;
|
|
58
58
|
namePath?: NamePath;
|
|
59
59
|
[key: string]: any;
|
|
60
|
-
}) =>
|
|
60
|
+
}) => R;
|
|
61
61
|
type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value'> & {
|
|
62
62
|
value?: T['value'];
|
|
63
63
|
onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
|
|
@@ -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;
|
|
@@ -220,7 +220,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
220
220
|
extra?: string | React.ReactNode;
|
|
221
221
|
/** 是否固定字段, 不隐藏 */
|
|
222
222
|
fixed?: boolean;
|
|
223
|
-
confirm?: boolean | ModalFuncProps |
|
|
223
|
+
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
|
|
224
224
|
}
|
|
225
225
|
export type ProColumnProps<T = any> = ProFormColumnProps<T> & ColumnPropsMap<T, 'ProForm'>;
|
|
226
226
|
/**
|
package/es/ProForm/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import { useForm } from './utils/useForm';
|
|
|
26
26
|
import { useFieldProps } from './utils/useFieldProps';
|
|
27
27
|
import locale from '../locale';
|
|
28
28
|
var ProForm = function ProForm(props, ref) {
|
|
29
|
-
var _forms$formKey, _localStorage;
|
|
29
|
+
var _forms$formKey, _localStorage, _ref;
|
|
30
30
|
var _props$mode = props.mode,
|
|
31
31
|
mode = _props$mode === void 0 ? 'search' : _props$mode,
|
|
32
32
|
span = props.span,
|
|
@@ -49,8 +49,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
49
49
|
expandOpenChange = props.expandOpenChange,
|
|
50
50
|
_props$viewEmpty = props.viewEmpty,
|
|
51
51
|
viewEmpty = _props$viewEmpty === void 0 ? '-' : _props$viewEmpty,
|
|
52
|
-
|
|
53
|
-
labelAlign = _props$labelAlign === void 0 ? 'left' : _props$labelAlign,
|
|
52
|
+
labelAlign = props.labelAlign,
|
|
54
53
|
labelWidth = props.labelWidth,
|
|
55
54
|
onValuesChange = props.onValuesChange,
|
|
56
55
|
onFinish = props.onFinish,
|
|
@@ -231,9 +230,9 @@ var ProForm = function ProForm(props, ref) {
|
|
|
231
230
|
}
|
|
232
231
|
},
|
|
233
232
|
className: cls,
|
|
234
|
-
form: form
|
|
235
|
-
labelAlign: labelAlign
|
|
233
|
+
form: form
|
|
236
234
|
}, formProps), config), otherProps), {}, {
|
|
235
|
+
labelAlign: (_ref = labelAlign !== null && labelAlign !== void 0 ? labelAlign : config.labelAlign) !== null && _ref !== void 0 ? _ref : 'left',
|
|
237
236
|
onValuesChange: handleValuesChange,
|
|
238
237
|
onFinish: handleFinish,
|
|
239
238
|
initialValues: _initialValues,
|
|
@@ -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 值
|