diff --git a/projects/demo/src/app/app.routes.ts b/projects/demo/src/app/app.routes.ts index 0688ff6..8b28ef4 100644 --- a/projects/demo/src/app/app.routes.ts +++ b/projects/demo/src/app/app.routes.ts @@ -7,9 +7,4 @@ export const routes: Routes = [ loadComponent: () => import('./components/demo/demo.component').then((m) => m.DemoComponent), }, - { - path: 'test', - loadComponent: () => - import('./components/test/test.component').then((m) => m.TestComponent), - }, ]; diff --git a/projects/demo/src/app/components/demo/demo.component.html b/projects/demo/src/app/components/demo/demo.component.html index 7885a25..ca85ca7 100644 --- a/projects/demo/src/app/components/demo/demo.component.html +++ b/projects/demo/src/app/components/demo/demo.component.html @@ -1,28 +1,37 @@ - + {{ npmPackage }} + + + @if (isDark()) { + dark_mode + } @else { + light_mode + } + + format_color_fill - @for (theme of themes; track theme) { - - @if (selectedTheme.value === theme.value) { + @for (color of colors; track color.value) { + + @if (selectedColor() === color.value) { radio_button_checked } @else { radio_button_unchecked } - {{ theme.description }} + {{ color.description }} } @@ -34,9 +43,10 @@ +
an Angular material 17+ extension to add time pickers!
an Angular material 18+ extension to add time pickers!
Dynamic locale (v >= 12.2.0)
- @for (locale of myLocaleKeys; track locale; let last = $last) { - - {{ locale }} - - @if (!last) { - | +
- using default palette (primary) -
- -<mat-form-field> - <input matInput - name="selected_time_A" - [(ngModel)]="selectedTimes.A" - [ngxMatTimepicker]="pickerA" - placeholder="4:00 PM" - readonly /> - <mat-icon matSuffix - (click)="pickerA.open()"> - watch_later - </mat-icon> -</mat-form-field> -<ngx-mat-timepicker #pickerA></ngx-mat-timepicker> - -
-<mat-form-field> - <input matInput - name="selected_time_A" - [(ngModel)]="selectedTimes.A" - [ngxMatTimepicker]="pickerA" - placeholder="4:00 PM" - readonly /> - <mat-icon matSuffix - (click)="pickerA.open()"> - watch_later - </mat-icon> -</mat-form-field> -<ngx-mat-timepicker #pickerA></ngx-mat-timepicker> -
using accent palette
- -<mat-form-field> - <input matInput - name="selected_time_B" - format="24" - [(ngModel)]="selectedTimes.B" - [ngxMatTimepicker]="pickerB" - placeholder="16:00" - readonly /> - <mat-icon matSuffix - (click)="pickerB.open()"> - watch_later - </mat-icon> -</mat-form-field> -<ngx-mat-timepicker color="accent" - #pickerB></ngx-mat-timepicker> - -
-<mat-form-field> - <input matInput - name="selected_time_B" - format="24" - [(ngModel)]="selectedTimes.B" - [ngxMatTimepicker]="pickerB" - placeholder="16:00" - readonly /> - <mat-icon matSuffix - (click)="pickerB.open()"> - watch_later - </mat-icon> -</mat-form-field> -<ngx-mat-timepicker color="accent" - #pickerB></ngx-mat-timepicker> -
using warn palette
format = 12
format = 24
- -<ngx-mat-timepicker-field color="warn" - [format]="12" - [defaultTime]="'11:11 PM'"></ngx-mat-timepicker-field> - <ngx-mat-timepicker-field color="warn" - [format]="24" - [defaultTime]="'23:11'"></ngx-mat-timepicker-field> - -
-<ngx-mat-timepicker-field color="warn" - [format]="12" - [defaultTime]="'11:11 PM'"></ngx-mat-timepicker-field> - <ngx-mat-timepicker-field color="warn" - [format]="24" - [defaultTime]="'23:11'"></ngx-mat-timepicker-field> -
- using *ngIf to show/hide only the input, but not the - ngx-mat-timepicker -
- Before v 9.0.3, inputs weren't detached when destroyed, so you needed - to destroy the ngx-mat-timepicker as well. Not anymore. -
- -<mat-form-field *ngIf="showInput"> - <input matInput - name="selected_time" - [format]="24" - [(ngModel)]="selectedTimes.C" - [ngxMatTimepicker]="pickerC" - placeholder="12:00" - readonly /> - <mat-icon matSuffix - (click)="pickerC.open()"> - watch_later - </mat-icon> -</mat-form-field> -<button mat-raised-button - (click)="showInput = !showInput" - color="primary"> - {{showInput ? "Destroy" : "Restore"}} input -</button> -<div class="ngx-mtp-box-bordered"> - <small>ngx-mat-timepicker is here</small> - <ngx-mat-timepicker color="accent" - #pickerC></ngx-mat-timepicker> -</div> - -
-<mat-form-field *ngIf="showInput"> - <input matInput - name="selected_time" - [format]="24" - [(ngModel)]="selectedTimes.C" - [ngxMatTimepicker]="pickerC" - placeholder="12:00" - readonly /> - <mat-icon matSuffix - (click)="pickerC.open()"> - watch_later - </mat-icon> -</mat-form-field> -<button mat-raised-button - (click)="showInput = !showInput" - color="primary"> - {{showInput ? "Destroy" : "Restore"}} input -</button> -<div class="ngx-mtp-box-bordered"> - <small>ngx-mat-timepicker is here</small> - <ngx-mat-timepicker color="accent" - #pickerC></ngx-mat-timepicker> -</div> -
using appendToInput
- -<mat-form-field> - <input matInput - [format]="24" - [(ngModel)]="selectedTimes.D" - [ngxMatTimepicker]="pickerD" - placeholder="12:00" - readonly /> - <mat-icon matSuffix - (click)="pickerD.open()"> - watch_later - </mat-icon> -</mat-form-field> -<div class="ngx-mtp-box-bordered"> - <small>ngx-mat-timepicker is here</small> - <ngx-mat-timepicker color="accent" - appendToInput="true" - #pickerD></ngx-mat-timepicker> -</div> - -
-<mat-form-field> - <input matInput - [format]="24" - [(ngModel)]="selectedTimes.D" - [ngxMatTimepicker]="pickerD" - placeholder="12:00" - readonly /> - <mat-icon matSuffix - (click)="pickerD.open()"> - watch_later - </mat-icon> -</mat-form-field> -<div class="ngx-mtp-box-bordered"> - <small>ngx-mat-timepicker is here</small> - <ngx-mat-timepicker color="accent" - appendToInput="true" - #pickerD></ngx-mat-timepicker> -</div> -
use external button to open the picker
- -<mat-form-field> - <input matInput - [format]="24" - [(ngModel)]="selectedTimes.E" - [ngxMatTimepicker]="pickerE" - placeholder="12:00" - readonly /> - <mat-icon matSuffix - (click)="pickerE.open()"> - watch_later - </mat-icon> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerE.open()" - color="primary"> - Open picker -</button> - <ngx-mat-timepicker color="accent" - #pickerE></ngx-mat-timepicker> - -
-<mat-form-field> - <input matInput - [format]="24" - [(ngModel)]="selectedTimes.E" - [ngxMatTimepicker]="pickerE" - placeholder="12:00" - readonly /> - <mat-icon matSuffix - (click)="pickerE.open()"> - watch_later - </mat-icon> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerE.open()" - color="primary"> - Open picker -</button> - <ngx-mat-timepicker color="accent" - #pickerE></ngx-mat-timepicker> -
- use component in material stile (instead of using mat-icon + matSuffix) -
- -<mat-form-field> - <input matInput - [format]="24" - [(ngModel)]="selectedTimes.F" - [ngxMatTimepicker]="pickerF" - placeholder="12:00" - readonly /> - <ngx-mat-timepicker-toggle></ngx-mat-timepicker-toggle> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerF.open()" - color="primary"> - Open picker -</button> - <ngx-mat-timepicker color="accent" - #pickerF></ngx-mat-timepicker> - -
-<mat-form-field> - <input matInput - [format]="24" - [(ngModel)]="selectedTimes.F" - [ngxMatTimepicker]="pickerF" - placeholder="12:00" - readonly /> - <ngx-mat-timepicker-toggle></ngx-mat-timepicker-toggle> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerF.open()" - color="primary"> - Open picker -</button> - <ngx-mat-timepicker color="accent" - #pickerF></ngx-mat-timepicker> -
add config to have min and/or max hour
- -<mat-form-field> - <input matInput - name="selected_time_g" - [format]="12" - [max]="maxTime" - [min]="minTime" - [(ngModel)]="selectedTimes.G" - [ngxMatTimepicker]="pickerG" - placeholder="12:00" - readonly /> - <ngx-mat-timepicker-toggle matSuffix></ngx-mat-timepicker-toggle> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerG.open()" - color="primary"> - Open picker -</button> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="selectedTimes.G = '12:00'" - color="primary"> - Invalidate -</button> -<ngx-mat-timepicker color="accent" - #pickerG></ngx-mat-timepicker> - -
-<mat-form-field> - <input matInput - name="selected_time_g" - [format]="12" - [max]="maxTime" - [min]="minTime" - [(ngModel)]="selectedTimes.G" - [ngxMatTimepicker]="pickerG" - placeholder="12:00" - readonly /> - <ngx-mat-timepicker-toggle matSuffix></ngx-mat-timepicker-toggle> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerG.open()" - color="primary"> - Open picker -</button> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="selectedTimes.G = '12:00'" - color="primary"> - Invalidate -</button> -<ngx-mat-timepicker color="accent" - #pickerG></ngx-mat-timepicker> -
Don't link input to picker
- -<mat-form-field> - <input matInput - [pattern]="timeRegex" - name="selected_time_h" - #inputModel="ngModel" - [(ngModel)]="selectedTimeFreeInput" - (blur)="inputModel.valid && selectedTimeFreeInputChanged(selectedTimeFreeInput)" - placeholder="12:00" /> - <mat-error *ngIf="inputModel.hasError('pattern')">Expected format: H:mm AM|PM</mat-error> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerH.open()" - color="primary"> - Open picker -</button> -<ngx-mat-timepicker (timeSet)="updateTime($event, 'selectedTimeFreeInput')" - #pickerH></ngx-mat-timepicker> - -
-<mat-form-field> - <input matInput - [pattern]="timeRegex" - name="selected_time_h" - #inputModel="ngModel" - [(ngModel)]="selectedTimeFreeInput" - (blur)="inputModel.valid && selectedTimeFreeInputChanged(selectedTimeFreeInput)" - placeholder="12:00" /> - <mat-error *ngIf="inputModel.hasError('pattern')">Expected format: H:mm AM|PM</mat-error> -</mat-form-field> -<button mat-raised-button - class="ngx-mtp-margin-top ngx-mtp-margin-bottom ngx-mtp-d-inline-block" - (click)="pickerH.open()" - color="primary"> - Open picker -</button> -<ngx-mat-timepicker (timeSet)="updateTime($event, 'selectedTimeFreeInput')" - #pickerH></ngx-mat-timepicker> -
Go to the docs!