lkt-table 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.js CHANGED
@@ -1,19 +1,19 @@
1
- import { reactive as _, defineComponent as Q, ref as S, watch as N, nextTick as re, computed as c, resolveComponent as M, openBlock as s, createBlock as b, withCtx as O, createTextVNode as G, toDisplayString as F, unref as B, createElementBlock as f, Fragment as E, withModifiers as lt, resolveDynamicComponent as x, createElementVNode as V, normalizeClass as ne, createCommentVNode as g, createVNode as Y, renderList as j, renderSlot as W, withDirectives as te, vShow as le, useSlots as ot, onMounted as at, createSlots as Be } from "vue";
2
- import { httpCall as nt } from "lkt-http-client";
1
+ import { reactive as H, defineComponent as G, ref as C, watch as U, nextTick as de, computed as f, resolveComponent as $, openBlock as s, createBlock as b, withCtx as F, createTextVNode as le, toDisplayString as j, unref as E, createElementBlock as m, Fragment as A, withModifiers as at, resolveDynamicComponent as Z, createCommentVNode as y, normalizeClass as te, createElementVNode as B, createVNode as X, renderList as P, renderSlot as N, withDirectives as x, vShow as ee, useSlots as nt, onMounted as st, createSlots as Be } from "vue";
2
+ import { httpCall as ut } from "lkt-http-client";
3
3
  import { __ as q } from "lkt-i18n";
4
- import { createLktEvent as de } from "lkt-events";
5
- import { generateRandomString as st, replaceAll as ut } from "lkt-string-tools";
6
- import { DataState as it } from "lkt-data-state";
7
- import rt from "sortablejs";
8
- import dt from "lkt-loader";
9
- import mt from "lkt-button";
10
- import ct from "lkt-paginator";
11
- import ft from "lkt-field-text";
12
- import pt from "lkt-field-textarea";
13
- import vt from "lkt-field-select";
14
- import ht from "lkt-field-switch";
15
- import yt from "lkt-field-file";
16
- class U {
4
+ import { createLktEvent as ce } from "lkt-events";
5
+ import { generateRandomString as it, replaceAll as rt } from "lkt-string-tools";
6
+ import { DataState as dt } from "lkt-data-state";
7
+ import ct from "sortablejs";
8
+ import mt from "lkt-loader";
9
+ import ft from "lkt-button";
10
+ import pt from "lkt-paginator";
11
+ import vt from "lkt-field-text";
12
+ import ht from "lkt-field-textarea";
13
+ import yt from "lkt-field-select";
14
+ import kt from "lkt-field-switch";
15
+ import bt from "lkt-field-file";
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 = "";
19
19
  }
@@ -102,7 +102,7 @@ class U {
102
102
  if (!this.resource) return this;
103
103
  try {
104
104
  this.isLoading = !0;
105
- const t = await nt(this.resource, this.resourceData);
105
+ const t = await ut(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,52 +155,52 @@ class U {
155
155
  return this.isForRowKey = t, this;
156
156
  }
157
157
  }
158
- const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n = !0) => _(new U(l, t).setIsSortable(n).defineAsLink(r)), Sl = (l, t, r, n = !0) => _(new U(l, t).setIsSortable(n).defineAsAction(r)), Vl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsText()), Dl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsEmail()), wl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsTel()), Tl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsCheck()), Bl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsSwitch()), El = (l, t, r, n = !0) => _(new U(l, t).setIsSortable(n).defineAsSelect(r)), Ll = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).setIsHidden(!0)), Ee = (l, t, r, n) => {
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 i = l[r.key], o = t[r.key];
160
+ let u = l[r.key], o = t[r.key];
161
161
  if (n === "asc") {
162
- if (i > o) return 1;
163
- if (o > i) return -1;
162
+ if (u > o) return 1;
163
+ if (o > u) return -1;
164
164
  } else {
165
- if (i > o) return -1;
166
- if (o > i) return 1;
165
+ if (u > o) return -1;
166
+ if (o > u) return 1;
167
167
  }
168
168
  return 0;
169
- }, Z = (l, t, r, n = []) => {
169
+ }, Y = (l, t, r, n = []) => {
170
170
  if (l.extractTitleFromColumn) {
171
- let i = n.find((o) => o.key === l.extractTitleFromColumn);
172
- if (i)
173
- return Z(i, t, r, n);
171
+ let u = n.find((o) => o.key === l.extractTitleFromColumn);
172
+ if (u)
173
+ return Y(u, t, r, n);
174
174
  }
175
175
  if (l.formatter && typeof l.formatter == "function") {
176
- let i = l.formatter(t[l.key], t, l, r);
177
- return i.startsWith("__:") ? q(i.substring(3)) : i;
176
+ let u = l.formatter(t[l.key], t, l, r);
177
+ return u.startsWith("__:") ? q(u.substring(3)) : u;
178
178
  }
179
179
  return t[l.key];
180
- }, kt = (l, t, r) => {
180
+ }, gt = (l, t, r) => {
181
181
  if (!l.colspan) return -1;
182
182
  let n = t;
183
- return r.forEach((i) => {
184
- let o = me(l, i);
183
+ return r.forEach((u) => {
184
+ let o = me(l, u);
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, bt = (l, t, r) => {
187
+ }, me = (l, t) => l.colspan === !1 ? !1 : typeof l.colspan == "function" ? l.colspan(t) : l.colspan, Ct = (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
- }, gt = (l = []) => {
191
+ }, St = (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
- }, Ct = (l, t) => {
197
+ }, Vt = (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];
201
201
  }
202
202
  return null;
203
- }, Ie = /* @__PURE__ */ Q({
203
+ }, Le = /* @__PURE__ */ G({
204
204
  __name: "LktTableCell",
205
205
  props: {
206
206
  modelValue: { default: () => ({}) },
@@ -211,31 +211,31 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
211
211
  },
212
212
  emits: ["update:modelValue"],
213
213
  setup(l, { emit: t }) {
214
- const r = t, n = l, i = S(n.modelValue), o = S(i.value[n.column.key]), h = S(null), C = S(n.column.showLoading());
215
- N(o, (a) => {
216
- const u = JSON.parse(JSON.stringify(i.value));
217
- u[n.column.key] = a, r("update:modelValue", u);
218
- }), N(() => n.modelValue, (a) => {
219
- i.value = a, o.value = i.value[n.column.key];
220
- }), N(() => n.column, () => {
221
- n.column.resourceLoaded && re(() => C.value = !1);
214
+ const r = t, n = l, u = C(n.modelValue), o = C(u.value[n.column.key]), h = C(null), g = C(n.column.showLoading());
215
+ U(o, (a) => {
216
+ const i = JSON.parse(JSON.stringify(u.value));
217
+ i[n.column.key] = a, r("update:modelValue", i);
218
+ }), U(() => n.modelValue, (a) => {
219
+ u.value = a, o.value = u.value[n.column.key];
220
+ }), U(() => n.column, () => {
221
+ n.column.resourceLoaded && de(() => g.value = !1);
222
222
  }, { deep: !0 }), n.column.hasToLoadResource() && n.column.loadResource();
223
- const v = c(() => ({ ...n.column.slotData, item: i.value }));
224
- return (a, u) => {
225
- const P = M("router-link"), J = M("lkt-field-text"), d = M("lkt-field-switch"), $ = M("lkt-field-file"), H = M("lkt-loader"), y = M("lkt-field-select");
226
- return a.column.type === "link" ? (s(), b(P, {
223
+ const v = f(() => ({ ...n.column.slotData, item: u.value }));
224
+ return (a, i) => {
225
+ const W = $("lkt-anchor"), J = $("lkt-field-text"), d = $("lkt-field-switch"), I = $("lkt-field-file"), S = $("lkt-loader"), V = $("lkt-field-select");
226
+ return a.column.type === "link" ? (s(), b(W, {
227
227
  key: 0,
228
- to: a.column.getHref(i.value)
228
+ to: a.column.getHref(u.value)
229
229
  }, {
230
- default: O(() => [
231
- G(F(B(Z)(a.column, i.value, a.i)), 1)
230
+ default: F(() => [
231
+ le(j(E(Y)(a.column, u.value, a.i)), 1)
232
232
  ]),
233
233
  _: 1
234
- }, 8, ["to"])) : a.column.type === "action" ? (s(), f("a", {
234
+ }, 8, ["to"])) : a.column.type === "action" ? (s(), m("a", {
235
235
  key: 1,
236
236
  href: "#",
237
- onClick: u[0] || (u[0] = (p) => a.column.doAction(i.value))
238
- }, F(B(Z)(a.column, i.value, a.i)), 1)) : a.column.type === "text" ? (s(), b(J, {
237
+ onClick: i[0] || (i[0] = (p) => a.column.doAction(u.value))
238
+ }, j(E(Y)(a.column, u.value, a.i)), 1)) : a.column.type === "text" ? (s(), b(J, {
239
239
  key: 2,
240
240
  "read-mode": !a.column.editable || !a.editModeEnabled,
241
241
  ref: (p) => h.value = p,
@@ -243,7 +243,7 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
243
243
  "value-slot": a.column.valueSlot,
244
244
  "slot-data": v.value,
245
245
  modelValue: o.value,
246
- "onUpdate:modelValue": u[1] || (u[1] = (p) => o.value = p)
246
+ "onUpdate:modelValue": i[1] || (i[1] = (p) => o.value = p)
247
247
  }, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "email" ? (s(), b(J, {
248
248
  key: 3,
249
249
  "read-mode": !a.column.editable || !a.editModeEnabled,
@@ -253,7 +253,7 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
253
253
  "slot-data": v.value,
254
254
  "is-email": "",
255
255
  modelValue: o.value,
256
- "onUpdate:modelValue": u[2] || (u[2] = (p) => o.value = p)
256
+ "onUpdate:modelValue": i[2] || (i[2] = (p) => o.value = p)
257
257
  }, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "tel" ? (s(), b(J, {
258
258
  key: 4,
259
259
  "read-mode": !a.column.editable || !a.editModeEnabled,
@@ -263,33 +263,33 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
263
263
  "slot-data": v.value,
264
264
  "is-tel": "",
265
265
  modelValue: o.value,
266
- "onUpdate:modelValue": u[3] || (u[3] = (p) => o.value = p)
266
+ "onUpdate:modelValue": i[3] || (i[3] = (p) => o.value = p)
267
267
  }, null, 8, ["read-mode", "edit-slot", "value-slot", "slot-data", "modelValue"])) : a.column.type === "check" ? (s(), 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
- "onUpdate:modelValue": u[4] || (u[4] = (p) => o.value = p)
273
+ "onUpdate:modelValue": i[4] || (i[4] = (p) => o.value = p)
274
274
  }, null, 8, ["read-mode", "modelValue"])) : a.column.type === "switch" ? (s(), 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
- "onUpdate:modelValue": u[5] || (u[5] = (p) => o.value = p)
280
- }, null, 8, ["read-mode", "modelValue"])) : a.column.type === "file" ? (s(), b($, {
279
+ "onUpdate:modelValue": i[5] || (i[5] = (p) => o.value = p)
280
+ }, null, 8, ["read-mode", "modelValue"])) : a.column.type === "file" ? (s(), b(I, {
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
- "onUpdate:modelValue": u[6] || (u[6] = (p) => o.value = p)
286
- }, null, 8, ["read-mode", "modelValue"])) : a.column.type === "select" ? (s(), f(E, { key: 8 }, [
287
- C.value ? (s(), b(H, { key: 0 })) : (s(), b(y, {
285
+ "onUpdate:modelValue": i[6] || (i[6] = (p) => o.value = p)
286
+ }, null, 8, ["read-mode", "modelValue"])) : a.column.type === "select" ? (s(), m(A, { key: 8 }, [
287
+ g.value ? (s(), b(S, { key: 0 })) : (s(), b(V, {
288
288
  key: 1,
289
289
  "read-mode": !a.column.editable || !a.editModeEnabled,
290
290
  ref: (p) => h.value = p,
291
291
  modelValue: o.value,
292
- "onUpdate:modelValue": u[7] || (u[7] = (p) => o.value = p),
292
+ "onUpdate:modelValue": i[7] || (i[7] = (p) => o.value = p),
293
293
  "slot-data": v.value,
294
294
  resource: a.column.resource,
295
295
  "use-resource-slot": a.column.resourceSlot ? a.column.resourceSlot : a.column.resource,
@@ -300,57 +300,57 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (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)) : (s(), f(E, { key: 9 }, [
304
- G(F(B(Z)(a.column, i.value, a.i, a.columns)), 1)
303
+ ], 64)) : (s(), m(A, { key: 9 }, [
304
+ le(j(E(Y)(a.column, u.value, a.i, a.columns)), 1)
305
305
  ], 64));
306
306
  };
307
307
  }
308
- }), A = {
308
+ }), R = {
309
309
  navButtonSlot: "",
310
310
  dropButtonSlot: "",
311
311
  createButtonSlot: ""
312
- }, St = /* @__PURE__ */ V("i", { class: "" }, null, -1), Vt = /* @__PURE__ */ Q({
312
+ }, Dt = /* @__PURE__ */ G({
313
313
  __name: "DropButton",
314
314
  props: {
315
315
  disabled: { type: Boolean, default: !1 },
316
316
  text: { default: "" },
317
+ icon: { default: "" },
317
318
  confirm: { default: "" },
318
319
  resource: { default: "" },
319
320
  resourceData: { default: () => ({}) }
320
321
  },
321
322
  emits: ["click"],
322
323
  setup(l, { emit: t }) {
323
- const r = t, n = l, i = c(() => A.dropButtonSlot !== ""), o = c(() => A.dropButtonSlot), h = c(() => n.text.startsWith("__:") ? q(n.text.substring(3)) : n.text);
324
- return (C, v) => {
325
- const a = M("lkt-button");
324
+ const r = t, n = l, u = f(() => R.dropButtonSlot !== ""), o = f(() => R.dropButtonSlot), h = f(() => n.text.startsWith("__:") ? q(n.text.substring(3)) : n.text);
325
+ return (g, v) => {
326
+ const a = $("lkt-button");
326
327
  return s(), b(a, {
327
328
  palette: "table-delete",
328
- resource: C.resource,
329
- "resource-data": C.resourceData,
330
- "confirm-modal": C.confirm,
331
- disabled: C.disabled,
332
- onClick: v[0] || (v[0] = lt((u) => r("click"), ["prevent", "stop"]))
329
+ icon: u.value ? "" : g.icon,
330
+ text: u.value ? "" : h.value,
331
+ resource: g.resource,
332
+ "resource-data": g.resourceData,
333
+ "confirm-modal": g.confirm,
334
+ disabled: g.disabled,
335
+ onClick: v[0] || (v[0] = at((i) => r("click"), ["prevent", "stop"]))
333
336
  }, {
334
- default: O(() => [
335
- i.value ? (s(), b(x(o.value), { key: 0 })) : (s(), f(E, { key: 1 }, [
336
- St,
337
- G(" " + F(h.value), 1)
338
- ], 64))
337
+ default: F(() => [
338
+ u.value ? (s(), b(Z(o.value), { key: 0 })) : y("", !0)
339
339
  ]),
340
340
  _: 1
341
- }, 8, ["resource", "resource-data", "confirm-modal", "disabled"]);
341
+ }, 8, ["icon", "text", "resource", "resource-data", "confirm-modal", "disabled"]);
342
342
  };
343
343
  }
344
- }), Dt = ["data-i", "data-draggable"], wt = {
344
+ }), wt = ["data-i", "data-draggable"], Tt = {
345
345
  key: 1,
346
346
  "data-role": "invalid-drag-indicator"
347
- }, Tt = {
347
+ }, Bt = {
348
348
  key: 2,
349
349
  class: "lkt-table-nav-cell"
350
- }, Bt = { class: "lkt-table-nav-container" }, Et = /* @__PURE__ */ V("i", { class: "" }, null, -1), Lt = /* @__PURE__ */ V("i", { class: "" }, null, -1), It = ["data-column", "colspan", "title", "onClick"], Mt = {
350
+ }, Et = { class: "lkt-table-nav-container" }, It = /* @__PURE__ */ B("i", { class: "" }, null, -1), Lt = /* @__PURE__ */ B("i", { class: "" }, null, -1), Mt = ["data-column", "colspan", "title", "onClick"], $t = {
351
351
  key: 4,
352
352
  class: "lkt-table-col-drop"
353
- }, $t = /* @__PURE__ */ Q({
353
+ }, At = /* @__PURE__ */ G({
354
354
  __name: "LktTableRow",
355
355
  props: {
356
356
  modelValue: { default: () => ({}) },
@@ -367,119 +367,121 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
367
367
  emptyColumns: { default: () => [] },
368
368
  dropConfirm: { default: "" },
369
369
  dropText: { default: "" },
370
+ dropIcon: { default: "" },
370
371
  dropResource: { default: "" }
371
372
  },
372
373
  emits: ["update:modelValue", "click", "show", "item-up", "item-down", "item-drop"],
373
374
  setup(l, { emit: t }) {
374
- const r = t, n = l, i = S(n.modelValue), o = (d, $, H) => {
375
- r("click", d, de("", { item: $, column: H }));
376
- }, h = (d, $) => {
377
- r("show", d, de("", { i: $ }));
378
- }, C = c(() => {
375
+ const r = t, n = l, u = C(n.modelValue), o = (d, I, S) => {
376
+ r("click", d, ce("", { item: I, column: S }));
377
+ }, h = (d, I) => {
378
+ r("show", d, ce("", { i: I }));
379
+ }, g = f(() => {
379
380
  let d = [];
380
381
  return n.sortable && n.isDraggable && d.push("handle"), d.join(" ");
381
- }), v = c(() => A.navButtonSlot !== ""), a = c(() => A.navButtonSlot);
382
- c(() => A.dropButtonSlot !== ""), c(() => A.dropButtonSlot);
383
- const u = () => {
382
+ }), v = f(() => R.navButtonSlot !== ""), a = f(() => R.navButtonSlot);
383
+ f(() => R.dropButtonSlot !== ""), f(() => R.dropButtonSlot);
384
+ const i = () => {
384
385
  r("item-up", n.i);
385
- }, P = () => {
386
+ }, W = () => {
386
387
  r("item-down", n.i);
387
388
  }, J = () => {
388
389
  r("item-drop", n.i);
389
390
  };
390
- return N(() => n.modelValue, (d) => i.value = d), N(i, (d) => {
391
+ return U(() => n.modelValue, (d) => u.value = d), U(u, (d) => {
391
392
  r("update:modelValue", d, n.i);
392
- }, { deep: !0 }), (d, $) => {
393
- const H = M("lkt-button");
394
- return s(), f("tr", {
393
+ }, { deep: !0 }), (d, I) => {
394
+ const S = $("lkt-button");
395
+ return s(), m("tr", {
395
396
  "data-i": d.i,
396
397
  "data-draggable": d.isDraggable
397
398
  }, [
398
- d.sortable && d.isDraggable && d.editModeEnabled ? (s(), f("td", {
399
+ d.sortable && d.isDraggable && d.editModeEnabled ? (s(), m("td", {
399
400
  key: 0,
400
401
  "data-role": "drag-indicator",
401
- class: ne(C.value)
402
- }, null, 2)) : d.sortable && d.editModeEnabled ? (s(), f("td", wt)) : g("", !0),
403
- d.addNavigation && d.editModeEnabled ? (s(), f("td", Tt, [
404
- V("div", Bt, [
405
- Y(H, {
402
+ class: te(g.value)
403
+ }, null, 2)) : d.sortable && d.editModeEnabled ? (s(), m("td", Tt)) : y("", !0),
404
+ d.addNavigation && d.editModeEnabled ? (s(), m("td", Bt, [
405
+ B("div", Et, [
406
+ X(S, {
406
407
  palette: "table-nav",
407
408
  disabled: d.i === 0,
408
- onClick: u
409
+ onClick: i
409
410
  }, {
410
- default: O(() => [
411
- v.value ? (s(), b(x(a.value), {
411
+ default: F(() => [
412
+ v.value ? (s(), b(Z(a.value), {
412
413
  key: 0,
413
414
  direction: "up"
414
- })) : (s(), f(E, { key: 1 }, [
415
- Et,
416
- G(" UP ")
415
+ })) : (s(), m(A, { key: 1 }, [
416
+ It,
417
+ le(" UP ")
417
418
  ], 64))
418
419
  ]),
419
420
  _: 1
420
421
  }, 8, ["disabled"]),
421
- Y(H, {
422
+ X(S, {
422
423
  palette: "table-nav",
423
424
  disabled: d.latestRow,
424
- onClick: P
425
+ onClick: W
425
426
  }, {
426
- default: O(() => [
427
- v.value ? (s(), b(x(a.value), {
427
+ default: F(() => [
428
+ v.value ? (s(), b(Z(a.value), {
428
429
  key: 0,
429
430
  direction: "down"
430
- })) : (s(), f(E, { key: 1 }, [
431
+ })) : (s(), m(A, { key: 1 }, [
431
432
  Lt,
432
- G(" DOWN ")
433
+ le(" DOWN ")
433
434
  ], 64))
434
435
  ]),
435
436
  _: 1
436
437
  }, 8, ["disabled"])
437
438
  ])
438
- ])) : g("", !0),
439
- d.displayHiddenColumnsIndicator ? (s(), f("td", {
439
+ ])) : y("", !0),
440
+ d.displayHiddenColumnsIndicator ? (s(), m("td", {
440
441
  key: 3,
441
- onClick: $[0] || ($[0] = (y) => h(y, d.i)),
442
+ onClick: I[0] || (I[0] = (V) => h(V, d.i)),
442
443
  "data-role": "show-more",
443
- class: ne(d.hiddenIsVisible ? "state-open" : "")
444
- }, null, 2)) : g("", !0),
445
- (s(!0), f(E, null, j(d.visibleColumns, (y) => (s(), f(E, null, [
446
- B(bt)(y, d.emptyColumns, i.value) ? (s(), f("td", {
444
+ class: te(d.hiddenIsVisible ? "state-open" : "")
445
+ }, null, 2)) : y("", !0),
446
+ (s(!0), m(A, null, P(d.visibleColumns, (V) => (s(), m(A, null, [
447
+ E(Ct)(V, d.emptyColumns, u.value) ? (s(), m("td", {
447
448
  key: 0,
448
- "data-column": y.key,
449
- colspan: B(me)(y, i.value),
450
- title: B(Z)(y, i.value, d.i, d.visibleColumns),
451
- onClick: (p) => o(p, i.value, y)
449
+ "data-column": V.key,
450
+ colspan: E(me)(V, u.value),
451
+ title: E(Y)(V, u.value, d.i, d.visibleColumns),
452
+ onClick: (p) => o(p, u.value, V)
452
453
  }, [
453
- d.$slots[y.key] ? W(d.$slots, y.key, {
454
+ d.$slots[V.key] ? N(d.$slots, V.key, {
454
455
  key: 0,
455
- value: i.value[y.key],
456
- item: i.value,
457
- column: y,
456
+ value: u.value[V.key],
457
+ item: u.value,
458
+ column: V,
458
459
  i: d.i
459
- }) : i.value ? (s(), b(Ie, {
460
+ }) : u.value ? (s(), b(Le, {
460
461
  key: 1,
461
- modelValue: i.value,
462
- "onUpdate:modelValue": $[1] || ($[1] = (p) => i.value = p),
463
- column: y,
462
+ modelValue: u.value,
463
+ "onUpdate:modelValue": I[1] || (I[1] = (p) => u.value = p),
464
+ column: V,
464
465
  columns: d.visibleColumns,
465
466
  "edit-mode-enabled": d.editModeEnabled,
466
467
  i: d.i
467
- }, null, 8, ["modelValue", "column", "columns", "edit-mode-enabled", "i"])) : g("", !0)
468
- ], 8, It)) : g("", !0)
468
+ }, null, 8, ["modelValue", "column", "columns", "edit-mode-enabled", "i"])) : y("", !0)
469
+ ], 8, Mt)) : y("", !0)
469
470
  ], 64))), 256)),
470
- d.canDrop && d.editModeEnabled ? (s(), f("td", Mt, [
471
- Y(Vt, {
471
+ d.canDrop && d.editModeEnabled ? (s(), m("td", $t, [
472
+ X(Dt, {
472
473
  resource: d.dropResource,
473
- "resource-data": i.value,
474
+ "resource-data": u.value,
474
475
  confirm: d.dropConfirm,
475
476
  text: d.dropText,
477
+ icon: d.dropIcon,
476
478
  onClick: J
477
- }, null, 8, ["resource", "resource-data", "confirm", "text"])
478
- ])) : g("", !0)
479
- ], 8, Dt);
479
+ }, null, 8, ["resource", "resource-data", "confirm", "text", "icon"])
480
+ ])) : y("", !0)
481
+ ], 8, wt);
480
482
  };
481
483
  }
482
- }), At = { "data-role": "hidden-row" }, Rt = ["colspan"], Ot = ["data-column"], Nt = ["data-i"], Ft = ["data-column", "title", "onClick"], _t = /* @__PURE__ */ Q({
484
+ }), Rt = { "data-role": "hidden-row" }, Ot = ["colspan"], Nt = ["data-column"], Ft = ["data-i"], Ut = ["data-column", "title", "onClick"], Ht = /* @__PURE__ */ G({
483
485
  __name: "LktHiddenRow",
484
486
  props: {
485
487
  modelValue: { default: () => ({}) },
@@ -494,74 +496,74 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
494
496
  },
495
497
  emits: ["update:modelValue", "click"],
496
498
  setup(l, { emit: t }) {
497
- const r = t, n = l, i = S(n.modelValue), o = (h, C, v) => {
498
- r("click", h, de("", { item: C, column: v }));
499
+ const r = t, n = l, u = C(n.modelValue), o = (h, g, v) => {
500
+ r("click", h, ce("", { item: g, column: v }));
499
501
  };
500
- return N(() => n.modelValue, (h) => i.value = h), N(i, () => r("update:modelValue", i.value)), (h, C) => te((s(), f("tr", At, [
501
- V("td", { colspan: h.hiddenColumnsColSpan }, [
502
- V("table", null, [
503
- V("tr", null, [
504
- (s(!0), f(E, null, j(h.hiddenColumns, (v) => (s(), f("th", {
502
+ return U(() => n.modelValue, (h) => u.value = h), U(u, () => r("update:modelValue", u.value)), (h, g) => x((s(), m("tr", Rt, [
503
+ B("td", { colspan: h.hiddenColumnsColSpan }, [
504
+ B("table", null, [
505
+ B("tr", null, [
506
+ (s(!0), m(A, null, P(h.hiddenColumns, (v) => (s(), m("th", {
505
507
  "data-column": v.key
506
508
  }, [
507
- V("div", null, F(v.label), 1)
508
- ], 8, Ot))), 256))
509
+ B("div", null, j(v.label), 1)
510
+ ], 8, Nt))), 256))
509
511
  ]),
510
- V("tr", { "data-i": h.i }, [
511
- (s(!0), f(E, null, j(h.hiddenColumns, (v, a) => (s(), f("td", {
512
+ B("tr", { "data-i": h.i }, [
513
+ (s(!0), m(A, null, P(h.hiddenColumns, (v, a) => (s(), m("td", {
512
514
  "data-column": v.key,
513
- title: B(Z)(v, i.value, a, h.hiddenColumns),
514
- onClick: (u) => o(u, i.value, v)
515
+ title: E(Y)(v, u.value, a, h.hiddenColumns),
516
+ onClick: (i) => o(i, u.value, v)
515
517
  }, [
516
- h.$slots[v.key] ? W(h.$slots, v.key, {
518
+ h.$slots[v.key] ? N(h.$slots, v.key, {
517
519
  key: 0,
518
- value: i.value[v.key],
519
- item: i.value,
520
+ value: u.value[v.key],
521
+ item: u.value,
520
522
  column: v,
521
523
  i: a
522
- }) : (s(), b(Ie, {
524
+ }) : (s(), b(Le, {
523
525
  key: 1,
524
526
  column: v,
525
527
  columns: h.hiddenColumns,
526
- modelValue: i.value,
527
- "onUpdate:modelValue": C[0] || (C[0] = (u) => i.value = u),
528
+ modelValue: u.value,
529
+ "onUpdate:modelValue": g[0] || (g[0] = (i) => u.value = i),
528
530
  i: a
529
531
  }, null, 8, ["column", "columns", "modelValue", "i"]))
530
- ], 8, Ft))), 256))
531
- ], 8, Nt)
532
+ ], 8, Ut))), 256))
533
+ ], 8, Ft)
532
534
  ])
533
- ], 8, Rt)
535
+ ], 8, Ot)
534
536
  ], 512)), [
535
- [le, h.hiddenIsVisible]
537
+ [ee, h.hiddenIsVisible]
536
538
  ]);
537
539
  }
538
- }), Ut = /* @__PURE__ */ V("i", { class: "" }, null, -1), Le = /* @__PURE__ */ Q({
540
+ }), Ie = /* @__PURE__ */ G({
539
541
  __name: "CreateButton",
540
542
  props: {
541
543
  disabled: { type: Boolean, default: !1 },
542
- text: { type: Boolean, default: "" }
544
+ text: { default: "" },
545
+ icon: { default: "" }
543
546
  },
544
547
  emits: ["click"],
545
548
  setup(l, { emit: t }) {
546
- const r = t, n = l, i = c(() => A.createButtonSlot !== ""), o = c(() => A.createButtonSlot), h = c(() => n.text.startsWith("__:") ? q(n.text.substring(3)) : n.text);
547
- return (C, v) => {
548
- const a = M("lkt-button");
549
+ const r = t, n = l, u = f(() => R.createButtonSlot !== ""), o = f(() => R.createButtonSlot), h = f(() => n.text.startsWith("__:") ? q(n.text.substring(3)) : n.text);
550
+ return (g, v) => {
551
+ const a = $("lkt-button");
549
552
  return s(), b(a, {
550
553
  palette: "table-create",
551
- disabled: C.disabled,
552
- onClick: v[0] || (v[0] = (u) => r("click"))
554
+ disabled: g.disabled,
555
+ icon: u.value ? "" : g.icon,
556
+ text: u.value ? "" : h.value,
557
+ onClick: v[0] || (v[0] = (i) => r("click"))
553
558
  }, {
554
- default: O(() => [
555
- i.value ? (s(), b(x(o.value), { key: 0 })) : (s(), f(E, { key: 1 }, [
556
- Ut,
557
- G(" " + F(h.value), 1)
558
- ], 64))
559
+ default: F(() => [
560
+ u.value ? (s(), b(Z(o.value), { key: 0 })) : y("", !0)
559
561
  ]),
560
562
  _: 1
561
- }, 8, ["disabled"]);
563
+ }, 8, ["disabled", "icon", "text"]);
562
564
  };
563
565
  }
564
- }), Ht = ["data-column", "data-sortable", "data-sort", "colspan", "title"], Kt = /* @__PURE__ */ Q({
566
+ }), Kt = ["data-column", "data-sortable", "data-sort", "colspan", "title"], _t = /* @__PURE__ */ G({
565
567
  __name: "TableHeader",
566
568
  props: {
567
569
  column: { default: () => ({}) },
@@ -572,42 +574,42 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
572
574
  },
573
575
  emits: ["click"],
574
576
  setup(l, { emit: t }) {
575
- const r = t, n = l, i = c(() => kt(n.column, n.amountOfColumns, n.items)), o = c(() => n.column.sortable === !0), h = c(() => o.value && n.sortBy === n.column.key ? n.sortDirection : ""), C = c(() => n.column.label.startsWith("__:") ? q(n.column.label.substring(3)) : n.column.label), v = () => {
577
+ const r = t, n = l, u = 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("__:") ? q(n.column.label.substring(3)) : n.column.label), v = () => {
576
578
  r("click", n.column);
577
579
  };
578
- return (a, u) => (s(), f("th", {
580
+ return (a, i) => (s(), m("th", {
579
581
  "data-column": a.column.key,
580
582
  "data-sortable": o.value,
581
583
  "data-sort": h.value,
582
- colspan: i.value,
583
- title: C.value,
584
+ colspan: u.value,
585
+ title: g.value,
584
586
  onClick: v
585
587
  }, [
586
- V("div", null, F(C.value), 1)
587
- ], 8, Ht));
588
+ B("div", null, j(g.value), 1)
589
+ ], 8, Kt));
588
590
  }
589
- }), Wt = ["id"], Pt = { key: 0 }, jt = { class: "lkt-table-page-buttons" }, Jt = { key: 1 }, zt = { class: "switch-edition-mode" }, qt = {
591
+ }), Pt = ["id"], Wt = { key: 0 }, jt = { class: "lkt-table-page-buttons" }, Jt = { key: 1 }, zt = { class: "switch-edition-mode" }, qt = {
590
592
  key: 0,
591
593
  class: "lkt-table-page-buttons"
592
594
  }, Gt = {
593
595
  key: 1,
594
596
  class: "lkt-table-page-filters"
595
- }, Qt = ["data-sortable"], Xt = {
597
+ }, Qt = ["data-sortable"], Xt = { key: 0 }, Yt = {
596
598
  key: 0,
597
599
  "data-role": "drag-indicator"
598
- }, Yt = { key: 1 }, Zt = { key: 2 }, xt = {
600
+ }, Zt = { key: 1 }, xt = { key: 2 }, el = {
599
601
  key: 3,
600
602
  class: "lkt-table-col-drop"
601
- }, el = ["id"], tl = {
603
+ }, tl = ["id"], ll = { class: "lkt-table-item" }, ol = {
602
604
  key: 3,
603
605
  class: "lkt-empty-table"
604
- }, ll = {
606
+ }, al = {
605
607
  key: 4,
606
608
  class: "lkt-table-page-empty"
607
- }, ol = {
609
+ }, nl = {
608
610
  key: 5,
609
611
  class: "lkt-table-page-buttons lkt-table-page-buttons-bottom"
610
- }, al = /* @__PURE__ */ Q({
612
+ }, sl = /* @__PURE__ */ G({
611
613
  __name: "LktTable",
612
614
  props: {
613
615
  modelValue: { default: () => [] },
@@ -619,6 +621,7 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
619
621
  hideEmptyColumns: { type: Boolean, default: !1 },
620
622
  draggableItemKey: { default: "name" },
621
623
  page: { default: 1 },
624
+ perms: { default: [] },
622
625
  resource: { default: "" },
623
626
  noResultsText: { default: "No results" },
624
627
  title: { default: "" },
@@ -626,6 +629,7 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
626
629
  titleIcon: { default: "h2" },
627
630
  wrapContentTag: { default: "div" },
628
631
  wrapContentClass: { default: "" },
632
+ itemsContainerClass: { default: "" },
629
633
  filters: { default: () => [] },
630
634
  dataStateConfig: { default: () => ({}) },
631
635
  hiddenSave: { type: Boolean, default: !1 },
@@ -638,7 +642,9 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
638
642
  saveResourceData: { default: () => ({}) },
639
643
  saveText: { default: "Save" },
640
644
  createText: { default: "Add item" },
645
+ createIcon: { default: "" },
641
646
  dropText: { default: "Delete" },
647
+ dropIcon: { default: "" },
642
648
  editModeText: { default: "Edit mode" },
643
649
  switchEditionEnabled: { type: Boolean, default: !1 },
644
650
  canCreate: { type: Boolean, default: !1 },
@@ -646,310 +652,324 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
646
652
  dropConfirm: { default: "" },
647
653
  dropResource: { default: "" },
648
654
  addNavigation: { type: Boolean, default: !1 },
655
+ itemMode: { type: Boolean, default: !1 },
649
656
  createEnabledValidator: { type: Function, default: void 0 }
650
657
  },
651
658
  emits: ["update:modelValue", "sort", "click", "save", "error", "before-save"],
652
659
  setup(l, { expose: t, emit: r }) {
653
- const n = r, i = ot(), o = l, h = {}, C = S(typeof o.sorter == "function" ? o.sorter : Ee), v = S(gt(o.columns)), a = S("asc"), u = S(o.modelValue), P = S(h), J = S(null), d = S(o.columns);
654
- let $ = [];
655
- const H = S(o.page), y = S(!1), p = S(!1), ee = S($), ce = S(null), Me = S({}), X = S(new it({ items: u.value }, o.dataStateConfig)), L = S(o.editMode), $e = (e) => {
656
- console.log("onResults", e), Array.isArray(e) && (u.value = e), y.value = !1, p.value = !0, X.value.store({ items: u.value }).turnStoredIntoOriginal();
660
+ const n = r, u = 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), I = 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)), L = C(o.editMode), $e = (e) => {
661
+ Array.isArray(e) && (i.value = e), S.value = !1, V.value = !0, Q.value.store({ items: i.value }).turnStoredIntoOriginal();
657
662
  }, Ae = (e) => {
658
- ee.value = e;
659
- }, Re = () => re(() => y.value = !0), Oe = () => {
660
- ce.value.doRefresh();
661
- }, oe = st(12), se = c(() => {
663
+ p.value = e;
664
+ }, Re = () => de(() => S.value = !0), Oe = () => {
665
+ fe.value.doRefresh();
666
+ }, oe = it(12), se = f(() => {
662
667
  if (!o.hideEmptyColumns) return [];
663
668
  let e = [];
664
- return d.value.forEach((m) => {
665
- let k = m.key, w = !1;
666
- u.value.forEach((D) => {
669
+ return d.value.forEach((c) => {
670
+ let k = c.key, T = !1;
671
+ i.value.forEach((D) => {
667
672
  if (typeof D.checkEmpty == "function")
668
673
  return D.checkEmpty(D);
669
- D[k] && (w = !0);
670
- }), w || e.push(k);
674
+ D[k] && (T = !0);
675
+ }), T || e.push(k);
671
676
  }), e;
672
- }), ae = c(() => d.value.filter((e) => !e.hidden)), ue = c(() => d.value.filter((e) => e.hidden)), Ne = c(() => {
677
+ }), ae = f(() => d.value.filter((e) => !e.hidden)), ue = f(() => d.value.filter((e) => e.hidden)), Ne = f(() => {
673
678
  let e = ae.value.length + 1;
674
679
  return o.sortable && ++e, e;
675
- }), Fe = c(() => d.value.filter((e) => e.isForRowKey)), fe = c(() => ue.value.length > 0 && !o.sortable), _e = c(() => d.value.map((e) => e.key)), pe = c(() => {
680
+ }), Fe = f(() => d.value.filter((e) => e.isForRowKey)), pe = f(() => ue.value.length > 0 && !o.sortable), Ue = f(() => d.value.map((e) => e.key)), ve = f(() => {
676
681
  let e = [];
677
- for (let m in i) _e.value.indexOf(m) !== -1 && e.push(m);
682
+ for (let c in u) Ue.value.indexOf(c) !== -1 && e.push(c);
678
683
  return e;
679
- }), ve = c(() => o.hiddenSave || y.value || !o.saveResource ? !1 : L.value && X.value.changed() ? !0 : L.value), Ue = c(() => o.switchEditionEnabled ? !0 : ve.value || L.value && o.canCreate), He = c(() => o.saveDisabled || typeof o.saveValidator == "function" && !o.saveValidator(u.value) ? !1 : X.value.changed()), Ke = c(() => u.value.length), We = c(() => ({
680
- items: u.value,
684
+ }), he = f(() => o.hiddenSave || S.value || !o.saveResource ? !1 : L.value && Q.value.changed() ? !0 : L.value), He = f(() => o.switchEditionEnabled ? !0 : he.value || L.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
+ items: i.value,
681
686
  ...o.saveResourceData
682
- })), Pe = c(() => o.titleTag === "" ? "h2" : o.titleTag), je = c(() => o.wrapContentTag === "" ? "div" : o.wrapContentTag), ie = c(() => o.title.startsWith("__:") ? q(o.title.substring(3)) : o.title), Je = c(() => o.saveText.startsWith("__:") ? q(o.saveText.substring(3)) : o.saveText), ze = c(() => o.editModeText.startsWith("__:") ? q(o.editModeText.substring(3)) : o.editModeText);
683
- c(() => ee.value.includes("create")), c(() => ee.value.includes("read")), c(() => ee.value.includes("update"));
684
- const he = c(() => ee.value.includes("drop")), qe = (e) => {
685
- let m = e.target;
686
- if (typeof m.dataset.column > "u")
687
+ })), We = f(() => o.titleTag === "" ? "h2" : o.titleTag), je = f(() => o.wrapContentTag === "" ? "div" : o.wrapContentTag), ie = f(() => o.title.startsWith("__:") ? q(o.title.substring(3)) : o.title), Je = f(() => o.saveText.startsWith("__:") ? q(o.saveText.substring(3)) : o.saveText), ze = f(() => o.editModeText.startsWith("__:") ? q(o.editModeText.substring(3)) : o.editModeText), ne = f(() => p.value.includes("create")), qe = f(() => p.value.includes("read")), Ge = f(() => p.value.includes("update")), re = f(() => p.value.includes("drop")), Qe = (e) => {
688
+ let c = e.target;
689
+ if (typeof c.dataset.column > "u")
687
690
  do
688
- m = m.parentNode;
689
- while (typeof m.dataset.column > "u" && m.tagName !== "TABLE" && m.tagName !== "body");
690
- if (m.tagName === "TD" && (m = m.parentNode, m = m.dataset.i, typeof m < "u"))
691
- return u.value[m];
692
- }, ye = (e) => P.value["tr_" + e] === !0, ke = (e) => {
693
- e && e.sortable && (u.value = u.value.sort((m, k) => C.value(m, k, e, a.value)), a.value = a.value === "asc" ? "desc" : "asc", v.value = e.key, n("sort", [v.value, a.value]));
694
- }, be = (e, m) => {
695
- n("click", e, m);
696
- }, ge = (e, m) => {
697
- let k = "tr_" + m.value.i;
698
- P.value[k] = typeof P.value[k] > "u" ? !0 : !P.value[k];
691
+ c = c.parentNode;
692
+ while (typeof c.dataset.column > "u" && c.tagName !== "TABLE" && c.tagName !== "body");
693
+ if (c.tagName === "TD" && (c = c.parentNode, c = c.dataset.i, typeof c < "u"))
694
+ return i.value[c];
695
+ }, ye = (e) => W.value["tr_" + e] === !0, ke = (e) => {
696
+ 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]));
697
+ }, be = (e, c) => {
698
+ n("click", e, c);
699
+ }, ge = (e, c) => {
700
+ let k = "tr_" + c.value.i;
701
+ W.value[k] = typeof W.value[k] > "u" ? !0 : !W.value[k];
699
702
  }, Ce = () => {
700
703
  d.value.forEach((e) => {
701
704
  if (e.type === "select" && e.autoLoadSelectOptions) {
702
- let m = e.autoLoadSelectOptionsKey !== "" ? e.autoLoadSelectOptionsKey : e.key, k = [];
703
- u.value.forEach((D) => {
704
- Array.isArray(D[m]) && D[m].forEach((R) => k.push(R));
705
+ let c = e.autoLoadSelectOptionsKey !== "" ? e.autoLoadSelectOptionsKey : e.key, k = [];
706
+ i.value.forEach((D) => {
707
+ Array.isArray(D[c]) && D[c].forEach((O) => k.push(O));
705
708
  });
706
- let w = {};
709
+ let T = {};
707
710
  k = k.filter(function(D) {
708
- return w[D.value] ? !1 : (w[D.value] = !0, !0);
711
+ return T[D.value] ? !1 : (T[D.value] = !0, !0);
709
712
  }), e.setOptions(k);
710
713
  }
711
714
  });
712
- }, Ge = (e) => typeof o.checkValidDrag == "function" ? o.checkValidDrag(e) : !0, Se = (e) => typeof o.draggableChecker == "function" ? o.draggableChecker(e) : !0, Ve = () => {
713
- u.value.push({});
714
- }, Qe = () => {
715
- y.value = !0;
716
- }, Xe = () => {
717
- y.value = !1;
718
- }, Ye = (e, m) => {
719
- if (n("before-save"), o.saveResource && (y.value = !1, !m.success)) {
720
- n("error", m.httpStatus);
715
+ }, Xe = (e) => typeof o.checkValidDrag == "function" ? o.checkValidDrag(e) : !0, Se = (e) => typeof o.draggableChecker == "function" ? o.draggableChecker(e) : !0, Ve = () => {
716
+ i.value.push({});
717
+ }, Ye = () => {
718
+ S.value = !0;
719
+ }, Ze = () => {
720
+ S.value = !1;
721
+ }, xe = (e, c) => {
722
+ if (n("before-save"), o.saveResource && (S.value = !1, !c.success)) {
723
+ n("error", c.httpStatus);
721
724
  return;
722
725
  }
723
- X.value.turnStoredIntoOriginal(), n("save", m);
724
- }, De = (e, m, k) => {
726
+ Q.value.turnStoredIntoOriginal(), n("save", c);
727
+ }, De = (e, c, k) => {
725
728
  if (k >= e.length) {
726
- let w = k - e.length + 1;
727
- for (; w--; ) e.push(void 0);
729
+ let T = k - e.length + 1;
730
+ for (; T--; ) e.push(void 0);
728
731
  }
729
- return e.splice(k, 0, e.splice(m, 1)[0]), e;
730
- }, Ze = (e) => {
731
- De(u.value, e, e - 1);
732
- }, xe = (e) => {
733
- De(u.value, e, e + 1);
732
+ return e.splice(k, 0, e.splice(c, 1)[0]), e;
734
733
  }, et = (e) => {
735
- u.value.splice(e, 1);
736
- }, tt = () => {
734
+ De(i.value, e, e - 1);
735
+ }, tt = (e) => {
736
+ De(i.value, e, e + 1);
737
+ }, lt = (e) => {
738
+ i.value.splice(e, 1);
739
+ }, ot = () => {
737
740
  let e = document.getElementById("lkt-table-body-" + oe);
738
- Me.value = new rt(e, {
741
+ Me.value = new ct(e, {
739
742
  direction: "vertical",
740
743
  handle: ".handle",
741
744
  animation: 150,
742
- onEnd: function(m) {
743
- let k = m.oldIndex, w = m.newIndex, D = JSON.parse(JSON.stringify(u.value));
744
- u.value.splice(k, 1, D[w]), u.value.splice(w, 1, D[k]);
745
+ onEnd: function(c) {
746
+ let k = c.oldIndex, T = c.newIndex, D = JSON.parse(JSON.stringify(i.value));
747
+ i.value.splice(k, 1, D[T]), i.value.splice(T, 1, D[k]);
745
748
  },
746
- onMove: function(m, k) {
747
- return Ge(m);
749
+ onMove: function(c, k) {
750
+ return Xe(c);
748
751
  }
749
752
  });
750
- }, we = (e, m, k = !1) => {
751
- let w = [oe, "row", m];
752
- return k && w.push("hidden"), Fe.value.forEach((D) => {
753
- let R = String(e[D.key]).toLowerCase();
754
- R.length > 50 && (R = R.substring(0, 50)), R = ut(R, " ", "-"), w.push(R);
755
- }), w.join("-");
756
- }, Te = c(() => typeof o.createEnabledValidator == "function" ? o.createEnabledValidator({ items: u.value }) : !0);
757
- return at(() => {
758
- Ce(), ke(Ct(o.columns, v.value)), X.value.store({ items: u.value }).turnStoredIntoOriginal(), o.sortable && re(() => {
759
- tt();
753
+ }, we = (e, c, k = !1) => {
754
+ let T = [oe, "row", c];
755
+ return k && T.push("hidden"), Fe.value.forEach((D) => {
756
+ let O = String(e[D.key]).toLowerCase();
757
+ O.length > 50 && (O = O.substring(0, 50)), O = rt(O, " ", "-"), T.push(O);
758
+ }), T.join("-");
759
+ }, Te = f(() => typeof o.createEnabledValidator == "function" ? o.createEnabledValidator({ items: i.value }) : !0);
760
+ return st(() => {
761
+ Ce(), ke(Vt(o.columns, v.value)), Q.value.store({ items: i.value }).turnStoredIntoOriginal(), o.sortable && de(() => {
762
+ ot();
760
763
  });
761
- }), N(() => o.columns, (e) => d.value = e), N(() => o.modelValue, (e) => u.value = e), N(u, (e) => {
762
- Ce(), X.value.increment({ items: e }), n("update:modelValue", e);
764
+ }), U(() => o.columns, (e) => d.value = e), U(() => o.modelValue, (e) => i.value = e), U(i, (e) => {
765
+ Ce(), Q.value.increment({ items: e }), n("update:modelValue", e);
763
766
  }, { deep: !0 }), t({
764
- getItemByEvent: qe,
767
+ getItemByEvent: Qe,
765
768
  doRefresh: Oe
766
- }), (e, m) => {
767
- const k = M("lkt-button"), w = M("lkt-field-switch"), D = M("lkt-loader"), R = M("lkt-paginator");
768
- return s(), f("section", {
769
+ }), (e, c) => {
770
+ const k = $("lkt-button"), T = $("lkt-field-switch"), D = $("lkt-loader"), O = $("lkt-paginator");
771
+ return s(), m("section", {
769
772
  class: "lkt-table-page",
770
- id: "lkt-table-page-" + B(oe)
773
+ id: "lkt-table-page-" + E(oe)
771
774
  }, [
772
- ie.value || B(i).title ? (s(), f("header", Pt, [
773
- ie.value ? (s(), b(x(Pe.value), { key: 0 }, {
774
- default: O(() => [
775
- e.titleIcon ? (s(), f("i", {
775
+ ie.value || E(u).title ? (s(), m("header", Wt, [
776
+ ie.value ? (s(), b(Z(We.value), { key: 0 }, {
777
+ default: F(() => [
778
+ e.titleIcon ? (s(), m("i", {
776
779
  key: 0,
777
- class: ne(e.titleIcon)
778
- }, null, 2)) : g("", !0),
779
- G(" " + F(ie.value), 1)
780
+ class: te(e.titleIcon)
781
+ }, null, 2)) : y("", !0),
782
+ le(" " + j(ie.value), 1)
780
783
  ]),
781
784
  _: 1
782
- })) : g("", !0),
783
- B(i).title ? W(e.$slots, "title", { key: 1 }) : g("", !0)
784
- ])) : g("", !0),
785
- (s(), b(x(je.value), {
786
- class: ne(["lkt-table-page-content-wrapper", e.wrapContentClass])
785
+ })) : y("", !0),
786
+ E(u).title ? N(e.$slots, "title", { key: 1 }) : y("", !0)
787
+ ])) : y("", !0),
788
+ (s(), b(Z(je.value), {
789
+ class: te(["lkt-table-page-content-wrapper", e.wrapContentClass])
787
790
  }, {
788
- default: O(() => [
789
- te(V("div", jt, [
790
- te(Y(k, {
791
+ default: F(() => [
792
+ x(B("div", jt, [
793
+ x(X(k, {
791
794
  ref: "saveButton",
792
795
  palette: "success",
793
- disabled: !He.value,
796
+ disabled: !Ke.value,
794
797
  "confirm-modal": e.saveConfirm,
795
798
  "confirm-data": e.confirmData,
796
799
  resource: e.saveResource,
797
- "resource-data": We.value,
798
- onLoading: Qe,
799
- onLoaded: Xe,
800
- onClick: Ye
800
+ "resource-data": Pe.value,
801
+ onLoading: Ye,
802
+ onLoaded: Ze,
803
+ onClick: xe
801
804
  }, {
802
- default: O(() => [
803
- B(i)["button-save"] ? W(e.$slots, "button-save", {
805
+ default: F(() => [
806
+ E(u)["button-save"] ? N(e.$slots, "button-save", {
804
807
  key: 0,
805
- items: u.value,
808
+ items: i.value,
806
809
  editMode: e.editMode,
807
810
  canUpdate: !e.saveDisabled
808
- }) : (s(), f("span", Jt, F(Je.value), 1))
811
+ }) : (s(), m("span", Jt, j(Je.value), 1))
809
812
  ]),
810
813
  _: 3
811
814
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
812
- [le, ve.value]
815
+ [ee, he.value]
813
816
  ]),
814
- e.canCreate && L.value ? (s(), b(Le, {
817
+ e.canCreate && ne.value && L.value ? (s(), b(Ie, {
815
818
  key: 0,
816
819
  disabled: !Te.value,
817
820
  text: e.createText,
821
+ icon: e.createIcon,
818
822
  onClick: Ve
819
- }, null, 8, ["disabled", "text"])) : g("", !0),
820
- V("div", zt, [
821
- te(Y(w, {
823
+ }, null, 8, ["disabled", "text", "icon"])) : y("", !0),
824
+ B("div", zt, [
825
+ x(X(T, {
822
826
  modelValue: L.value,
823
- "onUpdate:modelValue": m[0] || (m[0] = (T) => L.value = T),
827
+ "onUpdate:modelValue": c[0] || (c[0] = (w) => L.value = w),
824
828
  label: ze.value
825
829
  }, null, 8, ["modelValue", "label"]), [
826
- [le, e.switchEditionEnabled]
830
+ [ee, e.switchEditionEnabled]
827
831
  ])
828
832
  ])
829
833
  ], 512), [
830
- [le, Ue.value]
834
+ [ee, He.value]
831
835
  ]),
832
- B(i).buttons ? (s(), f("div", qt, [
833
- W(e.$slots, "buttons")
834
- ])) : g("", !0),
835
- p.value && B(i).filters ? (s(), f("div", Gt, [
836
- W(e.$slots, "filters", {
837
- items: u.value,
838
- isLoading: y.value
836
+ E(u).buttons ? (s(), m("div", qt, [
837
+ N(e.$slots, "buttons")
838
+ ])) : y("", !0),
839
+ V.value && E(u).filters ? (s(), m("div", Gt, [
840
+ N(e.$slots, "filters", {
841
+ items: i.value,
842
+ isLoading: S.value
839
843
  })
840
- ])) : g("", !0),
841
- y.value ? (s(), b(D, { key: 2 })) : g("", !0),
842
- te(V("div", {
844
+ ])) : y("", !0),
845
+ S.value ? (s(), b(D, { key: 2 })) : y("", !0),
846
+ x(B("div", {
843
847
  class: "lkt-table",
844
848
  "data-sortable": e.sortable
845
849
  }, [
846
- V("table", null, [
847
- V("thead", null, [
848
- V("tr", null, [
849
- e.sortable && L.value ? (s(), f("th", Xt)) : g("", !0),
850
- e.addNavigation && L.value ? (s(), f("th", Yt)) : g("", !0),
851
- fe.value ? (s(), f("th", Zt)) : g("", !0),
852
- (s(!0), f(E, null, j(ae.value, (T) => (s(), f(E, null, [
853
- se.value.indexOf(T.key) === -1 ? (s(), b(Kt, {
850
+ e.itemMode ? (s(), m("div", {
851
+ key: 1,
852
+ class: te(["lkt-table-items-container", e.itemsContainerClass])
853
+ }, [
854
+ (s(!0), m(A, null, P(i.value, (w) => (s(), m("div", ll, [
855
+ N(e.$slots, "item", {
856
+ item: w,
857
+ canCreate: ne.value,
858
+ canRead: qe.value,
859
+ canUpdate: Ge.value,
860
+ canDrop: re.value,
861
+ isLoading: S.value
862
+ })
863
+ ]))), 256))
864
+ ], 2)) : (s(), m("table", Xt, [
865
+ B("thead", null, [
866
+ B("tr", null, [
867
+ e.sortable && L.value ? (s(), m("th", Yt)) : y("", !0),
868
+ e.addNavigation && L.value ? (s(), m("th", Zt)) : y("", !0),
869
+ pe.value ? (s(), m("th", xt)) : y("", !0),
870
+ (s(!0), m(A, null, P(ae.value, (w) => (s(), m(A, null, [
871
+ se.value.indexOf(w.key) === -1 ? (s(), b(_t, {
854
872
  key: 0,
855
- column: T,
873
+ column: w,
856
874
  "sort-by": v.value,
857
875
  "sort-direction": a.value,
858
876
  "amount-of-columns": e.columns.length,
859
- items: u.value,
860
- onClick: (I) => ke(T)
861
- }, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : g("", !0)
877
+ items: i.value,
878
+ onClick: (M) => ke(w)
879
+ }, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : y("", !0)
862
880
  ], 64))), 256)),
863
- e.canDrop && he.value && L.value ? (s(), f("th", xt)) : g("", !0)
881
+ e.canDrop && re.value && L.value ? (s(), m("th", el)) : y("", !0)
864
882
  ])
865
883
  ]),
866
- V("tbody", {
867
- ref: (T) => J.value = T,
868
- id: "lkt-table-body-" + B(oe)
884
+ B("tbody", {
885
+ ref: (w) => J.value = w,
886
+ id: "lkt-table-body-" + E(oe)
869
887
  }, [
870
- (s(!0), f(E, null, j(u.value, (T, I) => (s(), b($t, {
871
- modelValue: u.value[I],
872
- "onUpdate:modelValue": (K) => u.value[I] = K,
873
- key: we(T, I),
874
- i: I,
875
- "display-hidden-columns-indicator": fe.value,
876
- "is-draggable": Se(T),
888
+ (s(!0), m(A, null, P(i.value, (w, M) => (s(), b(At, {
889
+ modelValue: i.value[M],
890
+ "onUpdate:modelValue": (_) => i.value[M] = _,
891
+ key: we(w, M),
892
+ i: M,
893
+ "display-hidden-columns-indicator": pe.value,
894
+ "is-draggable": Se(w),
877
895
  sortable: e.sortable,
878
896
  "visible-columns": ae.value,
879
897
  "empty-columns": se.value,
880
898
  "add-navigation": e.addNavigation,
881
- "hidden-is-visible": ye(I),
882
- "latest-row": I + 1 === Ke.value,
883
- "can-drop": e.canDrop && he.value && L.value,
899
+ "hidden-is-visible": ye(M),
900
+ "latest-row": M + 1 === _e.value,
901
+ "can-drop": e.canDrop && re.value && L.value,
884
902
  "drop-confirm": e.dropConfirm,
885
903
  "drop-resource": e.dropResource,
886
904
  "drop-text": e.dropText,
905
+ "drop-icon": e.dropIcon,
887
906
  "edit-mode-enabled": L.value,
888
907
  onClick: be,
889
908
  onShow: ge,
890
- onItemUp: Ze,
891
- onItemDown: xe,
892
- onItemDrop: et
909
+ onItemUp: et,
910
+ onItemDown: tt,
911
+ onItemDrop: lt
893
912
  }, Be({ _: 2 }, [
894
- j(pe.value, (K) => ({
895
- name: K,
896
- fn: O((z) => [
897
- W(e.$slots, K, {
913
+ P(ve.value, (_) => ({
914
+ name: _,
915
+ fn: F((z) => [
916
+ N(e.$slots, _, {
898
917
  item: z.item,
899
918
  value: z.value,
900
919
  column: z.column
901
920
  })
902
921
  ])
903
922
  }))
904
- ]), 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", "edit-mode-enabled"]))), 128)),
905
- ue.value.length > 0 ? (s(!0), f(E, { key: 0 }, j(u.value, (T, I) => (s(), b(_t, {
906
- modelValue: u.value[I],
907
- "onUpdate:modelValue": (K) => u.value[I] = K,
908
- key: we(T, I, !0),
909
- i: I,
923
+ ]), 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)),
924
+ ue.value.length > 0 ? (s(!0), m(A, { key: 0 }, P(i.value, (w, M) => (s(), b(Ht, {
925
+ modelValue: i.value[M],
926
+ "onUpdate:modelValue": (_) => i.value[M] = _,
927
+ key: we(w, M, !0),
928
+ i: M,
910
929
  "hidden-columns": ue.value,
911
930
  "hidden-columns-col-span": Ne.value,
912
- "is-draggable": Se(T),
931
+ "is-draggable": Se(w),
913
932
  sortable: e.sortable,
914
933
  "visible-columns": ae.value,
915
934
  "empty-columns": se.value,
916
- "hidden-is-visible": ye(I),
935
+ "hidden-is-visible": ye(M),
917
936
  onClick: be,
918
937
  onShow: ge
919
938
  }, Be({ _: 2 }, [
920
- j(pe.value, (K) => ({
921
- name: K,
922
- fn: O((z) => [
923
- W(e.$slots, K, {
939
+ P(ve.value, (_) => ({
940
+ name: _,
941
+ fn: F((z) => [
942
+ N(e.$slots, _, {
924
943
  item: z.item,
925
944
  value: z.value,
926
945
  column: z.column
927
946
  })
928
947
  ])
929
948
  }))
930
- ]), 1032, ["modelValue", "onUpdate:modelValue", "i", "hidden-columns", "hidden-columns-col-span", "is-draggable", "sortable", "visible-columns", "empty-columns", "hidden-is-visible"]))), 128)) : g("", !0)
931
- ], 8, el)
932
- ])
949
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "i", "hidden-columns", "hidden-columns-col-span", "is-draggable", "sortable", "visible-columns", "empty-columns", "hidden-is-visible"]))), 128)) : y("", !0)
950
+ ], 8, tl)
951
+ ]))
933
952
  ], 8, Qt), [
934
- [le, !y.value && u.value.length > 0]
953
+ [ee, !S.value && i.value.length > 0]
935
954
  ]),
936
- e.$slots["no-items"] ? (s(), f("div", tl, [
937
- W(e.$slots, "no-items")
938
- ])) : g("", !0),
939
- !y.value && u.value.length === 0 ? (s(), f("div", ll, F(e.noResultsText), 1)) : g("", !0),
940
- e.canCreate && L.value ? (s(), f("div", ol, [
941
- e.canCreate && L.value ? (s(), b(Le, {
955
+ e.$slots["no-items"] ? (s(), m("div", ol, [
956
+ N(e.$slots, "no-items")
957
+ ])) : y("", !0),
958
+ !S.value && i.value.length === 0 ? (s(), m("div", al, j(e.noResultsText), 1)) : y("", !0),
959
+ e.canCreate && ne.value && L.value ? (s(), m("div", nl, [
960
+ e.canCreate && ne.value && L.value ? (s(), b(Ie, {
942
961
  key: 0,
943
962
  disabled: !Te.value,
944
963
  text: e.createText,
964
+ icon: e.createIcon,
945
965
  onClick: Ve
946
- }, null, 8, ["disabled", "text"])) : g("", !0)
947
- ])) : g("", !0),
948
- Y(R, {
966
+ }, null, 8, ["disabled", "text", "icon"])) : y("", !0)
967
+ ])) : y("", !0),
968
+ X(O, {
949
969
  ref_key: "paginator",
950
- ref: ce,
951
- modelValue: H.value,
952
- "onUpdate:modelValue": m[1] || (m[1] = (T) => H.value = T),
970
+ ref: fe,
971
+ modelValue: I.value,
972
+ "onUpdate:modelValue": c[1] || (c[1] = (w) => I.value = w),
953
973
  resource: e.resource,
954
974
  filters: e.filters,
955
975
  onResults: $e,
@@ -959,28 +979,28 @@ const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n =
959
979
  ]),
960
980
  _: 3
961
981
  }, 8, ["class"]))
962
- ], 8, Wt);
982
+ ], 8, Pt);
963
983
  };
964
984
  }
965
- }), Il = {
985
+ }), $l = {
966
986
  install: (l) => {
967
- l.component("lkt-loader") === void 0 && l.use(dt), l.component("lkt-button") === void 0 && l.use(mt), l.component("lkt-paginator") === void 0 && l.use(ct), l.component("lkt-field-text") === void 0 && l.use(ft), l.component("lkt-field-textarea") === void 0 && l.use(pt), l.component("lkt-field-select") === void 0 && l.use(vt), l.component("lkt-field-switch") === void 0 && l.use(ht), l.component("lkt-field-file") === void 0 && l.use(yt), l.component("lkt-table") === void 0 && l.component("lkt-table", al);
987
+ 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", sl);
968
988
  }
969
- }, Ml = (l) => (A.navButtonSlot = l, !0), $l = (l) => (A.dropButtonSlot = l, !0), Al = (l) => (A.createButtonSlot = l, !0);
989
+ }, Al = (l) => (R.navButtonSlot = l, !0), Rl = (l) => (R.dropButtonSlot = l, !0), Ol = (l) => (R.createButtonSlot = l, !0);
970
990
  export {
971
- U as LktTableColumn,
972
- Sl as createActionColumn,
973
- Tl as createCheckColumn,
974
- gl as createColumn,
975
- Dl as createEmailColumn,
976
- Ll as createHiddenColumn,
977
- Cl as createLinkColumn,
978
- El as createSelectColumn,
979
- Bl as createSwitchColumn,
980
- wl as createTelColumn,
981
- Vl as createTextColumn,
982
- Il as default,
983
- Al as setTableCreateButtonSlot,
984
- $l as setTableDropButtonSlot,
985
- Ml as setTableNavButtonSlot
991
+ K as LktTableColumn,
992
+ Dl as createActionColumn,
993
+ El as createCheckColumn,
994
+ Sl as createColumn,
995
+ Tl as createEmailColumn,
996
+ Ml as createHiddenColumn,
997
+ Vl as createLinkColumn,
998
+ Ll as createSelectColumn,
999
+ Il as createSwitchColumn,
1000
+ Bl as createTelColumn,
1001
+ wl as createTextColumn,
1002
+ $l as default,
1003
+ Ol as setTableCreateButtonSlot,
1004
+ Rl as setTableDropButtonSlot,
1005
+ Al as setTableNavButtonSlot
986
1006
  };