@angular/material 21.0.0-next.9 → 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.
Files changed (202) hide show
  1. package/core/tokens/_classes.scss +1 -1
  2. package/core/tokens/m2/_md-sys-color.scss +17 -17
  3. package/fesm2022/_animation-chunk.mjs +10 -16
  4. package/fesm2022/_animation-chunk.mjs.map +1 -1
  5. package/fesm2022/_date-formats-chunk.mjs +68 -164
  6. package/fesm2022/_date-formats-chunk.mjs.map +1 -1
  7. package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
  8. package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
  9. package/fesm2022/_error-options-chunk.mjs +56 -19
  10. package/fesm2022/_error-options-chunk.mjs.map +1 -1
  11. package/fesm2022/_error-state-chunk.mjs +24 -31
  12. package/fesm2022/_error-state-chunk.mjs.map +1 -1
  13. package/fesm2022/_form-field-chunk.mjs +1224 -1017
  14. package/fesm2022/_form-field-chunk.mjs.map +1 -1
  15. package/fesm2022/_icon-button-chunk.mjs +243 -187
  16. package/fesm2022/_icon-button-chunk.mjs.map +1 -1
  17. package/fesm2022/_icon-registry-chunk.mjs +350 -575
  18. package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
  19. package/fesm2022/_input-harness-chunk.mjs +56 -107
  20. package/fesm2022/_input-harness-chunk.mjs.map +1 -1
  21. package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
  22. package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
  23. package/fesm2022/_internal-form-field-chunk.mjs +59 -19
  24. package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
  25. package/fesm2022/_line-chunk.mjs +83 -43
  26. package/fesm2022/_line-chunk.mjs.map +1 -1
  27. package/fesm2022/_option-chunk.mjs +348 -311
  28. package/fesm2022/_option-chunk.mjs.map +1 -1
  29. package/fesm2022/_option-harness-chunk.mjs +23 -39
  30. package/fesm2022/_option-harness-chunk.mjs.map +1 -1
  31. package/fesm2022/_option-module-chunk.mjs +36 -10
  32. package/fesm2022/_option-module-chunk.mjs.map +1 -1
  33. package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
  34. package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
  35. package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
  36. package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
  37. package/fesm2022/_public-api-chunk.mjs +71 -134
  38. package/fesm2022/_public-api-chunk.mjs.map +1 -1
  39. package/fesm2022/_ripple-chunk.mjs +504 -600
  40. package/fesm2022/_ripple-chunk.mjs.map +1 -1
  41. package/fesm2022/_ripple-loader-chunk.mjs +120 -138
  42. package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
  43. package/fesm2022/_ripple-module-chunk.mjs +36 -10
  44. package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
  45. package/fesm2022/_structural-styles-chunk.mjs +37 -10
  46. package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
  47. package/fesm2022/_tooltip-chunk.mjs +810 -888
  48. package/fesm2022/_tooltip-chunk.mjs.map +1 -1
  49. package/fesm2022/autocomplete-testing.mjs +62 -86
  50. package/fesm2022/autocomplete-testing.mjs.map +1 -1
  51. package/fesm2022/autocomplete.mjs +965 -1126
  52. package/fesm2022/autocomplete.mjs.map +1 -1
  53. package/fesm2022/badge-testing.mjs +38 -54
  54. package/fesm2022/badge-testing.mjs.map +1 -1
  55. package/fesm2022/badge.mjs +321 -272
  56. package/fesm2022/badge.mjs.map +1 -1
  57. package/fesm2022/bottom-sheet-testing.mjs +10 -24
  58. package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
  59. package/fesm2022/bottom-sheet.mjs +349 -344
  60. package/fesm2022/bottom-sheet.mjs.map +1 -1
  61. package/fesm2022/button-testing.mjs +60 -94
  62. package/fesm2022/button-testing.mjs.map +1 -1
  63. package/fesm2022/button-toggle-testing.mjs +76 -125
  64. package/fesm2022/button-toggle-testing.mjs.map +1 -1
  65. package/fesm2022/button-toggle.mjs +752 -662
  66. package/fesm2022/button-toggle.mjs.map +1 -1
  67. package/fesm2022/button.mjs +263 -158
  68. package/fesm2022/button.mjs.map +1 -1
  69. package/fesm2022/card-testing.mjs +19 -33
  70. package/fesm2022/card-testing.mjs.map +1 -1
  71. package/fesm2022/card.mjs +576 -272
  72. package/fesm2022/card.mjs.map +1 -1
  73. package/fesm2022/checkbox-testing.mjs +71 -123
  74. package/fesm2022/checkbox-testing.mjs.map +1 -1
  75. package/fesm2022/checkbox.mjs +515 -477
  76. package/fesm2022/checkbox.mjs.map +1 -1
  77. package/fesm2022/chips-testing.mjs +201 -344
  78. package/fesm2022/chips-testing.mjs.map +1 -1
  79. package/fesm2022/chips.mjs +2552 -2289
  80. package/fesm2022/chips.mjs.map +1 -1
  81. package/fesm2022/core-testing.mjs +14 -28
  82. package/fesm2022/core-testing.mjs.map +1 -1
  83. package/fesm2022/core.mjs +357 -328
  84. package/fesm2022/core.mjs.map +1 -1
  85. package/fesm2022/datepicker-testing.mjs +15 -25
  86. package/fesm2022/datepicker-testing.mjs.map +1 -1
  87. package/fesm2022/datepicker.mjs +4826 -4563
  88. package/fesm2022/datepicker.mjs.map +1 -1
  89. package/fesm2022/dialog-testing.mjs +93 -129
  90. package/fesm2022/dialog-testing.mjs.map +1 -1
  91. package/fesm2022/dialog.mjs +810 -829
  92. package/fesm2022/dialog.mjs.map +1 -1
  93. package/fesm2022/divider-testing.mjs +10 -11
  94. package/fesm2022/divider-testing.mjs.map +1 -1
  95. package/fesm2022/divider.mjs +119 -43
  96. package/fesm2022/divider.mjs.map +1 -1
  97. package/fesm2022/expansion-testing.mjs +74 -130
  98. package/fesm2022/expansion-testing.mjs.map +1 -1
  99. package/fesm2022/expansion.mjs +703 -515
  100. package/fesm2022/expansion.mjs.map +1 -1
  101. package/fesm2022/form-field-testing-control.mjs +16 -33
  102. package/fesm2022/form-field-testing-control.mjs.map +1 -1
  103. package/fesm2022/form-field-testing.mjs +118 -179
  104. package/fesm2022/form-field-testing.mjs.map +1 -1
  105. package/fesm2022/form-field.mjs +36 -10
  106. package/fesm2022/form-field.mjs.map +1 -1
  107. package/fesm2022/grid-list-testing.mjs +65 -113
  108. package/fesm2022/grid-list-testing.mjs.map +1 -1
  109. package/fesm2022/grid-list.mjs +559 -494
  110. package/fesm2022/grid-list.mjs.map +1 -1
  111. package/fesm2022/icon-testing.mjs +148 -127
  112. package/fesm2022/icon-testing.mjs.map +1 -1
  113. package/fesm2022/icon.mjs +325 -351
  114. package/fesm2022/icon.mjs.map +1 -1
  115. package/fesm2022/input-testing.mjs +59 -99
  116. package/fesm2022/input-testing.mjs.map +1 -1
  117. package/fesm2022/input.mjs +457 -520
  118. package/fesm2022/input.mjs.map +1 -1
  119. package/fesm2022/list-testing.mjs +251 -434
  120. package/fesm2022/list-testing.mjs.map +1 -1
  121. package/fesm2022/list.mjs +1522 -1204
  122. package/fesm2022/list.mjs.map +1 -1
  123. package/fesm2022/material.mjs +0 -5
  124. package/fesm2022/material.mjs.map +1 -1
  125. package/fesm2022/menu-testing.mjs +159 -228
  126. package/fesm2022/menu-testing.mjs.map +1 -1
  127. package/fesm2022/menu.mjs +1338 -1343
  128. package/fesm2022/menu.mjs.map +1 -1
  129. package/fesm2022/paginator-testing.mjs +55 -79
  130. package/fesm2022/paginator-testing.mjs.map +1 -1
  131. package/fesm2022/paginator.mjs +381 -309
  132. package/fesm2022/paginator.mjs.map +1 -1
  133. package/fesm2022/progress-bar-testing.mjs +12 -21
  134. package/fesm2022/progress-bar-testing.mjs.map +1 -1
  135. package/fesm2022/progress-bar.mjs +224 -169
  136. package/fesm2022/progress-bar.mjs.map +1 -1
  137. package/fesm2022/progress-spinner-testing.mjs +13 -23
  138. package/fesm2022/progress-spinner-testing.mjs.map +1 -1
  139. package/fesm2022/progress-spinner.mjs +235 -160
  140. package/fesm2022/progress-spinner.mjs.map +1 -1
  141. package/fesm2022/radio-testing.mjs +133 -208
  142. package/fesm2022/radio-testing.mjs.map +1 -1
  143. package/fesm2022/radio.mjs +712 -679
  144. package/fesm2022/radio.mjs.map +1 -1
  145. package/fesm2022/select-testing.mjs +83 -117
  146. package/fesm2022/select-testing.mjs.map +1 -1
  147. package/fesm2022/select.mjs +1116 -1246
  148. package/fesm2022/select.mjs.map +1 -1
  149. package/fesm2022/sidenav-testing.mjs +54 -120
  150. package/fesm2022/sidenav-testing.mjs.map +1 -1
  151. package/fesm2022/sidenav.mjs +1078 -995
  152. package/fesm2022/sidenav.mjs.map +1 -1
  153. package/fesm2022/slide-toggle-testing.mjs +57 -92
  154. package/fesm2022/slide-toggle-testing.mjs.map +1 -1
  155. package/fesm2022/slide-toggle.mjs +369 -279
  156. package/fesm2022/slide-toggle.mjs.map +1 -1
  157. package/fesm2022/slider-testing.mjs +90 -138
  158. package/fesm2022/slider-testing.mjs.map +1 -1
  159. package/fesm2022/slider.mjs +1651 -1716
  160. package/fesm2022/slider.mjs.map +1 -1
  161. package/fesm2022/snack-bar-testing.mjs +40 -87
  162. package/fesm2022/snack-bar-testing.mjs.map +1 -1
  163. package/fesm2022/snack-bar.mjs +763 -714
  164. package/fesm2022/snack-bar.mjs.map +1 -1
  165. package/fesm2022/sort-testing.mjs +45 -66
  166. package/fesm2022/sort-testing.mjs.map +1 -1
  167. package/fesm2022/sort.mjs +419 -344
  168. package/fesm2022/sort.mjs.map +1 -1
  169. package/fesm2022/stepper-testing.mjs +78 -154
  170. package/fesm2022/stepper-testing.mjs.map +1 -1
  171. package/fesm2022/stepper.mjs +790 -498
  172. package/fesm2022/stepper.mjs.map +1 -1
  173. package/fesm2022/table-testing.mjs +120 -213
  174. package/fesm2022/table-testing.mjs.map +1 -1
  175. package/fesm2022/table.mjs +1026 -684
  176. package/fesm2022/table.mjs.map +1 -1
  177. package/fesm2022/tabs-testing.mjs +125 -197
  178. package/fesm2022/tabs-testing.mjs.map +1 -1
  179. package/fesm2022/tabs.mjs +2351 -2028
  180. package/fesm2022/tabs.mjs.map +1 -1
  181. package/fesm2022/timepicker-testing.mjs +113 -172
  182. package/fesm2022/timepicker-testing.mjs.map +1 -1
  183. package/fesm2022/timepicker.mjs +1019 -826
  184. package/fesm2022/timepicker.mjs.map +1 -1
  185. package/fesm2022/toolbar-testing.mjs +16 -27
  186. package/fesm2022/toolbar-testing.mjs.map +1 -1
  187. package/fesm2022/toolbar.mjs +163 -78
  188. package/fesm2022/toolbar.mjs.map +1 -1
  189. package/fesm2022/tooltip-testing.mjs +41 -52
  190. package/fesm2022/tooltip-testing.mjs.map +1 -1
  191. package/fesm2022/tooltip.mjs +36 -10
  192. package/fesm2022/tooltip.mjs.map +1 -1
  193. package/fesm2022/tree-testing.mjs +86 -162
  194. package/fesm2022/tree-testing.mjs.map +1 -1
  195. package/fesm2022/tree.mjs +638 -466
  196. package/fesm2022/tree.mjs.map +1 -1
  197. package/package.json +2 -2
  198. package/schematics/ng-add/index.js +1 -1
  199. package/types/expansion.d.ts +4 -2
  200. package/types/menu-testing.d.ts +2 -0
  201. package/types/select.d.ts +1 -1
  202. package/types/timepicker.d.ts +1 -0
@@ -26,1200 +26,1039 @@ import '@angular/cdk/observers/private';
26
26
  import './_ripple-module-chunk.mjs';
27
27
  import './_pseudo-checkbox-module-chunk.mjs';
28
28
 
29
- /** Event object that is emitted when an autocomplete option is selected. */
30
29
  class MatAutocompleteSelectedEvent {
31
- source;
32
- option;
33
- constructor(
34
- /** Reference to the autocomplete panel that emitted the event. */
35
- source,
36
- /** Option that was selected. */
37
- option) {
38
- this.source = source;
39
- this.option = option;
40
- }
30
+ source;
31
+ option;
32
+ constructor(source, option) {
33
+ this.source = source;
34
+ this.option = option;
35
+ }
41
36
  }
42
- /** Injection token to be used to override the default options for `mat-autocomplete`. */
43
37
  const MAT_AUTOCOMPLETE_DEFAULT_OPTIONS = new InjectionToken('mat-autocomplete-default-options', {
44
- providedIn: 'root',
45
- factory: () => ({
46
- autoActiveFirstOption: false,
47
- autoSelectActiveOption: false,
48
- hideSingleSelectionIndicator: false,
49
- requireSelection: false,
50
- hasBackdrop: false,
51
- }),
38
+ providedIn: 'root',
39
+ factory: () => ({
40
+ autoActiveFirstOption: false,
41
+ autoSelectActiveOption: false,
42
+ hideSingleSelectionIndicator: false,
43
+ requireSelection: false,
44
+ hasBackdrop: false
45
+ })
52
46
  });
53
- /** Autocomplete component. */
54
47
  class MatAutocomplete {
55
- _changeDetectorRef = inject(ChangeDetectorRef);
56
- _elementRef = inject(ElementRef);
57
- _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
58
- _animationsDisabled = _animationsDisabled();
59
- _activeOptionChanges = Subscription.EMPTY;
60
- /** Manages active item in option list based on key events. */
61
- _keyManager;
62
- /** Whether the autocomplete panel should be visible, depending on option length. */
63
- showPanel = false;
64
- /** Whether the autocomplete panel is open. */
65
- get isOpen() {
66
- return this._isOpen && this.showPanel;
67
- }
68
- _isOpen = false;
69
- /** Latest trigger that opened the autocomplete. */
70
- _latestOpeningTrigger;
71
- /** @docs-private Sets the theme color of the panel. */
72
- _setColor(value) {
73
- this._color = value;
74
- this._changeDetectorRef.markForCheck();
75
- }
76
- /** @docs-private theme color of the panel */
77
- _color;
78
- // The @ViewChild query for TemplateRef here needs to be static because some code paths
79
- // lead to the overlay being created before change detection has finished for this component.
80
- // Notably, another component may trigger `focus` on the autocomplete-trigger.
81
- /** @docs-private */
82
- template;
83
- /** Element for the panel containing the autocomplete options. */
84
- panel;
85
- /** Reference to all options within the autocomplete. */
86
- options;
87
- /** Reference to all option groups within the autocomplete. */
88
- optionGroups;
89
- /** Aria label of the autocomplete. */
90
- ariaLabel;
91
- /** Input that can be used to specify the `aria-labelledby` attribute. */
92
- ariaLabelledby;
93
- /** Function that maps an option's control value to its display value in the trigger. */
94
- displayWith = null;
95
- /**
96
- * Whether the first option should be highlighted when the autocomplete panel is opened.
97
- * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
98
- */
99
- autoActiveFirstOption;
100
- /** Whether the active option should be selected as the user is navigating. */
101
- autoSelectActiveOption;
102
- /**
103
- * Whether the user is required to make a selection when they're interacting with the
104
- * autocomplete. If the user moves away from the autocomplete without selecting an option from
105
- * the list, the value will be reset. If the user opens the panel and closes it without
106
- * interacting or selecting a value, the initial value will be kept.
107
- */
108
- requireSelection;
109
- /**
110
- * Specify the width of the autocomplete panel. Can be any CSS sizing value, otherwise it will
111
- * match the width of its host.
112
- */
113
- panelWidth;
114
- /** Whether ripples are disabled within the autocomplete panel. */
115
- disableRipple;
116
- /** Event that is emitted whenever an option from the list is selected. */
117
- optionSelected = new EventEmitter();
118
- /** Event that is emitted when the autocomplete panel is opened. */
119
- opened = new EventEmitter();
120
- /** Event that is emitted when the autocomplete panel is closed. */
121
- closed = new EventEmitter();
122
- /** Emits whenever an option is activated. */
123
- optionActivated = new EventEmitter();
124
- /**
125
- * Takes classes set on the host mat-autocomplete element and applies them to the panel
126
- * inside the overlay container to allow for easy styling.
127
- */
128
- set classList(value) {
129
- this._classList = value;
130
- this._elementRef.nativeElement.className = '';
48
+ _changeDetectorRef = inject(ChangeDetectorRef);
49
+ _elementRef = inject(ElementRef);
50
+ _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
51
+ _animationsDisabled = _animationsDisabled();
52
+ _activeOptionChanges = Subscription.EMPTY;
53
+ _keyManager;
54
+ showPanel = false;
55
+ get isOpen() {
56
+ return this._isOpen && this.showPanel;
57
+ }
58
+ _isOpen = false;
59
+ _latestOpeningTrigger;
60
+ _setColor(value) {
61
+ this._color = value;
62
+ this._changeDetectorRef.markForCheck();
63
+ }
64
+ _color;
65
+ template;
66
+ panel;
67
+ options;
68
+ optionGroups;
69
+ ariaLabel;
70
+ ariaLabelledby;
71
+ displayWith = null;
72
+ autoActiveFirstOption;
73
+ autoSelectActiveOption;
74
+ requireSelection;
75
+ panelWidth;
76
+ disableRipple;
77
+ optionSelected = new EventEmitter();
78
+ opened = new EventEmitter();
79
+ closed = new EventEmitter();
80
+ optionActivated = new EventEmitter();
81
+ set classList(value) {
82
+ this._classList = value;
83
+ this._elementRef.nativeElement.className = '';
84
+ }
85
+ _classList;
86
+ get hideSingleSelectionIndicator() {
87
+ return this._hideSingleSelectionIndicator;
88
+ }
89
+ set hideSingleSelectionIndicator(value) {
90
+ this._hideSingleSelectionIndicator = value;
91
+ this._syncParentProperties();
92
+ }
93
+ _hideSingleSelectionIndicator;
94
+ _syncParentProperties() {
95
+ if (this.options) {
96
+ for (const option of this.options) {
97
+ option._changeDetectorRef.markForCheck();
98
+ }
131
99
  }
132
- _classList;
133
- /** Whether checkmark indicator for single-selection options is hidden. */
134
- get hideSingleSelectionIndicator() {
135
- return this._hideSingleSelectionIndicator;
136
- }
137
- set hideSingleSelectionIndicator(value) {
138
- this._hideSingleSelectionIndicator = value;
139
- this._syncParentProperties();
140
- }
141
- _hideSingleSelectionIndicator;
142
- /** Syncs the parent state with the individual options. */
143
- _syncParentProperties() {
144
- if (this.options) {
145
- for (const option of this.options) {
146
- option._changeDetectorRef.markForCheck();
147
- }
148
- }
149
- }
150
- /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
151
- id = inject(_IdGenerator).getId('mat-autocomplete-');
152
- /**
153
- * Tells any descendant `mat-optgroup` to use the inert a11y pattern.
154
- * @docs-private
155
- */
156
- inertGroups;
157
- constructor() {
158
- const platform = inject(Platform);
159
- // TODO(crisbeto): the problem that the `inertGroups` option resolves is only present on
160
- // Safari using VoiceOver. We should occasionally check back to see whether the bug
161
- // wasn't resolved in VoiceOver, and if it has, we can remove this and the `inertGroups`
162
- // option altogether.
163
- this.inertGroups = platform?.SAFARI || false;
164
- this.autoActiveFirstOption = !!this._defaults.autoActiveFirstOption;
165
- this.autoSelectActiveOption = !!this._defaults.autoSelectActiveOption;
166
- this.requireSelection = !!this._defaults.requireSelection;
167
- this._hideSingleSelectionIndicator = this._defaults.hideSingleSelectionIndicator ?? false;
168
- }
169
- ngAfterContentInit() {
170
- this._keyManager = new ActiveDescendantKeyManager(this.options)
171
- .withWrap()
172
- .skipPredicate(this._skipPredicate);
173
- this._activeOptionChanges = this._keyManager.change.subscribe(index => {
174
- if (this.isOpen) {
175
- this.optionActivated.emit({ source: this, option: this.options.toArray()[index] || null });
176
- }
100
+ }
101
+ id = inject(_IdGenerator).getId('mat-autocomplete-');
102
+ inertGroups;
103
+ constructor() {
104
+ const platform = inject(Platform);
105
+ this.inertGroups = platform?.SAFARI || false;
106
+ this.autoActiveFirstOption = !!this._defaults.autoActiveFirstOption;
107
+ this.autoSelectActiveOption = !!this._defaults.autoSelectActiveOption;
108
+ this.requireSelection = !!this._defaults.requireSelection;
109
+ this._hideSingleSelectionIndicator = this._defaults.hideSingleSelectionIndicator ?? false;
110
+ }
111
+ ngAfterContentInit() {
112
+ this._keyManager = new ActiveDescendantKeyManager(this.options).withWrap().skipPredicate(this._skipPredicate);
113
+ this._activeOptionChanges = this._keyManager.change.subscribe(index => {
114
+ if (this.isOpen) {
115
+ this.optionActivated.emit({
116
+ source: this,
117
+ option: this.options.toArray()[index] || null
177
118
  });
178
- // Set the initial visibility state.
179
- this._setVisibility();
180
- }
181
- ngOnDestroy() {
182
- this._keyManager?.destroy();
183
- this._activeOptionChanges.unsubscribe();
184
- }
185
- /**
186
- * Sets the panel scrollTop. This allows us to manually scroll to display options
187
- * above or below the fold, as they are not actually being focused when active.
188
- */
189
- _setScrollTop(scrollTop) {
190
- if (this.panel) {
191
- this.panel.nativeElement.scrollTop = scrollTop;
192
- }
193
- }
194
- /** Returns the panel's scrollTop. */
195
- _getScrollTop() {
196
- return this.panel ? this.panel.nativeElement.scrollTop : 0;
197
- }
198
- /** Panel should hide itself when the option list is empty. */
199
- _setVisibility() {
200
- this.showPanel = !!this.options?.length;
201
- this._changeDetectorRef.markForCheck();
202
- }
203
- /** Emits the `select` event. */
204
- _emitSelectEvent(option) {
205
- const event = new MatAutocompleteSelectedEvent(this, option);
206
- this.optionSelected.emit(event);
207
- }
208
- /** Gets the aria-labelledby for the autocomplete panel. */
209
- _getPanelAriaLabelledby(labelId) {
210
- if (this.ariaLabel) {
211
- return null;
212
- }
213
- const labelExpression = labelId ? labelId + ' ' : '';
214
- return this.ariaLabelledby ? labelExpression + this.ariaLabelledby : labelId;
119
+ }
120
+ });
121
+ this._setVisibility();
122
+ }
123
+ ngOnDestroy() {
124
+ this._keyManager?.destroy();
125
+ this._activeOptionChanges.unsubscribe();
126
+ }
127
+ _setScrollTop(scrollTop) {
128
+ if (this.panel) {
129
+ this.panel.nativeElement.scrollTop = scrollTop;
215
130
  }
216
- // `skipPredicate` determines if key manager should avoid putting a given option in the tab
217
- // order. Allow disabled list items to receive focus via keyboard to align with WAI ARIA
218
- // recommendation.
219
- //
220
- // Normally WAI ARIA's instructions are to exclude disabled items from the tab order, but it
221
- // makes a few exceptions for compound widgets.
222
- //
223
- // From [Developing a Keyboard Interface](
224
- // https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/):
225
- // "For the following composite widget elements, keep them focusable when disabled: Options in a
226
- // Listbox..."
227
- //
228
- // The user can focus disabled options using the keyboard, but the user cannot click disabled
229
- // options.
230
- _skipPredicate() {
231
- return false;
131
+ }
132
+ _getScrollTop() {
133
+ return this.panel ? this.panel.nativeElement.scrollTop : 0;
134
+ }
135
+ _setVisibility() {
136
+ this.showPanel = !!this.options?.length;
137
+ this._changeDetectorRef.markForCheck();
138
+ }
139
+ _emitSelectEvent(option) {
140
+ const event = new MatAutocompleteSelectedEvent(this, option);
141
+ this.optionSelected.emit(event);
142
+ }
143
+ _getPanelAriaLabelledby(labelId) {
144
+ if (this.ariaLabel) {
145
+ return null;
232
146
  }
233
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
234
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "20.2.0-next.2", type: MatAutocomplete, isStandalone: true, selector: "mat-autocomplete", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], displayWith: "displayWith", autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute], autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute], requireSelection: ["requireSelection", "requireSelection", booleanAttribute], panelWidth: "panelWidth", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], classList: ["class", "classList"], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute] }, outputs: { optionSelected: "optionSelected", opened: "opened", closed: "closed", optionActivated: "optionActivated" }, host: { classAttribute: "mat-mdc-autocomplete" }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], queries: [{ propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], exportAs: ["matAutocomplete"], ngImport: i0, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:relative;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-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-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
147
+ const labelExpression = labelId ? labelId + ' ' : '';
148
+ return this.ariaLabelledby ? labelExpression + this.ariaLabelledby : labelId;
149
+ }
150
+ _skipPredicate() {
151
+ return false;
152
+ }
153
+ static ɵfac = i0.ɵɵngDeclareFactory({
154
+ minVersion: "12.0.0",
155
+ version: "20.2.0-next.2",
156
+ ngImport: i0,
157
+ type: MatAutocomplete,
158
+ deps: [],
159
+ target: i0.ɵɵFactoryTarget.Component
160
+ });
161
+ static ɵcmp = i0.ɵɵngDeclareComponent({
162
+ minVersion: "16.1.0",
163
+ version: "20.2.0-next.2",
164
+ type: MatAutocomplete,
165
+ isStandalone: true,
166
+ selector: "mat-autocomplete",
167
+ inputs: {
168
+ ariaLabel: ["aria-label", "ariaLabel"],
169
+ ariaLabelledby: ["aria-labelledby", "ariaLabelledby"],
170
+ displayWith: "displayWith",
171
+ autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute],
172
+ autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute],
173
+ requireSelection: ["requireSelection", "requireSelection", booleanAttribute],
174
+ panelWidth: "panelWidth",
175
+ disableRipple: ["disableRipple", "disableRipple", booleanAttribute],
176
+ classList: ["class", "classList"],
177
+ hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute]
178
+ },
179
+ outputs: {
180
+ optionSelected: "optionSelected",
181
+ opened: "opened",
182
+ closed: "closed",
183
+ optionActivated: "optionActivated"
184
+ },
185
+ host: {
186
+ classAttribute: "mat-mdc-autocomplete"
187
+ },
188
+ providers: [{
189
+ provide: MAT_OPTION_PARENT_COMPONENT,
190
+ useExisting: MatAutocomplete
191
+ }],
192
+ queries: [{
193
+ propertyName: "options",
194
+ predicate: MatOption,
195
+ descendants: true
196
+ }, {
197
+ propertyName: "optionGroups",
198
+ predicate: MAT_OPTGROUP,
199
+ descendants: true
200
+ }],
201
+ viewQueries: [{
202
+ propertyName: "template",
203
+ first: true,
204
+ predicate: TemplateRef,
205
+ descendants: true,
206
+ static: true
207
+ }, {
208
+ propertyName: "panel",
209
+ first: true,
210
+ predicate: ["panel"],
211
+ descendants: true
212
+ }],
213
+ exportAs: ["matAutocomplete"],
214
+ ngImport: i0,
215
+ template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n",
216
+ styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:relative;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-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-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}\n"],
217
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
218
+ encapsulation: i0.ViewEncapsulation.None
219
+ });
235
220
  }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocomplete, decorators: [{
237
- type: Component,
238
- args: [{ selector: 'mat-autocomplete', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'matAutocomplete', host: {
239
- 'class': 'mat-mdc-autocomplete',
240
- }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:relative;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-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-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}\n"] }]
241
- }], ctorParameters: () => [], propDecorators: { template: [{
242
- type: ViewChild,
243
- args: [TemplateRef, { static: true }]
244
- }], panel: [{
245
- type: ViewChild,
246
- args: ['panel']
247
- }], options: [{
248
- type: ContentChildren,
249
- args: [MatOption, { descendants: true }]
250
- }], optionGroups: [{
251
- type: ContentChildren,
252
- args: [MAT_OPTGROUP, { descendants: true }]
253
- }], ariaLabel: [{
254
- type: Input,
255
- args: ['aria-label']
256
- }], ariaLabelledby: [{
257
- type: Input,
258
- args: ['aria-labelledby']
259
- }], displayWith: [{
260
- type: Input
261
- }], autoActiveFirstOption: [{
262
- type: Input,
263
- args: [{ transform: booleanAttribute }]
264
- }], autoSelectActiveOption: [{
265
- type: Input,
266
- args: [{ transform: booleanAttribute }]
267
- }], requireSelection: [{
268
- type: Input,
269
- args: [{ transform: booleanAttribute }]
270
- }], panelWidth: [{
271
- type: Input
272
- }], disableRipple: [{
273
- type: Input,
274
- args: [{ transform: booleanAttribute }]
275
- }], optionSelected: [{
276
- type: Output
277
- }], opened: [{
278
- type: Output
279
- }], closed: [{
280
- type: Output
281
- }], optionActivated: [{
282
- type: Output
283
- }], classList: [{
284
- type: Input,
285
- args: ['class']
286
- }], hideSingleSelectionIndicator: [{
287
- type: Input,
288
- args: [{ transform: booleanAttribute }]
289
- }] } });
221
+ i0.ɵɵngDeclareClassMetadata({
222
+ minVersion: "12.0.0",
223
+ version: "20.2.0-next.2",
224
+ ngImport: i0,
225
+ type: MatAutocomplete,
226
+ decorators: [{
227
+ type: Component,
228
+ args: [{
229
+ selector: 'mat-autocomplete',
230
+ encapsulation: ViewEncapsulation.None,
231
+ changeDetection: ChangeDetectionStrategy.OnPush,
232
+ exportAs: 'matAutocomplete',
233
+ host: {
234
+ 'class': 'mat-mdc-autocomplete'
235
+ },
236
+ providers: [{
237
+ provide: MAT_OPTION_PARENT_COMPONENT,
238
+ useExisting: MatAutocomplete
239
+ }],
240
+ template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-autocomplete-panel-animations-enabled]=\"!_animationsDisabled\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n",
241
+ styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:relative;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-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-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}\n"]
242
+ }]
243
+ }],
244
+ ctorParameters: () => [],
245
+ propDecorators: {
246
+ template: [{
247
+ type: ViewChild,
248
+ args: [TemplateRef, {
249
+ static: true
250
+ }]
251
+ }],
252
+ panel: [{
253
+ type: ViewChild,
254
+ args: ['panel']
255
+ }],
256
+ options: [{
257
+ type: ContentChildren,
258
+ args: [MatOption, {
259
+ descendants: true
260
+ }]
261
+ }],
262
+ optionGroups: [{
263
+ type: ContentChildren,
264
+ args: [MAT_OPTGROUP, {
265
+ descendants: true
266
+ }]
267
+ }],
268
+ ariaLabel: [{
269
+ type: Input,
270
+ args: ['aria-label']
271
+ }],
272
+ ariaLabelledby: [{
273
+ type: Input,
274
+ args: ['aria-labelledby']
275
+ }],
276
+ displayWith: [{
277
+ type: Input
278
+ }],
279
+ autoActiveFirstOption: [{
280
+ type: Input,
281
+ args: [{
282
+ transform: booleanAttribute
283
+ }]
284
+ }],
285
+ autoSelectActiveOption: [{
286
+ type: Input,
287
+ args: [{
288
+ transform: booleanAttribute
289
+ }]
290
+ }],
291
+ requireSelection: [{
292
+ type: Input,
293
+ args: [{
294
+ transform: booleanAttribute
295
+ }]
296
+ }],
297
+ panelWidth: [{
298
+ type: Input
299
+ }],
300
+ disableRipple: [{
301
+ type: Input,
302
+ args: [{
303
+ transform: booleanAttribute
304
+ }]
305
+ }],
306
+ optionSelected: [{
307
+ type: Output
308
+ }],
309
+ opened: [{
310
+ type: Output
311
+ }],
312
+ closed: [{
313
+ type: Output
314
+ }],
315
+ optionActivated: [{
316
+ type: Output
317
+ }],
318
+ classList: [{
319
+ type: Input,
320
+ args: ['class']
321
+ }],
322
+ hideSingleSelectionIndicator: [{
323
+ type: Input,
324
+ args: [{
325
+ transform: booleanAttribute
326
+ }]
327
+ }]
328
+ }
329
+ });
290
330
 
291
- /**
292
- * Directive applied to an element to make it usable
293
- * as a connection point for an autocomplete panel.
294
- */
295
331
  class MatAutocompleteOrigin {
296
- elementRef = inject(ElementRef);
297
- constructor() { }
298
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteOrigin, deps: [], target: i0.ɵɵFactoryTarget.Directive });
299
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatAutocompleteOrigin, isStandalone: true, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"], ngImport: i0 });
332
+ elementRef = inject(ElementRef);
333
+ constructor() {}
334
+ static ɵfac = i0.ɵɵngDeclareFactory({
335
+ minVersion: "12.0.0",
336
+ version: "20.2.0-next.2",
337
+ ngImport: i0,
338
+ type: MatAutocompleteOrigin,
339
+ deps: [],
340
+ target: i0.ɵɵFactoryTarget.Directive
341
+ });
342
+ static ɵdir = i0.ɵɵngDeclareDirective({
343
+ minVersion: "14.0.0",
344
+ version: "20.2.0-next.2",
345
+ type: MatAutocompleteOrigin,
346
+ isStandalone: true,
347
+ selector: "[matAutocompleteOrigin]",
348
+ exportAs: ["matAutocompleteOrigin"],
349
+ ngImport: i0
350
+ });
300
351
  }
301
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteOrigin, decorators: [{
302
- type: Directive,
303
- args: [{
304
- selector: '[matAutocompleteOrigin]',
305
- exportAs: 'matAutocompleteOrigin',
306
- }]
307
- }], ctorParameters: () => [] });
352
+ i0.ɵɵngDeclareClassMetadata({
353
+ minVersion: "12.0.0",
354
+ version: "20.2.0-next.2",
355
+ ngImport: i0,
356
+ type: MatAutocompleteOrigin,
357
+ decorators: [{
358
+ type: Directive,
359
+ args: [{
360
+ selector: '[matAutocompleteOrigin]',
361
+ exportAs: 'matAutocompleteOrigin'
362
+ }]
363
+ }],
364
+ ctorParameters: () => []
365
+ });
308
366
 
309
- /**
310
- * Provider that allows the autocomplete to register as a ControlValueAccessor.
311
- * @docs-private
312
- */
313
367
  const MAT_AUTOCOMPLETE_VALUE_ACCESSOR = {
314
- provide: NG_VALUE_ACCESSOR,
315
- useExisting: forwardRef(() => MatAutocompleteTrigger),
316
- multi: true,
368
+ provide: NG_VALUE_ACCESSOR,
369
+ useExisting: forwardRef(() => MatAutocompleteTrigger),
370
+ multi: true
317
371
  };
318
- /**
319
- * Creates an error to be thrown when attempting to use an autocomplete trigger without a panel.
320
- * @docs-private
321
- */
322
372
  function getMatAutocompleteMissingPanelError() {
323
- return Error('Attempting to open an undefined instance of `mat-autocomplete`. ' +
324
- 'Make sure that the id passed to the `matAutocomplete` is correct and that ' +
325
- "you're attempting to open it after the ngAfterContentInit hook.");
373
+ return Error('Attempting to open an undefined instance of `mat-autocomplete`. ' + 'Make sure that the id passed to the `matAutocomplete` is correct and that ' + "you're attempting to open it after the ngAfterContentInit hook.");
326
374
  }
327
- /** Injection token that determines the scroll handling while the autocomplete panel is open. */
328
375
  const MAT_AUTOCOMPLETE_SCROLL_STRATEGY = new InjectionToken('mat-autocomplete-scroll-strategy', {
329
- providedIn: 'root',
330
- factory: () => {
331
- const injector = inject(Injector);
332
- return () => createRepositionScrollStrategy(injector);
333
- },
376
+ providedIn: 'root',
377
+ factory: () => {
378
+ const injector = inject(Injector);
379
+ return () => createRepositionScrollStrategy(injector);
380
+ }
334
381
  });
335
- /** Base class with all of the `MatAutocompleteTrigger` functionality. */
336
382
  class MatAutocompleteTrigger {
337
- _environmentInjector = inject(EnvironmentInjector);
338
- _element = inject(ElementRef);
339
- _injector = inject(Injector);
340
- _viewContainerRef = inject(ViewContainerRef);
341
- _zone = inject(NgZone);
342
- _changeDetectorRef = inject(ChangeDetectorRef);
343
- _dir = inject(Directionality, { optional: true });
344
- _formField = inject(MAT_FORM_FIELD, { optional: true, host: true });
345
- _viewportRuler = inject(ViewportRuler);
346
- _scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
347
- _renderer = inject(Renderer2);
348
- _animationsDisabled = _animationsDisabled();
349
- _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, { optional: true });
350
- _overlayRef;
351
- _portal;
352
- _componentDestroyed = false;
353
- _initialized = new Subject();
354
- _keydownSubscription;
355
- _outsideClickSubscription;
356
- _cleanupWindowBlur;
357
- /** Old value of the native input. Used to work around issues with the `input` event on IE. */
358
- _previousValue;
359
- /** Value of the input element when the panel was attached (even if there are no options). */
360
- _valueOnAttach;
361
- /** Value on the previous keydown event. */
362
- _valueOnLastKeydown;
363
- /** Strategy that is used to position the panel. */
364
- _positionStrategy;
365
- /** Whether or not the label state is being overridden. */
366
- _manuallyFloatingLabel = false;
367
- /** The subscription for closing actions (some are bound to document). */
368
- _closingActionsSubscription;
369
- /** Subscription to viewport size changes. */
370
- _viewportSubscription = Subscription.EMPTY;
371
- /** Implements BreakpointObserver to be used to detect handset landscape */
372
- _breakpointObserver = inject(BreakpointObserver);
373
- _handsetLandscapeSubscription = Subscription.EMPTY;
374
- /**
375
- * Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
376
- * closed autocomplete from being reopened if the user switches to another browser tab and then
377
- * comes back.
378
- */
379
- _canOpenOnNextFocus = true;
380
- /** Value inside the input before we auto-selected an option. */
381
- _valueBeforeAutoSelection;
382
- /**
383
- * Current option that we have auto-selected as the user is navigating,
384
- * but which hasn't been propagated to the model value yet.
385
- */
386
- _pendingAutoselectedOption;
387
- /** Stream of keyboard events that can close the panel. */
388
- _closeKeyEventStream = new Subject();
389
- /** Classes to apply to the panel. Exposed as a public property for internal usage. */
390
- _overlayPanelClass = coerceArray(this._defaults?.overlayPanelClass || []);
391
- /**
392
- * Event handler for when the window is blurred. Needs to be an
393
- * arrow function in order to preserve the context.
394
- */
395
- _windowBlurHandler = () => {
396
- // If the user blurred the window while the autocomplete is focused, it means that it'll be
397
- // refocused when they come back. In this case we want to skip the first focus event, if the
398
- // pane was closed, in order to avoid reopening it unintentionally.
399
- this._canOpenOnNextFocus = this.panelOpen || !this._hasFocus();
400
- };
401
- /** `View -> model callback called when value changes` */
402
- _onChange = () => { };
403
- /** `View -> model callback called when autocomplete has been touched` */
404
- _onTouched = () => { };
405
- /** The autocomplete panel to be attached to this trigger. */
406
- autocomplete;
407
- /**
408
- * Position of the autocomplete panel relative to the trigger element. A position of `auto`
409
- * will render the panel underneath the trigger if there is enough space for it to fit in
410
- * the viewport, otherwise the panel will be shown above it. If the position is set to
411
- * `above` or `below`, the panel will always be shown above or below the trigger. no matter
412
- * whether it fits completely in the viewport.
413
- */
414
- position = 'auto';
415
- /**
416
- * Reference relative to which to position the autocomplete panel.
417
- * Defaults to the autocomplete trigger element.
418
- */
419
- connectedTo;
420
- /**
421
- * `autocomplete` attribute to be set on the input element.
422
- * @docs-private
423
- */
424
- autocompleteAttribute = 'off';
425
- /**
426
- * Whether the autocomplete is disabled. When disabled, the element will
427
- * act as a regular input and the user won't be able to open the panel.
428
- */
429
- autocompleteDisabled;
430
- constructor() { }
431
- /** Class to apply to the panel when it's above the input. */
432
- _aboveClass = 'mat-mdc-autocomplete-panel-above';
433
- ngAfterViewInit() {
434
- this._initialized.next();
435
- this._initialized.complete();
436
- this._cleanupWindowBlur = this._renderer.listen('window', 'blur', this._windowBlurHandler);
437
- }
438
- ngOnChanges(changes) {
439
- if (changes['position'] && this._positionStrategy) {
440
- this._setStrategyPositions(this._positionStrategy);
441
- if (this.panelOpen) {
442
- this._overlayRef.updatePosition();
443
- }
444
- }
445
- }
446
- ngOnDestroy() {
447
- this._cleanupWindowBlur?.();
448
- this._handsetLandscapeSubscription.unsubscribe();
449
- this._viewportSubscription.unsubscribe();
450
- this._componentDestroyed = true;
451
- this._destroyPanel();
452
- this._closeKeyEventStream.complete();
453
- this._clearFromModal();
454
- }
455
- /** Whether or not the autocomplete panel is open. */
456
- get panelOpen() {
457
- return this._overlayAttached && this.autocomplete.showPanel;
458
- }
459
- _overlayAttached = false;
460
- /** Opens the autocomplete suggestion panel. */
461
- openPanel() {
462
- this._openPanelInternal();
383
+ _environmentInjector = inject(EnvironmentInjector);
384
+ _element = inject(ElementRef);
385
+ _injector = inject(Injector);
386
+ _viewContainerRef = inject(ViewContainerRef);
387
+ _zone = inject(NgZone);
388
+ _changeDetectorRef = inject(ChangeDetectorRef);
389
+ _dir = inject(Directionality, {
390
+ optional: true
391
+ });
392
+ _formField = inject(MAT_FORM_FIELD, {
393
+ optional: true,
394
+ host: true
395
+ });
396
+ _viewportRuler = inject(ViewportRuler);
397
+ _scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
398
+ _renderer = inject(Renderer2);
399
+ _animationsDisabled = _animationsDisabled();
400
+ _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, {
401
+ optional: true
402
+ });
403
+ _overlayRef;
404
+ _portal;
405
+ _componentDestroyed = false;
406
+ _initialized = new Subject();
407
+ _keydownSubscription;
408
+ _outsideClickSubscription;
409
+ _cleanupWindowBlur;
410
+ _previousValue;
411
+ _valueOnAttach;
412
+ _valueOnLastKeydown;
413
+ _positionStrategy;
414
+ _manuallyFloatingLabel = false;
415
+ _closingActionsSubscription;
416
+ _viewportSubscription = Subscription.EMPTY;
417
+ _breakpointObserver = inject(BreakpointObserver);
418
+ _handsetLandscapeSubscription = Subscription.EMPTY;
419
+ _canOpenOnNextFocus = true;
420
+ _valueBeforeAutoSelection;
421
+ _pendingAutoselectedOption;
422
+ _closeKeyEventStream = new Subject();
423
+ _overlayPanelClass = coerceArray(this._defaults?.overlayPanelClass || []);
424
+ _windowBlurHandler = () => {
425
+ this._canOpenOnNextFocus = this.panelOpen || !this._hasFocus();
426
+ };
427
+ _onChange = () => {};
428
+ _onTouched = () => {};
429
+ autocomplete;
430
+ position = 'auto';
431
+ connectedTo;
432
+ autocompleteAttribute = 'off';
433
+ autocompleteDisabled;
434
+ constructor() {}
435
+ _aboveClass = 'mat-mdc-autocomplete-panel-above';
436
+ ngAfterViewInit() {
437
+ this._initialized.next();
438
+ this._initialized.complete();
439
+ this._cleanupWindowBlur = this._renderer.listen('window', 'blur', this._windowBlurHandler);
440
+ }
441
+ ngOnChanges(changes) {
442
+ if (changes['position'] && this._positionStrategy) {
443
+ this._setStrategyPositions(this._positionStrategy);
444
+ if (this.panelOpen) {
445
+ this._overlayRef.updatePosition();
446
+ }
463
447
  }
464
- /** Closes the autocomplete suggestion panel. */
465
- closePanel() {
466
- this._resetLabel();
467
- if (!this._overlayAttached) {
468
- return;
469
- }
470
- if (this.panelOpen) {
471
- // Only emit if the panel was visible.
472
- // `afterNextRender` always runs outside of the Angular zone, so all the subscriptions from
473
- // `_subscribeToClosingActions()` are also outside of the Angular zone.
474
- // We should manually run in Angular zone to update UI after panel closing.
475
- this._zone.run(() => {
476
- this.autocomplete.closed.emit();
477
- });
478
- }
479
- // Only reset if this trigger is the latest one that opened the
480
- // autocomplete since another may have taken it over.
481
- if (this.autocomplete._latestOpeningTrigger === this) {
482
- this.autocomplete._isOpen = false;
483
- this.autocomplete._latestOpeningTrigger = null;
484
- }
485
- this._overlayAttached = false;
486
- this._pendingAutoselectedOption = null;
487
- if (this._overlayRef && this._overlayRef.hasAttached()) {
488
- this._overlayRef.detach();
489
- this._closingActionsSubscription.unsubscribe();
490
- }
491
- this._updatePanelState();
492
- // Note that in some cases this can end up being called after the component is destroyed.
493
- // Add a check to ensure that we don't try to run change detection on a destroyed view.
494
- if (!this._componentDestroyed) {
495
- // We need to trigger change detection manually, because
496
- // `fromEvent` doesn't seem to do it at the proper time.
497
- // This ensures that the label is reset when the
498
- // user clicks outside.
499
- this._changeDetectorRef.detectChanges();
500
- }
501
- // Remove aria-owns attribute when the autocomplete is no longer visible.
502
- if (this._trackedModal) {
503
- removeAriaReferencedId(this._trackedModal, 'aria-owns', this.autocomplete.id);
504
- }
448
+ }
449
+ ngOnDestroy() {
450
+ this._cleanupWindowBlur?.();
451
+ this._handsetLandscapeSubscription.unsubscribe();
452
+ this._viewportSubscription.unsubscribe();
453
+ this._componentDestroyed = true;
454
+ this._destroyPanel();
455
+ this._closeKeyEventStream.complete();
456
+ this._clearFromModal();
457
+ }
458
+ get panelOpen() {
459
+ return this._overlayAttached && this.autocomplete.showPanel;
460
+ }
461
+ _overlayAttached = false;
462
+ openPanel() {
463
+ this._openPanelInternal();
464
+ }
465
+ closePanel() {
466
+ this._resetLabel();
467
+ if (!this._overlayAttached) {
468
+ return;
505
469
  }
506
- /**
507
- * Updates the position of the autocomplete suggestion panel to ensure that it fits all options
508
- * within the viewport.
509
- */
510
- updatePosition() {
511
- if (this._overlayAttached) {
512
- this._overlayRef.updatePosition();
513
- }
470
+ if (this.panelOpen) {
471
+ this._zone.run(() => {
472
+ this.autocomplete.closed.emit();
473
+ });
514
474
  }
515
- /**
516
- * A stream of actions that should close the autocomplete panel, including
517
- * when an option is selected, on blur, and when TAB is pressed.
518
- */
519
- get panelClosingActions() {
520
- return merge(this.optionSelections, this.autocomplete._keyManager.tabOut.pipe(filter(() => this._overlayAttached)), this._closeKeyEventStream, this._getOutsideClickStream(), this._overlayRef
521
- ? this._overlayRef.detachments().pipe(filter(() => this._overlayAttached))
522
- : of()).pipe(
523
- // Normalize the output so we return a consistent type.
524
- map(event => (event instanceof MatOptionSelectionChange ? event : null)));
475
+ if (this.autocomplete._latestOpeningTrigger === this) {
476
+ this.autocomplete._isOpen = false;
477
+ this.autocomplete._latestOpeningTrigger = null;
525
478
  }
526
- /** Stream of changes to the selection state of the autocomplete options. */
527
- optionSelections = defer(() => {
528
- const options = this.autocomplete ? this.autocomplete.options : null;
529
- if (options) {
530
- return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map(option => option.onSelectionChange))));
531
- }
532
- // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
533
- // Return a stream that we'll replace with the real one once everything is in place.
534
- return this._initialized.pipe(switchMap(() => this.optionSelections));
535
- });
536
- /** The currently active option, coerced to MatOption type. */
537
- get activeOption() {
538
- if (this.autocomplete && this.autocomplete._keyManager) {
539
- return this.autocomplete._keyManager.activeItem;
540
- }
541
- return null;
479
+ this._overlayAttached = false;
480
+ this._pendingAutoselectedOption = null;
481
+ if (this._overlayRef && this._overlayRef.hasAttached()) {
482
+ this._overlayRef.detach();
483
+ this._closingActionsSubscription.unsubscribe();
542
484
  }
543
- /** Stream of clicks outside of the autocomplete panel. */
544
- _getOutsideClickStream() {
545
- return new Observable(observer => {
546
- const listener = (event) => {
547
- // If we're in the Shadow DOM, the event target will be the shadow root, so we have to
548
- // fall back to check the first element in the path of the click event.
549
- const clickTarget = _getEventTarget(event);
550
- const formField = this._formField
551
- ? this._formField.getConnectedOverlayOrigin().nativeElement
552
- : null;
553
- const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
554
- if (this._overlayAttached &&
555
- clickTarget !== this._element.nativeElement &&
556
- // Normally focus moves inside `mousedown` so this condition will almost always be
557
- // true. Its main purpose is to handle the case where the input is focused from an
558
- // outside click which propagates up to the `body` listener within the same sequence
559
- // and causes the panel to close immediately (see #3106).
560
- !this._hasFocus() &&
561
- (!formField || !formField.contains(clickTarget)) &&
562
- (!customOrigin || !customOrigin.contains(clickTarget)) &&
563
- !!this._overlayRef &&
564
- !this._overlayRef.overlayElement.contains(clickTarget)) {
565
- observer.next(event);
566
- }
567
- };
568
- const cleanups = [
569
- this._renderer.listen('document', 'click', listener),
570
- this._renderer.listen('document', 'auxclick', listener),
571
- this._renderer.listen('document', 'touchend', listener),
572
- ];
573
- return () => {
574
- cleanups.forEach(current => current());
575
- };
576
- });
485
+ this._updatePanelState();
486
+ if (!this._componentDestroyed) {
487
+ this._changeDetectorRef.detectChanges();
577
488
  }
578
- // Implemented as part of ControlValueAccessor.
579
- writeValue(value) {
580
- Promise.resolve(null).then(() => this._assignOptionValue(value));
489
+ if (this._trackedModal) {
490
+ removeAriaReferencedId(this._trackedModal, 'aria-owns', this.autocomplete.id);
581
491
  }
582
- // Implemented as part of ControlValueAccessor.
583
- registerOnChange(fn) {
584
- this._onChange = fn;
492
+ }
493
+ updatePosition() {
494
+ if (this._overlayAttached) {
495
+ this._overlayRef.updatePosition();
585
496
  }
586
- // Implemented as part of ControlValueAccessor.
587
- registerOnTouched(fn) {
588
- this._onTouched = fn;
497
+ }
498
+ get panelClosingActions() {
499
+ return merge(this.optionSelections, this.autocomplete._keyManager.tabOut.pipe(filter(() => this._overlayAttached)), this._closeKeyEventStream, this._getOutsideClickStream(), this._overlayRef ? this._overlayRef.detachments().pipe(filter(() => this._overlayAttached)) : of()).pipe(map(event => event instanceof MatOptionSelectionChange ? event : null));
500
+ }
501
+ optionSelections = defer(() => {
502
+ const options = this.autocomplete ? this.autocomplete.options : null;
503
+ if (options) {
504
+ return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map(option => option.onSelectionChange))));
589
505
  }
590
- // Implemented as part of ControlValueAccessor.
591
- setDisabledState(isDisabled) {
592
- this._element.nativeElement.disabled = isDisabled;
506
+ return this._initialized.pipe(switchMap(() => this.optionSelections));
507
+ });
508
+ get activeOption() {
509
+ if (this.autocomplete && this.autocomplete._keyManager) {
510
+ return this.autocomplete._keyManager.activeItem;
593
511
  }
594
- _handleKeydown(e) {
595
- const event = e;
596
- const keyCode = event.keyCode;
597
- const hasModifier = hasModifierKey(event);
598
- // Prevent the default action on all escape key presses. This is here primarily to bring IE
599
- // in line with other browsers. By default, pressing escape on IE will cause it to revert
600
- // the input value to the one that it had on focus, however it won't dispatch any events
601
- // which means that the model value will be out of sync with the view.
602
- if (keyCode === ESCAPE && !hasModifier) {
603
- event.preventDefault();
604
- }
605
- this._valueOnLastKeydown = this._element.nativeElement.value;
606
- if (this.activeOption && keyCode === ENTER && this.panelOpen && !hasModifier) {
607
- this.activeOption._selectViaInteraction();
608
- this._resetActiveItem();
609
- event.preventDefault();
610
- }
611
- else if (this.autocomplete) {
612
- const prevActiveItem = this.autocomplete._keyManager.activeItem;
613
- const isArrowKey = keyCode === UP_ARROW || keyCode === DOWN_ARROW;
614
- if (keyCode === TAB || (isArrowKey && !hasModifier && this.panelOpen)) {
615
- this.autocomplete._keyManager.onKeydown(event);
616
- }
617
- else if (isArrowKey && this._canOpen()) {
618
- this._openPanelInternal(this._valueOnLastKeydown);
619
- }
620
- if (isArrowKey || this.autocomplete._keyManager.activeItem !== prevActiveItem) {
621
- this._scrollToOption(this.autocomplete._keyManager.activeItemIndex || 0);
622
- if (this.autocomplete.autoSelectActiveOption && this.activeOption) {
623
- if (!this._pendingAutoselectedOption) {
624
- this._valueBeforeAutoSelection = this._valueOnLastKeydown;
625
- }
626
- this._pendingAutoselectedOption = this.activeOption;
627
- this._assignOptionValue(this.activeOption.value);
628
- }
629
- }
630
- }
631
- }
632
- _handleInput(event) {
633
- let target = event.target;
634
- let value = target.value;
635
- // Based on `NumberValueAccessor` from forms.
636
- if (target.type === 'number') {
637
- value = value == '' ? null : parseFloat(value);
638
- }
639
- // If the input has a placeholder, IE will fire the `input` event on page load,
640
- // focus and blur, in addition to when the user actually changed the value. To
641
- // filter out all of the extra events, we save the value on focus and between
642
- // `input` events, and we check whether it changed.
643
- // See: https://connect.microsoft.com/IE/feedback/details/885747/
644
- if (this._previousValue !== value) {
645
- this._previousValue = value;
646
- this._pendingAutoselectedOption = null;
647
- // If selection is required we don't write to the CVA while the user is typing.
648
- // At the end of the selection either the user will have picked something
649
- // or we'll reset the value back to null.
650
- if (!this.autocomplete || !this.autocomplete.requireSelection) {
651
- this._onChange(value);
652
- }
653
- if (!value) {
654
- this._clearPreviousSelectedOption(null, false);
655
- }
656
- else if (this.panelOpen && !this.autocomplete.requireSelection) {
657
- // Note that we don't reset this when `requireSelection` is enabled,
658
- // because the option will be reset when the panel is closed.
659
- const selectedOption = this.autocomplete.options?.find(option => option.selected);
660
- if (selectedOption) {
661
- const display = this._getDisplayValue(selectedOption.value);
662
- if (value !== display) {
663
- selectedOption.deselect(false);
664
- }
665
- }
666
- }
667
- if (this._canOpen() && this._hasFocus()) {
668
- // When the `input` event fires, the input's value will have already changed. This means
669
- // that if we take the `this._element.nativeElement.value` directly, it'll be one keystroke
670
- // behind. This can be a problem when the user selects a value, changes a character while
671
- // the input still has focus and then clicks away (see #28432). To work around it, we
672
- // capture the value in `keydown` so we can use it here.
673
- const valueOnAttach = this._valueOnLastKeydown ?? this._element.nativeElement.value;
674
- this._valueOnLastKeydown = null;
675
- this._openPanelInternal(valueOnAttach);
676
- }
677
- }
678
- }
679
- _handleFocus() {
680
- if (!this._canOpenOnNextFocus) {
681
- this._canOpenOnNextFocus = true;
682
- }
683
- else if (this._canOpen()) {
684
- this._previousValue = this._element.nativeElement.value;
685
- this._attachOverlay(this._previousValue);
686
- this._floatLabel(true);
512
+ return null;
513
+ }
514
+ _getOutsideClickStream() {
515
+ return new Observable(observer => {
516
+ const listener = event => {
517
+ const clickTarget = _getEventTarget(event);
518
+ const formField = this._formField ? this._formField.getConnectedOverlayOrigin().nativeElement : null;
519
+ const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
520
+ if (this._overlayAttached && clickTarget !== this._element.nativeElement && !this._hasFocus() && (!formField || !formField.contains(clickTarget)) && (!customOrigin || !customOrigin.contains(clickTarget)) && !!this._overlayRef && !this._overlayRef.overlayElement.contains(clickTarget)) {
521
+ observer.next(event);
687
522
  }
523
+ };
524
+ const cleanups = [this._renderer.listen('document', 'click', listener), this._renderer.listen('document', 'auxclick', listener), this._renderer.listen('document', 'touchend', listener)];
525
+ return () => {
526
+ cleanups.forEach(current => current());
527
+ };
528
+ });
529
+ }
530
+ writeValue(value) {
531
+ Promise.resolve(null).then(() => this._assignOptionValue(value));
532
+ }
533
+ registerOnChange(fn) {
534
+ this._onChange = fn;
535
+ }
536
+ registerOnTouched(fn) {
537
+ this._onTouched = fn;
538
+ }
539
+ setDisabledState(isDisabled) {
540
+ this._element.nativeElement.disabled = isDisabled;
541
+ }
542
+ _handleKeydown(e) {
543
+ const event = e;
544
+ const keyCode = event.keyCode;
545
+ const hasModifier = hasModifierKey(event);
546
+ if (keyCode === ESCAPE && !hasModifier) {
547
+ event.preventDefault();
688
548
  }
689
- _handleClick() {
690
- if (this._canOpen() && !this.panelOpen) {
691
- this._openPanelInternal();
549
+ this._valueOnLastKeydown = this._element.nativeElement.value;
550
+ if (this.activeOption && keyCode === ENTER && this.panelOpen && !hasModifier) {
551
+ this.activeOption._selectViaInteraction();
552
+ this._resetActiveItem();
553
+ event.preventDefault();
554
+ } else if (this.autocomplete) {
555
+ const prevActiveItem = this.autocomplete._keyManager.activeItem;
556
+ const isArrowKey = keyCode === UP_ARROW || keyCode === DOWN_ARROW;
557
+ if (keyCode === TAB || isArrowKey && !hasModifier && this.panelOpen) {
558
+ this.autocomplete._keyManager.onKeydown(event);
559
+ } else if (isArrowKey && this._canOpen()) {
560
+ this._openPanelInternal(this._valueOnLastKeydown);
561
+ }
562
+ if (isArrowKey || this.autocomplete._keyManager.activeItem !== prevActiveItem) {
563
+ this._scrollToOption(this.autocomplete._keyManager.activeItemIndex || 0);
564
+ if (this.autocomplete.autoSelectActiveOption && this.activeOption) {
565
+ if (!this._pendingAutoselectedOption) {
566
+ this._valueBeforeAutoSelection = this._valueOnLastKeydown;
567
+ }
568
+ this._pendingAutoselectedOption = this.activeOption;
569
+ this._assignOptionValue(this.activeOption.value);
692
570
  }
571
+ }
693
572
  }
694
- /** Whether the input currently has focus. */
695
- _hasFocus() {
696
- return _getFocusedElementPierceShadowDom() === this._element.nativeElement;
573
+ }
574
+ _handleInput(event) {
575
+ let target = event.target;
576
+ let value = target.value;
577
+ if (target.type === 'number') {
578
+ value = value == '' ? null : parseFloat(value);
697
579
  }
698
- /**
699
- * In "auto" mode, the label will animate down as soon as focus is lost.
700
- * This causes the value to jump when selecting an option with the mouse.
701
- * This method manually floats the label until the panel can be closed.
702
- * @param shouldAnimate Whether the label should be animated when it is floated.
703
- */
704
- _floatLabel(shouldAnimate = false) {
705
- if (this._formField && this._formField.floatLabel === 'auto') {
706
- if (shouldAnimate) {
707
- this._formField._animateAndLockLabel();
708
- }
709
- else {
710
- this._formField.floatLabel = 'always';
711
- }
712
- this._manuallyFloatingLabel = true;
580
+ if (this._previousValue !== value) {
581
+ this._previousValue = value;
582
+ this._pendingAutoselectedOption = null;
583
+ if (!this.autocomplete || !this.autocomplete.requireSelection) {
584
+ this._onChange(value);
585
+ }
586
+ if (!value) {
587
+ this._clearPreviousSelectedOption(null, false);
588
+ } else if (this.panelOpen && !this.autocomplete.requireSelection) {
589
+ const selectedOption = this.autocomplete.options?.find(option => option.selected);
590
+ if (selectedOption) {
591
+ const display = this._getDisplayValue(selectedOption.value);
592
+ if (value !== display) {
593
+ selectedOption.deselect(false);
594
+ }
713
595
  }
596
+ }
597
+ if (this._canOpen() && this._hasFocus()) {
598
+ const valueOnAttach = this._valueOnLastKeydown ?? this._element.nativeElement.value;
599
+ this._valueOnLastKeydown = null;
600
+ this._openPanelInternal(valueOnAttach);
601
+ }
714
602
  }
715
- /** If the label has been manually elevated, return it to its normal state. */
716
- _resetLabel() {
717
- if (this._manuallyFloatingLabel) {
718
- if (this._formField) {
719
- this._formField.floatLabel = 'auto';
720
- }
721
- this._manuallyFloatingLabel = false;
722
- }
603
+ }
604
+ _handleFocus() {
605
+ if (!this._canOpenOnNextFocus) {
606
+ this._canOpenOnNextFocus = true;
607
+ } else if (this._canOpen()) {
608
+ this._previousValue = this._element.nativeElement.value;
609
+ this._attachOverlay(this._previousValue);
610
+ this._floatLabel(true);
723
611
  }
724
- /**
725
- * This method listens to a stream of panel closing actions and resets the
726
- * stream every time the option list changes.
727
- */
728
- _subscribeToClosingActions() {
729
- const initialRender = new Observable(subscriber => {
730
- afterNextRender(() => {
731
- subscriber.next();
732
- }, { injector: this._environmentInjector });
733
- });
734
- const optionChanges = this.autocomplete.options?.changes.pipe(tap(() => this._positionStrategy.reapplyLastPosition()),
735
- // Defer emitting to the stream until the next tick, because changing
736
- // bindings in here will cause "changed after checked" errors.
737
- delay(0)) ?? of();
738
- // When the options are initially rendered, and when the option list changes...
739
- return (merge(initialRender, optionChanges)
740
- .pipe(
741
- // create a new stream of panelClosingActions, replacing any previous streams
742
- // that were created, and flatten it so our stream only emits closing events...
743
- switchMap(() => this._zone.run(() => {
744
- // `afterNextRender` always runs outside of the Angular zone, thus we have to re-enter
745
- // the Angular zone. This will lead to change detection being called outside of the Angular
746
- // zone and the `autocomplete.opened` will also emit outside of the Angular.
747
- const wasOpen = this.panelOpen;
748
- this._resetActiveItem();
749
- this._updatePanelState();
750
- this._changeDetectorRef.detectChanges();
751
- if (this.panelOpen) {
752
- this._overlayRef.updatePosition();
753
- }
754
- if (wasOpen !== this.panelOpen) {
755
- // If the `panelOpen` state changed, we need to make sure to emit the `opened` or
756
- // `closed` event, because we may not have emitted it. This can happen
757
- // - if the users opens the panel and there are no options, but the
758
- // options come in slightly later or as a result of the value changing,
759
- // - if the panel is closed after the user entered a string that did not match any
760
- // of the available options,
761
- // - if a valid string is entered after an invalid one.
762
- if (this.panelOpen) {
763
- this._emitOpened();
764
- }
765
- else {
766
- this.autocomplete.closed.emit();
767
- }
768
- }
769
- return this.panelClosingActions;
770
- })),
771
- // when the first closing event occurs...
772
- take(1))
773
- // set the value, close the panel, and complete.
774
- .subscribe(event => this._setValueAndClose(event)));
612
+ }
613
+ _handleClick() {
614
+ if (this._canOpen() && !this.panelOpen) {
615
+ this._openPanelInternal();
775
616
  }
776
- /**
777
- * Emits the opened event once it's known that the panel will be shown and stores
778
- * the state of the trigger right before the opening sequence was finished.
779
- */
780
- _emitOpened() {
781
- this.autocomplete.opened.emit();
617
+ }
618
+ _hasFocus() {
619
+ return _getFocusedElementPierceShadowDom() === this._element.nativeElement;
620
+ }
621
+ _floatLabel(shouldAnimate = false) {
622
+ if (this._formField && this._formField.floatLabel === 'auto') {
623
+ if (shouldAnimate) {
624
+ this._formField._animateAndLockLabel();
625
+ } else {
626
+ this._formField.floatLabel = 'always';
627
+ }
628
+ this._manuallyFloatingLabel = true;
782
629
  }
783
- /** Destroys the autocomplete suggestion panel. */
784
- _destroyPanel() {
785
- if (this._overlayRef) {
786
- this.closePanel();
787
- this._overlayRef.dispose();
788
- this._overlayRef = null;
789
- }
630
+ }
631
+ _resetLabel() {
632
+ if (this._manuallyFloatingLabel) {
633
+ if (this._formField) {
634
+ this._formField.floatLabel = 'auto';
635
+ }
636
+ this._manuallyFloatingLabel = false;
790
637
  }
791
- /** Given a value, returns the string that should be shown within the input. */
792
- _getDisplayValue(value) {
793
- const autocomplete = this.autocomplete;
794
- return autocomplete && autocomplete.displayWith ? autocomplete.displayWith(value) : value;
795
- }
796
- _assignOptionValue(value) {
797
- const toDisplay = this._getDisplayValue(value);
798
- if (value == null) {
799
- this._clearPreviousSelectedOption(null, false);
638
+ }
639
+ _subscribeToClosingActions() {
640
+ const initialRender = new Observable(subscriber => {
641
+ afterNextRender(() => {
642
+ subscriber.next();
643
+ }, {
644
+ injector: this._environmentInjector
645
+ });
646
+ });
647
+ const optionChanges = this.autocomplete.options?.changes.pipe(tap(() => this._positionStrategy.reapplyLastPosition()), delay(0)) ?? of();
648
+ return merge(initialRender, optionChanges).pipe(switchMap(() => this._zone.run(() => {
649
+ const wasOpen = this.panelOpen;
650
+ this._resetActiveItem();
651
+ this._updatePanelState();
652
+ this._changeDetectorRef.detectChanges();
653
+ if (this.panelOpen) {
654
+ this._overlayRef.updatePosition();
655
+ }
656
+ if (wasOpen !== this.panelOpen) {
657
+ if (this.panelOpen) {
658
+ this._emitOpened();
659
+ } else {
660
+ this.autocomplete.closed.emit();
800
661
  }
801
- // Simply falling back to an empty string if the display value is falsy does not work properly.
802
- // The display value can also be the number zero and shouldn't fall back to an empty string.
803
- this._updateNativeInputValue(toDisplay != null ? toDisplay : '');
662
+ }
663
+ return this.panelClosingActions;
664
+ })), take(1)).subscribe(event => this._setValueAndClose(event));
665
+ }
666
+ _emitOpened() {
667
+ this.autocomplete.opened.emit();
668
+ }
669
+ _destroyPanel() {
670
+ if (this._overlayRef) {
671
+ this.closePanel();
672
+ this._overlayRef.dispose();
673
+ this._overlayRef = null;
804
674
  }
805
- _updateNativeInputValue(value) {
806
- // If it's used within a `MatFormField`, we should set it through the property so it can go
807
- // through change detection.
808
- if (this._formField) {
809
- this._formField._control.value = value;
810
- }
811
- else {
812
- this._element.nativeElement.value = value;
813
- }
814
- this._previousValue = value;
675
+ }
676
+ _getDisplayValue(value) {
677
+ const autocomplete = this.autocomplete;
678
+ return autocomplete && autocomplete.displayWith ? autocomplete.displayWith(value) : value;
679
+ }
680
+ _assignOptionValue(value) {
681
+ const toDisplay = this._getDisplayValue(value);
682
+ if (value == null) {
683
+ this._clearPreviousSelectedOption(null, false);
815
684
  }
816
- /**
817
- * This method closes the panel, and if a value is specified, also sets the associated
818
- * control to that value. It will also mark the control as dirty if this interaction
819
- * stemmed from the user.
820
- */
821
- _setValueAndClose(event) {
822
- const panel = this.autocomplete;
823
- const toSelect = event ? event.source : this._pendingAutoselectedOption;
824
- if (toSelect) {
825
- this._clearPreviousSelectedOption(toSelect);
826
- this._assignOptionValue(toSelect.value);
827
- // TODO(crisbeto): this should wait until the animation is done, otherwise the value
828
- // gets reset while the panel is still animating which looks glitchy. It'll likely break
829
- // some tests to change it at this point.
830
- this._onChange(toSelect.value);
831
- panel._emitSelectEvent(toSelect);
832
- this._element.nativeElement.focus();
833
- }
834
- else if (panel.requireSelection &&
835
- this._element.nativeElement.value !== this._valueOnAttach) {
836
- this._clearPreviousSelectedOption(null);
837
- this._assignOptionValue(null);
838
- this._onChange(null);
839
- }
840
- this.closePanel();
685
+ this._updateNativeInputValue(toDisplay != null ? toDisplay : '');
686
+ }
687
+ _updateNativeInputValue(value) {
688
+ if (this._formField) {
689
+ this._formField._control.value = value;
690
+ } else {
691
+ this._element.nativeElement.value = value;
841
692
  }
842
- /**
843
- * Clear any previous selected option and emit a selection change event for this option
844
- */
845
- _clearPreviousSelectedOption(skip, emitEvent) {
846
- // Null checks are necessary here, because the autocomplete
847
- // or its options may not have been assigned yet.
848
- this.autocomplete?.options?.forEach(option => {
849
- if (option !== skip && option.selected) {
850
- option.deselect(emitEvent);
851
- }
852
- });
693
+ this._previousValue = value;
694
+ }
695
+ _setValueAndClose(event) {
696
+ const panel = this.autocomplete;
697
+ const toSelect = event ? event.source : this._pendingAutoselectedOption;
698
+ if (toSelect) {
699
+ this._clearPreviousSelectedOption(toSelect);
700
+ this._assignOptionValue(toSelect.value);
701
+ this._onChange(toSelect.value);
702
+ panel._emitSelectEvent(toSelect);
703
+ this._element.nativeElement.focus();
704
+ } else if (panel.requireSelection && this._element.nativeElement.value !== this._valueOnAttach) {
705
+ this._clearPreviousSelectedOption(null);
706
+ this._assignOptionValue(null);
707
+ this._onChange(null);
853
708
  }
854
- _openPanelInternal(valueOnAttach = this._element.nativeElement.value) {
855
- this._attachOverlay(valueOnAttach);
856
- this._floatLabel();
857
- // Add aria-owns attribute when the autocomplete becomes visible.
858
- if (this._trackedModal) {
859
- const panelId = this.autocomplete.id;
860
- addAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
861
- }
709
+ this.closePanel();
710
+ }
711
+ _clearPreviousSelectedOption(skip, emitEvent) {
712
+ this.autocomplete?.options?.forEach(option => {
713
+ if (option !== skip && option.selected) {
714
+ option.deselect(emitEvent);
715
+ }
716
+ });
717
+ }
718
+ _openPanelInternal(valueOnAttach = this._element.nativeElement.value) {
719
+ this._attachOverlay(valueOnAttach);
720
+ this._floatLabel();
721
+ if (this._trackedModal) {
722
+ const panelId = this.autocomplete.id;
723
+ addAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
862
724
  }
863
- _attachOverlay(valueOnAttach) {
864
- if (!this.autocomplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {
865
- throw getMatAutocompleteMissingPanelError();
866
- }
867
- let overlayRef = this._overlayRef;
868
- if (!overlayRef) {
869
- this._portal = new TemplatePortal(this.autocomplete.template, this._viewContainerRef, {
870
- id: this._formField?.getLabelId(),
871
- });
872
- overlayRef = createOverlayRef(this._injector, this._getOverlayConfig());
873
- this._overlayRef = overlayRef;
874
- this._viewportSubscription = this._viewportRuler.change().subscribe(() => {
875
- if (this.panelOpen && overlayRef) {
876
- overlayRef.updateSize({ width: this._getPanelWidth() });
877
- }
878
- });
879
- // Subscribe to the breakpoint events stream to detect when screen is in
880
- // handsetLandscape.
881
- this._handsetLandscapeSubscription = this._breakpointObserver
882
- .observe(Breakpoints.HandsetLandscape)
883
- .subscribe(result => {
884
- const isHandsetLandscape = result.matches;
885
- // Check if result.matches Breakpoints.HandsetLandscape. Apply HandsetLandscape
886
- // settings to prevent overlay cutoff in that breakpoint. Fixes b/284148377
887
- if (isHandsetLandscape) {
888
- this._positionStrategy
889
- .withFlexibleDimensions(true)
890
- .withGrowAfterOpen(true)
891
- .withViewportMargin(8);
892
- }
893
- else {
894
- this._positionStrategy
895
- .withFlexibleDimensions(false)
896
- .withGrowAfterOpen(false)
897
- .withViewportMargin(0);
898
- }
899
- });
900
- }
901
- else {
902
- // Update the trigger, panel width and direction, in case anything has changed.
903
- this._positionStrategy.setOrigin(this._getConnectedElement());
904
- overlayRef.updateSize({ width: this._getPanelWidth() });
905
- }
906
- if (overlayRef && !overlayRef.hasAttached()) {
907
- overlayRef.attach(this._portal);
908
- this._valueOnAttach = valueOnAttach;
909
- this._valueOnLastKeydown = null;
910
- this._closingActionsSubscription = this._subscribeToClosingActions();
911
- }
912
- const wasOpen = this.panelOpen;
913
- this.autocomplete._isOpen = this._overlayAttached = true;
914
- this.autocomplete._latestOpeningTrigger = this;
915
- this.autocomplete._setColor(this._formField?.color);
916
- this._updatePanelState();
917
- this._applyModalPanelOwnership();
918
- // We need to do an extra `panelOpen` check in here, because the
919
- // autocomplete won't be shown if there are no options.
920
- if (this.panelOpen && wasOpen !== this.panelOpen) {
921
- this._emitOpened();
922
- }
725
+ }
726
+ _attachOverlay(valueOnAttach) {
727
+ if (!this.autocomplete && (typeof ngDevMode === 'undefined' || ngDevMode)) {
728
+ throw getMatAutocompleteMissingPanelError();
923
729
  }
924
- /** Handles keyboard events coming from the overlay panel. */
925
- _handlePanelKeydown = (event) => {
926
- // Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
927
- // See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
928
- if ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
929
- (event.keyCode === UP_ARROW && hasModifierKey(event, 'altKey'))) {
930
- // If the user had typed something in before we autoselected an option, and they decided
931
- // to cancel the selection, restore the input value to the one they had typed in.
932
- if (this._pendingAutoselectedOption) {
933
- this._updateNativeInputValue(this._valueBeforeAutoSelection ?? '');
934
- this._pendingAutoselectedOption = null;
935
- }
936
- this._closeKeyEventStream.next();
937
- this._resetActiveItem();
938
- // We need to stop propagation, otherwise the event will eventually
939
- // reach the input itself and cause the overlay to be reopened.
940
- event.stopPropagation();
941
- event.preventDefault();
942
- }
943
- };
944
- /** Updates the panel's visibility state and any trigger state tied to id. */
945
- _updatePanelState() {
946
- this.autocomplete._setVisibility();
947
- // Note that here we subscribe and unsubscribe based on the panel's visiblity state,
948
- // because the act of subscribing will prevent events from reaching other overlays and
949
- // we don't want to block the events if there are no options.
950
- if (this.panelOpen) {
951
- const overlayRef = this._overlayRef;
952
- if (!this._keydownSubscription) {
953
- // Use the `keydownEvents` in order to take advantage of
954
- // the overlay event targeting provided by the CDK overlay.
955
- this._keydownSubscription = overlayRef.keydownEvents().subscribe(this._handlePanelKeydown);
956
- }
957
- if (!this._outsideClickSubscription) {
958
- // Subscribe to the pointer events stream so that it doesn't get picked up by other overlays.
959
- // TODO(crisbeto): we should switch `_getOutsideClickStream` eventually to use this stream,
960
- // but the behvior isn't exactly the same and it ends up breaking some internal tests.
961
- this._outsideClickSubscription = overlayRef.outsidePointerEvents().subscribe();
962
- }
730
+ let overlayRef = this._overlayRef;
731
+ if (!overlayRef) {
732
+ this._portal = new TemplatePortal(this.autocomplete.template, this._viewContainerRef, {
733
+ id: this._formField?.getLabelId()
734
+ });
735
+ overlayRef = createOverlayRef(this._injector, this._getOverlayConfig());
736
+ this._overlayRef = overlayRef;
737
+ this._viewportSubscription = this._viewportRuler.change().subscribe(() => {
738
+ if (this.panelOpen && overlayRef) {
739
+ overlayRef.updateSize({
740
+ width: this._getPanelWidth()
741
+ });
963
742
  }
964
- else {
965
- this._keydownSubscription?.unsubscribe();
966
- this._outsideClickSubscription?.unsubscribe();
967
- this._keydownSubscription = this._outsideClickSubscription = null;
743
+ });
744
+ this._handsetLandscapeSubscription = this._breakpointObserver.observe(Breakpoints.HandsetLandscape).subscribe(result => {
745
+ const isHandsetLandscape = result.matches;
746
+ if (isHandsetLandscape) {
747
+ this._positionStrategy.withFlexibleDimensions(true).withGrowAfterOpen(true).withViewportMargin(8);
748
+ } else {
749
+ this._positionStrategy.withFlexibleDimensions(false).withGrowAfterOpen(false).withViewportMargin(0);
968
750
  }
751
+ });
752
+ } else {
753
+ this._positionStrategy.setOrigin(this._getConnectedElement());
754
+ overlayRef.updateSize({
755
+ width: this._getPanelWidth()
756
+ });
969
757
  }
970
- _getOverlayConfig() {
971
- return new OverlayConfig({
972
- positionStrategy: this._getOverlayPosition(),
973
- scrollStrategy: this._scrollStrategy(),
974
- width: this._getPanelWidth(),
975
- direction: this._dir ?? undefined,
976
- hasBackdrop: this._defaults?.hasBackdrop,
977
- backdropClass: this._defaults?.backdropClass || 'cdk-overlay-transparent-backdrop',
978
- panelClass: this._overlayPanelClass,
979
- disableAnimations: this._animationsDisabled,
980
- });
758
+ if (overlayRef && !overlayRef.hasAttached()) {
759
+ overlayRef.attach(this._portal);
760
+ this._valueOnAttach = valueOnAttach;
761
+ this._valueOnLastKeydown = null;
762
+ this._closingActionsSubscription = this._subscribeToClosingActions();
981
763
  }
982
- _getOverlayPosition() {
983
- // Set default Overlay Position
984
- const strategy = createFlexibleConnectedPositionStrategy(this._injector, this._getConnectedElement())
985
- .withFlexibleDimensions(false)
986
- .withPush(false);
987
- this._setStrategyPositions(strategy);
988
- this._positionStrategy = strategy;
989
- return strategy;
764
+ const wasOpen = this.panelOpen;
765
+ this.autocomplete._isOpen = this._overlayAttached = true;
766
+ this.autocomplete._latestOpeningTrigger = this;
767
+ this.autocomplete._setColor(this._formField?.color);
768
+ this._updatePanelState();
769
+ this._applyModalPanelOwnership();
770
+ if (this.panelOpen && wasOpen !== this.panelOpen) {
771
+ this._emitOpened();
990
772
  }
991
- /** Sets the positions on a position strategy based on the directive's input state. */
992
- _setStrategyPositions(positionStrategy) {
993
- // Note that we provide horizontal fallback positions, even though by default the dropdown
994
- // width matches the input, because consumers can override the width. See #18854.
995
- const belowPositions = [
996
- { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
997
- { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
998
- ];
999
- // The overlay edge connected to the trigger should have squared corners, while
1000
- // the opposite end has rounded corners. We apply a CSS class to swap the
1001
- // border-radius based on the overlay position.
1002
- const panelClass = this._aboveClass;
1003
- const abovePositions = [
1004
- { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', panelClass },
1005
- { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', panelClass },
1006
- ];
1007
- let positions;
1008
- if (this.position === 'above') {
1009
- positions = abovePositions;
1010
- }
1011
- else if (this.position === 'below') {
1012
- positions = belowPositions;
1013
- }
1014
- else {
1015
- positions = [...belowPositions, ...abovePositions];
1016
- }
1017
- positionStrategy.withPositions(positions);
773
+ }
774
+ _handlePanelKeydown = event => {
775
+ if (event.keyCode === ESCAPE && !hasModifierKey(event) || event.keyCode === UP_ARROW && hasModifierKey(event, 'altKey')) {
776
+ if (this._pendingAutoselectedOption) {
777
+ this._updateNativeInputValue(this._valueBeforeAutoSelection ?? '');
778
+ this._pendingAutoselectedOption = null;
779
+ }
780
+ this._closeKeyEventStream.next();
781
+ this._resetActiveItem();
782
+ event.stopPropagation();
783
+ event.preventDefault();
1018
784
  }
1019
- _getConnectedElement() {
1020
- if (this.connectedTo) {
1021
- return this.connectedTo.elementRef;
1022
- }
1023
- return this._formField ? this._formField.getConnectedOverlayOrigin() : this._element;
785
+ };
786
+ _updatePanelState() {
787
+ this.autocomplete._setVisibility();
788
+ if (this.panelOpen) {
789
+ const overlayRef = this._overlayRef;
790
+ if (!this._keydownSubscription) {
791
+ this._keydownSubscription = overlayRef.keydownEvents().subscribe(this._handlePanelKeydown);
792
+ }
793
+ if (!this._outsideClickSubscription) {
794
+ this._outsideClickSubscription = overlayRef.outsidePointerEvents().subscribe();
795
+ }
796
+ } else {
797
+ this._keydownSubscription?.unsubscribe();
798
+ this._outsideClickSubscription?.unsubscribe();
799
+ this._keydownSubscription = this._outsideClickSubscription = null;
1024
800
  }
1025
- _getPanelWidth() {
1026
- return this.autocomplete.panelWidth || this._getHostWidth();
801
+ }
802
+ _getOverlayConfig() {
803
+ return new OverlayConfig({
804
+ positionStrategy: this._getOverlayPosition(),
805
+ scrollStrategy: this._scrollStrategy(),
806
+ width: this._getPanelWidth(),
807
+ direction: this._dir ?? undefined,
808
+ hasBackdrop: this._defaults?.hasBackdrop,
809
+ backdropClass: this._defaults?.backdropClass || 'cdk-overlay-transparent-backdrop',
810
+ panelClass: this._overlayPanelClass,
811
+ disableAnimations: this._animationsDisabled
812
+ });
813
+ }
814
+ _getOverlayPosition() {
815
+ const strategy = createFlexibleConnectedPositionStrategy(this._injector, this._getConnectedElement()).withFlexibleDimensions(false).withPush(false);
816
+ this._setStrategyPositions(strategy);
817
+ this._positionStrategy = strategy;
818
+ return strategy;
819
+ }
820
+ _setStrategyPositions(positionStrategy) {
821
+ const belowPositions = [{
822
+ originX: 'start',
823
+ originY: 'bottom',
824
+ overlayX: 'start',
825
+ overlayY: 'top'
826
+ }, {
827
+ originX: 'end',
828
+ originY: 'bottom',
829
+ overlayX: 'end',
830
+ overlayY: 'top'
831
+ }];
832
+ const panelClass = this._aboveClass;
833
+ const abovePositions = [{
834
+ originX: 'start',
835
+ originY: 'top',
836
+ overlayX: 'start',
837
+ overlayY: 'bottom',
838
+ panelClass
839
+ }, {
840
+ originX: 'end',
841
+ originY: 'top',
842
+ overlayX: 'end',
843
+ overlayY: 'bottom',
844
+ panelClass
845
+ }];
846
+ let positions;
847
+ if (this.position === 'above') {
848
+ positions = abovePositions;
849
+ } else if (this.position === 'below') {
850
+ positions = belowPositions;
851
+ } else {
852
+ positions = [...belowPositions, ...abovePositions];
1027
853
  }
1028
- /** Returns the width of the input element, so the panel width can match it. */
1029
- _getHostWidth() {
1030
- return this._getConnectedElement().nativeElement.getBoundingClientRect().width;
854
+ positionStrategy.withPositions(positions);
855
+ }
856
+ _getConnectedElement() {
857
+ if (this.connectedTo) {
858
+ return this.connectedTo.elementRef;
1031
859
  }
1032
- /**
1033
- * Reset the active item to -1. This is so that pressing arrow keys will activate the correct
1034
- * option.
1035
- *
1036
- * If the consumer opted-in to automatically activatating the first option, activate the first
1037
- * *enabled* option.
1038
- */
1039
- _resetActiveItem() {
1040
- const autocomplete = this.autocomplete;
1041
- if (autocomplete.autoActiveFirstOption) {
1042
- // Find the index of the first *enabled* option. Avoid calling `_keyManager.setActiveItem`
1043
- // because it activates the first option that passes the skip predicate, rather than the
1044
- // first *enabled* option.
1045
- let firstEnabledOptionIndex = -1;
1046
- for (let index = 0; index < autocomplete.options.length; index++) {
1047
- const option = autocomplete.options.get(index);
1048
- if (!option.disabled) {
1049
- firstEnabledOptionIndex = index;
1050
- break;
1051
- }
1052
- }
1053
- autocomplete._keyManager.setActiveItem(firstEnabledOptionIndex);
1054
- }
1055
- else {
1056
- autocomplete._keyManager.setActiveItem(-1);
860
+ return this._formField ? this._formField.getConnectedOverlayOrigin() : this._element;
861
+ }
862
+ _getPanelWidth() {
863
+ return this.autocomplete.panelWidth || this._getHostWidth();
864
+ }
865
+ _getHostWidth() {
866
+ return this._getConnectedElement().nativeElement.getBoundingClientRect().width;
867
+ }
868
+ _resetActiveItem() {
869
+ const autocomplete = this.autocomplete;
870
+ if (autocomplete.autoActiveFirstOption) {
871
+ let firstEnabledOptionIndex = -1;
872
+ for (let index = 0; index < autocomplete.options.length; index++) {
873
+ const option = autocomplete.options.get(index);
874
+ if (!option.disabled) {
875
+ firstEnabledOptionIndex = index;
876
+ break;
1057
877
  }
878
+ }
879
+ autocomplete._keyManager.setActiveItem(firstEnabledOptionIndex);
880
+ } else {
881
+ autocomplete._keyManager.setActiveItem(-1);
1058
882
  }
1059
- /** Determines whether the panel can be opened. */
1060
- _canOpen() {
1061
- const element = this._element.nativeElement;
1062
- return !element.readOnly && !element.disabled && !this.autocompleteDisabled;
883
+ }
884
+ _canOpen() {
885
+ const element = this._element.nativeElement;
886
+ return !element.readOnly && !element.disabled && !this.autocompleteDisabled;
887
+ }
888
+ _scrollToOption(index) {
889
+ const autocomplete = this.autocomplete;
890
+ const labelCount = _countGroupLabelsBeforeOption(index, autocomplete.options, autocomplete.optionGroups);
891
+ if (index === 0 && labelCount === 1) {
892
+ autocomplete._setScrollTop(0);
893
+ } else if (autocomplete.panel) {
894
+ const option = autocomplete.options.toArray()[index];
895
+ if (option) {
896
+ const element = option._getHostElement();
897
+ const newScrollPosition = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, autocomplete._getScrollTop(), autocomplete.panel.nativeElement.offsetHeight);
898
+ autocomplete._setScrollTop(newScrollPosition);
899
+ }
1063
900
  }
1064
- /** Scrolls to a particular option in the list. */
1065
- _scrollToOption(index) {
1066
- // Given that we are not actually focusing active options, we must manually adjust scroll
1067
- // to reveal options below the fold. First, we find the offset of the option from the top
1068
- // of the panel. If that offset is below the fold, the new scrollTop will be the offset -
1069
- // the panel height + the option height, so the active option will be just visible at the
1070
- // bottom of the panel. If that offset is above the top of the visible panel, the new scrollTop
1071
- // will become the offset. If that offset is visible within the panel already, the scrollTop is
1072
- // not adjusted.
1073
- const autocomplete = this.autocomplete;
1074
- const labelCount = _countGroupLabelsBeforeOption(index, autocomplete.options, autocomplete.optionGroups);
1075
- if (index === 0 && labelCount === 1) {
1076
- // If we've got one group label before the option and we're at the top option,
1077
- // scroll the list to the top. This is better UX than scrolling the list to the
1078
- // top of the option, because it allows the user to read the top group's label.
1079
- autocomplete._setScrollTop(0);
1080
- }
1081
- else if (autocomplete.panel) {
1082
- const option = autocomplete.options.toArray()[index];
1083
- if (option) {
1084
- const element = option._getHostElement();
1085
- const newScrollPosition = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, autocomplete._getScrollTop(), autocomplete.panel.nativeElement.offsetHeight);
1086
- autocomplete._setScrollTop(newScrollPosition);
1087
- }
1088
- }
901
+ }
902
+ _trackedModal = null;
903
+ _applyModalPanelOwnership() {
904
+ const modal = this._element.nativeElement.closest('body > .cdk-overlay-container [aria-modal="true"]');
905
+ if (!modal) {
906
+ return;
1089
907
  }
1090
- /**
1091
- * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
1092
- * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
1093
- * panel. Track the modal we have changed so we can undo the changes on destroy.
1094
- */
1095
- _trackedModal = null;
1096
- /**
1097
- * If the autocomplete trigger is inside of an `aria-modal` element, connect
1098
- * that modal to the options panel with `aria-owns`.
1099
- *
1100
- * For some browser + screen reader combinations, when navigation is inside
1101
- * of an `aria-modal` element, the screen reader treats everything outside
1102
- * of that modal as hidden or invisible.
1103
- *
1104
- * This causes a problem when the combobox trigger is _inside_ of a modal, because the
1105
- * options panel is rendered _outside_ of that modal, preventing screen reader navigation
1106
- * from reaching the panel.
1107
- *
1108
- * We can work around this issue by applying `aria-owns` to the modal with the `id` of
1109
- * the options panel. This effectively communicates to assistive technology that the
1110
- * options panel is part of the same interaction as the modal.
1111
- *
1112
- * At time of this writing, this issue is present in VoiceOver.
1113
- * See https://github.com/angular/components/issues/20694
1114
- */
1115
- _applyModalPanelOwnership() {
1116
- // TODO(http://github.com/angular/components/issues/26853): consider de-duplicating this with
1117
- // the `LiveAnnouncer` and any other usages.
1118
- //
1119
- // Note that the selector here is limited to CDK overlays at the moment in order to reduce the
1120
- // section of the DOM we need to look through. This should cover all the cases we support, but
1121
- // the selector can be expanded if it turns out to be too narrow.
1122
- const modal = this._element.nativeElement.closest('body > .cdk-overlay-container [aria-modal="true"]');
1123
- if (!modal) {
1124
- // Most commonly, the autocomplete trigger is not inside a modal.
1125
- return;
1126
- }
1127
- const panelId = this.autocomplete.id;
1128
- if (this._trackedModal) {
1129
- removeAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
1130
- }
1131
- addAriaReferencedId(modal, 'aria-owns', panelId);
1132
- this._trackedModal = modal;
908
+ const panelId = this.autocomplete.id;
909
+ if (this._trackedModal) {
910
+ removeAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
1133
911
  }
1134
- /** Clears the references to the listbox overlay element from the modal it was added to. */
1135
- _clearFromModal() {
1136
- if (this._trackedModal) {
1137
- const panelId = this.autocomplete.id;
1138
- removeAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
1139
- this._trackedModal = null;
1140
- }
912
+ addAriaReferencedId(modal, 'aria-owns', panelId);
913
+ this._trackedModal = modal;
914
+ }
915
+ _clearFromModal() {
916
+ if (this._trackedModal) {
917
+ const panelId = this.autocomplete.id;
918
+ removeAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
919
+ this._trackedModal = null;
1141
920
  }
1142
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1143
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "20.2.0-next.2", type: MatAutocompleteTrigger, isStandalone: true, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: { autocomplete: ["matAutocomplete", "autocomplete"], position: ["matAutocompletePosition", "position"], connectedTo: ["matAutocompleteConnectedTo", "connectedTo"], autocompleteAttribute: ["autocomplete", "autocompleteAttribute"], autocompleteDisabled: ["matAutocompleteDisabled", "autocompleteDisabled", booleanAttribute] }, host: { listeners: { "focusin": "_handleFocus()", "blur": "_onTouched()", "input": "_handleInput($event)", "keydown": "_handleKeydown($event)", "click": "_handleClick()" }, properties: { "attr.autocomplete": "autocompleteAttribute", "attr.role": "autocompleteDisabled ? null : \"combobox\"", "attr.aria-autocomplete": "autocompleteDisabled ? null : \"list\"", "attr.aria-activedescendant": "(panelOpen && activeOption) ? activeOption.id : null", "attr.aria-expanded": "autocompleteDisabled ? null : panelOpen.toString()", "attr.aria-controls": "(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id", "attr.aria-haspopup": "autocompleteDisabled ? null : \"listbox\"" }, classAttribute: "mat-mdc-autocomplete-trigger" }, providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR], exportAs: ["matAutocompleteTrigger"], usesOnChanges: true, ngImport: i0 });
921
+ }
922
+ static ɵfac = i0.ɵɵngDeclareFactory({
923
+ minVersion: "12.0.0",
924
+ version: "20.2.0-next.2",
925
+ ngImport: i0,
926
+ type: MatAutocompleteTrigger,
927
+ deps: [],
928
+ target: i0.ɵɵFactoryTarget.Directive
929
+ });
930
+ static ɵdir = i0.ɵɵngDeclareDirective({
931
+ minVersion: "16.1.0",
932
+ version: "20.2.0-next.2",
933
+ type: MatAutocompleteTrigger,
934
+ isStandalone: true,
935
+ selector: "input[matAutocomplete], textarea[matAutocomplete]",
936
+ inputs: {
937
+ autocomplete: ["matAutocomplete", "autocomplete"],
938
+ position: ["matAutocompletePosition", "position"],
939
+ connectedTo: ["matAutocompleteConnectedTo", "connectedTo"],
940
+ autocompleteAttribute: ["autocomplete", "autocompleteAttribute"],
941
+ autocompleteDisabled: ["matAutocompleteDisabled", "autocompleteDisabled", booleanAttribute]
942
+ },
943
+ host: {
944
+ listeners: {
945
+ "focusin": "_handleFocus()",
946
+ "blur": "_onTouched()",
947
+ "input": "_handleInput($event)",
948
+ "keydown": "_handleKeydown($event)",
949
+ "click": "_handleClick()"
950
+ },
951
+ properties: {
952
+ "attr.autocomplete": "autocompleteAttribute",
953
+ "attr.role": "autocompleteDisabled ? null : \"combobox\"",
954
+ "attr.aria-autocomplete": "autocompleteDisabled ? null : \"list\"",
955
+ "attr.aria-activedescendant": "(panelOpen && activeOption) ? activeOption.id : null",
956
+ "attr.aria-expanded": "autocompleteDisabled ? null : panelOpen.toString()",
957
+ "attr.aria-controls": "(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id",
958
+ "attr.aria-haspopup": "autocompleteDisabled ? null : \"listbox\""
959
+ },
960
+ classAttribute: "mat-mdc-autocomplete-trigger"
961
+ },
962
+ providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR],
963
+ exportAs: ["matAutocompleteTrigger"],
964
+ usesOnChanges: true,
965
+ ngImport: i0
966
+ });
1144
967
  }
1145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteTrigger, decorators: [{
1146
- type: Directive,
1147
- args: [{
1148
- selector: `input[matAutocomplete], textarea[matAutocomplete]`,
1149
- host: {
1150
- 'class': 'mat-mdc-autocomplete-trigger',
1151
- '[attr.autocomplete]': 'autocompleteAttribute',
1152
- '[attr.role]': 'autocompleteDisabled ? null : "combobox"',
1153
- '[attr.aria-autocomplete]': 'autocompleteDisabled ? null : "list"',
1154
- '[attr.aria-activedescendant]': '(panelOpen && activeOption) ? activeOption.id : null',
1155
- '[attr.aria-expanded]': 'autocompleteDisabled ? null : panelOpen.toString()',
1156
- '[attr.aria-controls]': '(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id',
1157
- '[attr.aria-haspopup]': 'autocompleteDisabled ? null : "listbox"',
1158
- // Note: we use `focusin`, as opposed to `focus`, in order to open the panel
1159
- // a little earlier. This avoids issues where IE delays the focusing of the input.
1160
- '(focusin)': '_handleFocus()',
1161
- '(blur)': '_onTouched()',
1162
- '(input)': '_handleInput($event)',
1163
- '(keydown)': '_handleKeydown($event)',
1164
- '(click)': '_handleClick()',
1165
- },
1166
- exportAs: 'matAutocompleteTrigger',
1167
- providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR],
1168
- }]
1169
- }], ctorParameters: () => [], propDecorators: { autocomplete: [{
1170
- type: Input,
1171
- args: ['matAutocomplete']
1172
- }], position: [{
1173
- type: Input,
1174
- args: ['matAutocompletePosition']
1175
- }], connectedTo: [{
1176
- type: Input,
1177
- args: ['matAutocompleteConnectedTo']
1178
- }], autocompleteAttribute: [{
1179
- type: Input,
1180
- args: ['autocomplete']
1181
- }], autocompleteDisabled: [{
1182
- type: Input,
1183
- args: [{ alias: 'matAutocompleteDisabled', transform: booleanAttribute }]
1184
- }] } });
968
+ i0.ɵɵngDeclareClassMetadata({
969
+ minVersion: "12.0.0",
970
+ version: "20.2.0-next.2",
971
+ ngImport: i0,
972
+ type: MatAutocompleteTrigger,
973
+ decorators: [{
974
+ type: Directive,
975
+ args: [{
976
+ selector: `input[matAutocomplete], textarea[matAutocomplete]`,
977
+ host: {
978
+ 'class': 'mat-mdc-autocomplete-trigger',
979
+ '[attr.autocomplete]': 'autocompleteAttribute',
980
+ '[attr.role]': 'autocompleteDisabled ? null : "combobox"',
981
+ '[attr.aria-autocomplete]': 'autocompleteDisabled ? null : "list"',
982
+ '[attr.aria-activedescendant]': '(panelOpen && activeOption) ? activeOption.id : null',
983
+ '[attr.aria-expanded]': 'autocompleteDisabled ? null : panelOpen.toString()',
984
+ '[attr.aria-controls]': '(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id',
985
+ '[attr.aria-haspopup]': 'autocompleteDisabled ? null : "listbox"',
986
+ '(focusin)': '_handleFocus()',
987
+ '(blur)': '_onTouched()',
988
+ '(input)': '_handleInput($event)',
989
+ '(keydown)': '_handleKeydown($event)',
990
+ '(click)': '_handleClick()'
991
+ },
992
+ exportAs: 'matAutocompleteTrigger',
993
+ providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR]
994
+ }]
995
+ }],
996
+ ctorParameters: () => [],
997
+ propDecorators: {
998
+ autocomplete: [{
999
+ type: Input,
1000
+ args: ['matAutocomplete']
1001
+ }],
1002
+ position: [{
1003
+ type: Input,
1004
+ args: ['matAutocompletePosition']
1005
+ }],
1006
+ connectedTo: [{
1007
+ type: Input,
1008
+ args: ['matAutocompleteConnectedTo']
1009
+ }],
1010
+ autocompleteAttribute: [{
1011
+ type: Input,
1012
+ args: ['autocomplete']
1013
+ }],
1014
+ autocompleteDisabled: [{
1015
+ type: Input,
1016
+ args: [{
1017
+ alias: 'matAutocompleteDisabled',
1018
+ transform: booleanAttribute
1019
+ }]
1020
+ }]
1021
+ }
1022
+ });
1185
1023
 
1186
1024
  class MatAutocompleteModule {
1187
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1188
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteModule, imports: [OverlayModule,
1189
- MatOptionModule,
1190
- MatAutocomplete,
1191
- MatAutocompleteTrigger,
1192
- MatAutocompleteOrigin], exports: [CdkScrollableModule,
1193
- MatAutocomplete,
1194
- MatOptionModule,
1195
- BidiModule,
1196
- MatAutocompleteTrigger,
1197
- MatAutocompleteOrigin] });
1198
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteModule, imports: [OverlayModule,
1199
- MatOptionModule, CdkScrollableModule,
1200
- MatOptionModule,
1201
- BidiModule] });
1025
+ static ɵfac = i0.ɵɵngDeclareFactory({
1026
+ minVersion: "12.0.0",
1027
+ version: "20.2.0-next.2",
1028
+ ngImport: i0,
1029
+ type: MatAutocompleteModule,
1030
+ deps: [],
1031
+ target: i0.ɵɵFactoryTarget.NgModule
1032
+ });
1033
+ static ɵmod = i0.ɵɵngDeclareNgModule({
1034
+ minVersion: "14.0.0",
1035
+ version: "20.2.0-next.2",
1036
+ ngImport: i0,
1037
+ type: MatAutocompleteModule,
1038
+ imports: [OverlayModule, MatOptionModule, MatAutocomplete, MatAutocompleteTrigger, MatAutocompleteOrigin],
1039
+ exports: [CdkScrollableModule, MatAutocomplete, MatOptionModule, BidiModule, MatAutocompleteTrigger, MatAutocompleteOrigin]
1040
+ });
1041
+ static ɵinj = i0.ɵɵngDeclareInjector({
1042
+ minVersion: "12.0.0",
1043
+ version: "20.2.0-next.2",
1044
+ ngImport: i0,
1045
+ type: MatAutocompleteModule,
1046
+ imports: [OverlayModule, MatOptionModule, CdkScrollableModule, MatOptionModule, BidiModule]
1047
+ });
1202
1048
  }
1203
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatAutocompleteModule, decorators: [{
1204
- type: NgModule,
1205
- args: [{
1206
- imports: [
1207
- OverlayModule,
1208
- MatOptionModule,
1209
- MatAutocomplete,
1210
- MatAutocompleteTrigger,
1211
- MatAutocompleteOrigin,
1212
- ],
1213
- exports: [
1214
- CdkScrollableModule,
1215
- MatAutocomplete,
1216
- MatOptionModule,
1217
- BidiModule,
1218
- MatAutocompleteTrigger,
1219
- MatAutocompleteOrigin,
1220
- ],
1221
- }]
1222
- }] });
1049
+ i0.ɵɵngDeclareClassMetadata({
1050
+ minVersion: "12.0.0",
1051
+ version: "20.2.0-next.2",
1052
+ ngImport: i0,
1053
+ type: MatAutocompleteModule,
1054
+ decorators: [{
1055
+ type: NgModule,
1056
+ args: [{
1057
+ imports: [OverlayModule, MatOptionModule, MatAutocomplete, MatAutocompleteTrigger, MatAutocompleteOrigin],
1058
+ exports: [CdkScrollableModule, MatAutocomplete, MatOptionModule, BidiModule, MatAutocompleteTrigger, MatAutocompleteOrigin]
1059
+ }]
1060
+ }]
1061
+ });
1223
1062
 
1224
1063
  export { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, MAT_AUTOCOMPLETE_SCROLL_STRATEGY, MAT_AUTOCOMPLETE_VALUE_ACCESSOR, MatAutocomplete, MatAutocompleteModule, MatAutocompleteOrigin, MatAutocompleteSelectedEvent, MatAutocompleteTrigger, MatOption, getMatAutocompleteMissingPanelError };
1225
1064
  //# sourceMappingURL=autocomplete.mjs.map