From c254e4e7b71dd0f859cc27a93f424e98139d5314 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 May 2024 17:44:54 +0200 Subject: [PATCH 001/484] Calendar - add option to change step size in yearpicker --- src/app/components/calendar/calendar.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index 37fd1cd6592..e5b44344c0b 100644 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -604,6 +604,11 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { * @group Props */ @Input({ transform: booleanAttribute }) timeOnly: boolean | undefined; + /** + * Years to change per step in yearpicker. + * @group Props + */ + @Input({ transform: numberAttribute }) stepYearPicker: number = 20; /** * Hours to change per step. * @group Props @@ -1284,8 +1289,8 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { yearPickerValues() { let yearPickerValues = []; - let base = this.currentYear - (this.currentYear % 10); - for (let i = 0; i < 10; i++) { + let base = this.currentYear - (this.currentYear % this.stepYearPicker); + for (let i = 0; i < this.stepYearPicker; i++) { yearPickerValues.push(base + i); } @@ -1407,7 +1412,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { this.updateFocus(); }, 1); } else if (this.currentView === 'year') { - this.decrementDecade(); + this.decrementYearPickerStep(); setTimeout(() => { this.updateFocus(); }, 1); @@ -1438,7 +1443,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { this.updateFocus(); }, 1); } else if (this.currentView === 'year') { - this.incrementDecade(); + this.incrementYearPickerStep(); setTimeout(() => { this.updateFocus(); }, 1); @@ -1465,12 +1470,12 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { } } - decrementDecade() { - this.currentYear = this.currentYear - 10; + decrementYearPickerStep() { + this.currentYear = this.currentYear - this.stepYearPicker; } - incrementDecade() { - this.currentYear = this.currentYear + 10; + incrementYearPickerStep() { + this.currentYear = this.currentYear + this.stepYearPicker; } incrementYear() { From c968e5f5dda4091045f471ec3255ed014405c086 Mon Sep 17 00:00:00 2001 From: Alexander Ciesielski Date: Mon, 6 May 2024 15:23:35 +0200 Subject: [PATCH 002/484] feat(button): make standalone --- src/app/components/api/shared.ts | 9 +++++---- src/app/components/autofocus/autofocus.ts | 7 +++---- src/app/components/button/button.ts | 15 +++++++++------ src/app/components/ripple/ripple.ts | 8 ++++---- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/app/components/api/shared.ts b/src/app/components/api/shared.ts index 88735641065..cb5ecbe7e84 100755 --- a/src/app/components/api/shared.ts +++ b/src/app/components/api/shared.ts @@ -1,20 +1,22 @@ -import { CommonModule } from '@angular/common'; import { Component, Directive, Input, NgModule, TemplateRef } from '@angular/core'; @Component({ selector: 'p-header', + standalone: true, template: '' }) export class Header {} @Component({ selector: 'p-footer', + standalone: true, template: '' }) export class Footer {} @Directive({ selector: '[pTemplate]', + standalone: true, host: {} }) export class PrimeTemplate { @@ -30,8 +32,7 @@ export class PrimeTemplate { } @NgModule({ - imports: [CommonModule], - exports: [Header, Footer, PrimeTemplate], - declarations: [Header, Footer, PrimeTemplate] + imports: [Header, Footer, PrimeTemplate], + exports: [Header, Footer, PrimeTemplate] }) export class SharedModule {} diff --git a/src/app/components/autofocus/autofocus.ts b/src/app/components/autofocus/autofocus.ts index 11253f8051b..504103917b3 100644 --- a/src/app/components/autofocus/autofocus.ts +++ b/src/app/components/autofocus/autofocus.ts @@ -1,4 +1,3 @@ -import { CommonModule } from '@angular/common'; import { Directive, ElementRef, Input, NgModule, booleanAttribute } from '@angular/core'; import { DomHandler } from 'primeng/dom'; /** @@ -7,6 +6,7 @@ import { DomHandler } from 'primeng/dom'; */ @Directive({ selector: '[pAutoFocus]', + standalone: true, host: { class: 'p-element' } @@ -49,8 +49,7 @@ export class AutoFocus { } @NgModule({ - imports: [CommonModule], - exports: [AutoFocus], - declarations: [AutoFocus] + imports: [AutoFocus], + exports: [AutoFocus] }) export class AutoFocusModule {} diff --git a/src/app/components/button/button.ts b/src/app/components/button/button.ts index cd02156c196..94fafb2293f 100755 --- a/src/app/components/button/button.ts +++ b/src/app/components/button/button.ts @@ -1,4 +1,4 @@ -import { CommonModule, DOCUMENT } from '@angular/common'; +import { DOCUMENT, NgClass, NgIf, NgStyle, NgTemplateOutlet } from '@angular/common'; import { AfterContentInit, AfterViewInit, @@ -20,11 +20,11 @@ import { numberAttribute } from '@angular/core'; import { PrimeTemplate, SharedModule } from 'primeng/api'; +import { AutoFocus } from 'primeng/autofocus'; import { DomHandler } from 'primeng/dom'; import { SpinnerIcon } from 'primeng/icons/spinner'; -import { RippleModule } from 'primeng/ripple'; +import { Ripple } from 'primeng/ripple'; import { ObjectUtils } from 'primeng/utils'; -import { AutoFocusModule } from 'primeng/autofocus'; type ButtonIconPosition = 'left' | 'right' | 'top' | 'bottom'; @@ -36,12 +36,14 @@ const INTERNAL_BUTTON_CLASSES = { loading: 'p-button-loading', labelOnly: 'p-button-loading-label-only' } as const; + /** * Button directive is an extension to button component. * @group Components */ @Directive({ selector: '[pButton]', + standalone: true, host: { class: 'p-element' } @@ -329,6 +331,8 @@ export class ButtonDirective implements AfterViewInit, OnDestroy { */ @Component({ selector: 'p-button', + standalone: true, + imports: [NgIf, NgTemplateOutlet, NgStyle, NgClass, Ripple, AutoFocus, SpinnerIcon], template: ` @@ -58,6 +75,7 @@ type SplitButtonIconPosition = 'left' | 'right'; [ariaLabel]="buttonProps?.['ariaLabel']" pAutoFocus [autofocus]="autofocus" + [pTooltip]="tooltip" > @@ -60,6 +61,7 @@ type SplitButtonIconPosition = 'left' | 'right'; pAutoFocus [autofocus]="autofocus" [pTooltip]="tooltip" + [tooltipOptions]="tooltipOptions" > -
+
-
- -