iglooform 2.4.32 → 2.4.35
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/filter/checkBox.js +5 -10
- package/es/form/addable-section/index.d.ts +1 -0
- package/es/form/addable-section/index.js +16 -5
- package/es/form/element/index.js +6 -2
- package/es/form/index.js +2 -1
- package/es/form/render/index.d.ts +2 -2
- package/es/form-context.d.ts +1 -0
- package/es/form-context.js +2 -1
- package/es/free-form/addable-section/index.d.ts +1 -0
- package/es/free-form/addable-section/index.js +16 -5
- package/es/free-form/element/index.js +5 -1
- package/es/free-form/index.js +2 -1
- package/es/input/amount.js +15 -2
- package/es/select/attached-select.js +36 -20
- package/es/table/index.js +5 -0
- 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/filter/checkBox.js +5 -10
- package/lib/form/addable-section/index.d.ts +1 -0
- package/lib/form/addable-section/index.js +16 -5
- package/lib/form/element/index.js +6 -2
- package/lib/form/index.js +2 -1
- package/lib/form/render/index.d.ts +2 -2
- package/lib/form-context.d.ts +1 -0
- package/lib/form-context.js +2 -1
- package/lib/free-form/addable-section/index.d.ts +1 -0
- package/lib/free-form/addable-section/index.js +16 -5
- package/lib/free-form/element/index.js +5 -1
- package/lib/free-form/index.js +2 -1
- package/lib/input/amount.js +15 -2
- package/lib/select/attached-select.js +36 -20
- package/lib/table/index.js +5 -0
- 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
|
};
|
package/es/filter/checkBox.js
CHANGED
|
@@ -60,20 +60,15 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
60
60
|
allChoose = _useState2[0],
|
|
61
61
|
setAllChoose = _useState2[1];
|
|
62
62
|
|
|
63
|
-
var
|
|
64
|
-
return handleFilterDisable(allSelected, disabled);
|
|
65
|
-
}),
|
|
66
|
-
_useState4 = _slicedToArray(_useState3, 1),
|
|
67
|
-
allCanChoose = _useState4[0];
|
|
68
|
-
|
|
63
|
+
var nowValidList = handleFilterDisable(allSelected, disabled);
|
|
69
64
|
useEffect(function () {
|
|
70
65
|
// 有可能用户配置的可选大于实际能选中的
|
|
71
|
-
if (chooseed.length >=
|
|
66
|
+
if (chooseed.length >= nowValidList.length) {
|
|
72
67
|
setAllChoose(true);
|
|
73
68
|
} else {
|
|
74
69
|
setAllChoose(false);
|
|
75
70
|
}
|
|
76
|
-
}, [chooseed.length,
|
|
71
|
+
}, [chooseed.length, allSelected]);
|
|
77
72
|
return _jsxs("div", {
|
|
78
73
|
className: "igloo-form-filter-drop-down-container-content-group",
|
|
79
74
|
children: [_jsxs("div", {
|
|
@@ -100,10 +95,10 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
100
95
|
}) : _jsx("span", {
|
|
101
96
|
className: "igloo-form-filter-drop-down-container-content-group-title-action",
|
|
102
97
|
onClick: function onClick() {
|
|
103
|
-
typeof _onChange === 'function' && _onChange(
|
|
98
|
+
typeof _onChange === 'function' && _onChange(nowValidList);
|
|
104
99
|
valueConfirm({
|
|
105
100
|
type: optionKey,
|
|
106
|
-
value:
|
|
101
|
+
value: nowValidList
|
|
107
102
|
});
|
|
108
103
|
setAllChoose(true);
|
|
109
104
|
},
|
|
@@ -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
|
};
|
package/es/form/element/index.js
CHANGED
|
@@ -69,7 +69,8 @@ var Element = function Element(_ref) {
|
|
|
69
69
|
var _useContext = useContext(FormContext),
|
|
70
70
|
form = _useContext.form,
|
|
71
71
|
requiredMark = _useContext.requiredMark,
|
|
72
|
-
registerDependencies = _useContext.registerDependencies
|
|
72
|
+
registerDependencies = _useContext.registerDependencies,
|
|
73
|
+
handleValuesChange = _useContext.handleValuesChange;
|
|
73
74
|
|
|
74
75
|
var _useReducer = useReducer(function (r) {
|
|
75
76
|
return r + 1;
|
|
@@ -212,6 +213,9 @@ var Element = function Element(_ref) {
|
|
|
212
213
|
name: formItemProps.name,
|
|
213
214
|
value: value
|
|
214
215
|
}]);
|
|
216
|
+
handleValuesChange([{
|
|
217
|
+
name: formItemProps.name
|
|
218
|
+
}]);
|
|
215
219
|
};
|
|
216
220
|
|
|
217
221
|
var validateField = function validateField() {
|
|
@@ -259,7 +263,7 @@ var Element = function Element(_ref) {
|
|
|
259
263
|
}));
|
|
260
264
|
|
|
261
265
|
if (preview) {
|
|
262
|
-
if (hideWhenPreview) return null;
|
|
266
|
+
if (hideWhenPreview || !display) return null;
|
|
263
267
|
return component;
|
|
264
268
|
}
|
|
265
269
|
|
package/es/form/index.js
CHANGED
|
@@ -241,7 +241,8 @@ var IglooForm = function IglooForm(props, ref) {
|
|
|
241
241
|
getScrollContainer: getScrollContainer,
|
|
242
242
|
registerDependencies: registerDependencies,
|
|
243
243
|
uploadApi: uploadApi,
|
|
244
|
-
selectDatasourceApi: selectDatasourceApi
|
|
244
|
+
selectDatasourceApi: selectDatasourceApi,
|
|
245
|
+
handleValuesChange: handleValuesChange
|
|
245
246
|
}, locales),
|
|
246
247
|
children: _jsxs(_Form, {
|
|
247
248
|
form: form,
|
|
@@ -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;
|
package/es/form-context.d.ts
CHANGED
|
@@ -17,5 +17,6 @@ declare const _default: React.Context<{
|
|
|
17
17
|
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
18
|
uploadApi?: string | undefined;
|
|
19
19
|
selectDatasourceApi?: string | undefined;
|
|
20
|
+
handleValuesChange(changedFields: any): any;
|
|
20
21
|
}>;
|
|
21
22
|
export default _default;
|
package/es/form-context.js
CHANGED
|
@@ -3,5 +3,6 @@ export default /*#__PURE__*/React.createContext({
|
|
|
3
3
|
getScrollContainer: function getScrollContainer() {
|
|
4
4
|
return window;
|
|
5
5
|
},
|
|
6
|
-
registerDependencies: function registerDependencies() {}
|
|
6
|
+
registerDependencies: function registerDependencies() {},
|
|
7
|
+
handleValuesChange: function handleValuesChange() {}
|
|
7
8
|
});
|
|
@@ -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
|
};
|
|
@@ -64,7 +64,8 @@ var Element = function Element(props) {
|
|
|
64
64
|
var _useContext = useContext(FormContext),
|
|
65
65
|
form = _useContext.form,
|
|
66
66
|
requiredMark = _useContext.requiredMark,
|
|
67
|
-
registerDependencies = _useContext.registerDependencies
|
|
67
|
+
registerDependencies = _useContext.registerDependencies,
|
|
68
|
+
handleValuesChange = _useContext.handleValuesChange;
|
|
68
69
|
|
|
69
70
|
var _useReducer = useReducer(function (r) {
|
|
70
71
|
return r + 1;
|
|
@@ -201,6 +202,9 @@ var Element = function Element(props) {
|
|
|
201
202
|
name: formItemProps.name,
|
|
202
203
|
value: value
|
|
203
204
|
}]);
|
|
205
|
+
handleValuesChange([{
|
|
206
|
+
name: formItemProps.name
|
|
207
|
+
}]);
|
|
204
208
|
};
|
|
205
209
|
|
|
206
210
|
var validateField = function validateField() {
|
package/es/free-form/index.js
CHANGED
|
@@ -198,7 +198,8 @@ var FreeForm = function FreeForm(props) {
|
|
|
198
198
|
getScrollContainer: getScrollContainer,
|
|
199
199
|
registerDependencies: registerDependencies,
|
|
200
200
|
uploadApi: uploadApi,
|
|
201
|
-
selectDatasourceApi: selectDatasourceApi
|
|
201
|
+
selectDatasourceApi: selectDatasourceApi,
|
|
202
|
+
handleValuesChange: handleValuesChange
|
|
202
203
|
}, locales),
|
|
203
204
|
children: _jsx(_Form, {
|
|
204
205
|
form: form,
|
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) {
|
|
@@ -97,6 +97,16 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
97
97
|
useEffect(function () {
|
|
98
98
|
setDisplay(options);
|
|
99
99
|
}, [options]);
|
|
100
|
+
useEffect(function () {
|
|
101
|
+
var setFieldValue = rest.setFieldValue;
|
|
102
|
+
var foundValue = options.find(function (option) {
|
|
103
|
+
return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
if (!foundValue) {
|
|
107
|
+
typeof setFieldValue === 'function' && setFieldValue();
|
|
108
|
+
}
|
|
109
|
+
}, [valueProp, options]);
|
|
100
110
|
|
|
101
111
|
var _useState7 = useState(false),
|
|
102
112
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -319,7 +329,7 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
319
329
|
useEffect(function () {
|
|
320
330
|
var calcOptions = /*#__PURE__*/function () {
|
|
321
331
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
322
|
-
var
|
|
332
|
+
var _options2, query, api, rst, _yield$rst$json, data;
|
|
323
333
|
|
|
324
334
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
325
335
|
while (1) {
|
|
@@ -358,24 +368,30 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
358
368
|
|
|
359
369
|
case 6:
|
|
360
370
|
if (!optionGroups) {
|
|
361
|
-
_context.next =
|
|
371
|
+
_context.next = 11;
|
|
362
372
|
break;
|
|
363
373
|
}
|
|
364
374
|
|
|
365
375
|
if (!dependFieldValue) {
|
|
366
|
-
_context.next =
|
|
376
|
+
_context.next = 11;
|
|
367
377
|
break;
|
|
368
378
|
}
|
|
369
379
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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
|
+
}
|
|
373
389
|
});
|
|
374
|
-
return _context.abrupt("return",
|
|
390
|
+
return _context.abrupt("return", _options2);
|
|
375
391
|
|
|
376
|
-
case
|
|
392
|
+
case 11:
|
|
377
393
|
if (!(selectDatasourceApi && datasourceKey)) {
|
|
378
|
-
_context.next =
|
|
394
|
+
_context.next = 28;
|
|
379
395
|
break;
|
|
380
396
|
}
|
|
381
397
|
|
|
@@ -383,34 +399,34 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
383
399
|
return "parent=".concat(v);
|
|
384
400
|
}).join('&') : dependFieldValue ? "parent=".concat(dependFieldValue) : '';
|
|
385
401
|
api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
|
|
386
|
-
_context.prev =
|
|
387
|
-
_context.next =
|
|
402
|
+
_context.prev = 14;
|
|
403
|
+
_context.next = 17;
|
|
388
404
|
return fetch(query ? "".concat(api, "?").concat(query) : api);
|
|
389
405
|
|
|
390
|
-
case
|
|
406
|
+
case 17:
|
|
391
407
|
rst = _context.sent;
|
|
392
|
-
_context.next =
|
|
408
|
+
_context.next = 20;
|
|
393
409
|
return rst.json();
|
|
394
410
|
|
|
395
|
-
case
|
|
411
|
+
case 20:
|
|
396
412
|
_yield$rst$json = _context.sent;
|
|
397
413
|
data = _yield$rst$json.data;
|
|
398
414
|
return _context.abrupt("return", data || []);
|
|
399
415
|
|
|
400
|
-
case
|
|
401
|
-
_context.prev =
|
|
402
|
-
_context.t0 = _context["catch"](
|
|
416
|
+
case 25:
|
|
417
|
+
_context.prev = 25;
|
|
418
|
+
_context.t0 = _context["catch"](14);
|
|
403
419
|
return _context.abrupt("return", []);
|
|
404
420
|
|
|
405
|
-
case
|
|
421
|
+
case 28:
|
|
406
422
|
return _context.abrupt("return", []);
|
|
407
423
|
|
|
408
|
-
case
|
|
424
|
+
case 29:
|
|
409
425
|
case "end":
|
|
410
426
|
return _context.stop();
|
|
411
427
|
}
|
|
412
428
|
}
|
|
413
|
-
}, _callee, null, [[
|
|
429
|
+
}, _callee, null, [[14, 25]]);
|
|
414
430
|
}));
|
|
415
431
|
|
|
416
432
|
return function calcOptions() {
|
package/es/table/index.js
CHANGED
|
@@ -245,6 +245,11 @@ var IglooTable = function IglooTable(_ref) {
|
|
|
245
245
|
invariant(colMax >= selectedColKeys.length, 'colmax has less than default select');
|
|
246
246
|
}
|
|
247
247
|
}, []);
|
|
248
|
+
useEffect(function () {
|
|
249
|
+
var defaultKey = filterDefaultShow(columns);
|
|
250
|
+
setSelectedColKeys(defaultKey);
|
|
251
|
+
setModalSelectedCol(defaultKey);
|
|
252
|
+
}, [JSON.stringify(columns), columns]);
|
|
248
253
|
invariant(typeof onPagination === 'function', 'onPagination should be a function');
|
|
249
254
|
var everyColumnsHasKey = columns.every(function (col) {
|
|
250
255
|
return col.key !== undefined;
|
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
|
};
|
package/lib/filter/checkBox.js
CHANGED
|
@@ -79,20 +79,15 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
79
79
|
allChoose = _useState2[0],
|
|
80
80
|
setAllChoose = _useState2[1];
|
|
81
81
|
|
|
82
|
-
var
|
|
83
|
-
return handleFilterDisable(allSelected, disabled);
|
|
84
|
-
}),
|
|
85
|
-
_useState4 = _slicedToArray(_useState3, 1),
|
|
86
|
-
allCanChoose = _useState4[0];
|
|
87
|
-
|
|
82
|
+
var nowValidList = handleFilterDisable(allSelected, disabled);
|
|
88
83
|
(0, _react.useEffect)(function () {
|
|
89
84
|
// 有可能用户配置的可选大于实际能选中的
|
|
90
|
-
if (chooseed.length >=
|
|
85
|
+
if (chooseed.length >= nowValidList.length) {
|
|
91
86
|
setAllChoose(true);
|
|
92
87
|
} else {
|
|
93
88
|
setAllChoose(false);
|
|
94
89
|
}
|
|
95
|
-
}, [chooseed.length,
|
|
90
|
+
}, [chooseed.length, allSelected]);
|
|
96
91
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
97
92
|
className: "igloo-form-filter-drop-down-container-content-group",
|
|
98
93
|
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -119,10 +114,10 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
|
|
|
119
114
|
}) : (0, _jsxRuntime.jsx)("span", {
|
|
120
115
|
className: "igloo-form-filter-drop-down-container-content-group-title-action",
|
|
121
116
|
onClick: function onClick() {
|
|
122
|
-
typeof _onChange === 'function' && _onChange(
|
|
117
|
+
typeof _onChange === 'function' && _onChange(nowValidList);
|
|
123
118
|
valueConfirm({
|
|
124
119
|
type: optionKey,
|
|
125
|
-
value:
|
|
120
|
+
value: nowValidList
|
|
126
121
|
});
|
|
127
122
|
setAllChoose(true);
|
|
128
123
|
},
|
|
@@ -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
|
};
|
|
@@ -98,7 +98,8 @@ var Element = function Element(_ref) {
|
|
|
98
98
|
var _useContext = (0, _react.useContext)(_formContext.default),
|
|
99
99
|
form = _useContext.form,
|
|
100
100
|
requiredMark = _useContext.requiredMark,
|
|
101
|
-
registerDependencies = _useContext.registerDependencies
|
|
101
|
+
registerDependencies = _useContext.registerDependencies,
|
|
102
|
+
handleValuesChange = _useContext.handleValuesChange;
|
|
102
103
|
|
|
103
104
|
var _useReducer = (0, _react.useReducer)(function (r) {
|
|
104
105
|
return r + 1;
|
|
@@ -241,6 +242,9 @@ var Element = function Element(_ref) {
|
|
|
241
242
|
name: formItemProps.name,
|
|
242
243
|
value: value
|
|
243
244
|
}]);
|
|
245
|
+
handleValuesChange([{
|
|
246
|
+
name: formItemProps.name
|
|
247
|
+
}]);
|
|
244
248
|
};
|
|
245
249
|
|
|
246
250
|
var validateField = function validateField() {
|
|
@@ -288,7 +292,7 @@ var Element = function Element(_ref) {
|
|
|
288
292
|
}));
|
|
289
293
|
|
|
290
294
|
if (preview) {
|
|
291
|
-
if (hideWhenPreview) return null;
|
|
295
|
+
if (hideWhenPreview || !display) return null;
|
|
292
296
|
return component;
|
|
293
297
|
}
|
|
294
298
|
|
package/lib/form/index.js
CHANGED
|
@@ -262,7 +262,8 @@ var IglooForm = function IglooForm(props, ref) {
|
|
|
262
262
|
getScrollContainer: getScrollContainer,
|
|
263
263
|
registerDependencies: registerDependencies,
|
|
264
264
|
uploadApi: uploadApi,
|
|
265
|
-
selectDatasourceApi: selectDatasourceApi
|
|
265
|
+
selectDatasourceApi: selectDatasourceApi,
|
|
266
|
+
handleValuesChange: handleValuesChange
|
|
266
267
|
}, locales),
|
|
267
268
|
children: (0, _jsxRuntime.jsxs)(_form.default, {
|
|
268
269
|
form: form,
|
|
@@ -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;
|
package/lib/form-context.d.ts
CHANGED
|
@@ -17,5 +17,6 @@ declare const _default: React.Context<{
|
|
|
17
17
|
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
18
|
uploadApi?: string | undefined;
|
|
19
19
|
selectDatasourceApi?: string | undefined;
|
|
20
|
+
handleValuesChange(changedFields: any): any;
|
|
20
21
|
}>;
|
|
21
22
|
export default _default;
|
package/lib/form-context.js
CHANGED
|
@@ -13,7 +13,8 @@ var _default = /*#__PURE__*/_react.default.createContext({
|
|
|
13
13
|
getScrollContainer: function getScrollContainer() {
|
|
14
14
|
return window;
|
|
15
15
|
},
|
|
16
|
-
registerDependencies: function registerDependencies() {}
|
|
16
|
+
registerDependencies: function registerDependencies() {},
|
|
17
|
+
handleValuesChange: function handleValuesChange() {}
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
exports.default = _default;
|
|
@@ -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
|
};
|
|
@@ -90,7 +90,8 @@ var Element = function Element(props) {
|
|
|
90
90
|
var _useContext = (0, _react.useContext)(_formContext.default),
|
|
91
91
|
form = _useContext.form,
|
|
92
92
|
requiredMark = _useContext.requiredMark,
|
|
93
|
-
registerDependencies = _useContext.registerDependencies
|
|
93
|
+
registerDependencies = _useContext.registerDependencies,
|
|
94
|
+
handleValuesChange = _useContext.handleValuesChange;
|
|
94
95
|
|
|
95
96
|
var _useReducer = (0, _react.useReducer)(function (r) {
|
|
96
97
|
return r + 1;
|
|
@@ -227,6 +228,9 @@ var Element = function Element(props) {
|
|
|
227
228
|
name: formItemProps.name,
|
|
228
229
|
value: value
|
|
229
230
|
}]);
|
|
231
|
+
handleValuesChange([{
|
|
232
|
+
name: formItemProps.name
|
|
233
|
+
}]);
|
|
230
234
|
};
|
|
231
235
|
|
|
232
236
|
var validateField = function validateField() {
|
package/lib/free-form/index.js
CHANGED
|
@@ -214,7 +214,8 @@ var FreeForm = function FreeForm(props) {
|
|
|
214
214
|
getScrollContainer: getScrollContainer,
|
|
215
215
|
registerDependencies: registerDependencies,
|
|
216
216
|
uploadApi: uploadApi,
|
|
217
|
-
selectDatasourceApi: selectDatasourceApi
|
|
217
|
+
selectDatasourceApi: selectDatasourceApi,
|
|
218
|
+
handleValuesChange: handleValuesChange
|
|
218
219
|
}, locales),
|
|
219
220
|
children: (0, _jsxRuntime.jsx)(_form.default, {
|
|
220
221
|
form: form,
|
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) {
|
|
@@ -122,6 +122,16 @@ var IglooSelect = function IglooSelect(_ref) {
|
|
|
122
122
|
(0, _react.useEffect)(function () {
|
|
123
123
|
setDisplay(options);
|
|
124
124
|
}, [options]);
|
|
125
|
+
(0, _react.useEffect)(function () {
|
|
126
|
+
var setFieldValue = rest.setFieldValue;
|
|
127
|
+
var foundValue = options.find(function (option) {
|
|
128
|
+
return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (!foundValue) {
|
|
132
|
+
typeof setFieldValue === 'function' && setFieldValue();
|
|
133
|
+
}
|
|
134
|
+
}, [valueProp, options]);
|
|
125
135
|
|
|
126
136
|
var _useState7 = (0, _react.useState)(false),
|
|
127
137
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
@@ -344,7 +354,7 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
344
354
|
(0, _react.useEffect)(function () {
|
|
345
355
|
var calcOptions = /*#__PURE__*/function () {
|
|
346
356
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
347
|
-
var
|
|
357
|
+
var _options2, query, api, rst, _yield$rst$json, data;
|
|
348
358
|
|
|
349
359
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
350
360
|
while (1) {
|
|
@@ -383,24 +393,30 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
383
393
|
|
|
384
394
|
case 6:
|
|
385
395
|
if (!optionGroups) {
|
|
386
|
-
_context.next =
|
|
396
|
+
_context.next = 11;
|
|
387
397
|
break;
|
|
388
398
|
}
|
|
389
399
|
|
|
390
400
|
if (!dependFieldValue) {
|
|
391
|
-
_context.next =
|
|
401
|
+
_context.next = 11;
|
|
392
402
|
break;
|
|
393
403
|
}
|
|
394
404
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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
|
+
}
|
|
398
414
|
});
|
|
399
|
-
return _context.abrupt("return",
|
|
415
|
+
return _context.abrupt("return", _options2);
|
|
400
416
|
|
|
401
|
-
case
|
|
417
|
+
case 11:
|
|
402
418
|
if (!(selectDatasourceApi && datasourceKey)) {
|
|
403
|
-
_context.next =
|
|
419
|
+
_context.next = 28;
|
|
404
420
|
break;
|
|
405
421
|
}
|
|
406
422
|
|
|
@@ -408,34 +424,34 @@ var AttachedSelect = function AttachedSelect(_ref11) {
|
|
|
408
424
|
return "parent=".concat(v);
|
|
409
425
|
}).join('&') : dependFieldValue ? "parent=".concat(dependFieldValue) : '';
|
|
410
426
|
api = "".concat(selectDatasourceApi, "/").concat(datasourceKey);
|
|
411
|
-
_context.prev =
|
|
412
|
-
_context.next =
|
|
427
|
+
_context.prev = 14;
|
|
428
|
+
_context.next = 17;
|
|
413
429
|
return fetch(query ? "".concat(api, "?").concat(query) : api);
|
|
414
430
|
|
|
415
|
-
case
|
|
431
|
+
case 17:
|
|
416
432
|
rst = _context.sent;
|
|
417
|
-
_context.next =
|
|
433
|
+
_context.next = 20;
|
|
418
434
|
return rst.json();
|
|
419
435
|
|
|
420
|
-
case
|
|
436
|
+
case 20:
|
|
421
437
|
_yield$rst$json = _context.sent;
|
|
422
438
|
data = _yield$rst$json.data;
|
|
423
439
|
return _context.abrupt("return", data || []);
|
|
424
440
|
|
|
425
|
-
case
|
|
426
|
-
_context.prev =
|
|
427
|
-
_context.t0 = _context["catch"](
|
|
441
|
+
case 25:
|
|
442
|
+
_context.prev = 25;
|
|
443
|
+
_context.t0 = _context["catch"](14);
|
|
428
444
|
return _context.abrupt("return", []);
|
|
429
445
|
|
|
430
|
-
case
|
|
446
|
+
case 28:
|
|
431
447
|
return _context.abrupt("return", []);
|
|
432
448
|
|
|
433
|
-
case
|
|
449
|
+
case 29:
|
|
434
450
|
case "end":
|
|
435
451
|
return _context.stop();
|
|
436
452
|
}
|
|
437
453
|
}
|
|
438
|
-
}, _callee, null, [[
|
|
454
|
+
}, _callee, null, [[14, 25]]);
|
|
439
455
|
}));
|
|
440
456
|
|
|
441
457
|
return function calcOptions() {
|
package/lib/table/index.js
CHANGED
|
@@ -284,6 +284,11 @@ var IglooTable = function IglooTable(_ref) {
|
|
|
284
284
|
(0, _invariant.default)(colMax >= selectedColKeys.length, 'colmax has less than default select');
|
|
285
285
|
}
|
|
286
286
|
}, []);
|
|
287
|
+
(0, _react.useEffect)(function () {
|
|
288
|
+
var defaultKey = filterDefaultShow(columns);
|
|
289
|
+
setSelectedColKeys(defaultKey);
|
|
290
|
+
setModalSelectedCol(defaultKey);
|
|
291
|
+
}, [JSON.stringify(columns), columns]);
|
|
287
292
|
(0, _invariant.default)(typeof onPagination === 'function', 'onPagination should be a function');
|
|
288
293
|
var everyColumnsHasKey = columns.every(function (col) {
|
|
289
294
|
return col.key !== undefined;
|
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;
|