mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 11:21:29 +00:00
Fix eslint warnings (#5635)
* 01 fix eslint warnings * fix code warnings * fix code warnings * fix code warnings * fix code warnings * fix code warnings
This commit is contained in:
@@ -60,7 +60,7 @@ class TreeNodeView extends React.Component {
|
||||
isHighlight: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onMouseOver = () => {
|
||||
if (!this.props.isItemFreezed) {
|
||||
@@ -69,7 +69,7 @@ class TreeNodeView extends React.Component {
|
||||
isHighlight: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onMouseLeave = () => {
|
||||
if (!this.props.isItemFreezed) {
|
||||
@@ -78,7 +78,7 @@ class TreeNodeView extends React.Component {
|
||||
isHighlight: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onNodeClick = () => {
|
||||
const { node } = this.props;
|
||||
@@ -91,9 +91,9 @@ class TreeNodeView extends React.Component {
|
||||
if (isCustomPermission) {
|
||||
const { preview: canPreview, modify: canModify } = customPermission.permission;
|
||||
if (!canPreview && !canModify) return;
|
||||
}
|
||||
}
|
||||
this.props.onNodeClick(this.props.node);
|
||||
}
|
||||
};
|
||||
|
||||
onLoadToggle = (e) => {
|
||||
e.stopPropagation();
|
||||
@@ -103,14 +103,14 @@ class TreeNodeView extends React.Component {
|
||||
} else {
|
||||
this.props.onNodeExpanded(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragStart = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
return false;
|
||||
}
|
||||
this.props.onNodeDragStart(e, this.props.node);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragEnter = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
@@ -120,14 +120,14 @@ class TreeNodeView extends React.Component {
|
||||
this.setState({isNodeDropShow: true});
|
||||
}
|
||||
this.props.onNodeDragEnter(e, this.props.node);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragMove = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
return false;
|
||||
}
|
||||
this.props.onNodeDragMove(e);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragLeave = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
@@ -135,7 +135,7 @@ class TreeNodeView extends React.Component {
|
||||
}
|
||||
this.setState({isNodeDropShow: false});
|
||||
this.props.onNodeDragLeave(e, this.props.node);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDrop = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrag) {
|
||||
@@ -144,32 +144,32 @@ class TreeNodeView extends React.Component {
|
||||
e.stopPropagation();
|
||||
this.setState({isNodeDropShow: false});
|
||||
this.props.onNodeDrop(e, this.props.node);
|
||||
}
|
||||
};
|
||||
|
||||
unfreezeItem = () => {
|
||||
this.setState({isShowOperationMenu: false});
|
||||
this.props.unfreezeItem();
|
||||
}
|
||||
};
|
||||
|
||||
onMenuItemClick = (operation, event, node) => {
|
||||
this.props.onMenuItemClick(operation, node);
|
||||
}
|
||||
};
|
||||
|
||||
onItemMouseDown = (event) => {
|
||||
event.stopPropagation();
|
||||
if (event.button === 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onItemContextMenu = (event) => {
|
||||
this.handleContextClick(event);
|
||||
}
|
||||
};
|
||||
|
||||
handleContextClick = (event) => {
|
||||
this.props.handleContextClick(event, this.props.node);
|
||||
this.setState({isShowOperationMenu: false});
|
||||
}
|
||||
};
|
||||
|
||||
getNodeTypeAndIcon = () => {
|
||||
let { node } = this.props;
|
||||
@@ -200,7 +200,7 @@ class TreeNodeView extends React.Component {
|
||||
}
|
||||
}
|
||||
return {icon, type};
|
||||
}
|
||||
};
|
||||
|
||||
calculateMenuList = (node) => {
|
||||
let { NEW_FOLDER, NEW_FILE, COPY, MOVE, RENAME, DELETE, OPEN_VIA_CLIENT} = TextTranslation;
|
||||
@@ -226,12 +226,12 @@ class TreeNodeView extends React.Component {
|
||||
canModify && menuList.push(MOVE, RENAME);
|
||||
canDelete && menuList.push(DELETE);
|
||||
|
||||
if (node.object.type !== 'dir') {
|
||||
if (node.object.type !== 'dir') {
|
||||
menuList.push(OPEN_VIA_CLIENT);
|
||||
}
|
||||
|
||||
return menuList;
|
||||
}
|
||||
};
|
||||
|
||||
renderChildren = () => {
|
||||
let { node, paddingLeft } = this.props;
|
||||
@@ -267,7 +267,7 @@ class TreeNodeView extends React.Component {
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
let { currentPath, node, isNodeMenuShow, userPerm } = this.props;
|
||||
@@ -277,7 +277,7 @@ class TreeNodeView extends React.Component {
|
||||
hlClass = 'tree-node-hight-light';
|
||||
}
|
||||
|
||||
const { isCustomPermission } = Utils.getUserPermission(userPerm)
|
||||
const { isCustomPermission } = Utils.getUserPermission(userPerm);
|
||||
return (
|
||||
<div className="tree-node">
|
||||
<div
|
||||
|
@@ -1,7 +1,7 @@
|
||||
class TreeNode {
|
||||
|
||||
constructor({ path, object, isLoaded, isPreload, isExpanded, parentNode }) {
|
||||
this.path = path || object.name, // The default setting is the object name, which is set to a relative path when the father is set.
|
||||
this.path = path || object.name; // The default setting is the object name, which is set to a relative path when the father is set.
|
||||
this.object = object;
|
||||
this.isLoaded = isLoaded || false;
|
||||
this.isPreload = isPreload || false;
|
||||
|
@@ -19,6 +19,8 @@ const propTypes = {
|
||||
currentRepoInfo: PropTypes.object,
|
||||
selectedDirentList: PropTypes.array,
|
||||
onItemsMove: PropTypes.func,
|
||||
posX: PropTypes.number.isRequired,
|
||||
posY: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
const PADDING_LEFT = 20;
|
||||
@@ -42,7 +44,7 @@ class TreeView extends React.Component {
|
||||
|
||||
onItemMove = (repo, dirent, selectedPath, currentPath) => {
|
||||
this.props.onItemMove(repo, dirent, selectedPath, currentPath);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragStart = (e, node) => {
|
||||
if (Utils.isIEBrower()) {
|
||||
@@ -53,7 +55,7 @@ class TreeView extends React.Component {
|
||||
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
e.dataTransfer.setData('applicaiton/drag-item-info', dragStartNodeData);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragEnter = (e, node) => {
|
||||
if (Utils.isIEBrower() || !this.canDrop) {
|
||||
@@ -65,7 +67,7 @@ class TreeView extends React.Component {
|
||||
isTreeViewDropTipShow: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragMove = (e) => {
|
||||
if (Utils.isIEBrower() || !this.canDrop) {
|
||||
@@ -73,7 +75,7 @@ class TreeView extends React.Component {
|
||||
}
|
||||
e.preventDefault();
|
||||
e.dataTransfer.dropEffect = 'move';
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDragLeave = (e, node) => {
|
||||
if (Utils.isIEBrower() || !this.canDrop) {
|
||||
@@ -84,16 +86,16 @@ class TreeView extends React.Component {
|
||||
isTreeViewDropTipShow: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onContainerClick = (event) => {
|
||||
hideMenu();
|
||||
}
|
||||
};
|
||||
|
||||
onNodeClick = (node) => {
|
||||
hideMenu();
|
||||
this.props.onNodeClick(node);
|
||||
}
|
||||
};
|
||||
|
||||
onNodeDrop = (e, node) => {
|
||||
if (Utils.isIEBrower() || !this.canDrop) {
|
||||
@@ -158,7 +160,7 @@ class TreeView extends React.Component {
|
||||
}
|
||||
|
||||
this.onItemMove(this.props.currentRepoInfo, nodeDirent, dropNodeData.path, nodeParentPath);
|
||||
}
|
||||
};
|
||||
|
||||
onMoveItems = (dragStartNodeData, dropNodeData, destRepo, destDirentPath) => {
|
||||
let direntPaths = [];
|
||||
@@ -191,27 +193,27 @@ class TreeView extends React.Component {
|
||||
}
|
||||
|
||||
this.props.onItemsMove(destRepo, destDirentPath);
|
||||
}
|
||||
};
|
||||
|
||||
freezeItem = () => {
|
||||
this.setState({isItemFreezed: true});
|
||||
}
|
||||
};
|
||||
|
||||
unfreezeItem = () => {
|
||||
this.setState({isItemFreezed: false});
|
||||
}
|
||||
};
|
||||
|
||||
onMenuItemClick = (operation, node) => {
|
||||
this.props.onMenuItemClick(operation, node);
|
||||
hideMenu();
|
||||
}
|
||||
};
|
||||
|
||||
onMouseDown = (event) => {
|
||||
event.stopPropagation();
|
||||
if (event.button === 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onContextMenu = (event) => {
|
||||
event.preventDefault();
|
||||
@@ -221,7 +223,7 @@ class TreeView extends React.Component {
|
||||
return '';
|
||||
}
|
||||
this.handleContextClick(event);
|
||||
}
|
||||
};
|
||||
|
||||
handleContextClick = (event, node) => {
|
||||
event.preventDefault();
|
||||
@@ -254,7 +256,7 @@ class TreeView extends React.Component {
|
||||
};
|
||||
|
||||
showMenu(showMenuConfig);
|
||||
}
|
||||
};
|
||||
|
||||
getMenuList = (node) => {
|
||||
let menuList = [];
|
||||
@@ -293,20 +295,20 @@ class TreeView extends React.Component {
|
||||
canModify && menuList.push(MOVE, RENAME);
|
||||
canDelete && menuList.push(DELETE);
|
||||
|
||||
if (node.object.type !== 'dir') {
|
||||
if (node.object.type !== 'dir') {
|
||||
menuList.push(OPEN_VIA_CLIENT);
|
||||
}
|
||||
|
||||
return menuList;
|
||||
}
|
||||
};
|
||||
|
||||
onShowMenu = () => {
|
||||
this.freezeItem();
|
||||
}
|
||||
};
|
||||
|
||||
onHideMenu = () => {
|
||||
this.unfreezeItem();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
|
Reference in New Issue
Block a user