@angular/material 10.0.0-rc.3 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_theming.scss +17 -17
- package/autocomplete/index.metadata.json +1 -1
- package/autocomplete/testing/autocomplete-harness.d.ts +2 -0
- package/bundles/material-autocomplete-testing.umd.js +11 -0
- package/bundles/material-autocomplete-testing.umd.js.map +1 -1
- package/bundles/material-autocomplete-testing.umd.min.js +2 -2
- package/bundles/material-autocomplete-testing.umd.min.js.map +1 -1
- package/bundles/material-autocomplete.umd.js +3 -1
- package/bundles/material-autocomplete.umd.js.map +1 -1
- package/bundles/material-autocomplete.umd.min.js +5 -5
- package/bundles/material-autocomplete.umd.min.js.map +1 -1
- package/bundles/material-badge-testing.umd.min.js +1 -1
- package/bundles/material-badge-testing.umd.min.js.map +1 -1
- package/bundles/material-bottom-sheet-testing.umd.min.js +1 -1
- package/bundles/material-bottom-sheet-testing.umd.min.js.map +1 -1
- package/bundles/material-button-testing.umd.js +11 -0
- package/bundles/material-button-testing.umd.js.map +1 -1
- package/bundles/material-button-testing.umd.min.js +2 -2
- package/bundles/material-button-testing.umd.min.js.map +1 -1
- package/bundles/material-button-toggle-testing.umd.js +11 -0
- package/bundles/material-button-toggle-testing.umd.js.map +1 -1
- package/bundles/material-button-toggle-testing.umd.min.js +3 -3
- package/bundles/material-button-toggle-testing.umd.min.js.map +1 -1
- package/bundles/material-button-toggle.umd.js +12 -3
- package/bundles/material-button-toggle.umd.js.map +1 -1
- package/bundles/material-button-toggle.umd.min.js +2 -2
- package/bundles/material-button-toggle.umd.min.js.map +1 -1
- package/bundles/material-button.umd.js +7 -2
- package/bundles/material-button.umd.js.map +1 -1
- package/bundles/material-button.umd.min.js +4 -4
- package/bundles/material-button.umd.min.js.map +1 -1
- package/bundles/material-card-testing.umd.js +335 -0
- package/bundles/material-card-testing.umd.js.map +1 -0
- package/bundles/material-card-testing.umd.min.js +44 -0
- package/bundles/material-card-testing.umd.min.js.map +1 -0
- package/bundles/material-checkbox-testing.umd.js +11 -0
- package/bundles/material-checkbox-testing.umd.js.map +1 -1
- package/bundles/material-checkbox-testing.umd.min.js +3 -3
- package/bundles/material-checkbox-testing.umd.min.js.map +1 -1
- package/bundles/material-checkbox.umd.js.map +1 -1
- package/bundles/material-chips.umd.js +36 -12
- package/bundles/material-chips.umd.js.map +1 -1
- package/bundles/material-chips.umd.min.js +4 -4
- package/bundles/material-chips.umd.min.js.map +1 -1
- package/bundles/material-core-testing.umd.min.js +1 -1
- package/bundles/material-core-testing.umd.min.js.map +1 -1
- package/bundles/material-core.umd.js +11 -3
- package/bundles/material-core.umd.js.map +1 -1
- package/bundles/material-core.umd.min.js +11 -11
- package/bundles/material-core.umd.min.js.map +1 -1
- package/bundles/material-datepicker.umd.js +20 -11
- package/bundles/material-datepicker.umd.js.map +1 -1
- package/bundles/material-datepicker.umd.min.js +5 -5
- package/bundles/material-datepicker.umd.min.js.map +1 -1
- package/bundles/material-dialog-testing.umd.min.js +1 -1
- package/bundles/material-dialog-testing.umd.min.js.map +1 -1
- package/bundles/material-dialog.umd.js +45 -8
- package/bundles/material-dialog.umd.js.map +1 -1
- package/bundles/material-dialog.umd.min.js +14 -7
- package/bundles/material-dialog.umd.min.js.map +1 -1
- package/bundles/material-divider-testing.umd.min.js +1 -1
- package/bundles/material-divider-testing.umd.min.js.map +1 -1
- package/bundles/material-expansion-testing.umd.js +11 -0
- package/bundles/material-expansion-testing.umd.js.map +1 -1
- package/bundles/material-expansion-testing.umd.min.js +3 -3
- package/bundles/material-expansion-testing.umd.min.js.map +1 -1
- package/bundles/material-form-field-testing.umd.js +32 -0
- package/bundles/material-form-field-testing.umd.js.map +1 -1
- package/bundles/material-form-field-testing.umd.min.js +4 -4
- package/bundles/material-form-field-testing.umd.min.js.map +1 -1
- package/bundles/material-form-field.umd.js +47 -21
- package/bundles/material-form-field.umd.js.map +1 -1
- package/bundles/material-form-field.umd.min.js +5 -5
- package/bundles/material-form-field.umd.min.js.map +1 -1
- package/bundles/material-grid-list-testing.umd.min.js +1 -1
- package/bundles/material-grid-list-testing.umd.min.js.map +1 -1
- package/bundles/material-grid-list.umd.js +2 -2
- package/bundles/material-grid-list.umd.js.map +1 -1
- package/bundles/material-grid-list.umd.min.js +2 -2
- package/bundles/material-grid-list.umd.min.js.map +1 -1
- package/bundles/material-input-testing.umd.js +23 -6
- package/bundles/material-input-testing.umd.js.map +1 -1
- package/bundles/material-input-testing.umd.min.js +3 -3
- package/bundles/material-input-testing.umd.min.js.map +1 -1
- package/bundles/material-input.umd.js +28 -3
- package/bundles/material-input.umd.js.map +1 -1
- package/bundles/material-input.umd.min.js +3 -3
- package/bundles/material-input.umd.min.js.map +1 -1
- package/bundles/material-list-testing.umd.js +33 -0
- package/bundles/material-list-testing.umd.js.map +1 -1
- package/bundles/material-list-testing.umd.min.js +2 -2
- package/bundles/material-list-testing.umd.min.js.map +1 -1
- package/bundles/material-list.umd.js +3 -3
- package/bundles/material-list.umd.min.js +1 -1
- package/bundles/material-list.umd.min.js.map +1 -1
- package/bundles/material-menu-testing.umd.js +22 -0
- package/bundles/material-menu-testing.umd.js.map +1 -1
- package/bundles/material-menu-testing.umd.min.js +2 -2
- package/bundles/material-menu-testing.umd.min.js.map +1 -1
- package/bundles/material-menu.umd.js +13 -2
- package/bundles/material-menu.umd.js.map +1 -1
- package/bundles/material-menu.umd.min.js +4 -4
- package/bundles/material-menu.umd.min.js.map +1 -1
- package/bundles/material-paginator-testing.umd.min.js +1 -1
- package/bundles/material-paginator-testing.umd.min.js.map +1 -1
- package/bundles/material-progress-bar-testing.umd.min.js +1 -1
- package/bundles/material-progress-bar-testing.umd.min.js.map +1 -1
- package/bundles/material-progress-spinner-testing.umd.js +1 -1
- package/bundles/material-progress-spinner-testing.umd.js.map +1 -1
- package/bundles/material-progress-spinner-testing.umd.min.js +2 -2
- package/bundles/material-progress-spinner-testing.umd.min.js.map +1 -1
- package/bundles/material-progress-spinner.umd.js +2 -2
- package/bundles/material-progress-spinner.umd.min.js +3 -3
- package/bundles/material-progress-spinner.umd.min.js.map +1 -1
- package/bundles/material-radio-testing.umd.js +11 -0
- package/bundles/material-radio-testing.umd.js.map +1 -1
- package/bundles/material-radio-testing.umd.min.js +3 -3
- package/bundles/material-radio-testing.umd.min.js.map +1 -1
- package/bundles/material-radio.umd.js +15 -5
- package/bundles/material-radio.umd.js.map +1 -1
- package/bundles/material-radio.umd.min.js +2 -2
- package/bundles/material-radio.umd.min.js.map +1 -1
- package/bundles/material-select-testing.umd.js +11 -0
- package/bundles/material-select-testing.umd.js.map +1 -1
- package/bundles/material-select-testing.umd.min.js +2 -2
- package/bundles/material-select-testing.umd.min.js.map +1 -1
- package/bundles/material-select.umd.js +11 -3
- package/bundles/material-select.umd.js.map +1 -1
- package/bundles/material-select.umd.min.js +4 -4
- package/bundles/material-select.umd.min.js.map +1 -1
- package/bundles/material-sidenav-testing.umd.min.js +1 -1
- package/bundles/material-sidenav-testing.umd.min.js.map +1 -1
- package/bundles/material-sidenav.umd.js +41 -17
- package/bundles/material-sidenav.umd.js.map +1 -1
- package/bundles/material-sidenav.umd.min.js +2 -2
- package/bundles/material-sidenav.umd.min.js.map +1 -1
- package/bundles/material-slide-toggle-testing.umd.js +11 -0
- package/bundles/material-slide-toggle-testing.umd.js.map +1 -1
- package/bundles/material-slide-toggle-testing.umd.min.js +2 -2
- package/bundles/material-slide-toggle-testing.umd.min.js.map +1 -1
- package/bundles/material-slide-toggle.umd.js.map +1 -1
- package/bundles/material-slider-testing.umd.js +11 -0
- package/bundles/material-slider-testing.umd.js.map +1 -1
- package/bundles/material-slider-testing.umd.min.js +2 -2
- package/bundles/material-slider-testing.umd.min.js.map +1 -1
- package/bundles/material-snack-bar-testing.umd.min.js +1 -1
- package/bundles/material-snack-bar-testing.umd.min.js.map +1 -1
- package/bundles/material-snack-bar.umd.js +47 -39
- package/bundles/material-snack-bar.umd.js.map +1 -1
- package/bundles/material-snack-bar.umd.min.js +2 -2
- package/bundles/material-snack-bar.umd.min.js.map +1 -1
- package/bundles/material-sort-testing.umd.js +10 -10
- package/bundles/material-sort-testing.umd.js.map +1 -1
- package/bundles/material-sort-testing.umd.min.js +3 -3
- package/bundles/material-sort-testing.umd.min.js.map +1 -1
- package/bundles/material-sort.umd.js +25 -12
- package/bundles/material-sort.umd.js.map +1 -1
- package/bundles/material-sort.umd.min.js +5 -5
- package/bundles/material-sort.umd.min.js.map +1 -1
- package/bundles/material-table-testing.umd.min.js +1 -1
- package/bundles/material-table-testing.umd.min.js.map +1 -1
- package/bundles/material-table.umd.min.js +2 -2
- package/bundles/material-table.umd.min.js.map +1 -1
- package/bundles/material-tabs-testing.umd.min.js +1 -1
- package/bundles/material-tabs-testing.umd.min.js.map +1 -1
- package/bundles/material-tabs.umd.js +23 -4
- package/bundles/material-tabs.umd.js.map +1 -1
- package/bundles/material-tabs.umd.min.js +5 -12
- package/bundles/material-tabs.umd.min.js.map +1 -1
- package/bundles/material-toolbar-testing.umd.js +330 -0
- package/bundles/material-toolbar-testing.umd.js.map +1 -0
- package/bundles/material-toolbar-testing.umd.min.js +44 -0
- package/bundles/material-toolbar-testing.umd.min.js.map +1 -0
- package/bundles/material-tooltip-testing.umd.min.js +1 -1
- package/bundles/material-tooltip-testing.umd.min.js.map +1 -1
- package/bundles/material-tooltip.umd.js +14 -1
- package/bundles/material-tooltip.umd.js.map +1 -1
- package/bundles/material-tooltip.umd.min.js +3 -3
- package/bundles/material-tooltip.umd.min.js.map +1 -1
- package/bundles/material-tree.umd.js.map +1 -1
- package/button/_button-base.scss +1 -1
- package/button/_button-theme.scss +8 -8
- package/button/index.metadata.json +1 -1
- package/button/testing/button-harness.d.ts +2 -0
- package/button-toggle/button-toggle.d.ts +10 -3
- package/button-toggle/index.metadata.json +1 -1
- package/button-toggle/testing/button-toggle-harness.d.ts +2 -0
- package/card/testing/card-harness-filters.d.ts +17 -0
- package/card/testing/card-harness.d.ts +36 -0
- package/card/testing/index.d.ts +8 -0
- package/card/testing/package.json +9 -0
- package/card/testing/public-api.d.ts +9 -0
- package/checkbox/index.metadata.json +1 -1
- package/checkbox/testing/checkbox-harness.d.ts +2 -0
- package/chips/chip.d.ts +19 -1
- package/chips/index.metadata.json +1 -1
- package/core/focus-indicators/_focus-indicators.scss +6 -6
- package/core/index.metadata.json +1 -1
- package/core/option/optgroup.d.ts +7 -0
- package/core/ripple/ripple-ref.d.ts +21 -2
- package/core/ripple/ripple-renderer.d.ts +1 -19
- package/core/ripple/ripple.d.ts +2 -2
- package/core/style/_list-common.scss +1 -1
- package/datepicker/date-range-input-parts.d.ts +2 -4
- package/datepicker/date-range-input.d.ts +4 -4
- package/datepicker/date-range-picker.d.ts +10 -3
- package/datepicker/datepicker.d.ts +2 -3
- package/datepicker/index.metadata.json +1 -1
- package/datepicker/public-api.d.ts +1 -1
- package/dialog/dialog-container.d.ts +9 -2
- package/dialog/dialog-content-directives.d.ts +1 -0
- package/dialog/dialog-ref.d.ts +7 -0
- package/dialog/index.metadata.json +1 -1
- package/esm2015/autocomplete/autocomplete-module.js +18 -22
- package/esm2015/autocomplete/autocomplete-origin.js +16 -20
- package/esm2015/autocomplete/autocomplete-trigger.js +519 -521
- package/esm2015/autocomplete/autocomplete.js +126 -130
- package/esm2015/autocomplete/testing/autocomplete-harness.js +99 -97
- package/esm2015/badge/badge-module.js +13 -17
- package/esm2015/badge/badge.js +184 -188
- package/esm2015/badge/testing/badge-harness.js +74 -78
- package/esm2015/bottom-sheet/bottom-sheet-container.js +161 -165
- package/esm2015/bottom-sheet/bottom-sheet-module.js +15 -19
- package/esm2015/bottom-sheet/bottom-sheet.js +124 -128
- package/esm2015/bottom-sheet/testing/bottom-sheet-harness.js +29 -33
- package/esm2015/button/button-module.js +20 -24
- package/esm2015/button/button.js +111 -114
- package/esm2015/button/testing/button-harness.js +60 -58
- package/esm2015/button-toggle/button-toggle-module.js +10 -14
- package/esm2015/button-toggle/button-toggle.js +368 -368
- package/esm2015/button-toggle/testing/button-toggle-group-harness.js +42 -46
- package/esm2015/button-toggle/testing/button-toggle-harness.js +113 -111
- package/esm2015/card/card-module.js +30 -34
- package/esm2015/card/card.js +147 -203
- package/esm2015/card/testing/card-harness-filters.js +8 -0
- package/esm2015/card/testing/card-harness.js +52 -0
- package/esm2015/card/testing/index.js +9 -0
- package/esm2015/card/testing/public-api.js +10 -0
- package/esm2015/card/testing/testing.externs.js +0 -0
- package/esm2015/checkbox/checkbox-module.js +21 -29
- package/esm2015/checkbox/checkbox-required-validator.js +9 -13
- package/esm2015/checkbox/checkbox.js +315 -319
- package/esm2015/checkbox/testing/checkbox-harness.js +150 -148
- package/esm2015/chips/chip-input.js +119 -123
- package/esm2015/chips/chip-list.js +572 -576
- package/esm2015/chips/chip.js +333 -328
- package/esm2015/chips/chips-module.js +16 -20
- package/esm2015/core/animation/animation.js +12 -20
- package/esm2015/core/common-behaviors/common-module.js +91 -95
- package/esm2015/core/datetime/index.js +19 -27
- package/esm2015/core/datetime/native-date-adapter.js +202 -206
- package/esm2015/core/error/error-options.js +16 -24
- package/esm2015/core/line/line.js +18 -26
- package/esm2015/core/option/index.js +10 -14
- package/esm2015/core/option/optgroup.js +36 -33
- package/esm2015/core/option/option.js +181 -185
- package/esm2015/core/ripple/index.js +10 -14
- package/esm2015/core/ripple/ripple-ref.js +1 -1
- package/esm2015/core/ripple/ripple-renderer.js +1 -1
- package/esm2015/core/ripple/ripple.js +102 -106
- package/esm2015/core/selection/index.js +9 -13
- package/esm2015/core/selection/pseudo-checkbox/pseudo-checkbox.js +32 -36
- package/esm2015/core/testing/optgroup-harness.js +39 -43
- package/esm2015/core/testing/option-harness.js +51 -55
- package/esm2015/core/version.js +1 -1
- package/esm2015/datepicker/calendar-body.js +214 -218
- package/esm2015/datepicker/calendar.js +295 -303
- package/esm2015/datepicker/date-range-input-parts.js +214 -229
- package/esm2015/datepicker/date-range-input.js +244 -242
- package/esm2015/datepicker/date-range-picker.js +19 -23
- package/esm2015/datepicker/date-range-selection-strategy.js +31 -35
- package/esm2015/datepicker/date-selection-model.js +110 -122
- package/esm2015/datepicker/datepicker-base.js +418 -426
- package/esm2015/datepicker/datepicker-input-base.js +227 -224
- package/esm2015/datepicker/datepicker-input.js +111 -115
- package/esm2015/datepicker/datepicker-intl.js +37 -41
- package/esm2015/datepicker/datepicker-module.js +62 -66
- package/esm2015/datepicker/datepicker-toggle.js +81 -89
- package/esm2015/datepicker/datepicker.js +13 -17
- package/esm2015/datepicker/month-view.js +283 -287
- package/esm2015/datepicker/multi-year-view.js +198 -202
- package/esm2015/datepicker/public-api.js +2 -2
- package/esm2015/datepicker/year-view.js +220 -224
- package/esm2015/dialog/dialog-container.js +175 -164
- package/esm2015/dialog/dialog-content-directives.js +105 -114
- package/esm2015/dialog/dialog-module.js +32 -36
- package/esm2015/dialog/dialog-ref.js +17 -3
- package/esm2015/dialog/dialog.js +236 -240
- package/esm2015/dialog/testing/dialog-harness.js +58 -62
- package/esm2015/divider/divider-module.js +10 -14
- package/esm2015/divider/divider.js +33 -37
- package/esm2015/divider/testing/divider-harness.js +16 -20
- package/esm2015/expansion/accordion.js +73 -77
- package/esm2015/expansion/expansion-module.js +26 -30
- package/esm2015/expansion/expansion-panel-content.js +13 -17
- package/esm2015/expansion/expansion-panel-header.js +168 -180
- package/esm2015/expansion/expansion-panel.js +144 -152
- package/esm2015/expansion/testing/accordion-harness.js +24 -28
- package/esm2015/expansion/testing/expansion-harness.js +136 -134
- package/esm2015/form-field/error.js +26 -23
- package/esm2015/form-field/form-field-control.js +6 -10
- package/esm2015/form-field/form-field-module.js +31 -35
- package/esm2015/form-field/form-field.js +407 -409
- package/esm2015/form-field/hint.js +35 -29
- package/esm2015/form-field/label.js +8 -12
- package/esm2015/form-field/placeholder.js +8 -12
- package/esm2015/form-field/prefix.js +16 -13
- package/esm2015/form-field/suffix.js +16 -13
- package/esm2015/form-field/testing/form-field-harness.js +220 -206
- package/esm2015/grid-list/grid-list-module.js +26 -30
- package/esm2015/grid-list/grid-list.js +108 -112
- package/esm2015/grid-list/grid-tile.js +91 -111
- package/esm2015/grid-list/testing/grid-list-harness.js +62 -66
- package/esm2015/grid-list/testing/grid-tile-harness.js +69 -73
- package/esm2015/grid-list/tile-styler.js +1 -1
- package/esm2015/icon/icon-module.js +10 -14
- package/esm2015/icon/icon-registry.js +406 -410
- package/esm2015/icon/icon.js +228 -232
- package/esm2015/icon/testing/fake-icon-registry.js +66 -74
- package/esm2015/input/autosize.js +30 -34
- package/esm2015/input/input-module.js +21 -25
- package/esm2015/input/input.js +305 -284
- package/esm2015/input/testing/input-harness.js +129 -123
- package/esm2015/list/list-module.js +32 -36
- package/esm2015/list/list.js +165 -189
- package/esm2015/list/selection-list.js +503 -511
- package/esm2015/list/testing/action-list-harness.js +55 -57
- package/esm2015/list/testing/list-harness.js +31 -39
- package/esm2015/list/testing/list-item-harness-base.js +13 -17
- package/esm2015/list/testing/nav-list-harness.js +62 -64
- package/esm2015/list/testing/selection-list-harness.js +136 -138
- package/esm2015/menu/menu-content.js +74 -71
- package/esm2015/menu/menu-item.js +119 -123
- package/esm2015/menu/menu-module.js +29 -37
- package/esm2015/menu/menu-panel.js +1 -1
- package/esm2015/menu/menu-trigger.js +402 -405
- package/esm2015/menu/menu.js +329 -339
- package/esm2015/menu/testing/menu-harness.js +193 -189
- package/esm2015/paginator/paginator-intl.js +36 -40
- package/esm2015/paginator/paginator-module.js +16 -20
- package/esm2015/paginator/paginator.js +205 -209
- package/esm2015/paginator/testing/paginator-harness.js +91 -95
- package/esm2015/progress-bar/progress-bar-module.js +10 -14
- package/esm2015/progress-bar/progress-bar.js +114 -118
- package/esm2015/progress-bar/testing/progress-bar-harness.js +27 -31
- package/esm2015/progress-spinner/progress-spinner-module.js +17 -21
- package/esm2015/progress-spinner/progress-spinner.js +181 -189
- package/esm2015/progress-spinner/testing/progress-spinner-harness.js +28 -32
- package/esm2015/radio/radio-module.js +10 -14
- package/esm2015/radio/radio.js +437 -444
- package/esm2015/radio/testing/radio-harness.js +241 -243
- package/esm2015/select/select-module.js +23 -27
- package/esm2015/select/select.js +917 -918
- package/esm2015/select/testing/select-harness.js +138 -136
- package/esm2015/sidenav/drawer.js +632 -620
- package/esm2015/sidenav/sidenav-module.js +31 -35
- package/esm2015/sidenav/sidenav.js +104 -116
- package/esm2015/sidenav/testing/drawer-harness.js +40 -44
- package/esm2015/sidenav/testing/sidenav-harness.js +20 -24
- package/esm2015/slide-toggle/slide-toggle-module.js +27 -35
- package/esm2015/slide-toggle/slide-toggle-required-validator.js +9 -13
- package/esm2015/slide-toggle/slide-toggle.js +184 -188
- package/esm2015/slide-toggle/testing/slide-toggle-harness.js +123 -121
- package/esm2015/slider/slider-module.js +10 -14
- package/esm2015/slider/slider.js +640 -644
- package/esm2015/slider/testing/slider-harness.js +129 -127
- package/esm2015/snack-bar/simple-snack-bar.js +32 -36
- package/esm2015/snack-bar/snack-bar-container.js +144 -148
- package/esm2015/snack-bar/snack-bar-module.js +17 -21
- package/esm2015/snack-bar/snack-bar-ref.js +1 -1
- package/esm2015/snack-bar/snack-bar.js +208 -205
- package/esm2015/snack-bar/testing/snack-bar-harness.js +112 -116
- package/esm2015/sort/sort-header-intl.js +21 -21
- package/esm2015/sort/sort-header.js +200 -194
- package/esm2015/sort/sort-module.js +11 -15
- package/esm2015/sort/sort.js +92 -96
- package/esm2015/sort/testing/sort-harness.js +28 -32
- package/esm2015/sort/testing/sort-header-harness.js +66 -67
- package/esm2015/stepper/step-header.js +78 -82
- package/esm2015/stepper/step-label.js +8 -12
- package/esm2015/stepper/stepper-button.js +23 -31
- package/esm2015/stepper/stepper-icon.js +16 -20
- package/esm2015/stepper/stepper-intl.js +15 -19
- package/esm2015/stepper/stepper-module.js +40 -44
- package/esm2015/stepper/stepper.js +139 -155
- package/esm2015/table/cell.js +94 -122
- package/esm2015/table/row.js +90 -118
- package/esm2015/table/table-module.js +13 -17
- package/esm2015/table/table.js +26 -30
- package/esm2015/table/testing/cell-harness.js +56 -68
- package/esm2015/table/testing/row-harness.js +90 -102
- package/esm2015/table/testing/table-harness.js +65 -69
- package/esm2015/table/text-column.js +17 -21
- package/esm2015/tabs/index.js +4 -2
- package/esm2015/tabs/ink-bar.js +55 -59
- package/esm2015/tabs/paginated-tab-header.js +415 -419
- package/esm2015/tabs/tab-body.js +179 -191
- package/esm2015/tabs/tab-content.js +21 -16
- package/esm2015/tabs/tab-group.js +263 -271
- package/esm2015/tabs/tab-header.js +69 -77
- package/esm2015/tabs/tab-label-wrapper.js +29 -33
- package/esm2015/tabs/tab-label.js +16 -13
- package/esm2015/tabs/tab-nav-bar/tab-nav-bar.js +199 -215
- package/esm2015/tabs/tab.js +80 -83
- package/esm2015/tabs/tabs-module.js +38 -42
- package/esm2015/tabs/testing/tab-group-harness.js +52 -56
- package/esm2015/tabs/testing/tab-harness.js +78 -82
- package/esm2015/toolbar/testing/index.js +9 -0
- package/esm2015/toolbar/testing/public-api.js +10 -0
- package/esm2015/toolbar/testing/testing.externs.js +0 -0
- package/esm2015/toolbar/testing/toolbar-harness-filters.js +8 -0
- package/esm2015/toolbar/testing/toolbar-harness.js +47 -0
- package/esm2015/toolbar/toolbar-module.js +10 -14
- package/esm2015/toolbar/toolbar.js +61 -69
- package/esm2015/tooltip/testing/tooltip-harness.js +43 -47
- package/esm2015/tooltip/tooltip-module.js +17 -21
- package/esm2015/tooltip/tooltip.js +502 -497
- package/esm2015/tree/data-source/flat-data-source.js +1 -1
- package/esm2015/tree/node.js +99 -111
- package/esm2015/tree/outlet.js +19 -23
- package/esm2015/tree/padding.js +13 -17
- package/esm2015/tree/toggle.js +15 -19
- package/esm2015/tree/tree-module.js +10 -14
- package/esm2015/tree/tree.js +23 -27
- package/expansion/testing/expansion-harness.d.ts +2 -0
- package/fesm2015/autocomplete/testing.js +98 -95
- package/fesm2015/autocomplete/testing.js.map +1 -1
- package/fesm2015/autocomplete.js +677 -687
- package/fesm2015/autocomplete.js.map +1 -1
- package/fesm2015/badge/testing.js +73 -76
- package/fesm2015/badge/testing.js.map +1 -1
- package/fesm2015/badge.js +195 -201
- package/fesm2015/badge.js.map +1 -1
- package/fesm2015/bottom-sheet/testing.js +28 -31
- package/fesm2015/bottom-sheet/testing.js.map +1 -1
- package/fesm2015/bottom-sheet.js +297 -306
- package/fesm2015/bottom-sheet.js.map +1 -1
- package/fesm2015/button/testing.js +59 -56
- package/fesm2015/button/testing.js.map +1 -1
- package/fesm2015/button-toggle/testing.js +155 -155
- package/fesm2015/button-toggle/testing.js.map +1 -1
- package/fesm2015/button-toggle.js +377 -378
- package/fesm2015/button-toggle.js.map +1 -1
- package/fesm2015/button.js +129 -133
- package/fesm2015/button.js.map +1 -1
- package/fesm2015/card/testing.js +79 -0
- package/fesm2015/card/testing.js.map +1 -0
- package/fesm2015/card.js +175 -220
- package/fesm2015/card.js.map +1 -1
- package/fesm2015/checkbox/testing.js +149 -146
- package/fesm2015/checkbox/testing.js.map +1 -1
- package/fesm2015/checkbox.js +342 -354
- package/fesm2015/checkbox.js.map +1 -1
- package/fesm2015/chips.js +1039 -1039
- package/fesm2015/chips.js.map +1 -1
- package/fesm2015/core/testing.js +88 -94
- package/fesm2015/core/testing.js.map +1 -1
- package/fesm2015/core.js +729 -773
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/datepicker.js +2821 -2884
- package/fesm2015/datepicker.js.map +1 -1
- package/fesm2015/dialog/testing.js +57 -60
- package/fesm2015/dialog/testing.js.map +1 -1
- package/fesm2015/dialog.js +564 -549
- package/fesm2015/dialog.js.map +1 -1
- package/fesm2015/divider/testing.js +15 -18
- package/fesm2015/divider/testing.js.map +1 -1
- package/fesm2015/divider.js +41 -47
- package/fesm2015/divider.js.map +1 -1
- package/fesm2015/expansion/testing.js +159 -159
- package/fesm2015/expansion/testing.js.map +1 -1
- package/fesm2015/expansion.js +422 -446
- package/fesm2015/expansion.js.map +1 -1
- package/fesm2015/form-field/testing.js +219 -204
- package/fesm2015/form-field/testing.js.map +1 -1
- package/fesm2015/form-field.js +538 -532
- package/fesm2015/form-field.js.map +1 -1
- package/fesm2015/grid-list/testing.js +129 -135
- package/fesm2015/grid-list/testing.js.map +1 -1
- package/fesm2015/grid-list.js +221 -242
- package/fesm2015/grid-list.js.map +1 -1
- package/fesm2015/icon/testing.js +65 -71
- package/fesm2015/icon/testing.js.map +1 -1
- package/fesm2015/icon.js +660 -669
- package/fesm2015/icon.js.map +1 -1
- package/fesm2015/input/testing.js +128 -121
- package/fesm2015/input/testing.js.map +1 -1
- package/fesm2015/input.js +353 -337
- package/fesm2015/input.js.map +1 -1
- package/fesm2015/list/testing.js +298 -307
- package/fesm2015/list/testing.js.map +1 -1
- package/fesm2015/list.js +698 -725
- package/fesm2015/list.js.map +1 -1
- package/fesm2015/menu/testing.js +192 -186
- package/fesm2015/menu/testing.js.map +1 -1
- package/fesm2015/menu.js +948 -962
- package/fesm2015/menu.js.map +1 -1
- package/fesm2015/paginator/testing.js +90 -93
- package/fesm2015/paginator/testing.js.map +1 -1
- package/fesm2015/paginator.js +247 -256
- package/fesm2015/paginator.js.map +1 -1
- package/fesm2015/progress-bar/testing.js +26 -29
- package/fesm2015/progress-bar/testing.js.map +1 -1
- package/fesm2015/progress-bar.js +122 -128
- package/fesm2015/progress-bar.js.map +1 -1
- package/fesm2015/progress-spinner/testing.js +27 -30
- package/fesm2015/progress-spinner/testing.js.map +1 -1
- package/fesm2015/progress-spinner.js +196 -205
- package/fesm2015/progress-spinner.js.map +1 -1
- package/fesm2015/radio/testing.js +240 -240
- package/fesm2015/radio/testing.js.map +1 -1
- package/fesm2015/radio.js +447 -453
- package/fesm2015/radio.js.map +1 -1
- package/fesm2015/select/testing.js +137 -134
- package/fesm2015/select/testing.js.map +1 -1
- package/fesm2015/select.js +939 -941
- package/fesm2015/select.js.map +1 -1
- package/fesm2015/sidenav/testing.js +58 -64
- package/fesm2015/sidenav/testing.js.map +1 -1
- package/fesm2015/sidenav.js +765 -762
- package/fesm2015/sidenav.js.map +1 -1
- package/fesm2015/slide-toggle/testing.js +122 -119
- package/fesm2015/slide-toggle/testing.js.map +1 -1
- package/fesm2015/slide-toggle.js +217 -229
- package/fesm2015/slide-toggle.js.map +1 -1
- package/fesm2015/slider/testing.js +128 -125
- package/fesm2015/slider/testing.js.map +1 -1
- package/fesm2015/slider.js +648 -654
- package/fesm2015/slider.js.map +1 -1
- package/fesm2015/snack-bar/testing.js +111 -114
- package/fesm2015/snack-bar/testing.js.map +1 -1
- package/fesm2015/snack-bar.js +426 -431
- package/fesm2015/snack-bar.js.map +1 -1
- package/fesm2015/sort/testing.js +92 -95
- package/fesm2015/sort/testing.js.map +1 -1
- package/fesm2015/sort.js +320 -318
- package/fesm2015/sort.js.map +1 -1
- package/fesm2015/stepper.js +312 -345
- package/fesm2015/stepper.js.map +1 -1
- package/fesm2015/table/testing.js +208 -229
- package/fesm2015/table/testing.js.map +1 -1
- package/fesm2015/table.js +235 -286
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/tabs/testing.js +128 -134
- package/fesm2015/tabs/testing.js.map +1 -1
- package/fesm2015/tabs.js +1362 -1399
- package/fesm2015/tabs.js.map +1 -1
- package/fesm2015/toolbar/testing.js +74 -0
- package/fesm2015/toolbar/testing.js.map +1 -0
- package/fesm2015/toolbar.js +69 -78
- package/fesm2015/toolbar.js.map +1 -1
- package/fesm2015/tooltip/testing.js +42 -45
- package/fesm2015/tooltip/testing.js.map +1 -1
- package/fesm2015/tooltip.js +517 -513
- package/fesm2015/tooltip.js.map +1 -1
- package/fesm2015/tree.js +173 -197
- package/fesm2015/tree.js.map +1 -1
- package/form-field/error.d.ts +7 -0
- package/form-field/hint.d.ts +10 -0
- package/form-field/index.metadata.json +1 -1
- package/form-field/prefix.d.ts +7 -0
- package/form-field/suffix.d.ts +7 -0
- package/form-field/testing/form-field-harness.d.ts +8 -0
- package/grid-list/grid-list.d.ts +2 -1
- package/grid-list/index.metadata.json +1 -1
- package/grid-list/tile-styler.d.ts +10 -5
- package/input/_input-theme.scss +2 -2
- package/input/index.metadata.json +1 -1
- package/input/input.d.ts +6 -2
- package/input/testing/input-harness.d.ts +2 -0
- package/list/index.metadata.json +1 -1
- package/list/testing/action-list-harness.d.ts +2 -0
- package/list/testing/nav-list-harness.d.ts +2 -0
- package/list/testing/selection-list-harness.d.ts +2 -0
- package/menu/index.metadata.json +1 -1
- package/menu/menu-content.d.ts +7 -1
- package/menu/menu-panel.d.ts +1 -0
- package/menu/menu.d.ts +4 -0
- package/menu/testing/menu-harness.d.ts +4 -0
- package/package.json +6 -6
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/progress-spinner/index.metadata.json +1 -1
- package/radio/index.metadata.json +1 -1
- package/radio/radio.d.ts +6 -0
- package/radio/testing/radio-harness.d.ts +2 -0
- package/schematics/migration.json +5 -0
- package/schematics/ng-add/index.js +2 -2
- package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +3 -3
- package/schematics/ng-generate/navigation/schema.json +5 -0
- package/schematics/ng-update/data/index.js +1 -1
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.js +7 -2
- package/schematics/ng-update/migrations/hammer-gestures-v9/hammer-gestures-migration.js +639 -639
- package/schematics/ng-update/migrations/misc-ripples-v7/ripple-speed-factor-migration.js +1 -1
- package/select/index.metadata.json +1 -1
- package/select/select.d.ts +6 -0
- package/select/testing/select-harness.d.ts +2 -0
- package/sidenav/drawer.d.ts +15 -3
- package/sidenav/index.metadata.json +1 -1
- package/slide-toggle/index.metadata.json +1 -1
- package/slide-toggle/testing/slide-toggle-harness.d.ts +2 -0
- package/slider/testing/slider-harness.d.ts +2 -0
- package/snack-bar/index.metadata.json +1 -1
- package/snack-bar/simple-snack-bar.d.ts +13 -1
- package/snack-bar/snack-bar-container.d.ts +16 -3
- package/snack-bar/snack-bar-ref.d.ts +3 -3
- package/snack-bar/snack-bar.d.ts +10 -3
- package/sort/index.metadata.json +1 -1
- package/sort/sort-header-intl.d.ts +5 -1
- package/sort/sort-header.d.ts +3 -1
- package/sort/testing/sort-header-harness.d.ts +6 -2
- package/tabs/index.d.ts +3 -1
- package/tabs/index.metadata.json +1 -1
- package/tabs/tab-content.d.ts +7 -1
- package/tabs/tab-label.d.ts +7 -0
- package/toolbar/testing/index.d.ts +8 -0
- package/toolbar/testing/package.json +9 -0
- package/toolbar/testing/public-api.d.ts +9 -0
- package/toolbar/testing/toolbar-harness-filters.d.ts +13 -0
- package/toolbar/testing/toolbar-harness.d.ts +31 -0
- package/tooltip/index.metadata.json +1 -1
- package/tooltip/tooltip.d.ts +1 -0
- package/tree/data-source/flat-data-source.d.ts +4 -4
- package/tree/index.metadata.json +1 -1
package/fesm2015/snack-bar.js
CHANGED
|
@@ -10,6 +10,38 @@ import { trigger, state, style, transition, animate } from '@angular/animations'
|
|
|
10
10
|
import { LiveAnnouncer } from '@angular/cdk/a11y';
|
|
11
11
|
import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright Google LLC All Rights Reserved.
|
|
16
|
+
*
|
|
17
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
18
|
+
* found in the LICENSE file at https://angular.io/license
|
|
19
|
+
*/
|
|
20
|
+
/** Injection token that can be used to access the data that was passed in to a snack bar. */
|
|
21
|
+
const MAT_SNACK_BAR_DATA = new InjectionToken('MatSnackBarData');
|
|
22
|
+
/**
|
|
23
|
+
* Configuration used when opening a snack-bar.
|
|
24
|
+
*/
|
|
25
|
+
class MatSnackBarConfig {
|
|
26
|
+
constructor() {
|
|
27
|
+
/** The politeness level for the MatAriaLiveAnnouncer announcement. */
|
|
28
|
+
this.politeness = 'assertive';
|
|
29
|
+
/**
|
|
30
|
+
* Message to be announced by the LiveAnnouncer. When opening a snackbar without a custom
|
|
31
|
+
* component or template, the announcement message will default to the specified message.
|
|
32
|
+
*/
|
|
33
|
+
this.announcementMessage = '';
|
|
34
|
+
/** The length of time in milliseconds to wait before automatically dismissing the snack bar. */
|
|
35
|
+
this.duration = 0;
|
|
36
|
+
/** Data being injected into the child component. */
|
|
37
|
+
this.data = null;
|
|
38
|
+
/** The horizontal position to place the snack bar. */
|
|
39
|
+
this.horizontalPosition = 'center';
|
|
40
|
+
/** The vertical position to place the snack bar. */
|
|
41
|
+
this.verticalPosition = 'bottom';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
13
45
|
/**
|
|
14
46
|
* @license
|
|
15
47
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -98,38 +130,6 @@ class MatSnackBarRef {
|
|
|
98
130
|
}
|
|
99
131
|
}
|
|
100
132
|
|
|
101
|
-
/**
|
|
102
|
-
* @license
|
|
103
|
-
* Copyright Google LLC All Rights Reserved.
|
|
104
|
-
*
|
|
105
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
106
|
-
* found in the LICENSE file at https://angular.io/license
|
|
107
|
-
*/
|
|
108
|
-
/** Injection token that can be used to access the data that was passed in to a snack bar. */
|
|
109
|
-
const MAT_SNACK_BAR_DATA = new InjectionToken('MatSnackBarData');
|
|
110
|
-
/**
|
|
111
|
-
* Configuration used when opening a snack-bar.
|
|
112
|
-
*/
|
|
113
|
-
class MatSnackBarConfig {
|
|
114
|
-
constructor() {
|
|
115
|
-
/** The politeness level for the MatAriaLiveAnnouncer announcement. */
|
|
116
|
-
this.politeness = 'assertive';
|
|
117
|
-
/**
|
|
118
|
-
* Message to be announced by the LiveAnnouncer. When opening a snackbar without a custom
|
|
119
|
-
* component or template, the announcement message will default to the specified message.
|
|
120
|
-
*/
|
|
121
|
-
this.announcementMessage = '';
|
|
122
|
-
/** The length of time in milliseconds to wait before automatically dismissing the snack bar. */
|
|
123
|
-
this.duration = 0;
|
|
124
|
-
/** Data being injected into the child component. */
|
|
125
|
-
this.data = null;
|
|
126
|
-
/** The horizontal position to place the snack bar. */
|
|
127
|
-
this.horizontalPosition = 'center';
|
|
128
|
-
/** The vertical position to place the snack bar. */
|
|
129
|
-
this.verticalPosition = 'bottom';
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
133
|
/**
|
|
134
134
|
* @license
|
|
135
135
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -141,39 +141,36 @@ class MatSnackBarConfig {
|
|
|
141
141
|
* A component used to open as the default snack bar, matching material spec.
|
|
142
142
|
* This should only be used internally by the snack bar service.
|
|
143
143
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return !!this.data.action;
|
|
157
|
-
}
|
|
144
|
+
class SimpleSnackBar {
|
|
145
|
+
constructor(snackBarRef, data) {
|
|
146
|
+
this.snackBarRef = snackBarRef;
|
|
147
|
+
this.data = data;
|
|
148
|
+
}
|
|
149
|
+
/** Performs the action on the snack bar. */
|
|
150
|
+
action() {
|
|
151
|
+
this.snackBarRef.dismissWithAction();
|
|
152
|
+
}
|
|
153
|
+
/** If the action button should be shown. */
|
|
154
|
+
get hasAction() {
|
|
155
|
+
return !!this.data.action;
|
|
158
156
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
]
|
|
175
|
-
|
|
176
|
-
})();
|
|
157
|
+
}
|
|
158
|
+
SimpleSnackBar.decorators = [
|
|
159
|
+
{ type: Component, args: [{
|
|
160
|
+
selector: 'simple-snack-bar',
|
|
161
|
+
template: "<span>{{data.message}}</span>\n<div class=\"mat-simple-snackbar-action\" *ngIf=\"hasAction\">\n <button mat-button (click)=\"action()\">{{data.action}}</button>\n</div>\n",
|
|
162
|
+
encapsulation: ViewEncapsulation.None,
|
|
163
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
164
|
+
host: {
|
|
165
|
+
'class': 'mat-simple-snackbar',
|
|
166
|
+
},
|
|
167
|
+
styles: [".mat-simple-snackbar{display:flex;justify-content:space-between;align-items:center;line-height:20px;opacity:1}.mat-simple-snackbar-action{flex-shrink:0;margin:-8px -8px -8px 8px}.mat-simple-snackbar-action button{max-height:36px;min-width:0}[dir=rtl] .mat-simple-snackbar-action{margin-left:-8px;margin-right:8px}\n"]
|
|
168
|
+
},] }
|
|
169
|
+
];
|
|
170
|
+
SimpleSnackBar.ctorParameters = () => [
|
|
171
|
+
{ type: MatSnackBarRef },
|
|
172
|
+
{ type: undefined, decorators: [{ type: Inject, args: [MAT_SNACK_BAR_DATA,] }] }
|
|
173
|
+
];
|
|
177
174
|
|
|
178
175
|
/**
|
|
179
176
|
* @license
|
|
@@ -215,166 +212,163 @@ const matSnackBarAnimations = {
|
|
|
215
212
|
* Internal component that wraps user-provided snack bar content.
|
|
216
213
|
* @docs-private
|
|
217
214
|
*/
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.attachDomPortal = (portal) => {
|
|
242
|
-
this._assertNotAttached();
|
|
243
|
-
this._applySnackBarClasses();
|
|
244
|
-
return this._portalOutlet.attachDomPortal(portal);
|
|
245
|
-
};
|
|
246
|
-
// Based on the ARIA spec, `alert` and `status` roles have an
|
|
247
|
-
// implicit `assertive` and `polite` politeness respectively.
|
|
248
|
-
if (snackBarConfig.politeness === 'assertive' && !snackBarConfig.announcementMessage) {
|
|
249
|
-
this._role = 'alert';
|
|
250
|
-
}
|
|
251
|
-
else if (snackBarConfig.politeness === 'off') {
|
|
252
|
-
this._role = null;
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
this._role = 'status';
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
/** Attach a component portal as content to this snack bar container. */
|
|
259
|
-
attachComponentPortal(portal) {
|
|
215
|
+
class MatSnackBarContainer extends BasePortalOutlet {
|
|
216
|
+
constructor(_ngZone, _elementRef, _changeDetectorRef,
|
|
217
|
+
/** The snack bar configuration. */
|
|
218
|
+
snackBarConfig) {
|
|
219
|
+
super();
|
|
220
|
+
this._ngZone = _ngZone;
|
|
221
|
+
this._elementRef = _elementRef;
|
|
222
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
223
|
+
this.snackBarConfig = snackBarConfig;
|
|
224
|
+
/** Whether the component has been destroyed. */
|
|
225
|
+
this._destroyed = false;
|
|
226
|
+
/** Subject for notifying that the snack bar has exited from view. */
|
|
227
|
+
this._onExit = new Subject();
|
|
228
|
+
/** Subject for notifying that the snack bar has finished entering the view. */
|
|
229
|
+
this._onEnter = new Subject();
|
|
230
|
+
/** The state of the snack bar animations. */
|
|
231
|
+
this._animationState = 'void';
|
|
232
|
+
/**
|
|
233
|
+
* Attaches a DOM portal to the snack bar container.
|
|
234
|
+
* @deprecated To be turned into a method.
|
|
235
|
+
* @breaking-change 10.0.0
|
|
236
|
+
*/
|
|
237
|
+
this.attachDomPortal = (portal) => {
|
|
260
238
|
this._assertNotAttached();
|
|
261
239
|
this._applySnackBarClasses();
|
|
262
|
-
return this._portalOutlet.
|
|
240
|
+
return this._portalOutlet.attachDomPortal(portal);
|
|
241
|
+
};
|
|
242
|
+
// Based on the ARIA spec, `alert` and `status` roles have an
|
|
243
|
+
// implicit `assertive` and `polite` politeness respectively.
|
|
244
|
+
if (snackBarConfig.politeness === 'assertive' && !snackBarConfig.announcementMessage) {
|
|
245
|
+
this._role = 'alert';
|
|
263
246
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
this._assertNotAttached();
|
|
267
|
-
this._applySnackBarClasses();
|
|
268
|
-
return this._portalOutlet.attachTemplatePortal(portal);
|
|
247
|
+
else if (snackBarConfig.politeness === 'off') {
|
|
248
|
+
this._role = null;
|
|
269
249
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const { fromState, toState } = event;
|
|
273
|
-
if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
|
|
274
|
-
this._completeExit();
|
|
275
|
-
}
|
|
276
|
-
if (toState === 'visible') {
|
|
277
|
-
// Note: we shouldn't use `this` inside the zone callback,
|
|
278
|
-
// because it can cause a memory leak.
|
|
279
|
-
const onEnter = this._onEnter;
|
|
280
|
-
this._ngZone.run(() => {
|
|
281
|
-
onEnter.next();
|
|
282
|
-
onEnter.complete();
|
|
283
|
-
});
|
|
284
|
-
}
|
|
250
|
+
else {
|
|
251
|
+
this._role = 'status';
|
|
285
252
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return this._onExit;
|
|
304
|
-
}
|
|
305
|
-
/** Makes sure the exit callbacks have been invoked when the element is destroyed. */
|
|
306
|
-
ngOnDestroy() {
|
|
307
|
-
this._destroyed = true;
|
|
253
|
+
}
|
|
254
|
+
/** Attach a component portal as content to this snack bar container. */
|
|
255
|
+
attachComponentPortal(portal) {
|
|
256
|
+
this._assertNotAttached();
|
|
257
|
+
this._applySnackBarClasses();
|
|
258
|
+
return this._portalOutlet.attachComponentPortal(portal);
|
|
259
|
+
}
|
|
260
|
+
/** Attach a template portal as content to this snack bar container. */
|
|
261
|
+
attachTemplatePortal(portal) {
|
|
262
|
+
this._assertNotAttached();
|
|
263
|
+
this._applySnackBarClasses();
|
|
264
|
+
return this._portalOutlet.attachTemplatePortal(portal);
|
|
265
|
+
}
|
|
266
|
+
/** Handle end of animations, updating the state of the snackbar. */
|
|
267
|
+
onAnimationEnd(event) {
|
|
268
|
+
const { fromState, toState } = event;
|
|
269
|
+
if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
|
|
308
270
|
this._completeExit();
|
|
309
271
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
this._onExit.complete();
|
|
272
|
+
if (toState === 'visible') {
|
|
273
|
+
// Note: we shouldn't use `this` inside the zone callback,
|
|
274
|
+
// because it can cause a memory leak.
|
|
275
|
+
const onEnter = this._onEnter;
|
|
276
|
+
this._ngZone.run(() => {
|
|
277
|
+
onEnter.next();
|
|
278
|
+
onEnter.complete();
|
|
318
279
|
});
|
|
319
280
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
281
|
+
}
|
|
282
|
+
/** Begin animation of snack bar entrance into view. */
|
|
283
|
+
enter() {
|
|
284
|
+
if (!this._destroyed) {
|
|
285
|
+
this._animationState = 'visible';
|
|
286
|
+
this._changeDetectorRef.detectChanges();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/** Begin animation of the snack bar exiting from view. */
|
|
290
|
+
exit() {
|
|
291
|
+
// Note: this one transitions to `hidden`, rather than `void`, in order to handle the case
|
|
292
|
+
// where multiple snack bars are opened in quick succession (e.g. two consecutive calls to
|
|
293
|
+
// `MatSnackBar.open`).
|
|
294
|
+
this._animationState = 'hidden';
|
|
295
|
+
// Mark this element with an 'exit' attribute to indicate that the snackbar has
|
|
296
|
+
// been dismissed and will soon be removed from the DOM. This is used by the snackbar
|
|
297
|
+
// test harness.
|
|
298
|
+
this._elementRef.nativeElement.setAttribute('mat-exit', '');
|
|
299
|
+
return this._onExit;
|
|
300
|
+
}
|
|
301
|
+
/** Makes sure the exit callbacks have been invoked when the element is destroyed. */
|
|
302
|
+
ngOnDestroy() {
|
|
303
|
+
this._destroyed = true;
|
|
304
|
+
this._completeExit();
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Waits for the zone to settle before removing the element. Helps prevent
|
|
308
|
+
* errors where we end up removing an element which is in the middle of an animation.
|
|
309
|
+
*/
|
|
310
|
+
_completeExit() {
|
|
311
|
+
this._ngZone.onMicrotaskEmpty.asObservable().pipe(take(1)).subscribe(() => {
|
|
312
|
+
this._onExit.next();
|
|
313
|
+
this._onExit.complete();
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/** Applies the various positioning and user-configured CSS classes to the snack bar. */
|
|
317
|
+
_applySnackBarClasses() {
|
|
318
|
+
const element = this._elementRef.nativeElement;
|
|
319
|
+
const panelClasses = this.snackBarConfig.panelClass;
|
|
320
|
+
if (panelClasses) {
|
|
321
|
+
if (Array.isArray(panelClasses)) {
|
|
322
|
+
// Note that we can't use a spread here, because IE doesn't support multiple arguments.
|
|
323
|
+
panelClasses.forEach(cssClass => element.classList.add(cssClass));
|
|
335
324
|
}
|
|
336
|
-
|
|
337
|
-
element.classList.add(
|
|
325
|
+
else {
|
|
326
|
+
element.classList.add(panelClasses);
|
|
338
327
|
}
|
|
339
328
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
329
|
+
if (this.snackBarConfig.horizontalPosition === 'center') {
|
|
330
|
+
element.classList.add('mat-snack-bar-center');
|
|
331
|
+
}
|
|
332
|
+
if (this.snackBarConfig.verticalPosition === 'top') {
|
|
333
|
+
element.classList.add('mat-snack-bar-top');
|
|
345
334
|
}
|
|
346
335
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
}
|
|
336
|
+
/** Asserts that no content is already attached to the container. */
|
|
337
|
+
_assertNotAttached() {
|
|
338
|
+
if (this._portalOutlet.hasAttached()) {
|
|
339
|
+
throw Error('Attempting to attach snack bar content after content is already attached');
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
MatSnackBarContainer.decorators = [
|
|
344
|
+
{ type: Component, args: [{
|
|
345
|
+
selector: 'snack-bar-container',
|
|
346
|
+
template: "<ng-template cdkPortalOutlet></ng-template>\n",
|
|
347
|
+
// In Ivy embedded views will be change detected from their declaration place, rather than
|
|
348
|
+
// where they were stamped out. This means that we can't have the snack bar container be OnPush,
|
|
349
|
+
// because it might cause snack bars that were opened from a template not to be out of date.
|
|
350
|
+
// tslint:disable-next-line:validate-decorators
|
|
351
|
+
changeDetection: ChangeDetectionStrategy.Default,
|
|
352
|
+
encapsulation: ViewEncapsulation.None,
|
|
353
|
+
animations: [matSnackBarAnimations.snackBarState],
|
|
354
|
+
host: {
|
|
355
|
+
'[attr.role]': '_role',
|
|
356
|
+
'class': 'mat-snack-bar-container',
|
|
357
|
+
'[@state]': '_animationState',
|
|
358
|
+
'(@state.done)': 'onAnimationEnd($event)'
|
|
359
|
+
},
|
|
360
|
+
styles: [".mat-snack-bar-container{border-radius:4px;box-sizing:border-box;display:block;margin:24px;max-width:33vw;min-width:344px;padding:14px 16px;min-height:48px;transform-origin:center}.cdk-high-contrast-active .mat-snack-bar-container{border:solid 1px}.mat-snack-bar-handset{width:100%}.mat-snack-bar-handset .mat-snack-bar-container{margin:8px;max-width:100%;min-width:0;width:100%}\n"]
|
|
361
|
+
},] }
|
|
362
|
+
];
|
|
363
|
+
MatSnackBarContainer.ctorParameters = () => [
|
|
364
|
+
{ type: NgZone },
|
|
365
|
+
{ type: ElementRef },
|
|
366
|
+
{ type: ChangeDetectorRef },
|
|
367
|
+
{ type: MatSnackBarConfig }
|
|
368
|
+
];
|
|
369
|
+
MatSnackBarContainer.propDecorators = {
|
|
370
|
+
_portalOutlet: [{ type: ViewChild, args: [CdkPortalOutlet, { static: true },] }]
|
|
371
|
+
};
|
|
378
372
|
|
|
379
373
|
/**
|
|
380
374
|
* @license
|
|
@@ -383,25 +377,22 @@ let MatSnackBarContainer = /** @class */ (() => {
|
|
|
383
377
|
* Use of this source code is governed by an MIT-style license that can be
|
|
384
378
|
* found in the LICENSE file at https://angular.io/license
|
|
385
379
|
*/
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
];
|
|
403
|
-
return MatSnackBarModule;
|
|
404
|
-
})();
|
|
380
|
+
class MatSnackBarModule {
|
|
381
|
+
}
|
|
382
|
+
MatSnackBarModule.decorators = [
|
|
383
|
+
{ type: NgModule, args: [{
|
|
384
|
+
imports: [
|
|
385
|
+
OverlayModule,
|
|
386
|
+
PortalModule,
|
|
387
|
+
CommonModule,
|
|
388
|
+
MatButtonModule,
|
|
389
|
+
MatCommonModule,
|
|
390
|
+
],
|
|
391
|
+
exports: [MatSnackBarContainer, MatCommonModule],
|
|
392
|
+
declarations: [MatSnackBarContainer, SimpleSnackBar],
|
|
393
|
+
entryComponents: [MatSnackBarContainer, SimpleSnackBar],
|
|
394
|
+
},] }
|
|
395
|
+
];
|
|
405
396
|
|
|
406
397
|
/**
|
|
407
398
|
* @license
|
|
@@ -422,224 +413,228 @@ function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY() {
|
|
|
422
413
|
/**
|
|
423
414
|
* Service to dispatch Material Design snack bar messages.
|
|
424
415
|
*/
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
this._defaultConfig = _defaultConfig;
|
|
434
|
-
/**
|
|
435
|
-
* Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
|
|
436
|
-
* If there is a parent snack-bar service, all operations should delegate to that parent
|
|
437
|
-
* via `_openedSnackBarRef`.
|
|
438
|
-
*/
|
|
439
|
-
this._snackBarRefAtThisLevel = null;
|
|
440
|
-
}
|
|
441
|
-
/** Reference to the currently opened snackbar at *any* level. */
|
|
442
|
-
get _openedSnackBarRef() {
|
|
443
|
-
const parent = this._parentSnackBar;
|
|
444
|
-
return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
|
|
445
|
-
}
|
|
446
|
-
set _openedSnackBarRef(value) {
|
|
447
|
-
if (this._parentSnackBar) {
|
|
448
|
-
this._parentSnackBar._openedSnackBarRef = value;
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
this._snackBarRefAtThisLevel = value;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Creates and dispatches a snack bar with a custom component for the content, removing any
|
|
456
|
-
* currently opened snack bars.
|
|
457
|
-
*
|
|
458
|
-
* @param component Component to be instantiated.
|
|
459
|
-
* @param config Extra configuration for the snack bar.
|
|
460
|
-
*/
|
|
461
|
-
openFromComponent(component, config) {
|
|
462
|
-
return this._attach(component, config);
|
|
463
|
-
}
|
|
416
|
+
class MatSnackBar {
|
|
417
|
+
constructor(_overlay, _live, _injector, _breakpointObserver, _parentSnackBar, _defaultConfig) {
|
|
418
|
+
this._overlay = _overlay;
|
|
419
|
+
this._live = _live;
|
|
420
|
+
this._injector = _injector;
|
|
421
|
+
this._breakpointObserver = _breakpointObserver;
|
|
422
|
+
this._parentSnackBar = _parentSnackBar;
|
|
423
|
+
this._defaultConfig = _defaultConfig;
|
|
464
424
|
/**
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* @param template Template to be instantiated.
|
|
469
|
-
* @param config Extra configuration for the snack bar.
|
|
425
|
+
* Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
|
|
426
|
+
* If there is a parent snack-bar service, all operations should delegate to that parent
|
|
427
|
+
* via `_openedSnackBarRef`.
|
|
470
428
|
*/
|
|
471
|
-
|
|
472
|
-
|
|
429
|
+
this._snackBarRefAtThisLevel = null;
|
|
430
|
+
/** The component that should be rendered as the snack bar's simple component. */
|
|
431
|
+
this.simpleSnackBarComponent = SimpleSnackBar;
|
|
432
|
+
/** The container component that attaches the provided template or component. */
|
|
433
|
+
this.snackBarContainerComponent = MatSnackBarContainer;
|
|
434
|
+
/** The CSS class to applie for handset mode. */
|
|
435
|
+
this.handsetCssClass = 'mat-snack-bar-handset';
|
|
436
|
+
}
|
|
437
|
+
/** Reference to the currently opened snackbar at *any* level. */
|
|
438
|
+
get _openedSnackBarRef() {
|
|
439
|
+
const parent = this._parentSnackBar;
|
|
440
|
+
return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
|
|
441
|
+
}
|
|
442
|
+
set _openedSnackBarRef(value) {
|
|
443
|
+
if (this._parentSnackBar) {
|
|
444
|
+
this._parentSnackBar._openedSnackBarRef = value;
|
|
473
445
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
* @param message The message to show in the snackbar.
|
|
477
|
-
* @param action The label for the snackbar action.
|
|
478
|
-
* @param config Additional configuration options for the snackbar.
|
|
479
|
-
*/
|
|
480
|
-
open(message, action = '', config) {
|
|
481
|
-
const _config = Object.assign(Object.assign({}, this._defaultConfig), config);
|
|
482
|
-
// Since the user doesn't have access to the component, we can
|
|
483
|
-
// override the data to pass in our own message and action.
|
|
484
|
-
_config.data = { message, action };
|
|
485
|
-
if (!_config.announcementMessage) {
|
|
486
|
-
_config.announcementMessage = message;
|
|
487
|
-
}
|
|
488
|
-
return this.openFromComponent(SimpleSnackBar, _config);
|
|
446
|
+
else {
|
|
447
|
+
this._snackBarRefAtThisLevel = value;
|
|
489
448
|
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Creates and dispatches a snack bar with a custom component for the content, removing any
|
|
452
|
+
* currently opened snack bars.
|
|
453
|
+
*
|
|
454
|
+
* @param component Component to be instantiated.
|
|
455
|
+
* @param config Extra configuration for the snack bar.
|
|
456
|
+
*/
|
|
457
|
+
openFromComponent(component, config) {
|
|
458
|
+
return this._attach(component, config);
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Creates and dispatches a snack bar with a custom template for the content, removing any
|
|
462
|
+
* currently opened snack bars.
|
|
463
|
+
*
|
|
464
|
+
* @param template Template to be instantiated.
|
|
465
|
+
* @param config Extra configuration for the snack bar.
|
|
466
|
+
*/
|
|
467
|
+
openFromTemplate(template, config) {
|
|
468
|
+
return this._attach(template, config);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Opens a snackbar with a message and an optional action.
|
|
472
|
+
* @param message The message to show in the snackbar.
|
|
473
|
+
* @param action The label for the snackbar action.
|
|
474
|
+
* @param config Additional configuration options for the snackbar.
|
|
475
|
+
*/
|
|
476
|
+
open(message, action = '', config) {
|
|
477
|
+
const _config = Object.assign(Object.assign({}, this._defaultConfig), config);
|
|
478
|
+
// Since the user doesn't have access to the component, we can
|
|
479
|
+
// override the data to pass in our own message and action.
|
|
480
|
+
_config.data = { message, action };
|
|
481
|
+
// Since the snack bar has `role="alert"`, we don't
|
|
482
|
+
// want to announce the same message twice.
|
|
483
|
+
if (_config.announcementMessage === message) {
|
|
484
|
+
_config.announcementMessage = undefined;
|
|
497
485
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
486
|
+
return this.openFromComponent(this.simpleSnackBarComponent, _config);
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Dismisses the currently-visible snack bar.
|
|
490
|
+
*/
|
|
491
|
+
dismiss() {
|
|
492
|
+
if (this._openedSnackBarRef) {
|
|
493
|
+
this._openedSnackBarRef.dismiss();
|
|
503
494
|
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const injector = new PortalInjector(userInjector || this._injector, new WeakMap([
|
|
510
|
-
[MatSnackBarConfig, config]
|
|
511
|
-
]));
|
|
512
|
-
const containerPortal = new ComponentPortal(MatSnackBarContainer, config.viewContainerRef, injector);
|
|
513
|
-
const containerRef = overlayRef.attach(containerPortal);
|
|
514
|
-
containerRef.instance.snackBarConfig = config;
|
|
515
|
-
return containerRef.instance;
|
|
495
|
+
}
|
|
496
|
+
ngOnDestroy() {
|
|
497
|
+
// Only dismiss the snack bar at the current level on destroy.
|
|
498
|
+
if (this._snackBarRefAtThisLevel) {
|
|
499
|
+
this._snackBarRefAtThisLevel.dismiss();
|
|
516
500
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const classList = overlayRef.overlayElement.classList;
|
|
544
|
-
const className = 'mat-snack-bar-handset';
|
|
545
|
-
state.matches ? classList.add(className) : classList.remove(className);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Attaches the snack bar container component to the overlay.
|
|
504
|
+
*/
|
|
505
|
+
_attachSnackBarContainer(overlayRef, config) {
|
|
506
|
+
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
507
|
+
const injector = new PortalInjector(userInjector || this._injector, new WeakMap([
|
|
508
|
+
[MatSnackBarConfig, config]
|
|
509
|
+
]));
|
|
510
|
+
const containerPortal = new ComponentPortal(this.snackBarContainerComponent, config.viewContainerRef, injector);
|
|
511
|
+
const containerRef = overlayRef.attach(containerPortal);
|
|
512
|
+
containerRef.instance.snackBarConfig = config;
|
|
513
|
+
return containerRef.instance;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Places a new component or a template as the content of the snack bar container.
|
|
517
|
+
*/
|
|
518
|
+
_attach(content, userConfig) {
|
|
519
|
+
const config = Object.assign(Object.assign(Object.assign({}, new MatSnackBarConfig()), this._defaultConfig), userConfig);
|
|
520
|
+
const overlayRef = this._createOverlay(config);
|
|
521
|
+
const container = this._attachSnackBarContainer(overlayRef, config);
|
|
522
|
+
const snackBarRef = new MatSnackBarRef(container, overlayRef);
|
|
523
|
+
if (content instanceof TemplateRef) {
|
|
524
|
+
const portal = new TemplatePortal(content, null, {
|
|
525
|
+
$implicit: config.data,
|
|
526
|
+
snackBarRef
|
|
546
527
|
});
|
|
547
|
-
|
|
548
|
-
this._openedSnackBarRef = snackBarRef;
|
|
549
|
-
return this._openedSnackBarRef;
|
|
528
|
+
snackBarRef.instance = container.attachTemplatePortal(portal);
|
|
550
529
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if (config.duration && config.duration > 0) {
|
|
577
|
-
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
530
|
+
else {
|
|
531
|
+
const injector = this._createInjector(config, snackBarRef);
|
|
532
|
+
const portal = new ComponentPortal(content, undefined, injector);
|
|
533
|
+
const contentRef = container.attachComponentPortal(portal);
|
|
534
|
+
// We can't pass this via the injector, because the injector is created earlier.
|
|
535
|
+
snackBarRef.instance = contentRef.instance;
|
|
536
|
+
}
|
|
537
|
+
// Subscribe to the breakpoint observer and attach the mat-snack-bar-handset class as
|
|
538
|
+
// appropriate. This class is applied to the overlay element because the overlay must expand to
|
|
539
|
+
// fill the width of the screen for full width snackbars.
|
|
540
|
+
this._breakpointObserver.observe(Breakpoints.HandsetPortrait).pipe(takeUntil(overlayRef.detachments())).subscribe(state => {
|
|
541
|
+
const classList = overlayRef.overlayElement.classList;
|
|
542
|
+
state.matches ? classList.add(this.handsetCssClass) : classList.remove(this.handsetCssClass);
|
|
543
|
+
});
|
|
544
|
+
this._animateSnackBar(snackBarRef, config);
|
|
545
|
+
this._openedSnackBarRef = snackBarRef;
|
|
546
|
+
return this._openedSnackBarRef;
|
|
547
|
+
}
|
|
548
|
+
/** Animates the old snack bar out and the new one in. */
|
|
549
|
+
_animateSnackBar(snackBarRef, config) {
|
|
550
|
+
// When the snackbar is dismissed, clear the reference to it.
|
|
551
|
+
snackBarRef.afterDismissed().subscribe(() => {
|
|
552
|
+
// Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
|
|
553
|
+
if (this._openedSnackBarRef == snackBarRef) {
|
|
554
|
+
this._openedSnackBarRef = null;
|
|
578
555
|
}
|
|
579
556
|
if (config.announcementMessage) {
|
|
580
|
-
this._live.
|
|
557
|
+
this._live.clear();
|
|
581
558
|
}
|
|
559
|
+
});
|
|
560
|
+
if (this._openedSnackBarRef) {
|
|
561
|
+
// If a snack bar is already in view, dismiss it and enter the
|
|
562
|
+
// new snack bar after exit animation is complete.
|
|
563
|
+
this._openedSnackBarRef.afterDismissed().subscribe(() => {
|
|
564
|
+
snackBarRef.containerInstance.enter();
|
|
565
|
+
});
|
|
566
|
+
this._openedSnackBarRef.dismiss();
|
|
582
567
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
*/
|
|
587
|
-
_createOverlay(config) {
|
|
588
|
-
const overlayConfig = new OverlayConfig();
|
|
589
|
-
overlayConfig.direction = config.direction;
|
|
590
|
-
let positionStrategy = this._overlay.position().global();
|
|
591
|
-
// Set horizontal position.
|
|
592
|
-
const isRtl = config.direction === 'rtl';
|
|
593
|
-
const isLeft = (config.horizontalPosition === 'left' ||
|
|
594
|
-
(config.horizontalPosition === 'start' && !isRtl) ||
|
|
595
|
-
(config.horizontalPosition === 'end' && isRtl));
|
|
596
|
-
const isRight = !isLeft && config.horizontalPosition !== 'center';
|
|
597
|
-
if (isLeft) {
|
|
598
|
-
positionStrategy.left('0');
|
|
599
|
-
}
|
|
600
|
-
else if (isRight) {
|
|
601
|
-
positionStrategy.right('0');
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
positionStrategy.centerHorizontally();
|
|
605
|
-
}
|
|
606
|
-
// Set horizontal position.
|
|
607
|
-
if (config.verticalPosition === 'top') {
|
|
608
|
-
positionStrategy.top('0');
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
positionStrategy.bottom('0');
|
|
612
|
-
}
|
|
613
|
-
overlayConfig.positionStrategy = positionStrategy;
|
|
614
|
-
return this._overlay.create(overlayConfig);
|
|
568
|
+
else {
|
|
569
|
+
// If no snack bar is in view, enter the new snack bar.
|
|
570
|
+
snackBarRef.containerInstance.enter();
|
|
615
571
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
623
|
-
return new PortalInjector(userInjector || this._injector, new WeakMap([
|
|
624
|
-
[MatSnackBarRef, snackBarRef],
|
|
625
|
-
[MAT_SNACK_BAR_DATA, config.data]
|
|
626
|
-
]));
|
|
572
|
+
// If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
|
|
573
|
+
if (config.duration && config.duration > 0) {
|
|
574
|
+
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
575
|
+
}
|
|
576
|
+
if (config.announcementMessage) {
|
|
577
|
+
this._live.announce(config.announcementMessage, config.politeness);
|
|
627
578
|
}
|
|
628
579
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
580
|
+
/**
|
|
581
|
+
* Creates a new overlay and places it in the correct location.
|
|
582
|
+
* @param config The user-specified snack bar config.
|
|
583
|
+
*/
|
|
584
|
+
_createOverlay(config) {
|
|
585
|
+
const overlayConfig = new OverlayConfig();
|
|
586
|
+
overlayConfig.direction = config.direction;
|
|
587
|
+
let positionStrategy = this._overlay.position().global();
|
|
588
|
+
// Set horizontal position.
|
|
589
|
+
const isRtl = config.direction === 'rtl';
|
|
590
|
+
const isLeft = (config.horizontalPosition === 'left' ||
|
|
591
|
+
(config.horizontalPosition === 'start' && !isRtl) ||
|
|
592
|
+
(config.horizontalPosition === 'end' && isRtl));
|
|
593
|
+
const isRight = !isLeft && config.horizontalPosition !== 'center';
|
|
594
|
+
if (isLeft) {
|
|
595
|
+
positionStrategy.left('0');
|
|
596
|
+
}
|
|
597
|
+
else if (isRight) {
|
|
598
|
+
positionStrategy.right('0');
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
positionStrategy.centerHorizontally();
|
|
602
|
+
}
|
|
603
|
+
// Set horizontal position.
|
|
604
|
+
if (config.verticalPosition === 'top') {
|
|
605
|
+
positionStrategy.top('0');
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
positionStrategy.bottom('0');
|
|
609
|
+
}
|
|
610
|
+
overlayConfig.positionStrategy = positionStrategy;
|
|
611
|
+
return this._overlay.create(overlayConfig);
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Creates an injector to be used inside of a snack bar component.
|
|
615
|
+
* @param config Config that was used to create the snack bar.
|
|
616
|
+
* @param snackBarRef Reference to the snack bar.
|
|
617
|
+
*/
|
|
618
|
+
_createInjector(config, snackBarRef) {
|
|
619
|
+
const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
|
|
620
|
+
return new PortalInjector(userInjector || this._injector, new WeakMap([
|
|
621
|
+
[MatSnackBarRef, snackBarRef],
|
|
622
|
+
[MAT_SNACK_BAR_DATA, config.data]
|
|
623
|
+
]));
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
MatSnackBar.ɵprov = ɵɵdefineInjectable({ factory: function MatSnackBar_Factory() { return new MatSnackBar(ɵɵinject(Overlay), ɵɵinject(LiveAnnouncer), ɵɵinject(INJECTOR), ɵɵinject(BreakpointObserver), ɵɵinject(MatSnackBar, 12), ɵɵinject(MAT_SNACK_BAR_DEFAULT_OPTIONS)); }, token: MatSnackBar, providedIn: MatSnackBarModule });
|
|
627
|
+
MatSnackBar.decorators = [
|
|
628
|
+
{ type: Injectable, args: [{ providedIn: MatSnackBarModule },] }
|
|
629
|
+
];
|
|
630
|
+
MatSnackBar.ctorParameters = () => [
|
|
631
|
+
{ type: Overlay },
|
|
632
|
+
{ type: LiveAnnouncer },
|
|
633
|
+
{ type: Injector },
|
|
634
|
+
{ type: BreakpointObserver },
|
|
635
|
+
{ type: MatSnackBar, decorators: [{ type: Optional }, { type: SkipSelf }] },
|
|
636
|
+
{ type: MatSnackBarConfig, decorators: [{ type: Inject, args: [MAT_SNACK_BAR_DEFAULT_OPTIONS,] }] }
|
|
637
|
+
];
|
|
643
638
|
|
|
644
639
|
/**
|
|
645
640
|
* @license
|