Skip to content

Commit bf7e9ef

Browse files
authored
refactor(multiple): remove unnecessary inputs and outputs metadata (#28311)
Removes some `inputs` and `outputs` declarations from the directive metadata which isn't necessary anymore now that we don't use TS mixin functions anymore.
1 parent 729dfc5 commit bf7e9ef

File tree

9 files changed

+16
-19
lines changed

9 files changed

+16
-19
lines changed

src/material/slide-toggle/slide-toggle.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ let nextUniqueId = 0;
7070
selector: 'mat-slide-toggle',
7171
templateUrl: 'slide-toggle.html',
7272
styleUrls: ['slide-toggle.css'],
73-
inputs: ['disabled', 'disableRipple', 'color', 'tabIndex'],
7473
host: {
7574
'class': 'mat-mdc-slide-toggle',
7675
'[id]': 'id',

src/material/stepper/stepper-button.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {Directive} from '@angular/core';
1616
'class': 'mat-stepper-next',
1717
'[type]': 'type',
1818
},
19-
inputs: ['type'],
2019
standalone: true,
2120
})
2221
export class MatStepperNext extends CdkStepperNext {}
@@ -28,7 +27,6 @@ export class MatStepperNext extends CdkStepperNext {}
2827
'class': 'mat-stepper-previous',
2928
'[type]': 'type',
3029
},
31-
inputs: ['type'],
3230
standalone: true,
3331
})
3432
export class MatStepperPrevious extends CdkStepperPrevious {}

src/material/stepper/stepper.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ export class MatStep extends CdkStep implements ErrorStateMatcher, AfterContentI
131131
exportAs: 'matStepper, matVerticalStepper, matHorizontalStepper',
132132
templateUrl: 'stepper.html',
133133
styleUrls: ['stepper.css'],
134-
inputs: ['selectedIndex'],
135134
host: {
136135
'[class.mat-stepper-horizontal]': 'orientation === "horizontal"',
137136
'[class.mat-stepper-vertical]': 'orientation === "vertical"',

src/material/tabs/paginated-tab-header.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
Input,
2323
booleanAttribute,
2424
numberAttribute,
25+
Output,
2526
} from '@angular/core';
2627
import {Direction, Directionality} from '@angular/cdk/bidi';
2728
import {ViewportRuler} from '@angular/cdk/scrolling';
@@ -128,11 +129,12 @@ export abstract class MatPaginatedTabHeader
128129
disablePagination: boolean = false;
129130

130131
/** The index of the active tab. */
132+
@Input({transform: numberAttribute})
131133
get selectedIndex(): number {
132134
return this._selectedIndex;
133135
}
134-
set selectedIndex(v: unknown) {
135-
const value = numberAttribute(v, 0);
136+
set selectedIndex(v: number) {
137+
const value = isNaN(v) ? 0 : v;
136138

137139
if (this._selectedIndex != value) {
138140
this._selectedIndexChanged = true;
@@ -146,10 +148,10 @@ export abstract class MatPaginatedTabHeader
146148
private _selectedIndex: number = 0;
147149

148150
/** Event emitted when the option is selected. */
149-
readonly selectFocusedIndex: EventEmitter<number> = new EventEmitter<number>();
151+
@Output() readonly selectFocusedIndex: EventEmitter<number> = new EventEmitter<number>();
150152

151153
/** Event emitted when a label is focused. */
152-
readonly indexFocused: EventEmitter<number> = new EventEmitter<number>();
154+
@Output() readonly indexFocused: EventEmitter<number> = new EventEmitter<number>();
153155

154156
constructor(
155157
protected _elementRef: ElementRef<HTMLElement>,

src/material/tabs/tab-header.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ import {MatRipple} from '@angular/material/core';
4646
selector: 'mat-tab-header',
4747
templateUrl: 'tab-header.html',
4848
styleUrls: ['tab-header.css'],
49-
inputs: ['selectedIndex'],
50-
outputs: ['selectFocusedIndex', 'indexFocused'],
5149
encapsulation: ViewEncapsulation.None,
5250
// tslint:disable-next-line:validate-decorators
5351
changeDetection: ChangeDetectionStrategy.Default,

src/material/tabs/tab-nav-bar/tab-nav-bar.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ const _MatTabLinkMixinBase = mixinInkBarItem(
241241
@Component({
242242
selector: '[mat-tab-link], [matTabLink]',
243243
exportAs: 'matTabLink',
244-
inputs: ['active', 'id'],
245244
changeDetection: ChangeDetectionStrategy.OnPush,
246245
encapsulation: ViewEncapsulation.None,
247246
templateUrl: 'tab-link.html',

tools/public_api_guard/material/slide-toggle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class MatSlideToggle implements OnDestroy, AfterContentInit, OnChanges, C
9999
validate(control: AbstractControl<boolean>): ValidationErrors | null;
100100
writeValue(value: any): void;
101101
// (undocumented)
102-
static ɵcmp: i0.ɵɵComponentDeclaration<MatSlideToggle, "mat-slide-toggle", ["matSlideToggle"], { "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "name": { "alias": "name"; "required": false; }; "id": { "alias": "id"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; }; "required": { "alias": "required"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "hideIcon": { "alias": "hideIcon"; "required": false; }; }, { "change": "change"; "toggleChange": "toggleChange"; }, never, ["*"], true, never>;
102+
static ɵcmp: i0.ɵɵComponentDeclaration<MatSlideToggle, "mat-slide-toggle", ["matSlideToggle"], { "name": { "alias": "name"; "required": false; }; "id": { "alias": "id"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; }; "required": { "alias": "required"; "required": false; }; "color": { "alias": "color"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "hideIcon": { "alias": "hideIcon"; "required": false; }; }, { "change": "change"; "toggleChange": "toggleChange"; }, never, ["*"], true, never>;
103103
// (undocumented)
104104
static ɵfac: i0.ɵɵFactoryDeclaration<MatSlideToggle, [null, null, null, { attribute: "tabindex"; }, null, { optional: true; }]>;
105105
}

tools/public_api_guard/material/stepper.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class MatStepper extends CdkStepper implements AfterContentInit {
146146
readonly steps: QueryList<MatStep>;
147147
_steps: QueryList<MatStep>;
148148
// (undocumented)
149-
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepper, "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", ["matStepper", "matVerticalStepper", "matHorizontalStepper"], { "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "headerPosition": { "alias": "headerPosition"; "required": false; }; "animationDuration": { "alias": "animationDuration"; "required": false; }; }, { "animationDone": "animationDone"; }, ["_steps", "_icons"], never, true, never>;
149+
static ɵcmp: i0.ɵɵComponentDeclaration<MatStepper, "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", ["matStepper", "matVerticalStepper", "matHorizontalStepper"], { "disableRipple": { "alias": "disableRipple"; "required": false; }; "color": { "alias": "color"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "headerPosition": { "alias": "headerPosition"; "required": false; }; "animationDuration": { "alias": "animationDuration"; "required": false; }; }, { "animationDone": "animationDone"; }, ["_steps", "_icons"], never, true, never>;
150150
// (undocumented)
151151
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepper, [{ optional: true; }, null, null]>;
152152
}
@@ -201,15 +201,15 @@ export class MatStepperModule {
201201
// @public
202202
export class MatStepperNext extends CdkStepperNext {
203203
// (undocumented)
204-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperNext, "button[matStepperNext]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, true, never>;
204+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperNext, "button[matStepperNext]", never, {}, {}, never, never, true, never>;
205205
// (undocumented)
206206
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperNext, never>;
207207
}
208208

209209
// @public
210210
export class MatStepperPrevious extends CdkStepperPrevious {
211211
// (undocumented)
212-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperPrevious, "button[matStepperPrevious]", never, { "type": { "alias": "type"; "required": false; }; }, {}, never, never, true, never>;
212+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatStepperPrevious, "button[matStepperPrevious]", never, {}, {}, never, never, true, never>;
213213
// (undocumented)
214214
static ɵfac: i0.ɵɵFactoryDeclaration<MatStepperPrevious, never>;
215215
}

tools/public_api_guard/material/tabs.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ export abstract class MatPaginatedTabHeader implements AfterContentChecked, Afte
116116
// (undocumented)
117117
static ngAcceptInputType_disablePagination: unknown;
118118
// (undocumented)
119+
static ngAcceptInputType_selectedIndex: unknown;
120+
// (undocumented)
119121
ngAfterContentChecked(): void;
120122
// (undocumented)
121123
ngAfterContentInit(): void;
@@ -134,7 +136,7 @@ export abstract class MatPaginatedTabHeader implements AfterContentChecked, Afte
134136
};
135137
_scrollToLabel(labelIndex: number): void;
136138
get selectedIndex(): number;
137-
set selectedIndex(v: unknown);
139+
set selectedIndex(v: number);
138140
readonly selectFocusedIndex: EventEmitter<number>;
139141
_setTabFocus(tabIndex: number): void;
140142
_showPaginationControls: boolean;
@@ -148,7 +150,7 @@ export abstract class MatPaginatedTabHeader implements AfterContentChecked, Afte
148150
updatePagination(): void;
149151
_updateTabScrollPosition(): void;
150152
// (undocumented)
151-
static ɵdir: i0.ɵɵDirectiveDeclaration<MatPaginatedTabHeader, never, never, { "disablePagination": { "alias": "disablePagination"; "required": false; }; }, {}, never, never, false, never>;
153+
static ɵdir: i0.ɵɵDirectiveDeclaration<MatPaginatedTabHeader, never, never, { "disablePagination": { "alias": "disablePagination"; "required": false; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; }, { "selectFocusedIndex": "selectFocusedIndex"; "indexFocused": "indexFocused"; }, never, never, false, never>;
152154
// (undocumented)
153155
static ɵfac: i0.ɵɵFactoryDeclaration<MatPaginatedTabHeader, [null, null, null, { optional: true; }, null, null, { optional: true; }]>;
154156
}
@@ -357,7 +359,7 @@ export class MatTabHeader extends MatPaginatedTabHeader implements AfterContentC
357359
// (undocumented)
358360
_tabListInner: ElementRef;
359361
// (undocumented)
360-
static ɵcmp: i0.ɵɵComponentDeclaration<MatTabHeader, "mat-tab-header", never, { "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; }, { "selectFocusedIndex": "selectFocusedIndex"; "indexFocused": "indexFocused"; }, ["_items"], ["*"], true, never>;
362+
static ɵcmp: i0.ɵɵComponentDeclaration<MatTabHeader, "mat-tab-header", never, { "disableRipple": { "alias": "disableRipple"; "required": false; }; }, {}, ["_items"], ["*"], true, never>;
361363
// (undocumented)
362364
static ɵfac: i0.ɵɵFactoryDeclaration<MatTabHeader, [null, null, null, { optional: true; }, null, null, { optional: true; }]>;
363365
}
@@ -438,7 +440,7 @@ export class MatTabLink extends _MatTabLinkMixinBase implements AfterViewInit, O
438440
// (undocumented)
439441
tabIndex: number;
440442
// (undocumented)
441-
static ɵcmp: i0.ɵɵComponentDeclaration<MatTabLink, "[mat-tab-link], [matTabLink]", ["matTabLink"], { "active": { "alias": "active"; "required": false; }; "id": { "alias": "id"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; }, {}, never, ["*"], true, never>;
443+
static ɵcmp: i0.ɵɵComponentDeclaration<MatTabLink, "[mat-tab-link], [matTabLink]", ["matTabLink"], { "active": { "alias": "active"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "disableRipple": { "alias": "disableRipple"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, {}, never, ["*"], true, never>;
442444
// (undocumented)
443445
static ɵfac: i0.ɵɵFactoryDeclaration<MatTabLink, [null, null, { optional: true; }, { attribute: "tabindex"; }, null, { optional: true; }]>;
444446
}

0 commit comments

Comments
 (0)