iglooform 2.4.33 → 2.4.34
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 +1 -0
- package/es/confirmation/index.js +11 -2
- package/es/form/addable-section/index.d.ts +1 -0
- package/es/form/addable-section/index.js +16 -5
- package/es/form/render/index.d.ts +2 -2
- package/es/free-form/addable-section/index.d.ts +1 -0
- package/es/free-form/addable-section/index.js +16 -5
- package/es/input/amount.js +15 -2
- package/es/select/attached-select.js +26 -20
- package/es/types.d.ts +3 -2
- package/es/utils/form-utils.js +4 -1
- package/lib/confirmation/index.d.ts +1 -0
- package/lib/confirmation/index.js +11 -2
- package/lib/form/addable-section/index.d.ts +1 -0
- package/lib/form/addable-section/index.js +16 -5
- package/lib/form/render/index.d.ts +2 -2
- package/lib/free-form/addable-section/index.d.ts +1 -0
- package/lib/free-form/addable-section/index.js +16 -5
- package/lib/input/amount.js +15 -2
- package/lib/select/attached-select.js +26 -20
- package/lib/types.d.ts +3 -2
- package/lib/utils/form-utils.js +4 -1
- package/package.json +1 -1
package/es/confirmation/index.js
CHANGED
|
@@ -24,7 +24,8 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
24
24
|
modalContent = _ref.modalContent,
|
|
25
25
|
modalTitle = _ref.modalTitle,
|
|
26
26
|
okText = _ref.okText,
|
|
27
|
-
cancelText = _ref.cancelText
|
|
27
|
+
cancelText = _ref.cancelText,
|
|
28
|
+
href = _ref.href;
|
|
28
29
|
|
|
29
30
|
var _useState = useState(false),
|
|
30
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -71,6 +72,14 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
71
72
|
return setVisible(true);
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
if (href) {
|
|
76
|
+
var a = document.createElement('a');
|
|
77
|
+
a.href = href;
|
|
78
|
+
a.target = '_blank';
|
|
79
|
+
a.click();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
74
83
|
onChange && onChange(!value);
|
|
75
84
|
},
|
|
76
85
|
style: {
|
|
@@ -95,7 +104,7 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
95
104
|
});
|
|
96
105
|
};
|
|
97
106
|
|
|
98
|
-
Confirmation.formItemPropsHandler = function () {
|
|
107
|
+
Confirmation.formItemPropsHandler = function (config) {
|
|
99
108
|
return {
|
|
100
109
|
fullRow: true
|
|
101
110
|
};
|
|
@@ -67,7 +67,8 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
67
67
|
_config$min = config.min,
|
|
68
68
|
min = _config$min === void 0 ? initCount : _config$min,
|
|
69
69
|
addButtonText = config.addButtonText,
|
|
70
|
-
addButtonIcon = config.addButtonIcon
|
|
70
|
+
addButtonIcon = config.addButtonIcon,
|
|
71
|
+
description = config.description;
|
|
71
72
|
|
|
72
73
|
var _useBreakpoint = useBreakpoint(),
|
|
73
74
|
md = _useBreakpoint.md;
|
|
@@ -201,12 +202,21 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
201
202
|
style: {
|
|
202
203
|
width: '100%'
|
|
203
204
|
},
|
|
204
|
-
children: [groups, groupKeys.length < max && !preview &&
|
|
205
|
+
children: [groups, groupKeys.length < max && !preview && _jsxs(_Col, {
|
|
205
206
|
span: 24,
|
|
206
207
|
style: {
|
|
207
|
-
marginTop: !md ? 24 : 32
|
|
208
|
+
marginTop: groups.length ? !md ? 24 : 32 : 0
|
|
208
209
|
},
|
|
209
|
-
children: _jsx(
|
|
210
|
+
children: [description && _jsx(Typography, {
|
|
211
|
+
level: "body1",
|
|
212
|
+
wrapElement: "div",
|
|
213
|
+
style: {
|
|
214
|
+
color: '#666666',
|
|
215
|
+
marginBottom: 8,
|
|
216
|
+
whiteSpace: 'pre-wrap'
|
|
217
|
+
},
|
|
218
|
+
children: description
|
|
219
|
+
}), _jsx(Button, {
|
|
210
220
|
onClick: function onClick() {
|
|
211
221
|
return dispath({
|
|
212
222
|
type: 'add',
|
|
@@ -215,10 +225,11 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
215
225
|
},
|
|
216
226
|
className: "igloo-form-addable-section-button",
|
|
217
227
|
icon: addButtonIcon,
|
|
228
|
+
disabled: elementProps.disabled,
|
|
218
229
|
children: addButtonText || "".concat(formatMessage({
|
|
219
230
|
id: 'Add'
|
|
220
231
|
}), " ").concat(label)
|
|
221
|
-
})
|
|
232
|
+
})]
|
|
222
233
|
})]
|
|
223
234
|
});
|
|
224
235
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC, IglooComponentProps } from '../../types';
|
|
2
2
|
import { FormInstance } from 'antd/es/form';
|
|
3
3
|
interface Props extends IglooComponentProps {
|
|
4
|
-
render?: (preview: boolean, form?: FormInstance, value?: any, onChange?:
|
|
4
|
+
render?: (preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']) => any;
|
|
5
5
|
preview?: boolean;
|
|
6
6
|
value?: any;
|
|
7
|
-
onChange?:
|
|
7
|
+
onChange?: (params: any) => any;
|
|
8
8
|
}
|
|
9
9
|
declare const RenderElement: FC<Props>;
|
|
10
10
|
export default RenderElement;
|
|
@@ -13,6 +13,7 @@ export interface AddableSectionProps extends FormItemConfig {
|
|
|
13
13
|
initCount?: number;
|
|
14
14
|
addButtonText?: string;
|
|
15
15
|
addButtonIcon?: ReactNode;
|
|
16
|
+
description?: string | ReactNode;
|
|
16
17
|
}
|
|
17
18
|
declare const AddableSection: FC<AddableSectionProps>;
|
|
18
19
|
export default AddableSection;
|
|
@@ -65,7 +65,8 @@ var AddableSection = function AddableSection(props) {
|
|
|
65
65
|
setShowStepButton = props.setShowStepButton,
|
|
66
66
|
addButtonText = props.addButtonText,
|
|
67
67
|
addButtonIcon = props.addButtonIcon,
|
|
68
|
-
children = props.children
|
|
68
|
+
children = props.children,
|
|
69
|
+
description = props.description;
|
|
69
70
|
|
|
70
71
|
var _useBreakpoint = useBreakpoint(),
|
|
71
72
|
md = _useBreakpoint.md;
|
|
@@ -275,12 +276,21 @@ var AddableSection = function AddableSection(props) {
|
|
|
275
276
|
style: {
|
|
276
277
|
width: '100%'
|
|
277
278
|
},
|
|
278
|
-
children: [groups, groupKeys.length < max && !preview &&
|
|
279
|
+
children: [groups, groupKeys.length < max && !preview && _jsxs(_Col, {
|
|
279
280
|
span: 24,
|
|
280
281
|
style: {
|
|
281
|
-
marginTop: !md ? 24 : 32
|
|
282
|
+
marginTop: groups.length ? !md ? 24 : 32 : 0
|
|
282
283
|
},
|
|
283
|
-
children: _jsx(
|
|
284
|
+
children: [description && _jsx(Typography, {
|
|
285
|
+
level: "body1",
|
|
286
|
+
wrapElement: "div",
|
|
287
|
+
style: {
|
|
288
|
+
color: '#666666',
|
|
289
|
+
marginBottom: 8,
|
|
290
|
+
whiteSpace: 'pre-wrap'
|
|
291
|
+
},
|
|
292
|
+
children: description
|
|
293
|
+
}), _jsx(Button, {
|
|
284
294
|
onClick: function onClick() {
|
|
285
295
|
return dispath({
|
|
286
296
|
type: 'add',
|
|
@@ -289,10 +299,11 @@ var AddableSection = function AddableSection(props) {
|
|
|
289
299
|
},
|
|
290
300
|
className: "igloo-addable-section-button",
|
|
291
301
|
icon: addButtonIcon,
|
|
302
|
+
disabled: elementProps.disabled,
|
|
292
303
|
children: addButtonText || "".concat(formatMessage({
|
|
293
304
|
id: 'Add'
|
|
294
305
|
}), " ").concat(label)
|
|
295
|
-
})
|
|
306
|
+
})]
|
|
296
307
|
})]
|
|
297
308
|
});
|
|
298
309
|
};
|
package/es/input/amount.js
CHANGED
|
@@ -44,7 +44,18 @@ var Amount = function Amount(_ref) {
|
|
|
44
44
|
disabled = _ref.disabled,
|
|
45
45
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
var handleOnBlur = function handleOnBlur(e) {
|
|
48
|
+
var onChange = rest.onChange;
|
|
49
|
+
|
|
50
|
+
if (typeof value === 'string' && value.endsWith('.')) {
|
|
51
|
+
e.target.value = value.replace('.', '');
|
|
52
|
+
onChange && onChange(e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return _jsx(_Input, _objectSpread(_objectSpread({
|
|
57
|
+
onBlur: handleOnBlur
|
|
58
|
+
}, omit(rest, formMethods)), {}, {
|
|
48
59
|
disabled: disabled,
|
|
49
60
|
className: classnames('igloo-input-amount', {
|
|
50
61
|
'igloo-input-disable': disabled
|
|
@@ -63,7 +74,9 @@ Amount.formItemPropsHandler = function (_ref2) {
|
|
|
63
74
|
return {
|
|
64
75
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
65
76
|
var value = e.target.value;
|
|
66
|
-
|
|
77
|
+
var str = value.replaceAll(seperator, '').replaceAll(/[^0-9\.]/g, '');
|
|
78
|
+
if (value.endsWith('.')) return str;
|
|
79
|
+
return str ? parseFloat(str) : undefined;
|
|
67
80
|
},
|
|
68
81
|
rules: [{
|
|
69
82
|
validator: function validator(_, value) {
|
|
@@ -329,7 +329,7 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
329
329
|
useEffect(function () {
|
|
330
330
|
var calcOptions = /*#__PURE__*/function () {
|
|
331
331
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
332
|
-
var
|
|
332
|
+
var _options2, query, api, rst, _yield$rst$json, data;
|
|
333
333
|
|
|
334
334
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
335
335
|
while (1) {
|
|
@@ -368,24 +368,30 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
368
368
|
|
|
369
369
|
case 6:
|
|
370
370
|
if (!optionGroups) {
|
|
371
|
-
_context.next =
|
|
371
|
+
_context.next = 11;
|
|
372
372
|
break;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
if (!dependFieldValue) {
|
|
376
|
-
_context.next =
|
|
376
|
+
_context.next = 11;
|
|
377
377
|
break;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
_options2 = [];
|
|
381
|
+
optionGroups.forEach(function (_ref13) {
|
|
382
|
+
var parentKey = _ref13.parentKey,
|
|
383
|
+
_ref13$options = _ref13.options,
|
|
384
|
+
options = _ref13$options === void 0 ? [] : _ref13$options;
|
|
385
|
+
|
|
386
|
+
if (Array.isArray(dependFieldValue) ? dependFieldValue.includes(parentKey) : parentKey === dependFieldValue) {
|
|
387
|
+
_options2.push.apply(_options2, _toConsumableArray(options));
|
|
388
|
+
}
|
|
383
389
|
});
|
|
384
|
-
return _context.abrupt("return",
|
|
390
|
+
return _context.abrupt("return", _options2);
|
|
385
391
|
|
|
386
|
-
case
|
|
392
|
+
case 11:
|
|
387
393
|
if (!(selectDatasourceApi && datasourceKey)) {
|
|
388
|
-
_context.next =
|
|
394
|
+
_context.next = 28;
|
|
389
395
|
break;
|
|
390
396
|
}
|
|
391
397
|
|
|
@@ -393,34 +399,34 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
393
399
|
return "parent=".concat(v);
|
|
394
400
|
}).join('&') : dependFieldValue ? "parent=".concat(dependFieldValue) : '';
|
|
395
401
|
api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
|
|
396
|
-
_context.prev =
|
|
397
|
-
_context.next =
|
|
402
|
+
_context.prev = 14;
|
|
403
|
+
_context.next = 17;
|
|
398
404
|
return fetch(query ? "".concat(api, "?").concat(query) : api);
|
|
399
405
|
|
|
400
|
-
case
|
|
406
|
+
case 17:
|
|
401
407
|
rst = _context.sent;
|
|
402
|
-
_context.next =
|
|
408
|
+
_context.next = 20;
|
|
403
409
|
return rst.json();
|
|
404
410
|
|
|
405
|
-
case
|
|
411
|
+
case 20:
|
|
406
412
|
_yield$rst$json = _context.sent;
|
|
407
413
|
data = _yield$rst$json.data;
|
|
408
414
|
return _context.abrupt("return", data || []);
|
|
409
415
|
|
|
410
|
-
case
|
|
411
|
-
_context.prev =
|
|
412
|
-
_context.t0 = _context["catch"](
|
|
416
|
+
case 25:
|
|
417
|
+
_context.prev = 25;
|
|
418
|
+
_context.t0 = _context["catch"](14);
|
|
413
419
|
return _context.abrupt("return", []);
|
|
414
420
|
|
|
415
|
-
case
|
|
421
|
+
case 28:
|
|
416
422
|
return _context.abrupt("return", []);
|
|
417
423
|
|
|
418
|
-
case
|
|
424
|
+
case 29:
|
|
419
425
|
case "end":
|
|
420
426
|
return _context.stop();
|
|
421
427
|
}
|
|
422
428
|
}
|
|
423
|
-
}, _callee, null, [[
|
|
429
|
+
}, _callee, null, [[14, 25]]);
|
|
424
430
|
}));
|
|
425
431
|
|
|
426
432
|
return function calcOptions() {
|
package/es/types.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface FormBasicConfig {
|
|
|
31
31
|
export declare type FormItemAssert = {
|
|
32
32
|
field: NamePath;
|
|
33
33
|
value?: any;
|
|
34
|
-
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled';
|
|
34
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled';
|
|
35
35
|
};
|
|
36
36
|
export declare type FormItemCopyValue = {
|
|
37
37
|
assert: FormItemAssert;
|
|
@@ -72,7 +72,7 @@ export interface FormItemExtraConfig extends FormItemProps {
|
|
|
72
72
|
showOptional?: boolean;
|
|
73
73
|
previewFormater?(value: any, form?: FormInstance): any;
|
|
74
74
|
handleNext?(values: any): any;
|
|
75
|
-
render?(preview: boolean, form?: FormInstance, value?: any, onChange?:
|
|
75
|
+
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
76
76
|
locales?: {
|
|
77
77
|
[key: string]: string;
|
|
78
78
|
};
|
|
@@ -94,6 +94,7 @@ export interface FormItemExtraConfig extends FormItemProps {
|
|
|
94
94
|
valueFormater?: (value: any) => any;
|
|
95
95
|
currentStep?: number;
|
|
96
96
|
subscribedFields?: FormItemName[];
|
|
97
|
+
description?: string | React.ReactNode;
|
|
97
98
|
[key: string]: any;
|
|
98
99
|
}
|
|
99
100
|
export interface FormItemConfig extends FormItemExtraConfig {
|
package/es/utils/form-utils.js
CHANGED
|
@@ -86,7 +86,10 @@ export var testAssert = function testAssert(form, assert) {
|
|
|
86
86
|
break;
|
|
87
87
|
|
|
88
88
|
case 'filled':
|
|
89
|
-
return v !== undefined;
|
|
89
|
+
return v !== undefined && v !== '' && !(Array.isArray(v) && !v.length);
|
|
90
|
+
|
|
91
|
+
case 'unfilled':
|
|
92
|
+
return v === undefined || v === '' || Array.isArray(v) && !v.length;
|
|
90
93
|
|
|
91
94
|
case 'eq':
|
|
92
95
|
return v === value;
|
|
@@ -38,7 +38,8 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
38
38
|
modalContent = _ref.modalContent,
|
|
39
39
|
modalTitle = _ref.modalTitle,
|
|
40
40
|
okText = _ref.okText,
|
|
41
|
-
cancelText = _ref.cancelText
|
|
41
|
+
cancelText = _ref.cancelText,
|
|
42
|
+
href = _ref.href;
|
|
42
43
|
|
|
43
44
|
var _useState = (0, _react.useState)(false),
|
|
44
45
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -85,6 +86,14 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
85
86
|
return setVisible(true);
|
|
86
87
|
}
|
|
87
88
|
|
|
89
|
+
if (href) {
|
|
90
|
+
var a = document.createElement('a');
|
|
91
|
+
a.href = href;
|
|
92
|
+
a.target = '_blank';
|
|
93
|
+
a.click();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
88
97
|
onChange && onChange(!value);
|
|
89
98
|
},
|
|
90
99
|
style: {
|
|
@@ -109,7 +118,7 @@ var Confirmation = function Confirmation(_ref) {
|
|
|
109
118
|
});
|
|
110
119
|
};
|
|
111
120
|
|
|
112
|
-
Confirmation.formItemPropsHandler = function () {
|
|
121
|
+
Confirmation.formItemPropsHandler = function (config) {
|
|
113
122
|
return {
|
|
114
123
|
fullRow: true
|
|
115
124
|
};
|
|
@@ -92,7 +92,8 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
92
92
|
_config$min = config.min,
|
|
93
93
|
min = _config$min === void 0 ? initCount : _config$min,
|
|
94
94
|
addButtonText = config.addButtonText,
|
|
95
|
-
addButtonIcon = config.addButtonIcon
|
|
95
|
+
addButtonIcon = config.addButtonIcon,
|
|
96
|
+
description = config.description;
|
|
96
97
|
|
|
97
98
|
var _useBreakpoint = useBreakpoint(),
|
|
98
99
|
md = _useBreakpoint.md;
|
|
@@ -226,12 +227,21 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
226
227
|
style: {
|
|
227
228
|
width: '100%'
|
|
228
229
|
},
|
|
229
|
-
children: [groups, groupKeys.length < max && !preview && (0, _jsxRuntime.
|
|
230
|
+
children: [groups, groupKeys.length < max && !preview && (0, _jsxRuntime.jsxs)(_col.default, {
|
|
230
231
|
span: 24,
|
|
231
232
|
style: {
|
|
232
|
-
marginTop: !md ? 24 : 32
|
|
233
|
+
marginTop: groups.length ? !md ? 24 : 32 : 0
|
|
233
234
|
},
|
|
234
|
-
children: (0, _jsxRuntime.jsx)(
|
|
235
|
+
children: [description && (0, _jsxRuntime.jsx)(_typography.default, {
|
|
236
|
+
level: "body1",
|
|
237
|
+
wrapElement: "div",
|
|
238
|
+
style: {
|
|
239
|
+
color: '#666666',
|
|
240
|
+
marginBottom: 8,
|
|
241
|
+
whiteSpace: 'pre-wrap'
|
|
242
|
+
},
|
|
243
|
+
children: description
|
|
244
|
+
}), (0, _jsxRuntime.jsx)(_button.default, {
|
|
235
245
|
onClick: function onClick() {
|
|
236
246
|
return dispath({
|
|
237
247
|
type: 'add',
|
|
@@ -240,10 +250,11 @@ var AddableSection = function AddableSection(_ref) {
|
|
|
240
250
|
},
|
|
241
251
|
className: "igloo-form-addable-section-button",
|
|
242
252
|
icon: addButtonIcon,
|
|
253
|
+
disabled: elementProps.disabled,
|
|
243
254
|
children: addButtonText || "".concat(formatMessage({
|
|
244
255
|
id: 'Add'
|
|
245
256
|
}), " ").concat(label)
|
|
246
|
-
})
|
|
257
|
+
})]
|
|
247
258
|
})]
|
|
248
259
|
});
|
|
249
260
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC, IglooComponentProps } from '../../types';
|
|
2
2
|
import { FormInstance } from 'antd/es/form';
|
|
3
3
|
interface Props extends IglooComponentProps {
|
|
4
|
-
render?: (preview: boolean, form?: FormInstance, value?: any, onChange?:
|
|
4
|
+
render?: (preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']) => any;
|
|
5
5
|
preview?: boolean;
|
|
6
6
|
value?: any;
|
|
7
|
-
onChange?:
|
|
7
|
+
onChange?: (params: any) => any;
|
|
8
8
|
}
|
|
9
9
|
declare const RenderElement: FC<Props>;
|
|
10
10
|
export default RenderElement;
|
|
@@ -13,6 +13,7 @@ export interface AddableSectionProps extends FormItemConfig {
|
|
|
13
13
|
initCount?: number;
|
|
14
14
|
addButtonText?: string;
|
|
15
15
|
addButtonIcon?: ReactNode;
|
|
16
|
+
description?: string | ReactNode;
|
|
16
17
|
}
|
|
17
18
|
declare const AddableSection: FC<AddableSectionProps>;
|
|
18
19
|
export default AddableSection;
|
|
@@ -89,7 +89,8 @@ var AddableSection = function AddableSection(props) {
|
|
|
89
89
|
setShowStepButton = props.setShowStepButton,
|
|
90
90
|
addButtonText = props.addButtonText,
|
|
91
91
|
addButtonIcon = props.addButtonIcon,
|
|
92
|
-
children = props.children
|
|
92
|
+
children = props.children,
|
|
93
|
+
description = props.description;
|
|
93
94
|
|
|
94
95
|
var _useBreakpoint = useBreakpoint(),
|
|
95
96
|
md = _useBreakpoint.md;
|
|
@@ -299,12 +300,21 @@ var AddableSection = function AddableSection(props) {
|
|
|
299
300
|
style: {
|
|
300
301
|
width: '100%'
|
|
301
302
|
},
|
|
302
|
-
children: [groups, groupKeys.length < max && !preview && (0, _jsxRuntime.
|
|
303
|
+
children: [groups, groupKeys.length < max && !preview && (0, _jsxRuntime.jsxs)(_col.default, {
|
|
303
304
|
span: 24,
|
|
304
305
|
style: {
|
|
305
|
-
marginTop: !md ? 24 : 32
|
|
306
|
+
marginTop: groups.length ? !md ? 24 : 32 : 0
|
|
306
307
|
},
|
|
307
|
-
children: (0, _jsxRuntime.jsx)(
|
|
308
|
+
children: [description && (0, _jsxRuntime.jsx)(_typography.default, {
|
|
309
|
+
level: "body1",
|
|
310
|
+
wrapElement: "div",
|
|
311
|
+
style: {
|
|
312
|
+
color: '#666666',
|
|
313
|
+
marginBottom: 8,
|
|
314
|
+
whiteSpace: 'pre-wrap'
|
|
315
|
+
},
|
|
316
|
+
children: description
|
|
317
|
+
}), (0, _jsxRuntime.jsx)(_button.default, {
|
|
308
318
|
onClick: function onClick() {
|
|
309
319
|
return dispath({
|
|
310
320
|
type: 'add',
|
|
@@ -313,10 +323,11 @@ var AddableSection = function AddableSection(props) {
|
|
|
313
323
|
},
|
|
314
324
|
className: "igloo-addable-section-button",
|
|
315
325
|
icon: addButtonIcon,
|
|
326
|
+
disabled: elementProps.disabled,
|
|
316
327
|
children: addButtonText || "".concat(formatMessage({
|
|
317
328
|
id: 'Add'
|
|
318
329
|
}), " ").concat(label)
|
|
319
|
-
})
|
|
330
|
+
})]
|
|
320
331
|
})]
|
|
321
332
|
});
|
|
322
333
|
};
|
package/lib/input/amount.js
CHANGED
|
@@ -60,7 +60,18 @@ var Amount = function Amount(_ref) {
|
|
|
60
60
|
disabled = _ref.disabled,
|
|
61
61
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
var handleOnBlur = function handleOnBlur(e) {
|
|
64
|
+
var onChange = rest.onChange;
|
|
65
|
+
|
|
66
|
+
if (typeof value === 'string' && value.endsWith('.')) {
|
|
67
|
+
e.target.value = value.replace('.', '');
|
|
68
|
+
onChange && onChange(e);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (0, _jsxRuntime.jsx)(_input.default, _objectSpread(_objectSpread({
|
|
73
|
+
onBlur: handleOnBlur
|
|
74
|
+
}, (0, _omit.default)(rest, _formMethods.default)), {}, {
|
|
64
75
|
disabled: disabled,
|
|
65
76
|
className: (0, _classnames.default)('igloo-input-amount', {
|
|
66
77
|
'igloo-input-disable': disabled
|
|
@@ -79,7 +90,9 @@ Amount.formItemPropsHandler = function (_ref2) {
|
|
|
79
90
|
return {
|
|
80
91
|
getValueFromEvent: function getValueFromEvent(e) {
|
|
81
92
|
var value = e.target.value;
|
|
82
|
-
|
|
93
|
+
var str = value.replaceAll(seperator, '').replaceAll(/[^0-9\.]/g, '');
|
|
94
|
+
if (value.endsWith('.')) return str;
|
|
95
|
+
return str ? parseFloat(str) : undefined;
|
|
83
96
|
},
|
|
84
97
|
rules: [{
|
|
85
98
|
validator: function validator(_, value) {
|
|
@@ -354,7 +354,7 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
354
354
|
(0, _react.useEffect)(function () {
|
|
355
355
|
var calcOptions = /*#__PURE__*/function () {
|
|
356
356
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
357
|
-
var
|
|
357
|
+
var _options2, query, api, rst, _yield$rst$json, data;
|
|
358
358
|
|
|
359
359
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
360
360
|
while (1) {
|
|
@@ -393,24 +393,30 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
393
393
|
|
|
394
394
|
case 6:
|
|
395
395
|
if (!optionGroups) {
|
|
396
|
-
_context.next =
|
|
396
|
+
_context.next = 11;
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
if (!dependFieldValue) {
|
|
401
|
-
_context.next =
|
|
401
|
+
_context.next = 11;
|
|
402
402
|
break;
|
|
403
403
|
}
|
|
404
404
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
405
|
+
_options2 = [];
|
|
406
|
+
optionGroups.forEach(function (_ref13) {
|
|
407
|
+
var parentKey = _ref13.parentKey,
|
|
408
|
+
_ref13$options = _ref13.options,
|
|
409
|
+
options = _ref13$options === void 0 ? [] : _ref13$options;
|
|
410
|
+
|
|
411
|
+
if (Array.isArray(dependFieldValue) ? dependFieldValue.includes(parentKey) : parentKey === dependFieldValue) {
|
|
412
|
+
_options2.push.apply(_options2, _toConsumableArray(options));
|
|
413
|
+
}
|
|
408
414
|
});
|
|
409
|
-
return _context.abrupt("return",
|
|
415
|
+
return _context.abrupt("return", _options2);
|
|
410
416
|
|
|
411
|
-
case
|
|
417
|
+
case 11:
|
|
412
418
|
if (!(selectDatasourceApi && datasourceKey)) {
|
|
413
|
-
_context.next =
|
|
419
|
+
_context.next = 28;
|
|
414
420
|
break;
|
|
415
421
|
}
|
|
416
422
|
|
|
@@ -418,34 +424,34 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
418
424
|
return "parent=".concat(v);
|
|
419
425
|
}).join('&') : dependFieldValue ? "parent=".concat(dependFieldValue) : '';
|
|
420
426
|
api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
|
|
421
|
-
_context.prev =
|
|
422
|
-
_context.next =
|
|
427
|
+
_context.prev = 14;
|
|
428
|
+
_context.next = 17;
|
|
423
429
|
return fetch(query ? "".concat(api, "?").concat(query) : api);
|
|
424
430
|
|
|
425
|
-
case
|
|
431
|
+
case 17:
|
|
426
432
|
rst = _context.sent;
|
|
427
|
-
_context.next =
|
|
433
|
+
_context.next = 20;
|
|
428
434
|
return rst.json();
|
|
429
435
|
|
|
430
|
-
case
|
|
436
|
+
case 20:
|
|
431
437
|
_yield$rst$json = _context.sent;
|
|
432
438
|
data = _yield$rst$json.data;
|
|
433
439
|
return _context.abrupt("return", data || []);
|
|
434
440
|
|
|
435
|
-
case
|
|
436
|
-
_context.prev =
|
|
437
|
-
_context.t0 = _context["catch"](
|
|
441
|
+
case 25:
|
|
442
|
+
_context.prev = 25;
|
|
443
|
+
_context.t0 = _context["catch"](14);
|
|
438
444
|
return _context.abrupt("return", []);
|
|
439
445
|
|
|
440
|
-
case
|
|
446
|
+
case 28:
|
|
441
447
|
return _context.abrupt("return", []);
|
|
442
448
|
|
|
443
|
-
case
|
|
449
|
+
case 29:
|
|
444
450
|
case "end":
|
|
445
451
|
return _context.stop();
|
|
446
452
|
}
|
|
447
453
|
}
|
|
448
|
-
}, _callee, null, [[
|
|
454
|
+
}, _callee, null, [[14, 25]]);
|
|
449
455
|
}));
|
|
450
456
|
|
|
451
457
|
return function calcOptions() {
|
package/lib/types.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface FormBasicConfig {
|
|
|
31
31
|
export declare type FormItemAssert = {
|
|
32
32
|
field: NamePath;
|
|
33
33
|
value?: any;
|
|
34
|
-
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled';
|
|
34
|
+
operation?: 'eq' | 'ne' | 'in' | 'ni' | 'lt' | 'le' | 'gt' | 'ge' | 'co' | 'nc' | 'filled' | 'unfilled';
|
|
35
35
|
};
|
|
36
36
|
export declare type FormItemCopyValue = {
|
|
37
37
|
assert: FormItemAssert;
|
|
@@ -72,7 +72,7 @@ export interface FormItemExtraConfig extends FormItemProps {
|
|
|
72
72
|
showOptional?: boolean;
|
|
73
73
|
previewFormater?(value: any, form?: FormInstance): any;
|
|
74
74
|
handleNext?(values: any): any;
|
|
75
|
-
render?(preview: boolean, form?: FormInstance, value?: any, onChange?:
|
|
75
|
+
render?(preview: boolean, form?: FormInstance, value?: any, onChange?: (params: any) => any, setShowStepButton?: IglooComponentProps['setShowStepButton']): any;
|
|
76
76
|
locales?: {
|
|
77
77
|
[key: string]: string;
|
|
78
78
|
};
|
|
@@ -94,6 +94,7 @@ export interface FormItemExtraConfig extends FormItemProps {
|
|
|
94
94
|
valueFormater?: (value: any) => any;
|
|
95
95
|
currentStep?: number;
|
|
96
96
|
subscribedFields?: FormItemName[];
|
|
97
|
+
description?: string | React.ReactNode;
|
|
97
98
|
[key: string]: any;
|
|
98
99
|
}
|
|
99
100
|
export interface FormItemConfig extends FormItemExtraConfig {
|
package/lib/utils/form-utils.js
CHANGED
|
@@ -102,7 +102,10 @@ var testAssert = function testAssert(form, assert) {
|
|
|
102
102
|
break;
|
|
103
103
|
|
|
104
104
|
case 'filled':
|
|
105
|
-
return v !== undefined;
|
|
105
|
+
return v !== undefined && v !== '' && !(Array.isArray(v) && !v.length);
|
|
106
|
+
|
|
107
|
+
case 'unfilled':
|
|
108
|
+
return v === undefined || v === '' || Array.isArray(v) && !v.length;
|
|
106
109
|
|
|
107
110
|
case 'eq':
|
|
108
111
|
return v === value;
|