@eturnity/eturnity_reusable_components 7.6.1-qa-16-02-15.1 → 7.8.0
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/package.json
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
:position="position"
|
4
4
|
:isOpen="isOpen"
|
5
5
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
6
|
+
@click.native="onOutsideClose()"
|
6
7
|
:backdrop="backdrop"
|
7
8
|
>
|
8
9
|
<modal-container @click.stop>
|
@@ -26,7 +27,7 @@
|
|
26
27
|
// import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
|
27
28
|
// This is a more flexible modal box, where the parent can decide how the body of the modal looks
|
28
29
|
// To use:
|
29
|
-
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true">
|
30
|
+
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
|
30
31
|
// <div>Data....</div>
|
31
32
|
// </modal>
|
32
33
|
|
@@ -136,6 +137,10 @@ export default {
|
|
136
137
|
required: true,
|
137
138
|
default: false
|
138
139
|
},
|
140
|
+
preventOutsideClose: {
|
141
|
+
required: false,
|
142
|
+
default: false
|
143
|
+
},
|
139
144
|
isLoading: {
|
140
145
|
required: false,
|
141
146
|
default: false
|
@@ -153,30 +158,20 @@ export default {
|
|
153
158
|
default: 'fixed'
|
154
159
|
}
|
155
160
|
},
|
156
|
-
beforeDestroy() {
|
157
|
-
window.removeEventListener('keydown', this.handleKeyDown)
|
158
|
-
},
|
159
161
|
methods: {
|
160
162
|
onCloseModal() {
|
161
163
|
this.$emit('on-close')
|
162
164
|
},
|
163
|
-
|
164
|
-
|
165
|
-
|
165
|
+
onOutsideClose() {
|
166
|
+
// If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
|
167
|
+
if (!this.preventOutsideClose) {
|
168
|
+
this.$emit('on-close')
|
166
169
|
}
|
167
170
|
}
|
168
171
|
},
|
169
172
|
watch: {
|
170
|
-
isOpen: {
|
171
|
-
|
172
|
-
handler(isOpen) {
|
173
|
-
document.body.style.overflow = isOpen ? 'hidden' : ''
|
174
|
-
if (isOpen) {
|
175
|
-
window.addEventListener('keydown', this.handleKeyDown)
|
176
|
-
} else {
|
177
|
-
window.removeEventListener('keydown', this.handleKeyDown)
|
178
|
-
}
|
179
|
-
}
|
173
|
+
isOpen: function (newVal) {
|
174
|
+
document.body.style.overflow = newVal ? 'hidden' : ''
|
180
175
|
}
|
181
176
|
}
|
182
177
|
}
|