@studio-west/component-sw 0.13.11 → 0.13.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { a as e, i as t } from "./utils-DwvFrrWs.js";
1
+ import { a as e, o as t } from "./utils-qzwUfWRX.js";
2
2
  import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, renderSlot as f, toDisplayString as p, unref as m, withModifiers as h } from "vue";
3
3
  //#region src/components/SwDatePicker.vue
4
4
  var ee = { class: "sw-data-picker" }, g = {
@@ -56,7 +56,7 @@ var ee = { class: "sw-data-picker" }, g = {
56
56
  let n = new Date(2024, t);
57
57
  return new Intl.DateTimeFormat(W.value, { month: "long" }).format(n);
58
58
  })), q = u(Math.floor(F.value / 10) * 10), J = r(() => Array.from({ length: 12 }, (e, t) => q.value + t - 1));
59
- A.data?.startDate ? (N.value = new Date(t(A.data.startDate)), F.value = N.value.getFullYear(), I.value = N.value.getMonth()) : A.data?.firstDate && (F.value = new Date(t(A.data.firstDate)).getFullYear(), I.value = new Date(t(A.data.firstDate)).getMonth(), z.value = new Date(F.value, I.value + 1, 1).getMonth()), A.data?.endDate && A.range === "range" && (P.value = new Date(t(A.data.endDate)), L.value = P.value.getFullYear(), R.value = P.value.getMonth());
59
+ A.data?.startDate ? (N.value = new Date(e(A.data.startDate)), F.value = N.value.getFullYear(), I.value = N.value.getMonth()) : A.data?.firstDate && (F.value = new Date(e(A.data.firstDate)).getFullYear(), I.value = new Date(e(A.data.firstDate)).getMonth(), z.value = new Date(F.value, I.value + 1, 1).getMonth()), A.data?.endDate && A.range === "range" && (P.value = new Date(e(A.data.endDate)), L.value = P.value.getFullYear(), R.value = P.value.getMonth());
60
60
  let Y = () => {
61
61
  B.value = [], V.value = 0;
62
62
  let e = new Date(F.value, I.value, 0);
@@ -101,38 +101,38 @@ var ee = { class: "sw-data-picker" }, g = {
101
101
  e(t?.weekend ?? t?.holidays, "weekend"), e(t?.preholiday ?? t?.preholidays, "preholiday"), e(t?.holiday, "holiday"), e(t?.nowork, "nowork");
102
102
  }, pe = () => {
103
103
  if (!A.limitation || A.limitation.length < 2) return !1;
104
- let e = A.limitation.filter((e) => e.startDate && e.endDate);
105
- if (e.length < 2) return !1;
106
- let n = [...e].sort((e, n) => new Date(t(e.startDate)).getTime() - new Date(t(n.startDate)).getTime());
107
- for (let e = 1; e < n.length; e++) {
108
- let r = new Date(t(n[e - 1].endDate));
109
- if (new Date(t(n[e].startDate)) <= r) return console.warn("Warning: Диапазоны пересекаются:", n[e - 1], n[e]), !0;
104
+ let t = A.limitation.filter((e) => e.startDate && e.endDate);
105
+ if (t.length < 2) return !1;
106
+ let n = [...t].sort((t, n) => new Date(e(t.startDate)).getTime() - new Date(e(n.startDate)).getTime());
107
+ for (let t = 1; t < n.length; t++) {
108
+ let r = new Date(e(n[t - 1].endDate));
109
+ if (new Date(e(n[t].startDate)) <= r) return console.warn("Warning: Диапазоны пересекаются:", n[t - 1], n[t]), !0;
110
110
  }
111
111
  return !1;
112
- }, X = (e, n, r) => {
112
+ }, X = (t, n, r) => {
113
113
  if (!A.limitation || A.limitation.length === 0 || r == null) return !0;
114
- let i = new Date(e, n, r).getTime();
115
- for (let e of A.limitation) {
116
- let { startDate: n, endDate: r } = e;
114
+ let i = new Date(t, n, r).getTime();
115
+ for (let t of A.limitation) {
116
+ let { startDate: n, endDate: r } = t;
117
117
  if (!n && r) {
118
- if (i <= new Date(t(r)).getTime()) return !1;
118
+ if (i <= new Date(e(r)).getTime()) return !1;
119
119
  continue;
120
120
  }
121
121
  if (n && !r) {
122
- if (i >= new Date(t(n)).getTime()) return !1;
122
+ if (i >= new Date(e(n)).getTime()) return !1;
123
123
  continue;
124
124
  }
125
125
  if (n && r) {
126
- let e = new Date(t(n)).getTime(), a = new Date(t(r)).getTime();
127
- if (e <= a) {
128
- if (i >= e && i <= a) return !1;
129
- } else if (i >= e || i <= a) return !1;
126
+ let t = new Date(e(n)).getTime(), a = new Date(e(r)).getTime();
127
+ if (t <= a) {
128
+ if (i >= t && i <= a) return !1;
129
+ } else if (i >= t || i <= a) return !1;
130
130
  }
131
131
  }
132
132
  return !0;
133
- }, Z = (t, n) => {
134
- if (!X(t.year, t.month, t.day)) return;
135
- let r = e(new Date(t.year, t.month, t.day), "{dd}.{m}.{Y}");
133
+ }, Z = (e, n) => {
134
+ if (!X(e.year, e.month, e.day)) return;
135
+ let r = t(new Date(e.year, e.month, e.day), "{dd}.{m}.{Y}");
136
136
  if (A.range === "range") if (U.value !== -1) me(), H.value = n, B.value[n].class[1] = "active";
137
137
  else if (H.value !== -1) {
138
138
  let [e, t] = [Math.min(H.value, n), Math.max(H.value, n)];
@@ -148,21 +148,21 @@ var ee = { class: "sw-data-picker" }, g = {
148
148
  });
149
149
  }, me = () => {
150
150
  B.value.forEach((e) => e.class[1] = ""), H.value = -1, U.value = -1;
151
- }, he = (t, n, r) => {
152
- let i = e(new Date(B.value[t].year, B.value[t].month, B.value[t].day), "{dd}.{m}.{Y}");
153
- if (n >= t) {
154
- for (let e = t + 1; e < n; e++) B.value[e].class[1] = "select";
151
+ }, he = (e, n, r) => {
152
+ let i = t(new Date(B.value[e].year, B.value[e].month, B.value[e].day), "{dd}.{m}.{Y}");
153
+ if (n >= e) {
154
+ for (let t = e + 1; t < n; t++) B.value[t].class[1] = "select";
155
155
  j("input", {
156
156
  dateStart: i,
157
157
  dateEnd: r,
158
- count: Q(t, n)
158
+ count: Q(e, n)
159
159
  });
160
160
  } else {
161
- for (let e = n + 1; e < t; e++) B.value[e].class[1] = "select";
161
+ for (let t = n + 1; t < e; t++) B.value[t].class[1] = "select";
162
162
  j("input", {
163
163
  dateStart: r,
164
164
  dateEnd: i,
165
- count: Q(n, t)
165
+ count: Q(n, e)
166
166
  });
167
167
  }
168
168
  B.value[n].class[1] = "active";
@@ -181,37 +181,37 @@ var ee = { class: "sw-data-picker" }, g = {
181
181
  B.value[U.value].class[1] = "active";
182
182
  for (let e = H.value + 1; e < U.value; e++) B.value[e].class[1] = "select";
183
183
  }
184
- return (t, r) => (l(), a("div", ee, [o("div", null, [
184
+ return (e, r) => (l(), a("div", ee, [o("div", null, [
185
185
  A.range === "decades" || M.value === 3 ? (l(), a("p", g, [
186
186
  o("span", null, [o("button", { onClick: r[0] ||= h((e) => {
187
187
  q.value -= 10, $(F.value, I.value);
188
- }, ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[16] ||= s("«", -1)])])]),
188
+ }, ["prevent"]) }, [f(e.$slots, "double-arrow", {}, () => [r[16] ||= s("«", -1)])])]),
189
189
  o("span", _, p(J.value[0]) + " - " + p(J.value[11]), 1),
190
190
  o("span", null, [o("button", {
191
191
  class: "sw-revers",
192
192
  onClick: r[1] ||= h((e) => {
193
193
  q.value += 10, $(F.value, I.value);
194
194
  }, ["prevent"])
195
- }, [f(t.$slots, "double-arrow", {}, () => [r[17] ||= s("«", -1)])])])
195
+ }, [f(e.$slots, "double-arrow", {}, () => [r[17] ||= s("«", -1)])])])
196
196
  ])) : (l(), a("p", v, [
197
- o("span", null, [o("button", { onClick: r[2] ||= h((e) => $(F.value - 1, I.value), ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[18] ||= s("«", -1)])]), o("button", { onClick: r[3] ||= h((e) => {
197
+ o("span", null, [o("button", { onClick: r[2] ||= h((e) => $(F.value - 1, I.value), ["prevent"]) }, [f(e.$slots, "double-arrow", {}, () => [r[18] ||= s("«", -1)])]), o("button", { onClick: r[3] ||= h((e) => {
198
198
  M.value = 0, $(F.value, I.value - 1);
199
- }, ["prevent"]) }, [f(t.$slots, "arrow", {}, () => [r[19] ||= s("‹", -1)])])]),
200
- o("span", y, [o("button", { onClick: r[4] ||= h((e) => M.value = 3, ["prevent"]) }, p(F.value), 1), o("button", { onClick: r[5] ||= h((e) => M.value = 1, ["prevent"]) }, p(m(e)(N.value.setMonth(I.value), "{F}")), 1)]),
199
+ }, ["prevent"]) }, [f(e.$slots, "arrow", {}, () => [r[19] ||= s("‹", -1)])])]),
200
+ o("span", y, [o("button", { onClick: r[4] ||= h((e) => M.value = 3, ["prevent"]) }, p(F.value), 1), o("button", { onClick: r[5] ||= h((e) => M.value = 1, ["prevent"]) }, p(m(t)(N.value.setMonth(I.value), "{F}")), 1)]),
201
201
  o("span", null, [o("button", {
202
202
  class: "sw-revers",
203
203
  onClick: r[6] ||= h((e) => {
204
204
  M.value = 0, $(F.value, I.value + 1);
205
205
  }, ["prevent"])
206
- }, [f(t.$slots, "arrow", {}, () => [r[20] ||= s("‹", -1)])]), o("button", {
206
+ }, [f(e.$slots, "arrow", {}, () => [r[20] ||= s("‹", -1)])]), o("button", {
207
207
  class: "sw-revers",
208
208
  onClick: r[7] ||= h((e) => $(F.value + 1, I.value), ["prevent"])
209
- }, [f(t.$slots, "double-arrow", {}, () => [r[21] ||= s("«", -1)])])])
209
+ }, [f(e.$slots, "double-arrow", {}, () => [r[21] ||= s("«", -1)])])])
210
210
  ])),
211
- A.range === "year" || A.range === "decades" || M.value === 1 || M.value === 3 ? i("", !0) : (l(), a("div", b, [(l(), a(n, null, d(7, (t, n) => o("button", {
211
+ A.range === "year" || A.range === "decades" || M.value === 1 || M.value === 3 ? i("", !0) : (l(), a("div", b, [(l(), a(n, null, d(7, (e, n) => o("button", {
212
212
  key: n,
213
213
  class: "disabled"
214
- }, p(m(e)(new Date(1970, 1, t + m(G)), "{D}")), 1)), 64))])),
214
+ }, p(m(t)(new Date(1970, 1, e + m(G)), "{D}")), 1)), 64))])),
215
215
  M.value !== 3 && A.range === "year" || M.value === 1 ? (l(), a("div", x, [(l(!0), a(n, null, d(K.value, (e, t) => (l(), a("button", {
216
216
  key: t,
217
217
  onClick: h((e) => {
@@ -235,33 +235,33 @@ var ee = { class: "sw-data-picker" }, g = {
235
235
  A.range === "decades" || M.value === 4 ? (l(), a("p", ie, [
236
236
  o("span", null, [o("button", { onClick: r[8] ||= h((e) => {
237
237
  q.value -= 10, $(F.value, I.value);
238
- }, ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[22] ||= s("«", -1)])])]),
238
+ }, ["prevent"]) }, [f(e.$slots, "double-arrow", {}, () => [r[22] ||= s("«", -1)])])]),
239
239
  o("span", ae, p(J.value[0]) + " - " + p(J.value[11]), 1),
240
240
  o("span", null, [o("button", {
241
241
  class: "sw-revers",
242
242
  onClick: r[9] ||= h((e) => {
243
243
  q.value += 10, $(F.value, I.value);
244
244
  }, ["prevent"])
245
- }, [f(t.$slots, "double-arrow", {}, () => [r[23] ||= s("«", -1)])])])
245
+ }, [f(e.$slots, "double-arrow", {}, () => [r[23] ||= s("«", -1)])])])
246
246
  ])) : (l(), a("p", oe, [
247
- o("span", null, [o("button", { onClick: r[10] ||= h((e) => $(F.value - 1, I.value), ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[24] ||= s("«", -1)])]), o("button", { onClick: r[11] ||= h((e) => {
247
+ o("span", null, [o("button", { onClick: r[10] ||= h((e) => $(F.value - 1, I.value), ["prevent"]) }, [f(e.$slots, "double-arrow", {}, () => [r[24] ||= s("«", -1)])]), o("button", { onClick: r[11] ||= h((e) => {
248
248
  M.value = 0, $(F.value, I.value - 1);
249
- }, ["prevent"]) }, [f(t.$slots, "arrow", {}, () => [r[25] ||= s("‹", -1)])])]),
250
- o("span", se, [o("button", { onClick: r[12] ||= h((e) => M.value = 4, ["prevent"]) }, p(new Date(F.value, I.value + 1).getFullYear()), 1), o("button", { onClick: r[13] ||= h((e) => M.value = 2, ["prevent"]) }, p(m(e)(N.value.setMonth(I.value + 1), "{F}")), 1)]),
249
+ }, ["prevent"]) }, [f(e.$slots, "arrow", {}, () => [r[25] ||= s("‹", -1)])])]),
250
+ o("span", se, [o("button", { onClick: r[12] ||= h((e) => M.value = 4, ["prevent"]) }, p(new Date(F.value, I.value + 1).getFullYear()), 1), o("button", { onClick: r[13] ||= h((e) => M.value = 2, ["prevent"]) }, p(m(t)(N.value.setMonth(I.value + 1), "{F}")), 1)]),
251
251
  o("span", null, [o("button", {
252
252
  class: "sw-revers",
253
253
  onClick: r[14] ||= h((e) => {
254
254
  M.value = 0, $(F.value, I.value + 1);
255
255
  }, ["prevent"])
256
- }, [f(t.$slots, "arrow", {}, () => [r[26] ||= s("‹", -1)])]), o("button", {
256
+ }, [f(e.$slots, "arrow", {}, () => [r[26] ||= s("‹", -1)])]), o("button", {
257
257
  class: "sw-revers",
258
258
  onClick: r[15] ||= h((e) => $(F.value + 1, I.value), ["prevent"])
259
- }, [f(t.$slots, "double-arrow", {}, () => [r[27] ||= s("«", -1)])])])
259
+ }, [f(e.$slots, "double-arrow", {}, () => [r[27] ||= s("«", -1)])])])
260
260
  ])),
261
- M.value === 2 || M.value === 4 ? i("", !0) : (l(), a("div", ce, [(l(), a(n, null, d(7, (t, n) => o("button", {
261
+ M.value === 2 || M.value === 4 ? i("", !0) : (l(), a("div", ce, [(l(), a(n, null, d(7, (e, n) => o("button", {
262
262
  key: n,
263
263
  class: "disabled"
264
- }, p(m(e)(new Date(1970, 1, t + m(G)), "{D}")), 1)), 64))])),
264
+ }, p(m(t)(new Date(1970, 1, e + m(G)), "{D}")), 1)), 64))])),
265
265
  M.value === 2 ? (l(), a("div", le, [(l(!0), a(n, null, d(K.value, (e, t) => (l(), a("button", {
266
266
  key: t,
267
267
  onClick: h((e) => {
@@ -0,0 +1,177 @@
1
+ import { Teleport as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, mergeModels as a, nextTick as o, normalizeClass as s, normalizeStyle as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, renderSlot as p, unref as m, useModel as h, watch as g, watchEffect as _, withModifiers as v } from "vue";
2
+ //#region src/components/SwDropdown.vue
3
+ var y = ["id"], b = {
4
+ __name: "SwDropdown",
5
+ props: /*@__PURE__*/ a({
6
+ class: {
7
+ type: String,
8
+ default: ""
9
+ },
10
+ size: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ type: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ trigger: {
19
+ type: String,
20
+ default: "click"
21
+ },
22
+ placement: {
23
+ type: String,
24
+ default: "bottom-left"
25
+ },
26
+ maxWidth: {
27
+ type: Number,
28
+ default: 0
29
+ }
30
+ }, {
31
+ modelValue: {},
32
+ modelModifiers: {}
33
+ }),
34
+ emits: ["update:modelValue"],
35
+ setup(a, { expose: b }) {
36
+ let x = a, S = h(a, "modelValue"), C = f(null), w = f(null), T = f({}), E = f(""), D = Math.ceil(Math.random() * 1e3), O = f(0), k = f(-1), A = t(() => {
37
+ let e = ["sw-dropdown"];
38
+ return x.size.length > 0 && e.push("sw-" + x.size), x.type.length > 0 && e.push("sw-" + x.type), e;
39
+ }), j = () => w.value ? [...w.value.querySelectorAll(".sw-dropdown-item")] : [], M = (e) => {
40
+ let t = j();
41
+ if (!t.length) return;
42
+ let n = (e % t.length + t.length) % t.length;
43
+ k.value = n, t.forEach((e, t) => {
44
+ e.classList.toggle("is-active", t === n), t === n && e.scrollIntoView({ block: "nearest" });
45
+ });
46
+ }, N = () => {
47
+ o(() => {
48
+ w.value && (w.value.focus({ preventScroll: !0 }), k.value = -1, j().forEach((e) => e.classList.remove("is-active")));
49
+ });
50
+ }, P = (e) => {
51
+ if (!S.value) return;
52
+ let t = j();
53
+ switch (e.key) {
54
+ case "Escape":
55
+ e.preventDefault(), e.stopPropagation(), S.value = !1, C.value?.querySelector("button, [tabindex], a, input")?.focus?.() || C.value?.focus?.();
56
+ break;
57
+ case "ArrowDown":
58
+ e.preventDefault(), M(k.value + 1);
59
+ break;
60
+ case "ArrowUp":
61
+ e.preventDefault(), M(k.value <= 0 ? t.length - 1 : k.value - 1);
62
+ break;
63
+ case "Home":
64
+ e.preventDefault(), M(0);
65
+ break;
66
+ case "End":
67
+ e.preventDefault(), M(t.length - 1);
68
+ break;
69
+ case "Enter":
70
+ case " ":
71
+ k.value >= 0 && t[k.value] && (e.preventDefault(), t[k.value].click());
72
+ break;
73
+ case "Tab":
74
+ S.value = !1;
75
+ break;
76
+ }
77
+ };
78
+ g(S, (e) => {
79
+ typeof document > "u" || (e ? N() : k.value = -1);
80
+ });
81
+ let F = new ResizeObserver(() => {
82
+ S.value && O.value++, O.value > 99 && (O.value = 1);
83
+ });
84
+ _(() => {
85
+ if (!S.value || !w.value || !C.value) return;
86
+ O.value < 2 && F.observe(w.value);
87
+ let e = window.pageYOffset || document.documentElement.scrollTop, t = window.pageXOffset || document.documentElement.scrollLeft;
88
+ document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = `-${t}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = e, document.documentElement.scrollLeft = t;
89
+ let n = C.value.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = w.value.offsetHeight, o = w.value.offsetWidth, s = n.left + n.width / 2 + t, c = n.top + n.height / 2 + e, l = n.height / 2 + 8, [u, d] = x.placement.split("-", 2);
90
+ switch (u) {
91
+ case "bottom":
92
+ c = e + i - a - l - 8 < c ? c - l - a : c + l, d === void 0 && (s -= o / 2);
93
+ break;
94
+ case "top":
95
+ c = e + a + l + 8 > c ? c + l : c - l - a, d === void 0 && (s -= o / 2);
96
+ break;
97
+ case "left":
98
+ s - o - n.width / 2 - 8 < 0 ? s + n.width / 2 + 8 + o < r ? (s = s + n.width / 2 + 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s = s + n.width / 2 < r ? s + n.width / 2 - o : s - o / 2) : (s = s - o - n.width / 2 - 8, c -= a / 2);
99
+ break;
100
+ case "right":
101
+ s + n.width / 2 + 8 + o > r ? s - o - n.width / 2 - 8 > 0 ? (s = s - o - n.width / 2 - 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s -= n.width / 2) : (s = s + n.width / 2 + 8, c -= a / 2);
102
+ break;
103
+ }
104
+ switch (d) {
105
+ case "left":
106
+ s = t + r - 8 > s - n.width / 2 + o ? s - n.width / 2 : s - o + n.width / 2;
107
+ break;
108
+ case "right":
109
+ s = 8 < s + n.width / 2 - o ? s - o + n.width / 2 : s - n.width / 2;
110
+ break;
111
+ }
112
+ s < 0 && (s = 0), c < 0 && (c = 0);
113
+ let f = n.left + n.width / 2 + t, p = n.top + n.height / 2 + e, m = s + o / 2 - f, h = c + a / 2 - p, g;
114
+ g = Math.abs(h) >= Math.abs(m) ? h > 0 ? "top" : "bottom" : m > 0 ? "left" : "right";
115
+ let _ = g === "top" || g === "bottom" ? Math.max(12, Math.min(o - 12, f - s)) : Math.max(12, Math.min(a - 12, p - c));
116
+ E.value = `arrow-${g}`;
117
+ let v = 0;
118
+ for (let e = C.value; e && e !== document.documentElement; e = e.parentElement) {
119
+ let t = getComputedStyle(e).zIndex;
120
+ if (t === "auto") continue;
121
+ let n = Number.parseInt(t, 10);
122
+ if (!Number.isNaN(n)) {
123
+ v = n;
124
+ break;
125
+ }
126
+ }
127
+ T.value = {
128
+ position: "absolute",
129
+ top: `${c}px`,
130
+ left: `${s}px`,
131
+ maxWidth: x.maxWidth > 0 ? `${x.maxWidth}px` : "",
132
+ "--sw-dropdown-arrow": `${_}px`,
133
+ "--sw-z-index": String(v)
134
+ };
135
+ }, { flush: "post" });
136
+ let I = () => {
137
+ x.trigger === "click" && (S.value = !S.value);
138
+ }, L = () => {
139
+ x.trigger === "hover" && (S.value = !S.value);
140
+ }, R = () => {
141
+ x.trigger === "context" && (S.value = !S.value);
142
+ }, z = () => {
143
+ S.value && O.value++, O.value > 99 && (O.value = 1);
144
+ };
145
+ b({ handleResize: z });
146
+ let B = (e) => {
147
+ x.trigger !== "none" && !e.target.closest(`[id="${D}"]`) && C.value && !C.value.contains(e.target) && (S.value = !1);
148
+ }, V = (e) => {
149
+ e.key === "Escape" && S.value && (S.value = !1);
150
+ };
151
+ return l(() => {
152
+ typeof window > "u" || (window.addEventListener("resize", z), document.documentElement.ontouchstart === void 0 ? document.documentElement.addEventListener("click", B, !0) : document.documentElement.addEventListener("touchstart", B, !0), window.onscrollend === void 0 ? window.addEventListener("scroll", z) : window.addEventListener("scrollend", z), document.addEventListener("keydown", V));
153
+ }), u(() => {
154
+ F.disconnect(), !(typeof window > "u") && (window.removeEventListener("resize", z), document.documentElement.ontouchstart === void 0 ? document.documentElement.removeEventListener("click", B) : document.documentElement.removeEventListener("touchstart", B), window.onscrollend === void 0 ? window.removeEventListener("scroll", z) : window.removeEventListener("scrollend", z), document.removeEventListener("keydown", V));
155
+ }), (t, a) => (d(), i("div", {
156
+ class: s(A.value),
157
+ onClick: a[0] ||= (e) => I(),
158
+ onMouseover: a[1] ||= v((e) => L(), ["stop"]),
159
+ onMouseleave: a[2] ||= v((e) => L(), ["stop"]),
160
+ onContextmenu: a[3] ||= v((e) => R(), ["stop"]),
161
+ ref_key: "dropdownRef",
162
+ ref: C
163
+ }, [p(t.$slots, "default"), (d(), n(e, { to: "body" }, [S.value ? (d(), i("ul", {
164
+ key: 0,
165
+ ref_key: "popupRef",
166
+ ref: w,
167
+ id: m(D),
168
+ class: s(["sw-dropdown-popup", [x.class, E.value]]),
169
+ style: c(T.value),
170
+ tabindex: "-1",
171
+ role: "menu",
172
+ onKeydown: P
173
+ }, [p(t.$slots, "dropdown")], 46, y)) : r("", !0)]))], 34));
174
+ }
175
+ };
176
+ //#endregion
177
+ export { b as default };
@@ -0,0 +1,43 @@
1
+ import { n as e } from "./SwIcon-B-HHyuxu.js";
2
+ import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, normalizeClass as o, openBlock as s, renderSlot as c } from "vue";
3
+ //#region src/components/SwDropdownItem.vue
4
+ var l = {
5
+ class: "lead",
6
+ "aria-hidden": "true"
7
+ }, u = { class: "text" }, d = {
8
+ __name: "SwDropdownItem",
9
+ props: {
10
+ class: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ size: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ type: {
19
+ type: String,
20
+ default: ""
21
+ },
22
+ before: {
23
+ type: String,
24
+ default: ""
25
+ },
26
+ iconBefore: {
27
+ type: String,
28
+ default: ""
29
+ }
30
+ },
31
+ setup(d) {
32
+ let f = d, p = t(() => f.before || f.iconBefore), m = t(() => {
33
+ let e = ["sw-dropdown-item"];
34
+ return f.size.length > 0 && e.push("sw-" + f.size), f.type.length > 0 && e.push("sw-" + f.type), f.class.length > 0 && e.push(f.class), e;
35
+ });
36
+ return (t, d) => (s(), i("li", { class: o(m.value) }, [a("span", l, [p.value.length > 0 ? (s(), n(e, {
37
+ key: 0,
38
+ "icon-class": p.value
39
+ }, null, 8, ["icon-class"])) : r("", !0)]), a("span", u, [c(t.$slots, "default")])], 2));
40
+ }
41
+ };
42
+ //#endregion
43
+ export { d as default };
@@ -1,5 +1,5 @@
1
- import { n as e } from "./SwIcon-C4RHAbK1.js";
2
- import { t } from "./SwButton-BfG2InPf.js";
1
+ import { n as e } from "./SwIcon-B-HHyuxu.js";
2
+ import { t } from "./SwButton-DpOGpsBS.js";
3
3
  import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onUnmounted as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, useModel as ee, watch as te, withCtx as b, withModifiers as ne } from "vue";
4
4
  //#region src/utils/mediaCrop.ts
5
5
  function re(e, t, n, r) {
@@ -0,0 +1,59 @@
1
+ import { computed as e, createCommentVNode as t, createElementBlock as n, createTextVNode as r, normalizeClass as i, openBlock as a, renderSlot as o, toDisplayString as s, unref as c, useSlots as l } from "vue";
2
+ //#region src/components/SwFormItem.vue
3
+ var u = {
4
+ key: 0,
5
+ class: "label"
6
+ }, d = {
7
+ key: 1,
8
+ class: "text"
9
+ }, f = {
10
+ __name: "SwFormItem",
11
+ props: {
12
+ class: {
13
+ type: String,
14
+ default: ""
15
+ },
16
+ label: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ type: {
21
+ type: String,
22
+ default: "",
23
+ validator: (e) => [
24
+ "",
25
+ "primary",
26
+ "success",
27
+ "info",
28
+ "warning",
29
+ "danger",
30
+ "error"
31
+ ].includes(e)
32
+ },
33
+ justify: {
34
+ type: String,
35
+ default: "",
36
+ validator: (e) => [
37
+ "",
38
+ "start",
39
+ "end",
40
+ "around",
41
+ "center"
42
+ ].includes(e)
43
+ }
44
+ },
45
+ setup(f) {
46
+ let p = l(), m = f, h = e(() => {
47
+ let e = ["sw-form-item"];
48
+ return m.justify.length > 0 && e.push(`sw-${m.justify}`), m.type.length > 0 && e.push(`sw-${m.type === "error" ? "danger" : m.type}`), m.class.length > 0 && e.push(m.class), e;
49
+ });
50
+ return (e, l) => (a(), n("div", { class: i(h.value) }, [
51
+ o(e.$slots, "before"),
52
+ m.label.length > 0 || c(p).label ? (a(), n("span", u, [o(e.$slots, "label", {}, () => [r(s(m.label), 1)])])) : t("", !0),
53
+ c(p).default ? (a(), n("span", d, [o(e.$slots, "default")])) : t("", !0),
54
+ o(e.$slots, "after")
55
+ ], 2));
56
+ }
57
+ };
58
+ //#endregion
59
+ export { f as default };
@@ -0,0 +1,134 @@
1
+ import { i as e } from "./utils-qzwUfWRX.js";
2
+ import { n as t } from "./SwIcon-B-HHyuxu.js";
3
+ import { t as n } from "./SwButton-DpOGpsBS.js";
4
+ import r from "./SwDropdown-DpedC6Bn.js";
5
+ import { computed as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, mergeModels as l, normalizeClass as u, onMounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, useModel as g, watchEffect as _, withCtx as v } from "vue";
6
+ //#region src/components/SwGide.vue
7
+ var y = ["src"], b = {
8
+ __name: "SwGide",
9
+ props: /*@__PURE__*/ l({
10
+ steps: {
11
+ type: Array,
12
+ default: () => []
13
+ },
14
+ after: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ iconClose: {
19
+ type: String,
20
+ default: ""
21
+ },
22
+ maxWidth: {
23
+ type: Number,
24
+ default: 250
25
+ }
26
+ }, {
27
+ modelValue: {
28
+ type: Number,
29
+ default: 0
30
+ },
31
+ modelModifiers: {}
32
+ }),
33
+ emits: /*@__PURE__*/ l(["close"], ["update:modelValue"]),
34
+ setup(l, { emit: b }) {
35
+ let x = p(null), S = p(!0), C = p(null), w = g(l, "modelValue"), T = b, E = l, D = i(() => E.after || E.iconClose), O = () => T("close"), k = () => {
36
+ if (!x.value) return;
37
+ let t = Math.min(e(x.value), 9980);
38
+ x.value.style.setProperty("--sw-z-index", String(t));
39
+ }, A = (e) => {
40
+ let t = w.value + e;
41
+ t < 0 ? w.value = 0 : t >= E.steps.length ? O() : w.value = t;
42
+ }, j = !1, M = (e) => {
43
+ let t = e.getBoundingClientRect(), n = window.innerHeight;
44
+ t.top < 5 ? (j = !0, document.documentElement.scrollTop += t.top - 5) : t.bottom > n - 5 && (j = !0, document.documentElement.scrollTop += t.bottom - n + 5);
45
+ }, N = () => {
46
+ if (!C.value || !x.value) return;
47
+ let e = C.value.getBoundingClientRect(), t = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft;
48
+ x.value.style.gridTemplateRows = `${e.top + t - 5}px ${e.height + 10}px 1fr`, x.value.style.gridTemplateColumns = `${e.left + n - 5}px ${e.width + 10}px 1fr`, x.value.style.height = document.documentElement.scrollHeight + "px";
49
+ };
50
+ return _((e) => {
51
+ if (!x.value) return;
52
+ let t = E.steps[w.value]?.tag;
53
+ if (!t || !t.trim()) {
54
+ x.value.style.gridTemplateRows = "40% 0 1fr", x.value.style.gridTemplateColumns = "1fr 0 1fr", x.value.style.height = document.documentElement.scrollHeight + "px", k();
55
+ return;
56
+ }
57
+ if (C.value = document.querySelector(t), !C.value) {
58
+ console.warn(`[SwGuide] Элемент не найден: ${t}`);
59
+ return;
60
+ }
61
+ M(C.value);
62
+ let n = () => {
63
+ if (j) {
64
+ j = !1;
65
+ return;
66
+ }
67
+ N();
68
+ };
69
+ k(), N();
70
+ let r = new ResizeObserver(N);
71
+ r.observe(C.value), window.addEventListener("resize", n), window.addEventListener("scroll", n, { passive: !0 }), e(() => {
72
+ r.disconnect(), window.removeEventListener("resize", n), window.removeEventListener("scroll", n);
73
+ });
74
+ }), d(() => window.onload = () => C.value = document.querySelector(E.steps[w.value]?.tag)), (e, i) => (f(), a("div", {
75
+ class: "sw-gide",
76
+ ref_key: "swGide",
77
+ ref: x
78
+ }, [
79
+ i[6] ||= o("div", { class: "overlay0" }, null, -1),
80
+ i[7] ||= o("div", { class: "overlay1" }, null, -1),
81
+ c(r, {
82
+ class: "gide",
83
+ trigger: "none",
84
+ placement: E.steps[w.value].placement,
85
+ modelValue: S.value,
86
+ "onUpdate:modelValue": i[2] ||= (e) => S.value = e,
87
+ maxWidth: E.maxWidth
88
+ }, {
89
+ dropdown: v(() => [
90
+ o("header", null, [m(e.$slots, "header", {}, () => [s(h(E.steps[w.value].header) + " ", 1), c(n, {
91
+ type: "primary",
92
+ link: "",
93
+ onClick: O
94
+ }, {
95
+ default: v(() => [c(t, { "icon-class": D.value }, null, 8, ["icon-class"])]),
96
+ _: 1
97
+ })])]),
98
+ m(e.$slots, "default", {}, () => [o("div", null, h(E.steps[w.value].text), 1), o("img", {
99
+ class: u(/left/.test(E.steps[w.value]?.placement) ? "reflect" : null),
100
+ src: E.steps[w.value].img
101
+ }, null, 10, y)]),
102
+ o("footer", null, [m(e.$slots, "footer", {}, () => [c(n, {
103
+ type: w.value === 0 ? "info" : "warning",
104
+ text: "",
105
+ link: "",
106
+ onClick: i[0] ||= (e) => A(-1)
107
+ }, {
108
+ default: v(() => [m(e.$slots, "arrow", {}, () => [i[3] ||= s("‹", -1)])]),
109
+ _: 3
110
+ }, 8, ["type"]), c(n, {
111
+ type: "success",
112
+ onClick: i[1] ||= (e) => A(1),
113
+ text: "",
114
+ link: "",
115
+ class: "sw-revers"
116
+ }, {
117
+ default: v(() => [m(e.$slots, "arrow", {}, () => [i[4] ||= s("‹", -1)])]),
118
+ _: 3
119
+ })])])
120
+ ]),
121
+ default: v(() => [i[5] ||= o("div", { class: "hole" }, null, -1)]),
122
+ _: 3
123
+ }, 8, [
124
+ "placement",
125
+ "modelValue",
126
+ "maxWidth"
127
+ ]),
128
+ i[8] ||= o("div", { class: "overlay2" }, null, -1),
129
+ i[9] ||= o("div", { class: "overlay3" }, null, -1)
130
+ ], 512));
131
+ }
132
+ };
133
+ //#endregion
134
+ export { b as default };
@@ -1,5 +1,5 @@
1
- import { r as e } from "./utils-DwvFrrWs.js";
2
- import { t } from "./SwSelect-DwxIlRFI.js";
1
+ import { r as e } from "./utils-qzwUfWRX.js";
2
+ import { t } from "./SwSelect-DDNh3p6B.js";
3
3
  import { computed as n, createElementBlock as r, createElementVNode as i, mergeProps as a, openBlock as o, unref as s } from "vue";
4
4
  //#region src/components/SwIcon.vue
5
5
  var c = /* @__PURE__ */ t({ default: () => u }), l = ["href"], u = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {