@eturnity/eturnity_reusable_components 7.4.3-EPDM-9694.0 → 7.4.4-EPDM-9677.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.4.3-EPDM-9694.0",
3
+ "version": "7.4.4-EPDM-9677.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <container-wrapper>
2
+ <container-wrapper @click="$emit('on-container-click')">
3
3
  <upper-container v-if="filterViews && filterViews.length">
4
4
  <view-container :maxWidth="activeView.length">
5
5
  <select-component
@@ -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(event.target) &&
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>
@@ -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
 
@@ -85,6 +86,22 @@ const ModalContainer = styled.div`
85
86
  min-width: 100px;
86
87
  min-height: 100px;
87
88
 
89
+ ::-webkit-scrollbar {
90
+ width: 0.3em;
91
+ height: 100%;
92
+ background-color: ${(props) => props.theme.colors.grey5};
93
+ }
94
+
95
+ /* Make scrollbar visible when needed */
96
+ ::-webkit-scrollbar-thumb {
97
+ background-color: ${(props) => props.theme.colors.grey3};
98
+ }
99
+
100
+ /* Make scrollbar track visible when needed */
101
+ ::-webkit-scrollbar-track {
102
+ background-color: ${(props) => props.theme.colors.grey5};
103
+ }
104
+
88
105
  .close {
89
106
  position: absolute;
90
107
  right: 20px;
@@ -120,6 +137,10 @@ export default {
120
137
  required: true,
121
138
  default: false
122
139
  },
140
+ preventOutsideClose: {
141
+ required: false,
142
+ default: false
143
+ },
123
144
  isLoading: {
124
145
  required: false,
125
146
  default: false
@@ -137,27 +158,20 @@ export default {
137
158
  default: 'fixed'
138
159
  }
139
160
  },
140
- beforeDestroy() {
141
- window.removeEventListener('keydown', this.handleKeyDown)
142
- },
143
161
  methods: {
144
162
  onCloseModal() {
145
163
  this.$emit('on-close')
146
164
  },
147
- handleKeyDown({ key }) {
148
- if (key === 'Escape') {
149
- this.onCloseModal()
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')
150
169
  }
151
170
  }
152
171
  },
153
172
  watch: {
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
- }
173
+ isOpen: function (newVal) {
174
+ document.body.style.overflow = newVal ? 'hidden' : ''
161
175
  }
162
176
  }
163
177
  }