mirror of https://github.com/hashicorp/consul
ui: Install ref modifier and use it instead of dom selecting (#7383)
parent
bda515abe9
commit
2ad0f652e7
|
@ -6,11 +6,6 @@ export default Component.extend({
|
||||||
dom: service('dom'),
|
dom: service('dom'),
|
||||||
classNames: ['phrase-editor'],
|
classNames: ['phrase-editor'],
|
||||||
item: '',
|
item: '',
|
||||||
didInsertElement: function() {
|
|
||||||
this._super(...arguments);
|
|
||||||
// TODO: use {{ref}}
|
|
||||||
this.input = this.dom.element('input', this.element);
|
|
||||||
},
|
|
||||||
onchange: function(e) {},
|
onchange: function(e) {},
|
||||||
search: function(e) {
|
search: function(e) {
|
||||||
// TODO: Temporarily continue supporting `searchable`
|
// TODO: Temporarily continue supporting `searchable`
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { set } from '@ember/object';
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
dom: service('dom'),
|
dom: service('dom'),
|
||||||
|
@ -19,12 +18,6 @@ export default Component.extend({
|
||||||
this.guid = this.dom.guid(this);
|
this.guid = this.dom.guid(this);
|
||||||
this._listeners = this.dom.listeners();
|
this._listeners = this.dom.listeners();
|
||||||
},
|
},
|
||||||
didInsertElement: function() {
|
|
||||||
this._super(...arguments);
|
|
||||||
// TODO(octane): move to ref
|
|
||||||
set(this, 'input', this.dom.element(`#toggle-button-${this.guid}`));
|
|
||||||
set(this, 'label', this.input.nextElementSibling);
|
|
||||||
},
|
|
||||||
willDestroyElement: function() {
|
willDestroyElement: function() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this._listeners.remove();
|
this._listeners.remove();
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
</ul>
|
</ul>
|
||||||
<label class="type-search">
|
<label class="type-search">
|
||||||
<span>Search</span>
|
<span>Search</span>
|
||||||
<input onchange={{action 'add'}} onsearch={{action 'add'}} oninput={{action 'input'}} onkeydown={{action 'keydown'}} placeholder={{if (eq value.length 0) placeholder}} value={{item}} type="search" name="s" autofocus="autofocus" />
|
<input {{ref this "input"}} onchange={{action 'add'}} onsearch={{action 'add'}} oninput={{action 'input'}} onkeydown={{action 'keydown'}} placeholder={{if (eq value.length 0) placeholder}} value={{item}} type="search" name="s" autofocus="autofocus" />
|
||||||
</label>
|
</label>
|
|
@ -1,4 +1,4 @@
|
||||||
<input type="checkbox" checked={{if checked 'checked' undefined}} id={{concat 'toggle-button-' guid}} onchange={{action 'change'}} />
|
<input {{ref this "input"}} type="checkbox" checked={{if checked 'checked' undefined}} id={{concat 'toggle-button-' guid}} onchange={{action 'change'}} />
|
||||||
<label for={{concat 'toggle-button-' guid}}>
|
<label {{ref this "label"}} for={{concat 'toggle-button-' guid}}>
|
||||||
{{yield (action 'click')}}
|
{{yield (action 'click')}}
|
||||||
</label>
|
</label>
|
|
@ -100,6 +100,7 @@
|
||||||
"ember-power-select": "^3.0.6",
|
"ember-power-select": "^3.0.6",
|
||||||
"ember-power-select-with-create": "^0.7.0",
|
"ember-power-select-with-create": "^0.7.0",
|
||||||
"ember-qunit": "^4.6.0",
|
"ember-qunit": "^4.6.0",
|
||||||
|
"ember-ref-modifier": "^1.0.0",
|
||||||
"ember-resolver": "^7.0.0",
|
"ember-resolver": "^7.0.0",
|
||||||
"ember-sinon-qunit": "4.0.1",
|
"ember-sinon-qunit": "4.0.1",
|
||||||
"ember-source": "~3.16.0",
|
"ember-source": "~3.16.0",
|
||||||
|
|
|
@ -5780,6 +5780,13 @@ ember-qunit@^4.6.0:
|
||||||
ember-cli-test-loader "^2.2.0"
|
ember-cli-test-loader "^2.2.0"
|
||||||
qunit "^2.9.3"
|
qunit "^2.9.3"
|
||||||
|
|
||||||
|
ember-ref-modifier@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ember-ref-modifier/-/ember-ref-modifier-1.0.0.tgz#3e98d8c26eda7cf4da4b2d82d6a0c80c5058efed"
|
||||||
|
integrity sha512-JPCwlKerzZCbc5GO01xcgRJv5JcK1O61FF5PE6UxMNRwgDxT33mjTPO2JFhn4HGoG0NvpnkpLLxw+qf1KuX8kw==
|
||||||
|
dependencies:
|
||||||
|
ember-cli-babel "^7.13.2"
|
||||||
|
|
||||||
ember-require-module@^0.3.0:
|
ember-require-module@^0.3.0:
|
||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/ember-require-module/-/ember-require-module-0.3.0.tgz#65aff7908b5b846467e4526594d33cfe0c23456b"
|
resolved "https://registry.yarnpkg.com/ember-require-module/-/ember-require-module-0.3.0.tgz#65aff7908b5b846467e4526594d33cfe0c23456b"
|
||||||
|
|
Loading…
Reference in New Issue