lkt-item-crud 2.0.12 → 2.0.13

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,25 +1,25 @@
1
- import { defineComponent as Be, ref as p, watch as h, useSlots as ke, computed as k, resolveComponent as se, createElementBlock as E, createCommentVNode as l, openBlock as m, createBlock as A, mergeProps as N, withCtx as M, renderSlot as g, withDirectives as V, unref as n, createVNode as K, vShow as O, Fragment as Ue, mergeDefaults as Se, nextTick as Ie, onMounted as we, resolveDynamicComponent as Me, normalizeProps as Re, guardReactiveProps as Te, createElementVNode as Ee, toDisplayString as $e, createSlots as ce } from "vue";
2
- import { httpCall as Le } from "lkt-http-client";
1
+ import { defineComponent as Be, ref as p, watch as h, useSlots as ke, computed as k, resolveComponent as se, createElementBlock as E, createCommentVNode as i, openBlock as b, createBlock as j, mergeProps as L, withCtx as M, renderSlot as y, withDirectives as O, unref as n, createVNode as H, vShow as V, Fragment as Ue, mergeDefaults as Se, nextTick as Ie, onMounted as we, resolveDynamicComponent as Me, normalizeProps as Re, guardReactiveProps as Te, createElementVNode as Ee, toDisplayString as $e, createSlots as ce } from "vue";
2
+ import { httpCall as Ne } from "lkt-http-client";
3
3
  import { DataState as fe } from "lkt-data-state";
4
- import { ensureButtonConfig as j, LktSettings as d, ItemCrudMode as w, ItemCrudButtonNavVisibility as me, TablePermission as ie, ItemCrudView as be, ItemCrudButtonNavPosition as ge, NotificationType as X, getDefaultValues as Ne, ItemCrud as Ve, ToastPositionX as W } from "lkt-vue-kernel";
5
- import { closeModal as Oe } from "lkt-modal";
4
+ import { ensureButtonConfig as A, LktSettings as r, ItemCrudMode as I, ItemCrudButtonNavVisibility as me, TablePermission as ie, ItemCrudView as be, ItemCrudButtonNavPosition as ge, NotificationType as X, getDefaultValues as Le, ItemCrud as Oe, ToastPositionX as W } from "lkt-vue-kernel";
5
+ import { closeModal as Ve, updateModalKey as Ae } from "lkt-modal";
6
6
  import { __ as je } from "lkt-i18n";
7
7
  import { openToast as J } from "lkt-toast";
8
8
  const x = class x {
9
9
  };
10
10
  x.debugEnabled = !1, x.defaultSaveIcon = "", x.defaultDropIcon = "";
11
11
  let Q = x;
12
- const B = (...C) => {
13
- Q.debugEnabled && console.info("[LktItemCrud] ", ...C);
14
- }, ot = (C = !0) => {
15
- Q.debugEnabled = C;
16
- }, Ae = {
17
- key: 0,
18
- class: "lkt-item-crud-buttons"
12
+ const m = (...D) => {
13
+ Q.debugEnabled && console.info("[LktItemCrud] ", ...D);
14
+ }, ut = (D = !0) => {
15
+ Q.debugEnabled = D;
19
16
  }, Pe = {
20
17
  key: 0,
21
18
  class: "lkt-item-crud-buttons"
22
19
  }, Xe = {
20
+ key: 0,
21
+ class: "lkt-item-crud-buttons"
22
+ }, Ke = {
23
23
  key: 1,
24
24
  class: "lkt-item-crud-buttons"
25
25
  }, Fe = {
@@ -53,30 +53,30 @@ const B = (...C) => {
53
53
  "save",
54
54
  "drop"
55
55
  ],
56
- setup(C, { expose: ee, emit: ue }) {
57
- const o = ue, a = C, b = p(j(a.createButton, d.defaultCreateButton)), i = p(j(a.updateButton, d.defaultUpdateButton)), r = p(j(a.dropButton, d.defaultDropButton)), y = p(j(a.editModeButton, d.defaultEditModeButton)), R = p(j(a.groupButton, d.defaultGroupButton));
56
+ setup(D, { expose: ee, emit: ue }) {
57
+ const o = ue, a = D, g = p(A(a.createButton, r.defaultCreateButton)), s = p(A(a.updateButton, r.defaultUpdateButton)), d = p(A(a.dropButton, r.defaultDropButton)), B = p(A(a.editModeButton, r.defaultEditModeButton)), R = p(A(a.groupButton, r.defaultGroupButton));
58
58
  h(() => a.createButton, (e) => {
59
- b.value = j(e, d.defaultCreateButton);
59
+ g.value = A(e, r.defaultCreateButton);
60
60
  }, { deep: !0 }), h(() => a.updateButton, (e) => {
61
- i.value = j(e, d.defaultUpdateButton);
61
+ s.value = A(e, r.defaultUpdateButton);
62
62
  }, { deep: !0 }), h(() => a.dropButton, (e) => {
63
- r.value = j(e, d.defaultDropButton);
63
+ d.value = A(e, r.defaultDropButton);
64
64
  }, { deep: !0 }), h(() => a.editModeButton, (e) => {
65
- y.value = j(e, d.defaultEditModeButton);
65
+ B.value = A(e, r.defaultEditModeButton);
66
66
  }, { deep: !0 });
67
- const v = ke(), S = p(null), D = p(null), s = p(a.loading);
68
- h(() => a.loading, (e) => s.value = e), h(s, (e) => o("update:loading", e));
67
+ const v = ke(), S = p(null), U = p(null), l = p(a.loading);
68
+ h(() => a.loading, (e) => l.value = e), h(l, (e) => o("update:loading", e));
69
69
  const c = p(a.editing);
70
70
  h(() => a.editing, (e) => c.value = e), h(c, (e) => o("update:editing", e));
71
71
  const $ = () => {
72
- s.value = !0;
73
- }, U = () => {
74
- s.value = !1;
75
- }, G = (e, f) => {
72
+ l.value = !0;
73
+ }, C = () => {
74
+ l.value = !1;
75
+ }, F = (e, f) => {
76
76
  typeof e > "u" || o("create", e, f);
77
77
  }, Y = (e, f) => {
78
78
  typeof e > "u" || o("save", e, f);
79
- }, L = (e, f) => {
79
+ }, N = (e, f) => {
80
80
  typeof e > "u" || o("drop", e, f);
81
81
  };
82
82
  ee({
@@ -84,216 +84,216 @@ const B = (...C) => {
84
84
  S.value && typeof S.value.click == "function" && S.value.click();
85
85
  },
86
86
  doDrop: () => {
87
- D.value && typeof D.value.click == "function" && D.value.click();
87
+ U.value && typeof U.value.click == "function" && U.value.click();
88
88
  }
89
89
  });
90
90
  const Z = k(() => {
91
91
  var e, f;
92
- return a.mode !== w.Update || !a.canUpdate || !a.dataChanged ? !1 : typeof ((e = i.value) == null ? void 0 : e.disabled) == "function" ? !i.value.disabled(a.item) : typeof ((f = i.value) == null ? void 0 : f.disabled) == "boolean" ? !i.value.disabled : !0;
93
- }), F = k(() => {
92
+ return a.mode !== I.Update || !a.canUpdate || !a.dataChanged ? !1 : typeof ((e = s.value) == null ? void 0 : e.disabled) == "function" ? !s.value.disabled(a.item) : typeof ((f = s.value) == null ? void 0 : f.disabled) == "boolean" ? !s.value.disabled : !0;
93
+ }), K = k(() => {
94
94
  var e, f;
95
- return a.mode !== w.Create || !a.dataChanged ? !1 : typeof ((e = b.value) == null ? void 0 : e.disabled) == "function" ? !b.value.disabled(a.item) : typeof ((f = b.value) == null ? void 0 : f.disabled) == "boolean" ? !b.value.disabled : !0;
96
- }), q = k(() => {
95
+ return a.mode !== I.Create || !a.dataChanged ? !1 : typeof ((e = g.value) == null ? void 0 : e.disabled) == "function" ? !g.value.disabled(a.item) : typeof ((f = g.value) == null ? void 0 : f.disabled) == "boolean" ? !g.value.disabled : !0;
96
+ }), G = k(() => {
97
97
  var e, f;
98
- return a.canDrop ? typeof ((e = r.value) == null ? void 0 : e.disabled) == "function" ? !r.value.disabled(a.item) : typeof ((f = r.value) == null ? void 0 : f.disabled) == "boolean" ? !r.value.disabled : !0 : !1;
99
- }), z = k(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !s.value && a.editing && a.httpSuccessRead), P = k(() => a.mode === w.Create && a.createButton === !1 || a.mode === w.Update && a.updateButton === !1 || s.value ? !1 : a.editing && a.httpSuccessRead), H = k(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !s.value && a.mode !== w.Create && a.httpSuccessRead), oe = k(() => a.buttonNavVisibility === me.Always || v["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === me.Never ? !1 : P.value || z.value || H.value);
98
+ return a.canDrop ? typeof ((e = d.value) == null ? void 0 : e.disabled) == "function" ? !d.value.disabled(a.item) : typeof ((f = d.value) == null ? void 0 : f.disabled) == "boolean" ? !d.value.disabled : !0 : !1;
99
+ }), q = k(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !l.value && a.editing && a.httpSuccessRead), P = k(() => a.mode === I.Create && a.createButton === !1 || a.mode === I.Update && a.updateButton === !1 || l.value ? !1 : a.editing && a.httpSuccessRead), z = k(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !l.value && a.mode !== I.Create && a.httpSuccessRead), oe = k(() => a.buttonNavVisibility === me.Always || v["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === me.Never ? !1 : P.value || q.value || z.value);
100
100
  return (e, f) => {
101
101
  const T = se("lkt-button");
102
- return oe.value ? (m(), E("div", Ae, [
103
- e.groupButton !== !1 ? (m(), A(T, N({
102
+ return oe.value ? (b(), E("div", Pe, [
103
+ e.groupButton !== !1 ? (b(), j(T, L({
104
104
  key: 0,
105
105
  ref: "groupButton"
106
106
  }, R.value, { class: "lkt-item-crud-group-button" }), {
107
107
  split: M(() => [
108
- H.value ? (m(), A(T, N({ key: 0 }, y.value, {
108
+ z.value ? (b(), j(T, L({ key: 0 }, B.value, {
109
109
  checked: c.value,
110
110
  "onUpdate:checked": f[0] || (f[0] = (_) => c.value = _),
111
111
  class: "lkt-item-crud--switch-mode-button"
112
- }), null, 16, ["checked"])) : l("", !0),
113
- n(v)["prev-buttons-ever"] ? g(e.$slots, "prev-buttons-ever", {
112
+ }), null, 16, ["checked"])) : i("", !0),
113
+ n(v)["prev-buttons-ever"] ? y(e.$slots, "prev-buttons-ever", {
114
114
  key: 1,
115
115
  canUpdate: e.canUpdate,
116
116
  canDrop: e.canDrop,
117
117
  perms: e.perms
118
- }) : l("", !0),
119
- n(v)["prev-buttons"] ? g(e.$slots, "prev-buttons", {
118
+ }) : i("", !0),
119
+ n(v)["prev-buttons"] ? y(e.$slots, "prev-buttons", {
120
120
  key: 2,
121
121
  canUpdate: e.canUpdate,
122
122
  canDrop: e.canDrop,
123
123
  perms: e.perms
124
- }) : l("", !0),
125
- V(K(T, N({
124
+ }) : i("", !0),
125
+ O(H(T, L({
126
126
  ref_key: "saveButtonRef",
127
127
  ref: S
128
- }, i.value, {
128
+ }, s.value, {
129
129
  disabled: !Z.value,
130
130
  onLoading: $,
131
- onLoaded: U,
131
+ onLoaded: C,
132
132
  onClick: Y
133
133
  }), {
134
134
  default: M(() => [
135
- n(v)["button-save"] ? g(e.$slots, "button-save", {
135
+ n(v)["button-save"] ? y(e.$slots, "button-save", {
136
136
  key: 0,
137
137
  item: e.item,
138
138
  editMode: c.value,
139
139
  isCreate: !1,
140
140
  canUpdate: e.canUpdate,
141
141
  canDrop: e.canDrop
142
- }) : l("", !0)
142
+ }) : i("", !0)
143
143
  ]),
144
144
  _: 3
145
145
  }, 16, ["disabled"]), [
146
- [O, e.mode === n(w).Update && P.value]
146
+ [V, e.mode === n(I).Update && P.value]
147
147
  ]),
148
- V(K(T, N({
148
+ O(H(T, L({
149
149
  ref_key: "saveButtonRef",
150
150
  ref: S
151
- }, b.value, {
152
- disabled: !F.value,
151
+ }, g.value, {
152
+ disabled: !K.value,
153
153
  onLoading: $,
154
- onLoaded: U,
155
- onClick: G
154
+ onLoaded: C,
155
+ onClick: F
156
156
  }), {
157
157
  default: M(() => [
158
- n(v)["button-save"] ? g(e.$slots, "button-save", {
158
+ n(v)["button-save"] ? y(e.$slots, "button-save", {
159
159
  key: 0,
160
160
  item: e.item,
161
161
  editMode: c.value,
162
162
  isCreate: !0,
163
163
  canUpdate: e.canUpdate,
164
164
  canDrop: e.canDrop
165
- }) : l("", !0)
165
+ }) : i("", !0)
166
166
  ]),
167
167
  _: 3
168
168
  }, 16, ["disabled"]), [
169
- [O, e.mode === n(w).Create && P.value]
169
+ [V, e.mode === n(I).Create && P.value]
170
170
  ]),
171
- V(K(T, N({
171
+ O(H(T, L({
172
172
  ref_key: "dropButtonRef",
173
- ref: D
174
- }, r.value, {
175
- disabled: !q.value,
173
+ ref: U
174
+ }, d.value, {
175
+ disabled: !G.value,
176
176
  onLoading: $,
177
- onLoaded: U,
178
- onClick: L
177
+ onLoaded: C,
178
+ onClick: N
179
179
  }), {
180
180
  default: M(() => [
181
- n(v)["button-drop"] ? g(e.$slots, "button-drop", {
181
+ n(v)["button-drop"] ? y(e.$slots, "button-drop", {
182
182
  key: 0,
183
183
  item: e.item,
184
184
  editMode: c.value,
185
185
  isCreate: !1,
186
186
  canUpdate: e.canUpdate,
187
187
  canDrop: e.canDrop
188
- }) : l("", !0)
188
+ }) : i("", !0)
189
189
  ]),
190
190
  _: 3
191
191
  }, 16, ["disabled"]), [
192
- [O, z.value && e.mode !== n(w).Create]
192
+ [V, q.value && e.mode !== n(I).Create]
193
193
  ]),
194
- n(v).buttons ? g(e.$slots, "buttons", { key: 3 }) : l("", !0)
194
+ n(v).buttons ? y(e.$slots, "buttons", { key: 3 }) : i("", !0)
195
195
  ]),
196
196
  _: 3
197
- }, 16)) : (m(), E(Ue, { key: 1 }, [
198
- n(v)["prev-buttons-ever"] ? V((m(), E("div", Pe, [
199
- g(e.$slots, "prev-buttons-ever", {
197
+ }, 16)) : (b(), E(Ue, { key: 1 }, [
198
+ n(v)["prev-buttons-ever"] ? O((b(), E("div", Xe, [
199
+ y(e.$slots, "prev-buttons-ever", {
200
200
  canUpdate: e.canUpdate,
201
201
  canDrop: e.canDrop,
202
202
  perms: e.perms
203
203
  })
204
204
  ], 512)), [
205
- [O, !s.value]
206
- ]) : l("", !0),
207
- n(v)["prev-buttons"] ? V((m(), E("div", Xe, [
208
- g(e.$slots, "prev-buttons", {
205
+ [V, !l.value]
206
+ ]) : i("", !0),
207
+ n(v)["prev-buttons"] ? O((b(), E("div", Ke, [
208
+ y(e.$slots, "prev-buttons", {
209
209
  canUpdate: e.canUpdate,
210
210
  canDrop: e.canDrop,
211
211
  perms: e.perms
212
212
  })
213
213
  ], 512)), [
214
- [O, c.value && !s.value]
215
- ]) : l("", !0),
216
- V(K(T, N({
214
+ [V, c.value && !l.value]
215
+ ]) : i("", !0),
216
+ O(H(T, L({
217
217
  ref_key: "saveButtonRef",
218
218
  ref: S
219
- }, i.value, {
219
+ }, s.value, {
220
220
  disabled: !Z.value,
221
221
  onLoading: $,
222
- onLoaded: U,
222
+ onLoaded: C,
223
223
  onClick: Y
224
224
  }), {
225
225
  default: M(() => [
226
- n(v)["button-save"] ? g(e.$slots, "button-save", {
226
+ n(v)["button-save"] ? y(e.$slots, "button-save", {
227
227
  key: 0,
228
228
  item: e.item,
229
229
  editMode: c.value,
230
230
  isCreate: !1,
231
231
  canUpdate: e.canUpdate,
232
232
  canDrop: e.canDrop
233
- }) : l("", !0)
233
+ }) : i("", !0)
234
234
  ]),
235
235
  _: 3
236
236
  }, 16, ["disabled"]), [
237
- [O, e.mode === n(w).Update && P.value]
237
+ [V, e.mode === n(I).Update && P.value]
238
238
  ]),
239
- V(K(T, N({
239
+ O(H(T, L({
240
240
  ref_key: "saveButtonRef",
241
241
  ref: S
242
- }, b.value, {
243
- disabled: !F.value,
242
+ }, g.value, {
243
+ disabled: !K.value,
244
244
  onLoading: $,
245
- onLoaded: U,
246
- onClick: G
245
+ onLoaded: C,
246
+ onClick: F
247
247
  }), {
248
248
  default: M(() => [
249
- n(v)["button-save"] ? g(e.$slots, "button-save", {
249
+ n(v)["button-save"] ? y(e.$slots, "button-save", {
250
250
  key: 0,
251
251
  item: e.item,
252
252
  editMode: c.value,
253
253
  isCreate: !0,
254
254
  canUpdate: e.canUpdate,
255
- canDrop: e.canDrop
256
- }) : l("", !0)
255
+ canDrop: !1
256
+ }) : i("", !0)
257
257
  ]),
258
258
  _: 3
259
259
  }, 16, ["disabled"]), [
260
- [O, e.mode === n(w).Create && P.value]
260
+ [V, e.mode === n(I).Create && P.value]
261
261
  ]),
262
- V(K(T, N({
262
+ O(H(T, L({
263
263
  ref_key: "dropButtonRef",
264
- ref: D
265
- }, r.value, {
266
- disabled: !q.value,
264
+ ref: U
265
+ }, d.value, {
266
+ disabled: !G.value,
267
267
  onLoading: $,
268
- onLoaded: U,
269
- onClick: L
268
+ onLoaded: C,
269
+ onClick: N
270
270
  }), {
271
271
  default: M(() => [
272
- n(v)["button-drop"] ? g(e.$slots, "button-drop", {
272
+ n(v)["button-drop"] ? y(e.$slots, "button-drop", {
273
273
  key: 0,
274
274
  item: e.item,
275
275
  editMode: c.value,
276
276
  isCreate: !1,
277
277
  canUpdate: e.canUpdate,
278
278
  canDrop: e.canDrop
279
- }) : l("", !0)
279
+ }) : i("", !0)
280
280
  ]),
281
281
  _: 3
282
282
  }, 16, ["disabled"]), [
283
- [O, z.value && e.mode !== n(w).Create]
283
+ [V, q.value && e.mode !== n(I).Create]
284
284
  ]),
285
- n(v).buttons ? V((m(), E("div", Fe, [
286
- g(e.$slots, "buttons")
285
+ n(v).buttons ? O((b(), E("div", Fe, [
286
+ y(e.$slots, "buttons")
287
287
  ], 512)), [
288
- [O, c.value && !s.value]
289
- ]) : l("", !0),
290
- H.value ? (m(), A(T, N({ key: 3 }, y.value, {
288
+ [V, c.value && !l.value]
289
+ ]) : i("", !0),
290
+ z.value ? (b(), j(T, L({ key: 3 }, B.value, {
291
291
  checked: c.value,
292
292
  "onUpdate:checked": f[1] || (f[1] = (_) => c.value = _),
293
293
  class: "lkt-item-crud--switch-mode-button"
294
- }), null, 16, ["checked"])) : l("", !0)
294
+ }), null, 16, ["checked"])) : i("", !0)
295
295
  ], 64))
296
- ])) : l("", !0);
296
+ ])) : i("", !0);
297
297
  };
298
298
  }
299
299
  }), Ge = { class: "lkt-item-crud" }, qe = {
@@ -305,16 +305,16 @@ const B = (...C) => {
305
305
  }, He = {
306
306
  key: 1,
307
307
  class: "lkt-item-crud_header-title"
308
- }, Ke = {
308
+ }, We = {
309
309
  key: 2,
310
310
  class: "lkt-item-crud_header-slot"
311
- }, We = {
311
+ }, Je = {
312
312
  key: 2,
313
313
  class: "lkt-item-crud_content"
314
- }, Je = {
314
+ }, Qe = {
315
315
  key: 0,
316
316
  class: "lkt-grid-1"
317
- }, Qe = /* @__PURE__ */ Be({
317
+ }, Ye = /* @__PURE__ */ Be({
318
318
  __name: "LktItemCrud",
319
319
  props: /* @__PURE__ */ Se({
320
320
  modelValue: {},
@@ -337,7 +337,7 @@ const B = (...C) => {
337
337
  title: {},
338
338
  beforeEmitUpdate: { type: Function },
339
339
  notificationType: {}
340
- }, Ne(Ve)),
340
+ }, Le(Oe)),
341
341
  emits: [
342
342
  "update:modelValue",
343
343
  "update:editing",
@@ -350,112 +350,119 @@ const B = (...C) => {
350
350
  "error",
351
351
  "modified-data"
352
352
  ],
353
- setup(C, { expose: ee, emit: ue }) {
354
- const o = C, a = ke(), b = ue, i = p(!0), r = p(o.modelValue), y = p(o.perms), R = p(o.editing), v = p(!1), S = p(!1), D = p(200), s = p(new fe(r.value, o.dataStateConfig)), c = p(!1), $ = p(new fe(o.readData)), U = p(o.mode === w.Create), G = p(!1), Y = p(!1), L = p(null), te = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.Update)), ae = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.Drop)), Z = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.SwitchEditMode)), F = async () => {
355
- B("fetchItem"), i.value = !0, D.value = -1, S.value = !1;
353
+ setup(D, { expose: ee, emit: ue }) {
354
+ const o = D, a = ke(), g = ue, s = p(!0), d = p(o.modelValue), B = p(o.perms), R = p(o.editing), v = p(!1), S = p(!1), U = p(200), l = p(new fe(d.value, o.dataStateConfig)), c = p(!1), $ = p(new fe(o.readData)), C = p(o.mode === I.Create), F = p(!1), Y = p(!1), N = p(null), te = k(() => !C.value && Array.isArray(B.value) && B.value.includes(ie.Update)), ae = k(() => !C.value && Array.isArray(B.value) && B.value.includes(ie.Drop)), Z = k(() => !C.value && Array.isArray(B.value) && B.value.includes(ie.SwitchEditMode));
355
+ h(() => o.mode, (t) => {
356
+ C.value = t === I.Create;
357
+ });
358
+ const K = async () => {
359
+ m("fetchItem"), s.value = !0, U.value = -1, S.value = !1;
356
360
  try {
357
- const t = await Le(o.readResource, o.readData);
358
- if (B("fetchItem -> response", t), i.value = !1, D.value = t.httpStatus, !t.success) {
359
- v.value = !1, D.value = t.httpStatus, b("error", t.httpStatus);
361
+ const t = await Ne(o.readResource, o.readData);
362
+ if (m("fetchItem -> response", t), s.value = !1, U.value = t.httpStatus, !t.success) {
363
+ v.value = !1, U.value = t.httpStatus, g("error", t.httpStatus);
360
364
  return;
361
365
  }
362
- v.value = !0, r.value = t.data, y.value = t.perms, s.value.increment(r.value).turnStoredIntoOriginal(), c.value = s.value.changed(), $.value.turnStoredIntoOriginal(), b("read", t);
366
+ v.value = !0, d.value = t.data, B.value = t.perms, l.value.increment(d.value).turnStoredIntoOriginal(), c.value = l.value.changed(), $.value.turnStoredIntoOriginal(), g("read", t);
363
367
  } catch {
364
- i.value = !1, v.value = !1, D.value = 404, b("error", 404);
368
+ s.value = !1, v.value = !1, U.value = 404, g("error", 404);
365
369
  return;
366
370
  }
367
371
  };
368
372
  h(() => o.modelValue, (t) => {
369
- r.value = t, s.value.increment(t);
370
- }, { deep: !0 }), h(r, (t) => {
371
- if (G.value = !0, B("item updated ->", r.value), typeof o.beforeEmitUpdate == "function") {
372
- B("item updated -> has beforeEmitUpdate");
373
- let u = o.beforeEmitUpdate(r.value);
374
- B("item updated -> override with: ", u), typeof u == "object" && (r.value = u);
373
+ d.value = t, l.value.increment(t);
374
+ }, { deep: !0 }), h(d, (t) => {
375
+ if (F.value = !0, m("item updated ->", d.value), typeof o.beforeEmitUpdate == "function") {
376
+ m("item updated -> has beforeEmitUpdate");
377
+ let u = o.beforeEmitUpdate(d.value);
378
+ m("item updated -> override with: ", u), typeof u == "object" && (d.value = u);
375
379
  }
376
- b("update:modelValue", r.value), B("item updated -> update dataState"), s.value.increment(t), c.value = s.value.changed(), Ie(() => G.value = !1);
377
- }, { deep: !0 }), h(y, () => b("perms", y.value)), h(c, (t) => {
378
- b("modified-data", t);
380
+ g("update:modelValue", d.value), m("item updated -> update dataState"), l.value.increment(t), c.value = l.value.changed(), Ie(() => F.value = !1);
381
+ }, { deep: !0 }), h(B, () => g("perms", B.value)), h(c, (t) => {
382
+ g("modified-data", t);
379
383
  }), h(() => o.readData, (t) => {
380
- $.value.increment(t), $.value.changed() && F();
384
+ $.value.increment(t), $.value.changed() && K();
381
385
  }), h(() => o.editing, (t) => {
382
- B("editing updated -> updating editMode", t), R.value = t;
386
+ m("editing updated -> updating editMode", t), R.value = t;
383
387
  }), h(R, (t) => {
384
- B("editMode updated -> emit update", t), b("update:editing", t);
388
+ m("editMode updated -> emit update", t), g("update:editing", t);
385
389
  }), we(() => {
386
- o.readResource && !U.value ? F() : (U.value, v.value = !0, R.value = !0, i.value = !1, s.value.increment(r.value).turnStoredIntoOriginal(), c.value = s.value.changed());
390
+ o.readResource && !C.value ? K() : (C.value, v.value = !0, R.value = !0, s.value = !1, l.value.increment(d.value).turnStoredIntoOriginal(), c.value = l.value.changed());
387
391
  });
388
- const q = (t, u) => {
392
+ const G = (t, u) => {
389
393
  if (u) {
390
- if (i.value = !1, typeof t < "u" && (D.value = t.httpStatus, !t.success))
391
- return S.value = !0, b("error", t.httpStatus), !1;
394
+ if (s.value = !1, typeof t < "u" && (U.value = t.httpStatus, !t.success))
395
+ return S.value = !0, g("error", t.httpStatus), !1;
392
396
  S.value = !0;
393
397
  }
394
398
  return !0;
395
- }, z = (t) => {
396
- !de.value && typeof t < "u" && t.autoReloadId && (B("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), o.readData.id = t.autoReloadId, B("doAutoReloadId -> turning off create mode"), U.value = !1, F());
399
+ }, q = (t) => {
400
+ m("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId && (m("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), de.value ? (m("doAutoReloadId -> insideModal: ", o), Ae(o.modalConfig.modalName, o.modalConfig.modalKey, t.autoReloadId)) : (m("doAutoReloadId -> outsideModal"), o.readData.id = t.autoReloadId, m("doAutoReloadId -> turning off create mode"), C.value = !1, K()));
397
401
  }, P = (t, u) => {
398
- if (B("onCreate"), !q(u, o.createButton.resource)) {
402
+ if (m("onCreate"), !G(u, o.createButton.resource)) {
399
403
  o.notificationType === X.Toast && J({
400
- text: d.defaultCreateErrorText,
401
- details: d.defaultCreateErrorDetails,
402
- icon: d.defaultCreateErrorIcon,
404
+ text: r.defaultCreateErrorText,
405
+ details: r.defaultCreateErrorDetails,
406
+ icon: r.defaultCreateErrorIcon,
403
407
  positionX: W.Right
404
408
  });
405
409
  return;
406
410
  }
407
- Y.value = !0, B("onCreate -> turn stored data into original"), s.value.increment(r.value).turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
408
- text: d.defaultCreateSuccessText,
409
- details: d.defaultCreateSuccessDetails,
410
- icon: d.defaultCreateSuccessIcon,
411
+ Y.value = !0, m("onCreate -> turn stored data into original"), l.value.increment(d.value).turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
412
+ text: r.defaultCreateSuccessText,
413
+ details: r.defaultCreateSuccessDetails,
414
+ icon: r.defaultCreateSuccessIcon,
411
415
  positionX: W.Right
412
- }), z(u), b("create", u);
413
- }, H = (t, u) => {
414
- if (B("onUpdate"), !q(u, o.updateButton.resource)) {
416
+ }), q(u), m("onCreate -> beforeEmitCreate"), g("create", u);
417
+ }, z = (t, u) => {
418
+ if (m("onUpdate"), !G(u, o.updateButton.resource)) {
415
419
  o.notificationType === X.Toast && J({
416
- text: d.defaultUpdateErrorText,
417
- details: d.defaultUpdateErrorDetails,
418
- icon: d.defaultUpdateErrorIcon,
420
+ text: r.defaultUpdateErrorText,
421
+ details: r.defaultUpdateErrorDetails,
422
+ icon: r.defaultUpdateErrorIcon,
419
423
  positionX: W.Right
420
424
  });
421
425
  return;
422
426
  }
423
- B("onUpdate -> turn stored data into original"), s.value.turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
424
- text: d.defaultUpdateSuccessText,
425
- details: d.defaultUpdateSuccessDetails,
426
- icon: d.defaultUpdateSuccessIcon,
427
+ m("onUpdate -> turn stored data into original"), l.value.turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
428
+ text: r.defaultUpdateSuccessText,
429
+ details: r.defaultUpdateSuccessDetails,
430
+ icon: r.defaultUpdateSuccessIcon,
427
431
  positionX: W.Right
428
- }), z(u), b("update", u);
432
+ }), q(u), g("update", u);
429
433
  }, oe = (t, u) => {
430
- if (B("onDrop"), !q(u, o.dropButton.resource)) {
434
+ if (m("onDrop"), !G(u, o.dropButton.resource)) {
431
435
  o.notificationType === X.Toast && J({
432
- text: d.defaultDropErrorText,
433
- details: d.defaultDropErrorDetails,
434
- icon: d.defaultDropErrorIcon,
436
+ text: r.defaultDropErrorText,
437
+ details: r.defaultDropErrorDetails,
438
+ icon: r.defaultDropErrorIcon,
435
439
  positionX: W.Right
436
440
  });
437
441
  return;
438
442
  }
439
443
  o.notificationType === X.Toast && J({
440
- text: d.defaultDropSuccessText,
441
- details: d.defaultDropSuccessDetails,
442
- icon: d.defaultDropSuccessIcon,
444
+ text: r.defaultDropSuccessText,
445
+ details: r.defaultDropSuccessDetails,
446
+ icon: r.defaultDropSuccessIcon,
443
447
  positionX: W.Right
444
- }), b("drop", u), o.view === be.Modal && (B("onDrop -> close modal"), Oe(o.modalConfig.modalName, o.modalConfig.modalKey));
448
+ }), g("drop", u), o.view === be.Modal && (m("onDrop -> close modal"), Ve(o.modalConfig.modalName, o.modalConfig.modalKey));
445
449
  };
446
450
  ee({
447
451
  doDrop: () => {
448
- L.value && L.value.doDrop();
452
+ N.value && N.value.doDrop();
449
453
  },
450
- doRefresh: F,
454
+ doRefresh: K,
451
455
  doSave: () => {
452
- L.value && L.value.doSave();
456
+ N.value && N.value.doSave();
457
+ },
458
+ turnStoredDataIntoOriginal: () => {
459
+ l.value.increment(d.value).turnStoredIntoOriginal();
453
460
  },
454
- hasModifiedData: () => s.value.changed()
461
+ hasModifiedData: () => l.value.changed()
455
462
  });
456
463
  const T = k(() => {
457
464
  var t;
458
- return s.value.changed() ? (t = o.modalConfig) == null ? void 0 : t.closeConfirm : "";
465
+ return l.value.changed() ? (t = o.modalConfig) == null ? void 0 : t.closeConfirm : "";
459
466
  }), _ = (t) => {
460
467
  var u;
461
468
  if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
@@ -463,42 +470,42 @@ const B = (...C) => {
463
470
  ...t,
464
471
  itemCreated: Y.value
465
472
  });
466
- }, ne = k(() => o.title.startsWith("__:") ? String(je(o.title.substring(3))) : o.title), he = k(() => i.value ? !1 : ne.value.length > 0 || !!a["post-title"]), de = k(() => o.view === be.Modal), pe = k(() => de.value ? "lkt-modal" : "section"), Ce = k(() => pe.value === "lkt-modal" ? {
473
+ }, ne = k(() => o.title.startsWith("__:") ? String(je(o.title.substring(3))) : o.title), he = k(() => s.value ? !1 : ne.value.length > 0 || !!a["post-title"]), de = k(() => o.view === be.Modal), pe = k(() => de.value ? "lkt-modal" : "section"), Ce = k(() => pe.value === "lkt-modal" ? {
467
474
  title: o.title,
468
- item: r.value,
475
+ item: d.value,
469
476
  ...o.modalConfig,
470
477
  beforeClose: _,
471
478
  closeConfirm: T.value
472
479
  } : {});
473
480
  return (t, u) => {
474
481
  const ve = se("lkt-http-info"), De = se("lkt-loader");
475
- return m(), A(Me(pe.value), Re(Te(Ce.value)), {
482
+ return b(), j(Me(pe.value), Re(Te(Ce.value)), {
476
483
  default: M(() => [
477
484
  Ee("article", Ge, [
478
- !de.value && he.value ? (m(), E("header", qe, [
479
- n(a)["pre-title"] ? (m(), E("div", ze, [
480
- g(t.$slots, "pre-title", {
481
- item: r.value,
482
- loading: i.value
485
+ !de.value && he.value ? (b(), E("header", qe, [
486
+ n(a)["pre-title"] ? (b(), E("div", ze, [
487
+ y(t.$slots, "pre-title", {
488
+ item: d.value,
489
+ loading: s.value
483
490
  })
484
- ])) : l("", !0),
485
- ne.value.length > 0 ? (m(), E("h1", He, $e(ne.value), 1)) : l("", !0),
486
- n(a)["post-title"] ? (m(), E("div", Ke, [
487
- g(t.$slots, "post-title", {
488
- item: r.value,
489
- loading: i.value
491
+ ])) : i("", !0),
492
+ ne.value.length > 0 ? (b(), E("h1", He, $e(ne.value), 1)) : i("", !0),
493
+ n(a)["post-title"] ? (b(), E("div", We, [
494
+ y(t.$slots, "post-title", {
495
+ item: d.value,
496
+ loading: s.value
490
497
  })
491
- ])) : l("", !0)
492
- ])) : l("", !0),
493
- t.buttonNavPosition === n(ge).Top ? (m(), A(ye, {
498
+ ])) : i("", !0)
499
+ ])) : i("", !0),
500
+ t.buttonNavPosition === n(ge).Top ? (b(), j(ye, {
494
501
  key: 1,
495
502
  ref_key: "buttonNav",
496
- ref: L,
497
- loading: i.value,
498
- "onUpdate:loading": u[0] || (u[0] = (I) => i.value = I),
503
+ ref: N,
504
+ loading: s.value,
505
+ "onUpdate:loading": u[0] || (u[0] = (w) => s.value = w),
499
506
  editing: R.value,
500
- "onUpdate:editing": u[1] || (u[1] = (I) => R.value = I),
501
- item: r.value,
507
+ "onUpdate:editing": u[1] || (u[1] = (w) => R.value = w),
508
+ item: d.value,
502
509
  mode: t.mode,
503
510
  view: t.view,
504
511
  "button-nav-visibility": t.buttonNavVisibility,
@@ -512,16 +519,16 @@ const B = (...C) => {
512
519
  "can-update": te.value,
513
520
  "can-drop": ae.value,
514
521
  "can-switch-edit-mode": Z.value,
515
- perms: y.value,
522
+ perms: B.value,
516
523
  onCreate: P,
517
- onSave: H,
524
+ onSave: z,
518
525
  onDrop: oe
519
526
  }, ce({ _: 2 }, [
520
527
  n(a)["prev-buttons-ever"] ? {
521
528
  name: "prev-buttons-ever",
522
- fn: M(({ canUpdate: I, canDrop: re, perms: le }) => [
523
- g(t.$slots, "prev-buttons-ever", {
524
- canUpdate: I,
529
+ fn: M(({ canUpdate: w, canDrop: re, perms: le }) => [
530
+ y(t.$slots, "prev-buttons-ever", {
531
+ canUpdate: w,
525
532
  canDrop: re,
526
533
  perms: le
527
534
  })
@@ -530,51 +537,51 @@ const B = (...C) => {
530
537
  } : void 0,
531
538
  n(a)["prev-buttons"] ? {
532
539
  name: "prev-buttons",
533
- fn: M(({ canUpdate: I, canDrop: re, perms: le }) => [
534
- g(t.$slots, "prev-buttons", {
535
- canUpdate: I,
540
+ fn: M(({ canUpdate: w, canDrop: re, perms: le }) => [
541
+ y(t.$slots, "prev-buttons", {
542
+ canUpdate: w,
536
543
  canDrop: re,
537
544
  perms: le
538
545
  })
539
546
  ]),
540
547
  key: "1"
541
548
  } : void 0
542
- ]), 1032, ["loading", "editing", "item", "mode", "view", "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", "perms"])) : l("", !0),
543
- i.value ? l("", !0) : (m(), E("div", We, [
544
- v.value ? (m(), E("div", Je, [
545
- S.value && t.notificationType === n(X).Inline ? (m(), A(ve, {
549
+ ]), 1032, ["loading", "editing", "item", "mode", "view", "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", "perms"])) : i("", !0),
550
+ s.value ? i("", !0) : (b(), E("div", Je, [
551
+ v.value ? (b(), E("div", Qe, [
552
+ S.value && t.notificationType === n(X).Inline ? (b(), j(ve, {
546
553
  key: 0,
547
- code: D.value,
548
- palette: D.value === 200 ? "success" : "danger",
554
+ code: U.value,
555
+ palette: U.value === 200 ? "success" : "danger",
549
556
  quick: "",
550
557
  "can-close": "",
551
- onClose: u[2] || (u[2] = (I) => S.value = !1)
552
- }, null, 8, ["code", "palette"])) : l("", !0),
553
- g(t.$slots, "item", {
554
- item: r.value,
555
- loading: i.value,
558
+ onClose: u[2] || (u[2] = (w) => S.value = !1)
559
+ }, null, 8, ["code", "palette"])) : i("", !0),
560
+ y(t.$slots, "item", {
561
+ item: d.value,
562
+ loading: s.value,
556
563
  editMode: R.value,
557
- isCreate: U.value,
564
+ isCreate: C.value,
558
565
  canUpdate: te.value,
559
566
  canDrop: ae.value,
560
- itemBeingEdited: G.value,
561
- perms: y.value
567
+ itemBeingEdited: F.value,
568
+ perms: B.value
562
569
  })
563
- ])) : t.notificationType === n(X).Inline ? (m(), A(ve, {
570
+ ])) : t.notificationType === n(X).Inline ? (b(), j(ve, {
564
571
  key: 1,
565
- code: D.value
566
- }, null, 8, ["code"])) : l("", !0)
572
+ code: U.value
573
+ }, null, 8, ["code"])) : i("", !0)
567
574
  ])),
568
- i.value ? (m(), A(De, { key: 3 })) : l("", !0),
569
- t.buttonNavPosition === n(ge).Bottom ? (m(), A(ye, {
575
+ s.value ? (b(), j(De, { key: 3 })) : i("", !0),
576
+ t.buttonNavPosition === n(ge).Bottom ? (b(), j(ye, {
570
577
  key: 4,
571
578
  ref_key: "buttonNav",
572
- ref: L,
573
- loading: i.value,
574
- "onUpdate:loading": u[3] || (u[3] = (I) => i.value = I),
579
+ ref: N,
580
+ loading: s.value,
581
+ "onUpdate:loading": u[3] || (u[3] = (w) => s.value = w),
575
582
  editing: R.value,
576
- "onUpdate:editing": u[4] || (u[4] = (I) => R.value = I),
577
- item: r.value,
583
+ "onUpdate:editing": u[4] || (u[4] = (w) => R.value = w),
584
+ item: d.value,
578
585
  mode: t.mode,
579
586
  view: t.view,
580
587
  "button-nav-visibility": t.buttonNavVisibility,
@@ -588,44 +595,44 @@ const B = (...C) => {
588
595
  "can-update": te.value,
589
596
  "can-drop": ae.value,
590
597
  "can-switch-edit-mode": Z.value,
591
- perms: y.value,
598
+ perms: B.value,
592
599
  onCreate: P,
593
- onSave: H,
600
+ onSave: z,
594
601
  onDrop: oe
595
602
  }, ce({ _: 2 }, [
596
603
  n(a)["prev-buttons-ever"] ? {
597
604
  name: "prev-buttons-ever",
598
605
  fn: M(() => [
599
- g(t.$slots, "prev-buttons-ever")
606
+ y(t.$slots, "prev-buttons-ever")
600
607
  ]),
601
608
  key: "0"
602
609
  } : void 0,
603
610
  n(a)["prev-buttons"] ? {
604
611
  name: "prev-buttons-ever",
605
612
  fn: M(() => [
606
- g(t.$slots, "prev-buttons")
613
+ y(t.$slots, "prev-buttons")
607
614
  ]),
608
615
  key: "1"
609
616
  } : void 0
610
- ]), 1032, ["loading", "editing", "item", "mode", "view", "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", "perms"])) : l("", !0)
617
+ ]), 1032, ["loading", "editing", "item", "mode", "view", "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", "perms"])) : i("", !0)
611
618
  ])
612
619
  ]),
613
620
  _: 3
614
621
  }, 16);
615
622
  };
616
623
  }
617
- }), ut = {
618
- install: (C, ee = {}) => {
619
- C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Qe);
624
+ }), nt = {
625
+ install: (D, ee = {}) => {
626
+ D.component("lkt-item-crud") === void 0 && D.component("lkt-item-crud", Ye);
620
627
  }
621
- }, nt = (C) => {
622
- Q.defaultSaveIcon = C;
623
- }, dt = (C) => {
624
- Q.defaultDropIcon = C;
628
+ }, dt = (D) => {
629
+ Q.defaultSaveIcon = D;
630
+ }, rt = (D) => {
631
+ Q.defaultDropIcon = D;
625
632
  };
626
633
  export {
627
- ot as debugLktItemCrud,
628
- ut as default,
629
- dt as setItemCrudDefaultDropIcon,
630
- nt as setItemCrudDefaultSaveIcon
634
+ ut as debugLktItemCrud,
635
+ nt as default,
636
+ rt as setItemCrudDefaultDropIcon,
637
+ dt as setItemCrudDefaultSaveIcon
631
638
  };