@studio-west/component-sw 0.13.11 → 0.13.16
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 +159 -54
- package/dist/{SwButton-BfG2InPf.js → SwButton-DBj7jzhd.js} +1 -1
- package/dist/{SwDatePicker-BfuFsZeg.js → SwDatePicker-BwgaZLnR.js} +47 -47
- package/dist/{SwDropdown-BTADCvrN.js → SwDropdown-D5nIZEAM.js} +40 -23
- package/dist/SwDropdownItem-09XdzVHh.js +43 -0
- package/dist/{SwFile-D8wkf69j.js → SwFile-BTNWhEX-.js} +2 -2
- package/dist/SwFormItem-SuqNvXBQ.js +59 -0
- package/dist/SwGide-BScP5PoP.js +134 -0
- package/dist/{SwIcon-C4RHAbK1.js → SwIcon-Ce_Lj65y.js} +2 -2
- package/dist/{SwInput-0Eph7P-m.js → SwInput-D5cZvb4H.js} +2 -2
- package/dist/{SwMessage-WHO6knac.js → SwMessage-BRYFF_qT.js} +9 -5
- package/dist/{SwSelect-DwxIlRFI.js → SwSelect-Bo9kUY7P.js} +617 -494
- package/dist/SwSlider-Cl9pwY6h.js +197 -0
- package/dist/component-sw.css +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +91 -67
- 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 +8 -2
- 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/SwSlider-DkgJH6Bh.js +0 -179
|
@@ -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 };
|