lkt-table 1.2.9 → 1.2.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 +14 -14
- package/dist/build.js +196 -191
- package/package.json +1 -1
- package/src/lib-components/LktTable.vue +10 -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 $l(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, Rl as default, Ol as setTableCreateButtonSlot, Al as setTableDropButtonSlot, $l 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
|
|
2
|
-
import { httpCall as
|
|
1
|
+
import { reactive as H, defineComponent as q, ref as C, watch as A, nextTick as de, computed as f, resolveComponent as R, openBlock as u, createBlock as b, withCtx as U, createTextVNode as le, toDisplayString as j, unref as L, 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 N, 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];
|
|
@@ -212,30 +212,30 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
212
212
|
emits: ["update:modelValue"],
|
|
213
213
|
setup(l, { emit: t }) {
|
|
214
214
|
const r = t, n = l, s = C(n.modelValue), o = C(s.value[n.column.key]), h = C(null), g = C(n.column.showLoading());
|
|
215
|
-
|
|
215
|
+
A(o, (a) => {
|
|
216
216
|
const i = JSON.parse(JSON.stringify(s.value));
|
|
217
217
|
i[n.column.key] = a, r("update:modelValue", i);
|
|
218
|
-
}),
|
|
218
|
+
}), A(() => n.modelValue, (a) => {
|
|
219
219
|
s.value = a, o.value = s.value[n.column.key];
|
|
220
|
-
}),
|
|
220
|
+
}), A(() => n.column, () => {
|
|
221
221
|
n.column.resourceLoaded && de(() => g.value = !1);
|
|
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 _ = R("lkt-anchor"), J = R("lkt-field-text"), d = R("lkt-field-switch"),
|
|
225
|
+
const _ = R("lkt-anchor"), J = R("lkt-field-text"), d = R("lkt-field-switch"), M = R("lkt-field-file"), S = R("lkt-loader"), V = R("lkt-field-select");
|
|
226
226
|
return a.column.type === "link" ? (u(), b(_, {
|
|
227
227
|
key: 0,
|
|
228
228
|
to: a.column.getHref(s.value)
|
|
229
229
|
}, {
|
|
230
|
-
default:
|
|
231
|
-
le(j(
|
|
230
|
+
default: U(() => [
|
|
231
|
+
le(j(L(Y)(a.column, s.value, a.i)), 1)
|
|
232
232
|
]),
|
|
233
233
|
_: 1
|
|
234
234
|
}, 8, ["to"])) : a.column.type === "action" ? (u(), m("a", {
|
|
235
235
|
key: 1,
|
|
236
236
|
href: "#",
|
|
237
237
|
onClick: i[0] || (i[0] = (p) => a.column.doAction(s.value))
|
|
238
|
-
}, j(
|
|
238
|
+
}, j(L(Y)(a.column, s.value, a.i)), 1)) : a.column.type === "text" ? (u(), b(J, {
|
|
239
239
|
key: 2,
|
|
240
240
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
241
241
|
ref: (p) => h.value = p,
|
|
@@ -277,7 +277,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
277
277
|
ref: (p) => h.value = p,
|
|
278
278
|
modelValue: o.value,
|
|
279
279
|
"onUpdate:modelValue": i[5] || (i[5] = (p) => o.value = p)
|
|
280
|
-
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "file" ? (u(), b(
|
|
280
|
+
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "file" ? (u(), b(M, {
|
|
281
281
|
key: 7,
|
|
282
282
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
283
283
|
ref: (p) => h.value = p,
|
|
@@ -301,15 +301,15 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
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
303
|
], 64)) : (u(), m($, { key: 9 }, [
|
|
304
|
-
le(j(
|
|
304
|
+
le(j(L(Y)(a.column, s.value, a.i, a.columns)), 1)
|
|
305
305
|
], 64));
|
|
306
306
|
};
|
|
307
307
|
}
|
|
308
|
-
}),
|
|
308
|
+
}), O = {
|
|
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,7 +321,7 @@ 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(() => O.dropButtonSlot !== ""), o = f(() => O.dropButtonSlot), h = f(() => n.text.startsWith("__:") ? z(n.text.substring(3)) : n.text);
|
|
325
325
|
return (g, v) => {
|
|
326
326
|
const a = R("lkt-button");
|
|
327
327
|
return u(), b(a, {
|
|
@@ -332,25 +332,25 @@ 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
|
-
default:
|
|
337
|
+
default: U(() => [
|
|
338
338
|
s.value ? (u(), b(Z(o.value), { key: 0 })) : y("", !0)
|
|
339
339
|
]),
|
|
340
340
|
_: 1
|
|
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: () => ({}) },
|
|
@@ -372,15 +372,15 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
372
372
|
},
|
|
373
373
|
emits: ["update:modelValue", "click", "show", "item-up", "item-down", "item-drop"],
|
|
374
374
|
setup(l, { emit: t }) {
|
|
375
|
-
const r = t, n = l, s = C(n.modelValue), o = (d,
|
|
376
|
-
r("click", d, ce("", { item:
|
|
377
|
-
}, h = (d,
|
|
378
|
-
r("show", d, ce("", { i:
|
|
375
|
+
const r = t, n = l, s = C(n.modelValue), o = (d, M, S) => {
|
|
376
|
+
r("click", d, ce("", { item: M, column: S }));
|
|
377
|
+
}, h = (d, M) => {
|
|
378
|
+
r("show", d, ce("", { i: M }));
|
|
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(() => O.navButtonSlot !== ""), a = f(() => O.navButtonSlot);
|
|
383
|
+
f(() => O.dropButtonSlot !== ""), f(() => O.dropButtonSlot);
|
|
384
384
|
const i = () => {
|
|
385
385
|
r("item-up", n.i);
|
|
386
386
|
}, _ = () => {
|
|
@@ -388,9 +388,9 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
388
388
|
}, J = () => {
|
|
389
389
|
r("item-drop", n.i);
|
|
390
390
|
};
|
|
391
|
-
return
|
|
391
|
+
return A(() => n.modelValue, (d) => s.value = d), A(s, (d) => {
|
|
392
392
|
r("update:modelValue", d, n.i);
|
|
393
|
-
}, { deep: !0 }), (d,
|
|
393
|
+
}, { deep: !0 }), (d, M) => {
|
|
394
394
|
const S = R("lkt-button");
|
|
395
395
|
return u(), m("tr", {
|
|
396
396
|
"data-i": d.i,
|
|
@@ -400,20 +400,20 @@ 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,
|
|
409
409
|
onClick: i
|
|
410
410
|
}, {
|
|
411
|
-
default:
|
|
411
|
+
default: U(() => [
|
|
412
412
|
v.value ? (u(), b(Z(a.value), {
|
|
413
413
|
key: 0,
|
|
414
414
|
direction: "up"
|
|
415
415
|
})) : (u(), m($, { key: 1 }, [
|
|
416
|
-
|
|
416
|
+
Mt,
|
|
417
417
|
le(" UP ")
|
|
418
418
|
], 64))
|
|
419
419
|
]),
|
|
@@ -424,12 +424,12 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
424
424
|
disabled: d.latestRow,
|
|
425
425
|
onClick: _
|
|
426
426
|
}, {
|
|
427
|
-
default:
|
|
427
|
+
default: U(() => [
|
|
428
428
|
v.value ? (u(), b(Z(a.value), {
|
|
429
429
|
key: 0,
|
|
430
430
|
direction: "down"
|
|
431
431
|
})) : (u(), m($, { key: 1 }, [
|
|
432
|
-
|
|
432
|
+
Rt,
|
|
433
433
|
le(" DOWN ")
|
|
434
434
|
], 64))
|
|
435
435
|
]),
|
|
@@ -439,19 +439,19 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
439
439
|
])) : y("", !0),
|
|
440
440
|
d.displayHiddenColumnsIndicator ? (u(), m("td", {
|
|
441
441
|
key: 3,
|
|
442
|
-
onClick:
|
|
442
|
+
onClick: M[0] || (M[0] = (V) => h(V, d.i)),
|
|
443
443
|
"data-role": "show-more",
|
|
444
444
|
class: te(d.hiddenIsVisible ? "state-open" : "")
|
|
445
445
|
}, null, 2)) : y("", !0),
|
|
446
446
|
(u(!0), m($, null, W(d.visibleColumns, (V) => (u(), m($, null, [
|
|
447
|
-
|
|
447
|
+
L(Vt)(V, d.emptyColumns, s.value) ? (u(), m("td", {
|
|
448
448
|
key: 0,
|
|
449
449
|
"data-column": V.key,
|
|
450
|
-
colspan:
|
|
451
|
-
title:
|
|
450
|
+
colspan: L(me)(V, s.value),
|
|
451
|
+
title: L(Y)(V, s.value, d.i, d.visibleColumns),
|
|
452
452
|
onClick: (p) => o(p, s.value, V)
|
|
453
453
|
}, [
|
|
454
|
-
d.$slots[V.key] ?
|
|
454
|
+
d.$slots[V.key] ? N(d.$slots, V.key, {
|
|
455
455
|
key: 0,
|
|
456
456
|
value: s.value[V.key],
|
|
457
457
|
item: s.value,
|
|
@@ -460,16 +460,16 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
460
460
|
}) : s.value ? (u(), b(Me, {
|
|
461
461
|
key: 1,
|
|
462
462
|
modelValue: s.value,
|
|
463
|
-
"onUpdate:modelValue":
|
|
463
|
+
"onUpdate:modelValue": M[1] || (M[1] = (p) => s.value = p),
|
|
464
464
|
column: V,
|
|
465
465
|
columns: d.visibleColumns,
|
|
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,7 +499,7 @@ 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
|
|
502
|
+
return A(() => n.modelValue, (h) => s.value = h), A(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, [
|
|
@@ -507,15 +507,15 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
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
513
|
(u(!0), m($, null, W(h.hiddenColumns, (v, a) => (u(), m("td", {
|
|
514
514
|
"data-column": v.key,
|
|
515
|
-
title:
|
|
515
|
+
title: L(Y)(v, s.value, a, h.hiddenColumns),
|
|
516
516
|
onClick: (i) => o(i, s.value, v)
|
|
517
517
|
}, [
|
|
518
|
-
h.$slots[v.key] ?
|
|
518
|
+
h.$slots[v.key] ? N(h.$slots, v.key, {
|
|
519
519
|
key: 0,
|
|
520
520
|
value: s.value[v.key],
|
|
521
521
|
item: s.value,
|
|
@@ -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
|
]);
|
|
@@ -547,7 +547,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
547
547
|
},
|
|
548
548
|
emits: ["click"],
|
|
549
549
|
setup(l, { emit: t }) {
|
|
550
|
-
const r = t, n = l, s = f(() =>
|
|
550
|
+
const r = t, n = l, s = f(() => O.createButtonSlot !== ""), o = f(() => O.createButtonSlot), h = f(() => n.text.startsWith("__:") ? z(n.text.substring(3)) : n.text);
|
|
551
551
|
return (g, v) => {
|
|
552
552
|
const a = R("lkt-button");
|
|
553
553
|
return u(), b(a, {
|
|
@@ -558,14 +558,14 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
558
558
|
"on-click-to": g.to,
|
|
559
559
|
onClick: v[0] || (v[0] = (i) => r("click"))
|
|
560
560
|
}, {
|
|
561
|
-
default:
|
|
561
|
+
default: U(() => [
|
|
562
562
|
s.value ? (u(), b(Z(o.value), { key: 0 })) : y("", !0)
|
|
563
563
|
]),
|
|
564
564
|
_: 1
|
|
565
565
|
}, 8, ["disabled", "icon", "text", "on-click-to"]);
|
|
566
566
|
};
|
|
567
567
|
}
|
|
568
|
-
}),
|
|
568
|
+
}), Wt = ["data-column", "data-sortable", "data-sort", "colspan", "title"], _t = /* @__PURE__ */ q({
|
|
569
569
|
__name: "TableHeader",
|
|
570
570
|
props: {
|
|
571
571
|
column: { default: () => ({}) },
|
|
@@ -576,7 +576,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
576
576
|
},
|
|
577
577
|
emits: ["click"],
|
|
578
578
|
setup(l, { emit: t }) {
|
|
579
|
-
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 = () => {
|
|
580
580
|
r("click", n.column);
|
|
581
581
|
};
|
|
582
582
|
return (a, i) => (u(), m("th", {
|
|
@@ -588,30 +588,30 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
588
588
|
onClick: v
|
|
589
589
|
}, [
|
|
590
590
|
E("div", null, j(g.value), 1)
|
|
591
|
-
], 8,
|
|
591
|
+
], 8, Wt));
|
|
592
592
|
}
|
|
593
|
-
}),
|
|
593
|
+
}), jt = ["id"], Jt = { key: 0 }, Gt = { class: "lkt-table-page-buttons" }, zt = { key: 1 }, qt = { class: "switch-edition-mode" }, Qt = {
|
|
594
594
|
key: 0,
|
|
595
595
|
class: "lkt-table-page-buttons"
|
|
596
|
-
},
|
|
596
|
+
}, Xt = {
|
|
597
597
|
key: 1,
|
|
598
598
|
class: "lkt-table-page-filters"
|
|
599
|
-
},
|
|
599
|
+
}, Yt = ["data-sortable"], Zt = { key: 0 }, xt = {
|
|
600
600
|
key: 0,
|
|
601
601
|
"data-role": "drag-indicator"
|
|
602
|
-
},
|
|
602
|
+
}, el = { key: 1 }, tl = { key: 2 }, ll = {
|
|
603
603
|
key: 3,
|
|
604
604
|
class: "lkt-table-col-drop"
|
|
605
|
-
},
|
|
605
|
+
}, ol = ["id"], al = { class: "lkt-table-item" }, nl = {
|
|
606
606
|
key: 3,
|
|
607
607
|
class: "lkt-empty-table"
|
|
608
|
-
},
|
|
608
|
+
}, ul = {
|
|
609
609
|
key: 4,
|
|
610
610
|
class: "lkt-table-page-empty"
|
|
611
|
-
},
|
|
611
|
+
}, sl = {
|
|
612
612
|
key: 5,
|
|
613
613
|
class: "lkt-table-page-buttons lkt-table-page-buttons-bottom"
|
|
614
|
-
},
|
|
614
|
+
}, il = /* @__PURE__ */ q({
|
|
615
615
|
__name: "LktTable",
|
|
616
616
|
props: {
|
|
617
617
|
modelValue: { default: () => [] },
|
|
@@ -659,15 +659,18 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
659
659
|
createEnabledValidator: { type: Function, default: void 0 },
|
|
660
660
|
newValueGenerator: { type: Function, default: void 0 }
|
|
661
661
|
},
|
|
662
|
-
emits: ["update:modelValue", "sort", "click", "save", "error", "before-save"],
|
|
662
|
+
emits: ["update:modelValue", "sort", "click", "save", "error", "before-save", "read-response"],
|
|
663
663
|
setup(l, { expose: t, emit: r }) {
|
|
664
|
-
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), M = 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)), I = C(o.editMode), $e = (e) => {
|
|
665
665
|
Array.isArray(e) && (i.value = e), S.value = !1, V.value = !0, Q.value.store({ items: i.value }).turnStoredIntoOriginal();
|
|
666
666
|
}, Ae = (e) => {
|
|
667
667
|
p.value = e;
|
|
668
|
-
}, Oe = () =>
|
|
668
|
+
}, Oe = (e) => {
|
|
669
|
+
}, Fe = (e) => {
|
|
670
|
+
n("read-response", e);
|
|
671
|
+
}, Ne = () => de(() => S.value = !0), Ue = () => {
|
|
669
672
|
fe.value.doRefresh();
|
|
670
|
-
}, oe =
|
|
673
|
+
}, oe = dt(12), ue = f(() => {
|
|
671
674
|
if (!o.hideEmptyColumns) return [];
|
|
672
675
|
let e = [];
|
|
673
676
|
return d.value.forEach((c) => {
|
|
@@ -678,17 +681,17 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
678
681
|
D[k] && (T = !0);
|
|
679
682
|
}), T || e.push(k);
|
|
680
683
|
}), e;
|
|
681
|
-
}), 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(() => {
|
|
682
685
|
let e = ae.value.length + 1;
|
|
683
686
|
return o.sortable && ++e, e;
|
|
684
|
-
}),
|
|
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(() => {
|
|
685
688
|
let e = [];
|
|
686
|
-
for (let c in s)
|
|
689
|
+
for (let c in s) Pe.value.indexOf(c) !== -1 && e.push(c);
|
|
687
690
|
return e;
|
|
688
|
-
}), he = f(() => o.hiddenSave || S.value || !o.saveResource ? !1 :
|
|
691
|
+
}), he = f(() => o.hiddenSave || S.value || !o.saveResource ? !1 : I.value && Q.value.changed() ? !0 : I.value), We = f(() => o.switchEditionEnabled ? !0 : he.value || I.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(() => ({
|
|
689
692
|
items: i.value,
|
|
690
693
|
...o.saveResourceData
|
|
691
|
-
})),
|
|
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) => {
|
|
692
695
|
let c = e.target;
|
|
693
696
|
if (typeof c.dataset.column > "u")
|
|
694
697
|
do
|
|
@@ -708,7 +711,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
708
711
|
if (e.type === "select" && e.autoLoadSelectOptions) {
|
|
709
712
|
let c = e.autoLoadSelectOptionsKey !== "" ? e.autoLoadSelectOptionsKey : e.key, k = [];
|
|
710
713
|
i.value.forEach((D) => {
|
|
711
|
-
Array.isArray(D[c]) && D[c].forEach((
|
|
714
|
+
Array.isArray(D[c]) && D[c].forEach((F) => k.push(F));
|
|
712
715
|
});
|
|
713
716
|
let T = {};
|
|
714
717
|
k = k.filter(function(D) {
|
|
@@ -716,7 +719,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
716
719
|
}), e.setOptions(k);
|
|
717
720
|
}
|
|
718
721
|
});
|
|
719
|
-
},
|
|
722
|
+
}, xe = (e) => typeof o.checkValidDrag == "function" ? o.checkValidDrag(e) : !0, Se = (e) => typeof o.draggableChecker == "function" ? o.draggableChecker(e) : !0, Ve = () => {
|
|
720
723
|
if (typeof o.newValueGenerator == "function") {
|
|
721
724
|
let e = o.newValueGenerator();
|
|
722
725
|
if (typeof e == "object") {
|
|
@@ -725,11 +728,11 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
725
728
|
}
|
|
726
729
|
}
|
|
727
730
|
i.value.push({});
|
|
728
|
-
},
|
|
731
|
+
}, et = () => {
|
|
729
732
|
S.value = !0;
|
|
730
|
-
},
|
|
733
|
+
}, tt = () => {
|
|
731
734
|
S.value = !1;
|
|
732
|
-
},
|
|
735
|
+
}, lt = (e, c) => {
|
|
733
736
|
if (n("before-save"), o.saveResource && (S.value = !1, !c.success)) {
|
|
734
737
|
n("error", c.httpStatus);
|
|
735
738
|
return;
|
|
@@ -741,15 +744,15 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
741
744
|
for (; T--; ) e.push(void 0);
|
|
742
745
|
}
|
|
743
746
|
return e.splice(k, 0, e.splice(c, 1)[0]), e;
|
|
744
|
-
},
|
|
747
|
+
}, ot = (e) => {
|
|
745
748
|
De(i.value, e, e - 1);
|
|
746
|
-
},
|
|
749
|
+
}, at = (e) => {
|
|
747
750
|
De(i.value, e, e + 1);
|
|
748
751
|
}, we = (e) => {
|
|
749
752
|
i.value.splice(e, 1);
|
|
750
|
-
},
|
|
753
|
+
}, nt = () => {
|
|
751
754
|
let e = document.getElementById("lkt-table-body-" + oe);
|
|
752
|
-
Re.value = new
|
|
755
|
+
Re.value = new ft(e, {
|
|
753
756
|
direction: "vertical",
|
|
754
757
|
handle: ".handle",
|
|
755
758
|
animation: 150,
|
|
@@ -758,34 +761,34 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
758
761
|
i.value.splice(k, 1, D[T]), i.value.splice(T, 1, D[k]);
|
|
759
762
|
},
|
|
760
763
|
onMove: function(c, k) {
|
|
761
|
-
return
|
|
764
|
+
return xe(c);
|
|
762
765
|
}
|
|
763
766
|
});
|
|
764
767
|
}, Te = (e, c, k = !1) => {
|
|
765
768
|
let T = [oe, "row", c];
|
|
766
|
-
return k && T.push("hidden"),
|
|
767
|
-
let
|
|
768
|
-
|
|
769
|
+
return k && T.push("hidden"), Ke.value.forEach((D) => {
|
|
770
|
+
let F = String(e[D.key]).toLowerCase();
|
|
771
|
+
F.length > 50 && (F = F.substring(0, 50)), F = ct(F, " ", "-"), T.push(F);
|
|
769
772
|
}), T.join("-");
|
|
770
773
|
}, Be = f(() => typeof o.createEnabledValidator == "function" ? o.createEnabledValidator({ items: i.value }) : !0);
|
|
771
|
-
return
|
|
772
|
-
Ce(), ke(
|
|
773
|
-
|
|
774
|
+
return it(() => {
|
|
775
|
+
Ce(), ke(wt(o.columns, v.value)), Q.value.store({ items: i.value }).turnStoredIntoOriginal(), o.sortable && de(() => {
|
|
776
|
+
nt();
|
|
774
777
|
});
|
|
775
|
-
}),
|
|
778
|
+
}), A(() => o.editMode, (e) => I.value = e), A(() => o.columns, (e) => d.value = e), A(() => o.modelValue, (e) => i.value = e), A(i, (e) => {
|
|
776
779
|
Ce(), Q.value.increment({ items: e }), n("update:modelValue", e);
|
|
777
780
|
}, { deep: !0 }), t({
|
|
778
|
-
getItemByEvent:
|
|
779
|
-
doRefresh:
|
|
781
|
+
getItemByEvent: Ze,
|
|
782
|
+
doRefresh: Ue
|
|
780
783
|
}), (e, c) => {
|
|
781
|
-
const k = R("lkt-button"), T = R("lkt-field-switch"), D = R("lkt-loader"),
|
|
784
|
+
const k = R("lkt-button"), T = R("lkt-field-switch"), D = R("lkt-loader"), F = R("lkt-paginator");
|
|
782
785
|
return u(), m("section", {
|
|
783
786
|
class: "lkt-table-page",
|
|
784
|
-
id: "lkt-table-page-" +
|
|
787
|
+
id: "lkt-table-page-" + L(oe)
|
|
785
788
|
}, [
|
|
786
|
-
ie.value ||
|
|
787
|
-
ie.value ? (u(), b(Z(
|
|
788
|
-
default:
|
|
789
|
+
ie.value || L(s).title ? (u(), m("header", Jt, [
|
|
790
|
+
ie.value ? (u(), b(Z(Ge.value), { key: 0 }, {
|
|
791
|
+
default: U(() => [
|
|
789
792
|
e.titleIcon ? (u(), m("i", {
|
|
790
793
|
key: 0,
|
|
791
794
|
class: te(e.titleIcon)
|
|
@@ -794,38 +797,38 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
794
797
|
]),
|
|
795
798
|
_: 1
|
|
796
799
|
})) : y("", !0),
|
|
797
|
-
|
|
800
|
+
L(s).title ? N(e.$slots, "title", { key: 1 }) : y("", !0)
|
|
798
801
|
])) : y("", !0),
|
|
799
|
-
(u(), b(Z(
|
|
802
|
+
(u(), b(Z(ze.value), {
|
|
800
803
|
class: te(["lkt-table-page-content-wrapper", e.wrapContentClass])
|
|
801
804
|
}, {
|
|
802
|
-
default:
|
|
803
|
-
x(E("div",
|
|
805
|
+
default: U(() => [
|
|
806
|
+
x(E("div", Gt, [
|
|
804
807
|
x(X(k, {
|
|
805
808
|
ref: "saveButton",
|
|
806
809
|
palette: "success",
|
|
807
|
-
disabled: !
|
|
810
|
+
disabled: !_e.value,
|
|
808
811
|
"confirm-modal": e.saveConfirm,
|
|
809
812
|
"confirm-data": e.confirmData,
|
|
810
813
|
resource: e.saveResource,
|
|
811
|
-
"resource-data":
|
|
812
|
-
onLoading:
|
|
813
|
-
onLoaded:
|
|
814
|
-
onClick:
|
|
814
|
+
"resource-data": Je.value,
|
|
815
|
+
onLoading: et,
|
|
816
|
+
onLoaded: tt,
|
|
817
|
+
onClick: lt
|
|
815
818
|
}, {
|
|
816
|
-
default:
|
|
817
|
-
|
|
819
|
+
default: U(() => [
|
|
820
|
+
L(s)["button-save"] ? N(e.$slots, "button-save", {
|
|
818
821
|
key: 0,
|
|
819
822
|
items: i.value,
|
|
820
823
|
editMode: e.editMode,
|
|
821
824
|
canUpdate: !e.saveDisabled
|
|
822
|
-
}) : (u(), m("span",
|
|
825
|
+
}) : (u(), m("span", zt, j(qe.value), 1))
|
|
823
826
|
]),
|
|
824
827
|
_: 3
|
|
825
828
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
|
|
826
829
|
[ee, he.value]
|
|
827
830
|
]),
|
|
828
|
-
e.canCreate && ne.value &&
|
|
831
|
+
e.canCreate && ne.value && I.value ? (u(), b(Le, {
|
|
829
832
|
key: 0,
|
|
830
833
|
disabled: !Be.value,
|
|
831
834
|
text: e.createText,
|
|
@@ -833,23 +836,23 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
833
836
|
to: e.createRoute,
|
|
834
837
|
onClick: Ve
|
|
835
838
|
}, null, 8, ["disabled", "text", "icon", "to"])) : y("", !0),
|
|
836
|
-
E("div",
|
|
839
|
+
E("div", qt, [
|
|
837
840
|
x(X(T, {
|
|
838
|
-
modelValue:
|
|
839
|
-
"onUpdate:modelValue": c[0] || (c[0] = (w) =>
|
|
840
|
-
label:
|
|
841
|
+
modelValue: I.value,
|
|
842
|
+
"onUpdate:modelValue": c[0] || (c[0] = (w) => I.value = w),
|
|
843
|
+
label: Qe.value
|
|
841
844
|
}, null, 8, ["modelValue", "label"]), [
|
|
842
845
|
[ee, e.switchEditionEnabled]
|
|
843
846
|
])
|
|
844
847
|
])
|
|
845
848
|
], 512), [
|
|
846
|
-
[ee,
|
|
849
|
+
[ee, We.value]
|
|
847
850
|
]),
|
|
848
|
-
|
|
849
|
-
|
|
851
|
+
L(s).buttons ? (u(), m("div", Qt, [
|
|
852
|
+
N(e.$slots, "buttons")
|
|
850
853
|
])) : y("", !0),
|
|
851
|
-
V.value &&
|
|
852
|
-
|
|
854
|
+
V.value && L(s).filters ? (u(), m("div", Xt, [
|
|
855
|
+
N(e.$slots, "filters", {
|
|
853
856
|
items: i.value,
|
|
854
857
|
isLoading: S.value
|
|
855
858
|
})
|
|
@@ -863,26 +866,26 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
863
866
|
key: 1,
|
|
864
867
|
class: te(["lkt-table-items-container", e.itemsContainerClass])
|
|
865
868
|
}, [
|
|
866
|
-
(u(!0), m($, null, W(i.value, (w, B) => (u(), m("div",
|
|
867
|
-
|
|
869
|
+
(u(!0), m($, null, W(i.value, (w, B) => (u(), m("div", al, [
|
|
870
|
+
N(e.$slots, "item", {
|
|
868
871
|
item: w,
|
|
869
872
|
index: B,
|
|
870
873
|
canCreate: ne.value,
|
|
871
|
-
canRead:
|
|
872
|
-
canUpdate:
|
|
874
|
+
canRead: Xe.value,
|
|
875
|
+
canUpdate: Ye.value,
|
|
873
876
|
canDrop: re.value,
|
|
874
877
|
isLoading: S.value,
|
|
875
878
|
doDrop: () => we(B)
|
|
876
879
|
})
|
|
877
880
|
]))), 256))
|
|
878
|
-
], 2)) : (u(), m("table",
|
|
881
|
+
], 2)) : (u(), m("table", Zt, [
|
|
879
882
|
E("thead", null, [
|
|
880
883
|
E("tr", null, [
|
|
881
|
-
e.sortable &&
|
|
882
|
-
e.addNavigation &&
|
|
883
|
-
pe.value ? (u(), m("th",
|
|
884
|
+
e.sortable && I.value ? (u(), m("th", xt)) : y("", !0),
|
|
885
|
+
e.addNavigation && I.value ? (u(), m("th", el)) : y("", !0),
|
|
886
|
+
pe.value ? (u(), m("th", tl)) : y("", !0),
|
|
884
887
|
(u(!0), m($, null, W(ae.value, (w) => (u(), m($, null, [
|
|
885
|
-
ue.value.indexOf(w.key) === -1 ? (u(), b(
|
|
888
|
+
ue.value.indexOf(w.key) === -1 ? (u(), b(_t, {
|
|
886
889
|
key: 0,
|
|
887
890
|
column: w,
|
|
888
891
|
"sort-by": v.value,
|
|
@@ -892,14 +895,14 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
892
895
|
onClick: (B) => ke(w)
|
|
893
896
|
}, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : y("", !0)
|
|
894
897
|
], 64))), 256)),
|
|
895
|
-
e.canDrop && re.value &&
|
|
898
|
+
e.canDrop && re.value && I.value ? (u(), m("th", ll)) : y("", !0)
|
|
896
899
|
])
|
|
897
900
|
]),
|
|
898
901
|
E("tbody", {
|
|
899
902
|
ref: (w) => J.value = w,
|
|
900
|
-
id: "lkt-table-body-" +
|
|
903
|
+
id: "lkt-table-body-" + L(oe)
|
|
901
904
|
}, [
|
|
902
|
-
(u(!0), m($, null, W(i.value, (w, B) => (u(), b(
|
|
905
|
+
(u(!0), m($, null, W(i.value, (w, B) => (u(), b(Ot, {
|
|
903
906
|
modelValue: i.value[B],
|
|
904
907
|
"onUpdate:modelValue": (P) => i.value[B] = P,
|
|
905
908
|
key: Te(w, B),
|
|
@@ -911,23 +914,23 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
911
914
|
"empty-columns": ue.value,
|
|
912
915
|
"add-navigation": e.addNavigation,
|
|
913
916
|
"hidden-is-visible": ye(B),
|
|
914
|
-
"latest-row": B + 1 ===
|
|
915
|
-
"can-drop": e.canDrop && re.value &&
|
|
917
|
+
"latest-row": B + 1 === je.value,
|
|
918
|
+
"can-drop": e.canDrop && re.value && I.value,
|
|
916
919
|
"drop-confirm": e.dropConfirm,
|
|
917
920
|
"drop-resource": e.dropResource,
|
|
918
921
|
"drop-text": e.dropText,
|
|
919
922
|
"drop-icon": e.dropIcon,
|
|
920
|
-
"edit-mode-enabled":
|
|
923
|
+
"edit-mode-enabled": I.value,
|
|
921
924
|
onClick: be,
|
|
922
925
|
onShow: ge,
|
|
923
|
-
onItemUp:
|
|
924
|
-
onItemDown:
|
|
926
|
+
onItemUp: ot,
|
|
927
|
+
onItemDown: at,
|
|
925
928
|
onItemDrop: we
|
|
926
929
|
}, Ee({ _: 2 }, [
|
|
927
930
|
W(ve.value, (P) => ({
|
|
928
931
|
name: P,
|
|
929
|
-
fn:
|
|
930
|
-
|
|
932
|
+
fn: U((G) => [
|
|
933
|
+
N(e.$slots, P, {
|
|
931
934
|
item: G.item,
|
|
932
935
|
value: G.value,
|
|
933
936
|
column: G.column
|
|
@@ -935,13 +938,13 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
935
938
|
])
|
|
936
939
|
}))
|
|
937
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)),
|
|
938
|
-
se.value.length > 0 ? (u(!0), m($, { key: 0 }, W(i.value, (w, B) => (u(), b(
|
|
941
|
+
se.value.length > 0 ? (u(!0), m($, { key: 0 }, W(i.value, (w, B) => (u(), b(Pt, {
|
|
939
942
|
modelValue: i.value[B],
|
|
940
943
|
"onUpdate:modelValue": (P) => i.value[B] = P,
|
|
941
944
|
key: Te(w, B, !0),
|
|
942
945
|
i: B,
|
|
943
946
|
"hidden-columns": se.value,
|
|
944
|
-
"hidden-columns-col-span":
|
|
947
|
+
"hidden-columns-col-span": He.value,
|
|
945
948
|
"is-draggable": Se(w),
|
|
946
949
|
sortable: e.sortable,
|
|
947
950
|
"visible-columns": ae.value,
|
|
@@ -952,8 +955,8 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
952
955
|
}, Ee({ _: 2 }, [
|
|
953
956
|
W(ve.value, (P) => ({
|
|
954
957
|
name: P,
|
|
955
|
-
fn:
|
|
956
|
-
|
|
958
|
+
fn: U((G) => [
|
|
959
|
+
N(e.$slots, P, {
|
|
957
960
|
item: G.item,
|
|
958
961
|
value: G.value,
|
|
959
962
|
column: G.column
|
|
@@ -961,17 +964,17 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
961
964
|
])
|
|
962
965
|
}))
|
|
963
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)
|
|
964
|
-
], 8,
|
|
967
|
+
], 8, ol)
|
|
965
968
|
]))
|
|
966
|
-
], 8,
|
|
969
|
+
], 8, Yt), [
|
|
967
970
|
[ee, !S.value && i.value.length > 0]
|
|
968
971
|
]),
|
|
969
|
-
e.$slots["no-items"] ? (u(), m("div",
|
|
970
|
-
|
|
972
|
+
e.$slots["no-items"] ? (u(), m("div", nl, [
|
|
973
|
+
N(e.$slots, "no-items")
|
|
971
974
|
])) : y("", !0),
|
|
972
|
-
!S.value && i.value.length === 0 ? (u(), m("div",
|
|
973
|
-
e.canCreate && ne.value &&
|
|
974
|
-
e.canCreate && ne.value &&
|
|
975
|
+
!S.value && i.value.length === 0 ? (u(), m("div", ul, j(e.noResultsText), 1)) : y("", !0),
|
|
976
|
+
e.canCreate && ne.value && I.value ? (u(), m("div", sl, [
|
|
977
|
+
e.canCreate && ne.value && I.value ? (u(), b(Le, {
|
|
975
978
|
key: 0,
|
|
976
979
|
disabled: !Be.value,
|
|
977
980
|
text: e.createText,
|
|
@@ -980,42 +983,44 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
980
983
|
onClick: Ve
|
|
981
984
|
}, null, 8, ["disabled", "text", "icon", "to"])) : y("", !0)
|
|
982
985
|
])) : y("", !0),
|
|
983
|
-
X(
|
|
986
|
+
X(F, {
|
|
984
987
|
ref_key: "paginator",
|
|
985
988
|
ref: fe,
|
|
986
|
-
modelValue:
|
|
987
|
-
"onUpdate:modelValue": c[1] || (c[1] = (w) =>
|
|
989
|
+
modelValue: M.value,
|
|
990
|
+
"onUpdate:modelValue": c[1] || (c[1] = (w) => M.value = w),
|
|
988
991
|
resource: e.resource,
|
|
989
992
|
filters: e.filters,
|
|
990
993
|
onResults: $e,
|
|
991
|
-
onLoading:
|
|
992
|
-
onPerms: Ae
|
|
994
|
+
onLoading: Ne,
|
|
995
|
+
onPerms: Ae,
|
|
996
|
+
onCustom: Oe,
|
|
997
|
+
onResponse: Fe
|
|
993
998
|
}, null, 8, ["modelValue", "resource", "filters"])
|
|
994
999
|
]),
|
|
995
1000
|
_: 3
|
|
996
1001
|
}, 8, ["class"]))
|
|
997
|
-
], 8,
|
|
1002
|
+
], 8, jt);
|
|
998
1003
|
};
|
|
999
1004
|
}
|
|
1000
|
-
}),
|
|
1005
|
+
}), Al = {
|
|
1001
1006
|
install: (l) => {
|
|
1002
|
-
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);
|
|
1003
1008
|
}
|
|
1004
|
-
},
|
|
1009
|
+
}, Ol = (l) => (O.navButtonSlot = l, !0), Fl = (l) => (O.dropButtonSlot = l, !0), Nl = (l) => (O.createButtonSlot = l, !0);
|
|
1005
1010
|
export {
|
|
1006
1011
|
K as LktTableColumn,
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
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
|
|
1021
1026
|
};
|
package/package.json
CHANGED
|
@@ -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
|
|
|
@@ -145,6 +145,12 @@ const onResults = (r: any) => {
|
|
|
145
145
|
onPerms = (r: string[]) => {
|
|
146
146
|
perms.value = r;
|
|
147
147
|
},
|
|
148
|
+
onCustomReceived = (r: LktObject) => {
|
|
149
|
+
// perms.value = r;
|
|
150
|
+
},
|
|
151
|
+
onPaginatorResponse = (r: HTTPResponse) => {
|
|
152
|
+
emit('read-response', r);
|
|
153
|
+
},
|
|
148
154
|
onLoading = () => nextTick(() => loading.value = true),
|
|
149
155
|
doRefresh = () => {
|
|
150
156
|
//@ts-ignore
|
|
@@ -430,6 +436,7 @@ onMounted(() => {
|
|
|
430
436
|
}
|
|
431
437
|
})
|
|
432
438
|
|
|
439
|
+
watch(() => props.editMode, (v) => editModeEnabled.value = v);
|
|
433
440
|
watch(() => props.columns, (v) => Columns.value = v);
|
|
434
441
|
watch(() => props.modelValue, (v) => Items.value = v);
|
|
435
442
|
watch(Items, (v: any) => {
|
|
@@ -650,6 +657,8 @@ defineExpose({
|
|
|
650
657
|
v-on:results="onResults"
|
|
651
658
|
v-on:loading="onLoading"
|
|
652
659
|
v-on:perms="onPerms"
|
|
660
|
+
v-on:custom="onCustomReceived"
|
|
661
|
+
v-on:response="onPaginatorResponse"
|
|
653
662
|
/>
|
|
654
663
|
|
|
655
664
|
</component>
|