lkt-item-crud 2.0.20 → 2.0.21
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 +4 -4
- package/dist/build.js +286 -284
- package/dist/lib-components/LktItemCrud.vue.d.ts +2 -1
- package/package.json +1 -1
- package/src/lib-components/LktItemCrud.vue +16 -4
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
1
|
+
declare function It(B?: boolean): void;
|
|
2
|
+
declare namespace Rt {
|
|
3
3
|
function install(B: any, K?: {}): void;
|
|
4
4
|
}
|
|
5
|
+
declare function Ot(B: any): void;
|
|
5
6
|
declare function At(B: any): void;
|
|
6
|
-
|
|
7
|
-
export { Tt as debugLktItemCrud, It as default, At as setItemCrudDefaultDropIcon, Rt as setItemCrudDefaultSaveIcon };
|
|
7
|
+
export { It as debugLktItemCrud, Rt as default, Ot as setItemCrudDefaultDropIcon, At 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 { ModificationView as
|
|
5
|
-
import { closeModal as
|
|
1
|
+
import { defineComponent as Fe, ref as d, watch as f, useSlots as Xe, computed as y, resolveComponent as ye, createElementBlock as J, createCommentVNode as p, openBlock as v, createBlock as A, Fragment as $e, renderSlot as U, withDirectives as F, mergeProps as S, normalizeProps as Ve, unref as n, createVNode as Y, vShow as X, withCtx as _, mergeDefaults as ze, nextTick as Qe, onMounted as Ye, resolveDynamicComponent as Ze, createSlots as ge, createElementVNode as _e, toDisplayString as xe } from "vue";
|
|
2
|
+
import { httpCall as et } from "lkt-http-client";
|
|
3
|
+
import { DataState as ke } from "lkt-data-state";
|
|
4
|
+
import { ModificationView as g, ItemCrudMode as T, ItemCrudButtonNavVisibility as je, ButtonType as Te, TablePermission as Ie, ensureButtonConfig as Z, LktSettings as s, ItemCrudView as Pe, ItemCrudButtonNavPosition as Re, NotificationType as ee, getDefaultValues as tt, ItemCrud as ot, ToastPositionX as de } from "lkt-vue-kernel";
|
|
5
|
+
import { closeModal as at, updateModalKey as it } from "lkt-modal";
|
|
6
6
|
import { __ as nt } from "lkt-i18n";
|
|
7
|
-
import { openToast as
|
|
8
|
-
import { useRouter as
|
|
7
|
+
import { openToast as re } from "lkt-toast";
|
|
8
|
+
import { useRouter as ut } from "vue-router";
|
|
9
9
|
const ve = class ve {
|
|
10
10
|
};
|
|
11
11
|
ve.debugEnabled = !1, ve.defaultSaveIcon = "", ve.defaultDropIcon = "";
|
|
12
|
-
let
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
}, ut = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "lkt-item-crud-buttons"
|
|
12
|
+
let se = ve;
|
|
13
|
+
const D = (...B) => {
|
|
14
|
+
se.debugEnabled && console.info("[LktItemCrud] ", ...B);
|
|
15
|
+
}, It = (B = !0) => {
|
|
16
|
+
se.debugEnabled = B;
|
|
20
17
|
}, lt = {
|
|
21
18
|
key: 0,
|
|
22
19
|
class: "lkt-item-crud-buttons"
|
|
23
20
|
}, dt = {
|
|
24
|
-
key:
|
|
21
|
+
key: 0,
|
|
25
22
|
class: "lkt-item-crud-buttons"
|
|
26
23
|
}, rt = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "lkt-item-crud-buttons"
|
|
26
|
+
}, st = {
|
|
27
27
|
key: 2,
|
|
28
28
|
class: "lkt-item-crud-buttons"
|
|
29
|
-
},
|
|
29
|
+
}, Ae = /* @__PURE__ */ Fe({
|
|
30
30
|
__name: "ButtonNav",
|
|
31
31
|
props: {
|
|
32
32
|
item: { default: () => ({}) },
|
|
@@ -65,23 +65,23 @@ const C = (...B) => {
|
|
|
65
65
|
"drop"
|
|
66
66
|
],
|
|
67
67
|
setup(B, { expose: K, emit: te }) {
|
|
68
|
-
const o = te,
|
|
69
|
-
f(() =>
|
|
70
|
-
const c =
|
|
71
|
-
f(() =>
|
|
72
|
-
const O = d(
|
|
73
|
-
f(() =>
|
|
68
|
+
const o = te, i = B, C = d(i.pickedModificationView);
|
|
69
|
+
f(() => i.pickedModificationView, (t) => C.value = t), f(C, (t) => o("update:pickedModificationView", t));
|
|
70
|
+
const c = Xe(), r = d(null), u = d(null), m = d(i.loading);
|
|
71
|
+
f(() => i.loading, (t) => m.value = t), f(m, (t) => o("update:loading", t));
|
|
72
|
+
const O = d(i.editing);
|
|
73
|
+
f(() => i.editing, (t) => O.value = t), f(O, (t) => o("update:editing", t));
|
|
74
74
|
const b = () => {
|
|
75
75
|
m.value = !0;
|
|
76
|
-
},
|
|
76
|
+
}, k = () => {
|
|
77
77
|
m.value = !1;
|
|
78
78
|
}, x = (t, w) => {
|
|
79
79
|
typeof t > "u" || o("create", t, w);
|
|
80
|
-
},
|
|
80
|
+
}, N = (t, w) => {
|
|
81
81
|
typeof t > "u" || o("save", t, w);
|
|
82
82
|
}, Q = (t, w) => {
|
|
83
83
|
typeof t > "u" || o("drop", t, w);
|
|
84
|
-
},
|
|
84
|
+
}, I = y(() => i.editableView === g.Modifications ? i.modifications : i.item);
|
|
85
85
|
K({
|
|
86
86
|
doSave: () => {
|
|
87
87
|
r.value && typeof r.value.click == "function" && r.value.click();
|
|
@@ -90,77 +90,77 @@ const C = (...B) => {
|
|
|
90
90
|
u.value && typeof u.value.click == "function" && u.value.click();
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
-
const M =
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
] : Array.isArray(
|
|
93
|
+
const M = y(() => !i.canDrop || i.dropButton === !1 ? !1 : !i.canUpdate && i.canDrop ? !0 : !m.value && i.editing && i.httpSuccessRead), W = y(() => i.mode === T.Create && i.createButton === !1 || i.mode === T.Update && i.updateButton === !1 || m.value ? !1 : i.editing && i.httpSuccessRead), E = y(() => i.editModeButton === !1 || !i.canSwitchEditMode || !i.canUpdate && !i.canDrop || !i.canUpdate && i.canDrop ? !1 : !m.value && i.mode !== T.Create && i.httpSuccessRead), pe = y(() => i.buttonNavVisibility === je.Always || c["prev-buttons-ever"] ? !0 : i.buttonNavVisibility === je.Never ? !1 : W.value || M.value || E.value), z = y(() => i.modificationView === !1 ? [] : i.modificationView === !0 ? [
|
|
94
|
+
g.Current,
|
|
95
|
+
g.Modifications,
|
|
96
|
+
g.SplitView,
|
|
97
|
+
g.Differences
|
|
98
|
+
] : Array.isArray(i.modificationView) ? i.modificationView : []), H = y(() => {
|
|
99
99
|
let t = [];
|
|
100
|
-
return z.value.includes(
|
|
100
|
+
return z.value.includes(g.Current) && t.push({
|
|
101
101
|
text: "Current",
|
|
102
102
|
icon: "lkt-icn-see",
|
|
103
|
-
disabled:
|
|
103
|
+
disabled: C.value === g.Current,
|
|
104
104
|
events: {
|
|
105
105
|
click: () => {
|
|
106
|
-
|
|
106
|
+
C.value = g.Current;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
}), z.value.includes(
|
|
109
|
+
}), z.value.includes(g.Modifications) && t.push({
|
|
110
110
|
text: "Modifications",
|
|
111
111
|
icon: "lkt-icn-edit",
|
|
112
|
-
disabled:
|
|
112
|
+
disabled: C.value === g.Modifications,
|
|
113
113
|
events: {
|
|
114
114
|
click: () => {
|
|
115
|
-
|
|
115
|
+
C.value = g.Modifications;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
}), z.value.includes(
|
|
118
|
+
}), z.value.includes(g.SplitView) && t.push({
|
|
119
119
|
text: "Split View",
|
|
120
120
|
icon: "lkt-icn-columns",
|
|
121
|
-
disabled:
|
|
121
|
+
disabled: C.value === g.SplitView,
|
|
122
122
|
events: {
|
|
123
123
|
click: () => {
|
|
124
|
-
|
|
124
|
+
C.value = g.SplitView;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
}), z.value.includes(
|
|
127
|
+
}), z.value.includes(g.Differences) && t.push({
|
|
128
128
|
text: "Differences",
|
|
129
129
|
icon: "lkt-icn-balance",
|
|
130
|
-
disabled:
|
|
130
|
+
disabled: C.value === g.Differences,
|
|
131
131
|
events: {
|
|
132
132
|
click: () => {
|
|
133
|
-
|
|
133
|
+
C.value = g.Differences;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
}), t;
|
|
137
137
|
});
|
|
138
138
|
return (t, w) => {
|
|
139
139
|
var L, $, j, P;
|
|
140
|
-
const h =
|
|
141
|
-
return pe.value ? (v(), J("div",
|
|
142
|
-
t.grouped && t.groupButtonAsModalActions ? (v(), J(
|
|
143
|
-
|
|
140
|
+
const h = ye("lkt-button");
|
|
141
|
+
return pe.value ? (v(), J("div", lt, [
|
|
142
|
+
t.grouped && t.groupButtonAsModalActions ? (v(), J($e, { key: 0 }, [
|
|
143
|
+
E.value ? (v(), A(h, S({ key: 0 }, t.editModeButton, {
|
|
144
144
|
checked: O.value,
|
|
145
|
-
"onUpdate:checked": w[0] || (w[0] = (
|
|
145
|
+
"onUpdate:checked": w[0] || (w[0] = (G) => O.value = G),
|
|
146
146
|
class: "lkt-item-crud--switch-mode-button"
|
|
147
147
|
}), null, 16, ["checked"])) : p("", !0),
|
|
148
|
-
z.value.length > 0 ? (v(), A(h,
|
|
149
|
-
type:
|
|
148
|
+
z.value.length > 0 ? (v(), A(h, Ve(S({ key: 1 }, {
|
|
149
|
+
type: n(Te).Tooltip,
|
|
150
150
|
icon: "lkt-icn-cross-arrows",
|
|
151
151
|
class: "lkt-item-crud--modifications-button",
|
|
152
|
-
splitButtons:
|
|
152
|
+
splitButtons: H.value,
|
|
153
153
|
tooltip: {
|
|
154
154
|
contentClass: "lkt-flex-column"
|
|
155
155
|
}
|
|
156
156
|
})), null, 16)) : p("", !0),
|
|
157
|
-
|
|
157
|
+
n(c)["prev-buttons-ever"] ? U(t.$slots, "prev-buttons-ever", {
|
|
158
158
|
key: 2,
|
|
159
159
|
canUpdate: t.canUpdate,
|
|
160
160
|
canDrop: t.canDrop,
|
|
161
161
|
perms: t.perms
|
|
162
162
|
}) : p("", !0),
|
|
163
|
-
|
|
163
|
+
n(c)["prev-buttons"] ? U(t.$slots, "prev-buttons", {
|
|
164
164
|
key: 3,
|
|
165
165
|
canUpdate: t.canUpdate,
|
|
166
166
|
canDrop: t.canDrop,
|
|
@@ -173,15 +173,15 @@ const C = (...B) => {
|
|
|
173
173
|
...t.updateButton,
|
|
174
174
|
resourceData: {
|
|
175
175
|
...(L = t.updateButton) == null ? void 0 : L.resourceData,
|
|
176
|
-
...
|
|
176
|
+
...I.value
|
|
177
177
|
},
|
|
178
178
|
disabled: !t.ableToUpdate
|
|
179
179
|
}, {
|
|
180
180
|
onLoading: b,
|
|
181
|
-
onLoaded:
|
|
182
|
-
onClick:
|
|
181
|
+
onLoaded: k,
|
|
182
|
+
onClick: N
|
|
183
183
|
}), null, 16), [
|
|
184
|
-
[X, t.mode ===
|
|
184
|
+
[X, t.mode === n(T).Update && W.value]
|
|
185
185
|
]),
|
|
186
186
|
F(Y(h, S({
|
|
187
187
|
ref_key: "saveButtonRef",
|
|
@@ -190,15 +190,15 @@ const C = (...B) => {
|
|
|
190
190
|
...t.createButton,
|
|
191
191
|
resourceData: {
|
|
192
192
|
...($ = t.createButton) == null ? void 0 : $.resourceData,
|
|
193
|
-
...
|
|
193
|
+
...I.value
|
|
194
194
|
},
|
|
195
195
|
disabled: !t.ableToCreate
|
|
196
196
|
}, {
|
|
197
197
|
onLoading: b,
|
|
198
|
-
onLoaded:
|
|
198
|
+
onLoaded: k,
|
|
199
199
|
onClick: x
|
|
200
200
|
}), null, 16), [
|
|
201
|
-
[X, t.mode ===
|
|
201
|
+
[X, t.mode === n(T).Create && W.value]
|
|
202
202
|
]),
|
|
203
203
|
F(Y(h, S({
|
|
204
204
|
ref_key: "dropButtonRef",
|
|
@@ -206,40 +206,40 @@ const C = (...B) => {
|
|
|
206
206
|
}, t.dropButton, {
|
|
207
207
|
disabled: !t.ableToDrop,
|
|
208
208
|
onLoading: b,
|
|
209
|
-
onLoaded:
|
|
209
|
+
onLoaded: k,
|
|
210
210
|
onClick: Q
|
|
211
211
|
}), null, 16, ["disabled"]), [
|
|
212
|
-
[X, M.value && t.mode !==
|
|
212
|
+
[X, M.value && t.mode !== n(T).Create]
|
|
213
213
|
]),
|
|
214
|
-
|
|
214
|
+
n(c).buttons ? U(t.$slots, "buttons", { key: 4 }) : p("", !0)
|
|
215
215
|
], 64)) : t.grouped ? (v(), A(h, S({
|
|
216
216
|
key: 1,
|
|
217
217
|
ref: "groupButton"
|
|
218
218
|
}, t.groupButton, { class: "lkt-item-crud-group-button" }), {
|
|
219
219
|
split: _(() => {
|
|
220
|
-
var
|
|
220
|
+
var G, ue;
|
|
221
221
|
return [
|
|
222
|
-
|
|
222
|
+
E.value ? (v(), A(h, S({ key: 0 }, t.editModeButton, {
|
|
223
223
|
checked: O.value,
|
|
224
|
-
"onUpdate:checked": w[1] || (w[1] = (
|
|
224
|
+
"onUpdate:checked": w[1] || (w[1] = (le) => O.value = le),
|
|
225
225
|
class: "lkt-item-crud--switch-mode-button"
|
|
226
226
|
}), null, 16, ["checked"])) : p("", !0),
|
|
227
|
-
z.value.length > 0 ? (v(), A(h,
|
|
228
|
-
type:
|
|
227
|
+
z.value.length > 0 ? (v(), A(h, Ve(S({ key: 1 }, {
|
|
228
|
+
type: n(Te).Tooltip,
|
|
229
229
|
icon: "lkt-icn-cross-arrows",
|
|
230
230
|
class: "lkt-item-crud--modifications-button",
|
|
231
|
-
splitButtons:
|
|
231
|
+
splitButtons: H.value,
|
|
232
232
|
tooltip: {
|
|
233
233
|
contentClass: "lkt-flex-column"
|
|
234
234
|
}
|
|
235
235
|
})), null, 16)) : p("", !0),
|
|
236
|
-
|
|
236
|
+
n(c)["prev-buttons-ever"] ? U(t.$slots, "prev-buttons-ever", {
|
|
237
237
|
key: 2,
|
|
238
238
|
canUpdate: t.canUpdate,
|
|
239
239
|
canDrop: t.canDrop,
|
|
240
240
|
perms: t.perms
|
|
241
241
|
}) : p("", !0),
|
|
242
|
-
|
|
242
|
+
n(c)["prev-buttons"] ? U(t.$slots, "prev-buttons", {
|
|
243
243
|
key: 3,
|
|
244
244
|
canUpdate: t.canUpdate,
|
|
245
245
|
canDrop: t.canDrop,
|
|
@@ -251,16 +251,16 @@ const C = (...B) => {
|
|
|
251
251
|
}, {
|
|
252
252
|
...t.updateButton,
|
|
253
253
|
resourceData: {
|
|
254
|
-
...(
|
|
255
|
-
...
|
|
254
|
+
...(G = t.updateButton) == null ? void 0 : G.resourceData,
|
|
255
|
+
...I.value
|
|
256
256
|
},
|
|
257
257
|
disabled: !t.ableToUpdate
|
|
258
258
|
}, {
|
|
259
259
|
onLoading: b,
|
|
260
|
-
onLoaded:
|
|
261
|
-
onClick:
|
|
260
|
+
onLoaded: k,
|
|
261
|
+
onClick: N
|
|
262
262
|
}), null, 16), [
|
|
263
|
-
[X, t.mode ===
|
|
263
|
+
[X, t.mode === n(T).Update && W.value]
|
|
264
264
|
]),
|
|
265
265
|
F(Y(h, S({
|
|
266
266
|
ref_key: "saveButtonRef",
|
|
@@ -268,17 +268,17 @@ const C = (...B) => {
|
|
|
268
268
|
}, {
|
|
269
269
|
...t.createButton,
|
|
270
270
|
resourceData: {
|
|
271
|
-
...(
|
|
272
|
-
...
|
|
271
|
+
...(ue = t.createButton) == null ? void 0 : ue.resourceData,
|
|
272
|
+
...I.value
|
|
273
273
|
},
|
|
274
274
|
disabled: !t.ableToCreate
|
|
275
275
|
}, {
|
|
276
276
|
disabled: !t.ableToCreate,
|
|
277
277
|
onLoading: b,
|
|
278
|
-
onLoaded:
|
|
278
|
+
onLoaded: k,
|
|
279
279
|
onClick: x
|
|
280
280
|
}), null, 16, ["disabled"]), [
|
|
281
|
-
[X, t.mode ===
|
|
281
|
+
[X, t.mode === n(T).Create && W.value]
|
|
282
282
|
]),
|
|
283
283
|
F(Y(h, S({
|
|
284
284
|
ref_key: "dropButtonRef",
|
|
@@ -286,17 +286,17 @@ const C = (...B) => {
|
|
|
286
286
|
}, t.dropButton, {
|
|
287
287
|
disabled: !t.ableToDrop,
|
|
288
288
|
onLoading: b,
|
|
289
|
-
onLoaded:
|
|
289
|
+
onLoaded: k,
|
|
290
290
|
onClick: Q
|
|
291
291
|
}), null, 16, ["disabled"]), [
|
|
292
|
-
[X, M.value && t.mode !==
|
|
292
|
+
[X, M.value && t.mode !== n(T).Create]
|
|
293
293
|
]),
|
|
294
|
-
|
|
294
|
+
n(c).buttons ? U(t.$slots, "buttons", { key: 4 }) : p("", !0)
|
|
295
295
|
];
|
|
296
296
|
}),
|
|
297
297
|
_: 3
|
|
298
|
-
}, 16)) : (v(), J(
|
|
299
|
-
|
|
298
|
+
}, 16)) : (v(), J($e, { key: 2 }, [
|
|
299
|
+
n(c)["prev-buttons-ever"] ? F((v(), J("div", dt, [
|
|
300
300
|
U(t.$slots, "prev-buttons-ever", {
|
|
301
301
|
canUpdate: t.canUpdate,
|
|
302
302
|
canDrop: t.canDrop,
|
|
@@ -305,7 +305,7 @@ const C = (...B) => {
|
|
|
305
305
|
], 512)), [
|
|
306
306
|
[X, !m.value]
|
|
307
307
|
]) : p("", !0),
|
|
308
|
-
|
|
308
|
+
n(c)["prev-buttons"] ? F((v(), J("div", rt, [
|
|
309
309
|
U(t.$slots, "prev-buttons", {
|
|
310
310
|
canUpdate: t.canUpdate,
|
|
311
311
|
canDrop: t.canDrop,
|
|
@@ -321,15 +321,15 @@ const C = (...B) => {
|
|
|
321
321
|
...t.updateButton,
|
|
322
322
|
resourceData: {
|
|
323
323
|
...(j = t.updateButton) == null ? void 0 : j.resourceData,
|
|
324
|
-
...
|
|
324
|
+
...I.value
|
|
325
325
|
},
|
|
326
326
|
disabled: !t.ableToUpdate
|
|
327
327
|
}, {
|
|
328
328
|
onLoading: b,
|
|
329
|
-
onLoaded:
|
|
330
|
-
onClick:
|
|
329
|
+
onLoaded: k,
|
|
330
|
+
onClick: N
|
|
331
331
|
}), null, 16), [
|
|
332
|
-
[X, t.mode ===
|
|
332
|
+
[X, t.mode === n(T).Update && W.value]
|
|
333
333
|
]),
|
|
334
334
|
F(Y(h, S({
|
|
335
335
|
ref_key: "saveButtonRef",
|
|
@@ -338,15 +338,15 @@ const C = (...B) => {
|
|
|
338
338
|
...t.createButton,
|
|
339
339
|
resourceData: {
|
|
340
340
|
...(P = t.createButton) == null ? void 0 : P.resourceData,
|
|
341
|
-
...
|
|
341
|
+
...I.value
|
|
342
342
|
},
|
|
343
343
|
disabled: !t.ableToCreate
|
|
344
344
|
}, {
|
|
345
345
|
onLoading: b,
|
|
346
|
-
onLoaded:
|
|
346
|
+
onLoaded: k,
|
|
347
347
|
onClick: x
|
|
348
348
|
}), null, 16), [
|
|
349
|
-
[X, t.mode ===
|
|
349
|
+
[X, t.mode === n(T).Create && W.value]
|
|
350
350
|
]),
|
|
351
351
|
F(Y(h, S({
|
|
352
352
|
ref_key: "dropButtonRef",
|
|
@@ -354,41 +354,41 @@ const C = (...B) => {
|
|
|
354
354
|
}, t.dropButton, {
|
|
355
355
|
disabled: !t.ableToDrop,
|
|
356
356
|
onLoading: b,
|
|
357
|
-
onLoaded:
|
|
357
|
+
onLoaded: k,
|
|
358
358
|
onClick: Q
|
|
359
359
|
}), null, 16, ["disabled"]), [
|
|
360
|
-
[X, M.value && t.mode !==
|
|
360
|
+
[X, M.value && t.mode !== n(T).Create]
|
|
361
361
|
]),
|
|
362
|
-
|
|
362
|
+
n(c).buttons ? F((v(), J("div", st, [
|
|
363
363
|
U(t.$slots, "buttons")
|
|
364
364
|
], 512)), [
|
|
365
365
|
[X, O.value && !m.value]
|
|
366
366
|
]) : p("", !0),
|
|
367
|
-
z.value.length > 0 ? (v(), A(h,
|
|
368
|
-
type:
|
|
367
|
+
z.value.length > 0 ? (v(), A(h, Ve(S({ key: 3 }, {
|
|
368
|
+
type: n(Te).Tooltip,
|
|
369
369
|
icon: "lkt-icn-cross-arrows",
|
|
370
370
|
class: "lkt-item-crud--modifications-button",
|
|
371
|
-
splitButtons:
|
|
371
|
+
splitButtons: H.value,
|
|
372
372
|
tooltip: {
|
|
373
373
|
contentClass: "lkt-flex-column"
|
|
374
374
|
}
|
|
375
375
|
})), null, 16)) : p("", !0),
|
|
376
|
-
|
|
376
|
+
E.value ? (v(), A(h, S({ key: 4 }, t.editModeButton, {
|
|
377
377
|
checked: O.value,
|
|
378
|
-
"onUpdate:checked": w[2] || (w[2] = (
|
|
378
|
+
"onUpdate:checked": w[2] || (w[2] = (G) => O.value = G),
|
|
379
379
|
class: "lkt-item-crud--switch-mode-button"
|
|
380
380
|
}), null, 16, ["checked"])) : p("", !0)
|
|
381
381
|
], 64))
|
|
382
382
|
])) : p("", !0);
|
|
383
383
|
};
|
|
384
384
|
}
|
|
385
|
-
}),
|
|
386
|
-
let o = new
|
|
387
|
-
onlyProps:
|
|
385
|
+
}), pt = (B, K, te) => {
|
|
386
|
+
let o = new ke(JSON.parse(JSON.stringify(B)), {
|
|
387
|
+
onlyProps: Je(te),
|
|
388
388
|
recursiveOnlyProps: !1
|
|
389
389
|
});
|
|
390
390
|
return o.increment(JSON.parse(JSON.stringify(K))), o;
|
|
391
|
-
},
|
|
391
|
+
}, Je = (B) => {
|
|
392
392
|
if (B.items === void 0) return [];
|
|
393
393
|
if (B.items.length === 0) return [];
|
|
394
394
|
let K = [];
|
|
@@ -399,38 +399,39 @@ const C = (...B) => {
|
|
|
399
399
|
o.key !== void 0 && K.push(o.key);
|
|
400
400
|
break;
|
|
401
401
|
case "form":
|
|
402
|
-
o.form && (K = [...K, ...
|
|
402
|
+
o.form && (K = [...K, ...Je(o.form)]);
|
|
403
403
|
break;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
return K;
|
|
407
|
-
},
|
|
407
|
+
}, vt = { class: "lkt-item-crud" }, ct = {
|
|
408
408
|
key: 0,
|
|
409
409
|
class: "lkt-item-crud_header"
|
|
410
|
-
},
|
|
410
|
+
}, ft = {
|
|
411
411
|
key: 0,
|
|
412
412
|
class: "lkt-item-crud_header-slot"
|
|
413
|
-
},
|
|
413
|
+
}, mt = {
|
|
414
414
|
key: 1,
|
|
415
415
|
class: "lkt-item-crud_header-title"
|
|
416
|
-
},
|
|
416
|
+
}, bt = {
|
|
417
417
|
key: 2,
|
|
418
418
|
class: "lkt-item-crud_header-slot"
|
|
419
|
-
},
|
|
419
|
+
}, gt = {
|
|
420
420
|
key: 2,
|
|
421
421
|
class: "lkt-item-crud_content"
|
|
422
|
-
},
|
|
422
|
+
}, yt = {
|
|
423
423
|
key: 0,
|
|
424
424
|
class: "lkt-grid-1"
|
|
425
|
-
},
|
|
425
|
+
}, kt = /* @__PURE__ */ Fe({
|
|
426
426
|
__name: "LktItemCrud",
|
|
427
|
-
props: /* @__PURE__ */
|
|
427
|
+
props: /* @__PURE__ */ ze({
|
|
428
428
|
modelValue: {},
|
|
429
429
|
modifications: {},
|
|
430
430
|
editing: { type: Boolean },
|
|
431
431
|
perms: {},
|
|
432
432
|
customData: {},
|
|
433
433
|
form: {},
|
|
434
|
+
formUiConfig: {},
|
|
434
435
|
mode: {},
|
|
435
436
|
view: {},
|
|
436
437
|
visibleView: {},
|
|
@@ -456,7 +457,7 @@ const C = (...B) => {
|
|
|
456
457
|
redirectOnDrop: { type: [String, Function] },
|
|
457
458
|
differencesTableConfig: { type: [Object, Function] },
|
|
458
459
|
events: {}
|
|
459
|
-
},
|
|
460
|
+
}, tt(ot)),
|
|
460
461
|
emits: [
|
|
461
462
|
"update:modelValue",
|
|
462
463
|
"update:editing",
|
|
@@ -474,13 +475,13 @@ const C = (...B) => {
|
|
|
474
475
|
"modified-data"
|
|
475
476
|
],
|
|
476
477
|
setup(B, { expose: K, emit: te }) {
|
|
477
|
-
const o = B,
|
|
478
|
+
const o = B, i = ut(), C = Xe(), c = te, r = d(!0), u = d(o.modelValue), m = d(o.modifications), O = d(o.customData), b = d(o.perms), k = d(o.editing), x = d(!1), N = d(!1), Q = d(!1), I = d(200), R = d(new ke(u.value, o.dataStateConfig)), ne = d(new ke(m.value, o.dataStateConfig)), M = d(!1), W = d(new ke(o.readData)), E = d(o.mode === T.Create), pe = d(!1), z = d(!1), H = d(null), t = y(() => !E.value && Array.isArray(b.value) && b.value.includes(Ie.Update)), w = y(() => !E.value && Array.isArray(b.value) && b.value.includes(Ie.Drop)), h = y(() => !E.value && Array.isArray(b.value) && b.value.includes(Ie.SwitchEditMode)), L = d(o.visibleView);
|
|
478
479
|
f(() => o.visibleView, (e) => {
|
|
479
480
|
L.value = e;
|
|
480
481
|
}), f(L, (e) => {
|
|
481
482
|
c("update:modificationView", e);
|
|
482
483
|
}), f(() => o.mode, (e) => {
|
|
483
|
-
|
|
484
|
+
E.value = e === T.Create;
|
|
484
485
|
}), f(() => o.perms, (e) => {
|
|
485
486
|
b.value = e;
|
|
486
487
|
}), f(b, (e) => {
|
|
@@ -490,11 +491,11 @@ const C = (...B) => {
|
|
|
490
491
|
}), f(O, (e) => {
|
|
491
492
|
c("update:customData", e);
|
|
492
493
|
}), f(() => o.modifications, (e) => {
|
|
493
|
-
|
|
494
|
+
ne.value.increment(e), m.value = e;
|
|
494
495
|
}, { deep: !0 }), f(m, (e) => {
|
|
495
|
-
|
|
496
|
+
Ee(), ne.value.increment(e), oe.value === g.Modifications && (M.value = ne.value.changed()), c("update:modifications", e);
|
|
496
497
|
}, { deep: !0 });
|
|
497
|
-
const $ = d(Z(o.createButton, s.defaultCreateButton)), j = d(Z(o.updateButton, s.defaultUpdateButton)), P = d(Z(o.dropButton, s.defaultDropButton)),
|
|
498
|
+
const $ = d(Z(o.createButton, s.defaultCreateButton)), j = d(Z(o.updateButton, s.defaultUpdateButton)), P = d(Z(o.dropButton, s.defaultDropButton)), G = d(Z(o.editModeButton, s.defaultEditModeButton)), ue = d(Z(o.groupButton, s.defaultGroupButton));
|
|
498
499
|
f(() => o.createButton, (e) => {
|
|
499
500
|
$.value = Z(e, s.defaultCreateButton);
|
|
500
501
|
}, { deep: !0 }), f(() => o.updateButton, (e) => {
|
|
@@ -502,192 +503,192 @@ const C = (...B) => {
|
|
|
502
503
|
}, { deep: !0 }), f(() => o.dropButton, (e) => {
|
|
503
504
|
P.value = Z(e, s.defaultDropButton);
|
|
504
505
|
}, { deep: !0 }), f(() => o.editModeButton, (e) => {
|
|
505
|
-
|
|
506
|
+
G.value = Z(e, s.defaultEditModeButton);
|
|
506
507
|
}, { deep: !0 });
|
|
507
|
-
const
|
|
508
|
+
const le = async () => {
|
|
508
509
|
var e, a, q;
|
|
509
|
-
|
|
510
|
+
D("fetchItem"), r.value = !0, I.value = -1, Q.value = !1, typeof ((e = o.events) == null ? void 0 : e.httpStart) == "function" && o.events.httpStart();
|
|
510
511
|
try {
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
httpResponse:
|
|
515
|
-
}), c("error",
|
|
512
|
+
const V = await et(o.readResource, o.readData);
|
|
513
|
+
if (D("fetchItem -> response", V), r.value = !1, I.value = V.httpStatus, O.value = V.custom, !V.success) {
|
|
514
|
+
N.value = !1, I.value = V.httpStatus, typeof ((a = o.events) == null ? void 0 : a.httpEnd) == "function" && o.events.httpEnd({
|
|
515
|
+
httpResponse: V
|
|
516
|
+
}), c("error", V.httpStatus);
|
|
516
517
|
return;
|
|
517
518
|
}
|
|
518
|
-
|
|
519
|
-
httpResponse:
|
|
520
|
-
}), c("read",
|
|
519
|
+
N.value = !0, u.value = V.data, m.value = Array.isArray(V.modifications) ? {} : V.modifications, b.value = V.perms, R.value.increment(u.value).turnStoredIntoOriginal(), ne.value.increment(m.value).turnStoredIntoOriginal(), M.value = R.value.changed(), W.value.turnStoredIntoOriginal(), Object.keys(m.value).length > 0 && (L.value = g.Modifications), typeof ((q = o.events) == null ? void 0 : q.httpEnd) == "function" && o.events.httpEnd({
|
|
520
|
+
httpResponse: V
|
|
521
|
+
}), c("read", V);
|
|
521
522
|
} catch {
|
|
522
|
-
r.value = !1,
|
|
523
|
+
r.value = !1, N.value = !1, I.value = 404, c("error", 404);
|
|
523
524
|
return;
|
|
524
525
|
}
|
|
525
526
|
};
|
|
526
527
|
f(() => o.modelValue, (e) => {
|
|
527
|
-
u.value = e,
|
|
528
|
+
u.value = e, R.value.increment(e);
|
|
528
529
|
}, { deep: !0 }), f(u, (e) => {
|
|
529
|
-
if (pe.value = !0,
|
|
530
|
-
|
|
530
|
+
if (pe.value = !0, D("item updated ->", u.value), typeof o.beforeEmitUpdate == "function") {
|
|
531
|
+
D("item updated -> has beforeEmitUpdate");
|
|
531
532
|
let a = o.beforeEmitUpdate(u.value);
|
|
532
|
-
|
|
533
|
+
D("item updated -> override with: ", a), typeof a == "object" && (u.value = a);
|
|
533
534
|
}
|
|
534
|
-
|
|
535
|
+
Ee(), c("update:modelValue", u.value), D("item updated -> update dataState"), R.value.increment(e), oe.value === g.Current && (M.value = R.value.changed()), Qe(() => pe.value = !1);
|
|
535
536
|
}, { deep: !0 }), f(b, () => c("perms", b.value)), f(M, (e) => {
|
|
536
537
|
c("modified-data", e);
|
|
537
538
|
}), f(() => o.readData, (e) => {
|
|
538
|
-
W.value.increment(e), W.value.changed() &&
|
|
539
|
+
W.value.increment(e), W.value.changed() && le();
|
|
539
540
|
}), f(() => o.editing, (e) => {
|
|
540
|
-
|
|
541
|
-
}), f(
|
|
542
|
-
|
|
541
|
+
D("editing updated -> updating editMode", e), k.value = e;
|
|
542
|
+
}), f(k, (e) => {
|
|
543
|
+
D("editMode updated -> emit update", e), c("update:editing", e);
|
|
543
544
|
});
|
|
544
|
-
const
|
|
545
|
-
me.value && (
|
|
545
|
+
const Oe = d(void 0), Ee = () => {
|
|
546
|
+
me.value && (Oe.value = pt(u.value, m.value, o.form));
|
|
546
547
|
};
|
|
547
|
-
|
|
548
|
-
o.readResource && !
|
|
548
|
+
Ye(() => {
|
|
549
|
+
o.readResource && !E.value ? le() : (E.value, N.value = !0, k.value = !0, r.value = !1, R.value.increment(u.value).turnStoredIntoOriginal(), M.value = R.value.changed());
|
|
549
550
|
});
|
|
550
|
-
const
|
|
551
|
+
const Be = (e, a) => {
|
|
551
552
|
if (a) {
|
|
552
|
-
if (r.value = !1, typeof e < "u" && (
|
|
553
|
+
if (r.value = !1, typeof e < "u" && (I.value = e.httpStatus, !e.success))
|
|
553
554
|
return Q.value = !0, c("error", e.httpStatus), !1;
|
|
554
555
|
Q.value = !0;
|
|
555
556
|
}
|
|
556
557
|
return !0;
|
|
557
|
-
},
|
|
558
|
-
if (
|
|
559
|
-
if (
|
|
558
|
+
}, Ne = (e, a) => {
|
|
559
|
+
if (D("doAutoReloadId -> enter: ", e), typeof e < "u" && e.autoReloadId)
|
|
560
|
+
if (D("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), typeof a < "u") {
|
|
560
561
|
let q = a;
|
|
561
|
-
typeof a == "function" && (q = a(e.autoReloadId)),
|
|
562
|
-
} else
|
|
563
|
-
},
|
|
564
|
-
if (
|
|
565
|
-
o.notificationType === ee.Toast &&
|
|
562
|
+
typeof a == "function" && (q = a(e.autoReloadId)), i.push(q);
|
|
563
|
+
} else Se.value ? (D("doAutoReloadId -> insideModal: ", o), it(o.modalConfig.modalName, o.modalConfig.modalKey, e.autoReloadId)) : (D("doAutoReloadId -> outsideModal"), o.readData.id = e.autoReloadId, D("doAutoReloadId -> turning off create mode"), E.value = !1, le());
|
|
564
|
+
}, Ce = (e, a) => {
|
|
565
|
+
if (D("onCreate"), !Be(a, $.value.resource)) {
|
|
566
|
+
o.notificationType === ee.Toast && re({
|
|
566
567
|
text: s.defaultCreateErrorText,
|
|
567
568
|
details: s.defaultCreateErrorDetails,
|
|
568
569
|
icon: s.defaultCreateErrorIcon,
|
|
569
|
-
positionX:
|
|
570
|
+
positionX: de.Right
|
|
570
571
|
});
|
|
571
572
|
return;
|
|
572
573
|
}
|
|
573
|
-
z.value = !0,
|
|
574
|
+
z.value = !0, D("onCreate -> turn stored data into original"), R.value.increment(u.value).turnStoredIntoOriginal(), o.notificationType === ee.Toast && re({
|
|
574
575
|
text: s.defaultCreateSuccessText,
|
|
575
576
|
details: s.defaultCreateSuccessDetails,
|
|
576
577
|
icon: s.defaultCreateSuccessIcon,
|
|
577
|
-
positionX:
|
|
578
|
-
}),
|
|
579
|
-
},
|
|
580
|
-
if (
|
|
581
|
-
o.notificationType === ee.Toast &&
|
|
578
|
+
positionX: de.Right
|
|
579
|
+
}), Ne(a, o.redirectOnCreate), D("onCreate -> beforeEmitCreate"), c("create", a);
|
|
580
|
+
}, he = (e, a) => {
|
|
581
|
+
if (D("onUpdate"), !Be(a, j.value.resource)) {
|
|
582
|
+
o.notificationType === ee.Toast && re({
|
|
582
583
|
text: s.defaultUpdateErrorText,
|
|
583
584
|
details: s.defaultUpdateErrorDetails,
|
|
584
585
|
icon: s.defaultUpdateErrorIcon,
|
|
585
|
-
positionX:
|
|
586
|
+
positionX: de.Right
|
|
586
587
|
});
|
|
587
588
|
return;
|
|
588
589
|
}
|
|
589
|
-
|
|
590
|
+
D("onUpdate -> turn stored data into original"), R.value.turnStoredIntoOriginal(), o.notificationType === ee.Toast && re({
|
|
590
591
|
text: s.defaultUpdateSuccessText,
|
|
591
592
|
details: s.defaultUpdateSuccessDetails,
|
|
592
593
|
icon: s.defaultUpdateSuccessIcon,
|
|
593
|
-
positionX:
|
|
594
|
-
}),
|
|
595
|
-
},
|
|
596
|
-
if (
|
|
597
|
-
o.notificationType === ee.Toast &&
|
|
594
|
+
positionX: de.Right
|
|
595
|
+
}), Ne(a), c("update", a);
|
|
596
|
+
}, De = (e, a) => {
|
|
597
|
+
if (D("onDrop"), !Be(a, P.value.resource)) {
|
|
598
|
+
o.notificationType === ee.Toast && re({
|
|
598
599
|
text: s.defaultDropErrorText,
|
|
599
600
|
details: s.defaultDropErrorDetails,
|
|
600
601
|
icon: s.defaultDropErrorIcon,
|
|
601
|
-
positionX:
|
|
602
|
+
positionX: de.Right
|
|
602
603
|
});
|
|
603
604
|
return;
|
|
604
605
|
}
|
|
605
|
-
if (o.notificationType === ee.Toast &&
|
|
606
|
+
if (o.notificationType === ee.Toast && re({
|
|
606
607
|
text: s.defaultDropSuccessText,
|
|
607
608
|
details: s.defaultDropSuccessDetails,
|
|
608
609
|
icon: s.defaultDropSuccessIcon,
|
|
609
|
-
positionX:
|
|
610
|
-
}), c("drop", a), o.view ===
|
|
610
|
+
positionX: de.Right
|
|
611
|
+
}), c("drop", a), o.view === Pe.Modal && (D("onDrop -> close modal"), at(o.modalConfig.modalName, o.modalConfig.modalKey)), typeof o.redirectOnDrop < "u") {
|
|
611
612
|
let q = o.redirectOnDrop;
|
|
612
|
-
typeof o.redirectOnDrop == "function" && (q = o.redirectOnDrop()),
|
|
613
|
+
typeof o.redirectOnDrop == "function" && (q = o.redirectOnDrop()), i.push(q);
|
|
613
614
|
}
|
|
614
615
|
};
|
|
615
616
|
K({
|
|
616
617
|
doDrop: () => {
|
|
617
|
-
|
|
618
|
+
H.value && H.value.doDrop();
|
|
618
619
|
},
|
|
619
|
-
doRefresh:
|
|
620
|
+
doRefresh: le,
|
|
620
621
|
doSave: () => {
|
|
621
|
-
|
|
622
|
+
H.value && H.value.doSave();
|
|
622
623
|
},
|
|
623
624
|
turnStoredDataIntoOriginal: () => {
|
|
624
|
-
|
|
625
|
+
R.value.increment(u.value).turnStoredIntoOriginal();
|
|
625
626
|
},
|
|
626
|
-
hasModifiedData: () =>
|
|
627
|
+
hasModifiedData: () => R.value.changed()
|
|
627
628
|
});
|
|
628
|
-
const
|
|
629
|
-
var e;
|
|
630
|
-
return
|
|
631
|
-
}),
|
|
629
|
+
const Ke = y(() => {
|
|
630
|
+
var e, a;
|
|
631
|
+
return be.value ? oe.value === g.Modifications ? ne.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "" : R.value.changed() ? (a = o.modalConfig) == null ? void 0 : a.closeConfirm : "" : "";
|
|
632
|
+
}), We = (e) => {
|
|
632
633
|
var a;
|
|
633
634
|
if (typeof ((a = o.modalConfig) == null ? void 0 : a.beforeClose) == "function")
|
|
634
635
|
return o.modalConfig.beforeClose({
|
|
635
636
|
...e,
|
|
636
637
|
itemCreated: z.value
|
|
637
638
|
});
|
|
638
|
-
},
|
|
639
|
+
}, we = y(() => o.title.startsWith("__:") ? String(nt(o.title.substring(3))) : o.title), He = y(() => r.value ? !1 : we.value.length > 0 || !!C["post-title"]), Se = y(() => o.view === Pe.Modal), Le = y(() => Se.value ? "lkt-modal" : "section"), ce = y(() => {
|
|
639
640
|
var e, a;
|
|
640
|
-
return o.mode !==
|
|
641
|
+
return o.mode !== T.Update || !t.value || !o.enabledSaveWithoutChanges && !M.value || me.value && !x.value ? !1 : typeof ((e = j.value) == null ? void 0 : e.disabled) == "function" ? !j.value.disabled({
|
|
641
642
|
prop: u.value
|
|
642
643
|
}) : typeof ((a = j.value) == null ? void 0 : a.disabled) == "boolean" ? !j.value.disabled : !0;
|
|
643
|
-
}), fe =
|
|
644
|
+
}), fe = y(() => {
|
|
644
645
|
var e, a;
|
|
645
|
-
return o.mode !==
|
|
646
|
+
return o.mode !== T.Create || !o.enabledSaveWithoutChanges && !M.value || me.value && !x.value ? !1 : typeof ((e = $.value) == null ? void 0 : e.disabled) == "function" ? !$.value.disabled({
|
|
646
647
|
prop: u.value
|
|
647
648
|
}) : typeof ((a = $.value) == null ? void 0 : a.disabled) == "boolean" ? !$.value.disabled : !0;
|
|
648
|
-
}),
|
|
649
|
+
}), Ue = y(() => {
|
|
649
650
|
var e, a;
|
|
650
651
|
return w.value ? typeof ((e = P.value) == null ? void 0 : e.disabled) == "function" ? !P.value.disabled({
|
|
651
652
|
prop: u.value
|
|
652
653
|
}) : typeof ((a = P.value) == null ? void 0 : a.disabled) == "boolean" ? !P.value.disabled : !0 : !1;
|
|
653
|
-
}), Ge =
|
|
654
|
+
}), Ge = y(() => Le.value === "lkt-modal" ? {
|
|
654
655
|
title: o.title,
|
|
655
656
|
item: u.value,
|
|
656
657
|
...o.modalConfig,
|
|
657
|
-
beforeClose:
|
|
658
|
-
closeConfirm:
|
|
658
|
+
beforeClose: We,
|
|
659
|
+
closeConfirm: Ke.value,
|
|
659
660
|
headerActionsButton: o.groupButton !== !1 ? {
|
|
660
661
|
dot: fe.value || ce.value
|
|
661
662
|
} : !1
|
|
662
|
-
} : {}), me =
|
|
663
|
+
} : {}), me = y(() => typeof o.form == "object" && Object.keys(o.form).length > 0), Me = y(() => Object.keys(m.value).length === 0 ? [] : o.modificationViews), oe = y(() => Object.keys(m.value).length === 0 ? g.Current : g.Modifications), be = y(() => E.value || t.value || w.value);
|
|
663
664
|
return (e, a) => {
|
|
664
|
-
const q =
|
|
665
|
-
return v(), A(
|
|
665
|
+
const q = ye("lkt-http-info"), V = ye("lkt-form"), qe = ye("lkt-loader");
|
|
666
|
+
return v(), A(Ze(Le.value), S(Ge.value, { class: "lkt-item-crud" }), ge({
|
|
666
667
|
default: _(() => [
|
|
667
|
-
|
|
668
|
-
!
|
|
669
|
-
|
|
668
|
+
_e("article", vt, [
|
|
669
|
+
!Se.value && He.value ? (v(), J("header", ct, [
|
|
670
|
+
n(C)["pre-title"] ? (v(), J("div", ft, [
|
|
670
671
|
U(e.$slots, "pre-title", {
|
|
671
672
|
item: u.value,
|
|
672
673
|
loading: r.value
|
|
673
674
|
})
|
|
674
675
|
])) : p("", !0),
|
|
675
|
-
|
|
676
|
-
|
|
676
|
+
we.value.length > 0 ? (v(), J("h1", mt, xe(we.value), 1)) : p("", !0),
|
|
677
|
+
n(C)["post-title"] ? (v(), J("div", bt, [
|
|
677
678
|
U(e.$slots, "post-title", {
|
|
678
679
|
item: u.value,
|
|
679
680
|
loading: r.value
|
|
680
681
|
})
|
|
681
682
|
])) : p("", !0)
|
|
682
683
|
])) : p("", !0),
|
|
683
|
-
e.buttonNavPosition ===
|
|
684
|
+
e.buttonNavPosition === n(Re).Top && (e.groupButton === !1 || !e.groupButtonAsModalActions) && be.value ? (v(), A(Ae, {
|
|
684
685
|
key: 1,
|
|
685
686
|
ref_key: "buttonNav",
|
|
686
|
-
ref:
|
|
687
|
+
ref: H,
|
|
687
688
|
loading: r.value,
|
|
688
689
|
"onUpdate:loading": a[3] || (a[3] = (l) => r.value = l),
|
|
689
|
-
editing:
|
|
690
|
-
"onUpdate:editing": a[4] || (a[4] = (l) =>
|
|
690
|
+
editing: k.value,
|
|
691
|
+
"onUpdate:editing": a[4] || (a[4] = (l) => k.value = l),
|
|
691
692
|
"picked-modification-view": L.value,
|
|
692
693
|
"onUpdate:pickedModificationView": a[5] || (a[5] = (l) => L.value = l),
|
|
693
694
|
item: u.value,
|
|
@@ -699,58 +700,58 @@ const C = (...B) => {
|
|
|
699
700
|
"create-button": $.value,
|
|
700
701
|
"update-button": j.value,
|
|
701
702
|
"drop-button": P.value,
|
|
702
|
-
"edit-mode-button":
|
|
703
|
-
"group-button":
|
|
703
|
+
"edit-mode-button": G.value,
|
|
704
|
+
"group-button": ue.value,
|
|
704
705
|
"data-changed": M.value,
|
|
705
|
-
"http-success-read":
|
|
706
|
+
"http-success-read": N.value,
|
|
706
707
|
"can-update": t.value,
|
|
707
708
|
"can-drop": w.value,
|
|
708
709
|
"can-switch-edit-mode": h.value,
|
|
709
710
|
"group-button-as-modal-actions": e.groupButtonAsModalActions,
|
|
710
711
|
"able-to-create": fe.value,
|
|
711
712
|
"able-to-update": ce.value,
|
|
712
|
-
"able-to-drop":
|
|
713
|
+
"able-to-drop": Ue.value,
|
|
713
714
|
perms: b.value,
|
|
714
|
-
"modification-view":
|
|
715
|
-
"editable-view":
|
|
716
|
-
onCreate:
|
|
717
|
-
onSave:
|
|
718
|
-
onDrop:
|
|
719
|
-
},
|
|
720
|
-
|
|
715
|
+
"modification-view": Me.value,
|
|
716
|
+
"editable-view": oe.value,
|
|
717
|
+
onCreate: Ce,
|
|
718
|
+
onSave: he,
|
|
719
|
+
onDrop: De
|
|
720
|
+
}, ge({ _: 2 }, [
|
|
721
|
+
n(C)["prev-buttons-ever"] ? {
|
|
721
722
|
name: "prev-buttons-ever",
|
|
722
|
-
fn: _(({ canUpdate: l, canDrop:
|
|
723
|
+
fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
|
|
723
724
|
U(e.$slots, "prev-buttons-ever", {
|
|
724
725
|
canUpdate: l,
|
|
725
|
-
canDrop:
|
|
726
|
-
perms:
|
|
726
|
+
canDrop: ae,
|
|
727
|
+
perms: ie
|
|
727
728
|
})
|
|
728
729
|
]),
|
|
729
730
|
key: "0"
|
|
730
731
|
} : void 0,
|
|
731
|
-
|
|
732
|
+
n(C)["prev-buttons"] ? {
|
|
732
733
|
name: "prev-buttons",
|
|
733
|
-
fn: _(({ canUpdate: l, canDrop:
|
|
734
|
+
fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
|
|
734
735
|
U(e.$slots, "prev-buttons", {
|
|
735
736
|
canUpdate: l,
|
|
736
|
-
canDrop:
|
|
737
|
-
perms:
|
|
737
|
+
canDrop: ae,
|
|
738
|
+
perms: ie
|
|
738
739
|
})
|
|
739
740
|
]),
|
|
740
741
|
key: "1"
|
|
741
742
|
} : void 0
|
|
742
743
|
]), 1032, ["loading", "editing", "picked-modification-view", "item", "modifications", "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", "modification-view", "editable-view"])) : p("", !0),
|
|
743
|
-
r.value ? p("", !0) : (v(), J("div",
|
|
744
|
-
|
|
745
|
-
Q.value && e.notificationType ===
|
|
744
|
+
r.value ? p("", !0) : (v(), J("div", gt, [
|
|
745
|
+
N.value ? (v(), J("div", yt, [
|
|
746
|
+
Q.value && e.notificationType === n(ee).Inline ? (v(), A(q, {
|
|
746
747
|
key: 0,
|
|
747
|
-
code:
|
|
748
|
-
palette:
|
|
748
|
+
code: I.value,
|
|
749
|
+
palette: I.value === 200 ? "success" : "danger",
|
|
749
750
|
quick: "",
|
|
750
751
|
"can-close": "",
|
|
751
752
|
onClose: a[6] || (a[6] = (l) => Q.value = !1)
|
|
752
753
|
}, null, 8, ["code", "palette"])) : p("", !0),
|
|
753
|
-
me.value ? (v(), A(
|
|
754
|
+
me.value ? (v(), A(V, S({
|
|
754
755
|
key: 1,
|
|
755
756
|
modelValue: u.value,
|
|
756
757
|
"onUpdate:modelValue": a[7] || (a[7] = (l) => u.value = l),
|
|
@@ -759,37 +760,38 @@ const C = (...B) => {
|
|
|
759
760
|
valid: x.value,
|
|
760
761
|
"onUpdate:valid": a[9] || (a[9] = (l) => x.value = l)
|
|
761
762
|
}, {
|
|
763
|
+
...e.formUiConfig,
|
|
762
764
|
form: e.form,
|
|
763
765
|
differencesTableConfig: e.differencesTableConfig,
|
|
764
766
|
visibleView: L.value,
|
|
765
|
-
modificationDataState:
|
|
766
|
-
editableViews: [
|
|
767
|
-
disabled: !
|
|
767
|
+
modificationDataState: Oe.value,
|
|
768
|
+
editableViews: [oe.value],
|
|
769
|
+
disabled: !k.value
|
|
768
770
|
}), null, 16, ["modelValue", "modifications", "valid"])) : U(e.$slots, "item", {
|
|
769
771
|
key: 2,
|
|
770
772
|
item: u.value,
|
|
771
773
|
loading: r.value,
|
|
772
|
-
editMode:
|
|
773
|
-
isCreate:
|
|
774
|
+
editMode: k.value,
|
|
775
|
+
isCreate: E.value,
|
|
774
776
|
canUpdate: t.value,
|
|
775
777
|
canDrop: w.value,
|
|
776
778
|
itemBeingEdited: pe.value,
|
|
777
779
|
perms: b.value
|
|
778
780
|
})
|
|
779
|
-
])) : e.notificationType ===
|
|
781
|
+
])) : e.notificationType === n(ee).Inline ? (v(), A(q, {
|
|
780
782
|
key: 1,
|
|
781
|
-
code:
|
|
783
|
+
code: I.value
|
|
782
784
|
}, null, 8, ["code"])) : p("", !0)
|
|
783
785
|
])),
|
|
784
|
-
r.value ? (v(), A(
|
|
785
|
-
e.buttonNavPosition ===
|
|
786
|
+
r.value ? (v(), A(qe, { key: 3 })) : p("", !0),
|
|
787
|
+
e.buttonNavPosition === n(Re).Bottom && (e.groupButton === !1 || !e.groupButtonAsModalActions) && be.value ? (v(), A(Ae, {
|
|
786
788
|
key: 4,
|
|
787
789
|
ref_key: "buttonNav",
|
|
788
|
-
ref:
|
|
790
|
+
ref: H,
|
|
789
791
|
loading: r.value,
|
|
790
792
|
"onUpdate:loading": a[10] || (a[10] = (l) => r.value = l),
|
|
791
|
-
editing:
|
|
792
|
-
"onUpdate:editing": a[11] || (a[11] = (l) =>
|
|
793
|
+
editing: k.value,
|
|
794
|
+
"onUpdate:editing": a[11] || (a[11] = (l) => k.value = l),
|
|
793
795
|
"picked-modification-view": L.value,
|
|
794
796
|
"onUpdate:pickedModificationView": a[12] || (a[12] = (l) => L.value = l),
|
|
795
797
|
item: u.value,
|
|
@@ -801,32 +803,32 @@ const C = (...B) => {
|
|
|
801
803
|
"create-button": $.value,
|
|
802
804
|
"update-button": j.value,
|
|
803
805
|
"drop-button": P.value,
|
|
804
|
-
"edit-mode-button":
|
|
805
|
-
"group-button":
|
|
806
|
+
"edit-mode-button": G.value,
|
|
807
|
+
"group-button": ue.value,
|
|
806
808
|
"data-changed": M.value,
|
|
807
|
-
"http-success-read":
|
|
809
|
+
"http-success-read": N.value,
|
|
808
810
|
"can-update": t.value,
|
|
809
811
|
"can-drop": w.value,
|
|
810
812
|
"can-switch-edit-mode": h.value,
|
|
811
813
|
"group-button-as-modal-actions": e.groupButtonAsModalActions,
|
|
812
814
|
"able-to-create": fe.value,
|
|
813
815
|
"able-to-update": ce.value,
|
|
814
|
-
"able-to-drop":
|
|
816
|
+
"able-to-drop": Ue.value,
|
|
815
817
|
perms: b.value,
|
|
816
|
-
"modification-view":
|
|
817
|
-
"editable-view":
|
|
818
|
-
onCreate:
|
|
819
|
-
onSave:
|
|
820
|
-
onDrop:
|
|
821
|
-
},
|
|
822
|
-
|
|
818
|
+
"modification-view": Me.value,
|
|
819
|
+
"editable-view": oe.value,
|
|
820
|
+
onCreate: Ce,
|
|
821
|
+
onSave: he,
|
|
822
|
+
onDrop: De
|
|
823
|
+
}, ge({ _: 2 }, [
|
|
824
|
+
n(C)["prev-buttons-ever"] ? {
|
|
823
825
|
name: "prev-buttons-ever",
|
|
824
826
|
fn: _(() => [
|
|
825
827
|
U(e.$slots, "prev-buttons-ever")
|
|
826
828
|
]),
|
|
827
829
|
key: "0"
|
|
828
830
|
} : void 0,
|
|
829
|
-
|
|
831
|
+
n(C)["prev-buttons"] ? {
|
|
830
832
|
name: "prev-buttons-ever",
|
|
831
833
|
fn: _(() => [
|
|
832
834
|
U(e.$slots, "prev-buttons")
|
|
@@ -838,17 +840,17 @@ const C = (...B) => {
|
|
|
838
840
|
]),
|
|
839
841
|
_: 2
|
|
840
842
|
}, [
|
|
841
|
-
e.groupButton !== !1 && e.groupButtonAsModalActions ? {
|
|
843
|
+
e.groupButton !== !1 && e.groupButtonAsModalActions && be.value ? {
|
|
842
844
|
name: "header-actions",
|
|
843
845
|
fn: _(() => [
|
|
844
|
-
e.buttonNavPosition ===
|
|
846
|
+
e.buttonNavPosition === n(Re).Top ? (v(), A(Ae, {
|
|
845
847
|
key: 0,
|
|
846
848
|
ref_key: "buttonNav",
|
|
847
|
-
ref:
|
|
849
|
+
ref: H,
|
|
848
850
|
loading: r.value,
|
|
849
851
|
"onUpdate:loading": a[0] || (a[0] = (l) => r.value = l),
|
|
850
|
-
editing:
|
|
851
|
-
"onUpdate:editing": a[1] || (a[1] = (l) =>
|
|
852
|
+
editing: k.value,
|
|
853
|
+
"onUpdate:editing": a[1] || (a[1] = (l) => k.value = l),
|
|
852
854
|
"picked-modification-view": L.value,
|
|
853
855
|
"onUpdate:pickedModificationView": a[2] || (a[2] = (l) => L.value = l),
|
|
854
856
|
item: u.value,
|
|
@@ -860,42 +862,42 @@ const C = (...B) => {
|
|
|
860
862
|
"create-button": $.value,
|
|
861
863
|
"update-button": j.value,
|
|
862
864
|
"drop-button": P.value,
|
|
863
|
-
"edit-mode-button":
|
|
864
|
-
"group-button":
|
|
865
|
+
"edit-mode-button": G.value,
|
|
866
|
+
"group-button": ue.value,
|
|
865
867
|
"data-changed": M.value,
|
|
866
|
-
"http-success-read":
|
|
868
|
+
"http-success-read": N.value,
|
|
867
869
|
"can-update": t.value,
|
|
868
870
|
"can-drop": w.value,
|
|
869
871
|
"can-switch-edit-mode": h.value,
|
|
870
872
|
"group-button-as-modal-actions": e.groupButtonAsModalActions,
|
|
871
873
|
"able-to-create": fe.value,
|
|
872
874
|
"able-to-update": ce.value,
|
|
873
|
-
"able-to-drop":
|
|
875
|
+
"able-to-drop": Ue.value,
|
|
874
876
|
perms: b.value,
|
|
875
|
-
"modification-view":
|
|
876
|
-
"editable-view":
|
|
877
|
-
onCreate:
|
|
878
|
-
onSave:
|
|
879
|
-
onDrop:
|
|
880
|
-
},
|
|
881
|
-
|
|
877
|
+
"modification-view": Me.value,
|
|
878
|
+
"editable-view": oe.value,
|
|
879
|
+
onCreate: Ce,
|
|
880
|
+
onSave: he,
|
|
881
|
+
onDrop: De
|
|
882
|
+
}, ge({ _: 2 }, [
|
|
883
|
+
n(C)["prev-buttons-ever"] ? {
|
|
882
884
|
name: "prev-buttons-ever",
|
|
883
|
-
fn: _(({ canUpdate: l, canDrop:
|
|
885
|
+
fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
|
|
884
886
|
U(e.$slots, "prev-buttons-ever", {
|
|
885
887
|
canUpdate: l,
|
|
886
|
-
canDrop:
|
|
887
|
-
perms:
|
|
888
|
+
canDrop: ae,
|
|
889
|
+
perms: ie
|
|
888
890
|
})
|
|
889
891
|
]),
|
|
890
892
|
key: "0"
|
|
891
893
|
} : void 0,
|
|
892
|
-
|
|
894
|
+
n(C)["prev-buttons"] ? {
|
|
893
895
|
name: "prev-buttons",
|
|
894
|
-
fn: _(({ canUpdate: l, canDrop:
|
|
896
|
+
fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
|
|
895
897
|
U(e.$slots, "prev-buttons", {
|
|
896
898
|
canUpdate: l,
|
|
897
|
-
canDrop:
|
|
898
|
-
perms:
|
|
899
|
+
canDrop: ae,
|
|
900
|
+
perms: ie
|
|
899
901
|
})
|
|
900
902
|
]),
|
|
901
903
|
key: "1"
|
|
@@ -907,18 +909,18 @@ const C = (...B) => {
|
|
|
907
909
|
]), 1040);
|
|
908
910
|
};
|
|
909
911
|
}
|
|
910
|
-
}),
|
|
912
|
+
}), Rt = {
|
|
911
913
|
install: (B, K = {}) => {
|
|
912
|
-
B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud",
|
|
914
|
+
B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud", kt);
|
|
913
915
|
}
|
|
914
|
-
}, Rt = (B) => {
|
|
915
|
-
re.defaultSaveIcon = B;
|
|
916
916
|
}, At = (B) => {
|
|
917
|
-
|
|
917
|
+
se.defaultSaveIcon = B;
|
|
918
|
+
}, Ot = (B) => {
|
|
919
|
+
se.defaultDropIcon = B;
|
|
918
920
|
};
|
|
919
921
|
export {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
922
|
+
It as debugLktItemCrud,
|
|
923
|
+
Rt as default,
|
|
924
|
+
Ot as setItemCrudDefaultDropIcon,
|
|
925
|
+
At as setItemCrudDefaultSaveIcon
|
|
924
926
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonConfig, ItemCrudButtonNavPosition, ItemCrudConfig, ItemCrudMode, ItemCrudView, LktObject, ModalConfig, ModificationView, NotificationType } from 'lkt-vue-kernel';
|
|
1
|
+
import { ButtonConfig, FormUiConfig, ItemCrudButtonNavPosition, ItemCrudConfig, ItemCrudMode, ItemCrudView, LktObject, ModalConfig, ModificationView, NotificationType } from 'lkt-vue-kernel';
|
|
2
2
|
declare var __VLS_17: {
|
|
3
3
|
canUpdate: boolean | undefined;
|
|
4
4
|
canDrop: boolean | undefined;
|
|
@@ -100,6 +100,7 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
|
100
100
|
editing: boolean;
|
|
101
101
|
perms: import("lkt-vue-kernel").ValidTablePermission[];
|
|
102
102
|
customData: LktObject;
|
|
103
|
+
formUiConfig: Partial<FormUiConfig>;
|
|
103
104
|
visibleView: ModificationView;
|
|
104
105
|
modificationViews: boolean | Array<ModificationView>;
|
|
105
106
|
editModeButton: ButtonConfig | false;
|
package/package.json
CHANGED
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
}
|
|
165
165
|
httpSuccessRead.value = true;
|
|
166
166
|
item.value = r.data;
|
|
167
|
-
itemModifications.value = r.modifications;
|
|
167
|
+
itemModifications.value = Array.isArray(r.modifications) ? {} : r.modifications;
|
|
168
168
|
permissions.value = r.perms;
|
|
169
169
|
dataState.value.increment(item.value).turnStoredIntoOriginal();
|
|
170
170
|
modificationsDataState.value.increment(itemModifications.value).turnStoredIntoOriginal();
|
|
@@ -407,6 +407,10 @@
|
|
|
407
407
|
|
|
408
408
|
|
|
409
409
|
const closeConfirm = computed(() => {
|
|
410
|
+
if (!computedHasButtons.value) return '';
|
|
411
|
+
if (computedEditableView.value === ModificationView.Modifications) {
|
|
412
|
+
return modificationsDataState.value.changed() ? props.modalConfig?.closeConfirm : '';
|
|
413
|
+
}
|
|
410
414
|
return dataState.value.changed() ? props.modalConfig?.closeConfirm : '';
|
|
411
415
|
});
|
|
412
416
|
|
|
@@ -504,6 +508,10 @@
|
|
|
504
508
|
if (Object.keys(itemModifications.value).length === 0) return ModificationView.Current;
|
|
505
509
|
return ModificationView.Modifications;
|
|
506
510
|
})
|
|
511
|
+
|
|
512
|
+
const computedHasButtons = computed(() => {
|
|
513
|
+
return createMode.value || canUpdate.value || canDrop.value;
|
|
514
|
+
})
|
|
507
515
|
</script>
|
|
508
516
|
|
|
509
517
|
<template>
|
|
@@ -512,7 +520,7 @@
|
|
|
512
520
|
v-bind="computedContainerAttrs"
|
|
513
521
|
class="lkt-item-crud"
|
|
514
522
|
>
|
|
515
|
-
<template v-if="groupButton !== false && groupButtonAsModalActions" #header-actions>
|
|
523
|
+
<template v-if="groupButton !== false && groupButtonAsModalActions && computedHasButtons" #header-actions>
|
|
516
524
|
<button-nav
|
|
517
525
|
ref="buttonNav"
|
|
518
526
|
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top"
|
|
@@ -576,7 +584,10 @@
|
|
|
576
584
|
|
|
577
585
|
<button-nav
|
|
578
586
|
ref="buttonNav"
|
|
579
|
-
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top
|
|
587
|
+
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top
|
|
588
|
+
&& (groupButton === false || !groupButtonAsModalActions)
|
|
589
|
+
&& computedHasButtons
|
|
590
|
+
"
|
|
580
591
|
v-model:loading="isLoading"
|
|
581
592
|
v-model:editing="editMode"
|
|
582
593
|
v-model:picked-modification-view="pickedModificationView"
|
|
@@ -639,6 +650,7 @@
|
|
|
639
650
|
v-model:modifications="itemModifications"
|
|
640
651
|
v-model:valid="validForm"
|
|
641
652
|
v-bind="<FormUiConfig>{
|
|
653
|
+
...formUiConfig,
|
|
642
654
|
form,
|
|
643
655
|
differencesTableConfig,
|
|
644
656
|
visibleView: pickedModificationView,
|
|
@@ -668,7 +680,7 @@
|
|
|
668
680
|
|
|
669
681
|
<button-nav
|
|
670
682
|
ref="buttonNav"
|
|
671
|
-
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Bottom && (groupButton === false || !groupButtonAsModalActions)"
|
|
683
|
+
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Bottom && (groupButton === false || !groupButtonAsModalActions) && computedHasButtons"
|
|
672
684
|
v-model:loading="isLoading"
|
|
673
685
|
v-model:editing="editMode"
|
|
674
686
|
v-model:picked-modification-view="pickedModificationView"
|