|
|
@ -18,10 +18,19 @@ class PathInput extends Component {
|
|
|
|
this._node = document.getElementById('portal-root');
|
|
|
|
this._node = document.getElementById('portal-root');
|
|
|
|
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
|
|
|
|
value: props.value,
|
|
|
|
isFileBrowserModalOpen: false
|
|
|
|
isFileBrowserModalOpen: false
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
|
|
|
const { value } = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (prevProps.value !== value) {
|
|
|
|
|
|
|
|
this.setState({ value });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Control
|
|
|
|
// Control
|
|
|
|
|
|
|
|
|
|
|
@ -51,11 +60,8 @@ class PathInput extends Component {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Listeners
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
|
|
|
|
onInputChange = (event, { newValue }) => {
|
|
|
|
onInputChange = ({ value }) => {
|
|
|
|
this.props.onChange({
|
|
|
|
this.setState({ value });
|
|
|
|
name: this.props.name,
|
|
|
|
|
|
|
|
value: newValue
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onInputKeyDown = (event) => {
|
|
|
|
onInputKeyDown = (event) => {
|
|
|
@ -77,6 +83,11 @@ class PathInput extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onInputBlur = () => {
|
|
|
|
onInputBlur = () => {
|
|
|
|
|
|
|
|
this.props.onChange({
|
|
|
|
|
|
|
|
name: this.props.name,
|
|
|
|
|
|
|
|
value: this.state.value
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.props.onClearPaths();
|
|
|
|
this.props.onClearPaths();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -108,13 +119,18 @@ class PathInput extends Component {
|
|
|
|
const {
|
|
|
|
const {
|
|
|
|
className,
|
|
|
|
className,
|
|
|
|
name,
|
|
|
|
name,
|
|
|
|
value,
|
|
|
|
|
|
|
|
paths,
|
|
|
|
paths,
|
|
|
|
includeFiles,
|
|
|
|
includeFiles,
|
|
|
|
hasFileBrowser,
|
|
|
|
hasFileBrowser,
|
|
|
|
onChange,
|
|
|
|
onChange,
|
|
|
|
...otherProps
|
|
|
|
...otherProps
|
|
|
|
} = this.props;
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
|
|
|
value,
|
|
|
|
|
|
|
|
isFileBrowserModalOpen
|
|
|
|
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className={className}>
|
|
|
|
<div className={className}>
|
|
|
|
<AutoSuggestInput
|
|
|
|
<AutoSuggestInput
|
|
|
@ -130,7 +146,7 @@ class PathInput extends Component {
|
|
|
|
onSuggestionSelected={this.onSuggestionSelected}
|
|
|
|
onSuggestionSelected={this.onSuggestionSelected}
|
|
|
|
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
|
|
|
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
|
|
|
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
|
|
|
|
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
|
|
|
|
onChange={onChange}
|
|
|
|
onChange={this.onInputChange}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -144,7 +160,7 @@ class PathInput extends Component {
|
|
|
|
</FormInputButton>
|
|
|
|
</FormInputButton>
|
|
|
|
|
|
|
|
|
|
|
|
<FileBrowserModal
|
|
|
|
<FileBrowserModal
|
|
|
|
isOpen={this.state.isFileBrowserModalOpen}
|
|
|
|
isOpen={isFileBrowserModalOpen}
|
|
|
|
name={name}
|
|
|
|
name={name}
|
|
|
|
value={value}
|
|
|
|
value={value}
|
|
|
|
includeFiles={includeFiles}
|
|
|
|
includeFiles={includeFiles}
|
|
|
|