Skip to content

Commit 311d9a0

Browse files
committed
refactor(material/legacy-autocomplete): rename ts symbols
1 parent 7f089e2 commit 311d9a0

File tree

9 files changed

+63
-57
lines changed

9 files changed

+63
-57
lines changed

src/components-examples/material/chips/chips-autocomplete/chips-autocomplete-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {COMMA, ENTER} from '@angular/cdk/keycodes';
22
import {Component, ElementRef, ViewChild} from '@angular/core';
33
import {FormControl} from '@angular/forms';
4-
import {MatAutocompleteSelectedEvent} from '@angular/material/legacy-autocomplete';
4+
import {MatLegacyAutocompleteSelectedEvent} from '@angular/material/legacy-autocomplete';
55
import {MatLegacyChipInputEvent} from '@angular/material/legacy-chips';
66
import {Observable} from 'rxjs';
77
import {map, startWith} from 'rxjs/operators';
@@ -52,7 +52,7 @@ export class ChipsAutocompleteExample {
5252
}
5353
}
5454

55-
selected(event: MatAutocompleteSelectedEvent): void {
55+
selected(event: MatLegacyAutocompleteSelectedEvent): void {
5656
this.fruits.push(event.option.viewValue);
5757
this.fruitInput.nativeElement.value = '';
5858
this.fruitCtrl.setValue(null);

src/material/legacy-autocomplete/autocomplete-trigger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
* Provider that allows the autocomplete to register as a ControlValueAccessor.
1818
* @docs-private
1919
*/
20-
export const MAT_AUTOCOMPLETE_VALUE_ACCESSOR: any = {
20+
export const MAT_LEGACY_AUTOCOMPLETE_VALUE_ACCESSOR: any = {
2121
provide: NG_VALUE_ACCESSOR,
2222
useExisting: forwardRef(() => MatLegacyAutocompleteTrigger),
2323
multi: true,
@@ -43,7 +43,7 @@ export const MAT_AUTOCOMPLETE_VALUE_ACCESSOR: any = {
4343
'(click)': '_handleClick()',
4444
},
4545
exportAs: 'matAutocompleteTrigger',
46-
providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR],
46+
providers: [MAT_LEGACY_AUTOCOMPLETE_VALUE_ACCESSOR],
4747
})
4848
export class MatLegacyAutocompleteTrigger extends _MatAutocompleteTriggerBase {
4949
protected _aboveClass = 'mat-autocomplete-panel-above';

src/material/legacy-autocomplete/autocomplete.spec.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ import {map, startWith} from 'rxjs/operators';
4646
import {MatLegacyInputModule} from '../legacy-input/index';
4747

4848
import {
49-
getMatAutocompleteMissingPanelError,
50-
MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,
51-
MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
49+
getMatLegacyAutocompleteMissingPanelError,
50+
MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS,
51+
MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY,
5252
MatLegacyAutocomplete,
5353
MatLegacyAutocompleteModule,
5454
MatLegacyAutocompleteOrigin,
55-
MatAutocompleteSelectedEvent,
55+
MatLegacyAutocompleteSelectedEvent,
5656
MatLegacyAutocompleteTrigger,
5757
} from './index';
5858

@@ -2314,7 +2314,7 @@ describe('MatAutocomplete', () => {
23142314
fixture.destroy();
23152315
TestBed.resetTestingModule();
23162316
fixture = createComponent(SimpleAutocomplete, [
2317-
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: {autoActiveFirstOption: true}},
2317+
{provide: MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: {autoActiveFirstOption: true}},
23182318
]);
23192319

23202320
fixture.detectChanges();
@@ -2513,7 +2513,10 @@ describe('MatAutocomplete', () => {
25132513
describe('with panel classes in the default options', () => {
25142514
it('should apply them if provided as string', fakeAsync(() => {
25152515
const fixture = createComponent(SimpleAutocomplete, [
2516-
{provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, useValue: {overlayPanelClass: 'default1'}},
2516+
{
2517+
provide: MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS,
2518+
useValue: {overlayPanelClass: 'default1'},
2519+
},
25172520
]);
25182521

25192522
fixture.detectChanges();
@@ -2527,7 +2530,7 @@ describe('MatAutocomplete', () => {
25272530
it('should apply them if provided as array', fakeAsync(() => {
25282531
const fixture = createComponent(SimpleAutocomplete, [
25292532
{
2530-
provide: MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,
2533+
provide: MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS,
25312534
useValue: {overlayPanelClass: ['default1', 'default2']},
25322535
},
25332536
]);
@@ -2618,7 +2621,7 @@ describe('MatAutocomplete', () => {
26182621

26192622
expect(() => {
26202623
fixture.componentInstance.trigger.openPanel();
2621-
}).toThrow(getMatAutocompleteMissingPanelError());
2624+
}).toThrow(getMatLegacyAutocompleteMissingPanelError());
26222625
});
26232626

26242627
it('should not throw on init, even if the panel is not defined', fakeAsync(() => {
@@ -2698,7 +2701,7 @@ describe('MatAutocomplete', () => {
26982701
useValue: {scrolled: () => scrolledSubject},
26992702
},
27002703
{
2701-
provide: MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
2704+
provide: MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY,
27022705
useFactory: (overlay: Overlay) => () => overlay.scrollStrategies.close(),
27032706
deps: [Overlay],
27042707
},
@@ -3167,7 +3170,7 @@ describe('MatAutocomplete', () => {
31673170

31683171
expect(spy).toHaveBeenCalledTimes(1);
31693172

3170-
const event = spy.calls.mostRecent().args[0] as MatAutocompleteSelectedEvent;
3173+
const event = spy.calls.mostRecent().args[0] as MatLegacyAutocompleteSelectedEvent;
31713174

31723175
expect(event.source).toBe(fixture.componentInstance.autocomplete);
31733176
expect(event.option.value).toBe('Washington');
@@ -3220,7 +3223,7 @@ describe('MatAutocomplete', () => {
32203223

32213224
expect(spy).toHaveBeenCalledTimes(1);
32223225

3223-
const event = spy.calls.mostRecent().args[0] as MatAutocompleteSelectedEvent;
3226+
const event = spy.calls.mostRecent().args[0] as MatLegacyAutocompleteSelectedEvent;
32243227

32253228
expect(event.source).toBe(fixture.componentInstance.autocomplete);
32263229
expect(event.option.value).toBe('Puerto Rico');

src/material/legacy-autocomplete/public-api.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
export * from './autocomplete';
10-
export * from './autocomplete-module';
11-
export * from './autocomplete-trigger';
12-
export * from './autocomplete-origin';
9+
export {MatLegacyAutocomplete} from './autocomplete';
10+
export {MatLegacyAutocompleteModule} from './autocomplete-module';
11+
export {
12+
MAT_LEGACY_AUTOCOMPLETE_VALUE_ACCESSOR,
13+
MatLegacyAutocompleteTrigger,
14+
} from './autocomplete-trigger';
15+
export {MatLegacyAutocompleteOrigin} from './autocomplete-origin';
1316

1417
// Everything from `material/autocomplete`, except for `MatAutcomplete` and `MatAutocompleteModule`.
1518
export {
16-
getMatAutocompleteMissingPanelError,
17-
MAT_AUTOCOMPLETE_DEFAULT_OPTIONS,
18-
MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY,
19-
MAT_AUTOCOMPLETE_SCROLL_STRATEGY,
20-
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY,
21-
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER,
22-
MatAutocompleteActivatedEvent,
23-
MatAutocompleteDefaultOptions,
24-
MatAutocompleteSelectedEvent,
19+
getMatAutocompleteMissingPanelError as getMatLegacyAutocompleteMissingPanelError,
20+
MAT_AUTOCOMPLETE_DEFAULT_OPTIONS as MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS,
21+
MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY as MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY,
22+
MAT_AUTOCOMPLETE_SCROLL_STRATEGY as MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY,
23+
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY as MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY,
24+
MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER as MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER,
25+
MatAutocompleteActivatedEvent as MatLegacyAutocompleteActivatedEvent,
26+
MatAutocompleteDefaultOptions as MatLegacyAutocompleteDefaultOptions,
27+
MatAutocompleteSelectedEvent as MatLegacyAutocompleteSelectedEvent,
2528
} from '@angular/material/autocomplete';

src/material/legacy-autocomplete/testing/autocomplete-harness-filters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {BaseHarnessFilters} from '@angular/cdk/testing';
1010

1111
/** A set of criteria that can be used to filter a list of `MatAutocompleteHarness` instances. */
12-
export interface AutocompleteHarnessFilters extends BaseHarnessFilters {
12+
export interface LegacyAutocompleteHarnessFilters extends BaseHarnessFilters {
1313
/** Only find instances whose associated input element matches the given value. */
1414
value?: string | RegExp;
1515
}

src/material/legacy-autocomplete/testing/autocomplete-harness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
OptionHarnessFilters,
1515
} from '@angular/material/legacy-core/testing';
1616
import {_MatAutocompleteHarnessBase} from '@angular/material/autocomplete/testing';
17-
import {AutocompleteHarnessFilters} from './autocomplete-harness-filters';
17+
import {LegacyAutocompleteHarnessFilters} from './autocomplete-harness-filters';
1818

1919
/** Harness for interacting with a standard mat-autocomplete in tests. */
2020
export class MatLegacyAutocompleteHarness extends _MatAutocompleteHarnessBase<
@@ -39,7 +39,7 @@ export class MatLegacyAutocompleteHarness extends _MatAutocompleteHarnessBase<
3939
* @return a `HarnessPredicate` configured with the given options.
4040
*/
4141
static with(
42-
options: AutocompleteHarnessFilters = {},
42+
options: LegacyAutocompleteHarnessFilters = {},
4343
): HarnessPredicate<MatLegacyAutocompleteHarness> {
4444
return new HarnessPredicate(MatLegacyAutocompleteHarness, options).addOption(
4545
'value',

src/material/legacy-autocomplete/testing/public-api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
export * from './autocomplete-harness';
10-
export * from './autocomplete-harness-filters';
9+
export {MatLegacyAutocompleteHarness} from './autocomplete-harness';
10+
export {LegacyAutocompleteHarnessFilters} from './autocomplete-harness-filters';

tools/public_api_guard/material/legacy-autocomplete-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { OptgroupHarnessFilters } from '@angular/material/legacy-core/testing';
1313
import { OptionHarnessFilters } from '@angular/material/legacy-core/testing';
1414

1515
// @public
16-
export interface AutocompleteHarnessFilters extends BaseHarnessFilters {
16+
export interface LegacyAutocompleteHarnessFilters extends BaseHarnessFilters {
1717
value?: string | RegExp;
1818
}
1919

@@ -26,7 +26,7 @@ export class MatLegacyAutocompleteHarness extends _MatAutocompleteHarnessBase<ty
2626
protected _optionGroupClass: typeof MatLegacyOptgroupHarness;
2727
// (undocumented)
2828
protected _prefix: string;
29-
static with(options?: AutocompleteHarnessFilters): HarnessPredicate<MatLegacyAutocompleteHarness>;
29+
static with(options?: LegacyAutocompleteHarnessFilters): HarnessPredicate<MatLegacyAutocompleteHarness>;
3030
}
3131

3232
// (No @packageDocumentation comment for this package)

tools/public_api_guard/material/legacy-autocomplete.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,42 @@
44
55
```ts
66

7-
import { getMatAutocompleteMissingPanelError } from '@angular/material/autocomplete';
7+
import { getMatAutocompleteMissingPanelError as getMatLegacyAutocompleteMissingPanelError } from '@angular/material/autocomplete';
88
import * as i0 from '@angular/core';
99
import * as i4 from '@angular/cdk/overlay';
1010
import * as i5 from '@angular/material/legacy-core';
1111
import * as i6 from '@angular/material/core';
1212
import * as i7 from '@angular/common';
1313
import * as i8 from '@angular/cdk/scrolling';
14-
import { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS } from '@angular/material/autocomplete';
15-
import { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY } from '@angular/material/autocomplete';
16-
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY } from '@angular/material/autocomplete';
17-
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY } from '@angular/material/autocomplete';
18-
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER } from '@angular/material/autocomplete';
19-
import { MatAutocompleteActivatedEvent } from '@angular/material/autocomplete';
14+
import { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS as MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS } from '@angular/material/autocomplete';
15+
import { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY as MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY } from '@angular/material/autocomplete';
16+
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY as MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY } from '@angular/material/autocomplete';
17+
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY as MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY } from '@angular/material/autocomplete';
18+
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER as MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER } from '@angular/material/autocomplete';
2019
import { _MatAutocompleteBase } from '@angular/material/autocomplete';
21-
import { MatAutocompleteDefaultOptions } from '@angular/material/autocomplete';
2220
import { _MatAutocompleteOriginBase } from '@angular/material/autocomplete';
23-
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
2421
import { _MatAutocompleteTriggerBase } from '@angular/material/autocomplete';
22+
import { MatAutocompleteActivatedEvent as MatLegacyAutocompleteActivatedEvent } from '@angular/material/autocomplete';
23+
import { MatAutocompleteDefaultOptions as MatLegacyAutocompleteDefaultOptions } from '@angular/material/autocomplete';
24+
import { MatAutocompleteSelectedEvent as MatLegacyAutocompleteSelectedEvent } from '@angular/material/autocomplete';
2525
import { MatLegacyOptgroup } from '@angular/material/legacy-core';
2626
import { MatLegacyOption } from '@angular/material/legacy-core';
2727
import { QueryList } from '@angular/core';
2828

29-
export { getMatAutocompleteMissingPanelError }
29+
export { getMatLegacyAutocompleteMissingPanelError }
3030

31-
export { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS }
31+
export { MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS }
3232

33-
export { MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY }
33+
export { MAT_LEGACY_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY }
3434

35-
export { MAT_AUTOCOMPLETE_SCROLL_STRATEGY }
35+
export { MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY }
3636

37-
export { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY }
37+
export { MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY }
3838

39-
export { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER }
39+
export { MAT_LEGACY_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER }
4040

4141
// @public
42-
export const MAT_AUTOCOMPLETE_VALUE_ACCESSOR: any;
43-
44-
export { MatAutocompleteActivatedEvent }
45-
46-
export { MatAutocompleteDefaultOptions }
47-
48-
export { MatAutocompleteSelectedEvent }
42+
export const MAT_LEGACY_AUTOCOMPLETE_VALUE_ACCESSOR: any;
4943

5044
// @public (undocumented)
5145
export class MatLegacyAutocomplete extends _MatAutocompleteBase {
@@ -61,6 +55,10 @@ export class MatLegacyAutocomplete extends _MatAutocompleteBase {
6155
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyAutocomplete, never>;
6256
}
6357

58+
export { MatLegacyAutocompleteActivatedEvent }
59+
60+
export { MatLegacyAutocompleteDefaultOptions }
61+
6462
// @public (undocumented)
6563
export class MatLegacyAutocompleteModule {
6664
// (undocumented)
@@ -79,6 +77,8 @@ export class MatLegacyAutocompleteOrigin extends _MatAutocompleteOriginBase {
7977
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyAutocompleteOrigin, never>;
8078
}
8179

80+
export { MatLegacyAutocompleteSelectedEvent }
81+
8282
// @public (undocumented)
8383
export class MatLegacyAutocompleteTrigger extends _MatAutocompleteTriggerBase {
8484
// (undocumented)

0 commit comments

Comments
 (0)