lkt-item-crud 2.0.21 → 2.0.22
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 +5 -5
- package/dist/build.js +416 -434
- package/package.json +1 -1
- package/src/lib-components/LktItemCrud.vue +15 -9
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
ButtonConfig,
|
|
8
8
|
ensureButtonConfig, FormUiConfig,
|
|
9
9
|
getDefaultValues,
|
|
10
|
+
getFormDataState,
|
|
10
11
|
ItemCrud,
|
|
11
12
|
ItemCrudButtonNavPosition,
|
|
12
13
|
ItemCrudConfig,
|
|
@@ -26,7 +27,6 @@
|
|
|
26
27
|
import ButtonNav from '../components/ButtonNav.vue';
|
|
27
28
|
import { openToast } from 'lkt-toast';
|
|
28
29
|
import { useRouter } from 'vue-router';
|
|
29
|
-
import { getModificationsDataState } from '../functions/modifications-functions';
|
|
30
30
|
|
|
31
31
|
// defineOptions({
|
|
32
32
|
// inheritAttrs: false
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
permissions = ref(props.perms),
|
|
63
63
|
editMode = ref(props.editing),
|
|
64
64
|
validForm = ref(false),
|
|
65
|
+
changedForm = ref(false),
|
|
65
66
|
httpSuccessRead = ref(false),
|
|
66
67
|
showStoreMessage = ref(false),
|
|
67
68
|
httpStatus = ref(200),
|
|
@@ -191,6 +192,10 @@
|
|
|
191
192
|
}
|
|
192
193
|
};
|
|
193
194
|
|
|
195
|
+
watch(itemBeingEdited, (v) => {
|
|
196
|
+
if (v) nextTick(() => itemBeingEdited.value = false);
|
|
197
|
+
})
|
|
198
|
+
|
|
194
199
|
|
|
195
200
|
watch(() => props.modelValue, v => {
|
|
196
201
|
item.value = v;
|
|
@@ -198,7 +203,6 @@
|
|
|
198
203
|
}, { deep: true });
|
|
199
204
|
|
|
200
205
|
watch(item, (v) => {
|
|
201
|
-
itemBeingEdited.value = true;
|
|
202
206
|
debug('item updated ->', item.value);
|
|
203
207
|
if (typeof props.beforeEmitUpdate === 'function') {
|
|
204
208
|
debug('item updated -> has beforeEmitUpdate');
|
|
@@ -206,14 +210,16 @@
|
|
|
206
210
|
debug('item updated -> override with: ', override);
|
|
207
211
|
if (typeof override === 'object') item.value = override;
|
|
208
212
|
}
|
|
209
|
-
|
|
213
|
+
if (computedHasForm.value) {
|
|
214
|
+
resetFormDifferencesChecker();
|
|
215
|
+
}
|
|
210
216
|
emit('update:modelValue', item.value);
|
|
211
217
|
debug('item updated -> update dataState');
|
|
212
218
|
dataState.value.increment(v);
|
|
213
219
|
if (computedEditableView.value === ModificationView.Current) {
|
|
214
220
|
dataChanged.value = dataState.value.changed();
|
|
215
221
|
}
|
|
216
|
-
|
|
222
|
+
itemBeingEdited.value = true;
|
|
217
223
|
}, { deep: true });
|
|
218
224
|
|
|
219
225
|
watch(permissions, () => emit('perms', permissions.value));
|
|
@@ -238,7 +244,7 @@
|
|
|
238
244
|
const formDifferencesChecker = ref(undefined);
|
|
239
245
|
const resetFormDifferencesChecker = () => {
|
|
240
246
|
if (computedHasForm.value) {
|
|
241
|
-
formDifferencesChecker.value =
|
|
247
|
+
formDifferencesChecker.value = getFormDataState(item.value, itemModifications.value, props.form);
|
|
242
248
|
}
|
|
243
249
|
}
|
|
244
250
|
|
|
@@ -408,6 +414,8 @@
|
|
|
408
414
|
|
|
409
415
|
const closeConfirm = computed(() => {
|
|
410
416
|
if (!computedHasButtons.value) return '';
|
|
417
|
+
if (computedHasForm.value) return changedForm.value ? props.modalConfig?.closeConfirm : '';
|
|
418
|
+
|
|
411
419
|
if (computedEditableView.value === ModificationView.Modifications) {
|
|
412
420
|
return modificationsDataState.value.changed() ? props.modalConfig?.closeConfirm : '';
|
|
413
421
|
}
|
|
@@ -584,10 +592,7 @@
|
|
|
584
592
|
|
|
585
593
|
<button-nav
|
|
586
594
|
ref="buttonNav"
|
|
587
|
-
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top
|
|
588
|
-
&& (groupButton === false || !groupButtonAsModalActions)
|
|
589
|
-
&& computedHasButtons
|
|
590
|
-
"
|
|
595
|
+
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top && (groupButton === false || !groupButtonAsModalActions) && computedHasButtons"
|
|
591
596
|
v-model:loading="isLoading"
|
|
592
597
|
v-model:editing="editMode"
|
|
593
598
|
v-model:picked-modification-view="pickedModificationView"
|
|
@@ -649,6 +654,7 @@
|
|
|
649
654
|
v-model="item"
|
|
650
655
|
v-model:modifications="itemModifications"
|
|
651
656
|
v-model:valid="validForm"
|
|
657
|
+
v-model:changed="changedForm"
|
|
652
658
|
v-bind="<FormUiConfig>{
|
|
653
659
|
...formUiConfig,
|
|
654
660
|
form,
|