@@ -20,11 +20,9 @@ import {
2020 InjectionToken ,
2121 Injector ,
2222 input ,
23- InputSignal ,
2423 InputSignalWithTransform ,
2524 OnDestroy ,
2625 output ,
27- OutputEmitterRef ,
2826 Signal ,
2927 signal ,
3028 TemplateRef ,
@@ -55,14 +53,15 @@ import {TemplatePortal} from '@angular/cdk/portal';
5553import { _getEventTarget } from '@angular/cdk/platform' ;
5654import { ENTER , ESCAPE , hasModifierKey , TAB } from '@angular/cdk/keycodes' ;
5755import { _IdGenerator , ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
56+ import { Subscription } from 'rxjs' ;
5857import {
5958 generateOptions ,
6059 MAT_TIMEPICKER_CONFIG ,
6160 MatTimepickerOption ,
6261 parseInterval ,
6362 validateAdapter ,
6463} from './util' ;
65- import { Subscription } from 'rxjs ' ;
64+ import { MatTimepickerOptionTemplate } from './timepicker-option ' ;
6665
6766/** Event emitted when a value is selected in the timepicker. */
6867export interface MatTimepickerSelected < D > {
@@ -129,31 +128,33 @@ export interface MatTimepickerConnectedInput<D> {
129128 ] ,
130129} )
131130export 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 ) ;
131+ private readonly _dir = inject ( Directionality , { optional : true } ) ;
132+ private readonly _viewContainerRef = inject ( ViewContainerRef ) ;
133+ private readonly _injector = inject ( Injector ) ;
134+ private readonly _defaultConfig = inject ( MAT_TIMEPICKER_CONFIG , { optional : true } ) ;
135+ private readonly _dateAdapter = inject < DateAdapter < D > > ( DateAdapter , { optional : true } ) ! ;
136+ private readonly _dateFormats = inject ( MAT_DATE_FORMATS , { optional : true } ) ! ;
137+ private readonly _scrollStrategyFactory = inject ( MAT_TIMEPICKER_SCROLL_STRATEGY ) ;
138+ protected readonly _animationsDisabled = _animationsDisabled ( ) ;
139+
140+ private readonly _isOpen = signal ( false ) ;
141+ private readonly _activeDescendant = signal < string | null > ( null ) ;
142+
143+ private readonly _input = signal < MatTimepickerConnectedInput < D > | null > ( null ) ;
145144 private _overlayRef : OverlayRef | null = null ;
146145 private _portal : TemplatePortal < unknown > | null = null ;
147146 private _optionsCacheKey : string | null = null ;
148147 private _localeChanges : Subscription ;
149148 private _onOpenRender : AfterRenderRef | null = null ;
150149
151- protected _panelTemplate = viewChild . required < TemplateRef < unknown > > ( 'panelTemplate' ) ;
152150 protected _timeOptions : readonly MatTimepickerOption < D > [ ] = [ ] ;
153- protected _options = viewChildren ( MatOption ) ;
154- protected _optionTemplate = contentChild < TemplateRef < MatTimepickerOption < D > > > ( TemplateRef ) ;
151+ protected readonly _panelTemplate = viewChild . required < TemplateRef < unknown > > ( 'panelTemplate' ) ;
152+ protected readonly _options = viewChildren ( MatOption ) ;
153+ protected readonly _optionTemplate = contentChild < MatTimepickerOptionTemplate < D > > (
154+ MatTimepickerOptionTemplate ,
155+ ) ;
155156
156- private _keyManager = new ActiveDescendantKeyManager ( this . _options , this . _injector )
157+ private readonly _keyManager = new ActiveDescendantKeyManager ( this . _options , this . _injector )
157158 . withHomeAndEnd ( true )
158159 . withPageUpDown ( true )
159160 . withVerticalOrientation ( true ) ;
@@ -172,48 +173,43 @@ export class MatTimepicker<D> implements OnDestroy, MatOptionParentComponent {
172173 * Array of pre-defined options that the user can select from, as an alternative to using the
173174 * `interval` input. An error will be thrown if both `options` and `interval` are specified.
174175 */
175- readonly options : InputSignal < readonly MatTimepickerOption < D > [ ] | null > = input <
176- readonly MatTimepickerOption < D > [ ] | null
177- > ( null ) ;
176+ readonly options = input < readonly MatTimepickerOption < D > [ ] | null > ( null ) ;
178177
179178 /** Whether the timepicker is open. */
180- readonly isOpen : Signal < boolean > = this . _isOpen . asReadonly ( ) ;
179+ readonly isOpen = this . _isOpen . asReadonly ( ) ;
181180
182181 /** Emits when the user selects a time. */
183- readonly selected : OutputEmitterRef < MatTimepickerSelected < D > > = output ( ) ;
182+ readonly selected = output < MatTimepickerSelected < D > > ( ) ;
184183
185184 /** Emits when the timepicker is opened. */
186- readonly opened : OutputEmitterRef < void > = output ( ) ;
185+ readonly opened = output ( ) ;
187186
188187 /** Emits when the timepicker is closed. */
189- readonly closed : OutputEmitterRef < void > = output ( ) ;
188+ readonly closed = output ( ) ;
190189
191190 /** ID of the active descendant option. */
192- readonly activeDescendant : Signal < string | null > = this . _activeDescendant . asReadonly ( ) ;
191+ readonly activeDescendant = this . _activeDescendant . asReadonly ( ) ;
193192
194193 /** Unique ID of the timepicker's panel */
195- readonly panelId : string = inject ( _IdGenerator ) . getId ( 'mat-timepicker-panel-' ) ;
194+ readonly panelId = inject ( _IdGenerator ) . getId ( 'mat-timepicker-panel-' ) ;
196195
197196 /** 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- ) ;
197+ readonly disableRipple = input ( this . _defaultConfig ?. disableRipple ?? false , {
198+ transform : booleanAttribute ,
199+ } ) ;
204200
205201 /** ARIA label for the timepicker panel. */
206- readonly ariaLabel : InputSignal < string | null > = input < string | null > ( null , {
202+ readonly ariaLabel = input < string | null > ( null , {
207203 alias : 'aria-label' ,
208204 } ) ;
209205
210206 /** ID of the label element for the timepicker panel. */
211- readonly ariaLabelledby : InputSignal < string | null > = input < string | null > ( null , {
207+ readonly ariaLabelledby = input < string | null > ( null , {
212208 alias : 'aria-labelledby' ,
213209 } ) ;
214210
215211 /** Whether the timepicker is currently disabled. */
216- readonly disabled : Signal < boolean > = computed ( ( ) => ! ! this . _input ( ) ?. disabled ( ) ) ;
212+ readonly disabled = computed ( ( ) => ! ! this . _input ( ) ?. disabled ( ) ) ;
217213
218214 constructor ( ) {
219215 if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
0 commit comments