@angular/material 19.1.0-next.1 → 19.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/index.d.ts +5 -5
- package/button/index.d.ts +2 -0
- package/core/index.d.ts +1 -0
- package/core/theming/_theming.scss +1 -1
- package/datepicker/index.d.ts +1 -0
- package/expansion/index.d.ts +11 -8
- package/fesm2022/autocomplete.mjs +54 -50
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +10 -10
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +10 -10
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +10 -10
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +39 -37
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +14 -14
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips.mjs +40 -40
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +73 -75
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +104 -111
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +25 -25
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion.mjs +114 -105
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +39 -37
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input.mjs +26 -32
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list.mjs +58 -55
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +219 -192
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +40 -31
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +12 -10
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio.mjs +15 -14
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +24 -13
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +28 -27
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +14 -14
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +38 -39
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +22 -22
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +59 -70
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +58 -66
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +58 -41
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +54 -76
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/index.d.ts +1 -0
- package/input/index.d.ts +8 -5
- package/list/index.d.ts +2 -0
- package/menu/index.d.ts +20 -19
- package/package.json +2 -2
- package/paginator/index.d.ts +8 -0
- package/progress-bar/index.d.ts +2 -0
- package/radio/index.d.ts +4 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/theme-color/index_bundled.js +2 -2
- package/schematics/ng-update/index_bundled.js +31 -31
- package/select/index.d.ts +15 -2
- package/sidenav/index.d.ts +1 -0
- package/slider/index.d.ts +4 -1
- package/tabs/index.d.ts +4 -2
- package/timepicker/index.d.ts +4 -0
- package/tooltip/index.d.ts +4 -5
package/fesm2022/timepicker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ViewContainerRef, Injector, signal, viewChild, viewChildren, input, output, booleanAttribute, effect, ElementRef, afterNextRender, untracked, Component, ChangeDetectionStrategy, ViewEncapsulation,
|
|
2
|
+
import { InjectionToken, inject, ViewContainerRef, Injector, signal, viewChild, viewChildren, input, output, booleanAttribute, computed, effect, ElementRef, afterNextRender, untracked, Component, ChangeDetectionStrategy, ViewEncapsulation, model, Renderer2, Directive, HostAttributeToken, NgModule } from '@angular/core';
|
|
3
3
|
import { trigger, state, style, transition, group, animate } from '@angular/animations';
|
|
4
4
|
import { DateAdapter, MAT_DATE_FORMATS, MatOption, MAT_OPTION_PARENT_COMPONENT } from '@angular/material/core';
|
|
5
5
|
import { Directionality } from '@angular/cdk/bidi';
|
|
@@ -107,7 +107,7 @@ class MatTimepicker {
|
|
|
107
107
|
_dateFormats = inject(MAT_DATE_FORMATS, { optional: true });
|
|
108
108
|
_isOpen = signal(false);
|
|
109
109
|
_activeDescendant = signal(null);
|
|
110
|
-
_input;
|
|
110
|
+
_input = signal(null);
|
|
111
111
|
_overlayRef = null;
|
|
112
112
|
_portal = null;
|
|
113
113
|
_optionsCacheKey = null;
|
|
@@ -155,6 +155,8 @@ class MatTimepicker {
|
|
|
155
155
|
ariaLabelledby = input(null, {
|
|
156
156
|
alias: 'aria-labelledby',
|
|
157
157
|
});
|
|
158
|
+
/** Whether the timepicker is currently disabled. */
|
|
159
|
+
disabled = computed(() => !!this._input()?.disabled());
|
|
158
160
|
constructor() {
|
|
159
161
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
160
162
|
validateAdapter(this._dateAdapter, this._dateFormats);
|
|
@@ -178,26 +180,27 @@ class MatTimepicker {
|
|
|
178
180
|
}
|
|
179
181
|
/** Opens the timepicker. */
|
|
180
182
|
open() {
|
|
181
|
-
|
|
183
|
+
const input = this._input();
|
|
184
|
+
if (!input) {
|
|
182
185
|
return;
|
|
183
186
|
}
|
|
184
187
|
// Focus should already be on the input, but this call is in case the timepicker is opened
|
|
185
188
|
// programmatically. We need to call this even if the timepicker is already open, because
|
|
186
189
|
// the user might be clicking the toggle.
|
|
187
|
-
|
|
190
|
+
input.focus();
|
|
188
191
|
if (this._isOpen()) {
|
|
189
192
|
return;
|
|
190
193
|
}
|
|
191
194
|
this._isOpen.set(true);
|
|
192
195
|
this._generateOptions();
|
|
193
196
|
const overlayRef = this._getOverlayRef();
|
|
194
|
-
overlayRef.updateSize({ width:
|
|
197
|
+
overlayRef.updateSize({ width: input.getOverlayOrigin().nativeElement.offsetWidth });
|
|
195
198
|
this._portal ??= new TemplatePortal(this._panelTemplate(), this._viewContainerRef);
|
|
196
199
|
overlayRef.attach(this._portal);
|
|
197
200
|
this._onOpenRender?.destroy();
|
|
198
201
|
this._onOpenRender = afterNextRender(() => {
|
|
199
202
|
const options = this._options();
|
|
200
|
-
this._syncSelectedState(
|
|
203
|
+
this._syncSelectedState(input.value(), options, options[0]);
|
|
201
204
|
this._onOpenRender = null;
|
|
202
205
|
}, { injector: this._injector });
|
|
203
206
|
this.opened.emit();
|
|
@@ -212,10 +215,11 @@ class MatTimepicker {
|
|
|
212
215
|
}
|
|
213
216
|
/** Registers an input with the timepicker. */
|
|
214
217
|
registerInput(input) {
|
|
215
|
-
|
|
218
|
+
const currentInput = this._input();
|
|
219
|
+
if (currentInput && input !== currentInput && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
216
220
|
throw new Error('MatTimepicker can only be registered with one input at a time');
|
|
217
221
|
}
|
|
218
|
-
this._input
|
|
222
|
+
this._input.set(input);
|
|
219
223
|
}
|
|
220
224
|
ngOnDestroy() {
|
|
221
225
|
this._keyManager.destroy();
|
|
@@ -227,14 +231,14 @@ class MatTimepicker {
|
|
|
227
231
|
_selectValue(value) {
|
|
228
232
|
this.close();
|
|
229
233
|
this.selected.emit({ value, source: this });
|
|
230
|
-
this._input
|
|
234
|
+
this._input()?.focus();
|
|
231
235
|
}
|
|
232
236
|
/** Gets the value of the `aria-labelledby` attribute. */
|
|
233
237
|
_getAriaLabelledby() {
|
|
234
238
|
if (this.ariaLabel()) {
|
|
235
239
|
return null;
|
|
236
240
|
}
|
|
237
|
-
return this.ariaLabelledby() || this._input?._getLabelId() || null;
|
|
241
|
+
return this.ariaLabelledby() || this._input()?._getLabelId() || null;
|
|
238
242
|
}
|
|
239
243
|
/** Creates an overlay reference for the timepicker panel. */
|
|
240
244
|
_getOverlayRef() {
|
|
@@ -243,7 +247,7 @@ class MatTimepicker {
|
|
|
243
247
|
}
|
|
244
248
|
const positionStrategy = this._overlay
|
|
245
249
|
.position()
|
|
246
|
-
.flexibleConnectedTo(this._input.getOverlayOrigin())
|
|
250
|
+
.flexibleConnectedTo(this._input().getOverlayOrigin())
|
|
247
251
|
.withFlexibleDimensions(false)
|
|
248
252
|
.withPush(false)
|
|
249
253
|
.withTransformOriginOn('.mat-timepicker-panel')
|
|
@@ -273,8 +277,8 @@ class MatTimepicker {
|
|
|
273
277
|
});
|
|
274
278
|
this._overlayRef.outsidePointerEvents().subscribe(event => {
|
|
275
279
|
const target = _getEventTarget(event);
|
|
276
|
-
const origin = this._input
|
|
277
|
-
if (target && target !== origin && !origin.contains(target)) {
|
|
280
|
+
const origin = this._input()?.getOverlayOrigin().nativeElement;
|
|
281
|
+
if (target && origin && target !== origin && !origin.contains(target)) {
|
|
278
282
|
this.close();
|
|
279
283
|
}
|
|
280
284
|
});
|
|
@@ -289,10 +293,11 @@ class MatTimepicker {
|
|
|
289
293
|
this._timeOptions = options;
|
|
290
294
|
}
|
|
291
295
|
else {
|
|
296
|
+
const input = this._input();
|
|
292
297
|
const adapter = this._dateAdapter;
|
|
293
298
|
const timeFormat = this._dateFormats.display.timeInput;
|
|
294
|
-
const min =
|
|
295
|
-
const max =
|
|
299
|
+
const min = input?.min() || adapter.setTime(adapter.today(), 0, 0, 0);
|
|
300
|
+
const max = input?.max() || adapter.setTime(adapter.today(), 23, 59, 0);
|
|
296
301
|
const cacheKey = interval + '/' + adapter.format(min, timeFormat) + '/' + adapter.format(max, timeFormat);
|
|
297
302
|
// Don't re-generate the options if the inputs haven't changed.
|
|
298
303
|
if (cacheKey !== this._optionsCacheKey) {
|
|
@@ -375,20 +380,20 @@ class MatTimepicker {
|
|
|
375
380
|
*/
|
|
376
381
|
_handleInputStateChanges() {
|
|
377
382
|
effect(() => {
|
|
378
|
-
const
|
|
383
|
+
const input = this._input();
|
|
379
384
|
const options = this._options();
|
|
380
|
-
if (this._isOpen()) {
|
|
381
|
-
this._syncSelectedState(value, options, null);
|
|
385
|
+
if (this._isOpen() && input) {
|
|
386
|
+
this._syncSelectedState(input.value(), options, null);
|
|
382
387
|
}
|
|
383
388
|
});
|
|
384
389
|
}
|
|
385
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
386
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.
|
|
390
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
391
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0-next.3", type: MatTimepicker, isStandalone: true, selector: "mat-timepicker", inputs: { interval: { classPropertyName: "interval", publicName: "interval", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, disableRipple: { classPropertyName: "disableRipple", publicName: "disableRipple", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected", opened: "opened", closed: "closed" }, providers: [
|
|
387
392
|
{
|
|
388
393
|
provide: MAT_OPTION_PARENT_COMPONENT,
|
|
389
394
|
useExisting: MatTimepicker,
|
|
390
395
|
},
|
|
391
|
-
], viewQueries: [{ propertyName: "_panelTemplate", first: true, predicate: ["panelTemplate"], descendants: true, isSignal: true }, { propertyName: "_options", predicate: MatOption, descendants: true, isSignal: true }], exportAs: ["matTimepicker"], ngImport: i0, template: "<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n class=\"mat-timepicker-panel\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"_getAriaLabelledby()\"\n [id]=\"panelId\"\n @panel>\n @for (option of _timeOptions; track option.value) {\n <mat-option\n [value]=\"option.value\"\n (onSelectionChange)=\"_selectValue(option.value)\">{{option.label}}</mat-option>\n }\n </div>\n</ng-template>\n", styles: ["mat-timepicker{display:none}.mat-timepicker-panel{width:100%;max-height:256px;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;border-bottom-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-bottom-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-timepicker-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-timepicker-container-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){.mat-timepicker-panel{outline:solid 1px}}.mat-timepicker-above .mat-timepicker-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-top-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small))}.mat-timepicker-input
|
|
396
|
+
], viewQueries: [{ propertyName: "_panelTemplate", first: true, predicate: ["panelTemplate"], descendants: true, isSignal: true }, { propertyName: "_options", predicate: MatOption, descendants: true, isSignal: true }], exportAs: ["matTimepicker"], ngImport: i0, template: "<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n class=\"mat-timepicker-panel\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"_getAriaLabelledby()\"\n [id]=\"panelId\"\n @panel>\n @for (option of _timeOptions; track option.value) {\n <mat-option\n [value]=\"option.value\"\n (onSelectionChange)=\"_selectValue(option.value)\">{{option.label}}</mat-option>\n }\n </div>\n</ng-template>\n", styles: ["mat-timepicker{display:none}.mat-timepicker-panel{width:100%;max-height:256px;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;border-bottom-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-bottom-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-timepicker-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-timepicker-container-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){.mat-timepicker-panel{outline:solid 1px}}.mat-timepicker-above .mat-timepicker-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-top-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small))}.mat-timepicker-input[readonly]{cursor:pointer}@media(forced-colors: active){.mat-timepicker-toggle-default-icon{color:CanvasText}}"], dependencies: [{ kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }], animations: [
|
|
392
397
|
trigger('panel', [
|
|
393
398
|
state('void', style({ opacity: 0, transform: 'scaleY(0.8)' })),
|
|
394
399
|
transition(':enter', [
|
|
@@ -401,7 +406,7 @@ class MatTimepicker {
|
|
|
401
406
|
]),
|
|
402
407
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
403
408
|
}
|
|
404
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepicker, decorators: [{
|
|
405
410
|
type: Component,
|
|
406
411
|
args: [{ selector: 'mat-timepicker', exportAs: 'matTimepicker', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [MatOption], providers: [
|
|
407
412
|
{
|
|
@@ -419,7 +424,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
419
424
|
]),
|
|
420
425
|
transition(':leave', [animate('0.075s linear', style({ opacity: 0 }))]),
|
|
421
426
|
]),
|
|
422
|
-
], template: "<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n class=\"mat-timepicker-panel\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"_getAriaLabelledby()\"\n [id]=\"panelId\"\n @panel>\n @for (option of _timeOptions; track option.value) {\n <mat-option\n [value]=\"option.value\"\n (onSelectionChange)=\"_selectValue(option.value)\">{{option.label}}</mat-option>\n }\n </div>\n</ng-template>\n", styles: ["mat-timepicker{display:none}.mat-timepicker-panel{width:100%;max-height:256px;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;border-bottom-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-bottom-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-timepicker-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-timepicker-container-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){.mat-timepicker-panel{outline:solid 1px}}.mat-timepicker-above .mat-timepicker-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-top-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small))}.mat-timepicker-input
|
|
427
|
+
], template: "<ng-template #panelTemplate>\n <div\n role=\"listbox\"\n class=\"mat-timepicker-panel\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"_getAriaLabelledby()\"\n [id]=\"panelId\"\n @panel>\n @for (option of _timeOptions; track option.value) {\n <mat-option\n [value]=\"option.value\"\n (onSelectionChange)=\"_selectValue(option.value)\">{{option.label}}</mat-option>\n }\n </div>\n</ng-template>\n", styles: ["mat-timepicker{display:none}.mat-timepicker-panel{width:100%;max-height:256px;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;border-bottom-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-bottom-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-timepicker-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-timepicker-container-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){.mat-timepicker-panel{outline:solid 1px}}.mat-timepicker-above .mat-timepicker-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small));border-top-right-radius:var(--mat-timepicker-container-shape, var(--mat-sys-corner-extra-small))}.mat-timepicker-input[readonly]{cursor:pointer}@media(forced-colors: active){.mat-timepicker-toggle-default-icon{color:CanvasText}}"] }]
|
|
423
428
|
}], ctorParameters: () => [] });
|
|
424
429
|
/**
|
|
425
430
|
* Scrolls an option into view.
|
|
@@ -442,6 +447,7 @@ class MatTimepickerInput {
|
|
|
442
447
|
_onChange;
|
|
443
448
|
_onTouched;
|
|
444
449
|
_validatorOnChange;
|
|
450
|
+
_cleanupClick;
|
|
445
451
|
_accessorDisabled = signal(false);
|
|
446
452
|
_localeSubscription;
|
|
447
453
|
_timepickerSubscription;
|
|
@@ -498,6 +504,7 @@ class MatTimepickerInput {
|
|
|
498
504
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
499
505
|
validateAdapter(this._dateAdapter, this._dateFormats);
|
|
500
506
|
}
|
|
507
|
+
const renderer = inject(Renderer2);
|
|
501
508
|
this._validator = this._getValidator();
|
|
502
509
|
this._respondToValueChanges();
|
|
503
510
|
this._respondToMinMaxChanges();
|
|
@@ -509,14 +516,18 @@ class MatTimepickerInput {
|
|
|
509
516
|
});
|
|
510
517
|
// Bind the click listener manually to the overlay origin, because we want the entire
|
|
511
518
|
// form field to be clickable, if the timepicker is used in `mat-form-field`.
|
|
512
|
-
this.getOverlayOrigin().nativeElement
|
|
519
|
+
this._cleanupClick = renderer.listen(this.getOverlayOrigin().nativeElement, 'click', this._handleClick);
|
|
513
520
|
}
|
|
514
521
|
/**
|
|
515
522
|
* Implemented as a part of `ControlValueAccessor`.
|
|
516
523
|
* @docs-private
|
|
517
524
|
*/
|
|
518
525
|
writeValue(value) {
|
|
519
|
-
|
|
526
|
+
// Note that we need to deserialize here, rather than depend on the value change effect,
|
|
527
|
+
// because `getValidDateOrNull` will clobber the value if it's parseable, but not created by
|
|
528
|
+
// the current adapter (see #30140).
|
|
529
|
+
const deserialized = this._dateAdapter.deserialize(value);
|
|
530
|
+
this.value.set(this._dateAdapter.getValidDateOrNull(deserialized));
|
|
520
531
|
}
|
|
521
532
|
/**
|
|
522
533
|
* Implemented as a part of `ControlValueAccessor`.
|
|
@@ -562,7 +573,7 @@ class MatTimepickerInput {
|
|
|
562
573
|
this._elementRef.nativeElement.focus();
|
|
563
574
|
}
|
|
564
575
|
ngOnDestroy() {
|
|
565
|
-
this.
|
|
576
|
+
this._cleanupClick();
|
|
566
577
|
this._timepickerSubscription?.unsubscribe();
|
|
567
578
|
this._localeSubscription.unsubscribe();
|
|
568
579
|
}
|
|
@@ -572,7 +583,9 @@ class MatTimepickerInput {
|
|
|
572
583
|
}
|
|
573
584
|
/** Handles clicks on the input or the containing form field. */
|
|
574
585
|
_handleClick = () => {
|
|
575
|
-
this.
|
|
586
|
+
if (!this.disabled()) {
|
|
587
|
+
this.timepicker().open();
|
|
588
|
+
}
|
|
576
589
|
};
|
|
577
590
|
/** Handles the `input` event. */
|
|
578
591
|
_handleInput(value) {
|
|
@@ -601,7 +614,7 @@ class MatTimepickerInput {
|
|
|
601
614
|
/** Handles the `keydown` event. */
|
|
602
615
|
_handleKeydown(event) {
|
|
603
616
|
// All keyboard events while open are handled through the timepicker.
|
|
604
|
-
if (this.timepicker().isOpen()) {
|
|
617
|
+
if (this.timepicker().isOpen() || this.disabled()) {
|
|
605
618
|
return;
|
|
606
619
|
}
|
|
607
620
|
if (event.keyCode === ESCAPE && !hasModifierKey(event) && this.value() !== null) {
|
|
@@ -609,7 +622,7 @@ class MatTimepickerInput {
|
|
|
609
622
|
this.value.set(null);
|
|
610
623
|
this._formatValue(null);
|
|
611
624
|
}
|
|
612
|
-
else if (
|
|
625
|
+
else if (event.keyCode === DOWN_ARROW || event.keyCode === UP_ARROW) {
|
|
613
626
|
event.preventDefault();
|
|
614
627
|
this.timepicker().open();
|
|
615
628
|
}
|
|
@@ -725,8 +738,8 @@ class MatTimepickerInput {
|
|
|
725
738
|
},
|
|
726
739
|
]);
|
|
727
740
|
}
|
|
728
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
729
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.
|
|
741
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
742
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.0-next.3", type: MatTimepickerInput, isStandalone: true, selector: "input[matTimepicker]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, timepicker: { classPropertyName: "timepicker", publicName: "matTimepicker", isSignal: true, isRequired: true, transformFunction: null }, min: { classPropertyName: "min", publicName: "matTimepickerMin", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "matTimepickerMax", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "combobox", "type": "text", "aria-haspopup": "listbox" }, listeners: { "blur": "_handleBlur()", "input": "_handleInput($event.target.value)", "keydown": "_handleKeydown($event)" }, properties: { "attr.aria-activedescendant": "_ariaActiveDescendant()", "attr.aria-expanded": "_ariaExpanded()", "attr.aria-controls": "_ariaControls()", "attr.mat-timepicker-id": "timepicker()?.panelId", "disabled": "disabled()" }, classAttribute: "mat-timepicker-input" }, providers: [
|
|
730
743
|
{
|
|
731
744
|
provide: NG_VALUE_ACCESSOR,
|
|
732
745
|
useExisting: MatTimepickerInput,
|
|
@@ -743,7 +756,7 @@ class MatTimepickerInput {
|
|
|
743
756
|
},
|
|
744
757
|
], exportAs: ["matTimepickerInput"], ngImport: i0 });
|
|
745
758
|
}
|
|
746
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
759
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerInput, decorators: [{
|
|
747
760
|
type: Directive,
|
|
748
761
|
args: [{
|
|
749
762
|
selector: 'input[matTimepicker]',
|
|
@@ -789,6 +802,10 @@ class MatTimepickerToggle {
|
|
|
789
802
|
const parsed = Number(value);
|
|
790
803
|
return isNaN(parsed) ? null : parsed;
|
|
791
804
|
})();
|
|
805
|
+
_isDisabled = computed(() => {
|
|
806
|
+
const timepicker = this.timepicker();
|
|
807
|
+
return this.disabled() || timepicker.disabled();
|
|
808
|
+
});
|
|
792
809
|
/** Timepicker instance that the button will toggle. */
|
|
793
810
|
timepicker = input.required({
|
|
794
811
|
alias: 'for',
|
|
@@ -808,15 +825,15 @@ class MatTimepickerToggle {
|
|
|
808
825
|
disableRipple = input(this._defaultConfig?.disableRipple ?? false, { transform: booleanAttribute });
|
|
809
826
|
/** Opens the connected timepicker. */
|
|
810
827
|
_open(event) {
|
|
811
|
-
if (this.timepicker() && !this.
|
|
828
|
+
if (this.timepicker() && !this._isDisabled()) {
|
|
812
829
|
this.timepicker().open();
|
|
813
830
|
event.stopPropagation();
|
|
814
831
|
}
|
|
815
832
|
}
|
|
816
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
817
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.
|
|
833
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerToggle, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
834
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.0-next.3", type: MatTimepickerToggle, isStandalone: true, selector: "mat-timepicker-toggle", inputs: { timepicker: { classPropertyName: "timepicker", publicName: "for", isSignal: true, isRequired: true, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, disableRipple: { classPropertyName: "disableRipple", publicName: "disableRipple", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "_open($event)" }, properties: { "attr.tabindex": "null" }, classAttribute: "mat-timepicker-toggle" }, exportAs: ["matTimepickerToggle"], ngImport: i0, template: "<button\n mat-icon-button\n type=\"button\"\n aria-haspopup=\"listbox\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-expanded]=\"timepicker().isOpen()\"\n [attr.tabindex]=\"_isDisabled() ? -1 : tabIndex()\"\n [disabled]=\"_isDisabled()\"\n [disableRipple]=\"disableRipple()\">\n\n <ng-content select=\"[matTimepickerToggleIcon]\">\n <svg\n class=\"mat-timepicker-toggle-default-icon\"\n height=\"24px\"\n width=\"24px\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n focusable=\"false\"\n aria-hidden=\"true\">\n <path d=\"m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z\"/>\n </svg>\n </ng-content>\n</button>\n", dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
818
835
|
}
|
|
819
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
836
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerToggle, decorators: [{
|
|
820
837
|
type: Component,
|
|
821
838
|
args: [{ selector: 'mat-timepicker-toggle', host: {
|
|
822
839
|
'class': 'mat-timepicker-toggle',
|
|
@@ -825,15 +842,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
825
842
|
// `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
|
|
826
843
|
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
827
844
|
'(click)': '_open($event)',
|
|
828
|
-
}, exportAs: 'matTimepickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIconButton], template: "<button\n mat-icon-button\n type=\"button\"\n aria-haspopup=\"listbox\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-expanded]=\"timepicker().isOpen()\"\n [attr.tabindex]=\"
|
|
845
|
+
}, exportAs: 'matTimepickerToggle', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatIconButton], template: "<button\n mat-icon-button\n type=\"button\"\n aria-haspopup=\"listbox\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-expanded]=\"timepicker().isOpen()\"\n [attr.tabindex]=\"_isDisabled() ? -1 : tabIndex()\"\n [disabled]=\"_isDisabled()\"\n [disableRipple]=\"disableRipple()\">\n\n <ng-content select=\"[matTimepickerToggleIcon]\">\n <svg\n class=\"mat-timepicker-toggle-default-icon\"\n height=\"24px\"\n width=\"24px\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n focusable=\"false\"\n aria-hidden=\"true\">\n <path d=\"m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z\"/>\n </svg>\n </ng-content>\n</button>\n" }]
|
|
829
846
|
}] });
|
|
830
847
|
|
|
831
848
|
class MatTimepickerModule {
|
|
832
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
833
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.
|
|
834
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.
|
|
849
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
850
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerModule, imports: [MatTimepicker, MatTimepickerInput, MatTimepickerToggle], exports: [CdkScrollableModule, MatTimepicker, MatTimepickerInput, MatTimepickerToggle] });
|
|
851
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerModule, imports: [MatTimepicker, MatTimepickerToggle, CdkScrollableModule] });
|
|
835
852
|
}
|
|
836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.3", ngImport: i0, type: MatTimepickerModule, decorators: [{
|
|
837
854
|
type: NgModule,
|
|
838
855
|
args: [{
|
|
839
856
|
imports: [MatTimepicker, MatTimepickerInput, MatTimepickerToggle],
|