lkt-item-crud 2.0.31 → 2.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as qe, ref as p, watch as y, useSlots as ze, computed as B, resolveComponent as me, createElementBlock as w, createCommentVNode as k, openBlock as n, createBlock as m, Fragment as F, renderSlot as R, withDirectives as h, mergeProps as f, normalizeProps as Se, unref as s, renderList as H, vShow as D, createVNode as x, withCtx as J, mergeDefaults as at, nextTick as Ke, onMounted as ot, resolveDynamicComponent as nt, createSlots as ce, toDisplayString as ut } from "vue";
2
2
  import { httpCall as it } from "lkt-http-client";
3
3
  import { DataState as $e } from "lkt-data-state";
4
- import { ModificationView as S, ItemCrudMode as O, ItemCrudButtonNavVisibility as We, ButtonType as Ne, TablePermission as we, ensureButtonConfig as ee, LktSettings as g, getFormDataState as lt, ItemCrudView as Ge, getFormSlotKeys as rt, ItemCrudButtonNavPosition as je, NotificationType as ne, getDefaultValues as dt, ItemCrud as st, ToastPositionX as se } from "lkt-vue-kernel";
4
+ import { ModificationView as U, ItemCrudMode as O, ItemCrudButtonNavVisibility as We, ButtonType as Ne, TablePermission as we, ensureButtonConfig as ee, LktSettings as g, getFormDataState as lt, ItemCrudView as Ge, getFormSlotKeys as rt, ItemCrudButtonNavPosition as je, NotificationType as ne, getDefaultValues as dt, ItemCrud as st, ToastPositionX as se } from "lkt-vue-kernel";
5
5
  import { closeModal as vt, updateModalKey as pt } from "lkt-modal";
6
6
  import { __ as ft } from "lkt-i18n";
7
7
  import { openToast as ve } from "lkt-toast";
@@ -78,7 +78,7 @@ const V = (...N) => {
78
78
  y(() => u.editing, (t) => E.value = t), y(E, (t) => a("update:editing", t));
79
79
  const b = () => {
80
80
  i.value = !0;
81
- }, U = () => {
81
+ }, S = () => {
82
82
  i.value = !1;
83
83
  }, te = (t, $) => {
84
84
  typeof t > "u" || a("create", t, $);
@@ -86,7 +86,7 @@ const V = (...N) => {
86
86
  typeof t > "u" || a("save", t, $);
87
87
  }, P = (t, $) => {
88
88
  typeof t > "u" || a("drop", t, $);
89
- }, K = B(() => u.editableView === S.Modifications ? u.modifications : u.item);
89
+ }, K = B(() => u.editableView === U.Modifications ? u.modifications : u.item);
90
90
  ge({
91
91
  doSave: () => {
92
92
  c.value && typeof c.value.click == "function" && c.value.click();
@@ -96,46 +96,46 @@ const V = (...N) => {
96
96
  }
97
97
  });
98
98
  const W = B(() => !u.canDrop || u.dropButton === !1 ? !1 : !u.canUpdate && u.canDrop ? !0 : !i.value && u.editing && u.httpSuccessRead), I = B(() => u.mode === O.Create && (u.createButton === !1 || !u.canCreate) || u.mode === O.Update && (u.updateButton === !1 || !u.canUpdate) || i.value ? !1 : u.editing && u.httpSuccessRead), ae = B(() => u.editModeButton === !1 || !u.canSwitchEditMode || !u.canUpdate && !u.canDrop || !u.canUpdate && u.canDrop ? !1 : !i.value && u.mode !== O.Create && u.httpSuccessRead), z = B(() => u.buttonNavVisibility === We.Always || C["prev-buttons-ever"] ? !0 : u.buttonNavVisibility === We.Never ? !1 : I.value || W.value || ae.value), G = B(() => u.modificationView === !1 ? [] : u.modificationView === !0 ? [
99
- S.Current,
100
- S.Modifications,
101
- S.SplitView,
102
- S.Differences
99
+ U.Current,
100
+ U.Modifications,
101
+ U.SplitView,
102
+ U.Differences
103
103
  ] : Array.isArray(u.modificationView) ? u.modificationView : []), re = B(() => {
104
104
  let t = [];
105
- return G.value.includes(S.Current) && t.push({
105
+ return G.value.includes(U.Current) && t.push({
106
106
  text: "Current",
107
107
  icon: "lkt-icn-see",
108
- disabled: M.value === S.Current,
108
+ disabled: M.value === U.Current,
109
109
  events: {
110
110
  click: () => {
111
- M.value = S.Current;
111
+ M.value = U.Current;
112
112
  }
113
113
  }
114
- }), G.value.includes(S.Modifications) && t.push({
114
+ }), G.value.includes(U.Modifications) && t.push({
115
115
  text: "Modifications",
116
116
  icon: "lkt-icn-edit",
117
- disabled: M.value === S.Modifications,
117
+ disabled: M.value === U.Modifications,
118
118
  events: {
119
119
  click: () => {
120
- M.value = S.Modifications;
120
+ M.value = U.Modifications;
121
121
  }
122
122
  }
123
- }), G.value.includes(S.SplitView) && t.push({
123
+ }), G.value.includes(U.SplitView) && t.push({
124
124
  text: "Split View",
125
125
  icon: "lkt-icn-columns",
126
- disabled: M.value === S.SplitView,
126
+ disabled: M.value === U.SplitView,
127
127
  events: {
128
128
  click: () => {
129
- M.value = S.SplitView;
129
+ M.value = U.SplitView;
130
130
  }
131
131
  }
132
- }), G.value.includes(S.Differences) && t.push({
132
+ }), G.value.includes(U.Differences) && t.push({
133
133
  text: "Differences",
134
134
  icon: "lkt-icn-balance",
135
- disabled: M.value === S.Differences,
135
+ disabled: M.value === U.Differences,
136
136
  events: {
137
137
  click: () => {
138
- M.value = S.Differences;
138
+ M.value = U.Differences;
139
139
  }
140
140
  }
141
141
  }), t;
@@ -189,7 +189,7 @@ const V = (...N) => {
189
189
  disabled: !t.ableToUpdate
190
190
  }, {
191
191
  onLoading: b,
192
- onLoaded: U,
192
+ onLoaded: S,
193
193
  onClick: Q
194
194
  }), null, 16), [
195
195
  [D, t.mode === s(O).Update && I.value]
@@ -206,7 +206,7 @@ const V = (...N) => {
206
206
  disabled: !t.ableToCreate
207
207
  }, {
208
208
  onLoading: b,
209
- onLoaded: U,
209
+ onLoaded: S,
210
210
  onClick: te
211
211
  }), null, 16), [
212
212
  [D, t.mode === s(O).Create && I.value]
@@ -217,7 +217,7 @@ const V = (...N) => {
217
217
  }, t.dropButton, {
218
218
  disabled: !t.ableToDrop,
219
219
  onLoading: b,
220
- onLoaded: U,
220
+ onLoaded: S,
221
221
  onClick: P
222
222
  }), null, 16, ["disabled"]), [
223
223
  [D, W.value && t.mode !== s(O).Create]
@@ -280,7 +280,7 @@ const V = (...N) => {
280
280
  disabled: !t.ableToUpdate
281
281
  }, {
282
282
  onLoading: b,
283
- onLoaded: U,
283
+ onLoaded: S,
284
284
  onClick: Q
285
285
  }), null, 16), [
286
286
  [D, t.mode === s(O).Update && I.value]
@@ -298,7 +298,7 @@ const V = (...N) => {
298
298
  }, {
299
299
  disabled: !t.ableToCreate,
300
300
  onLoading: b,
301
- onLoaded: U,
301
+ onLoaded: S,
302
302
  onClick: te
303
303
  }), null, 16, ["disabled"]), [
304
304
  [D, t.mode === s(O).Create && I.value]
@@ -309,7 +309,7 @@ const V = (...N) => {
309
309
  }, t.dropButton, {
310
310
  disabled: !t.ableToDrop,
311
311
  onLoading: b,
312
- onLoaded: U,
312
+ onLoaded: S,
313
313
  onClick: P
314
314
  }), null, 16, ["disabled"]), [
315
315
  [D, W.value && t.mode !== s(O).Create]
@@ -361,7 +361,7 @@ const V = (...N) => {
361
361
  disabled: !t.ableToUpdate
362
362
  }, {
363
363
  onLoading: b,
364
- onLoaded: U,
364
+ onLoaded: S,
365
365
  onClick: Q
366
366
  }), null, 16), [
367
367
  [D, t.mode === s(O).Update && I.value]
@@ -378,7 +378,7 @@ const V = (...N) => {
378
378
  disabled: !t.ableToCreate
379
379
  }, {
380
380
  onLoading: b,
381
- onLoaded: U,
381
+ onLoaded: S,
382
382
  onClick: te
383
383
  }), null, 16), [
384
384
  [D, t.mode === s(O).Create && I.value]
@@ -389,7 +389,7 @@ const V = (...N) => {
389
389
  }, t.dropButton, {
390
390
  disabled: !t.ableToDrop,
391
391
  onLoading: b,
392
- onLoaded: U,
392
+ onLoaded: S,
393
393
  onClick: P
394
394
  }), null, 16, ["disabled"]), [
395
395
  [D, W.value && t.mode !== s(O).Create]
@@ -499,7 +499,7 @@ const V = (...N) => {
499
499
  "modified-data"
500
500
  ],
501
501
  setup(N, { expose: ge, emit: Ue }) {
502
- const a = N, u = ct(), M = ze(), C = Ue, c = p(!0), r = p(a.modelValue), i = p(a.modifications), E = p(a.customData), b = p(a.perms), U = p(a.editing), te = p(!1), Q = p(!1), P = p(!1), K = p(!1), Y = p(200), L = p(new $e(r.value, a.dataStateConfig)), W = p(new $e(i.value, a.dataStateConfig)), I = p(!1), ae = p(new $e(a.readData)), z = p(a.mode === O.Create), G = p(!1), re = p(!1), t = p(null), $ = p(null), d = B(() => z.value && a.createButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Create)), Z = B(() => !z.value && a.updateButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Update)), _ = B(() => !z.value && a.dropButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Drop)), de = B(() => a.editModeButton !== !1 && !z.value && Array.isArray(b.value) && b.value.includes(we.SwitchEditMode)), j = p(a.visibleView);
502
+ const a = N, u = ct(), M = ze(), C = Ue, c = p(!0), r = p(a.modelValue), i = p(a.modifications), E = p(a.customData), b = p(a.perms), S = p(a.editing), te = p(!1), Q = p(!1), P = p(!1), K = p(!1), Y = p(200), L = p(new $e(r.value, a.dataStateConfig)), W = p(new $e(i.value, a.dataStateConfig)), I = p(!1), ae = p(new $e(a.readData)), z = p(a.mode === O.Create), G = p(!1), re = p(!1), t = p(null), $ = p(null), d = B(() => z.value && a.createButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Create)), Z = B(() => !z.value && a.updateButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Update)), _ = B(() => !z.value && a.dropButton !== !1 && Array.isArray(b.value) && b.value.includes(we.Drop)), de = B(() => a.editModeButton !== !1 && !z.value && Array.isArray(b.value) && b.value.includes(we.SwitchEditMode)), j = p(a.visibleView);
503
503
  y(() => a.visibleView, (e) => {
504
504
  j.value = e;
505
505
  }), y(j, (e) => {
@@ -517,7 +517,7 @@ const V = (...N) => {
517
517
  }), y(() => a.modifications, (e) => {
518
518
  W.value.increment(e), i.value = e;
519
519
  }, { deep: !0 }), y(i, (e) => {
520
- Ee(), W.value.increment(e), ue.value === S.Modifications && (I.value = W.value.changed()), C("update:modifications", e);
520
+ Ee(), W.value.increment(e), ue.value === U.Modifications && (I.value = W.value.changed()), C("update:modifications", e);
521
521
  }, { deep: !0 });
522
522
  const v = p(ee(a.createButton, g.defaultCreateButton)), q = p(ee(a.updateButton, g.defaultUpdateButton)), T = p(ee(a.dropButton, g.defaultDropButton)), ye = p(ee(a.editModeButton, g.defaultEditModeButton)), Me = p(ee(a.groupButton, g.defaultGroupButton));
523
523
  y(() => a.createButton, (e) => {
@@ -540,7 +540,7 @@ const V = (...N) => {
540
540
  }), C("error", A.httpStatus);
541
541
  return;
542
542
  }
543
- P.value = !0, r.value = A.data, i.value = Array.isArray(A.modifications) ? {} : A.modifications, b.value = A.perms, L.value.increment(r.value).turnStoredIntoOriginal(), W.value.increment(i.value).turnStoredIntoOriginal(), I.value = L.value.changed(), ae.value.turnStoredIntoOriginal(), Object.keys(i.value).length > 0 && (j.value = S.Modifications), oe.value && (Ee(), Ke(() => {
543
+ P.value = !0, r.value = A.data, i.value = Array.isArray(A.modifications) ? {} : A.modifications, b.value = A.perms, L.value.increment(r.value).turnStoredIntoOriginal(), W.value.increment(i.value).turnStoredIntoOriginal(), I.value = L.value.changed(), ae.value.turnStoredIntoOriginal(), Object.keys(i.value).length > 0 && (j.value = U.Modifications), oe.value && (Ee(), Ke(() => {
544
544
  $.value.turnStoredIntoOriginal();
545
545
  })), typeof ((X = a.events) == null ? void 0 : X.httpEnd) == "function" && a.events.httpEnd({
546
546
  httpResponse: A
@@ -560,21 +560,21 @@ const V = (...N) => {
560
560
  let o = a.beforeEmitUpdate(r.value);
561
561
  V("item updated -> override with: ", o), typeof o == "object" && (r.value = o);
562
562
  }
563
- oe.value && Ee(), C("update:modelValue", r.value), V("item updated -> update dataState"), L.value.increment(e), ue.value === S.Current && (I.value = L.value.changed()), G.value = !0;
563
+ oe.value && Ee(), C("update:modelValue", r.value), V("item updated -> update dataState"), L.value.increment(e), ue.value === U.Current && (I.value = L.value.changed()), G.value = !0;
564
564
  }, { deep: !0 }), y(b, () => C("perms", b.value)), y(I, (e) => {
565
565
  C("modified-data", e);
566
566
  }), y(() => a.readData, (e) => {
567
567
  ae.value.increment(e), ae.value.changed() && Be();
568
568
  }), y(() => a.editing, (e) => {
569
- V("editing updated -> updating editMode", e), U.value = e;
570
- }), y(U, (e) => {
569
+ V("editing updated -> updating editMode", e), S.value = e;
570
+ }), y(S, (e) => {
571
571
  V("editMode updated -> emit update", e), C("update:editing", e);
572
572
  });
573
573
  const Pe = p(void 0), Ee = () => {
574
574
  oe.value && (Pe.value = lt(r.value, i.value, fe.value));
575
575
  };
576
576
  ot(() => {
577
- a.readResource && !z.value ? Be() : (z.value, P.value = !0, U.value = !0, c.value = !1, L.value.increment(r.value).turnStoredIntoOriginal(), I.value = L.value.changed());
577
+ a.readResource && !z.value ? Be() : (z.value, P.value = !0, S.value = !0, c.value = !1, L.value.increment(r.value).turnStoredIntoOriginal(), I.value = L.value.changed());
578
578
  });
579
579
  const Ve = (e, o) => {
580
580
  if (o) {
@@ -656,7 +656,7 @@ const V = (...N) => {
656
656
  });
657
657
  const Je = B(() => {
658
658
  var e, o, X;
659
- return De.value ? oe.value ? Q.value ? (e = a.modalConfig) == null ? void 0 : e.closeConfirm : "" : ue.value === S.Modifications ? W.value.changed() ? (o = a.modalConfig) == null ? void 0 : o.closeConfirm : "" : L.value.changed() ? (X = a.modalConfig) == null ? void 0 : X.closeConfirm : "" : "";
659
+ return De.value ? oe.value ? Q.value ? (e = a.modalConfig) == null ? void 0 : e.closeConfirm : "" : ue.value === U.Modifications ? W.value.changed() ? (o = a.modalConfig) == null ? void 0 : o.closeConfirm : "" : L.value.changed() ? (X = a.modalConfig) == null ? void 0 : X.closeConfirm : "" : "";
660
660
  }), Qe = (e) => {
661
661
  var o;
662
662
  if (typeof ((o = a.modalConfig) == null ? void 0 : o.beforeClose) == "function")
@@ -688,11 +688,12 @@ const V = (...N) => {
688
688
  headerActionsButton: a.groupButton !== !1 ? {
689
689
  dot: he.value || Ce.value
690
690
  } : !1
691
- } : {}), oe = B(() => typeof fe.value == "object" && Object.keys(fe.value).length > 0), Le = B(() => Object.keys(i.value).length === 0 ? [] : a.modificationViews), ue = B(() => Object.keys(i.value).length === 0 ? S.Current : S.Modifications), De = B(() => d.value || Z.value || _.value), xe = B(() => oe.value ? rt(fe.value) : []), fe = B(() => typeof a.form == "function" ? a.form({
691
+ } : {}), oe = B(() => typeof fe.value == "object" && Object.keys(fe.value).length > 0), Le = B(() => Object.keys(i.value).length === 0 ? [] : a.modificationViews), ue = B(() => Object.keys(i.value).length === 0 ? U.Current : U.Modifications), De = B(() => d.value || Z.value || _.value), xe = B(() => oe.value ? rt(fe.value) : []), fe = B(() => typeof a.form == "function" ? a.form({
692
692
  mode: a.mode,
693
693
  view: j.value,
694
694
  item: r.value,
695
- modifications: i.value
695
+ modifications: i.value,
696
+ editing: S.value
696
697
  }) : a.form);
697
698
  return (e, o) => {
698
699
  const X = me("lkt-header"), A = me("lkt-http-info"), et = me("lkt-form"), tt = me("lkt-loader");
@@ -719,8 +720,8 @@ const V = (...N) => {
719
720
  ref: t,
720
721
  loading: c.value,
721
722
  "onUpdate:loading": o[3] || (o[3] = (l) => c.value = l),
722
- editing: U.value,
723
- "onUpdate:editing": o[4] || (o[4] = (l) => U.value = l),
723
+ editing: S.value,
724
+ "onUpdate:editing": o[4] || (o[4] = (l) => S.value = l),
724
725
  "picked-modification-view": j.value,
725
726
  "onUpdate:pickedModificationView": o[5] || (o[5] = (l) => j.value = l),
726
727
  item: r.value,
@@ -807,7 +808,7 @@ const V = (...N) => {
807
808
  visibleView: j.value,
808
809
  modificationDataState: Pe.value,
809
810
  editableViews: [ue.value],
810
- disabled: !U.value
811
+ disabled: !S.value
811
812
  }), ce({ _: 2 }, [
812
813
  H(xe.value, (l) => ({
813
814
  name: l,
@@ -819,7 +820,7 @@ const V = (...N) => {
819
820
  key: 2,
820
821
  item: r.value,
821
822
  loading: c.value,
822
- editMode: U.value,
823
+ editMode: S.value,
823
824
  isCreate: z.value,
824
825
  canUpdate: Z.value,
825
826
  canDrop: _.value,
@@ -838,8 +839,8 @@ const V = (...N) => {
838
839
  ref: t,
839
840
  loading: c.value,
840
841
  "onUpdate:loading": o[11] || (o[11] = (l) => c.value = l),
841
- editing: U.value,
842
- "onUpdate:editing": o[12] || (o[12] = (l) => U.value = l),
842
+ editing: S.value,
843
+ "onUpdate:editing": o[12] || (o[12] = (l) => S.value = l),
843
844
  "picked-modification-view": j.value,
844
845
  "onUpdate:pickedModificationView": o[13] || (o[13] = (l) => j.value = l),
845
846
  item: r.value,
@@ -901,8 +902,8 @@ const V = (...N) => {
901
902
  ref: t,
902
903
  loading: c.value,
903
904
  "onUpdate:loading": o[0] || (o[0] = (l) => c.value = l),
904
- editing: U.value,
905
- "onUpdate:editing": o[1] || (o[1] = (l) => U.value = l),
905
+ editing: S.value,
906
+ "onUpdate:editing": o[1] || (o[1] = (l) => S.value = l),
906
907
  "picked-modification-view": j.value,
907
908
  "onUpdate:pickedModificationView": o[2] || (o[2] = (l) => j.value = l),
908
909
  item: r.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -547,7 +547,8 @@
547
547
  mode: props.mode,
548
548
  view: pickedModificationView.value,
549
549
  item: item.value,
550
- modifications: itemModifications.value
550
+ modifications: itemModifications.value,
551
+ editing: editMode.value
551
552
  });
552
553
  return props.form;
553
554
  })