projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
16086: Enhances readability by using plural on Array var's name.
[arvados-workbench2.git]
/
src
/
components
/
chips-input
/
chips-input.tsx
diff --git
a/src/components/chips-input/chips-input.tsx
b/src/components/chips-input/chips-input.tsx
index 13699660053824a8f205efc1f8a556ba43d8b106..790d49ebd6e306e202bb691d553bba8f57ccf2b1 100644
(file)
--- a/
src/components/chips-input/chips-input.tsx
+++ b/
src/components/chips-input/chips-input.tsx
@@
-9,7
+9,7
@@
import { StyleRulesCallback } from '@material-ui/core/styles';
import { InputProps } from '@material-ui/core/Input';
interface ChipsInputProps<Value> {
import { InputProps } from '@material-ui/core/Input';
interface ChipsInputProps<Value> {
- value: Value[];
+ value
s
: Value[];
getLabel?: (value: Value) => string;
onChange: (value: Value[]) => void;
createNewValue: (value: string) => Value;
getLabel?: (value: Value) => string;
onChange: (value: Value[]) => void;
createNewValue: (value: string) => Value;
@@
-64,13
+64,13
@@
export const ChipsInput = withStyles(styles)(
if (this.state.text) {
const newValue = this.props.createNewValue(this.state.text);
this.setState({ text: '' });
if (this.state.text) {
const newValue = this.props.createNewValue(this.state.text);
this.setState({ text: '' });
- this.props.onChange([...this.props.value, newValue]);
+ this.props.onChange([...this.props.value
s
, newValue]);
}
}
deleteLastValue = () => {
}
}
deleteLastValue = () => {
- if (this.state.text.length === 0 && this.props.value.length > 0) {
- this.props.onChange(this.props.value.slice(0, -1));
+ if (this.state.text.length === 0 && this.props.value
s
.length > 0) {
+ this.props.onChange(this.props.value
s
.slice(0, -1));
}
}
}
}
@@
-103,12
+103,11
@@
export const ChipsInput = withStyles(styles)(
}
renderChips() {
}
renderChips() {
- const { classes,
value,
...props } = this.props;
+ const { classes, ...props } = this.props;
return <div className={classes.chips}>
<Chips
{...props}
clickable={!props.disabled}
return <div className={classes.chips}>
<Chips
{...props}
clickable={!props.disabled}
- values={value}
filler={<div ref={this.filler} />}
/>
</div>;
filler={<div ref={this.filler} />}
/>
</div>;
@@
-132,7
+131,7
@@
export const ChipsInput = withStyles(styles)(
}
componentDidUpdate(prevProps: ChipsInputProps<Value>) {
}
componentDidUpdate(prevProps: ChipsInputProps<Value>) {
- if (prevProps.value
!== this.props.value
) {
+ if (prevProps.value
s !== this.props.values
) {
this.updateCursorPosition();
}
}
this.updateCursorPosition();
}
}