lkt-item-crud 2.0.4 → 2.0.5

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 et(B?: boolean): void;
1
+ declare function et(C?: boolean): void;
2
2
  declare namespace tt {
3
- function install(B: any, W?: {}): void;
3
+ function install(C: any, J?: {}): void;
4
4
  }
5
- declare function ot(B: any): void;
6
- declare function at(B: any): void;
5
+ declare function ot(C: any): void;
6
+ declare function at(C: any): void;
7
7
  export { et as debugLktItemCrud, tt as default, ot as setItemCrudDefaultDropIcon, at as setItemCrudDefaultSaveIcon };
package/dist/build.js CHANGED
@@ -1,18 +1,18 @@
1
- import { defineComponent as me, ref as d, watch as k, useSlots as be, computed as y, resolveComponent as de, createElementBlock as w, createCommentVNode as s, openBlock as l, withDirectives as J, createBlock as U, unref as v, renderSlot as D, vShow as Q, mergeProps as Y, withCtx as $, mergeDefaults as Ce, nextTick as De, onMounted as Se, resolveDynamicComponent as Ie, normalizeProps as we, guardReactiveProps as Ue, createElementVNode as Me, toDisplayString as Ee, createSlots as se } from "vue";
1
+ import { defineComponent as me, ref as i, watch as k, useSlots as be, computed as y, resolveComponent as de, createElementBlock as U, createCommentVNode as v, openBlock as s, withDirectives as Y, createBlock as w, unref as p, renderSlot as D, vShow as Z, mergeProps as x, withCtx as V, mergeDefaults as Be, nextTick as De, onMounted as Se, resolveDynamicComponent as Ie, normalizeProps as Ue, guardReactiveProps as we, createElementVNode as Te, toDisplayString as Me, createSlots as se } from "vue";
2
2
  import { httpCall as Re } from "lkt-http-client";
3
3
  import { DataState as ve } from "lkt-data-state";
4
- import { ensureButtonConfig as T, LktSettings as m, ItemCrudMode as N, ItemCrudButtonNavVisibility as ae, TablePermission as oe, ItemCrudView as pe, ItemCrudButtonNavPosition as ce, NotificationType as H, getDefaultValues as Te, ItemCrud as Ne, ToastPositionX as ue } from "lkt-vue-kernel";
4
+ import { ensureButtonConfig as E, LktSettings as n, ItemCrudMode as $, ItemCrudButtonNavVisibility as ue, TablePermission as ne, ItemCrudView as pe, ItemCrudButtonNavPosition as ce, NotificationType as N, getDefaultValues as Ee, ItemCrud as Ne, ToastPositionX as O } from "lkt-vue-kernel";
5
5
  import { closeModal as $e } from "lkt-modal";
6
6
  import { __ as Ve } from "lkt-i18n";
7
- import { openToast as ne } from "lkt-toast";
8
- const K = class K {
7
+ import { openToast as j } from "lkt-toast";
8
+ const G = class G {
9
9
  };
10
- K.debugEnabled = !1, K.defaultSaveIcon = "", K.defaultDropIcon = "";
11
- let O = K;
12
- const g = (...B) => {
13
- O.debugEnabled && console.info("[LktItemCrud] ", ...B);
14
- }, et = (B = !0) => {
15
- O.debugEnabled = B;
10
+ G.debugEnabled = !1, G.defaultSaveIcon = "", G.defaultDropIcon = "";
11
+ let q = G;
12
+ const g = (...C) => {
13
+ q.debugEnabled && console.info("[LktItemCrud] ", ...C);
14
+ }, et = (C = !0) => {
15
+ q.debugEnabled = C;
16
16
  }, Le = {
17
17
  key: 0,
18
18
  class: "lkt-item-crud-buttons"
@@ -22,7 +22,7 @@ const g = (...B) => {
22
22
  }, Pe = {
23
23
  key: 1,
24
24
  class: "lkt-item-crud-buttons"
25
- }, _e = {
25
+ }, Xe = {
26
26
  key: 5,
27
27
  class: "lkt-item-crud-buttons"
28
28
  }, fe = /* @__PURE__ */ me({
@@ -51,144 +51,144 @@ const g = (...B) => {
51
51
  "save",
52
52
  "drop"
53
53
  ],
54
- setup(B, { expose: W, emit: Z }) {
55
- const o = Z, a = B, p = d(T(a.createButton, m.defaultCreateButton)), E = d(T(a.updateButton, m.defaultUpdateButton)), n = d(T(a.dropButton, m.defaultDropButton)), r = d(T(a.editModeButton, m.defaultEditModeButton));
54
+ setup(C, { expose: J, emit: ee }) {
55
+ const o = ee, a = C, c = i(E(a.createButton, n.defaultCreateButton)), M = i(E(a.updateButton, n.defaultUpdateButton)), d = i(E(a.dropButton, n.defaultDropButton)), r = i(E(a.editModeButton, n.defaultEditModeButton));
56
56
  k(() => a.createButton, (t) => {
57
- p.value = T(t, m.defaultCreateButton);
57
+ c.value = E(t, n.defaultCreateButton);
58
58
  }, { deep: !0 }), k(() => a.updateButton, (t) => {
59
- E.value = T(t, m.defaultUpdateButton);
59
+ M.value = E(t, n.defaultUpdateButton);
60
60
  }, { deep: !0 }), k(() => a.dropButton, (t) => {
61
- n.value = T(t, m.defaultDropButton);
61
+ d.value = E(t, n.defaultDropButton);
62
62
  }, { deep: !0 }), k(() => a.editModeButton, (t) => {
63
- r.value = T(t, m.defaultEditModeButton);
63
+ r.value = E(t, n.defaultEditModeButton);
64
64
  }, { deep: !0 });
65
- const f = be(), C = d(null), S = d(null), b = d(a.loading);
65
+ const m = be(), B = i(null), S = i(null), b = i(a.loading);
66
66
  k(() => a.loading, (t) => b.value = t), k(b, (t) => o("update:loading", t));
67
- const c = d(a.editing);
68
- k(() => a.editing, (t) => c.value = t), k(c, (t) => o("update:editing", t));
67
+ const f = i(a.editing);
68
+ k(() => a.editing, (t) => f.value = t), k(f, (t) => o("update:editing", t));
69
69
  const h = () => {
70
70
  b.value = !0;
71
71
  }, I = () => {
72
72
  b.value = !1;
73
- }, X = (t, i) => {
74
- o("create", t, i);
75
- }, M = (t, i) => {
76
- o("save", t, i);
77
- }, j = (t, i) => {
78
- o("drop", t, i);
73
+ }, z = (t, l) => {
74
+ typeof t > "u" || o("create", t, l);
75
+ }, T = (t, l) => {
76
+ typeof t > "u" || o("save", t, l);
77
+ }, F = (t, l) => {
78
+ typeof t > "u" || o("drop", t, l);
79
79
  };
80
- W({
80
+ J({
81
81
  doSave: () => {
82
- C.value && typeof C.value.click == "function" && C.value.click();
82
+ B.value && typeof B.value.click == "function" && B.value.click();
83
83
  },
84
84
  doDrop: () => {
85
85
  S.value && typeof S.value.click == "function" && S.value.click();
86
86
  }
87
87
  });
88
- const P = y(() => {
89
- var t, i;
90
- return a.mode !== N.Create && !a.canUpdate || !a.dataChanged ? !1 : typeof ((t = E.value) == null ? void 0 : t.disabled) == "function" ? !E.value.disabled(a.item) : typeof ((i = E.value) == null ? void 0 : i.disabled) == "boolean" ? !E.value.disabled : !0;
88
+ const X = y(() => {
89
+ var t, l;
90
+ return a.mode !== $.Create && !a.canUpdate || !a.dataChanged ? !1 : typeof ((t = M.value) == null ? void 0 : t.disabled) == "function" ? !M.value.disabled(a.item) : typeof ((l = M.value) == null ? void 0 : l.disabled) == "boolean" ? !M.value.disabled : !0;
91
91
  }), _ = y(() => {
92
- var t, i;
93
- return a.mode !== N.Create || !a.dataChanged ? !1 : typeof ((t = p.value) == null ? void 0 : t.disabled) == "function" ? !p.value.disabled(a.item) : typeof ((i = p.value) == null ? void 0 : i.disabled) == "boolean" ? !p.value.disabled : !0;
94
- }), q = y(() => {
95
- var t, i;
96
- return a.canDrop ? typeof ((t = n.value) == null ? void 0 : t.disabled) == "function" ? !n.value.disabled(a.item) : typeof ((i = n.value) == null ? void 0 : i.disabled) == "boolean" ? !n.value.disabled : !0 : !1;
97
- }), L = y(() => a.canDrop ? !a.canUpdate && a.canDrop ? !0 : !b.value && a.editing && a.httpSuccessRead : !1), A = y(() => a.dataChanged ? !0 : b.value ? !1 : a.mode === N.Create ? !0 : a.buttonNavVisibility === ae.Never ? !1 : a.editing && a.httpSuccessRead), z = y(() => !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !b.value && a.mode !== N.Create && a.httpSuccessRead), G = y(() => a.buttonNavVisibility === ae.Always && (P.value || _.value || q.value) || f["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === ae.Never ? !1 : A.value || L.value || z.value);
98
- return (t, i) => {
99
- const F = de("lkt-button");
100
- return G.value ? (l(), w("div", Le, [
101
- v(f)["prev-buttons-ever"] ? J((l(), w("div", Ae, [
92
+ var t, l;
93
+ return a.mode !== $.Create || !a.dataChanged ? !1 : typeof ((t = c.value) == null ? void 0 : t.disabled) == "function" ? !c.value.disabled(a.item) : typeof ((l = c.value) == null ? void 0 : l.disabled) == "boolean" ? !c.value.disabled : !0;
94
+ }), H = y(() => {
95
+ var t, l;
96
+ return a.canDrop ? typeof ((t = d.value) == null ? void 0 : t.disabled) == "function" ? !d.value.disabled(a.item) : typeof ((l = d.value) == null ? void 0 : l.disabled) == "boolean" ? !d.value.disabled : !0 : !1;
97
+ }), A = y(() => a.canDrop ? !a.canUpdate && a.canDrop ? !0 : !b.value && a.editing && a.httpSuccessRead : !1), P = y(() => a.dataChanged ? !0 : b.value ? !1 : a.mode === $.Create ? !0 : a.buttonNavVisibility === ue.Never ? !1 : a.editing && a.httpSuccessRead), K = y(() => !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !b.value && a.mode !== $.Create && a.httpSuccessRead), Q = y(() => a.buttonNavVisibility === ue.Always && (X.value || _.value || H.value) || m["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === ue.Never ? !1 : P.value || A.value || K.value);
98
+ return (t, l) => {
99
+ const W = de("lkt-button");
100
+ return Q.value ? (s(), U("div", Le, [
101
+ p(m)["prev-buttons-ever"] ? Y((s(), U("div", Ae, [
102
102
  D(t.$slots, "prev-buttons-ever")
103
103
  ], 512)), [
104
- [Q, !b.value]
105
- ]) : s("", !0),
106
- v(f)["prev-buttons"] ? J((l(), w("div", Pe, [
104
+ [Z, !b.value]
105
+ ]) : v("", !0),
106
+ p(m)["prev-buttons"] ? Y((s(), U("div", Pe, [
107
107
  D(t.$slots, "prev-buttons")
108
108
  ], 512)), [
109
- [Q, c.value && !b.value]
110
- ]) : s("", !0),
111
- t.mode === v(N).Update && A.value ? (l(), U(F, Y({
109
+ [Z, f.value && !b.value]
110
+ ]) : v("", !0),
111
+ t.mode === p($).Update && P.value ? (s(), w(W, x({
112
112
  key: 2,
113
113
  ref_key: "saveButtonRef",
114
- ref: C
115
- }, E.value, {
116
- disabled: !P.value,
114
+ ref: B
115
+ }, M.value, {
116
+ disabled: !X.value,
117
117
  onLoading: h,
118
118
  onLoaded: I,
119
- onClick: M
119
+ onClick: T
120
120
  }), {
121
- default: $(() => [
122
- v(f)["button-save"] ? D(t.$slots, "button-save", {
121
+ default: V(() => [
122
+ p(m)["button-save"] ? D(t.$slots, "button-save", {
123
123
  key: 0,
124
124
  item: t.item,
125
- editMode: c.value,
125
+ editMode: f.value,
126
126
  isCreate: !1,
127
127
  canUpdate: t.canUpdate,
128
128
  canDrop: t.canDrop
129
- }) : s("", !0)
129
+ }) : v("", !0)
130
130
  ]),
131
131
  _: 3
132
- }, 16, ["disabled"])) : t.mode === v(N).Create && A.value ? (l(), U(F, Y({
132
+ }, 16, ["disabled"])) : t.mode === p($).Create && P.value ? (s(), w(W, x({
133
133
  key: 3,
134
134
  ref_key: "saveButtonRef",
135
- ref: C
136
- }, p.value, {
135
+ ref: B
136
+ }, c.value, {
137
137
  disabled: !_.value,
138
138
  onLoading: h,
139
139
  onLoaded: I,
140
- onClick: X
140
+ onClick: z
141
141
  }), {
142
- default: $(() => [
143
- v(f)["button-save"] ? D(t.$slots, "button-save", {
142
+ default: V(() => [
143
+ p(m)["button-save"] ? D(t.$slots, "button-save", {
144
144
  key: 0,
145
145
  item: t.item,
146
- editMode: c.value,
146
+ editMode: f.value,
147
147
  isCreate: !0,
148
148
  canUpdate: t.canUpdate,
149
149
  canDrop: t.canDrop
150
- }) : s("", !0)
150
+ }) : v("", !0)
151
151
  ]),
152
152
  _: 3
153
- }, 16, ["disabled"])) : s("", !0),
154
- t.mode !== v(N).Create ? J((l(), U(F, Y({
153
+ }, 16, ["disabled"])) : v("", !0),
154
+ t.mode !== p($).Create ? Y((s(), w(W, x({
155
155
  key: 4,
156
156
  ref_key: "dropButtonRef",
157
157
  ref: S
158
- }, n.value, {
159
- disabled: !q.value,
158
+ }, d.value, {
159
+ disabled: !H.value,
160
160
  onLoading: h,
161
161
  onLoaded: I,
162
- onClick: j
162
+ onClick: F
163
163
  }), {
164
- default: $(() => [
165
- v(f)["button-drop"] ? D(t.$slots, "button-drop", {
164
+ default: V(() => [
165
+ p(m)["button-drop"] ? D(t.$slots, "button-drop", {
166
166
  key: 0,
167
167
  item: t.item,
168
- editMode: c.value,
168
+ editMode: f.value,
169
169
  isCreate: !1,
170
170
  canUpdate: t.canUpdate,
171
171
  canDrop: t.canDrop
172
- }) : s("", !0)
172
+ }) : v("", !0)
173
173
  ]),
174
174
  _: 3
175
175
  }, 16, ["disabled"])), [
176
- [Q, L.value]
177
- ]) : s("", !0),
178
- v(f).buttons ? J((l(), w("div", _e, [
176
+ [Z, A.value]
177
+ ]) : v("", !0),
178
+ p(m).buttons ? Y((s(), U("div", Xe, [
179
179
  D(t.$slots, "buttons")
180
180
  ], 512)), [
181
- [Q, c.value && !b.value]
182
- ]) : s("", !0),
183
- z.value ? (l(), U(F, Y({ key: 6 }, r.value, {
184
- checked: c.value,
185
- "onUpdate:checked": i[0] || (i[0] = (re) => c.value = re),
181
+ [Z, f.value && !b.value]
182
+ ]) : v("", !0),
183
+ K.value ? (s(), w(W, x({ key: 6 }, r.value, {
184
+ checked: f.value,
185
+ "onUpdate:checked": l[0] || (l[0] = (ie) => f.value = ie),
186
186
  class: "lkt-item-crud--switch-mode-button"
187
- }), null, 16, ["checked"])) : s("", !0)
188
- ])) : s("", !0);
187
+ }), null, 16, ["checked"])) : v("", !0)
188
+ ])) : v("", !0);
189
189
  };
190
190
  }
191
- }), Oe = { class: "lkt-item-crud" }, Xe = {
191
+ }), _e = { class: "lkt-item-crud" }, Oe = {
192
192
  key: 0,
193
193
  class: "lkt-item-crud_header"
194
194
  }, je = {
@@ -208,7 +208,7 @@ const g = (...B) => {
208
208
  class: "lkt-grid-1"
209
209
  }, Ke = /* @__PURE__ */ me({
210
210
  __name: "LktItemCrud",
211
- props: /* @__PURE__ */ Ce({
211
+ props: /* @__PURE__ */ Be({
212
212
  modelValue: {},
213
213
  editing: { type: Boolean },
214
214
  mode: {},
@@ -227,7 +227,7 @@ const g = (...B) => {
227
227
  title: {},
228
228
  beforeEmitUpdate: { type: Function },
229
229
  notificationType: {}
230
- }, Te(Ne)),
230
+ }, Ee(Ne)),
231
231
  emits: [
232
232
  "update:modelValue",
233
233
  "update:editing",
@@ -240,93 +240,108 @@ const g = (...B) => {
240
240
  "error",
241
241
  "modified-data"
242
242
  ],
243
- setup(B, { expose: W, emit: Z }) {
244
- const o = B, a = be(), p = Z;
245
- let E = [];
246
- const n = d(!0), r = d(o.modelValue), f = d(E), C = d(o.editing), S = d(!1), b = d(!1), c = d(200), h = d(new ve(r.value, o.dataStateConfig)), I = d(!1), X = d(new ve(o.readData)), M = d(o.mode === N.Create), j = d(!1), x = d(!1), V = d(null), P = y(() => !M.value && Array.isArray(f.value) && f.value.includes(oe.Update)), _ = y(() => !M.value && Array.isArray(f.value) && f.value.includes(oe.Drop)), q = y(() => !M.value && Array.isArray(f.value) && f.value.includes(oe.SwitchEditMode)), L = async () => {
247
- g("fetchItem"), n.value = !0, c.value = -1, b.value = !1;
243
+ setup(C, { expose: J, emit: ee }) {
244
+ const o = C, a = be(), c = ee;
245
+ let M = [];
246
+ const d = i(!0), r = i(o.modelValue), m = i(M), B = i(o.editing), S = i(!1), b = i(!1), f = i(200), h = i(new ve(r.value, o.dataStateConfig)), I = i(!1), z = i(new ve(o.readData)), T = i(o.mode === $.Create), F = i(!1), te = i(!1), L = i(null), X = y(() => !T.value && Array.isArray(m.value) && m.value.includes(ne.Update)), _ = y(() => !T.value && Array.isArray(m.value) && m.value.includes(ne.Drop)), H = y(() => !T.value && Array.isArray(m.value) && m.value.includes(ne.SwitchEditMode)), A = async () => {
247
+ g("fetchItem"), d.value = !0, f.value = -1, b.value = !1;
248
248
  try {
249
249
  const e = await Re(o.readResource, o.readData);
250
- if (g("fetchItem -> response", e), n.value = !1, c.value = e.httpStatus, !e.success) {
251
- S.value = !1, c.value = e.httpStatus, p("error", e.httpStatus);
250
+ if (g("fetchItem -> response", e), d.value = !1, f.value = e.httpStatus, !e.success) {
251
+ S.value = !1, f.value = e.httpStatus, c("error", e.httpStatus);
252
252
  return;
253
253
  }
254
- S.value = !0, r.value = e.data, f.value = e.perms, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed(), X.value.turnStoredIntoOriginal(), p("read", e);
254
+ S.value = !0, r.value = e.data, m.value = e.perms, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed(), z.value.turnStoredIntoOriginal(), c("read", e);
255
255
  } catch {
256
- n.value = !1, S.value = !1, c.value = 404, p("error", 404);
256
+ d.value = !1, S.value = !1, f.value = 404, c("error", 404);
257
257
  return;
258
258
  }
259
259
  };
260
260
  k(() => o.modelValue, (e) => {
261
261
  r.value = e, h.value.increment(e);
262
262
  }, { deep: !0 }), k(r, (e) => {
263
- if (j.value = !0, g("item updated ->", r.value), typeof o.beforeEmitUpdate == "function") {
263
+ if (F.value = !0, g("item updated ->", r.value), typeof o.beforeEmitUpdate == "function") {
264
264
  g("item updated -> has beforeEmitUpdate");
265
265
  let u = o.beforeEmitUpdate(r.value);
266
266
  g("item updated -> override with: ", u), typeof u == "object" && (r.value = u);
267
267
  }
268
- p("update:modelValue", r.value), g("item updated -> update dataState"), h.value.increment(e), I.value = h.value.changed(), De(() => j.value = !1);
269
- }, { deep: !0 }), k(f, () => p("perms", f.value)), k(I, (e) => {
270
- p("modified-data", e);
268
+ c("update:modelValue", r.value), g("item updated -> update dataState"), h.value.increment(e), I.value = h.value.changed(), De(() => F.value = !1);
269
+ }, { deep: !0 }), k(m, () => c("perms", m.value)), k(I, (e) => {
270
+ c("modified-data", e);
271
271
  }), k(() => o.readData, (e) => {
272
- X.value.increment(e), X.value.changed() && L();
272
+ z.value.increment(e), z.value.changed() && A();
273
273
  }), k(() => o.editing, (e) => {
274
- g("editing updated -> updating editMode", e), C.value = e;
275
- }), k(C, (e) => {
276
- g("editMode updated -> emit update", e), p("update:editing", e);
274
+ g("editing updated -> updating editMode", e), B.value = e;
275
+ }), k(B, (e) => {
276
+ g("editMode updated -> emit update", e), c("update:editing", e);
277
277
  }), Se(() => {
278
- o.readResource && !M.value ? L() : M.value && (S.value = !0, C.value = !0, n.value = !1, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed());
278
+ o.readResource && !T.value ? A() : T.value && (S.value = !0, B.value = !0, d.value = !1, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed());
279
279
  });
280
- const A = (e, u) => {
280
+ const P = (e, u) => {
281
281
  if (u) {
282
- if (n.value = !1, typeof e < "u" && (c.value = e.httpStatus, !e.success))
283
- return b.value = !0, p("error", e.httpStatus), !1;
282
+ if (d.value = !1, typeof e < "u" && (f.value = e.httpStatus, !e.success))
283
+ return b.value = !0, c("error", e.httpStatus), !1;
284
284
  b.value = !0;
285
285
  }
286
286
  return !0;
287
- }, z = (e) => {
288
- !te.value && e.autoReloadId && (g("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), o.readData.id = e.autoReloadId, g("doAutoReloadId -> turning off create mode"), M.value = !1, L());
289
- }, G = (e, u) => {
290
- if (g("onCreate"), !A(u, o.createButton.resource)) {
291
- o.notificationType === H.Toast && ne({
292
- text: m.defaultCreateErrorText,
293
- details: m.defaultCreateErrorDetails,
294
- icon: m.defaultCreateErrorIcon,
295
- positionX: ue.Right
287
+ }, K = (e) => {
288
+ !oe.value && e.autoReloadId && (g("doAutoReloadId -> autoReloadId detected: ", e.autoReloadId), o.readData.id = e.autoReloadId, g("doAutoReloadId -> turning off create mode"), T.value = !1, A());
289
+ }, Q = (e, u) => {
290
+ if (g("onCreate"), !P(u, o.createButton.resource)) {
291
+ o.notificationType === N.Toast && j({
292
+ text: n.defaultCreateErrorText,
293
+ details: n.defaultCreateErrorDetails,
294
+ icon: n.defaultCreateErrorIcon,
295
+ positionX: O.Right
296
296
  });
297
297
  return;
298
298
  }
299
- x.value = !0, g("onCreate -> turn stored data into original"), h.value.increment(r.value).turnStoredIntoOriginal(), z(u), p("create", u);
299
+ te.value = !0, g("onCreate -> turn stored data into original"), h.value.increment(r.value).turnStoredIntoOriginal(), o.notificationType === N.Toast && j({
300
+ text: n.defaultCreateSuccessText,
301
+ details: n.defaultCreateSuccessDetails,
302
+ icon: n.defaultCreateSuccessIcon,
303
+ positionX: O.Right
304
+ }), K(u), c("create", u);
300
305
  }, t = (e, u) => {
301
- if (g("onUpdate"), !A(u, o.updateButton.resource)) {
302
- o.notificationType === H.Toast && ne({
303
- text: m.defaultUpdateErrorText,
304
- details: m.defaultUpdateErrorDetails,
305
- icon: m.defaultUpdateErrorIcon,
306
- positionX: ue.Right
306
+ if (g("onUpdate"), !P(u, o.updateButton.resource)) {
307
+ o.notificationType === N.Toast && j({
308
+ text: n.defaultUpdateErrorText,
309
+ details: n.defaultUpdateErrorDetails,
310
+ icon: n.defaultUpdateErrorIcon,
311
+ positionX: O.Right
307
312
  });
308
313
  return;
309
314
  }
310
- g("onUpdate -> turn stored data into original"), h.value.turnStoredIntoOriginal(), z(u), p("update", u);
311
- }, i = (e, u) => {
312
- if (g("onDrop"), !A(u, o.dropButton.resource)) {
313
- o.notificationType === H.Toast && ne({
314
- text: m.defaultDropErrorText,
315
- details: m.defaultDropErrorDetails,
316
- icon: m.defaultDropErrorIcon,
317
- positionX: ue.Right
315
+ g("onUpdate -> turn stored data into original"), h.value.turnStoredIntoOriginal(), o.notificationType === N.Toast && j({
316
+ text: n.defaultUpdateSuccessText,
317
+ details: n.defaultUpdateSuccessDetails,
318
+ icon: n.defaultUpdateSuccessIcon,
319
+ positionX: O.Right
320
+ }), K(u), c("update", u);
321
+ }, l = (e, u) => {
322
+ if (g("onDrop"), !P(u, o.dropButton.resource)) {
323
+ o.notificationType === N.Toast && j({
324
+ text: n.defaultDropErrorText,
325
+ details: n.defaultDropErrorDetails,
326
+ icon: n.defaultDropErrorIcon,
327
+ positionX: O.Right
318
328
  });
319
329
  return;
320
330
  }
321
- p("drop", u), o.view === pe.Modal && (g("onDrop -> close modal"), $e(o.modalConfig.modalName, o.modalConfig.modalKey));
331
+ o.notificationType === N.Toast && j({
332
+ text: n.defaultDropSuccessText,
333
+ details: n.defaultDropSuccessDetails,
334
+ icon: n.defaultDropSuccessIcon,
335
+ positionX: O.Right
336
+ }), c("drop", u), o.view === pe.Modal && (g("onDrop -> close modal"), $e(o.modalConfig.modalName, o.modalConfig.modalKey));
322
337
  };
323
- W({
338
+ J({
324
339
  doDrop: () => {
325
- V.value && V.value.doDrop();
340
+ L.value && L.value.doDrop();
326
341
  },
327
- doRefresh: L,
342
+ doRefresh: A,
328
343
  doSave: () => {
329
- V.value && V.value.doSave();
344
+ L.value && L.value.doSave();
330
345
  },
331
346
  hasModifiedData: () => h.value.changed()
332
347
  });
@@ -338,9 +353,9 @@ const g = (...B) => {
338
353
  if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
339
354
  return o.modalConfig.beforeClose({
340
355
  ...e,
341
- itemCreated: x.value
356
+ itemCreated: te.value
342
357
  });
343
- }, ee = y(() => o.title.startsWith("__:") ? String(Ve(o.title.substring(3))) : o.title), he = y(() => n.value ? !1 : ee.value.length > 0 || !!a["post-title"]), te = y(() => o.view === pe.Modal), ie = y(() => te.value ? "lkt-modal" : "section"), ke = y(() => ie.value === "lkt-modal" ? {
358
+ }, ae = y(() => o.title.startsWith("__:") ? String(Ve(o.title.substring(3))) : o.title), he = y(() => d.value ? !1 : ae.value.length > 0 || !!a["post-title"]), oe = y(() => o.view === pe.Modal), re = y(() => oe.value ? "lkt-modal" : "section"), ke = y(() => re.value === "lkt-modal" ? {
344
359
  title: o.title,
345
360
  item: r.value,
346
361
  ...o.modalConfig,
@@ -348,33 +363,33 @@ const g = (...B) => {
348
363
  "close-confirm": ge.value
349
364
  } : {});
350
365
  return (e, u) => {
351
- const le = de("lkt-http-info"), Be = de("lkt-loader");
352
- return l(), U(Ie(ie.value), we(Ue(ke.value)), {
353
- default: $(() => [
354
- Me("article", Oe, [
355
- !te.value && he.value ? (l(), w("header", Xe, [
356
- v(a)["pre-title"] ? (l(), w("div", je, [
366
+ const le = de("lkt-http-info"), Ce = de("lkt-loader");
367
+ return s(), w(Ie(re.value), Ue(we(ke.value)), {
368
+ default: V(() => [
369
+ Te("article", _e, [
370
+ !oe.value && he.value ? (s(), U("header", Oe, [
371
+ p(a)["pre-title"] ? (s(), U("div", je, [
357
372
  D(e.$slots, "pre-title", {
358
373
  item: r.value,
359
- loading: n.value
374
+ loading: d.value
360
375
  })
361
- ])) : s("", !0),
362
- ee.value.length > 0 ? (l(), w("h1", qe, Ee(ee.value), 1)) : s("", !0),
363
- v(a)["post-title"] ? (l(), w("div", ze, [
376
+ ])) : v("", !0),
377
+ ae.value.length > 0 ? (s(), U("h1", qe, Me(ae.value), 1)) : v("", !0),
378
+ p(a)["post-title"] ? (s(), U("div", ze, [
364
379
  D(e.$slots, "post-title", {
365
380
  item: r.value,
366
- loading: n.value
381
+ loading: d.value
367
382
  })
368
- ])) : s("", !0)
369
- ])) : s("", !0),
370
- e.buttonNavPosition === v(ce).Top ? (l(), U(fe, {
383
+ ])) : v("", !0)
384
+ ])) : v("", !0),
385
+ e.buttonNavPosition === p(ce).Top ? (s(), w(fe, {
371
386
  key: 1,
372
387
  ref_key: "buttonNav",
373
- ref: V,
374
- loading: n.value,
375
- "onUpdate:loading": u[0] || (u[0] = (R) => n.value = R),
376
- editing: C.value,
377
- "onUpdate:editing": u[1] || (u[1] = (R) => C.value = R),
388
+ ref: L,
389
+ loading: d.value,
390
+ "onUpdate:loading": u[0] || (u[0] = (R) => d.value = R),
391
+ editing: B.value,
392
+ "onUpdate:editing": u[1] || (u[1] = (R) => B.value = R),
378
393
  item: r.value,
379
394
  mode: e.mode,
380
395
  view: e.view,
@@ -385,61 +400,61 @@ const g = (...B) => {
385
400
  "edit-mode-button": e.editModeButton,
386
401
  "data-changed": I.value,
387
402
  "http-success-read": S.value,
388
- "can-update": P.value,
403
+ "can-update": X.value,
389
404
  "can-drop": _.value,
390
- "can-switch-edit-mode": q.value,
391
- onCreate: G,
405
+ "can-switch-edit-mode": H.value,
406
+ onCreate: Q,
392
407
  onSave: t,
393
- onDrop: i
408
+ onDrop: l
394
409
  }, se({ _: 2 }, [
395
- v(a)["prev-buttons-ever"] ? {
410
+ p(a)["prev-buttons-ever"] ? {
396
411
  name: "prev-buttons-ever",
397
- fn: $(() => [
412
+ fn: V(() => [
398
413
  D(e.$slots, "prev-buttons-ever")
399
414
  ]),
400
415
  key: "0"
401
416
  } : void 0,
402
- v(a)["prev-buttons"] ? {
417
+ p(a)["prev-buttons"] ? {
403
418
  name: "prev-buttons-ever",
404
- fn: $(() => [
419
+ fn: V(() => [
405
420
  D(e.$slots, "prev-buttons")
406
421
  ]),
407
422
  key: "1"
408
423
  } : void 0
409
- ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : s("", !0),
410
- n.value ? s("", !0) : (l(), w("div", Fe, [
411
- S.value ? (l(), w("div", He, [
412
- b.value && e.notificationType === v(H).Inline ? (l(), U(le, {
424
+ ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : v("", !0),
425
+ d.value ? v("", !0) : (s(), U("div", Fe, [
426
+ S.value ? (s(), U("div", He, [
427
+ b.value && e.notificationType === p(N).Inline ? (s(), w(le, {
413
428
  key: 0,
414
- code: c.value,
415
- palette: c.value === 200 ? "success" : "danger",
429
+ code: f.value,
430
+ palette: f.value === 200 ? "success" : "danger",
416
431
  quick: "",
417
432
  "can-close": "",
418
433
  onClose: u[2] || (u[2] = (R) => b.value = !1)
419
- }, null, 8, ["code", "palette"])) : s("", !0),
434
+ }, null, 8, ["code", "palette"])) : v("", !0),
420
435
  D(e.$slots, "item", {
421
436
  item: r.value,
422
- loading: n.value,
423
- editMode: C.value,
424
- isCreate: M.value,
425
- canUpdate: P.value,
437
+ loading: d.value,
438
+ editMode: B.value,
439
+ isCreate: T.value,
440
+ canUpdate: X.value,
426
441
  canDrop: _.value,
427
- itemBeingEdited: j.value
442
+ itemBeingEdited: F.value
428
443
  })
429
- ])) : e.notificationType === v(H).Inline ? (l(), U(le, {
444
+ ])) : e.notificationType === p(N).Inline ? (s(), w(le, {
430
445
  key: 1,
431
- code: c.value
432
- }, null, 8, ["code"])) : s("", !0)
446
+ code: f.value
447
+ }, null, 8, ["code"])) : v("", !0)
433
448
  ])),
434
- n.value ? (l(), U(Be, { key: 3 })) : s("", !0),
435
- e.buttonNavPosition === v(ce).Bottom ? (l(), U(fe, {
449
+ d.value ? (s(), w(Ce, { key: 3 })) : v("", !0),
450
+ e.buttonNavPosition === p(ce).Bottom ? (s(), w(fe, {
436
451
  key: 4,
437
452
  ref_key: "buttonNav",
438
- ref: V,
439
- loading: n.value,
440
- "onUpdate:loading": u[3] || (u[3] = (R) => n.value = R),
441
- editing: C.value,
442
- "onUpdate:editing": u[4] || (u[4] = (R) => C.value = R),
453
+ ref: L,
454
+ loading: d.value,
455
+ "onUpdate:loading": u[3] || (u[3] = (R) => d.value = R),
456
+ editing: B.value,
457
+ "onUpdate:editing": u[4] || (u[4] = (R) => B.value = R),
443
458
  item: r.value,
444
459
  mode: e.mode,
445
460
  view: e.view,
@@ -450,28 +465,28 @@ const g = (...B) => {
450
465
  "edit-mode-button": e.editModeButton,
451
466
  "data-changed": I.value,
452
467
  "http-success-read": S.value,
453
- "can-update": P.value,
468
+ "can-update": X.value,
454
469
  "can-drop": _.value,
455
- "can-switch-edit-mode": q.value,
456
- onCreate: G,
470
+ "can-switch-edit-mode": H.value,
471
+ onCreate: Q,
457
472
  onSave: t,
458
- onDrop: i
473
+ onDrop: l
459
474
  }, se({ _: 2 }, [
460
- v(a)["prev-buttons-ever"] ? {
475
+ p(a)["prev-buttons-ever"] ? {
461
476
  name: "prev-buttons-ever",
462
- fn: $(() => [
477
+ fn: V(() => [
463
478
  D(e.$slots, "prev-buttons-ever")
464
479
  ]),
465
480
  key: "0"
466
481
  } : void 0,
467
- v(a)["prev-buttons"] ? {
482
+ p(a)["prev-buttons"] ? {
468
483
  name: "prev-buttons-ever",
469
- fn: $(() => [
484
+ fn: V(() => [
470
485
  D(e.$slots, "prev-buttons")
471
486
  ]),
472
487
  key: "1"
473
488
  } : void 0
474
- ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : s("", !0)
489
+ ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : v("", !0)
475
490
  ])
476
491
  ]),
477
492
  _: 3
@@ -479,13 +494,13 @@ const g = (...B) => {
479
494
  };
480
495
  }
481
496
  }), tt = {
482
- install: (B, W = {}) => {
483
- B.component("lkt-item-crud") === void 0 && B.component("lkt-item-crud", Ke);
497
+ install: (C, J = {}) => {
498
+ C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Ke);
484
499
  }
485
- }, at = (B) => {
486
- O.defaultSaveIcon = B;
487
- }, ot = (B) => {
488
- O.defaultDropIcon = B;
500
+ }, at = (C) => {
501
+ q.defaultSaveIcon = C;
502
+ }, ot = (C) => {
503
+ q.defaultDropIcon = C;
489
504
  };
490
505
  export {
491
506
  et as debugLktItemCrud,
@@ -1536,7 +1536,7 @@ declare const saveButtonRef: import("vue").Ref<HTMLButtonElement | null, HTMLBut
1536
1536
  declare const dropButtonRef: import("vue").Ref<HTMLButtonElement | null, HTMLButtonElement | null>;
1537
1537
  declare const isLoading: import("vue").Ref<boolean, boolean>;
1538
1538
  declare const isEditing: import("vue").Ref<boolean, boolean>;
1539
- declare const onButtonLoading: () => void, onButtonLoaded: () => void, onCreate: ($event: Event, r: HTTPResponse) => void, onSave: ($event: Event, r: HTTPResponse) => void, onDrop: ($event: Event, r: HTTPResponse) => void;
1539
+ declare const onButtonLoading: () => void, onButtonLoaded: () => void, onCreate: ($event: Event | undefined, r: HTTPResponse) => void, onSave: ($event: Event | undefined, r: HTTPResponse) => void, onDrop: ($event: Event | undefined, r: HTTPResponse) => void;
1540
1540
  declare const ableToUpdate: import("vue").ComputedRef<boolean>, ableToCreate: import("vue").ComputedRef<boolean>, ableToDrop: import("vue").ComputedRef<boolean>, showDropButton: import("vue").ComputedRef<boolean>, showSaveButton: import("vue").ComputedRef<boolean>, showSwitchButton: import("vue").ComputedRef<boolean>, showButtons: import("vue").ComputedRef<boolean>;
1541
1541
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
1542
1542
  declare var __VLS_1: {}, __VLS_3: {}, __VLS_17: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -37,6 +37,8 @@
37
37
  "vue-tsc": "^2.2.0"
38
38
  },
39
39
  "dependencies": {
40
+ },
41
+ "peerDependencies": {
40
42
  "lkt-button": "^2.0.4",
41
43
  "lkt-data-state": "^1.0.9",
42
44
  "lkt-http-client": "^1.0.12",
@@ -46,9 +48,7 @@
46
48
  "lkt-modal": "^2.0.2",
47
49
  "lkt-string-tools": "^1.0.2",
48
50
  "lkt-toast": "^1.0.1",
49
- "lkt-vue-kernel": "^1.0.27"
50
- },
51
- "peerDependencies": {
51
+ "lkt-vue-kernel": "^1.0.27",
52
52
  "vue": "^3.3.0"
53
53
  }
54
54
  }
@@ -87,13 +87,16 @@
87
87
  onButtonLoaded = () => {
88
88
  isLoading.value = false;
89
89
  },
90
- onCreate = ($event: Event, r: HTTPResponse) => {
90
+ onCreate = ($event: Event|undefined, r: HTTPResponse) => {
91
+ if (typeof $event === 'undefined') return;
91
92
  emit('create', $event, r);
92
93
  },
93
- onSave = ($event: Event, r: HTTPResponse) => {
94
+ onSave = ($event: Event|undefined, r: HTTPResponse) => {
95
+ if (typeof $event === 'undefined') return;
94
96
  emit('save', $event, r);
95
97
  },
96
- onDrop = ($event: Event, r: HTTPResponse) => {
98
+ onDrop = ($event: Event|undefined, r: HTTPResponse) => {
99
+ if (typeof $event === 'undefined') return;
97
100
  emit('drop', $event, r);
98
101
  };
99
102
 
@@ -187,6 +187,14 @@
187
187
  itemCreated.value = true;
188
188
  debug('onCreate -> turn stored data into original');
189
189
  dataState.value.increment(item.value).turnStoredIntoOriginal();
190
+ if (props.notificationType === NotificationType.Toast) {
191
+ openToast(<ToastConfig>{
192
+ text: LktSettings.defaultCreateSuccessText,
193
+ details: LktSettings.defaultCreateSuccessDetails,
194
+ icon: LktSettings.defaultCreateSuccessIcon,
195
+ positionX: ToastPositionX.Right,
196
+ });
197
+ }
190
198
  doAutoReloadId(r);
191
199
  emit('create', r);
192
200
  },
@@ -205,6 +213,14 @@
205
213
  }
206
214
  debug('onUpdate -> turn stored data into original');
207
215
  dataState.value.turnStoredIntoOriginal();
216
+ if (props.notificationType === NotificationType.Toast) {
217
+ openToast(<ToastConfig>{
218
+ text: LktSettings.defaultUpdateSuccessText,
219
+ details: LktSettings.defaultUpdateSuccessDetails,
220
+ icon: LktSettings.defaultUpdateSuccessIcon,
221
+ positionX: ToastPositionX.Right,
222
+ });
223
+ }
208
224
  doAutoReloadId(r);
209
225
  emit('update', r);
210
226
  },
@@ -221,6 +237,14 @@
221
237
  }
222
238
  return;
223
239
  }
240
+ if (props.notificationType === NotificationType.Toast) {
241
+ openToast(<ToastConfig>{
242
+ text: LktSettings.defaultDropSuccessText,
243
+ details: LktSettings.defaultDropSuccessDetails,
244
+ icon: LktSettings.defaultDropSuccessIcon,
245
+ positionX: ToastPositionX.Right,
246
+ });
247
+ }
224
248
  emit('drop', r);
225
249
  if (props.view === ItemCrudView.Modal) {
226
250
  debug('onDrop -> close modal');