@studio-west/component-sw 0.11.18 → 0.11.19

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.
Files changed (54) hide show
  1. package/dist/SwAlert-BN8mwcp_.js +89 -0
  2. package/dist/SwButton-B6iaLa_y.js +45 -0
  3. package/dist/SwButtonGroup-Dmsbam44.js +59 -0
  4. package/dist/SwCollapse-Dy2XxzJg.js +31 -0
  5. package/dist/SwDatePicker-CNGIsEmm.js +262 -0
  6. package/dist/SwDropdown-DMkEn-su.js +114 -0
  7. package/dist/SwDropdownItem-CscV8R77.js +36 -0
  8. package/dist/SwDropdownNew-TXu5V6xZ.js +107 -0
  9. package/dist/SwFormItem-DQJohClb.js +24 -0
  10. package/dist/SwGide-9v0z3Y49.js +125 -0
  11. package/dist/SwIcon-0PtPyq2k.js +35 -0
  12. package/dist/SwInput-fqZBIN92.js +102 -0
  13. package/dist/SwMessage-BvvbQ1cP.js +55 -0
  14. package/dist/SwSection-fNuXuePo.js +32 -0
  15. package/dist/SwSelect-CuBxoXju.js +1594 -0
  16. package/dist/SwSkeleton-DIwAcNfp.js +28 -0
  17. package/dist/SwSkeletonItem-D3Wjgl7J.js +35 -0
  18. package/dist/SwSlider-CyLU7COn.js +179 -0
  19. package/dist/SwSwitch-DluxsVEW.js +56 -0
  20. package/dist/SwTable-D5v0TIuo.js +133 -0
  21. package/dist/SwTableColumn-CCqBUIhN.js +28 -0
  22. package/dist/SwTabs-zHhFxzck.js +32 -0
  23. package/dist/SwTabsPane-BY5KEs_h.js +36 -0
  24. package/dist/component-sw.css +2 -1
  25. package/dist/index.cjs +6 -6
  26. package/dist/index.js +58 -7
  27. package/dist/utils-CGgSSFR1.js +52 -0
  28. package/package.json +1 -1
  29. package/src/components/SwButton.vue +1 -0
  30. package/src/components/SwButtonGroup.vue +1 -0
  31. package/src/components/SwTable.vue +14 -5
  32. package/dist/SwButton-yS_tKW9w.js +0 -4
  33. package/dist/SwButton.vue_vue_type_script_setup_true_lang-aODPwFa6.js +0 -34
  34. package/dist/SwButtonGroup-D9HH5POO.js +0 -49
  35. package/dist/SwCollapse-CuN3EbT6.js +0 -33
  36. package/dist/SwDatePicker-DHP73Q1c.js +0 -366
  37. package/dist/SwDropdown-DQGTnnKw.js +0 -111
  38. package/dist/SwDropdownItem-Cua7E0JN.js +0 -31
  39. package/dist/SwDropdownNew-CYfjZFd2.js +0 -107
  40. package/dist/SwFormItem-CaA4jsoa.js +0 -24
  41. package/dist/SwGide-BcLOtvRd.js +0 -138
  42. package/dist/SwInput-m4LDJuNs.js +0 -90
  43. package/dist/SwMessage-yOG9UmvF.js +0 -57
  44. package/dist/SwSection-CQe2kE0O.js +0 -34
  45. package/dist/SwSelect-BxbCfof-.js +0 -1883
  46. package/dist/SwSkeleton-B7ysp8L9.js +0 -26
  47. package/dist/SwSkeletonItem-CU7LvihY.js +0 -29
  48. package/dist/SwSlider--meCHr2D.js +0 -158
  49. package/dist/SwSwitch-DeMdyD0-.js +0 -47
  50. package/dist/SwTable-BSCqB4nS.js +0 -156
  51. package/dist/SwTableColumn-BLF5bPuJ.js +0 -28
  52. package/dist/SwTabs-DkSI4oAh.js +0 -38
  53. package/dist/SwTabsPane-Dwtj8g7T.js +0 -38
  54. package/dist/index-DX9QZTeL.js +0 -188
@@ -0,0 +1,89 @@
1
+ import { n as e } from "./SwIcon-0PtPyq2k.js";
2
+ import { t } from "./SwSelect-CuBxoXju.js";
3
+ import { Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, normalizeClass as l, onMounted as u, onUnmounted as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, withCtx as g } from "vue";
4
+ //#region src/components/SwAlert.vue
5
+ var _ = /* @__PURE__ */ t({ default: () => v }), v = {
6
+ __name: "SwAlert",
7
+ props: {
8
+ message: {
9
+ type: String,
10
+ default: "Default message"
11
+ },
12
+ before: {
13
+ type: String,
14
+ default: ""
15
+ },
16
+ class: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ after: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ size: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ duration: {
29
+ type: Number,
30
+ default: 6e3
31
+ },
32
+ type: {
33
+ type: String,
34
+ default: "info",
35
+ validator: (e) => [
36
+ "success",
37
+ "warning",
38
+ "error",
39
+ "info"
40
+ ].includes(e)
41
+ }
42
+ },
43
+ emits: ["closed"],
44
+ setup(t, { emit: _ }) {
45
+ let v = t, y = _, b = p(!1), x = null, S = () => {
46
+ document.querySelector(".sw-alert-wrapper").togglePopover(), b.value = !0, document.querySelector(".sw-alert-wrapper").showPopover(), E();
47
+ }, C = () => {
48
+ b.value = !1, y("closed");
49
+ }, w = () => {
50
+ x &&= (clearTimeout(x), null);
51
+ }, T = () => {
52
+ E();
53
+ }, E = () => {
54
+ x = setTimeout(C, v.duration);
55
+ };
56
+ u(() => {
57
+ S();
58
+ }), d(() => {
59
+ x && clearTimeout(x);
60
+ });
61
+ let D = r(() => {
62
+ let e = ["sw-alert"];
63
+ return v.size.length > 0 && e.push(`sw-${v.size}`), v.type.length > 0 && e.push(`sw-${v.type}`), v.class.length > 0 && e.push(v.class), e;
64
+ });
65
+ return (t, r) => (f(), i(n, { name: "fade" }, {
66
+ default: g(() => [b.value ? (f(), o("div", {
67
+ key: 0,
68
+ class: l(D.value),
69
+ onMouseenter: w,
70
+ onMouseleave: T
71
+ }, [
72
+ v.before.length > 0 ? (f(), i(e, {
73
+ key: 0,
74
+ "icon-class": v.before
75
+ }, null, 8, ["icon-class"])) : m(t.$slots, "prefix", { key: 1 }),
76
+ m(t.$slots, "default", {}, () => [c(h(v.message), 1)]),
77
+ v.after.length > 0 ? (f(), i(e, {
78
+ key: 2,
79
+ "icon-class": v.after,
80
+ onClick: C
81
+ }, null, 8, ["icon-class"])) : m(t.$slots, "suffix", { key: 3 }),
82
+ s("footer", null, [m(t.$slots, "footer")])
83
+ ], 34)) : a("", !0)]),
84
+ _: 3
85
+ }));
86
+ }
87
+ };
88
+ //#endregion
89
+ export { v as n, _ as t };
@@ -0,0 +1,45 @@
1
+ import { computed as e, createElementBlock as t, defineComponent as n, normalizeClass as r, openBlock as i, renderSlot as a } from "vue";
2
+ //#endregion
3
+ //#region src/components/SwButton.vue
4
+ var o = /* @__PURE__ */ n({
5
+ __name: "SwButton",
6
+ props: {
7
+ class: { default: "" },
8
+ size: { default: "" },
9
+ type: { default: "" },
10
+ round: {
11
+ type: Boolean,
12
+ default: !1
13
+ },
14
+ text: {
15
+ type: Boolean,
16
+ default: !1
17
+ },
18
+ link: {
19
+ type: Boolean,
20
+ default: !1
21
+ },
22
+ href: { default: "" },
23
+ disabled: {
24
+ type: Boolean,
25
+ default: !1
26
+ }
27
+ },
28
+ setup(n) {
29
+ let o = n, s = () => {
30
+ if (o.href.length > 0) {
31
+ let e = document.createElement("a");
32
+ e.setAttribute("href", o.href), e.setAttribute("target", "_blank"), o.disabled || e.click();
33
+ }
34
+ }, c = e(() => {
35
+ let e = ["sw-button"];
36
+ return o.size.length > 0 && e.push("sw-" + o.size), o.type.length > 0 && e.push("sw-" + o.type), o.round && e.push("sw-round"), o.text && e.push("sw-text"), o.link && e.push("sw-link"), o.disabled && e.push("sw-disabled"), o.class.length > 0 && e.push(o.class), e;
37
+ });
38
+ return (e, n) => (i(), t("button", {
39
+ class: r(c.value),
40
+ onClick: s
41
+ }, [a(e.$slots, "default")], 2));
42
+ }
43
+ });
44
+ //#endregion
45
+ export { o as default };
@@ -0,0 +1,59 @@
1
+ import { computed as e, createElementBlock as t, mergeModels as n, normalizeClass as r, onMounted as i, onUnmounted as a, openBlock as o, ref as s, renderSlot as c, useModel as l, watch as u } from "vue";
2
+ //#region src/components/SwButtonGroup.vue
3
+ var d = {
4
+ __name: "SwButtonGroup",
5
+ props: /* @__PURE__ */ n({
6
+ class: {
7
+ type: String,
8
+ default: ""
9
+ },
10
+ vertical: {
11
+ type: Boolean,
12
+ default: !1
13
+ },
14
+ radio: {
15
+ type: Boolean,
16
+ default: !1
17
+ },
18
+ round: {
19
+ type: Boolean,
20
+ default: !1
21
+ }
22
+ }, {
23
+ modelValue: {},
24
+ modelModifiers: {}
25
+ }),
26
+ emits: ["update:modelValue"],
27
+ setup(n) {
28
+ let d = l(n, "modelValue"), f = s([]), p = s(null), m = s(null), h = n, g = e(() => {
29
+ let e = ["sw-button-group"];
30
+ return h.vertical && e.push("sw-vertical"), h.round && e.push("sw-round"), h.class.length > 0 && e.push(h.class), e;
31
+ });
32
+ i(async () => {
33
+ await new Promise((e) => setTimeout(e, 0)), h.radio && _(), p.value && (m.value = new MutationObserver(() => {
34
+ h.radio && _();
35
+ }), m.value.observe(p.value, {
36
+ childList: !0,
37
+ subtree: !0
38
+ }));
39
+ }), a(() => {
40
+ m.value && m.value.disconnect();
41
+ }), u(d, () => {
42
+ h.radio && [].forEach.call(f.value, (e, t) => {
43
+ t === d.value ? e.classList.remove("sw-text") : e.classList.add("sw-text");
44
+ });
45
+ });
46
+ let _ = () => {
47
+ f.value = [], p.value && (f.value = p.value.querySelectorAll("button, .sw-button")), h.radio && [].forEach.call(f.value, (e, t) => {
48
+ d.value === t ? e.classList.remove("sw-text") : e.classList.add("sw-text"), e.addEventListener("click", () => d.value = t);
49
+ });
50
+ };
51
+ return (e, n) => (o(), t("div", {
52
+ class: r(g.value),
53
+ ref_key: "buttonGroup",
54
+ ref: p
55
+ }, [c(e.$slots, "default")], 2));
56
+ }
57
+ };
58
+ //#endregion
59
+ export { d as default };
@@ -0,0 +1,31 @@
1
+ import { createElementBlock as e, normalizeClass as t, normalizeStyle as n, onBeforeUnmount as r, onMounted as i, openBlock as a, ref as o, renderSlot as s, watch as c } from "vue";
2
+ //#region src/components/SwCollapse.vue
3
+ var l = {
4
+ __name: "SwCollapse",
5
+ props: { visual: {
6
+ type: Boolean,
7
+ default: !0
8
+ } },
9
+ setup(l) {
10
+ i(() => {
11
+ f.value = "0px";
12
+ });
13
+ let u = o(null), d = l;
14
+ c(() => d.visual, () => p());
15
+ let f = o("0px"), p = () => {
16
+ u.value && (f.value = d.visual ? u.value.scrollHeight + "px" : "0px");
17
+ }, m;
18
+ return i(() => {
19
+ p(), u.value && (m = new ResizeObserver(p), m.observe(u.value));
20
+ }), r(() => {
21
+ m && m.disconnect();
22
+ }), (r, i) => (a(), e("div", {
23
+ class: t(["sw-collapse", { open: d.visual }]),
24
+ style: n({ maxHeight: f.value }),
25
+ ref_key: "collapse",
26
+ ref: u
27
+ }, [s(r.$slots, "default")], 6));
28
+ }
29
+ };
30
+ //#endregion
31
+ export { l as default };
@@ -0,0 +1,262 @@
1
+ import { a as e, i as t } from "./utils-CGgSSFR1.js";
2
+ import { Fragment as n, computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, normalizeClass as c, openBlock as l, ref as u, renderList as d, renderSlot as f, toDisplayString as p, unref as m, withModifiers as h } from "vue";
3
+ //#region src/components/SwDatePicker.vue
4
+ var ee = { class: "sw-data-picker" }, g = {
5
+ key: 0,
6
+ class: "month_year"
7
+ }, _ = { class: "text" }, v = {
8
+ key: 1,
9
+ class: "month_year"
10
+ }, y = { class: "text" }, b = {
11
+ key: 2,
12
+ class: "week"
13
+ }, x = {
14
+ key: 3,
15
+ class: "year"
16
+ }, S = ["onClick"], C = {
17
+ key: 4,
18
+ class: "year"
19
+ }, w = ["onClick"], te = {
20
+ key: 5,
21
+ class: "month"
22
+ }, ne = ["onClick"], re = { key: 0 }, ie = {
23
+ key: 0,
24
+ class: "month_year"
25
+ }, ae = { class: "text" }, oe = {
26
+ key: 1,
27
+ class: "month_year"
28
+ }, se = { class: "text" }, ce = {
29
+ key: 2,
30
+ class: "week"
31
+ }, le = {
32
+ key: 3,
33
+ class: "year"
34
+ }, T = ["onClick"], E = {
35
+ key: 4,
36
+ class: "year"
37
+ }, ue = ["onClick"], D = {
38
+ key: 5,
39
+ class: "month"
40
+ }, O = ["onClick"], k = {
41
+ __name: "SwDatePicker",
42
+ props: {
43
+ data: Object,
44
+ limitation: {
45
+ type: [Boolean, Array],
46
+ default: () => !1
47
+ },
48
+ range: {
49
+ type: String,
50
+ default: "solid"
51
+ }
52
+ },
53
+ emits: ["input"],
54
+ setup(k, { emit: de }) {
55
+ let A = k, j = de, M = u(5), N = u(/* @__PURE__ */ new Date()), P = u(/* @__PURE__ */ new Date()), F = u((/* @__PURE__ */ new Date()).getFullYear()), I = u((/* @__PURE__ */ new Date()).getMonth()), L = u((/* @__PURE__ */ new Date()).getFullYear()), R = u((/* @__PURE__ */ new Date()).getMonth()), z = u(new Date(F.value, I.value + 1, 1).getMonth()), B = u([]), V = u(0), H = u(-1), U = u(-1), W = u(navigator.language || "ru"), G = /en|zh|ja|he/.test(W.value) ? 0 : 1, K = r(() => Array.from({ length: 12 }, (e, t) => {
56
+ let n = new Date(2024, t);
57
+ return new Intl.DateTimeFormat(W.value, { month: "long" }).format(n);
58
+ })), q = u(Math.floor(F.value / 10) * 10), J = r(() => Array.from({ length: 12 }, (e, t) => q.value + t - 1));
59
+ A.data?.startDate ? (N.value = new Date(t(A.data.startDate)), F.value = N.value.getFullYear(), I.value = N.value.getMonth()) : A.data?.firstDate && (F.value = new Date(t(A.data.firstDate)).getFullYear(), I.value = new Date(t(A.data.firstDate)).getMonth(), z.value = new Date(F.value, I.value + 1, 1).getMonth()), A.data?.endDate && A.range === "range" && (P.value = new Date(t(A.data.endDate)), L.value = P.value.getFullYear(), R.value = P.value.getMonth());
60
+ let Y = () => {
61
+ B.value = [], V.value = 0;
62
+ let e = new Date(F.value, I.value, 0);
63
+ for (let t = e.getDate() - e.getDay() + G; t <= e.getDate(); t++) e.getDay() !== 6 + G && (B.value.push({
64
+ day: t,
65
+ month: e.getMonth(),
66
+ year: e.getFullYear(),
67
+ class: []
68
+ }), V.value++);
69
+ let t = new Date(F.value, I.value + 1, 0).getDate();
70
+ for (let e = 1; e <= t; e++) B.value.push({
71
+ day: e,
72
+ month: I.value,
73
+ year: F.value,
74
+ class: []
75
+ }), V.value++;
76
+ if (A.range === "range") {
77
+ let e = new Date(F.value, I.value + 1, 1), t = new Date(F.value, I.value + 2, 0).getDate();
78
+ for (let n = 1; n <= t; n++) B.value.push({
79
+ day: n,
80
+ month: e.getMonth(),
81
+ year: e.getFullYear(),
82
+ class: []
83
+ });
84
+ }
85
+ fe();
86
+ }, fe = () => {
87
+ if (!A.data?.holiday) return;
88
+ let e = (e, t) => {
89
+ e.forEach((e) => {
90
+ let [n, r, i] = e.split("-").map(Number), a = B.value.findIndex((e) => e.year === n && e.month + 1 === r && e.day === i);
91
+ a !== -1 && (B.value[a].class[0] = t);
92
+ });
93
+ };
94
+ e(A.data.holiday.preholidays, "preholiday"), e(A.data.holiday.holidays, "weekend"), e(A.data.holiday.holiday, "holiday"), e(A.data.holiday.nowork, "nowork");
95
+ }, pe = () => {
96
+ if (!A.limitation || A.limitation.length < 2) return !1;
97
+ let e = [...A.limitation].sort((e, n) => new Date(t(e.startDate)).getTime() - new Date(t(n.startDate)).getTime());
98
+ for (let n = 1; n < e.length; n++) {
99
+ let r = new Date(t(e[n - 1].endDate));
100
+ if (new Date(t(e[n].startDate)) <= r) return console.warn("Warning: Диапазоны пересекаются:", e[n - 1], e[n]), !0;
101
+ }
102
+ return !1;
103
+ }, X = (e, n, r) => {
104
+ if (!A.limitation || A.limitation.length === 0) return !0;
105
+ let i = new Date(e, n, r).getTime();
106
+ for (let e of A.limitation) {
107
+ let { startDate: n, endDate: r } = e;
108
+ if (!n && r && i <= new Date(t(r)).getTime() || n && !r && i >= new Date(t(n)).getTime()) return !1;
109
+ if (n && r) {
110
+ let e = new Date(t(n)).getTime(), a = new Date(t(r)).getTime();
111
+ if (e <= a) {
112
+ if (i >= e && i <= a) return !1;
113
+ } else if (i >= e || i <= a) return !1;
114
+ }
115
+ }
116
+ return !0;
117
+ }, Z = (t, n) => {
118
+ let r = e(new Date(t.year, t.month, t.day), "{dd}.{m}.{Y}");
119
+ A.range === "range" ? U.value === -1 ? H.value === -1 ? (H.value = n, B.value[n].class[1] = "active") : (U.value = n, he(H.value, U.value, r)) : (me(), H.value = n, B.value[n].class[1] = "active") : (H.value !== -1 && (B.value[H.value].class[1] = ""), H.value = n, B.value[n].class[1] = "active", j("input", {
120
+ dateStart: r,
121
+ count: 1
122
+ }));
123
+ }, me = () => {
124
+ B.value.forEach((e) => e.class[1] = ""), H.value = -1, U.value = -1;
125
+ }, he = (t, n, r) => {
126
+ let i = e(new Date(B.value[t].year, B.value[t].month, B.value[t].day), "{dd}.{m}.{Y}");
127
+ if (n >= t) {
128
+ for (let e = t + 1; e < n; e++) B.value[e].class[1] = "select";
129
+ j("input", {
130
+ dateStart: i,
131
+ dateEnd: r,
132
+ count: Q(t, n)
133
+ });
134
+ } else {
135
+ for (let e = n + 1; e < t; e++) B.value[e].class[1] = "select";
136
+ j("input", {
137
+ dateStart: r,
138
+ dateEnd: i,
139
+ count: Q(n, t)
140
+ });
141
+ }
142
+ B.value[n].class[1] = "active";
143
+ }, Q = (e, t) => {
144
+ let n = Math.abs(e - t) + 1, [r, i] = [Math.min(e, t), Math.max(e, t)];
145
+ for (let e = r; e <= i; e++) B.value[e]?.class[0] === "holiday" && n--;
146
+ return n;
147
+ }, $ = (e, t) => {
148
+ X(e, t) && (N.value = new Date(e, t, 1), F.value = N.value.getFullYear(), I.value = N.value.getMonth(), z.value = new Date(e, t + 1, 1).getMonth(), (A.range === "year" || A.range === "decades") && M.value === 0 ? Z({
149
+ year: e,
150
+ month: t,
151
+ day: 1
152
+ }, 8) : Y());
153
+ };
154
+ if (Y(), pe(), A.data?.startDate && (H.value = B.value.findIndex((e) => e.day === N.value.getDate() && e.month === I.value && e.year === F.value), H.value !== -1 && (B.value[H.value].class[1] = "active")), A.data?.endDate && A.range === "range" && (U.value = B.value.findIndex((e) => e.day === P.value.getDate() && e.month === R.value && e.year === L.value), U.value !== -1)) {
155
+ B.value[U.value].class[1] = "active";
156
+ for (let e = H.value + 1; e < U.value; e++) B.value[e].class[1] = "select";
157
+ }
158
+ return (t, r) => (l(), a("div", ee, [o("div", null, [
159
+ A.range === "decades" || M.value === 3 ? (l(), a("p", g, [
160
+ o("span", null, [o("button", { onClick: r[0] ||= h((e) => {
161
+ q.value -= 10, $(F.value, I.value);
162
+ }, ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[16] ||= s("«", -1)])])]),
163
+ o("span", _, p(J.value[0]) + " - " + p(J.value[11]), 1),
164
+ o("span", null, [o("button", {
165
+ class: "sw-revers",
166
+ onClick: r[1] ||= h((e) => {
167
+ q.value += 10, $(F.value, I.value);
168
+ }, ["prevent"])
169
+ }, [f(t.$slots, "double-arrow", {}, () => [r[17] ||= s("«", -1)])])])
170
+ ])) : (l(), a("p", v, [
171
+ o("span", null, [o("button", { onClick: r[2] ||= h((e) => $(F.value - 1, I.value), ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[18] ||= s("«", -1)])]), o("button", { onClick: r[3] ||= h((e) => {
172
+ M.value = 0, $(F.value, I.value - 1);
173
+ }, ["prevent"]) }, [f(t.$slots, "arrow", {}, () => [r[19] ||= s("‹", -1)])])]),
174
+ o("span", y, [o("button", { onClick: r[4] ||= h((e) => M.value = 3, ["prevent"]) }, p(F.value), 1), o("button", { onClick: r[5] ||= h((e) => M.value = 1, ["prevent"]) }, p(m(e)(N.value.setMonth(I.value), "{F}")), 1)]),
175
+ o("span", null, [o("button", {
176
+ class: "sw-revers",
177
+ onClick: r[6] ||= h((e) => {
178
+ M.value = 0, $(F.value, I.value + 1);
179
+ }, ["prevent"])
180
+ }, [f(t.$slots, "arrow", {}, () => [r[20] ||= s("‹", -1)])]), o("button", {
181
+ class: "sw-revers",
182
+ onClick: r[7] ||= h((e) => $(F.value + 1, I.value), ["prevent"])
183
+ }, [f(t.$slots, "double-arrow", {}, () => [r[21] ||= s("«", -1)])])])
184
+ ])),
185
+ A.range === "year" || A.range === "decades" || M.value === 1 || M.value === 3 ? i("", !0) : (l(), a("div", b, [(l(), a(n, null, d(7, (t, n) => o("button", {
186
+ key: n,
187
+ class: "disabled"
188
+ }, p(m(e)(new Date(1970, 1, t + m(G)), "{D}")), 1)), 64))])),
189
+ M.value !== 3 && A.range === "year" || M.value === 1 ? (l(), a("div", x, [(l(!0), a(n, null, d(K.value, (e, t) => (l(), a("button", {
190
+ key: t,
191
+ onClick: h((e) => {
192
+ M.value = 0, $(F.value, t);
193
+ }, ["prevent"]),
194
+ class: c(t === I.value ? "active" : "")
195
+ }, p(e), 11, S))), 128))])) : A.range === "decades" || M.value === 3 ? (l(), a("div", C, [(l(!0), a(n, null, d(J.value, (e, t) => (l(), a("button", {
196
+ key: t,
197
+ onClick: h((t) => {
198
+ M.value = A.range === "year" ? 1 : 0, $(e, I.value);
199
+ }, ["prevent"]),
200
+ class: c(q.value + t - 1 === F.value ? "active" : "")
201
+ }, p(e), 11, w))), 128))])) : (l(), a("div", te, [(l(!0), a(n, null, d(B.value, (e, t) => (l(), a(n, { key: t }, [t < V.value + (7 - new Date(F.value, I.value + 1, 1).getDay() + m(G)) % 7 ? (l(), a("button", {
202
+ key: 0,
203
+ class: c(e.month === I.value && X(e.year, e.month, e.day) ? e.class : "disabled"),
204
+ onClick: h(() => {
205
+ e.month === I.value && Z(e, t);
206
+ }, ["prevent"])
207
+ }, p(e.day), 11, ne)) : i("", !0)], 64))), 128))]))
208
+ ]), A.range === "range" ? (l(), a("div", re, [
209
+ A.range === "decades" || M.value === 4 ? (l(), a("p", ie, [
210
+ o("span", null, [o("button", { onClick: r[8] ||= h((e) => {
211
+ q.value -= 10, $(F.value, I.value);
212
+ }, ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[22] ||= s("«", -1)])])]),
213
+ o("span", ae, p(J.value[0]) + " - " + p(J.value[11]), 1),
214
+ o("span", null, [o("button", {
215
+ class: "sw-revers",
216
+ onClick: r[9] ||= h((e) => {
217
+ q.value += 10, $(F.value, I.value);
218
+ }, ["prevent"])
219
+ }, [f(t.$slots, "double-arrow", {}, () => [r[23] ||= s("«", -1)])])])
220
+ ])) : (l(), a("p", oe, [
221
+ o("span", null, [o("button", { onClick: r[10] ||= h((e) => $(F.value - 1, I.value), ["prevent"]) }, [f(t.$slots, "double-arrow", {}, () => [r[24] ||= s("«", -1)])]), o("button", { onClick: r[11] ||= h((e) => {
222
+ M.value = 0, $(F.value, I.value - 1);
223
+ }, ["prevent"]) }, [f(t.$slots, "arrow", {}, () => [r[25] ||= s("‹", -1)])])]),
224
+ o("span", se, [o("button", { onClick: r[12] ||= h((e) => M.value = 4, ["prevent"]) }, p(new Date(F.value, I.value + 1).getFullYear()), 1), o("button", { onClick: r[13] ||= h((e) => M.value = 2, ["prevent"]) }, p(m(e)(N.value.setMonth(I.value + 1), "{F}")), 1)]),
225
+ o("span", null, [o("button", {
226
+ class: "sw-revers",
227
+ onClick: r[14] ||= h((e) => {
228
+ M.value = 0, $(F.value, I.value + 1);
229
+ }, ["prevent"])
230
+ }, [f(t.$slots, "arrow", {}, () => [r[26] ||= s("‹", -1)])]), o("button", {
231
+ class: "sw-revers",
232
+ onClick: r[15] ||= h((e) => $(F.value + 1, I.value), ["prevent"])
233
+ }, [f(t.$slots, "double-arrow", {}, () => [r[27] ||= s("«", -1)])])])
234
+ ])),
235
+ M.value === 2 || M.value === 4 ? i("", !0) : (l(), a("div", ce, [(l(), a(n, null, d(7, (t, n) => o("button", {
236
+ key: n,
237
+ class: "disabled"
238
+ }, p(m(e)(new Date(1970, 1, t + m(G)), "{D}")), 1)), 64))])),
239
+ M.value === 2 ? (l(), a("div", le, [(l(!0), a(n, null, d(K.value, (e, t) => (l(), a("button", {
240
+ key: t,
241
+ onClick: h((e) => {
242
+ M.value = 0, $(F.value, t - 1);
243
+ }, ["prevent"]),
244
+ class: c(t === (I.value + 1) % 12 ? "active" : "")
245
+ }, p(e), 11, T))), 128))])) : M.value === 4 ? (l(), a("div", E, [(l(!0), a(n, null, d(J.value, (e, t) => (l(), a("button", {
246
+ key: t,
247
+ onClick: h((t) => {
248
+ M.value = 0, $(e, I.value);
249
+ }, ["prevent"]),
250
+ class: c(q.value + t - 1 === F.value ? "active" : "")
251
+ }, p(e), 11, ue))), 128))])) : (l(), a("div", D, [(l(!0), a(n, null, d(B.value, (e, t) => (l(), a(n, { key: t }, [t >= V.value - (7 + new Date(F.value, I.value + 1, 1).getDay() - m(G)) % 7 ? (l(), a("button", {
252
+ key: 0,
253
+ class: c(e.month === z.value && X(e.year, e.month, e.day) ? e.class : "disabled"),
254
+ onClick: h(() => {
255
+ e.month === z.value && Z(e, t);
256
+ }, ["prevent"])
257
+ }, p(e.day), 11, O)) : i("", !0)], 64))), 128))]))
258
+ ])) : i("", !0)]));
259
+ }
260
+ };
261
+ //#endregion
262
+ export { k as default };
@@ -0,0 +1,114 @@
1
+ import { Teleport as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, mergeModels as a, normalizeClass as o, normalizeStyle as s, onMounted as c, onUnmounted as l, openBlock as u, ref as d, renderSlot as f, unref as p, useModel as m, watchEffect as h, withModifiers as g } from "vue";
2
+ //#region src/components/SwDropdown.vue
3
+ var _ = ["id"], v = {
4
+ __name: "SwDropdown",
5
+ props: /* @__PURE__ */ a({
6
+ class: {
7
+ type: String,
8
+ default: ""
9
+ },
10
+ size: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ type: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ trigger: {
19
+ type: String,
20
+ default: "click"
21
+ },
22
+ placement: {
23
+ type: String,
24
+ default: "bottom-left"
25
+ },
26
+ maxWidth: {
27
+ type: Number,
28
+ default: 0
29
+ }
30
+ }, {
31
+ modelValue: {},
32
+ modelModifiers: {}
33
+ }),
34
+ emits: ["update:modelValue"],
35
+ setup(a, { expose: v }) {
36
+ let y = a, b = m(a, "modelValue"), x = d(null), S = d(null), C = d({}), w = Math.ceil(Math.random() * 1e3), T = d(0), E = t(() => {
37
+ let e = ["sw-dropdown"];
38
+ return y.size.length > 0 && e.push("sw-" + y.size), y.type.length > 0 && e.push("sw-" + y.type), e;
39
+ }), D = new ResizeObserver(() => {
40
+ b.value && T.value++, T.value > 99 && (T.value = 1);
41
+ });
42
+ h(() => {
43
+ if (!b.value || !S.value || !x.value) return;
44
+ T.value < 2 && D.observe(S.value);
45
+ let e = window.pageYOffset || document.documentElement.scrollTop, t = window.pageXOffset || document.documentElement.scrollLeft;
46
+ document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = `-${t}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = e, document.documentElement.scrollLeft = t;
47
+ let n = x.value.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = S.value.offsetHeight, o = S.value.offsetWidth, s = n.left + n.width / 2 + t, c = n.top + n.height / 2 + e, l = n.height / 2 + 8, [u, d] = y.placement.split("-", 2);
48
+ switch (u) {
49
+ case "bottom":
50
+ c = e + i - a - l - 8 < c ? c - l - a : c + l, d === void 0 && (s -= o / 2);
51
+ break;
52
+ case "top":
53
+ c = e + a + l + 8 > c ? c + l : c - l - a, d === void 0 && (s -= o / 2);
54
+ break;
55
+ case "left":
56
+ s - o - n.width / 2 - 8 < 0 ? s + n.width / 2 + 8 + o < r ? (s = s + n.width / 2 + 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s = s + n.width / 2 < r ? s + n.width / 2 - o : s - o / 2) : (s = s - o - n.width / 2 - 8, c -= a / 2);
57
+ break;
58
+ case "right":
59
+ s + n.width / 2 + 8 + o > r ? s - o - n.width / 2 - 8 > 0 ? (s = s - o - n.width / 2 - 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s -= n.width / 2) : (s = s + n.width / 2 + 8, c -= a / 2);
60
+ break;
61
+ }
62
+ switch (d) {
63
+ case "left":
64
+ s = t + r - 8 > s - n.width / 2 + o ? s - n.width / 2 : s - o + n.width / 2;
65
+ break;
66
+ case "right":
67
+ s = 8 < s + n.width / 2 - o ? s - o + n.width / 2 : s - n.width / 2;
68
+ break;
69
+ }
70
+ s < 0 && (s = 0), c < 0 && (c = 0), C.value = {
71
+ position: "absolute",
72
+ top: `${c}px`,
73
+ left: `${s}px`,
74
+ maxWidth: y.maxWidth > 0 ? `${y.maxWidth}px` : ""
75
+ };
76
+ }, { flush: "post" });
77
+ let O = () => {
78
+ y.trigger === "click" && (b.value = !b.value);
79
+ }, k = () => {
80
+ y.trigger === "hover" && (b.value = !b.value);
81
+ }, A = () => {
82
+ y.trigger === "context" && (b.value = !b.value);
83
+ }, j = () => {
84
+ b.value && T.value++, T.value > 99 && (T.value = 1);
85
+ };
86
+ v({ handleResize: j });
87
+ let M = (e) => {
88
+ y.trigger !== "none" && !e.target.closest(`[id="${w}"]`) && x.value && !x.value.contains(e.target) && (b.value = !1);
89
+ };
90
+ return c(() => {
91
+ window.addEventListener("resize", j), document.documentElement.ontouchstart === void 0 ? document.documentElement.addEventListener("click", M, !0) : document.documentElement.addEventListener("touchstart", M, !0), window.onscrollend === void 0 ? window.addEventListener("scroll", j) : window.addEventListener("scrollend", j);
92
+ }), l(() => {
93
+ D.disconnect(), window.removeEventListener("resize", j), document.documentElement.ontouchstart === void 0 ? document.documentElement.removeEventListener("click", M) : document.documentElement.removeEventListener("touchstart", M), window.onscrollend === void 0 ? window.removeEventListener("scroll", j) : window.removeEventListener("scrollend", j);
94
+ }), (t, a) => (u(), i("div", {
95
+ class: o(E.value),
96
+ onClick: a[0] ||= (e) => O(),
97
+ onMouseover: a[1] ||= g((e) => k(), ["stop"]),
98
+ onMouseleave: a[2] ||= g((e) => k(), ["stop"]),
99
+ onContextmenu: a[3] ||= g((e) => A(), ["stop"]),
100
+ ref_key: "dropdownRef",
101
+ ref: x
102
+ }, [f(t.$slots, "default"), (u(), n(e, { to: "body" }, [b.value ? (u(), i("ul", {
103
+ key: 0,
104
+ ref_key: "popupRef",
105
+ ref: S,
106
+ id: p(w),
107
+ class: o(["sw-dropdown-popup", y.class]),
108
+ style: s(C.value),
109
+ tabindex: "-1"
110
+ }, [f(t.$slots, "dropdown")], 14, _)) : r("", !0)]))], 34));
111
+ }
112
+ };
113
+ //#endregion
114
+ export { v as default };
@@ -0,0 +1,36 @@
1
+ import { n as e } from "./SwIcon-0PtPyq2k.js";
2
+ import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, normalizeClass as a, openBlock as o, renderSlot as s } from "vue";
3
+ //#region src/components/SwDropdownItem.vue
4
+ var c = {
5
+ __name: "SwDropdownItem",
6
+ props: {
7
+ class: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ size: {
12
+ type: String,
13
+ default: ""
14
+ },
15
+ type: {
16
+ type: String,
17
+ default: ""
18
+ },
19
+ iconBefore: {
20
+ type: String,
21
+ default: ""
22
+ }
23
+ },
24
+ setup(c) {
25
+ let l = c, u = t(() => {
26
+ let e = ["sw-dropdown-item"];
27
+ return l.size.length > 0 && e.push("sw-" + l.size), l.type.length > 0 && e.push("sw-" + l.type), l.class.length > 0 && e.push(l.class), e;
28
+ });
29
+ return (t, l) => (o(), i("li", { class: a(u.value) }, [c.iconBefore.length > 0 ? (o(), n(e, {
30
+ key: 0,
31
+ "icon-class": c.iconBefore
32
+ }, null, 8, ["icon-class"])) : r("", !0), s(t.$slots, "default")], 2));
33
+ }
34
+ };
35
+ //#endregion
36
+ export { c as default };