lkt-item-crud 1.2.1 → 1.2.2

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- declare function qe(t?: boolean): void;
2
- declare namespace Ae {
3
- function install(t: any, C?: {}): void;
1
+ declare function He(a?: boolean): void;
2
+ declare namespace We {
3
+ function install(a: any, C?: {}): void;
4
4
  }
5
- declare function We(t: any): void;
6
- declare function He(t: any): void;
7
- export { qe as debugLktItemCrud, Ae as default, We as setItemCrudDefaultDropIcon, He as setItemCrudDefaultSaveIcon };
5
+ declare function Qe(a: any): void;
6
+ declare function Ge(a: any): void;
7
+ export { He as debugLktItemCrud, We as default, Qe as setItemCrudDefaultDropIcon, Ge as setItemCrudDefaultSaveIcon };
package/dist/build.js CHANGED
@@ -1,31 +1,31 @@
1
- import { defineComponent as pe, useSlots as me, ref as s, computed as n, watch as y, nextTick as he, resolveComponent as J, openBlock as c, createBlock as N, resolveDynamicComponent as Ce, normalizeProps as ke, guardReactiveProps as be, withCtx as P, createElementVNode as Z, createElementBlock as B, unref as h, renderSlot as R, createCommentVNode as v, toDisplayString as De, withDirectives as V, createVNode as ee, vShow as T } from "vue";
2
- import { httpCall as ye } from "lkt-http-client";
3
- import { DataState as ae } from "lkt-data-state";
1
+ import { defineComponent as pe, useSlots as me, ref as v, computed as n, watch as S, nextTick as he, resolveComponent as x, openBlock as s, createBlock as T, resolveDynamicComponent as be, normalizeProps as Ce, guardReactiveProps as ke, withCtx as P, createElementVNode as Z, createElementBlock as b, unref as m, renderSlot as g, createCommentVNode as f, toDisplayString as ye, withDirectives as w, vShow as E, createVNode as ee } from "vue";
2
+ import { httpCall as De } from "lkt-http-client";
3
+ import { DataState as te } from "lkt-data-state";
4
4
  import { execModal as Se, refreshModal as ge, closeModal as Me, openModal as Ie, reOpenModal as Be } from "lkt-modal";
5
5
  import { __ as _e } from "lkt-i18n";
6
6
  const L = class L {
7
7
  };
8
8
  L.debugEnabled = !1, L.defaultSaveIcon = "", L.defaultDropIcon = "";
9
- let S = L;
10
- const u = (...t) => {
11
- S.debugEnabled && console.info("[LktItemCrud] ", ...t);
12
- }, qe = (t = !0) => {
13
- S.debugEnabled = t;
14
- }, j = (t) => {
15
- u("runModalCallback -> init", t);
16
- let C = t.modalKey ? t.modalKey : "_", _ = t.args ? t.args : {};
17
- switch (t.action) {
9
+ let M = L;
10
+ const d = (...a) => {
11
+ M.debugEnabled && console.info("[LktItemCrud] ", ...a);
12
+ }, He = (a = !0) => {
13
+ M.debugEnabled = a;
14
+ }, j = (a) => {
15
+ d("runModalCallback -> init", a);
16
+ let C = a.modalKey ? a.modalKey : "_", R = a.args ? a.args : {};
17
+ switch (a.action) {
18
18
  case "reOpen":
19
- return Be(t.modalName, C, _);
19
+ return Be(a.modalName, C, R);
20
20
  case "open":
21
- return Ie(t.modalName, C, _);
21
+ return Ie(a.modalName, C, R);
22
22
  case "close":
23
- return Me(t.modalName, C);
23
+ return Me(a.modalName, C);
24
24
  case "refresh":
25
- return ge(t.modalName, C, _);
25
+ return ge(a.modalName, C, R);
26
26
  case "exec":
27
- let e = t.method;
28
- return e ? Se(t.modalName, C, e, _) : void 0;
27
+ let e = a.method;
28
+ return e ? Se(a.modalName, C, e, R) : void 0;
29
29
  }
30
30
  }, we = { class: "lkt-item-crud" }, Ee = {
31
31
  key: 0,
@@ -40,24 +40,30 @@ const u = (...t) => {
40
40
  key: 2,
41
41
  class: "lkt-item-crud_header-slot"
42
42
  }, Ve = { class: "lkt-item-crud-buttons" }, Te = {
43
- key: 1,
43
+ key: 0,
44
44
  class: "lkt-item-crud-buttons"
45
45
  }, Le = {
46
46
  key: 1,
47
- class: "lkt-item-crud_content"
47
+ class: "lkt-item-crud-buttons"
48
+ }, $e = {
49
+ key: 3,
50
+ class: "lkt-item-crud-buttons"
48
51
  }, Oe = {
52
+ key: 1,
53
+ class: "lkt-item-crud_content"
54
+ }, ze = {
49
55
  key: 0,
50
56
  class: "lkt-grid-1"
51
- }, $e = /* @__PURE__ */ pe({
57
+ }, Ke = /* @__PURE__ */ pe({
52
58
  __name: "LktItemCrud",
53
59
  props: {
54
60
  modelValue: { default: () => ({}) },
55
61
  title: { default: "" },
56
62
  editModeText: { default: "Edition Mode" },
57
63
  saveText: { default: "Save" },
58
- saveIcon: { default: () => S.defaultSaveIcon },
64
+ saveIcon: { default: () => M.defaultSaveIcon },
59
65
  dropText: { default: "Delete" },
60
- dropIcon: { default: () => S.defaultDropIcon },
66
+ dropIcon: { default: () => M.defaultDropIcon },
61
67
  hiddenSave: { type: Boolean, default: !1 },
62
68
  hiddenDrop: { type: Boolean, default: !1 },
63
69
  hiddenButtons: { type: Boolean, default: !1 },
@@ -103,79 +109,79 @@ const u = (...t) => {
103
109
  beforeClose: { type: Function, default: void 0 }
104
110
  },
105
111
  emits: ["update:modelValue", "update:isCreate", "update:editing", "read", "create", "update", "drop", "before-save", "perms", "error", "modified-data"],
106
- setup(t, { expose: C, emit: _ }) {
107
- const e = t, p = me(), i = _;
108
- let te = [];
109
- const d = s(!0), r = s(e.modelValue), U = s(te), f = s(e.editing), k = s(!1), g = s(!1), m = s(200), O = s(null), $ = s(null), b = s(new ae(r.value, e.dataStateConfig)), K = s(new ae(e.readData)), o = s(e.isCreate), x = s(!1), le = n(() => o.value ? e.createConfirm : e.updateConfirm), oe = n(() => o.value ? e.createConfirmData : e.updateConfirmData), q = n(() => o.value ? e.createResource : e.updateResource), ue = n(() => o.value ? { ...e.createData, ...JSON.parse(JSON.stringify(r.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(r.value)) }), de = n(() => o.value ? e.createDisabled : e.updateDisabled), M = n(() => !o.value && U.value.includes("update")), I = n(() => !o.value && U.value.includes("drop")), z = async () => {
110
- u("fetchItem"), d.value = !0, m.value = -1, g.value = !1;
112
+ setup(a, { expose: C, emit: R }) {
113
+ const e = a, i = me(), c = R;
114
+ let ae = [];
115
+ const o = v(!0), r = v(e.modelValue), V = v(ae), p = v(e.editing), k = v(!1), I = v(!1), h = v(200), $ = v(null), O = v(null), y = v(new te(r.value, e.dataStateConfig)), K = v(new te(e.readData)), u = v(e.isCreate), F = v(!1), le = n(() => u.value ? e.createConfirm : e.updateConfirm), oe = n(() => u.value ? e.createConfirmData : e.updateConfirmData), q = n(() => u.value ? e.createResource : e.updateResource), ue = n(() => u.value ? { ...e.createData, ...JSON.parse(JSON.stringify(r.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(r.value)) }), de = n(() => u.value ? e.createDisabled : e.updateDisabled), B = n(() => !u.value && V.value.includes("update")), _ = n(() => !u.value && V.value.includes("drop")), z = async () => {
116
+ d("fetchItem"), o.value = !0, h.value = -1, I.value = !1;
111
117
  try {
112
- const a = await ye(e.readResource, e.readData);
113
- if (u("fetchItem -> response", a), d.value = !1, m.value = a.httpStatus, !a.success) {
114
- k.value = !1, m.value = a.httpStatus, i("error", a.httpStatus);
118
+ const t = await De(e.readResource, e.readData);
119
+ if (d("fetchItem -> response", t), o.value = !1, h.value = t.httpStatus, !t.success) {
120
+ k.value = !1, h.value = t.httpStatus, c("error", t.httpStatus);
115
121
  return;
116
122
  }
117
- k.value = !0, r.value = a.data, U.value = a.perms, b.value.increment(r.value).turnStoredIntoOriginal(), K.value.turnStoredIntoOriginal(), i("read", a);
123
+ k.value = !0, r.value = t.data, V.value = t.perms, y.value.increment(r.value).turnStoredIntoOriginal(), K.value.turnStoredIntoOriginal(), c("read", t);
118
124
  } catch {
119
- d.value = !1, k.value = !1, m.value = 404, i("error", 404);
125
+ o.value = !1, k.value = !1, h.value = 404, c("error", 404);
120
126
  return;
121
127
  }
122
128
  };
123
- y(() => e.modelValue, (a) => {
124
- r.value = a, b.value.increment(a);
125
- }, { deep: !0 }), y(r, (a) => {
126
- if (x.value = !0, u("item updated ->", r.value), typeof e.beforeEmitUpdate == "function") {
127
- u("item updated -> has beforeEmitUpdate");
129
+ S(() => e.modelValue, (t) => {
130
+ r.value = t, y.value.increment(t);
131
+ }, { deep: !0 }), S(r, (t) => {
132
+ if (F.value = !0, d("item updated ->", r.value), typeof e.beforeEmitUpdate == "function") {
133
+ d("item updated -> has beforeEmitUpdate");
128
134
  let l = e.beforeEmitUpdate(r.value);
129
- u("item updated -> override with: ", l), typeof l == "object" && (r.value = l);
135
+ d("item updated -> override with: ", l), typeof l == "object" && (r.value = l);
130
136
  }
131
- i("update:modelValue", r.value), u("item updated -> update dataState"), b.value.increment(a), he(() => x.value = !1);
132
- }, { deep: !0 }), y(U, () => i("perms", U.value));
133
- const A = n(() => de.value || !o.value && !M.value || typeof e.saveValidator == "function" && !e.saveValidator(r.value) ? !1 : b.value.changed());
134
- y(A, (a) => i("modified-data", a)), y(o, (a) => i("update:isCreate", a)), y(() => e.readData, (a) => {
135
- K.value.increment(a), K.value.changed() && z();
136
- }), y(() => e.editing, (a) => {
137
- u("editing updated -> updating editMode", a), f.value = a;
138
- }), y(f, (a) => {
139
- u("editMode updated -> emit update", a), i("update:editing", a);
140
- }), e.readResource && !o.value ? z() : o.value && (k.value = !0, f.value = !0, d.value = !1);
141
- const re = (a, l) => {
142
- if (d.value = !1, m.value = l.httpStatus, !l.success) {
143
- g.value = !0, i("error", l.httpStatus);
137
+ c("update:modelValue", r.value), d("item updated -> update dataState"), y.value.increment(t), he(() => F.value = !1);
138
+ }, { deep: !0 }), S(V, () => c("perms", V.value));
139
+ const A = n(() => de.value || !u.value && !B.value || typeof e.saveValidator == "function" && !e.saveValidator(r.value) ? !1 : y.value.changed());
140
+ S(A, (t) => c("modified-data", t)), S(u, (t) => c("update:isCreate", t)), S(() => e.readData, (t) => {
141
+ K.value.increment(t), K.value.changed() && z();
142
+ }), S(() => e.editing, (t) => {
143
+ d("editing updated -> updating editMode", t), p.value = t;
144
+ }), S(p, (t) => {
145
+ d("editMode updated -> emit update", t), c("update:editing", t);
146
+ }), e.readResource && !u.value ? z() : u.value && (k.value = !0, p.value = !0, o.value = !1);
147
+ const re = (t, l) => {
148
+ if (o.value = !1, h.value = l.httpStatus, !l.success) {
149
+ I.value = !0, c("error", l.httpStatus);
144
150
  return;
145
151
  }
146
- g.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((D) => {
152
+ I.value = !0, e.onDropModalCallbacks.length > 0 && (d("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((D) => {
147
153
  j(D);
148
- })), i("drop", l);
149
- }, ne = (a, l) => {
150
- if (u("onSave -> received response:", l), i("before-save"), q.value) {
151
- if (d.value = !1, m.value = l.httpStatus, !l.success) {
152
- g.value = !0, i("error", l.httpStatus);
154
+ })), c("drop", l);
155
+ }, ne = (t, l) => {
156
+ if (d("onSave -> received response:", l), c("before-save"), q.value) {
157
+ if (o.value = !1, h.value = l.httpStatus, !l.success) {
158
+ I.value = !0, c("error", l.httpStatus);
153
159
  return;
154
160
  }
155
- g.value = !0;
161
+ I.value = !0;
156
162
  }
157
- let D = o.value ? "create" : "update";
158
- o.value || (u("onSave -> turn stored data into original"), b.value.turnStoredIntoOriginal()), D === "create" ? typeof e.onCreate == "function" && (u("onSave -> trigger onCreate callback"), e.onCreate(l), e.onCreateModalCallbacks.length > 0 && (u("onSave -> has onCreateModalCallbacks"), e.onCreateModalCallbacks.forEach((w) => {
159
- j(w);
160
- }))) : typeof e.onUpdate == "function" && (u("onSave -> trigger onUpdate callback"), e.onUpdate(l), e.onUpdateModalCallbacks.length > 0 && (u("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((w) => {
161
- j(w);
162
- }))), !e.insideModal && l.autoReloadId && (u("onSave -> autoReloadId detected: ", l.autoReloadId), e.readData.id = l.autoReloadId, u("onSave -> turning off create mode"), o.value = !1, z()), i(D, l);
163
+ let D = u.value ? "create" : "update";
164
+ u.value || (d("onSave -> turn stored data into original"), y.value.turnStoredIntoOriginal()), D === "create" ? typeof e.onCreate == "function" && (d("onSave -> trigger onCreate callback"), e.onCreate(l), e.onCreateModalCallbacks.length > 0 && (d("onSave -> has onCreateModalCallbacks"), e.onCreateModalCallbacks.forEach((U) => {
165
+ j(U);
166
+ }))) : typeof e.onUpdate == "function" && (d("onSave -> trigger onUpdate callback"), e.onUpdate(l), e.onUpdateModalCallbacks.length > 0 && (d("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((U) => {
167
+ j(U);
168
+ }))), !e.insideModal && l.autoReloadId && (d("onSave -> autoReloadId detected: ", l.autoReloadId), e.readData.id = l.autoReloadId, d("onSave -> turning off create mode"), u.value = !1, z()), c(D, l);
163
169
  }, H = () => {
164
- d.value = !0, m.value = -1;
170
+ o.value = !0, h.value = -1;
165
171
  }, W = () => {
166
- d.value = !1;
172
+ o.value = !1;
167
173
  };
168
174
  C({
169
175
  doDrop: () => {
170
- $.value && typeof $.value.click == "function" && $.value.click();
176
+ O.value && typeof O.value.click == "function" && O.value.click();
171
177
  },
172
178
  doRefresh: z,
173
179
  doSave: () => {
174
- O.value && typeof O.value.click == "function" && O.value.click();
180
+ $.value && typeof $.value.click == "function" && $.value.click();
175
181
  },
176
- hasModifiedData: () => b.value.changed()
182
+ hasModifiedData: () => y.value.changed()
177
183
  });
178
- const ie = n(() => b.value.changed() ? e.editedCloseConfirm : ""), G = n(() => !M.value && I.value ? !0 : !e.hiddenDrop && !d.value && f.value && k.value), Q = n(() => b.value.changed() ? !0 : d.value ? !1 : o.value ? !0 : !e.hiddenSave && f.value && k.value), X = n(() => e.hideSwitchEdition || !M.value && !I.value || !M.value && I.value ? !1 : !d.value && !o.value && k.value && !(e.dropDisabled && e.updateDisabled)), se = n(() => !e.hiddenButtons && (Q.value || G.value || X.value)), F = n(() => e.title.startsWith("__:") ? String(_e(e.title.substring(3))) : e.title), ce = n(() => d.value ? !1 : F.value.length > 0 || !!p["post-title"]), Y = n(() => e.insideModal ? "lkt-modal" : "section"), fe = n(() => Y.value === "lkt-modal" ? {
184
+ const se = n(() => y.value.changed() ? e.editedCloseConfirm : ""), G = n(() => !B.value && _.value ? !0 : !e.hiddenDrop && !o.value && p.value && k.value), Q = n(() => y.value.changed() ? !0 : o.value ? !1 : u.value ? !0 : !e.hiddenSave && p.value && k.value), X = n(() => e.hideSwitchEdition || !B.value && !_.value || !B.value && _.value ? !1 : !o.value && !u.value && k.value && !(e.dropDisabled && e.updateDisabled)), ie = n(() => i["prev-buttons-ever"] ? !0 : !e.hiddenButtons && (Q.value || G.value || X.value)), J = n(() => e.title.startsWith("__:") ? String(_e(e.title.substring(3))) : e.title), ce = n(() => o.value ? !1 : J.value.length > 0 || !!i["post-title"]), Y = n(() => e.insideModal ? "lkt-modal" : "section"), ve = n(() => Y.value === "lkt-modal" ? {
179
185
  "modal-name": e.modalName,
180
186
  "modal-key": e.modalKey,
181
187
  "z-index": e.zIndex,
@@ -184,149 +190,159 @@ const u = (...t) => {
184
190
  "before-close": e.beforeClose,
185
191
  "disabled-close": e.disabledClose,
186
192
  "disabled-veil-click": e.disabledVeilClick,
187
- "close-confirm": ie.value,
193
+ "close-confirm": se.value,
188
194
  "close-confirm-key": e.editedCloseConfirmKey,
189
195
  title: e.title,
190
196
  size: e.size
191
197
  } : {});
192
- return (a, l) => {
193
- const D = J("lkt-button"), w = J("lkt-http-info"), ve = J("lkt-loader");
194
- return c(), N(Ce(Y.value), ke(be(fe.value)), {
198
+ return (t, l) => {
199
+ const D = x("lkt-button"), U = x("lkt-http-info"), fe = x("lkt-loader");
200
+ return s(), T(be(Y.value), Ce(ke(ve.value)), {
195
201
  default: P(() => [
196
202
  Z("article", we, [
197
- !a.insideModal && ce.value ? (c(), B("header", Ee, [
198
- h(p)["pre-title"] ? (c(), B("div", Re, [
199
- R(a.$slots, "pre-title", {
203
+ !t.insideModal && ce.value ? (s(), b("header", Ee, [
204
+ m(i)["pre-title"] ? (s(), b("div", Re, [
205
+ g(t.$slots, "pre-title", {
200
206
  item: r.value,
201
- loading: d.value
207
+ loading: o.value
202
208
  })
203
- ])) : v("", !0),
204
- F.value.length > 0 ? (c(), B("h1", Ue, De(F.value), 1)) : v("", !0),
205
- h(p)["post-title"] ? (c(), B("div", Ne, [
206
- R(a.$slots, "post-title", {
209
+ ])) : f("", !0),
210
+ J.value.length > 0 ? (s(), b("h1", Ue, ye(J.value), 1)) : f("", !0),
211
+ m(i)["post-title"] ? (s(), b("div", Ne, [
212
+ g(t.$slots, "post-title", {
207
213
  item: r.value,
208
- loading: d.value
214
+ loading: o.value
209
215
  })
210
- ])) : v("", !0)
211
- ])) : v("", !0),
212
- V(Z("div", Ve, [
213
- V(ee(D, {
214
- ref: (E) => O.value = E,
216
+ ])) : f("", !0)
217
+ ])) : f("", !0),
218
+ w(Z("div", Ve, [
219
+ m(i)["prev-buttons-ever"] ? w((s(), b("div", Te, [
220
+ g(t.$slots, "prev-buttons-ever")
221
+ ], 512)), [
222
+ [E, !o.value]
223
+ ]) : f("", !0),
224
+ m(i)["prev-buttons"] ? w((s(), b("div", Le, [
225
+ g(t.$slots, "prev-buttons")
226
+ ], 512)), [
227
+ [E, p.value && !o.value]
228
+ ]) : f("", !0),
229
+ w(ee(D, {
230
+ ref: (N) => $.value = N,
215
231
  palette: "success",
216
232
  disabled: !A.value,
217
233
  "confirm-modal": le.value,
218
234
  "confirm-data": oe.value,
219
235
  resource: q.value,
220
236
  "resource-data": ue.value,
221
- text: h(p)["button-save"] ? "" : a.saveText,
222
- icon: h(p)["button-save"] ? "" : a.saveIcon,
237
+ text: m(i)["button-save"] ? "" : t.saveText,
238
+ icon: m(i)["button-save"] ? "" : t.saveIcon,
223
239
  onLoading: H,
224
240
  onLoaded: W,
225
241
  onClick: ne
226
242
  }, {
227
243
  default: P(() => [
228
- h(p)["button-save"] ? R(a.$slots, "button-save", {
244
+ m(i)["button-save"] ? g(t.$slots, "button-save", {
229
245
  key: 0,
230
246
  item: r.value,
231
- editMode: f.value,
232
- isCreate: o.value,
233
- canUpdate: M.value,
234
- canDrop: I.value
235
- }) : v("", !0)
247
+ editMode: p.value,
248
+ isCreate: u.value,
249
+ canUpdate: B.value,
250
+ canDrop: _.value
251
+ }) : f("", !0)
236
252
  ]),
237
253
  _: 3
238
254
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"]), [
239
- [T, Q.value]
255
+ [E, Q.value]
240
256
  ]),
241
- o.value ? v("", !0) : V((c(), N(D, {
242
- key: 0,
243
- ref: (E) => $.value = E,
257
+ u.value ? f("", !0) : w((s(), T(D, {
258
+ key: 2,
259
+ ref: (N) => O.value = N,
244
260
  palette: "danger",
245
- disabled: a.dropDisabled || !I.value,
246
- "confirm-modal": a.dropConfirm,
247
- "confirm-data": a.dropConfirmData,
248
- resource: a.dropResource,
249
- "resource-data": a.dropData,
250
- text: h(p)["button-drop"] ? "" : a.dropText,
251
- icon: h(p)["button-drop"] ? "" : a.dropIcon,
261
+ disabled: t.dropDisabled || !_.value,
262
+ "confirm-modal": t.dropConfirm,
263
+ "confirm-data": t.dropConfirmData,
264
+ resource: t.dropResource,
265
+ "resource-data": t.dropData,
266
+ text: m(i)["button-drop"] ? "" : t.dropText,
267
+ icon: m(i)["button-drop"] ? "" : t.dropIcon,
252
268
  onLoading: H,
253
269
  onLoaded: W,
254
270
  onClick: re
255
271
  }, {
256
272
  default: P(() => [
257
- h(p)["button-drop"] ? R(a.$slots, "button-drop", {
273
+ m(i)["button-drop"] ? g(t.$slots, "button-drop", {
258
274
  key: 0,
259
275
  item: r.value,
260
- editMode: f.value,
261
- isCreate: o.value,
262
- canUpdate: M.value,
263
- canDrop: I.value
264
- }) : v("", !0)
276
+ editMode: p.value,
277
+ isCreate: u.value,
278
+ canUpdate: B.value,
279
+ canDrop: _.value
280
+ }) : f("", !0)
265
281
  ]),
266
282
  _: 3
267
283
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])), [
268
- [T, G.value]
284
+ [E, G.value]
269
285
  ]),
270
- h(p).buttons ? V((c(), B("div", Te, [
271
- R(a.$slots, "buttons")
286
+ m(i).buttons ? w((s(), b("div", $e, [
287
+ g(t.$slots, "buttons")
272
288
  ], 512)), [
273
- [T, f.value]
274
- ]) : v("", !0),
275
- V(ee(D, {
276
- checked: f.value,
277
- "onUpdate:checked": l[0] || (l[0] = (E) => f.value = E),
289
+ [E, p.value && !o.value]
290
+ ]) : f("", !0),
291
+ w(ee(D, {
292
+ checked: p.value,
293
+ "onUpdate:checked": l[0] || (l[0] = (N) => p.value = N),
278
294
  class: "lkt-item-crud--switch-mode-button",
279
295
  "show-switch": "",
280
- text: a.editModeText
296
+ text: t.editModeText
281
297
  }, null, 8, ["checked", "text"]), [
282
- [T, X.value]
298
+ [E, X.value]
283
299
  ])
284
300
  ], 512), [
285
- [T, se.value]
301
+ [E, ie.value]
286
302
  ]),
287
- d.value ? v("", !0) : (c(), B("div", Le, [
288
- k.value ? (c(), B("div", Oe, [
289
- g.value ? (c(), N(w, {
303
+ o.value ? f("", !0) : (s(), b("div", Oe, [
304
+ k.value ? (s(), b("div", ze, [
305
+ I.value ? (s(), T(U, {
290
306
  key: 0,
291
- code: m.value,
307
+ code: h.value,
292
308
  quick: "",
293
- palette: m.value === 200 ? "success" : "danger",
309
+ palette: h.value === 200 ? "success" : "danger",
294
310
  "can-close": "",
295
- onClose: l[1] || (l[1] = (E) => g.value = !1)
296
- }, null, 8, ["code", "palette"])) : v("", !0),
297
- R(a.$slots, "item", {
311
+ onClose: l[1] || (l[1] = (N) => I.value = !1)
312
+ }, null, 8, ["code", "palette"])) : f("", !0),
313
+ g(t.$slots, "item", {
298
314
  item: r.value,
299
- loading: d.value,
300
- editMode: f.value,
301
- isCreate: o.value,
302
- canUpdate: M.value,
303
- canDrop: I.value,
304
- itemBeingEdited: x.value
315
+ loading: o.value,
316
+ editMode: p.value,
317
+ isCreate: u.value,
318
+ canUpdate: B.value,
319
+ canDrop: _.value,
320
+ itemBeingEdited: F.value
305
321
  })
306
- ])) : (c(), N(w, {
322
+ ])) : (s(), T(U, {
307
323
  key: 1,
308
- code: m.value
324
+ code: h.value
309
325
  }, null, 8, ["code"]))
310
326
  ])),
311
- d.value ? (c(), N(ve, { key: 2 })) : v("", !0)
327
+ o.value ? (s(), T(fe, { key: 2 })) : f("", !0)
312
328
  ])
313
329
  ]),
314
330
  _: 3
315
331
  }, 16);
316
332
  };
317
333
  }
318
- }), Ae = {
319
- install: (t, C = {}) => {
320
- t.component("lkt-item-crud") === void 0 && t.component("lkt-item-crud", $e);
334
+ }), We = {
335
+ install: (a, C = {}) => {
336
+ a.component("lkt-item-crud") === void 0 && a.component("lkt-item-crud", Ke);
321
337
  }
322
- }, He = (t) => {
323
- S.defaultSaveIcon = t;
324
- }, We = (t) => {
325
- S.defaultDropIcon = t;
338
+ }, Ge = (a) => {
339
+ M.defaultSaveIcon = a;
340
+ }, Qe = (a) => {
341
+ M.defaultDropIcon = a;
326
342
  };
327
343
  export {
328
- qe as debugLktItemCrud,
329
- Ae as default,
330
- We as setItemCrudDefaultDropIcon,
331
- He as setItemCrudDefaultSaveIcon
344
+ He as debugLktItemCrud,
345
+ We as default,
346
+ Qe as setItemCrudDefaultDropIcon,
347
+ Ge as setItemCrudDefaultSaveIcon
332
348
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -382,6 +382,7 @@
382
382
  && !(props.dropDisabled && props.updateDisabled);
383
383
  }),
384
384
  showButtons = computed(() => {
385
+ if (slots['prev-buttons-ever']) return true;
385
386
  return !props.hiddenButtons && (showSaveButton.value || showDropButton.value || showSwitchButton.value);
386
387
  }),
387
388
  computedTitle = computed(() => {
@@ -436,6 +437,15 @@
436
437
  </div>
437
438
  </header>
438
439
  <div class="lkt-item-crud-buttons" v-show="showButtons">
440
+
441
+ <div class="lkt-item-crud-buttons" v-if="slots['prev-buttons-ever']" v-show="!isLoading">
442
+ <slot name="prev-buttons-ever"/>
443
+ </div>
444
+
445
+ <div class="lkt-item-crud-buttons" v-if="slots['prev-buttons']" v-show="editMode && !isLoading">
446
+ <slot name="prev-buttons"/>
447
+ </div>
448
+
439
449
  <lkt-button
440
450
  :ref="(el:any) => saveButton = el"
441
451
  v-show="showSaveButton"
@@ -479,7 +489,7 @@
479
489
  :can-drop="canDrop"></slot>
480
490
  </lkt-button>
481
491
 
482
- <div class="lkt-item-crud-buttons" v-if="slots.buttons" v-show="editMode">
492
+ <div class="lkt-item-crud-buttons" v-if="slots.buttons" v-show="editMode && !isLoading">
483
493
  <slot name="buttons"/>
484
494
  </div>
485
495