mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
Updated existing Angular Material examples
This commit is contained in:
parent
f1e1ddc236
commit
7ec117202d
|
@ -27,7 +27,7 @@ export class AutocompleteDisplayExample implements OnInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.filteredOptions = this.myControl.valueChanges
|
this.filteredOptions = this.myControl.valueChanges
|
||||||
.pipe(
|
.pipe(
|
||||||
startWith<string | User>(''),
|
startWith(''),
|
||||||
map(value => typeof value === 'string' ? value : value.name),
|
map(value => typeof value === 'string' ? value : value.name),
|
||||||
map(name => name ? this._filter(name) : this.options.slice())
|
map(name => name ? this._filter(name) : this.options.slice())
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,7 +24,7 @@ export const _filter = (opt: string[], value: string): string[] => {
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AutocompleteOptgroupExample implements OnInit {
|
export class AutocompleteOptgroupExample implements OnInit {
|
||||||
stateForm: FormGroup = this.fb.group({
|
stateForm: FormGroup = this._formBuilder.group({
|
||||||
stateGroup: '',
|
stateGroup: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ export class AutocompleteOptgroupExample implements OnInit {
|
||||||
|
|
||||||
stateGroupOptions: Observable<StateGroup[]>;
|
stateGroupOptions: Observable<StateGroup[]>;
|
||||||
|
|
||||||
constructor(private fb: FormBuilder) {}
|
constructor(private _formBuilder: FormBuilder) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.stateGroupOptions = this.stateForm.get('stateGroup')!.valueChanges
|
this.stateGroupOptions = this.stateForm.get('stateGroup')!.valueChanges
|
||||||
|
|
|
@ -13,5 +13,9 @@
|
||||||
<p>
|
<p>
|
||||||
Icon with a badge
|
Icon with a badge
|
||||||
<mat-icon matBadge="15" matBadgeColor="warn">home</mat-icon>
|
<mat-icon matBadge="15" matBadgeColor="warn">home</mat-icon>
|
||||||
|
<!-- Include text description of the icon's meaning for screen-readers -->
|
||||||
|
<span class="cdk-visually-hidden">
|
||||||
|
Example with a home icon with overlaid badge showing the number 15
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatBottomSheet, MatBottomSheetRef} from '@angular/material';
|
import {MatBottomSheet, MatBottomSheetRef} from '@angular/material/bottom-sheet';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Bottom Sheet Overview
|
* @title Bottom Sheet Overview
|
||||||
|
@ -10,10 +10,10 @@ import {MatBottomSheet, MatBottomSheetRef} from '@angular/material';
|
||||||
styleUrls: ['bottom-sheet-overview-example.css'],
|
styleUrls: ['bottom-sheet-overview-example.css'],
|
||||||
})
|
})
|
||||||
export class BottomSheetOverviewExample {
|
export class BottomSheetOverviewExample {
|
||||||
constructor(private bottomSheet: MatBottomSheet) {}
|
constructor(private _bottomSheet: MatBottomSheet) {}
|
||||||
|
|
||||||
openBottomSheet(): void {
|
openBottomSheet(): void {
|
||||||
this.bottomSheet.open(BottomSheetOverviewExampleSheet);
|
this._bottomSheet.open(BottomSheetOverviewExampleSheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ export class BottomSheetOverviewExample {
|
||||||
templateUrl: 'bottom-sheet-overview-example-sheet.html',
|
templateUrl: 'bottom-sheet-overview-example-sheet.html',
|
||||||
})
|
})
|
||||||
export class BottomSheetOverviewExampleSheet {
|
export class BottomSheetOverviewExampleSheet {
|
||||||
constructor(private bottomSheetRef: MatBottomSheetRef<BottomSheetOverviewExampleSheet>) {}
|
constructor(private _bottomSheetRef: MatBottomSheetRef<BottomSheetOverviewExampleSheet>) {}
|
||||||
|
|
||||||
openLink(event: MouseEvent): void {
|
openLink(event: MouseEvent): void {
|
||||||
this.bottomSheetRef.dismiss();
|
this._bottomSheetRef.dismiss();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-button-toggle-group {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<mat-button-toggle-group #group="matButtonToggleGroup">
|
<mat-button-toggle-group #group="matButtonToggleGroup">
|
||||||
<mat-button-toggle value="left">
|
<mat-button-toggle value="left" aria-label="Text align left">
|
||||||
<mat-icon>format_align_left</mat-icon>
|
<mat-icon>format_align_left</mat-icon>
|
||||||
</mat-button-toggle>
|
</mat-button-toggle>
|
||||||
<mat-button-toggle value="center">
|
<mat-button-toggle value="center" aria-label="Text align center">
|
||||||
<mat-icon>format_align_center</mat-icon>
|
<mat-icon>format_align_center</mat-icon>
|
||||||
</mat-button-toggle>
|
</mat-button-toggle>
|
||||||
<mat-button-toggle value="right">
|
<mat-button-toggle value="right" aria-label="Text align right">
|
||||||
<mat-icon>format_align_right</mat-icon>
|
<mat-icon>format_align_right</mat-icon>
|
||||||
</mat-button-toggle>
|
</mat-button-toggle>
|
||||||
<mat-button-toggle value="justify" disabled>
|
<mat-button-toggle value="justify" disabled aria-label="Text align justify">
|
||||||
<mat-icon>format_align_justify</mat-icon>
|
<mat-icon>format_align_justify</mat-icon>
|
||||||
</mat-button-toggle>
|
</mat-button-toggle>
|
||||||
</mat-button-toggle-group>
|
</mat-button-toggle-group>
|
||||||
|
|
|
@ -40,20 +40,20 @@
|
||||||
|
|
||||||
<h3>Icon Buttons</h3>
|
<h3>Icon Buttons</h3>
|
||||||
<div class="example-button-row">
|
<div class="example-button-row">
|
||||||
<button mat-icon-button>
|
<button mat-icon-button aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="primary">
|
<button mat-icon-button color="primary" aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="accent">
|
<button mat-icon-button color="accent" aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="warn">
|
<button mat-icon-button color="warn" aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button disabled>
|
<button mat-icon-button disabled aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@
|
||||||
<button mat-fab color="accent">Accent</button>
|
<button mat-fab color="accent">Accent</button>
|
||||||
<button mat-fab color="warn">Warn</button>
|
<button mat-fab color="warn">Warn</button>
|
||||||
<button mat-fab disabled>Disabled</button>
|
<button mat-fab disabled>Disabled</button>
|
||||||
<button mat-fab>
|
<button mat-fab aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<a mat-fab routerLink=".">Link</a>
|
<a mat-fab routerLink=".">Link</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,8 +77,8 @@
|
||||||
<button mat-mini-fab color="accent">Accent</button>
|
<button mat-mini-fab color="accent">Accent</button>
|
||||||
<button mat-mini-fab color="warn">Warn</button>
|
<button mat-mini-fab color="warn">Warn</button>
|
||||||
<button mat-mini-fab disabled>Disabled</button>
|
<button mat-mini-fab disabled>Disabled</button>
|
||||||
<button mat-mini-fab>
|
<button mat-mini-fab aria-label="Example icon-button with a heart icon">
|
||||||
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
|
<mat-icon>favorite</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<a mat-mini-fab routerLink=".">Link</a>
|
<a mat-mini-fab routerLink=".">Link</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<mat-form-field class="example-chip-list">
|
<mat-form-field class="example-chip-list">
|
||||||
<mat-chip-list #chipList>
|
<mat-chip-list #chipList aria-label="Fruit selection">
|
||||||
<mat-chip
|
<mat-chip
|
||||||
*ngFor="let fruit of fruits"
|
*ngFor="let fruit of fruits"
|
||||||
[selectable]="selectable"
|
[selectable]="selectable"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import {COMMA, ENTER} from '@angular/cdk/keycodes';
|
import {COMMA, ENTER} from '@angular/cdk/keycodes';
|
||||||
import {Component, ElementRef, ViewChild} from '@angular/core';
|
import {Component, ElementRef, ViewChild} from '@angular/core';
|
||||||
import {FormControl} from '@angular/forms';
|
import {FormControl} from '@angular/forms';
|
||||||
import {MatAutocompleteSelectedEvent, MatChipInputEvent, MatAutocomplete} from '@angular/material';
|
import {MatAutocompleteSelectedEvent, MatAutocomplete} from '@angular/material/autocomplete';
|
||||||
|
import {MatChipInputEvent} from '@angular/material/chips';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {map, startWith} from 'rxjs/operators';
|
import {map, startWith} from 'rxjs/operators';
|
||||||
|
|
||||||
|
@ -24,8 +25,8 @@ export class ChipsAutocompleteExample {
|
||||||
fruits: string[] = ['Lemon'];
|
fruits: string[] = ['Lemon'];
|
||||||
allFruits: string[] = ['Apple', 'Lemon', 'Lime', 'Orange', 'Strawberry'];
|
allFruits: string[] = ['Apple', 'Lemon', 'Lime', 'Orange', 'Strawberry'];
|
||||||
|
|
||||||
@ViewChild('fruitInput') fruitInput: ElementRef<HTMLInputElement>;
|
@ViewChild('fruitInput', {static: false}) fruitInput: ElementRef<HTMLInputElement>;
|
||||||
@ViewChild('auto') matAutocomplete: MatAutocomplete;
|
@ViewChild('auto', {static: false}) matAutocomplete: MatAutocomplete;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.filteredFruits = this.fruitCtrl.valueChanges.pipe(
|
this.filteredFruits = this.fruitCtrl.valueChanges.pipe(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<mat-form-field class="example-chip-list">
|
<mat-form-field class="example-chip-list">
|
||||||
<mat-chip-list #chipList>
|
<mat-chip-list #chipList aria-label="Fruit selection">
|
||||||
<mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
|
<mat-chip *ngFor="let fruit of fruits" [selectable]="selectable"
|
||||||
[removable]="removable" (removed)="remove(fruit)">
|
[removable]="removable" (removed)="remove(fruit)">
|
||||||
{{fruit.name}}
|
{{fruit.name}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {COMMA, ENTER} from '@angular/cdk/keycodes';
|
import {COMMA, ENTER} from '@angular/cdk/keycodes';
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatChipInputEvent} from '@angular/material';
|
import {MatChipInputEvent} from '@angular/material/chips';
|
||||||
|
|
||||||
export interface Fruit {
|
export interface Fruit {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<mat-chip-list>
|
<mat-chip-list aria-label="Fish selection">
|
||||||
<mat-chip>One fish</mat-chip>
|
<mat-chip>One fish</mat-chip>
|
||||||
<mat-chip>Two fish</mat-chip>
|
<mat-chip>Two fish</mat-chip>
|
||||||
<mat-chip color="primary" selected>Primary fish</mat-chip>
|
<mat-chip color="primary" selected>Primary fish</mat-chip>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<mat-chip-list class="mat-chip-list-stacked">
|
<mat-chip-list class="mat-chip-list-stacked" aria-label="Color selection">
|
||||||
<mat-chip *ngFor="let chip of availableColors" selected [color]="chip.color">
|
<mat-chip *ngFor="let chip of availableColors" selected [color]="chip.color">
|
||||||
{{chip.name}}
|
{{chip.name}}
|
||||||
</mat-chip>
|
</mat-chip>
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -2,11 +2,10 @@ import {
|
||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
Host,
|
|
||||||
Inject,
|
Inject,
|
||||||
OnDestroy
|
OnDestroy
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {MatCalendar} from '@angular/material';
|
import {MatCalendar} from '@angular/material/datepicker';
|
||||||
import {DateAdapter, MAT_DATE_FORMATS, MatDateFormats} from '@angular/material/core';
|
import {DateAdapter, MAT_DATE_FORMATS, MatDateFormats} from '@angular/material/core';
|
||||||
import {Subject} from 'rxjs';
|
import {Subject} from 'rxjs';
|
||||||
import {takeUntil} from 'rxjs/operators';
|
import {takeUntil} from 'rxjs/operators';
|
||||||
|
@ -64,37 +63,36 @@ export class DatepickerCustomHeaderExample {
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class ExampleHeader<D> implements OnDestroy {
|
export class ExampleHeader<D> implements OnDestroy {
|
||||||
private destroyed = new Subject<void>();
|
private _destroyed = new Subject<void>();
|
||||||
|
|
||||||
constructor(@Host() private calendar: MatCalendar<D>,
|
constructor(
|
||||||
private dateAdapter: DateAdapter<D>,
|
private _calendar: MatCalendar<D>, private _dateAdapter: DateAdapter<D>,
|
||||||
@Inject(MAT_DATE_FORMATS) private dateFormats: MatDateFormats,
|
@Inject(MAT_DATE_FORMATS) private _dateFormats: MatDateFormats, cdr: ChangeDetectorRef) {
|
||||||
cdr: ChangeDetectorRef) {
|
_calendar.stateChanges
|
||||||
calendar.stateChanges
|
.pipe(takeUntil(this._destroyed))
|
||||||
.pipe(takeUntil(this.destroyed))
|
|
||||||
.subscribe(() => cdr.markForCheck());
|
.subscribe(() => cdr.markForCheck());
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.destroyed.next();
|
this._destroyed.next();
|
||||||
this.destroyed.complete();
|
this._destroyed.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
get periodLabel() {
|
get periodLabel() {
|
||||||
return this.dateAdapter
|
return this._dateAdapter
|
||||||
.format(this.calendar.activeDate, this.dateFormats.display.monthYearLabel)
|
.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel)
|
||||||
.toLocaleUpperCase();
|
.toLocaleUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
previousClicked(mode: 'month' | 'year') {
|
previousClicked(mode: 'month' | 'year') {
|
||||||
this.calendar.activeDate = mode === 'month' ?
|
this._calendar.activeDate = mode === 'month' ?
|
||||||
this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1) :
|
this._dateAdapter.addCalendarMonths(this._calendar.activeDate, -1) :
|
||||||
this.dateAdapter.addCalendarYears(this.calendar.activeDate, -1);
|
this._dateAdapter.addCalendarYears(this._calendar.activeDate, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
nextClicked(mode: 'month' | 'year') {
|
nextClicked(mode: 'month' | 'year') {
|
||||||
this.calendar.activeDate = mode === 'month' ?
|
this._calendar.activeDate = mode === 'month' ?
|
||||||
this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1) :
|
this._dateAdapter.addCalendarMonths(this._calendar.activeDate, 1) :
|
||||||
this.dateAdapter.addCalendarYears(this.calendar.activeDate, 1);
|
this._dateAdapter.addCalendarYears(this._calendar.activeDate, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class DatepickerLocaleExample {
|
export class DatepickerLocaleExample {
|
||||||
constructor(private adapter: DateAdapter<any>) {}
|
constructor(private _adapter: DateAdapter<any>) {}
|
||||||
|
|
||||||
french() {
|
french() {
|
||||||
this.adapter.setLocale('fr');
|
this._adapter.setLocale('fr');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ export class DatepickerViewsSelectionExample {
|
||||||
this.date.setValue(ctrlValue);
|
this.date.setValue(ctrlValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
chosenMonthHandler(normlizedMonth: Moment, datepicker: MatDatepicker<Moment>) {
|
chosenMonthHandler(normalizedMonth: Moment, datepicker: MatDatepicker<Moment>) {
|
||||||
const ctrlValue = this.date.value;
|
const ctrlValue = this.date.value;
|
||||||
ctrlValue.month(normlizedMonth.month());
|
ctrlValue.month(normalizedMonth.month());
|
||||||
this.date.setValue(ctrlValue);
|
this.date.setValue(ctrlValue);
|
||||||
datepicker.close();
|
datepicker.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatDialog} from '@angular/material';
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Dialog with header, scrollable content and actions
|
* @title Dialog with header, scrollable content and actions
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component, Inject} from '@angular/core';
|
import {Component, Inject} from '@angular/core';
|
||||||
import {MatDialog, MAT_DIALOG_DATA} from '@angular/material';
|
import {MatDialog, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||||
|
|
||||||
export interface DialogData {
|
export interface DialogData {
|
||||||
animal: 'panda' | 'unicorn' | 'lion';
|
animal: 'panda' | 'unicorn' | 'lion';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatDialog} from '@angular/material';
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Dialog elements
|
* @title Dialog elements
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component, Inject} from '@angular/core';
|
import {Component, Inject} from '@angular/core';
|
||||||
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
|
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||||
|
|
||||||
export interface DialogData {
|
export interface DialogData {
|
||||||
animal: string;
|
animal: string;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component, ViewChild} from '@angular/core';
|
import {Component, ViewChild} from '@angular/core';
|
||||||
import {MatAccordion} from '@angular/material';
|
import {MatAccordion} from '@angular/material/expansion';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Accordion with expand/collapse all toggles
|
* @title Accordion with expand/collapse all toggles
|
||||||
|
@ -10,5 +10,5 @@ import {MatAccordion} from '@angular/material';
|
||||||
styleUrls: ['expansion-expand-collapse-all-example.css'],
|
styleUrls: ['expansion-expand-collapse-all-example.css'],
|
||||||
})
|
})
|
||||||
export class ExpansionExpandCollapseAllExample {
|
export class ExpansionExpandCollapseAllExample {
|
||||||
@ViewChild(MatAccordion) accordion: MatAccordion;
|
@ViewChild(MatAccordion, {static: false}) accordion: MatAccordion;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,3 +7,7 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -17,3 +17,7 @@
|
||||||
.example-focus-monitor .cdk-program-focused {
|
.example-focus-monitor .cdk-program-focused {
|
||||||
background: rgba(255, 0, 255, 0.5);
|
background: rgba(255, 0, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ export class FocusMonitorDirectivesExample {
|
||||||
elementOrigin = this.formatOrigin(null);
|
elementOrigin = this.formatOrigin(null);
|
||||||
subtreeOrigin = this.formatOrigin(null);
|
subtreeOrigin = this.formatOrigin(null);
|
||||||
|
|
||||||
constructor(private ngZone: NgZone, private cdr: ChangeDetectorRef) {}
|
constructor(private _ngZone: NgZone, private _cdr: ChangeDetectorRef) {}
|
||||||
|
|
||||||
|
|
||||||
formatOrigin(origin: FocusOrigin): string {
|
formatOrigin(origin: FocusOrigin): string {
|
||||||
|
@ -20,6 +20,6 @@ export class FocusMonitorDirectivesExample {
|
||||||
|
|
||||||
// Workaround for the fact that (cdkFocusChange) emits outside NgZone.
|
// Workaround for the fact that (cdkFocusChange) emits outside NgZone.
|
||||||
markForCheck() {
|
markForCheck() {
|
||||||
this.ngZone.run(() => this.cdr.markForCheck());
|
this._ngZone.run(() => this._cdr.markForCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,3 +21,8 @@
|
||||||
.example-focus-monitor button:focus {
|
.example-focus-monitor button:focus {
|
||||||
box-shadow: 0 0 30px cyan;
|
box-shadow: 0 0 30px cyan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mat-form-field,
|
||||||
|
button {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
|
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
|
||||||
import {
|
import {
|
||||||
|
AfterViewInit,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
NgZone,
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
@ -15,20 +15,20 @@ import {
|
||||||
templateUrl: 'focus-monitor-focus-via-example.html',
|
templateUrl: 'focus-monitor-focus-via-example.html',
|
||||||
styleUrls: ['focus-monitor-focus-via-example.css']
|
styleUrls: ['focus-monitor-focus-via-example.css']
|
||||||
})
|
})
|
||||||
export class FocusMonitorFocusViaExample implements OnDestroy, OnInit {
|
export class FocusMonitorFocusViaExample implements OnDestroy, AfterViewInit {
|
||||||
@ViewChild('monitored') monitoredEl: ElementRef<HTMLElement>;
|
@ViewChild('monitored', {static: false}) monitoredEl: ElementRef<HTMLElement>;
|
||||||
|
|
||||||
origin = this.formatOrigin(null);
|
origin = this.formatOrigin(null);
|
||||||
|
|
||||||
constructor(public focusMonitor: FocusMonitor,
|
constructor(public focusMonitor: FocusMonitor,
|
||||||
private cdr: ChangeDetectorRef,
|
private _cdr: ChangeDetectorRef,
|
||||||
private ngZone: NgZone) {}
|
private _ngZone: NgZone) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngAfterViewInit() {
|
||||||
this.focusMonitor.monitor(this.monitoredEl)
|
this.focusMonitor.monitor(this.monitoredEl)
|
||||||
.subscribe(origin => this.ngZone.run(() => {
|
.subscribe(origin => this._ngZone.run(() => {
|
||||||
this.origin = this.formatOrigin(origin);
|
this.origin = this.formatOrigin(origin);
|
||||||
this.cdr.markForCheck();
|
this._cdr.markForCheck();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,3 +17,7 @@
|
||||||
.example-focus-monitor .cdk-program-focused {
|
.example-focus-monitor .cdk-program-focused {
|
||||||
background: rgba(255, 0, 255, 0.5);
|
background: rgba(255, 0, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
|
import {FocusMonitor, FocusOrigin} from '@angular/cdk/a11y';
|
||||||
import {
|
import {
|
||||||
|
AfterViewInit,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
Component,
|
Component,
|
||||||
ElementRef,
|
ElementRef,
|
||||||
NgZone,
|
NgZone,
|
||||||
OnDestroy,
|
OnDestroy,
|
||||||
OnInit,
|
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
@ -15,33 +15,33 @@ import {
|
||||||
templateUrl: 'focus-monitor-overview-example.html',
|
templateUrl: 'focus-monitor-overview-example.html',
|
||||||
styleUrls: ['focus-monitor-overview-example.css']
|
styleUrls: ['focus-monitor-overview-example.css']
|
||||||
})
|
})
|
||||||
export class FocusMonitorOverviewExample implements OnDestroy, OnInit {
|
export class FocusMonitorOverviewExample implements OnDestroy, AfterViewInit {
|
||||||
@ViewChild('element') element: ElementRef<HTMLElement>;
|
@ViewChild('element', {static: false}) element: ElementRef<HTMLElement>;
|
||||||
@ViewChild('subtree') subtree: ElementRef<HTMLElement>;
|
@ViewChild('subtree', {static: false}) subtree: ElementRef<HTMLElement>;
|
||||||
|
|
||||||
elementOrigin = this.formatOrigin(null);
|
elementOrigin = this.formatOrigin(null);
|
||||||
subtreeOrigin = this.formatOrigin(null);
|
subtreeOrigin = this.formatOrigin(null);
|
||||||
|
|
||||||
constructor(private focusMonitor: FocusMonitor,
|
constructor(private _focusMonitor: FocusMonitor,
|
||||||
private cdr: ChangeDetectorRef,
|
private _cdr: ChangeDetectorRef,
|
||||||
private ngZone: NgZone) {}
|
private _ngZone: NgZone) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngAfterViewInit() {
|
||||||
this.focusMonitor.monitor(this.element)
|
this._focusMonitor.monitor(this.element)
|
||||||
.subscribe(origin => this.ngZone.run(() => {
|
.subscribe(origin => this._ngZone.run(() => {
|
||||||
this.elementOrigin = this.formatOrigin(origin);
|
this.elementOrigin = this.formatOrigin(origin);
|
||||||
this.cdr.markForCheck();
|
this._cdr.markForCheck();
|
||||||
}));
|
}));
|
||||||
this.focusMonitor.monitor(this.subtree, true)
|
this._focusMonitor.monitor(this.subtree, true)
|
||||||
.subscribe(origin => this.ngZone.run(() => {
|
.subscribe(origin => this._ngZone.run(() => {
|
||||||
this.subtreeOrigin = this.formatOrigin(origin);
|
this.subtreeOrigin = this.formatOrigin(origin);
|
||||||
this.cdr.markForCheck();
|
this._cdr.markForCheck();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.focusMonitor.stopMonitoring(this.element);
|
this._focusMonitor.stopMonitoring(this.element);
|
||||||
this.focusMonitor.stopMonitoring(this.subtree);
|
this._focusMonitor.stopMonitoring(this.subtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
formatOrigin(origin: FocusOrigin): string {
|
formatOrigin(origin: FocusOrigin): string {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div [formGroup]="parts" class="example-tel-input-container">
|
<div [formGroup]="parts" class="example-tel-input-container">
|
||||||
<input class="example-tel-input-element" formControlName="area" size="3">
|
<input class="example-tel-input-element" formControlName="area" size="3" aria-label="Area code" (input)="_handleInput()">
|
||||||
<span class="example-tel-input-spacer">–</span>
|
<span class="example-tel-input-spacer">–</span>
|
||||||
<input class="example-tel-input-element" formControlName="exchange" size="3">
|
<input class="example-tel-input-element" formControlName="exchange" size="3" aria-label="Exchange code" (input)="_handleInput()">
|
||||||
<span class="example-tel-input-spacer">–</span>
|
<span class="example-tel-input-spacer">–</span>
|
||||||
<input class="example-tel-input-element" formControlName="subscriber" size="4">
|
<input class="example-tel-input-element" formControlName="subscriber" size="4" aria-label="Subscriber number" (input)="_handleInput()">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {FocusMonitor} from '@angular/cdk/a11y';
|
import {FocusMonitor} from '@angular/cdk/a11y';
|
||||||
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
||||||
import {Component, ElementRef, Input, OnDestroy} from '@angular/core';
|
import {Component, ElementRef, Input, OnDestroy, Optional, Self} from '@angular/core';
|
||||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
import {FormBuilder, FormGroup, ControlValueAccessor, NgControl} from '@angular/forms';
|
||||||
import {MatFormFieldControl} from '@angular/material';
|
import {MatFormFieldControl} from '@angular/material/form-field';
|
||||||
import {Subject} from 'rxjs';
|
import {Subject} from 'rxjs';
|
||||||
|
|
||||||
/** @title Form field with custom telephone number input control. */
|
/** @title Form field with custom telephone number input control. */
|
||||||
|
@ -30,17 +30,18 @@ export class MyTel {
|
||||||
'[attr.aria-describedby]': 'describedBy',
|
'[attr.aria-describedby]': 'describedBy',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export class MyTelInput implements MatFormFieldControl<MyTel>, OnDestroy {
|
export class MyTelInput implements ControlValueAccessor, MatFormFieldControl<MyTel>, OnDestroy {
|
||||||
static nextId = 0;
|
static nextId = 0;
|
||||||
|
|
||||||
parts: FormGroup;
|
parts: FormGroup;
|
||||||
stateChanges = new Subject<void>();
|
stateChanges = new Subject<void>();
|
||||||
focused = false;
|
focused = false;
|
||||||
ngControl = null;
|
|
||||||
errorState = false;
|
errorState = false;
|
||||||
controlType = 'example-tel-input';
|
controlType = 'example-tel-input';
|
||||||
id = `example-tel-input-${MyTelInput.nextId++}`;
|
id = `example-tel-input-${MyTelInput.nextId++}`;
|
||||||
describedBy = '';
|
describedBy = '';
|
||||||
|
onChange = (_: any) => {};
|
||||||
|
onTouched = () => {};
|
||||||
|
|
||||||
get empty() {
|
get empty() {
|
||||||
const {value: {area, exchange, subscriber}} = this.parts;
|
const {value: {area, exchange, subscriber}} = this.parts;
|
||||||
|
@ -70,6 +71,7 @@ export class MyTelInput implements MatFormFieldControl<MyTel>, OnDestroy {
|
||||||
get disabled(): boolean { return this._disabled; }
|
get disabled(): boolean { return this._disabled; }
|
||||||
set disabled(value: boolean) {
|
set disabled(value: boolean) {
|
||||||
this._disabled = coerceBooleanProperty(value);
|
this._disabled = coerceBooleanProperty(value);
|
||||||
|
this._disabled ? this.parts.disable() : this.parts.enable();
|
||||||
this.stateChanges.next();
|
this.stateChanges.next();
|
||||||
}
|
}
|
||||||
private _disabled = false;
|
private _disabled = false;
|
||||||
|
@ -88,22 +90,34 @@ export class MyTelInput implements MatFormFieldControl<MyTel>, OnDestroy {
|
||||||
this.stateChanges.next();
|
this.stateChanges.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(fb: FormBuilder, private fm: FocusMonitor, private elRef: ElementRef<HTMLElement>) {
|
constructor(
|
||||||
this.parts = fb.group({
|
formBuilder: FormBuilder,
|
||||||
|
private _focusMonitor: FocusMonitor,
|
||||||
|
private _elementRef: ElementRef<HTMLElement>,
|
||||||
|
@Optional() @Self() public ngControl: NgControl) {
|
||||||
|
|
||||||
|
this.parts = formBuilder.group({
|
||||||
area: '',
|
area: '',
|
||||||
exchange: '',
|
exchange: '',
|
||||||
subscriber: '',
|
subscriber: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
fm.monitor(elRef, true).subscribe(origin => {
|
_focusMonitor.monitor(_elementRef, true).subscribe(origin => {
|
||||||
|
if (this.focused && !origin) {
|
||||||
|
this.onTouched();
|
||||||
|
}
|
||||||
this.focused = !!origin;
|
this.focused = !!origin;
|
||||||
this.stateChanges.next();
|
this.stateChanges.next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.ngControl != null) {
|
||||||
|
this.ngControl.valueAccessor = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.stateChanges.complete();
|
this.stateChanges.complete();
|
||||||
this.fm.stopMonitoring(this.elRef);
|
this._focusMonitor.stopMonitoring(this._elementRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
setDescribedByIds(ids: string[]) {
|
setDescribedByIds(ids: string[]) {
|
||||||
|
@ -112,7 +126,27 @@ export class MyTelInput implements MatFormFieldControl<MyTel>, OnDestroy {
|
||||||
|
|
||||||
onContainerClick(event: MouseEvent) {
|
onContainerClick(event: MouseEvent) {
|
||||||
if ((event.target as Element).tagName.toLowerCase() != 'input') {
|
if ((event.target as Element).tagName.toLowerCase() != 'input') {
|
||||||
this.elRef.nativeElement.querySelector('input')!.focus();
|
this._elementRef.nativeElement.querySelector('input')!.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeValue(tel: MyTel | null): void {
|
||||||
|
this.value = tel;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerOnChange(fn: any): void {
|
||||||
|
this.onChange = fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerOnTouched(fn: any): void {
|
||||||
|
this.onTouched = fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDisabledState(isDisabled: boolean): void {
|
||||||
|
this.disabled = isDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleInput(): void {
|
||||||
|
this.onChange(this.parts.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,5 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-container .mat-radio-button {
|
.example-container .mat-radio-button {
|
||||||
margin: 0 5px;
|
margin: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<div class="example-container">
|
<div class="example-container">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="Enter your password" [type]="hide ? 'password' : 'text'">
|
<input matInput placeholder="Enter your password" [type]="hide ? 'password' : 'text'">
|
||||||
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
|
<button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
|
||||||
|
<mat-icon>{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
|
||||||
|
</button>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<mat-icon>home</mat-icon>
|
<mat-icon aria-hidden="false" aria-label="Example home icon">home</mat-icon>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<mat-icon svgIcon="thumbs-up"></mat-icon>
|
<mat-icon svgIcon="thumbs-up" aria-hidden="false" aria-label="Example thumbs up SVG icon"></mat-icon>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {DomSanitizer} from '@angular/platform-browser';
|
import {DomSanitizer} from '@angular/platform-browser';
|
||||||
import {MatIconRegistry} from '@angular/material';
|
import {MatIconRegistry} from '@angular/material/icon';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title SVG icons
|
* @title SVG icons
|
||||||
|
|
|
@ -7,3 +7,7 @@
|
||||||
.example-full-width {
|
.example-full-width {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<button mat-icon-button [matMenuTriggerFor]="menu">
|
<button mat-icon-button [matMenuTriggerFor]="menu" aria-label="Example icon-button with a menu">
|
||||||
<mat-icon>more_vert</mat-icon>
|
<mat-icon>more_vert</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<mat-menu #menu="matMenu">
|
<mat-menu #menu="matMenu">
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item disabled>
|
<button mat-menu-item disabled>
|
||||||
<mat-icon>voicemail</mat-icon>
|
<mat-icon>voicemail</mat-icon>
|
||||||
<span>Check voicemail</span>
|
<span>Check voice mail</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item>
|
<button mat-menu-item>
|
||||||
<mat-icon>notifications_off</mat-icon>
|
<mat-icon>notifications_off</mat-icon>
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {PageEvent} from '@angular/material';
|
import {PageEvent} from '@angular/material/paginator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Configurable paginator
|
* @title Configurable paginator
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
.example-radio-group {
|
.example-radio-group {
|
||||||
display: inline-flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
margin: 15px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-radio-button {
|
.example-radio-button {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-selected-value {
|
|
||||||
margin: 15px 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<mat-radio-group class="example-radio-group" [(ngModel)]="favoriteSeason">
|
<label id="example-radio-group-label">Pick your favorite season</label>
|
||||||
|
<mat-radio-group
|
||||||
|
aria-labelledby="example-radio-group-label"
|
||||||
|
class="example-radio-group"
|
||||||
|
[(ngModel)]="favoriteSeason">
|
||||||
<mat-radio-button class="example-radio-button" *ngFor="let season of seasons" [value]="season">
|
<mat-radio-button class="example-radio-button" *ngFor="let season of seasons" [value]="season">
|
||||||
{{season}}
|
{{season}}
|
||||||
</mat-radio-button>
|
</mat-radio-button>
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
<div class="example-selected-value">Your favorite season is: {{favoriteSeason}}</div>
|
<div>Your favorite season is: {{favoriteSeason}}</div>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
.mat-radio-button ~ .mat-radio-button {
|
.mat-radio-button ~ .mat-radio-button {
|
||||||
padding-right: 16px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<mat-radio-group>
|
<mat-radio-group aria-label="Select an option">
|
||||||
<mat-radio-button value="1">Option 1</mat-radio-button>
|
<mat-radio-button value="1">Option 1</mat-radio-button>
|
||||||
<mat-radio-button value="2">Option 2</mat-radio-button>
|
<mat-radio-button value="2">Option 2</mat-radio-button>
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
<h4>mat-select</h4>
|
<h4>mat-select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Choose an option" [disabled]="disableSelect.value">
|
<mat-label>Choose an option</mat-label>
|
||||||
|
<mat-select [disabled]="disableSelect.value">
|
||||||
<mat-option value="option1">Option 1</mat-option>
|
<mat-option value="option1">Option 1</mat-option>
|
||||||
<mat-option value="option2" disabled>Option 2 (disabled)</mat-option>
|
<mat-option value="option2" disabled>Option 2 (disabled)</mat-option>
|
||||||
<mat-option value="option3">Option 3</mat-option>
|
<mat-option value="option3">Option 3</mat-option>
|
||||||
|
@ -13,8 +14,9 @@
|
||||||
|
|
||||||
<h4>native html select</h4>
|
<h4>native html select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<select matNativeControl placeholder="Choose an option" [disabled]="disableSelect.value">
|
<mat-label>Choose an option</mat-label>
|
||||||
<option value="" disabled selected></option>
|
<select matNativeControl [disabled]="disableSelect.value">
|
||||||
|
<option value="" selected></option>
|
||||||
<option value="volvo">Volvo</option>
|
<option value="volvo">Volvo</option>
|
||||||
<option value="saab" disabled>Saab</option>
|
<option value="saab" disabled>Saab</option>
|
||||||
<option value="mercedes">Mercedes</option>
|
<option value="mercedes">Mercedes</option>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<h4>mat-select</h4>
|
<h4>mat-select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Choose one" [formControl]="selected" [errorStateMatcher]="matcher">
|
<mat-label>Choose one</mat-label>
|
||||||
|
<mat-select [formControl]="selected" [errorStateMatcher]="matcher">
|
||||||
<mat-option>Clear</mat-option>
|
<mat-option>Clear</mat-option>
|
||||||
<mat-option value="valid">Valid option</mat-option>
|
<mat-option value="valid">Valid option</mat-option>
|
||||||
<mat-option value="invalid">Invalid option</mat-option>
|
<mat-option value="invalid">Invalid option</mat-option>
|
||||||
|
@ -14,7 +15,8 @@
|
||||||
|
|
||||||
<h4>native html select</h4>
|
<h4>native html select</h4>
|
||||||
<mat-form-field class="demo-full-width">
|
<mat-form-field class="demo-full-width">
|
||||||
<select matNativeControl placeholder="Choose one" [formControl]="nativeSelectFormControl" [errorStateMatcher]="matcher">
|
<mat-label>Choose one</mat-label>
|
||||||
|
<select matNativeControl [formControl]="nativeSelectFormControl" [errorStateMatcher]="matcher">
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
<option value="valid" selected>Valid option</option>
|
<option value="valid" selected>Valid option</option>
|
||||||
<option value="invalid">Invalid option</option>
|
<option value="invalid">Invalid option</option>
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<form>
|
<form>
|
||||||
<h4>mat-select</h4>
|
<h4>mat-select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Favorite food" [(ngModel)]="selectedValue" name="food">
|
<mat-label>Favorite food</mat-label>
|
||||||
|
<mat-select [(ngModel)]="selectedValue" name="food">
|
||||||
<mat-option *ngFor="let food of foods" [value]="food.value">
|
<mat-option *ngFor="let food of foods" [value]="food.value">
|
||||||
{{food.viewValue}}
|
{{food.viewValue}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
@ -10,8 +11,9 @@
|
||||||
<p> Selected food: {{selectedValue}} </p>
|
<p> Selected food: {{selectedValue}} </p>
|
||||||
<h4>native html select</h4>
|
<h4>native html select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<select matNativeControl placeholder="Favorite car" [(ngModel)]="selectedCar" name="car">
|
<mat-label>Favorite car</mat-label>
|
||||||
<option value="" disabled selected></option>
|
<select matNativeControl [(ngModel)]="selectedCar" name="car">
|
||||||
|
<option value="" selected></option>
|
||||||
<option *ngFor="let car of cars" [value]="car.value">
|
<option *ngFor="let car of cars" [value]="car.value">
|
||||||
{{car.viewValue}}
|
{{car.viewValue}}
|
||||||
</option>
|
</option>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<h4>mat select</h4>
|
<h4>mat select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Favorite animal" [formControl]="animalControl" required>
|
<mat-label>Favorite animal</mat-label>
|
||||||
|
<mat-select [formControl]="animalControl" required>
|
||||||
<mat-option>--</mat-option>
|
<mat-option>--</mat-option>
|
||||||
<mat-option *ngFor="let animal of animals" [value]="animal">
|
<mat-option *ngFor="let animal of animals" [value]="animal">
|
||||||
{{animal.name}}
|
{{animal.name}}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Toppings" [formControl]="toppings" multiple>
|
<mat-label>Toppings</mat-label>
|
||||||
|
<mat-select [formControl]="toppings" multiple>
|
||||||
<mat-option *ngFor="let topping of toppingList" [value]="topping">{{topping}}</mat-option>
|
<mat-option *ngFor="let topping of toppingList" [value]="topping">{{topping}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Select an option" disableRipple>
|
<mat-label>Select an option</mat-label>
|
||||||
|
<mat-select disableRipple>
|
||||||
<mat-option value="1">Option 1</mat-option>
|
<mat-option value="1">Option 1</mat-option>
|
||||||
<mat-option value="2">Option 2</mat-option>
|
<mat-option value="2">Option 2</mat-option>
|
||||||
<mat-option value="3">Option 3</mat-option>
|
<mat-option value="3">Option 3</mat-option>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<h4>mat-select</h4>
|
<h4>mat-select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Pokemon" [formControl]="pokemonControl">
|
<mat-label>Pokemon</mat-label>
|
||||||
|
<mat-select [formControl]="pokemonControl">
|
||||||
<mat-option>-- None --</mat-option>
|
<mat-option>-- None --</mat-option>
|
||||||
<mat-optgroup *ngFor="let group of pokemonGroups" [label]="group.name"
|
<mat-optgroup *ngFor="let group of pokemonGroups" [label]="group.name"
|
||||||
[disabled]="group.disabled">
|
[disabled]="group.disabled">
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
|
|
||||||
<h4>native html select</h4>
|
<h4>native html select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
<mat-label>Cars</mat-label>
|
||||||
<select matNativeControl>
|
<select matNativeControl>
|
||||||
<optgroup label="Swedish Cars">
|
<optgroup label="Swedish Cars">
|
||||||
<option value="volvo">volvo</option>
|
<option value="volvo">volvo</option>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<h4>Basic mat-select</h4>
|
<h4>Basic mat-select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Favorite food">
|
<mat-label>Favorite food</mat-label>
|
||||||
|
<mat-select>
|
||||||
<mat-option *ngFor="let food of foods" [value]="food.value">
|
<mat-option *ngFor="let food of foods" [value]="food.value">
|
||||||
{{food.viewValue}}
|
{{food.viewValue}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
|
|
||||||
<h4>Basic native select</h4>
|
<h4>Basic native select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
<mat-label>Cars</mat-label>
|
||||||
<select matNativeControl required>
|
<select matNativeControl required>
|
||||||
<option value="volvo">Volvo</option>
|
<option value="volvo">Volvo</option>
|
||||||
<option value="saab">Saab</option>
|
<option value="saab">Saab</option>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
.example-panel-red .mat-select-panel {
|
.example-panel-red.mat-select-panel {
|
||||||
background: rgba(255, 0, 0, 0.5);
|
background: rgba(255, 0, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-panel-green .mat-select-panel {
|
.example-panel-green.mat-select-panel {
|
||||||
background: rgba(0, 255, 0, 0.5);
|
background: rgba(0, 255, 0, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-panel-blue .mat-select-panel {
|
.example-panel-blue.mat-select-panel {
|
||||||
background: rgba(0, 0, 255, 0.5);
|
background: rgba(0, 0, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Panel color" [formControl]="panelColor"
|
<mat-label>Panel color</mat-label>
|
||||||
|
<mat-select [formControl]="panelColor"
|
||||||
panelClass="example-panel-{{panelColor.value}}">
|
panelClass="example-panel-{{panelColor.value}}">
|
||||||
<mat-option value="red">Red</mat-option>
|
<mat-option value="red">Red</mat-option>
|
||||||
<mat-option value="green">Green</mat-option>
|
<mat-option value="green">Green</mat-option>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<h4>mat-select</h4>
|
<h4>mat-select</h4>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="State">
|
<mat-label>State</mat-label>
|
||||||
|
<mat-select>
|
||||||
<mat-option>None</mat-option>
|
<mat-option>None</mat-option>
|
||||||
<mat-option *ngFor="let state of states" [value]="state">{{state}}</mat-option>
|
<mat-option *ngFor="let state of states" [value]="state">{{state}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
<mat-label>Select an option</mat-label>
|
||||||
<mat-select [(value)]="selected">
|
<mat-select [(value)]="selected">
|
||||||
<mat-option>None</mat-option>
|
<mat-option>None</mat-option>
|
||||||
<mat-option value="option1">Option 1</mat-option>
|
<mat-option value="option1">Option 1</mat-option>
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
.example-container {
|
.example-container {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
margin: 10px;
|
margin: 12px;
|
||||||
border: 1px solid #555;
|
border: 1px solid #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mat-drawer-content {
|
||||||
|
padding: 12px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {MatSidenav} from '@angular/material/sidenav';
|
||||||
styleUrls: ['sidenav-disable-close-example.css'],
|
styleUrls: ['sidenav-disable-close-example.css'],
|
||||||
})
|
})
|
||||||
export class SidenavDisableCloseExample {
|
export class SidenavDisableCloseExample {
|
||||||
@ViewChild('sidenav') sidenav: MatSidenav;
|
@ViewChild('sidenav', {static: false}) sidenav: MatSidenav;
|
||||||
|
|
||||||
reason = '';
|
reason = '';
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/** No CSS for this example */
|
|
@ -1,3 +1,8 @@
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Snack bar duration (seconds)</mat-label>
|
||||||
|
<input type="number" [(ngModel)]="durationInSeconds" matInput>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
<button mat-button (click)="openSnackBar()" aria-label="Show an example snack-bar">
|
<button mat-button (click)="openSnackBar()" aria-label="Show an example snack-bar">
|
||||||
Pizza party
|
Pizza party
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatSnackBar} from '@angular/material';
|
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Snack-bar with a custom component
|
* @title Snack-bar with a custom component
|
||||||
|
@ -7,13 +7,16 @@ import {MatSnackBar} from '@angular/material';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'snack-bar-component-example',
|
selector: 'snack-bar-component-example',
|
||||||
templateUrl: 'snack-bar-component-example.html',
|
templateUrl: 'snack-bar-component-example.html',
|
||||||
|
styleUrls: ['snack-bar-component-example.css'],
|
||||||
})
|
})
|
||||||
export class SnackBarComponentExample {
|
export class SnackBarComponentExample {
|
||||||
constructor(public snackBar: MatSnackBar) {}
|
durationInSeconds = 5;
|
||||||
|
|
||||||
|
constructor(private _snackBar: MatSnackBar) {}
|
||||||
|
|
||||||
openSnackBar() {
|
openSnackBar() {
|
||||||
this.snackBar.openFromComponent(PizzaPartyComponent, {
|
this._snackBar.openFromComponent(PizzaPartyComponent, {
|
||||||
duration: 500,
|
duration: this.durationInSeconds * 1000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatSnackBar} from '@angular/material';
|
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Basic snack-bar
|
* @title Basic snack-bar
|
||||||
|
@ -10,10 +10,10 @@ import {MatSnackBar} from '@angular/material';
|
||||||
styleUrls: ['snack-bar-overview-example.css'],
|
styleUrls: ['snack-bar-overview-example.css'],
|
||||||
})
|
})
|
||||||
export class SnackBarOverviewExample {
|
export class SnackBarOverviewExample {
|
||||||
constructor(public snackBar: MatSnackBar) {}
|
constructor(private _snackBar: MatSnackBar) {}
|
||||||
|
|
||||||
openSnackBar(message: string, action: string) {
|
openSnackBar(message: string, action: string) {
|
||||||
this.snackBar.open(message, action, {
|
this._snackBar.open(message, action, {
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ import {
|
||||||
MatSnackBar,
|
MatSnackBar,
|
||||||
MatSnackBarHorizontalPosition,
|
MatSnackBarHorizontalPosition,
|
||||||
MatSnackBarVerticalPosition,
|
MatSnackBarVerticalPosition,
|
||||||
} from '@angular/material';
|
} from '@angular/material/snack-bar';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Snack-bar with configurable position
|
* @title Snack-bar with configurable position
|
||||||
|
@ -11,16 +11,17 @@ import {
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'snack-bar-position-example',
|
selector: 'snack-bar-position-example',
|
||||||
templateUrl: 'snack-bar-position-example.html',
|
templateUrl: 'snack-bar-position-example.html',
|
||||||
|
styleUrls: ['snack-bar-position-example.css'],
|
||||||
})
|
})
|
||||||
export class SnackBarPositionExample {
|
export class SnackBarPositionExample {
|
||||||
|
|
||||||
horizontalPosition: MatSnackBarHorizontalPosition = 'start';
|
horizontalPosition: MatSnackBarHorizontalPosition = 'start';
|
||||||
verticalPosition: MatSnackBarVerticalPosition = 'bottom';
|
verticalPosition: MatSnackBarVerticalPosition = 'bottom';
|
||||||
|
|
||||||
constructor(public snackBar: MatSnackBar) {}
|
constructor(private _snackBar: MatSnackBar) {}
|
||||||
|
|
||||||
openSnackBar() {
|
openSnackBar() {
|
||||||
this.snackBar.open('Canonball!!', 'End now', {
|
this._snackBar.open('Canonball!!', 'End now', {
|
||||||
duration: 500,
|
duration: 500,
|
||||||
horizontalPosition: this.horizontalPosition,
|
horizontalPosition: this.horizontalPosition,
|
||||||
verticalPosition: this.verticalPosition,
|
verticalPosition: this.verticalPosition,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {Sort} from '@angular/material';
|
import {Sort} from '@angular/material/sort';
|
||||||
|
|
||||||
export interface Dessert {
|
export interface Dessert {
|
||||||
calories: number;
|
calories: number;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||||
import {MAT_STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
|
import {STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Stepper that displays errors in the steps
|
* @title Stepper that displays errors in the steps
|
||||||
|
@ -10,7 +10,7 @@ import {MAT_STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
|
||||||
templateUrl: 'stepper-errors-example.html',
|
templateUrl: 'stepper-errors-example.html',
|
||||||
styleUrls: ['stepper-errors-example.css'],
|
styleUrls: ['stepper-errors-example.css'],
|
||||||
providers: [{
|
providers: [{
|
||||||
provide: MAT_STEPPER_GLOBAL_OPTIONS, useValue: {showError: true}
|
provide: STEPPER_GLOBAL_OPTIONS, useValue: {showError: true}
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
export class StepperErrorsExample implements OnInit {
|
export class StepperErrorsExample implements OnInit {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||||
import {MAT_STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
|
import {STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Stepper with customized states
|
* @title Stepper with customized states
|
||||||
|
@ -10,7 +10,7 @@ import {MAT_STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper';
|
||||||
templateUrl: 'stepper-states-example.html',
|
templateUrl: 'stepper-states-example.html',
|
||||||
styleUrls: ['stepper-states-example.css'],
|
styleUrls: ['stepper-states-example.css'],
|
||||||
providers: [{
|
providers: [{
|
||||||
provide: MAT_STEPPER_GLOBAL_OPTIONS, useValue: {displayDefaultIndicatorType: false}
|
provide: STEPPER_GLOBAL_OPTIONS, useValue: {displayDefaultIndicatorType: false}
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
export class StepperStatesExample implements OnInit {
|
export class StepperStatesExample implements OnInit {
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class TabGroupAsyncExample {
|
||||||
asyncTabs: Observable<ExampleTab[]>;
|
asyncTabs: Observable<ExampleTab[]>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.asyncTabs = Observable.create((observer: Observer<ExampleTab[]>) => {
|
this.asyncTabs = new Observable((observer: Observer<ExampleTab[]>) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
observer.next([
|
observer.next([
|
||||||
{label: 'First', content: 'Content 1'},
|
{label: 'First', content: 'Content 1'},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Tag group with dynamic height based on tab contents
|
* @title Tab group with dynamic height based on tab contents
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tab-group-dynamic-height-example',
|
selector: 'tab-group-dynamic-height-example',
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<tr mat-row *matRowDef="let element; columns: columnsToDisplay;"
|
<tr mat-row *matRowDef="let element; columns: columnsToDisplay;"
|
||||||
class="example-element-row"
|
class="example-element-row"
|
||||||
[class.example-expanded-row]="expandedElement === element"
|
[class.example-expanded-row]="expandedElement === element"
|
||||||
(click)="expandedElement = element">
|
(click)="expandedElement = expandedElement === element ? null : element">
|
||||||
</tr>
|
</tr>
|
||||||
<tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>
|
<tr mat-row *matRowDef="let row; columns: ['expandedDetail']" class="example-detail-row"></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations';
|
||||||
templateUrl: 'table-expandable-rows-example.html',
|
templateUrl: 'table-expandable-rows-example.html',
|
||||||
animations: [
|
animations: [
|
||||||
trigger('detailExpand', [
|
trigger('detailExpand', [
|
||||||
state('collapsed', style({height: '0px', minHeight: '0', display: 'none'})),
|
state('collapsed', style({height: '0px', minHeight: '0'})),
|
||||||
state('expanded', style({height: '*'})),
|
state('expanded', style({height: '*'})),
|
||||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
||||||
]),
|
]),
|
||||||
|
@ -19,7 +19,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations';
|
||||||
export class TableExpandableRowsExample {
|
export class TableExpandableRowsExample {
|
||||||
dataSource = ELEMENT_DATA;
|
dataSource = ELEMENT_DATA;
|
||||||
columnsToDisplay = ['name', 'weight', 'symbol', 'position'];
|
columnsToDisplay = ['name', 'weight', 'symbol', 'position'];
|
||||||
expandedElement: PeriodicElement;
|
expandedElement: PeriodicElement | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatTableDataSource} from '@angular/material';
|
import {MatTableDataSource} from '@angular/material/table';
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Structure */
|
/* Structure */
|
||||||
.example-container {
|
.example-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
min-height: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-table-container {
|
.example-table-container {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="example-table-container">
|
<div class="example-table-container">
|
||||||
|
|
||||||
<table mat-table [dataSource]="data" class="example-table"
|
<table mat-table [dataSource]="data" class="example-table"
|
||||||
matSort matSortActive="created" matSortDisableClear matSortDirection="asc">
|
matSort matSortActive="created" matSortDisableClear matSortDirection="desc">
|
||||||
<!-- Number Column -->
|
<!-- Number Column -->
|
||||||
<ng-container matColumnDef="number">
|
<ng-container matColumnDef="number">
|
||||||
<th mat-header-cell *matHeaderCellDef>#</th>
|
<th mat-header-cell *matHeaderCellDef>#</th>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {HttpClient} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, ViewChild, AfterViewInit} from '@angular/core';
|
||||||
import {MatPaginator, MatSort} from '@angular/material';
|
import {MatPaginator} from '@angular/material/paginator';
|
||||||
|
import {MatSort} from '@angular/material/sort';
|
||||||
import {merge, Observable, of as observableOf} from 'rxjs';
|
import {merge, Observable, of as observableOf} from 'rxjs';
|
||||||
import {catchError, map, startWith, switchMap} from 'rxjs/operators';
|
import {catchError, map, startWith, switchMap} from 'rxjs/operators';
|
||||||
|
|
||||||
|
@ -12,22 +13,22 @@ import {catchError, map, startWith, switchMap} from 'rxjs/operators';
|
||||||
styleUrls: ['table-http-example.css'],
|
styleUrls: ['table-http-example.css'],
|
||||||
templateUrl: 'table-http-example.html',
|
templateUrl: 'table-http-example.html',
|
||||||
})
|
})
|
||||||
export class TableHttpExample implements OnInit {
|
export class TableHttpExample implements AfterViewInit {
|
||||||
displayedColumns: string[] = ['created', 'state', 'number', 'title'];
|
displayedColumns: string[] = ['created', 'state', 'number', 'title'];
|
||||||
exampleDatabase: ExampleHttpDao | null;
|
exampleDatabase: ExampleHttpDatabase | null;
|
||||||
data: GithubIssue[] = [];
|
data: GithubIssue[] = [];
|
||||||
|
|
||||||
resultsLength = 0;
|
resultsLength = 0;
|
||||||
isLoadingResults = true;
|
isLoadingResults = true;
|
||||||
isRateLimitReached = false;
|
isRateLimitReached = false;
|
||||||
|
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort, {static: false}) sort: MatSort;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private _httpClient: HttpClient) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngAfterViewInit() {
|
||||||
this.exampleDatabase = new ExampleHttpDao(this.http);
|
this.exampleDatabase = new ExampleHttpDatabase(this._httpClient);
|
||||||
|
|
||||||
// If the user changes the sort order, reset back to the first page.
|
// If the user changes the sort order, reset back to the first page.
|
||||||
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
||||||
|
@ -71,14 +72,14 @@ export interface GithubIssue {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** An example database that the data source uses to retrieve data for the table. */
|
/** An example database that the data source uses to retrieve data for the table. */
|
||||||
export class ExampleHttpDao {
|
export class ExampleHttpDatabase {
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private _httpClient: HttpClient) {}
|
||||||
|
|
||||||
getRepoIssues(sort: string, order: string, page: number): Observable<GithubApi> {
|
getRepoIssues(sort: string, order: string, page: number): Observable<GithubApi> {
|
||||||
const href = 'https://api.github.com/search/issues';
|
const href = 'https://api.github.com/search/issues';
|
||||||
const requestUrl =
|
const requestUrl =
|
||||||
`${href}?q=repo:angular/material2&sort=${sort}&order=${order}&page=${page + 1}`;
|
`${href}?q=repo:angular/components&sort=${sort}&order=${order}&page=${page + 1}`;
|
||||||
|
|
||||||
return this.http.get<GithubApi>(requestUrl);
|
return this._httpClient.get<GithubApi>(requestUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {MatPaginator, MatSort, MatTableDataSource} from '@angular/material';
|
import {MatPaginator} from '@angular/material/paginator';
|
||||||
|
import {MatSort} from '@angular/material/sort';
|
||||||
|
import {MatTableDataSource} from '@angular/material/table';
|
||||||
|
|
||||||
export interface UserData {
|
export interface UserData {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -9,11 +11,14 @@ export interface UserData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Constants used to fill up our data base. */
|
/** Constants used to fill up our data base. */
|
||||||
const COLORS: string[] = ['maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple',
|
const COLORS: string[] = [
|
||||||
'fuchsia', 'lime', 'teal', 'aqua', 'blue', 'navy', 'black', 'gray'];
|
'maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple', 'fuchsia', 'lime', 'teal',
|
||||||
const NAMES: string[] = ['Maia', 'Asher', 'Olivia', 'Atticus', 'Amelia', 'Jack',
|
'aqua', 'blue', 'navy', 'black', 'gray'
|
||||||
'Charlotte', 'Theodore', 'Isla', 'Oliver', 'Isabella', 'Jasper',
|
];
|
||||||
'Cora', 'Levi', 'Violet', 'Arthur', 'Mia', 'Thomas', 'Elizabeth'];
|
const NAMES: string[] = [
|
||||||
|
'Maia', 'Asher', 'Olivia', 'Atticus', 'Amelia', 'Jack', 'Charlotte', 'Theodore', 'Isla', 'Oliver',
|
||||||
|
'Isabella', 'Jasper', 'Cora', 'Levi', 'Violet', 'Arthur', 'Mia', 'Thomas', 'Elizabeth'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Data table with sorting, pagination, and filtering.
|
* @title Data table with sorting, pagination, and filtering.
|
||||||
|
@ -27,8 +32,8 @@ export class TableOverviewExample implements OnInit {
|
||||||
displayedColumns: string[] = ['id', 'name', 'progress', 'color'];
|
displayedColumns: string[] = ['id', 'name', 'progress', 'color'];
|
||||||
dataSource: MatTableDataSource<UserData>;
|
dataSource: MatTableDataSource<UserData>;
|
||||||
|
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort, {static: true}) sort: MatSort;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// Create 100 users
|
// Create 100 users
|
||||||
|
@ -54,8 +59,7 @@ export class TableOverviewExample implements OnInit {
|
||||||
|
|
||||||
/** Builds and returns a new User. */
|
/** Builds and returns a new User. */
|
||||||
function createNewUser(id: number): UserData {
|
function createNewUser(id: number): UserData {
|
||||||
const name =
|
const name = NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' +
|
||||||
NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' +
|
|
||||||
NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.';
|
NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {MatPaginator, MatTableDataSource} from '@angular/material';
|
import {MatPaginator} from '@angular/material/paginator';
|
||||||
|
import {MatTableDataSource} from '@angular/material/table';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Table with pagination
|
* @title Table with pagination
|
||||||
|
@ -13,7 +14,7 @@ export class TablePaginationExample implements OnInit {
|
||||||
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
||||||
dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
|
dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
|
||||||
|
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
|
|
|
@ -5,13 +5,15 @@
|
||||||
<th mat-header-cell *matHeaderCellDef>
|
<th mat-header-cell *matHeaderCellDef>
|
||||||
<mat-checkbox (change)="$event ? masterToggle() : null"
|
<mat-checkbox (change)="$event ? masterToggle() : null"
|
||||||
[checked]="selection.hasValue() && isAllSelected()"
|
[checked]="selection.hasValue() && isAllSelected()"
|
||||||
[indeterminate]="selection.hasValue() && !isAllSelected()">
|
[indeterminate]="selection.hasValue() && !isAllSelected()"
|
||||||
|
[aria-label]="checkboxLabel()">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</th>
|
</th>
|
||||||
<td mat-cell *matCellDef="let row">
|
<td mat-cell *matCellDef="let row">
|
||||||
<mat-checkbox (click)="$event.stopPropagation()"
|
<mat-checkbox (click)="$event.stopPropagation()"
|
||||||
(change)="$event ? selection.toggle(row) : null"
|
(change)="$event ? selection.toggle(row) : null"
|
||||||
[checked]="selection.isSelected(row)">
|
[checked]="selection.isSelected(row)"
|
||||||
|
[aria-label]="checkboxLabel(row)">
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {SelectionModel} from '@angular/cdk/collections';
|
import {SelectionModel} from '@angular/cdk/collections';
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatTableDataSource} from '@angular/material';
|
import {MatTableDataSource} from '@angular/material/table';
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -48,4 +48,12 @@ export class TableSelectionExample {
|
||||||
this.selection.clear() :
|
this.selection.clear() :
|
||||||
this.dataSource.data.forEach(row => this.selection.select(row));
|
this.dataSource.data.forEach(row => this.selection.select(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The label for the checkbox on the passed row */
|
||||||
|
checkboxLabel(row?: PeriodicElement): string {
|
||||||
|
if (!row) {
|
||||||
|
return `${this.isAllSelected() ? 'select' : 'deselect'} all`;
|
||||||
|
}
|
||||||
|
return `${this.selection.isSelected(row) ? 'deselect' : 'select'} row ${row.position + 1}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
import {Component, Input, OnDestroy, OnInit, Optional, ViewChild} from '@angular/core';
|
import {Component, Input, OnDestroy, OnInit, Optional, ViewChild} from '@angular/core';
|
||||||
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
import {coerceBooleanProperty} from '@angular/cdk/coercion';
|
||||||
import {
|
import { MatSort, MatSortHeader } from '@angular/material/sort';
|
||||||
MatColumnDef,
|
import { MatColumnDef, MatTable, MatTableDataSource } from '@angular/material/table';
|
||||||
MatSort,
|
|
||||||
MatSortHeader,
|
|
||||||
MatTable,
|
|
||||||
MatTableDataSource
|
|
||||||
} from '@angular/material';
|
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -39,9 +34,9 @@ const ELEMENT_DATA: PeriodicElement[] = [
|
||||||
export class TableSimpleColumnExample implements OnInit {
|
export class TableSimpleColumnExample implements OnInit {
|
||||||
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
||||||
dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
|
dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
|
||||||
getWeight = (data: PeriodicElement) => '~' + data.weight;
|
|
||||||
|
|
||||||
@ViewChild('sort') sort: MatSort;
|
@ViewChild('sort', {static: true}) sort: MatSort;
|
||||||
|
getWeight = (data: PeriodicElement) => '~' + data.weight;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
|
@ -106,9 +101,9 @@ export class SimpleColumn<T> implements OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
_sortable: boolean;
|
_sortable: boolean;
|
||||||
|
|
||||||
@ViewChild(MatColumnDef) columnDef: MatColumnDef;
|
@ViewChild(MatColumnDef, {static: true}) columnDef: MatColumnDef;
|
||||||
|
|
||||||
@ViewChild(MatSortHeader) sortHeader: MatSortHeader;
|
@ViewChild(MatSortHeader, {static: true}) sortHeader: MatSortHeader;
|
||||||
|
|
||||||
constructor(@Optional() public table: MatTable<any>) { }
|
constructor(@Optional() public table: MatTable<any>) { }
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {MatSort, MatTableDataSource} from '@angular/material';
|
import {MatSort} from '@angular/material/sort';
|
||||||
|
import {MatTableDataSource} from '@angular/material/table';
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -33,7 +34,7 @@ export class TableSortingExample implements OnInit {
|
||||||
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
||||||
dataSource = new MatTableDataSource(ELEMENT_DATA);
|
dataSource = new MatTableDataSource(ELEMENT_DATA);
|
||||||
|
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort, {static: true}) sort: MatSort;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Table with a sticky columns
|
* @title Table with sticky columns
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'table-sticky-columns-example',
|
selector: 'table-sticky-columns-example',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatButtonToggleGroup} from '@angular/material';
|
import {MatButtonToggleGroup} from '@angular/material/button-toggle';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Flex-layout tables with toggle-able sticky headers, footers, and columns
|
* @title Flex-layout tables with toggle-able sticky headers, footers, and columns
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MatButtonToggleGroup} from '@angular/material';
|
import {MatButtonToggleGroup} from '@angular/material/button-toggle';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Tables with toggle-able sticky headers, footers, and columns
|
* @title Tables with toggle-able sticky headers, footers, and columns
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import {DataSource} from '@angular/cdk/collections';
|
||||||
import {
|
import {
|
||||||
AfterContentInit,
|
AfterContentInit,
|
||||||
Component,
|
Component,
|
||||||
|
@ -7,15 +8,14 @@ import {
|
||||||
QueryList,
|
QueryList,
|
||||||
ViewChild
|
ViewChild
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
import {MatSort} from '@angular/material/sort';
|
||||||
import {
|
import {
|
||||||
MatColumnDef,
|
MatColumnDef,
|
||||||
MatHeaderRowDef,
|
MatHeaderRowDef,
|
||||||
MatRowDef,
|
MatRowDef,
|
||||||
MatSort,
|
|
||||||
MatTable,
|
MatTable,
|
||||||
MatTableDataSource
|
MatTableDataSource
|
||||||
} from '@angular/material';
|
} from '@angular/material/table';
|
||||||
import {DataSource} from '@angular/cdk/collections';
|
|
||||||
|
|
||||||
export interface PeriodicElement {
|
export interface PeriodicElement {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -49,7 +49,7 @@ export class TableWrappedExample implements OnInit {
|
||||||
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
|
||||||
dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
|
dataSource = new MatTableDataSource<PeriodicElement>(ELEMENT_DATA);
|
||||||
|
|
||||||
@ViewChild('sort') sort: MatSort;
|
@ViewChild('sort', {static: true}) sort: MatSort;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource.sort = this.sort;
|
||||||
|
@ -74,7 +74,7 @@ export class WrapperTable<T> implements AfterContentInit {
|
||||||
@ContentChildren(MatRowDef) rowDefs: QueryList<MatRowDef<T>>;
|
@ContentChildren(MatRowDef) rowDefs: QueryList<MatRowDef<T>>;
|
||||||
@ContentChildren(MatColumnDef) columnDefs: QueryList<MatColumnDef>;
|
@ContentChildren(MatColumnDef) columnDefs: QueryList<MatColumnDef>;
|
||||||
|
|
||||||
@ViewChild(MatTable) table: MatTable<T>;
|
@ViewChild(MatTable, {static: true}) table: MatTable<T>;
|
||||||
|
|
||||||
@Input() columns: string[];
|
@Input() columns: string[];
|
||||||
|
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {AutofillMonitor} from '@angular/cdk/text-field';
|
import {AutofillMonitor} from '@angular/cdk/text-field';
|
||||||
import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angular/core';
|
||||||
|
|
||||||
/** @title Monitoring autofill state with AutofillMonitor */
|
/** @title Monitoring autofill state with AutofillMonitor */
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -7,23 +7,23 @@ import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core
|
||||||
templateUrl: './text-field-autofill-monitor-example.html',
|
templateUrl: './text-field-autofill-monitor-example.html',
|
||||||
styleUrls: ['./text-field-autofill-monitor-example.css'],
|
styleUrls: ['./text-field-autofill-monitor-example.css'],
|
||||||
})
|
})
|
||||||
export class TextFieldAutofillMonitorExample implements OnDestroy, OnInit {
|
export class TextFieldAutofillMonitorExample implements AfterViewInit, OnDestroy {
|
||||||
@ViewChild('first', {read: ElementRef}) firstName: ElementRef<HTMLElement>;
|
@ViewChild('first', { read: ElementRef, static: false }) firstName: ElementRef<HTMLElement>;
|
||||||
@ViewChild('last', {read: ElementRef}) lastName: ElementRef<HTMLElement>;
|
@ViewChild('last', { read: ElementRef, static: false }) lastName: ElementRef<HTMLElement>;
|
||||||
firstNameAutofilled: boolean;
|
firstNameAutofilled: boolean;
|
||||||
lastNameAutofilled: boolean;
|
lastNameAutofilled: boolean;
|
||||||
|
|
||||||
constructor(private autofill: AutofillMonitor) {}
|
constructor(private _autofill: AutofillMonitor) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngAfterViewInit() {
|
||||||
this.autofill.monitor(this.firstName)
|
this._autofill.monitor(this.firstName)
|
||||||
.subscribe(e => this.firstNameAutofilled = e.isAutofilled);
|
.subscribe(e => this.firstNameAutofilled = e.isAutofilled);
|
||||||
this.autofill.monitor(this.lastName)
|
this._autofill.monitor(this.lastName)
|
||||||
.subscribe(e => this.lastNameAutofilled = e.isAutofilled);
|
.subscribe(e => this.lastNameAutofilled = e.isAutofilled);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.autofill.stopMonitoring(this.firstName);
|
this._autofill.stopMonitoring(this.firstName);
|
||||||
this.autofill.stopMonitoring(this.lastName);
|
this._autofill.stopMonitoring(this.lastName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
/** No CSS for this example */
|
mat-form-field {
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
<textarea matInput
|
<textarea matInput
|
||||||
cdkTextareaAutosize
|
cdkTextareaAutosize
|
||||||
#autosize="cdkTextareaAutosize"
|
#autosize="cdkTextareaAutosize"
|
||||||
cdkAutosizeMinRows="2"
|
cdkAutosizeMinRows="1"
|
||||||
cdkAutosizeMaxRows="5"></textarea>
|
cdkAutosizeMaxRows="5"></textarea>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -9,13 +9,13 @@ import {take} from 'rxjs/operators';
|
||||||
styleUrls: ['./text-field-autosize-textarea-example.css'],
|
styleUrls: ['./text-field-autosize-textarea-example.css'],
|
||||||
})
|
})
|
||||||
export class TextFieldAutosizeTextareaExample {
|
export class TextFieldAutosizeTextareaExample {
|
||||||
constructor(private ngZone: NgZone) {}
|
constructor(private _ngZone: NgZone) {}
|
||||||
|
|
||||||
@ViewChild('autosize') autosize: CdkTextareaAutosize;
|
@ViewChild('autosize', {static: false}) autosize: CdkTextareaAutosize;
|
||||||
|
|
||||||
triggerResize() {
|
triggerResize() {
|
||||||
// Wait for changes to be applied, then trigger textarea resize.
|
// Wait for changes to be applied, then trigger textarea resize.
|
||||||
this.ngZone.onStable.pipe(take(1))
|
this._ngZone.onStable.pipe(take(1))
|
||||||
.subscribe(() => this.autosize.resizeToFitContent(true));
|
.subscribe(() => this.autosize.resizeToFitContent(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
<mat-toolbar-row>
|
<mat-toolbar-row>
|
||||||
<span>Second Line</span>
|
<span>Second Line</span>
|
||||||
<span class="example-spacer"></span>
|
<span class="example-spacer"></span>
|
||||||
<mat-icon class="example-icon">verified_user</mat-icon>
|
<mat-icon class="example-icon" aria-hidden="false" aria-label="Example user verified icon">verified_user</mat-icon>
|
||||||
</mat-toolbar-row>
|
</mat-toolbar-row>
|
||||||
|
|
||||||
<mat-toolbar-row>
|
<mat-toolbar-row>
|
||||||
<span>Third Line</span>
|
<span>Third Line</span>
|
||||||
<span class="example-spacer"></span>
|
<span class="example-spacer"></span>
|
||||||
<mat-icon class="example-icon">favorite</mat-icon>
|
<mat-icon class="example-icon" aria-hidden="false" aria-label="Example heart icon">favorite</mat-icon>
|
||||||
<mat-icon class="example-icon">delete</mat-icon>
|
<mat-icon class="example-icon" aria-hidden="false" aria-label="Example delete icon">delete</mat-icon>
|
||||||
</mat-toolbar-row>
|
</mat-toolbar-row>
|
||||||
</mat-toolbar>
|
</mat-toolbar>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {FormControl} from '@angular/forms';
|
import {FormControl} from '@angular/forms';
|
||||||
import {TooltipPosition} from '@angular/material';
|
import {TooltipPosition} from '@angular/material/tooltip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Tooltip that demonstrates auto-hiding when it clips out of its scrolling container.
|
* @title Tooltip that demonstrates auto-hiding when it clips out of its scrolling container.
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<div>
|
<div>
|
||||||
<span> Mouse over to </span>
|
<span> Click the following buttons to... </span>
|
||||||
<button mat-button
|
<button mat-button
|
||||||
(mouseenter)="tooltip.show()"
|
(click)="tooltip.show()"
|
||||||
aria-label="Button that progamatically shows a tooltip on another button"
|
aria-label="Show tooltip on the button at the end of this section"
|
||||||
class="example-action-button">
|
class="example-action-button">
|
||||||
show
|
show
|
||||||
</button>
|
</button>
|
||||||
<button mat-button
|
<button mat-button
|
||||||
(mouseenter)="tooltip.hide()"
|
(click)="tooltip.hide()"
|
||||||
aria-label="Button that progamatically hides a tooltip on another button"
|
aria-label="Hide tooltip on the button at the end of this section"
|
||||||
class="example-action-button">
|
class="example-action-button">
|
||||||
hide
|
hide
|
||||||
</button>
|
</button>
|
||||||
<button mat-button
|
<button mat-button
|
||||||
(mouseenter)="tooltip.toggle()"
|
(click)="tooltip.toggle()"
|
||||||
aria-label="Button that progamatically toggles a tooltip on another button to show/hide"
|
aria-label="Show/Hide tooltip on the button at the end of this section"
|
||||||
class="example-action-button">
|
class="example-action-button">
|
||||||
toggle show/hide
|
toggle show/hide
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions} from '@angular/material';
|
import {MAT_TOOLTIP_DEFAULT_OPTIONS, MatTooltipDefaultOptions} from '@angular/material/tooltip';
|
||||||
|
|
||||||
/** Custom options the configure the tooltip's default show/hide delays. */
|
/** Custom options the configure the tooltip's default show/hide delays. */
|
||||||
export const myCustomTooltipDefaults: MatTooltipDefaultOptions = {
|
export const myCustomTooltipDefaults: MatTooltipDefaultOptions = {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {FormControl} from '@angular/forms';
|
import {FormControl} from '@angular/forms';
|
||||||
import {TooltipPosition} from '@angular/material';
|
import {TooltipPosition} from '@angular/material/tooltip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title Tooltip with a custom position
|
* @title Tooltip with a custom position
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user