@para-ui/core 3.0.28 → 3.0.30
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/AutoBox/index.js +48 -88
- package/AutoTips/index.js +25 -32
- package/Breadcrumbs/index.js +43 -63
- package/Button/SplitButton.d.ts +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/index.js +88 -118
- package/ButtonGroup/index.js +27 -36
- package/Carousel/index.d.ts +2 -2
- package/Carousel/index.js +27 -28
- package/Cascader/index.js +52 -64
- package/Checkbox/index.js +23 -39
- package/CheckboxGroup/index.js +31 -48
- package/Collapse/collapsePanel.d.ts +1 -1
- package/Collapse/index.d.ts +1 -1
- package/Collapse/index.js +9 -29
- package/Collapse/util.d.ts +2 -2
- package/CollapseBox/index.js +45 -56
- package/CollapseLayout/index.js +35 -54
- package/ComboSelect/index.js +222 -349
- package/ComboSelect/interface.d.ts +3 -3
- package/Container/index.js +17 -20
- package/DatePicker/generatePicker/index.d.ts +17 -17
- package/DatePicker/index.d.ts +4 -4
- package/DatePicker/index.js +111 -167
- package/Desktop/index.js +62 -173
- package/Drawer/index.js +65 -58
- package/Drawer/interface.d.ts +7 -3
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/index.js +3 -3
- package/Empty/index.js +17 -22
- package/Form/index.d.ts +1 -1
- package/Form/index.js +38 -80
- package/FormItem/index.d.ts +1 -1
- package/FormItem/index.js +11 -11
- package/FormItem/validateFunction.d.ts +1 -1
- package/FunctionModal/index.js +11 -11
- package/GlobalContext/index.js +3 -3
- package/GlobalContext/usePopupContainer.d.ts +1 -1
- package/Help/index.js +11 -11
- package/HelperText/index.js +11 -12
- package/InputLang/index.js +47 -80
- package/InputNumber/index.js +65 -100
- package/Label/index.js +15 -16
- package/Loading/index.js +6 -7
- package/Menu/index.js +148 -328
- package/Menu/interface.d.ts +2 -2
- package/Menu/verticalMenuList.d.ts +1 -1
- package/Message/index.d.ts +1 -1
- package/Message/index.js +45 -64
- package/Modal/Confirm/index.d.ts +2 -2
- package/Modal/index.d.ts +1 -1
- package/Modal/index.js +119 -152
- package/MultiBox/index.js +44 -76
- package/Notification/index.d.ts +2 -2
- package/Notification/index.js +51 -72
- package/OperateBtn/index.js +42 -70
- package/PageHeader/index.js +120 -286
- package/PageHeader/interface.d.ts +1 -1
- package/Pagination/index.d.ts +2 -2
- package/Pagination/index.js +79 -131
- package/ParauiProvider/index.js +2 -3
- package/PasswordRules/index.js +12 -30
- package/PopConfirm/index.d.ts +1 -1
- package/PopConfirm/index.js +52 -59
- package/Popover/index.js +8 -9
- package/Progress/index.d.ts +6 -6
- package/Progress/index.js +50 -89
- package/Querying/index.js +14 -17
- package/README.md +813 -800
- package/Radio/index.js +21 -33
- package/RadioGroup/index.js +32 -47
- package/Search/index.js +44 -66
- package/Select/index.js +176 -343
- package/SelectInput/index.js +8 -9
- package/Selector/index.js +285 -681
- package/SelectorPicker/index.js +62 -97
- package/SingleBox/index.js +30 -55
- package/Slider/index.d.ts +1 -1
- package/Slider/index.js +29 -41
- package/Slider/interface.d.ts +2 -2
- package/Split/index.js +10 -23
- package/Status/index.js +8 -7
- package/Stepper/index.d.ts +1 -1
- package/Stepper/index.js +20 -25
- package/Styles/form.scss +5 -5
- package/Styles/index.scss +37 -37
- package/Styles/normalize.scss +348 -348
- package/Styles/scrollbar.scss +223 -223
- package/Styles/theme.scss +74 -74
- package/Switch/index.d.ts +2 -2
- package/Switch/index.js +19 -20
- package/Table/index.js +568 -1019
- package/Table/interface.d.ts +5 -5
- package/Tabs/index.d.ts +3 -3
- package/Tabs/index.js +47 -65
- package/Tag/TagGroup.d.ts +1 -1
- package/Tag/index.d.ts +2 -2
- package/Tag/index.js +72 -107
- package/TextEditor/index.d.ts +2 -2
- package/TextEditor/index.js +81 -105
- package/TextField/index.js +141 -220
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/index.js +12 -15
- package/Timeline/index.js +42 -52
- package/Title/index.js +10 -9
- package/ToggleButton/ToggleButtonGroup.d.ts +1 -1
- package/ToggleButton/index.js +50 -70
- package/Tooltip/index.js +64 -98
- package/Tooltip/interface.d.ts +1 -1
- package/Transfer/index.d.ts +1 -1
- package/Transfer/index.js +114 -137
- package/Transfer/useClick.d.ts +1 -1
- package/Tree/index.js +10 -10
- package/Tree/interface.d.ts +6 -6
- package/Upload/Dragger/index.d.ts +1 -1
- package/Upload/ImageUpload/index.d.ts +1 -1
- package/Upload/ImgCrop/EasyCrop.d.ts +1 -1
- package/Upload/index.d.ts +1 -1
- package/Upload/index.js +283 -475
- package/Upload/interface.d.ts +2 -2
- package/_verture/{constant-bf34e6fa.js → constant-66aa48a1.js} +0 -1
- package/_verture/defineProperty-62acccfc.js +34 -0
- package/_verture/{index-342379c6.js → index-06fea29b.js} +79 -124
- package/_verture/{index-48875ffd.js → index-131f8fe5.js} +80 -181
- package/_verture/{index-31ce5a11.js → index-92144ad3.js} +238 -445
- package/_verture/{index-bbed73a3.js → index-be4faaee.js} +19 -61
- package/_verture/{intl-336570e4.js → intl-5cbb940c.js} +4 -12
- package/_verture/{modalContext-d646d9db.js → modalContext-c749e1c6.js} +18 -43
- package/_verture/{slicedToArray-d7722f4b.js → slicedToArray-77980792.js} +23 -25
- package/_verture/{toConsumableArray-f8047a75.js → toConsumableArray-87c7d895.js} +1 -1
- package/_verture/{useFormatMessage-f4452258.js → useFormatMessage-703f8b20.js} +1 -3
- package/_verture/{useGlobalProps-af9a2af6.js → useGlobalProps-1b846a65.js} +1 -2
- package/_verture/{usePopupContainer-b8ab7cab.js → usePopupContainer-87febeb9.js} +10 -25
- package/_verture/{util-a77b261e.js → util-7e1fb1e2.js} +2 -3
- package/index.d.ts +2 -4
- package/index.js +15 -16
- package/package.json +167 -168
- package/Test/index.d.ts +0 -3
- package/Test/index.js +0 -9
- package/_verture/defineProperty-0590dc61.js +0 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { _ as _slicedToArray } from './slicedToArray-
|
|
3
|
+
import { _ as _slicedToArray } from './slicedToArray-77980792.js';
|
|
4
4
|
import { TextField } from '../TextField/index.js';
|
|
5
5
|
import { RadioGroup } from '../RadioGroup/index.js';
|
|
6
6
|
import Select from '../Select/index.js';
|
|
@@ -17,29 +17,25 @@ import { ComboSelect } from '../ComboSelect/index.js';
|
|
|
17
17
|
import HelperText from '../HelperText/index.js';
|
|
18
18
|
import clsx from 'clsx';
|
|
19
19
|
import Label from '../Label/index.js';
|
|
20
|
-
import { $ as $prefixCls } from './constant-
|
|
20
|
+
import { $ as $prefixCls } from './constant-66aa48a1.js';
|
|
21
21
|
|
|
22
22
|
var FormRadioGroup = function FormRadioGroup(props) {
|
|
23
23
|
var defaultValue = props.defaultValue,
|
|
24
|
-
|
|
24
|
+
change = props.change;
|
|
25
25
|
/**
|
|
26
26
|
* 选中的值
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
28
|
var _React$useState = React__default.useState(defaultValue || ''),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
+
selectValue = _React$useState2[0],
|
|
31
|
+
setSelectValue = _React$useState2[1];
|
|
33
32
|
/**
|
|
34
33
|
* 选中值改变
|
|
35
34
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
35
|
var changeValue = function changeValue(value) {
|
|
39
36
|
setSelectValue(value);
|
|
40
37
|
change && change(value);
|
|
41
38
|
};
|
|
42
|
-
|
|
43
39
|
return jsx(RadioGroup, Object.assign({
|
|
44
40
|
value: selectValue,
|
|
45
41
|
onChange: changeValue,
|
|
@@ -49,27 +45,23 @@ var FormRadioGroup = function FormRadioGroup(props) {
|
|
|
49
45
|
|
|
50
46
|
var FormSelect = function FormSelect(props) {
|
|
51
47
|
var _props$defaultValue = props.defaultValue,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
defaultValue = _props$defaultValue === void 0 ? '' : _props$defaultValue,
|
|
49
|
+
change = props.change,
|
|
50
|
+
value = props.value;
|
|
55
51
|
/**
|
|
56
52
|
* 选中的值
|
|
57
53
|
*/
|
|
58
|
-
|
|
59
54
|
var _React$useState = React__default.useState(value !== undefined ? value : defaultValue),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
56
|
+
selectValue = _React$useState2[0],
|
|
57
|
+
setSelectValue = _React$useState2[1];
|
|
63
58
|
/**
|
|
64
59
|
* 选中值改变
|
|
65
60
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
61
|
var changeValue = function changeValue(value) {
|
|
69
62
|
setSelectValue(value);
|
|
70
63
|
change && change(value);
|
|
71
64
|
};
|
|
72
|
-
|
|
73
65
|
React__default.useEffect(function () {
|
|
74
66
|
setSelectValue(value);
|
|
75
67
|
}, [value]);
|
|
@@ -84,25 +76,21 @@ var FormSelect = function FormSelect(props) {
|
|
|
84
76
|
|
|
85
77
|
var FormCheckboxGroup = function FormCheckboxGroup(props) {
|
|
86
78
|
var defaultValue = props.defaultValue,
|
|
87
|
-
|
|
79
|
+
change = props.change;
|
|
88
80
|
/**
|
|
89
81
|
* 选中的值
|
|
90
82
|
*/
|
|
91
|
-
|
|
92
83
|
var _React$useState = React__default.useState(defaultValue || []),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
85
|
+
selectValue = _React$useState2[0],
|
|
86
|
+
setSelectValue = _React$useState2[1];
|
|
96
87
|
/**
|
|
97
88
|
* 选中值改变
|
|
98
89
|
*/
|
|
99
|
-
|
|
100
|
-
|
|
101
90
|
var changeValue = function changeValue(value) {
|
|
102
91
|
setSelectValue(value);
|
|
103
92
|
change && change(value);
|
|
104
93
|
};
|
|
105
|
-
|
|
106
94
|
return jsx(CheckboxGroup, Object.assign({
|
|
107
95
|
value: selectValue,
|
|
108
96
|
onChange: changeValue,
|
|
@@ -117,116 +105,87 @@ var FormCheckboxGroup = function FormCheckboxGroup(props) {
|
|
|
117
105
|
var fixedValidateFunction = {
|
|
118
106
|
'required': function required(item, val) {
|
|
119
107
|
var _a, _b, _c, _d;
|
|
120
|
-
|
|
121
108
|
var vtype = _typeof(val);
|
|
122
|
-
|
|
123
109
|
var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.required) || "".concat(item.label, "\u4E0D\u80FD\u4E3A\u7A7A");
|
|
124
110
|
var jude = false;
|
|
125
|
-
|
|
126
111
|
switch (vtype) {
|
|
127
112
|
case 'string':
|
|
128
113
|
var disOnlySpace = item.disOnlySpace !== undefined ? item.disOnlySpace : (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.disOnlySpace;
|
|
129
|
-
|
|
130
114
|
if (!disOnlySpace) {
|
|
131
115
|
jude = !!val;
|
|
132
116
|
} else {
|
|
133
117
|
var space = /^[\s]+$/;
|
|
134
118
|
jude = !!val && !space.test(val);
|
|
135
119
|
}
|
|
136
|
-
|
|
137
120
|
break;
|
|
138
|
-
|
|
139
121
|
case 'number':
|
|
140
122
|
jude = val + 1 > val;
|
|
141
123
|
break;
|
|
142
|
-
|
|
143
124
|
case 'object':
|
|
144
125
|
var str = JSON.stringify(val);
|
|
145
126
|
jude = str !== 'null' && str !== '[]' && str !== '{}';
|
|
146
127
|
break;
|
|
147
|
-
|
|
148
128
|
case 'boolean':
|
|
149
129
|
jude = val !== undefined;
|
|
150
130
|
break;
|
|
151
|
-
|
|
152
131
|
default:
|
|
153
132
|
jude = !!val;
|
|
154
133
|
break;
|
|
155
134
|
}
|
|
156
|
-
|
|
157
135
|
return jude || error;
|
|
158
136
|
},
|
|
159
137
|
'maxlength': function maxlength(item, val) {
|
|
160
138
|
var _a, _b, _c, _d, _e, _f;
|
|
161
|
-
|
|
162
139
|
var vtype = _typeof(val);
|
|
163
|
-
|
|
164
140
|
var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.maxlength) || "\u6700\u5927\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7".concat((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.maxlength);
|
|
165
141
|
var jude = false;
|
|
166
|
-
|
|
167
142
|
if (vtype === 'string' || vtype === 'number' && val + 1 > val) {
|
|
168
143
|
jude = !("".concat(val).length > (((_f = (_e = item.rules) === null || _e === void 0 ? void 0 : _e.validate) === null || _f === void 0 ? void 0 : _f.maxlength) || NaN));
|
|
169
144
|
} else {
|
|
170
145
|
jude = !val;
|
|
171
146
|
}
|
|
172
|
-
|
|
173
147
|
return jude || error;
|
|
174
148
|
},
|
|
175
149
|
'minLength': function minLength(item, val) {
|
|
176
150
|
var _a, _b, _c, _d, _e, _f;
|
|
177
|
-
|
|
178
151
|
var vtype = _typeof(val);
|
|
179
|
-
|
|
180
152
|
var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.minLength) || "\u6700\u5C0F\u957F\u5EA6\u4E3A".concat((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.minLength);
|
|
181
153
|
var jude = false;
|
|
182
|
-
|
|
183
154
|
if (vtype === 'string' || vtype === 'number' && val + 1 > val) {
|
|
184
155
|
jude = "".concat(val).length >= (((_f = (_e = item.rules) === null || _e === void 0 ? void 0 : _e.validate) === null || _f === void 0 ? void 0 : _f.minLength) || -1);
|
|
185
156
|
} else {
|
|
186
157
|
jude = !val;
|
|
187
158
|
}
|
|
188
|
-
|
|
189
159
|
return jude || error;
|
|
190
160
|
},
|
|
191
161
|
'pattern': function pattern(item, val) {
|
|
192
162
|
var _a, _b, _c, _d;
|
|
193
|
-
|
|
194
163
|
var testReg = (_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
195
164
|
var error = ((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.pattern) || "\u53C2\u6570\u4E0D\u7B26\u5408\u6821\u9A8C\u89C4\u5219: ".concat(testReg);
|
|
196
165
|
var jude = !val;
|
|
197
|
-
|
|
198
166
|
if (testReg && val && typeof testReg !== 'function') {
|
|
199
167
|
jude = testReg.test(val);
|
|
200
168
|
}
|
|
201
|
-
|
|
202
169
|
return jude || error;
|
|
203
170
|
},
|
|
204
171
|
'min': function min(item, val) {
|
|
205
172
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
206
|
-
|
|
207
173
|
var vtype = _typeof(val);
|
|
208
|
-
|
|
209
174
|
var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.min) || "\u6700\u5C0F\u503C\u4E3A".concat((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.min);
|
|
210
175
|
var jude = !val;
|
|
211
|
-
|
|
212
176
|
if (vtype === 'string' || vtype === 'number') {
|
|
213
177
|
jude = val >= (((_f = (_e = item.rules) === null || _e === void 0 ? void 0 : _e.validate) === null || _f === void 0 ? void 0 : _f.min) === undefined ? -Infinity : (_h = (_g = item.rules) === null || _g === void 0 ? void 0 : _g.validate) === null || _h === void 0 ? void 0 : _h.min);
|
|
214
178
|
}
|
|
215
|
-
|
|
216
179
|
return jude || error;
|
|
217
180
|
},
|
|
218
181
|
'max': function max(item, val) {
|
|
219
182
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
220
|
-
|
|
221
183
|
var vtype = _typeof(val);
|
|
222
|
-
|
|
223
184
|
var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.max) || "\u6700\u5927\u503C\u4E3A".concat((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.max);
|
|
224
185
|
var jude = !val;
|
|
225
|
-
|
|
226
186
|
if (vtype === 'string' || vtype === 'number') {
|
|
227
187
|
jude = val <= (((_f = (_e = item.rules) === null || _e === void 0 ? void 0 : _e.validate) === null || _f === void 0 ? void 0 : _f.max) === undefined ? Infinity : (_h = (_g = item.rules) === null || _g === void 0 ? void 0 : _g.validate) === null || _h === void 0 ? void 0 : _h.max);
|
|
228
188
|
}
|
|
229
|
-
|
|
230
189
|
return jude || error;
|
|
231
190
|
}
|
|
232
191
|
};
|
|
@@ -234,20 +193,15 @@ var fixedValidateFunction = {
|
|
|
234
193
|
* 表单rules校验方法
|
|
235
194
|
* @type {validateFunctionType}
|
|
236
195
|
*/
|
|
237
|
-
|
|
238
196
|
var validate = function validate(item, val) {
|
|
239
197
|
var _a, _b;
|
|
240
|
-
|
|
241
198
|
var validateObj = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate;
|
|
242
|
-
|
|
243
199
|
if (validateObj) {
|
|
244
200
|
var messageObj = (_b = item.rules) === null || _b === void 0 ? void 0 : _b.message;
|
|
245
201
|
console.log('validateObj');
|
|
246
|
-
|
|
247
202
|
for (var key in validateObj) {
|
|
248
203
|
var tempFuc = validateObj[key];
|
|
249
204
|
var tmsg = '';
|
|
250
|
-
|
|
251
205
|
if (typeof tempFuc === 'function') {
|
|
252
206
|
tmsg = tempFuc(item, val);
|
|
253
207
|
if (tmsg === false && messageObj) tmsg = messageObj[key];
|
|
@@ -259,11 +213,9 @@ var validate = function validate(item, val) {
|
|
|
259
213
|
console.log("\u9879\u76EE: ".concat(item.label, ", \u81EA\u5B9A\u4E49\u6821\u9A8C\u89C4\u5219: ").concat(key, ", \u65B9\u6CD5\u672A\u5B9A\u4E49"));
|
|
260
214
|
tmsg = true;
|
|
261
215
|
}
|
|
262
|
-
|
|
263
216
|
if (tmsg !== true) return tmsg || '';
|
|
264
217
|
}
|
|
265
218
|
}
|
|
266
|
-
|
|
267
219
|
return false;
|
|
268
220
|
};
|
|
269
221
|
|
|
@@ -273,37 +225,31 @@ styleInject(css_248z$1);
|
|
|
273
225
|
/**
|
|
274
226
|
* 文件组件
|
|
275
227
|
*/
|
|
276
|
-
|
|
277
228
|
var FormFile = function FormFile(props) {
|
|
278
229
|
var _props$fileType = props.fileType,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
230
|
+
fileType = _props$fileType === void 0 ? '' : _props$fileType,
|
|
231
|
+
defaultValue = props.defaultValue,
|
|
232
|
+
onChange = props.onChange,
|
|
233
|
+
disabled = props.disabled,
|
|
234
|
+
buttonLabel = props.buttonLabel,
|
|
235
|
+
inputProps = props.inputProps,
|
|
236
|
+
buttonProps = props.buttonProps;
|
|
286
237
|
/**
|
|
287
238
|
* 存储文件输入框真实dom
|
|
288
239
|
* @type {HTMLInputElement}
|
|
289
240
|
*/
|
|
290
|
-
|
|
291
241
|
var inputFileEl = React__default.useRef(null);
|
|
292
242
|
/**
|
|
293
243
|
* 模拟点击选择文件
|
|
294
244
|
*/
|
|
295
|
-
|
|
296
245
|
var inputFileClick = function inputFileClick() {
|
|
297
246
|
var _a;
|
|
298
|
-
|
|
299
247
|
console.log('inputFileClick', inputFileEl.current);
|
|
300
248
|
(_a = inputFileEl.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
301
249
|
};
|
|
302
250
|
/**
|
|
303
251
|
* 文件改变
|
|
304
252
|
*/
|
|
305
|
-
|
|
306
|
-
|
|
307
253
|
var fileChange = function fileChange(value) {
|
|
308
254
|
var val = value !== undefined ? value : inputFileEl.current.files;
|
|
309
255
|
setSelectedFile(val);
|
|
@@ -314,17 +260,13 @@ var FormFile = function FormFile(props) {
|
|
|
314
260
|
* @type {string}
|
|
315
261
|
* 已选择的文件
|
|
316
262
|
*/
|
|
317
|
-
|
|
318
|
-
|
|
319
263
|
var _React$useState = React__default.useState(),
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
264
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
265
|
+
selectedFile = _React$useState2[0],
|
|
266
|
+
setSelectedFile = _React$useState2[1];
|
|
323
267
|
/**
|
|
324
268
|
* 初始化操作
|
|
325
269
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
270
|
React__default.useEffect(function () {
|
|
329
271
|
if (defaultValue) {
|
|
330
272
|
if (typeof defaultValue === 'string') {
|
|
@@ -378,22 +320,19 @@ var FormFile = function FormFile(props) {
|
|
|
378
320
|
* @author zhanzl
|
|
379
321
|
* @date 2022/06/02
|
|
380
322
|
*/
|
|
381
|
-
|
|
382
323
|
var DefaultCompoments = function DefaultCompoments(props) {
|
|
383
324
|
var error = props.error,
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
325
|
+
placeholder = props.placeholder,
|
|
326
|
+
defaultValue = props.defaultValue,
|
|
327
|
+
disabled = props.disabled,
|
|
328
|
+
_onChange = props.onChange,
|
|
329
|
+
inputProps = props.inputProps,
|
|
330
|
+
moudle = props.moudle;
|
|
391
331
|
var _React$useState = React__default.useState(defaultValue),
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
332
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
333
|
+
dValue = _React$useState2[0],
|
|
334
|
+
setDvalue = _React$useState2[1];
|
|
335
|
+
// 监听defaultValue改变
|
|
397
336
|
React__default.useEffect(function () {
|
|
398
337
|
setDvalue(defaultValue);
|
|
399
338
|
}, [defaultValue]);
|
|
@@ -406,10 +345,8 @@ var DefaultCompoments = function DefaultCompoments(props) {
|
|
|
406
345
|
}, inputProps), {
|
|
407
346
|
onChange: function onChange(e) {
|
|
408
347
|
var _a;
|
|
409
|
-
|
|
410
348
|
var tVal = ((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value) || e;
|
|
411
349
|
setDvalue(tVal);
|
|
412
|
-
|
|
413
350
|
_onChange(tVal);
|
|
414
351
|
}
|
|
415
352
|
}));
|
|
@@ -418,39 +355,35 @@ var DefaultCompoments = function DefaultCompoments(props) {
|
|
|
418
355
|
/**
|
|
419
356
|
* form 表单操作项 类型
|
|
420
357
|
*/
|
|
421
|
-
|
|
422
358
|
var ItemType = function ItemType(props) {
|
|
423
359
|
var itemType = props.itemType,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
360
|
+
error = props.error,
|
|
361
|
+
placeholder = props.placeholder,
|
|
362
|
+
label = props.label,
|
|
363
|
+
inputProps = props.inputProps,
|
|
364
|
+
name = props.name,
|
|
365
|
+
rules = props.rules,
|
|
366
|
+
setValue = props.setValue,
|
|
367
|
+
setError = props.setError,
|
|
368
|
+
backData = props.backData,
|
|
369
|
+
disabled = props.disabled,
|
|
370
|
+
change = props.change;
|
|
435
371
|
var tipsStr = placeholder || "".concat(label);
|
|
436
372
|
/**
|
|
437
373
|
* 报错信息
|
|
438
374
|
* @type {boolean}
|
|
439
375
|
*/
|
|
440
|
-
|
|
441
376
|
var _React$useState = React__default.useState(!!error),
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
377
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
378
|
+
errorStatus = _React$useState2[0],
|
|
379
|
+
setErrorStatus = _React$useState2[1];
|
|
445
380
|
/**
|
|
446
381
|
* 校验方法
|
|
447
382
|
*/
|
|
448
|
-
|
|
449
|
-
|
|
450
383
|
var validateFunction = function validateFunction(val) {
|
|
451
384
|
setValue && setValue(name, 'value', val);
|
|
452
|
-
change && change(val);
|
|
453
|
-
|
|
385
|
+
change && change(val);
|
|
386
|
+
// 没有校验规则直接退出
|
|
454
387
|
if (!rules) return;
|
|
455
388
|
var item = Object.assign(Object.assign({}, props), {
|
|
456
389
|
setErrorMsg: setErrorMsg,
|
|
@@ -462,13 +395,10 @@ var ItemType = function ItemType(props) {
|
|
|
462
395
|
/**
|
|
463
396
|
* 存储和校验数据
|
|
464
397
|
*/
|
|
465
|
-
|
|
466
|
-
|
|
467
398
|
var setAndValidateValue = validateFunction;
|
|
468
399
|
/**
|
|
469
400
|
* 合并设置Error状态方法
|
|
470
401
|
*/
|
|
471
|
-
|
|
472
402
|
var setErrorMsg = React__default.useCallback(function (msg) {
|
|
473
403
|
setError && setError(msg);
|
|
474
404
|
setErrorStatus(!!msg);
|
|
@@ -477,7 +407,6 @@ var ItemType = function ItemType(props) {
|
|
|
477
407
|
/**
|
|
478
408
|
* 传出最后的 item 对象
|
|
479
409
|
*/
|
|
480
|
-
|
|
481
410
|
React__default.useEffect(function () {
|
|
482
411
|
var item = Object.assign(Object.assign({}, props), {
|
|
483
412
|
setErrorMsg: setErrorMsg,
|
|
@@ -488,7 +417,6 @@ var ItemType = function ItemType(props) {
|
|
|
488
417
|
/**
|
|
489
418
|
* 判断显示那个
|
|
490
419
|
*/
|
|
491
|
-
|
|
492
420
|
var selectType = function selectType() {
|
|
493
421
|
if (itemType && typeof itemType !== 'string' && (!itemType.name || itemType.name === 'InputType')) {
|
|
494
422
|
var item = Object.assign(Object.assign({}, props), {
|
|
@@ -497,7 +425,6 @@ var ItemType = function ItemType(props) {
|
|
|
497
425
|
});
|
|
498
426
|
return itemType(item);
|
|
499
427
|
}
|
|
500
|
-
|
|
501
428
|
switch (itemType) {
|
|
502
429
|
case 'file':
|
|
503
430
|
return jsx(FormFile, Object.assign({}, props, {
|
|
@@ -507,7 +434,6 @@ var ItemType = function ItemType(props) {
|
|
|
507
434
|
validateFunction(value);
|
|
508
435
|
}
|
|
509
436
|
}));
|
|
510
|
-
|
|
511
437
|
case 'switch':
|
|
512
438
|
if (backData[name] === undefined) setValue && setValue(name, 'initValue', !!backData[name]);
|
|
513
439
|
return jsx(Switch, Object.assign({
|
|
@@ -519,7 +445,6 @@ var ItemType = function ItemType(props) {
|
|
|
519
445
|
}, Object.assign(Object.assign({}, inputProps), {
|
|
520
446
|
disabled: disabled
|
|
521
447
|
})));
|
|
522
|
-
|
|
523
448
|
case 'checkGroup':
|
|
524
449
|
return jsx(FormCheckboxGroup, Object.assign({
|
|
525
450
|
error: errorStatus,
|
|
@@ -531,7 +456,6 @@ var ItemType = function ItemType(props) {
|
|
|
531
456
|
}, Object.assign(Object.assign({}, inputProps), {
|
|
532
457
|
disabled: disabled
|
|
533
458
|
})));
|
|
534
|
-
|
|
535
459
|
case 'select':
|
|
536
460
|
return jsx(FormSelect, Object.assign({
|
|
537
461
|
placeholder: tipsStr,
|
|
@@ -544,7 +468,6 @@ var ItemType = function ItemType(props) {
|
|
|
544
468
|
}, Object.assign({
|
|
545
469
|
disabled: disabled
|
|
546
470
|
}, inputProps)));
|
|
547
|
-
|
|
548
471
|
case 'radioGroup':
|
|
549
472
|
return jsx(FormRadioGroup, Object.assign({
|
|
550
473
|
error: errorStatus,
|
|
@@ -556,7 +479,6 @@ var ItemType = function ItemType(props) {
|
|
|
556
479
|
}, Object.assign({
|
|
557
480
|
disabled: disabled
|
|
558
481
|
}, inputProps)));
|
|
559
|
-
|
|
560
482
|
case 'textarea':
|
|
561
483
|
return jsx(TextField, Object.assign({
|
|
562
484
|
error: errorStatus,
|
|
@@ -571,7 +493,6 @@ var ItemType = function ItemType(props) {
|
|
|
571
493
|
validateFunction(e.target.value);
|
|
572
494
|
}
|
|
573
495
|
}, inputProps));
|
|
574
|
-
|
|
575
496
|
case 'number':
|
|
576
497
|
return jsx(InputNumber, Object.assign({
|
|
577
498
|
error: errorStatus,
|
|
@@ -584,7 +505,6 @@ var ItemType = function ItemType(props) {
|
|
|
584
505
|
validateFunction(val);
|
|
585
506
|
}
|
|
586
507
|
}, inputProps));
|
|
587
|
-
|
|
588
508
|
case 'comboSelect':
|
|
589
509
|
return jsx(ComboSelect, Object.assign({
|
|
590
510
|
error: errorStatus,
|
|
@@ -595,7 +515,6 @@ var ItemType = function ItemType(props) {
|
|
|
595
515
|
validateFunction(options);
|
|
596
516
|
}
|
|
597
517
|
}, inputProps));
|
|
598
|
-
|
|
599
518
|
default:
|
|
600
519
|
if (itemType && typeof itemType !== 'string') {
|
|
601
520
|
return jsx(DefaultCompoments, {
|
|
@@ -610,7 +529,6 @@ var ItemType = function ItemType(props) {
|
|
|
610
529
|
inputProps: inputProps
|
|
611
530
|
});
|
|
612
531
|
}
|
|
613
|
-
|
|
614
532
|
return jsx(TextField, Object.assign({
|
|
615
533
|
defaultValue: backData[name] || '',
|
|
616
534
|
error: errorStatus,
|
|
@@ -624,7 +542,6 @@ var ItemType = function ItemType(props) {
|
|
|
624
542
|
}, inputProps));
|
|
625
543
|
}
|
|
626
544
|
};
|
|
627
|
-
|
|
628
545
|
return selectType();
|
|
629
546
|
};
|
|
630
547
|
|
|
@@ -632,25 +549,21 @@ var ItemType = function ItemType(props) {
|
|
|
632
549
|
* 报错信息组件
|
|
633
550
|
* @description 为了解决,在主组件设置state,导致输入框中内容刷新,且失去焦点
|
|
634
551
|
*/
|
|
635
|
-
|
|
636
552
|
var ErrorTips = function ErrorTips(props) {
|
|
637
553
|
var getSetError = props.getSetError,
|
|
638
|
-
|
|
639
|
-
|
|
554
|
+
errorMessage = props.errorMessage,
|
|
555
|
+
helperTextProps = props.helperTextProps;
|
|
640
556
|
/**
|
|
641
557
|
* 报错信息
|
|
642
558
|
* @type {string}
|
|
643
559
|
*/
|
|
644
|
-
|
|
645
560
|
var _React$useState = React__default.useState(errorMessage || ''),
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
561
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
562
|
+
errorTips = _React$useState2[0],
|
|
563
|
+
setErrorTips = _React$useState2[1];
|
|
649
564
|
/**
|
|
650
565
|
* 初始化传出, 设置错误信息方法
|
|
651
566
|
*/
|
|
652
|
-
|
|
653
|
-
|
|
654
567
|
React__default.useEffect(function () {
|
|
655
568
|
setErrorTips(errorMessage || '');
|
|
656
569
|
}, [errorMessage]);
|
|
@@ -683,35 +596,32 @@ var formInputTypeJson = {
|
|
|
683
596
|
* @author zhanzl
|
|
684
597
|
* @description 用于根据配置自动生成表单
|
|
685
598
|
*/
|
|
686
|
-
|
|
687
599
|
var FormItem = function FormItem(props) {
|
|
688
600
|
var _a, _b;
|
|
689
|
-
|
|
690
601
|
var _props$type = props.type,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
602
|
+
type = _props$type === void 0 ? 'horizontal' : _props$type,
|
|
603
|
+
labelWidth = props.labelWidth,
|
|
604
|
+
tips = props.tips,
|
|
605
|
+
label = props.label,
|
|
606
|
+
itemType = props.itemType,
|
|
607
|
+
_props$InputType = props.InputType,
|
|
608
|
+
InputType = _props$InputType === void 0 ? itemType : _props$InputType,
|
|
609
|
+
setValue = props.setValue,
|
|
610
|
+
errorMessage = props.errorMessage,
|
|
611
|
+
hideLabel = props.hideLabel,
|
|
612
|
+
_props$backData = props.backData,
|
|
613
|
+
backData = _props$backData === void 0 ? {} : _props$backData,
|
|
614
|
+
defaultValue = props.defaultValue,
|
|
615
|
+
name = props.name,
|
|
616
|
+
_props$hideError = props.hideError,
|
|
617
|
+
hideError = _props$hideError === void 0 ? false : _props$hideError,
|
|
618
|
+
_props$className = props.className,
|
|
619
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
620
|
+
labelProps = props.labelProps,
|
|
621
|
+
helperTextProps = props.helperTextProps,
|
|
622
|
+
requiredElement = props.requiredElement,
|
|
623
|
+
_props$disRequiredEle = props.disRequiredElement,
|
|
624
|
+
disRequiredElement = _props$disRequiredEle === void 0 ? false : _props$disRequiredEle;
|
|
715
625
|
if (backData[name] === undefined) {
|
|
716
626
|
backData[name] = defaultValue;
|
|
717
627
|
}
|
|
@@ -719,21 +629,16 @@ var FormItem = function FormItem(props) {
|
|
|
719
629
|
* 接受设置报错信息方法
|
|
720
630
|
* @type {Function}
|
|
721
631
|
*/
|
|
722
|
-
|
|
723
|
-
|
|
724
632
|
var setErrorTips = React__default.useRef();
|
|
725
633
|
/**
|
|
726
634
|
* 设置错误信息
|
|
727
635
|
*/
|
|
728
|
-
|
|
729
636
|
var setError = function setError(error) {
|
|
730
637
|
setErrorTips.current && setErrorTips.current(error);
|
|
731
638
|
};
|
|
732
639
|
/**
|
|
733
640
|
* 用于判断是否是 vertical 模式如果是则添加相应的外层
|
|
734
641
|
*/
|
|
735
|
-
|
|
736
|
-
|
|
737
642
|
var TypeLayout = function TypeLayout(props) {
|
|
738
643
|
return type === 'vertical' ? jsx("div", Object.assign({
|
|
739
644
|
className: "form-content-vertical form-content-vertical-".concat(name),
|
|
@@ -747,25 +652,19 @@ var FormItem = function FormItem(props) {
|
|
|
747
652
|
/**
|
|
748
653
|
* 展示label
|
|
749
654
|
*/
|
|
750
|
-
|
|
751
|
-
|
|
752
655
|
var showLabel = React__default.useCallback(function () {
|
|
753
656
|
if (!label) return '';
|
|
754
657
|
return typeof label === 'string' ? label : label(props);
|
|
755
658
|
}, [label]);
|
|
756
659
|
/** 处理className */
|
|
757
|
-
|
|
758
660
|
var handClass = function handClass() {
|
|
759
661
|
var str = "".concat($prefixCls, "-form-item ").concat($prefixCls, "-form-item-").concat(name);
|
|
760
662
|
if (className) str += ' ' + className;
|
|
761
|
-
|
|
762
663
|
if (typeof InputType === 'string' && formInputTypeJson[InputType]) {
|
|
763
664
|
str += " ".concat($prefixCls, "-form-item-").concat(InputType);
|
|
764
665
|
}
|
|
765
|
-
|
|
766
666
|
return str;
|
|
767
667
|
};
|
|
768
|
-
|
|
769
668
|
return jsxs("div", Object.assign({
|
|
770
669
|
className: handClass()
|
|
771
670
|
}, {
|