@signal24/vue-foundation 4.2.0 → 4.2.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,4 +1,4 @@
1
- import type { AnyComponentPublicInstance } from '@/components';
1
+ import type { AnyComponentPublicInstance } from '../components/modal-container';
2
2
  declare const MaskState: unique symbol;
3
3
  interface IMaskState {
4
4
  [MaskState]?: {
@@ -1,16 +1,16 @@
1
1
  var Ce = Object.defineProperty;
2
- var Le = (e, t, n) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var f = (e, t, n) => (Le(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import { defineComponent as x, defineProps as Ie, defineEmits as De, 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 P, vModelSelect as He, reactive as $e, h as ue, markRaw as Ae, onMounted as W, onBeforeUnmount as q, getCurrentInstance as he, createBlock as U, Teleport as Be, normalizeClass as E, withModifiers as Ve, renderSlot as F, resolveDirective as fe, createSlots as Fe, withCtx as _, createTextVNode as Q, vModelText as _e, watch as J, onActivated as pe, onDeactivated as me } from "vue";
2
+ var xe = (e, t, n) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var f = (e, t, n) => (xe(e, typeof t != "symbol" ? t + "" : t, n), n);
4
+ import { defineComponent as L, defineProps as Ie, defineEmits as He, ref as I, computed as H, openBlock as a, createElementBlock as d, createElementVNode as v, toDisplayString as w, withDirectives as D, createCommentVNode as g, Fragment as $, renderList as P, vModelSelect as De, reactive as $e, h as ue, markRaw as Ae, onMounted as W, onBeforeUnmount as q, getCurrentInstance as he, createBlock as U, Teleport as Be, normalizeClass as E, withModifiers as Ve, renderSlot as F, resolveDirective as fe, createSlots as Fe, withCtx as _, createTextVNode as Q, vModelText as _e, watch as J, onActivated as pe, onDeactivated as me } from "vue";
5
5
  import { debounce as Ne, isEqual as ve, upperFirst as Ke, startCase as Re, cloneDeep as je, remove as Pe } from "lodash";
6
6
  import { escapeHtml as We } from "@vue/shared";
7
- import { escapeHtml as Hn } from "@vue/shared";
7
+ import { escapeHtml as Dn } from "@vue/shared";
8
8
  import { format as R } from "date-fns";
9
- const qe = x({
9
+ const qe = L({
10
10
  setup() {
11
11
  const e = Ie();
12
- De(["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);
12
+ He(["update:modelValue"]);
13
+ const t = I(null), n = H(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), i = I(e.modelValue ?? null);
14
14
  return { props: e, options: t, renderOptions: n, selectedItem: i };
15
15
  },
16
16
  watch: {
@@ -45,7 +45,7 @@ const qe = x({
45
45
  value: null
46
46
  }, Xe = ["value"];
47
47
  function Ye(e, t, n, i, s, o) {
48
- return e.renderOptions ? H((a(), d("select", {
48
+ return e.renderOptions ? D((a(), d("select", {
49
49
  key: 1,
50
50
  "onUpdate:modelValue": t[0] || (t[0] = (l) => e.selectedItem = l)
51
51
  }, [
@@ -58,14 +58,14 @@ function Ye(e, t, n, i, s, o) {
58
58
  }, w(l), 9, Xe);
59
59
  }), 128))
60
60
  ], 512)), [
61
- [He, e.selectedItem]
61
+ [De, e.selectedItem]
62
62
  ]) : (a(), d("select", Ue, [
63
63
  v("option", null, w(e.props.loadingText || "Loading..."), 1)
64
64
  ]));
65
65
  }
66
66
  const rn = /* @__PURE__ */ ge(qe, [["render", Ye]]);
67
67
  let Ze = 0;
68
- const y = $e([]), an = x({
68
+ const y = $e([]), an = L({
69
69
  setup() {
70
70
  return () => ue("div", { id: "modal-container" }, [
71
71
  P(y, (e) => e.vnode)
@@ -173,7 +173,7 @@ const Je = ["id"], et = {
173
173
  }, tt = { class: "vf-modal-content" }, nt = {
174
174
  key: 1,
175
175
  class: "vf-modal-footer"
176
- }, it = /* @__PURE__ */ x({
176
+ }, it = /* @__PURE__ */ L({
177
177
  __name: "modal",
178
178
  props: {
179
179
  id: {},
@@ -235,7 +235,7 @@ const Je = ["id"], et = {
235
235
  ]));
236
236
  }
237
237
  });
238
- const st = ["innerHtml"], ot = ["innerText"], V = /* @__PURE__ */ x({
238
+ const st = ["innerHtml"], ot = ["innerText"], V = /* @__PURE__ */ L({
239
239
  __name: "alert-modal",
240
240
  props: {
241
241
  isBare: { type: Boolean },
@@ -247,7 +247,7 @@ const st = ["innerHtml"], ot = ["innerText"], V = /* @__PURE__ */ x({
247
247
  callback: { type: Function }
248
248
  },
249
249
  setup(e) {
250
- const t = e, n = D(() => t.message instanceof Error ? Qe(t.message) : t.message);
250
+ const t = e, n = H(() => t.message instanceof Error ? Qe(t.message) : t.message);
251
251
  return (i, s) => {
252
252
  const o = fe("autofocus");
253
253
  return a(), U(it, {
@@ -276,7 +276,7 @@ const st = ["innerHtml"], ot = ["innerText"], V = /* @__PURE__ */ x({
276
276
  name: "footer",
277
277
  fn: _(() => [
278
278
  i.shouldConfirm ? (a(), d($, { key: 0 }, [
279
- H((a(), d("button", {
279
+ D((a(), d("button", {
280
280
  class: "primary",
281
281
  onClick: s[0] || (s[0] = () => i.callback(!0))
282
282
  }, [
@@ -288,7 +288,7 @@ const st = ["innerHtml"], ot = ["innerText"], V = /* @__PURE__ */ x({
288
288
  class: "default",
289
289
  onClick: s[1] || (s[1] = () => i.callback(!1))
290
290
  }, "Cancel")
291
- ], 64)) : H((a(), d("button", {
291
+ ], 64)) : D((a(), d("button", {
292
292
  key: 1,
293
293
  class: "default",
294
294
  onClick: s[2] || (s[2] = () => i.callback(!0))
@@ -600,7 +600,7 @@ function yt(e, t, n, i, s, o) {
600
600
  return a(), d("div", {
601
601
  class: E(["vf-smart-select", { disabled: o.effectiveDisabled, open: e.shouldDisplayOptions }])
602
602
  }, [
603
- H(v("input", {
603
+ D(v("input", {
604
604
  "onUpdate:modelValue": t[0] || (t[0] = (r) => e.searchText = r),
605
605
  ref: "searchField",
606
606
  type: "text",
@@ -638,7 +638,7 @@ function yt(e, t, n, i, s, o) {
638
638
  ], 512)) : g("", !0)
639
639
  ], 2);
640
640
  }
641
- const Et = /* @__PURE__ */ ge(dt, [["render", yt]]), gn = /* @__PURE__ */ x({
641
+ const Et = /* @__PURE__ */ ge(dt, [["render", yt]]), gn = /* @__PURE__ */ L({
642
642
  __name: "ez-smart-select",
643
643
  props: {
644
644
  modelValue: {},
@@ -649,10 +649,10 @@ const Et = /* @__PURE__ */ ge(dt, [["render", yt]]), gn = /* @__PURE__ */ x({
649
649
  },
650
650
  emits: ["update:modelValue"],
651
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]) => ({
652
+ const n = e, i = H(() => Array.isArray(n.options) ? n.options.map((l) => ({ value: l, label: l })) : Object.entries(n.options).map(([l, r]) => ({
653
653
  value: l,
654
654
  label: r
655
- }))), s = D(() => n.formatter ? (l) => {
655
+ }))), s = H(() => n.formatter ? (l) => {
656
656
  var r;
657
657
  return (r = n.formatter) == null ? void 0 : r.call(n, l.label);
658
658
  } : (l) => l.label), o = I(i.value.find((l) => l.value === n.modelValue) ?? null);
@@ -695,13 +695,13 @@ function kt(e) {
695
695
  function Mt(e) {
696
696
  return e ? Re(e) : null;
697
697
  }
698
- function xt(e) {
698
+ function Lt(e) {
699
699
  return e ? e.toUpperCase() : null;
700
700
  }
701
701
  function Ct(e) {
702
702
  return e ? lt(e) : null;
703
703
  }
704
- function Lt(e) {
704
+ function xt(e) {
705
705
  return at(e);
706
706
  }
707
707
  const ne = {
@@ -712,9 +712,9 @@ const ne = {
712
712
  phone: St,
713
713
  upperFirst: kt,
714
714
  startCase: Mt,
715
- upperCase: xt,
715
+ upperCase: Lt,
716
716
  desnake: Ct,
717
- usCurrency: Lt
717
+ usCurrency: xt
718
718
  }, yn = (e) => ({
719
719
  ...ne,
720
720
  ...e(ne)
@@ -731,12 +731,12 @@ function Tn(e, t) {
731
731
  const s = e.currentTarget;
732
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
733
  if (u == "-") {
734
- const L = document.createElement("div");
735
- L.classList.add("separator"), i.appendChild(L);
734
+ const x = document.createElement("div");
735
+ x.classList.add("separator"), i.appendChild(x);
736
736
  return;
737
737
  }
738
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", () => xe(m, u.handler));
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", () => Le(m, u.handler));
740
740
  });
741
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
742
  i.style.left = p + "px", i.style.top = h + "px", setTimeout(() => {
@@ -745,13 +745,13 @@ function Tn(e, t) {
745
745
  function T() {
746
746
  t.targetClass && s.classList.remove(t.targetClass), s.classList.remove("context-menu-active"), s.style.userSelect = "", n.remove();
747
747
  }
748
- function xe(u, m) {
748
+ function Le(u, m) {
749
749
  if (u.classList.contains("pending-confirm"))
750
750
  return m();
751
- const L = u.innerHTML;
751
+ const x = u.innerHTML;
752
752
  u.classList.add("pending-confirm"), u.innerText = "Confirm";
753
753
  const G = () => {
754
- u.classList.remove("pending-confirm"), u.innerHTML = L, u.removeEventListener("mouseleave", G);
754
+ u.classList.remove("pending-confirm"), u.innerHTML = x, u.removeEventListener("mouseleave", G);
755
755
  };
756
756
  u.addEventListener("mouseleave", G), e.stopPropagation();
757
757
  }
@@ -759,13 +759,13 @@ function Tn(e, t) {
759
759
  const It = (e) => new Promise((t) => setTimeout(t, e)), On = (e) => It(e * 1e3), S = Symbol("MaskState");
760
760
  function bn(e, t) {
761
761
  const n = e.$.vnode.el, i = n.closest(".vf-modal");
762
- return Dt(i ?? n, t);
762
+ return Ht(i ?? n, t);
763
763
  }
764
764
  function wn(e) {
765
765
  const t = e.$.vnode.el, n = t.closest(".vf-modal");
766
766
  return Oe(n ?? t);
767
767
  }
768
- function Dt(e, t) {
768
+ function Ht(e, t) {
769
769
  if (!e[S]) {
770
770
  const n = document.createElement("div");
771
771
  n.classList.add("vf-mask"), e.appendChild(n), e[S] = { maskEl: n };
@@ -779,18 +779,18 @@ const j = Symbol("FormMaskState");
779
779
  function Sn(e, t, n) {
780
780
  const i = e instanceof Element ? e : be(e);
781
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;
782
+ const s = t instanceof Element ? t : i.querySelectorAll(t ?? "button:not([disabled])")[0], o = s.tagName === "INPUT" ? s.value : s.innerHTML;
783
783
  s.setAttribute("disabled", "disabled"), s.innerText = n ?? "Please wait...";
784
784
  const r = [...i.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
785
785
  return r.forEach((c) => c.setAttribute("disabled", "disabled")), i[j] = {
786
786
  disabledElements: r,
787
787
  waitButton: s,
788
- buttonText: o
789
- }, () => Ht(i);
788
+ buttonHtml: o
789
+ }, () => Dt(i);
790
790
  }
791
- function Ht(e) {
791
+ function Dt(e) {
792
792
  const t = e instanceof Element ? e : be(e), n = t[j];
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[j]);
793
+ n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((i) => i.removeAttribute("disabled")), n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled"), delete t[j]);
794
794
  }
795
795
  function be(e) {
796
796
  const t = e.$.vnode.el;
@@ -811,7 +811,7 @@ function Mn(e, t) {
811
811
  function At(e) {
812
812
  return e instanceof Error && "status" in e && "body" in e;
813
813
  }
814
- function xn({ apiClient: e, onRequest: t, onError: n, CancelablePromise: i }) {
814
+ function Ln({ apiClient: e, onRequest: t, onError: n, CancelablePromise: i }) {
815
815
  const s = e.request.request.bind(e.request);
816
816
  e.request.request = (o) => (t && (o = t(o)), new i((l, r, c) => {
817
817
  const p = s(o);
@@ -1077,7 +1077,7 @@ class Jt {
1077
1077
  function en(e) {
1078
1078
  e.directive("autofocus", _t), e.directive("confirm-button", Nt), e.directive("date-input", Rt), e.directive("datetime", Pt), e.directive("disabled", qt), e.directive("duration", zt), e.directive("infinite-scroll", Zt), e.directive("readonly", Gt), e.directive("tooltip", Qt);
1079
1079
  }
1080
- function Ln(e) {
1080
+ function xn(e) {
1081
1081
  en(e);
1082
1082
  }
1083
1083
  export {
@@ -1093,17 +1093,17 @@ export {
1093
1093
  yn as createFilters,
1094
1094
  ye as createModalInjection,
1095
1095
  lt as desnakeCase,
1096
- Hn as escapeHtml,
1096
+ Dn as escapeHtml,
1097
1097
  Qe as formatError,
1098
1098
  $t as formatNumber,
1099
1099
  rt as formatPhone,
1100
1100
  at as formatUSCurrency,
1101
1101
  mn as handleError,
1102
1102
  pn as handleErrorAndAlert,
1103
- xn as installApiClientInterceptors,
1104
- Ln as installVf,
1103
+ Ln as installApiClientInterceptors,
1104
+ xn as installVf,
1105
1105
  bn as maskComponent,
1106
- Dt as maskEl,
1106
+ Ht as maskEl,
1107
1107
  Sn as maskForm,
1108
1108
  vn as nl2br,
1109
1109
  Mn as nullifyEmptyInputs,
@@ -1123,7 +1123,7 @@ export {
1123
1123
  X as toError,
1124
1124
  wn as unmaskComponent,
1125
1125
  Oe as unmaskEl,
1126
- Ht as unmaskForm,
1126
+ Dt as unmaskForm,
1127
1127
  Bt as useInfiniteScroll,
1128
1128
  Cn as useResizeWatcher
1129
1129
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.2.0",
4
+ "version": "4.2.1",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "bin": {
@@ -20,8 +20,7 @@
20
20
  <script lang="ts" setup>
21
21
  import { computed } from 'vue';
22
22
 
23
- import { formatError } from '@/helpers/error';
24
-
23
+ import { formatError } from '../helpers/error';
25
24
  import Modal from './modal.vue';
26
25
 
27
26
  const props = defineProps<{
@@ -1,7 +1,7 @@
1
1
  import { format } from 'date-fns';
2
2
  import type { DirectiveBinding, ObjectDirective } from 'vue';
3
3
 
4
- import { VfOptions } from '@/config';
4
+ import { VfOptions } from '../config';
5
5
 
6
6
  export const vDatetime: ObjectDirective<HTMLElement, string> = {
7
7
  beforeMount: applyDateTime,
@@ -1,5 +1,4 @@
1
- import { showAlert } from '@/components/alert-helpers';
2
-
1
+ import { showAlert } from '../components/alert-helpers';
3
2
  import { VfOptions } from '../config';
4
3
 
5
4
  export class UserError extends Error {
@@ -1,4 +1,4 @@
1
- import type { AnyComponentPublicInstance } from '@/components';
1
+ import type { AnyComponentPublicInstance } from '../components/modal-container';
2
2
 
3
3
  /*///////////////////////////////////////////////
4
4
  Component Overlay Masking
@@ -51,7 +51,7 @@ interface IFormMaskState {
51
51
  [FormMaskState]?: {
52
52
  disabledElements: HTMLElement[];
53
53
  waitButton: HTMLElement;
54
- buttonText: string;
54
+ buttonHtml: string;
55
55
  };
56
56
  }
57
57
  type FormMaskElement = Element & IFormMaskState;
@@ -63,7 +63,7 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
63
63
  const buttonEl = (
64
64
  buttonSelector instanceof Element ? buttonSelector : form.querySelectorAll(buttonSelector ?? 'button:not([disabled])')[0]
65
65
  ) as HTMLElement;
66
- const originalButtonText = buttonEl.tagName === 'INPUT' ? (buttonEl as HTMLInputElement).value : buttonEl.innerText;
66
+ const originalButtonHtml = buttonEl.tagName === 'INPUT' ? (buttonEl as HTMLInputElement).value : buttonEl.innerHTML;
67
67
  buttonEl.setAttribute('disabled', 'disabled');
68
68
  buttonEl.innerText = buttonText ?? 'Please wait...';
69
69
 
@@ -74,7 +74,7 @@ export function maskForm(formOrCmp: Element | AnyComponentPublicInstance, button
74
74
  (form as FormMaskElement)[FormMaskState] = {
75
75
  disabledElements: inputs,
76
76
  waitButton: buttonEl,
77
- buttonText: originalButtonText
77
+ buttonHtml: originalButtonHtml
78
78
  };
79
79
 
80
80
  return () => unmaskForm(form);
@@ -89,7 +89,7 @@ export function unmaskForm(formOrCmp: Element | AnyComponentPublicInstance) {
89
89
  form.classList.remove('vf-masked');
90
90
 
91
91
  state.disabledElements.forEach(el => el.removeAttribute('disabled'));
92
- state.waitButton.innerText = state.buttonText;
92
+ state.waitButton.innerHTML = state.buttonHtml;
93
93
  state.waitButton.removeAttribute('disabled');
94
94
 
95
95
  delete (form as FormMaskElement)[FormMaskState];