From 6aed24a02cf43add96f8d1c27371dc2f98ffa163 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 27 Sep 2017 12:27:18 +0200 Subject: [PATCH 1/2] textfield: clear icon dinamic display --- client/core/src/drop-down/drop-down.js | 7 +++++-- client/core/src/textfield/textfield.html | 11 +++++++++-- client/core/src/textfield/textfield.js | 9 ++++++--- client/salix/src/styles/misc.scss | 3 +++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/client/core/src/drop-down/drop-down.js b/client/core/src/drop-down/drop-down.js index dd72ed4b73..4651370702 100644 --- a/client/core/src/drop-down/drop-down.js +++ b/client/core/src/drop-down/drop-down.js @@ -11,6 +11,7 @@ export default class DropDown { this._search = null; this.itemsFiltered = []; this._activeOption = -1; + this._focusingFilter = false; } get show() { return this._show; @@ -18,11 +19,13 @@ export default class DropDown { set show(value) { let oldValue = this.show; this._show = value; - if (value && oldValue !== value && this.filter) { + if (value && !this._focusingFilter && oldValue !== value && this.filter) { let inputFilterSearch = this.$element[0].querySelector('input'); + this._focusingFilter = true; this.$timeout(() => { inputFilterSearch.focus(); - }); + this._focusingFilter = false; + }, 250); } } get search() { diff --git a/client/core/src/textfield/textfield.html b/client/core/src/textfield/textfield.html index 3872ee8948..b62b18f7e5 100644 --- a/client/core/src/textfield/textfield.html +++ b/client/core/src/textfield/textfield.html @@ -1,4 +1,11 @@ -
+
- clear + clear info_outline
diff --git a/client/core/src/textfield/textfield.js b/client/core/src/textfield/textfield.js index 9272952c87..c7f61736f4 100644 --- a/client/core/src/textfield/textfield.js +++ b/client/core/src/textfield/textfield.js @@ -4,7 +4,7 @@ import * as normalizerFactory from '../lib/inputAttrsNormalizer'; import './style.scss'; export default class TextfieldController extends Component { - constructor($element, $scope, $attrs, normalizer) { + constructor($element, $scope, $attrs, $timeout, normalizer) { super($element); normalizer.normalize($attrs); @@ -12,6 +12,7 @@ export default class TextfieldController extends Component { this.$scope = $scope; this.$attrs = $attrs; this.$element = $element; + this.$timeout = $timeout; this._value = null; this.type = this.$attrs.type || 'text'; @@ -20,6 +21,8 @@ export default class TextfieldController extends Component { this.focus = false; this.hasInfo = Boolean(this.$attrs.info); this.info = this.$attrs.info || null; + this.hasFocus = false; + this.hasMouseIn = false; componentHandler.upgradeElement($element[0].firstChild); } @@ -33,7 +36,7 @@ export default class TextfieldController extends Component { this.hasValue = Boolean(this._value); this.mdlUpdate(); } - + mdlUpdate() { let mdlField = this.$element[0].firstChild.MaterialTextfield; if (mdlField) @@ -45,7 +48,7 @@ export default class TextfieldController extends Component { this.input.focus(); } } -TextfieldController.$inject = ['$element', '$scope', '$attrs', normalizerFactory.NAME]; +TextfieldController.$inject = ['$element', '$scope', '$attrs', '$timeout', normalizerFactory.NAME]; module.component('vnTextfield', { template: require('./textfield.html'), diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index a562d7dd7b..3473160dd6 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -2,6 +2,9 @@ @import "margin"; @import "colors"; +*{ + outline: none; +} .form { height: 100%; box-sizing: border-box; From 35454c5c53a25d6a46412b98911138fa67e73af0 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 27 Sep 2017 12:44:33 +0200 Subject: [PATCH 2/2] moved textfield styles --- client/core/src/textfield/style.scss | 3 +++ client/salix/src/styles/misc.scss | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/core/src/textfield/style.scss b/client/core/src/textfield/style.scss index 236b76b9cd..aafeee2045 100644 --- a/client/core/src/textfield/style.scss +++ b/client/core/src/textfield/style.scss @@ -1,4 +1,7 @@ vn-textfield { + div { + outline: none; //remove chrome outline + } .mdl-chip__action { position: absolute; width: auto; diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 3473160dd6..a562d7dd7b 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -2,9 +2,6 @@ @import "margin"; @import "colors"; -*{ - outline: none; -} .form { height: 100%; box-sizing: border-box;