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