@eturnity/eturnity_reusable_components 7.4.4-EPDM-9606 → 7.4.4-qa-16-02-05

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.4.4-EPDM-9606",
3
+ "version": "7.4.4-qa-16-02-05",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -3,7 +3,6 @@
3
3
  :position="position"
4
4
  :isOpen="isOpen"
5
5
  :class="{ visible: isOpen, hidden: !isOpen }"
6
- @click.native="onOutsideClose()"
7
6
  :backdrop="backdrop"
8
7
  >
9
8
  <modal-container @click.stop>
@@ -27,7 +26,7 @@
27
26
  // import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
28
27
  // This is a more flexible modal box, where the parent can decide how the body of the modal looks
29
28
  // To use:
30
- // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
29
+ // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true">
31
30
  // <div>Data....</div>
32
31
  // </modal>
33
32
 
@@ -121,10 +120,6 @@ export default {
121
120
  required: true,
122
121
  default: false
123
122
  },
124
- preventOutsideClose: {
125
- required: false,
126
- default: false
127
- },
128
123
  isLoading: {
129
124
  required: false,
130
125
  default: false
@@ -142,20 +137,27 @@ export default {
142
137
  default: 'fixed'
143
138
  }
144
139
  },
140
+ beforeDestroy() {
141
+ window.removeEventListener('keydown', this.handleKeyDown)
142
+ },
145
143
  methods: {
146
144
  onCloseModal() {
147
145
  this.$emit('on-close')
148
146
  },
149
- onOutsideClose() {
150
- // If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
151
- if (!this.preventOutsideClose) {
152
- this.$emit('on-close')
147
+ handleKeyDown({ key }) {
148
+ if (key === 'Escape') {
149
+ this.onCloseModal()
153
150
  }
154
151
  }
155
152
  },
156
153
  watch: {
157
- isOpen: function (newVal) {
158
- document.body.style.overflow = newVal ? 'hidden' : ''
154
+ isOpen: function (isOpen) {
155
+ document.body.style.overflow = isOpen ? 'hidden' : ''
156
+ if (isOpen) {
157
+ window.addEventListener('keydown', this.handleKeyDown)
158
+ } else {
159
+ window.removeEventListener('keydown', this.handleKeyDown)
160
+ }
159
161
  }
160
162
  }
161
163
  }