lkt-table 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.js +170 -162
- package/package.json +1 -1
- package/src/lib-components/LktTable.vue +10 -0
package/dist/build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { reactive as H, defineComponent as
|
|
2
|
-
import { httpCall as
|
|
3
|
-
import { __ as
|
|
1
|
+
import { reactive as H, defineComponent as q, ref as C, watch as U, nextTick as de, computed as f, resolveComponent as $, openBlock as u, createBlock as b, withCtx as N, createTextVNode as le, toDisplayString as j, unref as I, createElementBlock as m, Fragment as A, withModifiers as at, resolveDynamicComponent as Z, createCommentVNode as y, normalizeClass as te, createElementVNode as E, createVNode as X, renderList as P, renderSlot as F, withDirectives as x, vShow as ee, useSlots as nt, onMounted as ut, createSlots as Be } from "vue";
|
|
2
|
+
import { httpCall as st } from "lkt-http-client";
|
|
3
|
+
import { __ as z } from "lkt-i18n";
|
|
4
4
|
import { createLktEvent as ce } from "lkt-events";
|
|
5
5
|
import { generateRandomString as it, replaceAll as rt } from "lkt-string-tools";
|
|
6
6
|
import { DataState as dt } from "lkt-data-state";
|
|
@@ -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 st(this.resource, this.resourceData);
|
|
106
106
|
this.options = t.data, this.isLoading = !1, this.resourceLoaded = !0;
|
|
107
107
|
} catch {
|
|
108
108
|
this.isLoading = !1;
|
|
@@ -157,31 +157,31 @@ class K {
|
|
|
157
157
|
}
|
|
158
158
|
const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n = !0) => H(new K(l, t).setIsSortable(n).defineAsLink(r)), Dl = (l, t, r, n = !0) => H(new K(l, t).setIsSortable(n).defineAsAction(r)), wl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsText()), Tl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsEmail()), Bl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsTel()), El = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsCheck()), Il = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).defineAsSwitch()), Ll = (l, t, r, n = !0) => H(new K(l, t).setIsSortable(n).defineAsSelect(r)), Ml = (l, t, r = !0) => H(new K(l, t).setIsSortable(r).setIsHidden(!0)), Ee = (l, t, r, n) => {
|
|
159
159
|
if (!r) return 0;
|
|
160
|
-
let
|
|
160
|
+
let s = l[r.key], o = t[r.key];
|
|
161
161
|
if (n === "asc") {
|
|
162
|
-
if (
|
|
163
|
-
if (o >
|
|
162
|
+
if (s > o) return 1;
|
|
163
|
+
if (o > s) return -1;
|
|
164
164
|
} else {
|
|
165
|
-
if (
|
|
166
|
-
if (o >
|
|
165
|
+
if (s > o) return -1;
|
|
166
|
+
if (o > s) return 1;
|
|
167
167
|
}
|
|
168
168
|
return 0;
|
|
169
169
|
}, Y = (l, t, r, n = []) => {
|
|
170
170
|
if (l.extractTitleFromColumn) {
|
|
171
|
-
let
|
|
172
|
-
if (
|
|
173
|
-
return Y(
|
|
171
|
+
let s = n.find((o) => o.key === l.extractTitleFromColumn);
|
|
172
|
+
if (s)
|
|
173
|
+
return Y(s, t, r, n);
|
|
174
174
|
}
|
|
175
175
|
if (l.formatter && typeof l.formatter == "function") {
|
|
176
|
-
let
|
|
177
|
-
return
|
|
176
|
+
let s = l.formatter(t[l.key], t, l, r);
|
|
177
|
+
return s.startsWith("__:") ? z(s.substring(3)) : s;
|
|
178
178
|
}
|
|
179
179
|
return t[l.key];
|
|
180
180
|
}, gt = (l, t, r) => {
|
|
181
181
|
if (!l.colspan) return -1;
|
|
182
182
|
let n = t;
|
|
183
|
-
return r.forEach((
|
|
184
|
-
let o = me(l,
|
|
183
|
+
return r.forEach((s) => {
|
|
184
|
+
let o = me(l, s);
|
|
185
185
|
o > 0 && o < n && (n = o);
|
|
186
186
|
}), n;
|
|
187
187
|
}, me = (l, t) => l.colspan === !1 ? !1 : typeof l.colspan == "function" ? l.colspan(t) : l.colspan, Ct = (l, t, r) => {
|
|
@@ -200,7 +200,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
200
200
|
if (l[r].key === t) return l[r];
|
|
201
201
|
}
|
|
202
202
|
return null;
|
|
203
|
-
}, Le = /* @__PURE__ */
|
|
203
|
+
}, Le = /* @__PURE__ */ q({
|
|
204
204
|
__name: "LktTableCell",
|
|
205
205
|
props: {
|
|
206
206
|
modelValue: { default: () => ({}) },
|
|
@@ -211,31 +211,31 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
211
211
|
},
|
|
212
212
|
emits: ["update:modelValue"],
|
|
213
213
|
setup(l, { emit: t }) {
|
|
214
|
-
const r = t, n = l,
|
|
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
|
U(o, (a) => {
|
|
216
|
-
const i = JSON.parse(JSON.stringify(
|
|
216
|
+
const i = JSON.parse(JSON.stringify(s.value));
|
|
217
217
|
i[n.column.key] = a, r("update:modelValue", i);
|
|
218
218
|
}), U(() => n.modelValue, (a) => {
|
|
219
|
-
|
|
219
|
+
s.value = a, o.value = s.value[n.column.key];
|
|
220
220
|
}), U(() => n.column, () => {
|
|
221
221
|
n.column.resourceLoaded && de(() => g.value = !1);
|
|
222
222
|
}, { deep: !0 }), n.column.hasToLoadResource() && n.column.loadResource();
|
|
223
|
-
const v = f(() => ({ ...n.column.slotData, item:
|
|
223
|
+
const v = f(() => ({ ...n.column.slotData, item: s.value }));
|
|
224
224
|
return (a, i) => {
|
|
225
225
|
const W = $("lkt-anchor"), J = $("lkt-field-text"), d = $("lkt-field-switch"), L = $("lkt-field-file"), S = $("lkt-loader"), V = $("lkt-field-select");
|
|
226
|
-
return a.column.type === "link" ? (
|
|
226
|
+
return a.column.type === "link" ? (u(), b(W, {
|
|
227
227
|
key: 0,
|
|
228
|
-
to: a.column.getHref(
|
|
228
|
+
to: a.column.getHref(s.value)
|
|
229
229
|
}, {
|
|
230
|
-
default:
|
|
231
|
-
le(j(I(Y)(a.column,
|
|
230
|
+
default: N(() => [
|
|
231
|
+
le(j(I(Y)(a.column, s.value, a.i)), 1)
|
|
232
232
|
]),
|
|
233
233
|
_: 1
|
|
234
|
-
}, 8, ["to"])) : a.column.type === "action" ? (
|
|
234
|
+
}, 8, ["to"])) : a.column.type === "action" ? (u(), m("a", {
|
|
235
235
|
key: 1,
|
|
236
236
|
href: "#",
|
|
237
|
-
onClick: i[0] || (i[0] = (p) => a.column.doAction(
|
|
238
|
-
}, j(I(Y)(a.column,
|
|
237
|
+
onClick: i[0] || (i[0] = (p) => a.column.doAction(s.value))
|
|
238
|
+
}, j(I(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,
|
|
@@ -244,7 +244,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
244
244
|
"slot-data": v.value,
|
|
245
245
|
modelValue: o.value,
|
|
246
246
|
"onUpdate:modelValue": i[1] || (i[1] = (p) => o.value = p)
|
|
247
|
-
}, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "email" ? (
|
|
247
|
+
}, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "email" ? (u(), b(J, {
|
|
248
248
|
key: 3,
|
|
249
249
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
250
250
|
ref: (p) => h.value = p,
|
|
@@ -254,7 +254,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
254
254
|
"is-email": "",
|
|
255
255
|
modelValue: o.value,
|
|
256
256
|
"onUpdate:modelValue": i[2] || (i[2] = (p) => o.value = p)
|
|
257
|
-
}, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "tel" ? (
|
|
257
|
+
}, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "tel" ? (u(), b(J, {
|
|
258
258
|
key: 4,
|
|
259
259
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
260
260
|
ref: (p) => h.value = p,
|
|
@@ -264,27 +264,27 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
264
264
|
"is-tel": "",
|
|
265
265
|
modelValue: o.value,
|
|
266
266
|
"onUpdate:modelValue": i[3] || (i[3] = (p) => o.value = p)
|
|
267
|
-
}, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "check" ? (
|
|
267
|
+
}, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "check" ? (u(), b(d, {
|
|
268
268
|
key: 5,
|
|
269
269
|
"is-check": "",
|
|
270
270
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
271
271
|
ref: (p) => h.value = p,
|
|
272
272
|
modelValue: o.value,
|
|
273
273
|
"onUpdate:modelValue": i[4] || (i[4] = (p) => o.value = p)
|
|
274
|
-
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "switch" ? (
|
|
274
|
+
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "switch" ? (u(), b(d, {
|
|
275
275
|
key: 6,
|
|
276
276
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
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" ? (
|
|
280
|
+
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "file" ? (u(), b(L, {
|
|
281
281
|
key: 7,
|
|
282
282
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
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" ? (
|
|
287
|
-
g.value ? (
|
|
286
|
+
}, null, 8, ["read-mode", "modelValue"])) : a.column.type === "select" ? (u(), m(A, { key: 8 }, [
|
|
287
|
+
g.value ? (u(), b(S, { key: 0 })) : (u(), b(V, {
|
|
288
288
|
key: 1,
|
|
289
289
|
"read-mode": !a.column.editable || !a.editModeEnabled,
|
|
290
290
|
ref: (p) => h.value = p,
|
|
@@ -300,8 +300,8 @@ 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)) : (
|
|
304
|
-
le(j(I(Y)(a.column,
|
|
303
|
+
], 64)) : (u(), m(A, { key: 9 }, [
|
|
304
|
+
le(j(I(Y)(a.column, s.value, a.i, a.columns)), 1)
|
|
305
305
|
], 64));
|
|
306
306
|
};
|
|
307
307
|
}
|
|
@@ -309,7 +309,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
309
309
|
navButtonSlot: "",
|
|
310
310
|
dropButtonSlot: "",
|
|
311
311
|
createButtonSlot: ""
|
|
312
|
-
}, Dt = /* @__PURE__ */
|
|
312
|
+
}, Dt = /* @__PURE__ */ q({
|
|
313
313
|
__name: "DropButton",
|
|
314
314
|
props: {
|
|
315
315
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -321,21 +321,21 @@ 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,
|
|
324
|
+
const r = t, n = l, s = f(() => R.dropButtonSlot !== ""), o = f(() => R.dropButtonSlot), h = f(() => n.text.startsWith("__:") ? z(n.text.substring(3)) : n.text);
|
|
325
325
|
return (g, v) => {
|
|
326
326
|
const a = $("lkt-button");
|
|
327
|
-
return
|
|
327
|
+
return u(), b(a, {
|
|
328
328
|
palette: "table-delete",
|
|
329
|
-
icon:
|
|
330
|
-
text:
|
|
329
|
+
icon: s.value ? "" : g.icon,
|
|
330
|
+
text: s.value ? "" : h.value,
|
|
331
331
|
resource: g.resource,
|
|
332
332
|
"resource-data": g.resourceData,
|
|
333
333
|
"confirm-modal": g.confirm,
|
|
334
334
|
disabled: g.disabled,
|
|
335
335
|
onClick: v[0] || (v[0] = at((i) => r("click"), ["prevent", "stop"]))
|
|
336
336
|
}, {
|
|
337
|
-
default:
|
|
338
|
-
|
|
337
|
+
default: N(() => [
|
|
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"]);
|
|
@@ -350,7 +350,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
350
350
|
}, Et = { class: "lkt-table-nav-container" }, It = /* @__PURE__ */ E("i", { class: "" }, null, -1), Lt = /* @__PURE__ */ E("i", { class: "" }, null, -1), Mt = ["data-column", "colspan", "title", "onClick"], $t = {
|
|
351
351
|
key: 4,
|
|
352
352
|
class: "lkt-table-col-drop"
|
|
353
|
-
}, At = /* @__PURE__ */
|
|
353
|
+
}, At = /* @__PURE__ */ q({
|
|
354
354
|
__name: "LktTableRow",
|
|
355
355
|
props: {
|
|
356
356
|
modelValue: { default: () => ({}) },
|
|
@@ -372,7 +372,7 @@ 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,
|
|
375
|
+
const r = t, n = l, s = C(n.modelValue), o = (d, L, S) => {
|
|
376
376
|
r("click", d, ce("", { item: L, column: S }));
|
|
377
377
|
}, h = (d, L) => {
|
|
378
378
|
r("show", d, ce("", { i: L }));
|
|
@@ -388,31 +388,31 @@ 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 U(() => n.modelValue, (d) =>
|
|
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
394
|
const S = $("lkt-button");
|
|
395
|
-
return
|
|
395
|
+
return u(), m("tr", {
|
|
396
396
|
"data-i": d.i,
|
|
397
397
|
"data-draggable": d.isDraggable
|
|
398
398
|
}, [
|
|
399
|
-
d.sortable && d.isDraggable && d.editModeEnabled ? (
|
|
399
|
+
d.sortable && d.isDraggable && d.editModeEnabled ? (u(), m("td", {
|
|
400
400
|
key: 0,
|
|
401
401
|
"data-role": "drag-indicator",
|
|
402
402
|
class: te(g.value)
|
|
403
|
-
}, null, 2)) : d.sortable && d.editModeEnabled ? (
|
|
404
|
-
d.addNavigation && d.editModeEnabled ? (
|
|
403
|
+
}, null, 2)) : d.sortable && d.editModeEnabled ? (u(), m("td", Tt)) : y("", !0),
|
|
404
|
+
d.addNavigation && d.editModeEnabled ? (u(), m("td", Bt, [
|
|
405
405
|
E("div", Et, [
|
|
406
406
|
X(S, {
|
|
407
407
|
palette: "table-nav",
|
|
408
408
|
disabled: d.i === 0,
|
|
409
409
|
onClick: i
|
|
410
410
|
}, {
|
|
411
|
-
default:
|
|
412
|
-
v.value ? (
|
|
411
|
+
default: N(() => [
|
|
412
|
+
v.value ? (u(), b(Z(a.value), {
|
|
413
413
|
key: 0,
|
|
414
414
|
direction: "up"
|
|
415
|
-
})) : (
|
|
415
|
+
})) : (u(), m(A, { key: 1 }, [
|
|
416
416
|
It,
|
|
417
417
|
le(" UP ")
|
|
418
418
|
], 64))
|
|
@@ -424,11 +424,11 @@ 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: W
|
|
426
426
|
}, {
|
|
427
|
-
default:
|
|
428
|
-
v.value ? (
|
|
427
|
+
default: N(() => [
|
|
428
|
+
v.value ? (u(), b(Z(a.value), {
|
|
429
429
|
key: 0,
|
|
430
430
|
direction: "down"
|
|
431
|
-
})) : (
|
|
431
|
+
})) : (u(), m(A, { key: 1 }, [
|
|
432
432
|
Lt,
|
|
433
433
|
le(" DOWN ")
|
|
434
434
|
], 64))
|
|
@@ -437,30 +437,30 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
437
437
|
}, 8, ["disabled"])
|
|
438
438
|
])
|
|
439
439
|
])) : y("", !0),
|
|
440
|
-
d.displayHiddenColumnsIndicator ? (
|
|
440
|
+
d.displayHiddenColumnsIndicator ? (u(), m("td", {
|
|
441
441
|
key: 3,
|
|
442
442
|
onClick: L[0] || (L[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
|
-
(
|
|
447
|
-
I(Ct)(V, d.emptyColumns,
|
|
446
|
+
(u(!0), m(A, null, P(d.visibleColumns, (V) => (u(), m(A, null, [
|
|
447
|
+
I(Ct)(V, d.emptyColumns, s.value) ? (u(), m("td", {
|
|
448
448
|
key: 0,
|
|
449
449
|
"data-column": V.key,
|
|
450
|
-
colspan: I(me)(V,
|
|
451
|
-
title: I(Y)(V,
|
|
452
|
-
onClick: (p) => o(p,
|
|
450
|
+
colspan: I(me)(V, s.value),
|
|
451
|
+
title: I(Y)(V, s.value, d.i, d.visibleColumns),
|
|
452
|
+
onClick: (p) => o(p, s.value, V)
|
|
453
453
|
}, [
|
|
454
|
-
d.$slots[V.key] ?
|
|
454
|
+
d.$slots[V.key] ? F(d.$slots, V.key, {
|
|
455
455
|
key: 0,
|
|
456
|
-
value:
|
|
457
|
-
item:
|
|
456
|
+
value: s.value[V.key],
|
|
457
|
+
item: s.value,
|
|
458
458
|
column: V,
|
|
459
459
|
i: d.i
|
|
460
|
-
}) :
|
|
460
|
+
}) : s.value ? (u(), b(Le, {
|
|
461
461
|
key: 1,
|
|
462
|
-
modelValue:
|
|
463
|
-
"onUpdate:modelValue": L[1] || (L[1] = (p) =>
|
|
462
|
+
modelValue: s.value,
|
|
463
|
+
"onUpdate:modelValue": L[1] || (L[1] = (p) => s.value = p),
|
|
464
464
|
column: V,
|
|
465
465
|
columns: d.visibleColumns,
|
|
466
466
|
"edit-mode-enabled": d.editModeEnabled,
|
|
@@ -468,10 +468,10 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
468
468
|
}, null, 8, ["modelValue", "column", "columns", "edit-mode-enabled", "i"])) : y("", !0)
|
|
469
469
|
], 8, Mt)) : y("", !0)
|
|
470
470
|
], 64))), 256)),
|
|
471
|
-
d.canDrop && d.editModeEnabled ? (
|
|
471
|
+
d.canDrop && d.editModeEnabled ? (u(), m("td", $t, [
|
|
472
472
|
X(Dt, {
|
|
473
473
|
resource: d.dropResource,
|
|
474
|
-
"resource-data":
|
|
474
|
+
"resource-data": s.value,
|
|
475
475
|
confirm: d.dropConfirm,
|
|
476
476
|
text: d.dropText,
|
|
477
477
|
icon: d.dropIcon,
|
|
@@ -481,7 +481,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
481
481
|
], 8, wt);
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
|
-
}), Rt = { "data-role": "hidden-row" }, Ot = ["colspan"],
|
|
484
|
+
}), Rt = { "data-role": "hidden-row" }, Ot = ["colspan"], Ft = ["data-column"], Nt = ["data-i"], Ut = ["data-column", "title", "onClick"], Ht = /* @__PURE__ */ q({
|
|
485
485
|
__name: "LktHiddenRow",
|
|
486
486
|
props: {
|
|
487
487
|
modelValue: { default: () => ({}) },
|
|
@@ -496,48 +496,48 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
496
496
|
},
|
|
497
497
|
emits: ["update:modelValue", "click"],
|
|
498
498
|
setup(l, { emit: t }) {
|
|
499
|
-
const r = t, n = l,
|
|
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) =>
|
|
502
|
+
return U(() => n.modelValue, (h) => s.value = h), U(s, () => r("update:modelValue", s.value)), (h, g) => x((u(), m("tr", Rt, [
|
|
503
503
|
E("td", { colspan: h.hiddenColumnsColSpan }, [
|
|
504
504
|
E("table", null, [
|
|
505
505
|
E("tr", null, [
|
|
506
|
-
(
|
|
506
|
+
(u(!0), m(A, null, P(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, Ft))), 256))
|
|
511
511
|
]),
|
|
512
512
|
E("tr", { "data-i": h.i }, [
|
|
513
|
-
(
|
|
513
|
+
(u(!0), m(A, null, P(h.hiddenColumns, (v, a) => (u(), m("td", {
|
|
514
514
|
"data-column": v.key,
|
|
515
|
-
title: I(Y)(v,
|
|
516
|
-
onClick: (i) => o(i,
|
|
515
|
+
title: I(Y)(v, s.value, a, h.hiddenColumns),
|
|
516
|
+
onClick: (i) => o(i, s.value, v)
|
|
517
517
|
}, [
|
|
518
|
-
h.$slots[v.key] ?
|
|
518
|
+
h.$slots[v.key] ? F(h.$slots, v.key, {
|
|
519
519
|
key: 0,
|
|
520
|
-
value:
|
|
521
|
-
item:
|
|
520
|
+
value: s.value[v.key],
|
|
521
|
+
item: s.value,
|
|
522
522
|
column: v,
|
|
523
523
|
i: a
|
|
524
|
-
}) : (
|
|
524
|
+
}) : (u(), b(Le, {
|
|
525
525
|
key: 1,
|
|
526
526
|
column: v,
|
|
527
527
|
columns: h.hiddenColumns,
|
|
528
|
-
modelValue:
|
|
529
|
-
"onUpdate:modelValue": g[0] || (g[0] = (i) =>
|
|
528
|
+
modelValue: s.value,
|
|
529
|
+
"onUpdate:modelValue": g[0] || (g[0] = (i) => s.value = i),
|
|
530
530
|
i: a
|
|
531
531
|
}, null, 8, ["column", "columns", "modelValue", "i"]))
|
|
532
532
|
], 8, Ut))), 256))
|
|
533
|
-
], 8,
|
|
533
|
+
], 8, Nt)
|
|
534
534
|
])
|
|
535
535
|
], 8, Ot)
|
|
536
536
|
], 512)), [
|
|
537
537
|
[ee, h.hiddenIsVisible]
|
|
538
538
|
]);
|
|
539
539
|
}
|
|
540
|
-
}), Ie = /* @__PURE__ */
|
|
540
|
+
}), Ie = /* @__PURE__ */ q({
|
|
541
541
|
__name: "CreateButton",
|
|
542
542
|
props: {
|
|
543
543
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -546,24 +546,24 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
546
546
|
},
|
|
547
547
|
emits: ["click"],
|
|
548
548
|
setup(l, { emit: t }) {
|
|
549
|
-
const r = t, n = l,
|
|
549
|
+
const r = t, n = l, s = f(() => R.createButtonSlot !== ""), o = f(() => R.createButtonSlot), h = f(() => n.text.startsWith("__:") ? z(n.text.substring(3)) : n.text);
|
|
550
550
|
return (g, v) => {
|
|
551
551
|
const a = $("lkt-button");
|
|
552
|
-
return
|
|
552
|
+
return u(), b(a, {
|
|
553
553
|
palette: "table-create",
|
|
554
554
|
disabled: g.disabled,
|
|
555
|
-
icon:
|
|
556
|
-
text:
|
|
555
|
+
icon: s.value ? "" : g.icon,
|
|
556
|
+
text: s.value ? "" : h.value,
|
|
557
557
|
onClick: v[0] || (v[0] = (i) => r("click"))
|
|
558
558
|
}, {
|
|
559
|
-
default:
|
|
560
|
-
|
|
559
|
+
default: N(() => [
|
|
560
|
+
s.value ? (u(), b(Z(o.value), { key: 0 })) : y("", !0)
|
|
561
561
|
]),
|
|
562
562
|
_: 1
|
|
563
563
|
}, 8, ["disabled", "icon", "text"]);
|
|
564
564
|
};
|
|
565
565
|
}
|
|
566
|
-
}), Kt = ["data-column", "data-sortable", "data-sort", "colspan", "title"], _t = /* @__PURE__ */
|
|
566
|
+
}), Kt = ["data-column", "data-sortable", "data-sort", "colspan", "title"], _t = /* @__PURE__ */ q({
|
|
567
567
|
__name: "TableHeader",
|
|
568
568
|
props: {
|
|
569
569
|
column: { default: () => ({}) },
|
|
@@ -574,24 +574,24 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
574
574
|
},
|
|
575
575
|
emits: ["click"],
|
|
576
576
|
setup(l, { emit: t }) {
|
|
577
|
-
const r = t, n = l,
|
|
577
|
+
const r = t, n = l, s = f(() => gt(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
578
|
r("click", n.column);
|
|
579
579
|
};
|
|
580
|
-
return (a, i) => (
|
|
580
|
+
return (a, i) => (u(), m("th", {
|
|
581
581
|
"data-column": a.column.key,
|
|
582
582
|
"data-sortable": o.value,
|
|
583
583
|
"data-sort": h.value,
|
|
584
|
-
colspan:
|
|
584
|
+
colspan: s.value,
|
|
585
585
|
title: g.value,
|
|
586
586
|
onClick: v
|
|
587
587
|
}, [
|
|
588
588
|
E("div", null, j(g.value), 1)
|
|
589
589
|
], 8, Kt));
|
|
590
590
|
}
|
|
591
|
-
}), Pt = ["id"], Wt = { key: 0 }, jt = { class: "lkt-table-page-buttons" }, Jt = { key: 1 },
|
|
591
|
+
}), Pt = ["id"], Wt = { key: 0 }, jt = { class: "lkt-table-page-buttons" }, Jt = { key: 1 }, Gt = { class: "switch-edition-mode" }, zt = {
|
|
592
592
|
key: 0,
|
|
593
593
|
class: "lkt-table-page-buttons"
|
|
594
|
-
},
|
|
594
|
+
}, qt = {
|
|
595
595
|
key: 1,
|
|
596
596
|
class: "lkt-table-page-filters"
|
|
597
597
|
}, Qt = ["data-sortable"], Xt = { key: 0 }, Yt = {
|
|
@@ -609,7 +609,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
609
609
|
}, nl = {
|
|
610
610
|
key: 5,
|
|
611
611
|
class: "lkt-table-page-buttons lkt-table-page-buttons-bottom"
|
|
612
|
-
},
|
|
612
|
+
}, ul = /* @__PURE__ */ q({
|
|
613
613
|
__name: "LktTable",
|
|
614
614
|
props: {
|
|
615
615
|
modelValue: { default: () => [] },
|
|
@@ -653,17 +653,18 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
653
653
|
dropResource: { default: "" },
|
|
654
654
|
addNavigation: { type: Boolean, default: !1 },
|
|
655
655
|
itemMode: { type: Boolean, default: !1 },
|
|
656
|
-
createEnabledValidator: { type: Function, default: void 0 }
|
|
656
|
+
createEnabledValidator: { type: Function, default: void 0 },
|
|
657
|
+
newValueGenerator: { type: Function, default: void 0 }
|
|
657
658
|
},
|
|
658
659
|
emits: ["update:modelValue", "sort", "click", "save", "error", "before-save"],
|
|
659
660
|
setup(l, { expose: t, emit: r }) {
|
|
660
|
-
const n = r,
|
|
661
|
+
const n = r, s = nt(), o = l, h = {}, g = C(typeof o.sorter == "function" ? o.sorter : Ee), v = C(St(o.columns)), a = C("asc"), i = C(o.modelValue), W = 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), Me = C({}), Q = C(new dt({ items: i.value }, o.dataStateConfig)), M = C(o.editMode), $e = (e) => {
|
|
661
662
|
Array.isArray(e) && (i.value = e), S.value = !1, V.value = !0, Q.value.store({ items: i.value }).turnStoredIntoOriginal();
|
|
662
663
|
}, Ae = (e) => {
|
|
663
664
|
p.value = e;
|
|
664
665
|
}, Re = () => de(() => S.value = !0), Oe = () => {
|
|
665
666
|
fe.value.doRefresh();
|
|
666
|
-
}, oe = it(12),
|
|
667
|
+
}, oe = it(12), ue = f(() => {
|
|
667
668
|
if (!o.hideEmptyColumns) return [];
|
|
668
669
|
let e = [];
|
|
669
670
|
return d.value.forEach((c) => {
|
|
@@ -674,17 +675,17 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
674
675
|
D[k] && (T = !0);
|
|
675
676
|
}), T || e.push(k);
|
|
676
677
|
}), e;
|
|
677
|
-
}), ae = f(() => d.value.filter((e) => !e.hidden)),
|
|
678
|
+
}), ae = f(() => d.value.filter((e) => !e.hidden)), se = f(() => d.value.filter((e) => e.hidden)), Fe = f(() => {
|
|
678
679
|
let e = ae.value.length + 1;
|
|
679
680
|
return o.sortable && ++e, e;
|
|
680
|
-
}),
|
|
681
|
+
}), Ne = f(() => d.value.filter((e) => e.isForRowKey)), pe = f(() => se.value.length > 0 && !o.sortable), Ue = f(() => d.value.map((e) => e.key)), ve = f(() => {
|
|
681
682
|
let e = [];
|
|
682
|
-
for (let c in
|
|
683
|
+
for (let c in s) Ue.value.indexOf(c) !== -1 && e.push(c);
|
|
683
684
|
return e;
|
|
684
685
|
}), he = f(() => o.hiddenSave || S.value || !o.saveResource ? !1 : M.value && Q.value.changed() ? !0 : M.value), He = f(() => o.switchEditionEnabled ? !0 : he.value || M.value && o.canCreate), Ke = f(() => o.saveDisabled || typeof o.saveValidator == "function" && !o.saveValidator(i.value) ? !1 : Q.value.changed()), _e = f(() => i.value.length), Pe = f(() => ({
|
|
685
686
|
items: i.value,
|
|
686
687
|
...o.saveResourceData
|
|
687
|
-
})), We = f(() => o.titleTag === "" ? "h2" : o.titleTag), je = f(() => o.wrapContentTag === "" ? "div" : o.wrapContentTag), ie = f(() => o.title.startsWith("__:") ?
|
|
688
|
+
})), We = f(() => o.titleTag === "" ? "h2" : o.titleTag), je = f(() => o.wrapContentTag === "" ? "div" : o.wrapContentTag), ie = f(() => o.title.startsWith("__:") ? z(o.title.substring(3)) : o.title), Je = f(() => o.saveText.startsWith("__:") ? z(o.saveText.substring(3)) : o.saveText), Ge = f(() => o.editModeText.startsWith("__:") ? z(o.editModeText.substring(3)) : o.editModeText), ne = f(() => p.value.includes("create")), ze = f(() => p.value.includes("read")), qe = f(() => p.value.includes("update")), re = f(() => p.value.includes("drop")), Qe = (e) => {
|
|
688
689
|
let c = e.target;
|
|
689
690
|
if (typeof c.dataset.column > "u")
|
|
690
691
|
do
|
|
@@ -713,6 +714,13 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
713
714
|
}
|
|
714
715
|
});
|
|
715
716
|
}, Xe = (e) => typeof o.checkValidDrag == "function" ? o.checkValidDrag(e) : !0, Se = (e) => typeof o.draggableChecker == "function" ? o.draggableChecker(e) : !0, Ve = () => {
|
|
717
|
+
if (typeof o.newValueGenerator == "function") {
|
|
718
|
+
let e = o.newValueGenerator();
|
|
719
|
+
if (typeof e == "object") {
|
|
720
|
+
i.value.push(e);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
716
724
|
i.value.push({});
|
|
717
725
|
}, Ye = () => {
|
|
718
726
|
S.value = !0;
|
|
@@ -752,12 +760,12 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
752
760
|
});
|
|
753
761
|
}, we = (e, c, k = !1) => {
|
|
754
762
|
let T = [oe, "row", c];
|
|
755
|
-
return k && T.push("hidden"),
|
|
763
|
+
return k && T.push("hidden"), Ne.value.forEach((D) => {
|
|
756
764
|
let O = String(e[D.key]).toLowerCase();
|
|
757
765
|
O.length > 50 && (O = O.substring(0, 50)), O = rt(O, " ", "-"), T.push(O);
|
|
758
766
|
}), T.join("-");
|
|
759
767
|
}, Te = f(() => typeof o.createEnabledValidator == "function" ? o.createEnabledValidator({ items: i.value }) : !0);
|
|
760
|
-
return
|
|
768
|
+
return ut(() => {
|
|
761
769
|
Ce(), ke(Vt(o.columns, v.value)), Q.value.store({ items: i.value }).turnStoredIntoOriginal(), o.sortable && de(() => {
|
|
762
770
|
ot();
|
|
763
771
|
});
|
|
@@ -768,14 +776,14 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
768
776
|
doRefresh: Oe
|
|
769
777
|
}), (e, c) => {
|
|
770
778
|
const k = $("lkt-button"), T = $("lkt-field-switch"), D = $("lkt-loader"), O = $("lkt-paginator");
|
|
771
|
-
return
|
|
779
|
+
return u(), m("section", {
|
|
772
780
|
class: "lkt-table-page",
|
|
773
781
|
id: "lkt-table-page-" + I(oe)
|
|
774
782
|
}, [
|
|
775
|
-
ie.value || I(
|
|
776
|
-
ie.value ? (
|
|
777
|
-
default:
|
|
778
|
-
e.titleIcon ? (
|
|
783
|
+
ie.value || I(s).title ? (u(), m("header", Wt, [
|
|
784
|
+
ie.value ? (u(), b(Z(We.value), { key: 0 }, {
|
|
785
|
+
default: N(() => [
|
|
786
|
+
e.titleIcon ? (u(), m("i", {
|
|
779
787
|
key: 0,
|
|
780
788
|
class: te(e.titleIcon)
|
|
781
789
|
}, null, 2)) : y("", !0),
|
|
@@ -783,12 +791,12 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
783
791
|
]),
|
|
784
792
|
_: 1
|
|
785
793
|
})) : y("", !0),
|
|
786
|
-
I(
|
|
794
|
+
I(s).title ? F(e.$slots, "title", { key: 1 }) : y("", !0)
|
|
787
795
|
])) : y("", !0),
|
|
788
|
-
(
|
|
796
|
+
(u(), b(Z(je.value), {
|
|
789
797
|
class: te(["lkt-table-page-content-wrapper", e.wrapContentClass])
|
|
790
798
|
}, {
|
|
791
|
-
default:
|
|
799
|
+
default: N(() => [
|
|
792
800
|
x(E("div", jt, [
|
|
793
801
|
x(X(k, {
|
|
794
802
|
ref: "saveButton",
|
|
@@ -802,30 +810,30 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
802
810
|
onLoaded: Ze,
|
|
803
811
|
onClick: xe
|
|
804
812
|
}, {
|
|
805
|
-
default:
|
|
806
|
-
I(
|
|
813
|
+
default: N(() => [
|
|
814
|
+
I(s)["button-save"] ? F(e.$slots, "button-save", {
|
|
807
815
|
key: 0,
|
|
808
816
|
items: i.value,
|
|
809
817
|
editMode: e.editMode,
|
|
810
818
|
canUpdate: !e.saveDisabled
|
|
811
|
-
}) : (
|
|
819
|
+
}) : (u(), m("span", Jt, j(Je.value), 1))
|
|
812
820
|
]),
|
|
813
821
|
_: 3
|
|
814
822
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
|
|
815
823
|
[ee, he.value]
|
|
816
824
|
]),
|
|
817
|
-
e.canCreate && ne.value && M.value ? (
|
|
825
|
+
e.canCreate && ne.value && M.value ? (u(), b(Ie, {
|
|
818
826
|
key: 0,
|
|
819
827
|
disabled: !Te.value,
|
|
820
828
|
text: e.createText,
|
|
821
829
|
icon: e.createIcon,
|
|
822
830
|
onClick: Ve
|
|
823
831
|
}, null, 8, ["disabled", "text", "icon"])) : y("", !0),
|
|
824
|
-
E("div",
|
|
832
|
+
E("div", Gt, [
|
|
825
833
|
x(X(T, {
|
|
826
834
|
modelValue: M.value,
|
|
827
835
|
"onUpdate:modelValue": c[0] || (c[0] = (w) => M.value = w),
|
|
828
|
-
label:
|
|
836
|
+
label: Ge.value
|
|
829
837
|
}, null, 8, ["modelValue", "label"]), [
|
|
830
838
|
[ee, e.switchEditionEnabled]
|
|
831
839
|
])
|
|
@@ -833,43 +841,43 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
833
841
|
], 512), [
|
|
834
842
|
[ee, He.value]
|
|
835
843
|
]),
|
|
836
|
-
I(
|
|
837
|
-
|
|
844
|
+
I(s).buttons ? (u(), m("div", zt, [
|
|
845
|
+
F(e.$slots, "buttons")
|
|
838
846
|
])) : y("", !0),
|
|
839
|
-
V.value && I(
|
|
840
|
-
|
|
847
|
+
V.value && I(s).filters ? (u(), m("div", qt, [
|
|
848
|
+
F(e.$slots, "filters", {
|
|
841
849
|
items: i.value,
|
|
842
850
|
isLoading: S.value
|
|
843
851
|
})
|
|
844
852
|
])) : y("", !0),
|
|
845
|
-
S.value ? (
|
|
853
|
+
S.value ? (u(), b(D, { key: 2 })) : y("", !0),
|
|
846
854
|
x(E("div", {
|
|
847
855
|
class: "lkt-table",
|
|
848
856
|
"data-sortable": e.sortable
|
|
849
857
|
}, [
|
|
850
|
-
e.itemMode ? (
|
|
858
|
+
e.itemMode ? (u(), m("div", {
|
|
851
859
|
key: 1,
|
|
852
860
|
class: te(["lkt-table-items-container", e.itemsContainerClass])
|
|
853
861
|
}, [
|
|
854
|
-
(
|
|
855
|
-
|
|
862
|
+
(u(!0), m(A, null, P(i.value, (w, B) => (u(), m("div", ll, [
|
|
863
|
+
F(e.$slots, "item", {
|
|
856
864
|
item: w,
|
|
857
865
|
index: B,
|
|
858
866
|
canCreate: ne.value,
|
|
859
|
-
canRead:
|
|
860
|
-
canUpdate:
|
|
867
|
+
canRead: ze.value,
|
|
868
|
+
canUpdate: qe.value,
|
|
861
869
|
canDrop: re.value,
|
|
862
870
|
isLoading: S.value
|
|
863
871
|
})
|
|
864
872
|
]))), 256))
|
|
865
|
-
], 2)) : (
|
|
873
|
+
], 2)) : (u(), m("table", Xt, [
|
|
866
874
|
E("thead", null, [
|
|
867
875
|
E("tr", null, [
|
|
868
|
-
e.sortable && M.value ? (
|
|
869
|
-
e.addNavigation && M.value ? (
|
|
870
|
-
pe.value ? (
|
|
871
|
-
(
|
|
872
|
-
|
|
876
|
+
e.sortable && M.value ? (u(), m("th", Yt)) : y("", !0),
|
|
877
|
+
e.addNavigation && M.value ? (u(), m("th", Zt)) : y("", !0),
|
|
878
|
+
pe.value ? (u(), m("th", xt)) : y("", !0),
|
|
879
|
+
(u(!0), m(A, null, P(ae.value, (w) => (u(), m(A, null, [
|
|
880
|
+
ue.value.indexOf(w.key) === -1 ? (u(), b(_t, {
|
|
873
881
|
key: 0,
|
|
874
882
|
column: w,
|
|
875
883
|
"sort-by": v.value,
|
|
@@ -879,14 +887,14 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
879
887
|
onClick: (B) => ke(w)
|
|
880
888
|
}, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : y("", !0)
|
|
881
889
|
], 64))), 256)),
|
|
882
|
-
e.canDrop && re.value && M.value ? (
|
|
890
|
+
e.canDrop && re.value && M.value ? (u(), m("th", el)) : y("", !0)
|
|
883
891
|
])
|
|
884
892
|
]),
|
|
885
893
|
E("tbody", {
|
|
886
894
|
ref: (w) => J.value = w,
|
|
887
895
|
id: "lkt-table-body-" + I(oe)
|
|
888
896
|
}, [
|
|
889
|
-
(
|
|
897
|
+
(u(!0), m(A, null, P(i.value, (w, B) => (u(), b(At, {
|
|
890
898
|
modelValue: i.value[B],
|
|
891
899
|
"onUpdate:modelValue": (_) => i.value[B] = _,
|
|
892
900
|
key: we(w, B),
|
|
@@ -895,7 +903,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
895
903
|
"is-draggable": Se(w),
|
|
896
904
|
sortable: e.sortable,
|
|
897
905
|
"visible-columns": ae.value,
|
|
898
|
-
"empty-columns":
|
|
906
|
+
"empty-columns": ue.value,
|
|
899
907
|
"add-navigation": e.addNavigation,
|
|
900
908
|
"hidden-is-visible": ye(B),
|
|
901
909
|
"latest-row": B + 1 === _e.value,
|
|
@@ -913,37 +921,37 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
913
921
|
}, Be({ _: 2 }, [
|
|
914
922
|
P(ve.value, (_) => ({
|
|
915
923
|
name: _,
|
|
916
|
-
fn:
|
|
917
|
-
|
|
918
|
-
item:
|
|
919
|
-
value:
|
|
920
|
-
column:
|
|
924
|
+
fn: N((G) => [
|
|
925
|
+
F(e.$slots, _, {
|
|
926
|
+
item: G.item,
|
|
927
|
+
value: G.value,
|
|
928
|
+
column: G.column
|
|
921
929
|
})
|
|
922
930
|
])
|
|
923
931
|
}))
|
|
924
932
|
]), 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)),
|
|
925
|
-
|
|
933
|
+
se.value.length > 0 ? (u(!0), m(A, { key: 0 }, P(i.value, (w, B) => (u(), b(Ht, {
|
|
926
934
|
modelValue: i.value[B],
|
|
927
935
|
"onUpdate:modelValue": (_) => i.value[B] = _,
|
|
928
936
|
key: we(w, B, !0),
|
|
929
937
|
i: B,
|
|
930
|
-
"hidden-columns":
|
|
931
|
-
"hidden-columns-col-span":
|
|
938
|
+
"hidden-columns": se.value,
|
|
939
|
+
"hidden-columns-col-span": Fe.value,
|
|
932
940
|
"is-draggable": Se(w),
|
|
933
941
|
sortable: e.sortable,
|
|
934
942
|
"visible-columns": ae.value,
|
|
935
|
-
"empty-columns":
|
|
943
|
+
"empty-columns": ue.value,
|
|
936
944
|
"hidden-is-visible": ye(B),
|
|
937
945
|
onClick: be,
|
|
938
946
|
onShow: ge
|
|
939
947
|
}, Be({ _: 2 }, [
|
|
940
948
|
P(ve.value, (_) => ({
|
|
941
949
|
name: _,
|
|
942
|
-
fn:
|
|
943
|
-
|
|
944
|
-
item:
|
|
945
|
-
value:
|
|
946
|
-
column:
|
|
950
|
+
fn: N((G) => [
|
|
951
|
+
F(e.$slots, _, {
|
|
952
|
+
item: G.item,
|
|
953
|
+
value: G.value,
|
|
954
|
+
column: G.column
|
|
947
955
|
})
|
|
948
956
|
])
|
|
949
957
|
}))
|
|
@@ -953,12 +961,12 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
953
961
|
], 8, Qt), [
|
|
954
962
|
[ee, !S.value && i.value.length > 0]
|
|
955
963
|
]),
|
|
956
|
-
e.$slots["no-items"] ? (
|
|
957
|
-
|
|
964
|
+
e.$slots["no-items"] ? (u(), m("div", ol, [
|
|
965
|
+
F(e.$slots, "no-items")
|
|
958
966
|
])) : y("", !0),
|
|
959
|
-
!S.value && i.value.length === 0 ? (
|
|
960
|
-
e.canCreate && ne.value && M.value ? (
|
|
961
|
-
e.canCreate && ne.value && M.value ? (
|
|
967
|
+
!S.value && i.value.length === 0 ? (u(), m("div", al, j(e.noResultsText), 1)) : y("", !0),
|
|
968
|
+
e.canCreate && ne.value && M.value ? (u(), m("div", nl, [
|
|
969
|
+
e.canCreate && ne.value && M.value ? (u(), b(Ie, {
|
|
962
970
|
key: 0,
|
|
963
971
|
disabled: !Te.value,
|
|
964
972
|
text: e.createText,
|
|
@@ -985,7 +993,7 @@ const Sl = (l, t, r = !0) => H(new K(l, t).setIsSortable(r)), Vl = (l, t, r, n =
|
|
|
985
993
|
}
|
|
986
994
|
}), $l = {
|
|
987
995
|
install: (l) => {
|
|
988
|
-
l.component("lkt-loader") === void 0 && l.use(mt), l.component("lkt-button") === void 0 && l.use(ft), l.component("lkt-paginator") === void 0 && l.use(pt), l.component("lkt-field-text") === void 0 && l.use(vt), l.component("lkt-field-textarea") === void 0 && l.use(ht), l.component("lkt-field-select") === void 0 && l.use(yt), l.component("lkt-field-switch") === void 0 && l.use(kt), l.component("lkt-field-file") === void 0 && l.use(bt), l.component("lkt-table") === void 0 && l.component("lkt-table",
|
|
996
|
+
l.component("lkt-loader") === void 0 && l.use(mt), l.component("lkt-button") === void 0 && l.use(ft), l.component("lkt-paginator") === void 0 && l.use(pt), l.component("lkt-field-text") === void 0 && l.use(vt), l.component("lkt-field-textarea") === void 0 && l.use(ht), l.component("lkt-field-select") === void 0 && l.use(yt), l.component("lkt-field-switch") === void 0 && l.use(kt), l.component("lkt-field-file") === void 0 && l.use(bt), l.component("lkt-table") === void 0 && l.component("lkt-table", ul);
|
|
989
997
|
}
|
|
990
998
|
}, Al = (l) => (R.navButtonSlot = l, !0), Rl = (l) => (R.dropButtonSlot = l, !0), Ol = (l) => (R.createButtonSlot = l, !0);
|
|
991
999
|
export {
|
package/package.json
CHANGED
|
@@ -64,6 +64,7 @@ const props = withDefaults(defineProps<{
|
|
|
64
64
|
addNavigation?: boolean
|
|
65
65
|
itemMode?: boolean
|
|
66
66
|
createEnabledValidator?: Function
|
|
67
|
+
newValueGenerator?: Function
|
|
67
68
|
}>(), {
|
|
68
69
|
modelValue: () => [],
|
|
69
70
|
columns: () => [],
|
|
@@ -109,6 +110,7 @@ const props = withDefaults(defineProps<{
|
|
|
109
110
|
addNavigation: false,
|
|
110
111
|
itemMode: false,
|
|
111
112
|
createEnabledValidator: undefined,
|
|
113
|
+
newValueGenerator: undefined,
|
|
112
114
|
});
|
|
113
115
|
|
|
114
116
|
const hiddenColumnsStack: LktObject = {};
|
|
@@ -325,6 +327,14 @@ const getItemByEvent = (e: any) => {
|
|
|
325
327
|
return true;
|
|
326
328
|
},
|
|
327
329
|
onClickAddItem = () => {
|
|
330
|
+
if (typeof props.newValueGenerator === 'function') {
|
|
331
|
+
let newValue = props.newValueGenerator();
|
|
332
|
+
|
|
333
|
+
if (typeof newValue === 'object') {
|
|
334
|
+
Items.value.push(newValue);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
328
338
|
Items.value.push({});
|
|
329
339
|
},
|
|
330
340
|
onButtonLoading = () => {
|