iglooform 2.5.6 → 2.5.9

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 (79) hide show
  1. package/es/confirmation/index.d.ts +2 -2
  2. package/es/confirmation/index.js +37 -2
  3. package/es/filter/checkBox.d.ts +4 -3
  4. package/es/filter/checkBox.js +31 -7
  5. package/es/filter/index.js +4 -2
  6. package/es/filter/radioBox.d.ts +2 -1
  7. package/es/filter/radioBox.js +24 -3
  8. package/es/form/element/index.js +22 -21
  9. package/es/form/hstep/index.d.ts +17 -0
  10. package/es/form/hstep/index.js +158 -0
  11. package/es/form/hstep/style/index.d.ts +1 -0
  12. package/es/form/hstep/style/index.js +1 -0
  13. package/es/form/hstep/style/index.less +84 -0
  14. package/es/form/hsteps/index.d.ts +19 -0
  15. package/es/form/hsteps/index.js +407 -0
  16. package/es/form/hsteps/style/index.d.ts +1 -0
  17. package/es/form/hsteps/style/index.js +1 -0
  18. package/es/form/hsteps/style/index.less +78 -0
  19. package/es/form/index.js +31 -40
  20. package/es/form/pages/index.js +2 -2
  21. package/es/form/section/index.d.ts +2 -0
  22. package/es/form/section/index.js +70 -10
  23. package/es/form/section/style/index.less +14 -0
  24. package/es/form/step/index.js +15 -10
  25. package/es/form/steps/index.js +27 -15
  26. package/es/form-step-context.d.ts +6 -0
  27. package/es/form-step-context.js +4 -0
  28. package/es/free-form/index.js +24 -38
  29. package/es/input/input-number.js +2 -2
  30. package/es/locale/en-US/messages.json +9 -0
  31. package/es/locale/id-ID/messages.json +9 -0
  32. package/es/locale/th-TH/messages.json +9 -0
  33. package/es/locale/vi-VN/messages.json +9 -0
  34. package/es/locale/zh-CN/messages.json +9 -0
  35. package/es/locale/zh-TW/messages.json +9 -0
  36. package/es/select/style/index.less +1 -0
  37. package/es/types.d.ts +13 -1
  38. package/es/upload-photo/index.js +10 -4
  39. package/es/utils/form-utils.js +84 -1
  40. package/lib/confirmation/index.d.ts +2 -2
  41. package/lib/confirmation/index.js +37 -1
  42. package/lib/filter/checkBox.d.ts +4 -3
  43. package/lib/filter/checkBox.js +31 -7
  44. package/lib/filter/index.js +4 -2
  45. package/lib/filter/radioBox.d.ts +2 -1
  46. package/lib/filter/radioBox.js +24 -3
  47. package/lib/form/element/index.js +22 -21
  48. package/lib/form/hstep/index.d.ts +17 -0
  49. package/lib/form/hstep/index.js +183 -0
  50. package/lib/form/hstep/style/index.d.ts +1 -0
  51. package/lib/form/hstep/style/index.js +3 -0
  52. package/lib/form/hstep/style/index.less +84 -0
  53. package/lib/form/hsteps/index.d.ts +19 -0
  54. package/lib/form/hsteps/index.js +437 -0
  55. package/lib/form/hsteps/style/index.d.ts +1 -0
  56. package/lib/form/hsteps/style/index.js +3 -0
  57. package/lib/form/hsteps/style/index.less +78 -0
  58. package/lib/form/index.js +31 -39
  59. package/lib/form/pages/index.js +2 -2
  60. package/lib/form/section/index.d.ts +2 -0
  61. package/lib/form/section/index.js +72 -8
  62. package/lib/form/section/style/index.less +14 -0
  63. package/lib/form/step/index.js +15 -10
  64. package/lib/form/steps/index.js +27 -14
  65. package/lib/form-step-context.d.ts +6 -0
  66. package/lib/form-step-context.js +16 -0
  67. package/lib/free-form/index.js +23 -37
  68. package/lib/input/input-number.js +2 -2
  69. package/lib/locale/en-US/messages.json +9 -0
  70. package/lib/locale/id-ID/messages.json +9 -0
  71. package/lib/locale/th-TH/messages.json +9 -0
  72. package/lib/locale/vi-VN/messages.json +9 -0
  73. package/lib/locale/zh-CN/messages.json +9 -0
  74. package/lib/locale/zh-TW/messages.json +9 -0
  75. package/lib/select/style/index.less +1 -0
  76. package/lib/types.d.ts +13 -1
  77. package/lib/upload-photo/index.js +10 -4
  78. package/lib/utils/form-utils.js +85 -1
  79. package/package.json +1 -1
@@ -26,6 +26,7 @@
26
26
  "Edit": "编辑",
27
27
  "Error Report": "错误报告",
28
28
  "Filter": "过滤条件",
29
+ "I agree to the Igloo": "",
29
30
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "我承诺上述信息均真实有效,并且物品遗失纯属意外。",
30
31
  "Import": "导入",
31
32
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建议不要选择超过{colMax}个字段,以确保最佳展示效果。",
@@ -37,15 +38,20 @@
37
38
  "No preview for this file. Only support image, video or PDF file.": "此文件不支持预览。仅支持图片、视频和PDF。",
38
39
  "Numbers only, please omit \" \" or \"-\".": "仅数字,请省略“ ”或“-”。",
39
40
  "OK": "确定",
41
+ "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "",
40
42
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "如您对上述填写内容满意,在勾选以下申明后,请继续提交您的理赔申请。",
41
43
  "Optional": "可选",
42
44
  "Other Reason": "其他原因",
43
45
  "Please enter a valid date.": "请输入一个有效的日期。",
44
46
  "Please enter a valid time.": "请输入一个有效的时间。",
47
+ "Please input a date after {date}": "",
48
+ "Please input a date before {date}": "",
49
+ "Please read and agree to Igloo Terms of Use and Privacy Policy": "",
45
50
  "Please select": "请选择",
46
51
  "Please select a file type": "请选择一个文件类型",
47
52
  "Please take a moment to review what you’ve told us above.": "请您仔细审阅以上信息",
48
53
  "Previous": "上一步",
54
+ "Privacy Policy": "",
49
55
  "Processing": "解析中",
50
56
  "Processing progress cannot be updated at the moment. Don’t worry! All your file data are still in progress.": "文件解析中,请耐心等待。",
51
57
  "Quantity of files should be less than {limit}": "文件数量不能超过{limit}",
@@ -56,12 +62,14 @@
56
62
  "Reset All Filters": "重置所有过滤条件",
57
63
  "Result": "结果",
58
64
  "Result: Success {success_num}; Error {fail_num}": "结果:成功 {success_num}; 失败 {fail_num}",
65
+ "Review and Submit": "",
59
66
  "Rows per page": "每页条数",
60
67
  "Search": "搜索",
61
68
  "Searching...": "正在搜索...",
62
69
  "Select All": "全选",
63
70
  "Send OTP": "发送OTP",
64
71
  "Submit": "提交",
72
+ "Terms of Use": "",
65
73
  "The file type is not supported.": "不支持上传该类型的文件。",
66
74
  "There are no options available currently": "当前没有可用的选项",
67
75
  "This Month": "当月",
@@ -69,6 +77,7 @@
69
77
  "Uploading": "上传中",
70
78
  "We support CSV or XLSX files (less than 20M each).": "支持上传20M以内的CSV和XLSX文件",
71
79
  "Yes, Close": "确认,关闭",
80
+ "and": "",
72
81
  "browse": "选择",
73
82
  "or": "或者",
74
83
  "{beginIndex}-{endIndex} of {total}": "{beginIndex}-{endIndex} 总计 {total}",
@@ -26,6 +26,7 @@
26
26
  "Edit": "編輯",
27
27
  "Error Report": "錯誤報告",
28
28
  "Filter": "篩選",
29
+ "I agree to the Igloo": "",
29
30
  "I declare that the statements I have described above are true. I further declare that the loss occured was accidental, without planning or consensus with other parties.": "我聲明我上面描述的陳述是真的。我進一步宣布發生損失是偶然的,沒有規劃或與其他方的共識。",
30
31
  "Import": "導入",
31
32
  "It is recommended to select no more than {colMax} metrics to ensure the default visibility of each column input.": "建議選擇不超過{colMax}指標以確保每個列輸入的默認可見性。",
@@ -37,15 +38,20 @@
37
38
  "No preview for this file. Only support image, video or PDF file.": "不支持預覽此文件。只支持圖像,視頻或PDF文件。",
38
39
  "Numbers only, please omit \" \" or \"-\".": "只有數字,請省略“”或“ - ”。",
39
40
  "OK": "好",
41
+ "Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.": "",
40
42
  "Once you’re happy with the above, and you’ve checked the declaration, please go ahead and submit your claim.": "一旦您對上述內容感到滿意,您已檢查聲明,請繼續並提交您的索賠。",
41
43
  "Optional": "可選項",
42
44
  "Other Reason": "其他原因",
43
45
  "Please enter a valid date.": "請輸入有效的日期。",
44
46
  "Please enter a valid time.": "請輸入有效的時間。",
47
+ "Please input a date after {date}": "",
48
+ "Please input a date before {date}": "",
49
+ "Please read and agree to Igloo Terms of Use and Privacy Policy": "",
45
50
  "Please select": "請選擇",
46
51
  "Please select a file type": "請選擇文件類型",
47
52
  "Please take a moment to review what you’ve told us above.": "請花點時間查看您在上面提供給我們的內容。",
48
53
  "Previous": "以前的",
54
+ "Privacy Policy": "",
49
55
  "Processing": "處理中",
50
56
  "Processing progress cannot be updated at the moment. Don’t worry! All your file data are still in progress.": "此刻無法更新處理進度。別擔心!您的所有文件數據仍在進行中。",
51
57
  "Quantity of files should be less than {limit}": "文件的數量應小於{limit}",
@@ -56,12 +62,14 @@
56
62
  "Reset All Filters": "重置所有過濾器",
57
63
  "Result": "結果",
58
64
  "Result: Success {success_num}; Error {fail_num}": "結果:成功{success_num};錯誤{fail_num}",
65
+ "Review and Submit": "",
59
66
  "Rows per page": "每頁行數",
60
67
  "Search": "檢索",
61
68
  "Searching...": "正在檢索...",
62
69
  "Select All": "全選",
63
70
  "Send OTP": "發送OTP.",
64
71
  "Submit": "提交",
72
+ "Terms of Use": "",
65
73
  "The file type is not supported.": "不支持文件類型。",
66
74
  "There are no options available currently": "當前沒有可用的選項",
67
75
  "This Month": "本月",
@@ -69,6 +77,7 @@
69
77
  "Uploading": "上傳",
70
78
  "We support CSV or XLSX files (less than 20M each).": "我們支持CSV或XLSX文件(小於20M)。",
71
79
  "Yes, Close": "是的,關閉",
80
+ "and": "",
72
81
  "browse": "瀏覽",
73
82
  "or": "或者",
74
83
  "{beginIndex}-{endIndex} of {total}": "{beginIndex} - {endIndex} 從 {total}",
@@ -237,6 +237,7 @@
237
237
  position: absolute;
238
238
  top: 0;
239
239
  right: 0;
240
+ margin-inline-end: 0;
240
241
  }
241
242
 
242
243
  .igloo-select-arrow-active {
package/lib/types.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface FormBasicConfig {
27
27
  onFirstModified?: () => any;
28
28
  uploadApi?: string;
29
29
  selectDatasourceApi?: string;
30
+ stepDirection?: 'vertical' | 'horizontal';
30
31
  }
31
32
  export declare type FormItemAssert = {
32
33
  field: NamePath;
@@ -52,7 +53,7 @@ export interface FormItemExtraConfig extends FormItemProps {
52
53
  md?: number;
53
54
  xs?: number;
54
55
  span?: number;
55
- areaCode?: number | string;
56
+ areaCode?: number | string | (number | string)[];
56
57
  phoneNumber?: number | string;
57
58
  mergeRules?: boolean;
58
59
  dependencies?: NamePath[];
@@ -95,6 +96,17 @@ export interface FormItemExtraConfig extends FormItemProps {
95
96
  currentStep?: number;
96
97
  subscribedFields?: FormItemName[];
97
98
  description?: string | React.ReactNode;
99
+ dateLimitationType?: 'relative' | 'absolute';
100
+ absoluteRangeStart?: number;
101
+ absoluteRangeEnd?: number;
102
+ relativeRangeStart?: {
103
+ type: 'day' | 'month' | 'year';
104
+ quantity: number;
105
+ };
106
+ relativeRangeEnd?: {
107
+ type: 'day' | 'month' | 'year';
108
+ quantity: number;
109
+ };
98
110
  [key: string]: any;
99
111
  }
100
112
  export interface FormItemConfig extends FormItemExtraConfig {
@@ -117,22 +117,28 @@ var getFileType = /*#__PURE__*/function () {
117
117
  while (1) {
118
118
  switch (_context.prev = _context.next) {
119
119
  case 0:
120
- _context.next = 2;
120
+ _context.prev = 0;
121
+ _context.next = 3;
121
122
  return fetch(src, {
122
123
  cache: 'force-cache'
123
124
  });
124
125
 
125
- case 2:
126
+ case 3:
126
127
  r = _context.sent;
127
128
  contentType = r.headers.get('content-type');
128
129
  return _context.abrupt("return", ClassifyType(contentType));
129
130
 
130
- case 5:
131
+ case 8:
132
+ _context.prev = 8;
133
+ _context.t0 = _context["catch"](0);
134
+ return _context.abrupt("return", 'unknown');
135
+
136
+ case 11:
131
137
  case "end":
132
138
  return _context.stop();
133
139
  }
134
140
  }
135
- }, _callee);
141
+ }, _callee, null, [[0, 8]]);
136
142
  }));
137
143
 
138
144
  return function getFileType(_x) {
@@ -13,7 +13,9 @@ var _typography = _interopRequireDefault(require("../typography"));
13
13
 
14
14
  var _formattedMessage = _interopRequireDefault(require("../locale/formatted-message"));
15
15
 
16
- var _excluded = ["type", "name", "required", "requiredAsserts", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater", "antdDependencies"],
16
+ var _moment = _interopRequireDefault(require("moment"));
17
+
18
+ var _excluded = ["type", "name", "required", "requiredAsserts", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater", "antdDependencies", "dateLimitationType", "absoluteRangeEnd", "absoluteRangeStart", "relativeRangeStart", "relativeRangeEnd"],
17
19
  _excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
18
20
 
19
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -172,6 +174,11 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
172
174
  shouldRender = config.shouldRender,
173
175
  valueFormater = config.valueFormater,
174
176
  antdDependencies = config.antdDependencies,
177
+ dateLimitationType = config.dateLimitationType,
178
+ absoluteRangeEnd = config.absoluteRangeEnd,
179
+ absoluteRangeStart = config.absoluteRangeStart,
180
+ relativeRangeStart = config.relativeRangeStart,
181
+ relativeRangeEnd = config.relativeRangeEnd,
175
182
  rest = _objectWithoutProperties(config, _excluded);
176
183
 
177
184
  (0, _invariant.default)(nameProp || type === 'Divider' || type === 'Section' || type === 'Typography' || !type, "name property is required for form item config (type: ".concat(type, ")"));
@@ -231,6 +238,83 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
231
238
  elementProps[key.replace('element-', '')] = rest[key];
232
239
  });
233
240
  elementProps.disabled = calcDisabled(disabled, form) || copiedValue.disabled || selectedValue.disabled;
241
+
242
+ if (dateLimitationType) {
243
+ if (['DatePicker', 'BuddhistDatePicker'].includes(type)) {
244
+ var rangeStart = 0;
245
+ var rangeEnd = Number.MAX_SAFE_INTEGER;
246
+
247
+ if (dateLimitationType === 'absolute' && absoluteRangeStart) {
248
+ rangeStart = +(0, _moment.default)(absoluteRangeStart).startOf('day');
249
+ }
250
+
251
+ if (dateLimitationType === 'relative' && (relativeRangeStart === null || relativeRangeStart === void 0 ? void 0 : relativeRangeStart.quantity) !== undefined) {
252
+ rangeStart = +(0, _moment.default)().add(relativeRangeStart.quantity, relativeRangeStart.type).startOf('day');
253
+ }
254
+
255
+ if (dateLimitationType === 'absolute' && absoluteRangeEnd) {
256
+ rangeEnd = +(0, _moment.default)(absoluteRangeEnd).endOf('day');
257
+ }
258
+
259
+ if (dateLimitationType === 'relative' && (relativeRangeEnd === null || relativeRangeEnd === void 0 ? void 0 : relativeRangeEnd.quantity) !== undefined) {
260
+ rangeEnd = +(0, _moment.default)().add(relativeRangeEnd.quantity, relativeRangeEnd.type).endOf('day');
261
+ }
262
+
263
+ elementProps.disabledDate = function (current) {
264
+ return +current < rangeStart || +current > (rangeEnd || Number.MAX_SAFE_INTEGER);
265
+ };
266
+ }
267
+
268
+ if (type === 'InputDate') {
269
+ var _rangeStart;
270
+
271
+ var _rangeEnd;
272
+
273
+ if (dateLimitationType === 'absolute' && absoluteRangeStart) {
274
+ _rangeStart = (0, _moment.default)(absoluteRangeStart).startOf('day');
275
+ }
276
+
277
+ if (dateLimitationType === 'relative' && (relativeRangeStart === null || relativeRangeStart === void 0 ? void 0 : relativeRangeStart.quantity) !== undefined) {
278
+ _rangeStart = (0, _moment.default)().add(relativeRangeStart.quantity, relativeRangeStart.type).startOf('day');
279
+ }
280
+
281
+ if (dateLimitationType === 'absolute' && absoluteRangeEnd) {
282
+ _rangeEnd = (0, _moment.default)(absoluteRangeEnd).endOf('day');
283
+ }
284
+
285
+ if (dateLimitationType === 'relative' && (relativeRangeEnd === null || relativeRangeEnd === void 0 ? void 0 : relativeRangeEnd.quantity) !== undefined) {
286
+ _rangeEnd = (0, _moment.default)().add(relativeRangeEnd.quantity, relativeRangeEnd.type).endOf('day');
287
+ }
288
+
289
+ rules.push({
290
+ validator: function validator(_, date) {
291
+ var trimedDate = date.replaceAll(/\s/g, '');
292
+ var format = elementProps.format ? elementProps.format.replaceAll(/\s/g, '') : 'DD/MM/YYYY';
293
+
294
+ if (_rangeStart && (0, _moment.default)(trimedDate, format) < _rangeStart) {
295
+ return Promise.reject((0, _jsxRuntime.jsx)(_formattedMessage.default, {
296
+ id: "Please input a date after {date}",
297
+ values: {
298
+ date: _rangeStart.format(format)
299
+ }
300
+ }));
301
+ }
302
+
303
+ if (_rangeEnd && (0, _moment.default)(trimedDate, format) > _rangeEnd) {
304
+ return Promise.reject((0, _jsxRuntime.jsx)(_formattedMessage.default, {
305
+ id: "Please input a date before {date}",
306
+ values: {
307
+ date: _rangeEnd.format(format)
308
+ }
309
+ }));
310
+ }
311
+
312
+ return Promise.resolve();
313
+ }
314
+ });
315
+ }
316
+ }
317
+
234
318
  return {
235
319
  colProps: {
236
320
  span: extraFullRow && fullRow === undefined || fullRow || extraHalfRow && halfRow === undefined || halfRow ? 24 : span || extraSpan || 12,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.5.6",
3
+ "version": "2.5.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",