@para-ui/core 5.0.1 → 5.0.3-beta.8
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/FieldForm/component.json +22 -1
- package/FormItemGroup/component.json +72 -0
- package/Menu/component.json +9 -2
- package/es/Checkbox/index.js +26 -24
- package/es/CheckboxGroup/index.css +1 -1
- package/es/CheckboxGroup/style/index.css +1 -1
- package/es/ExpressionInput/Popup.js +11 -4
- package/es/ExpressionInput/useExpressionInput.js +40 -37
- package/es/FieldForm/ErrorList.js +9 -8
- package/es/FieldForm/FieldFormItem/ItemHolder.d.ts +2 -0
- package/es/FieldForm/FieldFormItem/ItemHolder.js +78 -68
- package/es/FieldForm/FieldFormItem/index.d.ts +3 -0
- package/es/FieldForm/FieldFormItem/index.js +131 -120
- package/es/FieldForm/Form.d.ts +3 -1
- package/es/FieldForm/Form.js +54 -50
- package/es/FieldForm/compactControlMarker.d.ts +18 -0
- package/es/FieldForm/compactControlMarker.js +5 -0
- package/es/FieldForm/component.json +22 -1
- package/es/FieldForm/context.d.ts +3 -1
- package/es/FieldForm/context.js +6 -5
- package/es/FieldForm/index.css +1 -1
- package/es/FieldForm/index.d.ts +2 -0
- package/es/FieldForm/index.js +13 -9
- package/es/FieldForm/interface.d.ts +9 -0
- package/es/FieldForm/style/index.css +1 -1
- package/es/FieldForm/util.d.ts +14 -0
- package/es/FieldForm/util.js +41 -17
- package/es/FormItemGroup/component.json +72 -0
- package/es/FormItemGroup/index.css +1 -0
- package/es/FormItemGroup/index.d.ts +14 -0
- package/es/FormItemGroup/index.js +27 -0
- package/es/FormItemGroup/style/css.js +1 -0
- package/es/FormItemGroup/style/index.css +1 -0
- package/es/FormItemGroup/style/index.js +1 -0
- package/es/HelperText/index.js +15 -13
- package/es/Menu/component.json +9 -2
- package/es/Menu/index.css +1 -1
- package/es/Menu/interface.d.ts +2 -0
- package/es/Menu/style/index.css +1 -1
- package/es/Menu/verticalMenuList.js +378 -361
- package/es/RadioGroup/index.css +1 -1
- package/es/RadioGroup/style/index.css +1 -1
- package/es/RangeInput/index.js +60 -60
- package/es/Switch/index.js +30 -28
- package/es/Tag/TagGroup.js +29 -32
- package/es/Tag/index.js +5 -5
- package/es/index.d.ts +2 -0
- package/es/index.js +175 -169
- package/lib/Checkbox/index.js +1 -1
- package/lib/CheckboxGroup/index.css +1 -1
- package/lib/CheckboxGroup/style/index.css +1 -1
- package/lib/ExpressionInput/Popup.js +1 -1
- package/lib/ExpressionInput/useExpressionInput.js +1 -1
- package/lib/FieldForm/ErrorList.js +1 -1
- package/lib/FieldForm/FieldFormItem/ItemHolder.d.ts +2 -0
- package/lib/FieldForm/FieldFormItem/ItemHolder.js +1 -1
- package/lib/FieldForm/FieldFormItem/index.d.ts +3 -0
- package/lib/FieldForm/FieldFormItem/index.js +1 -1
- package/lib/FieldForm/Form.d.ts +3 -1
- package/lib/FieldForm/Form.js +1 -1
- package/lib/FieldForm/compactControlMarker.d.ts +18 -0
- package/lib/FieldForm/compactControlMarker.js +2 -0
- package/lib/FieldForm/component.json +22 -1
- package/lib/FieldForm/context.d.ts +3 -1
- package/lib/FieldForm/context.js +1 -1
- package/lib/FieldForm/index.css +1 -1
- package/lib/FieldForm/index.d.ts +2 -0
- package/lib/FieldForm/index.js +1 -1
- package/lib/FieldForm/interface.d.ts +9 -0
- package/lib/FieldForm/style/index.css +1 -1
- package/lib/FieldForm/util.d.ts +14 -0
- package/lib/FieldForm/util.js +1 -1
- package/lib/FormItemGroup/component.json +72 -0
- package/lib/FormItemGroup/index.css +1 -0
- package/lib/FormItemGroup/index.d.ts +14 -0
- package/lib/FormItemGroup/index.js +2 -0
- package/lib/FormItemGroup/style/css.js +1 -0
- package/lib/FormItemGroup/style/index.css +1 -0
- package/lib/FormItemGroup/style/index.js +1 -0
- package/lib/HelperText/index.js +1 -1
- package/lib/Menu/component.json +9 -2
- package/lib/Menu/index.css +1 -1
- package/lib/Menu/interface.d.ts +2 -0
- package/lib/Menu/style/index.css +1 -1
- package/lib/Menu/verticalMenuList.js +1 -1
- package/lib/RadioGroup/index.css +1 -1
- package/lib/RadioGroup/style/index.css +1 -1
- package/lib/RangeInput/index.js +1 -1
- package/lib/Switch/index.js +1 -1
- package/lib/Tag/TagGroup.js +1 -1
- package/lib/Tag/index.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/package.json +14 -1
|
@@ -1,95 +1,105 @@
|
|
|
1
1
|
import { j as t } from "../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { useContext as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { FormContext as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
2
|
+
import { useContext as q, useMemo as I, useRef as A, useState as D } from "react";
|
|
3
|
+
import O from "../../_virtual/index.js";
|
|
4
|
+
import T from "rc-util/lib/Dom/isVisible";
|
|
5
|
+
import k from "rc-util/lib/hooks/useLayoutEffect";
|
|
6
|
+
import { FormContext as z, NoStyleItemContext as G } from "../context.js";
|
|
7
|
+
import J from "../FormItemLabel.js";
|
|
8
|
+
import K from "../FormItemInput.js";
|
|
9
|
+
import Q from "./StatusProvider.js";
|
|
10
|
+
function ne(l) {
|
|
11
11
|
const {
|
|
12
|
-
className:
|
|
13
|
-
style:
|
|
14
|
-
helperText:
|
|
12
|
+
className: S,
|
|
13
|
+
style: C,
|
|
14
|
+
helperText: i,
|
|
15
15
|
errors: m,
|
|
16
|
-
warnings:
|
|
16
|
+
warnings: c,
|
|
17
17
|
status: e,
|
|
18
|
-
hidden:
|
|
19
|
-
children:
|
|
18
|
+
hidden: j,
|
|
19
|
+
children: v,
|
|
20
20
|
fieldId: r,
|
|
21
|
-
required:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
21
|
+
required: E,
|
|
22
|
+
identityMeta: u,
|
|
23
|
+
onSubItemMetaChange: L,
|
|
24
|
+
layout: d,
|
|
25
|
+
hideLabel: $,
|
|
26
|
+
hideError: M,
|
|
27
|
+
noSpacing: N,
|
|
28
|
+
spacing: p,
|
|
29
|
+
label: P,
|
|
30
|
+
labelProps: w,
|
|
31
|
+
labelAlign: B,
|
|
32
|
+
colon: F,
|
|
33
|
+
labelWidth: H,
|
|
34
|
+
labelWrap: R
|
|
35
|
+
} = l, { prefixCls: s, layout: f, spacing: g, itemDecorator: h } = q(z), n = I(() => d ?? f, [d, f]), x = I(() => p ?? g, [p, g]), o = A(null), b = !!(i != null || m.length || c.length), V = !!o.current && T(o.current), [W, y] = D(null);
|
|
36
|
+
k(() => {
|
|
37
|
+
if (b && o.current) {
|
|
38
|
+
const a = getComputedStyle(o.current);
|
|
39
|
+
y(parseInt(a.marginBottom, 10));
|
|
38
40
|
}
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
41
|
-
|
|
41
|
+
}, [b, V]);
|
|
42
|
+
const _ = (a) => {
|
|
43
|
+
a || y(null);
|
|
42
44
|
};
|
|
43
45
|
return /* @__PURE__ */ t.jsx(
|
|
44
|
-
|
|
46
|
+
Q,
|
|
45
47
|
{
|
|
46
|
-
...
|
|
47
|
-
prefixCls:
|
|
48
|
+
...l,
|
|
49
|
+
prefixCls: s,
|
|
48
50
|
children: /* @__PURE__ */ t.jsxs(
|
|
49
51
|
"div",
|
|
50
52
|
{
|
|
51
|
-
className:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
className: O(
|
|
54
|
+
S,
|
|
55
|
+
`${s}-item`,
|
|
56
|
+
{
|
|
57
|
+
[`${s}-item__${r}`]: r,
|
|
58
|
+
// 状态
|
|
59
|
+
"is-success": e === "success",
|
|
60
|
+
"is-warning": e === "warning",
|
|
61
|
+
"is-error": e === "error",
|
|
62
|
+
"is-validating": e === "validating",
|
|
63
|
+
"is-hidden": j,
|
|
64
|
+
// 布局
|
|
65
|
+
[`is-${n}`]: n,
|
|
66
|
+
// 间距密度
|
|
67
|
+
[`is-spacing-${x}`]: x
|
|
68
|
+
},
|
|
69
|
+
h?.getItemClassName?.(u)
|
|
70
|
+
),
|
|
71
|
+
style: C,
|
|
63
72
|
children: [
|
|
64
73
|
/* @__PURE__ */ t.jsx(
|
|
65
|
-
|
|
74
|
+
J,
|
|
66
75
|
{
|
|
67
76
|
fieldId: r,
|
|
68
|
-
label:
|
|
69
|
-
labelWidth:
|
|
70
|
-
labelWrap:
|
|
71
|
-
labelAlign:
|
|
72
|
-
colon:
|
|
73
|
-
labelProps: { required:
|
|
74
|
-
hideLabel:
|
|
77
|
+
label: P,
|
|
78
|
+
labelWidth: H,
|
|
79
|
+
labelWrap: R,
|
|
80
|
+
labelAlign: B,
|
|
81
|
+
colon: F,
|
|
82
|
+
labelProps: { required: E, ...w },
|
|
83
|
+
hideLabel: $,
|
|
75
84
|
layout: n
|
|
76
85
|
}
|
|
77
86
|
),
|
|
78
87
|
/* @__PURE__ */ t.jsx(
|
|
79
|
-
|
|
88
|
+
K,
|
|
80
89
|
{
|
|
81
90
|
fieldId: r,
|
|
82
91
|
errors: m,
|
|
83
|
-
warnings:
|
|
92
|
+
warnings: c,
|
|
84
93
|
status: e,
|
|
85
|
-
helperText:
|
|
86
|
-
marginBottom:
|
|
87
|
-
onErrorVisibleChanged:
|
|
88
|
-
hideError:
|
|
89
|
-
noSpacing:
|
|
90
|
-
children: /* @__PURE__ */ t.jsx(
|
|
94
|
+
helperText: i,
|
|
95
|
+
marginBottom: W,
|
|
96
|
+
onErrorVisibleChanged: _,
|
|
97
|
+
hideError: M,
|
|
98
|
+
noSpacing: N,
|
|
99
|
+
children: /* @__PURE__ */ t.jsx(G.Provider, { value: L, children: v })
|
|
91
100
|
}
|
|
92
|
-
)
|
|
101
|
+
),
|
|
102
|
+
h?.renderItemExtra?.(u)
|
|
93
103
|
]
|
|
94
104
|
}
|
|
95
105
|
)
|
|
@@ -97,6 +107,6 @@ function te(a) {
|
|
|
97
107
|
);
|
|
98
108
|
}
|
|
99
109
|
export {
|
|
100
|
-
|
|
110
|
+
ne as default
|
|
101
111
|
};
|
|
102
112
|
//# sourceMappingURL=ItemHolder.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode, ReactElement, CSSProperties } from 'react';
|
|
2
2
|
import { FieldProps } from 'rc-field-form/lib/Field';
|
|
3
3
|
import { Meta } from 'rc-field-form/lib/interface';
|
|
4
|
+
import { ItemDecoratorMeta } from '../interface';
|
|
4
5
|
import { FormInstance, FormItemLayout } from '../Form';
|
|
5
6
|
import { FormItemInputProps } from '../FormItemInput';
|
|
6
7
|
import { FormItemLabelProps } from '../FormItemLabel';
|
|
@@ -35,6 +36,7 @@ export interface FormItemProps<Values = unknown> extends FormItemLabelProps, For
|
|
|
35
36
|
disabled?: boolean;
|
|
36
37
|
size?: 'small' | 'medium' | 'large';
|
|
37
38
|
noSpacing?: boolean;
|
|
39
|
+
spacing?: 'normal' | 'compact';
|
|
38
40
|
}
|
|
39
41
|
export interface ItemHolderProps extends FormItemProps {
|
|
40
42
|
errors: ReactNode[];
|
|
@@ -44,6 +46,7 @@ export interface ItemHolderProps extends FormItemProps {
|
|
|
44
46
|
fieldId?: string;
|
|
45
47
|
isRequired?: boolean;
|
|
46
48
|
onSubItemMetaChange: ReportMetaChange;
|
|
49
|
+
identityMeta: ItemDecoratorMeta;
|
|
47
50
|
}
|
|
48
51
|
declare function InternalFormItem<Values = unknown>(props: FormItemProps<Values>): ReactElement;
|
|
49
52
|
type InternalFormItemType = typeof InternalFormItem;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { FieldContext as
|
|
4
|
-
import
|
|
5
|
-
import { supportRef as
|
|
6
|
-
import
|
|
7
|
-
import { FormContext as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { getStatus as
|
|
13
|
-
import
|
|
1
|
+
import { j as u } from "../../_virtual/jsx-runtime.js";
|
|
2
|
+
import { useContext as y, useMemo as T, useRef as le, isValidElement as W, Children as $, cloneElement as j } from "react";
|
|
3
|
+
import { FieldContext as ce, ListContext as fe, Field as ge } from "rc-field-form";
|
|
4
|
+
import ue from "rc-util/lib/hooks/useState";
|
|
5
|
+
import { supportRef as pe } from "rc-util/lib/ref";
|
|
6
|
+
import he from "./MemoInput.js";
|
|
7
|
+
import { FormContext as ye, NoStyleItemContext as be } from "../context.js";
|
|
8
|
+
import Ce from "../hooks/useChildren.js";
|
|
9
|
+
import Ie from "../hooks/useFormItemStatus.js";
|
|
10
|
+
import Se from "../hooks/useFrameState.js";
|
|
11
|
+
import Pe from "../hooks/useItemRef.js";
|
|
12
|
+
import { isCompactControlChild as ve, getStatus as we, toArray as N, joinNamePath as Ee, getFieldId as Fe, isReactComponent as B } from "../util.js";
|
|
13
|
+
import Te from "./ItemHolder.js";
|
|
14
14
|
function G() {
|
|
15
15
|
return {
|
|
16
16
|
errors: [],
|
|
@@ -21,147 +21,158 @@ function G() {
|
|
|
21
21
|
validated: !1
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
24
|
+
const je = "__SPLIT__", Ne = { namePath: [], path: "" };
|
|
25
|
+
function xe(b) {
|
|
26
26
|
const {
|
|
27
|
-
noStyle:
|
|
27
|
+
noStyle: x,
|
|
28
28
|
shouldUpdate: J,
|
|
29
|
-
dependencies:
|
|
30
|
-
messageVariables:
|
|
31
|
-
trigger:
|
|
32
|
-
validateTrigger:
|
|
33
|
-
children:
|
|
34
|
-
required:
|
|
35
|
-
hidden:
|
|
36
|
-
rules:
|
|
29
|
+
dependencies: R,
|
|
30
|
+
messageVariables: _,
|
|
31
|
+
trigger: q = "onChange",
|
|
32
|
+
validateTrigger: z,
|
|
33
|
+
children: Q,
|
|
34
|
+
required: C,
|
|
35
|
+
hidden: X,
|
|
36
|
+
rules: Z,
|
|
37
37
|
name: l,
|
|
38
|
-
label:
|
|
39
|
-
disabled:
|
|
38
|
+
label: A,
|
|
39
|
+
disabled: I,
|
|
40
40
|
helperText: S,
|
|
41
|
-
hasFeedback:
|
|
42
|
-
validateStatus:
|
|
43
|
-
size:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
hasFeedback: L,
|
|
42
|
+
validateStatus: V,
|
|
43
|
+
size: P,
|
|
44
|
+
spacing: v
|
|
45
|
+
} = b, { name: ee, disabled: w, size: E } = y(ye), t = Ce(Q), re = T(
|
|
46
|
+
() => v === void 0 && ve(t) ? "compact" : void 0,
|
|
47
|
+
[v, t]
|
|
48
|
+
), K = typeof t == "function", M = y(be), { validateTrigger: te } = y(ce), O = z !== void 0 ? z : te, F = l != null, ne = y(fe), k = le(), [D, ie] = Se({}), [a, oe] = ue(() => G()), se = (e) => {
|
|
49
|
+
const o = ne?.getKey(e.name);
|
|
50
|
+
if (oe(e.destroy ? G() : e, !0), x && S !== !1 && M) {
|
|
51
|
+
let n = e.name;
|
|
52
|
+
if (e.destroy)
|
|
53
|
+
n = k.current || n;
|
|
54
|
+
else if (o !== void 0) {
|
|
55
|
+
const [s, r] = o;
|
|
56
|
+
n = [s, ...r], k.current = n;
|
|
53
57
|
}
|
|
54
|
-
|
|
58
|
+
M(e, n);
|
|
55
59
|
}
|
|
56
|
-
},
|
|
57
|
-
|
|
60
|
+
}, ae = (e, o) => {
|
|
61
|
+
ie((n) => {
|
|
58
62
|
const s = {
|
|
59
|
-
...
|
|
60
|
-
},
|
|
61
|
-
return
|
|
63
|
+
...n
|
|
64
|
+
}, i = [...e.name.slice(0, -1), ...o].join(je);
|
|
65
|
+
return e.destroy ? delete s[i] : s[i] = e, s;
|
|
62
66
|
});
|
|
63
|
-
}, [
|
|
64
|
-
const
|
|
65
|
-
return Object.values(
|
|
66
|
-
|
|
67
|
-
}), [
|
|
68
|
-
}, [
|
|
69
|
-
() =>
|
|
70
|
-
[a,
|
|
71
|
-
),
|
|
67
|
+
}, [p, Y] = T(() => {
|
|
68
|
+
const e = [...a.errors], o = [...a.warnings];
|
|
69
|
+
return Object.values(D).forEach((n) => {
|
|
70
|
+
e.push(...n.errors || []), o.push(...n.warnings || []);
|
|
71
|
+
}), [e, o];
|
|
72
|
+
}, [D, a.errors, a.warnings]), c = T(
|
|
73
|
+
() => we(a.errors, a.warnings, a, "", !!L, V),
|
|
74
|
+
[a, L, V]
|
|
75
|
+
), H = (e, o, n, s, r = Ne) => x && !X ? /* @__PURE__ */ u.jsx(u.Fragment, { children: $.map(e, (i) => B(i) ? j(i, {
|
|
72
76
|
...s,
|
|
73
77
|
name: l,
|
|
74
|
-
disabled:
|
|
75
|
-
error:
|
|
76
|
-
size:
|
|
77
|
-
...
|
|
78
|
-
}) :
|
|
79
|
-
|
|
78
|
+
disabled: I ?? w,
|
|
79
|
+
error: c === "error" || c === "warning",
|
|
80
|
+
size: P ?? E,
|
|
81
|
+
...i.props
|
|
82
|
+
}) : i) }) : /* @__PURE__ */ u.jsx(
|
|
83
|
+
Te,
|
|
80
84
|
{
|
|
81
|
-
...
|
|
82
|
-
fieldId:
|
|
83
|
-
required:
|
|
84
|
-
errors:
|
|
85
|
-
warnings:
|
|
86
|
-
status:
|
|
85
|
+
...b,
|
|
86
|
+
fieldId: o,
|
|
87
|
+
required: C ?? n,
|
|
88
|
+
errors: p,
|
|
89
|
+
warnings: Y,
|
|
90
|
+
status: c,
|
|
87
91
|
meta: a,
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
identityMeta: r,
|
|
93
|
+
onSubItemMetaChange: ae,
|
|
94
|
+
spacing: v ?? re,
|
|
95
|
+
children: $.map(e, (i) => B(i) ? j(i, {
|
|
90
96
|
...s,
|
|
91
97
|
name: l,
|
|
92
|
-
disabled:
|
|
93
|
-
error:
|
|
94
|
-
size:
|
|
95
|
-
...
|
|
96
|
-
}) :
|
|
98
|
+
disabled: I ?? w,
|
|
99
|
+
error: c === "error" || c === "warning",
|
|
100
|
+
size: P ?? E,
|
|
101
|
+
...i.props
|
|
102
|
+
}) : i)
|
|
97
103
|
}
|
|
98
104
|
);
|
|
99
|
-
if (!F && !
|
|
100
|
-
return
|
|
101
|
-
let
|
|
102
|
-
typeof
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
if (!F && !K && !R)
|
|
106
|
+
return H(t);
|
|
107
|
+
let g = {};
|
|
108
|
+
typeof A == "string" ? g.label = A : l && (g.label = String(l)), _ && (g = { ...g, ..._ });
|
|
109
|
+
const de = Pe(), me = ({
|
|
110
|
+
control: e,
|
|
111
|
+
fieldId: o,
|
|
112
|
+
isRequired: n,
|
|
113
|
+
mergedName: s
|
|
114
|
+
}) => {
|
|
115
|
+
if (!W(t)) return null;
|
|
116
|
+
const r = {
|
|
117
|
+
...t.props,
|
|
118
|
+
...e,
|
|
119
|
+
disabled: I ?? w,
|
|
120
|
+
error: c === "error" || c === "warning",
|
|
121
|
+
size: t.props?.size ?? P ?? E
|
|
111
122
|
};
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
(S ||
|
|
123
|
+
if (r.fieldId || (r["data-field-id"] = o), S || p.length > 0 || Y.length > 0) {
|
|
124
|
+
const d = [];
|
|
125
|
+
(S || p.length > 0) && d.push(`${o}_help`), r["aria-describedby"] = d.join(" ");
|
|
115
126
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
p.length > 0 && (r["aria-invalid"] = "true"), n && (r["aria-required"] = "true"), pe(t) && (r.ref = de(s, t)), (/* @__PURE__ */ new Set([...N(q), ...N(O)])).forEach((d) => {
|
|
128
|
+
r[d] = (...m) => {
|
|
129
|
+
e[d]?.(...m), t.props[d]?.(...m);
|
|
119
130
|
};
|
|
120
131
|
});
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
132
|
+
const h = [
|
|
133
|
+
r["aria-required"],
|
|
134
|
+
r["aria-invalid"],
|
|
135
|
+
r["aria-describedby"]
|
|
125
136
|
];
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
|
|
137
|
+
return /* @__PURE__ */ u.jsx(
|
|
138
|
+
he,
|
|
128
139
|
{
|
|
129
|
-
control:
|
|
130
|
-
update:
|
|
131
|
-
childProps:
|
|
132
|
-
children:
|
|
140
|
+
control: e,
|
|
141
|
+
update: t,
|
|
142
|
+
childProps: h,
|
|
143
|
+
children: j(t, r)
|
|
133
144
|
}
|
|
134
145
|
);
|
|
135
146
|
};
|
|
136
|
-
return /* @__PURE__ */
|
|
137
|
-
|
|
147
|
+
return /* @__PURE__ */ u.jsx(
|
|
148
|
+
ge,
|
|
138
149
|
{
|
|
139
|
-
...
|
|
140
|
-
messageVariables:
|
|
141
|
-
trigger:
|
|
142
|
-
validateTrigger:
|
|
143
|
-
onMetaChange:
|
|
144
|
-
children: (
|
|
145
|
-
const s =
|
|
146
|
-
if (
|
|
150
|
+
...b,
|
|
151
|
+
messageVariables: g,
|
|
152
|
+
trigger: q,
|
|
153
|
+
validateTrigger: O,
|
|
154
|
+
onMetaChange: se,
|
|
155
|
+
children: (e, o, n) => {
|
|
156
|
+
const s = N(l).length && o ? o.name : [], r = { namePath: s, path: Ee(s) }, i = Fe(s, ee), h = C !== void 0 ? C : !!Z?.some((f) => {
|
|
157
|
+
if (f && typeof f == "object" && f.required && !f.warningOnly)
|
|
147
158
|
return !0;
|
|
148
|
-
if (typeof
|
|
149
|
-
const
|
|
150
|
-
return
|
|
159
|
+
if (typeof f == "function") {
|
|
160
|
+
const U = f(n);
|
|
161
|
+
return U?.required && !U?.warningOnly;
|
|
151
162
|
}
|
|
152
163
|
return !1;
|
|
153
|
-
}),
|
|
154
|
-
...
|
|
164
|
+
}), d = {
|
|
165
|
+
...e
|
|
155
166
|
};
|
|
156
|
-
let
|
|
157
|
-
return Array.isArray(
|
|
167
|
+
let m = null;
|
|
168
|
+
return Array.isArray(t) && F ? m = t : W(t) ? m = me({ control: d, fieldId: i, isRequired: h, mergedName: s }) : K && (J || R) && !F ? m = t(n) : m = t, H(m, i, h, d, r);
|
|
158
169
|
}
|
|
159
170
|
}
|
|
160
171
|
);
|
|
161
172
|
}
|
|
162
|
-
const
|
|
163
|
-
|
|
173
|
+
const Re = xe;
|
|
174
|
+
Re.useStatus = Ie;
|
|
164
175
|
export {
|
|
165
|
-
|
|
176
|
+
Re as default
|
|
166
177
|
};
|
|
167
178
|
//# sourceMappingURL=index.js.map
|
package/es/FieldForm/Form.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PropsWithChildren, RefAttributes, ReactElement, FC, ReactNode } from 'r
|
|
|
2
2
|
import { useWatch } from 'rc-field-form';
|
|
3
3
|
import { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
|
|
4
4
|
import { FormRef } from 'rc-field-form/lib/interface';
|
|
5
|
-
import { FormLabelAlign } from './interface';
|
|
5
|
+
import { FormLabelAlign, ItemDecorator } from './interface';
|
|
6
6
|
import { FormInstance, default as useForm } from './hooks/useForm';
|
|
7
7
|
import { FeedbackIcons } from './FieldFormItem';
|
|
8
8
|
export type RequiredMark = boolean | 'optional' | ((labelNode: ReactNode, info: {
|
|
@@ -22,6 +22,8 @@ export interface FormProps<Values = unknown> extends Omit<RcFormProps<Values>, '
|
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
requiredMark?: RequiredMark;
|
|
24
24
|
size?: 'small' | 'medium' | 'large';
|
|
25
|
+
spacing?: 'normal' | 'compact';
|
|
26
|
+
itemDecorator?: ItemDecorator;
|
|
25
27
|
}
|
|
26
28
|
declare const FieldForm: (<Values = unknown>(props: PropsWithChildren<FormProps<Values>> & RefAttributes<FormRef<Values>>) => ReactElement) & Pick<FC, "displayName">;
|
|
27
29
|
export { useForm, useWatch, type FormInstance };
|