@angular/material 19.0.0-next.8 → 19.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_index.scss +1 -2
- package/autocomplete/_autocomplete-theme.scss +37 -24
- package/autocomplete/index.d.ts +5 -6
- package/badge/_badge-theme.scss +38 -24
- package/bottom-sheet/_bottom-sheet-theme.scss +32 -20
- package/button/_button-theme.scss +229 -105
- package/button/_fab-theme.scss +95 -44
- package/button/_icon-button-theme.scss +38 -25
- package/button/index.d.ts +3 -3
- package/button-toggle/_button-toggle-theme.scss +62 -37
- package/card/_card-theme.scss +79 -38
- package/card/index.d.ts +2 -3
- package/checkbox/_checkbox-theme.scss +16 -10
- package/chips/_chips-theme.scss +64 -30
- package/core/_core-theme.scss +55 -37
- package/core/_core.scss +3 -6
- package/core/option/_optgroup-theme.scss +29 -18
- package/core/option/_option-theme.scss +34 -21
- package/core/ripple/_ripple-theme.scss +33 -21
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +49 -23
- package/core/theming/_config-validation.scss +4 -4
- package/core/theming/_definition.scss +12 -2
- package/core/tokens/_m3-system.scss +86 -42
- package/core/tokens/_token-utils.scss +91 -34
- package/core/tokens/m2/mat/_badge.scss +12 -3
- package/core/tokens/m2/mdc/_radio.scss +1 -1
- package/core/tokens/m3/definitions/_md-comp-elevated-card.scss +1 -1
- package/core/tokens/m3/mat/_badge.scss +6 -3
- package/datepicker/_datepicker-theme.scss +53 -32
- package/datepicker/index.d.ts +33 -34
- package/dialog/_dialog-theme.scss +46 -23
- package/divider/_divider-theme.scss +28 -17
- package/expansion/_expansion-theme.scss +36 -24
- package/fesm2022/autocomplete/testing.mjs +2 -5
- package/fesm2022/autocomplete/testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +225 -148
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge/testing.mjs +2 -5
- package/fesm2022/badge/testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +45 -35
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet/testing.mjs +1 -1
- package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +80 -58
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button/testing.mjs +2 -2
- package/fesm2022/button/testing.mjs.map +1 -1
- package/fesm2022/button-toggle/testing.mjs +4 -7
- package/fesm2022/button-toggle/testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +82 -45
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +106 -79
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card/testing.mjs +3 -6
- package/fesm2022/card/testing.mjs.map +1 -1
- package/fesm2022/card.mjs +56 -69
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox/testing.mjs +4 -7
- package/fesm2022/checkbox/testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +104 -62
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips/testing.mjs +11 -14
- package/fesm2022/chips/testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +322 -276
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core/testing.mjs +5 -11
- package/fesm2022/core/testing.mjs.map +1 -1
- package/fesm2022/core.mjs +242 -187
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker/testing.mjs +13 -22
- package/fesm2022/datepicker/testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +827 -582
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog/testing.mjs +15 -10
- package/fesm2022/dialog/testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +221 -156
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider/testing.mjs +1 -1
- package/fesm2022/divider/testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +10 -12
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion/testing.mjs +7 -10
- package/fesm2022/expansion/testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +86 -80
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field/testing.mjs +12 -15
- package/fesm2022/form-field/testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +179 -132
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list/testing.mjs +11 -17
- package/fesm2022/grid-list/testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +75 -56
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +8 -8
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +66 -46
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input/testing.mjs +3 -3
- package/fesm2022/input/testing.mjs.map +1 -1
- package/fesm2022/input.mjs +103 -72
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list/testing.mjs +21 -38
- package/fesm2022/list/testing.mjs.map +1 -1
- package/fesm2022/list.mjs +197 -195
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu/testing.mjs +3 -6
- package/fesm2022/menu/testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +178 -127
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator/testing.mjs +10 -13
- package/fesm2022/paginator/testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +83 -58
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar/testing.mjs +1 -1
- package/fesm2022/progress-bar/testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +36 -35
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner/testing.mjs +1 -1
- package/fesm2022/progress-spinner/testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +28 -14
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio/testing.mjs +6 -12
- package/fesm2022/radio/testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +123 -87
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select/testing.mjs +6 -9
- package/fesm2022/select/testing.mjs.map +1 -1
- package/fesm2022/select.mjs +219 -182
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav/testing.mjs +6 -6
- package/fesm2022/sidenav/testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +136 -125
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle/testing.mjs +3 -6
- package/fesm2022/slide-toggle/testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +77 -47
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider/testing.mjs +2 -2
- package/fesm2022/slider/testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +262 -194
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar/testing.mjs +4 -7
- package/fesm2022/snack-bar/testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +143 -111
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort/testing.mjs +3 -6
- package/fesm2022/sort/testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +94 -74
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper/testing.mjs +4 -4
- package/fesm2022/stepper/testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +146 -113
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table/testing.mjs +13 -25
- package/fesm2022/table/testing.mjs.map +1 -1
- package/fesm2022/table.mjs +183 -194
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs/testing.mjs +5 -5
- package/fesm2022/tabs/testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +329 -251
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker/testing.mjs +7 -16
- package/fesm2022/timepicker/testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +160 -155
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar/testing.mjs +2 -5
- package/fesm2022/toolbar/testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +26 -17
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip/testing.mjs +6 -9
- package/fesm2022/tooltip/testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +97 -74
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree/testing.mjs +3 -6
- package/fesm2022/tree/testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +57 -61
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/_form-field-theme.scss +114 -61
- package/form-field/index.d.ts +9 -10
- package/grid-list/_grid-list-theme.scss +25 -15
- package/icon/_icon-theme.scss +22 -14
- package/input/_input-theme.scss +18 -11
- package/list/_list-theme.scss +89 -47
- package/list/index.d.ts +20 -21
- package/menu/_menu-theme.scss +33 -21
- package/menu/index.d.ts +8 -9
- package/package.json +2 -2
- package/paginator/_paginator-theme.scss +39 -23
- package/prebuilt-themes/azure-blue.css +1 -1
- package/prebuilt-themes/cyan-orange.css +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/magenta-violet.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/prebuilt-themes/rose-red.css +1 -1
- package/progress-bar/_progress-bar-theme.scss +20 -16
- package/progress-spinner/_progress-spinner-theme.scss +41 -25
- package/progress-spinner/index.d.ts +3 -4
- package/radio/_radio-theme.scss +60 -32
- package/radio/index.d.ts +2 -3
- package/schematics/collection.json +3 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-add/theming/create-custom-theme.js +1 -6
- package/schematics/ng-add/theming/create-custom-theme.mjs +1 -6
- package/schematics/ng-generate/{m3-theme → theme-color}/index_bundled.js +480 -288
- package/schematics/ng-generate/theme-color/index_bundled.js.map +7 -0
- package/schematics/ng-generate/{m3-theme → theme-color}/schema.json +7 -13
- package/schematics/ng-update/index_bundled.js +6 -1
- package/schematics/ng-update/index_bundled.js.map +1 -1
- package/select/_select-theme.scss +38 -25
- package/select/index.d.ts +6 -7
- package/sidenav/_sidenav-theme.scss +28 -17
- package/slide-toggle/_slide-toggle-theme.scss +52 -28
- package/slider/_slider-theme.scss +62 -38
- package/snack-bar/_snack-bar-theme.scss +29 -17
- package/sort/_sort-theme.scss +33 -21
- package/stepper/_stepper-theme.scss +40 -27
- package/stepper/index.d.ts +14 -15
- package/table/_table-theme.scss +36 -23
- package/tabs/_tabs-theme.scss +97 -50
- package/tabs/index.d.ts +2 -2
- package/timepicker/_timepicker-theme.scss +37 -24
- package/toolbar/_toolbar-theme.scss +35 -22
- package/tooltip/_tooltip-theme.scss +18 -15
- package/tooltip/index.d.ts +5 -6
- package/tree/_tree-theme.scss +33 -21
- package/schematics/ng-generate/m3-theme/index_bundled.js.map +0 -7
|
@@ -3,12 +3,9 @@ import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
|
|
|
3
3
|
import { MatOptionHarness, MatOptgroupHarness } from '@angular/material/core/testing';
|
|
4
4
|
|
|
5
5
|
class MatAutocompleteHarness extends ComponentHarness {
|
|
6
|
-
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
9
|
-
}
|
|
6
|
+
_documentRootLocator = this.documentRootLocatorFactory();
|
|
10
7
|
/** The selector for the host element of a `MatAutocomplete` instance. */
|
|
11
|
-
static
|
|
8
|
+
static hostSelector = '.mat-mdc-autocomplete-trigger';
|
|
12
9
|
/**
|
|
13
10
|
* Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific
|
|
14
11
|
* attributes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/autocomplete/testing/autocomplete-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {\n MatOptgroupHarness,\n MatOptionHarness,\n OptgroupHarnessFilters,\n OptionHarnessFilters,\n} from '@angular/material/core/testing';\nimport {AutocompleteHarnessFilters} from './autocomplete-harness-filters';\n\nexport class MatAutocompleteHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n\n /** The selector for the host element of a `MatAutocomplete` instance. */\n static hostSelector = '.mat-mdc-autocomplete-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific\n * attributes.\n * @param options Options for filtering which autocomplete instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatAutocompleteHarness>(\n this: ComponentHarnessConstructor<T>,\n options: AutocompleteHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('value', options.value, (harness, value) =>\n HarnessPredicate.stringMatches(harness.getValue(), value),\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => {\n return (await harness.isDisabled()) === disabled;\n });\n }\n\n /** Gets the value of the autocomplete input. */\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /** Whether the autocomplete input is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Focuses the autocomplete input. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the autocomplete input. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the autocomplete input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Enters text into the autocomplete. */\n async enterText(value: string): Promise<void> {\n return (await this.host()).sendKeys(value);\n }\n\n /** Clears the input value. */\n async clear(): Promise<void> {\n return (await this.host()).clear();\n }\n\n /** Gets the options inside the autocomplete panel. */\n async getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error('Unable to retrieve options for autocomplete. Autocomplete panel is closed.');\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptionHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptionHarnessFilters),\n )();\n }\n\n /** Gets the option groups inside the autocomplete panel. */\n async getOptionGroups(\n filters?: Omit<OptgroupHarnessFilters, 'ancestor'>,\n ): Promise<MatOptgroupHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error(\n 'Unable to retrieve option groups for autocomplete. Autocomplete panel is closed.',\n );\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptgroupHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptgroupHarnessFilters),\n )();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionHarnessFilters): Promise<void> {\n await this.focus(); // Focus the input to make sure the autocomplete panel is shown.\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Whether the autocomplete is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._getPanel();\n return !!panel && (await panel.hasClass(`mat-mdc-autocomplete-visible`));\n }\n\n /** Gets the panel associated with this autocomplete trigger. */\n private async _getPanel(): Promise<TestElement | null> {\n // Technically this is static, but it needs to be in a\n // function, because the autocomplete's panel ID can changed.\n return this._documentRootLocator.locatorForOptional(await this._getPanelSelector())();\n }\n\n /** Gets the selector that can be used to find the autocomplete trigger's panel. */\n protected async _getPanelSelector(): Promise<string> {\n return `#${await (await this.host()).getAttribute('aria-controls')}`;\n }\n}\n"],"names":[],"mappings":";;;;AAuBM,MAAO,sBAAuB,SAAQ,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/autocomplete/testing/autocomplete-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {\n MatOptgroupHarness,\n MatOptionHarness,\n OptgroupHarnessFilters,\n OptionHarnessFilters,\n} from '@angular/material/core/testing';\nimport {AutocompleteHarnessFilters} from './autocomplete-harness-filters';\n\nexport class MatAutocompleteHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n\n /** The selector for the host element of a `MatAutocomplete` instance. */\n static hostSelector = '.mat-mdc-autocomplete-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific\n * attributes.\n * @param options Options for filtering which autocomplete instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatAutocompleteHarness>(\n this: ComponentHarnessConstructor<T>,\n options: AutocompleteHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('value', options.value, (harness, value) =>\n HarnessPredicate.stringMatches(harness.getValue(), value),\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => {\n return (await harness.isDisabled()) === disabled;\n });\n }\n\n /** Gets the value of the autocomplete input. */\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /** Whether the autocomplete input is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Focuses the autocomplete input. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the autocomplete input. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the autocomplete input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Enters text into the autocomplete. */\n async enterText(value: string): Promise<void> {\n return (await this.host()).sendKeys(value);\n }\n\n /** Clears the input value. */\n async clear(): Promise<void> {\n return (await this.host()).clear();\n }\n\n /** Gets the options inside the autocomplete panel. */\n async getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error('Unable to retrieve options for autocomplete. Autocomplete panel is closed.');\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptionHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptionHarnessFilters),\n )();\n }\n\n /** Gets the option groups inside the autocomplete panel. */\n async getOptionGroups(\n filters?: Omit<OptgroupHarnessFilters, 'ancestor'>,\n ): Promise<MatOptgroupHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error(\n 'Unable to retrieve option groups for autocomplete. Autocomplete panel is closed.',\n );\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptgroupHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptgroupHarnessFilters),\n )();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionHarnessFilters): Promise<void> {\n await this.focus(); // Focus the input to make sure the autocomplete panel is shown.\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Whether the autocomplete is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._getPanel();\n return !!panel && (await panel.hasClass(`mat-mdc-autocomplete-visible`));\n }\n\n /** Gets the panel associated with this autocomplete trigger. */\n private async _getPanel(): Promise<TestElement | null> {\n // Technically this is static, but it needs to be in a\n // function, because the autocomplete's panel ID can changed.\n return this._documentRootLocator.locatorForOptional(await this._getPanelSelector())();\n }\n\n /** Gets the selector that can be used to find the autocomplete trigger's panel. */\n protected async _getPanelSelector(): Promise<string> {\n return `#${await (await this.host()).getAttribute('aria-controls')}`;\n }\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -2,20 +2,20 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, inject, ChangeDetectorRef, ElementRef, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef, ViewContainerRef, NgZone, Injector, afterNextRender, NgModule } from '@angular/core';
|
|
3
3
|
import { MAT_OPTION_PARENT_COMPONENT, MatOption, MAT_OPTGROUP, MatOptionSelectionChange, _countGroupLabelsBeforeOption, _getOptionScrollPosition, MatOptionModule, MatCommonModule } from '@angular/material/core';
|
|
4
4
|
export { MatOptgroup, MatOption } from '@angular/material/core';
|
|
5
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
6
5
|
import { ViewportRuler, CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
7
6
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
8
7
|
import { ActiveDescendantKeyManager, removeAriaReferencedId, addAriaReferencedId } from '@angular/cdk/a11y';
|
|
9
8
|
import { Platform, _getEventTarget } from '@angular/cdk/platform';
|
|
10
9
|
import { trigger, state, style, transition, group, animate } from '@angular/animations';
|
|
11
|
-
import { Subscription, Subject,
|
|
10
|
+
import { Subscription, Subject, merge, of, defer, fromEvent, Observable } from 'rxjs';
|
|
12
11
|
import { Directionality } from '@angular/cdk/bidi';
|
|
13
|
-
import { ESCAPE,
|
|
12
|
+
import { hasModifierKey, ESCAPE, ENTER, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
|
|
14
13
|
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
15
14
|
import { TemplatePortal } from '@angular/cdk/portal';
|
|
15
|
+
import { DOCUMENT } from '@angular/common';
|
|
16
16
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
17
17
|
import { MAT_FORM_FIELD } from '@angular/material/form-field';
|
|
18
|
-
import {
|
|
18
|
+
import { filter, map, startWith, switchMap, tap, delay, take } from 'rxjs/operators';
|
|
19
19
|
|
|
20
20
|
// Animation values come from
|
|
21
21
|
// TODO(mmalerba): Ideally find a way to import the values from MDC's code.
|
|
@@ -40,6 +40,8 @@ const panelAnimation = trigger('panelAnimation', [
|
|
|
40
40
|
let _uniqueAutocompleteIdCounter = 0;
|
|
41
41
|
/** Event object that is emitted when an autocomplete option is selected. */
|
|
42
42
|
class MatAutocompleteSelectedEvent {
|
|
43
|
+
source;
|
|
44
|
+
option;
|
|
43
45
|
constructor(
|
|
44
46
|
/** Reference to the autocomplete panel that emitted the event. */
|
|
45
47
|
source,
|
|
@@ -65,15 +67,76 @@ function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY() {
|
|
|
65
67
|
}
|
|
66
68
|
/** Autocomplete component. */
|
|
67
69
|
class MatAutocomplete {
|
|
70
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
71
|
+
_elementRef = inject(ElementRef);
|
|
72
|
+
_defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
|
|
73
|
+
_activeOptionChanges = Subscription.EMPTY;
|
|
74
|
+
/** Emits when the panel animation is done. Null if the panel doesn't animate. */
|
|
75
|
+
_animationDone = new EventEmitter();
|
|
76
|
+
/** Manages active item in option list based on key events. */
|
|
77
|
+
_keyManager;
|
|
78
|
+
/** Whether the autocomplete panel should be visible, depending on option length. */
|
|
79
|
+
showPanel = false;
|
|
68
80
|
/** Whether the autocomplete panel is open. */
|
|
69
81
|
get isOpen() {
|
|
70
82
|
return this._isOpen && this.showPanel;
|
|
71
83
|
}
|
|
84
|
+
_isOpen = false;
|
|
85
|
+
/** Latest trigger that opened the autocomplete. */
|
|
86
|
+
_latestOpeningTrigger;
|
|
72
87
|
/** @docs-private Sets the theme color of the panel. */
|
|
73
88
|
_setColor(value) {
|
|
74
89
|
this._color = value;
|
|
75
90
|
this._changeDetectorRef.markForCheck();
|
|
76
91
|
}
|
|
92
|
+
/** @docs-private theme color of the panel */
|
|
93
|
+
_color;
|
|
94
|
+
// The @ViewChild query for TemplateRef here needs to be static because some code paths
|
|
95
|
+
// lead to the overlay being created before change detection has finished for this component.
|
|
96
|
+
// Notably, another component may trigger `focus` on the autocomplete-trigger.
|
|
97
|
+
/** @docs-private */
|
|
98
|
+
template;
|
|
99
|
+
/** Element for the panel containing the autocomplete options. */
|
|
100
|
+
panel;
|
|
101
|
+
/** Reference to all options within the autocomplete. */
|
|
102
|
+
options;
|
|
103
|
+
/** Reference to all option groups within the autocomplete. */
|
|
104
|
+
optionGroups;
|
|
105
|
+
/** Aria label of the autocomplete. */
|
|
106
|
+
ariaLabel;
|
|
107
|
+
/** Input that can be used to specify the `aria-labelledby` attribute. */
|
|
108
|
+
ariaLabelledby;
|
|
109
|
+
/** Function that maps an option's control value to its display value in the trigger. */
|
|
110
|
+
displayWith = null;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the first option should be highlighted when the autocomplete panel is opened.
|
|
113
|
+
* Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
|
|
114
|
+
*/
|
|
115
|
+
autoActiveFirstOption;
|
|
116
|
+
/** Whether the active option should be selected as the user is navigating. */
|
|
117
|
+
autoSelectActiveOption;
|
|
118
|
+
/**
|
|
119
|
+
* Whether the user is required to make a selection when they're interacting with the
|
|
120
|
+
* autocomplete. If the user moves away from the autocomplete without selecting an option from
|
|
121
|
+
* the list, the value will be reset. If the user opens the panel and closes it without
|
|
122
|
+
* interacting or selecting a value, the initial value will be kept.
|
|
123
|
+
*/
|
|
124
|
+
requireSelection;
|
|
125
|
+
/**
|
|
126
|
+
* Specify the width of the autocomplete panel. Can be any CSS sizing value, otherwise it will
|
|
127
|
+
* match the width of its host.
|
|
128
|
+
*/
|
|
129
|
+
panelWidth;
|
|
130
|
+
/** Whether ripples are disabled within the autocomplete panel. */
|
|
131
|
+
disableRipple;
|
|
132
|
+
/** Event that is emitted whenever an option from the list is selected. */
|
|
133
|
+
optionSelected = new EventEmitter();
|
|
134
|
+
/** Event that is emitted when the autocomplete panel is opened. */
|
|
135
|
+
opened = new EventEmitter();
|
|
136
|
+
/** Event that is emitted when the autocomplete panel is closed. */
|
|
137
|
+
closed = new EventEmitter();
|
|
138
|
+
/** Emits whenever an option is activated. */
|
|
139
|
+
optionActivated = new EventEmitter();
|
|
77
140
|
/**
|
|
78
141
|
* Takes classes set on the host mat-autocomplete element and applies them to the panel
|
|
79
142
|
* inside the overlay container to allow for easy styling.
|
|
@@ -82,6 +145,7 @@ class MatAutocomplete {
|
|
|
82
145
|
this._classList = value;
|
|
83
146
|
this._elementRef.nativeElement.className = '';
|
|
84
147
|
}
|
|
148
|
+
_classList;
|
|
85
149
|
/** Whether checkmark indicator for single-selection options is hidden. */
|
|
86
150
|
get hideSingleSelectionIndicator() {
|
|
87
151
|
return this._hideSingleSelectionIndicator;
|
|
@@ -90,6 +154,7 @@ class MatAutocomplete {
|
|
|
90
154
|
this._hideSingleSelectionIndicator = value;
|
|
91
155
|
this._syncParentProperties();
|
|
92
156
|
}
|
|
157
|
+
_hideSingleSelectionIndicator;
|
|
93
158
|
/** Syncs the parent state with the individual options. */
|
|
94
159
|
_syncParentProperties() {
|
|
95
160
|
if (this.options) {
|
|
@@ -98,28 +163,14 @@ class MatAutocomplete {
|
|
|
98
163
|
}
|
|
99
164
|
}
|
|
100
165
|
}
|
|
166
|
+
/** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
|
|
167
|
+
id = `mat-autocomplete-${_uniqueAutocompleteIdCounter++}`;
|
|
168
|
+
/**
|
|
169
|
+
* Tells any descendant `mat-optgroup` to use the inert a11y pattern.
|
|
170
|
+
* @docs-private
|
|
171
|
+
*/
|
|
172
|
+
inertGroups;
|
|
101
173
|
constructor() {
|
|
102
|
-
this._changeDetectorRef = inject(ChangeDetectorRef);
|
|
103
|
-
this._elementRef = inject(ElementRef);
|
|
104
|
-
this._defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
|
|
105
|
-
this._activeOptionChanges = Subscription.EMPTY;
|
|
106
|
-
/** Emits when the panel animation is done. Null if the panel doesn't animate. */
|
|
107
|
-
this._animationDone = new EventEmitter();
|
|
108
|
-
/** Whether the autocomplete panel should be visible, depending on option length. */
|
|
109
|
-
this.showPanel = false;
|
|
110
|
-
this._isOpen = false;
|
|
111
|
-
/** Function that maps an option's control value to its display value in the trigger. */
|
|
112
|
-
this.displayWith = null;
|
|
113
|
-
/** Event that is emitted whenever an option from the list is selected. */
|
|
114
|
-
this.optionSelected = new EventEmitter();
|
|
115
|
-
/** Event that is emitted when the autocomplete panel is opened. */
|
|
116
|
-
this.opened = new EventEmitter();
|
|
117
|
-
/** Event that is emitted when the autocomplete panel is closed. */
|
|
118
|
-
this.closed = new EventEmitter();
|
|
119
|
-
/** Emits whenever an option is activated. */
|
|
120
|
-
this.optionActivated = new EventEmitter();
|
|
121
|
-
/** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
|
|
122
|
-
this.id = `mat-autocomplete-${_uniqueAutocompleteIdCounter++}`;
|
|
123
174
|
const platform = inject(Platform);
|
|
124
175
|
// TODO(crisbeto): the problem that the `inertGroups` option resolves is only present on
|
|
125
176
|
// Safari using VoiceOver. We should occasionally check back to see whether the bug
|
|
@@ -196,14 +247,14 @@ class MatAutocomplete {
|
|
|
196
247
|
_skipPredicate() {
|
|
197
248
|
return false;
|
|
198
249
|
}
|
|
199
|
-
static
|
|
200
|
-
static
|
|
250
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
251
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.0.0-next.10", 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-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 [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\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:static;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}mat-autocomplete{display:none}"], animations: [panelAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
201
252
|
}
|
|
202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
253
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocomplete, decorators: [{
|
|
203
254
|
type: Component,
|
|
204
255
|
args: [{ selector: 'mat-autocomplete', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'matAutocomplete', host: {
|
|
205
256
|
'class': 'mat-mdc-autocomplete',
|
|
206
|
-
}, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], animations: [panelAnimation],
|
|
257
|
+
}, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], animations: [panelAnimation], 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-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 [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\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:static;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}mat-autocomplete{display:none}"] }]
|
|
207
258
|
}], ctorParameters: () => [], propDecorators: { template: [{
|
|
208
259
|
type: ViewChild,
|
|
209
260
|
args: [TemplateRef, { static: true }]
|
|
@@ -259,18 +310,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
|
|
|
259
310
|
* as a connection point for an autocomplete panel.
|
|
260
311
|
*/
|
|
261
312
|
class MatAutocompleteOrigin {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
static
|
|
266
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0-next.8", type: MatAutocompleteOrigin, isStandalone: true, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"], ngImport: i0 }); }
|
|
313
|
+
elementRef = inject(ElementRef);
|
|
314
|
+
constructor() { }
|
|
315
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteOrigin, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
316
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0-next.10", type: MatAutocompleteOrigin, isStandalone: true, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"], ngImport: i0 });
|
|
267
317
|
}
|
|
268
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
318
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteOrigin, decorators: [{
|
|
269
319
|
type: Directive,
|
|
270
320
|
args: [{
|
|
271
321
|
selector: '[matAutocompleteOrigin]',
|
|
272
322
|
exportAs: 'matAutocompleteOrigin',
|
|
273
|
-
standalone: true,
|
|
274
323
|
}]
|
|
275
324
|
}], ctorParameters: () => [] });
|
|
276
325
|
|
|
@@ -312,104 +361,99 @@ const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
|
|
|
312
361
|
};
|
|
313
362
|
/** Base class with all of the `MatAutocompleteTrigger` functionality. */
|
|
314
363
|
class MatAutocompleteTrigger {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
this.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
* inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
|
|
409
|
-
* panel. Track the modal we have changed so we can undo the changes on destroy.
|
|
410
|
-
*/
|
|
411
|
-
this._trackedModal = null;
|
|
412
|
-
}
|
|
364
|
+
_element = inject(ElementRef);
|
|
365
|
+
_overlay = inject(Overlay);
|
|
366
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
367
|
+
_zone = inject(NgZone);
|
|
368
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
369
|
+
_dir = inject(Directionality, { optional: true });
|
|
370
|
+
_formField = inject(MAT_FORM_FIELD, { optional: true, host: true });
|
|
371
|
+
_document = inject(DOCUMENT);
|
|
372
|
+
_viewportRuler = inject(ViewportRuler);
|
|
373
|
+
_defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, { optional: true });
|
|
374
|
+
_overlayRef;
|
|
375
|
+
_portal;
|
|
376
|
+
_componentDestroyed = false;
|
|
377
|
+
_scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
|
|
378
|
+
_keydownSubscription;
|
|
379
|
+
_outsideClickSubscription;
|
|
380
|
+
/** Old value of the native input. Used to work around issues with the `input` event on IE. */
|
|
381
|
+
_previousValue;
|
|
382
|
+
/** Value of the input element when the panel was attached (even if there are no options). */
|
|
383
|
+
_valueOnAttach;
|
|
384
|
+
/** Value on the previous keydown event. */
|
|
385
|
+
_valueOnLastKeydown;
|
|
386
|
+
/** Strategy that is used to position the panel. */
|
|
387
|
+
_positionStrategy;
|
|
388
|
+
/** Whether or not the label state is being overridden. */
|
|
389
|
+
_manuallyFloatingLabel = false;
|
|
390
|
+
/** The subscription for closing actions (some are bound to document). */
|
|
391
|
+
_closingActionsSubscription;
|
|
392
|
+
/** Subscription to viewport size changes. */
|
|
393
|
+
_viewportSubscription = Subscription.EMPTY;
|
|
394
|
+
/** Implements BreakpointObserver to be used to detect handset landscape */
|
|
395
|
+
_breakpointObserver = inject(BreakpointObserver);
|
|
396
|
+
_handsetLandscapeSubscription = Subscription.EMPTY;
|
|
397
|
+
/**
|
|
398
|
+
* Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
|
|
399
|
+
* closed autocomplete from being reopened if the user switches to another browser tab and then
|
|
400
|
+
* comes back.
|
|
401
|
+
*/
|
|
402
|
+
_canOpenOnNextFocus = true;
|
|
403
|
+
/** Value inside the input before we auto-selected an option. */
|
|
404
|
+
_valueBeforeAutoSelection;
|
|
405
|
+
/**
|
|
406
|
+
* Current option that we have auto-selected as the user is navigating,
|
|
407
|
+
* but which hasn't been propagated to the model value yet.
|
|
408
|
+
*/
|
|
409
|
+
_pendingAutoselectedOption;
|
|
410
|
+
/** Stream of keyboard events that can close the panel. */
|
|
411
|
+
_closeKeyEventStream = new Subject();
|
|
412
|
+
/**
|
|
413
|
+
* Event handler for when the window is blurred. Needs to be an
|
|
414
|
+
* arrow function in order to preserve the context.
|
|
415
|
+
*/
|
|
416
|
+
_windowBlurHandler = () => {
|
|
417
|
+
// If the user blurred the window while the autocomplete is focused, it means that it'll be
|
|
418
|
+
// refocused when they come back. In this case we want to skip the first focus event, if the
|
|
419
|
+
// pane was closed, in order to avoid reopening it unintentionally.
|
|
420
|
+
this._canOpenOnNextFocus =
|
|
421
|
+
this._document.activeElement !== this._element.nativeElement || this.panelOpen;
|
|
422
|
+
};
|
|
423
|
+
/** `View -> model callback called when value changes` */
|
|
424
|
+
_onChange = () => { };
|
|
425
|
+
/** `View -> model callback called when autocomplete has been touched` */
|
|
426
|
+
_onTouched = () => { };
|
|
427
|
+
/** The autocomplete panel to be attached to this trigger. */
|
|
428
|
+
autocomplete;
|
|
429
|
+
/**
|
|
430
|
+
* Position of the autocomplete panel relative to the trigger element. A position of `auto`
|
|
431
|
+
* will render the panel underneath the trigger if there is enough space for it to fit in
|
|
432
|
+
* the viewport, otherwise the panel will be shown above it. If the position is set to
|
|
433
|
+
* `above` or `below`, the panel will always be shown above or below the trigger. no matter
|
|
434
|
+
* whether it fits completely in the viewport.
|
|
435
|
+
*/
|
|
436
|
+
position = 'auto';
|
|
437
|
+
/**
|
|
438
|
+
* Reference relative to which to position the autocomplete panel.
|
|
439
|
+
* Defaults to the autocomplete trigger element.
|
|
440
|
+
*/
|
|
441
|
+
connectedTo;
|
|
442
|
+
/**
|
|
443
|
+
* `autocomplete` attribute to be set on the input element.
|
|
444
|
+
* @docs-private
|
|
445
|
+
*/
|
|
446
|
+
autocompleteAttribute = 'off';
|
|
447
|
+
/**
|
|
448
|
+
* Whether the autocomplete is disabled. When disabled, the element will
|
|
449
|
+
* act as a regular input and the user won't be able to open the panel.
|
|
450
|
+
*/
|
|
451
|
+
autocompleteDisabled;
|
|
452
|
+
_initialized = new Subject();
|
|
453
|
+
_injector = inject(Injector);
|
|
454
|
+
constructor() { }
|
|
455
|
+
/** Class to apply to the panel when it's above the input. */
|
|
456
|
+
_aboveClass = 'mat-mdc-autocomplete-panel-above';
|
|
413
457
|
ngAfterViewInit() {
|
|
414
458
|
this._initialized.next();
|
|
415
459
|
this._initialized.complete();
|
|
@@ -442,6 +486,7 @@ class MatAutocompleteTrigger {
|
|
|
442
486
|
get panelOpen() {
|
|
443
487
|
return this._overlayAttached && this.autocomplete.showPanel;
|
|
444
488
|
}
|
|
489
|
+
_overlayAttached = false;
|
|
445
490
|
/** Opens the autocomplete suggestion panel. */
|
|
446
491
|
openPanel() {
|
|
447
492
|
this._openPanelInternal();
|
|
@@ -508,6 +553,16 @@ class MatAutocompleteTrigger {
|
|
|
508
553
|
// Normalize the output so we return a consistent type.
|
|
509
554
|
map(event => (event instanceof MatOptionSelectionChange ? event : null)));
|
|
510
555
|
}
|
|
556
|
+
/** Stream of changes to the selection state of the autocomplete options. */
|
|
557
|
+
optionSelections = defer(() => {
|
|
558
|
+
const options = this.autocomplete ? this.autocomplete.options : null;
|
|
559
|
+
if (options) {
|
|
560
|
+
return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map(option => option.onSelectionChange))));
|
|
561
|
+
}
|
|
562
|
+
// If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
|
|
563
|
+
// Return a stream that we'll replace with the real one once everything is in place.
|
|
564
|
+
return this._initialized.pipe(switchMap(() => this.optionSelections));
|
|
565
|
+
});
|
|
511
566
|
/** The currently active option, coerced to MatOption type. */
|
|
512
567
|
get activeOption() {
|
|
513
568
|
if (this.autocomplete && this.autocomplete._keyManager) {
|
|
@@ -886,6 +941,26 @@ class MatAutocompleteTrigger {
|
|
|
886
941
|
this._emitOpened();
|
|
887
942
|
}
|
|
888
943
|
}
|
|
944
|
+
/** Handles keyboard events coming from the overlay panel. */
|
|
945
|
+
_handlePanelKeydown = (event) => {
|
|
946
|
+
// Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
|
|
947
|
+
// See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
|
|
948
|
+
if ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
|
|
949
|
+
(event.keyCode === UP_ARROW && hasModifierKey(event, 'altKey'))) {
|
|
950
|
+
// If the user had typed something in before we autoselected an option, and they decided
|
|
951
|
+
// to cancel the selection, restore the input value to the one they had typed in.
|
|
952
|
+
if (this._pendingAutoselectedOption) {
|
|
953
|
+
this._updateNativeInputValue(this._valueBeforeAutoSelection ?? '');
|
|
954
|
+
this._pendingAutoselectedOption = null;
|
|
955
|
+
}
|
|
956
|
+
this._closeKeyEventStream.next();
|
|
957
|
+
this._resetActiveItem();
|
|
958
|
+
// We need to stop propagation, otherwise the event will eventually
|
|
959
|
+
// reach the input itself and cause the overlay to be reopened.
|
|
960
|
+
event.stopPropagation();
|
|
961
|
+
event.preventDefault();
|
|
962
|
+
}
|
|
963
|
+
};
|
|
889
964
|
/** Updates the panel's visibility state and any trigger state tied to id. */
|
|
890
965
|
_updatePanelState() {
|
|
891
966
|
this.autocomplete._setVisibility();
|
|
@@ -1035,6 +1110,12 @@ class MatAutocompleteTrigger {
|
|
|
1035
1110
|
}
|
|
1036
1111
|
}
|
|
1037
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
|
|
1115
|
+
* inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
|
|
1116
|
+
* panel. Track the modal we have changed so we can undo the changes on destroy.
|
|
1117
|
+
*/
|
|
1118
|
+
_trackedModal = null;
|
|
1038
1119
|
/**
|
|
1039
1120
|
* If the autocomplete trigger is inside of an `aria-modal` element, connect
|
|
1040
1121
|
* that modal to the options panel with `aria-owns`.
|
|
@@ -1081,10 +1162,10 @@ class MatAutocompleteTrigger {
|
|
|
1081
1162
|
this._trackedModal = null;
|
|
1082
1163
|
}
|
|
1083
1164
|
}
|
|
1084
|
-
static
|
|
1085
|
-
static
|
|
1165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1166
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.0-next.10", 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 });
|
|
1086
1167
|
}
|
|
1087
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteTrigger, decorators: [{
|
|
1088
1169
|
type: Directive,
|
|
1089
1170
|
args: [{
|
|
1090
1171
|
selector: `input[matAutocomplete], textarea[matAutocomplete]`,
|
|
@@ -1107,7 +1188,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
|
|
|
1107
1188
|
},
|
|
1108
1189
|
exportAs: 'matAutocompleteTrigger',
|
|
1109
1190
|
providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR],
|
|
1110
|
-
standalone: true,
|
|
1111
1191
|
}]
|
|
1112
1192
|
}], ctorParameters: () => [], propDecorators: { autocomplete: [{
|
|
1113
1193
|
type: Input,
|
|
@@ -1127,11 +1207,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
|
|
|
1127
1207
|
}] } });
|
|
1128
1208
|
|
|
1129
1209
|
class MatAutocompleteModule {
|
|
1130
|
-
static
|
|
1131
|
-
static
|
|
1210
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1211
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, imports: [OverlayModule,
|
|
1132
1212
|
MatOptionModule,
|
|
1133
1213
|
MatCommonModule,
|
|
1134
|
-
CommonModule,
|
|
1135
1214
|
MatAutocomplete,
|
|
1136
1215
|
MatAutocompleteTrigger,
|
|
1137
1216
|
MatAutocompleteOrigin], exports: [CdkScrollableModule,
|
|
@@ -1139,22 +1218,20 @@ class MatAutocompleteModule {
|
|
|
1139
1218
|
MatOptionModule,
|
|
1140
1219
|
MatCommonModule,
|
|
1141
1220
|
MatAutocompleteTrigger,
|
|
1142
|
-
MatAutocompleteOrigin] });
|
|
1143
|
-
static
|
|
1221
|
+
MatAutocompleteOrigin] });
|
|
1222
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [OverlayModule,
|
|
1144
1223
|
MatOptionModule,
|
|
1145
|
-
MatCommonModule,
|
|
1146
|
-
CommonModule, CdkScrollableModule,
|
|
1224
|
+
MatCommonModule, CdkScrollableModule,
|
|
1147
1225
|
MatOptionModule,
|
|
1148
|
-
MatCommonModule] });
|
|
1226
|
+
MatCommonModule] });
|
|
1149
1227
|
}
|
|
1150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.
|
|
1228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, decorators: [{
|
|
1151
1229
|
type: NgModule,
|
|
1152
1230
|
args: [{
|
|
1153
1231
|
imports: [
|
|
1154
1232
|
OverlayModule,
|
|
1155
1233
|
MatOptionModule,
|
|
1156
1234
|
MatCommonModule,
|
|
1157
|
-
CommonModule,
|
|
1158
1235
|
MatAutocomplete,
|
|
1159
1236
|
MatAutocompleteTrigger,
|
|
1160
1237
|
MatAutocompleteOrigin,
|