|
|
@ -73,19 +73,19 @@ class Step2 extends Component {
|
|
|
|
* Clears the tags text field.
|
|
|
|
* Clears the tags text field.
|
|
|
|
* Chip gets two parameters: Key and value.
|
|
|
|
* Chip gets two parameters: Key and value.
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
addTags(event) {
|
|
|
|
_addTags(event) {
|
|
|
|
let tags = this.state.tags;
|
|
|
|
let tags = this.state.tags;
|
|
|
|
if (event.charCode === 13) {
|
|
|
|
if (event.charCode === 13) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.preventDefault();
|
|
|
|
tags.push({key: Math.floor(Math.random() * 1000), value: event.target.value});
|
|
|
|
tags.push({key: Math.floor(Math.random() * 1000), value: event.target.value});
|
|
|
|
this.setState({tags, defValue: ""}, console.log(this.state.tags));
|
|
|
|
this.setState({tags, defValue: ""});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Set the value for tag.
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
handleTagChange(event) {
|
|
|
|
_handleTagChange(event) {
|
|
|
|
let defaultValue = this.state.defValue;
|
|
|
|
let defaultValue = this.state.defValue;
|
|
|
|
defaultValue = event.target.value;
|
|
|
|
defaultValue = event.target.value;
|
|
|
|
this.setState({defValue: defaultValue})
|
|
|
|
this.setState({defValue: defaultValue})
|
|
|
@ -94,14 +94,14 @@ class Step2 extends Component {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Invokes the handleNext function in Create component.
|
|
|
|
* Invokes the handleNext function in Create component.
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
handleNext() {
|
|
|
|
_handleNext() {
|
|
|
|
this.props.handleNext();
|
|
|
|
this.props.handleNext();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Invokes the handlePrev function in Create component.
|
|
|
|
* Invokes the handlePrev function in Create component.
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
handlePrev() {
|
|
|
|
_handlePrev() {
|
|
|
|
this.props.handlePrev();
|
|
|
|
this.props.handlePrev();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -109,7 +109,7 @@ class Step2 extends Component {
|
|
|
|
* Handles Chip delete function.
|
|
|
|
* Handles Chip delete function.
|
|
|
|
* Removes the tag from state.tags
|
|
|
|
* Removes the tag from state.tags
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
handleRequestDelete = (key) => {
|
|
|
|
_handleRequestDelete = (key) => {
|
|
|
|
this.chipData = this.state.tags;
|
|
|
|
this.chipData = this.state.tags;
|
|
|
|
const chipToDelete = this.chipData.map((chip) => chip.key).indexOf(key);
|
|
|
|
const chipToDelete = this.chipData.map((chip) => chip.key).indexOf(key);
|
|
|
|
this.chipData.splice(chipToDelete, 1);
|
|
|
|
this.chipData.splice(chipToDelete, 1);
|
|
|
@ -119,12 +119,11 @@ class Step2 extends Component {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Creates Chip array from state.tags.
|
|
|
|
* Creates Chip array from state.tags.
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
renderChip(data) {
|
|
|
|
_renderChip(data) {
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Chip
|
|
|
|
<Chip
|
|
|
|
key={data.key}
|
|
|
|
key={data.key}
|
|
|
|
onRequestDelete={() => this.handleRequestDelete(data.key)}
|
|
|
|
onRequestDelete={() => this._handleRequestDelete(data.key)}
|
|
|
|
style={this.styles.chip}
|
|
|
|
style={this.styles.chip}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{data.value}
|
|
|
|
{data.value}
|
|
|
@ -172,11 +171,11 @@ class Step2 extends Component {
|
|
|
|
floatingLabelText="Tags*"
|
|
|
|
floatingLabelText="Tags*"
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
value={this.state.defValue}
|
|
|
|
value={this.state.defValue}
|
|
|
|
onChange={this.handleTagChange.bind(this)}
|
|
|
|
onChange={this._handleTagChange.bind(this)}
|
|
|
|
onKeyPress={this.addTags.bind(this)}
|
|
|
|
onKeyPress={this._addTags.bind(this)}
|
|
|
|
/><br/>
|
|
|
|
/><br/>
|
|
|
|
<div style={this.styles.wrapper}>
|
|
|
|
<div style={this.styles.wrapper}>
|
|
|
|
{this.state.tags.map(this.renderChip, this)}
|
|
|
|
{this.state.tags.map(this._renderChip, this)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
<SelectField
|
|
|
|
<SelectField
|
|
|
@ -216,13 +215,13 @@ class Step2 extends Component {
|
|
|
|
<FlatButton
|
|
|
|
<FlatButton
|
|
|
|
label="< Back"
|
|
|
|
label="< Back"
|
|
|
|
disabled={false}
|
|
|
|
disabled={false}
|
|
|
|
onClick={this.handlePrev.bind(this)}
|
|
|
|
onClick={this._handlePrev.bind(this)}
|
|
|
|
style={{marginRight: 12}}
|
|
|
|
style={{marginRight: 12}}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<RaisedButton
|
|
|
|
<RaisedButton
|
|
|
|
label="Next >"
|
|
|
|
label="Next >"
|
|
|
|
primary={true}
|
|
|
|
primary={true}
|
|
|
|
onClick={this.handleNext.bind(this)}
|
|
|
|
onClick={this._handleNext.bind(this)}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|