source: trip-planner-front/node_modules/@fortawesome/angular-fontawesome/esm2015/icon/icon.component.js@ 1ad8e64

Last change on this file since 1ad8e64 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 18.5 KB
Line 
1import { Component, HostBinding, Input, Optional } from '@angular/core';
2import { DomSanitizer } from '@angular/platform-browser';
3import { findIconDefinition, icon, parse, } from '@fortawesome/fontawesome-svg-core';
4import { FaConfig } from '../config';
5import { FaIconLibrary } from '../icon-library';
6import { faWarnIfIconDefinitionMissing } from '../shared/errors/warn-if-icon-html-missing';
7import { faWarnIfIconSpecMissing } from '../shared/errors/warn-if-icon-spec-missing';
8import { faClassList } from '../shared/utils/classlist.util';
9import { faNormalizeIconSpec } from '../shared/utils/normalize-icon-spec.util';
10import { FaStackItemSizeDirective } from '../stack/stack-item-size.directive';
11import { FaStackComponent } from '../stack/stack.component';
12export class FaIconComponent {
13 constructor(sanitizer, config, iconLibrary, stackItem, stack) {
14 this.sanitizer = sanitizer;
15 this.config = config;
16 this.iconLibrary = iconLibrary;
17 this.stackItem = stackItem;
18 this.classes = [];
19 if (stack != null && stackItem == null) {
20 console.error('FontAwesome: fa-icon and fa-duotone-icon elements must specify stackItemSize attribute when wrapped into ' +
21 'fa-stack. Example: <fa-icon stackItemSize="2x"></fa-icon>.');
22 }
23 }
24 ngOnChanges(changes) {
25 if (this.icon == null && this.config.fallbackIcon == null) {
26 return faWarnIfIconSpecMissing();
27 }
28 let iconToBeRendered = null;
29 if (this.icon == null) {
30 iconToBeRendered = this.config.fallbackIcon;
31 }
32 else {
33 iconToBeRendered = this.icon;
34 }
35 if (changes) {
36 const iconDefinition = this.findIconDefinition(iconToBeRendered);
37 if (iconDefinition != null) {
38 const params = this.buildParams();
39 this.renderIcon(iconDefinition, params);
40 }
41 }
42 }
43 /**
44 * Programmatically trigger rendering of the icon.
45 *
46 * This method is useful, when creating {@link FaIconComponent} dynamically or
47 * changing its inputs programmatically as in these cases icon won't be
48 * re-rendered automatically.
49 */
50 render() {
51 this.ngOnChanges({});
52 }
53 findIconDefinition(i) {
54 const lookup = faNormalizeIconSpec(i, this.config.defaultPrefix);
55 if ('icon' in lookup) {
56 return lookup;
57 }
58 const definition = this.iconLibrary.getIconDefinition(lookup.prefix, lookup.iconName);
59 if (definition != null) {
60 return definition;
61 }
62 const globalDefinition = findIconDefinition(lookup);
63 if (globalDefinition != null) {
64 const message = 'Global icon library is deprecated. ' +
65 'Consult https://github.com/FortAwesome/angular-fontawesome/blob/master/UPGRADING.md ' +
66 'for the migration instructions.';
67 if (this.config.globalLibrary === 'unset') {
68 console.error('FontAwesome: ' + message);
69 }
70 else if (!this.config.globalLibrary) {
71 throw new Error(message);
72 }
73 return globalDefinition;
74 }
75 faWarnIfIconDefinitionMissing(lookup);
76 return null;
77 }
78 buildParams() {
79 const classOpts = {
80 flip: this.flip,
81 spin: this.spin,
82 pulse: this.pulse,
83 border: this.border,
84 inverse: this.inverse,
85 size: this.size || null,
86 pull: this.pull || null,
87 rotate: this.rotate || null,
88 fixedWidth: typeof this.fixedWidth === 'boolean' ? this.fixedWidth : this.config.fixedWidth,
89 stackItemSize: this.stackItem != null ? this.stackItem.stackItemSize : null,
90 };
91 const parsedTransform = typeof this.transform === 'string' ? parse.transform(this.transform) : this.transform;
92 return {
93 title: this.title,
94 transform: parsedTransform,
95 classes: [...faClassList(classOpts), ...this.classes],
96 mask: this.mask != null ? this.findIconDefinition(this.mask) : null,
97 styles: this.styles != null ? this.styles : {},
98 symbol: this.symbol,
99 attributes: {
100 role: this.a11yRole,
101 },
102 };
103 }
104 renderIcon(definition, params) {
105 const renderedIcon = icon(definition, params);
106 this.renderedIconHTML = this.sanitizer.bypassSecurityTrustHtml(renderedIcon.html.join('\n'));
107 }
108}
109FaIconComponent.decorators = [
110 { type: Component, args: [{
111 selector: 'fa-icon',
112 template: ``,
113 host: {
114 class: 'ng-fa-icon',
115 '[attr.title]': 'title',
116 }
117 },] }
118];
119FaIconComponent.ctorParameters = () => [
120 { type: DomSanitizer },
121 { type: FaConfig },
122 { type: FaIconLibrary },
123 { type: FaStackItemSizeDirective, decorators: [{ type: Optional }] },
124 { type: FaStackComponent, decorators: [{ type: Optional }] }
125];
126FaIconComponent.propDecorators = {
127 icon: [{ type: Input }],
128 title: [{ type: Input }],
129 spin: [{ type: Input }],
130 pulse: [{ type: Input }],
131 mask: [{ type: Input }],
132 styles: [{ type: Input }],
133 flip: [{ type: Input }],
134 size: [{ type: Input }],
135 pull: [{ type: Input }],
136 border: [{ type: Input }],
137 inverse: [{ type: Input }],
138 symbol: [{ type: Input }],
139 rotate: [{ type: Input }],
140 fixedWidth: [{ type: Input }],
141 classes: [{ type: Input }],
142 transform: [{ type: Input }],
143 a11yRole: [{ type: Input }],
144 renderedIconHTML: [{ type: HostBinding, args: ['innerHTML',] }]
145};
146//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaWNvbi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL2ljb24vaWNvbi5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFhLFFBQVEsRUFBaUIsTUFBTSxlQUFlLENBQUM7QUFDbEcsT0FBTyxFQUFFLFlBQVksRUFBWSxNQUFNLDJCQUEyQixDQUFDO0FBQ25FLE9BQU8sRUFFTCxrQkFBa0IsRUFFbEIsSUFBSSxFQUlKLEtBQUssR0FNTixNQUFNLG1DQUFtQyxDQUFDO0FBQzNDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFDckMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQ2hELE9BQU8sRUFBRSw2QkFBNkIsRUFBRSxNQUFNLDRDQUE0QyxDQUFDO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hbnNmb3JtLFxuICAgICAgY2xhc3NlczogWy4uLmZhQ2xhc3NMaXN0KGNsYXNzT3B0cyksIC4uLnRoaXMuY2xhc3Nlc10sXG4gICAgICBtYXNrOiB0aGlzLm1hc2sgIT0gbnVsbCA/IHRoaXMuZmluZEljb25EZWZpbml0aW9uKHRoaXMubWFzaykgOiBudWxsLFxuICAgICAgc3R5bGVzOiB0aGlzLnN0eWxlcyAhPSBudWxsID8gdGhpcy5zdHlsZXMgOiB7fSxcbiAgICAgIHN5bWJvbDogdGhpcy5zeW1ib2wsXG4gICAgICBhdHRyaWJ1dGVzOiB7XG4gICAgICAgIHJvbGU6IHRoaXMuYTExeVJvbGUsXG4gICAgICB9LFxuICAgIH07XG4gIH1cblxuICBwcml2YXRlIHJlbmRlckljb24oZGVmaW5pdGlvbjogSWNvbkRlZmluaXRpb24sIHBhcmFtczogSWNvblBhcmFtcykge1xuICAgIGNvbnN0IHJlbmRlcmVkSWNvbiA9IGljb24oZGVmaW5pdGlvbiwgcGFyYW1zKTtcbiAgICB0aGlzLnJlbmRlcmVkSWNvbkhUTUwgPSB0aGlzLnNhbml0aXplci5ieXBhc3NTZWN1cml0eVRydXN0SHRtbChyZW5kZXJlZEljb24uaHRtbC5qb2luKCdcXG4nKSk7XG4gIH1cbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.