lkt-item-crud 1.1.28 → 1.2.0

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