MCPcopy Create free account
hub / github.com/DTStack/molecule / FolderTree

Function FolderTree

src/workbench/sidebar/explore/folderTree.tsx:68–261  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

66);
67
68const FolderTree: React.FunctionComponent<IFolderTreeProps> = (props) => {
69 const {
70 folderTree = {},
71 entry,
72 panel,
73 onUpdateFileName,
74 onSelectFile,
75 onDropTree,
76 onClickContextMenu,
77 onRightClick,
78 onLoadData,
79 createTreeNode,
80 onExpandKeys,
81 ...restProps
82 } = props;
83
84 const {
85 data = [],
86 folderPanelContextMenu = [],
87 expandKeys,
88 loadedKeys,
89 current,
90 } = folderTree;
91
92 const inputRef = useRef<HTMLInputElement>(null);
93 // tree context view
94 const contextMenu = useRef<ReturnType<typeof useContextMenu>>();
95
96 // panel context view
97 const contextView = useContextViewEle();
98
99 // to detect current tree whether is editable
100 const hasEditable = detectHasEditableStatus(data);
101
102 const onClickMenuItem = (e, item) => {
103 onClickContextMenu?.(item);
104 contextMenu.current?.hide();
105 };
106
107 // init context menu
108 const initContextMenu = () => {
109 return useContextMenu({
110 anchor: select(`.${folderTreeClassName}`),
111 render: () => (
112 <Menu
113 role="menu"
114 onClick={onClickMenuItem}
115 data={folderPanelContextMenu}
116 />
117 ),
118 });
119 };
120
121 const handleMenuClick = (
122 item: IMenuItemProps,
123 data: IFolderTreeNodeProps
124 ) => {
125 onClickContextMenu?.(item, data);

Callers

nothing calls this directly

Calls 5

useContextViewEleFunction · 0.90
classNamesFunction · 0.90
detectHasEditableStatusFunction · 0.85
initContextMenuFunction · 0.85
disposeMethod · 0.65

Tested by

no test coverage detected