iglooform 2.4.33 → 2.5.0
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/element/index.js +5 -1
- 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/media/media.js +6 -3
- package/es/media/preview.js +13 -13
- package/es/select/attached-select.js +26 -20
- package/es/table/index.js +5 -0
- package/es/types.d.ts +3 -2
- package/es/upload-photo/media.js +6 -7
- package/es/upload-preview/media.js +13 -13
- 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/element/index.js +5 -1
- 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/media/media.js +6 -3
- package/lib/media/preview.js +13 -15
- package/lib/select/attached-select.js +26 -20
- package/lib/table/index.js +5 -0
- package/lib/types.d.ts +3 -2
- package/lib/upload-photo/media.js +6 -9
- package/lib/upload-preview/media.js +13 -13
- package/lib/utils/form-utils.js +4 -1
- package/package.json +4 -3
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
|
};
|
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() {
|
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) {
|
package/es/media/media.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "antd/es/tooltip/style";
|
|
2
2
|
import _Tooltip from "antd/es/tooltip";
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
5
5
|
|
|
6
6
|
var MediaItem = function MediaItem(_ref) {
|
|
7
7
|
var type = _ref.type,
|
|
@@ -25,9 +25,12 @@ var MediaItem = function MediaItem(_ref) {
|
|
|
25
25
|
maxHeight: 80,
|
|
26
26
|
position: 'absolute'
|
|
27
27
|
},
|
|
28
|
-
children: _jsx(
|
|
28
|
+
children: _jsx(Document, {
|
|
29
29
|
file: src,
|
|
30
|
-
|
|
30
|
+
children: _jsx(Page, {
|
|
31
|
+
pageNumber: 1,
|
|
32
|
+
scale: 0.1
|
|
33
|
+
})
|
|
31
34
|
})
|
|
32
35
|
});
|
|
33
36
|
|
package/es/media/preview.js
CHANGED
|
@@ -18,7 +18,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
import { useState } from 'react';
|
|
21
|
-
import
|
|
21
|
+
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
22
22
|
|
|
23
23
|
var PdfViewer = function PdfViewer(_ref) {
|
|
24
24
|
var src = _ref.src,
|
|
@@ -41,17 +41,6 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
var pages = [];
|
|
45
|
-
|
|
46
|
-
for (var i = 1; i <= pageSize; i++) {
|
|
47
|
-
pages.push(_jsx(PDF, {
|
|
48
|
-
file: src,
|
|
49
|
-
page: i,
|
|
50
|
-
onDocumentLoadSuccess: handlePageInit,
|
|
51
|
-
scale: scale
|
|
52
|
-
}, i));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
44
|
return _jsx("div", {
|
|
56
45
|
style: {
|
|
57
46
|
display: 'flex',
|
|
@@ -61,7 +50,18 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
61
50
|
transform: "translate(".concat(left, "px, ").concat(top, "px)"),
|
|
62
51
|
position: 'absolute'
|
|
63
52
|
},
|
|
64
|
-
children:
|
|
53
|
+
children: _jsx(Document, {
|
|
54
|
+
file: src,
|
|
55
|
+
onLoadSuccess: handlePageInit,
|
|
56
|
+
children: Array.from({
|
|
57
|
+
length: pageSize
|
|
58
|
+
}).map(function (_, index) {
|
|
59
|
+
return _jsx(Page, {
|
|
60
|
+
pageNumber: index + 1,
|
|
61
|
+
scale: scale
|
|
62
|
+
}, index);
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
|
|
@@ -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/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/upload-photo/media.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
3
3
|
|
|
4
4
|
var MediaItem = function MediaItem(_ref) {
|
|
5
5
|
var type = _ref.type,
|
|
@@ -21,13 +21,12 @@ var MediaItem = function MediaItem(_ref) {
|
|
|
21
21
|
case 'pdf':
|
|
22
22
|
return _jsx("div", {
|
|
23
23
|
className: className,
|
|
24
|
-
children: _jsx(
|
|
24
|
+
children: _jsx(Document, {
|
|
25
25
|
file: src,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
26
|
+
children: _jsx(Page, {
|
|
27
|
+
pageNumber: 1,
|
|
28
|
+
height: 96
|
|
29
|
+
})
|
|
31
30
|
})
|
|
32
31
|
});
|
|
33
32
|
|
|
@@ -16,7 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { useState, useContext } from 'react';
|
|
18
18
|
import Typography from '../typography';
|
|
19
|
-
import
|
|
19
|
+
import { Document, Page } from 'react-pdf/dist/esm/entry.webpack';
|
|
20
20
|
import { ErrorFilled } from 'iglooicon';
|
|
21
21
|
import LocaleContext from '../locale/locale-context';
|
|
22
22
|
import classNames from 'classnames';
|
|
@@ -42,20 +42,20 @@ var PDF = function PDF(_ref) {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
var pages = [];
|
|
46
|
-
|
|
47
|
-
for (var i = 1; i <= pageSize; i++) {
|
|
48
|
-
pages.push(_jsx(PDFPreview, {
|
|
49
|
-
file: src,
|
|
50
|
-
page: i,
|
|
51
|
-
onDocumentLoadSuccess: handlePageInit,
|
|
52
|
-
scale: md ? 1 : 0.5
|
|
53
|
-
}, i));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
45
|
return _jsx("div", {
|
|
57
46
|
className: "igloo-upload-preview-pdf",
|
|
58
|
-
children:
|
|
47
|
+
children: _jsx(Document, {
|
|
48
|
+
file: src,
|
|
49
|
+
onLoadSuccess: handlePageInit,
|
|
50
|
+
children: Array.from({
|
|
51
|
+
length: pageSize
|
|
52
|
+
}).map(function (_, index) {
|
|
53
|
+
return _jsx(Page, {
|
|
54
|
+
pageNumber: index + 1,
|
|
55
|
+
scale: md ? 1 : 0.5
|
|
56
|
+
}, index);
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
|
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
|
};
|
|
@@ -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() {
|
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) {
|
package/lib/media/media.js
CHANGED
|
@@ -11,7 +11,7 @@ var _tooltip = _interopRequireDefault(require("antd/es/tooltip"));
|
|
|
11
11
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _entry = require("react-pdf/dist/esm/entry.webpack");
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
@@ -37,9 +37,12 @@ var MediaItem = function MediaItem(_ref) {
|
|
|
37
37
|
maxHeight: 80,
|
|
38
38
|
position: 'absolute'
|
|
39
39
|
},
|
|
40
|
-
children: (0, _jsxRuntime.jsx)(
|
|
40
|
+
children: (0, _jsxRuntime.jsx)(_entry.Document, {
|
|
41
41
|
file: src,
|
|
42
|
-
|
|
42
|
+
children: (0, _jsxRuntime.jsx)(_entry.Page, {
|
|
43
|
+
pageNumber: 1,
|
|
44
|
+
scale: 0.1
|
|
45
|
+
})
|
|
43
46
|
})
|
|
44
47
|
});
|
|
45
48
|
|
package/lib/media/preview.js
CHANGED
|
@@ -9,9 +9,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
var _entry = require("react-pdf/dist/esm/entry.webpack");
|
|
15
13
|
|
|
16
14
|
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; }
|
|
17
15
|
|
|
@@ -52,17 +50,6 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
52
50
|
}
|
|
53
51
|
};
|
|
54
52
|
|
|
55
|
-
var pages = [];
|
|
56
|
-
|
|
57
|
-
for (var i = 1; i <= pageSize; i++) {
|
|
58
|
-
pages.push((0, _jsxRuntime.jsx)(_reactPdf.default, {
|
|
59
|
-
file: src,
|
|
60
|
-
page: i,
|
|
61
|
-
onDocumentLoadSuccess: handlePageInit,
|
|
62
|
-
scale: scale
|
|
63
|
-
}, i));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
53
|
return (0, _jsxRuntime.jsx)("div", {
|
|
67
54
|
style: {
|
|
68
55
|
display: 'flex',
|
|
@@ -72,7 +59,18 @@ var PdfViewer = function PdfViewer(_ref) {
|
|
|
72
59
|
transform: "translate(".concat(left, "px, ").concat(top, "px)"),
|
|
73
60
|
position: 'absolute'
|
|
74
61
|
},
|
|
75
|
-
children:
|
|
62
|
+
children: (0, _jsxRuntime.jsx)(_entry.Document, {
|
|
63
|
+
file: src,
|
|
64
|
+
onLoadSuccess: handlePageInit,
|
|
65
|
+
children: Array.from({
|
|
66
|
+
length: pageSize
|
|
67
|
+
}).map(function (_, index) {
|
|
68
|
+
return (0, _jsxRuntime.jsx)(_entry.Page, {
|
|
69
|
+
pageNumber: index + 1,
|
|
70
|
+
scale: scale
|
|
71
|
+
}, index);
|
|
72
|
+
})
|
|
73
|
+
})
|
|
76
74
|
});
|
|
77
75
|
};
|
|
78
76
|
|
|
@@ -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/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 {
|
|
@@ -7,9 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
var _entry = require("react-pdf/dist/esm/entry.webpack");
|
|
13
11
|
|
|
14
12
|
var MediaItem = function MediaItem(_ref) {
|
|
15
13
|
var type = _ref.type,
|
|
@@ -31,13 +29,12 @@ var MediaItem = function MediaItem(_ref) {
|
|
|
31
29
|
case 'pdf':
|
|
32
30
|
return (0, _jsxRuntime.jsx)("div", {
|
|
33
31
|
className: className,
|
|
34
|
-
children: (0, _jsxRuntime.jsx)(
|
|
32
|
+
children: (0, _jsxRuntime.jsx)(_entry.Document, {
|
|
35
33
|
file: src,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
34
|
+
children: (0, _jsxRuntime.jsx)(_entry.Page, {
|
|
35
|
+
pageNumber: 1,
|
|
36
|
+
height: 96
|
|
37
|
+
})
|
|
41
38
|
})
|
|
42
39
|
});
|
|
43
40
|
|
|
@@ -15,7 +15,7 @@ var _react = require("react");
|
|
|
15
15
|
|
|
16
16
|
var _typography = _interopRequireDefault(require("../typography"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _entry = require("react-pdf/dist/esm/entry.webpack");
|
|
19
19
|
|
|
20
20
|
var _iglooicon = require("iglooicon");
|
|
21
21
|
|
|
@@ -59,20 +59,20 @@ var PDF = function PDF(_ref) {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
var pages = [];
|
|
63
|
-
|
|
64
|
-
for (var i = 1; i <= pageSize; i++) {
|
|
65
|
-
pages.push((0, _jsxRuntime.jsx)(_reactPdf.default, {
|
|
66
|
-
file: src,
|
|
67
|
-
page: i,
|
|
68
|
-
onDocumentLoadSuccess: handlePageInit,
|
|
69
|
-
scale: md ? 1 : 0.5
|
|
70
|
-
}, i));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
62
|
return (0, _jsxRuntime.jsx)("div", {
|
|
74
63
|
className: "igloo-upload-preview-pdf",
|
|
75
|
-
children:
|
|
64
|
+
children: (0, _jsxRuntime.jsx)(_entry.Document, {
|
|
65
|
+
file: src,
|
|
66
|
+
onLoadSuccess: handlePageInit,
|
|
67
|
+
children: Array.from({
|
|
68
|
+
length: pageSize
|
|
69
|
+
}).map(function (_, index) {
|
|
70
|
+
return (0, _jsxRuntime.jsx)(_entry.Page, {
|
|
71
|
+
pageNumber: index + 1,
|
|
72
|
+
scale: md ? 1 : 0.5
|
|
73
|
+
}, index);
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iglooform",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"build-dev": "dumi build",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
]
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@mikecousins/react-pdf": "^5.5.1",
|
|
38
37
|
"@umijs/hooks": "^1.9.3",
|
|
39
38
|
"aws-sdk": "^2.966.0",
|
|
40
39
|
"classnames": "^2.2.6",
|
|
@@ -44,7 +43,8 @@
|
|
|
44
43
|
"lodash.debounce": "^4.0.8",
|
|
45
44
|
"omit.js": "^2.0.2",
|
|
46
45
|
"react": "^16.12.0",
|
|
47
|
-
"react-json-view": "^1.19.1"
|
|
46
|
+
"react-json-view": "^1.19.1",
|
|
47
|
+
"react-pdf": "^5.7.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@formatjs/cli": "^4.2.8",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"@types/classnames": "^2.2.11",
|
|
53
53
|
"@types/invariant": "^2.2.34",
|
|
54
54
|
"@types/lodash.debounce": "^4.0.6",
|
|
55
|
+
"@types/react-pdf": "^5.0.9",
|
|
55
56
|
"@types/vfile-message": "^2.0.0",
|
|
56
57
|
"@umijs/plugin-antd": "^0.8.0",
|
|
57
58
|
"@umijs/plugin-esbuild": "^1.3.1",
|