lkt-item-crud 2.0.5 → 2.0.6

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,28 +1,28 @@
1
- import { defineComponent as me, ref as i, watch as k, useSlots as be, computed as y, resolveComponent as de, createElementBlock as U, createCommentVNode as v, openBlock as s, withDirectives as Y, createBlock as w, unref as p, renderSlot as D, vShow as Z, mergeProps as x, withCtx as V, mergeDefaults as Be, nextTick as De, onMounted as Se, resolveDynamicComponent as Ie, normalizeProps as Ue, guardReactiveProps as we, createElementVNode as Te, toDisplayString as Me, createSlots as se } from "vue";
2
- import { httpCall as Re } from "lkt-http-client";
1
+ import { defineComponent as me, ref as l, watch as h, useSlots as be, computed as y, resolveComponent as ie, createElementBlock as w, createCommentVNode as v, openBlock as s, withDirectives as Z, createBlock as T, unref as c, renderSlot as k, vShow as x, mergeProps as ee, withCtx as $, mergeDefaults as Ce, nextTick as ke, onMounted as De, resolveDynamicComponent as Se, normalizeProps as Ie, guardReactiveProps as Ue, createElementVNode as we, toDisplayString as Te, createSlots as se } from "vue";
2
+ import { httpCall as Me } from "lkt-http-client";
3
3
  import { DataState as ve } from "lkt-data-state";
4
- import { ensureButtonConfig as E, LktSettings as n, ItemCrudMode as $, ItemCrudButtonNavVisibility as ue, TablePermission as ne, ItemCrudView as pe, ItemCrudButtonNavPosition as ce, NotificationType as N, getDefaultValues as Ee, ItemCrud as Ne, ToastPositionX as O } from "lkt-vue-kernel";
5
- import { closeModal as $e } from "lkt-modal";
6
- import { __ as Ve } from "lkt-i18n";
7
- import { openToast as j } from "lkt-toast";
8
- const G = class G {
4
+ import { ensureButtonConfig as E, LktSettings as n, ItemCrudMode as U, ItemCrudButtonNavVisibility as ne, TablePermission as de, ItemCrudView as pe, ItemCrudButtonNavPosition as ce, NotificationType as N, getDefaultValues as Re, ItemCrud as Ee, ToastPositionX as X } from "lkt-vue-kernel";
5
+ import { closeModal as Ne } from "lkt-modal";
6
+ import { __ as $e } from "lkt-i18n";
7
+ import { openToast as _ } from "lkt-toast";
8
+ const W = class W {
9
9
  };
10
- G.debugEnabled = !1, G.defaultSaveIcon = "", G.defaultDropIcon = "";
11
- let q = G;
12
- const g = (...C) => {
13
- q.debugEnabled && console.info("[LktItemCrud] ", ...C);
14
- }, et = (C = !0) => {
15
- q.debugEnabled = C;
16
- }, Le = {
10
+ W.debugEnabled = !1, W.defaultSaveIcon = "", W.defaultDropIcon = "";
11
+ let q = W;
12
+ const g = (...B) => {
13
+ q.debugEnabled && console.info("[LktItemCrud] ", ...B);
14
+ }, xe = (B = !0) => {
15
+ q.debugEnabled = B;
16
+ }, Ve = {
17
17
  key: 0,
18
18
  class: "lkt-item-crud-buttons"
19
- }, Ae = {
19
+ }, Le = {
20
20
  key: 0,
21
21
  class: "lkt-item-crud-buttons"
22
- }, Pe = {
22
+ }, Oe = {
23
23
  key: 1,
24
24
  class: "lkt-item-crud-buttons"
25
- }, Xe = {
25
+ }, Ae = {
26
26
  key: 5,
27
27
  class: "lkt-item-crud-buttons"
28
28
  }, fe = /* @__PURE__ */ me({
@@ -33,10 +33,10 @@ const g = (...C) => {
33
33
  loading: { type: Boolean },
34
34
  view: {},
35
35
  mode: {},
36
- createButton: {},
37
- updateButton: {},
38
- dropButton: {},
39
- editModeButton: {},
36
+ createButton: { type: [Object, Boolean] },
37
+ updateButton: { type: [Object, Boolean] },
38
+ dropButton: { type: [Object, Boolean] },
39
+ editModeButton: { type: [Object, Boolean] },
40
40
  dataChanged: { type: Boolean },
41
41
  canUpdate: { type: Boolean },
42
42
  canDrop: { type: Boolean },
@@ -51,99 +51,99 @@ const g = (...C) => {
51
51
  "save",
52
52
  "drop"
53
53
  ],
54
- setup(C, { expose: J, emit: ee }) {
55
- const o = ee, a = C, c = i(E(a.createButton, n.defaultCreateButton)), M = i(E(a.updateButton, n.defaultUpdateButton)), d = i(E(a.dropButton, n.defaultDropButton)), r = i(E(a.editModeButton, n.defaultEditModeButton));
56
- k(() => a.createButton, (t) => {
57
- c.value = E(t, n.defaultCreateButton);
58
- }, { deep: !0 }), k(() => a.updateButton, (t) => {
59
- M.value = E(t, n.defaultUpdateButton);
60
- }, { deep: !0 }), k(() => a.dropButton, (t) => {
54
+ setup(B, { expose: G, emit: te }) {
55
+ const o = te, a = B, f = l(E(a.createButton, n.defaultCreateButton)), i = l(E(a.updateButton, n.defaultUpdateButton)), d = l(E(a.dropButton, n.defaultDropButton)), D = l(E(a.editModeButton, n.defaultEditModeButton));
56
+ h(() => a.createButton, (t) => {
57
+ f.value = E(t, n.defaultCreateButton);
58
+ }, { deep: !0 }), h(() => a.updateButton, (t) => {
59
+ i.value = E(t, n.defaultUpdateButton);
60
+ }, { deep: !0 }), h(() => a.dropButton, (t) => {
61
61
  d.value = E(t, n.defaultDropButton);
62
- }, { deep: !0 }), k(() => a.editModeButton, (t) => {
63
- r.value = E(t, n.defaultEditModeButton);
62
+ }, { deep: !0 }), h(() => a.editModeButton, (t) => {
63
+ D.value = E(t, n.defaultEditModeButton);
64
64
  }, { deep: !0 });
65
- const m = be(), B = i(null), S = i(null), b = i(a.loading);
66
- k(() => a.loading, (t) => b.value = t), k(b, (t) => o("update:loading", t));
67
- const f = i(a.editing);
68
- k(() => a.editing, (t) => f.value = t), k(f, (t) => o("update:editing", t));
69
- const h = () => {
70
- b.value = !0;
71
- }, I = () => {
72
- b.value = !1;
73
- }, z = (t, l) => {
74
- typeof t > "u" || o("create", t, l);
75
- }, T = (t, l) => {
76
- typeof t > "u" || o("save", t, l);
77
- }, F = (t, l) => {
78
- typeof t > "u" || o("drop", t, l);
65
+ const b = be(), C = l(null), I = l(null), p = l(a.loading);
66
+ h(() => a.loading, (t) => p.value = t), h(p, (t) => o("update:loading", t));
67
+ const r = l(a.editing);
68
+ h(() => a.editing, (t) => r.value = t), h(r, (t) => o("update:editing", t));
69
+ const S = () => {
70
+ p.value = !0;
71
+ }, V = () => {
72
+ p.value = !1;
73
+ }, M = (t, m) => {
74
+ typeof t > "u" || o("create", t, m);
75
+ }, z = (t, m) => {
76
+ typeof t > "u" || o("save", t, m);
77
+ }, J = (t, m) => {
78
+ typeof t > "u" || o("drop", t, m);
79
79
  };
80
- J({
80
+ G({
81
81
  doSave: () => {
82
- B.value && typeof B.value.click == "function" && B.value.click();
82
+ C.value && typeof C.value.click == "function" && C.value.click();
83
83
  },
84
84
  doDrop: () => {
85
- S.value && typeof S.value.click == "function" && S.value.click();
85
+ I.value && typeof I.value.click == "function" && I.value.click();
86
86
  }
87
87
  });
88
- const X = y(() => {
89
- var t, l;
90
- return a.mode !== $.Create && !a.canUpdate || !a.dataChanged ? !1 : typeof ((t = M.value) == null ? void 0 : t.disabled) == "function" ? !M.value.disabled(a.item) : typeof ((l = M.value) == null ? void 0 : l.disabled) == "boolean" ? !M.value.disabled : !0;
91
- }), _ = y(() => {
92
- var t, l;
93
- return a.mode !== $.Create || !a.dataChanged ? !1 : typeof ((t = c.value) == null ? void 0 : t.disabled) == "function" ? !c.value.disabled(a.item) : typeof ((l = c.value) == null ? void 0 : l.disabled) == "boolean" ? !c.value.disabled : !0;
94
- }), H = y(() => {
95
- var t, l;
96
- return a.canDrop ? typeof ((t = d.value) == null ? void 0 : t.disabled) == "function" ? !d.value.disabled(a.item) : typeof ((l = d.value) == null ? void 0 : l.disabled) == "boolean" ? !d.value.disabled : !0 : !1;
97
- }), A = y(() => a.canDrop ? !a.canUpdate && a.canDrop ? !0 : !b.value && a.editing && a.httpSuccessRead : !1), P = y(() => a.dataChanged ? !0 : b.value ? !1 : a.mode === $.Create ? !0 : a.buttonNavVisibility === ue.Never ? !1 : a.editing && a.httpSuccessRead), K = y(() => !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !b.value && a.mode !== $.Create && a.httpSuccessRead), Q = y(() => a.buttonNavVisibility === ue.Always && (X.value || _.value || H.value) || m["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === ue.Never ? !1 : P.value || A.value || K.value);
98
- return (t, l) => {
99
- const W = de("lkt-button");
100
- return Q.value ? (s(), U("div", Le, [
101
- p(m)["prev-buttons-ever"] ? Y((s(), U("div", Ae, [
102
- D(t.$slots, "prev-buttons-ever")
88
+ const A = y(() => {
89
+ var t, m;
90
+ return a.mode !== U.Create && !a.canUpdate || !a.dataChanged ? !1 : typeof ((t = i.value) == null ? void 0 : t.disabled) == "function" ? !i.value.disabled(a.item) : typeof ((m = i.value) == null ? void 0 : m.disabled) == "boolean" ? !i.value.disabled : !0;
91
+ }), F = y(() => {
92
+ var t, m;
93
+ return a.mode !== U.Create || !a.dataChanged ? !1 : typeof ((t = f.value) == null ? void 0 : t.disabled) == "function" ? !f.value.disabled(a.item) : typeof ((m = f.value) == null ? void 0 : m.disabled) == "boolean" ? !f.value.disabled : !0;
94
+ }), O = y(() => {
95
+ var t, m;
96
+ return a.canDrop ? typeof ((t = d.value) == null ? void 0 : t.disabled) == "function" ? !d.value.disabled(a.item) : typeof ((m = d.value) == null ? void 0 : m.disabled) == "boolean" ? !d.value.disabled : !0 : !1;
97
+ }), j = y(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !p.value && a.editing && a.httpSuccessRead), P = y(() => a.mode === U.Create && a.createButton === !1 || a.mode === U.Update && a.updateButton === !1 ? !1 : a.dataChanged ? !0 : p.value ? !1 : a.mode === U.Create ? !0 : a.buttonNavVisibility === ne.Never ? !1 : a.editing && a.httpSuccessRead), H = y(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !p.value && a.mode !== U.Create && a.httpSuccessRead), Y = y(() => a.buttonNavVisibility === ne.Always && (A.value || F.value || O.value) || b["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === ne.Never ? !1 : P.value || j.value || H.value);
98
+ return (t, m) => {
99
+ const K = ie("lkt-button");
100
+ return Y.value ? (s(), w("div", Ve, [
101
+ c(b)["prev-buttons-ever"] ? Z((s(), w("div", Le, [
102
+ k(t.$slots, "prev-buttons-ever")
103
103
  ], 512)), [
104
- [Z, !b.value]
104
+ [x, !p.value]
105
105
  ]) : v("", !0),
106
- p(m)["prev-buttons"] ? Y((s(), U("div", Pe, [
107
- D(t.$slots, "prev-buttons")
106
+ c(b)["prev-buttons"] ? Z((s(), w("div", Oe, [
107
+ k(t.$slots, "prev-buttons")
108
108
  ], 512)), [
109
- [Z, f.value && !b.value]
109
+ [x, r.value && !p.value]
110
110
  ]) : v("", !0),
111
- t.mode === p($).Update && P.value ? (s(), w(W, x({
111
+ t.mode === c(U).Update && P.value ? (s(), T(K, ee({
112
112
  key: 2,
113
113
  ref_key: "saveButtonRef",
114
- ref: B
115
- }, M.value, {
116
- disabled: !X.value,
117
- onLoading: h,
118
- onLoaded: I,
119
- onClick: T
114
+ ref: C
115
+ }, i.value, {
116
+ disabled: !A.value,
117
+ onLoading: S,
118
+ onLoaded: V,
119
+ onClick: z
120
120
  }), {
121
- default: V(() => [
122
- p(m)["button-save"] ? D(t.$slots, "button-save", {
121
+ default: $(() => [
122
+ c(b)["button-save"] ? k(t.$slots, "button-save", {
123
123
  key: 0,
124
124
  item: t.item,
125
- editMode: f.value,
125
+ editMode: r.value,
126
126
  isCreate: !1,
127
127
  canUpdate: t.canUpdate,
128
128
  canDrop: t.canDrop
129
129
  }) : v("", !0)
130
130
  ]),
131
131
  _: 3
132
- }, 16, ["disabled"])) : t.mode === p($).Create && P.value ? (s(), w(W, x({
132
+ }, 16, ["disabled"])) : t.mode === c(U).Create && P.value ? (s(), T(K, ee({
133
133
  key: 3,
134
134
  ref_key: "saveButtonRef",
135
- ref: B
136
- }, c.value, {
137
- disabled: !_.value,
138
- onLoading: h,
139
- onLoaded: I,
140
- onClick: z
135
+ ref: C
136
+ }, f.value, {
137
+ disabled: !F.value,
138
+ onLoading: S,
139
+ onLoaded: V,
140
+ onClick: M
141
141
  }), {
142
- default: V(() => [
143
- p(m)["button-save"] ? D(t.$slots, "button-save", {
142
+ default: $(() => [
143
+ c(b)["button-save"] ? k(t.$slots, "button-save", {
144
144
  key: 0,
145
145
  item: t.item,
146
- editMode: f.value,
146
+ editMode: r.value,
147
147
  isCreate: !0,
148
148
  canUpdate: t.canUpdate,
149
149
  canDrop: t.canDrop
@@ -151,21 +151,21 @@ const g = (...C) => {
151
151
  ]),
152
152
  _: 3
153
153
  }, 16, ["disabled"])) : v("", !0),
154
- t.mode !== p($).Create ? Y((s(), w(W, x({
154
+ t.mode !== c(U).Create ? Z((s(), T(K, ee({
155
155
  key: 4,
156
156
  ref_key: "dropButtonRef",
157
- ref: S
157
+ ref: I
158
158
  }, d.value, {
159
- disabled: !H.value,
160
- onLoading: h,
161
- onLoaded: I,
162
- onClick: F
159
+ disabled: !O.value,
160
+ onLoading: S,
161
+ onLoaded: V,
162
+ onClick: J
163
163
  }), {
164
- default: V(() => [
165
- p(m)["button-drop"] ? D(t.$slots, "button-drop", {
164
+ default: $(() => [
165
+ c(b)["button-drop"] ? k(t.$slots, "button-drop", {
166
166
  key: 0,
167
167
  item: t.item,
168
- editMode: f.value,
168
+ editMode: r.value,
169
169
  isCreate: !1,
170
170
  canUpdate: t.canUpdate,
171
171
  canDrop: t.canDrop
@@ -173,50 +173,51 @@ const g = (...C) => {
173
173
  ]),
174
174
  _: 3
175
175
  }, 16, ["disabled"])), [
176
- [Z, A.value]
176
+ [x, j.value]
177
177
  ]) : v("", !0),
178
- p(m).buttons ? Y((s(), U("div", Xe, [
179
- D(t.$slots, "buttons")
178
+ c(b).buttons ? Z((s(), w("div", Ae, [
179
+ k(t.$slots, "buttons")
180
180
  ], 512)), [
181
- [Z, f.value && !b.value]
181
+ [x, r.value && !p.value]
182
182
  ]) : v("", !0),
183
- K.value ? (s(), w(W, x({ key: 6 }, r.value, {
184
- checked: f.value,
185
- "onUpdate:checked": l[0] || (l[0] = (ie) => f.value = ie),
183
+ H.value ? (s(), T(K, ee({ key: 6 }, D.value, {
184
+ checked: r.value,
185
+ "onUpdate:checked": m[0] || (m[0] = (ae) => r.value = ae),
186
186
  class: "lkt-item-crud--switch-mode-button"
187
187
  }), null, 16, ["checked"])) : v("", !0)
188
188
  ])) : v("", !0);
189
189
  };
190
190
  }
191
- }), _e = { class: "lkt-item-crud" }, Oe = {
191
+ }), je = { class: "lkt-item-crud" }, Pe = {
192
192
  key: 0,
193
193
  class: "lkt-item-crud_header"
194
- }, je = {
194
+ }, Xe = {
195
195
  key: 0,
196
196
  class: "lkt-item-crud_header-slot"
197
- }, qe = {
197
+ }, _e = {
198
198
  key: 1,
199
199
  class: "lkt-item-crud_header-title"
200
- }, ze = {
200
+ }, qe = {
201
201
  key: 2,
202
202
  class: "lkt-item-crud_header-slot"
203
- }, Fe = {
203
+ }, ze = {
204
204
  key: 2,
205
205
  class: "lkt-item-crud_content"
206
- }, He = {
206
+ }, Fe = {
207
207
  key: 0,
208
208
  class: "lkt-grid-1"
209
- }, Ke = /* @__PURE__ */ me({
209
+ }, He = /* @__PURE__ */ me({
210
210
  __name: "LktItemCrud",
211
- props: /* @__PURE__ */ Be({
211
+ props: /* @__PURE__ */ Ce({
212
212
  modelValue: {},
213
213
  editing: { type: Boolean },
214
+ perms: {},
214
215
  mode: {},
215
216
  view: {},
216
- editModeButton: {},
217
- dropButton: {},
218
- createButton: {},
219
- updateButton: {},
217
+ editModeButton: { type: [Object, Boolean] },
218
+ dropButton: { type: [Object, Boolean] },
219
+ createButton: { type: [Object, Boolean] },
220
+ updateButton: { type: [Object, Boolean] },
220
221
  buttonNavPosition: {},
221
222
  buttonNavVisibility: {},
222
223
  modalConfig: {},
@@ -227,7 +228,7 @@ const g = (...C) => {
227
228
  title: {},
228
229
  beforeEmitUpdate: { type: Function },
229
230
  notificationType: {}
230
- }, Ee(Ne)),
231
+ }, Re(Ee)),
231
232
  emits: [
232
233
  "update:modelValue",
233
234
  "update:editing",
@@ -240,157 +241,155 @@ const g = (...C) => {
240
241
  "error",
241
242
  "modified-data"
242
243
  ],
243
- setup(C, { expose: J, emit: ee }) {
244
- const o = C, a = be(), c = ee;
245
- let M = [];
246
- const d = i(!0), r = i(o.modelValue), m = i(M), B = i(o.editing), S = i(!1), b = i(!1), f = i(200), h = i(new ve(r.value, o.dataStateConfig)), I = i(!1), z = i(new ve(o.readData)), T = i(o.mode === $.Create), F = i(!1), te = i(!1), L = i(null), X = y(() => !T.value && Array.isArray(m.value) && m.value.includes(ne.Update)), _ = y(() => !T.value && Array.isArray(m.value) && m.value.includes(ne.Drop)), H = y(() => !T.value && Array.isArray(m.value) && m.value.includes(ne.SwitchEditMode)), A = async () => {
247
- g("fetchItem"), d.value = !0, f.value = -1, b.value = !1;
244
+ setup(B, { expose: G, emit: te }) {
245
+ const o = B, a = be(), f = te, i = l(!0), d = l(o.modelValue), D = l(o.perms), b = l(o.editing), C = l(!1), I = l(!1), p = l(200), r = l(new ve(d.value, o.dataStateConfig)), S = l(!1), V = l(new ve(o.readData)), M = l(o.mode === U.Create), z = l(!1), J = l(!1), L = l(null), Q = y(() => !M.value && Array.isArray(D.value) && D.value.includes(de.Update)), A = y(() => !M.value && Array.isArray(D.value) && D.value.includes(de.Drop)), F = y(() => !M.value && Array.isArray(D.value) && D.value.includes(de.SwitchEditMode)), O = async () => {
246
+ g("fetchItem"), i.value = !0, p.value = -1, I.value = !1;
248
247
  try {
249
- const e = await Re(o.readResource, o.readData);
250
- if (g("fetchItem -> response", e), d.value = !1, f.value = e.httpStatus, !e.success) {
251
- S.value = !1, f.value = e.httpStatus, c("error", e.httpStatus);
248
+ const e = await Me(o.readResource, o.readData);
249
+ if (g("fetchItem -> response", e), i.value = !1, p.value = e.httpStatus, !e.success) {
250
+ C.value = !1, p.value = e.httpStatus, f("error", e.httpStatus);
252
251
  return;
253
252
  }
254
- S.value = !0, r.value = e.data, m.value = e.perms, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed(), z.value.turnStoredIntoOriginal(), c("read", e);
253
+ C.value = !0, d.value = e.data, D.value = e.perms, r.value.increment(d.value).turnStoredIntoOriginal(), S.value = r.value.changed(), V.value.turnStoredIntoOriginal(), f("read", e);
255
254
  } catch {
256
- d.value = !1, S.value = !1, f.value = 404, c("error", 404);
255
+ i.value = !1, C.value = !1, p.value = 404, f("error", 404);
257
256
  return;
258
257
  }
259
258
  };
260
- k(() => o.modelValue, (e) => {
261
- r.value = e, h.value.increment(e);
262
- }, { deep: !0 }), k(r, (e) => {
263
- if (F.value = !0, g("item updated ->", r.value), typeof o.beforeEmitUpdate == "function") {
259
+ h(() => o.modelValue, (e) => {
260
+ d.value = e, r.value.increment(e);
261
+ }, { deep: !0 }), h(d, (e) => {
262
+ if (z.value = !0, g("item updated ->", d.value), typeof o.beforeEmitUpdate == "function") {
264
263
  g("item updated -> has beforeEmitUpdate");
265
- let u = o.beforeEmitUpdate(r.value);
266
- g("item updated -> override with: ", u), typeof u == "object" && (r.value = u);
264
+ let u = o.beforeEmitUpdate(d.value);
265
+ g("item updated -> override with: ", u), typeof u == "object" && (d.value = u);
267
266
  }
268
- c("update:modelValue", r.value), g("item updated -> update dataState"), h.value.increment(e), I.value = h.value.changed(), De(() => F.value = !1);
269
- }, { deep: !0 }), k(m, () => c("perms", m.value)), k(I, (e) => {
270
- c("modified-data", e);
271
- }), k(() => o.readData, (e) => {
272
- z.value.increment(e), z.value.changed() && A();
273
- }), k(() => o.editing, (e) => {
274
- g("editing updated -> updating editMode", e), B.value = e;
275
- }), k(B, (e) => {
276
- g("editMode updated -> emit update", e), c("update:editing", e);
277
- }), Se(() => {
278
- o.readResource && !T.value ? A() : T.value && (S.value = !0, B.value = !0, d.value = !1, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed());
267
+ f("update:modelValue", d.value), g("item updated -> update dataState"), r.value.increment(e), S.value = r.value.changed(), ke(() => z.value = !1);
268
+ }, { deep: !0 }), h(D, () => f("perms", D.value)), h(S, (e) => {
269
+ f("modified-data", e);
270
+ }), h(() => o.readData, (e) => {
271
+ V.value.increment(e), V.value.changed() && O();
272
+ }), h(() => o.editing, (e) => {
273
+ g("editing updated -> updating editMode", e), b.value = e;
274
+ }), h(b, (e) => {
275
+ g("editMode updated -> emit update", e), f("update:editing", e);
276
+ }), De(() => {
277
+ o.readResource && !M.value ? O() : (M.value, C.value = !0, b.value = !0, i.value = !1, r.value.increment(d.value).turnStoredIntoOriginal(), S.value = r.value.changed());
279
278
  });
280
- const P = (e, u) => {
279
+ const j = (e, u) => {
281
280
  if (u) {
282
- if (d.value = !1, typeof e < "u" && (f.value = e.httpStatus, !e.success))
283
- return b.value = !0, c("error", e.httpStatus), !1;
284
- b.value = !0;
281
+ if (i.value = !1, typeof e < "u" && (p.value = e.httpStatus, !e.success))
282
+ return I.value = !0, f("error", e.httpStatus), !1;
283
+ I.value = !0;
285
284
  }
286
285
  return !0;
287
- }, K = (e) => {
288
- !oe.value && e.autoReloadId && (g("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), o.readData.id = e.autoReloadId, g("doAutoReloadId -> turning off create mode"), T.value = !1, A());
289
- }, Q = (e, u) => {
290
- if (g("onCreate"), !P(u, o.createButton.resource)) {
291
- o.notificationType === N.Toast && j({
286
+ }, P = (e) => {
287
+ !ue.value && e.autoReloadId && (g("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), o.readData.id = e.autoReloadId, g("doAutoReloadId -> turning off create mode"), M.value = !1, O());
288
+ }, H = (e, u) => {
289
+ if (g("onCreate"), !j(u, o.createButton.resource)) {
290
+ o.notificationType === N.Toast && _({
292
291
  text: n.defaultCreateErrorText,
293
292
  details: n.defaultCreateErrorDetails,
294
293
  icon: n.defaultCreateErrorIcon,
295
- positionX: O.Right
294
+ positionX: X.Right
296
295
  });
297
296
  return;
298
297
  }
299
- te.value = !0, g("onCreate -> turn stored data into original"), h.value.increment(r.value).turnStoredIntoOriginal(), o.notificationType === N.Toast && j({
298
+ J.value = !0, g("onCreate -> turn stored data into original"), r.value.increment(d.value).turnStoredIntoOriginal(), o.notificationType === N.Toast && _({
300
299
  text: n.defaultCreateSuccessText,
301
300
  details: n.defaultCreateSuccessDetails,
302
301
  icon: n.defaultCreateSuccessIcon,
303
- positionX: O.Right
304
- }), K(u), c("create", u);
305
- }, t = (e, u) => {
306
- if (g("onUpdate"), !P(u, o.updateButton.resource)) {
307
- o.notificationType === N.Toast && j({
302
+ positionX: X.Right
303
+ }), P(u), f("create", u);
304
+ }, Y = (e, u) => {
305
+ if (g("onUpdate"), !j(u, o.updateButton.resource)) {
306
+ o.notificationType === N.Toast && _({
308
307
  text: n.defaultUpdateErrorText,
309
308
  details: n.defaultUpdateErrorDetails,
310
309
  icon: n.defaultUpdateErrorIcon,
311
- positionX: O.Right
310
+ positionX: X.Right
312
311
  });
313
312
  return;
314
313
  }
315
- g("onUpdate -> turn stored data into original"), h.value.turnStoredIntoOriginal(), o.notificationType === N.Toast && j({
314
+ g("onUpdate -> turn stored data into original"), r.value.turnStoredIntoOriginal(), o.notificationType === N.Toast && _({
316
315
  text: n.defaultUpdateSuccessText,
317
316
  details: n.defaultUpdateSuccessDetails,
318
317
  icon: n.defaultUpdateSuccessIcon,
319
- positionX: O.Right
320
- }), K(u), c("update", u);
321
- }, l = (e, u) => {
322
- if (g("onDrop"), !P(u, o.dropButton.resource)) {
323
- o.notificationType === N.Toast && j({
318
+ positionX: X.Right
319
+ }), P(u), f("update", u);
320
+ }, t = (e, u) => {
321
+ if (g("onDrop"), !j(u, o.dropButton.resource)) {
322
+ o.notificationType === N.Toast && _({
324
323
  text: n.defaultDropErrorText,
325
324
  details: n.defaultDropErrorDetails,
326
325
  icon: n.defaultDropErrorIcon,
327
- positionX: O.Right
326
+ positionX: X.Right
328
327
  });
329
328
  return;
330
329
  }
331
- o.notificationType === N.Toast && j({
330
+ o.notificationType === N.Toast && _({
332
331
  text: n.defaultDropSuccessText,
333
332
  details: n.defaultDropSuccessDetails,
334
333
  icon: n.defaultDropSuccessIcon,
335
- positionX: O.Right
336
- }), c("drop", u), o.view === pe.Modal && (g("onDrop -> close modal"), $e(o.modalConfig.modalName, o.modalConfig.modalKey));
334
+ positionX: X.Right
335
+ }), f("drop", u), o.view === pe.Modal && (g("onDrop -> close modal"), Ne(o.modalConfig.modalName, o.modalConfig.modalKey));
337
336
  };
338
- J({
337
+ G({
339
338
  doDrop: () => {
340
339
  L.value && L.value.doDrop();
341
340
  },
342
- doRefresh: A,
341
+ doRefresh: O,
343
342
  doSave: () => {
344
343
  L.value && L.value.doSave();
345
344
  },
346
- hasModifiedData: () => h.value.changed()
345
+ hasModifiedData: () => r.value.changed()
347
346
  });
348
- const ge = y(() => {
347
+ const ae = y(() => {
349
348
  var e;
350
- return h.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
351
- }), ye = (e) => {
349
+ return r.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
350
+ }), ge = (e) => {
352
351
  var u;
353
352
  if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
354
353
  return o.modalConfig.beforeClose({
355
354
  ...e,
356
- itemCreated: te.value
355
+ itemCreated: J.value
357
356
  });
358
- }, ae = y(() => o.title.startsWith("__:") ? String(Ve(o.title.substring(3))) : o.title), he = y(() => d.value ? !1 : ae.value.length > 0 || !!a["post-title"]), oe = y(() => o.view === pe.Modal), re = y(() => oe.value ? "lkt-modal" : "section"), ke = y(() => re.value === "lkt-modal" ? {
357
+ }, oe = y(() => o.title.startsWith("__:") ? String($e(o.title.substring(3))) : o.title), ye = y(() => i.value ? !1 : oe.value.length > 0 || !!a["post-title"]), ue = y(() => o.view === pe.Modal), re = y(() => ue.value ? "lkt-modal" : "section"), he = y(() => re.value === "lkt-modal" ? {
359
358
  title: o.title,
360
- item: r.value,
359
+ item: d.value,
361
360
  ...o.modalConfig,
362
- "before-close": ye,
363
- "close-confirm": ge.value
361
+ beforeClose: ge,
362
+ closeConfirm: ae.value
364
363
  } : {});
365
364
  return (e, u) => {
366
- const le = de("lkt-http-info"), Ce = de("lkt-loader");
367
- return s(), w(Ie(re.value), Ue(we(ke.value)), {
368
- default: V(() => [
369
- Te("article", _e, [
370
- !oe.value && he.value ? (s(), U("header", Oe, [
371
- p(a)["pre-title"] ? (s(), U("div", je, [
372
- D(e.$slots, "pre-title", {
373
- item: r.value,
374
- loading: d.value
365
+ const le = ie("lkt-http-info"), Be = ie("lkt-loader");
366
+ return s(), T(Se(re.value), Ie(Ue(he.value)), {
367
+ default: $(() => [
368
+ we("article", je, [
369
+ !ue.value && ye.value ? (s(), w("header", Pe, [
370
+ c(a)["pre-title"] ? (s(), w("div", Xe, [
371
+ k(e.$slots, "pre-title", {
372
+ item: d.value,
373
+ loading: i.value
375
374
  })
376
375
  ])) : v("", !0),
377
- ae.value.length > 0 ? (s(), U("h1", qe, Me(ae.value), 1)) : v("", !0),
378
- p(a)["post-title"] ? (s(), U("div", ze, [
379
- D(e.$slots, "post-title", {
380
- item: r.value,
381
- loading: d.value
376
+ oe.value.length > 0 ? (s(), w("h1", _e, Te(oe.value), 1)) : v("", !0),
377
+ c(a)["post-title"] ? (s(), w("div", qe, [
378
+ k(e.$slots, "post-title", {
379
+ item: d.value,
380
+ loading: i.value
382
381
  })
383
382
  ])) : v("", !0)
384
383
  ])) : v("", !0),
385
- e.buttonNavPosition === p(ce).Top ? (s(), w(fe, {
384
+ e.buttonNavPosition === c(ce).Top ? (s(), T(fe, {
386
385
  key: 1,
387
386
  ref_key: "buttonNav",
388
387
  ref: L,
389
- loading: d.value,
390
- "onUpdate:loading": u[0] || (u[0] = (R) => d.value = R),
391
- editing: B.value,
392
- "onUpdate:editing": u[1] || (u[1] = (R) => B.value = R),
393
- item: r.value,
388
+ loading: i.value,
389
+ "onUpdate:loading": u[0] || (u[0] = (R) => i.value = R),
390
+ editing: b.value,
391
+ "onUpdate:editing": u[1] || (u[1] = (R) => b.value = R),
392
+ item: d.value,
394
393
  mode: e.mode,
395
394
  view: e.view,
396
395
  "button-nav-visibility": e.buttonNavVisibility,
@@ -398,64 +397,64 @@ const g = (...C) => {
398
397
  "update-button": e.updateButton,
399
398
  "drop-button": e.dropButton,
400
399
  "edit-mode-button": e.editModeButton,
401
- "data-changed": I.value,
402
- "http-success-read": S.value,
403
- "can-update": X.value,
404
- "can-drop": _.value,
405
- "can-switch-edit-mode": H.value,
406
- onCreate: Q,
407
- onSave: t,
408
- onDrop: l
400
+ "data-changed": S.value,
401
+ "http-success-read": C.value,
402
+ "can-update": Q.value,
403
+ "can-drop": A.value,
404
+ "can-switch-edit-mode": F.value,
405
+ onCreate: H,
406
+ onSave: Y,
407
+ onDrop: t
409
408
  }, se({ _: 2 }, [
410
- p(a)["prev-buttons-ever"] ? {
409
+ c(a)["prev-buttons-ever"] ? {
411
410
  name: "prev-buttons-ever",
412
- fn: V(() => [
413
- D(e.$slots, "prev-buttons-ever")
411
+ fn: $(() => [
412
+ k(e.$slots, "prev-buttons-ever")
414
413
  ]),
415
414
  key: "0"
416
415
  } : void 0,
417
- p(a)["prev-buttons"] ? {
416
+ c(a)["prev-buttons"] ? {
418
417
  name: "prev-buttons-ever",
419
- fn: V(() => [
420
- D(e.$slots, "prev-buttons")
418
+ fn: $(() => [
419
+ k(e.$slots, "prev-buttons")
421
420
  ]),
422
421
  key: "1"
423
422
  } : void 0
424
423
  ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : v("", !0),
425
- d.value ? v("", !0) : (s(), U("div", Fe, [
426
- S.value ? (s(), U("div", He, [
427
- b.value && e.notificationType === p(N).Inline ? (s(), w(le, {
424
+ i.value ? v("", !0) : (s(), w("div", ze, [
425
+ C.value ? (s(), w("div", Fe, [
426
+ I.value && e.notificationType === c(N).Inline ? (s(), T(le, {
428
427
  key: 0,
429
- code: f.value,
430
- palette: f.value === 200 ? "success" : "danger",
428
+ code: p.value,
429
+ palette: p.value === 200 ? "success" : "danger",
431
430
  quick: "",
432
431
  "can-close": "",
433
- onClose: u[2] || (u[2] = (R) => b.value = !1)
432
+ onClose: u[2] || (u[2] = (R) => I.value = !1)
434
433
  }, null, 8, ["code", "palette"])) : v("", !0),
435
- D(e.$slots, "item", {
436
- item: r.value,
437
- loading: d.value,
438
- editMode: B.value,
439
- isCreate: T.value,
440
- canUpdate: X.value,
441
- canDrop: _.value,
442
- itemBeingEdited: F.value
434
+ k(e.$slots, "item", {
435
+ item: d.value,
436
+ loading: i.value,
437
+ editMode: b.value,
438
+ isCreate: M.value,
439
+ canUpdate: Q.value,
440
+ canDrop: A.value,
441
+ itemBeingEdited: z.value
443
442
  })
444
- ])) : e.notificationType === p(N).Inline ? (s(), w(le, {
443
+ ])) : e.notificationType === c(N).Inline ? (s(), T(le, {
445
444
  key: 1,
446
- code: f.value
445
+ code: p.value
447
446
  }, null, 8, ["code"])) : v("", !0)
448
447
  ])),
449
- d.value ? (s(), w(Ce, { key: 3 })) : v("", !0),
450
- e.buttonNavPosition === p(ce).Bottom ? (s(), w(fe, {
448
+ i.value ? (s(), T(Be, { key: 3 })) : v("", !0),
449
+ e.buttonNavPosition === c(ce).Bottom ? (s(), T(fe, {
451
450
  key: 4,
452
451
  ref_key: "buttonNav",
453
452
  ref: L,
454
- loading: d.value,
455
- "onUpdate:loading": u[3] || (u[3] = (R) => d.value = R),
456
- editing: B.value,
457
- "onUpdate:editing": u[4] || (u[4] = (R) => B.value = R),
458
- item: r.value,
453
+ loading: i.value,
454
+ "onUpdate:loading": u[3] || (u[3] = (R) => i.value = R),
455
+ editing: b.value,
456
+ "onUpdate:editing": u[4] || (u[4] = (R) => b.value = R),
457
+ item: d.value,
459
458
  mode: e.mode,
460
459
  view: e.view,
461
460
  "button-nav-visibility": e.buttonNavVisibility,
@@ -463,26 +462,26 @@ const g = (...C) => {
463
462
  "update-button": e.updateButton,
464
463
  "drop-button": e.dropButton,
465
464
  "edit-mode-button": e.editModeButton,
466
- "data-changed": I.value,
467
- "http-success-read": S.value,
468
- "can-update": X.value,
469
- "can-drop": _.value,
470
- "can-switch-edit-mode": H.value,
471
- onCreate: Q,
472
- onSave: t,
473
- onDrop: l
465
+ "data-changed": S.value,
466
+ "http-success-read": C.value,
467
+ "can-update": Q.value,
468
+ "can-drop": A.value,
469
+ "can-switch-edit-mode": F.value,
470
+ onCreate: H,
471
+ onSave: Y,
472
+ onDrop: t
474
473
  }, se({ _: 2 }, [
475
- p(a)["prev-buttons-ever"] ? {
474
+ c(a)["prev-buttons-ever"] ? {
476
475
  name: "prev-buttons-ever",
477
- fn: V(() => [
478
- D(e.$slots, "prev-buttons-ever")
476
+ fn: $(() => [
477
+ k(e.$slots, "prev-buttons-ever")
479
478
  ]),
480
479
  key: "0"
481
480
  } : void 0,
482
- p(a)["prev-buttons"] ? {
481
+ c(a)["prev-buttons"] ? {
483
482
  name: "prev-buttons-ever",
484
- fn: V(() => [
485
- D(e.$slots, "prev-buttons")
483
+ fn: $(() => [
484
+ k(e.$slots, "prev-buttons")
486
485
  ]),
487
486
  key: "1"
488
487
  } : void 0
@@ -493,18 +492,18 @@ const g = (...C) => {
493
492
  }, 16);
494
493
  };
495
494
  }
496
- }), tt = {
497
- install: (C, J = {}) => {
498
- C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Ke);
495
+ }), et = {
496
+ install: (B, G = {}) => {
497
+ B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud", He);
499
498
  }
500
- }, at = (C) => {
501
- q.defaultSaveIcon = C;
502
- }, ot = (C) => {
503
- q.defaultDropIcon = C;
499
+ }, tt = (B) => {
500
+ q.defaultSaveIcon = B;
501
+ }, at = (B) => {
502
+ q.defaultDropIcon = B;
504
503
  };
505
504
  export {
506
- et as debugLktItemCrud,
507
- tt as default,
508
- ot as setItemCrudDefaultDropIcon,
509
- at as setItemCrudDefaultSaveIcon
505
+ xe as debugLktItemCrud,
506
+ et as default,
507
+ at as setItemCrudDefaultDropIcon,
508
+ tt as setItemCrudDefaultSaveIcon
510
509
  };