@fewangsit/wangsvue-fats 1.0.1-alpha.53 → 1.0.1-alpha.55

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