lkt-item-crud 2.0.3 → 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.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 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
+ import { httpCall as Re } from "lkt-http-client";
3
+ import { DataState as ve } from "lkt-data-state";
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
- import { __ as Ne } from "lkt-i18n";
7
- const K = class K {
6
+ import { __ as Ve } from "lkt-i18n";
7
+ import { openToast as j } from "lkt-toast";
8
+ const G = class G {
8
9
  };
9
- K.debugEnabled = !1, K.defaultSaveIcon = "", K.defaultDropIcon = "";
10
- let O = K;
11
- const b = (...k) => {
12
- O.debugEnabled && console.info("[LktItemCrud] ", ...k);
13
- }, Xe = (k = !0) => {
14
- O.debugEnabled = k;
15
- }, Ee = {
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
+ }, 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
+ }, Xe = {
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,164 +51,164 @@ 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(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
+ k(() => a.createButton, (t) => {
57
+ c.value = E(t, n.defaultCreateButton);
58
+ }, { deep: !0 }), k(() => a.updateButton, (t) => {
59
+ M.value = E(t, n.defaultUpdateButton);
60
+ }, { deep: !0 }), k(() => a.dropButton, (t) => {
61
+ d.value = E(t, n.defaultDropButton);
62
+ }, { deep: !0 }), k(() => a.editModeButton, (t) => {
63
+ r.value = E(t, n.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 m = be(), B = i(null), S = i(null), b = i(a.loading);
66
+ k(() => a.loading, (t) => b.value = t), k(b, (t) => o("update:loading", t));
67
+ const f = i(a.editing);
68
+ k(() => a.editing, (t) => f.value = t), k(f, (t) => o("update:editing", t));
69
+ const h = () => {
70
+ b.value = !0;
71
+ }, I = () => {
72
+ b.value = !1;
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);
78
79
  };
79
- W({
80
+ J({
80
81
  doSave: () => {
81
82
  B.value && typeof B.value.click == "function" && B.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 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
+ }), _ = y(() => {
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
+ D(t.$slots, "prev-buttons-ever")
102
103
  ], 512)), [
103
- [Q, !m.value]
104
- ]) : s("", !0),
105
- f(c)["prev-buttons"] ? J((i(), w("div", Le, [
106
- C(t.$slots, "prev-buttons")
104
+ [Z, !b.value]
105
+ ]) : v("", !0),
106
+ p(m)["prev-buttons"] ? Y((s(), U("div", Pe, [
107
+ D(t.$slots, "prev-buttons")
107
108
  ], 512)), [
108
- [Q, p.value && !m.value]
109
- ]) : s("", !0),
110
- t.mode === f(E).Update && P.value ? (i(), I(H, X({
109
+ [Z, f.value && !b.value]
110
+ ]) : v("", !0),
111
+ t.mode === p($).Update && P.value ? (s(), w(W, x({
111
112
  key: 2,
112
113
  ref_key: "saveButtonRef",
113
114
  ref: B
114
115
  }, M.value, {
115
- disabled: !T.value,
116
- onLoading: y,
117
- onLoaded: S,
118
- onClick: U
116
+ disabled: !X.value,
117
+ onLoading: h,
118
+ onLoaded: I,
119
+ onClick: T
119
120
  }), {
120
121
  default: V(() => [
121
- f(c)["button-save"] ? C(t.$slots, "button-save", {
122
+ p(m)["button-save"] ? D(t.$slots, "button-save", {
122
123
  key: 0,
123
124
  item: t.item,
124
- editMode: p.value,
125
+ editMode: f.value,
125
126
  isCreate: !1,
126
127
  canUpdate: t.canUpdate,
127
128
  canDrop: t.canDrop
128
- }) : s("", !0)
129
+ }) : v("", !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 === p($).Create && P.value ? (s(), w(W, x({
132
133
  key: 3,
133
134
  ref_key: "saveButtonRef",
134
135
  ref: B
135
- }, v.value, {
136
+ }, c.value, {
136
137
  disabled: !_.value,
137
- onLoading: y,
138
- onLoaded: S,
139
- onClick: j
138
+ onLoading: h,
139
+ onLoaded: I,
140
+ onClick: z
140
141
  }), {
141
142
  default: V(() => [
142
- f(c)["button-save"] ? C(t.$slots, "button-save", {
143
+ p(m)["button-save"] ? D(t.$slots, "button-save", {
143
144
  key: 0,
144
145
  item: t.item,
145
- editMode: p.value,
146
+ editMode: f.value,
146
147
  isCreate: !0,
147
148
  canUpdate: t.canUpdate,
148
149
  canDrop: t.canDrop
149
- }) : s("", !0)
150
+ }) : v("", !0)
150
151
  ]),
151
152
  _: 3
152
- }, 16, ["disabled"])) : s("", !0),
153
- t.mode !== f(E).Create ? J((i(), I(H, X({
153
+ }, 16, ["disabled"])) : v("", !0),
154
+ t.mode !== p($).Create ? Y((s(), w(W, x({
154
155
  key: 4,
155
156
  ref_key: "dropButtonRef",
156
- ref: D
157
- }, n.value, {
158
- disabled: !z.value,
159
- onLoading: y,
160
- onLoaded: S,
161
- onClick: q
157
+ ref: S
158
+ }, d.value, {
159
+ disabled: !H.value,
160
+ onLoading: h,
161
+ onLoaded: I,
162
+ onClick: F
162
163
  }), {
163
164
  default: V(() => [
164
- f(c)["button-drop"] ? C(t.$slots, "button-drop", {
165
+ p(m)["button-drop"] ? D(t.$slots, "button-drop", {
165
166
  key: 0,
166
167
  item: t.item,
167
- editMode: p.value,
168
+ editMode: f.value,
168
169
  isCreate: !1,
169
170
  canUpdate: t.canUpdate,
170
171
  canDrop: t.canDrop
171
- }) : s("", !0)
172
+ }) : v("", !0)
172
173
  ]),
173
174
  _: 3
174
175
  }, 16, ["disabled"])), [
175
- [Q, A.value]
176
- ]) : s("", !0),
177
- f(c).buttons ? J((i(), w("div", Ae, [
178
- C(t.$slots, "buttons")
176
+ [Z, A.value]
177
+ ]) : v("", !0),
178
+ p(m).buttons ? Y((s(), U("div", Xe, [
179
+ D(t.$slots, "buttons")
179
180
  ], 512)), [
180
- [Q, p.value && !m.value]
181
- ]) : 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),
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),
185
186
  class: "lkt-item-crud--switch-mode-button"
186
- }), null, 16, ["checked"])) : s("", !0)
187
- ])) : s("", !0);
187
+ }), null, 16, ["checked"])) : v("", !0)
188
+ ])) : v("", !0);
188
189
  };
189
190
  }
190
- }), Pe = { class: "lkt-item-crud" }, Te = {
191
+ }), _e = { class: "lkt-item-crud" }, Oe = {
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__ */ Be({
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
+ }, Ee(Ne)),
229
231
  emits: [
230
232
  "update:modelValue",
231
233
  "update:editing",
@@ -238,60 +240,102 @@ 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
+ setup(C, { expose: J, emit: ee }) {
244
+ const o = C, a = be(), c = ee;
243
245
  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;
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;
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), d.value = !1, f.value = e.httpStatus, !e.success) {
251
+ S.value = !1, f.value = e.httpStatus, c("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, m.value = e.perms, h.value.increment(r.value).turnStoredIntoOriginal(), I.value = h.value.changed(), z.value.turnStoredIntoOriginal(), c("read", e);
253
255
  } catch {
254
- n.value = !1, D.value = !1, p.value = 404, v("error", 404);
256
+ d.value = !1, S.value = !1, f.value = 404, c("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 (F.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
+ 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
+ }), k(() => o.readData, (e) => {
272
+ z.value.increment(e), z.value.changed() && A();
273
+ }), k(() => o.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
+ }), Se(() => {
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());
277
279
  });
278
280
  const P = (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 (d.value = !1, typeof e < "u" && (f.value = e.httpStatus, !e.success))
283
+ return b.value = !0, c("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
- }, 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));
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
+ });
297
+ return;
298
+ }
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);
289
305
  }, 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)));
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
312
+ });
313
+ return;
314
+ }
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
328
+ });
329
+ return;
330
+ }
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));
293
337
  };
294
- W({
338
+ J({
295
339
  doDrop: () => {
296
340
  L.value && L.value.doDrop();
297
341
  },
@@ -299,54 +343,54 @@ const b = (...k) => {
299
343
  doSave: () => {
300
344
  L.value && L.value.doSave();
301
345
  },
302
- hasModifiedData: () => y.value.changed()
346
+ hasModifiedData: () => h.value.changed()
303
347
  });
304
- const fe = g(() => {
348
+ const ge = y(() => {
305
349
  var e;
306
- return y.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
307
- }), me = (e) => {
350
+ return h.value.changed() ? (e = o.modalConfig) == null ? void 0 : e.closeConfirm : "";
351
+ }), ye = (e) => {
308
352
  var u;
309
353
  if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
310
354
  return o.modalConfig.beforeClose({
311
355
  ...e,
312
- itemCreated: Z.value
356
+ itemCreated: te.value
313
357
  });
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" ? {
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" ? {
315
359
  title: o.title,
316
- item: l.value,
360
+ item: r.value,
317
361
  ...o.modalConfig,
318
- "before-close": me,
319
- "close-confirm": fe.value
362
+ "before-close": ye,
363
+ "close-confirm": ge.value
320
364
  } : {});
321
365
  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)), {
366
+ const le = de("lkt-http-info"), Ce = de("lkt-loader");
367
+ return s(), w(Ie(re.value), Ue(we(ke.value)), {
324
368
  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,
330
- loading: n.value
369
+ Te("article", _e, [
370
+ !oe.value && he.value ? (s(), U("header", Oe, [
371
+ p(a)["pre-title"] ? (s(), U("div", je, [
372
+ D(e.$slots, "pre-title", {
373
+ item: r.value,
374
+ loading: d.value
331
375
  })
332
- ])) : 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,
337
- loading: n.value
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, [
379
+ D(e.$slots, "post-title", {
380
+ item: r.value,
381
+ loading: d.value
338
382
  })
339
- ])) : s("", !0)
340
- ])) : s("", !0),
341
- e.buttonNavPosition === f(se).Top ? (i(), I(ve, {
383
+ ])) : v("", !0)
384
+ ])) : v("", !0),
385
+ e.buttonNavPosition === p(ce).Top ? (s(), w(fe, {
342
386
  key: 1,
343
387
  ref_key: "buttonNav",
344
388
  ref: L,
345
- loading: n.value,
346
- "onUpdate:loading": u[0] || (u[0] = (R) => n.value = R),
389
+ loading: d.value,
390
+ "onUpdate:loading": u[0] || (u[0] = (R) => d.value = R),
347
391
  editing: B.value,
348
392
  "onUpdate:editing": u[1] || (u[1] = (R) => B.value = R),
349
- item: l.value,
393
+ item: r.value,
350
394
  mode: e.mode,
351
395
  view: e.view,
352
396
  "button-nav-visibility": e.buttonNavVisibility,
@@ -354,64 +398,64 @@ const b = (...k) => {
354
398
  "update-button": e.updateButton,
355
399
  "drop-button": e.dropButton,
356
400
  "edit-mode-button": e.editModeButton,
357
- "data-changed": S.value,
358
- "http-success-read": D.value,
359
- "can-update": T.value,
401
+ "data-changed": I.value,
402
+ "http-success-read": S.value,
403
+ "can-update": X.value,
360
404
  "can-drop": _.value,
361
- "can-switch-edit-mode": z.value,
362
- onCreate: G,
405
+ "can-switch-edit-mode": H.value,
406
+ onCreate: Q,
363
407
  onSave: t,
364
- onDrop: r
365
- }, le({ _: 2 }, [
366
- f(a)["prev-buttons-ever"] ? {
408
+ onDrop: l
409
+ }, se({ _: 2 }, [
410
+ p(a)["prev-buttons-ever"] ? {
367
411
  name: "prev-buttons-ever",
368
412
  fn: V(() => [
369
- C(e.$slots, "prev-buttons-ever")
413
+ D(e.$slots, "prev-buttons-ever")
370
414
  ]),
371
415
  key: "0"
372
416
  } : void 0,
373
- f(a)["prev-buttons"] ? {
417
+ p(a)["prev-buttons"] ? {
374
418
  name: "prev-buttons-ever",
375
419
  fn: V(() => [
376
- C(e.$slots, "prev-buttons")
420
+ D(e.$slots, "prev-buttons")
377
421
  ]),
378
422
  key: "1"
379
423
  } : void 0
380
- ]), 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, {
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, {
384
428
  key: 0,
385
- code: p.value,
429
+ code: f.value,
430
+ palette: f.value === 200 ? "success" : "danger",
386
431
  quick: "",
387
- palette: p.value === 200 ? "success" : "danger",
388
432
  "can-close": "",
389
- onClose: u[2] || (u[2] = (R) => m.value = !1)
390
- }, null, 8, ["code", "palette"])) : s("", !0),
391
- C(e.$slots, "item", {
392
- item: l.value,
393
- loading: n.value,
433
+ onClose: u[2] || (u[2] = (R) => b.value = !1)
434
+ }, null, 8, ["code", "palette"])) : v("", !0),
435
+ D(e.$slots, "item", {
436
+ item: r.value,
437
+ loading: d.value,
394
438
  editMode: B.value,
395
- isCreate: U.value,
396
- canUpdate: T.value,
439
+ isCreate: T.value,
440
+ canUpdate: X.value,
397
441
  canDrop: _.value,
398
- itemBeingEdited: q.value
442
+ itemBeingEdited: F.value
399
443
  })
400
- ])) : (i(), I(de, {
444
+ ])) : e.notificationType === p(N).Inline ? (s(), w(le, {
401
445
  key: 1,
402
- code: p.value
403
- }, null, 8, ["code"]))
446
+ code: f.value
447
+ }, null, 8, ["code"])) : v("", !0)
404
448
  ])),
405
- n.value ? (i(), I(ye, { key: 3 })) : s("", !0),
406
- e.buttonNavPosition === f(se).Bottom ? (i(), I(ve, {
449
+ d.value ? (s(), w(Ce, { key: 3 })) : v("", !0),
450
+ e.buttonNavPosition === p(ce).Bottom ? (s(), w(fe, {
407
451
  key: 4,
408
452
  ref_key: "buttonNav",
409
453
  ref: L,
410
- loading: n.value,
411
- "onUpdate:loading": u[3] || (u[3] = (R) => n.value = R),
454
+ loading: d.value,
455
+ "onUpdate:loading": u[3] || (u[3] = (R) => d.value = R),
412
456
  editing: B.value,
413
457
  "onUpdate:editing": u[4] || (u[4] = (R) => B.value = R),
414
- item: l.value,
458
+ item: r.value,
415
459
  mode: e.mode,
416
460
  view: e.view,
417
461
  "button-nav-visibility": e.buttonNavVisibility,
@@ -419,48 +463,48 @@ const b = (...k) => {
419
463
  "update-button": e.updateButton,
420
464
  "drop-button": e.dropButton,
421
465
  "edit-mode-button": e.editModeButton,
422
- "data-changed": S.value,
423
- "http-success-read": D.value,
424
- "can-update": T.value,
466
+ "data-changed": I.value,
467
+ "http-success-read": S.value,
468
+ "can-update": X.value,
425
469
  "can-drop": _.value,
426
- "can-switch-edit-mode": z.value,
427
- onCreate: G,
470
+ "can-switch-edit-mode": H.value,
471
+ onCreate: Q,
428
472
  onSave: t,
429
- onDrop: r
430
- }, le({ _: 2 }, [
431
- f(a)["prev-buttons-ever"] ? {
473
+ onDrop: l
474
+ }, se({ _: 2 }, [
475
+ p(a)["prev-buttons-ever"] ? {
432
476
  name: "prev-buttons-ever",
433
477
  fn: V(() => [
434
- C(e.$slots, "prev-buttons-ever")
478
+ D(e.$slots, "prev-buttons-ever")
435
479
  ]),
436
480
  key: "0"
437
481
  } : void 0,
438
- f(a)["prev-buttons"] ? {
482
+ p(a)["prev-buttons"] ? {
439
483
  name: "prev-buttons-ever",
440
484
  fn: V(() => [
441
- C(e.$slots, "prev-buttons")
485
+ D(e.$slots, "prev-buttons")
442
486
  ]),
443
487
  key: "1"
444
488
  } : void 0
445
- ]), 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)
446
490
  ])
447
491
  ]),
448
492
  _: 3
449
493
  }, 16);
450
494
  };
451
495
  }
452
- }), Ye = {
453
- install: (k, W = {}) => {
454
- k.component("lkt-item-crud") === void 0 && k.component("lkt-item-crud", Fe);
496
+ }), tt = {
497
+ install: (C, J = {}) => {
498
+ C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Ke);
455
499
  }
456
- }, Ze = (k) => {
457
- O.defaultSaveIcon = k;
458
- }, xe = (k) => {
459
- O.defaultDropIcon = k;
500
+ }, at = (C) => {
501
+ q.defaultSaveIcon = C;
502
+ }, ot = (C) => {
503
+ q.defaultDropIcon = C;
460
504
  };
461
505
  export {
462
- Xe as debugLktItemCrud,
463
- Ye as default,
464
- xe as setItemCrudDefaultDropIcon,
465
- Ze as setItemCrudDefaultSaveIcon
506
+ et as debugLktItemCrud,
507
+ tt as default,
508
+ ot as setItemCrudDefaultDropIcon,
509
+ at as setItemCrudDefaultSaveIcon
466
510
  };