lkt-item-crud 1.2.4 → 1.2.5

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,4 +1,4 @@
1
- import { defineComponent as ve, useSlots as pe, ref as p, watch as k, resolveComponent as Z, openBlock as s, createElementBlock as S, unref as m, withDirectives as z, renderSlot as y, vShow as K, createCommentVNode as c, createBlock as B, withCtx as $, computed as i, nextTick as he, resolveDynamicComponent as ke, normalizeProps as ye, guardReactiveProps as Ce, createElementVNode as De, toDisplayString as ge, createSlots as ne } from "vue";
1
+ import { defineComponent as ve, useSlots as pe, ref as p, watch as y, resolveComponent as Z, openBlock as s, createElementBlock as w, unref as m, withDirectives as z, renderSlot as k, vShow as K, createCommentVNode as c, createBlock as M, withCtx as E, computed as i, nextTick as he, resolveDynamicComponent as ye, normalizeProps as ke, guardReactiveProps as Ce, createElementVNode as De, toDisplayString as ge, createSlots as ne } from "vue";
2
2
  import { httpCall as Se } from "lkt-http-client";
3
3
  import { DataState as se } from "lkt-data-state";
4
4
  import { execModal as we, refreshModal as Be, closeModal as Me, openModal as Ie, reOpenModal as Te } from "lkt-modal";
@@ -6,26 +6,26 @@ import { __ as Ue } from "lkt-i18n";
6
6
  const F = class F {
7
7
  };
8
8
  F.debugEnabled = !1, F.defaultSaveIcon = "", F.defaultDropIcon = "";
9
- let T = F;
9
+ let U = F;
10
10
  const v = (...o) => {
11
- T.debugEnabled && console.info("[LktItemCrud] ", ...o);
11
+ U.debugEnabled && console.info("[LktItemCrud] ", ...o);
12
12
  }, Xe = (o = !0) => {
13
- T.debugEnabled = o;
13
+ U.debugEnabled = o;
14
14
  }, Y = (o) => {
15
15
  v("runModalCallback -> init", o);
16
- let g = o.modalKey ? o.modalKey : "_", M = o.args ? o.args : {};
16
+ let g = o.modalKey ? o.modalKey : "_", I = o.args ? o.args : {};
17
17
  switch (o.action) {
18
18
  case "reOpen":
19
- return Te(o.modalName, g, M);
19
+ return Te(o.modalName, g, I);
20
20
  case "open":
21
- return Ie(o.modalName, g, M);
21
+ return Ie(o.modalName, g, I);
22
22
  case "close":
23
23
  return Me(o.modalName, g);
24
24
  case "refresh":
25
- return Be(o.modalName, g, M);
25
+ return Be(o.modalName, g, I);
26
26
  case "exec":
27
27
  let e = o.method;
28
- return e ? we(o.modalName, g, e, M) : void 0;
28
+ return e ? we(o.modalName, g, e, I) : void 0;
29
29
  }
30
30
  }, Re = { class: "lkt-item-crud-buttons" }, Ne = {
31
31
  key: 0,
@@ -65,110 +65,110 @@ const v = (...o) => {
65
65
  editModeText: {}
66
66
  },
67
67
  emits: ["update:loading", "update:editing", "save", "drop"],
68
- setup(o, { expose: g, emit: M }) {
69
- const e = M, b = o, u = pe(), E = p(null), r = p(null), d = p(b.loading);
70
- k(() => b.loading, (t) => d.value = t), k(d, (t) => e("update:loading", t));
68
+ setup(o, { expose: g, emit: I }) {
69
+ const e = I, b = o, u = pe(), V = p(null), r = p(null), d = p(b.loading);
70
+ y(() => b.loading, (a) => d.value = a), y(d, (a) => e("update:loading", a));
71
71
  const f = p(b.editing);
72
- k(() => b.editing, (t) => f.value = t), k(f, (t) => e("update:editing", t));
72
+ y(() => b.editing, (a) => f.value = a), y(f, (a) => e("update:editing", a));
73
73
  const h = () => {
74
74
  d.value = !0;
75
75
  }, C = () => {
76
76
  d.value = !1;
77
- }, w = () => {
78
- e("save");
79
- }, D = () => {
80
- e("drop");
77
+ }, B = (a, S) => {
78
+ e("save", a, S);
79
+ }, D = (a, S) => {
80
+ e("drop", a, S);
81
81
  };
82
82
  return g({
83
83
  doSave: () => {
84
- E.value && typeof E.value.click == "function" && E.value.click();
84
+ V.value && typeof V.value.click == "function" && V.value.click();
85
85
  },
86
86
  doDrop: () => {
87
87
  r.value && typeof r.value.click == "function" && r.value.click();
88
88
  }
89
- }), (t, V) => {
89
+ }), (a, S) => {
90
90
  const n = Z("lkt-button");
91
- return s(), S("div", Re, [
92
- m(u)["prev-buttons-ever"] ? z((s(), S("div", Ne, [
93
- y(t.$slots, "prev-buttons-ever")
91
+ return s(), w("div", Re, [
92
+ m(u)["prev-buttons-ever"] ? z((s(), w("div", Ne, [
93
+ k(a.$slots, "prev-buttons-ever")
94
94
  ], 512)), [
95
95
  [K, !d.value]
96
96
  ]) : c("", !0),
97
- m(u)["prev-buttons"] ? z((s(), S("div", $e, [
98
- y(t.$slots, "prev-buttons")
97
+ m(u)["prev-buttons"] ? z((s(), w("div", $e, [
98
+ k(a.$slots, "prev-buttons")
99
99
  ], 512)), [
100
100
  [K, f.value && !d.value]
101
101
  ]) : c("", !0),
102
- t.showSaveButton ? (s(), B(n, {
102
+ a.showSaveButton ? (s(), M(n, {
103
103
  key: 2,
104
104
  ref_key: "saveButton",
105
- ref: E,
105
+ ref: V,
106
106
  palette: "success",
107
- disabled: !t.ableToSave,
108
- "confirm-modal": t.saveConfirm,
109
- "confirm-data": t.confirmData,
110
- resource: t.saveResource,
111
- "resource-data": t.saveData,
112
- text: m(u)["button-save"] ? "" : t.saveText,
113
- icon: m(u)["button-save"] ? "" : t.saveIcon,
107
+ disabled: !a.ableToSave,
108
+ "confirm-modal": a.saveConfirm,
109
+ "confirm-data": a.confirmData,
110
+ resource: a.saveResource,
111
+ "resource-data": a.saveData,
112
+ text: m(u)["button-save"] ? "" : a.saveText,
113
+ icon: m(u)["button-save"] ? "" : a.saveIcon,
114
114
  onLoading: h,
115
115
  onLoaded: C,
116
- onClick: w
116
+ onClick: B
117
117
  }, {
118
- default: $(() => [
119
- m(u)["button-save"] ? y(t.$slots, "button-save", {
118
+ default: E(() => [
119
+ m(u)["button-save"] ? k(a.$slots, "button-save", {
120
120
  key: 0,
121
- item: t.item,
121
+ item: a.item,
122
122
  editMode: f.value,
123
- isCreate: t.createMode,
124
- canUpdate: t.canUpdate,
125
- canDrop: t.canDrop
123
+ isCreate: a.createMode,
124
+ canUpdate: a.canUpdate,
125
+ canDrop: a.canDrop
126
126
  }) : c("", !0)
127
127
  ]),
128
128
  _: 3
129
129
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])) : c("", !0),
130
- t.createMode ? c("", !0) : z((s(), B(n, {
130
+ a.createMode ? c("", !0) : z((s(), M(n, {
131
131
  key: 3,
132
132
  ref_key: "dropButton",
133
133
  ref: r,
134
134
  palette: "danger",
135
- disabled: !t.ableToDrop,
136
- "confirm-modal": t.dropConfirm,
137
- "confirm-data": t.dropConfirmData,
138
- resource: t.dropResource,
139
- "resource-data": t.dropData,
140
- text: m(u)["button-drop"] ? "" : t.dropText,
141
- icon: m(u)["button-drop"] ? "" : t.dropIcon,
135
+ disabled: !a.ableToDrop,
136
+ "confirm-modal": a.dropConfirm,
137
+ "confirm-data": a.dropConfirmData,
138
+ resource: a.dropResource,
139
+ "resource-data": a.dropData,
140
+ text: m(u)["button-drop"] ? "" : a.dropText,
141
+ icon: m(u)["button-drop"] ? "" : a.dropIcon,
142
142
  onLoading: h,
143
143
  onLoaded: C,
144
144
  onClick: D
145
145
  }, {
146
- default: $(() => [
147
- m(u)["button-drop"] ? y(t.$slots, "button-drop", {
146
+ default: E(() => [
147
+ m(u)["button-drop"] ? k(a.$slots, "button-drop", {
148
148
  key: 0,
149
- item: t.item,
149
+ item: a.item,
150
150
  editMode: f.value,
151
- isCreate: t.createMode,
152
- canUpdate: t.canUpdate,
153
- canDrop: t.canDrop
151
+ isCreate: a.createMode,
152
+ canUpdate: a.canUpdate,
153
+ canDrop: a.canDrop
154
154
  }) : c("", !0)
155
155
  ]),
156
156
  _: 3
157
157
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])), [
158
- [K, t.showDropButton]
158
+ [K, a.showDropButton]
159
159
  ]),
160
- m(u).buttons ? z((s(), S("div", Ee, [
161
- y(t.$slots, "buttons")
160
+ m(u).buttons ? z((s(), w("div", Ee, [
161
+ k(a.$slots, "buttons")
162
162
  ], 512)), [
163
163
  [K, f.value && !d.value]
164
164
  ]) : c("", !0),
165
- t.showSwitchButton ? (s(), B(n, {
165
+ a.showSwitchButton ? (s(), M(n, {
166
166
  key: 5,
167
167
  checked: f.value,
168
- "onUpdate:checked": V[0] || (V[0] = (L) => f.value = L),
168
+ "onUpdate:checked": S[0] || (S[0] = (L) => f.value = L),
169
169
  class: "lkt-item-crud--switch-mode-button",
170
170
  "show-switch": "",
171
- text: t.editModeText
171
+ text: a.editModeText
172
172
  }, null, 8, ["checked", "text"])) : c("", !0)
173
173
  ]);
174
174
  };
@@ -200,9 +200,9 @@ const Ve = { class: "lkt-item-crud" }, Le = {
200
200
  title: { default: "" },
201
201
  editModeText: { default: "Edition Mode" },
202
202
  saveText: { default: "Save" },
203
- saveIcon: { default: () => T.defaultSaveIcon },
203
+ saveIcon: { default: () => U.defaultSaveIcon },
204
204
  dropText: { default: "Delete" },
205
- dropIcon: { default: () => T.defaultDropIcon },
205
+ dropIcon: { default: () => U.defaultDropIcon },
206
206
  hiddenSave: { type: Boolean, default: !1 },
207
207
  hiddenDrop: { type: Boolean, default: !1 },
208
208
  hiddenButtons: { type: Boolean, default: !1 },
@@ -250,63 +250,63 @@ const Ve = { class: "lkt-item-crud" }, Le = {
250
250
  beforeClose: { type: Function, default: void 0 }
251
251
  },
252
252
  emits: ["update:modelValue", "update:isCreate", "update:editing", "read", "create", "update", "drop", "before-save", "perms", "error", "modified-data"],
253
- setup(o, { expose: g, emit: M }) {
254
- const e = o, b = pe(), u = M;
255
- let E = [];
256
- const r = p(!0), d = p(e.modelValue), f = p(E), h = p(e.editing), C = p(!1), w = p(!1), D = p(200), x = p(null), ee = p(null), t = p(new se(d.value, e.dataStateConfig)), V = p(new se(e.readData)), n = p(e.isCreate), L = p(!1), P = p(null), ae = i(() => n.value ? e.createConfirm : e.updateConfirm), te = i(() => n.value ? e.createConfirmData : e.updateConfirmData), q = i(() => n.value ? e.createResource : e.updateResource), oe = i(() => n.value ? { ...e.createData, ...JSON.parse(JSON.stringify(d.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(d.value)) }), ce = i(() => n.value ? e.createDisabled : e.updateDisabled), U = i(() => !n.value && Array.isArray(f.value) && f.value.includes("update")), R = i(() => !n.value && Array.isArray(f.value) && f.value.includes("drop")), J = async () => {
257
- v("fetchItem"), r.value = !0, D.value = -1, w.value = !1;
253
+ setup(o, { expose: g, emit: I }) {
254
+ const e = o, b = pe(), u = I;
255
+ let V = [];
256
+ const r = p(!0), d = p(e.modelValue), f = p(V), h = p(e.editing), C = p(!1), B = p(!1), D = p(200), x = p(null), ee = p(null), a = p(new se(d.value, e.dataStateConfig)), S = p(new se(e.readData)), n = p(e.isCreate), L = p(!1), P = p(null), te = i(() => n.value ? e.createConfirm : e.updateConfirm), ae = i(() => n.value ? e.createConfirmData : e.updateConfirmData), q = i(() => n.value ? e.createResource : e.updateResource), oe = i(() => n.value ? { ...e.createData, ...JSON.parse(JSON.stringify(d.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(d.value)) }), ce = i(() => n.value ? e.createDisabled : e.updateDisabled), R = i(() => !n.value && Array.isArray(f.value) && f.value.includes("update")), N = i(() => !n.value && Array.isArray(f.value) && f.value.includes("drop")), J = async () => {
257
+ v("fetchItem"), r.value = !0, D.value = -1, B.value = !1;
258
258
  try {
259
- const a = await Se(e.readResource, e.readData);
260
- if (v("fetchItem -> response", a), r.value = !1, D.value = a.httpStatus, !a.success) {
261
- C.value = !1, D.value = a.httpStatus, u("error", a.httpStatus);
259
+ const t = await Se(e.readResource, e.readData);
260
+ if (v("fetchItem -> response", t), r.value = !1, D.value = t.httpStatus, !t.success) {
261
+ C.value = !1, D.value = t.httpStatus, u("error", t.httpStatus);
262
262
  return;
263
263
  }
264
- C.value = !0, d.value = a.data, f.value = a.perms, t.value.increment(d.value).turnStoredIntoOriginal(), V.value.turnStoredIntoOriginal(), u("read", a);
264
+ C.value = !0, d.value = t.data, f.value = t.perms, a.value.increment(d.value).turnStoredIntoOriginal(), S.value.turnStoredIntoOriginal(), u("read", t);
265
265
  } catch {
266
266
  r.value = !1, C.value = !1, D.value = 404, u("error", 404);
267
267
  return;
268
268
  }
269
269
  };
270
- k(() => e.modelValue, (a) => {
271
- d.value = a, t.value.increment(a);
272
- }, { deep: !0 }), k(d, (a) => {
270
+ y(() => e.modelValue, (t) => {
271
+ d.value = t, a.value.increment(t);
272
+ }, { deep: !0 }), y(d, (t) => {
273
273
  if (L.value = !0, v("item updated ->", d.value), typeof e.beforeEmitUpdate == "function") {
274
274
  v("item updated -> has beforeEmitUpdate");
275
275
  let l = e.beforeEmitUpdate(d.value);
276
276
  v("item updated -> override with: ", l), typeof l == "object" && (d.value = l);
277
277
  }
278
- u("update:modelValue", d.value), v("item updated -> update dataState"), t.value.increment(a), he(() => L.value = !1);
279
- }, { deep: !0 }), k(f, () => u("perms", f.value));
280
- const O = i(() => ce.value || !n.value && !U.value || typeof e.saveValidator == "function" && !e.saveValidator(d.value) ? !1 : t.value.changed()), H = i(() => !e.dropDisabled && R.value);
281
- k(O, (a) => u("modified-data", a)), k(n, (a) => u("update:isCreate", a)), k(() => e.readData, (a) => {
282
- V.value.increment(a), V.value.changed() && J();
283
- }), k(() => e.editing, (a) => {
284
- v("editing updated -> updating editMode", a), h.value = a;
285
- }), k(h, (a) => {
286
- v("editMode updated -> emit update", a), u("update:editing", a);
278
+ u("update:modelValue", d.value), v("item updated -> update dataState"), a.value.increment(t), he(() => L.value = !1);
279
+ }, { deep: !0 }), y(f, () => u("perms", f.value));
280
+ const O = i(() => ce.value || !n.value && !R.value || typeof e.saveValidator == "function" && !e.saveValidator(d.value) ? !1 : a.value.changed()), H = i(() => !e.dropDisabled && N.value);
281
+ y(O, (t) => u("modified-data", t)), y(n, (t) => u("update:isCreate", t)), y(() => e.readData, (t) => {
282
+ S.value.increment(t), S.value.changed() && J();
283
+ }), y(() => e.editing, (t) => {
284
+ v("editing updated -> updating editMode", t), h.value = t;
285
+ }), y(h, (t) => {
286
+ v("editMode updated -> emit update", t), u("update:editing", t);
287
287
  }), e.readResource && !n.value ? J() : n.value && (C.value = !0, h.value = !0, r.value = !1);
288
- const le = (a, l) => {
288
+ const le = (t, l) => {
289
289
  if (r.value = !1, D.value = l.httpStatus, !l.success) {
290
- w.value = !0, u("error", l.httpStatus);
290
+ B.value = !0, u("error", l.httpStatus);
291
291
  return;
292
292
  }
293
- w.value = !0, e.onDropModalCallbacks.length > 0 && (v("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((N) => {
294
- Y(N);
293
+ B.value = !0, e.onDropModalCallbacks.length > 0 && (v("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach(($) => {
294
+ Y($);
295
295
  })), u("drop", l);
296
- }, de = (a, l) => {
296
+ }, de = (t, l) => {
297
297
  if (v("onSave -> received response:", l), u("before-save"), q.value) {
298
- if (r.value = !1, D.value = l.httpStatus, !l.success) {
299
- w.value = !0, u("error", l.httpStatus);
298
+ if (r.value = !1, typeof l < "u" && (D.value = l.httpStatus, l.success)) {
299
+ B.value = !0, u("error", l.httpStatus);
300
300
  return;
301
301
  }
302
- w.value = !0;
302
+ B.value = !0;
303
303
  }
304
- let N = n.value ? "create" : "update";
305
- n.value || (v("onSave -> turn stored data into original"), t.value.turnStoredIntoOriginal()), N === "create" ? typeof e.onCreate == "function" && (v("onSave -> trigger onCreate callback"), e.onCreate(l), e.onCreateModalCallbacks.length > 0 && (v("onSave -> has onCreateModalCallbacks"), e.onCreateModalCallbacks.forEach((A) => {
304
+ let $ = n.value ? "create" : "update";
305
+ n.value || (v("onSave -> turn stored data into original"), a.value.turnStoredIntoOriginal()), $ === "create" ? typeof e.onCreate == "function" && (v("onSave -> trigger onCreate callback"), e.onCreate(l), e.onCreateModalCallbacks.length > 0 && (v("onSave -> has onCreateModalCallbacks"), e.onCreateModalCallbacks.forEach((A) => {
306
306
  Y(A);
307
307
  }))) : typeof e.onUpdate == "function" && (v("onSave -> trigger onUpdate callback"), e.onUpdate(l), e.onUpdateModalCallbacks.length > 0 && (v("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((A) => {
308
308
  Y(A);
309
- }))), !e.insideModal && l.autoReloadId && (v("onSave -> autoReloadId detected: ", l.autoReloadId), e.readData.id = l.autoReloadId, v("onSave -> turning off create mode"), n.value = !1, J()), u(N, l);
309
+ }))), !e.insideModal && l.autoReloadId && (v("onSave -> autoReloadId detected: ", l.autoReloadId), e.readData.id = l.autoReloadId, v("onSave -> turning off create mode"), n.value = !1, J()), u($, l);
310
310
  };
311
311
  g({
312
312
  doDrop: () => {
@@ -316,9 +316,9 @@ const Ve = { class: "lkt-item-crud" }, Le = {
316
316
  doSave: () => {
317
317
  P.value && x.value.doSave();
318
318
  },
319
- hasModifiedData: () => t.value.changed()
319
+ hasModifiedData: () => a.value.changed()
320
320
  });
321
- const fe = i(() => t.value.changed() ? e.editedCloseConfirm : ""), W = i(() => !U.value && R.value ? !0 : !e.hiddenDrop && !r.value && h.value && C.value), G = i(() => t.value.changed() ? !0 : r.value ? !1 : n.value ? !0 : e.buttonNavVisibility === j.Always ? O.value : !e.hiddenSave && h.value && C.value), Q = i(() => e.hideSwitchEdition || !U.value && !R.value || !U.value && R.value ? !1 : !r.value && !n.value && C.value && !(e.dropDisabled && e.updateDisabled)), re = i(() => e.buttonNavVisibility === j.Always && (O.value || H.value) || b["prev-buttons-ever"] ? !0 : !e.hiddenButtons && (G.value || W.value || Q.value)), X = i(() => e.title.startsWith("__:") ? String(Ue(e.title.substring(3))) : e.title), me = i(() => r.value ? !1 : X.value.length > 0 || !!b["post-title"]), ue = i(() => e.insideModal ? "lkt-modal" : "section"), be = i(() => ue.value === "lkt-modal" ? {
321
+ const fe = i(() => a.value.changed() ? e.editedCloseConfirm : ""), W = i(() => !R.value && N.value ? !0 : !e.hiddenDrop && !r.value && h.value && C.value), G = i(() => a.value.changed() ? !0 : r.value ? !1 : n.value ? !0 : e.buttonNavVisibility === j.Always ? O.value : !e.hiddenSave && h.value && C.value), Q = i(() => e.hideSwitchEdition || !R.value && !N.value || !R.value && N.value ? !1 : !r.value && !n.value && C.value && !(e.dropDisabled && e.updateDisabled)), re = i(() => e.buttonNavVisibility === j.Always && (O.value || H.value) || b["prev-buttons-ever"] ? !0 : !e.hiddenButtons && (G.value || W.value || Q.value)), X = i(() => e.title.startsWith("__:") ? String(Ue(e.title.substring(3))) : e.title), me = i(() => r.value ? !1 : X.value.length > 0 || !!b["post-title"]), ue = i(() => e.insideModal ? "lkt-modal" : "section"), be = i(() => ue.value === "lkt-modal" ? {
322
322
  "modal-name": e.modalName,
323
323
  "modal-key": e.modalKey,
324
324
  "z-index": e.zIndex,
@@ -332,143 +332,143 @@ const Ve = { class: "lkt-item-crud" }, Le = {
332
332
  title: e.title,
333
333
  size: e.size
334
334
  } : {});
335
- return (a, l) => {
336
- const N = Z("lkt-http-info"), A = Z("lkt-loader");
337
- return s(), B(ke(ue.value), ye(Ce(be.value)), {
338
- default: $(() => [
335
+ return (t, l) => {
336
+ const $ = Z("lkt-http-info"), A = Z("lkt-loader");
337
+ return s(), M(ye(ue.value), ke(Ce(be.value)), {
338
+ default: E(() => [
339
339
  De("article", Ve, [
340
- !a.insideModal && me.value ? (s(), S("header", Le, [
341
- m(b)["pre-title"] ? (s(), S("div", Oe, [
342
- y(a.$slots, "pre-title", {
340
+ !t.insideModal && me.value ? (s(), w("header", Le, [
341
+ m(b)["pre-title"] ? (s(), w("div", Oe, [
342
+ k(t.$slots, "pre-title", {
343
343
  item: d.value,
344
344
  loading: r.value
345
345
  })
346
346
  ])) : c("", !0),
347
- X.value.length > 0 ? (s(), S("h1", Ae, ge(X.value), 1)) : c("", !0),
348
- m(b)["post-title"] ? (s(), S("div", ze, [
349
- y(a.$slots, "post-title", {
347
+ X.value.length > 0 ? (s(), w("h1", Ae, ge(X.value), 1)) : c("", !0),
348
+ m(b)["post-title"] ? (s(), w("div", ze, [
349
+ k(t.$slots, "post-title", {
350
350
  item: d.value,
351
351
  loading: r.value
352
352
  })
353
353
  ])) : c("", !0)
354
354
  ])) : c("", !0),
355
- re.value && a.buttonNavPosition === "top" ? (s(), B(ie, {
355
+ re.value && t.buttonNavPosition === "top" ? (s(), M(ie, {
356
356
  key: 1,
357
357
  ref_key: "buttonNav",
358
358
  ref: P,
359
359
  loading: r.value,
360
- "onUpdate:loading": l[0] || (l[0] = (I) => r.value = I),
360
+ "onUpdate:loading": l[0] || (l[0] = (T) => r.value = T),
361
361
  editing: h.value,
362
- "onUpdate:editing": l[1] || (l[1] = (I) => h.value = I),
362
+ "onUpdate:editing": l[1] || (l[1] = (T) => h.value = T),
363
363
  item: d.value,
364
364
  "create-mode": n.value,
365
- "can-update": U.value,
366
- "can-drop": R.value,
365
+ "can-update": R.value,
366
+ "can-drop": N.value,
367
367
  "show-switch-button": Q.value,
368
368
  "show-save-button": G.value,
369
369
  "show-drop-button": W.value,
370
370
  "able-to-save": O.value,
371
371
  "able-to-drop": H.value,
372
- "save-confirm": ae.value,
373
- "drop-confirm": a.dropConfirm,
374
- "confirm-data": te.value,
375
- "drop-confirm-data": a.dropConfirmData,
372
+ "save-confirm": te.value,
373
+ "drop-confirm": t.dropConfirm,
374
+ "confirm-data": ae.value,
375
+ "drop-confirm-data": t.dropConfirmData,
376
376
  "save-resource": q.value,
377
- "drop-resource": a.dropResource,
377
+ "drop-resource": t.dropResource,
378
378
  "save-data": oe.value,
379
- "drop-data": a.dropData,
380
- "save-text": a.saveText,
381
- "drop-text": a.dropText,
382
- "save-icon": a.saveIcon,
383
- "drop-icon": a.dropIcon,
384
- "edit-mode-text": a.editModeText,
379
+ "drop-data": t.dropData,
380
+ "save-text": t.saveText,
381
+ "drop-text": t.dropText,
382
+ "save-icon": t.saveIcon,
383
+ "drop-icon": t.dropIcon,
384
+ "edit-mode-text": t.editModeText,
385
385
  onSave: de,
386
386
  onDrop: le
387
387
  }, ne({ _: 2 }, [
388
388
  m(b)["prev-buttons-ever"] ? {
389
389
  name: "prev-buttons-ever",
390
- fn: $(() => [
391
- y(a.$slots, "prev-buttons-ever")
390
+ fn: E(() => [
391
+ k(t.$slots, "prev-buttons-ever")
392
392
  ]),
393
393
  key: "0"
394
394
  } : void 0,
395
395
  m(b)["prev-buttons"] ? {
396
396
  name: "prev-buttons-ever",
397
- fn: $(() => [
398
- y(a.$slots, "prev-buttons")
397
+ fn: E(() => [
398
+ k(t.$slots, "prev-buttons")
399
399
  ]),
400
400
  key: "1"
401
401
  } : void 0
402
402
  ]), 1032, ["loading", "editing", "item", "create-mode", "can-update", "can-drop", "show-switch-button", "show-save-button", "show-drop-button", "able-to-save", "able-to-drop", "save-confirm", "drop-confirm", "confirm-data", "drop-confirm-data", "save-resource", "drop-resource", "save-data", "drop-data", "save-text", "drop-text", "save-icon", "drop-icon", "edit-mode-text"])) : c("", !0),
403
- r.value ? c("", !0) : (s(), S("div", Ke, [
404
- C.value ? (s(), S("div", Fe, [
405
- w.value ? (s(), B(N, {
403
+ r.value ? c("", !0) : (s(), w("div", Ke, [
404
+ C.value ? (s(), w("div", Fe, [
405
+ B.value ? (s(), M($, {
406
406
  key: 0,
407
407
  code: D.value,
408
408
  quick: "",
409
409
  palette: D.value === 200 ? "success" : "danger",
410
410
  "can-close": "",
411
- onClose: l[2] || (l[2] = (I) => w.value = !1)
411
+ onClose: l[2] || (l[2] = (T) => B.value = !1)
412
412
  }, null, 8, ["code", "palette"])) : c("", !0),
413
- y(a.$slots, "item", {
413
+ k(t.$slots, "item", {
414
414
  item: d.value,
415
415
  loading: r.value,
416
416
  editMode: h.value,
417
417
  isCreate: n.value,
418
- canUpdate: U.value,
419
- canDrop: R.value,
418
+ canUpdate: R.value,
419
+ canDrop: N.value,
420
420
  itemBeingEdited: L.value
421
421
  })
422
- ])) : (s(), B(N, {
422
+ ])) : (s(), M($, {
423
423
  key: 1,
424
424
  code: D.value
425
425
  }, null, 8, ["code"]))
426
426
  ])),
427
- r.value ? (s(), B(A, { key: 3 })) : c("", !0),
428
- a.buttonNavPosition === m(_).Bottom ? z((s(), B(ie, {
427
+ r.value ? (s(), M(A, { key: 3 })) : c("", !0),
428
+ t.buttonNavPosition === m(_).Bottom ? z((s(), M(ie, {
429
429
  key: 4,
430
430
  ref_key: "buttonNav",
431
431
  ref: P,
432
432
  loading: r.value,
433
- "onUpdate:loading": l[3] || (l[3] = (I) => r.value = I),
433
+ "onUpdate:loading": l[3] || (l[3] = (T) => r.value = T),
434
434
  editing: h.value,
435
- "onUpdate:editing": l[4] || (l[4] = (I) => h.value = I),
435
+ "onUpdate:editing": l[4] || (l[4] = (T) => h.value = T),
436
436
  item: d.value,
437
437
  "create-mode": n.value,
438
- "can-update": U.value,
439
- "can-drop": R.value,
438
+ "can-update": R.value,
439
+ "can-drop": N.value,
440
440
  "show-switch-button": Q.value,
441
441
  "show-save-button": G.value,
442
442
  "show-drop-button": W.value,
443
443
  "able-to-save": O.value,
444
444
  "able-to-drop": H.value,
445
- "save-confirm": ae.value,
446
- "drop-confirm": a.dropConfirm,
447
- "confirm-data": te.value,
448
- "drop-confirm-data": a.dropConfirmData,
445
+ "save-confirm": te.value,
446
+ "drop-confirm": t.dropConfirm,
447
+ "confirm-data": ae.value,
448
+ "drop-confirm-data": t.dropConfirmData,
449
449
  "save-resource": q.value,
450
- "drop-resource": a.dropResource,
450
+ "drop-resource": t.dropResource,
451
451
  "save-data": oe.value,
452
- "drop-data": a.dropData,
453
- "save-text": a.saveText,
454
- "drop-text": a.dropText,
455
- "save-icon": a.saveIcon,
456
- "drop-icon": a.dropIcon,
457
- "edit-mode-text": a.editModeText,
452
+ "drop-data": t.dropData,
453
+ "save-text": t.saveText,
454
+ "drop-text": t.dropText,
455
+ "save-icon": t.saveIcon,
456
+ "drop-icon": t.dropIcon,
457
+ "edit-mode-text": t.editModeText,
458
458
  onSave: de,
459
459
  onDrop: le
460
460
  }, ne({ _: 2 }, [
461
461
  m(b)["prev-buttons-ever"] ? {
462
462
  name: "prev-buttons-ever",
463
- fn: $(() => [
464
- y(a.$slots, "prev-buttons-ever")
463
+ fn: E(() => [
464
+ k(t.$slots, "prev-buttons-ever")
465
465
  ]),
466
466
  key: "0"
467
467
  } : void 0,
468
468
  m(b)["prev-buttons"] ? {
469
469
  name: "prev-buttons-ever",
470
- fn: $(() => [
471
- y(a.$slots, "prev-buttons")
470
+ fn: E(() => [
471
+ k(t.$slots, "prev-buttons")
472
472
  ]),
473
473
  key: "1"
474
474
  } : void 0
@@ -486,9 +486,9 @@ const Ve = { class: "lkt-item-crud" }, Le = {
486
486
  o.component("lkt-item-crud") === void 0 && o.component("lkt-item-crud", Pe);
487
487
  }
488
488
  }, Ze = (o) => {
489
- T.defaultSaveIcon = o;
489
+ U.defaultSaveIcon = o;
490
490
  }, _e = (o) => {
491
- T.defaultDropIcon = o;
491
+ U.defaultDropIcon = o;
492
492
  };
493
493
  export {
494
494
  Xe as debugLktItemCrud,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, useSlots, watch } from 'vue';
3
3
  import { LktObject } from 'lkt-ts-interfaces';
4
+ import { HTTPResponse } from 'lkt-http-client';
4
5
 
5
6
  const emit = defineEmits(['update:loading', 'update:editing', 'save', 'drop']);
6
7
 
@@ -57,11 +58,11 @@
57
58
  onButtonLoaded = () => {
58
59
  isLoading.value = false;
59
60
  },
60
- onSave = () => {
61
- emit('save');
61
+ onSave = ($event: Event, r: HTTPResponse) => {
62
+ emit('save', $event, r);
62
63
  },
63
- onDrop = () => {
64
- emit('drop');
64
+ onDrop = ($event: Event, r: HTTPResponse) => {
65
+ emit('drop', $event, r);
65
66
  };
66
67
 
67
68
  const doSave = () => {
@@ -289,11 +289,13 @@
289
289
  emit('before-save');
290
290
  if (saveResource.value) {
291
291
  isLoading.value = false;
292
- httpStatus.value = r.httpStatus;
293
- if (!r.success) {
294
- showStoreMessage.value = true;
295
- emit('error', r.httpStatus);
296
- return;
292
+ if (typeof r !== 'undefined') {
293
+ httpStatus.value = r.httpStatus;
294
+ if (r.success) {
295
+ showStoreMessage.value = true;
296
+ emit('error', r.httpStatus);
297
+ return;
298
+ }
297
299
  }
298
300
  showStoreMessage.value = true;
299
301
  }