@unicom-cloud/ui 0.8.52 → 0.8.54
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/Affix.js +41 -40
- package/Alert.js +2 -2
- package/Anchor.js +1 -1
- package/AutoComplete.js +3 -3
- package/Avatar.js +1 -1
- package/BackTop.js +2 -2
- package/Badge.js +2 -2
- package/Breadcrumb.js +2 -2
- package/Button.js +1 -1
- package/Calendar.js +3 -3
- package/Card.js +1 -1
- package/Carousel.js +1 -1
- package/Cascader.js +1 -1
- package/Checkbox.js +1 -1
- package/Collapse.js +1 -1
- package/ColorPicker.js +3 -3
- package/Comment.js +1 -1
- package/ConfigProvider.js +2 -2
- package/Copy.js +1 -1
- package/DatePicker.js +1268 -1233
- package/Descriptions.js +1 -1
- package/Divider.js +1 -1
- package/Draggable.js +1 -1
- package/Drawer.js +1 -1
- package/Dropdown.js +1 -1
- package/Empty.js +1 -1
- package/Form.js +122 -117
- package/Grid.js +86 -83
- package/Icon.js +1 -1
- package/IconHover.js +1 -1
- package/Image.js +1 -1
- package/Input.js +1 -1
- package/InputNumber.js +2 -2
- package/InputTag.js +1 -1
- package/Layout.js +2 -2
- package/Link.js +1 -1
- package/List.js +3 -3
- package/Mentions.js +3 -3
- package/Menu.js +1 -1
- package/Message.js +2 -2
- package/Modal.js +1 -1
- package/Notice.js +2 -2
- package/Notification.js +2 -2
- package/OverflowEllipsis.js +1 -1
- package/PageHeader.js +1 -1
- package/Pagination.js +1 -1
- package/Picker.js +1 -1
- package/Popconfirm.js +1 -1
- package/Popover.js +1 -1
- package/Progress.js +1 -1
- package/Radio.js +2 -2
- package/Rate.js +1 -1
- package/ResizeBox.js +33 -32
- package/Result.js +1 -1
- package/Select.js +1 -1
- package/SelectView.js +142 -141
- package/Skeleton.js +1 -1
- package/Slider.js +2 -2
- package/Space.js +1 -1
- package/Spin.js +1 -1
- package/Statistic.js +1 -1
- package/Steps.js +1 -1
- package/Switch.js +15 -14
- package/Table.js +141 -133
- package/Tabs.js +1 -1
- package/Tag.js +111 -82
- package/TimePicker.js +3 -3
- package/Timeline.js +1 -1
- package/Tooltip.js +1 -1
- package/Transfer.js +3 -3
- package/Tree.js +1 -1
- package/TreeSelect.js +1 -1
- package/Trigger.js +31 -30
- package/Typography.js +25 -25
- package/Upload.js +1 -1
- package/VerificationCode.js +1 -1
- package/Version.js +1 -1
- package/Watermark.js +1 -1
- package/chunk/{DUX5Hw8l.js → BC0PujUD.js} +3 -3
- package/chunk/{Ct7mcZuW.js → BH5fVprw.js} +1 -1
- package/chunk/{I0bfWb5y.js → BUQBof6z.js} +95 -93
- package/chunk/{DWGwYNvC.js → BdJcAQ0Q.js} +2 -2
- package/chunk/{CQvJK4kb.js → BmtF7P8U.js} +12 -12
- package/chunk/{DfvdYCUz.js → BzMYgxgO.js} +1 -1
- package/chunk/{n58kSv9T.js → BzqZZHGK.js} +11 -5
- package/chunk/{5PpvDpEt.js → C3I_L73_.js} +2 -2
- package/chunk/{CkIWpIl6.js → CIc4yo9k.js} +1 -1
- package/chunk/{dhljdm11.js → CK0H_Yi4.js} +64 -63
- package/chunk/{BXZYc88i.js → CTSIr-Pr.js} +3 -3
- package/chunk/{4XXtB4ZV.js → CqcZfQQ4.js} +1 -1
- package/chunk/{Cku5-xbe.js → CzTYWtfa.js} +47 -46
- package/chunk/DG7VgAhL.js +445 -0
- package/chunk/DQ3uFRJD.js +892 -0
- package/chunk/{DG5zSZDd.js → DTgc2wl4.js} +2 -2
- package/chunk/{9AJ-uN8F.js → DZGcv_9A.js} +1 -1
- package/chunk/{CoevJNNj.js → DbtCtriE.js} +1 -1
- package/chunk/{tkU8zIK4.js → DdtfPvgk.js} +1 -1
- package/chunk/{Cw63stMm.js → Dki1RB5p.js} +18 -18
- package/chunk/Niaq_og8.js +970 -0
- package/chunk/{DCe3olyi.js → PuuHmqnW.js} +101 -99
- package/chunk/{BHWpeAbb.js → RL1SNlng.js} +1 -1
- package/chunk/{CfqAfcA3.js → RRWbBHK-.js} +2 -2
- package/chunk/{B9nYZhXo.js → ShWkfsJd.js} +2 -2
- package/chunk/i1A7W8Qt.js +277 -0
- package/chunk/qSJXQ1qu.js +640 -0
- package/chunk/{z7sBNzI4.js → xPzFRQJn.js} +33 -32
- package/index.js +408 -346
- package/package.json +1 -23
- package/style.css +1 -1
- package/types/color-picker/colors.d.ts +1 -1
- package/types/date-picker/Picker.d.ts +4 -3
- package/types/date-picker/PickerRange.d.ts +3 -7
- package/types/date-picker/interface.d.ts +9 -1
- package/types/grid/index.d.ts +2 -1
- package/types/index.d.ts +1 -0
- package/types/modal/config.d.ts +1 -0
- package/types/modal/interface.d.ts +1 -0
- package/types/pagination/interface.d.ts +1 -0
- package/types/picker/InputRange.d.ts +1 -1
- package/types/select/Select.d.ts +1 -1
- package/types/tag/interface.d.ts +7 -3
- package/types/utils/CSSTransition.d.ts +2 -1
- package/types/utils/is.d.ts +4 -17
- package/types/version/index.d.ts +1 -1
- package/utils/CSSTransition.js +1 -1
- package/utils/contextHolder.js +1 -1
- package/utils/is.js +102 -104
- package/utils/reactDOM.js +19 -19
- package/chunk/C61BEbHK.js +0 -263
- package/chunk/DMeJAY1S.js +0 -606
- package/chunk/DXMtLuTP.js +0 -443
- package/chunk/m3_n9fBe.js +0 -961
- package/chunk/uUGMUxt_.js +0 -474
package/Form.js
CHANGED
|
@@ -5,22 +5,22 @@ import { jsx as f, jsxs as J, Fragment as Pe } from "react/jsx-runtime";
|
|
|
5
5
|
import { y as Ke } from "./chunk/CiZVOdJ3.js";
|
|
6
6
|
import P from "lodash/isPlainObject";
|
|
7
7
|
import Me from "lodash/merge";
|
|
8
|
-
import H, { createContext as
|
|
9
|
-
import { a as
|
|
8
|
+
import H, { createContext as ue, useRef as L, forwardRef as Ve, useContext as O, useEffect as ie, useImperativeHandle as et, Component as tt, isValidElement as fe, useState as ce, useMemo as Ee, createElement as we, cloneElement as Te, useCallback as ee } from "react";
|
|
9
|
+
import { a as _e, b as rt } from "./chunk/xPzFRQJn.js";
|
|
10
10
|
import st from "./hooks/useCreate.js";
|
|
11
11
|
import it from "./hooks/useMergeProps.js";
|
|
12
12
|
import G from "@unicom-cloud/utils/class-name";
|
|
13
|
-
import
|
|
13
|
+
import xe from "./utils/omit.js";
|
|
14
14
|
import { NOOP as b } from "./utils/constant.js";
|
|
15
15
|
import $ from "lodash/get";
|
|
16
16
|
import Le from "lodash/has";
|
|
17
17
|
import T from "lodash/isArray";
|
|
18
18
|
import j from "lodash/isFunction";
|
|
19
19
|
import nt from "lodash/omit";
|
|
20
|
-
import
|
|
20
|
+
import De from "lodash/setWith";
|
|
21
21
|
import { isExist as $e } from "./utils/is.js";
|
|
22
22
|
import { Schema as lt } from "@unicom-cloud/utils/validate";
|
|
23
|
-
import
|
|
23
|
+
import Ue from "lodash/cloneDeepWith";
|
|
24
24
|
import Oe from "lodash/set";
|
|
25
25
|
import ot from "@unicom-cloud/icons/IconUiCheckCircleFill";
|
|
26
26
|
import at from "@unicom-cloud/icons/IconUiCloseCircleFill";
|
|
@@ -32,12 +32,12 @@ import ht from "lodash/isNil";
|
|
|
32
32
|
import re from "./utils/warning.js";
|
|
33
33
|
import te from "lodash/isUndefined";
|
|
34
34
|
import je from "./Grid.js";
|
|
35
|
-
import { P as gt } from "./chunk/
|
|
35
|
+
import { P as gt } from "./chunk/DQ3uFRJD.js";
|
|
36
36
|
import mt from "@unicom-cloud/icons/IconUiQuestionCircleFill";
|
|
37
37
|
import Ft from "./Tooltip.js";
|
|
38
38
|
import ft from "./hooks/useForceUpdate.js";
|
|
39
39
|
import pt from "lodash/isString";
|
|
40
|
-
const se =
|
|
40
|
+
const se = ue({
|
|
41
41
|
layout: "horizontal",
|
|
42
42
|
labelCol: { span: 5, offset: 0 },
|
|
43
43
|
labelAlign: "right",
|
|
@@ -71,13 +71,13 @@ const se = ce({
|
|
|
71
71
|
innerGetStoreStatus: b
|
|
72
72
|
})
|
|
73
73
|
}
|
|
74
|
-
}), Se =
|
|
74
|
+
}), Se = ue({}), qe = ue({}), Ge = ue({}), me = {
|
|
75
75
|
error: "error",
|
|
76
76
|
success: "success",
|
|
77
77
|
warning: "warning",
|
|
78
78
|
validating: "validating"
|
|
79
79
|
};
|
|
80
|
-
var
|
|
80
|
+
var U = /* @__PURE__ */ ((s) => (s.init = "init", s.error = "error", s.success = "success", s.submitting = "submitting", s))(U || {});
|
|
81
81
|
class St extends Error {
|
|
82
82
|
constructor(t) {
|
|
83
83
|
super("form validate error, get errors by error.errors");
|
|
@@ -96,16 +96,16 @@ function Vt(s) {
|
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
function K(s) {
|
|
99
|
-
return
|
|
99
|
+
return Ue(s, (e) => {
|
|
100
100
|
if (!P(e) && !T(e))
|
|
101
101
|
return e;
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
-
const bt = (s, e) =>
|
|
104
|
+
const bt = (s, e) => Ue(s, (t) => {
|
|
105
105
|
if (j(t))
|
|
106
106
|
return (r) => t(r, e);
|
|
107
107
|
});
|
|
108
|
-
function
|
|
108
|
+
function W(s, e, t) {
|
|
109
109
|
return Oe(s, e, K(t)), s;
|
|
110
110
|
}
|
|
111
111
|
function ke(s, e = "") {
|
|
@@ -116,7 +116,7 @@ function ze(s) {
|
|
|
116
116
|
var e;
|
|
117
117
|
return ((e = s == null ? void 0 : s.constructor) == null ? void 0 : e.name) === "SyntheticEvent" || (s == null ? void 0 : s.nativeEvent) instanceof Event;
|
|
118
118
|
}
|
|
119
|
-
async function
|
|
119
|
+
async function Ne(s, e, t, r) {
|
|
120
120
|
const i = [...t || []];
|
|
121
121
|
let l = 0;
|
|
122
122
|
return new Promise(async (n) => {
|
|
@@ -143,8 +143,8 @@ async function We(s, e, t, r) {
|
|
|
143
143
|
a(i[l]);
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
const t =
|
|
146
|
+
function ae(s, e) {
|
|
147
|
+
const t = De({}, s, void 0, Object);
|
|
148
148
|
return e.some((r) => Le(t, r));
|
|
149
149
|
}
|
|
150
150
|
const be = "_input";
|
|
@@ -152,7 +152,7 @@ class vt {
|
|
|
152
152
|
constructor() {
|
|
153
153
|
// 表示的 Form 的提交状态而非单个字段的提交状态。
|
|
154
154
|
// 只有在触发表单 reset(原生 reset,而非当前的 resetFields) 时,才会回到 init 状态(目前没有支持 form.reset,所以没有这块逻辑)
|
|
155
|
-
u(this, "submitStatus",
|
|
155
|
+
u(this, "submitStatus", U.init);
|
|
156
156
|
u(this, "registerFields", []);
|
|
157
157
|
// 所有 form item value 的变动,都会通知这里注册到的 watcher
|
|
158
158
|
u(this, "registerWatchers", []);
|
|
@@ -219,11 +219,11 @@ class vt {
|
|
|
219
219
|
});
|
|
220
220
|
u(this, "innerSetInitialValues", (e) => {
|
|
221
221
|
e && (this.initialValues = Me(this.initialValues, K(e)), Object.keys(e).forEach((t) => {
|
|
222
|
-
|
|
222
|
+
W(this.store, t, e[t]);
|
|
223
223
|
}));
|
|
224
224
|
});
|
|
225
225
|
u(this, "innerSetInitialValue", (e, t) => {
|
|
226
|
-
e && (this.initialValues[e] = t, this._inTouchFields(e) ||
|
|
226
|
+
e && (this.initialValues[e] = t, this._inTouchFields(e) || W(this.store, e, $(this.initialValues, e)));
|
|
227
227
|
});
|
|
228
228
|
/**
|
|
229
229
|
*
|
|
@@ -233,7 +233,7 @@ class vt {
|
|
|
233
233
|
u(this, "innerSetFieldValue", (e, t, r) => {
|
|
234
234
|
if (!e) return;
|
|
235
235
|
const i = this.getFields();
|
|
236
|
-
|
|
236
|
+
W(this.store, e, t), this.triggerValuesChange({
|
|
237
237
|
[e]: t
|
|
238
238
|
}), this.triggerTouchChange({ [e]: t }), this.notify("innerSetValue", {
|
|
239
239
|
prev: i,
|
|
@@ -276,7 +276,7 @@ class vt {
|
|
|
276
276
|
const l = e[i], n = this.getFields();
|
|
277
277
|
if (l) {
|
|
278
278
|
const o = {};
|
|
279
|
-
"error" in l && (o.errors = l.error), "warning" in l && (o.warnings = l.warning), "touched" in l && (o.touched = l.touched), "value" in l && (
|
|
279
|
+
"error" in l && (o.errors = l.error), "warning" in l && (o.warnings = l.warning), "touched" in l && (o.touched = l.touched), "value" in l && (W(this.store, i, l.value), r[i] = l.value), this.notify("setFieldValue", {
|
|
280
280
|
data: o,
|
|
281
281
|
prev: n,
|
|
282
282
|
field: i,
|
|
@@ -307,10 +307,10 @@ class vt {
|
|
|
307
307
|
u(this, "getFieldsValue", (e) => {
|
|
308
308
|
const t = {};
|
|
309
309
|
return T(e) ? (e.forEach((r) => {
|
|
310
|
-
|
|
310
|
+
W(t, r, this.getFieldValue(r));
|
|
311
311
|
}), t) : (this.getRegisteredFields(!0).forEach(({ props: { field: r } }) => {
|
|
312
312
|
const i = $(this.store, r);
|
|
313
|
-
|
|
313
|
+
W(t, r, i);
|
|
314
314
|
}), t);
|
|
315
315
|
});
|
|
316
316
|
u(this, "getInitialValues", () => this.initialValues);
|
|
@@ -325,7 +325,7 @@ class vt {
|
|
|
325
325
|
let i = {};
|
|
326
326
|
if (r && T(r))
|
|
327
327
|
r.forEach((n) => {
|
|
328
|
-
|
|
328
|
+
W(
|
|
329
329
|
this.store,
|
|
330
330
|
n,
|
|
331
331
|
this.initialValues[n]
|
|
@@ -334,10 +334,10 @@ class vt {
|
|
|
334
334
|
else {
|
|
335
335
|
const n = {};
|
|
336
336
|
i = this.getFields(), Object.keys(this.initialValues).forEach((o) => {
|
|
337
|
-
|
|
337
|
+
W(n, o, this.initialValues[o]);
|
|
338
338
|
}), this.store = n, this.getRegisteredFields(!0).forEach((o) => {
|
|
339
339
|
const a = o.props.field;
|
|
340
|
-
|
|
340
|
+
W(i, a, $(this.store, a));
|
|
341
341
|
}), this.triggerValuesChange(i), this._popTouchField(), this.notify("reset", {
|
|
342
342
|
prev: t,
|
|
343
343
|
field: Object.keys(i)
|
|
@@ -368,7 +368,7 @@ class vt {
|
|
|
368
368
|
var p;
|
|
369
369
|
V.error && (h = { ...h, ...V.error });
|
|
370
370
|
const m = this.getRegisteredField(V.field);
|
|
371
|
-
(p = m == null ? void 0 : m.props) != null && p.isFormList ||
|
|
371
|
+
(p = m == null ? void 0 : m.props) != null && p.isFormList || W(g, V.field, V.value);
|
|
372
372
|
});
|
|
373
373
|
let F;
|
|
374
374
|
return Object.keys(h).length ? (d == null || d(h), F = o == null ? void 0 : o(h, K(g))) : F = o == null ? void 0 : o(null, K(g)), F;
|
|
@@ -378,11 +378,11 @@ class vt {
|
|
|
378
378
|
u(this, "toggleSubmitStatus", (e) => {
|
|
379
379
|
this.submitStatus = e, this.innerCollectFormState(), this.notifyFormWatcher();
|
|
380
380
|
});
|
|
381
|
-
u(this, "submit", () => (this.toggleSubmitStatus(
|
|
381
|
+
u(this, "submit", () => (this.toggleSubmitStatus(U.submitting), this.validate((e, t) => {
|
|
382
382
|
let r;
|
|
383
383
|
const { onSubmit: i, onSubmitFailed: l } = this.callbacks;
|
|
384
|
-
!e && i && (r = i(t)), e && l && (r = l(e)), r && r.then ? r.then((n) => (this.toggleSubmitStatus(
|
|
385
|
-
e ?
|
|
384
|
+
!e && i && (r = i(t)), e && l && (r = l(e)), r && r.then ? r.then((n) => (this.toggleSubmitStatus(U.success), n)).catch((n) => (this.toggleSubmitStatus(U.error), Promise.reject(n))) : this.toggleSubmitStatus(
|
|
385
|
+
e ? U.error : U.success
|
|
386
386
|
);
|
|
387
387
|
})));
|
|
388
388
|
u(this, "getFieldsState", (e) => {
|
|
@@ -394,7 +394,7 @@ class vt {
|
|
|
394
394
|
errors: l ? [l] : [],
|
|
395
395
|
warnings: i.getWarnings(),
|
|
396
396
|
validateStatus: i.getValidateStatus(),
|
|
397
|
-
isSubmitting: this.submitStatus ===
|
|
397
|
+
isSubmitting: this.submitStatus === U.submitting,
|
|
398
398
|
isTouched: i.isTouched(),
|
|
399
399
|
value: this.getFieldValue(i.props.field)
|
|
400
400
|
};
|
|
@@ -410,7 +410,7 @@ class vt {
|
|
|
410
410
|
if (r && T(r)) {
|
|
411
411
|
const i = {};
|
|
412
412
|
r.forEach((l) => {
|
|
413
|
-
|
|
413
|
+
W(this.store, l, void 0), i[l] = $(this.store, l);
|
|
414
414
|
}), this.triggerValuesChange(i), this.notify("setFieldValue", {
|
|
415
415
|
prev: t,
|
|
416
416
|
field: r,
|
|
@@ -423,7 +423,7 @@ class vt {
|
|
|
423
423
|
const i = {};
|
|
424
424
|
this.store = {}, this.getRegisteredFields(!0).forEach((l) => {
|
|
425
425
|
const n = l.props.field;
|
|
426
|
-
|
|
426
|
+
W(i, n, void 0);
|
|
427
427
|
}), this.triggerValuesChange(i), this.notify("setFieldValue", {
|
|
428
428
|
prev: t,
|
|
429
429
|
field: Object.keys(i),
|
|
@@ -467,7 +467,7 @@ class vt {
|
|
|
467
467
|
_getIterativelyKeysByField(e) {
|
|
468
468
|
if (!e)
|
|
469
469
|
return [];
|
|
470
|
-
const r = [].concat(e).map((i) => ke(
|
|
470
|
+
const r = [].concat(e).map((i) => ke(W({}, i, void 0))).reduce((i, l) => i.concat(l), []);
|
|
471
471
|
return [e, ...r];
|
|
472
472
|
}
|
|
473
473
|
_inTouchFields(e) {
|
|
@@ -480,7 +480,7 @@ class vt {
|
|
|
480
480
|
}
|
|
481
481
|
_pushTouchField(e) {
|
|
482
482
|
[].concat(e).forEach((t) => {
|
|
483
|
-
|
|
483
|
+
De(this.touchedFields, t, void 0, Object);
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
}
|
|
@@ -545,7 +545,7 @@ const Ct = {
|
|
|
545
545
|
validateTrigger: "onChange"
|
|
546
546
|
}, It = (s, e) => {
|
|
547
547
|
var X, B;
|
|
548
|
-
const t = O(
|
|
548
|
+
const t = O(_e), r = O(qe), i = L(null), [l] = Ae(
|
|
549
549
|
s.form
|
|
550
550
|
), n = it(
|
|
551
551
|
s,
|
|
@@ -566,55 +566,55 @@ const Ct = {
|
|
|
566
566
|
prefixCls: y,
|
|
567
567
|
validateMessages: I,
|
|
568
568
|
...k
|
|
569
|
-
} = n,
|
|
569
|
+
} = n, N = y || t.getPrefixCls("form"), Q = t.rtl, ne = "size" in n ? n.size : t.size, le = l.getInnerMethods(!0);
|
|
570
570
|
st(() => {
|
|
571
571
|
le.innerSetInitialValues(n.initialValues);
|
|
572
572
|
}), ie(() => {
|
|
573
573
|
let S;
|
|
574
574
|
return r.register && (S = r.register(n.id, l)), S;
|
|
575
|
-
}, [n.id, l]),
|
|
576
|
-
const w = i.current,
|
|
575
|
+
}, [n.id, l]), l.scrollToField = (S, x) => {
|
|
576
|
+
const w = i.current, R = n.id;
|
|
577
577
|
if (!w)
|
|
578
578
|
return;
|
|
579
579
|
let q = w.querySelector(
|
|
580
|
-
`#${Fe(
|
|
580
|
+
`#${Fe(R, S)}`
|
|
581
581
|
);
|
|
582
582
|
q || (q = w.querySelector(
|
|
583
|
-
`#${Fe(
|
|
583
|
+
`#${Fe(R, S)}${be}`
|
|
584
584
|
)), q && Ke(q, {
|
|
585
585
|
behavior: "smooth",
|
|
586
586
|
block: "nearest",
|
|
587
587
|
scrollMode: "if-needed",
|
|
588
|
-
...
|
|
588
|
+
...x
|
|
589
589
|
});
|
|
590
590
|
}, le.innerSetCallbacks({
|
|
591
|
-
onValuesChange: (S,
|
|
592
|
-
var w,
|
|
593
|
-
(w = n.onValuesChange) == null || w.call(n, S,
|
|
591
|
+
onValuesChange: (S, x) => {
|
|
592
|
+
var w, R;
|
|
593
|
+
(w = n.onValuesChange) == null || w.call(n, S, x), (R = r.onFormValuesChange) == null || R.call(r, n.id, S);
|
|
594
594
|
},
|
|
595
595
|
onChange: n.onChange,
|
|
596
596
|
onValidateFail: (S) => {
|
|
597
597
|
if (n.scrollToFirstError) {
|
|
598
|
-
const
|
|
598
|
+
const x = P(n.scrollToFirstError) ? n.scrollToFirstError : {};
|
|
599
599
|
l.scrollToField(
|
|
600
600
|
Object.keys(S)[0],
|
|
601
|
-
|
|
601
|
+
x
|
|
602
602
|
);
|
|
603
603
|
}
|
|
604
604
|
},
|
|
605
605
|
onSubmitFailed: n.onSubmitFailed,
|
|
606
606
|
onSubmit: (S) => {
|
|
607
|
-
var w,
|
|
608
|
-
const
|
|
609
|
-
return (
|
|
607
|
+
var w, R;
|
|
608
|
+
const x = (w = n.onSubmit) == null ? void 0 : w.call(n, S);
|
|
609
|
+
return (R = r.onFormSubmit) == null || R.call(r, n.id, S), x;
|
|
610
610
|
},
|
|
611
611
|
onReset: (S) => {
|
|
612
|
-
var w,
|
|
613
|
-
const
|
|
614
|
-
return (
|
|
612
|
+
var w, R;
|
|
613
|
+
const x = (w = n.onReset) == null ? void 0 : w.call(n, S);
|
|
614
|
+
return (R = r == null ? void 0 : r.onFormReset) == null || R.call(r, n.id, S), x;
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
|
-
const
|
|
617
|
+
const he = {
|
|
618
618
|
requiredSymbol: g,
|
|
619
619
|
labelAlign: F,
|
|
620
620
|
disabled: V,
|
|
@@ -623,7 +623,7 @@ const Ct = {
|
|
|
623
623
|
wrapperCol: d,
|
|
624
624
|
layout: o,
|
|
625
625
|
store: l,
|
|
626
|
-
prefixCls:
|
|
626
|
+
prefixCls: N,
|
|
627
627
|
validateTrigger: v,
|
|
628
628
|
validateMessages: Me(
|
|
629
629
|
{},
|
|
@@ -631,12 +631,17 @@ const Ct = {
|
|
|
631
631
|
I
|
|
632
632
|
),
|
|
633
633
|
getFormElementId: (S) => Fe(h, S)
|
|
634
|
-
};
|
|
635
|
-
return
|
|
634
|
+
}, oe = se;
|
|
635
|
+
return et(e, () => ({
|
|
636
|
+
...l,
|
|
637
|
+
getRootDOMNode() {
|
|
638
|
+
return i.current;
|
|
639
|
+
}
|
|
640
|
+
})), /* @__PURE__ */ f(rt, { ...t, size: ne, children: /* @__PURE__ */ f(oe.Provider, { value: he, children: /* @__PURE__ */ f(
|
|
636
641
|
c,
|
|
637
642
|
{
|
|
638
643
|
ref: i,
|
|
639
|
-
...
|
|
644
|
+
...xe(k, [
|
|
640
645
|
"form",
|
|
641
646
|
"size",
|
|
642
647
|
"initialValues",
|
|
@@ -650,10 +655,10 @@ const Ct = {
|
|
|
650
655
|
]),
|
|
651
656
|
...n.wrapperProps,
|
|
652
657
|
className: G(
|
|
653
|
-
|
|
654
|
-
`${
|
|
655
|
-
`${
|
|
656
|
-
{ [`${
|
|
658
|
+
N,
|
|
659
|
+
`${N}-${o}`,
|
|
660
|
+
`${N}-size-${ne}`,
|
|
661
|
+
{ [`${N}-rtl`]: Q },
|
|
657
662
|
p
|
|
658
663
|
),
|
|
659
664
|
style: n.style,
|
|
@@ -732,7 +737,7 @@ class z extends tt {
|
|
|
732
737
|
const i = T(r.field) ? r.field : [r.field], { field: l, shouldUpdate: n, dependencies: o } = this.props, a = (d) => {
|
|
733
738
|
if (o && n && re(!0, "`shouldUpdate` of the `Form.Item` will be ignored."), o)
|
|
734
739
|
(T(o) || o.some(
|
|
735
|
-
(c) =>
|
|
740
|
+
(c) => ae(c, i)
|
|
736
741
|
)) && this.isTouched() && this.validateField();
|
|
737
742
|
else if (n) {
|
|
738
743
|
let c = !1;
|
|
@@ -747,7 +752,7 @@ class z extends tt {
|
|
|
747
752
|
this.toggleTouched(!1), this.toggleValidateStatus(void 0), this.setErrors(null), this.setWarnings(null), o || n ? a() : this.updateFormItem();
|
|
748
753
|
break;
|
|
749
754
|
case "innerSetValue":
|
|
750
|
-
if (
|
|
755
|
+
if (ae(l, i)) {
|
|
751
756
|
this.toggleTouched(!0), this.updateFormItem();
|
|
752
757
|
return;
|
|
753
758
|
}
|
|
@@ -757,7 +762,7 @@ class z extends tt {
|
|
|
757
762
|
});
|
|
758
763
|
break;
|
|
759
764
|
case "setFieldValue":
|
|
760
|
-
if (
|
|
765
|
+
if (ae(l, i)) {
|
|
761
766
|
this.toggleTouched(!0), r.data && "touched" in r.data && this.toggleTouched(r.data.touched), r.data && "warnings" in r.data && this.setWarnings(
|
|
762
767
|
ht(r.data.warnings) ? [] : [].concat(r.data.warnings)
|
|
763
768
|
), r.data && "errors" in r.data ? this.setErrors(r.data.errors) : pe($(r.prev, l), $(r.current, l)) || this.setErrors(null), this.updateFormItem();
|
|
@@ -780,7 +785,7 @@ class z extends tt {
|
|
|
780
785
|
// 仅仅校验下值,不做任何状态变更
|
|
781
786
|
u(this, "validateFieldOnly", () => {
|
|
782
787
|
const { validateMessages: t } = this.context, { field: r, rules: i } = this.props, l = this.getFieldValue();
|
|
783
|
-
return
|
|
788
|
+
return Ne(r, l, i, t).then(
|
|
784
789
|
({ error: n, warning: o }) => Promise.resolve({ error: n, value: l, warning: o, field: r })
|
|
785
790
|
);
|
|
786
791
|
});
|
|
@@ -797,7 +802,7 @@ class z extends tt {
|
|
|
797
802
|
}, c = t ? (n || []).filter((h) => [].concat(
|
|
798
803
|
h.validateTrigger || o || r
|
|
799
804
|
).indexOf(t) > -1) : n;
|
|
800
|
-
return c && c.length && l ? (d(),
|
|
805
|
+
return c && c.length && l ? (d(), Ne(l, a, c, i).then(
|
|
801
806
|
({ error: h, warning: g }) => {
|
|
802
807
|
var F;
|
|
803
808
|
return this.setErrors(h ? h[l] : null), this.setWarnings(g || null), this.toggleValidateStatus(
|
|
@@ -967,7 +972,7 @@ const wt = ({
|
|
|
967
972
|
] }),
|
|
968
973
|
e ? e === !0 ? ":" : e : ""
|
|
969
974
|
] }) : null;
|
|
970
|
-
}, Tt = je.Row,
|
|
975
|
+
}, Tt = je.Row, Re = je.Col, $t = ({
|
|
971
976
|
prefixCls: s,
|
|
972
977
|
help: e,
|
|
973
978
|
errors: t,
|
|
@@ -1007,13 +1012,13 @@ const wt = ({
|
|
|
1007
1012
|
);
|
|
1008
1013
|
}, kt = (s, e) => {
|
|
1009
1014
|
var ve, ye, Ce;
|
|
1010
|
-
const { getPrefixCls: t, prefixCls: r } = O(
|
|
1015
|
+
const { getPrefixCls: t, prefixCls: r } = O(_e), i = O(Se), l = O(Ge), [n, o] = ce(null), [a, d] = ce(null), c = O(se), h = c.prefixCls || t("form"), g = s.layout || c.layout, F = s.labelAlign || c.labelAlign, V = L(!1), m = (M, C = {}) => {
|
|
1011
1016
|
if (V.current)
|
|
1012
1017
|
return;
|
|
1013
|
-
const { errors:
|
|
1018
|
+
const { errors: D, warnings: Z } = C || {};
|
|
1014
1019
|
o((Y) => {
|
|
1015
1020
|
const E = { ...Y || {} };
|
|
1016
|
-
return
|
|
1021
|
+
return D ? E[M] = D : delete E[M], E;
|
|
1017
1022
|
}), d((Y) => {
|
|
1018
1023
|
const E = { ...Y || {} };
|
|
1019
1024
|
return Z && Z.length ? E[M] = Z : delete E[M], E;
|
|
@@ -1030,16 +1035,16 @@ const wt = ({
|
|
|
1030
1035
|
prefixCls: h,
|
|
1031
1036
|
updateFormItem: p,
|
|
1032
1037
|
disabled: "disabled" in s ? s.disabled : c.disabled
|
|
1033
|
-
}, { label: y, extra: I, className: k, style:
|
|
1038
|
+
}, { label: y, extra: I, className: k, style: N, validateStatus: Q, hidden: ne, ...le } = s, he = G(`${h}-label-item`, {
|
|
1034
1039
|
[`${h}-label-item-left`]: F === "left"
|
|
1035
|
-
}),
|
|
1040
|
+
}), oe = n ? Object.values(n) : [], X = a ? Object.values(a).reduce((M, C) => M.concat(C), []) : [], B = Ee(() => {
|
|
1036
1041
|
if (Q)
|
|
1037
1042
|
return Q;
|
|
1038
|
-
if (
|
|
1043
|
+
if (oe.length)
|
|
1039
1044
|
return me.error;
|
|
1040
1045
|
if (X.length)
|
|
1041
1046
|
return me.warning;
|
|
1042
|
-
}, [n, a, Q]), S = Ee(() => !te(s.help) || X.length > 0, [s.help, a]),
|
|
1047
|
+
}, [n, a, Q]), S = Ee(() => !te(s.help) || X.length > 0, [s.help, a]), x = G(
|
|
1043
1048
|
`${h}-item`,
|
|
1044
1049
|
{
|
|
1045
1050
|
[`${h}-item-error`]: S || !Q && B === me.error,
|
|
@@ -1052,14 +1057,14 @@ const wt = ({
|
|
|
1052
1057
|
k
|
|
1053
1058
|
), w = () => {
|
|
1054
1059
|
var Z, Y;
|
|
1055
|
-
const { field: M, children: C } = s,
|
|
1060
|
+
const { field: M, children: C } = s, D = "disabled" in s ? s.disabled : c.disabled;
|
|
1056
1061
|
if (j(C)) {
|
|
1057
|
-
let { key: E, ...
|
|
1062
|
+
let { key: E, ..._ } = s ?? {};
|
|
1058
1063
|
return /* @__PURE__ */ we(
|
|
1059
1064
|
z,
|
|
1060
1065
|
{
|
|
1061
|
-
disabled:
|
|
1062
|
-
...
|
|
1066
|
+
disabled: D,
|
|
1067
|
+
..._,
|
|
1063
1068
|
key: M || E,
|
|
1064
1069
|
_key: M || E
|
|
1065
1070
|
},
|
|
@@ -1069,33 +1074,33 @@ const wt = ({
|
|
|
1069
1074
|
);
|
|
1070
1075
|
}
|
|
1071
1076
|
if (T(C)) {
|
|
1072
|
-
const E = H.Children.map(C, (
|
|
1073
|
-
const Ie = P(
|
|
1074
|
-
return P(
|
|
1077
|
+
const E = H.Children.map(C, (_, ge) => {
|
|
1078
|
+
const Ie = P(_) && _.key || ge, Qe = P(_) && "disabled" in _.props, Xe = !te(D) && !Qe ? { key: Ie, disabled: D } : { key: Ie };
|
|
1079
|
+
return P(_) ? Te(_, Xe) : _;
|
|
1075
1080
|
});
|
|
1076
1081
|
return /* @__PURE__ */ f(z, { ...s, field: void 0, children: E });
|
|
1077
1082
|
}
|
|
1078
1083
|
if (H.Children.count(C) == 1) {
|
|
1079
1084
|
if (M) {
|
|
1080
1085
|
const E = ((Z = l == null ? void 0 : l.getItemKey) == null ? void 0 : Z.call(l, M)) || M;
|
|
1081
|
-
return /* @__PURE__ */ we(z, { disabled:
|
|
1086
|
+
return /* @__PURE__ */ we(z, { disabled: D, ...s, key: E, _key: E }, C);
|
|
1082
1087
|
}
|
|
1083
1088
|
if (P(C)) {
|
|
1084
1089
|
if ((Y = C.type) != null && Y.isFormControl)
|
|
1085
1090
|
return C;
|
|
1086
|
-
const
|
|
1087
|
-
return /* @__PURE__ */ f(z, { ...s, field: void 0, children:
|
|
1091
|
+
const _ = !("disabled" in C.props) && !te(D) ? { disabled: D } : null;
|
|
1092
|
+
return /* @__PURE__ */ f(z, { ...s, field: void 0, children: _ ? Te(C, _) : C });
|
|
1088
1093
|
}
|
|
1089
1094
|
}
|
|
1090
1095
|
return C;
|
|
1091
|
-
},
|
|
1096
|
+
}, R = Se, q = {
|
|
1092
1097
|
...c
|
|
1093
1098
|
};
|
|
1094
|
-
return s.noStyle || (q.wrapperCol = void 0, q.labelCol = void 0), /* @__PURE__ */ f(se.Provider, { value: q, children: /* @__PURE__ */ f(
|
|
1099
|
+
return s.noStyle || (q.wrapperCol = void 0, q.labelCol = void 0), /* @__PURE__ */ f(se.Provider, { value: q, children: /* @__PURE__ */ f(R.Provider, { value: v, children: s.noStyle ? w() : /* @__PURE__ */ J(
|
|
1095
1100
|
Tt,
|
|
1096
1101
|
{
|
|
1097
1102
|
ref: e,
|
|
1098
|
-
...
|
|
1103
|
+
...xe(le, [
|
|
1099
1104
|
"tooltip",
|
|
1100
1105
|
"children",
|
|
1101
1106
|
"prefixCls",
|
|
@@ -1125,16 +1130,16 @@ const wt = ({
|
|
|
1125
1130
|
"requiredSymbol",
|
|
1126
1131
|
"isFormList"
|
|
1127
1132
|
]),
|
|
1128
|
-
className:
|
|
1133
|
+
className: x,
|
|
1129
1134
|
div: g !== "horizontal",
|
|
1130
|
-
style:
|
|
1135
|
+
style: N,
|
|
1131
1136
|
children: [
|
|
1132
1137
|
y ? /* @__PURE__ */ f(
|
|
1133
|
-
|
|
1138
|
+
Re,
|
|
1134
1139
|
{
|
|
1135
1140
|
...s.labelCol || c.labelCol,
|
|
1136
1141
|
className: G(
|
|
1137
|
-
|
|
1142
|
+
he,
|
|
1138
1143
|
(ve = s.labelCol) == null ? void 0 : ve.className,
|
|
1139
1144
|
(ye = c.labelCol) == null ? void 0 : ye.className,
|
|
1140
1145
|
{
|
|
@@ -1157,7 +1162,7 @@ const wt = ({
|
|
|
1157
1162
|
}
|
|
1158
1163
|
) : null,
|
|
1159
1164
|
/* @__PURE__ */ J(
|
|
1160
|
-
|
|
1165
|
+
Re,
|
|
1161
1166
|
{
|
|
1162
1167
|
className: G(`${h}-item-wrapper`, {
|
|
1163
1168
|
[`${h}-item-wrapper-flex`]: !s.wrapperCol && !c.wrapperCol
|
|
@@ -1170,7 +1175,7 @@ const wt = ({
|
|
|
1170
1175
|
{
|
|
1171
1176
|
prefixCls: h,
|
|
1172
1177
|
help: s.help,
|
|
1173
|
-
errors:
|
|
1178
|
+
errors: oe,
|
|
1174
1179
|
warnings: X
|
|
1175
1180
|
}
|
|
1176
1181
|
),
|
|
@@ -1181,13 +1186,13 @@ const wt = ({
|
|
|
1181
1186
|
]
|
|
1182
1187
|
}
|
|
1183
1188
|
) }) });
|
|
1184
|
-
},
|
|
1185
|
-
|
|
1189
|
+
}, de = Ve(kt);
|
|
1190
|
+
de.defaultProps = {
|
|
1186
1191
|
trigger: "onChange",
|
|
1187
1192
|
triggerPropName: "value"
|
|
1188
1193
|
};
|
|
1189
|
-
|
|
1190
|
-
const
|
|
1194
|
+
de.displayName = "FormItem";
|
|
1195
|
+
const We = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
|
|
1191
1196
|
const { field: e, children: t, initialValue: r } = s, i = L({
|
|
1192
1197
|
id: 0,
|
|
1193
1198
|
keys: []
|
|
@@ -1202,7 +1207,7 @@ const Re = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
|
|
|
1202
1207
|
}
|
|
1203
1208
|
},
|
|
1204
1209
|
children: /* @__PURE__ */ f(
|
|
1205
|
-
|
|
1210
|
+
de,
|
|
1206
1211
|
{
|
|
1207
1212
|
field: e,
|
|
1208
1213
|
...l,
|
|
@@ -1212,11 +1217,11 @@ const Re = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
|
|
|
1212
1217
|
noStyle: "noStyle" in s ? s.noStyle : !s.rules,
|
|
1213
1218
|
shouldUpdate: (o, a, d) => {
|
|
1214
1219
|
var c, h;
|
|
1215
|
-
return !!(d && !d.isInner &&
|
|
1220
|
+
return !!(d && !d.isInner && ae(d.field, [e]) && ((c = $(o, e)) == null ? void 0 : c.length) !== ((h = $(a, e)) == null ? void 0 : h.length));
|
|
1216
1221
|
},
|
|
1217
1222
|
children: (o, a, { value: d, onChange: c }) => {
|
|
1218
1223
|
const h = d || [], g = function(m, p) {
|
|
1219
|
-
var
|
|
1224
|
+
var N;
|
|
1220
1225
|
if (ze(m)) {
|
|
1221
1226
|
re(
|
|
1222
1227
|
!0,
|
|
@@ -1224,7 +1229,7 @@ const Re = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
|
|
|
1224
1229
|
);
|
|
1225
1230
|
return;
|
|
1226
1231
|
}
|
|
1227
|
-
const v = ((
|
|
1232
|
+
const v = ((N = a.getInnerMethods(!0)) == null ? void 0 : N.innerGetFieldValue(e)) || [], y = i.current.id;
|
|
1228
1233
|
i.current.id += 1;
|
|
1229
1234
|
const I = v || [];
|
|
1230
1235
|
let k = I;
|
|
@@ -1241,9 +1246,9 @@ const Re = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
|
|
|
1241
1246
|
const v = (((y = a.getInnerMethods(!0)) == null ? void 0 : y.innerGetFieldValue(e)) || []).filter((I, k) => k !== m);
|
|
1242
1247
|
n.splice(m, 1), c([...v], { isFormList: !0 });
|
|
1243
1248
|
}, V = function(m, p) {
|
|
1244
|
-
var
|
|
1245
|
-
const v = ((
|
|
1246
|
-
if (m === p || !
|
|
1249
|
+
var N;
|
|
1250
|
+
const v = ((N = a.getInnerMethods(!0)) == null ? void 0 : N.innerGetFieldValue(e)) || [];
|
|
1251
|
+
if (m === p || !We(m, v) || !We(p, v))
|
|
1247
1252
|
return;
|
|
1248
1253
|
const y = n[m];
|
|
1249
1254
|
n.splice(m, 1), n.splice(p, 0, y);
|
|
@@ -1271,7 +1276,7 @@ const Re = (s, e) => !te(s) && s >= 0 && s < e.length, He = (s) => {
|
|
|
1271
1276
|
);
|
|
1272
1277
|
};
|
|
1273
1278
|
He.displayName = "FormList";
|
|
1274
|
-
const
|
|
1279
|
+
const Nt = (s, e) => {
|
|
1275
1280
|
const t = L({}), r = ee((o, a) => (o && (t.current[o] = a), () => {
|
|
1276
1281
|
delete t.current[o];
|
|
1277
1282
|
}), []), i = ee(
|
|
@@ -1311,12 +1316,12 @@ const Wt = (s, e) => {
|
|
|
1311
1316
|
children: s.children
|
|
1312
1317
|
}
|
|
1313
1318
|
);
|
|
1314
|
-
}, Je = Ve(
|
|
1319
|
+
}, Je = Ve(Nt);
|
|
1315
1320
|
Je.displayName = "FormProvider";
|
|
1316
|
-
const
|
|
1321
|
+
const Rt = () => {
|
|
1317
1322
|
const s = O(se), e = s.store, t = L(!1), r = ft(), i = ee(() => {
|
|
1318
1323
|
var o, a, d;
|
|
1319
|
-
const { submitStatus: l } = ((d = (a = (o = e == null ? void 0 : e.getInnerMethods) == null ? void 0 : o.call(e, !0)) == null ? void 0 : a.innerGetStoreStatus) == null ? void 0 : d.call(a)) ?? {}, n = l ===
|
|
1324
|
+
const { submitStatus: l } = ((d = (a = (o = e == null ? void 0 : e.getInnerMethods) == null ? void 0 : o.call(e, !0)) == null ? void 0 : a.innerGetStoreStatus) == null ? void 0 : d.call(a)) ?? {}, n = l === U.submitting;
|
|
1320
1325
|
n !== t.current && (t.current = n, r());
|
|
1321
1326
|
}, []);
|
|
1322
1327
|
return ie(() => {
|
|
@@ -1336,13 +1341,13 @@ const Nt = () => {
|
|
|
1336
1341
|
disabled: s.disabled,
|
|
1337
1342
|
isSubmitting: t.current
|
|
1338
1343
|
};
|
|
1339
|
-
},
|
|
1344
|
+
}, Wt = (s, e) => {
|
|
1340
1345
|
const t = O(se), r = e || t.store, i = L(s);
|
|
1341
1346
|
i.current = s;
|
|
1342
1347
|
const l = ee(() => {
|
|
1343
1348
|
const d = i.current, c = r.getFieldsState([d]);
|
|
1344
1349
|
return c == null ? void 0 : c[d];
|
|
1345
|
-
}, []), [n, o] =
|
|
1350
|
+
}, []), [n, o] = ce(l), a = L(n);
|
|
1346
1351
|
return ie(() => {
|
|
1347
1352
|
var g;
|
|
1348
1353
|
if (!r) {
|
|
@@ -1360,7 +1365,7 @@ const Nt = () => {
|
|
|
1360
1365
|
};
|
|
1361
1366
|
}, []), n;
|
|
1362
1367
|
}, Pt = (s, e) => {
|
|
1363
|
-
const t = O(se), r = e || t.store, [i, l] =
|
|
1368
|
+
const t = O(se), r = e || t.store, [i, l] = ce(() => {
|
|
1364
1369
|
const a = r == null ? void 0 : r.getFieldsValue([].concat(s));
|
|
1365
1370
|
return pt(s) ? $(a, s) : a;
|
|
1366
1371
|
}), n = L(s);
|
|
@@ -1387,21 +1392,21 @@ const Nt = () => {
|
|
|
1387
1392
|
}, []), i;
|
|
1388
1393
|
}, A = Be;
|
|
1389
1394
|
A.Provider = Je;
|
|
1390
|
-
A.Item =
|
|
1395
|
+
A.Item = de;
|
|
1391
1396
|
A.List = He;
|
|
1392
1397
|
A.Control = z;
|
|
1393
1398
|
A.useForm = Ae;
|
|
1394
|
-
A.useFormContext =
|
|
1399
|
+
A.useFormContext = Rt;
|
|
1395
1400
|
A.useWatch = Pt;
|
|
1396
|
-
A.useFormState =
|
|
1401
|
+
A.useFormState = Wt;
|
|
1397
1402
|
export {
|
|
1398
1403
|
z as FormControl,
|
|
1399
|
-
|
|
1404
|
+
de as FormItem,
|
|
1400
1405
|
He as FormList,
|
|
1401
1406
|
Je as FormProvider,
|
|
1402
1407
|
A as default,
|
|
1403
1408
|
Ae as useForm,
|
|
1404
|
-
|
|
1405
|
-
|
|
1409
|
+
Rt as useFormContext,
|
|
1410
|
+
Wt as useFormState,
|
|
1406
1411
|
Pt as useWatch
|
|
1407
1412
|
};
|