lkt-item-crud 2.0.6 → 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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
3
|
-
function install(B: any,
|
|
1
|
+
declare function tt(B?: boolean): void;
|
|
2
|
+
declare namespace at {
|
|
3
|
+
function install(B: any, J?: {}): void;
|
|
4
4
|
}
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
export {
|
|
5
|
+
declare function ut(B: any): void;
|
|
6
|
+
declare function ot(B: any): void;
|
|
7
|
+
export { tt as debugLktItemCrud, at as default, ut as setItemCrudDefaultDropIcon, ot as setItemCrudDefaultSaveIcon };
|
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
|
|
8
|
-
const
|
|
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
|
+
const G = class G {
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
let
|
|
10
|
+
G.debugEnabled = !1, G.defaultSaveIcon = "", G.defaultDropIcon = "";
|
|
11
|
+
let F = G;
|
|
12
12
|
const g = (...B) => {
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
},
|
|
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: () => ({}) },
|
|
@@ -41,6 +41,7 @@ const g = (...B) => {
|
|
|
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,164 +52,172 @@ const g = (...B) => {
|
|
|
51
52
|
"save",
|
|
52
53
|
"drop"
|
|
53
54
|
],
|
|
54
|
-
setup(B, { expose:
|
|
55
|
-
const o = te, a = B, f = l(E(a.createButton, n.defaultCreateButton)),
|
|
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));
|
|
56
57
|
h(() => a.createButton, (t) => {
|
|
57
58
|
f.value = E(t, n.defaultCreateButton);
|
|
58
59
|
}, { deep: !0 }), h(() => a.updateButton, (t) => {
|
|
59
|
-
|
|
60
|
+
r.value = E(t, n.defaultUpdateButton);
|
|
60
61
|
}, { deep: !0 }), h(() => a.dropButton, (t) => {
|
|
61
62
|
d.value = E(t, n.defaultDropButton);
|
|
62
63
|
}, { deep: !0 }), h(() => a.editModeButton, (t) => {
|
|
63
|
-
|
|
64
|
+
C.value = E(t, n.defaultEditModeButton);
|
|
64
65
|
}, { deep: !0 });
|
|
65
|
-
const b =
|
|
66
|
-
h(() => a.loading, (t) =>
|
|
67
|
-
const
|
|
68
|
-
h(() => a.editing, (t) =>
|
|
69
|
-
const
|
|
70
|
-
|
|
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;
|
|
71
72
|
}, V = () => {
|
|
72
|
-
|
|
73
|
-
},
|
|
73
|
+
v.value = !1;
|
|
74
|
+
}, R = (t, m) => {
|
|
74
75
|
typeof t > "u" || o("create", t, m);
|
|
75
|
-
},
|
|
76
|
+
}, H = (t, m) => {
|
|
76
77
|
typeof t > "u" || o("save", t, m);
|
|
77
|
-
},
|
|
78
|
+
}, Q = (t, m) => {
|
|
78
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
|
+
const O = y(() => {
|
|
89
90
|
var t, m;
|
|
90
|
-
return a.mode !==
|
|
91
|
-
}),
|
|
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(() => {
|
|
92
93
|
var t, m;
|
|
93
|
-
return a.mode !==
|
|
94
|
-
}),
|
|
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(() => {
|
|
95
96
|
var t, m;
|
|
96
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;
|
|
97
|
-
}),
|
|
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);
|
|
98
99
|
return (t, m) => {
|
|
99
|
-
const
|
|
100
|
-
return
|
|
101
|
-
c(b)["prev-buttons-ever"] ?
|
|
102
|
-
|
|
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
|
-
[x, !
|
|
105
|
-
]) :
|
|
106
|
-
c(b)["prev-buttons"] ?
|
|
107
|
-
|
|
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
|
-
[x,
|
|
110
|
-
]) :
|
|
111
|
-
t.mode === c(
|
|
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:
|
|
123
|
+
ref: k
|
|
124
|
+
}, r.value, {
|
|
125
|
+
disabled: !O.value,
|
|
126
|
+
onLoading: U,
|
|
118
127
|
onLoaded: V,
|
|
119
|
-
onClick:
|
|
128
|
+
onClick: H
|
|
120
129
|
}), {
|
|
121
130
|
default: $(() => [
|
|
122
|
-
c(b)["button-save"] ?
|
|
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 === c(
|
|
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:
|
|
144
|
+
ref: k
|
|
136
145
|
}, f.value, {
|
|
137
|
-
disabled: !
|
|
138
|
-
onLoading:
|
|
146
|
+
disabled: !j.value,
|
|
147
|
+
onLoading: U,
|
|
139
148
|
onLoaded: V,
|
|
140
|
-
onClick:
|
|
149
|
+
onClick: R
|
|
141
150
|
}), {
|
|
142
151
|
default: $(() => [
|
|
143
|
-
c(b)["button-save"] ?
|
|
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 !== c(
|
|
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
166
|
ref: I
|
|
158
167
|
}, d.value, {
|
|
159
|
-
disabled: !
|
|
160
|
-
onLoading:
|
|
168
|
+
disabled: !A.value,
|
|
169
|
+
onLoading: U,
|
|
161
170
|
onLoaded: V,
|
|
162
|
-
onClick:
|
|
171
|
+
onClick: Q
|
|
163
172
|
}), {
|
|
164
173
|
default: $(() => [
|
|
165
|
-
c(b)["button-drop"] ?
|
|
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
|
-
[x,
|
|
177
|
-
]) :
|
|
178
|
-
c(b).buttons ?
|
|
179
|
-
|
|
185
|
+
[x, P.value]
|
|
186
|
+
]) : p("", !0),
|
|
187
|
+
c(b).buttons ? _((s(), T("div", Pe, [
|
|
188
|
+
D(t.$slots, "buttons")
|
|
180
189
|
], 512)), [
|
|
181
|
-
[x,
|
|
182
|
-
]) :
|
|
183
|
-
|
|
184
|
-
checked:
|
|
185
|
-
"onUpdate:checked": m[0] || (m[0] = (ae) =>
|
|
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 },
|
|
214
223
|
perms: {},
|
|
@@ -228,7 +237,7 @@ const g = (...B) => {
|
|
|
228
237
|
title: {},
|
|
229
238
|
beforeEmitUpdate: { type: Function },
|
|
230
239
|
notificationType: {}
|
|
231
|
-
},
|
|
240
|
+
}, Ne($e)),
|
|
232
241
|
emits: [
|
|
233
242
|
"update:modelValue",
|
|
234
243
|
"update:editing",
|
|
@@ -241,154 +250,154 @@ const g = (...B) => {
|
|
|
241
250
|
"error",
|
|
242
251
|
"modified-data"
|
|
243
252
|
],
|
|
244
|
-
setup(B, { expose:
|
|
245
|
-
const o = B, a =
|
|
246
|
-
g("fetchItem"),
|
|
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;
|
|
247
256
|
try {
|
|
248
|
-
const e = await
|
|
249
|
-
if (g("fetchItem -> response", e),
|
|
250
|
-
|
|
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);
|
|
251
260
|
return;
|
|
252
261
|
}
|
|
253
|
-
|
|
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);
|
|
254
263
|
} catch {
|
|
255
|
-
|
|
264
|
+
r.value = !1, k.value = !1, v.value = 404, f("error", 404);
|
|
256
265
|
return;
|
|
257
266
|
}
|
|
258
267
|
};
|
|
259
268
|
h(() => o.modelValue, (e) => {
|
|
260
|
-
d.value = e,
|
|
269
|
+
d.value = e, i.value.increment(e);
|
|
261
270
|
}, { deep: !0 }), h(d, (e) => {
|
|
262
|
-
if (
|
|
271
|
+
if (H.value = !0, g("item updated ->", d.value), typeof o.beforeEmitUpdate == "function") {
|
|
263
272
|
g("item updated -> has beforeEmitUpdate");
|
|
264
273
|
let u = o.beforeEmitUpdate(d.value);
|
|
265
274
|
g("item updated -> override with: ", u), typeof u == "object" && (d.value = u);
|
|
266
275
|
}
|
|
267
|
-
f("update:modelValue", d.value), g("item updated -> update dataState"),
|
|
268
|
-
}, { deep: !0 }), h(
|
|
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) => {
|
|
269
278
|
f("modified-data", e);
|
|
270
279
|
}), h(() => o.readData, (e) => {
|
|
271
|
-
V.value.increment(e), V.value.changed() &&
|
|
280
|
+
V.value.increment(e), V.value.changed() && A();
|
|
272
281
|
}), h(() => o.editing, (e) => {
|
|
273
282
|
g("editing updated -> updating editMode", e), b.value = e;
|
|
274
283
|
}), h(b, (e) => {
|
|
275
284
|
g("editMode updated -> emit update", e), f("update:editing", e);
|
|
276
|
-
}),
|
|
277
|
-
o.readResource && !
|
|
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());
|
|
278
287
|
});
|
|
279
|
-
const
|
|
288
|
+
const P = (e, u) => {
|
|
280
289
|
if (u) {
|
|
281
|
-
if (
|
|
290
|
+
if (r.value = !1, typeof e < "u" && (v.value = e.httpStatus, !e.success))
|
|
282
291
|
return I.value = !0, f("error", e.httpStatus), !1;
|
|
283
292
|
I.value = !0;
|
|
284
293
|
}
|
|
285
294
|
return !0;
|
|
286
|
-
},
|
|
287
|
-
!ue.value && e.autoReloadId && (g("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), o.readData.id = e.autoReloadId, g("doAutoReloadId -> turning off create mode"),
|
|
288
|
-
},
|
|
289
|
-
if (g("onCreate"), !
|
|
290
|
-
o.notificationType === N.Toast &&
|
|
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) => {
|
|
298
|
+
if (g("onCreate"), !P(u, o.createButton.resource)) {
|
|
299
|
+
o.notificationType === N.Toast && z({
|
|
291
300
|
text: n.defaultCreateErrorText,
|
|
292
301
|
details: n.defaultCreateErrorDetails,
|
|
293
302
|
icon: n.defaultCreateErrorIcon,
|
|
294
|
-
positionX:
|
|
303
|
+
positionX: q.Right
|
|
295
304
|
});
|
|
296
305
|
return;
|
|
297
306
|
}
|
|
298
|
-
|
|
307
|
+
Q.value = !0, g("onCreate -> turn stored data into original"), i.value.increment(d.value).turnStoredIntoOriginal(), o.notificationType === N.Toast && z({
|
|
299
308
|
text: n.defaultCreateSuccessText,
|
|
300
309
|
details: n.defaultCreateSuccessDetails,
|
|
301
310
|
icon: n.defaultCreateSuccessIcon,
|
|
302
|
-
positionX:
|
|
303
|
-
}),
|
|
304
|
-
},
|
|
305
|
-
if (g("onUpdate"), !
|
|
306
|
-
o.notificationType === N.Toast &&
|
|
311
|
+
positionX: q.Right
|
|
312
|
+
}), X(u), f("create", u);
|
|
313
|
+
}, Z = (e, u) => {
|
|
314
|
+
if (g("onUpdate"), !P(u, o.updateButton.resource)) {
|
|
315
|
+
o.notificationType === N.Toast && z({
|
|
307
316
|
text: n.defaultUpdateErrorText,
|
|
308
317
|
details: n.defaultUpdateErrorDetails,
|
|
309
318
|
icon: n.defaultUpdateErrorIcon,
|
|
310
|
-
positionX:
|
|
319
|
+
positionX: q.Right
|
|
311
320
|
});
|
|
312
321
|
return;
|
|
313
322
|
}
|
|
314
|
-
g("onUpdate -> turn stored data into original"),
|
|
323
|
+
g("onUpdate -> turn stored data into original"), i.value.turnStoredIntoOriginal(), o.notificationType === N.Toast && z({
|
|
315
324
|
text: n.defaultUpdateSuccessText,
|
|
316
325
|
details: n.defaultUpdateSuccessDetails,
|
|
317
326
|
icon: n.defaultUpdateSuccessIcon,
|
|
318
|
-
positionX:
|
|
319
|
-
}),
|
|
327
|
+
positionX: q.Right
|
|
328
|
+
}), X(u), f("update", u);
|
|
320
329
|
}, t = (e, u) => {
|
|
321
|
-
if (g("onDrop"), !
|
|
322
|
-
o.notificationType === N.Toast &&
|
|
330
|
+
if (g("onDrop"), !P(u, o.dropButton.resource)) {
|
|
331
|
+
o.notificationType === N.Toast && z({
|
|
323
332
|
text: n.defaultDropErrorText,
|
|
324
333
|
details: n.defaultDropErrorDetails,
|
|
325
334
|
icon: n.defaultDropErrorIcon,
|
|
326
|
-
positionX:
|
|
335
|
+
positionX: q.Right
|
|
327
336
|
});
|
|
328
337
|
return;
|
|
329
338
|
}
|
|
330
|
-
o.notificationType === N.Toast &&
|
|
339
|
+
o.notificationType === N.Toast && z({
|
|
331
340
|
text: n.defaultDropSuccessText,
|
|
332
341
|
details: n.defaultDropSuccessDetails,
|
|
333
342
|
icon: n.defaultDropSuccessIcon,
|
|
334
|
-
positionX:
|
|
335
|
-
}), f("drop", u), o.view ===
|
|
343
|
+
positionX: q.Right
|
|
344
|
+
}), f("drop", u), o.view === fe.Modal && (g("onDrop -> close modal"), Ve(o.modalConfig.modalName, o.modalConfig.modalKey));
|
|
336
345
|
};
|
|
337
|
-
|
|
346
|
+
J({
|
|
338
347
|
doDrop: () => {
|
|
339
348
|
L.value && L.value.doDrop();
|
|
340
349
|
},
|
|
341
|
-
doRefresh:
|
|
350
|
+
doRefresh: A,
|
|
342
351
|
doSave: () => {
|
|
343
352
|
L.value && L.value.doSave();
|
|
344
353
|
},
|
|
345
|
-
hasModifiedData: () =>
|
|
354
|
+
hasModifiedData: () => i.value.changed()
|
|
346
355
|
});
|
|
347
356
|
const ae = y(() => {
|
|
348
357
|
var e;
|
|
349
|
-
return
|
|
350
|
-
}),
|
|
358
|
+
return i.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
|
|
359
|
+
}), he = (e) => {
|
|
351
360
|
var u;
|
|
352
361
|
if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
|
|
353
362
|
return o.modalConfig.beforeClose({
|
|
354
363
|
...e,
|
|
355
|
-
itemCreated:
|
|
364
|
+
itemCreated: Q.value
|
|
356
365
|
});
|
|
357
|
-
}, oe = y(() => o.title.startsWith("__:") ? String(
|
|
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" ? {
|
|
358
367
|
title: o.title,
|
|
359
368
|
item: d.value,
|
|
360
369
|
...o.modalConfig,
|
|
361
|
-
beforeClose:
|
|
370
|
+
beforeClose: he,
|
|
362
371
|
closeConfirm: ae.value
|
|
363
372
|
} : {});
|
|
364
373
|
return (e, u) => {
|
|
365
|
-
const
|
|
366
|
-
return s(),
|
|
374
|
+
const pe = le("lkt-http-info"), Ce = le("lkt-loader");
|
|
375
|
+
return s(), M(Ie(se.value), we(Te(ke.value)), {
|
|
367
376
|
default: $(() => [
|
|
368
|
-
|
|
369
|
-
!ue.value &&
|
|
370
|
-
c(a)["pre-title"] ? (s(),
|
|
371
|
-
|
|
377
|
+
Me("article", Xe, [
|
|
378
|
+
!ue.value && Be.value ? (s(), T("header", qe, [
|
|
379
|
+
c(a)["pre-title"] ? (s(), T("div", ze, [
|
|
380
|
+
D(e.$slots, "pre-title", {
|
|
372
381
|
item: d.value,
|
|
373
|
-
loading:
|
|
382
|
+
loading: r.value
|
|
374
383
|
})
|
|
375
|
-
])) :
|
|
376
|
-
oe.value.length > 0 ? (s(),
|
|
377
|
-
c(a)["post-title"] ? (s(),
|
|
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, [
|
|
387
|
+
D(e.$slots, "post-title", {
|
|
379
388
|
item: d.value,
|
|
380
|
-
loading:
|
|
389
|
+
loading: r.value
|
|
381
390
|
})
|
|
382
|
-
])) :
|
|
383
|
-
])) :
|
|
384
|
-
e.buttonNavPosition === c(
|
|
391
|
+
])) : p("", !0)
|
|
392
|
+
])) : p("", !0),
|
|
393
|
+
e.buttonNavPosition === c(me).Top ? (s(), M(be, {
|
|
385
394
|
key: 1,
|
|
386
395
|
ref_key: "buttonNav",
|
|
387
396
|
ref: L,
|
|
388
|
-
loading:
|
|
389
|
-
"onUpdate:loading": u[0] || (u[0] = (
|
|
397
|
+
loading: r.value,
|
|
398
|
+
"onUpdate:loading": u[0] || (u[0] = (S) => r.value = S),
|
|
390
399
|
editing: b.value,
|
|
391
|
-
"onUpdate:editing": u[1] || (u[1] = (
|
|
400
|
+
"onUpdate:editing": u[1] || (u[1] = (S) => b.value = S),
|
|
392
401
|
item: d.value,
|
|
393
402
|
mode: e.mode,
|
|
394
403
|
view: e.view,
|
|
@@ -397,63 +406,72 @@ const g = (...B) => {
|
|
|
397
406
|
"update-button": e.updateButton,
|
|
398
407
|
"drop-button": e.dropButton,
|
|
399
408
|
"edit-mode-button": e.editModeButton,
|
|
400
|
-
"data-changed":
|
|
401
|
-
"http-success-read":
|
|
402
|
-
"can-update":
|
|
403
|
-
"can-drop":
|
|
404
|
-
"can-switch-edit-mode":
|
|
405
|
-
|
|
406
|
-
|
|
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,
|
|
407
417
|
onDrop: t
|
|
408
|
-
},
|
|
418
|
+
}, ve({ _: 2 }, [
|
|
409
419
|
c(a)["prev-buttons-ever"] ? {
|
|
410
420
|
name: "prev-buttons-ever",
|
|
411
|
-
fn: $(() => [
|
|
412
|
-
|
|
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
|
+
})
|
|
413
427
|
]),
|
|
414
428
|
key: "0"
|
|
415
429
|
} : void 0,
|
|
416
430
|
c(a)["prev-buttons"] ? {
|
|
417
431
|
name: "prev-buttons-ever",
|
|
418
|
-
fn: $(() => [
|
|
419
|
-
|
|
432
|
+
fn: $(({ canUpdate: S, canDrop: ne, perms: de }) => [
|
|
433
|
+
D(e.$slots, "prev-buttons", {
|
|
434
|
+
canUpdate: S,
|
|
435
|
+
canDrop: ne,
|
|
436
|
+
perms: de
|
|
437
|
+
})
|
|
420
438
|
]),
|
|
421
439
|
key: "1"
|
|
422
440
|
} : void 0
|
|
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"])) :
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
I.value && e.notificationType === c(N).Inline ? (s(),
|
|
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, {
|
|
427
445
|
key: 0,
|
|
428
|
-
code:
|
|
429
|
-
palette:
|
|
446
|
+
code: v.value,
|
|
447
|
+
palette: v.value === 200 ? "success" : "danger",
|
|
430
448
|
quick: "",
|
|
431
449
|
"can-close": "",
|
|
432
|
-
onClose: u[2] || (u[2] = (
|
|
433
|
-
}, null, 8, ["code", "palette"])) :
|
|
434
|
-
|
|
450
|
+
onClose: u[2] || (u[2] = (S) => I.value = !1)
|
|
451
|
+
}, null, 8, ["code", "palette"])) : p("", !0),
|
|
452
|
+
D(e.$slots, "item", {
|
|
435
453
|
item: d.value,
|
|
436
|
-
loading:
|
|
454
|
+
loading: r.value,
|
|
437
455
|
editMode: b.value,
|
|
438
|
-
isCreate:
|
|
439
|
-
canUpdate:
|
|
440
|
-
canDrop:
|
|
441
|
-
itemBeingEdited:
|
|
456
|
+
isCreate: R.value,
|
|
457
|
+
canUpdate: Y.value,
|
|
458
|
+
canDrop: O.value,
|
|
459
|
+
itemBeingEdited: H.value
|
|
442
460
|
})
|
|
443
|
-
])) : e.notificationType === c(N).Inline ? (s(),
|
|
461
|
+
])) : e.notificationType === c(N).Inline ? (s(), M(pe, {
|
|
444
462
|
key: 1,
|
|
445
|
-
code:
|
|
446
|
-
}, null, 8, ["code"])) :
|
|
463
|
+
code: v.value
|
|
464
|
+
}, null, 8, ["code"])) : p("", !0)
|
|
447
465
|
])),
|
|
448
|
-
|
|
449
|
-
e.buttonNavPosition === c(
|
|
466
|
+
r.value ? (s(), M(Ce, { key: 3 })) : p("", !0),
|
|
467
|
+
e.buttonNavPosition === c(me).Bottom ? (s(), M(be, {
|
|
450
468
|
key: 4,
|
|
451
469
|
ref_key: "buttonNav",
|
|
452
470
|
ref: L,
|
|
453
|
-
loading:
|
|
454
|
-
"onUpdate:loading": u[3] || (u[3] = (
|
|
471
|
+
loading: r.value,
|
|
472
|
+
"onUpdate:loading": u[3] || (u[3] = (S) => r.value = S),
|
|
455
473
|
editing: b.value,
|
|
456
|
-
"onUpdate:editing": u[4] || (u[4] = (
|
|
474
|
+
"onUpdate:editing": u[4] || (u[4] = (S) => b.value = S),
|
|
457
475
|
item: d.value,
|
|
458
476
|
mode: e.mode,
|
|
459
477
|
view: e.view,
|
|
@@ -462,48 +480,48 @@ const g = (...B) => {
|
|
|
462
480
|
"update-button": e.updateButton,
|
|
463
481
|
"drop-button": e.dropButton,
|
|
464
482
|
"edit-mode-button": e.editModeButton,
|
|
465
|
-
"data-changed":
|
|
466
|
-
"http-success-read":
|
|
467
|
-
"can-update":
|
|
468
|
-
"can-drop":
|
|
469
|
-
"can-switch-edit-mode":
|
|
470
|
-
onCreate:
|
|
471
|
-
onSave:
|
|
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,
|
|
472
490
|
onDrop: t
|
|
473
|
-
},
|
|
491
|
+
}, ve({ _: 2 }, [
|
|
474
492
|
c(a)["prev-buttons-ever"] ? {
|
|
475
493
|
name: "prev-buttons-ever",
|
|
476
494
|
fn: $(() => [
|
|
477
|
-
|
|
495
|
+
D(e.$slots, "prev-buttons-ever")
|
|
478
496
|
]),
|
|
479
497
|
key: "0"
|
|
480
498
|
} : void 0,
|
|
481
499
|
c(a)["prev-buttons"] ? {
|
|
482
500
|
name: "prev-buttons-ever",
|
|
483
501
|
fn: $(() => [
|
|
484
|
-
|
|
502
|
+
D(e.$slots, "prev-buttons")
|
|
485
503
|
]),
|
|
486
504
|
key: "1"
|
|
487
505
|
} : void 0
|
|
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"])) :
|
|
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)
|
|
489
507
|
])
|
|
490
508
|
]),
|
|
491
509
|
_: 3
|
|
492
510
|
}, 16);
|
|
493
511
|
};
|
|
494
512
|
}
|
|
495
|
-
}),
|
|
496
|
-
install: (B,
|
|
497
|
-
B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud",
|
|
513
|
+
}), at = {
|
|
514
|
+
install: (B, J = {}) => {
|
|
515
|
+
B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud", Ge);
|
|
498
516
|
}
|
|
499
|
-
},
|
|
500
|
-
|
|
501
|
-
},
|
|
502
|
-
|
|
517
|
+
}, ot = (B) => {
|
|
518
|
+
F.defaultSaveIcon = B;
|
|
519
|
+
}, ut = (B) => {
|
|
520
|
+
F.defaultDropIcon = B;
|
|
503
521
|
};
|
|
504
522
|
export {
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
523
|
+
tt as debugLktItemCrud,
|
|
524
|
+
at as default,
|
|
525
|
+
ut as setItemCrudDefaultDropIcon,
|
|
526
|
+
ot as setItemCrudDefaultSaveIcon
|
|
509
527
|
};
|
|
@@ -15,6 +15,7 @@ type __VLS_Props = {
|
|
|
15
15
|
canUpdate?: boolean;
|
|
16
16
|
canDrop?: boolean;
|
|
17
17
|
canSwitchEditMode?: boolean;
|
|
18
|
+
perms?: Array<string>;
|
|
18
19
|
httpSuccessRead?: boolean;
|
|
19
20
|
buttonNavVisibility: ItemCrudButtonNavVisibility;
|
|
20
21
|
};
|
|
@@ -1651,7 +1652,15 @@ declare const isEditing: import("vue").Ref<boolean, boolean>;
|
|
|
1651
1652
|
declare const onButtonLoading: () => void, onButtonLoaded: () => void, onCreate: ($event: Event | undefined, r: HTTPResponse) => void, onSave: ($event: Event | undefined, r: HTTPResponse) => void, onDrop: ($event: Event | undefined, r: HTTPResponse) => void;
|
|
1652
1653
|
declare const ableToUpdate: import("vue").ComputedRef<boolean>, ableToCreate: import("vue").ComputedRef<boolean>, ableToDrop: import("vue").ComputedRef<boolean>, showDropButton: import("vue").ComputedRef<boolean>, showSaveButton: import("vue").ComputedRef<boolean>, showSwitchButton: import("vue").ComputedRef<boolean>, showButtons: import("vue").ComputedRef<boolean>;
|
|
1653
1654
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
1654
|
-
declare var __VLS_1: {
|
|
1655
|
+
declare var __VLS_1: {
|
|
1656
|
+
canUpdate: boolean | undefined;
|
|
1657
|
+
canDrop: boolean | undefined;
|
|
1658
|
+
perms: string[] | undefined;
|
|
1659
|
+
}, __VLS_3: {
|
|
1660
|
+
canUpdate: boolean | undefined;
|
|
1661
|
+
canDrop: boolean | undefined;
|
|
1662
|
+
perms: string[] | undefined;
|
|
1663
|
+
}, __VLS_17: {
|
|
1655
1664
|
item: LktObject;
|
|
1656
1665
|
editMode: boolean;
|
|
1657
1666
|
isCreate: boolean;
|
|
@@ -3,7 +3,7 @@ import { HTTPResponse } from 'lkt-http-client';
|
|
|
3
3
|
import { ItemCrudButtonNavPosition, ItemCrudConfig, ItemCrudMode, ItemCrudView, LktObject, NotificationType } from 'lkt-vue-kernel';
|
|
4
4
|
import ButtonNav from '../components/ButtonNav.vue';
|
|
5
5
|
declare const slots: SetupContext['slots'];
|
|
6
|
-
declare const isLoading: import("vue").Ref<boolean, boolean>, item: import("vue").Ref<LktObject, LktObject>, editMode: import("vue").Ref<boolean, boolean>, httpSuccessRead: import("vue").Ref<boolean, boolean>, showStoreMessage: import("vue").Ref<boolean, boolean>, httpStatus: import("vue").Ref<number, number>, dataChanged: import("vue").Ref<boolean, boolean>, createMode: import("vue").Ref<boolean, boolean>, itemBeingEdited: import("vue").Ref<boolean, boolean>, buttonNav: import("vue").Ref<null, null>, canUpdate: import("vue").ComputedRef<boolean>, canDrop: import("vue").ComputedRef<boolean>, canSwitchEditMode: import("vue").ComputedRef<boolean>;
|
|
6
|
+
declare const isLoading: import("vue").Ref<boolean, boolean>, item: import("vue").Ref<LktObject, LktObject>, perms: import("vue").Ref<string[], string[]>, editMode: import("vue").Ref<boolean, boolean>, httpSuccessRead: import("vue").Ref<boolean, boolean>, showStoreMessage: import("vue").Ref<boolean, boolean>, httpStatus: import("vue").Ref<number, number>, dataChanged: import("vue").Ref<boolean, boolean>, createMode: import("vue").Ref<boolean, boolean>, itemBeingEdited: import("vue").Ref<boolean, boolean>, buttonNav: import("vue").Ref<null, null>, canUpdate: import("vue").ComputedRef<boolean>, canDrop: import("vue").ComputedRef<boolean>, canSwitchEditMode: import("vue").ComputedRef<boolean>;
|
|
7
7
|
declare const onCreate: ($event: PointerEvent, r: HTTPResponse) => void, onUpdate: ($event: PointerEvent, r: HTTPResponse) => void, onDrop: ($event: PointerEvent, r: HTTPResponse) => void;
|
|
8
8
|
declare const computedTitle: import("vue").ComputedRef<string>, displayHeader: import("vue").ComputedRef<boolean>, computedInsideModal: import("vue").ComputedRef<boolean>, computedContainerTag: import("vue").ComputedRef<"lkt-modal" | "section">, computedContainerAttrs: import("vue").ComputedRef<{}>;
|
|
9
9
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
@@ -13,7 +13,15 @@ declare var __VLS_6: {
|
|
|
13
13
|
}, __VLS_8: {
|
|
14
14
|
item: LktObject;
|
|
15
15
|
loading: boolean;
|
|
16
|
-
}, __VLS_21: {
|
|
16
|
+
}, __VLS_21: {
|
|
17
|
+
canUpdate: boolean | undefined;
|
|
18
|
+
canDrop: boolean | undefined;
|
|
19
|
+
perms: string[] | undefined;
|
|
20
|
+
}, __VLS_23: {
|
|
21
|
+
canUpdate: boolean | undefined;
|
|
22
|
+
canDrop: boolean | undefined;
|
|
23
|
+
perms: string[] | undefined;
|
|
24
|
+
}, __VLS_33: {
|
|
17
25
|
item: LktObject;
|
|
18
26
|
loading: false;
|
|
19
27
|
editMode: boolean;
|
|
@@ -44,6 +52,7 @@ declare const __VLS_self: import("vue").DefineComponent<ItemCrudConfig, {
|
|
|
44
52
|
slots: typeof slots;
|
|
45
53
|
isLoading: typeof isLoading;
|
|
46
54
|
item: typeof item;
|
|
55
|
+
perms: typeof perms;
|
|
47
56
|
editMode: typeof editMode;
|
|
48
57
|
httpSuccessRead: typeof httpSuccessRead;
|
|
49
58
|
showStoreMessage: typeof showStoreMessage;
|
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
canUpdate?: boolean
|
|
38
38
|
canDrop?: boolean
|
|
39
39
|
canSwitchEditMode?: boolean
|
|
40
|
+
perms?: Array<string>
|
|
40
41
|
|
|
41
42
|
httpSuccessRead?: boolean
|
|
42
43
|
|
|
@@ -114,7 +115,7 @@
|
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
const ableToUpdate = computed(() => {
|
|
117
|
-
if (props.mode !== ItemCrudMode.
|
|
118
|
+
if (props.mode !== ItemCrudMode.Update || !props.canUpdate) return false;
|
|
118
119
|
if (!props.dataChanged) return false;
|
|
119
120
|
|
|
120
121
|
if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled(props.item);
|
|
@@ -151,7 +152,9 @@
|
|
|
151
152
|
showSaveButton = computed(() => {
|
|
152
153
|
if (props.mode === ItemCrudMode.Create && props.createButton === false) return false;
|
|
153
154
|
if (props.mode === ItemCrudMode.Update && props.updateButton === false) return false;
|
|
154
|
-
if (props.dataChanged)
|
|
155
|
+
if (props.dataChanged) {
|
|
156
|
+
return ableToUpdate.value || ableToCreate.value;
|
|
157
|
+
}
|
|
155
158
|
if (isLoading.value) return false;
|
|
156
159
|
|
|
157
160
|
if (props.mode === ItemCrudMode.Create) {
|
|
@@ -188,11 +191,19 @@
|
|
|
188
191
|
<div v-if="showButtons" class="lkt-item-crud-buttons">
|
|
189
192
|
|
|
190
193
|
<div class="lkt-item-crud-buttons" v-if="slots['prev-buttons-ever']" v-show="!isLoading">
|
|
191
|
-
<slot name="prev-buttons-ever"
|
|
194
|
+
<slot name="prev-buttons-ever"
|
|
195
|
+
:can-update="canUpdate"
|
|
196
|
+
:can-drop="canDrop"
|
|
197
|
+
:perms="perms"
|
|
198
|
+
/>
|
|
192
199
|
</div>
|
|
193
200
|
|
|
194
201
|
<div class="lkt-item-crud-buttons" v-if="slots['prev-buttons']" v-show="isEditing && !isLoading">
|
|
195
|
-
<slot name="prev-buttons"
|
|
202
|
+
<slot name="prev-buttons"
|
|
203
|
+
:can-update="canUpdate"
|
|
204
|
+
:can-drop="canDrop"
|
|
205
|
+
:perms="perms"
|
|
206
|
+
/>
|
|
196
207
|
</div>
|
|
197
208
|
|
|
198
209
|
<lkt-button
|
|
@@ -362,15 +362,24 @@
|
|
|
362
362
|
:can-update="canUpdate"
|
|
363
363
|
:can-drop="canDrop"
|
|
364
364
|
:can-switch-edit-mode="canSwitchEditMode"
|
|
365
|
+
:perms="perms"
|
|
365
366
|
@create="onCreate"
|
|
366
367
|
@save="onUpdate"
|
|
367
368
|
@drop="onDrop"
|
|
368
369
|
>
|
|
369
|
-
<template #prev-buttons-ever v-if="slots['prev-buttons-ever']">
|
|
370
|
-
<slot name="prev-buttons-ever"
|
|
370
|
+
<template #prev-buttons-ever="{canUpdate, canDrop, perms}" v-if="slots['prev-buttons-ever']">
|
|
371
|
+
<slot name="prev-buttons-ever"
|
|
372
|
+
:can-update="canUpdate"
|
|
373
|
+
:can-drop="canDrop"
|
|
374
|
+
:perms="perms"
|
|
375
|
+
/>
|
|
371
376
|
</template>
|
|
372
|
-
<template #prev-buttons-ever v-if="slots['prev-buttons']">
|
|
373
|
-
<slot name="prev-buttons"
|
|
377
|
+
<template #prev-buttons-ever="{canUpdate, canDrop, perms}" v-if="slots['prev-buttons']">
|
|
378
|
+
<slot name="prev-buttons"
|
|
379
|
+
:can-update="canUpdate"
|
|
380
|
+
:can-drop="canDrop"
|
|
381
|
+
:perms="perms"
|
|
382
|
+
/>
|
|
374
383
|
</template>
|
|
375
384
|
</button-nav>
|
|
376
385
|
|