diff --git a/src/app/components/breadcrumb/breadcrumb.ts b/src/app/components/breadcrumb/breadcrumb.ts index 52c1235056c..81c2ef72e9a 100755 --- a/src/app/components/breadcrumb/breadcrumb.ts +++ b/src/app/components/breadcrumb/breadcrumb.ts @@ -6,6 +6,7 @@ import { ChevronRightIcon } from 'primeng/icons/chevronright'; import { HomeIcon } from 'primeng/icons/home'; import { TooltipModule } from 'primeng/tooltip'; import { BreadcrumbItemClickEvent } from './breadcrumb.interface'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; /** * Breadcrumb provides contextual information about page hierarchy. * @group Components @@ -41,7 +42,7 @@ import { BreadcrumbItemClickEvent } from './breadcrumb.interface'; {{ home.label }} - + {{ home.label }} - + @@ -101,7 +102,7 @@ import { BreadcrumbItemClickEvent } from './breadcrumb.interface'; {{ item.label }} - + @@ -131,7 +132,7 @@ import { BreadcrumbItemClickEvent } from './breadcrumb.interface'; {{ item.label }} - + @@ -251,7 +252,7 @@ export class Breadcrumb implements AfterContentInit { } @NgModule({ - imports: [CommonModule, RouterModule, TooltipModule, ChevronRightIcon, HomeIcon, SharedModule], + imports: [CommonModule, RouterModule, TooltipModule, ChevronRightIcon, HomeIcon, SharedModule, SafeHtmlPipe], exports: [Breadcrumb, RouterModule, TooltipModule, SharedModule], declarations: [Breadcrumb] }) diff --git a/src/app/components/confirmdialog/confirmdialog.ts b/src/app/components/confirmdialog/confirmdialog.ts index 666aa4f344d..d7fe14a4bf8 100755 --- a/src/app/components/confirmdialog/confirmdialog.ts +++ b/src/app/components/confirmdialog/confirmdialog.ts @@ -34,6 +34,7 @@ import { RippleModule } from 'primeng/ripple'; import { Nullable } from 'primeng/ts-helpers'; import { UniqueComponentId, ZIndexUtils } from 'primeng/utils'; import { Subscription } from 'rxjs'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; const showAnimation = animation([style({ transform: '{{transform}}', opacity: 0 }), animate('{{transition}}', style({ transform: 'none', opacity: 1 }))]); @@ -78,7 +79,7 @@ const hideAnimation = animation([animate('{{transition}}', style({ transform: '{ - + @@ -761,7 +762,7 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy { } @NgModule({ - imports: [CommonModule, ButtonModule, RippleModule, TimesIcon, CheckIcon], + imports: [CommonModule, ButtonModule, RippleModule, TimesIcon, CheckIcon, SafeHtmlPipe], exports: [ConfirmDialog, ButtonModule, SharedModule], declarations: [ConfirmDialog] }) diff --git a/src/app/components/contextmenu/contextmenu.ts b/src/app/components/contextmenu/contextmenu.ts index 616d1205004..082f22c71fa 100755 --- a/src/app/components/contextmenu/contextmenu.ts +++ b/src/app/components/contextmenu/contextmenu.ts @@ -36,6 +36,7 @@ import { RippleModule } from 'primeng/ripple'; import { TooltipModule } from 'primeng/tooltip'; import { Nullable, VoidListener } from 'primeng/ts-helpers'; import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Component({ selector: 'p-contextMenuSub', @@ -116,7 +117,7 @@ import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -159,7 +160,7 @@ import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -1201,7 +1202,7 @@ export class ContextMenu implements OnInit, AfterContentInit, OnDestroy { } @NgModule({ - imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule], + imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, SafeHtmlPipe], exports: [ContextMenu, RouterModule, TooltipModule, SharedModule], declarations: [ContextMenu, ContextMenuSub] }) diff --git a/src/app/components/dom/safeHtmlPipe.ts b/src/app/components/dom/safeHtmlPipe.ts new file mode 100644 index 00000000000..7129fc5ba5d --- /dev/null +++ b/src/app/components/dom/safeHtmlPipe.ts @@ -0,0 +1,26 @@ +import { isPlatformBrowser } from '@angular/common'; +import { + Inject, PLATFORM_ID, + Pipe, + PipeTransform, + SecurityContext +} from '@angular/core'; +import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; + + +@Pipe({ + name: 'safeHtml', + standalone: true +}) +export class SafeHtmlPipe implements PipeTransform { + constructor(@Inject(PLATFORM_ID) private readonly platformId: any, private readonly domSanitizer: DomSanitizer) { } + + public transform(value: string): SafeHtml { + if (!value || !isPlatformBrowser(this.platformId)) { + return value; + } + + const sanitizedValue = this.domSanitizer.sanitize(SecurityContext.HTML ,value); + return this.domSanitizer.bypassSecurityTrustHtml(sanitizedValue); + } +} diff --git a/src/app/components/megamenu/megamenu.ts b/src/app/components/megamenu/megamenu.ts index e15fe600ade..581d83d9667 100755 --- a/src/app/components/megamenu/megamenu.ts +++ b/src/app/components/megamenu/megamenu.ts @@ -34,6 +34,7 @@ import { RippleModule } from 'primeng/ripple'; import { TooltipModule } from 'primeng/tooltip'; import { VoidListener } from 'primeng/ts-helpers'; import { ObjectUtils, UniqueComponentId } from 'primeng/utils'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Component({ selector: 'p-megaMenuSub', @@ -111,7 +112,7 @@ import { ObjectUtils, UniqueComponentId } from 'primeng/utils'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -153,7 +154,7 @@ import { ObjectUtils, UniqueComponentId } from 'primeng/utils'; [attr.tabindex]="-1" > {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -1077,7 +1078,7 @@ export class MegaMenu implements AfterContentInit, OnDestroy, OnInit { } @NgModule({ - imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon], + imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, SafeHtmlPipe], exports: [MegaMenu, RouterModule, TooltipModule, SharedModule], declarations: [MegaMenu, MegaMenuSub] }) diff --git a/src/app/components/menu/menu.ts b/src/app/components/menu/menu.ts index 7897b11eff1..1ae446ef411 100755 --- a/src/app/components/menu/menu.ts +++ b/src/app/components/menu/menu.ts @@ -13,22 +13,17 @@ import { OnDestroy, Output, PLATFORM_ID, - Pipe, - PipeTransform, QueryList, Renderer2, TemplateRef, ViewChild, ViewEncapsulation, - ViewRef, booleanAttribute, computed, - effect, forwardRef, numberAttribute, signal } from '@angular/core'; -import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { RouterModule } from '@angular/router'; import { MenuItem, OverlayService, PrimeNGConfig, PrimeTemplate, SharedModule } from 'primeng/api'; import { ConnectedOverlayScrollHandler, DomHandler } from 'primeng/dom'; @@ -36,21 +31,7 @@ import { RippleModule } from 'primeng/ripple'; import { TooltipModule } from 'primeng/tooltip'; import { Nullable, VoidListener } from 'primeng/ts-helpers'; import { UniqueComponentId, ZIndexUtils } from 'primeng/utils'; - -@Pipe({ - name: 'safeHtml' -}) -export class SafeHtmlPipe implements PipeTransform { - constructor(@Inject(PLATFORM_ID) private readonly platformId: any, private readonly sanitizer: DomSanitizer) {} - - public transform(value: string): SafeHtml { - if (!value || !isPlatformBrowser(this.platformId)) { - return value; - } - - return this.sanitizer.bypassSecurityTrustHtml(value); - } -} +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Component({ selector: '[pMenuItemContent]', @@ -824,6 +805,6 @@ export class Menu implements OnDestroy { @NgModule({ imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule], exports: [Menu, RouterModule, TooltipModule, SharedModule], - declarations: [Menu, MenuItemContent, SafeHtmlPipe] + declarations: [Menu, MenuItemContent] }) export class MenuModule {} diff --git a/src/app/components/menubar/menubar.ts b/src/app/components/menubar/menubar.ts index 2b6983a4ceb..ae55072ccf8 100755 --- a/src/app/components/menubar/menubar.ts +++ b/src/app/components/menubar/menubar.ts @@ -37,6 +37,7 @@ import { VoidListener } from 'primeng/ts-helpers'; import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; import { Subject, Subscription, interval } from 'rxjs'; import { debounce, filter } from 'rxjs/operators'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Injectable() export class MenubarService { @@ -125,7 +126,7 @@ export class MenubarService { {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -165,7 +166,7 @@ export class MenubarService { [attr.tabindex]="-1" > {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -1124,7 +1125,7 @@ export class Menubar implements AfterContentInit, OnDestroy, OnInit { } @NgModule({ - imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, BarsIcon, AngleDownIcon, AngleRightIcon], + imports: [CommonModule, RouterModule, RippleModule, TooltipModule, SharedModule, BarsIcon, AngleDownIcon, AngleRightIcon, SafeHtmlPipe], exports: [Menubar, RouterModule, TooltipModule, SharedModule], declarations: [Menubar, MenubarSub] }) diff --git a/src/app/components/message/message.ts b/src/app/components/message/message.ts index 4f976e39d0f..b3e7259b772 100755 --- a/src/app/components/message/message.ts +++ b/src/app/components/message/message.ts @@ -4,6 +4,7 @@ import { CheckIcon } from 'primeng/icons/check'; import { ExclamationTriangleIcon } from 'primeng/icons/exclamationtriangle'; import { InfoCircleIcon } from 'primeng/icons/infocircle'; import { TimesCircleIcon } from 'primeng/icons/timescircle'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; /** * Message groups a collection of contents in tabs. * @group Components @@ -17,7 +18,7 @@ import { TimesCircleIcon } from 'primeng/icons/timescircle';
- +
{{ text }} @@ -75,7 +76,7 @@ export class UIMessage { } @NgModule({ - imports: [CommonModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon], + imports: [CommonModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon, SafeHtmlPipe], exports: [UIMessage], declarations: [UIMessage] }) diff --git a/src/app/components/messages/messages.ts b/src/app/components/messages/messages.ts index 7241efdeee8..94f0eb067c3 100644 --- a/src/app/components/messages/messages.ts +++ b/src/app/components/messages/messages.ts @@ -27,6 +27,7 @@ import { TimesIcon } from 'primeng/icons/times'; import { TimesCircleIcon } from 'primeng/icons/timescircle'; import { RippleModule } from 'primeng/ripple'; import { Subscription, timer } from 'rxjs'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; /** * Messages is used to display alerts inline. * @group Components @@ -53,8 +54,8 @@ import { Subscription, timer } from 'rxjs';
- - + + {{ msg.summary }} @@ -287,7 +288,7 @@ export class Messages implements AfterContentInit, OnDestroy { } @NgModule({ - imports: [CommonModule, RippleModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon, TimesIcon], + imports: [CommonModule, RippleModule, CheckIcon, InfoCircleIcon, TimesCircleIcon, ExclamationTriangleIcon, TimesIcon, SafeHtmlPipe], exports: [Messages], declarations: [Messages] }) diff --git a/src/app/components/panelmenu/panelmenu.ts b/src/app/components/panelmenu/panelmenu.ts index 91308de1d4e..90c3772d2de 100644 --- a/src/app/components/panelmenu/panelmenu.ts +++ b/src/app/components/panelmenu/panelmenu.ts @@ -33,6 +33,7 @@ import { ChevronDownIcon } from 'primeng/icons/chevrondown'; import { ChevronRightIcon } from 'primeng/icons/chevronright'; import { TooltipModule } from 'primeng/tooltip'; import { ObjectUtils, UniqueComponentId } from 'primeng/utils'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Component({ selector: 'p-panelMenuSub', @@ -89,7 +90,7 @@ import { ObjectUtils, UniqueComponentId } from 'primeng/utils';
{{ getItemProp(processedItem, 'label') }} - + {{ processedItem.badge }} {{ getItemProp(processedItem, 'label') }} - + {{ getItemProp(processedItem, 'badge') }}
@@ -761,7 +762,7 @@ export class PanelMenuList implements OnChanges {
{{ getItemProp(item, 'label') }} - + {{ getItemProp(item, 'badge') }}
@@ -792,7 +793,7 @@ export class PanelMenuList implements OnChanges { {{ getItemProp(item, 'label') }} - + {{ getItemProp(item, 'badge') }} @@ -1110,7 +1111,7 @@ export class PanelMenu implements AfterContentInit { } } @NgModule({ - imports: [CommonModule, RouterModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, ChevronDownIcon, ChevronRightIcon], + imports: [CommonModule, RouterModule, TooltipModule, SharedModule, AngleDownIcon, AngleRightIcon, ChevronDownIcon, ChevronRightIcon, SafeHtmlPipe], exports: [PanelMenu, RouterModule, TooltipModule, SharedModule], declarations: [PanelMenu, PanelMenuSub, PanelMenuList] }) diff --git a/src/app/components/slidemenu/slidemenu.ts b/src/app/components/slidemenu/slidemenu.ts index 0a0a431ea24..3019dee7211 100755 --- a/src/app/components/slidemenu/slidemenu.ts +++ b/src/app/components/slidemenu/slidemenu.ts @@ -36,6 +36,7 @@ import { TooltipModule } from 'primeng/tooltip'; import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; import { Nullable, VoidListener } from 'primeng/ts-helpers'; import { CaretLeftIcon } from 'primeng/icons/caretleft'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Component({ selector: 'p-slideMenuSub', @@ -119,7 +120,7 @@ import { CaretLeftIcon } from 'primeng/icons/caretleft'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -162,7 +163,7 @@ import { CaretLeftIcon } from 'primeng/icons/caretleft'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -1332,7 +1333,7 @@ export class SlideMenu implements OnInit, AfterContentInit, OnDestroy { } @NgModule({ - imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, CaretLeftIcon], + imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, CaretLeftIcon, SafeHtmlPipe], exports: [SlideMenu, RouterModule, TooltipModule, SharedModule], declarations: [SlideMenu, SlideMenuSub] }) diff --git a/src/app/components/steps/steps.ts b/src/app/components/steps/steps.ts index 300360721d5..44082470aea 100755 --- a/src/app/components/steps/steps.ts +++ b/src/app/components/steps/steps.ts @@ -6,6 +6,7 @@ import { Nullable } from 'primeng/ts-helpers'; import { MenuItem } from 'primeng/api'; import { TooltipModule } from 'primeng/tooltip'; import { Subscription } from 'rxjs'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; /** * Steps components is an indicator for the steps in a wizard workflow. * @group Components @@ -52,7 +53,7 @@ import { Subscription } from 'rxjs'; > {{ i + 1 }} {{ item.label }} - + {{ i + 1 }} {{ item.label }} - + @@ -278,7 +279,7 @@ export class Steps implements OnInit, OnDestroy { } @NgModule({ - imports: [CommonModule, RouterModule, TooltipModule], + imports: [CommonModule, RouterModule, TooltipModule, SafeHtmlPipe], exports: [Steps, RouterModule, TooltipModule], declarations: [Steps] }) diff --git a/src/app/components/tabmenu/tabmenu.ts b/src/app/components/tabmenu/tabmenu.ts index d05e475accb..1d5a3255e4d 100644 --- a/src/app/components/tabmenu/tabmenu.ts +++ b/src/app/components/tabmenu/tabmenu.ts @@ -34,6 +34,7 @@ import { TooltipModule } from 'primeng/tooltip'; import { Nullable } from 'primeng/ts-helpers'; import { ObjectUtils } from 'primeng/utils'; import { filter } from 'rxjs/operators'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; /** * TabMenu is a navigation component that displays items as tab headers. @@ -81,7 +82,7 @@ import { filter } from 'rxjs/operators'; {{ getItemProp(item, 'label') }} - + {{ getItemProp(item, 'badge') }} @@ -110,7 +111,7 @@ import { filter } from 'rxjs/operators'; {{ getItemProp(item, 'label') }} - + {{ getItemProp(item, 'badge') }} @@ -523,7 +524,7 @@ export class TabMenu implements AfterContentInit, AfterViewInit, AfterViewChecke } @NgModule({ - imports: [CommonModule, RouterModule, SharedModule, RippleModule, TooltipModule, ChevronLeftIcon, ChevronRightIcon], + imports: [CommonModule, RouterModule, SharedModule, RippleModule, TooltipModule, ChevronLeftIcon, ChevronRightIcon, SafeHtmlPipe], exports: [TabMenu, RouterModule, SharedModule, TooltipModule], declarations: [TabMenu] }) diff --git a/src/app/components/tieredmenu/tieredmenu.ts b/src/app/components/tieredmenu/tieredmenu.ts index ebd0f947a6b..9003d4e3bbb 100755 --- a/src/app/components/tieredmenu/tieredmenu.ts +++ b/src/app/components/tieredmenu/tieredmenu.ts @@ -27,7 +27,7 @@ import { input, numberAttribute, signal -} from '@angular/core'; + } from '@angular/core'; import { RouterModule } from '@angular/router'; import { MenuItem, OverlayService, PrimeNGConfig, PrimeTemplate, SharedModule } from 'primeng/api'; import { ConnectedOverlayScrollHandler, DomHandler } from 'primeng/dom'; @@ -36,6 +36,7 @@ import { RippleModule } from 'primeng/ripple'; import { TooltipModule } from 'primeng/tooltip'; import { Nullable, VoidListener } from 'primeng/ts-helpers'; import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; +import { SafeHtmlPipe } from '../dom/safeHtmlPipe'; @Component({ selector: 'p-tieredMenuSub', @@ -110,7 +111,7 @@ import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -152,7 +153,7 @@ import { ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primeng/utils'; {{ getItemLabel(processedItem) }} - + {{ getItemProp(processedItem, 'badge') }} @@ -1190,7 +1191,7 @@ export class TieredMenu implements OnInit, AfterContentInit, OnDestroy { } @NgModule({ - imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule], + imports: [CommonModule, RouterModule, RippleModule, TooltipModule, AngleRightIcon, SharedModule, SafeHtmlPipe], exports: [TieredMenu, RouterModule, TooltipModule, SharedModule], declarations: [TieredMenu, TieredMenuSub] }) diff --git a/src/app/showcase/pages/treetable/treetabledemo.module.ts b/src/app/showcase/pages/treetable/treetabledemo.module.ts index f79fa79a3d4..f316cbef483 100755 --- a/src/app/showcase/pages/treetable/treetabledemo.module.ts +++ b/src/app/showcase/pages/treetable/treetabledemo.module.ts @@ -1,6 +1,5 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; -import { SortSingleColumnDoc } from '@doc/treetable/sortsinglecolumndoc'; import { TreeTableDocModule } from '@doc/treetable/treetabledoc.module'; import { TreeTableDemo } from './treetabledemo'; import { TreeTableDemoRoutingModule } from './treetabledemo-routing.module';