lkt-item-crud 1.1.10 → 1.1.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.js CHANGED
@@ -49,7 +49,8 @@ const p = (...u) => {
49
49
  dropDisabled: { type: Boolean, default: !1 },
50
50
  saveValidator: { type: Function, required: !1, default: () => !0 },
51
51
  onCreate: { type: Function, required: !1, default: () => !0 },
52
- onUpdate: { type: Function, required: !1, default: () => !0 }
52
+ onUpdate: { type: Function, required: !1, default: () => !0 },
53
+ insideModal: { type: Boolean, default: !1 }
53
54
  },
54
55
  emits: ["update:modelValue", "update:isCreate", "read", "create", "update", "drop", "perms", "error", "modified-data"],
55
56
  setup(u, { expose: $, emit: W }) {
@@ -91,7 +92,7 @@ const p = (...u) => {
91
92
  m.value = !0;
92
93
  }
93
94
  let b = a.value ? "create" : "update";
94
- a.value || (p("onSave -> turn stored data into original"), k.value.turnStoredIntoOriginal()), l.autoReloadId && (p("onSave -> autoReloadId detected: ", l.autoReloadId), e.readData.id = l.autoReloadId, p("onSave -> turning off create mode"), a.value = !1, U()), b === "create" ? typeof e.onCreate == "function" && (p("onSave -> trigger onCreate callback"), e.onCreate()) : typeof e.onUpdate == "function" && (p("onSave -> trigger onUpdate callback"), e.onUpdate()), n(b, l);
95
+ a.value || (p("onSave -> turn stored data into original"), k.value.turnStoredIntoOriginal()), b === "create" ? typeof e.onCreate == "function" && (p("onSave -> trigger onCreate callback"), e.onCreate(l)) : typeof e.onUpdate == "function" && (p("onSave -> trigger onUpdate callback"), e.onUpdate(l)), !e.insideModal && l.autoReloadId && (p("onSave -> autoReloadId detected: ", l.autoReloadId), e.readData.id = l.autoReloadId, p("onSave -> turning off create mode"), a.value = !1, U()), n(b, l);
95
96
  }, J = () => {
96
97
  o.value = !0, i.value = -1;
97
98
  }, F = () => {
@@ -123,6 +123,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
123
123
  required: false;
124
124
  default: () => boolean;
125
125
  };
126
+ insideModal: {
127
+ type: BooleanConstructor;
128
+ default: boolean;
129
+ };
126
130
  }, {
127
131
  doDrop: () => void;
128
132
  doRefresh: () => Promise<void>;
@@ -262,6 +266,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
262
266
  required: false;
263
267
  default: () => boolean;
264
268
  };
269
+ insideModal: {
270
+ type: BooleanConstructor;
271
+ default: boolean;
272
+ };
265
273
  }>> & {
266
274
  onError?: ((...args: any[]) => any) | undefined;
267
275
  onDrop?: ((...args: any[]) => any) | undefined;
@@ -298,6 +306,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
298
306
  updateDisabled: boolean;
299
307
  dropDisabled: boolean;
300
308
  saveValidator: Function;
309
+ insideModal: boolean;
301
310
  }, {}>, {
302
311
  "post-title"?(_: {
303
312
  item: Record<string, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-item-crud",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -46,6 +46,8 @@ const props = defineProps({
46
46
 
47
47
  onCreate: {type: Function, required: false, default: () => true},
48
48
  onUpdate: {type: Function, required: false, default: () => true},
49
+
50
+ insideModal: {type: Boolean, default: false},
49
51
  });
50
52
 
51
53
  const slots = useSlots();
@@ -192,13 +194,6 @@ const onDrop = ($event: PointerEvent, r: HTTPResponse) => {
192
194
  dataState.value.turnStoredIntoOriginal();
193
195
  }
194
196
 
195
- if (r.autoReloadId) {
196
- debug('onSave -> autoReloadId detected: ', r.autoReloadId);
197
- props.readData['id'] = r.autoReloadId;
198
- debug('onSave -> turning off create mode');
199
- createMode.value = false;
200
- fetchItem();
201
- }
202
197
  if (emits === 'create') {
203
198
  if (typeof props.onCreate === 'function') {
204
199
  debug('onSave -> trigger onCreate callback');
@@ -210,6 +205,14 @@ const onDrop = ($event: PointerEvent, r: HTTPResponse) => {
210
205
  props.onUpdate(r);
211
206
  }
212
207
  }
208
+
209
+ if (!props.insideModal && r.autoReloadId) {
210
+ debug('onSave -> autoReloadId detected: ', r.autoReloadId);
211
+ props.readData['id'] = r.autoReloadId;
212
+ debug('onSave -> turning off create mode');
213
+ createMode.value = false;
214
+ fetchItem();
215
+ }
213
216
  emit(emits, r)
214
217
  },
215
218
  onButtonLoading = () => {