lkt-table 1.2.2 → 1.2.3
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 +297 -297
- package/dist/build.js +165 -165
- package/package.json +1 -1
- package/src/lib-components/LktTable.vue +1 -1
package/dist/build.js
CHANGED
|
@@ -14,40 +14,40 @@ import vt from "lkt-field-select";
|
|
|
14
14
|
import ht from "lkt-field-switch";
|
|
15
15
|
import yt from "lkt-field-file";
|
|
16
16
|
class U {
|
|
17
|
-
constructor(
|
|
18
|
-
this.key =
|
|
17
|
+
constructor(t = "", r = "") {
|
|
18
|
+
this.key = t, this.label = r, this.sortable = !0, this.hidden = !1, this.formatter = void 0, this.checkEmpty = void 0, this.colspan = void 0, this.resource = "", this.resourceData = {}, this.isMultiple = !1, this.isLoading = !1, this.resourceLoaded = !1, this.valueSlot = "", this.editSlot = "", this.multipleDisplay = "", this.multipleDisplayEdition = "";
|
|
19
19
|
}
|
|
20
|
-
setIsSortable(
|
|
21
|
-
return this.sortable =
|
|
20
|
+
setIsSortable(t = !0) {
|
|
21
|
+
return this.sortable = t, this;
|
|
22
22
|
}
|
|
23
|
-
setIsEditable(
|
|
24
|
-
return this.editable =
|
|
23
|
+
setIsEditable(t = !0) {
|
|
24
|
+
return this.editable = t, this;
|
|
25
25
|
}
|
|
26
|
-
setIsHidden(
|
|
27
|
-
return this.hidden =
|
|
26
|
+
setIsHidden(t = !0) {
|
|
27
|
+
return this.hidden = t, this;
|
|
28
28
|
}
|
|
29
|
-
setIsLoading(
|
|
30
|
-
return this.isLoading =
|
|
29
|
+
setIsLoading(t = !0) {
|
|
30
|
+
return this.isLoading = t, this;
|
|
31
31
|
}
|
|
32
|
-
setFormatter(
|
|
33
|
-
return this.formatter =
|
|
32
|
+
setFormatter(t = void 0) {
|
|
33
|
+
return this.formatter = t, this;
|
|
34
34
|
}
|
|
35
|
-
setEmptyChecker(
|
|
36
|
-
return this.checkEmpty =
|
|
35
|
+
setEmptyChecker(t = void 0) {
|
|
36
|
+
return this.checkEmpty = t, this;
|
|
37
37
|
}
|
|
38
|
-
setColSpan(
|
|
38
|
+
setColSpan(t = void 0) {
|
|
39
39
|
return this.colspan = void 0, this;
|
|
40
40
|
}
|
|
41
|
-
getHref(
|
|
42
|
-
return typeof this.link == "function" ? this.link(
|
|
41
|
+
getHref(t) {
|
|
42
|
+
return typeof this.link == "function" ? this.link(t) : this.link;
|
|
43
43
|
}
|
|
44
|
-
doAction(
|
|
44
|
+
doAction(t) {
|
|
45
45
|
if (typeof this.action == "function")
|
|
46
|
-
return this.action(
|
|
46
|
+
return this.action(t);
|
|
47
47
|
console.warn("No action defined");
|
|
48
48
|
}
|
|
49
|
-
defineAsLink(
|
|
50
|
-
return this.type = "link", this.link =
|
|
49
|
+
defineAsLink(t) {
|
|
50
|
+
return this.type = "link", this.link = t, this;
|
|
51
51
|
}
|
|
52
52
|
defineAsText() {
|
|
53
53
|
return this.type = "text", this;
|
|
@@ -73,11 +73,11 @@ class U {
|
|
|
73
73
|
defineAsFile() {
|
|
74
74
|
return this.type = "file", this;
|
|
75
75
|
}
|
|
76
|
-
defineAsAction(
|
|
77
|
-
return this.type = "action", this.action =
|
|
76
|
+
defineAsAction(t) {
|
|
77
|
+
return this.type = "action", this.action = t, this;
|
|
78
78
|
}
|
|
79
|
-
defineAsSelect(
|
|
80
|
-
return this.type = "select", this.options =
|
|
79
|
+
defineAsSelect(t) {
|
|
80
|
+
return this.type = "select", this.options = t, this;
|
|
81
81
|
}
|
|
82
82
|
showLoading() {
|
|
83
83
|
return this.resource !== "" && !this.resourceLoaded;
|
|
@@ -85,38 +85,38 @@ class U {
|
|
|
85
85
|
hasToLoadResource() {
|
|
86
86
|
return this.resource !== "" && !this.resourceLoaded && !this.isLoading;
|
|
87
87
|
}
|
|
88
|
-
setIsMultiple(
|
|
89
|
-
return this.isMultiple =
|
|
88
|
+
setIsMultiple(t = !0) {
|
|
89
|
+
return this.isMultiple = t, this;
|
|
90
90
|
}
|
|
91
|
-
setResource(
|
|
92
|
-
return this.resource =
|
|
91
|
+
setResource(t) {
|
|
92
|
+
return this.resource = t, this;
|
|
93
93
|
}
|
|
94
|
-
setResourceSlot(
|
|
95
|
-
return this.resourceSlot =
|
|
94
|
+
setResourceSlot(t) {
|
|
95
|
+
return this.resourceSlot = t, this;
|
|
96
96
|
}
|
|
97
|
-
setResourceData(
|
|
98
|
-
return this.resourceData =
|
|
97
|
+
setResourceData(t) {
|
|
98
|
+
return this.resourceData = t, this;
|
|
99
99
|
}
|
|
100
100
|
async loadResource() {
|
|
101
101
|
if (this.resourceLoaded) return this;
|
|
102
102
|
if (!this.resource) return this;
|
|
103
103
|
try {
|
|
104
104
|
this.isLoading = !0;
|
|
105
|
-
const
|
|
106
|
-
this.options =
|
|
105
|
+
const t = await nt(this.resource, this.resourceData);
|
|
106
|
+
this.options = t.data, this.isLoading = !1, this.resourceLoaded = !0;
|
|
107
107
|
} catch {
|
|
108
108
|
this.isLoading = !1;
|
|
109
109
|
}
|
|
110
110
|
return this;
|
|
111
111
|
}
|
|
112
|
-
setEditSlot(
|
|
113
|
-
return this.editSlot =
|
|
112
|
+
setEditSlot(t) {
|
|
113
|
+
return this.editSlot = t, this;
|
|
114
114
|
}
|
|
115
|
-
setValueSlot(
|
|
116
|
-
return this.valueSlot =
|
|
115
|
+
setValueSlot(t) {
|
|
116
|
+
return this.valueSlot = t, this;
|
|
117
117
|
}
|
|
118
|
-
setMultipleDisplay(
|
|
119
|
-
return this.setIsMultiple(!0), this.multipleDisplay =
|
|
118
|
+
setMultipleDisplay(t) {
|
|
119
|
+
return this.setIsMultiple(!0), this.multipleDisplay = t, this;
|
|
120
120
|
}
|
|
121
121
|
setMultipleDisplayToList() {
|
|
122
122
|
return this.setIsMultiple(!0), this.multipleDisplay = "list", this;
|
|
@@ -127,8 +127,8 @@ class U {
|
|
|
127
127
|
setMultipleDisplayToCount() {
|
|
128
128
|
return this.setIsMultiple(!0), this.multipleDisplay = "count", this;
|
|
129
129
|
}
|
|
130
|
-
setMultipleDisplayEdition(
|
|
131
|
-
return this.setIsMultiple(!0), this.multipleDisplayEdition =
|
|
130
|
+
setMultipleDisplayEdition(t) {
|
|
131
|
+
return this.setIsMultiple(!0), this.multipleDisplayEdition = t, this;
|
|
132
132
|
}
|
|
133
133
|
setMultipleDisplayEditionToList() {
|
|
134
134
|
return this.setIsMultiple(!0), this.multipleDisplayEdition = "list", this;
|
|
@@ -136,28 +136,28 @@ class U {
|
|
|
136
136
|
setMultipleDisplayEditionToInline() {
|
|
137
137
|
return this.setIsMultiple(!0), this.multipleDisplayEdition = "inline", this;
|
|
138
138
|
}
|
|
139
|
-
setSlotData(
|
|
140
|
-
return this.slotData =
|
|
139
|
+
setSlotData(t) {
|
|
140
|
+
return this.slotData = t, this;
|
|
141
141
|
}
|
|
142
|
-
setAutoLoadSelectOptions(
|
|
143
|
-
return this.autoLoadSelectOptions =
|
|
142
|
+
setAutoLoadSelectOptions(t = !0, r = "") {
|
|
143
|
+
return this.autoLoadSelectOptions = t, this.autoLoadSelectOptionsKey = r, this;
|
|
144
144
|
}
|
|
145
|
-
setTagMode(
|
|
146
|
-
return this.tags =
|
|
145
|
+
setTagMode(t = !0) {
|
|
146
|
+
return this.tags = t, this;
|
|
147
147
|
}
|
|
148
|
-
setOptions(
|
|
149
|
-
return this.options =
|
|
148
|
+
setOptions(t = []) {
|
|
149
|
+
return this.options = t, this;
|
|
150
150
|
}
|
|
151
|
-
setTitleSourceColumn(
|
|
152
|
-
return this.extractTitleFromColumn =
|
|
151
|
+
setTitleSourceColumn(t) {
|
|
152
|
+
return this.extractTitleFromColumn = t, this;
|
|
153
153
|
}
|
|
154
|
-
useForRowKey(
|
|
155
|
-
return this.isForRowKey =
|
|
154
|
+
useForRowKey(t = !0) {
|
|
155
|
+
return this.isForRowKey = t, this;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
const gl = (l,
|
|
158
|
+
const gl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r)), Cl = (l, t, r, n = !0) => _(new U(l, t).setIsSortable(n).defineAsLink(r)), Sl = (l, t, r, n = !0) => _(new U(l, t).setIsSortable(n).defineAsAction(r)), Vl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsText()), Dl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsEmail()), wl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsTel()), Tl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsCheck()), Bl = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).defineAsSwitch()), El = (l, t, r, n = !0) => _(new U(l, t).setIsSortable(n).defineAsSelect(r)), Ll = (l, t, r = !0) => _(new U(l, t).setIsSortable(r).setIsHidden(!0)), Ee = (l, t, r, n) => {
|
|
159
159
|
if (!r) return 0;
|
|
160
|
-
let i = l[r.key], o =
|
|
160
|
+
let i = l[r.key], o = t[r.key];
|
|
161
161
|
if (n === "asc") {
|
|
162
162
|
if (i > o) return 1;
|
|
163
163
|
if (o > i) return -1;
|
|
@@ -166,38 +166,38 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
166
166
|
if (o > i) return 1;
|
|
167
167
|
}
|
|
168
168
|
return 0;
|
|
169
|
-
}, Z = (l,
|
|
169
|
+
}, Z = (l, t, r, n = []) => {
|
|
170
170
|
if (l.extractTitleFromColumn) {
|
|
171
171
|
let i = n.find((o) => o.key === l.extractTitleFromColumn);
|
|
172
172
|
if (i)
|
|
173
|
-
return Z(i,
|
|
173
|
+
return Z(i, t, r, n);
|
|
174
174
|
}
|
|
175
175
|
if (l.formatter && typeof l.formatter == "function") {
|
|
176
|
-
let i = l.formatter(
|
|
176
|
+
let i = l.formatter(t[l.key], t, l, r);
|
|
177
177
|
return i.startsWith("__:") ? q(i.substring(3)) : i;
|
|
178
178
|
}
|
|
179
|
-
return
|
|
180
|
-
}, kt = (l,
|
|
179
|
+
return t[l.key];
|
|
180
|
+
}, kt = (l, t, r) => {
|
|
181
181
|
if (!l.colspan) return -1;
|
|
182
|
-
let n =
|
|
182
|
+
let n = t;
|
|
183
183
|
return r.forEach((i) => {
|
|
184
184
|
let o = me(l, i);
|
|
185
185
|
o > 0 && o < n && (n = o);
|
|
186
186
|
}), n;
|
|
187
|
-
}, me = (l,
|
|
188
|
-
if (typeof l != "object" || !l.key ||
|
|
187
|
+
}, me = (l, t) => l.colspan === !1 ? !1 : typeof l.colspan == "function" ? l.colspan(t) : l.colspan, bt = (l, t, r) => {
|
|
188
|
+
if (typeof l != "object" || !l.key || t.indexOf(l.key) > -1) return !1;
|
|
189
189
|
let n = me(l, r);
|
|
190
190
|
return typeof l.colspan > "u" ? !0 : (typeof l.colspan < "u" && (typeof l.colspan == "function" ? n = parseInt(l.colspan()) : n = parseInt(l.colspan)), n > 0);
|
|
191
191
|
}, gt = (l = []) => {
|
|
192
192
|
if (l.length > 0) {
|
|
193
|
-
for (let
|
|
194
|
-
if (l[
|
|
193
|
+
for (let t = 0; t < l.length; ++t)
|
|
194
|
+
if (l[t].sortable) return l[t].key;
|
|
195
195
|
}
|
|
196
196
|
return "";
|
|
197
|
-
}, Ct = (l,
|
|
197
|
+
}, Ct = (l, t) => {
|
|
198
198
|
if (l.length > 0) {
|
|
199
199
|
for (let r = 0; r < l.length; ++r)
|
|
200
|
-
if (l[r].key ===
|
|
200
|
+
if (l[r].key === t) return l[r];
|
|
201
201
|
}
|
|
202
202
|
return null;
|
|
203
203
|
}, Ie = /* @__PURE__ */ Q({
|
|
@@ -210,8 +210,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
210
210
|
editModeEnabled: { type: Boolean, default: !1 }
|
|
211
211
|
},
|
|
212
212
|
emits: ["update:modelValue"],
|
|
213
|
-
setup(l, { emit:
|
|
214
|
-
const r =
|
|
213
|
+
setup(l, { emit: t }) {
|
|
214
|
+
const r = t, n = l, i = S(n.modelValue), o = S(i.value[n.column.key]), h = S(null), C = S(n.column.showLoading());
|
|
215
215
|
N(o, (a) => {
|
|
216
216
|
const u = JSON.parse(JSON.stringify(i.value));
|
|
217
217
|
u[n.column.key] = a, r("update:modelValue", u);
|
|
@@ -319,8 +319,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
319
319
|
resourceData: { default: () => ({}) }
|
|
320
320
|
},
|
|
321
321
|
emits: ["click"],
|
|
322
|
-
setup(l, { emit:
|
|
323
|
-
const r =
|
|
322
|
+
setup(l, { emit: t }) {
|
|
323
|
+
const r = t, n = l, i = c(() => A.dropButtonSlot !== ""), o = c(() => A.dropButtonSlot), h = c(() => n.text.startsWith("__:") ? q(n.text.substring(3)) : n.text);
|
|
324
324
|
return (C, v) => {
|
|
325
325
|
const a = M("lkt-button");
|
|
326
326
|
return s(), b(a, {
|
|
@@ -370,8 +370,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
370
370
|
dropResource: { default: "" }
|
|
371
371
|
},
|
|
372
372
|
emits: ["update:modelValue", "click", "show", "item-up", "item-down", "item-drop"],
|
|
373
|
-
setup(l, { emit:
|
|
374
|
-
const r =
|
|
373
|
+
setup(l, { emit: t }) {
|
|
374
|
+
const r = t, n = l, i = S(n.modelValue), o = (d, $, H) => {
|
|
375
375
|
r("click", d, de("", { item: $, column: H }));
|
|
376
376
|
}, h = (d, $) => {
|
|
377
377
|
r("show", d, de("", { i: $ }));
|
|
@@ -493,8 +493,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
493
493
|
emptyColumns: { default: () => [] }
|
|
494
494
|
},
|
|
495
495
|
emits: ["update:modelValue", "click"],
|
|
496
|
-
setup(l, { emit:
|
|
497
|
-
const r =
|
|
496
|
+
setup(l, { emit: t }) {
|
|
497
|
+
const r = t, n = l, i = S(n.modelValue), o = (h, C, v) => {
|
|
498
498
|
r("click", h, de("", { item: C, column: v }));
|
|
499
499
|
};
|
|
500
500
|
return N(() => n.modelValue, (h) => i.value = h), N(i, () => r("update:modelValue", i.value)), (h, C) => te((s(), f("tr", At, [
|
|
@@ -542,8 +542,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
542
542
|
text: { type: Boolean, default: "" }
|
|
543
543
|
},
|
|
544
544
|
emits: ["click"],
|
|
545
|
-
setup(l, { emit:
|
|
546
|
-
const r =
|
|
545
|
+
setup(l, { emit: t }) {
|
|
546
|
+
const r = t, n = l, i = c(() => A.createButtonSlot !== ""), o = c(() => A.createButtonSlot), h = c(() => n.text.startsWith("__:") ? q(n.text.substring(3)) : n.text);
|
|
547
547
|
return (C, v) => {
|
|
548
548
|
const a = M("lkt-button");
|
|
549
549
|
return s(), b(a, {
|
|
@@ -571,8 +571,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
571
571
|
items: { default: () => [] }
|
|
572
572
|
},
|
|
573
573
|
emits: ["click"],
|
|
574
|
-
setup(l, { emit:
|
|
575
|
-
const r =
|
|
574
|
+
setup(l, { emit: t }) {
|
|
575
|
+
const r = t, n = l, i = c(() => kt(n.column, n.amountOfColumns, n.items)), o = c(() => n.column.sortable === !0), h = c(() => o.value && n.sortBy === n.column.key ? n.sortDirection : ""), C = c(() => n.column.label.startsWith("__:") ? q(n.column.label.substring(3)) : n.column.label), v = () => {
|
|
576
576
|
r("click", n.column);
|
|
577
577
|
};
|
|
578
578
|
return (a, u) => (s(), f("th", {
|
|
@@ -649,93 +649,93 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
649
649
|
createEnabledValidator: { type: Function, default: void 0 }
|
|
650
650
|
},
|
|
651
651
|
emits: ["update:modelValue", "sort", "click", "save", "error", "before-save"],
|
|
652
|
-
setup(l, { expose:
|
|
652
|
+
setup(l, { expose: t, emit: r }) {
|
|
653
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
654
|
let $ = [];
|
|
655
|
-
const H = S(o.page), y = S(!
|
|
656
|
-
Array.isArray(
|
|
657
|
-
}, Ae = (
|
|
658
|
-
ee.value =
|
|
655
|
+
const H = S(o.page), y = S(!1), p = S(!1), ee = S($), ce = S(null), Me = S({}), X = S(new it({ items: u.value }, o.dataStateConfig)), L = S(o.editMode), $e = (e) => {
|
|
656
|
+
console.log("onResults", e), Array.isArray(e) && (u.value = e), y.value = !1, p.value = !0, X.value.store({ items: u.value }).turnStoredIntoOriginal();
|
|
657
|
+
}, Ae = (e) => {
|
|
658
|
+
ee.value = e;
|
|
659
659
|
}, Re = () => re(() => y.value = !0), Oe = () => {
|
|
660
660
|
ce.value.doRefresh();
|
|
661
661
|
}, oe = st(12), se = c(() => {
|
|
662
662
|
if (!o.hideEmptyColumns) return [];
|
|
663
|
-
let
|
|
663
|
+
let e = [];
|
|
664
664
|
return d.value.forEach((m) => {
|
|
665
665
|
let k = m.key, w = !1;
|
|
666
666
|
u.value.forEach((D) => {
|
|
667
667
|
if (typeof D.checkEmpty == "function")
|
|
668
668
|
return D.checkEmpty(D);
|
|
669
669
|
D[k] && (w = !0);
|
|
670
|
-
}), w ||
|
|
671
|
-
}),
|
|
672
|
-
}), ae = c(() => d.value.filter((
|
|
673
|
-
let
|
|
674
|
-
return o.sortable && ++
|
|
675
|
-
}), Fe = c(() => d.value.filter((
|
|
676
|
-
let
|
|
677
|
-
for (let m in i) _e.value.indexOf(m) !== -1 &&
|
|
678
|
-
return
|
|
670
|
+
}), w || e.push(k);
|
|
671
|
+
}), e;
|
|
672
|
+
}), ae = c(() => d.value.filter((e) => !e.hidden)), ue = c(() => d.value.filter((e) => e.hidden)), Ne = c(() => {
|
|
673
|
+
let e = ae.value.length + 1;
|
|
674
|
+
return o.sortable && ++e, e;
|
|
675
|
+
}), Fe = c(() => d.value.filter((e) => e.isForRowKey)), fe = c(() => ue.value.length > 0 && !o.sortable), _e = c(() => d.value.map((e) => e.key)), pe = c(() => {
|
|
676
|
+
let e = [];
|
|
677
|
+
for (let m in i) _e.value.indexOf(m) !== -1 && e.push(m);
|
|
678
|
+
return e;
|
|
679
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
680
|
items: u.value,
|
|
681
681
|
...o.saveResourceData
|
|
682
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
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 = (
|
|
685
|
-
let m =
|
|
684
|
+
const he = c(() => ee.value.includes("drop")), qe = (e) => {
|
|
685
|
+
let m = e.target;
|
|
686
686
|
if (typeof m.dataset.column > "u")
|
|
687
687
|
do
|
|
688
688
|
m = m.parentNode;
|
|
689
689
|
while (typeof m.dataset.column > "u" && m.tagName !== "TABLE" && m.tagName !== "body");
|
|
690
690
|
if (m.tagName === "TD" && (m = m.parentNode, m = m.dataset.i, typeof m < "u"))
|
|
691
691
|
return u.value[m];
|
|
692
|
-
}, ye = (
|
|
693
|
-
|
|
694
|
-
}, be = (
|
|
695
|
-
n("click",
|
|
696
|
-
}, ge = (
|
|
692
|
+
}, ye = (e) => P.value["tr_" + e] === !0, ke = (e) => {
|
|
693
|
+
e && e.sortable && (u.value = u.value.sort((m, k) => C.value(m, k, e, a.value)), a.value = a.value === "asc" ? "desc" : "asc", v.value = e.key, n("sort", [v.value, a.value]));
|
|
694
|
+
}, be = (e, m) => {
|
|
695
|
+
n("click", e, m);
|
|
696
|
+
}, ge = (e, m) => {
|
|
697
697
|
let k = "tr_" + m.value.i;
|
|
698
698
|
P.value[k] = typeof P.value[k] > "u" ? !0 : !P.value[k];
|
|
699
699
|
}, Ce = () => {
|
|
700
|
-
d.value.forEach((
|
|
701
|
-
if (
|
|
702
|
-
let m =
|
|
700
|
+
d.value.forEach((e) => {
|
|
701
|
+
if (e.type === "select" && e.autoLoadSelectOptions) {
|
|
702
|
+
let m = e.autoLoadSelectOptionsKey !== "" ? e.autoLoadSelectOptionsKey : e.key, k = [];
|
|
703
703
|
u.value.forEach((D) => {
|
|
704
704
|
Array.isArray(D[m]) && D[m].forEach((R) => k.push(R));
|
|
705
705
|
});
|
|
706
706
|
let w = {};
|
|
707
707
|
k = k.filter(function(D) {
|
|
708
708
|
return w[D.value] ? !1 : (w[D.value] = !0, !0);
|
|
709
|
-
}),
|
|
709
|
+
}), e.setOptions(k);
|
|
710
710
|
}
|
|
711
711
|
});
|
|
712
|
-
}, Ge = (
|
|
712
|
+
}, Ge = (e) => typeof o.checkValidDrag == "function" ? o.checkValidDrag(e) : !0, Se = (e) => typeof o.draggableChecker == "function" ? o.draggableChecker(e) : !0, Ve = () => {
|
|
713
713
|
u.value.push({});
|
|
714
714
|
}, Qe = () => {
|
|
715
715
|
y.value = !0;
|
|
716
716
|
}, Xe = () => {
|
|
717
717
|
y.value = !1;
|
|
718
|
-
}, Ye = (
|
|
718
|
+
}, Ye = (e, m) => {
|
|
719
719
|
if (n("before-save"), o.saveResource && (y.value = !1, !m.success)) {
|
|
720
720
|
n("error", m.httpStatus);
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
723
723
|
X.value.turnStoredIntoOriginal(), n("save", m);
|
|
724
|
-
}, De = (
|
|
725
|
-
if (k >=
|
|
726
|
-
let w = k -
|
|
727
|
-
for (; w--; )
|
|
724
|
+
}, De = (e, m, k) => {
|
|
725
|
+
if (k >= e.length) {
|
|
726
|
+
let w = k - e.length + 1;
|
|
727
|
+
for (; w--; ) e.push(void 0);
|
|
728
728
|
}
|
|
729
|
-
return
|
|
730
|
-
}, Ze = (
|
|
731
|
-
De(u.value,
|
|
732
|
-
}, xe = (
|
|
733
|
-
De(u.value,
|
|
734
|
-
}, et = (
|
|
735
|
-
u.value.splice(
|
|
729
|
+
return e.splice(k, 0, e.splice(m, 1)[0]), e;
|
|
730
|
+
}, Ze = (e) => {
|
|
731
|
+
De(u.value, e, e - 1);
|
|
732
|
+
}, xe = (e) => {
|
|
733
|
+
De(u.value, e, e + 1);
|
|
734
|
+
}, et = (e) => {
|
|
735
|
+
u.value.splice(e, 1);
|
|
736
736
|
}, tt = () => {
|
|
737
|
-
let
|
|
738
|
-
Me.value = new rt(
|
|
737
|
+
let e = document.getElementById("lkt-table-body-" + oe);
|
|
738
|
+
Me.value = new rt(e, {
|
|
739
739
|
direction: "vertical",
|
|
740
740
|
handle: ".handle",
|
|
741
741
|
animation: 150,
|
|
@@ -747,10 +747,10 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
747
747
|
return Ge(m);
|
|
748
748
|
}
|
|
749
749
|
});
|
|
750
|
-
}, we = (
|
|
750
|
+
}, we = (e, m, k = !1) => {
|
|
751
751
|
let w = [oe, "row", m];
|
|
752
752
|
return k && w.push("hidden"), Fe.value.forEach((D) => {
|
|
753
|
-
let R = String(
|
|
753
|
+
let R = String(e[D.key]).toLowerCase();
|
|
754
754
|
R.length > 50 && (R = R.substring(0, 50)), R = ut(R, " ", "-"), w.push(R);
|
|
755
755
|
}), w.join("-");
|
|
756
756
|
}, Te = c(() => typeof o.createEnabledValidator == "function" ? o.createEnabledValidator({ items: u.value }) : !0);
|
|
@@ -758,12 +758,12 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
758
758
|
Ce(), ke(Ct(o.columns, v.value)), X.value.store({ items: u.value }).turnStoredIntoOriginal(), o.sortable && re(() => {
|
|
759
759
|
tt();
|
|
760
760
|
});
|
|
761
|
-
}), N(() => o.columns, (
|
|
762
|
-
Ce(), X.value.increment({ items:
|
|
763
|
-
}, { deep: !0 }),
|
|
761
|
+
}), N(() => o.columns, (e) => d.value = e), N(() => o.modelValue, (e) => u.value = e), N(u, (e) => {
|
|
762
|
+
Ce(), X.value.increment({ items: e }), n("update:modelValue", e);
|
|
763
|
+
}, { deep: !0 }), t({
|
|
764
764
|
getItemByEvent: qe,
|
|
765
765
|
doRefresh: Oe
|
|
766
|
-
}), (
|
|
766
|
+
}), (e, m) => {
|
|
767
767
|
const k = M("lkt-button"), w = M("lkt-field-switch"), D = M("lkt-loader"), R = M("lkt-paginator");
|
|
768
768
|
return s(), f("section", {
|
|
769
769
|
class: "lkt-table-page",
|
|
@@ -772,18 +772,18 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
772
772
|
ie.value || B(i).title ? (s(), f("header", Pt, [
|
|
773
773
|
ie.value ? (s(), b(x(Pe.value), { key: 0 }, {
|
|
774
774
|
default: O(() => [
|
|
775
|
-
|
|
775
|
+
e.titleIcon ? (s(), f("i", {
|
|
776
776
|
key: 0,
|
|
777
|
-
class: ne(
|
|
777
|
+
class: ne(e.titleIcon)
|
|
778
778
|
}, null, 2)) : g("", !0),
|
|
779
779
|
G(" " + F(ie.value), 1)
|
|
780
780
|
]),
|
|
781
781
|
_: 1
|
|
782
782
|
})) : g("", !0),
|
|
783
|
-
B(i).title ? W(
|
|
783
|
+
B(i).title ? W(e.$slots, "title", { key: 1 }) : g("", !0)
|
|
784
784
|
])) : g("", !0),
|
|
785
785
|
(s(), b(x(je.value), {
|
|
786
|
-
class: ne(["lkt-table-page-content-wrapper",
|
|
786
|
+
class: ne(["lkt-table-page-content-wrapper", e.wrapContentClass])
|
|
787
787
|
}, {
|
|
788
788
|
default: O(() => [
|
|
789
789
|
te(V("div", jt, [
|
|
@@ -791,30 +791,30 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
791
791
|
ref: "saveButton",
|
|
792
792
|
palette: "success",
|
|
793
793
|
disabled: !He.value,
|
|
794
|
-
"confirm-modal":
|
|
795
|
-
"confirm-data":
|
|
796
|
-
resource:
|
|
794
|
+
"confirm-modal": e.saveConfirm,
|
|
795
|
+
"confirm-data": e.confirmData,
|
|
796
|
+
resource: e.saveResource,
|
|
797
797
|
"resource-data": We.value,
|
|
798
798
|
onLoading: Qe,
|
|
799
799
|
onLoaded: Xe,
|
|
800
800
|
onClick: Ye
|
|
801
801
|
}, {
|
|
802
802
|
default: O(() => [
|
|
803
|
-
B(i)["button-save"] ? W(
|
|
803
|
+
B(i)["button-save"] ? W(e.$slots, "button-save", {
|
|
804
804
|
key: 0,
|
|
805
805
|
items: u.value,
|
|
806
|
-
editMode:
|
|
807
|
-
canUpdate: !
|
|
806
|
+
editMode: e.editMode,
|
|
807
|
+
canUpdate: !e.saveDisabled
|
|
808
808
|
}) : (s(), f("span", Jt, F(Je.value), 1))
|
|
809
809
|
]),
|
|
810
810
|
_: 3
|
|
811
811
|
}, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
|
|
812
812
|
[le, ve.value]
|
|
813
813
|
]),
|
|
814
|
-
|
|
814
|
+
e.canCreate && L.value ? (s(), b(Le, {
|
|
815
815
|
key: 0,
|
|
816
816
|
disabled: !Te.value,
|
|
817
|
-
text:
|
|
817
|
+
text: e.createText,
|
|
818
818
|
onClick: Ve
|
|
819
819
|
}, null, 8, ["disabled", "text"])) : g("", !0),
|
|
820
820
|
V("div", zt, [
|
|
@@ -823,17 +823,17 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
823
823
|
"onUpdate:modelValue": m[0] || (m[0] = (T) => L.value = T),
|
|
824
824
|
label: ze.value
|
|
825
825
|
}, null, 8, ["modelValue", "label"]), [
|
|
826
|
-
[le,
|
|
826
|
+
[le, e.switchEditionEnabled]
|
|
827
827
|
])
|
|
828
828
|
])
|
|
829
829
|
], 512), [
|
|
830
830
|
[le, Ue.value]
|
|
831
831
|
]),
|
|
832
832
|
B(i).buttons ? (s(), f("div", qt, [
|
|
833
|
-
W(
|
|
833
|
+
W(e.$slots, "buttons")
|
|
834
834
|
])) : g("", !0),
|
|
835
835
|
p.value && B(i).filters ? (s(), f("div", Gt, [
|
|
836
|
-
W(
|
|
836
|
+
W(e.$slots, "filters", {
|
|
837
837
|
items: u.value,
|
|
838
838
|
isLoading: y.value
|
|
839
839
|
})
|
|
@@ -841,13 +841,13 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
841
841
|
y.value ? (s(), b(D, { key: 2 })) : g("", !0),
|
|
842
842
|
te(V("div", {
|
|
843
843
|
class: "lkt-table",
|
|
844
|
-
"data-sortable":
|
|
844
|
+
"data-sortable": e.sortable
|
|
845
845
|
}, [
|
|
846
846
|
V("table", null, [
|
|
847
847
|
V("thead", null, [
|
|
848
848
|
V("tr", null, [
|
|
849
|
-
|
|
850
|
-
|
|
849
|
+
e.sortable && L.value ? (s(), f("th", Xt)) : g("", !0),
|
|
850
|
+
e.addNavigation && L.value ? (s(), f("th", Yt)) : g("", !0),
|
|
851
851
|
fe.value ? (s(), f("th", Zt)) : g("", !0),
|
|
852
852
|
(s(!0), f(E, null, j(ae.value, (T) => (s(), f(E, null, [
|
|
853
853
|
se.value.indexOf(T.key) === -1 ? (s(), b(Kt, {
|
|
@@ -855,12 +855,12 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
855
855
|
column: T,
|
|
856
856
|
"sort-by": v.value,
|
|
857
857
|
"sort-direction": a.value,
|
|
858
|
-
"amount-of-columns":
|
|
858
|
+
"amount-of-columns": e.columns.length,
|
|
859
859
|
items: u.value,
|
|
860
860
|
onClick: (I) => ke(T)
|
|
861
861
|
}, null, 8, ["column", "sort-by", "sort-direction", "amount-of-columns", "items", "onClick"])) : g("", !0)
|
|
862
862
|
], 64))), 256)),
|
|
863
|
-
|
|
863
|
+
e.canDrop && he.value && L.value ? (s(), f("th", xt)) : g("", !0)
|
|
864
864
|
])
|
|
865
865
|
]),
|
|
866
866
|
V("tbody", {
|
|
@@ -874,16 +874,16 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
874
874
|
i: I,
|
|
875
875
|
"display-hidden-columns-indicator": fe.value,
|
|
876
876
|
"is-draggable": Se(T),
|
|
877
|
-
sortable:
|
|
877
|
+
sortable: e.sortable,
|
|
878
878
|
"visible-columns": ae.value,
|
|
879
879
|
"empty-columns": se.value,
|
|
880
|
-
"add-navigation":
|
|
880
|
+
"add-navigation": e.addNavigation,
|
|
881
881
|
"hidden-is-visible": ye(I),
|
|
882
882
|
"latest-row": I + 1 === Ke.value,
|
|
883
|
-
"can-drop":
|
|
884
|
-
"drop-confirm":
|
|
885
|
-
"drop-resource":
|
|
886
|
-
"drop-text":
|
|
883
|
+
"can-drop": e.canDrop && he.value && L.value,
|
|
884
|
+
"drop-confirm": e.dropConfirm,
|
|
885
|
+
"drop-resource": e.dropResource,
|
|
886
|
+
"drop-text": e.dropText,
|
|
887
887
|
"edit-mode-enabled": L.value,
|
|
888
888
|
onClick: be,
|
|
889
889
|
onShow: ge,
|
|
@@ -894,7 +894,7 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
894
894
|
j(pe.value, (K) => ({
|
|
895
895
|
name: K,
|
|
896
896
|
fn: O((z) => [
|
|
897
|
-
W(
|
|
897
|
+
W(e.$slots, K, {
|
|
898
898
|
item: z.item,
|
|
899
899
|
value: z.value,
|
|
900
900
|
column: z.column
|
|
@@ -910,7 +910,7 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
910
910
|
"hidden-columns": ue.value,
|
|
911
911
|
"hidden-columns-col-span": Ne.value,
|
|
912
912
|
"is-draggable": Se(T),
|
|
913
|
-
sortable:
|
|
913
|
+
sortable: e.sortable,
|
|
914
914
|
"visible-columns": ae.value,
|
|
915
915
|
"empty-columns": se.value,
|
|
916
916
|
"hidden-is-visible": ye(I),
|
|
@@ -920,7 +920,7 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
920
920
|
j(pe.value, (K) => ({
|
|
921
921
|
name: K,
|
|
922
922
|
fn: O((z) => [
|
|
923
|
-
W(
|
|
923
|
+
W(e.$slots, K, {
|
|
924
924
|
item: z.item,
|
|
925
925
|
value: z.value,
|
|
926
926
|
column: z.column
|
|
@@ -933,15 +933,15 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
933
933
|
], 8, Qt), [
|
|
934
934
|
[le, !y.value && u.value.length > 0]
|
|
935
935
|
]),
|
|
936
|
-
|
|
937
|
-
W(
|
|
936
|
+
e.$slots["no-items"] ? (s(), f("div", tl, [
|
|
937
|
+
W(e.$slots, "no-items")
|
|
938
938
|
])) : g("", !0),
|
|
939
|
-
!y.value && u.value.length === 0 ? (s(), f("div", ll, F(
|
|
940
|
-
|
|
941
|
-
|
|
939
|
+
!y.value && u.value.length === 0 ? (s(), f("div", ll, F(e.noResultsText), 1)) : g("", !0),
|
|
940
|
+
e.canCreate && L.value ? (s(), f("div", ol, [
|
|
941
|
+
e.canCreate && L.value ? (s(), b(Le, {
|
|
942
942
|
key: 0,
|
|
943
943
|
disabled: !Te.value,
|
|
944
|
-
text:
|
|
944
|
+
text: e.createText,
|
|
945
945
|
onClick: Ve
|
|
946
946
|
}, null, 8, ["disabled", "text"])) : g("", !0)
|
|
947
947
|
])) : g("", !0),
|
|
@@ -950,8 +950,8 @@ const gl = (l, e, r = !0) => _(new U(l, e).setIsSortable(r)), Cl = (l, e, r, n =
|
|
|
950
950
|
ref: ce,
|
|
951
951
|
modelValue: H.value,
|
|
952
952
|
"onUpdate:modelValue": m[1] || (m[1] = (T) => H.value = T),
|
|
953
|
-
resource:
|
|
954
|
-
filters:
|
|
953
|
+
resource: e.resource,
|
|
954
|
+
filters: e.filters,
|
|
955
955
|
onResults: $e,
|
|
956
956
|
onLoading: Re,
|
|
957
957
|
onPerms: Ae
|