@signal24/vue-foundation 3.8.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/.eslintrc.cjs +35 -0
  2. package/.prettierrc.json +4 -2
  3. package/dist/src/components/ajax-select.vue.d.ts +21 -0
  4. package/dist/src/components/alert-helpers.d.ts +8 -0
  5. package/dist/src/components/alert-modal.vue.d.ts +27 -0
  6. package/dist/src/components/ez-smart-select.vue.d.ts +27 -0
  7. package/dist/src/components/index.d.ts +8 -0
  8. package/dist/src/components/modal-container.d.ts +33 -0
  9. package/dist/src/components/modal.vue.d.ts +34 -0
  10. package/dist/src/components/smart-select.vue.d.ts +121 -0
  11. package/dist/src/config.d.ts +8 -0
  12. package/dist/src/directives/autofocus.d.ts +2 -0
  13. package/dist/src/directives/confirm-button.d.ts +2 -0
  14. package/dist/src/directives/date-input.d.ts +2 -0
  15. package/dist/src/directives/datetime.d.ts +2 -0
  16. package/dist/src/directives/disabled.d.ts +2 -0
  17. package/dist/src/directives/duration.d.ts +2 -0
  18. package/dist/src/directives/index.d.ts +24 -0
  19. package/dist/src/directives/infinite-scroll.d.ts +3 -0
  20. package/dist/src/directives/readonly.d.ts +2 -0
  21. package/dist/src/directives/tooltip.d.ts +41 -0
  22. package/dist/src/filters/index.d.ts +39 -0
  23. package/dist/src/helpers/array.d.ts +3 -0
  24. package/dist/src/helpers/context-menu.d.ts +13 -0
  25. package/dist/src/helpers/delay.d.ts +2 -0
  26. package/dist/src/helpers/error.d.ts +7 -0
  27. package/dist/src/helpers/index.d.ts +9 -0
  28. package/dist/src/helpers/mask.d.ts +15 -0
  29. package/dist/src/helpers/number.d.ts +1 -0
  30. package/dist/src/helpers/object.d.ts +2 -0
  31. package/dist/src/helpers/openapi.d.ts +34 -0
  32. package/dist/src/helpers/string.d.ts +5 -0
  33. package/dist/src/hooks/index.d.ts +2 -0
  34. package/dist/src/hooks/infinite-scroll.d.ts +30 -0
  35. package/dist/src/hooks/resize-watcher.d.ts +1 -0
  36. package/dist/src/index.d.ts +8 -0
  37. package/dist/src/types.d.ts +14 -0
  38. package/dist/src/vite-plugins/index.d.ts +1 -0
  39. package/dist/src/vite-plugins/index.js +2 -0
  40. package/dist/src/vite-plugins/vite-openapi-plugin.d.ts +4 -0
  41. package/dist/src/vite-plugins/vite-openapi-plugin.js +58 -0
  42. package/dist/vue-foundation.css +1 -0
  43. package/dist/vue-foundation.es.js +1129 -0
  44. package/package.json +44 -16
  45. package/src/components/ajax-select.vue +44 -23
  46. package/src/components/alert-helpers.ts +45 -0
  47. package/src/components/alert-modal.vue +68 -0
  48. package/src/components/ez-smart-select.vue +51 -0
  49. package/src/components/index.ts +10 -0
  50. package/src/components/modal-container.ts +131 -0
  51. package/src/components/modal.vue +44 -129
  52. package/src/components/smart-select.vue +196 -243
  53. package/src/config.ts +15 -0
  54. package/src/directives/autofocus.ts +20 -0
  55. package/src/directives/confirm-button.ts +50 -0
  56. package/src/directives/date-input.ts +19 -0
  57. package/src/directives/datetime.ts +48 -0
  58. package/src/directives/disabled.ts +30 -0
  59. package/src/directives/duration.ts +79 -0
  60. package/src/directives/index.ts +37 -0
  61. package/src/directives/infinite-scroll.ts +9 -0
  62. package/src/directives/readonly.ts +15 -0
  63. package/src/directives/tooltip.ts +190 -0
  64. package/src/filters/index.ts +79 -0
  65. package/src/helpers/array.ts +7 -0
  66. package/src/helpers/context-menu.ts +108 -0
  67. package/src/helpers/delay.ts +2 -0
  68. package/src/helpers/error.ts +41 -0
  69. package/src/helpers/index.ts +9 -0
  70. package/src/helpers/mask.ts +105 -0
  71. package/src/helpers/number.ts +3 -0
  72. package/src/helpers/object.ts +19 -0
  73. package/src/helpers/openapi.ts +82 -0
  74. package/src/helpers/string.ts +27 -0
  75. package/src/hooks/index.ts +2 -0
  76. package/src/hooks/infinite-scroll.ts +107 -0
  77. package/src/hooks/resize-watcher.ts +8 -0
  78. package/src/index.ts +14 -0
  79. package/src/types.ts +14 -0
  80. package/src/vite-plugins/index.ts +2 -0
  81. package/src/vite-plugins/vite-openapi-plugin.ts +71 -0
  82. package/tsconfig.app.json +22 -0
  83. package/tsconfig.json +14 -0
  84. package/tsconfig.node.json +9 -0
  85. package/tsconfig.vite-plugins.json +10 -0
  86. package/tsconfig.vitest.json +9 -0
  87. package/vite.config.js +37 -35
  88. package/vitest.config.js +17 -0
  89. package/.eslintrc.js +0 -16
  90. package/CHANGES.md +0 -13
  91. package/postcss.config.cjs +0 -5
  92. package/src/app.js +0 -25
  93. package/src/components/alert.vue +0 -130
  94. package/src/components/index.js +0 -12
  95. package/src/config.js +0 -11
  96. package/src/directives/autofocus.js +0 -17
  97. package/src/directives/confirm-button.js +0 -40
  98. package/src/directives/date-input.js +0 -18
  99. package/src/directives/datetime.js +0 -46
  100. package/src/directives/disabled.js +0 -28
  101. package/src/directives/duration.js +0 -72
  102. package/src/directives/index.js +0 -10
  103. package/src/directives/infinite-scroll.js +0 -17
  104. package/src/directives/readonly.js +0 -17
  105. package/src/directives/tooltip.js +0 -178
  106. package/src/directives/user-text.js +0 -11
  107. package/src/filters/index.js +0 -82
  108. package/src/helpers/array.js +0 -99
  109. package/src/helpers/context-menu.js +0 -66
  110. package/src/helpers/delay.js +0 -3
  111. package/src/helpers/error.js +0 -36
  112. package/src/helpers/http.js +0 -44
  113. package/src/helpers/index.js +0 -9
  114. package/src/helpers/mask.js +0 -90
  115. package/src/helpers/number.js +0 -6
  116. package/src/helpers/string.js +0 -36
  117. package/src/helpers/vue.js +0 -5
  118. package/src/index.js +0 -33
  119. package/src/plugins/index.js +0 -10
  120. package/src/plugins/infinite-scroll/hook.js +0 -30
  121. package/src/plugins/infinite-scroll.js +0 -100
  122. package/src/plugins/resize-watcher.js +0 -28
@@ -0,0 +1,1129 @@
1
+ var Le = Object.defineProperty;
2
+ var Ie = (e, t, n) => t in e ? Le(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var f = (e, t, n) => (Ie(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ import { defineComponent as M, defineProps as De, defineEmits as He, ref as I, computed as D, openBlock as a, createElementBlock as d, createElementVNode as v, toDisplayString as w, withDirectives as H, createCommentVNode as g, Fragment as $, renderList as W, vModelSelect as $e, reactive as Ae, h as he, markRaw as Be, onMounted as q, onBeforeUnmount as U, getCurrentInstance as fe, createBlock as z, Teleport as Ve, normalizeClass as E, withModifiers as Fe, renderSlot as F, resolveDirective as pe, createSlots as Ne, withCtx as N, unref as R, createTextVNode as J, vModelText as _e, watch as ee, onActivated as me, onDeactivated as ve } from "vue";
5
+ import { debounce as Ke, isEqual as ge, upperFirst as Re, startCase as je, cloneDeep as Pe, remove as We } from "lodash";
6
+ import { escapeHtml as qe } from "@vue/shared";
7
+ import { escapeHtml as $n } from "@vue/shared";
8
+ import { format as j } from "date-fns";
9
+ const Ue = M({
10
+ setup() {
11
+ const e = De();
12
+ He(["update:modelValue"]);
13
+ const t = I(null), n = D(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), i = I(e.modelValue ?? null);
14
+ return { props: e, options: t, renderOptions: n, selectedItem: i };
15
+ },
16
+ watch: {
17
+ loadFn() {
18
+ this.load();
19
+ },
20
+ selectedItem() {
21
+ this.$emit("update:modelValue", this.selectedItem);
22
+ },
23
+ modelValue() {
24
+ this.selectedItem = this.props.modelValue;
25
+ }
26
+ },
27
+ mounted() {
28
+ this.load();
29
+ },
30
+ methods: {
31
+ async load() {
32
+ this.options = await this.props.loadFn();
33
+ }
34
+ }
35
+ }), ye = (e, t) => {
36
+ const n = e.__vccOpts || e;
37
+ for (const [i, s] of t)
38
+ n[i] = s;
39
+ return n;
40
+ }, ze = {
41
+ key: 0,
42
+ disabled: ""
43
+ }, Xe = {
44
+ key: 0,
45
+ value: null
46
+ }, Ye = ["value"];
47
+ function Ze(e, t, n, i, s, o) {
48
+ return e.renderOptions ? H((a(), d("select", {
49
+ key: 1,
50
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => e.selectedItem = l)
51
+ }, [
52
+ e.props.nullText ? (a(), d("option", Xe, w(e.props.nullText), 1)) : g("", !0),
53
+ (a(!0), d($, null, W(e.renderOptions, (l, r) => {
54
+ var c;
55
+ return a(), d("option", {
56
+ key: r,
57
+ value: (c = e.options) == null ? void 0 : c[r]
58
+ }, w(l), 9, Ye);
59
+ }), 128))
60
+ ], 512)), [
61
+ [$e, e.selectedItem]
62
+ ]) : (a(), d("select", ze, [
63
+ v("option", null, w(e.props.loadingText || "Loading..."), 1)
64
+ ]));
65
+ }
66
+ const an = /* @__PURE__ */ ye(Ue, [["render", Ze]]);
67
+ let Ge = 0;
68
+ const y = Ae([]), cn = M({
69
+ setup() {
70
+ return () => he("div", { id: "modal-container" }, [
71
+ W(y, (e) => e.vnode)
72
+ ]);
73
+ }
74
+ });
75
+ function Ee(e, t) {
76
+ const n = document.getElementById("vf-modal-target") ?? document.createElement("div");
77
+ n.id = "vf-modal-target", n.removeAttribute("inert"), document.body.appendChild(n);
78
+ const i = Be(e), s = {
79
+ id: String(++Ge),
80
+ component: i,
81
+ props: t,
82
+ vnode: he(i, t)
83
+ };
84
+ return y.push(s), s;
85
+ }
86
+ function Te(e) {
87
+ const t = y.indexOf(e);
88
+ t >= 0 && y.splice(t, 1);
89
+ }
90
+ function dn(e) {
91
+ Oe(e.$);
92
+ }
93
+ function Oe(e) {
94
+ let t = e;
95
+ for (; t && !Qe(t.vnode); )
96
+ t = t.parent;
97
+ }
98
+ function Qe(e) {
99
+ var n, i;
100
+ const t = y.findIndex((s) => s.vnode.component === e.component);
101
+ return t >= 0 ? ((i = (n = y[t].props).callback) == null || i.call(n, void 0), y.splice(t, 1), !0) : !1;
102
+ }
103
+ async function X(e, t) {
104
+ return new Promise((n) => {
105
+ let i = null;
106
+ const o = { ...t, callback: (l) => {
107
+ Te(i), n(l);
108
+ } };
109
+ i = Ee(e, o);
110
+ });
111
+ }
112
+ function A(e, t) {
113
+ return { title: t ? e : void 0, message: t ?? e };
114
+ }
115
+ async function te(e, t) {
116
+ await X(V, A(e, t));
117
+ }
118
+ async function un(e, t) {
119
+ return await X(V, {
120
+ ...A(e, t),
121
+ shouldConfirm: !0
122
+ }) === !0;
123
+ }
124
+ async function hn(e, t) {
125
+ return await X(V, {
126
+ ...A(e, t),
127
+ shouldConfirm: !0,
128
+ classes: ["destructive"]
129
+ }) === !0;
130
+ }
131
+ function fn(e, t) {
132
+ const n = Ee(V, {
133
+ ...A(e, t),
134
+ callback: () => {
135
+ }
136
+ });
137
+ return () => Te(n);
138
+ }
139
+ const C = {
140
+ unhandledErrorSupportText: "please contact support",
141
+ errorHandler: (e) => console.error("Unhandled error:", e),
142
+ defaultDateTimeFormat: "MM/dd/yy HH:mm"
143
+ };
144
+ function pn(e) {
145
+ Object.assign(C, e);
146
+ }
147
+ class B extends Error {
148
+ constructor(t) {
149
+ super(t), this.name = "UserError";
150
+ }
151
+ }
152
+ function Je(e) {
153
+ return e instanceof B ? e.message : `An application error has occurred:
154
+
155
+ ${Y(e).message}
156
+
157
+ Please refresh the page and try again. If this error persists, ${C.unhandledErrorSupportText}.`;
158
+ }
159
+ function Y(e) {
160
+ return e instanceof Error ? e : new Error(String(e));
161
+ }
162
+ async function mn(e, t) {
163
+ const n = Y(e);
164
+ return n instanceof B || C.errorHandler(n), t ? te(t, n) : te(n);
165
+ }
166
+ async function vn(e) {
167
+ const t = Y(e);
168
+ t instanceof B || C.errorHandler(t);
169
+ }
170
+ const et = ["id"], tt = {
171
+ key: 0,
172
+ class: "vf-modal-header"
173
+ }, nt = { class: "vf-modal-content" }, it = {
174
+ key: 1,
175
+ class: "vf-modal-footer"
176
+ }, st = /* @__PURE__ */ M({
177
+ __name: "modal",
178
+ props: {
179
+ id: null,
180
+ closeOnMaskClick: { type: Boolean },
181
+ scrolls: { type: Boolean },
182
+ closeX: { type: Boolean },
183
+ class: null
184
+ },
185
+ emits: ["formSubmit"],
186
+ setup(e) {
187
+ const t = e, n = I();
188
+ q(() => {
189
+ var l;
190
+ window.addEventListener("keydown", s), document.body.classList.add("vf-modal-open"), t.closeOnMaskClick && ((l = n.value) == null || l.addEventListener("click", i));
191
+ }), U(() => {
192
+ document.body.querySelectorAll(".vf-modal").length > 0 || document.body.classList.remove("vf-modal-open");
193
+ });
194
+ function i(l) {
195
+ l.target == n.value && o();
196
+ }
197
+ function s(l) {
198
+ if (l.key === "Esc" || l.key === "Escape") {
199
+ const r = document.querySelectorAll(".vf-modal-wrap");
200
+ r[r.length - 1] === n.value && o();
201
+ }
202
+ }
203
+ function o() {
204
+ const l = fe();
205
+ Oe(l);
206
+ }
207
+ return (l, r) => (a(), z(Ve, { to: "#vf-modal-target" }, [
208
+ v("div", {
209
+ id: e.id,
210
+ class: E(["vf-overlay vf-modal-wrap", t.class]),
211
+ ref_key: "overlay",
212
+ ref: n
213
+ }, [
214
+ v("form", {
215
+ action: ".",
216
+ class: E(["vf-modal", { scrolls: e.scrolls }]),
217
+ onSubmit: r[0] || (r[0] = Fe((c) => l.$emit("formSubmit"), ["prevent"]))
218
+ }, [
219
+ l.$slots.header ? (a(), d("div", tt, [
220
+ F(l.$slots, "header"),
221
+ t.closeX ? (a(), d("i", {
222
+ key: 0,
223
+ class: "close",
224
+ onClick: o
225
+ })) : g("", !0)
226
+ ])) : g("", !0),
227
+ v("div", nt, [
228
+ F(l.$slots, "default")
229
+ ]),
230
+ l.$slots.footer ? (a(), d("div", it, [
231
+ F(l.$slots, "footer")
232
+ ])) : g("", !0)
233
+ ], 34)
234
+ ], 10, et)
235
+ ]));
236
+ }
237
+ });
238
+ const ot = ["innerHtml"], lt = ["innerText"], V = /* @__PURE__ */ M({
239
+ __name: "alert-modal",
240
+ props: {
241
+ isBare: { type: Boolean },
242
+ isHtml: { type: Boolean },
243
+ classes: null,
244
+ title: null,
245
+ message: null,
246
+ shouldConfirm: { type: Boolean },
247
+ callback: { type: Function }
248
+ },
249
+ setup(e) {
250
+ const t = e, n = D(() => t.message instanceof Error ? Je(t.message) : t.message);
251
+ return (i, s) => {
252
+ const o = pe("autofocus");
253
+ return a(), z(st, {
254
+ class: E(["vf-alert", e.classes])
255
+ }, Ne({
256
+ default: N(() => [
257
+ e.isHtml ? (a(), d("div", {
258
+ key: 0,
259
+ innerHtml: e.message,
260
+ class: "user-message"
261
+ }, null, 8, ot)) : (a(), d("div", {
262
+ key: 1,
263
+ innerText: R(n)
264
+ }, null, 8, lt))
265
+ ]),
266
+ _: 2
267
+ }, [
268
+ e.isBare ? void 0 : {
269
+ name: "header",
270
+ fn: N(() => [
271
+ v("h1", null, w(e.title), 1)
272
+ ]),
273
+ key: "0"
274
+ },
275
+ e.isBare ? void 0 : {
276
+ name: "footer",
277
+ fn: N(() => [
278
+ e.shouldConfirm ? (a(), d($, { key: 0 }, [
279
+ H((a(), d("button", {
280
+ class: "primary",
281
+ onClick: s[0] || (s[0] = () => e.callback(!0))
282
+ }, [
283
+ J("Confirm")
284
+ ])), [
285
+ [o]
286
+ ]),
287
+ v("button", {
288
+ class: "default",
289
+ onClick: s[1] || (s[1] = () => e.callback(!1))
290
+ }, "Cancel")
291
+ ], 64)) : H((a(), d("button", {
292
+ key: 1,
293
+ class: "default",
294
+ onClick: s[2] || (s[2] = () => e.callback(!0))
295
+ }, [
296
+ J("OK")
297
+ ])), [
298
+ [o]
299
+ ])
300
+ ]),
301
+ key: "1"
302
+ }
303
+ ]), 1032, ["class"]);
304
+ };
305
+ }
306
+ });
307
+ function gn(e) {
308
+ return e.replace(/\n/g, "<br>");
309
+ }
310
+ function rt(e) {
311
+ return e.replace(/_/g, " ");
312
+ }
313
+ function at(e) {
314
+ const t = e.replace(/\D/g, "").replace(/^1/, "");
315
+ return t.length != 10 ? e : "(" + t.substring(0, 3) + ") " + t.substring(3, 6) + "-" + t.substring(6);
316
+ }
317
+ function ct(e) {
318
+ return "$" + Number(e).toFixed(3).replace(/0$/, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
319
+ }
320
+ const O = Symbol("null"), ne = Symbol("create"), dt = "`1234567890-=[]\\;',./~!@#$%^&*()_+{}|:\"<>?qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM", ut = {
321
+ props: {
322
+ modelValue: {
323
+ type: null,
324
+ default: null
325
+ },
326
+ loadOptions: Function,
327
+ options: Object,
328
+ prependOptions: Object,
329
+ appendOptions: Object,
330
+ onCreateItem: Function,
331
+ preload: Boolean,
332
+ remoteSearch: Boolean,
333
+ searchFields: Object,
334
+ placeholder: String,
335
+ keyExtractor: Function,
336
+ valueExtractor: Function,
337
+ formatter: {
338
+ type: Function,
339
+ required: !0
340
+ },
341
+ subtitleFormatter: Function,
342
+ nullTitle: String,
343
+ noResultsText: String,
344
+ disabled: Boolean,
345
+ optionsListId: String,
346
+ debug: Boolean
347
+ },
348
+ emits: {
349
+ optionsLoaded: Object,
350
+ createItem: Object,
351
+ "update:modelValue": Object
352
+ },
353
+ data() {
354
+ return {
355
+ isLoading: !1,
356
+ isLoaded: !1,
357
+ loadedOptions: [],
358
+ isSearching: !1,
359
+ searchText: "",
360
+ selectedOption: null,
361
+ selectedOptionTitle: null,
362
+ shouldDisplayOptions: !1,
363
+ highlightedOptionKey: null,
364
+ shouldShowCreateOption: !1
365
+ };
366
+ },
367
+ computed: {
368
+ /**
369
+ * EFFECTIVE PROPS
370
+ */
371
+ effectivePrependOptions() {
372
+ return this.prependOptions ?? [];
373
+ },
374
+ effectiveAppendOptions() {
375
+ return this.appendOptions ?? [];
376
+ },
377
+ effectiveDisabled() {
378
+ return !!this.disabled;
379
+ },
380
+ effectivePlaceholder() {
381
+ return !this.isLoaded && this.preload ? "Loading..." : this.nullTitle ? this.nullTitle : this.placeholder || "";
382
+ },
383
+ effectiveNoResultsText() {
384
+ return this.noResultsText || "No options match your search.";
385
+ },
386
+ effectiveKeyExtractor() {
387
+ return this.keyExtractor ?? this.valueExtractor;
388
+ },
389
+ /**
390
+ * OPTIONS GENERATION
391
+ */
392
+ allOptions() {
393
+ return [...this.effectivePrependOptions, ...this.loadedOptions, ...this.effectiveAppendOptions];
394
+ },
395
+ optionsDescriptors() {
396
+ return this.allOptions.map((e, t) => {
397
+ var r, c;
398
+ const n = this.formatter(e), i = (r = this.subtitleFormatter) == null ? void 0 : r.call(this, e), s = n ? n.trim().toLowerCase() : "", o = i ? i.trim().toLowerCase() : "", l = [];
399
+ return this.searchFields ? this.searchFields.forEach((p) => {
400
+ e[p] && l.push(String(e[p]).toLowerCase());
401
+ }) : (l.push(s), o && l.push(o)), {
402
+ // eslint-disable-next-line vue/no-use-computed-property-like-method
403
+ key: ((c = this.effectiveKeyExtractor) == null ? void 0 : c.call(this, e)) ?? String(t),
404
+ title: n,
405
+ subtitle: i,
406
+ searchContent: l.join(""),
407
+ ref: e
408
+ };
409
+ });
410
+ },
411
+ effectiveOptions() {
412
+ let e = [...this.optionsDescriptors];
413
+ if (this.isSearching) {
414
+ const t = this.searchText.trim().toLowerCase();
415
+ if (t.length) {
416
+ e = e.filter((s) => s.searchContent.includes(t));
417
+ const n = qe(this.searchText).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), i = new RegExp(`(${n})`, "ig");
418
+ e = e.map((s) => {
419
+ var o;
420
+ return {
421
+ ...s,
422
+ title: s.title.replace(i, "<mark>$1</mark>"),
423
+ subtitle: (o = s.subtitle) == null ? void 0 : o.replace(i, "<mark>$1</mark>")
424
+ };
425
+ }), this.shouldShowCreateOption && (e.find((o) => o.searchContent === t) !== void 0 || e.push({
426
+ key: ne,
427
+ title: "Create <strong>" + this.searchText.trim() + "</strong>..."
428
+ }));
429
+ }
430
+ } else
431
+ this.nullTitle && e.unshift({
432
+ key: O,
433
+ title: this.nullTitle
434
+ });
435
+ return e;
436
+ }
437
+ },
438
+ watch: {
439
+ // props
440
+ modelValue() {
441
+ this.handleValueChanged();
442
+ },
443
+ options() {
444
+ this.loadedOptions = this.options ?? [];
445
+ },
446
+ // data
447
+ optionsDescriptors() {
448
+ this.shouldDisplayOptions && setTimeout(this.highlightInitialOption, 0);
449
+ },
450
+ searchText() {
451
+ this.isSearching && !this.remoteSearch && !this.searchText.trim().length && (this.isSearching = !1);
452
+ },
453
+ shouldDisplayOptions() {
454
+ this.shouldDisplayOptions ? setTimeout(this.handleOptionsDisplayed, 0) : (this.isSearching = !1, this.searchText = this.selectedOptionTitle || "", this.$refs.optionsContainer && (this.$refs.optionsContainer.style.visibility = "hidden"));
455
+ },
456
+ effectiveOptions() {
457
+ var e;
458
+ this.modelValue && !this.selectedOption && this.handleValueChanged(), this.highlightedOptionKey && !this.effectiveOptions.find((t) => t.key == this.highlightedOptionKey) && (this.highlightedOptionKey = ((e = this.effectiveOptions[0]) == null ? void 0 : e.key) ?? O);
459
+ }
460
+ },
461
+ async mounted() {
462
+ this.shouldShowCreateOption = this.$attrs.onCreateItem !== void 0, this.options ? (this.loadedOptions = this.options, this.isLoaded = !0) : this.preload && await this.loadRemoteOptions(), this.handleValueChanged(), this.$watch("selectedOption", () => {
463
+ this.selectedOption !== this.modelValue && this.$emit(
464
+ "update:modelValue",
465
+ this.selectedOption && this.valueExtractor ? this.valueExtractor(this.selectedOption) : this.selectedOption
466
+ );
467
+ }), this.remoteSearch && this.$watch("searchText", Ke(this.reloadOptionsIfSearching, 250));
468
+ },
469
+ methods: {
470
+ async loadRemoteOptions() {
471
+ await this.reloadOptions(), this.loadedOptions && this.$emit("optionsLoaded", this.loadedOptions);
472
+ },
473
+ handleSourceUpdate() {
474
+ if (this.preload)
475
+ return this.reloadOptions();
476
+ this.isLoaded && (this.isLoaded = !1, this.loadedOptions = []);
477
+ },
478
+ async reloadOptions() {
479
+ var t;
480
+ const e = this.remoteSearch && this.isSearching && this.searchText ? this.searchText : null;
481
+ this.isLoading = !0, this.loadedOptions = await ((t = this.loadOptions) == null ? void 0 : t.call(this, e)) ?? [], this.isLoading = !1, this.isLoaded = !0;
482
+ },
483
+ reloadOptionsIfSearching() {
484
+ this.isSearching && (this.reloadOptions(), this.isSearching = this.searchText.trim().length > 0);
485
+ },
486
+ handleKeyDown(e) {
487
+ if (e.key == "Escape") {
488
+ e.stopPropagation(), e.target.blur();
489
+ return;
490
+ }
491
+ if (!(e.key == "ArrowLeft" || e.key == "ArrowRight") && e.key != "Tab") {
492
+ if (!this.isLoaded) {
493
+ this.isSearching || e.preventDefault();
494
+ return;
495
+ }
496
+ if (e.key == "ArrowUp" || e.key == "ArrowDown")
497
+ return e.preventDefault(), this.incrementHighlightedOption(e.key == "ArrowUp" ? -1 : 1);
498
+ if (e.key == "PageUp" || e.key == "PageDown")
499
+ return e.preventDefault(), this.incrementHighlightedOption(e.key == "PageUp" ? -10 : 10);
500
+ if (e.key == "Home" || e.key == "End")
501
+ return e.preventDefault(), this.incrementHighlightedOption(e.key == "Home" ? -Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER);
502
+ if (e.key == "Enter") {
503
+ e.preventDefault();
504
+ const t = this.effectiveOptions.find((n) => n.key == this.highlightedOptionKey);
505
+ if (t)
506
+ return this.selectOption(t);
507
+ }
508
+ if (e.key === "Delete" || e.key === "Backspace") {
509
+ this.searchText.length > 1 && (this.isSearching = !0);
510
+ return;
511
+ }
512
+ !e.metaKey && dt.includes(e.key) && (this.isSearching = !0);
513
+ }
514
+ },
515
+ handleInputFocused() {
516
+ this.setHighlightedOptionKey(), this.shouldDisplayOptions = !0;
517
+ },
518
+ setHighlightedOptionKey(e) {
519
+ var t;
520
+ this.selectedOption ? this.highlightedOptionKey = this.getOptionKey(this.selectedOption) : e ? this.highlightedOptionKey = ((t = this.effectiveOptions) == null ? void 0 : t[0].key) ?? O : this.nullTitle && (this.highlightedOptionKey = O);
521
+ },
522
+ getOptionKey(e) {
523
+ var t;
524
+ return this.effectiveKeyExtractor ? this.effectiveKeyExtractor(this.selectedOption) : ((t = this.getOptionDescriptor(e)) == null ? void 0 : t.key) ?? "";
525
+ },
526
+ getOptionDescriptor(e) {
527
+ const t = this.effectiveOptions.find((i) => i.ref === e);
528
+ if (t)
529
+ return t;
530
+ const n = this.effectiveOptions.find((i) => ge(i.ref, e));
531
+ return n || null;
532
+ },
533
+ handleInputBlurred() {
534
+ this.debug || (!this.searchText.length && this.nullTitle && (this.selectedOption = null, this.selectedOptionTitle = null), this.shouldDisplayOptions = !1);
535
+ },
536
+ handleOptionsDisplayed() {
537
+ this.isLoaded || this.loadRemoteOptions(), this.optionsListId && this.$refs.optionsContainer.setAttribute("id", this.optionsListId), this.teleportOptionsContainer();
538
+ },
539
+ teleportOptionsContainer() {
540
+ const e = this.$el.getBoundingClientRect(), t = e.y + e.height + 2, n = e.x, i = this.$refs.optionsContainer, s = window.getComputedStyle(this.$el);
541
+ for (let o in s)
542
+ /^(font|text)/.test(o) && (i.style[o] = s[o]);
543
+ if (i.style.top = t + "px", i.style.left = n + "px", i.style.minWidth = e.width + "px", !s.maxHeight || s.maxHeight == "none") {
544
+ const o = window.innerHeight - t - 12;
545
+ i.style.maxHeight = o + "px";
546
+ }
547
+ i.style.visibility = "visible", document.body.appendChild(i), setTimeout(this.highlightInitialOption, 0);
548
+ },
549
+ highlightInitialOption() {
550
+ if (!this.isLoaded || !this.highlightedOptionKey)
551
+ return;
552
+ const e = this.effectiveOptions.findIndex((i) => i.key == this.highlightedOptionKey), t = this.$refs.optionsContainer, n = t.querySelectorAll(".option")[e];
553
+ t.scrollTop = n.offsetTop;
554
+ },
555
+ handleOptionHover(e) {
556
+ this.highlightedOptionKey = e ? e.key : null;
557
+ },
558
+ incrementHighlightedOption(e) {
559
+ const t = this.effectiveOptions.findIndex((o) => o.key == this.highlightedOptionKey);
560
+ let n = t + e;
561
+ if (n < 0 ? n = 0 : n >= this.effectiveOptions.length && (n = this.effectiveOptions.length - 1), t == n)
562
+ return;
563
+ this.highlightedOptionKey = this.effectiveOptions[n].key;
564
+ const i = this.$refs.optionsContainer, s = i.querySelectorAll(".option")[n];
565
+ s.offsetTop < i.scrollTop ? i.scrollTop = s.offsetTop : s.offsetTop + s.offsetHeight > i.scrollTop + i.clientHeight && (i.scrollTop = s.offsetTop + s.offsetHeight - i.clientHeight);
566
+ },
567
+ selectOption(e) {
568
+ if (this.isSearching = !1, e.key == O)
569
+ this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null;
570
+ else if (e.key === ne) {
571
+ const t = this.searchText.trim();
572
+ this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null, this.$emit("createItem", t);
573
+ } else {
574
+ const n = this.optionsDescriptors.find((i) => i.key == e.key).ref;
575
+ this.selectedOption = n, this.selectedOptionTitle = this.formatter(n), this.searchText = this.selectedOptionTitle || "";
576
+ }
577
+ this.$refs.searchField.blur();
578
+ },
579
+ handleValueChanged() {
580
+ this.modelValue ? (this.selectedOption = this.valueExtractor ? this.allOptions.find((e) => this.modelValue === this.valueExtractor(e)) : this.modelValue, this.selectedOptionTitle = this.selectedOption ? this.formatter(this.selectedOption) : null, this.searchText = this.selectedOptionTitle || "") : (this.selectedOption = null, this.selectedOptionTitle = null, this.searchText = "");
581
+ },
582
+ addRemoteOption(e) {
583
+ this.loadedOptions.push(e);
584
+ }
585
+ }
586
+ };
587
+ const ht = ["placeholder"], ft = {
588
+ key: 0,
589
+ ref: "optionsContainer",
590
+ class: "vf-smart-select-options"
591
+ }, pt = {
592
+ key: 0,
593
+ class: "no-results"
594
+ }, mt = ["onMousemove", "onMousedown"], vt = ["innerHTML"], gt = ["innerHTML"], yt = {
595
+ key: 0,
596
+ class: "no-results"
597
+ };
598
+ function Et(e, t, n, i, s, o) {
599
+ const l = pe("disabled");
600
+ return a(), d("div", {
601
+ class: E(["vf-smart-select", { disabled: o.effectiveDisabled, open: e.shouldDisplayOptions }])
602
+ }, [
603
+ H(v("input", {
604
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => e.searchText = r),
605
+ ref: "searchField",
606
+ type: "text",
607
+ class: E({ nullable: !!n.nullTitle }),
608
+ onKeydown: t[1] || (t[1] = (...r) => o.handleKeyDown && o.handleKeyDown(...r)),
609
+ placeholder: o.effectivePlaceholder,
610
+ onFocus: t[2] || (t[2] = (...r) => o.handleInputFocused && o.handleInputFocused(...r)),
611
+ onBlur: t[3] || (t[3] = (...r) => o.handleInputBlurred && o.handleInputBlurred(...r))
612
+ }, null, 42, ht), [
613
+ [_e, e.searchText],
614
+ [l, o.effectiveDisabled]
615
+ ]),
616
+ e.shouldDisplayOptions ? (a(), d("div", ft, [
617
+ e.isLoaded ? (a(), d($, { key: 1 }, [
618
+ (a(!0), d($, null, W(o.effectiveOptions, (r) => (a(), d("div", {
619
+ key: String(r.key),
620
+ class: E(["option", {
621
+ highlighted: e.highlightedOptionKey === r.key
622
+ }]),
623
+ onMousemove: (c) => o.handleOptionHover(r),
624
+ onMousedown: (c) => o.selectOption(r)
625
+ }, [
626
+ v("div", {
627
+ class: "title",
628
+ innerHTML: r.title
629
+ }, null, 8, vt),
630
+ r.subtitle ? (a(), d("div", {
631
+ key: 0,
632
+ class: "subtitle",
633
+ innerHTML: r.subtitle
634
+ }, null, 8, gt)) : g("", !0)
635
+ ], 42, mt))), 128)),
636
+ !o.effectiveOptions.length && e.searchText ? (a(), d("div", yt, w(o.effectiveNoResultsText), 1)) : g("", !0)
637
+ ], 64)) : (a(), d("div", pt, "Loading..."))
638
+ ], 512)) : g("", !0)
639
+ ], 2);
640
+ }
641
+ const Tt = /* @__PURE__ */ ye(ut, [["render", Et]]), yn = /* @__PURE__ */ M({
642
+ __name: "ez-smart-select",
643
+ props: {
644
+ modelValue: null,
645
+ nullTitle: null,
646
+ placeholder: null,
647
+ options: null,
648
+ formatter: { type: Function }
649
+ },
650
+ emits: ["update:modelValue"],
651
+ setup(e, { emit: t }) {
652
+ const n = e, i = D(() => Array.isArray(n.options) ? n.options.map((l) => ({ value: l, label: l })) : Object.entries(n.options).map(([l, r]) => ({
653
+ value: l,
654
+ label: r
655
+ }))), s = D(() => n.formatter ? (l) => {
656
+ var r;
657
+ return (r = n.formatter) == null ? void 0 : r.call(n, l.label);
658
+ } : (l) => l.label), o = I(i.value.find((l) => l.value === n.modelValue) ?? null);
659
+ return ee(
660
+ () => n.modelValue,
661
+ (l) => {
662
+ o.value = i.value.find((r) => r.value === l) ?? null;
663
+ }
664
+ ), ee(o, (l) => {
665
+ var r;
666
+ t("update:modelValue", l ? ((r = i.value.find((c) => ge(c, l))) == null ? void 0 : r.value) ?? null : null);
667
+ }), (l, r) => (a(), z(Tt, {
668
+ modelValue: o.value,
669
+ "onUpdate:modelValue": r[0] || (r[0] = (c) => o.value = c),
670
+ options: R(i),
671
+ formatter: R(s),
672
+ "null-title": e.nullTitle
673
+ }, null, 8, ["modelValue", "options", "formatter", "null-title"]));
674
+ }
675
+ });
676
+ function Ot(e) {
677
+ const t = Math.floor(Math.log(e) / Math.log(1024)), i = (e / Math.pow(1024, t)).toFixed(2), s = ["B", "KB", "MB", "GB", "TB"][t];
678
+ return `${i} ${s}`;
679
+ }
680
+ function bt(e) {
681
+ return e != null && String(e).length ? e : "-";
682
+ }
683
+ function wt(e) {
684
+ return e || "-";
685
+ }
686
+ function St(e) {
687
+ return e === null || typeof e == "string" && !/^\d+$/.test(e) ? e : At(Number(e));
688
+ }
689
+ function kt(e) {
690
+ return e && at(e);
691
+ }
692
+ function xt(e) {
693
+ return e ? Re(e) : null;
694
+ }
695
+ function Mt(e) {
696
+ return e ? je(e) : null;
697
+ }
698
+ function Ct(e) {
699
+ return e ? e.toUpperCase() : null;
700
+ }
701
+ function Lt(e) {
702
+ return e ? rt(e) : null;
703
+ }
704
+ function It(e) {
705
+ return ct(e);
706
+ }
707
+ const ie = {
708
+ bytes: Ot,
709
+ dash: bt,
710
+ dashZeros: wt,
711
+ number: St,
712
+ phone: kt,
713
+ upperFirst: xt,
714
+ startCase: Mt,
715
+ upperCase: Ct,
716
+ desnake: Lt,
717
+ usCurrency: It
718
+ }, En = (e) => ({
719
+ ...ie,
720
+ ...e(ie)
721
+ });
722
+ function Tn(e, t, n) {
723
+ const i = typeof t == "function" ? e.findIndex(t) : e.indexOf(t);
724
+ return i === -1 ? !1 : (e.splice(i, 1, n), !0);
725
+ }
726
+ function On(e, t) {
727
+ const n = document.createElement("div");
728
+ n.classList.add("vf-overlay"), n.addEventListener("click", T), document.body.appendChild(n);
729
+ const i = document.createElement("div");
730
+ i.classList.add("vf-context-menu"), i.style.position = "absolute", n.appendChild(i);
731
+ const s = e.currentTarget;
732
+ s.style.userSelect = "none", s.classList.add("context-menu-active"), t.targetClass && s.classList.add(t.targetClass), t.class && i.classList.add(t.class), t.items.forEach((u) => {
733
+ if (u == "-") {
734
+ const L = document.createElement("div");
735
+ L.classList.add("separator"), i.appendChild(L);
736
+ return;
737
+ }
738
+ const m = document.createElement("div");
739
+ m.classList.add("item"), m.style.userSelect = "none", m.innerText = u.title, i.appendChild(m), u.class && m.classList.add(u.class), u.shouldConfirm ? m.addEventListener("click", () => u.handler()) : m.addEventListener("click", () => Ce(m, u.handler));
740
+ });
741
+ const o = window.innerWidth - e.clientX, l = window.innerHeight - e.clientY, r = i.offsetHeight, c = i.offsetWidth, p = o < c ? e.clientX - c - 1 : e.clientX + 1, h = l < r ? e.clientY - r - 1 : e.clientY + 1;
742
+ i.style.left = p + "px", i.style.top = h + "px", setTimeout(() => {
743
+ i.style.width = i.offsetWidth + "px";
744
+ }, 50);
745
+ function T() {
746
+ t.targetClass && s.classList.remove(t.targetClass), s.classList.remove("context-menu-active"), s.style.userSelect = "", n.remove();
747
+ }
748
+ function Ce(u, m) {
749
+ if (u.classList.contains("pending-confirm"))
750
+ return m();
751
+ const L = u.innerHTML;
752
+ u.classList.add("pending-confirm"), u.innerText = "Confirm";
753
+ const Q = () => {
754
+ u.classList.remove("pending-confirm"), u.innerHTML = L, u.removeEventListener("mouseleave", Q);
755
+ };
756
+ u.addEventListener("mouseleave", Q), e.stopPropagation();
757
+ }
758
+ }
759
+ const Dt = (e) => new Promise((t) => setTimeout(t, e)), bn = (e) => Dt(e * 1e3), S = Symbol("MaskState");
760
+ function wn(e, t) {
761
+ const n = e.$.vnode.el, i = n.closest(".vf-modal");
762
+ return Ht(i ?? n, t);
763
+ }
764
+ function Sn(e) {
765
+ const t = e.$.vnode.el, n = t.closest(".vf-modal");
766
+ return be(n ?? t);
767
+ }
768
+ function Ht(e, t) {
769
+ if (!e[S]) {
770
+ const n = document.createElement("div");
771
+ n.classList.add("vf-mask"), e.appendChild(n), e[S] = { maskEl: n };
772
+ }
773
+ return e[S].maskEl.innerText = t ?? "", () => be(e);
774
+ }
775
+ function be(e) {
776
+ e[S] && e.removeChild(e[S].maskEl);
777
+ }
778
+ const P = Symbol("FormMaskState");
779
+ function kn(e, t, n) {
780
+ const i = e instanceof Element ? e : we(e);
781
+ i.classList.add("vf-masked");
782
+ const s = t instanceof Element ? t : i.querySelectorAll(t ?? "button:not([disabled])")[0], o = s.tagName === "INPUT" ? s.value : s.innerText;
783
+ s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...";
784
+ const r = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
785
+ return r.forEach((c) => c.setAttribute("disabled", "disabled")), i[P] = {
786
+ disabledElements: r,
787
+ waitButton: s,
788
+ buttonText: o
789
+ }, () => $t(i);
790
+ }
791
+ function $t(e) {
792
+ const t = e instanceof Element ? e : we(e), n = t[P];
793
+ n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton.innerText = n.buttonText, n.waitButton.removeAttribute("disabled"), delete t[P]);
794
+ }
795
+ function we(e) {
796
+ const t = e.$.vnode.el;
797
+ return t.tagName === "FORM" ? t : t.querySelector("form");
798
+ }
799
+ function At(e) {
800
+ return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
801
+ }
802
+ function xn(e, t) {
803
+ return e != null ? Pe(e) : t;
804
+ }
805
+ function Mn(e, t) {
806
+ const n = { ...e };
807
+ for (const i of t)
808
+ n[i] === "" && (n[i] = null);
809
+ return n;
810
+ }
811
+ function Bt(e) {
812
+ return e instanceof Error && "status" in e && "body" in e;
813
+ }
814
+ function Cn({ apiClient: e, onRequest: t, onError: n, CancelablePromise: i }) {
815
+ const s = e.request.request.bind(e.request);
816
+ e.request.request = (o) => (t && (o = t(o)), new i((l, r, c) => {
817
+ const p = s(o);
818
+ c(p.cancel), p.then(l).catch((h) => {
819
+ if (Bt(h) && typeof h.body == "object" && "error" in h.body && h.status === 422)
820
+ return r(new B(h.body.error));
821
+ if (n) {
822
+ const T = n(h, o);
823
+ if (T === null)
824
+ return;
825
+ if (T instanceof Error)
826
+ return r(T);
827
+ }
828
+ r(h);
829
+ });
830
+ }));
831
+ }
832
+ const Z = Symbol("HookState");
833
+ function Vt(e, t) {
834
+ const n = t ?? fe();
835
+ q(() => Ft(n, e), n), me(() => Nt(n), n), ve(() => se(n), n), U(() => se(n), n);
836
+ }
837
+ function Ft(e, t) {
838
+ const n = {};
839
+ if (t.elScrolledToBottom && (n.el = new K(e.vnode.el, t.elScrolledToBottom), n.el.install()), t.ancestorScrolledToBottom) {
840
+ const i = Se(e.vnode.el);
841
+ i ? (n.ancestor = new K(i, t.ancestorScrolledToBottom), n.ancestor.install()) : console.warn("no scollable ancestor found for component:", e);
842
+ }
843
+ t.windowScrolledToBottom && (n.window = new K(window, t.windowScrolledToBottom), n.window.install()), e[Z] = n;
844
+ }
845
+ function Nt(e) {
846
+ var n, i, s;
847
+ const t = e[Z];
848
+ (n = t == null ? void 0 : t.el) == null || n.install(), (i = t == null ? void 0 : t.ancestor) == null || i.install(), (s = t == null ? void 0 : t.window) == null || s.install();
849
+ }
850
+ function se(e) {
851
+ var n, i, s;
852
+ const t = e[Z];
853
+ (n = t == null ? void 0 : t.el) == null || n.uninstall(), (i = t == null ? void 0 : t.ancestor) == null || i.uninstall(), (s = t == null ? void 0 : t.window) == null || s.uninstall();
854
+ }
855
+ const _ = ["auto", "scroll"];
856
+ function Se(e) {
857
+ const t = e.parentElement;
858
+ if (!t)
859
+ return null;
860
+ const n = window.getComputedStyle(t);
861
+ return _.includes(n.overflow) || _.includes(n.overflowX) || _.includes(n.overflowY) ? t : Se(t);
862
+ }
863
+ class K {
864
+ constructor(t, n) {
865
+ f(this, "isTripped", !1);
866
+ f(this, "onScrollWithContext", this.onScroll.bind(this));
867
+ this.el = t, this.handler = n;
868
+ }
869
+ install() {
870
+ this.el.addEventListener("scroll", this.onScrollWithContext);
871
+ }
872
+ uninstall() {
873
+ this.el.removeEventListener("scroll", this.onScrollWithContext);
874
+ }
875
+ onScroll(t) {
876
+ Math.ceil(this.el.scrollTop + this.el.clientHeight + 5) >= this.el.scrollHeight ? this.isTripped || (this.handler(t), this.isTripped = !0) : this.isTripped && (this.isTripped = !1);
877
+ }
878
+ }
879
+ function Ln(e) {
880
+ q(() => window.addEventListener("resize", e)), me(() => window.addEventListener("resize", e)), ve(() => window.removeEventListener("resize", e)), U(() => window.removeEventListener("resize", e));
881
+ }
882
+ const _t = {
883
+ mounted: le,
884
+ updated: le
885
+ }, oe = Symbol("HasAutoFocused");
886
+ function le(e, t) {
887
+ if (t.value === void 0 && e[oe] || t.value !== void 0 && !t.value || t.oldValue !== void 0 && t.value == t.oldValue)
888
+ return;
889
+ e[oe] = !0;
890
+ const n = ["BUTTON", "INPUT", "TEXTAREA", "SELECT"].indexOf(e.tagName) > -1 ? e : e.querySelectorAll("input")[0];
891
+ setTimeout(() => n.focus(), 10);
892
+ }
893
+ const Kt = {
894
+ mounted: Rt
895
+ }, b = Symbol("ConfirmState");
896
+ function Rt(e) {
897
+ e.addEventListener("click", (t) => {
898
+ const n = Date.now();
899
+ if (e[b]) {
900
+ if (n - e[b].initTime < 300)
901
+ return;
902
+ e[b].resetHandler(), e.dispatchEvent(new Event("confirm"));
903
+ return;
904
+ }
905
+ t.preventDefault(), t.stopImmediatePropagation();
906
+ const i = {
907
+ initTime: n,
908
+ preconfirmHtml: e.innerHTML,
909
+ resetHandler: () => {
910
+ e.innerHTML = i.preconfirmHtml, e.blur(), e.removeEventListener("mouseout", i.resetHandler), delete e[b];
911
+ }
912
+ };
913
+ e[b] = i, e.innerHTML = "Confirm", e.addEventListener("mouseout", i.resetHandler);
914
+ });
915
+ }
916
+ const jt = {
917
+ beforeMount: Pt
918
+ };
919
+ function Pt(e) {
920
+ e.addEventListener("blur", () => {
921
+ let t = e.value;
922
+ /^\d{1,2}\/\d{1,2}$/.test(t) && (t += "/" + j(/* @__PURE__ */ new Date(), "yy"));
923
+ const n = Date.parse(t);
924
+ isNaN(n) ? e.value = "" : e.value = j(n, "MM/dd/yyyy"), e.dispatchEvent(new Event("input"));
925
+ });
926
+ }
927
+ const Wt = {
928
+ beforeMount: re,
929
+ updated: re
930
+ };
931
+ function re(e, t) {
932
+ t.value == t.oldValue && e.innerHTML.length || (e.innerText = qt(e, t));
933
+ }
934
+ function qt(e, t) {
935
+ var c, p;
936
+ if (!t.value)
937
+ return ((c = e.attributes.getNamedItem("placeholder")) == null ? void 0 : c.value) ?? "";
938
+ let n = "";
939
+ const i = t.value.replace(/ /g, "T").replace(/\.\d+Z$/, "Z"), s = e.attributes.getNamedItem("local") !== null ? i.replace(/Z$/, "") : i.replace(/(Z|\+00:00)?$/, "Z"), o = new Date(s);
940
+ !e.attributes.getNamedItem("display-utc") !== null && o.setMinutes(o.getMinutes() - o.getTimezoneOffset());
941
+ let l = (p = e.attributes.getNamedItem("format")) == null ? void 0 : p.value;
942
+ if (!l && e.attributes.getNamedItem("relative-date") !== null) {
943
+ const h = /* @__PURE__ */ new Date();
944
+ h.getFullYear() == o.getFullYear() && h.getMonth() == o.getMonth() && h.getDate() == o.getDate() && (n = "at", l = "HH:mm");
945
+ }
946
+ l || (l = C.defaultDateTimeFormat);
947
+ let r = j(o, l);
948
+ return n && (r = n + " " + r), r;
949
+ }
950
+ const Ut = {
951
+ beforeMount: ae,
952
+ updated: ae,
953
+ unmounted: zt
954
+ };
955
+ function ae(e, t) {
956
+ e.tagName === "LABEL" && (t.value ? e.classList.remove("disabled") : e.classList.add("disabled"), e = e.querySelector("input")), t.value ? e.setAttribute("disabled", "disabled") : e.removeAttribute("disabled");
957
+ }
958
+ function zt(e) {
959
+ e.tagName === "LABEL" && (e.classList.remove("disabled"), e = e.querySelector("input")), e.removeAttribute("disabled");
960
+ }
961
+ const Xt = {
962
+ beforeMount: ce,
963
+ updated: ce,
964
+ unmounted: xe
965
+ }, x = Symbol("HasAutoFocused"), G = [];
966
+ function Yt() {
967
+ G.forEach(ke);
968
+ }
969
+ setInterval(Yt, 1e3);
970
+ function ce(e, t) {
971
+ var l;
972
+ if (t.value == t.oldValue)
973
+ return;
974
+ if (!t.value)
975
+ return xe(e);
976
+ const n = new Date(t.value), i = (l = e.attributes.getNamedItem("base-time")) == null ? void 0 : l.value, s = n.getTime() - (i ? new Date(i).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
977
+ e[x] || G.push(e), e[x] = {
978
+ startTs: s,
979
+ includeSeconds: o
980
+ }, ke(e);
981
+ }
982
+ function ke(e) {
983
+ const t = e[x], n = Math.round((Date.now() - t.startTs) / 1e3);
984
+ e.innerText = Zt(n, t.includeSeconds);
985
+ }
986
+ function xe(e) {
987
+ e[x] && (We(G, e), delete e[x]), e.innerText = "-";
988
+ }
989
+ function Zt(e, t) {
990
+ const n = [], i = Math.floor(e / 86400);
991
+ i && n.push(i + "d"), e -= i * 86400;
992
+ const s = Math.floor(e / 3600);
993
+ (i || s) && n.push(s + "h"), e -= s * 3600;
994
+ const o = Math.floor(e / 60);
995
+ return (i || s || o) && n.push(o + "m"), t ? n.length || n.push("0m") : (e -= o * 60, n.push(e + "s")), n.join(" ");
996
+ }
997
+ const Gt = {
998
+ created(e, t) {
999
+ Vt(t.value, t.instance.$);
1000
+ }
1001
+ }, Qt = {
1002
+ beforeMount: de,
1003
+ updated: de
1004
+ };
1005
+ function de(e, t) {
1006
+ e.tagName == "LABEL" && (e = e.querySelector("input")), t.value ? e.setAttribute("readonly", "readonly") : e.removeAttribute("readonly");
1007
+ }
1008
+ const Jt = {
1009
+ mounted: ue,
1010
+ updated: ue,
1011
+ unmounted: Me
1012
+ }, k = Symbol("TooltipState");
1013
+ function ue(e, t) {
1014
+ var i;
1015
+ let n = ((i = e.attributes.getNamedItem("tip")) == null ? void 0 : i.value) ?? t.value;
1016
+ if (t.value || (n = null), n) {
1017
+ const s = {
1018
+ content: n,
1019
+ html: e.getAttribute("html") !== null
1020
+ };
1021
+ e[k] ? e[k].configure(s) : e[k] = new en(e, s);
1022
+ } else
1023
+ Me(e);
1024
+ }
1025
+ function Me(e) {
1026
+ var t;
1027
+ (t = e[k]) == null || t.destroy(), delete e[k];
1028
+ }
1029
+ class en {
1030
+ constructor(t, n) {
1031
+ f(this, "lastMoveEvt");
1032
+ f(this, "checkInterval");
1033
+ f(this, "shouldShow", !1);
1034
+ f(this, "tipEl");
1035
+ f(this, "titleEl");
1036
+ f(this, "contentEl");
1037
+ f(this, "mouseMoveBound", !1);
1038
+ f(this, "handleMouseMoveWithContext", this.handleMouseMove.bind(this));
1039
+ f(this, "handleTargetMouseEnterWithContext", this.handleTargetMouseEnter.bind(this));
1040
+ f(this, "handleTargetMouseLeaveWithContext", this.handleTargetMouseLeave.bind(this));
1041
+ this.el = t, this.config = n, t.addEventListener("mouseenter", this.handleTargetMouseEnterWithContext), t.addEventListener("mouseleave", this.handleTargetMouseLeaveWithContext);
1042
+ }
1043
+ configure(t) {
1044
+ this.config = t;
1045
+ }
1046
+ handleTargetMouseEnter(t) {
1047
+ this.shouldShow = !0, setTimeout(() => this.show(t), this.config.delay ?? 0);
1048
+ }
1049
+ handleTargetMouseLeave() {
1050
+ this.shouldShow = !1, this.removeTooltip();
1051
+ }
1052
+ show(t) {
1053
+ this.shouldShow && (this.renderTooltip(), t && this.handleMouseMove(t));
1054
+ }
1055
+ renderTooltip() {
1056
+ this.tipEl || (this.tipEl = document.createElement("div"), this.tipEl.style.position = "absolute", this.tipEl.style.zIndex = "1000000", document.body.appendChild(this.tipEl)), this.tipEl.className = this.getClasses().join(" "), this.config.title ? (this.titleEl || (this.titleEl = document.createElement("div"), this.titleEl.className = "title", this.tipEl.appendChild(this.titleEl)), this.titleEl.innerText = this.config.title) : this.titleEl && this.titleEl.remove(), this.contentEl || (this.contentEl = document.createElement("div"), this.contentEl.className = "content", this.tipEl.appendChild(this.contentEl)), this.contentEl[this.config.html ? "innerHTML" : "innerText"] = this.config.content, this.checkInterval && (this.checkInterval = setInterval(() => this.checkMoveEvent(), 250)), this.mouseMoveBound || (this.mouseMoveBound = !0, window.addEventListener("mousemove", this.handleMouseMoveWithContext));
1057
+ }
1058
+ getClasses() {
1059
+ return ["vf-tooltip", ...Array.isArray(this.config.class) ? this.config.class : this.config.class ? [this.config.class] : []];
1060
+ }
1061
+ removeTooltip() {
1062
+ this.shouldShow || this.tipEl && (this.tipEl.remove(), this.tipEl = void 0, this.titleEl = void 0, this.contentEl = void 0, this.checkInterval && (clearInterval(this.checkInterval), this.checkInterval = void 0), window.removeEventListener("mousemove", this.handleMouseMoveWithContext), this.mouseMoveBound = !1);
1063
+ }
1064
+ handleMouseMove(t) {
1065
+ const n = this.tipEl.offsetWidth, i = this.tipEl.offsetHeight, s = window.innerWidth, o = window.innerHeight;
1066
+ let l = t.pageX + 10, r = t.pageY + 20;
1067
+ l + n > s && (l = t.pageX - 5 - n), r + i > o && (r = t.pageY - 5 - i), this.tipEl.style.left = l + "px", this.tipEl.style.top = r + "px", this.lastMoveEvt = t;
1068
+ }
1069
+ checkMoveEvent() {
1070
+ var t;
1071
+ this.lastMoveEvt && this.tipEl !== this.lastMoveEvt.target && ((t = this.tipEl) != null && t.contains(this.lastMoveEvt.target) || this.handleTargetMouseLeave());
1072
+ }
1073
+ destroy() {
1074
+ this.shouldShow = !1, this.removeTooltip(), this.el.removeEventListener("mouseenter", this.handleTargetMouseEnterWithContext), this.el.removeEventListener("mouseleave", this.handleTargetMouseLeaveWithContext);
1075
+ }
1076
+ }
1077
+ function tn(e) {
1078
+ e.directive("autofocus", _t), e.directive("confirm-button", Kt), e.directive("date-input", jt), e.directive("datetime", Wt), e.directive("disabled", Ut), e.directive("duration", Xt), e.directive("infinite-scroll", Gt), e.directive("readonly", Qt), e.directive("tooltip", Jt);
1079
+ }
1080
+ function In(e) {
1081
+ tn(e);
1082
+ }
1083
+ export {
1084
+ cn as ModalContainer,
1085
+ B as UserError,
1086
+ an as VfAjaxSelect,
1087
+ V as VfAlertModal,
1088
+ yn as VfEzSmartSelect,
1089
+ st as VfModal,
1090
+ Tt as VfSmartSelect,
1091
+ xn as cloneProp,
1092
+ pn as configureVf,
1093
+ En as createFilters,
1094
+ Ee as createModalInjection,
1095
+ rt as desnakeCase,
1096
+ $n as escapeHtml,
1097
+ Je as formatError,
1098
+ At as formatNumber,
1099
+ at as formatPhone,
1100
+ ct as formatUSCurrency,
1101
+ vn as handleError,
1102
+ mn as handleErrorAndAlert,
1103
+ Cn as installApiClientInterceptors,
1104
+ In as installVf,
1105
+ wn as maskComponent,
1106
+ Ht as maskEl,
1107
+ kn as maskForm,
1108
+ gn as nl2br,
1109
+ Mn as nullifyEmptyInputs,
1110
+ X as presentModal,
1111
+ Te as removeModalInjection,
1112
+ dn as removeModalInjectionByInstance,
1113
+ Oe as removeModalInjectionByInternalInstance,
1114
+ Qe as removeModalInjectionByVnode,
1115
+ Tn as replaceElement,
1116
+ te as showAlert,
1117
+ un as showConfirm,
1118
+ hn as showConfirmDestroy,
1119
+ On as showContextMenu,
1120
+ fn as showWait,
1121
+ Dt as sleep,
1122
+ bn as sleepSecs,
1123
+ Y as toError,
1124
+ Sn as unmaskComponent,
1125
+ be as unmaskEl,
1126
+ $t as unmaskForm,
1127
+ Vt as useInfiniteScroll,
1128
+ Ln as useResizeWatcher
1129
+ };