lkt-item-crud 2.0.21 → 2.0.23
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 +6 -6
- package/dist/build.js +441 -452
- package/dist/lib-components/LktItemCrud.vue.d.ts +7 -5
- package/package.json +1 -1
- package/src/lib-components/LktItemCrud.vue +27 -10
|
@@ -21,7 +21,7 @@ declare var __VLS_17: {
|
|
|
21
21
|
canUpdate: boolean | undefined;
|
|
22
22
|
canDrop: boolean | undefined;
|
|
23
23
|
perms: string[] | undefined;
|
|
24
|
-
},
|
|
24
|
+
}, __VLS_53: string, __VLS_54: {}, __VLS_56: {
|
|
25
25
|
item: LktObject;
|
|
26
26
|
loading: false;
|
|
27
27
|
editMode: boolean;
|
|
@@ -30,8 +30,10 @@ declare var __VLS_17: {
|
|
|
30
30
|
canDrop: boolean;
|
|
31
31
|
itemBeingEdited: boolean;
|
|
32
32
|
perms: string[];
|
|
33
|
-
},
|
|
33
|
+
}, __VLS_77: {}, __VLS_79: {};
|
|
34
34
|
type __VLS_Slots = {} & {
|
|
35
|
+
[K in NonNullable<typeof __VLS_53>]?: (props: typeof __VLS_54) => any;
|
|
36
|
+
} & {
|
|
35
37
|
'prev-buttons-ever'?: (props: typeof __VLS_17) => any;
|
|
36
38
|
} & {
|
|
37
39
|
'prev-buttons'?: (props: typeof __VLS_19) => any;
|
|
@@ -44,11 +46,11 @@ type __VLS_Slots = {} & {
|
|
|
44
46
|
} & {
|
|
45
47
|
'prev-buttons'?: (props: typeof __VLS_38) => any;
|
|
46
48
|
} & {
|
|
47
|
-
item?: (props: typeof
|
|
49
|
+
item?: (props: typeof __VLS_56) => any;
|
|
48
50
|
} & {
|
|
49
|
-
'prev-buttons-ever'?: (props: typeof
|
|
51
|
+
'prev-buttons-ever'?: (props: typeof __VLS_77) => any;
|
|
50
52
|
} & {
|
|
51
|
-
'prev-buttons'?: (props: typeof
|
|
53
|
+
'prev-buttons'?: (props: typeof __VLS_79) => any;
|
|
52
54
|
};
|
|
53
55
|
declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
54
56
|
doDrop: () => void;
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
ButtonConfig,
|
|
8
8
|
ensureButtonConfig, FormUiConfig,
|
|
9
9
|
getDefaultValues,
|
|
10
|
+
getFormDataState, getFormSlotKeys,
|
|
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
|
}
|
|
@@ -512,6 +520,13 @@
|
|
|
512
520
|
const computedHasButtons = computed(() => {
|
|
513
521
|
return createMode.value || canUpdate.value || canDrop.value;
|
|
514
522
|
})
|
|
523
|
+
|
|
524
|
+
const computedFormSlots = computed(() => {
|
|
525
|
+
if (computedHasForm.value) {
|
|
526
|
+
return getFormSlotKeys(props.form);
|
|
527
|
+
}
|
|
528
|
+
return [];
|
|
529
|
+
})
|
|
515
530
|
</script>
|
|
516
531
|
|
|
517
532
|
<template>
|
|
@@ -584,10 +599,7 @@
|
|
|
584
599
|
|
|
585
600
|
<button-nav
|
|
586
601
|
ref="buttonNav"
|
|
587
|
-
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top
|
|
588
|
-
&& (groupButton === false || !groupButtonAsModalActions)
|
|
589
|
-
&& computedHasButtons
|
|
590
|
-
"
|
|
602
|
+
v-if="buttonNavPosition === ItemCrudButtonNavPosition.Top && (groupButton === false || !groupButtonAsModalActions) && computedHasButtons"
|
|
591
603
|
v-model:loading="isLoading"
|
|
592
604
|
v-model:editing="editMode"
|
|
593
605
|
v-model:picked-modification-view="pickedModificationView"
|
|
@@ -649,6 +661,7 @@
|
|
|
649
661
|
v-model="item"
|
|
650
662
|
v-model:modifications="itemModifications"
|
|
651
663
|
v-model:valid="validForm"
|
|
664
|
+
v-model:changed="changedForm"
|
|
652
665
|
v-bind="<FormUiConfig>{
|
|
653
666
|
...formUiConfig,
|
|
654
667
|
form,
|
|
@@ -658,7 +671,11 @@
|
|
|
658
671
|
editableViews: [computedEditableView],
|
|
659
672
|
disabled: !editMode,
|
|
660
673
|
}"
|
|
661
|
-
|
|
674
|
+
>
|
|
675
|
+
<template v-for="formSlot in computedFormSlots" v-slot:[formSlot]="{}">
|
|
676
|
+
<slot :name="formSlot"/>
|
|
677
|
+
</template>
|
|
678
|
+
</lkt-form>
|
|
662
679
|
</template>
|
|
663
680
|
|
|
664
681
|
<template v-else>
|