lkt-table 1.3.3 → 1.3.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.
package/dist/build.js CHANGED
@@ -1,4 +1,4 @@
1
- import { reactive as N, defineComponent as Y, ref as g, watch as W, computed as c, resolveComponent as H, unref as C, openBlock as n, createBlock as B, withCtx as P, createTextVNode as ae, toDisplayString as Q, createElementBlock as s, mergeProps as gt, Fragment as D, withModifiers as ze, resolveDynamicComponent as X, createCommentVNode as p, normalizeClass as O, createElementVNode as R, createVNode as te, renderList as A, renderSlot as F, withDirectives as se, vShow as de, useSlots as Ct, onMounted as St, nextTick as Pe, createSlots as Ke, normalizeProps as ie } from "vue";
1
+ import { reactive as U, defineComponent as Y, ref as g, watch as N, computed as c, resolveComponent as H, unref as C, openBlock as n, createBlock as B, withCtx as P, createTextVNode as ae, toDisplayString as Q, createElementBlock as s, mergeProps as gt, Fragment as D, withModifiers as ze, resolveDynamicComponent as X, createCommentVNode as p, normalizeClass as O, createElementVNode as R, createVNode as te, renderList as A, renderSlot as F, withDirectives as se, vShow as de, useSlots as Ct, onMounted as St, nextTick as Pe, createSlots as Ke, normalizeProps as ie } from "vue";
2
2
  import { Field as He } from "lkt-field";
3
3
  import { __ as ce } from "lkt-i18n";
4
4
  import { replaceAll as Ge, generateRandomString as Bt } from "lkt-string-tools";
@@ -22,7 +22,7 @@ class M {
22
22
  }
23
23
  }
24
24
  var E = /* @__PURE__ */ ((t) => (t.Text = "text", t.Number = "number", t.Check = "check", t.Switch = "switch", t.Select = "select", t.Email = "email", t.Tel = "tel", t.File = "file", t.Link = "link", t.Action = "action", t.Integer = "int", t.Float = "float", t))(E || {});
25
- const Sl = (t) => N(new M(t)), Bl = (t, r, i, a = !0) => N(new M({ key: t, label: r, sortable: a, type: E.Link, link: i })), wl = (t, r, i, a = !0) => N(new M({ key: t, label: r, sortable: a, type: E.Action, action: i })), Dl = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Text, sortable: i })), Vl = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Number, sortable: i })), El = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Number, sortable: i })), Il = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Email, sortable: i })), Tl = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Tel, sortable: i })), $l = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Check, sortable: i })), Rl = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.Switch, sortable: i })), Ll = (t, r, i, a = !0) => N(new M({ key: t, label: r, type: E.Select, sortable: a })), Ml = (t, r, i = !0) => N(new M({ key: t, label: r, type: E.File, sortable: i })), Fl = (t, r, i = !0) => N(new M({ key: t, label: r, sortable: i, hidden: !0 })), je = (t, r, i, a) => {
25
+ const Sl = (t) => U(new M(t)), Bl = (t, r, i, a = !0) => U(new M({ key: t, label: r, sortable: a, type: E.Link, link: i })), wl = (t, r, i, a = !0) => U(new M({ key: t, label: r, sortable: a, type: E.Action, action: i })), Dl = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Text, sortable: i })), Vl = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Number, sortable: i })), El = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Number, sortable: i })), Il = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Email, sortable: i })), Tl = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Tel, sortable: i })), $l = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Check, sortable: i })), Rl = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.Switch, sortable: i })), Ll = (t, r, i, a = !0) => U(new M({ key: t, label: r, type: E.Select, sortable: a })), Ml = (t, r, i = !0) => U(new M({ key: t, label: r, type: E.File, sortable: i })), Fl = (t, r, i = !0) => U(new M({ key: t, label: r, sortable: i, hidden: !0 })), je = (t, r, i, a) => {
26
26
  if (!i) return 0;
27
27
  let u = t[i.key], l = r[i.key];
28
28
  if (a === "asc") {
@@ -79,10 +79,10 @@ const Sl = (t) => N(new M(t)), Bl = (t, r, i, a = !0) => N(new M({ key: t, label
79
79
  emits: ["update:modelValue"],
80
80
  setup(t, { emit: r }) {
81
81
  const i = r, a = t, u = g(a.modelValue), l = g(u.value[a.column.key]), k = g(null);
82
- W(l, (f) => {
82
+ N(l, (f) => {
83
83
  const o = JSON.parse(JSON.stringify(u.value));
84
84
  o[a.column.key] = f, i("update:modelValue", o);
85
- }), W(() => a.modelValue, (f) => {
85
+ }), N(() => a.modelValue, (f) => {
86
86
  u.value = f, l.value = u.value[a.column.key];
87
87
  });
88
88
  const V = c(() => ({ ...a.column.slotData, item: u.value })), h = c(() => {
@@ -280,7 +280,7 @@ const Rt = /* @__PURE__ */ Y({
280
280
  i("item-drop", a.i);
281
281
  }, f = () => {
282
282
  };
283
- return W(() => a.modelValue, (o) => u.value = o), W(u, (o) => {
283
+ return N(() => a.modelValue, (o) => u.value = o), N(u, (o) => {
284
284
  i("update:modelValue", o, a.i);
285
285
  }, { deep: !0 }), (o, v) => {
286
286
  const b = H("lkt-button");
@@ -398,7 +398,7 @@ const Rt = /* @__PURE__ */ Y({
398
398
  emits: ["update:modelValue", "click"],
399
399
  setup(t, { emit: r }) {
400
400
  const i = r, a = t, u = g(a.modelValue), l = (k) => i("click", k);
401
- return W(() => a.modelValue, (k) => u.value = k), W(u, () => i("update:modelValue", u.value)), (k, V) => se((n(), s("tr", Ht, [
401
+ return N(() => a.modelValue, (k) => u.value = k), N(u, () => i("update:modelValue", u.value)), (k, V) => se((n(), s("tr", Ht, [
402
402
  R("td", { colspan: k.hiddenColumnsColSpan }, [
403
403
  R("table", null, [
404
404
  R("tr", null, [
@@ -580,9 +580,22 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
580
580
  requiredItemsForBottomCreate: { default: 0 },
581
581
  slotItemVar: { default: "item" }
582
582
  },
583
- emits: ["update:modelValue", "update:perms", "sort", "click", "save", "error", "before-save", "read-response", "click-create"],
583
+ emits: [
584
+ "update:modelValue",
585
+ "update:perms",
586
+ "sort",
587
+ "click",
588
+ "save",
589
+ "error",
590
+ "before-save",
591
+ "read-response",
592
+ "click-create",
593
+ "page"
594
+ ],
584
595
  setup(t, { expose: r, emit: i }) {
585
- const a = i, u = Ct(), l = t, k = {}, V = g(typeof l.sorter == "function" ? l.sorter : je), h = g(Tt(l.columns)), I = g("asc"), d = g(l.modelValue), q = g(k), oe = g(null), K = g(l.columns), f = g(l.page), o = g(!1), v = g(!1), b = g(l.perms), y = g(null), Z = g({}), ee = g(new wt({ items: d.value }, l.dataStateConfig)), L = g(l.editMode), ne = g(0), fe = g(l.type);
596
+ const a = i, u = Ct(), l = t, k = {}, V = g(typeof l.sorter == "function" ? l.sorter : je), h = g(Tt(l.columns)), I = g("asc"), d = g(l.modelValue), q = g(k), oe = g(null), K = g(l.columns), f = g(l.page), o = g(!1), v = g(!1), b = g(l.perms), y = g(null), Z = g({}), ee = g(new wt({ items: d.value }, l.dataStateConfig)), L = g(l.editMode), ne = g(0);
597
+ N(f, (e) => a("page", e));
598
+ const fe = g(l.type);
586
599
  l.itemMode && fe.value === J.Table && (fe.value = J.Item);
587
600
  const Oe = (e) => {
588
601
  Array.isArray(e) && (d.value = e), o.value = !1, v.value = !0, ee.value.store({ items: d.value }).turnStoredIntoOriginal();
@@ -597,12 +610,12 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
597
610
  if (!l.hideEmptyColumns) return [];
598
611
  let e = [];
599
612
  return K.value.forEach((m) => {
600
- let w = m.key, U = !1;
613
+ let w = m.key, W = !1;
601
614
  d.value.forEach((z) => {
602
615
  if (typeof z.checkEmpty == "function")
603
616
  return z.checkEmpty(z);
604
- z[w] && (U = !0);
605
- }), U || e.push(w);
617
+ z[w] && (W = !0);
618
+ }), W || e.push(w);
606
619
  }), e;
607
620
  }), pe = c(() => K.value.filter((e) => !e.hidden)), Se = c(() => K.value.filter((e) => e.hidden)), xe = c(() => {
608
621
  let e = pe.value.length + 1;
@@ -654,8 +667,8 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
654
667
  ee.value.turnStoredIntoOriginal(), a("save", m);
655
668
  }, Ue = (e, m, w) => {
656
669
  if (w >= e.length) {
657
- let U = w - e.length + 1;
658
- for (; U--; ) e.push(void 0);
670
+ let W = w - e.length + 1;
671
+ for (; W--; ) e.push(void 0);
659
672
  }
660
673
  return e.splice(w, 0, e.splice(m, 1)[0]), e;
661
674
  }, vt = (e) => {
@@ -671,25 +684,25 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
671
684
  handle: ".handle",
672
685
  animation: 150,
673
686
  onEnd: function(m) {
674
- let w = m.oldIndex, U = m.newIndex;
675
- d.value.splice(U, 0, d.value.splice(w, 1)[0]), ne.value = ge();
687
+ let w = m.oldIndex, W = m.newIndex;
688
+ d.value.splice(W, 0, d.value.splice(w, 1)[0]), ne.value = ge();
676
689
  },
677
690
  onMove: function(m, w) {
678
691
  return ct(m);
679
692
  }
680
693
  });
681
694
  }, We = (e, m, w = !1) => {
682
- let U = [ne.value, me, "row", m];
683
- return w && U.push("hidden"), et.value.forEach((z) => {
695
+ let W = [ne.value, me, "row", m];
696
+ return w && W.push("hidden"), et.value.forEach((z) => {
684
697
  let G = String(e[z.key]).toLowerCase();
685
- G.length > 50 && (G = G.substring(0, 50)), G = Ge(G, " ", "-"), U.push(G);
686
- }), U.join("-");
698
+ G.length > 50 && (G = G.substring(0, 50)), G = Ge(G, " ", "-"), W.push(G);
699
+ }), W.join("-");
687
700
  }, Ae = c(() => typeof l.createEnabledValidator == "function" ? l.createEnabledValidator({ items: d.value }) : !0), ye = c(() => ve.value ? l.canCreateWithoutEdition || l.canCreate && L.value : !1), be = (e) => typeof l.itemDisplayChecker == "function" ? l.itemDisplayChecker(e) : !0;
688
701
  St(() => {
689
702
  l.initialSorting && Re($t(l.columns, h.value)), ee.value.store({ items: d.value }).turnStoredIntoOriginal(), l.sortable && Pe(() => {
690
703
  yt();
691
704
  });
692
- }), W(() => l.perms, (e) => b.value = e), W(b, (e) => a("update:perms", e)), W(() => l.editMode, (e) => L.value = e), W(() => l.columns, (e) => K.value = e), W(() => l.modelValue, (e) => d.value = e), W(d, (e) => {
705
+ }), N(() => l.perms, (e) => b.value = e), N(b, (e) => a("update:perms", e)), N(() => l.editMode, (e) => L.value = e), N(() => l.columns, (e) => K.value = e), N(() => l.modelValue, (e) => d.value = e), N(d, (e) => {
693
706
  ee.value.increment({ items: e }), a("update:modelValue", e);
694
707
  }, { deep: !0 }), r({
695
708
  getItemByEvent: dt,
@@ -697,7 +710,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
697
710
  });
698
711
  const bt = c(() => typeof $.defaultEmptySlot < "u"), ht = c(() => $.defaultEmptySlot);
699
712
  return (e, m) => {
700
- const w = H("lkt-button"), U = H("lkt-field"), z = H("lkt-loader"), G = H("lkt-paginator");
713
+ const w = H("lkt-button"), W = H("lkt-field"), z = H("lkt-loader"), G = H("lkt-paginator");
701
714
  return n(), s("section", {
702
715
  class: "lkt-table-page",
703
716
  id: "lkt-table-page-" + C(me)
@@ -756,7 +769,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
756
769
  onClick: Ne
757
770
  }, null, 8, ["disabled", "text", "icon", "to"])) : p("", !0),
758
771
  R("div", _t, [
759
- se(te(U, {
772
+ se(te(W, {
760
773
  type: "switch",
761
774
  modelValue: L.value,
762
775
  "onUpdate:modelValue": m[0] || (m[0] = (S) => L.value = S),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-table",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -14,9 +14,20 @@ import TableHeader from "../components/TableHeader.vue";
14
14
  import {__} from "lkt-i18n";
15
15
  import {time} from "lkt-date-tools";
16
16
  import {Settings} from "../settings/Settings";
17
- import {TypeOfTable} from "@/enums/TypeOfTable";
18
-
19
- const emit = defineEmits(['update:modelValue', 'update:perms', 'sort', 'click', 'save', 'error', 'before-save', 'read-response', 'click-create']);
17
+ import {TypeOfTable} from "../enums/TypeOfTable";
18
+
19
+ const emit = defineEmits([
20
+ 'update:modelValue',
21
+ 'update:perms',
22
+ 'sort',
23
+ 'click',
24
+ 'save',
25
+ 'error',
26
+ 'before-save',
27
+ 'read-response',
28
+ 'click-create',
29
+ 'page',
30
+ ]);
20
31
 
21
32
  const slots = useSlots();
22
33
 
@@ -163,6 +174,8 @@ const Page = ref(props.page),
163
174
  updateTimeStamp = ref(0)
164
175
  ;
165
176
 
177
+ watch(Page, (v) => emit('page', v));
178
+
166
179
  const Type = ref(props.type);
167
180
  if (props.itemMode && Type.value === TypeOfTable.Table) {
168
181
  Type.value = TypeOfTable.Item;