@coreui/icons-angular 4.2.14 → 4.2.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,394 +4,394 @@ import * as i1 from '@angular/platform-browser';
4
4
  import * as i3 from '@angular/common';
5
5
  import { CommonModule } from '@angular/common';
6
6
 
7
- class IconSetService {
8
- constructor() {
9
- this._iconNames = {};
10
- this._icons = {};
11
- }
12
- get iconNames() {
13
- return this._iconNames;
14
- }
15
- ;
16
- get icons() {
17
- return this._icons;
18
- }
19
- set icons(iconSet) {
20
- for (const iconsKey in iconSet) {
21
- this._iconNames[iconsKey] = iconsKey;
22
- }
23
- this._icons = iconSet;
24
- }
25
- getIcon(name) {
26
- const icon = this.icons[name];
27
- if (!icon) {
28
- console.warn(`CoreUI WARN: Icon ${name} is not registered in IconService`);
29
- }
30
- return this.icons[name];
31
- }
32
- }
33
- IconSetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconSetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
34
- IconSetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconSetService, providedIn: 'root' });
35
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconSetService, decorators: [{
36
- type: Injectable,
37
- args: [{
38
- providedIn: 'root'
39
- }]
7
+ class IconSetService {
8
+ constructor() {
9
+ this._iconNames = {};
10
+ this._icons = {};
11
+ }
12
+ get iconNames() {
13
+ return this._iconNames;
14
+ }
15
+ ;
16
+ get icons() {
17
+ return this._icons;
18
+ }
19
+ set icons(iconSet) {
20
+ for (const iconsKey in iconSet) {
21
+ this._iconNames[iconsKey] = iconsKey;
22
+ }
23
+ this._icons = iconSet;
24
+ }
25
+ getIcon(name) {
26
+ const icon = this.icons[name];
27
+ if (!icon) {
28
+ console.warn(`CoreUI WARN: Icon ${name} is not registered in IconService`);
29
+ }
30
+ return this.icons[name];
31
+ }
32
+ }
33
+ IconSetService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconSetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
34
+ IconSetService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconSetService, providedIn: 'root' });
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconSetService, decorators: [{
36
+ type: Injectable,
37
+ args: [{
38
+ providedIn: 'root'
39
+ }]
40
40
  }], ctorParameters: function () { return []; } });
41
41
 
42
- class IconSetModule {
43
- constructor(parentModule) {
44
- if (parentModule) {
45
- throw new Error('CoreUI IconSetModule is already loaded. Import it in the AppModule only');
46
- }
47
- }
48
- static forRoot() {
49
- return {
50
- ngModule: IconSetModule,
51
- providers: [
52
- { provide: IconSetService }
53
- ]
54
- };
55
- }
56
- }
57
- IconSetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconSetModule, deps: [{ token: IconSetModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
58
- IconSetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: IconSetModule, imports: [CommonModule] });
59
- IconSetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconSetModule, providers: [
60
- IconSetService
61
- ], imports: [CommonModule] });
62
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconSetModule, decorators: [{
63
- type: NgModule,
64
- args: [{
65
- imports: [
66
- CommonModule
67
- ],
68
- providers: [
69
- IconSetService
70
- ]
71
- }]
72
- }], ctorParameters: function () {
73
- return [{ type: IconSetModule, decorators: [{
74
- type: Optional
75
- }, {
76
- type: SkipSelf
77
- }] }];
42
+ class IconSetModule {
43
+ constructor(parentModule) {
44
+ if (parentModule) {
45
+ throw new Error('CoreUI IconSetModule is already loaded. Import it in the AppModule only');
46
+ }
47
+ }
48
+ static forRoot() {
49
+ return {
50
+ ngModule: IconSetModule,
51
+ providers: [
52
+ { provide: IconSetService }
53
+ ]
54
+ };
55
+ }
56
+ }
57
+ IconSetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconSetModule, deps: [{ token: IconSetModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
58
+ IconSetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: IconSetModule, imports: [CommonModule] });
59
+ IconSetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconSetModule, providers: [
60
+ IconSetService
61
+ ], imports: [CommonModule] });
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconSetModule, decorators: [{
63
+ type: NgModule,
64
+ args: [{
65
+ imports: [
66
+ CommonModule
67
+ ],
68
+ providers: [
69
+ IconSetService
70
+ ]
71
+ }]
72
+ }], ctorParameters: function () {
73
+ return [{ type: IconSetModule, decorators: [{
74
+ type: Optional
75
+ }, {
76
+ type: SkipSelf
77
+ }] }];
78
78
  } });
79
79
 
80
- class IconDirective {
81
- constructor(renderer, elementRef, sanitizer, iconSet) {
82
- this.renderer = renderer;
83
- this.elementRef = elementRef;
84
- this.sanitizer = sanitizer;
85
- this.iconSet = iconSet;
86
- this.size = '';
87
- this.xmlns = 'http://www.w3.org/2000/svg';
88
- this.pointerEvents = 'none';
89
- this.role = 'img';
90
- }
91
- set name(name) {
92
- this._name = (name === null || name === void 0 ? void 0 : name.includes('-')) ? this.toCamelCase(name) : name;
93
- }
94
- get name() {
95
- return this._name;
96
- }
97
- set viewBox(viewBox) {
98
- this._viewBox = viewBox;
99
- }
100
- get viewBox() {
101
- var _a;
102
- return (_a = this._viewBox) !== null && _a !== void 0 ? _a : this.scale;
103
- }
104
- get hostClasses() {
105
- var _a;
106
- const classes = {
107
- icon: true,
108
- [`icon-${this.computedSize}`]: !!this.computedSize
109
- };
110
- return (_a = this.customClasses) !== null && _a !== void 0 ? _a : classes;
111
- }
112
- get innerHtml() {
113
- var _a, _b;
114
- const code = Array.isArray(this.code) ? this.code[1] || this.code[0] : (_a = this.code) !== null && _a !== void 0 ? _a : '';
115
- // todo proper sanitize
116
- // const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
117
- return this.sanitizer.bypassSecurityTrustHtml((_b = (this.titleCode + code)) !== null && _b !== void 0 ? _b : '');
118
- }
119
- get titleCode() {
120
- return this.title ? `<title>${this.title}</title>` : '';
121
- }
122
- get code() {
123
- var _a;
124
- if (this.content) {
125
- return this.content;
126
- }
127
- if (this.iconSet && this.name) {
128
- return this.iconSet.getIcon(this.name);
129
- }
130
- if (this.name && !((_a = this.iconSet) === null || _a === void 0 ? void 0 : _a.icons[this.name]))
131
- console.warn(`c-icon component: icon name '${this.name}' does not exist for IconSet service. ` +
132
- `To use icon by 'name' prop you need to add it to IconSet service. \n`, this.name);
133
- return undefined;
134
- }
135
- get scale() {
136
- return Array.isArray(this.code) && this.code.length > 1 ? `0 0 ${this.code[0]}` : '0 0 64 64';
137
- }
138
- get computedSize() {
139
- const addCustom = !this.size && (this.width || this.height);
140
- return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
141
- }
142
- get computedClasses() {
143
- const classes = {
144
- icon: true,
145
- [`icon-${this.computedSize}`]: !!this.computedSize
146
- };
147
- return !!this.customClasses ? this.customClasses : classes;
148
- }
149
- toCamelCase(str) {
150
- return str.replace(/([-_][a-z0-9])/ig, ($1) => {
151
- return $1.toUpperCase().replace('-', '');
152
- });
153
- }
154
- }
155
- IconDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconSetService }], target: i0.ɵɵFactoryTarget.Directive });
156
- IconDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.11", type: IconDirective, selector: "svg[cIcon]", inputs: { content: ["cIcon", "content"], size: "size", title: "title", customClasses: "customClasses", width: "width", height: "height", name: "name", viewBox: "viewBox", xmlns: "xmlns", pointerEvents: ["pointer-events", "pointerEvents"], role: "role" }, host: { properties: { "attr.viewBox": "this.viewBox", "attr.xmlns": "this.xmlns", "attr.pointer-events": "this.pointerEvents", "attr.role": "this.role", "class": "this.hostClasses", "innerHtml": "this.innerHtml" } }, exportAs: ["cIcon"], ngImport: i0 });
157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconDirective, decorators: [{
158
- type: Directive,
159
- args: [{
160
- selector: 'svg[cIcon]',
161
- exportAs: 'cIcon'
162
- }]
163
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconSetService }]; }, propDecorators: { content: [{
164
- type: Input,
165
- args: ['cIcon']
166
- }], size: [{
167
- type: Input
168
- }], title: [{
169
- type: Input
170
- }], customClasses: [{
171
- type: Input
172
- }], width: [{
173
- type: Input
174
- }], height: [{
175
- type: Input
176
- }], name: [{
177
- type: Input
178
- }], viewBox: [{
179
- type: HostBinding,
180
- args: ['attr.viewBox']
181
- }, {
182
- type: Input
183
- }], xmlns: [{
184
- type: HostBinding,
185
- args: ['attr.xmlns']
186
- }, {
187
- type: Input
188
- }], pointerEvents: [{
189
- type: HostBinding,
190
- args: ['attr.pointer-events']
191
- }, {
192
- type: Input,
193
- args: ['pointer-events']
194
- }], role: [{
195
- type: HostBinding,
196
- args: ['attr.role']
197
- }, {
198
- type: Input
199
- }], hostClasses: [{
200
- type: HostBinding,
201
- args: ['class']
202
- }], innerHtml: [{
203
- type: HostBinding,
204
- args: ['innerHtml']
80
+ class IconDirective {
81
+ constructor(renderer, elementRef, sanitizer, iconSet) {
82
+ this.renderer = renderer;
83
+ this.elementRef = elementRef;
84
+ this.sanitizer = sanitizer;
85
+ this.iconSet = iconSet;
86
+ this.size = '';
87
+ this.xmlns = 'http://www.w3.org/2000/svg';
88
+ this.pointerEvents = 'none';
89
+ this.role = 'img';
90
+ }
91
+ set name(name) {
92
+ this._name = (name === null || name === void 0 ? void 0 : name.includes('-')) ? this.toCamelCase(name) : name;
93
+ }
94
+ get name() {
95
+ return this._name;
96
+ }
97
+ set viewBox(viewBox) {
98
+ this._viewBox = viewBox;
99
+ }
100
+ get viewBox() {
101
+ var _a;
102
+ return (_a = this._viewBox) !== null && _a !== void 0 ? _a : this.scale;
103
+ }
104
+ get hostClasses() {
105
+ var _a;
106
+ const classes = {
107
+ icon: true,
108
+ [`icon-${this.computedSize}`]: !!this.computedSize
109
+ };
110
+ return (_a = this.customClasses) !== null && _a !== void 0 ? _a : classes;
111
+ }
112
+ get innerHtml() {
113
+ var _a, _b;
114
+ const code = Array.isArray(this.code) ? this.code[1] || this.code[0] : (_a = this.code) !== null && _a !== void 0 ? _a : '';
115
+ // todo proper sanitize
116
+ // const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
117
+ return this.sanitizer.bypassSecurityTrustHtml((_b = (this.titleCode + code)) !== null && _b !== void 0 ? _b : '');
118
+ }
119
+ get titleCode() {
120
+ return this.title ? `<title>${this.title}</title>` : '';
121
+ }
122
+ get code() {
123
+ var _a;
124
+ if (this.content) {
125
+ return this.content;
126
+ }
127
+ if (this.iconSet && this.name) {
128
+ return this.iconSet.getIcon(this.name);
129
+ }
130
+ if (this.name && !((_a = this.iconSet) === null || _a === void 0 ? void 0 : _a.icons[this.name]))
131
+ console.warn(`c-icon component: icon name '${this.name}' does not exist for IconSet service. ` +
132
+ `To use icon by 'name' prop you need to add it to IconSet service. \n`, this.name);
133
+ return undefined;
134
+ }
135
+ get scale() {
136
+ return Array.isArray(this.code) && this.code.length > 1 ? `0 0 ${this.code[0]}` : '0 0 64 64';
137
+ }
138
+ get computedSize() {
139
+ const addCustom = !this.size && (this.width || this.height);
140
+ return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
141
+ }
142
+ get computedClasses() {
143
+ const classes = {
144
+ icon: true,
145
+ [`icon-${this.computedSize}`]: !!this.computedSize
146
+ };
147
+ return !!this.customClasses ? this.customClasses : classes;
148
+ }
149
+ toCamelCase(str) {
150
+ return str.replace(/([-_][a-z0-9])/ig, ($1) => {
151
+ return $1.toUpperCase().replace('-', '');
152
+ });
153
+ }
154
+ }
155
+ IconDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconSetService }], target: i0.ɵɵFactoryTarget.Directive });
156
+ IconDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: IconDirective, selector: "svg[cIcon]", inputs: { content: ["cIcon", "content"], size: "size", title: "title", customClasses: "customClasses", width: "width", height: "height", name: "name", viewBox: "viewBox", xmlns: "xmlns", pointerEvents: ["pointer-events", "pointerEvents"], role: "role" }, host: { properties: { "attr.viewBox": "this.viewBox", "attr.xmlns": "this.xmlns", "attr.pointer-events": "this.pointerEvents", "attr.role": "this.role", "class": "this.hostClasses", "innerHtml": "this.innerHtml" } }, exportAs: ["cIcon"], ngImport: i0 });
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconDirective, decorators: [{
158
+ type: Directive,
159
+ args: [{
160
+ selector: 'svg[cIcon]',
161
+ exportAs: 'cIcon'
162
+ }]
163
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconSetService }]; }, propDecorators: { content: [{
164
+ type: Input,
165
+ args: ['cIcon']
166
+ }], size: [{
167
+ type: Input
168
+ }], title: [{
169
+ type: Input
170
+ }], customClasses: [{
171
+ type: Input
172
+ }], width: [{
173
+ type: Input
174
+ }], height: [{
175
+ type: Input
176
+ }], name: [{
177
+ type: Input
178
+ }], viewBox: [{
179
+ type: HostBinding,
180
+ args: ['attr.viewBox']
181
+ }, {
182
+ type: Input
183
+ }], xmlns: [{
184
+ type: HostBinding,
185
+ args: ['attr.xmlns']
186
+ }, {
187
+ type: Input
188
+ }], pointerEvents: [{
189
+ type: HostBinding,
190
+ args: ['attr.pointer-events']
191
+ }, {
192
+ type: Input,
193
+ args: ['pointer-events']
194
+ }], role: [{
195
+ type: HostBinding,
196
+ args: ['attr.role']
197
+ }, {
198
+ type: Input
199
+ }], hostClasses: [{
200
+ type: HostBinding,
201
+ args: ['class']
202
+ }], innerHtml: [{
203
+ type: HostBinding,
204
+ args: ['innerHtml']
205
205
  }] } });
206
206
 
207
- class HtmlAttributesDirective {
208
- constructor(renderer, el) {
209
- this.renderer = renderer;
210
- this.el = el;
211
- }
212
- ngOnInit() {
213
- const attribs = this.cHtmlAttr;
214
- for (const attr in attribs) {
215
- if (attr === 'style' && typeof (attribs[attr]) === 'object') {
216
- this.setStyle(attribs[attr]);
217
- }
218
- else if (attr === 'class') {
219
- this.addClass(attribs[attr]);
220
- }
221
- else {
222
- this.setAttrib(attr, attribs[attr]);
223
- }
224
- }
225
- }
226
- setStyle(styles) {
227
- // tslint:disable-next-line:forin
228
- for (const style in styles) {
229
- this.renderer.setStyle(this.el.nativeElement, style, styles[style]);
230
- }
231
- }
232
- addClass(classes) {
233
- const classArray = (Array.isArray(classes) ? classes : classes.split(' '));
234
- classArray.filter((element) => element.length > 0).forEach(element => {
235
- this.renderer.addClass(this.el.nativeElement, element);
236
- });
237
- }
238
- setAttrib(key, value) {
239
- value !== null ?
240
- this.renderer.setAttribute(this.el.nativeElement, key, value) :
241
- this.renderer.removeAttribute(this.el.nativeElement, key);
242
- }
243
- }
244
- HtmlAttributesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: HtmlAttributesDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
245
- HtmlAttributesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.11", type: HtmlAttributesDirective, selector: "[cHtmlAttr]", inputs: { cHtmlAttr: "cHtmlAttr" }, exportAs: ["cHtmlAttr"], ngImport: i0 });
246
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: HtmlAttributesDirective, decorators: [{
247
- type: Directive,
248
- args: [{
249
- selector: '[cHtmlAttr]',
250
- exportAs: 'cHtmlAttr'
251
- }]
252
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { cHtmlAttr: [{
253
- type: Input
207
+ class HtmlAttributesDirective {
208
+ constructor(renderer, el) {
209
+ this.renderer = renderer;
210
+ this.el = el;
211
+ }
212
+ ngOnInit() {
213
+ const attribs = this.cHtmlAttr;
214
+ for (const attr in attribs) {
215
+ if (attr === 'style' && typeof (attribs[attr]) === 'object') {
216
+ this.setStyle(attribs[attr]);
217
+ }
218
+ else if (attr === 'class') {
219
+ this.addClass(attribs[attr]);
220
+ }
221
+ else {
222
+ this.setAttrib(attr, attribs[attr]);
223
+ }
224
+ }
225
+ }
226
+ setStyle(styles) {
227
+ // tslint:disable-next-line:forin
228
+ for (const style in styles) {
229
+ this.renderer.setStyle(this.el.nativeElement, style, styles[style]);
230
+ }
231
+ }
232
+ addClass(classes) {
233
+ const classArray = (Array.isArray(classes) ? classes : classes.split(' '));
234
+ classArray.filter((element) => element.length > 0).forEach(element => {
235
+ this.renderer.addClass(this.el.nativeElement, element);
236
+ });
237
+ }
238
+ setAttrib(key, value) {
239
+ value !== null ?
240
+ this.renderer.setAttribute(this.el.nativeElement, key, value) :
241
+ this.renderer.removeAttribute(this.el.nativeElement, key);
242
+ }
243
+ }
244
+ HtmlAttributesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HtmlAttributesDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
245
+ HtmlAttributesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: HtmlAttributesDirective, selector: "[cHtmlAttr]", inputs: { cHtmlAttr: "cHtmlAttr" }, exportAs: ["cHtmlAttr"], ngImport: i0 });
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HtmlAttributesDirective, decorators: [{
247
+ type: Directive,
248
+ args: [{
249
+ selector: '[cHtmlAttr]',
250
+ exportAs: 'cHtmlAttr'
251
+ }]
252
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { cHtmlAttr: [{
253
+ type: Input
254
254
  }] } });
255
255
 
256
- class IconComponent {
257
- constructor(renderer, elementRef, sanitizer, iconSet) {
258
- this.renderer = renderer;
259
- this.elementRef = elementRef;
260
- this.sanitizer = sanitizer;
261
- this.iconSet = iconSet;
262
- this.attributes = { role: 'img' };
263
- this.size = '';
264
- this.use = '';
265
- this.customClasses = '';
266
- this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
267
- }
268
- set name(name) {
269
- this._name = name.includes('-') ? this.toCamelCase(name) : name;
270
- }
271
- get name() {
272
- return this._name;
273
- }
274
- set viewBox(viewBox) {
275
- this._viewBox = viewBox;
276
- }
277
- get viewBox() {
278
- var _a;
279
- return (_a = this._viewBox) !== null && _a !== void 0 ? _a : this.scale;
280
- }
281
- get innerHtml() {
282
- var _a, _b;
283
- const code = Array.isArray(this.code) ? this.code[1] || this.code[0] : (_a = this.code) !== null && _a !== void 0 ? _a : '';
284
- // todo proper sanitize
285
- // const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
286
- return this.sanitizer.bypassSecurityTrustHtml((_b = (this.titleCode + code)) !== null && _b !== void 0 ? _b : '');
287
- }
288
- ngAfterViewInit() {
289
- this.elementRef.nativeElement.classList.forEach((item) => {
290
- this.renderer.addClass(this.svgElementRef.nativeElement, item);
291
- });
292
- const parentElement = this.renderer.parentNode(this.elementRef.nativeElement);
293
- const svgElement = this.svgElementRef.nativeElement;
294
- this.renderer.insertBefore(parentElement, svgElement, this.elementRef.nativeElement);
295
- this.renderer.removeChild(parentElement, this.elementRef.nativeElement);
296
- }
297
- get titleCode() {
298
- return this.title ? `<title>${this.title}</title>` : '';
299
- }
300
- get code() {
301
- var _a;
302
- if (this.content) {
303
- return this.content;
304
- }
305
- if (this.iconSet && this.name) {
306
- return this.iconSet.getIcon(this.name);
307
- }
308
- if (this.name && !((_a = this.iconSet) === null || _a === void 0 ? void 0 : _a.icons[this.name]))
309
- console.warn(`c-icon component: icon name '${this.name}' does not exist for IconSet service. ` +
310
- `To use icon by 'name' prop you need to add it to IconSet service. \n`, this.name);
311
- return undefined;
312
- }
313
- get scale() {
314
- return Array.isArray(this.code) && this.code.length > 1 ? `0 0 ${this.code[0]}` : '0 0 64 64';
315
- }
316
- get computedSize() {
317
- const addCustom = !this.size && (this.width || this.height);
318
- return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
319
- }
320
- get computedClasses() {
321
- const classes = {
322
- icon: true,
323
- [`icon-${this.computedSize}`]: !!this.computedSize
324
- };
325
- return !!this.customClasses ? this.customClasses : classes;
326
- }
327
- toCamelCase(str) {
328
- return str.replace(/([-_][a-z0-9])/ig, ($1) => {
329
- return $1.toUpperCase().replace('-', '');
330
- });
331
- }
332
- }
333
- IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconSetService }], target: i0.ɵɵFactoryTarget.Component });
334
- IconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.11", type: IconComponent, selector: "c-icon", inputs: { attributes: "attributes", content: "content", size: "size", title: "title", use: "use", customClasses: "customClasses", width: "width", height: "height", name: "name", viewBox: "viewBox" }, viewQueries: [{ propertyName: "svgElementRef", first: true, predicate: ["svgElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<svg *ngIf=\"(!use) && (!!code)\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n [attr.width]=\"width\"\r\n [attr.height]=\"height || width\"\r\n [attr.viewBox]=\"viewBox\"\r\n [innerHtml]=\"innerHtml\"\r\n [ngClass]=\"computedClasses\"\r\n [cHtmlAttr]=\"attributes\"\r\n role=\"img\"\r\n pointer-events=\"none\"\r\n #svgElement\r\n>\r\n</svg>\r\n\r\n<svg *ngIf=\"use\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n [attr.width]=\"width\"\r\n [attr.height]=\"height || width\"\r\n [ngClass]=\"computedClasses\"\r\n [cHtmlAttr]=\"attributes\"\r\n role=\"img\"\r\n pointer-events=\"none\"\r\n>\r\n <use [attr.href]=\"use\"></use>\r\n</svg>\r\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: HtmlAttributesDirective, selector: "[cHtmlAttr]", inputs: ["cHtmlAttr"], exportAs: ["cHtmlAttr"] }] });
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconComponent, decorators: [{
336
- type: Component,
337
- args: [{ selector: 'c-icon', template: "<svg *ngIf=\"(!use) && (!!code)\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n [attr.width]=\"width\"\r\n [attr.height]=\"height || width\"\r\n [attr.viewBox]=\"viewBox\"\r\n [innerHtml]=\"innerHtml\"\r\n [ngClass]=\"computedClasses\"\r\n [cHtmlAttr]=\"attributes\"\r\n role=\"img\"\r\n pointer-events=\"none\"\r\n #svgElement\r\n>\r\n</svg>\r\n\r\n<svg *ngIf=\"use\"\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n [attr.width]=\"width\"\r\n [attr.height]=\"height || width\"\r\n [ngClass]=\"computedClasses\"\r\n [cHtmlAttr]=\"attributes\"\r\n role=\"img\"\r\n pointer-events=\"none\"\r\n>\r\n <use [attr.href]=\"use\"></use>\r\n</svg>\r\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"] }]
338
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconSetService }]; }, propDecorators: { attributes: [{
339
- type: Input
340
- }], content: [{
341
- type: Input
342
- }], size: [{
343
- type: Input
344
- }], title: [{
345
- type: Input
346
- }], use: [{
347
- type: Input
348
- }], customClasses: [{
349
- type: Input
350
- }], width: [{
351
- type: Input
352
- }], height: [{
353
- type: Input
354
- }], name: [{
355
- type: Input
356
- }], viewBox: [{
357
- type: Input
358
- }], svgElementRef: [{
359
- type: ViewChild,
360
- args: ['svgElement', { read: ElementRef }]
256
+ class IconComponent {
257
+ constructor(renderer, elementRef, sanitizer, iconSet) {
258
+ this.renderer = renderer;
259
+ this.elementRef = elementRef;
260
+ this.sanitizer = sanitizer;
261
+ this.iconSet = iconSet;
262
+ this.attributes = { role: 'img' };
263
+ this.size = '';
264
+ this.use = '';
265
+ this.customClasses = '';
266
+ this.renderer.setStyle(this.elementRef.nativeElement, 'display', 'none');
267
+ }
268
+ set name(name) {
269
+ this._name = name.includes('-') ? this.toCamelCase(name) : name;
270
+ }
271
+ get name() {
272
+ return this._name;
273
+ }
274
+ set viewBox(viewBox) {
275
+ this._viewBox = viewBox;
276
+ }
277
+ get viewBox() {
278
+ var _a;
279
+ return (_a = this._viewBox) !== null && _a !== void 0 ? _a : this.scale;
280
+ }
281
+ get innerHtml() {
282
+ var _a, _b;
283
+ const code = Array.isArray(this.code) ? this.code[1] || this.code[0] : (_a = this.code) !== null && _a !== void 0 ? _a : '';
284
+ // todo proper sanitize
285
+ // const sanitized = this.sanitizer.sanitize(SecurityContext.HTML, code);
286
+ return this.sanitizer.bypassSecurityTrustHtml((_b = (this.titleCode + code)) !== null && _b !== void 0 ? _b : '');
287
+ }
288
+ ngAfterViewInit() {
289
+ this.elementRef.nativeElement.classList.forEach((item) => {
290
+ this.renderer.addClass(this.svgElementRef.nativeElement, item);
291
+ });
292
+ const parentElement = this.renderer.parentNode(this.elementRef.nativeElement);
293
+ const svgElement = this.svgElementRef.nativeElement;
294
+ this.renderer.insertBefore(parentElement, svgElement, this.elementRef.nativeElement);
295
+ this.renderer.removeChild(parentElement, this.elementRef.nativeElement);
296
+ }
297
+ get titleCode() {
298
+ return this.title ? `<title>${this.title}</title>` : '';
299
+ }
300
+ get code() {
301
+ var _a;
302
+ if (this.content) {
303
+ return this.content;
304
+ }
305
+ if (this.iconSet && this.name) {
306
+ return this.iconSet.getIcon(this.name);
307
+ }
308
+ if (this.name && !((_a = this.iconSet) === null || _a === void 0 ? void 0 : _a.icons[this.name]))
309
+ console.warn(`c-icon component: icon name '${this.name}' does not exist for IconSet service. ` +
310
+ `To use icon by 'name' prop you need to add it to IconSet service. \n`, this.name);
311
+ return undefined;
312
+ }
313
+ get scale() {
314
+ return Array.isArray(this.code) && this.code.length > 1 ? `0 0 ${this.code[0]}` : '0 0 64 64';
315
+ }
316
+ get computedSize() {
317
+ const addCustom = !this.size && (this.width || this.height);
318
+ return this.size === 'custom' || addCustom ? 'custom-size' : this.size;
319
+ }
320
+ get computedClasses() {
321
+ const classes = {
322
+ icon: true,
323
+ [`icon-${this.computedSize}`]: !!this.computedSize
324
+ };
325
+ return !!this.customClasses ? this.customClasses : classes;
326
+ }
327
+ toCamelCase(str) {
328
+ return str.replace(/([-_][a-z0-9])/ig, ($1) => {
329
+ return $1.toUpperCase().replace('-', '');
330
+ });
331
+ }
332
+ }
333
+ IconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.DomSanitizer }, { token: IconSetService }], target: i0.ɵɵFactoryTarget.Component });
334
+ IconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: IconComponent, selector: "c-icon", inputs: { attributes: "attributes", content: "content", size: "size", title: "title", use: "use", customClasses: "customClasses", width: "width", height: "height", name: "name", viewBox: "viewBox" }, viewQueries: [{ propertyName: "svgElementRef", first: true, predicate: ["svgElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<svg *ngIf=\"(!use) && (!!code)\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width\"\n [attr.height]=\"height || width\"\n [attr.viewBox]=\"viewBox\"\n [innerHtml]=\"innerHtml\"\n [ngClass]=\"computedClasses\"\n [cHtmlAttr]=\"attributes\"\n role=\"img\"\n pointer-events=\"none\"\n #svgElement\n>\n</svg>\n\n<svg *ngIf=\"use\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width\"\n [attr.height]=\"height || width\"\n [ngClass]=\"computedClasses\"\n [cHtmlAttr]=\"attributes\"\n role=\"img\"\n pointer-events=\"none\"\n>\n <use [attr.href]=\"use\"></use>\n</svg>\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: HtmlAttributesDirective, selector: "[cHtmlAttr]", inputs: ["cHtmlAttr"], exportAs: ["cHtmlAttr"] }] });
335
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconComponent, decorators: [{
336
+ type: Component,
337
+ args: [{ selector: 'c-icon', template: "<svg *ngIf=\"(!use) && (!!code)\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width\"\n [attr.height]=\"height || width\"\n [attr.viewBox]=\"viewBox\"\n [innerHtml]=\"innerHtml\"\n [ngClass]=\"computedClasses\"\n [cHtmlAttr]=\"attributes\"\n role=\"img\"\n pointer-events=\"none\"\n #svgElement\n>\n</svg>\n\n<svg *ngIf=\"use\"\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"width\"\n [attr.height]=\"height || width\"\n [ngClass]=\"computedClasses\"\n [cHtmlAttr]=\"attributes\"\n role=\"img\"\n pointer-events=\"none\"\n>\n <use [attr.href]=\"use\"></use>\n</svg>\n", styles: [".icon{display:inline-block;color:inherit;text-align:center;vertical-align:-.125rem;fill:currentColor}.icon:not(.icon-c-s):not(.icon-custom-size){width:1rem;height:1rem;font-size:1rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xxl{width:2rem;height:2rem;font-size:2rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-xl{width:1.5rem;height:1.5rem;font-size:1.5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-lg{width:1.25rem;height:1.25rem;font-size:1.25rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-sm{width:.875rem;height:.875rem;font-size:.875rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-3xl{width:3rem;height:3rem;font-size:3rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-4xl{width:4rem;height:4rem;font-size:4rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-5xl{width:5rem;height:5rem;font-size:5rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-6xl{width:6rem;height:6rem;font-size:6rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-7xl{width:7rem;height:7rem;font-size:7rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-8xl{width:8rem;height:8rem;font-size:8rem}.icon:not(.icon-c-s):not(.icon-custom-size).icon-9xl{width:9rem;height:9rem;font-size:9rem}\n"] }]
338
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: IconSetService }]; }, propDecorators: { attributes: [{
339
+ type: Input
340
+ }], content: [{
341
+ type: Input
342
+ }], size: [{
343
+ type: Input
344
+ }], title: [{
345
+ type: Input
346
+ }], use: [{
347
+ type: Input
348
+ }], customClasses: [{
349
+ type: Input
350
+ }], width: [{
351
+ type: Input
352
+ }], height: [{
353
+ type: Input
354
+ }], name: [{
355
+ type: Input
356
+ }], viewBox: [{
357
+ type: Input
358
+ }], svgElementRef: [{
359
+ type: ViewChild,
360
+ args: ['svgElement', { read: ElementRef }]
361
361
  }] } });
362
362
 
363
- class IconModule {
364
- }
365
- IconModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
366
- IconModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.11", ngImport: i0, type: IconModule, declarations: [IconComponent,
367
- HtmlAttributesDirective,
368
- IconDirective], imports: [CommonModule], exports: [IconComponent,
369
- IconDirective] });
370
- IconModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconModule, imports: [CommonModule] });
371
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.11", ngImport: i0, type: IconModule, decorators: [{
372
- type: NgModule,
373
- args: [{
374
- declarations: [
375
- IconComponent,
376
- HtmlAttributesDirective,
377
- IconDirective
378
- ],
379
- imports: [
380
- CommonModule,
381
- ],
382
- exports: [
383
- IconComponent,
384
- IconDirective
385
- ],
386
- }]
363
+ class IconModule {
364
+ }
365
+ IconModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
366
+ IconModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: IconModule, declarations: [IconComponent,
367
+ HtmlAttributesDirective,
368
+ IconDirective], imports: [CommonModule], exports: [IconComponent,
369
+ IconDirective] });
370
+ IconModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconModule, imports: [CommonModule] });
371
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: IconModule, decorators: [{
372
+ type: NgModule,
373
+ args: [{
374
+ declarations: [
375
+ IconComponent,
376
+ HtmlAttributesDirective,
377
+ IconDirective
378
+ ],
379
+ imports: [
380
+ CommonModule,
381
+ ],
382
+ exports: [
383
+ IconComponent,
384
+ IconDirective
385
+ ],
386
+ }]
387
387
  }] });
388
388
 
389
- /*
390
- * Public API Surface of @coreui/icons-angular
389
+ /*
390
+ * Public API Surface of @coreui/icons-angular
391
391
  */
392
392
 
393
- /**
394
- * Generated bundle index. Do not edit.
393
+ /**
394
+ * Generated bundle index. Do not edit.
395
395
  */
396
396
 
397
397
  export { IconComponent, IconDirective, IconModule, IconSetModule, IconSetService };