@angular/material 21.0.0-next.8 → 21.0.0-rc.0
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/core/tokens/_classes.scss +1 -1
- package/core/tokens/m2/_md-sys-color.scss +17 -17
- package/fesm2022/_animation-chunk.mjs +10 -16
- package/fesm2022/_animation-chunk.mjs.map +1 -1
- package/fesm2022/_date-formats-chunk.mjs +68 -164
- package/fesm2022/_date-formats-chunk.mjs.map +1 -1
- package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
- package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_error-options-chunk.mjs +56 -19
- package/fesm2022/_error-options-chunk.mjs.map +1 -1
- package/fesm2022/_error-state-chunk.mjs +24 -31
- package/fesm2022/_error-state-chunk.mjs.map +1 -1
- package/fesm2022/_form-field-chunk.mjs +1224 -1017
- package/fesm2022/_form-field-chunk.mjs.map +1 -1
- package/fesm2022/_icon-button-chunk.mjs +243 -187
- package/fesm2022/_icon-button-chunk.mjs.map +1 -1
- package/fesm2022/_icon-registry-chunk.mjs +350 -575
- package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
- package/fesm2022/_input-harness-chunk.mjs +56 -107
- package/fesm2022/_input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
- package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
- package/fesm2022/_internal-form-field-chunk.mjs +59 -19
- package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
- package/fesm2022/_line-chunk.mjs +83 -43
- package/fesm2022/_line-chunk.mjs.map +1 -1
- package/fesm2022/_option-chunk.mjs +348 -311
- package/fesm2022/_option-chunk.mjs.map +1 -1
- package/fesm2022/_option-harness-chunk.mjs +23 -39
- package/fesm2022/_option-harness-chunk.mjs.map +1 -1
- package/fesm2022/_option-module-chunk.mjs +36 -10
- package/fesm2022/_option-module-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
- package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
- package/fesm2022/_public-api-chunk.mjs +71 -134
- package/fesm2022/_public-api-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-chunk.mjs +504 -600
- package/fesm2022/_ripple-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-loader-chunk.mjs +120 -138
- package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-module-chunk.mjs +36 -10
- package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
- package/fesm2022/_structural-styles-chunk.mjs +37 -10
- package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
- package/fesm2022/_tooltip-chunk.mjs +810 -888
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/autocomplete-testing.mjs +62 -86
- package/fesm2022/autocomplete-testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +965 -1126
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge-testing.mjs +38 -54
- package/fesm2022/badge-testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +321 -272
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet-testing.mjs +10 -24
- package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +349 -344
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-testing.mjs +60 -94
- package/fesm2022/button-testing.mjs.map +1 -1
- package/fesm2022/button-toggle-testing.mjs +76 -125
- package/fesm2022/button-toggle-testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +752 -662
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +263 -158
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card-testing.mjs +19 -33
- package/fesm2022/card-testing.mjs.map +1 -1
- package/fesm2022/card.mjs +576 -272
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox-testing.mjs +71 -123
- package/fesm2022/checkbox-testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +515 -477
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips-testing.mjs +201 -350
- package/fesm2022/chips-testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +2552 -2289
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core-testing.mjs +14 -28
- package/fesm2022/core-testing.mjs.map +1 -1
- package/fesm2022/core.mjs +357 -328
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker-testing.mjs +15 -25
- package/fesm2022/datepicker-testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +4826 -4563
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog-testing.mjs +93 -129
- package/fesm2022/dialog-testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +810 -829
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider-testing.mjs +10 -11
- package/fesm2022/divider-testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +119 -43
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion-testing.mjs +74 -130
- package/fesm2022/expansion-testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +703 -515
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field-testing-control.mjs +16 -33
- package/fesm2022/form-field-testing-control.mjs.map +1 -1
- package/fesm2022/form-field-testing.mjs +118 -179
- package/fesm2022/form-field-testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -10
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list-testing.mjs +65 -113
- package/fesm2022/grid-list-testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +559 -494
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon-testing.mjs +148 -127
- package/fesm2022/icon-testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +325 -351
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input-testing.mjs +59 -99
- package/fesm2022/input-testing.mjs.map +1 -1
- package/fesm2022/input.mjs +457 -520
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list-testing.mjs +251 -434
- package/fesm2022/list-testing.mjs.map +1 -1
- package/fesm2022/list.mjs +1522 -1204
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/material.mjs +0 -5
- package/fesm2022/material.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +159 -228
- package/fesm2022/menu-testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +1338 -1343
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator-testing.mjs +55 -79
- package/fesm2022/paginator-testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +381 -309
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar-testing.mjs +12 -21
- package/fesm2022/progress-bar-testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +224 -169
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner-testing.mjs +13 -23
- package/fesm2022/progress-spinner-testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +235 -160
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio-testing.mjs +133 -208
- package/fesm2022/radio-testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +712 -679
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select-testing.mjs +83 -117
- package/fesm2022/select-testing.mjs.map +1 -1
- package/fesm2022/select.mjs +1116 -1246
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav-testing.mjs +54 -120
- package/fesm2022/sidenav-testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +1078 -995
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle-testing.mjs +57 -92
- package/fesm2022/slide-toggle-testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +369 -279
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider-testing.mjs +90 -138
- package/fesm2022/slider-testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +1651 -1716
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar-testing.mjs +40 -87
- package/fesm2022/snack-bar-testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +763 -714
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort-testing.mjs +45 -66
- package/fesm2022/sort-testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +419 -344
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper-testing.mjs +78 -154
- package/fesm2022/stepper-testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +790 -498
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table-testing.mjs +125 -186
- package/fesm2022/table-testing.mjs.map +1 -1
- package/fesm2022/table.mjs +1026 -684
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +125 -197
- package/fesm2022/tabs-testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +2351 -2028
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker-testing.mjs +113 -172
- package/fesm2022/timepicker-testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +1019 -826
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +16 -27
- package/fesm2022/toolbar-testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +163 -78
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip-testing.mjs +41 -52
- package/fesm2022/tooltip-testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +36 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +86 -162
- package/fesm2022/tree-testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +638 -466
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/types/expansion.d.ts +4 -2
- package/types/menu-testing.d.ts +2 -0
- package/types/select.d.ts +1 -1
- package/types/sort.d.ts +1 -1
- package/types/table-testing.d.ts +27 -1
- package/types/timepicker.d.ts +148 -128
|
@@ -8,340 +8,377 @@ import { MatPseudoCheckbox } from './_pseudo-checkbox-chunk.mjs';
|
|
|
8
8
|
import { _StructuralStylesLoader } from './_structural-styles-chunk.mjs';
|
|
9
9
|
import { _CdkPrivateStyleLoader, _VisuallyHiddenLoader } from '@angular/cdk/private';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Injection token used to provide the parent component to options.
|
|
13
|
-
*/
|
|
14
11
|
const MAT_OPTION_PARENT_COMPONENT = new InjectionToken('MAT_OPTION_PARENT_COMPONENT');
|
|
15
12
|
|
|
16
|
-
// Notes on the accessibility pattern used for `mat-optgroup`.
|
|
17
|
-
// The option group has two different "modes": regular and inert. The regular mode uses the
|
|
18
|
-
// recommended a11y pattern which has `role="group"` on the group element with `aria-labelledby`
|
|
19
|
-
// pointing to the label. This works for `mat-select`, but it seems to hit a bug for autocomplete
|
|
20
|
-
// under VoiceOver where the group doesn't get read out at all. The bug appears to be that if
|
|
21
|
-
// there's __any__ a11y-related attribute on the group (e.g. `role` or `aria-labelledby`),
|
|
22
|
-
// VoiceOver on Safari won't read it out.
|
|
23
|
-
// We've introduced the `inert` mode as a workaround. Under this mode, all a11y attributes are
|
|
24
|
-
// removed from the group, and we get the screen reader to read out the group label by mirroring it
|
|
25
|
-
// inside an invisible element in the option. This is sub-optimal, because the screen reader will
|
|
26
|
-
// repeat the group label on each navigation, whereas the default pattern only reads the group when
|
|
27
|
-
// the user enters a new group. The following alternate approaches were considered:
|
|
28
|
-
// 1. Reading out the group label using the `LiveAnnouncer` solves the problem, but we can't control
|
|
29
|
-
// when the text will be read out so sometimes it comes in too late or never if the user
|
|
30
|
-
// navigates quickly.
|
|
31
|
-
// 2. `<mat-option aria-describedby="groupLabel"` - This works on Safari, but VoiceOver in Chrome
|
|
32
|
-
// won't read out the description at all.
|
|
33
|
-
// 3. `<mat-option aria-labelledby="optionLabel groupLabel"` - This works on Chrome, but Safari
|
|
34
|
-
// doesn't read out the text at all. Furthermore, on
|
|
35
|
-
/**
|
|
36
|
-
* Injection token that can be used to reference instances of `MatOptgroup`. It serves as
|
|
37
|
-
* alternative token to the actual `MatOptgroup` class which could cause unnecessary
|
|
38
|
-
* retention of the class and its component metadata.
|
|
39
|
-
*/
|
|
40
13
|
const MAT_OPTGROUP = new InjectionToken('MatOptgroup');
|
|
41
|
-
/**
|
|
42
|
-
* Component that is used to group instances of `mat-option`.
|
|
43
|
-
*/
|
|
44
14
|
class MatOptgroup {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
15
|
+
label;
|
|
16
|
+
disabled = false;
|
|
17
|
+
_labelId = inject(_IdGenerator).getId('mat-optgroup-label-');
|
|
18
|
+
_inert;
|
|
19
|
+
constructor() {
|
|
20
|
+
const parent = inject(MAT_OPTION_PARENT_COMPONENT, {
|
|
21
|
+
optional: true
|
|
22
|
+
});
|
|
23
|
+
this._inert = parent?.inertGroups ?? false;
|
|
24
|
+
}
|
|
25
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
26
|
+
minVersion: "12.0.0",
|
|
27
|
+
version: "20.2.0-next.2",
|
|
28
|
+
ngImport: i0,
|
|
29
|
+
type: MatOptgroup,
|
|
30
|
+
deps: [],
|
|
31
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
32
|
+
});
|
|
33
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
34
|
+
minVersion: "16.1.0",
|
|
35
|
+
version: "20.2.0-next.2",
|
|
36
|
+
type: MatOptgroup,
|
|
37
|
+
isStandalone: true,
|
|
38
|
+
selector: "mat-optgroup",
|
|
39
|
+
inputs: {
|
|
40
|
+
label: "label",
|
|
41
|
+
disabled: ["disabled", "disabled", booleanAttribute]
|
|
42
|
+
},
|
|
43
|
+
host: {
|
|
44
|
+
properties: {
|
|
45
|
+
"attr.role": "_inert ? null : \"group\"",
|
|
46
|
+
"attr.aria-disabled": "_inert ? null : disabled.toString()",
|
|
47
|
+
"attr.aria-labelledby": "_inert ? null : _labelId"
|
|
48
|
+
},
|
|
49
|
+
classAttribute: "mat-mdc-optgroup"
|
|
50
|
+
},
|
|
51
|
+
providers: [{
|
|
52
|
+
provide: MAT_OPTGROUP,
|
|
53
|
+
useExisting: MatOptgroup
|
|
54
|
+
}],
|
|
55
|
+
exportAs: ["matOptgroup"],
|
|
56
|
+
ngImport: i0,
|
|
57
|
+
template: "<span\n class=\"mat-mdc-optgroup-label\"\n role=\"presentation\"\n [class.mdc-list-item--disabled]=\"disabled\"\n [id]=\"_labelId\">\n <span class=\"mdc-list-item__primary-text\">{{ label }} <ng-content></ng-content></span>\n</span>\n\n<ng-content select=\"mat-option, ng-container\"></ng-content>\n",
|
|
58
|
+
styles: [".mat-mdc-optgroup{color:var(--mat-optgroup-label-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-optgroup-label-text-font, var(--mat-sys-title-small-font));line-height:var(--mat-optgroup-label-text-line-height, var(--mat-sys-title-small-line-height));font-size:var(--mat-optgroup-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-optgroup-label-text-tracking, var(--mat-sys-title-small-tracking));font-weight:var(--mat-optgroup-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-optgroup-label{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;min-height:48px;padding:0 16px;outline:none}.mat-mdc-optgroup-label.mdc-list-item--disabled{opacity:.38}.mat-mdc-optgroup-label .mdc-list-item__primary-text{font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;white-space:normal;color:inherit}\n"],
|
|
59
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
60
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
61
|
+
});
|
|
59
62
|
}
|
|
60
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
64
|
+
minVersion: "12.0.0",
|
|
65
|
+
version: "20.2.0-next.2",
|
|
66
|
+
ngImport: i0,
|
|
67
|
+
type: MatOptgroup,
|
|
68
|
+
decorators: [{
|
|
69
|
+
type: Component,
|
|
70
|
+
args: [{
|
|
71
|
+
selector: 'mat-optgroup',
|
|
72
|
+
exportAs: 'matOptgroup',
|
|
73
|
+
encapsulation: ViewEncapsulation.None,
|
|
74
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
75
|
+
host: {
|
|
76
|
+
'class': 'mat-mdc-optgroup',
|
|
77
|
+
'[attr.role]': '_inert ? null : "group"',
|
|
78
|
+
'[attr.aria-disabled]': '_inert ? null : disabled.toString()',
|
|
79
|
+
'[attr.aria-labelledby]': '_inert ? null : _labelId'
|
|
80
|
+
},
|
|
81
|
+
providers: [{
|
|
82
|
+
provide: MAT_OPTGROUP,
|
|
83
|
+
useExisting: MatOptgroup
|
|
84
|
+
}],
|
|
85
|
+
template: "<span\n class=\"mat-mdc-optgroup-label\"\n role=\"presentation\"\n [class.mdc-list-item--disabled]=\"disabled\"\n [id]=\"_labelId\">\n <span class=\"mdc-list-item__primary-text\">{{ label }} <ng-content></ng-content></span>\n</span>\n\n<ng-content select=\"mat-option, ng-container\"></ng-content>\n",
|
|
86
|
+
styles: [".mat-mdc-optgroup{color:var(--mat-optgroup-label-text-color, var(--mat-sys-on-surface-variant));font-family:var(--mat-optgroup-label-text-font, var(--mat-sys-title-small-font));line-height:var(--mat-optgroup-label-text-line-height, var(--mat-sys-title-small-line-height));font-size:var(--mat-optgroup-label-text-size, var(--mat-sys-title-small-size));letter-spacing:var(--mat-optgroup-label-text-tracking, var(--mat-sys-title-small-tracking));font-weight:var(--mat-optgroup-label-text-weight, var(--mat-sys-title-small-weight))}.mat-mdc-optgroup-label{display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;min-height:48px;padding:0 16px;outline:none}.mat-mdc-optgroup-label.mdc-list-item--disabled{opacity:.38}.mat-mdc-optgroup-label .mdc-list-item__primary-text{font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;white-space:normal;color:inherit}\n"]
|
|
87
|
+
}]
|
|
88
|
+
}],
|
|
89
|
+
ctorParameters: () => [],
|
|
90
|
+
propDecorators: {
|
|
91
|
+
label: [{
|
|
92
|
+
type: Input
|
|
93
|
+
}],
|
|
94
|
+
disabled: [{
|
|
95
|
+
type: Input,
|
|
96
|
+
args: [{
|
|
97
|
+
transform: booleanAttribute
|
|
98
|
+
}]
|
|
99
|
+
}]
|
|
100
|
+
}
|
|
101
|
+
});
|
|
74
102
|
|
|
75
|
-
/** Event object emitted by MatOption when selected or deselected. */
|
|
76
103
|
class MatOptionSelectionChange {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
isUserInput = false) {
|
|
84
|
-
this.source = source;
|
|
85
|
-
this.isUserInput = isUserInput;
|
|
86
|
-
}
|
|
104
|
+
source;
|
|
105
|
+
isUserInput;
|
|
106
|
+
constructor(source, isUserInput = false) {
|
|
107
|
+
this.source = source;
|
|
108
|
+
this.isUserInput = isUserInput;
|
|
109
|
+
}
|
|
87
110
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Single option inside of a `<mat-select>` element.
|
|
90
|
-
*/
|
|
91
111
|
class MatOption {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
set
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
get active() {
|
|
150
|
-
return this._active;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* The displayed value of the option. It is necessary to show the selected option in the
|
|
154
|
-
* select's trigger.
|
|
155
|
-
*/
|
|
156
|
-
get viewValue() {
|
|
157
|
-
// TODO(kara): Add input property alternative for node envs.
|
|
158
|
-
return (this._text?.nativeElement.textContent || '').trim();
|
|
159
|
-
}
|
|
160
|
-
/** Selects the option. */
|
|
161
|
-
select(emitEvent = true) {
|
|
162
|
-
if (!this._selected) {
|
|
163
|
-
this._selected = true;
|
|
164
|
-
this._changeDetectorRef.markForCheck();
|
|
165
|
-
if (emitEvent) {
|
|
166
|
-
this._emitSelectionChangeEvent();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/** Deselects the option. */
|
|
171
|
-
deselect(emitEvent = true) {
|
|
172
|
-
if (this._selected) {
|
|
173
|
-
this._selected = false;
|
|
174
|
-
this._changeDetectorRef.markForCheck();
|
|
175
|
-
if (emitEvent) {
|
|
176
|
-
this._emitSelectionChangeEvent();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
112
|
+
_element = inject(ElementRef);
|
|
113
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
114
|
+
_parent = inject(MAT_OPTION_PARENT_COMPONENT, {
|
|
115
|
+
optional: true
|
|
116
|
+
});
|
|
117
|
+
group = inject(MAT_OPTGROUP, {
|
|
118
|
+
optional: true
|
|
119
|
+
});
|
|
120
|
+
_signalDisableRipple = false;
|
|
121
|
+
_selected = false;
|
|
122
|
+
_active = false;
|
|
123
|
+
_mostRecentViewValue = '';
|
|
124
|
+
get multiple() {
|
|
125
|
+
return this._parent && this._parent.multiple;
|
|
126
|
+
}
|
|
127
|
+
get selected() {
|
|
128
|
+
return this._selected;
|
|
129
|
+
}
|
|
130
|
+
value;
|
|
131
|
+
id = inject(_IdGenerator).getId('mat-option-');
|
|
132
|
+
get disabled() {
|
|
133
|
+
return this.group && this.group.disabled || this._disabled();
|
|
134
|
+
}
|
|
135
|
+
set disabled(value) {
|
|
136
|
+
this._disabled.set(value);
|
|
137
|
+
}
|
|
138
|
+
_disabled = signal(false, ...(ngDevMode ? [{
|
|
139
|
+
debugName: "_disabled"
|
|
140
|
+
}] : []));
|
|
141
|
+
get disableRipple() {
|
|
142
|
+
return this._signalDisableRipple ? this._parent.disableRipple() : !!this._parent?.disableRipple;
|
|
143
|
+
}
|
|
144
|
+
get hideSingleSelectionIndicator() {
|
|
145
|
+
return !!(this._parent && this._parent.hideSingleSelectionIndicator);
|
|
146
|
+
}
|
|
147
|
+
onSelectionChange = new EventEmitter();
|
|
148
|
+
_text;
|
|
149
|
+
_stateChanges = new Subject();
|
|
150
|
+
constructor() {
|
|
151
|
+
const styleLoader = inject(_CdkPrivateStyleLoader);
|
|
152
|
+
styleLoader.load(_StructuralStylesLoader);
|
|
153
|
+
styleLoader.load(_VisuallyHiddenLoader);
|
|
154
|
+
this._signalDisableRipple = !!this._parent && isSignal(this._parent.disableRipple);
|
|
155
|
+
}
|
|
156
|
+
get active() {
|
|
157
|
+
return this._active;
|
|
158
|
+
}
|
|
159
|
+
get viewValue() {
|
|
160
|
+
return (this._text?.nativeElement.textContent || '').trim();
|
|
161
|
+
}
|
|
162
|
+
select(emitEvent = true) {
|
|
163
|
+
if (!this._selected) {
|
|
164
|
+
this._selected = true;
|
|
165
|
+
this._changeDetectorRef.markForCheck();
|
|
166
|
+
if (emitEvent) {
|
|
167
|
+
this._emitSelectionChangeEvent();
|
|
168
|
+
}
|
|
179
169
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
170
|
+
}
|
|
171
|
+
deselect(emitEvent = true) {
|
|
172
|
+
if (this._selected) {
|
|
173
|
+
this._selected = false;
|
|
174
|
+
this._changeDetectorRef.markForCheck();
|
|
175
|
+
if (emitEvent) {
|
|
176
|
+
this._emitSelectionChangeEvent();
|
|
177
|
+
}
|
|
188
178
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
setActiveStyles() {
|
|
195
|
-
if (!this._active) {
|
|
196
|
-
this._active = true;
|
|
197
|
-
this._changeDetectorRef.markForCheck();
|
|
198
|
-
}
|
|
179
|
+
}
|
|
180
|
+
focus(_origin, options) {
|
|
181
|
+
const element = this._getHostElement();
|
|
182
|
+
if (typeof element.focus === 'function') {
|
|
183
|
+
element.focus(options);
|
|
199
184
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
setInactiveStyles() {
|
|
206
|
-
if (this._active) {
|
|
207
|
-
this._active = false;
|
|
208
|
-
this._changeDetectorRef.markForCheck();
|
|
209
|
-
}
|
|
185
|
+
}
|
|
186
|
+
setActiveStyles() {
|
|
187
|
+
if (!this._active) {
|
|
188
|
+
this._active = true;
|
|
189
|
+
this._changeDetectorRef.markForCheck();
|
|
210
190
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
191
|
+
}
|
|
192
|
+
setInactiveStyles() {
|
|
193
|
+
if (this._active) {
|
|
194
|
+
this._active = false;
|
|
195
|
+
this._changeDetectorRef.markForCheck();
|
|
214
196
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* `Selects the option while indicating the selection came from the user. Used to
|
|
225
|
-
* determine if the select's view -> model callback should be invoked.`
|
|
226
|
-
*/
|
|
227
|
-
_selectViaInteraction() {
|
|
228
|
-
if (!this.disabled) {
|
|
229
|
-
this._selected = this.multiple ? !this._selected : true;
|
|
230
|
-
this._changeDetectorRef.markForCheck();
|
|
231
|
-
this._emitSelectionChangeEvent(true);
|
|
232
|
-
}
|
|
197
|
+
}
|
|
198
|
+
getLabel() {
|
|
199
|
+
return this.viewValue;
|
|
200
|
+
}
|
|
201
|
+
_handleKeydown(event) {
|
|
202
|
+
if ((event.keyCode === ENTER || event.keyCode === SPACE) && !hasModifierKey(event)) {
|
|
203
|
+
this._selectViaInteraction();
|
|
204
|
+
event.preventDefault();
|
|
233
205
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
206
|
+
}
|
|
207
|
+
_selectViaInteraction() {
|
|
208
|
+
if (!this.disabled) {
|
|
209
|
+
this._selected = this.multiple ? !this._selected : true;
|
|
210
|
+
this._changeDetectorRef.markForCheck();
|
|
211
|
+
this._emitSelectionChangeEvent(true);
|
|
240
212
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if (this._mostRecentViewValue) {
|
|
255
|
-
this._stateChanges.next();
|
|
256
|
-
}
|
|
257
|
-
this._mostRecentViewValue = viewValue;
|
|
258
|
-
}
|
|
213
|
+
}
|
|
214
|
+
_getTabIndex() {
|
|
215
|
+
return this.disabled ? '-1' : '0';
|
|
216
|
+
}
|
|
217
|
+
_getHostElement() {
|
|
218
|
+
return this._element.nativeElement;
|
|
219
|
+
}
|
|
220
|
+
ngAfterViewChecked() {
|
|
221
|
+
if (this._selected) {
|
|
222
|
+
const viewValue = this.viewValue;
|
|
223
|
+
if (viewValue !== this._mostRecentViewValue) {
|
|
224
|
+
if (this._mostRecentViewValue) {
|
|
225
|
+
this._stateChanges.next();
|
|
259
226
|
}
|
|
227
|
+
this._mostRecentViewValue = viewValue;
|
|
228
|
+
}
|
|
260
229
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
230
|
+
}
|
|
231
|
+
ngOnDestroy() {
|
|
232
|
+
this._stateChanges.complete();
|
|
233
|
+
}
|
|
234
|
+
_emitSelectionChangeEvent(isUserInput = false) {
|
|
235
|
+
this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput));
|
|
236
|
+
}
|
|
237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
238
|
+
minVersion: "12.0.0",
|
|
239
|
+
version: "20.2.0-next.2",
|
|
240
|
+
ngImport: i0,
|
|
241
|
+
type: MatOption,
|
|
242
|
+
deps: [],
|
|
243
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
244
|
+
});
|
|
245
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
246
|
+
minVersion: "17.0.0",
|
|
247
|
+
version: "20.2.0-next.2",
|
|
248
|
+
type: MatOption,
|
|
249
|
+
isStandalone: true,
|
|
250
|
+
selector: "mat-option",
|
|
251
|
+
inputs: {
|
|
252
|
+
value: "value",
|
|
253
|
+
id: "id",
|
|
254
|
+
disabled: ["disabled", "disabled", booleanAttribute]
|
|
255
|
+
},
|
|
256
|
+
outputs: {
|
|
257
|
+
onSelectionChange: "onSelectionChange"
|
|
258
|
+
},
|
|
259
|
+
host: {
|
|
260
|
+
attributes: {
|
|
261
|
+
"role": "option"
|
|
262
|
+
},
|
|
263
|
+
listeners: {
|
|
264
|
+
"click": "_selectViaInteraction()",
|
|
265
|
+
"keydown": "_handleKeydown($event)"
|
|
266
|
+
},
|
|
267
|
+
properties: {
|
|
268
|
+
"class.mdc-list-item--selected": "selected",
|
|
269
|
+
"class.mat-mdc-option-multiple": "multiple",
|
|
270
|
+
"class.mat-mdc-option-active": "active",
|
|
271
|
+
"class.mdc-list-item--disabled": "disabled",
|
|
272
|
+
"id": "id",
|
|
273
|
+
"attr.aria-selected": "selected",
|
|
274
|
+
"attr.aria-disabled": "disabled.toString()"
|
|
275
|
+
},
|
|
276
|
+
classAttribute: "mat-mdc-option mdc-list-item"
|
|
277
|
+
},
|
|
278
|
+
viewQueries: [{
|
|
279
|
+
propertyName: "_text",
|
|
280
|
+
first: true,
|
|
281
|
+
predicate: ["text"],
|
|
282
|
+
descendants: true,
|
|
283
|
+
static: true
|
|
284
|
+
}],
|
|
285
|
+
exportAs: ["matOption"],
|
|
286
|
+
ngImport: i0,
|
|
287
|
+
template: "<!-- Set aria-hidden=\"true\" to this DOM node and other decorative nodes in this file. This might\n be contributing to issue where sometimes VoiceOver focuses on a TextNode in the a11y tree instead\n of the Option node (#23202). Most assistive technology will generally ignore non-role,\n non-text-content elements. Adding aria-hidden seems to make VoiceOver behave more consistently. -->\n@if (multiple) {\n <mat-pseudo-checkbox\n class=\"mat-mdc-option-pseudo-checkbox\"\n [disabled]=\"disabled\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n aria-hidden=\"true\"></mat-pseudo-checkbox>\n}\n\n<ng-content select=\"mat-icon\"></ng-content>\n\n<span class=\"mdc-list-item__primary-text\" #text><ng-content></ng-content></span>\n\n<!-- Render checkmark at the end for single-selection. -->\n@if (!multiple && selected && !hideSingleSelectionIndicator) {\n <mat-pseudo-checkbox\n class=\"mat-mdc-option-pseudo-checkbox\"\n [disabled]=\"disabled\"\n state=\"checked\"\n aria-hidden=\"true\"\n appearance=\"minimal\"></mat-pseudo-checkbox>\n}\n\n<!-- See a11y notes inside optgroup.ts for context behind this element. -->\n@if (group && group._inert) {\n <span class=\"cdk-visually-hidden\">({{ group.label }})</span>\n}\n\n<div class=\"mat-mdc-option-ripple mat-focus-indicator\" aria-hidden=\"true\" mat-ripple\n [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"disabled || disableRipple\">\n</div>\n",
|
|
288
|
+
styles: [".mat-mdc-option{-webkit-user-select:none;user-select:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;min-height:48px;padding:0 16px;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--mat-option-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-option-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-option-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-option-label-text-size, var(--mat-sys-body-large-size));letter-spacing:var(--mat-option-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-option-label-text-weight, var(--mat-sys-body-large-weight))}.mat-mdc-option:hover:not(.mdc-list-item--disabled){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-option:focus.mdc-list-item,.mat-mdc-option.mat-mdc-option-active.mdc-list-item{background-color:var(--mat-option-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent));outline:0}.mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled):not(.mat-mdc-option-active,.mat-mdc-option-multiple,:focus,:hover){background-color:var(--mat-option-selected-state-layer-color, var(--mat-sys-secondary-container))}.mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled):not(.mat-mdc-option-active,.mat-mdc-option-multiple,:focus,:hover) .mdc-list-item__primary-text{color:var(--mat-option-selected-state-label-text-color, var(--mat-sys-on-secondary-container))}.mat-mdc-option .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-option-selected-state-label-text-color, var(--mat-sys-on-secondary-container))}.mat-mdc-option.mdc-list-item{align-items:center;background:rgba(0,0,0,0)}.mat-mdc-option.mdc-list-item--disabled{cursor:default;pointer-events:none}.mat-mdc-option.mdc-list-item--disabled .mat-mdc-option-pseudo-checkbox,.mat-mdc-option.mdc-list-item--disabled .mdc-list-item__primary-text,.mat-mdc-option.mdc-list-item--disabled>mat-icon{opacity:.38}.mat-mdc-optgroup .mat-mdc-option:not(.mat-mdc-option-multiple){padding-left:32px}[dir=rtl] .mat-mdc-optgroup .mat-mdc-option:not(.mat-mdc-option-multiple){padding-left:16px;padding-right:32px}.mat-mdc-option .mat-icon,.mat-mdc-option .mat-pseudo-checkbox-full{margin-right:16px;flex-shrink:0}[dir=rtl] .mat-mdc-option .mat-icon,[dir=rtl] .mat-mdc-option .mat-pseudo-checkbox-full{margin-right:0;margin-left:16px}.mat-mdc-option .mat-pseudo-checkbox-minimal{margin-left:16px;flex-shrink:0}[dir=rtl] .mat-mdc-option .mat-pseudo-checkbox-minimal{margin-right:16px;margin-left:0}.mat-mdc-option .mat-mdc-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-option .mdc-list-item__primary-text{white-space:normal;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;margin-right:auto}[dir=rtl] .mat-mdc-option .mdc-list-item__primary-text{margin-right:0;margin-left:auto}@media(forced-colors: active){.mat-mdc-option.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after{content:\"\";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}[dir=rtl] .mat-mdc-option.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after{right:auto;left:16px}}.mat-mdc-option-multiple{--mat-list-list-item-selected-container-color: var(--mat-list-list-item-container-color, transparent)}.mat-mdc-option-active .mat-focus-indicator::before{content:\"\"}\n"],
|
|
289
|
+
dependencies: [{
|
|
290
|
+
kind: "component",
|
|
291
|
+
type: MatPseudoCheckbox,
|
|
292
|
+
selector: "mat-pseudo-checkbox",
|
|
293
|
+
inputs: ["state", "disabled", "appearance"]
|
|
294
|
+
}, {
|
|
295
|
+
kind: "directive",
|
|
296
|
+
type: MatRipple,
|
|
297
|
+
selector: "[mat-ripple], [matRipple]",
|
|
298
|
+
inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"],
|
|
299
|
+
exportAs: ["matRipple"]
|
|
300
|
+
}],
|
|
301
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
302
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
303
|
+
});
|
|
270
304
|
}
|
|
271
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
305
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
306
|
+
minVersion: "12.0.0",
|
|
307
|
+
version: "20.2.0-next.2",
|
|
308
|
+
ngImport: i0,
|
|
309
|
+
type: MatOption,
|
|
310
|
+
decorators: [{
|
|
311
|
+
type: Component,
|
|
312
|
+
args: [{
|
|
313
|
+
selector: 'mat-option',
|
|
314
|
+
exportAs: 'matOption',
|
|
315
|
+
host: {
|
|
316
|
+
'role': 'option',
|
|
317
|
+
'[class.mdc-list-item--selected]': 'selected',
|
|
318
|
+
'[class.mat-mdc-option-multiple]': 'multiple',
|
|
319
|
+
'[class.mat-mdc-option-active]': 'active',
|
|
320
|
+
'[class.mdc-list-item--disabled]': 'disabled',
|
|
321
|
+
'[id]': 'id',
|
|
322
|
+
'[attr.aria-selected]': 'selected',
|
|
323
|
+
'[attr.aria-disabled]': 'disabled.toString()',
|
|
324
|
+
'(click)': '_selectViaInteraction()',
|
|
325
|
+
'(keydown)': '_handleKeydown($event)',
|
|
326
|
+
'class': 'mat-mdc-option mdc-list-item'
|
|
327
|
+
},
|
|
328
|
+
encapsulation: ViewEncapsulation.None,
|
|
329
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
330
|
+
imports: [MatPseudoCheckbox, MatRipple],
|
|
331
|
+
template: "<!-- Set aria-hidden=\"true\" to this DOM node and other decorative nodes in this file. This might\n be contributing to issue where sometimes VoiceOver focuses on a TextNode in the a11y tree instead\n of the Option node (#23202). Most assistive technology will generally ignore non-role,\n non-text-content elements. Adding aria-hidden seems to make VoiceOver behave more consistently. -->\n@if (multiple) {\n <mat-pseudo-checkbox\n class=\"mat-mdc-option-pseudo-checkbox\"\n [disabled]=\"disabled\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n aria-hidden=\"true\"></mat-pseudo-checkbox>\n}\n\n<ng-content select=\"mat-icon\"></ng-content>\n\n<span class=\"mdc-list-item__primary-text\" #text><ng-content></ng-content></span>\n\n<!-- Render checkmark at the end for single-selection. -->\n@if (!multiple && selected && !hideSingleSelectionIndicator) {\n <mat-pseudo-checkbox\n class=\"mat-mdc-option-pseudo-checkbox\"\n [disabled]=\"disabled\"\n state=\"checked\"\n aria-hidden=\"true\"\n appearance=\"minimal\"></mat-pseudo-checkbox>\n}\n\n<!-- See a11y notes inside optgroup.ts for context behind this element. -->\n@if (group && group._inert) {\n <span class=\"cdk-visually-hidden\">({{ group.label }})</span>\n}\n\n<div class=\"mat-mdc-option-ripple mat-focus-indicator\" aria-hidden=\"true\" mat-ripple\n [matRippleTrigger]=\"_getHostElement()\" [matRippleDisabled]=\"disabled || disableRipple\">\n</div>\n",
|
|
332
|
+
styles: [".mat-mdc-option{-webkit-user-select:none;user-select:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:flex;position:relative;align-items:center;justify-content:flex-start;overflow:hidden;min-height:48px;padding:0 16px;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--mat-option-label-text-color, var(--mat-sys-on-surface));font-family:var(--mat-option-label-text-font, var(--mat-sys-label-large-font));line-height:var(--mat-option-label-text-line-height, var(--mat-sys-label-large-line-height));font-size:var(--mat-option-label-text-size, var(--mat-sys-body-large-size));letter-spacing:var(--mat-option-label-text-tracking, var(--mat-sys-label-large-tracking));font-weight:var(--mat-option-label-text-weight, var(--mat-sys-body-large-weight))}.mat-mdc-option:hover:not(.mdc-list-item--disabled){background-color:var(--mat-option-hover-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-hover-state-layer-opacity) * 100%), transparent))}.mat-mdc-option:focus.mdc-list-item,.mat-mdc-option.mat-mdc-option-active.mdc-list-item{background-color:var(--mat-option-focus-state-layer-color, color-mix(in srgb, var(--mat-sys-on-surface) calc(var(--mat-sys-focus-state-layer-opacity) * 100%), transparent));outline:0}.mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled):not(.mat-mdc-option-active,.mat-mdc-option-multiple,:focus,:hover){background-color:var(--mat-option-selected-state-layer-color, var(--mat-sys-secondary-container))}.mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled):not(.mat-mdc-option-active,.mat-mdc-option-multiple,:focus,:hover) .mdc-list-item__primary-text{color:var(--mat-option-selected-state-label-text-color, var(--mat-sys-on-secondary-container))}.mat-mdc-option .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-option-selected-state-label-text-color, var(--mat-sys-on-secondary-container))}.mat-mdc-option.mdc-list-item{align-items:center;background:rgba(0,0,0,0)}.mat-mdc-option.mdc-list-item--disabled{cursor:default;pointer-events:none}.mat-mdc-option.mdc-list-item--disabled .mat-mdc-option-pseudo-checkbox,.mat-mdc-option.mdc-list-item--disabled .mdc-list-item__primary-text,.mat-mdc-option.mdc-list-item--disabled>mat-icon{opacity:.38}.mat-mdc-optgroup .mat-mdc-option:not(.mat-mdc-option-multiple){padding-left:32px}[dir=rtl] .mat-mdc-optgroup .mat-mdc-option:not(.mat-mdc-option-multiple){padding-left:16px;padding-right:32px}.mat-mdc-option .mat-icon,.mat-mdc-option .mat-pseudo-checkbox-full{margin-right:16px;flex-shrink:0}[dir=rtl] .mat-mdc-option .mat-icon,[dir=rtl] .mat-mdc-option .mat-pseudo-checkbox-full{margin-right:0;margin-left:16px}.mat-mdc-option .mat-pseudo-checkbox-minimal{margin-left:16px;flex-shrink:0}[dir=rtl] .mat-mdc-option .mat-pseudo-checkbox-minimal{margin-right:16px;margin-left:0}.mat-mdc-option .mat-mdc-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-mdc-option .mdc-list-item__primary-text{white-space:normal;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;font-family:inherit;text-decoration:inherit;text-transform:inherit;margin-right:auto}[dir=rtl] .mat-mdc-option .mdc-list-item__primary-text{margin-right:0;margin-left:auto}@media(forced-colors: active){.mat-mdc-option.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after{content:\"\";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}[dir=rtl] .mat-mdc-option.mdc-list-item--selected:not(:has(.mat-mdc-option-pseudo-checkbox))::after{right:auto;left:16px}}.mat-mdc-option-multiple{--mat-list-list-item-selected-container-color: var(--mat-list-list-item-container-color, transparent)}.mat-mdc-option-active .mat-focus-indicator::before{content:\"\"}\n"]
|
|
333
|
+
}]
|
|
334
|
+
}],
|
|
335
|
+
ctorParameters: () => [],
|
|
336
|
+
propDecorators: {
|
|
337
|
+
value: [{
|
|
338
|
+
type: Input
|
|
339
|
+
}],
|
|
340
|
+
id: [{
|
|
341
|
+
type: Input
|
|
342
|
+
}],
|
|
343
|
+
disabled: [{
|
|
344
|
+
type: Input,
|
|
345
|
+
args: [{
|
|
346
|
+
transform: booleanAttribute
|
|
347
|
+
}]
|
|
348
|
+
}],
|
|
349
|
+
onSelectionChange: [{
|
|
350
|
+
type: Output
|
|
351
|
+
}],
|
|
352
|
+
_text: [{
|
|
353
|
+
type: ViewChild,
|
|
354
|
+
args: ['text', {
|
|
355
|
+
static: true
|
|
356
|
+
}]
|
|
357
|
+
}]
|
|
358
|
+
}
|
|
359
|
+
});
|
|
315
360
|
function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
return groupCounter;
|
|
361
|
+
if (optionGroups.length) {
|
|
362
|
+
let optionsArray = options.toArray();
|
|
363
|
+
let groups = optionGroups.toArray();
|
|
364
|
+
let groupCounter = 0;
|
|
365
|
+
for (let i = 0; i < optionIndex + 1; i++) {
|
|
366
|
+
if (optionsArray[i].group && optionsArray[i].group === groups[groupCounter]) {
|
|
367
|
+
groupCounter++;
|
|
368
|
+
}
|
|
326
369
|
}
|
|
327
|
-
return
|
|
370
|
+
return groupCounter;
|
|
371
|
+
}
|
|
372
|
+
return 0;
|
|
328
373
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Determines the position to which to scroll a panel in order for an option to be into view.
|
|
331
|
-
* @param optionOffset Offset of the option from the top of the panel.
|
|
332
|
-
* @param optionHeight Height of the options.
|
|
333
|
-
* @param currentScrollPosition Current scroll position of the panel.
|
|
334
|
-
* @param panelHeight Height of the panel.
|
|
335
|
-
* @docs-private
|
|
336
|
-
*/
|
|
337
374
|
function _getOptionScrollPosition(optionOffset, optionHeight, currentScrollPosition, panelHeight) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
375
|
+
if (optionOffset < currentScrollPosition) {
|
|
376
|
+
return optionOffset;
|
|
377
|
+
}
|
|
378
|
+
if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
|
|
379
|
+
return Math.max(0, optionOffset - panelHeight + optionHeight);
|
|
380
|
+
}
|
|
381
|
+
return currentScrollPosition;
|
|
345
382
|
}
|
|
346
383
|
|
|
347
384
|
export { MAT_OPTGROUP, MAT_OPTION_PARENT_COMPONENT, MatOptgroup, MatOption, MatOptionSelectionChange, _countGroupLabelsBeforeOption, _getOptionScrollPosition };
|