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/es/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 {
@@ -84,22 +84,28 @@ var getFileType = /*#__PURE__*/function () {
84
84
  while (1) {
85
85
  switch (_context.prev = _context.next) {
86
86
  case 0:
87
- _context.next = 2;
87
+ _context.prev = 0;
88
+ _context.next = 3;
88
89
  return fetch(src, {
89
90
  cache: 'force-cache'
90
91
  });
91
92
 
92
- case 2:
93
+ case 3:
93
94
  r = _context.sent;
94
95
  contentType = r.headers.get('content-type');
95
96
  return _context.abrupt("return", ClassifyType(contentType));
96
97
 
97
- case 5:
98
+ case 8:
99
+ _context.prev = 8;
100
+ _context.t0 = _context["catch"](0);
101
+ return _context.abrupt("return", 'unknown');
102
+
103
+ case 11:
98
104
  case "end":
99
105
  return _context.stop();
100
106
  }
101
107
  }
102
- }, _callee);
108
+ }, _callee, null, [[0, 8]]);
103
109
  }));
104
110
 
105
111
  return function getFileType(_x) {
@@ -1,4 +1,4 @@
1
- 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"],
1
+ 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"],
2
2
  _excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
3
3
 
4
4
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
@@ -29,6 +29,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
29
  import invariant from 'invariant';
30
30
  import Typography from '../typography';
31
31
  import FormattedMessage from '../locale/formatted-message';
32
+ import moment from 'moment';
32
33
  export var calcNamePath = function calcNamePath(parentName, name) {
33
34
  var names = [];
34
35
 
@@ -154,6 +155,11 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
154
155
  shouldRender = config.shouldRender,
155
156
  valueFormater = config.valueFormater,
156
157
  antdDependencies = config.antdDependencies,
158
+ dateLimitationType = config.dateLimitationType,
159
+ absoluteRangeEnd = config.absoluteRangeEnd,
160
+ absoluteRangeStart = config.absoluteRangeStart,
161
+ relativeRangeStart = config.relativeRangeStart,
162
+ relativeRangeEnd = config.relativeRangeEnd,
157
163
  rest = _objectWithoutProperties(config, _excluded);
158
164
 
159
165
  invariant(nameProp || type === 'Divider' || type === 'Section' || type === 'Typography' || !type, "name property is required for form item config (type: ".concat(type, ")"));
@@ -213,6 +219,83 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
213
219
  elementProps[key.replace('element-', '')] = rest[key];
214
220
  });
215
221
  elementProps.disabled = calcDisabled(disabled, form) || copiedValue.disabled || selectedValue.disabled;
222
+
223
+ if (dateLimitationType) {
224
+ if (['DatePicker', 'BuddhistDatePicker'].includes(type)) {
225
+ var rangeStart = 0;
226
+ var rangeEnd = Number.MAX_SAFE_INTEGER;
227
+
228
+ if (dateLimitationType === 'absolute' && absoluteRangeStart) {
229
+ rangeStart = +moment(absoluteRangeStart).startOf('day');
230
+ }
231
+
232
+ if (dateLimitationType === 'relative' && (relativeRangeStart === null || relativeRangeStart === void 0 ? void 0 : relativeRangeStart.quantity) !== undefined) {
233
+ rangeStart = +moment().add(relativeRangeStart.quantity, relativeRangeStart.type).startOf('day');
234
+ }
235
+
236
+ if (dateLimitationType === 'absolute' && absoluteRangeEnd) {
237
+ rangeEnd = +moment(absoluteRangeEnd).endOf('day');
238
+ }
239
+
240
+ if (dateLimitationType === 'relative' && (relativeRangeEnd === null || relativeRangeEnd === void 0 ? void 0 : relativeRangeEnd.quantity) !== undefined) {
241
+ rangeEnd = +moment().add(relativeRangeEnd.quantity, relativeRangeEnd.type).endOf('day');
242
+ }
243
+
244
+ elementProps.disabledDate = function (current) {
245
+ return +current < rangeStart || +current > (rangeEnd || Number.MAX_SAFE_INTEGER);
246
+ };
247
+ }
248
+
249
+ if (type === 'InputDate') {
250
+ var _rangeStart;
251
+
252
+ var _rangeEnd;
253
+
254
+ if (dateLimitationType === 'absolute' && absoluteRangeStart) {
255
+ _rangeStart = moment(absoluteRangeStart).startOf('day');
256
+ }
257
+
258
+ if (dateLimitationType === 'relative' && (relativeRangeStart === null || relativeRangeStart === void 0 ? void 0 : relativeRangeStart.quantity) !== undefined) {
259
+ _rangeStart = moment().add(relativeRangeStart.quantity, relativeRangeStart.type).startOf('day');
260
+ }
261
+
262
+ if (dateLimitationType === 'absolute' && absoluteRangeEnd) {
263
+ _rangeEnd = moment(absoluteRangeEnd).endOf('day');
264
+ }
265
+
266
+ if (dateLimitationType === 'relative' && (relativeRangeEnd === null || relativeRangeEnd === void 0 ? void 0 : relativeRangeEnd.quantity) !== undefined) {
267
+ _rangeEnd = moment().add(relativeRangeEnd.quantity, relativeRangeEnd.type).endOf('day');
268
+ }
269
+
270
+ rules.push({
271
+ validator: function validator(_, date) {
272
+ var trimedDate = date.replaceAll(/\s/g, '');
273
+ var format = elementProps.format ? elementProps.format.replaceAll(/\s/g, '') : 'DD/MM/YYYY';
274
+
275
+ if (_rangeStart && moment(trimedDate, format) < _rangeStart) {
276
+ return Promise.reject(_jsx(FormattedMessage, {
277
+ id: "Please input a date after {date}",
278
+ values: {
279
+ date: _rangeStart.format(format)
280
+ }
281
+ }));
282
+ }
283
+
284
+ if (_rangeEnd && moment(trimedDate, format) > _rangeEnd) {
285
+ return Promise.reject(_jsx(FormattedMessage, {
286
+ id: "Please input a date before {date}",
287
+ values: {
288
+ date: _rangeEnd.format(format)
289
+ }
290
+ }));
291
+ }
292
+
293
+ return Promise.resolve();
294
+ }
295
+ });
296
+ }
297
+ }
298
+
216
299
  return {
217
300
  colProps: {
218
301
  span: extraFullRow && fullRow === undefined || fullRow || extraHalfRow && halfRow === undefined || halfRow ? 24 : span || extraSpan || 12,
@@ -1,9 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { FC } from '../types';
3
- interface ConfirmationProps {
3
+ export interface ConfirmationProps {
4
4
  onChange?: Function;
5
5
  value?: boolean;
6
- message: ReactNode;
6
+ message?: ReactNode;
7
7
  modalContent?: ReactNode;
8
8
  modalTitle?: ReactNode;
9
9
  okText?: ReactNode;
@@ -15,6 +15,8 @@ var _typography = _interopRequireDefault(require("../typography"));
15
15
 
16
16
  var _checkbox = _interopRequireDefault(require("../checkbox"));
17
17
 
18
+ var _button = _interopRequireDefault(require("../button"));
19
+
18
20
  var _localeContext = _interopRequireDefault(require("../locale/locale-context"));
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -100,7 +102,41 @@ var Confirmation = function Confirmation(_ref) {
100
102
  cursor: 'pointer',
101
103
  marginLeft: 8
102
104
  },
103
- children: message
105
+ children: message || (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
106
+ children: [formatMessage({
107
+ id: 'I agree to the Igloo'
108
+ }), (0, _jsxRuntime.jsx)(_button.default, {
109
+ type: "link",
110
+ href: "https://contents.iglooinsure.com/termsofservice",
111
+ target: '_blank',
112
+ style: {
113
+ margin: '0 4px',
114
+ lineHeight: 'inherit'
115
+ },
116
+ onClick: function onClick(e) {
117
+ return e.stopPropagation();
118
+ },
119
+ children: formatMessage({
120
+ id: 'Terms of Use'
121
+ })
122
+ }), formatMessage({
123
+ id: 'and'
124
+ }), (0, _jsxRuntime.jsx)(_button.default, {
125
+ type: "link",
126
+ href: "https://contents.iglooinsure.com/privacypolicy",
127
+ style: {
128
+ margin: '0 4px',
129
+ lineHeight: 'inherit'
130
+ },
131
+ target: '_blank',
132
+ onClick: function onClick(e) {
133
+ return e.stopPropagation();
134
+ },
135
+ children: formatMessage({
136
+ id: 'Privacy Policy'
137
+ })
138
+ })]
139
+ })
104
140
  }), modalContent && (0, _jsxRuntime.jsx)(_modal.default, {
105
141
  title: modalTitle,
106
142
  visible: visible,
@@ -1,11 +1,12 @@
1
- declare const CratetCheckBoxFilter: (props: {
1
+ declare const CreateCheckBoxFilter: (props: {
2
2
  title: any;
3
3
  configList: any[];
4
4
  optionKey: string;
5
5
  allSelected: any[];
6
- valueConfirm: any;
6
+ handleOptionsChange: any;
7
7
  chooseed?: string[];
8
8
  onChange?: any;
9
9
  disabled?: any[];
10
+ setConfirmValue?: any;
10
11
  }) => JSX.Element;
11
- export default CratetCheckBoxFilter;
12
+ export default CreateCheckBoxFilter;
@@ -31,6 +31,12 @@ var _typography = _interopRequireDefault(require("../typography"));
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
 
34
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
+
36
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
+
38
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
+
34
40
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
41
 
36
42
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -56,7 +62,7 @@ function handleFilterDisable() {
56
62
  });
57
63
  }
58
64
 
59
- var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
65
+ var CreateCheckBoxFilter = function CreateCheckBoxFilter(props) {
60
66
  var _useContext = (0, _react.useContext)(_locale.LocaleContext),
61
67
  formatMessage = _useContext.formatMessage;
62
68
 
@@ -70,8 +76,10 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
70
76
  chooseed = _props$chooseed === void 0 ? [] : _props$chooseed,
71
77
  disabled = props.disabled,
72
78
  _onChange = props.onChange,
73
- _props$valueConfirm = props.valueConfirm,
74
- valueConfirm = _props$valueConfirm === void 0 ? function () {} : _props$valueConfirm;
79
+ _props$setConfirmValu = props.setConfirmValue,
80
+ setConfirmValue = _props$setConfirmValu === void 0 ? function () {} : _props$setConfirmValu,
81
+ _props$handleOptionsC = props.handleOptionsChange,
82
+ handleOptionsChange = _props$handleOptionsC === void 0 ? function () {} : _props$handleOptionsC;
75
83
  var timeKey = new Date();
76
84
 
77
85
  var _useState = (0, _react.useState)(false),
@@ -88,6 +96,22 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
88
96
  setAllChoose(false);
89
97
  }
90
98
  }, [chooseed.length, allSelected]);
99
+ (0, _react.useEffect)(function () {
100
+ var filterDisabled = chooseed.filter(function (e) {
101
+ return !(disabled === null || disabled === void 0 ? void 0 : disabled.includes(e));
102
+ });
103
+
104
+ if (filterDisabled.length !== chooseed.length) {
105
+ handleOptionsChange({
106
+ type: optionKey,
107
+ value: filterDisabled
108
+ });
109
+ setConfirmValue(function (old) {
110
+ return _objectSpread(_objectSpread({}, old), {}, _defineProperty({}, optionKey, filterDisabled));
111
+ });
112
+ typeof _onChange === 'function' && _onChange(filterDisabled);
113
+ }
114
+ }, [disabled]);
91
115
  return (0, _jsxRuntime.jsxs)("div", {
92
116
  className: "igloo-form-filter-drop-down-container-content-group",
93
117
  children: [(0, _jsxRuntime.jsxs)("div", {
@@ -99,7 +123,7 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
99
123
  className: "igloo-form-filter-drop-down-container-content-group-title-action",
100
124
  onClick: function onClick() {
101
125
  typeof _onChange === 'function' && _onChange([]);
102
- valueConfirm({
126
+ handleOptionsChange({
103
127
  type: optionKey,
104
128
  value: []
105
129
  });
@@ -115,7 +139,7 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
115
139
  className: "igloo-form-filter-drop-down-container-content-group-title-action",
116
140
  onClick: function onClick() {
117
141
  typeof _onChange === 'function' && _onChange(nowValidList);
118
- valueConfirm({
142
+ handleOptionsChange({
119
143
  type: optionKey,
120
144
  value: nowValidList
121
145
  });
@@ -135,7 +159,7 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
135
159
  },
136
160
  onChange: function onChange(e) {
137
161
  typeof _onChange === 'function' && _onChange(e);
138
- valueConfirm({
162
+ handleOptionsChange({
139
163
  type: optionKey,
140
164
  value: e
141
165
  });
@@ -164,5 +188,5 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
164
188
  }, optionKey);
165
189
  };
166
190
 
167
- var _default = CratetCheckBoxFilter;
191
+ var _default = CreateCheckBoxFilter;
168
192
  exports.default = _default;
@@ -720,7 +720,8 @@ var FilterComponent = function FilterComponent(props) {
720
720
  allSelected: optionsAllSelected[key],
721
721
  chooseed: optionsChanged[key],
722
722
  disabled: disabled,
723
- valueConfirm: dispatchOptionsChange,
723
+ handleOptionsChange: dispatchOptionsChange,
724
+ setConfirmValue: setConfimed,
724
725
  onChange: onChangeProps
725
726
  }, key);
726
727
 
@@ -732,7 +733,8 @@ var FilterComponent = function FilterComponent(props) {
732
733
  optionKey: key,
733
734
  chooseed: optionsChanged[key],
734
735
  disabled: disabled,
735
- valueConfirm: dispatchOptionsChange,
736
+ handleOptionsChange: dispatchOptionsChange,
737
+ setConfirmValue: setConfimed,
736
738
  onChange: onChangeProps
737
739
  }, key);
738
740
  }
@@ -2,7 +2,8 @@ declare type IRadioBoxProps = {
2
2
  title: any;
3
3
  configList: any[];
4
4
  optionKey: string;
5
- valueConfirm: any;
5
+ handleOptionsChange: any;
6
+ setConfirmValue: any;
6
7
  chooseed?: string[];
7
8
  disabled?: any[];
8
9
  onChange?: any;
@@ -25,16 +25,37 @@ var _jsxRuntime = require("react/jsx-runtime");
25
25
 
26
26
  var _typography = _interopRequireDefault(require("../typography"));
27
27
 
28
+ var _react = require("react");
29
+
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
31
 
32
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
33
+
34
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
35
+
36
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
+
30
38
  var CreateRadioBoxFilter = function CreateRadioBoxFilter(props) {
31
39
  var optionKey = props.optionKey,
32
40
  title = props.title,
33
41
  configList = props.configList,
34
42
  disabled = props.disabled,
35
- valueConfirm = props.valueConfirm,
43
+ handleOptionsChange = props.handleOptionsChange,
44
+ setConfirmValue = props.setConfirmValue,
36
45
  chooseed = props.chooseed,
37
46
  _onChange = props.onChange;
47
+ (0, _react.useEffect)(function () {
48
+ if (disabled === null || disabled === void 0 ? void 0 : disabled.includes(chooseed)) {
49
+ typeof _onChange === 'function' && _onChange(undefined);
50
+ handleOptionsChange({
51
+ type: optionKey,
52
+ value: undefined
53
+ });
54
+ setConfirmValue(function (old) {
55
+ return _objectSpread(_objectSpread({}, old), {}, _defineProperty({}, optionKey, undefined));
56
+ });
57
+ }
58
+ }, [disabled]);
38
59
  return (0, _jsxRuntime.jsxs)("div", {
39
60
  className: "igloo-form-filter-drop-down-container-content-group",
40
61
  children: [(0, _jsxRuntime.jsx)("div", {
@@ -44,10 +65,10 @@ var CreateRadioBoxFilter = function CreateRadioBoxFilter(props) {
44
65
  children: title
45
66
  })
46
67
  }), (0, _jsxRuntime.jsx)(_radio.default.Group, {
47
- value: chooseed,
68
+ value: (disabled === null || disabled === void 0 ? void 0 : disabled.includes(chooseed)) ? undefined : chooseed,
48
69
  onChange: function onChange(e) {
49
70
  typeof _onChange === 'function' && _onChange(e.target.value);
50
- valueConfirm({
71
+ handleOptionsChange({
51
72
  type: optionKey,
52
73
  value: e.target.value
53
74
  });
@@ -180,26 +180,6 @@ var Element = function Element(_ref) {
180
180
  var _useBreakpoint = useBreakpoint(),
181
181
  md = _useBreakpoint.md;
182
182
 
183
- if (type === 'Section') {
184
- return (0, _jsxRuntime.jsx)(_section.default, {
185
- parentName: parentName,
186
- config: config,
187
- preview: preview,
188
- disabled: disabled,
189
- setShowStepButton: setShowStepButton
190
- });
191
- }
192
-
193
- if (type === 'AddableSection') {
194
- return (0, _jsxRuntime.jsx)(_addableSection.default, {
195
- parentName: parentName,
196
- config: config,
197
- preview: preview,
198
- disabled: disabled,
199
- setShowStepButton: setShowStepButton
200
- });
201
- }
202
-
203
183
  var _calcFormItemProps = (0, _formUtils.calcFormItemProps)(config, _objectSpread(_objectSpread({}, extraConfig), {}, {
204
184
  requiredMark: requiredMark
205
185
  }), form, parentName),
@@ -264,7 +244,28 @@ var Element = function Element(_ref) {
264
244
  name: formItemProps.name,
265
245
  value: formItemProps.initialValue
266
246
  }]);
267
- }, [formItemProps.initialValue]); //这里要想一下有没有更优雅的实现方式
247
+ }, [formItemProps.initialValue]);
248
+
249
+ if (type === 'Section') {
250
+ return (0, _jsxRuntime.jsx)(_section.default, {
251
+ parentName: parentName,
252
+ config: config,
253
+ preview: preview,
254
+ disabled: disabled,
255
+ setShowStepButton: setShowStepButton
256
+ });
257
+ }
258
+
259
+ if (type === 'AddableSection') {
260
+ return (0, _jsxRuntime.jsx)(_addableSection.default, {
261
+ parentName: parentName,
262
+ config: config,
263
+ preview: preview,
264
+ disabled: disabled,
265
+ setShowStepButton: setShowStepButton
266
+ });
267
+ } //这里要想一下有没有更优雅的实现方式
268
+
268
269
 
269
270
  if (withoutForm) {
270
271
  var hideWhenPreview = elementProps.hideWhenPreview,
@@ -0,0 +1,17 @@
1
+ import { FC } from 'react';
2
+ import { FormItemConfig, FormItemName } from '../../types';
3
+ import './style/index.less';
4
+ export interface StepProps {
5
+ parentName?: FormItemName;
6
+ config: FormItemConfig;
7
+ edit: boolean;
8
+ preview: boolean;
9
+ index: number;
10
+ total: number;
11
+ handleNext(): void;
12
+ handleEdit(index: number): void;
13
+ showLastIndex?: boolean;
14
+ shouldScroll: boolean;
15
+ }
16
+ declare const Step: FC<StepProps>;
17
+ export default Step;