From 36a3c0ee86002247b564fdc03b41284cc78c77e5 Mon Sep 17 00:00:00 2001 From: Egor Volvachev Date: Sun, 19 Feb 2023 17:30:42 +0300 Subject: [PATCH] fix(primeng/p-chips): docs and type of property `separator` Fixes #12640. --- src/app/components/chips/chips.ts | 4 ++-- src/app/components/contextmenu/contextmenu.ts | 4 ++-- src/app/showcase/doc/chips/propsdoc.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/components/chips/chips.ts b/src/app/components/chips/chips.ts index 14b8e68f0cf..1531a61574c 100755 --- a/src/app/components/chips/chips.ts +++ b/src/app/components/chips/chips.ts @@ -142,7 +142,7 @@ export class Chips implements AfterContentInit, ControlValueAccessor { * Separator char to add an item when pressed in addition to the enter key. * @group Props */ - @Input() separator: string | undefined; + @Input() separator: string | RegExp | undefined; /** * When enabled, a clear icon is displayed to clear the value. * @group Props @@ -243,7 +243,7 @@ export class Chips implements AfterContentInit, ControlValueAccessor { onPaste(event: any) { if (!this.disabled) { if (this.separator) { - let pastedData = (event.clipboardData || (this.document.defaultView as any)['clipboardData']).getData('Text'); + const pastedData: string = (event.clipboardData || (this.document.defaultView as any)['clipboardData']).getData('Text'); pastedData.split(this.separator).forEach((val: any) => { this.addItem(event, val, true); }); diff --git a/src/app/components/contextmenu/contextmenu.ts b/src/app/components/contextmenu/contextmenu.ts index 5798d21c76a..bcf36634f97 100755 --- a/src/app/components/contextmenu/contextmenu.ts +++ b/src/app/components/contextmenu/contextmenu.ts @@ -342,7 +342,7 @@ export class ContextMenu implements AfterViewInit, OnDestroy { if (this.global) { const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document'; this.triggerEventListener = this.renderer.listen(documentTarget, this.triggerEvent, (event) => { - if(this.containerViewChild && this.containerViewChild.nativeElement.style.display !== 'none') { + if (this.containerViewChild && this.containerViewChild.nativeElement.style.display !== 'none') { this.hide(); } this.show(event); @@ -350,7 +350,7 @@ export class ContextMenu implements AfterViewInit, OnDestroy { }); } else if (this.target) { this.triggerEventListener = this.renderer.listen(this.target, this.triggerEvent, (event) => { - if(this.containerViewChild && this.containerViewChild.nativeElement.style.display !== 'none') { + if (this.containerViewChild && this.containerViewChild.nativeElement.style.display !== 'none') { this.hide(); } this.show(event); diff --git a/src/app/showcase/doc/chips/propsdoc.ts b/src/app/showcase/doc/chips/propsdoc.ts index 480a3576d8f..1a32ad8a807 100644 --- a/src/app/showcase/doc/chips/propsdoc.ts +++ b/src/app/showcase/doc/chips/propsdoc.ts @@ -103,7 +103,7 @@ import { Component, Input } from '@angular/core'; separator - string + string | RegExp null Separator char to add an item when pressed in addition to the enter key.