y-design-ssr 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/libs/button/index.css +1 -579
- package/libs/button/index.d.ts +0 -1
- package/libs/button/index.mjs +65 -111
- package/libs/button/index.umd.js +2 -203
- package/libs/cell/index.css +1 -1077
- package/libs/cell/index.d.ts +0 -1
- package/libs/cell/index.mjs +104 -168
- package/libs/cell/index.umd.js +2 -301
- package/libs/checkbox/index.css +1 -1053
- package/libs/checkbox/index.d.ts +0 -1
- package/libs/checkbox/index.mjs +127 -243
- package/libs/checkbox/index.umd.js +2 -370
- package/libs/checkboxGroup/index.css +1 -422
- package/libs/checkboxGroup/index.d.ts +0 -1
- package/libs/checkboxGroup/index.mjs +87 -174
- package/libs/checkboxGroup/index.umd.js +2 -266
- package/libs/col/index.css +1 -615
- package/libs/col/index.d.ts +0 -1
- package/libs/col/index.mjs +81 -247
- package/libs/col/index.umd.js +2 -306
- package/libs/countdown/index.css +1 -417
- package/libs/countdown/index.d.ts +0 -1
- package/libs/countdown/index.mjs +71 -180
- package/libs/countdown/index.umd.js +2 -232
- package/libs/dialog/index.css +1 -1405
- package/libs/dialog/index.d.ts +0 -1
- package/libs/dialog/index.mjs +476 -647
- package/libs/dialog/index.umd.js +2 -1129
- package/libs/empty/index.css +1 -457
- package/libs/empty/index.d.ts +0 -1
- package/libs/empty/index.mjs +44 -92
- package/libs/empty/index.umd.js +2 -140
- package/libs/form/index.css +1 -477
- package/libs/form/index.d.ts +0 -1
- package/libs/form/index.mjs +126 -227
- package/libs/form/index.umd.js +2 -320
- package/libs/formItem/index.css +1 -477
- package/libs/formItem/index.d.ts +0 -1
- package/libs/formItem/index.mjs +126 -277
- package/libs/formItem/index.umd.js +2 -373
- package/libs/icon/index.css +1 -982
- package/libs/icon/index.d.ts +0 -1
- package/libs/icon/index.mjs +58 -108
- package/libs/icon/index.umd.js +2 -187
- package/libs/index.css +1 -2902
- package/libs/index.mjs +2348 -3789
- package/libs/index.umd.js +2 -5509
- package/libs/input/index.css +1 -483
- package/libs/input/index.d.ts +0 -1
- package/libs/input/index.mjs +92 -184
- package/libs/input/index.umd.js +2 -275
- package/libs/layout/index.css +1 -684
- package/libs/layout/index.mjs +130 -230
- package/libs/layout/index.umd.js +2 -318
- package/libs/list/index.css +1 -440
- package/libs/list/index.d.ts +0 -1
- package/libs/list/index.mjs +207 -389
- package/libs/list/index.umd.js +2 -572
- package/libs/loading/index.css +1 -548
- package/libs/loading/index.d.ts +0 -1
- package/libs/loading/index.mjs +118 -197
- package/libs/loading/index.umd.js +2 -322
- package/libs/locale/index.mjs +28 -0
- package/libs/locale/index.umd.js +1 -0
- package/libs/locale/package.json +6 -0
- package/libs/mask/index.css +1 -426
- package/libs/mask/index.d.ts +0 -1
- package/libs/mask/index.mjs +70 -132
- package/libs/mask/index.umd.js +2 -202
- package/libs/popup/index.css +1 -465
- package/libs/popup/index.d.ts +0 -1
- package/libs/popup/index.mjs +134 -211
- package/libs/popup/index.umd.js +2 -359
- package/libs/progress/index.css +1 -488
- package/libs/progress/index.d.ts +0 -1
- package/libs/progress/index.mjs +128 -201
- package/libs/progress/index.umd.js +2 -323
- package/libs/pullrefresh/index.css +1 -441
- package/libs/pullrefresh/index.d.ts +0 -1
- package/libs/pullrefresh/index.mjs +111 -242
- package/libs/pullrefresh/index.umd.js +2 -303
- package/libs/row/index.css +1 -485
- package/libs/row/index.d.ts +0 -1
- package/libs/row/index.mjs +89 -182
- package/libs/row/index.umd.js +2 -238
- package/libs/slider/index.css +1 -558
- package/libs/slider/index.d.ts +0 -1
- package/libs/slider/index.mjs +160 -357
- package/libs/slider/index.umd.js +2 -454
- package/libs/stepper/index.css +1 -489
- package/libs/stepper/index.d.ts +0 -1
- package/libs/stepper/index.mjs +101 -182
- package/libs/stepper/index.umd.js +2 -270
- package/libs/style/index.css +1 -0
- package/libs/style/index.mjs +1 -0
- package/libs/style/index.umd.js +2 -0
- package/libs/style/package.json +6 -0
- package/libs/swipe/index.css +1 -506
- package/libs/swipe/index.d.ts +0 -1
- package/libs/swipe/index.mjs +259 -543
- package/libs/swipe/index.umd.js +2 -704
- package/libs/swipeItem/index.css +1 -424
- package/libs/swipeItem/index.d.ts +0 -1
- package/libs/swipeItem/index.mjs +52 -112
- package/libs/swipeItem/index.umd.js +2 -155
- package/libs/switch/index.css +1 -472
- package/libs/switch/index.d.ts +0 -1
- package/libs/switch/index.mjs +62 -122
- package/libs/switch/index.umd.js +2 -201
- package/libs/tab/index.d.ts +0 -1
- package/libs/tab/index.mjs +68 -132
- package/libs/tab/index.umd.js +1 -191
- package/libs/tabs/index.css +1 -514
- package/libs/tabs/index.d.ts +0 -1
- package/libs/tabs/index.mjs +410 -752
- package/libs/tabs/index.umd.js +2 -1021
- package/libs/toast/index.css +1 -1050
- package/libs/toast/index.d.ts +0 -1
- package/libs/toast/index.mjs +114 -184
- package/libs/toast/index.umd.js +2 -307
- package/libs/tooltip/index.css +1 -514
- package/libs/tooltip/index.d.ts +0 -1
- package/libs/tooltip/index.mjs +155 -294
- package/libs/tooltip/index.umd.js +2 -417
- package/libs/utils/index.mjs +76 -0
- package/libs/utils/index.umd.js +1 -0
- package/libs/utils/package.json +6 -0
- package/package.json +2 -5
package/libs/slider/index.mjs
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
import { ref, reactive, defineComponent, computed, createVNode } from "vue";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (Array.isArray(mods)) {
|
|
10
|
-
return mods.reduce((acc, cur) => acc + getMods(el, cur), "");
|
|
11
|
-
}
|
|
12
|
-
return Object.keys(mods).reduce(
|
|
13
|
-
(acc, cur) => acc + (mods[cur] ? getMods(el, cur) : ""),
|
|
14
|
-
""
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
const createBEM = (block) => {
|
|
18
|
-
return (el, mods) => {
|
|
19
|
-
let _el = el;
|
|
20
|
-
let _mods = mods;
|
|
21
|
-
if (_el && typeof _el !== "string") {
|
|
22
|
-
_mods = _el;
|
|
23
|
-
_el = "";
|
|
24
|
-
}
|
|
25
|
-
_el = _el ? `${block}__${_el}` : block;
|
|
26
|
-
return `${_el}${getMods(_el, _mods)}`;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const createGlobalBem = () => {
|
|
30
|
-
return (el, mods) => {
|
|
31
|
-
if (!mods) {
|
|
32
|
-
return `y-${el}`;
|
|
33
|
-
}
|
|
34
|
-
return `${getMods(`y-${el}`, mods)}`;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const defaultLang = {
|
|
1
|
+
import { ref as s, reactive as E, defineComponent as H, computed as V, createVNode as g } from "vue";
|
|
2
|
+
const $ = (e, a) => a ? typeof a == "string" ? ` ${e}--${a}` : Array.isArray(a) ? a.reduce((o, n) => o + $(e, n), "") : Object.keys(a).reduce(
|
|
3
|
+
(o, n) => o + (a[n] ? $(e, n) : ""),
|
|
4
|
+
""
|
|
5
|
+
) : "", P = (e) => (a, o) => {
|
|
6
|
+
let n = a, u = o;
|
|
7
|
+
return n && typeof n != "string" && (u = n, n = ""), n = n ? `${e}__${n}` : e, `${n}${$(n, u)}`;
|
|
8
|
+
}, G = () => (e, a) => a ? `${$(`y-${e}`, a)}` : `y-${e}`, J = {
|
|
38
9
|
"pull-refresh": {
|
|
39
10
|
pulling: "下拉刷新...",
|
|
40
11
|
loosing: "释放刷新...",
|
|
@@ -46,94 +17,39 @@ const defaultLang = {
|
|
|
46
17
|
validateMessage: "请输入正确内容"
|
|
47
18
|
}
|
|
48
19
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"zh-CN":
|
|
20
|
+
s("zh-CN");
|
|
21
|
+
E({
|
|
22
|
+
"zh-CN": J
|
|
52
23
|
});
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
return [
|
|
56
|
-
}
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
return val;
|
|
60
|
-
}
|
|
61
|
-
return `${val}px`;
|
|
62
|
-
};
|
|
63
|
-
const MIN_DISTANCE = 10;
|
|
64
|
-
const getDirection = (x, y) => {
|
|
65
|
-
if (x > y && x > MIN_DISTANCE) {
|
|
66
|
-
return "horizontal";
|
|
67
|
-
}
|
|
68
|
-
if (y > x && y > MIN_DISTANCE) {
|
|
69
|
-
return "vertical";
|
|
70
|
-
}
|
|
71
|
-
return "";
|
|
72
|
-
};
|
|
73
|
-
const getTouchDirection = (x, y) => {
|
|
74
|
-
if (Math.abs(x) > Math.abs(y)) {
|
|
75
|
-
if (x > 0)
|
|
76
|
-
return "right";
|
|
77
|
-
return "left";
|
|
78
|
-
}
|
|
79
|
-
if (y > 0)
|
|
80
|
-
return "bottom";
|
|
81
|
-
return "top";
|
|
82
|
-
};
|
|
83
|
-
const useTouch = () => {
|
|
84
|
-
const startX = ref(0);
|
|
85
|
-
const startY = ref(0);
|
|
86
|
-
const deltaX = ref(0);
|
|
87
|
-
const deltaY = ref(0);
|
|
88
|
-
const offsetX = ref(0);
|
|
89
|
-
const offsetY = ref(0);
|
|
90
|
-
const direction = ref("");
|
|
91
|
-
const touchDirection = ref("");
|
|
92
|
-
const isVertical = () => direction.value === "vertical";
|
|
93
|
-
const isHorizontal = () => direction.value === "horizontal";
|
|
94
|
-
const reset2 = () => {
|
|
95
|
-
deltaX.value = 0;
|
|
96
|
-
deltaY.value = 0;
|
|
97
|
-
offsetX.value = 0;
|
|
98
|
-
offsetY.value = 0;
|
|
99
|
-
direction.value = "";
|
|
100
|
-
touchDirection.value = "";
|
|
101
|
-
};
|
|
102
|
-
const start = (event) => {
|
|
103
|
-
reset2();
|
|
104
|
-
startX.value = event.touches[0].clientX;
|
|
105
|
-
startY.value = event.touches[0].clientY;
|
|
106
|
-
};
|
|
107
|
-
const move = (event) => {
|
|
108
|
-
const touch = event.touches[0];
|
|
109
|
-
deltaX.value = touch.clientX < 0 ? 0 : touch.clientX - startX.value;
|
|
110
|
-
deltaY.value = touch.clientY - startY.value;
|
|
111
|
-
offsetX.value = Math.abs(deltaX.value);
|
|
112
|
-
offsetY.value = Math.abs(deltaY.value);
|
|
113
|
-
if (!direction.value) {
|
|
114
|
-
direction.value = getDirection(offsetX.value, offsetY.value);
|
|
115
|
-
}
|
|
116
|
-
touchDirection.value = getTouchDirection(deltaX.value, deltaY.value);
|
|
24
|
+
const j = (e) => {
|
|
25
|
+
const a = `y-${e}`;
|
|
26
|
+
return [a, P(a), G()];
|
|
27
|
+
}, L = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, _ = 10, U = (e, a) => e > a && e > _ ? "horizontal" : a > e && a > _ ? "vertical" : "", p = (e, a) => Math.abs(e) > Math.abs(a) ? e > 0 ? "right" : "left" : a > 0 ? "bottom" : "top", q = () => {
|
|
28
|
+
const e = s(0), a = s(0), o = s(0), n = s(0), u = s(0), i = s(0), c = s(""), C = s(""), h = () => c.value === "vertical", b = () => c.value === "horizontal", N = () => {
|
|
29
|
+
o.value = 0, n.value = 0, u.value = 0, i.value = 0, c.value = "", C.value = "";
|
|
117
30
|
};
|
|
118
31
|
return {
|
|
119
|
-
move
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
32
|
+
move: (m) => {
|
|
33
|
+
const y = m.touches[0];
|
|
34
|
+
o.value = y.clientX < 0 ? 0 : y.clientX - e.value, n.value = y.clientY - a.value, u.value = Math.abs(o.value), i.value = Math.abs(n.value), c.value || (c.value = U(u.value, i.value)), C.value = p(o.value, n.value);
|
|
35
|
+
},
|
|
36
|
+
start: (m) => {
|
|
37
|
+
N(), e.value = m.touches[0].clientX, a.value = m.touches[0].clientY;
|
|
38
|
+
},
|
|
39
|
+
reset: N,
|
|
40
|
+
startX: e,
|
|
41
|
+
startY: a,
|
|
42
|
+
deltaX: o,
|
|
43
|
+
deltaY: n,
|
|
44
|
+
offsetX: u,
|
|
45
|
+
offsetY: i,
|
|
46
|
+
direction: c,
|
|
47
|
+
touchDirection: C,
|
|
48
|
+
isVertical: h,
|
|
49
|
+
isHorizontal: b
|
|
132
50
|
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const Slider = /* @__PURE__ */ defineComponent({
|
|
136
|
-
name: cname,
|
|
51
|
+
}, [F, d] = j("slider"), R = /* @__PURE__ */ H({
|
|
52
|
+
name: F,
|
|
137
53
|
props: {
|
|
138
54
|
modelValue: {
|
|
139
55
|
type: [Number, Array],
|
|
@@ -165,11 +81,11 @@ const Slider = /* @__PURE__ */ defineComponent({
|
|
|
165
81
|
},
|
|
166
82
|
disabled: {
|
|
167
83
|
type: Boolean,
|
|
168
|
-
default:
|
|
84
|
+
default: !1
|
|
169
85
|
},
|
|
170
86
|
showTooltip: {
|
|
171
87
|
type: Boolean,
|
|
172
|
-
default:
|
|
88
|
+
default: !1
|
|
173
89
|
},
|
|
174
90
|
step: {
|
|
175
91
|
type: Number,
|
|
@@ -189,260 +105,147 @@ const Slider = /* @__PURE__ */ defineComponent({
|
|
|
189
105
|
}
|
|
190
106
|
},
|
|
191
107
|
emits: ["change", "drag-start", "drag-end", "update:modelValue"],
|
|
192
|
-
setup(
|
|
193
|
-
emit,
|
|
194
|
-
slots
|
|
108
|
+
setup(e, {
|
|
109
|
+
emit: a,
|
|
110
|
+
slots: o
|
|
195
111
|
}) {
|
|
196
|
-
const
|
|
197
|
-
const startRef = ref(0);
|
|
198
|
-
const curRef = ref(0);
|
|
199
|
-
const moveStatusRef = ref("");
|
|
200
|
-
const touch = useTouch();
|
|
201
|
-
const isRangeRef = computed(() => Array.isArray(props.modelValue));
|
|
202
|
-
const formatValue = (value) => {
|
|
112
|
+
const n = s(), u = s(0), i = s(0), c = s(""), C = q(), h = V(() => Array.isArray(e.modelValue)), b = (t) => {
|
|
203
113
|
const {
|
|
204
|
-
min,
|
|
205
|
-
max,
|
|
206
|
-
step
|
|
207
|
-
} =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const handleClick = (event) => {
|
|
212
|
-
event.stopPropagation();
|
|
213
|
-
if (props.disabled)
|
|
114
|
+
min: r,
|
|
115
|
+
max: l,
|
|
116
|
+
step: f
|
|
117
|
+
} = e, v = Math.max(r, Math.min(t, l));
|
|
118
|
+
return Math.round(v / f) * f;
|
|
119
|
+
}, N = (t) => {
|
|
120
|
+
if (t.stopPropagation(), e.disabled)
|
|
214
121
|
return;
|
|
215
122
|
const {
|
|
216
|
-
min,
|
|
217
|
-
modelValue
|
|
218
|
-
} =
|
|
123
|
+
min: r,
|
|
124
|
+
modelValue: l
|
|
125
|
+
} = e, {
|
|
126
|
+
left: f,
|
|
127
|
+
width: v
|
|
128
|
+
} = n.value.getBoundingClientRect(), S = t.clientX - f, T = Math.floor(r + S / v * M.value);
|
|
129
|
+
if (h.value) {
|
|
130
|
+
const X = l[0], x = l[1], W = (X + x) / 2;
|
|
131
|
+
T <= W ? m([T, x]) : m([X, T]);
|
|
132
|
+
} else
|
|
133
|
+
m(T);
|
|
134
|
+
}, w = (t) => t[0] > t[1] ? [t[1], t[0]] : t, k = (t, r) => JSON.stringify(t) === JSON.stringify(r), m = (t, r) => {
|
|
135
|
+
let l = 0;
|
|
136
|
+
h.value ? l = w(t).map(b) : l = b(t), a("update:modelValue", l), typeof r > "u" && !k(u.value, i.value) && a("change", l);
|
|
137
|
+
}, y = V(() => {
|
|
219
138
|
const {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
} =
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const left = modelValue[0];
|
|
227
|
-
const right = modelValue[1];
|
|
228
|
-
const middle = (left + right) / 2;
|
|
229
|
-
if (curValue <= middle) {
|
|
230
|
-
updateValue([curValue, right]);
|
|
231
|
-
} else {
|
|
232
|
-
updateValue([left, curValue]);
|
|
233
|
-
}
|
|
234
|
-
} else {
|
|
235
|
-
updateValue(curValue);
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
const handlePositionOrder = (value) => {
|
|
239
|
-
if (value[0] > value[1]) {
|
|
240
|
-
return [value[1], value[0]];
|
|
241
|
-
}
|
|
242
|
-
return value;
|
|
243
|
-
};
|
|
244
|
-
const isSameValue = (beforeValue, curValue) => JSON.stringify(beforeValue) === JSON.stringify(curValue);
|
|
245
|
-
const updateValue = (value, unfinished) => {
|
|
246
|
-
let newValue = 0;
|
|
247
|
-
if (isRangeRef.value) {
|
|
248
|
-
newValue = handlePositionOrder(value).map(formatValue);
|
|
249
|
-
} else {
|
|
250
|
-
newValue = formatValue(value);
|
|
251
|
-
}
|
|
252
|
-
emit("update:modelValue", newValue);
|
|
253
|
-
if (typeof unfinished === "undefined" && !isSameValue(startRef.value, curRef.value)) {
|
|
254
|
-
emit("change", newValue);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
const getInnerLengthPercentRef = computed(() => {
|
|
139
|
+
modelValue: t,
|
|
140
|
+
min: r
|
|
141
|
+
} = e;
|
|
142
|
+
let l = null;
|
|
143
|
+
return h.value ? l = Math.floor((b(t[1]) - b(t[0])) * 100 / M.value) : l = Math.floor((b(t) - r) * 100 / M.value), `${l}%`;
|
|
144
|
+
}), A = V(() => {
|
|
258
145
|
const {
|
|
259
|
-
modelValue,
|
|
260
|
-
min
|
|
261
|
-
} =
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const getOffsetRef = computed(() => {
|
|
271
|
-
const {
|
|
272
|
-
modelValue,
|
|
273
|
-
min
|
|
274
|
-
} = props;
|
|
275
|
-
if (isRangeRef.value) {
|
|
276
|
-
return `${Math.floor((formatValue(modelValue[0]) - min) * 100 / numberGapRef.value)}%`;
|
|
277
|
-
}
|
|
278
|
-
return "0%";
|
|
279
|
-
});
|
|
280
|
-
const toolTipStyle = computed(() => {
|
|
281
|
-
return {
|
|
282
|
-
left: getInnerLengthPercentRef.value,
|
|
283
|
-
transition: moveStatusRef.value === "moving" ? "none" : `${props.transitionTime}ms ease-in-out`
|
|
284
|
-
};
|
|
285
|
-
});
|
|
286
|
-
const numberGapRef = computed(() => props.max - props.min);
|
|
287
|
-
const handleTouchStart = (event) => {
|
|
288
|
-
if (props.disabled)
|
|
289
|
-
return;
|
|
290
|
-
touch.start(event);
|
|
291
|
-
moveStatusRef.value = "startMove";
|
|
292
|
-
curRef.value = props.modelValue;
|
|
293
|
-
if (isRangeRef.value) {
|
|
294
|
-
startRef.value = [...curRef.value];
|
|
295
|
-
} else {
|
|
296
|
-
startRef.value = curRef.value;
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
const handleTouchMove = (event, pos) => {
|
|
300
|
-
if (props.disabled)
|
|
146
|
+
modelValue: t,
|
|
147
|
+
min: r
|
|
148
|
+
} = e;
|
|
149
|
+
return h.value ? `${Math.floor((b(t[0]) - r) * 100 / M.value)}%` : "0%";
|
|
150
|
+
}), z = V(() => ({
|
|
151
|
+
left: y.value,
|
|
152
|
+
transition: c.value === "moving" ? "none" : `${e.transitionTime}ms ease-in-out`
|
|
153
|
+
})), M = V(() => e.max - e.min), D = (t) => {
|
|
154
|
+
e.disabled || (C.start(t), c.value = "startMove", i.value = e.modelValue, h.value ? u.value = [...i.value] : u.value = i.value);
|
|
155
|
+
}, I = (t, r) => {
|
|
156
|
+
if (e.disabled)
|
|
301
157
|
return;
|
|
302
|
-
|
|
303
|
-
if (moveStatusRef.value === "startMove") {
|
|
304
|
-
emit("drag-start");
|
|
305
|
-
}
|
|
306
|
-
moveStatusRef.value = "moving";
|
|
158
|
+
C.move(t), c.value === "startMove" && a("drag-start"), c.value = "moving";
|
|
307
159
|
const {
|
|
308
|
-
width
|
|
309
|
-
} =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
160
|
+
width: l
|
|
161
|
+
} = n.value.getBoundingClientRect(), f = C.deltaX.value, v = Math.floor(f / l * M.value);
|
|
162
|
+
Array.isArray(u.value) && Array.isArray(i.value) ? r === "left" ? i.value[0] = u.value[0] + v : i.value[1] = u.value[1] + v : i.value = u.value + v, m(i.value, !0);
|
|
163
|
+
}, O = () => {
|
|
164
|
+
e.disabled || (c.value === "moving" && (m(i.value), a("drag-end")), c.value = "endMove");
|
|
165
|
+
}, B = (t) => {
|
|
166
|
+
let r = "", l = {}, f = 0, v = d("button-wrapper");
|
|
167
|
+
return t === 0 ? (r = "left", l = {
|
|
168
|
+
left: A.value,
|
|
169
|
+
backgroundColor: Array.isArray(e.buttonBgColor) ? e.buttonBgColor[0] : e.buttonBgColor
|
|
170
|
+
}, f = e.modelValue[t], v = d("button-wrapper", "left")) : t === 1 ? (r = "right", f = e.modelValue[t], l = {
|
|
171
|
+
left: `${parseInt(y.value) + parseInt(A.value)}%`,
|
|
172
|
+
backgroundColor: Array.isArray(e.buttonBgColor) ? e.buttonBgColor[1] : e.buttonBgColor
|
|
173
|
+
}, v = d("button-wrapper", "right")) : (f = e.modelValue, l = {
|
|
174
|
+
left: y.value,
|
|
175
|
+
backgroundColor: e.buttonBgColor
|
|
176
|
+
}), g("div", {
|
|
177
|
+
role: "slider",
|
|
178
|
+
"aria-valuemin": e.min,
|
|
179
|
+
"aria-valuemax": e.max,
|
|
180
|
+
"aria-valuenow": f,
|
|
181
|
+
class: v,
|
|
182
|
+
onTouchstart: D,
|
|
183
|
+
onTouchmove: (S) => I(S, r),
|
|
184
|
+
onTouchend: O,
|
|
185
|
+
style: {
|
|
186
|
+
...l,
|
|
187
|
+
transition: c.value === "moving" ? "none" : `${e.transitionTime}ms ease-in-out`
|
|
317
188
|
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
updateValue(curRef.value, true);
|
|
322
|
-
};
|
|
323
|
-
const handleTouchEnd = () => {
|
|
324
|
-
if (props.disabled)
|
|
325
|
-
return;
|
|
326
|
-
if (moveStatusRef.value === "moving") {
|
|
327
|
-
updateValue(curRef.value);
|
|
328
|
-
emit("drag-end");
|
|
329
|
-
}
|
|
330
|
-
moveStatusRef.value = "endMove";
|
|
331
|
-
};
|
|
332
|
-
const renderButton = (index) => {
|
|
333
|
-
let pos = "";
|
|
334
|
-
let posStyle = {};
|
|
335
|
-
let curValue = 0;
|
|
336
|
-
let buttonWrapperClass = bem("button-wrapper");
|
|
337
|
-
if (index === 0) {
|
|
338
|
-
pos = "left";
|
|
339
|
-
posStyle = {
|
|
340
|
-
left: getOffsetRef.value,
|
|
341
|
-
backgroundColor: Array.isArray(props.buttonBgColor) ? props.buttonBgColor[0] : props.buttonBgColor
|
|
342
|
-
};
|
|
343
|
-
curValue = props.modelValue[index];
|
|
344
|
-
buttonWrapperClass = bem("button-wrapper", "left");
|
|
345
|
-
} else if (index === 1) {
|
|
346
|
-
pos = "right";
|
|
347
|
-
curValue = props.modelValue[index];
|
|
348
|
-
posStyle = {
|
|
349
|
-
left: `${parseInt(getInnerLengthPercentRef.value) + parseInt(getOffsetRef.value)}%`,
|
|
350
|
-
backgroundColor: Array.isArray(props.buttonBgColor) ? props.buttonBgColor[1] : props.buttonBgColor
|
|
351
|
-
};
|
|
352
|
-
buttonWrapperClass = bem("button-wrapper", "right");
|
|
353
|
-
} else {
|
|
354
|
-
curValue = props.modelValue;
|
|
355
|
-
posStyle = {
|
|
356
|
-
left: getInnerLengthPercentRef.value,
|
|
357
|
-
backgroundColor: props.buttonBgColor
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
return createVNode("div", {
|
|
361
|
-
"role": "slider",
|
|
362
|
-
"aria-valuemin": props.min,
|
|
363
|
-
"aria-valuemax": props.max,
|
|
364
|
-
"aria-valuenow": curValue,
|
|
365
|
-
"class": buttonWrapperClass,
|
|
366
|
-
"onTouchstart": handleTouchStart,
|
|
367
|
-
"onTouchmove": (e) => handleTouchMove(e, pos),
|
|
368
|
-
"onTouchend": handleTouchEnd,
|
|
369
|
-
"style": {
|
|
370
|
-
...posStyle,
|
|
371
|
-
transition: moveStatusRef.value === "moving" ? "none" : `${props.transitionTime}ms ease-in-out`
|
|
372
|
-
}
|
|
373
|
-
}, [slots.button ? slots.button() : createVNode("div", {
|
|
374
|
-
"class": bem("inner-button"),
|
|
375
|
-
"style": posStyle
|
|
189
|
+
}, [o.button ? o.button() : g("div", {
|
|
190
|
+
class: d("inner-button"),
|
|
191
|
+
style: l
|
|
376
192
|
}, null)]);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
return arr.map((_, index) => ({
|
|
381
|
-
position: `${index * props.step}%`
|
|
382
|
-
}));
|
|
383
|
-
});
|
|
193
|
+
}, Y = V(() => Array((e.max - e.min) / e.step).fill({}).map((r, l) => ({
|
|
194
|
+
position: `${l * e.step}%`
|
|
195
|
+
})));
|
|
384
196
|
return () => {
|
|
385
|
-
var
|
|
386
|
-
return
|
|
387
|
-
|
|
388
|
-
}, [
|
|
389
|
-
|
|
390
|
-
left:
|
|
197
|
+
var t;
|
|
198
|
+
return g("div", {
|
|
199
|
+
class: d()
|
|
200
|
+
}, [o.iconLeft && g("div", {
|
|
201
|
+
class: d("icon", {
|
|
202
|
+
left: !0
|
|
391
203
|
})
|
|
392
|
-
}, [
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
disabled:
|
|
204
|
+
}, [o.iconLeft()]), g("div", {
|
|
205
|
+
role: "presentation",
|
|
206
|
+
ref: n,
|
|
207
|
+
class: d("wrapper-main", {
|
|
208
|
+
disabled: e.disabled
|
|
397
209
|
}),
|
|
398
|
-
|
|
399
|
-
background:
|
|
400
|
-
height:
|
|
210
|
+
style: {
|
|
211
|
+
background: e.inactiveColor,
|
|
212
|
+
height: L(e.barHeight)
|
|
401
213
|
},
|
|
402
|
-
|
|
403
|
-
}, [
|
|
404
|
-
|
|
405
|
-
}, [
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
"class": bem("tooltip", {
|
|
416
|
-
wrapper: slots.toolTip
|
|
214
|
+
onClick: N
|
|
215
|
+
}, [e.step !== 1 && g("div", {
|
|
216
|
+
class: d("dots")
|
|
217
|
+
}, [Y.value.map((r) => g("div", {
|
|
218
|
+
class: d("dot"),
|
|
219
|
+
style: {
|
|
220
|
+
left: r.position,
|
|
221
|
+
background: e.gapColor,
|
|
222
|
+
width: L(e.gapWidth)
|
|
223
|
+
}
|
|
224
|
+
}, null))]), e.showTooltip && g("div", {
|
|
225
|
+
class: d("tooltip", {
|
|
226
|
+
wrapper: o.toolTip
|
|
417
227
|
}),
|
|
418
|
-
|
|
419
|
-
}, [((
|
|
420
|
-
|
|
421
|
-
left:
|
|
422
|
-
width:
|
|
423
|
-
background:
|
|
424
|
-
transition:
|
|
228
|
+
style: z.value
|
|
229
|
+
}, [((t = o.toolTip) == null ? void 0 : t.call(o)) || e.modelValue]), g("div", {
|
|
230
|
+
style: {
|
|
231
|
+
left: A.value,
|
|
232
|
+
width: y.value,
|
|
233
|
+
background: e.activeColor,
|
|
234
|
+
transition: c.value === "moving" ? "none" : `${e.transitionTime}ms ease-in-out`
|
|
425
235
|
},
|
|
426
|
-
|
|
427
|
-
}, null),
|
|
428
|
-
|
|
429
|
-
right:
|
|
236
|
+
class: d("inner")
|
|
237
|
+
}, null), h.value ? [B(0), B(1)] : B()]), o.iconRight && g("div", {
|
|
238
|
+
class: d("icon", {
|
|
239
|
+
right: !0
|
|
430
240
|
})
|
|
431
|
-
}, [
|
|
241
|
+
}, [o.iconRight()])]);
|
|
432
242
|
};
|
|
433
243
|
}
|
|
434
244
|
});
|
|
435
|
-
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
const animation = "";
|
|
439
|
-
const theme = "";
|
|
440
|
-
const style = "";
|
|
441
|
-
Slider.install = (Vue) => {
|
|
442
|
-
const { name } = Slider;
|
|
443
|
-
Vue.component(name, Slider);
|
|
245
|
+
R.install = (e) => {
|
|
246
|
+
const { name: a } = R;
|
|
247
|
+
e.component(a, R);
|
|
444
248
|
};
|
|
445
249
|
export {
|
|
446
|
-
|
|
447
|
-
Slider as default
|
|
250
|
+
R as default
|
|
448
251
|
};
|