1 | import { Component, ElementRef, HostBinding, Input, Renderer2 } from '@angular/core';
|
---|
2 | import { FaConfig } from '../config';
|
---|
3 | /**
|
---|
4 | * Fontawesome layers.
|
---|
5 | */
|
---|
6 | export class FaLayersComponent {
|
---|
7 | constructor(renderer, elementRef, config) {
|
---|
8 | this.renderer = renderer;
|
---|
9 | this.elementRef = elementRef;
|
---|
10 | this.config = config;
|
---|
11 | }
|
---|
12 | ngOnInit() {
|
---|
13 | this.renderer.addClass(this.elementRef.nativeElement, 'fa-layers');
|
---|
14 | this.fixedWidth = typeof this.fixedWidth === 'boolean' ? this.fixedWidth : this.config.fixedWidth;
|
---|
15 | }
|
---|
16 | ngOnChanges(changes) {
|
---|
17 | if ('size' in changes) {
|
---|
18 | if (changes.size.currentValue != null) {
|
---|
19 | this.renderer.addClass(this.elementRef.nativeElement, `fa-${changes.size.currentValue}`);
|
---|
20 | }
|
---|
21 | if (changes.size.previousValue != null) {
|
---|
22 | this.renderer.removeClass(this.elementRef.nativeElement, `fa-${changes.size.previousValue}`);
|
---|
23 | }
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
27 | FaLayersComponent.decorators = [
|
---|
28 | { type: Component, args: [{
|
---|
29 | selector: 'fa-layers',
|
---|
30 | template: `<ng-content></ng-content>`
|
---|
31 | },] }
|
---|
32 | ];
|
---|
33 | FaLayersComponent.ctorParameters = () => [
|
---|
34 | { type: Renderer2 },
|
---|
35 | { type: ElementRef },
|
---|
36 | { type: FaConfig }
|
---|
37 | ];
|
---|
38 | FaLayersComponent.propDecorators = {
|
---|
39 | size: [{ type: Input }],
|
---|
40 | fixedWidth: [{ type: Input }, { type: HostBinding, args: ['class.fa-fw',] }]
|
---|
41 | };
|
---|
42 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF5ZXJzLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9saW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