Skip to content

Commit

Permalink
fix(material/legacy-list): deprecate all ts symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Sep 7, 2022
1 parent cf0dd6c commit e67e493
Show file tree
Hide file tree
Showing 13 changed files with 180 additions and 45 deletions.
4 changes: 4 additions & 0 deletions src/material/legacy-list/list-module.ts
Expand Up @@ -25,6 +25,10 @@ import {
import {MatLegacyListOption, MatLegacySelectionList} from './selection-list';
import {MatDividerModule} from '@angular/material/divider';

/**
* @deprecated Use `MatListModule` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@NgModule({
imports: [MatLineModule, MatRippleModule, MatCommonModule, MatPseudoCheckboxModule, CommonModule],
exports: [
Expand Down
20 changes: 19 additions & 1 deletion src/material/legacy-list/list.ts
Expand Up @@ -44,6 +44,10 @@ const _MatListBase = mixinDisabled(mixinDisableRipple(class {}));
/** @docs-private */
const _MatListItemMixinBase = mixinDisableRipple(class {});

/**
* @deprecated Use `MatNavList` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-nav-list',
exportAs: 'matNavList',
Expand Down Expand Up @@ -74,6 +78,10 @@ export class MatLegacyNavList
}
}

/**
* @deprecated Use `MatList` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-list, mat-action-list',
exportAs: 'matList',
Expand Down Expand Up @@ -129,6 +137,8 @@ export class MatLegacyList
/**
* Directive whose purpose is to add the mat- CSS styling to this selector.
* @docs-private
* @deprecated Use `MatListAvatarCssMatStyler` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: '[mat-list-avatar], [matListAvatar]',
Expand All @@ -139,6 +149,8 @@ export class MatLegacyListAvatarCssMatStyler {}
/**
* Directive whose purpose is to add the mat- CSS styling to this selector.
* @docs-private
* @deprecated Use `MatListIconCssMatStyler` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: '[mat-list-icon], [matListIcon]',
Expand All @@ -149,14 +161,20 @@ export class MatLegacyListIconCssMatStyler {}
/**
* Directive whose purpose is to add the mat- CSS styling to this selector.
* @docs-private
* @deprecated Use `MatListSubheaderCssMatStyler` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: '[mat-subheader], [matSubheader]',
host: {'class': 'mat-subheader'},
})
export class MatLegacyListSubheaderCssMatStyler {}

/** An item within a Material Design list. */
/**
* An item within a Material Design list.
* @deprecated Use `MatListItem` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-list-item, a[mat-list-item], button[mat-list-item]',
exportAs: 'matListItem',
Expand Down
9 changes: 9 additions & 0 deletions src/material/legacy-list/public-api.ts
Expand Up @@ -24,6 +24,15 @@ export {
} from './selection-list';

export {
/**
* @deprecated Use `MAT_LIST` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
MAT_LIST as MAT_LEGACY_LIST,

/**
* @deprecated Use `MAT_NAV_LIST` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
MAT_NAV_LIST as MAT_LEGACY_NAV_LIST,
} from '@angular/material/list';
18 changes: 16 additions & 2 deletions src/material/legacy-list/selection-list.ts
Expand Up @@ -46,14 +46,22 @@ import {MatLegacyListAvatarCssMatStyler, MatLegacyListIconCssMatStyler} from './
const _MatSelectionListBase = mixinDisableRipple(class {});
const _MatListOptionBase = mixinDisableRipple(class {});

/** @docs-private */
/**
* @docs-private
* @deprecated Use `MAT_SELECTION_LIST_VALUE_ACCESSOR` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_SELECTION_LIST_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => MatLegacySelectionList),
multi: true,
};

/** Change event that is being fired whenever the selected state of an option changes. */
/**
* Change event that is being fired whenever the selected state of an option changes.
* @deprecated Use `MatSelectionListChange` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacySelectionListChange {
constructor(
/** Reference to the selection list that emitted the event. */
Expand All @@ -66,13 +74,17 @@ export class MatLegacySelectionListChange {
/**
* Type describing possible positions of a checkbox in a list option
* with respect to the list item's text.
* @deprecated Use `MatListOptionCheckboxPosition` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export type MatLegacyListOptionCheckboxPosition = 'before' | 'after';

/**
* Component for list-options of selection-list. Each list-option can automatically
* generate a checkbox and can put current item into the selectionModel of selection-list
* if the current item is selected.
* @deprecated Use `MatListOption` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-list-option',
Expand Down Expand Up @@ -325,6 +337,8 @@ export class MatLegacyListOption

/**
* Material Design list component where each item is a selectable option. Behaves as a listbox.
* @deprecated Use `MatSelectionList` from `@angular/material/list` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-selection-list',
Expand Down
12 changes: 10 additions & 2 deletions src/material/legacy-list/testing/action-list-harness.ts
Expand Up @@ -14,7 +14,11 @@ import {
} from './list-harness-filters';
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';

/** Harness for interacting with a standard mat-action-list in tests. */
/**
* Harness for interacting with a standard mat-action-list in tests.
* @deprecated Use `MatActionListHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyActionListHarness extends MatLegacyListHarnessBase<
typeof MatLegacyActionListItemHarness,
MatLegacyActionListItemHarness,
Expand All @@ -38,7 +42,11 @@ export class MatLegacyActionListHarness extends MatLegacyListHarnessBase<
override _itemHarness = MatLegacyActionListItemHarness;
}

/** Harness for interacting with an action list item. */
/**
* Harness for interacting with an action list item.
* @deprecated Use `MatActionListItemHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyActionListItemHarness extends MatLegacyListItemHarnessBase {
/** The selector for the host element of a `MatListItem` instance. */
static hostSelector = `${MatLegacyActionListHarness.hostSelector} .mat-list-item`;
Expand Down
8 changes: 7 additions & 1 deletion src/material/legacy-list/testing/list-harness-base.ts
Expand Up @@ -19,7 +19,11 @@ import {
} from './list-harness-filters';
import {MatLegacySubheaderHarness} from './list-item-harness-base';

/** Represents a section of a list falling under a specific header. */
/**
* Represents a section of a list falling under a specific header.
* @deprecated Use `ListSection` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface ListSection<I> {
/** The heading for this list section. `undefined` if there is no heading. */
heading?: string;
Expand All @@ -34,6 +38,8 @@ export interface ListSection<I> {
* @template C The list item harness type that `T` constructs.
* @template F The filter type used filter list item harness of type `C`.
* @docs-private
* @deprecated Use `class` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export abstract class MatLegacyListHarnessBase<
T extends ComponentHarnessConstructor<C> & {with: (options?: F) => HarnessPredicate<C>},
Expand Down
40 changes: 40 additions & 0 deletions src/material/legacy-list/testing/list-harness-filters.ts
Expand Up @@ -8,30 +8,70 @@

import {BaseHarnessFilters} from '@angular/cdk/testing';

/**
* @deprecated Use `ListHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyListHarnessFilters extends BaseHarnessFilters {}

/**
* @deprecated Use `ActionListHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyActionListHarnessFilters extends BaseHarnessFilters {}

/**
* @deprecated Use `NavListHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyNavListHarnessFilters extends BaseHarnessFilters {}

/**
* @deprecated Use `SelectionListHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacySelectionListHarnessFilters extends BaseHarnessFilters {}

/**
* @deprecated Use `BaseListItemHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyBaseListItemHarnessFilters extends BaseHarnessFilters {
text?: string | RegExp;
}

/**
* @deprecated Use `ListItemHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyListItemHarnessFilters extends LegacyBaseListItemHarnessFilters {}

/**
* @deprecated Use `ActionListItemHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyActionListItemHarnessFilters extends LegacyBaseListItemHarnessFilters {}

/**
* @deprecated Use `NavListItemHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyNavListItemHarnessFilters extends LegacyBaseListItemHarnessFilters {
href?: string | RegExp | null;
}

/**
* @deprecated Use `ListOptionHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacyListOptionHarnessFilters extends LegacyBaseListItemHarnessFilters {
selected?: boolean;
}

/**
* @deprecated Use `SubheaderHarnessFilters` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export interface LegacySubheaderHarnessFilters extends BaseHarnessFilters {
text?: string | RegExp;
}
12 changes: 10 additions & 2 deletions src/material/legacy-list/testing/list-harness.ts
Expand Up @@ -11,7 +11,11 @@ import {MatLegacyListHarnessBase} from './list-harness-base';
import {LegacyListHarnessFilters, LegacyListItemHarnessFilters} from './list-harness-filters';
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';

/** Harness for interacting with a standard mat-list in tests. */
/**
* Harness for interacting with a standard mat-list in tests.
* @deprecated Use `MatListHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyListHarness extends MatLegacyListHarnessBase<
typeof MatLegacyListItemHarness,
MatLegacyListItemHarness,
Expand All @@ -33,7 +37,11 @@ export class MatLegacyListHarness extends MatLegacyListHarnessBase<
override _itemHarness = MatLegacyListItemHarness;
}

/** Harness for interacting with a list item. */
/**
* Harness for interacting with a list item.
* @deprecated Use `MatListItemHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyListItemHarness extends MatLegacyListItemHarnessBase {
/** The selector for the host element of a `MatListItem` instance. */
static hostSelector = `${MatLegacyListHarness.hostSelector} .mat-list-item`;
Expand Down
16 changes: 14 additions & 2 deletions src/material/legacy-list/testing/list-item-harness-base.ts
Expand Up @@ -28,6 +28,8 @@ const avatarSelector = '.mat-list-avatar';
* @param harnessType A constructor for a list item harness.
* @param options An instance of `BaseListItemHarnessFilters` to apply.
* @return A `HarnessPredicate` for the given harness type with the given options applied.
* @deprecated Use `getListItemPredicate` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export function getListItemPredicate<H extends MatLegacyListItemHarnessBase>(
harnessType: ComponentHarnessConstructor<H>,
Expand All @@ -40,7 +42,11 @@ export function getListItemPredicate<H extends MatLegacyListItemHarnessBase>(
);
}

/** Harness for interacting with a list subheader. */
/**
* Harness for interacting with a list subheader.
* @deprecated Use `MatSubheaderHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacySubheaderHarness extends ComponentHarness {
static hostSelector = '.mat-subheader';

Expand All @@ -60,7 +66,11 @@ export class MatLegacySubheaderHarness extends ComponentHarness {
}
}

/** Selectors for the various list item sections that may contain user content. */
/**
* Selectors for the various list item sections that may contain user content.
* @deprecated Use `enum` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const enum MatLegacyListItemSection {
CONTENT = '.mat-list-item-content',
// TODO(mmalerba): consider adding sections for leading/trailing icons.
Expand All @@ -69,6 +79,8 @@ export const enum MatLegacyListItemSection {
/**
* Shared behavior among the harnesses for the various `MatListItem` flavors.
* @docs-private
* @deprecated Use `class` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export abstract class MatLegacyListItemHarnessBase extends ContentContainerComponentHarness<MatLegacyListItemSection> {
private _lines = this.locatorForAll('.mat-line');
Expand Down
12 changes: 10 additions & 2 deletions src/material/legacy-list/testing/nav-list-harness.ts
Expand Up @@ -11,7 +11,11 @@ import {MatLegacyListHarnessBase} from './list-harness-base';
import {LegacyNavListHarnessFilters, LegacyNavListItemHarnessFilters} from './list-harness-filters';
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';

/** Harness for interacting with a standard mat-nav-list in tests. */
/**
* Harness for interacting with a standard mat-nav-list in tests.
* @deprecated Use `MatNavListHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyNavListHarness extends MatLegacyListHarnessBase<
typeof MatLegacyNavListItemHarness,
MatLegacyNavListItemHarness,
Expand All @@ -35,7 +39,11 @@ export class MatLegacyNavListHarness extends MatLegacyListHarnessBase<
override _itemHarness = MatLegacyNavListItemHarness;
}

/** Harness for interacting with a nav list item. */
/**
* Harness for interacting with a nav list item.
* @deprecated Use `MatNavListItemHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyNavListItemHarness extends MatLegacyListItemHarnessBase {
/** The selector for the host element of a `MatListItem` instance. */
static hostSelector = `${MatLegacyNavListHarness.hostSelector} .mat-list-item`;
Expand Down
12 changes: 10 additions & 2 deletions src/material/legacy-list/testing/selection-list-harness.ts
Expand Up @@ -16,7 +16,11 @@ import {
} from './list-harness-filters';
import {getListItemPredicate, MatLegacyListItemHarnessBase} from './list-item-harness-base';

/** Harness for interacting with a standard mat-selection-list in tests. */
/**
* Harness for interacting with a standard mat-selection-list in tests.
* @deprecated Use `MatSelectionListHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacySelectionListHarness extends MatLegacyListHarnessBase<
typeof MatLegacyListOptionHarness,
MatLegacyListOptionHarness,
Expand Down Expand Up @@ -76,7 +80,11 @@ export class MatLegacySelectionListHarness extends MatLegacyListHarnessBase<
}
}

/** Harness for interacting with a list option. */
/**
* Harness for interacting with a list option.
* @deprecated Use `MatListOptionHarness` from `@angular/material/list/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyListOptionHarness extends MatLegacyListItemHarnessBase {
/** The selector for the host element of a `MatListOption` instance. */
static hostSelector = '.mat-list-option';
Expand Down

0 comments on commit e67e493

Please sign in to comment.