iglooform 2.4.7 → 2.4.11
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/admin-upload/float.js +25 -35
- package/es/admin-upload/index.d.ts +2 -0
- package/es/admin-upload/index.js +43 -36
- package/es/admin-upload/job-list.js +85 -115
- package/es/admin-upload/modal.js +19 -26
- package/es/alert-message/index.js +11 -9
- package/es/amount/index.js +10 -5
- package/es/back-top/index.js +14 -10
- package/es/button/index.js +23 -28
- package/es/button/style/index.less +23 -19
- package/es/card-detail/card-group.js +16 -22
- package/es/card-detail/card-item.js +16 -21
- package/es/card-detail/card-page.js +11 -15
- package/es/card-detail/card.js +24 -24
- package/es/card-detail/style/index.less +13 -0
- package/es/card-detail/utils.js +6 -7
- package/es/checkbox/index.js +23 -22
- package/es/claim-list/index.js +53 -70
- package/es/confirmation/index.js +7 -9
- package/es/date-picker/buddhist.js +3 -3
- package/es/date-picker/index.js +10 -4
- package/es/declaration/index.js +16 -13
- package/es/detail-panel/index.js +67 -83
- package/es/documents/index.js +6 -8
- package/es/example/index.js +9 -11
- package/es/filter/checkBox.js +33 -45
- package/es/filter/customize.js +3 -4
- package/es/filter/index.d.ts +1 -0
- package/es/filter/index.js +88 -112
- package/es/filter/radioBox.js +23 -31
- package/es/filter/rangePicker.js +43 -59
- package/es/form/addable-section/index.d.ts +19 -0
- package/es/form/addable-section/index.js +211 -0
- package/es/form/addable-section/style/index.d.ts +1 -0
- package/es/form/addable-section/style/index.js +1 -0
- package/es/form/addable-section/style/index.less +22 -0
- package/es/form/divider/index.js +7 -1
- package/es/form/element/index.js +58 -47
- package/es/form/element/style/index.less +9 -0
- package/es/form/index.js +16 -17
- package/es/form/login/index.js +15 -20
- package/es/form/page/index.js +18 -24
- package/es/form/page/style/index.less +1 -1
- package/es/form/pages/index.js +23 -32
- package/es/form/pages/style/index.less +3 -1
- package/es/form/render/index.js +1 -1
- package/es/form/section/index.js +14 -17
- package/es/form/step/index.js +31 -42
- package/es/form/steps/index.js +8 -11
- package/es/{form/context.d.ts → form-context.d.ts} +1 -0
- package/es/{form/context.js → form-context.js} +0 -0
- package/es/free-form/addable-section/index.d.ts +18 -0
- package/es/free-form/addable-section/index.js +286 -0
- package/es/free-form/addable-section/style/index.d.ts +1 -0
- package/es/free-form/addable-section/style/index.js +1 -0
- package/es/free-form/addable-section/style/index.less +22 -0
- package/es/free-form/element/index.js +43 -41
- package/es/free-form/element/style/index.less +12 -2
- package/es/free-form/index.d.ts +5 -1
- package/es/free-form/index.js +17 -17
- package/es/free-form/page/index.js +36 -46
- package/es/free-form/page/style/index.less +3 -1
- package/es/free-form/pages/index.js +8 -10
- package/es/free-form/section/index.js +20 -22
- package/es/free-form/section/style/index.less +4 -0
- package/es/free-form/step/index.js +37 -47
- package/es/free-form/steps/index.js +8 -10
- package/es/global-message/index.js +1 -1
- package/es/home-menu/index.js +52 -71
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/input/amount.js +10 -5
- package/es/input/credit-card.js +7 -1
- package/es/input/email.js +8 -1
- package/es/input/expiry-date.js +14 -18
- package/es/input/input-date.js +12 -16
- package/es/input/input-number.js +9 -2
- package/es/input/input.js +9 -2
- package/es/input/otp.js +17 -15
- package/es/input/password.js +12 -6
- package/es/input/phone-number.js +6 -8
- package/es/input/style/index.less +9 -1
- package/es/input/text-area.js +14 -10
- package/es/layout/defaultFooter.js +60 -82
- package/es/layout/defaultHeader.js +11 -15
- package/es/layout/footer.js +108 -148
- package/es/layout/header.js +51 -60
- package/es/layout/index.js +16 -12
- package/es/locale/en-US/messages.json +2 -0
- package/es/locale/id-ID/messages.json +2 -0
- package/es/locale/locale-provider.js +8 -10
- package/es/locale/th-TH/messages.json +2 -0
- package/es/locale/vi-VN/messages.json +2 -0
- package/es/locale/zh-CN/messages.json +2 -0
- package/es/login-page/index.js +30 -42
- package/es/media/index.js +20 -27
- package/es/media/media.js +9 -12
- package/es/media/preview.js +8 -10
- package/es/mobile-insurer-detail/index.js +74 -91
- package/es/mobile-insurer-list/index.js +34 -38
- package/es/modal/index.d.ts +4 -3
- package/es/modal/index.js +25 -27
- package/es/modal/style/index.less +24 -5
- package/es/platform/platform-card/index.js +9 -12
- package/es/platform/switch-platform/index.js +24 -32
- package/es/policy-list/index.js +11 -14
- package/es/policy-list/policy-card.js +119 -153
- package/es/radio/index.js +33 -35
- package/es/select/attached-select.js +31 -34
- package/es/select/select.js +12 -8
- package/es/select/style/index.less +1 -1
- package/es/select/time-select.js +12 -16
- package/es/status-box/index.js +8 -10
- package/es/table/index.js +72 -96
- package/es/tabs/index.js +7 -1
- package/es/types.d.ts +4 -2
- package/es/typography/index.js +6 -8
- package/es/upload/index.d.ts +2 -1
- package/es/upload/index.js +169 -143
- package/es/upload-photo/index.d.ts +2 -1
- package/es/upload-photo/index.js +170 -142
- package/es/upload-photo/media.js +3 -4
- package/es/upload-preview/index.js +9 -12
- package/es/upload-preview/media.js +12 -16
- package/es/upload-preview/style/index.less +2 -2
- package/es/utils/form-utils.js +49 -36
- package/lib/admin-upload/float.js +25 -35
- package/lib/admin-upload/index.d.ts +2 -0
- package/lib/admin-upload/index.js +43 -36
- package/lib/admin-upload/job-list.js +85 -115
- package/lib/admin-upload/modal.js +19 -26
- package/lib/alert-message/index.js +11 -9
- package/lib/amount/index.js +10 -5
- package/lib/back-top/index.js +14 -10
- package/lib/button/index.js +24 -29
- package/lib/button/style/index.less +23 -19
- package/lib/card-detail/card-group.js +16 -22
- package/lib/card-detail/card-item.js +16 -21
- package/lib/card-detail/card-page.js +11 -15
- package/lib/card-detail/card.js +24 -24
- package/lib/card-detail/index.js +6 -6
- package/lib/card-detail/style/index.less +13 -0
- package/lib/card-detail/utils.js +7 -8
- package/lib/checkbox/index.js +24 -23
- package/lib/claim-list/index.js +53 -70
- package/lib/confirmation/index.js +7 -9
- package/lib/date-picker/buddhist.js +3 -3
- package/lib/date-picker/index.js +11 -5
- package/lib/declaration/index.js +16 -13
- package/lib/detail-panel/index.js +67 -83
- package/lib/documents/index.js +6 -8
- package/lib/example/index.js +10 -12
- package/lib/filter/checkBox.js +33 -45
- package/lib/filter/customize.js +3 -4
- package/lib/filter/index.d.ts +1 -0
- package/lib/filter/index.js +88 -112
- package/lib/filter/radioBox.js +23 -31
- package/lib/filter/rangePicker.js +43 -59
- package/lib/form/addable-section/index.d.ts +19 -0
- package/lib/form/addable-section/index.js +232 -0
- package/lib/form/addable-section/style/index.d.ts +1 -0
- package/lib/form/addable-section/style/index.js +3 -0
- package/lib/form/addable-section/style/index.less +22 -0
- package/lib/form/divider/index.js +7 -1
- package/lib/form/element/index.js +60 -48
- package/lib/form/element/style/index.less +9 -0
- package/lib/form/elements.js +1 -1
- package/lib/form/index.js +16 -17
- package/lib/form/login/index.js +16 -21
- package/lib/form/page/index.js +19 -25
- package/lib/form/page/style/index.less +1 -1
- package/lib/form/pages/index.js +24 -33
- package/lib/form/pages/style/index.less +3 -1
- package/lib/form/render/index.js +2 -2
- package/lib/form/section/index.js +15 -18
- package/lib/form/step/index.js +32 -43
- package/lib/form/steps/index.js +9 -12
- package/lib/{form/context.d.ts → form-context.d.ts} +1 -0
- package/lib/{form/context.js → form-context.js} +0 -0
- package/lib/free-form/addable-section/index.d.ts +18 -0
- package/lib/free-form/addable-section/index.js +306 -0
- package/lib/free-form/addable-section/style/index.d.ts +1 -0
- package/lib/free-form/addable-section/style/index.js +3 -0
- package/lib/free-form/addable-section/style/index.less +22 -0
- package/lib/free-form/element/index.js +44 -42
- package/lib/free-form/element/style/index.less +12 -2
- package/lib/free-form/index.d.ts +5 -1
- package/lib/free-form/index.js +17 -17
- package/lib/free-form/page/index.js +37 -47
- package/lib/free-form/page/style/index.less +3 -1
- package/lib/free-form/pages/index.js +8 -10
- package/lib/free-form/section/index.js +21 -23
- package/lib/free-form/section/style/index.less +4 -0
- package/lib/free-form/step/index.js +38 -48
- package/lib/free-form/steps/index.js +9 -11
- package/lib/global-message/index.js +1 -1
- package/lib/home-menu/index.js +52 -71
- package/lib/index.d.ts +1 -0
- package/lib/index.js +141 -132
- package/lib/input/amount.js +10 -5
- package/lib/input/credit-card.js +7 -1
- package/lib/input/email.js +7 -1
- package/lib/input/expiry-date.js +14 -18
- package/lib/input/index.js +18 -18
- package/lib/input/input-date.js +12 -16
- package/lib/input/input-number.js +8 -2
- package/lib/input/input.js +8 -2
- package/lib/input/otp.js +17 -15
- package/lib/input/password.js +11 -6
- package/lib/input/phone-number.js +6 -8
- package/lib/input/style/index.less +9 -1
- package/lib/input/text-area.js +14 -10
- package/lib/layout/defaultFooter.js +60 -82
- package/lib/layout/defaultHeader.js +11 -15
- package/lib/layout/footer.js +108 -148
- package/lib/layout/header.js +51 -60
- package/lib/layout/index.js +15 -12
- package/lib/locale/en-US/messages.json +2 -0
- package/lib/locale/format-message.js +1 -1
- package/lib/locale/id-ID/messages.json +2 -0
- package/lib/locale/index.js +4 -4
- package/lib/locale/locale-provider.js +9 -11
- package/lib/locale/th-TH/messages.json +2 -0
- package/lib/locale/vi-VN/messages.json +2 -0
- package/lib/locale/zh-CN/messages.json +2 -0
- package/lib/login-page/index.js +30 -42
- package/lib/media/index.js +20 -27
- package/lib/media/media.js +9 -12
- package/lib/media/preview.js +8 -10
- package/lib/mobile-insurer-detail/index.js +74 -91
- package/lib/mobile-insurer-list/index.js +34 -38
- package/lib/modal/index.d.ts +4 -3
- package/lib/modal/index.js +25 -27
- package/lib/modal/style/index.less +24 -5
- package/lib/platform/platform-card/index.js +9 -12
- package/lib/platform/switch-platform/index.js +24 -32
- package/lib/policy-list/index.js +11 -14
- package/lib/policy-list/policy-card.js +119 -153
- package/lib/radio/index.js +33 -35
- package/lib/select/attached-select.js +32 -35
- package/lib/select/select.js +13 -9
- package/lib/select/style/index.less +1 -1
- package/lib/select/time-select.js +12 -16
- package/lib/status-box/index.js +8 -10
- package/lib/table/index.js +72 -96
- package/lib/tabs/index.js +8 -2
- package/lib/types.d.ts +4 -2
- package/lib/typography/index.js +6 -8
- package/lib/upload/index.d.ts +2 -1
- package/lib/upload/index.js +170 -143
- package/lib/upload-photo/index.d.ts +2 -1
- package/lib/upload-photo/index.js +171 -142
- package/lib/upload-photo/media.js +3 -4
- package/lib/upload-preview/index.js +9 -12
- package/lib/upload-preview/media.js +12 -16
- package/lib/upload-preview/style/index.less +2 -2
- package/lib/utils/form-utils.js +49 -37
- package/package.json +1 -1
- package/es/free-form/context.d.ts +0 -19
- package/es/free-form/context.js +0 -7
- package/lib/free-form/context.d.ts +0 -19
- package/lib/free-form/context.js +0 -19
|
@@ -115,9 +115,8 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
115
115
|
if (!files || !files.length) return _jsx("div", {
|
|
116
116
|
children: "-"
|
|
117
117
|
}, void 0);
|
|
118
|
-
return _jsxs("div",
|
|
119
|
-
className: "igloo-upload-preview"
|
|
120
|
-
}, {
|
|
118
|
+
return _jsxs("div", {
|
|
119
|
+
className: "igloo-upload-preview",
|
|
121
120
|
children: [description || (files.length === 1 ? formatMessage({
|
|
122
121
|
id: '1 file attached.'
|
|
123
122
|
}) : formatMessage({
|
|
@@ -133,20 +132,18 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
133
132
|
style: {
|
|
134
133
|
fontSize: 24
|
|
135
134
|
}
|
|
136
|
-
}, void 0), _jsxs(Modal,
|
|
135
|
+
}, void 0), _jsxs(Modal, {
|
|
137
136
|
visible: preview,
|
|
138
|
-
title: _jsxs(Typography,
|
|
139
|
-
level: "h4"
|
|
140
|
-
}, {
|
|
137
|
+
title: _jsxs(Typography, {
|
|
138
|
+
level: "h4",
|
|
141
139
|
children: [label, " (", current + 1, "/", files.length, ")"]
|
|
142
|
-
}
|
|
140
|
+
}, void 0),
|
|
143
141
|
className: "igloo-upload-preview-modal",
|
|
144
142
|
footer: null,
|
|
145
143
|
onCancel: function onCancel() {
|
|
146
144
|
return setPreview(false);
|
|
147
145
|
},
|
|
148
|
-
forceRender: false
|
|
149
|
-
}, {
|
|
146
|
+
forceRender: false,
|
|
150
147
|
children: [_jsx(Button, {
|
|
151
148
|
icon: _jsx(ArrowLeftOutlined, {}, void 0),
|
|
152
149
|
className: classnames('igloo-upload-preview-modal-button', 'igloo-upload-preview-modal-button-left'),
|
|
@@ -161,8 +158,8 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
161
158
|
onClick: next,
|
|
162
159
|
disabled: current >= files.length - 1
|
|
163
160
|
}, void 0)]
|
|
164
|
-
}
|
|
165
|
-
}
|
|
161
|
+
}, void 0)]
|
|
162
|
+
}, void 0);
|
|
166
163
|
};
|
|
167
164
|
|
|
168
165
|
export default UploadPreview;
|
|
@@ -53,11 +53,10 @@ var PDF = function PDF(_ref) {
|
|
|
53
53
|
}, i));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
return _jsx("div",
|
|
57
|
-
className: "igloo-upload-preview-pdf"
|
|
58
|
-
}, {
|
|
56
|
+
return _jsx("div", {
|
|
57
|
+
className: "igloo-upload-preview-pdf",
|
|
59
58
|
children: pages
|
|
60
|
-
}
|
|
59
|
+
}, void 0);
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
var Media = function Media(_ref3) {
|
|
@@ -68,20 +67,18 @@ var Media = function Media(_ref3) {
|
|
|
68
67
|
var _useContext = useContext(LocaleContext),
|
|
69
68
|
formatMessage = _useContext.formatMessage;
|
|
70
69
|
|
|
71
|
-
var children = _jsxs("div",
|
|
72
|
-
className: "igloo-upload-prevew-not-supported"
|
|
73
|
-
}, {
|
|
70
|
+
var children = _jsxs("div", {
|
|
71
|
+
className: "igloo-upload-prevew-not-supported",
|
|
74
72
|
children: [_jsx(ErrorFilled, {
|
|
75
73
|
className: "igloo-upload-prevew-not-supported-icon"
|
|
76
|
-
}, void 0), _jsx(Typography,
|
|
74
|
+
}, void 0), _jsx(Typography, {
|
|
77
75
|
level: "body1",
|
|
78
|
-
className: "igloo-upload-prevew-not-supported-text"
|
|
79
|
-
}, {
|
|
76
|
+
className: "igloo-upload-prevew-not-supported-text",
|
|
80
77
|
children: formatMessage({
|
|
81
78
|
id: 'No preview for this file. Only support image, video or PDF file.'
|
|
82
79
|
})
|
|
83
|
-
}
|
|
84
|
-
}
|
|
80
|
+
}, void 0)]
|
|
81
|
+
}, void 0);
|
|
85
82
|
|
|
86
83
|
if (type === 'image') {
|
|
87
84
|
children = _jsx("img", {
|
|
@@ -105,11 +102,10 @@ var Media = function Media(_ref3) {
|
|
|
105
102
|
}, void 0);
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
return _jsx("div",
|
|
109
|
-
className: classNames('igloo-upload-preview-container', className)
|
|
110
|
-
}, {
|
|
105
|
+
return _jsx("div", {
|
|
106
|
+
className: classNames('igloo-upload-preview-container', className),
|
|
111
107
|
children: children
|
|
112
|
-
}
|
|
108
|
+
}, void 0);
|
|
113
109
|
};
|
|
114
110
|
|
|
115
111
|
export default Media;
|
package/es/utils/form-utils.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var _excluded = ["type", "name", "required", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater"],
|
|
1
|
+
var _excluded = ["type", "name", "required", "requiredAsserts", "showOptional", "rules", "initialValue", "normalize", "mergeRules", "getValueFromEvent", "getValueProps", "extra", "help", "label", "previewLabel", "extraLabel", "copyValue", "selectValue", "span", "halfRow", "fullRow", "valuePropName", "dependencies", "asserts", "messageVariables", "requiredMessage", "previewFormater", "disabled", "ignore", "shouldRender", "valueFormater"],
|
|
2
2
|
_excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
|
|
3
3
|
|
|
4
4
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
5
5
|
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
6
|
+
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; }
|
|
7
7
|
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
9
|
|
|
10
10
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
11
|
|
|
@@ -36,7 +36,7 @@ export var calcNamePath = function calcNamePath(parentName, name) {
|
|
|
36
36
|
names.push(parentName);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
if (name) {
|
|
39
|
+
if (name !== undefined) {
|
|
40
40
|
names.push(name);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -45,9 +45,8 @@ export var calcNamePath = function calcNamePath(parentName, name) {
|
|
|
45
45
|
export var testAssert = function testAssert(form, assert) {
|
|
46
46
|
var field = assert.field,
|
|
47
47
|
value = assert.value,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var v = form.getFieldValue(field);
|
|
48
|
+
operation = assert.operation;
|
|
49
|
+
var v = form.getFieldValue(typeof field === 'string' ? field.split('.') : field);
|
|
51
50
|
|
|
52
51
|
switch (operation) {
|
|
53
52
|
case 'ne':
|
|
@@ -86,18 +85,39 @@ export var testAssert = function testAssert(form, assert) {
|
|
|
86
85
|
if (v === undefined || v < value) return false;
|
|
87
86
|
break;
|
|
88
87
|
|
|
88
|
+
case 'filled':
|
|
89
|
+
return v !== undefined;
|
|
90
|
+
|
|
89
91
|
case 'eq':
|
|
92
|
+
return v === value;
|
|
93
|
+
|
|
90
94
|
default:
|
|
91
|
-
if (
|
|
95
|
+
if (value !== undefined) return v === value;
|
|
96
|
+
return v !== undefined;
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
return true;
|
|
95
100
|
};
|
|
101
|
+
|
|
102
|
+
var calcRequired = function calcRequired() {
|
|
103
|
+
var required = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
104
|
+
var form = arguments.length > 1 ? arguments[1] : undefined;
|
|
105
|
+
var requiredAsserts = arguments.length > 2 ? arguments[2] : undefined;
|
|
106
|
+
|
|
107
|
+
if (Array.isArray(requiredAsserts)) {
|
|
108
|
+
return requiredAsserts.every(function (assert) {
|
|
109
|
+
return form && testAssert(form, assert);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return required;
|
|
114
|
+
};
|
|
115
|
+
|
|
96
116
|
export var calcFormItemProps = function calcFormItemProps(config, extraProps, form, parentName) {
|
|
97
117
|
var type = config.type,
|
|
98
118
|
nameProp = config.name,
|
|
99
|
-
|
|
100
|
-
|
|
119
|
+
required = config.required,
|
|
120
|
+
requiredAsserts = config.requiredAsserts,
|
|
101
121
|
_config$showOptional = config.showOptional,
|
|
102
122
|
showOptional = _config$showOptional === void 0 ? false : _config$showOptional,
|
|
103
123
|
_config$rules = config.rules,
|
|
@@ -161,7 +181,7 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
|
|
|
161
181
|
className = extraProps.className,
|
|
162
182
|
extraRest = _objectWithoutProperties(extraProps, _excluded2);
|
|
163
183
|
|
|
164
|
-
var rules = required
|
|
184
|
+
var rules = calcRequired(required, form, requiredAsserts) ? [{
|
|
165
185
|
required: true,
|
|
166
186
|
message: requiredMessage || extraRequiredMessage
|
|
167
187
|
}].concat(_toConsumableArray(propsRules)) : _toConsumableArray(propsRules);
|
|
@@ -206,40 +226,33 @@ export var calcFormItemProps = function calcFormItemProps(config, extraProps, fo
|
|
|
206
226
|
normalize: normalize || extraNormalize,
|
|
207
227
|
rules: rules,
|
|
208
228
|
validateTrigger: _toConsumableArray(new Set(validateTriggers)),
|
|
209
|
-
label: label ? _jsxs("div",
|
|
210
|
-
className: "igloo-form-label"
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
children: [_jsx(Typography, Object.assign({
|
|
216
|
-
level: "body1"
|
|
217
|
-
}, {
|
|
229
|
+
label: label ? _jsxs("div", {
|
|
230
|
+
className: "igloo-form-label",
|
|
231
|
+
children: [_jsxs("div", {
|
|
232
|
+
className: "igloo-form-label-text",
|
|
233
|
+
children: [_jsx(Typography, {
|
|
234
|
+
level: "body1",
|
|
218
235
|
children: label
|
|
219
|
-
}
|
|
220
|
-
className: "igloo-form-label-required"
|
|
221
|
-
}, {
|
|
236
|
+
}, void 0), isRequired && requiredMark && _jsx("span", {
|
|
237
|
+
className: "igloo-form-label-required",
|
|
222
238
|
children: "*"
|
|
223
|
-
}
|
|
224
|
-
className: "igloo-form-label-optional"
|
|
225
|
-
}, {
|
|
239
|
+
}, void 0), showOptional && _jsxs("span", {
|
|
240
|
+
className: "igloo-form-label-optional",
|
|
226
241
|
children: ["(", formatMessage({
|
|
227
242
|
id: 'Optional'
|
|
228
243
|
}), ")"]
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
className: "igloo-form-label-extra"
|
|
232
|
-
}, {
|
|
244
|
+
}, void 0)]
|
|
245
|
+
}, void 0), extraLabel && _jsx("div", {
|
|
246
|
+
className: "igloo-form-label-extra",
|
|
233
247
|
children: typeof extraLabel === 'function' ? extraLabel(form) : extraLabel
|
|
234
|
-
}
|
|
235
|
-
}
|
|
248
|
+
}, void 0)]
|
|
249
|
+
}, void 0) : null,
|
|
236
250
|
getValueFromEvent: getValueFromEvent || extraGetValueFromEvent,
|
|
237
251
|
getValueProps: getValueProps,
|
|
238
|
-
extra: (extra || extraExtra) && _jsx(Typography,
|
|
239
|
-
level: "caption2"
|
|
240
|
-
}, {
|
|
252
|
+
extra: (extra || extraExtra) && _jsx(Typography, {
|
|
253
|
+
level: "caption2",
|
|
241
254
|
children: extra || extraExtra
|
|
242
|
-
}
|
|
255
|
+
}, void 0),
|
|
243
256
|
help: help || extraHelp,
|
|
244
257
|
valuePropName: valuePropName || extraValuePropName,
|
|
245
258
|
messageVariables: _objectSpread({
|
|
@@ -57,21 +57,17 @@ var Float = function Float(_ref) {
|
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
return (0, _jsxRuntime.jsxs)("div",
|
|
61
|
-
className: "igloo-admin-upload-float"
|
|
62
|
-
|
|
63
|
-
children: [(0, _jsxRuntime.jsxs)("div", Object.assign({
|
|
60
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
61
|
+
className: "igloo-admin-upload-float",
|
|
62
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
64
63
|
className: "igloo-admin-upload-float-header",
|
|
65
64
|
onClick: function onClick() {
|
|
66
65
|
return setOpen(!open);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
children: [(0, _jsxRuntime.jsx)("div", Object.assign({
|
|
73
|
-
className: "igloo-admin-upload-float-header-icon-box"
|
|
74
|
-
}, {
|
|
66
|
+
},
|
|
67
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
68
|
+
className: "igloo-admin-upload-float-header-left",
|
|
69
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
70
|
+
className: "igloo-admin-upload-float-header-icon-box",
|
|
75
71
|
children: processingNumber ? (0, _jsxRuntime.jsx)(_iglooicon.ProcessingOutlined, {
|
|
76
72
|
className: "igloo-admin-upload-float-header-icon",
|
|
77
73
|
spinning: true,
|
|
@@ -79,31 +75,27 @@ var Float = function Float(_ref) {
|
|
|
79
75
|
}, void 0) : (0, _jsxRuntime.jsx)(_iglooicon.CheckOutlined, {
|
|
80
76
|
className: "igloo-admin-upload-float-header-icon"
|
|
81
77
|
}, void 0)
|
|
82
|
-
}
|
|
83
|
-
className: "igloo-admin-upload-float-header-text"
|
|
84
|
-
|
|
85
|
-
children: [(0, _jsxRuntime.jsx)(_typography.default, Object.assign({
|
|
78
|
+
}, void 0), (0, _jsxRuntime.jsxs)("div", {
|
|
79
|
+
className: "igloo-admin-upload-float-header-text",
|
|
80
|
+
children: [(0, _jsxRuntime.jsx)(_typography.default, {
|
|
86
81
|
level: "h5",
|
|
87
|
-
wrapElement: "div"
|
|
88
|
-
}, {
|
|
82
|
+
wrapElement: "div",
|
|
89
83
|
children: title || formatMessage({
|
|
90
84
|
id: 'Data Importing Queue'
|
|
91
85
|
})
|
|
92
|
-
}
|
|
86
|
+
}, void 0), formatTips && (0, _jsxRuntime.jsx)(_typography.default, {
|
|
93
87
|
level: "body3",
|
|
94
88
|
wrapElement: "div",
|
|
95
|
-
className: "igloo-admin-upload-float-header-tips"
|
|
96
|
-
}, {
|
|
89
|
+
className: "igloo-admin-upload-float-header-tips",
|
|
97
90
|
children: formatTips({
|
|
98
91
|
uploading: uploadingNumber,
|
|
99
92
|
processing: processingNumber,
|
|
100
93
|
done: doneNumber
|
|
101
94
|
})
|
|
102
|
-
}
|
|
95
|
+
}, void 0), !formatTips && (0, _jsxRuntime.jsx)(_typography.default, {
|
|
103
96
|
level: "body3",
|
|
104
97
|
wrapElement: "div",
|
|
105
|
-
className: "igloo-admin-upload-float-header-tips"
|
|
106
|
-
}, {
|
|
98
|
+
className: "igloo-admin-upload-float-header-tips",
|
|
107
99
|
children: processingNumber ? processingNumber === 1 ? formatMessage({
|
|
108
100
|
id: '1 file in progress...'
|
|
109
101
|
}) : formatMessage({
|
|
@@ -119,22 +111,20 @@ var Float = function Float(_ref) {
|
|
|
119
111
|
doneNumber: doneNumber
|
|
120
112
|
}
|
|
121
113
|
})
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
className: "igloo-admin-upload-float-header-right"
|
|
126
|
-
}, {
|
|
114
|
+
}, void 0)]
|
|
115
|
+
}, void 0)]
|
|
116
|
+
}, void 0), (0, _jsxRuntime.jsxs)("div", {
|
|
117
|
+
className: "igloo-admin-upload-float-header-right",
|
|
127
118
|
children: [open ? (0, _jsxRuntime.jsx)(_iglooicon.ArrowUpOutlined, {}, void 0) : (0, _jsxRuntime.jsx)(_iglooicon.ArrowDownOutlined, {}, void 0), !processingNumber && (0, _jsxRuntime.jsx)(_iglooicon.CrossOutlined, {
|
|
128
119
|
className: "igloo-admin-upload-float-header-close",
|
|
129
120
|
onClick: onClose
|
|
130
121
|
}, void 0)]
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
className: "igloo-admin-upload-float-content"
|
|
134
|
-
}, {
|
|
122
|
+
}, void 0)]
|
|
123
|
+
}, void 0), open && (0, _jsxRuntime.jsx)("div", {
|
|
124
|
+
className: "igloo-admin-upload-float-content",
|
|
135
125
|
children: children
|
|
136
|
-
}
|
|
137
|
-
}
|
|
126
|
+
}, void 0)]
|
|
127
|
+
}, void 0);
|
|
138
128
|
};
|
|
139
129
|
|
|
140
130
|
var _default = Float;
|
|
@@ -2,6 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { RequestMethod } from 'umi-request';
|
|
3
3
|
import { IglooButtonProps } from '../button';
|
|
4
4
|
import { UploadProps } from 'antd/es/upload';
|
|
5
|
+
import { Job } from './job-list';
|
|
5
6
|
import './style';
|
|
6
7
|
export interface AdminUploadProps {
|
|
7
8
|
dataSource: string | {
|
|
@@ -29,6 +30,7 @@ export interface AdminUploadProps {
|
|
|
29
30
|
done: number;
|
|
30
31
|
}) => string;
|
|
31
32
|
selectPlaceholder?: string;
|
|
33
|
+
onFinish?: (jobs: Job[]) => any;
|
|
32
34
|
}
|
|
33
35
|
declare const AdminUpload: FC<AdminUploadProps>;
|
|
34
36
|
export default AdminUpload;
|
|
@@ -41,9 +41,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
41
41
|
|
|
42
42
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
43
43
|
|
|
44
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
44
|
+
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; }
|
|
45
45
|
|
|
46
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
46
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
47
47
|
|
|
48
48
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
49
49
|
|
|
@@ -81,7 +81,8 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
81
81
|
refreshInteval = _ref$refreshInteval === void 0 ? 1000 : _ref$refreshInteval,
|
|
82
82
|
accept = _ref.accept,
|
|
83
83
|
formatTips = _ref.formatTips,
|
|
84
|
-
selectPlaceholder = _ref.selectPlaceholder
|
|
84
|
+
selectPlaceholder = _ref.selectPlaceholder,
|
|
85
|
+
onFinish = _ref.onFinish;
|
|
85
86
|
(0, _invariant.default)(dataSource, 'dataSource is required');
|
|
86
87
|
(0, _invariant.default)(typeof requestMethod === 'function', 'requestMethod is required');
|
|
87
88
|
|
|
@@ -189,11 +190,19 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
189
190
|
var data = _ref4.data;
|
|
190
191
|
var processing = [];
|
|
191
192
|
var done = [];
|
|
193
|
+
var latestFinished = [];
|
|
192
194
|
data === null || data === void 0 ? void 0 : (_data$sort = data.sort(function (a, b) {
|
|
193
195
|
return b.create_at - a.create_at;
|
|
194
196
|
})) === null || _data$sort === void 0 ? void 0 : _data$sort.forEach(function (job) {
|
|
195
197
|
if (job.status === 'Done') {
|
|
196
198
|
done.push(job);
|
|
199
|
+
|
|
200
|
+
if (!doneJobs.find(function (_ref5) {
|
|
201
|
+
var job_id = _ref5.job_id;
|
|
202
|
+
return job.job_id === job_id;
|
|
203
|
+
})) {
|
|
204
|
+
latestFinished.push(job);
|
|
205
|
+
}
|
|
197
206
|
}
|
|
198
207
|
|
|
199
208
|
if (job.status === 'Processing') {
|
|
@@ -202,6 +211,11 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
202
211
|
});
|
|
203
212
|
setProcessingJobs(processing);
|
|
204
213
|
setDoneJobs(done);
|
|
214
|
+
|
|
215
|
+
if (latestFinished.length && typeof onFinish === 'function') {
|
|
216
|
+
onFinish(latestFinished);
|
|
217
|
+
}
|
|
218
|
+
|
|
205
219
|
setFailed(false);
|
|
206
220
|
|
|
207
221
|
if (!(processing === null || processing === void 0 ? void 0 : processing.length)) {
|
|
@@ -277,8 +291,8 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
277
291
|
refresh().then(function () {
|
|
278
292
|
handleRemoveUpload(uid);
|
|
279
293
|
});
|
|
280
|
-
}).catch(function (
|
|
281
|
-
var errorMessage =
|
|
294
|
+
}).catch(function (_ref6) {
|
|
295
|
+
var errorMessage = _ref6.errorMessage;
|
|
282
296
|
dispatch({
|
|
283
297
|
type: 'update',
|
|
284
298
|
payload: {
|
|
@@ -329,7 +343,7 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
329
343
|
};
|
|
330
344
|
|
|
331
345
|
var handleRemoveJob = (0, _lodash.default)( /*#__PURE__*/function () {
|
|
332
|
-
var
|
|
346
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(jobId) {
|
|
333
347
|
var rst;
|
|
334
348
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
335
349
|
while (1) {
|
|
@@ -354,7 +368,7 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
354
368
|
}));
|
|
355
369
|
|
|
356
370
|
return function (_x) {
|
|
357
|
-
return
|
|
371
|
+
return _ref7.apply(this, arguments);
|
|
358
372
|
};
|
|
359
373
|
}(), 2000, {
|
|
360
374
|
leading: true,
|
|
@@ -362,15 +376,15 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
362
376
|
});
|
|
363
377
|
|
|
364
378
|
var handleHideJobs = /*#__PURE__*/function () {
|
|
365
|
-
var
|
|
379
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
366
380
|
var rst;
|
|
367
381
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
368
382
|
while (1) {
|
|
369
383
|
switch (_context2.prev = _context2.next) {
|
|
370
384
|
case 0:
|
|
371
385
|
_context2.next = 2;
|
|
372
|
-
return remove(doneJobs.map(function (
|
|
373
|
-
var job_id =
|
|
386
|
+
return remove(doneJobs.map(function (_ref9) {
|
|
387
|
+
var job_id = _ref9.job_id;
|
|
374
388
|
return job_id;
|
|
375
389
|
}));
|
|
376
390
|
|
|
@@ -391,7 +405,7 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
391
405
|
}));
|
|
392
406
|
|
|
393
407
|
return function handleHideJobs() {
|
|
394
|
-
return
|
|
408
|
+
return _ref8.apply(this, arguments);
|
|
395
409
|
};
|
|
396
410
|
}();
|
|
397
411
|
|
|
@@ -400,20 +414,18 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
400
414
|
setShowFloatComfirm(true);
|
|
401
415
|
};
|
|
402
416
|
|
|
403
|
-
return (0, _jsxRuntime.jsxs)("div",
|
|
404
|
-
className: "igloo-admin-upload"
|
|
405
|
-
|
|
406
|
-
children: [(0, _jsxRuntime.jsx)(_button.default, Object.assign({
|
|
417
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
418
|
+
className: "igloo-admin-upload",
|
|
419
|
+
children: [(0, _jsxRuntime.jsx)(_button.default, {
|
|
407
420
|
type: buttonType,
|
|
408
421
|
onClick: function onClick() {
|
|
409
422
|
return setShowModal(true);
|
|
410
423
|
},
|
|
411
|
-
icon: (0, _jsxRuntime.jsx)(_iglooicon.PublishOutlined, {}, void 0)
|
|
412
|
-
}, {
|
|
424
|
+
icon: (0, _jsxRuntime.jsx)(_iglooicon.PublishOutlined, {}, void 0),
|
|
413
425
|
children: buttonText || formatMessage({
|
|
414
426
|
id: 'Import'
|
|
415
427
|
})
|
|
416
|
-
}
|
|
428
|
+
}, void 0), (0, _jsxRuntime.jsx)(_modal2.default, {
|
|
417
429
|
title: modalTitle,
|
|
418
430
|
accept: accept,
|
|
419
431
|
visible: showModal,
|
|
@@ -422,8 +434,7 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
422
434
|
onClose: function onClose() {
|
|
423
435
|
return setShowModal(false);
|
|
424
436
|
},
|
|
425
|
-
onUpload: handleUpload
|
|
426
|
-
}, {
|
|
437
|
+
onUpload: handleUpload,
|
|
427
438
|
children: (0, _jsxRuntime.jsx)(_jobList.default, {
|
|
428
439
|
uploadJobs: uploadJobs,
|
|
429
440
|
processingJobs: processingJobs,
|
|
@@ -435,15 +446,14 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
435
446
|
cancelProcess: handleRemoveJob,
|
|
436
447
|
hideJob: handleRemoveJob
|
|
437
448
|
}, void 0)
|
|
438
|
-
}
|
|
449
|
+
}, void 0), (0, _jsxRuntime.jsx)(_float.default, {
|
|
439
450
|
title: floatTitle,
|
|
440
451
|
visible: showFloat,
|
|
441
452
|
uploadingNumber: uploadJobs.length,
|
|
442
453
|
processingNumber: processingJobs.length,
|
|
443
454
|
doneNumber: doneJobs.length,
|
|
444
455
|
onClose: handleCloseFloat,
|
|
445
|
-
formatTips: formatTips
|
|
446
|
-
}, {
|
|
456
|
+
formatTips: formatTips,
|
|
447
457
|
children: (0, _jsxRuntime.jsx)(_jobList.default, {
|
|
448
458
|
uploadJobs: uploadJobs,
|
|
449
459
|
processingJobs: processingJobs,
|
|
@@ -455,7 +465,7 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
455
465
|
cancelProcess: handleRemoveJob,
|
|
456
466
|
hideJob: handleRemoveJob
|
|
457
467
|
}, void 0)
|
|
458
|
-
}
|
|
468
|
+
}, void 0), (0, _jsxRuntime.jsx)(_modal.default, {
|
|
459
469
|
cancelText: formatMessage({
|
|
460
470
|
id: 'Cancel'
|
|
461
471
|
}),
|
|
@@ -486,19 +496,16 @@ var AdminUpload = function AdminUpload(_ref) {
|
|
|
486
496
|
style: {
|
|
487
497
|
fontSize: 24
|
|
488
498
|
}
|
|
489
|
-
}, void 0)
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
children: ["Would you like to close the result panel now? You can go to", ' ', (0, _jsxRuntime.jsxs)(_typography.default, Object.assign({
|
|
495
|
-
level: "caption1"
|
|
496
|
-
}, {
|
|
499
|
+
}, void 0),
|
|
500
|
+
children: (0, _jsxRuntime.jsxs)(_typography.default, {
|
|
501
|
+
level: "body1",
|
|
502
|
+
children: ["Would you like to close the result panel now? You can go to", ' ', (0, _jsxRuntime.jsxs)(_typography.default, {
|
|
503
|
+
level: "caption1",
|
|
497
504
|
children: ["My Account ", '>', " Activity Log"]
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}
|
|
505
|
+
}, void 0), ' ', "to view this import result after this panel is closed."]
|
|
506
|
+
}, void 0)
|
|
507
|
+
}, void 0)]
|
|
508
|
+
}, void 0);
|
|
502
509
|
};
|
|
503
510
|
|
|
504
511
|
var _default = AdminUpload;
|