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
|
@@ -134,9 +134,8 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
134
134
|
if (!files || !files.length) return (0, _jsxRuntime.jsx)("div", {
|
|
135
135
|
children: "-"
|
|
136
136
|
}, void 0);
|
|
137
|
-
return (0, _jsxRuntime.jsxs)("div",
|
|
138
|
-
className: "igloo-upload-preview"
|
|
139
|
-
}, {
|
|
137
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
138
|
+
className: "igloo-upload-preview",
|
|
140
139
|
children: [description || (files.length === 1 ? formatMessage({
|
|
141
140
|
id: '1 file attached.'
|
|
142
141
|
}) : formatMessage({
|
|
@@ -152,20 +151,18 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
152
151
|
style: {
|
|
153
152
|
fontSize: 24
|
|
154
153
|
}
|
|
155
|
-
}, void 0), (0, _jsxRuntime.jsxs)(_modal.default,
|
|
154
|
+
}, void 0), (0, _jsxRuntime.jsxs)(_modal.default, {
|
|
156
155
|
visible: preview,
|
|
157
|
-
title: (0, _jsxRuntime.jsxs)(_typography.default,
|
|
158
|
-
level: "h4"
|
|
159
|
-
}, {
|
|
156
|
+
title: (0, _jsxRuntime.jsxs)(_typography.default, {
|
|
157
|
+
level: "h4",
|
|
160
158
|
children: [label, " (", current + 1, "/", files.length, ")"]
|
|
161
|
-
}
|
|
159
|
+
}, void 0),
|
|
162
160
|
className: "igloo-upload-preview-modal",
|
|
163
161
|
footer: null,
|
|
164
162
|
onCancel: function onCancel() {
|
|
165
163
|
return setPreview(false);
|
|
166
164
|
},
|
|
167
|
-
forceRender: false
|
|
168
|
-
}, {
|
|
165
|
+
forceRender: false,
|
|
169
166
|
children: [(0, _jsxRuntime.jsx)(_button.default, {
|
|
170
167
|
icon: (0, _jsxRuntime.jsx)(_iglooicon.ArrowLeftOutlined, {}, void 0),
|
|
171
168
|
className: (0, _classnames.default)('igloo-upload-preview-modal-button', 'igloo-upload-preview-modal-button-left'),
|
|
@@ -180,8 +177,8 @@ var UploadPreview = function UploadPreview(_ref) {
|
|
|
180
177
|
onClick: next,
|
|
181
178
|
disabled: current >= files.length - 1
|
|
182
179
|
}, void 0)]
|
|
183
|
-
}
|
|
184
|
-
}
|
|
180
|
+
}, void 0)]
|
|
181
|
+
}, void 0);
|
|
185
182
|
};
|
|
186
183
|
|
|
187
184
|
var _default = UploadPreview;
|
|
@@ -70,11 +70,10 @@ var PDF = function PDF(_ref) {
|
|
|
70
70
|
}, i));
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
return (0, _jsxRuntime.jsx)("div",
|
|
74
|
-
className: "igloo-upload-preview-pdf"
|
|
75
|
-
}, {
|
|
73
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
74
|
+
className: "igloo-upload-preview-pdf",
|
|
76
75
|
children: pages
|
|
77
|
-
}
|
|
76
|
+
}, void 0);
|
|
78
77
|
};
|
|
79
78
|
|
|
80
79
|
var Media = function Media(_ref3) {
|
|
@@ -85,20 +84,18 @@ var Media = function Media(_ref3) {
|
|
|
85
84
|
var _useContext = (0, _react.useContext)(_localeContext.default),
|
|
86
85
|
formatMessage = _useContext.formatMessage;
|
|
87
86
|
|
|
88
|
-
var children = (0, _jsxRuntime.jsxs)("div",
|
|
89
|
-
className: "igloo-upload-prevew-not-supported"
|
|
90
|
-
}, {
|
|
87
|
+
var children = (0, _jsxRuntime.jsxs)("div", {
|
|
88
|
+
className: "igloo-upload-prevew-not-supported",
|
|
91
89
|
children: [(0, _jsxRuntime.jsx)(_iglooicon.ErrorFilled, {
|
|
92
90
|
className: "igloo-upload-prevew-not-supported-icon"
|
|
93
|
-
}, void 0), (0, _jsxRuntime.jsx)(_typography.default,
|
|
91
|
+
}, void 0), (0, _jsxRuntime.jsx)(_typography.default, {
|
|
94
92
|
level: "body1",
|
|
95
|
-
className: "igloo-upload-prevew-not-supported-text"
|
|
96
|
-
}, {
|
|
93
|
+
className: "igloo-upload-prevew-not-supported-text",
|
|
97
94
|
children: formatMessage({
|
|
98
95
|
id: 'No preview for this file. Only support image, video or PDF file.'
|
|
99
96
|
})
|
|
100
|
-
}
|
|
101
|
-
}
|
|
97
|
+
}, void 0)]
|
|
98
|
+
}, void 0);
|
|
102
99
|
|
|
103
100
|
if (type === 'image') {
|
|
104
101
|
children = (0, _jsxRuntime.jsx)("img", {
|
|
@@ -122,11 +119,10 @@ var Media = function Media(_ref3) {
|
|
|
122
119
|
}, void 0);
|
|
123
120
|
}
|
|
124
121
|
|
|
125
|
-
return (0, _jsxRuntime.jsx)("div",
|
|
126
|
-
className: (0, _classnames.default)('igloo-upload-preview-container', className)
|
|
127
|
-
}, {
|
|
122
|
+
return (0, _jsxRuntime.jsx)("div", {
|
|
123
|
+
className: (0, _classnames.default)('igloo-upload-preview-container', className),
|
|
128
124
|
children: children
|
|
129
|
-
}
|
|
125
|
+
}, void 0);
|
|
130
126
|
};
|
|
131
127
|
|
|
132
128
|
var _default = Media;
|
package/lib/utils/form-utils.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.testAssert = exports.calcShouldRender = exports.calcSelectValue = exports.calcNamePath = exports.calcFormItemProps = exports.calcDisabled = exports.calcCopyValue = void 0;
|
|
7
7
|
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
|
|
@@ -13,16 +13,16 @@ var _typography = _interopRequireDefault(require("../typography"));
|
|
|
13
13
|
|
|
14
14
|
var _formattedMessage = _interopRequireDefault(require("../locale/formatted-message"));
|
|
15
15
|
|
|
16
|
-
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"],
|
|
16
|
+
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"],
|
|
17
17
|
_excluded2 = ["initialValue", "normalize", "rules", "extra", "help", "getValueFromEvent", "span", "valuePropName", "fullRow", "halfRow", "messageVariables", "requiredMessage", "previewFormater", "valueFormater", "required", "requiredMark", "className"];
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
21
21
|
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; } } }; }
|
|
22
22
|
|
|
23
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
23
|
+
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; }
|
|
24
24
|
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
25
|
+
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; }
|
|
26
26
|
|
|
27
27
|
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; }
|
|
28
28
|
|
|
@@ -49,7 +49,7 @@ var calcNamePath = function calcNamePath(parentName, name) {
|
|
|
49
49
|
names.push(parentName);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (name) {
|
|
52
|
+
if (name !== undefined) {
|
|
53
53
|
names.push(name);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -61,9 +61,8 @@ exports.calcNamePath = calcNamePath;
|
|
|
61
61
|
var testAssert = function testAssert(form, assert) {
|
|
62
62
|
var field = assert.field,
|
|
63
63
|
value = assert.value,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var v = form.getFieldValue(field);
|
|
64
|
+
operation = assert.operation;
|
|
65
|
+
var v = form.getFieldValue(typeof field === 'string' ? field.split('.') : field);
|
|
67
66
|
|
|
68
67
|
switch (operation) {
|
|
69
68
|
case 'ne':
|
|
@@ -102,9 +101,15 @@ var testAssert = function testAssert(form, assert) {
|
|
|
102
101
|
if (v === undefined || v < value) return false;
|
|
103
102
|
break;
|
|
104
103
|
|
|
104
|
+
case 'filled':
|
|
105
|
+
return v !== undefined;
|
|
106
|
+
|
|
105
107
|
case 'eq':
|
|
108
|
+
return v === value;
|
|
109
|
+
|
|
106
110
|
default:
|
|
107
|
-
if (
|
|
111
|
+
if (value !== undefined) return v === value;
|
|
112
|
+
return v !== undefined;
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
return true;
|
|
@@ -112,11 +117,25 @@ var testAssert = function testAssert(form, assert) {
|
|
|
112
117
|
|
|
113
118
|
exports.testAssert = testAssert;
|
|
114
119
|
|
|
120
|
+
var calcRequired = function calcRequired() {
|
|
121
|
+
var required = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
122
|
+
var form = arguments.length > 1 ? arguments[1] : undefined;
|
|
123
|
+
var requiredAsserts = arguments.length > 2 ? arguments[2] : undefined;
|
|
124
|
+
|
|
125
|
+
if (Array.isArray(requiredAsserts)) {
|
|
126
|
+
return requiredAsserts.every(function (assert) {
|
|
127
|
+
return form && testAssert(form, assert);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return required;
|
|
132
|
+
};
|
|
133
|
+
|
|
115
134
|
var calcFormItemProps = function calcFormItemProps(config, extraProps, form, parentName) {
|
|
116
135
|
var type = config.type,
|
|
117
136
|
nameProp = config.name,
|
|
118
|
-
|
|
119
|
-
|
|
137
|
+
required = config.required,
|
|
138
|
+
requiredAsserts = config.requiredAsserts,
|
|
120
139
|
_config$showOptional = config.showOptional,
|
|
121
140
|
showOptional = _config$showOptional === void 0 ? false : _config$showOptional,
|
|
122
141
|
_config$rules = config.rules,
|
|
@@ -180,7 +199,7 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
180
199
|
className = extraProps.className,
|
|
181
200
|
extraRest = _objectWithoutProperties(extraProps, _excluded2);
|
|
182
201
|
|
|
183
|
-
var rules = required
|
|
202
|
+
var rules = calcRequired(required, form, requiredAsserts) ? [{
|
|
184
203
|
required: true,
|
|
185
204
|
message: requiredMessage || extraRequiredMessage
|
|
186
205
|
}].concat(_toConsumableArray(propsRules)) : _toConsumableArray(propsRules);
|
|
@@ -225,40 +244,33 @@ var calcFormItemProps = function calcFormItemProps(config, extraProps, form, par
|
|
|
225
244
|
normalize: normalize || extraNormalize,
|
|
226
245
|
rules: rules,
|
|
227
246
|
validateTrigger: _toConsumableArray(new Set(validateTriggers)),
|
|
228
|
-
label: label ? (0, _jsxRuntime.jsxs)("div",
|
|
229
|
-
className: "igloo-form-label"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
children: [(0, _jsxRuntime.jsx)(_typography.default, Object.assign({
|
|
235
|
-
level: "body1"
|
|
236
|
-
}, {
|
|
247
|
+
label: label ? (0, _jsxRuntime.jsxs)("div", {
|
|
248
|
+
className: "igloo-form-label",
|
|
249
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
250
|
+
className: "igloo-form-label-text",
|
|
251
|
+
children: [(0, _jsxRuntime.jsx)(_typography.default, {
|
|
252
|
+
level: "body1",
|
|
237
253
|
children: label
|
|
238
|
-
}
|
|
239
|
-
className: "igloo-form-label-required"
|
|
240
|
-
}, {
|
|
254
|
+
}, void 0), isRequired && requiredMark && (0, _jsxRuntime.jsx)("span", {
|
|
255
|
+
className: "igloo-form-label-required",
|
|
241
256
|
children: "*"
|
|
242
|
-
}
|
|
243
|
-
className: "igloo-form-label-optional"
|
|
244
|
-
}, {
|
|
257
|
+
}, void 0), showOptional && (0, _jsxRuntime.jsxs)("span", {
|
|
258
|
+
className: "igloo-form-label-optional",
|
|
245
259
|
children: ["(", (0, _formattedMessage.default)({
|
|
246
260
|
id: 'Optional'
|
|
247
261
|
}), ")"]
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
className: "igloo-form-label-extra"
|
|
251
|
-
}, {
|
|
262
|
+
}, void 0)]
|
|
263
|
+
}, void 0), extraLabel && (0, _jsxRuntime.jsx)("div", {
|
|
264
|
+
className: "igloo-form-label-extra",
|
|
252
265
|
children: typeof extraLabel === 'function' ? extraLabel(form) : extraLabel
|
|
253
|
-
}
|
|
254
|
-
}
|
|
266
|
+
}, void 0)]
|
|
267
|
+
}, void 0) : null,
|
|
255
268
|
getValueFromEvent: getValueFromEvent || extraGetValueFromEvent,
|
|
256
269
|
getValueProps: getValueProps,
|
|
257
|
-
extra: (extra || extraExtra) && (0, _jsxRuntime.jsx)(_typography.default,
|
|
258
|
-
level: "caption2"
|
|
259
|
-
}, {
|
|
270
|
+
extra: (extra || extraExtra) && (0, _jsxRuntime.jsx)(_typography.default, {
|
|
271
|
+
level: "caption2",
|
|
260
272
|
children: extra || extraExtra
|
|
261
|
-
}
|
|
273
|
+
}, void 0),
|
|
262
274
|
help: help || extraHelp,
|
|
263
275
|
valuePropName: valuePropName || extraValuePropName,
|
|
264
276
|
messageVariables: _objectSpread({
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance } from 'antd/es/form';
|
|
3
|
-
import { FormItemName } from '@/types';
|
|
4
|
-
declare const _default: React.Context<{
|
|
5
|
-
form?: FormInstance<any> | undefined;
|
|
6
|
-
onCancel?(): void;
|
|
7
|
-
cancelText?: string | undefined;
|
|
8
|
-
submitText?: string | undefined;
|
|
9
|
-
previewText?: string | undefined;
|
|
10
|
-
nextText?: string | undefined;
|
|
11
|
-
continueText?: string | undefined;
|
|
12
|
-
validateMessages?: Object | undefined;
|
|
13
|
-
submitting?: boolean | undefined;
|
|
14
|
-
requiredMark?: boolean | undefined;
|
|
15
|
-
showSubmitButton?: boolean | undefined;
|
|
16
|
-
getScrollContainer: () => HTMLElement | Window | null;
|
|
17
|
-
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
|
-
}>;
|
|
19
|
-
export default _default;
|
package/es/free-form/context.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormInstance } from 'antd/es/form';
|
|
3
|
-
import { FormItemName } from '@/types';
|
|
4
|
-
declare const _default: React.Context<{
|
|
5
|
-
form?: FormInstance<any> | undefined;
|
|
6
|
-
onCancel?(): void;
|
|
7
|
-
cancelText?: string | undefined;
|
|
8
|
-
submitText?: string | undefined;
|
|
9
|
-
previewText?: string | undefined;
|
|
10
|
-
nextText?: string | undefined;
|
|
11
|
-
continueText?: string | undefined;
|
|
12
|
-
validateMessages?: Object | undefined;
|
|
13
|
-
submitting?: boolean | undefined;
|
|
14
|
-
requiredMark?: boolean | undefined;
|
|
15
|
-
showSubmitButton?: boolean | undefined;
|
|
16
|
-
getScrollContainer: () => HTMLElement | Window | null;
|
|
17
|
-
registerDependencies: (name: FormItemName | FormItemName[], updater: Function) => void;
|
|
18
|
-
}>;
|
|
19
|
-
export default _default;
|
package/lib/free-form/context.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
var _default = /*#__PURE__*/_react.default.createContext({
|
|
13
|
-
getScrollContainer: function getScrollContainer() {
|
|
14
|
-
return window;
|
|
15
|
-
},
|
|
16
|
-
registerDependencies: function registerDependencies() {}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
exports.default = _default;
|