| 81 | ], |
| 82 | }) |
| 83 | export class MatTimepickerInput<D> |
| 84 | implements MatTimepickerConnectedInput<D>, ControlValueAccessor, Validator, OnDestroy |
| 85 | { |
| 86 | private _elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef); |
| 87 | private _dateAdapter = inject<DateAdapter<D>>(DateAdapter, {optional: true})!; |
| 88 | private _dateFormats = inject(MAT_DATE_FORMATS, {optional: true})!; |
| 89 | private _formField = inject(MAT_FORM_FIELD, {optional: true}); |
| 90 | |
| 91 | private _onChange: ((value: unknown) => void) | undefined; |
| 92 | private _onTouched: (() => void) | undefined; |
| 93 | private _validatorOnChange: (() => void) | undefined; |
| 94 | private _cleanupClick: () => void; |
| 95 | private _accessorDisabled = signal(false); |
| 96 | private _localeSubscription: Subscription; |
| 97 | private _timepickerSubscription: OutputRefSubscription | undefined; |
| 98 | private _validator: ValidatorFn; |
| 99 | private _lastValueValid = true; |
| 100 | private _minValid = true; |
| 101 | private _maxValid = true; |
| 102 | private _lastValidDate: D | null = null; |
| 103 | |
| 104 | /** Value of the `aria-activedescendant` attribute. */ |
| 105 | protected readonly _ariaActiveDescendant = computed(() => { |
| 106 | const timepicker = this.timepicker(); |
| 107 | const isOpen = timepicker.isOpen(); |
| 108 | const activeDescendant = timepicker.activeDescendant(); |
| 109 | return isOpen && activeDescendant ? activeDescendant : null; |
| 110 | }); |
| 111 | |
| 112 | /** Value of the `aria-expanded` attribute. */ |
| 113 | protected readonly _ariaExpanded = computed(() => this.timepicker().isOpen() + ''); |
| 114 | |
| 115 | /** Value of the `aria-controls` attribute. */ |
| 116 | protected readonly _ariaControls = computed(() => { |
| 117 | const timepicker = this.timepicker(); |
| 118 | return timepicker.isOpen() ? timepicker.panelId : null; |
| 119 | }); |
| 120 | |
| 121 | /** Current value of the input. */ |
| 122 | readonly value: ModelSignal<D | null> = model<D | null>(null); |
| 123 | |
| 124 | /** Timepicker that the input is associated with. */ |
| 125 | readonly timepicker: InputSignal<MatTimepicker<D>> = input.required<MatTimepicker<D>>({ |
| 126 | alias: 'matTimepicker', |
| 127 | }); |
| 128 | |
| 129 | /** |
| 130 | * Minimum time that can be selected or typed in. Can be either |
| 131 | * a date object (only time will be used) or a valid time string. |
| 132 | */ |
| 133 | readonly min: InputSignalWithTransform<D | null, unknown> = input(null, { |
| 134 | alias: 'matTimepickerMin', |
| 135 | transform: (value: unknown) => this._transformDateInput<D>(value), |
| 136 | }); |
| 137 | |
| 138 | /** |
| 139 | * Maximum time that can be selected or typed in. Can be either |
| 140 | * a date object (only time will be used) or a valid time string. |
nothing calls this directly
no test coverage detected
searching dependent graphs…