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 CHANGED
@@ -1,7 +1,7 @@
1
- declare function Tt(B?: boolean): void;
2
- declare namespace It {
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
- declare function Rt(B: any): void;
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 Pe, ref as d, watch as f, useSlots as Fe, computed as k, resolveComponent as ge, createElementBlock as J, createCommentVNode as p, openBlock as v, createBlock as A, Fragment as Le, renderSlot as U, withDirectives as F, mergeProps as S, normalizeProps as Me, unref as i, createVNode as Y, vShow as X, withCtx as _, mergeDefaults as qe, nextTick as ze, onMounted as Qe, resolveDynamicComponent as Ye, createSlots as be, createElementVNode as Ze, toDisplayString as _e } from "vue";
2
- import { httpCall as xe } from "lkt-http-client";
3
- import { DataState as ye } from "lkt-data-state";
4
- import { ModificationView as y, ItemCrudMode as V, ItemCrudButtonNavVisibility as $e, ButtonType as Ve, TablePermission as Te, ensureButtonConfig as Z, LktSettings as s, ItemCrudView as je, ItemCrudButtonNavPosition as Ie, NotificationType as ee, getDefaultValues as et, ItemCrud as tt, ToastPositionX as le } from "lkt-vue-kernel";
5
- import { closeModal as ot, updateModalKey as at } from "lkt-modal";
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 de } from "lkt-toast";
8
- import { useRouter as it } from "vue-router";
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 re = ve;
13
- const C = (...B) => {
14
- re.debugEnabled && console.info("[LktItemCrud] ", ...B);
15
- }, Tt = (B = !0) => {
16
- re.debugEnabled = B;
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: 1,
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
- }, Re = /* @__PURE__ */ Pe({
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, n = B, D = d(n.pickedModificationView);
69
- f(() => n.pickedModificationView, (t) => D.value = t), f(D, (t) => o("update:pickedModificationView", t));
70
- const c = Fe(), r = d(null), u = d(null), m = d(n.loading);
71
- f(() => n.loading, (t) => m.value = t), f(m, (t) => o("update:loading", t));
72
- const O = d(n.editing);
73
- f(() => n.editing, (t) => O.value = t), f(O, (t) => o("update:editing", t));
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
- }, g = () => {
76
+ }, k = () => {
77
77
  m.value = !1;
78
78
  }, x = (t, w) => {
79
79
  typeof t > "u" || o("create", t, w);
80
- }, E = (t, w) => {
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
- }, T = k(() => n.editableView === y.Modifications ? n.modifications : n.item);
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 = k(() => !n.canDrop || n.dropButton === !1 ? !1 : !n.canUpdate && n.canDrop ? !0 : !m.value && n.editing && n.httpSuccessRead), W = k(() => n.mode === V.Create && n.createButton === !1 || n.mode === V.Update && n.updateButton === !1 || m.value ? !1 : n.editing && n.httpSuccessRead), N = k(() => n.editModeButton === !1 || !n.canSwitchEditMode || !n.canUpdate && !n.canDrop || !n.canUpdate && n.canDrop ? !1 : !m.value && n.mode !== V.Create && n.httpSuccessRead), pe = k(() => n.buttonNavVisibility === $e.Always || c["prev-buttons-ever"] ? !0 : n.buttonNavVisibility === $e.Never ? !1 : W.value || M.value || N.value), z = k(() => n.modificationView === !1 ? [] : n.modificationView === !0 ? [
94
- y.Current,
95
- y.Modifications,
96
- y.SplitView,
97
- y.Differences
98
- ] : Array.isArray(n.modificationView) ? n.modificationView : []), G = k(() => {
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(y.Current) && t.push({
100
+ return z.value.includes(g.Current) && t.push({
101
101
  text: "Current",
102
102
  icon: "lkt-icn-see",
103
- disabled: D.value === y.Current,
103
+ disabled: C.value === g.Current,
104
104
  events: {
105
105
  click: () => {
106
- D.value = y.Current;
106
+ C.value = g.Current;
107
107
  }
108
108
  }
109
- }), z.value.includes(y.Modifications) && t.push({
109
+ }), z.value.includes(g.Modifications) && t.push({
110
110
  text: "Modifications",
111
111
  icon: "lkt-icn-edit",
112
- disabled: D.value === y.Modifications,
112
+ disabled: C.value === g.Modifications,
113
113
  events: {
114
114
  click: () => {
115
- D.value = y.Modifications;
115
+ C.value = g.Modifications;
116
116
  }
117
117
  }
118
- }), z.value.includes(y.SplitView) && t.push({
118
+ }), z.value.includes(g.SplitView) && t.push({
119
119
  text: "Split View",
120
120
  icon: "lkt-icn-columns",
121
- disabled: D.value === y.SplitView,
121
+ disabled: C.value === g.SplitView,
122
122
  events: {
123
123
  click: () => {
124
- D.value = y.SplitView;
124
+ C.value = g.SplitView;
125
125
  }
126
126
  }
127
- }), z.value.includes(y.Differences) && t.push({
127
+ }), z.value.includes(g.Differences) && t.push({
128
128
  text: "Differences",
129
129
  icon: "lkt-icn-balance",
130
- disabled: D.value === y.Differences,
130
+ disabled: C.value === g.Differences,
131
131
  events: {
132
132
  click: () => {
133
- D.value = y.Differences;
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 = ge("lkt-button");
141
- return pe.value ? (v(), J("div", ut, [
142
- t.grouped && t.groupButtonAsModalActions ? (v(), J(Le, { key: 0 }, [
143
- N.value ? (v(), A(h, S({ key: 0 }, t.editModeButton, {
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] = (H) => O.value = H),
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, Me(S({ key: 1 }, {
149
- type: i(Ve).Tooltip,
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: G.value,
152
+ splitButtons: H.value,
153
153
  tooltip: {
154
154
  contentClass: "lkt-flex-column"
155
155
  }
156
156
  })), null, 16)) : p("", !0),
157
- i(c)["prev-buttons-ever"] ? U(t.$slots, "prev-buttons-ever", {
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
- i(c)["prev-buttons"] ? U(t.$slots, "prev-buttons", {
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
- ...T.value
176
+ ...I.value
177
177
  },
178
178
  disabled: !t.ableToUpdate
179
179
  }, {
180
180
  onLoading: b,
181
- onLoaded: g,
182
- onClick: E
181
+ onLoaded: k,
182
+ onClick: N
183
183
  }), null, 16), [
184
- [X, t.mode === i(V).Update && W.value]
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
- ...T.value
193
+ ...I.value
194
194
  },
195
195
  disabled: !t.ableToCreate
196
196
  }, {
197
197
  onLoading: b,
198
- onLoaded: g,
198
+ onLoaded: k,
199
199
  onClick: x
200
200
  }), null, 16), [
201
- [X, t.mode === i(V).Create && W.value]
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: g,
209
+ onLoaded: k,
210
210
  onClick: Q
211
211
  }), null, 16, ["disabled"]), [
212
- [X, M.value && t.mode !== i(V).Create]
212
+ [X, M.value && t.mode !== n(T).Create]
213
213
  ]),
214
- i(c).buttons ? U(t.$slots, "buttons", { key: 4 }) : p("", !0)
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 H, ne;
220
+ var G, ue;
221
221
  return [
222
- N.value ? (v(), A(h, S({ key: 0 }, t.editModeButton, {
222
+ E.value ? (v(), A(h, S({ key: 0 }, t.editModeButton, {
223
223
  checked: O.value,
224
- "onUpdate:checked": w[1] || (w[1] = (ie) => O.value = ie),
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, Me(S({ key: 1 }, {
228
- type: i(Ve).Tooltip,
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: G.value,
231
+ splitButtons: H.value,
232
232
  tooltip: {
233
233
  contentClass: "lkt-flex-column"
234
234
  }
235
235
  })), null, 16)) : p("", !0),
236
- i(c)["prev-buttons-ever"] ? U(t.$slots, "prev-buttons-ever", {
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
- i(c)["prev-buttons"] ? U(t.$slots, "prev-buttons", {
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
- ...(H = t.updateButton) == null ? void 0 : H.resourceData,
255
- ...T.value
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: g,
261
- onClick: E
260
+ onLoaded: k,
261
+ onClick: N
262
262
  }), null, 16), [
263
- [X, t.mode === i(V).Update && W.value]
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
- ...(ne = t.createButton) == null ? void 0 : ne.resourceData,
272
- ...T.value
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: g,
278
+ onLoaded: k,
279
279
  onClick: x
280
280
  }), null, 16, ["disabled"]), [
281
- [X, t.mode === i(V).Create && W.value]
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: g,
289
+ onLoaded: k,
290
290
  onClick: Q
291
291
  }), null, 16, ["disabled"]), [
292
- [X, M.value && t.mode !== i(V).Create]
292
+ [X, M.value && t.mode !== n(T).Create]
293
293
  ]),
294
- i(c).buttons ? U(t.$slots, "buttons", { key: 4 }) : p("", !0)
294
+ n(c).buttons ? U(t.$slots, "buttons", { key: 4 }) : p("", !0)
295
295
  ];
296
296
  }),
297
297
  _: 3
298
- }, 16)) : (v(), J(Le, { key: 2 }, [
299
- i(c)["prev-buttons-ever"] ? F((v(), J("div", lt, [
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
- i(c)["prev-buttons"] ? F((v(), J("div", dt, [
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
- ...T.value
324
+ ...I.value
325
325
  },
326
326
  disabled: !t.ableToUpdate
327
327
  }, {
328
328
  onLoading: b,
329
- onLoaded: g,
330
- onClick: E
329
+ onLoaded: k,
330
+ onClick: N
331
331
  }), null, 16), [
332
- [X, t.mode === i(V).Update && W.value]
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
- ...T.value
341
+ ...I.value
342
342
  },
343
343
  disabled: !t.ableToCreate
344
344
  }, {
345
345
  onLoading: b,
346
- onLoaded: g,
346
+ onLoaded: k,
347
347
  onClick: x
348
348
  }), null, 16), [
349
- [X, t.mode === i(V).Create && W.value]
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: g,
357
+ onLoaded: k,
358
358
  onClick: Q
359
359
  }), null, 16, ["disabled"]), [
360
- [X, M.value && t.mode !== i(V).Create]
360
+ [X, M.value && t.mode !== n(T).Create]
361
361
  ]),
362
- i(c).buttons ? F((v(), J("div", rt, [
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, Me(S({ key: 3 }, {
368
- type: i(Ve).Tooltip,
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: G.value,
371
+ splitButtons: H.value,
372
372
  tooltip: {
373
373
  contentClass: "lkt-flex-column"
374
374
  }
375
375
  })), null, 16)) : p("", !0),
376
- N.value ? (v(), A(h, S({ key: 4 }, t.editModeButton, {
376
+ E.value ? (v(), A(h, S({ key: 4 }, t.editModeButton, {
377
377
  checked: O.value,
378
- "onUpdate:checked": w[2] || (w[2] = (H) => O.value = H),
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
- }), st = (B, K, te) => {
386
- let o = new ye(JSON.parse(JSON.stringify(B)), {
387
- onlyProps: Xe(te),
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
- }, Xe = (B) => {
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, ...Xe(o.form)]);
402
+ o.form && (K = [...K, ...Je(o.form)]);
403
403
  break;
404
404
  }
405
405
  }
406
406
  return K;
407
- }, pt = { class: "lkt-item-crud" }, vt = {
407
+ }, vt = { class: "lkt-item-crud" }, ct = {
408
408
  key: 0,
409
409
  class: "lkt-item-crud_header"
410
- }, ct = {
410
+ }, ft = {
411
411
  key: 0,
412
412
  class: "lkt-item-crud_header-slot"
413
- }, ft = {
413
+ }, mt = {
414
414
  key: 1,
415
415
  class: "lkt-item-crud_header-title"
416
- }, mt = {
416
+ }, bt = {
417
417
  key: 2,
418
418
  class: "lkt-item-crud_header-slot"
419
- }, bt = {
419
+ }, gt = {
420
420
  key: 2,
421
421
  class: "lkt-item-crud_content"
422
- }, gt = {
422
+ }, yt = {
423
423
  key: 0,
424
424
  class: "lkt-grid-1"
425
- }, yt = /* @__PURE__ */ Pe({
425
+ }, kt = /* @__PURE__ */ Fe({
426
426
  __name: "LktItemCrud",
427
- props: /* @__PURE__ */ qe({
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
- }, et(tt)),
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, n = it(), D = Fe(), c = te, r = d(!0), u = d(o.modelValue), m = d(o.modifications), O = d(o.customData), b = d(o.perms), g = d(o.editing), x = d(!1), E = d(!1), Q = d(!1), T = d(200), I = d(new ye(u.value, o.dataStateConfig)), se = d(new ye(m.value, o.dataStateConfig)), M = d(!1), W = d(new ye(o.readData)), N = d(o.mode === V.Create), pe = d(!1), z = d(!1), G = d(null), t = k(() => !N.value && Array.isArray(b.value) && b.value.includes(Te.Update)), w = k(() => !N.value && Array.isArray(b.value) && b.value.includes(Te.Drop)), h = k(() => !N.value && Array.isArray(b.value) && b.value.includes(Te.SwitchEditMode)), L = d(o.visibleView);
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
- N.value = e === V.Create;
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
- se.value.increment(e), m.value = e;
494
+ ne.value.increment(e), m.value = e;
494
495
  }, { deep: !0 }), f(m, (e) => {
495
- Oe(), se.value.increment(e), ue.value === y.Modifications && (M.value = se.value.changed()), c("update:modifications", e);
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)), H = d(Z(o.editModeButton, s.defaultEditModeButton)), ne = d(Z(o.groupButton, s.defaultGroupButton));
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
- H.value = Z(e, s.defaultEditModeButton);
506
+ G.value = Z(e, s.defaultEditModeButton);
506
507
  }, { deep: !0 });
507
- const ie = async () => {
508
+ const le = async () => {
508
509
  var e, a, q;
509
- C("fetchItem"), r.value = !0, T.value = -1, Q.value = !1, typeof ((e = o.events) == null ? void 0 : e.httpStart) == "function" && o.events.httpStart();
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 R = await xe(o.readResource, o.readData);
512
- if (C("fetchItem -> response", R), r.value = !1, T.value = R.httpStatus, O.value = R.custom, !R.success) {
513
- E.value = !1, T.value = R.httpStatus, typeof ((a = o.events) == null ? void 0 : a.httpEnd) == "function" && o.events.httpEnd({
514
- httpResponse: R
515
- }), c("error", R.httpStatus);
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
- E.value = !0, u.value = R.data, m.value = R.modifications, b.value = R.perms, I.value.increment(u.value).turnStoredIntoOriginal(), se.value.increment(m.value).turnStoredIntoOriginal(), M.value = I.value.changed(), W.value.turnStoredIntoOriginal(), Object.keys(m.value).length > 0 && (L.value = y.Modifications), typeof ((q = o.events) == null ? void 0 : q.httpEnd) == "function" && o.events.httpEnd({
519
- httpResponse: R
520
- }), c("read", R);
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, E.value = !1, T.value = 404, c("error", 404);
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, I.value.increment(e);
528
+ u.value = e, R.value.increment(e);
528
529
  }, { deep: !0 }), f(u, (e) => {
529
- if (pe.value = !0, C("item updated ->", u.value), typeof o.beforeEmitUpdate == "function") {
530
- C("item updated -> has beforeEmitUpdate");
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
- C("item updated -> override with: ", a), typeof a == "object" && (u.value = a);
533
+ D("item updated -> override with: ", a), typeof a == "object" && (u.value = a);
533
534
  }
534
- Oe(), c("update:modelValue", u.value), C("item updated -> update dataState"), I.value.increment(e), ue.value === y.Current && (M.value = I.value.changed()), ze(() => pe.value = !1);
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() && ie();
539
+ W.value.increment(e), W.value.changed() && le();
539
540
  }), f(() => o.editing, (e) => {
540
- C("editing updated -> updating editMode", e), g.value = e;
541
- }), f(g, (e) => {
542
- C("editMode updated -> emit update", e), c("update:editing", e);
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 Ae = d(void 0), Oe = () => {
545
- me.value && (Ae.value = st(u.value, m.value, o.form));
545
+ const Oe = d(void 0), Ee = () => {
546
+ me.value && (Oe.value = pt(u.value, m.value, o.form));
546
547
  };
547
- Qe(() => {
548
- o.readResource && !N.value ? ie() : (N.value, E.value = !0, g.value = !0, r.value = !1, I.value.increment(u.value).turnStoredIntoOriginal(), M.value = I.value.changed());
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 ke = (e, a) => {
551
+ const Be = (e, a) => {
551
552
  if (a) {
552
- if (r.value = !1, typeof e < "u" && (T.value = e.httpStatus, !e.success))
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
- }, Ee = (e, a) => {
558
- if (C("doAutoReloadId -> enter: ", e), typeof e < "u" && e.autoReloadId)
559
- if (C("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), typeof a < "u") {
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)), n.push(q);
562
- } else we.value ? (C("doAutoReloadId -> insideModal: ", o), at(o.modalConfig.modalName, o.modalConfig.modalKey, e.autoReloadId)) : (C("doAutoReloadId -> outsideModal"), o.readData.id = e.autoReloadId, C("doAutoReloadId -> turning off create mode"), N.value = !1, ie());
563
- }, Be = (e, a) => {
564
- if (C("onCreate"), !ke(a, $.value.resource)) {
565
- o.notificationType === ee.Toast && de({
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: le.Right
570
+ positionX: de.Right
570
571
  });
571
572
  return;
572
573
  }
573
- z.value = !0, C("onCreate -> turn stored data into original"), I.value.increment(u.value).turnStoredIntoOriginal(), o.notificationType === ee.Toast && de({
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: le.Right
578
- }), Ee(a, o.redirectOnCreate), C("onCreate -> beforeEmitCreate"), c("create", a);
579
- }, De = (e, a) => {
580
- if (C("onUpdate"), !ke(a, j.value.resource)) {
581
- o.notificationType === ee.Toast && de({
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: le.Right
586
+ positionX: de.Right
586
587
  });
587
588
  return;
588
589
  }
589
- C("onUpdate -> turn stored data into original"), I.value.turnStoredIntoOriginal(), o.notificationType === ee.Toast && de({
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: le.Right
594
- }), Ee(a), c("update", a);
595
- }, he = (e, a) => {
596
- if (C("onDrop"), !ke(a, P.value.resource)) {
597
- o.notificationType === ee.Toast && de({
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: le.Right
602
+ positionX: de.Right
602
603
  });
603
604
  return;
604
605
  }
605
- if (o.notificationType === ee.Toast && de({
606
+ if (o.notificationType === ee.Toast && re({
606
607
  text: s.defaultDropSuccessText,
607
608
  details: s.defaultDropSuccessDetails,
608
609
  icon: s.defaultDropSuccessIcon,
609
- positionX: le.Right
610
- }), c("drop", a), o.view === je.Modal && (C("onDrop -> close modal"), ot(o.modalConfig.modalName, o.modalConfig.modalKey)), typeof o.redirectOnDrop < "u") {
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()), n.push(q);
613
+ typeof o.redirectOnDrop == "function" && (q = o.redirectOnDrop()), i.push(q);
613
614
  }
614
615
  };
615
616
  K({
616
617
  doDrop: () => {
617
- G.value && G.value.doDrop();
618
+ H.value && H.value.doDrop();
618
619
  },
619
- doRefresh: ie,
620
+ doRefresh: le,
620
621
  doSave: () => {
621
- G.value && G.value.doSave();
622
+ H.value && H.value.doSave();
622
623
  },
623
624
  turnStoredDataIntoOriginal: () => {
624
- I.value.increment(u.value).turnStoredIntoOriginal();
625
+ R.value.increment(u.value).turnStoredIntoOriginal();
625
626
  },
626
- hasModifiedData: () => I.value.changed()
627
+ hasModifiedData: () => R.value.changed()
627
628
  });
628
- const Je = k(() => {
629
- var e;
630
- return I.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
631
- }), Ke = (e) => {
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
- }, Ce = k(() => o.title.startsWith("__:") ? String(nt(o.title.substring(3))) : o.title), We = k(() => r.value ? !1 : Ce.value.length > 0 || !!D["post-title"]), we = k(() => o.view === je.Modal), Ne = k(() => we.value ? "lkt-modal" : "section"), ce = k(() => {
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 !== V.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
+ 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 = k(() => {
644
+ }), fe = y(() => {
644
645
  var e, a;
645
- return o.mode !== V.Create || !o.enabledSaveWithoutChanges && !M.value || me.value && !x.value ? !1 : typeof ((e = $.value) == null ? void 0 : e.disabled) == "function" ? !$.value.disabled({
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
- }), Se = k(() => {
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 = k(() => Ne.value === "lkt-modal" ? {
654
+ }), Ge = y(() => Le.value === "lkt-modal" ? {
654
655
  title: o.title,
655
656
  item: u.value,
656
657
  ...o.modalConfig,
657
- beforeClose: Ke,
658
- closeConfirm: Je.value,
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 = k(() => typeof o.form == "object" && Object.keys(o.form).length > 0), Ue = k(() => Object.keys(m.value).length === 0 ? [] : o.modificationViews), ue = k(() => Object.keys(m.value).length === 0 ? y.Current : y.Modifications);
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 = ge("lkt-http-info"), R = ge("lkt-form"), He = ge("lkt-loader");
665
- return v(), A(Ye(Ne.value), S(Ge.value, { class: "lkt-item-crud" }), be({
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
- Ze("article", pt, [
668
- !we.value && We.value ? (v(), J("header", vt, [
669
- i(D)["pre-title"] ? (v(), J("div", ct, [
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
- Ce.value.length > 0 ? (v(), J("h1", ft, _e(Ce.value), 1)) : p("", !0),
676
- i(D)["post-title"] ? (v(), J("div", mt, [
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 === i(Ie).Top && (e.groupButton === !1 || !e.groupButtonAsModalActions) ? (v(), A(Re, {
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: G,
687
+ ref: H,
687
688
  loading: r.value,
688
689
  "onUpdate:loading": a[3] || (a[3] = (l) => r.value = l),
689
- editing: g.value,
690
- "onUpdate:editing": a[4] || (a[4] = (l) => g.value = 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": H.value,
703
- "group-button": ne.value,
703
+ "edit-mode-button": G.value,
704
+ "group-button": ue.value,
704
705
  "data-changed": M.value,
705
- "http-success-read": E.value,
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": Se.value,
713
+ "able-to-drop": Ue.value,
713
714
  perms: b.value,
714
- "modification-view": Ue.value,
715
- "editable-view": ue.value,
716
- onCreate: Be,
717
- onSave: De,
718
- onDrop: he
719
- }, be({ _: 2 }, [
720
- i(D)["prev-buttons-ever"] ? {
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: oe, perms: ae }) => [
723
+ fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
723
724
  U(e.$slots, "prev-buttons-ever", {
724
725
  canUpdate: l,
725
- canDrop: oe,
726
- perms: ae
726
+ canDrop: ae,
727
+ perms: ie
727
728
  })
728
729
  ]),
729
730
  key: "0"
730
731
  } : void 0,
731
- i(D)["prev-buttons"] ? {
732
+ n(C)["prev-buttons"] ? {
732
733
  name: "prev-buttons",
733
- fn: _(({ canUpdate: l, canDrop: oe, perms: ae }) => [
734
+ fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
734
735
  U(e.$slots, "prev-buttons", {
735
736
  canUpdate: l,
736
- canDrop: oe,
737
- perms: ae
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", bt, [
744
- E.value ? (v(), J("div", gt, [
745
- Q.value && e.notificationType === i(ee).Inline ? (v(), A(q, {
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: T.value,
748
- palette: T.value === 200 ? "success" : "danger",
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(R, S({
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: Ae.value,
766
- editableViews: [ue.value],
767
- disabled: !g.value
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: g.value,
773
- isCreate: N.value,
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 === i(ee).Inline ? (v(), A(q, {
781
+ ])) : e.notificationType === n(ee).Inline ? (v(), A(q, {
780
782
  key: 1,
781
- code: T.value
783
+ code: I.value
782
784
  }, null, 8, ["code"])) : p("", !0)
783
785
  ])),
784
- r.value ? (v(), A(He, { key: 3 })) : p("", !0),
785
- e.buttonNavPosition === i(Ie).Bottom && (e.groupButton === !1 || !e.groupButtonAsModalActions) ? (v(), A(Re, {
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: G,
790
+ ref: H,
789
791
  loading: r.value,
790
792
  "onUpdate:loading": a[10] || (a[10] = (l) => r.value = l),
791
- editing: g.value,
792
- "onUpdate:editing": a[11] || (a[11] = (l) => g.value = 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": H.value,
805
- "group-button": ne.value,
806
+ "edit-mode-button": G.value,
807
+ "group-button": ue.value,
806
808
  "data-changed": M.value,
807
- "http-success-read": E.value,
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": Se.value,
816
+ "able-to-drop": Ue.value,
815
817
  perms: b.value,
816
- "modification-view": Ue.value,
817
- "editable-view": ue.value,
818
- onCreate: Be,
819
- onSave: De,
820
- onDrop: he
821
- }, be({ _: 2 }, [
822
- i(D)["prev-buttons-ever"] ? {
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
- i(D)["prev-buttons"] ? {
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 === i(Ie).Top ? (v(), A(Re, {
846
+ e.buttonNavPosition === n(Re).Top ? (v(), A(Ae, {
845
847
  key: 0,
846
848
  ref_key: "buttonNav",
847
- ref: G,
849
+ ref: H,
848
850
  loading: r.value,
849
851
  "onUpdate:loading": a[0] || (a[0] = (l) => r.value = l),
850
- editing: g.value,
851
- "onUpdate:editing": a[1] || (a[1] = (l) => g.value = 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": H.value,
864
- "group-button": ne.value,
865
+ "edit-mode-button": G.value,
866
+ "group-button": ue.value,
865
867
  "data-changed": M.value,
866
- "http-success-read": E.value,
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": Se.value,
875
+ "able-to-drop": Ue.value,
874
876
  perms: b.value,
875
- "modification-view": Ue.value,
876
- "editable-view": ue.value,
877
- onCreate: Be,
878
- onSave: De,
879
- onDrop: he
880
- }, be({ _: 2 }, [
881
- i(D)["prev-buttons-ever"] ? {
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: oe, perms: ae }) => [
885
+ fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
884
886
  U(e.$slots, "prev-buttons-ever", {
885
887
  canUpdate: l,
886
- canDrop: oe,
887
- perms: ae
888
+ canDrop: ae,
889
+ perms: ie
888
890
  })
889
891
  ]),
890
892
  key: "0"
891
893
  } : void 0,
892
- i(D)["prev-buttons"] ? {
894
+ n(C)["prev-buttons"] ? {
893
895
  name: "prev-buttons",
894
- fn: _(({ canUpdate: l, canDrop: oe, perms: ae }) => [
896
+ fn: _(({ canUpdate: l, canDrop: ae, perms: ie }) => [
895
897
  U(e.$slots, "prev-buttons", {
896
898
  canUpdate: l,
897
- canDrop: oe,
898
- perms: ae
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
- }), It = {
912
+ }), Rt = {
911
913
  install: (B, K = {}) => {
912
- B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud", yt);
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
- re.defaultDropIcon = B;
917
+ se.defaultSaveIcon = B;
918
+ }, Ot = (B) => {
919
+ se.defaultDropIcon = B;
918
920
  };
919
921
  export {
920
- Tt as debugLktItemCrud,
921
- It as default,
922
- At as setItemCrudDefaultDropIcon,
923
- Rt as setItemCrudDefaultSaveIcon
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.20",
3
+ "version": "2.0.21",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -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 && (groupButton === false || !groupButtonAsModalActions)"
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"