Skip to content

refactor: remove mixin classes from public api #15743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cdk/table/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export class CdkFooterCellDef implements CellDef {

// Boilerplate for applying mixins to CdkColumnDef.
/** @docs-private */
export class CdkColumnDefBase {}
export const _CdkColumnDefBase: CanStickCtor&typeof CdkColumnDefBase =
class CdkColumnDefBase {}
const _CdkColumnDefBase: CanStickCtor&typeof CdkColumnDefBase =
mixinHasStickyInput(CdkColumnDefBase);

/**
Expand Down
8 changes: 4 additions & 4 deletions src/cdk/table/row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export abstract class BaseRowDef implements OnChanges {

// Boilerplate for applying mixins to CdkHeaderRowDef.
/** @docs-private */
export class CdkHeaderRowDefBase extends BaseRowDef {}
export const _CdkHeaderRowDefBase: CanStickCtor&typeof CdkHeaderRowDefBase =
class CdkHeaderRowDefBase extends BaseRowDef {}
const _CdkHeaderRowDefBase: CanStickCtor&typeof CdkHeaderRowDefBase =
mixinHasStickyInput(CdkHeaderRowDefBase);

/**
Expand All @@ -103,8 +103,8 @@ export class CdkHeaderRowDef extends _CdkHeaderRowDefBase implements CanStick, O

// Boilerplate for applying mixins to CdkFooterRowDef.
/** @docs-private */
export class CdkFooterRowDefBase extends BaseRowDef {}
export const _CdkFooterRowDefBase: CanStickCtor&typeof CdkFooterRowDefBase =
class CdkFooterRowDefBase extends BaseRowDef {}
const _CdkFooterRowDefBase: CanStickCtor&typeof CdkFooterRowDefBase =
mixinHasStickyInput(CdkFooterRowDefBase);

/**
Expand Down
5 changes: 0 additions & 5 deletions src/material-experimental/mdc-checkbox/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ export {
MatCheckboxClickAction,
MatCheckboxRequiredValidator,
_MatCheckboxRequiredValidatorModule,
/**
* @deprecated
* @breaking-change 9.0.0
*/
MatCheckboxBase,
/**
* @deprecated
* @breaking-change 9.0.0
Expand Down
4 changes: 2 additions & 2 deletions src/material/autocomplete/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class MatAutocompleteSelectedEvent {

// Boilerplate for applying mixins to MatAutocomplete.
/** @docs-private */
export class MatAutocompleteBase {}
export const _MatAutocompleteMixinBase: CanDisableRippleCtor & typeof MatAutocompleteBase =
class MatAutocompleteBase {}
const _MatAutocompleteMixinBase: CanDisableRippleCtor & typeof MatAutocompleteBase =
mixinDisableRipple(MatAutocompleteBase);

/** Default `mat-autocomplete` options that can be overridden. */
Expand Down
4 changes: 2 additions & 2 deletions src/material/badge/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ let nextId = 0;

// Boilerplate for applying mixins to MatBadge.
/** @docs-private */
export class MatBadgeBase {}
class MatBadgeBase {}

export const _MatBadgeMixinBase:
const _MatBadgeMixinBase:
CanDisableCtor & typeof MatBadgeBase = mixinDisabled(MatBadgeBase);

export type MatBadgePosition = 'above after' | 'above before' | 'below before' | 'below after';
Expand Down
4 changes: 2 additions & 2 deletions src/material/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ export class MatButtonToggleGroup implements ControlValueAccessor, OnInit, After

// Boilerplate for applying mixins to the MatButtonToggle class.
/** @docs-private */
export class MatButtonToggleBase {}
export const _MatButtonToggleMixinBase: CanDisableRippleCtor & typeof MatButtonToggleBase =
class MatButtonToggleBase {}
const _MatButtonToggleMixinBase: CanDisableRippleCtor & typeof MatButtonToggleBase =
mixinDisableRipple(MatButtonToggleBase);

/** Single button inside of a toggle group. */
Expand Down
7 changes: 3 additions & 4 deletions src/material/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ const BUTTON_HOST_ATTRIBUTES = [

// Boilerplate for applying mixins to MatButton.
/** @docs-private */
export class MatButtonBase {
class MatButtonBase {
constructor(public _elementRef: ElementRef) {}
}

export const _MatButtonMixinBase:
CanDisableRippleCtor & CanDisableCtor & CanColorCtor & typeof MatButtonBase =
mixinColor(mixinDisabled(mixinDisableRipple(MatButtonBase)));
const _MatButtonMixinBase: CanDisableRippleCtor & CanDisableCtor & CanColorCtor &
typeof MatButtonBase = mixinColor(mixinDisabled(mixinDisableRipple(MatButtonBase)));

/**
* Material design button.
Expand Down
4 changes: 2 additions & 2 deletions src/material/checkbox/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export class MatCheckboxChange {

// Boilerplate for applying mixins to MatCheckbox.
/** @docs-private */
export class MatCheckboxBase {
class MatCheckboxBase {
constructor(public _elementRef: ElementRef) {}
}
export const _MatCheckboxMixinBase:
const _MatCheckboxMixinBase:
HasTabIndexCtor &
CanColorCtor &
CanDisableRippleCtor &
Expand Down
4 changes: 2 additions & 2 deletions src/material/chips/chip-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ import {MatChipTextControl} from './chip-text-control';

// Boilerplate for applying mixins to MatChipList.
/** @docs-private */
export class MatChipListBase {
class MatChipListBase {
constructor(public _defaultErrorStateMatcher: ErrorStateMatcher,
public _parentForm: NgForm,
public _parentFormGroup: FormGroupDirective,
/** @docs-private */
public ngControl: NgControl) {}
}
export const _MatChipListMixinBase: CanUpdateErrorStateCtor & typeof MatChipListBase =
const _MatChipListMixinBase: CanUpdateErrorStateCtor & typeof MatChipListBase =
mixinErrorState(MatChipListBase);


Expand Down
26 changes: 12 additions & 14 deletions src/material/chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ export class MatChipSelectionChange {

// Boilerplate for applying mixins to MatChip.
/** @docs-private */
export class MatChipBase {
class MatChipBase {
constructor(public _elementRef: ElementRef) {}
}

export const _MatChipMixinBase:
CanColorCtor & CanDisableRippleCtor & CanDisableCtor & typeof MatChipBase =
mixinColor(mixinDisableRipple(mixinDisabled(MatChipBase)), 'primary');

const CHIP_ATTRIBUTE_NAMES = ['mat-basic-chip'];
const _MatChipMixinBase: CanColorCtor & CanDisableRippleCtor & CanDisableCtor & typeof MatChipBase =
mixinColor(mixinDisableRipple(mixinDisabled(MatChipBase)), 'primary');

/**
* Dummy directive to add CSS class to chip avatar.
Expand Down Expand Up @@ -242,15 +239,16 @@ export class MatChip extends _MatChipMixinBase implements FocusableOption, OnDes
}

_addHostClassName() {
// Add class for the different chips
for (const attr of CHIP_ATTRIBUTE_NAMES) {
if (this._elementRef.nativeElement.hasAttribute(attr) ||
this._elementRef.nativeElement.tagName.toLowerCase() === attr) {
(this._elementRef.nativeElement as HTMLElement).classList.add(attr);
return;
}
const basicChipAttrName = 'mat-basic-chip';
const element = this._elementRef.nativeElement as HTMLElement;

if (element.hasAttribute(basicChipAttrName) ||
element.tagName.toLowerCase() === basicChipAttrName) {
element.classList.add(basicChipAttrName);
return;
} else {
element.classList.add('mat-standard-chip');
}
(this._elementRef.nativeElement as HTMLElement).classList.add('mat-standard-chip');
}

ngOnDestroy() {
Expand Down
4 changes: 2 additions & 2 deletions src/material/core/option/optgroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {CanDisable, CanDisableCtor, mixinDisabled} from '../common-behaviors/dis

// Boilerplate for applying mixins to MatOptgroup.
/** @docs-private */
export class MatOptgroupBase { }
export const _MatOptgroupMixinBase: CanDisableCtor & typeof MatOptgroupBase =
class MatOptgroupBase { }
const _MatOptgroupMixinBase: CanDisableCtor & typeof MatOptgroupBase =
mixinDisabled(MatOptgroupBase);

// Counter for unique group ids.
Expand Down
4 changes: 2 additions & 2 deletions src/material/datepicker/datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export const MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {

// Boilerplate for applying mixins to MatDatepickerContent.
/** @docs-private */
export class MatDatepickerContentBase {
class MatDatepickerContentBase {
constructor(public _elementRef: ElementRef) { }
}
export const _MatDatepickerContentMixinBase: CanColorCtor & typeof MatDatepickerContentBase =
const _MatDatepickerContentMixinBase: CanColorCtor & typeof MatDatepickerContentBase =
mixinColor(MatDatepickerContentBase);

/**
Expand Down
4 changes: 2 additions & 2 deletions src/material/form-field/form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ const outlineGapPadding = 5;
* Boilerplate for applying mixins to MatFormField.
* @docs-private
*/
export class MatFormFieldBase {
class MatFormFieldBase {
constructor(public _elementRef: ElementRef) { }
}

/**
* Base class to which we're applying the form field mixins.
* @docs-private
*/
export const _MatFormFieldMixinBase: CanColorCtor & typeof MatFormFieldBase =
const _MatFormFieldMixinBase: CanColorCtor & typeof MatFormFieldBase =
mixinColor(MatFormFieldBase, 'primary');

/** Possible appearance styles for the form field. */
Expand Down
5 changes: 2 additions & 3 deletions src/material/icon/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ import {MatIconRegistry} from './icon-registry';

// Boilerplate for applying mixins to MatIcon.
/** @docs-private */
export class MatIconBase {
class MatIconBase {
constructor(public _elementRef: ElementRef) {}
}
export const _MatIconMixinBase: CanColorCtor & typeof MatIconBase =
mixinColor(MatIconBase);
const _MatIconMixinBase: CanColorCtor & typeof MatIconBase = mixinColor(MatIconBase);

/**
* Injection token used to provide the current location to `MatIcon`.
Expand Down
4 changes: 2 additions & 2 deletions src/material/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ let nextUniqueId = 0;

// Boilerplate for applying mixins to MatInput.
/** @docs-private */
export class MatInputBase {
class MatInputBase {
constructor(public _defaultErrorStateMatcher: ErrorStateMatcher,
public _parentForm: NgForm,
public _parentFormGroup: FormGroupDirective,
/** @docs-private */
public ngControl: NgControl) {}
}
export const _MatInputMixinBase: CanUpdateErrorStateCtor & typeof MatInputBase =
const _MatInputMixinBase: CanUpdateErrorStateCtor & typeof MatInputBase =
mixinErrorState(MatInputBase);

/** Directive that allows a native input to work inside a `MatFormField`. */
Expand Down
8 changes: 4 additions & 4 deletions src/material/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ import {takeUntil} from 'rxjs/operators';

// Boilerplate for applying mixins to MatList.
/** @docs-private */
export class MatListBase {}
export const _MatListMixinBase: CanDisableRippleCtor & typeof MatListBase =
class MatListBase {}
const _MatListMixinBase: CanDisableRippleCtor & typeof MatListBase =
mixinDisableRipple(MatListBase);

// Boilerplate for applying mixins to MatListItem.
/** @docs-private */
export class MatListItemBase {}
export const _MatListItemMixinBase: CanDisableRippleCtor & typeof MatListItemBase =
class MatListItemBase {}
const _MatListItemMixinBase: CanDisableRippleCtor & typeof MatListItemBase =
mixinDisableRipple(MatListItemBase);

@Component({
Expand Down
8 changes: 4 additions & 4 deletions src/material/list/selection-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ import {MatListAvatarCssMatStyler, MatListIconCssMatStyler} from './list';


/** @docs-private */
export class MatSelectionListBase {}
export const _MatSelectionListMixinBase: CanDisableRippleCtor & typeof MatSelectionListBase =
class MatSelectionListBase {}
const _MatSelectionListMixinBase: CanDisableRippleCtor & typeof MatSelectionListBase =
mixinDisableRipple(MatSelectionListBase);

/** @docs-private */
export class MatListOptionBase {}
export const _MatListOptionMixinBase: CanDisableRippleCtor & typeof MatListOptionBase =
class MatListOptionBase {}
const _MatListOptionMixinBase: CanDisableRippleCtor & typeof MatListOptionBase =
mixinDisableRipple(MatListOptionBase);

/** @docs-private */
Expand Down
4 changes: 2 additions & 2 deletions src/material/menu/menu-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import {MAT_MENU_PANEL, MatMenuPanel} from './menu-panel';

// Boilerplate for applying mixins to MatMenuItem.
/** @docs-private */
export class MatMenuItemBase {}
export const _MatMenuItemMixinBase: CanDisableRippleCtor & CanDisableCtor & typeof MatMenuItemBase =
class MatMenuItemBase {}
const _MatMenuItemMixinBase: CanDisableRippleCtor & CanDisableCtor & typeof MatMenuItemBase =
mixinDisableRipple(mixinDisabled(MatMenuItemBase));

/**
Expand Down
4 changes: 2 additions & 2 deletions src/material/paginator/paginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export class PageEvent {

// Boilerplate for applying mixins to MatPaginator.
/** @docs-private */
export class MatPaginatorBase {}
export const _MatPaginatorBase: CanDisableCtor & HasInitializedCtor & typeof MatPaginatorBase =
class MatPaginatorBase {}
const _MatPaginatorBase: CanDisableCtor & HasInitializedCtor & typeof MatPaginatorBase =
mixinDisabled(mixinInitialized(MatPaginatorBase));

/**
Expand Down
14 changes: 7 additions & 7 deletions src/material/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ import {DOCUMENT} from '@angular/common';
// TODO(josephperrott): Benchpress tests.
// TODO(josephperrott): Add ARIA attributes for progress bar "for".

// Boilerplate for applying mixins to MatProgressBar.
/** @docs-private */
export class MatProgressBarBase {
constructor(public _elementRef: ElementRef) { }
}

/** Last animation end data. */
export interface ProgressAnimationEnd {
value: number;
}

export const _MatProgressBarMixinBase: CanColorCtor & typeof MatProgressBarBase =
// Boilerplate for applying mixins to MatProgressBar.
/** @docs-private */
class MatProgressBarBase {
constructor(public _elementRef: ElementRef) { }
}

const _MatProgressBarMixinBase: CanColorCtor & typeof MatProgressBarBase =
mixinColor(MatProgressBarBase, 'primary');

/**
Expand Down
4 changes: 2 additions & 2 deletions src/material/progress-spinner/progress-spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const BASE_STROKE_WIDTH = 10;

// Boilerplate for applying mixins to MatProgressSpinner.
/** @docs-private */
export class MatProgressSpinnerBase {
class MatProgressSpinnerBase {
constructor(public _elementRef: ElementRef) {}
}
export const _MatProgressSpinnerMixinBase: CanColorCtor & typeof MatProgressSpinnerBase =
const _MatProgressSpinnerMixinBase: CanColorCtor & typeof MatProgressSpinnerBase =
mixinColor(MatProgressSpinnerBase, 'primary');

/** Default `mat-progress-spinner` options that can be overridden. */
Expand Down
6 changes: 3 additions & 3 deletions src/material/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class MatRadioGroup implements AfterContentInit, ControlValueAccessor {

// Boilerplate for applying mixins to MatRadioButton.
/** @docs-private */
export class MatRadioButtonBase {
class MatRadioButtonBase {
// Since the disabled property is manually defined for the MatRadioButton and isn't set up in
// the mixin base class. To be able to use the tabindex mixin, a disabled property must be
// defined to properly work.
Expand All @@ -302,8 +302,8 @@ export class MatRadioButtonBase {
}
// As per Material design specifications the selection control radio should use the accent color
// palette by default. https://material.io/guidelines/components/selection-controls.html
export const _MatRadioButtonMixinBase:
CanColorCtor & CanDisableRippleCtor & HasTabIndexCtor & typeof MatRadioButtonBase =
const _MatRadioButtonMixinBase: CanColorCtor & CanDisableRippleCtor & HasTabIndexCtor &
typeof MatRadioButtonBase =
mixinColor(mixinDisableRipple(mixinTabIndex(MatRadioButtonBase)), 'accent');

/**
Expand Down
4 changes: 2 additions & 2 deletions src/material/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ export class MatSelectChange {

// Boilerplate for applying mixins to MatSelect.
/** @docs-private */
export class MatSelectBase {
class MatSelectBase {
constructor(public _elementRef: ElementRef,
public _defaultErrorStateMatcher: ErrorStateMatcher,
public _parentForm: NgForm,
public _parentFormGroup: FormGroupDirective,
public ngControl: NgControl) {}
}
export const _MatSelectMixinBase:
const _MatSelectMixinBase:
CanDisableCtor &
HasTabIndexCtor &
CanDisableRippleCtor &
Expand Down
4 changes: 2 additions & 2 deletions src/material/slide-toggle/slide-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export class MatSlideToggleChange {

// Boilerplate for applying mixins to MatSlideToggle.
/** @docs-private */
export class MatSlideToggleBase {
class MatSlideToggleBase {
constructor(public _elementRef: ElementRef) {}
}
export const _MatSlideToggleMixinBase:
const _MatSlideToggleMixinBase:
HasTabIndexCtor &
CanColorCtor &
CanDisableRippleCtor &
Expand Down
Loading