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