@wikicasa-dev/components 2.0.21 → 2.0.22
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/dist/SimpleSlider.js +26 -20
- package/dist/assets/SimpleSlider.css +1 -1
- package/package.json +1 -1
package/dist/SimpleSlider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as V, mergeModels as L, useCssVars as S, useTemplateRef as T, useModel as y, ref as m,
|
|
2
|
-
import { _ as
|
|
3
|
-
import './assets/SimpleSlider.css';const
|
|
1
|
+
import { defineComponent as V, mergeModels as L, useCssVars as S, useTemplateRef as T, useModel as y, ref as m, watch as E, onMounted as C, openBlock as X, createElementBlock as $, createElementVNode as s, withModifiers as B } from "vue";
|
|
2
|
+
import { _ as D } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
3
|
+
import './assets/SimpleSlider.css';const W = ["aria-valuemin", "aria-valuemax", "aria-valuenow"], P = /* @__PURE__ */ V({
|
|
4
4
|
__name: "SimpleSlider",
|
|
5
5
|
props: /* @__PURE__ */ L({
|
|
6
6
|
min: { default: 0 },
|
|
@@ -15,12 +15,12 @@ import './assets/SimpleSlider.css';const D = ["aria-valuemin", "aria-valuemax",
|
|
|
15
15
|
emits: ["update:modelValue"],
|
|
16
16
|
setup(t) {
|
|
17
17
|
S((i) => ({
|
|
18
|
-
"
|
|
19
|
-
|
|
18
|
+
"0f43c897": r.value,
|
|
19
|
+
ec9c737a: d.value
|
|
20
20
|
}));
|
|
21
|
-
const o = T("customSlider"),
|
|
21
|
+
const o = T("customSlider"), u = y(t, "modelValue"), l = m(!1), d = m("50%"), r = m("50%"), c = (i = 0) => {
|
|
22
22
|
const e = t.logarithmic ? b(i) : k(i), a = (e - t.min) / (t.max - t.min), f = t.logarithmic ? h(e) : a * 100;
|
|
23
|
-
|
|
23
|
+
u.value = Math.round(e), d.value = `${Math.round(f)}%`, r.value = t.logarithmic ? `${Math.round(h(e))}%` : `${a * 100}%`;
|
|
24
24
|
}, k = (i = 0) => {
|
|
25
25
|
const e = Math.round((i - t.min) / t.step) * t.step + t.min;
|
|
26
26
|
return Math.max(t.min, Math.min(t.max, e));
|
|
@@ -39,39 +39,45 @@ import './assets/SimpleSlider.css';const D = ["aria-valuemin", "aria-valuemax",
|
|
|
39
39
|
);
|
|
40
40
|
return Math.max(t.min, Math.min(t.max, e));
|
|
41
41
|
}, v = (i) => {
|
|
42
|
-
if (!
|
|
42
|
+
if (!l.value || !o.value) return;
|
|
43
43
|
const e = o.value.getBoundingClientRect(), a = o.value.offsetWidth;
|
|
44
44
|
let n = ("touches" in i ? i.touches[0].clientX : i.clientX) - e.left;
|
|
45
45
|
n = Math.max(0, Math.min(a, n));
|
|
46
46
|
const w = t.logarithmic ? x(n / a * 100) : n / a * (t.max - t.min) + t.min;
|
|
47
47
|
c(w);
|
|
48
48
|
}, M = () => {
|
|
49
|
-
|
|
49
|
+
l.value = !0;
|
|
50
50
|
}, g = () => {
|
|
51
|
-
|
|
51
|
+
l.value = !1;
|
|
52
52
|
};
|
|
53
|
-
return
|
|
53
|
+
return E(
|
|
54
|
+
u,
|
|
55
|
+
(i) => {
|
|
56
|
+
c(i);
|
|
57
|
+
},
|
|
58
|
+
{ immediate: !0 }
|
|
59
|
+
), C(() => {
|
|
54
60
|
document.addEventListener("mousemove", v), document.addEventListener("mouseup", g), document.addEventListener("touchmove", v, { passive: !0 }), document.addEventListener("touchend", g, { passive: !0 });
|
|
55
|
-
}), (i, e) => (
|
|
56
|
-
|
|
61
|
+
}), (i, e) => (X(), $("div", null, [
|
|
62
|
+
s("div", {
|
|
57
63
|
ref: "customSlider",
|
|
58
64
|
class: "uikit-relative uikit-my-20px uikit-h-1 uikit-rounded-2xs uikit-bg-w-secondary",
|
|
59
65
|
role: "slider",
|
|
60
66
|
"aria-valuemin": i.min,
|
|
61
67
|
"aria-valuemax": i.max,
|
|
62
|
-
"aria-valuenow":
|
|
68
|
+
"aria-valuenow": u.value,
|
|
63
69
|
tabindex: "0"
|
|
64
70
|
}, [
|
|
65
|
-
e[2] || (e[2] =
|
|
66
|
-
|
|
71
|
+
e[2] || (e[2] = s("div", { class: "slider-track uikit-absolute uikit-left-0 uikit-top-0 uikit-h-full uikit-rounded-2xs uikit-bg-w-primary" }, null, -1)),
|
|
72
|
+
s("div", {
|
|
67
73
|
class: "slider-thumb uikit-absolute -uikit-top-2 uikit-size-20px -uikit-translate-x-1/2 uikit-cursor-pointer uikit-rounded-full uikit-border-2 uikit-border-solid uikit-border-w-primary uikit-bg-white",
|
|
68
74
|
onMousedown: e[0] || (e[0] = (a) => M()),
|
|
69
|
-
onTouchstart: e[1] || (e[1] =
|
|
75
|
+
onTouchstart: e[1] || (e[1] = B((a) => M(), ["prevent"]))
|
|
70
76
|
}, null, 32)
|
|
71
|
-
], 8,
|
|
77
|
+
], 8, W)
|
|
72
78
|
]));
|
|
73
79
|
}
|
|
74
|
-
}),
|
|
80
|
+
}), I = /* @__PURE__ */ D(P, [["__scopeId", "data-v-54b825e3"]]);
|
|
75
81
|
export {
|
|
76
|
-
|
|
82
|
+
I as default
|
|
77
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.slider-track[data-v-
|
|
1
|
+
.slider-track[data-v-54b825e3]{width:var(--0f43c897)}.slider-thumb[data-v-54b825e3]{left:var(--ec9c737a)}
|