@layers.digital/layers-design-system-vue3 1.0.3 → 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,4 +1,826 @@
1
- const o = "";
1
+ import { useLocale as Fe, ElTooltip as Ue, Ee as ze, EVENT_CODE as We } from "./layers-design-system-vue332.js";
2
+ import { ElInput as $e } from "./layers-design-system-vue333.js";
3
+ import { useFormItem as _e, useFormSize as Ke, useFormDisabled as je, UPDATE_MODEL_EVENT as H, useFormItemInputId as He, useSizeProp as Ne, CHANGE_EVENT as Ve, INPUT_EVENT as D } from "./layers-design-system-vue328.js";
4
+ import { ElIcon as Pe, arrow_down_default as Ge, minus_default as qe, arrow_up_default as Je, plus_default as Qe } from "./layers-design-system-vue334.js";
5
+ import { buildProps as he, useNamespace as pe, isNumber as X, isUndefined as me, isNil_default as ie, withInstall as Re, isString as ke, throwError as Ye, debugWarn as be, definePropType as ue, useEventListener as Ze, _export_sfc as Ie, isFunction as Ce, isArray as De, debounce_default as Te } from "./layers-design-system-vue329.js";
6
+ import { defineComponent as te, ref as ee, reactive as Be, computed as V, watch as se, onMounted as Xe, onUpdated as et, openBlock as x, createElementBlock as O, normalizeClass as U, unref as t, withModifiers as ce, withDirectives as Le, withKeys as ve, createVNode as de, withCtx as ge, createBlock as Z, createCommentVNode as ne, toRefs as Ee, normalizeStyle as le, createElementVNode as ae, toDisplayString as tt, h as lt, provide as nt, Fragment as fe, renderList as we, nextTick as ye, shallowRef as at, inject as rt } from "vue";
7
+ var ot = 100, ut = 600, Me = {
8
+ beforeMount(e, l) {
9
+ const o = l.value, { interval: a = ot, delay: c = ut } = Ce(o) ? {} : o;
10
+ let i, u;
11
+ const d = () => Ce(o) ? o() : o.handler(), y = () => {
12
+ u && (clearTimeout(u), u = void 0), i && (clearInterval(i), i = void 0);
13
+ };
14
+ e.addEventListener("mousedown", (v) => {
15
+ v.button === 0 && (y(), d(), document.addEventListener("mouseup", () => y(), {
16
+ once: !0
17
+ }), u = setTimeout(() => {
18
+ i = setInterval(() => {
19
+ d();
20
+ }, a);
21
+ }, c));
22
+ });
23
+ }
24
+ }, it = he({
25
+ id: {
26
+ type: String,
27
+ default: void 0
28
+ },
29
+ step: {
30
+ type: Number,
31
+ default: 1
32
+ },
33
+ stepStrictly: Boolean,
34
+ max: {
35
+ type: Number,
36
+ default: Number.POSITIVE_INFINITY
37
+ },
38
+ min: {
39
+ type: Number,
40
+ default: Number.NEGATIVE_INFINITY
41
+ },
42
+ modelValue: Number,
43
+ readonly: Boolean,
44
+ disabled: Boolean,
45
+ size: Ne,
46
+ controls: {
47
+ type: Boolean,
48
+ default: !0
49
+ },
50
+ controlsPosition: {
51
+ type: String,
52
+ default: "",
53
+ values: ["", "right"]
54
+ },
55
+ valueOnClear: {
56
+ type: [String, Number, null],
57
+ validator: (e) => e === null || X(e) || ["min", "max"].includes(e),
58
+ default: null
59
+ },
60
+ name: String,
61
+ label: String,
62
+ placeholder: String,
63
+ precision: {
64
+ type: Number,
65
+ validator: (e) => e >= 0 && e === Number.parseInt(`${e}`, 10)
66
+ },
67
+ validateEvent: {
68
+ type: Boolean,
69
+ default: !0
70
+ }
71
+ }), st = {
72
+ [Ve]: (e, l) => l !== e,
73
+ blur: (e) => e instanceof FocusEvent,
74
+ focus: (e) => e instanceof FocusEvent,
75
+ [D]: (e) => X(e) || ie(e),
76
+ [H]: (e) => X(e) || ie(e)
77
+ }, dt = ["aria-label", "onKeydown"], mt = ["aria-label", "onKeydown"], ct = te({
78
+ name: "ElInputNumber"
79
+ }), vt = /* @__PURE__ */ te({
80
+ ...ct,
81
+ props: it,
82
+ emits: st,
83
+ setup(e, { expose: l, emit: o }) {
84
+ const a = e, { t: c } = Fe(), i = pe("input-number"), u = ee(), d = Be({
85
+ currentValue: a.modelValue,
86
+ userInput: null
87
+ }), { formItem: y } = _e(), v = V(() => X(a.modelValue) && a.modelValue <= a.min), h = V(() => X(a.modelValue) && a.modelValue >= a.max), s = V(() => {
88
+ const n = Y(a.step);
89
+ return me(a.precision) ? Math.max(Y(a.modelValue), n) : (n > a.precision, a.precision);
90
+ }), C = V(() => a.controls && a.controlsPosition === "right"), F = Ke(), T = je(), z = V(() => {
91
+ if (d.userInput !== null)
92
+ return d.userInput;
93
+ let n = d.currentValue;
94
+ if (ie(n))
95
+ return "";
96
+ if (X(n)) {
97
+ if (Number.isNaN(n))
98
+ return "";
99
+ me(a.precision) || (n = n.toFixed(a.precision));
100
+ }
101
+ return n;
102
+ }), _ = (n, r) => {
103
+ if (me(r) && (r = s.value), r === 0)
104
+ return Math.round(n);
105
+ let b = String(n);
106
+ const N = b.indexOf(".");
107
+ if (N === -1 || !b.replace(".", "").split("")[N + r])
108
+ return n;
109
+ const M = b.length;
110
+ return b.charAt(M - 1) === "5" && (b = `${b.slice(0, Math.max(0, M - 1))}6`), Number.parseFloat(Number(b).toFixed(r));
111
+ }, Y = (n) => {
112
+ if (ie(n))
113
+ return 0;
114
+ const r = n.toString(), b = r.indexOf(".");
115
+ let N = 0;
116
+ return b !== -1 && (N = r.length - b - 1), N;
117
+ }, L = (n, r = 1) => X(n) ? _(n + a.step * r) : d.currentValue, K = () => {
118
+ if (a.readonly || T.value || h.value)
119
+ return;
120
+ const n = Number(z.value) || 0, r = L(n);
121
+ w(r), o(D, d.currentValue);
122
+ }, P = () => {
123
+ if (a.readonly || T.value || v.value)
124
+ return;
125
+ const n = Number(z.value) || 0, r = L(n, -1);
126
+ w(r), o(D, d.currentValue);
127
+ }, p = (n, r) => {
128
+ const { max: b, min: N, step: S, precision: B, stepStrictly: M, valueOnClear: A } = a;
129
+ b < N && Ye("InputNumber", "min should not be greater than max.");
130
+ let E = Number(n);
131
+ if (ie(n) || Number.isNaN(E))
132
+ return null;
133
+ if (n === "") {
134
+ if (A === null)
135
+ return null;
136
+ E = ke(A) ? { min: N, max: b }[A] : A;
137
+ }
138
+ return M && (E = _(Math.round(E / S) * S, B)), me(B) || (E = _(E, B)), (E > b || E < N) && (E = E > b ? b : N, r && o(H, E)), E;
139
+ }, w = (n, r = !0) => {
140
+ var b;
141
+ const N = d.currentValue, S = p(n);
142
+ if (!r) {
143
+ o(H, S);
144
+ return;
145
+ }
146
+ N !== S && (d.userInput = null, o(H, S), o(Ve, S, N), a.validateEvent && ((b = y == null ? void 0 : y.validate) == null || b.call(y, "change").catch((B) => be())), d.currentValue = S);
147
+ }, q = (n) => {
148
+ d.userInput = n;
149
+ const r = n === "" ? null : Number(n);
150
+ o(D, r), w(r, !1);
151
+ }, J = (n) => {
152
+ const r = n !== "" ? Number(n) : "";
153
+ (X(r) && !Number.isNaN(r) || n === "") && w(r), d.userInput = null;
154
+ }, W = () => {
155
+ var n, r;
156
+ (r = (n = u.value) == null ? void 0 : n.focus) == null || r.call(n);
157
+ }, G = () => {
158
+ var n, r;
159
+ (r = (n = u.value) == null ? void 0 : n.blur) == null || r.call(n);
160
+ }, g = (n) => {
161
+ o("focus", n);
162
+ }, k = (n) => {
163
+ var r;
164
+ o("blur", n), a.validateEvent && ((r = y == null ? void 0 : y.validate) == null || r.call(y, "blur").catch((b) => be()));
165
+ };
166
+ return se(() => a.modelValue, (n) => {
167
+ const r = p(d.userInput), b = p(n, !0);
168
+ !X(r) && (!r || r !== b) && (d.currentValue = b, d.userInput = null);
169
+ }, { immediate: !0 }), Xe(() => {
170
+ var n;
171
+ const { min: r, max: b, modelValue: N } = a, S = (n = u.value) == null ? void 0 : n.input;
172
+ if (S.setAttribute("role", "spinbutton"), Number.isFinite(b) ? S.setAttribute("aria-valuemax", String(b)) : S.removeAttribute("aria-valuemax"), Number.isFinite(r) ? S.setAttribute("aria-valuemin", String(r)) : S.removeAttribute("aria-valuemin"), S.setAttribute("aria-valuenow", String(d.currentValue)), S.setAttribute("aria-disabled", String(T.value)), !X(N) && N != null) {
173
+ let B = Number(N);
174
+ Number.isNaN(B) && (B = null), o(H, B);
175
+ }
176
+ }), et(() => {
177
+ var n;
178
+ const r = (n = u.value) == null ? void 0 : n.input;
179
+ r == null || r.setAttribute("aria-valuenow", `${d.currentValue}`);
180
+ }), l({
181
+ focus: W,
182
+ blur: G
183
+ }), (n, r) => (x(), O("div", {
184
+ class: U([
185
+ t(i).b(),
186
+ t(i).m(t(F)),
187
+ t(i).is("disabled", t(T)),
188
+ t(i).is("without-controls", !n.controls),
189
+ t(i).is("controls-right", t(C))
190
+ ]),
191
+ onDragstart: r[1] || (r[1] = ce(() => {
192
+ }, ["prevent"]))
193
+ }, [
194
+ n.controls ? Le((x(), O("span", {
195
+ key: 0,
196
+ role: "button",
197
+ "aria-label": t(c)("el.inputNumber.decrease"),
198
+ class: U([t(i).e("decrease"), t(i).is("disabled", t(v))]),
199
+ onKeydown: ve(P, ["enter"])
200
+ }, [
201
+ de(t(Pe), null, {
202
+ default: ge(() => [
203
+ t(C) ? (x(), Z(t(Ge), { key: 0 })) : (x(), Z(t(qe), { key: 1 }))
204
+ ]),
205
+ _: 1
206
+ })
207
+ ], 42, dt)), [
208
+ [t(Me), P]
209
+ ]) : ne("v-if", !0),
210
+ n.controls ? Le((x(), O("span", {
211
+ key: 1,
212
+ role: "button",
213
+ "aria-label": t(c)("el.inputNumber.increase"),
214
+ class: U([t(i).e("increase"), t(i).is("disabled", t(h))]),
215
+ onKeydown: ve(K, ["enter"])
216
+ }, [
217
+ de(t(Pe), null, {
218
+ default: ge(() => [
219
+ t(C) ? (x(), Z(t(Je), { key: 0 })) : (x(), Z(t(Qe), { key: 1 }))
220
+ ]),
221
+ _: 1
222
+ })
223
+ ], 42, mt)), [
224
+ [t(Me), K]
225
+ ]) : ne("v-if", !0),
226
+ de(t($e), {
227
+ id: n.id,
228
+ ref_key: "input",
229
+ ref: u,
230
+ type: "number",
231
+ step: n.step,
232
+ "model-value": t(z),
233
+ placeholder: n.placeholder,
234
+ readonly: n.readonly,
235
+ disabled: t(T),
236
+ size: t(F),
237
+ max: n.max,
238
+ min: n.min,
239
+ name: n.name,
240
+ label: n.label,
241
+ "validate-event": !1,
242
+ onWheel: r[0] || (r[0] = ce(() => {
243
+ }, ["prevent"])),
244
+ onKeydown: [
245
+ ve(ce(K, ["prevent"]), ["up"]),
246
+ ve(ce(P, ["prevent"]), ["down"])
247
+ ],
248
+ onBlur: k,
249
+ onFocus: g,
250
+ onInput: q,
251
+ onChange: J
252
+ }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
253
+ ], 34));
254
+ }
255
+ }), ft = /* @__PURE__ */ Ie(vt, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]), bt = Re(ft), Oe = Symbol("sliderContextKey"), gt = he({
256
+ modelValue: {
257
+ type: ue([Number, Array]),
258
+ default: 0
259
+ },
260
+ id: {
261
+ type: String,
262
+ default: void 0
263
+ },
264
+ min: {
265
+ type: Number,
266
+ default: 0
267
+ },
268
+ max: {
269
+ type: Number,
270
+ default: 100
271
+ },
272
+ step: {
273
+ type: Number,
274
+ default: 1
275
+ },
276
+ showInput: Boolean,
277
+ showInputControls: {
278
+ type: Boolean,
279
+ default: !0
280
+ },
281
+ size: Ne,
282
+ inputSize: Ne,
283
+ showStops: Boolean,
284
+ showTooltip: {
285
+ type: Boolean,
286
+ default: !0
287
+ },
288
+ formatTooltip: {
289
+ type: ue(Function),
290
+ default: void 0
291
+ },
292
+ disabled: Boolean,
293
+ range: Boolean,
294
+ vertical: Boolean,
295
+ height: String,
296
+ debounce: {
297
+ type: Number,
298
+ default: 300
299
+ },
300
+ label: {
301
+ type: String,
302
+ default: void 0
303
+ },
304
+ rangeStartLabel: {
305
+ type: String,
306
+ default: void 0
307
+ },
308
+ rangeEndLabel: {
309
+ type: String,
310
+ default: void 0
311
+ },
312
+ formatValueText: {
313
+ type: ue(Function),
314
+ default: void 0
315
+ },
316
+ tooltipClass: {
317
+ type: String,
318
+ default: void 0
319
+ },
320
+ placement: {
321
+ type: String,
322
+ values: ze,
323
+ default: "top"
324
+ },
325
+ marks: {
326
+ type: ue(Object)
327
+ },
328
+ validateEvent: {
329
+ type: Boolean,
330
+ default: !0
331
+ }
332
+ }), Se = (e) => X(e) || De(e) && e.every(X), yt = {
333
+ [H]: Se,
334
+ [D]: Se,
335
+ [Ve]: Se
336
+ }, Vt = (e, l, o) => {
337
+ const a = ee();
338
+ return Xe(async () => {
339
+ e.range ? (Array.isArray(e.modelValue) ? (l.firstValue = Math.max(e.min, e.modelValue[0]), l.secondValue = Math.min(e.max, e.modelValue[1])) : (l.firstValue = e.min, l.secondValue = e.max), l.oldValue = [l.firstValue, l.secondValue]) : (typeof e.modelValue != "number" || Number.isNaN(e.modelValue) ? l.firstValue = e.min : l.firstValue = Math.min(e.max, Math.max(e.min, e.modelValue)), l.oldValue = l.firstValue), Ze(window, "resize", o), await ye(), o();
340
+ }), {
341
+ sliderWrapper: a
342
+ };
343
+ }, ht = (e) => V(() => e.marks ? Object.keys(e.marks).map(Number.parseFloat).sort((o, a) => o - a).filter((o) => o <= e.max && o >= e.min).map((o) => ({
344
+ point: o,
345
+ position: (o - e.min) * 100 / (e.max - e.min),
346
+ mark: e.marks[o]
347
+ })) : []), pt = (e, l, o) => {
348
+ const { form: a, formItem: c } = _e(), i = at(), u = ee(), d = ee(), y = {
349
+ firstButton: u,
350
+ secondButton: d
351
+ }, v = V(() => e.disabled || (a == null ? void 0 : a.disabled) || !1), h = V(() => Math.min(l.firstValue, l.secondValue)), s = V(() => Math.max(l.firstValue, l.secondValue)), C = V(() => e.range ? `${100 * (s.value - h.value) / (e.max - e.min)}%` : `${100 * (l.firstValue - e.min) / (e.max - e.min)}%`), F = V(() => e.range ? `${100 * (h.value - e.min) / (e.max - e.min)}%` : "0%"), T = V(() => e.vertical ? { height: e.height } : {}), z = V(() => e.vertical ? {
352
+ height: C.value,
353
+ bottom: F.value
354
+ } : {
355
+ width: C.value,
356
+ left: F.value
357
+ }), _ = () => {
358
+ i.value && (l.sliderSize = i.value[`client${e.vertical ? "Height" : "Width"}`]);
359
+ }, Y = (g) => {
360
+ const k = e.min + g * (e.max - e.min) / 100;
361
+ if (!e.range)
362
+ return u;
363
+ let n;
364
+ return Math.abs(h.value - k) < Math.abs(s.value - k) ? n = l.firstValue < l.secondValue ? "firstButton" : "secondButton" : n = l.firstValue > l.secondValue ? "firstButton" : "secondButton", y[n];
365
+ }, L = (g) => {
366
+ const k = Y(g);
367
+ return k.value.setPosition(g), k;
368
+ }, K = (g) => {
369
+ l.firstValue = g, p(e.range ? [h.value, s.value] : g);
370
+ }, P = (g) => {
371
+ l.secondValue = g, e.range && p([h.value, s.value]);
372
+ }, p = (g) => {
373
+ o(H, g), o(D, g);
374
+ }, w = async () => {
375
+ await ye(), o(Ve, e.range ? [h.value, s.value] : e.modelValue);
376
+ }, q = (g) => {
377
+ var k, n, r, b, N, S;
378
+ if (v.value || l.dragging)
379
+ return;
380
+ _();
381
+ let B = 0;
382
+ if (e.vertical) {
383
+ const M = (r = (n = (k = g.touches) == null ? void 0 : k.item(0)) == null ? void 0 : n.clientY) != null ? r : g.clientY;
384
+ B = (i.value.getBoundingClientRect().bottom - M) / l.sliderSize * 100;
385
+ } else {
386
+ const M = (S = (N = (b = g.touches) == null ? void 0 : b.item(0)) == null ? void 0 : N.clientX) != null ? S : g.clientX, A = i.value.getBoundingClientRect().left;
387
+ B = (M - A) / l.sliderSize * 100;
388
+ }
389
+ if (!(B < 0 || B > 100))
390
+ return L(B);
391
+ };
392
+ return {
393
+ elFormItem: c,
394
+ slider: i,
395
+ firstButton: u,
396
+ secondButton: d,
397
+ sliderDisabled: v,
398
+ minValue: h,
399
+ maxValue: s,
400
+ runwayStyle: T,
401
+ barStyle: z,
402
+ resetSize: _,
403
+ setPosition: L,
404
+ emitChange: w,
405
+ onSliderWrapperPrevent: (g) => {
406
+ var k, n;
407
+ ((k = y.firstButton.value) != null && k.dragging || (n = y.secondButton.value) != null && n.dragging) && g.preventDefault();
408
+ },
409
+ onSliderClick: (g) => {
410
+ q(g) && w();
411
+ },
412
+ onSliderDown: async (g) => {
413
+ const k = q(g);
414
+ k && (await ye(), k.value.onButtonDown(g));
415
+ },
416
+ setFirstValue: K,
417
+ setSecondValue: P
418
+ };
419
+ }, { left: wt, down: St, right: Nt, up: kt, home: Et, end: It, pageUp: Bt, pageDown: xt } = We, Pt = (e, l, o) => {
420
+ const a = ee(), c = ee(!1), i = V(() => l.value instanceof Function), u = V(() => i.value && l.value(e.modelValue) || e.modelValue), d = Te(() => {
421
+ o.value && (c.value = !0);
422
+ }, 50), y = Te(() => {
423
+ o.value && (c.value = !1);
424
+ }, 50);
425
+ return {
426
+ tooltip: a,
427
+ tooltipVisible: c,
428
+ formatValue: u,
429
+ displayTooltip: d,
430
+ hideTooltip: y
431
+ };
432
+ }, Ct = (e, l, o) => {
433
+ const {
434
+ disabled: a,
435
+ min: c,
436
+ max: i,
437
+ step: u,
438
+ showTooltip: d,
439
+ precision: y,
440
+ sliderSize: v,
441
+ formatTooltip: h,
442
+ emitChange: s,
443
+ resetSize: C,
444
+ updateDragging: F
445
+ } = rt(Oe), { tooltip: T, tooltipVisible: z, formatValue: _, displayTooltip: Y, hideTooltip: L } = Pt(e, h, d), K = ee(), P = V(() => `${(e.modelValue - c.value) / (i.value - c.value) * 100}%`), p = V(() => e.vertical ? { bottom: P.value } : { left: P.value }), w = () => {
446
+ l.hovering = !0, Y();
447
+ }, q = () => {
448
+ l.hovering = !1, l.dragging || L();
449
+ }, J = (m) => {
450
+ a.value || (m.preventDefault(), B(m), window.addEventListener("mousemove", M), window.addEventListener("touchmove", M), window.addEventListener("mouseup", A), window.addEventListener("touchend", A), window.addEventListener("contextmenu", A), K.value.focus());
451
+ }, W = (m) => {
452
+ a.value || (l.newPosition = Number.parseFloat(P.value) + m / (i.value - c.value) * 100, E(l.newPosition), s());
453
+ }, G = () => {
454
+ W(-u.value);
455
+ }, g = () => {
456
+ W(u.value);
457
+ }, k = () => {
458
+ W(-u.value * 4);
459
+ }, n = () => {
460
+ W(u.value * 4);
461
+ }, r = () => {
462
+ a.value || (E(0), s());
463
+ }, b = () => {
464
+ a.value || (E(100), s());
465
+ }, N = (m) => {
466
+ let I = !0;
467
+ [wt, St].includes(m.key) ? G() : [Nt, kt].includes(m.key) ? g() : m.key === Et ? r() : m.key === It ? b() : m.key === xt ? k() : m.key === Bt ? n() : I = !1, I && m.preventDefault();
468
+ }, S = (m) => {
469
+ let I, $;
470
+ return m.type.startsWith("touch") ? ($ = m.touches[0].clientY, I = m.touches[0].clientX) : ($ = m.clientY, I = m.clientX), {
471
+ clientX: I,
472
+ clientY: $
473
+ };
474
+ }, B = (m) => {
475
+ l.dragging = !0, l.isClick = !0;
476
+ const { clientX: I, clientY: $ } = S(m);
477
+ e.vertical ? l.startY = $ : l.startX = I, l.startPosition = Number.parseFloat(P.value), l.newPosition = l.startPosition;
478
+ }, M = (m) => {
479
+ if (l.dragging) {
480
+ l.isClick = !1, Y(), C();
481
+ let I;
482
+ const { clientX: $, clientY: Q } = S(m);
483
+ e.vertical ? (l.currentY = Q, I = (l.startY - l.currentY) / v.value * 100) : (l.currentX = $, I = (l.currentX - l.startX) / v.value * 100), l.newPosition = l.startPosition + I, E(l.newPosition);
484
+ }
485
+ }, A = () => {
486
+ l.dragging && (setTimeout(() => {
487
+ l.dragging = !1, l.hovering || L(), l.isClick || E(l.newPosition), s();
488
+ }, 0), window.removeEventListener("mousemove", M), window.removeEventListener("touchmove", M), window.removeEventListener("mouseup", A), window.removeEventListener("touchend", A), window.removeEventListener("contextmenu", A));
489
+ }, E = async (m) => {
490
+ if (m === null || Number.isNaN(+m))
491
+ return;
492
+ m < 0 ? m = 0 : m > 100 && (m = 100);
493
+ const I = 100 / ((i.value - c.value) / u.value);
494
+ let Q = Math.round(m / I) * I * (i.value - c.value) * 0.01 + c.value;
495
+ Q = Number.parseFloat(Q.toFixed(y.value)), Q !== e.modelValue && o(H, Q), !l.dragging && e.modelValue !== l.oldValue && (l.oldValue = e.modelValue), await ye(), l.dragging && Y(), T.value.updatePopper();
496
+ };
497
+ return se(() => l.dragging, (m) => {
498
+ F(m);
499
+ }), {
500
+ disabled: a,
501
+ button: K,
502
+ tooltip: T,
503
+ tooltipVisible: z,
504
+ showTooltip: d,
505
+ wrapperStyle: p,
506
+ formatValue: _,
507
+ handleMouseEnter: w,
508
+ handleMouseLeave: q,
509
+ onButtonDown: J,
510
+ onKeyDown: N,
511
+ setPosition: E
512
+ };
513
+ }, Tt = (e, l, o, a) => ({
514
+ stops: V(() => {
515
+ if (!e.showStops || e.min > e.max)
516
+ return [];
517
+ if (e.step === 0)
518
+ return [];
519
+ const u = (e.max - e.min) / e.step, d = 100 * e.step / (e.max - e.min), y = Array.from({ length: u - 1 }).map((v, h) => (h + 1) * d);
520
+ return e.range ? y.filter((v) => v < 100 * (o.value - e.min) / (e.max - e.min) || v > 100 * (a.value - e.min) / (e.max - e.min)) : y.filter((v) => v > 100 * (l.firstValue - e.min) / (e.max - e.min));
521
+ }),
522
+ getStopStyle: (u) => e.vertical ? { bottom: `${u}%` } : { left: `${u}%` }
523
+ }), Lt = (e, l, o, a, c, i) => {
524
+ const u = (v) => {
525
+ c(H, v), c(D, v);
526
+ }, d = () => e.range ? ![o.value, a.value].every((v, h) => v === l.oldValue[h]) : e.modelValue !== l.oldValue, y = () => {
527
+ var v, h;
528
+ e.min > e.max && Ye("Slider", "min should not be greater than max.");
529
+ const s = e.modelValue;
530
+ e.range && Array.isArray(s) ? s[1] < e.min ? u([e.min, e.min]) : s[0] > e.max ? u([e.max, e.max]) : s[0] < e.min ? u([e.min, s[1]]) : s[1] > e.max ? u([s[0], e.max]) : (l.firstValue = s[0], l.secondValue = s[1], d() && (e.validateEvent && ((v = i == null ? void 0 : i.validate) == null || v.call(i, "change").catch((C) => be())), l.oldValue = s.slice())) : !e.range && typeof s == "number" && !Number.isNaN(s) && (s < e.min ? u(e.min) : s > e.max ? u(e.max) : (l.firstValue = s, d() && (e.validateEvent && ((h = i == null ? void 0 : i.validate) == null || h.call(i, "change").catch((C) => be())), l.oldValue = s)));
531
+ };
532
+ y(), se(() => l.dragging, (v) => {
533
+ v || y();
534
+ }), se(() => e.modelValue, (v, h) => {
535
+ l.dragging || Array.isArray(v) && Array.isArray(h) && v.every((s, C) => s === h[C]) && l.firstValue === v[0] && l.secondValue === v[1] || y();
536
+ }, {
537
+ deep: !0
538
+ }), se(() => [e.min, e.max], () => {
539
+ y();
540
+ });
541
+ }, Mt = he({
542
+ modelValue: {
543
+ type: Number,
544
+ default: 0
545
+ },
546
+ vertical: Boolean,
547
+ tooltipClass: String,
548
+ placement: {
549
+ type: String,
550
+ values: ze,
551
+ default: "top"
552
+ }
553
+ }), At = {
554
+ [H]: (e) => X(e)
555
+ }, Ft = ["tabindex"], zt = te({
556
+ name: "ElSliderButton"
557
+ }), _t = /* @__PURE__ */ te({
558
+ ...zt,
559
+ props: Mt,
560
+ emits: At,
561
+ setup(e, { expose: l, emit: o }) {
562
+ const a = e, c = pe("slider"), i = Be({
563
+ hovering: !1,
564
+ dragging: !1,
565
+ isClick: !1,
566
+ startX: 0,
567
+ currentX: 0,
568
+ startY: 0,
569
+ currentY: 0,
570
+ startPosition: 0,
571
+ newPosition: 0,
572
+ oldValue: a.modelValue
573
+ }), {
574
+ disabled: u,
575
+ button: d,
576
+ tooltip: y,
577
+ showTooltip: v,
578
+ tooltipVisible: h,
579
+ wrapperStyle: s,
580
+ formatValue: C,
581
+ handleMouseEnter: F,
582
+ handleMouseLeave: T,
583
+ onButtonDown: z,
584
+ onKeyDown: _,
585
+ setPosition: Y
586
+ } = Ct(a, i, o), { hovering: L, dragging: K } = Ee(i);
587
+ return l({
588
+ onButtonDown: z,
589
+ onKeyDown: _,
590
+ setPosition: Y,
591
+ hovering: L,
592
+ dragging: K
593
+ }), (P, p) => (x(), O("div", {
594
+ ref_key: "button",
595
+ ref: d,
596
+ class: U([t(c).e("button-wrapper"), { hover: t(L), dragging: t(K) }]),
597
+ style: le(t(s)),
598
+ tabindex: t(u) ? -1 : 0,
599
+ onMouseenter: p[0] || (p[0] = (...w) => t(F) && t(F)(...w)),
600
+ onMouseleave: p[1] || (p[1] = (...w) => t(T) && t(T)(...w)),
601
+ onMousedown: p[2] || (p[2] = (...w) => t(z) && t(z)(...w)),
602
+ onTouchstart: p[3] || (p[3] = (...w) => t(z) && t(z)(...w)),
603
+ onFocus: p[4] || (p[4] = (...w) => t(F) && t(F)(...w)),
604
+ onBlur: p[5] || (p[5] = (...w) => t(T) && t(T)(...w)),
605
+ onKeydown: p[6] || (p[6] = (...w) => t(_) && t(_)(...w))
606
+ }, [
607
+ de(t(Ue), {
608
+ ref_key: "tooltip",
609
+ ref: y,
610
+ visible: t(h),
611
+ placement: P.placement,
612
+ "fallback-placements": ["top", "bottom", "right", "left"],
613
+ "stop-popper-mouse-event": !1,
614
+ "popper-class": P.tooltipClass,
615
+ disabled: !t(v),
616
+ persistent: ""
617
+ }, {
618
+ content: ge(() => [
619
+ ae("span", null, tt(t(C)), 1)
620
+ ]),
621
+ default: ge(() => [
622
+ ae("div", {
623
+ class: U([t(c).e("button"), { hover: t(L), dragging: t(K) }])
624
+ }, null, 2)
625
+ ]),
626
+ _: 1
627
+ }, 8, ["visible", "placement", "popper-class", "disabled"])
628
+ ], 46, Ft));
629
+ }
630
+ }), Ae = /* @__PURE__ */ Ie(_t, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/button.vue"]]), Kt = he({
631
+ mark: {
632
+ type: ue([String, Object]),
633
+ default: void 0
634
+ }
635
+ }), Rt = te({
636
+ name: "ElSliderMarker",
637
+ props: Kt,
638
+ setup(e) {
639
+ const l = pe("slider"), o = V(() => ke(e.mark) ? e.mark : e.mark.label), a = V(() => ke(e.mark) ? void 0 : e.mark.style);
640
+ return () => lt("div", {
641
+ class: l.e("marks-text"),
642
+ style: a.value
643
+ }, o.value);
644
+ }
645
+ }), Yt = ["id", "role", "aria-label", "aria-labelledby"], Xt = { key: 1 }, Ot = te({
646
+ name: "ElSlider"
647
+ }), Ut = /* @__PURE__ */ te({
648
+ ...Ot,
649
+ props: gt,
650
+ emits: yt,
651
+ setup(e, { expose: l, emit: o }) {
652
+ const a = e, c = pe("slider"), { t: i } = Fe(), u = Be({
653
+ firstValue: 0,
654
+ secondValue: 0,
655
+ oldValue: 0,
656
+ dragging: !1,
657
+ sliderSize: 1
658
+ }), {
659
+ elFormItem: d,
660
+ slider: y,
661
+ firstButton: v,
662
+ secondButton: h,
663
+ sliderDisabled: s,
664
+ minValue: C,
665
+ maxValue: F,
666
+ runwayStyle: T,
667
+ barStyle: z,
668
+ resetSize: _,
669
+ emitChange: Y,
670
+ onSliderWrapperPrevent: L,
671
+ onSliderClick: K,
672
+ onSliderDown: P,
673
+ setFirstValue: p,
674
+ setSecondValue: w
675
+ } = pt(a, u, o), { stops: q, getStopStyle: J } = Tt(a, u, C, F), { inputId: W, isLabeledByFormItem: G } = He(a, {
676
+ formItemContext: d
677
+ }), g = Ke(), k = V(() => a.inputSize || g.value), n = V(() => a.label || i("el.slider.defaultLabel", {
678
+ min: a.min,
679
+ max: a.max
680
+ })), r = V(() => a.range ? a.rangeStartLabel || i("el.slider.defaultRangeStartLabel") : n.value), b = V(() => a.formatValueText ? a.formatValueText(m.value) : `${m.value}`), N = V(() => a.rangeEndLabel || i("el.slider.defaultRangeEndLabel")), S = V(() => a.formatValueText ? a.formatValueText(I.value) : `${I.value}`), B = V(() => [
681
+ c.b(),
682
+ c.m(g.value),
683
+ c.is("vertical", a.vertical),
684
+ { [c.m("with-input")]: a.showInput }
685
+ ]), M = ht(a);
686
+ Lt(a, u, C, F, o, d);
687
+ const A = V(() => {
688
+ const f = [a.min, a.max, a.step].map((j) => {
689
+ const re = `${j}`.split(".")[1];
690
+ return re ? re.length : 0;
691
+ });
692
+ return Math.max.apply(null, f);
693
+ }), { sliderWrapper: E } = Vt(a, u, _), { firstValue: m, secondValue: I, sliderSize: $ } = Ee(u), Q = (f) => {
694
+ u.dragging = f;
695
+ };
696
+ return nt(Oe, {
697
+ ...Ee(a),
698
+ sliderSize: $,
699
+ disabled: s,
700
+ precision: A,
701
+ emitChange: Y,
702
+ resetSize: _,
703
+ updateDragging: Q
704
+ }), l({
705
+ onSliderClick: K
706
+ }), (f, j) => {
707
+ var re, xe;
708
+ return x(), O("div", {
709
+ id: f.range ? t(W) : void 0,
710
+ ref_key: "sliderWrapper",
711
+ ref: E,
712
+ class: U(t(B)),
713
+ role: f.range ? "group" : void 0,
714
+ "aria-label": f.range && !t(G) ? t(n) : void 0,
715
+ "aria-labelledby": f.range && t(G) ? (re = t(d)) == null ? void 0 : re.labelId : void 0,
716
+ onTouchstart: j[2] || (j[2] = (...R) => t(L) && t(L)(...R)),
717
+ onTouchmove: j[3] || (j[3] = (...R) => t(L) && t(L)(...R))
718
+ }, [
719
+ ae("div", {
720
+ ref_key: "slider",
721
+ ref: y,
722
+ class: U([
723
+ t(c).e("runway"),
724
+ { "show-input": f.showInput && !f.range },
725
+ t(c).is("disabled", t(s))
726
+ ]),
727
+ style: le(t(T)),
728
+ onMousedown: j[0] || (j[0] = (...R) => t(P) && t(P)(...R)),
729
+ onTouchstart: j[1] || (j[1] = (...R) => t(P) && t(P)(...R))
730
+ }, [
731
+ ae("div", {
732
+ class: U(t(c).e("bar")),
733
+ style: le(t(z))
734
+ }, null, 6),
735
+ de(Ae, {
736
+ id: f.range ? void 0 : t(W),
737
+ ref_key: "firstButton",
738
+ ref: v,
739
+ "model-value": t(m),
740
+ vertical: f.vertical,
741
+ "tooltip-class": f.tooltipClass,
742
+ placement: f.placement,
743
+ role: "slider",
744
+ "aria-label": f.range || !t(G) ? t(r) : void 0,
745
+ "aria-labelledby": !f.range && t(G) ? (xe = t(d)) == null ? void 0 : xe.labelId : void 0,
746
+ "aria-valuemin": f.min,
747
+ "aria-valuemax": f.range ? t(I) : f.max,
748
+ "aria-valuenow": t(m),
749
+ "aria-valuetext": t(b),
750
+ "aria-orientation": f.vertical ? "vertical" : "horizontal",
751
+ "aria-disabled": t(s),
752
+ "onUpdate:modelValue": t(p)
753
+ }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]),
754
+ f.range ? (x(), Z(Ae, {
755
+ key: 0,
756
+ ref_key: "secondButton",
757
+ ref: h,
758
+ "model-value": t(I),
759
+ vertical: f.vertical,
760
+ "tooltip-class": f.tooltipClass,
761
+ placement: f.placement,
762
+ role: "slider",
763
+ "aria-label": t(N),
764
+ "aria-valuemin": t(m),
765
+ "aria-valuemax": f.max,
766
+ "aria-valuenow": t(I),
767
+ "aria-valuetext": t(S),
768
+ "aria-orientation": f.vertical ? "vertical" : "horizontal",
769
+ "aria-disabled": t(s),
770
+ "onUpdate:modelValue": t(w)
771
+ }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : ne("v-if", !0),
772
+ f.showStops ? (x(), O("div", Xt, [
773
+ (x(!0), O(fe, null, we(t(q), (R, oe) => (x(), O("div", {
774
+ key: oe,
775
+ class: U(t(c).e("stop")),
776
+ style: le(t(J)(R))
777
+ }, null, 6))), 128))
778
+ ])) : ne("v-if", !0),
779
+ t(M).length > 0 ? (x(), O(fe, { key: 2 }, [
780
+ ae("div", null, [
781
+ (x(!0), O(fe, null, we(t(M), (R, oe) => (x(), O("div", {
782
+ key: oe,
783
+ style: le(t(J)(R.position)),
784
+ class: U([t(c).e("stop"), t(c).e("marks-stop")])
785
+ }, null, 6))), 128))
786
+ ]),
787
+ ae("div", {
788
+ class: U(t(c).e("marks"))
789
+ }, [
790
+ (x(!0), O(fe, null, we(t(M), (R, oe) => (x(), Z(t(Rt), {
791
+ key: oe,
792
+ mark: R.mark,
793
+ style: le(t(J)(R.position))
794
+ }, null, 8, ["mark", "style"]))), 128))
795
+ ], 2)
796
+ ], 64)) : ne("v-if", !0)
797
+ ], 38),
798
+ f.showInput && !f.range ? (x(), Z(t(bt), {
799
+ key: 0,
800
+ ref: "input",
801
+ "model-value": t(m),
802
+ class: U(t(c).e("input")),
803
+ step: f.step,
804
+ disabled: t(s),
805
+ controls: f.showInputControls,
806
+ min: f.min,
807
+ max: f.max,
808
+ debounce: f.debounce,
809
+ size: t(k),
810
+ "onUpdate:modelValue": t(p),
811
+ onChange: t(Y)
812
+ }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : ne("v-if", !0)
813
+ ], 42, Yt);
814
+ };
815
+ }
816
+ }), Wt = /* @__PURE__ */ Ie(Ut, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/slider/src/slider.vue"]]), Qt = Re(Wt);
2
817
  export {
3
- o as default
818
+ bt as ElInputNumber,
819
+ Qt as ElSlider,
820
+ st as inputNumberEmits,
821
+ it as inputNumberProps,
822
+ Oe as sliderContextKey,
823
+ yt as sliderEmits,
824
+ gt as sliderProps,
825
+ Me as vRepeatClick
4
826
  };