iglooform 2.4.7 → 2.4.11
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.
- package/es/admin-upload/float.js +25 -35
- package/es/admin-upload/index.d.ts +2 -0
- package/es/admin-upload/index.js +43 -36
- package/es/admin-upload/job-list.js +85 -115
- package/es/admin-upload/modal.js +19 -26
- package/es/alert-message/index.js +11 -9
- package/es/amount/index.js +10 -5
- package/es/back-top/index.js +14 -10
- package/es/button/index.js +23 -28
- package/es/button/style/index.less +23 -19
- package/es/card-detail/card-group.js +16 -22
- package/es/card-detail/card-item.js +16 -21
- package/es/card-detail/card-page.js +11 -15
- package/es/card-detail/card.js +24 -24
- package/es/card-detail/style/index.less +13 -0
- package/es/card-detail/utils.js +6 -7
- package/es/checkbox/index.js +23 -22
- package/es/claim-list/index.js +53 -70
- package/es/confirmation/index.js +7 -9
- package/es/date-picker/buddhist.js +3 -3
- package/es/date-picker/index.js +10 -4
- package/es/declaration/index.js +16 -13
- package/es/detail-panel/index.js +67 -83
- package/es/documents/index.js +6 -8
- package/es/example/index.js +9 -11
- package/es/filter/checkBox.js +33 -45
- package/es/filter/customize.js +3 -4
- package/es/filter/index.d.ts +1 -0
- package/es/filter/index.js +88 -112
- package/es/filter/radioBox.js +23 -31
- package/es/filter/rangePicker.js +43 -59
- package/es/form/addable-section/index.d.ts +19 -0
- package/es/form/addable-section/index.js +211 -0
- package/es/form/addable-section/style/index.d.ts +1 -0
- package/es/form/addable-section/style/index.js +1 -0
- package/es/form/addable-section/style/index.less +22 -0
- package/es/form/divider/index.js +7 -1
- package/es/form/element/index.js +58 -47
- package/es/form/element/style/index.less +9 -0
- package/es/form/index.js +16 -17
- package/es/form/login/index.js +15 -20
- package/es/form/page/index.js +18 -24
- package/es/form/page/style/index.less +1 -1
- package/es/form/pages/index.js +23 -32
- package/es/form/pages/style/index.less +3 -1
- package/es/form/render/index.js +1 -1
- package/es/form/section/index.js +14 -17
- package/es/form/step/index.js +31 -42
- package/es/form/steps/index.js +8 -11
- package/es/{form/context.d.ts → form-context.d.ts} +1 -0
- package/es/{form/context.js → form-context.js} +0 -0
- package/es/free-form/addable-section/index.d.ts +18 -0
- package/es/free-form/addable-section/index.js +286 -0
- package/es/free-form/addable-section/style/index.d.ts +1 -0
- package/es/free-form/addable-section/style/index.js +1 -0
- package/es/free-form/addable-section/style/index.less +22 -0
- package/es/free-form/element/index.js +43 -41
- package/es/free-form/element/style/index.less +12 -2
- package/es/free-form/index.d.ts +5 -1
- package/es/free-form/index.js +17 -17
- package/es/free-form/page/index.js +36 -46
- package/es/free-form/page/style/index.less +3 -1
- package/es/free-form/pages/index.js +8 -10
- package/es/free-form/section/index.js +20 -22
- package/es/free-form/section/style/index.less +4 -0
- package/es/free-form/step/index.js +37 -47
- package/es/free-form/steps/index.js +8 -10
- package/es/global-message/index.js +1 -1
- package/es/home-menu/index.js +52 -71
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/input/amount.js +10 -5
- package/es/input/credit-card.js +7 -1
- package/es/input/email.js +8 -1
- package/es/input/expiry-date.js +14 -18
- package/es/input/input-date.js +12 -16
- package/es/input/input-number.js +9 -2
- package/es/input/input.js +9 -2
- package/es/input/otp.js +17 -15
- package/es/input/password.js +12 -6
- package/es/input/phone-number.js +6 -8
- package/es/input/style/index.less +9 -1
- package/es/input/text-area.js +14 -10
- package/es/layout/defaultFooter.js +60 -82
- package/es/layout/defaultHeader.js +11 -15
- package/es/layout/footer.js +108 -148
- package/es/layout/header.js +51 -60
- package/es/layout/index.js +16 -12
- package/es/locale/en-US/messages.json +2 -0
- package/es/locale/id-ID/messages.json +2 -0
- package/es/locale/locale-provider.js +8 -10
- package/es/locale/th-TH/messages.json +2 -0
- package/es/locale/vi-VN/messages.json +2 -0
- package/es/locale/zh-CN/messages.json +2 -0
- package/es/login-page/index.js +30 -42
- package/es/media/index.js +20 -27
- package/es/media/media.js +9 -12
- package/es/media/preview.js +8 -10
- package/es/mobile-insurer-detail/index.js +74 -91
- package/es/mobile-insurer-list/index.js +34 -38
- package/es/modal/index.d.ts +4 -3
- package/es/modal/index.js +25 -27
- package/es/modal/style/index.less +24 -5
- package/es/platform/platform-card/index.js +9 -12
- package/es/platform/switch-platform/index.js +24 -32
- package/es/policy-list/index.js +11 -14
- package/es/policy-list/policy-card.js +119 -153
- package/es/radio/index.js +33 -35
- package/es/select/attached-select.js +31 -34
- package/es/select/select.js +12 -8
- package/es/select/style/index.less +1 -1
- package/es/select/time-select.js +12 -16
- package/es/status-box/index.js +8 -10
- package/es/table/index.js +72 -96
- package/es/tabs/index.js +7 -1
- package/es/types.d.ts +4 -2
- package/es/typography/index.js +6 -8
- package/es/upload/index.d.ts +2 -1
- package/es/upload/index.js +169 -143
- package/es/upload-photo/index.d.ts +2 -1
- package/es/upload-photo/index.js +170 -142
- package/es/upload-photo/media.js +3 -4
- package/es/upload-preview/index.js +9 -12
- package/es/upload-preview/media.js +12 -16
- package/es/upload-preview/style/index.less +2 -2
- package/es/utils/form-utils.js +49 -36
- package/lib/admin-upload/float.js +25 -35
- package/lib/admin-upload/index.d.ts +2 -0
- package/lib/admin-upload/index.js +43 -36
- package/lib/admin-upload/job-list.js +85 -115
- package/lib/admin-upload/modal.js +19 -26
- package/lib/alert-message/index.js +11 -9
- package/lib/amount/index.js +10 -5
- package/lib/back-top/index.js +14 -10
- package/lib/button/index.js +24 -29
- package/lib/button/style/index.less +23 -19
- package/lib/card-detail/card-group.js +16 -22
- package/lib/card-detail/card-item.js +16 -21
- package/lib/card-detail/card-page.js +11 -15
- package/lib/card-detail/card.js +24 -24
- package/lib/card-detail/index.js +6 -6
- package/lib/card-detail/style/index.less +13 -0
- package/lib/card-detail/utils.js +7 -8
- package/lib/checkbox/index.js +24 -23
- package/lib/claim-list/index.js +53 -70
- package/lib/confirmation/index.js +7 -9
- package/lib/date-picker/buddhist.js +3 -3
- package/lib/date-picker/index.js +11 -5
- package/lib/declaration/index.js +16 -13
- package/lib/detail-panel/index.js +67 -83
- package/lib/documents/index.js +6 -8
- package/lib/example/index.js +10 -12
- package/lib/filter/checkBox.js +33 -45
- package/lib/filter/customize.js +3 -4
- package/lib/filter/index.d.ts +1 -0
- package/lib/filter/index.js +88 -112
- package/lib/filter/radioBox.js +23 -31
- package/lib/filter/rangePicker.js +43 -59
- package/lib/form/addable-section/index.d.ts +19 -0
- package/lib/form/addable-section/index.js +232 -0
- package/lib/form/addable-section/style/index.d.ts +1 -0
- package/lib/form/addable-section/style/index.js +3 -0
- package/lib/form/addable-section/style/index.less +22 -0
- package/lib/form/divider/index.js +7 -1
- package/lib/form/element/index.js +60 -48
- package/lib/form/element/style/index.less +9 -0
- package/lib/form/elements.js +1 -1
- package/lib/form/index.js +16 -17
- package/lib/form/login/index.js +16 -21
- package/lib/form/page/index.js +19 -25
- package/lib/form/page/style/index.less +1 -1
- package/lib/form/pages/index.js +24 -33
- package/lib/form/pages/style/index.less +3 -1
- package/lib/form/render/index.js +2 -2
- package/lib/form/section/index.js +15 -18
- package/lib/form/step/index.js +32 -43
- package/lib/form/steps/index.js +9 -12
- package/lib/{form/context.d.ts → form-context.d.ts} +1 -0
- package/lib/{form/context.js → form-context.js} +0 -0
- package/lib/free-form/addable-section/index.d.ts +18 -0
- package/lib/free-form/addable-section/index.js +306 -0
- package/lib/free-form/addable-section/style/index.d.ts +1 -0
- package/lib/free-form/addable-section/style/index.js +3 -0
- package/lib/free-form/addable-section/style/index.less +22 -0
- package/lib/free-form/element/index.js +44 -42
- package/lib/free-form/element/style/index.less +12 -2
- package/lib/free-form/index.d.ts +5 -1
- package/lib/free-form/index.js +17 -17
- package/lib/free-form/page/index.js +37 -47
- package/lib/free-form/page/style/index.less +3 -1
- package/lib/free-form/pages/index.js +8 -10
- package/lib/free-form/section/index.js +21 -23
- package/lib/free-form/section/style/index.less +4 -0
- package/lib/free-form/step/index.js +38 -48
- package/lib/free-form/steps/index.js +9 -11
- package/lib/global-message/index.js +1 -1
- package/lib/home-menu/index.js +52 -71
- package/lib/index.d.ts +1 -0
- package/lib/index.js +141 -132
- package/lib/input/amount.js +10 -5
- package/lib/input/credit-card.js +7 -1
- package/lib/input/email.js +7 -1
- package/lib/input/expiry-date.js +14 -18
- package/lib/input/index.js +18 -18
- package/lib/input/input-date.js +12 -16
- package/lib/input/input-number.js +8 -2
- package/lib/input/input.js +8 -2
- package/lib/input/otp.js +17 -15
- package/lib/input/password.js +11 -6
- package/lib/input/phone-number.js +6 -8
- package/lib/input/style/index.less +9 -1
- package/lib/input/text-area.js +14 -10
- package/lib/layout/defaultFooter.js +60 -82
- package/lib/layout/defaultHeader.js +11 -15
- package/lib/layout/footer.js +108 -148
- package/lib/layout/header.js +51 -60
- package/lib/layout/index.js +15 -12
- package/lib/locale/en-US/messages.json +2 -0
- package/lib/locale/format-message.js +1 -1
- package/lib/locale/id-ID/messages.json +2 -0
- package/lib/locale/index.js +4 -4
- package/lib/locale/locale-provider.js +9 -11
- package/lib/locale/th-TH/messages.json +2 -0
- package/lib/locale/vi-VN/messages.json +2 -0
- package/lib/locale/zh-CN/messages.json +2 -0
- package/lib/login-page/index.js +30 -42
- package/lib/media/index.js +20 -27
- package/lib/media/media.js +9 -12
- package/lib/media/preview.js +8 -10
- package/lib/mobile-insurer-detail/index.js +74 -91
- package/lib/mobile-insurer-list/index.js +34 -38
- package/lib/modal/index.d.ts +4 -3
- package/lib/modal/index.js +25 -27
- package/lib/modal/style/index.less +24 -5
- package/lib/platform/platform-card/index.js +9 -12
- package/lib/platform/switch-platform/index.js +24 -32
- package/lib/policy-list/index.js +11 -14
- package/lib/policy-list/policy-card.js +119 -153
- package/lib/radio/index.js +33 -35
- package/lib/select/attached-select.js +32 -35
- package/lib/select/select.js +13 -9
- package/lib/select/style/index.less +1 -1
- package/lib/select/time-select.js +12 -16
- package/lib/status-box/index.js +8 -10
- package/lib/table/index.js +72 -96
- package/lib/tabs/index.js +8 -2
- package/lib/types.d.ts +4 -2
- package/lib/typography/index.js +6 -8
- package/lib/upload/index.d.ts +2 -1
- package/lib/upload/index.js +170 -143
- package/lib/upload-photo/index.d.ts +2 -1
- package/lib/upload-photo/index.js +171 -142
- package/lib/upload-photo/media.js +3 -4
- package/lib/upload-preview/index.js +9 -12
- package/lib/upload-preview/media.js +12 -16
- package/lib/upload-preview/style/index.less +2 -2
- package/lib/utils/form-utils.js +49 -37
- package/package.json +1 -1
- package/es/free-form/context.d.ts +0 -19
- package/es/free-form/context.js +0 -7
- package/lib/free-form/context.d.ts +0 -19
- package/lib/free-form/context.js +0 -19
package/es/filter/rangePicker.js
CHANGED
|
@@ -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",
|
|
109
|
-
className: "igloo-form-filter-drop-down-container-content-group"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
}
|
|
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",
|
|
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
|
-
}
|
|
194
|
-
}
|
|
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
|
-
}
|
|
213
|
-
}
|
|
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
|
-
}
|
|
232
|
-
}
|
|
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
|
-
}
|
|
251
|
-
}
|
|
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
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
254
|
+
}, void 0)
|
|
255
|
+
}, void 0)]
|
|
256
|
+
}, void 0), pa]
|
|
272
257
|
}, void 0);
|
|
273
258
|
}
|
|
274
|
-
}, void 0), pickerOpenStatus && _jsx("div",
|
|
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
|
-
}
|
|
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
|
-
}
|
|
297
|
-
}
|
|
280
|
+
}, void 0)]
|
|
281
|
+
}, void 0), _jsx(_Divider, {
|
|
298
282
|
style: {
|
|
299
283
|
margin: '16px 0px'
|
|
300
284
|
}
|
|
301
285
|
}, void 0)]
|
|
302
|
-
}
|
|
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
+
|
|
14
|
+
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."); }
|
|
15
|
+
|
|
16
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
17
|
+
|
|
18
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
19
|
+
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
22
|
+
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."); }
|
|
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 _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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
32
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
33
|
+
import { useReducer, useContext } 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
|
+
|
|
76
|
+
var _useReducer = useReducer(function (state, action) {
|
|
77
|
+
if (action.type === 'add') {
|
|
78
|
+
return [].concat(_toConsumableArray(state), [action.key]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var found = false;
|
|
82
|
+
return state.filter(function (key, index) {
|
|
83
|
+
if (index === state.length - 1) {
|
|
84
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
85
|
+
name: calcNamePath(namePath, index),
|
|
86
|
+
value: undefined
|
|
87
|
+
}]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (key === action.key) {
|
|
91
|
+
found = true;
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (found) {
|
|
96
|
+
form === null || form === void 0 ? void 0 : form.setFields([{
|
|
97
|
+
name: calcNamePath(namePath, index - 1),
|
|
98
|
+
value: form.getFieldValue(calcNamePath(namePath, index))
|
|
99
|
+
}]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return true;
|
|
103
|
+
});
|
|
104
|
+
}, 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
|
+
}
|
package/es/form/divider/index.js
CHANGED
|
@@ -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,
|
|
25
|
+
return _jsx(_Divider, _objectSpread({
|
|
20
26
|
className: classNames(className, 'igloo-form-divider')
|
|
21
27
|
}, omit(props, formMethods)), void 0);
|
|
22
28
|
};
|