mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 21:30:39 +00:00
optimize menu show&hide (#5481)
This commit is contained in:
@@ -81,7 +81,7 @@ class ContextMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleShow = (e) => {
|
handleShow = (e) => {
|
||||||
if (e.detail.id !== this.props.id || this.state.isVisible) return;
|
if (e.detail.id !== this.props.id) return;
|
||||||
|
|
||||||
const { x, y } = e.detail.position;
|
const { x, y } = e.detail.position;
|
||||||
const { currentObject, menuList} = e.detail;
|
const { currentObject, menuList} = e.detail;
|
||||||
|
@@ -39,7 +39,7 @@ const propTypes = {
|
|||||||
onItemsDelete: PropTypes.func.isRequired,
|
onItemsDelete: PropTypes.func.isRequired,
|
||||||
onFileTagChanged: PropTypes.func,
|
onFileTagChanged: PropTypes.func,
|
||||||
showDirentDetail: PropTypes.func.isRequired,
|
showDirentDetail: PropTypes.func.isRequired,
|
||||||
loadDirentList: PropTypes.func.isRequired,
|
loadDirentList: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirListView extends React.Component {
|
class DirListView extends React.Component {
|
||||||
|
@@ -80,6 +80,7 @@ class DirentGridView extends React.Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
onGridItemClick = (dirent) => {
|
onGridItemClick = (dirent) => {
|
||||||
|
hideMenu();
|
||||||
this.setState({activeDirent: dirent});
|
this.setState({activeDirent: dirent});
|
||||||
this.props.onGridItemClick(dirent);
|
this.props.onGridItemClick(dirent);
|
||||||
}
|
}
|
||||||
@@ -367,6 +368,7 @@ class DirentGridView extends React.Component{
|
|||||||
}
|
}
|
||||||
|
|
||||||
gridContainerClick = () => {
|
gridContainerClick = () => {
|
||||||
|
hideMenu();
|
||||||
if (!this.props.isDirentDetailShow) {
|
if (!this.props.isDirentDetailShow) {
|
||||||
this.onGridItemClick(null);
|
this.onGridItemClick(null);
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ const propTypes = {
|
|||||||
isGroupOwnedRepo: PropTypes.bool.isRequired,
|
isGroupOwnedRepo: PropTypes.bool.isRequired,
|
||||||
userPerm: PropTypes.string,
|
userPerm: PropTypes.string,
|
||||||
showDirentDetail: PropTypes.func.isRequired,
|
showDirentDetail: PropTypes.func.isRequired,
|
||||||
loadDirentList: PropTypes.func.isRequired,
|
loadDirentList: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirentListView extends React.Component {
|
class DirentListView extends React.Component {
|
||||||
@@ -125,6 +125,7 @@ class DirentListView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDirentClick = (dirent) => {
|
onDirentClick = (dirent) => {
|
||||||
|
hideMenu();
|
||||||
if (this.props.selectedDirentList.length > 0 && !this.state.activeDirent ) {
|
if (this.props.selectedDirentList.length > 0 && !this.state.activeDirent ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -311,6 +312,7 @@ class DirentListView extends React.Component {
|
|||||||
|
|
||||||
// table-container contextmenu handle
|
// table-container contextmenu handle
|
||||||
onContainerClick = () => {
|
onContainerClick = () => {
|
||||||
|
hideMenu();
|
||||||
if (this.state.activeDirent) {
|
if (this.state.activeDirent) {
|
||||||
this.onDirentClick(null);
|
this.onDirentClick(null);
|
||||||
}
|
}
|
||||||
|
@@ -86,6 +86,15 @@ class TreeView extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onContainerClick = (event) => {
|
||||||
|
hideMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
onNodeClick = (node) => {
|
||||||
|
hideMenu();
|
||||||
|
this.props.onNodeClick(node);
|
||||||
|
}
|
||||||
|
|
||||||
onNodeDrop = (e, node) => {
|
onNodeDrop = (e, node) => {
|
||||||
if (Utils.isIEBrower() || !this.canDrop) {
|
if (Utils.isIEBrower() || !this.canDrop) {
|
||||||
return false;
|
return false;
|
||||||
@@ -308,6 +317,7 @@ class TreeView extends React.Component {
|
|||||||
onDragLeave={this.onNodeDragLeave}
|
onDragLeave={this.onNodeDragLeave}
|
||||||
onMouseDown={this.onMouseDown}
|
onMouseDown={this.onMouseDown}
|
||||||
onContextMenu={this.onContextMenu}
|
onContextMenu={this.onContextMenu}
|
||||||
|
onClick={this.onContainerClick}
|
||||||
>
|
>
|
||||||
<TreeNodeView
|
<TreeNodeView
|
||||||
userPerm={this.props.userPerm}
|
userPerm={this.props.userPerm}
|
||||||
@@ -316,7 +326,7 @@ class TreeView extends React.Component {
|
|||||||
paddingLeft={PADDING_LEFT}
|
paddingLeft={PADDING_LEFT}
|
||||||
isNodeMenuShow={this.props.isNodeMenuShow}
|
isNodeMenuShow={this.props.isNodeMenuShow}
|
||||||
isItemFreezed={this.state.isItemFreezed}
|
isItemFreezed={this.state.isItemFreezed}
|
||||||
onNodeClick={this.props.onNodeClick}
|
onNodeClick={this.onNodeClick}
|
||||||
onMenuItemClick={this.props.onMenuItemClick}
|
onMenuItemClick={this.props.onMenuItemClick}
|
||||||
onNodeExpanded={this.props.onNodeExpanded}
|
onNodeExpanded={this.props.onNodeExpanded}
|
||||||
onNodeCollapse={this.props.onNodeCollapse}
|
onNodeCollapse={this.props.onNodeCollapse}
|
||||||
|
Reference in New Issue
Block a user