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