MCPcopy Index your code
hub / github.com/angular/components / MatTimepicker

Class MatTimepicker

src/material/timepicker/timepicker.ts:127–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 ],
126})
127export class MatTimepicker<D> implements OnDestroy, MatOptionParentComponent {
128 private _dir = inject(Directionality, {optional: true});
129 private _viewContainerRef = inject(ViewContainerRef);
130 private _injector = inject(Injector);
131 private _defaultConfig = inject(MAT_TIMEPICKER_CONFIG, {optional: true});
132 private _dateAdapter = inject<DateAdapter<D>>(DateAdapter, {optional: true})!;
133 private _dateFormats = inject(MAT_DATE_FORMATS, {optional: true})!;
134 private _scrollStrategyFactory = inject(MAT_TIMEPICKER_SCROLL_STRATEGY);
135 protected _animationsDisabled = _animationsDisabled();
136
137 private _isOpen = signal(false);
138 private _activeDescendant = signal<string | null>(null);
139
140 private _input = signal<MatTimepickerConnectedInput<D> | null>(null);
141 private _overlayRef: OverlayRef | null = null;
142 private _portal: TemplatePortal<unknown> | null = null;
143 private _optionsCacheKey: string | null = null;
144 private _localeChanges: Subscription | undefined;
145 private _onOpenRender: AfterRenderRef | null = null;
146
147 protected _panelTemplate = viewChild.required<TemplateRef<unknown>>('panelTemplate');
148 protected _timeOptions: readonly MatTimepickerOption<D>[] = [];
149 protected _options = viewChildren(MatOption);
150
151 private _keyManager = new ActiveDescendantKeyManager(this._options, this._injector)
152 .withHomeAndEnd(true)
153 .withPageUpDown(true)
154 .withVerticalOrientation(true);
155
156 /**
157 * Interval between each option in the timepicker. The value can either be an amount of
158 * seconds (e.g. 90) or a number with a unit (e.g. 45m). Supported units are `s` for seconds,
159 * `m` for minutes or `h` for hours.
160 */
161 readonly interval: InputSignalWithTransform<number | null, number | string | null> = input(
162 parseInterval(this._defaultConfig?.interval || null),
163 {transform: parseInterval},
164 );
165
166 /**
167 * Array of pre-defined options that the user can select from, as an alternative to using the
168 * `interval` input. An error will be thrown if both `options` and `interval` are specified.
169 */
170 readonly options: InputSignal<readonly MatTimepickerOption<D>[] | null> = input<
171 readonly MatTimepickerOption<D>[] | null
172 >(null);
173
174 /** Whether the timepicker is open. */
175 readonly isOpen: Signal<boolean> = this._isOpen.asReadonly();
176
177 /** Emits when the user selects a time. */
178 readonly selected: OutputEmitterRef<MatTimepickerSelected<D>> = output();
179
180 /** Emits when the timepicker is opened. */
181 readonly opened: OutputEmitterRef<void> = output();
182
183 /** Emits when the timepicker is closed. */
184 readonly closed: OutputEmitterRef<void> = output();

Callers

nothing calls this directly

Calls 12

_animationsDisabledFunction · 0.90
parseIntervalFunction · 0.90
signalFunction · 0.85
inputFunction · 0.85
computedFunction · 0.85
withPageUpDownMethod · 0.80
withHomeAndEndMethod · 0.80
asReadonlyMethod · 0.80
requiredMethod · 0.45
getIdMethod · 0.45
disabledMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…