From fe9a50d367901bc6b3c21794f5fd189ab69ce2c1 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 8 Feb 2023 14:46:23 +0200 Subject: [PATCH] update ids & remove on push --- .../chevron-button/chevron-button.component.html | 2 +- .../chevron-button/chevron-button.component.ts | 5 +++-- .../circle-button/circle-button.component.html | 3 ++- .../buttons/circle-button/circle-button.component.ts | 11 +++-------- .../buttons/icon-button/icon-button.component.html | 2 +- src/lib/buttons/icon-button/icon-button.component.ts | 12 +++--------- .../confirmation-dialog.component.html | 2 +- .../popup-filter/popup-filter.component.html | 2 +- .../inputs/details-radio/details-radio.component.ts | 3 +-- .../listing/page-header/page-header.component.html | 6 +++--- src/lib/upload-file/upload-file.component.ts | 3 +-- src/lib/utils/functions.ts | 4 ++++ 12 files changed, 24 insertions(+), 31 deletions(-) diff --git a/src/lib/buttons/chevron-button/chevron-button.component.html b/src/lib/buttons/chevron-button/chevron-button.component.html index f70975c..212f433 100644 --- a/src/lib/buttons/chevron-button/chevron-button.component.html +++ b/src/lib/buttons/chevron-button/chevron-button.component.html @@ -1,4 +1,4 @@ - diff --git a/src/lib/buttons/chevron-button/chevron-button.component.ts b/src/lib/buttons/chevron-button/chevron-button.component.ts index c06e345..be2d549 100644 --- a/src/lib/buttons/chevron-button/chevron-button.component.ts +++ b/src/lib/buttons/chevron-button/chevron-button.component.ts @@ -1,14 +1,15 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Component, Input } from '@angular/core'; +import { randomString } from '../../utils'; @Component({ selector: 'iqser-chevron-button [label]', templateUrl: './chevron-button.component.html', styleUrls: ['./chevron-button.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, }) export class ChevronButtonComponent { @Input() label!: string; @Input() showDot = false; @Input() primary = false; @Input() disabled = false; + @Input() buttonId = `${randomString()}-chevron-button`; } diff --git a/src/lib/buttons/circle-button/circle-button.component.html b/src/lib/buttons/circle-button/circle-button.component.html index de0dc40..9bd6478 100644 --- a/src/lib/buttons/circle-button/circle-button.component.html +++ b/src/lib/buttons/circle-button/circle-button.component.html @@ -13,11 +13,12 @@ [class.primary]="type === circleButtonTypes.primary" [class.warn]="type === circleButtonTypes.warn" [disabled]="disabled" - [id]="id ? id : buttonId" + [id]="buttonId" [type]="isSubmit ? 'submit' : 'button'" mat-icon-button > +
diff --git a/src/lib/buttons/circle-button/circle-button.component.ts b/src/lib/buttons/circle-button/circle-button.component.ts index 1fdb07d..9ec9fb8 100644 --- a/src/lib/buttons/circle-button/circle-button.component.ts +++ b/src/lib/buttons/circle-button/circle-button.component.ts @@ -1,18 +1,17 @@ -import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { MatLegacyTooltip as MatTooltip } from '@angular/material/legacy-tooltip'; import { CircleButtonType, CircleButtonTypes } from '../types/circle-button.type'; -import { IqserTooltipPosition, IqserTooltipPositions } from '../../utils'; +import { IqserTooltipPosition, IqserTooltipPositions, randomString } from '../../utils'; @Component({ selector: 'iqser-circle-button [icon]', templateUrl: './circle-button.component.html', styleUrls: ['./circle-button.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, }) export class CircleButtonComponent implements OnInit { readonly circleButtonTypes = CircleButtonTypes; - @Input() id!: string; + @Input() buttonId = `${randomString()}-circle-button`; @Input() icon!: string; @Input() tooltip?: string; @Input() tooltipClass?: string; @@ -32,10 +31,6 @@ export class CircleButtonComponent implements OnInit { constructor(private readonly _elementRef: ElementRef) {} - get buttonId(): string { - return `${Math.random().toString(36).substring(2, 9)}-button`; - } - ngOnInit(): void { (this._elementRef.nativeElement as HTMLElement).style.setProperty('--size', `${this.size}px`); (this._elementRef.nativeElement as HTMLElement).style.setProperty('--iconSize', `${this.iconSize}px`); diff --git a/src/lib/buttons/icon-button/icon-button.component.html b/src/lib/buttons/icon-button/icon-button.component.html index 9510afe..1f79488 100644 --- a/src/lib/buttons/icon-button/icon-button.component.html +++ b/src/lib/buttons/icon-button/icon-button.component.html @@ -1,7 +1,7 @@