lkt-item-crud 1.1.29 → 1.2.1

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