lkt-item-crud 2.0.11 → 2.0.12

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 at(C?: boolean): void;
2
- declare namespace ot {
3
- function install(C: any, x?: {}): void;
1
+ declare function ot(C?: boolean): void;
2
+ declare namespace ut {
3
+ function install(C: any, ee?: {}): void;
4
4
  }
5
+ declare function dt(C: any): void;
5
6
  declare function nt(C: any): void;
6
- declare function ut(C: any): void;
7
- export { at as debugLktItemCrud, ot as default, nt as setItemCrudDefaultDropIcon, ut as setItemCrudDefaultSaveIcon };
7
+ export { ot as debugLktItemCrud, ut as default, dt as setItemCrudDefaultDropIcon, nt as setItemCrudDefaultSaveIcon };
package/dist/build.js CHANGED
@@ -1,31 +1,31 @@
1
- import { defineComponent as ye, ref as v, watch as h, useSlots as ke, computed as k, resolveComponent as se, createElementBlock as $, createCommentVNode as n, openBlock as i, createBlock as B, mergeProps as O, withCtx as R, renderSlot as g, withDirectives as Y, unref as d, vShow as Z, Fragment as De, mergeDefaults as Ue, nextTick as Se, onMounted as Ie, resolveDynamicComponent as we, normalizeProps as Me, guardReactiveProps as Re, createElementVNode as Te, toDisplayString as Ee, createSlots as ce } from "vue";
2
- import { httpCall as $e } from "lkt-http-client";
1
+ import { defineComponent as Be, ref as p, watch as h, useSlots as ke, computed as k, resolveComponent as se, createElementBlock as E, createCommentVNode as l, openBlock as m, createBlock as A, mergeProps as N, withCtx as M, renderSlot as g, withDirectives as V, unref as n, createVNode as K, vShow as O, Fragment as Ue, mergeDefaults as Se, nextTick as Ie, onMounted as we, resolveDynamicComponent as Me, normalizeProps as Re, guardReactiveProps as Te, createElementVNode as Ee, toDisplayString as $e, createSlots as ce } from "vue";
2
+ import { httpCall as Le } from "lkt-http-client";
3
3
  import { DataState as fe } from "lkt-data-state";
4
- import { ensureButtonConfig as j, LktSettings as r, ItemCrudMode as w, ItemCrudButtonNavVisibility as le, TablePermission as ie, ItemCrudView as me, ItemCrudButtonNavPosition as be, NotificationType as P, getDefaultValues as Ne, ItemCrud as Le, ToastPositionX as H } from "lkt-vue-kernel";
5
- import { closeModal as Ve } from "lkt-modal";
6
- import { __ as Oe } from "lkt-i18n";
7
- import { openToast as K } from "lkt-toast";
8
- const _ = class _ {
4
+ import { ensureButtonConfig as j, LktSettings as d, ItemCrudMode as w, ItemCrudButtonNavVisibility as me, TablePermission as ie, ItemCrudView as be, ItemCrudButtonNavPosition as ge, NotificationType as X, getDefaultValues as Ne, ItemCrud as Ve, ToastPositionX as W } from "lkt-vue-kernel";
5
+ import { closeModal as Oe } from "lkt-modal";
6
+ import { __ as je } from "lkt-i18n";
7
+ import { openToast as J } from "lkt-toast";
8
+ const x = class x {
9
9
  };
10
- _.debugEnabled = !1, _.defaultSaveIcon = "", _.defaultDropIcon = "";
11
- let W = _;
12
- const y = (...C) => {
13
- W.debugEnabled && console.info("[LktItemCrud] ", ...C);
14
- }, at = (C = !0) => {
15
- W.debugEnabled = C;
16
- }, je = {
17
- key: 0,
18
- class: "lkt-item-crud-buttons"
10
+ x.debugEnabled = !1, x.defaultSaveIcon = "", x.defaultDropIcon = "";
11
+ let Q = x;
12
+ const B = (...C) => {
13
+ Q.debugEnabled && console.info("[LktItemCrud] ", ...C);
14
+ }, ot = (C = !0) => {
15
+ Q.debugEnabled = C;
19
16
  }, Ae = {
20
17
  key: 0,
21
18
  class: "lkt-item-crud-buttons"
22
19
  }, Pe = {
23
- key: 1,
20
+ key: 0,
24
21
  class: "lkt-item-crud-buttons"
25
22
  }, Xe = {
26
- key: 5,
23
+ key: 1,
24
+ class: "lkt-item-crud-buttons"
25
+ }, Fe = {
26
+ key: 2,
27
27
  class: "lkt-item-crud-buttons"
28
- }, ge = /* @__PURE__ */ ye({
28
+ }, ye = /* @__PURE__ */ Be({
29
29
  __name: "ButtonNav",
30
30
  props: {
31
31
  item: { default: () => ({}) },
@@ -53,266 +53,270 @@ const y = (...C) => {
53
53
  "save",
54
54
  "drop"
55
55
  ],
56
- setup(C, { expose: x, emit: oe }) {
57
- const o = oe, a = C, b = v(j(a.createButton, r.defaultCreateButton)), s = v(j(a.updateButton, r.defaultUpdateButton)), l = v(j(a.dropButton, r.defaultDropButton)), D = v(j(a.editModeButton, r.defaultEditModeButton)), T = v(j(a.groupButton, r.defaultGroupButton));
56
+ setup(C, { expose: ee, emit: ue }) {
57
+ const o = ue, a = C, b = p(j(a.createButton, d.defaultCreateButton)), i = p(j(a.updateButton, d.defaultUpdateButton)), r = p(j(a.dropButton, d.defaultDropButton)), y = p(j(a.editModeButton, d.defaultEditModeButton)), R = p(j(a.groupButton, d.defaultGroupButton));
58
58
  h(() => a.createButton, (e) => {
59
- b.value = j(e, r.defaultCreateButton);
59
+ b.value = j(e, d.defaultCreateButton);
60
60
  }, { deep: !0 }), h(() => a.updateButton, (e) => {
61
- s.value = j(e, r.defaultUpdateButton);
61
+ i.value = j(e, d.defaultUpdateButton);
62
62
  }, { deep: !0 }), h(() => a.dropButton, (e) => {
63
- l.value = j(e, r.defaultDropButton);
63
+ r.value = j(e, d.defaultDropButton);
64
64
  }, { deep: !0 }), h(() => a.editModeButton, (e) => {
65
- D.value = j(e, r.defaultEditModeButton);
65
+ y.value = j(e, d.defaultEditModeButton);
66
66
  }, { deep: !0 });
67
- const c = ke(), I = v(null), U = v(null), p = v(a.loading);
68
- h(() => a.loading, (e) => p.value = e), h(p, (e) => o("update:loading", e));
69
- const f = v(a.editing);
70
- h(() => a.editing, (e) => f.value = e), h(f, (e) => o("update:editing", e));
71
- const N = () => {
72
- p.value = !0;
73
- }, S = () => {
74
- p.value = !1;
75
- }, G = (e, m) => {
76
- typeof e > "u" || o("create", e, m);
77
- }, J = (e, m) => {
78
- typeof e > "u" || o("save", e, m);
79
- }, L = (e, m) => {
80
- typeof e > "u" || o("drop", e, m);
67
+ const v = ke(), S = p(null), D = p(null), s = p(a.loading);
68
+ h(() => a.loading, (e) => s.value = e), h(s, (e) => o("update:loading", e));
69
+ const c = p(a.editing);
70
+ h(() => a.editing, (e) => c.value = e), h(c, (e) => o("update:editing", e));
71
+ const $ = () => {
72
+ s.value = !0;
73
+ }, U = () => {
74
+ s.value = !1;
75
+ }, G = (e, f) => {
76
+ typeof e > "u" || o("create", e, f);
77
+ }, Y = (e, f) => {
78
+ typeof e > "u" || o("save", e, f);
79
+ }, L = (e, f) => {
80
+ typeof e > "u" || o("drop", e, f);
81
81
  };
82
- x({
82
+ ee({
83
83
  doSave: () => {
84
- I.value && typeof I.value.click == "function" && I.value.click();
84
+ S.value && typeof S.value.click == "function" && S.value.click();
85
85
  },
86
86
  doDrop: () => {
87
- U.value && typeof U.value.click == "function" && U.value.click();
87
+ D.value && typeof D.value.click == "function" && D.value.click();
88
88
  }
89
89
  });
90
- const X = k(() => {
91
- var e, m;
92
- return a.mode !== w.Update || !a.canUpdate || !a.dataChanged ? !1 : typeof ((e = s.value) == null ? void 0 : e.disabled) == "function" ? !s.value.disabled(a.item) : typeof ((m = s.value) == null ? void 0 : m.disabled) == "boolean" ? !s.value.disabled : !0;
93
- }), V = k(() => {
94
- var e, m;
95
- return a.mode !== w.Create || !a.dataChanged ? !1 : typeof ((e = b.value) == null ? void 0 : e.disabled) == "function" ? !b.value.disabled(a.item) : typeof ((m = b.value) == null ? void 0 : m.disabled) == "boolean" ? !b.value.disabled : !0;
90
+ const Z = k(() => {
91
+ var e, f;
92
+ return a.mode !== w.Update || !a.canUpdate || !a.dataChanged ? !1 : typeof ((e = i.value) == null ? void 0 : e.disabled) == "function" ? !i.value.disabled(a.item) : typeof ((f = i.value) == null ? void 0 : f.disabled) == "boolean" ? !i.value.disabled : !0;
96
93
  }), F = k(() => {
97
- var e, m;
98
- return a.canDrop ? typeof ((e = l.value) == null ? void 0 : e.disabled) == "function" ? !l.value.disabled(a.item) : typeof ((m = l.value) == null ? void 0 : m.disabled) == "boolean" ? !l.value.disabled : !0 : !1;
99
- }), q = k(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !p.value && a.editing && a.httpSuccessRead), A = k(() => a.mode === w.Create && a.createButton === !1 || a.mode === w.Update && a.updateButton === !1 ? !1 : a.dataChanged ? X.value || V.value : p.value ? !1 : a.mode === w.Create ? !0 : a.buttonNavVisibility === le.Never ? !1 : a.editing && a.httpSuccessRead), z = k(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !p.value && a.mode !== w.Create && a.httpSuccessRead), ae = k(() => a.buttonNavVisibility === le.Always && (X.value || V.value || F.value) || c["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === le.Never ? !1 : A.value || q.value || z.value);
100
- return (e, m) => {
101
- const E = se("lkt-button");
102
- return ae.value ? (i(), $("div", je, [
103
- e.groupButton !== !1 ? (i(), B(E, O({
94
+ var e, f;
95
+ return a.mode !== w.Create || !a.dataChanged ? !1 : typeof ((e = b.value) == null ? void 0 : e.disabled) == "function" ? !b.value.disabled(a.item) : typeof ((f = b.value) == null ? void 0 : f.disabled) == "boolean" ? !b.value.disabled : !0;
96
+ }), q = k(() => {
97
+ var e, f;
98
+ return a.canDrop ? typeof ((e = r.value) == null ? void 0 : e.disabled) == "function" ? !r.value.disabled(a.item) : typeof ((f = r.value) == null ? void 0 : f.disabled) == "boolean" ? !r.value.disabled : !0 : !1;
99
+ }), z = k(() => !a.canDrop || a.dropButton === !1 ? !1 : !a.canUpdate && a.canDrop ? !0 : !s.value && a.editing && a.httpSuccessRead), P = k(() => a.mode === w.Create && a.createButton === !1 || a.mode === w.Update && a.updateButton === !1 || s.value ? !1 : a.editing && a.httpSuccessRead), H = k(() => a.editModeButton === !1 || !a.canSwitchEditMode || !a.canUpdate && !a.canDrop || !a.canUpdate && a.canDrop ? !1 : !s.value && a.mode !== w.Create && a.httpSuccessRead), oe = k(() => a.buttonNavVisibility === me.Always || v["prev-buttons-ever"] ? !0 : a.buttonNavVisibility === me.Never ? !1 : P.value || z.value || H.value);
100
+ return (e, f) => {
101
+ const T = se("lkt-button");
102
+ return oe.value ? (m(), E("div", Ae, [
103
+ e.groupButton !== !1 ? (m(), A(T, N({
104
104
  key: 0,
105
105
  ref: "groupButton"
106
- }, T.value, { class: "lkt-item-crud-group-button" }), {
107
- split: R(() => [
108
- z.value ? (i(), B(E, O({ key: 0 }, D.value, {
109
- checked: f.value,
110
- "onUpdate:checked": m[0] || (m[0] = (Q) => f.value = Q),
106
+ }, R.value, { class: "lkt-item-crud-group-button" }), {
107
+ split: M(() => [
108
+ H.value ? (m(), A(T, N({ key: 0 }, y.value, {
109
+ checked: c.value,
110
+ "onUpdate:checked": f[0] || (f[0] = (_) => c.value = _),
111
111
  class: "lkt-item-crud--switch-mode-button"
112
- }), null, 16, ["checked"])) : n("", !0),
113
- d(c)["prev-buttons-ever"] ? g(e.$slots, "prev-buttons-ever", {
112
+ }), null, 16, ["checked"])) : l("", !0),
113
+ n(v)["prev-buttons-ever"] ? g(e.$slots, "prev-buttons-ever", {
114
114
  key: 1,
115
115
  canUpdate: e.canUpdate,
116
116
  canDrop: e.canDrop,
117
117
  perms: e.perms
118
- }) : n("", !0),
119
- d(c)["prev-buttons"] ? g(e.$slots, "prev-buttons", {
118
+ }) : l("", !0),
119
+ n(v)["prev-buttons"] ? g(e.$slots, "prev-buttons", {
120
120
  key: 2,
121
121
  canUpdate: e.canUpdate,
122
122
  canDrop: e.canDrop,
123
123
  perms: e.perms
124
- }) : n("", !0),
125
- e.mode === d(w).Update && A.value ? (i(), B(E, O({
126
- key: 3,
124
+ }) : l("", !0),
125
+ V(K(T, N({
127
126
  ref_key: "saveButtonRef",
128
- ref: I
129
- }, s.value, {
130
- disabled: !X.value,
131
- onLoading: N,
132
- onLoaded: S,
133
- onClick: J
127
+ ref: S
128
+ }, i.value, {
129
+ disabled: !Z.value,
130
+ onLoading: $,
131
+ onLoaded: U,
132
+ onClick: Y
134
133
  }), {
135
- default: R(() => [
136
- d(c)["button-save"] ? g(e.$slots, "button-save", {
134
+ default: M(() => [
135
+ n(v)["button-save"] ? g(e.$slots, "button-save", {
137
136
  key: 0,
138
137
  item: e.item,
139
- editMode: f.value,
138
+ editMode: c.value,
140
139
  isCreate: !1,
141
140
  canUpdate: e.canUpdate,
142
141
  canDrop: e.canDrop
143
- }) : n("", !0)
142
+ }) : l("", !0)
144
143
  ]),
145
144
  _: 3
146
- }, 16, ["disabled"])) : e.mode === d(w).Create && A.value ? (i(), B(E, O({
147
- key: 4,
145
+ }, 16, ["disabled"]), [
146
+ [O, e.mode === n(w).Update && P.value]
147
+ ]),
148
+ V(K(T, N({
148
149
  ref_key: "saveButtonRef",
149
- ref: I
150
+ ref: S
150
151
  }, b.value, {
151
- disabled: !V.value,
152
- onLoading: N,
153
- onLoaded: S,
152
+ disabled: !F.value,
153
+ onLoading: $,
154
+ onLoaded: U,
154
155
  onClick: G
155
156
  }), {
156
- default: R(() => [
157
- d(c)["button-save"] ? g(e.$slots, "button-save", {
157
+ default: M(() => [
158
+ n(v)["button-save"] ? g(e.$slots, "button-save", {
158
159
  key: 0,
159
160
  item: e.item,
160
- editMode: f.value,
161
+ editMode: c.value,
161
162
  isCreate: !0,
162
163
  canUpdate: e.canUpdate,
163
164
  canDrop: e.canDrop
164
- }) : n("", !0)
165
+ }) : l("", !0)
165
166
  ]),
166
167
  _: 3
167
- }, 16, ["disabled"])) : n("", !0),
168
- e.mode !== d(w).Create ? Y((i(), B(E, O({
169
- key: 5,
168
+ }, 16, ["disabled"]), [
169
+ [O, e.mode === n(w).Create && P.value]
170
+ ]),
171
+ V(K(T, N({
170
172
  ref_key: "dropButtonRef",
171
- ref: U
172
- }, l.value, {
173
- disabled: !F.value,
174
- onLoading: N,
175
- onLoaded: S,
173
+ ref: D
174
+ }, r.value, {
175
+ disabled: !q.value,
176
+ onLoading: $,
177
+ onLoaded: U,
176
178
  onClick: L
177
179
  }), {
178
- default: R(() => [
179
- d(c)["button-drop"] ? g(e.$slots, "button-drop", {
180
+ default: M(() => [
181
+ n(v)["button-drop"] ? g(e.$slots, "button-drop", {
180
182
  key: 0,
181
183
  item: e.item,
182
- editMode: f.value,
184
+ editMode: c.value,
183
185
  isCreate: !1,
184
186
  canUpdate: e.canUpdate,
185
187
  canDrop: e.canDrop
186
- }) : n("", !0)
188
+ }) : l("", !0)
187
189
  ]),
188
190
  _: 3
189
- }, 16, ["disabled"])), [
190
- [Z, q.value]
191
- ]) : n("", !0),
192
- d(c).buttons ? g(e.$slots, "buttons", { key: 6 }) : n("", !0)
191
+ }, 16, ["disabled"]), [
192
+ [O, z.value && e.mode !== n(w).Create]
193
+ ]),
194
+ n(v).buttons ? g(e.$slots, "buttons", { key: 3 }) : l("", !0)
193
195
  ]),
194
196
  _: 3
195
- }, 16)) : (i(), $(De, { key: 1 }, [
196
- d(c)["prev-buttons-ever"] ? Y((i(), $("div", Ae, [
197
+ }, 16)) : (m(), E(Ue, { key: 1 }, [
198
+ n(v)["prev-buttons-ever"] ? V((m(), E("div", Pe, [
197
199
  g(e.$slots, "prev-buttons-ever", {
198
200
  canUpdate: e.canUpdate,
199
201
  canDrop: e.canDrop,
200
202
  perms: e.perms
201
203
  })
202
204
  ], 512)), [
203
- [Z, !p.value]
204
- ]) : n("", !0),
205
- d(c)["prev-buttons"] ? Y((i(), $("div", Pe, [
205
+ [O, !s.value]
206
+ ]) : l("", !0),
207
+ n(v)["prev-buttons"] ? V((m(), E("div", Xe, [
206
208
  g(e.$slots, "prev-buttons", {
207
209
  canUpdate: e.canUpdate,
208
210
  canDrop: e.canDrop,
209
211
  perms: e.perms
210
212
  })
211
213
  ], 512)), [
212
- [Z, f.value && !p.value]
213
- ]) : n("", !0),
214
- e.mode === d(w).Update && A.value ? (i(), B(E, O({
215
- key: 2,
214
+ [O, c.value && !s.value]
215
+ ]) : l("", !0),
216
+ V(K(T, N({
216
217
  ref_key: "saveButtonRef",
217
- ref: I
218
- }, s.value, {
219
- disabled: !X.value,
220
- onLoading: N,
221
- onLoaded: S,
222
- onClick: J
218
+ ref: S
219
+ }, i.value, {
220
+ disabled: !Z.value,
221
+ onLoading: $,
222
+ onLoaded: U,
223
+ onClick: Y
223
224
  }), {
224
- default: R(() => [
225
- d(c)["button-save"] ? g(e.$slots, "button-save", {
225
+ default: M(() => [
226
+ n(v)["button-save"] ? g(e.$slots, "button-save", {
226
227
  key: 0,
227
228
  item: e.item,
228
- editMode: f.value,
229
+ editMode: c.value,
229
230
  isCreate: !1,
230
231
  canUpdate: e.canUpdate,
231
232
  canDrop: e.canDrop
232
- }) : n("", !0)
233
+ }) : l("", !0)
233
234
  ]),
234
235
  _: 3
235
- }, 16, ["disabled"])) : e.mode === d(w).Create && A.value ? (i(), B(E, O({
236
- key: 3,
236
+ }, 16, ["disabled"]), [
237
+ [O, e.mode === n(w).Update && P.value]
238
+ ]),
239
+ V(K(T, N({
237
240
  ref_key: "saveButtonRef",
238
- ref: I
241
+ ref: S
239
242
  }, b.value, {
240
- disabled: !V.value,
241
- onLoading: N,
242
- onLoaded: S,
243
+ disabled: !F.value,
244
+ onLoading: $,
245
+ onLoaded: U,
243
246
  onClick: G
244
247
  }), {
245
- default: R(() => [
246
- d(c)["button-save"] ? g(e.$slots, "button-save", {
248
+ default: M(() => [
249
+ n(v)["button-save"] ? g(e.$slots, "button-save", {
247
250
  key: 0,
248
251
  item: e.item,
249
- editMode: f.value,
252
+ editMode: c.value,
250
253
  isCreate: !0,
251
254
  canUpdate: e.canUpdate,
252
255
  canDrop: e.canDrop
253
- }) : n("", !0)
256
+ }) : l("", !0)
254
257
  ]),
255
258
  _: 3
256
- }, 16, ["disabled"])) : n("", !0),
257
- e.mode !== d(w).Create ? Y((i(), B(E, O({
258
- key: 4,
259
+ }, 16, ["disabled"]), [
260
+ [O, e.mode === n(w).Create && P.value]
261
+ ]),
262
+ V(K(T, N({
259
263
  ref_key: "dropButtonRef",
260
- ref: U
261
- }, l.value, {
262
- disabled: !F.value,
263
- onLoading: N,
264
- onLoaded: S,
264
+ ref: D
265
+ }, r.value, {
266
+ disabled: !q.value,
267
+ onLoading: $,
268
+ onLoaded: U,
265
269
  onClick: L
266
270
  }), {
267
- default: R(() => [
268
- d(c)["button-drop"] ? g(e.$slots, "button-drop", {
271
+ default: M(() => [
272
+ n(v)["button-drop"] ? g(e.$slots, "button-drop", {
269
273
  key: 0,
270
274
  item: e.item,
271
- editMode: f.value,
275
+ editMode: c.value,
272
276
  isCreate: !1,
273
277
  canUpdate: e.canUpdate,
274
278
  canDrop: e.canDrop
275
- }) : n("", !0)
279
+ }) : l("", !0)
276
280
  ]),
277
281
  _: 3
278
- }, 16, ["disabled"])), [
279
- [Z, q.value]
280
- ]) : n("", !0),
281
- d(c).buttons ? Y((i(), $("div", Xe, [
282
+ }, 16, ["disabled"]), [
283
+ [O, z.value && e.mode !== n(w).Create]
284
+ ]),
285
+ n(v).buttons ? V((m(), E("div", Fe, [
282
286
  g(e.$slots, "buttons")
283
287
  ], 512)), [
284
- [Z, f.value && !p.value]
285
- ]) : n("", !0),
286
- z.value ? (i(), B(E, O({ key: 6 }, D.value, {
287
- checked: f.value,
288
- "onUpdate:checked": m[1] || (m[1] = (Q) => f.value = Q),
288
+ [O, c.value && !s.value]
289
+ ]) : l("", !0),
290
+ H.value ? (m(), A(T, N({ key: 3 }, y.value, {
291
+ checked: c.value,
292
+ "onUpdate:checked": f[1] || (f[1] = (_) => c.value = _),
289
293
  class: "lkt-item-crud--switch-mode-button"
290
- }), null, 16, ["checked"])) : n("", !0)
294
+ }), null, 16, ["checked"])) : l("", !0)
291
295
  ], 64))
292
- ])) : n("", !0);
296
+ ])) : l("", !0);
293
297
  };
294
298
  }
295
- }), Fe = { class: "lkt-item-crud" }, Ge = {
299
+ }), Ge = { class: "lkt-item-crud" }, qe = {
296
300
  key: 0,
297
301
  class: "lkt-item-crud_header"
298
- }, qe = {
302
+ }, ze = {
299
303
  key: 0,
300
304
  class: "lkt-item-crud_header-slot"
301
- }, ze = {
305
+ }, He = {
302
306
  key: 1,
303
307
  class: "lkt-item-crud_header-title"
304
- }, He = {
308
+ }, Ke = {
305
309
  key: 2,
306
310
  class: "lkt-item-crud_header-slot"
307
- }, Ke = {
311
+ }, We = {
308
312
  key: 2,
309
313
  class: "lkt-item-crud_content"
310
- }, We = {
314
+ }, Je = {
311
315
  key: 0,
312
316
  class: "lkt-grid-1"
313
- }, Je = /* @__PURE__ */ ye({
317
+ }, Qe = /* @__PURE__ */ Be({
314
318
  __name: "LktItemCrud",
315
- props: /* @__PURE__ */ Ue({
319
+ props: /* @__PURE__ */ Se({
316
320
  modelValue: {},
317
321
  editing: { type: Boolean },
318
322
  perms: {},
@@ -333,7 +337,7 @@ const y = (...C) => {
333
337
  title: {},
334
338
  beforeEmitUpdate: { type: Function },
335
339
  notificationType: {}
336
- }, Ne(Le)),
340
+ }, Ne(Ve)),
337
341
  emits: [
338
342
  "update:modelValue",
339
343
  "update:editing",
@@ -346,155 +350,155 @@ const y = (...C) => {
346
350
  "error",
347
351
  "modified-data"
348
352
  ],
349
- setup(C, { expose: x, emit: oe }) {
350
- const o = C, a = ke(), b = oe, s = v(!0), l = v(o.modelValue), D = v(o.perms), T = v(o.editing), c = v(!1), I = v(!1), U = v(200), p = v(new fe(l.value, o.dataStateConfig)), f = v(!1), N = v(new fe(o.readData)), S = v(o.mode === w.Create), G = v(!1), J = v(!1), L = v(null), ee = k(() => !S.value && Array.isArray(D.value) && D.value.includes(ie.Update)), te = k(() => !S.value && Array.isArray(D.value) && D.value.includes(ie.Drop)), X = k(() => !S.value && Array.isArray(D.value) && D.value.includes(ie.SwitchEditMode)), V = async () => {
351
- y("fetchItem"), s.value = !0, U.value = -1, I.value = !1;
353
+ setup(C, { expose: ee, emit: ue }) {
354
+ const o = C, a = ke(), b = ue, i = p(!0), r = p(o.modelValue), y = p(o.perms), R = p(o.editing), v = p(!1), S = p(!1), D = p(200), s = p(new fe(r.value, o.dataStateConfig)), c = p(!1), $ = p(new fe(o.readData)), U = p(o.mode === w.Create), G = p(!1), Y = p(!1), L = p(null), te = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.Update)), ae = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.Drop)), Z = k(() => !U.value && Array.isArray(y.value) && y.value.includes(ie.SwitchEditMode)), F = async () => {
355
+ B("fetchItem"), i.value = !0, D.value = -1, S.value = !1;
352
356
  try {
353
- const t = await $e(o.readResource, o.readData);
354
- if (y("fetchItem -> response", t), s.value = !1, U.value = t.httpStatus, !t.success) {
355
- c.value = !1, U.value = t.httpStatus, b("error", t.httpStatus);
357
+ const t = await Le(o.readResource, o.readData);
358
+ if (B("fetchItem -> response", t), i.value = !1, D.value = t.httpStatus, !t.success) {
359
+ v.value = !1, D.value = t.httpStatus, b("error", t.httpStatus);
356
360
  return;
357
361
  }
358
- c.value = !0, l.value = t.data, D.value = t.perms, p.value.increment(l.value).turnStoredIntoOriginal(), f.value = p.value.changed(), N.value.turnStoredIntoOriginal(), b("read", t);
362
+ v.value = !0, r.value = t.data, y.value = t.perms, s.value.increment(r.value).turnStoredIntoOriginal(), c.value = s.value.changed(), $.value.turnStoredIntoOriginal(), b("read", t);
359
363
  } catch {
360
- s.value = !1, c.value = !1, U.value = 404, b("error", 404);
364
+ i.value = !1, v.value = !1, D.value = 404, b("error", 404);
361
365
  return;
362
366
  }
363
367
  };
364
368
  h(() => o.modelValue, (t) => {
365
- l.value = t, p.value.increment(t);
366
- }, { deep: !0 }), h(l, (t) => {
367
- if (G.value = !0, y("item updated ->", l.value), typeof o.beforeEmitUpdate == "function") {
368
- y("item updated -> has beforeEmitUpdate");
369
- let u = o.beforeEmitUpdate(l.value);
370
- y("item updated -> override with: ", u), typeof u == "object" && (l.value = u);
369
+ r.value = t, s.value.increment(t);
370
+ }, { deep: !0 }), h(r, (t) => {
371
+ if (G.value = !0, B("item updated ->", r.value), typeof o.beforeEmitUpdate == "function") {
372
+ B("item updated -> has beforeEmitUpdate");
373
+ let u = o.beforeEmitUpdate(r.value);
374
+ B("item updated -> override with: ", u), typeof u == "object" && (r.value = u);
371
375
  }
372
- b("update:modelValue", l.value), y("item updated -> update dataState"), p.value.increment(t), f.value = p.value.changed(), Se(() => G.value = !1);
373
- }, { deep: !0 }), h(D, () => b("perms", D.value)), h(f, (t) => {
376
+ b("update:modelValue", r.value), B("item updated -> update dataState"), s.value.increment(t), c.value = s.value.changed(), Ie(() => G.value = !1);
377
+ }, { deep: !0 }), h(y, () => b("perms", y.value)), h(c, (t) => {
374
378
  b("modified-data", t);
375
379
  }), h(() => o.readData, (t) => {
376
- N.value.increment(t), N.value.changed() && V();
380
+ $.value.increment(t), $.value.changed() && F();
377
381
  }), h(() => o.editing, (t) => {
378
- y("editing updated -> updating editMode", t), T.value = t;
379
- }), h(T, (t) => {
380
- y("editMode updated -> emit update", t), b("update:editing", t);
381
- }), Ie(() => {
382
- o.readResource && !S.value ? V() : (S.value, c.value = !0, T.value = !0, s.value = !1, p.value.increment(l.value).turnStoredIntoOriginal(), f.value = p.value.changed());
382
+ B("editing updated -> updating editMode", t), R.value = t;
383
+ }), h(R, (t) => {
384
+ B("editMode updated -> emit update", t), b("update:editing", t);
385
+ }), we(() => {
386
+ o.readResource && !U.value ? F() : (U.value, v.value = !0, R.value = !0, i.value = !1, s.value.increment(r.value).turnStoredIntoOriginal(), c.value = s.value.changed());
383
387
  });
384
- const F = (t, u) => {
388
+ const q = (t, u) => {
385
389
  if (u) {
386
- if (s.value = !1, typeof t < "u" && (U.value = t.httpStatus, !t.success))
387
- return I.value = !0, b("error", t.httpStatus), !1;
388
- I.value = !0;
390
+ if (i.value = !1, typeof t < "u" && (D.value = t.httpStatus, !t.success))
391
+ return S.value = !0, b("error", t.httpStatus), !1;
392
+ S.value = !0;
389
393
  }
390
394
  return !0;
391
- }, q = (t) => {
392
- !ne.value && t.autoReloadId && (y("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), o.readData.id = t.autoReloadId, y("doAutoReloadId -> turning off create mode"), S.value = !1, V());
393
- }, A = (t, u) => {
394
- if (y("onCreate"), !F(u, o.createButton.resource)) {
395
- o.notificationType === P.Toast && K({
396
- text: r.defaultCreateErrorText,
397
- details: r.defaultCreateErrorDetails,
398
- icon: r.defaultCreateErrorIcon,
399
- positionX: H.Right
395
+ }, z = (t) => {
396
+ !de.value && typeof t < "u" && t.autoReloadId && (B("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), o.readData.id = t.autoReloadId, B("doAutoReloadId -> turning off create mode"), U.value = !1, F());
397
+ }, P = (t, u) => {
398
+ if (B("onCreate"), !q(u, o.createButton.resource)) {
399
+ o.notificationType === X.Toast && J({
400
+ text: d.defaultCreateErrorText,
401
+ details: d.defaultCreateErrorDetails,
402
+ icon: d.defaultCreateErrorIcon,
403
+ positionX: W.Right
400
404
  });
401
405
  return;
402
406
  }
403
- J.value = !0, y("onCreate -> turn stored data into original"), p.value.increment(l.value).turnStoredIntoOriginal(), o.notificationType === P.Toast && K({
404
- text: r.defaultCreateSuccessText,
405
- details: r.defaultCreateSuccessDetails,
406
- icon: r.defaultCreateSuccessIcon,
407
- positionX: H.Right
408
- }), q(u), b("create", u);
409
- }, z = (t, u) => {
410
- if (y("onUpdate"), !F(u, o.updateButton.resource)) {
411
- o.notificationType === P.Toast && K({
412
- text: r.defaultUpdateErrorText,
413
- details: r.defaultUpdateErrorDetails,
414
- icon: r.defaultUpdateErrorIcon,
415
- positionX: H.Right
407
+ Y.value = !0, B("onCreate -> turn stored data into original"), s.value.increment(r.value).turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
408
+ text: d.defaultCreateSuccessText,
409
+ details: d.defaultCreateSuccessDetails,
410
+ icon: d.defaultCreateSuccessIcon,
411
+ positionX: W.Right
412
+ }), z(u), b("create", u);
413
+ }, H = (t, u) => {
414
+ if (B("onUpdate"), !q(u, o.updateButton.resource)) {
415
+ o.notificationType === X.Toast && J({
416
+ text: d.defaultUpdateErrorText,
417
+ details: d.defaultUpdateErrorDetails,
418
+ icon: d.defaultUpdateErrorIcon,
419
+ positionX: W.Right
416
420
  });
417
421
  return;
418
422
  }
419
- y("onUpdate -> turn stored data into original"), p.value.turnStoredIntoOriginal(), o.notificationType === P.Toast && K({
420
- text: r.defaultUpdateSuccessText,
421
- details: r.defaultUpdateSuccessDetails,
422
- icon: r.defaultUpdateSuccessIcon,
423
- positionX: H.Right
424
- }), q(u), b("update", u);
425
- }, ae = (t, u) => {
426
- if (y("onDrop"), !F(u, o.dropButton.resource)) {
427
- o.notificationType === P.Toast && K({
428
- text: r.defaultDropErrorText,
429
- details: r.defaultDropErrorDetails,
430
- icon: r.defaultDropErrorIcon,
431
- positionX: H.Right
423
+ B("onUpdate -> turn stored data into original"), s.value.turnStoredIntoOriginal(), o.notificationType === X.Toast && J({
424
+ text: d.defaultUpdateSuccessText,
425
+ details: d.defaultUpdateSuccessDetails,
426
+ icon: d.defaultUpdateSuccessIcon,
427
+ positionX: W.Right
428
+ }), z(u), b("update", u);
429
+ }, oe = (t, u) => {
430
+ if (B("onDrop"), !q(u, o.dropButton.resource)) {
431
+ o.notificationType === X.Toast && J({
432
+ text: d.defaultDropErrorText,
433
+ details: d.defaultDropErrorDetails,
434
+ icon: d.defaultDropErrorIcon,
435
+ positionX: W.Right
432
436
  });
433
437
  return;
434
438
  }
435
- o.notificationType === P.Toast && K({
436
- text: r.defaultDropSuccessText,
437
- details: r.defaultDropSuccessDetails,
438
- icon: r.defaultDropSuccessIcon,
439
- positionX: H.Right
440
- }), b("drop", u), o.view === me.Modal && (y("onDrop -> close modal"), Ve(o.modalConfig.modalName, o.modalConfig.modalKey));
439
+ o.notificationType === X.Toast && J({
440
+ text: d.defaultDropSuccessText,
441
+ details: d.defaultDropSuccessDetails,
442
+ icon: d.defaultDropSuccessIcon,
443
+ positionX: W.Right
444
+ }), b("drop", u), o.view === be.Modal && (B("onDrop -> close modal"), Oe(o.modalConfig.modalName, o.modalConfig.modalKey));
441
445
  };
442
- x({
446
+ ee({
443
447
  doDrop: () => {
444
448
  L.value && L.value.doDrop();
445
449
  },
446
- doRefresh: V,
450
+ doRefresh: F,
447
451
  doSave: () => {
448
452
  L.value && L.value.doSave();
449
453
  },
450
- hasModifiedData: () => p.value.changed()
454
+ hasModifiedData: () => s.value.changed()
451
455
  });
452
- const E = k(() => {
456
+ const T = k(() => {
453
457
  var t;
454
- return p.value.changed() ? (t = o.modalConfig) == null ? void 0 : t.closeConfirm : "";
455
- }), Q = (t) => {
458
+ return s.value.changed() ? (t = o.modalConfig) == null ? void 0 : t.closeConfirm : "";
459
+ }), _ = (t) => {
456
460
  var u;
457
461
  if (typeof ((u = o.modalConfig) == null ? void 0 : u.beforeClose) == "function")
458
462
  return o.modalConfig.beforeClose({
459
463
  ...t,
460
- itemCreated: J.value
464
+ itemCreated: Y.value
461
465
  });
462
- }, ue = k(() => o.title.startsWith("__:") ? String(Oe(o.title.substring(3))) : o.title), Be = k(() => s.value ? !1 : ue.value.length > 0 || !!a["post-title"]), ne = k(() => o.view === me.Modal), pe = k(() => ne.value ? "lkt-modal" : "section"), he = k(() => pe.value === "lkt-modal" ? {
466
+ }, ne = k(() => o.title.startsWith("__:") ? String(je(o.title.substring(3))) : o.title), he = k(() => i.value ? !1 : ne.value.length > 0 || !!a["post-title"]), de = k(() => o.view === be.Modal), pe = k(() => de.value ? "lkt-modal" : "section"), Ce = k(() => pe.value === "lkt-modal" ? {
463
467
  title: o.title,
464
- item: l.value,
468
+ item: r.value,
465
469
  ...o.modalConfig,
466
- beforeClose: Q,
467
- closeConfirm: E.value
470
+ beforeClose: _,
471
+ closeConfirm: T.value
468
472
  } : {});
469
473
  return (t, u) => {
470
- const ve = se("lkt-http-info"), Ce = se("lkt-loader");
471
- return i(), B(we(pe.value), Me(Re(he.value)), {
472
- default: R(() => [
473
- Te("article", Fe, [
474
- !ne.value && Be.value ? (i(), $("header", Ge, [
475
- d(a)["pre-title"] ? (i(), $("div", qe, [
474
+ const ve = se("lkt-http-info"), De = se("lkt-loader");
475
+ return m(), A(Me(pe.value), Re(Te(Ce.value)), {
476
+ default: M(() => [
477
+ Ee("article", Ge, [
478
+ !de.value && he.value ? (m(), E("header", qe, [
479
+ n(a)["pre-title"] ? (m(), E("div", ze, [
476
480
  g(t.$slots, "pre-title", {
477
- item: l.value,
478
- loading: s.value
481
+ item: r.value,
482
+ loading: i.value
479
483
  })
480
- ])) : n("", !0),
481
- ue.value.length > 0 ? (i(), $("h1", ze, Ee(ue.value), 1)) : n("", !0),
482
- d(a)["post-title"] ? (i(), $("div", He, [
484
+ ])) : l("", !0),
485
+ ne.value.length > 0 ? (m(), E("h1", He, $e(ne.value), 1)) : l("", !0),
486
+ n(a)["post-title"] ? (m(), E("div", Ke, [
483
487
  g(t.$slots, "post-title", {
484
- item: l.value,
485
- loading: s.value
488
+ item: r.value,
489
+ loading: i.value
486
490
  })
487
- ])) : n("", !0)
488
- ])) : n("", !0),
489
- t.buttonNavPosition === d(be).Top ? (i(), B(ge, {
491
+ ])) : l("", !0)
492
+ ])) : l("", !0),
493
+ t.buttonNavPosition === n(ge).Top ? (m(), A(ye, {
490
494
  key: 1,
491
495
  ref_key: "buttonNav",
492
496
  ref: L,
493
- loading: s.value,
494
- "onUpdate:loading": u[0] || (u[0] = (M) => s.value = M),
495
- editing: T.value,
496
- "onUpdate:editing": u[1] || (u[1] = (M) => T.value = M),
497
- item: l.value,
497
+ loading: i.value,
498
+ "onUpdate:loading": u[0] || (u[0] = (I) => i.value = I),
499
+ editing: R.value,
500
+ "onUpdate:editing": u[1] || (u[1] = (I) => R.value = I),
501
+ item: r.value,
498
502
  mode: t.mode,
499
503
  view: t.view,
500
504
  "button-nav-visibility": t.buttonNavVisibility,
@@ -503,73 +507,74 @@ const y = (...C) => {
503
507
  "drop-button": t.dropButton,
504
508
  "edit-mode-button": t.editModeButton,
505
509
  "group-button": t.groupButton,
506
- "data-changed": f.value,
507
- "http-success-read": c.value,
508
- "can-update": ee.value,
509
- "can-drop": te.value,
510
- "can-switch-edit-mode": X.value,
511
- perms: D.value,
512
- onCreate: A,
513
- onSave: z,
514
- onDrop: ae
510
+ "data-changed": c.value,
511
+ "http-success-read": v.value,
512
+ "can-update": te.value,
513
+ "can-drop": ae.value,
514
+ "can-switch-edit-mode": Z.value,
515
+ perms: y.value,
516
+ onCreate: P,
517
+ onSave: H,
518
+ onDrop: oe
515
519
  }, ce({ _: 2 }, [
516
- d(a)["prev-buttons-ever"] ? {
520
+ n(a)["prev-buttons-ever"] ? {
517
521
  name: "prev-buttons-ever",
518
- fn: R(({ canUpdate: M, canDrop: de, perms: re }) => [
522
+ fn: M(({ canUpdate: I, canDrop: re, perms: le }) => [
519
523
  g(t.$slots, "prev-buttons-ever", {
520
- canUpdate: M,
521
- canDrop: de,
522
- perms: re
524
+ canUpdate: I,
525
+ canDrop: re,
526
+ perms: le
523
527
  })
524
528
  ]),
525
529
  key: "0"
526
530
  } : void 0,
527
- d(a)["prev-buttons"] ? {
531
+ n(a)["prev-buttons"] ? {
528
532
  name: "prev-buttons",
529
- fn: R(({ canUpdate: M, canDrop: de, perms: re }) => [
533
+ fn: M(({ canUpdate: I, canDrop: re, perms: le }) => [
530
534
  g(t.$slots, "prev-buttons", {
531
- canUpdate: M,
532
- canDrop: de,
533
- perms: re
535
+ canUpdate: I,
536
+ canDrop: re,
537
+ perms: le
534
538
  })
535
539
  ]),
536
540
  key: "1"
537
541
  } : void 0
538
- ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode", "perms"])) : n("", !0),
539
- s.value ? n("", !0) : (i(), $("div", Ke, [
540
- c.value ? (i(), $("div", We, [
541
- I.value && t.notificationType === d(P).Inline ? (i(), B(ve, {
542
+ ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode", "perms"])) : l("", !0),
543
+ i.value ? l("", !0) : (m(), E("div", We, [
544
+ v.value ? (m(), E("div", Je, [
545
+ S.value && t.notificationType === n(X).Inline ? (m(), A(ve, {
542
546
  key: 0,
543
- code: U.value,
544
- palette: U.value === 200 ? "success" : "danger",
547
+ code: D.value,
548
+ palette: D.value === 200 ? "success" : "danger",
545
549
  quick: "",
546
550
  "can-close": "",
547
- onClose: u[2] || (u[2] = (M) => I.value = !1)
548
- }, null, 8, ["code", "palette"])) : n("", !0),
551
+ onClose: u[2] || (u[2] = (I) => S.value = !1)
552
+ }, null, 8, ["code", "palette"])) : l("", !0),
549
553
  g(t.$slots, "item", {
550
- item: l.value,
551
- loading: s.value,
552
- editMode: T.value,
553
- isCreate: S.value,
554
- canUpdate: ee.value,
555
- canDrop: te.value,
556
- itemBeingEdited: G.value
554
+ item: r.value,
555
+ loading: i.value,
556
+ editMode: R.value,
557
+ isCreate: U.value,
558
+ canUpdate: te.value,
559
+ canDrop: ae.value,
560
+ itemBeingEdited: G.value,
561
+ perms: y.value
557
562
  })
558
- ])) : t.notificationType === d(P).Inline ? (i(), B(ve, {
563
+ ])) : t.notificationType === n(X).Inline ? (m(), A(ve, {
559
564
  key: 1,
560
- code: U.value
561
- }, null, 8, ["code"])) : n("", !0)
565
+ code: D.value
566
+ }, null, 8, ["code"])) : l("", !0)
562
567
  ])),
563
- s.value ? (i(), B(Ce, { key: 3 })) : n("", !0),
564
- t.buttonNavPosition === d(be).Bottom ? (i(), B(ge, {
568
+ i.value ? (m(), A(De, { key: 3 })) : l("", !0),
569
+ t.buttonNavPosition === n(ge).Bottom ? (m(), A(ye, {
565
570
  key: 4,
566
571
  ref_key: "buttonNav",
567
572
  ref: L,
568
- loading: s.value,
569
- "onUpdate:loading": u[3] || (u[3] = (M) => s.value = M),
570
- editing: T.value,
571
- "onUpdate:editing": u[4] || (u[4] = (M) => T.value = M),
572
- item: l.value,
573
+ loading: i.value,
574
+ "onUpdate:loading": u[3] || (u[3] = (I) => i.value = I),
575
+ editing: R.value,
576
+ "onUpdate:editing": u[4] || (u[4] = (I) => R.value = I),
577
+ item: r.value,
573
578
  mode: t.mode,
574
579
  view: t.view,
575
580
  "button-nav-visibility": t.buttonNavVisibility,
@@ -578,48 +583,49 @@ const y = (...C) => {
578
583
  "drop-button": t.dropButton,
579
584
  "edit-mode-button": t.editModeButton,
580
585
  "group-button": t.groupButton,
581
- "data-changed": f.value,
582
- "http-success-read": c.value,
583
- "can-update": ee.value,
584
- "can-drop": te.value,
585
- "can-switch-edit-mode": X.value,
586
- onCreate: A,
587
- onSave: z,
588
- onDrop: ae
586
+ "data-changed": c.value,
587
+ "http-success-read": v.value,
588
+ "can-update": te.value,
589
+ "can-drop": ae.value,
590
+ "can-switch-edit-mode": Z.value,
591
+ perms: y.value,
592
+ onCreate: P,
593
+ onSave: H,
594
+ onDrop: oe
589
595
  }, ce({ _: 2 }, [
590
- d(a)["prev-buttons-ever"] ? {
596
+ n(a)["prev-buttons-ever"] ? {
591
597
  name: "prev-buttons-ever",
592
- fn: R(() => [
598
+ fn: M(() => [
593
599
  g(t.$slots, "prev-buttons-ever")
594
600
  ]),
595
601
  key: "0"
596
602
  } : void 0,
597
- d(a)["prev-buttons"] ? {
603
+ n(a)["prev-buttons"] ? {
598
604
  name: "prev-buttons-ever",
599
- fn: R(() => [
605
+ fn: M(() => [
600
606
  g(t.$slots, "prev-buttons")
601
607
  ]),
602
608
  key: "1"
603
609
  } : void 0
604
- ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode"])) : n("", !0)
610
+ ]), 1032, ["loading", "editing", "item", "mode", "view", "button-nav-visibility", "create-button", "update-button", "drop-button", "edit-mode-button", "group-button", "data-changed", "http-success-read", "can-update", "can-drop", "can-switch-edit-mode", "perms"])) : l("", !0)
605
611
  ])
606
612
  ]),
607
613
  _: 3
608
614
  }, 16);
609
615
  };
610
616
  }
611
- }), ot = {
612
- install: (C, x = {}) => {
613
- C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Je);
617
+ }), ut = {
618
+ install: (C, ee = {}) => {
619
+ C.component("lkt-item-crud") === void 0 && C.component("lkt-item-crud", Qe);
614
620
  }
615
- }, ut = (C) => {
616
- W.defaultSaveIcon = C;
617
621
  }, nt = (C) => {
618
- W.defaultDropIcon = C;
622
+ Q.defaultSaveIcon = C;
623
+ }, dt = (C) => {
624
+ Q.defaultDropIcon = C;
619
625
  };
620
626
  export {
621
- at as debugLktItemCrud,
622
- ot as default,
623
- nt as setItemCrudDefaultDropIcon,
624
- ut as setItemCrudDefaultSaveIcon
627
+ ot as debugLktItemCrud,
628
+ ut as default,
629
+ dt as setItemCrudDefaultDropIcon,
630
+ nt as setItemCrudDefaultSaveIcon
625
631
  };
@@ -29,6 +29,7 @@ declare var __VLS_6: {
29
29
  canUpdate: boolean;
30
30
  canDrop: boolean;
31
31
  itemBeingEdited: boolean;
32
+ perms: string[];
32
33
  }, __VLS_54: {}, __VLS_56: {};
33
34
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
34
35
  'pre-title'?: (props: typeof __VLS_6) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.11",
3
+ "version": "2.0.12",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -154,18 +154,15 @@
154
154
  showSaveButton = computed(() => {
155
155
  if (props.mode === ItemCrudMode.Create && props.createButton === false) return false;
156
156
  if (props.mode === ItemCrudMode.Update && props.updateButton === false) return false;
157
- if (props.dataChanged) {
158
- return ableToUpdate.value || ableToCreate.value;
159
- }
160
157
  if (isLoading.value) return false;
161
158
 
162
- if (props.mode === ItemCrudMode.Create) {
163
- return true;
164
- }
159
+ // if (props.dataChanged) {
160
+ // return ableToUpdate.value || ableToCreate.value;
161
+ // }
165
162
 
166
- if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
167
- return false;
168
- }
163
+ // if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
164
+ // return false;
165
+ // }
169
166
 
170
167
  return props.editing
171
168
  && props.httpSuccessRead;
@@ -181,7 +178,7 @@
181
178
  && props.httpSuccessRead;
182
179
  }),
183
180
  showButtons = computed(() => {
184
- if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Always && (ableToUpdate.value || ableToCreate.value || ableToDrop.value)) return true;
181
+ if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Always) return true;
185
182
  if (slots['prev-buttons-ever']) return true;
186
183
  if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) return false;
187
184
  return showSaveButton.value || showDropButton.value || showSwitchButton.value;
@@ -224,7 +221,7 @@
224
221
 
225
222
  <lkt-button
226
223
  ref="saveButtonRef"
227
- v-if="mode === ItemCrudMode.Update && showSaveButton"
224
+ v-show="mode === ItemCrudMode.Update && showSaveButton"
228
225
  v-bind="safeUpdateButton"
229
226
  :disabled="!ableToUpdate"
230
227
  @loading="onButtonLoading"
@@ -239,7 +236,7 @@
239
236
 
240
237
  <lkt-button
241
238
  ref="saveButtonRef"
242
- v-else-if="mode === ItemCrudMode.Create && showSaveButton"
239
+ v-show="mode === ItemCrudMode.Create && showSaveButton"
243
240
  v-bind="safeCreateButton"
244
241
  :disabled="!ableToCreate"
245
242
  @loading="onButtonLoading"
@@ -254,8 +251,7 @@
254
251
 
255
252
  <lkt-button
256
253
  ref="dropButtonRef"
257
- v-show="showDropButton"
258
- v-if="mode !== ItemCrudMode.Create"
254
+ v-show="showDropButton && mode !== ItemCrudMode.Create"
259
255
  v-bind="safeDropButton"
260
256
  :disabled="!ableToDrop"
261
257
  @loading="onButtonLoading"
@@ -295,7 +291,7 @@
295
291
 
296
292
  <lkt-button
297
293
  ref="saveButtonRef"
298
- v-if="mode === ItemCrudMode.Update && showSaveButton"
294
+ v-show="mode === ItemCrudMode.Update && showSaveButton"
299
295
  v-bind="safeUpdateButton"
300
296
  :disabled="!ableToUpdate"
301
297
  @loading="onButtonLoading"
@@ -310,7 +306,7 @@
310
306
 
311
307
  <lkt-button
312
308
  ref="saveButtonRef"
313
- v-else-if="mode === ItemCrudMode.Create && showSaveButton"
309
+ v-show="mode === ItemCrudMode.Create && showSaveButton"
314
310
  v-bind="safeCreateButton"
315
311
  :disabled="!ableToCreate"
316
312
  @loading="onButtonLoading"
@@ -325,8 +321,7 @@
325
321
 
326
322
  <lkt-button
327
323
  ref="dropButtonRef"
328
- v-show="showDropButton"
329
- v-if="mode !== ItemCrudMode.Create"
324
+ v-show="showDropButton && mode !== ItemCrudMode.Create"
330
325
  v-bind="safeDropButton"
331
326
  :disabled="!ableToDrop"
332
327
  @loading="onButtonLoading"
@@ -171,8 +171,8 @@
171
171
  }
172
172
  return true;
173
173
  },
174
- doAutoReloadId = (r: HTTPResponse) => {
175
- if (!computedInsideModal.value && r.autoReloadId) {
174
+ doAutoReloadId = (r?: HTTPResponse) => {
175
+ if (!computedInsideModal.value && typeof r !== 'undefined' && r.autoReloadId) {
176
176
  debug('doAutoReloadId -> autoReloadId detected: ', r.autoReloadId);
177
177
  props.readData['id'] = r.autoReloadId;
178
178
  debug('doAutoReloadId -> turning off create mode');
@@ -393,11 +393,16 @@
393
393
  quick
394
394
  can-close
395
395
  v-on:close="showStoreMessage = false" />
396
- <slot name="item" :item="item" :loading="isLoading" :edit-mode="editMode"
396
+ <slot name="item"
397
+ :item="item"
398
+ :loading="isLoading"
399
+ :edit-mode="editMode"
397
400
  :is-create="createMode"
398
401
  :can-update="canUpdate"
399
402
  :can-drop="canDrop"
400
- :item-being-edited="itemBeingEdited"></slot>
403
+ :item-being-edited="itemBeingEdited"
404
+ :perms="perms"
405
+ />
401
406
  </div>
402
407
  <lkt-http-info :code="httpStatus" v-else-if="notificationType === NotificationType.Inline" />
403
408
  </div>
@@ -422,6 +427,7 @@
422
427
  :can-update="canUpdate"
423
428
  :can-drop="canDrop"
424
429
  :can-switch-edit-mode="canSwitchEditMode"
430
+ :perms="perms"
425
431
  @create="onCreate"
426
432
  @save="onUpdate"
427
433
  @drop="onDrop"