From f662736b078f351ef75f28bad45040494d182772 Mon Sep 17 00:00:00 2001 From: Tony Samperi Date: Mon, 11 Dec 2023 20:39:42 +0100 Subject: [PATCH] v17.0.2 * Fix time not preserved in picker when "appendToInput" is true --- changelog.md | 6 +++ package.json | 2 +- .../app/components/demo/demo.component.html | 2 - projects/ngx-mat-timepicker/package.json | 2 +- ...ngx-mat-timepicker-standalone.component.ts | 2 +- .../ngx-mat-timepicker.component.ts | 42 ++++++++++++------- 6 files changed, 35 insertions(+), 21 deletions(-) diff --git a/changelog.md b/changelog.md index c73d310..1a10e74 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,15 @@ +#17.0.2 +* Fix time not preserved in picker when "appendToInput" is true (fixes [#93](https://github.com/tonysamperi/ngx-mat-timepicker/issues/93)) + #17.0.1 * Fix disabled clock buttons appearance (fixes [#94](https://github.com/tonysamperi/ngx-mat-timepicker/issues/94)) #17.0.0 * Update for Angular 17! 🎉 +#16.1.3 +* Fix time not preserved in picker when "appendToInput" is true (fixes [#93](https://github.com/tonysamperi/ngx-mat-timepicker/issues/93)) + #16.1.2 * Fix weird behaviours caused by multiple pickers in same page (fixes [#29](https://github.com/tonysamperi/ngx-mat-timepicker/issues/29)) diff --git a/package.json b/package.json index 4fab523..20ec90f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mat-timepicker-repo", - "version": "17.0.1", + "version": "17.0.2", "build": 0, "license": "MIT", "private": true, diff --git a/projects/ngx-mat-timepicker-repo/src/app/components/demo/demo.component.html b/projects/ngx-mat-timepicker-repo/src/app/components/demo/demo.component.html index 0fa6143..339b42c 100644 --- a/projects/ngx-mat-timepicker-repo/src/app/components/demo/demo.component.html +++ b/projects/ngx-mat-timepicker-repo/src/app/components/demo/demo.component.html @@ -318,7 +318,6 @@

Append to input

[format]="24" [(ngModel)]="selectedTimes.D" [ngxMatTimepicker]="pickerD" - [defaultValue]="selectedTimes.D" placeholder="23:59" readonly /> Append to input ngx-mat-timepicker is here diff --git a/projects/ngx-mat-timepicker/package.json b/projects/ngx-mat-timepicker/package.json index 840fbb9..b5fa159 100644 --- a/projects/ngx-mat-timepicker/package.json +++ b/projects/ngx-mat-timepicker/package.json @@ -1,6 +1,6 @@ { "name": "ngx-mat-timepicker", - "version": "17.0.1", + "version": "17.0.2", "license": "MIT", "description": "ngx-mat-timepicker is an Angular material 9+ extension to add time pickers!", "homepage": "https://tonysamperi.github.io/ngx-mat-timepicker", diff --git a/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker-standalone/ngx-mat-timepicker-standalone.component.ts b/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker-standalone/ngx-mat-timepicker-standalone.component.ts index 0b22b60..c638d81 100644 --- a/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker-standalone/ngx-mat-timepicker-standalone.component.ts +++ b/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker-standalone/ngx-mat-timepicker-standalone.component.ts @@ -55,7 +55,7 @@ export class NgxMatTimepickerStandaloneComponent extends NgxMatTimepickerBaseDir timepickerSrv: NgxMatTimepickerService, eventSrv: NgxMatTimepickerEventService, timepickerLocaleSrv: NgxMatTimepickerLocaleService) { - + console.info("DEBUG", data); super(timepickerSrv, eventSrv, timepickerLocaleSrv, data); } diff --git a/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker/ngx-mat-timepicker.component.ts b/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker/ngx-mat-timepicker.component.ts index 806a625..4d029eb 100644 --- a/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker/ngx-mat-timepicker.component.ts +++ b/projects/ngx-mat-timepicker/src/lib/components/ngx-mat-timepicker/ngx-mat-timepicker.component.ts @@ -1,13 +1,12 @@ import {coerceBooleanProperty} from "@angular/cdk/coercion"; import {Component, EventEmitter, HostBinding, Input, Output, TemplateRef} from "@angular/core"; -import { CdkOverlayOrigin, ConnectedPosition, Overlay, OverlayRef, CdkConnectedOverlay } from "@angular/cdk/overlay"; +import {CdkOverlayOrigin, ConnectedPosition, OverlayRef, CdkConnectedOverlay} from "@angular/cdk/overlay"; import {MatDialog, MatDialogRef} from "@angular/material/dialog"; import {ThemePalette} from "@angular/material/core"; // import {NgxMatTimepickerConfig} from "../../models/ngx-mat-timepicker-config.interface"; import {NgxMatTimepickerFormatType} from "../../models/ngx-mat-timepicker-format.type"; import {NgxMatTimepickerAdapter} from "../../services/ngx-mat-timepicker-adapter"; -import {NgxMatTimepickerEventService} from "../../services/ngx-mat-timepicker-event.service"; import {NgxMatTimepickerDirective} from "../../directives/ngx-mat-timepicker.directive"; import {NgxMatTimepickerRef} from "../../models/ngx-mat-timepicker-ref.interface"; import {NgxMatTimepickerDialogComponent} from "../ngx-mat-timepicker-dialog/ngx-mat-timepicker-dialog.component"; @@ -15,10 +14,29 @@ import {NGX_MAT_TIMEPICKER_CONFIG} from "../../tokens/ngx-mat-timepicker-config. // import {DateTime} from "ts-luxon"; import {BehaviorSubject} from "rxjs"; -import { NgxMatTimepickerStandaloneComponent } from "../ngx-mat-timepicker-standalone/ngx-mat-timepicker-standalone.component"; +import { + NgxMatTimepickerStandaloneComponent +} from "../ngx-mat-timepicker-standalone/ngx-mat-timepicker-standalone.component"; let config: NgxMatTimepickerConfig; +@Component({ + selector: "ngx-mat-timepicker-provider", + template: ``, + standalone: true, + providers: [ + { + provide: NGX_MAT_TIMEPICKER_CONFIG, + useFactory() { + return config; + } + } + ], + imports: [NgxMatTimepickerStandaloneComponent] +}) +export class NgxMatTimepickerProvider { +} + @Component({ selector: "ngx-mat-timepicker", template: ` @@ -30,17 +48,11 @@ let config: NgxMatTimepickerConfig; (backdropClick)="close()" [cdkConnectedOverlayOrigin]="overlayOrigin" [cdkConnectedOverlayOpen]="showPicker"> - - `, - providers: [ - { - provide: NGX_MAT_TIMEPICKER_CONFIG, useFactory() { - return config; - } - } - ], + + + `, standalone: true, - imports: [CdkConnectedOverlay, NgxMatTimepickerStandaloneComponent] + imports: [CdkConnectedOverlay, NgxMatTimepickerStandaloneComponent, NgxMatTimepickerProvider] }) export class NgxMatTimepickerComponent implements NgxMatTimepickerRef { @@ -160,9 +172,7 @@ export class NgxMatTimepickerComponent implements NgxMatTimepickerRef { private _overlayRef: OverlayRef; private _timepickerInput: NgxMatTimepickerDirective; - constructor(private _eventService: NgxMatTimepickerEventService, - private _dialog: MatDialog, - private _overlay: Overlay) { + constructor(private _dialog: MatDialog) { } close(): void {