lkt-item-crud 2.0.23 → 2.0.24

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