@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.6

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.
Files changed (188) hide show
  1. package/AutoBox/index.js +72 -85
  2. package/AutoTips/index.js +72 -95
  3. package/Badge/index.js +17 -16
  4. package/Breadcrumbs/index.js +57 -73
  5. package/Button/index.js +90 -118
  6. package/ButtonGroup/index.js +30 -33
  7. package/Carousel/index.js +29 -33
  8. package/Cascader/index.js +9 -10
  9. package/Checkbox/index.js +28 -35
  10. package/CheckboxGroup/index.js +43 -58
  11. package/Collapse/index.js +52 -49
  12. package/CollapseBox/index.js +65 -70
  13. package/CollapseLayout/index.js +106 -101
  14. package/ColorPicker/index.js +3 -3
  15. package/ComboSelect/index.js +260 -337
  16. package/ComboSelect/lang/en_US.d.ts +1 -0
  17. package/ComboSelect/lang/index.d.ts +2 -0
  18. package/ComboSelect/lang/zh_CN.d.ts +1 -0
  19. package/ComboSelect/utils.d.ts +6 -0
  20. package/Container/index.js +17 -21
  21. package/CopyText/index.js +50 -83
  22. package/DatePicker/index.js +24 -27
  23. package/Descriptions/index.js +50 -59
  24. package/Desktop/index.js +161 -180
  25. package/DragVerify/index.js +77 -113
  26. package/Drawer/index.js +80 -95
  27. package/Dropdown/index.js +3 -3
  28. package/DynamicMultiBox/index.js +222 -224
  29. package/DynamicMultiBox/interface.d.ts +7 -0
  30. package/Empty/index.js +26 -28
  31. package/Form/index.js +70 -74
  32. package/FormItem/index.js +18 -15
  33. package/FunctionModal/index.js +7 -14
  34. package/GlobalContext/index.js +17 -20
  35. package/Help/index.js +9 -12
  36. package/HelperText/index.js +11 -11
  37. package/InputLang/index.js +104 -124
  38. package/InputNumber/index.js +62 -81
  39. package/Label/index.js +19 -21
  40. package/Loading/index.js +11 -10
  41. package/Menu/index.js +302 -371
  42. package/Message/index.js +104 -113
  43. package/Modal/index.js +122 -148
  44. package/MultiBox/index.d.ts +5 -0
  45. package/MultiBox/index.js +111 -115
  46. package/Notification/index.js +105 -103
  47. package/OperateBtn/index.d.ts +3 -0
  48. package/OperateBtn/index.js +77 -107
  49. package/PageHeader/index.js +327 -406
  50. package/Pagination/index.js +107 -137
  51. package/ParauiProvider/index.js +20 -22
  52. package/PasswordRules/index.js +36 -40
  53. package/PopConfirm/index.js +60 -77
  54. package/Popover/index.js +12 -12
  55. package/Progress/index.js +72 -74
  56. package/Querying/index.js +22 -23
  57. package/README.md +2 -0
  58. package/Radio/index.js +27 -34
  59. package/RadioGroup/index.js +38 -52
  60. package/Search/index.js +34 -43
  61. package/Select/index.js +281 -345
  62. package/SelectInput/index.js +8 -13
  63. package/Selector/index.js +582 -796
  64. package/SelectorPicker/index.js +113 -134
  65. package/SingleBox/index.d.ts +5 -0
  66. package/SingleBox/index.js +92 -88
  67. package/Slider/index.js +46 -57
  68. package/Status/index.js +14 -13
  69. package/Stepper/index.js +24 -25
  70. package/Styles/theme.scss +9 -9
  71. package/Switch/index.js +32 -35
  72. package/Table/index.js +360 -494
  73. package/Tabs/index.js +100 -100
  74. package/Tag/index.js +64 -82
  75. package/TextEditor/index.js +78 -100
  76. package/TextField/index.js +142 -183
  77. package/TimePicker/index.js +29 -28
  78. package/Timeline/index.js +50 -47
  79. package/Title/index.js +32 -34
  80. package/ToggleButton/index.js +29 -29
  81. package/Tooltip/index.js +52 -56
  82. package/Transfer/index.js +117 -154
  83. package/Tree/index.js +9 -10
  84. package/Upload/index.js +125 -143
  85. package/Upload/interface.d.ts +2 -0
  86. package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
  87. package/_verture/{index-5a7e2438.js → index-3cdaba96.js} +967 -934
  88. package/_verture/{index-b1f80962.js → index-4fafd0a0.js} +6 -8
  89. package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
  90. package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
  91. package/_verture/{index-232d890b.js → index-d63bd287.js} +1 -1
  92. package/_verture/index-da9097d3.js +239 -0
  93. package/_verture/{index-9331b116.js → index-e0f9064d.js} +125 -134
  94. package/_verture/intl-f2f27722.js +69 -0
  95. package/_verture/{modalContext-736ff215.js → modalContext-8534f23d.js} +36 -64
  96. package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
  97. package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
  98. package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
  99. package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
  100. package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
  101. package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
  102. package/_verture/utils-c17b5265.js +97 -0
  103. package/index.js +24 -23
  104. package/locale/en-US.d.ts +1 -0
  105. package/locale/index.d.ts +2 -0
  106. package/locale/index.js +10 -8
  107. package/locale/zh-CN.d.ts +1 -0
  108. package/package.json +11 -10
  109. package/umd/AutoBox.js +9 -8
  110. package/umd/AutoTips.js +9 -8
  111. package/umd/Badge.js +1 -1
  112. package/umd/Breadcrumbs.js +9 -8
  113. package/umd/Button.js +9 -8
  114. package/umd/ButtonGroup.js +9 -8
  115. package/umd/Carousel.js +5 -5
  116. package/umd/Cascader.js +9 -8
  117. package/umd/Checkbox.js +9 -8
  118. package/umd/CheckboxGroup.js +9 -8
  119. package/umd/Collapse.js +8 -7
  120. package/umd/CollapseBox.js +1 -1
  121. package/umd/CollapseLayout.js +4 -4
  122. package/umd/ColorPicker.js +1 -1
  123. package/umd/ComboSelect.js +9 -8
  124. package/umd/Container.js +1 -1
  125. package/umd/CopyText.js +9 -8
  126. package/umd/DatePicker.js +9 -8
  127. package/umd/Descriptions.js +9 -8
  128. package/umd/Desktop.js +9 -8
  129. package/umd/DragVerify.js +4 -4
  130. package/umd/Drawer.js +9 -8
  131. package/umd/Dropdown.js +6 -5
  132. package/umd/DynamicMultiBox.js +11 -10
  133. package/umd/Empty.js +1 -1
  134. package/umd/Form.js +9 -8
  135. package/umd/FormItem.js +9 -8
  136. package/umd/FunctionModal.js +9 -8
  137. package/umd/GlobalContext.js +1 -1
  138. package/umd/Help.js +9 -8
  139. package/umd/HelperText.js +1 -1
  140. package/umd/InputLang.js +9 -8
  141. package/umd/InputNumber.js +9 -8
  142. package/umd/Label.js +9 -8
  143. package/umd/Loading.js +4 -4
  144. package/umd/Menu.js +4 -4
  145. package/umd/Message.js +4 -4
  146. package/umd/Modal.js +9 -8
  147. package/umd/MultiBox.js +9 -8
  148. package/umd/Notification.js +8 -7
  149. package/umd/OperateBtn.js +9 -8
  150. package/umd/PageHeader.js +9 -8
  151. package/umd/Pagination.js +9 -8
  152. package/umd/ParauiProvider.js +1 -1
  153. package/umd/PasswordRules.js +4 -4
  154. package/umd/PopConfirm.js +9 -8
  155. package/umd/Popover.js +9 -8
  156. package/umd/Progress.js +5 -5
  157. package/umd/Querying.js +1 -1
  158. package/umd/Radio.js +9 -8
  159. package/umd/RadioGroup.js +9 -8
  160. package/umd/Search.js +9 -8
  161. package/umd/Select.js +9 -8
  162. package/umd/SelectInput.js +9 -8
  163. package/umd/Selector.js +9 -8
  164. package/umd/SelectorPicker.js +9 -8
  165. package/umd/SingleBox.js +9 -8
  166. package/umd/Slider.js +6 -5
  167. package/umd/Status.js +4 -4
  168. package/umd/Stepper.js +9 -8
  169. package/umd/Switch.js +9 -8
  170. package/umd/Table.js +9 -8
  171. package/umd/Tabs.js +9 -8
  172. package/umd/Tag.js +9 -8
  173. package/umd/TextEditor.js +22 -21
  174. package/umd/TextField.js +9 -8
  175. package/umd/TimePicker.js +9 -8
  176. package/umd/Timeline.js +1 -1
  177. package/umd/Title.js +9 -8
  178. package/umd/ToggleButton.js +9 -8
  179. package/umd/Tooltip.js +9 -8
  180. package/umd/Transfer.js +10 -9
  181. package/umd/Tree.js +9 -8
  182. package/umd/Upload.js +10 -9
  183. package/umd/locale.js +1 -1
  184. package/_verture/index-e9007d6a.js +0 -236
  185. package/_verture/intl-5c1ec055.js +0 -81
  186. package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
  187. package/_verture/utils-418da0a4.js +0 -73
  188. /package/_verture/{typeof-c310ee4a.js → typeof-b240b062.js} +0 -0
@@ -1,25 +1,24 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
- import { _ as _slicedToArray } from './slicedToArray-a8206399.js';
4
3
  import { TextField } from '../TextField/index.js';
4
+ import { _ as _slicedToArray } from './slicedToArray-75fa4188.js';
5
5
  import { RadioGroup } from '../RadioGroup/index.js';
6
6
  import Select from '../Select/index.js';
7
7
  import { CheckboxGroup } from '../CheckboxGroup/index.js';
8
- import { _ as _typeof } from './typeof-adeedc13.js';
9
8
  import { Switch } from '../Switch/index.js';
10
9
  import Delete from '@para-ui/icons/Delete';
11
10
  import ParaLinkGroup from '@para-ui/icons/LinkGroup';
12
11
  import AutoTips from '../AutoTips/index.js';
13
12
  import { Button } from '../Button/index.js';
14
13
  import UploadIcon from '@para-ui/icons/UploadFile';
15
- import { u as useFormatMessage } from './useFormatMessage-703f8b20.js';
14
+ import { u as useFormatMessage } from './useFormatMessage-eb13cf56.js';
16
15
  import { s as styleInject } from './style-inject.es-300983ab.js';
17
16
  import { InputNumber } from '../InputNumber/index.js';
18
17
  import { ComboSelect } from '../ComboSelect/index.js';
19
18
  import HelperText from '../HelperText/index.js';
20
19
  import clsx from 'clsx';
21
20
  import Label from '../Label/index.js';
22
- import { $ as $prefixCls } from './constant-0d9802f7.js';
21
+ import { $ as $prefixCls } from './constant-5317fc89.js';
23
22
 
24
23
  var FormRadioGroup = function FormRadioGroup(props) {
25
24
  var defaultValue = props.defaultValue,
@@ -104,23 +103,23 @@ var FormCheckboxGroup = function FormCheckboxGroup(props) {
104
103
  * 表单默认的校验方法
105
104
  * @type {{[name: string]: validateFunctionType}}
106
105
  */
107
- var fixedValidateFunction = {
108
- 'required': function required(item, val, intl) {
106
+ const fixedValidateFunction = {
107
+ 'required': (item, val, intl) => {
109
108
  var _a, _b, _c, _d;
110
- var vtype = _typeof(val);
111
- var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.required) || intl({
109
+ const vtype = typeof val;
110
+ const error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.required) || intl({
112
111
  id: 'unEmpty'
113
112
  }, {
114
113
  label: item.label
115
114
  });
116
- var jude = false;
115
+ let jude = false;
117
116
  switch (vtype) {
118
117
  case 'string':
119
- 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;
118
+ const 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;
120
119
  if (!disOnlySpace) {
121
120
  jude = !!val;
122
121
  } else {
123
- var space = /^[\s]+$/;
122
+ const space = /^[\s]+$/;
124
123
  jude = !!val && !space.test(val);
125
124
  }
126
125
  break;
@@ -128,7 +127,7 @@ var fixedValidateFunction = {
128
127
  jude = val + 1 > val;
129
128
  break;
130
129
  case 'object':
131
- var str = JSON.stringify(val);
130
+ const str = JSON.stringify(val);
132
131
  jude = str !== 'null' && str !== '[]' && str !== '{}';
133
132
  break;
134
133
  case 'boolean':
@@ -140,15 +139,15 @@ var fixedValidateFunction = {
140
139
  }
141
140
  return jude || error;
142
141
  },
143
- 'maxlength': function maxlength(item, val, intl) {
142
+ 'maxlength': (item, val, intl) => {
144
143
  var _a, _b, _c, _d, _e, _f;
145
- var vtype = _typeof(val);
146
- var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.maxlength) || intl({
144
+ const vtype = typeof val;
145
+ const error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.maxlength) || intl({
147
146
  id: 'maxLength'
148
147
  }, {
149
148
  len: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.maxlength
150
149
  });
151
- var jude = false;
150
+ let jude = false;
152
151
  if (vtype === 'string' || vtype === 'number' && val + 1 > val) {
153
152
  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));
154
153
  } else {
@@ -156,15 +155,15 @@ var fixedValidateFunction = {
156
155
  }
157
156
  return jude || error;
158
157
  },
159
- 'minLength': function minLength(item, val, intl) {
158
+ 'minLength': (item, val, intl) => {
160
159
  var _a, _b, _c, _d, _e, _f;
161
- var vtype = _typeof(val);
162
- var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.minLength) || intl({
160
+ const vtype = typeof val;
161
+ const error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.minLength) || intl({
163
162
  id: 'minLength'
164
163
  }, {
165
164
  len: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.minLength
166
165
  });
167
- var jude = false;
166
+ let jude = false;
168
167
  if (vtype === 'string' || vtype === 'number' && val + 1 > val) {
169
168
  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);
170
169
  } else {
@@ -172,43 +171,43 @@ var fixedValidateFunction = {
172
171
  }
173
172
  return jude || error;
174
173
  },
175
- 'pattern': function pattern(item, val, intl) {
174
+ 'pattern': (item, val, intl) => {
176
175
  var _a, _b, _c, _d;
177
- var testReg = (_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.pattern;
178
- var error = ((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.pattern) || intl({
176
+ const testReg = (_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.pattern;
177
+ const error = ((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.pattern) || intl({
179
178
  id: 'unRule'
180
179
  }, {
181
180
  rule: '' + testReg
182
181
  });
183
- var jude = !val;
182
+ let jude = !val;
184
183
  if (testReg && val && typeof testReg !== 'function') {
185
184
  jude = testReg.test(val);
186
185
  }
187
186
  return jude || error;
188
187
  },
189
- 'min': function min(item, val, intl) {
188
+ 'min': (item, val, intl) => {
190
189
  var _a, _b, _c, _d, _e, _f, _g, _h;
191
- var vtype = _typeof(val);
192
- var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.min) || intl({
190
+ const vtype = typeof val;
191
+ const error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.min) || intl({
193
192
  id: 'minValue'
194
193
  }, {
195
194
  val: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.min
196
195
  });
197
- var jude = !val;
196
+ let jude = !val;
198
197
  if (vtype === 'string' || vtype === 'number') {
199
198
  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);
200
199
  }
201
200
  return jude || error;
202
201
  },
203
- 'max': function max(item, val, intl) {
202
+ 'max': (item, val, intl) => {
204
203
  var _a, _b, _c, _d, _e, _f, _g, _h;
205
- var vtype = _typeof(val);
206
- var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.max) || intl({
204
+ const vtype = typeof val;
205
+ const error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.max) || intl({
207
206
  id: 'maxValue'
208
207
  }, {
209
208
  val: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.max
210
209
  });
211
- var jude = !val;
210
+ let jude = !val;
212
211
  if (vtype === 'string' || vtype === 'number') {
213
212
  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);
214
213
  }
@@ -219,14 +218,14 @@ var fixedValidateFunction = {
219
218
  * 表单rules校验方法
220
219
  * @type {validateFunctionType}
221
220
  */
222
- var validate = function validate(item, val, intl) {
221
+ const validate = (item, val, intl) => {
223
222
  var _a, _b;
224
- var validateObj = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate;
223
+ const validateObj = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate;
225
224
  if (validateObj) {
226
- var messageObj = (_b = item.rules) === null || _b === void 0 ? void 0 : _b.message;
227
- for (var key in validateObj) {
228
- var tempFuc = validateObj[key];
229
- var tmsg = '';
225
+ const messageObj = (_b = item.rules) === null || _b === void 0 ? void 0 : _b.message;
226
+ for (const key in validateObj) {
227
+ const tempFuc = validateObj[key];
228
+ let tmsg = '';
230
229
  if (typeof tempFuc === 'function') {
231
230
  tmsg = tempFuc(item, val, intl);
232
231
  if (tmsg === false && messageObj) tmsg = messageObj[key];
@@ -247,8 +246,8 @@ var validate = function validate(item, val, intl) {
247
246
  var en = {
248
247
  choseFile: 'Chose File',
249
248
  unEmpty: '{label} Cannot be empty',
250
- maxLength: 'The maximum length cannot be exceeded{len}',
251
- minLength: 'The minimum length cannot be exceeded{len}',
249
+ maxLength: 'The maximum length cannot be exceeded {len}',
250
+ minLength: 'The minimum length cannot be exceeded {len}',
252
251
  unRule: 'The parameter does not comply with the validation rule {rule}',
253
252
  minValue: 'The minimum value is {val}',
254
253
  maxValue: 'The maximum value is {val}'
@@ -257,16 +256,16 @@ var en = {
257
256
  var zh = {
258
257
  choseFile: '选择文件',
259
258
  unEmpty: '{label}不能为空',
260
- maxLength: '最大长度不能超过{len}',
261
- minLength: '最小长度为{len}',
259
+ maxLength: '最大长度不能超过{len}',
260
+ minLength: '最小长度为{len}',
262
261
  unRule: '参数不符合校验规则{rule}',
263
262
  minValue: '最小值为{val}',
264
263
  maxValue: '最大值为{val}'
265
264
  };
266
265
 
267
266
  var localeJson = {
268
- zh: zh,
269
- en: en
267
+ zh,
268
+ en
270
269
  };
271
270
 
272
271
  var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.form-file {\n padding: 6px;\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n}\n.form-file .file-tips {\n min-height: 20px;\n position: relative;\n padding: 6px;\n}\n.form-file .file-tips .file-tips-item {\n position: relative;\n height: 20px;\n line-height: 16px;\n padding-right: 20px;\n}\n.form-file .file-tips .file-tips-item > [data-name=LinkGroup] {\n vertical-align: middle;\n margin-right: 9px;\n}\n.form-file .file-tips .file-tips-item .file-tips-context {\n display: inline-block;\n vertical-align: middle;\n width: calc(100% - 45px);\n color: rgb(92, 101, 115);\n}\n.form-file .file-tips .file-tips-item > [data-name=Delete] {\n display: none;\n vertical-align: middle;\n cursor: pointer;\n position: absolute;\n right: 3px;\n top: 2px;\n}\n.form-file .file-tips .file-tips-item > [data-name=Delete]:hover {\n opacity: 0.8;\n}\n.form-file .file-tips .file-tips-item:hover {\n backgroundColor: #f5f5f5;\n}\n.form-file .file-tips .file-tips-item:hover > [data-name=Delete] {\n display: inline-block;\n}";
@@ -408,53 +407,52 @@ var DefaultCompoments = function DefaultCompoments(props) {
408
407
  /**
409
408
  * form 表单操作项 类型
410
409
  */
411
- var ItemType = function ItemType(props) {
412
- var itemType = props.itemType,
413
- error = props.error,
414
- placeholder = props.placeholder,
415
- label = props.label,
416
- inputProps = props.inputProps,
417
- name = props.name,
418
- rules = props.rules,
419
- setValue = props.setValue,
420
- setError = props.setError,
421
- backData = props.backData,
422
- disabled = props.disabled,
423
- change = props.change,
424
- isComponent = props.isComponent;
425
- var intl = useFormatMessage('FormItem', localeJson);
426
- var tipsStr = placeholder || "".concat(label);
410
+ const ItemType = props => {
411
+ const {
412
+ itemType,
413
+ error,
414
+ placeholder,
415
+ label,
416
+ inputProps,
417
+ name,
418
+ rules,
419
+ setValue,
420
+ setError,
421
+ backData,
422
+ disabled,
423
+ change,
424
+ isComponent
425
+ } = props;
426
+ const intl = useFormatMessage('FormItem', localeJson);
427
+ const tipsStr = placeholder || "".concat(label);
427
428
  /**
428
429
  * 报错信息
429
430
  * @type {boolean}
430
431
  */
431
- var _React$useState = React__default.useState(!!error),
432
- _React$useState2 = _slicedToArray(_React$useState, 2),
433
- errorStatus = _React$useState2[0],
434
- setErrorStatus = _React$useState2[1];
432
+ const [errorStatus, setErrorStatus] = React__default.useState(!!error);
435
433
  /**
436
434
  * 校验方法
437
435
  */
438
- var validateFunction = function validateFunction(val) {
436
+ const validateFunction = val => {
439
437
  setValue && setValue(name, 'value', val);
440
438
  change && change(val);
441
439
  // 没有校验规则直接退出
442
440
  if (!rules) return;
443
- var item = Object.assign(Object.assign({}, props), {
444
- setErrorMsg: setErrorMsg,
445
- setAndValidateValue: setAndValidateValue
441
+ const item = Object.assign(Object.assign({}, props), {
442
+ setErrorMsg,
443
+ setAndValidateValue
446
444
  });
447
- var errorMessage = validate(item, val, intl) || '';
445
+ const errorMessage = validate(item, val, intl) || '';
448
446
  setErrorMsg(errorMessage);
449
447
  };
450
448
  /**
451
449
  * 存储和校验数据
452
450
  */
453
- var setAndValidateValue = validateFunction;
451
+ const setAndValidateValue = validateFunction;
454
452
  /**
455
453
  * 合并设置Error状态方法
456
454
  */
457
- var setErrorMsg = React__default.useCallback(function (msg) {
455
+ const setErrorMsg = React__default.useCallback(msg => {
458
456
  setError && setError(msg);
459
457
  setErrorStatus(!!msg);
460
458
  setValue && setValue(name, 'message', msg);
@@ -462,21 +460,21 @@ var ItemType = function ItemType(props) {
462
460
  /**
463
461
  * 传出最后的 item 对象
464
462
  */
465
- React__default.useEffect(function () {
466
- var item = Object.assign(Object.assign({}, props), {
467
- setErrorMsg: setErrorMsg,
468
- setAndValidateValue: setAndValidateValue
463
+ React__default.useEffect(() => {
464
+ const item = Object.assign(Object.assign({}, props), {
465
+ setErrorMsg,
466
+ setAndValidateValue
469
467
  });
470
468
  setValue && setValue(name, 'item', item);
471
469
  }, [name, props, setErrorMsg, setValue]);
472
470
  /**
473
471
  * 判断显示那个
474
472
  */
475
- var selectType = function selectType() {
473
+ const selectType = () => {
476
474
  if (!isComponent && itemType && typeof itemType !== 'string' && (!itemType.name || itemType.name === 'InputType')) {
477
- var item = Object.assign(Object.assign({}, props), {
478
- setErrorMsg: setErrorMsg,
479
- setAndValidateValue: setAndValidateValue
475
+ const item = Object.assign(Object.assign({}, props), {
476
+ setErrorMsg,
477
+ setAndValidateValue
480
478
  });
481
479
  return itemType(item);
482
480
  }
@@ -485,7 +483,7 @@ var ItemType = function ItemType(props) {
485
483
  return jsx(FormFile, Object.assign({}, props, {
486
484
  defaultValue: backData[name],
487
485
  disabled: disabled,
488
- onChange: function onChange(value) {
486
+ onChange: value => {
489
487
  validateFunction(value);
490
488
  }
491
489
  }));
@@ -493,7 +491,7 @@ var ItemType = function ItemType(props) {
493
491
  if (backData[name] === undefined) setValue && setValue(name, 'initValue', !!backData[name]);
494
492
  return jsx(Switch, Object.assign({
495
493
  defaultChecked: !!backData[name],
496
- onChange: function onChange(checked) {
494
+ onChange: checked => {
497
495
  validateFunction(checked);
498
496
  }
499
497
  }, Object.assign(Object.assign({}, inputProps), {
@@ -503,7 +501,7 @@ var ItemType = function ItemType(props) {
503
501
  return jsx(FormCheckboxGroup, Object.assign({
504
502
  error: errorStatus,
505
503
  defaultValue: backData[name],
506
- change: function change(value) {
504
+ change: value => {
507
505
  validateFunction(value);
508
506
  },
509
507
  list: props.list
@@ -515,7 +513,7 @@ var ItemType = function ItemType(props) {
515
513
  placeholder: tipsStr,
516
514
  defaultValue: backData[name],
517
515
  error: errorStatus,
518
- change: function change(value) {
516
+ change: value => {
519
517
  validateFunction(value);
520
518
  },
521
519
  list: props.list
@@ -526,7 +524,7 @@ var ItemType = function ItemType(props) {
526
524
  return jsx(FormRadioGroup, Object.assign({
527
525
  error: errorStatus,
528
526
  defaultValue: backData[name],
529
- change: function change(value) {
527
+ change: value => {
530
528
  validateFunction(value);
531
529
  },
532
530
  list: props.list
@@ -543,7 +541,7 @@ var ItemType = function ItemType(props) {
543
541
  rows: 3,
544
542
  name: name,
545
543
  hideErrorDom: null,
546
- onChange: function onChange(e) {
544
+ onChange: e => {
547
545
  validateFunction(e.target.value);
548
546
  }
549
547
  }, inputProps));
@@ -555,7 +553,7 @@ var ItemType = function ItemType(props) {
555
553
  disabled: disabled,
556
554
  name: name,
557
555
  hideErrorDom: null,
558
- onChange: function onChange(val) {
556
+ onChange: val => {
559
557
  validateFunction(val);
560
558
  }
561
559
  }, inputProps));
@@ -565,7 +563,7 @@ var ItemType = function ItemType(props) {
565
563
  placeholder: tipsStr,
566
564
  defaultValue: backData[name],
567
565
  disabled: disabled,
568
- onChange: function onChange(options) {
566
+ onChange: options => {
569
567
  validateFunction(options);
570
568
  }
571
569
  }, inputProps));
@@ -577,7 +575,7 @@ var ItemType = function ItemType(props) {
577
575
  placeholder: tipsStr,
578
576
  defaultValue: backData[name],
579
577
  disabled: disabled,
580
- onChange: function onChange(val) {
578
+ onChange: val => {
581
579
  validateFunction(val);
582
580
  },
583
581
  inputProps: inputProps
@@ -588,7 +586,7 @@ var ItemType = function ItemType(props) {
588
586
  autocomplete: "off",
589
587
  error: errorStatus,
590
588
  placeholder: tipsStr,
591
- onChange: function onChange(e) {
589
+ onChange: e => {
592
590
  validateFunction(e.target.value);
593
591
  },
594
592
  name: name,
@@ -604,25 +602,24 @@ var ItemType = function ItemType(props) {
604
602
  * 报错信息组件
605
603
  * @description 为了解决,在主组件设置state,导致输入框中内容刷新,且失去焦点
606
604
  */
607
- var ErrorTips = function ErrorTips(props) {
608
- var getSetError = props.getSetError,
609
- errorMessage = props.errorMessage,
610
- helperTextProps = props.helperTextProps;
605
+ const ErrorTips = props => {
606
+ const {
607
+ getSetError,
608
+ errorMessage,
609
+ helperTextProps
610
+ } = props;
611
611
  /**
612
612
  * 报错信息
613
613
  * @type {string}
614
614
  */
615
- var _React$useState = React__default.useState(errorMessage || ''),
616
- _React$useState2 = _slicedToArray(_React$useState, 2),
617
- errorTips = _React$useState2[0],
618
- setErrorTips = _React$useState2[1];
615
+ const [errorTips, setErrorTips] = React__default.useState(errorMessage || '');
619
616
  /**
620
617
  * 初始化传出, 设置错误信息方法
621
618
  */
622
- React__default.useEffect(function () {
619
+ React__default.useEffect(() => {
623
620
  setErrorTips(errorMessage || '');
624
621
  }, [errorMessage]);
625
- React__default.useEffect(function () {
622
+ React__default.useEffect(() => {
626
623
  getSetError && getSetError(setErrorTips);
627
624
  }, [getSetError]);
628
625
  return jsx(HelperText, Object.assign({
@@ -635,7 +632,7 @@ var ErrorTips = function ErrorTips(props) {
635
632
  var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-form-item {\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n}\n.paraui-v4-form-item .paraui-v4-text-field {\n display: block;\n}\n.paraui-v4-form-item.paraui-v4-form-item-checkGroup .form-label .form-labe-text, .paraui-v4-form-item.paraui-v4-form-item-radioGroup .form-label .form-labe-text {\n margin-bottom: 4px;\n}\n.paraui-v4-form-item .form-label {\n display: inline-block;\n}\n.paraui-v4-form-item .form-edit > div {\n padding: 0;\n width: 100%;\n}\n.paraui-v4-form-item .form-content-vertical {\n display: inline-block;\n width: 100%;\n}";
636
633
  styleInject(css_248z);
637
634
 
638
- var formInputTypeJson = {
635
+ const formInputTypeJson = {
639
636
  checkGroup: true,
640
637
  select: true,
641
638
  radioGroup: true,
@@ -651,32 +648,28 @@ var formInputTypeJson = {
651
648
  * @author zhanzl
652
649
  * @description 用于根据配置自动生成表单
653
650
  */
654
- var FormItem = function FormItem(props) {
651
+ const FormItem = props => {
655
652
  var _a, _b;
656
- var _props$type = props.type,
657
- type = _props$type === void 0 ? 'horizontal' : _props$type,
658
- labelWidth = props.labelWidth,
659
- tips = props.tips,
660
- label = props.label,
661
- itemType = props.itemType,
662
- _props$InputType = props.InputType,
663
- InputType = _props$InputType === void 0 ? itemType : _props$InputType,
664
- setValue = props.setValue,
665
- errorMessage = props.errorMessage,
666
- hideLabel = props.hideLabel,
667
- _props$backData = props.backData,
668
- backData = _props$backData === void 0 ? {} : _props$backData,
669
- defaultValue = props.defaultValue,
670
- name = props.name,
671
- _props$hideError = props.hideError,
672
- hideError = _props$hideError === void 0 ? false : _props$hideError,
673
- _props$className = props.className,
674
- className = _props$className === void 0 ? '' : _props$className,
675
- labelProps = props.labelProps,
676
- helperTextProps = props.helperTextProps,
677
- requiredElement = props.requiredElement,
678
- _props$disRequiredEle = props.disRequiredElement,
679
- disRequiredElement = _props$disRequiredEle === void 0 ? false : _props$disRequiredEle;
653
+ const {
654
+ type = 'horizontal',
655
+ labelWidth,
656
+ tips,
657
+ label,
658
+ itemType,
659
+ InputType = itemType,
660
+ setValue,
661
+ errorMessage,
662
+ hideLabel,
663
+ backData = {},
664
+ defaultValue,
665
+ name,
666
+ hideError = false,
667
+ className = '',
668
+ labelProps,
669
+ helperTextProps,
670
+ requiredElement,
671
+ disRequiredElement = false
672
+ } = props;
680
673
  if (backData[name] === undefined) {
681
674
  backData[name] = defaultValue;
682
675
  }
@@ -684,17 +677,17 @@ var FormItem = function FormItem(props) {
684
677
  * 接受设置报错信息方法
685
678
  * @type {Function}
686
679
  */
687
- var setErrorTips = React__default.useRef();
680
+ const setErrorTips = React__default.useRef();
688
681
  /**
689
682
  * 设置错误信息
690
683
  */
691
- var setError = function setError(error) {
684
+ const setError = error => {
692
685
  setErrorTips.current && setErrorTips.current(error);
693
686
  };
694
687
  /**
695
688
  * 用于判断是否是 vertical 模式如果是则添加相应的外层
696
689
  */
697
- var TypeLayout = function TypeLayout(props) {
690
+ const TypeLayout = props => {
698
691
  return type === 'vertical' ? jsx("div", Object.assign({
699
692
  className: "form-content-vertical form-content-vertical-".concat(name),
700
693
  style: {
@@ -707,13 +700,13 @@ var FormItem = function FormItem(props) {
707
700
  /**
708
701
  * 展示label
709
702
  */
710
- var showLabel = React__default.useCallback(function () {
703
+ const showLabel = React__default.useCallback(() => {
711
704
  if (!label) return '';
712
705
  return typeof label === 'string' ? label : label(props);
713
706
  }, [label]);
714
707
  /** 处理className */
715
- var handClass = function handClass() {
716
- var str = "".concat($prefixCls, "-form-item ").concat($prefixCls, "-form-item-").concat(name);
708
+ const handClass = () => {
709
+ let str = "".concat($prefixCls, "-form-item ").concat($prefixCls, "-form-item-").concat(name);
717
710
  if (className) str += " ".concat(className);
718
711
  if (typeof InputType === 'string' && formInputTypeJson[InputType]) {
719
712
  str += " ".concat($prefixCls, "-form-item-").concat(InputType);
@@ -752,9 +745,7 @@ var FormItem = function FormItem(props) {
752
745
  className: "form-error form-error-".concat(name)
753
746
  }, {
754
747
  children: jsx(ErrorTips, {
755
- getSetError: function getSetError(fuc) {
756
- return setErrorTips.current = fuc;
757
- },
748
+ getSetError: fuc => setErrorTips.current = fuc,
758
749
  helperTextProps: helperTextProps,
759
750
  errorMessage: errorMessage
760
751
  })
@@ -0,0 +1,69 @@
1
+ // 实现 get 方法
2
+ // 支持对象和数组/支持默认值/支持路径/支持字符串模版变量/支持jsx/支持.运算符和[]运算符
3
+ const get = (obj, path, defaultValue) => {
4
+ const pathArr = path.replace(/\[(\d+)\]/g, '.$1').split('.');
5
+ let result = obj;
6
+ for (const p of pathArr) {
7
+ result = Object(result)[p];
8
+ if (result === undefined) {
9
+ return defaultValue;
10
+ }
11
+ }
12
+ return result;
13
+ };
14
+ /**
15
+ * 替换字符串模版变量
16
+ * @param str
17
+ * @param vars
18
+ */
19
+ const replaceStrTemplateVars = (str, vars) => {
20
+ if (!vars) return str;
21
+ str = str.replace(/\"/g, '\\"');
22
+ // 模版字符串正则
23
+ const strTemplateReg = /({[^{}]+})/g;
24
+ const parts = str.split(strTemplateReg);
25
+ return parts.map(part => {
26
+ if (part.match(strTemplateReg)) {
27
+ const key = part.replace(/({|})/g, '');
28
+ const val = get(vars, key);
29
+ return val === undefined ? key : val;
30
+ }
31
+ return part;
32
+ });
33
+ };
34
+ /**
35
+ * 国际化获取方法
36
+ * @param ops 国际化取值key参数
37
+ * @param i18nData 国际化数据对象
38
+ * @param params 国际化字符变量对象
39
+ * @param lang 指定国际化语言
40
+ * @param defI18nData 默认国际化数据对象
41
+ */
42
+ const i18nIntl = props => {
43
+ var _a, _b;
44
+ const {
45
+ ops,
46
+ i18nData,
47
+ lang,
48
+ params,
49
+ defI18nData
50
+ } = props;
51
+ let text, key;
52
+ if (typeof ops === 'string') {
53
+ key = ops;
54
+ } else if (typeof ops === 'object') {
55
+ if (typeof ops.id !== 'string') return 'i18n intl object "id" is missing';
56
+ key = ops.id;
57
+ }
58
+ if (key !== undefined) {
59
+ text = (_a = i18nData[lang]) === null || _a === void 0 ? void 0 : _a[key];
60
+ if (text === undefined && defI18nData) {
61
+ // 尝试从默认国际化数据获取
62
+ text = (_b = defI18nData[lang]) === null || _b === void 0 ? void 0 : _b[key];
63
+ }
64
+ }
65
+ if (typeof text !== 'string') return "{".concat(key, "}");
66
+ return replaceStrTemplateVars(text, params);
67
+ };
68
+
69
+ export { i18nIntl as i };