Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
66041743
Commit
66041743
authored
9 years ago
by
Tom Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Support nested popovers by keeping track of which is the top one
parent
5b93f9c4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/frontend_client/app/query_builder/popover_content.react.js
+25
-2
25 additions, 2 deletions
...rontend_client/app/query_builder/popover_content.react.js
with
25 additions
and
2 deletions
resources/frontend_client/app/query_builder/popover_content.react.js
+
25
−
2
View file @
66041743
...
...
@@ -5,12 +5,35 @@ import OnClickOutside from 'react-onclickoutside';
// this feels a little silly, but we have this component ONLY so that we can add the OnClickOutside functionality on an
// arbitrary set of html content. I wish we could do that more easily
// keep track of the order popovers were opened so we only close the last one when clicked outside
var
popoverStack
=
[];
export
default
React
.
createClass
({
displayName
:
'
PopoverContent
'
,
mixins
:
[
OnClickOutside
],
handleClickOutside
:
function
()
{
this
.
props
.
handleClickOutside
();
componentWillMount
:
function
()
{
popoverStack
.
push
(
this
);
},
componentDidMount
:
function
()
{
// HACK: set the z-index of the parent element to ensure it's always on top
this
.
getDOMNode
().
parentNode
.
style
.
zIndex
=
popoverStack
.
length
;
},
componentWillUnmount
:
function
()
{
// remove popover from the stack
var
index
=
popoverStack
.
indexOf
(
this
);
if
(
index
>=
0
)
{
popoverStack
.
splice
(
index
,
1
);
}
},
handleClickOutside
:
function
(
e
)
{
// only propagate event for the popover on top of the stack
if
(
this
===
popoverStack
[
popoverStack
.
length
-
1
])
{
this
.
props
.
handleClickOutside
();
}
},
render
:
function
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment