Skip to content

Commit

Permalink
fix: manual pass Controller to View
Browse files Browse the repository at this point in the history
manual pass Controller to View
  • Loading branch information
zhangtengjin authored and wewoor committed Mar 11, 2021
1 parent cd6fa5b commit 03791e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/controller/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import * as React from 'react';
import { IFolderTree } from 'mo/model';
import { ExplorerView, FolderTreeView } from 'mo/workbench/sidebar/explore';
import { IActionBarItem } from 'mo/components/actionBar';

// TODO: 自依赖问题 connect 失效,暂时手动引入 Controller 往 View 层传递
import { folderTreeController, explorerController } from 'mo/controller';
export interface IExplorerController {
onHeaderToolbarClick?: (e: React.MouseEvent, item: IActionBarItem) => void;
}
Expand Down Expand Up @@ -42,7 +43,7 @@ export class ExplorerController
id: 'explore',
title: 'EXPLORER',
render() {
return <ExplorerView />;
return <ExplorerView {...explorerController} />;
},
};

Expand Down Expand Up @@ -128,7 +129,7 @@ export class ExplorerController
data: explorerState.folderTree?.data,
contextMenu: explorerState.folderTree?.contextMenu,
};
return <FolderTreeView {...folderProps} />;
return <FolderTreeView {...folderProps} {...folderTreeController} />;
},
};

Expand Down
1 change: 1 addition & 0 deletions src/workbench/sidebar/explore/explore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const Explorer: React.FunctionComponent<IExplorer> = (
props: IExplorer & IExplorerController
) => {
const { data = [], headerToolBar = [], onHeaderToolbarClick } = props;
console.log('Explorer => ExplorerController', props)
return (
<div className={defaultExplorerClassName}>
<Header
Expand Down
6 changes: 3 additions & 3 deletions src/workbench/sidebar/explore/folderTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const FolderTree: React.FunctionComponent<IFolderTree> = (
onClickContextMenu,
...restProps
} = props;

console.log('FolderTree => FolderTreeController', props)
const inputRef = useRef<any>(null);

const contextView = useContextView();
Expand Down Expand Up @@ -87,8 +87,8 @@ const FolderTree: React.FunctionComponent<IFolderTree> = (
onBlur={handleInputBlur}
/>
) : (
name
);
name
);
};

const renderByData = (
Expand Down

0 comments on commit 03791e7

Please sign in to comment.