lkt-item-crud 2.0.18 → 2.0.19

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 ct(T?: boolean): void;
2
- declare namespace mt {
3
- function install(T: any, te?: {}): void;
1
+ declare function gt(T?: boolean): void;
2
+ declare namespace yt {
3
+ function install(T: any, ae?: {}): void;
4
4
  }
5
- declare function gt(T: any): void;
6
- declare function bt(T: any): void;
7
- export { ct as debugLktItemCrud, mt as default, gt as setItemCrudDefaultDropIcon, bt as setItemCrudDefaultSaveIcon };
5
+ declare function kt(T: any): void;
6
+ declare function Bt(T: any): void;
7
+ export { gt as debugLktItemCrud, yt as default, kt as setItemCrudDefaultDropIcon, Bt as setItemCrudDefaultSaveIcon };
package/dist/build.js CHANGED
@@ -1,32 +1,32 @@
1
- import { defineComponent as Me, useSlots as Te, ref as f, watch as k, computed as S, resolveComponent as ke, createElementBlock as N, createCommentVNode as d, openBlock as b, createBlock as j, Fragment as Ce, renderSlot as s, withDirectives as $, mergeProps as R, unref as u, createVNode as G, withCtx as C, vShow as L, mergeDefaults as $e, nextTick as Le, onMounted as Ne, resolveDynamicComponent as Oe, createSlots as re, createElementVNode as Ve, toDisplayString as je } from "vue";
2
- import { httpCall as Pe } from "lkt-http-client";
3
- import { DataState as Ue } from "lkt-data-state";
4
- import { ItemCrudMode as I, ItemCrudButtonNavVisibility as Se, TablePermission as ge, ensureButtonConfig as q, LktSettings as i, ItemCrudView as Ie, ItemCrudButtonNavPosition as ye, NotificationType as J, getDefaultValues as Xe, ItemCrud as Fe, ToastPositionX as Z } from "lkt-vue-kernel";
5
- import { closeModal as We, updateModalKey as Ke } from "lkt-modal";
6
- import { __ as Ge } from "lkt-i18n";
1
+ import { defineComponent as we, useSlots as Re, ref as c, watch as D, computed as U, resolveComponent as le, createElementBlock as N, createCommentVNode as d, openBlock as m, createBlock as O, Fragment as Se, renderSlot as s, withDirectives as $, mergeProps as R, unref as u, createVNode as q, withCtx as C, vShow as L, mergeDefaults as Ne, nextTick as Ve, onMounted as je, resolveDynamicComponent as Pe, createSlots as re, createElementVNode as Xe, toDisplayString as Fe } from "vue";
2
+ import { httpCall as We } from "lkt-http-client";
3
+ import { DataState as Ie } from "lkt-data-state";
4
+ import { ItemCrudMode as S, ItemCrudButtonNavVisibility as Me, TablePermission as ke, ensureButtonConfig as z, LktSettings as i, ItemCrudView as Te, ItemCrudButtonNavPosition as De, NotificationType as J, getDefaultValues as Ke, ItemCrud as Ge, ToastPositionX as Z } from "lkt-vue-kernel";
5
+ import { closeModal as He, updateModalKey as qe } from "lkt-modal";
6
+ import { __ as ze } from "lkt-i18n";
7
7
  import { openToast as _ } from "lkt-toast";
8
- import { useRouter as qe } from "vue-router";
9
- const ee = class ee {
8
+ import { useRouter as Je } from "vue-router";
9
+ const te = class te {
10
10
  };
11
- ee.debugEnabled = !1, ee.defaultSaveIcon = "", ee.defaultDropIcon = "";
12
- let x = ee;
13
- const B = (...T) => {
11
+ te.debugEnabled = !1, te.defaultSaveIcon = "", te.defaultDropIcon = "";
12
+ let x = te;
13
+ const k = (...T) => {
14
14
  x.debugEnabled && console.info("[LktItemCrud] ", ...T);
15
- }, ct = (T = !0) => {
15
+ }, gt = (T = !0) => {
16
16
  x.debugEnabled = T;
17
- }, He = {
17
+ }, Qe = {
18
18
  key: 0,
19
19
  class: "lkt-item-crud-buttons"
20
- }, ze = {
20
+ }, Ye = {
21
21
  key: 0,
22
22
  class: "lkt-item-crud-buttons"
23
- }, Je = {
23
+ }, Ze = {
24
24
  key: 1,
25
25
  class: "lkt-item-crud-buttons"
26
- }, Qe = {
26
+ }, _e = {
27
27
  key: 2,
28
28
  class: "lkt-item-crud-buttons"
29
- }, Be = /* @__PURE__ */ Me({
29
+ }, he = /* @__PURE__ */ we({
30
30
  __name: "ButtonNav",
31
31
  props: {
32
32
  item: { default: () => ({}) },
@@ -59,38 +59,38 @@ const B = (...T) => {
59
59
  "save",
60
60
  "drop"
61
61
  ],
62
- setup(T, { expose: te, emit: le }) {
63
- const a = le, r = T, l = Te(), c = f(null), p = f(null), n = f(r.loading);
64
- k(() => r.loading, (e) => n.value = e), k(n, (e) => a("update:loading", e));
65
- const m = f(r.editing);
66
- k(() => r.editing, (e) => m.value = e), k(m, (e) => a("update:editing", e));
67
- const v = () => {
62
+ setup(T, { expose: ae, emit: ie }) {
63
+ const a = ie, r = T, l = Re(), b = c(null), v = c(null), n = c(r.loading);
64
+ D(() => r.loading, (e) => n.value = e), D(n, (e) => a("update:loading", e));
65
+ const g = c(r.editing);
66
+ D(() => r.editing, (e) => g.value = e), D(g, (e) => a("update:editing", e));
67
+ const f = () => {
68
68
  n.value = !0;
69
- }, g = () => {
69
+ }, y = () => {
70
70
  n.value = !1;
71
- }, A = (e, D) => {
72
- typeof e > "u" || a("create", e, D);
73
- }, P = (e, D) => {
74
- typeof e > "u" || a("save", e, D);
75
- }, E = (e, D) => {
76
- typeof e > "u" || a("drop", e, D);
71
+ }, X = (e, B) => {
72
+ typeof e > "u" || a("create", e, B);
73
+ }, A = (e, B) => {
74
+ typeof e > "u" || a("save", e, B);
75
+ }, F = (e, B) => {
76
+ typeof e > "u" || a("drop", e, B);
77
77
  };
78
- te({
78
+ ae({
79
79
  doSave: () => {
80
- c.value && typeof c.value.click == "function" && c.value.click();
80
+ b.value && typeof b.value.click == "function" && b.value.click();
81
81
  },
82
82
  doDrop: () => {
83
- p.value && typeof p.value.click == "function" && p.value.click();
83
+ v.value && typeof v.value.click == "function" && v.value.click();
84
84
  }
85
85
  });
86
- const H = S(() => !r.canDrop || r.dropButton === !1 ? !1 : !r.canUpdate && r.canDrop ? !0 : !n.value && r.editing && r.httpSuccessRead), U = S(() => r.mode === I.Create && r.createButton === !1 || r.mode === I.Update && r.updateButton === !1 || n.value ? !1 : r.editing && r.httpSuccessRead), z = S(() => r.editModeButton === !1 || !r.canSwitchEditMode || !r.canUpdate && !r.canDrop || !r.canUpdate && r.canDrop ? !1 : !n.value && r.mode !== I.Create && r.httpSuccessRead), ae = S(() => r.buttonNavVisibility === Se.Always || l["prev-buttons-ever"] ? !0 : r.buttonNavVisibility === Se.Never ? !1 : U.value || H.value || z.value);
87
- return (e, D) => {
88
- const h = ke("lkt-button");
89
- return ae.value ? (b(), N("div", He, [
90
- e.grouped && e.groupButtonAsModalActions ? (b(), N(Ce, { key: 0 }, [
91
- z.value ? (b(), j(h, R({ key: 0 }, e.editModeButton, {
92
- checked: m.value,
93
- "onUpdate:checked": D[0] || (D[0] = (X) => m.value = X),
86
+ const M = U(() => !r.canDrop || r.dropButton === !1 ? !1 : !r.canUpdate && r.canDrop ? !0 : !n.value && r.editing && r.httpSuccessRead), V = U(() => r.mode === S.Create && r.createButton === !1 || r.mode === S.Update && r.updateButton === !1 || n.value ? !1 : r.editing && r.httpSuccessRead), E = U(() => r.editModeButton === !1 || !r.canSwitchEditMode || !r.canUpdate && !r.canDrop || !r.canUpdate && r.canDrop ? !1 : !n.value && r.mode !== S.Create && r.httpSuccessRead), ee = U(() => r.buttonNavVisibility === Me.Always || l["prev-buttons-ever"] ? !0 : r.buttonNavVisibility === Me.Never ? !1 : V.value || M.value || E.value);
87
+ return (e, B) => {
88
+ const h = le("lkt-button");
89
+ return ee.value ? (m(), N("div", Qe, [
90
+ e.grouped && e.groupButtonAsModalActions ? (m(), N(Se, { key: 0 }, [
91
+ E.value ? (m(), O(h, R({ key: 0 }, e.editModeButton, {
92
+ checked: g.value,
93
+ "onUpdate:checked": B[0] || (B[0] = (j) => g.value = j),
94
94
  class: "lkt-item-crud--switch-mode-button"
95
95
  }), null, 16, ["checked"])) : d("", !0),
96
96
  u(l)["prev-buttons-ever"] ? s(e.$slots, "prev-buttons-ever", {
@@ -105,20 +105,20 @@ const B = (...T) => {
105
105
  canDrop: e.canDrop,
106
106
  perms: e.perms
107
107
  }) : d("", !0),
108
- $(G(h, R({
108
+ $(q(h, R({
109
109
  ref_key: "saveButtonRef",
110
- ref: c
110
+ ref: b
111
111
  }, e.updateButton, {
112
112
  disabled: !e.ableToUpdate,
113
- onLoading: v,
114
- onLoaded: g,
115
- onClick: P
113
+ onLoading: f,
114
+ onLoaded: y,
115
+ onClick: A
116
116
  }), {
117
117
  default: C(() => [
118
118
  u(l)["button-save"] ? s(e.$slots, "button-save", {
119
119
  key: 0,
120
120
  item: e.item,
121
- editMode: m.value,
121
+ editMode: g.value,
122
122
  isCreate: !1,
123
123
  canUpdate: e.canUpdate,
124
124
  canDrop: e.canDrop
@@ -126,22 +126,22 @@ const B = (...T) => {
126
126
  ]),
127
127
  _: 3
128
128
  }, 16, ["disabled"]), [
129
- [L, e.mode === u(I).Update && U.value]
129
+ [L, e.mode === u(S).Update && V.value]
130
130
  ]),
131
- $(G(h, R({
131
+ $(q(h, R({
132
132
  ref_key: "saveButtonRef",
133
- ref: c
133
+ ref: b
134
134
  }, e.createButton, {
135
135
  disabled: !e.ableToCreate,
136
- onLoading: v,
137
- onLoaded: g,
138
- onClick: A
136
+ onLoading: f,
137
+ onLoaded: y,
138
+ onClick: X
139
139
  }), {
140
140
  default: C(() => [
141
141
  u(l)["button-save"] ? s(e.$slots, "button-save", {
142
142
  key: 0,
143
143
  item: e.item,
144
- editMode: m.value,
144
+ editMode: g.value,
145
145
  isCreate: !0,
146
146
  canUpdate: e.canUpdate,
147
147
  canDrop: e.canDrop
@@ -149,22 +149,22 @@ const B = (...T) => {
149
149
  ]),
150
150
  _: 3
151
151
  }, 16, ["disabled"]), [
152
- [L, e.mode === u(I).Create && U.value]
152
+ [L, e.mode === u(S).Create && V.value]
153
153
  ]),
154
- $(G(h, R({
154
+ $(q(h, R({
155
155
  ref_key: "dropButtonRef",
156
- ref: p
156
+ ref: v
157
157
  }, e.dropButton, {
158
158
  disabled: !e.ableToDrop,
159
- onLoading: v,
160
- onLoaded: g,
161
- onClick: E
159
+ onLoading: f,
160
+ onLoaded: y,
161
+ onClick: F
162
162
  }), {
163
163
  default: C(() => [
164
164
  u(l)["button-drop"] ? s(e.$slots, "button-drop", {
165
165
  key: 0,
166
166
  item: e.item,
167
- editMode: m.value,
167
+ editMode: g.value,
168
168
  isCreate: !1,
169
169
  canUpdate: e.canUpdate,
170
170
  canDrop: e.canDrop
@@ -172,17 +172,17 @@ const B = (...T) => {
172
172
  ]),
173
173
  _: 3
174
174
  }, 16, ["disabled"]), [
175
- [L, H.value && e.mode !== u(I).Create]
175
+ [L, M.value && e.mode !== u(S).Create]
176
176
  ]),
177
177
  u(l).buttons ? s(e.$slots, "buttons", { key: 3 }) : d("", !0)
178
- ], 64)) : e.grouped ? (b(), j(h, R({
178
+ ], 64)) : e.grouped ? (m(), O(h, R({
179
179
  key: 1,
180
180
  ref: "groupButton"
181
181
  }, e.groupButton, { class: "lkt-item-crud-group-button" }), {
182
182
  split: C(() => [
183
- z.value ? (b(), j(h, R({ key: 0 }, e.editModeButton, {
184
- checked: m.value,
185
- "onUpdate:checked": D[1] || (D[1] = (X) => m.value = X),
183
+ E.value ? (m(), O(h, R({ key: 0 }, e.editModeButton, {
184
+ checked: g.value,
185
+ "onUpdate:checked": B[1] || (B[1] = (j) => g.value = j),
186
186
  class: "lkt-item-crud--switch-mode-button"
187
187
  }), null, 16, ["checked"])) : d("", !0),
188
188
  u(l)["prev-buttons-ever"] ? s(e.$slots, "prev-buttons-ever", {
@@ -197,20 +197,20 @@ const B = (...T) => {
197
197
  canDrop: e.canDrop,
198
198
  perms: e.perms
199
199
  }) : d("", !0),
200
- $(G(h, R({
200
+ $(q(h, R({
201
201
  ref_key: "saveButtonRef",
202
- ref: c
202
+ ref: b
203
203
  }, e.updateButton, {
204
204
  disabled: !e.ableToUpdate,
205
- onLoading: v,
206
- onLoaded: g,
207
- onClick: P
205
+ onLoading: f,
206
+ onLoaded: y,
207
+ onClick: A
208
208
  }), {
209
209
  default: C(() => [
210
210
  u(l)["button-save"] ? s(e.$slots, "button-save", {
211
211
  key: 0,
212
212
  item: e.item,
213
- editMode: m.value,
213
+ editMode: g.value,
214
214
  isCreate: !1,
215
215
  canUpdate: e.canUpdate,
216
216
  canDrop: e.canDrop
@@ -218,22 +218,22 @@ const B = (...T) => {
218
218
  ]),
219
219
  _: 3
220
220
  }, 16, ["disabled"]), [
221
- [L, e.mode === u(I).Update && U.value]
221
+ [L, e.mode === u(S).Update && V.value]
222
222
  ]),
223
- $(G(h, R({
223
+ $(q(h, R({
224
224
  ref_key: "saveButtonRef",
225
- ref: c
225
+ ref: b
226
226
  }, e.createButton, {
227
227
  disabled: !e.ableToCreate,
228
- onLoading: v,
229
- onLoaded: g,
230
- onClick: A
228
+ onLoading: f,
229
+ onLoaded: y,
230
+ onClick: X
231
231
  }), {
232
232
  default: C(() => [
233
233
  u(l)["button-save"] ? s(e.$slots, "button-save", {
234
234
  key: 0,
235
235
  item: e.item,
236
- editMode: m.value,
236
+ editMode: g.value,
237
237
  isCreate: !0,
238
238
  canUpdate: e.canUpdate,
239
239
  canDrop: e.canDrop
@@ -241,22 +241,22 @@ const B = (...T) => {
241
241
  ]),
242
242
  _: 3
243
243
  }, 16, ["disabled"]), [
244
- [L, e.mode === u(I).Create && U.value]
244
+ [L, e.mode === u(S).Create && V.value]
245
245
  ]),
246
- $(G(h, R({
246
+ $(q(h, R({
247
247
  ref_key: "dropButtonRef",
248
- ref: p
248
+ ref: v
249
249
  }, e.dropButton, {
250
250
  disabled: !e.ableToDrop,
251
- onLoading: v,
252
- onLoaded: g,
253
- onClick: E
251
+ onLoading: f,
252
+ onLoaded: y,
253
+ onClick: F
254
254
  }), {
255
255
  default: C(() => [
256
256
  u(l)["button-drop"] ? s(e.$slots, "button-drop", {
257
257
  key: 0,
258
258
  item: e.item,
259
- editMode: m.value,
259
+ editMode: g.value,
260
260
  isCreate: !1,
261
261
  canUpdate: e.canUpdate,
262
262
  canDrop: e.canDrop
@@ -264,13 +264,13 @@ const B = (...T) => {
264
264
  ]),
265
265
  _: 3
266
266
  }, 16, ["disabled"]), [
267
- [L, H.value && e.mode !== u(I).Create]
267
+ [L, M.value && e.mode !== u(S).Create]
268
268
  ]),
269
269
  u(l).buttons ? s(e.$slots, "buttons", { key: 3 }) : d("", !0)
270
270
  ]),
271
271
  _: 3
272
- }, 16)) : (b(), N(Ce, { key: 2 }, [
273
- u(l)["prev-buttons-ever"] ? $((b(), N("div", ze, [
272
+ }, 16)) : (m(), N(Se, { key: 2 }, [
273
+ u(l)["prev-buttons-ever"] ? $((m(), N("div", Ye, [
274
274
  s(e.$slots, "prev-buttons-ever", {
275
275
  canUpdate: e.canUpdate,
276
276
  canDrop: e.canDrop,
@@ -279,29 +279,29 @@ const B = (...T) => {
279
279
  ], 512)), [
280
280
  [L, !n.value]
281
281
  ]) : d("", !0),
282
- u(l)["prev-buttons"] ? $((b(), N("div", Je, [
282
+ u(l)["prev-buttons"] ? $((m(), N("div", Ze, [
283
283
  s(e.$slots, "prev-buttons", {
284
284
  canUpdate: e.canUpdate,
285
285
  canDrop: e.canDrop,
286
286
  perms: e.perms
287
287
  })
288
288
  ], 512)), [
289
- [L, m.value && !n.value]
289
+ [L, g.value && !n.value]
290
290
  ]) : d("", !0),
291
- $(G(h, R({
291
+ $(q(h, R({
292
292
  ref_key: "saveButtonRef",
293
- ref: c
293
+ ref: b
294
294
  }, e.updateButton, {
295
295
  disabled: !e.ableToUpdate,
296
- onLoading: v,
297
- onLoaded: g,
298
- onClick: P
296
+ onLoading: f,
297
+ onLoaded: y,
298
+ onClick: A
299
299
  }), {
300
300
  default: C(() => [
301
301
  u(l)["button-save"] ? s(e.$slots, "button-save", {
302
302
  key: 0,
303
303
  item: e.item,
304
- editMode: m.value,
304
+ editMode: g.value,
305
305
  isCreate: !1,
306
306
  canUpdate: e.canUpdate,
307
307
  canDrop: e.canDrop
@@ -309,22 +309,22 @@ const B = (...T) => {
309
309
  ]),
310
310
  _: 3
311
311
  }, 16, ["disabled"]), [
312
- [L, e.mode === u(I).Update && U.value]
312
+ [L, e.mode === u(S).Update && V.value]
313
313
  ]),
314
- $(G(h, R({
314
+ $(q(h, R({
315
315
  ref_key: "saveButtonRef",
316
- ref: c
316
+ ref: b
317
317
  }, e.createButton, {
318
318
  disabled: !e.ableToCreate,
319
- onLoading: v,
320
- onLoaded: g,
321
- onClick: A
319
+ onLoading: f,
320
+ onLoaded: y,
321
+ onClick: X
322
322
  }), {
323
323
  default: C(() => [
324
324
  u(l)["button-save"] ? s(e.$slots, "button-save", {
325
325
  key: 0,
326
326
  item: e.item,
327
- editMode: m.value,
327
+ editMode: g.value,
328
328
  isCreate: !0,
329
329
  canUpdate: e.canUpdate,
330
330
  canDrop: !1
@@ -332,22 +332,22 @@ const B = (...T) => {
332
332
  ]),
333
333
  _: 3
334
334
  }, 16, ["disabled"]), [
335
- [L, e.mode === u(I).Create && U.value]
335
+ [L, e.mode === u(S).Create && V.value]
336
336
  ]),
337
- $(G(h, R({
337
+ $(q(h, R({
338
338
  ref_key: "dropButtonRef",
339
- ref: p
339
+ ref: v
340
340
  }, e.dropButton, {
341
341
  disabled: !e.ableToDrop,
342
- onLoading: v,
343
- onLoaded: g,
344
- onClick: E
342
+ onLoading: f,
343
+ onLoaded: y,
344
+ onClick: F
345
345
  }), {
346
346
  default: C(() => [
347
347
  u(l)["button-drop"] ? s(e.$slots, "button-drop", {
348
348
  key: 0,
349
349
  item: e.item,
350
- editMode: m.value,
350
+ editMode: g.value,
351
351
  isCreate: !1,
352
352
  canUpdate: e.canUpdate,
353
353
  canDrop: e.canDrop
@@ -355,47 +355,48 @@ const B = (...T) => {
355
355
  ]),
356
356
  _: 3
357
357
  }, 16, ["disabled"]), [
358
- [L, H.value && e.mode !== u(I).Create]
358
+ [L, M.value && e.mode !== u(S).Create]
359
359
  ]),
360
- u(l).buttons ? $((b(), N("div", Qe, [
360
+ u(l).buttons ? $((m(), N("div", _e, [
361
361
  s(e.$slots, "buttons")
362
362
  ], 512)), [
363
- [L, m.value && !n.value]
363
+ [L, g.value && !n.value]
364
364
  ]) : d("", !0),
365
- z.value ? (b(), j(h, R({ key: 3 }, e.editModeButton, {
366
- checked: m.value,
367
- "onUpdate:checked": D[2] || (D[2] = (X) => m.value = X),
365
+ E.value ? (m(), O(h, R({ key: 3 }, e.editModeButton, {
366
+ checked: g.value,
367
+ "onUpdate:checked": B[2] || (B[2] = (j) => g.value = j),
368
368
  class: "lkt-item-crud--switch-mode-button"
369
369
  }), null, 16, ["checked"])) : d("", !0)
370
370
  ], 64))
371
371
  ])) : d("", !0);
372
372
  };
373
373
  }
374
- }), Ye = { class: "lkt-item-crud" }, Ze = {
374
+ }), xe = { class: "lkt-item-crud" }, et = {
375
375
  key: 0,
376
376
  class: "lkt-item-crud_header"
377
- }, _e = {
377
+ }, tt = {
378
378
  key: 0,
379
379
  class: "lkt-item-crud_header-slot"
380
- }, xe = {
380
+ }, at = {
381
381
  key: 1,
382
382
  class: "lkt-item-crud_header-title"
383
- }, et = {
383
+ }, ot = {
384
384
  key: 2,
385
385
  class: "lkt-item-crud_header-slot"
386
- }, tt = {
386
+ }, ut = {
387
387
  key: 2,
388
388
  class: "lkt-item-crud_content"
389
- }, at = {
389
+ }, nt = {
390
390
  key: 0,
391
391
  class: "lkt-grid-1"
392
- }, ot = /* @__PURE__ */ Me({
392
+ }, dt = /* @__PURE__ */ we({
393
393
  __name: "LktItemCrud",
394
- props: /* @__PURE__ */ $e({
394
+ props: /* @__PURE__ */ Ne({
395
395
  modelValue: {},
396
396
  editing: { type: Boolean },
397
397
  perms: {},
398
398
  customData: {},
399
+ form: {},
399
400
  mode: {},
400
401
  view: {},
401
402
  editModeButton: { type: [Object, Boolean] },
@@ -418,12 +419,13 @@ const B = (...T) => {
418
419
  redirectOnCreate: { type: [String, Function] },
419
420
  redirectOnDrop: { type: [String, Function] },
420
421
  events: {}
421
- }, Xe(Fe)),
422
+ }, Ke(Ge)),
422
423
  emits: [
423
424
  "update:modelValue",
424
425
  "update:editing",
425
426
  "update:perms",
426
427
  "update:customData",
428
+ "update:form",
427
429
  "read",
428
430
  "create",
429
431
  "update",
@@ -433,83 +435,83 @@ const B = (...T) => {
433
435
  "error",
434
436
  "modified-data"
435
437
  ],
436
- setup(T, { expose: te, emit: le }) {
437
- const a = T, r = qe(), l = Te(), c = le, p = f(!0), n = f(a.modelValue), m = f(a.customData), v = f(a.perms), g = f(a.editing), A = f(!1), P = f(!1), E = f(200), M = f(new Ue(n.value, a.dataStateConfig)), O = f(!1), H = f(new Ue(a.readData)), U = f(a.mode === I.Create), z = f(!1), ae = f(!1), e = f(null), D = S(() => !U.value && Array.isArray(v.value) && v.value.includes(ge.Update)), h = S(() => !U.value && Array.isArray(v.value) && v.value.includes(ge.Drop)), X = S(() => !U.value && Array.isArray(v.value) && v.value.includes(ge.SwitchEditMode));
438
- k(() => a.mode, (t) => {
439
- U.value = t === I.Create;
440
- }), k(() => a.perms, (t) => {
441
- v.value = t;
442
- }), k(v, (t) => {
443
- c("update:perms", t);
444
- }), k(() => a.customData, (t) => {
445
- m.value = t;
446
- }), k(m, (t) => {
447
- c("update:customData", t);
438
+ setup(T, { expose: ae, emit: ie }) {
439
+ const a = T, r = Je(), l = Re(), b = ie, v = c(!0), n = c(a.modelValue), g = c(a.customData), f = c(a.perms), y = c(a.editing), X = c(!1), A = c(!1), F = c(!1), W = c(200), I = c(new Ie(n.value, a.dataStateConfig)), M = c(!1), V = c(new Ie(a.readData)), E = c(a.mode === S.Create), ee = c(!1), e = c(!1), B = c(null), h = U(() => !E.value && Array.isArray(f.value) && f.value.includes(ke.Update)), j = U(() => !E.value && Array.isArray(f.value) && f.value.includes(ke.Drop)), se = U(() => !E.value && Array.isArray(f.value) && f.value.includes(ke.SwitchEditMode));
440
+ D(() => a.mode, (t) => {
441
+ E.value = t === S.Create;
442
+ }), D(() => a.perms, (t) => {
443
+ f.value = t;
444
+ }), D(f, (t) => {
445
+ b("update:perms", t);
446
+ }), D(() => a.customData, (t) => {
447
+ g.value = t;
448
+ }), D(g, (t) => {
449
+ b("update:customData", t);
448
450
  });
449
- const F = f(q(a.createButton, i.defaultCreateButton)), W = f(q(a.updateButton, i.defaultUpdateButton)), K = f(q(a.dropButton, i.defaultDropButton)), oe = f(q(a.editModeButton, i.defaultEditModeButton)), ie = f(q(a.groupButton, i.defaultGroupButton));
450
- k(() => a.createButton, (t) => {
451
- F.value = q(t, i.defaultCreateButton);
452
- }, { deep: !0 }), k(() => a.updateButton, (t) => {
453
- W.value = q(t, i.defaultUpdateButton);
454
- }, { deep: !0 }), k(() => a.dropButton, (t) => {
455
- K.value = q(t, i.defaultDropButton);
456
- }, { deep: !0 }), k(() => a.editModeButton, (t) => {
457
- oe.value = q(t, i.defaultEditModeButton);
451
+ const K = c(z(a.createButton, i.defaultCreateButton)), G = c(z(a.updateButton, i.defaultUpdateButton)), H = c(z(a.dropButton, i.defaultDropButton)), oe = c(z(a.editModeButton, i.defaultEditModeButton)), pe = c(z(a.groupButton, i.defaultGroupButton));
452
+ D(() => a.createButton, (t) => {
453
+ K.value = z(t, i.defaultCreateButton);
454
+ }, { deep: !0 }), D(() => a.updateButton, (t) => {
455
+ G.value = z(t, i.defaultUpdateButton);
456
+ }, { deep: !0 }), D(() => a.dropButton, (t) => {
457
+ H.value = z(t, i.defaultDropButton);
458
+ }, { deep: !0 }), D(() => a.editModeButton, (t) => {
459
+ oe.value = z(t, i.defaultEditModeButton);
458
460
  }, { deep: !0 });
459
461
  const ue = async () => {
460
- var t, o, V;
461
- B("fetchItem"), p.value = !0, E.value = -1, P.value = !1, typeof ((t = a.events) == null ? void 0 : t.httpStart) == "function" && a.events.httpStart();
462
+ var t, o, P;
463
+ k("fetchItem"), v.value = !0, W.value = -1, F.value = !1, typeof ((t = a.events) == null ? void 0 : t.httpStart) == "function" && a.events.httpStart();
462
464
  try {
463
- const w = await Pe(a.readResource, a.readData);
464
- if (B("fetchItem -> response", w), p.value = !1, E.value = w.httpStatus, m.value = w.custom, !w.success) {
465
- A.value = !1, E.value = w.httpStatus, typeof ((o = a.events) == null ? void 0 : o.httpEnd) == "function" && a.events.httpEnd({
465
+ const w = await We(a.readResource, a.readData);
466
+ if (k("fetchItem -> response", w), v.value = !1, W.value = w.httpStatus, g.value = w.custom, !w.success) {
467
+ A.value = !1, W.value = w.httpStatus, typeof ((o = a.events) == null ? void 0 : o.httpEnd) == "function" && a.events.httpEnd({
466
468
  httpResponse: w
467
- }), c("error", w.httpStatus);
469
+ }), b("error", w.httpStatus);
468
470
  return;
469
471
  }
470
- A.value = !0, n.value = w.data, v.value = w.perms, M.value.increment(n.value).turnStoredIntoOriginal(), O.value = M.value.changed(), H.value.turnStoredIntoOriginal(), typeof ((V = a.events) == null ? void 0 : V.httpEnd) == "function" && a.events.httpEnd({
472
+ A.value = !0, n.value = w.data, f.value = w.perms, I.value.increment(n.value).turnStoredIntoOriginal(), M.value = I.value.changed(), V.value.turnStoredIntoOriginal(), typeof ((P = a.events) == null ? void 0 : P.httpEnd) == "function" && a.events.httpEnd({
471
473
  httpResponse: w
472
- }), c("read", w);
474
+ }), b("read", w);
473
475
  } catch {
474
- p.value = !1, A.value = !1, E.value = 404, c("error", 404);
476
+ v.value = !1, A.value = !1, W.value = 404, b("error", 404);
475
477
  return;
476
478
  }
477
479
  };
478
- k(() => a.modelValue, (t) => {
479
- n.value = t, M.value.increment(t);
480
- }, { deep: !0 }), k(n, (t) => {
481
- if (z.value = !0, B("item updated ->", n.value), typeof a.beforeEmitUpdate == "function") {
482
- B("item updated -> has beforeEmitUpdate");
480
+ D(() => a.modelValue, (t) => {
481
+ n.value = t, I.value.increment(t);
482
+ }, { deep: !0 }), D(n, (t) => {
483
+ if (ee.value = !0, k("item updated ->", n.value), typeof a.beforeEmitUpdate == "function") {
484
+ k("item updated -> has beforeEmitUpdate");
483
485
  let o = a.beforeEmitUpdate(n.value);
484
- B("item updated -> override with: ", o), typeof o == "object" && (n.value = o);
486
+ k("item updated -> override with: ", o), typeof o == "object" && (n.value = o);
485
487
  }
486
- c("update:modelValue", n.value), B("item updated -> update dataState"), M.value.increment(t), O.value = M.value.changed(), Le(() => z.value = !1);
487
- }, { deep: !0 }), k(v, () => c("perms", v.value)), k(O, (t) => {
488
- c("modified-data", t);
489
- }), k(() => a.readData, (t) => {
490
- H.value.increment(t), H.value.changed() && ue();
491
- }), k(() => a.editing, (t) => {
492
- B("editing updated -> updating editMode", t), g.value = t;
493
- }), k(g, (t) => {
494
- B("editMode updated -> emit update", t), c("update:editing", t);
495
- }), Ne(() => {
496
- a.readResource && !U.value ? ue() : (U.value, A.value = !0, g.value = !0, p.value = !1, M.value.increment(n.value).turnStoredIntoOriginal(), O.value = M.value.changed());
488
+ b("update:modelValue", n.value), k("item updated -> update dataState"), I.value.increment(t), M.value = I.value.changed(), Ve(() => ee.value = !1);
489
+ }, { deep: !0 }), D(f, () => b("perms", f.value)), D(M, (t) => {
490
+ b("modified-data", t);
491
+ }), D(() => a.readData, (t) => {
492
+ V.value.increment(t), V.value.changed() && ue();
493
+ }), D(() => a.editing, (t) => {
494
+ k("editing updated -> updating editMode", t), y.value = t;
495
+ }), D(y, (t) => {
496
+ k("editMode updated -> emit update", t), b("update:editing", t);
497
+ }), je(() => {
498
+ a.readResource && !E.value ? ue() : (E.value, A.value = !0, y.value = !0, v.value = !1, I.value.increment(n.value).turnStoredIntoOriginal(), M.value = I.value.changed());
497
499
  });
498
- const se = (t, o) => {
500
+ const ve = (t, o) => {
499
501
  if (o) {
500
- if (p.value = !1, typeof t < "u" && (E.value = t.httpStatus, !t.success))
501
- return P.value = !0, c("error", t.httpStatus), !1;
502
- P.value = !0;
502
+ if (v.value = !1, typeof t < "u" && (W.value = t.httpStatus, !t.success))
503
+ return F.value = !0, b("error", t.httpStatus), !1;
504
+ F.value = !0;
503
505
  }
504
506
  return !0;
505
- }, he = (t, o) => {
506
- if (B("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId)
507
- if (B("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), typeof o < "u") {
508
- let V = o;
509
- typeof o == "function" && (V = o(t.autoReloadId)), r.push(V);
510
- } else me.value ? (B("doAutoReloadId -> insideModal: ", a), Ke(a.modalConfig.modalName, a.modalConfig.modalKey, t.autoReloadId)) : (B("doAutoReloadId -> outsideModal"), a.readData.id = t.autoReloadId, B("doAutoReloadId -> turning off create mode"), U.value = !1, ue());
511
- }, pe = (t, o) => {
512
- if (B("onCreate"), !se(o, F.value.resource)) {
507
+ }, Ce = (t, o) => {
508
+ if (k("doAutoReloadId -> enter: ", t), typeof t < "u" && t.autoReloadId)
509
+ if (k("doAutoReloadId -> autoReloadId detected: ", t.autoReloadId), typeof o < "u") {
510
+ let P = o;
511
+ typeof o == "function" && (P = o(t.autoReloadId)), r.push(P);
512
+ } else ge.value ? (k("doAutoReloadId -> insideModal: ", a), qe(a.modalConfig.modalName, a.modalConfig.modalKey, t.autoReloadId)) : (k("doAutoReloadId -> outsideModal"), a.readData.id = t.autoReloadId, k("doAutoReloadId -> turning off create mode"), E.value = !1, ue());
513
+ }, fe = (t, o) => {
514
+ if (k("onCreate"), !ve(o, K.value.resource)) {
513
515
  a.notificationType === J.Toast && _({
514
516
  text: i.defaultCreateErrorText,
515
517
  details: i.defaultCreateErrorDetails,
@@ -518,14 +520,14 @@ const B = (...T) => {
518
520
  });
519
521
  return;
520
522
  }
521
- ae.value = !0, B("onCreate -> turn stored data into original"), M.value.increment(n.value).turnStoredIntoOriginal(), a.notificationType === J.Toast && _({
523
+ e.value = !0, k("onCreate -> turn stored data into original"), I.value.increment(n.value).turnStoredIntoOriginal(), a.notificationType === J.Toast && _({
522
524
  text: i.defaultCreateSuccessText,
523
525
  details: i.defaultCreateSuccessDetails,
524
526
  icon: i.defaultCreateSuccessIcon,
525
527
  positionX: Z.Right
526
- }), he(o, a.redirectOnCreate), B("onCreate -> beforeEmitCreate"), c("create", o);
527
- }, ve = (t, o) => {
528
- if (B("onUpdate"), !se(o, W.value.resource)) {
528
+ }), Ce(o, a.redirectOnCreate), k("onCreate -> beforeEmitCreate"), b("create", o);
529
+ }, ce = (t, o) => {
530
+ if (k("onUpdate"), !ve(o, G.value.resource)) {
529
531
  a.notificationType === J.Toast && _({
530
532
  text: i.defaultUpdateErrorText,
531
533
  details: i.defaultUpdateErrorDetails,
@@ -534,14 +536,14 @@ const B = (...T) => {
534
536
  });
535
537
  return;
536
538
  }
537
- B("onUpdate -> turn stored data into original"), M.value.turnStoredIntoOriginal(), a.notificationType === J.Toast && _({
539
+ k("onUpdate -> turn stored data into original"), I.value.turnStoredIntoOriginal(), a.notificationType === J.Toast && _({
538
540
  text: i.defaultUpdateSuccessText,
539
541
  details: i.defaultUpdateSuccessDetails,
540
542
  icon: i.defaultUpdateSuccessIcon,
541
543
  positionX: Z.Right
542
- }), he(o), c("update", o);
543
- }, fe = (t, o) => {
544
- if (B("onDrop"), !se(o, K.value.resource)) {
544
+ }), Ce(o), b("update", o);
545
+ }, me = (t, o) => {
546
+ if (k("onDrop"), !ve(o, H.value.resource)) {
545
547
  a.notificationType === J.Toast && _({
546
548
  text: i.defaultDropErrorText,
547
549
  details: i.defaultDropErrorDetails,
@@ -555,116 +557,116 @@ const B = (...T) => {
555
557
  details: i.defaultDropSuccessDetails,
556
558
  icon: i.defaultDropSuccessIcon,
557
559
  positionX: Z.Right
558
- }), c("drop", o), a.view === Ie.Modal && (B("onDrop -> close modal"), We(a.modalConfig.modalName, a.modalConfig.modalKey)), typeof a.redirectOnDrop < "u") {
559
- let V = a.redirectOnDrop;
560
- typeof a.redirectOnDrop == "function" && (V = a.redirectOnDrop()), r.push(V);
560
+ }), b("drop", o), a.view === Te.Modal && (k("onDrop -> close modal"), He(a.modalConfig.modalName, a.modalConfig.modalKey)), typeof a.redirectOnDrop < "u") {
561
+ let P = a.redirectOnDrop;
562
+ typeof a.redirectOnDrop == "function" && (P = a.redirectOnDrop()), r.push(P);
561
563
  }
562
564
  };
563
- te({
565
+ ae({
564
566
  doDrop: () => {
565
- e.value && e.value.doDrop();
567
+ B.value && B.value.doDrop();
566
568
  },
567
569
  doRefresh: ue,
568
570
  doSave: () => {
569
- e.value && e.value.doSave();
571
+ B.value && B.value.doSave();
570
572
  },
571
573
  turnStoredDataIntoOriginal: () => {
572
- M.value.increment(n.value).turnStoredIntoOriginal();
574
+ I.value.increment(n.value).turnStoredIntoOriginal();
573
575
  },
574
- hasModifiedData: () => M.value.changed()
576
+ hasModifiedData: () => I.value.changed()
575
577
  });
576
- const we = S(() => {
578
+ const Ae = U(() => {
577
579
  var t;
578
- return M.value.changed() ? (t = a.modalConfig) == null ? void 0 : t.closeConfirm : "";
579
- }), Re = (t) => {
580
+ return I.value.changed() ? (t = a.modalConfig) == null ? void 0 : t.closeConfirm : "";
581
+ }), Ee = (t) => {
580
582
  var o;
581
583
  if (typeof ((o = a.modalConfig) == null ? void 0 : o.beforeClose) == "function")
582
584
  return a.modalConfig.beforeClose({
583
585
  ...t,
584
- itemCreated: ae.value
586
+ itemCreated: e.value
585
587
  });
586
- }, ce = S(() => a.title.startsWith("__:") ? String(Ge(a.title.substring(3))) : a.title), Ae = S(() => p.value ? !1 : ce.value.length > 0 || !!l["post-title"]), me = S(() => a.view === Ie.Modal), De = S(() => me.value ? "lkt-modal" : "section"), ne = S(() => {
588
+ }, be = U(() => a.title.startsWith("__:") ? String(ze(a.title.substring(3))) : a.title), $e = U(() => v.value ? !1 : be.value.length > 0 || !!l["post-title"]), ge = U(() => a.view === Te.Modal), Ue = U(() => ge.value ? "lkt-modal" : "section"), ne = U(() => {
587
589
  var t, o;
588
- return a.mode !== I.Update || !D.value || !a.enabledSaveWithoutChanges && !O.value ? !1 : typeof ((t = W.value) == null ? void 0 : t.disabled) == "function" ? !W.value.disabled({
590
+ return a.mode !== S.Update || !h.value || !a.enabledSaveWithoutChanges && !M.value || (console.log("ableToUpdate", X.value), Be.value && !X.value) ? !1 : typeof ((t = G.value) == null ? void 0 : t.disabled) == "function" ? !G.value.disabled({
589
591
  prop: n.value
590
- }) : typeof ((o = W.value) == null ? void 0 : o.disabled) == "boolean" ? !W.value.disabled : !0;
591
- }), de = S(() => {
592
+ }) : typeof ((o = G.value) == null ? void 0 : o.disabled) == "boolean" ? !G.value.disabled : !0;
593
+ }), de = U(() => {
592
594
  var t, o;
593
- return a.mode !== I.Create || !a.enabledSaveWithoutChanges && !O.value ? !1 : typeof ((t = F.value) == null ? void 0 : t.disabled) == "function" ? !F.value.disabled({
595
+ return a.mode !== S.Create || !a.enabledSaveWithoutChanges && !M.value || Be.value && !X.value ? !1 : typeof ((t = K.value) == null ? void 0 : t.disabled) == "function" ? !K.value.disabled({
594
596
  prop: n.value
595
- }) : typeof ((o = F.value) == null ? void 0 : o.disabled) == "boolean" ? !F.value.disabled : !0;
596
- }), be = S(() => {
597
+ }) : typeof ((o = K.value) == null ? void 0 : o.disabled) == "boolean" ? !K.value.disabled : !0;
598
+ }), ye = U(() => {
597
599
  var t, o;
598
- return h.value ? typeof ((t = K.value) == null ? void 0 : t.disabled) == "function" ? !K.value.disabled({
600
+ return j.value ? typeof ((t = H.value) == null ? void 0 : t.disabled) == "function" ? !H.value.disabled({
599
601
  prop: n.value
600
- }) : typeof ((o = K.value) == null ? void 0 : o.disabled) == "boolean" ? !K.value.disabled : !0 : !1;
601
- }), Ee = S(() => De.value === "lkt-modal" ? {
602
+ }) : typeof ((o = H.value) == null ? void 0 : o.disabled) == "boolean" ? !H.value.disabled : !0 : !1;
603
+ }), Le = U(() => Ue.value === "lkt-modal" ? {
602
604
  title: a.title,
603
605
  item: n.value,
604
606
  ...a.modalConfig,
605
- beforeClose: Re,
606
- closeConfirm: we.value,
607
+ beforeClose: Ee,
608
+ closeConfirm: Ae.value,
607
609
  headerActionsButton: a.groupButton !== !1 ? {
608
610
  dot: de.value || ne.value
609
611
  } : !1
610
- } : {});
612
+ } : {}), Be = U(() => typeof a.form == "object" && Object.keys(a.form).length > 0);
611
613
  return (t, o) => {
612
- const V = ke("lkt-http-info"), w = ke("lkt-loader");
613
- return b(), j(Oe(De.value), R(Ee.value, { class: "lkt-item-crud" }), re({
614
+ const P = le("lkt-http-info"), w = le("lkt-form"), Oe = le("lkt-loader");
615
+ return m(), O(Pe(Ue.value), R(Le.value, { class: "lkt-item-crud" }), re({
614
616
  default: C(() => [
615
- Ve("article", Ye, [
616
- !me.value && Ae.value ? (b(), N("header", Ze, [
617
- u(l)["pre-title"] ? (b(), N("div", _e, [
617
+ Xe("article", xe, [
618
+ !ge.value && $e.value ? (m(), N("header", et, [
619
+ u(l)["pre-title"] ? (m(), N("div", tt, [
618
620
  s(t.$slots, "pre-title", {
619
621
  item: n.value,
620
- loading: p.value
622
+ loading: v.value
621
623
  })
622
624
  ])) : d("", !0),
623
- ce.value.length > 0 ? (b(), N("h1", xe, je(ce.value), 1)) : d("", !0),
624
- u(l)["post-title"] ? (b(), N("div", et, [
625
+ be.value.length > 0 ? (m(), N("h1", at, Fe(be.value), 1)) : d("", !0),
626
+ u(l)["post-title"] ? (m(), N("div", ot, [
625
627
  s(t.$slots, "post-title", {
626
628
  item: n.value,
627
- loading: p.value
629
+ loading: v.value
628
630
  })
629
631
  ])) : d("", !0)
630
632
  ])) : d("", !0),
631
- t.buttonNavPosition === u(ye).Top && (t.groupButton === !1 || !t.groupButtonAsModalActions) ? (b(), j(Be, {
633
+ t.buttonNavPosition === u(De).Top && (t.groupButton === !1 || !t.groupButtonAsModalActions) ? (m(), O(he, {
632
634
  key: 1,
633
635
  ref_key: "buttonNav",
634
- ref: e,
635
- loading: p.value,
636
- "onUpdate:loading": o[2] || (o[2] = (y) => p.value = y),
637
- editing: g.value,
638
- "onUpdate:editing": o[3] || (o[3] = (y) => g.value = y),
636
+ ref: B,
637
+ loading: v.value,
638
+ "onUpdate:loading": o[2] || (o[2] = (p) => v.value = p),
639
+ editing: y.value,
640
+ "onUpdate:editing": o[3] || (o[3] = (p) => y.value = p),
639
641
  item: n.value,
640
642
  mode: t.mode,
641
643
  view: t.view,
642
644
  grouped: t.groupButton !== !1,
643
645
  "button-nav-visibility": t.buttonNavVisibility,
644
- "create-button": F.value,
645
- "update-button": W.value,
646
- "drop-button": K.value,
646
+ "create-button": K.value,
647
+ "update-button": G.value,
648
+ "drop-button": H.value,
647
649
  "edit-mode-button": oe.value,
648
- "group-button": ie.value,
649
- "data-changed": O.value,
650
+ "group-button": pe.value,
651
+ "data-changed": M.value,
650
652
  "http-success-read": A.value,
651
- "can-update": D.value,
652
- "can-drop": h.value,
653
- "can-switch-edit-mode": X.value,
653
+ "can-update": h.value,
654
+ "can-drop": j.value,
655
+ "can-switch-edit-mode": se.value,
654
656
  "group-button-as-modal-actions": t.groupButtonAsModalActions,
655
657
  "able-to-create": de.value,
656
658
  "able-to-update": ne.value,
657
- "able-to-drop": be.value,
658
- perms: v.value,
659
- onCreate: pe,
660
- onSave: ve,
661
- onDrop: fe
659
+ "able-to-drop": ye.value,
660
+ perms: f.value,
661
+ onCreate: fe,
662
+ onSave: ce,
663
+ onDrop: me
662
664
  }, re({ _: 2 }, [
663
665
  u(l)["prev-buttons-ever"] ? {
664
666
  name: "prev-buttons-ever",
665
- fn: C(({ canUpdate: y, canDrop: Q, perms: Y }) => [
667
+ fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
666
668
  s(t.$slots, "prev-buttons-ever", {
667
- canUpdate: y,
669
+ canUpdate: p,
668
670
  canDrop: Q,
669
671
  perms: Y
670
672
  })
@@ -673,9 +675,9 @@ const B = (...T) => {
673
675
  } : void 0,
674
676
  u(l)["prev-buttons"] ? {
675
677
  name: "prev-buttons",
676
- fn: C(({ canUpdate: y, canDrop: Q, perms: Y }) => [
678
+ fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
677
679
  s(t.$slots, "prev-buttons", {
678
- canUpdate: y,
680
+ canUpdate: p,
679
681
  canDrop: Q,
680
682
  perms: Y
681
683
  })
@@ -683,63 +685,72 @@ const B = (...T) => {
683
685
  key: "1"
684
686
  } : void 0
685
687
  ]), 1032, ["loading", "editing", "item", "mode", "view", "grouped", "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", "group-button-as-modal-actions", "able-to-create", "able-to-update", "able-to-drop", "perms"])) : d("", !0),
686
- p.value ? d("", !0) : (b(), N("div", tt, [
687
- A.value ? (b(), N("div", at, [
688
- P.value && t.notificationType === u(J).Inline ? (b(), j(V, {
688
+ v.value ? d("", !0) : (m(), N("div", ut, [
689
+ A.value ? (m(), N("div", nt, [
690
+ F.value && t.notificationType === u(J).Inline ? (m(), O(P, {
689
691
  key: 0,
690
- code: E.value,
691
- palette: E.value === 200 ? "success" : "danger",
692
+ code: W.value,
693
+ palette: W.value === 200 ? "success" : "danger",
692
694
  quick: "",
693
695
  "can-close": "",
694
- onClose: o[4] || (o[4] = (y) => P.value = !1)
696
+ onClose: o[4] || (o[4] = (p) => F.value = !1)
695
697
  }, null, 8, ["code", "palette"])) : d("", !0),
696
- s(t.$slots, "item", {
698
+ Be.value ? (m(), O(w, {
699
+ key: 1,
700
+ modelValue: n.value,
701
+ "onUpdate:modelValue": o[5] || (o[5] = (p) => n.value = p),
702
+ form: t.form,
703
+ "onUpdate:form": o[6] || (o[6] = (p) => t.form = p),
704
+ valid: X.value,
705
+ "onUpdate:valid": o[7] || (o[7] = (p) => X.value = p)
706
+ }, null, 8, ["modelValue", "form", "valid"])) : s(t.$slots, "item", {
707
+ key: 2,
697
708
  item: n.value,
698
- loading: p.value,
699
- editMode: g.value,
700
- isCreate: U.value,
701
- canUpdate: D.value,
702
- canDrop: h.value,
703
- itemBeingEdited: z.value,
704
- perms: v.value
709
+ loading: v.value,
710
+ editMode: y.value,
711
+ isCreate: E.value,
712
+ canUpdate: h.value,
713
+ canDrop: j.value,
714
+ itemBeingEdited: ee.value,
715
+ perms: f.value
705
716
  })
706
- ])) : t.notificationType === u(J).Inline ? (b(), j(V, {
717
+ ])) : t.notificationType === u(J).Inline ? (m(), O(P, {
707
718
  key: 1,
708
- code: E.value
719
+ code: W.value
709
720
  }, null, 8, ["code"])) : d("", !0)
710
721
  ])),
711
- p.value ? (b(), j(w, { key: 3 })) : d("", !0),
712
- t.buttonNavPosition === u(ye).Bottom && (t.groupButton === !1 || !t.groupButtonAsModalActions) ? (b(), j(Be, {
722
+ v.value ? (m(), O(Oe, { key: 3 })) : d("", !0),
723
+ t.buttonNavPosition === u(De).Bottom && (t.groupButton === !1 || !t.groupButtonAsModalActions) ? (m(), O(he, {
713
724
  key: 4,
714
725
  ref_key: "buttonNav",
715
- ref: e,
716
- loading: p.value,
717
- "onUpdate:loading": o[5] || (o[5] = (y) => p.value = y),
718
- editing: g.value,
719
- "onUpdate:editing": o[6] || (o[6] = (y) => g.value = y),
726
+ ref: B,
727
+ loading: v.value,
728
+ "onUpdate:loading": o[8] || (o[8] = (p) => v.value = p),
729
+ editing: y.value,
730
+ "onUpdate:editing": o[9] || (o[9] = (p) => y.value = p),
720
731
  item: n.value,
721
732
  mode: t.mode,
722
733
  view: t.view,
723
734
  grouped: t.groupButton !== !1,
724
735
  "button-nav-visibility": t.buttonNavVisibility,
725
- "create-button": F.value,
726
- "update-button": W.value,
727
- "drop-button": K.value,
736
+ "create-button": K.value,
737
+ "update-button": G.value,
738
+ "drop-button": H.value,
728
739
  "edit-mode-button": oe.value,
729
- "group-button": ie.value,
730
- "data-changed": O.value,
740
+ "group-button": pe.value,
741
+ "data-changed": M.value,
731
742
  "http-success-read": A.value,
732
- "can-update": D.value,
733
- "can-drop": h.value,
734
- "can-switch-edit-mode": X.value,
743
+ "can-update": h.value,
744
+ "can-drop": j.value,
745
+ "can-switch-edit-mode": se.value,
735
746
  "group-button-as-modal-actions": t.groupButtonAsModalActions,
736
747
  "able-to-create": de.value,
737
748
  "able-to-update": ne.value,
738
- "able-to-drop": be.value,
739
- perms: v.value,
740
- onCreate: pe,
741
- onSave: ve,
742
- onDrop: fe
749
+ "able-to-drop": ye.value,
750
+ perms: f.value,
751
+ onCreate: fe,
752
+ onSave: ce,
753
+ onDrop: me
743
754
  }, re({ _: 2 }, [
744
755
  u(l)["prev-buttons-ever"] ? {
745
756
  name: "prev-buttons-ever",
@@ -763,43 +774,43 @@ const B = (...T) => {
763
774
  t.groupButton !== !1 && t.groupButtonAsModalActions ? {
764
775
  name: "header-actions",
765
776
  fn: C(() => [
766
- t.buttonNavPosition === u(ye).Top ? (b(), j(Be, {
777
+ t.buttonNavPosition === u(De).Top ? (m(), O(he, {
767
778
  key: 0,
768
779
  ref_key: "buttonNav",
769
- ref: e,
770
- loading: p.value,
771
- "onUpdate:loading": o[0] || (o[0] = (y) => p.value = y),
772
- editing: g.value,
773
- "onUpdate:editing": o[1] || (o[1] = (y) => g.value = y),
780
+ ref: B,
781
+ loading: v.value,
782
+ "onUpdate:loading": o[0] || (o[0] = (p) => v.value = p),
783
+ editing: y.value,
784
+ "onUpdate:editing": o[1] || (o[1] = (p) => y.value = p),
774
785
  item: n.value,
775
786
  mode: t.mode,
776
787
  view: t.view,
777
788
  grouped: !0,
778
789
  "button-nav-visibility": t.buttonNavVisibility,
779
- "create-button": F.value,
780
- "update-button": W.value,
781
- "drop-button": K.value,
790
+ "create-button": K.value,
791
+ "update-button": G.value,
792
+ "drop-button": H.value,
782
793
  "edit-mode-button": oe.value,
783
- "group-button": ie.value,
784
- "data-changed": O.value,
794
+ "group-button": pe.value,
795
+ "data-changed": M.value,
785
796
  "http-success-read": A.value,
786
- "can-update": D.value,
787
- "can-drop": h.value,
788
- "can-switch-edit-mode": X.value,
797
+ "can-update": h.value,
798
+ "can-drop": j.value,
799
+ "can-switch-edit-mode": se.value,
789
800
  "group-button-as-modal-actions": t.groupButtonAsModalActions,
790
801
  "able-to-create": de.value,
791
802
  "able-to-update": ne.value,
792
- "able-to-drop": be.value,
793
- perms: v.value,
794
- onCreate: pe,
795
- onSave: ve,
796
- onDrop: fe
803
+ "able-to-drop": ye.value,
804
+ perms: f.value,
805
+ onCreate: fe,
806
+ onSave: ce,
807
+ onDrop: me
797
808
  }, re({ _: 2 }, [
798
809
  u(l)["prev-buttons-ever"] ? {
799
810
  name: "prev-buttons-ever",
800
- fn: C(({ canUpdate: y, canDrop: Q, perms: Y }) => [
811
+ fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
801
812
  s(t.$slots, "prev-buttons-ever", {
802
- canUpdate: y,
813
+ canUpdate: p,
803
814
  canDrop: Q,
804
815
  perms: Y
805
816
  })
@@ -808,9 +819,9 @@ const B = (...T) => {
808
819
  } : void 0,
809
820
  u(l)["prev-buttons"] ? {
810
821
  name: "prev-buttons",
811
- fn: C(({ canUpdate: y, canDrop: Q, perms: Y }) => [
822
+ fn: C(({ canUpdate: p, canDrop: Q, perms: Y }) => [
812
823
  s(t.$slots, "prev-buttons", {
813
- canUpdate: y,
824
+ canUpdate: p,
814
825
  canDrop: Q,
815
826
  perms: Y
816
827
  })
@@ -824,18 +835,18 @@ const B = (...T) => {
824
835
  ]), 1040);
825
836
  };
826
837
  }
827
- }), mt = {
828
- install: (T, te = {}) => {
829
- T.component("lkt-item-crud") === void 0 && T.component("lkt-item-crud", ot);
838
+ }), yt = {
839
+ install: (T, ae = {}) => {
840
+ T.component("lkt-item-crud") === void 0 && T.component("lkt-item-crud", dt);
830
841
  }
831
- }, bt = (T) => {
842
+ }, Bt = (T) => {
832
843
  x.defaultSaveIcon = T;
833
- }, gt = (T) => {
844
+ }, kt = (T) => {
834
845
  x.defaultDropIcon = T;
835
846
  };
836
847
  export {
837
- ct as debugLktItemCrud,
838
- mt as default,
839
- gt as setItemCrudDefaultDropIcon,
840
- bt as setItemCrudDefaultSaveIcon
848
+ gt as debugLktItemCrud,
849
+ yt as default,
850
+ kt as setItemCrudDefaultDropIcon,
851
+ Bt as setItemCrudDefaultSaveIcon
841
852
  };
@@ -21,7 +21,7 @@ declare var __VLS_17: {
21
21
  canUpdate: boolean | undefined;
22
22
  canDrop: boolean | undefined;
23
23
  perms: string[] | undefined;
24
- }, __VLS_48: {
24
+ }, __VLS_52: {
25
25
  item: LktObject;
26
26
  loading: false;
27
27
  editMode: boolean;
@@ -30,7 +30,7 @@ declare var __VLS_17: {
30
30
  canDrop: boolean;
31
31
  itemBeingEdited: boolean;
32
32
  perms: string[];
33
- }, __VLS_69: {}, __VLS_71: {};
33
+ }, __VLS_73: {}, __VLS_75: {};
34
34
  type __VLS_Slots = {} & {
35
35
  'prev-buttons-ever'?: (props: typeof __VLS_17) => any;
36
36
  } & {
@@ -44,11 +44,11 @@ type __VLS_Slots = {} & {
44
44
  } & {
45
45
  'prev-buttons'?: (props: typeof __VLS_38) => any;
46
46
  } & {
47
- item?: (props: typeof __VLS_48) => any;
47
+ item?: (props: typeof __VLS_52) => any;
48
48
  } & {
49
- 'prev-buttons-ever'?: (props: typeof __VLS_69) => any;
49
+ 'prev-buttons-ever'?: (props: typeof __VLS_73) => any;
50
50
  } & {
51
- 'prev-buttons'?: (props: typeof __VLS_71) => any;
51
+ 'prev-buttons'?: (props: typeof __VLS_75) => any;
52
52
  };
53
53
  declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
54
54
  doDrop: () => void;
@@ -67,6 +67,7 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
67
67
  "update:modelValue": (...args: any[]) => void;
68
68
  "update:perms": (...args: any[]) => void;
69
69
  "update:customData": (...args: any[]) => void;
70
+ "update:form": (...args: any[]) => void;
70
71
  "before-save": (...args: any[]) => void;
71
72
  "modified-data": (...args: any[]) => void;
72
73
  }, string, import("vue").PublicProps, Readonly<ItemCrudConfig> & Readonly<{
@@ -80,10 +81,12 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
80
81
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
81
82
  "onUpdate:perms"?: ((...args: any[]) => any) | undefined;
82
83
  "onUpdate:customData"?: ((...args: any[]) => any) | undefined;
84
+ "onUpdate:form"?: ((...args: any[]) => any) | undefined;
83
85
  "onBefore-save"?: ((...args: any[]) => any) | undefined;
84
86
  "onModified-data"?: ((...args: any[]) => any) | undefined;
85
87
  }>, {
86
88
  view: ItemCrudView;
89
+ form: import("lkt-vue-kernel").FormConfig;
87
90
  title: string;
88
91
  mode: ItemCrudMode;
89
92
  modelValue: LktObject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -40,6 +40,7 @@
40
40
  'update:editing',
41
41
  'update:perms',
42
42
  'update:customData',
43
+ 'update:form',
43
44
  'read',
44
45
  'create',
45
46
  'update',
@@ -55,6 +56,7 @@
55
56
  custom = ref(props.customData),
56
57
  permissions = ref(props.perms),
57
58
  editMode = ref(props.editing),
59
+ validForm = ref(false),
58
60
  httpSuccessRead = ref(false),
59
61
  showStoreMessage = ref(false),
60
62
  httpStatus = ref(200),
@@ -392,6 +394,8 @@
392
394
  ableToUpdate = computed(() => {
393
395
  if (props.mode !== ItemCrudMode.Update || !canUpdate.value) return false;
394
396
  if (!props.enabledSaveWithoutChanges && !dataChanged.value) return false;
397
+ console.log('ableToUpdate', validForm.value);
398
+ if (computedHasForm.value && !validForm.value) return false;
395
399
 
396
400
  if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled({
397
401
  prop: item.value
@@ -403,6 +407,7 @@
403
407
  ableToCreate = computed(() => {
404
408
  if (props.mode !== ItemCrudMode.Create) return false;
405
409
  if (!props.enabledSaveWithoutChanges && !dataChanged.value) return false;
410
+ if (computedHasForm.value && !validForm.value) return false;
406
411
 
407
412
  if (typeof safeCreateButton.value?.disabled === 'function') return !safeCreateButton.value.disabled({
408
413
  prop: item.value
@@ -440,6 +445,9 @@
440
445
  };
441
446
  }
442
447
  return {};
448
+ }),
449
+ computedHasForm = computed(() => {
450
+ return typeof props.form === 'object' && Object.keys(props.form).length > 0;
443
451
  })
444
452
  </script>
445
453
 
@@ -561,16 +569,26 @@
561
569
  quick
562
570
  can-close
563
571
  v-on:close="showStoreMessage = false" />
564
- <slot name="item"
565
- :item="item"
566
- :loading="isLoading"
567
- :edit-mode="editMode"
568
- :is-create="createMode"
569
- :can-update="canUpdate"
570
- :can-drop="canDrop"
571
- :item-being-edited="itemBeingEdited"
572
- :perms="permissions"
572
+
573
+ <lkt-form
574
+ v-if="computedHasForm"
575
+ v-model="item"
576
+ v-model:form="form"
577
+ v-model:valid="validForm"
573
578
  />
579
+
580
+ <template v-else>
581
+ <slot name="item"
582
+ :item="item"
583
+ :loading="isLoading"
584
+ :edit-mode="editMode"
585
+ :is-create="createMode"
586
+ :can-update="canUpdate"
587
+ :can-drop="canDrop"
588
+ :item-being-edited="itemBeingEdited"
589
+ :perms="permissions"
590
+ />
591
+ </template>
574
592
  </div>
575
593
  <lkt-http-info :code="httpStatus" v-else-if="notificationType === NotificationType.Inline" />
576
594
  </div>