@eturnity/eturnity_reusable_components 7.4.3-EPDM-9694.0 → 7.4.4
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
@@ -19,6 +19,7 @@
|
|
19
19
|
@on-apply-current-view="onApplyCurrentView()"
|
20
20
|
@on-prevent-close="onPreventClose($event)"
|
21
21
|
@on-reset-filters="onResetFilters()"
|
22
|
+
@on-container-click="onContainerClick()"
|
22
23
|
:hasActiveView="hasActiveView"
|
23
24
|
:activeView="activeView"
|
24
25
|
:activeLanguage="activeLanguage"
|
@@ -82,9 +83,19 @@ export default {
|
|
82
83
|
onToggleDropdown() {
|
83
84
|
this.isDropdownOpen = !this.isDropdownOpen
|
84
85
|
},
|
86
|
+
onContainerClick() {
|
87
|
+
// due to newer versions of Chrome (121), contains() is not always working.
|
88
|
+
// So, we need to add this so that the filter modal won't close
|
89
|
+
// when we open a dropdown. EPDM-9732
|
90
|
+
this.preventOutsideClick = true
|
91
|
+
setTimeout(() => {
|
92
|
+
this.preventOutsideClick = false
|
93
|
+
}, 100)
|
94
|
+
},
|
85
95
|
clickOutside(event) {
|
96
|
+
const target = event.target
|
86
97
|
if (
|
87
|
-
!this.$refs.dropdown.$el.contains(
|
98
|
+
!this.$refs.dropdown.$el.contains(target) &&
|
88
99
|
!this.preventOutsideClick
|
89
100
|
) {
|
90
101
|
this.isDropdownOpen = false
|
@@ -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>
|
@@ -20,13 +21,10 @@
|
|
20
21
|
</template>
|
21
22
|
|
22
23
|
<script>
|
23
|
-
// Rules: (as defined in https://e-turnity.atlassian.net/browse/EPDM-9694)
|
24
|
-
// 1. On clicking the “escape” key, close the modal onCloseModal()
|
25
|
-
// 2. Always prevent outside close
|
26
24
|
// import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
|
27
25
|
// This is a more flexible modal box, where the parent can decide how the body of the modal looks
|
28
26
|
// To use:
|
29
|
-
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true">
|
27
|
+
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
|
30
28
|
// <div>Data....</div>
|
31
29
|
// </modal>
|
32
30
|
|
@@ -120,6 +118,10 @@ export default {
|
|
120
118
|
required: true,
|
121
119
|
default: false
|
122
120
|
},
|
121
|
+
preventOutsideClose: {
|
122
|
+
required: false,
|
123
|
+
default: false
|
124
|
+
},
|
123
125
|
isLoading: {
|
124
126
|
required: false,
|
125
127
|
default: false
|
@@ -137,27 +139,20 @@ export default {
|
|
137
139
|
default: 'fixed'
|
138
140
|
}
|
139
141
|
},
|
140
|
-
beforeDestroy() {
|
141
|
-
window.removeEventListener('keydown', this.handleKeyDown)
|
142
|
-
},
|
143
142
|
methods: {
|
144
143
|
onCloseModal() {
|
145
144
|
this.$emit('on-close')
|
146
145
|
},
|
147
|
-
|
148
|
-
|
149
|
-
|
146
|
+
onOutsideClose() {
|
147
|
+
// If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
|
148
|
+
if (!this.preventOutsideClose) {
|
149
|
+
this.$emit('on-close')
|
150
150
|
}
|
151
151
|
}
|
152
152
|
},
|
153
153
|
watch: {
|
154
|
-
isOpen: function (
|
155
|
-
document.body.style.overflow =
|
156
|
-
if (isOpen) {
|
157
|
-
window.addEventListener('keydown', this.handleKeyDown)
|
158
|
-
} else {
|
159
|
-
window.removeEventListener('keydown', this.handleKeyDown)
|
160
|
-
}
|
154
|
+
isOpen: function (newVal) {
|
155
|
+
document.body.style.overflow = newVal ? 'hidden' : ''
|
161
156
|
}
|
162
157
|
}
|
163
158
|
}
|