Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Fix PR code review #474
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunkat committed Mar 21, 2017
1 parent e9e160d commit f026101
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/widget/RawWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ class RawWidget extends Component {

const {isEdited} = this.state;

// check if it's value from MasterWidget or not
// (to stabilize parsing changes in masterWidget due to problems with jumping cursor
const widgetValue = inputValue ? inputValue : widgetData[0].value;

// TODO: API SHOULD RETURN THE SAME PROPERTIES FOR FILTERS
const widgetField = filterWidget ?
fields[0].parameterName : fields[0].field;
Expand Down Expand Up @@ -322,7 +326,7 @@ class RawWidget extends Component {
type="text"
ref={c => this.rawWidget = c}
className="input-field js-input-field"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
placeholder={fields[0].emptyText}
disabled={widgetData[0].readonly || disabled}
onFocus={this.handleFocus}
Expand All @@ -342,7 +346,7 @@ class RawWidget extends Component {
<textarea
ref={c => this.rawWidget = c}
className="input-field js-input-field"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
disabled={widgetData[0].readonly || disabled}
placeholder={fields[0].emptyText}
onFocus={this.handleFocus}
Expand All @@ -364,7 +368,7 @@ class RawWidget extends Component {
className="input-field js-input-field"
min="0"
step="1"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
disabled={widgetData[0].readonly || disabled}
onFocus={this.handleFocus}
onChange={(e) => handleChange && handleChange(widgetField, e.target.value)}
Expand All @@ -383,7 +387,7 @@ class RawWidget extends Component {
ref={c => this.rawWidget = c}
type="number"
className="input-field js-input-field"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
disabled={widgetData[0].readonly || disabled}
onFocus={this.handleFocus}
onChange={(e) => handleChange && handleChange(fields[0].field, e.target.value)}
Expand All @@ -404,7 +408,7 @@ class RawWidget extends Component {
className="input-field js-input-field"
min="0"
step="1"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
disabled={widgetData[0].readonly || disabled}
onFocus={this.handleFocus}
onChange={(e) => handleChange && handleChange(widgetField, e.target.value)}
Expand All @@ -425,7 +429,7 @@ class RawWidget extends Component {
className="input-field js-input-field"
min="0"
step="1"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
disabled={widgetData[0].readonly || disabled}
onFocus={this.handleFocus}
onChange={(e) => handleChange && handleChange(widgetField, e.target.value)}
Expand All @@ -444,7 +448,7 @@ class RawWidget extends Component {
ref={c => this.rawWidget = c}
type="number"
className="input-field js-input-field"
value={inputValue ? inputValue : widgetData[0].value}
value={widgetValue}
disabled={widgetData[0].readonly || disabled}
onFocus={this.handleFocus}
onChange={(e) => handleChange && handleChange(widgetField, e.target.value)}
Expand Down

0 comments on commit f026101

Please sign in to comment.