Commit 84ef543e by Яков

add func renderHeaderColumn

parent 7bd49cc7
...@@ -86,5 +86,15 @@ ...@@ -86,5 +86,15 @@
}, },
"resolutions": { "resolutions": {
"graceful-fs": "^4.2.4" "graceful-fs": "^4.2.4"
},
"babel": {
"presets": [
"@babel/preset-react",
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-transform-react-jsx",
"@babel/plugin-proposal-class-properties"
]
} }
} }
...@@ -122,18 +122,22 @@ class ReactFinder extends PureComponent { ...@@ -122,18 +122,22 @@ class ReactFinder extends PureComponent {
} }
renderDetail() { renderDetail() {
const {renderDetail, dataSource, nodeKey, childrenPropName} = this.props; const { renderDetail, dataSource, nodeKey, childrenPropName } = this.props;
const {selectedKey} = this.state; const { selectedKey } = this.state;
const el = renderDetail && renderDetail({ const el = renderDetail && renderDetail({
selectedKey, selectedKey,
selectedData: findInTree( selectedData: findInTree(
dataSource, dataSource,
n => n[nodeKey] === selectedKey, {childrenName: childrenPropName} n => n[nodeKey] === selectedKey, { childrenName: childrenPropName }
) )
}); });
if (el) { if (el) {
return (<div className="react-finder-detail">{el}</div>); return (
<div className="react-finder-detail">
{el}
</div>
);
} }
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment