@@ -55,14 +55,15 @@ import {TemplatePortal} from '@angular/cdk/portal';
5555import { _getEventTarget } from '@angular/cdk/platform' ;
5656import { ENTER , ESCAPE , hasModifierKey , TAB } from '@angular/cdk/keycodes' ;
5757import { _IdGenerator , ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
58+ import { Subscription } from 'rxjs' ;
5859import {
5960 generateOptions ,
6061 MAT_TIMEPICKER_CONFIG ,
6162 MatTimepickerOption ,
6263 parseInterval ,
6364 validateAdapter ,
6465} from './util' ;
65- import { Subscription } from 'rxjs ' ;
66+ import { MatTimepickerOptionTemplate } from './timepicker-option ' ;
6667
6768/** Event emitted when a value is selected in the timepicker. */
6869export interface MatTimepickerSelected < D > {
@@ -129,31 +130,33 @@ export interface MatTimepickerConnectedInput<D> {
129130 ] ,
130131} )
131132export class MatTimepicker < D > implements OnDestroy , MatOptionParentComponent {
132- private _dir = inject ( Directionality , { optional : true } ) ;
133- private _viewContainerRef = inject ( ViewContainerRef ) ;
134- private _injector = inject ( Injector ) ;
135- private _defaultConfig = inject ( MAT_TIMEPICKER_CONFIG , { optional : true } ) ;
136- private _dateAdapter = inject < DateAdapter < D > > ( DateAdapter , { optional : true } ) ! ;
137- private _dateFormats = inject ( MAT_DATE_FORMATS , { optional : true } ) ! ;
138- private _scrollStrategyFactory = inject ( MAT_TIMEPICKER_SCROLL_STRATEGY ) ;
139- protected _animationsDisabled = _animationsDisabled ( ) ;
140-
141- private _isOpen = signal ( false ) ;
142- private _activeDescendant = signal < string | null > ( null ) ;
143-
144- private _input = signal < MatTimepickerConnectedInput < D > | null > ( null ) ;
133+ private readonly _dir = inject ( Directionality , { optional : true } ) ;
134+ private readonly _viewContainerRef = inject ( ViewContainerRef ) ;
135+ private readonly _injector = inject ( Injector ) ;
136+ private readonly _defaultConfig = inject ( MAT_TIMEPICKER_CONFIG , { optional : true } ) ;
137+ private readonly _dateAdapter = inject < DateAdapter < D > > ( DateAdapter , { optional : true } ) ! ;
138+ private readonly _dateFormats = inject ( MAT_DATE_FORMATS , { optional : true } ) ! ;
139+ private readonly _scrollStrategyFactory = inject ( MAT_TIMEPICKER_SCROLL_STRATEGY ) ;
140+ protected readonly _animationsDisabled = _animationsDisabled ( ) ;
141+
142+ private readonly _isOpen = signal ( false ) ;
143+ private readonly _activeDescendant = signal < string | null > ( null ) ;
144+
145+ private readonly _input = signal < MatTimepickerConnectedInput < D > | null > ( null ) ;
145146 private _overlayRef : OverlayRef | null = null ;
146147 private _portal : TemplatePortal < unknown > | null = null ;
147148 private _optionsCacheKey : string | null = null ;
148149 private _localeChanges : Subscription ;
149150 private _onOpenRender : AfterRenderRef | null = null ;
150151
151- protected _panelTemplate = viewChild . required < TemplateRef < unknown > > ( 'panelTemplate' ) ;
152152 protected _timeOptions : readonly MatTimepickerOption < D > [ ] = [ ] ;
153- protected _options = viewChildren ( MatOption ) ;
154- protected _optionTemplate = contentChild < TemplateRef < MatTimepickerOption < D > > > ( TemplateRef ) ;
153+ protected readonly _panelTemplate = viewChild . required < TemplateRef < unknown > > ( 'panelTemplate' ) ;
154+ protected readonly _options = viewChildren ( MatOption ) ;
155+ protected readonly _optionTemplate = contentChild < MatTimepickerOptionTemplate < D > > (
156+ MatTimepickerOptionTemplate ,
157+ ) ;
155158
156- private _keyManager = new ActiveDescendantKeyManager ( this . _options , this . _injector )
159+ private readonly _keyManager = new ActiveDescendantKeyManager ( this . _options , this . _injector )
157160 . withHomeAndEnd ( true )
158161 . withPageUpDown ( true )
159162 . withVerticalOrientation ( true ) ;
@@ -172,48 +175,43 @@ export class MatTimepicker<D> implements OnDestroy, MatOptionParentComponent {
172175 * Array of pre-defined options that the user can select from, as an alternative to using the
173176 * `interval` input. An error will be thrown if both `options` and `interval` are specified.
174177 */
175- readonly options : InputSignal < readonly MatTimepickerOption < D > [ ] | null > = input <
176- readonly MatTimepickerOption < D > [ ] | null
177- > ( null ) ;
178+ readonly options = input < readonly MatTimepickerOption < D > [ ] | null > ( null ) ;
178179
179180 /** Whether the timepicker is open. */
180- readonly isOpen : Signal < boolean > = this . _isOpen . asReadonly ( ) ;
181+ readonly isOpen = this . _isOpen . asReadonly ( ) ;
181182
182183 /** Emits when the user selects a time. */
183- readonly selected : OutputEmitterRef < MatTimepickerSelected < D > > = output ( ) ;
184+ readonly selected = output < MatTimepickerSelected < D > > ( ) ;
184185
185186 /** Emits when the timepicker is opened. */
186- readonly opened : OutputEmitterRef < void > = output ( ) ;
187+ readonly opened = output ( ) ;
187188
188189 /** Emits when the timepicker is closed. */
189- readonly closed : OutputEmitterRef < void > = output ( ) ;
190+ readonly closed = output ( ) ;
190191
191192 /** ID of the active descendant option. */
192- readonly activeDescendant : Signal < string | null > = this . _activeDescendant . asReadonly ( ) ;
193+ readonly activeDescendant = this . _activeDescendant . asReadonly ( ) ;
193194
194195 /** Unique ID of the timepicker's panel */
195- readonly panelId : string = inject ( _IdGenerator ) . getId ( 'mat-timepicker-panel-' ) ;
196+ readonly panelId = inject ( _IdGenerator ) . getId ( 'mat-timepicker-panel-' ) ;
196197
197198 /** Whether ripples within the timepicker should be disabled. */
198- readonly disableRipple : InputSignalWithTransform < boolean , unknown > = input (
199- this . _defaultConfig ?. disableRipple ?? false ,
200- {
201- transform : booleanAttribute ,
202- } ,
203- ) ;
199+ readonly disableRipple = input ( this . _defaultConfig ?. disableRipple ?? false , {
200+ transform : booleanAttribute ,
201+ } ) ;
204202
205203 /** ARIA label for the timepicker panel. */
206- readonly ariaLabel : InputSignal < string | null > = input < string | null > ( null , {
204+ readonly ariaLabel = input < string | null > ( null , {
207205 alias : 'aria-label' ,
208206 } ) ;
209207
210208 /** ID of the label element for the timepicker panel. */
211- readonly ariaLabelledby : InputSignal < string | null > = input < string | null > ( null , {
209+ readonly ariaLabelledby = input < string | null > ( null , {
212210 alias : 'aria-labelledby' ,
213211 } ) ;
214212
215213 /** Whether the timepicker is currently disabled. */
216- readonly disabled : Signal < boolean > = computed ( ( ) => ! ! this . _input ( ) ?. disabled ( ) ) ;
214+ readonly disabled = computed ( ( ) => ! ! this . _input ( ) ?. disabled ( ) ) ;
217215
218216 constructor ( ) {
219217 if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
0 commit comments