MCPcopy Create free account
hub / github.com/ElemeFE/element-react / handleExpandIconClick

Method handleExpandIconClick

src/tree/Node.jsx:141–161  ·  view source on GitHub ↗
(evt: ?SyntheticEvent<any>)

Source from the content-addressed store, hash-verified

139 }
140
141 handleExpandIconClick(evt: ?SyntheticEvent<any>): void {
142 if (evt) evt.stopPropagation();
143
144 const { nodeModel, parent } = this.props;
145 const {onNodeCollapse, onNodeExpand} = this.props.treeNode.props;
146
147 if (nodeModel.isLeaf) return;
148
149 if (nodeModel.expanded) {
150 nodeModel.collapse()
151 this.refresh()
152 onNodeCollapse(nodeModel.data, nodeModel, this)
153 } else {
154 nodeModel.expand(() => {
155 this.setState({childNodeRendered: true }, () => {
156 onNodeExpand(nodeModel.data, nodeModel, this)
157 });
158 parent.closeSiblings(nodeModel)
159 });
160 }
161 }
162
163 closeSiblings(exclude: any){
164 const {treeNode, nodeModel} = this.props;

Callers 1

handleClickMethod · 0.95

Calls 6

refreshMethod · 0.95
onNodeCollapseFunction · 0.85
onNodeExpandFunction · 0.85
collapseMethod · 0.80
expandMethod · 0.80
closeSiblingsMethod · 0.45

Tested by

no test coverage detected