@para-ui/core 3.0.86 → 3.0.88

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.
@@ -11,6 +11,7 @@ import Delete from '@para-ui/icons/Delete';
11
11
  import ParaLinkGroup from '@para-ui/icons/LinkGroup';
12
12
  import AutoTips from '../AutoTips/index.js';
13
13
  import { Button } from '../Button/index.js';
14
+ import { u as useFormatMessage } from './useFormatMessage-703f8b20.js';
14
15
  import { s as styleInject } from './style-inject.es-300983ab.js';
15
16
  import { InputNumber } from '../InputNumber/index.js';
16
17
  import { ComboSelect } from '../ComboSelect/index.js';
@@ -103,10 +104,14 @@ var FormCheckboxGroup = function FormCheckboxGroup(props) {
103
104
  * @type {{[name: string]: validateFunctionType}}
104
105
  */
105
106
  var fixedValidateFunction = {
106
- 'required': function required(item, val) {
107
+ 'required': function required(item, val, intl) {
107
108
  var _a, _b, _c, _d;
108
109
  var vtype = _typeof(val);
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");
110
+ var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.required) || intl({
111
+ id: 'unEmpty'
112
+ }, {
113
+ label: item.label
114
+ });
110
115
  var jude = false;
111
116
  switch (vtype) {
112
117
  case 'string':
@@ -134,10 +139,14 @@ var fixedValidateFunction = {
134
139
  }
135
140
  return jude || error;
136
141
  },
137
- 'maxlength': function maxlength(item, val) {
142
+ 'maxlength': function maxlength(item, val, intl) {
138
143
  var _a, _b, _c, _d, _e, _f;
139
144
  var vtype = _typeof(val);
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);
145
+ var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.maxlength) || intl({
146
+ id: 'maxLength'
147
+ }, {
148
+ len: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.maxlength
149
+ });
141
150
  var jude = false;
142
151
  if (vtype === 'string' || vtype === 'number' && val + 1 > val) {
143
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));
@@ -146,10 +155,14 @@ var fixedValidateFunction = {
146
155
  }
147
156
  return jude || error;
148
157
  },
149
- 'minLength': function minLength(item, val) {
158
+ 'minLength': function minLength(item, val, intl) {
150
159
  var _a, _b, _c, _d, _e, _f;
151
160
  var vtype = _typeof(val);
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);
161
+ var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.minLength) || intl({
162
+ id: 'minLength'
163
+ }, {
164
+ len: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.minLength
165
+ });
153
166
  var jude = false;
154
167
  if (vtype === 'string' || vtype === 'number' && val + 1 > val) {
155
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);
@@ -158,30 +171,42 @@ var fixedValidateFunction = {
158
171
  }
159
172
  return jude || error;
160
173
  },
161
- 'pattern': function pattern(item, val) {
174
+ 'pattern': function pattern(item, val, intl) {
162
175
  var _a, _b, _c, _d;
163
176
  var testReg = (_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.pattern;
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);
177
+ var error = ((_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.pattern) || intl({
178
+ id: 'unRule'
179
+ }, {
180
+ rule: '' + testReg
181
+ });
165
182
  var jude = !val;
166
183
  if (testReg && val && typeof testReg !== 'function') {
167
184
  jude = testReg.test(val);
168
185
  }
169
186
  return jude || error;
170
187
  },
171
- 'min': function min(item, val) {
188
+ 'min': function min(item, val, intl) {
172
189
  var _a, _b, _c, _d, _e, _f, _g, _h;
173
190
  var vtype = _typeof(val);
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);
191
+ var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.min) || intl({
192
+ id: 'minValue'
193
+ }, {
194
+ val: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.min
195
+ });
175
196
  var jude = !val;
176
197
  if (vtype === 'string' || vtype === 'number') {
177
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);
178
199
  }
179
200
  return jude || error;
180
201
  },
181
- 'max': function max(item, val) {
202
+ 'max': function max(item, val, intl) {
182
203
  var _a, _b, _c, _d, _e, _f, _g, _h;
183
204
  var vtype = _typeof(val);
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);
205
+ var error = ((_b = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.max) || intl({
206
+ id: 'maxValue'
207
+ }, {
208
+ val: (_d = (_c = item.rules) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.max
209
+ });
185
210
  var jude = !val;
186
211
  if (vtype === 'string' || vtype === 'number') {
187
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);
@@ -193,7 +218,7 @@ var fixedValidateFunction = {
193
218
  * 表单rules校验方法
194
219
  * @type {validateFunctionType}
195
220
  */
196
- var validate = function validate(item, val) {
221
+ var validate = function validate(item, val, intl) {
197
222
  var _a, _b;
198
223
  var validateObj = (_a = item.rules) === null || _a === void 0 ? void 0 : _a.validate;
199
224
  if (validateObj) {
@@ -202,10 +227,10 @@ var validate = function validate(item, val) {
202
227
  var tempFuc = validateObj[key];
203
228
  var tmsg = '';
204
229
  if (typeof tempFuc === 'function') {
205
- tmsg = tempFuc(item, val);
230
+ tmsg = tempFuc(item, val, intl);
206
231
  if (tmsg === false && messageObj) tmsg = messageObj[key];
207
232
  } else if (!!tempFuc && fixedValidateFunction[key]) {
208
- tmsg = fixedValidateFunction[key](item, val);
233
+ tmsg = fixedValidateFunction[key](item, val, intl);
209
234
  } else if (!tempFuc) {
210
235
  tmsg = true;
211
236
  } else {
@@ -218,6 +243,31 @@ var validate = function validate(item, val) {
218
243
  return false;
219
244
  };
220
245
 
246
+ var en = {
247
+ choseFile: 'Chose File',
248
+ unEmpty: '{label} Cannot be empty',
249
+ maxLength: 'The maximum length cannot be exceeded{len}',
250
+ minLength: 'The minimum length cannot be exceeded{len}',
251
+ unRule: 'The parameter does not comply with the validation rule {rule}',
252
+ minValue: 'The minimum value is {val}',
253
+ maxValue: 'The maximum value is {val}'
254
+ };
255
+
256
+ var zh = {
257
+ choseFile: '选择文件',
258
+ unEmpty: '{label}不能为空',
259
+ maxLength: '最大长度不能超过{len}',
260
+ minLength: '最小长度为{len}',
261
+ unRule: '参数不符合校验规则{rule}',
262
+ minValue: '最小值为{val}',
263
+ maxValue: '最大值为{val}'
264
+ };
265
+
266
+ var localeJson = {
267
+ zh: zh,
268
+ en: en
269
+ };
270
+
221
271
  var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\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: rgba(46, 55, 67, 0.7);\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}";
222
272
  styleInject(css_248z$1);
223
273
 
@@ -233,6 +283,7 @@ var FormFile = function FormFile(props) {
233
283
  buttonLabel = props.buttonLabel,
234
284
  inputProps = props.inputProps,
235
285
  buttonProps = props.buttonProps;
286
+ var intl = useFormatMessage('FormItem', localeJson);
236
287
  /**
237
288
  * 存储文件输入框真实dom
238
289
  * @type {HTMLInputElement}
@@ -282,7 +333,9 @@ var FormFile = function FormFile(props) {
282
333
  }, buttonProps, {
283
334
  onClick: inputFileClick
284
335
  }, {
285
- children: buttonLabel || '选择文件'
336
+ children: buttonLabel || intl({
337
+ id: 'choseFile'
338
+ })
286
339
  })), jsx("input", Object.assign({}, inputProps, {
287
340
  ref: inputFileEl,
288
341
  type: "file",
@@ -366,6 +419,7 @@ var ItemType = function ItemType(props) {
366
419
  backData = props.backData,
367
420
  disabled = props.disabled,
368
421
  change = props.change;
422
+ var intl = useFormatMessage('FormItem', localeJson);
369
423
  var tipsStr = placeholder || "".concat(label);
370
424
  /**
371
425
  * 报错信息
@@ -387,7 +441,7 @@ var ItemType = function ItemType(props) {
387
441
  setErrorMsg: setErrorMsg,
388
442
  setAndValidateValue: setAndValidateValue
389
443
  });
390
- var errorMessage = validate(item, val) || '';
444
+ var errorMessage = validate(item, val, intl) || '';
391
445
  setErrorMsg(errorMessage);
392
446
  };
393
447
  /**
@@ -706,4 +760,4 @@ var FormItem = function FormItem(props) {
706
760
  }));
707
761
  };
708
762
 
709
- export { FormItem as F, validate as v };
763
+ export { FormItem as F, localeJson as l, validate as v };
package/index.js CHANGED
@@ -22,8 +22,8 @@ export { D as Dropdown } from './_verture/index-77f9e0fb.js';
22
22
  export { default as DynamicMultiBox } from './DynamicMultiBox/index.js';
23
23
  export { default as Empty } from './Empty/index.js';
24
24
  export { default as Form } from './Form/index.js';
25
- export { F as FormItem } from './_verture/index-fa8a0124.js';
26
- export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-20780c9a.js';
25
+ export { F as FormItem } from './_verture/index-816522b9.js';
26
+ export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-630bdb73.js';
27
27
  export { default as GlobalContext, changeConfirmLocale, getConfirmLocale } from './GlobalContext/index.js';
28
28
  export { default as Help } from './Help/index.js';
29
29
  export { default as HelperText } from './HelperText/index.js';
@@ -126,7 +126,7 @@ import '@para-ui/icons/Drag';
126
126
  import './_verture/sortable.esm-49896035.js';
127
127
  import '@para-ui/icons/LinkGroup';
128
128
  import './_verture/intl-4a9f1b44.js';
129
- import './_verture/index-e2881a53.js';
129
+ import './_verture/index-65bbd1e4.js';
130
130
  import '@para-ui/icons/Help';
131
131
  import '@para-ui/icons/Application';
132
132
  import 'rc-input-number';
package/locale/en-US.d.ts CHANGED
@@ -64,6 +64,15 @@ declare const _default: {
64
64
  click: string;
65
65
  refresh: string;
66
66
  };
67
+ FormItem: {
68
+ choseFile: string;
69
+ unEmpty: string;
70
+ maxLength: string;
71
+ minLength: string;
72
+ unRule: string;
73
+ minValue: string;
74
+ maxValue: string;
75
+ };
67
76
  Modal: {
68
77
  cancel: string;
69
78
  ok: string;
package/locale/index.d.ts CHANGED
@@ -65,6 +65,15 @@ declare const _default: {
65
65
  click: string;
66
66
  refresh: string;
67
67
  };
68
+ FormItem: {
69
+ choseFile: string;
70
+ unEmpty: string;
71
+ maxLength: string;
72
+ minLength: string;
73
+ unRule: string;
74
+ minValue: string;
75
+ maxValue: string;
76
+ };
68
77
  Modal: {
69
78
  cancel: string;
70
79
  ok: string;
@@ -217,6 +226,15 @@ declare const _default: {
217
226
  click: string;
218
227
  refresh: string;
219
228
  };
229
+ FormItem: {
230
+ choseFile: string;
231
+ unEmpty: string;
232
+ maxLength: string;
233
+ minLength: string;
234
+ unRule: string;
235
+ minValue: string;
236
+ maxValue: string;
237
+ };
220
238
  Modal: {
221
239
  cancel: string;
222
240
  ok: string;
package/locale/index.js CHANGED
@@ -64,6 +64,15 @@ var enUS = {
64
64
  "click": ",Click to ",
65
65
  "refresh": "refresh"
66
66
  },
67
+ "FormItem": {
68
+ "choseFile": "Chose File",
69
+ "unEmpty": "{label} Cannot be empty",
70
+ "maxLength": "The maximum length cannot be exceeded{len}",
71
+ "minLength": "The minimum length cannot be exceeded{len}",
72
+ "unRule": "The parameter does not comply with the validation rule {rule}",
73
+ "minValue": "The minimum value is {val}",
74
+ "maxValue": "The maximum value is {val}"
75
+ },
67
76
  "Modal": {
68
77
  "cancel": "Cancel",
69
78
  "ok": "Ok"
@@ -217,6 +226,15 @@ var zhCN = {
217
226
  "click": ",点击",
218
227
  "refresh": "刷新"
219
228
  },
229
+ "FormItem": {
230
+ "choseFile": "选择文件",
231
+ "unEmpty": "{label}不能为空",
232
+ "maxLength": "最大长度不能超过{len}",
233
+ "minLength": "最小长度为{len}",
234
+ "unRule": "参数不符合校验规则{rule}",
235
+ "minValue": "最小值为{val}",
236
+ "maxValue": "最大值为{val}"
237
+ },
220
238
  "Modal": {
221
239
  "cancel": "取消",
222
240
  "ok": "确定"
package/locale/zh-CN.d.ts CHANGED
@@ -64,6 +64,15 @@ declare const _default: {
64
64
  click: string;
65
65
  refresh: string;
66
66
  };
67
+ FormItem: {
68
+ choseFile: string;
69
+ unEmpty: string;
70
+ maxLength: string;
71
+ minLength: string;
72
+ unRule: string;
73
+ minValue: string;
74
+ maxValue: string;
75
+ };
67
76
  Modal: {
68
77
  cancel: string;
69
78
  ok: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@para-ui/core",
3
3
  "private": false,
4
- "version": "3.0.86",
4
+ "version": "3.0.88",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
7
7
  "description": "Powered by Para FED",
@@ -160,11 +160,8 @@
160
160
  },
161
161
  "dev": {
162
162
  "debug": [
163
- "http://192.168.7.27",
164
- "http://192.168.3.1:10000",
165
- "http://192.168.2.83:10000",
166
163
  "http://10.10.2.48:10000",
167
- "http://10.10.2.252:10000"
164
+ "http://192.168.2.124:20000"
168
165
  ]
169
166
  }
170
167
  }