@afeefa/vue-app 0.0.208 → 0.0.210
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.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.210
|
package/package.json
CHANGED
@@ -40,12 +40,12 @@
|
|
40
40
|
</v-btn>
|
41
41
|
|
42
42
|
<edit-form-buttons
|
43
|
-
:changed="changed"
|
43
|
+
:changed="changed || _changed"
|
44
44
|
:valid="validFromOutside && valid"
|
45
45
|
angular
|
46
46
|
:has="{reset: reset && !!modelToEdit.id}"
|
47
47
|
@save="$emit('save', modelToEdit, ignoreChangesOnClose, close)"
|
48
|
-
@reset="
|
48
|
+
@reset="resetForm"
|
49
49
|
/>
|
50
50
|
</a-row>
|
51
51
|
</template>
|
@@ -61,11 +61,15 @@ import { Component, Vue, Watch } from '@a-vue'
|
|
61
61
|
import { DialogEvent } from '@a-vue/events'
|
62
62
|
|
63
63
|
@Component({
|
64
|
-
props: ['model', 'createModelToEdit', 'show', {reset: true, valid: true}]
|
64
|
+
props: ['model', 'createModelToEdit', 'show', {reset: true, valid: true, changed: false}]
|
65
65
|
})
|
66
66
|
export default class EditModal extends Vue {
|
67
67
|
show_ = false
|
68
68
|
|
69
|
+
get _changed () {
|
70
|
+
return this.changed
|
71
|
+
}
|
72
|
+
|
69
73
|
created () {
|
70
74
|
if (!this.model && !this.createModelToEdit) {
|
71
75
|
console.warn('You need to pass either a model or a model factory to <edit-modal>.')
|
@@ -113,7 +117,7 @@ export default class EditModal extends Vue {
|
|
113
117
|
|
114
118
|
async beforeClose () {
|
115
119
|
// run only if show_ is true to prevent double checks with a-modal
|
116
|
-
if (this.show_ && this.$refs.form.changed) {
|
120
|
+
if (this.show_ && (this.$refs.form.changed || this._changed)) {
|
117
121
|
const result = await this.$events.dispatch(new DialogEvent(DialogEvent.SHOW, {
|
118
122
|
title: 'Änderungen verwerfen?',
|
119
123
|
message: 'Im Formular sind nicht gespeicherte Änderungen. Sollen diese verworfen werden?',
|
@@ -146,5 +150,10 @@ export default class EditModal extends Vue {
|
|
146
150
|
resetChanged () {
|
147
151
|
this.$refs.form.resetChanged()
|
148
152
|
}
|
153
|
+
|
154
|
+
resetForm () {
|
155
|
+
this.$refs.form.reset()
|
156
|
+
this.$emit('reset')
|
157
|
+
}
|
149
158
|
}
|
150
159
|
</script>
|