File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ class Tree extends Component {
7474 onDragBefore : noop ,
7575 onDragAfter : noop ,
7676 customNodeTpl : noop ,
77+ renderItem : noop ,
7778 onLoadData : noop ,
7879 showLine : false ,
7980 lineType : 'default' ,
@@ -114,6 +115,7 @@ class Tree extends Component {
114115 onDragBefore : PropTypes . func ,
115116 onDragAfter : PropTypes . func ,
116117 customNodeTpl : PropTypes . func ,
118+ renderItem : PropTypes . func ,
117119 onLoadData : PropTypes . func ,
118120 showLine : PropTypes . bool ,
119121 lineType : PropTypes . oneOf ( [ 'default' , 'dashed' ] ) ,
@@ -718,6 +720,7 @@ class Tree extends Component {
718720 onDragMoving,
719721 onDragAfter,
720722 customNodeTpl,
723+ renderItem,
721724 isDynamicLoad,
722725 showLine,
723726 lineType,
@@ -772,6 +775,7 @@ class Tree extends Component {
772775 onDragMoving,
773776 onDragAfter,
774777 customNodeTpl,
778+ renderItem,
775779 removeNode,
776780 addNode,
777781 isDynamicLoad,
Original file line number Diff line number Diff line change 5151| onDragMoving | 拖动过程中调用 | Function | - |
5252| onDragAfter | 拖拽后调用 | Function | - |
5353| supportTooltip | 是否启用tooltip,为true时将根据文本长度自动增加tooltip。如数据超大,建议设置为false以节省性能 | Boolean | true |
54- | customNodeTpl | 自定义节点内容 | Function | - |
54+ | customNodeTpl | 添加自定义节点内容 | Function | - |
55+ | renderItem | 自定义节点内容 | Function | - |
5556| onLoadData | 动态加载数据 | Function | - |
5657| isDynamicLoad | 动态加载数据 | bool | false |
5758| showLine | 线性样式 | bool | false |
Original file line number Diff line number Diff line change @@ -172,6 +172,7 @@ class Node extends Component {
172172 removeNode,
173173 addNode,
174174 customNodeTpl,
175+ renderItem,
175176 isDynamicLoad,
176177 showLine,
177178 lineType,
@@ -267,6 +268,7 @@ class Node extends Component {
267268 supportCheckbox = { supportCheckbox }
268269 supportTooltip = { supportTooltip }
269270 onDoubleClick = { ( ) => onDoubleClick ( data ) }
271+ renderItem = { tmp => renderItem ?. ( data , tmp ) }
270272 />
271273 { /* 点击菜单 */ }
272274 { supportMenu && menuType !== RIGHT_MENU && ! disabled && (
@@ -407,6 +409,7 @@ function ShowSelection({
407409 onDoubleClick,
408410 onHandleSelect,
409411 supportTooltip,
412+ renderItem,
410413} ) {
411414 // 显示形式,有弹框菜单的与没有弹框菜单的,是否需要tooltip的,单选与多选的
412415 let nodeClassName = 'node-name' ;
@@ -485,6 +488,9 @@ function ShowSelection({
485488 ) ;
486489 }
487490 }
491+
492+ tmp = renderItem ?. ( tmp ) || tmp ;
493+
488494 const labelWidth = {
489495 width :
490496 supportMenu && menuType === DIALOG_MENU
You can’t perform that action at this time.
0 commit comments