lkt-table 1.4.2 → 2.0.0

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,127 +1,127 @@
1
- import { defineComponent as x, ref as h, watch as P, computed as i, resolveComponent as z, createBlock as C, createElementBlock as d, unref as f, openBlock as o, normalizeProps as Y, mergeProps as De, withCtx as F, createTextVNode as ue, toDisplayString as Z, Fragment as $, withModifiers as et, createCommentVNode as y, resolveDynamicComponent as _, useSlots as tt, normalizeClass as K, createElementVNode as U, createVNode as ie, renderSlot as w, renderList as j, withDirectives as ve, vShow as ye, onMounted as Mt, nextTick as $e, createSlots as Ze } from "vue";
2
- import { __ as be } from "lkt-i18n";
3
- import { Column as Re, ColumnType as oe, TableRowType as ne, TableType as Q, SortDirection as Be, TablePermission as X } from "lkt-vue-kernel";
4
- import { Column as zl } from "lkt-vue-kernel";
5
- import { replaceAll as lt, generateRandomString as Pt } from "lkt-string-tools";
6
- import { DataState as Ft } from "lkt-data-state";
7
- import Lt from "sortablejs";
8
- import { time as Se } from "lkt-date-tools";
9
- const Nl = (n) => new Re(n), _e = (n, m, p, u) => {
10
- if (!p) return 0;
11
- let a = n[p.key], t = m[p.key];
12
- if (u === "asc") {
13
- if (a > t) return 1;
14
- if (t > a) return -1;
1
+ import { defineComponent as _, ref as C, watch as N, computed as d, resolveComponent as K, createBlock as B, createElementBlock as s, unref as v, openBlock as u, normalizeProps as ae, mergeProps as ie, withCtx as L, createTextVNode as oe, toDisplayString as ne, Fragment as P, withModifiers as ot, createCommentVNode as f, resolveDynamicComponent as X, useSlots as nt, normalizeClass as G, createElementVNode as O, createVNode as de, renderSlot as w, renderList as z, withDirectives as ve, vShow as ye, mergeDefaults as Ft, onMounted as Ut, nextTick as Be, createSlots as tt } from "vue";
2
+ import { __ as ut } from "lkt-i18n";
3
+ import { Column as Le, SortDirection as be, ColumnType as le, TableRowType as re, extractI18nValue as lt, TablePermission as Z, TableType as ce, getDefaultValues as At, Table as Ot, ButtonType as Me } from "lkt-vue-kernel";
4
+ import { Column as Zl } from "lkt-vue-kernel";
5
+ import { replaceAll as rt, generateRandomString as Ht } from "lkt-string-tools";
6
+ import { DataState as qt } from "lkt-data-state";
7
+ import jt from "sortablejs";
8
+ import { time as fe } from "lkt-date-tools";
9
+ const jl = (n) => new Le(n), Kt = (n, p, m, a) => {
10
+ if (!m) return 0;
11
+ let o = n[m.key], t = p[m.key];
12
+ if (a === be.Asc) {
13
+ if (o > t) return 1;
14
+ if (t > o) return -1;
15
15
  } else {
16
- if (a > t) return -1;
17
- if (t > a) return 1;
16
+ if (o > t) return -1;
17
+ if (t > o) return 1;
18
18
  }
19
19
  return 0;
20
- }, se = (n, m, p, u = []) => {
20
+ }, se = (n, p, m, a = []) => {
21
21
  if (n.extractTitleFromColumn) {
22
- let a = u.find((t) => t.key === n.extractTitleFromColumn);
23
- if (a)
24
- return se(a, m, p, u);
22
+ let o = a.find((t) => t.key === n.extractTitleFromColumn);
23
+ if (o)
24
+ return se(o, p, m, a);
25
25
  }
26
26
  if (n.formatter && typeof n.formatter == "function") {
27
- let a = n.formatter(m[n.key], m, n, p);
28
- return a.startsWith("__:") ? be(a.substring(3)) : a;
27
+ let o = n.formatter(p[n.key], p, n, m);
28
+ return o.startsWith("__:") ? ut(o.substring(3)) : o;
29
29
  }
30
- return m[n.key];
31
- }, Nt = (n, m, p) => {
30
+ return p[n.key];
31
+ }, Wt = (n, p, m) => {
32
32
  if (!n.colspan) return -1;
33
- let u = m;
34
- return p.forEach((a) => {
35
- let t = Me(n, a);
36
- t > 0 && t < u && (u = t);
37
- }), u;
38
- }, Me = (n, m) => n.colspan === !1 ? !1 : typeof n.colspan == "function" ? n.colspan(m) : n.colspan, Ut = (n, m) => typeof n.preferSlot > "u" ? !0 : n.preferSlot === !1 ? !1 : typeof n.preferSlot == "function" ? n.preferSlot(m) : !0, At = (n, m, p) => {
39
- if (typeof n != "object" || !n.key || m.indexOf(n.key) > -1) return !1;
40
- let u = Me(n, p);
41
- return typeof n.colspan > "u" ? !0 : (typeof n.colspan < "u" && (typeof n.colspan == "function" ? u = parseInt(n.colspan(p)) : u = parseInt(n.colspan)), u > 0);
42
- }, Ot = (n = []) => {
33
+ let a = p;
34
+ return m.forEach((o) => {
35
+ let t = Pe(n, o);
36
+ t > 0 && t < a && (a = t);
37
+ }), a;
38
+ }, Pe = (n, p) => n.colspan === !1 ? !1 : typeof n.colspan == "function" ? n.colspan(p) : n.colspan, zt = (n, p) => typeof n.preferSlot > "u" ? !0 : n.preferSlot === !1 ? !1 : typeof n.preferSlot == "function" ? n.preferSlot(p) : !0, Gt = (n, p, m) => {
39
+ if (typeof n != "object" || !n.key || p.indexOf(n.key) > -1) return !1;
40
+ let a = Pe(n, m);
41
+ return typeof n.colspan > "u" ? !0 : (typeof n.colspan < "u" && (typeof n.colspan == "function" ? a = parseInt(n.colspan(m)) : a = parseInt(n.colspan)), a > 0);
42
+ }, Jt = (n = []) => {
43
43
  if (n.length > 0) {
44
- for (let m = 0; m < n.length; ++m)
45
- if (n[m].sortable) return n[m].key;
44
+ for (let p = 0; p < n.length; ++p)
45
+ if (n[p].sortable) return n[p].key;
46
46
  }
47
47
  return "";
48
- }, Ht = (n, m) => {
48
+ }, Qt = (n, p) => {
49
49
  if (n.length > 0) {
50
- for (let p = 0; p < n.length; ++p)
51
- if (n[p].key === m) return n[p];
50
+ for (let m = 0; m < n.length; ++m)
51
+ if (n[m].key === p) return n[m];
52
52
  }
53
53
  return null;
54
- }, at = (n) => n.type ? `is-${n.type}` : "", ot = /* @__PURE__ */ x({
54
+ }, it = (n) => n.type ? `is-${n.type}` : "", dt = /* @__PURE__ */ _({
55
55
  __name: "LktTableCell",
56
56
  props: {
57
57
  modelValue: { default: () => ({}) },
58
- column: { default: () => new Re() },
58
+ column: { default: () => new Le() },
59
59
  columns: { default: () => [] },
60
60
  i: { default: 0 },
61
61
  editModeEnabled: { type: Boolean, default: !1 },
62
62
  hasInlineEditPerm: { type: Boolean, default: !1 }
63
63
  },
64
64
  emits: ["update:modelValue"],
65
- setup(n, { emit: m }) {
66
- const p = m, u = n, a = h(u.modelValue), t = h(a.value[u.column.key]), c = h(null);
67
- let S = u.column.type;
68
- [oe.Integer, oe.Float].includes(S) && (S = oe.Number), P(t, (l) => {
69
- const M = JSON.parse(JSON.stringify(a.value));
70
- M[u.column.key] = l, p("update:modelValue", M);
71
- }), P(() => u.modelValue, (l) => {
72
- a.value = l, t.value = a.value[u.column.key];
65
+ setup(n, { emit: p }) {
66
+ const m = p, a = n, o = C(a.modelValue), t = C(o.value[a.column.key]), c = C(null);
67
+ let D = a.column.type;
68
+ [le.Integer, le.Float].includes(D) && (D = le.Number), N(t, (l) => {
69
+ const R = JSON.parse(JSON.stringify(o.value));
70
+ R[a.column.key] = l, m("update:modelValue", R);
71
+ }), N(() => a.modelValue, (l) => {
72
+ o.value = l, t.value = o.value[a.column.key];
73
73
  });
74
- const v = i(() => ({ ...u.column.slotData, item: a.value })), T = i(() => {
75
- var l, M, G, L;
76
- if ((l = u.column.field) != null && l.modalData && typeof ((M = u.column.field) == null ? void 0 : M.modalData) == "object")
77
- for (let N in u.column.field.modalData)
78
- if (typeof ((G = u.column.field) == null ? void 0 : G.modalData[N]) == "string" && u.column.field.modalData[N].startsWith("prop:")) {
79
- let I = u.column.field.modalData[N].substring(5);
80
- a.value[I];
74
+ const g = d(() => ({ ...a.column.slotData, item: o.value })), S = d(() => {
75
+ var l, R, H, F;
76
+ if ((l = a.column.field) != null && l.modalData && typeof ((R = a.column.field) == null ? void 0 : R.modalData) == "object")
77
+ for (let U in a.column.field.modalData)
78
+ if (typeof ((H = a.column.field) == null ? void 0 : H.modalData[U]) == "string" && a.column.field.modalData[U].startsWith("prop:")) {
79
+ let E = a.column.field.modalData[U].substring(5);
80
+ o.value[E];
81
81
  } else
82
- u.column.field.modalData[N];
83
- return (L = u.column.field) == null ? void 0 : L.modalData;
82
+ a.column.field.modalData[U];
83
+ return (F = a.column.field) == null ? void 0 : F.modalData;
84
84
  });
85
- return (l, M) => {
86
- var I, ee, R, te;
87
- const G = z("lkt-anchor"), L = z("lkt-button"), N = z("lkt-field");
88
- return l.column.type === f(oe).Anchor ? (o(), C(G, Y(De({ key: 0 }, l.column.anchor)), {
89
- default: F(() => [
90
- ue(Z(f(se)(l.column, a.value, l.i)), 1)
85
+ return (l, R) => {
86
+ var E, x, T, ee;
87
+ const H = K("lkt-anchor"), F = K("lkt-button"), U = K("lkt-field");
88
+ return l.column.type === v(le).Anchor ? (u(), B(H, ae(ie({ key: 0 }, l.column.anchor)), {
89
+ default: L(() => [
90
+ oe(ne(v(se)(l.column, o.value, l.i)), 1)
91
91
  ]),
92
92
  _: 1
93
- }, 16)) : l.column.type === f(oe).Button ? (o(), C(L, De({ key: 1 }, l.column.button, { prop: a.value }), {
94
- default: F(() => [
95
- ue(Z(f(se)(l.column, a.value, l.i)), 1)
93
+ }, 16)) : l.column.type === v(le).Button ? (u(), B(F, ie({ key: 1 }, l.column.button, { prop: o.value }), {
94
+ default: L(() => [
95
+ oe(ne(v(se)(l.column, o.value, l.i)), 1)
96
96
  ]),
97
97
  _: 1
98
- }, 16, ["prop"])) : l.column.type === f(oe).Field && l.hasInlineEditPerm ? (o(), C(N, De({ key: 2 }, l.column.field, {
98
+ }, 16, ["prop"])) : l.column.type === v(le).Field && l.hasInlineEditPerm ? (u(), B(U, ie({ key: 2 }, l.column.field, {
99
99
  "read-mode": !l.column.editable || !l.editModeEnabled,
100
- ref: (H) => c.value = H,
101
- "slot-data": v.value,
102
- label: ((I = l.column.field) == null ? void 0 : I.type) === "switch" || ((ee = l.column.field) == null ? void 0 : ee.type) === "check" ? l.column.label : "",
103
- "modal-data": T.value,
104
- prop: a.value,
100
+ ref: (q) => c.value = q,
101
+ "slot-data": g.value,
102
+ label: ((E = l.column.field) == null ? void 0 : E.type) === "switch" || ((x = l.column.field) == null ? void 0 : x.type) === "check" ? l.column.label : "",
103
+ "modal-data": S.value,
104
+ prop: o.value,
105
105
  modelValue: t.value,
106
- "onUpdate:modelValue": M[0] || (M[0] = (H) => t.value = H)
107
- }), null, 16, ["read-mode", "slot-data", "label", "modal-data", "prop", "modelValue"])) : l.column.type === f(oe).Field ? (o(), C(N, De({ key: 3 }, l.column.field, {
106
+ "onUpdate:modelValue": R[0] || (R[0] = (q) => t.value = q)
107
+ }), null, 16, ["read-mode", "slot-data", "label", "modal-data", "prop", "modelValue"])) : l.column.type === v(le).Field ? (u(), B(U, ie({ key: 3 }, l.column.field, {
108
108
  "read-mode": "",
109
- ref: (H) => c.value = H,
110
- "slot-data": v.value,
111
- label: ((R = l.column.field) == null ? void 0 : R.type) === "switch" || ((te = l.column.field) == null ? void 0 : te.type) === "check" ? l.column.label : "",
112
- "modal-data": T.value,
113
- prop: a.value,
109
+ ref: (q) => c.value = q,
110
+ "slot-data": g.value,
111
+ label: ((T = l.column.field) == null ? void 0 : T.type) === "switch" || ((ee = l.column.field) == null ? void 0 : ee.type) === "check" ? l.column.label : "",
112
+ "modal-data": S.value,
113
+ prop: o.value,
114
114
  "model-value": t.value
115
- }), null, 16, ["slot-data", "label", "modal-data", "prop", "model-value"])) : (o(), d($, { key: 4 }, [
116
- ue(Z(f(se)(l.column, a.value, l.i, l.columns)), 1)
115
+ }), null, 16, ["slot-data", "label", "modal-data", "prop", "model-value"])) : (u(), s(P, { key: 4 }, [
116
+ oe(ne(v(se)(l.column, o.value, l.i, l.columns)), 1)
117
117
  ], 64));
118
118
  };
119
119
  }
120
- }), J = class J {
120
+ }), Q = class Q {
121
121
  };
122
- J.navButtonSlot = "", J.dropButtonSlot = "", J.editButtonSlot = "", J.createButtonSlot = "", J.defaultEmptySlot = void 0, J.defaultSaveIcon = "", J.defaultNoResultsMessage = "No results";
123
- let E = J;
124
- const Wt = /* @__PURE__ */ x({
122
+ Q.navButtonSlot = "", Q.dropButtonSlot = "", Q.editButtonSlot = "", Q.createButtonSlot = "", Q.defaultEmptySlot = void 0, Q.defaultSaveIcon = "", Q.defaultNoResultsMessage = "No results";
123
+ let $ = Q;
124
+ const Xt = /* @__PURE__ */ _({
125
125
  __name: "DropButton",
126
126
  props: {
127
127
  disabled: { type: Boolean, default: !1 },
@@ -132,28 +132,28 @@ const Wt = /* @__PURE__ */ x({
132
132
  resourceData: { default: () => ({}) }
133
133
  },
134
134
  emits: ["click"],
135
- setup(n, { emit: m }) {
136
- const p = m, u = i(() => E.dropButtonSlot !== ""), a = i(() => E.dropButtonSlot);
135
+ setup(n, { emit: p }) {
136
+ const m = p, a = d(() => $.dropButtonSlot !== ""), o = d(() => $.dropButtonSlot);
137
137
  return (t, c) => {
138
- const S = z("lkt-button");
139
- return o(), C(S, {
138
+ const D = K("lkt-button");
139
+ return u(), B(D, {
140
140
  palette: "table-delete",
141
- icon: u.value ? "" : t.icon,
142
- text: u.value ? "" : t.text,
141
+ icon: a.value ? "" : t.icon,
142
+ text: a.value ? "" : t.text,
143
143
  resource: t.resource,
144
144
  "resource-data": t.resourceData,
145
145
  "confirm-modal": t.confirm,
146
146
  disabled: t.disabled,
147
- onClick: c[0] || (c[0] = et((v) => p("click"), ["prevent", "stop"]))
147
+ onClick: c[0] || (c[0] = ot((g) => m("click"), ["prevent", "stop"]))
148
148
  }, {
149
- default: F(() => [
150
- u.value ? (o(), C(_(a.value), { key: 0 })) : y("", !0)
149
+ default: L(() => [
150
+ a.value ? (u(), B(X(o.value), { key: 0 })) : f("", !0)
151
151
  ]),
152
152
  _: 1
153
153
  }, 8, ["icon", "text", "resource", "resource-data", "confirm-modal", "disabled"]);
154
154
  };
155
155
  }
156
- }), qt = /* @__PURE__ */ x({
156
+ }), Yt = /* @__PURE__ */ _({
157
157
  __name: "EditButton",
158
158
  props: {
159
159
  disabled: { type: Boolean, default: !1 },
@@ -165,42 +165,42 @@ const Wt = /* @__PURE__ */ x({
165
165
  resourceData: { default: () => ({}) }
166
166
  },
167
167
  emits: ["click"],
168
- setup(n, { emit: m }) {
169
- const p = m, u = i(() => E.editButtonSlot !== ""), a = i(() => E.editButtonSlot);
168
+ setup(n, { emit: p }) {
169
+ const m = p, a = d(() => $.editButtonSlot !== ""), o = d(() => $.editButtonSlot);
170
170
  return (t, c) => {
171
- const S = z("lkt-button");
172
- return o(), C(S, {
171
+ const D = K("lkt-button");
172
+ return u(), B(D, {
173
173
  palette: "table-delete",
174
- icon: u.value ? "" : t.icon,
175
- text: u.value ? "" : t.text,
174
+ icon: a.value ? "" : t.icon,
175
+ text: a.value ? "" : t.text,
176
176
  "on-click-to": t.link,
177
177
  "is-anchor": t.link !== "",
178
178
  resource: t.resource,
179
179
  "resource-data": t.resourceData,
180
180
  "confirm-modal": t.confirm,
181
181
  disabled: t.disabled,
182
- onClick: c[0] || (c[0] = et((v) => p("click"), ["prevent", "stop"]))
182
+ onClick: c[0] || (c[0] = ot((g) => m("click"), ["prevent", "stop"]))
183
183
  }, {
184
- default: F(() => [
185
- u.value ? (o(), C(_(a.value), { key: 0 })) : y("", !0)
184
+ default: L(() => [
185
+ a.value ? (u(), B(X(o.value), { key: 0 })) : f("", !0)
186
186
  ]),
187
187
  _: 1
188
188
  }, 8, ["icon", "text", "on-click-to", "is-anchor", "resource", "resource-data", "confirm-modal", "disabled"]);
189
189
  };
190
190
  }
191
- }), jt = ["data-i", "data-draggable"], Kt = ["data-i"], zt = {
191
+ }), Zt = ["data-i", "data-draggable"], _t = ["data-i"], xt = {
192
192
  key: 1,
193
193
  "data-role": "invalid-drag-indicator"
194
- }, Gt = {
194
+ }, el = {
195
195
  key: 2,
196
196
  class: "lkt-table-nav-cell"
197
- }, Jt = { class: "lkt-table-nav-container" }, Qt = ["colspan"], Xt = ["colspan"], Yt = ["data-column", "colspan", "title"], Zt = {
197
+ }, tl = { class: "lkt-table-nav-container" }, ll = ["colspan"], al = ["colspan"], ol = ["data-column", "colspan", "title"], nl = {
198
198
  key: 7,
199
199
  class: "lkt-table-col-drop"
200
- }, _t = {
200
+ }, ul = {
201
201
  key: 8,
202
202
  class: "lkt-table-col-edit"
203
- }, xt = /* @__PURE__ */ x({
203
+ }, rl = /* @__PURE__ */ _({
204
204
  __name: "LktTableRow",
205
205
  props: {
206
206
  modelValue: { default: () => ({}) },
@@ -224,90 +224,90 @@ const Wt = /* @__PURE__ */ x({
224
224
  editText: { default: "" },
225
225
  editIcon: { default: "" },
226
226
  editLink: { default: "" },
227
- rowDisplayType: { type: [Number, Function], default: ne.Auto },
227
+ rowDisplayType: { type: [Number, Function], default: re.Auto },
228
228
  renderDrag: { type: [Boolean, Function], default: !0 },
229
229
  disabledDrag: { type: [Boolean, Function], default: !0 }
230
230
  },
231
231
  emits: ["update:modelValue", "click", "show", "item-up", "item-down", "item-drop"],
232
- setup(n, { emit: m }) {
233
- const p = tt(), u = m, a = n, t = h(a.modelValue);
234
- let c = typeof a.rowDisplayType == "function" ? a.rowDisplayType(t.value, a.i) : a.rowDisplayType;
235
- c || (c = ne.Auto);
236
- const S = [ne.Auto, ne.PreferCustomItem].includes(c), v = [ne.Auto, ne.PreferItem].includes(c), T = h(a.editLink);
237
- for (let r in t.value) T.value = lt(T.value, ":" + r, t.value[r]);
238
- const l = (r) => u("click", r), M = (r, k) => {
239
- u("show", r, k);
240
- }, G = i(() => {
241
- let r = [], k = !1;
242
- return typeof a.disabledDrag == "function" ? k = a.disabledDrag(t.value) : k = a.disabledDrag === !0, !k && a.sortable && a.isDraggable ? r.push("handle") : k && r.push("disabled"), r.join(" ");
243
- }), L = i(() => E.navButtonSlot !== ""), N = i(() => E.navButtonSlot), I = () => {
244
- u("item-up", a.i);
232
+ setup(n, { emit: p }) {
233
+ const m = nt(), a = p, o = n, t = C(o.modelValue);
234
+ let c = typeof o.rowDisplayType == "function" ? o.rowDisplayType(t.value, o.i) : o.rowDisplayType;
235
+ c || (c = re.Auto);
236
+ const D = [re.Auto, re.PreferCustomItem].includes(c), g = [re.Auto, re.PreferItem].includes(c), S = C(o.editLink);
237
+ for (let r in t.value) S.value = rt(S.value, ":" + r, t.value[r]);
238
+ const l = (r) => a("click", r), R = (r, b) => {
239
+ a("show", r, b);
240
+ }, H = d(() => {
241
+ let r = [], b = !1;
242
+ return typeof o.disabledDrag == "function" ? b = o.disabledDrag(t.value) : b = o.disabledDrag === !0, !b && o.sortable && o.isDraggable ? r.push("handle") : b && r.push("disabled"), r.join(" ");
243
+ }), F = d(() => $.navButtonSlot !== ""), U = d(() => $.navButtonSlot), E = () => {
244
+ a("item-up", o.i);
245
+ }, x = () => {
246
+ a("item-down", o.i);
247
+ }, T = () => {
248
+ a("item-drop", o.i);
245
249
  }, ee = () => {
246
- u("item-down", a.i);
247
- }, R = () => {
248
- u("item-drop", a.i);
249
- }, te = () => {
250
250
  };
251
- P(() => a.modelValue, (r) => t.value = r), P(t, (r) => {
252
- u("update:modelValue", r);
251
+ N(() => o.modelValue, (r) => t.value = r), N(t, (r) => {
252
+ a("update:modelValue", r);
253
253
  }, { deep: !0 });
254
- const H = i(() => typeof a.renderDrag == "function" ? a.renderDrag(t.value) : a.renderDrag === !0);
255
- return i(() => typeof a.disabledDrag == "function" ? a.disabledDrag(t.value) : a.disabledDrag === !0), (r, k) => {
256
- const D = z("lkt-button");
257
- return o(), d("tr", {
254
+ const q = d(() => typeof o.renderDrag == "function" ? o.renderDrag(t.value) : o.renderDrag === !0);
255
+ return d(() => typeof o.disabledDrag == "function" ? o.disabledDrag(t.value) : o.disabledDrag === !0), (r, b) => {
256
+ const I = K("lkt-button");
257
+ return u(), s("tr", {
258
258
  "data-i": r.i,
259
259
  "data-draggable": r.isDraggable,
260
- class: K({ "type-custom-item": f(S), "type-item": f(v) })
260
+ class: G({ "type-custom-item": v(D), "type-item": v(g) })
261
261
  }, [
262
- r.sortable && r.isDraggable && r.editModeEnabled && H.value ? (o(), d("td", {
262
+ r.sortable && r.isDraggable && r.editModeEnabled && q.value ? (u(), s("td", {
263
263
  key: 0,
264
264
  "data-role": "drag-indicator",
265
- class: K(G.value),
265
+ class: G(H.value),
266
266
  "data-i": r.i
267
- }, null, 10, Kt)) : r.sortable && r.editModeEnabled && H.value ? (o(), d("td", zt)) : y("", !0),
268
- r.addNavigation && r.editModeEnabled ? (o(), d("td", Gt, [
269
- U("div", Jt, [
270
- ie(D, {
267
+ }, null, 10, _t)) : r.sortable && r.editModeEnabled && q.value ? (u(), s("td", xt)) : f("", !0),
268
+ r.addNavigation && r.editModeEnabled ? (u(), s("td", el, [
269
+ O("div", tl, [
270
+ de(I, {
271
271
  palette: "table-nav",
272
272
  disabled: r.i === 0,
273
- onClick: I
273
+ onClick: E
274
274
  }, {
275
- default: F(() => [
276
- L.value ? (o(), C(_(N.value), {
275
+ default: L(() => [
276
+ F.value ? (u(), B(X(U.value), {
277
277
  key: 0,
278
278
  direction: "up"
279
- })) : (o(), d($, { key: 1 }, [
280
- k[3] || (k[3] = U("i", { class: "" }, null, -1)),
281
- k[4] || (k[4] = ue(" UP "))
279
+ })) : (u(), s(P, { key: 1 }, [
280
+ b[3] || (b[3] = O("i", { class: "" }, null, -1)),
281
+ b[4] || (b[4] = oe(" UP "))
282
282
  ], 64))
283
283
  ]),
284
284
  _: 1
285
285
  }, 8, ["disabled"]),
286
- ie(D, {
286
+ de(I, {
287
287
  palette: "table-nav",
288
288
  disabled: r.latestRow,
289
- onClick: ee
289
+ onClick: x
290
290
  }, {
291
- default: F(() => [
292
- L.value ? (o(), C(_(N.value), {
291
+ default: L(() => [
292
+ F.value ? (u(), B(X(U.value), {
293
293
  key: 0,
294
294
  direction: "down"
295
- })) : (o(), d($, { key: 1 }, [
296
- k[5] || (k[5] = U("i", { class: "" }, null, -1)),
297
- k[6] || (k[6] = ue(" DOWN "))
295
+ })) : (u(), s(P, { key: 1 }, [
296
+ b[5] || (b[5] = O("i", { class: "" }, null, -1)),
297
+ b[6] || (b[6] = oe(" DOWN "))
298
298
  ], 64))
299
299
  ]),
300
300
  _: 1
301
301
  }, 8, ["disabled"])
302
302
  ])
303
- ])) : y("", !0),
304
- r.displayHiddenColumnsIndicator ? (o(), d("td", {
303
+ ])) : f("", !0),
304
+ r.displayHiddenColumnsIndicator ? (u(), s("td", {
305
305
  key: 3,
306
- onClick: k[0] || (k[0] = (V) => M(V, r.i)),
306
+ onClick: b[0] || (b[0] = (V) => R(V, r.i)),
307
307
  "data-role": "show-more",
308
- class: K(r.hiddenIsVisible ? "state-open" : "")
309
- }, null, 2)) : y("", !0),
310
- f(S) && f(p)[`item-${r.i}`] ? (o(), d("td", {
308
+ class: G(r.hiddenIsVisible ? "state-open" : "")
309
+ }, null, 2)) : f("", !0),
310
+ v(D) && v(m)[`item-${r.i}`] ? (u(), s("td", {
311
311
  key: "td" + r.i,
312
312
  colspan: r.visibleColumns.length
313
313
  }, [
@@ -315,7 +315,7 @@ const Wt = /* @__PURE__ */ x({
315
315
  item: t.value,
316
316
  index: r.i
317
317
  })
318
- ], 8, Qt)) : f(v) && f(p).item ? (o(), d("td", {
318
+ ], 8, ll)) : v(g) && v(m).item ? (u(), s("td", {
319
319
  key: "td" + r.i,
320
320
  colspan: r.visibleColumns.length
321
321
  }, [
@@ -323,56 +323,56 @@ const Wt = /* @__PURE__ */ x({
323
323
  item: t.value,
324
324
  index: r.i
325
325
  })
326
- ], 8, Xt)) : (o(!0), d($, { key: 6 }, j(r.visibleColumns, (V) => (o(), d($, null, [
327
- f(At)(V, r.emptyColumns, t.value) ? (o(), d("td", {
326
+ ], 8, al)) : (u(!0), s(P, { key: 6 }, z(r.visibleColumns, (V) => (u(), s(P, null, [
327
+ v(Gt)(V, r.emptyColumns, t.value) ? (u(), s("td", {
328
328
  key: "td" + r.i,
329
329
  "data-column": V.key,
330
- colspan: f(Me)(V, t.value),
331
- title: f(se)(V, t.value, r.i, r.visibleColumns),
332
- class: K(f(at)(V)),
333
- onClick: k[2] || (k[2] = (le) => l(le))
330
+ colspan: v(Pe)(V, t.value),
331
+ title: v(se)(V, t.value, r.i, r.visibleColumns),
332
+ class: G(v(it)(V)),
333
+ onClick: b[2] || (b[2] = (te) => l(te))
334
334
  }, [
335
- r.$slots[V.key] && f(Ut)(V, t.value) ? w(r.$slots, V.key, {
335
+ r.$slots[V.key] && v(zt)(V, t.value) ? w(r.$slots, V.key, {
336
336
  key: 0,
337
337
  value: t.value[V.key],
338
338
  item: t.value,
339
339
  column: V,
340
340
  i: r.i
341
- }) : t.value ? (o(), C(ot, {
341
+ }) : t.value ? (u(), B(dt, {
342
342
  key: 1,
343
343
  modelValue: t.value,
344
- "onUpdate:modelValue": k[1] || (k[1] = (le) => t.value = le),
344
+ "onUpdate:modelValue": b[1] || (b[1] = (te) => t.value = te),
345
345
  column: V,
346
346
  columns: r.visibleColumns,
347
347
  "edit-mode-enabled": r.editModeEnabled,
348
348
  "has-inline-edit-perm": r.hasInlineEditPerm,
349
349
  i: r.i
350
- }, null, 8, ["modelValue", "column", "columns", "edit-mode-enabled", "has-inline-edit-perm", "i"])) : y("", !0)
351
- ], 10, Yt)) : y("", !0)
350
+ }, null, 8, ["modelValue", "column", "columns", "edit-mode-enabled", "has-inline-edit-perm", "i"])) : f("", !0)
351
+ ], 10, ol)) : f("", !0)
352
352
  ], 64))), 256)),
353
- r.canDrop && r.editModeEnabled ? (o(), d("td", Zt, [
354
- ie(Wt, {
353
+ r.canDrop && r.editModeEnabled ? (u(), s("td", nl, [
354
+ de(Xt, {
355
355
  resource: r.dropResource,
356
356
  "resource-data": t.value,
357
357
  confirm: r.dropConfirm,
358
358
  text: r.dropText,
359
359
  icon: r.dropIcon,
360
- onClick: R
360
+ onClick: T
361
361
  }, null, 8, ["resource", "resource-data", "confirm", "text", "icon"])
362
- ])) : y("", !0),
363
- r.canEdit && r.editModeEnabled ? (o(), d("td", _t, [
364
- ie(qt, {
362
+ ])) : f("", !0),
363
+ r.canEdit && r.editModeEnabled ? (u(), s("td", ul, [
364
+ de(Yt, {
365
365
  "resource-data": t.value,
366
366
  text: r.editText,
367
367
  icon: r.editIcon,
368
- link: T.value,
369
- onClick: te
368
+ link: S.value,
369
+ onClick: ee
370
370
  }, null, 8, ["resource-data", "text", "icon", "link"])
371
- ])) : y("", !0)
372
- ], 10, jt);
371
+ ])) : f("", !0)
372
+ ], 10, Zt);
373
373
  };
374
374
  }
375
- }), el = { "data-role": "hidden-row" }, tl = ["colspan"], ll = ["data-column"], al = ["data-i"], ol = ["data-column", "title"], nl = /* @__PURE__ */ x({
375
+ }), il = { "data-role": "hidden-row" }, dl = ["colspan"], sl = ["data-column"], pl = ["data-i"], ml = ["data-column", "title"], cl = /* @__PURE__ */ _({
376
376
  __name: "LktHiddenRow",
377
377
  props: {
378
378
  modelValue: { default: () => ({}) },
@@ -388,203 +388,188 @@ const Wt = /* @__PURE__ */ x({
388
388
  hasInlineEditPerm: { type: Boolean, default: !1 }
389
389
  },
390
390
  emits: ["update:modelValue", "click"],
391
- setup(n, { emit: m }) {
392
- const p = m, u = n, a = h(u.modelValue), t = (c) => p("click", c);
393
- return P(() => u.modelValue, (c) => a.value = c), P(a, () => p("update:modelValue", a.value)), (c, S) => ve((o(), d("tr", el, [
394
- U("td", { colspan: c.hiddenColumnsColSpan }, [
395
- U("table", null, [
396
- U("tr", null, [
397
- (o(!0), d($, null, j(c.hiddenColumns, (v) => (o(), d("th", {
398
- "data-column": v.key
391
+ setup(n, { emit: p }) {
392
+ const m = p, a = n, o = C(a.modelValue), t = (c) => m("click", c);
393
+ return N(() => a.modelValue, (c) => o.value = c), N(o, () => m("update:modelValue", o.value)), (c, D) => ve((u(), s("tr", il, [
394
+ O("td", { colspan: c.hiddenColumnsColSpan }, [
395
+ O("table", null, [
396
+ O("tr", null, [
397
+ (u(!0), s(P, null, z(c.hiddenColumns, (g) => (u(), s("th", {
398
+ "data-column": g.key
399
399
  }, [
400
- U("div", null, Z(v.label), 1)
401
- ], 8, ll))), 256))
400
+ O("div", null, ne(g.label), 1)
401
+ ], 8, sl))), 256))
402
402
  ]),
403
- U("tr", { "data-i": c.i }, [
404
- (o(!0), d($, null, j(c.hiddenColumns, (v, T) => (o(), d("td", {
405
- "data-column": v.key,
406
- title: f(se)(v, a.value, T, c.hiddenColumns),
407
- onClick: S[1] || (S[1] = (l) => t(l))
403
+ O("tr", { "data-i": c.i }, [
404
+ (u(!0), s(P, null, z(c.hiddenColumns, (g, S) => (u(), s("td", {
405
+ "data-column": g.key,
406
+ title: v(se)(g, o.value, S, c.hiddenColumns),
407
+ onClick: D[1] || (D[1] = (l) => t(l))
408
408
  }, [
409
- c.$slots[v.key] ? w(c.$slots, v.key, {
409
+ c.$slots[g.key] ? w(c.$slots, g.key, {
410
410
  key: 0,
411
- value: a.value[v.key],
412
- item: a.value,
413
- column: v,
414
- i: T
415
- }) : (o(), C(ot, {
411
+ value: o.value[g.key],
412
+ item: o.value,
413
+ column: g,
414
+ i: S
415
+ }) : (u(), B(dt, {
416
416
  key: 1,
417
- column: v,
417
+ column: g,
418
418
  columns: c.hiddenColumns,
419
- modelValue: a.value,
420
- "onUpdate:modelValue": S[0] || (S[0] = (l) => a.value = l),
421
- i: T,
419
+ modelValue: o.value,
420
+ "onUpdate:modelValue": D[0] || (D[0] = (l) => o.value = l),
421
+ i: S,
422
422
  "edit-mode-enabled": c.editModeEnabled,
423
423
  "has-inline-edit-perm": c.hasInlineEditPerm
424
424
  }, null, 8, ["column", "columns", "modelValue", "i", "edit-mode-enabled", "has-inline-edit-perm"]))
425
- ], 8, ol))), 256))
426
- ], 8, al)
425
+ ], 8, ml))), 256))
426
+ ], 8, pl)
427
427
  ])
428
- ], 8, tl)
428
+ ], 8, dl)
429
429
  ], 512)), [
430
430
  [ye, c.hiddenIsVisible]
431
431
  ]);
432
432
  }
433
- }), xe = /* @__PURE__ */ x({
433
+ }), at = /* @__PURE__ */ _({
434
434
  __name: "CreateButton",
435
435
  props: {
436
- disabled: { type: Boolean, default: !1 },
437
- text: { default: "" },
438
- icon: { default: "" },
439
- to: { default: "" },
440
- modal: { default: "" },
441
- modalData: {}
436
+ config: { default: void 0 },
437
+ disabled: { type: Boolean, default: !1 }
442
438
  },
443
439
  emits: ["click", "append"],
444
- setup(n, { emit: m }) {
445
- const p = m, u = n, a = i(() => E.createButtonSlot !== ""), t = i(() => E.createButtonSlot), c = {
446
- ...u.modalData,
447
- beforeClose: (v) => {
448
- "itemCreated" in v && v.itemCreated === !0 && p("append", v.item);
440
+ setup(n, { emit: p }) {
441
+ var S;
442
+ const m = p, a = n, o = d(() => $.createButtonSlot !== ""), t = d(() => $.createButtonSlot), c = {
443
+ ...(S = a.config) == null ? void 0 : S.modalData,
444
+ beforeClose: (l) => {
445
+ "itemCreated" in l && l.itemCreated === !0 && m("append", l.item);
449
446
  }
450
- }, S = () => {
451
- if (!u.modal) {
452
- p("click");
447
+ }, D = {
448
+ ...a.config
449
+ };
450
+ D.modalData = c;
451
+ const g = () => {
452
+ var l;
453
+ if (!((l = a.config) != null && l.modal)) {
454
+ m("click");
453
455
  return;
454
456
  }
455
457
  };
456
- return (v, T) => {
457
- const l = z("lkt-button");
458
- return o(), C(l, {
459
- palette: "table-create",
460
- disabled: v.disabled,
461
- icon: a.value ? "" : v.icon,
462
- text: a.value ? "" : v.text,
463
- modal: v.modal,
464
- "modal-data": c,
465
- "on-click-to": v.to,
466
- onClick: S
467
- }, {
468
- default: F(() => [
469
- a.value ? (o(), C(_(t.value), { key: 0 })) : y("", !0)
458
+ return (l, R) => {
459
+ const H = K("lkt-button");
460
+ return u(), B(H, ie(D, {
461
+ disabled: l.disabled,
462
+ onClick: g
463
+ }), {
464
+ default: L(() => [
465
+ o.value ? (u(), B(X(t.value), { key: 0 })) : f("", !0)
470
466
  ]),
471
467
  _: 1
472
- }, 8, ["disabled", "icon", "text", "modal", "on-click-to"]);
468
+ }, 16, ["disabled"]);
473
469
  };
474
470
  }
475
- }), ul = ["data-column", "data-sortable", "data-sort", "colspan", "title"], rl = /* @__PURE__ */ x({
471
+ }), fl = ["data-column", "data-sortable", "data-sort", "colspan", "title"], vl = /* @__PURE__ */ _({
476
472
  __name: "TableHeader",
477
473
  props: {
478
- column: { default: () => new Re() },
474
+ column: { default: () => new Le() },
479
475
  sortBy: { default: "" },
480
476
  sortDirection: { default: "" },
481
477
  amountOfColumns: { default: 0 },
482
478
  items: { default: () => [] }
483
479
  },
484
480
  emits: ["click"],
485
- setup(n, { emit: m }) {
486
- const p = m, u = n, a = i(() => Nt(u.column, u.amountOfColumns, u.items)), t = i(() => u.column.sortable === !0), c = i(() => t.value && u.sortBy === u.column.key ? u.sortDirection : ""), S = i(() => u.column.label.startsWith("__:") ? be(u.column.label.substring(3)) : u.column.label), v = () => p("click", u.column);
487
- return (T, l) => (o(), d("th", {
488
- "data-column": T.column.key,
481
+ setup(n, { emit: p }) {
482
+ const m = p, a = n, o = d(() => Wt(a.column, a.amountOfColumns, a.items)), t = d(() => a.column.sortable === !0), c = d(() => t.value && a.sortBy === a.column.key ? a.sortDirection : ""), D = d(() => a.column.label.startsWith("__:") ? ut(a.column.label.substring(3)) : a.column.label), g = () => m("click", a.column);
483
+ return (S, l) => (u(), s("th", {
484
+ "data-column": S.column.key,
489
485
  "data-sortable": t.value,
490
486
  "data-sort": c.value,
491
- colspan: a.value,
492
- title: S.value,
493
- class: K(f(at)(T.column)),
494
- onClick: v
487
+ colspan: o.value,
488
+ title: D.value,
489
+ class: G(v(it)(S.column)),
490
+ onClick: g
495
491
  }, [
496
- U("div", null, Z(S.value), 1)
497
- ], 10, ul));
492
+ O("div", null, ne(D.value), 1)
493
+ ], 10, fl));
498
494
  }
499
- }), dl = ["id"], il = {
495
+ }), yl = ["id"], bl = {
500
496
  key: 0,
501
497
  class: "lkt-table-page-buttons"
502
- }, sl = { key: 1 }, ml = { class: "switch-edition-mode" }, fl = {
498
+ }, kl = { class: "switch-edition-mode" }, gl = {
503
499
  key: 1,
504
500
  class: "lkt-table-page-buttons"
505
- }, pl = {
501
+ }, hl = {
506
502
  key: 2,
507
503
  class: "lkt-table-page-filters"
508
- }, cl = ["data-sortable"], vl = { key: 0 }, yl = {
504
+ }, Cl = { class: "lkt-table" }, Bl = { key: 0 }, Dl = {
509
505
  key: 0,
510
506
  "data-role": "drag-indicator"
511
- }, bl = { key: 1 }, kl = { key: 2 }, hl = {
507
+ }, Sl = { key: 1 }, Il = { key: 2 }, Vl = {
512
508
  key: 3,
513
509
  class: "lkt-table-col-drop"
514
- }, gl = {
510
+ }, El = {
515
511
  key: 4,
516
512
  class: "lkt-table-col-edit"
517
- }, Cl = ["id"], Dl = ["id"], Bl = ["data-i"], Sl = ["data-i"], Il = ["data-i"], Tl = {
513
+ }, Tl = ["id"], wl = ["id"], $l = ["data-i"], Rl = ["data-i"], Ml = {
518
514
  key: 4,
519
515
  class: "lkt-table-empty"
520
- }, Vl = {
516
+ }, Ll = {
521
517
  key: 5,
522
518
  class: "lkt-table-page-buttons lkt-table-page-buttons-bottom"
523
- }, El = /* @__PURE__ */ x({
519
+ }, Pl = /* @__PURE__ */ _({
524
520
  __name: "LktTable",
525
- props: {
526
- modelValue: { default: () => [] },
527
- type: { default: Q.Table },
528
- columns: { default: () => [] },
529
- sorter: { type: Function, default: _e },
530
- draggableChecker: { type: Function, default: (n) => !0 },
531
- checkValidDrag: { type: Function, default: void 0 },
532
- renderDrag: { type: [Boolean, Function], default: !0 },
533
- disabledDrag: { type: [Boolean, Function] },
534
- sortable: { type: Boolean, default: !1 },
535
- hideEmptyColumns: { type: Boolean, default: !1 },
536
- initialSorting: { type: Boolean, default: !1 },
537
- draggableItemKey: { default: "name" },
538
- itemDisplayChecker: {},
539
- loading: { type: Boolean, default: !1 },
540
- page: { default: 1 },
541
- perms: { default: () => [] },
542
- resource: { default: "" },
543
- noResultsText: { default: E.defaultNoResultsMessage },
544
- title: { default: "" },
545
- titleTag: { default: "h2" },
546
- titleIcon: { default: "" },
547
- headerClass: { default: "" },
548
- wrapContentTag: { default: "div" },
549
- wrapContentClass: { default: "" },
550
- itemsContainerClass: { default: "" },
551
- filters: { default: () => [] },
552
- dataStateConfig: { default: () => ({}) },
553
- hiddenSave: { type: Boolean, default: !1 },
554
- editMode: { type: Boolean, default: !1 },
555
- saveDisabled: { type: Boolean, default: !1 },
556
- saveValidator: { type: Function, default: () => !0 },
557
- saveConfirm: { default: "" },
558
- confirmData: { default: () => ({}) },
559
- saveResource: { default: "" },
560
- saveResourceData: { default: () => ({}) },
561
- saveTooltipEngine: { default: "absolute" },
562
- splitSave: { type: Boolean, default: !1 },
563
- saveText: { default: "Save" },
564
- createText: { default: "Add item" },
565
- createIcon: { default: "" },
566
- createRoute: { default: "" },
567
- dropText: { default: "Delete" },
568
- dropIcon: { default: "" },
569
- editText: { default: "Edit" },
570
- editIcon: { default: "" },
571
- editLink: { default: "" },
572
- editModeText: { default: "Edit mode" },
573
- switchEditionEnabled: { type: Boolean, default: !1 },
521
+ props: /* @__PURE__ */ Ft({
522
+ modelValue: {},
523
+ type: {},
524
+ columns: {},
525
+ resource: {},
526
+ noResultsText: {},
527
+ filters: {},
528
+ hideEmptyColumns: { type: Boolean },
529
+ itemDisplayChecker: { type: Function },
530
+ rowDisplayType: { type: [Number, Function] },
531
+ loading: { type: Boolean },
532
+ page: {},
533
+ perms: {},
534
+ editMode: { type: Boolean },
535
+ dataStateConfig: {},
536
+ sortable: { type: Boolean },
537
+ sorter: { type: Function },
538
+ initialSorting: { type: Boolean },
539
+ drag: {},
540
+ paginator: {},
541
+ header: {},
542
+ title: {},
543
+ titleTag: {},
544
+ titleIcon: {},
545
+ headerClass: {},
546
+ saveButton: {},
547
+ createButton: {},
548
+ dropButton: {},
549
+ hiddenSave: { type: Boolean },
550
+ wrapContentTag: {},
551
+ wrapContentClass: {},
552
+ itemsContainerClass: {},
553
+ createText: {},
554
+ createIcon: {},
555
+ createRoute: {},
574
556
  createDisabled: { type: Boolean },
575
- dropConfirm: { default: "" },
576
- dropResource: { default: "" },
577
- addNavigation: { type: Boolean, default: !1 },
578
- itemMode: { type: Boolean, default: !1 },
579
- createEnabledValidator: { type: Function, default: void 0 },
580
- newValueGenerator: { type: Function, default: void 0 },
581
- requiredItemsForTopCreate: { default: 0 },
582
- requiredItemsForBottomCreate: { default: 0 },
583
- slotItemVar: { default: "item" },
584
- rowDisplayType: { type: [Number, Function], default: ne.Auto },
585
- modal: { default: "" },
586
- modalData: {}
587
- },
557
+ createEnabledValidator: { type: Function },
558
+ dropText: {},
559
+ dropIcon: {},
560
+ dropConfirm: {},
561
+ dropResource: {},
562
+ editText: {},
563
+ editIcon: {},
564
+ editLink: {},
565
+ editModeText: {},
566
+ switchEditionEnabled: { type: Boolean },
567
+ addNavigation: { type: Boolean },
568
+ newValueGenerator: { type: Function },
569
+ requiredItemsForTopCreate: {},
570
+ requiredItemsForBottomCreate: {},
571
+ slotItemVar: {}
572
+ }, At(Ot)),
588
573
  emits: [
589
574
  "update:modelValue",
590
575
  "update:perms",
@@ -599,495 +584,491 @@ const Wt = /* @__PURE__ */ x({
599
584
  "page",
600
585
  "drag-end"
601
586
  ],
602
- setup(n, { expose: m, emit: p }) {
603
- const u = p, a = tt(), t = n, c = {}, S = h(typeof t.sorter == "function" ? t.sorter : _e), v = h(Ot(t.columns)), T = h(Be.Asc), l = h(t.modelValue), M = h(c), G = h(null), L = h(t.columns), N = h(t.page), I = h(t.loading), ee = h(!1), R = h(t.perms), te = h(null), H = h(null), r = h({}), k = h(new Ft({ items: l.value }, t.dataStateConfig)), D = h(t.editMode), V = h(0), le = h(null), re = h(!1);
604
- P(I, (e) => u("update:loading", e)), P(N, (e) => u("page", e));
605
- const me = h(t.type);
606
- t.itemMode && me.value === Q.Table && (me.value = Q.Item);
607
- const nt = (e) => {
608
- R.value = e;
609
- }, ut = (e) => {
610
- Array.isArray(e.data) && (l.value = e.data), I.value = !1, ee.value = !0, k.value.store({ items: l.value }).turnStoredIntoOriginal(), re.value = !1, $e(() => {
611
- u("read-response", e);
587
+ setup(n, { expose: p, emit: m }) {
588
+ var et;
589
+ const a = m, o = nt(), t = n, c = {}, D = C(typeof t.sorter == "function" ? t.sorter : Kt), g = C(Jt(t.columns)), S = C(be.Asc), l = C(t.modelValue), R = C(c), H = C(null), F = C(t.columns), U = C((et = t.paginator) == null ? void 0 : et.modelValue), E = C(t.loading), x = C(!1), T = C(t.perms), ee = C(null), q = C(null), r = C({}), b = C(new qt({ items: l.value }, t.dataStateConfig)), I = C(t.editMode), V = C(0), te = C(null), ue = C(!1);
590
+ N(E, (e) => a("update:loading", e)), N(U, (e) => a("page", e));
591
+ const st = (e) => {
592
+ T.value = e;
593
+ }, pt = (e) => {
594
+ Array.isArray(e.data) && (l.value = e.data), E.value = !1, x.value = !0, b.value.store({ items: l.value }).turnStoredIntoOriginal(), ue.value = !1, Be(() => {
595
+ Ie.value, a("read-response", e);
612
596
  });
613
- }, rt = () => $e(() => I.value = !0), dt = () => {
614
- te.value.doRefresh();
615
- }, fe = Pt(12), Ie = i(() => {
597
+ }, mt = () => Be(() => E.value = !0), ct = () => {
598
+ ee.value.doRefresh();
599
+ }, pe = Ht(12), De = d(() => {
616
600
  if (!t.hideEmptyColumns) return [];
617
601
  let e = [];
618
- return L.value.forEach((s) => {
619
- let B = s.key, A = !1;
620
- l.value.forEach((W) => {
621
- if (typeof W.checkEmpty == "function")
622
- return W.checkEmpty(W);
623
- W[B] && (A = !0);
624
- }), A || e.push(B);
602
+ return F.value.forEach((i) => {
603
+ let k = i.key, M = !1;
604
+ l.value.forEach((A) => {
605
+ if (typeof A.checkEmpty == "function")
606
+ return A.checkEmpty(A);
607
+ A[k] && (M = !0);
608
+ }), M || e.push(k);
625
609
  }), e;
626
- }), ke = i(() => L.value.filter((e) => !e.hidden)), Te = i(() => L.value.filter((e) => e.hidden)), it = i(() => {
610
+ }), ke = d(() => F.value.filter((e) => !e.hidden)), Se = d(() => F.value.filter((e) => e.hidden)), ft = d(() => {
627
611
  let e = ke.value.length + 1;
628
612
  return t.sortable && ++e, e;
629
- }), st = i(() => L.value.filter((e) => e.isForRowKey)), Pe = i(() => Te.value.length > 0 && !t.sortable), mt = i(() => L.value.map((e) => e.key)), Fe = i(() => {
613
+ }), vt = d(() => F.value.filter((e) => e.isForRowKey)), Ne = d(() => Se.value.length > 0 && !t.sortable), yt = d(() => F.value.map((e) => e.key)), Fe = d(() => {
630
614
  let e = [];
631
- for (let s in a) mt.value.indexOf(s) !== -1 && e.push(s);
615
+ for (let i in o) yt.value.indexOf(i) !== -1 && e.push(i);
632
616
  return e;
633
- }), Le = i(() => t.hiddenSave || I.value || !t.saveResource ? !1 : D.value && re.value ? !0 : D.value), ft = i(() => ge.value && l.value.length >= t.requiredItemsForTopCreate || t.switchEditionEnabled ? !0 : Le.value || D.value && de.value), pt = i(() => t.saveDisabled || typeof t.saveValidator == "function" && !t.saveValidator(l.value) ? !1 : re.value), ct = i(() => l.value.length), vt = i(() => ({
634
- items: l.value,
635
- ...t.saveResourceData
636
- })), yt = i(() => t.titleTag === "" ? "h2" : t.titleTag), bt = i(() => t.wrapContentTag === "" ? "div" : t.wrapContentTag), Ve = i(() => t.title.startsWith("__:") ? be(t.title.substring(3)) : t.title), kt = i(() => t.saveText.startsWith("__:") ? be(t.saveText.substring(3)) : t.saveText), ht = i(() => t.editModeText.startsWith("__:") ? be(t.editModeText.substring(3)) : t.editModeText), de = i(() => R.value.includes(X.Create)), Ee = i(() => R.value.includes("read")), pe = i(() => R.value.includes(X.Update)), Ne = i(() => R.value.includes(X.Edit)), Ue = i(() => R.value.includes(X.InlineEdit)), gt = i(() => R.value.includes(X.ModalCreate)), Ct = i(() => R.value.includes(X.InlineCreate)), Ae = i(() => R.value.includes(X.InlineCreateEver)), ce = i(() => R.value.includes(X.Drop)), Dt = (e) => {
637
- let s = e.target;
638
- if (typeof s.dataset.column > "u")
617
+ }), Ue = d(() => {
618
+ var e;
619
+ return t.hiddenSave || E.value || !((e = t.saveButton) != null && e.resource || t.saveButton.type) ? !1 : I.value && ue.value ? !0 : I.value;
620
+ }), bt = d(() => Ce.value && l.value.length >= t.requiredItemsForTopCreate || t.switchEditionEnabled ? !0 : Ue.value || I.value && me.value), Ie = d(() => {
621
+ var e, i;
622
+ return V.value, typeof ((e = t.saveButton) == null ? void 0 : e.disabled) == "function" ? t.saveButton.disabled({
623
+ value: l.value,
624
+ dataState: b.value
625
+ }) : typeof ((i = t.saveButton) == null ? void 0 : i.disabled) == "boolean" ? t.saveButton.disabled : !ue.value;
626
+ }), kt = d(() => l.value.length), gt = d(() => {
627
+ var e;
628
+ return {
629
+ items: l.value,
630
+ ...(e = t.saveButton) == null ? void 0 : e.resourceData
631
+ };
632
+ }), ht = d(() => t.titleTag === "" ? "h2" : t.titleTag), Ct = d(() => t.wrapContentTag === "" ? "div" : t.wrapContentTag), Ve = d(() => lt(t.title)), Bt = d(() => lt(t.editModeText)), Ee = d(() => {
633
+ var e;
634
+ return (e = t.drag) == null ? void 0 : e.enabled;
635
+ }), me = d(() => T.value.includes(Z.Create)), Ae = d(() => T.value.includes("read")), ge = d(() => T.value.includes(Z.Update)), Oe = d(() => T.value.includes(Z.Edit)), He = d(() => T.value.includes(Z.InlineEdit)), Dt = d(() => T.value.includes(Z.ModalCreate)), St = d(() => T.value.includes(Z.InlineCreate)), qe = d(() => T.value.includes(Z.InlineCreateEver)), he = d(() => T.value.includes(Z.Drop)), It = (e) => {
636
+ let i = e.target;
637
+ if (typeof i.dataset.column > "u")
639
638
  do
640
- s = s.parentNode;
641
- while (typeof s.dataset.column > "u" && s.tagName !== "TABLE" && s.tagName !== "body");
642
- if (s.tagName === "TD" && (s = s.parentNode, s = s.dataset.i, typeof s < "u"))
643
- return l.value[s];
644
- }, Bt = (e) => l.value[e], St = (e) => {
645
- var s;
646
- return (s = G.value) == null ? void 0 : s.querySelector(`[data-i="${e}"]`);
647
- }, Oe = (e) => M.value["tr_" + e] === !0, He = (e) => {
648
- e && e.sortable && (l.value = l.value.sort((s, B) => S.value(s, B, e, T.value)), T.value = T.value === Be.Asc ? Be.Desc : Be.Asc, v.value = e.key, u("sort", [v.value, T.value]));
639
+ i = i.parentNode;
640
+ while (typeof i.dataset.column > "u" && i.tagName !== "TABLE" && i.tagName !== "body");
641
+ if (i.tagName === "TD" && (i = i.parentNode, i = i.dataset.i, typeof i < "u"))
642
+ return l.value[i];
643
+ }, Vt = (e) => l.value[e], Et = (e) => {
644
+ var i;
645
+ return (i = H.value) == null ? void 0 : i.querySelector(`[data-i="${e}"]`);
646
+ }, je = (e) => R.value["tr_" + e] === !0, Ke = (e) => {
647
+ e && e.sortable && (l.value = l.value.sort((i, k) => D.value(i, k, e, S.value)), S.value = S.value === be.Asc ? be.Desc : be.Asc, g.value = e.key, a("sort", [g.value, S.value]));
649
648
  }, We = (e) => {
650
- u("click", e);
651
- }, qe = (e, s) => {
652
- let B = "tr_" + s;
653
- M.value[B] = typeof M.value[B] > "u" ? !0 : !M.value[B];
654
- }, It = (e) => {
655
- var B, A, W, q;
656
- let s = parseInt((q = (W = (A = (B = e == null ? void 0 : e.originalEvent) == null ? void 0 : B.toElement) == null ? void 0 : A.closest("tr")) == null ? void 0 : W.dataset) == null ? void 0 : q.i);
657
- return typeof t.disabledDrag == "function" && t.disabledDrag(l.value[s]) || typeof t.disabledDrag == "boolean" && t.disabledDrag ? !1 : typeof t.checkValidDrag == "function" ? t.checkValidDrag(e) : !0;
658
- }, je = (e) => typeof t.draggableChecker == "function" ? t.draggableChecker(e) : !0, Ke = () => {
659
- if (de.value) {
660
- u("click-create");
649
+ a("click", e);
650
+ }, ze = (e, i) => {
651
+ let k = "tr_" + i;
652
+ R.value[k] = typeof R.value[k] > "u" ? !0 : !R.value[k];
653
+ }, Tt = (e) => {
654
+ var k, M, A, j, h, y, W, J;
655
+ let i = parseInt((j = (A = (M = (k = e == null ? void 0 : e.originalEvent) == null ? void 0 : k.toElement) == null ? void 0 : M.closest("tr")) == null ? void 0 : A.dataset) == null ? void 0 : j.i);
656
+ return !(typeof ((h = t.drag) == null ? void 0 : h.isValid) == "function" && !((y = t.drag) != null && y.isValid(l.value[i])) || typeof ((W = t.drag) == null ? void 0 : W.isValid) == "boolean" && !((J = t.drag) != null && J.isValid));
657
+ }, Ge = (e) => {
658
+ var i, k;
659
+ return typeof ((i = t.drag) == null ? void 0 : i.isDraggable) == "function" ? (k = t.drag) == null ? void 0 : k.isDraggable(e) : !0;
660
+ }, Je = () => {
661
+ if (me.value) {
662
+ a("click-create");
661
663
  return;
662
664
  }
663
- if (Ae.value)
664
- u("click-create");
665
+ if (qe.value)
666
+ a("click-create");
665
667
  else {
666
668
  if (typeof t.newValueGenerator == "function") {
667
669
  let e = t.newValueGenerator();
668
- if (typeof e == "object" || me.value !== Q.Table) {
670
+ if (typeof e == "object" || t.type !== ce.Table) {
669
671
  l.value.push(e);
670
672
  return;
671
673
  }
672
674
  }
673
675
  l.value.push({});
674
676
  }
675
- }, ze = (e) => {
677
+ }, Qe = (e) => {
676
678
  l.value.push(e);
677
- }, Ge = () => {
678
- I.value = !0;
679
- }, Je = () => {
680
- I.value = !1;
681
- }, Tt = (e, s) => {
682
- if (u("before-save"), t.saveResource && (I.value = !1, !s.success)) {
683
- u("error", s.httpStatus);
684
- return;
679
+ }, Xe = () => E.value = !0, Ye = () => E.value = !1, wt = (e, i) => {
680
+ var k, M, A;
681
+ if (!((k = t.saveButton) != null && k.type && [
682
+ Me.Split,
683
+ Me.SplitEver,
684
+ Me.SplitLazy
685
+ ].includes((M = t.saveButton) == null ? void 0 : M.type))) {
686
+ if (a("before-save"), (A = t.saveButton) != null && A.resource && (E.value = !1, !i.success)) {
687
+ a("error", i.httpStatus);
688
+ return;
689
+ }
690
+ b.value.turnStoredIntoOriginal(), ue.value = !1, a("save", i);
685
691
  }
686
- k.value.turnStoredIntoOriginal(), re.value = !1, u("save", s);
687
- }, Qe = (e, s, B) => {
688
- if (B >= e.length) {
689
- let A = B - e.length + 1;
690
- for (; A--; ) e.push(void 0);
692
+ }, Ze = (e, i, k) => {
693
+ if (k >= e.length) {
694
+ let M = k - e.length + 1;
695
+ for (; M--; ) e.push(void 0);
691
696
  }
692
- return e.splice(B, 0, e.splice(s, 1)[0]), e;
693
- }, Vt = (e) => {
694
- Qe(l.value, e, e - 1), V.value = Se();
695
- }, Et = (e) => {
696
- Qe(l.value, e, e + 1), V.value = Se();
697
- }, he = (e) => {
698
- l.value.splice(e, 1), V.value = Se();
699
- }, wt = () => {
697
+ return e.splice(k, 0, e.splice(i, 1)[0]), e;
698
+ }, $t = (e) => {
699
+ Ze(l.value, e, e - 1), V.value = fe();
700
+ }, Rt = (e) => {
701
+ Ze(l.value, e, e + 1), V.value = fe();
702
+ }, Te = (e) => {
703
+ l.value.splice(e, 1), V.value = fe();
704
+ }, Mt = () => {
700
705
  var e;
701
706
  r.value && typeof ((e = r.value) == null ? void 0 : e.destroy) == "function" && (r.value.destroy(), r.value = {});
702
- }, Xe = () => {
703
- le.value || (le.value = document.getElementById("lkt-table-body-" + fe)), r.value = new Lt(le.value, {
707
+ }, _e = () => {
708
+ te.value || (te.value = document.getElementById("lkt-table-body-" + pe)), r.value = new jt(te.value, {
704
709
  direction: "vertical",
705
710
  handle: ".handle",
706
711
  animation: 150,
707
712
  onEnd: function(e) {
708
- let s = e.oldIndex, B = e.newIndex;
709
- l.value.splice(B, 0, l.value.splice(s, 1)[0]), V.value = Se(), u("drag-end", l.value[B]);
713
+ let i = e.oldIndex, k = e.newIndex;
714
+ l.value.splice(k, 0, l.value.splice(i, 1)[0]), V.value = fe(), a("drag-end", l.value[k]);
710
715
  },
711
- onMove: function(e, s) {
712
- return It(e);
716
+ onMove: function(e, i) {
717
+ return Tt(e);
713
718
  }
714
719
  });
715
- }, we = (e, s, B = !1) => {
716
- let A = [V.value, fe, "row", s];
717
- return B && A.push("hidden"), st.value.forEach((W) => {
718
- let q = String(e[W.key]).toLowerCase();
719
- q.length > 50 && (q = q.substring(0, 50)), q = lt(q, " ", "-"), A.push(q);
720
- }), A.join("-");
721
- }, Ye = i(() => typeof t.createEnabledValidator == "function" ? t.createEnabledValidator({ items: l.value }) : !0), ge = i(() => Ae.value || de.value && D.value || Ct.value && D.value || gt.value && D.value), Ce = (e, s) => typeof t.itemDisplayChecker == "function" ? t.itemDisplayChecker(e) : !0;
722
- Mt(() => {
723
- t.initialSorting && He(Ht(t.columns, v.value)), k.value.store({ items: l.value }).turnStoredIntoOriginal(), re.value = !1, t.sortable && $e(() => {
724
- Xe();
720
+ }, we = (e, i, k = !1) => {
721
+ let M = [V.value, pe, "row", i];
722
+ return k && M.push("hidden"), vt.value.forEach((A) => {
723
+ let j = String(e[A.key]).toLowerCase();
724
+ j.length > 50 && (j = j.substring(0, 50)), j = rt(j, " ", "-"), M.push(j);
725
+ }), M.join("-");
726
+ }, xe = d(() => typeof t.createEnabledValidator == "function" ? t.createEnabledValidator({ items: l.value }) : !0), Ce = d(() => qe.value || me.value && I.value || St.value && I.value || Dt.value && I.value), Lt = d(() => [ce.Ol, ce.Ul].includes(t.type)), $e = (e, i) => typeof t.itemDisplayChecker == "function" ? t.itemDisplayChecker(e) : !0;
727
+ Ut(() => {
728
+ var e;
729
+ t.initialSorting && Ke(Qt(t.columns, g.value)), b.value.store({ items: l.value }).turnStoredIntoOriginal(), ue.value = !1, (e = t.drag) != null && e.enabled && Be(() => {
730
+ _e();
725
731
  });
726
- }), P(() => t.sortable, (e) => {
727
- e ? Xe() : wt();
728
- }), P(() => t.perms, (e) => R.value = e), P(R, (e) => u("update:perms", e)), P(() => t.editMode, (e) => D.value = e), P(() => t.columns, (e) => L.value = e, { deep: !0 }), P(() => t.modelValue, (e) => l.value = e, { deep: !0 }), P(l, (e) => {
729
- k.value.increment({ items: e }), re.value = k.value.changed(), u("update:modelValue", e);
730
- }, { deep: !0 }), m({
731
- getItemByEvent: Dt,
732
- getItemByIndex: Bt,
733
- getRowByIndex: St,
734
- doRefresh: dt,
735
- getHtml: () => H.value
732
+ }), N(() => {
733
+ var e;
734
+ return (e = t.drag) == null ? void 0 : e.enabled;
735
+ }, (e) => {
736
+ e ? _e() : Mt();
737
+ }), N(() => t.perms, (e) => T.value = e), N(T, (e) => a("update:perms", e)), N(() => t.editMode, (e) => I.value = e), N(() => t.columns, (e) => F.value = e, { deep: !0 }), N(() => t.modelValue, (e) => l.value = e, { deep: !0 }), N(l, (e) => {
738
+ b.value.increment({ items: e }), ue.value = b.value.changed(), a("update:modelValue", e);
739
+ }, { deep: !0 }), p({
740
+ getItemByEvent: It,
741
+ getItemByIndex: Vt,
742
+ getRowByIndex: Et,
743
+ doRefresh: ct,
744
+ getHtml: () => q.value,
745
+ turnStoredIntoOriginal: () => {
746
+ b.value.turnStoredIntoOriginal(), Be(() => {
747
+ V.value = fe();
748
+ });
749
+ }
736
750
  });
737
- const $t = i(() => typeof E.defaultEmptySlot < "u"), Rt = i(() => E.defaultEmptySlot);
738
- return (e, s) => {
739
- const B = z("lkt-button"), A = z("lkt-field"), W = z("lkt-loader"), q = z("lkt-paginator");
740
- return o(), d("section", {
751
+ const Pt = d(() => typeof $.defaultEmptySlot < "u"), Nt = d(() => $.defaultEmptySlot);
752
+ return (e, i) => {
753
+ const k = K("lkt-button"), M = K("lkt-field"), A = K("lkt-loader"), j = K("lkt-paginator");
754
+ return u(), s("section", {
741
755
  ref_key: "element",
742
- ref: H,
756
+ ref: q,
743
757
  class: "lkt-table-page",
744
- id: "lkt-table-page-" + f(fe)
758
+ id: "lkt-table-page-" + v(pe)
745
759
  }, [
746
- Ve.value || f(a).title ? (o(), d("header", {
760
+ Ve.value || v(o).title ? (u(), s("header", {
747
761
  key: 0,
748
- class: K(e.headerClass)
762
+ class: G(e.headerClass)
749
763
  }, [
750
- Ve.value ? (o(), C(_(yt.value), { key: 0 }, {
751
- default: F(() => [
752
- e.titleIcon ? (o(), d("i", {
764
+ Ve.value ? (u(), B(X(ht.value), { key: 0 }, {
765
+ default: L(() => [
766
+ e.titleIcon ? (u(), s("i", {
753
767
  key: 0,
754
- class: K(e.titleIcon)
755
- }, null, 2)) : y("", !0),
756
- ue(" " + Z(Ve.value), 1)
768
+ class: G(e.titleIcon)
769
+ }, null, 2)) : f("", !0),
770
+ oe(" " + ne(Ve.value), 1)
757
771
  ]),
758
772
  _: 1
759
- })) : y("", !0),
760
- f(a).title ? w(e.$slots, "title", { key: 1 }) : y("", !0)
761
- ], 2)) : y("", !0),
762
- (o(), C(_(bt.value), {
763
- class: K(["lkt-table-page-content-wrapper", e.wrapContentClass])
773
+ })) : f("", !0),
774
+ v(o).title ? w(e.$slots, "title", { key: 1 }) : f("", !0)
775
+ ], 2)) : f("", !0),
776
+ (u(), B(X(Ct.value), {
777
+ class: G(["lkt-table-page-content-wrapper", e.wrapContentClass])
764
778
  }, {
765
- default: F(() => [
766
- ft.value ? (o(), d("div", il, [
767
- ve(ie(B, {
779
+ default: L(() => [
780
+ bt.value ? (u(), s("div", bl, [
781
+ ve(de(k, ie({
768
782
  class: "lkt-table--save-button",
769
- ref: "saveButton",
770
- icon: f(E).defaultSaveIcon,
771
- disabled: !pt.value,
772
- "confirm-modal": e.saveConfirm,
773
- "confirm-data": e.confirmData,
774
- resource: e.saveResource,
775
- "resource-data": vt.value,
776
- split: e.splitSave,
777
- "tooltip-engine": e.saveTooltipEngine,
778
- onLoading: Ge,
779
- onLoaded: Je,
780
- onClick: Tt
781
- }, {
782
- split: F(({ doClose: g, doRootClick: b }) => [
783
+ ref: "saveButton"
784
+ }, e.saveButton, {
785
+ disabled: Ie.value,
786
+ "modal-data": gt.value,
787
+ onLoading: Xe,
788
+ onLoaded: Ye,
789
+ onClick: wt
790
+ }), {
791
+ split: L(({ doClose: h, doRootClick: y }) => [
783
792
  w(e.$slots, "button-save-split", {
784
- doClose: g,
785
- doRootClick: b,
786
- dataState: k.value,
787
- onButtonLoading: Ge,
788
- onButtonLoaded: Je
793
+ doClose: h,
794
+ doRootClick: y,
795
+ dataState: b.value,
796
+ onButtonLoading: Xe,
797
+ onButtonLoaded: Ye
789
798
  })
790
799
  ]),
791
- default: F(() => [
792
- f(a)["button-save"] ? w(e.$slots, "button-save", {
800
+ default: L(() => [
801
+ v(o)["button-save"] ? w(e.$slots, "button-save", {
793
802
  key: 0,
794
803
  items: l.value,
795
804
  editMode: e.editMode,
796
- canUpdate: !e.saveDisabled
797
- }) : (o(), d("span", sl, Z(kt.value), 1))
805
+ canUpdate: !Ie.value
806
+ }) : f("", !0)
798
807
  ]),
799
808
  _: 3
800
- }, 8, ["icon", "disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "split", "tooltip-engine"]), [
801
- [ye, Le.value]
809
+ }, 16, ["disabled", "modal-data"]), [
810
+ [ye, Ue.value]
802
811
  ]),
803
- ge.value && l.value.length >= e.requiredItemsForTopCreate ? (o(), C(xe, {
812
+ Ce.value && l.value.length >= e.requiredItemsForTopCreate ? (u(), B(at, {
804
813
  key: 0,
805
- disabled: !Ye.value || e.createDisabled,
806
- text: e.createText,
807
- icon: e.createIcon,
808
- to: e.createRoute,
809
- modal: e.modal,
810
- "modal-data": e.modalData,
811
- onClick: Ke,
812
- onAppend: ze
813
- }, null, 8, ["disabled", "text", "icon", "to", "modal", "modal-data"])) : y("", !0),
814
- U("div", ml, [
815
- ve(ie(A, {
814
+ config: e.createButton,
815
+ disabled: !xe.value || e.createDisabled,
816
+ onClick: Je,
817
+ onAppend: Qe
818
+ }, null, 8, ["config", "disabled"])) : f("", !0),
819
+ O("div", kl, [
820
+ ve(de(M, {
816
821
  type: "switch",
817
- modelValue: D.value,
818
- "onUpdate:modelValue": s[0] || (s[0] = (g) => D.value = g),
819
- label: ht.value
822
+ modelValue: I.value,
823
+ "onUpdate:modelValue": i[0] || (i[0] = (h) => I.value = h),
824
+ label: Bt.value
820
825
  }, null, 8, ["modelValue", "label"]), [
821
826
  [ye, e.switchEditionEnabled]
822
827
  ])
823
828
  ])
824
- ])) : y("", !0),
825
- f(a).buttons ? (o(), d("div", fl, [
829
+ ])) : f("", !0),
830
+ v(o).buttons ? (u(), s("div", gl, [
826
831
  w(e.$slots, "buttons")
827
- ])) : y("", !0),
828
- ee.value && f(a).filters ? (o(), d("div", pl, [
832
+ ])) : f("", !0),
833
+ x.value && v(o).filters ? (u(), s("div", hl, [
829
834
  w(e.$slots, "filters", {
830
835
  items: l.value,
831
- isLoading: I.value
836
+ isLoading: E.value
832
837
  })
833
- ])) : y("", !0),
834
- I.value ? (o(), C(W, { key: 3 })) : y("", !0),
835
- ve(U("div", {
836
- class: "lkt-table",
837
- "data-sortable": e.sortable
838
- }, [
839
- me.value === f(Q).Table ? (o(), d("table", vl, [
840
- U("thead", null, [
841
- U("tr", null, [
842
- e.sortable && D.value ? (o(), d("th", yl)) : y("", !0),
843
- e.addNavigation && D.value ? (o(), d("th", bl)) : y("", !0),
844
- Pe.value ? (o(), d("th", kl)) : y("", !0),
845
- (o(!0), d($, null, j(ke.value, (g) => (o(), d($, null, [
846
- Ie.value.indexOf(g.key) === -1 ? (o(), C(rl, {
838
+ ])) : f("", !0),
839
+ E.value ? (u(), B(A, { key: 3 })) : f("", !0),
840
+ ve(O("div", Cl, [
841
+ e.type === v(ce).Table ? (u(), s("table", Bl, [
842
+ O("thead", null, [
843
+ O("tr", null, [
844
+ Ee.value && I.value ? (u(), s("th", Dl)) : f("", !0),
845
+ e.addNavigation && I.value ? (u(), s("th", Sl)) : f("", !0),
846
+ Ne.value ? (u(), s("th", Il)) : f("", !0),
847
+ (u(!0), s(P, null, z(ke.value, (h) => (u(), s(P, null, [
848
+ De.value.indexOf(h.key) === -1 ? (u(), B(vl, {
847
849
  key: 0,
848
- column: g,
849
- "sort-by": v.value,
850
- "sort-direction": T.value,
850
+ column: h,
851
+ "sort-by": g.value,
852
+ "sort-direction": S.value,
851
853
  "amount-of-columns": e.columns.length,
852
854
  items: l.value,
853
- onClick: (b) => He(g)
854
- }, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : y("", !0)
855
+ onClick: (y) => Ke(h)
856
+ }, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : f("", !0)
855
857
  ], 64))), 256)),
856
- ce.value && D.value ? (o(), d("th", hl)) : y("", !0),
857
- Ne.value && pe.value && D.value ? (o(), d("th", gl)) : y("", !0)
858
+ he.value && I.value ? (u(), s("th", Vl)) : f("", !0),
859
+ Oe.value && ge.value && I.value ? (u(), s("th", El)) : f("", !0)
858
860
  ])
859
861
  ]),
860
- U("tbody", {
862
+ O("tbody", {
861
863
  ref_key: "tableBody",
862
- ref: G,
863
- id: "lkt-table-body-" + f(fe)
864
+ ref: H,
865
+ id: "lkt-table-body-" + v(pe)
864
866
  }, [
865
- (o(!0), d($, null, j(l.value, (g, b) => ve((o(), C(xt, {
866
- modelValue: l.value[b],
867
- "onUpdate:modelValue": (O) => l.value[b] = O,
868
- key: we(g, b),
869
- i: b,
870
- "display-hidden-columns-indicator": Pe.value,
871
- "is-draggable": je(g),
872
- sortable: e.sortable,
873
- "visible-columns": ke.value,
874
- "empty-columns": Ie.value,
875
- "add-navigation": e.addNavigation,
876
- "hidden-is-visible": Oe(b),
877
- "latest-row": b + 1 === ct.value,
878
- "can-drop": ce.value && D.value,
879
- "drop-confirm": e.dropConfirm,
880
- "drop-resource": e.dropResource,
881
- "drop-text": e.dropText,
882
- "drop-icon": e.dropIcon,
883
- "can-edit": Ne.value && pe.value && D.value,
884
- "edit-text": e.editText,
885
- "edit-icon": e.editIcon,
886
- "edit-link": e.editLink,
887
- "edit-mode-enabled": D.value,
888
- "has-inline-edit-perm": Ue.value,
889
- "row-display-type": e.rowDisplayType,
890
- "render-drag": e.renderDrag,
891
- "disabled-drag": e.disabledDrag,
892
- onClick: We,
893
- onShow: qe,
894
- onItemUp: Vt,
895
- onItemDown: Et,
896
- onItemDrop: he
897
- }, Ze({ _: 2 }, [
898
- f(a)[`item-${b}`] ? {
899
- name: `item-${b}`,
900
- fn: F((O) => [
901
- w(e.$slots, `item-${b}`, Y({
902
- [e.slotItemVar || ""]: O.item,
903
- index: b
904
- }))
905
- ]),
906
- key: "0"
907
- } : f(a).item ? {
908
- name: "item",
909
- fn: F((O) => [
910
- w(e.$slots, "item", Y({
911
- [e.slotItemVar || ""]: O.item,
912
- index: b
913
- }))
914
- ]),
915
- key: "1"
916
- } : void 0,
917
- j(Fe.value, (O) => ({
918
- name: O,
919
- fn: F((ae) => [
920
- w(e.$slots, O, Y({
921
- [e.slotItemVar || ""]: ae.item,
922
- value: ae.value,
923
- column: ae.column
924
- }))
925
- ])
926
- }))
927
- ]), 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", "can-edit", "edit-text", "edit-icon", "edit-link", "edit-mode-enabled", "has-inline-edit-perm", "row-display-type", "render-drag", "disabled-drag"])), [
928
- [ye, Ce(l.value[b])]
929
- ])), 128)),
930
- Te.value.length > 0 ? (o(!0), d($, { key: 0 }, j(l.value, (g, b) => (o(), C(nl, {
931
- modelValue: l.value[b],
932
- "onUpdate:modelValue": (O) => l.value[b] = O,
933
- key: we(g, b, !0),
934
- i: b,
935
- "hidden-columns": Te.value,
936
- "hidden-columns-col-span": it.value,
937
- "is-draggable": je(g),
938
- sortable: e.sortable,
867
+ (u(!0), s(P, null, z(l.value, (h, y) => {
868
+ var W, J;
869
+ return ve((u(), B(rl, {
870
+ modelValue: l.value[y],
871
+ "onUpdate:modelValue": (Y) => l.value[y] = Y,
872
+ key: we(h, y),
873
+ i: y,
874
+ "display-hidden-columns-indicator": Ne.value,
875
+ "is-draggable": Ge(h),
876
+ sortable: Ee.value,
877
+ "visible-columns": ke.value,
878
+ "empty-columns": De.value,
879
+ "add-navigation": e.addNavigation,
880
+ "hidden-is-visible": je(y),
881
+ "latest-row": y + 1 === kt.value,
882
+ "can-drop": he.value && I.value,
883
+ "drop-confirm": e.dropConfirm,
884
+ "drop-resource": e.dropResource,
885
+ "drop-text": e.dropText,
886
+ "drop-icon": e.dropIcon,
887
+ "can-edit": Oe.value && ge.value && I.value,
888
+ "edit-text": e.editText,
889
+ "edit-icon": e.editIcon,
890
+ "edit-link": e.editLink,
891
+ "edit-mode-enabled": I.value,
892
+ "has-inline-edit-perm": He.value,
893
+ "row-display-type": e.rowDisplayType,
894
+ "render-drag": (W = e.drag) == null ? void 0 : W.canRender,
895
+ "disabled-drag": (J = e.drag) == null ? void 0 : J.isDisabled,
896
+ onClick: We,
897
+ onShow: ze,
898
+ onItemUp: $t,
899
+ onItemDown: Rt,
900
+ onItemDrop: Te
901
+ }, tt({ _: 2 }, [
902
+ v(o)[`item-${y}`] ? {
903
+ name: `item-${y}`,
904
+ fn: L((Y) => [
905
+ w(e.$slots, `item-${y}`, ae({
906
+ [e.slotItemVar || ""]: Y.item,
907
+ index: y
908
+ }))
909
+ ]),
910
+ key: "0"
911
+ } : v(o).item ? {
912
+ name: "item",
913
+ fn: L((Y) => [
914
+ w(e.$slots, "item", ae({
915
+ [e.slotItemVar || ""]: Y.item,
916
+ index: y
917
+ }))
918
+ ]),
919
+ key: "1"
920
+ } : void 0,
921
+ z(Fe.value, (Y) => ({
922
+ name: Y,
923
+ fn: L((Re) => [
924
+ w(e.$slots, Y, ae({
925
+ [e.slotItemVar || ""]: Re.item,
926
+ value: Re.value,
927
+ column: Re.column
928
+ }))
929
+ ])
930
+ }))
931
+ ]), 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", "can-edit", "edit-text", "edit-icon", "edit-link", "edit-mode-enabled", "has-inline-edit-perm", "row-display-type", "render-drag", "disabled-drag"])), [
932
+ [ye, $e(l.value[y])]
933
+ ]);
934
+ }), 128)),
935
+ Se.value.length > 0 ? (u(!0), s(P, { key: 0 }, z(l.value, (h, y) => (u(), B(cl, {
936
+ modelValue: l.value[y],
937
+ "onUpdate:modelValue": (W) => l.value[y] = W,
938
+ key: we(h, y, !0),
939
+ i: y,
940
+ "hidden-columns": Se.value,
941
+ "hidden-columns-col-span": ft.value,
942
+ "is-draggable": Ge(h),
943
+ sortable: Ee.value,
939
944
  "visible-columns": ke.value,
940
- "empty-columns": Ie.value,
941
- "hidden-is-visible": Oe(b),
942
- "edit-mode-enabled": D.value,
943
- "has-inline-edit-perm": Ue.value,
945
+ "empty-columns": De.value,
946
+ "hidden-is-visible": je(y),
947
+ "edit-mode-enabled": I.value,
948
+ "has-inline-edit-perm": He.value,
944
949
  onClick: We,
945
- onShow: qe
946
- }, Ze({ _: 2 }, [
947
- j(Fe.value, (O) => ({
948
- name: O,
949
- fn: F((ae) => [
950
- w(e.$slots, O, Y({
951
- [e.slotItemVar || ""]: ae.item,
952
- value: ae.value,
953
- column: ae.column
950
+ onShow: ze
951
+ }, tt({ _: 2 }, [
952
+ z(Fe.value, (W) => ({
953
+ name: W,
954
+ fn: L((J) => [
955
+ w(e.$slots, W, ae({
956
+ [e.slotItemVar || ""]: J.item,
957
+ value: J.value,
958
+ column: J.column
954
959
  }))
955
960
  ])
956
961
  }))
957
- ]), 1032, ["modelValue", "onUpdate:modelValue", "i", "hidden-columns", "hidden-columns-col-span", "is-draggable", "sortable", "visible-columns", "empty-columns", "hidden-is-visible", "edit-mode-enabled", "has-inline-edit-perm"]))), 128)) : y("", !0)
958
- ], 8, Cl)
959
- ])) : me.value === f(Q).Item ? (o(), d("div", {
962
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "i", "hidden-columns", "hidden-columns-col-span", "is-draggable", "sortable", "visible-columns", "empty-columns", "hidden-is-visible", "edit-mode-enabled", "has-inline-edit-perm"]))), 128)) : f("", !0)
963
+ ], 8, Tl)
964
+ ])) : e.type === v(ce).Item ? (u(), s("div", {
960
965
  key: 1,
961
966
  ref_key: "tableBody",
962
- ref: G,
963
- id: "lkt-table-body-" + f(fe),
964
- class: K(["lkt-table-items-container", e.itemsContainerClass])
967
+ ref: H,
968
+ id: "lkt-table-body-" + v(pe),
969
+ class: G(["lkt-table-items-container", e.itemsContainerClass])
965
970
  }, [
966
- (o(!0), d($, null, j(l.value, (g, b) => (o(), d($, null, [
967
- Ce(g) ? (o(), d("div", {
971
+ (u(!0), s(P, null, z(l.value, (h, y) => (u(), s(P, null, [
972
+ $e(h) ? (u(), s("div", {
968
973
  class: "lkt-table-item",
969
- "data-i": b,
970
- key: we(g, b)
974
+ "data-i": y,
975
+ key: we(h, y)
971
976
  }, [
972
- w(e.$slots, "item", Y({
973
- [e.slotItemVar || ""]: g,
974
- index: b,
975
- editing: D.value,
976
- canCreate: de.value,
977
- canRead: Ee.value,
978
- canUpdate: pe.value,
979
- canDrop: ce.value,
980
- isLoading: I.value,
981
- doDrop: () => he(b)
977
+ w(e.$slots, "item", ae({
978
+ [e.slotItemVar || ""]: h,
979
+ index: y,
980
+ editing: I.value,
981
+ canCreate: me.value,
982
+ canRead: Ae.value,
983
+ canUpdate: ge.value,
984
+ canDrop: he.value,
985
+ isLoading: E.value,
986
+ doDrop: () => Te(y)
982
987
  }))
983
- ], 8, Bl)) : y("", !0)
988
+ ], 8, $l)) : f("", !0)
984
989
  ], 64))), 256))
985
- ], 10, Dl)) : f(Q).Ul ? (o(), d("ul", {
990
+ ], 10, wl)) : Lt.value ? (u(), B(X(e.type), {
986
991
  key: 2,
987
- class: K(["lkt-table-items-container", e.itemsContainerClass])
988
- }, [
989
- (o(!0), d($, null, j(l.value, (g, b) => (o(), d($, null, [
990
- Ce(g) ? (o(), d("li", {
991
- key: 0,
992
- class: "lkt-table-item",
993
- "data-i": b
994
- }, [
995
- w(e.$slots, "item", Y({
996
- [e.slotItemVar || ""]: g,
997
- index: b,
998
- editing: D.value,
999
- canCreate: de.value,
1000
- canRead: Ee.value,
1001
- canUpdate: pe.value,
1002
- canDrop: ce.value,
1003
- isLoading: I.value,
1004
- doDrop: () => he(b)
1005
- }))
1006
- ], 8, Sl)) : y("", !0)
1007
- ], 64))), 256))
1008
- ], 2)) : f(Q).Ul ? (o(), d("ol", {
1009
- key: 3,
1010
- class: K(["lkt-table-items-container", e.itemsContainerClass])
1011
- }, [
1012
- (o(!0), d($, null, j(l.value, (g, b) => (o(), d($, null, [
1013
- Ce(g) ? (o(), d("li", {
1014
- key: 0,
1015
- class: "lkt-table-item",
1016
- "data-i": b
1017
- }, [
1018
- w(e.$slots, "item", Y({
1019
- [e.slotItemVar || ""]: g,
1020
- index: b,
1021
- editing: D.value,
1022
- canCreate: de.value,
1023
- canRead: Ee.value,
1024
- canUpdate: pe.value,
1025
- canDrop: ce.value,
1026
- isLoading: I.value,
1027
- doDrop: () => he(b)
1028
- }))
1029
- ], 8, Il)) : y("", !0)
1030
- ], 64))), 256))
1031
- ], 2)) : y("", !0)
1032
- ], 8, cl), [
1033
- [ye, !I.value && l.value.length > 0]
992
+ class: G(["lkt-table-items-container", e.itemsContainerClass])
993
+ }, {
994
+ default: L(() => [
995
+ (u(!0), s(P, null, z(l.value, (h, y) => (u(), s(P, null, [
996
+ $e(h) ? (u(), s("li", {
997
+ key: 0,
998
+ class: "lkt-table-item",
999
+ "data-i": y
1000
+ }, [
1001
+ w(e.$slots, "item", ae({
1002
+ [e.slotItemVar || ""]: h,
1003
+ index: y,
1004
+ editing: I.value,
1005
+ canCreate: me.value,
1006
+ canRead: Ae.value,
1007
+ canUpdate: ge.value,
1008
+ canDrop: he.value,
1009
+ isLoading: E.value,
1010
+ doDrop: () => Te(y)
1011
+ }))
1012
+ ], 8, Rl)) : f("", !0)
1013
+ ], 64))), 256))
1014
+ ]),
1015
+ _: 3
1016
+ }, 8, ["class"])) : f("", !0)
1017
+ ], 512), [
1018
+ [ye, !E.value && l.value.length > 0]
1034
1019
  ]),
1035
- !I.value && l.value.length === 0 ? (o(), d("div", Tl, [
1036
- f(a).empty ? w(e.$slots, "empty", { key: 0 }) : $t.value ? (o(), C(_(Rt.value), {
1020
+ !E.value && l.value.length === 0 ? (u(), s("div", Ml, [
1021
+ v(o).empty ? w(e.$slots, "empty", { key: 0 }) : Pt.value ? (u(), B(X(Nt.value), {
1037
1022
  key: 1,
1038
1023
  message: e.noResultsText
1039
- }, null, 8, ["message"])) : e.noResultsText ? (o(), d($, { key: 2 }, [
1040
- ue(Z(e.noResultsText), 1)
1041
- ], 64)) : y("", !0)
1042
- ])) : y("", !0),
1043
- ge.value || f(a).bottomButtons ? (o(), d("div", Vl, [
1044
- ge.value && l.value.length >= e.requiredItemsForBottomCreate ? (o(), C(xe, {
1024
+ }, null, 8, ["message"])) : e.noResultsText ? (u(), s(P, { key: 2 }, [
1025
+ oe(ne(e.noResultsText), 1)
1026
+ ], 64)) : f("", !0)
1027
+ ])) : f("", !0),
1028
+ Ce.value || v(o).bottomButtons ? (u(), s("div", Ll, [
1029
+ Ce.value && l.value.length >= e.requiredItemsForBottomCreate ? (u(), B(at, {
1045
1030
  key: 0,
1046
- disabled: !Ye.value || e.createDisabled,
1047
- text: e.createText,
1048
- icon: e.createIcon,
1049
- to: e.createRoute,
1050
- modal: e.modal,
1051
- "modal-data": e.modalData,
1052
- onClick: Ke,
1053
- onAppend: ze
1054
- }, null, 8, ["disabled", "text", "icon", "to", "modal", "modal-data"])) : y("", !0),
1031
+ config: e.createButton,
1032
+ disabled: !xe.value || e.createDisabled,
1033
+ onClick: Je,
1034
+ onAppend: Qe
1035
+ }, null, 8, ["config", "disabled"])) : f("", !0),
1055
1036
  w(e.$slots, "bottom-buttons")
1056
- ])) : y("", !0),
1057
- e.resource.length > 0 ? (o(), C(q, {
1037
+ ])) : f("", !0),
1038
+ e.resource.length > 0 ? (u(), B(j, {
1058
1039
  key: 6,
1059
- ref_key: "paginator",
1060
- ref: te,
1061
- modelValue: N.value,
1062
- "onUpdate:modelValue": s[1] || (s[1] = (g) => N.value = g),
1040
+ ref_key: "paginatorRef",
1041
+ ref: ee,
1042
+ modelValue: U.value,
1043
+ "onUpdate:modelValue": i[1] || (i[1] = (h) => U.value = h),
1063
1044
  resource: e.resource,
1064
1045
  filters: e.filters,
1065
- onLoading: rt,
1066
- onPerms: nt,
1067
- onResponse: ut
1068
- }, null, 8, ["modelValue", "resource", "filters"])) : y("", !0)
1046
+ onLoading: mt,
1047
+ onPerms: st,
1048
+ onResponse: pt
1049
+ }, null, 8, ["modelValue", "resource", "filters"])) : f("", !0)
1069
1050
  ]),
1070
1051
  _: 3
1071
1052
  }, 8, ["class"]))
1072
- ], 8, dl);
1053
+ ], 8, yl);
1073
1054
  };
1074
1055
  }
1075
- }), Ul = {
1056
+ }), Kl = {
1076
1057
  install: (n) => {
1077
- n.component("lkt-table") === void 0 && n.component("lkt-table", El);
1058
+ n.component("lkt-table") === void 0 && n.component("lkt-table", Pl);
1078
1059
  }
1079
- }, Al = (n) => (E.navButtonSlot = n, !0), Ol = (n) => (E.dropButtonSlot = n, !0), Hl = (n) => (E.createButtonSlot = n, !0), Wl = (n) => {
1080
- E.defaultEmptySlot = n;
1081
- }, ql = (n) => {
1082
- E.defaultSaveIcon = n;
1060
+ }, Wl = (n) => ($.navButtonSlot = n, !0), zl = (n) => ($.dropButtonSlot = n, !0), Gl = (n) => ($.createButtonSlot = n, !0), Jl = (n) => {
1061
+ $.defaultEmptySlot = n;
1062
+ }, Ql = (n) => {
1063
+ $.defaultSaveIcon = n;
1083
1064
  };
1084
1065
  export {
1085
- zl as Column,
1086
- Nl as createColumn,
1087
- Ul as default,
1088
- Hl as setTableCreateButtonSlot,
1089
- Ol as setTableDropButtonSlot,
1090
- Wl as setTableEmptySlot,
1091
- Al as setTableNavButtonSlot,
1092
- ql as setTableSaveIcon
1066
+ Zl as Column,
1067
+ jl as createColumn,
1068
+ Kl as default,
1069
+ Gl as setTableCreateButtonSlot,
1070
+ zl as setTableDropButtonSlot,
1071
+ Jl as setTableEmptySlot,
1072
+ Wl as setTableNavButtonSlot,
1073
+ Ql as setTableSaveIcon
1093
1074
  };