-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
593692f
commit 3ee6dbb
Showing
26 changed files
with
275 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
web/client/components/data/featuregrid/enhancers/withHint.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
const {compose, branch} = require('recompose'); | ||
const tooltip = require('../../../misc/enhancers/tooltip'); | ||
const withPopover = require('./withPopover'); | ||
module.exports = compose( | ||
branch( | ||
(({renderPopover, popoverOptions} = {}) => renderPopover && !!popoverOptions), | ||
withPopover, | ||
tooltip | ||
) | ||
); |
28 changes: 28 additions & 0 deletions
28
web/client/components/data/featuregrid/enhancers/withPopover.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const React = require('react'); | ||
const Overlay = require('../../../misc/Overlay'); | ||
const {Popover} = require('react-bootstrap'); | ||
const ReactDOM = require('react-dom'); | ||
|
||
/** | ||
* An overlay popover is added to a Wrapped component | ||
* @param {object} Wrapped must be a class component, do not use a functional | ||
* component because it misses the refs property | ||
* you can customize popover props, content and placement | ||
*/ | ||
module.exports = (Wrapped) => class WithPopover extends React.Component { | ||
render() { | ||
let target = null; | ||
const {popoverOptions, ...props} = this.props; | ||
return ( | ||
<span className="mapstore-info-popover"> | ||
<Wrapped {...this.props} ref={button => { target = button; }} /> | ||
<Overlay placement={popoverOptions.placement} show target={() => ReactDOM.findDOMNode(target)}> | ||
<Popover | ||
{...popoverOptions.props}> | ||
{popoverOptions.content} | ||
</Popover> | ||
</Overlay> | ||
</span> | ||
); | ||
} | ||
}; |
8 changes: 8 additions & 0 deletions
8
web/client/components/data/featuregrid/enhancers/withTooltip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const React = require('react'); | ||
const OverlayTrigger = require('../../../misc/OverlayTrigger'); | ||
const {Tooltip} = require('react-bootstrap'); | ||
|
||
module.exports = (Wrapped) => ({tooltip, id, placement, ...props}) => | ||
(<OverlayTrigger placement={placement} overlay={<Tooltip id={`fe-${id}`}>{tooltip}</Tooltip>}> | ||
<Wrapped {...props}/> | ||
</OverlayTrigger>); |
20 changes: 10 additions & 10 deletions
20
web/client/components/data/featuregrid/toolbars/TButton.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
const React = require('react'); | ||
const {Button, Glyphicon, Tooltip} = require('react-bootstrap'); | ||
const OverlayTrigger = require('../../../misc/OverlayTrigger'); | ||
const {Button, Glyphicon} = require('react-bootstrap'); | ||
const hideStyle = { | ||
width: 0, | ||
padding: 0, | ||
borderWidth: 0 | ||
}; | ||
const normalStyle = { | ||
}; | ||
|
||
const normalStyle = {}; | ||
const getStyle = (visible) => visible ? normalStyle : hideStyle; | ||
module.exports = ({disabled, id, tooltip="", visible, onClick, glyph, active, className = "square-button"}) => | ||
(<OverlayTrigger placement="top" overlay={<Tooltip id={`fe-${id}`}>{tooltip}</Tooltip>}> | ||
<Button key={id} bsStyle={active ? "success" : "primary"} disabled={disabled} id={`fg-${id}`} | ||
|
||
module.exports = class SimpleTButton extends React.Component { | ||
render() { | ||
const {disabled, id, visible, onClick, glyph, active, className = "square-button", ...props} = this.props; | ||
return (<Button {...props} bsStyle={active ? "success" : "primary"} disabled={disabled} id={`fg-${id}`} | ||
style={getStyle(visible)} | ||
className={className} | ||
onClick={() => !disabled && onClick()}> | ||
<Glyphicon glyph={glyph}/> | ||
</Button> | ||
</OverlayTrigger>); | ||
</Button>); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.