lkt-table 1.2.8 → 1.2.10
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 +14 -14
- package/dist/build.js +177 -167
- package/package.json +1 -1
- package/src/components/CreateButton.vue +3 -0
- package/src/lib-components/LktTable.vue +13 -1
package/dist/build.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ declare class K {
|
|
|
70
70
|
useForRowKey(t?: boolean): this;
|
|
71
71
|
isForRowKey: boolean | undefined;
|
|
72
72
|
}
|
|
73
|
-
declare function
|
|
73
|
+
declare function Tl(l: any, t: any, r: any, n?: boolean): {
|
|
74
74
|
key: string;
|
|
75
75
|
label: string;
|
|
76
76
|
sortable: boolean;
|
|
@@ -141,7 +141,7 @@ declare function Dl(l: any, t: any, r: any, n?: boolean): {
|
|
|
141
141
|
useForRowKey: (t?: boolean) => K;
|
|
142
142
|
isForRowKey: boolean | undefined;
|
|
143
143
|
};
|
|
144
|
-
declare function
|
|
144
|
+
declare function Ll(l: any, t: any, r?: boolean): {
|
|
145
145
|
key: string;
|
|
146
146
|
label: string;
|
|
147
147
|
sortable: boolean;
|
|
@@ -212,7 +212,7 @@ declare function El(l: any, t: any, r?: boolean): {
|
|
|
212
212
|
useForRowKey: (t?: boolean) => K;
|
|
213
213
|
isForRowKey: boolean | undefined;
|
|
214
214
|
};
|
|
215
|
-
declare function
|
|
215
|
+
declare function Dl(l: any, t: any, r?: boolean): {
|
|
216
216
|
key: string;
|
|
217
217
|
label: string;
|
|
218
218
|
sortable: boolean;
|
|
@@ -283,7 +283,7 @@ declare function Sl(l: any, t: any, r?: boolean): {
|
|
|
283
283
|
useForRowKey: (t?: boolean) => K;
|
|
284
284
|
isForRowKey: boolean | undefined;
|
|
285
285
|
};
|
|
286
|
-
declare function
|
|
286
|
+
declare function El(l: any, t: any, r?: boolean): {
|
|
287
287
|
key: string;
|
|
288
288
|
label: string;
|
|
289
289
|
sortable: boolean;
|
|
@@ -354,7 +354,7 @@ declare function Tl(l: any, t: any, r?: boolean): {
|
|
|
354
354
|
useForRowKey: (t?: boolean) => K;
|
|
355
355
|
isForRowKey: boolean | undefined;
|
|
356
356
|
};
|
|
357
|
-
declare function
|
|
357
|
+
declare function $l(l: any, t: any, r?: boolean): {
|
|
358
358
|
key: string;
|
|
359
359
|
label: string;
|
|
360
360
|
sortable: boolean;
|
|
@@ -425,7 +425,7 @@ declare function Ml(l: any, t: any, r?: boolean): {
|
|
|
425
425
|
useForRowKey: (t?: boolean) => K;
|
|
426
426
|
isForRowKey: boolean | undefined;
|
|
427
427
|
};
|
|
428
|
-
declare function
|
|
428
|
+
declare function wl(l: any, t: any, r: any, n?: boolean): {
|
|
429
429
|
key: string;
|
|
430
430
|
label: string;
|
|
431
431
|
sortable: boolean;
|
|
@@ -496,7 +496,7 @@ declare function Vl(l: any, t: any, r: any, n?: boolean): {
|
|
|
496
496
|
useForRowKey: (t?: boolean) => K;
|
|
497
497
|
isForRowKey: boolean | undefined;
|
|
498
498
|
};
|
|
499
|
-
declare function
|
|
499
|
+
declare function Rl(l: any, t: any, r: any, n?: boolean): {
|
|
500
500
|
key: string;
|
|
501
501
|
label: string;
|
|
502
502
|
sortable: boolean;
|
|
@@ -567,7 +567,7 @@ declare function Ll(l: any, t: any, r: any, n?: boolean): {
|
|
|
567
567
|
useForRowKey: (t?: boolean) => K;
|
|
568
568
|
isForRowKey: boolean | undefined;
|
|
569
569
|
};
|
|
570
|
-
declare function
|
|
570
|
+
declare function Ml(l: any, t: any, r?: boolean): {
|
|
571
571
|
key: string;
|
|
572
572
|
label: string;
|
|
573
573
|
sortable: boolean;
|
|
@@ -638,7 +638,7 @@ declare function Il(l: any, t: any, r?: boolean): {
|
|
|
638
638
|
useForRowKey: (t?: boolean) => K;
|
|
639
639
|
isForRowKey: boolean | undefined;
|
|
640
640
|
};
|
|
641
|
-
declare function
|
|
641
|
+
declare function Il(l: any, t: any, r?: boolean): {
|
|
642
642
|
key: string;
|
|
643
643
|
label: string;
|
|
644
644
|
sortable: boolean;
|
|
@@ -709,7 +709,7 @@ declare function Bl(l: any, t: any, r?: boolean): {
|
|
|
709
709
|
useForRowKey: (t?: boolean) => K;
|
|
710
710
|
isForRowKey: boolean | undefined;
|
|
711
711
|
};
|
|
712
|
-
declare function
|
|
712
|
+
declare function Bl(l: any, t: any, r?: boolean): {
|
|
713
713
|
key: string;
|
|
714
714
|
label: string;
|
|
715
715
|
sortable: boolean;
|
|
@@ -780,10 +780,10 @@ declare function wl(l: any, t: any, r?: boolean): {
|
|
|
780
780
|
useForRowKey: (t?: boolean) => K;
|
|
781
781
|
isForRowKey: boolean | undefined;
|
|
782
782
|
};
|
|
783
|
-
declare namespace
|
|
783
|
+
declare namespace Al {
|
|
784
784
|
function install(l: any): void;
|
|
785
785
|
}
|
|
786
|
+
declare function Nl(l: any): boolean;
|
|
787
|
+
declare function Fl(l: any): boolean;
|
|
786
788
|
declare function Ol(l: any): boolean;
|
|
787
|
-
|
|
788
|
-
declare function Al(l: any): boolean;
|
|
789
|
-
export { K as LktTableColumn, Dl as createActionColumn, El as createCheckColumn, Sl as createColumn, Tl as createEmailColumn, Ml as createHiddenColumn, Vl as createLinkColumn, Ll as createSelectColumn, Il as createSwitchColumn, Bl as createTelColumn, wl as createTextColumn, $l as default, Ol as setTableCreateButtonSlot, Rl as setTableDropButtonSlot, Al as setTableNavButtonSlot };
|
|
789
|
+
export { K as LktTableColumn, Tl as createActionColumn, Ll as createCheckColumn, Dl as createColumn, El as createEmailColumn, $l as createHiddenColumn, wl as createLinkColumn, Rl as createSelectColumn, Ml as createSwitchColumn, Il as createTelColumn, Bl as createTextColumn, Al as default, Nl as setTableCreateButtonSlot, Fl as setTableDropButtonSlot, Ol as setTableNavButtonSlot };
|
package/dist/build.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { reactive as H, defineComponent as q, ref as C, watch as U, nextTick as de, computed as f, resolveComponent as
|
|
2
|
-
import { httpCall as
|
|
1
|
+
import { reactive as H, defineComponent as q, ref as C, watch as U, nextTick as de, computed as f, resolveComponent as R, openBlock as u, createBlock as b, withCtx as N, createTextVNode as le, toDisplayString as j, unref as I, createElementBlock as m, Fragment as $, withModifiers as ut, resolveDynamicComponent as Z, createCommentVNode as y, normalizeClass as te, createElementVNode as E, createVNode as X, renderList as W, renderSlot as F, withDirectives as x, vShow as ee, useSlots as st, onMounted as it, createSlots as Ee } from "vue";
|
|
2
|
+
import { httpCall as rt } from "lkt-http-client";
|
|
3
3
|
import { __ as z } from "lkt-i18n";
|
|
4
4
|
import { createLktEvent as ce } from "lkt-events";
|
|
5
|
-
import { generateRandomString as
|
|
6
|
-
import { DataState as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
5
|
+
import { generateRandomString as dt, replaceAll as ct } from "lkt-string-tools";
|
|
6
|
+
import { DataState as mt } from "lkt-data-state";
|
|
7
|
+
import ft from "sortablejs";
|
|
8
|
+
import pt from "lkt-loader";
|
|
9
|
+
import vt from "lkt-button";
|
|
10
|
+
import ht from "lkt-paginator";
|
|
11
|
+
import yt from "lkt-field-text";
|
|
12
|
+
import kt from "lkt-field-textarea";
|
|
13
|
+
import bt from "lkt-field-select";
|
|
14
|
+
import gt from "lkt-field-switch";
|
|
15
|
+
import Ct from "lkt-field-file";
|
|
16
16
|
class K {
|
|
17
17
|
constructor(t = "", r = "") {
|
|
18
18
|
this.key = t, this.label = r, this.sortable = !0, this.hidden = !1, this.formatter = void 0, this.checkEmpty = void 0, this.colspan = void 0, this.resource = "", this.resourceData = {}, this.isMultiple = !1, this.isLoading = !1, this.resourceLoaded = !1, this.valueSlot = "", this.editSlot = "", this.multipleDisplay = "", this.multipleDisplayEdition = "";
|
|
@@ -102,7 +102,7 @@ class K {
|
|
|
102
102
|
if (!this.resource) return this;
|
|
103
103
|
try {
|
|
104
104
|
this.isLoading = !0;
|
|
105
|
-
const t = await
|
|
105
|
+
const t = await rt(this.resource, this.resourceData);
|
|
106
106
|
this.options = t.data, this.isLoading = !1, this.resourceLoaded = !0;
|
|
107
107
|
} catch {
|
|
108
108
|
this.isLoading = !1;
|
|
@@ -155,7 +155,7 @@ class K {
|
|
|
155
155
|
return this.isForRowKey = t, this;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
const
|
|
158
|
+
const Dl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), wl = (l, t, r, n = !0) => H(new K(l, t).setIsSortable(n).defineAsLink(r)), Tl = (l, t, r, n = !0) => H(new K(l, t).setIsSortable(n).defineAsAction(r)), Bl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsText()), El = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsEmail()), Il = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsTel()), Ll = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsCheck()), Ml = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsSwitch()), Rl = (l, t, r, n = !0) => H(new K(l, t).setIsSortable(n).defineAsSelect(r)), $l = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).setIsHidden(!0)), Ie = (l, t, r, n) => {
|
|
159
159
|
if (!r) return 0;
|
|
160
160
|
let s = l[r.key], o = t[r.key];
|
|
161
161
|
if (n === "asc") {
|
|
@@ -177,24 +177,24 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
177
177
|
return s.startsWith("__:") ? z(s.substring(3)) : s;
|
|
178
178
|
}
|
|
179
179
|
return t[l.key];
|
|
180
|
-
},
|
|
180
|
+
}, St = (l, t, r) => {
|
|
181
181
|
if (!l.colspan) return -1;
|
|
182
182
|
let n = t;
|
|
183
183
|
return r.forEach((s) => {
|
|
184
184
|
let o = me(l, s);
|
|
185
185
|
o > 0 && o < n && (n = o);
|
|
186
186
|
}), n;
|
|
187
|
-
}, me = (l, t) => l.colspan === !1 ? !1 : typeof l.colspan == "function" ? l.colspan(t) : l.colspan,
|
|
187
|
+
}, me = (l, t) => l.colspan === !1 ? !1 : typeof l.colspan == "function" ? l.colspan(t) : l.colspan, Vt = (l, t, r) => {
|
|
188
188
|
if (typeof l != "object" || !l.key || t.indexOf(l.key) > -1) return !1;
|
|
189
189
|
let n = me(l, r);
|
|
190
190
|
return typeof l.colspan > "u" ? !0 : (typeof l.colspan < "u" && (typeof l.colspan == "function" ? n = parseInt(l.colspan()) : n = parseInt(l.colspan)), n > 0);
|
|
191
|
-
},
|
|
191
|
+
}, Dt = (l = []) => {
|
|
192
192
|
if (l.length > 0) {
|
|
193
193
|
for (let t = 0; t < l.length; ++t)
|
|
194
194
|
if (l[t].sortable) return l[t].key;
|
|
195
195
|
}
|
|
196
196
|
return "";
|
|
197
|
-
},
|
|
197
|
+
}, wt = (l, t) => {
|
|
198
198
|
if (l.length > 0) {
|
|
199
199
|
for (let r = 0; r < l.length; ++r)
|
|
200
200
|
if (l[r].key === t) return l[r];
|
|
@@ -222,8 +222,8 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
222
222
|
}, { deep: !0 }), n.column.hasToLoadResource() && n.column.loadResource();
|
|
223
223
|
const v = f(() => ({ ...n.column.slotData, item: s.value }));
|
|
224
224
|
return (a, i) => {
|
|
225
|
-
const
|
|
226
|
-
return a.column.type === "link" ? (u(), b(
|
|
225
|
+
const _ = R("lkt-anchor"), J = R("lkt-field-text"), d = R("lkt-field-switch"), L = R("lkt-field-file"), S = R("lkt-loader"), V = R("lkt-field-select");
|
|
226
|
+
return a.column.type === "link" ? (u(), b(_, {
|
|
227
227
|
key: 0,
|
|
228
228
|
to: a.column.getHref(s.value)
|
|
229
229
|
}, {
|
|
@@ -283,7 +283,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
283
283
|
ref: (p) => h.value = p,
|
|
284
284
|
modelValue: o.value,
|
|
285
285
|
"onUpdate:modelValue": i[6] || (i[6] = (p) => o.value = p)
|
|
286
|
-
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "select" ? (u(), m(
|
|
286
|
+
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "select" ? (u(), m($, { key: 8 }, [
|
|
287
287
|
g.value ? (u(), b(S, { key: 0 })) : (u(), b(V, {
|
|
288
288
|
key: 1,
|
|
289
289
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
@@ -300,16 +300,16 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
300
300
|
"multiple-display": a.column.multipleDisplay,
|
|
301
301
|
"multiple-display-edition": a.column.multipleDisplayEdition
|
|
302
302
|
}, null, 8, ["read-mode", "modelValue", "slot-data", "resource", "use-resource-slot", "resource-data", "options", "multiple", "tags", "multiple-display", "multiple-display-edition"]))
|
|
303
|
-
], 64)) : (u(), m(
|
|
303
|
+
], 64)) : (u(), m($, { key: 9 }, [
|
|
304
304
|
le(j(I(Y)(a.column, s.value, a.i, a.columns)), 1)
|
|
305
305
|
], 64));
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
}),
|
|
308
|
+
}), A = {
|
|
309
309
|
navButtonSlot: "",
|
|
310
310
|
dropButtonSlot: "",
|
|
311
311
|
createButtonSlot: ""
|
|
312
|
-
},
|
|
312
|
+
}, Tt = /* @__PURE__ */ q({
|
|
313
313
|
__name: "DropButton",
|
|
314
314
|
props: {
|
|
315
315
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -321,9 +321,9 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
321
321
|
},
|
|
322
322
|
emits: ["click"],
|
|
323
323
|
setup(l, { emit: t }) {
|
|
324
|
-
const r = t, n = l, s = f(() =>
|
|
324
|
+
const r = t, n = l, s = f(() => A.dropButtonSlot !== ""), o = f(() => A.dropButtonSlot), h = f(() => n.text.startsWith("__:") ? z(n.text.substring(3)) : n.text);
|
|
325
325
|
return (g, v) => {
|
|
326
|
-
const a =
|
|
326
|
+
const a = R("lkt-button");
|
|
327
327
|
return u(), b(a, {
|
|
328
328
|
palette: "table-delete",
|
|
329
329
|
icon: s.value ? "" : g.icon,
|
|
@@ -332,7 +332,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
332
332
|
"resource-data": g.resourceData,
|
|
333
333
|
"confirm-modal": g.confirm,
|
|
334
334
|
disabled: g.disabled,
|
|
335
|
-
onClick: v[0] || (v[0] =
|
|
335
|
+
onClick: v[0] || (v[0] = ut((i) => r("click"), ["prevent", "stop"]))
|
|
336
336
|
}, {
|
|
337
337
|
default: N(() => [
|
|
338
338
|
s.value ? (u(), b(Z(o.value), { key: 0 })) : y("", !0)
|
|
@@ -341,16 +341,16 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
341
341
|
}, 8, ["icon", "text", "resource", "resource-data", "confirm-modal", "disabled"]);
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
|
-
}),
|
|
344
|
+
}), Bt = ["data-i", "data-draggable"], Et = {
|
|
345
345
|
key: 1,
|
|
346
346
|
"data-role": "invalid-drag-indicator"
|
|
347
|
-
},
|
|
347
|
+
}, It = {
|
|
348
348
|
key: 2,
|
|
349
349
|
class: "lkt-table-nav-cell"
|
|
350
|
-
},
|
|
350
|
+
}, Lt = { class: "lkt-table-nav-container" }, Mt = /* @__PURE__ */ E("i", { class: "" }, null, -1), Rt = /* @__PURE__ */ E("i", { class: "" }, null, -1), $t = ["data-column", "colspan", "title", "onClick"], At = {
|
|
351
351
|
key: 4,
|
|
352
352
|
class: "lkt-table-col-drop"
|
|
353
|
-
},
|
|
353
|
+
}, Ot = /* @__PURE__ */ q({
|
|
354
354
|
__name: "LktTableRow",
|
|
355
355
|
props: {
|
|
356
356
|
modelValue: { default: () => ({}) },
|
|
@@ -379,11 +379,11 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
379
379
|
}, g = f(() => {
|
|
380
380
|
let d = [];
|
|
381
381
|
return n.sortable && n.isDraggable && d.push("handle"), d.join(" ");
|
|
382
|
-
}), v = f(() =>
|
|
383
|
-
f(() =>
|
|
382
|
+
}), v = f(() => A.navButtonSlot !== ""), a = f(() => A.navButtonSlot);
|
|
383
|
+
f(() => A.dropButtonSlot !== ""), f(() => A.dropButtonSlot);
|
|
384
384
|
const i = () => {
|
|
385
385
|
r("item-up", n.i);
|
|
386
|
-
},
|
|
386
|
+
}, _ = () => {
|
|
387
387
|
r("item-down", n.i);
|
|
388
388
|
}, J = () => {
|
|
389
389
|
r("item-drop", n.i);
|
|
@@ -391,7 +391,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
391
391
|
return U(() => n.modelValue, (d) => s.value = d), U(s, (d) => {
|
|
392
392
|
r("update:modelValue", d, n.i);
|
|
393
393
|
}, { deep: !0 }), (d, L) => {
|
|
394
|
-
const S =
|
|
394
|
+
const S = R("lkt-button");
|
|
395
395
|
return u(), m("tr", {
|
|
396
396
|
"data-i": d.i,
|
|
397
397
|
"data-draggable": d.isDraggable
|
|
@@ -400,9 +400,9 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
400
400
|
key: 0,
|
|
401
401
|
"data-role": "drag-indicator",
|
|
402
402
|
class: te(g.value)
|
|
403
|
-
}, null, 2)) : d.sortable && d.editModeEnabled ? (u(), m("td",
|
|
404
|
-
d.addNavigation && d.editModeEnabled ? (u(), m("td",
|
|
405
|
-
E("div",
|
|
403
|
+
}, null, 2)) : d.sortable && d.editModeEnabled ? (u(), m("td", Et)) : y("", !0),
|
|
404
|
+
d.addNavigation && d.editModeEnabled ? (u(), m("td", It, [
|
|
405
|
+
E("div", Lt, [
|
|
406
406
|
X(S, {
|
|
407
407
|
palette: "table-nav",
|
|
408
408
|
disabled: d.i === 0,
|
|
@@ -412,8 +412,8 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
412
412
|
v.value ? (u(), b(Z(a.value), {
|
|
413
413
|
key: 0,
|
|
414
414
|
direction: "up"
|
|
415
|
-
})) : (u(), m(
|
|
416
|
-
|
|
415
|
+
})) : (u(), m($, { key: 1 }, [
|
|
416
|
+
Mt,
|
|
417
417
|
le(" UP ")
|
|
418
418
|
], 64))
|
|
419
419
|
]),
|
|
@@ -422,14 +422,14 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
422
422
|
X(S, {
|
|
423
423
|
palette: "table-nav",
|
|
424
424
|
disabled: d.latestRow,
|
|
425
|
-
onClick:
|
|
425
|
+
onClick: _
|
|
426
426
|
}, {
|
|
427
427
|
default: N(() => [
|
|
428
428
|
v.value ? (u(), b(Z(a.value), {
|
|
429
429
|
key: 0,
|
|
430
430
|
direction: "down"
|
|
431
|
-
})) : (u(), m(
|
|
432
|
-
|
|
431
|
+
})) : (u(), m($, { key: 1 }, [
|
|
432
|
+
Rt,
|
|
433
433
|
le(" DOWN ")
|
|
434
434
|
], 64))
|
|
435
435
|
]),
|
|
@@ -443,8 +443,8 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
443
443
|
"data-role": "show-more",
|
|
444
444
|
class: te(d.hiddenIsVisible ? "state-open" : "")
|
|
445
445
|
}, null, 2)) : y("", !0),
|
|
446
|
-
(u(!0), m(
|
|
447
|
-
I(
|
|
446
|
+
(u(!0), m($, null, W(d.visibleColumns, (V) => (u(), m($, null, [
|
|
447
|
+
I(Vt)(V, d.emptyColumns, s.value) ? (u(), m("td", {
|
|
448
448
|
key: 0,
|
|
449
449
|
"data-column": V.key,
|
|
450
450
|
colspan: I(me)(V, s.value),
|
|
@@ -466,10 +466,10 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
466
466
|
"edit-mode-enabled": d.editModeEnabled,
|
|
467
467
|
i: d.i
|
|
468
468
|
}, null, 8, ["modelValue", "column", "columns", "edit-mode-enabled", "i"])) : y("", !0)
|
|
469
|
-
], 8,
|
|
469
|
+
], 8, $t)) : y("", !0)
|
|
470
470
|
], 64))), 256)),
|
|
471
|
-
d.canDrop && d.editModeEnabled ? (u(), m("td",
|
|
472
|
-
X(
|
|
471
|
+
d.canDrop && d.editModeEnabled ? (u(), m("td", At, [
|
|
472
|
+
X(Tt, {
|
|
473
473
|
resource: d.dropResource,
|
|
474
474
|
"resource-data": s.value,
|
|
475
475
|
confirm: d.dropConfirm,
|
|
@@ -478,10 +478,10 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
478
478
|
onClick: J
|
|
479
479
|
}, null, 8, ["resource", "resource-data", "confirm", "text", "icon"])
|
|
480
480
|
])) : y("", !0)
|
|
481
|
-
], 8,
|
|
481
|
+
], 8, Bt);
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
|
-
}),
|
|
484
|
+
}), Ft = { "data-role": "hidden-row" }, Nt = ["colspan"], Ut = ["data-column"], Ht = ["data-i"], Kt = ["data-column", "title", "onClick"], Pt = /* @__PURE__ */ q({
|
|
485
485
|
__name: "LktHiddenRow",
|
|
486
486
|
props: {
|
|
487
487
|
modelValue: { default: () => ({}) },
|
|
@@ -499,18 +499,18 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
499
499
|
const r = t, n = l, s = C(n.modelValue), o = (h, g, v) => {
|
|
500
500
|
r("click", h, ce("", { item: g, column: v }));
|
|
501
501
|
};
|
|
502
|
-
return U(() => n.modelValue, (h) => s.value = h), U(s, () => r("update:modelValue", s.value)), (h, g) => x((u(), m("tr",
|
|
502
|
+
return U(() => n.modelValue, (h) => s.value = h), U(s, () => r("update:modelValue", s.value)), (h, g) => x((u(), m("tr", Ft, [
|
|
503
503
|
E("td", { colspan: h.hiddenColumnsColSpan }, [
|
|
504
504
|
E("table", null, [
|
|
505
505
|
E("tr", null, [
|
|
506
|
-
(u(!0), m(
|
|
506
|
+
(u(!0), m($, null, W(h.hiddenColumns, (v) => (u(), m("th", {
|
|
507
507
|
"data-column": v.key
|
|
508
508
|
}, [
|
|
509
509
|
E("div", null, j(v.label), 1)
|
|
510
|
-
], 8,
|
|
510
|
+
], 8, Ut))), 256))
|
|
511
511
|
]),
|
|
512
512
|
E("tr", { "data-i": h.i }, [
|
|
513
|
-
(u(!0), m(
|
|
513
|
+
(u(!0), m($, null, W(h.hiddenColumns, (v, a) => (u(), m("td", {
|
|
514
514
|
"data-column": v.key,
|
|
515
515
|
title: I(Y)(v, s.value, a, h.hiddenColumns),
|
|
516
516
|
onClick: (i) => o(i, s.value, v)
|
|
@@ -529,10 +529,10 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
529
529
|
"onUpdate:modelValue": g[0] || (g[0] = (i) => s.value = i),
|
|
530
530
|
i: a
|
|
531
531
|
}, null, 8, ["column", "columns", "modelValue", "i"]))
|
|
532
|
-
], 8,
|
|
533
|
-
], 8,
|
|
532
|
+
], 8, Kt))), 256))
|
|
533
|
+
], 8, Ht)
|
|
534
534
|
])
|
|
535
|
-
], 8,
|
|
535
|
+
], 8, Nt)
|
|
536
536
|
], 512)), [
|
|
537
537
|
[ee, h.hiddenIsVisible]
|
|
538
538
|
]);
|
|
@@ -542,28 +542,30 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
542
542
|
props: {
|
|
543
543
|
disabled: { type: Boolean, default: !1 },
|
|
544
544
|
text: { default: "" },
|
|
545
|
-
icon: { default: "" }
|
|
545
|
+
icon: { default: "" },
|
|
546
|
+
to: { default: "" }
|
|
546
547
|
},
|
|
547
548
|
emits: ["click"],
|
|
548
549
|
setup(l, { emit: t }) {
|
|
549
|
-
const r = t, n = l, s = f(() =>
|
|
550
|
+
const r = t, n = l, s = f(() => A.createButtonSlot !== ""), o = f(() => A.createButtonSlot), h = f(() => n.text.startsWith("__:") ? z(n.text.substring(3)) : n.text);
|
|
550
551
|
return (g, v) => {
|
|
551
|
-
const a =
|
|
552
|
+
const a = R("lkt-button");
|
|
552
553
|
return u(), b(a, {
|
|
553
554
|
palette: "table-create",
|
|
554
555
|
disabled: g.disabled,
|
|
555
556
|
icon: s.value ? "" : g.icon,
|
|
556
557
|
text: s.value ? "" : h.value,
|
|
558
|
+
"on-click-to": g.to,
|
|
557
559
|
onClick: v[0] || (v[0] = (i) => r("click"))
|
|
558
560
|
}, {
|
|
559
561
|
default: N(() => [
|
|
560
562
|
s.value ? (u(), b(Z(o.value), { key: 0 })) : y("", !0)
|
|
561
563
|
]),
|
|
562
564
|
_: 1
|
|
563
|
-
}, 8, ["disabled", "icon", "text"]);
|
|
565
|
+
}, 8, ["disabled", "icon", "text", "on-click-to"]);
|
|
564
566
|
};
|
|
565
567
|
}
|
|
566
|
-
}),
|
|
568
|
+
}), Wt = ["data-column", "data-sortable", "data-sort", "colspan", "title"], _t = /* @__PURE__ */ q({
|
|
567
569
|
__name: "TableHeader",
|
|
568
570
|
props: {
|
|
569
571
|
column: { default: () => ({}) },
|
|
@@ -574,7 +576,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
574
576
|
},
|
|
575
577
|
emits: ["click"],
|
|
576
578
|
setup(l, { emit: t }) {
|
|
577
|
-
const r = t, n = l, s = f(() =>
|
|
579
|
+
const r = t, n = l, s = f(() => St(n.column, n.amountOfColumns, n.items)), o = f(() => n.column.sortable === !0), h = f(() => o.value && n.sortBy === n.column.key ? n.sortDirection : ""), g = f(() => n.column.label.startsWith("__:") ? z(n.column.label.substring(3)) : n.column.label), v = () => {
|
|
578
580
|
r("click", n.column);
|
|
579
581
|
};
|
|
580
582
|
return (a, i) => (u(), m("th", {
|
|
@@ -586,30 +588,30 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
586
588
|
onClick: v
|
|
587
589
|
}, [
|
|
588
590
|
E("div", null, j(g.value), 1)
|
|
589
|
-
], 8,
|
|
591
|
+
], 8, Wt));
|
|
590
592
|
}
|
|
591
|
-
}),
|
|
593
|
+
}), jt = ["id"], Jt = { key: 0 }, Gt = { class: "lkt-table-page-buttons" }, zt = { key: 1 }, qt = { class: "switch-edition-mode" }, Qt = {
|
|
592
594
|
key: 0,
|
|
593
595
|
class: "lkt-table-page-buttons"
|
|
594
|
-
},
|
|
596
|
+
}, Xt = {
|
|
595
597
|
key: 1,
|
|
596
598
|
class: "lkt-table-page-filters"
|
|
597
|
-
},
|
|
599
|
+
}, Yt = ["data-sortable"], Zt = { key: 0 }, xt = {
|
|
598
600
|
key: 0,
|
|
599
601
|
"data-role": "drag-indicator"
|
|
600
|
-
},
|
|
602
|
+
}, el = { key: 1 }, tl = { key: 2 }, ll = {
|
|
601
603
|
key: 3,
|
|
602
604
|
class: "lkt-table-col-drop"
|
|
603
|
-
},
|
|
605
|
+
}, ol = ["id"], al = { class: "lkt-table-item" }, nl = {
|
|
604
606
|
key: 3,
|
|
605
607
|
class: "lkt-empty-table"
|
|
606
|
-
},
|
|
608
|
+
}, ul = {
|
|
607
609
|
key: 4,
|
|
608
610
|
class: "lkt-table-page-empty"
|
|
609
|
-
},
|
|
611
|
+
}, sl = {
|
|
610
612
|
key: 5,
|
|
611
613
|
class: "lkt-table-page-buttons lkt-table-page-buttons-bottom"
|
|
612
|
-
},
|
|
614
|
+
}, il = /* @__PURE__ */ q({
|
|
613
615
|
__name: "LktTable",
|
|
614
616
|
props: {
|
|
615
617
|
modelValue: { default: () => [] },
|
|
@@ -643,6 +645,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
643
645
|
saveText: { default: "Save" },
|
|
644
646
|
createText: { default: "Add item" },
|
|
645
647
|
createIcon: { default: "" },
|
|
648
|
+
createRoute: { default: "" },
|
|
646
649
|
dropText: { default: "Delete" },
|
|
647
650
|
dropIcon: { default: "" },
|
|
648
651
|
editModeText: { default: "Edit mode" },
|
|
@@ -656,15 +659,18 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
656
659
|
createEnabledValidator: { type: Function, default: void 0 },
|
|
657
660
|
newValueGenerator: { type: Function, default: void 0 }
|
|
658
661
|
},
|
|
659
|
-
emits: ["update:modelValue", "sort", "click", "save", "error", "before-save"],
|
|
662
|
+
emits: ["update:modelValue", "sort", "click", "save", "error", "before-save", "read-response"],
|
|
660
663
|
setup(l, { expose: t, emit: r }) {
|
|
661
|
-
const n = r, s =
|
|
664
|
+
const n = r, s = st(), o = l, h = {}, g = C(typeof o.sorter == "function" ? o.sorter : Ie), v = C(Dt(o.columns)), a = C("asc"), i = C(o.modelValue), _ = C(h), J = C(null), d = C(o.columns), L = C(o.page), S = C(!1), V = C(!1), p = C(o.perms), fe = C(null), Re = C({}), Q = C(new mt({ items: i.value }, o.dataStateConfig)), M = C(o.editMode), $e = (e) => {
|
|
662
665
|
Array.isArray(e) && (i.value = e), S.value = !1, V.value = !0, Q.value.store({ items: i.value }).turnStoredIntoOriginal();
|
|
663
|
-
},
|
|
666
|
+
}, Ae = (e) => {
|
|
664
667
|
p.value = e;
|
|
665
|
-
}, Oe = () =>
|
|
668
|
+
}, Oe = (e) => {
|
|
669
|
+
}, Fe = (e) => {
|
|
670
|
+
n("read-response", e);
|
|
671
|
+
}, Ne = () => de(() => S.value = !0), Ue = () => {
|
|
666
672
|
fe.value.doRefresh();
|
|
667
|
-
}, oe =
|
|
673
|
+
}, oe = dt(12), ue = f(() => {
|
|
668
674
|
if (!o.hideEmptyColumns) return [];
|
|
669
675
|
let e = [];
|
|
670
676
|
return d.value.forEach((c) => {
|
|
@@ -675,17 +681,17 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
675
681
|
D[k] && (T = !0);
|
|
676
682
|
}), T || e.push(k);
|
|
677
683
|
}), e;
|
|
678
|
-
}), ae = f(() => d.value.filter((e) => !e.hidden)), se = f(() => d.value.filter((e) => e.hidden)),
|
|
684
|
+
}), ae = f(() => d.value.filter((e) => !e.hidden)), se = f(() => d.value.filter((e) => e.hidden)), He = f(() => {
|
|
679
685
|
let e = ae.value.length + 1;
|
|
680
686
|
return o.sortable && ++e, e;
|
|
681
|
-
}),
|
|
687
|
+
}), Ke = f(() => d.value.filter((e) => e.isForRowKey)), pe = f(() => se.value.length > 0 && !o.sortable), Pe = f(() => d.value.map((e) => e.key)), ve = f(() => {
|
|
682
688
|
let e = [];
|
|
683
|
-
for (let c in s)
|
|
689
|
+
for (let c in s) Pe.value.indexOf(c) !== -1 && e.push(c);
|
|
684
690
|
return e;
|
|
685
|
-
}), he = f(() => o.hiddenSave || S.value || !o.saveResource ? !1 : M.value && Q.value.changed() ? !0 : M.value),
|
|
691
|
+
}), he = f(() => o.hiddenSave || S.value || !o.saveResource ? !1 : M.value && Q.value.changed() ? !0 : M.value), We = f(() => o.switchEditionEnabled ? !0 : he.value || M.value && o.canCreate), _e = f(() => o.saveDisabled || typeof o.saveValidator == "function" && !o.saveValidator(i.value) ? !1 : Q.value.changed()), je = f(() => i.value.length), Je = f(() => ({
|
|
686
692
|
items: i.value,
|
|
687
693
|
...o.saveResourceData
|
|
688
|
-
})),
|
|
694
|
+
})), Ge = f(() => o.titleTag === "" ? "h2" : o.titleTag), ze = f(() => o.wrapContentTag === "" ? "div" : o.wrapContentTag), ie = f(() => o.title.startsWith("__:") ? z(o.title.substring(3)) : o.title), qe = f(() => o.saveText.startsWith("__:") ? z(o.saveText.substring(3)) : o.saveText), Qe = f(() => o.editModeText.startsWith("__:") ? z(o.editModeText.substring(3)) : o.editModeText), ne = f(() => p.value.includes("create")), Xe = f(() => p.value.includes("read")), Ye = f(() => p.value.includes("update")), re = f(() => p.value.includes("drop")), Ze = (e) => {
|
|
689
695
|
let c = e.target;
|
|
690
696
|
if (typeof c.dataset.column > "u")
|
|
691
697
|
do
|
|
@@ -693,13 +699,13 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
693
699
|
while (typeof c.dataset.column > "u" && c.tagName !== "TABLE" && c.tagName !== "body");
|
|
694
700
|
if (c.tagName === "TD" && (c = c.parentNode, c = c.dataset.i, typeof c < "u"))
|
|
695
701
|
return i.value[c];
|
|
696
|
-
}, ye = (e) =>
|
|
702
|
+
}, ye = (e) => _.value["tr_" + e] === !0, ke = (e) => {
|
|
697
703
|
e && e.sortable && (i.value = i.value.sort((c, k) => g.value(c, k, e, a.value)), a.value = a.value === "asc" ? "desc" : "asc", v.value = e.key, n("sort", [v.value, a.value]));
|
|
698
704
|
}, be = (e, c) => {
|
|
699
705
|
n("click", e, c);
|
|
700
706
|
}, ge = (e, c) => {
|
|
701
707
|
let k = "tr_" + c.value.i;
|
|
702
|
-
|
|
708
|
+
_.value[k] = typeof _.value[k] > "u" ? !0 : !_.value[k];
|
|
703
709
|
}, Ce = () => {
|
|
704
710
|
d.value.forEach((e) => {
|
|
705
711
|
if (e.type === "select" && e.autoLoadSelectOptions) {
|
|
@@ -713,7 +719,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
713
719
|
}), e.setOptions(k);
|
|
714
720
|
}
|
|
715
721
|
});
|
|
716
|
-
},
|
|
722
|
+
}, xe = (e) => typeof o.checkValidDrag == "function" ? o.checkValidDrag(e) : !0, Se = (e) => typeof o.draggableChecker == "function" ? o.draggableChecker(e) : !0, Ve = () => {
|
|
717
723
|
if (typeof o.newValueGenerator == "function") {
|
|
718
724
|
let e = o.newValueGenerator();
|
|
719
725
|
if (typeof e == "object") {
|
|
@@ -722,11 +728,11 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
722
728
|
}
|
|
723
729
|
}
|
|
724
730
|
i.value.push({});
|
|
725
|
-
},
|
|
731
|
+
}, et = () => {
|
|
726
732
|
S.value = !0;
|
|
727
|
-
},
|
|
733
|
+
}, tt = () => {
|
|
728
734
|
S.value = !1;
|
|
729
|
-
},
|
|
735
|
+
}, lt = (e, c) => {
|
|
730
736
|
if (n("before-save"), o.saveResource && (S.value = !1, !c.success)) {
|
|
731
737
|
n("error", c.httpStatus);
|
|
732
738
|
return;
|
|
@@ -738,15 +744,15 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
738
744
|
for (; T--; ) e.push(void 0);
|
|
739
745
|
}
|
|
740
746
|
return e.splice(k, 0, e.splice(c, 1)[0]), e;
|
|
741
|
-
},
|
|
747
|
+
}, ot = (e) => {
|
|
742
748
|
De(i.value, e, e - 1);
|
|
743
|
-
},
|
|
749
|
+
}, at = (e) => {
|
|
744
750
|
De(i.value, e, e + 1);
|
|
745
751
|
}, we = (e) => {
|
|
746
752
|
i.value.splice(e, 1);
|
|
747
|
-
},
|
|
753
|
+
}, nt = () => {
|
|
748
754
|
let e = document.getElementById("lkt-table-body-" + oe);
|
|
749
|
-
|
|
755
|
+
Re.value = new ft(e, {
|
|
750
756
|
direction: "vertical",
|
|
751
757
|
handle: ".handle",
|
|
752
758
|
animation: 150,
|
|
@@ -755,33 +761,33 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
755
761
|
i.value.splice(k, 1, D[T]), i.value.splice(T, 1, D[k]);
|
|
756
762
|
},
|
|
757
763
|
onMove: function(c, k) {
|
|
758
|
-
return
|
|
764
|
+
return xe(c);
|
|
759
765
|
}
|
|
760
766
|
});
|
|
761
767
|
}, Te = (e, c, k = !1) => {
|
|
762
768
|
let T = [oe, "row", c];
|
|
763
|
-
return k && T.push("hidden"),
|
|
769
|
+
return k && T.push("hidden"), Ke.value.forEach((D) => {
|
|
764
770
|
let O = String(e[D.key]).toLowerCase();
|
|
765
|
-
O.length > 50 && (O = O.substring(0, 50)), O =
|
|
771
|
+
O.length > 50 && (O = O.substring(0, 50)), O = ct(O, " ", "-"), T.push(O);
|
|
766
772
|
}), T.join("-");
|
|
767
773
|
}, Be = f(() => typeof o.createEnabledValidator == "function" ? o.createEnabledValidator({ items: i.value }) : !0);
|
|
768
|
-
return
|
|
769
|
-
Ce(), ke(
|
|
770
|
-
|
|
774
|
+
return it(() => {
|
|
775
|
+
Ce(), ke(wt(o.columns, v.value)), Q.value.store({ items: i.value }).turnStoredIntoOriginal(), o.sortable && de(() => {
|
|
776
|
+
nt();
|
|
771
777
|
});
|
|
772
778
|
}), U(() => o.columns, (e) => d.value = e), U(() => o.modelValue, (e) => i.value = e), U(i, (e) => {
|
|
773
779
|
Ce(), Q.value.increment({ items: e }), n("update:modelValue", e);
|
|
774
780
|
}, { deep: !0 }), t({
|
|
775
|
-
getItemByEvent:
|
|
776
|
-
doRefresh:
|
|
781
|
+
getItemByEvent: Ze,
|
|
782
|
+
doRefresh: Ue
|
|
777
783
|
}), (e, c) => {
|
|
778
|
-
const k =
|
|
784
|
+
const k = R("lkt-button"), T = R("lkt-field-switch"), D = R("lkt-loader"), O = R("lkt-paginator");
|
|
779
785
|
return u(), m("section", {
|
|
780
786
|
class: "lkt-table-page",
|
|
781
787
|
id: "lkt-table-page-" + I(oe)
|
|
782
788
|
}, [
|
|
783
|
-
ie.value || I(s).title ? (u(), m("header",
|
|
784
|
-
ie.value ? (u(), b(Z(
|
|
789
|
+
ie.value || I(s).title ? (u(), m("header", Jt, [
|
|
790
|
+
ie.value ? (u(), b(Z(Ge.value), { key: 0 }, {
|
|
785
791
|
default: N(() => [
|
|
786
792
|
e.titleIcon ? (u(), m("i", {
|
|
787
793
|
key: 0,
|
|
@@ -793,11 +799,11 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
793
799
|
})) : y("", !0),
|
|
794
800
|
I(s).title ? F(e.$slots, "title", { key: 1 }) : y("", !0)
|
|
795
801
|
])) : y("", !0),
|
|
796
|
-
(u(), b(Z(
|
|
802
|
+
(u(), b(Z(ze.value), {
|
|
797
803
|
class: te(["lkt-table-page-content-wrapper", e.wrapContentClass])
|
|
798
804
|
}, {
|
|
799
805
|
default: N(() => [
|
|
800
|
-
x(E("div",
|
|
806
|
+
x(E("div", Gt, [
|
|
801
807
|
x(X(k, {
|
|
802
808
|
ref: "saveButton",
|
|
803
809
|
palette: "success",
|
|
@@ -805,10 +811,10 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
805
811
|
"confirm-modal": e.saveConfirm,
|
|
806
812
|
"confirm-data": e.confirmData,
|
|
807
813
|
resource: e.saveResource,
|
|
808
|
-
"resource-data":
|
|
809
|
-
onLoading:
|
|
810
|
-
onLoaded:
|
|
811
|
-
onClick:
|
|
814
|
+
"resource-data": Je.value,
|
|
815
|
+
onLoading: et,
|
|
816
|
+
onLoaded: tt,
|
|
817
|
+
onClick: lt
|
|
812
818
|
}, {
|
|
813
819
|
default: N(() => [
|
|
814
820
|
I(s)["button-save"] ? F(e.$slots, "button-save", {
|
|
@@ -816,7 +822,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
816
822
|
items: i.value,
|
|
817
823
|
editMode: e.editMode,
|
|
818
824
|
canUpdate: !e.saveDisabled
|
|
819
|
-
}) : (u(), m("span",
|
|
825
|
+
}) : (u(), m("span", zt, j(qe.value), 1))
|
|
820
826
|
]),
|
|
821
827
|
_: 3
|
|
822
828
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
|
|
@@ -827,24 +833,25 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
827
833
|
disabled: !Be.value,
|
|
828
834
|
text: e.createText,
|
|
829
835
|
icon: e.createIcon,
|
|
836
|
+
to: e.createRoute,
|
|
830
837
|
onClick: Ve
|
|
831
|
-
}, null, 8, ["disabled", "text", "icon"])) : y("", !0),
|
|
832
|
-
E("div",
|
|
838
|
+
}, null, 8, ["disabled", "text", "icon", "to"])) : y("", !0),
|
|
839
|
+
E("div", qt, [
|
|
833
840
|
x(X(T, {
|
|
834
841
|
modelValue: M.value,
|
|
835
842
|
"onUpdate:modelValue": c[0] || (c[0] = (w) => M.value = w),
|
|
836
|
-
label:
|
|
843
|
+
label: Qe.value
|
|
837
844
|
}, null, 8, ["modelValue", "label"]), [
|
|
838
845
|
[ee, e.switchEditionEnabled]
|
|
839
846
|
])
|
|
840
847
|
])
|
|
841
848
|
], 512), [
|
|
842
|
-
[ee,
|
|
849
|
+
[ee, We.value]
|
|
843
850
|
]),
|
|
844
|
-
I(s).buttons ? (u(), m("div",
|
|
851
|
+
I(s).buttons ? (u(), m("div", Qt, [
|
|
845
852
|
F(e.$slots, "buttons")
|
|
846
853
|
])) : y("", !0),
|
|
847
|
-
V.value && I(s).filters ? (u(), m("div",
|
|
854
|
+
V.value && I(s).filters ? (u(), m("div", Xt, [
|
|
848
855
|
F(e.$slots, "filters", {
|
|
849
856
|
items: i.value,
|
|
850
857
|
isLoading: S.value
|
|
@@ -859,25 +866,25 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
859
866
|
key: 1,
|
|
860
867
|
class: te(["lkt-table-items-container", e.itemsContainerClass])
|
|
861
868
|
}, [
|
|
862
|
-
(u(!0), m(
|
|
869
|
+
(u(!0), m($, null, W(i.value, (w, B) => (u(), m("div", al, [
|
|
863
870
|
F(e.$slots, "item", {
|
|
864
871
|
item: w,
|
|
865
872
|
index: B,
|
|
866
873
|
canCreate: ne.value,
|
|
867
|
-
canRead:
|
|
868
|
-
canUpdate:
|
|
874
|
+
canRead: Xe.value,
|
|
875
|
+
canUpdate: Ye.value,
|
|
869
876
|
canDrop: re.value,
|
|
870
877
|
isLoading: S.value,
|
|
871
878
|
doDrop: () => we(B)
|
|
872
879
|
})
|
|
873
880
|
]))), 256))
|
|
874
|
-
], 2)) : (u(), m("table",
|
|
881
|
+
], 2)) : (u(), m("table", Zt, [
|
|
875
882
|
E("thead", null, [
|
|
876
883
|
E("tr", null, [
|
|
877
|
-
e.sortable && M.value ? (u(), m("th",
|
|
878
|
-
e.addNavigation && M.value ? (u(), m("th",
|
|
879
|
-
pe.value ? (u(), m("th",
|
|
880
|
-
(u(!0), m(
|
|
884
|
+
e.sortable && M.value ? (u(), m("th", xt)) : y("", !0),
|
|
885
|
+
e.addNavigation && M.value ? (u(), m("th", el)) : y("", !0),
|
|
886
|
+
pe.value ? (u(), m("th", tl)) : y("", !0),
|
|
887
|
+
(u(!0), m($, null, W(ae.value, (w) => (u(), m($, null, [
|
|
881
888
|
ue.value.indexOf(w.key) === -1 ? (u(), b(_t, {
|
|
882
889
|
key: 0,
|
|
883
890
|
column: w,
|
|
@@ -888,16 +895,16 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
888
895
|
onClick: (B) => ke(w)
|
|
889
896
|
}, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : y("", !0)
|
|
890
897
|
], 64))), 256)),
|
|
891
|
-
e.canDrop && re.value && M.value ? (u(), m("th",
|
|
898
|
+
e.canDrop && re.value && M.value ? (u(), m("th", ll)) : y("", !0)
|
|
892
899
|
])
|
|
893
900
|
]),
|
|
894
901
|
E("tbody", {
|
|
895
902
|
ref: (w) => J.value = w,
|
|
896
903
|
id: "lkt-table-body-" + I(oe)
|
|
897
904
|
}, [
|
|
898
|
-
(u(!0), m(
|
|
905
|
+
(u(!0), m($, null, W(i.value, (w, B) => (u(), b(Ot, {
|
|
899
906
|
modelValue: i.value[B],
|
|
900
|
-
"onUpdate:modelValue": (
|
|
907
|
+
"onUpdate:modelValue": (P) => i.value[B] = P,
|
|
901
908
|
key: Te(w, B),
|
|
902
909
|
i: B,
|
|
903
910
|
"display-hidden-columns-indicator": pe.value,
|
|
@@ -907,7 +914,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
907
914
|
"empty-columns": ue.value,
|
|
908
915
|
"add-navigation": e.addNavigation,
|
|
909
916
|
"hidden-is-visible": ye(B),
|
|
910
|
-
"latest-row": B + 1 ===
|
|
917
|
+
"latest-row": B + 1 === je.value,
|
|
911
918
|
"can-drop": e.canDrop && re.value && M.value,
|
|
912
919
|
"drop-confirm": e.dropConfirm,
|
|
913
920
|
"drop-resource": e.dropResource,
|
|
@@ -916,14 +923,14 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
916
923
|
"edit-mode-enabled": M.value,
|
|
917
924
|
onClick: be,
|
|
918
925
|
onShow: ge,
|
|
919
|
-
onItemUp:
|
|
920
|
-
onItemDown:
|
|
926
|
+
onItemUp: ot,
|
|
927
|
+
onItemDown: at,
|
|
921
928
|
onItemDrop: we
|
|
922
929
|
}, Ee({ _: 2 }, [
|
|
923
|
-
|
|
924
|
-
name:
|
|
930
|
+
W(ve.value, (P) => ({
|
|
931
|
+
name: P,
|
|
925
932
|
fn: N((G) => [
|
|
926
|
-
F(e.$slots,
|
|
933
|
+
F(e.$slots, P, {
|
|
927
934
|
item: G.item,
|
|
928
935
|
value: G.value,
|
|
929
936
|
column: G.column
|
|
@@ -931,13 +938,13 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
931
938
|
])
|
|
932
939
|
}))
|
|
933
940
|
]), 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", "edit-mode-enabled"]))), 128)),
|
|
934
|
-
se.value.length > 0 ? (u(!0), m(
|
|
941
|
+
se.value.length > 0 ? (u(!0), m($, { key: 0 }, W(i.value, (w, B) => (u(), b(Pt, {
|
|
935
942
|
modelValue: i.value[B],
|
|
936
|
-
"onUpdate:modelValue": (
|
|
943
|
+
"onUpdate:modelValue": (P) => i.value[B] = P,
|
|
937
944
|
key: Te(w, B, !0),
|
|
938
945
|
i: B,
|
|
939
946
|
"hidden-columns": se.value,
|
|
940
|
-
"hidden-columns-col-span":
|
|
947
|
+
"hidden-columns-col-span": He.value,
|
|
941
948
|
"is-draggable": Se(w),
|
|
942
949
|
sortable: e.sortable,
|
|
943
950
|
"visible-columns": ae.value,
|
|
@@ -946,10 +953,10 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
946
953
|
onClick: be,
|
|
947
954
|
onShow: ge
|
|
948
955
|
}, Ee({ _: 2 }, [
|
|
949
|
-
|
|
950
|
-
name:
|
|
956
|
+
W(ve.value, (P) => ({
|
|
957
|
+
name: P,
|
|
951
958
|
fn: N((G) => [
|
|
952
|
-
F(e.$slots,
|
|
959
|
+
F(e.$slots, P, {
|
|
953
960
|
item: G.item,
|
|
954
961
|
value: G.value,
|
|
955
962
|
column: G.column
|
|
@@ -957,23 +964,24 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
957
964
|
])
|
|
958
965
|
}))
|
|
959
966
|
]), 1032, ["modelValue", "onUpdate:modelValue", "i", "hidden-columns", "hidden-columns-col-span", "is-draggable", "sortable", "visible-columns", "empty-columns", "hidden-is-visible"]))), 128)) : y("", !0)
|
|
960
|
-
], 8,
|
|
967
|
+
], 8, ol)
|
|
961
968
|
]))
|
|
962
|
-
], 8,
|
|
969
|
+
], 8, Yt), [
|
|
963
970
|
[ee, !S.value && i.value.length > 0]
|
|
964
971
|
]),
|
|
965
|
-
e.$slots["no-items"] ? (u(), m("div",
|
|
972
|
+
e.$slots["no-items"] ? (u(), m("div", nl, [
|
|
966
973
|
F(e.$slots, "no-items")
|
|
967
974
|
])) : y("", !0),
|
|
968
|
-
!S.value && i.value.length === 0 ? (u(), m("div",
|
|
969
|
-
e.canCreate && ne.value && M.value ? (u(), m("div",
|
|
975
|
+
!S.value && i.value.length === 0 ? (u(), m("div", ul, j(e.noResultsText), 1)) : y("", !0),
|
|
976
|
+
e.canCreate && ne.value && M.value ? (u(), m("div", sl, [
|
|
970
977
|
e.canCreate && ne.value && M.value ? (u(), b(Le, {
|
|
971
978
|
key: 0,
|
|
972
979
|
disabled: !Be.value,
|
|
973
980
|
text: e.createText,
|
|
974
981
|
icon: e.createIcon,
|
|
982
|
+
to: e.createRoute,
|
|
975
983
|
onClick: Ve
|
|
976
|
-
}, null, 8, ["disabled", "text", "icon"])) : y("", !0)
|
|
984
|
+
}, null, 8, ["disabled", "text", "icon", "to"])) : y("", !0)
|
|
977
985
|
])) : y("", !0),
|
|
978
986
|
X(O, {
|
|
979
987
|
ref_key: "paginator",
|
|
@@ -982,35 +990,37 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
982
990
|
"onUpdate:modelValue": c[1] || (c[1] = (w) => L.value = w),
|
|
983
991
|
resource: e.resource,
|
|
984
992
|
filters: e.filters,
|
|
985
|
-
onResults:
|
|
986
|
-
onLoading:
|
|
987
|
-
onPerms:
|
|
993
|
+
onResults: $e,
|
|
994
|
+
onLoading: Ne,
|
|
995
|
+
onPerms: Ae,
|
|
996
|
+
onCustom: Oe,
|
|
997
|
+
onResponse: Fe
|
|
988
998
|
}, null, 8, ["modelValue", "resource", "filters"])
|
|
989
999
|
]),
|
|
990
1000
|
_: 3
|
|
991
1001
|
}, 8, ["class"]))
|
|
992
|
-
], 8,
|
|
1002
|
+
], 8, jt);
|
|
993
1003
|
};
|
|
994
1004
|
}
|
|
995
|
-
}),
|
|
1005
|
+
}), Al = {
|
|
996
1006
|
install: (l) => {
|
|
997
|
-
l.component("lkt-loader") === void 0 && l.use(
|
|
1007
|
+
l.component("lkt-loader") === void 0 && l.use(pt), l.component("lkt-button") === void 0 && l.use(vt), l.component("lkt-paginator") === void 0 && l.use(ht), l.component("lkt-field-text") === void 0 && l.use(yt), l.component("lkt-field-textarea") === void 0 && l.use(kt), l.component("lkt-field-select") === void 0 && l.use(bt), l.component("lkt-field-switch") === void 0 && l.use(gt), l.component("lkt-field-file") === void 0 && l.use(Ct), l.component("lkt-table") === void 0 && l.component("lkt-table", il);
|
|
998
1008
|
}
|
|
999
|
-
},
|
|
1009
|
+
}, Ol = (l) => (A.navButtonSlot = l, !0), Fl = (l) => (A.dropButtonSlot = l, !0), Nl = (l) => (A.createButtonSlot = l, !0);
|
|
1000
1010
|
export {
|
|
1001
1011
|
K as LktTableColumn,
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1012
|
+
Tl as createActionColumn,
|
|
1013
|
+
Ll as createCheckColumn,
|
|
1014
|
+
Dl as createColumn,
|
|
1015
|
+
El as createEmailColumn,
|
|
1016
|
+
$l as createHiddenColumn,
|
|
1017
|
+
wl as createLinkColumn,
|
|
1018
|
+
Rl as createSelectColumn,
|
|
1019
|
+
Ml as createSwitchColumn,
|
|
1020
|
+
Il as createTelColumn,
|
|
1021
|
+
Bl as createTextColumn,
|
|
1022
|
+
Al as default,
|
|
1023
|
+
Nl as setTableCreateButtonSlot,
|
|
1024
|
+
Fl as setTableDropButtonSlot,
|
|
1025
|
+
Ol as setTableNavButtonSlot
|
|
1016
1026
|
};
|
package/package.json
CHANGED
|
@@ -9,10 +9,12 @@ const props = withDefaults(defineProps<{
|
|
|
9
9
|
disabled: boolean
|
|
10
10
|
text: string
|
|
11
11
|
icon: string
|
|
12
|
+
to: string
|
|
12
13
|
}>(), {
|
|
13
14
|
disabled: false,
|
|
14
15
|
text: '',
|
|
15
16
|
icon: '',
|
|
17
|
+
to: '',
|
|
16
18
|
});
|
|
17
19
|
|
|
18
20
|
const hasCreateButtonSlot = computed(() => {
|
|
@@ -35,6 +37,7 @@ const hasCreateButtonSlot = computed(() => {
|
|
|
35
37
|
:disabled="disabled"
|
|
36
38
|
:icon="hasCreateButtonSlot ? '' : icon"
|
|
37
39
|
:text="hasCreateButtonSlot ? '' : computedText"
|
|
40
|
+
:on-click-to="to"
|
|
38
41
|
@click="emit('click')">
|
|
39
42
|
<template v-if="hasCreateButtonSlot">
|
|
40
43
|
<component
|
|
@@ -15,7 +15,7 @@ import Sortable from 'sortablejs';
|
|
|
15
15
|
import TableHeader from "../components/TableHeader.vue";
|
|
16
16
|
import {__} from "lkt-i18n";
|
|
17
17
|
|
|
18
|
-
const emit = defineEmits(['update:modelValue', 'sort', 'click', 'save', 'error', 'before-save']);
|
|
18
|
+
const emit = defineEmits(['update:modelValue', 'sort', 'click', 'save', 'error', 'before-save', 'read-response']);
|
|
19
19
|
|
|
20
20
|
const slots = useSlots();
|
|
21
21
|
|
|
@@ -53,6 +53,7 @@ const props = withDefaults(defineProps<{
|
|
|
53
53
|
saveText?: string
|
|
54
54
|
createText?: string
|
|
55
55
|
createIcon?: string
|
|
56
|
+
createRoute?: string
|
|
56
57
|
dropText?: string
|
|
57
58
|
dropIcon?: string
|
|
58
59
|
editModeText?: string
|
|
@@ -101,6 +102,7 @@ const props = withDefaults(defineProps<{
|
|
|
101
102
|
dropIcon: '',
|
|
102
103
|
createText: 'Add item',
|
|
103
104
|
createIcon: '',
|
|
105
|
+
createRoute: '',
|
|
104
106
|
editModeText: 'Edit mode',
|
|
105
107
|
switchEditionEnabled: false,
|
|
106
108
|
canCreate: false,
|
|
@@ -143,6 +145,12 @@ const onResults = (r: any) => {
|
|
|
143
145
|
onPerms = (r: string[]) => {
|
|
144
146
|
perms.value = r;
|
|
145
147
|
},
|
|
148
|
+
onCustomReceived = (r: LktObject) => {
|
|
149
|
+
// perms.value = r;
|
|
150
|
+
},
|
|
151
|
+
onPaginatorResponse = (r: HTTPResponse) => {
|
|
152
|
+
emit('read-response', r);
|
|
153
|
+
},
|
|
146
154
|
onLoading = () => nextTick(() => loading.value = true),
|
|
147
155
|
doRefresh = () => {
|
|
148
156
|
//@ts-ignore
|
|
@@ -488,6 +496,7 @@ defineExpose({
|
|
|
488
496
|
:disabled="!createEnabled"
|
|
489
497
|
:text="createText"
|
|
490
498
|
:icon="createIcon"
|
|
499
|
+
:to="createRoute"
|
|
491
500
|
@click="onClickAddItem"
|
|
492
501
|
/>
|
|
493
502
|
|
|
@@ -634,6 +643,7 @@ defineExpose({
|
|
|
634
643
|
:disabled="!createEnabled"
|
|
635
644
|
:text="createText"
|
|
636
645
|
:icon="createIcon"
|
|
646
|
+
:to="createRoute"
|
|
637
647
|
@click="onClickAddItem"
|
|
638
648
|
/>
|
|
639
649
|
</div>
|
|
@@ -646,6 +656,8 @@ defineExpose({
|
|
|
646
656
|
v-on:results="onResults"
|
|
647
657
|
v-on:loading="onLoading"
|
|
648
658
|
v-on:perms="onPerms"
|
|
659
|
+
v-on:custom="onCustomReceived"
|
|
660
|
+
v-on:response="onPaginatorResponse"
|
|
649
661
|
/>
|
|
650
662
|
|
|
651
663
|
</component>
|