@studio-west/component-sw 0.10.8 → 0.10.10
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 +3 -3
- package/dist/{SwDatePicker-DPL2xnfr.js → SwDatePicker-D25T1Ubw.js} +100 -103
- package/dist/{SwDropdownItem-CKexOhlx.js → SwDropdownItem-DFIqJmpS.js} +1 -1
- package/dist/{SwGide-D0cE663C.js → SwGide-Ch5TIda2.js} +24 -31
- package/dist/SwInput-Bn7eL-Ur.js +89 -0
- package/dist/SwMessage-5_BqCfqv.js +57 -0
- package/dist/SwSlider-CQgfTwD_.js +140 -0
- package/dist/SwTable-BKZ5idCi.js +149 -0
- package/dist/{index-C4bjIOWO.js → index-DeMssusd.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -9
- package/dist/SwInput-DW08IfrK.js +0 -91
- package/dist/SwMessage-DGaPcMYb.js +0 -60
- package/dist/SwSlider-t6njKr4X.js +0 -142
- package/dist/SwTable-BLrFhlyO.js +0 -152
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { mergeModels as f, useModel as g, ref as p, useSlots as v, watch as k, nextTick as w, onUnmounted as h, createElementBlock as r, openBlock as c, normalizeClass as y, createCommentVNode as C, renderSlot as a, createElementVNode as _, unref as S, createTextVNode as V, createVNode as d, toDisplayString as $, withCtx as E } from "vue";
|
|
2
|
+
import M from "./SwButton-85-tKHA7.js";
|
|
3
|
+
import { _ as N } from "./index-DeMssusd.js";
|
|
4
|
+
const R = { key: 0 }, x = {
|
|
5
|
+
__name: "SwMessage",
|
|
6
|
+
props: /* @__PURE__ */ f({
|
|
7
|
+
name: { type: String, default: "" },
|
|
8
|
+
class: { type: String, default: "" },
|
|
9
|
+
iconAfter: { type: String, default: "" }
|
|
10
|
+
}, {
|
|
11
|
+
modelValue: {},
|
|
12
|
+
modelModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(i) {
|
|
16
|
+
const o = g(i, "modelValue"), s = i, l = p(null), m = v(), n = (e) => {
|
|
17
|
+
if (console.log("target - ", e.target), l.value && o.value) {
|
|
18
|
+
const t = l.value.getBoundingClientRect();
|
|
19
|
+
e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom || (o.value = !1);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return k(() => o.value, (e) => {
|
|
23
|
+
e ? (l.value.showModal(), w(), window.addEventListener("click", n, !0)) : (l.value.close(), window.removeEventListener("click", n));
|
|
24
|
+
}), h(() => {
|
|
25
|
+
window.removeEventListener("click", n);
|
|
26
|
+
}), (e, t) => (c(), r("dialog", {
|
|
27
|
+
class: y("sw-message " + s.class),
|
|
28
|
+
ref_key: "messageRef",
|
|
29
|
+
ref: l
|
|
30
|
+
}, [
|
|
31
|
+
s.name.length > 0 || S(m)?.header ? (c(), r("header", R, [
|
|
32
|
+
a(e.$slots, "header", {}, () => [
|
|
33
|
+
V($(s.name) + " ", 1),
|
|
34
|
+
d(M, {
|
|
35
|
+
link: "",
|
|
36
|
+
type: "primary",
|
|
37
|
+
onClick: t[0] || (t[0] = (u) => o.value = !1)
|
|
38
|
+
}, {
|
|
39
|
+
default: E(() => [
|
|
40
|
+
d(N, {
|
|
41
|
+
"icon-class": s.iconAfter
|
|
42
|
+
}, null, 8, ["icon-class"])
|
|
43
|
+
]),
|
|
44
|
+
_: 1
|
|
45
|
+
})
|
|
46
|
+
])
|
|
47
|
+
])) : C("", !0),
|
|
48
|
+
a(e.$slots, "default"),
|
|
49
|
+
_("footer", null, [
|
|
50
|
+
a(e.$slots, "footer")
|
|
51
|
+
])
|
|
52
|
+
], 2));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
x as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { mergeModels as C, useModel as F, ref as d, computed as c, onMounted as R, onUnmounted as I, createElementBlock as g, openBlock as w, normalizeClass as D, createElementVNode as N, normalizeStyle as $, Fragment as q, renderList as U, withModifiers as T, renderSlot as j, createCommentVNode as G, toDisplayString as H } from "vue";
|
|
2
|
+
import { c as J } from "./index-DeMssusd.js";
|
|
3
|
+
const K = { class: "track" }, O = ["onMouseenter", "onMouseleave", "onFocus", "onBlur", "onMousedown", "onTouchstart"], Z = {
|
|
4
|
+
__name: "SwSlider",
|
|
5
|
+
props: /* @__PURE__ */ C({
|
|
6
|
+
class: { type: String, default: "" },
|
|
7
|
+
size: { type: String, default: "" },
|
|
8
|
+
min: { type: Number, default: 0 },
|
|
9
|
+
max: { type: Number, default: 100 },
|
|
10
|
+
step: { type: Number, default: 1 },
|
|
11
|
+
vertical: { type: Boolean, default: !1 },
|
|
12
|
+
showValue: { type: Boolean, default: !1 }
|
|
13
|
+
}, {
|
|
14
|
+
modelValue: { type: [Number, Array], required: !0 },
|
|
15
|
+
modelModifiers: {}
|
|
16
|
+
}),
|
|
17
|
+
emits: ["update:modelValue"],
|
|
18
|
+
setup(y) {
|
|
19
|
+
const v = F(y, "modelValue"), n = y, u = d([]), S = d([]), k = c(
|
|
20
|
+
() => {
|
|
21
|
+
let e = ["sw-slider"];
|
|
22
|
+
return n.size.length > 0 && e.push("sw-" + n.size), n.class.length > 0 && e.push(n.class), n.vertical && e.push("vertical"), e;
|
|
23
|
+
}
|
|
24
|
+
), E = (e) => {
|
|
25
|
+
const t = [...u.value];
|
|
26
|
+
t[e] = !0, u.value = t;
|
|
27
|
+
}, V = (e) => {
|
|
28
|
+
const t = [...u.value];
|
|
29
|
+
t[e] = !1, u.value = t;
|
|
30
|
+
}, b = (e) => {
|
|
31
|
+
const t = document.querySelector(".sw-slider");
|
|
32
|
+
return t ? J(t, n.vertical) : n.vertical ? { right: "100%", marginRight: "10px" } : { bottom: "100%", marginBottom: "10px" };
|
|
33
|
+
}, h = c(() => Array.isArray(v.value)), r = c({
|
|
34
|
+
get() {
|
|
35
|
+
return h.value ? [...v.value] : [v.value];
|
|
36
|
+
},
|
|
37
|
+
set(e) {
|
|
38
|
+
h.value ? v.value = [...e].sort((t, l) => t - l) : v.value = e[0];
|
|
39
|
+
}
|
|
40
|
+
}), s = c(() => {
|
|
41
|
+
const e = n.max - n.min;
|
|
42
|
+
return r.value.map((t) => e === 0 ? 0 : (t - n.min) / e * 100);
|
|
43
|
+
}), A = c(() => {
|
|
44
|
+
if (n.vertical)
|
|
45
|
+
if (h.value) {
|
|
46
|
+
const e = s.value[0] || 0, t = s.value[s.value.length - 1] || 0, l = Math.min(e, t);
|
|
47
|
+
return {
|
|
48
|
+
height: `${Math.max(e, t) - l}%`,
|
|
49
|
+
top: `${l}%`,
|
|
50
|
+
left: "0",
|
|
51
|
+
width: "100%"
|
|
52
|
+
};
|
|
53
|
+
} else
|
|
54
|
+
return {
|
|
55
|
+
height: `${s.value[0] || 0}%`,
|
|
56
|
+
top: "0",
|
|
57
|
+
left: "0",
|
|
58
|
+
width: "100%"
|
|
59
|
+
};
|
|
60
|
+
else if (h.value) {
|
|
61
|
+
const e = s.value[0] || 0, t = s.value[s.value.length - 1] || 0, l = Math.min(e, t);
|
|
62
|
+
return {
|
|
63
|
+
width: `${Math.max(e, t) - l}%`,
|
|
64
|
+
left: `${l}%`,
|
|
65
|
+
top: "0",
|
|
66
|
+
height: "100%"
|
|
67
|
+
};
|
|
68
|
+
} else
|
|
69
|
+
return {
|
|
70
|
+
width: `${s.value[0] || 0}%`,
|
|
71
|
+
left: "0",
|
|
72
|
+
top: "0",
|
|
73
|
+
height: "100%"
|
|
74
|
+
};
|
|
75
|
+
}), X = c(() => s.value.map((e, t) => n.vertical ? { top: `${e}%`, zIndex: r.value.length - t } : { left: `${e}%`, zIndex: r.value.length - t })), M = d(!1), i = d(null), P = d(null);
|
|
76
|
+
function x(e, t) {
|
|
77
|
+
const l = e.target.closest(".sw-slider");
|
|
78
|
+
l && (P.value = l.getBoundingClientRect(), i.value = t, M.value = !0, L(e.clientX || e.touches?.[0]?.clientX, e.clientY || e.touches?.[0]?.clientY));
|
|
79
|
+
}
|
|
80
|
+
function p(e) {
|
|
81
|
+
if (!M.value) return;
|
|
82
|
+
e.preventDefault?.();
|
|
83
|
+
const t = e.clientX || e.touches?.[0]?.clientX, l = e.clientY || e.touches?.[0]?.clientY;
|
|
84
|
+
L(t, l);
|
|
85
|
+
}
|
|
86
|
+
function f() {
|
|
87
|
+
M.value = !1, i.value = null;
|
|
88
|
+
}
|
|
89
|
+
function L(e, t) {
|
|
90
|
+
if (!P.value || i.value === null) return;
|
|
91
|
+
const l = P.value, o = n.vertical ? (t - l.top) / l.height : (e - l.left) / l.width, a = Math.max(0, Math.min(1, o)), Y = n.max - n.min;
|
|
92
|
+
let m = n.min + a * Y;
|
|
93
|
+
const _ = Math.round((m - n.min) / n.step);
|
|
94
|
+
m = n.min + _ * n.step, m = Math.max(n.min, Math.min(n.max, m));
|
|
95
|
+
const B = [...r.value];
|
|
96
|
+
B[i.value] = m, r.value = B, setTimeout(() => {
|
|
97
|
+
const z = [...S.value];
|
|
98
|
+
z[i.value] = b(i.value), S.value = z;
|
|
99
|
+
}, 0);
|
|
100
|
+
}
|
|
101
|
+
return R(() => {
|
|
102
|
+
window.addEventListener("mousemove", p), window.addEventListener("mouseup", f), window.addEventListener("touchmove", p, { passive: !1 }), window.addEventListener("touchend", f), u.value = new Array(r.value.length).fill(!1);
|
|
103
|
+
}), I(() => {
|
|
104
|
+
window.removeEventListener("mousemove", p), window.removeEventListener("mouseup", f), window.removeEventListener("touchmove", p), window.removeEventListener("touchend", f);
|
|
105
|
+
}), (e, t) => (w(), g("div", {
|
|
106
|
+
class: D(k.value)
|
|
107
|
+
}, [
|
|
108
|
+
N("div", K, [
|
|
109
|
+
N("div", {
|
|
110
|
+
class: "fill",
|
|
111
|
+
style: $(A.value)
|
|
112
|
+
}, null, 4)
|
|
113
|
+
]),
|
|
114
|
+
(w(!0), g(q, null, U(r.value, (l, o) => (w(), g("div", {
|
|
115
|
+
class: "thumb",
|
|
116
|
+
key: o,
|
|
117
|
+
style: $(X.value[o]),
|
|
118
|
+
onMouseenter: (a) => E(o),
|
|
119
|
+
onMouseleave: (a) => V(o),
|
|
120
|
+
onFocus: (a) => E(o),
|
|
121
|
+
onBlur: (a) => V(o),
|
|
122
|
+
onMousedown: T((a) => x(a, o), ["prevent"]),
|
|
123
|
+
onTouchstart: T((a) => x(a.touches[0], o), ["prevent"])
|
|
124
|
+
}, [
|
|
125
|
+
j(e.$slots, "default", {
|
|
126
|
+
index: o,
|
|
127
|
+
value: l
|
|
128
|
+
}),
|
|
129
|
+
u.value[o] && y.showValue ? (w(), g("div", {
|
|
130
|
+
key: 0,
|
|
131
|
+
class: D(["tooltip", { "tooltip-vertical": n.vertical }]),
|
|
132
|
+
style: $(b())
|
|
133
|
+
}, H(l), 7)) : G("", !0)
|
|
134
|
+
], 44, O))), 128))
|
|
135
|
+
], 2));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
Z as default
|
|
140
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useSlots as F, ref as W, onMounted as G, computed as m, createElementBlock as c, openBlock as i, createElementVNode as R, Fragment as w, renderList as g, normalizeStyle as M, toDisplayString as S, renderSlot as J, createTextVNode as K } from "vue";
|
|
2
|
+
import O from "./SwTableColumn-BLF5bPuJ.js";
|
|
3
|
+
const P = { class: "sw-table" }, Q = ["colspan", "rowspan"], U = ["colspan", "rowspan"], Z = {
|
|
4
|
+
__name: "SwTable",
|
|
5
|
+
props: {
|
|
6
|
+
data: {
|
|
7
|
+
type: Array,
|
|
8
|
+
required: !0
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
setup(T) {
|
|
12
|
+
const x = T, E = F(), d = W([]);
|
|
13
|
+
function v(r) {
|
|
14
|
+
const n = [];
|
|
15
|
+
for (const t of r)
|
|
16
|
+
if (t.type === O) {
|
|
17
|
+
const o = {
|
|
18
|
+
...t.props,
|
|
19
|
+
children: []
|
|
20
|
+
}, e = t.children?.default?.();
|
|
21
|
+
e && e.length > 0 && (o.children = v(e)), n.push(o);
|
|
22
|
+
}
|
|
23
|
+
return n;
|
|
24
|
+
}
|
|
25
|
+
function k(r) {
|
|
26
|
+
if (!r || r.length === 0) return 1;
|
|
27
|
+
let n = 1;
|
|
28
|
+
for (const t of r)
|
|
29
|
+
if (t.children && t.children.length > 0) {
|
|
30
|
+
const o = k(t.children);
|
|
31
|
+
n = Math.max(n, 1 + o);
|
|
32
|
+
}
|
|
33
|
+
return n;
|
|
34
|
+
}
|
|
35
|
+
function V(r, n) {
|
|
36
|
+
const t = Array.from({ length: n }, () => []);
|
|
37
|
+
function o(e, p, u = "") {
|
|
38
|
+
for (let a = 0; a < e.length; a++) {
|
|
39
|
+
const l = e[a], h = u ? `${u}-${l.prop || a}` : l.prop || a;
|
|
40
|
+
if (l.children && l.children.length > 0) {
|
|
41
|
+
const s = B(l.children);
|
|
42
|
+
t[p].push({
|
|
43
|
+
key: h,
|
|
44
|
+
label: l.label,
|
|
45
|
+
colspan: s,
|
|
46
|
+
rowspan: 1,
|
|
47
|
+
width: l.width,
|
|
48
|
+
height: l.height
|
|
49
|
+
}), o(l.children, p + 1, h);
|
|
50
|
+
} else
|
|
51
|
+
t[p].push({
|
|
52
|
+
key: l.prop,
|
|
53
|
+
label: l.label,
|
|
54
|
+
colspan: 1,
|
|
55
|
+
rowspan: n - p,
|
|
56
|
+
width: l.width,
|
|
57
|
+
height: l.height,
|
|
58
|
+
prop: l.prop
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return o(r, 0), t;
|
|
63
|
+
}
|
|
64
|
+
function B(r) {
|
|
65
|
+
let n = 0;
|
|
66
|
+
function t(o) {
|
|
67
|
+
for (const e of o)
|
|
68
|
+
e.children && e.children.length > 0 ? t(e.children) : n++;
|
|
69
|
+
}
|
|
70
|
+
return t(r), n;
|
|
71
|
+
}
|
|
72
|
+
function L(r) {
|
|
73
|
+
const n = [];
|
|
74
|
+
function t(o) {
|
|
75
|
+
for (const e of o)
|
|
76
|
+
e.children && e.children.length > 0 ? t(e.children) : n.push(e);
|
|
77
|
+
}
|
|
78
|
+
return t(r), n;
|
|
79
|
+
}
|
|
80
|
+
function N(r, n) {
|
|
81
|
+
const t = [], o = /* @__PURE__ */ new Map();
|
|
82
|
+
return r.forEach((e, p) => {
|
|
83
|
+
const u = [];
|
|
84
|
+
n.forEach((a, l) => {
|
|
85
|
+
const h = `${p}-${a.prop}`;
|
|
86
|
+
if (o.has(h))
|
|
87
|
+
return;
|
|
88
|
+
const s = e[a.prop];
|
|
89
|
+
let $ = s, b = 1, _ = 1, D = {};
|
|
90
|
+
s && typeof s == "object" && s !== null && ($ = s.label || s.value || "", b = s.colspan || 1, _ = s.rowspan || 1, D = s.style || {});
|
|
91
|
+
const z = {
|
|
92
|
+
key: h,
|
|
93
|
+
label: $,
|
|
94
|
+
prop: a.prop,
|
|
95
|
+
colspan: b,
|
|
96
|
+
rowspan: _,
|
|
97
|
+
style: D,
|
|
98
|
+
originalRow: e,
|
|
99
|
+
rowIndex: p
|
|
100
|
+
};
|
|
101
|
+
u.push(z);
|
|
102
|
+
for (let f = 0; f < _; f++)
|
|
103
|
+
for (let y = 0; y < b; y++) {
|
|
104
|
+
if (f === 0 && y === 0) continue;
|
|
105
|
+
const C = `${p + f}-${n[l + y]?.prop}`;
|
|
106
|
+
C && o.set(C, !0);
|
|
107
|
+
}
|
|
108
|
+
}), u.length > 0 && t.push(u);
|
|
109
|
+
}), t;
|
|
110
|
+
}
|
|
111
|
+
G(() => {
|
|
112
|
+
const r = E.default?.() || [];
|
|
113
|
+
d.value = v(r);
|
|
114
|
+
});
|
|
115
|
+
const A = m(() => k(d.value)), H = m(() => V(d.value, A.value)), j = m(() => L(d.value)), q = m(() => N(x.data, j.value));
|
|
116
|
+
return (r, n) => (i(), c("table", P, [
|
|
117
|
+
R("thead", null, [
|
|
118
|
+
(i(!0), c(w, null, g(H.value, (t, o) => (i(), c("tr", { key: o }, [
|
|
119
|
+
(i(!0), c(w, null, g(t, (e) => (i(), c("th", {
|
|
120
|
+
key: e.key,
|
|
121
|
+
colspan: e.colspan,
|
|
122
|
+
rowspan: e.rowspan,
|
|
123
|
+
style: M({ minWidth: e.width, minHeight: e.height })
|
|
124
|
+
}, S(e.label), 13, Q))), 128))
|
|
125
|
+
]))), 128))
|
|
126
|
+
]),
|
|
127
|
+
R("tbody", null, [
|
|
128
|
+
(i(!0), c(w, null, g(q.value, (t, o) => (i(), c("tr", { key: o }, [
|
|
129
|
+
(i(!0), c(w, null, g(t, (e) => (i(), c("td", {
|
|
130
|
+
key: e.key,
|
|
131
|
+
colspan: e.colspan,
|
|
132
|
+
rowspan: e.rowspan,
|
|
133
|
+
style: M(e.style)
|
|
134
|
+
}, [
|
|
135
|
+
J(r.$slots, e.prop, {
|
|
136
|
+
row: e.originalRow,
|
|
137
|
+
$index: e.rowIndex
|
|
138
|
+
}, () => [
|
|
139
|
+
K(S(e.label), 1)
|
|
140
|
+
])
|
|
141
|
+
], 12, U))), 128))
|
|
142
|
+
]))), 128))
|
|
143
|
+
])
|
|
144
|
+
]));
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
Z as default
|
|
149
|
+
};
|
|
@@ -166,7 +166,7 @@ function v(e = {}) {
|
|
|
166
166
|
}), i = l.mount(document.createElement("div"));
|
|
167
167
|
p.appendChild(i.$el);
|
|
168
168
|
}
|
|
169
|
-
const y = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => G), "./components/SwButton.vue": () => import("./SwButton-85-tKHA7.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-CuN3EbT6.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-
|
|
169
|
+
const y = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => G), "./components/SwButton.vue": () => import("./SwButton-85-tKHA7.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-CuN3EbT6.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-D25T1Ubw.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-DQGTnnKw.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-DFIqJmpS.js"), "./components/SwDropdownNew.vue": () => import("./SwDropdownNew-CYfjZFd2.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CaA4jsoa.js"), "./components/SwGide.vue": () => import("./SwGide-Ch5TIda2.js"), "./components/SwIcon.vue": () => Promise.resolve().then(() => q), "./components/SwInput.vue": () => import("./SwInput-Bn7eL-Ur.js"), "./components/SwMessage.vue": () => import("./SwMessage-5_BqCfqv.js"), "./components/SwSection.vue": () => import("./SwSection-D8ooQ21I.js"), "./components/SwSelect.vue": () => import("./SwSelect-C2RKinez.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-B7ysp8L9.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSlider.vue": () => import("./SwSlider-CQgfTwD_.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-6rl1IT4p.js"), "./components/SwTable.vue": () => import("./SwTable-BKZ5idCi.js"), "./components/SwTableColumn.vue": () => import("./SwTableColumn-BLF5bPuJ.js"), "./components/SwTabs.vue": () => import("./SwTabs-DkSI4oAh.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-Dwtj8g7T.js") }), S = {};
|
|
170
170
|
for (const e in y) {
|
|
171
171
|
const o = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (n, t) => t.toUpperCase());
|
|
172
172
|
S[o] = F(() => y[e]());
|