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