@vunk/form 2.19.20 → 2.19.21

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 (197) hide show
  1. package/components/ai-provider/index.cjs +1 -0
  2. package/components/ai-provider/index.d.ts +7 -0
  3. package/components/ai-provider/index.mjs +61 -0
  4. package/components/ai-provider/src/ctx.d.ts +8 -0
  5. package/components/ai-provider/src/index.vue.d.ts +23 -0
  6. package/components/ai-provider/src/types.d.ts +56 -0
  7. package/components/ai-provider/src/use.d.ts +3 -0
  8. package/components/api-tables-select/index.cjs +1 -1
  9. package/components/api-tables-select/index.mjs +1 -1
  10. package/components/api-tables-select/src/ctx.d.ts +57 -57
  11. package/components/api-tables-select/src/index.vue.d.ts +46 -419
  12. package/components/button/index.cjs +1 -1
  13. package/components/button/index.mjs +12 -12
  14. package/components/button/src/ctx.d.ts +7 -2
  15. package/components/button/src/index.vue.d.ts +36 -14
  16. package/components/card-input-collection/index.cjs +1 -1
  17. package/components/card-input-collection/index.mjs +136 -141
  18. package/components/card-input-collection/src/core.vue.d.ts +18 -7
  19. package/components/card-input-collection/src/ctx.d.ts +7 -2
  20. package/components/card-input-collection/src/index.vue.d.ts +18 -7
  21. package/components/cascader/index.cjs +1 -1
  22. package/components/cascader/index.mjs +38 -39
  23. package/components/cascader/src/ctx.d.ts +8 -3
  24. package/components/cascader/src/index.vue.d.ts +19 -8
  25. package/components/checkbox/src/ctx.d.ts +8 -3
  26. package/components/checkbox/src/index.vue.d.ts +43 -21
  27. package/components/{cloneDeep-DE0l40hv.mjs → cloneDeep-2YeQ7w2t.mjs} +10 -10
  28. package/components/cloneDeep-Btpy0oPF.js +1 -0
  29. package/components/collapse/index.cjs +1 -1
  30. package/components/collapse/index.mjs +19 -22
  31. package/components/collapse-item/index.cjs +1 -1
  32. package/components/collapse-item/index.mjs +21 -21
  33. package/components/collapse-item/src/index.vue.d.ts +2 -2
  34. package/components/color-picker/index.cjs +1 -1
  35. package/components/color-picker/index.mjs +26 -27
  36. package/components/color-picker/src/ctx.d.ts +7 -2
  37. package/components/color-picker/src/index.vue.d.ts +17 -6
  38. package/components/{style.css → components.css} +1 -1
  39. package/components/date-picker/index.cjs +1 -1
  40. package/components/date-picker/index.mjs +40 -41
  41. package/components/date-picker/src/ctx.d.ts +8 -3
  42. package/components/date-picker/src/index.vue.d.ts +17 -6
  43. package/components/date-picker-range/index.cjs +1 -1
  44. package/components/date-picker-range/index.mjs +17 -17
  45. package/components/date-picker-range/src/ctx.d.ts +14 -9
  46. package/components/date-picker-range/src/index.vue.d.ts +48 -26
  47. package/components/dialog/index.cjs +1 -1
  48. package/components/dialog/index.mjs +41 -52
  49. package/components/dialog/src/ctx.d.ts +1 -1
  50. package/components/dialog/src/index.vue.d.ts +1 -1
  51. package/components/dialog-input-collection/index.cjs +1 -1
  52. package/components/dialog-input-collection/index.mjs +124 -122
  53. package/components/dialog-input-collection/src/ctx.d.ts +7 -2
  54. package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1 -1
  55. package/components/dialog-input-collection/src/index.vue.d.ts +17 -6
  56. package/components/download-plus/index.cjs +1 -1
  57. package/components/download-plus/index.mjs +193 -202
  58. package/components/download-plus/src/ctx.d.ts +7 -2
  59. package/components/download-plus/src/index.vue.d.ts +32 -10
  60. package/components/editable-text/index.cjs +1 -1
  61. package/components/editable-text/index.mjs +72 -75
  62. package/components/editable-text/src/ctx.d.ts +7 -2
  63. package/components/editable-text/src/index.vue.d.ts +18 -7
  64. package/components/el-slider/index.cjs +1 -1
  65. package/components/el-slider/index.mjs +230 -233
  66. package/components/el-slider/src/composables/index.cjs +1 -1
  67. package/components/el-slider/src/composables/index.mjs +1 -1
  68. package/components/el-slider/src/slider-core.vue.d.ts +3 -3
  69. package/components/esri-input-geojson/index.cjs +1 -5
  70. package/components/esri-input-geojson/index.mjs +59 -68
  71. package/components/esri-input-geojson/src/append.vue.d.ts +2 -2
  72. package/components/esri-input-geojson/src/ctx.d.ts +9 -4
  73. package/components/esri-input-geojson/src/index.vue.d.ts +65 -30
  74. package/components/fieldset/src/index.vue.d.ts +1 -1
  75. package/components/form/index.cjs +1 -1
  76. package/components/form/index.mjs +96 -101
  77. package/components/form/src/ctx.d.ts +2 -2
  78. package/components/form/src/index.vue.d.ts +4 -4
  79. package/components/form/src/use.d.ts +2 -2
  80. package/components/form-item/index.cjs +1 -1
  81. package/components/form-item/index.mjs +179 -107
  82. package/components/form-item/src/core.vue.d.ts +7 -3
  83. package/components/form-item/src/ctx.d.ts +7 -1
  84. package/components/form-item/src/index.vue.d.ts +13 -2
  85. package/components/form-item/src/use.d.ts +11 -0
  86. package/components/form-item-renderer/index.cjs +1 -1
  87. package/components/form-item-renderer/index.d.ts +1 -0
  88. package/components/form-item-renderer/index.mjs +85 -78
  89. package/components/form-item-renderer/src/use.d.ts +3 -0
  90. package/components/forms-provider/index.cjs +1 -1
  91. package/components/forms-provider/index.mjs +18 -21
  92. package/components/index-BIo_4rr_.mjs +18620 -0
  93. package/components/index-Bc7UifHG.js +1 -0
  94. package/components/index-D0D9ABpH.js +108 -0
  95. package/components/{index-CeHbpfCD.mjs → index-DCNYT7Wv.mjs} +0 -1
  96. package/components/information-collection/index.cjs +1 -1
  97. package/components/information-collection/index.mjs +32 -38
  98. package/components/information-collection/src/ctx.d.ts +7 -2
  99. package/components/information-collection/src/index.vue.d.ts +17 -6
  100. package/components/information-tag/index.cjs +1 -1
  101. package/components/information-tag/index.mjs +9 -12
  102. package/components/information-tag/src/index.vue.d.ts +1 -1
  103. package/components/input/index.cjs +1 -1
  104. package/components/input/index.mjs +27 -27
  105. package/components/input/src/ctx.d.ts +9 -4
  106. package/components/input/src/index.vue.d.ts +35 -13
  107. package/components/input-array/index.cjs +1 -1
  108. package/components/input-array/index.mjs +71 -74
  109. package/components/input-array/src/ctx.d.ts +7 -2
  110. package/components/input-array/src/index.vue.d.ts +18 -7
  111. package/components/input-collection/index.cjs +1 -1
  112. package/components/input-collection/index.mjs +121 -126
  113. package/components/input-collection/src/core.vue.d.ts +17 -6
  114. package/components/input-collection/src/ctx.d.ts +7 -2
  115. package/components/input-collection/src/index.vue.d.ts +17 -6
  116. package/components/input-file/src/index.vue.d.ts +19 -8
  117. package/components/input-link/index.cjs +1 -1
  118. package/components/input-link/index.mjs +1 -1
  119. package/components/input-link/src/ctx.d.ts +7 -2
  120. package/components/input-link/src/index.vue.d.ts +54 -21
  121. package/components/input-number/index.cjs +1 -1
  122. package/components/input-number/index.mjs +30 -33
  123. package/components/input-number/src/ctx.d.ts +8 -3
  124. package/components/input-number/src/index.vue.d.ts +33 -11
  125. package/components/input-tag/index.cjs +1 -1
  126. package/components/input-tag/index.mjs +24 -24
  127. package/components/input-tag/src/ctx.d.ts +9 -4
  128. package/components/input-tag/src/index.vue.d.ts +33 -11
  129. package/components/monaco-editor/src/ctx.d.ts +8 -3
  130. package/components/monaco-editor/src/index.vue.d.ts +38 -16
  131. package/components/radio/src/ctx.d.ts +7 -2
  132. package/components/radio/src/index.vue.d.ts +40 -18
  133. package/components/radio/src/wraper.vue.d.ts +22 -11
  134. package/components/renderer-data/index.cjs +1 -1
  135. package/components/renderer-data/index.mjs +14 -17
  136. package/components/select/index.cjs +1 -1
  137. package/components/select/index.mjs +167 -131
  138. package/components/select/src/core.vue.d.ts +96 -69
  139. package/components/select/src/ctx.d.ts +9 -4
  140. package/components/select/src/index.vue.d.ts +53 -42
  141. package/components/slider/index.cjs +1 -1
  142. package/components/slider/index.mjs +30 -31
  143. package/components/slider/src/ctx.d.ts +7 -2
  144. package/components/slider/src/index.vue.d.ts +18 -7
  145. package/components/switch/src/ctx.d.ts +7 -2
  146. package/components/switch/src/index.vue.d.ts +18 -7
  147. package/components/tables-select/index.cjs +1 -1
  148. package/components/tables-select/index.mjs +4 -4
  149. package/components/tables-select/src/ctx.d.ts +68 -68
  150. package/components/tables-select/src/index.vue.d.ts +52 -420
  151. package/components/template-instances-provider/index.cjs +1 -1
  152. package/components/template-instances-provider/index.mjs +11 -17
  153. package/components/templates-default/src/index.vue.d.ts +404 -185
  154. package/components/templates-esri/src/index.vue.d.ts +65 -30
  155. package/components/templates-variant/src/index.vue.d.ts +48 -26
  156. package/components/time-picker/index.cjs +1 -1
  157. package/components/time-picker/index.mjs +38 -39
  158. package/components/time-picker/src/ctx.d.ts +8 -3
  159. package/components/time-picker/src/index.vue.d.ts +17 -6
  160. package/components/upload/index.cjs +1 -1
  161. package/components/upload/index.mjs +244 -253
  162. package/components/upload/src/ctx.d.ts +8 -3
  163. package/components/upload/src/file.vue.d.ts +3 -3
  164. package/components/upload/src/index.vue.d.ts +37 -15
  165. package/components/upload/src/wraper.vue.d.ts +19 -8
  166. package/components/upload-plus/index.cjs +7 -15
  167. package/components/upload-plus/index.mjs +1879 -1897
  168. package/components/upload-plus/src/ctx.d.ts +7 -2
  169. package/components/upload-plus/src/index.vue.d.ts +18 -7
  170. package/components/use-watch-C3iIa2DX.js +1 -0
  171. package/components/use-watch-Dp64x0si.mjs +411 -0
  172. package/components/van-cascader/src/ctx.d.ts +7 -2
  173. package/components/van-cascader/src/index.vue.d.ts +19 -8
  174. package/components/var-datetime-picker/src/ctx.d.ts +7 -2
  175. package/components/var-datetime-picker/src/index.vue.d.ts +30 -8
  176. package/components/vditor/src/ctx.d.ts +7 -2
  177. package/components/vditor/src/index.vue.d.ts +41 -19
  178. package/composables/element-plus/index.cjs +1 -1
  179. package/composables/element-plus/index.mjs +10 -10
  180. package/composables/form-mitt/index.mjs +1 -1
  181. package/composables/index.cjs +1 -1
  182. package/composables/index.mjs +53 -53
  183. package/index.css +1 -1
  184. package/locale/index.cjs +1 -1
  185. package/locale/index.mjs +8 -5
  186. package/locale/lang/ar.d.ts +1 -0
  187. package/locale/lang/en.d.ts +1 -0
  188. package/locale/lang/zh-cn.d.ts +1 -0
  189. package/package.json +9 -1
  190. package/shared/element-plus/ctx.d.ts +16 -16
  191. package/shared/types/source/index.d.ts +5 -0
  192. package/shared/upload/index.cjs +1 -1
  193. package/shared/upload/index.mjs +166 -165
  194. package/components/cloneDeep-DaYwfXwD.js +0 -1
  195. package/components/index-BBriTmQP.js +0 -1
  196. package/components/use-watch-Bfrz9pv_.js +0 -1
  197. package/components/use-watch-t49wP7jy.mjs +0 -414
@@ -1,414 +0,0 @@
1
- import { watch as j, getCurrentScope as re, onScopeDispose as ce, computed as b, toValue as q, unref as fe, ref as R, onMounted as de, nextTick as J, watchEffect as ve, shallowRef as me, inject as ge } from "vue";
2
- import { useFormItem as he, useFormDisabled as Ve, CHANGE_EVENT as be, UPDATE_MODEL_EVENT as I, INPUT_EVENT as ue, EVENT_CODE as N } from "element-plus";
3
- import { t as Z, d as ne } from "./debounce-DIph5ENi.mjs";
4
- import { noop as le } from "@vunk/shared/function";
5
- function ye(e, t, l) {
6
- return e === e && (l !== void 0 && (e = e <= l ? e : l), t !== void 0 && (e = e >= t ? e : t)), e;
7
- }
8
- function we(e, t, l) {
9
- return l === void 0 && (l = t, t = void 0), l !== void 0 && (l = Z(l), l = l === l ? l : 0), t !== void 0 && (t = Z(t), t = t === t ? t : 0), ye(Z(e), t, l);
10
- }
11
- function ke(e) {
12
- return re() ? (ce(e), !0) : !1;
13
- }
14
- const Se = typeof window < "u" && typeof document < "u";
15
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
16
- const xe = Object.prototype.toString, Ee = (e) => xe.call(e) === "[object Object]";
17
- function F(e) {
18
- return Array.isArray(e) ? e : [e];
19
- }
20
- function Me(e, t, l) {
21
- return j(
22
- e,
23
- t,
24
- {
25
- ...l,
26
- immediate: !0
27
- }
28
- );
29
- }
30
- const Ne = Se ? window : void 0;
31
- function Pe(e) {
32
- var t;
33
- const l = q(e);
34
- return (t = l == null ? void 0 : l.$el) != null ? t : l;
35
- }
36
- function ae(...e) {
37
- const t = [], l = () => {
38
- t.forEach((r) => r()), t.length = 0;
39
- }, f = (r, d, n, c) => (r.addEventListener(d, n, c), () => r.removeEventListener(d, n, c)), i = b(() => {
40
- const r = F(q(e[0])).filter((d) => d != null);
41
- return r.every((d) => typeof d != "string") ? r : void 0;
42
- }), u = Me(
43
- () => {
44
- var r, d;
45
- return [
46
- (d = (r = i.value) == null ? void 0 : r.map((n) => Pe(n))) != null ? d : [Ne].filter((n) => n != null),
47
- F(q(i.value ? e[1] : e[0])),
48
- F(fe(i.value ? e[2] : e[1])),
49
- // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
50
- q(i.value ? e[3] : e[2])
51
- ];
52
- },
53
- ([r, d, n, c]) => {
54
- if (l(), !(r != null && r.length) || !(d != null && d.length) || !(n != null && n.length))
55
- return;
56
- const h = Ee(c) ? { ...c } : c;
57
- t.push(
58
- ...r.flatMap(
59
- (y) => d.flatMap(
60
- (P) => n.map((A) => f(y, P, A, h))
61
- )
62
- )
63
- );
64
- },
65
- { flush: "post" }
66
- ), a = () => {
67
- u(), l();
68
- };
69
- return ke(l), a;
70
- }
71
- const Ce = Symbol("sliderContextKey"), Ye = (e, t, l) => {
72
- const f = R();
73
- return de(async () => {
74
- e.range ? (Array.isArray(e.modelValue) ? (t.firstValue = Math.max(e.min, e.modelValue[0]), t.secondValue = Math.min(e.max, e.modelValue[1])) : (t.firstValue = e.min, t.secondValue = e.max), t.oldValue = [t.firstValue, t.secondValue]) : (typeof e.modelValue != "number" || Number.isNaN(e.modelValue) ? t.firstValue = e.min : t.firstValue = Math.min(
75
- e.max,
76
- Math.max(e.min, e.modelValue)
77
- ), t.oldValue = t.firstValue), ae(window, "resize", l), await J(), l();
78
- }), {
79
- sliderWrapper: f
80
- };
81
- }, Ke = (e) => {
82
- const t = b(() => e.marks ? Object.keys(e.marks).map(Number.parseFloat).sort((f, i) => f - i).filter((f) => f <= e.max && f >= e.min).map(
83
- (f) => ({
84
- point: f,
85
- position: (f - e.min) * 100 / (e.max - e.min),
86
- mark: e.marks[f]
87
- })
88
- ) : []);
89
- return ve(() => {
90
- if (e.step === "mark" && !e.marks && console.warn("[ElSlider] marks prop must be provided when step is mark"), e.marks) {
91
- const l = Object.keys(e.marks), f = t.value.map((u) => u.point), i = l.filter((u) => {
92
- const a = Number.parseFloat(u);
93
- return Number.isNaN(a) || !f.includes(a);
94
- });
95
- i.length > 0 && console.warn(
96
- `[ElSlider] Some marks keys are invalid (not a number or out of [min, max]): [${i.map((u) => `'${u}'`).join(", ")}] and will be ignored.`
97
- );
98
- }
99
- }), t;
100
- }, Oe = (e, t, l, f) => {
101
- const { formItem: i } = he(), u = me(), a = R(), r = R(), d = {
102
- firstButton: a,
103
- secondButton: r
104
- }, n = Ve(), c = b(() => Math.min(t.firstValue, t.secondValue)), h = b(() => Math.max(t.firstValue, t.secondValue)), y = b(() => e.range ? `${100 * (h.value - c.value) / (e.max - e.min)}%` : `${100 * (t.firstValue - e.min) / (e.max - e.min)}%`), P = b(() => e.range ? `${100 * (c.value - e.min) / (e.max - e.min)}%` : "0%"), A = b(() => e.vertical ? { height: e.height } : {}), k = b(() => e.vertical ? {
105
- height: y.value,
106
- bottom: P.value
107
- } : f.value ? {
108
- width: y.value,
109
- left: "auto",
110
- right: P.value
111
- } : {
112
- width: y.value,
113
- left: P.value
114
- }), X = () => {
115
- if (u.value) {
116
- const s = u.value.getBoundingClientRect();
117
- t.sliderSize = s[e.vertical ? "height" : "width"];
118
- }
119
- }, z = (s) => {
120
- const v = e.min + s * (e.max - e.min) / 100;
121
- if (!e.range)
122
- return a;
123
- let V;
124
- return Math.abs(c.value - v) < Math.abs(h.value - v) ? V = t.firstValue < t.secondValue ? "firstButton" : "secondButton" : V = t.firstValue > t.secondValue ? "firstButton" : "secondButton", d[V];
125
- }, Y = (s) => {
126
- const v = z(s);
127
- return v.value.setPosition(s), v;
128
- }, Q = (s) => {
129
- t.firstValue = s ?? e.min;
130
- const v = e.range ? [c.value, h.value] : s ?? e.min;
131
- O(v);
132
- }, K = (s) => {
133
- t.secondValue = s, e.range && O([c.value, h.value]);
134
- }, O = (s) => {
135
- l(I, s), l(ue, s);
136
- }, C = async () => {
137
- await J(), l(
138
- be,
139
- e.range ? [c.value, h.value] : e.modelValue
140
- );
141
- }, M = (s) => {
142
- var V, U, G, _;
143
- if (n.value || t.dragging) return;
144
- X();
145
- let v = 0;
146
- if (e.vertical) {
147
- const B = ((U = (V = s.touches) == null ? void 0 : V.item(0)) == null ? void 0 : U.clientY) ?? s.clientY;
148
- v = (u.value.getBoundingClientRect().bottom - B) / t.sliderSize * 100;
149
- } else {
150
- const B = ((_ = (G = s.touches) == null ? void 0 : G.item(0)) == null ? void 0 : _.clientX) ?? s.clientX, $ = u.value.getBoundingClientRect();
151
- f.value ? v = ($.right - B) / t.sliderSize * 100 : v = (B - $.left) / t.sliderSize * 100;
152
- }
153
- if (!(v < 0 || v > 100))
154
- return Y(v);
155
- };
156
- return {
157
- elFormItem: i,
158
- slider: u,
159
- firstButton: a,
160
- secondButton: r,
161
- sliderDisabled: n,
162
- minValue: c,
163
- maxValue: h,
164
- runwayStyle: A,
165
- barStyle: k,
166
- resetSize: X,
167
- setPosition: Y,
168
- emitChange: C,
169
- onSliderWrapperPrevent: (s) => {
170
- var v, V;
171
- ((v = d.firstButton.value) != null && v.dragging || (V = d.secondButton.value) != null && V.dragging) && s.preventDefault();
172
- },
173
- onSliderClick: (s) => {
174
- M(s) && C();
175
- },
176
- onSliderDown: async (s) => {
177
- const v = M(s);
178
- v && (await J(), v.value.onButtonDown(s));
179
- },
180
- onSliderMarkerDown: (s) => {
181
- if (n.value || t.dragging) return;
182
- Y(s) && C();
183
- },
184
- setFirstValue: Q,
185
- setSecondValue: K
186
- };
187
- }, Le = (e) => e.code || e.key, Be = (e, t, l) => {
188
- const f = R(), i = R(!1), u = b(() => t.value instanceof Function), a = b(() => u.value && t.value(e.modelValue) || e.modelValue), r = ne(() => {
189
- l.value && (i.value = !0);
190
- }, 50), d = ne(() => {
191
- l.value && (i.value = !1);
192
- }, 50);
193
- return {
194
- tooltip: f,
195
- tooltipVisible: i,
196
- formatValue: a,
197
- displayTooltip: r,
198
- hideTooltip: d
199
- };
200
- }, We = (e, t, l) => {
201
- const {
202
- disabled: f,
203
- min: i,
204
- max: u,
205
- step: a,
206
- showTooltip: r,
207
- persistent: d,
208
- precision: n,
209
- sliderSize: c,
210
- formatTooltip: h,
211
- emitChange: y,
212
- resetSize: P,
213
- updateDragging: A,
214
- markList: k,
215
- isRtl: X
216
- } = ge(Ce), { tooltip: z, tooltipVisible: Y, formatValue: Q, displayTooltip: K, hideTooltip: O } = Be(e, h, r), C = R(), M = b(() => `${(e.modelValue - i.value) / (u.value - i.value) * 100}%`), D = b(() => e.vertical ? { bottom: M.value } : X.value ? { right: M.value } : { left: M.value }), W = b(() => a.value === "mark" && k.value.length > 0), p = () => {
217
- t.hovering = !0, K();
218
- }, ee = () => {
219
- t.hovering = !1, t.dragging || O();
220
- }, s = (o) => {
221
- f.value || (o.preventDefault(), ie(o), window.addEventListener("mousemove", H), window.addEventListener("touchmove", H), window.addEventListener("mouseup", T), window.addEventListener("touchend", T), window.addEventListener("contextmenu", T), C.value.focus());
222
- }, v = (o) => {
223
- f.value || (t.newPosition = Number.parseFloat(M.value) + o / (u.value - i.value) * 100, L(t.newPosition), y());
224
- }, V = (o) => {
225
- if (f.value || !k.value.length) return;
226
- const m = e.modelValue, g = Number.EPSILON, S = Math.abs(o);
227
- let w;
228
- if (o > 0) {
229
- const E = k.value.findIndex(
230
- (x) => x.point > m + g
231
- );
232
- if (E !== -1) {
233
- const x = Math.min(
234
- E + S - 1,
235
- k.value.length - 1
236
- );
237
- w = k.value[x].point;
238
- }
239
- } else {
240
- let E = -1;
241
- for (let x = k.value.length - 1; x >= 0; x--)
242
- if (k.value[x].point < m - g) {
243
- E = x;
244
- break;
245
- }
246
- if (E !== -1) {
247
- const x = Math.max(E - (S - 1), 0);
248
- w = k.value[x].point;
249
- }
250
- }
251
- if (w !== void 0 && w !== m) {
252
- const E = (w - i.value) / (u.value - i.value) * 100;
253
- L(E), y();
254
- }
255
- }, U = () => {
256
- W.value ? V(-1) : typeof a.value == "number" && v(-a.value);
257
- }, G = () => {
258
- W.value ? V(1) : typeof a.value == "number" && v(a.value);
259
- }, _ = () => {
260
- W.value ? V(-4) : typeof a.value == "number" && v(-a.value * 4);
261
- }, B = () => {
262
- W.value ? V(4) : typeof a.value == "number" && v(a.value * 4);
263
- }, $ = () => {
264
- f.value || (L(0), y());
265
- }, oe = () => {
266
- f.value || (L(100), y());
267
- }, se = (o) => {
268
- const m = Le(o);
269
- let g = !0;
270
- switch (m) {
271
- case N.left:
272
- case N.down:
273
- U();
274
- break;
275
- case N.right:
276
- case N.up:
277
- G();
278
- break;
279
- case N.home:
280
- $();
281
- break;
282
- case N.end:
283
- oe();
284
- break;
285
- case N.pageDown:
286
- _();
287
- break;
288
- case N.pageUp:
289
- B();
290
- break;
291
- default:
292
- g = !1;
293
- break;
294
- }
295
- g && o.preventDefault();
296
- }, te = (o) => {
297
- let m, g;
298
- return o.type.startsWith("touch") ? (g = o.touches[0].clientY, m = o.touches[0].clientX) : (g = o.clientY, m = o.clientX), {
299
- clientX: m,
300
- clientY: g
301
- };
302
- }, ie = (o) => {
303
- t.dragging = !0, t.isClick = !0;
304
- const { clientX: m, clientY: g } = te(o);
305
- e.vertical ? t.startY = g : t.startX = m, t.startPosition = Number.parseFloat(M.value), t.newPosition = t.startPosition;
306
- }, H = (o) => {
307
- if (t.dragging) {
308
- t.isClick = !1, K(), P();
309
- let m;
310
- const { clientX: g, clientY: S } = te(o);
311
- if (e.vertical)
312
- t.currentY = S, m = (t.startY - t.currentY) / c.value * 100;
313
- else {
314
- t.currentX = g;
315
- const w = (t.currentX - t.startX) / c.value * 100;
316
- m = X.value ? -w : w;
317
- }
318
- t.newPosition = t.startPosition + m, L(t.newPosition);
319
- }
320
- }, T = () => {
321
- t.dragging && (setTimeout(() => {
322
- t.dragging = !1, t.hovering || O(), t.isClick || L(t.newPosition), y();
323
- }, 0), window.removeEventListener("mousemove", H), window.removeEventListener("touchmove", H), window.removeEventListener("mouseup", T), window.removeEventListener("touchend", T), window.removeEventListener("contextmenu", T));
324
- }, L = async (o) => {
325
- if (o === null || Number.isNaN(+o)) return;
326
- o = we(o, 0, 100);
327
- let m;
328
- if (a.value === "mark")
329
- k.value.length === 0 ? m = o <= 50 ? i.value : u.value : m = k.value.reduce((S, w) => Math.abs(w.position - o) < Math.abs(S.position - o) ? w : S).point;
330
- else {
331
- const g = Math.floor((u.value - i.value) / a.value), S = g * a.value / (u.value - i.value) * 100, w = S + (100 - S) / 2;
332
- if (o < S) {
333
- const E = S / g, x = Math.round(o / E);
334
- m = i.value + x * a.value;
335
- } else o < w ? m = i.value + g * a.value : m = u.value;
336
- m = Number.parseFloat(m.toFixed(n.value));
337
- }
338
- m !== e.modelValue && l(I, m), !t.dragging && e.modelValue !== t.oldValue && (t.oldValue = e.modelValue), await J(), t.dragging && K(), z.value.updatePopper();
339
- };
340
- return j(
341
- () => t.dragging,
342
- (o) => {
343
- A(o);
344
- }
345
- ), ae(C, "touchstart", s, { passive: !1 }), {
346
- disabled: f,
347
- button: C,
348
- tooltip: z,
349
- tooltipVisible: Y,
350
- showTooltip: r,
351
- persistent: d,
352
- wrapperStyle: D,
353
- formatValue: Q,
354
- handleMouseEnter: p,
355
- handleMouseLeave: ee,
356
- onButtonDown: s,
357
- onKeyDown: se,
358
- setPosition: L
359
- };
360
- }, $e = (e, t, l, f, i) => ({
361
- stops: b(() => {
362
- if (!e.showStops || e.min > e.max) return [];
363
- if (e.step === "mark" || e.step === 0)
364
- return e.step === 0 && console.warn("[ElSlider] step should not be 0."), [];
365
- const r = Math.ceil((e.max - e.min) / e.step), d = 100 * e.step / (e.max - e.min), n = Array.from({ length: r - 1 }).map(
366
- (c, h) => (h + 1) * d
367
- );
368
- return e.range ? n.filter((c) => c < 100 * (l.value - e.min) / (e.max - e.min) || c > 100 * (f.value - e.min) / (e.max - e.min)) : n.filter(
369
- (c) => c > 100 * (t.firstValue - e.min) / (e.max - e.min)
370
- );
371
- }),
372
- getStopStyle: (r) => e.vertical ? { bottom: `${r}%` } : i.value ? { right: `${r}%` } : { left: `${r}%` }
373
- }), je = (e, t, l, f, i, u) => {
374
- const a = (n) => {
375
- i(I, n), i(ue, n);
376
- }, r = () => e.range ? ![l.value, f.value].every(
377
- (n, c) => n === t.oldValue[c]
378
- ) : e.modelValue !== t.oldValue, d = () => {
379
- var c, h;
380
- if (e.min > e.max)
381
- throw new Error("[Element Plus Slider] props.min should not be greater than props.max.");
382
- const n = e.modelValue;
383
- e.range && Array.isArray(n) ? n[1] < e.min ? a([e.min, e.min]) : n[0] > e.max ? a([e.max, e.max]) : n[0] < e.min ? a([e.min, n[1]]) : n[1] > e.max ? a([n[0], e.max]) : (t.firstValue = n[0], t.secondValue = n[1], r() && (e.validateEvent && ((c = u == null ? void 0 : u.validate) == null || c.call(u, "change").catch(le)), t.oldValue = n.slice())) : !e.range && typeof n == "number" && !Number.isNaN(n) && (n < e.min ? a(e.min) : n > e.max ? a(e.max) : (t.firstValue = n, r() && (e.validateEvent && ((h = u == null ? void 0 : u.validate) == null || h.call(u, "change").catch(le)), t.oldValue = n)));
384
- };
385
- d(), j(
386
- () => t.dragging,
387
- (n) => {
388
- n || d();
389
- }
390
- ), j(
391
- () => e.modelValue,
392
- (n, c) => {
393
- t.dragging || Array.isArray(n) && Array.isArray(c) && n.every((h, y) => h === c[y]) && t.firstValue === n[0] && t.secondValue === n[1] || d();
394
- },
395
- {
396
- deep: !0
397
- }
398
- ), j(
399
- () => [e.min, e.max],
400
- () => {
401
- d();
402
- }
403
- );
404
- };
405
- export {
406
- Ke as a,
407
- Oe as b,
408
- We as c,
409
- $e as d,
410
- je as e,
411
- ae as f,
412
- Ce as s,
413
- Ye as u
414
- };