lkt-table 1.3.10 → 1.3.11
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 +3 -3
- package/dist/build.js +36 -37
- package/package.json +1 -1
- package/src/components/LktTableCell.vue +1 -1
package/dist/build.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare class N {
|
|
|
15
15
|
getHref(r: any): any;
|
|
16
16
|
doAction(r: any): any;
|
|
17
17
|
}
|
|
18
|
-
declare function
|
|
18
|
+
declare function Ml(t: any, r: any, i: any, a?: boolean): {
|
|
19
19
|
key: string;
|
|
20
20
|
label: string;
|
|
21
21
|
sortable: boolean;
|
|
@@ -583,7 +583,7 @@ declare function Fl(t: any, r: any, i?: boolean): {
|
|
|
583
583
|
getHref: (r: any) => any;
|
|
584
584
|
doAction: (r: any) => any;
|
|
585
585
|
};
|
|
586
|
-
declare function
|
|
586
|
+
declare function Ll(t: any, r: any, i: any, a?: boolean): {
|
|
587
587
|
key: string;
|
|
588
588
|
label: string;
|
|
589
589
|
sortable: boolean;
|
|
@@ -947,4 +947,4 @@ declare function Ql(t: any): void;
|
|
|
947
947
|
declare function Gl(t: any): boolean;
|
|
948
948
|
declare function Xl(t: any): void;
|
|
949
949
|
import { Field as Je } from "lkt-field";
|
|
950
|
-
export { N as Column,
|
|
950
|
+
export { N as Column, Ml as createActionColumn, Wl as createCheckColumn, Rl as createColumn, Al as createEmailColumn, ql as createFileColumn, Ul as createFloatColumn, jl as createHiddenColumn, Fl as createIntegerColumn, Ll as createLinkColumn, Kl as createSelectColumn, Hl as createSwitchColumn, Pl as createTelColumn, Nl as createTextColumn, zl as default, Ol as setTableCreateButtonSlot, Jl as setTableDropButtonSlot, Ql as setTableEmptySlot, Gl as setTableNavButtonSlot, Xl as setTableSaveIcon };
|
package/dist/build.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { reactive as U, defineComponent as ee, ref as S, watch as
|
|
1
|
+
import { reactive as U, defineComponent as ee, ref as S, watch as L, computed as c, resolveComponent as K, unref as C, openBlock as n, createBlock as w, withCtx as H, createTextVNode as re, toDisplayString as _, createElementBlock as s, mergeProps as je, Fragment as E, withModifiers as Xe, resolveDynamicComponent as x, createCommentVNode as v, normalizeClass as Z, createElementVNode as M, createVNode as ne, renderList as W, renderSlot as F, withDirectives as ae, vShow as oe, useSlots as Tt, onMounted as $t, nextTick as ze, createSlots as Ge, normalizeProps as me } from "vue";
|
|
2
2
|
import { Field as Je } from "lkt-field";
|
|
3
3
|
import { __ as pe } from "lkt-i18n";
|
|
4
4
|
import { replaceAll as Ye, generateRandomString as Rt } from "lkt-string-tools";
|
|
5
|
-
import { DataState as
|
|
6
|
-
import
|
|
5
|
+
import { DataState as Lt } from "lkt-data-state";
|
|
6
|
+
import Mt from "sortablejs";
|
|
7
7
|
import { time as Se } from "lkt-date-tools";
|
|
8
8
|
class N {
|
|
9
9
|
constructor(r = {}) {
|
|
@@ -22,7 +22,7 @@ class N {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
var R = /* @__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))(R || {});
|
|
25
|
-
const Rl = (t) => U(new N(t)),
|
|
25
|
+
const Rl = (t) => U(new N(t)), Ll = (t, r, i, a = !0) => U(new N({ key: t, label: r, sortable: a, type: R.Link, link: i })), Ml = (t, r, i, a = !0) => U(new N({ key: t, label: r, sortable: a, type: R.Action, action: i })), Nl = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Text, sortable: i })), Fl = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Number, sortable: i })), Ul = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Number, sortable: i })), Al = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Email, sortable: i })), Pl = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Tel, sortable: i })), Wl = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Check, sortable: i })), Hl = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.Switch, sortable: i })), Kl = (t, r, i, a = !0) => U(new N({ key: t, label: r, type: R.Select, sortable: a })), ql = (t, r, i = !0) => U(new N({ key: t, label: r, type: R.File, sortable: i })), jl = (t, r, i = !0) => U(new N({ key: t, label: r, sortable: i, hidden: !0 })), Oe = (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") {
|
|
@@ -80,10 +80,10 @@ const Rl = (t) => U(new N(t)), Ml = (t, r, i, a = !0) => U(new N({ key: t, label
|
|
|
80
80
|
emits: ["update:modelValue"],
|
|
81
81
|
setup(t, { emit: r }) {
|
|
82
82
|
const i = r, a = t, u = S(a.modelValue), l = S(u.value[a.column.key]), y = S(null);
|
|
83
|
-
|
|
83
|
+
L(l, (m) => {
|
|
84
84
|
const o = JSON.parse(JSON.stringify(u.value));
|
|
85
85
|
o[a.column.key] = m, i("update:modelValue", o);
|
|
86
|
-
}),
|
|
86
|
+
}), L(() => a.modelValue, (m) => {
|
|
87
87
|
u.value = m, l.value = u.value[a.column.key];
|
|
88
88
|
});
|
|
89
89
|
const V = c(() => ({ ...a.column.slotData, item: u.value })), g = c(() => {
|
|
@@ -151,8 +151,7 @@ const Rl = (t) => U(new N(t)), Ml = (t, r, i, a = !0) => U(new N({ key: t, label
|
|
|
151
151
|
"modal-data": g.value,
|
|
152
152
|
options: G.value,
|
|
153
153
|
modelValue: l.value,
|
|
154
|
-
"onUpdate:modelValue": o[1] || (o[1] = (k) => l.value = k)
|
|
155
|
-
modelModifiers: { lazy: !0 }
|
|
154
|
+
"onUpdate:modelValue": o[1] || (o[1] = (k) => l.value = k)
|
|
156
155
|
}), null, 16, ["icon", "download", "type", "read-mode", "slot-data", "label", "modal-key", "modal-data", "options", "modelValue"])) : m.column.type !== "" ? (n(), w(b, je({ key: 3 }, m.column.field, {
|
|
157
156
|
icon: d.value,
|
|
158
157
|
download: q.value,
|
|
@@ -295,7 +294,7 @@ const Wt = /* @__PURE__ */ ee({
|
|
|
295
294
|
i("item-drop", a.i);
|
|
296
295
|
}, m = () => {
|
|
297
296
|
};
|
|
298
|
-
return
|
|
297
|
+
return L(() => a.modelValue, (o) => u.value = o), L(u, (o) => {
|
|
299
298
|
i("update:modelValue", o);
|
|
300
299
|
}, { deep: !0 }), (o, p) => {
|
|
301
300
|
const b = K("lkt-button");
|
|
@@ -309,7 +308,7 @@ const Wt = /* @__PURE__ */ ee({
|
|
|
309
308
|
class: Z(g.value)
|
|
310
309
|
}, null, 2)) : o.sortable && o.editModeEnabled ? (n(), s("td", qt)) : v("", !0),
|
|
311
310
|
o.addNavigation && o.editModeEnabled ? (n(), s("td", jt, [
|
|
312
|
-
|
|
311
|
+
M("div", zt, [
|
|
313
312
|
ne(b, {
|
|
314
313
|
palette: "table-nav",
|
|
315
314
|
disabled: o.i === 0,
|
|
@@ -320,7 +319,7 @@ const Wt = /* @__PURE__ */ ee({
|
|
|
320
319
|
key: 0,
|
|
321
320
|
direction: "up"
|
|
322
321
|
})) : (n(), s(E, { key: 1 }, [
|
|
323
|
-
p[2] || (p[2] =
|
|
322
|
+
p[2] || (p[2] = M("i", { class: "" }, null, -1)),
|
|
324
323
|
p[3] || (p[3] = re(" UP "))
|
|
325
324
|
], 64))
|
|
326
325
|
]),
|
|
@@ -336,7 +335,7 @@ const Wt = /* @__PURE__ */ ee({
|
|
|
336
335
|
key: 0,
|
|
337
336
|
direction: "down"
|
|
338
337
|
})) : (n(), s(E, { key: 1 }, [
|
|
339
|
-
p[4] || (p[4] =
|
|
338
|
+
p[4] || (p[4] = M("i", { class: "" }, null, -1)),
|
|
340
339
|
p[5] || (p[5] = re(" DOWN "))
|
|
341
340
|
], 64))
|
|
342
341
|
]),
|
|
@@ -414,17 +413,17 @@ const Wt = /* @__PURE__ */ ee({
|
|
|
414
413
|
emits: ["update:modelValue", "click"],
|
|
415
414
|
setup(t, { emit: r }) {
|
|
416
415
|
const i = r, a = t, u = S(a.modelValue), l = (y) => i("click", y);
|
|
417
|
-
return
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
416
|
+
return L(() => a.modelValue, (y) => u.value = y), L(u, () => i("update:modelValue", u.value)), (y, V) => ae((n(), s("tr", Xt, [
|
|
417
|
+
M("td", { colspan: y.hiddenColumnsColSpan }, [
|
|
418
|
+
M("table", null, [
|
|
419
|
+
M("tr", null, [
|
|
421
420
|
(n(!0), s(E, null, W(y.hiddenColumns, (g) => (n(), s("th", {
|
|
422
421
|
"data-column": g.key
|
|
423
422
|
}, [
|
|
424
|
-
|
|
423
|
+
M("div", null, _(g.label), 1)
|
|
425
424
|
], 8, Zt))), 256))
|
|
426
425
|
]),
|
|
427
|
-
|
|
426
|
+
M("tr", { "data-i": y.i }, [
|
|
428
427
|
(n(!0), s(E, null, W(y.hiddenColumns, (g, T) => (n(), s("td", {
|
|
429
428
|
"data-column": g.key,
|
|
430
429
|
title: C(ue)(g, u.value, T, y.hiddenColumns),
|
|
@@ -500,7 +499,7 @@ const Wt = /* @__PURE__ */ ee({
|
|
|
500
499
|
title: V.value,
|
|
501
500
|
onClick: g
|
|
502
501
|
}, [
|
|
503
|
-
|
|
502
|
+
M("div", null, _(V.value), 1)
|
|
504
503
|
], 8, tl));
|
|
505
504
|
}
|
|
506
505
|
});
|
|
@@ -598,8 +597,8 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
598
597
|
"page"
|
|
599
598
|
],
|
|
600
599
|
setup(t, { expose: r, emit: i }) {
|
|
601
|
-
const a = i, u = Tt(), l = t, y = {}, V = S(typeof l.sorter == "function" ? l.sorter : Oe), g = S(At(l.columns)), T = S(fe.Asc), d = S(l.modelValue), q = S(y), G = S(null), P = S(l.columns), m = S(l.page), o = S(l.loading), p = S(!1), b = S(l.perms), k = S(null), J = S(null), ve = S({}), le = S(new
|
|
602
|
-
|
|
600
|
+
const a = i, u = Tt(), l = t, y = {}, V = S(typeof l.sorter == "function" ? l.sorter : Oe), g = S(At(l.columns)), T = S(fe.Asc), d = S(l.modelValue), q = S(y), G = S(null), P = S(l.columns), m = S(l.page), o = S(l.loading), p = S(!1), b = S(l.perms), k = S(null), J = S(null), ve = S({}), le = S(new Lt({ items: d.value }, l.dataStateConfig)), $ = S(l.editMode), ie = S(0);
|
|
601
|
+
L(o, (e) => a("update:loading", e)), L(m, (e) => a("page", e));
|
|
603
602
|
const ye = S(l.type);
|
|
604
603
|
l.itemMode && ye.value === X.Table && (ye.value = X.Item);
|
|
605
604
|
const _e = (e) => {
|
|
@@ -632,7 +631,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
632
631
|
}), Re = c(() => l.hiddenSave || o.value || !l.saveResource ? !1 : $.value && le.value.changed() ? !0 : $.value), rt = c(() => ge.value && d.value.length >= l.requiredItemsForTopCreate || l.switchEditionEnabled ? !0 : Re.value || $.value && be.value), it = c(() => l.saveDisabled || typeof l.saveValidator == "function" && !l.saveValidator(d.value) ? !1 : le.value.changed()), dt = c(() => d.value.length), st = c(() => ({
|
|
633
632
|
items: d.value,
|
|
634
633
|
...l.saveResourceData
|
|
635
|
-
})), ct = c(() => l.titleTag === "" ? "h2" : l.titleTag), mt = c(() => l.wrapContentTag === "" ? "div" : l.wrapContentTag), Ie = c(() => l.title.startsWith("__:") ? pe(l.title.substring(3)) : l.title), ft = c(() => l.saveText.startsWith("__:") ? pe(l.saveText.substring(3)) : l.saveText), pt = c(() => l.editModeText.startsWith("__:") ? pe(l.editModeText.substring(3)) : l.editModeText), be = c(() => b.value.includes(Y.Create)), De = c(() => b.value.includes("read")), se = c(() => b.value.includes(Y.Update)),
|
|
634
|
+
})), ct = c(() => l.titleTag === "" ? "h2" : l.titleTag), mt = c(() => l.wrapContentTag === "" ? "div" : l.wrapContentTag), Ie = c(() => l.title.startsWith("__:") ? pe(l.title.substring(3)) : l.title), ft = c(() => l.saveText.startsWith("__:") ? pe(l.saveText.substring(3)) : l.saveText), pt = c(() => l.editModeText.startsWith("__:") ? pe(l.editModeText.substring(3)) : l.editModeText), be = c(() => b.value.includes(Y.Create)), De = c(() => b.value.includes("read")), se = c(() => b.value.includes(Y.Update)), Le = c(() => b.value.includes(Y.Edit)), vt = c(() => b.value.includes(Y.InlineEdit)), yt = c(() => b.value.includes(Y.InlineCreate)), Me = c(() => b.value.includes(Y.InlineCreateEver)), ce = c(() => b.value.includes(Y.Drop)), kt = (e) => {
|
|
636
635
|
let f = e.target;
|
|
637
636
|
if (typeof f.dataset.column > "u")
|
|
638
637
|
do
|
|
@@ -651,7 +650,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
651
650
|
let I = "tr_" + f;
|
|
652
651
|
q.value[I] = typeof q.value[I] > "u" ? !0 : !q.value[I];
|
|
653
652
|
}, gt = (e) => typeof l.checkValidDrag == "function" ? l.checkValidDrag(e) : !0, Pe = (e) => typeof l.draggableChecker == "function" ? l.draggableChecker(e) : !0, We = () => {
|
|
654
|
-
if (
|
|
653
|
+
if (Me.value)
|
|
655
654
|
a("click-create");
|
|
656
655
|
else {
|
|
657
656
|
if (typeof l.newValueGenerator == "function") {
|
|
@@ -689,7 +688,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
689
688
|
ve.value && (ve.value.destroy(), ve.value = {});
|
|
690
689
|
}, Ke = () => {
|
|
691
690
|
let e = document.getElementById("lkt-table-body-" + de);
|
|
692
|
-
ve.value = new
|
|
691
|
+
ve.value = new Mt(e, {
|
|
693
692
|
direction: "vertical",
|
|
694
693
|
handle: ".handle",
|
|
695
694
|
animation: 150,
|
|
@@ -707,14 +706,14 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
707
706
|
let Q = String(e[O.key]).toLowerCase();
|
|
708
707
|
Q.length > 50 && (Q = Q.substring(0, 50)), Q = Ye(Q, " ", "-"), A.push(Q);
|
|
709
708
|
}), A.join("-");
|
|
710
|
-
}, qe = c(() => typeof l.createEnabledValidator == "function" ? l.createEnabledValidator({ items: d.value }) : !0), ge = c(() =>
|
|
709
|
+
}, qe = c(() => typeof l.createEnabledValidator == "function" ? l.createEnabledValidator({ items: d.value }) : !0), ge = c(() => Me.value || yt.value && $.value), Ce = (e, f) => typeof l.itemDisplayChecker == "function" ? l.itemDisplayChecker(e) : !0;
|
|
711
710
|
$t(() => {
|
|
712
711
|
l.initialSorting && Fe(Pt(l.columns, g.value)), le.value.store({ items: d.value }).turnStoredIntoOriginal(), l.sortable && ze(() => {
|
|
713
712
|
Ke();
|
|
714
713
|
});
|
|
715
|
-
}),
|
|
714
|
+
}), L(() => l.sortable, (e) => {
|
|
716
715
|
e ? Ke() : Dt();
|
|
717
|
-
}),
|
|
716
|
+
}), L(() => l.perms, (e) => b.value = e), L(b, (e) => a("update:perms", e)), L(() => l.editMode, (e) => $.value = e), L(() => l.columns, (e) => P.value = e, { deep: !0 }), L(() => l.modelValue, (e) => d.value = e, { deep: !0 }), L(d, (e) => {
|
|
718
717
|
le.value.increment({ items: e }), a("update:modelValue", e);
|
|
719
718
|
}, { deep: !0 }), r({
|
|
720
719
|
getItemByEvent: kt,
|
|
@@ -752,7 +751,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
752
751
|
class: Z(["lkt-table-page-content-wrapper", e.wrapContentClass])
|
|
753
752
|
}, {
|
|
754
753
|
default: H(() => [
|
|
755
|
-
ae(
|
|
754
|
+
ae(M("div", ol, [
|
|
756
755
|
ae(ne(I, {
|
|
757
756
|
class: "lkt-table--save-button",
|
|
758
757
|
ref: "saveButton",
|
|
@@ -786,7 +785,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
786
785
|
to: e.createRoute,
|
|
787
786
|
onClick: We
|
|
788
787
|
}, null, 8, ["disabled", "text", "icon", "to"])) : v("", !0),
|
|
789
|
-
|
|
788
|
+
M("div", ul, [
|
|
790
789
|
ae(ne(A, {
|
|
791
790
|
type: "switch",
|
|
792
791
|
modelValue: $.value,
|
|
@@ -809,13 +808,13 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
809
808
|
})
|
|
810
809
|
])) : v("", !0),
|
|
811
810
|
o.value ? (n(), w(O, { key: 2 })) : v("", !0),
|
|
812
|
-
ae(
|
|
811
|
+
ae(M("div", {
|
|
813
812
|
class: "lkt-table",
|
|
814
813
|
"data-sortable": e.sortable
|
|
815
814
|
}, [
|
|
816
815
|
ye.value === C(X).Table ? (n(), s("table", sl, [
|
|
817
|
-
|
|
818
|
-
|
|
816
|
+
M("thead", null, [
|
|
817
|
+
M("tr", null, [
|
|
819
818
|
e.sortable && $.value ? (n(), s("th", cl)) : v("", !0),
|
|
820
819
|
e.addNavigation && $.value ? (n(), s("th", ml)) : v("", !0),
|
|
821
820
|
Te.value ? (n(), s("th", fl)) : v("", !0),
|
|
@@ -831,10 +830,10 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
831
830
|
}, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : v("", !0)
|
|
832
831
|
], 64))), 256)),
|
|
833
832
|
ce.value && $.value ? (n(), s("th", pl)) : v("", !0),
|
|
834
|
-
|
|
833
|
+
Le.value && se.value && $.value ? (n(), s("th", vl)) : v("", !0)
|
|
835
834
|
])
|
|
836
835
|
]),
|
|
837
|
-
|
|
836
|
+
M("tbody", {
|
|
838
837
|
ref_key: "tableBody",
|
|
839
838
|
ref: G,
|
|
840
839
|
id: "lkt-table-body-" + C(de)
|
|
@@ -857,7 +856,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
857
856
|
"drop-resource": e.dropResource,
|
|
858
857
|
"drop-text": e.dropText,
|
|
859
858
|
"drop-icon": e.dropIcon,
|
|
860
|
-
"can-edit":
|
|
859
|
+
"can-edit": Le.value && se.value && $.value,
|
|
861
860
|
"edit-text": e.editText,
|
|
862
861
|
"edit-icon": e.editIcon,
|
|
863
862
|
"edit-link": e.editLink,
|
|
@@ -1035,7 +1034,7 @@ const al = ["id"], ol = { class: "lkt-table-page-buttons" }, nl = { key: 1 }, ul
|
|
|
1035
1034
|
};
|
|
1036
1035
|
export {
|
|
1037
1036
|
N as Column,
|
|
1038
|
-
|
|
1037
|
+
Ml as createActionColumn,
|
|
1039
1038
|
Wl as createCheckColumn,
|
|
1040
1039
|
Rl as createColumn,
|
|
1041
1040
|
Al as createEmailColumn,
|
|
@@ -1043,7 +1042,7 @@ export {
|
|
|
1043
1042
|
Ul as createFloatColumn,
|
|
1044
1043
|
jl as createHiddenColumn,
|
|
1045
1044
|
Fl as createIntegerColumn,
|
|
1046
|
-
|
|
1045
|
+
Ll as createLinkColumn,
|
|
1047
1046
|
Kl as createSelectColumn,
|
|
1048
1047
|
Hl as createSwitchColumn,
|
|
1049
1048
|
Pl as createTelColumn,
|
package/package.json
CHANGED
|
@@ -117,7 +117,7 @@ const computedColumnType = computed(() => {
|
|
|
117
117
|
:modal-key="computedModalKey"
|
|
118
118
|
:modal-data="computedModalData"
|
|
119
119
|
:options="computedOptions"
|
|
120
|
-
v-model
|
|
120
|
+
v-model="value"/>
|
|
121
121
|
</template>
|
|
122
122
|
<template v-else-if="column.type !== ''">
|
|
123
123
|
<lkt-field
|