lkt-item-crud 2.0.33 → 2.0.35
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 +134 -121
- package/dist/functions/modifications-functions.d.ts +1 -3
- package/package.json +1 -1
- package/src/lib-components/LktItemCrud.vue +21 -12
package/dist/build.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare function
|
|
2
|
-
declare namespace
|
|
1
|
+
declare function $t($?: boolean): void;
|
|
2
|
+
declare namespace jt {
|
|
3
3
|
function install($: any, ke?: {}): void;
|
|
4
4
|
}
|
|
5
|
-
declare function Xt($: any): void;
|
|
6
5
|
declare function Pt($: any): void;
|
|
7
|
-
|
|
6
|
+
declare function Ft($: any): void;
|
|
7
|
+
export { $t as debugLktItemCrud, jt as default, Pt as setItemCrudDefaultDropIcon, Ft as setItemCrudDefaultSaveIcon };
|
package/dist/build.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { defineComponent as Je, ref as p, watch as C, useSlots as Qe, computed as b, resolveComponent as Be, createElementBlock as S, createCommentVNode as w, openBlock as n, createBlock as g, Fragment as F, renderSlot as I, withDirectives as B, mergeProps as v, normalizeProps as Me, unref as d, renderList as K, vShow as y, createVNode as J, withCtx as
|
|
1
|
+
import { defineComponent as Je, ref as p, watch as C, useSlots as Qe, computed as b, resolveComponent as Be, createElementBlock as S, createCommentVNode as w, openBlock as n, createBlock as g, Fragment as F, renderSlot as I, withDirectives as B, mergeProps as v, normalizeProps as Me, unref as d, renderList as K, vShow as y, createVNode as J, withCtx as x, mergeDefaults as nt, nextTick as Ge, onMounted as ut, resolveDynamicComponent as it, createSlots as ge, toDisplayString as lt } from "vue";
|
|
2
2
|
import { httpCall as rt } from "lkt-http-client";
|
|
3
3
|
import { DataState as je } from "lkt-data-state";
|
|
4
|
-
import { ModificationView as U, ItemCrudMode as V, ItemCrudButtonNavVisibility as qe, ButtonType as Fe, TablePermission as Ue, ensureButtonConfig as
|
|
5
|
-
import { closeModal as
|
|
6
|
-
import { __ as mt } from "lkt-i18n";
|
|
4
|
+
import { ModificationView as U, ItemCrudMode as V, ItemCrudButtonNavVisibility as qe, ButtonType as Fe, TablePermission as Ue, ensureButtonConfig as _, LktSettings as k, getFormDataState as dt, extractI18nValue as st, ItemCrudView as ze, getFormSlotKeys as vt, ItemCrudButtonNavPosition as Pe, NotificationType as ue, getDefaultValues as pt, ItemCrud as ft, ToastPositionX as fe } from "lkt-vue-kernel";
|
|
5
|
+
import { closeModal as ct, updateModalKey as mt } from "lkt-modal";
|
|
7
6
|
import { openToast as ce } from "lkt-toast";
|
|
8
7
|
import { useRouter as bt } from "vue-router";
|
|
9
8
|
const ye = class ye {
|
|
10
9
|
};
|
|
11
10
|
ye.debugEnabled = !1, ye.defaultSaveIcon = "", ye.defaultDropIcon = "";
|
|
12
11
|
let me = ye;
|
|
13
|
-
const
|
|
12
|
+
const E = (...$) => {
|
|
14
13
|
me.debugEnabled && console.info("[LktItemCrud] ", ...$);
|
|
15
|
-
},
|
|
14
|
+
}, $t = ($ = !0) => {
|
|
16
15
|
me.debugEnabled = $;
|
|
17
16
|
}, gt = {
|
|
18
17
|
key: 0,
|
|
@@ -72,19 +71,19 @@ const T = (...$) => {
|
|
|
72
71
|
"drop"
|
|
73
72
|
],
|
|
74
73
|
setup($, { expose: ke, emit: Ee }) {
|
|
75
|
-
const a = Ee, u = $,
|
|
76
|
-
C(() => u.pickedModificationView, (e) =>
|
|
74
|
+
const a = Ee, u = $, A = p(u.pickedModificationView);
|
|
75
|
+
C(() => u.pickedModificationView, (e) => A.value = e), C(A, (e) => a("update:pickedModificationView", e));
|
|
77
76
|
const h = Qe(), f = p(null), s = p(null), i = p(u.loading);
|
|
78
77
|
C(() => u.loading, (e) => i.value = e), C(i, (e) => a("update:loading", e));
|
|
79
|
-
const
|
|
80
|
-
C(() => u.editing, (e) =>
|
|
78
|
+
const T = p(u.editing);
|
|
79
|
+
C(() => u.editing, (e) => T.value = e), C(T, (e) => a("update:editing", e));
|
|
81
80
|
const m = () => {
|
|
82
81
|
i.value = !0;
|
|
83
82
|
}, D = () => {
|
|
84
83
|
i.value = !1;
|
|
85
84
|
}, Q = (e, L) => {
|
|
86
85
|
typeof e > "u" || a("create", e, L);
|
|
87
|
-
},
|
|
86
|
+
}, ee = (e, L) => {
|
|
88
87
|
typeof e > "u" || a("save", e, L);
|
|
89
88
|
}, P = (e, L) => {
|
|
90
89
|
typeof e > "u" || a("drop", e, L);
|
|
@@ -97,7 +96,7 @@ const T = (...$) => {
|
|
|
97
96
|
s.value && typeof s.value.click == "function" && s.value.click();
|
|
98
97
|
}
|
|
99
98
|
});
|
|
100
|
-
const W = b(() => !u.canDrop || u.dropButton === !1 ? !1 : !u.canUpdate && u.canDrop ? !0 : !i.value && u.editing && u.httpSuccessRead), M = b(() => u.mode === V.Create && (u.createButton === !1 || !u.canCreate) || u.mode === V.Update && (u.updateButton === !1 || !u.canUpdate) || i.value ? !1 : u.editing && u.httpSuccessRead),
|
|
99
|
+
const W = b(() => !u.canDrop || u.dropButton === !1 ? !1 : !u.canUpdate && u.canDrop ? !0 : !i.value && u.editing && u.httpSuccessRead), M = b(() => u.mode === V.Create && (u.createButton === !1 || !u.canCreate) || u.mode === V.Update && (u.updateButton === !1 || !u.canUpdate) || i.value ? !1 : u.editing && u.httpSuccessRead), ne = b(() => u.editModeButton === !1 || !u.canSwitchEditMode || !u.canUpdate && !u.canDrop || !u.canUpdate && u.canDrop ? !1 : !i.value && u.mode !== V.Create && u.httpSuccessRead), Y = b(() => u.buttonNavVisibility === qe.Always || h["prev-buttons-ever"] ? !0 : u.buttonNavVisibility === qe.Never ? !1 : M.value || W.value || ne.value), G = b(() => u.modificationView === !1 ? [] : u.modificationView === !0 ? [
|
|
101
100
|
U.Current,
|
|
102
101
|
U.Modifications,
|
|
103
102
|
U.SplitView,
|
|
@@ -107,49 +106,49 @@ const T = (...$) => {
|
|
|
107
106
|
return G.value.includes(U.Current) && e.push({
|
|
108
107
|
text: "Current",
|
|
109
108
|
icon: "lkt-icn-see",
|
|
110
|
-
disabled:
|
|
109
|
+
disabled: A.value === U.Current,
|
|
111
110
|
events: {
|
|
112
111
|
click: () => {
|
|
113
|
-
|
|
112
|
+
A.value = U.Current;
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
}), G.value.includes(U.Modifications) && e.push({
|
|
117
116
|
text: "Modifications",
|
|
118
117
|
icon: "lkt-icn-edit",
|
|
119
|
-
disabled:
|
|
118
|
+
disabled: A.value === U.Modifications,
|
|
120
119
|
events: {
|
|
121
120
|
click: () => {
|
|
122
|
-
|
|
121
|
+
A.value = U.Modifications;
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
}), G.value.includes(U.SplitView) && e.push({
|
|
126
125
|
text: "Split View",
|
|
127
126
|
icon: "lkt-icn-columns",
|
|
128
|
-
disabled:
|
|
127
|
+
disabled: A.value === U.SplitView,
|
|
129
128
|
events: {
|
|
130
129
|
click: () => {
|
|
131
|
-
|
|
130
|
+
A.value = U.SplitView;
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
}), G.value.includes(U.Differences) && e.push({
|
|
135
134
|
text: "Differences",
|
|
136
135
|
icon: "lkt-icn-balance",
|
|
137
|
-
disabled:
|
|
136
|
+
disabled: A.value === U.Differences,
|
|
138
137
|
events: {
|
|
139
138
|
click: () => {
|
|
140
|
-
|
|
139
|
+
A.value = U.Differences;
|
|
141
140
|
}
|
|
142
141
|
}
|
|
143
142
|
}), e;
|
|
144
143
|
});
|
|
145
144
|
return (e, L) => {
|
|
146
|
-
var
|
|
145
|
+
var ae, oe, ve, j, q, pe;
|
|
147
146
|
const l = Be("lkt-button");
|
|
148
147
|
return Y.value ? (n(), S("div", gt, [
|
|
149
148
|
e.grouped && e.groupButtonAsModalActions ? (n(), S(F, { key: 0 }, [
|
|
150
|
-
|
|
151
|
-
checked:
|
|
152
|
-
"onUpdate:checked": L[0] || (L[0] = (c) =>
|
|
149
|
+
ne.value ? (n(), g(l, v({ key: 0 }, e.editModeButton, {
|
|
150
|
+
checked: T.value,
|
|
151
|
+
"onUpdate:checked": L[0] || (L[0] = (c) => T.value = c),
|
|
153
152
|
class: "lkt-item-crud--switch-mode-button"
|
|
154
153
|
}), null, 16, ["checked"])) : w("", !0),
|
|
155
154
|
G.value.length > 0 ? (n(), g(l, Me(v({ key: 1 }, {
|
|
@@ -171,7 +170,7 @@ const T = (...$) => {
|
|
|
171
170
|
perms: e.perms
|
|
172
171
|
}) : w("", !0),
|
|
173
172
|
(n(!0), S(F, null, K(e.navStartButtonsEditing, (c) => B((n(), g(l, v({ ref_for: !0 }, c), null, 16)), [
|
|
174
|
-
[y,
|
|
173
|
+
[y, T.value && !i.value]
|
|
175
174
|
])), 256)),
|
|
176
175
|
d(h)["prev-buttons"] ? I(e.$slots, "prev-buttons", {
|
|
177
176
|
key: 3,
|
|
@@ -185,14 +184,14 @@ const T = (...$) => {
|
|
|
185
184
|
}, {
|
|
186
185
|
...e.updateButton,
|
|
187
186
|
resourceData: {
|
|
188
|
-
...(
|
|
187
|
+
...(ae = e.updateButton) == null ? void 0 : ae.resourceData,
|
|
189
188
|
...N.value
|
|
190
189
|
},
|
|
191
190
|
disabled: !e.ableToUpdate
|
|
192
191
|
}, {
|
|
193
192
|
onLoading: m,
|
|
194
193
|
onLoaded: D,
|
|
195
|
-
onClick:
|
|
194
|
+
onClick: ee
|
|
196
195
|
}), null, 16), [
|
|
197
196
|
[y, e.mode === d(V).Update && M.value]
|
|
198
197
|
]),
|
|
@@ -202,7 +201,7 @@ const T = (...$) => {
|
|
|
202
201
|
}, {
|
|
203
202
|
...e.createButton,
|
|
204
203
|
resourceData: {
|
|
205
|
-
...(
|
|
204
|
+
...(oe = e.createButton) == null ? void 0 : oe.resourceData,
|
|
206
205
|
...N.value
|
|
207
206
|
},
|
|
208
207
|
disabled: !e.ableToCreate
|
|
@@ -246,18 +245,18 @@ const T = (...$) => {
|
|
|
246
245
|
[y, !i.value]
|
|
247
246
|
])), 256)),
|
|
248
247
|
(n(!0), S(F, null, K(e.navEndButtonsEditing, (c) => B((n(), g(l, v({ ref_for: !0 }, c), null, 16)), [
|
|
249
|
-
[y,
|
|
248
|
+
[y, T.value && !i.value]
|
|
250
249
|
])), 256))
|
|
251
250
|
], 64)) : e.grouped ? (n(), g(l, v({
|
|
252
251
|
key: 1,
|
|
253
252
|
ref: "groupButton"
|
|
254
253
|
}, e.groupButton, { class: "lkt-item-crud-group-button" }), {
|
|
255
|
-
split:
|
|
254
|
+
split: x(() => {
|
|
256
255
|
var c, z, ie;
|
|
257
256
|
return [
|
|
258
|
-
|
|
259
|
-
checked:
|
|
260
|
-
"onUpdate:checked": L[1] || (L[1] = (X) =>
|
|
257
|
+
ne.value ? (n(), g(l, v({ key: 0 }, e.editModeButton, {
|
|
258
|
+
checked: T.value,
|
|
259
|
+
"onUpdate:checked": L[1] || (L[1] = (X) => T.value = X),
|
|
261
260
|
class: "lkt-item-crud--switch-mode-button"
|
|
262
261
|
}), null, 16, ["checked"])) : w("", !0),
|
|
263
262
|
G.value.length > 0 ? (n(), g(l, Me(v({ key: 1 }, {
|
|
@@ -279,7 +278,7 @@ const T = (...$) => {
|
|
|
279
278
|
perms: e.perms
|
|
280
279
|
}) : w("", !0),
|
|
281
280
|
(n(!0), S(F, null, K(e.navStartButtonsEditing, (X) => B((n(), g(l, v({ ref_for: !0 }, X), null, 16)), [
|
|
282
|
-
[y,
|
|
281
|
+
[y, T.value && !i.value]
|
|
283
282
|
])), 256)),
|
|
284
283
|
d(h)["prev-buttons"] ? I(e.$slots, "prev-buttons", {
|
|
285
284
|
key: 3,
|
|
@@ -300,7 +299,7 @@ const T = (...$) => {
|
|
|
300
299
|
}, {
|
|
301
300
|
onLoading: m,
|
|
302
301
|
onLoaded: D,
|
|
303
|
-
onClick:
|
|
302
|
+
onClick: ee
|
|
304
303
|
}), null, 16), [
|
|
305
304
|
[y, e.mode === d(V).Update && M.value]
|
|
306
305
|
]),
|
|
@@ -356,7 +355,7 @@ const T = (...$) => {
|
|
|
356
355
|
[y, !i.value]
|
|
357
356
|
])), 256)),
|
|
358
357
|
(n(!0), S(F, null, K(e.navEndButtonsEditing, (X) => B((n(), g(l, v({ ref_for: !0 }, X), null, 16)), [
|
|
359
|
-
[y,
|
|
358
|
+
[y, T.value && !i.value]
|
|
360
359
|
])), 256))
|
|
361
360
|
];
|
|
362
361
|
}),
|
|
@@ -375,7 +374,7 @@ const T = (...$) => {
|
|
|
375
374
|
[y, !i.value]
|
|
376
375
|
]) : w("", !0),
|
|
377
376
|
(n(!0), S(F, null, K(e.navStartButtonsEditing, (c) => B((n(), g(l, v({ ref_for: !0 }, c), null, 16)), [
|
|
378
|
-
[y,
|
|
377
|
+
[y, T.value && !i.value]
|
|
379
378
|
])), 256)),
|
|
380
379
|
d(h)["prev-buttons"] ? B((n(), S("div", yt, [
|
|
381
380
|
I(e.$slots, "prev-buttons", {
|
|
@@ -384,7 +383,7 @@ const T = (...$) => {
|
|
|
384
383
|
perms: e.perms
|
|
385
384
|
})
|
|
386
385
|
], 512)), [
|
|
387
|
-
[y,
|
|
386
|
+
[y, T.value && !i.value]
|
|
388
387
|
]) : w("", !0),
|
|
389
388
|
B(J(l, v({
|
|
390
389
|
ref_key: "saveButtonRef",
|
|
@@ -399,7 +398,7 @@ const T = (...$) => {
|
|
|
399
398
|
}, {
|
|
400
399
|
onLoading: m,
|
|
401
400
|
onLoaded: D,
|
|
402
|
-
onClick:
|
|
401
|
+
onClick: ee
|
|
403
402
|
}), null, 16), [
|
|
404
403
|
[y, e.mode === d(V).Update && M.value]
|
|
405
404
|
]),
|
|
@@ -451,13 +450,13 @@ const T = (...$) => {
|
|
|
451
450
|
d(h).buttons ? B((n(), S("div", kt, [
|
|
452
451
|
I(e.$slots, "buttons")
|
|
453
452
|
], 512)), [
|
|
454
|
-
[y,
|
|
453
|
+
[y, T.value && !i.value]
|
|
455
454
|
]) : w("", !0),
|
|
456
455
|
(n(!0), S(F, null, K(e.navEndButtons, (c) => B((n(), g(l, v({ ref_for: !0 }, c), null, 16)), [
|
|
457
456
|
[y, !i.value]
|
|
458
457
|
])), 256)),
|
|
459
458
|
(n(!0), S(F, null, K(e.navEndButtonsEditing, (c) => B((n(), g(l, v({ ref_for: !0 }, c), null, 16)), [
|
|
460
|
-
[y,
|
|
459
|
+
[y, T.value && !i.value]
|
|
461
460
|
])), 256)),
|
|
462
461
|
G.value.length > 0 ? (n(), g(l, Me(v({ key: 3 }, {
|
|
463
462
|
type: d(Fe).Tooltip,
|
|
@@ -468,9 +467,9 @@ const T = (...$) => {
|
|
|
468
467
|
contentClass: "lkt-flex-column"
|
|
469
468
|
}
|
|
470
469
|
})), null, 16)) : w("", !0),
|
|
471
|
-
|
|
472
|
-
checked:
|
|
473
|
-
"onUpdate:checked": L[2] || (L[2] = (c) =>
|
|
470
|
+
ne.value ? (n(), g(l, v({ key: 4 }, e.editModeButton, {
|
|
471
|
+
checked: T.value,
|
|
472
|
+
"onUpdate:checked": L[2] || (L[2] = (c) => T.value = c),
|
|
474
473
|
class: "lkt-item-crud--switch-mode-button"
|
|
475
474
|
}), null, 16, ["checked"])) : w("", !0)
|
|
476
475
|
], 64))
|
|
@@ -536,7 +535,7 @@ const T = (...$) => {
|
|
|
536
535
|
navEndButtons: {},
|
|
537
536
|
navEndButtonsEditing: {},
|
|
538
537
|
events: {}
|
|
539
|
-
},
|
|
538
|
+
}, pt(ft)),
|
|
540
539
|
emits: [
|
|
541
540
|
"update:modelValue",
|
|
542
541
|
"update:editing",
|
|
@@ -554,7 +553,7 @@ const T = (...$) => {
|
|
|
554
553
|
"modified-data"
|
|
555
554
|
],
|
|
556
555
|
setup($, { expose: ke, emit: Ee }) {
|
|
557
|
-
const a = $, u = bt(),
|
|
556
|
+
const a = $, u = bt(), A = Qe(), h = Ee, f = p(!0), s = p(a.modelValue), i = p(a.modifications), T = p(a.customData), m = p(a.perms), D = p(a.editing), Q = p(!1), ee = p(!1), P = p(!1), N = p(!1), te = p(200), O = p(new je(s.value, a.dataStateConfig)), W = p(new je(i.value, a.dataStateConfig)), M = p(!1), ne = p(new je(a.readData)), Y = p(a.mode === V.Create), G = p(!1), se = p(!1), e = p(null), L = p(null), l = b(() => Y.value && a.createButton !== !1 && Array.isArray(m.value) && m.value.includes(Ue.Create)), ae = b(() => !Y.value && a.updateButton !== !1 && Array.isArray(m.value) && m.value.includes(Ue.Update)), oe = b(() => !Y.value && a.dropButton !== !1 && Array.isArray(m.value) && m.value.includes(Ue.Drop)), ve = b(() => a.editModeButton !== !1 && !Y.value && Array.isArray(m.value) && m.value.includes(Ue.SwitchEditMode)), j = p(a.visibleView);
|
|
558
557
|
C(() => a.visibleView, (t) => {
|
|
559
558
|
j.value = t;
|
|
560
559
|
}), C(j, (t) => {
|
|
@@ -566,42 +565,42 @@ const T = (...$) => {
|
|
|
566
565
|
}), C(m, (t) => {
|
|
567
566
|
h("update:perms", t);
|
|
568
567
|
}), C(() => a.customData, (t) => {
|
|
569
|
-
|
|
570
|
-
}), C(
|
|
568
|
+
T.value = t;
|
|
569
|
+
}), C(T, (t) => {
|
|
571
570
|
h("update:customData", t);
|
|
572
571
|
}), C(() => a.modifications, (t) => {
|
|
573
572
|
W.value.increment(t), i.value = t;
|
|
574
573
|
}, { deep: !0 }), C(i, (t) => {
|
|
575
574
|
Ae(), W.value.increment(t), le.value === U.Modifications && (M.value = W.value.changed()), h("update:modifications", t);
|
|
576
575
|
}, { deep: !0 });
|
|
577
|
-
const q = p(
|
|
576
|
+
const q = p(_(a.createButton, k.defaultCreateButton)), pe = p(_(a.createAndNewButton, a.createButton)), c = p(_(a.updateButton, k.defaultUpdateButton)), z = p(_(a.dropButton, k.defaultDropButton)), ie = p(_(a.editModeButton, k.defaultEditModeButton)), X = p(_(a.groupButton, k.defaultGroupButton));
|
|
578
577
|
C(() => a.createButton, (t) => {
|
|
579
|
-
q.value =
|
|
578
|
+
q.value = _(t, k.defaultCreateButton);
|
|
580
579
|
}, { deep: !0 }), C(() => a.updateButton, (t) => {
|
|
581
|
-
c.value =
|
|
580
|
+
c.value = _(t, k.defaultUpdateButton);
|
|
582
581
|
}, { deep: !0 }), C(() => a.dropButton, (t) => {
|
|
583
|
-
z.value =
|
|
582
|
+
z.value = _(t, k.defaultDropButton);
|
|
584
583
|
}, { deep: !0 }), C(() => a.editModeButton, (t) => {
|
|
585
|
-
ie.value =
|
|
584
|
+
ie.value = _(t, k.defaultEditModeButton);
|
|
586
585
|
}, { deep: !0 });
|
|
587
586
|
const Ce = async () => {
|
|
588
587
|
var t, o, H;
|
|
589
|
-
|
|
588
|
+
E("fetchItem"), f.value = !0, te.value = -1, N.value = !1, typeof ((t = a.events) == null ? void 0 : t.httpStart) == "function" && a.events.httpStart();
|
|
590
589
|
try {
|
|
591
590
|
const R = await rt(a.readResource, a.readData);
|
|
592
|
-
if (
|
|
593
|
-
P.value = !1,
|
|
591
|
+
if (E("fetchItem -> response", R), f.value = !1, te.value = R.httpStatus, T.value = R.custom, !R.success) {
|
|
592
|
+
P.value = !1, te.value = R.httpStatus, typeof ((o = a.events) == null ? void 0 : o.httpEnd) == "function" && a.events.httpEnd({
|
|
594
593
|
httpResponse: R
|
|
595
594
|
}), h("error", R.httpStatus);
|
|
596
595
|
return;
|
|
597
596
|
}
|
|
598
|
-
P.value = !0, s.value = R.data, i.value = Array.isArray(R.modifications) ? {} : R.modifications, m.value = R.perms, O.value.increment(s.value).turnStoredIntoOriginal(), W.value.increment(i.value).turnStoredIntoOriginal(), M.value = O.value.changed(),
|
|
597
|
+
P.value = !0, s.value = R.data, i.value = Array.isArray(R.modifications) ? {} : R.modifications, m.value = R.perms, O.value.increment(s.value).turnStoredIntoOriginal(), W.value.increment(i.value).turnStoredIntoOriginal(), M.value = O.value.changed(), ne.value.turnStoredIntoOriginal(), Object.keys(i.value).length > 0 && (j.value = U.Modifications), Z.value && (Ae(), Ge(() => {
|
|
599
598
|
L.value.turnStoredIntoOriginal();
|
|
600
599
|
})), typeof ((H = a.events) == null ? void 0 : H.httpEnd) == "function" && a.events.httpEnd({
|
|
601
600
|
httpResponse: R
|
|
602
601
|
}), h("read", R);
|
|
603
602
|
} catch {
|
|
604
|
-
f.value = !1, P.value = !1,
|
|
603
|
+
f.value = !1, P.value = !1, te.value = 404, h("error", 404);
|
|
605
604
|
return;
|
|
606
605
|
}
|
|
607
606
|
};
|
|
@@ -610,42 +609,42 @@ const T = (...$) => {
|
|
|
610
609
|
}), C(() => a.modelValue, (t) => {
|
|
611
610
|
s.value = t, O.value.increment(t);
|
|
612
611
|
}, { deep: !0 }), C(s, (t) => {
|
|
613
|
-
if (
|
|
614
|
-
|
|
612
|
+
if (E("item updated ->", s.value), typeof a.beforeEmitUpdate == "function") {
|
|
613
|
+
E("item updated -> has beforeEmitUpdate");
|
|
615
614
|
let o = a.beforeEmitUpdate(s.value);
|
|
616
|
-
|
|
615
|
+
E("item updated -> override with: ", o), typeof o == "object" && (s.value = o);
|
|
617
616
|
}
|
|
618
|
-
|
|
617
|
+
Z.value && Ae(), h("update:modelValue", s.value), E("item updated -> update dataState"), O.value.increment(t), le.value === U.Current && (M.value = O.value.changed(), E("item updated -> dataState changed")), G.value = !0;
|
|
619
618
|
}, { deep: !0 }), C(m, () => h("perms", m.value)), C(M, (t) => {
|
|
620
619
|
h("modified-data", t);
|
|
621
620
|
}), C(() => a.readData, (t) => {
|
|
622
|
-
|
|
621
|
+
ne.value.increment(t), ne.value.changed() && Ce();
|
|
623
622
|
}), C(() => a.editing, (t) => {
|
|
624
|
-
|
|
623
|
+
E("editing updated -> updating editMode", t), D.value = t;
|
|
625
624
|
}), C(D, (t) => {
|
|
626
|
-
|
|
625
|
+
E("editMode updated -> emit update", t), h("update:editing", t);
|
|
627
626
|
});
|
|
628
627
|
const He = p(void 0), Ae = () => {
|
|
629
|
-
|
|
628
|
+
Z.value && (He.value = dt(s.value, i.value, be.value));
|
|
630
629
|
};
|
|
631
630
|
ut(() => {
|
|
632
631
|
a.readResource && !Y.value ? Ce() : (Y.value, P.value = !0, D.value = !0, f.value = !1, O.value.increment(s.value).turnStoredIntoOriginal(), M.value = O.value.changed());
|
|
633
632
|
});
|
|
634
633
|
const Te = (t, o) => {
|
|
635
634
|
if (o) {
|
|
636
|
-
if (f.value = !1, typeof t < "u" && (
|
|
635
|
+
if (f.value = !1, typeof t < "u" && (te.value = t.httpStatus, !t.success))
|
|
637
636
|
return N.value = !0, h("error", t.httpStatus), !1;
|
|
638
637
|
N.value = !0;
|
|
639
638
|
}
|
|
640
639
|
return !0;
|
|
641
640
|
}, Ke = (t, o) => {
|
|
642
|
-
if (
|
|
643
|
-
if (
|
|
641
|
+
if (E("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId)
|
|
642
|
+
if (E("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), typeof o < "u") {
|
|
644
643
|
let H = o;
|
|
645
644
|
typeof o == "function" && (H = o(t.autoReloadId)), u.push(H);
|
|
646
|
-
} else we.value ? (
|
|
645
|
+
} else we.value ? (E("doAutoReloadId -> insideModal: ", a), mt(a.modalConfig.modalName, a.modalConfig.modalKey, t.autoReloadId)) : (E("doAutoReloadId -> outsideModal"), a.readData.id = t.autoReloadId, E("doAutoReloadId -> turning off create mode"), Y.value = !1, Ce());
|
|
647
646
|
}, Ve = (t, o) => {
|
|
648
|
-
if (
|
|
647
|
+
if (E("onCreate"), !Te(o, q.value.resource)) {
|
|
649
648
|
a.notificationType === ue.Toast && ce({
|
|
650
649
|
text: k.defaultCreateErrorText,
|
|
651
650
|
details: k.defaultCreateErrorDetails,
|
|
@@ -654,14 +653,14 @@ const T = (...$) => {
|
|
|
654
653
|
});
|
|
655
654
|
return;
|
|
656
655
|
}
|
|
657
|
-
se.value = !0,
|
|
656
|
+
se.value = !0, E("onCreate -> turn stored data into original"), O.value.increment(s.value).turnStoredIntoOriginal(), W.value.turnStoredIntoOriginal(), a.notificationType === ue.Toast && ce({
|
|
658
657
|
text: k.defaultCreateSuccessText,
|
|
659
658
|
details: k.defaultCreateSuccessDetails,
|
|
660
659
|
icon: k.defaultCreateSuccessIcon,
|
|
661
660
|
positionX: fe.Right
|
|
662
|
-
}), Ke(o, a.redirectOnCreate),
|
|
661
|
+
}), Ke(o, a.redirectOnCreate), E("onCreate -> beforeEmitCreate"), h("create", o);
|
|
663
662
|
}, Ie = (t, o) => {
|
|
664
|
-
if (
|
|
663
|
+
if (E("onUpdate"), !Te(o, c.value.resource)) {
|
|
665
664
|
a.notificationType === ue.Toast && ce({
|
|
666
665
|
text: k.defaultUpdateErrorText,
|
|
667
666
|
details: k.defaultUpdateErrorDetails,
|
|
@@ -670,14 +669,14 @@ const T = (...$) => {
|
|
|
670
669
|
});
|
|
671
670
|
return;
|
|
672
671
|
}
|
|
673
|
-
|
|
672
|
+
E("onUpdate -> turn stored data into original"), O.value.turnStoredIntoOriginal(), W.value.turnStoredIntoOriginal(), a.notificationType === ue.Toast && ce({
|
|
674
673
|
text: k.defaultUpdateSuccessText,
|
|
675
674
|
details: k.defaultUpdateSuccessDetails,
|
|
676
675
|
icon: k.defaultUpdateSuccessIcon,
|
|
677
676
|
positionX: fe.Right
|
|
678
677
|
}), Ke(o), h("update", o);
|
|
679
678
|
}, Re = (t, o) => {
|
|
680
|
-
if (
|
|
679
|
+
if (E("onDrop"), !Te(o, z.value.resource)) {
|
|
681
680
|
a.notificationType === ue.Toast && ce({
|
|
682
681
|
text: k.defaultDropErrorText,
|
|
683
682
|
details: k.defaultDropErrorDetails,
|
|
@@ -691,7 +690,7 @@ const T = (...$) => {
|
|
|
691
690
|
details: k.defaultDropSuccessDetails,
|
|
692
691
|
icon: k.defaultDropSuccessIcon,
|
|
693
692
|
positionX: fe.Right
|
|
694
|
-
}), h("drop", o), a.view === ze.Modal && (
|
|
693
|
+
}), h("drop", o), a.view === ze.Modal && (E("onDrop -> close modal"), ct(a.modalConfig.modalName, a.modalConfig.modalKey)), typeof a.redirectOnDrop < "u") {
|
|
695
694
|
let H = a.redirectOnDrop;
|
|
696
695
|
typeof a.redirectOnDrop == "function" && (H = a.redirectOnDrop()), u.push(H);
|
|
697
696
|
}
|
|
@@ -711,7 +710,7 @@ const T = (...$) => {
|
|
|
711
710
|
});
|
|
712
711
|
const Ye = b(() => {
|
|
713
712
|
var t, o, H;
|
|
714
|
-
return Se.value ?
|
|
713
|
+
return Se.value ? Z.value ? ee.value ? (t = a.modalConfig) == null ? void 0 : t.closeConfirm : "" : le.value === U.Modifications ? W.value.changed() ? (o = a.modalConfig) == null ? void 0 : o.closeConfirm : "" : O.value.changed() ? (H = a.modalConfig) == null ? void 0 : H.closeConfirm : "" : "";
|
|
715
714
|
}), Ze = (t) => {
|
|
716
715
|
var o;
|
|
717
716
|
if (typeof ((o = a.modalConfig) == null ? void 0 : o.beforeClose) == "function")
|
|
@@ -719,19 +718,33 @@ const T = (...$) => {
|
|
|
719
718
|
...t,
|
|
720
719
|
itemCreated: se.value
|
|
721
720
|
});
|
|
722
|
-
}, Ne = b(() =>
|
|
721
|
+
}, Ne = b(() => st(a.title)), _e = b(() => f.value ? !1 : Ne.value.length > 0 || !!A["post-title"]), xe = b(() => f.value ? !1 : typeof a.header == "object" && Object.keys(a.header).length > 0), we = b(() => a.view === ze.Modal), We = b(() => we.value ? "lkt-modal" : "section"), he = b(() => {
|
|
723
722
|
var t, o;
|
|
724
|
-
|
|
723
|
+
if (a.mode !== V.Update || !ae.value || !(Z.value && Q.value)) return !1;
|
|
724
|
+
if (!a.enabledSaveWithoutChanges) {
|
|
725
|
+
if (Z.value) {
|
|
726
|
+
if (!ee.value) return !1;
|
|
727
|
+
} else if (!M.value)
|
|
728
|
+
return !1;
|
|
729
|
+
}
|
|
730
|
+
return typeof ((t = c.value) == null ? void 0 : t.disabled) == "function" ? !c.value.disabled({
|
|
725
731
|
prop: s.value
|
|
726
732
|
}) : typeof ((o = c.value) == null ? void 0 : o.disabled) == "boolean" ? !c.value.disabled : !0;
|
|
727
733
|
}), De = b(() => {
|
|
728
734
|
var t, o;
|
|
729
|
-
|
|
735
|
+
if (a.mode !== V.Create || !l.value || !(Z.value && Q.value)) return !1;
|
|
736
|
+
if (!a.enabledSaveWithoutChanges) {
|
|
737
|
+
if (Z.value) {
|
|
738
|
+
if (!ee.value) return !1;
|
|
739
|
+
} else if (!M.value)
|
|
740
|
+
return !1;
|
|
741
|
+
}
|
|
742
|
+
return typeof ((t = q.value) == null ? void 0 : t.disabled) == "function" ? !q.value.disabled({
|
|
730
743
|
prop: s.value
|
|
731
744
|
}) : typeof ((o = q.value) == null ? void 0 : o.disabled) == "boolean" ? !q.value.disabled : !0;
|
|
732
745
|
}), Oe = b(() => a.createAndNewButton !== !1 && typeof a.createAndNewButton == "object" && !Array.isArray(a.createAndNewButton) && Object.keys(a.createAndNewButton).length > 0), Le = b(() => {
|
|
733
746
|
var t, o;
|
|
734
|
-
return
|
|
747
|
+
return oe.value ? typeof ((t = z.value) == null ? void 0 : t.disabled) == "function" ? !z.value.disabled({
|
|
735
748
|
prop: s.value
|
|
736
749
|
}) : typeof ((o = z.value) == null ? void 0 : o.disabled) == "boolean" ? !z.value.disabled : !0 : !1;
|
|
737
750
|
}), et = b(() => We.value === "lkt-modal" ? {
|
|
@@ -743,7 +756,7 @@ const T = (...$) => {
|
|
|
743
756
|
headerActionsButton: a.groupButton !== !1 ? {
|
|
744
757
|
dot: De.value || he.value
|
|
745
758
|
} : !1
|
|
746
|
-
} : {}),
|
|
759
|
+
} : {}), Z = b(() => typeof be.value == "object" && Object.keys(be.value).length > 0), $e = b(() => Object.keys(i.value).length === 0 ? [] : a.modificationViews), le = b(() => Object.keys(i.value).length === 0 ? U.Current : U.Modifications), Se = b(() => l.value || ae.value || oe.value), tt = b(() => Z.value ? vt(be.value) : []), be = b(() => typeof a.form == "function" ? a.form({
|
|
747
760
|
mode: a.mode,
|
|
748
761
|
view: j.value,
|
|
749
762
|
item: s.value,
|
|
@@ -753,16 +766,16 @@ const T = (...$) => {
|
|
|
753
766
|
return (t, o) => {
|
|
754
767
|
const H = Be("lkt-header"), R = Be("lkt-http-info"), at = Be("lkt-form"), ot = Be("lkt-loader");
|
|
755
768
|
return n(), g(it(We.value), v(et.value, { class: "lkt-item-crud" }), ge({
|
|
756
|
-
default:
|
|
769
|
+
default: x(() => [
|
|
757
770
|
!we.value && xe.value ? (n(), g(H, Me(v({ key: 0 }, t.header)), null, 16)) : !we.value && _e.value ? (n(), S("header", Ct, [
|
|
758
|
-
d(
|
|
771
|
+
d(A)["pre-title"] ? (n(), S("div", wt, [
|
|
759
772
|
I(t.$slots, "pre-title", {
|
|
760
773
|
item: s.value,
|
|
761
774
|
loading: f.value
|
|
762
775
|
})
|
|
763
776
|
])) : w("", !0),
|
|
764
777
|
Ne.value.length > 0 ? (n(), S("h1", ht, lt(Ne.value), 1)) : w("", !0),
|
|
765
|
-
d(
|
|
778
|
+
d(A)["post-title"] ? (n(), S("div", Dt, [
|
|
766
779
|
I(t.$slots, "post-title", {
|
|
767
780
|
item: s.value,
|
|
768
781
|
loading: f.value
|
|
@@ -794,8 +807,8 @@ const T = (...$) => {
|
|
|
794
807
|
"data-changed": M.value,
|
|
795
808
|
"http-success-read": P.value,
|
|
796
809
|
"can-create": l.value,
|
|
797
|
-
"can-update":
|
|
798
|
-
"can-drop":
|
|
810
|
+
"can-update": ae.value,
|
|
811
|
+
"can-drop": oe.value,
|
|
799
812
|
"can-switch-edit-mode": ve.value,
|
|
800
813
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
801
814
|
"able-to-create": De.value,
|
|
@@ -813,9 +826,9 @@ const T = (...$) => {
|
|
|
813
826
|
onSave: Ie,
|
|
814
827
|
onDrop: Re
|
|
815
828
|
}, ge({ _: 2 }, [
|
|
816
|
-
d(
|
|
829
|
+
d(A)["prev-buttons-ever"] ? {
|
|
817
830
|
name: "prev-buttons-ever",
|
|
818
|
-
fn:
|
|
831
|
+
fn: x(({ canUpdate: r, canDrop: re, perms: de }) => [
|
|
819
832
|
I(t.$slots, "prev-buttons-ever", {
|
|
820
833
|
canUpdate: r,
|
|
821
834
|
canDrop: re,
|
|
@@ -824,9 +837,9 @@ const T = (...$) => {
|
|
|
824
837
|
]),
|
|
825
838
|
key: "0"
|
|
826
839
|
} : void 0,
|
|
827
|
-
d(
|
|
840
|
+
d(A)["prev-buttons"] ? {
|
|
828
841
|
name: "prev-buttons",
|
|
829
|
-
fn:
|
|
842
|
+
fn: x(({ canUpdate: r, canDrop: re, perms: de }) => [
|
|
830
843
|
I(t.$slots, "prev-buttons", {
|
|
831
844
|
canUpdate: r,
|
|
832
845
|
canDrop: re,
|
|
@@ -840,13 +853,13 @@ const T = (...$) => {
|
|
|
840
853
|
P.value ? (n(), S("div", Ut, [
|
|
841
854
|
N.value && t.notificationType === d(ue).Inline ? (n(), g(R, {
|
|
842
855
|
key: 0,
|
|
843
|
-
code:
|
|
844
|
-
palette:
|
|
856
|
+
code: te.value,
|
|
857
|
+
palette: te.value === 200 ? "success" : "danger",
|
|
845
858
|
quick: "",
|
|
846
859
|
"can-close": "",
|
|
847
860
|
onClose: o[6] || (o[6] = (r) => N.value = !1)
|
|
848
861
|
}, null, 8, ["code", "palette"])) : w("", !0),
|
|
849
|
-
|
|
862
|
+
Z.value ? (n(), g(at, v({
|
|
850
863
|
key: 1,
|
|
851
864
|
ref_key: "formRef",
|
|
852
865
|
ref: L,
|
|
@@ -856,8 +869,8 @@ const T = (...$) => {
|
|
|
856
869
|
"onUpdate:modifications": o[8] || (o[8] = (r) => i.value = r),
|
|
857
870
|
valid: Q.value,
|
|
858
871
|
"onUpdate:valid": o[9] || (o[9] = (r) => Q.value = r),
|
|
859
|
-
changed:
|
|
860
|
-
"onUpdate:changed": o[10] || (o[10] = (r) =>
|
|
872
|
+
changed: ee.value,
|
|
873
|
+
"onUpdate:changed": o[10] || (o[10] = (r) => ee.value = r)
|
|
861
874
|
}, {
|
|
862
875
|
...t.formUiConfig,
|
|
863
876
|
form: be.value,
|
|
@@ -869,7 +882,7 @@ const T = (...$) => {
|
|
|
869
882
|
}), ge({ _: 2 }, [
|
|
870
883
|
K(tt.value, (r) => ({
|
|
871
884
|
name: r,
|
|
872
|
-
fn:
|
|
885
|
+
fn: x(({}) => [
|
|
873
886
|
I(t.$slots, r)
|
|
874
887
|
])
|
|
875
888
|
}))
|
|
@@ -879,14 +892,14 @@ const T = (...$) => {
|
|
|
879
892
|
loading: f.value,
|
|
880
893
|
editMode: D.value,
|
|
881
894
|
isCreate: Y.value,
|
|
882
|
-
canUpdate:
|
|
883
|
-
canDrop:
|
|
895
|
+
canUpdate: ae.value,
|
|
896
|
+
canDrop: oe.value,
|
|
884
897
|
itemBeingEdited: G.value,
|
|
885
898
|
perms: m.value
|
|
886
899
|
})
|
|
887
900
|
])) : t.notificationType === d(ue).Inline ? (n(), g(R, {
|
|
888
901
|
key: 1,
|
|
889
|
-
code:
|
|
902
|
+
code: te.value
|
|
890
903
|
}, null, 8, ["code"])) : w("", !0)
|
|
891
904
|
])),
|
|
892
905
|
f.value ? (n(), g(ot, { key: 4 })) : w("", !0),
|
|
@@ -915,8 +928,8 @@ const T = (...$) => {
|
|
|
915
928
|
"data-changed": M.value,
|
|
916
929
|
"http-success-read": P.value,
|
|
917
930
|
"can-create": l.value,
|
|
918
|
-
"can-update":
|
|
919
|
-
"can-drop":
|
|
931
|
+
"can-update": ae.value,
|
|
932
|
+
"can-drop": oe.value,
|
|
920
933
|
"can-switch-edit-mode": ve.value,
|
|
921
934
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
922
935
|
"able-to-create": De.value,
|
|
@@ -934,16 +947,16 @@ const T = (...$) => {
|
|
|
934
947
|
onSave: Ie,
|
|
935
948
|
onDrop: Re
|
|
936
949
|
}, ge({ _: 2 }, [
|
|
937
|
-
d(
|
|
950
|
+
d(A)["prev-buttons-ever"] ? {
|
|
938
951
|
name: "prev-buttons-ever",
|
|
939
|
-
fn:
|
|
952
|
+
fn: x(() => [
|
|
940
953
|
I(t.$slots, "prev-buttons-ever")
|
|
941
954
|
]),
|
|
942
955
|
key: "0"
|
|
943
956
|
} : void 0,
|
|
944
|
-
d(
|
|
957
|
+
d(A)["prev-buttons"] ? {
|
|
945
958
|
name: "prev-buttons-ever",
|
|
946
|
-
fn:
|
|
959
|
+
fn: x(() => [
|
|
947
960
|
I(t.$slots, "prev-buttons")
|
|
948
961
|
]),
|
|
949
962
|
key: "1"
|
|
@@ -954,7 +967,7 @@ const T = (...$) => {
|
|
|
954
967
|
}, [
|
|
955
968
|
t.groupButton !== !1 && t.groupButtonAsModalActions && Se.value ? {
|
|
956
969
|
name: "header-actions",
|
|
957
|
-
fn:
|
|
970
|
+
fn: x(() => [
|
|
958
971
|
t.buttonNavPosition === d(Pe).Top ? (n(), g(Xe, {
|
|
959
972
|
key: 0,
|
|
960
973
|
ref_key: "buttonNav",
|
|
@@ -980,8 +993,8 @@ const T = (...$) => {
|
|
|
980
993
|
"data-changed": M.value,
|
|
981
994
|
"http-success-read": P.value,
|
|
982
995
|
"can-create": l.value,
|
|
983
|
-
"can-update":
|
|
984
|
-
"can-drop":
|
|
996
|
+
"can-update": ae.value,
|
|
997
|
+
"can-drop": oe.value,
|
|
985
998
|
"can-switch-edit-mode": ve.value,
|
|
986
999
|
"group-button-as-modal-actions": t.groupButtonAsModalActions,
|
|
987
1000
|
"able-to-create": De.value,
|
|
@@ -999,9 +1012,9 @@ const T = (...$) => {
|
|
|
999
1012
|
onSave: Ie,
|
|
1000
1013
|
onDrop: Re
|
|
1001
1014
|
}, ge({ _: 2 }, [
|
|
1002
|
-
d(
|
|
1015
|
+
d(A)["prev-buttons-ever"] ? {
|
|
1003
1016
|
name: "prev-buttons-ever",
|
|
1004
|
-
fn:
|
|
1017
|
+
fn: x(({ canUpdate: r, canDrop: re, perms: de }) => [
|
|
1005
1018
|
I(t.$slots, "prev-buttons-ever", {
|
|
1006
1019
|
canUpdate: r,
|
|
1007
1020
|
canDrop: re,
|
|
@@ -1010,9 +1023,9 @@ const T = (...$) => {
|
|
|
1010
1023
|
]),
|
|
1011
1024
|
key: "0"
|
|
1012
1025
|
} : void 0,
|
|
1013
|
-
d(
|
|
1026
|
+
d(A)["prev-buttons"] ? {
|
|
1014
1027
|
name: "prev-buttons",
|
|
1015
|
-
fn:
|
|
1028
|
+
fn: x(({ canUpdate: r, canDrop: re, perms: de }) => [
|
|
1016
1029
|
I(t.$slots, "prev-buttons", {
|
|
1017
1030
|
canUpdate: r,
|
|
1018
1031
|
canDrop: re,
|
|
@@ -1028,18 +1041,18 @@ const T = (...$) => {
|
|
|
1028
1041
|
]), 1040);
|
|
1029
1042
|
};
|
|
1030
1043
|
}
|
|
1031
|
-
}),
|
|
1044
|
+
}), jt = {
|
|
1032
1045
|
install: ($, ke = {}) => {
|
|
1033
1046
|
$.component("lkt-item-crud") === void 0 && $.component("lkt-item-crud", Mt);
|
|
1034
1047
|
}
|
|
1035
|
-
},
|
|
1048
|
+
}, Ft = ($) => {
|
|
1036
1049
|
me.defaultSaveIcon = $;
|
|
1037
|
-
},
|
|
1050
|
+
}, Pt = ($) => {
|
|
1038
1051
|
me.defaultDropIcon = $;
|
|
1039
1052
|
};
|
|
1040
1053
|
export {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1054
|
+
$t as debugLktItemCrud,
|
|
1055
|
+
jt as default,
|
|
1056
|
+
Pt as setItemCrudDefaultDropIcon,
|
|
1057
|
+
Ft as setItemCrudDefaultSaveIcon
|
|
1045
1058
|
};
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { FormConfig
|
|
2
|
-
import { DataState } from 'lkt-data-state';
|
|
3
|
-
export declare const getModificationsDataState: (value: LktObject, modifications: LktObject, form: FormConfig) => DataState;
|
|
1
|
+
import { FormConfig } from 'lkt-vue-kernel';
|
|
4
2
|
export declare const detectFormFieldsKeys: (form: FormConfig) => string[];
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { debug } from '../functions/debug';
|
|
6
6
|
import {
|
|
7
7
|
ButtonConfig,
|
|
8
|
-
ensureButtonConfig, FormUiConfig,
|
|
8
|
+
ensureButtonConfig, extractI18nValue, FormUiConfig,
|
|
9
9
|
getDefaultValues,
|
|
10
10
|
getFormDataState, getFormSlotKeys,
|
|
11
11
|
ItemCrud,
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
ToastPositionX,
|
|
24
24
|
} from 'lkt-vue-kernel';
|
|
25
25
|
import { closeModal, updateModalKey } from 'lkt-modal';
|
|
26
|
-
import { __ } from 'lkt-i18n';
|
|
27
26
|
import ButtonNav from '../components/ButtonNav.vue';
|
|
28
27
|
import { openToast } from 'lkt-toast';
|
|
29
28
|
import { useRouter } from 'vue-router';
|
|
@@ -228,6 +227,7 @@
|
|
|
228
227
|
dataState.value.increment(v);
|
|
229
228
|
if (computedEditableView.value === ModificationView.Current) {
|
|
230
229
|
dataChanged.value = dataState.value.changed();
|
|
230
|
+
debug('item updated -> dataState changed');
|
|
231
231
|
}
|
|
232
232
|
itemBeingEdited.value = true;
|
|
233
233
|
}, { deep: true });
|
|
@@ -444,12 +444,7 @@
|
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
446
|
|
|
447
|
-
const computedTitle = computed(() =>
|
|
448
|
-
if (props.title.startsWith('__:')) {
|
|
449
|
-
return String(__(props.title.substring(3)));
|
|
450
|
-
}
|
|
451
|
-
return props.title;
|
|
452
|
-
}),
|
|
447
|
+
const computedTitle = computed(() => extractI18nValue(props.title)),
|
|
453
448
|
displayHeader = computed(() => {
|
|
454
449
|
if (isLoading.value) return false;
|
|
455
450
|
|
|
@@ -469,8 +464,14 @@
|
|
|
469
464
|
}),
|
|
470
465
|
ableToUpdate = computed(() => {
|
|
471
466
|
if (props.mode !== ItemCrudMode.Update || !canUpdate.value) return false;
|
|
472
|
-
if (!
|
|
473
|
-
if (
|
|
467
|
+
if (!(computedHasForm.value && validForm.value)) return false;
|
|
468
|
+
if (!props.enabledSaveWithoutChanges) {
|
|
469
|
+
if (computedHasForm.value) {
|
|
470
|
+
if (!changedForm.value) return false;
|
|
471
|
+
} else if (!dataChanged.value) {
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
474
475
|
|
|
475
476
|
if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled({
|
|
476
477
|
prop: item.value
|
|
@@ -481,8 +482,16 @@
|
|
|
481
482
|
}),
|
|
482
483
|
ableToCreate = computed(() => {
|
|
483
484
|
if (props.mode !== ItemCrudMode.Create || !canCreate.value) return false;
|
|
484
|
-
if (!
|
|
485
|
-
if (
|
|
485
|
+
if (!(computedHasForm.value && validForm.value)) return false;
|
|
486
|
+
if (!props.enabledSaveWithoutChanges) {
|
|
487
|
+
if (computedHasForm.value) {
|
|
488
|
+
if (!changedForm.value) return false;
|
|
489
|
+
} else if (!dataChanged.value) {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
// if (!props.enabledSaveWithoutChanges && !computedHasForm.value && !dataChanged.value) return false;
|
|
494
|
+
// if (computedHasForm.value && (!validForm.value || (!props.enabledSaveWithoutChanges && !changedForm.value))) return false;
|
|
486
495
|
|
|
487
496
|
if (typeof safeCreateButton.value?.disabled === 'function') return !safeCreateButton.value.disabled({
|
|
488
497
|
prop: item.value
|