lkt-item-crud 2.0.18 → 2.0.19
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 +329 -318
- package/dist/lib-components/LktItemCrud.vue.d.ts +8 -5
- package/package.json +1 -1
- package/src/lib-components/LktItemCrud.vue +27 -9
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
3
|
-
function install(T: any,
|
|
1
|
+
declare function gt(T?: boolean): void;
|
|
2
|
+
declare namespace yt {
|
|
3
|
+
function install(T: any, ae?: {}): void;
|
|
4
4
|
}
|
|
5
|
-
declare function
|
|
6
|
-
declare function
|
|
7
|
-
export {
|
|
5
|
+
declare function kt(T: any): void;
|
|
6
|
+
declare function Bt(T: any): void;
|
|
7
|
+
export { gt as debugLktItemCrud, yt as default, kt as setItemCrudDefaultDropIcon, Bt as setItemCrudDefaultSaveIcon };
|
package/dist/build.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { httpCall as
|
|
3
|
-
import { DataState as
|
|
4
|
-
import { ItemCrudMode as
|
|
5
|
-
import { closeModal as
|
|
6
|
-
import { __ as
|
|
1
|
+
import { defineComponent as we, useSlots as Re, ref as c, watch as D, computed as U, resolveComponent as le, createElementBlock as N, createCommentVNode as d, openBlock as m, createBlock as O, Fragment as Se, renderSlot as s, withDirectives as $, mergeProps as R, unref as u, createVNode as q, withCtx as C, vShow as L, mergeDefaults as Ne, nextTick as Ve, onMounted as je, resolveDynamicComponent as Pe, createSlots as re, createElementVNode as Xe, toDisplayString as Fe } from "vue";
|
|
2
|
+
import { httpCall as We } from "lkt-http-client";
|
|
3
|
+
import { DataState as Ie } from "lkt-data-state";
|
|
4
|
+
import { ItemCrudMode as S, ItemCrudButtonNavVisibility as Me, TablePermission as ke, ensureButtonConfig as z, LktSettings as i, ItemCrudView as Te, ItemCrudButtonNavPosition as De, NotificationType as J, getDefaultValues as Ke, ItemCrud as Ge, ToastPositionX as Z } from "lkt-vue-kernel";
|
|
5
|
+
import { closeModal as He, updateModalKey as qe } from "lkt-modal";
|
|
6
|
+
import { __ as ze } from "lkt-i18n";
|
|
7
7
|
import { openToast as _ } from "lkt-toast";
|
|
8
|
-
import { useRouter as
|
|
9
|
-
const
|
|
8
|
+
import { useRouter as Je } from "vue-router";
|
|
9
|
+
const te = class te {
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
let x =
|
|
13
|
-
const
|
|
11
|
+
te.debugEnabled = !1, te.defaultSaveIcon = "", te.defaultDropIcon = "";
|
|
12
|
+
let x = te;
|
|
13
|
+
const k = (...T) => {
|
|
14
14
|
x.debugEnabled && console.info("[LktItemCrud] ", ...T);
|
|
15
|
-
},
|
|
15
|
+
}, gt = (T = !0) => {
|
|
16
16
|
x.debugEnabled = T;
|
|
17
|
-
},
|
|
17
|
+
}, Qe = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "lkt-item-crud-buttons"
|
|
20
|
-
},
|
|
20
|
+
}, Ye = {
|
|
21
21
|
key: 0,
|
|
22
22
|
class: "lkt-item-crud-buttons"
|
|
23
|
-
},
|
|
23
|
+
}, Ze = {
|
|
24
24
|
key: 1,
|
|
25
25
|
class: "lkt-item-crud-buttons"
|
|
26
|
-
},
|
|
26
|
+
}, _e = {
|
|
27
27
|
key: 2,
|
|
28
28
|
class: "lkt-item-crud-buttons"
|
|
29
|
-
},
|
|
29
|
+
}, he = /* @__PURE__ */ we({
|
|
30
30
|
__name: "ButtonNav",
|
|
31
31
|
props: {
|
|
32
32
|
item: { default: () => ({}) },
|
|
@@ -59,38 +59,38 @@ const B = (...T) => {
|
|
|
59
59
|
"save",
|
|
60
60
|
"drop"
|
|
61
61
|
],
|
|
62
|
-
setup(T, { expose:
|
|
63
|
-
const a =
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
62
|
+
setup(T, { expose: ae, emit: ie }) {
|
|
63
|
+
const a = ie, r = T, l = Re(), b = c(null), v = c(null), n = c(r.loading);
|
|
64
|
+
D(() => r.loading, (e) => n.value = e), D(n, (e) => a("update:loading", e));
|
|
65
|
+
const g = c(r.editing);
|
|
66
|
+
D(() => r.editing, (e) => g.value = e), D(g, (e) => a("update:editing", e));
|
|
67
|
+
const f = () => {
|
|
68
68
|
n.value = !0;
|
|
69
|
-
},
|
|
69
|
+
}, y = () => {
|
|
70
70
|
n.value = !1;
|
|
71
|
-
},
|
|
72
|
-
typeof e > "u" || a("create", e,
|
|
73
|
-
},
|
|
74
|
-
typeof e > "u" || a("save", e,
|
|
75
|
-
},
|
|
76
|
-
typeof e > "u" || a("drop", e,
|
|
71
|
+
}, X = (e, B) => {
|
|
72
|
+
typeof e > "u" || a("create", e, B);
|
|
73
|
+
}, A = (e, B) => {
|
|
74
|
+
typeof e > "u" || a("save", e, B);
|
|
75
|
+
}, F = (e, B) => {
|
|
76
|
+
typeof e > "u" || a("drop", e, B);
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
ae({
|
|
79
79
|
doSave: () => {
|
|
80
|
-
|
|
80
|
+
b.value && typeof b.value.click == "function" && b.value.click();
|
|
81
81
|
},
|
|
82
82
|
doDrop: () => {
|
|
83
|
-
|
|
83
|
+
v.value && typeof v.value.click == "function" && v.value.click();
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
const
|
|
87
|
-
return (e,
|
|
88
|
-
const h =
|
|
89
|
-
return
|
|
90
|
-
e.grouped && e.groupButtonAsModalActions ? (
|
|
91
|
-
|
|
92
|
-
checked:
|
|
93
|
-
"onUpdate:checked":
|
|
86
|
+
const M = U(() => !r.canDrop || r.dropButton === !1 ? !1 : !r.canUpdate && r.canDrop ? !0 : !n.value && r.editing && r.httpSuccessRead), V = U(() => r.mode === S.Create && r.createButton === !1 || r.mode === S.Update && r.updateButton === !1 || n.value ? !1 : r.editing && r.httpSuccessRead), E = U(() => r.editModeButton === !1 || !r.canSwitchEditMode || !r.canUpdate && !r.canDrop || !r.canUpdate && r.canDrop ? !1 : !n.value && r.mode !== S.Create && r.httpSuccessRead), ee = U(() => r.buttonNavVisibility === Me.Always || l["prev-buttons-ever"] ? !0 : r.buttonNavVisibility === Me.Never ? !1 : V.value || M.value || E.value);
|
|
87
|
+
return (e, B) => {
|
|
88
|
+
const h = le("lkt-button");
|
|
89
|
+
return ee.value ? (m(), N("div", Qe, [
|
|
90
|
+
e.grouped && e.groupButtonAsModalActions ? (m(), N(Se, { key: 0 }, [
|
|
91
|
+
E.value ? (m(), O(h, R({ key: 0 }, e.editModeButton, {
|
|
92
|
+
checked: g.value,
|
|
93
|
+
"onUpdate:checked": B[0] || (B[0] = (j) => g.value = j),
|
|
94
94
|
class: "lkt-item-crud--switch-mode-button"
|
|
95
95
|
}), null, 16, ["checked"])) : d("", !0),
|
|
96
96
|
u(l)["prev-buttons-ever"] ? s(e.$slots, "prev-buttons-ever", {
|
|
@@ -105,20 +105,20 @@ const B = (...T) => {
|
|
|
105
105
|
canDrop: e.canDrop,
|
|
106
106
|
perms: e.perms
|
|
107
107
|
}) : d("", !0),
|
|
108
|
-
$(
|
|
108
|
+
$(q(h, R({
|
|
109
109
|
ref_key: "saveButtonRef",
|
|
110
|
-
ref:
|
|
110
|
+
ref: b
|
|
111
111
|
}, e.updateButton, {
|
|
112
112
|
disabled: !e.ableToUpdate,
|
|
113
|
-
onLoading:
|
|
114
|
-
onLoaded:
|
|
115
|
-
onClick:
|
|
113
|
+
onLoading: f,
|
|
114
|
+
onLoaded: y,
|
|
115
|
+
onClick: A
|
|
116
116
|
}), {
|
|
117
117
|
default: C(() => [
|
|
118
118
|
u(l)["button-save"] ? s(e.$slots, "button-save", {
|
|
119
119
|
key: 0,
|
|
120
120
|
item: e.item,
|
|
121
|
-
editMode:
|
|
121
|
+
editMode: g.value,
|
|
122
122
|
isCreate: !1,
|
|
123
123
|
canUpdate: e.canUpdate,
|
|
124
124
|
canDrop: e.canDrop
|
|
@@ -126,22 +126,22 @@ const B = (...T) => {
|
|
|
126
126
|
]),
|
|
127
127
|
_: 3
|
|
128
128
|
}, 16, ["disabled"]), [
|
|
129
|
-
[L, e.mode === u(
|
|
129
|
+
[L, e.mode === u(S).Update && V.value]
|
|
130
130
|
]),
|
|
131
|
-
$(
|
|
131
|
+
$(q(h, R({
|
|
132
132
|
ref_key: "saveButtonRef",
|
|
133
|
-
ref:
|
|
133
|
+
ref: b
|
|
134
134
|
}, e.createButton, {
|
|
135
135
|
disabled: !e.ableToCreate,
|
|
136
|
-
onLoading:
|
|
137
|
-
onLoaded:
|
|
138
|
-
onClick:
|
|
136
|
+
onLoading: f,
|
|
137
|
+
onLoaded: y,
|
|
138
|
+
onClick: X
|
|
139
139
|
}), {
|
|
140
140
|
default: C(() => [
|
|
141
141
|
u(l)["button-save"] ? s(e.$slots, "button-save", {
|
|
142
142
|
key: 0,
|
|
143
143
|
item: e.item,
|
|
144
|
-
editMode:
|
|
144
|
+
editMode: g.value,
|
|
145
145
|
isCreate: !0,
|
|
146
146
|
canUpdate: e.canUpdate,
|
|
147
147
|
canDrop: e.canDrop
|
|
@@ -149,22 +149,22 @@ const B = (...T) => {
|
|
|
149
149
|
]),
|
|
150
150
|
_: 3
|
|
151
151
|
}, 16, ["disabled"]), [
|
|
152
|
-
[L, e.mode === u(
|
|
152
|
+
[L, e.mode === u(S).Create && V.value]
|
|
153
153
|
]),
|
|
154
|
-
$(
|
|
154
|
+
$(q(h, R({
|
|
155
155
|
ref_key: "dropButtonRef",
|
|
156
|
-
ref:
|
|
156
|
+
ref: v
|
|
157
157
|
}, e.dropButton, {
|
|
158
158
|
disabled: !e.ableToDrop,
|
|
159
|
-
onLoading:
|
|
160
|
-
onLoaded:
|
|
161
|
-
onClick:
|
|
159
|
+
onLoading: f,
|
|
160
|
+
onLoaded: y,
|
|
161
|
+
onClick: F
|
|
162
162
|
}), {
|
|
163
163
|
default: C(() => [
|
|
164
164
|
u(l)["button-drop"] ? s(e.$slots, "button-drop", {
|
|
165
165
|
key: 0,
|
|
166
166
|
item: e.item,
|
|
167
|
-
editMode:
|
|
167
|
+
editMode: g.value,
|
|
168
168
|
isCreate: !1,
|
|
169
169
|
canUpdate: e.canUpdate,
|
|
170
170
|
canDrop: e.canDrop
|
|
@@ -172,17 +172,17 @@ const B = (...T) => {
|
|
|
172
172
|
]),
|
|
173
173
|
_: 3
|
|
174
174
|
}, 16, ["disabled"]), [
|
|
175
|
-
[L,
|
|
175
|
+
[L, M.value && e.mode !== u(S).Create]
|
|
176
176
|
]),
|
|
177
177
|
u(l).buttons ? s(e.$slots, "buttons", { key: 3 }) : d("", !0)
|
|
178
|
-
], 64)) : e.grouped ? (
|
|
178
|
+
], 64)) : e.grouped ? (m(), O(h, R({
|
|
179
179
|
key: 1,
|
|
180
180
|
ref: "groupButton"
|
|
181
181
|
}, e.groupButton, { class: "lkt-item-crud-group-button" }), {
|
|
182
182
|
split: C(() => [
|
|
183
|
-
|
|
184
|
-
checked:
|
|
185
|
-
"onUpdate:checked":
|
|
183
|
+
E.value ? (m(), O(h, R({ key: 0 }, e.editModeButton, {
|
|
184
|
+
checked: g.value,
|
|
185
|
+
"onUpdate:checked": B[1] || (B[1] = (j) => g.value = j),
|
|
186
186
|
class: "lkt-item-crud--switch-mode-button"
|
|
187
187
|
}), null, 16, ["checked"])) : d("", !0),
|
|
188
188
|
u(l)["prev-buttons-ever"] ? s(e.$slots, "prev-buttons-ever", {
|
|
@@ -197,20 +197,20 @@ const B = (...T) => {
|
|
|
197
197
|
canDrop: e.canDrop,
|
|
198
198
|
perms: e.perms
|
|
199
199
|
}) : d("", !0),
|
|
200
|
-
$(
|
|
200
|
+
$(q(h, R({
|
|
201
201
|
ref_key: "saveButtonRef",
|
|
202
|
-
ref:
|
|
202
|
+
ref: b
|
|
203
203
|
}, e.updateButton, {
|
|
204
204
|
disabled: !e.ableToUpdate,
|
|
205
|
-
onLoading:
|
|
206
|
-
onLoaded:
|
|
207
|
-
onClick:
|
|
205
|
+
onLoading: f,
|
|
206
|
+
onLoaded: y,
|
|
207
|
+
onClick: A
|
|
208
208
|
}), {
|
|
209
209
|
default: C(() => [
|
|
210
210
|
u(l)["button-save"] ? s(e.$slots, "button-save", {
|
|
211
211
|
key: 0,
|
|
212
212
|
item: e.item,
|
|
213
|
-
editMode:
|
|
213
|
+
editMode: g.value,
|
|
214
214
|
isCreate: !1,
|
|
215
215
|
canUpdate: e.canUpdate,
|
|
216
216
|
canDrop: e.canDrop
|
|
@@ -218,22 +218,22 @@ const B = (...T) => {
|
|
|
218
218
|
]),
|
|
219
219
|
_: 3
|
|
220
220
|
}, 16, ["disabled"]), [
|
|
221
|
-
[L, e.mode === u(
|
|
221
|
+
[L, e.mode === u(S).Update && V.value]
|
|
222
222
|
]),
|
|
223
|
-
$(
|
|
223
|
+
$(q(h, R({
|
|
224
224
|
ref_key: "saveButtonRef",
|
|
225
|
-
ref:
|
|
225
|
+
ref: b
|
|
226
226
|
}, e.createButton, {
|
|
227
227
|
disabled: !e.ableToCreate,
|
|
228
|
-
onLoading:
|
|
229
|
-
onLoaded:
|
|
230
|
-
onClick:
|
|
228
|
+
onLoading: f,
|
|
229
|
+
onLoaded: y,
|
|
230
|
+
onClick: X
|
|
231
231
|
}), {
|
|
232
232
|
default: C(() => [
|
|
233
233
|
u(l)["button-save"] ? s(e.$slots, "button-save", {
|
|
234
234
|
key: 0,
|
|
235
235
|
item: e.item,
|
|
236
|
-
editMode:
|
|
236
|
+
editMode: g.value,
|
|
237
237
|
isCreate: !0,
|
|
238
238
|
canUpdate: e.canUpdate,
|
|
239
239
|
canDrop: e.canDrop
|
|
@@ -241,22 +241,22 @@ const B = (...T) => {
|
|
|
241
241
|
]),
|
|
242
242
|
_: 3
|
|
243
243
|
}, 16, ["disabled"]), [
|
|
244
|
-
[L, e.mode === u(
|
|
244
|
+
[L, e.mode === u(S).Create && V.value]
|
|
245
245
|
]),
|
|
246
|
-
$(
|
|
246
|
+
$(q(h, R({
|
|
247
247
|
ref_key: "dropButtonRef",
|
|
248
|
-
ref:
|
|
248
|
+
ref: v
|
|
249
249
|
}, e.dropButton, {
|
|
250
250
|
disabled: !e.ableToDrop,
|
|
251
|
-
onLoading:
|
|
252
|
-
onLoaded:
|
|
253
|
-
onClick:
|
|
251
|
+
onLoading: f,
|
|
252
|
+
onLoaded: y,
|
|
253
|
+
onClick: F
|
|
254
254
|
}), {
|
|
255
255
|
default: C(() => [
|
|
256
256
|
u(l)["button-drop"] ? s(e.$slots, "button-drop", {
|
|
257
257
|
key: 0,
|
|
258
258
|
item: e.item,
|
|
259
|
-
editMode:
|
|
259
|
+
editMode: g.value,
|
|
260
260
|
isCreate: !1,
|
|
261
261
|
canUpdate: e.canUpdate,
|
|
262
262
|
canDrop: e.canDrop
|
|
@@ -264,13 +264,13 @@ const B = (...T) => {
|
|
|
264
264
|
]),
|
|
265
265
|
_: 3
|
|
266
266
|
}, 16, ["disabled"]), [
|
|
267
|
-
[L,
|
|
267
|
+
[L, M.value && e.mode !== u(S).Create]
|
|
268
268
|
]),
|
|
269
269
|
u(l).buttons ? s(e.$slots, "buttons", { key: 3 }) : d("", !0)
|
|
270
270
|
]),
|
|
271
271
|
_: 3
|
|
272
|
-
}, 16)) : (
|
|
273
|
-
u(l)["prev-buttons-ever"] ? $((
|
|
272
|
+
}, 16)) : (m(), N(Se, { key: 2 }, [
|
|
273
|
+
u(l)["prev-buttons-ever"] ? $((m(), N("div", Ye, [
|
|
274
274
|
s(e.$slots, "prev-buttons-ever", {
|
|
275
275
|
canUpdate: e.canUpdate,
|
|
276
276
|
canDrop: e.canDrop,
|
|
@@ -279,29 +279,29 @@ const B = (...T) => {
|
|
|
279
279
|
], 512)), [
|
|
280
280
|
[L, !n.value]
|
|
281
281
|
]) : d("", !0),
|
|
282
|
-
u(l)["prev-buttons"] ? $((
|
|
282
|
+
u(l)["prev-buttons"] ? $((m(), N("div", Ze, [
|
|
283
283
|
s(e.$slots, "prev-buttons", {
|
|
284
284
|
canUpdate: e.canUpdate,
|
|
285
285
|
canDrop: e.canDrop,
|
|
286
286
|
perms: e.perms
|
|
287
287
|
})
|
|
288
288
|
], 512)), [
|
|
289
|
-
[L,
|
|
289
|
+
[L, g.value && !n.value]
|
|
290
290
|
]) : d("", !0),
|
|
291
|
-
$(
|
|
291
|
+
$(q(h, R({
|
|
292
292
|
ref_key: "saveButtonRef",
|
|
293
|
-
ref:
|
|
293
|
+
ref: b
|
|
294
294
|
}, e.updateButton, {
|
|
295
295
|
disabled: !e.ableToUpdate,
|
|
296
|
-
onLoading:
|
|
297
|
-
onLoaded:
|
|
298
|
-
onClick:
|
|
296
|
+
onLoading: f,
|
|
297
|
+
onLoaded: y,
|
|
298
|
+
onClick: A
|
|
299
299
|
}), {
|
|
300
300
|
default: C(() => [
|
|
301
301
|
u(l)["button-save"] ? s(e.$slots, "button-save", {
|
|
302
302
|
key: 0,
|
|
303
303
|
item: e.item,
|
|
304
|
-
editMode:
|
|
304
|
+
editMode: g.value,
|
|
305
305
|
isCreate: !1,
|
|
306
306
|
canUpdate: e.canUpdate,
|
|
307
307
|
canDrop: e.canDrop
|
|
@@ -309,22 +309,22 @@ const B = (...T) => {
|
|
|
309
309
|
]),
|
|
310
310
|
_: 3
|
|
311
311
|
}, 16, ["disabled"]), [
|
|
312
|
-
[L, e.mode === u(
|
|
312
|
+
[L, e.mode === u(S).Update && V.value]
|
|
313
313
|
]),
|
|
314
|
-
$(
|
|
314
|
+
$(q(h, R({
|
|
315
315
|
ref_key: "saveButtonRef",
|
|
316
|
-
ref:
|
|
316
|
+
ref: b
|
|
317
317
|
}, e.createButton, {
|
|
318
318
|
disabled: !e.ableToCreate,
|
|
319
|
-
onLoading:
|
|
320
|
-
onLoaded:
|
|
321
|
-
onClick:
|
|
319
|
+
onLoading: f,
|
|
320
|
+
onLoaded: y,
|
|
321
|
+
onClick: X
|
|
322
322
|
}), {
|
|
323
323
|
default: C(() => [
|
|
324
324
|
u(l)["button-save"] ? s(e.$slots, "button-save", {
|
|
325
325
|
key: 0,
|
|
326
326
|
item: e.item,
|
|
327
|
-
editMode:
|
|
327
|
+
editMode: g.value,
|
|
328
328
|
isCreate: !0,
|
|
329
329
|
canUpdate: e.canUpdate,
|
|
330
330
|
canDrop: !1
|
|
@@ -332,22 +332,22 @@ const B = (...T) => {
|
|
|
332
332
|
]),
|
|
333
333
|
_: 3
|
|
334
334
|
}, 16, ["disabled"]), [
|
|
335
|
-
[L, e.mode === u(
|
|
335
|
+
[L, e.mode === u(S).Create && V.value]
|
|
336
336
|
]),
|
|
337
|
-
$(
|
|
337
|
+
$(q(h, R({
|
|
338
338
|
ref_key: "dropButtonRef",
|
|
339
|
-
ref:
|
|
339
|
+
ref: v
|
|
340
340
|
}, e.dropButton, {
|
|
341
341
|
disabled: !e.ableToDrop,
|
|
342
|
-
onLoading:
|
|
343
|
-
onLoaded:
|
|
344
|
-
onClick:
|
|
342
|
+
onLoading: f,
|
|
343
|
+
onLoaded: y,
|
|
344
|
+
onClick: F
|
|
345
345
|
}), {
|
|
346
346
|
default: C(() => [
|
|
347
347
|
u(l)["button-drop"] ? s(e.$slots, "button-drop", {
|
|
348
348
|
key: 0,
|
|
349
349
|
item: e.item,
|
|
350
|
-
editMode:
|
|
350
|
+
editMode: g.value,
|
|
351
351
|
isCreate: !1,
|
|
352
352
|
canUpdate: e.canUpdate,
|
|
353
353
|
canDrop: e.canDrop
|
|
@@ -355,47 +355,48 @@ const B = (...T) => {
|
|
|
355
355
|
]),
|
|
356
356
|
_: 3
|
|
357
357
|
}, 16, ["disabled"]), [
|
|
358
|
-
[L,
|
|
358
|
+
[L, M.value && e.mode !== u(S).Create]
|
|
359
359
|
]),
|
|
360
|
-
u(l).buttons ? $((
|
|
360
|
+
u(l).buttons ? $((m(), N("div", _e, [
|
|
361
361
|
s(e.$slots, "buttons")
|
|
362
362
|
], 512)), [
|
|
363
|
-
[L,
|
|
363
|
+
[L, g.value && !n.value]
|
|
364
364
|
]) : d("", !0),
|
|
365
|
-
|
|
366
|
-
checked:
|
|
367
|
-
"onUpdate:checked":
|
|
365
|
+
E.value ? (m(), O(h, R({ key: 3 }, e.editModeButton, {
|
|
366
|
+
checked: g.value,
|
|
367
|
+
"onUpdate:checked": B[2] || (B[2] = (j) => g.value = j),
|
|
368
368
|
class: "lkt-item-crud--switch-mode-button"
|
|
369
369
|
}), null, 16, ["checked"])) : d("", !0)
|
|
370
370
|
], 64))
|
|
371
371
|
])) : d("", !0);
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
|
-
}),
|
|
374
|
+
}), xe = { class: "lkt-item-crud" }, et = {
|
|
375
375
|
key: 0,
|
|
376
376
|
class: "lkt-item-crud_header"
|
|
377
|
-
},
|
|
377
|
+
}, tt = {
|
|
378
378
|
key: 0,
|
|
379
379
|
class: "lkt-item-crud_header-slot"
|
|
380
|
-
},
|
|
380
|
+
}, at = {
|
|
381
381
|
key: 1,
|
|
382
382
|
class: "lkt-item-crud_header-title"
|
|
383
|
-
},
|
|
383
|
+
}, ot = {
|
|
384
384
|
key: 2,
|
|
385
385
|
class: "lkt-item-crud_header-slot"
|
|
386
|
-
},
|
|
386
|
+
}, ut = {
|
|
387
387
|
key: 2,
|
|
388
388
|
class: "lkt-item-crud_content"
|
|
389
|
-
},
|
|
389
|
+
}, nt = {
|
|
390
390
|
key: 0,
|
|
391
391
|
class: "lkt-grid-1"
|
|
392
|
-
},
|
|
392
|
+
}, dt = /* @__PURE__ */ we({
|
|
393
393
|
__name: "LktItemCrud",
|
|
394
|
-
props: /* @__PURE__ */
|
|
394
|
+
props: /* @__PURE__ */ Ne({
|
|
395
395
|
modelValue: {},
|
|
396
396
|
editing: { type: Boolean },
|
|
397
397
|
perms: {},
|
|
398
398
|
customData: {},
|
|
399
|
+
form: {},
|
|
399
400
|
mode: {},
|
|
400
401
|
view: {},
|
|
401
402
|
editModeButton: { type: [Object, Boolean] },
|
|
@@ -418,12 +419,13 @@ const B = (...T) => {
|
|
|
418
419
|
redirectOnCreate: { type: [String, Function] },
|
|
419
420
|
redirectOnDrop: { type: [String, Function] },
|
|
420
421
|
events: {}
|
|
421
|
-
},
|
|
422
|
+
}, Ke(Ge)),
|
|
422
423
|
emits: [
|
|
423
424
|
"update:modelValue",
|
|
424
425
|
"update:editing",
|
|
425
426
|
"update:perms",
|
|
426
427
|
"update:customData",
|
|
428
|
+
"update:form",
|
|
427
429
|
"read",
|
|
428
430
|
"create",
|
|
429
431
|
"update",
|
|
@@ -433,83 +435,83 @@ const B = (...T) => {
|
|
|
433
435
|
"error",
|
|
434
436
|
"modified-data"
|
|
435
437
|
],
|
|
436
|
-
setup(T, { expose:
|
|
437
|
-
const a = T, r =
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}),
|
|
441
|
-
|
|
442
|
-
}),
|
|
443
|
-
|
|
444
|
-
}),
|
|
445
|
-
|
|
446
|
-
}),
|
|
447
|
-
|
|
438
|
+
setup(T, { expose: ae, emit: ie }) {
|
|
439
|
+
const a = T, r = Je(), l = Re(), b = ie, v = c(!0), n = c(a.modelValue), g = c(a.customData), f = c(a.perms), y = c(a.editing), X = c(!1), A = c(!1), F = c(!1), W = c(200), I = c(new Ie(n.value, a.dataStateConfig)), M = c(!1), V = c(new Ie(a.readData)), E = c(a.mode === S.Create), ee = c(!1), e = c(!1), B = c(null), h = U(() => !E.value && Array.isArray(f.value) && f.value.includes(ke.Update)), j = U(() => !E.value && Array.isArray(f.value) && f.value.includes(ke.Drop)), se = U(() => !E.value && Array.isArray(f.value) && f.value.includes(ke.SwitchEditMode));
|
|
440
|
+
D(() => a.mode, (t) => {
|
|
441
|
+
E.value = t === S.Create;
|
|
442
|
+
}), D(() => a.perms, (t) => {
|
|
443
|
+
f.value = t;
|
|
444
|
+
}), D(f, (t) => {
|
|
445
|
+
b("update:perms", t);
|
|
446
|
+
}), D(() => a.customData, (t) => {
|
|
447
|
+
g.value = t;
|
|
448
|
+
}), D(g, (t) => {
|
|
449
|
+
b("update:customData", t);
|
|
448
450
|
});
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}, { deep: !0 }),
|
|
453
|
-
|
|
454
|
-
}, { deep: !0 }),
|
|
455
|
-
|
|
456
|
-
}, { deep: !0 }),
|
|
457
|
-
oe.value =
|
|
451
|
+
const K = c(z(a.createButton, i.defaultCreateButton)), G = c(z(a.updateButton, i.defaultUpdateButton)), H = c(z(a.dropButton, i.defaultDropButton)), oe = c(z(a.editModeButton, i.defaultEditModeButton)), pe = c(z(a.groupButton, i.defaultGroupButton));
|
|
452
|
+
D(() => a.createButton, (t) => {
|
|
453
|
+
K.value = z(t, i.defaultCreateButton);
|
|
454
|
+
}, { deep: !0 }), D(() => a.updateButton, (t) => {
|
|
455
|
+
G.value = z(t, i.defaultUpdateButton);
|
|
456
|
+
}, { deep: !0 }), D(() => a.dropButton, (t) => {
|
|
457
|
+
H.value = z(t, i.defaultDropButton);
|
|
458
|
+
}, { deep: !0 }), D(() => a.editModeButton, (t) => {
|
|
459
|
+
oe.value = z(t, i.defaultEditModeButton);
|
|
458
460
|
}, { deep: !0 });
|
|
459
461
|
const ue = async () => {
|
|
460
|
-
var t, o,
|
|
461
|
-
|
|
462
|
+
var t, o, P;
|
|
463
|
+
k("fetchItem"), v.value = !0, W.value = -1, F.value = !1, typeof ((t = a.events) == null ? void 0 : t.httpStart) == "function" && a.events.httpStart();
|
|
462
464
|
try {
|
|
463
|
-
const w = await
|
|
464
|
-
if (
|
|
465
|
-
A.value = !1,
|
|
465
|
+
const w = await We(a.readResource, a.readData);
|
|
466
|
+
if (k("fetchItem -> response", w), v.value = !1, W.value = w.httpStatus, g.value = w.custom, !w.success) {
|
|
467
|
+
A.value = !1, W.value = w.httpStatus, typeof ((o = a.events) == null ? void 0 : o.httpEnd) == "function" && a.events.httpEnd({
|
|
466
468
|
httpResponse: w
|
|
467
|
-
}),
|
|
469
|
+
}), b("error", w.httpStatus);
|
|
468
470
|
return;
|
|
469
471
|
}
|
|
470
|
-
A.value = !0, n.value = w.data,
|
|
472
|
+
A.value = !0, n.value = w.data, f.value = w.perms, I.value.increment(n.value).turnStoredIntoOriginal(), M.value = I.value.changed(), V.value.turnStoredIntoOriginal(), typeof ((P = a.events) == null ? void 0 : P.httpEnd) == "function" && a.events.httpEnd({
|
|
471
473
|
httpResponse: w
|
|
472
|
-
}),
|
|
474
|
+
}), b("read", w);
|
|
473
475
|
} catch {
|
|
474
|
-
|
|
476
|
+
v.value = !1, A.value = !1, W.value = 404, b("error", 404);
|
|
475
477
|
return;
|
|
476
478
|
}
|
|
477
479
|
};
|
|
478
|
-
|
|
479
|
-
n.value = t,
|
|
480
|
-
}, { deep: !0 }),
|
|
481
|
-
if (
|
|
482
|
-
|
|
480
|
+
D(() => a.modelValue, (t) => {
|
|
481
|
+
n.value = t, I.value.increment(t);
|
|
482
|
+
}, { deep: !0 }), D(n, (t) => {
|
|
483
|
+
if (ee.value = !0, k("item updated ->", n.value), typeof a.beforeEmitUpdate == "function") {
|
|
484
|
+
k("item updated -> has beforeEmitUpdate");
|
|
483
485
|
let o = a.beforeEmitUpdate(n.value);
|
|
484
|
-
|
|
486
|
+
k("item updated -> override with: ", o), typeof o == "object" && (n.value = o);
|
|
485
487
|
}
|
|
486
|
-
|
|
487
|
-
}, { deep: !0 }),
|
|
488
|
-
|
|
489
|
-
}),
|
|
490
|
-
|
|
491
|
-
}),
|
|
492
|
-
|
|
493
|
-
}),
|
|
494
|
-
|
|
495
|
-
}),
|
|
496
|
-
a.readResource && !
|
|
488
|
+
b("update:modelValue", n.value), k("item updated -> update dataState"), I.value.increment(t), M.value = I.value.changed(), Ve(() => ee.value = !1);
|
|
489
|
+
}, { deep: !0 }), D(f, () => b("perms", f.value)), D(M, (t) => {
|
|
490
|
+
b("modified-data", t);
|
|
491
|
+
}), D(() => a.readData, (t) => {
|
|
492
|
+
V.value.increment(t), V.value.changed() && ue();
|
|
493
|
+
}), D(() => a.editing, (t) => {
|
|
494
|
+
k("editing updated -> updating editMode", t), y.value = t;
|
|
495
|
+
}), D(y, (t) => {
|
|
496
|
+
k("editMode updated -> emit update", t), b("update:editing", t);
|
|
497
|
+
}), je(() => {
|
|
498
|
+
a.readResource && !E.value ? ue() : (E.value, A.value = !0, y.value = !0, v.value = !1, I.value.increment(n.value).turnStoredIntoOriginal(), M.value = I.value.changed());
|
|
497
499
|
});
|
|
498
|
-
const
|
|
500
|
+
const ve = (t, o) => {
|
|
499
501
|
if (o) {
|
|
500
|
-
if (
|
|
501
|
-
return
|
|
502
|
-
|
|
502
|
+
if (v.value = !1, typeof t < "u" && (W.value = t.httpStatus, !t.success))
|
|
503
|
+
return F.value = !0, b("error", t.httpStatus), !1;
|
|
504
|
+
F.value = !0;
|
|
503
505
|
}
|
|
504
506
|
return !0;
|
|
505
|
-
},
|
|
506
|
-
if (
|
|
507
|
-
if (
|
|
508
|
-
let
|
|
509
|
-
typeof o == "function" && (
|
|
510
|
-
} else
|
|
511
|
-
},
|
|
512
|
-
if (
|
|
507
|
+
}, Ce = (t, o) => {
|
|
508
|
+
if (k("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId)
|
|
509
|
+
if (k("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), typeof o < "u") {
|
|
510
|
+
let P = o;
|
|
511
|
+
typeof o == "function" && (P = o(t.autoReloadId)), r.push(P);
|
|
512
|
+
} else ge.value ? (k("doAutoReloadId -> insideModal: ", a), qe(a.modalConfig.modalName, a.modalConfig.modalKey, t.autoReloadId)) : (k("doAutoReloadId -> outsideModal"), a.readData.id = t.autoReloadId, k("doAutoReloadId -> turning off create mode"), E.value = !1, ue());
|
|
513
|
+
}, fe = (t, o) => {
|
|
514
|
+
if (k("onCreate"), !ve(o, K.value.resource)) {
|
|
513
515
|
a.notificationType === J.Toast && _({
|
|
514
516
|
text: i.defaultCreateErrorText,
|
|
515
517
|
details: i.defaultCreateErrorDetails,
|
|
@@ -518,14 +520,14 @@ const B = (...T) => {
|
|
|
518
520
|
});
|
|
519
521
|
return;
|
|
520
522
|
}
|
|
521
|
-
|
|
523
|
+
e.value = !0, k("onCreate -> turn stored data into original"), I.value.increment(n.value).turnStoredIntoOriginal(), a.notificationType === J.Toast && _({
|
|
522
524
|
text: i.defaultCreateSuccessText,
|
|
523
525
|
details: i.defaultCreateSuccessDetails,
|
|
524
526
|
icon: i.defaultCreateSuccessIcon,
|
|
525
527
|
positionX: Z.Right
|
|
526
|
-
}),
|
|
527
|
-
},
|
|
528
|
-
if (
|
|
528
|
+
}), Ce(o, a.redirectOnCreate), k("onCreate -> beforeEmitCreate"), b("create", o);
|
|
529
|
+
}, ce = (t, o) => {
|
|
530
|
+
if (k("onUpdate"), !ve(o, G.value.resource)) {
|
|
529
531
|
a.notificationType === J.Toast && _({
|
|
530
532
|
text: i.defaultUpdateErrorText,
|
|
531
533
|
details: i.defaultUpdateErrorDetails,
|
|
@@ -534,14 +536,14 @@ const B = (...T) => {
|
|
|
534
536
|
});
|
|
535
537
|
return;
|
|
536
538
|
}
|
|
537
|
-
|
|
539
|
+
k("onUpdate -> turn stored data into original"), I.value.turnStoredIntoOriginal(), a.notificationType === J.Toast && _({
|
|
538
540
|
text: i.defaultUpdateSuccessText,
|
|
539
541
|
details: i.defaultUpdateSuccessDetails,
|
|
540
542
|
icon: i.defaultUpdateSuccessIcon,
|
|
541
543
|
positionX: Z.Right
|
|
542
|
-
}),
|
|
543
|
-
},
|
|
544
|
-
if (
|
|
544
|
+
}), Ce(o), b("update", o);
|
|
545
|
+
}, me = (t, o) => {
|
|
546
|
+
if (k("onDrop"), !ve(o, H.value.resource)) {
|
|
545
547
|
a.notificationType === J.Toast && _({
|
|
546
548
|
text: i.defaultDropErrorText,
|
|
547
549
|
details: i.defaultDropErrorDetails,
|
|
@@ -555,116 +557,116 @@ const B = (...T) => {
|
|
|
555
557
|
details: i.defaultDropSuccessDetails,
|
|
556
558
|
icon: i.defaultDropSuccessIcon,
|
|
557
559
|
positionX: Z.Right
|
|
558
|
-
}),
|
|
559
|
-
let
|
|
560
|
-
typeof a.redirectOnDrop == "function" && (
|
|
560
|
+
}), b("drop", o), a.view === Te.Modal && (k("onDrop -> close modal"), He(a.modalConfig.modalName, a.modalConfig.modalKey)), typeof a.redirectOnDrop < "u") {
|
|
561
|
+
let P = a.redirectOnDrop;
|
|
562
|
+
typeof a.redirectOnDrop == "function" && (P = a.redirectOnDrop()), r.push(P);
|
|
561
563
|
}
|
|
562
564
|
};
|
|
563
|
-
|
|
565
|
+
ae({
|
|
564
566
|
doDrop: () => {
|
|
565
|
-
|
|
567
|
+
B.value && B.value.doDrop();
|
|
566
568
|
},
|
|
567
569
|
doRefresh: ue,
|
|
568
570
|
doSave: () => {
|
|
569
|
-
|
|
571
|
+
B.value && B.value.doSave();
|
|
570
572
|
},
|
|
571
573
|
turnStoredDataIntoOriginal: () => {
|
|
572
|
-
|
|
574
|
+
I.value.increment(n.value).turnStoredIntoOriginal();
|
|
573
575
|
},
|
|
574
|
-
hasModifiedData: () =>
|
|
576
|
+
hasModifiedData: () => I.value.changed()
|
|
575
577
|
});
|
|
576
|
-
const
|
|
578
|
+
const Ae = U(() => {
|
|
577
579
|
var t;
|
|
578
|
-
return
|
|
579
|
-
}),
|
|
580
|
+
return I.value.changed() ? (t = a.modalConfig) == null ? void 0 : t.closeConfirm : "";
|
|
581
|
+
}), Ee = (t) => {
|
|
580
582
|
var o;
|
|
581
583
|
if (typeof ((o = a.modalConfig) == null ? void 0 : o.beforeClose) == "function")
|
|
582
584
|
return a.modalConfig.beforeClose({
|
|
583
585
|
...t,
|
|
584
|
-
itemCreated:
|
|
586
|
+
itemCreated: e.value
|
|
585
587
|
});
|
|
586
|
-
},
|
|
588
|
+
}, be = U(() => a.title.startsWith("__:") ? String(ze(a.title.substring(3))) : a.title), $e = U(() => v.value ? !1 : be.value.length > 0 || !!l["post-title"]), ge = U(() => a.view === Te.Modal), Ue = U(() => ge.value ? "lkt-modal" : "section"), ne = U(() => {
|
|
587
589
|
var t, o;
|
|
588
|
-
return a.mode !==
|
|
590
|
+
return a.mode !== S.Update || !h.value || !a.enabledSaveWithoutChanges && !M.value || (console.log("ableToUpdate", X.value), Be.value && !X.value) ? !1 : typeof ((t = G.value) == null ? void 0 : t.disabled) == "function" ? !G.value.disabled({
|
|
589
591
|
prop: n.value
|
|
590
|
-
}) : typeof ((o =
|
|
591
|
-
}), de =
|
|
592
|
+
}) : typeof ((o = G.value) == null ? void 0 : o.disabled) == "boolean" ? !G.value.disabled : !0;
|
|
593
|
+
}), de = U(() => {
|
|
592
594
|
var t, o;
|
|
593
|
-
return a.mode !==
|
|
595
|
+
return a.mode !== S.Create || !a.enabledSaveWithoutChanges && !M.value || Be.value && !X.value ? !1 : typeof ((t = K.value) == null ? void 0 : t.disabled) == "function" ? !K.value.disabled({
|
|
594
596
|
prop: n.value
|
|
595
|
-
}) : typeof ((o =
|
|
596
|
-
}),
|
|
597
|
+
}) : typeof ((o = K.value) == null ? void 0 : o.disabled) == "boolean" ? !K.value.disabled : !0;
|
|
598
|
+
}), ye = U(() => {
|
|
597
599
|
var t, o;
|
|
598
|
-
return
|
|
600
|
+
return j.value ? typeof ((t = H.value) == null ? void 0 : t.disabled) == "function" ? !H.value.disabled({
|
|
599
601
|
prop: n.value
|
|
600
|
-
}) : typeof ((o =
|
|
601
|
-
}),
|
|
602
|
+
}) : typeof ((o = H.value) == null ? void 0 : o.disabled) == "boolean" ? !H.value.disabled : !0 : !1;
|
|
603
|
+
}), Le = U(() => Ue.value === "lkt-modal" ? {
|
|
602
604
|
title: a.title,
|
|
603
605
|
item: n.value,
|
|
604
606
|
...a.modalConfig,
|
|
605
|
-
beforeClose:
|
|
606
|
-
closeConfirm:
|
|
607
|
+
beforeClose: Ee,
|
|
608
|
+
closeConfirm: Ae.value,
|
|
607
609
|
headerActionsButton: a.groupButton !== !1 ? {
|
|
608
610
|
dot: de.value || ne.value
|
|
609
611
|
} : !1
|
|
610
|
-
} : {});
|
|
612
|
+
} : {}), Be = U(() => typeof a.form == "object" && Object.keys(a.form).length > 0);
|
|
611
613
|
return (t, o) => {
|
|
612
|
-
const
|
|
613
|
-
return
|
|
614
|
+
const P = le("lkt-http-info"), w = le("lkt-form"), Oe = le("lkt-loader");
|
|
615
|
+
return m(), O(Pe(Ue.value), R(Le.value, { class: "lkt-item-crud" }), re({
|
|
614
616
|
default: C(() => [
|
|
615
|
-
|
|
616
|
-
!
|
|
617
|
-
u(l)["pre-title"] ? (
|
|
617
|
+
Xe("article", xe, [
|
|
618
|
+
!ge.value && $e.value ? (m(), N("header", et, [
|
|
619
|
+
u(l)["pre-title"] ? (m(), N("div", tt, [
|
|
618
620
|
s(t.$slots, "pre-title", {
|
|
619
621
|
item: n.value,
|
|
620
|
-
loading:
|
|
622
|
+
loading: v.value
|
|
621
623
|
})
|
|
622
624
|
])) : d("", !0),
|
|
623
|
-
|
|
624
|
-
u(l)["post-title"] ? (
|
|
625
|
+
be.value.length > 0 ? (m(), N("h1", at, Fe(be.value), 1)) : d("", !0),
|
|
626
|
+
u(l)["post-title"] ? (m(), N("div", ot, [
|
|
625
627
|
s(t.$slots, "post-title", {
|
|
626
628
|
item: n.value,
|
|
627
|
-
loading:
|
|
629
|
+
loading: v.value
|
|
628
630
|
})
|
|
629
631
|
])) : d("", !0)
|
|
630
632
|
])) : d("", !0),
|
|
631
|
-
t.buttonNavPosition === u(
|
|
633
|
+
t.buttonNavPosition === u(De).Top && (t.groupButton === !1 || !t.groupButtonAsModalActions) ? (m(), O(he, {
|
|
632
634
|
key: 1,
|
|
633
635
|
ref_key: "buttonNav",
|
|
634
|
-
ref:
|
|
635
|
-
loading:
|
|
636
|
-
"onUpdate:loading": o[2] || (o[2] = (
|
|
637
|
-
editing:
|
|
638
|
-
"onUpdate:editing": o[3] || (o[3] = (
|
|
636
|
+
ref: B,
|
|
637
|
+
loading: v.value,
|
|
638
|
+
"onUpdate:loading": o[2] || (o[2] = (p) => v.value = p),
|
|
639
|
+
editing: y.value,
|
|
640
|
+
"onUpdate:editing": o[3] || (o[3] = (p) => y.value = p),
|
|
639
641
|
item: n.value,
|
|
640
642
|
mode: t.mode,
|
|
641
643
|
view: t.view,
|
|
642
644
|
grouped: t.groupButton !== !1,
|
|
643
645
|
"button-nav-visibility": t.buttonNavVisibility,
|
|
644
|
-
"create-button":
|
|
645
|
-
"update-button":
|
|
646
|
-
"drop-button":
|
|
646
|
+
"create-button": K.value,
|
|
647
|
+
"update-button": G.value,
|
|
648
|
+
"drop-button": H.value,
|
|
647
649
|
"edit-mode-button": oe.value,
|
|
648
|
-
"group-button":
|
|
649
|
-
"data-changed":
|
|
650
|
+
"group-button": pe.value,
|
|
651
|
+
"data-changed": M.value,
|
|
650
652
|
"http-success-read": A.value,
|
|
651
|
-
"can-update":
|
|
652
|
-
"can-drop":
|
|
653
|
-
"can-switch-edit-mode":
|
|
653
|
+
"can-update": h.value,
|
|
654
|
+
"can-drop": j.value,
|
|
655
|
+
"can-switch-edit-mode": se.value,
|
|
654
656
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
655
657
|
"able-to-create": de.value,
|
|
656
658
|
"able-to-update": ne.value,
|
|
657
|
-
"able-to-drop":
|
|
658
|
-
perms:
|
|
659
|
-
onCreate:
|
|
660
|
-
onSave:
|
|
661
|
-
onDrop:
|
|
659
|
+
"able-to-drop": ye.value,
|
|
660
|
+
perms: f.value,
|
|
661
|
+
onCreate: fe,
|
|
662
|
+
onSave: ce,
|
|
663
|
+
onDrop: me
|
|
662
664
|
}, re({ _: 2 }, [
|
|
663
665
|
u(l)["prev-buttons-ever"] ? {
|
|
664
666
|
name: "prev-buttons-ever",
|
|
665
|
-
fn: C(({ canUpdate:
|
|
667
|
+
fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
|
|
666
668
|
s(t.$slots, "prev-buttons-ever", {
|
|
667
|
-
canUpdate:
|
|
669
|
+
canUpdate: p,
|
|
668
670
|
canDrop: Q,
|
|
669
671
|
perms: Y
|
|
670
672
|
})
|
|
@@ -673,9 +675,9 @@ const B = (...T) => {
|
|
|
673
675
|
} : void 0,
|
|
674
676
|
u(l)["prev-buttons"] ? {
|
|
675
677
|
name: "prev-buttons",
|
|
676
|
-
fn: C(({ canUpdate:
|
|
678
|
+
fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
|
|
677
679
|
s(t.$slots, "prev-buttons", {
|
|
678
|
-
canUpdate:
|
|
680
|
+
canUpdate: p,
|
|
679
681
|
canDrop: Q,
|
|
680
682
|
perms: Y
|
|
681
683
|
})
|
|
@@ -683,63 +685,72 @@ const B = (...T) => {
|
|
|
683
685
|
key: "1"
|
|
684
686
|
} : void 0
|
|
685
687
|
]), 1032, ["loading", "editing", "item", "mode", "view", "grouped", "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", "group-button-as-modal-actions", "able-to-create", "able-to-update", "able-to-drop", "perms"])) : d("", !0),
|
|
686
|
-
|
|
687
|
-
A.value ? (
|
|
688
|
-
|
|
688
|
+
v.value ? d("", !0) : (m(), N("div", ut, [
|
|
689
|
+
A.value ? (m(), N("div", nt, [
|
|
690
|
+
F.value && t.notificationType === u(J).Inline ? (m(), O(P, {
|
|
689
691
|
key: 0,
|
|
690
|
-
code:
|
|
691
|
-
palette:
|
|
692
|
+
code: W.value,
|
|
693
|
+
palette: W.value === 200 ? "success" : "danger",
|
|
692
694
|
quick: "",
|
|
693
695
|
"can-close": "",
|
|
694
|
-
onClose: o[4] || (o[4] = (
|
|
696
|
+
onClose: o[4] || (o[4] = (p) => F.value = !1)
|
|
695
697
|
}, null, 8, ["code", "palette"])) : d("", !0),
|
|
696
|
-
|
|
698
|
+
Be.value ? (m(), O(w, {
|
|
699
|
+
key: 1,
|
|
700
|
+
modelValue: n.value,
|
|
701
|
+
"onUpdate:modelValue": o[5] || (o[5] = (p) => n.value = p),
|
|
702
|
+
form: t.form,
|
|
703
|
+
"onUpdate:form": o[6] || (o[6] = (p) => t.form = p),
|
|
704
|
+
valid: X.value,
|
|
705
|
+
"onUpdate:valid": o[7] || (o[7] = (p) => X.value = p)
|
|
706
|
+
}, null, 8, ["modelValue", "form", "valid"])) : s(t.$slots, "item", {
|
|
707
|
+
key: 2,
|
|
697
708
|
item: n.value,
|
|
698
|
-
loading:
|
|
699
|
-
editMode:
|
|
700
|
-
isCreate:
|
|
701
|
-
canUpdate:
|
|
702
|
-
canDrop:
|
|
703
|
-
itemBeingEdited:
|
|
704
|
-
perms:
|
|
709
|
+
loading: v.value,
|
|
710
|
+
editMode: y.value,
|
|
711
|
+
isCreate: E.value,
|
|
712
|
+
canUpdate: h.value,
|
|
713
|
+
canDrop: j.value,
|
|
714
|
+
itemBeingEdited: ee.value,
|
|
715
|
+
perms: f.value
|
|
705
716
|
})
|
|
706
|
-
])) : t.notificationType === u(J).Inline ? (
|
|
717
|
+
])) : t.notificationType === u(J).Inline ? (m(), O(P, {
|
|
707
718
|
key: 1,
|
|
708
|
-
code:
|
|
719
|
+
code: W.value
|
|
709
720
|
}, null, 8, ["code"])) : d("", !0)
|
|
710
721
|
])),
|
|
711
|
-
|
|
712
|
-
t.buttonNavPosition === u(
|
|
722
|
+
v.value ? (m(), O(Oe, { key: 3 })) : d("", !0),
|
|
723
|
+
t.buttonNavPosition === u(De).Bottom && (t.groupButton === !1 || !t.groupButtonAsModalActions) ? (m(), O(he, {
|
|
713
724
|
key: 4,
|
|
714
725
|
ref_key: "buttonNav",
|
|
715
|
-
ref:
|
|
716
|
-
loading:
|
|
717
|
-
"onUpdate:loading": o[
|
|
718
|
-
editing:
|
|
719
|
-
"onUpdate:editing": o[
|
|
726
|
+
ref: B,
|
|
727
|
+
loading: v.value,
|
|
728
|
+
"onUpdate:loading": o[8] || (o[8] = (p) => v.value = p),
|
|
729
|
+
editing: y.value,
|
|
730
|
+
"onUpdate:editing": o[9] || (o[9] = (p) => y.value = p),
|
|
720
731
|
item: n.value,
|
|
721
732
|
mode: t.mode,
|
|
722
733
|
view: t.view,
|
|
723
734
|
grouped: t.groupButton !== !1,
|
|
724
735
|
"button-nav-visibility": t.buttonNavVisibility,
|
|
725
|
-
"create-button":
|
|
726
|
-
"update-button":
|
|
727
|
-
"drop-button":
|
|
736
|
+
"create-button": K.value,
|
|
737
|
+
"update-button": G.value,
|
|
738
|
+
"drop-button": H.value,
|
|
728
739
|
"edit-mode-button": oe.value,
|
|
729
|
-
"group-button":
|
|
730
|
-
"data-changed":
|
|
740
|
+
"group-button": pe.value,
|
|
741
|
+
"data-changed": M.value,
|
|
731
742
|
"http-success-read": A.value,
|
|
732
|
-
"can-update":
|
|
733
|
-
"can-drop":
|
|
734
|
-
"can-switch-edit-mode":
|
|
743
|
+
"can-update": h.value,
|
|
744
|
+
"can-drop": j.value,
|
|
745
|
+
"can-switch-edit-mode": se.value,
|
|
735
746
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
736
747
|
"able-to-create": de.value,
|
|
737
748
|
"able-to-update": ne.value,
|
|
738
|
-
"able-to-drop":
|
|
739
|
-
perms:
|
|
740
|
-
onCreate:
|
|
741
|
-
onSave:
|
|
742
|
-
onDrop:
|
|
749
|
+
"able-to-drop": ye.value,
|
|
750
|
+
perms: f.value,
|
|
751
|
+
onCreate: fe,
|
|
752
|
+
onSave: ce,
|
|
753
|
+
onDrop: me
|
|
743
754
|
}, re({ _: 2 }, [
|
|
744
755
|
u(l)["prev-buttons-ever"] ? {
|
|
745
756
|
name: "prev-buttons-ever",
|
|
@@ -763,43 +774,43 @@ const B = (...T) => {
|
|
|
763
774
|
t.groupButton !== !1 && t.groupButtonAsModalActions ? {
|
|
764
775
|
name: "header-actions",
|
|
765
776
|
fn: C(() => [
|
|
766
|
-
t.buttonNavPosition === u(
|
|
777
|
+
t.buttonNavPosition === u(De).Top ? (m(), O(he, {
|
|
767
778
|
key: 0,
|
|
768
779
|
ref_key: "buttonNav",
|
|
769
|
-
ref:
|
|
770
|
-
loading:
|
|
771
|
-
"onUpdate:loading": o[0] || (o[0] = (
|
|
772
|
-
editing:
|
|
773
|
-
"onUpdate:editing": o[1] || (o[1] = (
|
|
780
|
+
ref: B,
|
|
781
|
+
loading: v.value,
|
|
782
|
+
"onUpdate:loading": o[0] || (o[0] = (p) => v.value = p),
|
|
783
|
+
editing: y.value,
|
|
784
|
+
"onUpdate:editing": o[1] || (o[1] = (p) => y.value = p),
|
|
774
785
|
item: n.value,
|
|
775
786
|
mode: t.mode,
|
|
776
787
|
view: t.view,
|
|
777
788
|
grouped: !0,
|
|
778
789
|
"button-nav-visibility": t.buttonNavVisibility,
|
|
779
|
-
"create-button":
|
|
780
|
-
"update-button":
|
|
781
|
-
"drop-button":
|
|
790
|
+
"create-button": K.value,
|
|
791
|
+
"update-button": G.value,
|
|
792
|
+
"drop-button": H.value,
|
|
782
793
|
"edit-mode-button": oe.value,
|
|
783
|
-
"group-button":
|
|
784
|
-
"data-changed":
|
|
794
|
+
"group-button": pe.value,
|
|
795
|
+
"data-changed": M.value,
|
|
785
796
|
"http-success-read": A.value,
|
|
786
|
-
"can-update":
|
|
787
|
-
"can-drop":
|
|
788
|
-
"can-switch-edit-mode":
|
|
797
|
+
"can-update": h.value,
|
|
798
|
+
"can-drop": j.value,
|
|
799
|
+
"can-switch-edit-mode": se.value,
|
|
789
800
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
790
801
|
"able-to-create": de.value,
|
|
791
802
|
"able-to-update": ne.value,
|
|
792
|
-
"able-to-drop":
|
|
793
|
-
perms:
|
|
794
|
-
onCreate:
|
|
795
|
-
onSave:
|
|
796
|
-
onDrop:
|
|
803
|
+
"able-to-drop": ye.value,
|
|
804
|
+
perms: f.value,
|
|
805
|
+
onCreate: fe,
|
|
806
|
+
onSave: ce,
|
|
807
|
+
onDrop: me
|
|
797
808
|
}, re({ _: 2 }, [
|
|
798
809
|
u(l)["prev-buttons-ever"] ? {
|
|
799
810
|
name: "prev-buttons-ever",
|
|
800
|
-
fn: C(({ canUpdate:
|
|
811
|
+
fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
|
|
801
812
|
s(t.$slots, "prev-buttons-ever", {
|
|
802
|
-
canUpdate:
|
|
813
|
+
canUpdate: p,
|
|
803
814
|
canDrop: Q,
|
|
804
815
|
perms: Y
|
|
805
816
|
})
|
|
@@ -808,9 +819,9 @@ const B = (...T) => {
|
|
|
808
819
|
} : void 0,
|
|
809
820
|
u(l)["prev-buttons"] ? {
|
|
810
821
|
name: "prev-buttons",
|
|
811
|
-
fn: C(({ canUpdate:
|
|
822
|
+
fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
|
|
812
823
|
s(t.$slots, "prev-buttons", {
|
|
813
|
-
canUpdate:
|
|
824
|
+
canUpdate: p,
|
|
814
825
|
canDrop: Q,
|
|
815
826
|
perms: Y
|
|
816
827
|
})
|
|
@@ -824,18 +835,18 @@ const B = (...T) => {
|
|
|
824
835
|
]), 1040);
|
|
825
836
|
};
|
|
826
837
|
}
|
|
827
|
-
}),
|
|
828
|
-
install: (T,
|
|
829
|
-
T.component("lkt-item-crud") === void 0 && T.component("lkt-item-crud",
|
|
838
|
+
}), yt = {
|
|
839
|
+
install: (T, ae = {}) => {
|
|
840
|
+
T.component("lkt-item-crud") === void 0 && T.component("lkt-item-crud", dt);
|
|
830
841
|
}
|
|
831
|
-
},
|
|
842
|
+
}, Bt = (T) => {
|
|
832
843
|
x.defaultSaveIcon = T;
|
|
833
|
-
},
|
|
844
|
+
}, kt = (T) => {
|
|
834
845
|
x.defaultDropIcon = T;
|
|
835
846
|
};
|
|
836
847
|
export {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
848
|
+
gt as debugLktItemCrud,
|
|
849
|
+
yt as default,
|
|
850
|
+
kt as setItemCrudDefaultDropIcon,
|
|
851
|
+
Bt as setItemCrudDefaultSaveIcon
|
|
841
852
|
};
|
|
@@ -21,7 +21,7 @@ declare var __VLS_17: {
|
|
|
21
21
|
canUpdate: boolean | undefined;
|
|
22
22
|
canDrop: boolean | undefined;
|
|
23
23
|
perms: string[] | undefined;
|
|
24
|
-
},
|
|
24
|
+
}, __VLS_52: {
|
|
25
25
|
item: LktObject;
|
|
26
26
|
loading: false;
|
|
27
27
|
editMode: boolean;
|
|
@@ -30,7 +30,7 @@ declare var __VLS_17: {
|
|
|
30
30
|
canDrop: boolean;
|
|
31
31
|
itemBeingEdited: boolean;
|
|
32
32
|
perms: string[];
|
|
33
|
-
},
|
|
33
|
+
}, __VLS_73: {}, __VLS_75: {};
|
|
34
34
|
type __VLS_Slots = {} & {
|
|
35
35
|
'prev-buttons-ever'?: (props: typeof __VLS_17) => any;
|
|
36
36
|
} & {
|
|
@@ -44,11 +44,11 @@ type __VLS_Slots = {} & {
|
|
|
44
44
|
} & {
|
|
45
45
|
'prev-buttons'?: (props: typeof __VLS_38) => any;
|
|
46
46
|
} & {
|
|
47
|
-
item?: (props: typeof
|
|
47
|
+
item?: (props: typeof __VLS_52) => any;
|
|
48
48
|
} & {
|
|
49
|
-
'prev-buttons-ever'?: (props: typeof
|
|
49
|
+
'prev-buttons-ever'?: (props: typeof __VLS_73) => any;
|
|
50
50
|
} & {
|
|
51
|
-
'prev-buttons'?: (props: typeof
|
|
51
|
+
'prev-buttons'?: (props: typeof __VLS_75) => any;
|
|
52
52
|
};
|
|
53
53
|
declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
54
54
|
doDrop: () => void;
|
|
@@ -67,6 +67,7 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
|
67
67
|
"update:modelValue": (...args: any[]) => void;
|
|
68
68
|
"update:perms": (...args: any[]) => void;
|
|
69
69
|
"update:customData": (...args: any[]) => void;
|
|
70
|
+
"update:form": (...args: any[]) => void;
|
|
70
71
|
"before-save": (...args: any[]) => void;
|
|
71
72
|
"modified-data": (...args: any[]) => void;
|
|
72
73
|
}, string, import("vue").PublicProps, Readonly<ItemCrudConfig> & Readonly<{
|
|
@@ -80,10 +81,12 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
|
80
81
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
81
82
|
"onUpdate:perms"?: ((...args: any[]) => any) | undefined;
|
|
82
83
|
"onUpdate:customData"?: ((...args: any[]) => any) | undefined;
|
|
84
|
+
"onUpdate:form"?: ((...args: any[]) => any) | undefined;
|
|
83
85
|
"onBefore-save"?: ((...args: any[]) => any) | undefined;
|
|
84
86
|
"onModified-data"?: ((...args: any[]) => any) | undefined;
|
|
85
87
|
}>, {
|
|
86
88
|
view: ItemCrudView;
|
|
89
|
+
form: import("lkt-vue-kernel").FormConfig;
|
|
87
90
|
title: string;
|
|
88
91
|
mode: ItemCrudMode;
|
|
89
92
|
modelValue: LktObject;
|
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
'update:editing',
|
|
41
41
|
'update:perms',
|
|
42
42
|
'update:customData',
|
|
43
|
+
'update:form',
|
|
43
44
|
'read',
|
|
44
45
|
'create',
|
|
45
46
|
'update',
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
custom = ref(props.customData),
|
|
56
57
|
permissions = ref(props.perms),
|
|
57
58
|
editMode = ref(props.editing),
|
|
59
|
+
validForm = ref(false),
|
|
58
60
|
httpSuccessRead = ref(false),
|
|
59
61
|
showStoreMessage = ref(false),
|
|
60
62
|
httpStatus = ref(200),
|
|
@@ -392,6 +394,8 @@
|
|
|
392
394
|
ableToUpdate = computed(() => {
|
|
393
395
|
if (props.mode !== ItemCrudMode.Update || !canUpdate.value) return false;
|
|
394
396
|
if (!props.enabledSaveWithoutChanges && !dataChanged.value) return false;
|
|
397
|
+
console.log('ableToUpdate', validForm.value);
|
|
398
|
+
if (computedHasForm.value && !validForm.value) return false;
|
|
395
399
|
|
|
396
400
|
if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled({
|
|
397
401
|
prop: item.value
|
|
@@ -403,6 +407,7 @@
|
|
|
403
407
|
ableToCreate = computed(() => {
|
|
404
408
|
if (props.mode !== ItemCrudMode.Create) return false;
|
|
405
409
|
if (!props.enabledSaveWithoutChanges && !dataChanged.value) return false;
|
|
410
|
+
if (computedHasForm.value && !validForm.value) return false;
|
|
406
411
|
|
|
407
412
|
if (typeof safeCreateButton.value?.disabled === 'function') return !safeCreateButton.value.disabled({
|
|
408
413
|
prop: item.value
|
|
@@ -440,6 +445,9 @@
|
|
|
440
445
|
};
|
|
441
446
|
}
|
|
442
447
|
return {};
|
|
448
|
+
}),
|
|
449
|
+
computedHasForm = computed(() => {
|
|
450
|
+
return typeof props.form === 'object' && Object.keys(props.form).length > 0;
|
|
443
451
|
})
|
|
444
452
|
</script>
|
|
445
453
|
|
|
@@ -561,16 +569,26 @@
|
|
|
561
569
|
quick
|
|
562
570
|
can-close
|
|
563
571
|
v-on:close="showStoreMessage = false" />
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
:can-drop="canDrop"
|
|
571
|
-
:item-being-edited="itemBeingEdited"
|
|
572
|
-
:perms="permissions"
|
|
572
|
+
|
|
573
|
+
<lkt-form
|
|
574
|
+
v-if="computedHasForm"
|
|
575
|
+
v-model="item"
|
|
576
|
+
v-model:form="form"
|
|
577
|
+
v-model:valid="validForm"
|
|
573
578
|
/>
|
|
579
|
+
|
|
580
|
+
<template v-else>
|
|
581
|
+
<slot name="item"
|
|
582
|
+
:item="item"
|
|
583
|
+
:loading="isLoading"
|
|
584
|
+
:edit-mode="editMode"
|
|
585
|
+
:is-create="createMode"
|
|
586
|
+
:can-update="canUpdate"
|
|
587
|
+
:can-drop="canDrop"
|
|
588
|
+
:item-being-edited="itemBeingEdited"
|
|
589
|
+
:perms="permissions"
|
|
590
|
+
/>
|
|
591
|
+
</template>
|
|
574
592
|
</div>
|
|
575
593
|
<lkt-http-info :code="httpStatus" v-else-if="notificationType === NotificationType.Inline" />
|
|
576
594
|
</div>
|