lkt-item-crud 2.0.30 → 2.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.js CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as qe, ref as p, watch as y, useSlots as ze, computed as B, resolveComponent as me, createElementBlock as w, createCommentVNode as k, openBlock as n, createBlock as m, Fragment as F, renderSlot as R, withDirectives as h, mergeProps as f, normalizeProps as Se, unref as d, renderList as H, vShow as D, createVNode as x, withCtx as J, mergeDefaults as at, nextTick as Ke, onMounted as ot, resolveDynamicComponent as nt, createSlots as ce, toDisplayString as ut } from "vue";
1
+ import { defineComponent as qe, ref as p, watch as y, useSlots as ze, computed as B, resolveComponent as me, createElementBlock as w, createCommentVNode as k, openBlock as n, createBlock as m, Fragment as F, renderSlot as R, withDirectives as h, mergeProps as f, normalizeProps as Se, unref as s, renderList as H, vShow as D, createVNode as x, withCtx as J, mergeDefaults as at, nextTick as Ke, onMounted as ot, resolveDynamicComponent as nt, createSlots as ce, toDisplayString as ut } from "vue";
2
2
  import { httpCall as it } from "lkt-http-client";
3
3
  import { DataState as $e } from "lkt-data-state";
4
- import { ModificationView as S, ItemCrudMode as O, ItemCrudButtonNavVisibility as We, ButtonType as Ne, TablePermission as we, ensureButtonConfig as ee, LktSettings as g, getFormDataState as lt, ItemCrudView as Ge, getFormSlotKeys as rt, ItemCrudButtonNavPosition as je, NotificationType as ne, getDefaultValues as dt, ItemCrud as st, ToastPositionX as se } from "lkt-vue-kernel";
4
+ import { ModificationView as U, ItemCrudMode as O, ItemCrudButtonNavVisibility as We, ButtonType as Ne, TablePermission as we, ensureButtonConfig as ee, LktSettings as g, getFormDataState as lt, ItemCrudView as Ge, getFormSlotKeys as rt, ItemCrudButtonNavPosition as je, NotificationType as ne, getDefaultValues as dt, ItemCrud as st, ToastPositionX as se } from "lkt-vue-kernel";
5
5
  import { closeModal as vt, updateModalKey as pt } from "lkt-modal";
6
6
  import { __ as ft } from "lkt-i18n";
7
7
  import { openToast as ve } from "lkt-toast";
@@ -72,13 +72,13 @@ const V = (...N) => {
72
72
  setup(N, { expose: ge, emit: Ue }) {
73
73
  const a = Ue, u = N, M = p(u.pickedModificationView);
74
74
  y(() => u.pickedModificationView, (t) => M.value = t), y(M, (t) => a("update:pickedModificationView", t));
75
- const C = ze(), c = p(null), s = p(null), i = p(u.loading);
75
+ const C = ze(), c = p(null), r = p(null), i = p(u.loading);
76
76
  y(() => u.loading, (t) => i.value = t), y(i, (t) => a("update:loading", t));
77
77
  const E = p(u.editing);
78
78
  y(() => u.editing, (t) => E.value = t), y(E, (t) => a("update:editing", t));
79
79
  const b = () => {
80
80
  i.value = !0;
81
- }, U = () => {
81
+ }, S = () => {
82
82
  i.value = !1;
83
83
  }, te = (t, $) => {
84
84
  typeof t > "u" || a("create", t, $);
@@ -86,72 +86,72 @@ const V = (...N) => {
86
86
  typeof t > "u" || a("save", t, $);
87
87
  }, P = (t, $) => {
88
88
  typeof t > "u" || a("drop", t, $);
89
- }, K = B(() => u.editableView === S.Modifications ? u.modifications : u.item);
89
+ }, K = B(() => u.editableView === U.Modifications ? u.modifications : u.item);
90
90
  ge({
91
91
  doSave: () => {
92
92
  c.value && typeof c.value.click == "function" && c.value.click();
93
93
  },
94
94
  doDrop: () => {
95
- s.value && typeof s.value.click == "function" && s.value.click();
95
+ r.value && typeof r.value.click == "function" && r.value.click();
96
96
  }
97
97
  });
98
98
  const W = B(() => !u.canDrop || u.dropButton === !1 ? !1 : !u.canUpdate && u.canDrop ? !0 : !i.value && u.editing && u.httpSuccessRead), I = B(() => u.mode === O.Create && (u.createButton === !1 || !u.canCreate) || u.mode === O.Update && (u.updateButton === !1 || !u.canUpdate) || i.value ? !1 : u.editing && u.httpSuccessRead), ae = B(() => u.editModeButton === !1 || !u.canSwitchEditMode || !u.canUpdate && !u.canDrop || !u.canUpdate && u.canDrop ? !1 : !i.value && u.mode !== O.Create && u.httpSuccessRead), z = B(() => u.buttonNavVisibility === We.Always || C["prev-buttons-ever"] ? !0 : u.buttonNavVisibility === We.Never ? !1 : I.value || W.value || ae.value), G = B(() => u.modificationView === !1 ? [] : u.modificationView === !0 ? [
99
- S.Current,
100
- S.Modifications,
101
- S.SplitView,
102
- S.Differences
99
+ U.Current,
100
+ U.Modifications,
101
+ U.SplitView,
102
+ U.Differences
103
103
  ] : Array.isArray(u.modificationView) ? u.modificationView : []), re = B(() => {
104
104
  let t = [];
105
- return G.value.includes(S.Current) && t.push({
105
+ return G.value.includes(U.Current) && t.push({
106
106
  text: "Current",
107
107
  icon: "lkt-icn-see",
108
- disabled: M.value === S.Current,
108
+ disabled: M.value === U.Current,
109
109
  events: {
110
110
  click: () => {
111
- M.value = S.Current;
111
+ M.value = U.Current;
112
112
  }
113
113
  }
114
- }), G.value.includes(S.Modifications) && t.push({
114
+ }), G.value.includes(U.Modifications) && t.push({
115
115
  text: "Modifications",
116
116
  icon: "lkt-icn-edit",
117
- disabled: M.value === S.Modifications,
117
+ disabled: M.value === U.Modifications,
118
118
  events: {
119
119
  click: () => {
120
- M.value = S.Modifications;
120
+ M.value = U.Modifications;
121
121
  }
122
122
  }
123
- }), G.value.includes(S.SplitView) && t.push({
123
+ }), G.value.includes(U.SplitView) && t.push({
124
124
  text: "Split View",
125
125
  icon: "lkt-icn-columns",
126
- disabled: M.value === S.SplitView,
126
+ disabled: M.value === U.SplitView,
127
127
  events: {
128
128
  click: () => {
129
- M.value = S.SplitView;
129
+ M.value = U.SplitView;
130
130
  }
131
131
  }
132
- }), G.value.includes(S.Differences) && t.push({
132
+ }), G.value.includes(U.Differences) && t.push({
133
133
  text: "Differences",
134
134
  icon: "lkt-icn-balance",
135
- disabled: M.value === S.Differences,
135
+ disabled: M.value === U.Differences,
136
136
  events: {
137
137
  click: () => {
138
- M.value = S.Differences;
138
+ M.value = U.Differences;
139
139
  }
140
140
  }
141
141
  }), t;
142
142
  });
143
143
  return (t, $) => {
144
144
  var Z, _, de, j;
145
- const r = me("lkt-button");
145
+ const d = me("lkt-button");
146
146
  return z.value ? (n(), w("div", mt, [
147
147
  t.grouped && t.groupButtonAsModalActions ? (n(), w(F, { key: 0 }, [
148
- ae.value ? (n(), m(r, f({ key: 0 }, t.editModeButton, {
148
+ ae.value ? (n(), m(d, f({ key: 0 }, t.editModeButton, {
149
149
  checked: E.value,
150
150
  "onUpdate:checked": $[0] || ($[0] = (v) => E.value = v),
151
151
  class: "lkt-item-crud--switch-mode-button"
152
152
  }), null, 16, ["checked"])) : k("", !0),
153
- G.value.length > 0 ? (n(), m(r, Se(f({ key: 1 }, {
154
- type: d(Ne).Tooltip,
153
+ G.value.length > 0 ? (n(), m(d, Se(f({ key: 1 }, {
154
+ type: s(Ne).Tooltip,
155
155
  icon: "lkt-icn-cross-arrows",
156
156
  class: "lkt-item-crud--modifications-button",
157
157
  splitButtons: re.value,
@@ -159,25 +159,25 @@ const V = (...N) => {
159
159
  contentClass: "lkt-flex-column"
160
160
  }
161
161
  })), null, 16)) : k("", !0),
162
- (n(!0), w(F, null, H(t.navStartButtons, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
162
+ (n(!0), w(F, null, H(t.navStartButtons, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
163
163
  [D, !i.value]
164
164
  ])), 256)),
165
- d(C)["prev-buttons-ever"] ? R(t.$slots, "prev-buttons-ever", {
165
+ s(C)["prev-buttons-ever"] ? R(t.$slots, "prev-buttons-ever", {
166
166
  key: 2,
167
167
  canUpdate: t.canUpdate,
168
168
  canDrop: t.canDrop,
169
169
  perms: t.perms
170
170
  }) : k("", !0),
171
- (n(!0), w(F, null, H(t.navStartButtonsEditing, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
171
+ (n(!0), w(F, null, H(t.navStartButtonsEditing, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
172
172
  [D, E.value && !i.value]
173
173
  ])), 256)),
174
- d(C)["prev-buttons"] ? R(t.$slots, "prev-buttons", {
174
+ s(C)["prev-buttons"] ? R(t.$slots, "prev-buttons", {
175
175
  key: 3,
176
176
  canUpdate: t.canUpdate,
177
177
  canDrop: t.canDrop,
178
178
  perms: t.perms
179
179
  }) : k("", !0),
180
- h(x(r, f({
180
+ h(x(d, f({
181
181
  ref_key: "saveButtonRef",
182
182
  ref: c
183
183
  }, {
@@ -189,12 +189,12 @@ const V = (...N) => {
189
189
  disabled: !t.ableToUpdate
190
190
  }, {
191
191
  onLoading: b,
192
- onLoaded: U,
192
+ onLoaded: S,
193
193
  onClick: Q
194
194
  }), null, 16), [
195
- [D, t.mode === d(O).Update && I.value]
195
+ [D, t.mode === s(O).Update && I.value]
196
196
  ]),
197
- h(x(r, f({
197
+ h(x(d, f({
198
198
  ref_key: "saveButtonRef",
199
199
  ref: c
200
200
  }, {
@@ -206,43 +206,43 @@ const V = (...N) => {
206
206
  disabled: !t.ableToCreate
207
207
  }, {
208
208
  onLoading: b,
209
- onLoaded: U,
209
+ onLoaded: S,
210
210
  onClick: te
211
211
  }), null, 16), [
212
- [D, t.mode === d(O).Create && I.value]
212
+ [D, t.mode === s(O).Create && I.value]
213
213
  ]),
214
- h(x(r, f({
214
+ h(x(d, f({
215
215
  ref_key: "dropButtonRef",
216
- ref: s
216
+ ref: r
217
217
  }, t.dropButton, {
218
218
  disabled: !t.ableToDrop,
219
219
  onLoading: b,
220
- onLoaded: U,
220
+ onLoaded: S,
221
221
  onClick: P
222
222
  }), null, 16, ["disabled"]), [
223
- [D, W.value && t.mode !== d(O).Create]
223
+ [D, W.value && t.mode !== s(O).Create]
224
224
  ]),
225
- d(C).buttons ? R(t.$slots, "buttons", { key: 4 }) : k("", !0),
226
- (n(!0), w(F, null, H(t.navEndButtons, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
225
+ s(C).buttons ? R(t.$slots, "buttons", { key: 4 }) : k("", !0),
226
+ (n(!0), w(F, null, H(t.navEndButtons, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
227
227
  [D, !i.value]
228
228
  ])), 256)),
229
- (n(!0), w(F, null, H(t.navEndButtonsEditing, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
229
+ (n(!0), w(F, null, H(t.navEndButtonsEditing, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
230
230
  [D, E.value && !i.value]
231
231
  ])), 256))
232
- ], 64)) : t.grouped ? (n(), m(r, f({
232
+ ], 64)) : t.grouped ? (n(), m(d, f({
233
233
  key: 1,
234
234
  ref: "groupButton"
235
235
  }, t.groupButton, { class: "lkt-item-crud-group-button" }), {
236
236
  split: J(() => {
237
237
  var v, q;
238
238
  return [
239
- ae.value ? (n(), m(r, f({ key: 0 }, t.editModeButton, {
239
+ ae.value ? (n(), m(d, f({ key: 0 }, t.editModeButton, {
240
240
  checked: E.value,
241
241
  "onUpdate:checked": $[1] || ($[1] = (T) => E.value = T),
242
242
  class: "lkt-item-crud--switch-mode-button"
243
243
  }), null, 16, ["checked"])) : k("", !0),
244
- G.value.length > 0 ? (n(), m(r, Se(f({ key: 1 }, {
245
- type: d(Ne).Tooltip,
244
+ G.value.length > 0 ? (n(), m(d, Se(f({ key: 1 }, {
245
+ type: s(Ne).Tooltip,
246
246
  icon: "lkt-icn-cross-arrows",
247
247
  class: "lkt-item-crud--modifications-button",
248
248
  splitButtons: re.value,
@@ -250,25 +250,25 @@ const V = (...N) => {
250
250
  contentClass: "lkt-flex-column"
251
251
  }
252
252
  })), null, 16)) : k("", !0),
253
- (n(!0), w(F, null, H(t.navStartButtons, (T) => h((n(), m(r, f({ ref_for: !0 }, T), null, 16)), [
253
+ (n(!0), w(F, null, H(t.navStartButtons, (T) => h((n(), m(d, f({ ref_for: !0 }, T), null, 16)), [
254
254
  [D, !i.value]
255
255
  ])), 256)),
256
- d(C)["prev-buttons-ever"] ? R(t.$slots, "prev-buttons-ever", {
256
+ s(C)["prev-buttons-ever"] ? R(t.$slots, "prev-buttons-ever", {
257
257
  key: 2,
258
258
  canUpdate: t.canUpdate,
259
259
  canDrop: t.canDrop,
260
260
  perms: t.perms
261
261
  }) : k("", !0),
262
- (n(!0), w(F, null, H(t.navStartButtonsEditing, (T) => h((n(), m(r, f({ ref_for: !0 }, T), null, 16)), [
262
+ (n(!0), w(F, null, H(t.navStartButtonsEditing, (T) => h((n(), m(d, f({ ref_for: !0 }, T), null, 16)), [
263
263
  [D, E.value && !i.value]
264
264
  ])), 256)),
265
- d(C)["prev-buttons"] ? R(t.$slots, "prev-buttons", {
265
+ s(C)["prev-buttons"] ? R(t.$slots, "prev-buttons", {
266
266
  key: 3,
267
267
  canUpdate: t.canUpdate,
268
268
  canDrop: t.canDrop,
269
269
  perms: t.perms
270
270
  }) : k("", !0),
271
- h(x(r, f({
271
+ h(x(d, f({
272
272
  ref_key: "saveButtonRef",
273
273
  ref: c
274
274
  }, {
@@ -280,12 +280,12 @@ const V = (...N) => {
280
280
  disabled: !t.ableToUpdate
281
281
  }, {
282
282
  onLoading: b,
283
- onLoaded: U,
283
+ onLoaded: S,
284
284
  onClick: Q
285
285
  }), null, 16), [
286
- [D, t.mode === d(O).Update && I.value]
286
+ [D, t.mode === s(O).Update && I.value]
287
287
  ]),
288
- h(x(r, f({
288
+ h(x(d, f({
289
289
  ref_key: "saveButtonRef",
290
290
  ref: c
291
291
  }, {
@@ -298,37 +298,37 @@ const V = (...N) => {
298
298
  }, {
299
299
  disabled: !t.ableToCreate,
300
300
  onLoading: b,
301
- onLoaded: U,
301
+ onLoaded: S,
302
302
  onClick: te
303
303
  }), null, 16, ["disabled"]), [
304
- [D, t.mode === d(O).Create && I.value]
304
+ [D, t.mode === s(O).Create && I.value]
305
305
  ]),
306
- h(x(r, f({
306
+ h(x(d, f({
307
307
  ref_key: "dropButtonRef",
308
- ref: s
308
+ ref: r
309
309
  }, t.dropButton, {
310
310
  disabled: !t.ableToDrop,
311
311
  onLoading: b,
312
- onLoaded: U,
312
+ onLoaded: S,
313
313
  onClick: P
314
314
  }), null, 16, ["disabled"]), [
315
- [D, W.value && t.mode !== d(O).Create]
315
+ [D, W.value && t.mode !== s(O).Create]
316
316
  ]),
317
- d(C).buttons ? R(t.$slots, "buttons", { key: 4 }) : k("", !0),
318
- (n(!0), w(F, null, H(t.navEndButtons, (T) => h((n(), m(r, f({ ref_for: !0 }, T), null, 16)), [
317
+ s(C).buttons ? R(t.$slots, "buttons", { key: 4 }) : k("", !0),
318
+ (n(!0), w(F, null, H(t.navEndButtons, (T) => h((n(), m(d, f({ ref_for: !0 }, T), null, 16)), [
319
319
  [D, !i.value]
320
320
  ])), 256)),
321
- (n(!0), w(F, null, H(t.navEndButtonsEditing, (T) => h((n(), m(r, f({ ref_for: !0 }, T), null, 16)), [
321
+ (n(!0), w(F, null, H(t.navEndButtonsEditing, (T) => h((n(), m(d, f({ ref_for: !0 }, T), null, 16)), [
322
322
  [D, E.value && !i.value]
323
323
  ])), 256))
324
324
  ];
325
325
  }),
326
326
  _: 3
327
327
  }, 16)) : (n(), w(F, { key: 2 }, [
328
- (n(!0), w(F, null, H(t.navStartButtons, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
328
+ (n(!0), w(F, null, H(t.navStartButtons, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
329
329
  [D, !i.value]
330
330
  ])), 256)),
331
- d(C)["prev-buttons-ever"] ? h((n(), w("div", bt, [
331
+ s(C)["prev-buttons-ever"] ? h((n(), w("div", bt, [
332
332
  R(t.$slots, "prev-buttons-ever", {
333
333
  canUpdate: t.canUpdate,
334
334
  canDrop: t.canDrop,
@@ -337,10 +337,10 @@ const V = (...N) => {
337
337
  ], 512)), [
338
338
  [D, !i.value]
339
339
  ]) : k("", !0),
340
- (n(!0), w(F, null, H(t.navStartButtonsEditing, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
340
+ (n(!0), w(F, null, H(t.navStartButtonsEditing, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
341
341
  [D, E.value && !i.value]
342
342
  ])), 256)),
343
- d(C)["prev-buttons"] ? h((n(), w("div", gt, [
343
+ s(C)["prev-buttons"] ? h((n(), w("div", gt, [
344
344
  R(t.$slots, "prev-buttons", {
345
345
  canUpdate: t.canUpdate,
346
346
  canDrop: t.canDrop,
@@ -349,7 +349,7 @@ const V = (...N) => {
349
349
  ], 512)), [
350
350
  [D, E.value && !i.value]
351
351
  ]) : k("", !0),
352
- h(x(r, f({
352
+ h(x(d, f({
353
353
  ref_key: "saveButtonRef",
354
354
  ref: c
355
355
  }, {
@@ -361,12 +361,12 @@ const V = (...N) => {
361
361
  disabled: !t.ableToUpdate
362
362
  }, {
363
363
  onLoading: b,
364
- onLoaded: U,
364
+ onLoaded: S,
365
365
  onClick: Q
366
366
  }), null, 16), [
367
- [D, t.mode === d(O).Update && I.value]
367
+ [D, t.mode === s(O).Update && I.value]
368
368
  ]),
369
- h(x(r, f({
369
+ h(x(d, f({
370
370
  ref_key: "saveButtonRef",
371
371
  ref: c
372
372
  }, {
@@ -378,35 +378,35 @@ const V = (...N) => {
378
378
  disabled: !t.ableToCreate
379
379
  }, {
380
380
  onLoading: b,
381
- onLoaded: U,
381
+ onLoaded: S,
382
382
  onClick: te
383
383
  }), null, 16), [
384
- [D, t.mode === d(O).Create && I.value]
384
+ [D, t.mode === s(O).Create && I.value]
385
385
  ]),
386
- h(x(r, f({
386
+ h(x(d, f({
387
387
  ref_key: "dropButtonRef",
388
- ref: s
388
+ ref: r
389
389
  }, t.dropButton, {
390
390
  disabled: !t.ableToDrop,
391
391
  onLoading: b,
392
- onLoaded: U,
392
+ onLoaded: S,
393
393
  onClick: P
394
394
  }), null, 16, ["disabled"]), [
395
- [D, W.value && t.mode !== d(O).Create]
395
+ [D, W.value && t.mode !== s(O).Create]
396
396
  ]),
397
- d(C).buttons ? h((n(), w("div", yt, [
397
+ s(C).buttons ? h((n(), w("div", yt, [
398
398
  R(t.$slots, "buttons")
399
399
  ], 512)), [
400
400
  [D, E.value && !i.value]
401
401
  ]) : k("", !0),
402
- (n(!0), w(F, null, H(t.navEndButtons, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
402
+ (n(!0), w(F, null, H(t.navEndButtons, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
403
403
  [D, !i.value]
404
404
  ])), 256)),
405
- (n(!0), w(F, null, H(t.navEndButtonsEditing, (v) => h((n(), m(r, f({ ref_for: !0 }, v), null, 16)), [
405
+ (n(!0), w(F, null, H(t.navEndButtonsEditing, (v) => h((n(), m(d, f({ ref_for: !0 }, v), null, 16)), [
406
406
  [D, E.value && !i.value]
407
407
  ])), 256)),
408
- G.value.length > 0 ? (n(), m(r, Se(f({ key: 3 }, {
409
- type: d(Ne).Tooltip,
408
+ G.value.length > 0 ? (n(), m(d, Se(f({ key: 3 }, {
409
+ type: s(Ne).Tooltip,
410
410
  icon: "lkt-icn-cross-arrows",
411
411
  class: "lkt-item-crud--modifications-button",
412
412
  splitButtons: re.value,
@@ -414,7 +414,7 @@ const V = (...N) => {
414
414
  contentClass: "lkt-flex-column"
415
415
  }
416
416
  })), null, 16)) : k("", !0),
417
- ae.value ? (n(), m(r, f({ key: 4 }, t.editModeButton, {
417
+ ae.value ? (n(), m(d, f({ key: 4 }, t.editModeButton, {
418
418
  checked: E.value,
419
419
  "onUpdate:checked": $[2] || ($[2] = (v) => E.value = v),
420
420
  class: "lkt-item-crud--switch-mode-button"
@@ -499,7 +499,7 @@ const V = (...N) => {
499
499
  "modified-data"
500
500
  ],
501
501
  setup(N, { expose: ge, emit: Ue }) {
502
- const a = N, u = ct(), M = ze(), C = Ue, c = p(!0), s = p(a.modelValue), i = p(a.modifications), E = p(a.customData), b = p(a.perms), U = p(a.editing), te = p(!1), Q = p(!1), P = p(!1), K = p(!1), Y = p(200), L = p(new $e(s.value, a.dataStateConfig)), W = p(new $e(i.value, a.dataStateConfig)), I = p(!1), ae = p(new $e(a.readData)), z = p(a.mode === O.Create), G = p(!1), re = p(!1), t = p(null), $ = p(null), r = B(() => z.value && a.createButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Create)), Z = B(() => !z.value && a.updateButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Update)), _ = B(() => !z.value && a.dropButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Drop)), de = B(() => a.editModeButton !== !1 && !z.value && Array.isArray(b.value) && b.value.includes(we.SwitchEditMode)), j = p(a.visibleView);
502
+ const a = N, u = ct(), M = ze(), C = Ue, c = p(!0), r = p(a.modelValue), i = p(a.modifications), E = p(a.customData), b = p(a.perms), S = p(a.editing), te = p(!1), Q = p(!1), P = p(!1), K = p(!1), Y = p(200), L = p(new $e(r.value, a.dataStateConfig)), W = p(new $e(i.value, a.dataStateConfig)), I = p(!1), ae = p(new $e(a.readData)), z = p(a.mode === O.Create), G = p(!1), re = p(!1), t = p(null), $ = p(null), d = B(() => z.value && a.createButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Create)), Z = B(() => !z.value && a.updateButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Update)), _ = B(() => !z.value && a.dropButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Drop)), de = B(() => a.editModeButton !== !1 && !z.value && Array.isArray(b.value) && b.value.includes(we.SwitchEditMode)), j = p(a.visibleView);
503
503
  y(() => a.visibleView, (e) => {
504
504
  j.value = e;
505
505
  }), y(j, (e) => {
@@ -517,7 +517,7 @@ const V = (...N) => {
517
517
  }), y(() => a.modifications, (e) => {
518
518
  W.value.increment(e), i.value = e;
519
519
  }, { deep: !0 }), y(i, (e) => {
520
- Ee(), W.value.increment(e), ue.value === S.Modifications && (I.value = W.value.changed()), C("update:modifications", e);
520
+ Ee(), W.value.increment(e), ue.value === U.Modifications && (I.value = W.value.changed()), C("update:modifications", e);
521
521
  }, { deep: !0 });
522
522
  const v = p(ee(a.createButton, g.defaultCreateButton)), q = p(ee(a.updateButton, g.defaultUpdateButton)), T = p(ee(a.dropButton, g.defaultDropButton)), ye = p(ee(a.editModeButton, g.defaultEditModeButton)), Me = p(ee(a.groupButton, g.defaultGroupButton));
523
523
  y(() => a.createButton, (e) => {
@@ -540,7 +540,7 @@ const V = (...N) => {
540
540
  }), C("error", A.httpStatus);
541
541
  return;
542
542
  }
543
- P.value = !0, s.value = A.data, i.value = Array.isArray(A.modifications) ? {} : A.modifications, b.value = A.perms, L.value.increment(s.value).turnStoredIntoOriginal(), W.value.increment(i.value).turnStoredIntoOriginal(), I.value = L.value.changed(), ae.value.turnStoredIntoOriginal(), Object.keys(i.value).length > 0 && (j.value = S.Modifications), oe.value && (Ee(), Ke(() => {
543
+ P.value = !0, r.value = A.data, i.value = Array.isArray(A.modifications) ? {} : A.modifications, b.value = A.perms, L.value.increment(r.value).turnStoredIntoOriginal(), W.value.increment(i.value).turnStoredIntoOriginal(), I.value = L.value.changed(), ae.value.turnStoredIntoOriginal(), Object.keys(i.value).length > 0 && (j.value = U.Modifications), oe.value && (Ee(), Ke(() => {
544
544
  $.value.turnStoredIntoOriginal();
545
545
  })), typeof ((X = a.events) == null ? void 0 : X.httpEnd) == "function" && a.events.httpEnd({
546
546
  httpResponse: A
@@ -553,28 +553,28 @@ const V = (...N) => {
553
553
  y(G, (e) => {
554
554
  e && Ke(() => G.value = !1);
555
555
  }), y(() => a.modelValue, (e) => {
556
- s.value = e, L.value.increment(e);
557
- }, { deep: !0 }), y(s, (e) => {
558
- if (V("item updated ->", s.value), typeof a.beforeEmitUpdate == "function") {
556
+ r.value = e, L.value.increment(e);
557
+ }, { deep: !0 }), y(r, (e) => {
558
+ if (V("item updated ->", r.value), typeof a.beforeEmitUpdate == "function") {
559
559
  V("item updated -> has beforeEmitUpdate");
560
- let o = a.beforeEmitUpdate(s.value);
561
- V("item updated -> override with: ", o), typeof o == "object" && (s.value = o);
560
+ let o = a.beforeEmitUpdate(r.value);
561
+ V("item updated -> override with: ", o), typeof o == "object" && (r.value = o);
562
562
  }
563
- oe.value && Ee(), C("update:modelValue", s.value), V("item updated -> update dataState"), L.value.increment(e), ue.value === S.Current && (I.value = L.value.changed()), G.value = !0;
563
+ oe.value && Ee(), C("update:modelValue", r.value), V("item updated -> update dataState"), L.value.increment(e), ue.value === U.Current && (I.value = L.value.changed()), G.value = !0;
564
564
  }, { deep: !0 }), y(b, () => C("perms", b.value)), y(I, (e) => {
565
565
  C("modified-data", e);
566
566
  }), y(() => a.readData, (e) => {
567
567
  ae.value.increment(e), ae.value.changed() && Be();
568
568
  }), y(() => a.editing, (e) => {
569
- V("editing updated -> updating editMode", e), U.value = e;
570
- }), y(U, (e) => {
569
+ V("editing updated -> updating editMode", e), S.value = e;
570
+ }), y(S, (e) => {
571
571
  V("editMode updated -> emit update", e), C("update:editing", e);
572
572
  });
573
573
  const Pe = p(void 0), Ee = () => {
574
- oe.value && (Pe.value = lt(s.value, i.value, fe.value));
574
+ oe.value && (Pe.value = lt(r.value, i.value, fe.value));
575
575
  };
576
576
  ot(() => {
577
- a.readResource && !z.value ? Be() : (z.value, P.value = !0, U.value = !0, c.value = !1, L.value.increment(s.value).turnStoredIntoOriginal(), I.value = L.value.changed());
577
+ a.readResource && !z.value ? Be() : (z.value, P.value = !0, S.value = !0, c.value = !1, L.value.increment(r.value).turnStoredIntoOriginal(), I.value = L.value.changed());
578
578
  });
579
579
  const Ve = (e, o) => {
580
580
  if (o) {
@@ -599,7 +599,7 @@ const V = (...N) => {
599
599
  });
600
600
  return;
601
601
  }
602
- re.value = !0, V("onCreate -> turn stored data into original"), L.value.increment(s.value).turnStoredIntoOriginal(), W.value.turnStoredIntoOriginal(), a.notificationType === ne.Toast && ve({
602
+ re.value = !0, V("onCreate -> turn stored data into original"), L.value.increment(r.value).turnStoredIntoOriginal(), W.value.turnStoredIntoOriginal(), a.notificationType === ne.Toast && ve({
603
603
  text: g.defaultCreateSuccessText,
604
604
  details: g.defaultCreateSuccessDetails,
605
605
  icon: g.defaultCreateSuccessIcon,
@@ -650,13 +650,13 @@ const V = (...N) => {
650
650
  t.value && t.value.doSave();
651
651
  },
652
652
  turnStoredDataIntoOriginal: () => {
653
- L.value.increment(s.value).turnStoredIntoOriginal();
653
+ L.value.increment(r.value).turnStoredIntoOriginal();
654
654
  },
655
655
  hasModifiedData: () => L.value.changed()
656
656
  });
657
657
  const Je = B(() => {
658
658
  var e, o, X;
659
- return De.value ? oe.value ? Q.value ? (e = a.modalConfig) == null ? void 0 : e.closeConfirm : "" : ue.value === S.Modifications ? W.value.changed() ? (o = a.modalConfig) == null ? void 0 : o.closeConfirm : "" : L.value.changed() ? (X = a.modalConfig) == null ? void 0 : X.closeConfirm : "" : "";
659
+ return De.value ? oe.value ? Q.value ? (e = a.modalConfig) == null ? void 0 : e.closeConfirm : "" : ue.value === U.Modifications ? W.value.changed() ? (o = a.modalConfig) == null ? void 0 : o.closeConfirm : "" : L.value.changed() ? (X = a.modalConfig) == null ? void 0 : X.closeConfirm : "" : "";
660
660
  }), Qe = (e) => {
661
661
  var o;
662
662
  if (typeof ((o = a.modalConfig) == null ? void 0 : o.beforeClose) == "function")
@@ -667,61 +667,64 @@ const V = (...N) => {
667
667
  }, Ae = B(() => a.title.startsWith("__:") ? String(ft(a.title.substring(3))) : a.title), Ye = B(() => c.value ? !1 : Ae.value.length > 0 || !!M["post-title"]), Ze = B(() => c.value ? !1 : typeof a.header == "object" && Object.keys(a.header).length > 0), ke = B(() => a.view === Ge.Modal), He = B(() => ke.value ? "lkt-modal" : "section"), Ce = B(() => {
668
668
  var e, o;
669
669
  return a.mode !== O.Update || !Z.value || !a.enabledSaveWithoutChanges && !I.value || oe.value && (!te.value || !Q.value) ? !1 : typeof ((e = q.value) == null ? void 0 : e.disabled) == "function" ? !q.value.disabled({
670
- prop: s.value
670
+ prop: r.value
671
671
  }) : typeof ((o = q.value) == null ? void 0 : o.disabled) == "boolean" ? !q.value.disabled : !0;
672
672
  }), he = B(() => {
673
673
  var e, o;
674
- return a.mode !== O.Create || !r.value || !a.enabledSaveWithoutChanges && !I.value || oe.value && !te.value && !Q.value ? !1 : typeof ((e = v.value) == null ? void 0 : e.disabled) == "function" ? !v.value.disabled({
675
- prop: s.value
674
+ return a.mode !== O.Create || !d.value || !a.enabledSaveWithoutChanges && !I.value || oe.value && !te.value && !Q.value ? !1 : typeof ((e = v.value) == null ? void 0 : e.disabled) == "function" ? !v.value.disabled({
675
+ prop: r.value
676
676
  }) : typeof ((o = v.value) == null ? void 0 : o.disabled) == "boolean" ? !v.value.disabled : !0;
677
677
  }), Oe = B(() => {
678
678
  var e, o;
679
679
  return _.value ? typeof ((e = T.value) == null ? void 0 : e.disabled) == "function" ? !T.value.disabled({
680
- prop: s.value
680
+ prop: r.value
681
681
  }) : typeof ((o = T.value) == null ? void 0 : o.disabled) == "boolean" ? !T.value.disabled : !0 : !1;
682
682
  }), _e = B(() => He.value === "lkt-modal" ? {
683
683
  title: a.title,
684
- item: s.value,
684
+ item: r.value,
685
685
  ...a.modalConfig,
686
686
  beforeClose: Qe,
687
687
  closeConfirm: Je.value,
688
688
  headerActionsButton: a.groupButton !== !1 ? {
689
689
  dot: he.value || Ce.value
690
690
  } : !1
691
- } : {}), oe = B(() => typeof fe.value == "object" && Object.keys(fe.value).length > 0), Le = B(() => Object.keys(i.value).length === 0 ? [] : a.modificationViews), ue = B(() => Object.keys(i.value).length === 0 ? S.Current : S.Modifications), De = B(() => r.value || Z.value || _.value), xe = B(() => oe.value ? rt(fe.value) : []), fe = B(() => typeof a.form == "function" ? a.form({
691
+ } : {}), oe = B(() => typeof fe.value == "object" && Object.keys(fe.value).length > 0), Le = B(() => Object.keys(i.value).length === 0 ? [] : a.modificationViews), ue = B(() => Object.keys(i.value).length === 0 ? U.Current : U.Modifications), De = B(() => d.value || Z.value || _.value), xe = B(() => oe.value ? rt(fe.value) : []), fe = B(() => typeof a.form == "function" ? a.form({
692
692
  mode: a.mode,
693
- view: j.value
693
+ view: j.value,
694
+ item: r.value,
695
+ modifications: i.value,
696
+ editing: S.value
694
697
  }) : a.form);
695
698
  return (e, o) => {
696
699
  const X = me("lkt-header"), A = me("lkt-http-info"), et = me("lkt-form"), tt = me("lkt-loader");
697
700
  return n(), m(nt(He.value), f(_e.value, { class: "lkt-item-crud" }), ce({
698
701
  default: J(() => [
699
702
  !ke.value && Ze.value ? (n(), m(X, Se(f({ key: 0 }, e.header)), null, 16)) : !ke.value && Ye.value ? (n(), w("header", Bt, [
700
- d(M)["pre-title"] ? (n(), w("div", kt, [
703
+ s(M)["pre-title"] ? (n(), w("div", kt, [
701
704
  R(e.$slots, "pre-title", {
702
- item: s.value,
705
+ item: r.value,
703
706
  loading: c.value
704
707
  })
705
708
  ])) : k("", !0),
706
709
  Ae.value.length > 0 ? (n(), w("h1", Ct, ut(Ae.value), 1)) : k("", !0),
707
- d(M)["post-title"] ? (n(), w("div", ht, [
710
+ s(M)["post-title"] ? (n(), w("div", ht, [
708
711
  R(e.$slots, "post-title", {
709
- item: s.value,
712
+ item: r.value,
710
713
  loading: c.value
711
714
  })
712
715
  ])) : k("", !0)
713
716
  ])) : k("", !0),
714
- e.buttonNavPosition === d(je).Top && (e.groupButton === !1 || !e.groupButtonAsModalActions) && De.value ? (n(), m(Fe, {
717
+ e.buttonNavPosition === s(je).Top && (e.groupButton === !1 || !e.groupButtonAsModalActions) && De.value ? (n(), m(Fe, {
715
718
  key: 2,
716
719
  ref_key: "buttonNav",
717
720
  ref: t,
718
721
  loading: c.value,
719
722
  "onUpdate:loading": o[3] || (o[3] = (l) => c.value = l),
720
- editing: U.value,
721
- "onUpdate:editing": o[4] || (o[4] = (l) => U.value = l),
723
+ editing: S.value,
724
+ "onUpdate:editing": o[4] || (o[4] = (l) => S.value = l),
722
725
  "picked-modification-view": j.value,
723
726
  "onUpdate:pickedModificationView": o[5] || (o[5] = (l) => j.value = l),
724
- item: s.value,
727
+ item: r.value,
725
728
  modifications: i.value,
726
729
  mode: e.mode,
727
730
  view: e.view,
@@ -734,7 +737,7 @@ const V = (...N) => {
734
737
  "group-button": Me.value,
735
738
  "data-changed": I.value,
736
739
  "http-success-read": P.value,
737
- "can-create": r.value,
740
+ "can-create": d.value,
738
741
  "can-update": Z.value,
739
742
  "can-drop": _.value,
740
743
  "can-switch-edit-mode": de.value,
@@ -753,7 +756,7 @@ const V = (...N) => {
753
756
  onSave: Te,
754
757
  onDrop: Re
755
758
  }, ce({ _: 2 }, [
756
- d(M)["prev-buttons-ever"] ? {
759
+ s(M)["prev-buttons-ever"] ? {
757
760
  name: "prev-buttons-ever",
758
761
  fn: J(({ canUpdate: l, canDrop: ie, perms: le }) => [
759
762
  R(e.$slots, "prev-buttons-ever", {
@@ -764,7 +767,7 @@ const V = (...N) => {
764
767
  ]),
765
768
  key: "0"
766
769
  } : void 0,
767
- d(M)["prev-buttons"] ? {
770
+ s(M)["prev-buttons"] ? {
768
771
  name: "prev-buttons",
769
772
  fn: J(({ canUpdate: l, canDrop: ie, perms: le }) => [
770
773
  R(e.$slots, "prev-buttons", {
@@ -778,7 +781,7 @@ const V = (...N) => {
778
781
  ]), 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-create", "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", "nav-start-buttons", "nav-start-buttons-editing", "nav-end-buttons", "nav-end-buttons-editing"])) : k("", !0),
779
782
  c.value ? k("", !0) : (n(), w("div", Dt, [
780
783
  P.value ? (n(), w("div", wt, [
781
- K.value && e.notificationType === d(ne).Inline ? (n(), m(A, {
784
+ K.value && e.notificationType === s(ne).Inline ? (n(), m(A, {
782
785
  key: 0,
783
786
  code: Y.value,
784
787
  palette: Y.value === 200 ? "success" : "danger",
@@ -790,8 +793,8 @@ const V = (...N) => {
790
793
  key: 1,
791
794
  ref_key: "formRef",
792
795
  ref: $,
793
- modelValue: s.value,
794
- "onUpdate:modelValue": o[7] || (o[7] = (l) => s.value = l),
796
+ modelValue: r.value,
797
+ "onUpdate:modelValue": o[7] || (o[7] = (l) => r.value = l),
795
798
  modifications: i.value,
796
799
  "onUpdate:modifications": o[8] || (o[8] = (l) => i.value = l),
797
800
  valid: te.value,
@@ -805,7 +808,7 @@ const V = (...N) => {
805
808
  visibleView: j.value,
806
809
  modificationDataState: Pe.value,
807
810
  editableViews: [ue.value],
808
- disabled: !U.value
811
+ disabled: !S.value
809
812
  }), ce({ _: 2 }, [
810
813
  H(xe.value, (l) => ({
811
814
  name: l,
@@ -815,32 +818,32 @@ const V = (...N) => {
815
818
  }))
816
819
  ]), 1040, ["modelValue", "modifications", "valid", "changed"])) : R(e.$slots, "item", {
817
820
  key: 2,
818
- item: s.value,
821
+ item: r.value,
819
822
  loading: c.value,
820
- editMode: U.value,
823
+ editMode: S.value,
821
824
  isCreate: z.value,
822
825
  canUpdate: Z.value,
823
826
  canDrop: _.value,
824
827
  itemBeingEdited: G.value,
825
828
  perms: b.value
826
829
  })
827
- ])) : e.notificationType === d(ne).Inline ? (n(), m(A, {
830
+ ])) : e.notificationType === s(ne).Inline ? (n(), m(A, {
828
831
  key: 1,
829
832
  code: Y.value
830
833
  }, null, 8, ["code"])) : k("", !0)
831
834
  ])),
832
835
  c.value ? (n(), m(tt, { key: 4 })) : k("", !0),
833
- e.buttonNavPosition === d(je).Bottom && (e.groupButton === !1 || !e.groupButtonAsModalActions) && De.value ? (n(), m(Fe, {
836
+ e.buttonNavPosition === s(je).Bottom && (e.groupButton === !1 || !e.groupButtonAsModalActions) && De.value ? (n(), m(Fe, {
834
837
  key: 5,
835
838
  ref_key: "buttonNav",
836
839
  ref: t,
837
840
  loading: c.value,
838
841
  "onUpdate:loading": o[11] || (o[11] = (l) => c.value = l),
839
- editing: U.value,
840
- "onUpdate:editing": o[12] || (o[12] = (l) => U.value = l),
842
+ editing: S.value,
843
+ "onUpdate:editing": o[12] || (o[12] = (l) => S.value = l),
841
844
  "picked-modification-view": j.value,
842
845
  "onUpdate:pickedModificationView": o[13] || (o[13] = (l) => j.value = l),
843
- item: s.value,
846
+ item: r.value,
844
847
  modifications: i.value,
845
848
  mode: e.mode,
846
849
  view: e.view,
@@ -853,7 +856,7 @@ const V = (...N) => {
853
856
  "group-button": Me.value,
854
857
  "data-changed": I.value,
855
858
  "http-success-read": P.value,
856
- "can-create": r.value,
859
+ "can-create": d.value,
857
860
  "can-update": Z.value,
858
861
  "can-drop": _.value,
859
862
  "can-switch-edit-mode": de.value,
@@ -872,14 +875,14 @@ const V = (...N) => {
872
875
  onSave: Te,
873
876
  onDrop: Re
874
877
  }, ce({ _: 2 }, [
875
- d(M)["prev-buttons-ever"] ? {
878
+ s(M)["prev-buttons-ever"] ? {
876
879
  name: "prev-buttons-ever",
877
880
  fn: J(() => [
878
881
  R(e.$slots, "prev-buttons-ever")
879
882
  ]),
880
883
  key: "0"
881
884
  } : void 0,
882
- d(M)["prev-buttons"] ? {
885
+ s(M)["prev-buttons"] ? {
883
886
  name: "prev-buttons-ever",
884
887
  fn: J(() => [
885
888
  R(e.$slots, "prev-buttons")
@@ -893,17 +896,17 @@ const V = (...N) => {
893
896
  e.groupButton !== !1 && e.groupButtonAsModalActions && De.value ? {
894
897
  name: "header-actions",
895
898
  fn: J(() => [
896
- e.buttonNavPosition === d(je).Top ? (n(), m(Fe, {
899
+ e.buttonNavPosition === s(je).Top ? (n(), m(Fe, {
897
900
  key: 0,
898
901
  ref_key: "buttonNav",
899
902
  ref: t,
900
903
  loading: c.value,
901
904
  "onUpdate:loading": o[0] || (o[0] = (l) => c.value = l),
902
- editing: U.value,
903
- "onUpdate:editing": o[1] || (o[1] = (l) => U.value = l),
905
+ editing: S.value,
906
+ "onUpdate:editing": o[1] || (o[1] = (l) => S.value = l),
904
907
  "picked-modification-view": j.value,
905
908
  "onUpdate:pickedModificationView": o[2] || (o[2] = (l) => j.value = l),
906
- item: s.value,
909
+ item: r.value,
907
910
  modifications: i.value,
908
911
  mode: e.mode,
909
912
  view: e.view,
@@ -916,7 +919,7 @@ const V = (...N) => {
916
919
  "group-button": Me.value,
917
920
  "data-changed": I.value,
918
921
  "http-success-read": P.value,
919
- "can-create": r.value,
922
+ "can-create": d.value,
920
923
  "can-update": Z.value,
921
924
  "can-drop": _.value,
922
925
  "can-switch-edit-mode": de.value,
@@ -935,7 +938,7 @@ const V = (...N) => {
935
938
  onSave: Te,
936
939
  onDrop: Re
937
940
  }, ce({ _: 2 }, [
938
- d(M)["prev-buttons-ever"] ? {
941
+ s(M)["prev-buttons-ever"] ? {
939
942
  name: "prev-buttons-ever",
940
943
  fn: J(({ canUpdate: l, canDrop: ie, perms: le }) => [
941
944
  R(e.$slots, "prev-buttons-ever", {
@@ -946,7 +949,7 @@ const V = (...N) => {
946
949
  ]),
947
950
  key: "0"
948
951
  } : void 0,
949
- d(M)["prev-buttons"] ? {
952
+ s(M)["prev-buttons"] ? {
950
953
  name: "prev-buttons",
951
954
  fn: J(({ canUpdate: l, canDrop: ie, perms: le }) => [
952
955
  R(e.$slots, "prev-buttons", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -546,6 +546,9 @@
546
546
  if (typeof props.form === 'function') return props.form({
547
547
  mode: props.mode,
548
548
  view: pickedModificationView.value,
549
+ item: item.value,
550
+ modifications: itemModifications.value,
551
+ editing: editMode.value
549
552
  });
550
553
  return props.form;
551
554
  })