iglooform 2.5.8 → 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.
- package/es/form/element/index.js +22 -21
- package/es/form/hstep/index.js +14 -5
- package/es/form/hstep/style/index.less +1 -1
- package/es/form/hsteps/index.d.ts +9 -3
- package/es/form/hsteps/index.js +35 -12
- package/es/form/hsteps/style/index.less +7 -1
- package/es/form/pages/index.js +2 -2
- package/es/form/step/index.js +14 -5
- package/es/form/steps/index.js +2 -2
- package/es/upload-photo/index.js +10 -4
- package/lib/form/element/index.js +22 -21
- package/lib/form/hstep/index.js +14 -5
- package/lib/form/hstep/style/index.less +1 -1
- package/lib/form/hsteps/index.d.ts +9 -3
- package/lib/form/hsteps/index.js +35 -12
- package/lib/form/hsteps/style/index.less +7 -1
- package/lib/form/pages/index.js +2 -2
- package/lib/form/step/index.js +14 -5
- package/lib/form/steps/index.js +2 -2
- package/lib/upload-photo/index.js +10 -4
- package/package.json +1 -1
package/es/form/element/index.js
CHANGED
|
@@ -151,26 +151,6 @@ var Element = function Element(_ref) {
|
|
|
151
151
|
var _useBreakpoint = useBreakpoint(),
|
|
152
152
|
md = _useBreakpoint.md;
|
|
153
153
|
|
|
154
|
-
if (type === 'Section') {
|
|
155
|
-
return _jsx(Section, {
|
|
156
|
-
parentName: parentName,
|
|
157
|
-
config: config,
|
|
158
|
-
preview: preview,
|
|
159
|
-
disabled: disabled,
|
|
160
|
-
setShowStepButton: setShowStepButton
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (type === 'AddableSection') {
|
|
165
|
-
return _jsx(AddableSection, {
|
|
166
|
-
parentName: parentName,
|
|
167
|
-
config: config,
|
|
168
|
-
preview: preview,
|
|
169
|
-
disabled: disabled,
|
|
170
|
-
setShowStepButton: setShowStepButton
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
154
|
var _calcFormItemProps = calcFormItemProps(config, _objectSpread(_objectSpread({}, extraConfig), {}, {
|
|
175
155
|
requiredMark: requiredMark
|
|
176
156
|
}), form, parentName),
|
|
@@ -235,7 +215,28 @@ var Element = function Element(_ref) {
|
|
|
235
215
|
name: formItemProps.name,
|
|
236
216
|
value: formItemProps.initialValue
|
|
237
217
|
}]);
|
|
238
|
-
}, [formItemProps.initialValue]);
|
|
218
|
+
}, [formItemProps.initialValue]);
|
|
219
|
+
|
|
220
|
+
if (type === 'Section') {
|
|
221
|
+
return _jsx(Section, {
|
|
222
|
+
parentName: parentName,
|
|
223
|
+
config: config,
|
|
224
|
+
preview: preview,
|
|
225
|
+
disabled: disabled,
|
|
226
|
+
setShowStepButton: setShowStepButton
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (type === 'AddableSection') {
|
|
231
|
+
return _jsx(AddableSection, {
|
|
232
|
+
parentName: parentName,
|
|
233
|
+
config: config,
|
|
234
|
+
preview: preview,
|
|
235
|
+
disabled: disabled,
|
|
236
|
+
setShowStepButton: setShowStepButton
|
|
237
|
+
});
|
|
238
|
+
} //这里要想一下有没有更优雅的实现方式
|
|
239
|
+
|
|
239
240
|
|
|
240
241
|
if (withoutForm) {
|
|
241
242
|
var hideWhenPreview = elementProps.hideWhenPreview,
|
package/es/form/hstep/index.js
CHANGED
|
@@ -74,14 +74,23 @@ var Step = function Step(_ref) {
|
|
|
74
74
|
md = _useBreakpoint.md;
|
|
75
75
|
|
|
76
76
|
useEffect(function () {
|
|
77
|
-
var _containerRef$current, _containerRef$
|
|
77
|
+
var _containerRef$current, _containerRef$current4;
|
|
78
78
|
|
|
79
79
|
if (md || !(shouldScroll && edit)) return;
|
|
80
80
|
var scrollContainer = getScrollContainer() || window;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if (typeof scrollContainer.scrollTo !== 'function') return;
|
|
82
|
+
|
|
83
|
+
if (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetTop) {
|
|
84
|
+
var _containerRef$current2, _containerRef$current3;
|
|
85
|
+
|
|
86
|
+
scrollContainer.scrollTo.length === 2 ? scrollContainer.scrollTo(0, (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetTop) - 50) : scrollContainer.scrollTo({
|
|
87
|
+
top: (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetTop) - 50,
|
|
88
|
+
behavior: 'smooth'
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.scrollIntoView();
|
|
85
94
|
}, [shouldScroll, edit]);
|
|
86
95
|
return _jsxs(_Fragment, {
|
|
87
96
|
children: [_jsxs("div", {
|
|
@@ -3,11 +3,17 @@ import { FormItemConfig, FormItemName } from '../../types';
|
|
|
3
3
|
import './style/index.less';
|
|
4
4
|
import { ConfirmationProps } from '../../confirmation';
|
|
5
5
|
export interface HStepsProps {
|
|
6
|
-
config: FormItemConfig
|
|
6
|
+
config: FormItemConfig & {
|
|
7
|
+
confirmations?: {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
required: boolean;
|
|
10
|
+
confirmation?: ConfirmationProps;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
withReview?: boolean;
|
|
14
|
+
};
|
|
7
15
|
parentName?: FormItemName;
|
|
8
16
|
name?: FormItemName;
|
|
9
|
-
withReview?: boolean;
|
|
10
|
-
confirmation?: ConfirmationProps;
|
|
11
17
|
}
|
|
12
18
|
declare const HSteps: FC<HStepsProps>;
|
|
13
19
|
export default HSteps;
|
package/es/form/hsteps/index.js
CHANGED
|
@@ -49,8 +49,7 @@ var useBreakpoint = _Grid.useBreakpoint;
|
|
|
49
49
|
var HSteps = function HSteps(_ref) {
|
|
50
50
|
var _renderElements$curre2, _renderElements$curre3;
|
|
51
51
|
|
|
52
|
-
var
|
|
53
|
-
parentName = _ref.parentName,
|
|
52
|
+
var parentName = _ref.parentName,
|
|
54
53
|
_ref$config = _ref.config,
|
|
55
54
|
_ref$config$elements = _ref$config.elements,
|
|
56
55
|
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
@@ -58,10 +57,10 @@ var HSteps = function HSteps(_ref) {
|
|
|
58
57
|
currentStep = _ref$config$currentSt === void 0 ? 0 : _ref$config$currentSt,
|
|
59
58
|
subscribedFields = _ref$config.subscribedFields,
|
|
60
59
|
onEdit = _ref$config.onEdit,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
_ref$
|
|
64
|
-
|
|
60
|
+
confirmations = _ref$config.confirmations,
|
|
61
|
+
_ref$config$withRevie = _ref$config.withReview,
|
|
62
|
+
withReview = _ref$config$withRevie === void 0 ? true : _ref$config$withRevie,
|
|
63
|
+
name = _ref$config.name;
|
|
65
64
|
|
|
66
65
|
var _useState = useState(0),
|
|
67
66
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -259,9 +258,7 @@ var HSteps = function HSteps(_ref) {
|
|
|
259
258
|
})]
|
|
260
259
|
})]
|
|
261
260
|
}), _jsxs("div", {
|
|
262
|
-
className:
|
|
263
|
-
'igloo-hsteps-content': !md
|
|
264
|
-
}),
|
|
261
|
+
className: "igloo-hsteps-content",
|
|
265
262
|
children: [current < renderElements.length && _jsx(StepContext.Provider, {
|
|
266
263
|
value: {
|
|
267
264
|
registerSection: registerSection
|
|
@@ -278,7 +275,7 @@ var HSteps = function HSteps(_ref) {
|
|
|
278
275
|
shouldScroll: shouldScroll
|
|
279
276
|
}, ((_renderElements$curre2 = renderElements[current]) === null || _renderElements$curre2 === void 0 ? void 0 : _renderElements$curre2.key) || ((_renderElements$curre3 = renderElements[current]) === null || _renderElements$curre3 === void 0 ? void 0 : _renderElements$curre3.name))
|
|
280
277
|
}), current === renderElements.length && _jsxs("div", {
|
|
281
|
-
className: "igloo-
|
|
278
|
+
className: "igloo-hsteps-confirmation-container",
|
|
282
279
|
children: [withReview && !md && _jsxs(Typography, {
|
|
283
280
|
className: "igloo-hstep-label",
|
|
284
281
|
level: "h3a",
|
|
@@ -329,7 +326,7 @@ var HSteps = function HSteps(_ref) {
|
|
|
329
326
|
children: formatMessage({
|
|
330
327
|
id: 'Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.'
|
|
331
328
|
})
|
|
332
|
-
}), _jsx(_Divider, {}), _jsx(_Form.Item, {
|
|
329
|
+
}), _jsx(_Divider, {}), !confirmations && _jsx(_Form.Item, {
|
|
333
330
|
name: calcNamePath(parentName, 'confirmation'),
|
|
334
331
|
rules: [{
|
|
335
332
|
validator: function validator(_, value) {
|
|
@@ -345,7 +342,33 @@ var HSteps = function HSteps(_ref) {
|
|
|
345
342
|
style: {
|
|
346
343
|
margin: 0
|
|
347
344
|
},
|
|
348
|
-
children: _jsx(Confirmation,
|
|
345
|
+
children: _jsx(Confirmation, {})
|
|
346
|
+
}), confirmations && Object.entries(confirmations).map(function (_ref6) {
|
|
347
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
348
|
+
key = _ref7[0],
|
|
349
|
+
_ref7$ = _ref7[1],
|
|
350
|
+
required = _ref7$.required,
|
|
351
|
+
_ref7$$confirmation = _ref7$.confirmation,
|
|
352
|
+
confirmation = _ref7$$confirmation === void 0 ? {} : _ref7$$confirmation;
|
|
353
|
+
|
|
354
|
+
return _jsx(_Form.Item, {
|
|
355
|
+
name: calcNamePath(parentName, key),
|
|
356
|
+
rules: [{
|
|
357
|
+
validator: function validator(_, value) {
|
|
358
|
+
if (required && !value) {
|
|
359
|
+
return Promise.reject(formatMessage({
|
|
360
|
+
id: 'Please read and agree to Igloo Terms of Use and Privacy Policy'
|
|
361
|
+
}));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return Promise.resolve();
|
|
365
|
+
}
|
|
366
|
+
}],
|
|
367
|
+
style: {
|
|
368
|
+
margin: 0
|
|
369
|
+
},
|
|
370
|
+
children: _jsx(Confirmation, _objectSpread({}, confirmation))
|
|
371
|
+
});
|
|
349
372
|
}), showSubmitButton && md && _jsx(_Form.Item, {
|
|
350
373
|
style: {
|
|
351
374
|
marginBottom: 0
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
width: 100%;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.igloo-hsteps-confirmation-container {
|
|
33
|
+
background: #f9f9f9;
|
|
34
|
+
padding: 0;
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
.igloo-hsteps-button {
|
|
33
39
|
margin-top: 24px;
|
|
34
40
|
min-width: 221px;
|
|
@@ -38,7 +44,7 @@
|
|
|
38
44
|
width: 100%;
|
|
39
45
|
padding: 32px;
|
|
40
46
|
background: #ffffff;
|
|
41
|
-
margin-top:
|
|
47
|
+
margin-top: 32px;
|
|
42
48
|
border-radius: 3px;
|
|
43
49
|
}
|
|
44
50
|
}
|
package/es/form/pages/index.js
CHANGED
|
@@ -32,9 +32,9 @@ import Typography from '../../typography';
|
|
|
32
32
|
var useBreakpoint = _Grid.useBreakpoint;
|
|
33
33
|
|
|
34
34
|
var Pages = function Pages(_ref) {
|
|
35
|
-
var
|
|
36
|
-
parentName = _ref.parentName,
|
|
35
|
+
var parentName = _ref.parentName,
|
|
37
36
|
_ref$config = _ref.config,
|
|
37
|
+
name = _ref$config.name,
|
|
38
38
|
_ref$config$elements = _ref$config.elements,
|
|
39
39
|
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
40
40
|
subscribedFields = _ref$config.subscribedFields;
|
package/es/form/step/index.js
CHANGED
|
@@ -77,14 +77,23 @@ var Step = function Step(_ref) {
|
|
|
77
77
|
md = _useBreakpoint.md;
|
|
78
78
|
|
|
79
79
|
useEffect(function () {
|
|
80
|
-
var _containerRef$current, _containerRef$
|
|
80
|
+
var _containerRef$current, _containerRef$current4;
|
|
81
81
|
|
|
82
82
|
if (md || !(shouldScroll && edit)) return;
|
|
83
83
|
var scrollContainer = getScrollContainer() || window;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
if (typeof scrollContainer.scrollTo !== 'function') return;
|
|
85
|
+
|
|
86
|
+
if (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetTop) {
|
|
87
|
+
var _containerRef$current2, _containerRef$current3;
|
|
88
|
+
|
|
89
|
+
scrollContainer.scrollTo.length === 2 ? scrollContainer.scrollTo(0, (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetTop) - 50) : scrollContainer.scrollTo({
|
|
90
|
+
top: (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetTop) - 50,
|
|
91
|
+
behavior: 'smooth'
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.scrollIntoView();
|
|
88
97
|
}, [shouldScroll, edit]);
|
|
89
98
|
var displayTotal = showLastIndex ? total : total - 1;
|
|
90
99
|
return _jsxs("div", {
|
package/es/form/steps/index.js
CHANGED
|
@@ -24,9 +24,9 @@ import './style/index.less';
|
|
|
24
24
|
import invariant from 'invariant';
|
|
25
25
|
|
|
26
26
|
var Steps = function Steps(_ref) {
|
|
27
|
-
var
|
|
28
|
-
parentName = _ref.parentName,
|
|
27
|
+
var parentName = _ref.parentName,
|
|
29
28
|
_ref$config = _ref.config,
|
|
29
|
+
name = _ref$config.name,
|
|
30
30
|
_ref$config$elements = _ref$config.elements,
|
|
31
31
|
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
32
32
|
_ref$config$showLastI = _ref$config.showLastIndex,
|
package/es/upload-photo/index.js
CHANGED
|
@@ -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.
|
|
87
|
+
_context.prev = 0;
|
|
88
|
+
_context.next = 3;
|
|
88
89
|
return fetch(src, {
|
|
89
90
|
cache: 'force-cache'
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
case
|
|
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
|
|
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) {
|
|
@@ -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,
|
package/lib/form/hstep/index.js
CHANGED
|
@@ -98,14 +98,23 @@ var Step = function Step(_ref) {
|
|
|
98
98
|
md = _useBreakpoint.md;
|
|
99
99
|
|
|
100
100
|
(0, _react.useEffect)(function () {
|
|
101
|
-
var _containerRef$current, _containerRef$
|
|
101
|
+
var _containerRef$current, _containerRef$current4;
|
|
102
102
|
|
|
103
103
|
if (md || !(shouldScroll && edit)) return;
|
|
104
104
|
var scrollContainer = getScrollContainer() || window;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
if (typeof scrollContainer.scrollTo !== 'function') return;
|
|
106
|
+
|
|
107
|
+
if (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetTop) {
|
|
108
|
+
var _containerRef$current2, _containerRef$current3;
|
|
109
|
+
|
|
110
|
+
scrollContainer.scrollTo.length === 2 ? scrollContainer.scrollTo(0, (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetTop) - 50) : scrollContainer.scrollTo({
|
|
111
|
+
top: (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetTop) - 50,
|
|
112
|
+
behavior: 'smooth'
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.scrollIntoView();
|
|
109
118
|
}, [shouldScroll, edit]);
|
|
110
119
|
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
111
120
|
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -3,11 +3,17 @@ import { FormItemConfig, FormItemName } from '../../types';
|
|
|
3
3
|
import './style/index.less';
|
|
4
4
|
import { ConfirmationProps } from '../../confirmation';
|
|
5
5
|
export interface HStepsProps {
|
|
6
|
-
config: FormItemConfig
|
|
6
|
+
config: FormItemConfig & {
|
|
7
|
+
confirmations?: {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
required: boolean;
|
|
10
|
+
confirmation?: ConfirmationProps;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
withReview?: boolean;
|
|
14
|
+
};
|
|
7
15
|
parentName?: FormItemName;
|
|
8
16
|
name?: FormItemName;
|
|
9
|
-
withReview?: boolean;
|
|
10
|
-
confirmation?: ConfirmationProps;
|
|
11
17
|
}
|
|
12
18
|
declare const HSteps: FC<HStepsProps>;
|
|
13
19
|
export default HSteps;
|
package/lib/form/hsteps/index.js
CHANGED
|
@@ -78,8 +78,7 @@ var useBreakpoint = _grid.default.useBreakpoint;
|
|
|
78
78
|
var HSteps = function HSteps(_ref) {
|
|
79
79
|
var _renderElements$curre2, _renderElements$curre3;
|
|
80
80
|
|
|
81
|
-
var
|
|
82
|
-
parentName = _ref.parentName,
|
|
81
|
+
var parentName = _ref.parentName,
|
|
83
82
|
_ref$config = _ref.config,
|
|
84
83
|
_ref$config$elements = _ref$config.elements,
|
|
85
84
|
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
@@ -87,10 +86,10 @@ var HSteps = function HSteps(_ref) {
|
|
|
87
86
|
currentStep = _ref$config$currentSt === void 0 ? 0 : _ref$config$currentSt,
|
|
88
87
|
subscribedFields = _ref$config.subscribedFields,
|
|
89
88
|
onEdit = _ref$config.onEdit,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
_ref$
|
|
93
|
-
|
|
89
|
+
confirmations = _ref$config.confirmations,
|
|
90
|
+
_ref$config$withRevie = _ref$config.withReview,
|
|
91
|
+
withReview = _ref$config$withRevie === void 0 ? true : _ref$config$withRevie,
|
|
92
|
+
name = _ref$config.name;
|
|
94
93
|
|
|
95
94
|
var _useState = (0, _react.useState)(0),
|
|
96
95
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -288,9 +287,7 @@ var HSteps = function HSteps(_ref) {
|
|
|
288
287
|
})]
|
|
289
288
|
})]
|
|
290
289
|
}), (0, _jsxRuntime.jsxs)("div", {
|
|
291
|
-
className:
|
|
292
|
-
'igloo-hsteps-content': !md
|
|
293
|
-
}),
|
|
290
|
+
className: "igloo-hsteps-content",
|
|
294
291
|
children: [current < renderElements.length && (0, _jsxRuntime.jsx)(_formStepContext.default.Provider, {
|
|
295
292
|
value: {
|
|
296
293
|
registerSection: registerSection
|
|
@@ -307,7 +304,7 @@ var HSteps = function HSteps(_ref) {
|
|
|
307
304
|
shouldScroll: shouldScroll
|
|
308
305
|
}, ((_renderElements$curre2 = renderElements[current]) === null || _renderElements$curre2 === void 0 ? void 0 : _renderElements$curre2.key) || ((_renderElements$curre3 = renderElements[current]) === null || _renderElements$curre3 === void 0 ? void 0 : _renderElements$curre3.name))
|
|
309
306
|
}), current === renderElements.length && (0, _jsxRuntime.jsxs)("div", {
|
|
310
|
-
className: "igloo-
|
|
307
|
+
className: "igloo-hsteps-confirmation-container",
|
|
311
308
|
children: [withReview && !md && (0, _jsxRuntime.jsxs)(_typography.default, {
|
|
312
309
|
className: "igloo-hstep-label",
|
|
313
310
|
level: "h3a",
|
|
@@ -358,7 +355,7 @@ var HSteps = function HSteps(_ref) {
|
|
|
358
355
|
children: formatMessage({
|
|
359
356
|
id: 'Once you’re happy with the above, and you’ve checked the box below, please go ahead and submit your activation.'
|
|
360
357
|
})
|
|
361
|
-
}), (0, _jsxRuntime.jsx)(_divider.default, {}), (0, _jsxRuntime.jsx)(_form.default.Item, {
|
|
358
|
+
}), (0, _jsxRuntime.jsx)(_divider.default, {}), !confirmations && (0, _jsxRuntime.jsx)(_form.default.Item, {
|
|
362
359
|
name: (0, _formUtils.calcNamePath)(parentName, 'confirmation'),
|
|
363
360
|
rules: [{
|
|
364
361
|
validator: function validator(_, value) {
|
|
@@ -374,7 +371,33 @@ var HSteps = function HSteps(_ref) {
|
|
|
374
371
|
style: {
|
|
375
372
|
margin: 0
|
|
376
373
|
},
|
|
377
|
-
children: (0, _jsxRuntime.jsx)(_confirmation.default,
|
|
374
|
+
children: (0, _jsxRuntime.jsx)(_confirmation.default, {})
|
|
375
|
+
}), confirmations && Object.entries(confirmations).map(function (_ref6) {
|
|
376
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
377
|
+
key = _ref7[0],
|
|
378
|
+
_ref7$ = _ref7[1],
|
|
379
|
+
required = _ref7$.required,
|
|
380
|
+
_ref7$$confirmation = _ref7$.confirmation,
|
|
381
|
+
confirmation = _ref7$$confirmation === void 0 ? {} : _ref7$$confirmation;
|
|
382
|
+
|
|
383
|
+
return (0, _jsxRuntime.jsx)(_form.default.Item, {
|
|
384
|
+
name: (0, _formUtils.calcNamePath)(parentName, key),
|
|
385
|
+
rules: [{
|
|
386
|
+
validator: function validator(_, value) {
|
|
387
|
+
if (required && !value) {
|
|
388
|
+
return Promise.reject(formatMessage({
|
|
389
|
+
id: 'Please read and agree to Igloo Terms of Use and Privacy Policy'
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return Promise.resolve();
|
|
394
|
+
}
|
|
395
|
+
}],
|
|
396
|
+
style: {
|
|
397
|
+
margin: 0
|
|
398
|
+
},
|
|
399
|
+
children: (0, _jsxRuntime.jsx)(_confirmation.default, _objectSpread({}, confirmation))
|
|
400
|
+
});
|
|
378
401
|
}), showSubmitButton && md && (0, _jsxRuntime.jsx)(_form.default.Item, {
|
|
379
402
|
style: {
|
|
380
403
|
marginBottom: 0
|
|
@@ -29,6 +29,12 @@
|
|
|
29
29
|
width: 100%;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
.igloo-hsteps-confirmation-container {
|
|
33
|
+
background: #f9f9f9;
|
|
34
|
+
padding: 0;
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
.igloo-hsteps-button {
|
|
33
39
|
margin-top: 24px;
|
|
34
40
|
min-width: 221px;
|
|
@@ -38,7 +44,7 @@
|
|
|
38
44
|
width: 100%;
|
|
39
45
|
padding: 32px;
|
|
40
46
|
background: #ffffff;
|
|
41
|
-
margin-top:
|
|
47
|
+
margin-top: 32px;
|
|
42
48
|
border-radius: 3px;
|
|
43
49
|
}
|
|
44
50
|
}
|
package/lib/form/pages/index.js
CHANGED
|
@@ -54,9 +54,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
54
54
|
var useBreakpoint = _grid.default.useBreakpoint;
|
|
55
55
|
|
|
56
56
|
var Pages = function Pages(_ref) {
|
|
57
|
-
var
|
|
58
|
-
parentName = _ref.parentName,
|
|
57
|
+
var parentName = _ref.parentName,
|
|
59
58
|
_ref$config = _ref.config,
|
|
59
|
+
name = _ref$config.name,
|
|
60
60
|
_ref$config$elements = _ref$config.elements,
|
|
61
61
|
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
62
62
|
subscribedFields = _ref$config.subscribedFields;
|
package/lib/form/step/index.js
CHANGED
|
@@ -101,14 +101,23 @@ var Step = function Step(_ref) {
|
|
|
101
101
|
md = _useBreakpoint.md;
|
|
102
102
|
|
|
103
103
|
(0, _react.useEffect)(function () {
|
|
104
|
-
var _containerRef$current, _containerRef$
|
|
104
|
+
var _containerRef$current, _containerRef$current4;
|
|
105
105
|
|
|
106
106
|
if (md || !(shouldScroll && edit)) return;
|
|
107
107
|
var scrollContainer = getScrollContainer() || window;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
if (typeof scrollContainer.scrollTo !== 'function') return;
|
|
109
|
+
|
|
110
|
+
if (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetTop) {
|
|
111
|
+
var _containerRef$current2, _containerRef$current3;
|
|
112
|
+
|
|
113
|
+
scrollContainer.scrollTo.length === 2 ? scrollContainer.scrollTo(0, (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetTop) - 50) : scrollContainer.scrollTo({
|
|
114
|
+
top: (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetTop) - 50,
|
|
115
|
+
behavior: 'smooth'
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.scrollIntoView();
|
|
112
121
|
}, [shouldScroll, edit]);
|
|
113
122
|
var displayTotal = showLastIndex ? total : total - 1;
|
|
114
123
|
return (0, _jsxRuntime.jsxs)("div", {
|
package/lib/form/steps/index.js
CHANGED
|
@@ -40,9 +40,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
40
40
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
41
41
|
|
|
42
42
|
var Steps = function Steps(_ref) {
|
|
43
|
-
var
|
|
44
|
-
parentName = _ref.parentName,
|
|
43
|
+
var parentName = _ref.parentName,
|
|
45
44
|
_ref$config = _ref.config,
|
|
45
|
+
name = _ref$config.name,
|
|
46
46
|
_ref$config$elements = _ref$config.elements,
|
|
47
47
|
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
48
48
|
_ref$config$showLastI = _ref$config.showLastIndex,
|
|
@@ -117,22 +117,28 @@ var getFileType = /*#__PURE__*/function () {
|
|
|
117
117
|
while (1) {
|
|
118
118
|
switch (_context.prev = _context.next) {
|
|
119
119
|
case 0:
|
|
120
|
-
_context.
|
|
120
|
+
_context.prev = 0;
|
|
121
|
+
_context.next = 3;
|
|
121
122
|
return fetch(src, {
|
|
122
123
|
cache: 'force-cache'
|
|
123
124
|
});
|
|
124
125
|
|
|
125
|
-
case
|
|
126
|
+
case 3:
|
|
126
127
|
r = _context.sent;
|
|
127
128
|
contentType = r.headers.get('content-type');
|
|
128
129
|
return _context.abrupt("return", ClassifyType(contentType));
|
|
129
130
|
|
|
130
|
-
case
|
|
131
|
+
case 8:
|
|
132
|
+
_context.prev = 8;
|
|
133
|
+
_context.t0 = _context["catch"](0);
|
|
134
|
+
return _context.abrupt("return", 'unknown');
|
|
135
|
+
|
|
136
|
+
case 11:
|
|
131
137
|
case "end":
|
|
132
138
|
return _context.stop();
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
|
-
}, _callee);
|
|
141
|
+
}, _callee, null, [[0, 8]]);
|
|
136
142
|
}));
|
|
137
143
|
|
|
138
144
|
return function getFileType(_x) {
|