@fewangsit/wangsvue-fats 1.0.1-alpha.54 → 1.0.1-alpha.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.
@@ -0,0 +1,1033 @@
1
+ import { defineComponent as Ht, onMounted as At, useAttrs as Pt, ref as B, shallowRef as $, computed as x, watch as Se, createBlock as ae, openBlock as v, withCtx as $e, renderSlot as j, createVNode as S, createElementVNode as g, mergeProps as c, unref as q, createElementBlock as h, createCommentVNode as C, withDirectives as Nt, toDisplayString as P, Fragment as le, renderList as fe, createTextVNode as Ut, normalizeProps as Ot, withKeys as b, vShow as Jt } from "vue";
2
+ import { D as O } from "../vendor/luxon/src/datetime.es.js";
3
+ import "../vendor/luxon/src/duration.es.js";
4
+ import { u as Kt } from "../plugins/WangsVue.es.js";
5
+ import { s as Zt } from "../vendor/primevue/overlaypanel/overlaypanel.esm.es.js";
6
+ import { s as zt } from "../vendor/primevue/selectbutton/selectbutton.esm.es.js";
7
+ import { s as Et } from "../vendor/primevue/skeleton/skeleton.esm.es.js";
8
+ import { _ as pe } from "../button/index.es.js";
9
+ import { _ as Wt } from "../fieldwrapper/index.es.js";
10
+ import { _ as ne } from "../icon/index.es.js";
11
+ import { _ as Lt } from "../inputgroup/index.es.js";
12
+ import { _ as Le } from "../inputtext/index.es.js";
13
+ import { _ as Rt } from "../validatormessage/index.es.js";
14
+ import { d as jt } from "../vendor/lodash-es/debounce.es.js";
15
+ const qt = ["id"], Gt = ["id", "aria-invalid", "disabled", "placeholder", "value"], Qt = { class: "flex gap-1" }, Xt = { key: 2 }, _t = {
16
+ key: 0,
17
+ class: "flex flex-col",
18
+ "data-wv-section": "datepicker"
19
+ }, ea = { "data-wv-section": "tableheader" }, ta = {
20
+ class: "grid grid-cols-7 justify-between h-[26.8px] items-center",
21
+ "data-wv-section": "weekdays"
22
+ }, aa = {
23
+ class: "grid grid-cols-7",
24
+ "data-wv-section": "tablebody"
25
+ }, la = ["aria-label", "data-wv-other-month", "data-wv-today"], na = ["aria-disabled", "data-p-disabled", "onClick"], oa = ["data-p-disabled", "data-p-highlight", "onClick"], ra = ["data-p-disabled", "data-p-highlight", "onClick"], sa = ["aria-label", "disabled"], ia = ["aria-label", "disabled"], ua = ["aria-label", "disabled"], da = ["aria-label", "disabled"], ca = {
26
+ key: 1,
27
+ class: "w-full flex items-center justify-end gap-1",
28
+ "data-wv-section": "calendarbuttons"
29
+ }, $a = /* @__PURE__ */ Ht({
30
+ __name: "BaseCalendarTimeZone",
31
+ props: {
32
+ modelValue: {},
33
+ dateValue: {},
34
+ epochTimeMillis: {},
35
+ valueFormat: { default: "millis" },
36
+ label: {},
37
+ placeholder: {},
38
+ disabled: { type: Boolean },
39
+ readonly: { type: Boolean },
40
+ overlayClass: {},
41
+ inputId: {},
42
+ id: {},
43
+ mode: { default: "single" },
44
+ selectionMode: { default: "single" },
45
+ hideOnDateTimeSelect: { type: Boolean },
46
+ hideOnRangeSelection: { type: Boolean, default: !0 },
47
+ view: { default: "date" },
48
+ showYear: { type: Boolean, default: !0 },
49
+ showButtons: { type: Boolean },
50
+ useValidator: { type: Boolean },
51
+ fieldName: {},
52
+ fieldInfo: {},
53
+ mandatory: { type: Boolean },
54
+ showOptionalText: { type: Boolean, default: void 0 },
55
+ invalid: { type: Boolean },
56
+ validatorMessage: {},
57
+ customValidation: {},
58
+ dateFormat: { default: "dd/mm/yy" },
59
+ hourFormat: { default: "24" },
60
+ showTime: { type: Boolean },
61
+ timeSeparator: { default: ":" },
62
+ stepHour: { default: 1 },
63
+ stepMinute: { default: 1 },
64
+ useTimeFormat: { type: Boolean },
65
+ onlyWeekdays: { type: Boolean, default: !1 },
66
+ excludeDates: { default: () => [] },
67
+ minDate: {},
68
+ maxDate: {},
69
+ maxYear: {},
70
+ maxMonth: {},
71
+ exactSelection: { type: Boolean, default: !1 }
72
+ },
73
+ emits: ["update:modelValue", "update:epochTimeMillis", "monthChange", "yearChange", "dateSelect"],
74
+ setup(Re, { emit: je }) {
75
+ var We;
76
+ const l = Re, N = je;
77
+ At(() => {
78
+ L();
79
+ });
80
+ const qe = Pt(), F = Kt("Calendar"), Ge = (1969 * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 1e7, he = JSON.parse(localStorage.getItem("user") || "{}"), H = (We = he == null ? void 0 : he.generalSetting) == null ? void 0 : We.timezone, y = (e) => {
81
+ const t = H && O.local().setZone(H).isValid, a = e instanceof Date && !isNaN(e.getTime());
82
+ if (t) {
83
+ const o = a ? O.fromJSDate(e).setZone(H) : O.now().setZone(H);
84
+ return {
85
+ Date: o.toJSDate(),
86
+ date: o.day,
87
+ day: o.weekday % 7,
88
+ // Match Date.getDay()
89
+ month: o.month - 1,
90
+ // Match Date.getMonth()
91
+ year: o.year,
92
+ time: o.toMillis(),
93
+ // Match Date.getTime()
94
+ hour: o.hour,
95
+ minute: o.minute,
96
+ second: o.second
97
+ };
98
+ }
99
+ const n = a ? e : /* @__PURE__ */ new Date();
100
+ return {
101
+ Date: n,
102
+ date: n.getDate(),
103
+ day: n.getDay(),
104
+ month: n.getMonth(),
105
+ year: n.getFullYear(),
106
+ time: n.getTime(),
107
+ hour: n.getHours(),
108
+ minute: n.getMinutes(),
109
+ second: n.getSeconds()
110
+ };
111
+ }, Ce = B(), oe = B(), ge = B(), Qe = y().Date, D = B(y().month), u = B(y().year), d = B(y().hour), f = B(y().minute), I = B(y().second), J = B(l.modelValue), re = B(!1), Fe = $(0), Ie = $(0), ye = $(), p = $(l.view ?? "date"), Ve = $([]), Ye = $(!1), w = $(!1), De = $(), Be = $(!1), we = $(), xe = $([]), r = x(() => l.showButtons || l.showTime ? J.value : l.modelValue), se = x(() => Ve.value.flatMap((e) => e)), Xe = x(() => d.value < 10 ? "0" + d.value : d.value), _e = x(() => f.value < 10 ? "0" + f.value : f.value), et = x(() => l.dateFormat || F.locale.global.dateFormat), tt = x(() => {
112
+ const e = [], t = (a) => {
113
+ if (l.minDate) {
114
+ const n = l.minDate.getMonth(), o = l.minDate.getFullYear();
115
+ if (u.value < o || u.value === o && a < n)
116
+ return !1;
117
+ }
118
+ if (l.maxDate) {
119
+ const n = l.maxDate.getMonth(), o = l.maxDate.getFullYear();
120
+ if (u.value > o || u.value === o && a > n)
121
+ return !1;
122
+ }
123
+ if (l.maxMonth && l.maxMonth === "current") {
124
+ const n = /* @__PURE__ */ new Date(), o = n.getMonth(), s = n.getFullYear();
125
+ return a <= o && u.value == s || // In current year
126
+ u.value < s;
127
+ }
128
+ return !0;
129
+ };
130
+ for (let a = 0; a <= 11; a++)
131
+ e.push({
132
+ value: a,
133
+ selectable: t(a)
134
+ });
135
+ return e;
136
+ }), ie = x(() => {
137
+ const e = [], t = u.value - u.value % 10, a = (n) => {
138
+ if (l.minDate && l.minDate.getFullYear() > n || l.maxDate && l.maxDate.getFullYear() < n)
139
+ return !1;
140
+ if (l.maxYear && l.maxYear === "current") {
141
+ const o = (/* @__PURE__ */ new Date()).getFullYear();
142
+ return n <= o;
143
+ }
144
+ return !0;
145
+ };
146
+ for (let n = 0; n < 10; n++)
147
+ e.push({
148
+ value: t + n,
149
+ selectable: a(t + n)
150
+ });
151
+ return e;
152
+ }), G = x(() => {
153
+ let e;
154
+ if (r.value && Q(r.value) ? e = r.value[M(r.value)] || r.value[0] : e = r.value, e && typeof e != "string" && e.toString() !== "Invalid Date")
155
+ return e;
156
+ const t = O.now().setZone(H).toUTC().toJSDate();
157
+ return l.maxDate && l.maxDate < t ? l.maxDate : l.minDate && l.minDate > t ? l.minDate : t;
158
+ }), at = x(() => l.invalid || !!qe["error-message"]), K = x(() => {
159
+ var e;
160
+ return Q(r.value) ? !r.value || ((e = r.value) == null ? void 0 : e.length) === 0 : !1;
161
+ }), M = (e) => (e == null ? void 0 : e.length) > 2 ? (e == null ? void 0 : e.length) - 1 : 1, lt = () => {
162
+ const e = new Date(u.value, D.value, 1), t = new Date(u.value, D.value + 1, 0), a = t.getDate(), n = e.getDay(), o = t.getDay(), s = [];
163
+ let m = 1 - n;
164
+ for (; m <= a; ) {
165
+ const i = [];
166
+ for (let U = 0; U < 7; U++)
167
+ i.push({
168
+ day: m,
169
+ month: D.value,
170
+ year: u.value,
171
+ otherMonth: m < 1 || m > a,
172
+ today: m === Qe.getDate() && D.value === (/* @__PURE__ */ new Date()).getMonth() && u.value === (/* @__PURE__ */ new Date()).getFullYear(),
173
+ selectable: ft(
174
+ m,
175
+ D.value,
176
+ u.value
177
+ )
178
+ }), m++;
179
+ s.push(i);
180
+ }
181
+ if (o !== 6) {
182
+ const i = s[s.length - 1];
183
+ let U = 1;
184
+ for (let Y = o + 1; Y < 7; Y++)
185
+ i[Y].day = U++, i[Y].otherMonth = !0;
186
+ }
187
+ return s;
188
+ }, nt = () => {
189
+ D.value === 0 ? (u.value--, D.value = 11) : D.value--, L();
190
+ }, ot = () => {
191
+ u.value--;
192
+ }, He = () => {
193
+ u.value++;
194
+ }, rt = () => {
195
+ D.value === 11 ? (He(), D.value = 0) : D.value++, L();
196
+ }, st = () => {
197
+ u.value -= 10;
198
+ }, it = () => {
199
+ u.value += 10;
200
+ }, ut = () => {
201
+ p.value === "date" ? nt() : p.value === "month" ? ot() : st();
202
+ }, dt = () => {
203
+ p.value === "date" ? rt() : p.value === "month" ? He() : it();
204
+ }, L = () => {
205
+ Ve.value = lt();
206
+ }, Z = () => r.value != null && typeof r.value != "string", z = (e) => l.selectionMode === "single" && (!Array.isArray(r.value) || r.value == null), V = () => l.selectionMode === "range" && (Array.isArray(r.value) || r.value == null), A = () => l.selectionMode === "multiple" && (Array.isArray(r.value) || r.value == null), Q = (e) => A() || V(), E = (e, t) => {
207
+ if (e) {
208
+ if (H) {
209
+ const a = O.fromJSDate(e).setZone(H);
210
+ return a.day === t.day && a.month === t.month + 1 && a.year === t.year;
211
+ }
212
+ return e.getDate() === t.day && e.getMonth() === t.month && e.getFullYear() === t.year;
213
+ }
214
+ return !1;
215
+ }, ct = (e, t, a) => {
216
+ if (e && t) {
217
+ const o = new Date(a.year, a.month, a.day);
218
+ return e.getTime() <= o.getTime() && t.getTime() >= o.getTime();
219
+ }
220
+ return !1;
221
+ }, X = (e) => {
222
+ if (!Z())
223
+ return !1;
224
+ if (r.value) {
225
+ if (z(r.value))
226
+ return E(r.value, e);
227
+ if (A())
228
+ return r.value.some(
229
+ (t) => E(t, e)
230
+ );
231
+ if (V())
232
+ return r.value[M(r.value)] ? E(r.value[0], e) || E(
233
+ r.value[M(r.value)],
234
+ e
235
+ ) || ct(
236
+ r.value[0],
237
+ r.value[M(r.value)],
238
+ e
239
+ ) : E(r.value[0], e);
240
+ }
241
+ return !1;
242
+ }, vt = (e) => z(r.value) || A() ? X(e) : V() ? X(e) && (E(r.value[0], e) || r.value[0] == null) : !1, mt = (e) => z(r.value) || A() ? X(e) : V() ? X(e) && (E(
243
+ r.value[M(r.value)],
244
+ e
245
+ ) || r.value[M(r.value)] == null) : !1, Ae = (e) => {
246
+ if (Z()) {
247
+ if (z(r.value))
248
+ return r.value.getMonth() === e && r.value.getFullYear() === u.value;
249
+ if (A())
250
+ return r.value.some(
251
+ (t) => t.getMonth() === e && t.getFullYear() === u.value
252
+ );
253
+ if (V()) {
254
+ const [t, a] = r.value;
255
+ if (t && a) {
256
+ const n = new Date(
257
+ y(t).year,
258
+ y(t).month
259
+ ), o = new Date(
260
+ y(a).year,
261
+ y(a).month
262
+ ), s = new Date(u.value, e);
263
+ return s >= n && s <= o;
264
+ }
265
+ }
266
+ }
267
+ return !1;
268
+ }, Pe = (e) => {
269
+ var t;
270
+ if (Z()) {
271
+ if (z(r.value))
272
+ return ((t = r.value) == null ? void 0 : t.getFullYear()) === e;
273
+ if (A())
274
+ return r.value.some(
275
+ (a) => a.getFullYear() === e
276
+ );
277
+ if (V()) {
278
+ const [a, n] = r.value;
279
+ return e >= a.getFullYear() && e <= (n ?? a).getFullYear();
280
+ }
281
+ }
282
+ return !1;
283
+ }, ft = (e, t, a) => {
284
+ let n = !0, o = !0, s = !0, m = !0;
285
+ if (l.onlyWeekdays) {
286
+ const i = new Date(a, t, e).getDay();
287
+ s = i >= 1 && i <= 5;
288
+ }
289
+ return l.excludeDates && (m = !l.excludeDates.some(
290
+ (i) => i.getFullYear() === a && i.getMonth() === t && i.getDate() === e
291
+ )), l.minDate && (l.minDate.getFullYear() > a || l.minDate.getFullYear() === a && (l.minDate.getMonth() > t || l.minDate.getMonth() === t && l.minDate.getDate() > e)) && (n = !1), l.maxDate && (l.maxDate.getFullYear() < a || l.maxDate.getFullYear() === a && (l.maxDate.getMonth() < t || l.maxDate.getMonth() === t && l.maxDate.getDate() < e)) && (o = !1), n && o && s && m;
292
+ }, be = (e, t) => {
293
+ e.currentTarget instanceof HTMLElement && e.currentTarget.focus(), t.selectable && It(t), l.selectionMode === "single" && (!l.showTime || l.hideOnDateTimeSelect) && te();
294
+ }, pt = (e, t) => {
295
+ t.selectable && (l.view === "month" ? be(e, {
296
+ year: u.value,
297
+ month: t.value,
298
+ day: 1,
299
+ selectable: !0,
300
+ today: !1,
301
+ otherMonth: !1
302
+ }) : (D.value = t.value, p.value = "date", N("monthChange", {
303
+ month: D.value,
304
+ year: u.value
305
+ })), L());
306
+ }, ht = (e, t) => {
307
+ t.selectable && (l.view === "year" ? be(e, {
308
+ year: t.value,
309
+ month: 0,
310
+ day: 1,
311
+ selectable: !0,
312
+ otherMonth: !1,
313
+ today: !1
314
+ }) : (u.value = t.value, p.value = "month", N("yearChange", {
315
+ month: D.value + 1,
316
+ year: u.value
317
+ })), L());
318
+ }, k = (e, t, a) => {
319
+ !l.disabled && !l.readonly && (Oe(e, null, t, a), e.preventDefault());
320
+ }, T = (e) => {
321
+ !l.disabled && !l.readonly && (Me(), ee(), e.preventDefault());
322
+ }, ue = () => {
323
+ Me();
324
+ }, de = (e) => {
325
+ switch (e.code) {
326
+ case "Tab":
327
+ break;
328
+ case "Escape":
329
+ te(), e.preventDefault();
330
+ break;
331
+ }
332
+ }, Ne = (e) => {
333
+ l.disabled || setTimeout(() => {
334
+ oe.value.show(e, Ue(e));
335
+ }, 0);
336
+ }, gt = (e) => {
337
+ l.disabled || setTimeout(() => {
338
+ var t;
339
+ (t = oe.value) == null || t.toggle(e, Ue(e));
340
+ }, 0);
341
+ }, yt = () => {
342
+ p.value = l.view, ke(), re.value || Ze();
343
+ }, Ue = (e) => ("$el" in ge.value ? ge.value.$el : Ce.value) ?? e.currentTarget, Oe = (e, t, a, n) => {
344
+ switch (t || (t = 500), Me(), De.value = setTimeout(() => {
345
+ Oe(e, 100, a, n);
346
+ }, t), a) {
347
+ case 0:
348
+ n === 1 ? Dt(e) : wt(e);
349
+ break;
350
+ case 1:
351
+ n === 1 ? bt(e) : Mt(e);
352
+ break;
353
+ }
354
+ }, Dt = (e) => {
355
+ const t = d.value;
356
+ let a = d.value + Number(l.stepHour), n = w.value;
357
+ l.hourFormat == "24" ? a = a >= 24 ? a - 24 : a : l.hourFormat == "12" && (t < 12 && a > 11 && (n = !w.value), a = a >= 13 ? a - 12 : a), _(a, f.value, I.value, n) && (d.value = a, w.value = n), e.preventDefault();
358
+ }, wt = (e) => {
359
+ let t = d.value - l.stepHour, a = w.value;
360
+ l.hourFormat == "24" ? t = t < 0 ? 24 + t : t : l.hourFormat == "12" && (d.value === 12 && (a = !w.value), t = t <= 0 ? 12 + t : t), _(t, f.value, I.value, a) && (d.value = t, w.value = a), e.preventDefault();
361
+ }, bt = (e) => {
362
+ const t = f.value + Number(l.stepMinute);
363
+ _(d.value, t, I.value, w.value) && (f.value = t > 59 ? t - 60 : t), e.preventDefault();
364
+ }, Mt = (e) => {
365
+ let t = f.value - l.stepMinute;
366
+ t = t < 0 ? 60 + t : t, _(d.value, t, I.value, w.value) && (f.value = t), e.preventDefault();
367
+ }, Me = () => {
368
+ De.value && clearInterval(De.value);
369
+ }, _ = (e, t, a, n) => {
370
+ let o;
371
+ const s = kt(e, n);
372
+ if (Q(r.value)) {
373
+ const i = Z() ? r.value : G.value;
374
+ o = i[M(i)] || i[0];
375
+ } else
376
+ o = Z() ? r.value : G.value;
377
+ const m = o ? o.toDateString() : null;
378
+ return !(l.minDate && m && l.minDate.toDateString() === m && (l.minDate.getHours() > s || l.minDate.getHours() === s && (l.minDate.getMinutes() > t || l.minDate.getMinutes() === t && l.minDate.getSeconds() > a)) || l.maxDate && m && l.maxDate.toDateString() === m && (l.maxDate.getHours() < s || l.maxDate.getHours() === s && (l.maxDate.getMinutes() < t || l.maxDate.getMinutes() === t && l.maxDate.getSeconds() < a)));
379
+ }, kt = (e, t) => l.hourFormat == "12" ? e === 12 ? t ? 12 : 0 : t ? e + 12 : e : e, ee = () => {
380
+ const e = (o) => {
381
+ const s = y(o);
382
+ return Ee({
383
+ day: s.date,
384
+ // Use dateTz.date to match Date.getDate(), because dateTz.day is 0-6 (Sunday-Saturday)
385
+ month: s.month,
386
+ year: s.year
387
+ });
388
+ };
389
+ Be.value = !0;
390
+ let t;
391
+ const a = Array.isArray(r.value) ? r.value.map((o) => e(o)) : e(r.value);
392
+ if (Q(r.value)) {
393
+ const o = Z() ? a : e(G.value);
394
+ t = o[M(o)] || o[0];
395
+ } else
396
+ t = Z() ? a : e(G.value);
397
+ t = t && !Array.isArray(t) ? t : e(), l.hourFormat == "12" ? d.value === 12 ? t = t.set({ hour: w.value ? 12 : 0 }) : t = t.set({
398
+ hour: w.value ? d.value + 12 : d.value
399
+ }) : t = t.set({ hour: d.value }), t = t.set({
400
+ minute: f.value,
401
+ second: I.value
402
+ }), Q(r.value) && (A() ? t = a == null ? void 0 : a.map(
403
+ (o) => O.fromISO(o.toISO())
404
+ ) : V() && (r.value[M(r.value)] ? t = [a[0], t] : t = [t, null]));
405
+ const n = Array.isArray(t) ? t.map((o) => o == null ? void 0 : o.toJSDate()) : t.toJSDate();
406
+ Ke(n), N("dateSelect", n), setTimeout(() => Be.value = !1, 0);
407
+ }, Je = (e) => e ? Array.isArray(e) ? e.map((a) => a == null ? void 0 : a.getTime()) : e.getTime() : null, Ke = (e) => {
408
+ l.showButtons || l.showTime ? (J.value = e, re.value = !1) : (N("update:epochTimeMillis", Je(e)), N("update:modelValue", e));
409
+ }, Tt = () => {
410
+ N("update:epochTimeMillis", Je(J.value)), N("update:modelValue", J.value), re.value = !0, te();
411
+ }, Ze = () => {
412
+ J.value = l.modelValue, re.value = !0, te();
413
+ }, St = () => {
414
+ !_(
415
+ d.value,
416
+ f.value,
417
+ I.value,
418
+ !w.value
419
+ ) && (l.maxDate || l.minDate) || (w.value = !w.value, ee());
420
+ }, ke = () => {
421
+ const e = y(G.value);
422
+ D.value = e.month, u.value = e.year, l.showTime && $t(e);
423
+ }, $t = (e) => {
424
+ let { hour: t } = e;
425
+ l.hourFormat === "12" && (w.value = t > 11, t >= 12 ? t = t == 12 ? 12 : t - 12 : t = t == 0 ? 12 : t), d.value = Math.floor(t / l.stepHour) * l.stepHour, f.value = Math.floor(e.minute / l.stepMinute) * l.stepMinute;
426
+ }, ze = () => {
427
+ const e = l.showButtons || l.showTime ? J.value : r.value;
428
+ if (typeof e == "string")
429
+ return e;
430
+ let t = "";
431
+ if (e)
432
+ try {
433
+ if (z(e))
434
+ e.toString() !== "Invalid Date" && (t = ce(e));
435
+ else if (A())
436
+ e && e.length && (t = e.map((a) => ce(a)).join(", "));
437
+ else if (V() && e && e.length) {
438
+ const a = e[0], n = e[M(e)];
439
+ a.toString() !== "Invalid Date" && (t = ce(a)), n && n.toString() !== "Invalid Date" && (t += " - " + ce(n));
440
+ }
441
+ } catch {
442
+ t = e.toString();
443
+ }
444
+ return t;
445
+ }, ce = (e) => {
446
+ let t = null;
447
+ return e && (t = Ct(e, et.value), l.showTime && (t += " " + Ft(e))), t;
448
+ }, Ct = (e, t) => {
449
+ if (!e)
450
+ return "";
451
+ const a = y(e);
452
+ let n;
453
+ const o = (Y) => {
454
+ const W = n + 1 < t.length && t.charAt(n + 1) === Y;
455
+ return W && n++, W;
456
+ }, s = (Y, W, Te) => {
457
+ let R = "" + W;
458
+ if (o(Y))
459
+ for (; R.length < Te; )
460
+ R = "0" + R;
461
+ return R;
462
+ }, m = (Y, W, Te, R) => o(Y) ? R[W] : Te[W];
463
+ let i = "", U = !1;
464
+ if (e)
465
+ for (n = 0; n < t.length; n++)
466
+ if (U)
467
+ t.charAt(n) === "'" && !o("'") ? U = !1 : i += t.charAt(n);
468
+ else
469
+ switch (t.charAt(n)) {
470
+ case "d":
471
+ i += s("d", a.date, 2);
472
+ break;
473
+ case "D":
474
+ i += m(
475
+ "D",
476
+ a.day,
477
+ F.locale.global.dayNamesShort,
478
+ F.locale.global.dayNames
479
+ );
480
+ break;
481
+ case "o":
482
+ i += s(
483
+ "o",
484
+ Math.round(
485
+ (new Date(
486
+ a.year,
487
+ a.month,
488
+ a.date
489
+ ).getTime() - new Date(a.year, 0, 0).getTime()) / 864e5
490
+ ),
491
+ 3
492
+ );
493
+ break;
494
+ case "m":
495
+ i += s("m", a.month + 1, 2);
496
+ break;
497
+ case "M":
498
+ i += m(
499
+ "M",
500
+ a.month,
501
+ F.locale.global.monthNamesShort,
502
+ F.locale.global.monthNames
503
+ );
504
+ break;
505
+ case "y":
506
+ i += o("y") ? a.year : (a.year % 100 < 10 ? "0" : "") + a.year % 100;
507
+ break;
508
+ case "@":
509
+ i += a.time;
510
+ break;
511
+ case "!":
512
+ i += a.time * 1e4 + Ge;
513
+ break;
514
+ case "'":
515
+ o("'") ? i += "'" : U = !0;
516
+ break;
517
+ default:
518
+ i += t.charAt(n);
519
+ }
520
+ return i;
521
+ }, Ft = (e) => {
522
+ if (!e)
523
+ return "";
524
+ const t = y(e);
525
+ let a = "", n = t.hour;
526
+ const o = t.minute;
527
+ return l.hourFormat === "12" && n > 11 && n !== 12 && (n -= 12), l.hourFormat === "12" ? a += n === 0 ? 12 : n < 10 ? "0" + n : n : a += n < 10 ? "0" + n : n, a += ":", a += o < 10 ? "0" + o : o, l.hourFormat === "12" && (a += t.hour > 11 ? ` ${F.locale.global.pm}` : ` ${F.locale.global.am}`), a;
528
+ }, Ee = (e) => {
529
+ const { year: t, month: a, day: n } = e, o = O.local().setZone(H).isValid ? H : Intl.DateTimeFormat().resolvedOptions().timeZone;
530
+ return O.fromObject(
531
+ {
532
+ year: t,
533
+ month: a + 1,
534
+ day: n,
535
+ hour: l.showTime ? d.value : 0,
536
+ minute: l.showTime ? f.value : 0,
537
+ second: l.showTime ? I.value : 0
538
+ },
539
+ { zone: o }
540
+ );
541
+ }, It = (e) => {
542
+ const t = Ee(e);
543
+ if (l.showTime && t.set({
544
+ hour: d.value + (l.hourFormat === "12" && d.value !== 12 && w.value ? 12 : 0),
545
+ minute: f.value,
546
+ second: I.value
547
+ }), l.minDate && l.minDate > t.toUTC().toJSDate()) {
548
+ const n = y(l.minDate);
549
+ t.set({
550
+ year: n.year,
551
+ month: n.month,
552
+ day: n.day,
553
+ hour: n.hour,
554
+ minute: n.minute,
555
+ second: n.second
556
+ }), d.value = t.hour, f.value = t.minute, I.value = t.second;
557
+ }
558
+ if (l.maxDate && l.maxDate < t.toUTC().toJSDate()) {
559
+ const n = y(l.maxDate);
560
+ t.set({
561
+ year: n.year,
562
+ month: n.month,
563
+ day: n.day,
564
+ hour: n.hour,
565
+ minute: n.minute,
566
+ second: n.second
567
+ }), d.value = t.hour, f.value = t.minute, I.value = t.second;
568
+ }
569
+ let a = null;
570
+ if (z(r.value))
571
+ a = t.toUTC().toJSDate();
572
+ else if (A()) {
573
+ let n = r.value;
574
+ if (n && n.length) {
575
+ const o = n.findIndex(
576
+ (s) => s.getFullYear() === t.year && s.getMonth() === t.month && s.getDate() === t.day
577
+ );
578
+ o !== -1 ? n.splice(o, 1) : n = [...n, t.toUTC().toJSDate()], n.sort((s, m) => s.getTime() - m.getTime());
579
+ } else n = [t.toUTC().toJSDate()];
580
+ a = n;
581
+ } else if (l.exactSelection)
582
+ a = Yt(e, t.toUTC().toJSDate());
583
+ else if (V())
584
+ if (r.value && r.value.length) {
585
+ let n = r.value[0], o = r.value[M(r.value)];
586
+ !o && t.toMillis() >= n.getTime() ? o = t.toUTC().toJSDate() : (n = t.toUTC().toJSDate(), o = null), a = [n, o];
587
+ } else
588
+ a = [t.toUTC().toJSDate(), null];
589
+ a !== null && Ke(a), Vt(a), N("dateSelect", t.toUTC().toJSDate());
590
+ }, Vt = (e) => {
591
+ const t = l.exactSelection ? e.length > 1 : e && e[M(e)] !== null;
592
+ V() && l.hideOnRangeSelection && !l.showButtons && !l.showTime && t && te();
593
+ }, Yt = (e, t) => {
594
+ const a = we.value;
595
+ if (!we.value || a.day === e.day)
596
+ return we.value = e, xe.value = se.value, [t];
597
+ const n = a.month === e.month ? se.value.filter((o) => o.day > a.day && o.day < e.day).map((o) => new Date(o.year, o.month, o.day)) : [
598
+ ...xe.value.filter((o) => !o.otherMonth && o.day > a.day).map((o) => new Date(o.year, o.month, o.day)),
599
+ ...se.value.filter((o) => !o.otherMonth && o.day < e.day).map((o) => new Date(o.year, o.month, o.day))
600
+ ];
601
+ return [
602
+ new Date(a.year, a.month, a.day),
603
+ ...n,
604
+ t
605
+ ];
606
+ }, te = () => {
607
+ setTimeout(() => {
608
+ var e;
609
+ (e = oe.value) == null || e.hide();
610
+ }, 150);
611
+ }, ve = (e) => {
612
+ e === "hour" ? Fe.value++ : Ie.value++, ee();
613
+ }, Bt = (e) => {
614
+ const t = "hour";
615
+ if (!e || parseInt(e) === 0)
616
+ me(t, e);
617
+ else {
618
+ me.cancel();
619
+ const a = parseInt(e);
620
+ l.hourFormat === "12" && a > 12 ? (d.value = Math.min(Math.max(a, 1), 12), ve(t)) : l.hourFormat === "24" && a > 23 ? (d.value = Math.min(Math.max(a, 0), 23), ve(t)) : (d.value = a, ee());
621
+ }
622
+ }, xt = (e) => {
623
+ const t = "minute";
624
+ if (!e || parseInt(e) === 0)
625
+ me(t, e);
626
+ else {
627
+ me.cancel();
628
+ const a = parseInt(e);
629
+ a > 59 ? (f.value = Math.min(Math.max(a, 0), 59), ve(t)) : (f.value = a, ee());
630
+ }
631
+ }, me = jt((e, t) => {
632
+ (!t || parseInt(t) === 0) && (e === "hour" ? d.value = l.hourFormat === "12" ? 1 : 0 : f.value = 0, ve(e));
633
+ }, 2e3);
634
+ return Se(
635
+ () => [
636
+ l.minDate,
637
+ l.maxDate,
638
+ l.excludeDates,
639
+ l.maxYear,
640
+ l.maxMonth
641
+ ],
642
+ () => L()
643
+ ), Se(
644
+ () => r.value,
645
+ () => {
646
+ ke(), ye.value = ze();
647
+ },
648
+ {
649
+ immediate: !0
650
+ }
651
+ ), (l.showButtons || l.showTime) && Se(
652
+ J,
653
+ () => {
654
+ ke(), ye.value = ze();
655
+ },
656
+ {
657
+ immediate: !0,
658
+ deep: !0
659
+ }
660
+ ), (e, t) => (v(), ae(Wt, {
661
+ ref_key: "wrapper",
662
+ ref: ge,
663
+ info: e.fieldInfo,
664
+ label: e.label,
665
+ mandatory: e.mandatory,
666
+ "show-optional-text": e.showOptionalText
667
+ }, {
668
+ default: $e(() => [
669
+ j(e.$slots, "default", { onClick: Ne }, () => [
670
+ S(Lt, {
671
+ disabled: e.disabled,
672
+ invalid: at.value
673
+ }, {
674
+ default: $e(() => [
675
+ g("span", c(e.$preset.calendar.root({ props: l }), {
676
+ id: e.id,
677
+ "data-wv-name": "calendar",
678
+ "data-wv-section": "root"
679
+ }), [
680
+ g("input", c({
681
+ id: e.inputId,
682
+ ref_key: "input",
683
+ ref: Ce,
684
+ "aria-invalid": e.invalid || void 0,
685
+ disabled: e.disabled,
686
+ placeholder: e.placeholder ?? q(F).locale.defaultPlaceholder,
687
+ tabindex: 0,
688
+ value: ye.value,
689
+ onClick: Ne,
690
+ "aria-autocomplete": "none",
691
+ autocomplete: "off",
692
+ inputmode: "none",
693
+ readonly: "",
694
+ role: "combobox",
695
+ type: "text"
696
+ }, e.$preset.calendar.input({ props: l })), null, 16, Gt),
697
+ S(ne, c({
698
+ onClick: gt,
699
+ icon: "calendar"
700
+ }, e.$preset.calendar.inputicon), null, 16)
701
+ ], 16, qt)
702
+ ]),
703
+ _: 1
704
+ }, 8, ["disabled", "invalid"])
705
+ ]),
706
+ S(q(Zt), {
707
+ ref_key: "overlayPanel",
708
+ ref: oe,
709
+ pt: {
710
+ root: {
711
+ class: [e.$preset.overlaypanel.root.class, "!mt-0", l.overlayClass]
712
+ }
713
+ },
714
+ onHide: yt
715
+ }, {
716
+ default: $e(() => [
717
+ g("div", c(e.$preset.calendar.panel({ props: l }), { "data-wv-section": "panel" }), [
718
+ g("div", c(e.$preset.calendar.container, { "data-wv-section": "container" }), [
719
+ g("div", c(e.$preset.calendar.header({ props: l, state: { currentView: p.value } }), { "data-wv-section": "navigation" }), [
720
+ S(pe, {
721
+ onClick: ut,
722
+ class: "rotate-180 !p-1",
723
+ "data-wv-section": "prevbutton",
724
+ icon: "arrow-right",
725
+ "icon-class": "w-5 h-5",
726
+ severity: "secondary",
727
+ text: ""
728
+ }),
729
+ g("div", Qt, [
730
+ p.value == "date" ? (v(), h("button", c({ key: 0 }, e.$preset.calendar.monthTitle, {
731
+ onClick: t[0] || (t[0] = (a) => p.value = "month")
732
+ }), P(e.$wangsvue.config.locale.global.monthNamesShort[D.value]), 17)) : C("", !0),
733
+ p.value != "year" ? (v(), h("button", c({ key: 1 }, e.$preset.calendar.yearTitle({ props: l }), {
734
+ onClick: t[1] || (t[1] = (a) => p.value = "year")
735
+ }), P(u.value), 17)) : C("", !0),
736
+ p.value == "year" ? (v(), h("span", Xt, P(ie.value[0].value) + " - " + P(ie.value[ie.value.length - 1].value), 1)) : C("", !0)
737
+ ]),
738
+ S(pe, {
739
+ onClick: dt,
740
+ class: "!p-1",
741
+ "data-wv-section": "nextbutton",
742
+ icon: "arrow-right",
743
+ "icon-class": "w-5 h-5",
744
+ severity: "secondary",
745
+ text: ""
746
+ })
747
+ ], 16),
748
+ p.value === "date" ? (v(), h("div", _t, [
749
+ g("div", ea, [
750
+ g("div", ta, [
751
+ (v(!0), h(le, null, fe(e.$wangsvue.config.locale.global.dayNamesShort, (a) => (v(), h("span", {
752
+ key: a,
753
+ abbr: "day",
754
+ class: "text-center",
755
+ "data-wv-section": "weekday"
756
+ }, P(a), 1))), 128))
757
+ ])
758
+ ]),
759
+ g("div", aa, [
760
+ (v(!0), h(le, null, fe(se.value, (a, n) => (v(), h("span", {
761
+ key: n,
762
+ "aria-label": a.day.toString(),
763
+ "data-wv-other-month": a.otherMonth,
764
+ "data-wv-today": a.today,
765
+ "data-wv-section": "day"
766
+ }, [
767
+ Ye.value && !a.otherMonth ? (v(), ae(q(Et), {
768
+ key: 0,
769
+ class: "!w-8 !h-8",
770
+ shape: "circle"
771
+ })) : Ye.value ? C("", !0) : (v(), h("span", c(
772
+ {
773
+ key: 1,
774
+ "aria-disabled": !a.selectable,
775
+ "data-p-disabled": a.otherMonth || !a.selectable,
776
+ onClick: (o) => be(o, a),
777
+ ref_for: !0
778
+ },
779
+ e.$preset.calendar.daylabel({
780
+ context: {
781
+ date: a,
782
+ today: a.today,
783
+ otherMonth: a.otherMonth,
784
+ selected: X(a),
785
+ firstSelected: vt(a),
786
+ lastSelected: mt(a),
787
+ disabled: !a.selectable
788
+ }
789
+ }),
790
+ {
791
+ "data-wv-section": "daylabel",
792
+ draggable: "false",
793
+ tabindex: "0"
794
+ }
795
+ ), [
796
+ a.otherMonth ? C("", !0) : (v(), h(le, { key: 0 }, [
797
+ Ut(P(a.day), 1)
798
+ ], 64))
799
+ ], 16, na))
800
+ ], 8, la))), 128))
801
+ ])
802
+ ])) : C("", !0),
803
+ p.value === "month" ? (v(), h("div", c({
804
+ key: 1,
805
+ "data-wv-section": "monthpicker"
806
+ }, e.$preset.calendar.monthpicker), [
807
+ (v(!0), h(le, null, fe(tt.value, (a, n) => (v(), h("span", c(
808
+ {
809
+ key: a.value,
810
+ ref_for: !0
811
+ },
812
+ e.$preset.calendar.month({
813
+ context: {
814
+ month: a,
815
+ monthIndex: n,
816
+ selected: Ae(n),
817
+ disabled: !a.selectable
818
+ }
819
+ }),
820
+ {
821
+ "data-p-disabled": !a.selectable,
822
+ "data-p-highlight": Ae(n),
823
+ onClick: (o) => pt(o, a)
824
+ }
825
+ ), P(e.$wangsvue.config.locale.global.monthNamesShort[a.value]), 17, oa))), 128))
826
+ ], 16)) : C("", !0),
827
+ p.value === "year" ? (v(), h("div", Ot(c({ key: 2 }, e.$preset.calendar.yearpicker)), [
828
+ (v(!0), h(le, null, fe(ie.value, (a) => (v(), h("span", c(
829
+ {
830
+ key: a.value,
831
+ ref_for: !0
832
+ },
833
+ e.$preset.calendar.year({
834
+ context: {
835
+ year: a,
836
+ selected: Pe(a.value),
837
+ disabled: !a.selectable
838
+ }
839
+ }),
840
+ {
841
+ "data-p-disabled": !a.selectable,
842
+ "data-p-highlight": Pe(a.value),
843
+ onClick: (n) => ht(n, a)
844
+ }
845
+ ), P(a.value), 17, ra))), 128))
846
+ ], 16)) : C("", !0)
847
+ ], 16),
848
+ e.showTime && p.value === "date" ? (v(), h("div", c({ key: 0 }, e.$preset.calendar.timepicker, { "data-wv-section": "timepicker" }), [
849
+ g("div", c(e.$preset.calendar.hourpicker, { "data-wv-section": "hourpicker" }), [
850
+ g("button", c({
851
+ "aria-label": e.$wangsvue.config.locale.global.nextHour,
852
+ disabled: K.value,
853
+ onKeydown: [
854
+ de,
855
+ t[2] || (t[2] = b((a) => k(a, 0, 1), ["enter"])),
856
+ t[3] || (t[3] = b((a) => k(a, 0, 1), ["space"]))
857
+ ],
858
+ onKeyup: [
859
+ t[4] || (t[4] = b((a) => T(a), ["enter"])),
860
+ t[5] || (t[5] = b((a) => T(a), ["space"]))
861
+ ],
862
+ onMousedown: t[6] || (t[6] = (a) => k(a, 0, 1)),
863
+ onMouseleave: t[7] || (t[7] = (a) => ue()),
864
+ onMouseup: t[8] || (t[8] = (a) => T(a))
865
+ }, e.$preset.calendar.incrementbutton, {
866
+ "data-wv-group-section": "hourpicker",
867
+ "data-wv-section": "incrementbutton",
868
+ type: "button"
869
+ }), [
870
+ j(e.$slots, "incrementicon", {}, () => [
871
+ S(ne, c({
872
+ "data-wv-group-section": "hourpicker",
873
+ "data-wv-section": "incrementicon",
874
+ icon: "arrow-up-s"
875
+ }, e.$preset.calendar.incrementicon), null, 16)
876
+ ])
877
+ ], 16, sa),
878
+ (v(), ae(Le, {
879
+ key: Fe.value,
880
+ "allowed-characters": /^\d+$/,
881
+ disabled: K.value,
882
+ "max-length": 2,
883
+ "model-value": Xe.value.toString(),
884
+ "onUpdate:modelValue": Bt,
885
+ class: "!w-[39px]",
886
+ placeholder: "",
887
+ "prevent-input-on-max-length": ""
888
+ }, null, 8, ["disabled", "model-value"])),
889
+ g("button", c({
890
+ "aria-label": e.$wangsvue.config.locale.global.prevHour,
891
+ disabled: K.value,
892
+ onKeydown: [
893
+ de,
894
+ t[9] || (t[9] = b((a) => k(a, 0, -1), ["enter"])),
895
+ t[10] || (t[10] = b((a) => k(a, 0, -1), ["space"]))
896
+ ],
897
+ onKeyup: [
898
+ t[11] || (t[11] = b((a) => T(a), ["enter"])),
899
+ t[12] || (t[12] = b((a) => T(a), ["space"]))
900
+ ],
901
+ onMousedown: t[13] || (t[13] = (a) => k(a, 0, -1)),
902
+ onMouseleave: t[14] || (t[14] = (a) => ue()),
903
+ onMouseup: t[15] || (t[15] = (a) => T(a))
904
+ }, e.$preset.calendar.decrementbutton, {
905
+ "data-wv-group-section": "hourpicker",
906
+ "data-wv-section": "decrementbutton",
907
+ type: "button"
908
+ }), [
909
+ j(e.$slots, "decrementicon", {}, () => [
910
+ S(ne, c({
911
+ "data-wv-group-section": "hourpicker",
912
+ "data-wv-section": "decrementicon",
913
+ icon: "arrow-down"
914
+ }, e.$preset.calendar.decrementicon), null, 16)
915
+ ])
916
+ ], 16, ia)
917
+ ], 16),
918
+ g("div", c(e.$preset.calendar.separatorcontainer, { "data-wv-section": "separatorcontainer" }), [
919
+ g("span", c(e.$preset.calendar.separator, { "data-wv-section": "separator" }), P(e.timeSeparator), 17)
920
+ ], 16),
921
+ g("div", c(e.$preset.calendar.minutepicker, { "data-wv-section": "minutepicker" }), [
922
+ g("button", c({
923
+ "aria-label": e.$wangsvue.config.locale.global.nextMinute,
924
+ disabled: e.disabled || K.value,
925
+ onKeydown: [
926
+ de,
927
+ t[16] || (t[16] = b((a) => k(a, 1, 1), ["enter"])),
928
+ t[17] || (t[17] = b((a) => k(a, 1, 1), ["space"]))
929
+ ],
930
+ onKeyup: [
931
+ t[18] || (t[18] = b((a) => T(a), ["enter"])),
932
+ t[19] || (t[19] = b((a) => T(a), ["space"]))
933
+ ],
934
+ onMousedown: t[20] || (t[20] = (a) => k(a, 1, 1)),
935
+ onMouseleave: t[21] || (t[21] = (a) => ue()),
936
+ onMouseup: t[22] || (t[22] = (a) => T(a))
937
+ }, e.$preset.calendar.incrementbutton, {
938
+ "data-wv-group-section": "minutepicker",
939
+ "data-wv-section": "incrementbutton",
940
+ type: "button"
941
+ }), [
942
+ j(e.$slots, "incrementicon", {}, () => [
943
+ S(ne, c({
944
+ "data-wv-group-section": "minutepicker",
945
+ "data-wv-section": "incrementicon",
946
+ icon: "arrow-up-s"
947
+ }, e.$preset.calendar.incrementicon), null, 16)
948
+ ])
949
+ ], 16, ua),
950
+ (v(), ae(Le, {
951
+ key: Ie.value,
952
+ "allowed-characters": /^\d+$/,
953
+ disabled: K.value,
954
+ "max-length": 2,
955
+ "model-value": _e.value.toString(),
956
+ "onUpdate:modelValue": xt,
957
+ class: "!w-[39px]",
958
+ placeholder: "",
959
+ "prevent-input-on-max-length": ""
960
+ }, null, 8, ["disabled", "model-value"])),
961
+ g("button", c({
962
+ "aria-label": e.$wangsvue.config.locale.global.prevMinute,
963
+ disabled: e.disabled || K.value,
964
+ onKeydown: [
965
+ de,
966
+ t[23] || (t[23] = b((a) => k(a, 1, -1), ["enter"])),
967
+ t[24] || (t[24] = b((a) => k(a, 1, -1), ["space"]))
968
+ ],
969
+ onKeyup: [
970
+ t[25] || (t[25] = b((a) => T(a), ["enter"])),
971
+ t[26] || (t[26] = b((a) => T(a), ["space"]))
972
+ ],
973
+ onMousedown: t[27] || (t[27] = (a) => k(a, 1, -1)),
974
+ onMouseleave: t[28] || (t[28] = (a) => ue()),
975
+ onMouseup: t[29] || (t[29] = (a) => T(a))
976
+ }, e.$preset.calendar.decrementbutton, {
977
+ "data-wv-group-section": "minutepicker",
978
+ "data-wv-section": "decrementbutton",
979
+ type: "button"
980
+ }), [
981
+ j(e.$slots, "decrementicon", {}, () => [
982
+ S(ne, c({
983
+ "data-wv-group-section": "minutepicker",
984
+ "data-wv-section": "decrementicon",
985
+ icon: "arrow-down"
986
+ }, e.$preset.calendar.decrementicon), null, 16)
987
+ ])
988
+ ], 16, da)
989
+ ], 16),
990
+ e.hourFormat === "12" ? (v(), ae(q(zt), {
991
+ key: 0,
992
+ disabled: K.value,
993
+ "model-value": w.value,
994
+ options: [
995
+ { label: "AM", value: !1 },
996
+ { label: "PM", value: !0 }
997
+ ],
998
+ "onUpdate:modelValue": St,
999
+ "option-label": "label",
1000
+ "option-value": "value"
1001
+ }, null, 8, ["disabled", "model-value"])) : C("", !0)
1002
+ ], 16)) : C("", !0),
1003
+ j(e.$slots, "addon-overlay"),
1004
+ e.showButtons || e.showTime ? Nt((v(), h("div", ca, [
1005
+ S(pe, {
1006
+ label: q(F).locale.cancelFooterButtonLabel,
1007
+ onClick: Ze,
1008
+ severity: "secondary",
1009
+ text: ""
1010
+ }, null, 8, ["label"]),
1011
+ S(pe, {
1012
+ disabled: !r.value,
1013
+ label: q(F).locale.applyFooterButtonLabel,
1014
+ onClick: Tt
1015
+ }, null, 8, ["disabled", "label"])
1016
+ ], 512)), [
1017
+ [Jt, p.value === "date"]
1018
+ ]) : C("", !0)
1019
+ ], 16)
1020
+ ]),
1021
+ _: 3
1022
+ }, 8, ["pt"]),
1023
+ S(Rt, {
1024
+ message: e.$attrs["error-message"]
1025
+ }, null, 8, ["message"])
1026
+ ]),
1027
+ _: 3
1028
+ }, 8, ["info", "label", "mandatory", "show-optional-text"]));
1029
+ }
1030
+ });
1031
+ export {
1032
+ $a as _
1033
+ };