info-library 2.14.55 → 2.14.56

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, SecurityContext, Directive, Inject, Input, Injectable, Pipe, Component, EventEmitter, forwardRef, Output, ViewChild, Renderer2, ElementRef, HostListener, ContentChildren, HostBinding, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+ import { InjectionToken, SecurityContext, Directive, Input, Injectable, Inject, Pipe, Component, EventEmitter, forwardRef, Output, ViewChild, Renderer2, ElementRef, HostListener, ContentChildren, HostBinding, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
3
  import * as i1 from '@angular/platform-browser';
4
4
  import DOMPurify from 'dompurify';
5
5
  import { conformToMask, createTextMaskInputElement } from 'text-mask-core/dist/textMaskCore';
@@ -56,52 +56,17 @@ import { MatChipsModule } from '@angular/material/chips';
56
56
  import { MatRadioModule } from '@angular/material/radio';
57
57
 
58
58
  const DICTIONARIES_CONFIG = new InjectionToken('DICTIONARIES_CONFIG');
59
- const APICONTROLLER_CONFIG = new InjectionToken('APICONTROLLER_CONFIG');
60
- const HTML_SANITIZER_CONFIG = new InjectionToken('HTML_SANITIZER_CONFIG');
59
+ const APICONTROLLER_CONFIG = new InjectionToken('APICONTROLLER_CONFIG');
61
60
 
62
61
  class HtmlSanitizerConfig {
63
62
  constructor() {
64
- //allowedTags: string[] = ['small', 'b', 'strong', 'i', 'em', 'u', 'br', 'p', 'span', 'ul', 'ol', 'li'];
63
+ this.allowedTags = ['small', 'b', 'i', 'a', 'span', 'br'];
65
64
  //allowedAttributes: string[] = [ 'class' ];
66
65
  this.forbiddenTags = ['img', 'iframe', 'script', 'svg', 'object', 'embed', 'video', 'audio', 'source', 'style'];
67
66
  this.forbiddenAttributes = ['src', 'srcset', 'onerror', 'onclick', 'onload'];
68
67
  }
69
68
  }
70
69
 
71
- class InfoSafeHtmlDirective {
72
- constructor(elementRef, sanitizer, config) {
73
- this.elementRef = elementRef;
74
- this.sanitizer = sanitizer;
75
- this.config = config;
76
- this.safeHtml = '';
77
- this.defaultConfig = new HtmlSanitizerConfig();
78
- this.domPurifyConfig = {
79
- FORBID_TAGS: this.config?.forbiddenTags ?? this.defaultConfig.forbiddenTags,
80
- FORBID_ATTR: this.config?.forbiddenAttributes ?? this.defaultConfig.forbiddenAttributes
81
- };
82
- }
83
- ngOnChanges() {
84
- if (!this.safeHtml)
85
- return;
86
- const sanitized = DOMPurify.sanitize(this.safeHtml, this.domPurifyConfig);
87
- const finalHtml = this.sanitizer.sanitize(SecurityContext.HTML, sanitized) || '';
88
- this.elementRef.nativeElement.innerHTML = finalHtml;
89
- }
90
- }
91
- /** @nocollapse */ InfoSafeHtmlDirective.ɵfac = function InfoSafeHtmlDirective_Factory(t) { return new (t || InfoSafeHtmlDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.DomSanitizer), i0.ɵɵdirectiveInject(HTML_SANITIZER_CONFIG)); };
92
- /** @nocollapse */ InfoSafeHtmlDirective.ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: InfoSafeHtmlDirective, selectors: [["", "safeHtml", ""]], inputs: { safeHtml: "safeHtml" }, features: [i0.ɵɵNgOnChangesFeature] });
93
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InfoSafeHtmlDirective, [{
94
- type: Directive,
95
- args: [{
96
- selector: '[safeHtml]'
97
- }]
98
- }], function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: HtmlSanitizerConfig, decorators: [{
99
- type: Inject,
100
- args: [HTML_SANITIZER_CONFIG]
101
- }] }]; }, { safeHtml: [{
102
- type: Input
103
- }] }); })();
104
-
105
70
  class InfoAppConfigModel {
106
71
  constructor() {
107
72
  this.production = false;
@@ -115,6 +80,7 @@ class InfoAppConfigModel {
115
80
  this.enabledPrime = false;
116
81
  this.title = '';
117
82
  this.headers = [];
83
+ this.allowedTags = [];
118
84
  }
119
85
  }
120
86
 
@@ -339,6 +305,38 @@ class InfoNotificationModel {
339
305
  class InfoNotificationItemModel {
340
306
  }
341
307
 
308
+ class InfoSafeHtmlDirective {
309
+ constructor(elementRef, sanitizer, platform) {
310
+ this.elementRef = elementRef;
311
+ this.sanitizer = sanitizer;
312
+ this.platform = platform;
313
+ this.safeHtml = '';
314
+ this.defaultConfig = new HtmlSanitizerConfig();
315
+ this.domPurifyConfig = {
316
+ ALLOWED_TAGS: this.platform.Config.allowedTags,
317
+ FORBID_TAGS: this.defaultConfig.forbiddenTags,
318
+ FORBID_ATTR: this.defaultConfig.forbiddenAttributes
319
+ };
320
+ }
321
+ ngOnChanges() {
322
+ if (!this.safeHtml)
323
+ return;
324
+ const sanitized = DOMPurify.sanitize(this.safeHtml, this.domPurifyConfig);
325
+ const finalHtml = this.sanitizer.sanitize(SecurityContext.HTML, sanitized) || '';
326
+ this.elementRef.nativeElement.innerHTML = finalHtml;
327
+ }
328
+ }
329
+ /** @nocollapse */ InfoSafeHtmlDirective.ɵfac = function InfoSafeHtmlDirective_Factory(t) { return new (t || InfoSafeHtmlDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.DomSanitizer), i0.ɵɵdirectiveInject(InfoPlatformModel)); };
330
+ /** @nocollapse */ InfoSafeHtmlDirective.ɵdir = /** @pureOrBreakMyCode */ i0.ɵɵdefineDirective({ type: InfoSafeHtmlDirective, selectors: [["", "safeHtml", ""]], inputs: { safeHtml: "safeHtml" }, features: [i0.ɵɵNgOnChangesFeature] });
331
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(InfoSafeHtmlDirective, [{
332
+ type: Directive,
333
+ args: [{
334
+ selector: '[safeHtml]'
335
+ }]
336
+ }], function () { return [{ type: i0.ElementRef }, { type: i1.DomSanitizer }, { type: InfoPlatformModel }]; }, { safeHtml: [{
337
+ type: Input
338
+ }] }); })();
339
+
342
340
  var InfoDialogButtons;
343
341
  (function (InfoDialogButtons) {
344
342
  InfoDialogButtons[InfoDialogButtons["Ok"] = 0] = "Ok";
@@ -9247,5 +9245,5 @@ class InfoLibraryModule {
9247
9245
  * Generated bundle index. Do not edit.
9248
9246
  */
9249
9247
 
9250
- export { APICONTROLLER_CONFIG, DICTIONARIES_CONFIG, HTML_SANITIZER_CONFIG, InfoAlertComponent, InfoAppConfigModel, InfoAuthenticationService, InfoAutoCompleteComponent, InfoBigCheckboxComponent, InfoCardComponent, InfoCheckboxComponent, InfoChipsComponent, InfoConfigurationService, InfoDataAccessModel, InfoDataService, InfoDateComponent, InfoDateMonthComponent, InfoDialogButtons, InfoDialogComponent, InfoDialogModal, InfoDialogModel, InfoDialogResult, InfoEditorComponent, InfoFilterComponent, InfoFormPropModel, InfoGridButtonModel, InfoGridComponent, InfoGridModalComponent, InfoInputComponent, InfoInputListComponent, InfoLastSearchModel, InfoLibraryModule, InfoListCheckboxComponent, InfoLoadingComponent, InfoLoginModel, InfoMainComponent, InfoMaskPipe, InfoMenuCardComponent, InfoMessageComponent, InfoMethodGridButtonModel, InfoModalAction, InfoModalComponent, InfoMultiSelectComponent, InfoNotificationItemModel, InfoNotificationModel, InfoPageAction, InfoPagebarButtonModel, InfoPagebarComponent, InfoPaginatorComponent, InfoPermissionModel, InfoPlatformModel, InfoSafeHtmlDirective, InfoSelectComponent, InfoSessionModel, InfoSidebarComponent, InfoThemeService, InfoTimelineComponent, InfoTopMenuComponent, InfoTopbarComponent, InfoTranslatePipe, InfoTranslateService };
9248
+ export { APICONTROLLER_CONFIG, DICTIONARIES_CONFIG, InfoAlertComponent, InfoAppConfigModel, InfoAuthenticationService, InfoAutoCompleteComponent, InfoBigCheckboxComponent, InfoCardComponent, InfoCheckboxComponent, InfoChipsComponent, InfoConfigurationService, InfoDataAccessModel, InfoDataService, InfoDateComponent, InfoDateMonthComponent, InfoDialogButtons, InfoDialogComponent, InfoDialogModal, InfoDialogModel, InfoDialogResult, InfoEditorComponent, InfoFilterComponent, InfoFormPropModel, InfoGridButtonModel, InfoGridComponent, InfoGridModalComponent, InfoInputComponent, InfoInputListComponent, InfoLastSearchModel, InfoLibraryModule, InfoListCheckboxComponent, InfoLoadingComponent, InfoLoginModel, InfoMainComponent, InfoMaskPipe, InfoMenuCardComponent, InfoMessageComponent, InfoMethodGridButtonModel, InfoModalAction, InfoModalComponent, InfoMultiSelectComponent, InfoNotificationItemModel, InfoNotificationModel, InfoPageAction, InfoPagebarButtonModel, InfoPagebarComponent, InfoPaginatorComponent, InfoPermissionModel, InfoPlatformModel, InfoSafeHtmlDirective, InfoSelectComponent, InfoSessionModel, InfoSidebarComponent, InfoThemeService, InfoTimelineComponent, InfoTopMenuComponent, InfoTopbarComponent, InfoTranslatePipe, InfoTranslateService };
9251
9249
  //# sourceMappingURL=info-library.mjs.map