mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-11 03:41:12 +00:00
Modify some code structure
This commit is contained in:
@@ -77,7 +77,6 @@ class DirGridView extends React.Component {
|
|||||||
isDirentDetailShow={this.props.isDirentDetailShow}
|
isDirentDetailShow={this.props.isDirentDetailShow}
|
||||||
onItemRename={this.props.onItemRename}
|
onItemRename={this.props.onItemRename}
|
||||||
onAddFolder={this.props.onAddFolder}
|
onAddFolder={this.props.onAddFolder}
|
||||||
onDirentClick={this.props.onDirentClick}
|
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
@@ -10,7 +10,7 @@ const propTypes = {
|
|||||||
onItemClick: PropTypes.func.isRequired,
|
onItemClick: PropTypes.func.isRequired,
|
||||||
showImagePopup: PropTypes.func.isRequired,
|
showImagePopup: PropTypes.func.isRequired,
|
||||||
onGridItemContextmenu: PropTypes.func.isRequired,
|
onGridItemContextmenu: PropTypes.func.isRequired,
|
||||||
onDirentClick: PropTypes.func.isRequired,
|
onGridItemClick: PropTypes.func.isRequired,
|
||||||
activeDirent: PropTypes.object,
|
activeDirent: PropTypes.object,
|
||||||
onGridItemMouseDown: PropTypes.func,
|
onGridItemMouseDown: PropTypes.func,
|
||||||
};
|
};
|
||||||
@@ -21,7 +21,7 @@ class DirentGridItem extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isGridSelected: false,
|
isGridSelected: false,
|
||||||
isGridDropTipshow: false,
|
isGridDropTipShow: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class DirentGridItem extends React.Component {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.setState({isGridSelected: true})
|
this.setState({isGridSelected: true})
|
||||||
this.props.onDirentClick(this.props.dirent)
|
this.props.onGridItemClick(this.props.dirent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ class DirentGridItem extends React.Component {
|
|||||||
|
|
||||||
onGridItemDragEnter = (e) => {
|
onGridItemDragEnter = (e) => {
|
||||||
if (this.props.dirent.type === 'dir') {
|
if (this.props.dirent.type === 'dir') {
|
||||||
this.setState({isGridDropTipshow: true});
|
this.setState({isGridDropTipShow: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,11 +85,11 @@ class DirentGridItem extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onGridItemDragLeave = (e) => {
|
onGridItemDragLeave = (e) => {
|
||||||
this.setState({isGridDropTipshow: false});
|
this.setState({isGridDropTipShow: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
onGridItemDragDrop = (e) => {
|
onGridItemDragDrop = (e) => {
|
||||||
this.setState({isGridDropTipshow: false});
|
this.setState({isGridDropTipShow: false});
|
||||||
if (e.dataTransfer.files.length) { // uploaded files
|
if (e.dataTransfer.files.length) { // uploaded files
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ class DirentGridItem extends React.Component {
|
|||||||
|
|
||||||
let gridClass = 'grid-file-img-link cursor-pointer'
|
let gridClass = 'grid-file-img-link cursor-pointer'
|
||||||
gridClass += this.state.isGridSelected ? " grid-selected-active" : " ";
|
gridClass += this.state.isGridSelected ? " grid-selected-active" : " ";
|
||||||
gridClass += this.state.isGridDropTipshow ? " grid-drop-show" : " ";
|
gridClass += this.state.isGridDropTipShow ? " grid-drop-show" : " ";
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@@ -40,7 +40,6 @@ const propTypes = {
|
|||||||
isDirentDetailShow: PropTypes.bool.isRequired,
|
isDirentDetailShow: PropTypes.bool.isRequired,
|
||||||
onGridItemClick: PropTypes.func,
|
onGridItemClick: PropTypes.func,
|
||||||
onAddFolder: PropTypes.func.isRequired,
|
onAddFolder: PropTypes.func.isRequired,
|
||||||
onDirentClick: PropTypes.func.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DirentGridView extends React.Component{
|
class DirentGridView extends React.Component{
|
||||||
@@ -60,10 +59,9 @@ class DirentGridView extends React.Component{
|
|||||||
isCreateFileDialogShow: false,
|
isCreateFileDialogShow: false,
|
||||||
|
|
||||||
isMutipleOperation: false,
|
isMutipleOperation: false,
|
||||||
dirent: '',
|
contextMenuDirent: '',
|
||||||
isGridItemFreezed: false,
|
isGridItemFreezed: false,
|
||||||
activeDirent: null,
|
activeDirent: null,
|
||||||
|
|
||||||
}
|
}
|
||||||
this.isRepoOwner = props.currentRepoInfo.owner_email === username;
|
this.isRepoOwner = props.currentRepoInfo.owner_email === username;
|
||||||
}
|
}
|
||||||
@@ -74,10 +72,9 @@ class DirentGridView extends React.Component{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onDirentClick = (dirent) => {
|
onGridItemClick = (dirent) => {
|
||||||
this.setState({activeDirent: dirent});
|
this.setState({activeDirent: dirent});
|
||||||
this.props.onDirentClick(dirent);
|
this.props.onGridItemClick(dirent);
|
||||||
this.props.onGridItemClick(dirent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMoveToggle = () => {
|
onMoveToggle = () => {
|
||||||
@@ -267,7 +264,7 @@ class DirentGridView extends React.Component{
|
|||||||
this.setState({
|
this.setState({
|
||||||
isRenameDialogShow: !this.state.isRenameDialogShow,
|
isRenameDialogShow: !this.state.isRenameDialogShow,
|
||||||
});
|
});
|
||||||
this.props.onItemRename(this.state.dirent, newName)
|
this.props.onItemRename(this.state.contextMenuDirent, newName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -356,7 +353,7 @@ class DirentGridView extends React.Component{
|
|||||||
if (!this.props.isDirentDetailShow) {
|
if (!this.props.isDirentDetailShow) {
|
||||||
this.props.onGridItemClick(null);
|
this.props.onGridItemClick(null);
|
||||||
}
|
}
|
||||||
this.onDirentClick(null);
|
this.onGridItemClick(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
onGridContainContextMenu = (event) => {
|
onGridContainContextMenu = (event) => {
|
||||||
@@ -387,7 +384,7 @@ class DirentGridView extends React.Component{
|
|||||||
|
|
||||||
hideMenu();
|
hideMenu();
|
||||||
|
|
||||||
this.setState({dirent: currentObject});
|
this.setState({contextMenuDirent: currentObject});
|
||||||
|
|
||||||
let showMenuConfig = {
|
let showMenuConfig = {
|
||||||
id: id,
|
id: id,
|
||||||
@@ -479,7 +476,7 @@ class DirentGridView extends React.Component{
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
let {direntList, path} = this.props;
|
let {direntList, path} = this.props;
|
||||||
let dirent = this.state.dirent ? this.state.dirent : '';
|
let dirent = this.state.contextMenuDirent ? this.state.contextMenuDirent : '';
|
||||||
let direntPath = Utils.joinPath(path, dirent.name);
|
let direntPath = Utils.joinPath(path, dirent.name);
|
||||||
|
|
||||||
if (this.props.isDirentListLoading) {
|
if (this.props.isDirentListLoading) {
|
||||||
@@ -503,7 +500,7 @@ class DirentGridView extends React.Component{
|
|||||||
onGridItemContextmenu={this.onGridItemContextmenu}
|
onGridItemContextmenu={this.onGridItemContextmenu}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
onGridItemMouseDown={this.onGridItemMouseDown}
|
onGridItemMouseDown={this.onGridItemMouseDown}
|
||||||
onDirentClick={this.onDirentClick}
|
onGridItemClick={this.onGridItemClick}
|
||||||
activeDirent={this.state.activeDirent}
|
activeDirent={this.state.activeDirent}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -546,7 +543,7 @@ class DirentGridView extends React.Component{
|
|||||||
isMutipleOperation={this.state.isMutipleOperation}
|
isMutipleOperation={this.state.isMutipleOperation}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
onCancelMove={this.onMoveToggle}
|
onCancelMove={this.onMoveToggle}
|
||||||
dirent={this.state.dirent}
|
dirent={this.state.contextMenuDirent}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{this.state.isZipDialogOpen &&
|
{this.state.isZipDialogOpen &&
|
||||||
@@ -567,7 +564,7 @@ class DirentGridView extends React.Component{
|
|||||||
isMutipleOperation={this.state.isMutipleOperation}
|
isMutipleOperation={this.state.isMutipleOperation}
|
||||||
onItemCopy={this.props.onItemCopy}
|
onItemCopy={this.props.onItemCopy}
|
||||||
onCancelCopy={this.onCopyToggle}
|
onCancelCopy={this.onCopyToggle}
|
||||||
dirent={this.state.dirent}
|
dirent={this.state.contextMenuDirent}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{this.state.isShareDialogShow &&
|
{this.state.isShareDialogShow &&
|
||||||
@@ -588,7 +585,7 @@ class DirentGridView extends React.Component{
|
|||||||
{this.state.isRenameDialogShow && (
|
{this.state.isRenameDialogShow && (
|
||||||
<ModalPortal>
|
<ModalPortal>
|
||||||
<Rename
|
<Rename
|
||||||
dirent={this.state.dirent}
|
dirent={this.state.contextMenuDirent}
|
||||||
onRename={this.onItemRename}
|
onRename={this.onItemRename}
|
||||||
checkDuplicatedName={this.checkDuplicatedName}
|
checkDuplicatedName={this.checkDuplicatedName}
|
||||||
toggleCancel={this.onItemRenameToggle}
|
toggleCancel={this.onItemRenameToggle}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
.grid-view {
|
.grid-view {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10rem;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
@@ -116,6 +116,7 @@ class LibContentContainer extends React.Component {
|
|||||||
|
|
||||||
onGridItemClick = (dirent) => {
|
onGridItemClick = (dirent) => {
|
||||||
this.setState({currentDirent: dirent});
|
this.setState({currentDirent: dirent});
|
||||||
|
this.props.onDirentClick(dirent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// on '<tr>'
|
// on '<tr>'
|
||||||
@@ -233,7 +234,6 @@ class LibContentContainer extends React.Component {
|
|||||||
onGridItemClick={this.onGridItemClick}
|
onGridItemClick={this.onGridItemClick}
|
||||||
isDirentDetailShow={this.props.isDirentDetailShow}
|
isDirentDetailShow={this.props.isDirentDetailShow}
|
||||||
onItemRename={this.props.onItemRename}
|
onItemRename={this.props.onItemRename}
|
||||||
onDirentClick={this.onDirentClick}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{this.props.currentMode === 'column' && (
|
{this.props.currentMode === 'column' && (
|
||||||
|
Reference in New Issue
Block a user