iglooform 2.4.8 → 2.4.12

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 (258) hide show
  1. package/es/admin-upload/float.js +25 -35
  2. package/es/admin-upload/index.d.ts +2 -0
  3. package/es/admin-upload/index.js +43 -36
  4. package/es/admin-upload/job-list.js +85 -115
  5. package/es/admin-upload/modal.js +19 -26
  6. package/es/alert-message/index.js +11 -9
  7. package/es/amount/index.js +10 -5
  8. package/es/back-top/index.js +14 -10
  9. package/es/button/index.js +23 -28
  10. package/es/button/style/index.less +23 -19
  11. package/es/card-detail/card-group.js +16 -22
  12. package/es/card-detail/card-item.js +16 -21
  13. package/es/card-detail/card-page.js +11 -15
  14. package/es/card-detail/card.js +24 -24
  15. package/es/card-detail/utils.js +6 -7
  16. package/es/checkbox/index.js +23 -22
  17. package/es/claim-list/index.js +53 -70
  18. package/es/confirmation/index.js +7 -9
  19. package/es/date-picker/buddhist.js +3 -3
  20. package/es/date-picker/index.js +10 -4
  21. package/es/declaration/index.js +16 -13
  22. package/es/detail-panel/index.js +67 -83
  23. package/es/documents/index.js +6 -8
  24. package/es/example/index.js +9 -11
  25. package/es/filter/checkBox.js +33 -45
  26. package/es/filter/customize.js +3 -4
  27. package/es/filter/index.d.ts +1 -0
  28. package/es/filter/index.js +88 -112
  29. package/es/filter/radioBox.js +23 -31
  30. package/es/filter/rangePicker.js +43 -59
  31. package/es/form/addable-section/index.d.ts +19 -0
  32. package/es/form/addable-section/index.js +211 -0
  33. package/es/form/addable-section/style/index.d.ts +1 -0
  34. package/es/form/addable-section/style/index.js +1 -0
  35. package/es/form/addable-section/style/index.less +22 -0
  36. package/es/form/divider/index.js +7 -1
  37. package/es/form/element/index.js +58 -47
  38. package/es/form/element/style/index.less +9 -0
  39. package/es/form/index.js +16 -17
  40. package/es/form/login/index.js +15 -20
  41. package/es/form/page/index.js +18 -24
  42. package/es/form/page/style/index.less +1 -1
  43. package/es/form/pages/index.js +23 -32
  44. package/es/form/pages/style/index.less +3 -1
  45. package/es/form/render/index.js +1 -1
  46. package/es/form/section/index.js +14 -17
  47. package/es/form/step/index.js +31 -42
  48. package/es/form/steps/index.js +8 -11
  49. package/es/{form/context.d.ts → form-context.d.ts} +1 -0
  50. package/es/{form/context.js → form-context.js} +0 -0
  51. package/es/free-form/addable-section/index.d.ts +18 -0
  52. package/es/free-form/addable-section/index.js +286 -0
  53. package/es/free-form/addable-section/style/index.d.ts +1 -0
  54. package/es/free-form/addable-section/style/index.js +1 -0
  55. package/es/free-form/addable-section/style/index.less +22 -0
  56. package/es/free-form/element/index.js +43 -41
  57. package/es/free-form/element/style/index.less +12 -2
  58. package/es/free-form/index.d.ts +5 -1
  59. package/es/free-form/index.js +17 -17
  60. package/es/free-form/page/index.js +36 -46
  61. package/es/free-form/page/style/index.less +3 -1
  62. package/es/free-form/pages/index.js +8 -10
  63. package/es/free-form/section/index.js +20 -22
  64. package/es/free-form/section/style/index.less +4 -0
  65. package/es/free-form/step/index.js +37 -47
  66. package/es/free-form/steps/index.js +8 -10
  67. package/es/global-message/index.js +1 -1
  68. package/es/home-menu/index.js +52 -71
  69. package/es/index.d.ts +1 -0
  70. package/es/index.js +2 -1
  71. package/es/input/amount.js +10 -5
  72. package/es/input/credit-card.js +7 -1
  73. package/es/input/email.js +8 -1
  74. package/es/input/expiry-date.js +14 -18
  75. package/es/input/input-date.js +12 -16
  76. package/es/input/input-number.js +9 -2
  77. package/es/input/input.js +9 -2
  78. package/es/input/otp.js +17 -15
  79. package/es/input/password.js +12 -6
  80. package/es/input/phone-number.js +6 -8
  81. package/es/input/style/index.less +9 -1
  82. package/es/input/text-area.js +14 -10
  83. package/es/layout/defaultFooter.js +60 -82
  84. package/es/layout/defaultHeader.js +11 -15
  85. package/es/layout/footer.js +108 -148
  86. package/es/layout/header.js +51 -60
  87. package/es/layout/index.js +16 -12
  88. package/es/locale/en-US/messages.json +2 -0
  89. package/es/locale/id-ID/messages.json +2 -0
  90. package/es/locale/locale-provider.js +8 -10
  91. package/es/locale/th-TH/messages.json +2 -0
  92. package/es/locale/vi-VN/messages.json +2 -0
  93. package/es/locale/zh-CN/messages.json +2 -0
  94. package/es/login-page/index.js +30 -42
  95. package/es/media/index.js +20 -27
  96. package/es/media/media.js +9 -12
  97. package/es/media/preview.js +8 -10
  98. package/es/mobile-insurer-detail/index.js +74 -91
  99. package/es/mobile-insurer-list/index.js +34 -38
  100. package/es/modal/index.d.ts +4 -3
  101. package/es/modal/index.js +25 -27
  102. package/es/modal/style/index.less +24 -5
  103. package/es/platform/platform-card/index.js +9 -12
  104. package/es/platform/switch-platform/index.js +24 -32
  105. package/es/policy-list/index.js +11 -14
  106. package/es/policy-list/policy-card.js +119 -153
  107. package/es/radio/index.js +33 -35
  108. package/es/select/attached-select.js +31 -34
  109. package/es/select/select.js +12 -8
  110. package/es/select/style/index.less +1 -1
  111. package/es/select/time-select.js +12 -16
  112. package/es/status-box/index.js +8 -10
  113. package/es/table/index.js +72 -96
  114. package/es/tabs/index.js +7 -1
  115. package/es/types.d.ts +4 -2
  116. package/es/typography/index.js +6 -8
  117. package/es/upload/index.d.ts +2 -1
  118. package/es/upload/index.js +169 -143
  119. package/es/upload-photo/index.d.ts +2 -1
  120. package/es/upload-photo/index.js +170 -142
  121. package/es/upload-photo/media.js +3 -4
  122. package/es/upload-preview/index.js +9 -12
  123. package/es/upload-preview/media.js +12 -16
  124. package/es/utils/form-utils.js +49 -36
  125. package/lib/admin-upload/float.js +25 -35
  126. package/lib/admin-upload/index.d.ts +2 -0
  127. package/lib/admin-upload/index.js +43 -36
  128. package/lib/admin-upload/job-list.js +85 -115
  129. package/lib/admin-upload/modal.js +19 -26
  130. package/lib/alert-message/index.js +11 -9
  131. package/lib/amount/index.js +10 -5
  132. package/lib/back-top/index.js +14 -10
  133. package/lib/button/index.js +24 -29
  134. package/lib/button/style/index.less +23 -19
  135. package/lib/card-detail/card-group.js +16 -22
  136. package/lib/card-detail/card-item.js +16 -21
  137. package/lib/card-detail/card-page.js +11 -15
  138. package/lib/card-detail/card.js +24 -24
  139. package/lib/card-detail/index.js +6 -6
  140. package/lib/card-detail/utils.js +7 -8
  141. package/lib/checkbox/index.js +24 -23
  142. package/lib/claim-list/index.js +53 -70
  143. package/lib/confirmation/index.js +7 -9
  144. package/lib/date-picker/buddhist.js +3 -3
  145. package/lib/date-picker/index.js +11 -5
  146. package/lib/declaration/index.js +16 -13
  147. package/lib/detail-panel/index.js +67 -83
  148. package/lib/documents/index.js +6 -8
  149. package/lib/example/index.js +10 -12
  150. package/lib/filter/checkBox.js +33 -45
  151. package/lib/filter/customize.js +3 -4
  152. package/lib/filter/index.d.ts +1 -0
  153. package/lib/filter/index.js +88 -112
  154. package/lib/filter/radioBox.js +23 -31
  155. package/lib/filter/rangePicker.js +43 -59
  156. package/lib/form/addable-section/index.d.ts +19 -0
  157. package/lib/form/addable-section/index.js +232 -0
  158. package/lib/form/addable-section/style/index.d.ts +1 -0
  159. package/lib/form/addable-section/style/index.js +3 -0
  160. package/lib/form/addable-section/style/index.less +22 -0
  161. package/lib/form/divider/index.js +7 -1
  162. package/lib/form/element/index.js +60 -48
  163. package/lib/form/element/style/index.less +9 -0
  164. package/lib/form/elements.js +1 -1
  165. package/lib/form/index.js +16 -17
  166. package/lib/form/login/index.js +16 -21
  167. package/lib/form/page/index.js +19 -25
  168. package/lib/form/page/style/index.less +1 -1
  169. package/lib/form/pages/index.js +24 -33
  170. package/lib/form/pages/style/index.less +3 -1
  171. package/lib/form/render/index.js +2 -2
  172. package/lib/form/section/index.js +15 -18
  173. package/lib/form/step/index.js +32 -43
  174. package/lib/form/steps/index.js +9 -12
  175. package/lib/{form/context.d.ts → form-context.d.ts} +1 -0
  176. package/lib/{form/context.js → form-context.js} +0 -0
  177. package/lib/free-form/addable-section/index.d.ts +18 -0
  178. package/lib/free-form/addable-section/index.js +306 -0
  179. package/lib/free-form/addable-section/style/index.d.ts +1 -0
  180. package/lib/free-form/addable-section/style/index.js +3 -0
  181. package/lib/free-form/addable-section/style/index.less +22 -0
  182. package/lib/free-form/element/index.js +44 -42
  183. package/lib/free-form/element/style/index.less +12 -2
  184. package/lib/free-form/index.d.ts +5 -1
  185. package/lib/free-form/index.js +17 -17
  186. package/lib/free-form/page/index.js +37 -47
  187. package/lib/free-form/page/style/index.less +3 -1
  188. package/lib/free-form/pages/index.js +8 -10
  189. package/lib/free-form/section/index.js +21 -23
  190. package/lib/free-form/section/style/index.less +4 -0
  191. package/lib/free-form/step/index.js +38 -48
  192. package/lib/free-form/steps/index.js +9 -11
  193. package/lib/global-message/index.js +1 -1
  194. package/lib/home-menu/index.js +52 -71
  195. package/lib/index.d.ts +1 -0
  196. package/lib/index.js +141 -132
  197. package/lib/input/amount.js +10 -5
  198. package/lib/input/credit-card.js +7 -1
  199. package/lib/input/email.js +7 -1
  200. package/lib/input/expiry-date.js +14 -18
  201. package/lib/input/index.js +18 -18
  202. package/lib/input/input-date.js +12 -16
  203. package/lib/input/input-number.js +8 -2
  204. package/lib/input/input.js +8 -2
  205. package/lib/input/otp.js +17 -15
  206. package/lib/input/password.js +11 -6
  207. package/lib/input/phone-number.js +6 -8
  208. package/lib/input/style/index.less +9 -1
  209. package/lib/input/text-area.js +14 -10
  210. package/lib/layout/defaultFooter.js +60 -82
  211. package/lib/layout/defaultHeader.js +11 -15
  212. package/lib/layout/footer.js +108 -148
  213. package/lib/layout/header.js +51 -60
  214. package/lib/layout/index.js +15 -12
  215. package/lib/locale/en-US/messages.json +2 -0
  216. package/lib/locale/format-message.js +1 -1
  217. package/lib/locale/id-ID/messages.json +2 -0
  218. package/lib/locale/index.js +4 -4
  219. package/lib/locale/locale-provider.js +9 -11
  220. package/lib/locale/th-TH/messages.json +2 -0
  221. package/lib/locale/vi-VN/messages.json +2 -0
  222. package/lib/locale/zh-CN/messages.json +2 -0
  223. package/lib/login-page/index.js +30 -42
  224. package/lib/media/index.js +20 -27
  225. package/lib/media/media.js +9 -12
  226. package/lib/media/preview.js +8 -10
  227. package/lib/mobile-insurer-detail/index.js +74 -91
  228. package/lib/mobile-insurer-list/index.js +34 -38
  229. package/lib/modal/index.d.ts +4 -3
  230. package/lib/modal/index.js +25 -27
  231. package/lib/modal/style/index.less +24 -5
  232. package/lib/platform/platform-card/index.js +9 -12
  233. package/lib/platform/switch-platform/index.js +24 -32
  234. package/lib/policy-list/index.js +11 -14
  235. package/lib/policy-list/policy-card.js +119 -153
  236. package/lib/radio/index.js +33 -35
  237. package/lib/select/attached-select.js +32 -35
  238. package/lib/select/select.js +13 -9
  239. package/lib/select/style/index.less +1 -1
  240. package/lib/select/time-select.js +12 -16
  241. package/lib/status-box/index.js +8 -10
  242. package/lib/table/index.js +72 -96
  243. package/lib/tabs/index.js +8 -2
  244. package/lib/types.d.ts +4 -2
  245. package/lib/typography/index.js +6 -8
  246. package/lib/upload/index.d.ts +2 -1
  247. package/lib/upload/index.js +170 -143
  248. package/lib/upload-photo/index.d.ts +2 -1
  249. package/lib/upload-photo/index.js +171 -142
  250. package/lib/upload-photo/media.js +3 -4
  251. package/lib/upload-preview/index.js +9 -12
  252. package/lib/upload-preview/media.js +12 -16
  253. package/lib/utils/form-utils.js +49 -37
  254. package/package.json +1 -1
  255. package/es/free-form/context.d.ts +0 -19
  256. package/es/free-form/context.js +0 -7
  257. package/lib/free-form/context.d.ts +0 -19
  258. package/lib/free-form/context.js +0 -19
@@ -105,20 +105,16 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
105
105
  className: "igloo-filter-date-picker-range-separate"
106
106
  }, void 0);
107
107
 
108
- return _jsxs("div", Object.assign({
109
- className: "igloo-form-filter-drop-down-container-content-group"
110
- }, {
111
- children: [_jsxs("div", Object.assign({
112
- className: "igloo-form-filter-drop-down-container-content-group-title"
113
- }, {
114
- children: [_jsx(Typography, Object.assign({
108
+ return _jsxs("div", {
109
+ className: "igloo-form-filter-drop-down-container-content-group",
110
+ children: [_jsxs("div", {
111
+ className: "igloo-form-filter-drop-down-container-content-group-title",
112
+ children: [_jsx(Typography, {
115
113
  level: "h4",
116
- className: "igloo-form-filter-range-picker-label"
117
- }, {
114
+ className: "igloo-form-filter-range-picker-label",
118
115
  children: title
119
- }), void 0), _jsxs("div", Object.assign({
120
- className: "igloo-form-filter-range-picker-container"
121
- }, {
116
+ }, void 0), _jsxs("div", {
117
+ className: "igloo-form-filter-range-picker-container",
122
118
  children: [_jsx(RangePicker, {
123
119
  inputReadOnly: true,
124
120
  className: classnames('igloo-date-picker-container', {
@@ -169,10 +165,9 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
169
165
  var thisMonthFinallyUse = dateRangeConfig.thisMonth || [moment().startOf('month'), moment().endOf('month')];
170
166
  var thisMonthDisable = disabledDate(thisMonthFinallyUse[0]) || disabledDate(thisMonthFinallyUse[1]);
171
167
  return _jsxs("div", {
172
- children: [_jsxs("div", Object.assign({
173
- className: "igloo-form-filter-date-picker-panel-top"
174
- }, {
175
- children: [_jsx("div", Object.assign({
168
+ children: [_jsxs("div", {
169
+ className: "igloo-form-filter-date-picker-panel-top",
170
+ children: [_jsx("div", {
176
171
  className: customDisable ? 'igloo-form-filter-date-picker-top-diable' : '',
177
172
  onClick: function onClick() {
178
173
  if (customDisable) return;
@@ -181,17 +176,15 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
181
176
  startTime: customFinallyUse[0],
182
177
  endTime: customFinallyUse[1]
183
178
  };
184
- }
185
- }, {
186
- children: _jsx(Typography, Object.assign({
179
+ },
180
+ children: _jsx(Typography, {
187
181
  level: "h5",
188
- className: "".concat(tiemRange === 0 ? 'igloo-form-filter-date-picker-panel-top-action' : '')
189
- }, {
182
+ className: "".concat(tiemRange === 0 ? 'igloo-form-filter-date-picker-panel-top-action' : ''),
190
183
  children: formatMessage({
191
184
  id: 'Custom'
192
185
  })
193
- }), void 0)
194
- }), void 0), _jsx("div", Object.assign({
186
+ }, void 0)
187
+ }, void 0), _jsx("div", {
195
188
  className: lastDayDisable ? 'igloo-form-filter-date-picker-top-diable' : '',
196
189
  onClick: function onClick() {
197
190
  if (lastDayDisable) return;
@@ -200,17 +193,15 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
200
193
  startTime: lastDayFinallyUse[0],
201
194
  endTime: lastDayFinallyUse[1]
202
195
  };
203
- }
204
- }, {
205
- children: _jsx(Typography, Object.assign({
196
+ },
197
+ children: _jsx(Typography, {
206
198
  level: "h5",
207
- className: "".concat(tiemRange === 1 ? 'igloo-form-filter-date-picker-panel-top-action' : '')
208
- }, {
199
+ className: "".concat(tiemRange === 1 ? 'igloo-form-filter-date-picker-panel-top-action' : ''),
209
200
  children: formatMessage({
210
201
  id: 'Last Day'
211
202
  })
212
- }), void 0)
213
- }), void 0), _jsx("div", Object.assign({
203
+ }, void 0)
204
+ }, void 0), _jsx("div", {
214
205
  className: lastSevenDaysDisable ? 'igloo-form-filter-date-picker-top-diable' : '',
215
206
  onClick: function onClick() {
216
207
  if (lastSevenDaysDisable) return;
@@ -219,17 +210,15 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
219
210
  startTime: lastSevenDaysFinallyUse[0],
220
211
  endTime: lastSevenDaysFinallyUse[1]
221
212
  };
222
- }
223
- }, {
224
- children: _jsx(Typography, Object.assign({
213
+ },
214
+ children: _jsx(Typography, {
225
215
  level: "h5",
226
- className: "".concat(tiemRange === 2 ? 'igloo-form-filter-date-picker-panel-top-action' : '')
227
- }, {
216
+ className: "".concat(tiemRange === 2 ? 'igloo-form-filter-date-picker-panel-top-action' : ''),
228
217
  children: formatMessage({
229
218
  id: 'Last 7 Days'
230
219
  })
231
- }), void 0)
232
- }), void 0), _jsx("div", Object.assign({
220
+ }, void 0)
221
+ }, void 0), _jsx("div", {
233
222
  className: lastMonthDisable ? 'igloo-form-filter-date-picker-top-diable' : '',
234
223
  onClick: function onClick() {
235
224
  if (lastMonthDisable) return;
@@ -238,17 +227,15 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
238
227
  startTime: lastMonthFinallyUse[0],
239
228
  endTime: lastMonthFinallyUse[1]
240
229
  };
241
- }
242
- }, {
243
- children: _jsx(Typography, Object.assign({
230
+ },
231
+ children: _jsx(Typography, {
244
232
  level: "h5",
245
- className: "".concat(tiemRange === 3 ? 'igloo-form-filter-date-picker-panel-top-action' : '')
246
- }, {
233
+ className: "".concat(tiemRange === 3 ? 'igloo-form-filter-date-picker-panel-top-action' : ''),
247
234
  children: formatMessage({
248
235
  id: 'Last Month'
249
236
  })
250
- }), void 0)
251
- }), void 0), _jsx("div", Object.assign({
237
+ }, void 0)
238
+ }, void 0), _jsx("div", {
252
239
  className: thisMonthDisable ? 'igloo-form-filter-date-picker-top-diable' : '',
253
240
  onClick: function onClick() {
254
241
  if (thisMonthDisable) return;
@@ -257,23 +244,20 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
257
244
  startTime: thisMonthFinallyUse[0],
258
245
  endTime: thisMonthFinallyUse[1]
259
246
  };
260
- }
261
- }, {
262
- children: _jsx(Typography, Object.assign({
247
+ },
248
+ children: _jsx(Typography, {
263
249
  level: "h5",
264
- className: "".concat(tiemRange === 4 ? 'igloo-form-filter-date-picker-panel-top-action' : '')
265
- }, {
250
+ className: "".concat(tiemRange === 4 ? 'igloo-form-filter-date-picker-panel-top-action' : ''),
266
251
  children: formatMessage({
267
252
  id: 'This Month'
268
253
  })
269
- }), void 0)
270
- }), void 0)]
271
- }), void 0), pa]
254
+ }, void 0)
255
+ }, void 0)]
256
+ }, void 0), pa]
272
257
  }, void 0);
273
258
  }
274
- }, void 0), pickerOpenStatus && _jsx("div", Object.assign({
275
- className: "igloo-form-filter-range-icon"
276
- }, {
259
+ }, void 0), pickerOpenStatus && _jsx("div", {
260
+ className: "igloo-form-filter-range-icon",
277
261
  children: _jsx(CalendarOutlined, {
278
262
  style: {
279
263
  fontSize: '20px'
@@ -289,17 +273,17 @@ var CreateRangePickerFilter = function CreateRangePickerFilter(props) {
289
273
  onFocus.focus();
290
274
  }
291
275
  }, void 0)
292
- }), void 0), _jsx("div", {
276
+ }, void 0), _jsx("div", {
293
277
  ref: dateRangerContainerRef,
294
278
  className: "igloo-form-fliter-drop-down-container-content-group-title-ranger-container"
295
279
  }, void 0)]
296
- }), void 0)]
297
- }), void 0), _jsx(_Divider, {
280
+ }, void 0)]
281
+ }, void 0), _jsx(_Divider, {
298
282
  style: {
299
283
  margin: '16px 0px'
300
284
  }
301
285
  }, void 0)]
302
- }), optionKey);
286
+ }, optionKey);
303
287
  };
304
288
 
305
289
  export default CreateRangePickerFilter;
@@ -0,0 +1,19 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { FormItemProps } from 'antd/es/form';
3
+ import { FormItemConfig, FormItemName } from '../../types';
4
+ import './style/index.less';
5
+ export interface AddableSectionProps {
6
+ parentName?: FormItemName;
7
+ formItemProps?: FormItemProps;
8
+ config: FormItemConfig;
9
+ preview?: boolean;
10
+ disabled?: boolean;
11
+ setShowStepButton?: (showButton: boolean) => void;
12
+ max?: number;
13
+ min?: number;
14
+ initCount?: number;
15
+ addButtonText?: string;
16
+ addButtonIcon?: ReactNode;
17
+ }
18
+ declare const AddableSection: FC<AddableSectionProps>;
19
+ export default AddableSection;
@@ -0,0 +1,211 @@
1
+ import "antd/es/row/style";
2
+ import _Row from "antd/es/row";
3
+ import "antd/es/col/style";
4
+ import _Col from "antd/es/col";
5
+
6
+ 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; }
7
+
8
+ 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; }
9
+
10
+ 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; }
11
+
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+
14
+ 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."); }
15
+
16
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
17
+
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+
20
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
+
22
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
+
24
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
+
26
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
27
+
28
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
29
+
30
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
+
32
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
33
+ import { useReducer, useContext, useCallback } from 'react';
34
+ import Element from '../element';
35
+ import FormContext from '../../form-context';
36
+ import { calcNamePath, calcFormItemProps } from '../../utils/form-utils';
37
+ import Typography from '../../typography';
38
+ import Button from '../../button';
39
+ import { LocaleContext } from '../../locale';
40
+ import './style/index.less';
41
+
42
+ var AddableSection = function AddableSection(_ref) {
43
+ var parentName = _ref.parentName,
44
+ config = _ref.config,
45
+ preview = _ref.preview,
46
+ disabled = _ref.disabled,
47
+ setShowStepButton = _ref.setShowStepButton;
48
+ var _config$elements = config.elements,
49
+ elements = _config$elements === void 0 ? [] : _config$elements,
50
+ name = config.name,
51
+ label = config.label,
52
+ _config$labelProps = config.labelProps,
53
+ labelProps = _config$labelProps === void 0 ? {} : _config$labelProps,
54
+ _config$contentProps = config.contentProps,
55
+ contentProps = _config$contentProps === void 0 ? {} : _config$contentProps,
56
+ _config$style = config.style,
57
+ style = _config$style === void 0 ? {} : _config$style,
58
+ _config$max = config.max,
59
+ max = _config$max === void 0 ? Number.MAX_SAFE_INTEGER : _config$max,
60
+ _config$initCount = config.initCount,
61
+ initCount = _config$initCount === void 0 ? 1 : _config$initCount,
62
+ _config$min = config.min,
63
+ min = _config$min === void 0 ? initCount : _config$min,
64
+ addButtonText = config.addButtonText,
65
+ addButtonIcon = config.addButtonIcon;
66
+
67
+ var _useContext = useContext(LocaleContext),
68
+ formatMessage = _useContext.formatMessage;
69
+
70
+ var _useContext2 = useContext(FormContext),
71
+ form = _useContext2.form,
72
+ requiredMark = _useContext2.requiredMark;
73
+
74
+ var namePath = calcNamePath(parentName, name);
75
+ var reducer = useCallback(function (state, action) {
76
+ if (action.type === 'add') {
77
+ return [].concat(_toConsumableArray(state), [action.key]);
78
+ }
79
+
80
+ var found = false;
81
+ return state.filter(function (key, index) {
82
+ if (key === action.key) {
83
+ found = true;
84
+ }
85
+
86
+ if (found) {
87
+ if (index === state.length - 1) {
88
+ form === null || form === void 0 ? void 0 : form.setFields([{
89
+ name: calcNamePath(namePath, index),
90
+ value: undefined
91
+ }]);
92
+ } else {
93
+ form === null || form === void 0 ? void 0 : form.setFields([{
94
+ name: calcNamePath(namePath, index),
95
+ value: form.getFieldValue(calcNamePath(namePath, index + 1))
96
+ }]);
97
+ }
98
+ }
99
+
100
+ return key !== action.key;
101
+ });
102
+ }, []);
103
+
104
+ var _useReducer = useReducer(reducer, function () {
105
+ var init = [];
106
+ var value = (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath)) || [];
107
+
108
+ for (var i = 0; i < Math.max(min, value.length, initCount); i++) {
109
+ init.push(Date.now() + Math.random());
110
+ }
111
+
112
+ return init;
113
+ }()),
114
+ _useReducer2 = _slicedToArray(_useReducer, 2),
115
+ groupKeys = _useReducer2[0],
116
+ dispath = _useReducer2[1];
117
+
118
+ var _calcFormItemProps = calcFormItemProps(config, {
119
+ requiredMark: requiredMark
120
+ }, form, parentName),
121
+ formItemProps = _calcFormItemProps.formItemProps,
122
+ elementProps = _calcFormItemProps.elementProps,
123
+ display = _calcFormItemProps.display;
124
+
125
+ if (formItemProps.copiedValue.copied) {
126
+ var currentValue = form === null || form === void 0 ? void 0 : form.getFieldValue(namePath);
127
+
128
+ var value = _objectSpread(_objectSpread({}, currentValue), formItemProps.copiedValue.value);
129
+
130
+ form === null || form === void 0 ? void 0 : form.setFields([{
131
+ name: namePath,
132
+ value: value,
133
+ errors: []
134
+ }]);
135
+ }
136
+
137
+ if (!display) {
138
+ return null;
139
+ }
140
+
141
+ var groups = groupKeys.map(function (key, index) {
142
+ var parentName = calcNamePath(namePath, index);
143
+ return _jsxs(_Col, {
144
+ span: 24,
145
+ className: 'igloo-freeform-addable-section',
146
+ children: [(groupKeys.length > min && !preview || label) && _jsxs(_Row, {
147
+ justify: "space-between",
148
+ className: 'igloo-addable-section-label',
149
+ children: [label ? _jsxs(Typography, _objectSpread(_objectSpread({}, labelProps), {}, {
150
+ level: "h4",
151
+ wrapElement: "div",
152
+ children: [label, " ", index + 1]
153
+ }), void 0) : _jsx("div", {}, void 0), groupKeys.length > min && !preview && _jsx(Button, {
154
+ type: "link",
155
+ className: "igloo-addable-section-label-remove",
156
+ onClick: function onClick() {
157
+ return dispath({
158
+ type: 'remove',
159
+ key: key
160
+ });
161
+ },
162
+ children: formatMessage({
163
+ id: 'Remove'
164
+ })
165
+ }, void 0)]
166
+ }, void 0), _jsx("div", _objectSpread(_objectSpread({
167
+ className: 'igloo-freeform-addable-section-content'
168
+ }, contentProps), {}, {
169
+ children: _jsx(_Row, {
170
+ gutter: [32, preview ? 16 : 24],
171
+ children: elements.map(function (child, index) {
172
+ return _jsx(Element, {
173
+ parentName: parentName,
174
+ config: child,
175
+ disabled: elementProps.disabled || disabled,
176
+ preview: preview,
177
+ setShowStepButton: setShowStepButton
178
+ }, index);
179
+ })
180
+ }, void 0)
181
+ }), void 0)]
182
+ }, key);
183
+ });
184
+ return _jsxs("div", {
185
+ className: "igloo-freeform-addable-section-container",
186
+ style: {
187
+ width: '100%'
188
+ },
189
+ children: [groups, groupKeys.length < max && !preview && _jsx(_Col, {
190
+ span: 24,
191
+ style: {
192
+ marginTop: 16
193
+ },
194
+ children: _jsx(Button, {
195
+ onClick: function onClick() {
196
+ return dispath({
197
+ type: 'add',
198
+ key: Date.now()
199
+ });
200
+ },
201
+ className: "igloo-addable-section-button",
202
+ icon: addButtonIcon,
203
+ children: addButtonText || "".concat(formatMessage({
204
+ id: 'Add'
205
+ }), " ").concat(label)
206
+ }, void 0)
207
+ }, void 0)]
208
+ }, void 0);
209
+ };
210
+
211
+ export default AddableSection;
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,22 @@
1
+ .igloo-freeform-addable-section-container {
2
+ .igloo-freeform-addable-section {
3
+ .igloo-freeform-addable-section-label {
4
+ .igloo-freeform-addable-section-label-remove {
5
+ height: auto;
6
+ border: none;
7
+ }
8
+ }
9
+
10
+ .igloo-freeform-addable-section-content {
11
+ margin-top: 16px;
12
+ }
13
+
14
+ & + .igloo-freeform-addable-section {
15
+ margin-top: 24px;
16
+ }
17
+ }
18
+
19
+ .igloo-freeform-addable-section-button {
20
+ min-width: 221px;
21
+ }
22
+ }
@@ -2,6 +2,12 @@ import "antd/es/divider/style";
2
2
  import _Divider from "antd/es/divider";
3
3
  var _excluded = ["className"];
4
4
 
5
+ 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; }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
5
11
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
12
 
7
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -16,7 +22,7 @@ var DividerElement = function DividerElement(_ref) {
16
22
  var className = _ref.className,
17
23
  props = _objectWithoutProperties(_ref, _excluded);
18
24
 
19
- return _jsx(_Divider, Object.assign({
25
+ return _jsx(_Divider, _objectSpread({
20
26
  className: classNames(className, 'igloo-form-divider')
21
27
  }, omit(props, formMethods)), void 0);
22
28
  };