Skip to content

Commit

Permalink
fix(primeng/p-chips): docs and type of property separator
Browse files Browse the repository at this point in the history
  • Loading branch information
volvachev committed May 23, 2023
1 parent 2e57322 commit 36a3c0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/components/chips/chips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/contextmenu/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,15 @@ 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);
event.preventDefault();
});
} 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);
Expand Down
2 changes: 1 addition & 1 deletion src/app/showcase/doc/chips/propsdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import { Component, Input } from '@angular/core';
</tr>
<tr>
<td>separator</td>
<td>string</td>
<td>string | RegExp</td>
<td>null</td>
<td>Separator char to add an item when pressed in addition to the enter key.</td>
</tr>
Expand Down

0 comments on commit 36a3c0e

Please sign in to comment.