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