@studio-west/component-sw 0.3.12 → 0.3.14

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