Skip to content

Commit

Permalink
feat: add input transform numberAttribute functions on every boolea…
Browse files Browse the repository at this point in the history
…n inputs
  • Loading branch information
LcsGa committed Jan 28, 2024
1 parent 9a7781f commit b3e91c7
Show file tree
Hide file tree
Showing 59 changed files with 298 additions and 222 deletions.
5 changes: 3 additions & 2 deletions src/app/components/accordion/accordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
TemplateRef,
ViewEncapsulation,
booleanAttribute,
forwardRef
forwardRef,
numberAttribute
} from '@angular/core';
import { BlockableUI, Header, PrimeTemplate, SharedModule } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
Expand Down Expand Up @@ -197,7 +198,7 @@ export class AccordionTab implements AfterContentInit, OnDestroy {
* The aria-level that each accordion header will have. The default value is 2 as per W3C specifications
* @group Props
*/
@Input() headerAriaLevel: number = 2;
@Input({ transform: numberAttribute }) headerAriaLevel: number = 2;
/**
* Event triggered by changing the choice.
* @param {boolean} value - Boolean value indicates that the option is changed.
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/animateonscroll/animateonscroll.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';
import { AfterViewInit, Directive, ElementRef, Input, NgModule, Renderer2, OnInit, Inject, PLATFORM_ID, booleanAttribute } from '@angular/core';
import { AfterViewInit, Directive, ElementRef, Input, NgModule, Renderer2, OnInit, Inject, PLATFORM_ID, booleanAttribute, numberAttribute } from '@angular/core';
import { DomHandler } from 'primeng/dom';

interface AnimateOnScrollOptions {
Expand Down Expand Up @@ -43,7 +43,7 @@ export class AnimateOnScroll implements OnInit, AfterViewInit {
* Specifies the threshold option of the IntersectionObserver API
* @group Props
*/
@Input() threshold: number | undefined;
@Input({ transform: numberAttribute }) threshold: number | undefined;
/**
* Whether the scroll event listener should be removed after initial run.
* @group Props
Expand Down
15 changes: 8 additions & 7 deletions src/app/components/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
Input,
NgModule,
NgZone,
numberAttribute,
OnDestroy,
Output,
QueryList,
Expand Down Expand Up @@ -282,12 +283,12 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Minimum number of characters to initiate a search.
* @group Props
*/
@Input() minLength: number = 1;
@Input({ transform: numberAttribute }) minLength: number = 1;
/**
* Delay between keystrokes to wait before sending a query.
* @group Props
*/
@Input() delay: number = 300;
@Input({ transform: numberAttribute }) delay: number = 300;
/**
* Inline style of the component.
* @group Props
Expand Down Expand Up @@ -357,7 +358,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Height of an item in the list for VirtualScrolling.
* @group Props
*/
@Input() virtualScrollItemSize: number | undefined;
@Input({ transform: numberAttribute }) virtualScrollItemSize: number | undefined;
/**
* Whether to use the scroller feature. The properties of scroller component can be used like an object in it.
* @group Props
Expand All @@ -367,7 +368,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Maximum number of character allows in the input field.
* @group Props
*/
@Input() maxlength: number | undefined;
@Input({ transform: numberAttribute }) maxlength: number | undefined;
/**
* Name of the input element.
* @group Props
Expand All @@ -382,7 +383,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Size of the input field.
* @group Props
*/
@Input() size: number | undefined;
@Input({ transform: numberAttribute }) size: number | undefined;
/**
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @group Props
Expand Down Expand Up @@ -412,7 +413,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Defines a string that labels the input for accessibility.
* @group Props
Expand Down Expand Up @@ -483,7 +484,7 @@ export class AutoComplete implements AfterViewChecked, AfterContentInit, OnDestr
* Index of the element in tabbing order.
* @group Props
*/
@Input() tabindex: number | undefined;
@Input({ transform: numberAttribute }) tabindex: number | undefined;
/**
* A property to uniquely identify a value in options.
* @group Props
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/blockui/blockui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
TemplateRef,
ViewChild,
ViewEncapsulation,
booleanAttribute
booleanAttribute,
numberAttribute
} from '@angular/core';
import { PrimeNGConfig, PrimeTemplate } from 'primeng/api';
import { DomHandler } from 'primeng/dom';
Expand Down Expand Up @@ -63,7 +64,7 @@ export class BlockUI implements AfterViewInit, OnDestroy {
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Class of the element.
* @group Props
Expand Down
13 changes: 7 additions & 6 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
Input,
NgModule,
NgZone,
numberAttribute,
OnDestroy,
OnInit,
Output,
Expand Down Expand Up @@ -603,17 +604,17 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
* Hours to change per step.
* @group Props
*/
@Input() stepHour: number = 1;
@Input({ transform: numberAttribute }) stepHour: number = 1;
/**
* Minutes to change per step.
* @group Props
*/
@Input() stepMinute: number = 1;
@Input({ transform: numberAttribute }) stepMinute: number = 1;
/**
* Seconds to change per step.
* @group Props
*/
@Input() stepSecond: number = 1;
@Input({ transform: numberAttribute }) stepSecond: number = 1;
/**
* Whether to show the seconds in time picker.
* @group Props
Expand Down Expand Up @@ -653,7 +654,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
* Maximum number of selectable dates in multiple mode.
* @group Props
*/
@Input() maxDateCount: number | undefined;
@Input({ transform: numberAttribute }) maxDateCount: number | undefined;
/**
* Whether to display today and clear buttons at the footer
* @group Props
Expand All @@ -678,7 +679,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Style class of the datetimepicker container element.
* @group Props
Expand Down Expand Up @@ -728,7 +729,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
* Index of the element in tabbing order.
* @group Props
*/
@Input() tabindex: number | undefined;
@Input({ transform: numberAttribute }) tabindex: number | undefined;
/**
* The minimum selectable date.
* @group Props
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/carousel/carousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
TemplateRef,
ViewChild,
ViewEncapsulation,
booleanAttribute
booleanAttribute,
numberAttribute
} from '@angular/core';
import { Footer, Header, PrimeTemplate, SharedModule } from 'primeng/api';
import { ChevronDownIcon } from 'primeng/icons/chevrondown';
Expand Down Expand Up @@ -264,7 +265,7 @@ export class Carousel implements AfterContentInit {
* Time in milliseconds to scroll items automatically.
* @group Props
*/
@Input() autoplayInterval: number = 0;
@Input({ transform: numberAttribute }) autoplayInterval: number = 0;
/**
* Inline style of the component.
* @group Props
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/cascadeselect/cascadeselect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Inject,
Input,
NgModule,
numberAttribute,
OnInit,
Output,
QueryList,
Expand Down Expand Up @@ -113,7 +114,7 @@ export class CascadeSelectSub implements OnInit {

@Input() groupIconTemplate: Nullable<TemplateRef<any>>;

@Input() level: number = 0;
@Input({ transform: numberAttribute }) level: number = 0;

@Input() optionLabel: string | undefined;

Expand Down Expand Up @@ -438,7 +439,7 @@ export class CascadeSelect implements OnInit, AfterContentInit {
* Index of the element in tabbing order.
* @group Props
*/
@Input() tabindex: number | undefined = 0;
@Input({ transform: numberAttribute }) tabindex: number | undefined = 0;
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
* @group Props
Expand Down
21 changes: 19 additions & 2 deletions src/app/components/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import { CommonModule } from '@angular/common';
import { booleanAttribute, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, forwardRef, Input, NgModule, Output, QueryList, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core';
import {
booleanAttribute,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChildren,
ElementRef,
EventEmitter,
forwardRef,
Input,
NgModule,
numberAttribute,
Output,
QueryList,
TemplateRef,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import { ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR } from '@angular/forms';
import { PrimeTemplate, SharedModule } from 'primeng/api';
import { CheckIcon } from 'primeng/icons/check';
Expand Down Expand Up @@ -126,7 +143,7 @@ export class Checkbox implements ControlValueAccessor {
* Index of the element in tabbing order.
* @group Props
*/
@Input() tabindex: number | undefined;
@Input({ transform: numberAttribute }) tabindex: number | undefined;
/**
* Identifier of the focus input to match a label defined for the component.
* @group Props
Expand Down
7 changes: 4 additions & 3 deletions src/app/components/chips/chips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
ViewChild,
ViewEncapsulation,
booleanAttribute,
forwardRef
forwardRef,
numberAttribute
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { PrimeTemplate, SharedModule } from 'primeng/api';
Expand Down Expand Up @@ -157,7 +158,7 @@ export class Chips implements AfterContentInit, ControlValueAccessor {
* Maximum number of entries allowed.
* @group Props
*/
@Input() max: number | undefined;
@Input({ transform: numberAttribute }) max: number | undefined;
/**
* Defines a string that labels the input for accessibility.
* @group Props
Expand All @@ -172,7 +173,7 @@ export class Chips implements AfterContentInit, ControlValueAccessor {
* Index of the element in tabbing order.
* @group Props
*/
@Input() tabindex: number | undefined;
@Input({ transform: numberAttribute }) tabindex: number | undefined;
/**
* Identifier of the focus input to match a label defined for the component.
* @group Props
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/colorpicker/colorpicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
ViewChild,
ViewEncapsulation,
booleanAttribute,
forwardRef
forwardRef,
numberAttribute
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { OverlayService, PrimeNGConfig } from 'primeng/api';
Expand Down Expand Up @@ -144,7 +145,7 @@ export class ColorPicker implements ControlValueAccessor, OnDestroy {
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Transition options of the show animation.
* @group Props
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/confirmdialog/confirmdialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
ViewChild,
ViewEncapsulation,
ViewRef,
booleanAttribute
booleanAttribute,
numberAttribute
} from '@angular/core';
import { ConfirmEventType, Confirmation, ConfirmationService, Footer, PrimeNGConfig, PrimeTemplate, SharedModule, TranslationKeys } from 'primeng/api';
import { ButtonModule } from 'primeng/button';
Expand Down Expand Up @@ -274,7 +275,7 @@ export class ConfirmDialog implements AfterContentInit, OnInit, OnDestroy {
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Transition options of the animation.
* @group Props
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/confirmpopup/confirmpopup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
Renderer2,
TemplateRef,
ViewEncapsulation,
booleanAttribute
booleanAttribute,
numberAttribute
} from '@angular/core';
import { Confirmation, ConfirmationService, OverlayService, PrimeNGConfig, PrimeTemplate, SharedModule, TranslationKeys } from 'primeng/api';
import { ButtonModule } from 'primeng/button';
Expand Down Expand Up @@ -144,7 +145,7 @@ export class ConfirmPopup implements AfterContentInit, OnDestroy {
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Inline style of the component.
* @group Props
Expand Down
11 changes: 6 additions & 5 deletions src/app/components/contextmenu/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
booleanAttribute,
effect,
forwardRef,
numberAttribute,
signal
} from '@angular/core';
import { RouterModule } from '@angular/router';
Expand Down Expand Up @@ -206,7 +207,7 @@ export class ContextMenuSub {

@Input({ transform: booleanAttribute }) autoZIndex: boolean = true;

@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;

@Input({ transform: booleanAttribute }) popup: boolean | undefined;

Expand All @@ -216,13 +217,13 @@ export class ContextMenuSub {

@Input() ariaLabelledBy: string | undefined;

@Input() level: number = 0;
@Input({ transform: numberAttribute }) level: number = 0;

@Input() focusedItemId: string | undefined;

@Input() activeItemPath: any[];

@Input() tabindex: number = 0;
@Input({ transform: numberAttribute }) tabindex: number = 0;

@Output() itemClick: EventEmitter<any> = new EventEmitter();

Expand Down Expand Up @@ -436,7 +437,7 @@ export class ContextMenu implements OnInit, AfterContentInit, OnDestroy {
* Base zIndex value to use in layering.
* @group Props
*/
@Input() baseZIndex: number = 0;
@Input({ transform: numberAttribute }) baseZIndex: number = 0;
/**
* Current id state as a string.
* @group Props
Expand All @@ -456,7 +457,7 @@ export class ContextMenu implements OnInit, AfterContentInit, OnDestroy {
* Press delay in touch devices as miliseconds.
* @group Props
*/
@Input() pressDelay: number | undefined = 500;
@Input({ transform: numberAttribute }) pressDelay: number | undefined = 500;
/**
* Callback to invoke when overlay menu is shown.
* @group Emits
Expand Down
Loading

0 comments on commit b3e91c7

Please sign in to comment.