lkt-item-crud 2.0.2 → 2.0.4

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