@silver-formily/element-plus 3.0.0 → 3.0.1
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/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 +18 -18
- 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.mjs.map +1 -1
- package/esm/__builtins__/shared/utils.mjs.map +1 -1
- package/esm/array-base/index.mjs +63 -59
- package/esm/array-base/index.mjs.map +1 -1
- package/esm/array-base/symbols.mjs.map +1 -1
- package/esm/array-base/utils.mjs +37 -31
- package/esm/array-base/utils.mjs.map +1 -1
- package/esm/array-cards/index.mjs +36 -33
- package/esm/array-cards/index.mjs.map +1 -1
- package/esm/array-collapse/index.mjs +39 -37
- package/esm/array-collapse/index.mjs.map +1 -1
- package/esm/array-collapse/utils.mjs +9 -2
- package/esm/array-collapse/utils.mjs.map +1 -1
- package/esm/array-items/index.mjs +38 -34
- package/esm/array-items/index.mjs.map +1 -1
- package/esm/array-list-tabs/index.mjs +38 -36
- package/esm/array-list-tabs/index.mjs.map +1 -1
- package/esm/array-list-tabs/utils.mjs +12 -5
- package/esm/array-list-tabs/utils.mjs.map +1 -1
- package/esm/array-table/index.mjs +62 -60
- package/esm/array-table/index.mjs.map +1 -1
- package/esm/array-table/utils.mjs +18 -11
- package/esm/array-table/utils.mjs.map +1 -1
- package/esm/array-tabs/index.mjs +28 -25
- package/esm/array-tabs/index.mjs.map +1 -1
- package/esm/autocomplete/index.mjs +22 -18
- package/esm/autocomplete/index.mjs.map +1 -1
- package/esm/cascader/index.mjs +22 -18
- package/esm/cascader/index.mjs.map +1 -1
- package/esm/checkbox/index.mjs +20 -16
- package/esm/checkbox/index.mjs.map +1 -1
- package/esm/color-picker/index.mjs +9 -6
- package/esm/color-picker/index.mjs.map +1 -1
- package/esm/color-picker-panel/index.mjs +9 -6
- package/esm/color-picker-panel/index.mjs.map +1 -1
- package/esm/date-picker/index.mjs +14 -11
- package/esm/date-picker/index.mjs.map +1 -1
- package/esm/date-picker/utils.mjs.map +1 -1
- package/esm/date-picker-panel/index.mjs +14 -11
- package/esm/date-picker-panel/index.mjs.map +1 -1
- package/esm/editable/index.mjs +33 -30
- package/esm/editable/index.mjs.map +1 -1
- package/esm/form/form.mjs +6 -6
- package/esm/form/form.mjs.map +1 -1
- package/esm/form-button-group/index.mjs +18 -14
- package/esm/form-button-group/index.mjs.map +1 -1
- package/esm/form-button-group/utils.mjs +9 -2
- package/esm/form-button-group/utils.mjs.map +1 -1
- package/esm/form-collapse/index.mjs +21 -18
- package/esm/form-collapse/index.mjs.map +1 -1
- package/esm/form-collapse/utils.mjs.map +1 -1
- package/esm/form-dialog/index.d.ts +1 -1
- package/esm/form-dialog/index.mjs +22 -22
- package/esm/form-dialog/index.mjs.map +1 -1
- package/esm/form-dialog/types.d.ts +13 -5
- package/esm/form-drawer/index.d.ts +1 -1
- package/esm/form-drawer/index.mjs +21 -21
- package/esm/form-drawer/index.mjs.map +1 -1
- package/esm/form-drawer/types.d.ts +13 -5
- package/esm/form-grid/hooks.mjs.map +1 -1
- package/esm/form-grid/index.mjs +21 -18
- package/esm/form-grid/index.mjs.map +1 -1
- package/esm/form-item/index.mjs +55 -53
- 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 -10
- package/esm/form-layout/form-layout.mjs.map +1 -1
- package/esm/form-layout/utils.mjs.map +1 -1
- package/esm/form-step/index.mjs +30 -27
- 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 +25 -23
- package/esm/form-tab/index.mjs.map +1 -1
- package/esm/form-tab/utils.mjs.map +1 -1
- package/esm/index.mjs +72 -72
- package/esm/input/index.mjs +30 -26
- package/esm/input/index.mjs.map +1 -1
- package/esm/input-number/index.mjs +11 -8
- package/esm/input-number/index.mjs.map +1 -1
- package/esm/input-tag/index.mjs +20 -16
- package/esm/input-tag/index.mjs.map +1 -1
- package/esm/mention/index.mjs +24 -20
- package/esm/mention/index.mjs.map +1 -1
- 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/index.mjs +31 -27
- package/esm/preview-text/index.mjs.map +1 -1
- package/esm/preview-text/utils.mjs.map +1 -1
- package/esm/query-form/default-components.mjs.map +1 -1
- package/esm/query-form/hooks.mjs.map +1 -1
- package/esm/query-form/index.mjs +51 -48
- package/esm/query-form/index.mjs.map +1 -1
- package/esm/query-form-item/index.mjs +37 -34
- package/esm/query-form-item/index.mjs.map +1 -1
- package/esm/radio/index.mjs +29 -25
- package/esm/radio/index.mjs.map +1 -1
- package/esm/rate/index.mjs +13 -10
- package/esm/rate/index.mjs.map +1 -1
- package/esm/reset/index.mjs.map +1 -1
- package/esm/segmented/index.mjs +16 -12
- package/esm/segmented/index.mjs.map +1 -1
- package/esm/select/index.mjs +26 -22
- package/esm/select/index.mjs.map +1 -1
- package/esm/select-table/index.mjs +16 -12
- package/esm/select-table/index.mjs.map +1 -1
- package/esm/shared/overlay-elements.mjs.map +1 -1
- package/esm/slider/index.mjs +13 -10
- package/esm/slider/index.mjs.map +1 -1
- package/esm/submit/index.mjs.map +1 -1
- package/esm/switch/index.mjs.map +1 -1
- package/esm/time-picker/index.mjs +9 -6
- package/esm/time-picker/index.mjs.map +1 -1
- package/esm/time-select/index.mjs +9 -6
- package/esm/time-select/index.mjs.map +1 -1
- package/esm/transfer/index.mjs.map +1 -1
- package/esm/tree/index.mjs +33 -29
- package/esm/tree/index.mjs.map +1 -1
- package/esm/tree/utils.mjs.map +1 -1
- package/esm/tree-select/index.mjs +18 -14
- package/esm/tree-select/index.mjs.map +1 -1
- package/esm/upload/index.mjs +10 -7
- package/esm/upload/index.mjs.map +1 -1
- package/esm/vendor/sizes.mjs.map +1 -1
- package/package.json +6 -5
package/esm/form-item/index.mjs
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { isVoidField as ce } from "@formily/core";
|
|
2
2
|
import { useField as fe, connect as ve, mapProps as pe } from "@silver-formily/vue";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
3
|
+
import { useNamespace as me, useFormSize as be, useId as ye, formItemContextKey as ke, ElTooltip as R, ElIcon as D } from "element-plus";
|
|
4
|
+
import "@formily/reactive";
|
|
5
|
+
import { useResizeObserver as ge } from "@vueuse/core";
|
|
6
|
+
import { defineComponent as Se, useSlots as he, computed as s, ref as b, reactive as xe, watch as Ce, provide as G, openBlock as a, createElementBlock as n, unref as l, normalizeClass as u, createBlock as f, resolveDynamicComponent as g, normalizeStyle as F, withCtx as m, isVNode as S, createVNode as x, createElementVNode as C, toDisplayString as y, Fragment as I, createTextVNode as E, createCommentVNode as c, renderSlot as K, TransitionGroup as Ie } from "vue";
|
|
7
|
+
import "@silver-formily/reactive-vue";
|
|
8
|
+
import { composeExport as _e } from "../__builtins__/shared/utils.mjs";
|
|
9
|
+
import { InfoFilled as $e, CircleClose as we, CircleCheck as Fe, Warning as We } from "@element-plus/icons-vue";
|
|
10
|
+
import { isValid as v, isArr as Ae } from "@formily/shared";
|
|
11
|
+
import { stylePrefix as Le } from "../__builtins__/configs/index.mjs";
|
|
12
|
+
import { FORM_LAYOUT_PROPS_KEYS as ze, useFormLayout as Be, formLayoutShallowContext as Te } from "../form-layout/utils.mjs";
|
|
13
|
+
import { p as Re } from "../vendor/lodash.mjs";
|
|
14
|
+
import { i as Ee, a as Ve, d as Pe } from "../vendor/types.mjs";
|
|
15
|
+
import { a as Ne } from "../vendor/shared.esm-bundler.mjs";
|
|
16
|
+
import { getFeedbackMessage as Oe, determineFeedbackStatus as qe } from "./utils.mjs";
|
|
15
17
|
import '../styles/form-item/index.css';const Me = "utils/dom/style";
|
|
16
18
|
function U(i, p = "px") {
|
|
17
19
|
if (!i && i !== 0) return "";
|
|
18
|
-
if (
|
|
20
|
+
if (Ee(i) || Ve(i))
|
|
19
21
|
return `${i}${p}`;
|
|
20
|
-
if (
|
|
22
|
+
if (Ne(i))
|
|
21
23
|
return i;
|
|
22
|
-
|
|
24
|
+
Pe(Me, "binding value must be a string or number");
|
|
23
25
|
}
|
|
24
|
-
const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */
|
|
26
|
+
const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ Se({
|
|
25
27
|
name: "FFormItem",
|
|
26
28
|
__name: "form-item",
|
|
27
29
|
props: {
|
|
@@ -50,21 +52,21 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
50
52
|
tooltipLayout: {}
|
|
51
53
|
},
|
|
52
54
|
setup(i, { expose: p }) {
|
|
53
|
-
const e = i, W =
|
|
55
|
+
const e = i, W = he(), o = me("form-item"), d = `${Le}-form-item`, H = s(() => e.internalFormItemClass || o.b()), J = s(
|
|
54
56
|
() => Object.fromEntries(
|
|
55
|
-
Object.entries(
|
|
57
|
+
Object.entries(Re(e, ze)).filter(([r, w]) => v(w))
|
|
56
58
|
)
|
|
57
|
-
), Q =
|
|
59
|
+
), Q = Be(), t = s(() => Object.assign({
|
|
58
60
|
colon: !0,
|
|
59
61
|
feedbackLayout: "loose",
|
|
60
62
|
fullness: !1,
|
|
61
63
|
labelWrap: !1
|
|
62
|
-
}, Q.value, J.value)), V = fe(), X =
|
|
64
|
+
}, Q.value, J.value)), V = fe(), X = be(void 0, { formItem: !1 }), P = s(() => v(t.value.size) ? t.value.size : X.value), A = ye().value, k = b([]), N = b(""), O = b(), h = b(), q = b();
|
|
63
65
|
p({
|
|
64
66
|
feedbackTooltipRef: q
|
|
65
67
|
});
|
|
66
68
|
const _ = s(
|
|
67
|
-
() => t.value.layout === "vertical" ||
|
|
69
|
+
() => t.value.layout === "vertical" || Ae(t.value.layout) && t.value.layout.includes("vertical") ? "top" : t.value.labelAlign ?? "right"
|
|
68
70
|
), Z = s(() => {
|
|
69
71
|
if (_.value === "top")
|
|
70
72
|
return {};
|
|
@@ -107,10 +109,10 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
107
109
|
}, ue = (r) => {
|
|
108
110
|
k.value = k.value.filter((w) => w !== r);
|
|
109
111
|
}, j = b(!1);
|
|
110
|
-
|
|
111
|
-
j.value =
|
|
112
|
+
ge(h, () => {
|
|
113
|
+
j.value = h.value?.scrollWidth > h.value?.clientWidth;
|
|
112
114
|
});
|
|
113
|
-
const T = s(() => j.value && !t.value.labelWrap), de = b(""), $ =
|
|
115
|
+
const T = s(() => j.value && !t.value.labelWrap), de = b(""), $ = xe({
|
|
114
116
|
$el: O,
|
|
115
117
|
labelWidth: t.value?.labelWidth,
|
|
116
118
|
size: P,
|
|
@@ -132,7 +134,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
132
134
|
propString: "",
|
|
133
135
|
setInitialValue: ie
|
|
134
136
|
});
|
|
135
|
-
return
|
|
137
|
+
return Ce(() => e.feedbackStatus, (r) => {
|
|
136
138
|
if (r === "pending") {
|
|
137
139
|
$.validateState = "validating";
|
|
138
140
|
return;
|
|
@@ -144,10 +146,10 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
144
146
|
$.validateState = r;
|
|
145
147
|
}, {
|
|
146
148
|
immediate: !0
|
|
147
|
-
}),
|
|
149
|
+
}), G(Te, b({
|
|
148
150
|
...v(t.value.size) && { size: t.value.size },
|
|
149
151
|
...v(t.value.colon) && { colon: t.value.colon }
|
|
150
|
-
})),
|
|
152
|
+
})), G(ke, $), (r, w) => (a(), n("div", {
|
|
151
153
|
ref_key: "formItemRef",
|
|
152
154
|
ref: O,
|
|
153
155
|
class: u([d, t.value.labelWrap && "is-warp", ...le.value]),
|
|
@@ -162,23 +164,23 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
162
164
|
style: F(Z.value)
|
|
163
165
|
}, {
|
|
164
166
|
default: m(() => [
|
|
165
|
-
|
|
167
|
+
S(e.label) ? (a(), f(g(e.label), { key: 0 })) : (a(), n("div", {
|
|
166
168
|
key: 1,
|
|
167
169
|
class: u(`${d}-label__wrapper`)
|
|
168
170
|
}, [
|
|
169
|
-
x(l(
|
|
171
|
+
x(l(R), {
|
|
170
172
|
disabled: !T.value && t.value.tooltipLayout !== "text"
|
|
171
173
|
}, {
|
|
172
174
|
content: m(() => [
|
|
173
|
-
|
|
175
|
+
S(e.tooltip) ? (a(), f(g(e.tooltip), { key: 0 })) : (a(), n("div", {
|
|
174
176
|
key: 1,
|
|
175
|
-
style: F(`width: ${
|
|
177
|
+
style: F(`width: ${h.value?.clientWidth ?? 0}px;`)
|
|
176
178
|
}, [
|
|
177
179
|
T.value ? (a(), n(I, { key: 0 }, [
|
|
178
|
-
|
|
180
|
+
E(y(e.label), 1)
|
|
179
181
|
], 64)) : c("", !0),
|
|
180
182
|
t.value.tooltipLayout === "text" ? (a(), n(I, { key: 1 }, [
|
|
181
|
-
|
|
183
|
+
E(y(e.tooltip), 1)
|
|
182
184
|
], 64)) : c("", !0)
|
|
183
185
|
], 4))
|
|
184
186
|
]),
|
|
@@ -191,22 +193,22 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
191
193
|
}, [
|
|
192
194
|
C("span", {
|
|
193
195
|
ref_key: "labelRef",
|
|
194
|
-
ref:
|
|
196
|
+
ref: h
|
|
195
197
|
}, y(e.label), 513)
|
|
196
198
|
], 2)
|
|
197
199
|
]),
|
|
198
200
|
_: 1
|
|
199
201
|
}, 8, ["disabled"]),
|
|
200
|
-
e.tooltip && t.value.tooltipLayout !== "text" ? (a(), f(l(
|
|
202
|
+
e.tooltip && !S(e.tooltip) && t.value.tooltipLayout !== "text" ? (a(), f(l(R), {
|
|
201
203
|
key: 0,
|
|
202
204
|
content: e.tooltip
|
|
203
205
|
}, {
|
|
204
206
|
default: m(() => [
|
|
205
|
-
x(l(
|
|
207
|
+
x(l(D), {
|
|
206
208
|
class: u(`${d}-label-tooltip`)
|
|
207
209
|
}, {
|
|
208
210
|
default: m(() => [
|
|
209
|
-
x(l(
|
|
211
|
+
x(l($e))
|
|
210
212
|
]),
|
|
211
213
|
_: 1
|
|
212
214
|
}, 8, ["class"])
|
|
@@ -229,7 +231,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
229
231
|
style: F(te.value)
|
|
230
232
|
}, [
|
|
231
233
|
l(v)(e.addonBefore) ? (a(), n(I, { key: 0 }, [
|
|
232
|
-
|
|
234
|
+
S(e.addonBefore) ? (a(), f(g(e.addonBefore), { key: 0 })) : (a(), n("div", {
|
|
233
235
|
key: 1,
|
|
234
236
|
class: u(`${d}-addon-before`)
|
|
235
237
|
}, y(e.addonBefore), 3))
|
|
@@ -242,7 +244,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
242
244
|
]),
|
|
243
245
|
style: F(ee.value)
|
|
244
246
|
}, [
|
|
245
|
-
t.value.feedbackLayout === "popover" ? (a(), f(l(
|
|
247
|
+
t.value.feedbackLayout === "popover" ? (a(), f(l(R), {
|
|
246
248
|
key: 0,
|
|
247
249
|
ref_key: "feedbackTooltipRef",
|
|
248
250
|
ref: q,
|
|
@@ -251,26 +253,26 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
251
253
|
offset: 6
|
|
252
254
|
}, {
|
|
253
255
|
default: m(() => [
|
|
254
|
-
|
|
256
|
+
K(r.$slots, "default")
|
|
255
257
|
]),
|
|
256
258
|
content: m(() => [
|
|
257
259
|
C("div", {
|
|
258
260
|
class: u([...M.value, l(o).is("tooltip")])
|
|
259
261
|
}, [
|
|
260
|
-
x(l(
|
|
262
|
+
x(l(D), null, {
|
|
261
263
|
default: m(() => [
|
|
262
|
-
e.feedbackStatus === "error" ? (a(), f(l(
|
|
263
|
-
e.feedbackStatus === "success" ? (a(), f(l(
|
|
264
|
-
e.feedbackStatus === "warning" ? (a(), f(l(
|
|
264
|
+
e.feedbackStatus === "error" ? (a(), f(l(we), { key: 0 })) : c("", !0),
|
|
265
|
+
e.feedbackStatus === "success" ? (a(), f(l(Fe), { key: 1 })) : c("", !0),
|
|
266
|
+
e.feedbackStatus === "warning" ? (a(), f(l(We), { key: 2 })) : c("", !0)
|
|
265
267
|
]),
|
|
266
268
|
_: 1
|
|
267
269
|
}),
|
|
268
|
-
|
|
270
|
+
E(" " + y(e.feedbackText), 1)
|
|
269
271
|
], 2)
|
|
270
272
|
]),
|
|
271
273
|
_: 3
|
|
272
|
-
}, 8, ["visible"])) :
|
|
273
|
-
x(
|
|
274
|
+
}, 8, ["visible"])) : K(r.$slots, "default", { key: 1 }),
|
|
275
|
+
x(Ie, {
|
|
274
276
|
name: `${l(o).namespace.value}-zoom-in-top`
|
|
275
277
|
}, {
|
|
276
278
|
default: m(() => [
|
|
@@ -279,7 +281,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
279
281
|
class: u(M.value)
|
|
280
282
|
}, y(e.feedbackText), 3)) : c("", !0),
|
|
281
283
|
l(v)(e.extra) ? (a(), n(I, { key: 1 }, [
|
|
282
|
-
|
|
284
|
+
S(e.extra) ? (a(), f(g(e.extra), { key: 0 })) : (a(), n("div", {
|
|
283
285
|
key: 1,
|
|
284
286
|
class: u(`${d}-extra`)
|
|
285
287
|
}, y(e.extra), 3))
|
|
@@ -289,7 +291,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
289
291
|
}, 8, ["name"])
|
|
290
292
|
], 6),
|
|
291
293
|
l(v)(e.addonAfter) ? (a(), n(I, { key: 1 }, [
|
|
292
|
-
|
|
294
|
+
S(e.addonAfter) ? (a(), f(g(e.addonAfter), { key: 0 })) : (a(), n("div", {
|
|
293
295
|
key: 1,
|
|
294
296
|
class: u(`${d}-addon-after`)
|
|
295
297
|
}, y(e.addonAfter), 3))
|
|
@@ -301,7 +303,7 @@ const je = ["role", "aria-labelledby"], Y = /* @__PURE__ */ me({
|
|
|
301
303
|
function De(i, p) {
|
|
302
304
|
if (ce(p) || !p)
|
|
303
305
|
return i;
|
|
304
|
-
const e =
|
|
306
|
+
const e = Oe(p), W = qe(p), o = "asterisk" in i ? i.asterisk : p.required && p.pattern !== "readPretty";
|
|
305
307
|
return {
|
|
306
308
|
...i,
|
|
307
309
|
feedbackText: e,
|
|
@@ -320,13 +322,13 @@ const Ge = ve(
|
|
|
320
322
|
},
|
|
321
323
|
De
|
|
322
324
|
)
|
|
323
|
-
),
|
|
325
|
+
), nt = _e(Ge, {
|
|
324
326
|
BaseItem: Y
|
|
325
327
|
});
|
|
326
328
|
export {
|
|
327
329
|
Y as FormBaseItem,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
+
nt as FormItem,
|
|
331
|
+
nt as default,
|
|
330
332
|
De as fieldFeedbackMapper
|
|
331
333
|
};
|
|
332
334
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../node_modules/.pnpm/element-plus@2.13.2_vue@3.5.28_typescript@5.9.2_/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 rootFormItemClass = computed(() => props.internalFormItemClass || ns.b())\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 rootFormItemClass.value,\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\nexport type { IFormItemProps } from './types'\r\n"],"names":["SCOPE","addUnit","value","defaultUnit","isNumber","isStringNumber","isString","debugWarn","props","__props","slots","useSlots","ns","useNamespace","prefixCls","stylePrefix","rootFormItemClass","computed","formItemConfig","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,IAAoBC,EAAS,MAAMT,EAAM,yBAAyBI,E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A,CAAA,WAElCgE,EAEM,OAAA;AAAA;YAFO,YAAU1D,CAAS,cAAA;AAAA,UAAA,GAC3BsE,EAAA5E,EAAM,UAAU,GAAA,CAAA;AAAA,QAAA;;;;;ACjUtB,SAASsF,GAAoBtF,GAAOkB,GAAO;AAChD,MAAIqE,GAAYrE,CAAK,KAAK,CAACA;AACzB,WAAOlB;AAGT,QAAMwF,IAAeC,GAAmBvE,CAAK,GACvCwE,IAAiBC,GAAwBzE,CAAK,GAC9C0E,IAAW,cAAc5F,IAC3BA,EAAM,WACNkB,EAAM,YAAYA,EAAM,YAAY;AAExC,SAAO;AAAA,IACL,GAAGlB;AAAA,IACH,cAAAwF;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.28_typescript@5.9.2_/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 { useResizeObserver } from '@vueuse/core'\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 } 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 rootFormItemClass = computed(() => props.internalFormItemClass || ns.b())\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 rootFormItemClass.value,\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/* istanbul ignore next -- @preserve */\nconst setInitialValue: FormItemContext['setInitialValue'] = () => {}\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 setInitialValue,\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 && !isVNode(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'\nexport type { IFormItemProps } from './types'\n"],"names":["SCOPE","addUnit","value","defaultUnit","isNumber","isStringNumber","isString","debugWarn","props","__props","slots","useSlots","ns","useNamespace","prefixCls","stylePrefix","rootFormItemClass","computed","formItemConfig","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,IAAoBC,EAAS,MAAM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EAAoCC,EAApBpE,EAAM,UAAU,GAAA,EAAA,KAAA,EAAA,CAAA,WAElCgE,EAEM,OAAA;AAAA;YAFO,YAAU1D,CAAS,cAAA;AAAA,UAAA,GAC3BsE,EAAA5E,EAAM,UAAU,GAAA,CAAA;AAAA,QAAA;;;;;ACjUtB,SAASsF,GAAoBtF,GAAOkB,GAAO;AAChD,MAAIqE,GAAYrE,CAAK,KAAK,CAACA;AACzB,WAAOlB;AAGT,QAAMwF,IAAeC,GAAmBvE,CAAK,GACvCwE,IAAiBC,GAAwBzE,CAAK,GAC9C0E,IAAW,cAAc5F,IAC3BA,EAAM,WACNkB,EAAM,YAAYA,EAAM,YAAY;AAExC,SAAO;AAAA,IACL,GAAGlB;AAAA,IACH,cAAAwF;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'\
|
|
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;"}
|
|
@@ -2,10 +2,14 @@ import { defineComponent as A, ref as l, computed as d, provide as e, watch as x
|
|
|
2
2
|
import { isValid as z, isEmpty as D } from "@formily/shared";
|
|
3
3
|
import { useThrottleFn as T } from "@vueuse/core";
|
|
4
4
|
import { useId as M, formContextKey as S } from "element-plus";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
5
|
+
import { stylePrefix as W } from "../__builtins__/configs/index.mjs";
|
|
6
|
+
import "@formily/reactive";
|
|
7
|
+
import "@formily/core";
|
|
8
|
+
import "@silver-formily/reactive-vue";
|
|
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({
|
|
9
13
|
name: "FFormLayout",
|
|
10
14
|
inheritAttrs: !1,
|
|
11
15
|
__name: "form-layout",
|
|
@@ -31,18 +35,18 @@ const Y = /* @__PURE__ */ A({
|
|
|
31
35
|
requireAsteriskPosition: {}
|
|
32
36
|
},
|
|
33
37
|
setup(c) {
|
|
34
|
-
const o = c, y = `${
|
|
35
|
-
u && e(
|
|
36
|
-
const h =
|
|
38
|
+
const o = c, y = `${W}-form`, { props: s } = $(), n = l(), u = o.tag === "form", v = M(), p = d(() => s.value.id ?? `formily-${v.value}`), L = d(() => u ? p.value : s.value.id);
|
|
39
|
+
u && e(H, p);
|
|
40
|
+
const h = V(), { props: a } = E(o, n), C = l({
|
|
37
41
|
...h.value,
|
|
38
42
|
...o.shallow ? {
|
|
39
43
|
size: o.size,
|
|
40
44
|
...z(o.colon) && { colon: o.colon }
|
|
41
45
|
} : r(o)
|
|
42
46
|
});
|
|
43
|
-
e(
|
|
47
|
+
e(K, C);
|
|
44
48
|
const f = l(o.shallow ? r(o) : {});
|
|
45
|
-
e(
|
|
49
|
+
e(j, f);
|
|
46
50
|
const k = T(() => {
|
|
47
51
|
if (!D(a.value)) {
|
|
48
52
|
const i = r(a.value);
|
|
@@ -76,6 +80,6 @@ const Y = /* @__PURE__ */ A({
|
|
|
76
80
|
}
|
|
77
81
|
});
|
|
78
82
|
export {
|
|
79
|
-
|
|
83
|
+
to as _
|
|
80
84
|
};
|
|
81
85
|
//# 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>\
|
|
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 { useThrottleFn } from '@vueuse/core'\nimport { formContextKey, useId } from 'element-plus'\nimport { computed, provide, reactive, ref, toRef, watch } from 'vue'\nimport { stylePrefix, useCleanAttrs } from '../__builtins__'\nimport { filterValidFormLayoutProps, formLayoutDeepContext, formLayoutIdContext, formLayoutShallowContext, useFormDeepLayout, useResponsiveFormLayout } from './utils'\n\ndefineOptions({\n name: 'FFormLayout',\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<IFormLayoutProps>(), {\n tag: 'form',\n colon: undefined,\n labelWrap: undefined,\n fullness: undefined,\n size: 'default',\n layout: 'horizontal',\n shallow: true,\n statusIcon: true,\n asterisk: undefined,\n})\nconst formPrefixCls = `${stylePrefix}-form`\nconst { props: attrs } = useCleanAttrs()\nconst rootHTMLRef = ref<HTMLElement>()\nconst isFormTag = props.tag === 'form'\nconst formLayoutBaseId = useId()\nconst formLayoutId = computed(() => attrs.value.id ?? `formily-${formLayoutBaseId.value}`)\nconst formLayoutDomId = computed(() => (isFormTag ? formLayoutId.value : attrs.value.id))\nif (isFormTag) {\n provide(formLayoutIdContext, formLayoutId)\n}\n\nconst formLayoutDeepConfig = useFormDeepLayout()\nconst { props: responsiveProps } = useResponsiveFormLayout(props, rootHTMLRef)\n\nconst deepLayout = ref({\n ...formLayoutDeepConfig.value,\n ...(props.shallow\n ? {\n size: props.size,\n ...(isValid(props.colon) && { colon: props.colon }),\n }\n : filterValidFormLayoutProps(props)),\n})\nprovide(formLayoutDeepContext, deepLayout)\n\nconst shallowLayout = ref(props.shallow ? filterValidFormLayoutProps(props) : {})\nprovide(formLayoutShallowContext, shallowLayout)\n\nconst updateLayout = useThrottleFn(() => {\n if (!isEmpty(responsiveProps.value)) {\n const _responsiveProps = filterValidFormLayoutProps(responsiveProps.value)\n shallowLayout.value = filterValidFormLayoutProps({ ...props, ..._responsiveProps })\n }\n}, 200, true)\n\nwatch(() => [props, responsiveProps], updateLayout, {\n deep: true,\n immediate: true,\n})\n\nconst formContext = reactive({\n size: toRef(props, 'size'),\n statusIcon: toRef(props, 'statusIcon'),\n hideRequiredAsterisk: toRef(props, 'hideRequiredAsterisk'),\n requireAsteriskPosition: toRef(props, 'requireAsteriskPosition'),\n})\nprovide(formContextKey, formContext as FormContext)\n</script>\n\n<template>\n <component\n :is=\"props.tag\"\n :id=\"formLayoutDomId\"\n ref=\"rootHTMLRef\"\n :class=\"formPrefixCls\"\n v-bind=\"attrs\"\n @submit.prevent.stop\n >\n <slot />\n </component>\n</template>\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../src/form-layout/utils.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey, Ref } from 'vue'\
|
|
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 { useResizeObserver } from '@vueuse/core'\nimport { computed, inject, ref } from 'vue'\n\nexport function calcBreakpointIndex(breakpoints: number[], width: number): number {\n for (const [i, breakpoint] of breakpoints.entries()) {\n if (width <= breakpoint) {\n return i\n }\n }\n return -1\n}\n\nexport function calcFactor<T>(value: T | readonly T[], breakpointIndex: number): T {\n if (!Array.isArray(value) || value.length === 0) {\n return value as T\n }\n const safeIndex = Math.max(-1, Math.min(breakpointIndex, value.length - 1))\n return value.at(safeIndex)\n}\n\nexport function factor<T>(value: T | T[], breakpointIndex: number): T {\n return isValid(value) ? calcFactor<T>(value, breakpointIndex) : value as T\n}\n\nexport function calculateProps(target: Element, props: IFormLayoutProps): IFormLayoutProps {\n const { clientWidth } = target\n const {\n breakpoints,\n layout,\n labelAlign,\n wrapperAlign,\n labelCol,\n wrapperCol,\n ...otherProps\n } = props\n const breakpointIndex = calcBreakpointIndex(\n breakpoints as number[],\n clientWidth,\n )\n\n return {\n layout: factor(layout, breakpointIndex),\n labelAlign: factor(labelAlign, breakpointIndex),\n wrapperAlign: factor(wrapperAlign, breakpointIndex),\n labelCol: factor(labelCol, breakpointIndex),\n wrapperCol: factor(wrapperCol, breakpointIndex),\n ...otherProps,\n }\n}\n\nexport function useResponsiveFormLayout(props: IFormLayoutProps, root: Ref<HTMLElement | null>) {\n const { breakpoints } = props\n if (!isArr(breakpoints)) {\n return {\n props: ref(props),\n }\n }\n\n const layoutProps = ref<IFormLayoutProps>({})\n\n useResizeObserver(root, () => {\n layoutProps.value = calculateProps(root.value, props)\n })\n\n return {\n props: layoutProps,\n }\n}\n\nexport const formLayoutDeepContext: InjectionKey<Ref<IFormLayoutProps>> = Symbol(\n 'formLayoutDeepContext',\n)\n\nexport const formLayoutShallowContext: InjectionKey<Ref<IFormLayoutProps>>\n = Symbol('formLayoutShallowContext')\n\nexport const formLayoutIdContext: InjectionKey<ComputedRef<string>>\n = Symbol('formLayoutIdContext')\n\nexport function useFormDeepLayout(): Ref<IFormLayoutProps> {\n return inject(formLayoutDeepContext, ref({}))\n}\n\nexport function useFormLayout(): Ref<IFormLayoutProps> {\n const shallowLayout = inject(formLayoutShallowContext, ref({}))\n const deepLayout = inject(formLayoutDeepContext, ref({}))\n\n const formLayout = computed(() => {\n return {\n ...deepLayout.value,\n ...shallowLayout.value,\n }\n })\n\n return formLayout\n}\n\nexport function useFormLayoutId(): ComputedRef<string> {\n return inject(formLayoutIdContext)\n}\n\nexport const FORM_LAYOUT_PROPS_KEYS: ReadonlyArray<keyof IFormLayoutProps> = [\n 'colon',\n 'labelAlign',\n 'wrapperAlign',\n 'labelWrap',\n 'labelWidth',\n 'wrapperWidth',\n 'labelCol',\n 'wrapperCol',\n 'fullness',\n 'size',\n 'layout',\n 'feedbackLayout',\n 'tooltipLayout',\n 'breakpoints',\n 'hideRequiredAsterisk',\n 'statusIcon',\n 'requireAsteriskPosition',\n] as const\n\nexport function filterValidFormLayoutProps(props: IFormLayoutProps): IFormLayoutProps {\n return Object.fromEntries(\n Object.entries(props)\n .filter(([_, value]) => isValid(value)),\n )\n}\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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