lkt-table 1.3.4 → 1.3.5
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.d.ts +2 -2
- package/dist/build.js +68 -65
- package/package.json +1 -1
- package/src/components/CreateButton.vue +1 -1
- package/src/lib-components/LktTable.vue +26 -18
package/dist/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare class
|
|
1
|
+
declare class F {
|
|
2
2
|
constructor(r?: {});
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
@@ -946,4 +946,4 @@ declare function Wl(t: any): boolean;
|
|
|
946
946
|
declare function Pl(t: any): void;
|
|
947
947
|
declare function Ul(t: any): boolean;
|
|
948
948
|
import { Field as He } from "lkt-field";
|
|
949
|
-
export {
|
|
949
|
+
export { F as Column, wl as createActionColumn, $l as createCheckColumn, Sl as createColumn, Il as createEmailColumn, Ml as createFileColumn, El as createFloatColumn, Fl as createHiddenColumn, Vl as createIntegerColumn, Bl as createLinkColumn, Ll as createSelectColumn, Rl as createSwitchColumn, Tl as createTelColumn, Dl as createTextColumn, Nl as default, Al as setTableCreateButtonSlot, Wl as setTableDropButtonSlot, Pl as setTableEmptySlot, Ul as setTableNavButtonSlot };
|
package/dist/build.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { reactive as U, defineComponent as Y, ref as g, watch as
|
|
1
|
+
import { reactive as U, defineComponent as Y, ref as g, watch as M, computed as c, resolveComponent as H, unref as C, openBlock as n, createBlock as S, 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 N, 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";
|
|
5
5
|
import { DataState as wt } from "lkt-data-state";
|
|
6
6
|
import Dt from "sortablejs";
|
|
7
7
|
import { time as ge } from "lkt-date-tools";
|
|
8
|
-
class
|
|
8
|
+
class F {
|
|
9
9
|
constructor(r = {}) {
|
|
10
10
|
this.key = "", this.label = "", this.sortable = !0, this.hidden = !1, this.editable = !1, this.formatter = void 0, this.checkEmpty = void 0, this.colspan = void 0, this.preferSlot = !0, this.type = "", this.link = "", this.action = void 0, this.isForRowKey = !1, this.extractTitleFromColumn = "", this.slotData = {}, this.field = new He();
|
|
11
11
|
for (let i in r)
|
|
@@ -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) => U(new
|
|
25
|
+
const Sl = (t) => U(new F(t)), Bl = (t, r, i, a = !0) => U(new F({ key: t, label: r, sortable: a, type: E.Link, link: i })), wl = (t, r, i, a = !0) => U(new F({ key: t, label: r, sortable: a, type: E.Action, action: i })), Dl = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Text, sortable: i })), Vl = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Number, sortable: i })), El = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Number, sortable: i })), Il = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Email, sortable: i })), Tl = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Tel, sortable: i })), $l = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Check, sortable: i })), Rl = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.Switch, sortable: i })), Ll = (t, r, i, a = !0) => U(new F({ key: t, label: r, type: E.Select, sortable: a })), Ml = (t, r, i = !0) => U(new F({ key: t, label: r, type: E.File, sortable: i })), Fl = (t, r, i = !0) => U(new F({ 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") {
|
|
@@ -71,7 +71,7 @@ const Sl = (t) => U(new M(t)), Bl = (t, r, i, a = !0) => U(new M({ key: t, label
|
|
|
71
71
|
__name: "LktTableCell",
|
|
72
72
|
props: {
|
|
73
73
|
modelValue: { default: () => ({}) },
|
|
74
|
-
column: { default: () => new
|
|
74
|
+
column: { default: () => new F() },
|
|
75
75
|
columns: { default: () => [] },
|
|
76
76
|
i: { default: 0 },
|
|
77
77
|
editModeEnabled: { type: Boolean, default: !1 }
|
|
@@ -79,10 +79,10 @@ const Sl = (t) => U(new M(t)), Bl = (t, r, i, a = !0) => U(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
|
-
|
|
82
|
+
M(l, (f) => {
|
|
83
83
|
const o = JSON.parse(JSON.stringify(u.value));
|
|
84
84
|
o[a.column.key] = f, i("update:modelValue", o);
|
|
85
|
-
}),
|
|
85
|
+
}), M(() => 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(() => {
|
|
@@ -126,7 +126,7 @@ const Sl = (t) => U(new M(t)), Bl = (t, r, i, a = !0) => U(new M({ key: t, label
|
|
|
126
126
|
}), K = c(() => [E.Integer, E.Float].includes(a.column.type) ? E.Number : a.column.type);
|
|
127
127
|
return (f, o) => {
|
|
128
128
|
const v = H("lkt-anchor"), b = H("lkt-field");
|
|
129
|
-
return f.column.type === C(E).Link ? (n(),
|
|
129
|
+
return f.column.type === C(E).Link ? (n(), S(v, {
|
|
130
130
|
key: 0,
|
|
131
131
|
to: f.column.getHref(u.value)
|
|
132
132
|
}, {
|
|
@@ -138,7 +138,7 @@ const Sl = (t) => U(new M(t)), Bl = (t, r, i, a = !0) => U(new M({ key: t, label
|
|
|
138
138
|
key: 1,
|
|
139
139
|
href: "#",
|
|
140
140
|
onClick: o[0] || (o[0] = (y) => f.column.doAction(u.value))
|
|
141
|
-
}, Q(C(le)(f.column, u.value, f.i)), 1)) : f.column.type !== "" ? (n(),
|
|
141
|
+
}, Q(C(le)(f.column, u.value, f.i)), 1)) : f.column.type !== "" ? (n(), S(b, gt({ key: 2 }, f.column.field, {
|
|
142
142
|
icon: d.value,
|
|
143
143
|
download: q.value,
|
|
144
144
|
type: K.value,
|
|
@@ -175,7 +175,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
175
175
|
const i = r, a = c(() => $.dropButtonSlot !== ""), u = c(() => $.dropButtonSlot);
|
|
176
176
|
return (l, k) => {
|
|
177
177
|
const V = H("lkt-button");
|
|
178
|
-
return n(),
|
|
178
|
+
return n(), S(V, {
|
|
179
179
|
palette: "table-delete",
|
|
180
180
|
icon: a.value ? "" : l.icon,
|
|
181
181
|
text: a.value ? "" : l.text,
|
|
@@ -186,7 +186,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
186
186
|
onClick: k[0] || (k[0] = ze((h) => i("click"), ["prevent", "stop"]))
|
|
187
187
|
}, {
|
|
188
188
|
default: P(() => [
|
|
189
|
-
a.value ? (n(),
|
|
189
|
+
a.value ? (n(), S(X(u.value), { key: 0 })) : p("", !0)
|
|
190
190
|
]),
|
|
191
191
|
_: 1
|
|
192
192
|
}, 8, ["icon", "text", "resource", "resource-data", "confirm-modal", "disabled"]);
|
|
@@ -208,7 +208,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
208
208
|
const i = r, a = c(() => $.editButtonSlot !== ""), u = c(() => $.editButtonSlot);
|
|
209
209
|
return (l, k) => {
|
|
210
210
|
const V = H("lkt-button");
|
|
211
|
-
return n(),
|
|
211
|
+
return n(), S(V, {
|
|
212
212
|
palette: "table-delete",
|
|
213
213
|
icon: a.value ? "" : l.icon,
|
|
214
214
|
text: a.value ? "" : l.text,
|
|
@@ -221,7 +221,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
221
221
|
onClick: k[0] || (k[0] = ze((h) => i("click"), ["prevent", "stop"]))
|
|
222
222
|
}, {
|
|
223
223
|
default: P(() => [
|
|
224
|
-
a.value ? (n(),
|
|
224
|
+
a.value ? (n(), S(X(u.value), { key: 0 })) : p("", !0)
|
|
225
225
|
]),
|
|
226
226
|
_: 1
|
|
227
227
|
}, 8, ["icon", "text", "on-click-to", "is-anchor", "resource", "resource-data", "confirm-modal", "disabled"]);
|
|
@@ -280,7 +280,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
280
280
|
i("item-drop", a.i);
|
|
281
281
|
}, f = () => {
|
|
282
282
|
};
|
|
283
|
-
return
|
|
283
|
+
return M(() => a.modelValue, (o) => u.value = o), M(u, (o) => {
|
|
284
284
|
i("update:modelValue", o, a.i);
|
|
285
285
|
}, { deep: !0 }), (o, v) => {
|
|
286
286
|
const b = H("lkt-button");
|
|
@@ -301,7 +301,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
301
301
|
onClick: q
|
|
302
302
|
}, {
|
|
303
303
|
default: P(() => [
|
|
304
|
-
I.value ? (n(),
|
|
304
|
+
I.value ? (n(), S(X(d.value), {
|
|
305
305
|
key: 0,
|
|
306
306
|
direction: "up"
|
|
307
307
|
})) : (n(), s(D, { key: 1 }, [
|
|
@@ -317,7 +317,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
317
317
|
onClick: oe
|
|
318
318
|
}, {
|
|
319
319
|
default: P(() => [
|
|
320
|
-
I.value ? (n(),
|
|
320
|
+
I.value ? (n(), S(X(d.value), {
|
|
321
321
|
key: 0,
|
|
322
322
|
direction: "down"
|
|
323
323
|
})) : (n(), s(D, { key: 1 }, [
|
|
@@ -343,13 +343,13 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
343
343
|
title: C(le)(y, u.value, o.i, o.visibleColumns),
|
|
344
344
|
onClick: (Z) => k(Z, u.value)
|
|
345
345
|
}, [
|
|
346
|
-
o.$slots[y.key] && C(Et)(y, u.value) ?
|
|
346
|
+
o.$slots[y.key] && C(Et)(y, u.value) ? N(o.$slots, y.key, {
|
|
347
347
|
key: 0,
|
|
348
348
|
value: u.value[y.key],
|
|
349
349
|
item: u.value,
|
|
350
350
|
column: y,
|
|
351
351
|
i: o.i
|
|
352
|
-
}) : u.value ? (n(),
|
|
352
|
+
}) : u.value ? (n(), S(Je, {
|
|
353
353
|
key: 1,
|
|
354
354
|
modelValue: u.value,
|
|
355
355
|
"onUpdate:modelValue": v[1] || (v[1] = (Z) => u.value = Z),
|
|
@@ -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
|
|
401
|
+
return M(() => a.modelValue, (k) => u.value = k), M(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, [
|
|
@@ -414,13 +414,13 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
414
414
|
title: C(le)(h, u.value, I, k.hiddenColumns),
|
|
415
415
|
onClick: (d) => l(d, u.value)
|
|
416
416
|
}, [
|
|
417
|
-
k.$slots[h.key] ?
|
|
417
|
+
k.$slots[h.key] ? N(k.$slots, h.key, {
|
|
418
418
|
key: 0,
|
|
419
419
|
value: u.value[h.key],
|
|
420
420
|
item: u.value,
|
|
421
421
|
column: h,
|
|
422
422
|
i: I
|
|
423
|
-
}) : (n(),
|
|
423
|
+
}) : (n(), S(Je, {
|
|
424
424
|
key: 1,
|
|
425
425
|
column: h,
|
|
426
426
|
columns: k.hiddenColumns,
|
|
@@ -449,7 +449,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
449
449
|
const i = r, a = c(() => $.createButtonSlot !== ""), u = c(() => $.createButtonSlot);
|
|
450
450
|
return (l, k) => {
|
|
451
451
|
const V = H("lkt-button");
|
|
452
|
-
return n(),
|
|
452
|
+
return n(), S(V, {
|
|
453
453
|
palette: "table-create",
|
|
454
454
|
disabled: l.disabled,
|
|
455
455
|
icon: a.value ? "" : l.icon,
|
|
@@ -458,7 +458,7 @@ const Rt = /* @__PURE__ */ Y({
|
|
|
458
458
|
onClick: k[0] || (k[0] = (h) => i("click"))
|
|
459
459
|
}, {
|
|
460
460
|
default: P(() => [
|
|
461
|
-
a.value ? (n(),
|
|
461
|
+
a.value ? (n(), S(X(u.value), { key: 0 })) : p("", !0)
|
|
462
462
|
]),
|
|
463
463
|
_: 1
|
|
464
464
|
}, 8, ["disabled", "icon", "text", "on-click-to"]);
|
|
@@ -533,8 +533,9 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
533
533
|
initialSorting: { type: Boolean, default: !1 },
|
|
534
534
|
draggableItemKey: { default: "name" },
|
|
535
535
|
itemDisplayChecker: {},
|
|
536
|
+
loading: { type: Boolean, default: !1 },
|
|
536
537
|
page: { default: 1 },
|
|
537
|
-
perms: { default: [] },
|
|
538
|
+
perms: { default: () => [] },
|
|
538
539
|
resource: { default: "" },
|
|
539
540
|
noResultsText: { default: "No results" },
|
|
540
541
|
title: { default: "" },
|
|
@@ -583,6 +584,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
583
584
|
emits: [
|
|
584
585
|
"update:modelValue",
|
|
585
586
|
"update:perms",
|
|
587
|
+
"update:loading",
|
|
586
588
|
"sort",
|
|
587
589
|
"click",
|
|
588
590
|
"save",
|
|
@@ -593,8 +595,8 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
593
595
|
"page"
|
|
594
596
|
],
|
|
595
597
|
setup(t, { expose: r, emit: i }) {
|
|
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(
|
|
597
|
-
|
|
598
|
+
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(l.loading), 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);
|
|
599
|
+
M(o, (e) => a("update:loading", e)), M(f, (e) => a("page", e));
|
|
598
600
|
const fe = g(l.type);
|
|
599
601
|
l.itemMode && fe.value === J.Table && (fe.value = J.Item);
|
|
600
602
|
const Oe = (e) => {
|
|
@@ -702,7 +704,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
702
704
|
l.initialSorting && Re($t(l.columns, h.value)), ee.value.store({ items: d.value }).turnStoredIntoOriginal(), l.sortable && Pe(() => {
|
|
703
705
|
yt();
|
|
704
706
|
});
|
|
705
|
-
}),
|
|
707
|
+
}), M(() => l.perms, (e) => b.value = e), M(b, (e) => a("update:perms", e)), M(() => l.editMode, (e) => L.value = e), M(() => l.columns, (e) => K.value = e), M(() => l.modelValue, (e) => d.value = e), M(d, (e) => {
|
|
706
708
|
ee.value.increment({ items: e }), a("update:modelValue", e);
|
|
707
709
|
}, { deep: !0 }), r({
|
|
708
710
|
getItemByEvent: dt,
|
|
@@ -719,7 +721,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
719
721
|
key: 0,
|
|
720
722
|
class: O(e.headerClass)
|
|
721
723
|
}, [
|
|
722
|
-
Be.value ? (n(),
|
|
724
|
+
Be.value ? (n(), S(X(ut.value), { key: 0 }, {
|
|
723
725
|
default: P(() => [
|
|
724
726
|
e.titleIcon ? (n(), s("i", {
|
|
725
727
|
key: 0,
|
|
@@ -729,9 +731,9 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
729
731
|
]),
|
|
730
732
|
_: 1
|
|
731
733
|
})) : p("", !0),
|
|
732
|
-
C(u).title ?
|
|
734
|
+
C(u).title ? N(e.$slots, "title", { key: 1 }) : p("", !0)
|
|
733
735
|
], 2)) : p("", !0),
|
|
734
|
-
(n(),
|
|
736
|
+
(n(), S(X(rt.value), {
|
|
735
737
|
class: O(["lkt-table-page-content-wrapper", e.wrapContentClass])
|
|
736
738
|
}, {
|
|
737
739
|
default: P(() => [
|
|
@@ -749,7 +751,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
749
751
|
onClick: pt
|
|
750
752
|
}, {
|
|
751
753
|
default: P(() => [
|
|
752
|
-
C(u)["button-save"] ?
|
|
754
|
+
C(u)["button-save"] ? N(e.$slots, "button-save", {
|
|
753
755
|
key: 0,
|
|
754
756
|
items: d.value,
|
|
755
757
|
editMode: e.editMode,
|
|
@@ -760,7 +762,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
760
762
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
|
|
761
763
|
[de, Te.value]
|
|
762
764
|
]),
|
|
763
|
-
ye.value && d.value.length >= e.requiredItemsForTopCreate ? (n(),
|
|
765
|
+
ye.value && d.value.length >= e.requiredItemsForTopCreate ? (n(), S(qe, {
|
|
764
766
|
key: 0,
|
|
765
767
|
disabled: !Ae.value || e.createDisabled,
|
|
766
768
|
text: e.createText,
|
|
@@ -772,7 +774,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
772
774
|
se(te(W, {
|
|
773
775
|
type: "switch",
|
|
774
776
|
modelValue: L.value,
|
|
775
|
-
"onUpdate:modelValue": m[0] || (m[0] = (
|
|
777
|
+
"onUpdate:modelValue": m[0] || (m[0] = (B) => L.value = B),
|
|
776
778
|
label: st.value
|
|
777
779
|
}, null, 8, ["modelValue", "label"]), [
|
|
778
780
|
[de, e.switchEditionEnabled]
|
|
@@ -782,15 +784,15 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
782
784
|
[de, lt.value]
|
|
783
785
|
]),
|
|
784
786
|
C(u).buttons ? (n(), s("div", xt, [
|
|
785
|
-
|
|
787
|
+
N(e.$slots, "buttons")
|
|
786
788
|
])) : p("", !0),
|
|
787
789
|
v.value && C(u).filters ? (n(), s("div", el, [
|
|
788
|
-
|
|
790
|
+
N(e.$slots, "filters", {
|
|
789
791
|
items: d.value,
|
|
790
792
|
isLoading: o.value
|
|
791
793
|
})
|
|
792
794
|
])) : p("", !0),
|
|
793
|
-
o.value ? (n(),
|
|
795
|
+
o.value ? (n(), S(z, { key: 2 })) : p("", !0),
|
|
794
796
|
se(R("div", {
|
|
795
797
|
class: "lkt-table",
|
|
796
798
|
"data-sortable": e.sortable
|
|
@@ -801,15 +803,15 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
801
803
|
e.sortable && L.value ? (n(), s("th", al)) : p("", !0),
|
|
802
804
|
e.addNavigation && L.value ? (n(), s("th", ol)) : p("", !0),
|
|
803
805
|
Ee.value ? (n(), s("th", nl)) : p("", !0),
|
|
804
|
-
(n(!0), s(D, null, A(pe.value, (
|
|
805
|
-
Ce.value.indexOf(
|
|
806
|
+
(n(!0), s(D, null, A(pe.value, (B) => (n(), s(D, null, [
|
|
807
|
+
Ce.value.indexOf(B.key) === -1 ? (n(), S(Qt, {
|
|
806
808
|
key: 0,
|
|
807
|
-
column:
|
|
809
|
+
column: B,
|
|
808
810
|
"sort-by": h.value,
|
|
809
811
|
"sort-direction": I.value,
|
|
810
812
|
"amount-of-columns": e.columns.length,
|
|
811
813
|
items: d.value,
|
|
812
|
-
onClick: (T) => Re(
|
|
814
|
+
onClick: (T) => Re(B)
|
|
813
815
|
}, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : p("", !0)
|
|
814
816
|
], 64))), 256)),
|
|
815
817
|
e.canDrop && re.value && L.value ? (n(), s("th", ul)) : p("", !0),
|
|
@@ -817,17 +819,18 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
817
819
|
])
|
|
818
820
|
]),
|
|
819
821
|
R("tbody", {
|
|
820
|
-
|
|
822
|
+
ref_key: "tableBody",
|
|
823
|
+
ref: oe,
|
|
821
824
|
id: "lkt-table-body-" + C(me)
|
|
822
825
|
}, [
|
|
823
|
-
(n(!0), s(D, null, A(d.value, (
|
|
824
|
-
be(
|
|
826
|
+
(n(!0), s(D, null, A(d.value, (B, T) => (n(), s(D, null, [
|
|
827
|
+
be(B) ? (n(), S(Kt, {
|
|
825
828
|
modelValue: d.value[T],
|
|
826
829
|
"onUpdate:modelValue": (_) => d.value[T] = _,
|
|
827
|
-
key: We(
|
|
830
|
+
key: We(B, T),
|
|
828
831
|
i: T,
|
|
829
832
|
"display-hidden-columns-indicator": Ee.value,
|
|
830
|
-
"is-draggable": Fe(
|
|
833
|
+
"is-draggable": Fe(B),
|
|
831
834
|
sortable: e.sortable,
|
|
832
835
|
"visible-columns": pe.value,
|
|
833
836
|
"empty-columns": Ce.value,
|
|
@@ -853,7 +856,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
853
856
|
A(Ie.value, (_) => ({
|
|
854
857
|
name: _,
|
|
855
858
|
fn: P((j) => [
|
|
856
|
-
|
|
859
|
+
N(e.$slots, _, ie({
|
|
857
860
|
[e.slotItemVar || ""]: j.item,
|
|
858
861
|
value: j.value,
|
|
859
862
|
column: j.column
|
|
@@ -861,7 +864,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
861
864
|
])
|
|
862
865
|
}))
|
|
863
866
|
]), 1032, ["modelValue", "onUpdate:modelValue", "i", "display-hidden-columns-indicator", "is-draggable", "sortable", "visible-columns", "empty-columns", "add-navigation", "hidden-is-visible", "latest-row", "can-drop", "drop-confirm", "drop-resource", "drop-text", "drop-icon", "can-edit", "edit-text", "edit-icon", "edit-link", "edit-mode-enabled"])) : p("", !0),
|
|
864
|
-
Se.value.length > 0 ? (n(!0), s(D, { key: 1 }, A(d.value, (_, j) => (n(),
|
|
867
|
+
Se.value.length > 0 ? (n(!0), s(D, { key: 1 }, A(d.value, (_, j) => (n(), S(Jt, {
|
|
865
868
|
modelValue: d.value[j],
|
|
866
869
|
"onUpdate:modelValue": (he) => d.value[j] = he,
|
|
867
870
|
key: We(_, j, !0),
|
|
@@ -879,7 +882,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
879
882
|
A(Ie.value, (he) => ({
|
|
880
883
|
name: he,
|
|
881
884
|
fn: P((De) => [
|
|
882
|
-
|
|
885
|
+
N(e.$slots, he, ie({
|
|
883
886
|
[e.slotItemVar || ""]: De.item,
|
|
884
887
|
value: De.value,
|
|
885
888
|
column: De.column
|
|
@@ -893,10 +896,10 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
893
896
|
key: 1,
|
|
894
897
|
class: O(["lkt-table-items-container", e.itemsContainerClass])
|
|
895
898
|
}, [
|
|
896
|
-
(n(!0), s(D, null, A(d.value, (
|
|
897
|
-
be(
|
|
898
|
-
|
|
899
|
-
[e.slotItemVar || ""]:
|
|
899
|
+
(n(!0), s(D, null, A(d.value, (B, T) => (n(), s(D, null, [
|
|
900
|
+
be(B) ? (n(), s("div", sl, [
|
|
901
|
+
N(e.$slots, "item", ie({
|
|
902
|
+
[e.slotItemVar || ""]: B,
|
|
900
903
|
index: T,
|
|
901
904
|
canCreate: ve.value,
|
|
902
905
|
canRead: we.value,
|
|
@@ -911,10 +914,10 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
911
914
|
key: 2,
|
|
912
915
|
class: O(["lkt-table-items-container", e.itemsContainerClass])
|
|
913
916
|
}, [
|
|
914
|
-
(n(!0), s(D, null, A(d.value, (
|
|
915
|
-
be(
|
|
916
|
-
|
|
917
|
-
[e.slotItemVar || ""]:
|
|
917
|
+
(n(!0), s(D, null, A(d.value, (B, T) => (n(), s(D, null, [
|
|
918
|
+
be(B) ? (n(), s("li", dl, [
|
|
919
|
+
N(e.$slots, "item", ie({
|
|
920
|
+
[e.slotItemVar || ""]: B,
|
|
918
921
|
index: T,
|
|
919
922
|
canCreate: ve.value,
|
|
920
923
|
canRead: we.value,
|
|
@@ -929,10 +932,10 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
929
932
|
key: 3,
|
|
930
933
|
class: O(["lkt-table-items-container", e.itemsContainerClass])
|
|
931
934
|
}, [
|
|
932
|
-
(n(!0), s(D, null, A(d.value, (
|
|
933
|
-
be(
|
|
934
|
-
|
|
935
|
-
[e.slotItemVar || ""]:
|
|
935
|
+
(n(!0), s(D, null, A(d.value, (B, T) => (n(), s(D, null, [
|
|
936
|
+
be(B) ? (n(), s("li", cl, [
|
|
937
|
+
N(e.$slots, "item", ie({
|
|
938
|
+
[e.slotItemVar || ""]: B,
|
|
936
939
|
index: T,
|
|
937
940
|
canCreate: ve.value,
|
|
938
941
|
canRead: we.value,
|
|
@@ -948,7 +951,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
948
951
|
[de, !o.value && d.value.length > 0]
|
|
949
952
|
]),
|
|
950
953
|
!o.value && d.value.length === 0 ? (n(), s("div", fl, [
|
|
951
|
-
C(u).empty ?
|
|
954
|
+
C(u).empty ? N(e.$slots, "empty", { key: 0 }) : bt.value ? (n(), S(X(ht.value), {
|
|
952
955
|
key: 1,
|
|
953
956
|
message: e.noResultsText
|
|
954
957
|
}, null, 8, ["message"])) : e.noResultsText ? (n(), s(D, { key: 2 }, [
|
|
@@ -956,7 +959,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
956
959
|
], 64)) : p("", !0)
|
|
957
960
|
])) : p("", !0),
|
|
958
961
|
ye.value || C(u).bottomButtons ? (n(), s("div", ml, [
|
|
959
|
-
ye.value && d.value.length >= e.requiredItemsForBottomCreate ? (n(),
|
|
962
|
+
ye.value && d.value.length >= e.requiredItemsForBottomCreate ? (n(), S(qe, {
|
|
960
963
|
key: 0,
|
|
961
964
|
disabled: !Ae.value || e.createDisabled,
|
|
962
965
|
text: e.createText,
|
|
@@ -964,14 +967,14 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
964
967
|
to: e.createRoute,
|
|
965
968
|
onClick: Ne
|
|
966
969
|
}, null, 8, ["disabled", "text", "icon", "to"])) : p("", !0),
|
|
967
|
-
|
|
970
|
+
N(e.$slots, "bottom-buttons")
|
|
968
971
|
])) : p("", !0),
|
|
969
|
-
e.resource.length > 0 ? (n(),
|
|
972
|
+
e.resource.length > 0 ? (n(), S(G, {
|
|
970
973
|
key: 5,
|
|
971
974
|
ref_key: "paginator",
|
|
972
975
|
ref: y,
|
|
973
976
|
modelValue: f.value,
|
|
974
|
-
"onUpdate:modelValue": m[1] || (m[1] = (
|
|
977
|
+
"onUpdate:modelValue": m[1] || (m[1] = (B) => f.value = B),
|
|
975
978
|
resource: e.resource,
|
|
976
979
|
filters: e.filters,
|
|
977
980
|
onResults: Oe,
|
|
@@ -994,7 +997,7 @@ const Xt = ["id"], Yt = { class: "lkt-table-page-buttons" }, Zt = { key: 1 }, _t
|
|
|
994
997
|
$.defaultEmptySlot = t;
|
|
995
998
|
};
|
|
996
999
|
export {
|
|
997
|
-
|
|
1000
|
+
F as Column,
|
|
998
1001
|
wl as createActionColumn,
|
|
999
1002
|
$l as createCheckColumn,
|
|
1000
1003
|
Sl as createColumn,
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ import {TypeOfTable} from "../enums/TypeOfTable";
|
|
|
19
19
|
const emit = defineEmits([
|
|
20
20
|
'update:modelValue',
|
|
21
21
|
'update:perms',
|
|
22
|
+
'update:loading',
|
|
22
23
|
'sort',
|
|
23
24
|
'click',
|
|
24
25
|
'save',
|
|
@@ -43,6 +44,7 @@ const props = withDefaults(defineProps<{
|
|
|
43
44
|
initialSorting?: boolean
|
|
44
45
|
draggableItemKey?: string
|
|
45
46
|
itemDisplayChecker?: Function
|
|
47
|
+
loading?: boolean
|
|
46
48
|
|
|
47
49
|
|
|
48
50
|
page?: number
|
|
@@ -103,10 +105,11 @@ const props = withDefaults(defineProps<{
|
|
|
103
105
|
hideEmptyColumns: false,
|
|
104
106
|
initialSorting: false,
|
|
105
107
|
draggableItemKey: 'name',
|
|
108
|
+
loading: false,
|
|
106
109
|
|
|
107
110
|
|
|
108
111
|
page: 1,
|
|
109
|
-
perms: [],
|
|
112
|
+
perms: () => [],
|
|
110
113
|
resource: '',
|
|
111
114
|
noResultsText: 'No results',
|
|
112
115
|
title: '',
|
|
@@ -164,7 +167,7 @@ const Sorter = ref(typeof props.sorter === 'function' ? props.sorter : defaultTa
|
|
|
164
167
|
Columns = ref(props.columns);
|
|
165
168
|
|
|
166
169
|
const Page = ref(props.page),
|
|
167
|
-
|
|
170
|
+
isLoading = ref(props.loading),
|
|
168
171
|
firstLoadReady = ref(false),
|
|
169
172
|
permissions = ref(props.perms),
|
|
170
173
|
paginator = ref(null),
|
|
@@ -174,6 +177,8 @@ const Page = ref(props.page),
|
|
|
174
177
|
updateTimeStamp = ref(0)
|
|
175
178
|
;
|
|
176
179
|
|
|
180
|
+
watch(isLoading, v => emit('update:loading', v));
|
|
181
|
+
|
|
177
182
|
watch(Page, (v) => emit('page', v));
|
|
178
183
|
|
|
179
184
|
const Type = ref(props.type);
|
|
@@ -184,7 +189,7 @@ if (props.itemMode && Type.value === TypeOfTable.Table) {
|
|
|
184
189
|
const onResults = (r: any) => {
|
|
185
190
|
//@ts-ignore
|
|
186
191
|
if (Array.isArray(r)) Items.value = r;
|
|
187
|
-
|
|
192
|
+
isLoading.value = false;
|
|
188
193
|
firstLoadReady.value = true;
|
|
189
194
|
dataState.value.store({items: Items.value}).turnStoredIntoOriginal();
|
|
190
195
|
},
|
|
@@ -197,7 +202,7 @@ const onResults = (r: any) => {
|
|
|
197
202
|
onPaginatorResponse = (r: HTTPResponse) => {
|
|
198
203
|
emit('read-response', r);
|
|
199
204
|
},
|
|
200
|
-
onLoading = () => nextTick(() =>
|
|
205
|
+
onLoading = () => nextTick(() => isLoading.value = true),
|
|
201
206
|
doRefresh = () => {
|
|
202
207
|
//@ts-ignore
|
|
203
208
|
paginator.value.doRefresh();
|
|
@@ -245,14 +250,14 @@ const emptyColumns = computed(() => {
|
|
|
245
250
|
return Columns.value.map(c => c.key);
|
|
246
251
|
|
|
247
252
|
}),
|
|
248
|
-
colSlots = computed(():
|
|
249
|
-
let r = [];
|
|
253
|
+
colSlots = computed((): string[] => {
|
|
254
|
+
let r:string[] = [];
|
|
250
255
|
for (let k in slots) if (columnKeys.value.indexOf(k) !== -1) r.push(k);
|
|
251
256
|
return r;
|
|
252
257
|
}),
|
|
253
258
|
showSaveButton = computed(() => {
|
|
254
259
|
if (props.hiddenSave) return false;
|
|
255
|
-
if (
|
|
260
|
+
if (isLoading.value) return false;
|
|
256
261
|
if (!props.saveResource) return false;
|
|
257
262
|
if (editModeEnabled.value && dataState.value.changed()) return true;
|
|
258
263
|
|
|
@@ -370,15 +375,15 @@ const getItemByEvent = (e: any) => {
|
|
|
370
375
|
}
|
|
371
376
|
},
|
|
372
377
|
onButtonLoading = () => {
|
|
373
|
-
|
|
378
|
+
isLoading.value = true;
|
|
374
379
|
},
|
|
375
380
|
onButtonLoaded = () => {
|
|
376
|
-
|
|
381
|
+
isLoading.value = false;
|
|
377
382
|
},
|
|
378
383
|
onSave = ($event: PointerEvent, r: HTTPResponse) => {
|
|
379
384
|
emit('before-save');
|
|
380
385
|
if (props.saveResource) {
|
|
381
|
-
|
|
386
|
+
isLoading.value = false;
|
|
382
387
|
if (!r.success) {
|
|
383
388
|
emit('error', r.httpStatus);
|
|
384
389
|
return;
|
|
@@ -416,7 +421,10 @@ const getItemByEvent = (e: any) => {
|
|
|
416
421
|
handle: '.handle',
|
|
417
422
|
animation: 150,
|
|
418
423
|
onEnd: function (evt: CustomEvent) {
|
|
424
|
+
//@ts-ignore
|
|
419
425
|
let oldIndex = evt.oldIndex;
|
|
426
|
+
|
|
427
|
+
//@ts-ignore
|
|
420
428
|
let newIndex = evt.newIndex;
|
|
421
429
|
Items.value.splice(newIndex, 0, Items.value.splice(oldIndex, 1)[0]);
|
|
422
430
|
updateTimeStamp.value = time();
|
|
@@ -555,12 +563,12 @@ const hasEmptySlot = computed(() => {
|
|
|
555
563
|
</div>
|
|
556
564
|
|
|
557
565
|
<div class="lkt-table-page-filters" v-if="firstLoadReady && slots.filters">
|
|
558
|
-
<slot name="filters" :items="Items" :is-loading="
|
|
566
|
+
<slot name="filters" :items="Items" :is-loading="isLoading"/>
|
|
559
567
|
</div>
|
|
560
568
|
|
|
561
|
-
<lkt-loader v-if="
|
|
569
|
+
<lkt-loader v-if="isLoading"/>
|
|
562
570
|
|
|
563
|
-
<div v-show="!
|
|
571
|
+
<div v-show="!isLoading && Items.length > 0" class="lkt-table" :data-sortable="sortable">
|
|
564
572
|
<table v-if="Type === TypeOfTable.Table">
|
|
565
573
|
<thead>
|
|
566
574
|
<tr>
|
|
@@ -589,7 +597,7 @@ const hasEmptySlot = computed(() => {
|
|
|
589
597
|
</tr>
|
|
590
598
|
</thead>
|
|
591
599
|
<tbody
|
|
592
|
-
|
|
600
|
+
ref="tableBody"
|
|
593
601
|
:id="'lkt-table-body-' + uniqueId"
|
|
594
602
|
>
|
|
595
603
|
<template
|
|
@@ -676,7 +684,7 @@ const hasEmptySlot = computed(() => {
|
|
|
676
684
|
v-bind:can-read="hasReadPerm"
|
|
677
685
|
v-bind:can-update="hasUpdatePerm"
|
|
678
686
|
v-bind:can-drop="hasDropPerm"
|
|
679
|
-
v-bind:is-loading="
|
|
687
|
+
v-bind:is-loading="isLoading"
|
|
680
688
|
v-bind:do-drop="() => onItemDrop(i)"
|
|
681
689
|
/>
|
|
682
690
|
</div>
|
|
@@ -694,7 +702,7 @@ const hasEmptySlot = computed(() => {
|
|
|
694
702
|
v-bind:can-read="hasReadPerm"
|
|
695
703
|
v-bind:can-update="hasUpdatePerm"
|
|
696
704
|
v-bind:can-drop="hasDropPerm"
|
|
697
|
-
v-bind:is-loading="
|
|
705
|
+
v-bind:is-loading="isLoading"
|
|
698
706
|
v-bind:do-drop="() => onItemDrop(i)"
|
|
699
707
|
/>
|
|
700
708
|
</li>
|
|
@@ -712,7 +720,7 @@ const hasEmptySlot = computed(() => {
|
|
|
712
720
|
v-bind:can-read="hasReadPerm"
|
|
713
721
|
v-bind:can-update="hasUpdatePerm"
|
|
714
722
|
v-bind:can-drop="hasDropPerm"
|
|
715
|
-
v-bind:is-loading="
|
|
723
|
+
v-bind:is-loading="isLoading"
|
|
716
724
|
v-bind:do-drop="() => onItemDrop(i)"
|
|
717
725
|
/>
|
|
718
726
|
</li>
|
|
@@ -720,7 +728,7 @@ const hasEmptySlot = computed(() => {
|
|
|
720
728
|
</ol>
|
|
721
729
|
</div>
|
|
722
730
|
|
|
723
|
-
<div class="lkt-table-empty" v-if="!
|
|
731
|
+
<div class="lkt-table-empty" v-if="!isLoading && Items.length === 0">
|
|
724
732
|
<template v-if="slots.empty">
|
|
725
733
|
<slot name="empty"/>
|
|
726
734
|
</template>
|