@angular/material 19.1.0-next.0 → 19.1.0-next.2
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/expansion/index.d.ts +9 -8
- package/fesm2022/autocomplete.mjs +13 -13
- 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 +38 -27
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +34 -34
- 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 +66 -66
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +82 -82
- 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 +112 -105
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +34 -34
- 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 +7 -7
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list.mjs +49 -49
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +57 -72
- 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 +7 -7
- 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 +10 -10
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +24 -13
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +22 -22
- 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 +16 -16
- 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 +98 -210
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +44 -43
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +54 -39
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/menu/index.d.ts +6 -0
- package/package.json +2 -2
- package/paginator/index.d.ts +8 -0
- package/radio/index.d.ts +2 -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 +50 -41
- package/schematics/ng-update/index_bundled.js.map +2 -2
- package/select/index.d.ts +15 -2
- package/sort/index.d.ts +15 -48
- package/timepicker/index.d.ts +3 -0
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, 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.2", ngImport: i0, type: MatTimepicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
391
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0-next.2", 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.2", 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.
|
|
@@ -516,7 +521,11 @@ class MatTimepickerInput {
|
|
|
516
521
|
* @docs-private
|
|
517
522
|
*/
|
|
518
523
|
writeValue(value) {
|
|
519
|
-
|
|
524
|
+
// Note that we need to deserialize here, rather than depend on the value change effect,
|
|
525
|
+
// because `getValidDateOrNull` will clobber the value if it's parseable, but not created by
|
|
526
|
+
// the current adapter (see #30140).
|
|
527
|
+
const deserialized = this._dateAdapter.deserialize(value);
|
|
528
|
+
this.value.set(this._dateAdapter.getValidDateOrNull(deserialized));
|
|
520
529
|
}
|
|
521
530
|
/**
|
|
522
531
|
* Implemented as a part of `ControlValueAccessor`.
|
|
@@ -572,7 +581,9 @@ class MatTimepickerInput {
|
|
|
572
581
|
}
|
|
573
582
|
/** Handles clicks on the input or the containing form field. */
|
|
574
583
|
_handleClick = () => {
|
|
575
|
-
this.
|
|
584
|
+
if (!this.disabled()) {
|
|
585
|
+
this.timepicker().open();
|
|
586
|
+
}
|
|
576
587
|
};
|
|
577
588
|
/** Handles the `input` event. */
|
|
578
589
|
_handleInput(value) {
|
|
@@ -601,7 +612,7 @@ class MatTimepickerInput {
|
|
|
601
612
|
/** Handles the `keydown` event. */
|
|
602
613
|
_handleKeydown(event) {
|
|
603
614
|
// All keyboard events while open are handled through the timepicker.
|
|
604
|
-
if (this.timepicker().isOpen()) {
|
|
615
|
+
if (this.timepicker().isOpen() || this.disabled()) {
|
|
605
616
|
return;
|
|
606
617
|
}
|
|
607
618
|
if (event.keyCode === ESCAPE && !hasModifierKey(event) && this.value() !== null) {
|
|
@@ -609,7 +620,7 @@ class MatTimepickerInput {
|
|
|
609
620
|
this.value.set(null);
|
|
610
621
|
this._formatValue(null);
|
|
611
622
|
}
|
|
612
|
-
else if (
|
|
623
|
+
else if (event.keyCode === DOWN_ARROW || event.keyCode === UP_ARROW) {
|
|
613
624
|
event.preventDefault();
|
|
614
625
|
this.timepicker().open();
|
|
615
626
|
}
|
|
@@ -725,8 +736,8 @@ class MatTimepickerInput {
|
|
|
725
736
|
},
|
|
726
737
|
]);
|
|
727
738
|
}
|
|
728
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
729
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.
|
|
739
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerInput, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
740
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.0-next.2", 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
741
|
{
|
|
731
742
|
provide: NG_VALUE_ACCESSOR,
|
|
732
743
|
useExisting: MatTimepickerInput,
|
|
@@ -743,7 +754,7 @@ class MatTimepickerInput {
|
|
|
743
754
|
},
|
|
744
755
|
], exportAs: ["matTimepickerInput"], ngImport: i0 });
|
|
745
756
|
}
|
|
746
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerInput, decorators: [{
|
|
747
758
|
type: Directive,
|
|
748
759
|
args: [{
|
|
749
760
|
selector: 'input[matTimepicker]',
|
|
@@ -789,6 +800,10 @@ class MatTimepickerToggle {
|
|
|
789
800
|
const parsed = Number(value);
|
|
790
801
|
return isNaN(parsed) ? null : parsed;
|
|
791
802
|
})();
|
|
803
|
+
_isDisabled = computed(() => {
|
|
804
|
+
const timepicker = this.timepicker();
|
|
805
|
+
return this.disabled() || timepicker.disabled();
|
|
806
|
+
});
|
|
792
807
|
/** Timepicker instance that the button will toggle. */
|
|
793
808
|
timepicker = input.required({
|
|
794
809
|
alias: 'for',
|
|
@@ -808,15 +823,15 @@ class MatTimepickerToggle {
|
|
|
808
823
|
disableRipple = input(this._defaultConfig?.disableRipple ?? false, { transform: booleanAttribute });
|
|
809
824
|
/** Opens the connected timepicker. */
|
|
810
825
|
_open(event) {
|
|
811
|
-
if (this.timepicker() && !this.
|
|
826
|
+
if (this.timepicker() && !this._isDisabled()) {
|
|
812
827
|
this.timepicker().open();
|
|
813
828
|
event.stopPropagation();
|
|
814
829
|
}
|
|
815
830
|
}
|
|
816
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.
|
|
817
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.
|
|
831
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerToggle, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
832
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.0-next.2", 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
833
|
}
|
|
819
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
834
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerToggle, decorators: [{
|
|
820
835
|
type: Component,
|
|
821
836
|
args: [{ selector: 'mat-timepicker-toggle', host: {
|
|
822
837
|
'class': 'mat-timepicker-toggle',
|
|
@@ -825,15 +840,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
825
840
|
// `stopPropagation` on it without affecting the user's `click` handlers. We need to stop
|
|
826
841
|
// it so that the input doesn't get focused automatically by the form field (See #21836).
|
|
827
842
|
'(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]=\"
|
|
843
|
+
}, 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
844
|
}] });
|
|
830
845
|
|
|
831
846
|
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.
|
|
847
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
848
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerModule, imports: [MatTimepicker, MatTimepickerInput, MatTimepickerToggle], exports: [CdkScrollableModule, MatTimepicker, MatTimepickerInput, MatTimepickerToggle] });
|
|
849
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerModule, imports: [MatTimepicker, MatTimepickerToggle, CdkScrollableModule] });
|
|
835
850
|
}
|
|
836
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.
|
|
851
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-next.2", ngImport: i0, type: MatTimepickerModule, decorators: [{
|
|
837
852
|
type: NgModule,
|
|
838
853
|
args: [{
|
|
839
854
|
imports: [MatTimepicker, MatTimepickerInput, MatTimepickerToggle],
|