Skip to content

Commit

Permalink
MappingBrowser go to page: Hide popover when clicked elsewhere (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Sep 27, 2022
1 parent 4cbee07 commit bd6c325
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/MappingBrowserTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@
placement="bottomleft"
@shown="goToPagePopoverShown"
@hide="popoverHide($event, `goToPage-${section.id}`)">
<div>
<div ref="goToPagePopover">
<p>
<b-input
v-model="goToPageValues[section.id]"
Expand Down Expand Up @@ -429,14 +429,15 @@ import auth from "@/mixins/auth.js"
import objects from "@/mixins/cdk.js"
import computed from "@/mixins/computed.js"
import hoverHandler from "@/mixins/hover-handler.js"
import clickHandler from "@/mixins/click-handler.js"
/**
* The mapping suggestion browser component.
*/
export default {
name: "MappingBrowser",
components: { ItemName, AutoLink, LoadingIndicator, LoadingIndicatorFull, FlexibleTable, RegistryInfo, MappingDetail, AnnotationPopover, DataModalButton, DateString },
mixins: [auth, objects, computed, hoverHandler],
mixins: [auth, objects, computed, hoverHandler, clickHandler],
props: {
sections: {
type: Array,
Expand Down Expand Up @@ -711,6 +712,17 @@ export default {
})
return handlers
},
// Click handler for go to page popover (makes it hide when clicked elsewhere)
clickHandlers() {
return [{
elements: [this.$refs.goToPagePopover && this.$refs.goToPagePopover[0]].concat(this.sections.map(section => document.getElementById(`mappingBrowser-pagination-goToPage-${section.id}`))).filter(Boolean),
handler: () => {
Object.keys(this.popoverShown).filter(key => key.startsWith("goToPage-")).forEach(key => {
this.popoverShown[key] = false
})
},
}]
},
searchForCreator(uri) {
let mappingBrowser = this.$parent
while (mappingBrowser && mappingBrowser.$options.name != "MappingBrowser") {
Expand Down

0 comments on commit bd6c325

Please sign in to comment.