mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 09:21:54 +00:00
Item right menu (#3203)
* Add item right menu * Add item right menu * Pass value bug * Add item right menu * modify style problem * Add some style * Modifying naming issues * Modify Priority * Add showShare jurisdiction and modify priority * Modify subscript to itemIndex * Communication between sibling components * Improve interaction * modify style problem * Promotion isItemFreezed and onUnfreezedItem level * modify bugs * have tree-node bug * Solve tree-node item-click bug * Complete right click menu * modify style * modify style * item-right-menu finash * modify style to dirent-=list-item * modify some style problem * modify styles * stop thead contextmenu
This commit is contained in:
@@ -15,6 +15,8 @@ const propTypes = {
|
||||
onNodeCollapse: PropTypes.func.isRequired,
|
||||
onItemMove: PropTypes.func,
|
||||
currentRepoInfo: PropTypes.object,
|
||||
switchAnotherMenuToShow: PropTypes.func,
|
||||
appMenuType: PropTypes.oneOf(['list_view_contextmenu', 'item_contextmenu', 'tree_contextmenu', 'item_op_menu']),
|
||||
};
|
||||
|
||||
const PADDING_LEFT = 20;
|
||||
@@ -36,6 +38,10 @@ class TreeView extends React.Component {
|
||||
this.registerHandlers();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.registerHandlers();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.unregisterHandlers();
|
||||
}
|
||||
@@ -100,6 +106,7 @@ class TreeView extends React.Component {
|
||||
|
||||
onFreezedItem = () => {
|
||||
this.setState({isItemFreezed: true});
|
||||
this.props.switchAnotherMenuToShow('item_op_menu');
|
||||
}
|
||||
|
||||
onUnFreezedItem = () => {
|
||||
@@ -108,16 +115,18 @@ class TreeView extends React.Component {
|
||||
|
||||
contextMenu = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
this.props.switchAnotherMenuToShow('tree_contextmenu');
|
||||
|
||||
this.setState({
|
||||
isRightMenuShow:false,
|
||||
});
|
||||
setTimeout(() => {
|
||||
}, () => {
|
||||
this.setState({
|
||||
isRightMenuShow:true,
|
||||
fileData:this.state.nodeData,
|
||||
isRightMenuShow: true,
|
||||
fileData: this.state.nodeData,
|
||||
mousePosition: {clientX: e.clientX, clientY: e.clientY}
|
||||
})
|
||||
},40)
|
||||
})
|
||||
}
|
||||
|
||||
unregisterHandlers = () => {
|
||||
@@ -140,6 +149,7 @@ class TreeView extends React.Component {
|
||||
this.setState({
|
||||
isRightMenuShow:false,
|
||||
})
|
||||
this.onUnFreezedItem();
|
||||
}
|
||||
|
||||
onMenuItemClick = (operation, node) => {
|
||||
@@ -170,8 +180,9 @@ class TreeView extends React.Component {
|
||||
onNodeDrop={this.onNodeDrop}
|
||||
onNodeDragEnter={this.onNodeDragEnter}
|
||||
onNodeDragLeave={this.onNodeDragLeave}
|
||||
appMenuType={this.props.appMenuType}
|
||||
/>
|
||||
{this.state.isRightMenuShow && (
|
||||
{this.state.isRightMenuShow && this.props.appMenuType === 'tree_contextmenu' && (
|
||||
<TreeViewContextMenu
|
||||
node={this.state.fileData}
|
||||
onMenuItemClick={this.onMenuItemClick}
|
||||
|
Reference in New Issue
Block a user