@signal24/vue-foundation 4.13.9 → 4.14.1

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.
@@ -1,14 +1,15 @@
1
1
  import type { Writable } from 'type-fest';
2
2
  import { type AllowedComponentProps, type ComponentInternalInstance, type ComponentPublicInstance, type ComputedOptions, type MethodOptions, type Raw, type VNode, type VNodeProps } from 'vue';
3
3
  import type { OverlayAnchorOptions } from './overlay-types';
4
- interface OverlayOptions {
4
+ interface OverlayOptions<C extends OverlayComponent, R extends ComponentReturn<C>> {
5
5
  anchor?: OverlayAnchorOptions;
6
+ onCallback?: (result: R) => void | Promise<boolean>;
6
7
  }
7
- export interface OverlayInjection<C extends OverlayComponent> {
8
+ export interface OverlayInjection<C extends OverlayComponent, R extends ComponentReturn<C>> {
8
9
  id: string;
9
10
  component: OverlayComponentUnwrapped<C>;
10
11
  props: OverlayComponentProps<C>;
11
- options: OverlayOptions;
12
+ options: OverlayOptions<C, R>;
12
13
  vnode: VNode;
13
14
  wrapperVnode?: VNode;
14
15
  }
@@ -41,11 +42,11 @@ type ComponentReturn<M extends OverlayComponent> = OverlayComponentProps<M> exte
41
42
  export type AnyComponentPublicInstance = {
42
43
  $?: ComponentInternalInstance;
43
44
  };
44
- export declare function createOverlayInjection<C extends OverlayComponent>(component: C, props: OverlayComponentProps<C>, options?: OverlayOptions): OverlayInjection<C>;
45
+ export declare function createOverlayInjection<C extends OverlayComponent, R extends ComponentReturn<C>>(component: C, props: OverlayComponentProps<C>, options?: OverlayOptions<C, R>): OverlayInjection<C, R>;
45
46
  export declare function dismissOverlayInjectionByInstance(instance: AnyComponentPublicInstance): void;
46
47
  export declare function dismissOverlayInjectionByInternalInstance(instance: ComponentInternalInstance): void;
47
48
  export declare function dismissOverlayInjectionByVnode(vnode: VNode): boolean;
48
49
  export declare function dismissOverlayInjectionById(id: string): boolean;
49
- export declare function removeOverlayInjection(injection: OverlayInjection<any>): void;
50
- export declare function presentOverlay<C extends OverlayComponent, R extends ComponentReturn<C>>(component: C, props: Omit<OverlayComponentProps<C>, 'callback'>, options?: OverlayOptions): Promise<R | undefined>;
50
+ export declare function removeOverlayInjection(injection: OverlayInjection<any, any>): void;
51
+ export declare function presentOverlay<C extends OverlayComponent, R extends ComponentReturn<C>>(component: C, props: Omit<OverlayComponentProps<C>, 'callback'>, options?: OverlayOptions<C, R>): Promise<R | undefined>;
51
52
  export {};
@@ -1,17 +1,17 @@
1
1
  var Ve = Object.defineProperty;
2
2
  var Fe = (e, t, n) => t in e ? Ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var E = (e, t, n) => (Fe(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { defineComponent as x, defineProps as _e, defineEmits as Ne, ref as O, computed as _, openBlock as d, createElementBlock as h, createElementVNode as w, toDisplayString as C, withDirectives as j, createCommentVNode as b, Fragment as U, renderList as J, vModelSelect as Re, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ke, withModifiers as te, renderSlot as K, reactive as je, h as W, Teleport as Ue, markRaw as We, onBeforeUnmount as ne, resolveDirective as Oe, createBlock as be, createSlots as Pe, withCtx as Y, createTextVNode as ae, vModelText as qe, watch as ce, onActivated as ke, onDeactivated as Se } from "vue";
5
- import { compact as ze, debounce as Xe, isEqual as xe, upperFirst as Ye, startCase as Ze, cloneDeep as Ge, remove as Qe } from "lodash";
3
+ var E = (e, t, n) => Fe(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { defineComponent as C, defineProps as _e, defineEmits as Re, ref as b, computed as _, openBlock as d, createElementBlock as h, createElementVNode as w, toDisplayString as x, withDirectives as j, createCommentVNode as O, Fragment as U, renderList as J, vModelSelect as Ne, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ke, withModifiers as te, renderSlot as K, reactive as je, h as W, Teleport as Ue, markRaw as We, onBeforeUnmount as ne, resolveDirective as be, createBlock as Oe, createSlots as Pe, withCtx as Y, createTextVNode as ae, vModelText as qe, watch as ce, onActivated as ke, onDeactivated as Se } from "vue";
5
+ import { compact as ze, debounce as Xe, isEqual as Ce, upperFirst as Ye, startCase as Ze, cloneDeep as Ge, remove as Qe } from "lodash";
6
6
  import { escapeHtml as Je } from "@vue/shared";
7
7
  import { escapeHtml as ni } from "@vue/shared";
8
8
  import { installOpenApiClientInterceptors as et, isOpenApiError as tt } from "@signal24/openapi-client-codegen/browser";
9
9
  import { format as G } from "date-fns";
10
- const nt = x({
10
+ const nt = C({
11
11
  setup() {
12
12
  const e = _e();
13
- Ne(["update:modelValue"]);
14
- const t = O(null), n = _(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), i = O(e.modelValue ?? null);
13
+ Re(["update:modelValue"]);
14
+ const t = b(null), n = _(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), i = b(e.modelValue ?? null);
15
15
  return { props: e, options: t, renderOptions: n, selectedItem: i };
16
16
  },
17
17
  watch: {
@@ -33,7 +33,7 @@ const nt = x({
33
33
  this.options = await this.props.loadFn();
34
34
  }
35
35
  }
36
- }), Ce = (e, t) => {
36
+ }), xe = (e, t) => {
37
37
  const n = e.__vccOpts || e;
38
38
  for (const [i, s] of t)
39
39
  n[i] = s;
@@ -45,41 +45,40 @@ const nt = x({
45
45
  key: 0,
46
46
  value: null
47
47
  }, ot = ["value"];
48
- function rt(e, t, n, i, s, o) {
48
+ function lt(e, t, n, i, s, o) {
49
49
  return e.renderOptions ? j((d(), h("select", {
50
50
  key: 1,
51
- "onUpdate:modelValue": t[0] || (t[0] = (l) => e.selectedItem = l)
51
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => e.selectedItem = r)
52
52
  }, [
53
- e.props.nullText ? (d(), h("option", st, C(e.props.nullText), 1)) : b("", !0),
54
- (d(!0), h(U, null, J(e.renderOptions, (l, r) => {
53
+ e.props.nullText ? (d(), h("option", st, x(e.props.nullText), 1)) : O("", !0),
54
+ (d(!0), h(U, null, J(e.renderOptions, (r, l) => {
55
55
  var a;
56
56
  return d(), h("option", {
57
- key: r,
58
- value: (a = e.options) == null ? void 0 : a[r]
59
- }, C(l), 9, ot);
57
+ key: l,
58
+ value: (a = e.options) == null ? void 0 : a[l]
59
+ }, x(r), 9, ot);
60
60
  }), 128))
61
61
  ], 512)), [
62
- [Re, e.selectedItem]
62
+ [Ne, e.selectedItem]
63
63
  ]) : (d(), h("select", it, [
64
- w("option", null, C(e.props.loadingText || "Loading..."), 1)
64
+ w("option", null, x(e.props.loadingText || "Loading..."), 1)
65
65
  ]));
66
66
  }
67
- const Mn = /* @__PURE__ */ Ce(nt, [["render", rt]]), lt = /* @__PURE__ */ x({
67
+ const Mn = /* @__PURE__ */ xe(nt, [["render", lt]]), rt = /* @__PURE__ */ C({
68
68
  __name: "overlay-anchor",
69
69
  props: {
70
70
  overlayId: {},
71
71
  anchor: {}
72
72
  },
73
73
  setup(e) {
74
- const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, i = O({ visibility: "hidden", top: "0", left: "0" }), s = O([]), o = ee();
75
- L(l);
76
- function l() {
77
- if (!o)
78
- return;
79
- const p = o.vnode.el, { styles: g, classes: m } = r(p, n);
74
+ const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, i = b({ visibility: "hidden", top: "0", left: "0" }), s = b([]), o = ee();
75
+ L(r);
76
+ function r() {
77
+ if (!o) return;
78
+ const p = o.vnode.el, { styles: g, classes: m } = l(p, n);
80
79
  i.value = g, s.value = m;
81
80
  }
82
- function r(p, g) {
81
+ function l(p, g) {
83
82
  const m = t.anchor instanceof HTMLElement ? {} : t.anchor, v = g.getBoundingClientRect(), f = p.getBoundingClientRect();
84
83
  m.matchWidth && (f.width = v.width), m.matchHeight && (f.height = v.height);
85
84
  const u = m.class ? Array.isArray(m.class) ? m.class : [m.class] : [];
@@ -123,7 +122,7 @@ const Mn = /* @__PURE__ */ Ce(nt, [["render", rt]]), lt = /* @__PURE__ */ x({
123
122
  }
124
123
  });
125
124
  let at = 0;
126
- const S = je([]), In = x({
125
+ const S = je([]), In = C({
127
126
  setup() {
128
127
  return () => W("div", [
129
128
  J(S, (e) => W(Ue, { key: e.id, to: "#vf-overlay-target" }, [e.wrapperVnode ?? e.vnode]))
@@ -133,13 +132,13 @@ const S = je([]), In = x({
133
132
  function ie(e, t, n) {
134
133
  const i = document.getElementById("vf-overlay-target") ?? document.createElement("div");
135
134
  i.id = "vf-overlay-target", i.removeAttribute("inert"), document.body.appendChild(i);
136
- const s = String(++at), o = We(e), l = W(o, t), r = n != null && n.anchor ? W(lt, { overlayId: s, anchor: n.anchor }, () => [l]) : void 0, a = {
135
+ const s = String(++at), o = We(e), r = W(o, t), l = n != null && n.anchor ? W(rt, { overlayId: s, anchor: n.anchor }, () => [r]) : void 0, a = {
137
136
  id: s,
138
137
  component: o,
139
138
  props: t,
140
139
  options: n ?? {},
141
- vnode: l,
142
- wrapperVnode: r
140
+ vnode: r,
141
+ wrapperVnode: l
143
142
  };
144
143
  return S.push(a), a;
145
144
  }
@@ -166,10 +165,15 @@ function P(e) {
166
165
  async function se(e, t, n) {
167
166
  return new Promise((i) => {
168
167
  let s = null;
169
- const l = { ...t, callback: (r) => {
170
- P(s), i(r);
168
+ const r = { ...t, callback: async (l) => {
169
+ if (n != null && n.onCallback) {
170
+ const a = n.onCallback(l);
171
+ if (typeof a == "object" && "then" in a && typeof a.then == "function" && await a === !1)
172
+ return;
173
+ }
174
+ P(s), i(l);
171
175
  } };
172
- s = ie(e, l, n);
176
+ s = ie(e, r, n);
173
177
  });
174
178
  }
175
179
  function q(e, t) {
@@ -239,7 +243,7 @@ function _n(e, t) {
239
243
  const n = (s = e.$) == null ? void 0 : s.vnode.el, i = n.closest(".vf-modal");
240
244
  return ht(i ?? n, t);
241
245
  }
242
- function Nn(e) {
246
+ function Rn(e) {
243
247
  var i;
244
248
  const t = (i = e.$) == null ? void 0 : i.vnode.el, n = t.closest(".vf-modal");
245
249
  return Me(n ?? t);
@@ -257,24 +261,22 @@ function Me(e) {
257
261
  const Q = Symbol("FormMaskState");
258
262
  function ft(e, t, n) {
259
263
  const i = e instanceof Element ? e : He(e);
260
- if (!i)
261
- return () => {
262
- };
264
+ if (!i) return () => {
265
+ };
263
266
  i.classList.add("vf-masked");
264
267
  const s = t instanceof Element ? t : i.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
265
268
  let o;
266
269
  s && (o = s.tagName === "INPUT" ? s.value : s.innerHTML, s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...");
267
- const r = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
268
- return r.forEach((a) => a.setAttribute("disabled", "disabled")), i[Q] = {
269
- disabledElements: r,
270
+ const l = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
271
+ return l.forEach((a) => a.setAttribute("disabled", "disabled")), i[Q] = {
272
+ disabledElements: l,
270
273
  waitButton: s,
271
274
  buttonHtml: o
272
275
  }, () => Ie(i);
273
276
  }
274
277
  function Ie(e) {
275
278
  const t = e instanceof Element ? e : He(e);
276
- if (!t)
277
- return;
279
+ if (!t) return;
278
280
  const n = t[Q];
279
281
  n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton && (n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled")), delete t[Q]);
280
282
  }
@@ -289,7 +291,7 @@ const pt = ["id"], mt = {
289
291
  }, vt = { class: "vf-modal-content" }, yt = {
290
292
  key: 1,
291
293
  class: "vf-modal-footer"
292
- }, gt = /* @__PURE__ */ x({
294
+ }, gt = /* @__PURE__ */ C({
293
295
  __name: "modal",
294
296
  props: {
295
297
  id: {},
@@ -302,7 +304,7 @@ const pt = ["id"], mt = {
302
304
  setup(e, { expose: t }) {
303
305
  const n = ee(), i = e;
304
306
  t({ mask: m, unmask: v, hide: f, unhide: u });
305
- const s = O(), o = O(), l = O(!1), r = _(() => ze([i.class, l.value && "hidden"]));
307
+ const s = b(), o = b(), r = b(!1), l = _(() => ze([i.class, r.value && "hidden"]));
306
308
  L(() => {
307
309
  var c;
308
310
  document.body.classList.add("vf-modal-open"), i.closeOnMaskClick && (window.addEventListener("keydown", p), (c = s.value) == null || c.addEventListener("click", a));
@@ -328,14 +330,14 @@ const pt = ["id"], mt = {
328
330
  Ie(o.value);
329
331
  }
330
332
  function f() {
331
- return l.value = !0, () => u();
333
+ return r.value = !0, () => u();
332
334
  }
333
335
  function u() {
334
- l.value = !1;
336
+ r.value = !1;
335
337
  }
336
338
  return (c, T) => (d(), h("div", {
337
339
  id: c.id,
338
- class: k(["vf-overlay vf-modal-wrap", r.value]),
340
+ class: k(["vf-overlay vf-modal-wrap", l.value]),
339
341
  ref_key: "overlay",
340
342
  ref: s
341
343
  }, [
@@ -352,18 +354,18 @@ const pt = ["id"], mt = {
352
354
  key: 0,
353
355
  class: "close",
354
356
  onClick: g
355
- })) : b("", !0)
356
- ])) : b("", !0),
357
+ })) : O("", !0)
358
+ ])) : O("", !0),
357
359
  w("div", vt, [
358
360
  K(c.$slots, "default")
359
361
  ]),
360
362
  c.$slots.footer ? (d(), h("div", yt, [
361
363
  K(c.$slots, "footer")
362
- ])) : b("", !0)
364
+ ])) : O("", !0)
363
365
  ], 34)
364
366
  ], 10, pt));
365
367
  }
366
- }), Et = ["innerHtml"], Tt = ["innerText"], X = /* @__PURE__ */ x({
368
+ }), Et = ["innerHtml"], Tt = ["innerText"], X = /* @__PURE__ */ C({
367
369
  __name: "alert-modal",
368
370
  props: {
369
371
  isBare: { type: Boolean },
@@ -377,8 +379,8 @@ const pt = ["id"], mt = {
377
379
  setup(e) {
378
380
  const t = e, n = _(() => t.message instanceof Error ? ut(t.message) : t.message);
379
381
  return (i, s) => {
380
- const o = Oe("autofocus");
381
- return d(), be(gt, {
382
+ const o = be("autofocus");
383
+ return d(), Oe(gt, {
382
384
  class: k(["vf-alert", i.classes])
383
385
  }, Pe({
384
386
  default: Y(() => [
@@ -396,7 +398,7 @@ const pt = ["id"], mt = {
396
398
  i.title ? {
397
399
  name: "header",
398
400
  fn: Y(() => [
399
- w("h1", null, C(i.title), 1)
401
+ w("h1", null, x(i.title), 1)
400
402
  ]),
401
403
  key: "0"
402
404
  } : void 0,
@@ -432,17 +434,17 @@ const pt = ["id"], mt = {
432
434
  };
433
435
  }
434
436
  });
435
- let R;
437
+ let N;
436
438
  const wt = new Uint8Array(16);
437
- function Ot() {
438
- if (!R && (R = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !R))
439
+ function bt() {
440
+ if (!N && (N = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !N))
439
441
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
440
- return R(wt);
442
+ return N(wt);
441
443
  }
442
444
  const y = [];
443
445
  for (let e = 0; e < 256; ++e)
444
446
  y.push((e + 256).toString(16).slice(1));
445
- function bt(e, t = 0) {
447
+ function Ot(e, t = 0) {
446
448
  return y[e[t + 0]] + y[e[t + 1]] + y[e[t + 2]] + y[e[t + 3]] + "-" + y[e[t + 4]] + y[e[t + 5]] + "-" + y[e[t + 6]] + y[e[t + 7]] + "-" + y[e[t + 8]] + y[e[t + 9]] + "-" + y[e[t + 10]] + y[e[t + 11]] + y[e[t + 12]] + y[e[t + 13]] + y[e[t + 14]] + y[e[t + 15]];
447
449
  }
448
450
  const kt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ue = {
@@ -452,22 +454,16 @@ function St(e, t, n) {
452
454
  if (ue.randomUUID && !t && !e)
453
455
  return ue.randomUUID();
454
456
  e = e || {};
455
- const i = e.random || (e.rng || Ot)();
456
- if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, t) {
457
- n = n || 0;
458
- for (let s = 0; s < 16; ++s)
459
- t[n + s] = i[s];
460
- return t;
461
- }
462
- return bt(i);
457
+ const i = e.random || (e.rng || bt)();
458
+ return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Ot(i);
463
459
  }
464
- function Rn(e) {
460
+ function Nn(e) {
465
461
  return e.replace(/\n/g, "<br>");
466
462
  }
467
- function xt(e) {
463
+ function Ct(e) {
468
464
  return e.replace(/_/g, " ");
469
465
  }
470
- function Ct(e) {
466
+ function xt(e) {
471
467
  const t = e.replace(/\D/g, "").replace(/^1/, "");
472
468
  return t.length != 10 ? e : "(" + t.substring(0, 3) + ") " + t.substring(3, 6) + "-" + t.substring(6);
473
469
  }
@@ -554,16 +550,16 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
554
550
  },
555
551
  optionsDescriptors() {
556
552
  return this.allOptions.map((e, t) => {
557
- var r, a;
558
- 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 = [];
553
+ var l, a;
554
+ const n = this.formatter(e), i = (l = this.subtitleFormatter) == null ? void 0 : l.call(this, e), s = n ? n.trim().toLowerCase() : "", o = i ? i.trim().toLowerCase() : "", r = [];
559
555
  return this.searchFields ? this.searchFields.forEach((p) => {
560
- e[p] && l.push(String(e[p]).toLowerCase());
561
- }) : (l.push(s), o && l.push(o)), {
556
+ e[p] && r.push(String(e[p]).toLowerCase());
557
+ }) : (r.push(s), o && r.push(o)), {
562
558
  // eslint-disable-next-line vue/no-use-computed-property-like-method
563
559
  key: ((a = this.effectiveKeyExtractor) == null ? void 0 : a.call(this, e)) ?? String(t),
564
560
  title: n,
565
561
  subtitle: i,
566
- searchContent: l.join(""),
562
+ searchContent: r.join(""),
567
563
  ref: e
568
564
  };
569
565
  });
@@ -587,11 +583,10 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
587
583
  title: "Create <strong>" + this.searchText.trim() + "</strong>..."
588
584
  }));
589
585
  }
590
- } else
591
- this.nullTitle && e.unshift({
592
- key: D,
593
- title: this.nullTitle
594
- });
586
+ } else this.nullTitle && e.unshift({
587
+ key: D,
588
+ title: this.nullTitle
589
+ });
595
590
  return e;
596
591
  }
597
592
  },
@@ -657,8 +652,7 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
657
652
  if (e.key == "Enter") {
658
653
  e.preventDefault();
659
654
  const t = this.effectiveOptions.find((n) => n.key == this.highlightedOptionKey);
660
- if (t)
661
- return this.selectOption(t);
655
+ if (t) return this.selectOption(t);
662
656
  }
663
657
  if (e.key === "Delete" || e.key === "Backspace") {
664
658
  this.searchText.length > 1 && (this.isSearching = !0);
@@ -682,7 +676,7 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
682
676
  const t = this.effectiveOptions.find((s) => s.ref === e);
683
677
  if (t)
684
678
  return t;
685
- const n = this.keyExtractor ? (s, o) => this.keyExtractor(s) === this.keyExtractor(o) : xe, i = this.effectiveOptions.find((s) => n(s.ref, e));
679
+ const n = this.keyExtractor ? (s, o) => this.keyExtractor(s) === this.keyExtractor(o) : Ce, i = this.effectiveOptions.find((s) => n(s.ref, e));
686
680
  return i || null;
687
681
  },
688
682
  handleInputBlurred() {
@@ -702,8 +696,7 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
702
696
  i.style.visibility = "visible", document.body.appendChild(i), setTimeout(this.highlightInitialOption, 0);
703
697
  },
704
698
  highlightInitialOption() {
705
- if (!this.isLoaded || !this.highlightedOptionKey)
706
- return;
699
+ if (!this.isLoaded || !this.highlightedOptionKey) return;
707
700
  const e = this.effectiveOptions.findIndex((i) => i.key == this.highlightedOptionKey), t = this.$refs.optionsContainer, n = t.querySelectorAll(".option")[e];
708
701
  t.scrollTop = n.offsetTop;
709
702
  },
@@ -713,8 +706,7 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
713
706
  incrementHighlightedOption(e) {
714
707
  const t = this.effectiveOptions.findIndex((o) => o.key == this.highlightedOptionKey);
715
708
  let n = t + e;
716
- if (n < 0 ? n = 0 : n >= this.effectiveOptions.length && (n = this.effectiveOptions.length - 1), t == n)
717
- return;
709
+ if (n < 0 ? n = 0 : n >= this.effectiveOptions.length && (n = this.effectiveOptions.length - 1), t == n) return;
718
710
  this.highlightedOptionKey = this.effectiveOptions[n].key;
719
711
  const i = this.$refs.optionsContainer, s = i.querySelectorAll(".option")[n];
720
712
  s.offsetTop < i.scrollTop ? i.scrollTop = s.offsetTop : s.offsetTop + s.offsetHeight > i.scrollTop + i.clientHeight && (i.scrollTop = s.offsetTop + s.offsetHeight - i.clientHeight);
@@ -751,51 +743,51 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
751
743
  class: "no-results"
752
744
  };
753
745
  function _t(e, t, n, i, s, o) {
754
- const l = Oe("disabled");
746
+ const r = be("disabled");
755
747
  return d(), h("div", {
756
748
  class: k(["vf-smart-select", { disabled: o.effectiveDisabled, open: e.shouldDisplayOptions }])
757
749
  }, [
758
750
  j(w("input", {
759
- "onUpdate:modelValue": t[0] || (t[0] = (r) => e.searchText = r),
751
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => e.searchText = l),
760
752
  ref: "searchField",
761
753
  type: "text",
762
754
  class: k({ nullable: !!n.nullTitle }),
763
- onKeydown: t[1] || (t[1] = (...r) => o.handleKeyDown && o.handleKeyDown(...r)),
755
+ onKeydown: t[1] || (t[1] = (...l) => o.handleKeyDown && o.handleKeyDown(...l)),
764
756
  placeholder: o.effectivePlaceholder,
765
- onFocus: t[2] || (t[2] = (...r) => o.handleInputFocused && o.handleInputFocused(...r)),
766
- onBlur: t[3] || (t[3] = (...r) => o.handleInputBlurred && o.handleInputBlurred(...r)),
757
+ onFocus: t[2] || (t[2] = (...l) => o.handleInputFocused && o.handleInputFocused(...l)),
758
+ onBlur: t[3] || (t[3] = (...l) => o.handleInputBlurred && o.handleInputBlurred(...l)),
767
759
  required: n.required,
768
760
  "data-1p-ignore": ""
769
761
  }, null, 42, Ht), [
770
762
  [qe, e.searchText],
771
- [l, o.effectiveDisabled]
763
+ [r, o.effectiveDisabled]
772
764
  ]),
773
765
  e.shouldDisplayOptions ? (d(), h("div", Dt, [
774
766
  e.isLoaded ? (d(), h(U, { key: 1 }, [
775
- (d(!0), h(U, null, J(o.effectiveOptions, (r) => (d(), h("div", {
776
- key: String(r.key),
767
+ (d(!0), h(U, null, J(o.effectiveOptions, (l) => (d(), h("div", {
768
+ key: String(l.key),
777
769
  class: k(["option", {
778
- highlighted: e.highlightedOptionKey === r.key
770
+ highlighted: e.highlightedOptionKey === l.key
779
771
  }]),
780
- onMousemove: (a) => o.handleOptionHover(r),
781
- onMousedown: (a) => o.selectOption(r)
772
+ onMousemove: (a) => o.handleOptionHover(l),
773
+ onMousedown: (a) => o.selectOption(l)
782
774
  }, [
783
775
  w("div", {
784
776
  class: "title",
785
- innerHTML: r.title
777
+ innerHTML: l.title
786
778
  }, null, 8, Bt),
787
- r.subtitle ? (d(), h("div", {
779
+ l.subtitle ? (d(), h("div", {
788
780
  key: 0,
789
781
  class: "subtitle",
790
- innerHTML: r.subtitle
791
- }, null, 8, Vt)) : b("", !0)
782
+ innerHTML: l.subtitle
783
+ }, null, 8, Vt)) : O("", !0)
792
784
  ], 42, $t))), 128)),
793
- !o.effectiveOptions.length && e.searchText ? (d(), h("div", Ft, C(o.effectiveNoResultsText), 1)) : b("", !0)
785
+ !o.effectiveOptions.length && e.searchText ? (d(), h("div", Ft, x(o.effectiveNoResultsText), 1)) : O("", !0)
794
786
  ], 64)) : (d(), h("div", At, "Loading..."))
795
- ], 512)) : b("", !0)
787
+ ], 512)) : O("", !0)
796
788
  ], 2);
797
789
  }
798
- const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
790
+ const Rt = /* @__PURE__ */ xe(It, [["render", _t]]), jn = /* @__PURE__ */ C({
799
791
  __name: "ez-smart-select",
800
792
  props: {
801
793
  modelValue: {},
@@ -806,36 +798,36 @@ const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
806
798
  },
807
799
  emits: ["update:modelValue"],
808
800
  setup(e, { emit: t }) {
809
- const n = e, i = _(() => Array.isArray(n.options) ? n.options.map((r) => ({ value: r, label: r })) : Object.entries(n.options).map(([r, a]) => ({
810
- value: r,
801
+ const n = e, i = _(() => Array.isArray(n.options) ? n.options.map((l) => ({ value: l, label: l })) : Object.entries(n.options).map(([l, a]) => ({
802
+ value: l,
811
803
  label: a
812
- }))), s = _(() => n.formatter ? (r) => {
804
+ }))), s = _(() => n.formatter ? (l) => {
813
805
  var a;
814
- return (a = n.formatter) == null ? void 0 : a.call(n, r.label);
815
- } : (r) => r.label), o = t, l = O(i.value.find((r) => r.value === n.modelValue) ?? null);
806
+ return (a = n.formatter) == null ? void 0 : a.call(n, l.label);
807
+ } : (l) => l.label), o = t, r = b(i.value.find((l) => l.value === n.modelValue) ?? null);
816
808
  return ce(
817
809
  () => n.modelValue,
818
- (r) => {
819
- l.value = i.value.find((a) => a.value === r) ?? null;
810
+ (l) => {
811
+ r.value = i.value.find((a) => a.value === l) ?? null;
820
812
  }
821
- ), ce(l, (r) => {
813
+ ), ce(r, (l) => {
822
814
  var a;
823
- o("update:modelValue", r ? ((a = i.value.find((p) => xe(p, r))) == null ? void 0 : a.value) ?? null : null);
824
- }), (r, a) => (d(), be(Nt, {
825
- modelValue: l.value,
826
- "onUpdate:modelValue": a[0] || (a[0] = (p) => l.value = p),
815
+ o("update:modelValue", l ? ((a = i.value.find((p) => Ce(p, l))) == null ? void 0 : a.value) ?? null : null);
816
+ }), (l, a) => (d(), Oe(Rt, {
817
+ modelValue: r.value,
818
+ "onUpdate:modelValue": a[0] || (a[0] = (p) => r.value = p),
827
819
  options: i.value,
828
820
  formatter: s.value,
829
- "null-title": r.nullTitle
821
+ "null-title": l.nullTitle
830
822
  }, null, 8, ["modelValue", "options", "formatter", "null-title"]));
831
823
  }
832
- }), Rt = { class: "content" }, Kt = { class: "message" }, jt = {
824
+ }), Nt = { class: "content" }, Kt = { class: "message" }, jt = {
833
825
  key: 0,
834
826
  class: "close"
835
827
  }, Ut = {
836
828
  key: 0,
837
829
  class: "progress-bar"
838
- }, Wt = /* @__PURE__ */ x({
830
+ }, Wt = /* @__PURE__ */ C({
839
831
  __name: "toast",
840
832
  props: {
841
833
  message: {},
@@ -850,7 +842,7 @@ const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
850
842
  function n() {
851
843
  t.onClick ? t.onClick() : t.disableClose || t.callback();
852
844
  }
853
- const i = O();
845
+ const i = b();
854
846
  return t.durationSecs !== null && L(() => {
855
847
  var o;
856
848
  const s = t.durationSecs ?? 5;
@@ -862,9 +854,9 @@ const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
862
854
  class: k(["vf-toast", s.className]),
863
855
  onClick: te(n, ["stop"])
864
856
  }, [
865
- w("div", Rt, [
866
- w("div", Kt, C(s.message), 1),
867
- s.disableClose ? b("", !0) : (d(), h("div", jt, "x"))
857
+ w("div", Nt, [
858
+ w("div", Kt, x(s.message), 1),
859
+ s.disableClose ? O("", !0) : (d(), h("div", jt, "x"))
868
860
  ]),
869
861
  s.durationSecs !== null ? (d(), h("div", Ut, [
870
862
  w("div", {
@@ -872,7 +864,7 @@ const Nt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ x({
872
864
  ref: i,
873
865
  class: "inner"
874
866
  }, null, 512)
875
- ])) : b("", !0)
867
+ ])) : O("", !0)
876
868
  ], 2));
877
869
  }
878
870
  });
@@ -897,7 +889,7 @@ function Xt(e) {
897
889
  return e === null || typeof e == "string" && !/^\d+$/.test(e) ? e : nn(Number(e));
898
890
  }
899
891
  function Yt(e) {
900
- return e && Ct(e);
892
+ return e && xt(e);
901
893
  }
902
894
  function Zt(e) {
903
895
  return e ? Ye(e) : null;
@@ -909,7 +901,7 @@ function Qt(e) {
909
901
  return e ? e.toUpperCase() : null;
910
902
  }
911
903
  function Jt(e) {
912
- return e ? xt(e) : null;
904
+ return e ? Ct(e) : null;
913
905
  }
914
906
  function en(e, t = 1) {
915
907
  return Lt(e, t);
@@ -948,7 +940,7 @@ function qn(e, t) {
948
940
  const u = document.createElement("div");
949
941
  u.classList.add("item"), u.style.userSelect = "none", u.innerText = f.title, i.appendChild(u), f.class && u.classList.add(f.class), f.shouldConfirm ? u.addEventListener("click", (c) => v(c, u, f.handler)) : u.addEventListener("click", () => f.handler());
950
942
  });
951
- const o = window.innerWidth - e.clientX, l = window.innerHeight - e.clientY, r = i.offsetHeight, a = i.offsetWidth, p = o < a ? e.clientX - a - 1 : e.clientX + 1, g = l < r ? e.clientY - r - 1 : e.clientY + 1;
943
+ const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l = i.offsetHeight, a = i.offsetWidth, p = o < a ? e.clientX - a - 1 : e.clientX + 1, g = r < l ? e.clientY - l - 1 : e.clientY + 1;
952
944
  i.style.left = p + "px", i.style.top = g + "px", setTimeout(() => {
953
945
  i.style.width = i.offsetWidth + "px";
954
946
  }, 50);
@@ -990,7 +982,7 @@ function Zn(e) {
990
982
  }
991
983
  });
992
984
  }
993
- const re = Symbol("HookState");
985
+ const le = Symbol("HookState");
994
986
  function Gn(e, t) {
995
987
  const n = t ?? ee();
996
988
  L(() => sn(n, e), n), ke(() => on(n), n), Se(() => pe(n), n), ne(() => pe(n), n);
@@ -1001,23 +993,22 @@ function sn(e, t) {
1001
993
  const i = De(e.vnode.el);
1002
994
  i ? n.ancestor = new V(i, t.ancestorScrolledToBottom) : console.warn("[VueFoundation] No scollable ancestor found for component:", e);
1003
995
  }
1004
- t.windowScrolledToBottom && (n.window = new V(window, t.windowScrolledToBottom)), e[re] = n;
996
+ t.windowScrolledToBottom && (n.window = new V(window, t.windowScrolledToBottom)), e[le] = n;
1005
997
  }
1006
998
  function on(e) {
1007
999
  var n, i, s;
1008
- const t = e[re];
1000
+ const t = e[le];
1009
1001
  (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();
1010
1002
  }
1011
1003
  function pe(e) {
1012
1004
  var n, i, s;
1013
- const t = e[re];
1005
+ const t = e[le];
1014
1006
  (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();
1015
1007
  }
1016
1008
  const Z = ["auto", "scroll"];
1017
1009
  function De(e) {
1018
1010
  const t = e.parentElement;
1019
- if (!t)
1020
- return null;
1011
+ if (!t) return null;
1021
1012
  const n = window.getComputedStyle(t);
1022
1013
  return Z.includes(n.overflow) || Z.includes(n.overflowX) || Z.includes(n.overflowY) ? t : De(t);
1023
1014
  }
@@ -1040,24 +1031,23 @@ class V {
1040
1031
  function Qn(e) {
1041
1032
  L(() => window.addEventListener("resize", e)), ke(() => window.addEventListener("resize", e)), Se(() => window.removeEventListener("resize", e)), ne(() => window.removeEventListener("resize", e));
1042
1033
  }
1043
- const rn = {
1034
+ const ln = {
1044
1035
  mounted: ve,
1045
1036
  updated: ve
1046
1037
  }, me = Symbol("HasAutoFocused");
1047
1038
  function ve(e, t) {
1048
- if (t.value === void 0 && e[me] || t.value !== void 0 && !t.value || t.oldValue !== void 0 && t.value == t.oldValue)
1049
- return;
1039
+ if (t.value === void 0 && e[me] || t.value !== void 0 && !t.value || t.oldValue !== void 0 && t.value == t.oldValue) return;
1050
1040
  e[me] = !0;
1051
1041
  const n = ["BUTTON", "INPUT", "TEXTAREA", "SELECT"].indexOf(e.tagName) > -1 ? e : e.querySelectorAll("input")[0];
1052
1042
  setTimeout(() => n.focus(), 10);
1053
1043
  }
1054
- const ln = {
1044
+ const rn = {
1055
1045
  mounted: an
1056
1046
  }, A = Symbol("ConfirmState");
1057
1047
  function an(e, t) {
1058
1048
  e.addEventListener("click", (n) => {
1059
- var l, r;
1060
- const i = Date.now(), s = ((l = t.value) == null ? void 0 : l.text) !== void 0 ? t.value.text : "Confirm";
1049
+ var r, l;
1050
+ const i = Date.now(), s = ((r = t.value) == null ? void 0 : r.text) !== void 0 ? t.value.text : "Confirm";
1061
1051
  if (e[A]) {
1062
1052
  if (i - e[A].initTime < 300)
1063
1053
  return;
@@ -1073,7 +1063,7 @@ function an(e, t) {
1073
1063
  s && (e.innerHTML = o.preconfirmHtml), (a = t.value) != null && a.class && e.classList.remove(t.value.class), e.blur(), e.removeEventListener("mouseout", o.resetHandler), delete e[A];
1074
1064
  }
1075
1065
  };
1076
- e[A] = o, s && (e.innerHTML = s), (r = t.value) != null && r.class && e.classList.add(t.value.class), e.addEventListener("mouseout", o.resetHandler);
1066
+ e[A] = o, s && (e.innerHTML = s), (l = t.value) != null && l.class && e.classList.add(t.value.class), e.addEventListener("mouseout", o.resetHandler);
1077
1067
  });
1078
1068
  }
1079
1069
  const cn = {
@@ -1101,14 +1091,14 @@ function hn(e, t) {
1101
1091
  let n = "";
1102
1092
  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);
1103
1093
  e.attributes.getNamedItem("display-utc") !== null && o.setMinutes(o.getMinutes() - o.getTimezoneOffset());
1104
- let l = (p = e.attributes.getNamedItem("format")) == null ? void 0 : p.value;
1105
- if (!l && e.attributes.getNamedItem("relative-date") !== null) {
1094
+ let r = (p = e.attributes.getNamedItem("format")) == null ? void 0 : p.value;
1095
+ if (!r && e.attributes.getNamedItem("relative-date") !== null) {
1106
1096
  const g = /* @__PURE__ */ new Date();
1107
- g.getFullYear() == o.getFullYear() && g.getMonth() == o.getMonth() && g.getDate() == o.getDate() && (n = "at", l = "HH:mm");
1097
+ g.getFullYear() == o.getFullYear() && g.getMonth() == o.getMonth() && g.getDate() == o.getDate() && (n = "at", r = "HH:mm");
1108
1098
  }
1109
- l || (e.attributes.getNamedItem("date-only") !== null ? l = M.defaultDateFormat : l = M.defaultDateTimeFormat);
1110
- let r = G(o, l);
1111
- return n && (r = n + " " + r), r;
1099
+ r || (e.attributes.getNamedItem("date-only") !== null ? r = M.defaultDateFormat : r = M.defaultDateTimeFormat);
1100
+ let l = G(o, r);
1101
+ return n && (l = n + " " + l), l;
1112
1102
  }
1113
1103
  const fn = {
1114
1104
  beforeMount: ge,
@@ -1125,29 +1115,27 @@ const mn = {
1125
1115
  beforeMount: Ee,
1126
1116
  updated: Ee,
1127
1117
  unmounted: $e
1128
- }, N = Symbol("HasAutoFocused"), le = [];
1118
+ }, R = Symbol("HasAutoFocused"), re = [];
1129
1119
  function vn() {
1130
- le.forEach(Ae);
1120
+ re.forEach(Ae);
1131
1121
  }
1132
1122
  setInterval(vn, 1e3);
1133
1123
  function Ee(e, t) {
1134
- var l;
1135
- if (t.value == t.oldValue)
1136
- return;
1137
- if (!t.value)
1138
- return $e(e);
1139
- 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;
1140
- e[N] || le.push(e), e[N] = {
1124
+ var r;
1125
+ if (t.value == t.oldValue) return;
1126
+ if (!t.value) return $e(e);
1127
+ const n = new Date(t.value), i = (r = e.attributes.getNamedItem("base-time")) == null ? void 0 : r.value, s = n.getTime() - (i ? new Date(i).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
1128
+ e[R] || re.push(e), e[R] = {
1141
1129
  startTs: s,
1142
1130
  includeSeconds: o
1143
1131
  }, Ae(e);
1144
1132
  }
1145
1133
  function Ae(e) {
1146
- const t = e[N], n = Math.round((Date.now() - t.startTs) / 1e3);
1134
+ const t = e[R], n = Math.round((Date.now() - t.startTs) / 1e3);
1147
1135
  e.innerText = yn(n, t.includeSeconds);
1148
1136
  }
1149
1137
  function $e(e) {
1150
- e[N] && (Qe(le, e), delete e[N]), e.innerText = "-";
1138
+ e[R] && (Qe(re, e), delete e[R]), e.innerText = "-";
1151
1139
  }
1152
1140
  function yn(e, t) {
1153
1141
  const n = [], i = Math.floor(e / 86400);
@@ -1234,8 +1222,8 @@ class wn {
1234
1222
  }
1235
1223
  handleMouseMove(t) {
1236
1224
  const n = this.tipEl.offsetWidth, i = this.tipEl.offsetHeight, s = window.innerWidth, o = window.innerHeight;
1237
- let l = t.pageX + 10, r = t.pageY + 20;
1238
- 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;
1225
+ let r = t.pageX + 10, l = t.pageY + 20;
1226
+ r + n > s && (r = t.pageX - 5 - n), l + i > o && (l = t.pageY - 5 - i), this.tipEl.style.left = r + "px", this.tipEl.style.top = l + "px", this.lastMoveEvt = t;
1239
1227
  }
1240
1228
  checkMoveEvent() {
1241
1229
  var t;
@@ -1245,11 +1233,11 @@ class wn {
1245
1233
  this.shouldShow = !1, this.removeTooltip(), this.el.removeEventListener("mouseenter", this.handleTargetMouseEnterWithContext), this.el.removeEventListener("mouseleave", this.handleTargetMouseLeaveWithContext);
1246
1234
  }
1247
1235
  }
1248
- function On(e) {
1249
- e.directive("autofocus", rn), e.directive("confirm-button", ln), e.directive("date-input", cn), e.directive("datetime", un), e.directive("disabled", fn), e.directive("duration", mn), e.directive("infinite-scroll", gn), e.directive("readonly", En), e.directive("tooltip", Tn);
1236
+ function bn(e) {
1237
+ e.directive("autofocus", ln), e.directive("confirm-button", rn), e.directive("date-input", cn), e.directive("datetime", un), e.directive("disabled", fn), e.directive("duration", mn), e.directive("infinite-scroll", gn), e.directive("readonly", En), e.directive("tooltip", Tn);
1250
1238
  }
1251
1239
  function Jn(e) {
1252
- On(e);
1240
+ bn(e);
1253
1241
  }
1254
1242
  export {
1255
1243
  In as OverlayContainer,
@@ -1258,12 +1246,12 @@ export {
1258
1246
  X as VfAlertModal,
1259
1247
  jn as VfEzSmartSelect,
1260
1248
  gt as VfModal,
1261
- Nt as VfSmartSelect,
1249
+ Rt as VfSmartSelect,
1262
1250
  Xn as cloneProp,
1263
1251
  Bn as configureVf,
1264
1252
  Wn as createFilters,
1265
1253
  ie as createOverlayInjection,
1266
- xt as desnakeCase,
1254
+ Ct as desnakeCase,
1267
1255
  dt as dismissOverlayInjectionById,
1268
1256
  Hn as dismissOverlayInjectionByInstance,
1269
1257
  Le as dismissOverlayInjectionByInternalInstance,
@@ -1271,7 +1259,7 @@ export {
1271
1259
  ni as escapeHtml,
1272
1260
  ut as formatError,
1273
1261
  nn as formatNumber,
1274
- Ct as formatPhone,
1262
+ xt as formatPhone,
1275
1263
  Lt as formatUSCurrency,
1276
1264
  Fn as handleError,
1277
1265
  Vn as handleErrorAndAlert,
@@ -1280,7 +1268,7 @@ export {
1280
1268
  _n as maskComponent,
1281
1269
  ht as maskEl,
1282
1270
  ft as maskForm,
1283
- Rn as nl2br,
1271
+ Nn as nl2br,
1284
1272
  Yn as nullifyEmptyInputs,
1285
1273
  se as presentOverlay,
1286
1274
  P as removeOverlayInjection,
@@ -1294,7 +1282,7 @@ export {
1294
1282
  tn as sleep,
1295
1283
  zn as sleepSecs,
1296
1284
  oe as toError,
1297
- Nn as unmaskComponent,
1285
+ Rn as unmaskComponent,
1298
1286
  Me as unmaskEl,
1299
1287
  Ie as unmaskForm,
1300
1288
  Gn as useInfiniteScroll,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.13.9",
4
+ "version": "4.14.1",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -52,16 +52,16 @@
52
52
  "@types/node": "^20.10.5",
53
53
  "@types/uuid": "^9.0.7",
54
54
  "@vitejs/plugin-vue": "^5.0.0",
55
- "@vue/eslint-config-prettier": "^8.0.0",
56
- "@vue/eslint-config-typescript": "^12.0.0",
55
+ "@vue/eslint-config-prettier": "^9.0.0",
56
+ "@vue/eslint-config-typescript": "^13.0.0",
57
57
  "@vue/test-utils": "^2.4.3",
58
58
  "@vue/tsconfig": "^0.5.1",
59
59
  "cypress": "^13.6.2",
60
60
  "date-fns": "^3.0.6",
61
61
  "eslint": "^8.56.0",
62
- "eslint-plugin-cypress": "^2.15.1",
63
- "eslint-plugin-simple-import-sort": "^10.0.0",
64
- "eslint-plugin-unused-imports": "^3.0.0",
62
+ "eslint-plugin-cypress": "^3.3.0",
63
+ "eslint-plugin-simple-import-sort": "^12.1.0",
64
+ "eslint-plugin-unused-imports": "^4.0.0",
65
65
  "eslint-plugin-vue": "^9.19.2",
66
66
  "jsdom": "^23.0.1",
67
67
  "lodash": "^4.17.21",
@@ -19,21 +19,22 @@ import {
19
19
  import OverlayAnchor from './overlay-anchor.vue';
20
20
  import type { OverlayAnchorOptions } from './overlay-types';
21
21
 
22
- interface OverlayOptions {
22
+ interface OverlayOptions<C extends OverlayComponent, R extends ComponentReturn<C>> {
23
23
  anchor?: OverlayAnchorOptions;
24
+ onCallback?: (result: R) => void | Promise<boolean>;
24
25
  }
25
26
 
26
- export interface OverlayInjection<C extends OverlayComponent> {
27
+ export interface OverlayInjection<C extends OverlayComponent, R extends ComponentReturn<C>> {
27
28
  id: string;
28
29
  component: OverlayComponentUnwrapped<C>;
29
30
  props: OverlayComponentProps<C>;
30
- options: OverlayOptions;
31
+ options: OverlayOptions<C, R>;
31
32
  vnode: VNode;
32
33
  wrapperVnode?: VNode;
33
34
  }
34
35
 
35
36
  let overlayCount = 0;
36
- const OverlayInjections: OverlayInjection<any>[] = reactive([]);
37
+ const OverlayInjections: OverlayInjection<any, any>[] = reactive([]);
37
38
 
38
39
  export const OverlayContainer = defineComponent({
39
40
  setup() {
@@ -62,9 +63,8 @@ export type Vue__ComponentPublicInstanceConstructor<
62
63
  new (...args: any[]): T;
63
64
  };
64
65
 
65
- export type ObjectComponentConfig<T extends Vue__ComponentPublicInstanceConstructor> = T extends Vue__ComponentPublicInstanceConstructor<infer P>
66
- ? P
67
- : never;
66
+ export type ObjectComponentConfig<T extends Vue__ComponentPublicInstanceConstructor> =
67
+ T extends Vue__ComponentPublicInstanceConstructor<infer P> ? P : never;
68
68
  export type ObjectComponentProps<T extends Vue__ComponentPublicInstanceConstructor> = Writable<
69
69
  Omit<ObjectComponentConfig<T>['$props'], keyof VNodeProps | keyof AllowedComponentProps>
70
70
  >;
@@ -92,11 +92,11 @@ type ComponentReturn<M extends OverlayComponent> = OverlayComponentProps<M> exte
92
92
 
93
93
  export type AnyComponentPublicInstance = { $?: ComponentInternalInstance };
94
94
 
95
- export function createOverlayInjection<C extends OverlayComponent>(
95
+ export function createOverlayInjection<C extends OverlayComponent, R extends ComponentReturn<C>>(
96
96
  component: C,
97
97
  props: OverlayComponentProps<C>,
98
- options?: OverlayOptions
99
- ): OverlayInjection<C> {
98
+ options?: OverlayOptions<C, R>
99
+ ): OverlayInjection<C, R> {
100
100
  // create or reconfigure the existing overlay target
101
101
  // re-injecting every time keeps the overlay container at the very end of the DOM
102
102
  const targetEl = document.getElementById('vf-overlay-target') ?? document.createElement('div');
@@ -110,7 +110,7 @@ export function createOverlayInjection<C extends OverlayComponent>(
110
110
  const wrapperVnode = options?.anchor ? h(OverlayAnchor, { overlayId, anchor: options.anchor }, () => [vnode]) : undefined;
111
111
 
112
112
  // todo: dunno what's going on with types here
113
- const injection: OverlayInjection<C> = {
113
+ const injection: OverlayInjection<C, R> = {
114
114
  id: overlayId,
115
115
  component: rawComponent as any,
116
116
  props,
@@ -152,7 +152,7 @@ export function dismissOverlayInjectionById(id: string) {
152
152
  return false;
153
153
  }
154
154
 
155
- export function removeOverlayInjection(injection: OverlayInjection<any>) {
155
+ export function removeOverlayInjection(injection: OverlayInjection<any, any>) {
156
156
  const index = OverlayInjections.indexOf(injection);
157
157
  if (index >= 0) {
158
158
  OverlayInjections.splice(index, 1);
@@ -162,11 +162,22 @@ export function removeOverlayInjection(injection: OverlayInjection<any>) {
162
162
  export async function presentOverlay<C extends OverlayComponent, R extends ComponentReturn<C>>(
163
163
  component: C,
164
164
  props: Omit<OverlayComponentProps<C>, 'callback'>,
165
- options?: OverlayOptions
165
+ options?: OverlayOptions<C, R>
166
166
  ): Promise<R | undefined> {
167
167
  return new Promise<R>(resolve => {
168
- let overlayInjection: OverlayInjection<C> | null = null;
169
- const callback = (result: R) => {
168
+ let overlayInjection: OverlayInjection<C, R> | null = null;
169
+ const callback = async (result: R) => {
170
+ if (options?.onCallback) {
171
+ const hookResult = options.onCallback(result);
172
+ if (typeof hookResult === 'object' && 'then' in hookResult && typeof hookResult.then === 'function') {
173
+ // ^ hack for ZoneAwarePromise
174
+ const hookResultValue = await hookResult;
175
+ if (hookResultValue === false) {
176
+ return;
177
+ }
178
+ }
179
+ }
180
+
170
181
  removeOverlayInjection(overlayInjection!);
171
182
  resolve(result);
172
183
  };
@@ -2,7 +2,7 @@ import { createOverlayInjection, type OverlayInjection, removeOverlayInjection }
2
2
  import Toast, { type IToastOptions } from './toast.vue';
3
3
 
4
4
  export function showToast(options: IToastOptions) {
5
- const injection: OverlayInjection<typeof Toast> = createOverlayInjection(Toast, {
5
+ const injection: OverlayInjection<typeof Toast, unknown> = createOverlayInjection(Toast, {
6
6
  ...options,
7
7
  callback: () => removeOverlayInjection(injection)
8
8
  });