First implementation of ResizableGrid and DockablePanel components#1835
First implementation of ResizableGrid and DockablePanel components#1835MV88 merged 4 commits intogeosolutions-it:masterfrom
Conversation
| const DockedGrid = React.createClass({ | ||
| propTypes: { | ||
| dockSize: React.PropTypes.number, | ||
| featureDockedGrid: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.func]), |
| > | ||
| <div id="feature-grid-container"> | ||
| <FeatureDockedGrid id="feature-docked-grid" | ||
| toolbar={{ |
There was a problem hiding this comment.
Can we configure this externally. We could have a grid without a toolbar
| onSizeChange={this.limitDockHeight} | ||
| fluid={true} | ||
| dimStyle={{ background: 'rgba(0, 0, 100, 0.2)' }} | ||
| dockStyle={null} |
| fluid={true} | ||
| dimStyle={{ background: 'rgba(0, 0, 100, 0.2)' }} | ||
| dockStyle={null} | ||
| dockHiddenStyle={null} |
| * @prop {object} [tools] The tools of the grid | ||
| * | ||
| */ | ||
| const FeatureDockedGrid = React.createClass({ |
There was a problem hiding this comment.
I don't see any Feature here
| getDefaultProps() { | ||
| return { | ||
| dockSize: 0.35, | ||
| featureDockedGrid: {}, |
| componentWillReceiveProps(newProps) { | ||
| if (this.props.size !== newProps.size) { | ||
| const pos = newProps.position; | ||
| if (pos === "right" || pos === "left") { |
There was a problem hiding this comment.
props.autoWidth = true if pos === right or left
props.autoHeight idem
| * @prop {object} [tools] The tools of the grid | ||
| * | ||
| */ | ||
| const FeatureDockedGrid = React.createClass({ |
| tools = [...tools, this.props.tools]; | ||
|
|
||
| return ( | ||
| <div style={{ |
| bottom: 2}}> | ||
| <span>{rowsSelected} {rowText} selected</span> | ||
| </div> | ||
| <ButtonToolbar className="featuregrid-tools" style={{marginLeft: "0px", flex: "none", marginBottom: "2px", marginRight: "2px"}} bsSize="sm"> |
There was a problem hiding this comment.
Add the toolbar in the container.
| flexDirection: "column", | ||
| height: "100%" | ||
| }}> | ||
| <div fluid={false} style={this.props.style} className="ag-fresh"> |
There was a problem hiding this comment.
Why this change? is related to the DockableGrid?
There was a problem hiding this comment.
because fluid is not a parameter of the div tag
|
|
||
| .react-grid-Main, .react-grid-Container, #feature-grid-container { | ||
| height: 100%; | ||
| width: 100% !important; |
There was a problem hiding this comment.
avoid !important when possible. Try to provide instead inline style
| width: 100% !important; | ||
| } | ||
| .react-grid-Container { | ||
| width: 100% !important; |
| height: 100% !important; | ||
| }*/ | ||
| .react-grid-Grid{ | ||
| min-height: 100% !important; |
| }, | ||
| render() { | ||
| return <ToggleButton {...this.getButtonProperties()} pressed={this.props.active} tooltip={<Tooltip><Message msgId={this.props.active ? this.props.activeTooltip : this.props.notActiveTooltip}/></Tooltip>} />; | ||
| return <ToggleButton {...this.getButtonProperties()} pressed={this.props.active} tooltip={<Tooltip id="globeViewSwitcher"><Message msgId={this.props.active ? this.props.activeTooltip : this.props.notActiveTooltip}/></Tooltip>} />; |
| flexDirection: "column", | ||
| height: "100%" | ||
| }}> | ||
| <div fluid={false} style={this.props.style} className="ag-fresh"> |
| <div id="container-wrapped-component" style={{height: "calc(100% - " + this.props.toolbarHeight + "px)"}}> | ||
| {this.props.wrappedComponent !== null ? (<WrappedComponent | ||
| size={{ | ||
| width: this.getAutoWidth(this.props.position), |
There was a problem hiding this comment.
use values instead of booleans and avoid the additional size parameter
| }, { | ||
| id: "3", | ||
| name: "Edifici" | ||
| }, { |
| fluid={this.props.fluid} | ||
| dimStyle={{ background: 'rgba(0, 0, 100, 0.2)' }} | ||
| > | ||
| <div id="container-wrapped-component" style={{height: "calc(100% - " + this.props.toolbarHeight + "px)"}}> |
| } | ||
| /* feauture grid */ | ||
| /* feature grid made by react-data-grid */ | ||
| #container-wrapped-component .react-grid-Header{ |
There was a problem hiding this comment.
.container-wrapped-component (same below)
use a better name like dockpanel-wrapped-component or something like this
| }, | ||
| getDefaultProps() { | ||
| return { | ||
| id: "dock", |
| rowGetter={this.rowGetter} | ||
| rowHeight={this.props.rowHeight} | ||
| rowKey={this.props.rowKey} | ||
| rowSelection={{ |
This PR is for adding to the feature grid components two new elements.
The DockablePanel components wrap any the ResizableGrid
Added tests and documentation