iglooform 2.5.5 → 2.5.8
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/confirmation/index.d.ts +2 -2
- package/es/confirmation/index.js +37 -2
- package/es/filter/checkBox.d.ts +4 -3
- package/es/filter/checkBox.js +31 -7
- package/es/filter/index.js +4 -2
- package/es/filter/radioBox.d.ts +2 -1
- package/es/filter/radioBox.js +24 -3
- package/es/form/hstep/index.d.ts +17 -0
- package/es/form/hstep/index.js +149 -0
- package/es/form/hstep/style/index.d.ts +1 -0
- package/es/form/hstep/style/index.js +1 -0
- package/es/form/hstep/style/index.less +84 -0
- package/es/form/hsteps/index.d.ts +13 -0
- package/es/form/hsteps/index.js +384 -0
- package/es/form/hsteps/style/index.d.ts +1 -0
- package/es/form/hsteps/style/index.js +1 -0
- package/es/form/hsteps/style/index.less +72 -0
- package/es/form/index.js +31 -40
- package/es/form/section/index.d.ts +2 -0
- package/es/form/section/index.js +70 -10
- package/es/form/section/style/index.less +14 -0
- package/es/form/step/index.js +1 -5
- package/es/form/steps/index.js +25 -13
- package/es/form-step-context.d.ts +6 -0
- package/es/form-step-context.js +4 -0
- package/es/free-form/index.js +24 -38
- package/es/input/input-number.js +2 -2
- package/es/locale/en-US/messages.json +9 -0
- package/es/locale/id-ID/messages.json +9 -0
- package/es/locale/th-TH/messages.json +9 -0
- package/es/locale/vi-VN/messages.json +9 -0
- package/es/locale/zh-CN/messages.json +9 -0
- package/es/locale/zh-TW/messages.json +9 -0
- package/es/select/style/index.less +1 -0
- package/es/types.d.ts +13 -1
- package/es/utils/form-utils.js +84 -1
- package/es/utils/option-utils.js +5 -1
- package/lib/confirmation/index.d.ts +2 -2
- package/lib/confirmation/index.js +37 -1
- package/lib/filter/checkBox.d.ts +4 -3
- package/lib/filter/checkBox.js +31 -7
- package/lib/filter/index.js +4 -2
- package/lib/filter/radioBox.d.ts +2 -1
- package/lib/filter/radioBox.js +24 -3
- package/lib/form/hstep/index.d.ts +17 -0
- package/lib/form/hstep/index.js +174 -0
- package/lib/form/hstep/style/index.d.ts +1 -0
- package/lib/form/hstep/style/index.js +3 -0
- package/lib/form/hstep/style/index.less +84 -0
- package/lib/form/hsteps/index.d.ts +13 -0
- package/lib/form/hsteps/index.js +414 -0
- package/lib/form/hsteps/style/index.d.ts +1 -0
- package/lib/form/hsteps/style/index.js +3 -0
- package/lib/form/hsteps/style/index.less +72 -0
- package/lib/form/index.js +31 -39
- package/lib/form/section/index.d.ts +2 -0
- package/lib/form/section/index.js +72 -8
- package/lib/form/section/style/index.less +14 -0
- package/lib/form/step/index.js +1 -5
- package/lib/form/steps/index.js +25 -12
- package/lib/form-step-context.d.ts +6 -0
- package/lib/form-step-context.js +16 -0
- package/lib/free-form/index.js +23 -37
- package/lib/input/input-number.js +2 -2
- package/lib/locale/en-US/messages.json +9 -0
- package/lib/locale/id-ID/messages.json +9 -0
- package/lib/locale/th-TH/messages.json +9 -0
- package/lib/locale/vi-VN/messages.json +9 -0
- package/lib/locale/zh-CN/messages.json +9 -0
- package/lib/locale/zh-TW/messages.json +9 -0
- package/lib/select/style/index.less +1 -0
- package/lib/types.d.ts +13 -1
- package/lib/utils/form-utils.js +85 -1
- package/lib/utils/option-utils.js +5 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { FC } from '../types';
|
|
3
|
-
interface ConfirmationProps {
|
|
3
|
+
export interface ConfirmationProps {
|
|
4
4
|
onChange?: Function;
|
|
5
5
|
value?: boolean;
|
|
6
|
-
message
|
|
6
|
+
message?: ReactNode;
|
|
7
7
|
modalContent?: ReactNode;
|
|
8
8
|
modalTitle?: ReactNode;
|
|
9
9
|
okText?: ReactNode;
|
package/es/confirmation/index.js
CHANGED
|
@@ -10,11 +10,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { useState, useContext } from 'react';
|
|
15
15
|
import Modal from '../modal';
|
|
16
16
|
import Typography from '../typography';
|
|
17
17
|
import Checkbox from '../checkbox';
|
|
18
|
+
import Button from '../button';
|
|
18
19
|
import LocaleContext from '../locale/locale-context';
|
|
19
20
|
|
|
20
21
|
var Confirmation = function Confirmation(_ref) {
|
|
@@ -86,7 +87,41 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
86
87
|
cursor: 'pointer',
|
|
87
88
|
marginLeft: 8
|
|
88
89
|
},
|
|
89
|
-
children: message
|
|
90
|
+
children: message || _jsxs(_Fragment, {
|
|
91
|
+
children: [formatMessage({
|
|
92
|
+
id: 'I agree to the Igloo'
|
|
93
|
+
}), _jsx(Button, {
|
|
94
|
+
type: "link",
|
|
95
|
+
href: "https://contents.iglooinsure.com/termsofservice",
|
|
96
|
+
target: '_blank',
|
|
97
|
+
style: {
|
|
98
|
+
margin: '0 4px',
|
|
99
|
+
lineHeight: 'inherit'
|
|
100
|
+
},
|
|
101
|
+
onClick: function onClick(e) {
|
|
102
|
+
return e.stopPropagation();
|
|
103
|
+
},
|
|
104
|
+
children: formatMessage({
|
|
105
|
+
id: 'Terms of Use'
|
|
106
|
+
})
|
|
107
|
+
}), formatMessage({
|
|
108
|
+
id: 'and'
|
|
109
|
+
}), _jsx(Button, {
|
|
110
|
+
type: "link",
|
|
111
|
+
href: "https://contents.iglooinsure.com/privacypolicy",
|
|
112
|
+
style: {
|
|
113
|
+
margin: '0 4px',
|
|
114
|
+
lineHeight: 'inherit'
|
|
115
|
+
},
|
|
116
|
+
target: '_blank',
|
|
117
|
+
onClick: function onClick(e) {
|
|
118
|
+
return e.stopPropagation();
|
|
119
|
+
},
|
|
120
|
+
children: formatMessage({
|
|
121
|
+
id: 'Privacy Policy'
|
|
122
|
+
})
|
|
123
|
+
})]
|
|
124
|
+
})
|
|
90
125
|
}), modalContent && _jsx(Modal, {
|
|
91
126
|
title: modalTitle,
|
|
92
127
|
visible: visible,
|
package/es/filter/checkBox.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const CreateCheckBoxFilter: (props: {
|
|
2
2
|
title: any;
|
|
3
3
|
configList: any[];
|
|
4
4
|
optionKey: string;
|
|
5
5
|
allSelected: any[];
|
|
6
|
-
|
|
6
|
+
handleOptionsChange: any;
|
|
7
7
|
chooseed?: string[];
|
|
8
8
|
onChange?: any;
|
|
9
9
|
disabled?: any[];
|
|
10
|
+
setConfirmValue?: any;
|
|
10
11
|
}) => JSX.Element;
|
|
11
|
-
export default
|
|
12
|
+
export default CreateCheckBoxFilter;
|
package/es/filter/checkBox.js
CHANGED
|
@@ -7,6 +7,12 @@ import _Row from "antd/es/row";
|
|
|
7
7
|
import "antd/es/checkbox/style";
|
|
8
8
|
import _Checkbox from "antd/es/checkbox";
|
|
9
9
|
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
10
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
17
|
|
|
12
18
|
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."); }
|
|
@@ -37,7 +43,7 @@ function handleFilterDisable() {
|
|
|
37
43
|
});
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
var
|
|
46
|
+
var CreateCheckBoxFilter = function CreateCheckBoxFilter(props) {
|
|
41
47
|
var _useContext = useContext(LocaleContext),
|
|
42
48
|
formatMessage = _useContext.formatMessage;
|
|
43
49
|
|
|
@@ -51,8 +57,10 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
51
57
|
chooseed = _props$chooseed === void 0 ? [] : _props$chooseed,
|
|
52
58
|
disabled = props.disabled,
|
|
53
59
|
_onChange = props.onChange,
|
|
54
|
-
_props$
|
|
55
|
-
|
|
60
|
+
_props$setConfirmValu = props.setConfirmValue,
|
|
61
|
+
setConfirmValue = _props$setConfirmValu === void 0 ? function () {} : _props$setConfirmValu,
|
|
62
|
+
_props$handleOptionsC = props.handleOptionsChange,
|
|
63
|
+
handleOptionsChange = _props$handleOptionsC === void 0 ? function () {} : _props$handleOptionsC;
|
|
56
64
|
var timeKey = new Date();
|
|
57
65
|
|
|
58
66
|
var _useState = useState(false),
|
|
@@ -69,6 +77,22 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
69
77
|
setAllChoose(false);
|
|
70
78
|
}
|
|
71
79
|
}, [chooseed.length, allSelected]);
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
var filterDisabled = chooseed.filter(function (e) {
|
|
82
|
+
return !(disabled === null || disabled === void 0 ? void 0 : disabled.includes(e));
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (filterDisabled.length !== chooseed.length) {
|
|
86
|
+
handleOptionsChange({
|
|
87
|
+
type: optionKey,
|
|
88
|
+
value: filterDisabled
|
|
89
|
+
});
|
|
90
|
+
setConfirmValue(function (old) {
|
|
91
|
+
return _objectSpread(_objectSpread({}, old), {}, _defineProperty({}, optionKey, filterDisabled));
|
|
92
|
+
});
|
|
93
|
+
typeof _onChange === 'function' && _onChange(filterDisabled);
|
|
94
|
+
}
|
|
95
|
+
}, [disabled]);
|
|
72
96
|
return _jsxs("div", {
|
|
73
97
|
className: "igloo-form-filter-drop-down-container-content-group",
|
|
74
98
|
children: [_jsxs("div", {
|
|
@@ -80,7 +104,7 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
80
104
|
className: "igloo-form-filter-drop-down-container-content-group-title-action",
|
|
81
105
|
onClick: function onClick() {
|
|
82
106
|
typeof _onChange === 'function' && _onChange([]);
|
|
83
|
-
|
|
107
|
+
handleOptionsChange({
|
|
84
108
|
type: optionKey,
|
|
85
109
|
value: []
|
|
86
110
|
});
|
|
@@ -96,7 +120,7 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
96
120
|
className: "igloo-form-filter-drop-down-container-content-group-title-action",
|
|
97
121
|
onClick: function onClick() {
|
|
98
122
|
typeof _onChange === 'function' && _onChange(nowValidList);
|
|
99
|
-
|
|
123
|
+
handleOptionsChange({
|
|
100
124
|
type: optionKey,
|
|
101
125
|
value: nowValidList
|
|
102
126
|
});
|
|
@@ -116,7 +140,7 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
116
140
|
},
|
|
117
141
|
onChange: function onChange(e) {
|
|
118
142
|
typeof _onChange === 'function' && _onChange(e);
|
|
119
|
-
|
|
143
|
+
handleOptionsChange({
|
|
120
144
|
type: optionKey,
|
|
121
145
|
value: e
|
|
122
146
|
});
|
|
@@ -145,4 +169,4 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
145
169
|
}, optionKey);
|
|
146
170
|
};
|
|
147
171
|
|
|
148
|
-
export default
|
|
172
|
+
export default CreateCheckBoxFilter;
|
package/es/filter/index.js
CHANGED
|
@@ -687,7 +687,8 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
687
687
|
allSelected: optionsAllSelected[key],
|
|
688
688
|
chooseed: optionsChanged[key],
|
|
689
689
|
disabled: disabled,
|
|
690
|
-
|
|
690
|
+
handleOptionsChange: dispatchOptionsChange,
|
|
691
|
+
setConfirmValue: setConfimed,
|
|
691
692
|
onChange: onChangeProps
|
|
692
693
|
}, key);
|
|
693
694
|
|
|
@@ -699,7 +700,8 @@ var FilterComponent = function FilterComponent(props) {
|
|
|
699
700
|
optionKey: key,
|
|
700
701
|
chooseed: optionsChanged[key],
|
|
701
702
|
disabled: disabled,
|
|
702
|
-
|
|
703
|
+
handleOptionsChange: dispatchOptionsChange,
|
|
704
|
+
setConfirmValue: setConfimed,
|
|
703
705
|
onChange: onChangeProps
|
|
704
706
|
}, key);
|
|
705
707
|
}
|
package/es/filter/radioBox.d.ts
CHANGED
package/es/filter/radioBox.js
CHANGED
|
@@ -6,17 +6,38 @@ import "antd/es/row/style";
|
|
|
6
6
|
import _Row from "antd/es/row";
|
|
7
7
|
import "antd/es/radio/style";
|
|
8
8
|
import _Radio from "antd/es/radio";
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
9
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
17
|
import Typography from '../typography';
|
|
18
|
+
import { useEffect } from 'react';
|
|
11
19
|
|
|
12
20
|
var CreateRadioBoxFilter = function CreateRadioBoxFilter(props) {
|
|
13
21
|
var optionKey = props.optionKey,
|
|
14
22
|
title = props.title,
|
|
15
23
|
configList = props.configList,
|
|
16
24
|
disabled = props.disabled,
|
|
17
|
-
|
|
25
|
+
handleOptionsChange = props.handleOptionsChange,
|
|
26
|
+
setConfirmValue = props.setConfirmValue,
|
|
18
27
|
chooseed = props.chooseed,
|
|
19
28
|
_onChange = props.onChange;
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
if (disabled === null || disabled === void 0 ? void 0 : disabled.includes(chooseed)) {
|
|
31
|
+
typeof _onChange === 'function' && _onChange(undefined);
|
|
32
|
+
handleOptionsChange({
|
|
33
|
+
type: optionKey,
|
|
34
|
+
value: undefined
|
|
35
|
+
});
|
|
36
|
+
setConfirmValue(function (old) {
|
|
37
|
+
return _objectSpread(_objectSpread({}, old), {}, _defineProperty({}, optionKey, undefined));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, [disabled]);
|
|
20
41
|
return _jsxs("div", {
|
|
21
42
|
className: "igloo-form-filter-drop-down-container-content-group",
|
|
22
43
|
children: [_jsx("div", {
|
|
@@ -26,10 +47,10 @@ var CreateRadioBoxFilter = function CreateRadioBoxFilter(props) {
|
|
|
26
47
|
children: title
|
|
27
48
|
})
|
|
28
49
|
}), _jsx(_Radio.Group, {
|
|
29
|
-
value: chooseed,
|
|
50
|
+
value: (disabled === null || disabled === void 0 ? void 0 : disabled.includes(chooseed)) ? undefined : chooseed,
|
|
30
51
|
onChange: function onChange(e) {
|
|
31
52
|
typeof _onChange === 'function' && _onChange(e.target.value);
|
|
32
|
-
|
|
53
|
+
handleOptionsChange({
|
|
33
54
|
type: optionKey,
|
|
34
55
|
value: e.target.value
|
|
35
56
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormItemConfig, FormItemName } from '../../types';
|
|
3
|
+
import './style/index.less';
|
|
4
|
+
export interface StepProps {
|
|
5
|
+
parentName?: FormItemName;
|
|
6
|
+
config: FormItemConfig;
|
|
7
|
+
edit: boolean;
|
|
8
|
+
preview: boolean;
|
|
9
|
+
index: number;
|
|
10
|
+
total: number;
|
|
11
|
+
handleNext(): void;
|
|
12
|
+
handleEdit(index: number): void;
|
|
13
|
+
showLastIndex?: boolean;
|
|
14
|
+
shouldScroll: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const Step: FC<StepProps>;
|
|
17
|
+
export default Step;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import "antd/es/divider/style";
|
|
2
|
+
import _Divider from "antd/es/divider";
|
|
3
|
+
import "antd/es/row/style";
|
|
4
|
+
import _Row from "antd/es/row";
|
|
5
|
+
import "antd/es/grid/style";
|
|
6
|
+
import _Grid from "antd/es/grid";
|
|
7
|
+
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
|
|
10
|
+
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."); }
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
import { useContext, useState, useRef, useEffect } from 'react';
|
|
22
|
+
import { LocaleContext } from '../../locale';
|
|
23
|
+
import Button from '../../button';
|
|
24
|
+
import Element from '../element';
|
|
25
|
+
import { calcNamePath } from '../../utils/form-utils';
|
|
26
|
+
import FormContext from '../../form-context';
|
|
27
|
+
import Typography from '../../typography';
|
|
28
|
+
import classnames from 'classnames';
|
|
29
|
+
import './style/index.less';
|
|
30
|
+
var useBreakpoint = _Grid.useBreakpoint;
|
|
31
|
+
|
|
32
|
+
var Step = function Step(_ref) {
|
|
33
|
+
var parentName = _ref.parentName,
|
|
34
|
+
_ref$config = _ref.config,
|
|
35
|
+
_ref$config$elements = _ref$config.elements,
|
|
36
|
+
elements = _ref$config$elements === void 0 ? [] : _ref$config$elements,
|
|
37
|
+
name = _ref$config.name,
|
|
38
|
+
label = _ref$config.label,
|
|
39
|
+
editButtonLabel = _ref$config.editButtonLabel,
|
|
40
|
+
getButtonDisabledState = _ref$config.getButtonDisabledState,
|
|
41
|
+
disableEditButton = _ref$config.disableEditButton,
|
|
42
|
+
buttonText = _ref$config.buttonText,
|
|
43
|
+
edit = _ref.edit,
|
|
44
|
+
preview = _ref.preview,
|
|
45
|
+
index = _ref.index,
|
|
46
|
+
total = _ref.total,
|
|
47
|
+
handleNext = _ref.handleNext,
|
|
48
|
+
handleEditProp = _ref.handleEdit,
|
|
49
|
+
showLastIndex = _ref.showLastIndex,
|
|
50
|
+
shouldScroll = _ref.shouldScroll;
|
|
51
|
+
|
|
52
|
+
var _useContext = useContext(LocaleContext),
|
|
53
|
+
formatMessage = _useContext.formatMessage;
|
|
54
|
+
|
|
55
|
+
var _useContext2 = useContext(FormContext),
|
|
56
|
+
continueText = _useContext2.continueText,
|
|
57
|
+
form = _useContext2.form,
|
|
58
|
+
getScrollContainer = _useContext2.getScrollContainer;
|
|
59
|
+
|
|
60
|
+
var _useState = useState(true),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
showButton = _useState2[0],
|
|
63
|
+
setShowButton = _useState2[1];
|
|
64
|
+
|
|
65
|
+
var containerRef = useRef(null);
|
|
66
|
+
|
|
67
|
+
var handleEdit = function handleEdit() {
|
|
68
|
+
return handleEditProp(index);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var buttonDisabled = getButtonDisabledState && form && getButtonDisabledState(form);
|
|
72
|
+
|
|
73
|
+
var _useBreakpoint = useBreakpoint(),
|
|
74
|
+
md = _useBreakpoint.md;
|
|
75
|
+
|
|
76
|
+
useEffect(function () {
|
|
77
|
+
var _containerRef$current, _containerRef$current2, _containerRef$current3;
|
|
78
|
+
|
|
79
|
+
if (md || !(shouldScroll && edit)) return;
|
|
80
|
+
var scrollContainer = getScrollContainer() || window;
|
|
81
|
+
(containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetTop) ? scrollContainer.scrollTo({
|
|
82
|
+
top: (containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetTop) - 50,
|
|
83
|
+
behavior: 'smooth'
|
|
84
|
+
}) : containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.scrollIntoView();
|
|
85
|
+
}, [shouldScroll, edit]);
|
|
86
|
+
return _jsxs(_Fragment, {
|
|
87
|
+
children: [_jsxs("div", {
|
|
88
|
+
className: classnames('igloo-hstep-container', {
|
|
89
|
+
'igloo-hstep-container-preview': preview
|
|
90
|
+
}),
|
|
91
|
+
ref: containerRef,
|
|
92
|
+
children: [_jsxs(Typography, {
|
|
93
|
+
className: "igloo-hstep-label",
|
|
94
|
+
level: "h3a",
|
|
95
|
+
children: [_jsx("span", {
|
|
96
|
+
className: "igloo-hstep-label-text",
|
|
97
|
+
children: label
|
|
98
|
+
}), preview && _jsx(Button, {
|
|
99
|
+
type: "link",
|
|
100
|
+
className: "igloo-hstep-label-edit",
|
|
101
|
+
onClick: handleEdit,
|
|
102
|
+
disabled: disableEditButton,
|
|
103
|
+
children: editButtonLabel || formatMessage({
|
|
104
|
+
id: 'Edit'
|
|
105
|
+
})
|
|
106
|
+
}), edit && !md && _jsxs(Typography, {
|
|
107
|
+
level: "body3",
|
|
108
|
+
children: [index + 1, "/", total]
|
|
109
|
+
})]
|
|
110
|
+
}), (edit || preview) && _jsxs("div", {
|
|
111
|
+
className: 'igloo-hstep-content',
|
|
112
|
+
children: [_jsx(_Row, {
|
|
113
|
+
gutter: [32, preview ? 16 : 24],
|
|
114
|
+
children: elements.map(function (child, index) {
|
|
115
|
+
return _jsx(Element, {
|
|
116
|
+
config: child,
|
|
117
|
+
parentName: calcNamePath(parentName, name),
|
|
118
|
+
setShowStepButton: setShowButton,
|
|
119
|
+
preview: preview
|
|
120
|
+
}, index);
|
|
121
|
+
})
|
|
122
|
+
}), edit && showButton && md && _jsx(Button, {
|
|
123
|
+
onClick: handleNext,
|
|
124
|
+
className: 'igloo-hstep-button',
|
|
125
|
+
type: "primary",
|
|
126
|
+
disabled: buttonDisabled,
|
|
127
|
+
children: buttonText || continueText || formatMessage({
|
|
128
|
+
id: 'Continue'
|
|
129
|
+
})
|
|
130
|
+
})]
|
|
131
|
+
}), !edit && !preview && _jsx(_Divider, {
|
|
132
|
+
className: "igloo-hstep-divider"
|
|
133
|
+
})]
|
|
134
|
+
}), edit && showButton && !md && _jsx("div", {
|
|
135
|
+
className: "igloo-hstep-button-container",
|
|
136
|
+
children: _jsx(Button, {
|
|
137
|
+
onClick: handleNext,
|
|
138
|
+
className: 'igloo-hstep-button',
|
|
139
|
+
type: "primary",
|
|
140
|
+
disabled: buttonDisabled,
|
|
141
|
+
children: buttonText || continueText || formatMessage({
|
|
142
|
+
id: 'Continue'
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export default Step;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.igloo-hstep-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
background: #ffffff;
|
|
4
|
+
padding: 32px;
|
|
5
|
+
margin-top: 16px;
|
|
6
|
+
|
|
7
|
+
.igloo-hstep-label {
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
font-size: 20px;
|
|
12
|
+
line-height: 28px;
|
|
13
|
+
margin-bottom: 16px;
|
|
14
|
+
|
|
15
|
+
.igloo-hstep-label-edit {
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
color: @primary-color;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.igloo-hstep-label-text {
|
|
23
|
+
color: #212121;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.igloo-hstep-content {
|
|
28
|
+
width: 100%;
|
|
29
|
+
|
|
30
|
+
.igloo-hstep-button {
|
|
31
|
+
min-width: 221px;
|
|
32
|
+
margin-top: 32px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.igloo-hstep-divider {
|
|
37
|
+
margin-top: 16px;
|
|
38
|
+
border-color: #bdbdbd;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media screen and (max-width: 768px) {
|
|
43
|
+
.igloo-hstep-container-preview {
|
|
44
|
+
background: #f9f9f9;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.igloo-hstep-container {
|
|
48
|
+
width: 100%;
|
|
49
|
+
padding: 24px 16px;
|
|
50
|
+
|
|
51
|
+
.igloo-hstep-content {
|
|
52
|
+
margin-top: 24px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.igloo-hstep-divider {
|
|
56
|
+
margin-top: 8px;
|
|
57
|
+
width: auto;
|
|
58
|
+
min-width: auto;
|
|
59
|
+
margin-left: 16px;
|
|
60
|
+
margin-right: 16px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.igloo-hstep-label {
|
|
64
|
+
margin-bottom: 8px;
|
|
65
|
+
font-size: 16px;
|
|
66
|
+
line-height: 24px;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.igloo-hstep-button-container {
|
|
71
|
+
width: 100%;
|
|
72
|
+
position: sticky;
|
|
73
|
+
bottom: 0;
|
|
74
|
+
box-shadow: 0px 0px 1px rgba(20, 20, 20, 0.04),
|
|
75
|
+
0px 1px 8px 2px rgba(20, 20, 20, 0.08);
|
|
76
|
+
|
|
77
|
+
padding: 24px 16px;
|
|
78
|
+
background: #ffffff;
|
|
79
|
+
|
|
80
|
+
.igloo-hstep-button {
|
|
81
|
+
width: 100%;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FormItemConfig, FormItemName } from '../../types';
|
|
3
|
+
import './style/index.less';
|
|
4
|
+
import { ConfirmationProps } from '../../confirmation';
|
|
5
|
+
export interface HStepsProps {
|
|
6
|
+
config: FormItemConfig;
|
|
7
|
+
parentName?: FormItemName;
|
|
8
|
+
name?: FormItemName;
|
|
9
|
+
withReview?: boolean;
|
|
10
|
+
confirmation?: ConfirmationProps;
|
|
11
|
+
}
|
|
12
|
+
declare const HSteps: FC<HStepsProps>;
|
|
13
|
+
export default HSteps;
|