deep linking for models, operations and tags
This commit is contained in:
@@ -1,22 +1,32 @@
|
||||
import React, { Component, } from "react"
|
||||
import PropTypes from "prop-types"
|
||||
//import layoutActions from "actions/layout"
|
||||
|
||||
|
||||
export default class ModelWrapper extends Component {
|
||||
|
||||
|
||||
export default class ModelComponent extends Component {
|
||||
static propTypes = {
|
||||
schema: PropTypes.object.isRequired,
|
||||
name: PropTypes.string,
|
||||
getComponent: PropTypes.func.isRequired,
|
||||
getConfigs: PropTypes.func.isRequired,
|
||||
specSelectors: PropTypes.object.isRequired,
|
||||
expandDepth: PropTypes.number
|
||||
expandDepth: PropTypes.number,
|
||||
layoutActions: PropTypes.object,
|
||||
layoutSelectors: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
onToggle = (name,isShown) => {
|
||||
this.props.layoutActions.show(["models", name],isShown)
|
||||
}
|
||||
|
||||
render(){
|
||||
let { getComponent, getConfigs } = this.props
|
||||
const Model = getComponent("Model")
|
||||
|
||||
const expanded = this.props.layoutSelectors.isShown(["models",this.props.name])
|
||||
return <div className="model-box">
|
||||
<Model { ...this.props } getConfigs={ getConfigs } depth={ 1 } expandDepth={ this.props.expandDepth || 0 }/>
|
||||
<Model { ...this.props } getConfigs={ getConfigs } expanded={expanded} depth={ 1 } onToggle={ this.onToggle} expandDepth={ this.props.expandDepth || 0 }/>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user