@studio-west/component-sw 0.3.44 → 0.3.46
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/{SwDatePicker-DxDM0h5b.js → SwDatePicker-DR4nTqDO.js} +57 -57
- package/dist/{SwDropdown-HVAlEbEM.js → SwDropdown-BQwvEVfc.js} +14 -14
- package/dist/{SwInput-DUCowmhB.js → SwInput-DvR1W8tc.js} +1 -1
- package/dist/{index-DVBROBVH.js → index-CTlrchY8.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ref as c, createElementBlock as
|
|
2
|
-
import { p as Y } from "./index-
|
|
3
|
-
const K = { class: "sw-data-picker" }, ee = { class: "month_year" }, te = { class: "text" }, ae = { class: "week" }, ne = { class: "month" }, le = ["onClick"], se = { key: 0 }, oe = { class: "month_year" }, ue = { class: "text" },
|
|
1
|
+
import { ref as c, createElementBlock as f, openBlock as g, createElementVNode as l, createCommentVNode as I, withModifiers as y, toDisplayString as M, unref as k, Fragment as x, renderList as S, normalizeClass as W } from "vue";
|
|
2
|
+
import { p as Y } from "./index-CTlrchY8.js";
|
|
3
|
+
const K = { class: "sw-data-picker" }, ee = { class: "month_year" }, te = { class: "text" }, ae = { class: "week" }, ne = { class: "month" }, le = ["onClick"], se = { key: 0 }, oe = { class: "month_year" }, ue = { class: "text" }, ie = { class: "week" }, re = { class: "month" }, ve = ["onClick"], he = {
|
|
4
4
|
__name: "SwDatePicker",
|
|
5
5
|
props: {
|
|
6
6
|
data: Object,
|
|
@@ -16,21 +16,21 @@ const K = { class: "sw-data-picker" }, ee = { class: "month_year" }, te = { clas
|
|
|
16
16
|
emits: ["input"],
|
|
17
17
|
setup(q, { emit: G }) {
|
|
18
18
|
var V, A, P, R;
|
|
19
|
-
const u = q,
|
|
19
|
+
const u = q, j = G, m = c(/* @__PURE__ */ new Date()), T = c(/* @__PURE__ */ new Date()), i = c((/* @__PURE__ */ new Date()).getFullYear()), o = c((/* @__PURE__ */ new Date()).getMonth()), B = c((/* @__PURE__ */ new Date()).getFullYear()), N = c((/* @__PURE__ */ new Date()).getMonth()), z = c((/* @__PURE__ */ new Date()).getMonth() + 1), s = c([]), F = c(0), v = c(-1), w = c(-1), H = c(navigator.languages || "ru"), _ = /en|zh|ja|he/.test(H.value) ? 0 : 1, D = (t) => {
|
|
20
20
|
let e = t.split(t.match(/\D.*?\D?/));
|
|
21
21
|
return e[0].length > 2 ? e.join("-") + "T00:00:01" : e.reverse().join("-") + "T00:00:01";
|
|
22
22
|
};
|
|
23
|
-
(V = u.data) != null && V.startDate && (
|
|
23
|
+
(V = u.data) != null && V.startDate && (m.value = new Date(D(u.data.startDate)), i.value = m.value.getFullYear(), o.value = m.value.getMonth()), (A = u.data) != null && A.endDate && u.range === "range" && (T.value = new Date(D(u.data.endDate)), B.value = T.value.getFullYear(), N.value = T.value.getMonth());
|
|
24
24
|
const L = () => {
|
|
25
25
|
s.value = [], F.value = 0;
|
|
26
|
-
const t = new Date(
|
|
26
|
+
const t = new Date(i.value, o.value, 0);
|
|
27
27
|
for (let a = t.getDate() - t.getDay() + _; a <= t.getDate(); a++)
|
|
28
28
|
t.getDay() !== 6 + _ && (s.value.push({ day: a, month: t.getMonth(), year: t.getFullYear(), class: [] }), F.value++);
|
|
29
|
-
const e = new Date(
|
|
29
|
+
const e = new Date(i.value, o.value + 1, 0).getDate();
|
|
30
30
|
for (let a = 1; a <= e; a++)
|
|
31
|
-
s.value.push({ day: a, month: o.value, year:
|
|
31
|
+
s.value.push({ day: a, month: o.value, year: i.value, class: [] }), F.value++;
|
|
32
32
|
if (u.range === "range") {
|
|
33
|
-
const a = new Date(
|
|
33
|
+
const a = new Date(i.value, o.value + 1, 1), n = new Date(i.value, o.value + 2, 0).getDate();
|
|
34
34
|
for (let d = 1; d <= n; d++)
|
|
35
35
|
s.value.push({ day: d, month: a.getMonth(), year: a.getFullYear(), class: [] });
|
|
36
36
|
}
|
|
@@ -40,7 +40,7 @@ const K = { class: "sw-data-picker" }, ee = { class: "month_year" }, te = { clas
|
|
|
40
40
|
if (!((e = u.data) != null && e.holiday)) return;
|
|
41
41
|
const t = (a, n) => {
|
|
42
42
|
a.forEach((d) => {
|
|
43
|
-
const [
|
|
43
|
+
const [r, h, p] = d.split("-").map(Number), C = s.value.findIndex((E) => E.year === r && E.month + 1 === h && E.day === p);
|
|
44
44
|
C !== -1 && (s.value[C].class[0] = n);
|
|
45
45
|
});
|
|
46
46
|
};
|
|
@@ -56,21 +56,21 @@ const K = { class: "sw-data-picker" }, ee = { class: "month_year" }, te = { clas
|
|
|
56
56
|
return console.warn("Warning: Диапазоны пересекаются:", t[e - 1], t[e]), !0;
|
|
57
57
|
}
|
|
58
58
|
return !1;
|
|
59
|
-
},
|
|
59
|
+
}, $ = (t, e, a) => {
|
|
60
60
|
if (!u.limitation || u.limitation.length === 0) return !0;
|
|
61
61
|
const n = new Date(t, e, a).getTime();
|
|
62
62
|
for (let d of u.limitation) {
|
|
63
|
-
const { startDate:
|
|
64
|
-
if (!
|
|
63
|
+
const { startDate: r, endDate: h } = d;
|
|
64
|
+
if (!r && h) {
|
|
65
65
|
const p = new Date(D(h)).getTime();
|
|
66
66
|
if (n <= p) return !1;
|
|
67
67
|
}
|
|
68
|
-
if (
|
|
69
|
-
const p = new Date(D(
|
|
68
|
+
if (r && !h) {
|
|
69
|
+
const p = new Date(D(r)).getTime();
|
|
70
70
|
if (n >= p) return !1;
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
73
|
-
const p = new Date(D(
|
|
72
|
+
if (r && h) {
|
|
73
|
+
const p = new Date(D(r)).getTime(), C = new Date(D(h)).getTime();
|
|
74
74
|
if (p <= C) {
|
|
75
75
|
if (n >= p && n <= C) return !1;
|
|
76
76
|
} else if (n >= p || n <= C) return !1;
|
|
@@ -79,115 +79,115 @@ const K = { class: "sw-data-picker" }, ee = { class: "month_year" }, te = { clas
|
|
|
79
79
|
return !0;
|
|
80
80
|
}, O = (t, e) => {
|
|
81
81
|
const a = Y(new Date(t.year, t.month, t.day), "{dd}.{m}.{Y}");
|
|
82
|
-
u.range === "range" ? w.value !== -1 ? (U(), v.value = e, s.value[e].class[1] = "active") : v.value !== -1 ? (w.value = e, X(v.value, w.value, a)) : (v.value = e, s.value[e].class[1] = "active") : (v.value !== -1 && (s.value[v.value].class[1] = ""), v.value = e, s.value[e].class[1] = "active",
|
|
82
|
+
u.range === "range" ? w.value !== -1 ? (U(), v.value = e, s.value[e].class[1] = "active") : v.value !== -1 ? (w.value = e, X(v.value, w.value, a)) : (v.value = e, s.value[e].class[1] = "active") : (v.value !== -1 && (s.value[v.value].class[1] = ""), v.value = e, s.value[e].class[1] = "active", j("input", { dateStart: a, count: 1 }));
|
|
83
83
|
}, U = () => {
|
|
84
84
|
s.value.forEach((t) => t.class[1] = ""), v.value = -1, w.value = -1;
|
|
85
85
|
}, X = (t, e, a) => {
|
|
86
86
|
let n = Y(new Date(s.value[t].year, s.value[t].month, s.value[t].day), "{dd}.{m}.{Y}"), d = Z(t, e);
|
|
87
87
|
if (e >= t)
|
|
88
|
-
for (let
|
|
89
|
-
s.value[
|
|
88
|
+
for (let r = t + 1; r < e; r++)
|
|
89
|
+
s.value[r].class[1] = "select";
|
|
90
90
|
else
|
|
91
|
-
for (let
|
|
92
|
-
s.value[
|
|
93
|
-
s.value[e].class[1] = "active",
|
|
91
|
+
for (let r = e + 1; r < t; r++)
|
|
92
|
+
s.value[r].class[1] = "select";
|
|
93
|
+
s.value[e].class[1] = "active", j("input", { dateStart: n, dateEnd: a, count: d });
|
|
94
94
|
}, Z = (t, e) => {
|
|
95
|
-
var
|
|
95
|
+
var r;
|
|
96
96
|
let a = Math.abs(t - e) + 1, [n, d] = [Math.min(t, e), Math.max(t, e)];
|
|
97
97
|
for (let h = n; h <= d; h++)
|
|
98
|
-
((
|
|
98
|
+
((r = s.value[h]) == null ? void 0 : r.class[0]) === "holiday" && a--;
|
|
99
99
|
return a;
|
|
100
100
|
}, b = (t, e) => {
|
|
101
|
-
|
|
101
|
+
$(t, e) && (m.value = new Date(t, e, 1), i.value = m.value.getFullYear(), o.value = m.value.getMonth(), L());
|
|
102
102
|
};
|
|
103
|
-
if (L(), Q() && console.error("Ошибка: Найдены пересекающиеся диапазоны!"), (P = u.data) != null && P.startDate && (v.value = s.value.findIndex((t) => t.day ===
|
|
103
|
+
if (L(), Q() && console.error("Ошибка: Найдены пересекающиеся диапазоны!"), (P = u.data) != null && P.startDate && (v.value = s.value.findIndex((t) => t.day === m.value.getDate() && t.month === o.value && t.year === i.value), v.value !== -1 && (s.value[v.value].class[1] = "active")), (R = u.data) != null && R.endDate && u.range === "range" && (w.value = s.value.findIndex((t) => t.day === T.value.getDate() && t.month === N.value && t.year === B.value), w.value !== -1)) {
|
|
104
104
|
s.value[w.value].class[1] = "active";
|
|
105
105
|
for (let t = v.value + 1; t < w.value; t++)
|
|
106
106
|
s.value[t].class[1] = "select";
|
|
107
107
|
}
|
|
108
|
-
return (t, e) => (
|
|
108
|
+
return (t, e) => (g(), f("div", K, [
|
|
109
109
|
l("div", null, [
|
|
110
110
|
l("p", ee, [
|
|
111
111
|
l("span", null, [
|
|
112
112
|
l("button", {
|
|
113
|
-
onClick: e[0] || (e[0] =
|
|
113
|
+
onClick: e[0] || (e[0] = y((a) => b(i.value - 1, o.value), ["prevent"]))
|
|
114
114
|
}, "«"),
|
|
115
115
|
l("button", {
|
|
116
|
-
onClick: e[1] || (e[1] =
|
|
116
|
+
onClick: e[1] || (e[1] = y((a) => b(i.value, o.value - 1), ["prevent"]))
|
|
117
117
|
}, "‹")
|
|
118
118
|
]),
|
|
119
119
|
l("span", te, [
|
|
120
|
-
l("button", null,
|
|
121
|
-
l("button", null,
|
|
120
|
+
l("button", null, M(i.value), 1),
|
|
121
|
+
l("button", null, M(k(Y)(m.value.setMonth(o.value), "{F}")), 1)
|
|
122
122
|
]),
|
|
123
123
|
l("span", null, [
|
|
124
124
|
l("button", {
|
|
125
|
-
onClick: e[2] || (e[2] =
|
|
125
|
+
onClick: e[2] || (e[2] = y((a) => b(i.value, o.value + 1), ["prevent"]))
|
|
126
126
|
}, "›"),
|
|
127
127
|
l("button", {
|
|
128
|
-
onClick: e[3] || (e[3] =
|
|
128
|
+
onClick: e[3] || (e[3] = y((a) => b(i.value + 1, o.value), ["prevent"]))
|
|
129
129
|
}, "»")
|
|
130
130
|
])
|
|
131
131
|
]),
|
|
132
132
|
l("div", ae, [
|
|
133
|
-
(
|
|
133
|
+
(g(), f(x, null, S(7, (a, n) => l("button", {
|
|
134
134
|
key: n,
|
|
135
135
|
class: "disabled"
|
|
136
|
-
},
|
|
136
|
+
}, M(k(Y)(new Date(1970, 1, a + k(_)), "{D}")), 1)), 64))
|
|
137
137
|
]),
|
|
138
138
|
l("div", ne, [
|
|
139
|
-
(
|
|
140
|
-
n < F.value + (7 - new Date(
|
|
139
|
+
(g(!0), f(x, null, S(s.value, (a, n) => (g(), f(x, { key: n }, [
|
|
140
|
+
n < F.value + (7 - new Date(i.value, o.value + 1, 1).getDay() + k(_)) % 7 ? (g(), f("button", {
|
|
141
141
|
key: 0,
|
|
142
|
-
class: W(a.month === o.value &&
|
|
142
|
+
class: W(a.month === o.value && $(a.year, a.month, a.day) ? a.class : "disabled"),
|
|
143
143
|
onClick: () => {
|
|
144
144
|
a.month === o.value && O(a, n);
|
|
145
145
|
}
|
|
146
|
-
},
|
|
146
|
+
}, M(a.day), 11, le)) : I("", !0)
|
|
147
147
|
], 64))), 128))
|
|
148
148
|
])
|
|
149
149
|
]),
|
|
150
|
-
u.range === "range" ? (
|
|
150
|
+
u.range === "range" ? (g(), f("div", se, [
|
|
151
151
|
l("p", oe, [
|
|
152
152
|
l("span", null, [
|
|
153
153
|
l("button", {
|
|
154
|
-
onClick: e[4] || (e[4] =
|
|
154
|
+
onClick: e[4] || (e[4] = y((a) => b(i.value - 1, o.value), ["prevent"]))
|
|
155
155
|
}, "«"),
|
|
156
156
|
l("button", {
|
|
157
|
-
onClick: e[5] || (e[5] =
|
|
157
|
+
onClick: e[5] || (e[5] = y((a) => b(i.value, o.value - 1), ["prevent"]))
|
|
158
158
|
}, "‹")
|
|
159
159
|
]),
|
|
160
160
|
l("span", ue, [
|
|
161
|
-
l("button", null,
|
|
162
|
-
l("button", null,
|
|
161
|
+
l("button", null, M(new Date(i.value, o.value + 1).getFullYear()), 1),
|
|
162
|
+
l("button", null, M(k(Y)(m.value.setMonth(o.value + 1), "{F}")), 1)
|
|
163
163
|
]),
|
|
164
164
|
l("span", null, [
|
|
165
165
|
l("button", {
|
|
166
|
-
onClick: e[6] || (e[6] =
|
|
166
|
+
onClick: e[6] || (e[6] = y((a) => b(i.value, o.value + 1), ["prevent"]))
|
|
167
167
|
}, "›"),
|
|
168
168
|
l("button", {
|
|
169
|
-
onClick: e[7] || (e[7] =
|
|
169
|
+
onClick: e[7] || (e[7] = y((a) => b(i.value + 1, o.value), ["prevent"]))
|
|
170
170
|
}, "»")
|
|
171
171
|
])
|
|
172
172
|
]),
|
|
173
|
-
l("div",
|
|
174
|
-
(
|
|
173
|
+
l("div", ie, [
|
|
174
|
+
(g(), f(x, null, S(7, (a, n) => l("button", {
|
|
175
175
|
key: n,
|
|
176
176
|
class: "disabled"
|
|
177
|
-
},
|
|
177
|
+
}, M(k(Y)(new Date(1970, 1, a + k(_)), "{D}")), 1)), 64))
|
|
178
178
|
]),
|
|
179
|
-
l("div",
|
|
180
|
-
(
|
|
181
|
-
n >= F.value - (7 + new Date(
|
|
179
|
+
l("div", re, [
|
|
180
|
+
(g(!0), f(x, null, S(s.value, (a, n) => (g(), f(x, { key: n }, [
|
|
181
|
+
n >= F.value - (7 + new Date(i.value, o.value + 1, 1).getDay() - k(_)) % 7 ? (g(), f("button", {
|
|
182
182
|
key: 0,
|
|
183
|
-
class: W(a.month === z.value
|
|
183
|
+
class: W(a.month === z.value && $(a.year, a.month, a.day) ? a.class : "disabled"),
|
|
184
184
|
onClick: () => {
|
|
185
|
-
a.month === z.value
|
|
185
|
+
a.month === z.value && O(a, n);
|
|
186
186
|
}
|
|
187
|
-
},
|
|
187
|
+
}, M(a.day), 11, ve)) : I("", !0)
|
|
188
188
|
], 64))), 128))
|
|
189
189
|
])
|
|
190
|
-
])) :
|
|
190
|
+
])) : I("", !0)
|
|
191
191
|
]));
|
|
192
192
|
}
|
|
193
193
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as b, ref as p, watch as W, nextTick as M, onMounted as B, onUnmounted as T, createElementBlock as k, openBlock as
|
|
1
|
+
import { computed as b, ref as p, watch as W, nextTick as M, onMounted as B, onUnmounted as T, createElementBlock as k, openBlock as f, withModifiers as m, normalizeClass as x, renderSlot as $, createBlock as H, Teleport as O, createCommentVNode as P, normalizeStyle as N, unref as q } from "vue";
|
|
2
2
|
const A = ["id"], U = {
|
|
3
3
|
__name: "SwDropdown",
|
|
4
4
|
props: {
|
|
@@ -13,7 +13,7 @@ const A = ["id"], U = {
|
|
|
13
13
|
setup(S) {
|
|
14
14
|
const l = S;
|
|
15
15
|
b(() => "dropdown" + Array.from(document.body.children).indexOf(document.querySelector("ul")));
|
|
16
|
-
const e = p(!1), d = p(null), u = p(null), v = p({}),
|
|
16
|
+
const e = p(!1), d = p(null), u = p(null), v = p({}), g = Math.ceil(Math.random() * 1e3), E = b(
|
|
17
17
|
() => {
|
|
18
18
|
let t = ["sw-dropdown"];
|
|
19
19
|
return l.size.length > 0 && t.push("sw-" + l.size), l.type.length > 0 && t.push("sw-" + l.type), t;
|
|
@@ -26,8 +26,8 @@ const A = ["id"], U = {
|
|
|
26
26
|
if (await M(), !u.value) return;
|
|
27
27
|
const t = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft;
|
|
28
28
|
document.body.style.position = "fixed", document.body.style.top = `-${t}px`, document.body.style.left = `-${n}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = t, document.documentElement.scrollLeft = n;
|
|
29
|
-
const o = d.value.getBoundingClientRect(), r = u.value.offsetHeight,
|
|
30
|
-
console.log("popupHeight", r), console.log("popupWidth",
|
|
29
|
+
const o = d.value.getBoundingClientRect(), r = u.value.offsetHeight, c = u.value.offsetWidth;
|
|
30
|
+
console.log("popupHeight", r), console.log("popupWidth", c);
|
|
31
31
|
let s = o.left + o.width / 2 + n, i = o.top + o.height / 2 + t;
|
|
32
32
|
const [L, R] = l.placement.split("-", 2);
|
|
33
33
|
switch (console.log(l.placement), L) {
|
|
@@ -38,7 +38,7 @@ const A = ["id"], U = {
|
|
|
38
38
|
i = i - o.height / 2 - 8 - r;
|
|
39
39
|
break;
|
|
40
40
|
case "left":
|
|
41
|
-
s = s -
|
|
41
|
+
s = s - c - o.width / 2 - 8, i = i - r / 2;
|
|
42
42
|
break;
|
|
43
43
|
case "right":
|
|
44
44
|
s = s + o.width / 2 + 8, i = i - r / 2;
|
|
@@ -49,7 +49,7 @@ const A = ["id"], U = {
|
|
|
49
49
|
s = s - o.width / 2;
|
|
50
50
|
break;
|
|
51
51
|
case "right":
|
|
52
|
-
s = s -
|
|
52
|
+
s = s - c + o.width / 2;
|
|
53
53
|
break;
|
|
54
54
|
}
|
|
55
55
|
s < 0 && (s = 0), i < 0 && (i = 0), v.value = {
|
|
@@ -67,28 +67,28 @@ const A = ["id"], U = {
|
|
|
67
67
|
}, y = () => {
|
|
68
68
|
e.value && a();
|
|
69
69
|
}, h = (t) => {
|
|
70
|
-
|
|
70
|
+
!t.target.closest(`[id="${g}"]`) && d.value && !d.value.contains(t.target) && (e.value = !1);
|
|
71
71
|
};
|
|
72
72
|
return B(() => {
|
|
73
73
|
window.addEventListener("resize", y), window.addEventListener("click", h);
|
|
74
74
|
}), T(() => {
|
|
75
75
|
window.removeEventListener("resize", y), window.removeEventListener("click", h);
|
|
76
|
-
}), (t, n) => (
|
|
76
|
+
}), (t, n) => (f(), k("div", {
|
|
77
77
|
class: x(E.value),
|
|
78
78
|
onClick: n[0] || (n[0] = (o) => z()),
|
|
79
|
-
onMouseover: n[1] || (n[1] =
|
|
80
|
-
onMouseleave: n[2] || (n[2] =
|
|
81
|
-
onContextmenu: n[3] || (n[3] =
|
|
79
|
+
onMouseover: n[1] || (n[1] = m((o) => w(), ["stop"])),
|
|
80
|
+
onMouseleave: n[2] || (n[2] = m((o) => w(), ["stop"])),
|
|
81
|
+
onContextmenu: n[3] || (n[3] = m((o) => C(), ["stop"])),
|
|
82
82
|
ref_key: "dropdownRef",
|
|
83
83
|
ref: d
|
|
84
84
|
}, [
|
|
85
85
|
$(t.$slots, "default"),
|
|
86
|
-
(
|
|
87
|
-
e.value ? (
|
|
86
|
+
(f(), H(O, { to: "body" }, [
|
|
87
|
+
e.value ? (f(), k("ul", {
|
|
88
88
|
key: 0,
|
|
89
89
|
ref_key: "popupRef",
|
|
90
90
|
ref: u,
|
|
91
|
-
id: q(
|
|
91
|
+
id: q(g),
|
|
92
92
|
class: x(["sw-dropdown-popup", l.class]),
|
|
93
93
|
style: N(v.value),
|
|
94
94
|
tabindex: "-1"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mergeModels as y, useModel as V, ref as C, computed as I, watch as M, createElementBlock as d, openBlock as i, normalizeClass as A, createBlock as v, renderSlot as _, createCommentVNode as x, withDirectives as E, createTextVNode as N, toDisplayString as R, createElementVNode as T, vModelDynamic as F } from "vue";
|
|
2
|
-
import { S } from "./index-
|
|
2
|
+
import { S } from "./index-CTlrchY8.js";
|
|
3
3
|
const O = ["for"], U = {
|
|
4
4
|
key: 0,
|
|
5
5
|
title: "Это поле обязательно для заполнения."
|
|
@@ -148,7 +148,7 @@ function w(e = {}) {
|
|
|
148
148
|
}), t = n.mount(document.createElement("div"));
|
|
149
149
|
l.appendChild(t.$el);
|
|
150
150
|
}
|
|
151
|
-
const h = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => U), "./components/SwButton.vue": () => import("./SwButton-0uPLNlAn.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-DxAVOWF1.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-
|
|
151
|
+
const h = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => U), "./components/SwButton.vue": () => import("./SwButton-0uPLNlAn.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-DxAVOWF1.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-DR4nTqDO.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-BQwvEVfc.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-C3_wJ1DL.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CfnEis1u.js"), "./components/SwInput.vue": () => import("./SwInput-DvR1W8tc.js"), "./components/SwMessage.vue": () => import("./SwMessage-BB2yKYsR.js"), "./components/SwSection.vue": () => import("./SwSection-CaY8OFmf.js"), "./components/SwSelect.vue": () => import("./SwSelect-0vcmQ8qv.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-DWILNFfF.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-BxSLWRTx.js"), "./components/SwTabs.vue": () => import("./SwTabs-DgvDpw7u.js"), "./components/SwTabsNew.vue": () => import("./SwTabsNew-Dr5Vyz6M.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-BUUmFjh7.js"), "./components/SwTabsPaneNew.vue": () => import("./SwTabsPaneNew-DFPu-sRT.js") }), d = {};
|
|
152
152
|
for (const e in h) {
|
|
153
153
|
const n = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (t, o) => o.toUpperCase());
|
|
154
154
|
d[n] = O(() => h[e]());
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(T,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(T=typeof globalThis<"u"?globalThis:T||self,e(T["component-sw"]={},T.vue))})(this,function(T,e){"use strict";function X(a){return/^(https?:|mailto:|tel:)/.test(a)}function j(a,l){if(arguments.length===0||!a)return null;const t=l||"{Y}-{m}-{d} {G}:{i}:{s}";let o;typeof a=="object"?o=a:(typeof a=="string"&&(/^[0-9]+$/.test(a)?a=parseInt(a):a=a.replace(new RegExp(/-/gm),"/")),typeof a=="number"&&a.toString().length===10&&(a=a*1e3),o=new Date(a));const n="ru-RU",d={Y:o.getFullYear(),m:(o.getMonth()+1).toString().padStart(2,"0"),d:o.getDate(),dd:o.getDate().toString().padStart(2,"0"),G:o.getHours(),H:o.getHours().toString().padStart(2,"0"),i:o.getMinutes().toString().padStart(2,"0"),s:o.getSeconds().toString().padStart(2,"0"),D:new Intl.DateTimeFormat(n,{weekday:"short"}).format(o),F:new Intl.DateTimeFormat(n,{month:"long"}).format(o),M:new Intl.DateTimeFormat(n,{month:"short"}).format(o)};return t.replace(/{(dd|[YmdGHisDFM])+}/g,(i,p)=>d[p])}const J=(a,l)=>{const t=a.__vccOpts||a;for(const[o,n]of l)t[o]=n;return t},Q={name:"SvgIcon",props:{prefix:{type:String,default:"icon"},iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{isExt(){return X(this.iconClass)}}},Z=["href"];function K(a,l,t,o,n,d){return d.isExt?(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:0,style:"mask: url("+t.iconClass+") no-repeat 50% 50%;",class:"svg-external-icon svg-icon"},a.$attrs),null,16)):(e.openBlock(),e.createElementBlock("svg",e.mergeProps({key:1,class:"svg-icon "+t.className,"aria-hidden":"true"},a.$attrs),[e.createElementVNode("use",{href:"#"+t.prefix+"-"+t.iconClass},null,8,Z)],16))}const v=J(Q,[["render",K]]),L={__name:"SwAlert",props:{message:{type:String,default:"Default message"},before:{type:String,default:""},class:{type:String,default:""},after:{type:String,default:""},size:{type:String,default:""},duration:{type:Number,default:6e3},type:{type:String,default:"info",validator:a=>["success","warning","error","info"].includes(a)}},emits:["closed"],setup(a,{emit:l}){const t=a,o=l,n=e.ref(!1);let d=null;const i=()=>{n.value=!0,D()},p=()=>{n.value=!1,o("closed")},f=()=>{d&&(clearTimeout(d),d=null)},g=()=>{D()},D=()=>{d=setTimeout(p,t.duration)};e.onMounted(()=>{i()}),e.onUnmounted(()=>{d&&clearTimeout(d)});const m=e.computed(()=>{const b=["sw-alert"];return t.size.length>0&&b.push(`sw-${t.size}`),t.type.length>0&&b.push(`sw-${t.type}`),t.class.length>0&&b.push(t.class),b});return(b,h)=>(e.openBlock(),e.createBlock(e.Transition,{name:"fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(m.value),onMouseenter:f,onMouseleave:g},[t.before.length>0?(e.openBlock(),e.createBlock(v,{key:0,"icon-class":t.before},null,8,["icon-class"])):e.renderSlot(b.$slots,"prefix",{key:1}),e.renderSlot(b.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)]),t.after.length>0?(e.openBlock(),e.createBlock(v,{key:2,"icon-class":t.after,onClick:p},null,8,["icon-class"])):e.renderSlot(b.$slots,"suffix",{key:3})],34)):e.createCommentVNode("",!0)]),_:3}))}},ee=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));let P=document.querySelector("div.sw-alert-wrapper");function I(a={}){P||(P=document.createElement("div"),P.className="sw-alert-wrapper",document.body.appendChild(P));const l=e.createApp({setup(){return()=>e.h(L,{...a,onClose:()=>{P.removeChild(l._container),l.unmount()}})}}),t=l.mount(document.createElement("div"));P.appendChild(t.$el)}const Y=Object.assign({"./components/SwAlert.vue":()=>Promise.resolve().then(()=>ee),"./components/SwButton.vue":()=>Promise.resolve().then(()=>le),"./components/SwCollapse.vue":()=>Promise.resolve().then(()=>oe),"./components/SwDatePicker.vue":()=>Promise.resolve().then(()=>he),"./components/SwDropdown.vue":()=>Promise.resolve().then(()=>_e),"./components/SwDropdownItem.vue":()=>Promise.resolve().then(()=>Se),"./components/SwFormItem.vue":()=>Promise.resolve().then(()=>we),"./components/SwInput.vue":()=>Promise.resolve().then(()=>$e),"./components/SwMessage.vue":()=>Promise.resolve().then(()=>Ee),"./components/SwSection.vue":()=>Promise.resolve().then(()=>Me),"./components/SwSelect.vue":()=>Promise.resolve().then(()=>xe),"./components/SwSkeleton.vue":()=>Promise.resolve().then(()=>Pe),"./components/SwSkeletonItem.vue":()=>Promise.resolve().then(()=>je),"./components/SwSwitch.vue":()=>Promise.resolve().then(()=>Fe),"./components/SwTabs.vue":()=>Promise.resolve().then(()=>Ae),"./components/SwTabsNew.vue":()=>Promise.resolve().then(()=>Ye),"./components/SwTabsPane.vue":()=>Promise.resolve().then(()=>Re),"./components/SwTabsPaneNew.vue":()=>Promise.resolve().then(()=>We)}),F={};for(const a in Y){const l=a.split("/").pop().replace(".vue","").replace(/-(\w)/g,(t,o)=>o.toUpperCase());F[l]=e.defineAsyncComponent(()=>Y[a]())}const te={install(a){Object.keys(F).forEach(l=>{a.component(l,F[l]),console.log(l)}),a.config.globalProperties.$Alert=I,a.provide("Alert",I)}},q={__name:"SwButton",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},round:{type:Boolean,default:!1},text:{type:Boolean,default:!1},link:{type:Boolean,default:!1},href:{type:String,default:""}},setup(a){const l=a,t=()=>{if(l.href.length>0){const n=document.createElement("a");n.setAttribute("href",l.href),n.setAttribute("target","_blank"),n.click()}},o=e.computed(()=>{let n=["sw-button"];return l.size.length>0&&n.push("sw-"+l.size),l.type.length>0&&n.push("sw-"+l.type),l.round&&n.push("sw-round"),l.text&&n.push("sw-text"),l.link&&n.push("sw-link"),l.class.length>0&&n.push(l.class),n});return(n,d)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(o.value),onClick:t},[e.renderSlot(n.$slots,"default")],2))}},le=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"})),oe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwCollapse",props:{visual:{type:Boolean,default:!0}},setup(a){e.onMounted(()=>{o.value="0px"});const l=e.ref(null),t=a,o=e.computed(()=>{var n;return t.visual?((n=l.value)==null?void 0:n.scrollHeight)+"px":"0px"});return(n,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sw-collapse",{open:t.visual}]),style:e.normalizeStyle({height:o.value}),ref_key:"collapse",ref:l},[e.renderSlot(n.$slots,"default")],6))}}},Symbol.toStringTag,{value:"Module"})),ne={class:"sw-data-picker"},ae={class:"month_year"},se={class:"text"},re={class:"week"},ce={class:"month"},ie=["onClick"],de={key:0},pe={class:"month_year"},me={class:"text"},fe={class:"week"},ue={class:"month"},ge=["onClick"],he=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDatePicker",props:{data:Object,limitation:{type:[Boolean,Array],default:()=>!1},range:{type:String,default:"solid"}},emits:["input"],setup(a,{emit:l}){var H,W,U,G;const t=a,o=l,n=e.ref(new Date),d=e.ref(new Date),i=e.ref(Number(new Date().getFullYear())),p=e.ref(Number(new Date().getMonth())),f=e.ref(Number(new Date().getFullYear())),g=e.ref(Number(new Date().getMonth())),D=e.ref(Number(new Date().getMonth())+1),m=e.ref([]),b=e.ref(0),h=e.ref(-1),u=e.ref(-1),w=e.ref(navigator.languages||"ru"),_=/en|zh|ja|he/.test(w.value)?0:1,S=r=>{let s=r.split(r.match(/\D.*?\D?/));return s[0].length>2?s.join("-")+"T00:00:01":s.reverse().join("-")+"T00:00:01"};(H=t.data)!=null&&H.startDate&&(n.value=new Date(S(t.data.startDate)),i.value=n.value.getFullYear(),p.value=n.value.getMonth()),(W=t.data)!=null&&W.endDate&&t.range==="range"&&(d.value=new Date(S(t.data.endDate)),f.value=d.value.getFullYear(),g.value=d.value.getMonth());const V=()=>{m.value=[],b.value=0;const r=new Date(i.value,p.value,0);for(let c=r.getDate()-r.getDay()+_;c<=r.getDate();c++)r.getDay()!==6+_&&(m.value.push({day:c,month:r.getMonth(),year:r.getFullYear(),class:[]}),b.value++);const s=new Date(i.value,p.value+1,0).getDate();for(let c=1;c<=s;c++)m.value.push({day:c,month:p.value,year:i.value,class:[]}),b.value++;if(t.range==="range"){const c=new Date(i.value,p.value+1,1),y=new Date(i.value,p.value+2,0).getDate();for(let E=1;E<=y;E++)m.value.push({day:E,month:c.getMonth(),year:c.getFullYear(),class:[]})}$()},$=()=>{var s;if(!((s=t.data)!=null&&s.holiday))return;const r=(c,y)=>{c.forEach(E=>{const[B,M,N]=E.split("-").map(Number),O=m.value.findIndex(A=>A.year===B&&A.month+1===M&&A.day===N);O!==-1&&(m.value[O].class[0]=y)})};r(t.data.holiday.preholidays,"preholiday"),r(t.data.holiday.holidays,"weekend"),r(t.data.holiday.holiday,"holiday"),r(t.data.holiday.nowork,"nowork")},k=()=>{if(!t.limitation||t.limitation.length<2)return!1;const r=[...t.limitation].sort((s,c)=>new Date(S(s.startDate)).getTime()-new Date(S(c.startDate)).getTime());for(let s=1;s<r.length;s++){const c=new Date(S(r[s-1].endDate));if(new Date(S(r[s].startDate))<=c)return console.warn("Warning: Диапазоны пересекаются:",r[s-1],r[s]),!0}return!1},C=(r,s,c)=>{if(!t.limitation||t.limitation.length===0)return!0;const y=new Date(r,s,c).getTime();for(let E of t.limitation){const{startDate:B,endDate:M}=E;if(!B&&M){const N=new Date(S(M)).getTime();if(y<=N)return!1}if(B&&!M){const N=new Date(S(B)).getTime();if(y>=N)return!1}if(B&&M){const N=new Date(S(B)).getTime(),O=new Date(S(M)).getTime();if(N<=O){if(y>=N&&y<=O)return!1}else if(y>=N||y<=O)return!1}}return!0},x=(r,s)=>{const c=j(new Date(r.year,r.month,r.day),"{dd}.{m}.{Y}");t.range==="range"?u.value!==-1?(Ue(),h.value=s,m.value[s].class[1]="active"):h.value!==-1?(u.value=s,Ge(h.value,u.value,c)):(h.value=s,m.value[s].class[1]="active"):(h.value!==-1&&(m.value[h.value].class[1]=""),h.value=s,m.value[s].class[1]="active",o("input",{dateStart:c,count:1}))},Ue=()=>{m.value.forEach(r=>r.class[1]=""),h.value=-1,u.value=-1},Ge=(r,s,c)=>{let y=j(new Date(m.value[r].year,m.value[r].month,m.value[r].day),"{dd}.{m}.{Y}"),E=Xe(r,s);if(s>=r)for(let B=r+1;B<s;B++)m.value[B].class[1]="select";else for(let B=s+1;B<r;B++)m.value[B].class[1]="select";m.value[s].class[1]="active",o("input",{dateStart:y,dateEnd:c,count:E})},Xe=(r,s)=>{var B;let c=Math.abs(r-s)+1,[y,E]=[Math.min(r,s),Math.max(r,s)];for(let M=y;M<=E;M++)((B=m.value[M])==null?void 0:B.class[0])==="holiday"&&c--;return c},z=(r,s)=>{C(r,s)&&(n.value=new Date(r,s,1),i.value=n.value.getFullYear(),p.value=n.value.getMonth(),V())};if(V(),k()&&console.error("Ошибка: Найдены пересекающиеся диапазоны!"),(U=t.data)!=null&&U.startDate&&(h.value=m.value.findIndex(r=>r.day===n.value.getDate()&&r.month===p.value&&r.year===i.value),h.value!==-1&&(m.value[h.value].class[1]="active")),(G=t.data)!=null&&G.endDate&&t.range==="range"&&(u.value=m.value.findIndex(r=>r.day===d.value.getDate()&&r.month===g.value&&r.year===f.value),u.value!==-1)){m.value[u.value].class[1]="active";for(let r=h.value+1;r<u.value;r++)m.value[r].class[1]="select"}return(r,s)=>(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("div",null,[e.createElementVNode("p",ae,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[0]||(s[0]=e.withModifiers(c=>z(i.value-1,p.value),["prevent"]))},"«"),e.createElementVNode("button",{onClick:s[1]||(s[1]=e.withModifiers(c=>z(i.value,p.value-1),["prevent"]))},"‹")]),e.createElementVNode("span",se,[e.createElementVNode("button",null,e.toDisplayString(i.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(j)(n.value.setMonth(p.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[2]||(s[2]=e.withModifiers(c=>z(i.value,p.value+1),["prevent"]))},"›"),e.createElementVNode("button",{onClick:s[3]||(s[3]=e.withModifiers(c=>z(i.value+1,p.value),["prevent"]))},"»")])]),e.createElementVNode("div",re,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(c,y)=>e.createElementVNode("button",{key:y,class:"disabled"},e.toDisplayString(e.unref(j)(new Date(1970,1,c+e.unref(_)),"{D}")),1)),64))]),e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(c,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[y<b.value+(7-new Date(i.value,p.value+1,1).getDay()+e.unref(_))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(c.month===p.value&&C(c.year,c.month,c.day)?c.class:"disabled"),onClick:()=>{c.month===p.value&&x(c,y)}},e.toDisplayString(c.day),11,ie)):e.createCommentVNode("",!0)],64))),128))])]),t.range==="range"?(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("p",pe,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[4]||(s[4]=e.withModifiers(c=>z(i.value-1,p.value),["prevent"]))},"«"),e.createElementVNode("button",{onClick:s[5]||(s[5]=e.withModifiers(c=>z(i.value,p.value-1),["prevent"]))},"‹")]),e.createElementVNode("span",me,[e.createElementVNode("button",null,e.toDisplayString(new Date(i.value,p.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(j)(n.value.setMonth(p.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[6]||(s[6]=e.withModifiers(c=>z(i.value,p.value+1),["prevent"]))},"›"),e.createElementVNode("button",{onClick:s[7]||(s[7]=e.withModifiers(c=>z(i.value+1,p.value),["prevent"]))},"»")])]),e.createElementVNode("div",fe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(c,y)=>e.createElementVNode("button",{key:y,class:"disabled"},e.toDisplayString(e.unref(j)(new Date(1970,1,c+e.unref(_)),"{D}")),1)),64))]),e.createElementVNode("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(c,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[y>=b.value-(7+new Date(i.value,p.value+1,1).getDay()-e.unref(_))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(c.month===D.value.getMonth()&&C(c.year,c.month,c.day)?c.class:"disabled"),onClick:()=>{c.month===D.value.getMonth()&&x(c,y)}},e.toDisplayString(c.day),11,ge)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),ye=["id"],_e=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdown",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},trigger:{type:String,default:"click"},placement:{type:String,default:"bottom-left"},maxWidth:{type:Number,default:0},manual:{type:Boolean,default:!1}},setup(a){const l=a;e.computed(()=>"dropdown"+Array.from(document.body.children).indexOf(document.querySelector("ul")));const t=e.ref(!1),o=e.ref(null),n=e.ref(null),d=e.ref({}),i=Math.ceil(Math.random()*1e3),p=e.computed(()=>{let u=["sw-dropdown"];return l.size.length>0&&u.push("sw-"+l.size),l.type.length>0&&u.push("sw-"+l.type),u});e.watch(()=>l.manual,u=>{t.value=u,console.log("watch",t.value),t.value&&f()});const f=async()=>{if(await e.nextTick(),!n.value)return;const u=window.pageYOffset||document.documentElement.scrollTop,w=window.pageXOffset||document.documentElement.scrollLeft;document.body.style.position="fixed",document.body.style.top=`-${u}px`,document.body.style.left=`-${w}px`,document.body.style.position="",document.body.style.top="",document.body.style.left="",document.documentElement.scrollTop=u,document.documentElement.scrollLeft=w;const _=o.value.getBoundingClientRect(),S=n.value.offsetHeight,V=n.value.offsetWidth;console.log("popupHeight",S),console.log("popupWidth",V);let $=_.left+_.width/2+w,k=_.top+_.height/2+u;const[C,x]=l.placement.split("-",2);switch(console.log(l.placement),C){case"bottom":k=k+_.height/2+8;break;case"top":k=k-_.height/2-8-S;break;case"left":$=$-V-_.width/2-8,k=k-S/2;break;case"right":$=$+_.width/2+8,k=k-S/2;break}switch(x){case"left":$=$-_.width/2;break;case"right":$=$-V+_.width/2;break}$<0&&($=0),k<0&&(k=0),d.value={position:"absolute",top:`${k}px`,left:`${$}px`,maxWidth:l.maxWidth===0?"":`${l.maxWidth}px`}},g=()=>{l.trigger==="click"&&(t.value=!t.value),t.value&&f()},D=()=>{l.trigger==="hover"&&(t.value=!t.value),t.value&&f()},m=()=>{l.trigger==="context"&&(t.value=!t.value),t.value&&f()},b=()=>{t.value&&f()},h=u=>{console.log(i),!u.target.closest(`[id="${i}"]`)&&o.value&&!o.value.contains(u.target)&&(t.value=!1)};return e.onMounted(()=>{window.addEventListener("resize",b),window.addEventListener("click",h)}),e.onUnmounted(()=>{window.removeEventListener("resize",b),window.removeEventListener("click",h)}),(u,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(p.value),onClick:w[0]||(w[0]=_=>g()),onMouseover:w[1]||(w[1]=e.withModifiers(_=>D(),["stop"])),onMouseleave:w[2]||(w[2]=e.withModifiers(_=>D(),["stop"])),onContextmenu:w[3]||(w[3]=e.withModifiers(_=>m(),["stop"])),ref_key:"dropdownRef",ref:o},[e.renderSlot(u.$slots,"default"),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.value?(e.openBlock(),e.createElementBlock("ul",{key:0,ref_key:"popupRef",ref:n,id:e.unref(i),class:e.normalizeClass(["sw-dropdown-popup",l.class]),style:e.normalizeStyle(d.value),tabindex:"-1"},[e.renderSlot(u.$slots,"dropdown")],14,ye)):e.createCommentVNode("",!0)]))],34))}}},Symbol.toStringTag,{value:"Module"})),Se=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdownItem",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},iconBefore:{type:String,default:""}},setup(a){const l=a,t=e.computed(()=>{let o=["sw-dropdown-item"];return l.size.length>0&&o.push("sw-"+l.size),l.type.length>0&&o.push("sw-"+l.type),l.class.length>0&&o.push(l.class),o});return(o,n)=>{const d=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(t.value)},[e.createVNode(d,{"icon-class":a.iconBefore},null,8,["icon-class"]),e.renderSlot(o.$slots,"default")],2)}}}},Symbol.toStringTag,{value:"Module"})),we=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwFormItem",props:{class:{type:String,default:""},type:{type:String,default:""}},setup(a){const l=a,t=e.computed(()=>{let o=["sw-form-item"];return l.type.length>0&&o.push("sw-"+l.type),l.class.length>0&&o.push(l.class),o});return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.value)},[e.renderSlot(o.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),be=["for"],ke={key:0,title:"Это поле обязательно для заполнения."},Be=["required","placeholder","type","id","name"],$e=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwInput",props:e.mergeModels({before:{type:String,default:""},after:{type:String,default:""},placeholder:{type:String,default:""},label:{type:String,default:""},name:{type:String,required:!0},class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:"text"},required:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["suffix","prefix","focusInput"],["update:modelValue"]),setup(a,{emit:l}){var b;const t=e.useModel(a,"modelValue"),o=a,n=e.ref(null),d=l,i=h=>{d("focusInput"),h.target.setSelectionRange(t.value.length,t.value.length),n.value!==null&&(n.value.style.top="-.6em")},p=h=>{var u;((u=t.value)==null?void 0:u.length)===0&&n.value!==null&&n.value.removeAttribute("style")};((b=t.value)==null?void 0:b.length)>0&&n.value!==null&&(n.value.style.top="-.6em");const f=()=>{d("suffix")},g=()=>{d("prefix")},D=e.computed(()=>{let h=["sw-input"];return o.size.length>0&&h.push("sw-"+o.size),o.class.length>0&&h.push(o.class),h});e.watch(t,(h,u)=>{o.type==="phone"&&(t.value=m(h,u))});const m=(h,u)=>{if(/^\+[0-9]\s/.test(u)&&h.length===2||/^\+0\s/.test(h))return"";const w=h;if(typeof w>"u"||w.length===0)return w;const _="+0 (___) ___-__-__";let S=0;const V=_.replace(/\D/g,""),$=w.replace(/\D/g,"");let k=_.replace(/[_\d]/g,x=>S<$.length?$.charAt(S++)||V.charAt(S):x);S=k.indexOf("_"),S!==-1&&(S=S<5?3:S,k=k.slice(0,S));let C=_.slice(0,w.length).replace(/_+/g,x=>`\\d{1,${x.length}}`).replace(/[+()]/g,"\\$&");if(C=new RegExp(`^${C}$`),k=k.replace(/[-—]$|(\) )$/g,""),!C.test(w)||w.length<5)return k};return(h,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(D.value)},[o.before.length>0?(e.openBlock(),e.createBlock(v,{key:0,"icon-class":o.before,onClick:g},null,8,["icon-class"])):e.renderSlot(h.$slots,"prefix",{key:1}),o.label.length>0?(e.openBlock(),e.createElementBlock("label",{key:2,for:o.name,ref_key:"lab",ref:n},[e.createTextVNode(e.toDisplayString(o.label),1),o.required?(e.openBlock(),e.createElementBlock("span",ke,"*")):e.createCommentVNode("",!0)],8,be)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=w=>t.value=w),required:o.required,placeholder:o.required&&o.label.length===0?o.placeholder+"*":o.placeholder,type:o.type,id:o.name,name:o.name,size:"60",onFocus:i,onBlur:p,maxlength:"128"},null,40,Be),[[e.vModelDynamic,t.value]]),o.after.length>0?(e.openBlock(),e.createBlock(v,{key:3,"icon-class":o.after,onClick:f},null,8,["icon-class"])):e.renderSlot(h.$slots,"suffix",{key:4})],2))}}},Symbol.toStringTag,{value:"Module"})),De={key:0},Ee=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwMessage",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=e.useModel(a,"modelValue"),t=a,o=e.ref(null);return(n,d)=>{const i=e.resolveComponent("svg-icon");return l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["sw-message",t.class]),ref_key:"messageRef",ref:o},[t.name.length>0?(e.openBlock(),e.createElementBlock("header",De,[e.renderSlot(n.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(t.name)+" ",1),e.createVNode(q,{link:"",type:"primary",onClick:d[0]||(d[0]=p=>l.value=!1)},{default:e.withCtx(()=>[e.createVNode(i,{"icon-class":t.iconAfter},null,8,["icon-class"])]),_:1})])])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",{},()=>[d[1]||(d[1]=e.createTextVNode("111222"))]),e.createElementVNode("footer",null,[e.renderSlot(n.$slots,"footer")])],2)):e.createCommentVNode("",!0)}}}},Symbol.toStringTag,{value:"Module"})),Me=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSection",props:{name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},setup(a){const l=a;return(t,o)=>{const n=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(l.class)},[e.createElementVNode("header",null,[e.renderSlot(t.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(l.name)+" ",1),e.createVNode(n,{"icon-class":l.iconAfter},null,8,["icon-class"])])]),e.renderSlot(t.$slots,"default"),e.createElementVNode("footer",null,[e.renderSlot(t.$slots,"footer")])],2)}}}},Symbol.toStringTag,{value:"Module"})),Te={class:"popup"},Ce={class:"wrapper"},Ne={class:"scrollbar"},Ve=["onClick"],xe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSelect",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},placeholder:{type:String,default:""},token:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=e.ref({fullText:""}),t=e.ref(!1),o=e.ref([]),n=e.useModel(a,"modelValue"),d=a;e.watch(n.text,f=>{f.length>3&&(l.value.fullText=f)}),e.watch(l.value.fullText,(f,g)=>{t.value=f.length>3&&f.length>g.length,f.length>3&&i()});const i=()=>{let f="https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address";console.log(l.value.fullText),axios.post(f,{query:l.value.fullText},{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Token "+d.token}}).then(g=>{console.log(g.data.suggestions),o.value=g.data.suggestions,o.value.length===1&&p(o.value[0])}).catch(g=>{console.log(g)})},p=f=>{l.value.fullText=f.value,t.value=!1;const g={};g.text=f.value,g.coords=[Number(f.data.geo_lat),Number(f.data.geo_lon)],g.suggestion=f.data,n.value=g};return(f,g)=>{const D=e.resolveComponent("sw-input");return e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(D,{size:"large",modelValue:l.value.fullText,"onUpdate:modelValue":g[0]||(g[0]=m=>l.value.fullText=m),placeholder:a.placeholder},null,8,["modelValue","placeholder"]),e.withDirectives(e.createElementVNode("div",Ce,[e.createElementVNode("ul",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(m,b)=>(e.openBlock(),e.createElementBlock("li",{tabindex:"1",key:b,onClick:h=>p(m)},e.toDisplayString(m.value),9,Ve))),128))])],512),[[e.vShow,t.value]])])}}}},Symbol.toStringTag,{value:"Module"})),ze={key:0},R={__name:"SwSkeletonItem",props:{width:{type:String,default:"100"},class:{type:String,default:""},animate:{type:Boolean,default:!1},size:{type:String,default:""}},setup(a){const l=a,t=e.computed(()=>{let n=["sw-skeleton-item"];return l.size.length>0&&n.push("sw-"+l.size),l.animate&&n.push("sw-animate"),l.class.length>0&&n.push(l.class),n}),o=e.computed(()=>({width:l.width+"%"}));return(n,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.value),style:e.normalizeStyle(o.value)},[l.animate?(e.openBlock(),e.createElementBlock("div",ze)):e.createCommentVNode("",!0)],6))}},je=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),Pe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSkeleton",props:{class:{type:String,default:""},visual:{type:Boolean,default:!1}},setup(a){const l=a;return(t,o)=>l.visual?e.renderSlot(t.$slots,"default",{key:0},()=>[o[0]||(o[0]=e.createTextVNode("1"))]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["sw-skeleton",l.class])},[e.renderSlot(t.$slots,"skeleton",{},()=>[e.createVNode(R,{animate:"",size:"small"})])],2))}}},Symbol.toStringTag,{value:"Module"})),Oe=["name","id"],ve=["for","data-onlabel","data-offlabel"],Fe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSwitch",props:e.mergeModels({id:{type:String,default:"checkbox"},class:{type:String,default:""},name:{type:String,default:""},on:{type:String,default:""},off:{type:String,default:""},size:{type:String,default:""},checkbox:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=e.useModel(a,"modelValue"),t=a,o=e.computed(()=>{let n=["sw-switch"];return t.size.length>0&&n.push("sw-"+t.size),t.checkbox&&n.push("sw-checkbox"),t.class.length>0&&n.push(t.class),n});return(n,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.value)},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",name:t.name,class:"sw-control",id:t.id,"onUpdate:modelValue":d[0]||(d[0]=i=>l.value=i)},null,8,Oe),[[e.vModelCheckbox,l.value]]),e.createElementVNode("label",{for:t.id,class:"sw-label","data-onlabel":t.on,"data-offlabel":t.off},null,8,ve),e.renderSlot(n.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Ie=["onClick"],Ae=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabs",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:l}){e.ref(0);const t=e.ref([]),o=a,n=e.useModel(a,"modelValue"),d=l;return t.value=e.useSlots().default().filter(i=>i.type.__name==="SwTabsPane"),e.provide("activeTab",n),e.provide("tabs",t),(i,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+o.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(f,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:e.normalizeClass([{active:n.value===g}]),onClick:D=>{n.value=g,d("tab-click",g)}},e.toDisplayString(f.props.label||f.props.title),11,Ie))),128))]),e.renderSlot(i.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Le=["onClick"],Ye=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsNew",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:l}){e.ref(0);const t=e.ref([]),o=a,n=e.useModel(a,"modelValue"),d=l;return e.provide("activeTab",n),e.provide("tabs",t),e.provide("registerTab",i=>{t.value.push(i)}),(i,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+o.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(f,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:e.normalizeClass([{active:n.value===g}]),onClick:D=>{n.value=g,d("tab-click",g)}},e.toDisplayString(f.props.label||f.props.title),11,Le))),128))]),e.renderSlot(i.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),qe={key:0,class:"tab-content"},Re=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPane",props:{title:{type:String,required:!0}},setup(a){const l=a,t=e.inject("activeTab"),o=e.inject("tabs"),n=e.computed(()=>{const d=o.value.findIndex(i=>i.props.title===l.title);return t.value===d});return(d,i)=>n.value?(e.openBlock(),e.createElementBlock("div",qe,[e.renderSlot(d.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"})),He={key:0,class:"tab-content"},We=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPaneNew",props:{label:{type:String,required:!0},title:{type:String}},setup(a){const l=a,t=e.inject("registerTab");if(!t)throw new Error("SwTabsPane must be used inside SwTabs");t({props:l});const o=e.inject("activeTab");if(!e.inject("tabs"))throw new Error("Tabs array is not provided by SwTabs");const d=e.inject("tabs").value.length-1;return(i,p)=>e.unref(o)===d?(e.openBlock(),e.createElementBlock("div",He,[e.renderSlot(i.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"}));T.Alert=I,T.Library=te,T.components=F,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(T,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(T=typeof globalThis<"u"?globalThis:T||self,e(T["component-sw"]={},T.vue))})(this,function(T,e){"use strict";function X(a){return/^(https?:|mailto:|tel:)/.test(a)}function j(a,l){if(arguments.length===0||!a)return null;const t=l||"{Y}-{m}-{d} {G}:{i}:{s}";let o;typeof a=="object"?o=a:(typeof a=="string"&&(/^[0-9]+$/.test(a)?a=parseInt(a):a=a.replace(new RegExp(/-/gm),"/")),typeof a=="number"&&a.toString().length===10&&(a=a*1e3),o=new Date(a));const n="ru-RU",i={Y:o.getFullYear(),m:(o.getMonth()+1).toString().padStart(2,"0"),d:o.getDate(),dd:o.getDate().toString().padStart(2,"0"),G:o.getHours(),H:o.getHours().toString().padStart(2,"0"),i:o.getMinutes().toString().padStart(2,"0"),s:o.getSeconds().toString().padStart(2,"0"),D:new Intl.DateTimeFormat(n,{weekday:"short"}).format(o),F:new Intl.DateTimeFormat(n,{month:"long"}).format(o),M:new Intl.DateTimeFormat(n,{month:"short"}).format(o)};return t.replace(/{(dd|[YmdGHisDFM])+}/g,(d,p)=>i[p])}const J=(a,l)=>{const t=a.__vccOpts||a;for(const[o,n]of l)t[o]=n;return t},Q={name:"SvgIcon",props:{prefix:{type:String,default:"icon"},iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{isExt(){return X(this.iconClass)}}},Z=["href"];function K(a,l,t,o,n,i){return i.isExt?(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:0,style:"mask: url("+t.iconClass+") no-repeat 50% 50%;",class:"svg-external-icon svg-icon"},a.$attrs),null,16)):(e.openBlock(),e.createElementBlock("svg",e.mergeProps({key:1,class:"svg-icon "+t.className,"aria-hidden":"true"},a.$attrs),[e.createElementVNode("use",{href:"#"+t.prefix+"-"+t.iconClass},null,8,Z)],16))}const v=J(Q,[["render",K]]),L={__name:"SwAlert",props:{message:{type:String,default:"Default message"},before:{type:String,default:""},class:{type:String,default:""},after:{type:String,default:""},size:{type:String,default:""},duration:{type:Number,default:6e3},type:{type:String,default:"info",validator:a=>["success","warning","error","info"].includes(a)}},emits:["closed"],setup(a,{emit:l}){const t=a,o=l,n=e.ref(!1);let i=null;const d=()=>{n.value=!0,D()},p=()=>{n.value=!1,o("closed")},f=()=>{i&&(clearTimeout(i),i=null)},g=()=>{D()},D=()=>{i=setTimeout(p,t.duration)};e.onMounted(()=>{d()}),e.onUnmounted(()=>{i&&clearTimeout(i)});const m=e.computed(()=>{const k=["sw-alert"];return t.size.length>0&&k.push(`sw-${t.size}`),t.type.length>0&&k.push(`sw-${t.type}`),t.class.length>0&&k.push(t.class),k});return(k,h)=>(e.openBlock(),e.createBlock(e.Transition,{name:"fade"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(m.value),onMouseenter:f,onMouseleave:g},[t.before.length>0?(e.openBlock(),e.createBlock(v,{key:0,"icon-class":t.before},null,8,["icon-class"])):e.renderSlot(k.$slots,"prefix",{key:1}),e.renderSlot(k.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.message),1)]),t.after.length>0?(e.openBlock(),e.createBlock(v,{key:2,"icon-class":t.after,onClick:p},null,8,["icon-class"])):e.renderSlot(k.$slots,"suffix",{key:3})],34)):e.createCommentVNode("",!0)]),_:3}))}},ee=Object.freeze(Object.defineProperty({__proto__:null,default:L},Symbol.toStringTag,{value:"Module"}));let P=document.querySelector("div.sw-alert-wrapper");function I(a={}){P||(P=document.createElement("div"),P.className="sw-alert-wrapper",document.body.appendChild(P));const l=e.createApp({setup(){return()=>e.h(L,{...a,onClose:()=>{P.removeChild(l._container),l.unmount()}})}}),t=l.mount(document.createElement("div"));P.appendChild(t.$el)}const Y=Object.assign({"./components/SwAlert.vue":()=>Promise.resolve().then(()=>ee),"./components/SwButton.vue":()=>Promise.resolve().then(()=>le),"./components/SwCollapse.vue":()=>Promise.resolve().then(()=>oe),"./components/SwDatePicker.vue":()=>Promise.resolve().then(()=>he),"./components/SwDropdown.vue":()=>Promise.resolve().then(()=>_e),"./components/SwDropdownItem.vue":()=>Promise.resolve().then(()=>Se),"./components/SwFormItem.vue":()=>Promise.resolve().then(()=>we),"./components/SwInput.vue":()=>Promise.resolve().then(()=>$e),"./components/SwMessage.vue":()=>Promise.resolve().then(()=>Ee),"./components/SwSection.vue":()=>Promise.resolve().then(()=>Me),"./components/SwSelect.vue":()=>Promise.resolve().then(()=>xe),"./components/SwSkeleton.vue":()=>Promise.resolve().then(()=>Pe),"./components/SwSkeletonItem.vue":()=>Promise.resolve().then(()=>je),"./components/SwSwitch.vue":()=>Promise.resolve().then(()=>Fe),"./components/SwTabs.vue":()=>Promise.resolve().then(()=>Ae),"./components/SwTabsNew.vue":()=>Promise.resolve().then(()=>Ye),"./components/SwTabsPane.vue":()=>Promise.resolve().then(()=>Re),"./components/SwTabsPaneNew.vue":()=>Promise.resolve().then(()=>We)}),F={};for(const a in Y){const l=a.split("/").pop().replace(".vue","").replace(/-(\w)/g,(t,o)=>o.toUpperCase());F[l]=e.defineAsyncComponent(()=>Y[a]())}const te={install(a){Object.keys(F).forEach(l=>{a.component(l,F[l]),console.log(l)}),a.config.globalProperties.$Alert=I,a.provide("Alert",I)}},q={__name:"SwButton",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},round:{type:Boolean,default:!1},text:{type:Boolean,default:!1},link:{type:Boolean,default:!1},href:{type:String,default:""}},setup(a){const l=a,t=()=>{if(l.href.length>0){const n=document.createElement("a");n.setAttribute("href",l.href),n.setAttribute("target","_blank"),n.click()}},o=e.computed(()=>{let n=["sw-button"];return l.size.length>0&&n.push("sw-"+l.size),l.type.length>0&&n.push("sw-"+l.type),l.round&&n.push("sw-round"),l.text&&n.push("sw-text"),l.link&&n.push("sw-link"),l.class.length>0&&n.push(l.class),n});return(n,i)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(o.value),onClick:t},[e.renderSlot(n.$slots,"default")],2))}},le=Object.freeze(Object.defineProperty({__proto__:null,default:q},Symbol.toStringTag,{value:"Module"})),oe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwCollapse",props:{visual:{type:Boolean,default:!0}},setup(a){e.onMounted(()=>{o.value="0px"});const l=e.ref(null),t=a,o=e.computed(()=>{var n;return t.visual?((n=l.value)==null?void 0:n.scrollHeight)+"px":"0px"});return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sw-collapse",{open:t.visual}]),style:e.normalizeStyle({height:o.value}),ref_key:"collapse",ref:l},[e.renderSlot(n.$slots,"default")],6))}}},Symbol.toStringTag,{value:"Module"})),ne={class:"sw-data-picker"},ae={class:"month_year"},se={class:"text"},re={class:"week"},ce={class:"month"},ie=["onClick"],de={key:0},pe={class:"month_year"},me={class:"text"},fe={class:"week"},ue={class:"month"},ge=["onClick"],he=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDatePicker",props:{data:Object,limitation:{type:[Boolean,Array],default:()=>!1},range:{type:String,default:"solid"}},emits:["input"],setup(a,{emit:l}){var H,W,U,G;const t=a,o=l,n=e.ref(new Date),i=e.ref(new Date),d=e.ref(new Date().getFullYear()),p=e.ref(new Date().getMonth()),f=e.ref(new Date().getFullYear()),g=e.ref(new Date().getMonth()),D=e.ref(new Date().getMonth()+1),m=e.ref([]),k=e.ref(0),h=e.ref(-1),u=e.ref(-1),w=e.ref(navigator.languages||"ru"),_=/en|zh|ja|he/.test(w.value)?0:1,S=r=>{let s=r.split(r.match(/\D.*?\D?/));return s[0].length>2?s.join("-")+"T00:00:01":s.reverse().join("-")+"T00:00:01"};(H=t.data)!=null&&H.startDate&&(n.value=new Date(S(t.data.startDate)),d.value=n.value.getFullYear(),p.value=n.value.getMonth()),(W=t.data)!=null&&W.endDate&&t.range==="range"&&(i.value=new Date(S(t.data.endDate)),f.value=i.value.getFullYear(),g.value=i.value.getMonth());const N=()=>{m.value=[],k.value=0;const r=new Date(d.value,p.value,0);for(let c=r.getDate()-r.getDay()+_;c<=r.getDate();c++)r.getDay()!==6+_&&(m.value.push({day:c,month:r.getMonth(),year:r.getFullYear(),class:[]}),k.value++);const s=new Date(d.value,p.value+1,0).getDate();for(let c=1;c<=s;c++)m.value.push({day:c,month:p.value,year:d.value,class:[]}),k.value++;if(t.range==="range"){const c=new Date(d.value,p.value+1,1),y=new Date(d.value,p.value+2,0).getDate();for(let E=1;E<=y;E++)m.value.push({day:E,month:c.getMonth(),year:c.getFullYear(),class:[]})}$()},$=()=>{var s;if(!((s=t.data)!=null&&s.holiday))return;const r=(c,y)=>{c.forEach(E=>{const[B,M,V]=E.split("-").map(Number),O=m.value.findIndex(A=>A.year===B&&A.month+1===M&&A.day===V);O!==-1&&(m.value[O].class[0]=y)})};r(t.data.holiday.preholidays,"preholiday"),r(t.data.holiday.holidays,"weekend"),r(t.data.holiday.holiday,"holiday"),r(t.data.holiday.nowork,"nowork")},b=()=>{if(!t.limitation||t.limitation.length<2)return!1;const r=[...t.limitation].sort((s,c)=>new Date(S(s.startDate)).getTime()-new Date(S(c.startDate)).getTime());for(let s=1;s<r.length;s++){const c=new Date(S(r[s-1].endDate));if(new Date(S(r[s].startDate))<=c)return console.warn("Warning: Диапазоны пересекаются:",r[s-1],r[s]),!0}return!1},C=(r,s,c)=>{if(!t.limitation||t.limitation.length===0)return!0;const y=new Date(r,s,c).getTime();for(let E of t.limitation){const{startDate:B,endDate:M}=E;if(!B&&M){const V=new Date(S(M)).getTime();if(y<=V)return!1}if(B&&!M){const V=new Date(S(B)).getTime();if(y>=V)return!1}if(B&&M){const V=new Date(S(B)).getTime(),O=new Date(S(M)).getTime();if(V<=O){if(y>=V&&y<=O)return!1}else if(y>=V||y<=O)return!1}}return!0},x=(r,s)=>{const c=j(new Date(r.year,r.month,r.day),"{dd}.{m}.{Y}");t.range==="range"?u.value!==-1?(Ue(),h.value=s,m.value[s].class[1]="active"):h.value!==-1?(u.value=s,Ge(h.value,u.value,c)):(h.value=s,m.value[s].class[1]="active"):(h.value!==-1&&(m.value[h.value].class[1]=""),h.value=s,m.value[s].class[1]="active",o("input",{dateStart:c,count:1}))},Ue=()=>{m.value.forEach(r=>r.class[1]=""),h.value=-1,u.value=-1},Ge=(r,s,c)=>{let y=j(new Date(m.value[r].year,m.value[r].month,m.value[r].day),"{dd}.{m}.{Y}"),E=Xe(r,s);if(s>=r)for(let B=r+1;B<s;B++)m.value[B].class[1]="select";else for(let B=s+1;B<r;B++)m.value[B].class[1]="select";m.value[s].class[1]="active",o("input",{dateStart:y,dateEnd:c,count:E})},Xe=(r,s)=>{var B;let c=Math.abs(r-s)+1,[y,E]=[Math.min(r,s),Math.max(r,s)];for(let M=y;M<=E;M++)((B=m.value[M])==null?void 0:B.class[0])==="holiday"&&c--;return c},z=(r,s)=>{C(r,s)&&(n.value=new Date(r,s,1),d.value=n.value.getFullYear(),p.value=n.value.getMonth(),N())};if(N(),b()&&console.error("Ошибка: Найдены пересекающиеся диапазоны!"),(U=t.data)!=null&&U.startDate&&(h.value=m.value.findIndex(r=>r.day===n.value.getDate()&&r.month===p.value&&r.year===d.value),h.value!==-1&&(m.value[h.value].class[1]="active")),(G=t.data)!=null&&G.endDate&&t.range==="range"&&(u.value=m.value.findIndex(r=>r.day===i.value.getDate()&&r.month===g.value&&r.year===f.value),u.value!==-1)){m.value[u.value].class[1]="active";for(let r=h.value+1;r<u.value;r++)m.value[r].class[1]="select"}return(r,s)=>(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("div",null,[e.createElementVNode("p",ae,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[0]||(s[0]=e.withModifiers(c=>z(d.value-1,p.value),["prevent"]))},"«"),e.createElementVNode("button",{onClick:s[1]||(s[1]=e.withModifiers(c=>z(d.value,p.value-1),["prevent"]))},"‹")]),e.createElementVNode("span",se,[e.createElementVNode("button",null,e.toDisplayString(d.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(j)(n.value.setMonth(p.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[2]||(s[2]=e.withModifiers(c=>z(d.value,p.value+1),["prevent"]))},"›"),e.createElementVNode("button",{onClick:s[3]||(s[3]=e.withModifiers(c=>z(d.value+1,p.value),["prevent"]))},"»")])]),e.createElementVNode("div",re,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(c,y)=>e.createElementVNode("button",{key:y,class:"disabled"},e.toDisplayString(e.unref(j)(new Date(1970,1,c+e.unref(_)),"{D}")),1)),64))]),e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(c,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[y<k.value+(7-new Date(d.value,p.value+1,1).getDay()+e.unref(_))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(c.month===p.value&&C(c.year,c.month,c.day)?c.class:"disabled"),onClick:()=>{c.month===p.value&&x(c,y)}},e.toDisplayString(c.day),11,ie)):e.createCommentVNode("",!0)],64))),128))])]),t.range==="range"?(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("p",pe,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[4]||(s[4]=e.withModifiers(c=>z(d.value-1,p.value),["prevent"]))},"«"),e.createElementVNode("button",{onClick:s[5]||(s[5]=e.withModifiers(c=>z(d.value,p.value-1),["prevent"]))},"‹")]),e.createElementVNode("span",me,[e.createElementVNode("button",null,e.toDisplayString(new Date(d.value,p.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(j)(n.value.setMonth(p.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:s[6]||(s[6]=e.withModifiers(c=>z(d.value,p.value+1),["prevent"]))},"›"),e.createElementVNode("button",{onClick:s[7]||(s[7]=e.withModifiers(c=>z(d.value+1,p.value),["prevent"]))},"»")])]),e.createElementVNode("div",fe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(c,y)=>e.createElementVNode("button",{key:y,class:"disabled"},e.toDisplayString(e.unref(j)(new Date(1970,1,c+e.unref(_)),"{D}")),1)),64))]),e.createElementVNode("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(c,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[y>=k.value-(7+new Date(d.value,p.value+1,1).getDay()-e.unref(_))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(c.month===D.value&&C(c.year,c.month,c.day)?c.class:"disabled"),onClick:()=>{c.month===D.value&&x(c,y)}},e.toDisplayString(c.day),11,ge)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),ye=["id"],_e=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdown",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},trigger:{type:String,default:"click"},placement:{type:String,default:"bottom-left"},maxWidth:{type:Number,default:0},manual:{type:Boolean,default:!1}},setup(a){const l=a;e.computed(()=>"dropdown"+Array.from(document.body.children).indexOf(document.querySelector("ul")));const t=e.ref(!1),o=e.ref(null),n=e.ref(null),i=e.ref({}),d=Math.ceil(Math.random()*1e3),p=e.computed(()=>{let u=["sw-dropdown"];return l.size.length>0&&u.push("sw-"+l.size),l.type.length>0&&u.push("sw-"+l.type),u});e.watch(()=>l.manual,u=>{t.value=u,console.log("watch",t.value),t.value&&f()});const f=async()=>{if(await e.nextTick(),!n.value)return;const u=window.pageYOffset||document.documentElement.scrollTop,w=window.pageXOffset||document.documentElement.scrollLeft;document.body.style.position="fixed",document.body.style.top=`-${u}px`,document.body.style.left=`-${w}px`,document.body.style.position="",document.body.style.top="",document.body.style.left="",document.documentElement.scrollTop=u,document.documentElement.scrollLeft=w;const _=o.value.getBoundingClientRect(),S=n.value.offsetHeight,N=n.value.offsetWidth;console.log("popupHeight",S),console.log("popupWidth",N);let $=_.left+_.width/2+w,b=_.top+_.height/2+u;const[C,x]=l.placement.split("-",2);switch(console.log(l.placement),C){case"bottom":b=b+_.height/2+8;break;case"top":b=b-_.height/2-8-S;break;case"left":$=$-N-_.width/2-8,b=b-S/2;break;case"right":$=$+_.width/2+8,b=b-S/2;break}switch(x){case"left":$=$-_.width/2;break;case"right":$=$-N+_.width/2;break}$<0&&($=0),b<0&&(b=0),i.value={position:"absolute",top:`${b}px`,left:`${$}px`,maxWidth:l.maxWidth===0?"":`${l.maxWidth}px`}},g=()=>{l.trigger==="click"&&(t.value=!t.value),t.value&&f()},D=()=>{l.trigger==="hover"&&(t.value=!t.value),t.value&&f()},m=()=>{l.trigger==="context"&&(t.value=!t.value),t.value&&f()},k=()=>{t.value&&f()},h=u=>{!u.target.closest(`[id="${d}"]`)&&o.value&&!o.value.contains(u.target)&&(t.value=!1)};return e.onMounted(()=>{window.addEventListener("resize",k),window.addEventListener("click",h)}),e.onUnmounted(()=>{window.removeEventListener("resize",k),window.removeEventListener("click",h)}),(u,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(p.value),onClick:w[0]||(w[0]=_=>g()),onMouseover:w[1]||(w[1]=e.withModifiers(_=>D(),["stop"])),onMouseleave:w[2]||(w[2]=e.withModifiers(_=>D(),["stop"])),onContextmenu:w[3]||(w[3]=e.withModifiers(_=>m(),["stop"])),ref_key:"dropdownRef",ref:o},[e.renderSlot(u.$slots,"default"),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.value?(e.openBlock(),e.createElementBlock("ul",{key:0,ref_key:"popupRef",ref:n,id:e.unref(d),class:e.normalizeClass(["sw-dropdown-popup",l.class]),style:e.normalizeStyle(i.value),tabindex:"-1"},[e.renderSlot(u.$slots,"dropdown")],14,ye)):e.createCommentVNode("",!0)]))],34))}}},Symbol.toStringTag,{value:"Module"})),Se=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdownItem",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},iconBefore:{type:String,default:""}},setup(a){const l=a,t=e.computed(()=>{let o=["sw-dropdown-item"];return l.size.length>0&&o.push("sw-"+l.size),l.type.length>0&&o.push("sw-"+l.type),l.class.length>0&&o.push(l.class),o});return(o,n)=>{const i=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(t.value)},[e.createVNode(i,{"icon-class":a.iconBefore},null,8,["icon-class"]),e.renderSlot(o.$slots,"default")],2)}}}},Symbol.toStringTag,{value:"Module"})),we=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwFormItem",props:{class:{type:String,default:""},type:{type:String,default:""}},setup(a){const l=a,t=e.computed(()=>{let o=["sw-form-item"];return l.type.length>0&&o.push("sw-"+l.type),l.class.length>0&&o.push(l.class),o});return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.value)},[e.renderSlot(o.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),ke=["for"],be={key:0,title:"Это поле обязательно для заполнения."},Be=["required","placeholder","type","id","name"],$e=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwInput",props:e.mergeModels({before:{type:String,default:""},after:{type:String,default:""},placeholder:{type:String,default:""},label:{type:String,default:""},name:{type:String,required:!0},class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:"text"},required:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["suffix","prefix","focusInput"],["update:modelValue"]),setup(a,{emit:l}){var k;const t=e.useModel(a,"modelValue"),o=a,n=e.ref(null),i=l,d=h=>{i("focusInput"),h.target.setSelectionRange(t.value.length,t.value.length),n.value!==null&&(n.value.style.top="-.6em")},p=h=>{var u;((u=t.value)==null?void 0:u.length)===0&&n.value!==null&&n.value.removeAttribute("style")};((k=t.value)==null?void 0:k.length)>0&&n.value!==null&&(n.value.style.top="-.6em");const f=()=>{i("suffix")},g=()=>{i("prefix")},D=e.computed(()=>{let h=["sw-input"];return o.size.length>0&&h.push("sw-"+o.size),o.class.length>0&&h.push(o.class),h});e.watch(t,(h,u)=>{o.type==="phone"&&(t.value=m(h,u))});const m=(h,u)=>{if(/^\+[0-9]\s/.test(u)&&h.length===2||/^\+0\s/.test(h))return"";const w=h;if(typeof w>"u"||w.length===0)return w;const _="+0 (___) ___-__-__";let S=0;const N=_.replace(/\D/g,""),$=w.replace(/\D/g,"");let b=_.replace(/[_\d]/g,x=>S<$.length?$.charAt(S++)||N.charAt(S):x);S=b.indexOf("_"),S!==-1&&(S=S<5?3:S,b=b.slice(0,S));let C=_.slice(0,w.length).replace(/_+/g,x=>`\\d{1,${x.length}}`).replace(/[+()]/g,"\\$&");if(C=new RegExp(`^${C}$`),b=b.replace(/[-—]$|(\) )$/g,""),!C.test(w)||w.length<5)return b};return(h,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(D.value)},[o.before.length>0?(e.openBlock(),e.createBlock(v,{key:0,"icon-class":o.before,onClick:g},null,8,["icon-class"])):e.renderSlot(h.$slots,"prefix",{key:1}),o.label.length>0?(e.openBlock(),e.createElementBlock("label",{key:2,for:o.name,ref_key:"lab",ref:n},[e.createTextVNode(e.toDisplayString(o.label),1),o.required?(e.openBlock(),e.createElementBlock("span",be,"*")):e.createCommentVNode("",!0)],8,ke)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=w=>t.value=w),required:o.required,placeholder:o.required&&o.label.length===0?o.placeholder+"*":o.placeholder,type:o.type,id:o.name,name:o.name,size:"60",onFocus:d,onBlur:p,maxlength:"128"},null,40,Be),[[e.vModelDynamic,t.value]]),o.after.length>0?(e.openBlock(),e.createBlock(v,{key:3,"icon-class":o.after,onClick:f},null,8,["icon-class"])):e.renderSlot(h.$slots,"suffix",{key:4})],2))}}},Symbol.toStringTag,{value:"Module"})),De={key:0},Ee=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwMessage",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=e.useModel(a,"modelValue"),t=a,o=e.ref(null);return(n,i)=>{const d=e.resolveComponent("svg-icon");return l.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["sw-message",t.class]),ref_key:"messageRef",ref:o},[t.name.length>0?(e.openBlock(),e.createElementBlock("header",De,[e.renderSlot(n.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(t.name)+" ",1),e.createVNode(q,{link:"",type:"primary",onClick:i[0]||(i[0]=p=>l.value=!1)},{default:e.withCtx(()=>[e.createVNode(d,{"icon-class":t.iconAfter},null,8,["icon-class"])]),_:1})])])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",{},()=>[i[1]||(i[1]=e.createTextVNode("111222"))]),e.createElementVNode("footer",null,[e.renderSlot(n.$slots,"footer")])],2)):e.createCommentVNode("",!0)}}}},Symbol.toStringTag,{value:"Module"})),Me=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSection",props:{name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},setup(a){const l=a;return(t,o)=>{const n=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(l.class)},[e.createElementVNode("header",null,[e.renderSlot(t.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(l.name)+" ",1),e.createVNode(n,{"icon-class":l.iconAfter},null,8,["icon-class"])])]),e.renderSlot(t.$slots,"default"),e.createElementVNode("footer",null,[e.renderSlot(t.$slots,"footer")])],2)}}}},Symbol.toStringTag,{value:"Module"})),Te={class:"popup"},Ce={class:"wrapper"},Ve={class:"scrollbar"},Ne=["onClick"],xe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSelect",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},placeholder:{type:String,default:""},token:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=e.ref({fullText:""}),t=e.ref(!1),o=e.ref([]),n=e.useModel(a,"modelValue"),i=a;e.watch(n.text,f=>{f.length>3&&(l.value.fullText=f)}),e.watch(l.value.fullText,(f,g)=>{t.value=f.length>3&&f.length>g.length,f.length>3&&d()});const d=()=>{let f="https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address";console.log(l.value.fullText),axios.post(f,{query:l.value.fullText},{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Token "+i.token}}).then(g=>{console.log(g.data.suggestions),o.value=g.data.suggestions,o.value.length===1&&p(o.value[0])}).catch(g=>{console.log(g)})},p=f=>{l.value.fullText=f.value,t.value=!1;const g={};g.text=f.value,g.coords=[Number(f.data.geo_lat),Number(f.data.geo_lon)],g.suggestion=f.data,n.value=g};return(f,g)=>{const D=e.resolveComponent("sw-input");return e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(D,{size:"large",modelValue:l.value.fullText,"onUpdate:modelValue":g[0]||(g[0]=m=>l.value.fullText=m),placeholder:a.placeholder},null,8,["modelValue","placeholder"]),e.withDirectives(e.createElementVNode("div",Ce,[e.createElementVNode("ul",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(m,k)=>(e.openBlock(),e.createElementBlock("li",{tabindex:"1",key:k,onClick:h=>p(m)},e.toDisplayString(m.value),9,Ne))),128))])],512),[[e.vShow,t.value]])])}}}},Symbol.toStringTag,{value:"Module"})),ze={key:0},R={__name:"SwSkeletonItem",props:{width:{type:String,default:"100"},class:{type:String,default:""},animate:{type:Boolean,default:!1},size:{type:String,default:""}},setup(a){const l=a,t=e.computed(()=>{let n=["sw-skeleton-item"];return l.size.length>0&&n.push("sw-"+l.size),l.animate&&n.push("sw-animate"),l.class.length>0&&n.push(l.class),n}),o=e.computed(()=>({width:l.width+"%"}));return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.value),style:e.normalizeStyle(o.value)},[l.animate?(e.openBlock(),e.createElementBlock("div",ze)):e.createCommentVNode("",!0)],6))}},je=Object.freeze(Object.defineProperty({__proto__:null,default:R},Symbol.toStringTag,{value:"Module"})),Pe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSkeleton",props:{class:{type:String,default:""},visual:{type:Boolean,default:!1}},setup(a){const l=a;return(t,o)=>l.visual?e.renderSlot(t.$slots,"default",{key:0},()=>[o[0]||(o[0]=e.createTextVNode("1"))]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["sw-skeleton",l.class])},[e.renderSlot(t.$slots,"skeleton",{},()=>[e.createVNode(R,{animate:"",size:"small"})])],2))}}},Symbol.toStringTag,{value:"Module"})),Oe=["name","id"],ve=["for","data-onlabel","data-offlabel"],Fe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSwitch",props:e.mergeModels({id:{type:String,default:"checkbox"},class:{type:String,default:""},name:{type:String,default:""},on:{type:String,default:""},off:{type:String,default:""},size:{type:String,default:""},checkbox:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const l=e.useModel(a,"modelValue"),t=a,o=e.computed(()=>{let n=["sw-switch"];return t.size.length>0&&n.push("sw-"+t.size),t.checkbox&&n.push("sw-checkbox"),t.class.length>0&&n.push(t.class),n});return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.value)},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",name:t.name,class:"sw-control",id:t.id,"onUpdate:modelValue":i[0]||(i[0]=d=>l.value=d)},null,8,Oe),[[e.vModelCheckbox,l.value]]),e.createElementVNode("label",{for:t.id,class:"sw-label","data-onlabel":t.on,"data-offlabel":t.off},null,8,ve),e.renderSlot(n.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Ie=["onClick"],Ae=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabs",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:l}){e.ref(0);const t=e.ref([]),o=a,n=e.useModel(a,"modelValue"),i=l;return t.value=e.useSlots().default().filter(d=>d.type.__name==="SwTabsPane"),e.provide("activeTab",n),e.provide("tabs",t),(d,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+o.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(f,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:e.normalizeClass([{active:n.value===g}]),onClick:D=>{n.value=g,i("tab-click",g)}},e.toDisplayString(f.props.label||f.props.title),11,Ie))),128))]),e.renderSlot(d.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Le=["onClick"],Ye=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsNew",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:l}){e.ref(0);const t=e.ref([]),o=a,n=e.useModel(a,"modelValue"),i=l;return e.provide("activeTab",n),e.provide("tabs",t),e.provide("registerTab",d=>{t.value.push(d)}),(d,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+o.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(f,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:e.normalizeClass([{active:n.value===g}]),onClick:D=>{n.value=g,i("tab-click",g)}},e.toDisplayString(f.props.label||f.props.title),11,Le))),128))]),e.renderSlot(d.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),qe={key:0,class:"tab-content"},Re=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPane",props:{title:{type:String,required:!0}},setup(a){const l=a,t=e.inject("activeTab"),o=e.inject("tabs"),n=e.computed(()=>{const i=o.value.findIndex(d=>d.props.title===l.title);return t.value===i});return(i,d)=>n.value?(e.openBlock(),e.createElementBlock("div",qe,[e.renderSlot(i.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"})),He={key:0,class:"tab-content"},We=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPaneNew",props:{label:{type:String,required:!0},title:{type:String}},setup(a){const l=a,t=e.inject("registerTab");if(!t)throw new Error("SwTabsPane must be used inside SwTabs");t({props:l});const o=e.inject("activeTab");if(!e.inject("tabs"))throw new Error("Tabs array is not provided by SwTabs");const i=e.inject("tabs").value.length-1;return(d,p)=>e.unref(o)===i?(e.openBlock(),e.createElementBlock("div",He,[e.renderSlot(d.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"}));T.Alert=I,T.Library=te,T.components=F,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.js
CHANGED