diff --git a/package-lock.json b/package-lock.json index e76720ef..66e51c25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -215,6 +215,14 @@ "tslib": "1.8.0" } }, + "@angular/material-moment-adapter": { + "version": "5.0.0-rc0", + "resolved": "https://registry.npmjs.org/@angular/material-moment-adapter/-/material-moment-adapter-5.0.0-rc0.tgz", + "integrity": "sha512-NI9Q8555vbm6RvBltW0rzyaKwthpUmjtoGtSQePp6TI0ZtROtGAwH/KCcNM3FsSqvQuxBc5jq0HId2wvHknxEw==", + "requires": { + "tslib": "1.8.0" + } + }, "@angular/platform-browser": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-5.0.2.tgz", diff --git a/package.json b/package.json index 4ec1837c..2ea0ab4e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@angular/forms": "5.0.2", "@angular/http": "5.0.2", "@angular/material": "5.0.0-rc0", + "@angular/material-moment-adapter": "5.0.0-rc0", "@angular/platform-browser": "5.0.2", "@angular/platform-browser-dynamic": "5.0.2", "@angular/router": "5.0.2", diff --git a/src/app/main/content/components/angular-material/angular-material.module.ts b/src/app/main/content/components/angular-material/angular-material.module.ts index ae4ee2c1..acffb5e6 100644 --- a/src/app/main/content/components/angular-material/angular-material.module.ts +++ b/src/app/main/content/components/angular-material/angular-material.module.ts @@ -2,9 +2,9 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { SharedModule } from '../../../../core/modules/shared.module'; import { FuseWidgetModule } from '../../../../core/components/widget/widget.module'; -import { FuseAngularMaterialComponent } from 'app/main/content/components/angular-material/angular-material.component'; import { FuseExampleViewerComponent } from './example-viewer/example-viewer'; import { EXAMPLE_LIST } from './example-components'; +import { FuseAngularMaterialComponent } from './angular-material.component'; const routes: Routes = [ { diff --git a/src/app/main/content/components/angular-material/example-components.ts b/src/app/main/content/components/angular-material/example-components.ts index 10a136dc..e3787926 100644 --- a/src/app/main/content/components/angular-material/example-components.ts +++ b/src/app/main/content/components/angular-material/example-components.ts @@ -15,15 +15,22 @@ import { ChipsInputExample } from '../../../../../assets/angular-material-exampl import { ChipsOverviewExample } from '../../../../../assets/angular-material-examples/chips-overview/chips-overview-example'; import { ChipsStackedExample } from '../../../../../assets/angular-material-examples/chips-stacked/chips-stacked-example'; import { DatepickerApiExample } from '../../../../../assets/angular-material-examples/datepicker-api/datepicker-api-example'; +import { DatepickerDisabledExample } from '../../../../../assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example'; +import { DatepickerEventsExample } from '../../../../../assets/angular-material-examples/datepicker-events/datepicker-events-example'; import { DatepickerFilterExample } from '../../../../../assets/angular-material-examples/datepicker-filter/datepicker-filter-example'; +import { DatepickerFormatsExample } from '../../../../../assets/angular-material-examples/datepicker-formats/datepicker-formats-example'; +import { DatepickerLocaleExample } from '../../../../../assets/angular-material-examples/datepicker-locale/datepicker-locale-example'; import { DatepickerMinMaxExample } from '../../../../../assets/angular-material-examples/datepicker-min-max/datepicker-min-max-example'; +import { DatepickerMomentExample } from '../../../../../assets/angular-material-examples/datepicker-moment/datepicker-moment-example'; import { DatepickerOverviewExample } from '../../../../../assets/angular-material-examples/datepicker-overview/datepicker-overview-example'; import { DatepickerStartViewExample } from '../../../../../assets/angular-material-examples/datepicker-start-view/datepicker-start-view-example'; import { DatepickerTouchExample } from '../../../../../assets/angular-material-examples/datepicker-touch/datepicker-touch-example'; +import { DatepickerValueExample } from '../../../../../assets/angular-material-examples/datepicker-value/datepicker-value-example'; import { DialogContentExampleDialog, DialogContentExample } from '../../../../../assets/angular-material-examples/dialog-content/dialog-content-example'; import { DialogDataExampleDialog, DialogDataExample } from '../../../../../assets/angular-material-examples/dialog-data/dialog-data-example'; import { DialogElementsExampleDialog, DialogElementsExample } from '../../../../../assets/angular-material-examples/dialog-elements/dialog-elements-example'; import { DialogOverviewExampleDialog, DialogOverviewExample } from '../../../../../assets/angular-material-examples/dialog-overview/dialog-overview-example'; +import { ElevationOverviewExample } from '../../../../../assets/angular-material-examples/elevation-overview/elevation-overview-example'; import { ExpansionOverviewExample } from '../../../../../assets/angular-material-examples/expansion-overview/expansion-overview-example'; import { ExpansionStepsExample } from '../../../../../assets/angular-material-examples/expansion-steps/expansion-steps-example'; import { MyTelInput, FormFieldCustomControlExample } from '../../../../../assets/angular-material-examples/form-field-custom-control/form-field-custom-control-example'; @@ -37,7 +44,9 @@ import { GridListDynamicExample } from '../../../../../assets/angular-material-e import { GridListOverviewExample } from '../../../../../assets/angular-material-examples/grid-list-overview/grid-list-overview-example'; import { IconOverviewExample } from '../../../../../assets/angular-material-examples/icon-overview/icon-overview-example'; import { IconSvgExample } from '../../../../../assets/angular-material-examples/icon-svg/icon-svg-example'; +import { InputAutosizeTextareaExample } from '../../../../../assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example'; import { InputClearableExample } from '../../../../../assets/angular-material-examples/input-clearable/input-clearable-example'; +import { InputErrorStateMatcherExample } from '../../../../../assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example'; import { InputErrorsExample } from '../../../../../assets/angular-material-examples/input-errors/input-errors-example'; import { InputFormExample } from '../../../../../assets/angular-material-examples/input-form/input-form-example'; import { InputHintExample } from '../../../../../assets/angular-material-examples/input-hint/input-hint-example'; @@ -51,14 +60,27 @@ import { MenuOverviewExample } from '../../../../../assets/angular-material-exam import { NestedMenuExample } from '../../../../../assets/angular-material-examples/nested-menu/nested-menu-example'; import { PaginatorConfigurableExample } from '../../../../../assets/angular-material-examples/paginator-configurable/paginator-configurable-example'; import { PaginatorOverviewExample } from '../../../../../assets/angular-material-examples/paginator-overview/paginator-overview-example'; +import { ProgressBarBufferExample } from '../../../../../assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example'; import { ProgressBarConfigurableExample } from '../../../../../assets/angular-material-examples/progress-bar-configurable/progress-bar-configurable-example'; -import { ProgressBarOverviewExample } from '../../../../../assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example'; +import { ProgressBarDeterminateExample } from '../../../../../assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example'; +import { ProgressBarIndeterminateExample } from '../../../../../assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example'; +import { ProgressBarQueryExample } from '../../../../../assets/angular-material-examples/progress-bar-query/progress-bar-query-example'; import { ProgressSpinnerConfigurableExample } from '../../../../../assets/angular-material-examples/progress-spinner-configurable/progress-spinner-configurable-example'; import { ProgressSpinnerOverviewExample } from '../../../../../assets/angular-material-examples/progress-spinner-overview/progress-spinner-overview-example'; import { RadioNgModelExample } from '../../../../../assets/angular-material-examples/radio-ng-model/radio-ng-model-example'; import { RadioOverviewExample } from '../../../../../assets/angular-material-examples/radio-overview/radio-overview-example'; +import { SelectCustomTriggerExample } from '../../../../../assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example'; +import { SelectDisabledExample } from '../../../../../assets/angular-material-examples/select-disabled/select-disabled-example'; +import { SelectErrorStateMatcherExample } from '../../../../../assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example'; import { SelectFormExample } from '../../../../../assets/angular-material-examples/select-form/select-form-example'; +import { SelectHintErrorExample } from '../../../../../assets/angular-material-examples/select-hint-error/select-hint-error-example'; +import { SelectMultipleExample } from '../../../../../assets/angular-material-examples/select-multiple/select-multiple-example'; +import { SelectNoRippleExample } from '../../../../../assets/angular-material-examples/select-no-ripple/select-no-ripple-example'; +import { SelectOptgroupExample } from '../../../../../assets/angular-material-examples/select-optgroup/select-optgroup-example'; import { SelectOverviewExample } from '../../../../../assets/angular-material-examples/select-overview/select-overview-example'; +import { SelectPanelClassExample } from '../../../../../assets/angular-material-examples/select-panel-class/select-panel-class-example'; +import { SelectResetExample } from '../../../../../assets/angular-material-examples/select-reset/select-reset-example'; +import { SelectValueBindingExample } from '../../../../../assets/angular-material-examples/select-value-binding/select-value-binding-example'; import { SidenavFabExample } from '../../../../../assets/angular-material-examples/sidenav-fab/sidenav-fab-example'; import { SidenavOverviewExample } from '../../../../../assets/angular-material-examples/sidenav-overview/sidenav-overview-example'; import { SlideToggleConfigurableExample } from '../../../../../assets/angular-material-examples/slide-toggle-configurable/slide-toggle-configurable-example'; @@ -97,10 +119,16 @@ export const COMPONENT_MAP = { 'datepicker' : [ 'datepicker-overview', 'datepicker-start-view', + 'datepicker-value', 'datepicker-min-max', 'datepicker-filter', + 'datepicker-events', + 'datepicker-disabled', 'datepicker-touch', - 'datepicker-api' + 'datepicker-api', + 'datepicker-locale', + 'datepicker-moment', + 'datepicker-formats' ], 'form-field' : [ 'form-field-overview', @@ -114,6 +142,8 @@ export const COMPONENT_MAP = { 'input' : [ 'input-overview', 'input-errors', + 'input-error-state-matcher', + 'input-autosize-textarea', 'input-prefix-suffix', 'input-hint', 'input-clearable', @@ -125,7 +155,17 @@ export const COMPONENT_MAP = { ], 'select' : [ 'select-overview', - 'select-form' + 'select-value-binding', + 'select-form', + 'select-hint-error', + 'select-disabled', + 'select-reset', + 'select-optgroup', + 'select-multiple', + 'select-custom-trigger', + 'select-no-ripple', + 'select-panel-class', + 'select-error-state-matcher' ], 'slider' : [ 'slider-overview', @@ -169,6 +209,9 @@ export const COMPONENT_MAP = { 'tabs-overview', 'tabs-template-label' ], + 'elevation' : [ + 'elevation-overview' + ], 'expansion-panel' : [ 'expansion-overview', 'expansion-steps' @@ -195,7 +238,10 @@ export const COMPONENT_MAP = { 'progress-spinner-configurable' ], 'progress-bar' : [ - 'progress-bar-overview', + 'progress-bar-determinate', + 'progress-bar-indeterminate', + 'progress-bar-query', + 'progress-bar-buffer', 'progress-bar-configurable' ], 'dialog' : [ @@ -324,41 +370,77 @@ export const EXAMPLE_COMPONENTS = { selectorName : null }, 'datepicker-api' : { - title : 'Datepicker API', + title : 'Datepicker open method ', component : DatepickerApiExample, additionalFiles: null, selectorName : null }, + 'datepicker-disabled' : { + title : 'Disabled datepicker ', + component : DatepickerDisabledExample, + additionalFiles: null, + selectorName : null + }, + 'datepicker-events' : { + title : 'Datepicker input and change events ', + component : DatepickerEventsExample, + additionalFiles: null, + selectorName : null + }, 'datepicker-filter' : { - title : 'Datepicker Filter', + title : 'Datepicker with filter validation ', component : DatepickerFilterExample, additionalFiles: null, selectorName : null }, + 'datepicker-formats' : { + title : 'Datepicker with custom formats ', + component : DatepickerFormatsExample, + additionalFiles: null, + selectorName : null + }, + 'datepicker-locale' : { + title : 'Datepicker with different locale ', + component : DatepickerLocaleExample, + additionalFiles: null, + selectorName : null + }, 'datepicker-min-max' : { - title : 'Datepicker Min Max', + title : 'Datepicker with min & max validation ', component : DatepickerMinMaxExample, additionalFiles: null, selectorName : null }, + 'datepicker-moment' : { + title : 'Datepicker that uses Moment.js dates ', + component : DatepickerMomentExample, + additionalFiles: null, + selectorName : null + }, 'datepicker-overview' : { - title : 'Basic datepicker', + title : 'Basic datepicker ', component : DatepickerOverviewExample, additionalFiles: null, selectorName : null }, 'datepicker-start-view' : { - title : 'Datepicker start date', + title : 'Datepicker start date ', component : DatepickerStartViewExample, additionalFiles: null, selectorName : null }, 'datepicker-touch' : { - title : 'Datepicker Touch', + title : 'Datepicker touch UI ', component : DatepickerTouchExample, additionalFiles: null, selectorName : null }, + 'datepicker-value' : { + title : 'Datepicker selected value ', + component : DatepickerValueExample, + additionalFiles: null, + selectorName : null + }, 'dialog-content' : { title : 'Dialog with header, scrollable content and actions', component : DialogContentExample, @@ -383,6 +465,12 @@ export const EXAMPLE_COMPONENTS = { additionalFiles: ['dialog-overview-example-dialog.html'], selectorName : 'DialogOverviewExample, DialogOverviewExampleDialog' }, + 'elevation-overview' : { + title : 'Elevation CSS classes', + component : ElevationOverviewExample, + additionalFiles: null, + selectorName : null + }, 'expansion-overview' : { title : 'Basic expansion panel', component : ExpansionOverviewExample, @@ -461,14 +549,26 @@ export const EXAMPLE_COMPONENTS = { additionalFiles: null, selectorName : null }, + 'input-autosize-textarea' : { + title : 'Auto-resizing textarea ', + component : InputAutosizeTextareaExample, + additionalFiles: null, + selectorName : null + }, 'input-clearable' : { - title : 'Input Clearable', + title : 'Input with a clear button', component : InputClearableExample, additionalFiles: null, selectorName : null }, + 'input-error-state-matcher' : { + title : 'Input with a custom ErrorStateMatcher ', + component : InputErrorStateMatcherExample, + additionalFiles: null, + selectorName : null + }, 'input-errors' : { - title : 'Input Errors', + title : 'Input with error messages', component : InputErrorsExample, additionalFiles: null, selectorName : null @@ -480,7 +580,7 @@ export const EXAMPLE_COMPONENTS = { selectorName : null }, 'input-hint' : { - title : 'Input hints', + title : 'Input with hints', component : InputHintExample, additionalFiles: null, selectorName : null @@ -492,7 +592,7 @@ export const EXAMPLE_COMPONENTS = { selectorName : null }, 'input-prefix-suffix' : { - title : 'Input Prefixes and Suffixes', + title : 'Inputs with prefixes and suffixes', component : InputPrefixSuffixExample, additionalFiles: null, selectorName : null @@ -545,15 +645,33 @@ export const EXAMPLE_COMPONENTS = { additionalFiles: null, selectorName : null }, + 'progress-bar-buffer' : { + title : 'Buffer progress-bar', + component : ProgressBarBufferExample, + additionalFiles: null, + selectorName : null + }, 'progress-bar-configurable' : { title : 'Configurable progress-bar', component : ProgressBarConfigurableExample, additionalFiles: null, selectorName : null }, - 'progress-bar-overview' : { - title : 'Basic progress-bar', - component : ProgressBarOverviewExample, + 'progress-bar-determinate' : { + title : 'Determinate progress-bar', + component : ProgressBarDeterminateExample, + additionalFiles: null, + selectorName : null + }, + 'progress-bar-indeterminate' : { + title : 'Indeterminate progress-bar', + component : ProgressBarIndeterminateExample, + additionalFiles: null, + selectorName : null + }, + 'progress-bar-query' : { + title : 'Query progress-bar', + component : ProgressBarQueryExample, additionalFiles: null, selectorName : null }, @@ -581,18 +699,78 @@ export const EXAMPLE_COMPONENTS = { additionalFiles: null, selectorName : null }, + 'select-custom-trigger' : { + title : 'Select with custom trigger text ', + component : SelectCustomTriggerExample, + additionalFiles: null, + selectorName : null + }, + 'select-disabled' : { + title : 'Disabled select ', + component : SelectDisabledExample, + additionalFiles: null, + selectorName : null + }, + 'select-error-state-matcher' : { + title : 'Select with a custom ErrorStateMatcher ', + component : SelectErrorStateMatcherExample, + additionalFiles: null, + selectorName : null + }, 'select-form' : { title : 'Select in a form', component : SelectFormExample, additionalFiles: null, selectorName : null }, + 'select-hint-error' : { + title : 'Select with form field features ', + component : SelectHintErrorExample, + additionalFiles: null, + selectorName : null + }, + 'select-multiple' : { + title : 'Select with multiple selection ', + component : SelectMultipleExample, + additionalFiles: null, + selectorName : null + }, + 'select-no-ripple' : { + title : 'Select with no option ripple ', + component : SelectNoRippleExample, + additionalFiles: null, + selectorName : null + }, + 'select-optgroup' : { + title : 'Select with option groups ', + component : SelectOptgroupExample, + additionalFiles: null, + selectorName : null + }, 'select-overview' : { title : 'Basic select', component : SelectOverviewExample, additionalFiles: null, selectorName : null }, + 'select-panel-class' : { + title : 'Select with custom panel styling', + component : SelectPanelClassExample, + additionalFiles: null, + selectorName : null + }, + 'select-reset' : { + title : 'Select with reset option ', + component : SelectResetExample, + additionalFiles: null, + selectorName : null + }, + 'select-value-binding' : { + title : 'Select with 2-way value binding ', + component : SelectValueBindingExample, + additionalFiles: null, + selectorName : null + }, 'sidenav-fab' : { title : 'Sidenav with a FAB', component : SidenavFabExample, @@ -678,7 +856,7 @@ export const EXAMPLE_COMPONENTS = { selectorName : null }, 'table-overview' : { - title : 'Feature-rich data table', + title : 'Data table with sorting, pagination, and filtering.', component : TableOverviewExample, additionalFiles: null, selectorName : null @@ -751,19 +929,22 @@ export const EXAMPLE_LIST = [ ChipsOverviewExample, ChipsStackedExample, DatepickerApiExample, + DatepickerDisabledExample, + DatepickerEventsExample, DatepickerFilterExample, + DatepickerFormatsExample, + DatepickerLocaleExample, DatepickerMinMaxExample, + DatepickerMomentExample, DatepickerOverviewExample, DatepickerStartViewExample, DatepickerTouchExample, - DialogContentExampleDialog, - DialogContentExample, - DialogDataExampleDialog, - DialogDataExample, - DialogElementsExampleDialog, - DialogElementsExample, - DialogOverviewExampleDialog, - DialogOverviewExample, + DatepickerValueExample, + DialogContentExampleDialog, DialogContentExample, + DialogDataExampleDialog, DialogDataExample, + DialogElementsExampleDialog, DialogElementsExample, + DialogOverviewExampleDialog, DialogOverviewExample, + ElevationOverviewExample, ExpansionOverviewExample, ExpansionStepsExample, MyTelInput, FormFieldCustomControlExample, @@ -777,7 +958,9 @@ export const EXAMPLE_LIST = [ GridListOverviewExample, IconOverviewExample, IconSvgExample, + InputAutosizeTextareaExample, InputClearableExample, + InputErrorStateMatcherExample, InputErrorsExample, InputFormExample, InputHintExample, @@ -791,14 +974,27 @@ export const EXAMPLE_LIST = [ NestedMenuExample, PaginatorConfigurableExample, PaginatorOverviewExample, + ProgressBarBufferExample, ProgressBarConfigurableExample, - ProgressBarOverviewExample, + ProgressBarDeterminateExample, + ProgressBarIndeterminateExample, + ProgressBarQueryExample, ProgressSpinnerConfigurableExample, ProgressSpinnerOverviewExample, RadioNgModelExample, RadioOverviewExample, + SelectCustomTriggerExample, + SelectDisabledExample, + SelectErrorStateMatcherExample, SelectFormExample, + SelectHintErrorExample, + SelectMultipleExample, + SelectNoRippleExample, + SelectOptgroupExample, SelectOverviewExample, + SelectPanelClassExample, + SelectResetExample, + SelectValueBindingExample, SidenavFabExample, SidenavOverviewExample, SlideToggleConfigurableExample, diff --git a/src/app/navigation.model.ts b/src/app/navigation.model.ts index f8bbd401..db9d78c8 100644 --- a/src/app/navigation.model.ts +++ b/src/app/navigation.model.ts @@ -649,6 +649,12 @@ export class NavigationModel 'type' : 'item', 'url' : '/components/angular-material/tabs' }, + { + 'id' : 'elevation', + 'title': 'Elevation', + 'type' : 'item', + 'url' : '/components/angular-material/elevation' + }, { 'id' : 'expansion-panel', 'title': 'Expansion Panel', diff --git a/src/assets/angular-material-examples/chips-input/chips-input-example.ts b/src/assets/angular-material-examples/chips-input/chips-input-example.ts index 6a383c63..6ec6bd3a 100644 --- a/src/assets/angular-material-examples/chips-input/chips-input-example.ts +++ b/src/assets/angular-material-examples/chips-input/chips-input-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; import { MatChipInputEvent } from '@angular/material'; -import { ENTER } from '@angular/cdk/keycodes'; - -const COMMA = 188; +import { ENTER, COMMA } from '@angular/cdk/keycodes'; /** * @title Chips with input diff --git a/src/assets/angular-material-examples/chips-stacked/chips-stacked-example.ts b/src/assets/angular-material-examples/chips-stacked/chips-stacked-example.ts index 51d0c411..7120ac7a 100644 --- a/src/assets/angular-material-examples/chips-stacked/chips-stacked-example.ts +++ b/src/assets/angular-material-examples/chips-stacked/chips-stacked-example.ts @@ -13,16 +13,20 @@ export class ChipsStackedExample color: string; availableColors = [ - {name : 'none', + { + name : 'none', color: '' }, - {name : 'Primary', + { + name : 'Primary', color: 'primary' }, - {name : 'Accent', + { + name : 'Accent', color: 'accent' }, - {name : 'Warn', + { + name : 'Warn', color: 'warn' } ]; diff --git a/src/assets/angular-material-examples/datepicker-api/datepicker-api-example.ts b/src/assets/angular-material-examples/datepicker-api/datepicker-api-example.ts index c2cac215..5e668aa7 100644 --- a/src/assets/angular-material-examples/datepicker-api/datepicker-api-example.ts +++ b/src/assets/angular-material-examples/datepicker-api/datepicker-api-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; -/** - * @title Datepicker API - */ +/** @title Datepicker open method */ @Component({ selector : 'datepicker-api-example', templateUrl: 'datepicker-api-example.html', diff --git a/src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.css b/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.css similarity index 100% rename from src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.css rename to src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.css diff --git a/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.html b/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.html new file mode 100644 index 00000000..b8c2ba39 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.html @@ -0,0 +1,23 @@ +

+ + + + + +

+ +

+ + + + + +

+ +

+ + + + + +

diff --git a/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.ts b/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.ts new file mode 100644 index 00000000..82a999dd --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-disabled/datepicker-disabled-example.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +/** @title Disabled datepicker */ +@Component({ + selector : 'datepicker-disabled-example', + templateUrl: 'datepicker-disabled-example.html', + styleUrls : ['datepicker-disabled-example.css'] +}) +export class DatepickerDisabledExample +{ +} diff --git a/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.css b/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.css new file mode 100644 index 00000000..33ff1dba --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.css @@ -0,0 +1,6 @@ +.example-events { + width: 400px; + height: 200px; + border: 1px solid #555; + overflow: auto; +} diff --git a/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.html b/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.html new file mode 100644 index 00000000..835163ea --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.html @@ -0,0 +1,10 @@ + + + + + + +
+
{{e}}
+
diff --git a/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.ts b/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.ts new file mode 100644 index 00000000..c8616000 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-events/datepicker-events-example.ts @@ -0,0 +1,18 @@ +import { Component } from '@angular/core'; +import { MatDatepickerInputEvent } from '@angular/material/datepicker'; + +/** @title Datepicker input and change events */ +@Component({ + selector : 'datepicker-events-example', + templateUrl: 'datepicker-events-example.html', + styleUrls : ['datepicker-events-example.css'] +}) +export class DatepickerEventsExample +{ + events: string[] = []; + + addEvent(type: string, event: MatDatepickerInputEvent) + { + this.events.push(`${type}: ${event.value}`); + } +} diff --git a/src/assets/angular-material-examples/datepicker-filter/datepicker-filter-example.ts b/src/assets/angular-material-examples/datepicker-filter/datepicker-filter-example.ts index ebe82cc5..1355dbf5 100644 --- a/src/assets/angular-material-examples/datepicker-filter/datepicker-filter-example.ts +++ b/src/assets/angular-material-examples/datepicker-filter/datepicker-filter-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; -/** - * @title Datepicker Filter - */ +/** @title Datepicker with filter validation */ @Component({ selector : 'datepicker-filter-example', templateUrl: 'datepicker-filter-example.html', diff --git a/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.css b/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.html b/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.html new file mode 100644 index 00000000..42f7396e --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.html @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.ts b/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.ts new file mode 100644 index 00000000..9693f252 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-formats/datepicker-formats-example.ts @@ -0,0 +1,44 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; +import { MomentDateAdapter } from '@angular/material-moment-adapter'; +import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; + +import * as moment from 'moment'; + +// See the Moment.js docs for the meaning of these formats: +// https://momentjs.com/docs/#/displaying/format/ +export const MY_FORMATS = { + parse : { + dateInput: 'LL' + }, + display: { + dateInput : 'LL', + monthYearLabel : 'MMM YYYY', + dateA11yLabel : 'LL', + monthYearA11yLabel: 'MMMM YYYY' + } +}; + +/** @title Datepicker with custom formats */ +@Component({ + selector : 'datepicker-formats-example', + templateUrl: 'datepicker-formats-example.html', + styleUrls : ['datepicker-formats-example.css'], + providers : [ + // `MomentDateAdapter` can be automatically provided by importing `MomentDateModule` in your + // application's root module. We provide it at the component level here, due to limitations of + // our example generation script. + {provide : DateAdapter, + useClass: MomentDateAdapter, + deps : [MAT_DATE_LOCALE] + }, + + {provide : MAT_DATE_FORMATS, + useValue: MY_FORMATS + } + ] +}) +export class DatepickerFormatsExample +{ + date = new FormControl(moment()); +} diff --git a/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.css b/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.html b/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.html new file mode 100644 index 00000000..dbd1bbb3 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.ts b/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.ts new file mode 100644 index 00000000..97859b92 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-locale/datepicker-locale-example.ts @@ -0,0 +1,42 @@ +import { Component } from '@angular/core'; +import { MAT_MOMENT_DATE_FORMATS, MomentDateAdapter } from '@angular/material-moment-adapter'; +import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; + +/** @title Datepicker with different locale */ +@Component({ + selector : 'datepicker-locale-example', + templateUrl: 'datepicker-locale-example.html', + styleUrls : ['datepicker-locale-example.css'], + providers : [ + // The locale would typically be provided on the root module of your application. We do it at + // the component level here, due to limitations of our example generation script. + { + provide : MAT_DATE_LOCALE, + useValue: 'ja-JP' + }, + + // `MomentDateAdapter` and `MAT_MOMENT_DATE_FORMATS` can be automatically provided by importing + // `MatMomentDateModule` in your applications root module. We provide it at the component level + // here, due to limitations of our example generation script. + { + provide : DateAdapter, + useClass: MomentDateAdapter, + deps : [MAT_DATE_LOCALE] + }, + { + provide : MAT_DATE_FORMATS, + useValue: MAT_MOMENT_DATE_FORMATS + } + ] +}) +export class DatepickerLocaleExample +{ + constructor(private adapter: DateAdapter) + { + } + + french() + { + this.adapter.setLocale('fr'); + } +} diff --git a/src/assets/angular-material-examples/datepicker-min-max/datepicker-min-max-example.ts b/src/assets/angular-material-examples/datepicker-min-max/datepicker-min-max-example.ts index 8bcc6fae..c37c261a 100644 --- a/src/assets/angular-material-examples/datepicker-min-max/datepicker-min-max-example.ts +++ b/src/assets/angular-material-examples/datepicker-min-max/datepicker-min-max-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; -/** - * @title Datepicker Min Max - */ +/** @title Datepicker with min & max validation */ @Component({ selector : 'datepicker-min-max-example', templateUrl: 'datepicker-min-max-example.html', diff --git a/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.css b/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.html b/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.html new file mode 100644 index 00000000..356fe317 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.html @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.ts b/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.ts new file mode 100644 index 00000000..a66d4849 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-moment/datepicker-moment-example.ts @@ -0,0 +1,32 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; +import { MAT_MOMENT_DATE_FORMATS, MomentDateAdapter } from '@angular/material-moment-adapter'; +import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; + +import * as moment from 'moment'; + +/** @title Datepicker that uses Moment.js dates */ +@Component({ + selector : 'datepicker-moment-example', + templateUrl: 'datepicker-moment-example.html', + styleUrls : ['datepicker-moment-example.css'], + providers : [ + // `MomentDateAdapter` and `MAT_MOMENT_DATE_FORMATS` can be automatically provided by importing + // `MatMomentDateModule` in your applications root module. We provide it at the component level + // here, due to limitations of our example generation script. + { + provide : DateAdapter, + useClass: MomentDateAdapter, + deps : [MAT_DATE_LOCALE] + }, + { + provide : MAT_DATE_FORMATS, + useValue: MAT_MOMENT_DATE_FORMATS + } + ] +}) +export class DatepickerMomentExample +{ + // Datepicker takes `Moment` objects instead of `Date` objects. + date = new FormControl(moment([2017, 0, 1])); +} diff --git a/src/assets/angular-material-examples/datepicker-overview/datepicker-overview-example.ts b/src/assets/angular-material-examples/datepicker-overview/datepicker-overview-example.ts index f77ade6b..8a7e6259 100644 --- a/src/assets/angular-material-examples/datepicker-overview/datepicker-overview-example.ts +++ b/src/assets/angular-material-examples/datepicker-overview/datepicker-overview-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; -/** - * @title Basic datepicker - */ +/** @title Basic datepicker */ @Component({ selector : 'datepicker-overview-example', templateUrl: 'datepicker-overview-example.html', diff --git a/src/assets/angular-material-examples/datepicker-start-view/datepicker-start-view-example.ts b/src/assets/angular-material-examples/datepicker-start-view/datepicker-start-view-example.ts index 57264dad..40444759 100644 --- a/src/assets/angular-material-examples/datepicker-start-view/datepicker-start-view-example.ts +++ b/src/assets/angular-material-examples/datepicker-start-view/datepicker-start-view-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; -/** - * @title Datepicker start date - */ +/** @title Datepicker start date */ @Component({ selector : 'datepicker-start-view-example', templateUrl: 'datepicker-start-view-example.html', diff --git a/src/assets/angular-material-examples/datepicker-touch/datepicker-touch-example.ts b/src/assets/angular-material-examples/datepicker-touch/datepicker-touch-example.ts index 4a4732a5..f4e00774 100644 --- a/src/assets/angular-material-examples/datepicker-touch/datepicker-touch-example.ts +++ b/src/assets/angular-material-examples/datepicker-touch/datepicker-touch-example.ts @@ -1,8 +1,6 @@ import { Component } from '@angular/core'; -/** - * @title Datepicker Touch - */ +/** @title Datepicker touch UI */ @Component({ selector : 'datepicker-touch-example', templateUrl: 'datepicker-touch-example.html', diff --git a/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.css b/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.html b/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.html new file mode 100644 index 00000000..8d001e84 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + diff --git a/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.ts b/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.ts new file mode 100644 index 00000000..6ba7d133 --- /dev/null +++ b/src/assets/angular-material-examples/datepicker-value/datepicker-value-example.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; + +/** @title Datepicker selected value */ +@Component({ + selector : 'datepicker-value-example', + templateUrl: 'datepicker-value-example.html', + styleUrls : ['datepicker-value-example.css'] +}) +export class DatepickerValueExample +{ + date = new FormControl(new Date()); + serializedDate = new FormControl((new Date()).toISOString()); +} diff --git a/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.css b/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.css new file mode 100644 index 00000000..60b1fa73 --- /dev/null +++ b/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.css @@ -0,0 +1,4 @@ +.example-container { + padding: 16px; + margin-bottom: 16px; +} diff --git a/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.html b/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.html new file mode 100644 index 00000000..0477751b --- /dev/null +++ b/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.html @@ -0,0 +1,7 @@ +
+ Example +
+ + diff --git a/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.ts b/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.ts new file mode 100644 index 00000000..94dcbc09 --- /dev/null +++ b/src/assets/angular-material-examples/elevation-overview/elevation-overview-example.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; + +/** + * @title Elevation CSS classes + */ +@Component({ + selector : 'elevation-overview-example', + styleUrls : ['elevation-overview-example.css'], + templateUrl: 'elevation-overview-example.html' +}) +export class ElevationOverviewExample +{ + isActive = false; +} diff --git a/src/assets/angular-material-examples/form-field-custom-control/form-field-custom-control-example.ts b/src/assets/angular-material-examples/form-field-custom-control/form-field-custom-control-example.ts index e9e62c24..686116e1 100644 --- a/src/assets/angular-material-examples/form-field-custom-control/form-field-custom-control-example.ts +++ b/src/assets/angular-material-examples/form-field-custom-control/form-field-custom-control-example.ts @@ -165,12 +165,12 @@ export class MyTelInput implements MatFormFieldControl, OnDestroy @Component({ selector: 'form-field-custom-control-example', template: ` - - - phone - Include area code - - ` + + + phone + Include area code + + ` }) export class FormFieldCustomControlExample { diff --git a/src/assets/angular-material-examples/form-field-theming/form-field-theming-example.html b/src/assets/angular-material-examples/form-field-theming/form-field-theming-example.html index 085adc53..7ac9bbcd 100644 --- a/src/assets/angular-material-examples/form-field-theming/form-field-theming-example.html +++ b/src/assets/angular-material-examples/form-field-theming/form-field-theming-example.html @@ -9,6 +9,6 @@ - Min size: 10px + Min size: 10px diff --git a/src/assets/angular-material-examples/grid-list-dynamic/grid-list-dynamic-example.ts b/src/assets/angular-material-examples/grid-list-dynamic/grid-list-dynamic-example.ts index 0cf1626c..9886d0b5 100644 --- a/src/assets/angular-material-examples/grid-list-dynamic/grid-list-dynamic-example.ts +++ b/src/assets/angular-material-examples/grid-list-dynamic/grid-list-dynamic-example.ts @@ -10,22 +10,26 @@ import { Component } from '@angular/core'; export class GridListDynamicExample { tiles = [ - {text : 'One', + { + text : 'One', cols : 3, rows : 1, color: 'lightblue' }, - {text : 'Two', + { + text : 'Two', cols : 1, rows : 2, color: 'lightgreen' }, - {text : 'Three', + { + text : 'Three', cols : 1, rows : 1, color: 'lightpink' }, - {text : 'Four', + { + text : 'Four', cols : 2, rows : 1, color: '#DDBDF1' diff --git a/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.css b/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.html b/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.html new file mode 100644 index 00000000..e9487d20 --- /dev/null +++ b/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.html @@ -0,0 +1,4 @@ + + + diff --git a/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.ts b/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.ts new file mode 100644 index 00000000..1ac3606e --- /dev/null +++ b/src/assets/angular-material-examples/input-autosize-textarea/input-autosize-textarea-example.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +/** @title Auto-resizing textarea */ +@Component({ + selector : 'input-autosize-textarea-example', + templateUrl: './input-autosize-textarea-example.html', + styleUrls : ['./input-autosize-textarea-example.css'] +}) +export class InputAutosizeTextareaExample +{ +} diff --git a/src/assets/angular-material-examples/input-clearable/input-clearable-example.ts b/src/assets/angular-material-examples/input-clearable/input-clearable-example.ts index f240bf0d..8fdf3a50 100644 --- a/src/assets/angular-material-examples/input-clearable/input-clearable-example.ts +++ b/src/assets/angular-material-examples/input-clearable/input-clearable-example.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; /** - * @title Input Clearable + * @title Input with a clear button */ @Component({ selector : 'input-clearable-example', diff --git a/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.css b/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.css new file mode 100644 index 00000000..7a2e5016 --- /dev/null +++ b/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.css @@ -0,0 +1,9 @@ +.example-form { + min-width: 150px; + max-width: 500px; + width: 100%; +} + +.example-full-width { + width: 100%; +} diff --git a/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.html b/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.html new file mode 100644 index 00000000..da1c9622 --- /dev/null +++ b/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.html @@ -0,0 +1,13 @@ +
+ + + Errors appear instantly! + + Please enter a valid email address + + + Email is required + + +
diff --git a/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.ts b/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.ts new file mode 100644 index 00000000..ad7e542d --- /dev/null +++ b/src/assets/angular-material-examples/input-error-state-matcher/input-error-state-matcher-example.ts @@ -0,0 +1,29 @@ +import { Component } from '@angular/core'; +import { FormControl, FormGroupDirective, NgForm, Validators } from '@angular/forms'; +import { ErrorStateMatcher } from '@angular/material/core'; + +/** Error when invalid control is dirty, touched, or submitted. */ +export class MyErrorStateMatcher implements ErrorStateMatcher +{ + isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean + { + const isSubmitted = form && form.submitted; + return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted)); + } +} + +/** @title Input with a custom ErrorStateMatcher */ +@Component({ + selector : 'input-error-state-matcher-example', + templateUrl: './input-error-state-matcher-example.html', + styleUrls : ['./input-error-state-matcher-example.css'] +}) +export class InputErrorStateMatcherExample +{ + emailFormControl = new FormControl('', [ + Validators.required, + Validators.email + ]); + + matcher = new MyErrorStateMatcher(); +} diff --git a/src/assets/angular-material-examples/input-errors/input-errors-example.html b/src/assets/angular-material-examples/input-errors/input-errors-example.html index 24c0c93a..2c72c98b 100644 --- a/src/assets/angular-material-examples/input-errors/input-errors-example.html +++ b/src/assets/angular-material-examples/input-errors/input-errors-example.html @@ -1,7 +1,7 @@
- + Please enter a valid email address diff --git a/src/assets/angular-material-examples/input-errors/input-errors-example.ts b/src/assets/angular-material-examples/input-errors/input-errors-example.ts index 59200fbb..9be64f28 100644 --- a/src/assets/angular-material-examples/input-errors/input-errors-example.ts +++ b/src/assets/angular-material-examples/input-errors/input-errors-example.ts @@ -1,10 +1,8 @@ import { Component } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; -const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; - /** - * @title Input Errors + * @title Input with error messages */ @Component({ selector : 'input-errors-example', @@ -13,10 +11,8 @@ const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA }) export class InputErrorsExample { - emailFormControl = new FormControl('', [ Validators.required, - Validators.pattern(EMAIL_REGEX) + Validators.email ]); - } diff --git a/src/assets/angular-material-examples/input-hint/input-hint-example.ts b/src/assets/angular-material-examples/input-hint/input-hint-example.ts index d8f0737b..96552d91 100644 --- a/src/assets/angular-material-examples/input-hint/input-hint-example.ts +++ b/src/assets/angular-material-examples/input-hint/input-hint-example.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; /** - * @title Input hints + * @title Input with hints */ @Component({ selector : 'input-hint-example', diff --git a/src/assets/angular-material-examples/input-overview/input-overview-example.html b/src/assets/angular-material-examples/input-overview/input-overview-example.html index e577897f..9667ace5 100644 --- a/src/assets/angular-material-examples/input-overview/input-overview-example.html +++ b/src/assets/angular-material-examples/input-overview/input-overview-example.html @@ -2,4 +2,8 @@ + + + + diff --git a/src/assets/angular-material-examples/input-prefix-suffix/input-prefix-suffix-example.ts b/src/assets/angular-material-examples/input-prefix-suffix/input-prefix-suffix-example.ts index 279792f8..decde83f 100644 --- a/src/assets/angular-material-examples/input-prefix-suffix/input-prefix-suffix-example.ts +++ b/src/assets/angular-material-examples/input-prefix-suffix/input-prefix-suffix-example.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core'; /** - * @title Input Prefixes and Suffixes + * @title Inputs with prefixes and suffixes */ @Component({ selector : 'input-prefix-suffix-example', diff --git a/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.css b/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.html b/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.html new file mode 100644 index 00000000..32c7d95e --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.html @@ -0,0 +1 @@ + diff --git a/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.ts b/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.ts new file mode 100644 index 00000000..1e893c02 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-buffer/progress-bar-buffer-example.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +/** + * @title Buffer progress-bar + */ +@Component({ + selector : 'progress-bar-buffer-example', + templateUrl: 'progress-bar-buffer-example.html' +}) +export class ProgressBarBufferExample +{ +} diff --git a/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.css b/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.html b/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.html new file mode 100644 index 00000000..905e8524 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.html @@ -0,0 +1 @@ + diff --git a/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.ts b/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.ts new file mode 100644 index 00000000..69ba1e7f --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-determinate/progress-bar-determinate-example.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +/** + * @title Determinate progress-bar + */ +@Component({ + selector : 'progress-bar-determinate-example', + templateUrl: 'progress-bar-determinate-example.html' +}) +export class ProgressBarDeterminateExample +{ +} diff --git a/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.css b/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.html b/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.html similarity index 100% rename from src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.html rename to src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.html diff --git a/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.ts b/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.ts new file mode 100644 index 00000000..8029e813 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-indeterminate/progress-bar-indeterminate-example.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +/** + * @title Indeterminate progress-bar + */ +@Component({ + selector : 'progress-bar-indeterminate-example', + templateUrl: 'progress-bar-indeterminate-example.html' +}) +export class ProgressBarIndeterminateExample +{ +} diff --git a/src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.ts b/src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.ts deleted file mode 100644 index e2e35861..00000000 --- a/src/assets/angular-material-examples/progress-bar-overview/progress-bar-overview-example.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Component } from '@angular/core'; - -/** - * @title Basic progress-bar - */ -@Component({ - selector : 'progress-bar-overview-example', - templateUrl: 'progress-bar-overview-example.html' -}) -export class ProgressBarOverviewExample -{ -} diff --git a/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.css b/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.html b/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.html new file mode 100644 index 00000000..71ef7d54 --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.html @@ -0,0 +1 @@ + diff --git a/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.ts b/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.ts new file mode 100644 index 00000000..567ec67a --- /dev/null +++ b/src/assets/angular-material-examples/progress-bar-query/progress-bar-query-example.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +/** + * @title Query progress-bar + */ +@Component({ + selector : 'progress-bar-query-example', + templateUrl: 'progress-bar-query-example.html' +}) +export class ProgressBarQueryExample +{ +} diff --git a/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.css b/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.css new file mode 100644 index 00000000..a4ebf62f --- /dev/null +++ b/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.css @@ -0,0 +1,4 @@ +.example-additional-selection { + opacity: 0.75; + font-size: 0.75em; +} diff --git a/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.html b/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.html new file mode 100644 index 00000000..50ee0cea --- /dev/null +++ b/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.html @@ -0,0 +1,11 @@ + + + + {{toppings.value ? toppings.value[0] : ''}} + + (+{{toppings.value.length - 1}} others) + + + {{topping}} + + diff --git a/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.ts b/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.ts new file mode 100644 index 00000000..4ac8f7d5 --- /dev/null +++ b/src/assets/angular-material-examples/select-custom-trigger/select-custom-trigger-example.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; + +/** @title Select with custom trigger text */ +@Component({ + selector : 'select-custom-trigger-example', + templateUrl: 'select-custom-trigger-example.html', + styleUrls : ['select-custom-trigger-example.css'] +}) +export class SelectCustomTriggerExample +{ + toppings = new FormControl(); + + toppingList = ['Extra cheese', 'Mushroom', 'Onion', 'Pepperoni', 'Sausage', 'Tomato']; +} diff --git a/src/assets/angular-material-examples/select-disabled/select-disabled-example.css b/src/assets/angular-material-examples/select-disabled/select-disabled-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-disabled/select-disabled-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-disabled/select-disabled-example.html b/src/assets/angular-material-examples/select-disabled/select-disabled-example.html new file mode 100644 index 00000000..692d5d22 --- /dev/null +++ b/src/assets/angular-material-examples/select-disabled/select-disabled-example.html @@ -0,0 +1,12 @@ +

+ Disable select +

+

+ + + Option 1 + Option 2 (disabled) + Option 3 + + +

diff --git a/src/assets/angular-material-examples/select-disabled/select-disabled-example.ts b/src/assets/angular-material-examples/select-disabled/select-disabled-example.ts new file mode 100644 index 00000000..07eeaa94 --- /dev/null +++ b/src/assets/angular-material-examples/select-disabled/select-disabled-example.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; + +/** @title Disabled select */ +@Component({ + selector : 'select-disabled-example', + templateUrl: 'select-disabled-example.html', + styleUrls : ['select-disabled-example.css'] +}) +export class SelectDisabledExample +{ + disableSelect = new FormControl(false); +} diff --git a/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.css b/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.html b/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.html new file mode 100644 index 00000000..7551ca97 --- /dev/null +++ b/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.html @@ -0,0 +1,12 @@ + + + Clear + Valid option + Invalid option + + Errors appear instantly! + You must make a selection + + Your selection is invalid + + diff --git a/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.ts b/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.ts new file mode 100644 index 00000000..c3957f6b --- /dev/null +++ b/src/assets/angular-material-examples/select-error-state-matcher/select-error-state-matcher-example.ts @@ -0,0 +1,29 @@ +import { Component } from '@angular/core'; +import { FormControl, FormGroupDirective, NgForm, Validators } from '@angular/forms'; +import { ErrorStateMatcher } from '@angular/material/core'; + +/** Error when invalid control is dirty, touched, or submitted. */ +export class MyErrorStateMatcher implements ErrorStateMatcher +{ + isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean + { + const isSubmitted = form && form.submitted; + return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted)); + } +} + +/** @title Select with a custom ErrorStateMatcher */ +@Component({ + selector : 'select-error-state-matcher-example', + templateUrl: 'select-error-state-matcher-example.html', + styleUrls : ['select-error-state-matcher-example.css'] +}) +export class SelectErrorStateMatcherExample +{ + selected = new FormControl('valid', [ + Validators.required, + Validators.pattern('valid') + ]); + + matcher = new MyErrorStateMatcher(); +} diff --git a/src/assets/angular-material-examples/select-form/select-form-example.ts b/src/assets/angular-material-examples/select-form/select-form-example.ts index afd365ae..94321ea5 100644 --- a/src/assets/angular-material-examples/select-form/select-form-example.ts +++ b/src/assets/angular-material-examples/select-form/select-form-example.ts @@ -5,20 +5,24 @@ import { Component } from '@angular/core'; */ @Component({ selector : 'select-form-example', - templateUrl: 'select-form-example.html' + templateUrl: 'select-form-example.html', + styleUrls : ['select-form-example.css'] }) export class SelectFormExample { selectedValue: string; foods = [ - {value : 'steak-0', + { + value : 'steak-0', viewValue: 'Steak' }, - {value : 'pizza-1', + { + value : 'pizza-1', viewValue: 'Pizza' }, - {value : 'tacos-2', + { + value : 'tacos-2', viewValue: 'Tacos' } ]; diff --git a/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.css b/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.html b/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.html new file mode 100644 index 00000000..254253eb --- /dev/null +++ b/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.html @@ -0,0 +1,10 @@ + + + -- + + {{animal.name}} + + + Please choose an animal + {{animalControl.value?.sound}} + diff --git a/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.ts b/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.ts new file mode 100644 index 00000000..74e9eb1f --- /dev/null +++ b/src/assets/angular-material-examples/select-hint-error/select-hint-error-example.ts @@ -0,0 +1,32 @@ +import { Component } from '@angular/core'; +import { FormControl, Validators } from '@angular/forms'; + +/** @title Select with form field features */ +@Component({ + selector : 'select-hint-error-example', + templateUrl: 'select-hint-error-example.html', + styleUrls : ['select-hint-error-example.css'] +}) +export class SelectHintErrorExample +{ + animalControl = new FormControl('', [Validators.required]); + + animals = [ + { + name : 'Dog', + sound: 'Woof!' + }, + { + name : 'Cat', + sound: 'Meow!' + }, + { + name : 'Cow', + sound: 'Moo!' + }, + { + name : 'Fox', + sound: 'Wa-pa-pa-pa-pa-pa-pow!' + } + ]; +} diff --git a/src/assets/angular-material-examples/select-multiple/select-multiple-example.css b/src/assets/angular-material-examples/select-multiple/select-multiple-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-multiple/select-multiple-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-multiple/select-multiple-example.html b/src/assets/angular-material-examples/select-multiple/select-multiple-example.html new file mode 100644 index 00000000..6056d9af --- /dev/null +++ b/src/assets/angular-material-examples/select-multiple/select-multiple-example.html @@ -0,0 +1,5 @@ + + + {{topping}} + + diff --git a/src/assets/angular-material-examples/select-multiple/select-multiple-example.ts b/src/assets/angular-material-examples/select-multiple/select-multiple-example.ts new file mode 100644 index 00000000..9c33296d --- /dev/null +++ b/src/assets/angular-material-examples/select-multiple/select-multiple-example.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; + +/** @title Select with multiple selection */ +@Component({ + selector : 'select-multiple-example', + templateUrl: 'select-multiple-example.html', + styleUrls : ['select-multiple-example.css'] +}) +export class SelectMultipleExample +{ + toppings = new FormControl(); + + toppingList = ['Extra cheese', 'Mushroom', 'Onion', 'Pepperoni', 'Sausage', 'Tomato']; +} diff --git a/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.css b/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.html b/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.html new file mode 100644 index 00000000..644d1ee6 --- /dev/null +++ b/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.html @@ -0,0 +1,7 @@ + + + Option 1 + Option 2 + Option 3 + + diff --git a/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.ts b/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.ts new file mode 100644 index 00000000..cfab0f3d --- /dev/null +++ b/src/assets/angular-material-examples/select-no-ripple/select-no-ripple-example.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +/** @title Select with no option ripple */ +@Component({ + selector : 'select-no-ripple-example', + templateUrl: 'select-no-ripple-example.html', + styleUrls : ['select-no-ripple-example.css'] +}) +export class SelectNoRippleExample +{ +} diff --git a/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.css b/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.html b/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.html new file mode 100644 index 00000000..9ffa0891 --- /dev/null +++ b/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.html @@ -0,0 +1,11 @@ + + + -- None -- + + + {{ pokemon.viewValue }} + + + + diff --git a/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.ts b/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.ts new file mode 100644 index 00000000..0e32bd1b --- /dev/null +++ b/src/assets/angular-material-examples/select-optgroup/select-optgroup-example.ts @@ -0,0 +1,81 @@ +import { Component } from '@angular/core'; +import { FormControl } from '@angular/forms'; + +/** @title Select with option groups */ +@Component({ + selector : 'select-optgroup-example', + templateUrl: 'select-optgroup-example.html', + styleUrls : ['select-optgroup-example.css'] +}) +export class SelectOptgroupExample +{ + pokemonControl = new FormControl(); + + pokemonGroups = [ + { + name : 'Grass', + pokemon: [ + { + value : 'bulbasaur-0', + viewValue: 'Bulbasaur' + }, + { + value : 'oddish-1', + viewValue: 'Oddish' + }, + { + value : 'bellsprout-2', + viewValue: 'Bellsprout' + } + ] + }, + { + name : 'Water', + pokemon: [ + { + value : 'squirtle-3', + viewValue: 'Squirtle' + }, + { + value : 'psyduck-4', + viewValue: 'Psyduck' + }, + { + value : 'horsea-5', + viewValue: 'Horsea' + } + ] + }, + { + name : 'Fire', + disabled: true, + pokemon : [ + { + value : 'charmander-6', + viewValue: 'Charmander' + }, + { + value : 'vulpix-7', + viewValue: 'Vulpix' + }, + { + value : 'flareon-8', + viewValue: 'Flareon' + } + ] + }, + { + name : 'Psychic', + pokemon: [ + { + value : 'mew-9', + viewValue: 'Mew' + }, + { + value : 'mewtwo-10', + viewValue: 'Mewtwo' + } + ] + } + ]; +} diff --git a/src/assets/angular-material-examples/select-overview/select-overview-example.ts b/src/assets/angular-material-examples/select-overview/select-overview-example.ts index 7e88e407..53efe178 100644 --- a/src/assets/angular-material-examples/select-overview/select-overview-example.ts +++ b/src/assets/angular-material-examples/select-overview/select-overview-example.ts @@ -5,18 +5,22 @@ import { Component } from '@angular/core'; */ @Component({ selector : 'select-overview-example', - templateUrl: 'select-overview-example.html' + templateUrl: 'select-overview-example.html', + styleUrls : ['select-overview-example.css'] }) export class SelectOverviewExample { foods = [ - {value : 'steak-0', + { + value : 'steak-0', viewValue: 'Steak' }, - {value : 'pizza-1', + { + value : 'pizza-1', viewValue: 'Pizza' }, - {value : 'tacos-2', + { + value : 'tacos-2', viewValue: 'Tacos' } ]; diff --git a/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.css b/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.css new file mode 100644 index 00000000..750bfabc --- /dev/null +++ b/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.css @@ -0,0 +1,11 @@ +.example-panel-red .mat-select-content { + background: rgba(255, 0, 0, 0.5); +} + +.example-panel-green .mat-select-content { + background: rgba(0, 255, 0, 0.5); +} + +.example-panel-blue .mat-select-content { + background: rgba(0, 0, 255, 0.5); +} diff --git a/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.html b/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.html new file mode 100644 index 00000000..5e3aaef2 --- /dev/null +++ b/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.html @@ -0,0 +1,8 @@ + + + Red + Green + Blue + + diff --git a/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.ts b/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.ts new file mode 100644 index 00000000..c87965d9 --- /dev/null +++ b/src/assets/angular-material-examples/select-panel-class/select-panel-class-example.ts @@ -0,0 +1,16 @@ +import { Component, ViewEncapsulation } from '@angular/core'; +import { FormControl } from '@angular/forms'; + +/** + * @title Select with custom panel styling + */ +@Component({ + selector : 'select-panel-class-example', + templateUrl : 'select-panel-class-example.html', + styleUrls : ['select-panel-class-example.css'], + encapsulation: ViewEncapsulation.None +}) +export class SelectPanelClassExample +{ + panelColor = new FormControl('red'); +} diff --git a/src/assets/angular-material-examples/select-reset/select-reset-example.css b/src/assets/angular-material-examples/select-reset/select-reset-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-reset/select-reset-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-reset/select-reset-example.html b/src/assets/angular-material-examples/select-reset/select-reset-example.html new file mode 100644 index 00000000..91c99388 --- /dev/null +++ b/src/assets/angular-material-examples/select-reset/select-reset-example.html @@ -0,0 +1,6 @@ + + + None + {{state}} + + diff --git a/src/assets/angular-material-examples/select-reset/select-reset-example.ts b/src/assets/angular-material-examples/select-reset/select-reset-example.ts new file mode 100644 index 00000000..6cf83795 --- /dev/null +++ b/src/assets/angular-material-examples/select-reset/select-reset-example.ts @@ -0,0 +1,20 @@ +import { Component } from '@angular/core'; + +/** @title Select with reset option */ +@Component({ + selector : 'select-reset-example', + templateUrl: 'select-reset-example.html', + styleUrls : ['select-reset-example.css'] +}) +export class SelectResetExample +{ + states = [ + 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', + 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', + 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', + 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', + 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', + 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', + 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming' + ]; +} diff --git a/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.css b/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.css new file mode 100644 index 00000000..74323087 --- /dev/null +++ b/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.css @@ -0,0 +1 @@ +/** No CSS for this example */ diff --git a/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.html b/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.html new file mode 100644 index 00000000..93e1d0b4 --- /dev/null +++ b/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.html @@ -0,0 +1,10 @@ + + + None + Option 1 + Option 2 + Option 3 + + + +

You selected: {{selected}}

diff --git a/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.ts b/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.ts new file mode 100644 index 00000000..3406f1fa --- /dev/null +++ b/src/assets/angular-material-examples/select-value-binding/select-value-binding-example.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +/** @title Select with 2-way value binding */ +@Component({ + selector : 'select-value-binding-example', + templateUrl: 'select-value-binding-example.html', + styleUrls : ['select-value-binding-example.css'] +}) +export class SelectValueBindingExample +{ + selected = 'option2'; +} diff --git a/src/assets/angular-material-examples/sort-overview/sort-overview-example.ts b/src/assets/angular-material-examples/sort-overview/sort-overview-example.ts index 939ead29..8e435c75 100644 --- a/src/assets/angular-material-examples/sort-overview/sort-overview-example.ts +++ b/src/assets/angular-material-examples/sort-overview/sort-overview-example.ts @@ -12,31 +12,36 @@ import { Sort } from '@angular/material'; export class SortOverviewExample { desserts = [ - {name : 'Frozen yogurt', + { + name : 'Frozen yogurt', calories: '159', fat : '6', carbs : '24', protein : '4' }, - {name : 'Ice cream sandwich', + { + name : 'Ice cream sandwich', calories: '237', fat : '9', carbs : '37', protein : '4' }, - {name : 'Eclair', + { + name : 'Eclair', calories: '262', fat : '16', carbs : '24', protein : '6' }, - {name : 'Cupcake', + { + name : 'Cupcake', calories: '305', fat : '4', carbs : '67', protein : '4' }, - {name : 'Gingerbread', + { + name : 'Gingerbread', calories: '356', fat : '16', carbs : '49', diff --git a/src/assets/angular-material-examples/table-basic/table-basic-example.ts b/src/assets/angular-material-examples/table-basic/table-basic-example.ts index acdca967..c768fa83 100644 --- a/src/assets/angular-material-examples/table-basic/table-basic-example.ts +++ b/src/assets/angular-material-examples/table-basic/table-basic-example.ts @@ -1,7 +1,5 @@ import { Component } from '@angular/core'; -import { DataSource } from '@angular/cdk/collections'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/observable/of'; +import { MatTableDataSource } from '@angular/material'; /** * @title Basic table @@ -14,7 +12,7 @@ import 'rxjs/add/observable/of'; export class TableBasicExample { displayedColumns = ['position', 'name', 'weight', 'symbol']; - dataSource = new ExampleDataSource(); + dataSource = new MatTableDataSource(ELEMENT_DATA); } export interface Element @@ -25,124 +23,125 @@ export interface Element symbol: string; } -const data: Element[] = [ - {position : 1, - name : 'Hydrogen', - weight: 1.0079, - symbol: 'H' +const ELEMENT_DATA: Element[] = [ + { + position: 1, + name : 'Hydrogen', + weight : 1.0079, + symbol : 'H' }, - {position : 2, - name : 'Helium', - weight: 4.0026, - symbol: 'He' + { + position: 2, + name : 'Helium', + weight : 4.0026, + symbol : 'He' }, - {position : 3, - name : 'Lithium', - weight: 6.941, - symbol: 'Li' + { + position: 3, + name : 'Lithium', + weight : 6.941, + symbol : 'Li' }, - {position : 4, - name : 'Beryllium', - weight: 9.0122, - symbol: 'Be' + { + position: 4, + name : 'Beryllium', + weight : 9.0122, + symbol : 'Be' }, - {position : 5, - name : 'Boron', - weight: 10.811, - symbol: 'B' + { + position: 5, + name : 'Boron', + weight : 10.811, + symbol : 'B' }, - {position : 6, - name : 'Carbon', - weight: 12.0107, - symbol: 'C' + { + position: 6, + name : 'Carbon', + weight : 12.0107, + symbol : 'C' }, - {position : 7, - name : 'Nitrogen', - weight: 14.0067, - symbol: 'N' + { + position: 7, + name : 'Nitrogen', + weight : 14.0067, + symbol : 'N' }, - {position : 8, - name : 'Oxygen', - weight: 15.9994, - symbol: 'O' + { + position: 8, + name : 'Oxygen', + weight : 15.9994, + symbol : 'O' }, - {position : 9, - name : 'Fluorine', - weight: 18.9984, - symbol: 'F' + { + position: 9, + name : 'Fluorine', + weight : 18.9984, + symbol : 'F' }, - {position : 10, - name : 'Neon', - weight: 20.1797, - symbol: 'Ne' + { + position: 10, + name : 'Neon', + weight : 20.1797, + symbol : 'Ne' }, - {position : 11, - name : 'Sodium', - weight: 22.9897, - symbol: 'Na' + { + position: 11, + name : 'Sodium', + weight : 22.9897, + symbol : 'Na' }, - {position : 12, - name : 'Magnesium', - weight: 24.305, - symbol: 'Mg' + { + position: 12, + name : 'Magnesium', + weight : 24.305, + symbol : 'Mg' }, - {position : 13, - name : 'Aluminum', - weight: 26.9815, - symbol: 'Al' + { + position: 13, + name : 'Aluminum', + weight : 26.9815, + symbol : 'Al' }, - {position : 14, - name : 'Silicon', - weight: 28.0855, - symbol: 'Si' + { + position: 14, + name : 'Silicon', + weight : 28.0855, + symbol : 'Si' }, - {position : 15, - name : 'Phosphorus', - weight: 30.9738, - symbol: 'P' + { + position: 15, + name : 'Phosphorus', + weight : 30.9738, + symbol : 'P' }, - {position : 16, - name : 'Sulfur', - weight: 32.065, - symbol: 'S' + { + position: 16, + name : 'Sulfur', + weight : 32.065, + symbol : 'S' }, - {position : 17, - name : 'Chlorine', - weight: 35.453, - symbol: 'Cl' + { + position: 17, + name : 'Chlorine', + weight : 35.453, + symbol : 'Cl' }, - {position : 18, - name : 'Argon', - weight: 39.948, - symbol: 'Ar' + { + position: 18, + name : 'Argon', + weight : 39.948, + symbol : 'Ar' }, - {position : 19, - name : 'Potassium', - weight: 39.0983, - symbol: 'K' + { + position: 19, + name : 'Potassium', + weight : 39.0983, + symbol : 'K' }, - {position : 20, - name : 'Calcium', - weight: 40.078, - symbol: 'Ca' + { + position: 20, + name : 'Calcium', + weight : 40.078, + symbol : 'Ca' } ]; - -/** - * Data source to provide what data should be rendered in the table. The observable provided - * in connect should emit exactly the data that should be rendered by the table. If the data is - * altered, the observable should emit that new set of data on the stream. In our case here, - * we return a stream that contains only one set of data that doesn't change. - */ -export class ExampleDataSource extends DataSource -{ - /** Connect function called by the table to retrieve one stream containing the data to render. */ - connect(): Observable - { - return Observable.of(data); - } - - disconnect() - { - } -} diff --git a/src/assets/angular-material-examples/table-filtering/table-filtering-example.css b/src/assets/angular-material-examples/table-filtering/table-filtering-example.css index 155058d1..26d5d392 100644 --- a/src/assets/angular-material-examples/table-filtering/table-filtering-example.css +++ b/src/assets/angular-material-examples/table-filtering/table-filtering-example.css @@ -7,17 +7,12 @@ .example-header { min-height: 64px; - display: flex; - align-items: baseline; padding: 8px 24px 0; - font-size: 20px; - justify-content: space-between; } .mat-form-field { font-size: 14px; - flex-grow: 1; - margin-left: 32px; + width: 100%; } .mat-table { diff --git a/src/assets/angular-material-examples/table-filtering/table-filtering-example.html b/src/assets/angular-material-examples/table-filtering/table-filtering-example.html index cd1964d3..abbc1009 100644 --- a/src/assets/angular-material-examples/table-filtering/table-filtering-example.html +++ b/src/assets/angular-material-examples/table-filtering/table-filtering-example.html @@ -1,37 +1,34 @@
- - + +
- - - - - ID - {{row.id}} - - - - - Progress - {{row.progress}}% + + + No. + {{element.position}} - + Name - {{row.name}} + {{element.name}} + + + + + Weight + {{element.weight}} - - Color - {{row.color}} + + Symbol + {{element.symbol}} diff --git a/src/assets/angular-material-examples/table-filtering/table-filtering-example.ts b/src/assets/angular-material-examples/table-filtering/table-filtering-example.ts index d00c5e3f..7b672fed 100644 --- a/src/assets/angular-material-examples/table-filtering/table-filtering-example.ts +++ b/src/assets/angular-material-examples/table-filtering/table-filtering-example.ts @@ -1,13 +1,5 @@ -import { Component, ElementRef, ViewChild } from '@angular/core'; -import { DataSource } from '@angular/cdk/collections'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/operator/startWith'; -import 'rxjs/add/observable/merge'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/debounceTime'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/observable/fromEvent'; +import { Component } from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; /** * @title Table with filtering @@ -19,134 +11,144 @@ import 'rxjs/add/observable/fromEvent'; }) export class TableFilteringExample { - displayedColumns = ['userId', 'userName', 'progress', 'color']; - exampleDatabase = new ExampleDatabase(); - dataSource: ExampleDataSource | null; + displayedColumns = ['position', 'name', 'weight', 'symbol']; + dataSource = new MatTableDataSource(ELEMENT_DATA); - @ViewChild('filter') filter: ElementRef; - - ngOnInit() + applyFilter(filterValue: string) { - this.dataSource = new ExampleDataSource(this.exampleDatabase); - Observable.fromEvent(this.filter.nativeElement, 'keyup') - .debounceTime(150) - .distinctUntilChanged() - .subscribe(() => { - if ( !this.dataSource ) - { - return; - } - this.dataSource.filter = this.filter.nativeElement.value; - }); + filterValue = filterValue.trim(); // Remove whitespace + filterValue = filterValue.toLowerCase(); // MatTableDataSource defaults to lowercase matches + this.dataSource.filter = filterValue; } } -/** Constants used to fill up our data base. */ -const COLORS = [ - 'maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple', - 'fuchsia', 'lime', 'teal', 'aqua', 'blue', 'navy', 'black', 'gray' -]; -const NAMES = [ - 'Maia', 'Asher', 'Olivia', 'Atticus', 'Amelia', 'Jack', - 'Charlotte', 'Theodore', 'Isla', 'Oliver', 'Isabella', 'Jasper', - 'Cora', 'Levi', 'Violet', 'Arthur', 'Mia', 'Thomas', 'Elizabeth' -]; - -export interface UserData +export interface Element { - id: string; name: string; - progress: string; - color: string; + position: number; + weight: number; + symbol: string; } -/** An example database that the data source uses to retrieve data for the table. */ -export class ExampleDatabase -{ - /** Stream that emits whenever the data has been modified. */ - dataChange: BehaviorSubject = new BehaviorSubject([]); - - get data(): UserData[] +const ELEMENT_DATA: Element[] = [ { - return this.dataChange.value; - } - - constructor() + position: 1, + name : 'Hydrogen', + weight : 1.0079, + symbol : 'H' + }, { - // Fill up the database with 100 users. - for ( let i = 0; i < 100; i++ ) - { - this.addUser(); - } - } - - /** Adds a new user to the database. */ - addUser() + position: 2, + name : 'Helium', + weight : 4.0026, + symbol : 'He' + }, { - const copiedData = this.data.slice(); - copiedData.push(this.createNewUser()); - this.dataChange.next(copiedData); - } - - /** Builds and returns a new User. */ - private createNewUser() + position: 3, + name : 'Lithium', + weight : 6.941, + symbol : 'Li' + }, { - const name = - NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' + - NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.'; - - return { - id : (this.data.length + 1).toString(), - name : name, - progress: Math.round(Math.random() * 100).toString(), - color : COLORS[Math.round(Math.random() * (COLORS.length - 1))] - }; - } -} - -/** - * Data source to provide what data should be rendered in the table. Note that the data source - * can retrieve its data in any way. In this case, the data source is provided a reference - * to a common data base, ExampleDatabase. It is not the data source's responsibility to manage - * the underlying data. Instead, it only needs to take the data and send the table exactly what - * should be rendered. - */ -export class ExampleDataSource extends DataSource -{ - _filterChange = new BehaviorSubject(''); - - get filter(): string + position: 4, + name : 'Beryllium', + weight : 9.0122, + symbol : 'Be' + }, { - return this._filterChange.value; - } - - set filter(filter: string) + position: 5, + name : 'Boron', + weight : 10.811, + symbol : 'B' + }, { - this._filterChange.next(filter); - } - - constructor(private _exampleDatabase: ExampleDatabase) + position: 6, + name : 'Carbon', + weight : 12.0107, + symbol : 'C' + }, { - super(); - } - - /** Connect function called by the table to retrieve one stream containing the data to render. */ - connect(): Observable + position: 7, + name : 'Nitrogen', + weight : 14.0067, + symbol : 'N' + }, { - const displayDataChanges = [ - this._exampleDatabase.dataChange, - this._filterChange - ]; - - return Observable.merge(...displayDataChanges).map(() => { - return this._exampleDatabase.data.slice().filter((item: UserData) => { - let searchStr = (item.name + item.color).toLowerCase(); - return searchStr.indexOf(this.filter.toLowerCase()) != -1; - }); - }); - } - - disconnect() + position: 8, + name : 'Oxygen', + weight : 15.9994, + symbol : 'O' + }, { + position: 9, + name : 'Fluorine', + weight : 18.9984, + symbol : 'F' + }, + { + position: 10, + name : 'Neon', + weight : 20.1797, + symbol : 'Ne' + }, + { + position: 11, + name : 'Sodium', + weight : 22.9897, + symbol : 'Na' + }, + { + position: 12, + name : 'Magnesium', + weight : 24.305, + symbol : 'Mg' + }, + { + position: 13, + name : 'Aluminum', + weight : 26.9815, + symbol : 'Al' + }, + { + position: 14, + name : 'Silicon', + weight : 28.0855, + symbol : 'Si' + }, + { + position: 15, + name : 'Phosphorus', + weight : 30.9738, + symbol : 'P' + }, + { + position: 16, + name : 'Sulfur', + weight : 32.065, + symbol : 'S' + }, + { + position: 17, + name : 'Chlorine', + weight : 35.453, + symbol : 'Cl' + }, + { + position: 18, + name : 'Argon', + weight : 39.948, + symbol : 'Ar' + }, + { + position: 19, + name : 'Potassium', + weight : 39.0983, + symbol : 'K' + }, + { + position: 20, + name : 'Calcium', + weight : 40.078, + symbol : 'Ca' } -} +]; diff --git a/src/assets/angular-material-examples/table-http/table-http-example.css b/src/assets/angular-material-examples/table-http/table-http-example.css index 4f7ac2f8..d1e89791 100644 --- a/src/assets/angular-material-examples/table-http/table-http-example.css +++ b/src/assets/angular-material-examples/table-http/table-http-example.css @@ -20,23 +20,6 @@ min-height: 300px; } -.mat-column-title { - text-overflow: ellipsis; - white-space: nowrap; - flex: 1; - overflow: hidden; -} - -/* Column Widths */ -.mat-column-number, -.mat-column-state { - max-width: 64px; -} - -.mat-column-created { - max-width: 124px; -} - .example-loading-shade { position: absolute; top: 0; @@ -55,3 +38,13 @@ max-width: 360px; text-align: center; } + +/* Column Widths */ +.mat-column-number, +.mat-column-state { + max-width: 64px; +} + +.mat-column-created { + max-width: 124px; +} diff --git a/src/assets/angular-material-examples/table-http/table-http-example.html b/src/assets/angular-material-examples/table-http/table-http-example.html index c18f5ac5..599f5281 100644 --- a/src/assets/angular-material-examples/table-http/table-http-example.html +++ b/src/assets/angular-material-examples/table-http/table-http-example.html @@ -1,14 +1,14 @@
- -
+ *ngIf="isLoadingResults || isRateLimitReached"> + +
GitHub's API rate limit has been reached. It will be reset in one minute.
+ matSort matSortActive="created" matSortDisableClear matSortDirection="asc"> @@ -32,7 +32,7 @@ - + @@ -45,7 +45,6 @@ - +
diff --git a/src/assets/angular-material-examples/table-http/table-http-example.ts b/src/assets/angular-material-examples/table-http/table-http-example.ts index a6848596..4f852bd2 100644 --- a/src/assets/angular-material-examples/table-http/table-http-example.ts +++ b/src/assets/angular-material-examples/table-http/table-http-example.ts @@ -1,7 +1,6 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; -import { Http } from '@angular/http'; -import { DataSource } from '@angular/cdk/collections'; -import { MatPaginator, MatSort } from '@angular/material'; +import { Component, AfterViewInit, ViewChild } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/merge'; import 'rxjs/add/observable/of'; @@ -18,24 +17,56 @@ import 'rxjs/add/operator/switchMap'; styleUrls : ['table-http-example.css'], templateUrl: 'table-http-example.html' }) -export class TableHttpExample implements OnInit +export class TableHttpExample implements AfterViewInit { - displayedColumns = ['created_at', 'state', 'number', 'title']; + displayedColumns = ['created', 'state', 'number', 'title']; exampleDatabase: ExampleHttpDao | null; - dataSource: ExampleDataSource | null; + dataSource = new MatTableDataSource(); + + resultsLength = 0; + isLoadingResults = false; + isRateLimitReached = false; @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; - constructor(private http: Http) + constructor(private http: HttpClient) { } - ngOnInit() + ngAfterViewInit() { this.exampleDatabase = new ExampleHttpDao(this.http); - this.dataSource = new ExampleDataSource( - this.exampleDatabase!, this.paginator, this.sort); + + // If the user changes the sort order, reset back to the first page. + this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0); + + Observable.merge(this.sort.sortChange, this.paginator.page) + .startWith(null) + .switchMap(() => { + setTimeout(() => { + this.isLoadingResults = true; + }); + return this.exampleDatabase!.getRepoIssues( + this.sort.active, this.sort.direction, this.paginator.pageIndex); + }) + .map(data => { + // Flip flag to show that loading has finished. + this.isLoadingResults = false; + this.isRateLimitReached = false; + this.resultsLength = data.total_count; + + return data.items; + }) + .catch(() => { + setTimeout(() => { + this.isLoadingResults = false; + // Catch if the GitHub API has reached its rate limit. Return empty data. + this.isRateLimitReached = true; + }); + return Observable.of([]); + }) + .subscribe(data => this.dataSource.data = data); } } @@ -56,7 +87,7 @@ export interface GithubIssue /** An example database that the data source uses to retrieve data for the table. */ export class ExampleHttpDao { - constructor(private http: Http) + constructor(private http: HttpClient) { } @@ -66,73 +97,6 @@ export class ExampleHttpDao const requestUrl = `${href}?q=repo:angular/material2&sort=${sort}&order=${order}&page=${page + 1}`; - return this.http.get(requestUrl) - .map(response => response.json() as GithubApi); - } -} - -/** - * Data source to provide what data should be rendered in the table. Note that the data source - * can retrieve its data in any way. In this case, the data source is provided a reference - * to a common data base, ExampleHttpDao. It is not the data source's responsibility to manage - * the underlying data. Instead, it only needs to take the data and send the table exactly what - * should be rendered. - */ -export class ExampleDataSource extends DataSource -{ - // The number of issues returned by github matching the query. - resultsLength = 0; - isLoadingResults = false; - isRateLimitReached = false; - - constructor( - private exampleDatabase: ExampleHttpDao, - private paginator: MatPaginator, - private sort: MatSort - ) - { - super(); - } - - /** Connect function called by the table to retrieve one stream containing the data to render. */ - connect(): Observable - { - const displayDataChanges = [ - this.sort.sortChange, - this.paginator.page - ]; - - // If the user changes the sort order, reset back to the first page. - this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0); - - return Observable.merge(...displayDataChanges) - .startWith(null) - .switchMap(() => { - setTimeout(() => { - this.isLoadingResults = true; - }); - return this.exampleDatabase.getRepoIssues( - this.sort.active, this.sort.direction, this.paginator.pageIndex); - }) - .map(data => { - // Flip flag to show that loading has finished. - this.isLoadingResults = false; - this.isRateLimitReached = false; - this.resultsLength = data.total_count; - - return data.items; - }) - .catch(() => { - // Catch if the GitHub API has reached its rate limit. Return empty data. - setTimeout(() => { - this.isLoadingResults = false; - this.isRateLimitReached = true; - }); - return Observable.of([]); - }); - } - - disconnect() - { + return this.http.get(requestUrl); } } diff --git a/src/assets/angular-material-examples/table-overview/table-overview-example.css b/src/assets/angular-material-examples/table-overview/table-overview-example.css index 5ddeba4b..986a3a60 100644 --- a/src/assets/angular-material-examples/table-overview/table-overview-example.css +++ b/src/assets/angular-material-examples/table-overview/table-overview-example.css @@ -1,4 +1,3 @@ -/* Structure */ .example-container { display: flex; flex-direction: column; @@ -6,45 +5,13 @@ } .example-header { - min-height: 56px; - max-height: 56px; - display: flex; - align-items: center; + min-height: 64px; padding: 8px 24px 0; - font-size: 20px; - justify-content: space-between; - border-bottom: 1px solid transparent; } .mat-form-field { font-size: 14px; - flex-grow: 1; - margin-top: 8px; -} - -.example-no-results { - display: flex; - justify-content: center; - padding: 24px; - font-size: 12px; - font-style: italic; -} - -/** Selection styles */ -.example-selection-header { - font-size: 18px; -} - -.mat-column-select { - max-width: 54px; -} - -.mat-row:hover, .example-selected-row { - background: #F5F5F5; -} - -.mat-row:active, .mat-row.example-selected-row { - background: #EAEAEA; + width: 100%; } .mat-table { diff --git a/src/assets/angular-material-examples/table-overview/table-overview-example.html b/src/assets/angular-material-examples/table-overview/table-overview-example.html index 161ae82b..61bafd76 100644 --- a/src/assets/angular-material-examples/table-overview/table-overview-example.html +++ b/src/assets/angular-material-examples/table-overview/table-overview-example.html @@ -1,40 +1,15 @@ -
- - +
+ +
-
- {{selection.selected.length}} - {{selection.selected.length == 1 ? 'user' : 'users'}} - selected -
- - - - - - - - - - - - - - - + - + ID {{row.id}} @@ -46,7 +21,7 @@ - + Name {{row.name}} @@ -58,21 +33,9 @@ - + -
- No users found matching filter. -
- - - +
diff --git a/src/assets/angular-material-examples/table-overview/table-overview-example.ts b/src/assets/angular-material-examples/table-overview/table-overview-example.ts index c70bbd8b..d441c52a 100644 --- a/src/assets/angular-material-examples/table-overview/table-overview-example.ts +++ b/src/assets/angular-material-examples/table-overview/table-overview-example.ts @@ -1,18 +1,8 @@ -import { Component, ElementRef, ViewChild } from '@angular/core'; -import { DataSource } from '@angular/cdk/collections'; -import { MatPaginator, MatSort } from '@angular/material'; -import { SelectionModel } from '@angular/cdk/collections'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/operator/startWith'; -import 'rxjs/add/observable/merge'; -import 'rxjs/add/observable/fromEvent'; -import 'rxjs/add/operator/map'; -import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/debounceTime'; +import { Component, ViewChild } from '@angular/core'; +import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material'; /** - * @title Feature-rich data table + * @title Data table with sorting, pagination, and filtering. */ @Component({ selector : 'table-overview-example', @@ -21,73 +11,58 @@ import 'rxjs/add/operator/debounceTime'; }) export class TableOverviewExample { - displayedColumns = ['select', 'userId', 'userName', 'progress', 'color']; - exampleDatabase = new ExampleDatabase(); - selection = new SelectionModel(true, []); - dataSource: ExampleDataSource | null; + displayedColumns = ['id', 'name', 'progress', 'color']; + dataSource: MatTableDataSource; @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; - @ViewChild('filter') filter: ElementRef; - ngOnInit() + constructor() { - this.dataSource = new ExampleDataSource(this.exampleDatabase, this.paginator, this.sort); - Observable.fromEvent(this.filter.nativeElement, 'keyup') - .debounceTime(150) - .distinctUntilChanged() - .subscribe(() => { - if ( !this.dataSource ) - { - return; - } - this.dataSource.filter = this.filter.nativeElement.value; - }); + // Create 100 users + const users: UserData[] = []; + for ( let i = 1; i <= 100; i++ ) + { + users.push(createNewUser(i)); + } + + // Assign the data to the data source for the table to render + this.dataSource = new MatTableDataSource(users); } - isAllSelected(): boolean + /** + * Set the paginator and sort after the view init since this component will + * be able to query its view for the initialized paginator and sort. + */ + ngAfterViewInit() { - if ( !this.dataSource ) - { - return false; - } - if ( this.selection.isEmpty() ) - { - return false; - } - - if ( this.filter.nativeElement.value ) - { - return this.selection.selected.length == this.dataSource.renderedData.length; - } - else - { - return this.selection.selected.length == this.exampleDatabase.data.length; - } + this.dataSource.paginator = this.paginator; + this.dataSource.sort = this.sort; } - masterToggle() + applyFilter(filterValue: string) { - if ( !this.dataSource ) - { - return; - } - - if ( this.isAllSelected() ) - { - this.selection.clear(); - } - else if ( this.filter.nativeElement.value ) - { - this.dataSource.renderedData.forEach(data => this.selection.select(data.id)); - } - else - { - this.exampleDatabase.data.forEach(data => this.selection.select(data.id)); - } + filterValue = filterValue.trim(); // Remove whitespace + filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches + this.dataSource.filter = filterValue; } } +/** Builds and returns a new User. */ +function createNewUser(id: number): UserData +{ + const name = + NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' + + NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.'; + + return { + id : id.toString(), + name : name, + progress: Math.round(Math.random() * 100).toString(), + color : COLORS[Math.round(Math.random() * (COLORS.length - 1))] + }; +} + /** Constants used to fill up our data base. */ const COLORS = [ 'maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple', @@ -106,153 +81,3 @@ export interface UserData progress: string; color: string; } - -/** An example database that the data source uses to retrieve data for the table. */ -export class ExampleDatabase -{ - /** Stream that emits whenever the data has been modified. */ - dataChange: BehaviorSubject = new BehaviorSubject([]); - - get data(): UserData[] - { - return this.dataChange.value; - } - - constructor() - { - // Fill up the database with 100 users. - setTimeout(() => { - for ( let i = 0; i < 100; i++ ) - { - this.addUser(); - } - }); - } - - /** Adds a new user to the database. */ - addUser() - { - const copiedData = this.data.slice(); - copiedData.push(this.createNewUser()); - this.dataChange.next(copiedData); - } - - /** Builds and returns a new User. */ - private createNewUser() - { - const name = - NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' + - NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.'; - - return { - id : (this.data.length + 1).toString(), - name : name, - progress: Math.round(Math.random() * 100).toString(), - color : COLORS[Math.round(Math.random() * (COLORS.length - 1))] - }; - } -} - -/** - * Data source to provide what data should be rendered in the table. Note that the data source - * can retrieve its data in any way. In this case, the data source is provided a reference - * to a common data base, ExampleDatabase. It is not the data source's responsibility to manage - * the underlying data. Instead, it only needs to take the data and send the table exactly what - * should be rendered. - */ -export class ExampleDataSource extends DataSource -{ - _filterChange = new BehaviorSubject(''); - - get filter(): string - { - return this._filterChange.value; - } - - set filter(filter: string) - { - this._filterChange.next(filter); - } - - filteredData: UserData[] = []; - renderedData: UserData[] = []; - - constructor( - private _exampleDatabase: ExampleDatabase, - private _paginator: MatPaginator, - private _sort: MatSort - ) - { - super(); - - // Reset to the first page when the user changes the filter. - this._filterChange.subscribe(() => this._paginator.pageIndex = 0); - } - - /** Connect function called by the table to retrieve one stream containing the data to render. */ - connect(): Observable - { - // Listen for any changes in the base data, sorting, filtering, or pagination - const displayDataChanges = [ - this._exampleDatabase.dataChange, - this._sort.sortChange, - this._filterChange, - this._paginator.page - ]; - - return Observable.merge(...displayDataChanges).map(() => { - // Filter data - this.filteredData = this._exampleDatabase.data.slice().filter((item: UserData) => { - let searchStr = (item.name + item.color).toLowerCase(); - return searchStr.indexOf(this.filter.toLowerCase()) != -1; - }); - - // Sort filtered data - const sortedData = this.sortData(this.filteredData.slice()); - - // Grab the page's slice of the filtered sorted data. - const startIndex = this._paginator.pageIndex * this._paginator.pageSize; - this.renderedData = sortedData.splice(startIndex, this._paginator.pageSize); - return this.renderedData; - }); - } - - disconnect() - { - } - - /** Returns a sorted copy of the database data. */ - sortData(data: UserData[]): UserData[] - { - if ( !this._sort.active || this._sort.direction == '' ) - { - return data; - } - - return data.sort((a, b) => { - let propertyA: number | string = ''; - let propertyB: number | string = ''; - - switch ( this._sort.active ) - { - case 'userId': - [propertyA, propertyB] = [a.id, b.id]; - break; - case 'userName': - [propertyA, propertyB] = [a.name, b.name]; - break; - case 'progress': - [propertyA, propertyB] = [a.progress, b.progress]; - break; - case 'color': - [propertyA, propertyB] = [a.color, b.color]; - break; - } - - let valueA = isNaN(+propertyA) ? propertyA : +propertyA; - let valueB = isNaN(+propertyB) ? propertyB : +propertyB; - - return (valueA < valueB ? -1 : 1) * (this._sort.direction == 'asc' ? 1 : -1); - }); - } -} diff --git a/src/assets/angular-material-examples/table-pagination/table-pagination-example.css b/src/assets/angular-material-examples/table-pagination/table-pagination-example.css index c6d0ba17..4bcbbe98 100644 --- a/src/assets/angular-material-examples/table-pagination/table-pagination-example.css +++ b/src/assets/angular-material-examples/table-pagination/table-pagination-example.css @@ -1,18 +1,9 @@ -/* Structure */ .example-container { display: flex; flex-direction: column; min-width: 300px; } -.example-header { - min-height: 64px; - display: flex; - align-items: center; - padding-left: 24px; - font-size: 20px; -} - .mat-table { overflow: auto; max-height: 500px; diff --git a/src/assets/angular-material-examples/table-pagination/table-pagination-example.html b/src/assets/angular-material-examples/table-pagination/table-pagination-example.html index 399a2197..a030e4a7 100644 --- a/src/assets/angular-material-examples/table-pagination/table-pagination-example.html +++ b/src/assets/angular-material-examples/table-pagination/table-pagination-example.html @@ -1,32 +1,28 @@
- - - - - - ID - {{row.id}} - - - - - Progress - {{row.progress}}% + + + No. + {{element.position}} - + Name - {{row.name}} + {{element.name}} + + + + + Weight + {{element.weight}} - - Color - {{row.color}} + + Symbol + {{element.symbol}} @@ -34,9 +30,7 @@ + [pageSize]="10" + [pageSizeOptions]="[5, 10, 20]"> -
+
\ No newline at end of file diff --git a/src/assets/angular-material-examples/table-pagination/table-pagination-example.ts b/src/assets/angular-material-examples/table-pagination/table-pagination-example.ts index ea56ac61..ad297cbe 100644 --- a/src/assets/angular-material-examples/table-pagination/table-pagination-example.ts +++ b/src/assets/angular-material-examples/table-pagination/table-pagination-example.ts @@ -1,11 +1,5 @@ import { Component, ViewChild } from '@angular/core'; -import { DataSource } from '@angular/cdk/collections'; -import { MatPaginator } from '@angular/material'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/operator/startWith'; -import 'rxjs/add/observable/merge'; -import 'rxjs/add/operator/map'; +import { MatPaginator, MatTableDataSource } from '@angular/material'; /** * @title Table with pagination @@ -17,113 +11,148 @@ import 'rxjs/add/operator/map'; }) export class TablePaginationExample { - displayedColumns = ['userId', 'userName', 'progress', 'color']; - exampleDatabase = new ExampleDatabase(); - dataSource: ExampleDataSource | null; + displayedColumns = ['position', 'name', 'weight', 'symbol']; + dataSource = new MatTableDataSource(ELEMENT_DATA); @ViewChild(MatPaginator) paginator: MatPaginator; - ngOnInit() + /** + * Set the paginator after the view init since this component will + * be able to query its view for the initialized paginator. + */ + ngAfterViewInit() { - this.dataSource = new ExampleDataSource(this.exampleDatabase, this.paginator); + this.dataSource.paginator = this.paginator; } } -/** Constants used to fill up our data base. */ -const COLORS = [ - 'maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple', - 'fuchsia', 'lime', 'teal', 'aqua', 'blue', 'navy', 'black', 'gray' -]; -const NAMES = [ - 'Maia', 'Asher', 'Olivia', 'Atticus', 'Amelia', 'Jack', - 'Charlotte', 'Theodore', 'Isla', 'Oliver', 'Isabella', 'Jasper', - 'Cora', 'Levi', 'Violet', 'Arthur', 'Mia', 'Thomas', 'Elizabeth' -]; - -export interface UserData +export interface Element { - id: string; name: string; - progress: string; - color: string; + position: number; + weight: number; + symbol: string; } -/** An example database that the data source uses to retrieve data for the table. */ -export class ExampleDatabase -{ - /** Stream that emits whenever the data has been modified. */ - dataChange: BehaviorSubject = new BehaviorSubject([]); - - get data(): UserData[] +const ELEMENT_DATA: Element[] = [ { - return this.dataChange.value; - } - - constructor() + position: 1, + name : 'Hydrogen', + weight : 1.0079, + symbol : 'H' + }, { - // Fill up the database with 100 users. - for ( let i = 0; i < 100; i++ ) - { - this.addUser(); - } - } - - /** Adds a new user to the database. */ - addUser() + position: 2, + name : 'Helium', + weight : 4.0026, + symbol : 'He' + }, { - const copiedData = this.data.slice(); - copiedData.push(this.createNewUser()); - this.dataChange.next(copiedData); - } - - /** Builds and returns a new User. */ - private createNewUser() + position: 3, + name : 'Lithium', + weight : 6.941, + symbol : 'Li' + }, { - const name = - NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' + - NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.'; - - return { - id : (this.data.length + 1).toString(), - name : name, - progress: Math.round(Math.random() * 100).toString(), - color : COLORS[Math.round(Math.random() * (COLORS.length - 1))] - }; - } -} - -/** - * Data source to provide what data should be rendered in the table. Note that the data source - * can retrieve its data in any way. In this case, the data source is provided a reference - * to a common data base, ExampleDatabase. It is not the data source's responsibility to manage - * the underlying data. Instead, it only needs to take the data and send the table exactly what - * should be rendered. - */ -export class ExampleDataSource extends DataSource -{ - constructor(private _exampleDatabase: ExampleDatabase, private _paginator: MatPaginator) + position: 4, + name : 'Beryllium', + weight : 9.0122, + symbol : 'Be' + }, { - super(); - } - - /** Connect function called by the table to retrieve one stream containing the data to render. */ - connect(): Observable + position: 5, + name : 'Boron', + weight : 10.811, + symbol : 'B' + }, { - const displayDataChanges = [ - this._exampleDatabase.dataChange, - this._paginator.page - ]; - - return Observable.merge(...displayDataChanges).map(() => { - const data = this._exampleDatabase.data.slice(); - - // Grab the page's slice of data. - const startIndex = this._paginator.pageIndex * this._paginator.pageSize; - return data.splice(startIndex, this._paginator.pageSize); - }); - } - - disconnect() + position: 6, + name : 'Carbon', + weight : 12.0107, + symbol : 'C' + }, { + position: 7, + name : 'Nitrogen', + weight : 14.0067, + symbol : 'N' + }, + { + position: 8, + name : 'Oxygen', + weight : 15.9994, + symbol : 'O' + }, + { + position: 9, + name : 'Fluorine', + weight : 18.9984, + symbol : 'F' + }, + { + position: 10, + name : 'Neon', + weight : 20.1797, + symbol : 'Ne' + }, + { + position: 11, + name : 'Sodium', + weight : 22.9897, + symbol : 'Na' + }, + { + position: 12, + name : 'Magnesium', + weight : 24.305, + symbol : 'Mg' + }, + { + position: 13, + name : 'Aluminum', + weight : 26.9815, + symbol : 'Al' + }, + { + position: 14, + name : 'Silicon', + weight : 28.0855, + symbol : 'Si' + }, + { + position: 15, + name : 'Phosphorus', + weight : 30.9738, + symbol : 'P' + }, + { + position: 16, + name : 'Sulfur', + weight : 32.065, + symbol : 'S' + }, + { + position: 17, + name : 'Chlorine', + weight : 35.453, + symbol : 'Cl' + }, + { + position: 18, + name : 'Argon', + weight : 39.948, + symbol : 'Ar' + }, + { + position: 19, + name : 'Potassium', + weight : 39.0983, + symbol : 'K' + }, + { + position: 20, + name : 'Calcium', + weight : 40.078, + symbol : 'Ca' } -} +]; diff --git a/src/assets/angular-material-examples/table-sorting/table-sorting-example.css b/src/assets/angular-material-examples/table-sorting/table-sorting-example.css index 7bde15b2..a5b2b1bd 100644 --- a/src/assets/angular-material-examples/table-sorting/table-sorting-example.css +++ b/src/assets/angular-material-examples/table-sorting/table-sorting-example.css @@ -1,23 +1,14 @@ -/* Structure */ .example-container { display: flex; flex-direction: column; min-width: 300px; } -.example-header { - min-height: 64px; - display: flex; - align-items: center; - padding-left: 24px; - font-size: 20px; -} - .mat-table { overflow: auto; max-height: 500px; } -.mat-header-cell .mat-sort-header-sorted { +.mat-header-cell.mat-sort-header-sorted { color: black; } diff --git a/src/assets/angular-material-examples/table-sorting/table-sorting-example.html b/src/assets/angular-material-examples/table-sorting/table-sorting-example.html index ff15e446..b7d868d2 100644 --- a/src/assets/angular-material-examples/table-sorting/table-sorting-example.html +++ b/src/assets/angular-material-examples/table-sorting/table-sorting-example.html @@ -1,34 +1,31 @@
- - - - - ID - {{row.id}} - - - - - Progress - {{row.progress}}% + + + No. + {{element.position}} - + Name - {{row.name}} + {{element.name}} + + + + + Weight + {{element.weight}} - - Color - {{row.color}} + + Symbol + {{element.symbol}} -
+
\ No newline at end of file diff --git a/src/assets/angular-material-examples/table-sorting/table-sorting-example.ts b/src/assets/angular-material-examples/table-sorting/table-sorting-example.ts index f9240cd0..2d3e82a7 100644 --- a/src/assets/angular-material-examples/table-sorting/table-sorting-example.ts +++ b/src/assets/angular-material-examples/table-sorting/table-sorting-example.ts @@ -1,11 +1,5 @@ import { Component, ViewChild } from '@angular/core'; -import { DataSource } from '@angular/cdk/collections'; -import { MatSort } from '@angular/material'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Observable } from 'rxjs/Observable'; -import 'rxjs/add/operator/startWith'; -import 'rxjs/add/observable/merge'; -import 'rxjs/add/operator/map'; +import { MatTableDataSource, MatSort } from '@angular/material'; /** * @title Table with sorting @@ -17,145 +11,148 @@ import 'rxjs/add/operator/map'; }) export class TableSortingExample { - displayedColumns = ['userId', 'userName', 'progress', 'color']; - exampleDatabase = new ExampleDatabase(); - dataSource: ExampleDataSource | null; + displayedColumns = ['position', 'name', 'weight', 'symbol']; + dataSource = new MatTableDataSource(ELEMENT_DATA); @ViewChild(MatSort) sort: MatSort; - ngOnInit() + /** + * Set the sort after the view init since this component will + * be able to query its view for the initialized sort. + */ + ngAfterViewInit() { - this.dataSource = new ExampleDataSource(this.exampleDatabase, this.sort); + this.dataSource.sort = this.sort; } } -/** Constants used to fill up our data base. */ -const COLORS = [ - 'maroon', 'red', 'orange', 'yellow', 'olive', 'green', 'purple', - 'fuchsia', 'lime', 'teal', 'aqua', 'blue', 'navy', 'black', 'gray' -]; -const NAMES = [ - 'Maia', 'Asher', 'Olivia', 'Atticus', 'Amelia', 'Jack', - 'Charlotte', 'Theodore', 'Isla', 'Oliver', 'Isabella', 'Jasper', - 'Cora', 'Levi', 'Violet', 'Arthur', 'Mia', 'Thomas', 'Elizabeth' -]; - -export interface UserData +export interface Element { - id: string; name: string; - progress: string; - color: string; + position: number; + weight: number; + symbol: string; } -/** An example database that the data source uses to retrieve data for the table. */ -export class ExampleDatabase -{ - /** Stream that emits whenever the data has been modified. */ - dataChange: BehaviorSubject = new BehaviorSubject([]); - - get data(): UserData[] +const ELEMENT_DATA: Element[] = [ { - return this.dataChange.value; - } - - constructor() + position: 1, + name : 'Hydrogen', + weight : 1.0079, + symbol : 'H' + }, { - // Fill up the database with 100 users. - for ( let i = 0; i < 100; i++ ) - { - this.addUser(); - } - } - - /** Adds a new user to the database. */ - addUser() + position: 2, + name : 'Helium', + weight : 4.0026, + symbol : 'He' + }, { - const copiedData = this.data.slice(); - copiedData.push(this.createNewUser()); - this.dataChange.next(copiedData); - } - - /** Builds and returns a new User. */ - private createNewUser() + position: 3, + name : 'Lithium', + weight : 6.941, + symbol : 'Li' + }, { - const name = - NAMES[Math.round(Math.random() * (NAMES.length - 1))] + ' ' + - NAMES[Math.round(Math.random() * (NAMES.length - 1))].charAt(0) + '.'; - - return { - id : (this.data.length + 1).toString(), - name : name, - progress: Math.round(Math.random() * 100).toString(), - color : COLORS[Math.round(Math.random() * (COLORS.length - 1))] - }; - } -} - -/** - * Data source to provide what data should be rendered in the table. Note that the data source - * can retrieve its data in any way. In this case, the data source is provided a reference - * to a common data base, ExampleDatabase. It is not the data source's responsibility to manage - * the underlying data. Instead, it only needs to take the data and send the table exactly what - * should be rendered. - */ -export class ExampleDataSource extends DataSource -{ - constructor(private _exampleDatabase: ExampleDatabase, private _sort: MatSort) + position: 4, + name : 'Beryllium', + weight : 9.0122, + symbol : 'Be' + }, { - super(); - } - - /** Connect function called by the table to retrieve one stream containing the data to render. */ - connect(): Observable + position: 5, + name : 'Boron', + weight : 10.811, + symbol : 'B' + }, { - const displayDataChanges = [ - this._exampleDatabase.dataChange, - this._sort.sortChange - ]; - - return Observable.merge(...displayDataChanges).map(() => { - return this.getSortedData(); - }); - } - - disconnect() + position: 6, + name : 'Carbon', + weight : 12.0107, + symbol : 'C' + }, { - } - - /** Returns a sorted copy of the database data. */ - getSortedData(): UserData[] + position: 7, + name : 'Nitrogen', + weight : 14.0067, + symbol : 'N' + }, { - const data = this._exampleDatabase.data.slice(); - if ( !this._sort.active || this._sort.direction == '' ) - { - return data; - } - - return data.sort((a, b) => { - let propertyA: number | string = ''; - let propertyB: number | string = ''; - - switch ( this._sort.active ) - { - case 'userId': - [propertyA, propertyB] = [a.id, b.id]; - break; - case 'userName': - [propertyA, propertyB] = [a.name, b.name]; - break; - case 'progress': - [propertyA, propertyB] = [a.progress, b.progress]; - break; - case 'color': - [propertyA, propertyB] = [a.color, b.color]; - break; - } - - let valueA = isNaN(+propertyA) ? propertyA : +propertyA; - let valueB = isNaN(+propertyB) ? propertyB : +propertyB; - - return (valueA < valueB ? -1 : 1) * (this._sort.direction == 'asc' ? 1 : -1); - }); + position: 8, + name : 'Oxygen', + weight : 15.9994, + symbol : 'O' + }, + { + position: 9, + name : 'Fluorine', + weight : 18.9984, + symbol : 'F' + }, + { + position: 10, + name : 'Neon', + weight : 20.1797, + symbol : 'Ne' + }, + { + position: 11, + name : 'Sodium', + weight : 22.9897, + symbol : 'Na' + }, + { + position: 12, + name : 'Magnesium', + weight : 24.305, + symbol : 'Mg' + }, + { + position: 13, + name : 'Aluminum', + weight : 26.9815, + symbol : 'Al' + }, + { + position: 14, + name : 'Silicon', + weight : 28.0855, + symbol : 'Si' + }, + { + position: 15, + name : 'Phosphorus', + weight : 30.9738, + symbol : 'P' + }, + { + position: 16, + name : 'Sulfur', + weight : 32.065, + symbol : 'S' + }, + { + position: 17, + name : 'Chlorine', + weight : 35.453, + symbol : 'Cl' + }, + { + position: 18, + name : 'Argon', + weight : 39.948, + symbol : 'Ar' + }, + { + position: 19, + name : 'Potassium', + weight : 39.0983, + symbol : 'K' + }, + { + position: 20, + name : 'Calcium', + weight : 40.078, + symbol : 'Ca' } -} +]; diff --git a/src/assets/angular-material-examples/toolbar-multirow/toolbar-multirow-example.html b/src/assets/angular-material-examples/toolbar-multirow/toolbar-multirow-example.html index 5ee4b8b7..bf25e3a0 100644 --- a/src/assets/angular-material-examples/toolbar-multirow/toolbar-multirow-example.html +++ b/src/assets/angular-material-examples/toolbar-multirow/toolbar-multirow-example.html @@ -1,5 +1,7 @@ - Custom Toolbar + + Custom Toolbar + Second Line