mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
Update dependency 3 (#5344)
* update react react-dom prop-types * update seafile-editor version * install deep-copy denpendency * update router version * repair focus bug * optimize code * optimize code
This commit is contained in:
@@ -16,7 +16,6 @@ class CreateDepartmentRepoDialog extends React.Component {
|
||||
errMessage: '',
|
||||
isSubmitBtnActive: false,
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
handleChange = (e) => {
|
||||
@@ -50,10 +49,6 @@ class CreateDepartmentRepoDialog extends React.Component {
|
||||
this.props.onCreateToggle();
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
validateRepoName = () => {
|
||||
let errMessage = '';
|
||||
let repoName = this.state.repoName.trim();
|
||||
@@ -78,7 +73,7 @@ class CreateDepartmentRepoDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Department Library')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -87,10 +82,10 @@ class CreateDepartmentRepoDialog extends React.Component {
|
||||
<Input
|
||||
id="repo-name"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
value={this.state.repoName}
|
||||
onChange={this.handleChange}
|
||||
maxLength={maxFileName}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -32,8 +32,6 @@ class CreateFile extends React.Component {
|
||||
} else {
|
||||
this.setState({parentPath: parentPath + '/'}); // sidePanel
|
||||
}
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0,0);
|
||||
}
|
||||
|
||||
handleChange = (e) => {
|
||||
@@ -132,9 +130,15 @@ class CreateFile extends React.Component {
|
||||
return isDuplicated;
|
||||
}
|
||||
|
||||
onAfterModelOpened = () => {
|
||||
if (!this.newInput.current) return;
|
||||
this.newInput.current.focus();
|
||||
this.newInput.current.setSelectionRange(0,0);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} onOpened={this.onAfterModelOpened}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New File')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -143,7 +147,7 @@ class CreateFile extends React.Component {
|
||||
<Input
|
||||
id="fileName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
innerRef={this.newInput}
|
||||
value={this.state.childName}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
|
@@ -21,7 +21,6 @@ class CreateForder extends React.Component {
|
||||
errMessage: '',
|
||||
isSubmitBtnActive: false,
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -31,8 +30,6 @@ class CreateForder extends React.Component {
|
||||
} else {
|
||||
this.setState({parentPath: parentPath + '/'}); // sidePanel
|
||||
}
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0,0);
|
||||
}
|
||||
|
||||
handleChange = (e) => {
|
||||
@@ -81,7 +78,7 @@ class CreateForder extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Folder')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -90,9 +87,9 @@ class CreateForder extends React.Component {
|
||||
<Input
|
||||
id="folderName"
|
||||
value={this.state.childName}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
onKeyPress={this.handleKeyPress}
|
||||
onChange={this.handleChange}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -14,12 +14,6 @@ class CreateGroupDialog extends React.Component {
|
||||
errorMsg: '',
|
||||
isSubmitBtnActive: false,
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
handleGroupChange = (event) => {
|
||||
@@ -69,17 +63,17 @@ class CreateGroupDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return(
|
||||
<Modal isOpen={this.props.showAddGroupModal} toggle={this.props.toggleAddGroupModal}>
|
||||
<Modal isOpen={this.props.showAddGroupModal} toggle={this.props.toggleAddGroupModal} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggleAddGroupModal}>{gettext('New Group')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<label htmlFor="groupName">{gettext('Name')}</label>
|
||||
<Input
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
type="text"
|
||||
id="groupName"
|
||||
value={this.state.groupName}
|
||||
onChange={this.handleGroupChange}
|
||||
onKeyDown={this.handleKeyDown}
|
||||
autoFocus={true}
|
||||
/>
|
||||
<span className="error">{this.state.errorMsg}</span>
|
||||
</ModalBody>
|
||||
|
@@ -25,7 +25,6 @@ class CreateRepoDialog extends React.Component {
|
||||
library_template: libraryTemplates.length ? libraryTemplates[0] : '',
|
||||
isSubmitBtnActive: false,
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
handleRepoNameChange = (e) => {
|
||||
@@ -69,10 +68,6 @@ class CreateRepoDialog extends React.Component {
|
||||
this.props.onCreateToggle();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
validateInputParams() {
|
||||
let errMessage = '';
|
||||
let repoName = this.state.repoName.trim();
|
||||
@@ -177,7 +172,7 @@ class CreateRepoDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Library')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -186,9 +181,9 @@ class CreateRepoDialog extends React.Component {
|
||||
<Input
|
||||
id="repoName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
value={this.state.repoName}
|
||||
onChange={this.handleRepoNameChange}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
|
@@ -22,7 +22,6 @@ class CreateTagDialog extends React.Component {
|
||||
errorMsg: '',
|
||||
colorList: ['#FBD44A', '#EAA775', '#F4667C', '#DC82D2', '#9860E5', '#9F8CF1', '#59CB74', '#ADDF84', '#89D2EA', '#4ECCCB', '#46A1FD', '#C2C2C2'],
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
inputNewName = (e) => {
|
||||
@@ -70,8 +69,6 @@ class CreateTagDialog extends React.Component {
|
||||
this.setState({
|
||||
tagColor: this.state.colorList[0]
|
||||
});
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -87,7 +84,7 @@ class CreateTagDialog extends React.Component {
|
||||
<div role="form" className="tag-create">
|
||||
<div className="form-group">
|
||||
<label className="form-label">{gettext('Name')}</label>
|
||||
<Input onKeyPress={this.handleKeyPress} innerRef={input => {this.newInput = input;}} value={this.state.tagName} onChange={this.inputNewName}/>
|
||||
<Input onKeyPress={this.handleKeyPress} autoFocus={true} value={this.state.tagName} onChange={this.inputNewName}/>
|
||||
<div className="mt-2"><span className="error">{this.state.errorMsg}</span></div>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
|
@@ -211,7 +211,7 @@ class EditFileTagDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggleCancel}>
|
||||
<Modal isOpen={true} toggle={this.props.toggleCancel} autoFocus={false}>
|
||||
{this.state.isListRepoTagShow &&
|
||||
<TagList
|
||||
repoID={this.props.repoID}
|
||||
|
@@ -11,10 +11,10 @@ const propTypes = {
|
||||
class ImportMembersDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.fileInputRef = React.createRef();
|
||||
this.state = {
|
||||
errorMsg: ''
|
||||
};
|
||||
this.fileInputRef = React.createRef();
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
|
@@ -18,12 +18,6 @@ class NewWikiDialog extends React.Component {
|
||||
repoID: '',
|
||||
isSubmitBtnActive: false,
|
||||
};
|
||||
this.newName = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newName.focus();
|
||||
this.newName.setSelectionRange(0, -1);
|
||||
}
|
||||
|
||||
inputNewName = (e) => {
|
||||
@@ -56,11 +50,11 @@ class NewWikiDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true}>
|
||||
<Modal isOpen={true} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Wiki')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<label className="form-label">{gettext('Name')}</label>
|
||||
<Input onKeyPress={this.handleKeyPress} innerRef={input => {this.newName = input;}} value={this.state.name} onChange={this.inputNewName}/>
|
||||
<Input onKeyPress={this.handleKeyPress} autoFocus={true} value={this.state.name} onChange={this.inputNewName}/>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button color="secondary" onClick={this.toggle}>{gettext('Cancel')}</Button>
|
||||
|
@@ -19,12 +19,6 @@ class AddDepartDialog extends React.Component {
|
||||
departName: '',
|
||||
errMessage: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
@@ -71,7 +65,7 @@ class AddDepartDialog extends React.Component {
|
||||
render() {
|
||||
let header = this.props.parentGroupID ? gettext('New Sub-department') : gettext('New Department');
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{header}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -82,7 +76,7 @@ class AddDepartDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.departName}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -19,12 +19,6 @@ class AddRepoDialog extends React.Component {
|
||||
repoName: '',
|
||||
errMessage: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
@@ -66,7 +60,7 @@ class AddRepoDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{gettext('New Library')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -77,7 +71,7 @@ class AddRepoDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.repoName}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -11,10 +11,10 @@ const propTypes = {
|
||||
class ImportOrgUsersDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.fileInputRef = React.createRef();
|
||||
this.state = {
|
||||
errorMsg: ''
|
||||
};
|
||||
this.fileInputRef = React.createRef();
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
|
@@ -31,11 +31,6 @@ class RenameDepartmentDialog extends React.Component {
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.select();
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
let isValid = this.validateName();
|
||||
const { orgID, groupID } = this.props;
|
||||
@@ -75,10 +70,16 @@ class RenameDepartmentDialog extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
onAfterModelOpened = () => {
|
||||
if (!this.newInput.current) return;
|
||||
this.newInput.current.focus();
|
||||
this.newInput.current.select();
|
||||
}
|
||||
|
||||
render() {
|
||||
let header = gettext('Rename Department');
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} onOpened={this.onAfterModelOpened}>
|
||||
<ModalHeader toggle={this.props.toggle}>{header}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -89,7 +90,7 @@ class RenameDepartmentDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.departmentName}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
innerRef={this.newInput}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -20,12 +20,6 @@ class SetGroupQuotaDialog extends React.Component {
|
||||
quota: '',
|
||||
errMessage: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
setGroupQuota = () => {
|
||||
@@ -61,7 +55,7 @@ class SetGroupQuotaDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{gettext('Set Quota')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<InputGroup>
|
||||
@@ -69,7 +63,7 @@ class SetGroupQuotaDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.quota}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
<InputGroupAddon addonType="append">{'MB'}</InputGroupAddon>
|
||||
</InputGroup>
|
||||
|
@@ -12,6 +12,7 @@ const propTypes = {
|
||||
};
|
||||
|
||||
class Rename extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
@@ -27,16 +28,8 @@ class Rename extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
let currentNode = this.props.currentNode;
|
||||
const { currentNode } = this.props;
|
||||
this.changeState(currentNode);
|
||||
this.newInput.focus();
|
||||
let type = currentNode.object.type;
|
||||
if (type === 'file') {
|
||||
var endIndex = currentNode.object.name.lastIndexOf('.md');
|
||||
this.newInput.setSelectionRange(0, endIndex, 'forward');
|
||||
} else {
|
||||
this.newInput.setSelectionRange(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -108,14 +101,27 @@ class Rename extends React.Component {
|
||||
return isDuplicated;
|
||||
}
|
||||
|
||||
onAfterModelOpened = () => {
|
||||
if (!this.newInput.current) return;
|
||||
const { currentNode } = this.props;
|
||||
let type = currentNode.object.type;
|
||||
this.newInput.current.focus();
|
||||
if (type === 'file') {
|
||||
var endIndex = currentNode.object.name.lastIndexOf('.md');
|
||||
this.newInput.current.setSelectionRange(0, endIndex, 'forward');
|
||||
} else {
|
||||
this.newInput.current.setSelectionRange(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let type = this.props.currentNode.object.type;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} onOpened={this.onAfterModelOpened}>
|
||||
<ModalHeader toggle={this.toggle}>{type === 'file' ? gettext('Rename File') : gettext('Rename Folder') }</ModalHeader>
|
||||
<ModalBody>
|
||||
<p>{type === 'file' ? gettext('New file name'): gettext('New folder name')}</p>
|
||||
<Input onKeyPress={this.handleKeyPress} innerRef={input => {this.newInput = input;}} placeholder="newName" value={this.state.newName} onChange={this.handleChange} />
|
||||
<Input onKeyPress={this.handleKeyPress} innerRef={this.newInput} placeholder="newName" value={this.state.newName} onChange={this.handleChange} />
|
||||
{this.state.errMessage && <Alert color="danger" className="mt-2">{this.state.errMessage}</Alert>}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
|
@@ -28,16 +28,8 @@ class Rename extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
let {dirent} = this.props;
|
||||
let { dirent } = this.props;
|
||||
this.changeState(dirent);
|
||||
this.newInput.focus();
|
||||
let type = dirent.type;
|
||||
if (type === 'file') {
|
||||
var endIndex = dirent.name.lastIndexOf('.md');
|
||||
this.newInput.setSelectionRange(0, endIndex, 'forward');
|
||||
} else {
|
||||
this.newInput.setSelectionRange(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -110,14 +102,28 @@ class Rename extends React.Component {
|
||||
return isDuplicated;
|
||||
}
|
||||
|
||||
onAfterModelOpened = () => {
|
||||
if (!this.newInput.current) return;
|
||||
this.newInput.current.focus();
|
||||
|
||||
let { dirent } = this.props;
|
||||
let type = dirent.type;
|
||||
if (type === 'file') {
|
||||
var endIndex = dirent.name.lastIndexOf('.md');
|
||||
this.newInput.current.setSelectionRange(0, endIndex, 'forward');
|
||||
} else {
|
||||
this.newInput.current.setSelectionRange(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let type = this.props.dirent.type;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} onOpened={this.onAfterModelOpened}>
|
||||
<ModalHeader toggle={this.toggle}>{type === 'file' ? gettext('Rename File') : gettext('Rename Folder') }</ModalHeader>
|
||||
<ModalBody>
|
||||
<p>{type === 'file' ? gettext('New file name'): gettext('New folder name')}</p>
|
||||
<Input onKeyPress={this.handleKeyPress} innerRef={input => {this.newInput = input;}} value={this.state.newName} onChange={this.handleChange} />
|
||||
<Input onKeyPress={this.handleKeyPress} innerRef={this.newInput} value={this.state.newName} onChange={this.handleChange} />
|
||||
{this.state.errMessage && <Alert color="danger" className="mt-2">{this.state.errMessage}</Alert>}
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
|
@@ -23,11 +23,6 @@ class SearchFileDialog extends React.Component {
|
||||
errMessage: '',
|
||||
fileList: null
|
||||
};
|
||||
this.inputRef = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.inputRef.current.focus();
|
||||
}
|
||||
|
||||
searchFile = () => {
|
||||
@@ -78,11 +73,11 @@ class SearchFileDialog extends React.Component {
|
||||
render() {
|
||||
const { q, errMessage, fileList, isSubmitDisabled, isSubmitting } = this.state;
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('Search')}</ModalHeader>
|
||||
<ModalBody style={{height: '250px'}} className="o-auto">
|
||||
<div className="d-flex">
|
||||
<input className="form-control mr-2" type="text" placeholder={gettext('Search files in this library')} value={q} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} ref={this.inputRef} />
|
||||
<input className="form-control mr-2" type="text" placeholder={gettext('Search files in this library')} value={q} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} autoFocus={true} />
|
||||
<button type="submit" className={`btn btn-primary flex-shrink-0 ${isSubmitting ? 'btn-loading' : ''}`} onClick={this.searchFile} disabled={isSubmitDisabled}>{gettext('Search')}</button>
|
||||
</div>
|
||||
{errMessage && <Alert color="danger" className="mt-2">{errMessage}</Alert>}
|
||||
|
@@ -19,12 +19,6 @@ class AddDepartDialog extends React.Component {
|
||||
departName: '',
|
||||
errMessage: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
@@ -71,7 +65,7 @@ class AddDepartDialog extends React.Component {
|
||||
render() {
|
||||
let header = this.props.parentGroupID ? gettext('New Sub-department') : gettext('New Department');
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{header}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -82,7 +76,7 @@ class AddDepartDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.departName}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -19,12 +19,6 @@ class AddRepoDialog extends React.Component {
|
||||
repoName: '',
|
||||
errMessage: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
@@ -66,7 +60,7 @@ class AddRepoDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{gettext('New Library')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -77,7 +71,7 @@ class AddRepoDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.repoName}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -20,7 +20,6 @@ class SysAdminCreateGroupDialog extends React.Component {
|
||||
errMessage: '',
|
||||
isSubmitBtnActive: false
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
handleRepoNameChange = (e) => {
|
||||
@@ -56,13 +55,9 @@ class SysAdminCreateGroupDialog extends React.Component {
|
||||
this.props.toggleDialog();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Group')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -71,9 +66,9 @@ class SysAdminCreateGroupDialog extends React.Component {
|
||||
<Input
|
||||
id="groupName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
value={this.state.groupName}
|
||||
onChange={this.handleRepoNameChange}
|
||||
autoFocus={true}
|
||||
/>
|
||||
<Label className="mt-2">
|
||||
{gettext('Owner')}
|
||||
|
@@ -19,7 +19,6 @@ class SysAdminCreateRepoDialog extends React.Component {
|
||||
errMessage: '',
|
||||
isSubmitBtnActive: false
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
handleRepoNameChange = (e) => {
|
||||
@@ -54,13 +53,9 @@ class SysAdminCreateRepoDialog extends React.Component {
|
||||
this.props.toggleDialog();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.toggle}>
|
||||
<Modal isOpen={true} toggle={this.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.toggle}>{gettext('New Library')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -69,9 +64,9 @@ class SysAdminCreateRepoDialog extends React.Component {
|
||||
<Input
|
||||
id="repoName"
|
||||
onKeyPress={this.handleKeyPress}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
value={this.state.repoName}
|
||||
onChange={this.handleRepoNameChange}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
|
@@ -12,10 +12,10 @@ const propTypes = {
|
||||
class SysAdminImportUserDialog extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.fileInputRef = React.createRef();
|
||||
this.state = {
|
||||
errorMsg: ''
|
||||
};
|
||||
this.fileInputRef = React.createRef();
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
|
@@ -14,11 +14,6 @@ class LogsExportExcelDialog extends React.Component {
|
||||
endDateStr: '',
|
||||
errMsg: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
downloadExcel = () => {
|
||||
@@ -79,7 +74,7 @@ class LogsExportExcelDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{gettext('Choose date')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<FormGroup>
|
||||
@@ -88,7 +83,7 @@ class LogsExportExcelDialog extends React.Component {
|
||||
value={this.state.startDateStr}
|
||||
onChange={this.handleStartChange}
|
||||
placeholder='yyyy-mm-dd'
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
|
@@ -27,11 +27,6 @@ class RenameDepartmentDialog extends React.Component {
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.select();
|
||||
this.newInput.focus();
|
||||
}
|
||||
|
||||
handleSubmit = () => {
|
||||
let isValid = this.validateName();
|
||||
if (isValid) {
|
||||
@@ -70,10 +65,16 @@ class RenameDepartmentDialog extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
onAfterModelOpened = () => {
|
||||
if (!this.newInput.current) return;
|
||||
this.newInput.current.focus();
|
||||
this.newInput.current.select();
|
||||
}
|
||||
|
||||
render() {
|
||||
let header = gettext('Rename Department');
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} onOpened={this.onAfterModelOpened}>
|
||||
<ModalHeader toggle={this.props.toggle}>{header}</ModalHeader>
|
||||
<ModalBody>
|
||||
<Form>
|
||||
@@ -84,7 +85,7 @@ class RenameDepartmentDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.departmentName}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
innerRef={this.newInput}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Form>
|
||||
|
@@ -20,12 +20,6 @@ class SetGroupQuotaDialog extends React.Component {
|
||||
quota: '',
|
||||
errMessage: '',
|
||||
};
|
||||
this.newInput = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.newInput.focus();
|
||||
this.newInput.setSelectionRange(0, 0);
|
||||
}
|
||||
|
||||
setGroupQuota = () => {
|
||||
@@ -61,7 +55,7 @@ class SetGroupQuotaDialog extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Modal isOpen={true} toggle={this.props.toggle}>
|
||||
<Modal isOpen={true} toggle={this.props.toggle} autoFocus={false}>
|
||||
<ModalHeader toggle={this.props.toggle}>{gettext('Set Quota')}</ModalHeader>
|
||||
<ModalBody>
|
||||
<InputGroup>
|
||||
@@ -69,7 +63,7 @@ class SetGroupQuotaDialog extends React.Component {
|
||||
onKeyPress={this.handleKeyPress}
|
||||
value={this.state.quota}
|
||||
onChange={this.handleChange}
|
||||
innerRef={input => {this.newInput = input;}}
|
||||
autoFocus={true}
|
||||
/>
|
||||
<InputGroupAddon addonType="append">{'MB'}</InputGroupAddon>
|
||||
</InputGroup>
|
||||
|
Reference in New Issue
Block a user