label-value component Enable/disable ellipsize #364

This commit is contained in:
Joan Sanchez 2018-06-21 08:46:30 +02:00
parent 7f8ceb6d37
commit afe051883e
3 changed files with 17 additions and 5 deletions

View File

@ -22,7 +22,7 @@
<vn-label-value label="Mobile" <vn-label-value label="Mobile"
value="{{$ctrl.summary.mobile}}"> value="{{$ctrl.summary.mobile}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Email" <vn-label-value label="Email" ellipsize="false"
value="{{$ctrl.summary.email}}"> value="{{$ctrl.summary.email}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Sales person" <vn-label-value label="Sales person"
@ -40,7 +40,7 @@
<vn-label-value label="NIF / CIF" <vn-label-value label="NIF / CIF"
value="{{$ctrl.summary.fi}}"> value="{{$ctrl.summary.fi}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Street" <vn-label-value label="Street" ellipsize="false"
value="{{$ctrl.summary.street}}"> value="{{$ctrl.summary.street}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="City" <vn-label-value label="City"
@ -145,7 +145,7 @@
<vn-label-value label="Name" <vn-label-value label="Name"
value="{{$ctrl.summary.addresses[0].nickname}}"> value="{{$ctrl.summary.addresses[0].nickname}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Street" <vn-label-value label="Street" ellipsize="false"
value="{{$ctrl.summary.addresses[0].street}}"> value="{{$ctrl.summary.addresses[0].street}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="City" <vn-label-value label="City"

View File

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

View File

@ -1,12 +1,24 @@
import ngModule from '../../module'; import ngModule from '../../module';
import './style.scss'; import './style.scss';
export default class Controller {
constructor() {
this.__ellipsize = true;
}
set ellipsize(value) {
this.__ellipsize = value;
}
}
ngModule.component('vnLabelValue', { ngModule.component('vnLabelValue', {
template: require('./label-value.html'), template: require('./label-value.html'),
controller: Controller,
replace: true, replace: true,
transclude: true, transclude: true,
bindings: { bindings: {
label: '@', label: '@',
value: '@' value: '@',
ellipsize: '<?'
} }
}); });