@silver-formily/element-plus 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.en-US.md +32 -32
- package/README.md +32 -32
- package/esm/__builtins__/configs/index.mjs.map +1 -1
- package/esm/__builtins__/index.mjs +19 -23
- package/esm/__builtins__/index.mjs.map +1 -1
- package/esm/__builtins__/shared/index.d.ts +0 -1
- package/esm/__builtins__/shared/index.mjs +17 -21
- package/esm/__builtins__/shared/index.mjs.map +1 -1
- package/esm/__builtins__/shared/loading.mjs +5 -5
- package/esm/__builtins__/shared/loading.mjs.map +1 -1
- package/esm/__builtins__/shared/simple-version-compare.mjs.map +1 -1
- package/esm/__builtins__/shared/transform-component.mjs.map +1 -1
- package/esm/__builtins__/shared/use-enter-submit.d.ts +9 -0
- package/esm/__builtins__/shared/use-enter-submit.mjs +25 -0
- package/esm/__builtins__/shared/use-enter-submit.mjs.map +1 -0
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +18 -21
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +29 -33
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +29 -31
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +35 -36
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +2 -8
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +30 -33
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +27 -28
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +5 -11
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +52 -53
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +12 -18
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +17 -19
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/autocomplete.d.ts +1222 -0
- package/esm/autocomplete/index.d.ts +639 -0
- package/esm/autocomplete/index.mjs +110 -0
- package/esm/autocomplete/index.mjs.map +1 -0
- package/esm/cascader/index.mjs +17 -20
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.d.ts +42 -42
- package/esm/checkbox/index.mjs +16 -19
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.d.ts +210 -0
- package/esm/color-picker/index.mjs +14 -0
- package/esm/color-picker/index.mjs.map +1 -0
- package/esm/color-picker-panel/index.d.ts +129 -0
- package/esm/color-picker-panel/index.mjs +22 -0
- package/esm/color-picker-panel/index.mjs.map +1 -0
- package/esm/date-picker/index.mjs +11 -35
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/date-picker/utils.d.ts +4 -0
- package/esm/date-picker/utils.mjs +27 -0
- package/esm/date-picker/utils.mjs.map +1 -0
- package/esm/date-picker-panel/index.d.ts +143 -0
- package/esm/date-picker-panel/index.mjs +27 -0
- package/esm/date-picker-panel/index.mjs.map +1 -0
- package/esm/editable/index.mjs +48 -50
- package/esm/editable/index.mjs.map +1 -1
- package/esm/env.d.mjs +2 -0
- package/esm/env.d.mjs.map +1 -0
- package/esm/form/form.mjs +6 -6
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/form-button-group.d.ts +1 -1
- package/esm/form-button-group/index.d.ts +3 -3
- package/esm/form-button-group/index.mjs +23 -26
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +2 -8
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +18 -20
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/dialog-content.d.ts +789 -3
- package/esm/form-dialog/index.mjs +98 -87
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +1 -0
- package/esm/form-drawer/drawer-content.d.ts +919 -3
- package/esm/form-drawer/index.mjs +92 -82
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +1 -0
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +20 -23
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +59 -57
- package/esm/form-item/index.mjs.map +1 -1
- package/esm/form-item/utils.mjs.map +1 -1
- package/esm/form-layout/form-layout.mjs +14 -18
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs +19 -24
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +24 -26
- package/esm/form-step/index.mjs.map +1 -1
- package/esm/form-step/utils.mjs.map +1 -1
- package/esm/form-tab/hooks.mjs.map +1 -1
- package/esm/form-tab/index.mjs +19 -20
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.d.ts +9 -0
- package/esm/index.mjs +90 -72
- package/esm/index.mjs.map +1 -1
- package/esm/input/index.mjs +20 -23
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.d.ts +21 -21
- package/esm/input-number/index.mjs +7 -9
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/input-tag/index.d.ts +32 -0
- package/esm/input-tag/index.mjs +46 -0
- package/esm/input-tag/index.mjs.map +1 -0
- package/esm/input-tag/input-tag.d.ts +32 -0
- package/esm/mention/index.d.ts +50 -0
- package/esm/mention/index.mjs +93 -0
- package/esm/mention/index.mjs.map +1 -0
- package/esm/mention/mention.d.ts +51 -0
- package/esm/pagination/components/jumper.mjs.map +1 -1
- package/esm/pagination/components/next.mjs.map +1 -1
- package/esm/pagination/components/pager.mjs.map +1 -1
- package/esm/pagination/components/prev.mjs.map +1 -1
- package/esm/pagination/components/total.mjs.map +1 -1
- package/esm/pagination/pagination.mjs.map +1 -1
- package/esm/password/index.mjs.map +1 -1
- package/esm/preview-text/color-picker.d.ts +5 -0
- package/esm/preview-text/index.d.ts +10 -0
- package/esm/preview-text/index.mjs +175 -119
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/rate.d.ts +5 -0
- package/esm/preview-text/utils.d.ts +5 -5
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/radio/index.d.ts +36 -36
- package/esm/radio/index.mjs +25 -28
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.d.ts +187 -0
- package/esm/rate/index.mjs +14 -0
- package/esm/rate/index.mjs.map +1 -0
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.d.ts +26 -0
- package/esm/segmented/index.mjs +37 -0
- package/esm/segmented/index.mjs.map +1 -0
- package/esm/segmented/segmented.d.ts +25 -0
- package/esm/select/index.mjs +16 -19
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.mjs +12 -15
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/shared/overlay-elements.d.ts +6 -0
- package/esm/shared/overlay-elements.mjs +16 -0
- package/esm/shared/overlay-elements.mjs.map +1 -0
- package/esm/slider/index.d.ts +177 -0
- package/esm/slider/index.mjs +14 -0
- package/esm/slider/index.mjs.map +1 -0
- package/esm/styles/preview-text/index.css +1 -1
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.d.ts +12 -12
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +6 -8
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.mjs +6 -8
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +28 -31
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +17 -20
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.d.ts +1 -1
- package/esm/upload/index.mjs +7 -9
- package/esm/upload/index.mjs.map +1 -1
- package/esm/upload/upload.d.ts +2 -2
- package/esm/vendor/sizes.mjs.map +1 -1
- package/package.json +115 -113
- package/esm/__builtins__/shared/hooks.d.ts +0 -7
- package/esm/__builtins__/shared/hooks.mjs +0 -59
- package/esm/__builtins__/shared/hooks.mjs.map +0 -1
package/esm/form-item/index.mjs
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { isVoidField as
|
|
2
|
-
import { useField as
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
import {
|
|
5
|
-
import "@formily/
|
|
6
|
-
import "@
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import { getFeedbackMessage as Ve, determineFeedbackStatus as Ne } from "./utils.mjs";
|
|
17
|
-
import '../styles/form-item/index.css';const Oe = "utils/dom/style";
|
|
1
|
+
import { isVoidField as de } from "@formily/core";
|
|
2
|
+
import { useField as ce, connect as fe, mapProps as ve } from "@silver-formily/vue";
|
|
3
|
+
import { defineComponent as pe, useSlots as me, computed as i, ref as b, reactive as be, watch as ye, provide as D, createElementBlock as n, openBlock as a, unref as l, normalizeClass as u, createBlock as f, createCommentVNode as c, createElementVNode as h, resolveDynamicComponent as g, normalizeStyle as W, withCtx as m, isVNode as x, createVNode as _, toDisplayString as y, Fragment as C, createTextVNode as R, renderSlot as G, TransitionGroup as ke } from "vue";
|
|
4
|
+
import { InfoFilled as ge, CircleClose as Se, CircleCheck as he, Warning as xe } from "@element-plus/icons-vue";
|
|
5
|
+
import { isValid as v, isArr as _e } from "@formily/shared";
|
|
6
|
+
import { useResizeObserver as Ce } from "@vueuse/core";
|
|
7
|
+
import { useNamespace as Ie, useFormSize as $e, useId as we, formItemContextKey as We, ElTooltip as E, ElIcon as K } from "element-plus";
|
|
8
|
+
import { FORM_LAYOUT_PROPS_KEYS as Fe, useFormLayout as Ae, formLayoutShallowContext as Le } from "../form-layout/utils.mjs";
|
|
9
|
+
import { p as ze } from "../vendor/lodash.mjs";
|
|
10
|
+
import { i as Be, a as Te, d as Re } from "../vendor/types.mjs";
|
|
11
|
+
import { i as Ee } from "../vendor/shared.esm-bundler.mjs";
|
|
12
|
+
import { stylePrefix as Ve } from "../__builtins__/configs/index.mjs";
|
|
13
|
+
import { getFeedbackMessage as Pe, determineFeedbackStatus as Ne } from "./utils.mjs";
|
|
14
|
+
import { composeExport as Oe } from "../__builtins__/shared/utils.mjs";
|
|
15
|
+
import '../styles/form-item/index.css';const qe = "utils/dom/style";
|
|
18
16
|
function U(s, p = "px") {
|
|
19
17
|
if (!s && s !== 0) return "";
|
|
20
|
-
if (
|
|
18
|
+
if (Be(s) || Te(s))
|
|
21
19
|
return `${s}${p}`;
|
|
22
|
-
if (
|
|
20
|
+
if (Ee(s))
|
|
23
21
|
return s;
|
|
24
|
-
|
|
22
|
+
Re(qe, "binding value must be a string or number");
|
|
25
23
|
}
|
|
26
|
-
const
|
|
24
|
+
const Me = ["role", "aria-labelledby"], Y = /* @__PURE__ */ pe({
|
|
27
25
|
name: "FFormItem",
|
|
28
26
|
__name: "form-item",
|
|
29
27
|
props: {
|
|
@@ -51,21 +49,21 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
51
49
|
tooltipLayout: {}
|
|
52
50
|
},
|
|
53
51
|
setup(s, { expose: p }) {
|
|
54
|
-
const e = s, F =
|
|
52
|
+
const e = s, F = me(), o = Ie("form-item"), d = `${Ve}-form-item`, H = i(
|
|
55
53
|
() => Object.fromEntries(
|
|
56
|
-
Object.entries(
|
|
54
|
+
Object.entries(ze(e, Fe)).filter(([r, w]) => v(w))
|
|
57
55
|
)
|
|
58
|
-
), J =
|
|
56
|
+
), J = Ae(), t = i(() => Object.assign({
|
|
59
57
|
colon: !0,
|
|
60
58
|
feedbackLayout: "loose",
|
|
61
59
|
fullness: !1,
|
|
62
60
|
labelWrap: !1
|
|
63
|
-
}, J.value, H.value)),
|
|
61
|
+
}, J.value, H.value)), V = ce(), Q = $e(void 0, { formItem: !1 }), P = i(() => v(t.value.size) ? t.value.size : Q.value), A = we().value, k = b([]), N = b(""), O = b(), S = b(), q = b();
|
|
64
62
|
p({
|
|
65
63
|
feedbackTooltipRef: q
|
|
66
64
|
});
|
|
67
65
|
const I = i(
|
|
68
|
-
() => t.value.layout === "vertical" ||
|
|
66
|
+
() => t.value.layout === "vertical" || _e(t.value.layout) && t.value.layout.includes("vertical") ? "top" : t.value.labelAlign ?? "right"
|
|
69
67
|
), X = i(() => {
|
|
70
68
|
if (I.value === "top")
|
|
71
69
|
return {};
|
|
@@ -77,10 +75,10 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
77
75
|
}), ee = i(() => ({
|
|
78
76
|
justifyContent: t.value?.wrapperAlign === "right" && "flex-end"
|
|
79
77
|
})), te = i(
|
|
80
|
-
() => e.asterisk &&
|
|
78
|
+
() => e.asterisk && V.value?.pattern !== "readPretty"
|
|
81
79
|
), ae = i(() => [
|
|
82
80
|
o.b(),
|
|
83
|
-
o.m(
|
|
81
|
+
o.m(P.value || "default"),
|
|
84
82
|
o.is(e.feedbackStatus),
|
|
85
83
|
o.is("validating", N.value === "validating"),
|
|
86
84
|
o.is("success", N.value === "success"),
|
|
@@ -105,37 +103,41 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
105
103
|
};
|
|
106
104
|
/* istanbul ignore next -- @preserve */
|
|
107
105
|
const re = async () => {
|
|
108
|
-
}
|
|
106
|
+
};
|
|
107
|
+
/* istanbul ignore next -- @preserve */
|
|
108
|
+
const se = () => {
|
|
109
|
+
}, ie = (r) => {
|
|
109
110
|
/* istanbul ignore else -- @preserve */
|
|
110
111
|
k.value.includes(r) || k.value.push(r);
|
|
111
|
-
},
|
|
112
|
+
}, ne = (r) => {
|
|
112
113
|
k.value = k.value.filter((w) => w !== r);
|
|
113
114
|
}, j = b(!1);
|
|
114
|
-
|
|
115
|
+
Ce(S, () => {
|
|
115
116
|
j.value = S.value?.scrollWidth > S.value?.clientWidth;
|
|
116
117
|
});
|
|
117
|
-
const T = i(() => j.value && !t.value.labelWrap),
|
|
118
|
+
const T = i(() => j.value && !t.value.labelWrap), ue = b(""), $ = be({
|
|
118
119
|
$el: O,
|
|
119
120
|
labelWidth: t.value?.labelWidth,
|
|
120
|
-
size:
|
|
121
|
-
validateState:
|
|
121
|
+
size: P,
|
|
122
|
+
validateState: ue.value,
|
|
122
123
|
labelId: A,
|
|
123
124
|
inputIds: k,
|
|
124
125
|
isGroup: B,
|
|
125
126
|
hasLabel: L,
|
|
126
|
-
addInputId:
|
|
127
|
-
removeInputId:
|
|
127
|
+
addInputId: ie,
|
|
128
|
+
removeInputId: ne,
|
|
128
129
|
resetField: re,
|
|
129
130
|
clearValidate: oe,
|
|
130
131
|
validate: le,
|
|
131
132
|
labelPosition: I,
|
|
132
133
|
inlineMessage: !0,
|
|
133
134
|
showMessage: !0,
|
|
134
|
-
fieldValue:
|
|
135
|
+
fieldValue: V.value?.value,
|
|
135
136
|
validateMessage: "",
|
|
136
|
-
propString: ""
|
|
137
|
+
propString: "",
|
|
138
|
+
setInitialValue: se
|
|
137
139
|
});
|
|
138
|
-
return
|
|
140
|
+
return ye(() => e.feedbackStatus, (r) => {
|
|
139
141
|
if (r === "pending") {
|
|
140
142
|
$.validateState = "validating";
|
|
141
143
|
return;
|
|
@@ -147,10 +149,10 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
147
149
|
$.validateState = r;
|
|
148
150
|
}, {
|
|
149
151
|
immediate: !0
|
|
150
|
-
}), D(
|
|
152
|
+
}), D(Le, b({
|
|
151
153
|
...v(t.value.size) && { size: t.value.size },
|
|
152
154
|
...v(t.value.colon) && { colon: t.value.colon }
|
|
153
|
-
})), D(
|
|
155
|
+
})), D(We, $), (r, w) => (a(), n("div", {
|
|
154
156
|
ref_key: "formItemRef",
|
|
155
157
|
ref: O,
|
|
156
158
|
class: u([d, t.value.labelWrap && "is-warp", ...ae.value]),
|
|
@@ -209,7 +211,7 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
209
211
|
class: u(`${d}-label-tooltip`)
|
|
210
212
|
}, {
|
|
211
213
|
default: m(() => [
|
|
212
|
-
_(l(
|
|
214
|
+
_(l(ge))
|
|
213
215
|
]),
|
|
214
216
|
_: 1
|
|
215
217
|
}, 8, ["class"])
|
|
@@ -262,9 +264,9 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
262
264
|
}, [
|
|
263
265
|
_(l(K), null, {
|
|
264
266
|
default: m(() => [
|
|
265
|
-
e.feedbackStatus === "error" ? (a(), f(l(
|
|
266
|
-
e.feedbackStatus === "success" ? (a(), f(l(
|
|
267
|
-
e.feedbackStatus === "warning" ? (a(), f(l(
|
|
267
|
+
e.feedbackStatus === "error" ? (a(), f(l(Se), { key: 0 })) : c("", !0),
|
|
268
|
+
e.feedbackStatus === "success" ? (a(), f(l(he), { key: 1 })) : c("", !0),
|
|
269
|
+
e.feedbackStatus === "warning" ? (a(), f(l(xe), { key: 2 })) : c("", !0)
|
|
268
270
|
]),
|
|
269
271
|
_: 1
|
|
270
272
|
}),
|
|
@@ -273,7 +275,7 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
273
275
|
]),
|
|
274
276
|
_: 3
|
|
275
277
|
}, 8, ["visible"])) : G(r.$slots, "default", { key: 1 }),
|
|
276
|
-
_(
|
|
278
|
+
_(ke, {
|
|
277
279
|
name: `${l(o).namespace.value}-zoom-in-top`
|
|
278
280
|
}, {
|
|
279
281
|
default: m(() => [
|
|
@@ -298,13 +300,13 @@ const qe = ["role", "aria-labelledby"], Y = /* @__PURE__ */ ve({
|
|
|
298
300
|
}, y(e.addonAfter), 3))
|
|
299
301
|
], 64)) : c("", !0)
|
|
300
302
|
], 6)
|
|
301
|
-
], 10,
|
|
303
|
+
], 10, Me));
|
|
302
304
|
}
|
|
303
305
|
});
|
|
304
|
-
function
|
|
305
|
-
if (
|
|
306
|
+
function je(s, p) {
|
|
307
|
+
if (de(p) || !p)
|
|
306
308
|
return s;
|
|
307
|
-
const e =
|
|
309
|
+
const e = Pe(p), F = Ne(p), o = "asterisk" in s ? s.asterisk : p.required && p.pattern !== "readPretty";
|
|
308
310
|
return {
|
|
309
311
|
...s,
|
|
310
312
|
feedbackText: e,
|
|
@@ -312,24 +314,24 @@ function Me(s, p) {
|
|
|
312
314
|
asterisk: o
|
|
313
315
|
};
|
|
314
316
|
}
|
|
315
|
-
const
|
|
317
|
+
const De = fe(
|
|
316
318
|
Y,
|
|
317
|
-
|
|
319
|
+
ve(
|
|
318
320
|
{
|
|
319
321
|
validateStatus: !0,
|
|
320
322
|
title: "label",
|
|
321
323
|
required: !0,
|
|
322
324
|
description: "extra"
|
|
323
325
|
},
|
|
324
|
-
|
|
326
|
+
je
|
|
325
327
|
)
|
|
326
|
-
),
|
|
328
|
+
), rt = Oe(De, {
|
|
327
329
|
BaseItem: Y
|
|
328
330
|
});
|
|
329
331
|
export {
|
|
330
332
|
Y as FormBaseItem,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
333
|
+
rt as FormItem,
|
|
334
|
+
rt as default,
|
|
335
|
+
je as fieldFeedbackMapper
|
|
334
336
|
};
|
|
335
337
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.22_typescript@5.9.3_/node_modules/element-plus/es/utils/dom/style.mjs","../../src/form-item/form-item.vue","../../src/form-item/index.ts"],"sourcesContent":["import { isNumber, isStringNumber } from '../types.mjs';\nimport { isClient } from '@vueuse/core';\nimport { isString, camelize, isObject } from '@vue/shared';\nimport { entriesOf, keysOf } from '../objects.mjs';\nimport { debugWarn } from '../error.mjs';\n\nconst SCOPE = \"utils/dom/style\";\nconst classNameToArray = (cls = \"\") => cls.split(\" \").filter((item) => !!item.trim());\nconst hasClass = (el, cls) => {\n if (!el || !cls) return false;\n if (cls.includes(\" \")) throw new Error(\"className should not contain space.\");\n return el.classList.contains(cls);\n};\nconst addClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.add(...classNameToArray(cls));\n};\nconst removeClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.remove(...classNameToArray(cls));\n};\nconst getStyle = (element, styleName) => {\n var _a;\n if (!isClient || !element || !styleName) return \"\";\n let key = camelize(styleName);\n if (key === \"float\") key = \"cssFloat\";\n try {\n const style = element.style[key];\n if (style) return style;\n const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, \"\");\n return computed ? computed[key] : \"\";\n } catch (e) {\n return element.style[key];\n }\n};\nconst setStyle = (element, styleName, value) => {\n if (!element || !styleName) return;\n if (isObject(styleName)) {\n entriesOf(styleName).forEach(\n ([prop, value2]) => setStyle(element, prop, value2)\n );\n } else {\n const key = camelize(styleName);\n element.style[key] = value;\n }\n};\nconst removeStyle = (element, style) => {\n if (!element || !style) return;\n if (isObject(style)) {\n keysOf(style).forEach((prop) => removeStyle(element, prop));\n } else {\n setStyle(element, style, \"\");\n }\n};\nfunction addUnit(value, defaultUnit = \"px\") {\n if (!value && value !== 0) return \"\";\n if (isNumber(value) || isStringNumber(value)) {\n return `${value}${defaultUnit}`;\n } else if (isString(value)) {\n return value;\n }\n debugWarn(SCOPE, \"binding value must be a string or number\");\n}\n\nexport { addClass, addUnit, classNameToArray, getStyle, hasClass, removeClass, removeStyle, setStyle };\n//# sourceMappingURL=style.mjs.map\n","<script lang=\"ts\" setup>\nimport type { Field } from '@formily/core'\nimport type {\n FormItemContext,\n FormItemValidateState,\n FormValidationResult,\n TooltipInstance,\n} from 'element-plus'\nimport type { ICalculatedFormLayoutProps } from 'src/form-layout/types'\nimport type { CSSProperties } from 'vue'\nimport type { IFormItemProps } from './types'\nimport { CircleCheck, CircleClose, InfoFilled, Warning } from '@element-plus/icons-vue'\nimport { isArr, isValid } from '@formily/shared'\nimport { useField } from '@silver-formily/vue'\nimport { ElIcon, ElTooltip, formItemContextKey, useFormSize, useId, useNamespace } from 'element-plus'\nimport { addUnit } from 'element-plus/es/utils/index'\nimport { pick } from 'lodash-es'\nimport { computed, isVNode, provide, reactive, ref, useSlots, watch } from 'vue'\nimport { stylePrefix, useResizeObserver } from '../__builtins__'\nimport { FORM_LAYOUT_PROPS_KEYS, formLayoutShallowContext, useFormLayout } from '../form-layout/utils'\n\ndefineOptions({\n name: 'FFormItem',\n})\nconst props = withDefaults(defineProps<IFormItemProps>(), {\n asterisk: undefined,\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n})\nconst slots = useSlots()\nconst ns = useNamespace('form-item')\nconst prefixCls = `${stylePrefix}-form-item`\nconst formItemConfig = computed<Partial<ICalculatedFormLayoutProps>>(() =>\n Object.fromEntries(\n Object.entries(pick(props, FORM_LAYOUT_PROPS_KEYS))\n .filter(([_, value]) => isValid(value)),\n ),\n)\nconst formlayoutConfig = useFormLayout()\nconst formlayout = computed(() => Object.assign({\n colon: true,\n feedbackLayout: 'loose',\n fullness: false,\n labelWrap: false,\n}, formlayoutConfig.value, formItemConfig.value))\nconst field = useField<Field>()\n\nconst inheritedSize = useFormSize(undefined, { formItem: false })\nconst formItemSize = computed(() => {\n if (isValid(formlayout.value.size)) {\n return formlayout.value.size\n }\n return inheritedSize.value\n})\n\nconst labelId = useId().value\nconst inputIds = ref<string[]>([])\n\nconst validateState = ref<FormItemValidateState>('')\nconst formItemRef = ref<HTMLDivElement>()\nconst labelRef = ref<HTMLElement>()\nconst feedbackTooltipRef = ref<TooltipInstance>()\ndefineExpose({\n feedbackTooltipRef,\n})\n\nconst labelPosition = computed(\n () => {\n if (formlayout.value.layout === 'vertical' || (isArr(formlayout.value.layout) && formlayout.value.layout.includes('vertical' as any))) {\n return 'top'\n }\n return formlayout.value.labelAlign ?? 'right'\n },\n)\n\nconst labelStyle = computed<CSSProperties>(() => {\n if (labelPosition.value === 'top') {\n return {}\n }\n\n const labelWidth = addUnit(formlayout.value.labelWidth || '')\n if (labelWidth)\n return { width: labelWidth }\n return {}\n})\n\nconst contentStyle = computed<CSSProperties>(() => {\n const contentWidth = addUnit(formlayout.value?.wrapperWidth || '')\n if (contentWidth)\n return { width: contentWidth, flex: 'unset' }\n return {}\n})\n\nconst contentWrapperStyle = computed<CSSProperties>(() => {\n return {\n justifyContent: formlayout.value?.wrapperAlign === 'right' && 'flex-end',\n }\n})\n\nconst isRequired = computed(() =>\n props.asterisk && field.value?.pattern !== 'readPretty',\n)\n\nconst formItemClasses = computed(() => [\n ns.b(),\n ns.m(formItemSize.value || 'default'),\n ns.is(props.feedbackStatus),\n ns.is('validating', validateState.value === 'validating'),\n ns.is('success', validateState.value === 'success'),\n ns.is('required', isRequired.value || props.asterisk),\n ns.is('no-asterisk', formlayout.value?.hideRequiredAsterisk),\n ns.is(formlayout.value.feedbackLayout),\n formlayout.value?.requireAsteriskPosition === 'right'\n ? 'asterisk-right'\n : 'asterisk-left',\n {\n [ns.m('feedback')]: formlayout.value?.statusIcon,\n [ns.m(`label-${labelPosition.value}`)]: labelPosition.value,\n },\n])\n\nconst validateClasses = computed(() => [\n `${prefixCls}-feedback`,\n ns.is(props.feedbackStatus),\n ns.is('loose', formlayout.value.feedbackLayout === 'loose'),\n])\n\nconst hasLabel = computed<boolean>(() => {\n return (props.label !== '' && isValid(props.label)) || isValid(slots.label)\n})\n\nconst labelFor = computed<string | undefined>(() => {\n return (\n props.for || (inputIds.value.length === 1 ? inputIds.value[0] : undefined)\n )\n})\n\nconst isGroup = computed<boolean>(() => {\n return !labelFor.value && hasLabel.value\n})\n\nasync function validate(): FormValidationResult {\n return true\n}\n/* istanbul ignore next -- @preserve */\nconst clearValidate: FormItemContext['clearValidate'] = () => {}\n/* istanbul ignore next -- @preserve */\nconst resetField: FormItemContext['resetField'] = async () => {}\n\nconst addInputId: FormItemContext['addInputId'] = (id: string) => {\n /* istanbul ignore else -- @preserve */\n if (!inputIds.value.includes(id)) {\n inputIds.value.push(id)\n }\n}\n\nconst removeInputId: FormItemContext['removeInputId'] = (id: string) => {\n inputIds.value = inputIds.value.filter(listId => listId !== id)\n}\n\nconst isEllipsisActive = ref(false)\nuseResizeObserver(labelRef, () => {\n isEllipsisActive.value = labelRef.value?.scrollWidth > labelRef.value?.clientWidth\n})\nconst isEllipsis = computed(() => {\n return isEllipsisActive.value && !formlayout.value.labelWrap\n})\n\n// HACK computed无法监听到props.feedbackStatus的变化\nconst _validateState = ref<FormItemValidateState>('')\nconst context: FormItemContext = reactive({\n $el: formItemRef,\n labelWidth: formlayout.value?.labelWidth,\n size: formItemSize,\n validateState: _validateState.value,\n labelId,\n inputIds,\n isGroup,\n hasLabel,\n addInputId,\n removeInputId,\n resetField,\n clearValidate,\n validate,\n labelPosition,\n inlineMessage: true,\n showMessage: true,\n fieldValue: field.value?.value,\n validateMessage: '',\n propString: '',\n})\nwatch(() => props.feedbackStatus, (val) => {\n if (val === 'pending') {\n context.validateState = 'validating'\n return\n }\n if (val === 'warning') {\n context.validateState = ''\n return\n }\n context.validateState = val\n}, {\n immediate: true,\n})\n\nprovide(formLayoutShallowContext, ref({\n ...(isValid(formlayout.value.size) && { size: formlayout.value.size }),\n ...(isValid(formlayout.value.colon) && { colon: formlayout.value.colon }),\n}))\nprovide(formItemContextKey, context)\n</script>\n\n<template>\n <div\n ref=\"formItemRef\" :class=\"[prefixCls, formlayout.labelWrap && 'is-warp', ...formItemClasses]\"\n :role=\"isGroup ? 'group' : undefined\" :aria-labelledby=\"isGroup ? labelId : undefined\"\n >\n <component\n :is=\"labelFor ? 'label' : 'div'\" v-if=\"hasLabel\" :id=\"labelId\" :for=\"labelFor\"\n :class=\"[ns.e('label'), isValid(formlayout.labelCol) && `${prefixCls}-col-${formlayout.labelCol}`]\"\n :style=\"labelStyle\"\n >\n <!-- label -->\n <template v-if=\"isVNode(props.label)\">\n <component :is=\"props.label\" />\n </template>\n <div v-else :class=\"`${prefixCls}-label__wrapper`\">\n <ElTooltip :disabled=\"!isEllipsis && formlayout.tooltipLayout !== 'text'\">\n <span\n :class=\"{\n [`${prefixCls}-label-content`]: true,\n ['is-tooltip']: isEllipsis || (props.tooltip && formlayout.tooltipLayout === 'text'),\n }\"\n >\n <span ref=\"labelRef\">{{ props.label }}</span>\n </span>\n <template #content>\n <template v-if=\"isVNode(props.tooltip)\">\n <component :is=\"props.tooltip\" />\n </template>\n <div v-else :style=\"`width: ${labelRef?.clientWidth ?? 0}px;`\">\n <template v-if=\"isEllipsis\">\n {{ props.label }}\n </template>\n <template v-if=\"formlayout.tooltipLayout === 'text'\">\n {{ props.tooltip }}\n </template>\n </div>\n </template>\n </ElTooltip>\n <ElTooltip v-if=\"props.tooltip && formlayout.tooltipLayout !== 'text'\" :content=\"props.tooltip\">\n <ElIcon :class=\"`${prefixCls}-label-tooltip`\">\n <InfoFilled />\n </ElIcon>\n </ElTooltip>\n <span v-if=\"formlayout.colon\" :class=\"`${prefixCls}-colon`\">:</span>\n </div>\n </component>\n <!-- content -->\n <div\n :class=\"[\n `${prefixCls}-content__wrapper`,\n isValid(formlayout.wrapperCol) && `${prefixCls}-col-${formlayout.wrapperCol}`,\n ]\"\n :style=\"contentWrapperStyle\"\n >\n <template v-if=\"isValid(props.addonBefore)\">\n <template v-if=\"isVNode(props.addonBefore)\">\n <component :is=\"props.addonBefore\" />\n </template>\n <div v-else :class=\"`${prefixCls}-addon-before`\">\n {{ props.addonBefore }}\n </div>\n </template>\n <div\n :class=\"[\n ns.e('content'),\n formlayout.fullness && 'is-fullness',\n ns.is('addon-after', !!props.addonAfter),\n ]\" :style=\"contentStyle\"\n >\n <ElTooltip\n v-if=\"formlayout.feedbackLayout === 'popover'\"\n ref=\"feedbackTooltipRef\"\n :visible=\"!!props.feedbackText\"\n effect=\"light\"\n :offset=\"6\"\n >\n <template #default>\n <slot />\n </template>\n <template #content>\n <div :class=\"[...validateClasses, ns.is('tooltip')]\">\n <ElIcon>\n <CircleClose v-if=\"props.feedbackStatus === 'error'\" />\n <CircleCheck v-if=\"props.feedbackStatus === 'success'\" />\n <Warning v-if=\"props.feedbackStatus === 'warning'\" />\n </ElIcon>\n {{ props.feedbackText }}\n </div>\n </template>\n </ElTooltip>\n <slot v-else />\n <TransitionGroup :name=\"`${ns.namespace.value}-zoom-in-top`\">\n <div v-if=\"props.feedbackText && formlayout.feedbackLayout !== 'popover'\" :class=\"validateClasses\">\n {{ props.feedbackText }}\n </div>\n <template v-if=\"isValid(props.extra)\">\n <template v-if=\"isVNode(props.extra)\">\n <component :is=\"props.extra\" />\n </template>\n <div v-else :class=\"`${prefixCls}-extra`\">\n {{ props.extra }}\n </div>\n </template>\n </TransitionGroup>\n </div>\n <template v-if=\"isValid(props.addonAfter)\">\n <template v-if=\"isVNode(props.addonAfter)\">\n <component :is=\"props.addonAfter\" />\n </template>\n <div v-else :class=\"`${prefixCls}-addon-after`\">\n {{ props.addonAfter }}\n </div>\n </template>\n </div>\n </div>\n</template>\n","import { isVoidField } from '@formily/core'\nimport { connect, mapProps } from '@silver-formily/vue'\nimport { composeExport } from '../__builtins__'\nimport FormBaseItem from './form-item.vue'\nimport { determineFeedbackStatus, getFeedbackMessage } from './utils'\nimport './style.scss'\n\nexport function fieldFeedbackMapper(props, field) {\n if (isVoidField(field) || !field) {\n return props\n }\n\n const feedbackText = getFeedbackMessage(field)\n const feedbackStatus = determineFeedbackStatus(field)\n const asterisk = 'asterisk' in props\n ? props.asterisk\n : field.required && field.pattern !== 'readPretty'\n\n return {\n ...props,\n feedbackText,\n feedbackStatus,\n asterisk,\n }\n}\n\nconst Item = connect<typeof FormBaseItem>(\n FormBaseItem,\n mapProps(\n {\n validateStatus: true,\n title: 'label',\n required: true,\n description: 'extra',\n },\n fieldFeedbackMapper,\n ),\n)\n\nexport const FormItem = composeExport(Item, {\n BaseItem: FormBaseItem,\n})\n\nexport default FormItem\n\nexport { default as FormBaseItem } from './form-item.vue'\n"],"names":["SCOPE","addUnit","value","defaultUnit","isNumber","isStringNumber","isString","debugWarn","props","__props","slots","useSlots","ns","useNamespace","prefixCls","stylePrefix","formItemConfig","computed","pick","FORM_LAYOUT_PROPS_KEYS","_","isValid","formlayoutConfig","useFormLayout","formlayout","field","useField","inheritedSize","useFormSize","formItemSize","labelId","useId","inputIds","ref","validateState","formItemRef","labelRef","feedbackTooltipRef","__expose","labelPosition","isArr","labelStyle","labelWidth","contentStyle","contentWidth","contentWrapperStyle","isRequired","formItemClasses","validateClasses","hasLabel","labelFor","isGroup","validate","clearValidate","resetField","addInputId","id","removeInputId","listId","isEllipsisActive","useResizeObserver","isEllipsis","_validateState","context","reactive","watch","val","provide","formLayoutShallowContext","formItemContextKey","_createElementBlock","_unref","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","isVNode","_createVNode","ElTooltip","_normalizeStyle","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","ElIcon","InfoFilled","_renderSlot","_ctx","CircleClose","CircleCheck","Warning","_TransitionGroup","fieldFeedbackMapper","isVoidField","feedbackText","getFeedbackMessage","feedbackStatus","determineFeedbackStatus","asterisk","Item","connect","FormBaseItem","mapProps","FormItem","composeExport"],"mappings":";;;;;;;;;;;;;;;;AAMA,MAAMA,KAAQ;AAgDd,SAASC,EAAQC,GAAOC,IAAc,MAAM;AAC1C,MAAI,CAACD,KAASA,MAAU,EAAG,QAAO;AAClC,MAAIE,GAASF,CAAK,KAAKG,GAAeH,CAAK;AACzC,WAAO,GAAGA,CAAK,GAAGC,CAAW;AACxB,MAAIG,GAASJ,CAAK;AACvB,WAAOA;AAET,EAAAK,GAAUP,IAAO,0CAA0C;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACtCA,UAAMQ,IAAQC,GAMRC,IAAQC,GAAA,GACRC,IAAKC,GAAa,WAAW,GAC7BC,IAAY,GAAGC,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8D,EAEM,OAAA;AAAA;YAFO,YAAUxD,CAAS,cAAA;AAAA,UAAA,GAC3BoE,EAAA1E,EAAM,UAAU,GAAA,CAAA;AAAA,QAAA;;;;;AC5TtB,SAASoF,GAAoBpF,GAAOiB,GAAO;AAChD,MAAIoE,GAAYpE,CAAK,KAAK,CAACA;AACzB,WAAOjB;AAGT,QAAMsF,IAAeC,GAAmBtE,CAAK,GACvCuE,IAAiBC,GAAwBxE,CAAK,GAC9CyE,IAAW,cAAc1F,IAC3BA,EAAM,WACNiB,EAAM,YAAYA,EAAM,YAAY;AAExC,SAAO;AAAA,IACL,GAAGjB;AAAA,IACH,cAAAsF;AAAA,IACA,gBAAAE;AAAA,IACA,UAAAE;AAAA,EAAA;AAEJ;AAEA,MAAMC,KAAOC;AAAA,EACXC;AAAAA,EACAC;AAAA,IACE;AAAA,MACE,gBAAgB;AAAA,MAChB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAAA,IAEfV;AAAA,EAAA;AAEJ,GAEaW,KAAWC,GAAcL,IAAM;AAAA,EAC1C,UAAUE;AACZ,CAAC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.22_typescript@5.9.3_/node_modules/element-plus/es/utils/dom/style.mjs","../../src/form-item/form-item.vue","../../src/form-item/index.ts"],"sourcesContent":["import { isNumber, isStringNumber } from '../types.mjs';\nimport { isClient } from '@vueuse/core';\nimport { isString, camelize, isObject } from '@vue/shared';\nimport { entriesOf, keysOf } from '../objects.mjs';\nimport { debugWarn } from '../error.mjs';\n\nconst SCOPE = \"utils/dom/style\";\nconst classNameToArray = (cls = \"\") => cls.split(\" \").filter((item) => !!item.trim());\nconst hasClass = (el, cls) => {\n if (!el || !cls) return false;\n if (cls.includes(\" \")) throw new Error(\"className should not contain space.\");\n return el.classList.contains(cls);\n};\nconst addClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.add(...classNameToArray(cls));\n};\nconst removeClass = (el, cls) => {\n if (!el || !cls.trim()) return;\n el.classList.remove(...classNameToArray(cls));\n};\nconst getStyle = (element, styleName) => {\n var _a;\n if (!isClient || !element || !styleName) return \"\";\n let key = camelize(styleName);\n if (key === \"float\") key = \"cssFloat\";\n try {\n const style = element.style[key];\n if (style) return style;\n const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, \"\");\n return computed ? computed[key] : \"\";\n } catch (e) {\n return element.style[key];\n }\n};\nconst setStyle = (element, styleName, value) => {\n if (!element || !styleName) return;\n if (isObject(styleName)) {\n entriesOf(styleName).forEach(\n ([prop, value2]) => setStyle(element, prop, value2)\n );\n } else {\n const key = camelize(styleName);\n element.style[key] = value;\n }\n};\nconst removeStyle = (element, style) => {\n if (!element || !style) return;\n if (isObject(style)) {\n keysOf(style).forEach((prop) => removeStyle(element, prop));\n } else {\n setStyle(element, style, \"\");\n }\n};\nfunction addUnit(value, defaultUnit = \"px\") {\n if (!value && value !== 0) return \"\";\n if (isNumber(value) || isStringNumber(value)) {\n return `${value}${defaultUnit}`;\n } else if (isString(value)) {\n return value;\n }\n debugWarn(SCOPE, \"binding value must be a string or number\");\n}\n\nexport { addClass, addUnit, classNameToArray, getStyle, hasClass, removeClass, removeStyle, setStyle };\n//# sourceMappingURL=style.mjs.map\n","<script lang=\"ts\" setup>\r\nimport type { Field } from '@formily/core'\r\nimport type {\r\n FormItemContext,\r\n FormItemValidateState,\r\n FormValidationResult,\r\n TooltipInstance,\r\n} from 'element-plus'\r\nimport type { ICalculatedFormLayoutProps } from 'src/form-layout/types'\r\nimport type { CSSProperties } from 'vue'\r\nimport type { IFormItemProps } from './types'\r\nimport { CircleCheck, CircleClose, InfoFilled, Warning } from '@element-plus/icons-vue'\r\nimport { isArr, isValid } from '@formily/shared'\r\nimport { useField } from '@silver-formily/vue'\r\nimport { useResizeObserver } from '@vueuse/core'\r\nimport { ElIcon, ElTooltip, formItemContextKey, useFormSize, useId, useNamespace } from 'element-plus'\r\nimport { addUnit } from 'element-plus/es/utils/index'\r\nimport { pick } from 'lodash-es'\r\nimport { computed, isVNode, provide, reactive, ref, useSlots, watch } from 'vue'\r\nimport { stylePrefix } from '../__builtins__'\r\nimport { FORM_LAYOUT_PROPS_KEYS, formLayoutShallowContext, useFormLayout } from '../form-layout/utils'\r\n\r\ndefineOptions({\r\n name: 'FFormItem',\r\n})\r\nconst props = withDefaults(defineProps<IFormItemProps>(), {\r\n asterisk: undefined,\r\n colon: undefined,\r\n labelWrap: undefined,\r\n fullness: undefined,\r\n})\r\nconst slots = useSlots()\r\nconst ns = useNamespace('form-item')\r\nconst prefixCls = `${stylePrefix}-form-item`\r\nconst formItemConfig = computed<Partial<ICalculatedFormLayoutProps>>(() =>\r\n Object.fromEntries(\r\n Object.entries(pick(props, FORM_LAYOUT_PROPS_KEYS))\r\n .filter(([_, value]) => isValid(value)),\r\n ),\r\n)\r\nconst formlayoutConfig = useFormLayout()\r\nconst formlayout = computed(() => Object.assign({\r\n colon: true,\r\n feedbackLayout: 'loose',\r\n fullness: false,\r\n labelWrap: false,\r\n}, formlayoutConfig.value, formItemConfig.value))\r\nconst field = useField<Field>()\r\n\r\nconst inheritedSize = useFormSize(undefined, { formItem: false })\r\nconst formItemSize = computed(() => {\r\n if (isValid(formlayout.value.size)) {\r\n return formlayout.value.size\r\n }\r\n return inheritedSize.value\r\n})\r\n\r\nconst labelId = useId().value\r\nconst inputIds = ref<string[]>([])\r\n\r\nconst validateState = ref<FormItemValidateState>('')\r\nconst formItemRef = ref<HTMLDivElement>()\r\nconst labelRef = ref<HTMLElement>()\r\nconst feedbackTooltipRef = ref<TooltipInstance>()\r\ndefineExpose({\r\n feedbackTooltipRef,\r\n})\r\n\r\nconst labelPosition = computed(\r\n () => {\r\n if (formlayout.value.layout === 'vertical' || (isArr(formlayout.value.layout) && formlayout.value.layout.includes('vertical' as any))) {\r\n return 'top'\r\n }\r\n return formlayout.value.labelAlign ?? 'right'\r\n },\r\n)\r\n\r\nconst labelStyle = computed<CSSProperties>(() => {\r\n if (labelPosition.value === 'top') {\r\n return {}\r\n }\r\n\r\n const labelWidth = addUnit(formlayout.value.labelWidth || '')\r\n if (labelWidth)\r\n return { width: labelWidth }\r\n return {}\r\n})\r\n\r\nconst contentStyle = computed<CSSProperties>(() => {\r\n const contentWidth = addUnit(formlayout.value?.wrapperWidth || '')\r\n if (contentWidth)\r\n return { width: contentWidth, flex: 'unset' }\r\n return {}\r\n})\r\n\r\nconst contentWrapperStyle = computed<CSSProperties>(() => {\r\n return {\r\n justifyContent: formlayout.value?.wrapperAlign === 'right' && 'flex-end',\r\n }\r\n})\r\n\r\nconst isRequired = computed(() =>\r\n props.asterisk && field.value?.pattern !== 'readPretty',\r\n)\r\n\r\nconst formItemClasses = computed(() => [\r\n ns.b(),\r\n ns.m(formItemSize.value || 'default'),\r\n ns.is(props.feedbackStatus),\r\n ns.is('validating', validateState.value === 'validating'),\r\n ns.is('success', validateState.value === 'success'),\r\n ns.is('required', isRequired.value || props.asterisk),\r\n ns.is('no-asterisk', formlayout.value?.hideRequiredAsterisk),\r\n ns.is(formlayout.value.feedbackLayout),\r\n formlayout.value?.requireAsteriskPosition === 'right'\r\n ? 'asterisk-right'\r\n : 'asterisk-left',\r\n {\r\n [ns.m('feedback')]: formlayout.value?.statusIcon,\r\n [ns.m(`label-${labelPosition.value}`)]: labelPosition.value,\r\n },\r\n])\r\n\r\nconst validateClasses = computed(() => [\r\n `${prefixCls}-feedback`,\r\n ns.is(props.feedbackStatus),\r\n ns.is('loose', formlayout.value.feedbackLayout === 'loose'),\r\n])\r\n\r\nconst hasLabel = computed<boolean>(() => {\r\n return (props.label !== '' && isValid(props.label)) || isValid(slots.label)\r\n})\r\n\r\nconst labelFor = computed<string | undefined>(() => {\r\n return (\r\n props.for || (inputIds.value.length === 1 ? inputIds.value[0] : undefined)\r\n )\r\n})\r\n\r\nconst isGroup = computed<boolean>(() => {\r\n return !labelFor.value && hasLabel.value\r\n})\r\n\r\nasync function validate(): FormValidationResult {\r\n return true\r\n}\r\n/* istanbul ignore next -- @preserve */\r\nconst clearValidate: FormItemContext['clearValidate'] = () => {}\r\n/* istanbul ignore next -- @preserve */\r\nconst resetField: FormItemContext['resetField'] = async () => {}\r\n/* istanbul ignore next -- @preserve */\r\nconst setInitialValue: FormItemContext['setInitialValue'] = () => {}\r\n\r\nconst addInputId: FormItemContext['addInputId'] = (id: string) => {\r\n /* istanbul ignore else -- @preserve */\r\n if (!inputIds.value.includes(id)) {\r\n inputIds.value.push(id)\r\n }\r\n}\r\n\r\nconst removeInputId: FormItemContext['removeInputId'] = (id: string) => {\r\n inputIds.value = inputIds.value.filter(listId => listId !== id)\r\n}\r\n\r\nconst isEllipsisActive = ref(false)\r\nuseResizeObserver(labelRef, () => {\r\n isEllipsisActive.value = labelRef.value?.scrollWidth > labelRef.value?.clientWidth\r\n})\r\nconst isEllipsis = computed(() => {\r\n return isEllipsisActive.value && !formlayout.value.labelWrap\r\n})\r\n\r\n// HACK computed无法监听到props.feedbackStatus的变化\r\nconst _validateState = ref<FormItemValidateState>('')\r\nconst context: FormItemContext = reactive({\r\n $el: formItemRef,\r\n labelWidth: formlayout.value?.labelWidth,\r\n size: formItemSize,\r\n validateState: _validateState.value,\r\n labelId,\r\n inputIds,\r\n isGroup,\r\n hasLabel,\r\n addInputId,\r\n removeInputId,\r\n resetField,\r\n clearValidate,\r\n validate,\r\n labelPosition,\r\n inlineMessage: true,\r\n showMessage: true,\r\n fieldValue: field.value?.value,\r\n validateMessage: '',\r\n propString: '',\r\n setInitialValue,\r\n})\r\nwatch(() => props.feedbackStatus, (val) => {\r\n if (val === 'pending') {\r\n context.validateState = 'validating'\r\n return\r\n }\r\n if (val === 'warning') {\r\n context.validateState = ''\r\n return\r\n }\r\n context.validateState = val\r\n}, {\r\n immediate: true,\r\n})\r\n\r\nprovide(formLayoutShallowContext, ref({\r\n ...(isValid(formlayout.value.size) && { size: formlayout.value.size }),\r\n ...(isValid(formlayout.value.colon) && { colon: formlayout.value.colon }),\r\n}))\r\nprovide(formItemContextKey, context)\r\n</script>\r\n\r\n<template>\r\n <div\r\n ref=\"formItemRef\" :class=\"[prefixCls, formlayout.labelWrap && 'is-warp', ...formItemClasses]\"\r\n :role=\"isGroup ? 'group' : undefined\" :aria-labelledby=\"isGroup ? labelId : undefined\"\r\n >\r\n <component\r\n :is=\"labelFor ? 'label' : 'div'\" v-if=\"hasLabel\" :id=\"labelId\" :for=\"labelFor\"\r\n :class=\"[ns.e('label'), isValid(formlayout.labelCol) && `${prefixCls}-col-${formlayout.labelCol}`]\"\r\n :style=\"labelStyle\"\r\n >\r\n <!-- label -->\r\n <template v-if=\"isVNode(props.label)\">\r\n <component :is=\"props.label\" />\r\n </template>\r\n <div v-else :class=\"`${prefixCls}-label__wrapper`\">\r\n <ElTooltip :disabled=\"!isEllipsis && formlayout.tooltipLayout !== 'text'\">\r\n <span\r\n :class=\"{\r\n [`${prefixCls}-label-content`]: true,\r\n ['is-tooltip']: isEllipsis || (props.tooltip && formlayout.tooltipLayout === 'text'),\r\n }\"\r\n >\r\n <span ref=\"labelRef\">{{ props.label }}</span>\r\n </span>\r\n <template #content>\r\n <template v-if=\"isVNode(props.tooltip)\">\r\n <component :is=\"props.tooltip\" />\r\n </template>\r\n <div v-else :style=\"`width: ${labelRef?.clientWidth ?? 0}px;`\">\r\n <template v-if=\"isEllipsis\">\r\n {{ props.label }}\r\n </template>\r\n <template v-if=\"formlayout.tooltipLayout === 'text'\">\r\n {{ props.tooltip }}\r\n </template>\r\n </div>\r\n </template>\r\n </ElTooltip>\r\n <ElTooltip v-if=\"props.tooltip && formlayout.tooltipLayout !== 'text'\" :content=\"props.tooltip\">\r\n <ElIcon :class=\"`${prefixCls}-label-tooltip`\">\r\n <InfoFilled />\r\n </ElIcon>\r\n </ElTooltip>\r\n <span v-if=\"formlayout.colon\" :class=\"`${prefixCls}-colon`\">:</span>\r\n </div>\r\n </component>\r\n <!-- content -->\r\n <div\r\n :class=\"[\r\n `${prefixCls}-content__wrapper`,\r\n isValid(formlayout.wrapperCol) && `${prefixCls}-col-${formlayout.wrapperCol}`,\r\n ]\"\r\n :style=\"contentWrapperStyle\"\r\n >\r\n <template v-if=\"isValid(props.addonBefore)\">\r\n <template v-if=\"isVNode(props.addonBefore)\">\r\n <component :is=\"props.addonBefore\" />\r\n </template>\r\n <div v-else :class=\"`${prefixCls}-addon-before`\">\r\n {{ props.addonBefore }}\r\n </div>\r\n </template>\r\n <div\r\n :class=\"[\r\n ns.e('content'),\r\n formlayout.fullness && 'is-fullness',\r\n ns.is('addon-after', !!props.addonAfter),\r\n ]\" :style=\"contentStyle\"\r\n >\r\n <ElTooltip\r\n v-if=\"formlayout.feedbackLayout === 'popover'\"\r\n ref=\"feedbackTooltipRef\"\r\n :visible=\"!!props.feedbackText\"\r\n effect=\"light\"\r\n :offset=\"6\"\r\n >\r\n <template #default>\r\n <slot />\r\n </template>\r\n <template #content>\r\n <div :class=\"[...validateClasses, ns.is('tooltip')]\">\r\n <ElIcon>\r\n <CircleClose v-if=\"props.feedbackStatus === 'error'\" />\r\n <CircleCheck v-if=\"props.feedbackStatus === 'success'\" />\r\n <Warning v-if=\"props.feedbackStatus === 'warning'\" />\r\n </ElIcon>\r\n {{ props.feedbackText }}\r\n </div>\r\n </template>\r\n </ElTooltip>\r\n <slot v-else />\r\n <TransitionGroup :name=\"`${ns.namespace.value}-zoom-in-top`\">\r\n <div v-if=\"props.feedbackText && formlayout.feedbackLayout !== 'popover'\" :class=\"validateClasses\">\r\n {{ props.feedbackText }}\r\n </div>\r\n <template v-if=\"isValid(props.extra)\">\r\n <template v-if=\"isVNode(props.extra)\">\r\n <component :is=\"props.extra\" />\r\n </template>\r\n <div v-else :class=\"`${prefixCls}-extra`\">\r\n {{ props.extra }}\r\n </div>\r\n </template>\r\n </TransitionGroup>\r\n </div>\r\n <template v-if=\"isValid(props.addonAfter)\">\r\n <template v-if=\"isVNode(props.addonAfter)\">\r\n <component :is=\"props.addonAfter\" />\r\n </template>\r\n <div v-else :class=\"`${prefixCls}-addon-after`\">\r\n {{ props.addonAfter }}\r\n </div>\r\n </template>\r\n </div>\r\n </div>\r\n</template>\r\n","import { isVoidField } from '@formily/core'\r\nimport { connect, mapProps } from '@silver-formily/vue'\r\nimport { composeExport } from '../__builtins__'\r\nimport FormBaseItem from './form-item.vue'\r\nimport { determineFeedbackStatus, getFeedbackMessage } from './utils'\r\nimport './style.scss'\r\n\r\nexport function fieldFeedbackMapper(props, field) {\r\n if (isVoidField(field) || !field) {\r\n return props\r\n }\r\n\r\n const feedbackText = getFeedbackMessage(field)\r\n const feedbackStatus = determineFeedbackStatus(field)\r\n const asterisk = 'asterisk' in props\r\n ? props.asterisk\r\n : field.required && field.pattern !== 'readPretty'\r\n\r\n return {\r\n ...props,\r\n feedbackText,\r\n feedbackStatus,\r\n asterisk,\r\n }\r\n}\r\n\r\nconst Item = connect<typeof FormBaseItem>(\r\n FormBaseItem,\r\n mapProps(\r\n {\r\n validateStatus: true,\r\n title: 'label',\r\n required: true,\r\n description: 'extra',\r\n },\r\n fieldFeedbackMapper,\r\n ),\r\n)\r\n\r\nexport const FormItem = composeExport(Item, {\r\n BaseItem: FormBaseItem,\r\n})\r\n\r\nexport default FormItem\r\n\r\nexport { default as FormBaseItem } from './form-item.vue'\r\n"],"names":["SCOPE","addUnit","value","defaultUnit","isNumber","isStringNumber","isString","debugWarn","props","__props","slots","useSlots","ns","useNamespace","prefixCls","stylePrefix","formItemConfig","computed","pick","FORM_LAYOUT_PROPS_KEYS","_","isValid","formlayoutConfig","useFormLayout","formlayout","field","useField","inheritedSize","useFormSize","formItemSize","labelId","useId","inputIds","ref","validateState","formItemRef","labelRef","feedbackTooltipRef","__expose","labelPosition","isArr","labelStyle","labelWidth","contentStyle","contentWidth","contentWrapperStyle","isRequired","formItemClasses","validateClasses","hasLabel","labelFor","isGroup","validate","clearValidate","resetField","setInitialValue","addInputId","id","removeInputId","listId","isEllipsisActive","useResizeObserver","isEllipsis","_validateState","context","reactive","watch","val","provide","formLayoutShallowContext","formItemContextKey","_createElementBlock","_unref","_openBlock","_createBlock","_resolveDynamicComponent","_normalizeClass","isVNode","_createVNode","ElTooltip","_normalizeStyle","_Fragment","_createTextVNode","_toDisplayString","_createElementVNode","ElIcon","InfoFilled","_renderSlot","_ctx","CircleClose","CircleCheck","Warning","_TransitionGroup","fieldFeedbackMapper","isVoidField","feedbackText","getFeedbackMessage","feedbackStatus","determineFeedbackStatus","asterisk","Item","connect","FormBaseItem","mapProps","FormItem","composeExport"],"mappings":";;;;;;;;;;;;;;AAMA,MAAMA,KAAQ;AAgDd,SAASC,EAAQC,GAAOC,IAAc,MAAM;AAC1C,MAAI,CAACD,KAASA,MAAU,EAAG,QAAO;AAClC,MAAIE,GAASF,CAAK,KAAKG,GAAeH,CAAK;AACzC,WAAO,GAAGA,CAAK,GAAGC,CAAW;AACxB,MAAIG,GAASJ,CAAK;AACvB,WAAOA;AAET,EAAAK,GAAUP,IAAO,0CAA0C;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrCA,UAAMQ,IAAQC,GAMRC,IAAQC,GAAA,GACRC,IAAKC,GAAa,WAAW,GAC7BC,IAAY,GAAGC,EAAW,cAC1BC,IAAiBC;AAAA,MAA8C,MACnE,OAAO;AAAA,QACL,OAAO,QAAQC,GAAKV,GAAOW,EAAsB,CAAC,EAC/C,OAAO,CAAC,CAACC,GAAGlB,CAAK,MAAMmB,EAAQnB,CAAK,CAAC;AAAA,MAAA;AAAA,IAC1C,GAEIoB,IAAmBC,GAAA,GACnBC,IAAaP,EAAS,MAAM,OAAO,OAAO;AAAA,MAC9C,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,WAAW;AAAA,IAAA,GACVK,EAAiB,OAAON,EAAe,KAAK,CAAC,GAC1CS,IAAQC,GAAA,GAERC,IAAgBC,GAAY,QAAW,EAAE,UAAU,IAAO,GAC1DC,IAAeZ,EAAS,MAC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H,cAAAuF;AAAA,IACA,gBAAAE;AAAA,IACA,UAAAE;AAAA,EAAA;AAEJ;AAEA,MAAMC,KAAOC;AAAA,EACXC;AAAAA,EACAC;AAAA,IACE;AAAA,MACE,gBAAgB;AAAA,MAChB,OAAO;AAAA,MACP,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAAA,IAEfV;AAAA,EAAA;AAEJ,GAEaW,KAAWC,GAAcL,IAAM;AAAA,EAC1C,UAAUE;AACZ,CAAC;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-item/utils.ts"],"sourcesContent":["import type { Field } from '@formily/core'\nimport { isArr } from '@formily/shared'\n\nexport function getFeedbackMessage(field: Field) {\n const messages = {\n errors: field.selfErrors.join(', '),\n warnings: field.selfWarnings.join(', '),\n successes: field.selfSuccesses.join(', '),\n }\n\n return messages.errors || messages.warnings || messages.successes\n}\n\nexport function determineFeedbackStatus(field: Field) {\n return isArr(field.decorator)\n ? (field.decorator[1]?.feedbackStatus ?? field.validateStatus)\n : field.validateStatus\n}\n"],"names":["getFeedbackMessage","field","messages","determineFeedbackStatus","isArr"],"mappings":";AAGO,SAASA,EAAmBC,GAAc;AAC/C,QAAMC,IAAW;AAAA,IACf,QAAQD,EAAM,WAAW,KAAK,IAAI;AAAA,IAClC,UAAUA,EAAM,aAAa,KAAK,IAAI;AAAA,IACtC,WAAWA,EAAM,cAAc,KAAK,IAAI;AAAA,EAAA;AAG1C,SAAOC,EAAS,UAAUA,EAAS,YAAYA,EAAS;AAC1D;AAEO,SAASC,EAAwBF,GAAc;AACpD,SAAOG,EAAMH,EAAM,SAAS,IACvBA,EAAM,UAAU,CAAC,GAAG,kBAAkBA,EAAM,iBAC7CA,EAAM;AACZ;"}
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-item/utils.ts"],"sourcesContent":["import type { Field } from '@formily/core'\r\nimport { isArr } from '@formily/shared'\r\n\r\nexport function getFeedbackMessage(field: Field) {\r\n const messages = {\r\n errors: field.selfErrors.join(', '),\r\n warnings: field.selfWarnings.join(', '),\r\n successes: field.selfSuccesses.join(', '),\r\n }\r\n\r\n return messages.errors || messages.warnings || messages.successes\r\n}\r\n\r\nexport function determineFeedbackStatus(field: Field) {\r\n return isArr(field.decorator)\r\n ? (field.decorator[1]?.feedbackStatus ?? field.validateStatus)\r\n : field.validateStatus\r\n}\r\n"],"names":["getFeedbackMessage","field","messages","determineFeedbackStatus","isArr"],"mappings":";AAGO,SAASA,EAAmBC,GAAc;AAC/C,QAAMC,IAAW;AAAA,IACf,QAAQD,EAAM,WAAW,KAAK,IAAI;AAAA,IAClC,UAAUA,EAAM,aAAa,KAAK,IAAI;AAAA,IACtC,WAAWA,EAAM,cAAc,KAAK,IAAI;AAAA,EAAA;AAG1C,SAAOC,EAAS,UAAUA,EAAS,YAAYA,EAAS;AAC1D;AAEO,SAASC,EAAwBF,GAAc;AACpD,SAAOG,EAAMH,EAAM,SAAS,IACvBA,EAAM,UAAU,CAAC,GAAG,kBAAkBA,EAAM,iBAC7CA,EAAM;AACZ;"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { defineComponent as A, ref as l, computed as d, provide as e, watch as x, reactive as B, toRef as t, createBlock as P, openBlock as g, resolveDynamicComponent as I, mergeProps as b, unref as F, withModifiers as R, withCtx as _, renderSlot as q } from "vue";
|
|
2
2
|
import { isValid as z, isEmpty as D } from "@formily/shared";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
import "@silver-formily/vue";
|
|
10
|
-
import { useCleanAttrs as $ } from "../__builtins__/shared/utils.mjs";
|
|
11
|
-
import { formLayoutIdContext as H, useFormDeepLayout as V, useResponsiveFormLayout as E, filterValidFormLayoutProps as r, formLayoutDeepContext as K, formLayoutShallowContext as j } from "./utils.mjs";
|
|
12
|
-
const to = /* @__PURE__ */ A({
|
|
3
|
+
import { useThrottleFn as T } from "@vueuse/core";
|
|
4
|
+
import { useId as M, formContextKey as S } from "element-plus";
|
|
5
|
+
import { formLayoutIdContext as W, useFormDeepLayout as $, useResponsiveFormLayout as H, filterValidFormLayoutProps as r, formLayoutDeepContext as V, formLayoutShallowContext as E } from "./utils.mjs";
|
|
6
|
+
import { useCleanAttrs as K } from "../__builtins__/shared/utils.mjs";
|
|
7
|
+
import { stylePrefix as j } from "../__builtins__/configs/index.mjs";
|
|
8
|
+
const Y = /* @__PURE__ */ A({
|
|
13
9
|
name: "FFormLayout",
|
|
14
10
|
inheritAttrs: !1,
|
|
15
11
|
__name: "form-layout",
|
|
@@ -35,19 +31,19 @@ const to = /* @__PURE__ */ A({
|
|
|
35
31
|
requireAsteriskPosition: {}
|
|
36
32
|
},
|
|
37
33
|
setup(c) {
|
|
38
|
-
const o = c, y = `${
|
|
39
|
-
u && e(
|
|
40
|
-
const h =
|
|
34
|
+
const o = c, y = `${j}-form`, { props: s } = K(), n = l(), u = o.tag === "form", v = M(), p = d(() => s.value.id ?? `formily-${v.value}`), L = d(() => u ? p.value : s.value.id);
|
|
35
|
+
u && e(W, p);
|
|
36
|
+
const h = $(), { props: a } = H(o, n), C = l({
|
|
41
37
|
...h.value,
|
|
42
38
|
...o.shallow ? {
|
|
43
39
|
size: o.size,
|
|
44
40
|
...z(o.colon) && { colon: o.colon }
|
|
45
41
|
} : r(o)
|
|
46
42
|
});
|
|
47
|
-
e(
|
|
43
|
+
e(V, C);
|
|
48
44
|
const f = l(o.shallow ? r(o) : {});
|
|
49
|
-
e(
|
|
50
|
-
const k =
|
|
45
|
+
e(E, f);
|
|
46
|
+
const k = T(() => {
|
|
51
47
|
if (!D(a.value)) {
|
|
52
48
|
const i = r(a.value);
|
|
53
49
|
f.value = r({ ...o, ...i });
|
|
@@ -63,7 +59,7 @@ const to = /* @__PURE__ */ A({
|
|
|
63
59
|
hideRequiredAsterisk: t(o, "hideRequiredAsterisk"),
|
|
64
60
|
requireAsteriskPosition: t(o, "requireAsteriskPosition")
|
|
65
61
|
});
|
|
66
|
-
return e(
|
|
62
|
+
return e(S, w), (i, m) => (g(), P(I(o.tag), b({
|
|
67
63
|
id: L.value,
|
|
68
64
|
ref_key: "rootHTMLRef",
|
|
69
65
|
ref: n,
|
|
@@ -80,6 +76,6 @@ const to = /* @__PURE__ */ A({
|
|
|
80
76
|
}
|
|
81
77
|
});
|
|
82
78
|
export {
|
|
83
|
-
|
|
79
|
+
Y as _
|
|
84
80
|
};
|
|
85
81
|
//# sourceMappingURL=form-layout.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { FormContext } from 'element-plus'\nimport type { IFormLayoutProps } from './types'\nimport { isEmpty, isValid } from '@formily/shared'\nimport { formContextKey, useId } from 'element-plus'\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs
|
|
1
|
+
{"version":3,"file":"form-layout.mjs","sources":["../../src/form-layout/form-layout.vue"],"sourcesContent":["<script lang=\"ts\" setup>\r\nimport type { FormContext } from 'element-plus'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isEmpty, isValid } from '@formily/shared'\r\nimport { useThrottleFn } from '@vueuse/core'\r\nimport { formContextKey, useId } from 'element-plus'\r\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\r\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\r\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\r\n\r\ndefineOptions({\r\n name: 'FFormLayout',\r\n inheritAttrs: false,\r\n})\r\n\r\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\r\n tag: 'form',\r\n colon: undefined,\r\n labelWrap: undefined,\r\n fullness: undefined,\r\n size: 'default',\r\n layout: 'horizontal',\r\n shallow: true,\r\n statusIcon: true,\r\n asterisk: undefined,\r\n})\r\nconst formPrefixCls = `${stylePrefix}-form`\r\nconst { props: attrs } = useCleanAttrs()\r\nconst rootHTMLRef = ref<HTMLElement>()\r\nconst isFormTag = props.tag === 'form'\r\nconst formLayoutBaseId = useId()\r\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\r\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\r\nif (isFormTag) {\r\n provide(formLayoutIdContext, formLayoutId)\r\n}\r\n\r\nconst formLayoutDeepConfig = useFormDeepLayout()\r\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\r\n\r\nconst deepLayout = ref({\r\n ...formLayoutDeepConfig.value,\r\n ...(props.shallow\r\n ? {\r\n size: props.size,\r\n ...(isValid(props.colon) && { colon: props.colon }),\r\n }\r\n : filterValidFormLayoutProps(props)),\r\n})\r\nprovide(formLayoutDeepContext, deepLayout)\r\n\r\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\r\nprovide(formLayoutShallowContext, shallowLayout)\r\n\r\nconst updateLayout = useThrottleFn(() => {\r\n if (!isEmpty(responsiveProps.value)) {\r\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\r\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\r\n }\r\n}, 200, true)\r\n\r\nwatch(() => [props, responsiveProps], updateLayout, {\r\n deep: true,\r\n immediate: true,\r\n})\r\n\r\nconst formContext = reactive({\r\n size: toRef(props, 'size'),\r\n statusIcon: toRef(props, 'statusIcon'),\r\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\r\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\r\n})\r\nprovide(formContextKey, formContext as FormContext)\r\n</script>\r\n\r\n<template>\r\n <component\r\n :is=\"props.tag\"\r\n :id=\"formLayoutDomId\"\r\n ref=\"rootHTMLRef\"\r\n :class=\"formPrefixCls\"\r\n v-bind=\"attrs\"\r\n @submit.prevent.stop\r\n >\r\n <slot />\r\n </component>\r\n</template>\r\n"],"names":["props","__props","formPrefixCls","stylePrefix","attrs","useCleanAttrs","rootHTMLRef","ref","isFormTag","formLayoutBaseId","useId","formLayoutId","computed","formLayoutDomId","provide","formLayoutIdContext","formLayoutDeepConfig","useFormDeepLayout","responsiveProps","useResponsiveFormLayout","deepLayout","isValid","filterValidFormLayoutProps","formLayoutDeepContext","shallowLayout","formLayoutShallowContext","updateLayout","useThrottleFn","isEmpty","_responsiveProps","watch","formContext","reactive","toRef","formContextKey","_openBlock","_createBlock","_resolveDynamicComponent","_mergeProps","_unref","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,UAAMA,IAAQC,GAWRC,IAAgB,GAAGC,CAAW,SAC9B,EAAE,OAAOC,EAAA,IAAUC,EAAA,GACnBC,IAAcC,EAAA,GACdC,IAAYR,EAAM,QAAQ,QAC1BS,IAAmBC,EAAA,GACnBC,IAAeC,EAAS,MAAMR,EAAM,MAAM,MAAM,WAAWK,EAAiB,KAAK,EAAE,GACnFI,IAAkBD,EAAS,MAAOJ,IAAYG,EAAa,QAAQP,EAAM,MAAM,EAAG;AACxF,IAAII,KACFM,EAAQC,GAAqBJ,CAAY;AAG3C,UAAMK,IAAuBC,EAAA,GACvB,EAAE,OAAOC,EAAA,IAAoBC,EAAwBnB,GAAOM,CAAW,GAEvEc,IAAab,EAAI;AAAA,MACrB,GAAGS,EAAqB;AAAA,MACxB,GAAIhB,EAAM,UACN;AAAA,QACE,MAAMA,EAAM;AAAA,QACZ,GAAIqB,EAAQrB,EAAM,KAAK,KAAK,EAAE,OAAOA,EAAM,MAAA;AAAA,MAAM,IAEnDsB,EAA2BtB,CAAK;AAAA,IAAA,CACrC;AACD,IAAAc,EAAQS,GAAuBH,CAAU;AAEzC,UAAMI,IAAgBjB,EAAIP,EAAM,UAAUsB,EAA2BtB,CAAK,IAAI,EAAE;AAChF,IAAAc,EAAQW,GAA0BD,CAAa;AAE/C,UAAME,IAAeC,EAAc,MAAM;AACvC,UAAI,CAACC,EAAQV,EAAgB,KAAK,GAAG;AACnC,cAAMW,IAAmBP,EAA2BJ,EAAgB,KAAK;AACzE,QAAAM,EAAc,QAAQF,EAA2B,EAAE,GAAGtB,GAAO,GAAG6B,GAAkB;AAAA,MACpF;AAAA,IACF,GAAG,KAAK,EAAI;AAEZ,IAAAC,EAAM,MAAM,CAAC9B,GAAOkB,CAAe,GAAGQ,GAAc;AAAA,MAClD,MAAM;AAAA,MACN,WAAW;AAAA,IAAA,CACZ;AAED,UAAMK,IAAcC,EAAS;AAAA,MAC3B,MAAMC,EAAMjC,GAAO,MAAM;AAAA,MACzB,YAAYiC,EAAMjC,GAAO,YAAY;AAAA,MACrC,sBAAsBiC,EAAMjC,GAAO,sBAAsB;AAAA,MACzD,yBAAyBiC,EAAMjC,GAAO,yBAAyB;AAAA,IAAA,CAChE;AACD,WAAAc,EAAQoB,GAAgBH,CAA0B,cAIhDI,KAAAC,EASYC,EARLrC,EAAM,GAAG,GADhBsC,EASY;AAAA,MAPT,IAAIzB,EAAA;AAAA,eACD;AAAA,MAAJ,KAAIP;AAAA,MACH,OAAOJ;AAAA,IAAA,GACAqC,EAAAnC,CAAA,GAAK;AAAA,MACZ,4BAAD,MAAA;AAAA,MAAA,GAAoB,CAAA,WAAA,MAAA,CAAA;AAAA,IAAA;iBAEpB,MAAQ;AAAA,QAARoC,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { isArr as d, isValid as u } from "@formily/shared";
|
|
2
|
+
import { useResizeObserver as h } from "@vueuse/core";
|
|
2
3
|
import { inject as l, ref as i, computed as s } from "vue";
|
|
3
|
-
import { useResizeObserver as h } from "../__builtins__/shared/hooks.mjs";
|
|
4
|
-
import "element-plus";
|
|
5
|
-
import "@formily/reactive";
|
|
6
|
-
import "@formily/core";
|
|
7
|
-
import "@silver-formily/reactive-vue";
|
|
8
|
-
import "@silver-formily/vue";
|
|
9
4
|
function A(t, o) {
|
|
10
5
|
for (const [r, e] of t.entries())
|
|
11
6
|
if (o <= e)
|
|
@@ -24,7 +19,7 @@ function a(t, o) {
|
|
|
24
19
|
function x(t, o) {
|
|
25
20
|
const { clientWidth: r } = t, {
|
|
26
21
|
breakpoints: e,
|
|
27
|
-
layout:
|
|
22
|
+
layout: p,
|
|
28
23
|
labelAlign: f,
|
|
29
24
|
wrapperAlign: m,
|
|
30
25
|
labelCol: y,
|
|
@@ -35,7 +30,7 @@ function x(t, o) {
|
|
|
35
30
|
r
|
|
36
31
|
);
|
|
37
32
|
return {
|
|
38
|
-
layout: a(
|
|
33
|
+
layout: a(p, n),
|
|
39
34
|
labelAlign: a(f, n),
|
|
40
35
|
wrapperAlign: a(m, n),
|
|
41
36
|
labelCol: a(y, n),
|
|
@@ -43,7 +38,7 @@ function x(t, o) {
|
|
|
43
38
|
...L
|
|
44
39
|
};
|
|
45
40
|
}
|
|
46
|
-
function
|
|
41
|
+
function P(t, o) {
|
|
47
42
|
const { breakpoints: r } = t;
|
|
48
43
|
if (!d(r))
|
|
49
44
|
return {
|
|
@@ -56,23 +51,23 @@ function _(t, o) {
|
|
|
56
51
|
props: e
|
|
57
52
|
};
|
|
58
53
|
}
|
|
59
|
-
const
|
|
54
|
+
const c = Symbol(
|
|
60
55
|
"formLayoutDeepContext"
|
|
61
56
|
), w = Symbol("formLayoutShallowContext"), k = Symbol("formLayoutIdContext");
|
|
62
|
-
function
|
|
63
|
-
return l(
|
|
57
|
+
function S() {
|
|
58
|
+
return l(c, i({}));
|
|
64
59
|
}
|
|
65
|
-
function
|
|
66
|
-
const t = l(w, i({})), o = l(
|
|
60
|
+
function O() {
|
|
61
|
+
const t = l(w, i({})), o = l(c, i({}));
|
|
67
62
|
return s(() => ({
|
|
68
63
|
...o.value,
|
|
69
64
|
...t.value
|
|
70
65
|
}));
|
|
71
66
|
}
|
|
72
|
-
function
|
|
67
|
+
function R() {
|
|
73
68
|
return l(k, s(() => ""));
|
|
74
69
|
}
|
|
75
|
-
const
|
|
70
|
+
const W = [
|
|
76
71
|
"colon",
|
|
77
72
|
"labelAlign",
|
|
78
73
|
"wrapperAlign",
|
|
@@ -91,24 +86,24 @@ const q = [
|
|
|
91
86
|
"statusIcon",
|
|
92
87
|
"requireAsteriskPosition"
|
|
93
88
|
];
|
|
94
|
-
function
|
|
89
|
+
function _(t) {
|
|
95
90
|
return Object.fromEntries(
|
|
96
91
|
Object.entries(t).filter(([o, r]) => u(r))
|
|
97
92
|
);
|
|
98
93
|
}
|
|
99
94
|
export {
|
|
100
|
-
|
|
95
|
+
W as FORM_LAYOUT_PROPS_KEYS,
|
|
101
96
|
A as calcBreakpointIndex,
|
|
102
97
|
C as calcFactor,
|
|
103
98
|
x as calculateProps,
|
|
104
99
|
a as factor,
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
_ as filterValidFormLayoutProps,
|
|
101
|
+
c as formLayoutDeepContext,
|
|
107
102
|
k as formLayoutIdContext,
|
|
108
103
|
w as formLayoutShallowContext,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
S as useFormDeepLayout,
|
|
105
|
+
O as useFormLayout,
|
|
106
|
+
R as useFormLayoutId,
|
|
107
|
+
P as useResponsiveFormLayout
|
|
113
108
|
};
|
|
114
109
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\nimport type { IFormLayoutProps } from './types'\nimport { isArr, isValid } from '@formily/shared'\nimport {
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\r\nimport type { IFormLayoutProps } from './types'\r\nimport { isArr, isValid } from '@formily/shared'\r\nimport { useResizeObserver } from '@vueuse/core'\r\nimport { computed, inject, ref } from 'vue'\r\n\r\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\r\n for (const [i, breakpoint] of breakpoints.entries()) {\r\n if (width <= breakpoint) {\r\n return i\r\n }\r\n }\r\n return -1\r\n}\r\n\r\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\r\n if (!Array.isArray(value) || value.length === 0) {\r\n return value as T\r\n }\r\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\r\n return value.at(safeIndex)\r\n}\r\n\r\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\r\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\r\n}\r\n\r\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\r\n const { clientWidth } = target\r\n const {\r\n breakpoints,\r\n layout,\r\n labelAlign,\r\n wrapperAlign,\r\n labelCol,\r\n wrapperCol,\r\n ...otherProps\r\n } = props\r\n const breakpointIndex = calcBreakpointIndex(\r\n breakpoints as number[],\r\n clientWidth,\r\n )\r\n\r\n return {\r\n layout: factor(layout, breakpointIndex),\r\n labelAlign: factor(labelAlign, breakpointIndex),\r\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\r\n labelCol: factor(labelCol, breakpointIndex),\r\n wrapperCol: factor(wrapperCol, breakpointIndex),\r\n ...otherProps,\r\n }\r\n}\r\n\r\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\r\n const { breakpoints } = props\r\n if (!isArr(breakpoints)) {\r\n return {\r\n props: ref(props),\r\n }\r\n }\r\n\r\n const layoutProps = ref<IFormLayoutProps>({})\r\n\r\n useResizeObserver(root, () => {\r\n layoutProps.value = calculateProps(root.value, props)\r\n })\r\n\r\n return {\r\n props: layoutProps,\r\n }\r\n}\r\n\r\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\r\n 'formLayoutDeepContext',\r\n)\r\n\r\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\r\n = Symbol('formLayoutShallowContext')\r\n\r\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\r\n = Symbol('formLayoutIdContext')\r\n\r\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\r\n return inject(formLayoutDeepContext, ref({}))\r\n}\r\n\r\nexport function useFormLayout(): Ref<IFormLayoutProps> {\r\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\r\n const deepLayout = inject(formLayoutDeepContext, ref({}))\r\n\r\n const formLayout = computed(() => {\r\n return {\r\n ...deepLayout.value,\r\n ...shallowLayout.value,\r\n }\r\n })\r\n\r\n return formLayout\r\n}\r\n\r\nexport function useFormLayoutId(): ComputedRef<string> {\r\n return inject(formLayoutIdContext, computed(() => ''))\r\n}\r\n\r\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\r\n 'colon',\r\n 'labelAlign',\r\n 'wrapperAlign',\r\n 'labelWrap',\r\n 'labelWidth',\r\n 'wrapperWidth',\r\n 'labelCol',\r\n 'wrapperCol',\r\n 'fullness',\r\n 'size',\r\n 'layout',\r\n 'feedbackLayout',\r\n 'tooltipLayout',\r\n 'breakpoints',\r\n 'hideRequiredAsterisk',\r\n 'statusIcon',\r\n 'requireAsteriskPosition',\r\n] as const\r\n\r\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\r\n return Object.fromEntries(\r\n Object.entries(props)\r\n .filter(([_, value]) => isValid(value)),\r\n )\r\n}\r\n"],"names":["calcBreakpointIndex","breakpoints","width","i","breakpoint","calcFactor","value","breakpointIndex","safeIndex","factor","isValid","calculateProps","target","props","clientWidth","layout","labelAlign","wrapperAlign","labelCol","wrapperCol","otherProps","useResponsiveFormLayout","root","isArr","ref","layoutProps","useResizeObserver","formLayoutDeepContext","formLayoutShallowContext","formLayoutIdContext","useFormDeepLayout","inject","useFormLayout","shallowLayout","deepLayout","computed","useFormLayoutId","FORM_LAYOUT_PROPS_KEYS","filterValidFormLayoutProps","_"],"mappings":";;;AAMO,SAASA,EAAoBC,GAAuBC,GAAuB;AAChF,aAAW,CAACC,GAAGC,CAAU,KAAKH,EAAY;AACxC,QAAIC,KAASE;AACX,aAAOD;AAGX,SAAO;AACT;AAEO,SAASE,EAAcC,GAAyBC,GAA4B;AACjF,MAAI,CAAC,MAAM,QAAQD,CAAK,KAAKA,EAAM,WAAW;AAC5C,WAAOA;AAET,QAAME,IAAY,KAAK,IAAI,IAAI,KAAK,IAAID,GAAiBD,EAAM,SAAS,CAAC,CAAC;AAC1E,SAAOA,EAAM,GAAGE,CAAS;AAC3B;AAEO,SAASC,EAAUH,GAAgBC,GAA4B;AACpE,SAAOG,EAAQJ,CAAK,IAAID,EAAcC,GAAOC,CAAe,IAAID;AAClE;AAEO,SAASK,EAAeC,GAAiBC,GAA2C;AACzF,QAAM,EAAE,aAAAC,MAAgBF,GAClB;AAAA,IACJ,aAAAX;AAAA,IACA,QAAAc;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDP,GACEN,IAAkBP;AAAA,IACtBC;AAAA,IACAa;AAAA,EAAA;AAGF,SAAO;AAAA,IACL,QAAQL,EAAOM,GAAQR,CAAe;AAAA,IACtC,YAAYE,EAAOO,GAAYT,CAAe;AAAA,IAC9C,cAAcE,EAAOQ,GAAcV,CAAe;AAAA,IAClD,UAAUE,EAAOS,GAAUX,CAAe;AAAA,IAC1C,YAAYE,EAAOU,GAAYZ,CAAe;AAAA,IAC9C,GAAGa;AAAA,EAAA;AAEP;AAEO,SAASC,EAAwBR,GAAyBS,GAA+B;AAC9F,QAAM,EAAE,aAAArB,MAAgBY;AACxB,MAAI,CAACU,EAAMtB,CAAW;AACpB,WAAO;AAAA,MACL,OAAOuB,EAAIX,CAAK;AAAA,IAAA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