Skip to content
Snippets Groups Projects
Commit 0fa21004 authored by permcu's avatar permcu
Browse files

Fix dialog-Object-Form's internal dialog-mode-handling

and move to proper places.

Now the dialog-mode can be set from parent via v-model and from child
via #activator. The later was previously broken.

The new placement just makes more sense with the mixins.
parent ea94457a
No related branches found
No related tags found
1 merge request!1793Fix dialog-Object-Form's internal dialog-mode-handling
Pipeline #197662 passed with warnings
<template>
<mobile-fullscreen-dialog
v-model="dialog"
v-model="dialogMode"
max-width="500px"
:close-button="false"
>
......@@ -26,7 +26,7 @@
:valid.sync="valid"
@loading="handleLoading"
@save="handleSave"
@cancel="dialog = false"
@cancel="dialogMode = false"
>
<template v-for="(_, slot) of $scopedSlots" #[slot]="scope"
><slot :name="slot" v-bind="scope"
......@@ -35,7 +35,7 @@
</template>
<template #actions>
<cancel-button @click="dialog = false" :disabled="loading" />
<cancel-button @click="dialogMode = false" :disabled="loading" />
<save-button
@click="$refs.form.submit()"
:loading="loading"
......@@ -67,22 +67,9 @@ export default {
},
mixins: [openableDialogMixin, objectFormPropsMixin, loadingMixin],
emits: ["cancel", "save"],
computed: {
dialog: {
get() {
return this.value;
},
set(newValue) {
this.$emit("input", newValue);
},
},
},
methods: {
close() {
this.dialog = false;
},
handleSave(items) {
this.dialog = false;
this.dialogMode = false;
this.$emit("save", items);
},
},
......
......@@ -47,7 +47,6 @@ export default {
this.$emit("cancel");
},
handleSuccess() {
this.dialog = false;
let snackbarTextKey = this.isCreate
? this.createSuccessMessageI18nKey
: this.editSuccessMessageI18nKey;
......
export default {
props: {
/**
* Dialog state (open or closed)
* Dialog-mode (open or closed)
* @model
* @values true,false
*/
......@@ -11,4 +11,25 @@ export default {
},
},
emits: ["input"],
data() {
return {
internalDialogMode: this.value,
};
},
computed: {
dialogMode: {
get() {
return this.internalDialogMode;
},
set(newValue) {
this.internalDialogMode = newValue;
this.$emit("input", newValue);
},
},
},
mounted() {
this.$watch("value", (newVal) => {
this.dialogMode = newVal;
});
},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment