@layers.digital/layers-design-system-vue3 1.0.2 → 1.0.4

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.
Files changed (94) hide show
  1. package/dist/components/LSwitch/LSwitch.vue.d.ts +357 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/layers-design-system-vue3.cjs +1 -1
  4. package/dist/layers-design-system-vue3.js +14 -15
  5. package/dist/layers-design-system-vue310.cjs +1 -1
  6. package/dist/layers-design-system-vue310.js +44 -2
  7. package/dist/layers-design-system-vue311.cjs +1 -1
  8. package/dist/layers-design-system-vue311.js +2 -44
  9. package/dist/layers-design-system-vue312.cjs +1 -1
  10. package/dist/layers-design-system-vue312.js +7 -2
  11. package/dist/layers-design-system-vue313.cjs +1 -1
  12. package/dist/layers-design-system-vue313.js +40 -7
  13. package/dist/layers-design-system-vue314.cjs +1 -1
  14. package/dist/layers-design-system-vue314.js +2 -40
  15. package/dist/layers-design-system-vue315.cjs +1 -1
  16. package/dist/layers-design-system-vue315.js +46 -2
  17. package/dist/layers-design-system-vue316.cjs +1 -1
  18. package/dist/layers-design-system-vue316.js +2 -46
  19. package/dist/layers-design-system-vue317.cjs +1 -1
  20. package/dist/layers-design-system-vue317.js +2 -2
  21. package/dist/layers-design-system-vue318.cjs +1 -1
  22. package/dist/layers-design-system-vue318.js +1 -1
  23. package/dist/layers-design-system-vue319.cjs +1 -1
  24. package/dist/layers-design-system-vue319.js +24 -2
  25. package/dist/layers-design-system-vue32.cjs +1 -1
  26. package/dist/layers-design-system-vue32.js +3 -3
  27. package/dist/layers-design-system-vue320.cjs +1 -1
  28. package/dist/layers-design-system-vue320.js +2 -24
  29. package/dist/layers-design-system-vue321.cjs +1 -1
  30. package/dist/layers-design-system-vue321.js +2 -2
  31. package/dist/layers-design-system-vue322.cjs +1 -1
  32. package/dist/layers-design-system-vue322.js +25 -2
  33. package/dist/layers-design-system-vue323.cjs +1 -1
  34. package/dist/layers-design-system-vue323.js +2 -3
  35. package/dist/layers-design-system-vue326.cjs +3 -3
  36. package/dist/layers-design-system-vue326.js +98 -99
  37. package/dist/layers-design-system-vue327.cjs +1 -1
  38. package/dist/layers-design-system-vue327.js +209 -793
  39. package/dist/layers-design-system-vue328.cjs +12 -1
  40. package/dist/layers-design-system-vue328.js +1091 -2015
  41. package/dist/layers-design-system-vue329.cjs +13 -9
  42. package/dist/layers-design-system-vue329.js +1971 -526
  43. package/dist/layers-design-system-vue33.cjs +1 -1
  44. package/dist/layers-design-system-vue33.js +3 -3
  45. package/dist/layers-design-system-vue330.cjs +1 -12
  46. package/dist/layers-design-system-vue330.js +8 -1172
  47. package/dist/layers-design-system-vue331.cjs +1 -5
  48. package/dist/layers-design-system-vue331.js +1706 -979
  49. package/dist/layers-design-system-vue332.cjs +1 -13
  50. package/dist/layers-design-system-vue332.js +1994 -1878
  51. package/dist/layers-design-system-vue333.cjs +9 -1
  52. package/dist/layers-design-system-vue333.js +536 -2
  53. package/dist/layers-design-system-vue334.cjs +5 -1
  54. package/dist/layers-design-system-vue334.js +1010 -2
  55. package/dist/layers-design-system-vue335.cjs +1 -1
  56. package/dist/layers-design-system-vue335.js +2 -2
  57. package/dist/layers-design-system-vue338.cjs +1 -1
  58. package/dist/layers-design-system-vue338.js +2 -9
  59. package/dist/layers-design-system-vue339.cjs +1 -1
  60. package/dist/layers-design-system-vue339.js +2 -1737
  61. package/dist/layers-design-system-vue34.cjs +1 -1
  62. package/dist/layers-design-system-vue34.js +3 -3
  63. package/dist/layers-design-system-vue340.cjs +1 -1
  64. package/dist/layers-design-system-vue340.js +2 -2
  65. package/dist/layers-design-system-vue341.cjs +1 -1
  66. package/dist/layers-design-system-vue341.js +2 -2
  67. package/dist/layers-design-system-vue342.cjs +1 -1
  68. package/dist/layers-design-system-vue342.js +824 -2
  69. package/dist/layers-design-system-vue343.js +2 -2
  70. package/dist/layers-design-system-vue344.cjs +1 -1
  71. package/dist/layers-design-system-vue344.js +2 -2
  72. package/dist/layers-design-system-vue345.cjs +1 -1
  73. package/dist/layers-design-system-vue345.js +2 -113
  74. package/dist/layers-design-system-vue346.cjs +1 -1
  75. package/dist/layers-design-system-vue346.js +113 -2
  76. package/dist/layers-design-system-vue347.cjs +1 -1
  77. package/dist/layers-design-system-vue347.js +2 -240
  78. package/dist/layers-design-system-vue348.cjs +1 -1
  79. package/dist/layers-design-system-vue348.js +2 -2
  80. package/dist/layers-design-system-vue35.cjs +1 -1
  81. package/dist/layers-design-system-vue35.js +9 -9
  82. package/dist/layers-design-system-vue350.cjs +1 -0
  83. package/dist/layers-design-system-vue350.js +4 -0
  84. package/dist/layers-design-system-vue36.cjs +1 -1
  85. package/dist/layers-design-system-vue36.js +8 -8
  86. package/dist/layers-design-system-vue37.cjs +1 -1
  87. package/dist/layers-design-system-vue37.js +3 -3
  88. package/dist/layers-design-system-vue38.cjs +1 -1
  89. package/dist/layers-design-system-vue38.js +2 -2
  90. package/dist/layers-design-system-vue39.cjs +1 -1
  91. package/dist/layers-design-system-vue39.js +5 -21
  92. package/dist/style.css +1 -1
  93. package/package.json +1 -1
  94. package/dist/components/LLinearProgress/LLinearProgress.vue.d.ts +0 -29
@@ -1,1175 +1,11 @@
1
- import { buildProp as lr, buildProps as Fe, definePropType as ce, useNamespace as qe, debugWarn as fr, throwError as ur, useResizeObserver as dr, refDebounced as cr, addUnit as Pe, isBoolean as Be, isString as pe, getProp as fe, castArray_default as ve, clone_default as Se, withInstall as pr, withNoopInstall as vr, useGetDerivedNamespace as mr, isArray as hr, isFunction as De, _export_sfc as Ce } from "./layers-design-system-vue332.js";
2
- import { defineComponent as X, computed as _, watch as k, provide as Ue, reactive as Ke, toRefs as Je, openBlock as me, createElementBlock as Ye, normalizeClass as Y, unref as E, renderSlot as ne, inject as L, ref as W, onMounted as xe, onBeforeUnmount as Ze, onUpdated as gr, createVNode as ae, Fragment as yr, useSlots as br, withCtx as ue, createBlock as wr, resolveDynamicComponent as Fr, normalizeStyle as Ie, createTextVNode as qr, toDisplayString as je, createCommentVNode as Ne, createElementVNode as Re, TransitionGroup as xr, toRef as Er, onUnmounted as _r, nextTick as Ge, getCurrentInstance as ke } from "vue";
3
- var Et = "update:modelValue", _t = "change", Ot = "input", Ee = ["", "default", "small", "large"], At = {
4
- large: 40,
5
- default: 32,
6
- small: 24
7
- }, He = (i) => {
8
- const e = ke();
9
- return _(() => {
10
- var r, n;
11
- return (n = (r = e == null ? void 0 : e.proxy) == null ? void 0 : r.$props) == null ? void 0 : n[i];
12
- });
13
- }, Ve = {
14
- prefix: Math.floor(Math.random() * 1e4),
15
- current: 0
16
- }, Or = Symbol("elIdInjection"), Ar = () => ke() ? L(Or, Ve) : Ve, Qe = (i) => {
17
- const e = Ar(), r = mr();
18
- return _(() => E(i) || `${r.value}-id-${e.prefix}-${e.current++}`);
19
- }, Pt = lr({
20
- type: String,
21
- values: Ee,
22
- required: !1
23
- }), Pr = Symbol("size"), Sr = () => {
24
- const i = L(Pr, {});
25
- return _(() => E(i.size) || "");
26
- }, K = Symbol("formContextKey"), H = Symbol("formItemContextKey"), Xe = (i, e = {}) => {
27
- const r = W(void 0), n = e.prop ? r : He("size"), t = e.global ? r : Sr(), o = e.form ? { size: void 0 } : L(K, void 0), a = e.formItem ? { size: void 0 } : L(H, void 0);
28
- return _(() => n.value || E(i) || (a == null ? void 0 : a.size) || (o == null ? void 0 : o.size) || t.value || "");
29
- }, St = (i) => {
30
- const e = He("disabled"), r = L(K, void 0);
31
- return _(() => e.value || E(i) || (r == null ? void 0 : r.disabled) || !1);
32
- }, It = () => {
33
- const i = L(K, void 0), e = L(H, void 0);
34
- return {
35
- form: i,
36
- formItem: e
37
- };
38
- }, jt = (i, {
39
- formItemContext: e,
40
- disableIdGeneration: r,
41
- disableIdManagement: n
42
- }) => {
43
- r || (r = W(!1)), n || (n = W(!1));
44
- const t = W();
45
- let o;
46
- const a = _(() => {
47
- var s;
48
- return !!(!i.label && e && e.inputIds && ((s = e.inputIds) == null ? void 0 : s.length) <= 1);
49
- });
50
- return xe(() => {
51
- o = k([Er(i, "id"), r], ([s, u]) => {
52
- const g = s ?? (u ? void 0 : Qe().value);
53
- g !== t.value && (e != null && e.removeInputId && (t.value && e.removeInputId(t.value), !(n != null && n.value) && !u && g && e.addInputId(g)), t.value = g);
54
- }, { immediate: !0 });
55
- }), _r(() => {
56
- o && o(), e != null && e.removeInputId && t.value && e.removeInputId(t.value);
57
- }), {
58
- isLabeledByFormItem: a,
59
- inputId: t
60
- };
61
- }, Ir = Fe({
62
- size: {
63
- type: String,
64
- values: Ee
65
- },
66
- disabled: Boolean
67
- }), jr = Fe({
68
- ...Ir,
69
- model: Object,
70
- rules: {
71
- type: ce(Object)
72
- },
73
- labelPosition: {
74
- type: String,
75
- values: ["left", "right", "top"],
76
- default: "right"
77
- },
78
- requireAsteriskPosition: {
79
- type: String,
80
- values: ["left", "right"],
81
- default: "left"
82
- },
83
- labelWidth: {
84
- type: [String, Number],
85
- default: ""
86
- },
87
- labelSuffix: {
88
- type: String,
89
- default: ""
90
- },
91
- inline: Boolean,
92
- inlineMessage: Boolean,
93
- statusIcon: Boolean,
94
- showMessage: {
95
- type: Boolean,
96
- default: !0
97
- },
98
- validateOnRuleChange: {
99
- type: Boolean,
100
- default: !0
101
- },
102
- hideRequiredAsterisk: Boolean,
103
- scrollToError: Boolean,
104
- scrollIntoViewOptions: {
105
- type: [Object, Boolean]
106
- }
107
- }), Nr = {
108
- validate: (i, e, r) => (hr(i) || pe(i)) && Be(e) && pe(r)
109
- }, Rr = [
110
- "",
111
- "error",
112
- "validating",
113
- "success"
114
- ], Vr = Fe({
115
- label: String,
116
- labelWidth: {
117
- type: [String, Number],
118
- default: ""
119
- },
120
- prop: {
121
- type: ce([String, Array])
122
- },
123
- required: {
124
- type: Boolean,
125
- default: void 0
126
- },
127
- rules: {
128
- type: ce([Object, Array])
129
- },
130
- error: String,
131
- validateStatus: {
132
- type: String,
133
- values: Rr
134
- },
135
- for: String,
136
- inlineMessage: {
137
- type: [String, Boolean],
138
- default: ""
139
- },
140
- showMessage: {
141
- type: Boolean,
142
- default: !0
143
- },
144
- size: {
145
- type: String,
146
- values: Ee
147
- }
148
- });
149
- function Mr() {
150
- const i = W([]), e = _(() => {
151
- if (!i.value.length)
152
- return "0";
153
- const o = Math.max(...i.value);
154
- return o ? `${o}px` : "";
155
- });
156
- function r(o) {
157
- const a = i.value.indexOf(o);
158
- return a === -1 && e.value, a;
159
- }
160
- function n(o, a) {
161
- if (o && a) {
162
- const s = r(a);
163
- i.value.splice(s, 1, o);
164
- } else
165
- o && i.value.push(o);
166
- }
167
- function t(o) {
168
- const a = r(o);
169
- a > -1 && i.value.splice(a, 1);
170
- }
171
- return {
172
- autoLabelWidth: e,
173
- registerLabelWidth: n,
174
- deregisterLabelWidth: t
175
- };
1
+ import { ref as c, watch as l } from "vue";
2
+ function o(t, n, u, r = (e) => e) {
3
+ const e = c(t[u]);
4
+ return l(
5
+ () => t[u],
6
+ (a, v) => (e.value = r(a, v), e.value)
7
+ ), l(e, () => n(`update:${u}`, e.value)), e;
176
8
  }
177
- var re = (i, e) => {
178
- const r = ve(e);
179
- return r.length > 0 ? i.filter((n) => n.prop && r.includes(n.prop)) : i;
180
- }, Wr = "ElForm", Lr = X({
181
- name: Wr
182
- }), Tr = /* @__PURE__ */ X({
183
- ...Lr,
184
- props: jr,
185
- emits: Nr,
186
- setup(i, { expose: e, emit: r }) {
187
- const n = i, t = [], o = Xe(), a = qe("form"), s = _(() => {
188
- const { labelPosition: v, inline: l } = n;
189
- return [
190
- a.b(),
191
- a.m(o.value || "default"),
192
- {
193
- [a.m(`label-${v}`)]: v,
194
- [a.m("inline")]: l
195
- }
196
- ];
197
- }), u = (v) => {
198
- t.push(v);
199
- }, g = (v) => {
200
- v.prop && t.splice(t.indexOf(v), 1);
201
- }, p = (v = []) => {
202
- n.model && re(t, v).forEach((l) => l.resetField());
203
- }, y = (v = []) => {
204
- re(t, v).forEach((l) => l.clearValidate());
205
- }, w = _(() => !!n.model), O = (v) => {
206
- if (t.length === 0)
207
- return [];
208
- const l = re(t, v);
209
- return l.length ? l : [];
210
- }, A = async (v) => b(void 0, v), d = async (v = []) => {
211
- if (!w.value)
212
- return !1;
213
- const l = O(v);
214
- if (l.length === 0)
215
- return !0;
216
- let h = {};
217
- for (const q of l)
218
- try {
219
- await q.validate("");
220
- } catch (x) {
221
- h = {
222
- ...h,
223
- ...x
224
- };
225
- }
226
- return Object.keys(h).length === 0 ? !0 : Promise.reject(h);
227
- }, b = async (v = [], l) => {
228
- const h = !De(l);
229
- try {
230
- const q = await d(v);
231
- return q === !0 && (l == null || l(q)), q;
232
- } catch (q) {
233
- if (q instanceof Error)
234
- throw q;
235
- const x = q;
236
- return n.scrollToError && f(Object.keys(x)[0]), l == null || l(!1, x), h && Promise.reject(x);
237
- }
238
- }, f = (v) => {
239
- var l;
240
- const h = re(t, v)[0];
241
- h && ((l = h.$el) == null || l.scrollIntoView(n.scrollIntoViewOptions));
242
- };
243
- return k(() => n.rules, () => {
244
- n.validateOnRuleChange && A().catch((v) => fr());
245
- }, { deep: !0 }), Ue(K, Ke({
246
- ...Je(n),
247
- emit: r,
248
- resetFields: p,
249
- clearValidate: y,
250
- validateField: b,
251
- addField: u,
252
- removeField: g,
253
- ...Mr()
254
- })), e({
255
- validate: A,
256
- validateField: b,
257
- resetFields: p,
258
- clearValidate: y,
259
- scrollToField: f
260
- }), (v, l) => (me(), Ye("form", {
261
- class: Y(E(s))
262
- }, [
263
- ne(v.$slots, "default")
264
- ], 2));
265
- }
266
- }), $r = /* @__PURE__ */ Ce(Tr, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
267
- function z() {
268
- return z = Object.assign ? Object.assign.bind() : function(i) {
269
- for (var e = 1; e < arguments.length; e++) {
270
- var r = arguments[e];
271
- for (var n in r)
272
- Object.prototype.hasOwnProperty.call(r, n) && (i[n] = r[n]);
273
- }
274
- return i;
275
- }, z.apply(this, arguments);
276
- }
277
- function zr(i, e) {
278
- i.prototype = Object.create(e.prototype), i.prototype.constructor = i, Q(i, e);
279
- }
280
- function he(i) {
281
- return he = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
282
- return r.__proto__ || Object.getPrototypeOf(r);
283
- }, he(i);
284
- }
285
- function Q(i, e) {
286
- return Q = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, t) {
287
- return n.__proto__ = t, n;
288
- }, Q(i, e);
289
- }
290
- function Br() {
291
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
292
- return !1;
293
- if (typeof Proxy == "function")
294
- return !0;
295
- try {
296
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
297
- })), !0;
298
- } catch {
299
- return !1;
300
- }
301
- }
302
- function ie(i, e, r) {
303
- return Br() ? ie = Reflect.construct.bind() : ie = function(t, o, a) {
304
- var s = [null];
305
- s.push.apply(s, o);
306
- var u = Function.bind.apply(t, s), g = new u();
307
- return a && Q(g, a.prototype), g;
308
- }, ie.apply(null, arguments);
309
- }
310
- function Dr(i) {
311
- return Function.toString.call(i).indexOf("[native code]") !== -1;
312
- }
313
- function ge(i) {
314
- var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
315
- return ge = function(n) {
316
- if (n === null || !Dr(n))
317
- return n;
318
- if (typeof n != "function")
319
- throw new TypeError("Super expression must either be null or a function");
320
- if (typeof e < "u") {
321
- if (e.has(n))
322
- return e.get(n);
323
- e.set(n, t);
324
- }
325
- function t() {
326
- return ie(n, arguments, he(this).constructor);
327
- }
328
- return t.prototype = Object.create(n.prototype, {
329
- constructor: {
330
- value: t,
331
- enumerable: !1,
332
- writable: !0,
333
- configurable: !0
334
- }
335
- }), Q(t, n);
336
- }, ge(i);
337
- }
338
- var Cr = /%[sdj%]/g, Ur = function() {
339
- };
340
- typeof process < "u" && process.env;
341
- function ye(i) {
342
- if (!i || !i.length)
343
- return null;
344
- var e = {};
345
- return i.forEach(function(r) {
346
- var n = r.field;
347
- e[n] = e[n] || [], e[n].push(r);
348
- }), e;
349
- }
350
- function N(i) {
351
- for (var e = arguments.length, r = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++)
352
- r[n - 1] = arguments[n];
353
- var t = 0, o = r.length;
354
- if (typeof i == "function")
355
- return i.apply(null, r);
356
- if (typeof i == "string") {
357
- var a = i.replace(Cr, function(s) {
358
- if (s === "%%")
359
- return "%";
360
- if (t >= o)
361
- return s;
362
- switch (s) {
363
- case "%s":
364
- return String(r[t++]);
365
- case "%d":
366
- return Number(r[t++]);
367
- case "%j":
368
- try {
369
- return JSON.stringify(r[t++]);
370
- } catch {
371
- return "[Circular]";
372
- }
373
- break;
374
- default:
375
- return s;
376
- }
377
- });
378
- return a;
379
- }
380
- return i;
381
- }
382
- function Kr(i) {
383
- return i === "string" || i === "url" || i === "hex" || i === "email" || i === "date" || i === "pattern";
384
- }
385
- function P(i, e) {
386
- return !!(i == null || e === "array" && Array.isArray(i) && !i.length || Kr(e) && typeof i == "string" && !i);
387
- }
388
- function Jr(i, e, r) {
389
- var n = [], t = 0, o = i.length;
390
- function a(s) {
391
- n.push.apply(n, s || []), t++, t === o && r(n);
392
- }
393
- i.forEach(function(s) {
394
- e(s, a);
395
- });
396
- }
397
- function Me(i, e, r) {
398
- var n = 0, t = i.length;
399
- function o(a) {
400
- if (a && a.length) {
401
- r(a);
402
- return;
403
- }
404
- var s = n;
405
- n = n + 1, s < t ? e(i[s], o) : r([]);
406
- }
407
- o([]);
408
- }
409
- function Yr(i) {
410
- var e = [];
411
- return Object.keys(i).forEach(function(r) {
412
- e.push.apply(e, i[r] || []);
413
- }), e;
414
- }
415
- var We = /* @__PURE__ */ function(i) {
416
- zr(e, i);
417
- function e(r, n) {
418
- var t;
419
- return t = i.call(this, "Async Validation Error") || this, t.errors = r, t.fields = n, t;
420
- }
421
- return e;
422
- }(/* @__PURE__ */ ge(Error));
423
- function Zr(i, e, r, n, t) {
424
- if (e.first) {
425
- var o = new Promise(function(w, O) {
426
- var A = function(f) {
427
- return n(f), f.length ? O(new We(f, ye(f))) : w(t);
428
- }, d = Yr(i);
429
- Me(d, r, A);
430
- });
431
- return o.catch(function(w) {
432
- return w;
433
- }), o;
434
- }
435
- var a = e.firstFields === !0 ? Object.keys(i) : e.firstFields || [], s = Object.keys(i), u = s.length, g = 0, p = [], y = new Promise(function(w, O) {
436
- var A = function(b) {
437
- if (p.push.apply(p, b), g++, g === u)
438
- return n(p), p.length ? O(new We(p, ye(p))) : w(t);
439
- };
440
- s.length || (n(p), w(t)), s.forEach(function(d) {
441
- var b = i[d];
442
- a.indexOf(d) !== -1 ? Me(b, r, A) : Jr(b, r, A);
443
- });
444
- });
445
- return y.catch(function(w) {
446
- return w;
447
- }), y;
448
- }
449
- function Gr(i) {
450
- return !!(i && i.message !== void 0);
451
- }
452
- function kr(i, e) {
453
- for (var r = i, n = 0; n < e.length; n++) {
454
- if (r == null)
455
- return r;
456
- r = r[e[n]];
457
- }
458
- return r;
459
- }
460
- function Le(i, e) {
461
- return function(r) {
462
- var n;
463
- return i.fullFields ? n = kr(e, i.fullFields) : n = e[r.field || i.fullField], Gr(r) ? (r.field = r.field || i.fullField, r.fieldValue = n, r) : {
464
- message: typeof r == "function" ? r() : r,
465
- fieldValue: n,
466
- field: r.field || i.fullField
467
- };
468
- };
469
- }
470
- function Te(i, e) {
471
- if (e) {
472
- for (var r in e)
473
- if (e.hasOwnProperty(r)) {
474
- var n = e[r];
475
- typeof n == "object" && typeof i[r] == "object" ? i[r] = z({}, i[r], n) : i[r] = n;
476
- }
477
- }
478
- return i;
479
- }
480
- var er = function(e, r, n, t, o, a) {
481
- e.required && (!n.hasOwnProperty(e.field) || P(r, a || e.type)) && t.push(N(o.messages.required, e.fullField));
482
- }, Hr = function(e, r, n, t, o) {
483
- (/^\s+$/.test(r) || r === "") && t.push(N(o.messages.whitespace, e.fullField));
484
- }, te, Qr = function() {
485
- if (te)
486
- return te;
487
- var i = "[a-fA-F\\d:]", e = function(h) {
488
- return h && h.includeBoundaries ? "(?:(?<=\\s|^)(?=" + i + ")|(?<=" + i + ")(?=\\s|$))" : "";
489
- }, r = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", n = "[a-fA-F\\d]{1,4}", t = (`
490
- (?:
491
- (?:` + n + ":){7}(?:" + n + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
492
- (?:` + n + ":){6}(?:" + r + "|:" + n + `|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
493
- (?:` + n + ":){5}(?::" + r + "|(?::" + n + `){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
494
- (?:` + n + ":){4}(?:(?::" + n + "){0,1}:" + r + "|(?::" + n + `){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
495
- (?:` + n + ":){3}(?:(?::" + n + "){0,2}:" + r + "|(?::" + n + `){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
496
- (?:` + n + ":){2}(?:(?::" + n + "){0,3}:" + r + "|(?::" + n + `){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
497
- (?:` + n + ":){1}(?:(?::" + n + "){0,4}:" + r + "|(?::" + n + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
498
- (?::(?:(?::` + n + "){0,5}:" + r + "|(?::" + n + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
499
- )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
500
- `).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), o = new RegExp("(?:^" + r + "$)|(?:^" + t + "$)"), a = new RegExp("^" + r + "$"), s = new RegExp("^" + t + "$"), u = function(h) {
501
- return h && h.exact ? o : new RegExp("(?:" + e(h) + r + e(h) + ")|(?:" + e(h) + t + e(h) + ")", "g");
502
- };
503
- u.v4 = function(l) {
504
- return l && l.exact ? a : new RegExp("" + e(l) + r + e(l), "g");
505
- }, u.v6 = function(l) {
506
- return l && l.exact ? s : new RegExp("" + e(l) + t + e(l), "g");
507
- };
508
- var g = "(?:(?:[a-z]+:)?//)", p = "(?:\\S+(?::\\S*)?@)?", y = u.v4().source, w = u.v6().source, O = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", A = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", d = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", b = "(?::\\d{2,5})?", f = '(?:[/?#][^\\s"]*)?', v = "(?:" + g + "|www\\.)" + p + "(?:localhost|" + y + "|" + w + "|" + O + A + d + ")" + b + f;
509
- return te = new RegExp("(?:^" + v + "$)", "i"), te;
510
- }, $e = {
511
- // http://emailregex.com/
512
- email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
513
- // url: new RegExp(
514
- // '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
515
- // 'i',
516
- // ),
517
- hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
518
- }, Z = {
519
- integer: function(e) {
520
- return Z.number(e) && parseInt(e, 10) === e;
521
- },
522
- float: function(e) {
523
- return Z.number(e) && !Z.integer(e);
524
- },
525
- array: function(e) {
526
- return Array.isArray(e);
527
- },
528
- regexp: function(e) {
529
- if (e instanceof RegExp)
530
- return !0;
531
- try {
532
- return !!new RegExp(e);
533
- } catch {
534
- return !1;
535
- }
536
- },
537
- date: function(e) {
538
- return typeof e.getTime == "function" && typeof e.getMonth == "function" && typeof e.getYear == "function" && !isNaN(e.getTime());
539
- },
540
- number: function(e) {
541
- return isNaN(e) ? !1 : typeof e == "number";
542
- },
543
- object: function(e) {
544
- return typeof e == "object" && !Z.array(e);
545
- },
546
- method: function(e) {
547
- return typeof e == "function";
548
- },
549
- email: function(e) {
550
- return typeof e == "string" && e.length <= 320 && !!e.match($e.email);
551
- },
552
- url: function(e) {
553
- return typeof e == "string" && e.length <= 2048 && !!e.match(Qr());
554
- },
555
- hex: function(e) {
556
- return typeof e == "string" && !!e.match($e.hex);
557
- }
558
- }, Xr = function(e, r, n, t, o) {
559
- if (e.required && r === void 0) {
560
- er(e, r, n, t, o);
561
- return;
562
- }
563
- var a = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], s = e.type;
564
- a.indexOf(s) > -1 ? Z[s](r) || t.push(N(o.messages.types[s], e.fullField, e.type)) : s && typeof r !== e.type && t.push(N(o.messages.types[s], e.fullField, e.type));
565
- }, et = function(e, r, n, t, o) {
566
- var a = typeof e.len == "number", s = typeof e.min == "number", u = typeof e.max == "number", g = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, p = r, y = null, w = typeof r == "number", O = typeof r == "string", A = Array.isArray(r);
567
- if (w ? y = "number" : O ? y = "string" : A && (y = "array"), !y)
568
- return !1;
569
- A && (p = r.length), O && (p = r.replace(g, "_").length), a ? p !== e.len && t.push(N(o.messages[y].len, e.fullField, e.len)) : s && !u && p < e.min ? t.push(N(o.messages[y].min, e.fullField, e.min)) : u && !s && p > e.max ? t.push(N(o.messages[y].max, e.fullField, e.max)) : s && u && (p < e.min || p > e.max) && t.push(N(o.messages[y].range, e.fullField, e.min, e.max));
570
- }, U = "enum", rt = function(e, r, n, t, o) {
571
- e[U] = Array.isArray(e[U]) ? e[U] : [], e[U].indexOf(r) === -1 && t.push(N(o.messages[U], e.fullField, e[U].join(", ")));
572
- }, tt = function(e, r, n, t, o) {
573
- if (e.pattern) {
574
- if (e.pattern instanceof RegExp)
575
- e.pattern.lastIndex = 0, e.pattern.test(r) || t.push(N(o.messages.pattern.mismatch, e.fullField, r, e.pattern));
576
- else if (typeof e.pattern == "string") {
577
- var a = new RegExp(e.pattern);
578
- a.test(r) || t.push(N(o.messages.pattern.mismatch, e.fullField, r, e.pattern));
579
- }
580
- }
581
- }, m = {
582
- required: er,
583
- whitespace: Hr,
584
- type: Xr,
585
- range: et,
586
- enum: rt,
587
- pattern: tt
588
- }, nt = function(e, r, n, t, o) {
589
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
590
- if (s) {
591
- if (P(r, "string") && !e.required)
592
- return n();
593
- m.required(e, r, t, a, o, "string"), P(r, "string") || (m.type(e, r, t, a, o), m.range(e, r, t, a, o), m.pattern(e, r, t, a, o), e.whitespace === !0 && m.whitespace(e, r, t, a, o));
594
- }
595
- n(a);
596
- }, it = function(e, r, n, t, o) {
597
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
598
- if (s) {
599
- if (P(r) && !e.required)
600
- return n();
601
- m.required(e, r, t, a, o), r !== void 0 && m.type(e, r, t, a, o);
602
- }
603
- n(a);
604
- }, at = function(e, r, n, t, o) {
605
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
606
- if (s) {
607
- if (r === "" && (r = void 0), P(r) && !e.required)
608
- return n();
609
- m.required(e, r, t, a, o), r !== void 0 && (m.type(e, r, t, a, o), m.range(e, r, t, a, o));
610
- }
611
- n(a);
612
- }, ot = function(e, r, n, t, o) {
613
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
614
- if (s) {
615
- if (P(r) && !e.required)
616
- return n();
617
- m.required(e, r, t, a, o), r !== void 0 && m.type(e, r, t, a, o);
618
- }
619
- n(a);
620
- }, st = function(e, r, n, t, o) {
621
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
622
- if (s) {
623
- if (P(r) && !e.required)
624
- return n();
625
- m.required(e, r, t, a, o), P(r) || m.type(e, r, t, a, o);
626
- }
627
- n(a);
628
- }, lt = function(e, r, n, t, o) {
629
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
630
- if (s) {
631
- if (P(r) && !e.required)
632
- return n();
633
- m.required(e, r, t, a, o), r !== void 0 && (m.type(e, r, t, a, o), m.range(e, r, t, a, o));
634
- }
635
- n(a);
636
- }, ft = function(e, r, n, t, o) {
637
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
638
- if (s) {
639
- if (P(r) && !e.required)
640
- return n();
641
- m.required(e, r, t, a, o), r !== void 0 && (m.type(e, r, t, a, o), m.range(e, r, t, a, o));
642
- }
643
- n(a);
644
- }, ut = function(e, r, n, t, o) {
645
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
646
- if (s) {
647
- if (r == null && !e.required)
648
- return n();
649
- m.required(e, r, t, a, o, "array"), r != null && (m.type(e, r, t, a, o), m.range(e, r, t, a, o));
650
- }
651
- n(a);
652
- }, dt = function(e, r, n, t, o) {
653
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
654
- if (s) {
655
- if (P(r) && !e.required)
656
- return n();
657
- m.required(e, r, t, a, o), r !== void 0 && m.type(e, r, t, a, o);
658
- }
659
- n(a);
660
- }, ct = "enum", pt = function(e, r, n, t, o) {
661
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
662
- if (s) {
663
- if (P(r) && !e.required)
664
- return n();
665
- m.required(e, r, t, a, o), r !== void 0 && m[ct](e, r, t, a, o);
666
- }
667
- n(a);
668
- }, vt = function(e, r, n, t, o) {
669
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
670
- if (s) {
671
- if (P(r, "string") && !e.required)
672
- return n();
673
- m.required(e, r, t, a, o), P(r, "string") || m.pattern(e, r, t, a, o);
674
- }
675
- n(a);
676
- }, mt = function(e, r, n, t, o) {
677
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
678
- if (s) {
679
- if (P(r, "date") && !e.required)
680
- return n();
681
- if (m.required(e, r, t, a, o), !P(r, "date")) {
682
- var u;
683
- r instanceof Date ? u = r : u = new Date(r), m.type(e, u, t, a, o), u && m.range(e, u.getTime(), t, a, o);
684
- }
685
- }
686
- n(a);
687
- }, ht = function(e, r, n, t, o) {
688
- var a = [], s = Array.isArray(r) ? "array" : typeof r;
689
- m.required(e, r, t, a, o, s), n(a);
690
- }, de = function(e, r, n, t, o) {
691
- var a = e.type, s = [], u = e.required || !e.required && t.hasOwnProperty(e.field);
692
- if (u) {
693
- if (P(r, a) && !e.required)
694
- return n();
695
- m.required(e, r, t, s, o, a), P(r, a) || m.type(e, r, t, s, o);
696
- }
697
- n(s);
698
- }, gt = function(e, r, n, t, o) {
699
- var a = [], s = e.required || !e.required && t.hasOwnProperty(e.field);
700
- if (s) {
701
- if (P(r) && !e.required)
702
- return n();
703
- m.required(e, r, t, a, o);
704
- }
705
- n(a);
706
- }, G = {
707
- string: nt,
708
- method: it,
709
- number: at,
710
- boolean: ot,
711
- regexp: st,
712
- integer: lt,
713
- float: ft,
714
- array: ut,
715
- object: dt,
716
- enum: pt,
717
- pattern: vt,
718
- date: mt,
719
- url: de,
720
- hex: de,
721
- email: de,
722
- required: ht,
723
- any: gt
724
- };
725
- function be() {
726
- return {
727
- default: "Validation error on field %s",
728
- required: "%s is required",
729
- enum: "%s must be one of %s",
730
- whitespace: "%s cannot be empty",
731
- date: {
732
- format: "%s date %s is invalid for format %s",
733
- parse: "%s date could not be parsed, %s is invalid ",
734
- invalid: "%s date %s is invalid"
735
- },
736
- types: {
737
- string: "%s is not a %s",
738
- method: "%s is not a %s (function)",
739
- array: "%s is not an %s",
740
- object: "%s is not an %s",
741
- number: "%s is not a %s",
742
- date: "%s is not a %s",
743
- boolean: "%s is not a %s",
744
- integer: "%s is not an %s",
745
- float: "%s is not a %s",
746
- regexp: "%s is not a valid %s",
747
- email: "%s is not a valid %s",
748
- url: "%s is not a valid %s",
749
- hex: "%s is not a valid %s"
750
- },
751
- string: {
752
- len: "%s must be exactly %s characters",
753
- min: "%s must be at least %s characters",
754
- max: "%s cannot be longer than %s characters",
755
- range: "%s must be between %s and %s characters"
756
- },
757
- number: {
758
- len: "%s must equal %s",
759
- min: "%s cannot be less than %s",
760
- max: "%s cannot be greater than %s",
761
- range: "%s must be between %s and %s"
762
- },
763
- array: {
764
- len: "%s must be exactly %s in length",
765
- min: "%s cannot be less than %s in length",
766
- max: "%s cannot be greater than %s in length",
767
- range: "%s must be between %s and %s in length"
768
- },
769
- pattern: {
770
- mismatch: "%s value %s does not match pattern %s"
771
- },
772
- clone: function() {
773
- var e = JSON.parse(JSON.stringify(this));
774
- return e.clone = this.clone, e;
775
- }
776
- };
777
- }
778
- var we = be(), ee = /* @__PURE__ */ function() {
779
- function i(r) {
780
- this.rules = null, this._messages = we, this.define(r);
781
- }
782
- var e = i.prototype;
783
- return e.define = function(n) {
784
- var t = this;
785
- if (!n)
786
- throw new Error("Cannot configure a schema with no rules");
787
- if (typeof n != "object" || Array.isArray(n))
788
- throw new Error("Rules must be an object");
789
- this.rules = {}, Object.keys(n).forEach(function(o) {
790
- var a = n[o];
791
- t.rules[o] = Array.isArray(a) ? a : [a];
792
- });
793
- }, e.messages = function(n) {
794
- return n && (this._messages = Te(be(), n)), this._messages;
795
- }, e.validate = function(n, t, o) {
796
- var a = this;
797
- t === void 0 && (t = {}), o === void 0 && (o = function() {
798
- });
799
- var s = n, u = t, g = o;
800
- if (typeof u == "function" && (g = u, u = {}), !this.rules || Object.keys(this.rules).length === 0)
801
- return g && g(null, s), Promise.resolve(s);
802
- function p(d) {
803
- var b = [], f = {};
804
- function v(h) {
805
- if (Array.isArray(h)) {
806
- var q;
807
- b = (q = b).concat.apply(q, h);
808
- } else
809
- b.push(h);
810
- }
811
- for (var l = 0; l < d.length; l++)
812
- v(d[l]);
813
- b.length ? (f = ye(b), g(b, f)) : g(null, s);
814
- }
815
- if (u.messages) {
816
- var y = this.messages();
817
- y === we && (y = be()), Te(y, u.messages), u.messages = y;
818
- } else
819
- u.messages = this.messages();
820
- var w = {}, O = u.keys || Object.keys(this.rules);
821
- O.forEach(function(d) {
822
- var b = a.rules[d], f = s[d];
823
- b.forEach(function(v) {
824
- var l = v;
825
- typeof l.transform == "function" && (s === n && (s = z({}, s)), f = s[d] = l.transform(f)), typeof l == "function" ? l = {
826
- validator: l
827
- } : l = z({}, l), l.validator = a.getValidationMethod(l), l.validator && (l.field = d, l.fullField = l.fullField || d, l.type = a.getType(l), w[d] = w[d] || [], w[d].push({
828
- rule: l,
829
- value: f,
830
- source: s,
831
- field: d
832
- }));
833
- });
834
- });
835
- var A = {};
836
- return Zr(w, u, function(d, b) {
837
- var f = d.rule, v = (f.type === "object" || f.type === "array") && (typeof f.fields == "object" || typeof f.defaultField == "object");
838
- v = v && (f.required || !f.required && d.value), f.field = d.field;
839
- function l(x, V) {
840
- return z({}, V, {
841
- fullField: f.fullField + "." + x,
842
- fullFields: f.fullFields ? [].concat(f.fullFields, [x]) : [x]
843
- });
844
- }
845
- function h(x) {
846
- x === void 0 && (x = []);
847
- var V = Array.isArray(x) ? x : [x];
848
- !u.suppressWarning && V.length && i.warning("async-validator:", V), V.length && f.message !== void 0 && (V = [].concat(f.message));
849
- var j = V.map(Le(f, s));
850
- if (u.first && j.length)
851
- return A[f.field] = 1, b(j);
852
- if (!v)
853
- b(j);
854
- else {
855
- if (f.required && !d.value)
856
- return f.message !== void 0 ? j = [].concat(f.message).map(Le(f, s)) : u.error && (j = [u.error(f, N(u.messages.required, f.field))]), b(j);
857
- var $ = {};
858
- f.defaultField && Object.keys(d.value).map(function(M) {
859
- $[M] = f.defaultField;
860
- }), $ = z({}, $, d.rule.fields);
861
- var J = {};
862
- Object.keys($).forEach(function(M) {
863
- var R = $[M], oe = Array.isArray(R) ? R : [R];
864
- J[M] = oe.map(l.bind(null, M));
865
- });
866
- var B = new i(J);
867
- B.messages(u.messages), d.rule.options && (d.rule.options.messages = u.messages, d.rule.options.error = u.error), B.validate(d.value, d.rule.options || u, function(M) {
868
- var R = [];
869
- j && j.length && R.push.apply(R, j), M && M.length && R.push.apply(R, M), b(R.length ? R : null);
870
- });
871
- }
872
- }
873
- var q;
874
- if (f.asyncValidator)
875
- q = f.asyncValidator(f, d.value, h, d.source, u);
876
- else if (f.validator) {
877
- try {
878
- q = f.validator(f, d.value, h, d.source, u);
879
- } catch (x) {
880
- console.error == null || console.error(x), u.suppressValidatorError || setTimeout(function() {
881
- throw x;
882
- }, 0), h(x.message);
883
- }
884
- q === !0 ? h() : q === !1 ? h(typeof f.message == "function" ? f.message(f.fullField || f.field) : f.message || (f.fullField || f.field) + " fails") : q instanceof Array ? h(q) : q instanceof Error && h(q.message);
885
- }
886
- q && q.then && q.then(function() {
887
- return h();
888
- }, function(x) {
889
- return h(x);
890
- });
891
- }, function(d) {
892
- p(d);
893
- }, s);
894
- }, e.getType = function(n) {
895
- if (n.type === void 0 && n.pattern instanceof RegExp && (n.type = "pattern"), typeof n.validator != "function" && n.type && !G.hasOwnProperty(n.type))
896
- throw new Error(N("Unknown rule type %s", n.type));
897
- return n.type || "string";
898
- }, e.getValidationMethod = function(n) {
899
- if (typeof n.validator == "function")
900
- return n.validator;
901
- var t = Object.keys(n), o = t.indexOf("message");
902
- return o !== -1 && t.splice(o, 1), t.length === 1 && t[0] === "required" ? G.required : G[this.getType(n)] || void 0;
903
- }, i;
904
- }();
905
- ee.register = function(e, r) {
906
- if (typeof r != "function")
907
- throw new Error("Cannot register a validator by type, validator is not a function");
908
- G[e] = r;
909
- };
910
- ee.warning = Ur;
911
- ee.messages = we;
912
- ee.validators = G;
913
- var ze = "ElLabelWrap", yt = X({
914
- name: ze,
915
- props: {
916
- isAutoWidth: Boolean,
917
- updateAll: Boolean
918
- },
919
- setup(i, {
920
- slots: e
921
- }) {
922
- const r = L(K, void 0), n = L(H);
923
- n || ur(ze, "usage: <el-form-item><label-wrap /></el-form-item>");
924
- const t = qe("form"), o = W(), a = W(0), s = () => {
925
- var p;
926
- if ((p = o.value) != null && p.firstElementChild) {
927
- const y = window.getComputedStyle(o.value.firstElementChild).width;
928
- return Math.ceil(Number.parseFloat(y));
929
- } else
930
- return 0;
931
- }, u = (p = "update") => {
932
- Ge(() => {
933
- e.default && i.isAutoWidth && (p === "update" ? a.value = s() : p === "remove" && (r == null || r.deregisterLabelWidth(a.value)));
934
- });
935
- }, g = () => u("update");
936
- return xe(() => {
937
- g();
938
- }), Ze(() => {
939
- u("remove");
940
- }), gr(() => g()), k(a, (p, y) => {
941
- i.updateAll && (r == null || r.registerLabelWidth(p, y));
942
- }), dr(_(() => {
943
- var p, y;
944
- return (y = (p = o.value) == null ? void 0 : p.firstElementChild) != null ? y : null;
945
- }), g), () => {
946
- var p, y;
947
- if (!e)
948
- return null;
949
- const {
950
- isAutoWidth: w
951
- } = i;
952
- if (w) {
953
- const O = r == null ? void 0 : r.autoLabelWidth, A = n == null ? void 0 : n.hasLabel, d = {};
954
- if (A && O && O !== "auto") {
955
- const b = Math.max(0, Number.parseInt(O, 10) - a.value), f = r.labelPosition === "left" ? "marginRight" : "marginLeft";
956
- b && (d[f] = `${b}px`);
957
- }
958
- return ae("div", {
959
- ref: o,
960
- class: [t.be("item", "label-wrap")],
961
- style: d
962
- }, [(p = e.default) == null ? void 0 : p.call(e)]);
963
- } else
964
- return ae(yr, {
965
- ref: o
966
- }, [(y = e.default) == null ? void 0 : y.call(e)]);
967
- };
968
- }
969
- }), bt = ["role", "aria-labelledby"], wt = X({
970
- name: "ElFormItem"
971
- }), Ft = /* @__PURE__ */ X({
972
- ...wt,
973
- props: Vr,
974
- setup(i, { expose: e }) {
975
- const r = i, n = br(), t = L(K, void 0), o = L(H, void 0), a = Xe(void 0, { formItem: !1 }), s = qe("form-item"), u = Qe().value, g = W([]), p = W(""), y = cr(p, 100), w = W(""), O = W();
976
- let A, d = !1;
977
- const b = _(() => {
978
- if ((t == null ? void 0 : t.labelPosition) === "top")
979
- return {};
980
- const c = Pe(r.labelWidth || (t == null ? void 0 : t.labelWidth) || "");
981
- return c ? { width: c } : {};
982
- }), f = _(() => {
983
- if ((t == null ? void 0 : t.labelPosition) === "top" || t != null && t.inline)
984
- return {};
985
- if (!r.label && !r.labelWidth && $)
986
- return {};
987
- const c = Pe(r.labelWidth || (t == null ? void 0 : t.labelWidth) || "");
988
- return !r.label && !n.label ? { marginLeft: c } : {};
989
- }), v = _(() => [
990
- s.b(),
991
- s.m(a.value),
992
- s.is("error", p.value === "error"),
993
- s.is("validating", p.value === "validating"),
994
- s.is("success", p.value === "success"),
995
- s.is("required", oe.value || r.required),
996
- s.is("no-asterisk", t == null ? void 0 : t.hideRequiredAsterisk),
997
- (t == null ? void 0 : t.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
998
- { [s.m("feedback")]: t == null ? void 0 : t.statusIcon }
999
- ]), l = _(() => Be(r.inlineMessage) ? r.inlineMessage : (t == null ? void 0 : t.inlineMessage) || !1), h = _(() => [
1000
- s.e("error"),
1001
- { [s.em("error", "inline")]: l.value }
1002
- ]), q = _(() => r.prop ? pe(r.prop) ? r.prop : r.prop.join(".") : ""), x = _(() => !!(r.label || n.label)), V = _(() => r.for || g.value.length === 1 ? g.value[0] : void 0), j = _(() => !V.value && x.value), $ = !!o, J = _(() => {
1003
- const c = t == null ? void 0 : t.model;
1004
- if (!(!c || !r.prop))
1005
- return fe(c, r.prop).value;
1006
- }), B = _(() => {
1007
- const { required: c } = r, F = [];
1008
- r.rules && F.push(...ve(r.rules));
1009
- const I = t == null ? void 0 : t.rules;
1010
- if (I && r.prop) {
1011
- const S = fe(I, r.prop).value;
1012
- S && F.push(...ve(S));
1013
- }
1014
- if (c !== void 0) {
1015
- const S = F.map((T, C) => [T, C]).filter(([T]) => Object.keys(T).includes("required"));
1016
- if (S.length > 0)
1017
- for (const [T, C] of S)
1018
- T.required !== c && (F[C] = { ...T, required: c });
1019
- else
1020
- F.push({ required: c });
1021
- }
1022
- return F;
1023
- }), M = _(() => B.value.length > 0), R = (c) => B.value.filter((I) => !I.trigger || !c ? !0 : Array.isArray(I.trigger) ? I.trigger.includes(c) : I.trigger === c).map(({ trigger: I, ...S }) => S), oe = _(() => B.value.some((c) => c.required)), tr = _(() => {
1024
- var c;
1025
- return y.value === "error" && r.showMessage && ((c = t == null ? void 0 : t.showMessage) != null ? c : !0);
1026
- }), _e = _(() => `${r.label || ""}${(t == null ? void 0 : t.labelSuffix) || ""}`), D = (c) => {
1027
- p.value = c;
1028
- }, nr = (c) => {
1029
- var F, I;
1030
- const { errors: S, fields: T } = c;
1031
- (!S || !T) && console.error(c), D("error"), w.value = S ? (I = (F = S == null ? void 0 : S[0]) == null ? void 0 : F.message) != null ? I : `${r.prop} is required` : "", t == null || t.emit("validate", r.prop, !1, w.value);
1032
- }, ir = () => {
1033
- D("success"), t == null || t.emit("validate", r.prop, !0, "");
1034
- }, ar = async (c) => {
1035
- const F = q.value;
1036
- return new ee({
1037
- [F]: c
1038
- }).validate({ [F]: J.value }, { firstFields: !0 }).then(() => (ir(), !0)).catch((S) => (nr(S), Promise.reject(S)));
1039
- }, Oe = async (c, F) => {
1040
- if (d || !r.prop)
1041
- return !1;
1042
- const I = De(F);
1043
- if (!M.value)
1044
- return F == null || F(!1), !1;
1045
- const S = R(c);
1046
- return S.length === 0 ? (F == null || F(!0), !0) : (D("validating"), ar(S).then(() => (F == null || F(!0), !0)).catch((T) => {
1047
- const { fields: C } = T;
1048
- return F == null || F(!1, C), I ? !1 : Promise.reject(C);
1049
- }));
1050
- }, se = () => {
1051
- D(""), w.value = "", d = !1;
1052
- }, Ae = async () => {
1053
- const c = t == null ? void 0 : t.model;
1054
- if (!c || !r.prop)
1055
- return;
1056
- const F = fe(c, r.prop);
1057
- d = !0, F.value = Se(A), await Ge(), se(), d = !1;
1058
- }, or = (c) => {
1059
- g.value.includes(c) || g.value.push(c);
1060
- }, sr = (c) => {
1061
- g.value = g.value.filter((F) => F !== c);
1062
- };
1063
- k(() => r.error, (c) => {
1064
- w.value = c || "", D(c ? "error" : "");
1065
- }, { immediate: !0 }), k(() => r.validateStatus, (c) => D(c || ""));
1066
- const le = Ke({
1067
- ...Je(r),
1068
- $el: O,
1069
- size: a,
1070
- validateState: p,
1071
- labelId: u,
1072
- inputIds: g,
1073
- isGroup: j,
1074
- hasLabel: x,
1075
- addInputId: or,
1076
- removeInputId: sr,
1077
- resetField: Ae,
1078
- clearValidate: se,
1079
- validate: Oe
1080
- });
1081
- return Ue(H, le), xe(() => {
1082
- r.prop && (t == null || t.addField(le), A = Se(J.value));
1083
- }), Ze(() => {
1084
- t == null || t.removeField(le);
1085
- }), e({
1086
- size: a,
1087
- validateMessage: w,
1088
- validateState: p,
1089
- validate: Oe,
1090
- clearValidate: se,
1091
- resetField: Ae
1092
- }), (c, F) => {
1093
- var I;
1094
- return me(), Ye("div", {
1095
- ref_key: "formItemRef",
1096
- ref: O,
1097
- class: Y(E(v)),
1098
- role: E(j) ? "group" : void 0,
1099
- "aria-labelledby": E(j) ? E(u) : void 0
1100
- }, [
1101
- ae(E(yt), {
1102
- "is-auto-width": E(b).width === "auto",
1103
- "update-all": ((I = E(t)) == null ? void 0 : I.labelWidth) === "auto"
1104
- }, {
1105
- default: ue(() => [
1106
- E(x) ? (me(), wr(Fr(E(V) ? "label" : "div"), {
1107
- key: 0,
1108
- id: E(u),
1109
- for: E(V),
1110
- class: Y(E(s).e("label")),
1111
- style: Ie(E(b))
1112
- }, {
1113
- default: ue(() => [
1114
- ne(c.$slots, "label", { label: E(_e) }, () => [
1115
- qr(je(E(_e)), 1)
1116
- ])
1117
- ]),
1118
- _: 3
1119
- }, 8, ["id", "for", "class", "style"])) : Ne("v-if", !0)
1120
- ]),
1121
- _: 3
1122
- }, 8, ["is-auto-width", "update-all"]),
1123
- Re("div", {
1124
- class: Y(E(s).e("content")),
1125
- style: Ie(E(f))
1126
- }, [
1127
- ne(c.$slots, "default"),
1128
- ae(xr, {
1129
- name: `${E(s).namespace.value}-zoom-in-top`
1130
- }, {
1131
- default: ue(() => [
1132
- E(tr) ? ne(c.$slots, "error", {
1133
- key: 0,
1134
- error: w.value
1135
- }, () => [
1136
- Re("div", {
1137
- class: Y(E(h))
1138
- }, je(w.value), 3)
1139
- ]) : Ne("v-if", !0)
1140
- ]),
1141
- _: 3
1142
- }, 8, ["name"])
1143
- ], 6)
1144
- ], 10, bt);
1145
- };
1146
- }
1147
- }), rr = /* @__PURE__ */ Ce(Ft, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form-item.vue"]]);
1148
- pr($r, {
1149
- FormItem: rr
1150
- });
1151
- vr(rr);
1152
9
  export {
1153
- _t as CHANGE_EVENT,
1154
- Or as ID_INJECTION_KEY,
1155
- Ot as INPUT_EVENT,
1156
- Pr as SIZE_INJECTION_KEY,
1157
- Et as UPDATE_MODEL_EVENT,
1158
- At as componentSizeMap,
1159
- Ee as componentSizes,
1160
- K as formContextKey,
1161
- Nr as formEmits,
1162
- H as formItemContextKey,
1163
- Vr as formItemProps,
1164
- Rr as formItemValidateStates,
1165
- jr as formProps,
1166
- St as useFormDisabled,
1167
- It as useFormItem,
1168
- jt as useFormItemInputId,
1169
- Xe as useFormSize,
1170
- Sr as useGlobalSize,
1171
- Qe as useId,
1172
- Ar as useIdInjection,
1173
- He as useProp,
1174
- Pt as useSizeProp
10
+ o as useVModel
1175
11
  };