lkt-item-crud 1.2.0 → 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 qe {
1
+ declare function qe(t?: boolean): void;
2
+ declare namespace Ae {
3
3
  function install(t: any, C?: {}): void;
4
4
  }
5
- declare function Pe(t: any): void;
5
+ declare function We(t: any): void;
6
6
  declare function He(t: any): void;
7
- export { je as debugLktItemCrud, qe as default, Pe as setItemCrudDefaultDropIcon, He as setItemCrudDefaultSaveIcon };
7
+ export { qe as debugLktItemCrud, Ae as default, We as setItemCrudDefaultDropIcon, He as setItemCrudDefaultSaveIcon };
package/dist/build.js CHANGED
@@ -1,54 +1,54 @@
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
- import { DataState as ee } from "lkt-data-state";
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";
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
6
  const L = class L {
7
7
  };
8
8
  L.debugEnabled = !1, L.defaultSaveIcon = "", L.defaultDropIcon = "";
9
9
  let S = L;
10
- const d = (...t) => {
10
+ const u = (...t) => {
11
11
  S.debugEnabled && console.info("[LktItemCrud] ", ...t);
12
- }, je = (t = !0) => {
12
+ }, qe = (t = !0) => {
13
13
  S.debugEnabled = t;
14
- }, H = (t) => {
15
- d("runModalCallback -> init", t);
16
- let C = t.modalKey ? t.modalKey : "_", w = t.args ? t.args : {};
14
+ }, j = (t) => {
15
+ u("runModalCallback -> init", t);
16
+ let C = t.modalKey ? t.modalKey : "_", _ = t.args ? t.args : {};
17
17
  switch (t.action) {
18
18
  case "reOpen":
19
- return ge(t.modalName, C, w);
19
+ return Be(t.modalName, C, _);
20
20
  case "open":
21
- return Se(t.modalName, C, w);
21
+ return Ie(t.modalName, C, _);
22
22
  case "close":
23
- return De(t.modalName, C);
23
+ return Me(t.modalName, C);
24
24
  case "refresh":
25
- return ye(t.modalName, C, w);
25
+ return ge(t.modalName, C, _);
26
26
  case "exec":
27
- let a = t.method;
28
- return a ? ke(t.modalName, C, a, w) : void 0;
27
+ let e = t.method;
28
+ return e ? Se(t.modalName, C, e, _) : void 0;
29
29
  }
30
- }, Ie = { class: "lkt-item-crud" }, Be = {
30
+ }, we = { class: "lkt-item-crud" }, Ee = {
31
31
  key: 0,
32
32
  class: "lkt-item-crud_header"
33
- }, we = {
33
+ }, Re = {
34
34
  key: 0,
35
35
  class: "lkt-item-crud_header-slot"
36
- }, Ee = {
36
+ }, Ue = {
37
37
  key: 1,
38
38
  class: "lkt-item-crud_header-title"
39
- }, Ue = {
39
+ }, Ne = {
40
40
  key: 2,
41
41
  class: "lkt-item-crud_header-slot"
42
- }, Re = { class: "lkt-item-crud-buttons" }, Ne = {
42
+ }, Ve = { class: "lkt-item-crud-buttons" }, Te = {
43
43
  key: 1,
44
44
  class: "lkt-item-crud-buttons"
45
- }, _e = {
45
+ }, Le = {
46
46
  key: 1,
47
47
  class: "lkt-item-crud_content"
48
- }, Ve = {
48
+ }, Oe = {
49
49
  key: 0,
50
50
  class: "lkt-grid-1"
51
- }, Te = /* @__PURE__ */ ve({
51
+ }, $e = /* @__PURE__ */ pe({
52
52
  __name: "LktItemCrud",
53
53
  props: {
54
54
  modelValue: { default: () => ({}) },
@@ -103,67 +103,67 @@ const d = (...t) => {
103
103
  beforeClose: { type: Function, default: void 0 }
104
104
  },
105
105
  emits: ["update:modelValue", "update:isCreate", "update:editing", "read", "create", "update", "drop", "before-save", "perms", "error", "modified-data"],
106
- setup(t, { expose: C, emit: w }) {
107
- const a = t, p = pe(), i = w;
108
- let ae = [];
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;
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;
111
111
  try {
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);
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);
115
115
  return;
116
116
  }
117
- b.value = !0, r.value = e.data, N.value = e.perms, k.value.increment(r.value).turnStoredIntoOriginal(), K.value.turnStoredIntoOriginal(), i("read", e);
117
+ k.value = !0, r.value = a.data, U.value = a.perms, b.value.increment(r.value).turnStoredIntoOriginal(), K.value.turnStoredIntoOriginal(), i("read", a);
118
118
  } catch {
119
- u.value = !1, b.value = !1, m.value = 404, i("error", 404);
119
+ d.value = !1, k.value = !1, m.value = 404, i("error", 404);
120
120
  return;
121
121
  }
122
122
  };
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);
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");
128
+ let l = e.beforeEmitUpdate(r.value);
129
+ u("item updated -> override with: ", l), typeof l == "object" && (r.value = l);
130
130
  }
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) {
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
143
  g.value = !0, i("error", l.httpStatus);
144
144
  return;
145
145
  }
146
- g.value = !0, a.onDropModalCallbacks.length > 0 && (d("onDrop -> has onDropModalCallbacks"), a.onDropModalCallbacks.forEach((y) => {
147
- H(y);
146
+ g.value = !0, e.onDropModalCallbacks.length > 0 && (u("onDrop -> has onDropModalCallbacks"), e.onDropModalCallbacks.forEach((D) => {
147
+ j(D);
148
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) {
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
152
  g.value = !0, i("error", l.httpStatus);
153
153
  return;
154
154
  }
155
155
  g.value = !0;
156
156
  }
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;
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;
165
+ }, W = () => {
166
+ d.value = !1;
167
167
  };
168
168
  C({
169
169
  doDrop: () => {
@@ -173,59 +173,59 @@ const d = (...t) => {
173
173
  doSave: () => {
174
174
  O.value && typeof O.value.click == "function" && O.value.click();
175
175
  },
176
- hasModifiedData: () => k.value.changed()
176
+ hasModifiedData: () => b.value.changed()
177
177
  });
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", {
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
+ } : {});
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)), {
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
200
  item: r.value,
201
- loading: u.value
201
+ loading: d.value
202
202
  })
203
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", {
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
207
  item: r.value,
208
- loading: u.value
208
+ loading: d.value
209
209
  })
210
210
  ])) : v("", !0)
211
211
  ])) : v("", !0),
212
- V(Z("div", Re, [
213
- V(x(y, {
214
- ref: (U) => O.value = U,
212
+ V(Z("div", Ve, [
213
+ V(ee(D, {
214
+ ref: (E) => O.value = E,
215
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
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
226
  }, {
227
- default: q(() => [
228
- h(p)["button-save"] ? R(e.$slots, "button-save", {
227
+ default: P(() => [
228
+ h(p)["button-save"] ? R(a.$slots, "button-save", {
229
229
  key: 0,
230
230
  item: r.value,
231
231
  editMode: f.value,
@@ -236,25 +236,25 @@ const d = (...t) => {
236
236
  ]),
237
237
  _: 3
238
238
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"]), [
239
- [T, X.value]
239
+ [T, Q.value]
240
240
  ]),
241
- o.value ? v("", !0) : V((c(), _(y, {
241
+ o.value ? v("", !0) : V((c(), N(D, {
242
242
  key: 0,
243
- ref: (U) => $.value = U,
243
+ ref: (E) => $.value = E,
244
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
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
255
  }, {
256
- default: q(() => [
257
- h(p)["button-drop"] ? R(e.$slots, "button-drop", {
256
+ default: P(() => [
257
+ h(p)["button-drop"] ? R(a.$slots, "button-drop", {
258
258
  key: 0,
259
259
  item: r.value,
260
260
  editMode: f.value,
@@ -265,68 +265,68 @@ const d = (...t) => {
265
265
  ]),
266
266
  _: 3
267
267
  }, 8, ["disabled", "confirm-modal", "confirm-data", "resource", "resource-data", "text", "icon"])), [
268
- [T, Q.value]
268
+ [T, G.value]
269
269
  ]),
270
- h(p).buttons ? V((c(), B("div", Ne, [
271
- R(e.$slots, "buttons")
270
+ h(p).buttons ? V((c(), B("div", Te, [
271
+ R(a.$slots, "buttons")
272
272
  ], 512)), [
273
273
  [T, f.value]
274
274
  ]) : v("", !0),
275
- V(x(y, {
275
+ V(ee(D, {
276
276
  checked: f.value,
277
- "onUpdate:checked": l[0] || (l[0] = (U) => f.value = U),
277
+ "onUpdate:checked": l[0] || (l[0] = (E) => f.value = E),
278
278
  class: "lkt-item-crud--switch-mode-button",
279
279
  "show-switch": "",
280
- text: e.editModeText
280
+ text: a.editModeText
281
281
  }, null, 8, ["checked", "text"]), [
282
- [T, Y.value]
282
+ [T, X.value]
283
283
  ])
284
284
  ], 512), [
285
- [T, ne.value]
285
+ [T, se.value]
286
286
  ]),
287
- u.value ? v("", !0) : (c(), B("div", _e, [
288
- b.value ? (c(), B("div", Ve, [
289
- g.value ? (c(), _(E, {
287
+ d.value ? v("", !0) : (c(), B("div", Le, [
288
+ k.value ? (c(), B("div", Oe, [
289
+ g.value ? (c(), N(w, {
290
290
  key: 0,
291
291
  code: m.value,
292
292
  quick: "",
293
293
  palette: m.value === 200 ? "success" : "danger",
294
294
  "can-close": "",
295
- onClose: l[1] || (l[1] = (U) => g.value = !1)
295
+ onClose: l[1] || (l[1] = (E) => g.value = !1)
296
296
  }, null, 8, ["code", "palette"])) : v("", !0),
297
- R(e.$slots, "item", {
297
+ R(a.$slots, "item", {
298
298
  item: r.value,
299
- loading: u.value,
299
+ loading: d.value,
300
300
  editMode: f.value,
301
301
  isCreate: o.value,
302
302
  canUpdate: M.value,
303
303
  canDrop: I.value,
304
- itemBeingEdited: F.value
304
+ itemBeingEdited: x.value
305
305
  })
306
- ])) : (c(), _(E, {
306
+ ])) : (c(), N(w, {
307
307
  key: 1,
308
308
  code: m.value
309
309
  }, null, 8, ["code"]))
310
310
  ])),
311
- u.value ? (c(), _(fe, { key: 2 })) : v("", !0)
311
+ d.value ? (c(), N(ve, { key: 2 })) : v("", !0)
312
312
  ])
313
313
  ]),
314
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"]);
315
+ }, 16);
316
316
  };
317
317
  }
318
- }), qe = {
318
+ }), Ae = {
319
319
  install: (t, C = {}) => {
320
- t.component("lkt-item-crud") === void 0 && t.component("lkt-item-crud", Te);
320
+ t.component("lkt-item-crud") === void 0 && t.component("lkt-item-crud", $e);
321
321
  }
322
322
  }, He = (t) => {
323
323
  S.defaultSaveIcon = t;
324
- }, Pe = (t) => {
324
+ }, We = (t) => {
325
325
  S.defaultDropIcon = t;
326
326
  };
327
327
  export {
328
- je as debugLktItemCrud,
329
- qe as default,
330
- Pe as setItemCrudDefaultDropIcon,
328
+ qe as debugLktItemCrud,
329
+ Ae as default,
330
+ We as setItemCrudDefaultDropIcon,
331
331
  He as setItemCrudDefaultSaveIcon
332
332
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -346,6 +346,12 @@
346
346
  hasModifiedData: () => dataState.value.changed(),
347
347
  });
348
348
 
349
+
350
+
351
+ const closeConfirm = computed(() => {
352
+ return dataState.value.changed() ? props.editedCloseConfirm : '';
353
+ })
354
+
349
355
  const showDropButton = computed(() => {
350
356
  if (!canUpdate.value && canDrop.value) return true;
351
357
 
@@ -392,28 +398,32 @@
392
398
  computedContainerTag = computed(() => {
393
399
  if (props.insideModal) return 'lkt-modal';
394
400
  return 'section';
401
+ }),
402
+ computedContainerAttrs = computed(() => {
403
+ if (computedContainerTag.value === 'lkt-modal') {
404
+ return {
405
+ 'modal-name': props.modalName,
406
+ 'modal-key': props.modalKey,
407
+ 'z-index': props.zIndex,
408
+ 'pre-title': props.preTitle,
409
+ 'show-close': props.showClose,
410
+ 'before-close': props.beforeClose,
411
+ 'disabled-close': props.disabledClose,
412
+ 'disabled-veil-click': props.disabledVeilClick,
413
+ 'close-confirm': closeConfirm.value,
414
+ 'close-confirm-key': props.editedCloseConfirmKey,
415
+ title: props.title,
416
+ size: props.size,
417
+ }
418
+ }
419
+ return {};
395
420
  });
396
-
397
- const closeConfirm = computed(() => {
398
- return dataState.value.changed() ? props.editedCloseConfirm : '';
399
- })
400
421
  </script>
401
422
 
402
423
  <template>
403
424
  <component
404
425
  :is="computedContainerTag"
405
- :pre-title="preTitle"
406
- :title="title"
407
- :modal-name="modalName"
408
- :modal-key="modalKey"
409
- :z-index="zIndex"
410
- :size="size"
411
- :show-close="showClose"
412
- :before-close="beforeClose"
413
- :disabled-close="disabledClose"
414
- :disabled-veil-click="disabledVeilClick"
415
- :close-confirm="closeConfirm"
416
- :close-confirm-key="editedCloseConfirmKey"
426
+ v-bind="computedContainerAttrs"
417
427
  >
418
428
  <article class="lkt-item-crud">
419
429
  <header class="lkt-item-crud_header" v-if="!insideModal && displayHeader">