lkt-item-crud 1.1.24 → 1.1.26

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,5 @@
1
- declare function $e(l?: boolean): void;
2
- declare namespace Fe {
3
- function install(l: any, p?: {}): void;
1
+ declare function Te(l?: boolean): void;
2
+ declare namespace $e {
3
+ function install(l: any, h?: {}): void;
4
4
  }
5
- export { $e as debugLktItemCrud, Fe as default };
5
+ export { Te as debugLktItemCrud, $e as default };
package/dist/build.js CHANGED
@@ -1,48 +1,56 @@
1
- import { defineComponent as ve, useSlots as fe, ref as s, computed as i, watch as h, nextTick as pe, resolveComponent as I, openBlock as f, createElementBlock as M, createElementVNode as K, toDisplayString as j, renderSlot as V, createCommentVNode as w, withDirectives as N, createBlock as L, withCtx as Y, unref as Z, vShow as O, createVNode as ee } from "vue";
1
+ import { defineComponent as ce, useSlots as ve, ref as i, computed as s, watch as b, nextTick as fe, resolveComponent as L, openBlock as f, createElementBlock as w, unref as C, renderSlot as U, createCommentVNode as m, createElementVNode as X, toDisplayString as pe, withDirectives as O, createBlock as T, withCtx as Y, vShow as $, createVNode as Z } from "vue";
2
2
  import { httpCall as me } from "lkt-http-client";
3
- import { DataState as ae } from "lkt-data-state";
4
- import { execModal as he, refreshModal as ke, closeModal as Ce, openModal as be, reOpenModal as De } from "lkt-modal";
5
- const H = class H {
3
+ import { DataState as ee } from "lkt-data-state";
4
+ import { execModal as he, refreshModal as ke, closeModal as be, openModal as Ce, reOpenModal as De } from "lkt-modal";
5
+ const q = class q {
6
6
  };
7
- H.debugEnabled = !1;
8
- let T = H;
7
+ q.debugEnabled = !1;
8
+ let F = q;
9
9
  const u = (...l) => {
10
- T.debugEnabled && console.info("[LktItemCrud] ", ...l);
11
- }, $e = (l = !0) => {
12
- T.debugEnabled = l;
13
- }, q = (l) => {
10
+ F.debugEnabled && console.info("[LktItemCrud] ", ...l);
11
+ }, Te = (l = !0) => {
12
+ F.debugEnabled = l;
13
+ }, j = (l) => {
14
14
  u("runModalCallback -> init", l);
15
- let p = l.modalKey ? l.modalKey : "_", S = l.args ? l.args : {};
15
+ let h = l.modalKey ? l.modalKey : "_", M = l.args ? l.args : {};
16
16
  switch (l.action) {
17
17
  case "reOpen":
18
- return De(l.modalName, p, S);
18
+ return De(l.modalName, h, M);
19
19
  case "open":
20
- return be(l.modalName, p, S);
20
+ return Ce(l.modalName, h, M);
21
21
  case "close":
22
- return Ce(l.modalName, p);
22
+ return be(l.modalName, h);
23
23
  case "refresh":
24
- return ke(l.modalName, p, S);
24
+ return ke(l.modalName, h, M);
25
25
  case "exec":
26
26
  let e = l.method;
27
- return e ? he(l.modalName, p, e, S) : void 0;
27
+ return e ? he(l.modalName, h, e, M) : void 0;
28
28
  }
29
29
  }, Se = { class: "lkt-item-crud" }, ye = {
30
30
  key: 0,
31
31
  class: "lkt-item-crud_header"
32
- }, ge = { class: "lkt-item-crud_header-title" }, Me = { class: "lkt-item-crud_header-slot" }, _e = { class: "lkt-item-crud-buttons" }, Be = { key: 1 }, we = { key: 1 }, Ee = {
32
+ }, ge = {
33
+ key: 0,
34
+ class: "lkt-item-crud_header-slot"
35
+ }, Me = { class: "lkt-item-crud_header-title" }, Be = {
36
+ key: 1,
37
+ class: "lkt-item-crud_header-slot"
38
+ }, _e = { class: "lkt-item-crud-buttons" }, we = {
33
39
  key: 1,
34
40
  class: "lkt-item-crud_content"
35
- }, Ue = {
41
+ }, Ie = {
36
42
  key: 0,
37
43
  class: "lkt-grid-1"
38
- }, Re = /* @__PURE__ */ ve({
44
+ }, Ee = /* @__PURE__ */ ce({
39
45
  __name: "LktItemCrud",
40
46
  props: {
41
47
  modelValue: { default: () => ({}) },
42
48
  title: { default: "" },
43
49
  editModeText: { default: "Edition Mode" },
44
50
  saveText: { default: "Save" },
51
+ saveIcon: {},
45
52
  dropText: { default: "Delete" },
53
+ dropIcon: {},
46
54
  hiddenSave: { type: Boolean, default: !1 },
47
55
  hiddenDrop: { type: Boolean, default: !1 },
48
56
  hiddenButtons: { type: Boolean, default: !1 },
@@ -77,188 +85,198 @@ const u = (...l) => {
77
85
  editing: { type: Boolean, default: !1 }
78
86
  },
79
87
  emits: ["update:modelValue", "update:isCreate", "update:editing", "read", "create", "update", "drop", "before-save", "perms", "error", "modified-data"],
80
- setup(l, { expose: p, emit: S }) {
81
- const e = l, $ = fe(), n = S;
82
- let te = [];
83
- const d = s(!0), r = s(e.modelValue), _ = s(te), c = s(e.editing), m = s(!1), k = s(!1), v = s(200), E = s(null), U = s(null), y = s(new ae(r.value, e.dataStateConfig)), F = s(new ae(e.readData)), o = s(e.isCreate), J = s(!1), le = i(() => o.value ? e.createConfirm : e.updateConfirm), oe = i(() => o.value ? e.createConfirmData : e.updateConfirmData), P = i(() => o.value ? e.createResource : e.updateResource), ue = i(() => o.value ? { ...e.createData, ...JSON.parse(JSON.stringify(r.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(r.value)) }), de = i(() => o.value ? e.createDisabled : e.updateDisabled), C = i(() => !o.value && _.value.includes("update")), b = i(() => !o.value && _.value.includes("drop")), R = async () => {
84
- u("fetchItem"), d.value = !0, v.value = -1, k.value = !1;
88
+ setup(l, { expose: h, emit: M }) {
89
+ const e = l, p = ve(), n = M;
90
+ let ae = [];
91
+ const d = i(!0), r = i(e.modelValue), I = i(ae), c = i(e.editing), k = i(!1), D = i(!1), v = i(200), R = i(null), V = i(null), B = i(new ee(r.value, e.dataStateConfig)), J = i(new ee(e.readData)), o = i(e.isCreate), K = i(!1), te = s(() => o.value ? e.createConfirm : e.updateConfirm), le = s(() => o.value ? e.createConfirmData : e.updateConfirmData), x = s(() => o.value ? e.createResource : e.updateResource), oe = s(() => o.value ? { ...e.createData, ...JSON.parse(JSON.stringify(r.value)) } : { ...e.updateData, ...JSON.parse(JSON.stringify(r.value)) }), ue = s(() => o.value ? e.createDisabled : e.updateDisabled), S = s(() => !o.value && I.value.includes("update")), y = s(() => !o.value && I.value.includes("drop")), N = async () => {
92
+ u("fetchItem"), d.value = !0, v.value = -1, D.value = !1;
85
93
  try {
86
94
  const a = await me(e.readResource, e.readData);
87
95
  if (u("fetchItem -> response", a), d.value = !1, v.value = a.httpStatus, !a.success) {
88
- m.value = !1, v.value = a.httpStatus, n("error", a.httpStatus);
96
+ k.value = !1, v.value = a.httpStatus, n("error", a.httpStatus);
89
97
  return;
90
98
  }
91
- m.value = !0, r.value = a.data, _.value = a.perms, y.value.increment(r.value).turnStoredIntoOriginal(), F.value.turnStoredIntoOriginal(), n("read", a);
99
+ k.value = !0, r.value = a.data, I.value = a.perms, B.value.increment(r.value).turnStoredIntoOriginal(), J.value.turnStoredIntoOriginal(), n("read", a);
92
100
  } catch {
93
- d.value = !1, m.value = !1, v.value = 404, n("error", 404);
101
+ d.value = !1, k.value = !1, v.value = 404, n("error", 404);
94
102
  return;
95
103
  }
96
- }, re = i(() => d.value ? !1 : e.title || !!$["post-title"]);
97
- h(() => e.modelValue, (a) => {
98
- r.value = a, y.value.increment(a);
99
- }, { deep: !0 }), h(r, (a) => {
100
- if (J.value = !0, u("item updated ->", r.value), typeof e.beforeEmitUpdate == "function") {
104
+ }, de = s(() => d.value ? !1 : e.title || !!p["post-title"]);
105
+ b(() => e.modelValue, (a) => {
106
+ r.value = a, B.value.increment(a);
107
+ }, { deep: !0 }), b(r, (a) => {
108
+ if (K.value = !0, u("item updated ->", r.value), typeof e.beforeEmitUpdate == "function") {
101
109
  u("item updated -> has beforeEmitUpdate");
102
110
  let t = e.beforeEmitUpdate(r.value);
103
111
  u("item updated -> override with: ", t), typeof t == "object" && (r.value = t);
104
112
  }
105
- n("update:modelValue", r.value), u("item updated -> update dataState"), y.value.increment(a), pe(() => J.value = !1);
106
- }, { deep: !0 }), h(_, () => n("perms", _.value));
107
- const x = i(() => de.value || !o.value && !C.value || typeof e.saveValidator == "function" && !e.saveValidator(r.value) ? !1 : y.value.changed());
108
- h(x, (a) => n("modified-data", a)), h(o, (a) => n("update:isCreate", a)), h(() => e.readData, (a) => {
109
- F.value.increment(a), F.value.changed() && R();
110
- }), h(() => e.editing, (a) => {
113
+ n("update:modelValue", r.value), u("item updated -> update dataState"), B.value.increment(a), fe(() => K.value = !1);
114
+ }, { deep: !0 }), b(I, () => n("perms", I.value));
115
+ const H = s(() => ue.value || !o.value && !S.value || typeof e.saveValidator == "function" && !e.saveValidator(r.value) ? !1 : B.value.changed());
116
+ b(H, (a) => n("modified-data", a)), b(o, (a) => n("update:isCreate", a)), b(() => e.readData, (a) => {
117
+ J.value.increment(a), J.value.changed() && N();
118
+ }), b(() => e.editing, (a) => {
111
119
  u("editing updated -> updating editMode", a), c.value = a;
112
- }), h(c, (a) => {
120
+ }), b(c, (a) => {
113
121
  u("editMode updated -> emit update", a), n("update:editing", a);
114
- }), e.readResource && !o.value ? R() : o.value && (m.value = !0, c.value = !0, d.value = !1);
115
- const ne = (a, t) => {
122
+ }), e.readResource && !o.value ? N() : o.value && (k.value = !0, c.value = !0, d.value = !1);
123
+ const re = (a, t) => {
116
124
  if (d.value = !1, v.value = t.httpStatus, !t.success) {
117
- k.value = !0, n("error", t.httpStatus);
125
+ D.value = !0, n("error", t.httpStatus);
118
126
  return;
119
127
  }
120
- k.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((D) => {
121
- q(D);
128
+ D.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((g) => {
129
+ j(g);
122
130
  })), n("drop", t);
123
- }, se = (a, t) => {
124
- if (u("onSave -> received response:", t), n("before-save"), P.value) {
131
+ }, ne = (a, t) => {
132
+ if (u("onSave -> received response:", t), n("before-save"), x.value) {
125
133
  if (d.value = !1, v.value = t.httpStatus, !t.success) {
126
- k.value = !0, n("error", t.httpStatus);
134
+ D.value = !0, n("error", t.httpStatus);
127
135
  return;
128
136
  }
129
- k.value = !0;
137
+ D.value = !0;
130
138
  }
131
- let D = o.value ? "create" : "update";
132
- o.value || (u("onSave -> turn stored data into original"), y.value.turnStoredIntoOriginal()), D === "create" ? typeof e.onCreate == "function" && (u("onSave -> trigger onCreate callback"), e.onCreate(t), e.onCreateModalCallbacks.length > 0 && (u("onSave -> has onCreateModalCallbacks"), e.onCreateModalCallbacks.forEach((B) => {
133
- q(B);
134
- }))) : typeof e.onUpdate == "function" && (u("onSave -> trigger onUpdate callback"), e.onUpdate(t), e.onUpdateModalCallbacks.length > 0 && (u("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((B) => {
135
- q(B);
136
- }))), !e.insideModal && t.autoReloadId && (u("onSave -> autoReloadId detected: ", t.autoReloadId), e.readData.id = t.autoReloadId, u("onSave -> turning off create mode"), o.value = !1, R()), n(D, t);
137
- }, z = () => {
139
+ let g = o.value ? "create" : "update";
140
+ o.value || (u("onSave -> turn stored data into original"), B.value.turnStoredIntoOriginal()), g === "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) => {
141
+ j(E);
142
+ }))) : typeof e.onUpdate == "function" && (u("onSave -> trigger onUpdate callback"), e.onUpdate(t), e.onUpdateModalCallbacks.length > 0 && (u("onSave -> has onUpdateModalCallbacks"), e.onUpdateModalCallbacks.forEach((E) => {
143
+ j(E);
144
+ }))), !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()), n(g, t);
145
+ }, P = () => {
138
146
  d.value = !0, v.value = -1;
139
- }, A = () => {
147
+ }, z = () => {
140
148
  d.value = !1;
141
149
  };
142
- p({
150
+ h({
143
151
  doDrop: () => {
144
- U.value && typeof U.value.click == "function" && U.value.click();
152
+ V.value && typeof V.value.click == "function" && V.value.click();
145
153
  },
146
- doRefresh: R,
154
+ doRefresh: N,
147
155
  doSave: () => {
148
- E.value && typeof E.value.click == "function" && E.value.click();
156
+ R.value && typeof R.value.click == "function" && R.value.click();
149
157
  }
150
158
  });
151
- const G = i(() => !C.value && b.value ? !0 : !e.hiddenDrop && !d.value && c.value && m.value), Q = i(() => y.value.changed() ? !0 : d.value ? !1 : o.value ? !0 : !e.hiddenSave && c.value && m.value), W = i(() => e.hideSwitchEdition || !C.value && !b.value || !C.value && b.value ? !1 : !d.value && !o.value && m.value && !(e.dropDisabled && e.updateDisabled)), ie = i(() => !e.hiddenButtons && (Q.value || G.value || W.value));
159
+ const A = s(() => !S.value && y.value ? !0 : !e.hiddenDrop && !d.value && c.value && k.value), G = s(() => B.value.changed() ? !0 : d.value ? !1 : o.value ? !0 : !e.hiddenSave && c.value && k.value), Q = s(() => e.hideSwitchEdition || !S.value && !y.value || !S.value && y.value ? !1 : !d.value && !o.value && k.value && !(e.dropDisabled && e.updateDisabled)), ie = s(() => !e.hiddenButtons && (G.value || A.value || Q.value));
152
160
  return (a, t) => {
153
- const D = I("lkt-button"), B = I("lkt-field-switch"), X = I("lkt-http-info"), ce = I("lkt-loader");
154
- return f(), M("article", Se, [
155
- re.value ? (f(), M("header", ye, [
156
- K("h1", ge, j(a.title), 1),
157
- K("div", Me, [
158
- V(a.$slots, "post-title", {
161
+ const g = L("lkt-button"), E = L("lkt-field-switch"), W = L("lkt-http-info"), se = L("lkt-loader");
162
+ return f(), w("article", Se, [
163
+ de.value ? (f(), w("header", ye, [
164
+ C(p)["pre-title"] ? (f(), w("div", ge, [
165
+ U(a.$slots, "pre-title", {
159
166
  item: r.value,
160
167
  loading: d.value
161
168
  })
162
- ])
163
- ])) : w("", !0),
164
- N(K("div", _e, [
165
- o.value ? w("", !0) : N((f(), L(D, {
169
+ ])) : m("", !0),
170
+ X("h1", Me, pe(a.title), 1),
171
+ C(p)["post-title"] ? (f(), w("div", Be, [
172
+ U(a.$slots, "post-title", {
173
+ item: r.value,
174
+ loading: d.value
175
+ })
176
+ ])) : m("", !0)
177
+ ])) : m("", !0),
178
+ O(X("div", _e, [
179
+ o.value ? m("", !0) : O((f(), T(g, {
166
180
  key: 0,
167
- ref: (g) => U.value = g,
181
+ ref: (_) => V.value = _,
168
182
  palette: "danger",
169
- disabled: a.dropDisabled || !b.value,
183
+ disabled: a.dropDisabled || !y.value,
170
184
  "confirm-modal": a.dropConfirm,
171
185
  "confirm-data": a.dropConfirmData,
172
186
  resource: a.dropResource,
173
187
  "resource-data": a.dropData,
174
- onLoading: z,
175
- onLoaded: A,
176
- onClick: ne
188
+ text: C(p)["button-drop"] ? "" : a.dropText,
189
+ icon: C(p)["button-drop"] ? "" : a.dropIcon,
190
+ onLoading: P,
191
+ onLoaded: z,
192
+ onClick: re
177
193
  }, {
178
194
  default: Y(() => [
179
- Z($)["button-drop"] ? V(a.$slots, "button-drop", {
195
+ C(p)["button-drop"] ? U(a.$slots, "button-drop", {
180
196
  key: 0,
181
197
  item: r.value,
182
198
  editMode: c.value,
183
199
  isCreate: o.value,
184
- canUpdate: C.value,
185
- canDrop: b.value
186
- }) : (f(), M("span", Be, j(a.dropText), 1))
200
+ canUpdate: S.value,
201
+ canDrop: y.value
202
+ }) : m("", !0)
187
203
  ]),
188
204
  _: 3
189
- }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"])), [
190
- [O, G.value]
205
+ }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])), [
206
+ [$, A.value]
191
207
  ]),
192
- N(ee(D, {
193
- ref: (g) => E.value = g,
208
+ O(Z(g, {
209
+ ref: (_) => R.value = _,
194
210
  palette: "success",
195
- disabled: !x.value,
196
- "confirm-modal": le.value,
197
- "confirm-data": oe.value,
198
- resource: P.value,
199
- "resource-data": ue.value,
200
- onLoading: z,
201
- onLoaded: A,
202
- onClick: se
211
+ disabled: !H.value,
212
+ "confirm-modal": te.value,
213
+ "confirm-data": le.value,
214
+ resource: x.value,
215
+ "resource-data": oe.value,
216
+ text: C(p)["button-save"] ? "" : a.saveText,
217
+ icon: C(p)["button-save"] ? "" : a.saveIcon,
218
+ onLoading: P,
219
+ onLoaded: z,
220
+ onClick: ne
203
221
  }, {
204
222
  default: Y(() => [
205
- Z($)["button-save"] ? V(a.$slots, "button-save", {
223
+ C(p)["button-save"] ? U(a.$slots, "button-save", {
206
224
  key: 0,
207
225
  item: r.value,
208
226
  editMode: c.value,
209
227
  isCreate: o.value,
210
- canUpdate: C.value,
211
- canDrop: b.value
212
- }) : (f(), M("span", we, j(a.saveText), 1))
228
+ canUpdate: S.value,
229
+ canDrop: y.value
230
+ }) : m("", !0)
213
231
  ]),
214
232
  _: 3
215
- }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data"]), [
216
- [O, Q.value]
233
+ }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"]), [
234
+ [$, G.value]
217
235
  ]),
218
- N(ee(B, {
236
+ O(Z(E, {
219
237
  modelValue: c.value,
220
- "onUpdate:modelValue": t[0] || (t[0] = (g) => c.value = g),
238
+ "onUpdate:modelValue": t[0] || (t[0] = (_) => c.value = _),
221
239
  label: a.editModeText
222
240
  }, null, 8, ["modelValue", "label"]), [
223
- [O, W.value]
241
+ [$, Q.value]
224
242
  ])
225
243
  ], 512), [
226
- [O, ie.value]
244
+ [$, ie.value]
227
245
  ]),
228
- d.value ? w("", !0) : (f(), M("div", Ee, [
229
- m.value ? (f(), M("div", Ue, [
230
- k.value ? (f(), L(X, {
246
+ d.value ? m("", !0) : (f(), w("div", we, [
247
+ k.value ? (f(), w("div", Ie, [
248
+ D.value ? (f(), T(W, {
231
249
  key: 0,
232
250
  code: v.value,
233
251
  quick: "",
234
252
  palette: v.value === 200 ? "success" : "danger",
235
253
  "can-close": "",
236
- onClose: t[1] || (t[1] = (g) => k.value = !1)
237
- }, null, 8, ["code", "palette"])) : w("", !0),
238
- V(a.$slots, "item", {
254
+ onClose: t[1] || (t[1] = (_) => D.value = !1)
255
+ }, null, 8, ["code", "palette"])) : m("", !0),
256
+ U(a.$slots, "item", {
239
257
  item: r.value,
240
258
  loading: d.value,
241
259
  editMode: c.value,
242
260
  isCreate: o.value,
243
- canUpdate: C.value,
244
- canDrop: b.value,
245
- itemBeingEdited: J.value
261
+ canUpdate: S.value,
262
+ canDrop: y.value,
263
+ itemBeingEdited: K.value
246
264
  })
247
- ])) : (f(), L(X, {
265
+ ])) : (f(), T(W, {
248
266
  key: 1,
249
267
  code: v.value
250
268
  }, null, 8, ["code"]))
251
269
  ])),
252
- d.value ? (f(), L(ce, { key: 2 })) : w("", !0)
270
+ d.value ? (f(), T(se, { key: 2 })) : m("", !0)
253
271
  ]);
254
272
  };
255
273
  }
256
- }), Fe = {
257
- install: (l, p = {}) => {
258
- l.component("lkt-item-crud") === void 0 && l.component("lkt-item-crud", Re);
274
+ }), $e = {
275
+ install: (l, h = {}) => {
276
+ l.component("lkt-item-crud") === void 0 && l.component("lkt-item-crud", Ee);
259
277
  }
260
278
  };
261
279
  export {
262
- $e as debugLktItemCrud,
263
- Fe as default
280
+ Te as debugLktItemCrud,
281
+ $e as default
264
282
  };
@@ -5,7 +5,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
5
5
  title: string;
6
6
  editModeText: string;
7
7
  saveText: string;
8
+ saveIcon: string;
8
9
  dropText: string;
10
+ dropIcon: string;
9
11
  hiddenSave: boolean;
10
12
  hiddenDrop: boolean;
11
13
  hiddenButtons: boolean;
@@ -97,7 +99,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
97
99
  title: string;
98
100
  editModeText: string;
99
101
  saveText: string;
102
+ saveIcon: string;
100
103
  dropText: string;
104
+ dropIcon: string;
101
105
  hiddenSave: boolean;
102
106
  hiddenDrop: boolean;
103
107
  hiddenButtons: boolean;
@@ -219,6 +223,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
219
223
  onDropModalCallbacks: ModalCallbackConfig[];
220
224
  editing: boolean;
221
225
  }, {}>, {
226
+ "pre-title"?(_: {
227
+ item: LktObject;
228
+ loading: boolean;
229
+ }): any;
222
230
  "post-title"?(_: {
223
231
  item: LktObject;
224
232
  loading: boolean;
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .lkt-item-crud{display:flex;flex-direction:column;gap:var(--gap)}.lkt-item-crud_content{display:flex;flex-direction:column;gap:15px}.lkt-item-crud-buttons{position:sticky;top:calc(-1 * var(--gap));display:flex;align-items:center;gap:var(--gap);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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -12,7 +12,9 @@ const props = withDefaults(defineProps<{
12
12
  title: string
13
13
  editModeText: string
14
14
  saveText: string
15
+ saveIcon: string
15
16
  dropText: string
17
+ dropIcon: string
16
18
  hiddenSave: boolean
17
19
  hiddenDrop: boolean
18
20
  hiddenButtons: boolean
@@ -354,8 +356,11 @@ const showDropButton = computed(() => {
354
356
  <template>
355
357
  <article class="lkt-item-crud">
356
358
  <header class="lkt-item-crud_header" v-if="displayHeader">
359
+ <div class="lkt-item-crud_header-slot" v-if="slots['pre-title']">
360
+ <slot name="pre-title" v-bind:item="item" v-bind:loading="isLoading"></slot>
361
+ </div>
357
362
  <h1 class="lkt-item-crud_header-title">{{ title }}</h1>
358
- <div class="lkt-item-crud_header-slot">
363
+ <div class="lkt-item-crud_header-slot" v-if="slots['post-title']">
359
364
  <slot name="post-title" v-bind:item="item" v-bind:loading="isLoading"></slot>
360
365
  </div>
361
366
  </header>
@@ -370,6 +375,8 @@ const showDropButton = computed(() => {
370
375
  v-bind:confirm-data="dropConfirmData"
371
376
  v-bind:resource="dropResource"
372
377
  v-bind:resource-data="dropData"
378
+ :text="slots['button-drop'] ? '' : dropText"
379
+ :icon="slots['button-drop'] ? '' : dropIcon"
373
380
  v-on:loading="onButtonLoading"
374
381
  v-on:loaded="onButtonLoaded"
375
382
  v-on:click="onDrop">
@@ -378,7 +385,6 @@ const showDropButton = computed(() => {
378
385
  v-bind:is-create="createMode"
379
386
  v-bind:can-update="canUpdate"
380
387
  v-bind:can-drop="canDrop"></slot>
381
- <span v-else>{{ dropText }}</span>
382
388
  </lkt-button>
383
389
 
384
390
  <lkt-button
@@ -390,6 +396,8 @@ const showDropButton = computed(() => {
390
396
  v-bind:confirm-data="confirmData"
391
397
  v-bind:resource="saveResource"
392
398
  v-bind:resource-data="saveData"
399
+ :text="slots['button-save'] ? '' : saveText"
400
+ :icon="slots['button-save'] ? '' : saveIcon"
393
401
  v-on:loading="onButtonLoading"
394
402
  v-on:loaded="onButtonLoaded"
395
403
  v-on:click="onSave">
@@ -398,7 +406,6 @@ const showDropButton = computed(() => {
398
406
  v-bind:is-create="createMode"
399
407
  v-bind:can-update="canUpdate"
400
408
  v-bind:can-drop="canDrop"></slot>
401
- <span v-else>{{ saveText }}</span>
402
409
  </lkt-button>
403
410
 
404
411
  <lkt-field-switch