* Renders field. * @protected * @return {?HTMLElement}
()
| 79 | * @return {?HTMLElement} |
| 80 | */ |
| 81 | renderField () { |
| 82 | this._$input = View.createElement('input', { |
| 83 | className: 'field-number__input', |
| 84 | id: this.getId(), |
| 85 | type: 'number', |
| 86 | onInput: this.inputValueDidChange.bind(this), |
| 87 | onFocus: evt => this.focus(), |
| 88 | onBlur: evt => this.blur() |
| 89 | }) |
| 90 | |
| 91 | this._$displayValue = View.createElement('span', { |
| 92 | className: 'field-number__display-value' |
| 93 | }) |
| 94 | |
| 95 | this._$displayDescription = View.createElement('span', { |
| 96 | className: 'field-number__display-description' |
| 97 | }) |
| 98 | |
| 99 | this._$display = View.createElement('div', { |
| 100 | className: 'field-number__display' |
| 101 | }, [this._$displayValue, this._$displayDescription]) |
| 102 | |
| 103 | const $stepDown = View.createElement('button', { |
| 104 | className: 'field-number__btn-step-down', |
| 105 | onClick: this.stepDownButtonDidClick.bind(this) |
| 106 | }, 'Step Down') |
| 107 | |
| 108 | const $value = View.createElement('div', { |
| 109 | className: 'field-number__value' |
| 110 | }, [this._$input, this._$display]) |
| 111 | |
| 112 | const $stepUp = View.createElement('button', { |
| 113 | className: 'field-number__btn-step-up', |
| 114 | onClick: this.stepUpButtonDidClick.bind(this) |
| 115 | }, 'Step Up') |
| 116 | |
| 117 | const $field = super.renderField() |
| 118 | $field.classList.remove('field__field') |
| 119 | $field.classList.add('field-number__field') |
| 120 | $field.appendChild($stepDown) |
| 121 | $field.appendChild($value) |
| 122 | $field.appendChild($stepUp) |
| 123 | return $field |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Triggered when input value has been changed. |
nothing calls this directly
no test coverage detected