@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/tooltip.js
CHANGED
|
@@ -88,546 +88,553 @@ function MAT_TOOLTIP_DEFAULT_OPTIONS_FACTORY() {
|
|
|
88
88
|
*
|
|
89
89
|
* https://material.io/design/components/tooltips.html
|
|
90
90
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
91
|
+
class MatTooltip {
|
|
92
|
+
constructor(_overlay, _elementRef, _scrollDispatcher, _viewContainerRef, _ngZone, _platform, _ariaDescriber, _focusMonitor, scrollStrategy, _dir, _defaultOptions) {
|
|
93
|
+
this._overlay = _overlay;
|
|
94
|
+
this._elementRef = _elementRef;
|
|
95
|
+
this._scrollDispatcher = _scrollDispatcher;
|
|
96
|
+
this._viewContainerRef = _viewContainerRef;
|
|
97
|
+
this._ngZone = _ngZone;
|
|
98
|
+
this._platform = _platform;
|
|
99
|
+
this._ariaDescriber = _ariaDescriber;
|
|
100
|
+
this._focusMonitor = _focusMonitor;
|
|
101
|
+
this._dir = _dir;
|
|
102
|
+
this._defaultOptions = _defaultOptions;
|
|
103
|
+
this._position = 'below';
|
|
104
|
+
this._disabled = false;
|
|
105
|
+
this._viewInitialized = false;
|
|
106
|
+
/** The default delay in ms before showing the tooltip after show is called */
|
|
107
|
+
this.showDelay = this._defaultOptions.showDelay;
|
|
108
|
+
/** The default delay in ms before hiding the tooltip after hide is called */
|
|
109
|
+
this.hideDelay = this._defaultOptions.hideDelay;
|
|
110
|
+
/**
|
|
111
|
+
* How touch gestures should be handled by the tooltip. On touch devices the tooltip directive
|
|
112
|
+
* uses a long press gesture to show and hide, however it can conflict with the native browser
|
|
113
|
+
* gestures. To work around the conflict, Angular Material disables native gestures on the
|
|
114
|
+
* trigger, but that might not be desirable on particular elements (e.g. inputs and draggable
|
|
115
|
+
* elements). The different values for this option configure the touch event handling as follows:
|
|
116
|
+
* - `auto` - Enables touch gestures for all elements, but tries to avoid conflicts with native
|
|
117
|
+
* browser gestures on particular elements. In particular, it allows text selection on inputs
|
|
118
|
+
* and textareas, and preserves the native browser dragging on elements marked as `draggable`.
|
|
119
|
+
* - `on` - Enables touch gestures for all elements and disables native
|
|
120
|
+
* browser gestures with no exceptions.
|
|
121
|
+
* - `off` - Disables touch gestures. Note that this will prevent the tooltip from
|
|
122
|
+
* showing on touch devices.
|
|
123
|
+
*/
|
|
124
|
+
this.touchGestures = 'auto';
|
|
125
|
+
this._message = '';
|
|
126
|
+
/** Manually-bound passive event listeners. */
|
|
127
|
+
this._passiveListeners = new Map();
|
|
128
|
+
/** Emits when the component is destroyed. */
|
|
129
|
+
this._destroyed = new Subject();
|
|
130
|
+
/**
|
|
131
|
+
* Handles the keydown events on the host element.
|
|
132
|
+
* Needs to be an arrow function so that we can use it in addEventListener.
|
|
133
|
+
*/
|
|
134
|
+
this._handleKeydown = (event) => {
|
|
135
|
+
if (this._isTooltipVisible() && event.keyCode === ESCAPE && !hasModifierKey(event)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
event.stopPropagation();
|
|
138
|
+
this._ngZone.run(() => this.hide(0));
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
this._scrollStrategy = scrollStrategy;
|
|
142
|
+
if (_defaultOptions) {
|
|
143
|
+
if (_defaultOptions.position) {
|
|
144
|
+
this.position = _defaultOptions.position;
|
|
145
|
+
}
|
|
146
|
+
if (_defaultOptions.touchGestures) {
|
|
147
|
+
this.touchGestures = _defaultOptions.touchGestures;
|
|
149
148
|
}
|
|
150
|
-
_ngZone.runOutsideAngular(() => {
|
|
151
|
-
_elementRef.nativeElement.addEventListener('keydown', this._handleKeydown);
|
|
152
|
-
});
|
|
153
149
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
_ngZone.runOutsideAngular(() => {
|
|
151
|
+
_elementRef.nativeElement.addEventListener('keydown', this._handleKeydown);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/** Allows the user to define the position of the tooltip relative to the parent element */
|
|
155
|
+
get position() { return this._position; }
|
|
156
|
+
set position(value) {
|
|
157
|
+
if (value !== this._position) {
|
|
158
|
+
this._position = value;
|
|
159
|
+
if (this._overlayRef) {
|
|
160
|
+
this._updatePosition();
|
|
161
|
+
if (this._tooltipInstance) {
|
|
162
|
+
this._tooltipInstance.show(0);
|
|
165
163
|
}
|
|
164
|
+
this._overlayRef.updatePosition();
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
}
|
|
168
|
+
/** Disables the display of the tooltip. */
|
|
169
|
+
get disabled() { return this._disabled; }
|
|
170
|
+
set disabled(value) {
|
|
171
|
+
this._disabled = coerceBooleanProperty(value);
|
|
172
|
+
// If tooltip is disabled, hide immediately.
|
|
173
|
+
if (this._disabled) {
|
|
174
|
+
this.hide(0);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this._setupPointerEvents();
|
|
176
178
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
}
|
|
180
|
+
/** The message to be displayed in the tooltip */
|
|
181
|
+
get message() { return this._message; }
|
|
182
|
+
set message(value) {
|
|
183
|
+
if (this._message) {
|
|
180
184
|
this._ariaDescriber.removeDescription(this._elementRef.nativeElement, this._message);
|
|
181
|
-
// If the message is not a string (e.g. number), convert it to a string and trim it.
|
|
182
|
-
this._message = value != null ? `${value}`.trim() : '';
|
|
183
|
-
if (!this._message && this._isTooltipVisible()) {
|
|
184
|
-
this.hide(0);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
this._updateTooltipMessage();
|
|
188
|
-
this._ngZone.runOutsideAngular(() => {
|
|
189
|
-
// The `AriaDescriber` has some functionality that avoids adding a description if it's the
|
|
190
|
-
// same as the `aria-label` of an element, however we can't know whether the tooltip trigger
|
|
191
|
-
// has a data-bound `aria-label` or when it'll be set for the first time. We can avoid the
|
|
192
|
-
// issue by deferring the description by a tick so Angular has time to set the `aria-label`.
|
|
193
|
-
Promise.resolve().then(() => {
|
|
194
|
-
this._ariaDescriber.describe(this._elementRef.nativeElement, this.message);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
185
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.
|
|
203
|
-
if (this._tooltipInstance) {
|
|
204
|
-
this._setTooltipClass(this._tooltipClass);
|
|
205
|
-
}
|
|
186
|
+
// If the message is not a string (e.g. number), convert it to a string and trim it.
|
|
187
|
+
this._message = value != null ? `${value}`.trim() : '';
|
|
188
|
+
if (!this._message && this._isTooltipVisible()) {
|
|
189
|
+
this.hide(0);
|
|
206
190
|
}
|
|
207
|
-
|
|
208
|
-
// This needs to happen after view init so the initial values for all inputs have been set.
|
|
191
|
+
else {
|
|
209
192
|
this._setupPointerEvents();
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
193
|
+
this._updateTooltipMessage();
|
|
194
|
+
this._ngZone.runOutsideAngular(() => {
|
|
195
|
+
// The `AriaDescriber` has some functionality that avoids adding a description if it's the
|
|
196
|
+
// same as the `aria-label` of an element, however we can't know whether the tooltip trigger
|
|
197
|
+
// has a data-bound `aria-label` or when it'll be set for the first time. We can avoid the
|
|
198
|
+
// issue by deferring the description by a tick so Angular has time to set the `aria-label`.
|
|
199
|
+
Promise.resolve().then(() => {
|
|
200
|
+
this._ariaDescriber.describe(this._elementRef.nativeElement, this.message);
|
|
201
|
+
});
|
|
220
202
|
});
|
|
221
203
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (this._overlayRef) {
|
|
229
|
-
this._overlayRef.dispose();
|
|
230
|
-
this._tooltipInstance = null;
|
|
231
|
-
}
|
|
232
|
-
// Clean up the event listeners set in the constructor
|
|
233
|
-
nativeElement.removeEventListener('keydown', this._handleKeydown);
|
|
234
|
-
this._passiveListeners.forEach((listener, event) => {
|
|
235
|
-
nativeElement.removeEventListener(event, listener, passiveListenerOptions);
|
|
236
|
-
});
|
|
237
|
-
this._passiveListeners.clear();
|
|
238
|
-
this._destroyed.next();
|
|
239
|
-
this._destroyed.complete();
|
|
240
|
-
this._ariaDescriber.removeDescription(nativeElement, this.message);
|
|
241
|
-
this._focusMonitor.stopMonitoring(nativeElement);
|
|
242
|
-
}
|
|
243
|
-
/** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */
|
|
244
|
-
show(delay = this.showDelay) {
|
|
245
|
-
if (this.disabled || !this.message || (this._isTooltipVisible() &&
|
|
246
|
-
!this._tooltipInstance._showTimeoutId && !this._tooltipInstance._hideTimeoutId)) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const overlayRef = this._createOverlay();
|
|
250
|
-
this._detach();
|
|
251
|
-
this._portal = this._portal || new ComponentPortal(TooltipComponent, this._viewContainerRef);
|
|
252
|
-
this._tooltipInstance = overlayRef.attach(this._portal).instance;
|
|
253
|
-
this._tooltipInstance.afterHidden()
|
|
254
|
-
.pipe(takeUntil(this._destroyed))
|
|
255
|
-
.subscribe(() => this._detach());
|
|
204
|
+
}
|
|
205
|
+
/** Classes to be passed to the tooltip. Supports the same syntax as `ngClass`. */
|
|
206
|
+
get tooltipClass() { return this._tooltipClass; }
|
|
207
|
+
set tooltipClass(value) {
|
|
208
|
+
this._tooltipClass = value;
|
|
209
|
+
if (this._tooltipInstance) {
|
|
256
210
|
this._setTooltipClass(this._tooltipClass);
|
|
257
|
-
this._updateTooltipMessage();
|
|
258
|
-
this._tooltipInstance.show(delay);
|
|
259
211
|
}
|
|
260
|
-
|
|
261
|
-
|
|
212
|
+
}
|
|
213
|
+
ngAfterViewInit() {
|
|
214
|
+
// This needs to happen after view init so the initial values for all inputs have been set.
|
|
215
|
+
this._viewInitialized = true;
|
|
216
|
+
this._setupPointerEvents();
|
|
217
|
+
this._focusMonitor.monitor(this._elementRef)
|
|
218
|
+
.pipe(takeUntil(this._destroyed))
|
|
219
|
+
.subscribe(origin => {
|
|
220
|
+
// Note that the focus monitor runs outside the Angular zone.
|
|
221
|
+
if (!origin) {
|
|
222
|
+
this._ngZone.run(() => this.hide(0));
|
|
223
|
+
}
|
|
224
|
+
else if (origin === 'keyboard') {
|
|
225
|
+
this._ngZone.run(() => this.show());
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Dispose the tooltip when destroyed.
|
|
231
|
+
*/
|
|
232
|
+
ngOnDestroy() {
|
|
233
|
+
const nativeElement = this._elementRef.nativeElement;
|
|
234
|
+
clearTimeout(this._touchstartTimeout);
|
|
235
|
+
if (this._overlayRef) {
|
|
236
|
+
this._overlayRef.dispose();
|
|
237
|
+
this._tooltipInstance = null;
|
|
238
|
+
}
|
|
239
|
+
// Clean up the event listeners set in the constructor
|
|
240
|
+
nativeElement.removeEventListener('keydown', this._handleKeydown);
|
|
241
|
+
this._passiveListeners.forEach((listener, event) => {
|
|
242
|
+
nativeElement.removeEventListener(event, listener, passiveListenerOptions);
|
|
243
|
+
});
|
|
244
|
+
this._passiveListeners.clear();
|
|
245
|
+
this._destroyed.next();
|
|
246
|
+
this._destroyed.complete();
|
|
247
|
+
this._ariaDescriber.removeDescription(nativeElement, this.message);
|
|
248
|
+
this._focusMonitor.stopMonitoring(nativeElement);
|
|
249
|
+
}
|
|
250
|
+
/** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */
|
|
251
|
+
show(delay = this.showDelay) {
|
|
252
|
+
if (this.disabled || !this.message || (this._isTooltipVisible() &&
|
|
253
|
+
!this._tooltipInstance._showTimeoutId && !this._tooltipInstance._hideTimeoutId)) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const overlayRef = this._createOverlay();
|
|
257
|
+
this._detach();
|
|
258
|
+
this._portal = this._portal || new ComponentPortal(TooltipComponent, this._viewContainerRef);
|
|
259
|
+
this._tooltipInstance = overlayRef.attach(this._portal).instance;
|
|
260
|
+
this._tooltipInstance.afterHidden()
|
|
261
|
+
.pipe(takeUntil(this._destroyed))
|
|
262
|
+
.subscribe(() => this._detach());
|
|
263
|
+
this._setTooltipClass(this._tooltipClass);
|
|
264
|
+
this._updateTooltipMessage();
|
|
265
|
+
this._tooltipInstance.show(delay);
|
|
266
|
+
}
|
|
267
|
+
/** Hides the tooltip after the delay in ms, defaults to tooltip-delay-hide or 0ms if no input */
|
|
268
|
+
hide(delay = this.hideDelay) {
|
|
269
|
+
if (this._tooltipInstance) {
|
|
270
|
+
this._tooltipInstance.hide(delay);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** Shows/hides the tooltip */
|
|
274
|
+
toggle() {
|
|
275
|
+
this._isTooltipVisible() ? this.hide() : this.show();
|
|
276
|
+
}
|
|
277
|
+
/** Returns true if the tooltip is currently visible to the user */
|
|
278
|
+
_isTooltipVisible() {
|
|
279
|
+
return !!this._tooltipInstance && this._tooltipInstance.isVisible();
|
|
280
|
+
}
|
|
281
|
+
/** Create the overlay config and position strategy */
|
|
282
|
+
_createOverlay() {
|
|
283
|
+
if (this._overlayRef) {
|
|
284
|
+
return this._overlayRef;
|
|
285
|
+
}
|
|
286
|
+
const scrollableAncestors = this._scrollDispatcher.getAncestorScrollContainers(this._elementRef);
|
|
287
|
+
// Create connected position strategy that listens for scroll events to reposition.
|
|
288
|
+
const strategy = this._overlay.position()
|
|
289
|
+
.flexibleConnectedTo(this._elementRef)
|
|
290
|
+
.withTransformOriginOn('.mat-tooltip')
|
|
291
|
+
.withFlexibleDimensions(false)
|
|
292
|
+
.withViewportMargin(8)
|
|
293
|
+
.withScrollableContainers(scrollableAncestors);
|
|
294
|
+
strategy.positionChanges.pipe(takeUntil(this._destroyed)).subscribe(change => {
|
|
262
295
|
if (this._tooltipInstance) {
|
|
263
|
-
this._tooltipInstance.
|
|
296
|
+
if (change.scrollableViewProperties.isOverlayClipped && this._tooltipInstance.isVisible()) {
|
|
297
|
+
// After position changes occur and the overlay is clipped by
|
|
298
|
+
// a parent scrollable then close the tooltip.
|
|
299
|
+
this._ngZone.run(() => this.hide(0));
|
|
300
|
+
}
|
|
264
301
|
}
|
|
302
|
+
});
|
|
303
|
+
this._overlayRef = this._overlay.create({
|
|
304
|
+
direction: this._dir,
|
|
305
|
+
positionStrategy: strategy,
|
|
306
|
+
panelClass: TOOLTIP_PANEL_CLASS,
|
|
307
|
+
scrollStrategy: this._scrollStrategy()
|
|
308
|
+
});
|
|
309
|
+
this._updatePosition();
|
|
310
|
+
this._overlayRef.detachments()
|
|
311
|
+
.pipe(takeUntil(this._destroyed))
|
|
312
|
+
.subscribe(() => this._detach());
|
|
313
|
+
return this._overlayRef;
|
|
314
|
+
}
|
|
315
|
+
/** Detaches the currently-attached tooltip. */
|
|
316
|
+
_detach() {
|
|
317
|
+
if (this._overlayRef && this._overlayRef.hasAttached()) {
|
|
318
|
+
this._overlayRef.detach();
|
|
265
319
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
320
|
+
this._tooltipInstance = null;
|
|
321
|
+
}
|
|
322
|
+
/** Updates the position of the current tooltip. */
|
|
323
|
+
_updatePosition() {
|
|
324
|
+
const position = this._overlayRef.getConfig().positionStrategy;
|
|
325
|
+
const origin = this._getOrigin();
|
|
326
|
+
const overlay = this._getOverlayPosition();
|
|
327
|
+
position.withPositions([
|
|
328
|
+
Object.assign(Object.assign({}, origin.main), overlay.main),
|
|
329
|
+
Object.assign(Object.assign({}, origin.fallback), overlay.fallback)
|
|
330
|
+
]);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Returns the origin position and a fallback position based on the user's position preference.
|
|
334
|
+
* The fallback position is the inverse of the origin (e.g. `'below' -> 'above'`).
|
|
335
|
+
*/
|
|
336
|
+
_getOrigin() {
|
|
337
|
+
const isLtr = !this._dir || this._dir.value == 'ltr';
|
|
338
|
+
const position = this.position;
|
|
339
|
+
let originPosition;
|
|
340
|
+
if (position == 'above' || position == 'below') {
|
|
341
|
+
originPosition = { originX: 'center', originY: position == 'above' ? 'top' : 'bottom' };
|
|
269
342
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
343
|
+
else if (position == 'before' ||
|
|
344
|
+
(position == 'left' && isLtr) ||
|
|
345
|
+
(position == 'right' && !isLtr)) {
|
|
346
|
+
originPosition = { originX: 'start', originY: 'center' };
|
|
273
347
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
348
|
+
else if (position == 'after' ||
|
|
349
|
+
(position == 'right' && isLtr) ||
|
|
350
|
+
(position == 'left' && !isLtr)) {
|
|
351
|
+
originPosition = { originX: 'end', originY: 'center' };
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
throw getMatTooltipInvalidPositionError(position);
|
|
355
|
+
}
|
|
356
|
+
const { x, y } = this._invertPosition(originPosition.originX, originPosition.originY);
|
|
357
|
+
return {
|
|
358
|
+
main: originPosition,
|
|
359
|
+
fallback: { originX: x, originY: y }
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
/** Returns the overlay position and a fallback position based on the user's preference */
|
|
363
|
+
_getOverlayPosition() {
|
|
364
|
+
const isLtr = !this._dir || this._dir.value == 'ltr';
|
|
365
|
+
const position = this.position;
|
|
366
|
+
let overlayPosition;
|
|
367
|
+
if (position == 'above') {
|
|
368
|
+
overlayPosition = { overlayX: 'center', overlayY: 'bottom' };
|
|
369
|
+
}
|
|
370
|
+
else if (position == 'below') {
|
|
371
|
+
overlayPosition = { overlayX: 'center', overlayY: 'top' };
|
|
372
|
+
}
|
|
373
|
+
else if (position == 'before' ||
|
|
374
|
+
(position == 'left' && isLtr) ||
|
|
375
|
+
(position == 'right' && !isLtr)) {
|
|
376
|
+
overlayPosition = { overlayX: 'end', overlayY: 'center' };
|
|
377
|
+
}
|
|
378
|
+
else if (position == 'after' ||
|
|
379
|
+
(position == 'right' && isLtr) ||
|
|
380
|
+
(position == 'left' && !isLtr)) {
|
|
381
|
+
overlayPosition = { overlayX: 'start', overlayY: 'center' };
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
throw getMatTooltipInvalidPositionError(position);
|
|
385
|
+
}
|
|
386
|
+
const { x, y } = this._invertPosition(overlayPosition.overlayX, overlayPosition.overlayY);
|
|
387
|
+
return {
|
|
388
|
+
main: overlayPosition,
|
|
389
|
+
fallback: { overlayX: x, overlayY: y }
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** Updates the tooltip message and repositions the overlay according to the new message length */
|
|
393
|
+
_updateTooltipMessage() {
|
|
394
|
+
// Must wait for the message to be painted to the tooltip so that the overlay can properly
|
|
395
|
+
// calculate the correct positioning based on the size of the text.
|
|
396
|
+
if (this._tooltipInstance) {
|
|
397
|
+
this._tooltipInstance.message = this.message;
|
|
398
|
+
this._tooltipInstance._markForCheck();
|
|
399
|
+
this._ngZone.onMicrotaskEmpty.asObservable().pipe(take(1), takeUntil(this._destroyed)).subscribe(() => {
|
|
288
400
|
if (this._tooltipInstance) {
|
|
289
|
-
|
|
290
|
-
// After position changes occur and the overlay is clipped by
|
|
291
|
-
// a parent scrollable then close the tooltip.
|
|
292
|
-
this._ngZone.run(() => this.hide(0));
|
|
293
|
-
}
|
|
401
|
+
this._overlayRef.updatePosition();
|
|
294
402
|
}
|
|
295
403
|
});
|
|
296
|
-
this._overlayRef = this._overlay.create({
|
|
297
|
-
direction: this._dir,
|
|
298
|
-
positionStrategy: strategy,
|
|
299
|
-
panelClass: TOOLTIP_PANEL_CLASS,
|
|
300
|
-
scrollStrategy: this._scrollStrategy()
|
|
301
|
-
});
|
|
302
|
-
this._updatePosition();
|
|
303
|
-
this._overlayRef.detachments()
|
|
304
|
-
.pipe(takeUntil(this._destroyed))
|
|
305
|
-
.subscribe(() => this._detach());
|
|
306
|
-
return this._overlayRef;
|
|
307
404
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
this._tooltipInstance
|
|
314
|
-
}
|
|
315
|
-
/** Updates the position of the current tooltip. */
|
|
316
|
-
_updatePosition() {
|
|
317
|
-
const position = this._overlayRef.getConfig().positionStrategy;
|
|
318
|
-
const origin = this._getOrigin();
|
|
319
|
-
const overlay = this._getOverlayPosition();
|
|
320
|
-
position.withPositions([
|
|
321
|
-
Object.assign(Object.assign({}, origin.main), overlay.main),
|
|
322
|
-
Object.assign(Object.assign({}, origin.fallback), overlay.fallback)
|
|
323
|
-
]);
|
|
405
|
+
}
|
|
406
|
+
/** Updates the tooltip class */
|
|
407
|
+
_setTooltipClass(tooltipClass) {
|
|
408
|
+
if (this._tooltipInstance) {
|
|
409
|
+
this._tooltipInstance.tooltipClass = tooltipClass;
|
|
410
|
+
this._tooltipInstance._markForCheck();
|
|
324
411
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const position = this.position;
|
|
332
|
-
let originPosition;
|
|
333
|
-
if (position == 'above' || position == 'below') {
|
|
334
|
-
originPosition = { originX: 'center', originY: position == 'above' ? 'top' : 'bottom' };
|
|
335
|
-
}
|
|
336
|
-
else if (position == 'before' ||
|
|
337
|
-
(position == 'left' && isLtr) ||
|
|
338
|
-
(position == 'right' && !isLtr)) {
|
|
339
|
-
originPosition = { originX: 'start', originY: 'center' };
|
|
340
|
-
}
|
|
341
|
-
else if (position == 'after' ||
|
|
342
|
-
(position == 'right' && isLtr) ||
|
|
343
|
-
(position == 'left' && !isLtr)) {
|
|
344
|
-
originPosition = { originX: 'end', originY: 'center' };
|
|
412
|
+
}
|
|
413
|
+
/** Inverts an overlay position. */
|
|
414
|
+
_invertPosition(x, y) {
|
|
415
|
+
if (this.position === 'above' || this.position === 'below') {
|
|
416
|
+
if (y === 'top') {
|
|
417
|
+
y = 'bottom';
|
|
345
418
|
}
|
|
346
|
-
else {
|
|
347
|
-
|
|
419
|
+
else if (y === 'bottom') {
|
|
420
|
+
y = 'top';
|
|
348
421
|
}
|
|
349
|
-
const { x, y } = this._invertPosition(originPosition.originX, originPosition.originY);
|
|
350
|
-
return {
|
|
351
|
-
main: originPosition,
|
|
352
|
-
fallback: { originX: x, originY: y }
|
|
353
|
-
};
|
|
354
422
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const position = this.position;
|
|
359
|
-
let overlayPosition;
|
|
360
|
-
if (position == 'above') {
|
|
361
|
-
overlayPosition = { overlayX: 'center', overlayY: 'bottom' };
|
|
423
|
+
else {
|
|
424
|
+
if (x === 'end') {
|
|
425
|
+
x = 'start';
|
|
362
426
|
}
|
|
363
|
-
else if (
|
|
364
|
-
|
|
427
|
+
else if (x === 'start') {
|
|
428
|
+
x = 'end';
|
|
365
429
|
}
|
|
366
|
-
else if (position == 'before' ||
|
|
367
|
-
(position == 'left' && isLtr) ||
|
|
368
|
-
(position == 'right' && !isLtr)) {
|
|
369
|
-
overlayPosition = { overlayX: 'end', overlayY: 'center' };
|
|
370
|
-
}
|
|
371
|
-
else if (position == 'after' ||
|
|
372
|
-
(position == 'right' && isLtr) ||
|
|
373
|
-
(position == 'left' && !isLtr)) {
|
|
374
|
-
overlayPosition = { overlayX: 'start', overlayY: 'center' };
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
throw getMatTooltipInvalidPositionError(position);
|
|
378
|
-
}
|
|
379
|
-
const { x, y } = this._invertPosition(overlayPosition.overlayX, overlayPosition.overlayY);
|
|
380
|
-
return {
|
|
381
|
-
main: overlayPosition,
|
|
382
|
-
fallback: { overlayX: x, overlayY: y }
|
|
383
|
-
};
|
|
384
430
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (this._tooltipInstance) {
|
|
394
|
-
this._overlayRef.updatePosition();
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
}
|
|
431
|
+
return { x, y };
|
|
432
|
+
}
|
|
433
|
+
/** Binds the pointer events to the tooltip trigger. */
|
|
434
|
+
_setupPointerEvents() {
|
|
435
|
+
// Optimization: Defer hooking up events if there's no message or the tooltip is disabled.
|
|
436
|
+
if (this._disabled || !this.message || !this._viewInitialized ||
|
|
437
|
+
this._passiveListeners.size) {
|
|
438
|
+
return;
|
|
398
439
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
this.
|
|
404
|
-
|
|
440
|
+
// The mouse events shouldn't be bound on mobile devices, because they can prevent the
|
|
441
|
+
// first tap from firing its click event or can cause the tooltip to open for clicks.
|
|
442
|
+
if (!this._platform.IOS && !this._platform.ANDROID) {
|
|
443
|
+
this._passiveListeners
|
|
444
|
+
.set('mouseenter', () => this.show())
|
|
445
|
+
.set('mouseleave', () => this.hide());
|
|
405
446
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
else if (x === 'start') {
|
|
421
|
-
x = 'end';
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
return { x, y };
|
|
425
|
-
}
|
|
426
|
-
/** Binds the pointer events to the tooltip trigger. */
|
|
427
|
-
_setupPointerEvents() {
|
|
428
|
-
// The mouse events shouldn't be bound on mobile devices, because they can prevent the
|
|
429
|
-
// first tap from firing its click event or can cause the tooltip to open for clicks.
|
|
430
|
-
if (!this._platform.IOS && !this._platform.ANDROID) {
|
|
431
|
-
this._passiveListeners
|
|
432
|
-
.set('mouseenter', () => this.show())
|
|
433
|
-
.set('mouseleave', () => this.hide());
|
|
434
|
-
}
|
|
435
|
-
else if (this.touchGestures !== 'off') {
|
|
436
|
-
this._disableNativeGesturesIfNecessary();
|
|
437
|
-
const touchendListener = () => {
|
|
438
|
-
clearTimeout(this._touchstartTimeout);
|
|
439
|
-
this.hide(this._defaultOptions.touchendHideDelay);
|
|
440
|
-
};
|
|
441
|
-
this._passiveListeners
|
|
442
|
-
.set('touchend', touchendListener)
|
|
443
|
-
.set('touchcancel', touchendListener)
|
|
444
|
-
.set('touchstart', () => {
|
|
445
|
-
// Note that it's important that we don't `preventDefault` here,
|
|
446
|
-
// because it can prevent click events from firing on the element.
|
|
447
|
-
clearTimeout(this._touchstartTimeout);
|
|
448
|
-
this._touchstartTimeout = setTimeout(() => this.show(), LONGPRESS_DELAY);
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
this._passiveListeners.forEach((listener, event) => {
|
|
452
|
-
this._elementRef.nativeElement.addEventListener(event, listener, passiveListenerOptions);
|
|
447
|
+
else if (this.touchGestures !== 'off') {
|
|
448
|
+
this._disableNativeGesturesIfNecessary();
|
|
449
|
+
const touchendListener = () => {
|
|
450
|
+
clearTimeout(this._touchstartTimeout);
|
|
451
|
+
this.hide(this._defaultOptions.touchendHideDelay);
|
|
452
|
+
};
|
|
453
|
+
this._passiveListeners
|
|
454
|
+
.set('touchend', touchendListener)
|
|
455
|
+
.set('touchcancel', touchendListener)
|
|
456
|
+
.set('touchstart', () => {
|
|
457
|
+
// Note that it's important that we don't `preventDefault` here,
|
|
458
|
+
// because it can prevent click events from firing on the element.
|
|
459
|
+
clearTimeout(this._touchstartTimeout);
|
|
460
|
+
this._touchstartTimeout = setTimeout(() => this.show(), LONGPRESS_DELAY);
|
|
453
461
|
});
|
|
454
462
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
463
|
+
this._passiveListeners.forEach((listener, event) => {
|
|
464
|
+
this._elementRef.nativeElement.addEventListener(event, listener, passiveListenerOptions);
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
/** Disables the native browser gestures, based on how the tooltip has been configured. */
|
|
468
|
+
_disableNativeGesturesIfNecessary() {
|
|
469
|
+
const element = this._elementRef.nativeElement;
|
|
470
|
+
const style = element.style;
|
|
471
|
+
const gestures = this.touchGestures;
|
|
472
|
+
if (gestures !== 'off') {
|
|
473
|
+
// If gestures are set to `auto`, we don't disable text selection on inputs and
|
|
474
|
+
// textareas, because it prevents the user from typing into them on iOS Safari.
|
|
475
|
+
if (gestures === 'on' || (element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA')) {
|
|
476
|
+
style.userSelect = style.msUserSelect = style.webkitUserSelect =
|
|
477
|
+
style.MozUserSelect = 'none';
|
|
478
|
+
}
|
|
479
|
+
// If we have `auto` gestures and the element uses native HTML dragging,
|
|
480
|
+
// we don't set `-webkit-user-drag` because it prevents the native behavior.
|
|
481
|
+
if (gestures === 'on' || !element.draggable) {
|
|
482
|
+
style.webkitUserDrag = 'none';
|
|
483
|
+
}
|
|
484
|
+
style.touchAction = 'none';
|
|
485
|
+
style.webkitTapHighlightColor = 'transparent';
|
|
475
486
|
}
|
|
476
487
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
]
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
})();
|
|
488
|
+
}
|
|
489
|
+
MatTooltip.decorators = [
|
|
490
|
+
{ type: Directive, args: [{
|
|
491
|
+
selector: '[matTooltip]',
|
|
492
|
+
exportAs: 'matTooltip',
|
|
493
|
+
host: {
|
|
494
|
+
'class': 'mat-tooltip-trigger'
|
|
495
|
+
}
|
|
496
|
+
},] }
|
|
497
|
+
];
|
|
498
|
+
MatTooltip.ctorParameters = () => [
|
|
499
|
+
{ type: Overlay },
|
|
500
|
+
{ type: ElementRef },
|
|
501
|
+
{ type: ScrollDispatcher },
|
|
502
|
+
{ type: ViewContainerRef },
|
|
503
|
+
{ type: NgZone },
|
|
504
|
+
{ type: Platform },
|
|
505
|
+
{ type: AriaDescriber },
|
|
506
|
+
{ type: FocusMonitor },
|
|
507
|
+
{ type: undefined, decorators: [{ type: Inject, args: [MAT_TOOLTIP_SCROLL_STRATEGY,] }] },
|
|
508
|
+
{ type: Directionality, decorators: [{ type: Optional }] },
|
|
509
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_TOOLTIP_DEFAULT_OPTIONS,] }] }
|
|
510
|
+
];
|
|
511
|
+
MatTooltip.propDecorators = {
|
|
512
|
+
position: [{ type: Input, args: ['matTooltipPosition',] }],
|
|
513
|
+
disabled: [{ type: Input, args: ['matTooltipDisabled',] }],
|
|
514
|
+
showDelay: [{ type: Input, args: ['matTooltipShowDelay',] }],
|
|
515
|
+
hideDelay: [{ type: Input, args: ['matTooltipHideDelay',] }],
|
|
516
|
+
touchGestures: [{ type: Input, args: ['matTooltipTouchGestures',] }],
|
|
517
|
+
message: [{ type: Input, args: ['matTooltip',] }],
|
|
518
|
+
tooltipClass: [{ type: Input, args: ['matTooltipClass',] }]
|
|
519
|
+
};
|
|
510
520
|
/**
|
|
511
521
|
* Internal component that wraps the tooltip's content.
|
|
512
522
|
* @docs-private
|
|
513
523
|
*/
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
class TooltipComponent {
|
|
525
|
+
constructor(_changeDetectorRef, _breakpointObserver) {
|
|
526
|
+
this._changeDetectorRef = _changeDetectorRef;
|
|
527
|
+
this._breakpointObserver = _breakpointObserver;
|
|
528
|
+
/** Property watched by the animation framework to show or hide the tooltip */
|
|
529
|
+
this._visibility = 'initial';
|
|
530
|
+
/** Whether interactions on the page should close the tooltip */
|
|
531
|
+
this._closeOnInteraction = false;
|
|
532
|
+
/** Subject for notifying that the tooltip has been hidden from the view */
|
|
533
|
+
this._onHide = new Subject();
|
|
534
|
+
/** Stream that emits whether the user has a handset-sized display. */
|
|
535
|
+
this._isHandset = this._breakpointObserver.observe(Breakpoints.Handset);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Shows the tooltip with an animation originating from the provided origin
|
|
539
|
+
* @param delay Amount of milliseconds to the delay showing the tooltip.
|
|
540
|
+
*/
|
|
541
|
+
show(delay) {
|
|
542
|
+
// Cancel the delayed hide if it is scheduled
|
|
543
|
+
if (this._hideTimeoutId) {
|
|
544
|
+
clearTimeout(this._hideTimeoutId);
|
|
545
|
+
this._hideTimeoutId = null;
|
|
527
546
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
//
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
+
// Body interactions should cancel the tooltip if there is a delay in showing.
|
|
548
|
+
this._closeOnInteraction = true;
|
|
549
|
+
this._showTimeoutId = setTimeout(() => {
|
|
550
|
+
this._visibility = 'visible';
|
|
551
|
+
this._showTimeoutId = null;
|
|
552
|
+
// Mark for check so if any parent component has set the
|
|
553
|
+
// ChangeDetectionStrategy to OnPush it will be checked anyways
|
|
554
|
+
this._markForCheck();
|
|
555
|
+
}, delay);
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Begins the animation to hide the tooltip after the provided delay in ms.
|
|
559
|
+
* @param delay Amount of milliseconds to delay showing the tooltip.
|
|
560
|
+
*/
|
|
561
|
+
hide(delay) {
|
|
562
|
+
// Cancel the delayed show if it is scheduled
|
|
563
|
+
if (this._showTimeoutId) {
|
|
564
|
+
clearTimeout(this._showTimeoutId);
|
|
565
|
+
this._showTimeoutId = null;
|
|
547
566
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
ngOnDestroy() {
|
|
575
|
-
this._onHide.complete();
|
|
576
|
-
}
|
|
577
|
-
_animationStart() {
|
|
578
|
-
this._closeOnInteraction = false;
|
|
579
|
-
}
|
|
580
|
-
_animationDone(event) {
|
|
581
|
-
const toState = event.toState;
|
|
582
|
-
if (toState === 'hidden' && !this.isVisible()) {
|
|
583
|
-
this._onHide.next();
|
|
584
|
-
}
|
|
585
|
-
if (toState === 'visible' || toState === 'hidden') {
|
|
586
|
-
this._closeOnInteraction = true;
|
|
587
|
-
}
|
|
567
|
+
this._hideTimeoutId = setTimeout(() => {
|
|
568
|
+
this._visibility = 'hidden';
|
|
569
|
+
this._hideTimeoutId = null;
|
|
570
|
+
// Mark for check so if any parent component has set the
|
|
571
|
+
// ChangeDetectionStrategy to OnPush it will be checked anyways
|
|
572
|
+
this._markForCheck();
|
|
573
|
+
}, delay);
|
|
574
|
+
}
|
|
575
|
+
/** Returns an observable that notifies when the tooltip has been hidden from view. */
|
|
576
|
+
afterHidden() {
|
|
577
|
+
return this._onHide.asObservable();
|
|
578
|
+
}
|
|
579
|
+
/** Whether the tooltip is being displayed. */
|
|
580
|
+
isVisible() {
|
|
581
|
+
return this._visibility === 'visible';
|
|
582
|
+
}
|
|
583
|
+
ngOnDestroy() {
|
|
584
|
+
this._onHide.complete();
|
|
585
|
+
}
|
|
586
|
+
_animationStart() {
|
|
587
|
+
this._closeOnInteraction = false;
|
|
588
|
+
}
|
|
589
|
+
_animationDone(event) {
|
|
590
|
+
const toState = event.toState;
|
|
591
|
+
if (toState === 'hidden' && !this.isVisible()) {
|
|
592
|
+
this._onHide.next();
|
|
588
593
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
* material design spec.
|
|
592
|
-
* https://material.io/design/components/tooltips.html#behavior
|
|
593
|
-
*/
|
|
594
|
-
_handleBodyInteraction() {
|
|
595
|
-
if (this._closeOnInteraction) {
|
|
596
|
-
this.hide(0);
|
|
597
|
-
}
|
|
594
|
+
if (toState === 'visible' || toState === 'hidden') {
|
|
595
|
+
this._closeOnInteraction = true;
|
|
598
596
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Interactions on the HTML body should close the tooltip immediately as defined in the
|
|
600
|
+
* material design spec.
|
|
601
|
+
* https://material.io/design/components/tooltips.html#behavior
|
|
602
|
+
*/
|
|
603
|
+
_handleBodyInteraction() {
|
|
604
|
+
if (this._closeOnInteraction) {
|
|
605
|
+
this.hide(0);
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
608
|
+
/**
|
|
609
|
+
* Marks that the tooltip needs to be checked in the next change detection run.
|
|
610
|
+
* Mainly used for rendering the initial text before positioning a tooltip, which
|
|
611
|
+
* can be problematic in components with OnPush change detection.
|
|
612
|
+
*/
|
|
613
|
+
_markForCheck() {
|
|
614
|
+
this._changeDetectorRef.markForCheck();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
TooltipComponent.decorators = [
|
|
618
|
+
{ type: Component, args: [{
|
|
619
|
+
selector: 'mat-tooltip-component',
|
|
620
|
+
template: "<div class=\"mat-tooltip\"\n [ngClass]=\"tooltipClass\"\n [class.mat-tooltip-handset]=\"(_isHandset | async)?.matches\"\n [@state]=\"_visibility\"\n (@state.start)=\"_animationStart()\"\n (@state.done)=\"_animationDone($event)\">{{message}}</div>\n",
|
|
621
|
+
encapsulation: ViewEncapsulation.None,
|
|
622
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
623
|
+
animations: [matTooltipAnimations.tooltipState],
|
|
624
|
+
host: {
|
|
625
|
+
// Forces the element to have a layout in IE and Edge. This fixes issues where the element
|
|
626
|
+
// won't be rendered if the animations are disabled or there is no web animations polyfill.
|
|
627
|
+
'[style.zoom]': '_visibility === "visible" ? 1 : null',
|
|
628
|
+
'(body:click)': 'this._handleBodyInteraction()',
|
|
629
|
+
'aria-hidden': 'true',
|
|
630
|
+
},
|
|
631
|
+
styles: [".mat-tooltip-panel{pointer-events:none !important}.mat-tooltip{color:#fff;border-radius:4px;margin:14px;max-width:250px;padding-left:8px;padding-right:8px;overflow:hidden;text-overflow:ellipsis}.cdk-high-contrast-active .mat-tooltip{outline:solid 1px}.mat-tooltip-handset{margin:24px;padding-left:16px;padding-right:16px}\n"]
|
|
632
|
+
},] }
|
|
633
|
+
];
|
|
634
|
+
TooltipComponent.ctorParameters = () => [
|
|
635
|
+
{ type: ChangeDetectorRef },
|
|
636
|
+
{ type: BreakpointObserver }
|
|
637
|
+
];
|
|
631
638
|
|
|
632
639
|
/**
|
|
633
640
|
* @license
|
|
@@ -636,25 +643,22 @@ let TooltipComponent = /** @class */ (() => {
|
|
|
636
643
|
* Use of this source code is governed by an MIT-style license that can be
|
|
637
644
|
* found in the LICENSE file at https://angular.io/license
|
|
638
645
|
*/
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
];
|
|
656
|
-
return MatTooltipModule;
|
|
657
|
-
})();
|
|
646
|
+
class MatTooltipModule {
|
|
647
|
+
}
|
|
648
|
+
MatTooltipModule.decorators = [
|
|
649
|
+
{ type: NgModule, args: [{
|
|
650
|
+
imports: [
|
|
651
|
+
A11yModule,
|
|
652
|
+
CommonModule,
|
|
653
|
+
OverlayModule,
|
|
654
|
+
MatCommonModule,
|
|
655
|
+
],
|
|
656
|
+
exports: [MatTooltip, TooltipComponent, MatCommonModule, CdkScrollableModule],
|
|
657
|
+
declarations: [MatTooltip, TooltipComponent],
|
|
658
|
+
entryComponents: [TooltipComponent],
|
|
659
|
+
providers: [MAT_TOOLTIP_SCROLL_STRATEGY_FACTORY_PROVIDER]
|
|
660
|
+
},] }
|
|
661
|
+
];
|
|
658
662
|
|
|
659
663
|
/**
|
|
660
664
|
* @license
|