- {{ timeValue }}h
+ {{ timeValue }}h
{{ dateValue }}
diff --git a/libs/ui/src/lib/ui/chip/chip-time/chip-time.component.ts b/libs/ui/src/lib/ui/chip/chip-time/chip-time.component.ts
index 14b44c4..21ad0b3 100644
--- a/libs/ui/src/lib/ui/chip/chip-time/chip-time.component.ts
+++ b/libs/ui/src/lib/ui/chip/chip-time/chip-time.component.ts
@@ -1,10 +1,9 @@
-import {
- ChangeDetectionStrategy,
- Component,
- EventEmitter,
- HostBinding,
- Input,
- Output,
+import {
+ ChangeDetectionStrategy,
+ Component,
+ HostBinding,
+ input,
+ output
} from '@angular/core';
import { ComponentFamilyClass } from '../../../styles';
import { DateTime } from 'luxon';
@@ -22,44 +21,45 @@ import { MatIcon } from '@angular/material/icon';
})
export class PiChipTimeComponent extends PiBaseChipComponent {
@HostBinding('class') get dateClasses(): string {
- const colorClass = this.color && `pi-color__${this.color}`;
- const isActiveClass = this.isActive ? 'is-active' : '';
- const affixClass = this.time && this.date ? 'has-affix' : '';
+ const color = this.color();
+ const colorClass = color && `pi-color__${color}`;
+ const isActiveClass = this.isActive() ? 'is-active' : '';
+ const affixClass = this.time() && this.date() ? 'has-affix' : '';
return ['pi-chip-time', ComponentFamilyClass.Chip, colorClass, isActiveClass, affixClass].join(
' '
);
}
- @Output() execute: EventEmitter = new EventEmitter();
+ readonly execute = output();
// Content
- @Input() date!: string; // ISO format in UTC time zone
- @Input() time!: string; // ISO format in UTC time zone
- @Input() timezone: string = 'utc';
+ readonly date = input.required(); // ISO format in UTC time zone
+ readonly time = input.required(); // ISO format in UTC time zone
+ readonly timezone = input('utc');
// Skin
- @Input() override color: chipThemingColor = 'primary';
+ override readonly color = input('primary');
/**
* On the chip time cases, we override the affix position property because
it will be always used by the thime input and will be always previous
*/
- @Input() override affixPosition: 'previous' = 'previous';
+ override readonly affixPosition = input<'previous'>('previous');
// time - available in S and M
// time + date - available in S
- @Input() override size: 'small' | 'medium' = 'small';
+ override readonly size = input<'small' | 'medium'>('small');
// Status
- @Input() isActive!: boolean;
+ readonly isActive = input.required();
get dateObj(): DateTime {
- return DateTime.fromISO(this.date, { zone: 'utc' });
+ return DateTime.fromISO(this.date(), { zone: 'utc' });
}
get timeValue(): string {
- return this.dateObj.setZone(this.timezone).toFormat('H:mm');
+ return this.dateObj.setZone(this.timezone()).toFormat('H:mm');
}
get dateValue(): string {
diff --git a/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.html b/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.html
index 95e6164..d3b068f 100644
--- a/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.html
+++ b/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.html
@@ -5,7 +5,7 @@
diff --git a/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.ts b/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.ts
index 8fdc4bb..013de28 100644
--- a/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.ts
+++ b/libs/ui/src/lib/ui/chip/chip-value/chip-value.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, HostBinding, Input, input } from '@angular/core';
import { PiBaseChipComponent } from '../base-chip.component';
import { unit } from '../../../util/models';
import { NgIf } from '@angular/common';
@@ -14,10 +14,12 @@ export class PiChipValueComponent extends PiBaseChipComponent {
@HostBinding('class') get valueClasses(): string {
const colorClass = this.value > 0 ? 'pi-color__success' : 'pi-color__warn';
const hasLabelClass = !!this.label ? 'has-label' : '';
+ const unitPosition = this.unitPosition();
const unitPositionClass =
- this.unitPosition && `pi-chip-value__unit-position--${this.unitPosition}`;
+ unitPosition && `pi-chip-value__unit-position--${unitPosition}`;
+ const affixPosition = this.affixPosition();
const affixPositionClass =
- this.affixPosition && `pi-chip__affix-position--${this.affixPosition}`;
+ affixPosition && `pi-chip__affix-position--${affixPosition}`;
return ['pi-chip-value', colorClass, hasLabelClass, unitPositionClass, affixPositionClass].join(
' '
);
@@ -25,11 +27,11 @@ export class PiChipValueComponent extends PiBaseChipComponent {
// Content
@Input() override value!: number;
- @Input() unit!: unit | string;
+ readonly unit = input.required
();
// Skin
- @Input() override size: 'medium' | 'large' = 'large';
+ override readonly size = input<'medium' | 'large'>('large');
// Unit
- @Input() unitPosition: 'previous' | 'after' = 'after';
+ readonly unitPosition = input<'previous' | 'after'>('after');
}
diff --git a/libs/ui/src/lib/ui/chip/chip/chip.component.html b/libs/ui/src/lib/ui/chip/chip/chip.component.html
index 140087a..6cefbb6 100644
--- a/libs/ui/src/lib/ui/chip/chip/chip.component.html
+++ b/libs/ui/src/lib/ui/chip/chip/chip.component.html
@@ -4,7 +4,7 @@
@@ -12,7 +12,7 @@
diff --git a/libs/ui/src/lib/ui/chip/chip/chip.component.ts b/libs/ui/src/lib/ui/chip/chip/chip.component.ts
index 5564f73..47ca9f1 100644
--- a/libs/ui/src/lib/ui/chip/chip/chip.component.ts
+++ b/libs/ui/src/lib/ui/chip/chip/chip.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, HostBinding, input } from '@angular/core';
import { theming } from '../../../styles';
import { PiBaseChipComponent } from '../base-chip.component';
import { NgIf } from '@angular/common';
@@ -13,18 +13,21 @@ import { MatIcon } from '@angular/material/icon';
})
export class PiChipComponent extends PiBaseChipComponent {
@HostBinding('class') get chipClasses(): string {
- const appearanceClass = this.appearance && `pi-chip__appearance--${this.appearance}`;
- const iconTypeClass = this.iconType && `pi-chip__icon-type--${this.iconType}`;
+ const appearance = this.appearance();
+ const appearanceClass = appearance && `pi-chip__appearance--${appearance}`;
+ const iconType = this.iconType();
+ const iconTypeClass = iconType && `pi-chip__icon-type--${iconType}`;
const hasLabelClass = !this.label ? 'pi-chip__single-icon' : '';
+ const affixPosition = this.affixPosition();
const affixPositionClass =
- this.affixPosition && `pi-chip__affix-position--${this.affixPosition}`;
+ affixPosition && `pi-chip__affix-position--${affixPosition}`;
return [appearanceClass, iconTypeClass, hasLabelClass, affixPositionClass].join(' ');
}
// Content
- @Input() iconType: 'custom' | 'default' = 'default';
+ readonly iconType = input<'custom' | 'default'>('default');
// Skin
- @Input() appearance: 'outline' | 'fill' = 'outline';
- @Input() override color: theming = 'primary';
+ readonly appearance = input<'outline' | 'fill'>('outline');
+ override readonly color = input('primary');
}
diff --git a/libs/ui/src/lib/ui/chip/tile/tile.component.html b/libs/ui/src/lib/ui/chip/tile/tile.component.html
index 45edaf0..68f9e29 100644
--- a/libs/ui/src/lib/ui/chip/tile/tile.component.html
+++ b/libs/ui/src/lib/ui/chip/tile/tile.component.html
@@ -1,6 +1,6 @@
-
+
{{ value }}
@@ -8,4 +8,4 @@
{{ value }}
-
+
diff --git a/libs/ui/src/lib/ui/chip/tile/tile.component.ts b/libs/ui/src/lib/ui/chip/tile/tile.component.ts
index 9e5662f..8619454 100644
--- a/libs/ui/src/lib/ui/chip/tile/tile.component.ts
+++ b/libs/ui/src/lib/ui/chip/tile/tile.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, HostBinding, Input, input } from '@angular/core';
import { ComponentFamilyClass, theming } from '../../../styles';
import { NgIf } from '@angular/common';
import { MatIcon } from '@angular/material/icon';
@@ -12,21 +12,23 @@ import { MatIcon } from '@angular/material/icon';
})
export class PiTileComponent {
@HostBinding('class') get classes(): string {
- const colorClass = this.color && `pi-color__${this.color}`;
+ const color = this.color();
+ const colorClass = color && `pi-color__${color}`;
const hasIconClass = !this.icon ? 'has-value' : '';
const hasIconAndValueClass = this.icon && this.value ? 'has-icon-and-value' : '';
- const flexDirection = this.flexDirection && `pi-tile__flex-direction--${this.flexDirection}`;
+ const flexDirectionValue = this.flexDirection();
+ const flexDirection = flexDirectionValue && `pi-tile__flex-direction--${flexDirectionValue}`;
return ['pi-tile', ComponentFamilyClass.Text, colorClass, flexDirection, hasIconClass].join(
' '
);
}
// Content
- @Input() label: string | undefined;
+ readonly label = input
();
@Input() value: string | undefined;
@Input() icon: string | undefined;
// Skin
- @Input() color: theming = 'primary';
- @Input() flexDirection: 'row' | 'column' = 'column';
+ readonly color = input('primary');
+ readonly flexDirection = input<'row' | 'column'>('column');
}
diff --git a/libs/ui/src/lib/ui/data-grid/data-grid/data-grid.component.html b/libs/ui/src/lib/ui/data-grid/data-grid/data-grid.component.html
index e21aab1..e393e08 100644
--- a/libs/ui/src/lib/ui/data-grid/data-grid/data-grid.component.html
+++ b/libs/ui/src/lib/ui/data-grid/data-grid/data-grid.component.html
@@ -1,7 +1,7 @@
-
+
@@ -9,25 +9,25 @@
Data Direction:
COLUMN
-->
-
+
-
+
@@ -44,31 +44,31 @@
-
@@ -21,16 +21,16 @@
{{ 'common.max' | translate }}
-
+
{{ text | translate }}
diff --git a/libs/ui/src/lib/ui/form-field/incremental-range-field/incremental-range-field.component.ts b/libs/ui/src/lib/ui/form-field/incremental-range-field/incremental-range-field.component.ts
index d878935..5e3ef9b 100644
--- a/libs/ui/src/lib/ui/form-field/incremental-range-field/incremental-range-field.component.ts
+++ b/libs/ui/src/lib/ui/form-field/incremental-range-field/incremental-range-field.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, HostBinding, input } from '@angular/core';
import { FormGroup, FormGroupDirective, ReactiveFormsModule } from '@angular/forms';
import { unit } from '../../../util/models';
import { PiLabelDirective } from '../directives/label.directive';
@@ -29,18 +29,18 @@ export class PiIncrementalRangeFieldComponent {
@HostBinding('class') className =
'pi-field pi-form-field__incremental pi-form-field__incremental--range';
- @Input() formGroupName!: string;
- @Input() minValue!: number;
- @Input() maxValue!: number;
- @Input() unit!: unit;
- @Input() step!: number;
- @Input() showError = false;
- @Input() showIncrementButtons: boolean = true;
- @Input() placeholder: string | undefined;
+ readonly formGroupName = input.required();
+ readonly minValue = input.required();
+ readonly maxValue = input.required();
+ readonly unit = input.required();
+ readonly step = input.required();
+ readonly showError = input(false);
+ readonly showIncrementButtons = input(true);
+ readonly placeholder = input();
constructor(private rootFormGroup: FormGroupDirective) {}
get form() {
- return this.rootFormGroup.control.get(this.formGroupName) as FormGroup;
+ return this.rootFormGroup.control.get(this.formGroupName()) as FormGroup;
}
}
diff --git a/libs/ui/src/lib/ui/form-field/number-field/number-field.component.html b/libs/ui/src/lib/ui/form-field/number-field/number-field.component.html
index 98774c2..0c24415 100644
--- a/libs/ui/src/lib/ui/form-field/number-field/number-field.component.html
+++ b/libs/ui/src/lib/ui/form-field/number-field/number-field.component.html
@@ -1,4 +1,4 @@
-
+
@@ -11,11 +11,11 @@
diff --git a/libs/ui/src/lib/ui/form-field/password-field/password-field.component.html b/libs/ui/src/lib/ui/form-field/password-field/password-field.component.html
index 859dd6a..42eca03 100644
--- a/libs/ui/src/lib/ui/form-field/password-field/password-field.component.html
+++ b/libs/ui/src/lib/ui/form-field/password-field/password-field.component.html
@@ -1,4 +1,4 @@
-
+
@@ -14,12 +14,12 @@
diff --git a/libs/ui/src/lib/ui/form-field/phone-field/phone-field.component.html b/libs/ui/src/lib/ui/form-field/phone-field/phone-field.component.html
index 770b518..be6ee6a 100644
--- a/libs/ui/src/lib/ui/form-field/phone-field/phone-field.component.html
+++ b/libs/ui/src/lib/ui/form-field/phone-field/phone-field.component.html
@@ -1,4 +1,4 @@
-
+
@@ -7,11 +7,11 @@
diff --git a/libs/ui/src/lib/ui/form-field/search-field/search-field.component.html b/libs/ui/src/lib/ui/form-field/search-field/search-field.component.html
index 091cc21..263aa34 100644
--- a/libs/ui/src/lib/ui/form-field/search-field/search-field.component.html
+++ b/libs/ui/src/lib/ui/form-field/search-field/search-field.component.html
@@ -10,12 +10,12 @@
(focus)="onFocus()"
(blur)="onBlur()"
[formControl]="control"
- [placeholder]="placeholder"
+ [placeholder]="placeholder()"
type="search"
/>
= new EventEmitter();
+ readonly searchClick = output();
- @Output() resetClick: EventEmitter = new EventEmitter();
+ readonly resetClick = output();
- @ViewChild('input', { read: ElementRef, static: true })
- inputRef!: ElementRef;
+ readonly inputRef = viewChild.required('input', { read: ElementRef });
- @Input() isClosable = true;
+ readonly isClosable = input(true);
private _isExpanded = false;
@Input()
@@ -59,7 +58,7 @@ export class PiSearchFieldComponent extends PiBaseFormFieldComponent implements
}
ngOnInit(): void {
- this.isExpanded = !!this.control.value || !this.isClosable;
+ this.isExpanded = !!this.control.value || !this.isClosable();
this.control.valueChanges.subscribe((value: any) => {
if (value) {
this.isExpanded = true;
@@ -69,11 +68,11 @@ export class PiSearchFieldComponent extends PiBaseFormFieldComponent implements
openField(): void {
this.isExpanded = true;
- this.inputRef.nativeElement.focus();
+ this.inputRef().nativeElement.focus();
}
closeField(): void {
- if (this.isClosable) {
+ if (this.isClosable()) {
this.isExpanded = false;
}
if (this.control.value) {
diff --git a/libs/ui/src/lib/ui/form-field/slide-toggle/slide-toggle.component.html b/libs/ui/src/lib/ui/form-field/slide-toggle/slide-toggle.component.html
index 5927625..20e0fde 100644
--- a/libs/ui/src/lib/ui/form-field/slide-toggle/slide-toggle.component.html
+++ b/libs/ui/src/lib/ui/form-field/slide-toggle/slide-toggle.component.html
@@ -1,4 +1,4 @@
-
6 && totalPages - firstPages[firstPages.length - 1] > 6"
+ *ngIf="totalPages() > 6 && totalPages() - firstPages[firstPages.length - 1] > 6"
(click)="movePages()"
icon="more"
>
diff --git a/libs/ui/src/lib/ui/paginator/paginator/paginator.component.ts b/libs/ui/src/lib/ui/paginator/paginator/paginator.component.ts
index cad8947..9f41a3a 100644
--- a/libs/ui/src/lib/ui/paginator/paginator/paginator.component.ts
+++ b/libs/ui/src/lib/ui/paginator/paginator/paginator.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, EventEmitter, Component, Output, Input, OnInit, HostBinding, forwardRef } from '@angular/core';
+import { ChangeDetectionStrategy, Component, Input, OnInit, HostBinding, forwardRef, input, output } from '@angular/core';
import { PiIconButtonComponent } from '../../button/icon-button/icon-button.component';
import { NgIf, NgFor } from '@angular/common';
import { PiIconComponent } from '../../icon/icon/icon.component';
@@ -20,11 +20,11 @@ import { PiIconComponent } from '../../icon/icon/icon.component';
export class PiPaginatorComponent implements OnInit {
@HostBinding('class') className = 'pi-paginator';
@Input() currentPage = 1;
- @Input() pageSize!: number;
- @Input() totalPages!: number;
- @Input() isDisabled!: boolean;
+ readonly pageSize = input.required();
+ readonly totalPages = input.required();
+ readonly isDisabled = input.required();
- @Output() changePage = new EventEmitter();
+ readonly changePage = output();
firstPages!: number[];
@@ -35,7 +35,7 @@ export class PiPaginatorComponent implements OnInit {
}
get pages() {
- return [...new Array(this.totalPages).keys()].map((el) => el + 1);
+ return [...new Array(this.totalPages()).keys()].map((el) => el + 1);
}
// get firstPages() {
@@ -51,11 +51,11 @@ export class PiPaginatorComponent implements OnInit {
// keys(o: object): string[];
get lastPages() {
- return [...new Array(this.totalPages).keys()].slice(-3).map((el) => el + 1);
+ return [...new Array(this.totalPages()).keys()].slice(-3).map((el) => el + 1);
}
protected initFirstPages(): void {
- this.firstPages = [...new Array(this.totalPages).slice(0, 3).keys()].map((el) => el + 1);
+ this.firstPages = [...new Array(this.totalPages()).slice(0, 3).keys()].map((el) => el + 1);
}
protected paginateBack(): void {
@@ -71,7 +71,7 @@ export class PiPaginatorComponent implements OnInit {
}
protected paginateNext(): void {
- if (this.currentPage < this.totalPages) {
+ if (this.currentPage < this.totalPages()) {
const updatedCurrentPage = this.currentPage + 1;
if (this.firstPages.indexOf(this.currentPage) >= 2) {
this.firstPagesRange = this.firstPagesRange + 3;
@@ -83,7 +83,7 @@ export class PiPaginatorComponent implements OnInit {
}
protected paginateTo(selectedPage: number): void {
- if (this.isDisabled && selectedPage > this.currentPage) {
+ if (this.isDisabled() && selectedPage > this.currentPage) {
return;
} else {
this.currentPage = selectedPage;
@@ -98,7 +98,7 @@ export class PiPaginatorComponent implements OnInit {
}
protected movePages(): void {
- if (!this.isDisabled) {
+ if (!this.isDisabled()) {
this.firstPagesRange = this.firstPagesRange + 3;
this.firstPages = this.incrementPaginatorRangeBy(3);
this.currentPage = this.firstPages[0];
@@ -107,13 +107,13 @@ export class PiPaginatorComponent implements OnInit {
}
private incrementPaginatorRangeBy(range: number): Array {
- return [...new Array(this.totalPages).keys()]
+ return [...new Array(this.totalPages()).keys()]
.slice(this.firstPagesRange, this.firstPagesRange + range)
.map((el) => el + 1);
}
private decrementPaginatorRangeBy(range: number): Array {
- return [...new Array(this.totalPages).keys()]
+ return [...new Array(this.totalPages()).keys()]
.slice(this.firstPagesRange - range, this.firstPagesRange)
.map((el) => el + 1);
}
diff --git a/libs/ui/src/lib/ui/panel/base-panel.component.ts b/libs/ui/src/lib/ui/panel/base-panel.component.ts
index 0a36a58..2a5b74c 100644
--- a/libs/ui/src/lib/ui/panel/base-panel.component.ts
+++ b/libs/ui/src/lib/ui/panel/base-panel.component.ts
@@ -1,5 +1,5 @@
// Angular
-import { Directive, Input, OnInit } from '@angular/core';
+import { Directive, OnInit, input } from '@angular/core';
import {
alignment,
borderRadius,
@@ -14,25 +14,25 @@ import { status } from '../../util/status';
@Directive()
export abstract class PiBasePanelComponent implements OnInit {
- @Input() alignment: alignment = 'center';
- @Input() borderRadius: borderRadius = 'large';
- @Input() color: styleType = 'white';
- @Input() flexDirection: flexDirection = 'column';
- @Input() isStroked = false;
- @Input() hasShadow = false;
- @Input() justify: justify = 'center';
- @Input() width: 'quarter' | 'third' | 'half' | 'fifth' | 'sixth' | 'two-thirds' | undefined;
+ readonly alignment = input('center');
+ readonly borderRadius = input('large');
+ readonly color = input('white');
+ readonly flexDirection = input('column');
+ readonly isStroked = input(false);
+ readonly hasShadow = input(false);
+ readonly justify = input('center');
+ readonly width = input<'quarter' | 'third' | 'half' | 'fifth' | 'sixth' | 'two-thirds'>();
// TODO: remove on the advisor dashboard refactor
- @Input() height!: 'small' | 'medium' | 'large' | 'x-large' | undefined;
- @Input() outline!: styleType;
- @Input() padding: padding = 'l';
- @Input() grid: 'half' | 'quarter' | 'reverse-quarter';
- @Input() gap: gap = 'l';
- @Input() mode: 'dark' | 'light' = 'dark';
- @Input() innerPadding!: padding;
- @Input() opacity: opacity;
+ readonly height = input.required<'small' | 'medium' | 'large' | 'x-large' | undefined>();
+ readonly outline = input.required();
+ readonly padding = input('l');
+ readonly grid = input<'half' | 'quarter' | 'reverse-quarter'>();
+ readonly gap = input('l');
+ readonly mode = input<'dark' | 'light'>('dark');
+ readonly innerPadding = input.required();
+ readonly opacity = input();
- @Input() status!: status | '';
+ readonly status = input.required();
ngOnInit(): void {
this.alignmentClass;
@@ -51,72 +51,86 @@ export abstract class PiBasePanelComponent implements OnInit {
}
protected get widthClass(): string | undefined {
- return this.width && `pi-panel__width--${this.width}`;
+ const width = this.width();
+ return width && `pi-panel__width--${width}`;
}
protected get alignmentClass(): string {
- return this.alignment && `pi-panel__align--${this.alignment}`;
+ const alignmentValue = this.alignment();
+ return alignmentValue && `pi-panel__align--${alignmentValue}`;
}
protected get justifyClass(): string {
- return this.justify && `pi-panel__justify--${this.justify}`;
+ const justifyValue = this.justify();
+ return justifyValue && `pi-panel__justify--${justifyValue}`;
}
protected get flexDirectionClass(): string {
- return this.flexDirection && `pi-panel__flex-direction--${this.flexDirection}`;
+ const flexDirectionValue = this.flexDirection();
+ return flexDirectionValue && `pi-panel__flex-direction--${flexDirectionValue}`;
}
protected get borderRadiusClass(): string {
- return this.borderRadius && `pi-panel__border-radius--${this.borderRadius}`;
+ const borderRadiusValue = this.borderRadius();
+ return borderRadiusValue && `pi-panel__border-radius--${borderRadiusValue}`;
}
protected get colorClass(): string {
- return `pi-color__${this.color}`;
+ return `pi-color__${this.color()}`;
}
protected get hasShadowClass(): string | boolean {
- return this.hasShadow && 'has-shadow';
+ return this.hasShadow() && 'has-shadow';
}
protected get heightClass(): string | undefined {
- return this.height && `pi-panel__height--${this.height}`;
+ const height = this.height();
+ return height && `pi-panel__height--${height}`;
}
protected get outlineClass(): string {
- return this.outline && `is-stroked pi-panel__border-color--${this.outline}`;
+ const outline = this.outline();
+ return outline && `is-stroked pi-panel__border-color--${outline}`;
}
protected get paddingClass(): string {
- return this.padding ? `pi-panel__padding--${this.padding}` : '';
+ const paddingValue = this.padding();
+ return paddingValue ? `pi-panel__padding--${paddingValue}` : '';
}
protected get gridClass(): string {
- return this.grid && `pi-panel__grid--${this.grid}`;
+ const grid = this.grid();
+ return grid && `pi-panel__grid--${grid}`;
}
protected get isStrokedClass(): string {
- return this.isStroked ? 'is-stroked' : '';
+ return this.isStroked() ? 'is-stroked' : '';
}
protected get gapClass(): string {
- return this.gap && `pi-panel__gap--${this.gap}`;
+ const gapValue = this.gap();
+ return gapValue && `pi-panel__gap--${gapValue}`;
}
protected get statusClass(): string {
- return this.status && `is-${this.status}`;
+ const statusValue = this.status();
+ return statusValue && `is-${statusValue}`;
}
protected get modeClass(): string {
- return this.mode && `pi-color__mode--${this.mode}`;
+ const mode = this.mode();
+ return mode && `pi-color__mode--${mode}`;
}
protected get innerPaddingClass(): string {
- return this.innerPadding
- ? `pi-panel__inner-padding pi-panel__inner-padding--${this.innerPadding}`
+ const innerPadding = this.innerPadding();
+ return innerPadding
+ ? `pi-panel__inner-padding pi-panel__inner-padding--${innerPadding}`
: '';
}
protected get opacityClass(): string {
- return this.opacity ? `pi-color__opacity--${this.opacity}` : '';
+ const opacityValue = this.opacity();
+ return opacityValue ? `pi-color__opacity--${opacityValue}` : '';
}
}
diff --git a/libs/ui/src/lib/ui/panel/expansion-panel/expansion-panel.component.html b/libs/ui/src/lib/ui/panel/expansion-panel/expansion-panel.component.html
index 6f0f321..fcfb5e8 100644
--- a/libs/ui/src/lib/ui/panel/expansion-panel/expansion-panel.component.html
+++ b/libs/ui/src/lib/ui/panel/expansion-panel/expansion-panel.component.html
@@ -1,9 +1,9 @@
-
-
- {{ value }}{{ value() }}%
- {{ label }}
+ {{ label() }}
diff --git a/libs/ui/src/lib/ui/progress/progress-spinner/progress-spinner.component.ts b/libs/ui/src/lib/ui/progress/progress-spinner/progress-spinner.component.ts
index ce698d0..2265d33 100644
--- a/libs/ui/src/lib/ui/progress/progress-spinner/progress-spinner.component.ts
+++ b/libs/ui/src/lib/ui/progress/progress-spinner/progress-spinner.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, HostBinding, Input } from '@angular/core';
+import { ChangeDetectionStrategy, Component, HostBinding, input } from '@angular/core';
import { MatProgressSpinner } from '@angular/material/progress-spinner';
import { NgIf } from '@angular/common';
import { PiProgressBarComponent } from '../progress-bar/progress-bar.component';
@@ -18,13 +18,17 @@ export class PiProgressSpinnerComponent {
className = 'pi-spinner pi-spinner__progress';
@HostBinding('class') get classes(): string {
+ const appearance = this.appearance();
const appearanceClass =
- this.appearance !== 'default' && `pi-spinner__appearance--${this.appearance}`;
- const strokeWidthClass = this.strokeWidth && `pi-spinner__stroke--${this.strokeWidth}`;
+ appearance !== 'default' && `pi-spinner__appearance--${appearance}`;
+ const strokeWidth = this.strokeWidth();
+ const strokeWidthClass = strokeWidth && `pi-spinner__stroke--${strokeWidth}`;
+ const diameter = this.diameter();
const smallDiameterClass =
- this.diameter === 60 || (this.diameter === 70 && 'pi-spinner__diameter--small');
+ diameter === 60 || (diameter === 70 && 'pi-spinner__diameter--small');
+ const diameterValue = this.diameter();
const largeDiameterClass =
- this.diameter === 110 || (this.diameter === 130 && 'pi-spinner__diameter--large');
+ diameterValue === 110 || (diameterValue === 130 && 'pi-spinner__diameter--large');
return [
'pi-spinner',
'pi-spinner__progress',
@@ -35,9 +39,9 @@ export class PiProgressSpinnerComponent {
].join(' ');
}
- @Input() value!: number;
- @Input() label!: string;
- @Input() appearance: 'compact' | 'default' = 'default';
- @Input() strokeWidth: 2 | 3 | 4 | 5 | 6 | 7 | 8 = 6;
- @Input() diameter!: number;
+ readonly value = input.required();
+ readonly label = input.required();
+ readonly appearance = input<'compact' | 'default'>('default');
+ readonly strokeWidth = input<2 | 3 | 4 | 5 | 6 | 7 | 8>(6);
+ readonly diameter = input.required();
}
diff --git a/libs/ui/src/lib/ui/select/base-select.component.ts b/libs/ui/src/lib/ui/select/base-select.component.ts
index 87b721e..227faff 100644
--- a/libs/ui/src/lib/ui/select/base-select.component.ts
+++ b/libs/ui/src/lib/ui/select/base-select.component.ts
@@ -1,15 +1,18 @@
-import {
- Component,
- ContentChild,
- ContentChildren,
- ElementRef,
- HostBinding,
- Injector,
- Input,
- QueryList,
- Renderer2,
- TemplateRef,
- ViewChildren,
+import {
+ Component,
+ ContentChildren,
+ ElementRef,
+ HostBinding,
+ Injector,
+ Input,
+ QueryList,
+ Renderer2,
+ TemplateRef,
+ ViewChildren,
+ input,
+ contentChild,
+ contentChildren,
+ viewChildren
} from '@angular/core';
import { FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import { PiFormControl } from '../../util/form-control';
@@ -44,12 +47,12 @@ export class PiBaseSelectComponent extends PiFormControl {
/**
* Name of the form control.
*/
- @Input() formControlName!: string;
+ readonly formControlName = input.required();
/**
* Property used for comparisons.
*/
- @Input() keyIdProperty!: string;
+ readonly keyIdProperty = input.required();
// ======================
// SKIN
@@ -58,47 +61,47 @@ export class PiBaseSelectComponent extends PiFormControl {
/**
* Specifies the layout for the menu.
*/
- @Input() menuType: 'default' | 'flex-wrap' | 'custom-grid' = 'default';
+ readonly menuType = input<'default' | 'flex-wrap' | 'custom-grid'>('default');
/**
* Defines the type of the select component.
*/
- @Input() type: 'default' | 'dropdown' = 'default';
+ readonly type = input<'default' | 'dropdown'>('default');
/**
* The appearance style of the select component.
*/
- @Input() appearance: 'fill' | 'outline' | 'ghost' = 'fill';
+ readonly appearance = input<'fill' | 'outline' | 'ghost'>('fill');
/**
* The type of the input.
*/
- @Input() pickedOptionType: 'button' | 'input' = 'input';
+ readonly pickedOptionType = input<'button' | 'input'>('input');
/**
* Defines the color of the select component and its child components.
*/
- @Input() color: SelectColor = 'primary';
+ readonly color = input('primary');
/**
* Defines the color of the select component and its child components.
*/
- @Input() menuColor: 'white' | 'transparent' = 'white';
+ readonly menuColor = input<'white' | 'transparent'>('white');
/**
* The flex direction property binded in the select component is used to bind
* the pre definded select option flex direction property.
*/
- @Input() flexDirection: SelectOptionFlexDirection = 'row';
+ readonly flexDirection = input('row');
/**
* The text align property defines if the picked option text in type dropdown cases and
* can extends the text alignment from the selec option when we use Back End data.
*/
- @Input() textAlign: 'left' | 'center' = 'left';
+ readonly textAlign = input<'left' | 'center'>('left');
/**
* An optional icon for the select.
*/
@@ -107,7 +110,7 @@ export class PiBaseSelectComponent extends PiFormControl {
/**
* An optional icon for the select.
*/
- @Input() actionIcon: actionIcon = 'chevron-forward';
+ readonly actionIcon = input('chevron-forward');
// ======================
// CONTENT & DATA
@@ -116,28 +119,28 @@ export class PiBaseSelectComponent extends PiFormControl {
/**
* List of selectable options.
*/
- @Input() options: Array = [];
+ readonly options = input>([]);
/**
* An optional label for the select.
*/
- @Input() label: string | undefined;
+ readonly label = input();
/**
* Placeholder for the select when no option is selected.
*/
- @Input() placeholder: string | undefined;
+ readonly placeholder = input();
/**
* Defines the select an select option size in picked option type button cases
*/
- @Input() size: 'small' | 'medium' = 'medium';
+ readonly size = input<'small' | 'medium'>('medium');
/**
* Defines if the picked option is responsive or not (ie. if it disappears in small devices or not)
*/
- @Input() isResponsive = true;
+ readonly isResponsive = input(true);
// ======================
// CONTENT PROJECTIONS
@@ -146,13 +149,12 @@ export class PiBaseSelectComponent extends PiFormControl {
/**
* Provides a reference to the custom template for the options if provided.
*/
- @ContentChild('optionTemplate', { static: false })
- optionTemplateRef!: TemplateRef;
+ readonly optionTemplateRef = contentChild.required>('optionTemplate');
/**
* Provides a reference to the custom template for the selected item if provided.
*/
- @ContentChild('selectedTemplate') selectedTemplateRef!: TemplateRef;
+ readonly selectedTemplateRef = contentChild.required>('selectedTemplate');
/**
* A query list of all the child option components that are content projected from an external consumer.
@@ -167,8 +169,7 @@ export class PiBaseSelectComponent extends PiFormControl {
* that are content projected from an external consumer.
* This provides direct access to their corresponding DOM elements.
*/
- @ContentChildren(PiSelectOptionComponent, { read: ElementRef })
- childrenOptionsEl!: QueryList;
+ readonly childrenOptionsEl = contentChildren(PiSelectOptionComponent, { read: ElementRef });
/**
* A query list of all the child option components that are directly defined (view children)
@@ -183,8 +184,7 @@ export class PiBaseSelectComponent extends PiFormControl {
* that are directly defined (view children) within this component's template.
* This provides direct access to their corresponding DOM elements.
*/
- @ViewChildren(PiSelectOptionComponent, { read: ElementRef })
- viewChildOptionsEl: QueryList;
+ readonly viewChildOptionsEl = viewChildren(PiSelectOptionComponent, { read: ElementRef });
constructor(
protected el: ElementRef,
@@ -202,7 +202,7 @@ export class PiBaseSelectComponent extends PiFormControl {
* Returns the FormControl associated with the formControlName.
*/
get control(): FormControl {
- return this.controlContainer.control?.get(this.formControlName) as FormControl;
+ return this.controlContainer.control?.get(this.formControlName()) as FormControl;
}
/**
@@ -261,17 +261,17 @@ export class PiBaseSelectComponent extends PiFormControl {
get selectOptionSize(): SelectOptionSize {
switch (true) {
- case this.type === 'dropdown' && this.pickedOptionType === 'input':
+ case this.type() === 'dropdown' && this.pickedOptionType() === 'input':
return SelectOptionSize.Small;
- case this.type === 'dropdown' && this.pickedOptionType === 'button' && this.size === 'medium':
+ case this.type() === 'dropdown' && this.pickedOptionType() === 'button' && this.size() === 'medium':
return SelectOptionSize.Medium;
- case this.type === 'dropdown' && this.pickedOptionType === 'button' && this.size === 'small':
+ case this.type() === 'dropdown' && this.pickedOptionType() === 'button' && this.size() === 'small':
return SelectOptionSize.Small;
- case this.type === 'default' && this.menuType === 'flex-wrap':
+ case this.type() === 'default' && this.menuType() === 'flex-wrap':
return SelectOptionSize.Large;
- case this.type === 'default' && this.menuType === 'default' && this.appearance === 'ghost':
+ case this.type() === 'default' && this.menuType() === 'default' && this.appearance() === 'ghost':
return SelectOptionSize.Medium;
- case this.type === 'default' && this.menuType === 'default' && this.appearance !== 'ghost':
+ case this.type() === 'default' && this.menuType() === 'default' && this.appearance() !== 'ghost':
return SelectOptionSize.Small;
default:
return SelectOptionSize.Medium;
@@ -287,10 +287,11 @@ export class PiBaseSelectComponent extends PiFormControl {
* Manage the Select & Select Multiple appearance property
*/
protected get appearanceClass(): string | undefined {
+ const appearance = this.appearance();
return (
- this.menuType !== 'custom-grid' &&
- this.appearance &&
- `pi-select__appearance--${this.appearance}`
+ this.menuType() !== 'custom-grid' &&
+ appearance &&
+ `pi-select__appearance--${appearance}`
);
}
@@ -306,7 +307,8 @@ export class PiBaseSelectComponent extends PiFormControl {
* color depending on the user profile.
*/
protected get colorClass(): string | undefined {
- return this.menuType !== 'custom-grid' && this.color && `pi-color__${this.color}`;
+ const color = this.color();
+ return this.menuType() !== 'custom-grid' && color && `pi-color__${color}`;
}
/**
@@ -315,8 +317,9 @@ export class PiBaseSelectComponent extends PiFormControl {
* This property can be modified from the default one (white) specially when type !== 'dropdown'.
*/
protected get menuColorClass(): string | undefined {
- return this.menuType !== 'custom-grid' && this.menuColor !== 'white'
- ? `pi-select__menu-color--${this.menuColor}`
+ const menuColor = this.menuColor();
+ return this.menuType() !== 'custom-grid' && menuColor !== 'white'
+ ? `pi-select__menu-color--${menuColor}`
: '';
}
@@ -332,9 +335,10 @@ export class PiBaseSelectComponent extends PiFormControl {
* to display the select options as a mosaic in the page
*/
protected get menuTypeClass(): string | undefined {
- return this.menuType === 'default'
+ const menuType = this.menuType();
+ return menuType === 'default'
? 'pi-select__menu-type--column'
- : `pi-select__menu-type--${this.menuType}`;
+ : `pi-select__menu-type--${menuType}`;
}
/**
@@ -350,11 +354,12 @@ export class PiBaseSelectComponent extends PiFormControl {
* it means that the picked option emulate a Button.
*/
protected get pickedOptionTypeClass(): string | undefined {
+ const pickedOptionType = this.pickedOptionType();
return (
- this.type === 'dropdown' &&
- this.menuType !== 'custom-grid' &&
- this.pickedOptionType &&
- `pi-select__picked-option-type--${this.pickedOptionType}`
+ this.type() === 'dropdown' &&
+ this.menuType() !== 'custom-grid' &&
+ pickedOptionType &&
+ `pi-select__picked-option-type--${pickedOptionType}`
);
}
@@ -379,7 +384,8 @@ export class PiBaseSelectComponent extends PiFormControl {
* in a static positioned menu.
*/
protected get typeClass(): string | undefined {
- return this.type && `pi-select__type--${this.type}`;
+ const type = this.type();
+ return type && `pi-select__type--${type}`;
}
/**
@@ -399,10 +405,12 @@ export class PiBaseSelectComponent extends PiFormControl {
*
*/
protected get textAlignClass(): string | boolean {
- return (this.textAlign !== 'left' && this.pickedOptionType === 'button') ||
- (this.menuType === 'flex-wrap' && this.flexDirection === 'row') ||
- this.menuType === 'default'
- ? `pi-select__text-align--${this.textAlign}`
+ const menuType = this.menuType();
+ const textAlign = this.textAlign();
+ return (textAlign !== 'left' && this.pickedOptionType() === 'button') ||
+ (menuType === 'flex-wrap' && this.flexDirection() === 'row') ||
+ menuType === 'default'
+ ? `pi-select__text-align--${textAlign}`
: '';
}
@@ -415,7 +423,8 @@ export class PiBaseSelectComponent extends PiFormControl {
*
*/
protected get sizeClass(): string | boolean {
- return this.pickedOptionType === 'button' && this.size ? `pi-select__${this.size}` : '';
+ const size = this.size();
+ return this.pickedOptionType() === 'button' && size ? `pi-select__${size}` : '';
}
/**
@@ -426,6 +435,6 @@ export class PiBaseSelectComponent extends PiFormControl {
* When the Select Picked Option Type === Button
*/
protected get isResponsiveClass(): string | boolean {
- return this.pickedOptionType === 'button' && this.isResponsive ? 'is-responsive' : '';
+ return this.pickedOptionType() === 'button' && this.isResponsive() ? 'is-responsive' : '';
}
}
diff --git a/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.html b/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.html
index 8655699..f068642 100644
--- a/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.html
+++ b/libs/ui/src/lib/ui/select/select-carousel/select-carousel.component.html
@@ -1,23 +1,23 @@