fix: elimina los ultimos errores de estrictez y normaliza a LF

This commit is contained in:
2026-07-27 23:57:22 +02:00
parent 422d85f59f
commit c15ccea103
497 changed files with 39058 additions and 39057 deletions

View File

@@ -151,8 +151,8 @@ export class PiCarouselComponent
return this._currentItemIndex; return this._currentItemIndex;
} }
itemsPerPage: number; itemsPerPage!: number;
pages: Array<number>; pages!: Array<number>;
// Drag variables // Drag variables
isDragging = false; isDragging = false;
@@ -160,13 +160,13 @@ export class PiCarouselComponent
dragInitPosition = 0; dragInitPosition = 0;
dragFinalPosition = 0; dragFinalPosition = 0;
private mousedownListener: () => void; private mousedownListener!: () => void;
private mouseupListener: () => void; private mouseupListener!: () => void;
private mousemoveListener: () => void; private mousemoveListener!: () => void;
private touchstartListener: () => void; private touchstartListener!: () => void;
private touchmoveListener: () => void; private touchmoveListener!: () => void;
private touchendListener: () => void; private touchendListener!: () => void;
constructor( constructor(
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,

View File

@@ -55,7 +55,7 @@ export class PiChartComponent implements OnInit, AfterViewInit {
readonly xAxisMarks = input<Array<string>>(); readonly xAxisMarks = input<Array<string>>();
readonly isComparativeChart = input<boolean>(true); readonly isComparativeChart = input<boolean>(true);
private _hoveredDatasetIndex: number; private _hoveredDatasetIndex!: number;
set hoveredDatasetIndex(index: number) { set hoveredDatasetIndex(index: number) {
this._hoveredDatasetIndex = index; this._hoveredDatasetIndex = index;
} }
@@ -65,7 +65,7 @@ export class PiChartComponent implements OnInit, AfterViewInit {
readonly chartRef = viewChild.required('chart', { read: (ElementRef<HTMLCanvasElement>) }); readonly chartRef = viewChild.required('chart', { read: (ElementRef<HTMLCanvasElement>) });
chart: Chart; chart!: Chart;
constructor( constructor(
private translate: TranslateService, private translate: TranslateService,
@@ -144,10 +144,9 @@ export class PiChartComponent implements OnInit, AfterViewInit {
return context.dataset.borderColor as string; return context.dataset.borderColor as string;
}, },
label: function (context) { label: function (context) {
const datasetLabel = context.dataset.label ?? '';
const chartLabel = const chartLabel =
context.dataset.label.length > 12 datasetLabel.length > 12 ? datasetLabel.slice(0, 12) + '...' : datasetLabel;
? context.dataset.label.slice(0, 12) + '...'
: context.dataset.label;
let label: string; let label: string;
if ((context.dataset as any).unitPosition === 'before') { if ((context.dataset as any).unitPosition === 'before') {
label = label =

View File

@@ -69,7 +69,7 @@ export class PiChipDateComponent extends PiBaseChipComponent {
return { return {
day: dateObj.day.toString() || '', day: dateObj.day.toString() || '',
month: dateObj.monthShort || '', month: dateObj.monthShort || '',
weekDay: isDateToday ? _.capitalize(dateObj.toRelativeCalendar()) : _.capitalize(dateObj.weekdayShort || ''), weekDay: isDateToday ? _.capitalize(dateObj.toRelativeCalendar() ?? '') : _.capitalize(dateObj.weekdayShort || ''),
}; };
} }
} }

View File

@@ -134,7 +134,7 @@ export class PiDataGridComponent<T> {
* - When de data data direction === COLUMN, 1 column emulates a row. * - When de data data direction === COLUMN, 1 column emulates a row.
* *
*/ */
protected get columnsClass(): string { protected get columnsClass() {
const columns = this.columns(); const columns = this.columns();
return columns && `pi-data-grid__columns--${columns}`; return columns && `pi-data-grid__columns--${columns}`;
} }
@@ -202,7 +202,7 @@ export class PiDataGridComponent<T> {
* with the cardType in order to generate grid template area to implement a specific design. * with the cardType in order to generate grid template area to implement a specific design.
* *
*/ */
protected get modeClass(): string { protected get modeClass() {
const mode = this.mode(); const mode = this.mode();
return mode && `pi-data-grid__mode--${mode}`; return mode && `pi-data-grid__mode--${mode}`;
} }
@@ -214,7 +214,7 @@ export class PiDataGridComponent<T> {
* - When de data data direction === COLUMN, 1 row emulates a column. * - When de data data direction === COLUMN, 1 row emulates a column.
* *
*/ */
protected get rowsClass(): string { protected get rowsClass() {
const rows = this.rows(); const rows = this.rows();
return rows && `pi-data-grid__rows--${rows}`; return rows && `pi-data-grid__rows--${rows}`;
} }

View File

@@ -42,7 +42,7 @@ export class PiBaseDataTableComponent implements OnInit {
return `pi-base-data-table__data-direction--${this.dataDirection()}`; return `pi-base-data-table__data-direction--${this.dataDirection()}`;
} }
get typeClass(): string | void { get typeClass() {
return this.type() === 'header' && 'pi-base-data-table__type--header'; return this.type() === 'header' && 'pi-base-data-table__type--header';
} }
@@ -52,7 +52,7 @@ export class PiBaseDataTableComponent implements OnInit {
.pipe(take(1)) .pipe(take(1))
.subscribe((deviceType: string) => { .subscribe((deviceType: string) => {
if (deviceType !== 'DESKTOP' && this.hideValues()) { if (deviceType !== 'DESKTOP' && this.hideValues()) {
delete this.items()[0].values; delete this.items()?.[0]?.values;
} }
}); });
} }

View File

@@ -50,7 +50,7 @@ export class PiDataTableItemComponent implements AfterViewInit {
setCellClassByIndex(): void { setCellClassByIndex(): void {
this.values()?.forEach((item: string, index: number) => { this.values()?.forEach((item: string, index: number) => {
this.componentItem().nativeElement.children[index].classList.add(`pi-cell__${index}`); this.componentItem()?.nativeElement.children[index].classList.add(`pi-cell__${index}`);
}); });
} }

View File

@@ -2,5 +2,6 @@ export interface DataTableItem {
heading: string; heading: string;
key?: string; key?: string;
position?: number; position?: number;
values: Array<string>; // opcional: base-data-table lo borra en pantallas pequeñas
values?: Array<string>;
} }

View File

@@ -79,7 +79,7 @@ export class PiIncrementalNumberFieldComponent extends PiBaseFormFieldComponent
} }
isIncrementButtonDisabled(): boolean { isIncrementButtonDisabled(): boolean {
return this.disabled || this.control.value + this.slot() > this.max(); return this.disabled || this.control.value + this.slot() > (this.max() ?? Infinity);
} }
isDecrementButtonDisabled(): boolean { isDecrementButtonDisabled(): boolean {

View File

@@ -42,8 +42,8 @@ export class PiModalComponent {
return ['pi-modal', typeClass, disableCloseClass].join(' '); return ['pi-modal', typeClass, disableCloseClass].join(' ');
} }
styleType: ModalStyleType; styleType!: ModalStyleType;
buttonColor: ModalStyleType; buttonColor!: ModalStyleType;
title: string | undefined; title: string | undefined;
subtitle: string | undefined; subtitle: string | undefined;

View File

@@ -97,7 +97,7 @@ export class PiNoteComponent implements OnInit {
readonly appearance = input<'fill' | 'ghost'>('fill'); readonly appearance = input<'fill' | 'ghost'>('fill');
readonly type = input<'status' | 'simple'>('status'); readonly type = input<'status' | 'simple'>('status');
noteStatus!: NoteStatus; noteStatus?: NoteStatus;
constructor(private noteDataService: NoteDataService) {} constructor(private noteDataService: NoteDataService) {}

View File

@@ -48,7 +48,7 @@ export class PiSnackBarComponent {
buttonColor!: styleType; buttonColor!: styleType;
/** The instance of the component making up the content of the snack bar. */ /** The instance of the component making up the content of the snack bar. */
private readonly snackBarRef: MatSnackBarRef<PiSnackBarComponent>; private readonly snackBarRef!: MatSnackBarRef<PiSnackBarComponent>;
constructor(@Optional() @Inject(MAT_SNACK_BAR_DATA) public data: any) { constructor(@Optional() @Inject(MAT_SNACK_BAR_DATA) public data: any) {
if (data) { if (data) {

View File

@@ -98,7 +98,7 @@ export abstract class PiBasePanelComponent implements OnInit {
return paddingValue ? `pi-panel__padding--${paddingValue}` : ''; return paddingValue ? `pi-panel__padding--${paddingValue}` : '';
} }
protected get gridClass(): string | false { protected get gridClass() {
const grid = this.grid(); const grid = this.grid();
return grid && `pi-panel__grid--${grid}`; return grid && `pi-panel__grid--${grid}`;
} }

View File

@@ -300,7 +300,7 @@ export class PiBaseSelectComponent extends PiFormControl {
* *
* color depending on the user profile. * color depending on the user profile.
*/ */
protected get colorClass(): string | undefined { protected get colorClass() {
const color = this.color(); const color = this.color();
return this.menuType() !== 'custom-grid' && color && `pi-color__${color}`; return this.menuType() !== 'custom-grid' && color && `pi-color__${color}`;
} }
@@ -347,7 +347,7 @@ export class PiBaseSelectComponent extends PiFormControl {
* B) the Picked Option Type === Button * B) the Picked Option Type === Button
* it means that the picked option emulate a Button. * it means that the picked option emulate a Button.
*/ */
protected get pickedOptionTypeClass(): string | undefined { protected get pickedOptionTypeClass() {
const pickedOptionType = this.pickedOptionType(); const pickedOptionType = this.pickedOptionType();
return ( return (
this.type() === 'dropdown' && this.type() === 'dropdown' &&

View File

@@ -68,7 +68,7 @@ export class PiTabComponent implements AfterViewChecked, OnDestroy {
readonly tabWrapperElementRef = viewChild.required('tabWrapper', { read: ElementRef }); readonly tabWrapperElementRef = viewChild.required('tabWrapper', { read: ElementRef });
currentContent: number; currentContent!: number;
currentTabElement: number = 0; currentTabElement: number = 0;
isTabWrapperScrolledToStart: boolean = true; isTabWrapperScrolledToStart: boolean = true;

View File

@@ -47,7 +47,7 @@ export class PiTextViewerLinkComponent extends PiBaseTextViewerComponent {
override readonly justify = input<justify>('flex-start'); override readonly justify = input<justify>('flex-start');
readonly display = input<display>('flex'); readonly display = input<display>('flex');
template: 'link' | 'route' | 'onClick'; template!: 'link' | 'route' | 'onClick';
getTemplate(): 'link' | 'route' | 'onClick' { getTemplate(): 'link' | 'route' | 'onClick' {
if (this.route()) { if (this.route()) {

View File

@@ -21,9 +21,9 @@ export class PiTooltipDirective implements OnInit, OnDestroy {
readonly tooltipColor = input<'white' | 'grey' | 'dark'>('white'); readonly tooltipColor = input<'white' | 'grey' | 'dark'>('white');
readonly tooltipPosition = input<TooltipPosition>('right'); readonly tooltipPosition = input<TooltipPosition>('right');
private mouseoverListener: () => void; private mouseoverListener!: () => void;
private mouseoutListener: () => void; private mouseoutListener!: () => void;
private clickListener: () => void; private clickListener!: () => void;
constructor(private tooltip: MatTooltip, private el: ElementRef, private renderer: Renderer2) {} constructor(private tooltip: MatTooltip, private el: ElementRef, private renderer: Renderer2) {}

View File

@@ -49,7 +49,7 @@ export class Commons {
static downloadPDF(url: string, name: string, target?: string): void { static downloadPDF(url: string, name: string, target?: string): void {
const targetLink = target || '_self'; const targetLink = target || '_self';
let link = document.createElement('a'); let link: HTMLAnchorElement | null = document.createElement('a');
link.href = url; link.href = url;
link.download = name; link.download = name;
link.target = targetLink; link.target = targetLink;
@@ -101,7 +101,7 @@ export class Commons {
minValue: number, minValue: number,
maxValue: number, maxValue: number,
unit: string, unit: string,
defaultLocale?: string defaultLocale = ''
): string { ): string {
if (!!minValue && !!maxValue) { if (!!minValue && !!maxValue) {
return `${minValue}${unit} - ${maxValue}${unit}`; return `${minValue}${unit} - ${maxValue}${unit}`;
@@ -115,7 +115,7 @@ export class Commons {
return defaultLocale; return defaultLocale;
} }
static removeEmptyValuesFromObject(obj: unknown): unknown { static removeEmptyValuesFromObject(obj: object): unknown {
return Object.fromEntries( return Object.fromEntries(
Object.entries(obj).filter( Object.entries(obj).filter(
([_, v]) => v != null && v !== '' && (v as Array<string>).length !== 0 ([_, v]) => v != null && v !== '' && (v as Array<string>).length !== 0
@@ -138,7 +138,7 @@ export class Commons {
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
} }
static getScrollParent(node: HTMLElement): HTMLElement { static getScrollParent(node: HTMLElement): HTMLElement | null {
if (node == null) { if (node == null) {
return null; return null;
} }

View File

@@ -21,7 +21,8 @@ export class DeviceConfigsFacade {
// Device // Device
readonly device$: Observable<Device> = this.store.select(fromSelectors.getDevice); readonly device$: Observable<Device> = this.store.select(fromSelectors.getDevice);
readonly size$: Observable<Size> = this.store.select(fromSelectors.getSize); // `null` hasta que se resuelve el tamaño (así lo declara el estado inicial)
readonly size$: Observable<Size | null> = this.store.select(fromSelectors.getSize);
readonly isSmallDevice$: Observable<boolean> = this.store.select(fromSelectors.getIsSmallDevice); readonly isSmallDevice$: Observable<boolean> = this.store.select(fromSelectors.getIsSmallDevice);
// Browser // Browser

View File

@@ -7,7 +7,7 @@ export const featureKey = 'CORE_deviceConfigs';
export interface DeviceConfigsState { export interface DeviceConfigsState {
device: Device; device: Device;
size: Size; size: Size | null;
browser: Browser browser: Browser
} }

View File

@@ -3,7 +3,7 @@ import { ControlContainer, ControlValueAccessor } from '@angular/forms';
@Injectable() @Injectable()
export class PiFormControl implements ControlValueAccessor { export class PiFormControl implements ControlValueAccessor {
value: number | string | Array<string> | boolean; value!: number | string | Array<string> | boolean;
onChange = (value: number | string | Array<string> | boolean) => {}; onChange = (value: number | string | Array<string> | boolean) => {};

View File

@@ -52,6 +52,6 @@ export abstract class PiBaseMenuEventItem {
const parent = this.el.nativeElement as HTMLElement; const parent = this.el.nativeElement as HTMLElement;
const children = (parent.children as HTMLCollection).item(1) ?? null; const children = (parent.children as HTMLCollection).item(1) ?? null;
return children?.classList.contains('is-visible'); return children?.classList.contains('is-visible') ?? false;
} }
} }

View File

@@ -3,7 +3,7 @@ import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'numberFormat', }) @Pipe({ name: 'numberFormat', })
export class NumberFormatPipe implements PipeTransform { export class NumberFormatPipe implements PipeTransform {
transform(value: unknown, ...args: Array<unknown>): unknown { transform(value: unknown, ...args: Array<unknown>): unknown {
return new Intl.NumberFormat('de-DE').format(+value); return new Intl.NumberFormat('de-DE').format(Number(value));
} }
} }
@@ -53,7 +53,7 @@ export class TruncatePipe implements PipeTransform {
@Pipe({ name: 'maxTwoDecimals' }) @Pipe({ name: 'maxTwoDecimals' })
export class MaxTwoDecimalsPipe implements PipeTransform { export class MaxTwoDecimalsPipe implements PipeTransform {
transform(value: unknown, ...args: Array<unknown>): unknown { transform(value: unknown, ...args: Array<unknown>): unknown {
return Math.round(+value * 100) / 100; return Math.round(Number(value) * 100) / 100;
} }
} }

View File

@@ -6,7 +6,7 @@ import { Inject, Injectable, Renderer2 } from '@angular/core';
providedIn: 'root', providedIn: 'root',
}) })
export class SchemaService { export class SchemaService {
script: HTMLScriptElement; script!: HTMLScriptElement;
constructor(@Inject(DOCUMENT) private doc: Document) {} constructor(@Inject(DOCUMENT) private doc: Document) {}

View File

@@ -237,7 +237,7 @@ export function validateMultipleChoiceRequired(control: AbstractControl): Valida
}; };
let selected: boolean = false; let selected: boolean = false;
selected = !!choices ? Object.entries(choices)?.some(([key, value]) => value) : null; selected = !!choices ? Object.entries(choices)?.some(([key, value]) => value) : false;
if (choices && !selected) { if (choices && !selected) {
return { message: ['common.validator.atLeastOneOption'] }; return { message: ['common.validator.atLeastOneOption'] };
@@ -246,8 +246,8 @@ export function validateMultipleChoiceRequired(control: AbstractControl): Valida
} }
export function rangeValidator(control: AbstractControl): ValidationErrors | null { export function rangeValidator(control: AbstractControl): ValidationErrors | null {
const from = Number(control.get('from').value); const from = Number(control.get('from')?.value);
const to = Number(control.get('to').value); const to = Number(control.get('to')?.value);
if (!from || !to) return null; if (!from || !to) return null;
return from <= to return from <= to
? null ? null