lkt-item-crud 2.0.4 → 2.0.6
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 +5 -5
- package/dist/build.js +287 -273
- package/dist/components/ButtonNav.vue.d.ts +317 -205
- package/dist/lib-components/LktItemCrud.vue.d.ts +10 -8
- package/package.json +11 -13
- package/src/components/ButtonNav.vue +17 -9
- package/src/lib-components/LktItemCrud.vue +38 -5
package/dist/build.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { defineComponent as me, ref as
|
|
2
|
-
import { httpCall as
|
|
1
|
+
import { defineComponent as me, ref as l, watch as h, useSlots as be, computed as y, resolveComponent as ie, createElementBlock as w, createCommentVNode as v, openBlock as s, withDirectives as Z, createBlock as T, unref as c, renderSlot as k, vShow as x, mergeProps as ee, withCtx as $, mergeDefaults as Ce, nextTick as ke, onMounted as De, resolveDynamicComponent as Se, normalizeProps as Ie, guardReactiveProps as Ue, createElementVNode as we, toDisplayString as Te, createSlots as se } from "vue";
|
|
2
|
+
import { httpCall as Me } from "lkt-http-client";
|
|
3
3
|
import { DataState as ve } from "lkt-data-state";
|
|
4
|
-
import { ensureButtonConfig as
|
|
5
|
-
import { closeModal as
|
|
6
|
-
import { __ as
|
|
7
|
-
import { openToast as
|
|
8
|
-
const
|
|
4
|
+
import { ensureButtonConfig as E, LktSettings as n, ItemCrudMode as U, ItemCrudButtonNavVisibility as ne, TablePermission as de, ItemCrudView as pe, ItemCrudButtonNavPosition as ce, NotificationType as N, getDefaultValues as Re, ItemCrud as Ee, ToastPositionX as X } from "lkt-vue-kernel";
|
|
5
|
+
import { closeModal as Ne } from "lkt-modal";
|
|
6
|
+
import { __ as $e } from "lkt-i18n";
|
|
7
|
+
import { openToast as _ } from "lkt-toast";
|
|
8
|
+
const W = class W {
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
let
|
|
10
|
+
W.debugEnabled = !1, W.defaultSaveIcon = "", W.defaultDropIcon = "";
|
|
11
|
+
let q = W;
|
|
12
12
|
const g = (...B) => {
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
},
|
|
13
|
+
q.debugEnabled && console.info("[LktItemCrud] ", ...B);
|
|
14
|
+
}, xe = (B = !0) => {
|
|
15
|
+
q.debugEnabled = B;
|
|
16
|
+
}, Ve = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "lkt-item-crud-buttons"
|
|
19
|
-
},
|
|
19
|
+
}, Le = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "lkt-item-crud-buttons"
|
|
22
|
-
},
|
|
22
|
+
}, Oe = {
|
|
23
23
|
key: 1,
|
|
24
24
|
class: "lkt-item-crud-buttons"
|
|
25
|
-
},
|
|
25
|
+
}, Ae = {
|
|
26
26
|
key: 5,
|
|
27
27
|
class: "lkt-item-crud-buttons"
|
|
28
28
|
}, fe = /* @__PURE__ */ me({
|
|
@@ -33,10 +33,10 @@ const g = (...B) => {
|
|
|
33
33
|
loading: { type: Boolean },
|
|
34
34
|
view: {},
|
|
35
35
|
mode: {},
|
|
36
|
-
createButton: {},
|
|
37
|
-
updateButton: {},
|
|
38
|
-
dropButton: {},
|
|
39
|
-
editModeButton: {},
|
|
36
|
+
createButton: { type: [Object, Boolean] },
|
|
37
|
+
updateButton: { type: [Object, Boolean] },
|
|
38
|
+
dropButton: { type: [Object, Boolean] },
|
|
39
|
+
editModeButton: { type: [Object, Boolean] },
|
|
40
40
|
dataChanged: { type: Boolean },
|
|
41
41
|
canUpdate: { type: Boolean },
|
|
42
42
|
canDrop: { type: Boolean },
|
|
@@ -51,172 +51,173 @@ const g = (...B) => {
|
|
|
51
51
|
"save",
|
|
52
52
|
"drop"
|
|
53
53
|
],
|
|
54
|
-
setup(B, { expose:
|
|
55
|
-
const o =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}, { deep: !0 }),
|
|
59
|
-
|
|
60
|
-
}, { deep: !0 }),
|
|
61
|
-
|
|
62
|
-
}, { deep: !0 }),
|
|
63
|
-
|
|
54
|
+
setup(B, { expose: G, emit: te }) {
|
|
55
|
+
const o = te, a = B, f = l(E(a.createButton, n.defaultCreateButton)), i = l(E(a.updateButton, n.defaultUpdateButton)), d = l(E(a.dropButton, n.defaultDropButton)), D = l(E(a.editModeButton, n.defaultEditModeButton));
|
|
56
|
+
h(() => a.createButton, (t) => {
|
|
57
|
+
f.value = E(t, n.defaultCreateButton);
|
|
58
|
+
}, { deep: !0 }), h(() => a.updateButton, (t) => {
|
|
59
|
+
i.value = E(t, n.defaultUpdateButton);
|
|
60
|
+
}, { deep: !0 }), h(() => a.dropButton, (t) => {
|
|
61
|
+
d.value = E(t, n.defaultDropButton);
|
|
62
|
+
}, { deep: !0 }), h(() => a.editModeButton, (t) => {
|
|
63
|
+
D.value = E(t, n.defaultEditModeButton);
|
|
64
64
|
}, { deep: !0 });
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
o("create", t,
|
|
75
|
-
},
|
|
76
|
-
o("save", t,
|
|
77
|
-
},
|
|
78
|
-
o("drop", t,
|
|
65
|
+
const b = be(), C = l(null), I = l(null), p = l(a.loading);
|
|
66
|
+
h(() => a.loading, (t) => p.value = t), h(p, (t) => o("update:loading", t));
|
|
67
|
+
const r = l(a.editing);
|
|
68
|
+
h(() => a.editing, (t) => r.value = t), h(r, (t) => o("update:editing", t));
|
|
69
|
+
const S = () => {
|
|
70
|
+
p.value = !0;
|
|
71
|
+
}, V = () => {
|
|
72
|
+
p.value = !1;
|
|
73
|
+
}, M = (t, m) => {
|
|
74
|
+
typeof t > "u" || o("create", t, m);
|
|
75
|
+
}, z = (t, m) => {
|
|
76
|
+
typeof t > "u" || o("save", t, m);
|
|
77
|
+
}, J = (t, m) => {
|
|
78
|
+
typeof t > "u" || o("drop", t, m);
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
G({
|
|
81
81
|
doSave: () => {
|
|
82
82
|
C.value && typeof C.value.click == "function" && C.value.click();
|
|
83
83
|
},
|
|
84
84
|
doDrop: () => {
|
|
85
|
-
|
|
85
|
+
I.value && typeof I.value.click == "function" && I.value.click();
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
const
|
|
89
|
-
var t,
|
|
90
|
-
return a.mode !==
|
|
91
|
-
}),
|
|
92
|
-
var t,
|
|
93
|
-
return a.mode !==
|
|
94
|
-
}),
|
|
95
|
-
var t,
|
|
96
|
-
return a.canDrop ? typeof ((t =
|
|
97
|
-
}),
|
|
98
|
-
return (t,
|
|
99
|
-
const
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
const A = y(() => {
|
|
89
|
+
var t, m;
|
|
90
|
+
return a.mode !== U.Create && !a.canUpdate || !a.dataChanged ? !1 : typeof ((t = i.value) == null ? void 0 : t.disabled) == "function" ? !i.value.disabled(a.item) : typeof ((m = i.value) == null ? void 0 : m.disabled) == "boolean" ? !i.value.disabled : !0;
|
|
91
|
+
}), F = y(() => {
|
|
92
|
+
var t, m;
|
|
93
|
+
return a.mode !== U.Create || !a.dataChanged ? !1 : typeof ((t = f.value) == null ? void 0 : t.disabled) == "function" ? !f.value.disabled(a.item) : typeof ((m = f.value) == null ? void 0 : m.disabled) == "boolean" ? !f.value.disabled : !0;
|
|
94
|
+
}), O = y(() => {
|
|
95
|
+
var t, m;
|
|
96
|
+
return a.canDrop ? typeof ((t = d.value) == null ? void 0 : t.disabled) == "function" ? !d.value.disabled(a.item) : typeof ((m = d.value) == null ? void 0 : m.disabled) == "boolean" ? !d.value.disabled : !0 : !1;
|
|
97
|
+
}), j = y(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !p.value && a.editing && a.httpSuccessRead), P = y(() => a.mode === U.Create && a.createButton === !1 || a.mode === U.Update && a.updateButton === !1 ? !1 : a.dataChanged ? !0 : p.value ? !1 : a.mode === U.Create ? !0 : a.buttonNavVisibility === ne.Never ? !1 : a.editing && a.httpSuccessRead), H = y(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !p.value && a.mode !== U.Create && a.httpSuccessRead), Y = y(() => a.buttonNavVisibility === ne.Always && (A.value || F.value || O.value) || b["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === ne.Never ? !1 : P.value || j.value || H.value);
|
|
98
|
+
return (t, m) => {
|
|
99
|
+
const K = ie("lkt-button");
|
|
100
|
+
return Y.value ? (s(), w("div", Ve, [
|
|
101
|
+
c(b)["prev-buttons-ever"] ? Z((s(), w("div", Le, [
|
|
102
|
+
k(t.$slots, "prev-buttons-ever")
|
|
103
103
|
], 512)), [
|
|
104
|
-
[
|
|
105
|
-
]) :
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
[x, !p.value]
|
|
105
|
+
]) : v("", !0),
|
|
106
|
+
c(b)["prev-buttons"] ? Z((s(), w("div", Oe, [
|
|
107
|
+
k(t.$slots, "prev-buttons")
|
|
108
108
|
], 512)), [
|
|
109
|
-
[
|
|
110
|
-
]) :
|
|
111
|
-
t.mode ===
|
|
109
|
+
[x, r.value && !p.value]
|
|
110
|
+
]) : v("", !0),
|
|
111
|
+
t.mode === c(U).Update && P.value ? (s(), T(K, ee({
|
|
112
112
|
key: 2,
|
|
113
113
|
ref_key: "saveButtonRef",
|
|
114
114
|
ref: C
|
|
115
|
-
},
|
|
116
|
-
disabled: !
|
|
117
|
-
onLoading:
|
|
118
|
-
onLoaded:
|
|
119
|
-
onClick:
|
|
115
|
+
}, i.value, {
|
|
116
|
+
disabled: !A.value,
|
|
117
|
+
onLoading: S,
|
|
118
|
+
onLoaded: V,
|
|
119
|
+
onClick: z
|
|
120
120
|
}), {
|
|
121
121
|
default: $(() => [
|
|
122
|
-
|
|
122
|
+
c(b)["button-save"] ? k(t.$slots, "button-save", {
|
|
123
123
|
key: 0,
|
|
124
124
|
item: t.item,
|
|
125
|
-
editMode:
|
|
125
|
+
editMode: r.value,
|
|
126
126
|
isCreate: !1,
|
|
127
127
|
canUpdate: t.canUpdate,
|
|
128
128
|
canDrop: t.canDrop
|
|
129
|
-
}) :
|
|
129
|
+
}) : v("", !0)
|
|
130
130
|
]),
|
|
131
131
|
_: 3
|
|
132
|
-
}, 16, ["disabled"])) : t.mode ===
|
|
132
|
+
}, 16, ["disabled"])) : t.mode === c(U).Create && P.value ? (s(), T(K, ee({
|
|
133
133
|
key: 3,
|
|
134
134
|
ref_key: "saveButtonRef",
|
|
135
135
|
ref: C
|
|
136
|
-
},
|
|
137
|
-
disabled: !
|
|
138
|
-
onLoading:
|
|
139
|
-
onLoaded:
|
|
140
|
-
onClick:
|
|
136
|
+
}, f.value, {
|
|
137
|
+
disabled: !F.value,
|
|
138
|
+
onLoading: S,
|
|
139
|
+
onLoaded: V,
|
|
140
|
+
onClick: M
|
|
141
141
|
}), {
|
|
142
142
|
default: $(() => [
|
|
143
|
-
|
|
143
|
+
c(b)["button-save"] ? k(t.$slots, "button-save", {
|
|
144
144
|
key: 0,
|
|
145
145
|
item: t.item,
|
|
146
|
-
editMode:
|
|
146
|
+
editMode: r.value,
|
|
147
147
|
isCreate: !0,
|
|
148
148
|
canUpdate: t.canUpdate,
|
|
149
149
|
canDrop: t.canDrop
|
|
150
|
-
}) :
|
|
150
|
+
}) : v("", !0)
|
|
151
151
|
]),
|
|
152
152
|
_: 3
|
|
153
|
-
}, 16, ["disabled"])) :
|
|
154
|
-
t.mode !==
|
|
153
|
+
}, 16, ["disabled"])) : v("", !0),
|
|
154
|
+
t.mode !== c(U).Create ? Z((s(), T(K, ee({
|
|
155
155
|
key: 4,
|
|
156
156
|
ref_key: "dropButtonRef",
|
|
157
|
-
ref:
|
|
158
|
-
},
|
|
159
|
-
disabled: !
|
|
160
|
-
onLoading:
|
|
161
|
-
onLoaded:
|
|
162
|
-
onClick:
|
|
157
|
+
ref: I
|
|
158
|
+
}, d.value, {
|
|
159
|
+
disabled: !O.value,
|
|
160
|
+
onLoading: S,
|
|
161
|
+
onLoaded: V,
|
|
162
|
+
onClick: J
|
|
163
163
|
}), {
|
|
164
164
|
default: $(() => [
|
|
165
|
-
|
|
165
|
+
c(b)["button-drop"] ? k(t.$slots, "button-drop", {
|
|
166
166
|
key: 0,
|
|
167
167
|
item: t.item,
|
|
168
|
-
editMode:
|
|
168
|
+
editMode: r.value,
|
|
169
169
|
isCreate: !1,
|
|
170
170
|
canUpdate: t.canUpdate,
|
|
171
171
|
canDrop: t.canDrop
|
|
172
|
-
}) :
|
|
172
|
+
}) : v("", !0)
|
|
173
173
|
]),
|
|
174
174
|
_: 3
|
|
175
175
|
}, 16, ["disabled"])), [
|
|
176
|
-
[
|
|
177
|
-
]) :
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
[x, j.value]
|
|
177
|
+
]) : v("", !0),
|
|
178
|
+
c(b).buttons ? Z((s(), w("div", Ae, [
|
|
179
|
+
k(t.$slots, "buttons")
|
|
180
180
|
], 512)), [
|
|
181
|
-
[
|
|
182
|
-
]) :
|
|
183
|
-
|
|
184
|
-
checked:
|
|
185
|
-
"onUpdate:checked":
|
|
181
|
+
[x, r.value && !p.value]
|
|
182
|
+
]) : v("", !0),
|
|
183
|
+
H.value ? (s(), T(K, ee({ key: 6 }, D.value, {
|
|
184
|
+
checked: r.value,
|
|
185
|
+
"onUpdate:checked": m[0] || (m[0] = (ae) => r.value = ae),
|
|
186
186
|
class: "lkt-item-crud--switch-mode-button"
|
|
187
|
-
}), null, 16, ["checked"])) :
|
|
188
|
-
])) :
|
|
187
|
+
}), null, 16, ["checked"])) : v("", !0)
|
|
188
|
+
])) : v("", !0);
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
}),
|
|
191
|
+
}), je = { class: "lkt-item-crud" }, Pe = {
|
|
192
192
|
key: 0,
|
|
193
193
|
class: "lkt-item-crud_header"
|
|
194
|
-
},
|
|
194
|
+
}, Xe = {
|
|
195
195
|
key: 0,
|
|
196
196
|
class: "lkt-item-crud_header-slot"
|
|
197
|
-
},
|
|
197
|
+
}, _e = {
|
|
198
198
|
key: 1,
|
|
199
199
|
class: "lkt-item-crud_header-title"
|
|
200
|
-
},
|
|
200
|
+
}, qe = {
|
|
201
201
|
key: 2,
|
|
202
202
|
class: "lkt-item-crud_header-slot"
|
|
203
|
-
},
|
|
203
|
+
}, ze = {
|
|
204
204
|
key: 2,
|
|
205
205
|
class: "lkt-item-crud_content"
|
|
206
|
-
},
|
|
206
|
+
}, Fe = {
|
|
207
207
|
key: 0,
|
|
208
208
|
class: "lkt-grid-1"
|
|
209
|
-
},
|
|
209
|
+
}, He = /* @__PURE__ */ me({
|
|
210
210
|
__name: "LktItemCrud",
|
|
211
211
|
props: /* @__PURE__ */ Ce({
|
|
212
212
|
modelValue: {},
|
|
213
213
|
editing: { type: Boolean },
|
|
214
|
+
perms: {},
|
|
214
215
|
mode: {},
|
|
215
216
|
view: {},
|
|
216
|
-
editModeButton: {},
|
|
217
|
-
dropButton: {},
|
|
218
|
-
createButton: {},
|
|
219
|
-
updateButton: {},
|
|
217
|
+
editModeButton: { type: [Object, Boolean] },
|
|
218
|
+
dropButton: { type: [Object, Boolean] },
|
|
219
|
+
createButton: { type: [Object, Boolean] },
|
|
220
|
+
updateButton: { type: [Object, Boolean] },
|
|
220
221
|
buttonNavPosition: {},
|
|
221
222
|
buttonNavVisibility: {},
|
|
222
223
|
modalConfig: {},
|
|
@@ -227,7 +228,7 @@ const g = (...B) => {
|
|
|
227
228
|
title: {},
|
|
228
229
|
beforeEmitUpdate: { type: Function },
|
|
229
230
|
notificationType: {}
|
|
230
|
-
},
|
|
231
|
+
}, Re(Ee)),
|
|
231
232
|
emits: [
|
|
232
233
|
"update:modelValue",
|
|
233
234
|
"update:editing",
|
|
@@ -240,142 +241,155 @@ const g = (...B) => {
|
|
|
240
241
|
"error",
|
|
241
242
|
"modified-data"
|
|
242
243
|
],
|
|
243
|
-
setup(B, { expose:
|
|
244
|
-
const o = B, a = be(), p =
|
|
245
|
-
|
|
246
|
-
const n = d(!0), r = d(o.modelValue), f = d(E), C = d(o.editing), S = d(!1), b = d(!1), c = d(200), h = d(new ve(r.value, o.dataStateConfig)), I = d(!1), X = d(new ve(o.readData)), M = d(o.mode === N.Create), j = d(!1), x = d(!1), V = d(null), P = y(() => !M.value && Array.isArray(f.value) && f.value.includes(oe.Update)), _ = y(() => !M.value && Array.isArray(f.value) && f.value.includes(oe.Drop)), q = y(() => !M.value && Array.isArray(f.value) && f.value.includes(oe.SwitchEditMode)), L = async () => {
|
|
247
|
-
g("fetchItem"), n.value = !0, c.value = -1, b.value = !1;
|
|
244
|
+
setup(B, { expose: G, emit: te }) {
|
|
245
|
+
const o = B, a = be(), f = te, i = l(!0), d = l(o.modelValue), D = l(o.perms), b = l(o.editing), C = l(!1), I = l(!1), p = l(200), r = l(new ve(d.value, o.dataStateConfig)), S = l(!1), V = l(new ve(o.readData)), M = l(o.mode === U.Create), z = l(!1), J = l(!1), L = l(null), Q = y(() => !M.value && Array.isArray(D.value) && D.value.includes(de.Update)), A = y(() => !M.value && Array.isArray(D.value) && D.value.includes(de.Drop)), F = y(() => !M.value && Array.isArray(D.value) && D.value.includes(de.SwitchEditMode)), O = async () => {
|
|
246
|
+
g("fetchItem"), i.value = !0, p.value = -1, I.value = !1;
|
|
248
247
|
try {
|
|
249
|
-
const e = await
|
|
250
|
-
if (g("fetchItem -> response", e),
|
|
251
|
-
|
|
248
|
+
const e = await Me(o.readResource, o.readData);
|
|
249
|
+
if (g("fetchItem -> response", e), i.value = !1, p.value = e.httpStatus, !e.success) {
|
|
250
|
+
C.value = !1, p.value = e.httpStatus, f("error", e.httpStatus);
|
|
252
251
|
return;
|
|
253
252
|
}
|
|
254
|
-
|
|
253
|
+
C.value = !0, d.value = e.data, D.value = e.perms, r.value.increment(d.value).turnStoredIntoOriginal(), S.value = r.value.changed(), V.value.turnStoredIntoOriginal(), f("read", e);
|
|
255
254
|
} catch {
|
|
256
|
-
|
|
255
|
+
i.value = !1, C.value = !1, p.value = 404, f("error", 404);
|
|
257
256
|
return;
|
|
258
257
|
}
|
|
259
258
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}, { deep: !0 }),
|
|
263
|
-
if (
|
|
259
|
+
h(() => o.modelValue, (e) => {
|
|
260
|
+
d.value = e, r.value.increment(e);
|
|
261
|
+
}, { deep: !0 }), h(d, (e) => {
|
|
262
|
+
if (z.value = !0, g("item updated ->", d.value), typeof o.beforeEmitUpdate == "function") {
|
|
264
263
|
g("item updated -> has beforeEmitUpdate");
|
|
265
|
-
let u = o.beforeEmitUpdate(
|
|
266
|
-
g("item updated -> override with: ", u), typeof u == "object" && (
|
|
264
|
+
let u = o.beforeEmitUpdate(d.value);
|
|
265
|
+
g("item updated -> override with: ", u), typeof u == "object" && (d.value = u);
|
|
267
266
|
}
|
|
268
|
-
|
|
269
|
-
}, { deep: !0 }),
|
|
270
|
-
|
|
271
|
-
}),
|
|
272
|
-
|
|
273
|
-
}),
|
|
274
|
-
g("editing updated -> updating editMode", e),
|
|
275
|
-
}),
|
|
276
|
-
g("editMode updated -> emit update", e),
|
|
277
|
-
}),
|
|
278
|
-
o.readResource && !M.value ?
|
|
267
|
+
f("update:modelValue", d.value), g("item updated -> update dataState"), r.value.increment(e), S.value = r.value.changed(), ke(() => z.value = !1);
|
|
268
|
+
}, { deep: !0 }), h(D, () => f("perms", D.value)), h(S, (e) => {
|
|
269
|
+
f("modified-data", e);
|
|
270
|
+
}), h(() => o.readData, (e) => {
|
|
271
|
+
V.value.increment(e), V.value.changed() && O();
|
|
272
|
+
}), h(() => o.editing, (e) => {
|
|
273
|
+
g("editing updated -> updating editMode", e), b.value = e;
|
|
274
|
+
}), h(b, (e) => {
|
|
275
|
+
g("editMode updated -> emit update", e), f("update:editing", e);
|
|
276
|
+
}), De(() => {
|
|
277
|
+
o.readResource && !M.value ? O() : (M.value, C.value = !0, b.value = !0, i.value = !1, r.value.increment(d.value).turnStoredIntoOriginal(), S.value = r.value.changed());
|
|
279
278
|
});
|
|
280
|
-
const
|
|
279
|
+
const j = (e, u) => {
|
|
281
280
|
if (u) {
|
|
282
|
-
if (
|
|
283
|
-
return
|
|
284
|
-
|
|
281
|
+
if (i.value = !1, typeof e < "u" && (p.value = e.httpStatus, !e.success))
|
|
282
|
+
return I.value = !0, f("error", e.httpStatus), !1;
|
|
283
|
+
I.value = !0;
|
|
285
284
|
}
|
|
286
285
|
return !0;
|
|
287
|
-
},
|
|
288
|
-
!
|
|
289
|
-
},
|
|
290
|
-
if (g("onCreate"), !
|
|
291
|
-
o.notificationType ===
|
|
292
|
-
text:
|
|
293
|
-
details:
|
|
294
|
-
icon:
|
|
295
|
-
positionX:
|
|
286
|
+
}, P = (e) => {
|
|
287
|
+
!ue.value && e.autoReloadId && (g("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), o.readData.id = e.autoReloadId, g("doAutoReloadId -> turning off create mode"), M.value = !1, O());
|
|
288
|
+
}, H = (e, u) => {
|
|
289
|
+
if (g("onCreate"), !j(u, o.createButton.resource)) {
|
|
290
|
+
o.notificationType === N.Toast && _({
|
|
291
|
+
text: n.defaultCreateErrorText,
|
|
292
|
+
details: n.defaultCreateErrorDetails,
|
|
293
|
+
icon: n.defaultCreateErrorIcon,
|
|
294
|
+
positionX: X.Right
|
|
296
295
|
});
|
|
297
296
|
return;
|
|
298
297
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
298
|
+
J.value = !0, g("onCreate -> turn stored data into original"), r.value.increment(d.value).turnStoredIntoOriginal(), o.notificationType === N.Toast && _({
|
|
299
|
+
text: n.defaultCreateSuccessText,
|
|
300
|
+
details: n.defaultCreateSuccessDetails,
|
|
301
|
+
icon: n.defaultCreateSuccessIcon,
|
|
302
|
+
positionX: X.Right
|
|
303
|
+
}), P(u), f("create", u);
|
|
304
|
+
}, Y = (e, u) => {
|
|
305
|
+
if (g("onUpdate"), !j(u, o.updateButton.resource)) {
|
|
306
|
+
o.notificationType === N.Toast && _({
|
|
307
|
+
text: n.defaultUpdateErrorText,
|
|
308
|
+
details: n.defaultUpdateErrorDetails,
|
|
309
|
+
icon: n.defaultUpdateErrorIcon,
|
|
310
|
+
positionX: X.Right
|
|
307
311
|
});
|
|
308
312
|
return;
|
|
309
313
|
}
|
|
310
|
-
g("onUpdate -> turn stored data into original"),
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
314
|
+
g("onUpdate -> turn stored data into original"), r.value.turnStoredIntoOriginal(), o.notificationType === N.Toast && _({
|
|
315
|
+
text: n.defaultUpdateSuccessText,
|
|
316
|
+
details: n.defaultUpdateSuccessDetails,
|
|
317
|
+
icon: n.defaultUpdateSuccessIcon,
|
|
318
|
+
positionX: X.Right
|
|
319
|
+
}), P(u), f("update", u);
|
|
320
|
+
}, t = (e, u) => {
|
|
321
|
+
if (g("onDrop"), !j(u, o.dropButton.resource)) {
|
|
322
|
+
o.notificationType === N.Toast && _({
|
|
323
|
+
text: n.defaultDropErrorText,
|
|
324
|
+
details: n.defaultDropErrorDetails,
|
|
325
|
+
icon: n.defaultDropErrorIcon,
|
|
326
|
+
positionX: X.Right
|
|
318
327
|
});
|
|
319
328
|
return;
|
|
320
329
|
}
|
|
321
|
-
|
|
330
|
+
o.notificationType === N.Toast && _({
|
|
331
|
+
text: n.defaultDropSuccessText,
|
|
332
|
+
details: n.defaultDropSuccessDetails,
|
|
333
|
+
icon: n.defaultDropSuccessIcon,
|
|
334
|
+
positionX: X.Right
|
|
335
|
+
}), f("drop", u), o.view === pe.Modal && (g("onDrop -> close modal"), Ne(o.modalConfig.modalName, o.modalConfig.modalKey));
|
|
322
336
|
};
|
|
323
|
-
|
|
337
|
+
G({
|
|
324
338
|
doDrop: () => {
|
|
325
|
-
|
|
339
|
+
L.value && L.value.doDrop();
|
|
326
340
|
},
|
|
327
|
-
doRefresh:
|
|
341
|
+
doRefresh: O,
|
|
328
342
|
doSave: () => {
|
|
329
|
-
|
|
343
|
+
L.value && L.value.doSave();
|
|
330
344
|
},
|
|
331
|
-
hasModifiedData: () =>
|
|
345
|
+
hasModifiedData: () => r.value.changed()
|
|
332
346
|
});
|
|
333
|
-
const
|
|
347
|
+
const ae = y(() => {
|
|
334
348
|
var e;
|
|
335
|
-
return
|
|
336
|
-
}),
|
|
349
|
+
return r.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
|
|
350
|
+
}), ge = (e) => {
|
|
337
351
|
var u;
|
|
338
352
|
if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
|
|
339
353
|
return o.modalConfig.beforeClose({
|
|
340
354
|
...e,
|
|
341
|
-
itemCreated:
|
|
355
|
+
itemCreated: J.value
|
|
342
356
|
});
|
|
343
|
-
},
|
|
357
|
+
}, oe = y(() => o.title.startsWith("__:") ? String($e(o.title.substring(3))) : o.title), ye = y(() => i.value ? !1 : oe.value.length > 0 || !!a["post-title"]), ue = y(() => o.view === pe.Modal), re = y(() => ue.value ? "lkt-modal" : "section"), he = y(() => re.value === "lkt-modal" ? {
|
|
344
358
|
title: o.title,
|
|
345
|
-
item:
|
|
359
|
+
item: d.value,
|
|
346
360
|
...o.modalConfig,
|
|
347
|
-
|
|
348
|
-
|
|
361
|
+
beforeClose: ge,
|
|
362
|
+
closeConfirm: ae.value
|
|
349
363
|
} : {});
|
|
350
364
|
return (e, u) => {
|
|
351
|
-
const le =
|
|
352
|
-
return
|
|
365
|
+
const le = ie("lkt-http-info"), Be = ie("lkt-loader");
|
|
366
|
+
return s(), T(Se(re.value), Ie(Ue(he.value)), {
|
|
353
367
|
default: $(() => [
|
|
354
|
-
|
|
355
|
-
!
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
item:
|
|
359
|
-
loading:
|
|
368
|
+
we("article", je, [
|
|
369
|
+
!ue.value && ye.value ? (s(), w("header", Pe, [
|
|
370
|
+
c(a)["pre-title"] ? (s(), w("div", Xe, [
|
|
371
|
+
k(e.$slots, "pre-title", {
|
|
372
|
+
item: d.value,
|
|
373
|
+
loading: i.value
|
|
360
374
|
})
|
|
361
|
-
])) :
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
item:
|
|
366
|
-
loading:
|
|
375
|
+
])) : v("", !0),
|
|
376
|
+
oe.value.length > 0 ? (s(), w("h1", _e, Te(oe.value), 1)) : v("", !0),
|
|
377
|
+
c(a)["post-title"] ? (s(), w("div", qe, [
|
|
378
|
+
k(e.$slots, "post-title", {
|
|
379
|
+
item: d.value,
|
|
380
|
+
loading: i.value
|
|
367
381
|
})
|
|
368
|
-
])) :
|
|
369
|
-
])) :
|
|
370
|
-
e.buttonNavPosition ===
|
|
382
|
+
])) : v("", !0)
|
|
383
|
+
])) : v("", !0),
|
|
384
|
+
e.buttonNavPosition === c(ce).Top ? (s(), T(fe, {
|
|
371
385
|
key: 1,
|
|
372
386
|
ref_key: "buttonNav",
|
|
373
|
-
ref:
|
|
374
|
-
loading:
|
|
375
|
-
"onUpdate:loading": u[0] || (u[0] = (R) =>
|
|
376
|
-
editing:
|
|
377
|
-
"onUpdate:editing": u[1] || (u[1] = (R) =>
|
|
378
|
-
item:
|
|
387
|
+
ref: L,
|
|
388
|
+
loading: i.value,
|
|
389
|
+
"onUpdate:loading": u[0] || (u[0] = (R) => i.value = R),
|
|
390
|
+
editing: b.value,
|
|
391
|
+
"onUpdate:editing": u[1] || (u[1] = (R) => b.value = R),
|
|
392
|
+
item: d.value,
|
|
379
393
|
mode: e.mode,
|
|
380
394
|
view: e.view,
|
|
381
395
|
"button-nav-visibility": e.buttonNavVisibility,
|
|
@@ -383,64 +397,64 @@ const g = (...B) => {
|
|
|
383
397
|
"update-button": e.updateButton,
|
|
384
398
|
"drop-button": e.dropButton,
|
|
385
399
|
"edit-mode-button": e.editModeButton,
|
|
386
|
-
"data-changed":
|
|
387
|
-
"http-success-read":
|
|
388
|
-
"can-update":
|
|
389
|
-
"can-drop":
|
|
390
|
-
"can-switch-edit-mode":
|
|
391
|
-
onCreate:
|
|
392
|
-
onSave:
|
|
393
|
-
onDrop:
|
|
400
|
+
"data-changed": S.value,
|
|
401
|
+
"http-success-read": C.value,
|
|
402
|
+
"can-update": Q.value,
|
|
403
|
+
"can-drop": A.value,
|
|
404
|
+
"can-switch-edit-mode": F.value,
|
|
405
|
+
onCreate: H,
|
|
406
|
+
onSave: Y,
|
|
407
|
+
onDrop: t
|
|
394
408
|
}, se({ _: 2 }, [
|
|
395
|
-
|
|
409
|
+
c(a)["prev-buttons-ever"] ? {
|
|
396
410
|
name: "prev-buttons-ever",
|
|
397
411
|
fn: $(() => [
|
|
398
|
-
|
|
412
|
+
k(e.$slots, "prev-buttons-ever")
|
|
399
413
|
]),
|
|
400
414
|
key: "0"
|
|
401
415
|
} : void 0,
|
|
402
|
-
|
|
416
|
+
c(a)["prev-buttons"] ? {
|
|
403
417
|
name: "prev-buttons-ever",
|
|
404
418
|
fn: $(() => [
|
|
405
|
-
|
|
419
|
+
k(e.$slots, "prev-buttons")
|
|
406
420
|
]),
|
|
407
421
|
key: "1"
|
|
408
422
|
} : void 0
|
|
409
|
-
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) :
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
423
|
+
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : v("", !0),
|
|
424
|
+
i.value ? v("", !0) : (s(), w("div", ze, [
|
|
425
|
+
C.value ? (s(), w("div", Fe, [
|
|
426
|
+
I.value && e.notificationType === c(N).Inline ? (s(), T(le, {
|
|
413
427
|
key: 0,
|
|
414
|
-
code:
|
|
415
|
-
palette:
|
|
428
|
+
code: p.value,
|
|
429
|
+
palette: p.value === 200 ? "success" : "danger",
|
|
416
430
|
quick: "",
|
|
417
431
|
"can-close": "",
|
|
418
|
-
onClose: u[2] || (u[2] = (R) =>
|
|
419
|
-
}, null, 8, ["code", "palette"])) :
|
|
420
|
-
|
|
421
|
-
item:
|
|
422
|
-
loading:
|
|
423
|
-
editMode:
|
|
432
|
+
onClose: u[2] || (u[2] = (R) => I.value = !1)
|
|
433
|
+
}, null, 8, ["code", "palette"])) : v("", !0),
|
|
434
|
+
k(e.$slots, "item", {
|
|
435
|
+
item: d.value,
|
|
436
|
+
loading: i.value,
|
|
437
|
+
editMode: b.value,
|
|
424
438
|
isCreate: M.value,
|
|
425
|
-
canUpdate:
|
|
426
|
-
canDrop:
|
|
427
|
-
itemBeingEdited:
|
|
439
|
+
canUpdate: Q.value,
|
|
440
|
+
canDrop: A.value,
|
|
441
|
+
itemBeingEdited: z.value
|
|
428
442
|
})
|
|
429
|
-
])) : e.notificationType ===
|
|
443
|
+
])) : e.notificationType === c(N).Inline ? (s(), T(le, {
|
|
430
444
|
key: 1,
|
|
431
|
-
code:
|
|
432
|
-
}, null, 8, ["code"])) :
|
|
445
|
+
code: p.value
|
|
446
|
+
}, null, 8, ["code"])) : v("", !0)
|
|
433
447
|
])),
|
|
434
|
-
|
|
435
|
-
e.buttonNavPosition ===
|
|
448
|
+
i.value ? (s(), T(Be, { key: 3 })) : v("", !0),
|
|
449
|
+
e.buttonNavPosition === c(ce).Bottom ? (s(), T(fe, {
|
|
436
450
|
key: 4,
|
|
437
451
|
ref_key: "buttonNav",
|
|
438
|
-
ref:
|
|
439
|
-
loading:
|
|
440
|
-
"onUpdate:loading": u[3] || (u[3] = (R) =>
|
|
441
|
-
editing:
|
|
442
|
-
"onUpdate:editing": u[4] || (u[4] = (R) =>
|
|
443
|
-
item:
|
|
452
|
+
ref: L,
|
|
453
|
+
loading: i.value,
|
|
454
|
+
"onUpdate:loading": u[3] || (u[3] = (R) => i.value = R),
|
|
455
|
+
editing: b.value,
|
|
456
|
+
"onUpdate:editing": u[4] || (u[4] = (R) => b.value = R),
|
|
457
|
+
item: d.value,
|
|
444
458
|
mode: e.mode,
|
|
445
459
|
view: e.view,
|
|
446
460
|
"button-nav-visibility": e.buttonNavVisibility,
|
|
@@ -448,48 +462,48 @@ const g = (...B) => {
|
|
|
448
462
|
"update-button": e.updateButton,
|
|
449
463
|
"drop-button": e.dropButton,
|
|
450
464
|
"edit-mode-button": e.editModeButton,
|
|
451
|
-
"data-changed":
|
|
452
|
-
"http-success-read":
|
|
453
|
-
"can-update":
|
|
454
|
-
"can-drop":
|
|
455
|
-
"can-switch-edit-mode":
|
|
456
|
-
onCreate:
|
|
457
|
-
onSave:
|
|
458
|
-
onDrop:
|
|
465
|
+
"data-changed": S.value,
|
|
466
|
+
"http-success-read": C.value,
|
|
467
|
+
"can-update": Q.value,
|
|
468
|
+
"can-drop": A.value,
|
|
469
|
+
"can-switch-edit-mode": F.value,
|
|
470
|
+
onCreate: H,
|
|
471
|
+
onSave: Y,
|
|
472
|
+
onDrop: t
|
|
459
473
|
}, se({ _: 2 }, [
|
|
460
|
-
|
|
474
|
+
c(a)["prev-buttons-ever"] ? {
|
|
461
475
|
name: "prev-buttons-ever",
|
|
462
476
|
fn: $(() => [
|
|
463
|
-
|
|
477
|
+
k(e.$slots, "prev-buttons-ever")
|
|
464
478
|
]),
|
|
465
479
|
key: "0"
|
|
466
480
|
} : void 0,
|
|
467
|
-
|
|
481
|
+
c(a)["prev-buttons"] ? {
|
|
468
482
|
name: "prev-buttons-ever",
|
|
469
483
|
fn: $(() => [
|
|
470
|
-
|
|
484
|
+
k(e.$slots, "prev-buttons")
|
|
471
485
|
]),
|
|
472
486
|
key: "1"
|
|
473
487
|
} : void 0
|
|
474
|
-
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) :
|
|
488
|
+
]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : v("", !0)
|
|
475
489
|
])
|
|
476
490
|
]),
|
|
477
491
|
_: 3
|
|
478
492
|
}, 16);
|
|
479
493
|
};
|
|
480
494
|
}
|
|
481
|
-
}),
|
|
482
|
-
install: (B,
|
|
483
|
-
B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud",
|
|
495
|
+
}), et = {
|
|
496
|
+
install: (B, G = {}) => {
|
|
497
|
+
B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud", He);
|
|
484
498
|
}
|
|
499
|
+
}, tt = (B) => {
|
|
500
|
+
q.defaultSaveIcon = B;
|
|
485
501
|
}, at = (B) => {
|
|
486
|
-
|
|
487
|
-
}, ot = (B) => {
|
|
488
|
-
O.defaultDropIcon = B;
|
|
502
|
+
q.defaultDropIcon = B;
|
|
489
503
|
};
|
|
490
504
|
export {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
505
|
+
xe as debugLktItemCrud,
|
|
506
|
+
et as default,
|
|
507
|
+
at as setItemCrudDefaultDropIcon,
|
|
508
|
+
tt as setItemCrudDefaultSaveIcon
|
|
495
509
|
};
|