Watchers from vnLabelValue removed

This commit is contained in:
Juan 2018-06-29 09:46:14 +02:00
parent c123207ac2
commit 6f07ae3c5c
4 changed files with 44 additions and 29 deletions

View File

@ -1,4 +1,4 @@
<section ng-class="{'ellipsize': $ctrl.__ellipsize}">
<vn-label translate>{{$ctrl.label}}:</vn-label>
<span title="{{$ctrl.value}}">{{$ctrl.value ? $ctrl.value : '-'}}</span>
<section class="ellipsize">
<vn-label></vn-label>
<span></span>
</section>

View File

@ -2,23 +2,35 @@ import ngModule from '../../module';
import './style.scss';
export default class Controller {
constructor() {
this.__ellipsize = true;
constructor($element, $translate) {
this.element = $element[0];
this._ = $translate;
}
set ellipsize(value) {
this.__ellipsize = value;
set label(value) {
let label = this.element.querySelector('vn-label');
label.textContent = this._.instant(value) + ':';
this._label = value;
}
get label() {
return this._label;
}
set value(value) {
let span = this.element.querySelector('span');
span.title = value;
span.textContent = value ? value : '-';
this._value = value;
}
get value() {
return this._value;
}
}
Controller.$inject = ['$element', '$translate'];
ngModule.component('vnLabelValue', {
template: require('./label-value.html'),
controller: Controller,
replace: true,
transclude: true,
template: require('./label-value.html'),
bindings: {
label: '@',
value: '@',
ellipsize: '<?'
value: '@'
}
});

View File

@ -1,11 +1,10 @@
@import "colors";
vn-label-value {
& vn-label {
vn-label-value > section {
& > vn-label {
color: $secondary-font-color;
}
& span {
& > span {
color: $main-font-color;
}
}

View File

@ -200,21 +200,26 @@ vn-main-block {
text-decoration: none;
color: inherit;
& > vn-horizontal > .buttons {
align-items: center;
& > vn-horizontal {
& > vn-one {
overflow: hidden;
}
& > .buttons {
align-items: center;
vn-icon {
opacity: .4;
color: $main-01;
margin-left: .5em;
transition: opacity 250ms ease-out;
font-size: 2em;
vn-icon {
opacity: .4;
color: $main-01;
margin-left: .5em;
transition: opacity 250ms ease-out;
font-size: 2em;
&:hover {
opacity: 1;
&:hover {
opacity: 1;
}
}
}
}
}
}
/** START - FORM ELEMENTS DISABLED **/
@ -237,5 +242,4 @@ fieldset[disabled] .mdl-textfield .mdl-textfield__label,
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 20em
}