lkt-item-crud 2.0.15 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as Ue, useSlots as Se, ref as m, watch as
|
|
1
|
+
import { defineComponent as Ue, useSlots as Se, ref as m, watch as D, computed as U, resolveComponent as be, createElementBlock as N, createCommentVNode as d, openBlock as b, createBlock as V, Fragment as ke, renderSlot as v, withDirectives as E, mergeProps as R, unref as u, createVNode as X, withCtx as C, vShow as L, mergeDefaults as Ae, nextTick as $e, onMounted as Ee, resolveDynamicComponent as Le, createSlots as oe, createElementVNode as Ne, toDisplayString as Ve } from "vue";
|
|
2
2
|
import { httpCall as Oe } from "lkt-http-client";
|
|
3
3
|
import { DataState as Ce } from "lkt-data-state";
|
|
4
|
-
import { ItemCrudMode as S, ItemCrudButtonNavVisibility as
|
|
5
|
-
import { closeModal as Xe, updateModalKey as
|
|
6
|
-
import { __ as
|
|
4
|
+
import { ItemCrudMode as S, ItemCrudButtonNavVisibility as he, TablePermission as fe, ensureButtonConfig as W, LktSettings as p, ItemCrudView as De, ItemCrudButtonNavPosition as ce, NotificationType as F, getDefaultValues as je, ItemCrud as Pe, ToastPositionX as z } from "lkt-vue-kernel";
|
|
5
|
+
import { closeModal as Xe, updateModalKey as We } from "lkt-modal";
|
|
6
|
+
import { __ as Ke } from "lkt-i18n";
|
|
7
7
|
import { openToast as J } from "lkt-toast";
|
|
8
8
|
const Y = class Y {
|
|
9
9
|
};
|
|
@@ -13,16 +13,16 @@ const y = (...T) => {
|
|
|
13
13
|
Q.debugEnabled && console.info("[LktItemCrud] ", ...T);
|
|
14
14
|
}, st = (T = !0) => {
|
|
15
15
|
Q.debugEnabled = T;
|
|
16
|
-
},
|
|
16
|
+
}, Fe = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "lkt-item-crud-buttons"
|
|
19
|
-
},
|
|
19
|
+
}, Ge = {
|
|
20
20
|
key: 0,
|
|
21
21
|
class: "lkt-item-crud-buttons"
|
|
22
|
-
},
|
|
22
|
+
}, qe = {
|
|
23
23
|
key: 1,
|
|
24
24
|
class: "lkt-item-crud-buttons"
|
|
25
|
-
},
|
|
25
|
+
}, He = {
|
|
26
26
|
key: 2,
|
|
27
27
|
class: "lkt-item-crud-buttons"
|
|
28
28
|
}, me = /* @__PURE__ */ Ue({
|
|
@@ -60,19 +60,19 @@ const y = (...T) => {
|
|
|
60
60
|
],
|
|
61
61
|
setup(T, { expose: Z, emit: ue }) {
|
|
62
62
|
const a = ue, n = T, r = Se(), s = m(null), i = m(null), f = m(n.loading);
|
|
63
|
-
|
|
63
|
+
D(() => n.loading, (e) => f.value = e), D(f, (e) => a("update:loading", e));
|
|
64
64
|
const l = m(n.editing);
|
|
65
|
-
|
|
65
|
+
D(() => n.editing, (e) => l.value = e), D(l, (e) => a("update:editing", e));
|
|
66
66
|
const B = () => {
|
|
67
67
|
f.value = !0;
|
|
68
68
|
}, M = () => {
|
|
69
69
|
f.value = !1;
|
|
70
|
-
}, A = (e,
|
|
71
|
-
typeof e > "u" || a("create", e,
|
|
72
|
-
}, k = (e,
|
|
73
|
-
typeof e > "u" || a("save", e,
|
|
74
|
-
}, w = (e,
|
|
75
|
-
typeof e > "u" || a("drop", e,
|
|
70
|
+
}, A = (e, h) => {
|
|
71
|
+
typeof e > "u" || a("create", e, h);
|
|
72
|
+
}, k = (e, h) => {
|
|
73
|
+
typeof e > "u" || a("save", e, h);
|
|
74
|
+
}, w = (e, h) => {
|
|
75
|
+
typeof e > "u" || a("drop", e, h);
|
|
76
76
|
};
|
|
77
77
|
Z({
|
|
78
78
|
doSave: () => {
|
|
@@ -82,14 +82,14 @@ const y = (...T) => {
|
|
|
82
82
|
i.value && typeof i.value.click == "function" && i.value.click();
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
const
|
|
86
|
-
return (e,
|
|
85
|
+
const K = U(() => !n.canDrop || n.dropButton === !1 ? !1 : !n.canUpdate && n.canDrop ? !0 : !f.value && n.editing && n.httpSuccessRead), O = U(() => n.mode === S.Create && n.createButton === !1 || n.mode === S.Update && n.updateButton === !1 || f.value ? !1 : n.editing && n.httpSuccessRead), $ = U(() => n.editModeButton === !1 || !n.canSwitchEditMode || !n.canUpdate && !n.canDrop || !n.canUpdate && n.canDrop ? !1 : !f.value && n.mode !== S.Create && n.httpSuccessRead), G = U(() => n.buttonNavVisibility === he.Always || r["prev-buttons-ever"] ? !0 : n.buttonNavVisibility === he.Never ? !1 : O.value || K.value || $.value);
|
|
86
|
+
return (e, h) => {
|
|
87
87
|
const c = be("lkt-button");
|
|
88
|
-
return
|
|
88
|
+
return G.value ? (b(), N("div", Fe, [
|
|
89
89
|
e.grouped && e.groupButtonAsModalActions ? (b(), N(ke, { key: 0 }, [
|
|
90
90
|
$.value ? (b(), V(c, R({ key: 0 }, e.editModeButton, {
|
|
91
91
|
checked: l.value,
|
|
92
|
-
"onUpdate:checked":
|
|
92
|
+
"onUpdate:checked": h[0] || (h[0] = (I) => l.value = I),
|
|
93
93
|
class: "lkt-item-crud--switch-mode-button"
|
|
94
94
|
}), null, 16, ["checked"])) : d("", !0),
|
|
95
95
|
u(r)["prev-buttons-ever"] ? v(e.$slots, "prev-buttons-ever", {
|
|
@@ -171,7 +171,7 @@ const y = (...T) => {
|
|
|
171
171
|
]),
|
|
172
172
|
_: 3
|
|
173
173
|
}, 16, ["disabled"]), [
|
|
174
|
-
[L,
|
|
174
|
+
[L, K.value && e.mode !== u(S).Create]
|
|
175
175
|
]),
|
|
176
176
|
u(r).buttons ? v(e.$slots, "buttons", { key: 3 }) : d("", !0)
|
|
177
177
|
], 64)) : e.grouped ? (b(), V(c, R({
|
|
@@ -181,7 +181,7 @@ const y = (...T) => {
|
|
|
181
181
|
split: C(() => [
|
|
182
182
|
$.value ? (b(), V(c, R({ key: 0 }, e.editModeButton, {
|
|
183
183
|
checked: l.value,
|
|
184
|
-
"onUpdate:checked":
|
|
184
|
+
"onUpdate:checked": h[1] || (h[1] = (I) => l.value = I),
|
|
185
185
|
class: "lkt-item-crud--switch-mode-button"
|
|
186
186
|
}), null, 16, ["checked"])) : d("", !0),
|
|
187
187
|
u(r)["prev-buttons-ever"] ? v(e.$slots, "prev-buttons-ever", {
|
|
@@ -263,13 +263,13 @@ const y = (...T) => {
|
|
|
263
263
|
]),
|
|
264
264
|
_: 3
|
|
265
265
|
}, 16, ["disabled"]), [
|
|
266
|
-
[L,
|
|
266
|
+
[L, K.value && e.mode !== u(S).Create]
|
|
267
267
|
]),
|
|
268
268
|
u(r).buttons ? v(e.$slots, "buttons", { key: 3 }) : d("", !0)
|
|
269
269
|
]),
|
|
270
270
|
_: 3
|
|
271
271
|
}, 16)) : (b(), N(ke, { key: 2 }, [
|
|
272
|
-
u(r)["prev-buttons-ever"] ? E((b(), N("div",
|
|
272
|
+
u(r)["prev-buttons-ever"] ? E((b(), N("div", Ge, [
|
|
273
273
|
v(e.$slots, "prev-buttons-ever", {
|
|
274
274
|
canUpdate: e.canUpdate,
|
|
275
275
|
canDrop: e.canDrop,
|
|
@@ -278,7 +278,7 @@ const y = (...T) => {
|
|
|
278
278
|
], 512)), [
|
|
279
279
|
[L, !f.value]
|
|
280
280
|
]) : d("", !0),
|
|
281
|
-
u(r)["prev-buttons"] ? E((b(), N("div",
|
|
281
|
+
u(r)["prev-buttons"] ? E((b(), N("div", qe, [
|
|
282
282
|
v(e.$slots, "prev-buttons", {
|
|
283
283
|
canUpdate: e.canUpdate,
|
|
284
284
|
canDrop: e.canDrop,
|
|
@@ -354,16 +354,16 @@ const y = (...T) => {
|
|
|
354
354
|
]),
|
|
355
355
|
_: 3
|
|
356
356
|
}, 16, ["disabled"]), [
|
|
357
|
-
[L,
|
|
357
|
+
[L, K.value && e.mode !== u(S).Create]
|
|
358
358
|
]),
|
|
359
|
-
u(r).buttons ? E((b(), N("div",
|
|
359
|
+
u(r).buttons ? E((b(), N("div", He, [
|
|
360
360
|
v(e.$slots, "buttons")
|
|
361
361
|
], 512)), [
|
|
362
362
|
[L, l.value && !f.value]
|
|
363
363
|
]) : d("", !0),
|
|
364
364
|
$.value ? (b(), V(c, R({ key: 3 }, e.editModeButton, {
|
|
365
365
|
checked: l.value,
|
|
366
|
-
"onUpdate:checked":
|
|
366
|
+
"onUpdate:checked": h[2] || (h[2] = (I) => l.value = I),
|
|
367
367
|
class: "lkt-item-crud--switch-mode-button"
|
|
368
368
|
}), null, 16, ["checked"])) : d("", !0)
|
|
369
369
|
], 64))
|
|
@@ -411,7 +411,8 @@ const y = (...T) => {
|
|
|
411
411
|
readData: {},
|
|
412
412
|
title: {},
|
|
413
413
|
beforeEmitUpdate: { type: Function },
|
|
414
|
-
notificationType: {}
|
|
414
|
+
notificationType: {},
|
|
415
|
+
enabledSaveWithoutChanges: { type: Boolean }
|
|
415
416
|
}, je(Pe)),
|
|
416
417
|
emits: [
|
|
417
418
|
"update:modelValue",
|
|
@@ -426,19 +427,19 @@ const y = (...T) => {
|
|
|
426
427
|
"modified-data"
|
|
427
428
|
],
|
|
428
429
|
setup(T, { expose: Z, emit: ue }) {
|
|
429
|
-
const a = T, n = Se(), r = ue, s = m(!0), i = m(a.modelValue), f = m(a.perms), l = m(a.editing), B = m(!1), M = m(!1), A = m(200), k = m(new Ce(i.value, a.dataStateConfig)), w = m(!1), _ = m(new Ce(a.readData)), j = m(a.mode === S.Create),
|
|
430
|
-
|
|
430
|
+
const a = T, n = Se(), r = ue, s = m(!0), i = m(a.modelValue), f = m(a.perms), l = m(a.editing), B = m(!1), M = m(!1), A = m(200), k = m(new Ce(i.value, a.dataStateConfig)), w = m(!1), _ = m(new Ce(a.readData)), j = m(a.mode === S.Create), K = m(!1), O = m(!1), $ = m(null), G = U(() => !j.value && Array.isArray(f.value) && f.value.includes(fe.Update)), e = U(() => !j.value && Array.isArray(f.value) && f.value.includes(fe.Drop)), h = U(() => !j.value && Array.isArray(f.value) && f.value.includes(fe.SwitchEditMode));
|
|
431
|
+
D(() => a.mode, (t) => {
|
|
431
432
|
j.value = t === S.Create;
|
|
432
433
|
});
|
|
433
|
-
const c = m(
|
|
434
|
-
|
|
435
|
-
c.value =
|
|
436
|
-
}, { deep: !0 }),
|
|
437
|
-
I.value =
|
|
438
|
-
}, { deep: !0 }),
|
|
439
|
-
P.value =
|
|
440
|
-
}, { deep: !0 }),
|
|
441
|
-
x.value =
|
|
434
|
+
const c = m(W(a.createButton, p.defaultCreateButton)), I = m(W(a.updateButton, p.defaultUpdateButton)), P = m(W(a.dropButton, p.defaultDropButton)), x = m(W(a.editModeButton, p.defaultEditModeButton)), ne = m(W(a.groupButton, p.defaultGroupButton));
|
|
435
|
+
D(() => a.createButton, (t) => {
|
|
436
|
+
c.value = W(t, p.defaultCreateButton);
|
|
437
|
+
}, { deep: !0 }), D(() => a.updateButton, (t) => {
|
|
438
|
+
I.value = W(t, p.defaultUpdateButton);
|
|
439
|
+
}, { deep: !0 }), D(() => a.dropButton, (t) => {
|
|
440
|
+
P.value = W(t, p.defaultDropButton);
|
|
441
|
+
}, { deep: !0 }), D(() => a.editModeButton, (t) => {
|
|
442
|
+
x.value = W(t, p.defaultEditModeButton);
|
|
442
443
|
}, { deep: !0 });
|
|
443
444
|
const ee = async () => {
|
|
444
445
|
y("fetchItem"), s.value = !0, A.value = -1, M.value = !1;
|
|
@@ -454,22 +455,22 @@ const y = (...T) => {
|
|
|
454
455
|
return;
|
|
455
456
|
}
|
|
456
457
|
};
|
|
457
|
-
|
|
458
|
+
D(() => a.modelValue, (t) => {
|
|
458
459
|
i.value = t, k.value.increment(t);
|
|
459
|
-
}, { deep: !0 }),
|
|
460
|
-
if (
|
|
460
|
+
}, { deep: !0 }), D(i, (t) => {
|
|
461
|
+
if (K.value = !0, y("item updated ->", i.value), typeof a.beforeEmitUpdate == "function") {
|
|
461
462
|
y("item updated -> has beforeEmitUpdate");
|
|
462
463
|
let o = a.beforeEmitUpdate(i.value);
|
|
463
464
|
y("item updated -> override with: ", o), typeof o == "object" && (i.value = o);
|
|
464
465
|
}
|
|
465
|
-
r("update:modelValue", i.value), y("item updated -> update dataState"), k.value.increment(t), w.value = k.value.changed(), $e(() =>
|
|
466
|
-
}, { deep: !0 }),
|
|
466
|
+
r("update:modelValue", i.value), y("item updated -> update dataState"), k.value.increment(t), w.value = k.value.changed(), $e(() => K.value = !1);
|
|
467
|
+
}, { deep: !0 }), D(f, () => r("perms", f.value)), D(w, (t) => {
|
|
467
468
|
r("modified-data", t);
|
|
468
|
-
}),
|
|
469
|
+
}), D(() => a.readData, (t) => {
|
|
469
470
|
_.value.increment(t), _.value.changed() && ee();
|
|
470
|
-
}),
|
|
471
|
+
}), D(() => a.editing, (t) => {
|
|
471
472
|
y("editing updated -> updating editMode", t), l.value = t;
|
|
472
|
-
}),
|
|
473
|
+
}), D(l, (t) => {
|
|
473
474
|
y("editMode updated -> emit update", t), r("update:editing", t);
|
|
474
475
|
}), Ee(() => {
|
|
475
476
|
a.readResource && !j.value ? ee() : (j.value, B.value = !0, l.value = !0, s.value = !1, k.value.increment(i.value).turnStoredIntoOriginal(), w.value = k.value.changed());
|
|
@@ -482,10 +483,10 @@ const y = (...T) => {
|
|
|
482
483
|
}
|
|
483
484
|
return !0;
|
|
484
485
|
}, ge = (t) => {
|
|
485
|
-
y("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId && (y("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), pe.value ? (y("doAutoReloadId -> insideModal: ", a),
|
|
486
|
+
y("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId && (y("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), pe.value ? (y("doAutoReloadId -> insideModal: ", a), We(a.modalConfig.modalName, a.modalConfig.modalKey, t.autoReloadId)) : (y("doAutoReloadId -> outsideModal"), a.readData.id = t.autoReloadId, y("doAutoReloadId -> turning off create mode"), j.value = !1, ee()));
|
|
486
487
|
}, re = (t, o) => {
|
|
487
488
|
if (y("onCreate"), !de(o, c.value.resource)) {
|
|
488
|
-
a.notificationType ===
|
|
489
|
+
a.notificationType === F.Toast && J({
|
|
489
490
|
text: p.defaultCreateErrorText,
|
|
490
491
|
details: p.defaultCreateErrorDetails,
|
|
491
492
|
icon: p.defaultCreateErrorIcon,
|
|
@@ -493,7 +494,7 @@ const y = (...T) => {
|
|
|
493
494
|
});
|
|
494
495
|
return;
|
|
495
496
|
}
|
|
496
|
-
O.value = !0, y("onCreate -> turn stored data into original"), k.value.increment(i.value).turnStoredIntoOriginal(), a.notificationType ===
|
|
497
|
+
O.value = !0, y("onCreate -> turn stored data into original"), k.value.increment(i.value).turnStoredIntoOriginal(), a.notificationType === F.Toast && J({
|
|
497
498
|
text: p.defaultCreateSuccessText,
|
|
498
499
|
details: p.defaultCreateSuccessDetails,
|
|
499
500
|
icon: p.defaultCreateSuccessIcon,
|
|
@@ -501,7 +502,7 @@ const y = (...T) => {
|
|
|
501
502
|
}), ge(o), y("onCreate -> beforeEmitCreate"), r("create", o);
|
|
502
503
|
}, le = (t, o) => {
|
|
503
504
|
if (y("onUpdate"), !de(o, I.value.resource)) {
|
|
504
|
-
a.notificationType ===
|
|
505
|
+
a.notificationType === F.Toast && J({
|
|
505
506
|
text: p.defaultUpdateErrorText,
|
|
506
507
|
details: p.defaultUpdateErrorDetails,
|
|
507
508
|
icon: p.defaultUpdateErrorIcon,
|
|
@@ -509,7 +510,7 @@ const y = (...T) => {
|
|
|
509
510
|
});
|
|
510
511
|
return;
|
|
511
512
|
}
|
|
512
|
-
y("onUpdate -> turn stored data into original"), k.value.turnStoredIntoOriginal(), a.notificationType ===
|
|
513
|
+
y("onUpdate -> turn stored data into original"), k.value.turnStoredIntoOriginal(), a.notificationType === F.Toast && J({
|
|
513
514
|
text: p.defaultUpdateSuccessText,
|
|
514
515
|
details: p.defaultUpdateSuccessDetails,
|
|
515
516
|
icon: p.defaultUpdateSuccessIcon,
|
|
@@ -517,7 +518,7 @@ const y = (...T) => {
|
|
|
517
518
|
}), ge(o), r("update", o);
|
|
518
519
|
}, ie = (t, o) => {
|
|
519
520
|
if (y("onDrop"), !de(o, P.value.resource)) {
|
|
520
|
-
a.notificationType ===
|
|
521
|
+
a.notificationType === F.Toast && J({
|
|
521
522
|
text: p.defaultDropErrorText,
|
|
522
523
|
details: p.defaultDropErrorDetails,
|
|
523
524
|
icon: p.defaultDropErrorIcon,
|
|
@@ -525,12 +526,12 @@ const y = (...T) => {
|
|
|
525
526
|
});
|
|
526
527
|
return;
|
|
527
528
|
}
|
|
528
|
-
a.notificationType ===
|
|
529
|
+
a.notificationType === F.Toast && J({
|
|
529
530
|
text: p.defaultDropSuccessText,
|
|
530
531
|
details: p.defaultDropSuccessDetails,
|
|
531
532
|
icon: p.defaultDropSuccessIcon,
|
|
532
533
|
positionX: z.Right
|
|
533
|
-
}), r("drop", o), a.view ===
|
|
534
|
+
}), r("drop", o), a.view === De.Modal && (y("onDrop -> close modal"), Xe(a.modalConfig.modalName, a.modalConfig.modalKey));
|
|
534
535
|
};
|
|
535
536
|
Z({
|
|
536
537
|
doDrop: () => {
|
|
@@ -555,12 +556,12 @@ const y = (...T) => {
|
|
|
555
556
|
...t,
|
|
556
557
|
itemCreated: O.value
|
|
557
558
|
});
|
|
558
|
-
}, se = U(() => a.title.startsWith("__:") ? String(
|
|
559
|
+
}, se = U(() => a.title.startsWith("__:") ? String(Ke(a.title.substring(3))) : a.title), Te = U(() => s.value ? !1 : se.value.length > 0 || !!n["post-title"]), pe = U(() => a.view === De.Modal), ye = U(() => pe.value ? "lkt-modal" : "section"), te = U(() => {
|
|
559
560
|
var t, o;
|
|
560
|
-
return a.mode !== S.Update || !
|
|
561
|
+
return a.mode !== S.Update || !G.value || !a.enabledSaveWithoutChanges && !w.value ? !1 : typeof ((t = I.value) == null ? void 0 : t.disabled) == "function" ? !I.value.disabled(i.value) : typeof ((o = I.value) == null ? void 0 : o.disabled) == "boolean" ? !I.value.disabled : !0;
|
|
561
562
|
}), ae = U(() => {
|
|
562
563
|
var t, o;
|
|
563
|
-
return a.mode !== S.Create || !w.value ? !1 : typeof ((t = c.value) == null ? void 0 : t.disabled) == "function" ? !c.value.disabled(i.value) : typeof ((o = c.value) == null ? void 0 : o.disabled) == "boolean" ? !c.value.disabled : !0;
|
|
564
|
+
return a.mode !== S.Create || !a.enabledSaveWithoutChanges && !w.value ? !1 : typeof ((t = c.value) == null ? void 0 : t.disabled) == "function" ? !c.value.disabled(i.value) : typeof ((o = c.value) == null ? void 0 : o.disabled) == "boolean" ? !c.value.disabled : !0;
|
|
564
565
|
}), ve = U(() => {
|
|
565
566
|
var t, o;
|
|
566
567
|
return e.value ? typeof ((t = P.value) == null ? void 0 : t.disabled) == "function" ? !P.value.disabled(i.value) : typeof ((o = P.value) == null ? void 0 : o.disabled) == "boolean" ? !P.value.disabled : !0 : !1;
|
|
@@ -614,9 +615,9 @@ const y = (...T) => {
|
|
|
614
615
|
"group-button": ne.value,
|
|
615
616
|
"data-changed": w.value,
|
|
616
617
|
"http-success-read": B.value,
|
|
617
|
-
"can-update":
|
|
618
|
+
"can-update": G.value,
|
|
618
619
|
"can-drop": e.value,
|
|
619
|
-
"can-switch-edit-mode":
|
|
620
|
+
"can-switch-edit-mode": h.value,
|
|
620
621
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
621
622
|
"able-to-create": ae.value,
|
|
622
623
|
"able-to-update": te.value,
|
|
@@ -628,22 +629,22 @@ const y = (...T) => {
|
|
|
628
629
|
}, oe({ _: 2 }, [
|
|
629
630
|
u(n)["prev-buttons-ever"] ? {
|
|
630
631
|
name: "prev-buttons-ever",
|
|
631
|
-
fn: C(({ canUpdate: g, canDrop:
|
|
632
|
+
fn: C(({ canUpdate: g, canDrop: q, perms: H }) => [
|
|
632
633
|
v(t.$slots, "prev-buttons-ever", {
|
|
633
634
|
canUpdate: g,
|
|
634
|
-
canDrop:
|
|
635
|
-
perms:
|
|
635
|
+
canDrop: q,
|
|
636
|
+
perms: H
|
|
636
637
|
})
|
|
637
638
|
]),
|
|
638
639
|
key: "0"
|
|
639
640
|
} : void 0,
|
|
640
641
|
u(n)["prev-buttons"] ? {
|
|
641
642
|
name: "prev-buttons",
|
|
642
|
-
fn: C(({ canUpdate: g, canDrop:
|
|
643
|
+
fn: C(({ canUpdate: g, canDrop: q, perms: H }) => [
|
|
643
644
|
v(t.$slots, "prev-buttons", {
|
|
644
645
|
canUpdate: g,
|
|
645
|
-
canDrop:
|
|
646
|
-
perms:
|
|
646
|
+
canDrop: q,
|
|
647
|
+
perms: H
|
|
647
648
|
})
|
|
648
649
|
]),
|
|
649
650
|
key: "1"
|
|
@@ -651,7 +652,7 @@ const y = (...T) => {
|
|
|
651
652
|
]), 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),
|
|
652
653
|
s.value ? d("", !0) : (b(), N("div", _e, [
|
|
653
654
|
B.value ? (b(), N("div", xe, [
|
|
654
|
-
M.value && t.notificationType === u(
|
|
655
|
+
M.value && t.notificationType === u(F).Inline ? (b(), V(Be, {
|
|
655
656
|
key: 0,
|
|
656
657
|
code: A.value,
|
|
657
658
|
palette: A.value === 200 ? "success" : "danger",
|
|
@@ -664,12 +665,12 @@ const y = (...T) => {
|
|
|
664
665
|
loading: s.value,
|
|
665
666
|
editMode: l.value,
|
|
666
667
|
isCreate: j.value,
|
|
667
|
-
canUpdate:
|
|
668
|
+
canUpdate: G.value,
|
|
668
669
|
canDrop: e.value,
|
|
669
|
-
itemBeingEdited:
|
|
670
|
+
itemBeingEdited: K.value,
|
|
670
671
|
perms: f.value
|
|
671
672
|
})
|
|
672
|
-
])) : t.notificationType === u(
|
|
673
|
+
])) : t.notificationType === u(F).Inline ? (b(), V(Be, {
|
|
673
674
|
key: 1,
|
|
674
675
|
code: A.value
|
|
675
676
|
}, null, 8, ["code"])) : d("", !0)
|
|
@@ -695,9 +696,9 @@ const y = (...T) => {
|
|
|
695
696
|
"group-button": ne.value,
|
|
696
697
|
"data-changed": w.value,
|
|
697
698
|
"http-success-read": B.value,
|
|
698
|
-
"can-update":
|
|
699
|
+
"can-update": G.value,
|
|
699
700
|
"can-drop": e.value,
|
|
700
|
-
"can-switch-edit-mode":
|
|
701
|
+
"can-switch-edit-mode": h.value,
|
|
701
702
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
702
703
|
"able-to-create": ae.value,
|
|
703
704
|
"able-to-update": te.value,
|
|
@@ -749,9 +750,9 @@ const y = (...T) => {
|
|
|
749
750
|
"group-button": ne.value,
|
|
750
751
|
"data-changed": w.value,
|
|
751
752
|
"http-success-read": B.value,
|
|
752
|
-
"can-update":
|
|
753
|
+
"can-update": G.value,
|
|
753
754
|
"can-drop": e.value,
|
|
754
|
-
"can-switch-edit-mode":
|
|
755
|
+
"can-switch-edit-mode": h.value,
|
|
755
756
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
756
757
|
"able-to-create": ae.value,
|
|
757
758
|
"able-to-update": te.value,
|
|
@@ -763,22 +764,22 @@ const y = (...T) => {
|
|
|
763
764
|
}, oe({ _: 2 }, [
|
|
764
765
|
u(n)["prev-buttons-ever"] ? {
|
|
765
766
|
name: "prev-buttons-ever",
|
|
766
|
-
fn: C(({ canUpdate: g, canDrop:
|
|
767
|
+
fn: C(({ canUpdate: g, canDrop: q, perms: H }) => [
|
|
767
768
|
v(t.$slots, "prev-buttons-ever", {
|
|
768
769
|
canUpdate: g,
|
|
769
|
-
canDrop:
|
|
770
|
-
perms:
|
|
770
|
+
canDrop: q,
|
|
771
|
+
perms: H
|
|
771
772
|
})
|
|
772
773
|
]),
|
|
773
774
|
key: "0"
|
|
774
775
|
} : void 0,
|
|
775
776
|
u(n)["prev-buttons"] ? {
|
|
776
777
|
name: "prev-buttons",
|
|
777
|
-
fn: C(({ canUpdate: g, canDrop:
|
|
778
|
+
fn: C(({ canUpdate: g, canDrop: q, perms: H }) => [
|
|
778
779
|
v(t.$slots, "prev-buttons", {
|
|
779
780
|
canUpdate: g,
|
|
780
|
-
canDrop:
|
|
781
|
-
perms:
|
|
781
|
+
canDrop: q,
|
|
782
|
+
perms: H
|
|
782
783
|
})
|
|
783
784
|
]),
|
|
784
785
|
key: "1"
|
|
@@ -100,6 +100,7 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
|
100
100
|
readData: LktObject;
|
|
101
101
|
beforeEmitUpdate: Function;
|
|
102
102
|
notificationType: NotificationType;
|
|
103
|
+
enabledSaveWithoutChanges: boolean;
|
|
103
104
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
104
105
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
105
106
|
export default _default;
|
package/package.json
CHANGED
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
}),
|
|
352
352
|
ableToUpdate = computed(() => {
|
|
353
353
|
if (props.mode !== ItemCrudMode.Update || !canUpdate.value) return false;
|
|
354
|
-
if (!dataChanged.value) return false;
|
|
354
|
+
if (!props.enabledSaveWithoutChanges && !dataChanged.value) return false;
|
|
355
355
|
|
|
356
356
|
if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled(item.value);
|
|
357
357
|
if (typeof safeUpdateButton.value?.disabled === 'boolean') return !safeUpdateButton.value.disabled;
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
}),
|
|
361
361
|
ableToCreate = computed(() => {
|
|
362
362
|
if (props.mode !== ItemCrudMode.Create) return false;
|
|
363
|
-
if (!dataChanged.value) return false;
|
|
363
|
+
if (!props.enabledSaveWithoutChanges && !dataChanged.value) return false;
|
|
364
364
|
|
|
365
365
|
if (typeof safeCreateButton.value?.disabled === 'function') return !safeCreateButton.value.disabled(item.value);
|
|
366
366
|
if (typeof safeCreateButton.value?.disabled === 'boolean') return !safeCreateButton.value.disabled;
|