@signal24/vue-foundation 4.19.3 → 4.19.4

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.
@@ -27,6 +27,7 @@ declare const _default: <T, V = T>(__VLS_props: NonNullable<Awaited<typeof __VLS
27
27
  debug?: boolean;
28
28
  required?: boolean;
29
29
  showCreateTextOnNewItem?: boolean;
30
+ autoNext?: boolean;
30
31
  }> & import("vue").PublicProps;
31
32
  expose(exposed: import("vue").ShallowUnwrapRef<{
32
33
  addRemoteOption: (option: T) => void;
@@ -1,7 +1,7 @@
1
1
  var Tt = Object.defineProperty;
2
2
  var St = (e, t, n) => t in e ? Tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var O = (e, t, n) => St(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { defineComponent as N, ref as T, computed as M, watch as A, onMounted as V, openBlock as E, createElementBlock as b, createElementVNode as F, toDisplayString as U, withDirectives as Q, createCommentVNode as D, Fragment as J, renderList as he, vModelSelect as Ct, getCurrentInstance as pe, withModifiers as ye, normalizeStyle as xt, normalizeClass as $, renderSlot as G, reactive as Lt, h as ee, Teleport as Mt, markRaw as It, onBeforeUnmount as ge, resolveDirective as Ht, createBlock as qe, createSlots as Ot, withCtx as ue, createTextVNode as ce, vModelText as At, onActivated as ze, onDeactivated as Ye } from "vue";
4
+ import { defineComponent as N, ref as T, computed as M, watch as A, onMounted as V, openBlock as E, createElementBlock as b, createElementVNode as F, toDisplayString as U, withDirectives as Q, createCommentVNode as D, Fragment as J, renderList as he, vModelSelect as xt, getCurrentInstance as pe, withModifiers as ye, normalizeStyle as Ct, normalizeClass as $, renderSlot as G, reactive as Lt, h as ee, Teleport as Mt, markRaw as It, onBeforeUnmount as ge, resolveDirective as Ht, createBlock as qe, createSlots as Ot, withCtx as ue, createTextVNode as ce, vModelText as At, onActivated as ze, onDeactivated as Ye } from "vue";
5
5
  import { compact as Ke, debounce as Ft, isEqual as Xe, startCase as Dt, upperFirst as Bt, cloneDeep as $t, remove as Vt, last as _t } from "lodash";
6
6
  import { escapeHtml as Nt } from "@vue/shared";
7
7
  import { escapeHtml as Uo } from "@vue/shared";
@@ -49,7 +49,7 @@ const Ut = {
49
49
  }, U(k), 9, Pt);
50
50
  }), 128))
51
51
  ], 512)), [
52
- [Ct, u.value]
52
+ [xt, u.value]
53
53
  ]) : (E(), b("select", Ut, [
54
54
  F("option", null, U(n.loadingText || "Loading..."), 1)
55
55
  ]));
@@ -76,14 +76,14 @@ const Ut = {
76
76
  if (f.y === "center")
77
77
  c = w.top + w.height / 2 - m.height / 2, r.push("anchored-center-y");
78
78
  else {
79
- const x = (w.bottom + m.height < window.innerHeight || f.y === "below") && f.y !== "above";
80
- c = x ? w.bottom : w.top - m.height, r.push(x ? "anchored-top" : "anchored-bottom");
79
+ const C = (w.bottom + m.height < window.innerHeight || f.y === "below") && f.y !== "above";
80
+ c = C ? w.bottom : w.top - m.height, r.push(C ? "anchored-top" : "anchored-bottom");
81
81
  }
82
82
  if (f.x === "center")
83
83
  S = w.left + w.width / 2 - m.width / 2, r.push("anchored-center-x");
84
84
  else {
85
- const x = (w.left + m.width < window.innerWidth || f.x === "left") && f.x !== "right";
86
- S = x ? w.left : w.right - m.width, r.push(x ? "anchored-left" : "anchored-right");
85
+ const C = (w.left + m.width < window.innerWidth || f.x === "left") && f.x !== "right";
86
+ S = C ? w.left : w.right - m.width, r.push(C ? "anchored-left" : "anchored-right");
87
87
  }
88
88
  return {
89
89
  styles: {
@@ -104,7 +104,7 @@ const Ut = {
104
104
  }, 10);
105
105
  }), (g, k) => (E(), b("div", {
106
106
  class: $(["vf-overlay-anchor", i.value]),
107
- style: xt(o.value),
107
+ style: Ct(o.value),
108
108
  onClick: ye(d, ["stop"])
109
109
  }, [
110
110
  G(g.$slots, "default")
@@ -456,7 +456,7 @@ function dn(e, t, n) {
456
456
  const o = e.random || (e.rng || un)();
457
457
  return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, an(o);
458
458
  }
459
- function Co(e) {
459
+ function xo(e) {
460
460
  return e.replace(/\n/g, "<br>");
461
461
  }
462
462
  function fn(e) {
@@ -469,7 +469,7 @@ function vn(e) {
469
469
  function mn(e, t = 1) {
470
470
  return "$" + (Number(e) / t).toFixed(3).replace(/0$/, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
471
471
  }
472
- function xo() {
472
+ function Co() {
473
473
  return dn();
474
474
  }
475
475
  const hn = ["disabled", "placeholder", "required"], pn = {
@@ -504,7 +504,8 @@ const hn = ["disabled", "placeholder", "required"], pn = {
504
504
  optionsListId: {},
505
505
  debug: { type: Boolean },
506
506
  required: { type: Boolean },
507
- showCreateTextOnNewItem: { type: Boolean }
507
+ showCreateTextOnNewItem: { type: Boolean },
508
+ autoNext: { type: Boolean }
508
509
  },
509
510
  emits: ["optionsLoaded", "update:modelValue"],
510
511
  setup(e, { expose: t, emit: n }) {
@@ -512,12 +513,12 @@ const hn = ["disabled", "placeholder", "required"], pn = {
512
513
  t({
513
514
  addRemoteOption: kt
514
515
  });
515
- const a = T(), d = T(), g = T(), k = T(!1), f = T(!1), w = T([]), m = T(!1), r = T(""), c = T(null), S = T(null), I = T(!1), x = T(null), Se = T(!1), at = M(() => l.showCreateTextOnNewItem ?? !0), rt = M(() => l.prependOptions ?? []), ut = M(() => l.appendOptions ?? []), Ce = M(() => !!l.disabled), ct = M(() => !f.value && l.preload ? "Loading..." : l.nullTitle ? l.nullTitle : l.placeholder || ""), dt = M(() => l.noResultsText || "No options match your search."), W = M(() => l.valueExtractor ? l.valueExtractor : l.valueField ? (s) => s[l.valueField] : null), j = M(() => l.keyExtractor ? l.keyExtractor : l.keyField ? (s) => String(s[l.keyField]) : W.value ? (s) => String(W.value(s)) : null), se = M(() => l.formatter ? l.formatter : l.labelField ? (s) => String(s[l.labelField]) : (s) => String(s)), xe = M(() => [...rt.value, ...w.value, ...ut.value]), ie = M(() => xe.value.map((s, v) => {
516
+ const a = T(), d = T(), g = T(), k = T(!1), f = T(!1), w = T([]), m = T(!1), r = T(""), c = T(null), S = T(null), I = T(!1), C = T(null), Se = T(!1), at = M(() => l.showCreateTextOnNewItem ?? !0), rt = M(() => l.prependOptions ?? []), ut = M(() => l.appendOptions ?? []), xe = M(() => !!l.disabled), ct = M(() => !f.value && l.preload ? "Loading..." : l.nullTitle ? l.nullTitle : l.placeholder || ""), dt = M(() => l.noResultsText || "No options match your search."), W = M(() => l.valueExtractor ? l.valueExtractor : l.valueField ? (s) => s[l.valueField] : null), j = M(() => l.keyExtractor ? l.keyExtractor : l.keyField ? (s) => String(s[l.keyField]) : W.value ? (s) => String(W.value(s)) : null), se = M(() => l.formatter ? l.formatter : l.labelField ? (s) => String(s[l.labelField]) : (s) => String(s)), Ce = M(() => [...rt.value, ...w.value, ...ut.value]), ie = M(() => Ce.value.map((s, v) => {
516
517
  var Ae, Fe;
517
- const h = se.value(s), p = (Ae = l.subtitleFormatter) == null ? void 0 : Ae.call(l, s), y = h ? h.trim().toLowerCase() : "", C = p ? p.trim().toLowerCase() : "", Z = [];
518
+ const h = se.value(s), p = (Ae = l.subtitleFormatter) == null ? void 0 : Ae.call(l, s), y = h ? h.trim().toLowerCase() : "", x = p ? p.trim().toLowerCase() : "", Z = [];
518
519
  return l.searchFields ? l.searchFields.forEach((De) => {
519
520
  s[De] && Z.push(String(s[De]).toLowerCase());
520
- }) : (Z.push(y), C && Z.push(C)), {
521
+ }) : (Z.push(y), x && Z.push(x)), {
521
522
  key: ((Fe = j.value) == null ? void 0 : Fe.call(j, s)) ?? String(v),
522
523
  title: h,
523
524
  subtitle: p,
@@ -532,13 +533,13 @@ const hn = ["disabled", "placeholder", "required"], pn = {
532
533
  s = s.filter((y) => y.searchContent.includes(v));
533
534
  const h = Nt(r.value).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), p = new RegExp(`(${h})`, "ig");
534
535
  s = s.map((y) => {
535
- var C;
536
+ var x;
536
537
  return {
537
538
  ...y,
538
539
  title: y.title.replace(p, "<mark>$1</mark>"),
539
- subtitle: (C = y.subtitle) == null ? void 0 : C.replace(p, "<mark>$1</mark>")
540
+ subtitle: (x = y.subtitle) == null ? void 0 : x.replace(p, "<mark>$1</mark>")
540
541
  };
541
- }), Se.value && (s.find((C) => C.searchContent === v) !== void 0 || s.push({
542
+ }), Se.value && (s.find((x) => x.searchContent === v) !== void 0 || s.push({
542
543
  key: i,
543
544
  title: at.value ? "Create <strong>" + r.value.trim() + "</strong>..." : r.value.trim()
544
545
  }));
@@ -562,7 +563,7 @@ const hn = ["disabled", "placeholder", "required"], pn = {
562
563
  I.value ? setTimeout(wt, 0) : (m.value = !1, r.value = S.value || "", g.value && (g.value.style.visibility = "hidden"));
563
564
  }), A(H, () => {
564
565
  var s;
565
- l.modelValue && !c.value && re(), (x.value || m.value) && !H.value.find((v) => v.key == x.value) && (x.value = ((s = H.value[0]) == null ? void 0 : s.key) ?? o);
566
+ l.modelValue && !c.value && re(), (C.value || m.value) && !H.value.find((v) => v.key == C.value) && (C.value = ((s = H.value[0]) == null ? void 0 : s.key) ?? o);
566
567
  }), V(async () => {
567
568
  Se.value = l.onCreateItem !== void 0, l.options ? (w.value = [...l.options], f.value = !0) : l.preload && await Le(), re(), A(c, () => {
568
569
  c.value !== l.modelValue && u(
@@ -600,7 +601,7 @@ const hn = ["disabled", "placeholder", "required"], pn = {
600
601
  return s.preventDefault(), ae(s.key == "Home" ? -Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER);
601
602
  if (s.key == "Enter") {
602
603
  s.preventDefault();
603
- const v = H.value.find((h) => h.key == x.value);
604
+ const v = H.value.find((h) => h.key == C.value);
604
605
  if (v) return He(v);
605
606
  }
606
607
  if (s.key === "Delete" || s.key === "Backspace") {
@@ -617,7 +618,7 @@ const hn = ["disabled", "placeholder", "required"], pn = {
617
618
  }, 0);
618
619
  }
619
620
  function ht(s) {
620
- c.value ? x.value = pt(c.value) : l.nullTitle && (x.value = o);
621
+ c.value ? C.value = pt(c.value) : l.nullTitle && (C.value = o);
621
622
  }
622
623
  function pt(s) {
623
624
  var v;
@@ -627,7 +628,7 @@ const hn = ["disabled", "placeholder", "required"], pn = {
627
628
  const v = H.value.find((y) => y.ref === s);
628
629
  if (v)
629
630
  return v;
630
- const h = l.keyExtractor ? (y, C) => l.keyExtractor(y) === l.keyExtractor(C) : Xe, p = H.value.find((y) => h(y.ref, s));
631
+ const h = l.keyExtractor ? (y, x) => l.keyExtractor(y) === l.keyExtractor(x) : Xe, p = H.value.find((y) => h(y.ref, s));
631
632
  return p || null;
632
633
  }
633
634
  function gt() {
@@ -639,27 +640,27 @@ const hn = ["disabled", "placeholder", "required"], pn = {
639
640
  }
640
641
  function Et() {
641
642
  const s = a.value.getBoundingClientRect(), v = s.y + s.height + 2, h = s.x, p = g.value, y = window.getComputedStyle(a.value);
642
- for (let C in y)
643
- /^(font|text)/.test(C) && (p.style[C] = y[C]);
643
+ for (let x in y)
644
+ /^(font|text)/.test(x) && (p.style[x] = y[x]);
644
645
  if (p.style.top = v + "px", p.style.left = h + "px", p.style.minWidth = s.width + "px", !y.maxHeight || y.maxHeight == "none") {
645
- const C = window.innerHeight - v - 12;
646
- p.style.maxHeight = C + "px";
646
+ const x = window.innerHeight - v - 12;
647
+ p.style.maxHeight = x + "px";
647
648
  }
648
649
  p.style.visibility = "visible", document.body.appendChild(p), setTimeout(Ie, 0);
649
650
  }
650
651
  function Ie() {
651
- if (!f.value || !x.value) return;
652
- const s = H.value.findIndex((p) => p.key == x.value), v = g.value, h = v == null ? void 0 : v.querySelectorAll(".option")[s];
652
+ if (!f.value || !C.value) return;
653
+ const s = H.value.findIndex((p) => p.key == C.value), v = g.value, h = v == null ? void 0 : v.querySelectorAll(".option")[s];
653
654
  h && (v.scrollTop = h.offsetTop);
654
655
  }
655
656
  function bt(s) {
656
- x.value = s ? s.key : null;
657
+ C.value = s ? s.key : null;
657
658
  }
658
659
  function ae(s) {
659
- const v = H.value.findIndex((C) => C.key == x.value);
660
+ const v = H.value.findIndex((x) => x.key == C.value);
660
661
  let h = v + s;
661
662
  if (h < 0 ? h = 0 : h >= H.value.length && (h = H.value.length - 1), v == h) return;
662
- x.value = H.value[h].key;
663
+ C.value = H.value[h].key;
663
664
  const p = g.value, y = p == null ? void 0 : p.querySelectorAll(".option")[h];
664
665
  y && (y.offsetTop < p.scrollTop ? p.scrollTop = y.offsetTop : y.offsetTop + y.offsetHeight > p.scrollTop + p.clientHeight && (p.scrollTop = y.offsetTop + y.offsetHeight - p.clientHeight));
665
666
  }
@@ -671,39 +672,40 @@ const hn = ["disabled", "placeholder", "required"], pn = {
671
672
  const p = r.value.trim();
672
673
  r.value = "", c.value = null, S.value = null, (v = l.onCreateItem) == null || v.call(l, p);
673
674
  } else {
674
- const y = ie.value.find((C) => C.key == s.key).ref;
675
+ const y = ie.value.find((x) => x.key == s.key).ref;
675
676
  c.value = y, S.value = se.value(y), r.value = S.value || "";
676
677
  }
677
678
  (h = d.value) == null || h.blur(), Oe();
678
679
  }
679
680
  function re() {
680
- l.modelValue ? (c.value = W.value ? xe.value.find((s) => l.modelValue === W.value(s)) : l.modelValue, S.value = c.value ? se.value(c.value) : null, r.value = S.value || "") : (c.value = null, S.value = null, r.value = "");
681
+ l.modelValue ? (c.value = W.value ? Ce.value.find((s) => l.modelValue === W.value(s)) : l.modelValue, S.value = c.value ? se.value(c.value) : null, r.value = S.value || "") : (c.value = null, S.value = null, r.value = "");
681
682
  }
682
683
  function kt(s) {
683
684
  w.value.unshift(s);
684
685
  }
685
686
  function Oe() {
686
687
  var y;
688
+ if (!l.autoNext) return;
687
689
  let s = (y = a.value) == null ? void 0 : y.parentElement;
688
690
  for (; s && s.tagName !== "FORM" && s.tagName !== "BODY"; )
689
691
  s = s.parentElement;
690
692
  if (!s) return;
691
693
  const v = s.querySelectorAll('input, button, textarea, select, [tabindex]:not([tabindex="-1"])');
692
694
  if (!v) return;
693
- const h = Array.from(v).findIndex((C) => C === d.value), p = v[h + 1];
695
+ const h = Array.from(v).findIndex((x) => x === d.value), p = v[h + 1];
694
696
  p && setTimeout(() => p.focus(), 0);
695
697
  }
696
698
  return (s, v) => (E(), b("div", {
697
699
  ref_key: "el",
698
700
  ref: a,
699
- class: $(["vf-smart-select", { disabled: Ce.value, open: I.value }])
701
+ class: $(["vf-smart-select", { disabled: xe.value, open: I.value }])
700
702
  }, [
701
703
  Q(F("input", {
702
704
  ref_key: "searchField",
703
705
  ref: d,
704
706
  "onUpdate:modelValue": v[0] || (v[0] = (h) => r.value = h),
705
707
  type: "text",
706
- disabled: Ce.value,
708
+ disabled: xe.value,
707
709
  class: $({ nullable: !!s.nullTitle }),
708
710
  placeholder: ct.value,
709
711
  required: s.required,
@@ -724,7 +726,7 @@ const hn = ["disabled", "placeholder", "required"], pn = {
724
726
  (E(!0), b(J, null, he(H.value, (h) => (E(), b("div", {
725
727
  key: String(h.key),
726
728
  class: $(["option", {
727
- highlighted: x.value === h.key
729
+ highlighted: C.value === h.key
728
730
  }]),
729
731
  onMousemove: (p) => bt(h),
730
732
  onMousedown: (p) => He(h)
@@ -780,10 +782,10 @@ const hn = ["disabled", "placeholder", "required"], pn = {
780
782
  function Mo() {
781
783
  return T();
782
784
  }
783
- const Tn = { class: "content" }, Sn = { class: "message" }, Cn = {
785
+ const Tn = { class: "content" }, Sn = { class: "message" }, xn = {
784
786
  key: 0,
785
787
  class: "close"
786
- }, xn = {
788
+ }, Cn = {
787
789
  key: 0,
788
790
  class: "progress-bar"
789
791
  }, Ln = /* @__PURE__ */ N({
@@ -815,9 +817,9 @@ const Tn = { class: "content" }, Sn = { class: "message" }, Cn = {
815
817
  }, [
816
818
  F("div", Tn, [
817
819
  F("div", Sn, U(i.message), 1),
818
- i.disableClose ? D("", !0) : (E(), b("div", Cn, "x"))
820
+ i.disableClose ? D("", !0) : (E(), b("div", xn, "x"))
819
821
  ]),
820
- i.durationSecs !== null ? (E(), b("div", xn, [
822
+ i.durationSecs !== null ? (E(), b("div", Cn, [
821
823
  F("div", {
822
824
  ref_key: "progressInnerEl",
823
825
  ref: o,
@@ -1262,7 +1264,7 @@ export {
1262
1264
  To as maskComponent,
1263
1265
  Gt as maskEl,
1264
1266
  Qt as maskForm,
1265
- Co as nl2br,
1267
+ xo as nl2br,
1266
1268
  Bo as nullifyEmptyInputs,
1267
1269
  Ee as presentOverlay,
1268
1270
  te as removeOverlayInjection,
@@ -1281,6 +1283,6 @@ export {
1281
1283
  Qe as unmaskForm,
1282
1284
  Vo as useInfiniteScroll,
1283
1285
  _o as useResizeWatcher,
1284
- xo as uuid,
1286
+ Co as uuid,
1285
1287
  Mo as vfModalRef
1286
1288
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.19.3",
4
+ "version": "4.19.4",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "exports": {
@@ -82,6 +82,7 @@ const props = defineProps<{
82
82
  debug?: boolean;
83
83
  required?: boolean;
84
84
  showCreateTextOnNewItem?: boolean;
85
+ autoNext?: boolean;
85
86
  }>();
86
87
 
87
88
  const emit = defineEmits<{
@@ -523,6 +524,8 @@ function addRemoteOption(option: T) {
523
524
  }
524
525
 
525
526
  function focusNextInput() {
527
+ if (!props.autoNext) return;
528
+
526
529
  let parent = el.value?.parentElement;
527
530
  while (parent && parent.tagName !== 'FORM' && parent.tagName !== 'BODY') {
528
531
  parent = parent.parentElement;