1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 02:48:51 +00:00

Merge branch '10.0'

This commit is contained in:
lian
2023-08-18 09:47:15 +08:00
10 changed files with 164 additions and 58 deletions

View File

@@ -59,21 +59,6 @@ class DirentListItem extends React.Component {
constructor(props) {
super(props);
this.state = {
isOperationShow: false,
highlight: false,
isZipDialogOpen: false,
isMoveDialogShow: false,
isCopyDialogShow: false,
isShareDialogShow: false,
isMutipleOperation: false,
isShowTagTooltip: false,
isDragTipShow: false,
isDropTipshow: false,
isEditFileTagShow: false,
isPermissionDialogOpen: false,
isOpMenuOpen: false // for mobile
};
const { dirent } = this.props;
const { isCustomPermission, customPermission } = Utils.getUserPermission(dirent.permission);
@@ -86,6 +71,23 @@ class DirentListItem extends React.Component {
this.canPreview = preview || modify;
this.canDrag = modify;
}
this.state = {
isOperationShow: false,
highlight: false,
isZipDialogOpen: false,
isMoveDialogShow: false,
isCopyDialogShow: false,
isShareDialogShow: false,
isMutipleOperation: false,
canDrag: this.canDrag,
isShowTagTooltip: false,
isDragTipShow: false,
isDropTipshow: false,
isEditFileTagShow: false,
isPermissionDialogOpen: false,
isOpMenuOpen: false // for mobile
};
}
componentWillReceiveProps(nextProps) {
@@ -115,7 +117,7 @@ class DirentListItem extends React.Component {
isOperationShow: true,
});
}
if (this.canDrag) {
if (this.state.canDrag) {
this.setState({isDragTipShow: true});
}
}
@@ -127,7 +129,7 @@ class DirentListItem extends React.Component {
isOperationShow: true,
});
}
if (this.canDrag) {
if (this.state.canDrag) {
this.setState({isDragTipShow: true});
}
}
@@ -314,6 +316,7 @@ class DirentListItem extends React.Component {
this.setState({
isOperationShow: false,
isRenameing: true,
canDrag: false
});
}
@@ -323,7 +326,10 @@ class DirentListItem extends React.Component {
}
onRenameCancel = () => {
this.setState({isRenameing: false});
this.setState({
isRenameing: false,
canDrag: this.canDrag // set it back to the initial value
});
this.unfreezeItem();
}
@@ -479,7 +485,7 @@ class DirentListItem extends React.Component {
}
onItemDragStart = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
e.dataTransfer.effectAllowed = 'move';
@@ -509,7 +515,7 @@ class DirentListItem extends React.Component {
}
onItemDragEnter = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
if (this.props.dirent.type === 'dir') {
@@ -519,7 +525,7 @@ class DirentListItem extends React.Component {
}
onItemDragOver = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
if (e.dataTransfer.dropEffect === 'copy') {
@@ -530,7 +536,7 @@ class DirentListItem extends React.Component {
}
onItemDragLeave = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
@@ -541,7 +547,7 @@ class DirentListItem extends React.Component {
}
onItemDragDrop = (e) => {
if (Utils.isIEBrower() || !this.canDrag) {
if (Utils.isIEBrower() || !this.state.canDrag) {
return false;
}
this.setState({isDropTipshow: false});
@@ -698,10 +704,11 @@ class DirentListItem extends React.Component {
let lockedInfo = gettext('locked by {name}').replace('{name}', dirent.lock_owner_name);
const isDesktop = Utils.isDesktop();
const { canDrag } = this.state;
const desktopItem = (
<tr
className={trClass}
draggable={this.canDrag}
draggable={canDrag}
onFocus={this.onMouseEnter}
onMouseEnter={this.onMouseEnter}
onMouseOver={this.onMouseOver}

View File

@@ -6,6 +6,7 @@ import '../../css/select-editor.css';
const propTypes = {
isTextMode: PropTypes.bool.isRequired, // there will be two mode. first: text and select. second: just select
isEditing: PropTypes.bool,
isEditIconShow: PropTypes.bool.isRequired,
options: PropTypes.array.isRequired,
currentOption: PropTypes.string.isRequired,
@@ -22,12 +23,13 @@ class SelectEditor extends React.Component {
static defaultProps = {
enableAddCustomPermission: false,
isEditing: false,
}
constructor(props) {
super(props);
this.state = {
isEditing: false,
isEditing: props.isEditing,
options: []
};
this.options = [];

View File

@@ -10,6 +10,7 @@ import { isPro } from '../../utils/constants';
const propTypes = {
repoID: PropTypes.string,
isTextMode: PropTypes.bool.isRequired,
isEditing: PropTypes.bool,
isEditIconShow: PropTypes.bool.isRequired,
permissions: PropTypes.array.isRequired,
currentPermission: PropTypes.string.isRequired,
@@ -20,6 +21,10 @@ const propTypes = {
class SharePermissionEditor extends React.Component {
static defaultProps = {
isEditing: false,
}
constructor(props) {
super(props);
this.state = {
@@ -84,7 +89,7 @@ class SharePermissionEditor extends React.Component {
}
return value;
}
translateExplanation = (explanation) => {
let value = Utils.sharePermsExplanation(explanation);
if (!value) {
@@ -120,6 +125,7 @@ class SharePermissionEditor extends React.Component {
return (
<SelectEditor
isTextMode={this.props.isTextMode}
isEditing={this.props.isEditing}
isEditIconShow={this.props.isEditIconShow}
options={this.getPermissions()}
currentOption={this.props.currentPermission}