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