mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
Added new Angular Material examples
This commit is contained in:
parent
7ec117202d
commit
bb3764aaff
|
@ -173,6 +173,11 @@ import { StepperErrorsExample } from 'assets/angular-material-examples/stepper-e
|
||||||
import { TabGroupAlignExample } from 'assets/angular-material-examples/tab-group-align/tab-group-align-example';
|
import { TabGroupAlignExample } from 'assets/angular-material-examples/tab-group-align/tab-group-align-example';
|
||||||
import { SimpleColumn, TableSimpleColumnExample } from 'assets/angular-material-examples/table-simple-column/table-simple-column-example';
|
import { SimpleColumn, TableSimpleColumnExample } from 'assets/angular-material-examples/table-simple-column/table-simple-column-example';
|
||||||
import { TableWrappedExample, WrapperTable } from 'assets/angular-material-examples/table-wrapped/table-wrapped-example';
|
import { TableWrappedExample, WrapperTable } from 'assets/angular-material-examples/table-wrapped/table-wrapped-example';
|
||||||
|
import { PlainInputAutocompleteExample } from 'assets/angular-material-examples/autocomplete-plain-input/autocomplete-plain-input-example';
|
||||||
|
import { ChipsDragDropExample } from 'assets/angular-material-examples/chips-drag-and-drop/chips-drag-and-drop-example';
|
||||||
|
import { DatepickerDateClassExample } from 'assets/angular-material-examples/datepicker-date-class/datepicker-date-class-example';
|
||||||
|
import { MenuPositionExample } from 'assets/angular-material-examples/menu-position/menu-position-example';
|
||||||
|
import { TabGroupAnimationsExample } from 'assets/angular-material-examples/tab-group-animations/tab-group-animations-example';
|
||||||
|
|
||||||
export const COMPONENT_MAP = {
|
export const COMPONENT_MAP = {
|
||||||
'autocomplete' : [
|
'autocomplete' : [
|
||||||
|
@ -181,7 +186,8 @@ export const COMPONENT_MAP = {
|
||||||
'autocomplete-display',
|
'autocomplete-display',
|
||||||
'autocomplete-filter',
|
'autocomplete-filter',
|
||||||
'autocomplete-optgroup',
|
'autocomplete-optgroup',
|
||||||
'autocomplete-simple'
|
'autocomplete-simple',
|
||||||
|
'autocomplete-plain-input'
|
||||||
],
|
],
|
||||||
'badge' : [
|
'badge' : [
|
||||||
'badge-overview'
|
'badge-overview'
|
||||||
|
@ -209,6 +215,7 @@ export const COMPONENT_MAP = {
|
||||||
'chips' : [
|
'chips' : [
|
||||||
'chips-overview',
|
'chips-overview',
|
||||||
'chips-autocomplete',
|
'chips-autocomplete',
|
||||||
|
// 'chips-drag-and-drop',
|
||||||
'chips-input',
|
'chips-input',
|
||||||
'chips-stacked'
|
'chips-stacked'
|
||||||
],
|
],
|
||||||
|
@ -218,6 +225,7 @@ export const COMPONENT_MAP = {
|
||||||
'datepicker-color',
|
'datepicker-color',
|
||||||
'datepicker-custom-header',
|
'datepicker-custom-header',
|
||||||
'datepicker-custom-icon',
|
'datepicker-custom-icon',
|
||||||
|
'datepicker-date-class',
|
||||||
'datepicker-disabled',
|
'datepicker-disabled',
|
||||||
'datepicker-events',
|
'datepicker-events',
|
||||||
'datepicker-filter',
|
'datepicker-filter',
|
||||||
|
@ -286,6 +294,7 @@ export const COMPONENT_MAP = {
|
||||||
],
|
],
|
||||||
'menu' : [
|
'menu' : [
|
||||||
'menu-overview',
|
'menu-overview',
|
||||||
|
'menu-position',
|
||||||
'menu-icons',
|
'menu-icons',
|
||||||
'nested-menu'
|
'nested-menu'
|
||||||
],
|
],
|
||||||
|
@ -389,6 +398,7 @@ export const COMPONENT_MAP = {
|
||||||
'tab-group-basic',
|
'tab-group-basic',
|
||||||
'tab-group-async',
|
'tab-group-async',
|
||||||
'tab-group-align',
|
'tab-group-align',
|
||||||
|
'tab-group-animations',
|
||||||
'tab-group-custom-label',
|
'tab-group-custom-label',
|
||||||
'tab-group-dynamic',
|
'tab-group-dynamic',
|
||||||
'tab-group-dynamic-height',
|
'tab-group-dynamic-height',
|
||||||
|
@ -448,6 +458,10 @@ export const EXAMPLE_COMPONENTS = {
|
||||||
title : 'Autocomplete overview',
|
title : 'Autocomplete overview',
|
||||||
component: AutocompleteOverviewExample
|
component: AutocompleteOverviewExample
|
||||||
},
|
},
|
||||||
|
'autocomplete-plain-input' : {
|
||||||
|
title : 'Plain input autocomplete',
|
||||||
|
component: PlainInputAutocompleteExample
|
||||||
|
},
|
||||||
'autocomplete-simple' : {
|
'autocomplete-simple' : {
|
||||||
title : 'Simple autocomplete',
|
title : 'Simple autocomplete',
|
||||||
component: AutocompleteSimpleExample
|
component: AutocompleteSimpleExample
|
||||||
|
@ -502,6 +516,10 @@ export const EXAMPLE_COMPONENTS = {
|
||||||
title : 'Chips Autocomplete',
|
title : 'Chips Autocomplete',
|
||||||
component: ChipsAutocompleteExample
|
component: ChipsAutocompleteExample
|
||||||
},
|
},
|
||||||
|
'chips-drag-and-drop' : {
|
||||||
|
title : 'Chips Drag and Drop',
|
||||||
|
component: ChipsDragDropExample
|
||||||
|
},
|
||||||
'chips-input' : {
|
'chips-input' : {
|
||||||
title : 'Chips with input',
|
title : 'Chips with input',
|
||||||
component: ChipsInputExample
|
component: ChipsInputExample
|
||||||
|
@ -531,6 +549,10 @@ export const EXAMPLE_COMPONENTS = {
|
||||||
title : 'Datepicker with custom icon',
|
title : 'Datepicker with custom icon',
|
||||||
component: DatepickerCustomIconExample
|
component: DatepickerCustomIconExample
|
||||||
},
|
},
|
||||||
|
'datepicker-date-class' : {
|
||||||
|
title : 'Datepicker with custom date classes',
|
||||||
|
component: DatepickerDateClassExample
|
||||||
|
},
|
||||||
'datepicker-disabled' : {
|
'datepicker-disabled' : {
|
||||||
title : 'Disabled datepicker',
|
title : 'Disabled datepicker',
|
||||||
component: DatepickerDisabledExample
|
component: DatepickerDisabledExample
|
||||||
|
@ -733,6 +755,10 @@ export const EXAMPLE_COMPONENTS = {
|
||||||
title : 'Basic menu',
|
title : 'Basic menu',
|
||||||
component: MenuOverviewExample
|
component: MenuOverviewExample
|
||||||
},
|
},
|
||||||
|
'menu-position' : {
|
||||||
|
title : 'Menu positioning',
|
||||||
|
component: MenuPositionExample
|
||||||
|
},
|
||||||
'nested-menu' : {
|
'nested-menu' : {
|
||||||
title : 'Nested menu',
|
title : 'Nested menu',
|
||||||
component: NestedMenuExample
|
component: NestedMenuExample
|
||||||
|
@ -1027,6 +1053,10 @@ export const EXAMPLE_COMPONENTS = {
|
||||||
title : 'Tab group with aligned labels',
|
title : 'Tab group with aligned labels',
|
||||||
component: TabGroupAlignExample
|
component: TabGroupAlignExample
|
||||||
},
|
},
|
||||||
|
'tab-group-animations' : {
|
||||||
|
title : 'Tab group animations',
|
||||||
|
component: TabGroupAnimationsExample
|
||||||
|
},
|
||||||
'tab-group-basic' : {
|
'tab-group-basic' : {
|
||||||
title : 'Basic use of the tab group',
|
title : 'Basic use of the tab group',
|
||||||
component: TabGroupBasicExample
|
component: TabGroupBasicExample
|
||||||
|
@ -1152,6 +1182,7 @@ export const EXAMPLE_LIST = [
|
||||||
AutocompleteOptgroupExample,
|
AutocompleteOptgroupExample,
|
||||||
AutocompleteOverviewExample,
|
AutocompleteOverviewExample,
|
||||||
AutocompleteSimpleExample,
|
AutocompleteSimpleExample,
|
||||||
|
PlainInputAutocompleteExample,
|
||||||
BadgeOverviewExample,
|
BadgeOverviewExample,
|
||||||
BottomSheetOverviewExample, BottomSheetOverviewExampleSheet,
|
BottomSheetOverviewExample, BottomSheetOverviewExampleSheet,
|
||||||
ButtonOverviewExample,
|
ButtonOverviewExample,
|
||||||
|
@ -1164,6 +1195,7 @@ export const EXAMPLE_LIST = [
|
||||||
CheckboxConfigurableExample,
|
CheckboxConfigurableExample,
|
||||||
CheckboxOverviewExample,
|
CheckboxOverviewExample,
|
||||||
ChipsAutocompleteExample,
|
ChipsAutocompleteExample,
|
||||||
|
ChipsDragDropExample,
|
||||||
ChipsInputExample,
|
ChipsInputExample,
|
||||||
ChipsOverviewExample,
|
ChipsOverviewExample,
|
||||||
ChipsStackedExample,
|
ChipsStackedExample,
|
||||||
|
@ -1171,6 +1203,7 @@ export const EXAMPLE_LIST = [
|
||||||
DatepickerColorExample,
|
DatepickerColorExample,
|
||||||
DatepickerCustomHeaderExample, ExampleHeader,
|
DatepickerCustomHeaderExample, ExampleHeader,
|
||||||
DatepickerCustomIconExample,
|
DatepickerCustomIconExample,
|
||||||
|
DatepickerDateClassExample,
|
||||||
DatepickerDisabledExample,
|
DatepickerDisabledExample,
|
||||||
DatepickerEventsExample,
|
DatepickerEventsExample,
|
||||||
DatepickerFilterExample,
|
DatepickerFilterExample,
|
||||||
|
@ -1219,6 +1252,7 @@ export const EXAMPLE_LIST = [
|
||||||
ListSelectionExample,
|
ListSelectionExample,
|
||||||
MenuIconsExample,
|
MenuIconsExample,
|
||||||
MenuOverviewExample,
|
MenuOverviewExample,
|
||||||
|
MenuPositionExample,
|
||||||
NestedMenuExample,
|
NestedMenuExample,
|
||||||
PaginatorConfigurableExample,
|
PaginatorConfigurableExample,
|
||||||
PaginatorOverviewExample,
|
PaginatorOverviewExample,
|
||||||
|
@ -1292,6 +1326,7 @@ export const EXAMPLE_LIST = [
|
||||||
TableStickyHeaderExample,
|
TableStickyHeaderExample,
|
||||||
TableWrappedExample, WrapperTable,
|
TableWrappedExample, WrapperTable,
|
||||||
TabGroupAlignExample,
|
TabGroupAlignExample,
|
||||||
|
TabGroupAnimationsExample,
|
||||||
TabGroupBasicExample,
|
TabGroupBasicExample,
|
||||||
TabGroupAsyncExample,
|
TabGroupAsyncExample,
|
||||||
TabGroupCustomLabelExample,
|
TabGroupCustomLabelExample,
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
.example-form {
|
||||||
|
min-width: 150px;
|
||||||
|
max-width: 500px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-full-width {
|
||||||
|
width: 100%;
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
<form class="example-form">
|
||||||
|
<input type="text" placeholder="Search for a street" [formControl]="control" [matAutocomplete]="auto">
|
||||||
|
<mat-autocomplete #auto="matAutocomplete">
|
||||||
|
<mat-option *ngFor="let street of filteredStreets | async" [value]="street">
|
||||||
|
{{street}}
|
||||||
|
</mat-option>
|
||||||
|
</mat-autocomplete>
|
||||||
|
</form>
|
|
@ -0,0 +1,34 @@
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {FormControl} from '@angular/forms';
|
||||||
|
import {Observable} from 'rxjs';
|
||||||
|
import {startWith, map} from 'rxjs/operators';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Plain input autocomplete
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'autocomplete-plain-input-example',
|
||||||
|
templateUrl: 'autocomplete-plain-input-example.html',
|
||||||
|
styleUrls: ['autocomplete-plain-input-example.css'],
|
||||||
|
})
|
||||||
|
export class PlainInputAutocompleteExample implements OnInit {
|
||||||
|
control = new FormControl();
|
||||||
|
streets: string[] = ['Champs-Élysées', 'Lombard Street', 'Abbey Road', 'Fifth Avenue'];
|
||||||
|
filteredStreets: Observable<string[]>;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.filteredStreets = this.control.valueChanges.pipe(
|
||||||
|
startWith(''),
|
||||||
|
map(value => this._filter(value))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _filter(value: string): string[] {
|
||||||
|
const filterValue = this._normalizeValue(value);
|
||||||
|
return this.streets.filter(street => this._normalizeValue(street).includes(filterValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
private _normalizeValue(value: string): string {
|
||||||
|
return value.toLowerCase().replace(/\s/g, '');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
.example-box.cdk-drag-animating {
|
||||||
|
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.example-chip .cdk-drop-list-dragging {
|
||||||
|
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
<mat-chip-list
|
||||||
|
class="example-chip"
|
||||||
|
cdkDropList
|
||||||
|
cdkDropListOrientation="horizontal"
|
||||||
|
(cdkDropListDropped)="drop($event)">
|
||||||
|
<mat-chip
|
||||||
|
class="example-box"
|
||||||
|
cdkDrag
|
||||||
|
*ngFor="let vegetable of vegetables">
|
||||||
|
{{vegetable.name}}
|
||||||
|
</mat-chip>
|
||||||
|
</mat-chip-list>
|
|
@ -0,0 +1,29 @@
|
||||||
|
import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
|
export interface Vegetable {
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Chips Drag and Drop
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'chips-drag-drop-example',
|
||||||
|
templateUrl: 'chips-drag-and-drop-example.html',
|
||||||
|
styleUrls: ['chips-drag-and-drop-example.css']
|
||||||
|
})
|
||||||
|
export class ChipsDragDropExample {
|
||||||
|
vegetables: Vegetable[] = [
|
||||||
|
{name: 'apple'},
|
||||||
|
{name: 'banana'},
|
||||||
|
{name: 'strawberry'},
|
||||||
|
{name: 'orange'},
|
||||||
|
{name: 'kiwi'},
|
||||||
|
{name: 'cherry'},
|
||||||
|
];
|
||||||
|
|
||||||
|
drop(event: CdkDragDrop<Vegetable[]>) {
|
||||||
|
moveItemInArray(this.vegetables, event.previousIndex, event.currentIndex);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
.example-custom-date-class {
|
||||||
|
background: orange;
|
||||||
|
border-radius: 100%;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<mat-form-field class="example-full-width">
|
||||||
|
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker [dateClass]="dateClass" #picker></mat-datepicker>
|
||||||
|
</mat-form-field>
|
|
@ -0,0 +1,18 @@
|
||||||
|
import {Component, ViewEncapsulation} from '@angular/core';
|
||||||
|
|
||||||
|
/** @title Datepicker with custom date classes */
|
||||||
|
@Component({
|
||||||
|
selector: 'datepicker-date-class-example',
|
||||||
|
templateUrl: 'datepicker-date-class-example.html',
|
||||||
|
styleUrls: ['datepicker-date-class-example.css'],
|
||||||
|
encapsulation: ViewEncapsulation.None,
|
||||||
|
})
|
||||||
|
export class DatepickerDateClassExample {
|
||||||
|
dateClass = (d: Date) => {
|
||||||
|
|
||||||
|
const date = d.date();
|
||||||
|
|
||||||
|
// Highlight the 1st and 20th day of each month.
|
||||||
|
return (date === 1 || date === 20) ? 'example-custom-date-class' : undefined;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
/** No CSS for this example */
|
|
@ -0,0 +1,24 @@
|
||||||
|
<button mat-button [matMenuTriggerFor]="aboveMenu">Above</button>
|
||||||
|
<mat-menu #aboveMenu="matMenu" yPosition="above">
|
||||||
|
<button mat-menu-item>Item 1</button>
|
||||||
|
<button mat-menu-item>Item 2</button>
|
||||||
|
</mat-menu>
|
||||||
|
|
||||||
|
<button mat-button [matMenuTriggerFor]="belowMenu">Below</button>
|
||||||
|
<mat-menu #belowMenu="matMenu" yPosition="below">
|
||||||
|
<button mat-menu-item>Item 1</button>
|
||||||
|
<button mat-menu-item>Item 2</button>
|
||||||
|
</mat-menu>
|
||||||
|
|
||||||
|
<button mat-button [matMenuTriggerFor]="beforeMenu">Before</button>
|
||||||
|
<mat-menu #beforeMenu="matMenu" xPosition="before">
|
||||||
|
<button mat-menu-item>Item 1</button>
|
||||||
|
<button mat-menu-item>Item 2</button>
|
||||||
|
</mat-menu>
|
||||||
|
|
||||||
|
|
||||||
|
<button mat-button [matMenuTriggerFor]="afterMenu">After</button>
|
||||||
|
<mat-menu #afterMenu="matMenu" xPosition="after">
|
||||||
|
<button mat-menu-item>Item 1</button>
|
||||||
|
<button mat-menu-item>Item 2</button>
|
||||||
|
</mat-menu>
|
11
src/assets/angular-material-examples/menu-position/menu-position-example.ts
Executable file
11
src/assets/angular-material-examples/menu-position/menu-position-example.ts
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Menu positioning
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'menu-position-example',
|
||||||
|
templateUrl: 'menu-position-example.html',
|
||||||
|
styleUrls: ['menu-position-example.css'],
|
||||||
|
})
|
||||||
|
export class MenuPositionExample {}
|
|
@ -0,0 +1,3 @@
|
||||||
|
.mat-tab-group {
|
||||||
|
margin-bottom: 48px;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<h3>No animation</h3>
|
||||||
|
|
||||||
|
<mat-tab-group animationDuration="0ms">
|
||||||
|
<mat-tab label="First">Content 1</mat-tab>
|
||||||
|
<mat-tab label="Second">Content 2</mat-tab>
|
||||||
|
<mat-tab label="Third">Content 3</mat-tab>
|
||||||
|
</mat-tab-group>
|
||||||
|
|
||||||
|
<h3>Very slow animation</h3>
|
||||||
|
<mat-tab-group animationDuration="2000ms">
|
||||||
|
<mat-tab label="First">Content 1</mat-tab>
|
||||||
|
<mat-tab label="Second">Content 2</mat-tab>
|
||||||
|
<mat-tab label="Third">Content 3</mat-tab>
|
||||||
|
</mat-tab-group>
|
|
@ -0,0 +1,11 @@
|
||||||
|
import {Component} from '@angular/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title Tab group animations
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'tab-group-animations-example',
|
||||||
|
templateUrl: 'tab-group-animations-example.html',
|
||||||
|
styleUrls: ['tab-group-animations-example.css'],
|
||||||
|
})
|
||||||
|
export class TabGroupAnimationsExample {}
|
Loading…
Reference in New Issue
Block a user