@studio-west/component-sw 0.13.11 → 0.13.17
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/LICENSE +201 -21
- package/README.md +294 -64
- package/dist/SwBadge-BOqWsTgl.js +43 -0
- package/dist/{SwButton-BfG2InPf.js → SwButton-DpOGpsBS.js} +1 -1
- package/dist/{SwDatePicker-BfuFsZeg.js → SwDatePicker-BwgaZLnR.js} +47 -47
- package/dist/SwDropdown-DpedC6Bn.js +177 -0
- package/dist/SwDropdownItem-DthBPUxn.js +43 -0
- package/dist/{SwFile-D8wkf69j.js → SwFile-DfeOYJQc.js} +2 -2
- package/dist/SwFormItem-SuqNvXBQ.js +59 -0
- package/dist/SwGide-BjQbQiBI.js +134 -0
- package/dist/{SwIcon-C4RHAbK1.js → SwIcon-B-HHyuxu.js} +2 -2
- package/dist/SwInput-BQXnoovf.js +163 -0
- package/dist/{SwMessage-WHO6knac.js → SwMessage-BghpMRWc.js} +9 -5
- package/dist/SwPagination-jTW9BD5P.js +121 -0
- package/dist/{SwSelect-DwxIlRFI.js → SwSelect-DDNh3p6B.js} +617 -472
- package/dist/SwSlider-Cl9pwY6h.js +197 -0
- package/dist/SwTag-DjZlthUS.js +51 -0
- package/dist/component-sw.css +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +95 -68
- package/dist/{utils-DwvFrrWs.js → utils-qzwUfWRX.js} +17 -2
- package/package.json +4 -1
- package/types/components.d.ts +0 -2
- package/types/index.d.ts +50 -2
- package/dist/SwDropdown-BTADCvrN.js +0 -114
- package/dist/SwDropdownItem-BBDMECgR.js +0 -40
- package/dist/SwDropdownNew-BuCIN-iv.js +0 -107
- package/dist/SwFormItem-DgFaNwe9.js +0 -24
- package/dist/SwGide-Da6Nv8Dd.js +0 -129
- package/dist/SwInput-0Eph7P-m.js +0 -104
- package/dist/SwSlider-DkgJH6Bh.js +0 -179
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { computed as e, createElementBlock as t, normalizeClass as n, openBlock as r, renderSlot as i } from "vue";
|
|
2
|
-
//#region src/components/SwFormItem.vue
|
|
3
|
-
var a = {
|
|
4
|
-
__name: "SwFormItem",
|
|
5
|
-
props: {
|
|
6
|
-
class: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: ""
|
|
9
|
-
},
|
|
10
|
-
type: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: ""
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
setup(a) {
|
|
16
|
-
let o = a, s = e(() => {
|
|
17
|
-
let e = ["sw-form-item"];
|
|
18
|
-
return o.type.length > 0 && e.push("sw-" + o.type), o.class.length > 0 && e.push(o.class), e;
|
|
19
|
-
});
|
|
20
|
-
return (e, a) => (r(), t("div", { class: n(s.value) }, [i(e.$slots, "default")], 2));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { a as default };
|
package/dist/SwGide-Da6Nv8Dd.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./SwIcon-C4RHAbK1.js";
|
|
2
|
-
import { t } from "./SwButton-BfG2InPf.js";
|
|
3
|
-
import n from "./SwDropdown-BTADCvrN.js";
|
|
4
|
-
import { computed as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, mergeModels as c, normalizeClass as l, onMounted as u, openBlock as d, ref as f, renderSlot as p, toDisplayString as m, useModel as h, watchEffect as g, withCtx as _ } from "vue";
|
|
5
|
-
//#region src/components/SwGide.vue
|
|
6
|
-
var v = ["src"], y = {
|
|
7
|
-
__name: "SwGide",
|
|
8
|
-
props: /*@__PURE__*/ c({
|
|
9
|
-
steps: {
|
|
10
|
-
type: Array,
|
|
11
|
-
default: () => []
|
|
12
|
-
},
|
|
13
|
-
after: {
|
|
14
|
-
type: String,
|
|
15
|
-
default: ""
|
|
16
|
-
},
|
|
17
|
-
iconClose: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: ""
|
|
20
|
-
},
|
|
21
|
-
maxWidth: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: 250
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
modelValue: {
|
|
27
|
-
type: Number,
|
|
28
|
-
default: 0
|
|
29
|
-
},
|
|
30
|
-
modelModifiers: {}
|
|
31
|
-
}),
|
|
32
|
-
emits: /*@__PURE__*/ c(["close"], ["update:modelValue"]),
|
|
33
|
-
setup(c, { emit: y }) {
|
|
34
|
-
let b = f(null), x = f(!0), S = f(null), C = h(c, "modelValue"), w = y, T = c, E = r(() => T.after || T.iconClose), D = () => w("close"), O = (e) => {
|
|
35
|
-
let t = C.value + e;
|
|
36
|
-
t < 0 ? C.value = 0 : t >= T.steps.length ? D() : C.value = t;
|
|
37
|
-
}, k = !1, A = (e) => {
|
|
38
|
-
let t = e.getBoundingClientRect(), n = window.innerHeight;
|
|
39
|
-
t.top < 5 ? (k = !0, document.documentElement.scrollTop += t.top - 5) : t.bottom > n - 5 && (k = !0, document.documentElement.scrollTop += t.bottom - n + 5);
|
|
40
|
-
}, j = () => {
|
|
41
|
-
if (!S.value || !b.value) return;
|
|
42
|
-
let e = S.value.getBoundingClientRect(), t = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft;
|
|
43
|
-
b.value.style.gridTemplateRows = `${e.top + t - 5}px ${e.height + 10}px 1fr`, b.value.style.gridTemplateColumns = `${e.left + n - 5}px ${e.width + 10}px 1fr`, b.value.style.height = document.documentElement.scrollHeight + "px";
|
|
44
|
-
};
|
|
45
|
-
return g((e) => {
|
|
46
|
-
if (!b.value) return;
|
|
47
|
-
let t = T.steps[C.value]?.tag;
|
|
48
|
-
if (!t || !t.trim()) {
|
|
49
|
-
b.value.style.gridTemplateRows = "40% 0 1fr", b.value.style.gridTemplateColumns = "1fr 0 1fr", b.value.style.height = document.documentElement.scrollHeight + "px";
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (S.value = document.querySelector(t), !S.value) {
|
|
53
|
-
console.warn(`[SwGuide] Элемент не найден: ${t}`);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
A(S.value);
|
|
57
|
-
let n = () => {
|
|
58
|
-
if (k) {
|
|
59
|
-
k = !1;
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
j();
|
|
63
|
-
};
|
|
64
|
-
j();
|
|
65
|
-
let r = new ResizeObserver(j);
|
|
66
|
-
r.observe(S.value), window.addEventListener("resize", n), window.addEventListener("scroll", n, { passive: !0 }), e(() => {
|
|
67
|
-
r.disconnect(), window.removeEventListener("resize", n), window.removeEventListener("scroll", n);
|
|
68
|
-
});
|
|
69
|
-
}), u(() => window.onload = () => S.value = document.querySelector(T.steps[C.value]?.tag)), (r, c) => (d(), i("div", {
|
|
70
|
-
class: "sw-gide",
|
|
71
|
-
ref_key: "swGide",
|
|
72
|
-
ref: b
|
|
73
|
-
}, [
|
|
74
|
-
c[6] ||= a("div", { class: "overlay0" }, null, -1),
|
|
75
|
-
c[7] ||= a("div", { class: "overlay1" }, null, -1),
|
|
76
|
-
s(n, {
|
|
77
|
-
class: "gide",
|
|
78
|
-
trigger: "none",
|
|
79
|
-
placement: T.steps[C.value].placement,
|
|
80
|
-
modelValue: x.value,
|
|
81
|
-
"onUpdate:modelValue": c[2] ||= (e) => x.value = e,
|
|
82
|
-
maxWidth: T.maxWidth
|
|
83
|
-
}, {
|
|
84
|
-
dropdown: _(() => [
|
|
85
|
-
a("header", null, [p(r.$slots, "header", {}, () => [o(m(T.steps[C.value].header) + " ", 1), s(t, {
|
|
86
|
-
type: "primary",
|
|
87
|
-
link: "",
|
|
88
|
-
onClick: D
|
|
89
|
-
}, {
|
|
90
|
-
default: _(() => [s(e, { "icon-class": E.value }, null, 8, ["icon-class"])]),
|
|
91
|
-
_: 1
|
|
92
|
-
})])]),
|
|
93
|
-
p(r.$slots, "default", {}, () => [a("div", null, m(T.steps[C.value].text), 1), a("img", {
|
|
94
|
-
class: l(/left/.test(T.steps[C.value]?.placement) ? "reflect" : null),
|
|
95
|
-
src: T.steps[C.value].img
|
|
96
|
-
}, null, 10, v)]),
|
|
97
|
-
a("footer", null, [p(r.$slots, "footer", {}, () => [s(t, {
|
|
98
|
-
type: C.value === 0 ? "info" : "warning",
|
|
99
|
-
text: "",
|
|
100
|
-
link: "",
|
|
101
|
-
onClick: c[0] ||= (e) => O(-1)
|
|
102
|
-
}, {
|
|
103
|
-
default: _(() => [p(r.$slots, "arrow", {}, () => [c[3] ||= o("‹", -1)])]),
|
|
104
|
-
_: 3
|
|
105
|
-
}, 8, ["type"]), s(t, {
|
|
106
|
-
type: "success",
|
|
107
|
-
onClick: c[1] ||= (e) => O(1),
|
|
108
|
-
text: "",
|
|
109
|
-
link: "",
|
|
110
|
-
class: "sw-revers"
|
|
111
|
-
}, {
|
|
112
|
-
default: _(() => [p(r.$slots, "arrow", {}, () => [c[4] ||= o("‹", -1)])]),
|
|
113
|
-
_: 3
|
|
114
|
-
})])])
|
|
115
|
-
]),
|
|
116
|
-
default: _(() => [c[5] ||= a("div", { class: "hole" }, null, -1)]),
|
|
117
|
-
_: 3
|
|
118
|
-
}, 8, [
|
|
119
|
-
"placement",
|
|
120
|
-
"modelValue",
|
|
121
|
-
"maxWidth"
|
|
122
|
-
]),
|
|
123
|
-
c[8] ||= a("div", { class: "overlay2" }, null, -1),
|
|
124
|
-
c[9] ||= a("div", { class: "overlay3" }, null, -1)
|
|
125
|
-
], 512));
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
//#endregion
|
|
129
|
-
export { y as default };
|
package/dist/SwInput-0Eph7P-m.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./utils-DwvFrrWs.js";
|
|
2
|
-
import { n as t } from "./SwIcon-C4RHAbK1.js";
|
|
3
|
-
import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, mergeProps as u, normalizeClass as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, useModel as g, vModelDynamic as _, watch as v, withDirectives as y } from "vue";
|
|
4
|
-
//#region src/components/SwInput.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var b = ["for"], x = {
|
|
6
|
-
key: 0,
|
|
7
|
-
title: "Это поле обязательно для заполнения."
|
|
8
|
-
}, S = [
|
|
9
|
-
"required",
|
|
10
|
-
"placeholder",
|
|
11
|
-
"type",
|
|
12
|
-
"inputmode",
|
|
13
|
-
"id",
|
|
14
|
-
"name",
|
|
15
|
-
"size",
|
|
16
|
-
"maxlength",
|
|
17
|
-
"minlength",
|
|
18
|
-
"autofocus"
|
|
19
|
-
], C = /* @__PURE__ */ c({
|
|
20
|
-
__name: "SwInput",
|
|
21
|
-
props: /*@__PURE__*/ l({
|
|
22
|
-
before: { default: "" },
|
|
23
|
-
after: { default: "" },
|
|
24
|
-
placeholder: { default: "" },
|
|
25
|
-
label: { default: "" },
|
|
26
|
-
name: {},
|
|
27
|
-
class: { default: "" },
|
|
28
|
-
size: { default: "" },
|
|
29
|
-
type: { default: "text" },
|
|
30
|
-
inputMode: { default: "text" },
|
|
31
|
-
required: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: !1
|
|
34
|
-
},
|
|
35
|
-
maxlength: { default: 128 },
|
|
36
|
-
minlength: { default: 1 },
|
|
37
|
-
inputSize: { default: 60 },
|
|
38
|
-
autofocus: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: !1
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
modelValue: {},
|
|
44
|
-
modelModifiers: {}
|
|
45
|
-
}),
|
|
46
|
-
emits: /*@__PURE__*/ l([
|
|
47
|
-
"suffix",
|
|
48
|
-
"prefix",
|
|
49
|
-
"focusInput"
|
|
50
|
-
], ["update:modelValue"]),
|
|
51
|
-
setup(c, { emit: l }) {
|
|
52
|
-
let C = g(c, "modelValue"), w = c, T = l, E = p(!1), D = n(() => (C.value?.length ?? 0) > 0), O = n(() => {
|
|
53
|
-
let e = ["sw-input"];
|
|
54
|
-
return w.size.length > 0 && e.push("sw-" + w.size), w.class.length > 0 && e.push(w.class), (E.value || D.value) && e.push("sw-input--active"), e;
|
|
55
|
-
}), k = (e) => {
|
|
56
|
-
E.value = !0, T("focusInput"), e.target.setSelectionRange(C.value?.length || 0, C.value?.length || 0);
|
|
57
|
-
}, A = () => {
|
|
58
|
-
E.value = !1;
|
|
59
|
-
}, j = () => {
|
|
60
|
-
T("suffix");
|
|
61
|
-
}, M = () => {
|
|
62
|
-
T("prefix");
|
|
63
|
-
}, N = (t, n) => {
|
|
64
|
-
if (w.type !== "phone" || t == null) return;
|
|
65
|
-
let r = e(t, n);
|
|
66
|
-
r !== t && (C.value = r);
|
|
67
|
-
};
|
|
68
|
-
return v(C, (e, t) => {
|
|
69
|
-
N(e, t);
|
|
70
|
-
}), (e, n) => (f(), a("div", { class: d(O.value) }, [
|
|
71
|
-
w.before.length > 0 ? (f(), r(t, {
|
|
72
|
-
key: 0,
|
|
73
|
-
"icon-class": w.before,
|
|
74
|
-
onClick: M
|
|
75
|
-
}, null, 8, ["icon-class"])) : m(e.$slots, "prefix", {}, void 0, void 0, 1),
|
|
76
|
-
w.label.length > 0 ? (f(), a("label", {
|
|
77
|
-
key: 2,
|
|
78
|
-
for: w.name
|
|
79
|
-
}, [s(h(w.label), 1), w.required ? (f(), a("span", x, "*")) : i("", !0)], 8, b)) : i("", !0),
|
|
80
|
-
y(o("input", u({
|
|
81
|
-
"onUpdate:modelValue": n[0] ||= (e) => C.value = e,
|
|
82
|
-
required: w.required,
|
|
83
|
-
placeholder: w.required && w.label.length === 0 ? w.placeholder + "*" : w.placeholder,
|
|
84
|
-
type: w.type,
|
|
85
|
-
inputmode: w.inputMode,
|
|
86
|
-
id: w.name,
|
|
87
|
-
name: w.name,
|
|
88
|
-
size: w.inputSize,
|
|
89
|
-
onFocus: k,
|
|
90
|
-
onBlur: A,
|
|
91
|
-
maxlength: w.maxlength,
|
|
92
|
-
minlength: w.minlength,
|
|
93
|
-
autofocus: w.autofocus
|
|
94
|
-
}, e.$attrs), null, 16, S), [[_, C.value]]),
|
|
95
|
-
w.after.length > 0 ? (f(), r(t, {
|
|
96
|
-
key: 3,
|
|
97
|
-
"icon-class": w.after,
|
|
98
|
-
onClick: j
|
|
99
|
-
}, null, 8, ["icon-class"])) : m(e.$slots, "suffix", {}, void 0, void 0, 4)
|
|
100
|
-
], 2));
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
//#endregion
|
|
104
|
-
export { C as default };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./utils-DwvFrrWs.js";
|
|
2
|
-
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, mergeModels as o, normalizeClass as s, normalizeStyle as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, useModel as g, withModifiers as _ } from "vue";
|
|
3
|
-
//#region src/components/SwSlider.vue
|
|
4
|
-
var v = [
|
|
5
|
-
"onMouseenter",
|
|
6
|
-
"onMouseleave",
|
|
7
|
-
"onFocus",
|
|
8
|
-
"onBlur",
|
|
9
|
-
"onMousedown",
|
|
10
|
-
"onTouchstart"
|
|
11
|
-
], y = {
|
|
12
|
-
__name: "SwSlider",
|
|
13
|
-
props: /*@__PURE__*/ o({
|
|
14
|
-
class: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: ""
|
|
17
|
-
},
|
|
18
|
-
size: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: ""
|
|
21
|
-
},
|
|
22
|
-
min: {
|
|
23
|
-
type: Number,
|
|
24
|
-
default: 0
|
|
25
|
-
},
|
|
26
|
-
max: {
|
|
27
|
-
type: Number,
|
|
28
|
-
default: 100
|
|
29
|
-
},
|
|
30
|
-
step: {
|
|
31
|
-
type: Number,
|
|
32
|
-
default: 1
|
|
33
|
-
},
|
|
34
|
-
vertical: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
default: !1
|
|
37
|
-
},
|
|
38
|
-
showValue: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: !1
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
modelValue: {
|
|
44
|
-
type: [Number, Array],
|
|
45
|
-
required: !0
|
|
46
|
-
},
|
|
47
|
-
modelModifiers: {}
|
|
48
|
-
}),
|
|
49
|
-
emits: ["update:modelValue"],
|
|
50
|
-
setup(o) {
|
|
51
|
-
let y = g(o, "modelValue"), b = o, x = f([]), S = f([]), C = n(() => {
|
|
52
|
-
let e = ["sw-slider"];
|
|
53
|
-
return b.size.length > 0 && e.push("sw-" + b.size), b.class.length > 0 && e.push(b.class), b.vertical && e.push("vertical"), e;
|
|
54
|
-
}), w = (e) => {
|
|
55
|
-
let t = [...x.value];
|
|
56
|
-
t[e] = !0, x.value = t;
|
|
57
|
-
}, T = (e) => {
|
|
58
|
-
let t = [...x.value];
|
|
59
|
-
t[e] = !1, x.value = t;
|
|
60
|
-
}, E = (t) => {
|
|
61
|
-
let n = typeof document < "u" ? document.querySelector(".sw-slider") : null;
|
|
62
|
-
return n ? e(n, b.vertical) : b.vertical ? {
|
|
63
|
-
right: "100%",
|
|
64
|
-
marginRight: "10px"
|
|
65
|
-
} : {
|
|
66
|
-
bottom: "100%",
|
|
67
|
-
marginBottom: "10px"
|
|
68
|
-
};
|
|
69
|
-
}, D = n(() => Array.isArray(y.value)), O = n({
|
|
70
|
-
get() {
|
|
71
|
-
return D.value ? [...y.value] : [y.value];
|
|
72
|
-
},
|
|
73
|
-
set(e) {
|
|
74
|
-
D.value ? y.value = [...e].sort((e, t) => e - t) : y.value = e[0];
|
|
75
|
-
}
|
|
76
|
-
}), k = n(() => {
|
|
77
|
-
let e = b.max - b.min;
|
|
78
|
-
return O.value.map((t) => e === 0 ? 0 : (t - b.min) / e * 100);
|
|
79
|
-
}), A = n(() => {
|
|
80
|
-
if (b.vertical) if (D.value) {
|
|
81
|
-
let e = k.value[0] || 0, t = k.value[k.value.length - 1] || 0, n = Math.min(e, t);
|
|
82
|
-
return {
|
|
83
|
-
height: `${Math.max(e, t) - n}%`,
|
|
84
|
-
top: `${n}%`,
|
|
85
|
-
left: "0",
|
|
86
|
-
width: "100%"
|
|
87
|
-
};
|
|
88
|
-
} else return {
|
|
89
|
-
height: `${k.value[0] || 0}%`,
|
|
90
|
-
top: "0",
|
|
91
|
-
left: "0",
|
|
92
|
-
width: "100%"
|
|
93
|
-
};
|
|
94
|
-
else if (D.value) {
|
|
95
|
-
let e = k.value[0] || 0, t = k.value[k.value.length - 1] || 0, n = Math.min(e, t);
|
|
96
|
-
return {
|
|
97
|
-
width: `${Math.max(e, t) - n}%`,
|
|
98
|
-
left: `${n}%`,
|
|
99
|
-
top: "0",
|
|
100
|
-
height: "100%"
|
|
101
|
-
};
|
|
102
|
-
} else return {
|
|
103
|
-
width: `${k.value[0] || 0}%`,
|
|
104
|
-
left: "0",
|
|
105
|
-
top: "0",
|
|
106
|
-
height: "100%"
|
|
107
|
-
};
|
|
108
|
-
}), j = n(() => k.value.map((e, t) => b.vertical ? {
|
|
109
|
-
top: `${e}%`,
|
|
110
|
-
zIndex: O.value.length - t
|
|
111
|
-
} : {
|
|
112
|
-
left: `${e}%`,
|
|
113
|
-
zIndex: O.value.length - t
|
|
114
|
-
}));
|
|
115
|
-
function M(e) {
|
|
116
|
-
if (D.value) return;
|
|
117
|
-
let t = e.currentTarget.closest(".sw-slider");
|
|
118
|
-
if (!t) return;
|
|
119
|
-
let n = t.getBoundingClientRect(), r = b.vertical ? (e.clientY - n.top) / n.height : (e.clientX - n.left) / n.width, i = Math.max(0, Math.min(1, r)), a = b.max - b.min, o = b.min + i * a, s = Math.round((o - b.min) / b.step);
|
|
120
|
-
o = b.min + s * b.step, o = Math.max(b.min, Math.min(b.max, o)), O.value = [o], setTimeout(() => {
|
|
121
|
-
let e = [...S.value];
|
|
122
|
-
e[0] = E(0), S.value = e;
|
|
123
|
-
}, 0);
|
|
124
|
-
}
|
|
125
|
-
let N = f(!1), P = f(null), F = f(null);
|
|
126
|
-
function I(e, t) {
|
|
127
|
-
let n = e.target.closest(".sw-slider");
|
|
128
|
-
n && (F.value = n.getBoundingClientRect(), P.value = t, N.value = !0, z(e.clientX || e.touches?.[0]?.clientX, e.clientY || e.touches?.[0]?.clientY));
|
|
129
|
-
}
|
|
130
|
-
function L(e) {
|
|
131
|
-
N.value && (e.preventDefault?.(), z(e.clientX || e.touches?.[0]?.clientX, e.clientY || e.touches?.[0]?.clientY));
|
|
132
|
-
}
|
|
133
|
-
function R() {
|
|
134
|
-
N.value = !1, P.value = null;
|
|
135
|
-
}
|
|
136
|
-
function z(e, t) {
|
|
137
|
-
if (!F.value || P.value === null) return;
|
|
138
|
-
let n = F.value, r = b.vertical ? (t - n.top) / n.height : (e - n.left) / n.width, i = Math.max(0, Math.min(1, r)), a = b.max - b.min, o = b.min + i * a, s = Math.round((o - b.min) / b.step);
|
|
139
|
-
o = b.min + s * b.step, o = Math.max(b.min, Math.min(b.max, o));
|
|
140
|
-
let c = [...O.value];
|
|
141
|
-
c[P.value] = o, O.value = c, setTimeout(() => {
|
|
142
|
-
let e = [...S.value];
|
|
143
|
-
e[P.value] = E(P.value), S.value = e;
|
|
144
|
-
}, 0);
|
|
145
|
-
}
|
|
146
|
-
return l(() => {
|
|
147
|
-
window.addEventListener("mousemove", L), window.addEventListener("mouseup", R), window.addEventListener("touchmove", L, { passive: !1 }), window.addEventListener("touchend", R), x.value = Array(O.value.length).fill(!1);
|
|
148
|
-
}), u(() => {
|
|
149
|
-
window.removeEventListener("mousemove", L), window.removeEventListener("mouseup", R), window.removeEventListener("touchmove", L), window.removeEventListener("touchend", R);
|
|
150
|
-
}), (e, n) => (d(), i("div", { class: s(C.value) }, [a("div", {
|
|
151
|
-
class: "track",
|
|
152
|
-
onClick: M,
|
|
153
|
-
onMousedown: n[0] ||= _((e) => I(e, 0), ["prevent"]),
|
|
154
|
-
onTouchstart: n[1] ||= _((e) => I(e.touches[0], 0), ["prevent"])
|
|
155
|
-
}, [a("div", {
|
|
156
|
-
class: "fill",
|
|
157
|
-
style: c(A.value)
|
|
158
|
-
}, null, 4)], 32), (d(!0), i(t, null, p(O.value, (t, n) => (d(), i("div", {
|
|
159
|
-
class: "thumb",
|
|
160
|
-
key: n,
|
|
161
|
-
style: c(j.value[n]),
|
|
162
|
-
onMouseenter: (e) => w(n),
|
|
163
|
-
onMouseleave: (e) => T(n),
|
|
164
|
-
onFocus: (e) => w(n),
|
|
165
|
-
onBlur: (e) => T(n),
|
|
166
|
-
onMousedown: _((e) => I(e, n), ["prevent"]),
|
|
167
|
-
onTouchstart: _((e) => I(e.touches[0], n), ["prevent"])
|
|
168
|
-
}, [m(e.$slots, "default", {
|
|
169
|
-
index: n,
|
|
170
|
-
value: t
|
|
171
|
-
}), x.value[n] && o.showValue ? (d(), i("div", {
|
|
172
|
-
key: 0,
|
|
173
|
-
class: s(["tooltip", { "tooltip-vertical": b.vertical }]),
|
|
174
|
-
style: c(E(n))
|
|
175
|
-
}, h(t), 7)) : r("", !0)], 44, v))), 128))], 2));
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
//#endregion
|
|
179
|
-
export { y as default };
|