#1411 Componente leyenda de colores

This commit is contained in:
Carlos Jimenez Ruiz 2019-05-09 14:17:44 +02:00
parent 883f0c6b42
commit 6f83f03400
4 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<span
ng-class="{'pointer': $ctrl.$attrs['onClick']}"
class="mdl-chip mdl-chip--contact"
ng-repeat="legend in $ctrl.data"
vn-tooltip="{{legend.description}}"
ng-click="$ctrl.onClick(legend)">
<span class="mdl-chip__contact" ng-style="{backgroundColor: legend.color}"></span>
<span class="mdl-chip__text">{{legend.name}}</span>
</span>

View File

@ -0,0 +1,24 @@
import ngModule from '../../module';
import Component from '../../lib/component';
import './style.scss';
export default class Controller extends Component {
constructor($element, $scope, $attrs) {
super($element, $scope);
this.$attrs = $attrs;
}
onClick(legend) {
this.emit('click', {legend});
}
}
Controller.$inject = ['$element', '$scope', '$attrs'];
ngModule.component('vnColorLegend', {
template: require('./index.html'),
controller: Controller,
bindings: {
data: '<?'
}
});

View File

@ -0,0 +1,13 @@
@import "variables";
.mdl-chip--contact {
margin-left: 5px;
height: 20px;
line-height: 5px;
float: left
}
.mdl-chip--contact .mdl-chip__contact {
height: 20px;
width: 20px
}

View File

@ -38,6 +38,7 @@ import './td-editable';
import './th';
import './input-range';
import './chip';
import './color-legend';
import './input-number';
import './input-time';
import './treeview';