@studio-west/employees 0.6.54 → 0.6.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SheetTable.cjs +1 -1
- package/dist/SheetTable.js +2 -3
- package/dist/SwButton-85-tKHA7-BpZ2q9aj.cjs +1 -0
- package/dist/SwButton-85-tKHA7-D0loTJgt.js +33 -0
- package/dist/SwCollapse-CuN3EbT6-1y2PMRQ8.cjs +1 -0
- package/dist/SwCollapse-CuN3EbT6-Bp57Ya_9.js +33 -0
- package/dist/SwDatePicker-C-UmCyTm-CTOiwZL1.cjs +1 -0
- package/dist/SwDatePicker-C-UmCyTm-Co9VaGQR.js +369 -0
- package/dist/SwDropdown-DQGTnnKw-BltvlnsL.cjs +1 -0
- package/dist/SwDropdown-DQGTnnKw-CJPDuCfV.js +111 -0
- package/dist/SwDropdownItem-Db2TXRVI-BcLri1T3.js +31 -0
- package/dist/SwDropdownItem-Db2TXRVI-DHp91ADz.cjs +1 -0
- package/dist/SwDropdownNew-CYfjZFd2-DIv6p-6i.cjs +1 -0
- package/dist/SwDropdownNew-CYfjZFd2-nlDq08DL.js +107 -0
- package/dist/SwFormItem-CaA4jsoa-6C3zw4iZ.js +24 -0
- package/dist/SwFormItem-CaA4jsoa-MFTEfPiY.cjs +1 -0
- package/dist/SwGide-Bv05X9FW-BTqybd7p.cjs +1 -0
- package/dist/SwGide-Bv05X9FW-XUYykhog.js +145 -0
- package/dist/SwInput-B1hD3QYw-DaqUVUBC.cjs +1 -0
- package/dist/SwInput-B1hD3QYw-zCu7Xl3k.js +91 -0
- package/dist/SwMessage-D24ZbJyd-B0sGfA92.js +60 -0
- package/dist/SwMessage-D24ZbJyd-hmjlb3jg.cjs +1 -0
- package/dist/SwSection-D8ooQ21I-DkmOwvIl.js +37 -0
- package/dist/SwSection-D8ooQ21I-Nsa_5V1p.cjs +1 -0
- package/dist/SwSelect-C2RKinez-BD70YvFF.js +71 -0
- package/dist/SwSelect-C2RKinez-KweWYzRe.cjs +1 -0
- package/dist/SwSkeleton-B7ysp8L9-DnocmEnE.js +26 -0
- package/dist/SwSkeleton-B7ysp8L9-RJwRbv_K.cjs +1 -0
- package/dist/SwSkeletonItem-CU7LvihY-BJmW7U8Z.cjs +1 -0
- package/dist/SwSkeletonItem-CU7LvihY-DdKyY6kY.js +29 -0
- package/dist/SwSlider-B8ah3WJf-DFs0WIbH.js +160 -0
- package/dist/SwSlider-B8ah3WJf-eotQC_I3.cjs +1 -0
- package/dist/SwSwitch-6rl1IT4p-BQTT__wH.cjs +1 -0
- package/dist/SwSwitch-6rl1IT4p-Cq2vi3fZ.js +47 -0
- package/dist/SwTable-BKZ5idCi-BMDZ1otG.cjs +1 -0
- package/dist/SwTable-BKZ5idCi-DEX2rFo2.js +152 -0
- package/dist/SwTableColumn-BLF5bPuJ-CHI10OyO.js +28 -0
- package/dist/SwTableColumn-BLF5bPuJ-CbuAoznO.cjs +1 -0
- package/dist/SwTabs-DkSI4oAh-By6KQ_XO.cjs +1 -0
- package/dist/SwTabs-DkSI4oAh-VaIFmFrU.js +38 -0
- package/dist/SwTabsPane-Dwtj8g7T-BUCrffEQ.cjs +1 -0
- package/dist/SwTabsPane-Dwtj8g7T-Dpg9j8nR.js +38 -0
- package/dist/VacationTable-3jJUSDHf.cjs +1 -0
- package/dist/VacationTable-GeJlpGuk.js +839 -0
- package/dist/VacationTable.cjs +1 -1
- package/dist/VacationTable.js +9 -726
- package/dist/WorkTable.cjs +4 -4
- package/dist/WorkTable.js +50 -50
- package/dist/employees.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { ref as D, computed as ee, createElementBlock as s, openBlock as o, createElementVNode as r, createCommentVNode as z, withModifiers as d, renderSlot as m, createTextVNode as p, toDisplayString as h, unref as Y, Fragment as C, renderList as x, normalizeClass as I } from "vue";
|
|
2
|
+
import { U as k, L as N } from "./VacationTable-GeJlpGuk.js";
|
|
3
|
+
const re = { class: "sw-data-picker" }, se = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "month_year"
|
|
6
|
+
}, oe = { class: "text" }, ce = {
|
|
7
|
+
key: 1,
|
|
8
|
+
class: "month_year"
|
|
9
|
+
}, ie = { class: "text" }, de = {
|
|
10
|
+
key: 2,
|
|
11
|
+
class: "week"
|
|
12
|
+
}, ye = {
|
|
13
|
+
key: 3,
|
|
14
|
+
class: "year"
|
|
15
|
+
}, ge = ["onClick"], he = {
|
|
16
|
+
key: 4,
|
|
17
|
+
class: "year"
|
|
18
|
+
}, De = ["onClick"], we = {
|
|
19
|
+
key: 5,
|
|
20
|
+
class: "month"
|
|
21
|
+
}, me = ["onClick"], pe = { key: 0 }, ke = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "month_year"
|
|
24
|
+
}, fe = { class: "text" }, be = {
|
|
25
|
+
key: 1,
|
|
26
|
+
class: "month_year"
|
|
27
|
+
}, Ce = { class: "text" }, Me = {
|
|
28
|
+
key: 2,
|
|
29
|
+
class: "week"
|
|
30
|
+
}, $e = {
|
|
31
|
+
key: 3,
|
|
32
|
+
class: "year"
|
|
33
|
+
}, Fe = ["onClick"], Ye = {
|
|
34
|
+
key: 4,
|
|
35
|
+
class: "year"
|
|
36
|
+
}, xe = ["onClick"], Te = {
|
|
37
|
+
key: 5,
|
|
38
|
+
class: "month"
|
|
39
|
+
}, Se = ["onClick"], Ie = {
|
|
40
|
+
__name: "SwDatePicker",
|
|
41
|
+
props: {
|
|
42
|
+
data: Object,
|
|
43
|
+
limitation: {
|
|
44
|
+
type: [Boolean, Array],
|
|
45
|
+
default: () => !1
|
|
46
|
+
},
|
|
47
|
+
range: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "solid"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
emits: ["input"],
|
|
53
|
+
setup(ae, { emit: te }) {
|
|
54
|
+
var R, U, Z, Q, X;
|
|
55
|
+
const n = ae, L = te, i = D(5), M = D(/* @__PURE__ */ new Date()), A = D(/* @__PURE__ */ new Date()), v = D((/* @__PURE__ */ new Date()).getFullYear()), u = D((/* @__PURE__ */ new Date()).getMonth()), W = D((/* @__PURE__ */ new Date()).getFullYear()), q = D((/* @__PURE__ */ new Date()).getMonth()), B = D(new Date(v.value, u.value + 1, 1).getMonth()), c = D([]), V = D(0), w = D(-1), F = D(-1), G = D(navigator.language || "ru"), S = /en|zh|ja|he/.test(G.value) ? 0 : 1, H = ee(() => Array.from({ length: 12 }, (t, e) => {
|
|
56
|
+
const a = new Date(2024, e);
|
|
57
|
+
return new Intl.DateTimeFormat(G.value, { month: "long" }).format(a);
|
|
58
|
+
})), T = D(Math.floor(v.value / 10) * 10), _ = ee(() => Array.from({ length: 12 }, (t, e) => T.value + e - 1));
|
|
59
|
+
(R = n.data) != null && R.startDate ? (M.value = new Date(k(n.data.startDate)), v.value = M.value.getFullYear(), u.value = M.value.getMonth()) : (U = n.data) != null && U.firstDate && (v.value = new Date(k(n.data.firstDate)).getFullYear(), u.value = new Date(k(n.data.firstDate)).getMonth(), B.value = new Date(v.value, u.value + 1, 1).getMonth()), (Z = n.data) != null && Z.endDate && n.range === "range" && (A.value = new Date(k(n.data.endDate)), W.value = A.value.getFullYear(), q.value = A.value.getMonth());
|
|
60
|
+
const J = () => {
|
|
61
|
+
c.value = [], V.value = 0;
|
|
62
|
+
const t = new Date(v.value, u.value, 0);
|
|
63
|
+
for (let a = t.getDate() - t.getDay() + S; a <= t.getDate(); a++)
|
|
64
|
+
t.getDay() !== 6 + S && (c.value.push({ day: a, month: t.getMonth(), year: t.getFullYear(), class: [] }), V.value++);
|
|
65
|
+
const e = new Date(v.value, u.value + 1, 0).getDate();
|
|
66
|
+
for (let a = 1; a <= e; a++)
|
|
67
|
+
c.value.push({ day: a, month: u.value, year: v.value, class: [] }), V.value++;
|
|
68
|
+
if (n.range === "range") {
|
|
69
|
+
const a = new Date(v.value, u.value + 1, 1), l = new Date(v.value, u.value + 2, 0).getDate();
|
|
70
|
+
for (let y = 1; y <= l; y++)
|
|
71
|
+
c.value.push({ day: y, month: a.getMonth(), year: a.getFullYear(), class: [] });
|
|
72
|
+
}
|
|
73
|
+
le();
|
|
74
|
+
}, le = () => {
|
|
75
|
+
var e;
|
|
76
|
+
if (!((e = n.data) != null && e.holiday)) return;
|
|
77
|
+
const t = (a, l) => {
|
|
78
|
+
a.forEach((y) => {
|
|
79
|
+
const [b, f, $] = y.split("-").map(Number), E = c.value.findIndex((P) => P.year === b && P.month + 1 === f && P.day === $);
|
|
80
|
+
E !== -1 && (c.value[E].class[0] = l);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
t(n.data.holiday.preholidays, "preholiday"), t(n.data.holiday.holidays, "weekend"), t(n.data.holiday.holiday, "holiday"), t(n.data.holiday.nowork, "nowork");
|
|
84
|
+
}, ne = () => {
|
|
85
|
+
if (!n.limitation || n.limitation.length < 2) return !1;
|
|
86
|
+
const t = [...n.limitation].sort(
|
|
87
|
+
(e, a) => new Date(k(e.startDate)).getTime() - new Date(k(a.startDate)).getTime()
|
|
88
|
+
);
|
|
89
|
+
for (let e = 1; e < t.length; e++) {
|
|
90
|
+
const a = new Date(k(t[e - 1].endDate));
|
|
91
|
+
if (new Date(k(t[e].startDate)) <= a)
|
|
92
|
+
return console.warn("Warning: Диапазоны пересекаются:", t[e - 1], t[e]), !0;
|
|
93
|
+
}
|
|
94
|
+
return !1;
|
|
95
|
+
}, j = (t, e, a) => {
|
|
96
|
+
if (!n.limitation || n.limitation.length === 0) return !0;
|
|
97
|
+
const l = new Date(t, e, a).getTime();
|
|
98
|
+
for (let y of n.limitation) {
|
|
99
|
+
const { startDate: b, endDate: f } = y;
|
|
100
|
+
if (!b && f) {
|
|
101
|
+
const $ = new Date(k(f)).getTime();
|
|
102
|
+
if (l <= $) return !1;
|
|
103
|
+
}
|
|
104
|
+
if (b && !f) {
|
|
105
|
+
const $ = new Date(k(b)).getTime();
|
|
106
|
+
if (l >= $) return !1;
|
|
107
|
+
}
|
|
108
|
+
if (b && f) {
|
|
109
|
+
const $ = new Date(k(b)).getTime(), E = new Date(k(f)).getTime();
|
|
110
|
+
if ($ <= E) {
|
|
111
|
+
if (l >= $ && l <= E) return !1;
|
|
112
|
+
} else if (l >= $ || l <= E) return !1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return !0;
|
|
116
|
+
}, O = (t, e) => {
|
|
117
|
+
const a = N(new Date(t.year, t.month, t.day), "{dd}.{m}.{Y}");
|
|
118
|
+
n.range === "range" ? F.value !== -1 ? (ue(), w.value = e, c.value[e].class[1] = "active") : w.value !== -1 ? (F.value = e, ve(w.value, F.value, a)) : (w.value = e, c.value[e].class[1] = "active") : (w.value !== -1 && (c.value[w.value].class[1] = ""), w.value = e, c.value[e].class[1] = "active", L("input", { dateStart: a, count: 1 }));
|
|
119
|
+
}, ue = () => {
|
|
120
|
+
c.value.forEach((t) => t.class[1] = ""), w.value = -1, F.value = -1;
|
|
121
|
+
}, ve = (t, e, a) => {
|
|
122
|
+
let l = N(new Date(c.value[t].year, c.value[t].month, c.value[t].day), "{dd}.{m}.{Y}");
|
|
123
|
+
if (e >= t) {
|
|
124
|
+
for (let y = t + 1; y < e; y++)
|
|
125
|
+
c.value[y].class[1] = "select";
|
|
126
|
+
L("input", { dateStart: l, dateEnd: a, count: K(t, e) });
|
|
127
|
+
} else {
|
|
128
|
+
for (let y = e + 1; y < t; y++)
|
|
129
|
+
c.value[y].class[1] = "select";
|
|
130
|
+
L("input", { dateStart: a, dateEnd: l, count: K(e, t) });
|
|
131
|
+
}
|
|
132
|
+
c.value[e].class[1] = "active";
|
|
133
|
+
}, K = (t, e) => {
|
|
134
|
+
var b;
|
|
135
|
+
let a = Math.abs(t - e) + 1, [l, y] = [Math.min(t, e), Math.max(t, e)];
|
|
136
|
+
for (let f = l; f <= y; f++)
|
|
137
|
+
((b = c.value[f]) == null ? void 0 : b.class[0]) === "holiday" && a--;
|
|
138
|
+
return a;
|
|
139
|
+
}, g = (t, e) => {
|
|
140
|
+
j(t, e) && (M.value = new Date(t, e, 1), v.value = M.value.getFullYear(), u.value = M.value.getMonth(), B.value = new Date(t, e + 1, 1).getMonth(), (n.range === "year" || n.range === "decades") && i.value === 0 ? O({ year: t, month: e, day: 1 }, 8) : J());
|
|
141
|
+
};
|
|
142
|
+
if (J(), ne(), (Q = n.data) != null && Q.startDate && (w.value = c.value.findIndex((t) => t.day === M.value.getDate() && t.month === u.value && t.year === v.value), w.value !== -1 && (c.value[w.value].class[1] = "active")), ((X = n.data) == null ? void 0 : X.endDate) && n.range === "range" && (F.value = c.value.findIndex((t) => t.day === A.value.getDate() && t.month === q.value && t.year === W.value), F.value !== -1)) {
|
|
143
|
+
c.value[F.value].class[1] = "active";
|
|
144
|
+
for (let t = w.value + 1; t < F.value; t++)
|
|
145
|
+
c.value[t].class[1] = "select";
|
|
146
|
+
}
|
|
147
|
+
return (t, e) => (o(), s("div", re, [
|
|
148
|
+
r("div", null, [
|
|
149
|
+
n.range === "decades" || i.value === 3 ? (o(), s("p", se, [
|
|
150
|
+
r("span", null, [
|
|
151
|
+
r("button", {
|
|
152
|
+
onClick: e[0] || (e[0] = d((a) => {
|
|
153
|
+
T.value -= 10, g(v.value, u.value);
|
|
154
|
+
}, ["prevent"]))
|
|
155
|
+
}, [
|
|
156
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
157
|
+
e[16] || (e[16] = p("«", -1))
|
|
158
|
+
])
|
|
159
|
+
])
|
|
160
|
+
]),
|
|
161
|
+
r("span", oe, h(_.value[0]) + " - " + h(_.value[11]), 1),
|
|
162
|
+
r("span", null, [
|
|
163
|
+
r("button", {
|
|
164
|
+
class: "sw-revers",
|
|
165
|
+
onClick: e[1] || (e[1] = d((a) => {
|
|
166
|
+
T.value += 10, g(v.value, u.value);
|
|
167
|
+
}, ["prevent"]))
|
|
168
|
+
}, [
|
|
169
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
170
|
+
e[17] || (e[17] = p("«", -1))
|
|
171
|
+
])
|
|
172
|
+
])
|
|
173
|
+
])
|
|
174
|
+
])) : (o(), s("p", ce, [
|
|
175
|
+
r("span", null, [
|
|
176
|
+
r("button", {
|
|
177
|
+
onClick: e[2] || (e[2] = d((a) => g(v.value - 1, u.value), ["prevent"]))
|
|
178
|
+
}, [
|
|
179
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
180
|
+
e[18] || (e[18] = p("«", -1))
|
|
181
|
+
])
|
|
182
|
+
]),
|
|
183
|
+
r("button", {
|
|
184
|
+
onClick: e[3] || (e[3] = d((a) => {
|
|
185
|
+
i.value = 0, g(v.value, u.value - 1);
|
|
186
|
+
}, ["prevent"]))
|
|
187
|
+
}, [
|
|
188
|
+
m(t.$slots, "arrow", {}, () => [
|
|
189
|
+
e[19] || (e[19] = p("‹", -1))
|
|
190
|
+
])
|
|
191
|
+
])
|
|
192
|
+
]),
|
|
193
|
+
r("span", ie, [
|
|
194
|
+
r("button", {
|
|
195
|
+
onClick: e[4] || (e[4] = d((a) => i.value = 3, ["prevent"]))
|
|
196
|
+
}, h(v.value), 1),
|
|
197
|
+
r("button", {
|
|
198
|
+
onClick: e[5] || (e[5] = d((a) => i.value = 1, ["prevent"]))
|
|
199
|
+
}, h(Y(N)(M.value.setMonth(u.value), "{F}")), 1)
|
|
200
|
+
]),
|
|
201
|
+
r("span", null, [
|
|
202
|
+
r("button", {
|
|
203
|
+
class: "sw-revers",
|
|
204
|
+
onClick: e[6] || (e[6] = d((a) => {
|
|
205
|
+
i.value = 0, g(v.value, u.value + 1);
|
|
206
|
+
}, ["prevent"]))
|
|
207
|
+
}, [
|
|
208
|
+
m(t.$slots, "arrow", {}, () => [
|
|
209
|
+
e[20] || (e[20] = p("‹", -1))
|
|
210
|
+
])
|
|
211
|
+
]),
|
|
212
|
+
r("button", {
|
|
213
|
+
class: "sw-revers",
|
|
214
|
+
onClick: e[7] || (e[7] = d((a) => g(v.value + 1, u.value), ["prevent"]))
|
|
215
|
+
}, [
|
|
216
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
217
|
+
e[21] || (e[21] = p("«", -1))
|
|
218
|
+
])
|
|
219
|
+
])
|
|
220
|
+
])
|
|
221
|
+
])),
|
|
222
|
+
n.range === "year" || n.range === "decades" || i.value === 1 || i.value === 3 ? z("", !0) : (o(), s("div", de, [
|
|
223
|
+
(o(), s(C, null, x(7, (a, l) => r("button", {
|
|
224
|
+
key: l,
|
|
225
|
+
class: "disabled"
|
|
226
|
+
}, h(Y(N)(new Date(1970, 1, a + Y(S)), "{D}")), 1)), 64))
|
|
227
|
+
])),
|
|
228
|
+
i.value !== 3 && n.range === "year" || i.value === 1 ? (o(), s("div", ye, [
|
|
229
|
+
(o(!0), s(C, null, x(H.value, (a, l) => (o(), s("button", {
|
|
230
|
+
key: l,
|
|
231
|
+
onClick: d((y) => {
|
|
232
|
+
i.value = 0, g(v.value, l);
|
|
233
|
+
}, ["prevent"]),
|
|
234
|
+
class: I(l === u.value ? "active" : "")
|
|
235
|
+
}, h(a), 11, ge))), 128))
|
|
236
|
+
])) : n.range === "decades" || i.value === 3 ? (o(), s("div", he, [
|
|
237
|
+
(o(!0), s(C, null, x(_.value, (a, l) => (o(), s("button", {
|
|
238
|
+
key: l,
|
|
239
|
+
onClick: d((y) => {
|
|
240
|
+
i.value = n.range === "year" ? 1 : 0, g(a, u.value);
|
|
241
|
+
}, ["prevent"]),
|
|
242
|
+
class: I(T.value + l - 1 === v.value ? "active" : "")
|
|
243
|
+
}, h(a), 11, De))), 128))
|
|
244
|
+
])) : (o(), s("div", we, [
|
|
245
|
+
(o(!0), s(C, null, x(c.value, (a, l) => (o(), s(C, { key: l }, [
|
|
246
|
+
l < V.value + (7 - new Date(v.value, u.value + 1, 1).getDay() + Y(S)) % 7 ? (o(), s("button", {
|
|
247
|
+
key: 0,
|
|
248
|
+
class: I(a.month === u.value && j(a.year, a.month, a.day) ? a.class : "disabled"),
|
|
249
|
+
onClick: d(() => {
|
|
250
|
+
a.month === u.value && O(a, l);
|
|
251
|
+
}, ["prevent"])
|
|
252
|
+
}, h(a.day), 11, me)) : z("", !0)
|
|
253
|
+
], 64))), 128))
|
|
254
|
+
]))
|
|
255
|
+
]),
|
|
256
|
+
n.range === "range" ? (o(), s("div", pe, [
|
|
257
|
+
n.range === "decades" || i.value === 4 ? (o(), s("p", ke, [
|
|
258
|
+
r("span", null, [
|
|
259
|
+
r("button", {
|
|
260
|
+
onClick: e[8] || (e[8] = d((a) => {
|
|
261
|
+
T.value -= 10, g(v.value, u.value);
|
|
262
|
+
}, ["prevent"]))
|
|
263
|
+
}, [
|
|
264
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
265
|
+
e[22] || (e[22] = p("«", -1))
|
|
266
|
+
])
|
|
267
|
+
])
|
|
268
|
+
]),
|
|
269
|
+
r("span", fe, h(_.value[0]) + " - " + h(_.value[11]), 1),
|
|
270
|
+
r("span", null, [
|
|
271
|
+
r("button", {
|
|
272
|
+
class: "sw-revers",
|
|
273
|
+
onClick: e[9] || (e[9] = d((a) => {
|
|
274
|
+
T.value += 10, g(v.value, u.value);
|
|
275
|
+
}, ["prevent"]))
|
|
276
|
+
}, [
|
|
277
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
278
|
+
e[23] || (e[23] = p("«", -1))
|
|
279
|
+
])
|
|
280
|
+
])
|
|
281
|
+
])
|
|
282
|
+
])) : (o(), s("p", be, [
|
|
283
|
+
r("span", null, [
|
|
284
|
+
r("button", {
|
|
285
|
+
onClick: e[10] || (e[10] = d((a) => g(v.value - 1, u.value), ["prevent"]))
|
|
286
|
+
}, [
|
|
287
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
288
|
+
e[24] || (e[24] = p("«", -1))
|
|
289
|
+
])
|
|
290
|
+
]),
|
|
291
|
+
r("button", {
|
|
292
|
+
onClick: e[11] || (e[11] = d((a) => {
|
|
293
|
+
i.value = 0, g(v.value, u.value - 1);
|
|
294
|
+
}, ["prevent"]))
|
|
295
|
+
}, [
|
|
296
|
+
m(t.$slots, "arrow", {}, () => [
|
|
297
|
+
e[25] || (e[25] = p("‹", -1))
|
|
298
|
+
])
|
|
299
|
+
])
|
|
300
|
+
]),
|
|
301
|
+
r("span", Ce, [
|
|
302
|
+
r("button", {
|
|
303
|
+
onClick: e[12] || (e[12] = d((a) => i.value = 4, ["prevent"]))
|
|
304
|
+
}, h(new Date(v.value, u.value + 1).getFullYear()), 1),
|
|
305
|
+
r("button", {
|
|
306
|
+
onClick: e[13] || (e[13] = d((a) => i.value = 2, ["prevent"]))
|
|
307
|
+
}, h(Y(N)(M.value.setMonth(u.value + 1), "{F}")), 1)
|
|
308
|
+
]),
|
|
309
|
+
r("span", null, [
|
|
310
|
+
r("button", {
|
|
311
|
+
class: "sw-revers",
|
|
312
|
+
onClick: e[14] || (e[14] = d((a) => {
|
|
313
|
+
i.value = 0, g(v.value, u.value + 1);
|
|
314
|
+
}, ["prevent"]))
|
|
315
|
+
}, [
|
|
316
|
+
m(t.$slots, "arrow", {}, () => [
|
|
317
|
+
e[26] || (e[26] = p("‹", -1))
|
|
318
|
+
])
|
|
319
|
+
]),
|
|
320
|
+
r("button", {
|
|
321
|
+
class: "sw-revers",
|
|
322
|
+
onClick: e[15] || (e[15] = d((a) => g(v.value + 1, u.value), ["prevent"]))
|
|
323
|
+
}, [
|
|
324
|
+
m(t.$slots, "double-arrow", {}, () => [
|
|
325
|
+
e[27] || (e[27] = p("«", -1))
|
|
326
|
+
])
|
|
327
|
+
])
|
|
328
|
+
])
|
|
329
|
+
])),
|
|
330
|
+
i.value === 2 || i.value === 4 ? z("", !0) : (o(), s("div", Me, [
|
|
331
|
+
(o(), s(C, null, x(7, (a, l) => r("button", {
|
|
332
|
+
key: l,
|
|
333
|
+
class: "disabled"
|
|
334
|
+
}, h(Y(N)(new Date(1970, 1, a + Y(S)), "{D}")), 1)), 64))
|
|
335
|
+
])),
|
|
336
|
+
i.value === 2 ? (o(), s("div", $e, [
|
|
337
|
+
(o(!0), s(C, null, x(H.value, (a, l) => (o(), s("button", {
|
|
338
|
+
key: l,
|
|
339
|
+
onClick: d((y) => {
|
|
340
|
+
i.value = 0, g(v.value, l - 1);
|
|
341
|
+
}, ["prevent"]),
|
|
342
|
+
class: I(l === (u.value + 1) % 12 ? "active" : "")
|
|
343
|
+
}, h(a), 11, Fe))), 128))
|
|
344
|
+
])) : i.value === 4 ? (o(), s("div", Ye, [
|
|
345
|
+
(o(!0), s(C, null, x(_.value, (a, l) => (o(), s("button", {
|
|
346
|
+
key: l,
|
|
347
|
+
onClick: d((y) => {
|
|
348
|
+
i.value = 0, g(a, u.value);
|
|
349
|
+
}, ["prevent"]),
|
|
350
|
+
class: I(T.value + l - 1 === v.value ? "active" : "")
|
|
351
|
+
}, h(a), 11, xe))), 128))
|
|
352
|
+
])) : (o(), s("div", Te, [
|
|
353
|
+
(o(!0), s(C, null, x(c.value, (a, l) => (o(), s(C, { key: l }, [
|
|
354
|
+
l >= V.value - (7 + new Date(v.value, u.value + 1, 1).getDay() - Y(S)) % 7 ? (o(), s("button", {
|
|
355
|
+
key: 0,
|
|
356
|
+
class: I(a.month === B.value && j(a.year, a.month, a.day) ? a.class : "disabled"),
|
|
357
|
+
onClick: d(() => {
|
|
358
|
+
a.month === B.value && O(a, l);
|
|
359
|
+
}, ["prevent"])
|
|
360
|
+
}, h(a.day), 11, Se)) : z("", !0)
|
|
361
|
+
], 64))), 128))
|
|
362
|
+
]))
|
|
363
|
+
])) : z("", !0)
|
|
364
|
+
]));
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
export {
|
|
368
|
+
Ie as default
|
|
369
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),B=["id"],C={__name:"SwDropdown",props:o.mergeModels({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}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(g,{expose:x}){const r=g,a=o.useModel(g,"modelValue"),w=o.ref(null),p=o.ref(null),y=o.ref({}),E=Math.ceil(Math.random()*1e3),c=o.ref(0),L=o.computed(()=>{let l=["sw-dropdown"];return r.size.length>0&&l.push("sw-"+r.size),r.type.length>0&&l.push("sw-"+r.type),l}),b=new ResizeObserver(()=>{a.value&&c.value++,c.value>99&&(c.value=1)});o.watchEffect(()=>{if(!a.value||!p.value||!w.value)return;c.value<2&&b.observe(p.value);let l=window.pageYOffset||document.documentElement.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft;document.body.style.position="fixed",document.body.style.top=`-${l}px`,document.body.style.left=`-${i}px`,document.body.style.position="",document.body.style.top="",document.body.style.left="",document.documentElement.scrollTop=l,document.documentElement.scrollLeft=i;const n=w.value.getBoundingClientRect();let h=window.innerWidth,z=window.innerHeight,s=p.value.offsetHeight,d=p.value.offsetWidth,e=n.left+n.width/2+i,t=n.top+n.height/2+l,u=n.height/2+8;const[$,f]=r.placement.split("-",2);switch($){case"bottom":t=l+z-s-u-8<t?t-u-s:t+u,f===void 0&&(e-=d/2);break;case"top":t=l+s+u+8>t?t+u:t-u-s,f===void 0&&(e-=d/2);break;case"left":e-d-n.width/2-8<0?e+n.width/2+8+d<h?(e=e+n.width/2+8,t=t-s/2):(t=l+s+u+8>t?t+u:t-u-s,e=e+n.width/2<h?e+n.width/2-d:e-d/2):(e=e-d-n.width/2-8,t=t-s/2);break;case"right":e+n.width/2+8+d>h?e-d-n.width/2-8>0?(e=e-d-n.width/2-8,t=t-s/2):(t=l+s+u+8>t?t+u:t-u-s,e=e-n.width/2):(e=e+n.width/2+8,t=t-s/2);break}switch(f){case"left":e=i+h-8>e-n.width/2+d?e-n.width/2:e-d+n.width/2;break;case"right":e=8<e+n.width/2-d?e-d+n.width/2:e-n.width/2;break}e<0&&(e=0),t<0&&(t=0),y.value={position:"absolute",top:`${t}px`,left:`${e}px`,maxWidth:r.maxWidth>0?`${r.maxWidth}px`:""}},{flush:"post"});const M=()=>{r.trigger==="click"&&(a.value=!a.value)},k=()=>{r.trigger==="hover"&&(a.value=!a.value)},S=()=>{r.trigger==="context"&&(a.value=!a.value)},m=()=>{a.value&&c.value++,c.value>99&&(c.value=1)};x({handleResize:m});const v=l=>{r.trigger!=="none"&&!l.target.closest(`[id="${E}"]`)&&w.value&&!w.value.contains(l.target)&&(a.value=!1)};return o.onMounted(()=>{window.addEventListener("resize",m),document.documentElement.ontouchstart!==void 0?document.documentElement.addEventListener("touchstart",v,!0):document.documentElement.addEventListener("click",v,!0),window.onscrollend!==void 0?window.addEventListener("scrollend",m):window.addEventListener("scroll",m)}),o.onUnmounted(()=>{b.disconnect(),window.removeEventListener("resize",m),document.documentElement.ontouchstart!==void 0?document.documentElement.removeEventListener("touchstart",v):document.documentElement.removeEventListener("click",v),window.onscrollend!==void 0?window.removeEventListener("scrollend",m):window.removeEventListener("scroll",m)}),(l,i)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(L.value),onClick:i[0]||(i[0]=n=>M()),onMouseover:i[1]||(i[1]=o.withModifiers(n=>k(),["stop"])),onMouseleave:i[2]||(i[2]=o.withModifiers(n=>k(),["stop"])),onContextmenu:i[3]||(i[3]=o.withModifiers(n=>S(),["stop"])),ref_key:"dropdownRef",ref:w},[o.renderSlot(l.$slots,"default"),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[a.value?(o.openBlock(),o.createElementBlock("ul",{key:0,ref_key:"popupRef",ref:p,id:o.unref(E),class:o.normalizeClass(["sw-dropdown-popup",r.class]),style:o.normalizeStyle(y.value),tabindex:"-1"},[o.renderSlot(l.$slots,"dropdown")],14,B)):o.createCommentVNode("",!0)]))],34))}};exports.default=C;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { mergeModels as V, useModel as _, ref as h, computed as H, watchEffect as O, createElementBlock as z, onMounted as N, onUnmounted as A, openBlock as g, withModifiers as y, normalizeClass as M, renderSlot as S, createBlock as D, Teleport as G, createCommentVNode as U, normalizeStyle as X, unref as Y } from "vue";
|
|
2
|
+
const j = ["id"], F = {
|
|
3
|
+
__name: "SwDropdown",
|
|
4
|
+
props: /* @__PURE__ */ V({
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
size: { type: String, default: "" },
|
|
7
|
+
type: { type: String, default: "" },
|
|
8
|
+
trigger: { type: String, default: "click" },
|
|
9
|
+
placement: { type: String, default: "bottom-left" },
|
|
10
|
+
maxWidth: { type: Number, default: 0 }
|
|
11
|
+
}, {
|
|
12
|
+
modelValue: {},
|
|
13
|
+
modelModifiers: {}
|
|
14
|
+
}),
|
|
15
|
+
emits: ["update:modelValue"],
|
|
16
|
+
setup(E, { expose: $ }) {
|
|
17
|
+
const i = E, u = _(E, "modelValue"), m = h(null), w = h(null), b = h({}), k = Math.ceil(Math.random() * 1e3), a = h(0), W = H(
|
|
18
|
+
() => {
|
|
19
|
+
let n = ["sw-dropdown"];
|
|
20
|
+
return i.size.length > 0 && n.push("sw-" + i.size), i.type.length > 0 && n.push("sw-" + i.type), n;
|
|
21
|
+
}
|
|
22
|
+
), x = new ResizeObserver(() => {
|
|
23
|
+
u.value && a.value++, a.value > 99 && (a.value = 1);
|
|
24
|
+
});
|
|
25
|
+
O(
|
|
26
|
+
() => {
|
|
27
|
+
if (!u.value || !w.value || !m.value)
|
|
28
|
+
return;
|
|
29
|
+
a.value < 2 && x.observe(w.value);
|
|
30
|
+
let n = window.pageYOffset || document.documentElement.scrollTop, d = window.pageXOffset || document.documentElement.scrollLeft;
|
|
31
|
+
document.body.style.position = "fixed", document.body.style.top = `-${n}px`, document.body.style.left = `-${d}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = n, document.documentElement.scrollLeft = d;
|
|
32
|
+
const o = m.value.getBoundingClientRect();
|
|
33
|
+
let v = window.innerWidth, B = window.innerHeight, s = w.value.offsetHeight, l = w.value.offsetWidth, e = o.left + o.width / 2 + d, t = o.top + o.height / 2 + n, r = o.height / 2 + 8;
|
|
34
|
+
const [T, f] = i.placement.split("-", 2);
|
|
35
|
+
switch (T) {
|
|
36
|
+
case "bottom":
|
|
37
|
+
t = n + B - s - r - 8 < t ? t - r - s : t + r, f === void 0 && (e -= l / 2);
|
|
38
|
+
break;
|
|
39
|
+
case "top":
|
|
40
|
+
t = n + s + r + 8 > t ? t + r : t - r - s, f === void 0 && (e -= l / 2);
|
|
41
|
+
break;
|
|
42
|
+
case "left":
|
|
43
|
+
e - l - o.width / 2 - 8 < 0 ? e + o.width / 2 + 8 + l < v ? (e = e + o.width / 2 + 8, t = t - s / 2) : (t = n + s + r + 8 > t ? t + r : t - r - s, e = e + o.width / 2 < v ? e + o.width / 2 - l : e - l / 2) : (e = e - l - o.width / 2 - 8, t = t - s / 2);
|
|
44
|
+
break;
|
|
45
|
+
case "right":
|
|
46
|
+
e + o.width / 2 + 8 + l > v ? e - l - o.width / 2 - 8 > 0 ? (e = e - l - o.width / 2 - 8, t = t - s / 2) : (t = n + s + r + 8 > t ? t + r : t - r - s, e = e - o.width / 2) : (e = e + o.width / 2 + 8, t = t - s / 2);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
switch (f) {
|
|
50
|
+
case "left":
|
|
51
|
+
e = d + v - 8 > e - o.width / 2 + l ? e - o.width / 2 : e - l + o.width / 2;
|
|
52
|
+
break;
|
|
53
|
+
case "right":
|
|
54
|
+
e = 8 < e + o.width / 2 - l ? e - l + o.width / 2 : e - o.width / 2;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
e < 0 && (e = 0), t < 0 && (t = 0), b.value = {
|
|
58
|
+
position: "absolute",
|
|
59
|
+
top: `${t}px`,
|
|
60
|
+
left: `${e}px`,
|
|
61
|
+
maxWidth: i.maxWidth > 0 ? `${i.maxWidth}px` : ""
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
{ flush: "post" }
|
|
65
|
+
);
|
|
66
|
+
const C = () => {
|
|
67
|
+
i.trigger === "click" && (u.value = !u.value);
|
|
68
|
+
}, L = () => {
|
|
69
|
+
i.trigger === "hover" && (u.value = !u.value);
|
|
70
|
+
}, R = () => {
|
|
71
|
+
i.trigger === "context" && (u.value = !u.value);
|
|
72
|
+
}, c = () => {
|
|
73
|
+
u.value && a.value++, a.value > 99 && (a.value = 1);
|
|
74
|
+
};
|
|
75
|
+
$({ handleResize: c });
|
|
76
|
+
const p = (n) => {
|
|
77
|
+
i.trigger !== "none" && !n.target.closest(`[id="${k}"]`) && m.value && !m.value.contains(n.target) && (u.value = !1);
|
|
78
|
+
};
|
|
79
|
+
return N(() => {
|
|
80
|
+
window.addEventListener("resize", c), document.documentElement.ontouchstart !== void 0 ? document.documentElement.addEventListener("touchstart", p, !0) : document.documentElement.addEventListener("click", p, !0), window.onscrollend !== void 0 ? window.addEventListener("scrollend", c) : window.addEventListener("scroll", c);
|
|
81
|
+
}), A(() => {
|
|
82
|
+
x.disconnect(), window.removeEventListener("resize", c), document.documentElement.ontouchstart !== void 0 ? document.documentElement.removeEventListener("touchstart", p) : document.documentElement.removeEventListener("click", p), window.onscrollend !== void 0 ? window.removeEventListener("scrollend", c) : window.removeEventListener("scroll", c);
|
|
83
|
+
}), (n, d) => (g(), z("div", {
|
|
84
|
+
class: M(W.value),
|
|
85
|
+
onClick: d[0] || (d[0] = (o) => C()),
|
|
86
|
+
onMouseover: d[1] || (d[1] = y((o) => L(), ["stop"])),
|
|
87
|
+
onMouseleave: d[2] || (d[2] = y((o) => L(), ["stop"])),
|
|
88
|
+
onContextmenu: d[3] || (d[3] = y((o) => R(), ["stop"])),
|
|
89
|
+
ref_key: "dropdownRef",
|
|
90
|
+
ref: m
|
|
91
|
+
}, [
|
|
92
|
+
S(n.$slots, "default"),
|
|
93
|
+
(g(), D(G, { to: "body" }, [
|
|
94
|
+
u.value ? (g(), z("ul", {
|
|
95
|
+
key: 0,
|
|
96
|
+
ref_key: "popupRef",
|
|
97
|
+
ref: w,
|
|
98
|
+
id: Y(k),
|
|
99
|
+
class: M(["sw-dropdown-popup", i.class]),
|
|
100
|
+
style: X(b.value),
|
|
101
|
+
tabindex: "-1"
|
|
102
|
+
}, [
|
|
103
|
+
S(n.$slots, "dropdown")
|
|
104
|
+
], 14, j)) : U("", !0)
|
|
105
|
+
]))
|
|
106
|
+
], 34));
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
F as default
|
|
111
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { computed as n, createElementBlock as r, openBlock as l, normalizeClass as a, createBlock as c, createCommentVNode as p, renderSlot as i } from "vue";
|
|
2
|
+
import { g as u } from "./VacationTable-GeJlpGuk.js";
|
|
3
|
+
const g = {
|
|
4
|
+
__name: "SwDropdownItem",
|
|
5
|
+
props: {
|
|
6
|
+
class: { type: String, default: "" },
|
|
7
|
+
size: { type: String, default: "" },
|
|
8
|
+
type: { type: String, default: "" },
|
|
9
|
+
iconBefore: { type: String, default: "" }
|
|
10
|
+
},
|
|
11
|
+
setup(o) {
|
|
12
|
+
const e = o, s = n(
|
|
13
|
+
() => {
|
|
14
|
+
let t = ["sw-dropdown-item"];
|
|
15
|
+
return e.size.length > 0 && t.push("sw-" + e.size), e.type.length > 0 && t.push("sw-" + e.type), e.class.length > 0 && t.push(e.class), t;
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
return (t, d) => (l(), r("li", {
|
|
19
|
+
class: a(s.value)
|
|
20
|
+
}, [
|
|
21
|
+
o.iconBefore.length > 0 ? (l(), c(u, {
|
|
22
|
+
key: 0,
|
|
23
|
+
"icon-class": o.iconBefore
|
|
24
|
+
}, null, 8, ["icon-class"])) : p("", !0),
|
|
25
|
+
i(t.$slots, "default")
|
|
26
|
+
], 2));
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
g as default
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),s=require("./VacationTable-3jJUSDHf.cjs"),r={__name:"SwDropdownItem",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},iconBefore:{type:String,default:""}},setup(o){const t=o,n=e.computed(()=>{let l=["sw-dropdown-item"];return t.size.length>0&&l.push("sw-"+t.size),t.type.length>0&&l.push("sw-"+t.type),t.class.length>0&&l.push(t.class),l});return(l,c)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(n.value)},[o.iconBefore.length>0?(e.openBlock(),e.createBlock(s.g,{key:0,"icon-class":o.iconBefore},null,8,["icon-class"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default")],2))}};exports.default=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),B=["id"],C={__name:"SwDropdownNew",props:o.mergeModels({class:{type:String,default:""},type:{type:String,default:""},trigger:{type:String,default:"click"},placement:{type:String,default:"bottom-left"},maxWidth:{type:Number,default:0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(h,{expose:k}){const u=h,a=o.useModel(h,"modelValue"),v=o.ref(null),p=o.ref(null),y=o.ref({}),x=Math.ceil(Math.random()*1e3),c=o.ref(0),E=o.computed(()=>{let n=["sw-dropdown"];return u.type.length>0&&n.push("sw-"+u.type),n}),g=new ResizeObserver(()=>{a.value&&c.value++,c.value>99&&(c.value=1)});o.watchEffect(()=>{if(!a.value||!p.value||!v.value)return;c.value<2&&g.observe(p.value);let n=window.pageYOffset||document.documentElement.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft;document.body.style.position="fixed",document.body.style.top=`-${n}px`,document.body.style.left=`-${i}px`,document.body.style.position="",document.body.style.top="",document.body.style.left="",document.documentElement.scrollTop=n,document.documentElement.scrollLeft=i;const l=v.value.getBoundingClientRect();let m=window.innerWidth,z=window.innerHeight,r=p.value.offsetHeight,d=p.value.offsetWidth,e=l.left+l.width/2+i,t=l.top+l.height/2+n,s=l.height/2+8;const[L,f]=u.placement.split("-",2);switch(L){case"bottom":t=n+z-r-s-8<t?t-s-r:t+s,f===void 0&&(e-=d/2);break;case"top":t=n+r+s+8>t?t+s:t-s-r,f===void 0&&(e-=d/2);break;case"left":e-d-l.width/2-8<0?e+l.width/2+8+d<m?(e=e+l.width/2+8,t=t-r/2):(t=n+r+s+8>t?t+s:t-s-r,e=e+l.width/2<m?e+l.width/2-d:e-d/2):(e=e-d-l.width/2-8,t=t-r/2);break;case"right":e+l.width/2+8+d>m?e-d-l.width/2-8>0?(e=e-d-l.width/2-8,t=t-r/2):(t=n+r+s+8>t?t+s:t-s-r,e=e-l.width/2):(e=e+l.width/2+8,t=t-r/2);break}switch(f){case"left":e=i+m-8>e-l.width/2+d?e-l.width/2:e-d+l.width/2;break;case"right":e=8<e+l.width/2-d?e-d+l.width/2:e-l.width/2;break}e<0&&(e=0),t<0&&(t=0),y.value={position:"absolute",top:`${t}px`,left:`${e}px`,maxWidth:u.maxWidth>0?`${u.maxWidth}px`:""}},{flush:"post"});const M=()=>{u.trigger==="click"&&(a.value=!a.value)},b=()=>{u.trigger==="hover"&&(a.value=!a.value)},S=()=>{u.trigger==="context"&&(a.value=!a.value)},w=()=>{a.value&&c.value++,c.value>99&&(c.value=1)};return k({handleResize:w}),o.onMounted(()=>{window.addEventListener("resize",w),window.onscrollend!==void 0?window.addEventListener("scrollend",w):window.addEventListener("scroll",w)}),o.onUnmounted(()=>{g.disconnect(),window.removeEventListener("resize",w),window.onscrollend!==void 0?window.removeEventListener("scrollend",w):window.removeEventListener("scroll",w)}),(n,i)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(E.value),onClick:i[0]||(i[0]=l=>M()),onMouseover:i[1]||(i[1]=o.withModifiers(l=>b(),["stop"])),onMouseleave:i[2]||(i[2]=o.withModifiers(l=>b(),["stop"])),onContextmenu:i[3]||(i[3]=o.withModifiers(l=>S(),["stop"])),ref_key:"dropdownRef",ref:v},[o.renderSlot(n.$slots,"default"),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[a.value?(o.openBlock(),o.createElementBlock("ul",{key:0,popover:"",ref_key:"popupRef",ref:p,id:o.unref(x),class:o.normalizeClass(["sw-dropdown-popup",u.class]),style:o.normalizeStyle(y.value),tabindex:"-1"},[o.renderSlot(n.$slots,"dropdown")],14,B)):o.createCommentVNode("",!0)]))],34))}};exports.default=C;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { mergeModels as T, useModel as V, ref as m, computed as _, watchEffect as N, createElementBlock as E, onMounted as O, onUnmounted as H, openBlock as f, withModifiers as y, normalizeClass as M, renderSlot as L, createBlock as q, Teleport as D, createCommentVNode as F, normalizeStyle as U, unref as X } from "vue";
|
|
2
|
+
const Y = ["id"], A = {
|
|
3
|
+
__name: "SwDropdownNew",
|
|
4
|
+
props: /* @__PURE__ */ T({
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
type: { type: String, default: "" },
|
|
7
|
+
trigger: { type: String, default: "click" },
|
|
8
|
+
placement: { type: String, default: "bottom-left" },
|
|
9
|
+
maxWidth: { type: Number, default: 0 }
|
|
10
|
+
}, {
|
|
11
|
+
modelValue: {},
|
|
12
|
+
modelModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(g, { expose: S }) {
|
|
16
|
+
const a = g, r = V(g, "modelValue"), v = m(null), p = m(null), b = m({}), z = Math.ceil(Math.random() * 1e3), u = m(0), W = _(
|
|
17
|
+
() => {
|
|
18
|
+
let d = ["sw-dropdown"];
|
|
19
|
+
return a.type.length > 0 && d.push("sw-" + a.type), d;
|
|
20
|
+
}
|
|
21
|
+
), k = new ResizeObserver(() => {
|
|
22
|
+
r.value && u.value++, u.value > 99 && (u.value = 1);
|
|
23
|
+
});
|
|
24
|
+
N(
|
|
25
|
+
() => {
|
|
26
|
+
if (!r.value || !p.value || !v.value)
|
|
27
|
+
return;
|
|
28
|
+
u.value < 2 && k.observe(p.value);
|
|
29
|
+
let d = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft;
|
|
30
|
+
document.body.style.position = "fixed", document.body.style.top = `-${d}px`, document.body.style.left = `-${n}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = d, document.documentElement.scrollLeft = n;
|
|
31
|
+
const o = v.value.getBoundingClientRect();
|
|
32
|
+
let w = window.innerWidth, R = window.innerHeight, i = p.value.offsetHeight, l = p.value.offsetWidth, e = o.left + o.width / 2 + n, t = o.top + o.height / 2 + d, s = o.height / 2 + 8;
|
|
33
|
+
const [B, h] = a.placement.split("-", 2);
|
|
34
|
+
switch (B) {
|
|
35
|
+
case "bottom":
|
|
36
|
+
t = d + R - i - s - 8 < t ? t - s - i : t + s, h === void 0 && (e -= l / 2);
|
|
37
|
+
break;
|
|
38
|
+
case "top":
|
|
39
|
+
t = d + i + s + 8 > t ? t + s : t - s - i, h === void 0 && (e -= l / 2);
|
|
40
|
+
break;
|
|
41
|
+
case "left":
|
|
42
|
+
e - l - o.width / 2 - 8 < 0 ? e + o.width / 2 + 8 + l < w ? (e = e + o.width / 2 + 8, t = t - i / 2) : (t = d + i + s + 8 > t ? t + s : t - s - i, e = e + o.width / 2 < w ? e + o.width / 2 - l : e - l / 2) : (e = e - l - o.width / 2 - 8, t = t - i / 2);
|
|
43
|
+
break;
|
|
44
|
+
case "right":
|
|
45
|
+
e + o.width / 2 + 8 + l > w ? e - l - o.width / 2 - 8 > 0 ? (e = e - l - o.width / 2 - 8, t = t - i / 2) : (t = d + i + s + 8 > t ? t + s : t - s - i, e = e - o.width / 2) : (e = e + o.width / 2 + 8, t = t - i / 2);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
switch (h) {
|
|
49
|
+
case "left":
|
|
50
|
+
e = n + w - 8 > e - o.width / 2 + l ? e - o.width / 2 : e - l + o.width / 2;
|
|
51
|
+
break;
|
|
52
|
+
case "right":
|
|
53
|
+
e = 8 < e + o.width / 2 - l ? e - l + o.width / 2 : e - o.width / 2;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
e < 0 && (e = 0), t < 0 && (t = 0), b.value = {
|
|
57
|
+
position: "absolute",
|
|
58
|
+
top: `${t}px`,
|
|
59
|
+
left: `${e}px`,
|
|
60
|
+
maxWidth: a.maxWidth > 0 ? `${a.maxWidth}px` : ""
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
{ flush: "post" }
|
|
64
|
+
);
|
|
65
|
+
const $ = () => {
|
|
66
|
+
a.trigger === "click" && (r.value = !r.value);
|
|
67
|
+
}, x = () => {
|
|
68
|
+
a.trigger === "hover" && (r.value = !r.value);
|
|
69
|
+
}, C = () => {
|
|
70
|
+
a.trigger === "context" && (r.value = !r.value);
|
|
71
|
+
}, c = () => {
|
|
72
|
+
r.value && u.value++, u.value > 99 && (u.value = 1);
|
|
73
|
+
};
|
|
74
|
+
return S({ handleResize: c }), O(() => {
|
|
75
|
+
window.addEventListener("resize", c), window.onscrollend !== void 0 ? window.addEventListener("scrollend", c) : window.addEventListener("scroll", c);
|
|
76
|
+
}), H(() => {
|
|
77
|
+
k.disconnect(), window.removeEventListener("resize", c), window.onscrollend !== void 0 ? window.removeEventListener("scrollend", c) : window.removeEventListener("scroll", c);
|
|
78
|
+
}), (d, n) => (f(), E("div", {
|
|
79
|
+
class: M(W.value),
|
|
80
|
+
onClick: n[0] || (n[0] = (o) => $()),
|
|
81
|
+
onMouseover: n[1] || (n[1] = y((o) => x(), ["stop"])),
|
|
82
|
+
onMouseleave: n[2] || (n[2] = y((o) => x(), ["stop"])),
|
|
83
|
+
onContextmenu: n[3] || (n[3] = y((o) => C(), ["stop"])),
|
|
84
|
+
ref_key: "dropdownRef",
|
|
85
|
+
ref: v
|
|
86
|
+
}, [
|
|
87
|
+
L(d.$slots, "default"),
|
|
88
|
+
(f(), q(D, { to: "body" }, [
|
|
89
|
+
r.value ? (f(), E("ul", {
|
|
90
|
+
key: 0,
|
|
91
|
+
popover: "",
|
|
92
|
+
ref_key: "popupRef",
|
|
93
|
+
ref: p,
|
|
94
|
+
id: X(z),
|
|
95
|
+
class: M(["sw-dropdown-popup", a.class]),
|
|
96
|
+
style: U(b.value),
|
|
97
|
+
tabindex: "-1"
|
|
98
|
+
}, [
|
|
99
|
+
L(d.$slots, "dropdown")
|
|
100
|
+
], 14, Y)) : F("", !0)
|
|
101
|
+
]))
|
|
102
|
+
], 34));
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
A as default
|
|
107
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { computed as r, createElementBlock as o, openBlock as a, normalizeClass as p, renderSlot as n } from "vue";
|
|
2
|
+
const u = {
|
|
3
|
+
__name: "SwFormItem",
|
|
4
|
+
props: {
|
|
5
|
+
class: { type: String, default: "" },
|
|
6
|
+
type: { type: String, default: "" }
|
|
7
|
+
},
|
|
8
|
+
setup(s) {
|
|
9
|
+
const t = s, l = r(
|
|
10
|
+
() => {
|
|
11
|
+
let e = ["sw-form-item"];
|
|
12
|
+
return t.type.length > 0 && e.push("sw-" + t.type), t.class.length > 0 && e.push(t.class), e;
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
return (e, c) => (a(), o("div", {
|
|
16
|
+
class: p(l.value)
|
|
17
|
+
}, [
|
|
18
|
+
n(e.$slots, "default")
|
|
19
|
+
], 2));
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
u as default
|
|
24
|
+
};
|