@ifsworld/granite-components 4.4.0 → 5.0.1
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/README.md +117 -4
- package/esm2020/ifsworld-granite-components.mjs +5 -0
- package/esm2020/index.mjs +48 -0
- package/esm2020/lib/arrange-grid/arrange-grid-item.component.mjs +44 -0
- package/esm2020/lib/arrange-grid/arrange-grid.component.mjs +125 -0
- package/esm2020/lib/arrange-grid/arrange-grid.module.mjs +19 -0
- package/esm2020/lib/badge/badge.component.mjs +39 -0
- package/esm2020/lib/badge/badge.module.mjs +18 -0
- package/esm2020/lib/badge/testing/badge.harness.mjs +25 -0
- package/esm2020/lib/button/button.component.mjs +89 -0
- package/esm2020/lib/button/button.module.mjs +16 -0
- package/esm2020/lib/checkbox/checkbox-group.component.mjs +17 -0
- package/esm2020/lib/checkbox/checkbox.component.mjs +96 -0
- package/esm2020/lib/checkbox/checkbox.module.mjs +17 -0
- package/esm2020/lib/core/animation.mjs +34 -0
- package/esm2020/lib/core/client-environment.mjs +20 -0
- package/esm2020/lib/core/common-behaviors/disabled.mjs +27 -0
- package/esm2020/lib/core/core.module.mjs +36 -0
- package/esm2020/lib/core/devices/client-input-desktop.directive.mjs +29 -0
- package/esm2020/lib/core/devices/client-input-touch.directive.mjs +29 -0
- package/esm2020/lib/core/devices/client-output-desktop.directive.mjs +29 -0
- package/esm2020/lib/core/devices/client-output-touch.directive.mjs +29 -0
- package/esm2020/lib/core/pipes/pure-pipes.module.mjs +16 -0
- package/esm2020/lib/core/pipes/title.pipe.mjs +21 -0
- package/esm2020/lib/core/radio-checkbox-base.mjs +19 -0
- package/esm2020/lib/core/theme.library.mjs +59 -0
- package/esm2020/lib/core/types.mjs +2 -0
- package/esm2020/lib/grid/grid.component.mjs +128 -0
- package/esm2020/lib/grid/grid.module.mjs +18 -0
- package/esm2020/lib/icon/icon.component.mjs +43 -0
- package/esm2020/lib/icon/icon.module.mjs +16 -0
- package/esm2020/lib/input-field/input-field.component.mjs +160 -0
- package/esm2020/lib/input-field/input-field.module.mjs +20 -0
- package/esm2020/lib/menu/divider.directive.mjs +23 -0
- package/esm2020/lib/menu/menu-base.mjs +347 -0
- package/esm2020/lib/menu/menu-desktop-animations.mjs +23 -0
- package/esm2020/lib/menu/menu-errors.mjs +37 -0
- package/esm2020/lib/menu/menu-item.component.mjs +91 -0
- package/esm2020/lib/menu/menu-panel.mjs +7 -0
- package/esm2020/lib/menu/menu-positions.mjs +9 -0
- package/esm2020/lib/menu/menu-touch-animations.mjs +137 -0
- package/esm2020/lib/menu/menu-touch-close.component.mjs +13 -0
- package/esm2020/lib/menu/menu-touch-title.component.mjs +59 -0
- package/esm2020/lib/menu/menu-trigger-for.directive.mjs +702 -0
- package/esm2020/lib/menu/menu.component.mjs +30 -0
- package/esm2020/lib/menu/menu.module.mjs +55 -0
- package/esm2020/lib/menu/testing/menu.harness.mjs +109 -0
- package/esm2020/lib/menu/title.directive.mjs +17 -0
- package/esm2020/lib/radio-button/radio-button.component.mjs +118 -0
- package/esm2020/lib/radio-button/radio-button.module.mjs +17 -0
- package/esm2020/lib/radio-button/radio-group.component.mjs +17 -0
- package/esm2020/lib/table/cell/cell.mjs +15 -0
- package/esm2020/lib/table/cell/table-data-cell.component.mjs +26 -0
- package/esm2020/lib/table/cell/table-header-cell.component.mjs +12 -0
- package/esm2020/lib/table/column/table-column.directive.mjs +23 -0
- package/esm2020/lib/table/table-constants.library.mjs +4 -0
- package/esm2020/lib/table/table.component.mjs +36 -0
- package/esm2020/lib/table/table.module.mjs +32 -0
- package/esm2020/lib/toggle-switch/toggle-switch.component.mjs +96 -0
- package/esm2020/lib/toggle-switch/toggle-switch.module.mjs +16 -0
- package/fesm2015/ifsworld-granite-components.mjs +3145 -0
- package/fesm2015/ifsworld-granite-components.mjs.map +1 -0
- package/fesm2020/ifsworld-granite-components.mjs +3103 -0
- package/fesm2020/ifsworld-granite-components.mjs.map +1 -0
- package/ifsworld-granite-components.d.ts +1 -8
- package/lib/arrange-grid/arrange-grid-item.component.d.ts +3 -0
- package/lib/arrange-grid/arrange-grid.component.d.ts +3 -0
- package/lib/arrange-grid/arrange-grid.module.d.ts +7 -0
- package/lib/badge/badge.component.d.ts +3 -0
- package/lib/badge/badge.module.d.ts +6 -0
- package/lib/button/button.component.d.ts +5 -0
- package/lib/button/button.module.d.ts +5 -0
- package/lib/checkbox/checkbox-group.component.d.ts +3 -0
- package/lib/checkbox/checkbox.component.d.ts +3 -0
- package/lib/checkbox/checkbox.module.d.ts +6 -0
- package/lib/core/core.module.d.ts +8 -0
- package/lib/core/devices/client-input-desktop.directive.d.ts +3 -0
- package/lib/core/devices/client-input-touch.directive.d.ts +3 -0
- package/lib/core/devices/client-output-desktop.directive.d.ts +3 -0
- package/lib/core/devices/client-output-touch.directive.d.ts +3 -0
- package/lib/core/pipes/pure-pipes.module.d.ts +5 -0
- package/lib/core/pipes/title.pipe.d.ts +3 -0
- package/lib/core/radio-checkbox-base.d.ts +3 -0
- package/lib/grid/grid.component.d.ts +5 -0
- package/lib/grid/grid.module.d.ts +6 -0
- package/lib/icon/icon.component.d.ts +3 -0
- package/lib/icon/icon.module.d.ts +5 -0
- package/lib/input-field/input-field.component.d.ts +3 -0
- package/lib/input-field/input-field.module.d.ts +8 -0
- package/lib/menu/divider.directive.d.ts +3 -0
- package/lib/menu/menu-base.d.ts +190 -0
- package/lib/menu/menu-item.component.d.ts +3 -0
- package/lib/menu/menu-touch-close.component.d.ts +3 -0
- package/lib/menu/menu-touch-title.component.d.ts +4 -1
- package/lib/menu/menu-trigger-for.directive.d.ts +4 -1
- package/lib/menu/menu.component.d.ts +4 -187
- package/lib/menu/menu.module.d.ts +15 -0
- package/lib/menu/title.directive.d.ts +3 -0
- package/lib/radio-button/radio-button.component.d.ts +4 -1
- package/lib/radio-button/radio-button.module.d.ts +6 -0
- package/lib/radio-button/radio-group.component.d.ts +3 -0
- package/lib/table/cell/cell.d.ts +3 -0
- package/lib/table/cell/table-data-cell.component.d.ts +3 -0
- package/lib/table/cell/table-header-cell.component.d.ts +3 -0
- package/lib/table/column/table-column.directive.d.ts +3 -0
- package/lib/table/table.component.d.ts +3 -0
- package/lib/table/table.module.d.ts +12 -0
- package/lib/toggle-switch/toggle-switch.component.d.ts +3 -0
- package/lib/toggle-switch/toggle-switch.module.d.ts +5 -0
- package/package.json +26 -13
- package/bundles/ifsworld-granite-components.umd.js +0 -3649
- package/bundles/ifsworld-granite-components.umd.js.map +0 -1
- package/bundles/ifsworld-granite-components.umd.min.js +0 -10
- package/bundles/ifsworld-granite-components.umd.min.js.map +0 -1
- package/esm2015/ifsworld-granite-components.js +0 -13
- package/esm2015/ifsworld-granite-components.js.map +0 -1
- package/esm2015/ifsworld-granite-components.metadata.json +0 -1
- package/esm2015/index.js +0 -48
- package/esm2015/index.js.map +0 -1
- package/esm2015/index.metadata.json +0 -1
- package/esm2015/lib/arrange-grid/arrange-grid-item.component.js +0 -48
- package/esm2015/lib/arrange-grid/arrange-grid-item.component.js.map +0 -1
- package/esm2015/lib/arrange-grid/arrange-grid-item.component.metadata.json +0 -1
- package/esm2015/lib/arrange-grid/arrange-grid.component.js +0 -123
- package/esm2015/lib/arrange-grid/arrange-grid.component.js.map +0 -1
- package/esm2015/lib/arrange-grid/arrange-grid.component.metadata.json +0 -1
- package/esm2015/lib/arrange-grid/arrange-grid.module.js +0 -14
- package/esm2015/lib/arrange-grid/arrange-grid.module.js.map +0 -1
- package/esm2015/lib/arrange-grid/arrange-grid.module.metadata.json +0 -1
- package/esm2015/lib/badge/badge.component.js +0 -44
- package/esm2015/lib/badge/badge.component.js.map +0 -1
- package/esm2015/lib/badge/badge.component.metadata.json +0 -1
- package/esm2015/lib/badge/badge.module.js +0 -13
- package/esm2015/lib/badge/badge.module.js.map +0 -1
- package/esm2015/lib/badge/badge.module.metadata.json +0 -1
- package/esm2015/lib/badge/testing/badge.harness.js +0 -30
- package/esm2015/lib/badge/testing/badge.harness.js.map +0 -1
- package/esm2015/lib/badge/testing/badge.harness.metadata.json +0 -1
- package/esm2015/lib/button/button.component.js +0 -108
- package/esm2015/lib/button/button.component.js.map +0 -1
- package/esm2015/lib/button/button.component.metadata.json +0 -1
- package/esm2015/lib/button/button.module.js +0 -11
- package/esm2015/lib/button/button.module.js.map +0 -1
- package/esm2015/lib/button/button.module.metadata.json +0 -1
- package/esm2015/lib/checkbox/checkbox-group.component.js +0 -19
- package/esm2015/lib/checkbox/checkbox-group.component.js.map +0 -1
- package/esm2015/lib/checkbox/checkbox-group.component.metadata.json +0 -1
- package/esm2015/lib/checkbox/checkbox.component.js +0 -89
- package/esm2015/lib/checkbox/checkbox.component.js.map +0 -1
- package/esm2015/lib/checkbox/checkbox.component.metadata.json +0 -1
- package/esm2015/lib/checkbox/checkbox.module.js +0 -12
- package/esm2015/lib/checkbox/checkbox.module.js.map +0 -1
- package/esm2015/lib/checkbox/checkbox.module.metadata.json +0 -1
- package/esm2015/lib/core/animation.js +0 -34
- package/esm2015/lib/core/animation.js.map +0 -1
- package/esm2015/lib/core/animation.metadata.json +0 -1
- package/esm2015/lib/core/client-environment.js +0 -20
- package/esm2015/lib/core/client-environment.js.map +0 -1
- package/esm2015/lib/core/client-environment.metadata.json +0 -1
- package/esm2015/lib/core/common-behaviors/disabled.js +0 -25
- package/esm2015/lib/core/common-behaviors/disabled.js.map +0 -1
- package/esm2015/lib/core/common-behaviors/disabled.metadata.json +0 -1
- package/esm2015/lib/core/core.module.js +0 -25
- package/esm2015/lib/core/core.module.js.map +0 -1
- package/esm2015/lib/core/core.module.metadata.json +0 -1
- package/esm2015/lib/core/devices/client-input-desktop.directive.js +0 -22
- package/esm2015/lib/core/devices/client-input-desktop.directive.js.map +0 -1
- package/esm2015/lib/core/devices/client-input-desktop.directive.metadata.json +0 -1
- package/esm2015/lib/core/devices/client-input-touch.directive.js +0 -22
- package/esm2015/lib/core/devices/client-input-touch.directive.js.map +0 -1
- package/esm2015/lib/core/devices/client-input-touch.directive.metadata.json +0 -1
- package/esm2015/lib/core/devices/client-output-desktop.directive.js +0 -22
- package/esm2015/lib/core/devices/client-output-desktop.directive.js.map +0 -1
- package/esm2015/lib/core/devices/client-output-desktop.directive.metadata.json +0 -1
- package/esm2015/lib/core/devices/client-output-touch.directive.js +0 -22
- package/esm2015/lib/core/devices/client-output-touch.directive.js.map +0 -1
- package/esm2015/lib/core/devices/client-output-touch.directive.metadata.json +0 -1
- package/esm2015/lib/core/pipes/pure-pipes.module.js +0 -11
- package/esm2015/lib/core/pipes/pure-pipes.module.js.map +0 -1
- package/esm2015/lib/core/pipes/pure-pipes.module.metadata.json +0 -1
- package/esm2015/lib/core/pipes/title.pipe.js +0 -17
- package/esm2015/lib/core/pipes/title.pipe.js.map +0 -1
- package/esm2015/lib/core/pipes/title.pipe.metadata.json +0 -1
- package/esm2015/lib/core/radio-checkbox-base.js +0 -15
- package/esm2015/lib/core/radio-checkbox-base.js.map +0 -1
- package/esm2015/lib/core/radio-checkbox-base.metadata.json +0 -1
- package/esm2015/lib/core/theme.library.js +0 -59
- package/esm2015/lib/core/theme.library.js.map +0 -1
- package/esm2015/lib/core/theme.library.metadata.json +0 -1
- package/esm2015/lib/core/types.js +0 -2
- package/esm2015/lib/core/types.js.map +0 -1
- package/esm2015/lib/core/types.metadata.json +0 -1
- package/esm2015/lib/grid/grid.component.js +0 -131
- package/esm2015/lib/grid/grid.component.js.map +0 -1
- package/esm2015/lib/grid/grid.component.metadata.json +0 -1
- package/esm2015/lib/grid/grid.module.js +0 -13
- package/esm2015/lib/grid/grid.module.js.map +0 -1
- package/esm2015/lib/grid/grid.module.metadata.json +0 -1
- package/esm2015/lib/icon/icon.component.js +0 -48
- package/esm2015/lib/icon/icon.component.js.map +0 -1
- package/esm2015/lib/icon/icon.component.metadata.json +0 -1
- package/esm2015/lib/icon/icon.module.js +0 -11
- package/esm2015/lib/icon/icon.module.js.map +0 -1
- package/esm2015/lib/icon/icon.module.metadata.json +0 -1
- package/esm2015/lib/input-field/input-field.component.js +0 -144
- package/esm2015/lib/input-field/input-field.component.js.map +0 -1
- package/esm2015/lib/input-field/input-field.component.metadata.json +0 -1
- package/esm2015/lib/input-field/input-field.module.js +0 -15
- package/esm2015/lib/input-field/input-field.module.js.map +0 -1
- package/esm2015/lib/input-field/input-field.module.metadata.json +0 -1
- package/esm2015/lib/menu/divider.directive.js +0 -20
- package/esm2015/lib/menu/divider.directive.js.map +0 -1
- package/esm2015/lib/menu/divider.directive.metadata.json +0 -1
- package/esm2015/lib/menu/menu-desktop-animations.js +0 -23
- package/esm2015/lib/menu/menu-desktop-animations.js.map +0 -1
- package/esm2015/lib/menu/menu-desktop-animations.metadata.json +0 -1
- package/esm2015/lib/menu/menu-errors.js +0 -37
- package/esm2015/lib/menu/menu-errors.js.map +0 -1
- package/esm2015/lib/menu/menu-errors.metadata.json +0 -1
- package/esm2015/lib/menu/menu-item.component.js +0 -82
- package/esm2015/lib/menu/menu-item.component.js.map +0 -1
- package/esm2015/lib/menu/menu-item.component.metadata.json +0 -1
- package/esm2015/lib/menu/menu-panel.js +0 -7
- package/esm2015/lib/menu/menu-panel.js.map +0 -1
- package/esm2015/lib/menu/menu-panel.metadata.json +0 -1
- package/esm2015/lib/menu/menu-positions.js +0 -9
- package/esm2015/lib/menu/menu-positions.js.map +0 -1
- package/esm2015/lib/menu/menu-positions.metadata.json +0 -1
- package/esm2015/lib/menu/menu-touch-animations.js +0 -137
- package/esm2015/lib/menu/menu-touch-animations.js.map +0 -1
- package/esm2015/lib/menu/menu-touch-animations.metadata.json +0 -1
- package/esm2015/lib/menu/menu-touch-close.component.js +0 -16
- package/esm2015/lib/menu/menu-touch-close.component.js.map +0 -1
- package/esm2015/lib/menu/menu-touch-close.component.metadata.json +0 -1
- package/esm2015/lib/menu/menu-touch-title.component.js +0 -45
- package/esm2015/lib/menu/menu-touch-title.component.js.map +0 -1
- package/esm2015/lib/menu/menu-touch-title.component.metadata.json +0 -1
- package/esm2015/lib/menu/menu-trigger-for.directive.js +0 -684
- package/esm2015/lib/menu/menu-trigger-for.directive.js.map +0 -1
- package/esm2015/lib/menu/menu-trigger-for.directive.metadata.json +0 -1
- package/esm2015/lib/menu/menu.component.js +0 -362
- package/esm2015/lib/menu/menu.component.js.map +0 -1
- package/esm2015/lib/menu/menu.component.metadata.json +0 -1
- package/esm2015/lib/menu/menu.module.js +0 -38
- package/esm2015/lib/menu/menu.module.js.map +0 -1
- package/esm2015/lib/menu/menu.module.metadata.json +0 -1
- package/esm2015/lib/menu/testing/menu.harness.js +0 -133
- package/esm2015/lib/menu/testing/menu.harness.js.map +0 -1
- package/esm2015/lib/menu/testing/menu.harness.metadata.json +0 -1
- package/esm2015/lib/menu/title.directive.js +0 -13
- package/esm2015/lib/menu/title.directive.js.map +0 -1
- package/esm2015/lib/menu/title.directive.metadata.json +0 -1
- package/esm2015/lib/radio-button/radio-button.component.js +0 -110
- package/esm2015/lib/radio-button/radio-button.component.js.map +0 -1
- package/esm2015/lib/radio-button/radio-button.component.metadata.json +0 -1
- package/esm2015/lib/radio-button/radio-button.module.js +0 -12
- package/esm2015/lib/radio-button/radio-button.module.js.map +0 -1
- package/esm2015/lib/radio-button/radio-button.module.metadata.json +0 -1
- package/esm2015/lib/radio-button/radio-group.component.js +0 -19
- package/esm2015/lib/radio-button/radio-group.component.js.map +0 -1
- package/esm2015/lib/radio-button/radio-group.component.metadata.json +0 -1
- package/esm2015/lib/table/cell/cell.js +0 -12
- package/esm2015/lib/table/cell/cell.js.map +0 -1
- package/esm2015/lib/table/cell/cell.metadata.json +0 -1
- package/esm2015/lib/table/cell/table-data-cell.component.js +0 -21
- package/esm2015/lib/table/cell/table-data-cell.component.js.map +0 -1
- package/esm2015/lib/table/cell/table-data-cell.component.metadata.json +0 -1
- package/esm2015/lib/table/cell/table-header-cell.component.js +0 -13
- package/esm2015/lib/table/cell/table-header-cell.component.js.map +0 -1
- package/esm2015/lib/table/cell/table-header-cell.component.metadata.json +0 -1
- package/esm2015/lib/table/column/table-column.directive.js +0 -16
- package/esm2015/lib/table/column/table-column.directive.js.map +0 -1
- package/esm2015/lib/table/column/table-column.directive.metadata.json +0 -1
- package/esm2015/lib/table/table-constants.library.js +0 -4
- package/esm2015/lib/table/table-constants.library.js.map +0 -1
- package/esm2015/lib/table/table-constants.library.metadata.json +0 -1
- package/esm2015/lib/table/table.component.js +0 -28
- package/esm2015/lib/table/table.component.js.map +0 -1
- package/esm2015/lib/table/table.component.metadata.json +0 -1
- package/esm2015/lib/table/table.module.js +0 -24
- package/esm2015/lib/table/table.module.js.map +0 -1
- package/esm2015/lib/table/table.module.metadata.json +0 -1
- package/esm2015/lib/toggle-switch/toggle-switch.component.js +0 -89
- package/esm2015/lib/toggle-switch/toggle-switch.component.js.map +0 -1
- package/esm2015/lib/toggle-switch/toggle-switch.component.metadata.json +0 -1
- package/esm2015/lib/toggle-switch/toggle-switch.module.js +0 -11
- package/esm2015/lib/toggle-switch/toggle-switch.module.js.map +0 -1
- package/esm2015/lib/toggle-switch/toggle-switch.module.metadata.json +0 -1
- package/fesm2015/ifsworld-granite-components.js +0 -2992
- package/fesm2015/ifsworld-granite-components.js.map +0 -1
- package/ifsworld-granite-components.metadata.json +0 -1
|
@@ -1,2992 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, ElementRef, Input, HostBinding, ContentChildren, NgModule, Renderer2, InjectionToken, Inject, Optional, EventEmitter, QueryList, Directive, ChangeDetectorRef, ViewChild, TemplateRef, Output, ViewContainerRef, Self, Attribute, HostListener, ContentChild, Pipe } from '@angular/core';
|
|
2
|
-
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
3
|
-
import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
4
|
-
import { Subject, BehaviorSubject, combineLatest, Subscription, merge, of, asapScheduler, fromEvent } from 'rxjs';
|
|
5
|
-
import { takeUntil, filter, map, startWith, switchMap, take, delay } from 'rxjs/operators';
|
|
6
|
-
import { __awaiter } from 'tslib';
|
|
7
|
-
import { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';
|
|
8
|
-
import { OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
9
|
-
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { FocusMonitor, FocusKeyManager, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
|
|
11
|
-
import { hasModifierKey } from '@angular/cdk/keycodes';
|
|
12
|
-
import { trigger, state, style, transition, group, query, animate, sequence } from '@angular/animations';
|
|
13
|
-
import { Directionality } from '@angular/cdk/bidi';
|
|
14
|
-
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
15
|
-
import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
|
|
16
|
-
import { CdkTableModule } from '@angular/cdk/table';
|
|
17
|
-
|
|
18
|
-
class GraniteArrangeGridItemComponent {
|
|
19
|
-
constructor(element) {
|
|
20
|
-
this.element = element;
|
|
21
|
-
/**
|
|
22
|
-
* Column span to render.
|
|
23
|
-
* For use in template only. Do not use outside of this component.
|
|
24
|
-
* @ignore
|
|
25
|
-
*/
|
|
26
|
-
this._columnSpan = null;
|
|
27
|
-
/* no-op */
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Number of cells the item would span. Used by arrange grid in column
|
|
31
|
-
* orientation to fill any unused space caused by wrapped items.
|
|
32
|
-
*/
|
|
33
|
-
set columnSpan(value) {
|
|
34
|
-
this._columnSpan = value;
|
|
35
|
-
this.updateStyles();
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Update element styles
|
|
39
|
-
*/
|
|
40
|
-
updateStyles() {
|
|
41
|
-
this.setCssProperty('--columnSpan', this._columnSpan ? this._columnSpan.toString() : null);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Set CSS variable value or remove it if a null value is given.
|
|
45
|
-
* Would of course rather have used property binding but that is not
|
|
46
|
-
* supported until (perhaps) Angular 9.
|
|
47
|
-
* See: https://github.com/angular/angular/issues/9343
|
|
48
|
-
*/
|
|
49
|
-
setCssProperty(variable, value) {
|
|
50
|
-
this.element.nativeElement.style.setProperty(variable, value);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
GraniteArrangeGridItemComponent.decorators = [
|
|
54
|
-
{ type: Component, args: [{
|
|
55
|
-
selector: 'granite-arrange-grid-item',
|
|
56
|
-
template: '<ng-content></ng-content>',
|
|
57
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
58
|
-
styles: [":host{--columnSpan:$default-column-span;display:grid;grid-column:span var(--columnSpan,1)}"]
|
|
59
|
-
},] }
|
|
60
|
-
];
|
|
61
|
-
GraniteArrangeGridItemComponent.ctorParameters = () => [
|
|
62
|
-
{ type: ElementRef }
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
var GraniteArrangeGridOrientation;
|
|
66
|
-
(function (GraniteArrangeGridOrientation) {
|
|
67
|
-
GraniteArrangeGridOrientation["columns"] = "columns";
|
|
68
|
-
GraniteArrangeGridOrientation["rows"] = "rows";
|
|
69
|
-
})(GraniteArrangeGridOrientation || (GraniteArrangeGridOrientation = {}));
|
|
70
|
-
class GraniteArrangeGridComponent {
|
|
71
|
-
constructor(element) {
|
|
72
|
-
this.element = element;
|
|
73
|
-
/** How to present grid items; `columns` (default) or `rows` */
|
|
74
|
-
this.orientation = GraniteArrangeGridOrientation.columns;
|
|
75
|
-
/** Exposes column orientation to template */
|
|
76
|
-
this.classColumnOrientation = false;
|
|
77
|
-
/** Exposes row orientation to template */
|
|
78
|
-
this.classRowOrientation = false;
|
|
79
|
-
/** Number of columns to render */
|
|
80
|
-
this._cols = GraniteArrangeGridComponent.defaultCols;
|
|
81
|
-
/** Nexted on component destruction to complete other observables. */
|
|
82
|
-
this.destroy$ = new Subject();
|
|
83
|
-
/* no-op */
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Number of grid columns to use when orientation is set to `column`. The
|
|
87
|
-
* default is two columns.
|
|
88
|
-
*/
|
|
89
|
-
set cols(value) {
|
|
90
|
-
this._cols = Math.max(1, Math.round(coerceNumberProperty(value)));
|
|
91
|
-
}
|
|
92
|
-
get cols() {
|
|
93
|
-
return this._cols;
|
|
94
|
-
}
|
|
95
|
-
set rows(value) {
|
|
96
|
-
// Prevent pointless usage
|
|
97
|
-
throw Error('Explicitly setting rows value for arrange grid is unsupported');
|
|
98
|
-
}
|
|
99
|
-
get rows() {
|
|
100
|
-
return this._rows;
|
|
101
|
-
}
|
|
102
|
-
ngAfterContentInit() {
|
|
103
|
-
// Update style whenever grid item components change in content
|
|
104
|
-
this.arrangeGridItemComponents.changes
|
|
105
|
-
.pipe(takeUntil(this.destroy$))
|
|
106
|
-
.subscribe(() => this.updateStyles());
|
|
107
|
-
this.updateStyles();
|
|
108
|
-
}
|
|
109
|
-
ngOnChanges(changes) {
|
|
110
|
-
if ((changes.orientation && !changes.orientation.isFirstChange()) ||
|
|
111
|
-
(changes.cols && !changes.cols.isFirstChange())) {
|
|
112
|
-
this.updateStyles();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
ngOnDestroy() {
|
|
116
|
-
this.destroy$.next();
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Update grid row template style.
|
|
120
|
-
*
|
|
121
|
-
* Use content height of all but last row and let the last grow
|
|
122
|
-
* to take up any remaining space.
|
|
123
|
-
*/
|
|
124
|
-
updateStyles() {
|
|
125
|
-
const children = (this.arrangeGridItemComponents || []).length;
|
|
126
|
-
if (this.orientation === GraniteArrangeGridOrientation.columns) {
|
|
127
|
-
// If too many items was placed into too few colums, there would
|
|
128
|
-
// be some wrapping. Take that into account when calculating the
|
|
129
|
-
// number of rows.
|
|
130
|
-
this._rows = Math.trunc((children - 1) / (this._cols || 1)) + 1;
|
|
131
|
-
this.classColumnOrientation = true;
|
|
132
|
-
this.classRowOrientation = false;
|
|
133
|
-
if (children > 0) {
|
|
134
|
-
// Fill any unused space caused by wrapped items by making the
|
|
135
|
-
// last item also span over remaining cells.
|
|
136
|
-
this.arrangeGridItemComponents.forEach((c) => (c.columnSpan = null));
|
|
137
|
-
this.arrangeGridItemComponents.last.columnSpan =
|
|
138
|
-
this._rows * this._cols - children + 1;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
this._cols = 1; // In row orientation, there is just a single column
|
|
143
|
-
this._rows = children;
|
|
144
|
-
this.classColumnOrientation = false;
|
|
145
|
-
this.classRowOrientation = true;
|
|
146
|
-
}
|
|
147
|
-
this.setCssProperty('--cols', this._cols.toString());
|
|
148
|
-
this.setCssProperty('--rows', this._rows.toString());
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Set CSS variable value or remove it if a null value is given.
|
|
152
|
-
* Would of course rather have used property binding but that is not
|
|
153
|
-
* supported until (perhaps) Angular 9.
|
|
154
|
-
* See: https://github.com/angular/angular/issues/9343
|
|
155
|
-
*
|
|
156
|
-
* TODO: Replace with property binding with Angular 9 upgrade
|
|
157
|
-
*/
|
|
158
|
-
setCssProperty(variable, value) {
|
|
159
|
-
this.element.nativeElement.style.setProperty(variable, value);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
/** Default number of columns to use in column orientation */
|
|
163
|
-
GraniteArrangeGridComponent.defaultCols = 2;
|
|
164
|
-
GraniteArrangeGridComponent.decorators = [
|
|
165
|
-
{ type: Component, args: [{
|
|
166
|
-
selector: 'granite-arrange-grid',
|
|
167
|
-
template: "<ng-content select=\"granite-arrange-grid-item\"></ng-content>\n",
|
|
168
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
169
|
-
styles: ["@media only screen and (min-width:960px){:host{--cols:1;--rows:1;display:grid;grid-template-columns:repeat(var(--cols,1),1fr);-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem}:host.row-orientation{grid-template-columns:auto;grid-template-rows:repeat(calc(var(--rows, 1) - 1),-webkit-max-content);grid-template-rows:repeat(calc(var(--rows, 1) - 1),max-content)}}"]
|
|
170
|
-
},] }
|
|
171
|
-
];
|
|
172
|
-
GraniteArrangeGridComponent.ctorParameters = () => [
|
|
173
|
-
{ type: ElementRef }
|
|
174
|
-
];
|
|
175
|
-
GraniteArrangeGridComponent.propDecorators = {
|
|
176
|
-
orientation: [{ type: Input }],
|
|
177
|
-
classColumnOrientation: [{ type: HostBinding, args: ['class.column-orientation',] }],
|
|
178
|
-
classRowOrientation: [{ type: HostBinding, args: ['class.row-orientation',] }],
|
|
179
|
-
arrangeGridItemComponents: [{ type: ContentChildren, args: [GraniteArrangeGridItemComponent,] }],
|
|
180
|
-
cols: [{ type: Input }]
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
class GraniteArrangeGridModule {
|
|
184
|
-
}
|
|
185
|
-
GraniteArrangeGridModule.decorators = [
|
|
186
|
-
{ type: NgModule, args: [{
|
|
187
|
-
declarations: [GraniteArrangeGridComponent, GraniteArrangeGridItemComponent],
|
|
188
|
-
imports: [CommonModule],
|
|
189
|
-
exports: [GraniteArrangeGridComponent, GraniteArrangeGridItemComponent],
|
|
190
|
-
},] }
|
|
191
|
-
];
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Grid item component
|
|
195
|
-
*
|
|
196
|
-
* Merely a wrapper for CSS Grid items, accepting item style as input parameters.
|
|
197
|
-
*/
|
|
198
|
-
class GraniteGridItemComponent {
|
|
199
|
-
constructor(element, renderer) {
|
|
200
|
-
this.element = element;
|
|
201
|
-
this.renderer = renderer;
|
|
202
|
-
}
|
|
203
|
-
ngOnChanges() {
|
|
204
|
-
this.updateStyles();
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Update element styles
|
|
208
|
-
*/
|
|
209
|
-
updateStyles() {
|
|
210
|
-
this.setStyle('gridColumnStart', this.columnStart);
|
|
211
|
-
this.setStyle('gridColumnEnd', this.columnEnd);
|
|
212
|
-
this.setStyle('gridRowStart', this.rowStart);
|
|
213
|
-
this.setStyle('gridRowEnd', this.rowEnd);
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Sets the element style. Needs to be set manually to avoid "Changed after
|
|
217
|
-
* checked" errors that would occur with HostBinding.
|
|
218
|
-
*/
|
|
219
|
-
setStyle(property, value) {
|
|
220
|
-
this.renderer.setStyle(this.element.nativeElement, property, value || '');
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
GraniteGridItemComponent.decorators = [
|
|
224
|
-
{ type: Component, args: [{
|
|
225
|
-
selector: 'granite-grid-item',
|
|
226
|
-
template: '<ng-content></ng-content>',
|
|
227
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
228
|
-
},] }
|
|
229
|
-
];
|
|
230
|
-
GraniteGridItemComponent.ctorParameters = () => [
|
|
231
|
-
{ type: ElementRef },
|
|
232
|
-
{ type: Renderer2 }
|
|
233
|
-
];
|
|
234
|
-
GraniteGridItemComponent.propDecorators = {
|
|
235
|
-
columnStart: [{ type: Input }],
|
|
236
|
-
columnEnd: [{ type: Input }],
|
|
237
|
-
rowStart: [{ type: Input }],
|
|
238
|
-
rowEnd: [{ type: Input }]
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Grid
|
|
242
|
-
*
|
|
243
|
-
* A wrapper around a native CSS Grid. Anything can be used for grid items, but
|
|
244
|
-
* `GridItemComponent` is recommended for common cases.
|
|
245
|
-
*/
|
|
246
|
-
class GraniteGridComponent {
|
|
247
|
-
constructor(element) {
|
|
248
|
-
this.element = element;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Number of grid columns, unless set via styling (grid-template-columns)
|
|
252
|
-
*
|
|
253
|
-
* Setting this value will produce equally sized columns
|
|
254
|
-
*/
|
|
255
|
-
set cols(value) {
|
|
256
|
-
this._cols = Math.max(1, Math.round(coerceNumberProperty(value)));
|
|
257
|
-
}
|
|
258
|
-
get cols() {
|
|
259
|
-
return this._cols;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Number of grid rows, unless set via styling (grid-template-rows)
|
|
263
|
-
*
|
|
264
|
-
* Setting this value will produce equally sized rows
|
|
265
|
-
*/
|
|
266
|
-
set rows(value) {
|
|
267
|
-
this._rows = Math.max(1, Math.round(coerceNumberProperty(value)));
|
|
268
|
-
}
|
|
269
|
-
get rows() {
|
|
270
|
-
return this._rows;
|
|
271
|
-
}
|
|
272
|
-
ngAfterContentInit() {
|
|
273
|
-
this.updateStyles();
|
|
274
|
-
}
|
|
275
|
-
ngOnChanges(changes) {
|
|
276
|
-
if ((changes.cols && !changes.cols.isFirstChange()) ||
|
|
277
|
-
(changes.rows && !changes.rows.isFirstChange())) {
|
|
278
|
-
this.updateStyles();
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
/** Update element styles */
|
|
282
|
-
updateStyles() {
|
|
283
|
-
this.updateColumnStyles();
|
|
284
|
-
this.updateRowStyles();
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Set CSS variable value or remove it if a null value is given.
|
|
288
|
-
* Would of course rather have used property binding but that is not
|
|
289
|
-
* supported until (perhaps) Angular 9.
|
|
290
|
-
* See: https://github.com/angular/angular/issues/9343
|
|
291
|
-
*
|
|
292
|
-
* TODO: Replace with property binding with Angular 9 upgrade
|
|
293
|
-
*/
|
|
294
|
-
setCssProperty(variable, value) {
|
|
295
|
-
this.element.nativeElement.style.setProperty(variable, value);
|
|
296
|
-
}
|
|
297
|
-
/** Update grid column template style */
|
|
298
|
-
updateColumnStyles() {
|
|
299
|
-
this.setCssProperty('--cols', (this._cols && this._cols.toString()) || null);
|
|
300
|
-
}
|
|
301
|
-
/** Update grid row template style */
|
|
302
|
-
updateRowStyles() {
|
|
303
|
-
this.setCssProperty('--rows', (this._rows && this._rows.toString()) || null);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
GraniteGridComponent.decorators = [
|
|
307
|
-
{ type: Component, args: [{
|
|
308
|
-
selector: 'granite-grid',
|
|
309
|
-
template: '<ng-content></ng-content>',
|
|
310
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
311
|
-
styles: [":host{--cols:1;--rows:1;display:grid;grid-template-columns:repeat(var(--cols,1),1fr);grid-template-rows:repeat(var(--rows,1),1fr)}"]
|
|
312
|
-
},] }
|
|
313
|
-
];
|
|
314
|
-
GraniteGridComponent.ctorParameters = () => [
|
|
315
|
-
{ type: ElementRef }
|
|
316
|
-
];
|
|
317
|
-
GraniteGridComponent.propDecorators = {
|
|
318
|
-
cols: [{ type: Input }],
|
|
319
|
-
rows: [{ type: Input }]
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
class GraniteGridModule {
|
|
323
|
-
}
|
|
324
|
-
GraniteGridModule.decorators = [
|
|
325
|
-
{ type: NgModule, args: [{
|
|
326
|
-
declarations: [GraniteGridComponent, GraniteGridItemComponent],
|
|
327
|
-
imports: [CommonModule],
|
|
328
|
-
exports: [GraniteGridComponent, GraniteGridItemComponent],
|
|
329
|
-
},] }
|
|
330
|
-
];
|
|
331
|
-
|
|
332
|
-
const TOKEN_PREFIX = 'granite-';
|
|
333
|
-
const TOKEN_PREFIX_OLD = 'fnd-'; // TODO: Remove this when all tokens have 'granite-' as the prefix
|
|
334
|
-
/**
|
|
335
|
-
* Get the theme that corresponds to a given ID
|
|
336
|
-
*/
|
|
337
|
-
function getThemeById(themes, id) {
|
|
338
|
-
const theme = id !== undefined ? themes.find((t) => t.id === id) : undefined;
|
|
339
|
-
return theme;
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Apply a theme to a DOM element by iterating though all tokens,
|
|
343
|
-
* setting a CSS variable for each one.
|
|
344
|
-
*
|
|
345
|
-
* @param theme Theme to set
|
|
346
|
-
* @param element Target element
|
|
347
|
-
*/
|
|
348
|
-
function applyTheme(theme, element) {
|
|
349
|
-
applyTokens(theme.tokens, element);
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* Set a CSS variable for each token on the specified element.
|
|
353
|
-
*
|
|
354
|
-
* @param theme Theme to set
|
|
355
|
-
* @param element Target element
|
|
356
|
-
*/
|
|
357
|
-
function applyTokens(tokens, element) {
|
|
358
|
-
for (const token of Object.keys(tokens)) {
|
|
359
|
-
element.style.setProperty(token, tokens[token]);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Remove theme token CSS variables from an element using the specified keys
|
|
364
|
-
*
|
|
365
|
-
* @param theme Theme with tokens to clear
|
|
366
|
-
* @param element Target element
|
|
367
|
-
*/
|
|
368
|
-
function clearTheme(theme, element) {
|
|
369
|
-
clearTokens(Object.keys(theme.tokens), element);
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Remove token CSS variables from an element using the specified keys.
|
|
373
|
-
*
|
|
374
|
-
* @param keys Token keys
|
|
375
|
-
* @param element Target element
|
|
376
|
-
*/
|
|
377
|
-
function clearTokens(keys, element) {
|
|
378
|
-
for (const token of keys) {
|
|
379
|
-
element.style.removeProperty(token);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
function isValidToken(key) {
|
|
383
|
-
return (key && (key.startsWith(TOKEN_PREFIX) || key.startsWith(TOKEN_PREFIX_OLD)));
|
|
384
|
-
}
|
|
385
|
-
function setPropertyValue(name, value, element) {
|
|
386
|
-
if (element && element.style && value != null) {
|
|
387
|
-
element.style.setProperty(name, isValidToken(value) ? `var(--${value})` : value);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
class GraniteBadgeComponent {
|
|
392
|
-
constructor(elementRef) {
|
|
393
|
-
this.elementRef = elementRef;
|
|
394
|
-
/** Pill style badge */
|
|
395
|
-
this.pill = false;
|
|
396
|
-
}
|
|
397
|
-
ngOnChanges(changes) {
|
|
398
|
-
if (changes.backgroundColor) {
|
|
399
|
-
if (changes.backgroundColor.previousValue !==
|
|
400
|
-
changes.backgroundColor.currentValue) {
|
|
401
|
-
setPropertyValue('background-color', changes.backgroundColor.currentValue, this.elementRef.nativeElement);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if (changes.color) {
|
|
405
|
-
if (changes.color.previousValue !== changes.color.currentValue) {
|
|
406
|
-
setPropertyValue('color', changes.color.currentValue, this.elementRef.nativeElement);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
GraniteBadgeComponent.decorators = [
|
|
412
|
-
{ type: Component, args: [{
|
|
413
|
-
selector: 'granite-badge',
|
|
414
|
-
exportAs: 'graniteBadge',
|
|
415
|
-
host: {
|
|
416
|
-
class: 'granite-badge',
|
|
417
|
-
'[class.granite-badge-pill]': 'pill',
|
|
418
|
-
},
|
|
419
|
-
template: '<ng-content></ng-content>',
|
|
420
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
421
|
-
styles: [":host{display:-moz-inline-flex;display:inline-flex;flex-direction:row;flex-wrap:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis;white-space:nowrap;align-items:center;background-color:var(--granite-color-signal-neutral);color:var(--granite-color-text-static-light);padding:calc(var(--granite-spacing-m) * .3125);border-radius:.3125rem;-webkit-padding-start:calc(var(--granite-spacing-m) * .625);padding-inline-start:calc(var(--granite-spacing-m) * .625);-webkit-padding-end:calc(var(--granite-spacing-m) * .625);padding-inline-end:calc(var(--granite-spacing-m) * .625)}:host(.granite-badge-pill){border-radius:1.5625rem}"]
|
|
422
|
-
},] }
|
|
423
|
-
];
|
|
424
|
-
GraniteBadgeComponent.ctorParameters = () => [
|
|
425
|
-
{ type: ElementRef }
|
|
426
|
-
];
|
|
427
|
-
GraniteBadgeComponent.propDecorators = {
|
|
428
|
-
backgroundColor: [{ type: Input }],
|
|
429
|
-
color: [{ type: Input }],
|
|
430
|
-
pill: [{ type: Input }]
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
class GraniteBadgeModule {
|
|
434
|
-
}
|
|
435
|
-
GraniteBadgeModule.decorators = [
|
|
436
|
-
{ type: NgModule, args: [{
|
|
437
|
-
declarations: [GraniteBadgeComponent],
|
|
438
|
-
imports: [CommonModule],
|
|
439
|
-
exports: [GraniteBadgeComponent],
|
|
440
|
-
},] }
|
|
441
|
-
];
|
|
442
|
-
|
|
443
|
-
class GraniteBadgeHarness extends ComponentHarness {
|
|
444
|
-
/**
|
|
445
|
-
* Gets a `HarnessPredicate` that can be used to search for a `GraniteBadgeHarness` that meets
|
|
446
|
-
* certain criteria.
|
|
447
|
-
* @param options Options for filtering which badge instances are considered a match.
|
|
448
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
449
|
-
*/
|
|
450
|
-
static with(options = {}) {
|
|
451
|
-
const predicate = new HarnessPredicate(GraniteBadgeHarness, options);
|
|
452
|
-
predicate.addOption('text', options.text, (harness, label) => HarnessPredicate.stringMatches(harness.getText(), label));
|
|
453
|
-
predicate.addOption('pill', options.pill, (harness, pill) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isPill()) === pill; }));
|
|
454
|
-
return predicate;
|
|
455
|
-
}
|
|
456
|
-
/** Gets the Badge text. */
|
|
457
|
-
getText() {
|
|
458
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
459
|
-
return (yield this.host()).text();
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
/** Whether it's a Pill type badge. */
|
|
463
|
-
isPill() {
|
|
464
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
465
|
-
return (yield this.host()).hasClass('granite-badge-pill');
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
GraniteBadgeHarness.hostSelector = 'granite-badge';
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* Injection token used to provide the parent menu to menu-specific components.
|
|
473
|
-
* @docs-private
|
|
474
|
-
*/
|
|
475
|
-
const GRANITE_MENU_PANEL = new InjectionToken('GRANITE_MENU_PANEL');
|
|
476
|
-
|
|
477
|
-
class GraniteMenuItemComponent {
|
|
478
|
-
constructor(_elementRef, _focusMonitor, _parentMenu) {
|
|
479
|
-
this._elementRef = _elementRef;
|
|
480
|
-
this._focusMonitor = _focusMonitor;
|
|
481
|
-
this._parentMenu = _parentMenu;
|
|
482
|
-
/** ARIA role for the menu item. */
|
|
483
|
-
this.role = 'menuitem';
|
|
484
|
-
/** Stream that emits when the menu item is hovered. */
|
|
485
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
486
|
-
this._hovered = new Subject();
|
|
487
|
-
/** Stream that emits when the menu item is focused. */
|
|
488
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
489
|
-
this._focused = new Subject();
|
|
490
|
-
/** Whether the menu item acts as a trigger for a sub-menu (used for styling) */
|
|
491
|
-
this._triggersSubmenu = false;
|
|
492
|
-
/**
|
|
493
|
-
* Whether the menu item is highlighted, e.g. in the "breadcrumb" parent chain
|
|
494
|
-
* of sub menu trigger items
|
|
495
|
-
*/
|
|
496
|
-
this._highlighted = false;
|
|
497
|
-
// Start monitoring the element so it gets the appropriate focused classes. We want
|
|
498
|
-
// to show the focus style for menu items only when the focus was not caused by a
|
|
499
|
-
// mouse or touch interaction.
|
|
500
|
-
_focusMonitor.monitor(this._elementRef, false);
|
|
501
|
-
}
|
|
502
|
-
ngOnDestroy() {
|
|
503
|
-
this._focusMonitor.stopMonitoring(this._elementRef);
|
|
504
|
-
this._hovered.complete();
|
|
505
|
-
this._focused.complete();
|
|
506
|
-
}
|
|
507
|
-
/** Focuses the menu item. */
|
|
508
|
-
focus(origin = 'program', options) {
|
|
509
|
-
this._focusMonitor.focusVia(this._getHostElement(), origin, options);
|
|
510
|
-
this._focused.next(this);
|
|
511
|
-
}
|
|
512
|
-
/** Returns the host DOM element. */
|
|
513
|
-
_getHostElement() {
|
|
514
|
-
return this._elementRef.nativeElement;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
GraniteMenuItemComponent.decorators = [
|
|
518
|
-
{ type: Component, args: [{
|
|
519
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
520
|
-
selector: '[graniteMenuItem]',
|
|
521
|
-
template: `<ng-content></ng-content>
|
|
522
|
-
<ng-container *ngIf="_triggersSubmenu">
|
|
523
|
-
<granite-icon
|
|
524
|
-
class="caret-left"
|
|
525
|
-
[fontIcon]="'icon-caret-left'"
|
|
526
|
-
></granite-icon>
|
|
527
|
-
<granite-icon
|
|
528
|
-
class="caret-right"
|
|
529
|
-
[fontIcon]="'icon-caret-right'"
|
|
530
|
-
></granite-icon>
|
|
531
|
-
</ng-container>`,
|
|
532
|
-
exportAs: 'graniteMenuItem',
|
|
533
|
-
host: {
|
|
534
|
-
'[attr.role]': 'role',
|
|
535
|
-
'[class.granite-menu-item]': 'true',
|
|
536
|
-
'[class.granite-menu-item-highlighted]': '_highlighted',
|
|
537
|
-
'[class.granite-menu-item-submenu-trigger]': '_triggersSubmenu',
|
|
538
|
-
//#region --- Touch device customizations ---
|
|
539
|
-
'[class.granite-device-output-touch]': '_clientOutput?.device === "touch"',
|
|
540
|
-
//#endregion --- Touch device customizations ---
|
|
541
|
-
'(mouseenter)': '_hovered.next(this)',
|
|
542
|
-
},
|
|
543
|
-
styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-s);width:100%;max-width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:start;text-decoration:none;background-color:var(--granite-color-background-variant);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small);font-family:inherit}@media (hover:hover) and (pointer:fine){:host:hover:not(.granite-title):not([disabled]){background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}@media (hover:none) and (pointer:coarse){:host:active:not(.granite-title):not([disabled]){background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host.granite-title{-moz-user-select:none;-webkit-user-select:none;user-select:none;display:flex;align-items:center;line-height:1.5rem;width:100%;outline:none;border:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;color:var(--granite-color-text);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-bold);cursor:default}:host.cdk-keyboard-focused,:host.cdk-program-focused,:host.granite-menu-item-highlighted{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}:host granite-icon{position:absolute;font-size:var(--granite-font-size-body-small);color:inherit;top:50%;transform:translateY(-50%)}:host.granite-menu-item-submenu-trigger{-webkit-padding-end:var(--granite-spacing-l);padding-inline-end:var(--granite-spacing-l)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-xs)}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left,[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}:host.granite-divider-top{border-top:.0625rem solid var(--granite-color-border-soft)}:host.granite-divider-bottom{border-bottom:.0625rem solid var(--granite-color-border-soft)}:host.granite-device-output-touch{line-height:3rem;font-size:var(--granite-font-size-body-small);text-align:center;padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-title{padding:0;justify-content:center;line-height:1.5rem;font-size:var(--granite-font-size-micro)}:host.granite-device-output-touch.granite-menu-item-back-trigger,:host.granite-device-output-touch.granite-menu-item-submenu-trigger{padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-menu-item-title{line-height:3rem;height:3rem;font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}@media (hover:none) and (pointer:coarse){:host.granite-device-output-touch.granite-menu-item-title:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-xs)}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right,[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}"]
|
|
544
|
-
},] }
|
|
545
|
-
];
|
|
546
|
-
GraniteMenuItemComponent.ctorParameters = () => [
|
|
547
|
-
{ type: ElementRef },
|
|
548
|
-
{ type: FocusMonitor },
|
|
549
|
-
{ type: undefined, decorators: [{ type: Inject, args: [GRANITE_MENU_PANEL,] }, { type: Optional }] }
|
|
550
|
-
];
|
|
551
|
-
GraniteMenuItemComponent.propDecorators = {
|
|
552
|
-
role: [{ type: Input }]
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Returns an ease-out CSS animation string with a slightly steeper curve
|
|
557
|
-
* than usual.
|
|
558
|
-
*
|
|
559
|
-
* @param duration Duration in milliseconds
|
|
560
|
-
* @param delay Delay in milliseconds
|
|
561
|
-
*/
|
|
562
|
-
function getEaseOutSteep(duration, delay) {
|
|
563
|
-
return (`${duration}ms ` +
|
|
564
|
-
(delay !== undefined ? ` ${delay}ms ` : '') +
|
|
565
|
-
'cubic-bezier(0, 0, 0.2, 1)');
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* Returns an ease-out-back CSS animation string with a slightly steeper
|
|
569
|
-
* curve than usual.
|
|
570
|
-
*
|
|
571
|
-
* @param duration Duration in milliseconds
|
|
572
|
-
* @param delay Delay in milliseconds
|
|
573
|
-
*/
|
|
574
|
-
function getEaseOutSteepBack(duration, delay) {
|
|
575
|
-
return (`${duration}ms ` +
|
|
576
|
-
(delay !== undefined ? ` ${delay}ms ` : '') +
|
|
577
|
-
'cubic-bezier(.37,1.3,.77,1)');
|
|
578
|
-
}
|
|
579
|
-
/**
|
|
580
|
-
* Returns a linear CSS animation string
|
|
581
|
-
*
|
|
582
|
-
* @param duration Duration in milliseconds
|
|
583
|
-
* @param delay Delay in milliseconds
|
|
584
|
-
*/
|
|
585
|
-
function getEaseLinear(duration, delay) {
|
|
586
|
-
return (`${duration}ms ` + (delay !== undefined ? ` ${delay}ms ` : '') + 'linear');
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
const easeOut120 = getEaseOutSteep(120);
|
|
590
|
-
/**
|
|
591
|
-
* Animations used by the `granite-menu` component, showing the desktop interface.
|
|
592
|
-
* @docs-private
|
|
593
|
-
*/
|
|
594
|
-
const graniteMenuDesktopAnimations = {
|
|
595
|
-
transformMenuDesktop: trigger('transformMenuDesktop', [
|
|
596
|
-
state('void', style({
|
|
597
|
-
opacity: 0,
|
|
598
|
-
transform: 'scale(0.9)',
|
|
599
|
-
})),
|
|
600
|
-
transition('void => enter', group([
|
|
601
|
-
query('.granite-menu-content', animate(getEaseLinear(100), style({
|
|
602
|
-
opacity: 1,
|
|
603
|
-
}))),
|
|
604
|
-
animate(easeOut120, style({ transform: 'scale(1)' })),
|
|
605
|
-
])),
|
|
606
|
-
transition('* => void', animate(getEaseLinear(100, 25), style({ opacity: 0 }))),
|
|
607
|
-
]),
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
const defaultDuration = 300;
|
|
611
|
-
const defaultDelay = 200;
|
|
612
|
-
const easeOut = getEaseOutSteep(defaultDuration);
|
|
613
|
-
const linear = getEaseLinear(defaultDuration);
|
|
614
|
-
const linearDelayed = getEaseLinear(defaultDuration, defaultDelay);
|
|
615
|
-
/**
|
|
616
|
-
* Insanely fast travel somewhere on or off the stage,
|
|
617
|
-
* to set a great starting position.
|
|
618
|
-
*
|
|
619
|
-
* For some reason this has to be animated with > 0ms time.
|
|
620
|
-
* Setting style directly gets ignored.
|
|
621
|
-
*/
|
|
622
|
-
const teleport = '1ms linear';
|
|
623
|
-
/**
|
|
624
|
-
* Style used by our menu stars to make grand entrée et sortie from/to below
|
|
625
|
-
* the viewport stage.
|
|
626
|
-
*/
|
|
627
|
-
const inTheOrchestraPit = style({
|
|
628
|
-
transform: 'translateX(0) translateY(100%)',
|
|
629
|
-
opacity: 0,
|
|
630
|
-
});
|
|
631
|
-
/** Style for a menu at the center of attention, on the viewport stage */
|
|
632
|
-
const onStage = style({
|
|
633
|
-
opacity: 1,
|
|
634
|
-
transform: 'translateX(0) translateY(0)',
|
|
635
|
-
});
|
|
636
|
-
/**
|
|
637
|
-
* Style for a (sub) menu starting position at the side of the stage, waiting
|
|
638
|
-
* to make an entrance by sliding into view, pushing the previous (parent)
|
|
639
|
-
* menu off.
|
|
640
|
-
*/
|
|
641
|
-
const awaitingCue = style({
|
|
642
|
-
opacity: 0,
|
|
643
|
-
transform: 'translateX(100vw) translateY(0)',
|
|
644
|
-
});
|
|
645
|
-
/**
|
|
646
|
-
* Style for a (parent) menu that has been pushed aside by a debutant
|
|
647
|
-
* (sub) menu and therefore, although maybe temporarily, left the spotlight.
|
|
648
|
-
*
|
|
649
|
-
* @param translateY Where to place on Y axis
|
|
650
|
-
*/
|
|
651
|
-
const retired = style({
|
|
652
|
-
opacity: 1,
|
|
653
|
-
transform: `translateX(-100vw) translateY(0)`,
|
|
654
|
-
});
|
|
655
|
-
/**
|
|
656
|
-
* Style for an active (sub) menu that dances across the stage, along with its
|
|
657
|
-
* parent menu, as a result of the user panning. Requires an `xOffset`
|
|
658
|
-
* parameter for the distance.
|
|
659
|
-
*/
|
|
660
|
-
const futsalShuffle = style({
|
|
661
|
-
transform: 'translateX({{ xOffset }}px)',
|
|
662
|
-
});
|
|
663
|
-
/**
|
|
664
|
-
* Style for a parent menu sweeping across the stage, right beside the
|
|
665
|
-
* starlet sub menu, either off the stage or back onto it (for a great comeback).
|
|
666
|
-
* Requires an `xOffset` parameter for the distance.
|
|
667
|
-
*/
|
|
668
|
-
const moonwalk = style({
|
|
669
|
-
transform: 'translateX(calc(-100vw + {{ xOffset }}px))',
|
|
670
|
-
});
|
|
671
|
-
const onStageHidden = style({
|
|
672
|
-
opacity: 0,
|
|
673
|
-
transform: 'translateX(0) translateY(0)',
|
|
674
|
-
});
|
|
675
|
-
/**
|
|
676
|
-
* Animations used by the `granite-menu` component, showing the touch interface.
|
|
677
|
-
* @docs-private
|
|
678
|
-
*/
|
|
679
|
-
const graniteMenuTouchAnimations = {
|
|
680
|
-
transformMenuTouch: trigger('transformMenuTouch', [
|
|
681
|
-
// Set up cast positions
|
|
682
|
-
state('void', awaitingCue),
|
|
683
|
-
state('enter, enter-from-below', onStage),
|
|
684
|
-
state('pan-hidden', moonwalk, { params: { xOffset: 0 } }),
|
|
685
|
-
state('pan', futsalShuffle, { params: { xOffset: 0 } }),
|
|
686
|
-
state('below-with-delay', inTheOrchestraPit),
|
|
687
|
-
state('hide', retired),
|
|
688
|
-
// General movement across the stage. Transitions to 'pan' and 'pan-hidden'
|
|
689
|
-
// states are intentionally left out as we want the menu position to update
|
|
690
|
-
// instantly as the user moves their finger.
|
|
691
|
-
transition('pan => enter, ' +
|
|
692
|
-
'pan => enter-from-below, ' +
|
|
693
|
-
'pan => void, ' +
|
|
694
|
-
'enter <=> hide, ' +
|
|
695
|
-
'enter-from-below <=> hide, ' +
|
|
696
|
-
'pan-hidden => hide, ' +
|
|
697
|
-
'pan-hidden => enter', animate(easeOut)),
|
|
698
|
-
transition(
|
|
699
|
-
// Jump straight onto the stage, from the orchestra pit.
|
|
700
|
-
// Excitement fills the air. Spotlight. Showtime.
|
|
701
|
-
'void => enter-from-below', sequence([
|
|
702
|
-
animate(teleport, inTheOrchestraPit),
|
|
703
|
-
animate(easeOut, onStage),
|
|
704
|
-
])),
|
|
705
|
-
transition(
|
|
706
|
-
// Go stand in the curtains, then make a grand entrance from the side
|
|
707
|
-
'void => enter', sequence([animate(teleport, awaitingCue), animate(easeOut, onStage)])),
|
|
708
|
-
transition(
|
|
709
|
-
// Get off the stage, back into the curtains on the side
|
|
710
|
-
'enter => void', animate(easeOut, awaitingCue)),
|
|
711
|
-
transition(
|
|
712
|
-
// Take the side stairs down from the stage
|
|
713
|
-
'hide => below', animate(linear, retired)),
|
|
714
|
-
transition(
|
|
715
|
-
// Wait for a bit, then take the side stairs down from the stage
|
|
716
|
-
'hide => below-with-delay', sequence([animate(teleport, retired), animate(linearDelayed, retired)])),
|
|
717
|
-
transition(
|
|
718
|
-
// Stage dive into the orchestra pit
|
|
719
|
-
'enter => below, enter-from-below => below', sequence([animate(teleport, onStage), animate(linear, inTheOrchestraPit)])),
|
|
720
|
-
transition(
|
|
721
|
-
// Receive the standing ovations, then stage dive into the orchestra pit
|
|
722
|
-
'enter => below-with-delay, enter-from-below => below-with-delay', sequence([
|
|
723
|
-
animate(teleport, onStage),
|
|
724
|
-
animate(linearDelayed, inTheOrchestraPit),
|
|
725
|
-
])),
|
|
726
|
-
]),
|
|
727
|
-
transformCloseButton: trigger('transformCloseButton', [
|
|
728
|
-
state('void, below, below-with-delay', onStageHidden),
|
|
729
|
-
state('enter, enter-from-below, pan-hidden, pan, hide', onStage),
|
|
730
|
-
transition('void => enter-from-below', sequence([
|
|
731
|
-
animate(teleport, onStageHidden),
|
|
732
|
-
animate(getEaseLinear(50, defaultDuration / 2), onStage),
|
|
733
|
-
])),
|
|
734
|
-
transition('enter => below, enter-from-below => below', sequence([
|
|
735
|
-
animate(teleport, onStage),
|
|
736
|
-
animate(getEaseLinear(25), onStageHidden),
|
|
737
|
-
])),
|
|
738
|
-
transition('enter => below-with-delay, enter-from-below => below-with-delay', sequence([
|
|
739
|
-
animate(teleport, onStage),
|
|
740
|
-
animate(getEaseLinear(50, defaultDelay), onStageHidden),
|
|
741
|
-
])),
|
|
742
|
-
]),
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
/**
|
|
746
|
-
* @license
|
|
747
|
-
* Copyright Google LLC All Rights Reserved.
|
|
748
|
-
*
|
|
749
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
750
|
-
* found in the LICENSE file at https://angular.io/license
|
|
751
|
-
*/
|
|
752
|
-
/**
|
|
753
|
-
* Throws an exception for the case when menu trigger doesn't have a valid granite-menu instance
|
|
754
|
-
* @docs-private
|
|
755
|
-
*/
|
|
756
|
-
function throwGraniteMenuMissingError() {
|
|
757
|
-
throw Error(`graniteMenuTriggerFor: must pass in an granite-menu instance.
|
|
758
|
-
|
|
759
|
-
Example:
|
|
760
|
-
<granite-menu #menu="graniteMenu"></granite-menu>
|
|
761
|
-
<button [graniteMenuTriggerFor]="menu"></button>`);
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Throws an exception for the case when menu's x-position value isn't valid.
|
|
765
|
-
* In other words, it doesn't match 'before' or 'after'.
|
|
766
|
-
* @docs-private
|
|
767
|
-
*/
|
|
768
|
-
function throwGraniteMenuInvalidPositionX() {
|
|
769
|
-
throw Error(`xPosition value must be either 'before' or after'.
|
|
770
|
-
Example: <granite-menu xPosition="before" #menu="graniteMenu"></granite-menu>`);
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Throws an exception for the case when menu's y-position value isn't valid.
|
|
774
|
-
* In other words, it doesn't match 'above' or 'below'.
|
|
775
|
-
* @docs-private
|
|
776
|
-
*/
|
|
777
|
-
function throwGraniteMenuInvalidPositionY() {
|
|
778
|
-
throw Error(`yPosition value must be either 'above' or below'.
|
|
779
|
-
Example: <granite-menu yPosition="above" #menu="graniteMenu"></granite-menu>`);
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
/** Counter for panel ID generation */
|
|
783
|
-
let menuPanelUid = 0;
|
|
784
|
-
/** Menu panel animation default transform values */
|
|
785
|
-
const transformMenuDefault = {
|
|
786
|
-
value: 'void',
|
|
787
|
-
params: {
|
|
788
|
-
xOffset: 0,
|
|
789
|
-
},
|
|
790
|
-
};
|
|
791
|
-
/** Base class with all of the menu functionality. */
|
|
792
|
-
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
793
|
-
class _MenuBaseComponent {
|
|
794
|
-
constructor(_changeDetectorRef) {
|
|
795
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
796
|
-
this.openOnHover = true;
|
|
797
|
-
/**
|
|
798
|
-
* Event emitted when the menu is closed
|
|
799
|
-
*/
|
|
800
|
-
this.closed = new EventEmitter();
|
|
801
|
-
/**
|
|
802
|
-
* Used for locating the panel in tests and setting the aria-control attribute
|
|
803
|
-
* for the menu trigger.
|
|
804
|
-
*/
|
|
805
|
-
this.panelId = `granite-menu-panel-${menuPanelUid++}`;
|
|
806
|
-
/** Whether to show back button in touch menu title bar */
|
|
807
|
-
this.showBackButton = false;
|
|
808
|
-
/** Whether to show touch menu title bar */
|
|
809
|
-
this.showTitle = false;
|
|
810
|
-
/** Whether to add a close button below the menu */
|
|
811
|
-
this.showCloseButton = false;
|
|
812
|
-
/** Observable current state of the panel animation. */
|
|
813
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
814
|
-
this._transformMenu = new BehaviorSubject(transformMenuDefault);
|
|
815
|
-
/** Emits whenever an animation on the menu completes. */
|
|
816
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
817
|
-
this._animationDone = new Subject();
|
|
818
|
-
this._menuEmpty$ = new BehaviorSubject(false);
|
|
819
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
820
|
-
this._isMenuEmpty$ = combineLatest([
|
|
821
|
-
this._menuEmpty$,
|
|
822
|
-
this._animationDone,
|
|
823
|
-
]).pipe(filter(([m, a]) => m && a != null), map(() => true));
|
|
824
|
-
/** Only the direct descendant menu items. */
|
|
825
|
-
this._directDescendantItems = new QueryList();
|
|
826
|
-
/** Subscription to tab events on the menu panel */
|
|
827
|
-
this._tabSubscription = Subscription.EMPTY;
|
|
828
|
-
this._xPosition = 'after';
|
|
829
|
-
this._yPosition = 'below';
|
|
830
|
-
/**
|
|
831
|
-
* Current horizontal offset. Used with `pan` and `pan-hidden`
|
|
832
|
-
* animation states.
|
|
833
|
-
*/
|
|
834
|
-
this.xOffset = 0;
|
|
835
|
-
}
|
|
836
|
-
/** Position of the menu in the X axis. */
|
|
837
|
-
get xPosition() {
|
|
838
|
-
return this._xPosition;
|
|
839
|
-
}
|
|
840
|
-
set xPosition(value) {
|
|
841
|
-
if (value !== 'before' && value !== 'after') {
|
|
842
|
-
throwGraniteMenuInvalidPositionX();
|
|
843
|
-
}
|
|
844
|
-
this._xPosition = value;
|
|
845
|
-
}
|
|
846
|
-
/** Position of the menu in the Y axis. */
|
|
847
|
-
get yPosition() {
|
|
848
|
-
return this._yPosition;
|
|
849
|
-
}
|
|
850
|
-
set yPosition(value) {
|
|
851
|
-
if (value !== 'above' && value !== 'below') {
|
|
852
|
-
throwGraniteMenuInvalidPositionY();
|
|
853
|
-
}
|
|
854
|
-
this._yPosition = value;
|
|
855
|
-
}
|
|
856
|
-
/** Current state of the panel animation. */
|
|
857
|
-
set _panelAnimationState(state) {
|
|
858
|
-
this._transformMenu.next({
|
|
859
|
-
value: state,
|
|
860
|
-
params: { xOffset: this.xOffset },
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
ngAfterContentChecked() {
|
|
864
|
-
this._menuEmpty$.next(this._allItems.length < 1 ? true : false);
|
|
865
|
-
}
|
|
866
|
-
ngAfterContentInit() {
|
|
867
|
-
this._updateDirectDescendants();
|
|
868
|
-
this._keyManager = new FocusKeyManager(this._directDescendantItems)
|
|
869
|
-
.withWrap()
|
|
870
|
-
.skipPredicate((menuItem) => {
|
|
871
|
-
const hostElement = menuItem._getHostElement();
|
|
872
|
-
return hostElement instanceof HTMLButtonElement
|
|
873
|
-
? hostElement.disabled
|
|
874
|
-
: hostElement.hasAttribute('graniteTitle');
|
|
875
|
-
});
|
|
876
|
-
this._tabSubscription = this._keyManager.tabOut.subscribe(() => {
|
|
877
|
-
this.closed.emit('tab');
|
|
878
|
-
});
|
|
879
|
-
// If a user manually (programatically) focuses a menu item, we need to reflect that focus
|
|
880
|
-
// change back to the key manager. Note that we don't need to unsubscribe here because _focused
|
|
881
|
-
// is internal and we know that it gets completed on destroy.
|
|
882
|
-
this._directDescendantItems.changes
|
|
883
|
-
.pipe(startWith(this._directDescendantItems), switchMap((items) => merge(...items.map((item) => item._focused))))
|
|
884
|
-
.subscribe((focusedItem) => this._keyManager.updateActiveItem(focusedItem));
|
|
885
|
-
}
|
|
886
|
-
ngOnDestroy() {
|
|
887
|
-
this._directDescendantItems.destroy();
|
|
888
|
-
this._tabSubscription.unsubscribe();
|
|
889
|
-
this.closed.complete();
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Stream that combines the `_hovered` observables of all the menu's items
|
|
893
|
-
* into a single observable. Emits whenever the hovered menu item changes.
|
|
894
|
-
*/
|
|
895
|
-
_hovered() {
|
|
896
|
-
// Coerce the `changes` property because Angular types it as `Observable<any>`
|
|
897
|
-
const itemChanges = this._directDescendantItems.changes;
|
|
898
|
-
return itemChanges.pipe(startWith(this._directDescendantItems),
|
|
899
|
-
// Hovering is not applicable when producing touch output
|
|
900
|
-
filter(() => {
|
|
901
|
-
var _a;
|
|
902
|
-
return ((_a = this._clientOutput) === null || _a === void 0 ? void 0 : _a.device) !== 'touch';
|
|
903
|
-
}), switchMap((items) => merge(...items.map((item) => item._hovered))));
|
|
904
|
-
}
|
|
905
|
-
/** Handle a keyboard event from the menu, delegating to the appropriate action. */
|
|
906
|
-
_handleKeydown(event) {
|
|
907
|
-
const key = event.key;
|
|
908
|
-
const manager = this._keyManager;
|
|
909
|
-
switch (key) {
|
|
910
|
-
case 'Escape':
|
|
911
|
-
if (!hasModifierKey(event)) {
|
|
912
|
-
event.preventDefault();
|
|
913
|
-
this.closed.emit('keydown');
|
|
914
|
-
}
|
|
915
|
-
break;
|
|
916
|
-
case 'ArrowLeft':
|
|
917
|
-
if (this.parentMenu && this.direction === 'ltr') {
|
|
918
|
-
this.closed.emit('keydown');
|
|
919
|
-
}
|
|
920
|
-
break;
|
|
921
|
-
case 'ArrowRight':
|
|
922
|
-
if (this.parentMenu && this.direction === 'rtl') {
|
|
923
|
-
this.closed.emit('keydown');
|
|
924
|
-
}
|
|
925
|
-
break;
|
|
926
|
-
case 'Home':
|
|
927
|
-
case 'End':
|
|
928
|
-
if (!hasModifierKey(event)) {
|
|
929
|
-
key === 'Home'
|
|
930
|
-
? manager.setFirstItemActive()
|
|
931
|
-
: manager.setLastItemActive();
|
|
932
|
-
event.preventDefault();
|
|
933
|
-
}
|
|
934
|
-
break;
|
|
935
|
-
default:
|
|
936
|
-
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
937
|
-
manager.setFocusOrigin('keyboard');
|
|
938
|
-
}
|
|
939
|
-
manager.onKeydown(event);
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
/**
|
|
943
|
-
* Focus the first item in the menu.
|
|
944
|
-
* @param origin Action from which the focus originated. Used to set the correct styling.
|
|
945
|
-
*/
|
|
946
|
-
focusFirstItem(origin = 'program') {
|
|
947
|
-
this._keyManager.setFocusOrigin(origin).setFirstItemActive();
|
|
948
|
-
}
|
|
949
|
-
/** Updates the `showTitle` property for touch device UI */
|
|
950
|
-
_updateShowTitle() {
|
|
951
|
-
this.showTitle = !!this.title || this.showBackButton;
|
|
952
|
-
}
|
|
953
|
-
/** Starts the enter animation */
|
|
954
|
-
_startAnimation() {
|
|
955
|
-
this._panelAnimationState = 'enter';
|
|
956
|
-
}
|
|
957
|
-
/** Resets the panel animation to its initial state. */
|
|
958
|
-
_resetAnimation() {
|
|
959
|
-
this._panelAnimationState = 'void';
|
|
960
|
-
}
|
|
961
|
-
/**
|
|
962
|
-
* Starts the 'below' animation, moving a menu down, out of view below the
|
|
963
|
-
* viewport. Used to close the whole menu, for example when clicking
|
|
964
|
-
* the backdrop.
|
|
965
|
-
*/
|
|
966
|
-
_startTouchCloseDownAnimation() {
|
|
967
|
-
this._panelAnimationState = 'below';
|
|
968
|
-
}
|
|
969
|
-
/**
|
|
970
|
-
* Starts the 'below-with-delay' animation, moving a menu down, out of view below the
|
|
971
|
-
* viewport. Used to close the whole menu as a response to the user tapping
|
|
972
|
-
* a menu item. There is a short delay before the animation starts, to that
|
|
973
|
-
* the user gets a visual feedback on what item was selected.
|
|
974
|
-
*/
|
|
975
|
-
_startTouchCloseDownAnimationWithDelay() {
|
|
976
|
-
this._panelAnimationState = 'below-with-delay';
|
|
977
|
-
}
|
|
978
|
-
/**
|
|
979
|
-
* Starts the 'void' animation, moving a (sub) menu out of view to the side
|
|
980
|
-
* of the viewport. Used when going "back" from a sub menu.
|
|
981
|
-
*/
|
|
982
|
-
_startTouchCloseSideAnimation() {
|
|
983
|
-
this._resetAnimation();
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* Starts the enter-from-below animation, moving a (root) menu into view,
|
|
987
|
-
* Animates upwards from a starting position below the viewport.
|
|
988
|
-
*/
|
|
989
|
-
_startTouchRootEnterAnimation() {
|
|
990
|
-
this._panelAnimationState = 'enter-from-below';
|
|
991
|
-
this.xOffset = 0;
|
|
992
|
-
}
|
|
993
|
-
/** Starts the enter animation, moving a (sub) menu into view. */
|
|
994
|
-
_startTouchSubmenuEnterAnimation() {
|
|
995
|
-
this._panelAnimationState = 'enter';
|
|
996
|
-
this.xOffset = 0;
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Starts the pan animation, to position a submenu in a response
|
|
1000
|
-
* to user dragging sideways (panning).
|
|
1001
|
-
*/
|
|
1002
|
-
_startTouchPanAnimation(xOffset) {
|
|
1003
|
-
this._panelAnimationState = 'pan';
|
|
1004
|
-
this.xOffset = xOffset;
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Starts the pan-hidden animation, to position a parent menu next to an
|
|
1008
|
-
* active submenu that the user is dragging sideways (panning).
|
|
1009
|
-
*/
|
|
1010
|
-
_startTouchHidePanAnimation(xOffset) {
|
|
1011
|
-
this._panelAnimationState = 'pan-hidden';
|
|
1012
|
-
this.xOffset = xOffset;
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Starts the hide animation, to make a parent menu slide out to leave
|
|
1016
|
-
* space for a submenu.
|
|
1017
|
-
*/
|
|
1018
|
-
_startTouchHideAnimation() {
|
|
1019
|
-
this._panelAnimationState = 'hide';
|
|
1020
|
-
this.xOffset = 0;
|
|
1021
|
-
}
|
|
1022
|
-
/** Callback that is invoked when the panel animation completes. */
|
|
1023
|
-
_onAnimationDone(event) {
|
|
1024
|
-
this._animationDone.next(event);
|
|
1025
|
-
this._isAnimating = false;
|
|
1026
|
-
}
|
|
1027
|
-
_onAnimationStart(event) {
|
|
1028
|
-
this._isAnimating = true;
|
|
1029
|
-
// Scroll the content element to the top as soon as the animation starts. This is necessary,
|
|
1030
|
-
// because we move focus to the first item while it's still being animated, which can throw
|
|
1031
|
-
// the browser off when it determines the scroll position. Alternatively we can move focus
|
|
1032
|
-
// when the animation is done, however moving focus asynchronously will interrupt screen
|
|
1033
|
-
// readers which are in the process of reading out the menu already. We take the `element`
|
|
1034
|
-
// from the `event` since we can't use a `ViewChild` to access the pane.
|
|
1035
|
-
if ((event.toState === 'enter' || event.toState === 'enter-from-below') &&
|
|
1036
|
-
this._keyManager.activeItemIndex === 0) {
|
|
1037
|
-
event.element.scrollTop = 0;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Handle click on the menu by emitting on the `closed` emitter
|
|
1042
|
-
* with a `click` reason
|
|
1043
|
-
*/
|
|
1044
|
-
_handleClick() {
|
|
1045
|
-
this.closed.emit('click');
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Handle click on the close button by emitting on the `closed` emitter
|
|
1049
|
-
* without any particular reason
|
|
1050
|
-
*/
|
|
1051
|
-
_handleCloseClick() {
|
|
1052
|
-
this.closed.emit();
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* Handle click on the back icon by emitting on the `clicked` emitter
|
|
1056
|
-
*/
|
|
1057
|
-
_handleBackClick(e) {
|
|
1058
|
-
if (this.showBackButton) {
|
|
1059
|
-
// Close submenu keydown-style: close only this menu and leave parents open
|
|
1060
|
-
this.closed.emit('keydown');
|
|
1061
|
-
}
|
|
1062
|
-
e.stopPropagation();
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* Update client device information for the menu and its menu items.
|
|
1066
|
-
*/
|
|
1067
|
-
_setDevice(clientInput, clientOutput) {
|
|
1068
|
-
this._clientInput = clientInput;
|
|
1069
|
-
this._clientOutput = clientOutput;
|
|
1070
|
-
this._directDescendantItems.forEach((item) => {
|
|
1071
|
-
item._clientInput = clientInput;
|
|
1072
|
-
item._clientOutput = clientOutput;
|
|
1073
|
-
});
|
|
1074
|
-
this._changeDetectorRef.markForCheck();
|
|
1075
|
-
}
|
|
1076
|
-
/**
|
|
1077
|
-
* Resets the active item in the menu. This is used when the menu is opened, allowing
|
|
1078
|
-
* the user to start from the first option when pressing the down arrow.
|
|
1079
|
-
*/
|
|
1080
|
-
resetActiveItem() {
|
|
1081
|
-
this._keyManager.setActiveItem(-1);
|
|
1082
|
-
}
|
|
1083
|
-
/**
|
|
1084
|
-
* Sets up a stream that will keep track of any newly-added menu items and will update the list
|
|
1085
|
-
* of direct descendants. We collect the descendants this way, because `_allItems` can include
|
|
1086
|
-
* items that are part of child menus, and using a custom way of registering items is unreliable
|
|
1087
|
-
* when it comes to maintaining the item order.
|
|
1088
|
-
*/
|
|
1089
|
-
_updateDirectDescendants() {
|
|
1090
|
-
this._allItems.changes
|
|
1091
|
-
.pipe(startWith(this._allItems))
|
|
1092
|
-
.subscribe((items) => {
|
|
1093
|
-
this._directDescendantItems.reset(items.filter((item) => item._parentMenu === this));
|
|
1094
|
-
this._directDescendantItems.notifyOnChanges();
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
_MenuBaseComponent.decorators = [
|
|
1099
|
-
{ type: Directive }
|
|
1100
|
-
];
|
|
1101
|
-
_MenuBaseComponent.ctorParameters = () => [
|
|
1102
|
-
{ type: ChangeDetectorRef }
|
|
1103
|
-
];
|
|
1104
|
-
_MenuBaseComponent.propDecorators = {
|
|
1105
|
-
xPosition: [{ type: Input }],
|
|
1106
|
-
yPosition: [{ type: Input }],
|
|
1107
|
-
title: [{ type: Input }],
|
|
1108
|
-
closeLabel: [{ type: Input }],
|
|
1109
|
-
openOnHover: [{ type: Input }],
|
|
1110
|
-
templateRef: [{ type: ViewChild, args: [TemplateRef,] }],
|
|
1111
|
-
_allItems: [{ type: ContentChildren, args: [GraniteMenuItemComponent, { descendants: true },] }],
|
|
1112
|
-
closed: [{ type: Output }]
|
|
1113
|
-
};
|
|
1114
|
-
class GraniteMenuComponent extends _MenuBaseComponent {
|
|
1115
|
-
}
|
|
1116
|
-
GraniteMenuComponent.decorators = [
|
|
1117
|
-
{ type: Component, args: [{
|
|
1118
|
-
selector: 'granite-menu',
|
|
1119
|
-
template: "<!--\n Using separate template part for desktop and touch output, because of\n animation triggers and slightly different content.\n-->\n<ng-template>\n <!-- Desktop -->\n <ng-container *ngIf=\"_clientOutput.device === 'desktop'\">\n <div\n #menu\n class=\"granite-menu\"\n [class.is-menu-empty]=\"_isMenuEmpty$ | async\"\n tabindex=\"-1\"\n [id]=\"panelId\"\n [@transformMenuDesktop]=\"_transformMenu | async\"\n (@transformMenuDesktop.start)=\"_onAnimationStart($event)\"\n (@transformMenuDesktop.done)=\"_onAnimationDone($event)\"\n (click)=\"_handleClick()\"\n (keydown)=\"_handleKeydown($event)\"\n >\n <div class=\"granite-menu-content\">\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n </div>\n </div>\n </ng-container>\n\n <!-- Touch -->\n <ng-container *ngIf=\"_clientOutput?.device === 'touch'\">\n <div\n #menu\n class=\"granite-menu granite-device-output-touch\"\n tabindex=\"-1\"\n [id]=\"panelId\"\n [@transformMenuTouch]=\"_transformMenu | async\"\n (@transformMenuTouch.start)=\"_onAnimationStart($event)\"\n (@transformMenuTouch.done)=\"_onAnimationDone($event)\"\n (click)=\"_handleClick()\"\n (keydown)=\"_handleKeydown($event)\"\n >\n <div class=\"granite-menu-content\">\n <div *ngIf=\"showTitle\" class=\"header-container\">\n <button\n [disabled]=\"!showBackButton\"\n graniteMenuTouchTitleItem\n (click)=\"_handleBackClick($event)\"\n >\n {{ title }}\n </button>\n </div>\n\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n\n <div class=\"footer-container\"></div>\n </div>\n </div>\n\n <!-- Close button -->\n <div class=\"close\" [@transformCloseButton]=\"_transformMenu | async\">\n <button\n *ngIf=\"showCloseButton\"\n graniteMenuTouchCloseItem\n (click)=\"_handleCloseClick()\"\n >\n {{ closeLabel }}\n </button>\n </div>\n </ng-container>\n\n <!--\n Content template shared between desktop and touch parts, as <ng-content>\n can't be used in two places in the same template\n -->\n <ng-template #content>\n <ng-content></ng-content>\n </ng-template>\n</ng-template>\n",
|
|
1120
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1121
|
-
exportAs: 'graniteMenu',
|
|
1122
|
-
animations: [
|
|
1123
|
-
graniteMenuDesktopAnimations.transformMenuDesktop,
|
|
1124
|
-
graniteMenuTouchAnimations.transformMenuTouch,
|
|
1125
|
-
graniteMenuTouchAnimations.transformCloseButton,
|
|
1126
|
-
],
|
|
1127
|
-
providers: [
|
|
1128
|
-
{ provide: GRANITE_MENU_PANEL, useExisting: GraniteMenuComponent },
|
|
1129
|
-
],
|
|
1130
|
-
styles: [".granite-menu:not(.granite-device-output-touch){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 2rem);outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;filter:drop-shadow(var(--granite-shadow-l));min-width:7rem;overflow-x:hidden;overflow-y:hidden}.granite-menu:not(.granite-device-output-touch).ng-animating{pointer-events:none}.granite-menu:not(.granite-device-output-touch):not(.is-menu-empty){min-height:2rem}.granite-menu:not(.granite-device-output-touch):hover{overflow-y:auto}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar{width:var(--granite-spacing-xs)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-thumb{background-color:var(--granite-color-border-hard);border-radius:calc(var(--granite-spacing-m) * .125)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-track{background-color:var(--granite-color-background-hover)}.granite-menu.granite-device-output-touch{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 2rem);outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;filter:drop-shadow(var(--granite-shadow-l));border-radius:.25rem;max-height:calc(100% - ($granite-base-rem * 7))}.granite-menu.granite-device-output-touch.ng-animating{pointer-events:none}.granite-menu.granite-device-output-touch:not(.is-menu-empty){min-height:3rem}.granite-menu.granite-device-output-touch:not(.close){margin:var(--granite-spacing-xs)}.granite-menu.granite-device-output-touch.close{-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs)}.granite-menu.granite-device-output-touch .header-container{position:-webkit-sticky;position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{position:-webkit-sticky;position:sticky;bottom:0;height:0}.close:not(:empty){background-color:var(--granite-color-background-variant);color:var(--granite-color-text);overflow:auto;-webkit-overflow-scrolling:touch;max-height:calc(100vh - 2rem);outline:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;filter:drop-shadow(var(--granite-shadow-l));border-radius:.25rem}.close:not(:empty).ng-animating{pointer-events:none}.close:not(:empty):not(.is-menu-empty){min-height:3rem}.close:not(:empty):not(.close){margin:var(--granite-spacing-xs)}.close:not(:empty).close{-webkit-margin-start:var(--granite-spacing-xs);margin-inline-start:var(--granite-spacing-xs);-webkit-margin-end:var(--granite-spacing-xs);margin-inline-end:var(--granite-spacing-xs);-webkit-margin-after:var(--granite-spacing-xs);margin-block-end:var(--granite-spacing-xs)}"]
|
|
1131
|
-
},] }
|
|
1132
|
-
];
|
|
1133
|
-
|
|
1134
|
-
/**
|
|
1135
|
-
* Injection token used to provide components knowledge of what device types
|
|
1136
|
-
* are being used for input.
|
|
1137
|
-
*/
|
|
1138
|
-
const GRANITE_CLIENT_INPUT = new InjectionToken('GRANITE_CLIENT_INPUT');
|
|
1139
|
-
/**
|
|
1140
|
-
* Injection token used to provide components knowledge of what device type
|
|
1141
|
-
* is being used for output.
|
|
1142
|
-
*/
|
|
1143
|
-
const GRANITE_CLIENT_OUTPUT = new InjectionToken('GRANITE_CLIENT_OUTPUT');
|
|
1144
|
-
const deviceDesktop = {
|
|
1145
|
-
input: { devices: ['mouse', 'keyboard'] },
|
|
1146
|
-
output: { device: 'desktop' },
|
|
1147
|
-
};
|
|
1148
|
-
const deviceTouch = {
|
|
1149
|
-
input: { devices: ['touch', 'onscreen-keyboard'] },
|
|
1150
|
-
output: { device: 'touch' },
|
|
1151
|
-
};
|
|
1152
|
-
|
|
1153
|
-
/** Options for binding a passive event listener. */
|
|
1154
|
-
const passiveEventListenerOptions = normalizePassiveListenerOptions({
|
|
1155
|
-
passive: true,
|
|
1156
|
-
});
|
|
1157
|
-
//#endregion --- Touch device customizations ---
|
|
1158
|
-
/**
|
|
1159
|
-
* Directive used to turn a button element into a (popup) menu trigger
|
|
1160
|
-
*
|
|
1161
|
-
* Stripped-down version of Angular Material's menu trigger directive (.../menu/menu-trigger.ts)
|
|
1162
|
-
*/
|
|
1163
|
-
class GraniteMenuTriggerForDirective {
|
|
1164
|
-
constructor(_overlay, _element, _viewContainerRef,
|
|
1165
|
-
/** If this is a _submenu_ trigger, it will have a parent menu */
|
|
1166
|
-
_parentMenu,
|
|
1167
|
-
//#region --- Touch device customizations ---
|
|
1168
|
-
/** Client input device information */
|
|
1169
|
-
_clientInput,
|
|
1170
|
-
/** Client output device information */
|
|
1171
|
-
_clientOutput,
|
|
1172
|
-
//#endregion --- Touch device customizations ---
|
|
1173
|
-
/**
|
|
1174
|
-
* If this is a _submenu_ trigger, there should be a corresponding menu
|
|
1175
|
-
* item directive present as well:
|
|
1176
|
-
*
|
|
1177
|
-
* <button graniteMenuItem [graniteMenuTriggerFor]="...">
|
|
1178
|
-
* ^-- This one
|
|
1179
|
-
*/
|
|
1180
|
-
_menuItemInstance, _dir, _focusMonitor,
|
|
1181
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1182
|
-
document) {
|
|
1183
|
-
this._overlay = _overlay;
|
|
1184
|
-
this._element = _element;
|
|
1185
|
-
this._viewContainerRef = _viewContainerRef;
|
|
1186
|
-
this._parentMenu = _parentMenu;
|
|
1187
|
-
this._clientInput = _clientInput;
|
|
1188
|
-
this._clientOutput = _clientOutput;
|
|
1189
|
-
this._menuItemInstance = _menuItemInstance;
|
|
1190
|
-
this._dir = _dir;
|
|
1191
|
-
this._focusMonitor = _focusMonitor;
|
|
1192
|
-
/** Whether the associated menu is open */
|
|
1193
|
-
this._isMenuOpen = false;
|
|
1194
|
-
// Tracking input type is necessary so it's possible to only auto-focus
|
|
1195
|
-
// the first item of the list when the menu is opened via the keyboard
|
|
1196
|
-
this._openedBy = null;
|
|
1197
|
-
this._hoverSubscription = Subscription.EMPTY;
|
|
1198
|
-
this._menuCloseSubscription = Subscription.EMPTY;
|
|
1199
|
-
this._closingActionsSubscription = Subscription.EMPTY;
|
|
1200
|
-
this._portal = null;
|
|
1201
|
-
this._overlayRef = null;
|
|
1202
|
-
this._touchTouchingElement = false;
|
|
1203
|
-
/**
|
|
1204
|
-
* Handles touch start events on the trigger.
|
|
1205
|
-
* Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
|
|
1206
|
-
*/
|
|
1207
|
-
this._handleTouchStart = () => {
|
|
1208
|
-
this._openedBy = 'touch';
|
|
1209
|
-
};
|
|
1210
|
-
// ----------------------------------------- //
|
|
1211
|
-
// --- Here be poor man's touch gestures --- //
|
|
1212
|
-
// ----------------------------------------- //
|
|
1213
|
-
// TODO: Replace with Hammer or other gesture library
|
|
1214
|
-
/**
|
|
1215
|
-
* Handles touch start events on the overlay host element (wrapper).
|
|
1216
|
-
* Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
|
|
1217
|
-
*/
|
|
1218
|
-
this._handleOverlayTouchStart = (event) => {
|
|
1219
|
-
if (this.menu._isAnimating) {
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
this._touchStartTime = new Date().getTime();
|
|
1223
|
-
this._touchStartX = event.changedTouches[0].clientX;
|
|
1224
|
-
this._touchStartY = event.changedTouches[0].clientY;
|
|
1225
|
-
this._touchCurrentX = this._touchStartX;
|
|
1226
|
-
this._touchCurrentY = this._touchStartY;
|
|
1227
|
-
this._touchTranslateX = 0;
|
|
1228
|
-
this._touchMaxX = this._overlayRef.hostElement.getBoundingClientRect().width;
|
|
1229
|
-
this._touchLockedX = null;
|
|
1230
|
-
this._touchTouchingElement = true;
|
|
1231
|
-
};
|
|
1232
|
-
this._handleOverlayTouchMove = (event) => {
|
|
1233
|
-
if (!this._touchTouchingElement || this.menu._isAnimating) {
|
|
1234
|
-
return;
|
|
1235
|
-
}
|
|
1236
|
-
if (this._touchLockedX) {
|
|
1237
|
-
return;
|
|
1238
|
-
}
|
|
1239
|
-
this._touchCurrentX = event.changedTouches[0].clientX;
|
|
1240
|
-
this._touchCurrentY = event.changedTouches[0].clientY;
|
|
1241
|
-
// Lock X-axis pan if initiating pan on Y-axis
|
|
1242
|
-
if (this._touchLockedX === null) {
|
|
1243
|
-
const dy = Math.abs(this._touchCurrentY - this._touchStartY);
|
|
1244
|
-
const dx = Math.abs(this._touchCurrentX - this._touchStartX);
|
|
1245
|
-
if (dx > 10 || dy > 10) {
|
|
1246
|
-
this._touchLockedX = dy > dx;
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
// Restrict to right pan/swipe and make menu movement extremely slow when
|
|
1251
|
-
// moved past allowed limits.
|
|
1252
|
-
const menuMargin = 16;
|
|
1253
|
-
this._touchTranslateX = this._touchCurrentX - this._touchStartX;
|
|
1254
|
-
if (this._touchTranslateX < 0) {
|
|
1255
|
-
this._touchTranslateX = this.easeOutExpo(this._touchTranslateX, 0, -menuMargin / 2, this._touchMaxX * -4);
|
|
1256
|
-
}
|
|
1257
|
-
else if (!this._parentMenu) {
|
|
1258
|
-
this._touchTranslateX = this.easeOutExpo(this._touchTranslateX, 0, menuMargin / 2, this._touchMaxX * 4);
|
|
1259
|
-
}
|
|
1260
|
-
else if (this._touchTranslateX > this._touchMaxX) {
|
|
1261
|
-
this._touchTranslateX = this.easeOutExpo(this._touchTranslateX - this._touchMaxX, this._touchMaxX, menuMargin / 2, this._touchMaxX * 4);
|
|
1262
|
-
}
|
|
1263
|
-
// Set new sub menu position and tell any parent to follow;
|
|
1264
|
-
this.animateSetMenuPosition(this._touchTranslateX);
|
|
1265
|
-
};
|
|
1266
|
-
this._handleOverlayTouchEnd = () => {
|
|
1267
|
-
if (!this._touchTouchingElement || this.menu._isAnimating) {
|
|
1268
|
-
return;
|
|
1269
|
-
}
|
|
1270
|
-
this._touchTranslateX = this._touchCurrentX - this._touchStartX;
|
|
1271
|
-
if (this._touchTranslateX === 0) {
|
|
1272
|
-
return;
|
|
1273
|
-
}
|
|
1274
|
-
this._touchTouchingElement = false;
|
|
1275
|
-
this._touchTimeTaken = new Date().getTime() - this._touchStartTime;
|
|
1276
|
-
const swipeMinDistance = 10;
|
|
1277
|
-
const swipeMinTime = 50;
|
|
1278
|
-
const swipeMaxTime = 300;
|
|
1279
|
-
const pannedHalfwayRight = this._touchTranslateX > this._touchMaxX / 2;
|
|
1280
|
-
const swipedRight = this._touchTranslateX > this._touchMaxX / swipeMinDistance &&
|
|
1281
|
-
this._touchTimeTaken > swipeMinTime &&
|
|
1282
|
-
this._touchTimeTaken < swipeMaxTime;
|
|
1283
|
-
if (!!this._parentMenu && (swipedRight || pannedHalfwayRight)) {
|
|
1284
|
-
// Close submenu keydown-style: close only this menu and leave parents open
|
|
1285
|
-
this.menu.closed.emit('keydown');
|
|
1286
|
-
}
|
|
1287
|
-
else {
|
|
1288
|
-
// Pan ended but the menu was not moved far enough. Reset menus to
|
|
1289
|
-
// where they were before panning stared.
|
|
1290
|
-
this.animateOpenMenu();
|
|
1291
|
-
}
|
|
1292
|
-
};
|
|
1293
|
-
_element.nativeElement.addEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
|
|
1294
|
-
if (_menuItemInstance) {
|
|
1295
|
-
_menuItemInstance._triggersSubmenu = this.triggersSubmenu();
|
|
1296
|
-
}
|
|
1297
|
-
this._document = document;
|
|
1298
|
-
}
|
|
1299
|
-
ngOnChanges(changes) {
|
|
1300
|
-
if (changes.menu) {
|
|
1301
|
-
this._handleMenuChange();
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
ngAfterContentInit() {
|
|
1305
|
-
// removed checkMenu here to avoid errors in dynamically genarated menus
|
|
1306
|
-
// menu is checked when opening the menu
|
|
1307
|
-
// this._checkMenu();
|
|
1308
|
-
this._handleHover();
|
|
1309
|
-
}
|
|
1310
|
-
ngOnDestroy() {
|
|
1311
|
-
if (this._overlayRef) {
|
|
1312
|
-
//#region --- Touch device customizations ---
|
|
1313
|
-
this.removeOverlayListeners();
|
|
1314
|
-
//#endregion --- Touch device customizations ---
|
|
1315
|
-
this._overlayRef.dispose();
|
|
1316
|
-
this._overlayRef = null;
|
|
1317
|
-
}
|
|
1318
|
-
this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
|
|
1319
|
-
this._hoverSubscription.unsubscribe();
|
|
1320
|
-
this._menuCloseSubscription.unsubscribe();
|
|
1321
|
-
this._closingActionsSubscription.unsubscribe();
|
|
1322
|
-
}
|
|
1323
|
-
/** Handles change of associated menu */
|
|
1324
|
-
_handleMenuChange() {
|
|
1325
|
-
this._menuCloseSubscription.unsubscribe();
|
|
1326
|
-
// Close the menu overlay when the menu itself says it wants to be closed
|
|
1327
|
-
if (this.menu) {
|
|
1328
|
-
const closed = this.menu.closed;
|
|
1329
|
-
this._menuCloseSubscription = closed.subscribe((reason) => {
|
|
1330
|
-
//#region --- Touch device customizations ---
|
|
1331
|
-
if (this.menu._isClosing) {
|
|
1332
|
-
return;
|
|
1333
|
-
}
|
|
1334
|
-
this.menu._isClosing = true;
|
|
1335
|
-
// Get rid of the menu and tell any parent to restore its position
|
|
1336
|
-
if (this._clientOutput.device === 'touch') {
|
|
1337
|
-
// First we wait for any running animation to complete
|
|
1338
|
-
const runningAnimationDone = this.menu._isAnimating
|
|
1339
|
-
? this.menu._animationDone
|
|
1340
|
-
: of([null]);
|
|
1341
|
-
runningAnimationDone
|
|
1342
|
-
.pipe(take(1), delay(0, asapScheduler))
|
|
1343
|
-
// eslint-disable-next-line rxjs/no-nested-subscribe
|
|
1344
|
-
.subscribe(() => {
|
|
1345
|
-
this.animateCloseMenu(reason !== 'keydown', reason === 'click');
|
|
1346
|
-
this.menu._animationDone
|
|
1347
|
-
.pipe(take(1), delay(0, asapScheduler))
|
|
1348
|
-
// eslint-disable-next-line rxjs/no-nested-subscribe
|
|
1349
|
-
.subscribe(() => this._destroyMenu());
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
else {
|
|
1353
|
-
//#endregion --- Touch device customizations ---
|
|
1354
|
-
this._destroyMenu();
|
|
1355
|
-
}
|
|
1356
|
-
// If a click closed the menu, we should close the entire chain of nested menus.
|
|
1357
|
-
if ((reason === 'click' || reason === 'tab') && this._parentMenu) {
|
|
1358
|
-
this._parentMenu.closed.emit(reason);
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
isOpen() {
|
|
1364
|
-
return this._isMenuOpen;
|
|
1365
|
-
}
|
|
1366
|
-
/** Open the associated menu */
|
|
1367
|
-
openMenu() {
|
|
1368
|
-
var _a;
|
|
1369
|
-
if (this._isMenuOpen) {
|
|
1370
|
-
return;
|
|
1371
|
-
}
|
|
1372
|
-
this._checkMenu();
|
|
1373
|
-
this.menu.parentMenu = this.triggersSubmenu()
|
|
1374
|
-
? this._parentMenu
|
|
1375
|
-
: undefined;
|
|
1376
|
-
this.menu.direction = this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
1377
|
-
if (this._parentMenu) {
|
|
1378
|
-
// Menu triggers inherit target device types from their parent.
|
|
1379
|
-
// Ultimately it is the root trigger that determines device types for
|
|
1380
|
-
// the whole menu hierarchy.
|
|
1381
|
-
this._clientInput = this._parentMenu._clientInput;
|
|
1382
|
-
this._clientOutput = this._parentMenu._clientOutput;
|
|
1383
|
-
}
|
|
1384
|
-
//#region --- Touch device customizations ---
|
|
1385
|
-
// Make the menu we're about to open use the same devices as the trigger
|
|
1386
|
-
this.menu._setDevice(this._clientInput, this._clientOutput);
|
|
1387
|
-
if (this._clientOutput.device === 'touch') {
|
|
1388
|
-
this.menu.showBackButton = !!this._parentMenu;
|
|
1389
|
-
this.menu._updateShowTitle();
|
|
1390
|
-
if (!this.menu.closeLabel) {
|
|
1391
|
-
this.menu.closeLabel = (_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a.closeLabel;
|
|
1392
|
-
}
|
|
1393
|
-
this.menu.showCloseButton = !!this.menu.closeLabel;
|
|
1394
|
-
}
|
|
1395
|
-
this.menu._isClosing = false;
|
|
1396
|
-
const panelClass = [];
|
|
1397
|
-
if (this._clientOutput.device === 'touch') {
|
|
1398
|
-
panelClass.push('granite-overlay-pane-fill-width-bottom');
|
|
1399
|
-
}
|
|
1400
|
-
const scrollStrategy = this._clientOutput.device !== 'touch'
|
|
1401
|
-
? this._overlay.scrollStrategies.reposition()
|
|
1402
|
-
: undefined;
|
|
1403
|
-
const hasBackdrop = this._clientOutput.device === 'touch' && !this.triggersSubmenu();
|
|
1404
|
-
//#endregion --- Touch device customizations ---
|
|
1405
|
-
// Create an overlay to stuff the menu (portal) into below
|
|
1406
|
-
if (!this._overlayRef) {
|
|
1407
|
-
const config = new OverlayConfig({
|
|
1408
|
-
positionStrategy: this._positionStrategy(),
|
|
1409
|
-
backdropClass: 'granite-overlay-dark-glass-backdrop',
|
|
1410
|
-
scrollStrategy,
|
|
1411
|
-
direction: this._dir,
|
|
1412
|
-
panelClass,
|
|
1413
|
-
hasBackdrop,
|
|
1414
|
-
});
|
|
1415
|
-
this._overlayRef = this._overlay.create(config);
|
|
1416
|
-
//#region --- Touch device customizations ---
|
|
1417
|
-
// Add touch listener for submenu back pan/swipe
|
|
1418
|
-
if (this._clientOutput.device === 'touch') {
|
|
1419
|
-
this.addOverlayListeners();
|
|
1420
|
-
}
|
|
1421
|
-
//#endregion --- Touch device customizations ---
|
|
1422
|
-
}
|
|
1423
|
-
else {
|
|
1424
|
-
// Reset animation state for reused overlays
|
|
1425
|
-
if (this._clientOutput.device === 'touch') {
|
|
1426
|
-
this.menu._panelAnimationState = 'void';
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
// Create portal from associated menu's template
|
|
1430
|
-
if (!this._portal || this._portal.templateRef !== this.menu.templateRef) {
|
|
1431
|
-
this._portal = new TemplatePortal(this.menu.templateRef, this._viewContainerRef);
|
|
1432
|
-
}
|
|
1433
|
-
// Attach menu portal to overlay ref (which is a portal outlet)
|
|
1434
|
-
this._overlayRef.attach(this._portal);
|
|
1435
|
-
// Subscribe to stream that emits whenever an action that should close the menu occurs
|
|
1436
|
-
this._closingActionsSubscription = this._menuClosingActions().subscribe(() => this.closeMenu());
|
|
1437
|
-
this.animateOpenMenu();
|
|
1438
|
-
this._setIsMenuOpen(true);
|
|
1439
|
-
this.menu.focusFirstItem(this._openedBy || 'program');
|
|
1440
|
-
}
|
|
1441
|
-
/** Whether the menu triggers a sub-menu or a top-level one. */
|
|
1442
|
-
triggersSubmenu() {
|
|
1443
|
-
return !!(this._menuItemInstance && this._parentMenu);
|
|
1444
|
-
}
|
|
1445
|
-
/** Toggles the menu between the open and closed states. */
|
|
1446
|
-
toggleMenu() {
|
|
1447
|
-
if (this._isMenuOpen) {
|
|
1448
|
-
this.closeMenu();
|
|
1449
|
-
}
|
|
1450
|
-
else {
|
|
1451
|
-
this.openMenu();
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
/** Close the associated menu */
|
|
1455
|
-
closeMenu() {
|
|
1456
|
-
this.menu.closed.emit();
|
|
1457
|
-
}
|
|
1458
|
-
/**
|
|
1459
|
-
* Focuses the menu trigger.
|
|
1460
|
-
* @param origin Source of the menu trigger's focus.
|
|
1461
|
-
*/
|
|
1462
|
-
focus(origin = 'program', options) {
|
|
1463
|
-
if (this._focusMonitor) {
|
|
1464
|
-
this._focusMonitor.focusVia(this._element, origin, options);
|
|
1465
|
-
}
|
|
1466
|
-
else {
|
|
1467
|
-
this._element.nativeElement.focus(options);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
/** Detach menu portal from overlay and update open state */
|
|
1471
|
-
_destroyMenu() {
|
|
1472
|
-
if (!this._overlayRef || !this._isMenuOpen) {
|
|
1473
|
-
return;
|
|
1474
|
-
}
|
|
1475
|
-
this._closingActionsSubscription.unsubscribe();
|
|
1476
|
-
this._overlayRef.detach();
|
|
1477
|
-
this._restoreFocus();
|
|
1478
|
-
this.menu._resetAnimation();
|
|
1479
|
-
this._setIsMenuOpen(false);
|
|
1480
|
-
}
|
|
1481
|
-
/** Handles mouse presses on the trigger. */
|
|
1482
|
-
_handleMousedown(event) {
|
|
1483
|
-
if (!isFakeMousedownFromScreenReader(event)) {
|
|
1484
|
-
if (this._openedBy !== 'touch') {
|
|
1485
|
-
// Since right or middle button clicks won't trigger the `click` event,
|
|
1486
|
-
// we shouldn't consider the menu as opened by mouse in those cases.
|
|
1487
|
-
this._openedBy = event.button === 0 ? 'mouse' : null;
|
|
1488
|
-
}
|
|
1489
|
-
// Since clicking on the trigger won't close the menu if it opens a sub-menu,
|
|
1490
|
-
// we should prevent focus from moving onto it via click to avoid the
|
|
1491
|
-
// highlight from lingering on the menu item.
|
|
1492
|
-
if (this.triggersSubmenu() && !this._toggleOnSubmenuClick()) {
|
|
1493
|
-
event.preventDefault();
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
/** Handles key presses on the trigger. */
|
|
1498
|
-
_handleKeydown(event) {
|
|
1499
|
-
const key = event.key;
|
|
1500
|
-
if (this.triggersSubmenu() &&
|
|
1501
|
-
((key === 'ArrowRight' && this._dir.value === 'ltr') ||
|
|
1502
|
-
(key === 'ArrowLeft' && this._dir.value === 'rtl'))) {
|
|
1503
|
-
this.openMenu();
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
/** Handles click events on the trigger. */
|
|
1507
|
-
_handleClick(event) {
|
|
1508
|
-
if (this.triggersSubmenu()) {
|
|
1509
|
-
// Stop event propagation to avoid closing the parent menu.
|
|
1510
|
-
event.stopPropagation();
|
|
1511
|
-
this._toggleOnSubmenuClick() ? this.toggleMenu() : this.openMenu();
|
|
1512
|
-
}
|
|
1513
|
-
else {
|
|
1514
|
-
this.toggleMenu();
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
/** Handles the cases where the user hovers over the trigger. */
|
|
1518
|
-
_handleHover() {
|
|
1519
|
-
// Subscribe to changes in the hovered item in order to toggle the panel.
|
|
1520
|
-
if (!this.triggersSubmenu() || !this._parentMenu) {
|
|
1521
|
-
return;
|
|
1522
|
-
}
|
|
1523
|
-
this._hoverSubscription = this._parentMenu
|
|
1524
|
-
._hovered()
|
|
1525
|
-
.pipe(filter(() => this._openOnHover()),
|
|
1526
|
-
// Since we might have multiple competing triggers for the same menu (e.g. a sub-menu
|
|
1527
|
-
// with different data and triggers), we have to delay it by a tick to ensure that
|
|
1528
|
-
// it won't be closed immediately after it is opened.
|
|
1529
|
-
filter((active) => active === this._menuItemInstance /*&& !active.disabled*/), delay(0, asapScheduler))
|
|
1530
|
-
.subscribe(() => {
|
|
1531
|
-
this._openedBy = 'mouse';
|
|
1532
|
-
// If the same menu is used between multiple triggers, it might still be animating
|
|
1533
|
-
// while the new trigger tries to re-open it. Wait for the animation to finish
|
|
1534
|
-
// before doing so. Also interrupt if the user moves to another item.
|
|
1535
|
-
if (this.menu instanceof _MenuBaseComponent && this.menu._isAnimating) {
|
|
1536
|
-
// We need the `delay(0)` here in order to avoid
|
|
1537
|
-
// 'changed after checked' errors in some cases. See Angular Material #12194.
|
|
1538
|
-
this.menu._animationDone
|
|
1539
|
-
.pipe(take(1), delay(0, asapScheduler), takeUntil(this._parentMenu._hovered()))
|
|
1540
|
-
// eslint-disable-next-line rxjs/no-nested-subscribe
|
|
1541
|
-
.subscribe(() => this.openMenu());
|
|
1542
|
-
}
|
|
1543
|
-
else {
|
|
1544
|
-
this.openMenu();
|
|
1545
|
-
}
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
/**
|
|
1549
|
-
* Restores focus to the element that was focused before the menu was open.
|
|
1550
|
-
* Could be the root trigger button or a submenu trigger item
|
|
1551
|
-
*/
|
|
1552
|
-
_restoreFocus() {
|
|
1553
|
-
// We should reset focus if the user is navigating using a keyboard or
|
|
1554
|
-
// if we have a top-level trigger which might cause focus to be lost
|
|
1555
|
-
// when clicking outside of the menu.
|
|
1556
|
-
if (!this._openedBy) {
|
|
1557
|
-
// Note that the focus style will show up both for `program` and
|
|
1558
|
-
// `keyboard` so we don't have to specify which one it is.
|
|
1559
|
-
this.focus();
|
|
1560
|
-
}
|
|
1561
|
-
else if (!this.triggersSubmenu()) {
|
|
1562
|
-
this.focus(this._openedBy);
|
|
1563
|
-
}
|
|
1564
|
-
this._openedBy = null;
|
|
1565
|
-
}
|
|
1566
|
-
// Set state rather than toggle to support triggers sharing a menu
|
|
1567
|
-
_setIsMenuOpen(isOpen) {
|
|
1568
|
-
this._isMenuOpen = isOpen;
|
|
1569
|
-
if (this.triggersSubmenu()) {
|
|
1570
|
-
this._menuItemInstance._highlighted =
|
|
1571
|
-
isOpen && this._clientOutput.device !== 'touch';
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
/**
|
|
1575
|
-
* This method checks that a valid instance of MenuComponent has been passed into
|
|
1576
|
-
* graniteMenuTriggerFor. If not, an exception is thrown.
|
|
1577
|
-
*/
|
|
1578
|
-
_checkMenu() {
|
|
1579
|
-
if (!this.menu) {
|
|
1580
|
-
throwGraniteMenuMissingError();
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
/**
|
|
1584
|
-
* Returns strategy for positioning the overlay for desktop devices:
|
|
1585
|
-
* Place adjacent to the trigger button (preferably immediately below)
|
|
1586
|
-
* in order to show as much of the menu as possible.
|
|
1587
|
-
*/
|
|
1588
|
-
_desktopPositionStrategy() {
|
|
1589
|
-
const positionStrategy = this._overlay
|
|
1590
|
-
.position()
|
|
1591
|
-
.flexibleConnectedTo(this._element)
|
|
1592
|
-
.withLockedPosition()
|
|
1593
|
-
.withTransformOriginOn('.granite-menu')
|
|
1594
|
-
.withPush(false);
|
|
1595
|
-
this._setPosition(positionStrategy);
|
|
1596
|
-
return positionStrategy;
|
|
1597
|
-
}
|
|
1598
|
-
/**
|
|
1599
|
-
* Sets the appropriate positions on a position strategy
|
|
1600
|
-
* so the overlay connects with the trigger correctly.
|
|
1601
|
-
* @param positionStrategy Strategy whose position to update.
|
|
1602
|
-
*/
|
|
1603
|
-
_setPosition(positionStrategy) {
|
|
1604
|
-
const MENU_PANEL_TOP_PADDING = 0;
|
|
1605
|
-
let [originX, originFallbackX] = this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'];
|
|
1606
|
-
const [overlayY, overlayFallbackY] = this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];
|
|
1607
|
-
let [originY, originFallbackY] = [overlayY, overlayFallbackY];
|
|
1608
|
-
let [overlayX, overlayFallbackX] = [originX, originFallbackX];
|
|
1609
|
-
let offsetY = 0;
|
|
1610
|
-
if (this.triggersSubmenu()) {
|
|
1611
|
-
// When the menu is a sub-menu, it should always align itself
|
|
1612
|
-
// to the edges of the trigger, instead of overlapping it.
|
|
1613
|
-
overlayFallbackX = originX =
|
|
1614
|
-
this.menu.xPosition === 'before' ? 'start' : 'end';
|
|
1615
|
-
originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
|
|
1616
|
-
offsetY =
|
|
1617
|
-
overlayY === 'bottom'
|
|
1618
|
-
? MENU_PANEL_TOP_PADDING
|
|
1619
|
-
: -MENU_PANEL_TOP_PADDING;
|
|
1620
|
-
}
|
|
1621
|
-
else {
|
|
1622
|
-
originY = overlayY === 'top' ? 'bottom' : 'top';
|
|
1623
|
-
originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
|
|
1624
|
-
}
|
|
1625
|
-
positionStrategy.withPositions([
|
|
1626
|
-
{ originX, originY, overlayX, overlayY, offsetY },
|
|
1627
|
-
{
|
|
1628
|
-
originX: originFallbackX,
|
|
1629
|
-
originY,
|
|
1630
|
-
overlayX: overlayFallbackX,
|
|
1631
|
-
overlayY,
|
|
1632
|
-
offsetY,
|
|
1633
|
-
},
|
|
1634
|
-
{
|
|
1635
|
-
originX,
|
|
1636
|
-
originY: originFallbackY,
|
|
1637
|
-
overlayX,
|
|
1638
|
-
overlayY: overlayFallbackY,
|
|
1639
|
-
offsetY: -offsetY,
|
|
1640
|
-
},
|
|
1641
|
-
{
|
|
1642
|
-
originX: originFallbackX,
|
|
1643
|
-
originY: originFallbackY,
|
|
1644
|
-
overlayX: overlayFallbackX,
|
|
1645
|
-
overlayY: overlayFallbackY,
|
|
1646
|
-
offsetY: -offsetY,
|
|
1647
|
-
},
|
|
1648
|
-
]);
|
|
1649
|
-
}
|
|
1650
|
-
/** Returns a stream that emits whenever an action that should close the menu occurs. */
|
|
1651
|
-
_menuClosingActions() {
|
|
1652
|
-
var _a;
|
|
1653
|
-
const detachments = (_a = this._overlayRef) === null || _a === void 0 ? void 0 : _a.detachments();
|
|
1654
|
-
const parentClose = this._parentMenu
|
|
1655
|
-
? this._parentMenu.closed
|
|
1656
|
-
: of();
|
|
1657
|
-
const hover = this._clientOutput.device === 'desktop' && this._parentMenu
|
|
1658
|
-
? this._parentMenu._hovered().pipe(filter((item) => item !== this._menuItemInstance), filter(() => this._isMenuOpen))
|
|
1659
|
-
: of();
|
|
1660
|
-
// Note: Quick fix. Feature reportedly exists in CDK for Angular 10
|
|
1661
|
-
// Filter to prevent closing when animating added though. Applied to
|
|
1662
|
-
// root menu only.
|
|
1663
|
-
const outsideClick = !this._parentMenu
|
|
1664
|
-
? fromEvent(this._document, 'click').pipe(filter((e) => e.target !== this._element.nativeElement &&
|
|
1665
|
-
e.target.closest('.granite-menu') === null), filter(() => !this.menu._isAnimating))
|
|
1666
|
-
: of();
|
|
1667
|
-
return merge(detachments, hover, parentClose, outsideClick);
|
|
1668
|
-
}
|
|
1669
|
-
/**
|
|
1670
|
-
* Whether to automatically open submenus on hover. This is true when showing
|
|
1671
|
-
* desktop menus and having mouse support.
|
|
1672
|
-
*/
|
|
1673
|
-
_openOnHover() {
|
|
1674
|
-
var _a, _b;
|
|
1675
|
-
return ((this.triggersSubmenu()
|
|
1676
|
-
? this._parentMenu.openOnHover
|
|
1677
|
-
: this.menu.openOnHover) &&
|
|
1678
|
-
((_a = this._parentMenu._clientOutput) === null || _a === void 0 ? void 0 : _a.device) === 'desktop' && ((_b = this._parentMenu._clientInput) === null || _b === void 0 ? void 0 : _b.devices.includes('mouse')));
|
|
1679
|
-
}
|
|
1680
|
-
/**
|
|
1681
|
-
* Whether to toggle submenus on click. This is true when showing desktop menus
|
|
1682
|
-
* without mouse support. Which, by the way, is not a great idea to begin with.
|
|
1683
|
-
*/
|
|
1684
|
-
_toggleOnSubmenuClick() {
|
|
1685
|
-
var _a, _b;
|
|
1686
|
-
return (!(this.triggersSubmenu()
|
|
1687
|
-
? this._parentMenu.openOnHover
|
|
1688
|
-
: this.menu.openOnHover) ||
|
|
1689
|
-
(((_a = this._parentMenu._clientOutput) === null || _a === void 0 ? void 0 : _a.device) === 'desktop' &&
|
|
1690
|
-
!((_b = this._parentMenu._clientInput) === null || _b === void 0 ? void 0 : _b.devices.includes('mouse'))));
|
|
1691
|
-
}
|
|
1692
|
-
// ------------------------------------------- //
|
|
1693
|
-
// --- Here be touch device customizations --- //
|
|
1694
|
-
// ------------------------------------------- //
|
|
1695
|
-
/** Set animation state to bring a newly opened menu into view */
|
|
1696
|
-
animateOpenMenu() {
|
|
1697
|
-
this._clientOutput.device === 'touch'
|
|
1698
|
-
? this.animateTouchOpenMenu()
|
|
1699
|
-
: this.menu._startAnimation();
|
|
1700
|
-
}
|
|
1701
|
-
animateTouchOpenMenu() {
|
|
1702
|
-
if (this.triggersSubmenu()) {
|
|
1703
|
-
// Slide newly opened sub menu into view from the side,
|
|
1704
|
-
// pushing any parent menu out of view on the other side
|
|
1705
|
-
this.menu._startTouchSubmenuEnterAnimation();
|
|
1706
|
-
this._parentMenu._startTouchHideAnimation();
|
|
1707
|
-
}
|
|
1708
|
-
else {
|
|
1709
|
-
// Slide root menu into view from below
|
|
1710
|
-
this.menu._startTouchRootEnterAnimation();
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
/** Set animation state to close the active menu */
|
|
1714
|
-
animateCloseMenu(toBelow, withDelay) {
|
|
1715
|
-
this._clientOutput.device === 'touch'
|
|
1716
|
-
? this._animateTouchCloseMenu(toBelow, withDelay)
|
|
1717
|
-
: this._parentMenu._resetAnimation();
|
|
1718
|
-
}
|
|
1719
|
-
_animateTouchCloseMenu(toBelow, withDelay) {
|
|
1720
|
-
var _a;
|
|
1721
|
-
if (toBelow) {
|
|
1722
|
-
// Slide menu out of view below the viewport
|
|
1723
|
-
withDelay
|
|
1724
|
-
? this.menu._startTouchCloseDownAnimationWithDelay()
|
|
1725
|
-
: this.menu._startTouchCloseDownAnimation();
|
|
1726
|
-
}
|
|
1727
|
-
else {
|
|
1728
|
-
// Slide the closed menu out of view to the side
|
|
1729
|
-
// and slide any parent menu back into view
|
|
1730
|
-
this.menu._startTouchCloseSideAnimation();
|
|
1731
|
-
(_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a._startTouchSubmenuEnterAnimation();
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
/**
|
|
1735
|
-
* Set animation state to place the menu and any parent at the given
|
|
1736
|
-
* horizontal position, i.e. following touch pan movement.
|
|
1737
|
-
*
|
|
1738
|
-
* @param xOffset Horizontal offset
|
|
1739
|
-
*/
|
|
1740
|
-
animateSetMenuPosition(xOffset) {
|
|
1741
|
-
this.menu._startTouchPanAnimation(xOffset);
|
|
1742
|
-
if (this._parentMenu) {
|
|
1743
|
-
this._parentMenu._startTouchHidePanAnimation(xOffset);
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
/**
|
|
1747
|
-
* Returns strategy for positioning the overlay depending on what type of
|
|
1748
|
-
* device the menu is being shown on
|
|
1749
|
-
*/
|
|
1750
|
-
_positionStrategy() {
|
|
1751
|
-
return this._clientOutput.device === 'touch'
|
|
1752
|
-
? this._touchPositionStrategy()
|
|
1753
|
-
: this._desktopPositionStrategy();
|
|
1754
|
-
}
|
|
1755
|
-
/**
|
|
1756
|
-
* Returns strategy for positioning the overlay for touch devices:
|
|
1757
|
-
* Place centered at the bottom of the screen.
|
|
1758
|
-
*/
|
|
1759
|
-
_touchPositionStrategy() {
|
|
1760
|
-
return this._overlay.position().global();
|
|
1761
|
-
}
|
|
1762
|
-
/**
|
|
1763
|
-
* Remove touch device pan/swipe listeners from overlay host element
|
|
1764
|
-
*/
|
|
1765
|
-
addOverlayListeners() {
|
|
1766
|
-
this._overlayRef.hostElement.addEventListener('touchstart', this._handleOverlayTouchStart, passiveEventListenerOptions);
|
|
1767
|
-
this._overlayRef.hostElement.addEventListener('touchmove', this._handleOverlayTouchMove, passiveEventListenerOptions);
|
|
1768
|
-
this._overlayRef.hostElement.addEventListener('touchend', this._handleOverlayTouchEnd, passiveEventListenerOptions);
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* Remove touch device pan/swipe listeners from overlay host element
|
|
1772
|
-
*/
|
|
1773
|
-
removeOverlayListeners() {
|
|
1774
|
-
this._overlayRef.hostElement.removeEventListener('touchstart', this._handleOverlayTouchStart, passiveEventListenerOptions);
|
|
1775
|
-
this._overlayRef.hostElement.removeEventListener('touchmove', this._handleOverlayTouchMove, passiveEventListenerOptions);
|
|
1776
|
-
this._overlayRef.hostElement.removeEventListener('touchend', this._handleOverlayTouchEnd, passiveEventListenerOptions);
|
|
1777
|
-
}
|
|
1778
|
-
/**
|
|
1779
|
-
* Standard exponential ease out function
|
|
1780
|
-
*
|
|
1781
|
-
* @param current Current value
|
|
1782
|
-
* @param offset Offset value, to which calculated value will be added
|
|
1783
|
-
* @param target The target value
|
|
1784
|
-
* @param end Value to which current value is compared
|
|
1785
|
-
*/
|
|
1786
|
-
easeOutExpo(current, offset, target, end) {
|
|
1787
|
-
return current === end
|
|
1788
|
-
? offset + target
|
|
1789
|
-
: target * (-Math.pow(2, (-10 * current) / end) + 1) + offset;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
GraniteMenuTriggerForDirective.decorators = [
|
|
1793
|
-
{ type: Directive, args: [{
|
|
1794
|
-
selector: `[graniteMenuTriggerFor]`,
|
|
1795
|
-
host: {
|
|
1796
|
-
class: 'granite-menu-trigger',
|
|
1797
|
-
'aria-haspopup': 'true',
|
|
1798
|
-
'[attr.aria-expanded]': '_isMenuOpen || null',
|
|
1799
|
-
'[attr.aria-controls]': '_isMenuOpen ? menu.panelId : null',
|
|
1800
|
-
'(mousedown)': '_handleMousedown($event)',
|
|
1801
|
-
'(keydown)': '_handleKeydown($event)',
|
|
1802
|
-
'(click)': '_handleClick($event)',
|
|
1803
|
-
},
|
|
1804
|
-
},] }
|
|
1805
|
-
];
|
|
1806
|
-
GraniteMenuTriggerForDirective.ctorParameters = () => [
|
|
1807
|
-
{ type: Overlay },
|
|
1808
|
-
{ type: ElementRef },
|
|
1809
|
-
{ type: ViewContainerRef },
|
|
1810
|
-
{ type: _MenuBaseComponent, decorators: [{ type: Inject, args: [GRANITE_MENU_PANEL,] }, { type: Optional }] },
|
|
1811
|
-
{ type: undefined, decorators: [{ type: Inject, args: [GRANITE_CLIENT_INPUT,] }, { type: Optional }] },
|
|
1812
|
-
{ type: undefined, decorators: [{ type: Inject, args: [GRANITE_CLIENT_OUTPUT,] }, { type: Optional }] },
|
|
1813
|
-
{ type: GraniteMenuItemComponent, decorators: [{ type: Optional }, { type: Self }] },
|
|
1814
|
-
{ type: Directionality, decorators: [{ type: Optional }] },
|
|
1815
|
-
{ type: FocusMonitor },
|
|
1816
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
|
1817
|
-
];
|
|
1818
|
-
GraniteMenuTriggerForDirective.propDecorators = {
|
|
1819
|
-
menu: [{ type: Input, args: ['graniteMenuTriggerFor',] }]
|
|
1820
|
-
};
|
|
1821
|
-
|
|
1822
|
-
class GraniteMenuTouchCloseComponent {
|
|
1823
|
-
}
|
|
1824
|
-
GraniteMenuTouchCloseComponent.decorators = [
|
|
1825
|
-
{ type: Component, args: [{
|
|
1826
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1827
|
-
selector: '[graniteMenuTouchCloseItem]',
|
|
1828
|
-
template: '<ng-content></ng-content>',
|
|
1829
|
-
exportAs: 'graniteMenuTouchCloseItem',
|
|
1830
|
-
host: {
|
|
1831
|
-
'[class.granite-device-output-touch]': 'true',
|
|
1832
|
-
},
|
|
1833
|
-
styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-s);width:100%;max-width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:start;text-decoration:none;background-color:var(--granite-color-background-variant);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small);font-family:inherit}@media (hover:hover) and (pointer:fine){:host:hover:not(.granite-title):not([disabled]){background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}@media (hover:none) and (pointer:coarse){:host:active:not(.granite-title):not([disabled]){background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host.granite-title{-moz-user-select:none;-webkit-user-select:none;user-select:none;display:flex;align-items:center;line-height:1.5rem;width:100%;outline:none;border:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;color:var(--granite-color-text);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-bold);cursor:default}:host.cdk-keyboard-focused,:host.cdk-program-focused,:host.granite-menu-item-highlighted{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}:host granite-icon{position:absolute;font-size:var(--granite-font-size-body-small);color:inherit;top:50%;transform:translateY(-50%)}:host.granite-menu-item-submenu-trigger{-webkit-padding-end:var(--granite-spacing-l);padding-inline-end:var(--granite-spacing-l)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-xs)}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left,[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}:host.granite-divider-top{border-top:.0625rem solid var(--granite-color-border-soft)}:host.granite-divider-bottom{border-bottom:.0625rem solid var(--granite-color-border-soft)}:host.granite-device-output-touch{line-height:3rem;font-size:var(--granite-font-size-body-small);text-align:center;padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-title{padding:0;justify-content:center;line-height:1.5rem;font-size:var(--granite-font-size-micro)}:host.granite-device-output-touch.granite-menu-item-back-trigger,:host.granite-device-output-touch.granite-menu-item-submenu-trigger{padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-menu-item-title{line-height:3rem;height:3rem;font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}@media (hover:none) and (pointer:coarse){:host.granite-device-output-touch.granite-menu-item-title:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-xs)}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right,[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}"]
|
|
1834
|
-
},] }
|
|
1835
|
-
];
|
|
1836
|
-
|
|
1837
|
-
class GraniteMenuTouchTitleItemComponent {
|
|
1838
|
-
constructor(
|
|
1839
|
-
/** If this is an item on a _submenu_, its parent menu will have a parent */
|
|
1840
|
-
_parentMenu) {
|
|
1841
|
-
/**
|
|
1842
|
-
* Whether the menu item acts as a trigger to return to a parent menu
|
|
1843
|
-
* (used for styling)
|
|
1844
|
-
*/
|
|
1845
|
-
this._triggersBack = false;
|
|
1846
|
-
this._triggersBack = !!_parentMenu.parentMenu;
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
GraniteMenuTouchTitleItemComponent.decorators = [
|
|
1850
|
-
{ type: Component, args: [{
|
|
1851
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1852
|
-
selector: '[graniteMenuTouchTitleItem]',
|
|
1853
|
-
template: `
|
|
1854
|
-
<ng-container *ngIf="_triggersBack">
|
|
1855
|
-
<granite-icon
|
|
1856
|
-
class="caret-left"
|
|
1857
|
-
[fontIcon]="'icon-caret-left'"
|
|
1858
|
-
></granite-icon>
|
|
1859
|
-
<granite-icon
|
|
1860
|
-
class="caret-right"
|
|
1861
|
-
[fontIcon]="'icon-caret-right'"
|
|
1862
|
-
></granite-icon>
|
|
1863
|
-
</ng-container>
|
|
1864
|
-
<ng-content></ng-content>
|
|
1865
|
-
`,
|
|
1866
|
-
exportAs: 'graniteMenuTouchTitleItem',
|
|
1867
|
-
host: {
|
|
1868
|
-
'[class.granite-menu-item-title]': 'true',
|
|
1869
|
-
'[class.granite-menu-item-back-trigger]': '_triggersBack',
|
|
1870
|
-
'[class.granite-device-output-touch]': 'true',
|
|
1871
|
-
},
|
|
1872
|
-
styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-s);width:100%;max-width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;cursor:pointer;outline:none;border:none;-webkit-tap-highlight-color:transparent;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:start;text-decoration:none;background-color:var(--granite-color-background-variant);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small);font-family:inherit}@media (hover:hover) and (pointer:fine){:host:hover:not(.granite-title):not([disabled]){background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}@media (hover:none) and (pointer:coarse){:host:active:not(.granite-title):not([disabled]){background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host.granite-title{-moz-user-select:none;-webkit-user-select:none;user-select:none;display:flex;align-items:center;line-height:1.5rem;width:100%;outline:none;border:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-decoration:none;color:var(--granite-color-text);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-bold);cursor:default}:host.cdk-keyboard-focused,:host.cdk-program-focused,:host.granite-menu-item-highlighted{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}:host granite-icon{position:absolute;font-size:var(--granite-font-size-body-small);color:inherit;top:50%;transform:translateY(-50%)}:host.granite-menu-item-submenu-trigger{-webkit-padding-end:var(--granite-spacing-l);padding-inline-end:var(--granite-spacing-l)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon,html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-xs)}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left,[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}:host.granite-divider-top{border-top:.0625rem solid var(--granite-color-border-soft)}:host.granite-divider-bottom{border-bottom:.0625rem solid var(--granite-color-border-soft)}:host.granite-device-output-touch{line-height:3rem;font-size:var(--granite-font-size-body-small);text-align:center;padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-title{padding:0;justify-content:center;line-height:1.5rem;font-size:var(--granite-font-size-micro)}:host.granite-device-output-touch.granite-menu-item-back-trigger,:host.granite-device-output-touch.granite-menu-item-submenu-trigger{padding:0 var(--granite-spacing-l)}:host.granite-device-output-touch.granite-menu-item-title{line-height:3rem;height:3rem;font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}@media (hover:none) and (pointer:coarse){:host.granite-device-output-touch.granite-menu-item-title:active{background:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-xs)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon,html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-xs)}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right,[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}"]
|
|
1873
|
-
},] }
|
|
1874
|
-
];
|
|
1875
|
-
GraniteMenuTouchTitleItemComponent.ctorParameters = () => [
|
|
1876
|
-
{ type: _MenuBaseComponent, decorators: [{ type: Inject, args: [GRANITE_MENU_PANEL,] }, { type: Optional }] }
|
|
1877
|
-
];
|
|
1878
|
-
|
|
1879
|
-
class GraniteDividerDirective {
|
|
1880
|
-
constructor() {
|
|
1881
|
-
this.dividerDirection = 'top';
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
GraniteDividerDirective.decorators = [
|
|
1885
|
-
{ type: Directive, args: [{
|
|
1886
|
-
selector: '[graniteDivider]',
|
|
1887
|
-
exportAs: 'graniteDivider',
|
|
1888
|
-
host: {
|
|
1889
|
-
'[class.granite-divider-top]': 'dividerDirection === "top"',
|
|
1890
|
-
'[class.granite-divider-bottom]': 'dividerDirection === "bottom"',
|
|
1891
|
-
},
|
|
1892
|
-
},] }
|
|
1893
|
-
];
|
|
1894
|
-
GraniteDividerDirective.propDecorators = {
|
|
1895
|
-
dividerDirection: [{ type: Input }]
|
|
1896
|
-
};
|
|
1897
|
-
|
|
1898
|
-
class GraniteIconComponent {
|
|
1899
|
-
constructor(_elementRef, renderer, ariaHidden) {
|
|
1900
|
-
this._elementRef = _elementRef;
|
|
1901
|
-
this.renderer = renderer;
|
|
1902
|
-
// aria-hidden will be set to true by default, unless it's overridden by the developer
|
|
1903
|
-
if (!ariaHidden) {
|
|
1904
|
-
this.renderer.setAttribute(_elementRef.nativeElement, 'aria-hidden', 'true');
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
ngOnChanges(changes) {
|
|
1908
|
-
if (changes.fontIcon) {
|
|
1909
|
-
this._updateFontIcon();
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
_updateFontIcon() {
|
|
1913
|
-
if (this.fontIcon !== this._previousFontIconClass) {
|
|
1914
|
-
if (this._previousFontIconClass) {
|
|
1915
|
-
this.renderer.removeClass(this._elementRef.nativeElement, this._previousFontIconClass);
|
|
1916
|
-
}
|
|
1917
|
-
if (this.fontIcon) {
|
|
1918
|
-
this.renderer.addClass(this._elementRef.nativeElement, this.fontIcon);
|
|
1919
|
-
}
|
|
1920
|
-
this._previousFontIconClass = this.fontIcon;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
GraniteIconComponent.decorators = [
|
|
1925
|
-
{ type: Component, args: [{
|
|
1926
|
-
selector: 'granite-icon',
|
|
1927
|
-
template: '<ng-content></ng-content>',
|
|
1928
|
-
host: {
|
|
1929
|
-
role: 'img',
|
|
1930
|
-
class: 'granite-icon',
|
|
1931
|
-
},
|
|
1932
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1933
|
-
styles: [":host.granite-icon{background-repeat:no-repeat;display:inline-block;padding:0 calc(var(--granite-spacing-xs) / 2);font-size:1em;line-height:1em;position:relative;top:.1em}"]
|
|
1934
|
-
},] }
|
|
1935
|
-
];
|
|
1936
|
-
GraniteIconComponent.ctorParameters = () => [
|
|
1937
|
-
{ type: ElementRef },
|
|
1938
|
-
{ type: Renderer2 },
|
|
1939
|
-
{ type: String, decorators: [{ type: Attribute, args: ['aria-hidden',] }] }
|
|
1940
|
-
];
|
|
1941
|
-
GraniteIconComponent.propDecorators = {
|
|
1942
|
-
fontIcon: [{ type: Input }]
|
|
1943
|
-
};
|
|
1944
|
-
|
|
1945
|
-
class GraniteIconModule {
|
|
1946
|
-
}
|
|
1947
|
-
GraniteIconModule.decorators = [
|
|
1948
|
-
{ type: NgModule, args: [{
|
|
1949
|
-
declarations: [GraniteIconComponent],
|
|
1950
|
-
exports: [GraniteIconComponent],
|
|
1951
|
-
},] }
|
|
1952
|
-
];
|
|
1953
|
-
|
|
1954
|
-
class GraniteTitleDirective {
|
|
1955
|
-
}
|
|
1956
|
-
GraniteTitleDirective.decorators = [
|
|
1957
|
-
{ type: Directive, args: [{
|
|
1958
|
-
selector: '[graniteTitle]',
|
|
1959
|
-
exportAs: 'graniteTitle',
|
|
1960
|
-
host: {
|
|
1961
|
-
'[class.granite-title]': 'true',
|
|
1962
|
-
},
|
|
1963
|
-
},] }
|
|
1964
|
-
];
|
|
1965
|
-
|
|
1966
|
-
class GraniteMenuModule {
|
|
1967
|
-
}
|
|
1968
|
-
GraniteMenuModule.decorators = [
|
|
1969
|
-
{ type: NgModule, args: [{
|
|
1970
|
-
declarations: [
|
|
1971
|
-
GraniteMenuComponent,
|
|
1972
|
-
GraniteMenuItemComponent,
|
|
1973
|
-
GraniteMenuTriggerForDirective,
|
|
1974
|
-
GraniteMenuTouchCloseComponent,
|
|
1975
|
-
GraniteMenuTouchTitleItemComponent,
|
|
1976
|
-
GraniteDividerDirective,
|
|
1977
|
-
GraniteTitleDirective,
|
|
1978
|
-
],
|
|
1979
|
-
imports: [CommonModule, OverlayModule, PortalModule, GraniteIconModule],
|
|
1980
|
-
exports: [
|
|
1981
|
-
GraniteMenuComponent,
|
|
1982
|
-
GraniteMenuItemComponent,
|
|
1983
|
-
GraniteMenuTriggerForDirective,
|
|
1984
|
-
GraniteMenuTouchCloseComponent,
|
|
1985
|
-
GraniteMenuTouchTitleItemComponent,
|
|
1986
|
-
GraniteDividerDirective,
|
|
1987
|
-
GraniteTitleDirective,
|
|
1988
|
-
],
|
|
1989
|
-
},] }
|
|
1990
|
-
];
|
|
1991
|
-
|
|
1992
|
-
/**
|
|
1993
|
-
* Test harness for menu component
|
|
1994
|
-
*
|
|
1995
|
-
* Stripped-down version of the Angular Material menu test harness (.../menu/menu-harness.ts)
|
|
1996
|
-
* just to get things going.
|
|
1997
|
-
*/
|
|
1998
|
-
class GraniteMenuHarness extends ComponentHarness {
|
|
1999
|
-
constructor() {
|
|
2000
|
-
super(...arguments);
|
|
2001
|
-
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
2002
|
-
}
|
|
2003
|
-
/**
|
|
2004
|
-
* Gets a `HarnessPredicate` that can be used to search for a `MenuHarness` that meets
|
|
2005
|
-
* certain criteria.
|
|
2006
|
-
* @param options Options for filtering which menu item instances are considered a match.
|
|
2007
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
2008
|
-
*/
|
|
2009
|
-
static with(options = {}) {
|
|
2010
|
-
return new HarnessPredicate(GraniteMenuHarness, options).addOption('text', options.text,
|
|
2011
|
-
/* @dynamic */ (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
2012
|
-
}
|
|
2013
|
-
/** Gets the text of the menu trigger */
|
|
2014
|
-
getText() {
|
|
2015
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2016
|
-
return (yield this.host()).text();
|
|
2017
|
-
});
|
|
2018
|
-
}
|
|
2019
|
-
/** Opens the menu, unless already open */
|
|
2020
|
-
open() {
|
|
2021
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2022
|
-
if (!(yield this.isOpen())) {
|
|
2023
|
-
yield (yield this.host()).click();
|
|
2024
|
-
// This is necessary so that we wait for the opening animation to finish.
|
|
2025
|
-
return this.forceStabilize();
|
|
2026
|
-
}
|
|
2027
|
-
});
|
|
2028
|
-
}
|
|
2029
|
-
/** Closes the menu, unless already closed */
|
|
2030
|
-
close() {
|
|
2031
|
-
var _a;
|
|
2032
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2033
|
-
yield ((_a = (yield this._getMenuPanel())) === null || _a === void 0 ? void 0 : _a.sendKeys(TestKey.ESCAPE));
|
|
2034
|
-
// This is necessary so that we wait for the closing animation to finish.
|
|
2035
|
-
return this.forceStabilize();
|
|
2036
|
-
});
|
|
2037
|
-
}
|
|
2038
|
-
/** Whether the menu is open */
|
|
2039
|
-
isOpen() {
|
|
2040
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2041
|
-
return !!(yield this._getMenuPanel());
|
|
2042
|
-
});
|
|
2043
|
-
}
|
|
2044
|
-
/**
|
|
2045
|
-
* Gets a list of `GraniteMenuItemHarness` representing the items in the menu.
|
|
2046
|
-
* @param filters Optionally filters which menu items are included.
|
|
2047
|
-
*/
|
|
2048
|
-
getItems(filters = {}) {
|
|
2049
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2050
|
-
const panelId = yield this._getPanelId();
|
|
2051
|
-
if (panelId) {
|
|
2052
|
-
return this._documentRootLocator.locatorForAll(GraniteMenuItemHarness.with(Object.assign(Object.assign({}, filters), { ancestor: `#${panelId}` })))();
|
|
2053
|
-
}
|
|
2054
|
-
return [];
|
|
2055
|
-
});
|
|
2056
|
-
}
|
|
2057
|
-
/** Gets the menu panel (popup) associated with the menu */
|
|
2058
|
-
_getMenuPanel() {
|
|
2059
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2060
|
-
const panelId = yield this._getPanelId();
|
|
2061
|
-
return panelId
|
|
2062
|
-
? this._documentRootLocator.locatorForOptional(`#${panelId}`)()
|
|
2063
|
-
: null;
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
/** Gets the id of the menu panel (popup) associated with this menu */
|
|
2067
|
-
_getPanelId() {
|
|
2068
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2069
|
-
const panelId = yield (yield this.host()).getAttribute('aria-controls');
|
|
2070
|
-
return panelId || null;
|
|
2071
|
-
});
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
/**
|
|
2075
|
-
* The selector for the host element of a `MenuComponent` instance,
|
|
2076
|
-
* i.e. the button element used to open the menu.
|
|
2077
|
-
*/
|
|
2078
|
-
GraniteMenuHarness.hostSelector = '.granite-menu-trigger';
|
|
2079
|
-
class GraniteMenuItemHarness extends ComponentHarness {
|
|
2080
|
-
/**
|
|
2081
|
-
* Gets a `HarnessPredicate` that can be used to search for a `GraniteMenuItemHarness` that meets
|
|
2082
|
-
* certain criteria.
|
|
2083
|
-
* @param options Options for filtering which menu item instances are considered a match.
|
|
2084
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
2085
|
-
*/
|
|
2086
|
-
static with(options = {}) {
|
|
2087
|
-
return new HarnessPredicate(GraniteMenuItemHarness, options).addOption('text', options.text,
|
|
2088
|
-
/* @dynamic */ (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
2089
|
-
}
|
|
2090
|
-
/** Gets the text of the menu item. */
|
|
2091
|
-
getText() {
|
|
2092
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2093
|
-
return (yield this.host()).text();
|
|
2094
|
-
});
|
|
2095
|
-
}
|
|
2096
|
-
/** Whether this item has a submenu. */
|
|
2097
|
-
hasSubmenu() {
|
|
2098
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2099
|
-
return (yield this.host()).matchesSelector(GraniteMenuHarness.hostSelector);
|
|
2100
|
-
});
|
|
2101
|
-
}
|
|
2102
|
-
/** Gets the submenu associated with this menu item, or null if none. */
|
|
2103
|
-
getSubmenu() {
|
|
2104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2105
|
-
if (yield this.hasSubmenu()) {
|
|
2106
|
-
return new GraniteMenuHarness(this.locatorFactory);
|
|
2107
|
-
}
|
|
2108
|
-
return null;
|
|
2109
|
-
});
|
|
2110
|
-
}
|
|
2111
|
-
/** Clicks the menu item. */
|
|
2112
|
-
click() {
|
|
2113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2114
|
-
yield (yield this.host()).click();
|
|
2115
|
-
// This is necessary so that we wait for the opening animation to finish. (i.e. if it opens another menu)
|
|
2116
|
-
return this.forceStabilize();
|
|
2117
|
-
});
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
/** The selector for the host element of a `MenuItemComponent` instance. */
|
|
2121
|
-
GraniteMenuItemHarness.hostSelector = '.granite-menu-item';
|
|
2122
|
-
|
|
2123
|
-
class GraniteToggleSwitchComponent {
|
|
2124
|
-
constructor(_focusMonitor) {
|
|
2125
|
-
this._focusMonitor = _focusMonitor;
|
|
2126
|
-
this.id = null;
|
|
2127
|
-
this.checked = false;
|
|
2128
|
-
this.disabled = false;
|
|
2129
|
-
this.readonly = false;
|
|
2130
|
-
this.labelPosition = 'after';
|
|
2131
|
-
this.ariaLabel = null;
|
|
2132
|
-
this.ariaLabelledby = null;
|
|
2133
|
-
this.valueChange = new EventEmitter();
|
|
2134
|
-
this.toggleChange = new EventEmitter();
|
|
2135
|
-
this.toggleBlur = new EventEmitter();
|
|
2136
|
-
this._positionBefore = false;
|
|
2137
|
-
this._toggleSwitchDisabled = false;
|
|
2138
|
-
}
|
|
2139
|
-
ngOnChanges(changes) {
|
|
2140
|
-
if (changes.checked) {
|
|
2141
|
-
this.checked = coerceBooleanProperty(changes.checked.currentValue);
|
|
2142
|
-
}
|
|
2143
|
-
if (changes.disabled) {
|
|
2144
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2145
|
-
}
|
|
2146
|
-
if (changes.readonly) {
|
|
2147
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2148
|
-
}
|
|
2149
|
-
if (changes.labelPosition != null) {
|
|
2150
|
-
this._positionBefore =
|
|
2151
|
-
changes.labelPosition.currentValue != null &&
|
|
2152
|
-
changes.labelPosition.currentValue === 'before';
|
|
2153
|
-
}
|
|
2154
|
-
if ((changes.disabled || changes.readonly) &&
|
|
2155
|
-
(this.disabled || this.readonly)) {
|
|
2156
|
-
this._toggleSwitchDisabled = true;
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
focus(origin = 'program', options) {
|
|
2160
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2161
|
-
}
|
|
2162
|
-
_onBlur() {
|
|
2163
|
-
this.toggleBlur.emit();
|
|
2164
|
-
}
|
|
2165
|
-
_toggleSwitchChange() {
|
|
2166
|
-
this.checked = this._getInputElement().checked;
|
|
2167
|
-
this.valueChange.emit(this.checked);
|
|
2168
|
-
}
|
|
2169
|
-
_toggleSwitchClick() {
|
|
2170
|
-
this.toggleChange.emit();
|
|
2171
|
-
}
|
|
2172
|
-
_getInputElement() {
|
|
2173
|
-
return this._inputElement.nativeElement;
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
GraniteToggleSwitchComponent.decorators = [
|
|
2177
|
-
{ type: Component, args: [{
|
|
2178
|
-
selector: 'granite-toggle-switch',
|
|
2179
|
-
exportAs: 'graniteToggleSwitch',
|
|
2180
|
-
host: {
|
|
2181
|
-
class: 'granite-toggle-switch',
|
|
2182
|
-
'[class.granite-toggle-switch-checked]': 'checked',
|
|
2183
|
-
'[class.granite-toggle-switch-disabled]': 'disabled',
|
|
2184
|
-
'[class.granite-toggle-switch-readonly]': 'readonly',
|
|
2185
|
-
'[class.granite-toggle-switch-label-before]': '_positionBefore',
|
|
2186
|
-
},
|
|
2187
|
-
template: "<label [attr.for]=\"id\" class=\"granite-toggle-switch-label\">\n <div class=\"granite-toggle-switch-bar\">\n <input\n #input\n [id]=\"id\"\n class=\"granite-toggle-switch-input cdk-visually-hidden\"\n role=\"switch\"\n type=\"checkbox\"\n [attr.aria-checked]=\"checked.toString()\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [checked]=\"checked\"\n [disabled]=\"_toggleSwitchDisabled\"\n [readonly]=\"readonly\"\n (click)=\"_toggleSwitchClick()\"\n (change)=\"_toggleSwitchChange()\"\n (blur)=\"_onBlur()\"\n />\n <div class=\"granite-toggle-switch-thumb\"></div>\n </div>\n <span class=\"granite-toggle-switch-text\"><ng-content></ng-content></span>\n</label>\n",
|
|
2188
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2189
|
-
styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none}:host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit;cursor:pointer}:host(.granite-toggle-switch){color:var(--granite-color-text)}:host(.granite-toggle-switch-checked) .granite-toggle-switch-bar{background-color:var(--granite-color-background-active)}:host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{border:.0625rem solid var(--granite-color-background-active)}:host-context([dir=ltr]) :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb,html[dir=ltr] :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:right}:host-context([dir=rtl]) :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb,html[dir=rtl] :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:left}:host(.granite-toggle-switch-disabled) .granite-toggle-switch-label{opacity:.6}:host(.granite-toggle-switch-disabled) *,:host(.granite-toggle-switch-readonly) *{cursor:default}:host(.granite-toggle-switch-label-before) .granite-toggle-switch-label{flex-direction:row-reverse}:host(.granite-toggle-switch-label-before) .granite-toggle-switch-text{-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:var(--granite-spacing-s);padding-inline-end:var(--granite-spacing-s)}.granite-toggle-switch-label{display:flex;align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content}.granite-toggle-switch-bar{width:2rem;height:1rem;border-radius:.5rem;background-color:var(--granite-color-background-inactive);transition:background-color .1s linear;position:relative}.granite-toggle-switch-bar:focus-within{box-shadow:0 0 0 .0625rem var(--granite-color-focus)}.granite-toggle-switch-thumb{width:1rem;height:1rem;border-radius:1rem;background-color:var(--granite-color-text-static-light);border:.0625rem solid var(--granite-color-background-inactive);transition:float .1s linear}:host-context([dir=ltr]) .granite-toggle-switch-thumb,html[dir=ltr] .granite-toggle-switch-thumb{float:left}:host-context([dir=rtl]) .granite-toggle-switch-thumb,html[dir=rtl] .granite-toggle-switch-thumb{float:right}.granite-toggle-switch-text{-webkit-padding-start:var(--granite-spacing-s);padding-inline-start:var(--granite-spacing-s)}.granite-toggle-switch-text:empty{display:none}"]
|
|
2190
|
-
},] }
|
|
2191
|
-
];
|
|
2192
|
-
GraniteToggleSwitchComponent.ctorParameters = () => [
|
|
2193
|
-
{ type: FocusMonitor }
|
|
2194
|
-
];
|
|
2195
|
-
GraniteToggleSwitchComponent.propDecorators = {
|
|
2196
|
-
id: [{ type: Input }],
|
|
2197
|
-
checked: [{ type: Input }],
|
|
2198
|
-
disabled: [{ type: Input }],
|
|
2199
|
-
readonly: [{ type: Input }],
|
|
2200
|
-
labelPosition: [{ type: Input }],
|
|
2201
|
-
ariaLabel: [{ type: Input, args: ['aria-label',] }],
|
|
2202
|
-
ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }],
|
|
2203
|
-
valueChange: [{ type: Output }],
|
|
2204
|
-
toggleChange: [{ type: Output }],
|
|
2205
|
-
toggleBlur: [{ type: Output }],
|
|
2206
|
-
_inputElement: [{ type: ViewChild, args: ['input',] }]
|
|
2207
|
-
};
|
|
2208
|
-
|
|
2209
|
-
class GraniteToggleSwitchModule {
|
|
2210
|
-
}
|
|
2211
|
-
GraniteToggleSwitchModule.decorators = [
|
|
2212
|
-
{ type: NgModule, args: [{
|
|
2213
|
-
declarations: [GraniteToggleSwitchComponent],
|
|
2214
|
-
exports: [GraniteToggleSwitchComponent],
|
|
2215
|
-
},] }
|
|
2216
|
-
];
|
|
2217
|
-
|
|
2218
|
-
class GraniteRadioButtonComponent {
|
|
2219
|
-
constructor(_focusMonitor, _radioDispatcher) {
|
|
2220
|
-
this._focusMonitor = _focusMonitor;
|
|
2221
|
-
this._radioDispatcher = _radioDispatcher;
|
|
2222
|
-
this.id = null;
|
|
2223
|
-
this.checked = false;
|
|
2224
|
-
this.required = false;
|
|
2225
|
-
this.disabled = false;
|
|
2226
|
-
this.readonly = false;
|
|
2227
|
-
this.labelPosition = 'after';
|
|
2228
|
-
this.ariaLabel = null;
|
|
2229
|
-
this.ariaLabelledby = null;
|
|
2230
|
-
this.radioChange = new EventEmitter();
|
|
2231
|
-
this.radioBlur = new EventEmitter();
|
|
2232
|
-
this._positionBefore = false;
|
|
2233
|
-
this._radioDisabled = false;
|
|
2234
|
-
this._removeUniqueSelectionListener = () => {
|
|
2235
|
-
// Function used to deregister listener
|
|
2236
|
-
};
|
|
2237
|
-
this._removeUniqueSelectionListener = _radioDispatcher.listen((id, name) => {
|
|
2238
|
-
if (id !== this.id && name === this.name) {
|
|
2239
|
-
this.checked = false;
|
|
2240
|
-
}
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
ngOnChanges(changes) {
|
|
2244
|
-
if (changes.checked) {
|
|
2245
|
-
this.checked = coerceBooleanProperty(changes.checked.currentValue);
|
|
2246
|
-
}
|
|
2247
|
-
if (changes.required) {
|
|
2248
|
-
this.required = coerceBooleanProperty(changes.required.currentValue);
|
|
2249
|
-
}
|
|
2250
|
-
if (changes.readonly) {
|
|
2251
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2252
|
-
}
|
|
2253
|
-
if (changes.disabled) {
|
|
2254
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2255
|
-
}
|
|
2256
|
-
if (changes.labelPosition != null) {
|
|
2257
|
-
this._positionBefore =
|
|
2258
|
-
changes.labelPosition.currentValue != null &&
|
|
2259
|
-
changes.labelPosition.currentValue === 'before';
|
|
2260
|
-
}
|
|
2261
|
-
if ((changes.disabled || changes.readonly) &&
|
|
2262
|
-
(this.disabled || this.readonly)) {
|
|
2263
|
-
this._radioDisabled = true;
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
ngOnDestroy() {
|
|
2267
|
-
this._removeUniqueSelectionListener();
|
|
2268
|
-
}
|
|
2269
|
-
// Focuses the radio button.
|
|
2270
|
-
focus(origin = 'program', options) {
|
|
2271
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2272
|
-
}
|
|
2273
|
-
_radioClick(element) {
|
|
2274
|
-
this.radioChange.emit(element === null || element === void 0 ? void 0 : element.value);
|
|
2275
|
-
}
|
|
2276
|
-
_radioChange() {
|
|
2277
|
-
this.checked = this._getInputElement().checked;
|
|
2278
|
-
// Notify all radio buttons with the same name to un-check
|
|
2279
|
-
this._radioDispatcher.notify(this.id, this.name);
|
|
2280
|
-
}
|
|
2281
|
-
_onBlur() {
|
|
2282
|
-
this.radioBlur.emit();
|
|
2283
|
-
}
|
|
2284
|
-
_getInputElement() {
|
|
2285
|
-
return this._inputElement.nativeElement;
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
GraniteRadioButtonComponent.decorators = [
|
|
2289
|
-
{ type: Component, args: [{
|
|
2290
|
-
selector: 'granite-radio-button',
|
|
2291
|
-
exportAs: 'graniteRadioButton',
|
|
2292
|
-
host: {
|
|
2293
|
-
class: 'granite-radio-button',
|
|
2294
|
-
'[class.granite-radio-button-disabled]': 'disabled',
|
|
2295
|
-
'[class.granite-radio-button-label-before]': '_positionBefore',
|
|
2296
|
-
'[class.granite-radio-button-checked]': 'checked',
|
|
2297
|
-
'[class.granite-radio-button-readonly]': 'readonly',
|
|
2298
|
-
},
|
|
2299
|
-
template: "<label class=\"granite-radio-button-label\">\n <div class=\"granite-radio-button-outer-circle\">\n <input\n #input\n [id]=\"id\"\n class=\"granite-radio-button-input cdk-visually-hidden\"\n type=\"radio\"\n [attr.name]=\"name\"\n [disabled]=\"_radioDisabled\"\n [checked]=\"checked\"\n [readonly]=\"readonly\"\n [required]=\"required\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-checked]=\"checked.toString()\"\n [value]=\"value\"\n (click)=\"_radioClick($event.target)\"\n (change)=\"_radioChange()\"\n (blur)=\"_onBlur()\"\n />\n <div class=\"granite-radio-button-inner-circle\"></div>\n </div>\n <span class=\"granite-radio-button-text\">\n <ng-content></ng-content>\n </span>\n</label>\n",
|
|
2300
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2301
|
-
styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-label:hover{cursor:pointer}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-label:hover .granite-radio-button-outer-circle{border-color:var(--granite-color-background-active-hover)}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-label:hover .granite-radio-button-inner-circle{background-color:var(--granite-color-background-active-hover)}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-outer-circle:focus-within{border:.0625rem solid var(--granite-color-focus)}:host(.granite-radio-button-label-before) .granite-radio-button-label{flex-direction:row-reverse}:host(.granite-radio-button-label-before) .granite-radio-button-text{-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:var(--granite-spacing-s);padding-inline-end:var(--granite-spacing-s)}:host(.granite-radio-button-checked) .granite-radio-button-inner-circle{visibility:visible;-webkit-animation:growAnimation .1s;animation:growAnimation .1s}:host(.granite-radio-button-checked) .granite-radio-button-outer-circle{border-color:var(--granite-color-background-active)}:host(.granite-radio-button-checked).granite-radio-button-disabled .granite-radio-button-inner-circle{background-color:var(--granite-color-text)}:host(.granite-radio-button-checked).granite-radio-button-disabled .granite-radio-button-outer-circle{border:.0625rem solid var(--granite-color-text);background-color:transparent}:host(.granite-radio-button-checked).granite-radio-button-readonly .granite-radio-button-inner-circle{background-color:var(--granite-color-text)}:host(.granite-radio-button-checked).granite-radio-button-readonly .granite-radio-button-outer-circle{border:.0625rem solid var(--granite-color-text)}.granite-radio-button-text{-webkit-padding-start:var(--granite-spacing-s);padding-inline-start:var(--granite-spacing-s);color:var(--granite-color-text)}.granite-radio-button-text:empty{display:none}.granite-radio-button-label{display:flex;align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-margin-end:var(--granite-spacing-xl);margin-inline-end:var(--granite-spacing-xl)}:host(.granite-radio-button-disabled) .granite-radio-button-text{opacity:.6}:host(.granite-radio-button-disabled) .granite-radio-button-outer-circle{opacity:.3;background-color:var(--granite-color-border-soft)}.granite-radio-button-outer-circle{height:1rem;width:1rem;border-radius:50%;box-sizing:border-box;border:.0625rem solid var(--granite-color-border-hard);display:flex;justify-content:center;position:relative;align-items:center}.granite-radio-button-inner-circle{width:.625rem;height:.625rem;visibility:hidden;position:absolute;border-radius:50%;background-color:var(--granite-color-background-active);margin:auto}@-webkit-keyframes growAnimation{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes growAnimation{0%{transform:scale(0)}to{transform:scale(1)}}"]
|
|
2302
|
-
},] }
|
|
2303
|
-
];
|
|
2304
|
-
GraniteRadioButtonComponent.ctorParameters = () => [
|
|
2305
|
-
{ type: FocusMonitor },
|
|
2306
|
-
{ type: UniqueSelectionDispatcher }
|
|
2307
|
-
];
|
|
2308
|
-
GraniteRadioButtonComponent.propDecorators = {
|
|
2309
|
-
value: [{ type: Input }],
|
|
2310
|
-
id: [{ type: Input }],
|
|
2311
|
-
name: [{ type: Input }],
|
|
2312
|
-
checked: [{ type: Input }],
|
|
2313
|
-
required: [{ type: Input }],
|
|
2314
|
-
disabled: [{ type: Input }],
|
|
2315
|
-
readonly: [{ type: Input }],
|
|
2316
|
-
labelPosition: [{ type: Input }],
|
|
2317
|
-
ariaLabel: [{ type: Input, args: ['aria-label',] }],
|
|
2318
|
-
ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }],
|
|
2319
|
-
radioChange: [{ type: Output }],
|
|
2320
|
-
radioBlur: [{ type: Output }],
|
|
2321
|
-
_inputElement: [{ type: ViewChild, args: ['input',] }]
|
|
2322
|
-
};
|
|
2323
|
-
|
|
2324
|
-
class GraniteRadioCheckboxBase {
|
|
2325
|
-
constructor() {
|
|
2326
|
-
this.layout = 'horizontal';
|
|
2327
|
-
this.ariaLabelledby = null;
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
GraniteRadioCheckboxBase.decorators = [
|
|
2331
|
-
{ type: Directive }
|
|
2332
|
-
];
|
|
2333
|
-
GraniteRadioCheckboxBase.propDecorators = {
|
|
2334
|
-
layout: [{ type: Input }],
|
|
2335
|
-
ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }]
|
|
2336
|
-
};
|
|
2337
|
-
|
|
2338
|
-
class GraniteRadioGroupComponent extends GraniteRadioCheckboxBase {
|
|
2339
|
-
}
|
|
2340
|
-
GraniteRadioGroupComponent.decorators = [
|
|
2341
|
-
{ type: Component, args: [{
|
|
2342
|
-
selector: 'granite-radio-group',
|
|
2343
|
-
host: {
|
|
2344
|
-
class: 'granite-radio-group',
|
|
2345
|
-
'[attr.role]': '"radiogroup"',
|
|
2346
|
-
'[attr.aria-labelledby]': 'ariaLabelledby',
|
|
2347
|
-
'[class.granite-radio-checkbox-base-layout-horizontal]': 'layout === "horizontal"',
|
|
2348
|
-
},
|
|
2349
|
-
template: '<ng-content></ng-content>',
|
|
2350
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2351
|
-
styles: [":host(.granite-radio-checkbox-base-layout-horizontal){display:flex;align-items:flex-start}"]
|
|
2352
|
-
},] }
|
|
2353
|
-
];
|
|
2354
|
-
|
|
2355
|
-
class GraniteRadioButtonModule {
|
|
2356
|
-
}
|
|
2357
|
-
GraniteRadioButtonModule.decorators = [
|
|
2358
|
-
{ type: NgModule, args: [{
|
|
2359
|
-
declarations: [GraniteRadioButtonComponent, GraniteRadioGroupComponent],
|
|
2360
|
-
exports: [GraniteRadioButtonComponent, GraniteRadioGroupComponent],
|
|
2361
|
-
},] }
|
|
2362
|
-
];
|
|
2363
|
-
|
|
2364
|
-
class GraniteCheckboxComponent {
|
|
2365
|
-
constructor(_focusMonitor) {
|
|
2366
|
-
this._focusMonitor = _focusMonitor;
|
|
2367
|
-
this.id = null;
|
|
2368
|
-
this.checked = false;
|
|
2369
|
-
this.disabled = false;
|
|
2370
|
-
this.readonly = false;
|
|
2371
|
-
this.labelPosition = 'after';
|
|
2372
|
-
this.ariaLabel = null;
|
|
2373
|
-
this.ariaLabelledby = null;
|
|
2374
|
-
this.valueChange = new EventEmitter();
|
|
2375
|
-
this.checkboxChange = new EventEmitter();
|
|
2376
|
-
this.checkboxBlur = new EventEmitter();
|
|
2377
|
-
this._positionBefore = false;
|
|
2378
|
-
this._checkboxDisabled = false;
|
|
2379
|
-
}
|
|
2380
|
-
ngOnChanges(changes) {
|
|
2381
|
-
if (changes.checked) {
|
|
2382
|
-
this.checked = coerceBooleanProperty(changes.checked.currentValue);
|
|
2383
|
-
}
|
|
2384
|
-
if (changes.disabled) {
|
|
2385
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2386
|
-
}
|
|
2387
|
-
if (changes.readonly) {
|
|
2388
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2389
|
-
}
|
|
2390
|
-
if (changes.labelPosition != null) {
|
|
2391
|
-
this._positionBefore =
|
|
2392
|
-
changes.labelPosition.currentValue != null &&
|
|
2393
|
-
changes.labelPosition.currentValue === 'before';
|
|
2394
|
-
}
|
|
2395
|
-
if ((changes.disabled || changes.readonly) &&
|
|
2396
|
-
(this.disabled || this.readonly)) {
|
|
2397
|
-
this._checkboxDisabled = true;
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
focus(origin = 'program', options) {
|
|
2401
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2402
|
-
}
|
|
2403
|
-
_onBlur() {
|
|
2404
|
-
this.checkboxBlur.emit();
|
|
2405
|
-
}
|
|
2406
|
-
_checkboxChange() {
|
|
2407
|
-
this.checked = this._getInputElement().checked;
|
|
2408
|
-
this.valueChange.emit(this.checked);
|
|
2409
|
-
}
|
|
2410
|
-
_checkboxClick() {
|
|
2411
|
-
this.checkboxChange.emit();
|
|
2412
|
-
}
|
|
2413
|
-
_getInputElement() {
|
|
2414
|
-
return this._inputElement.nativeElement;
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
GraniteCheckboxComponent.decorators = [
|
|
2418
|
-
{ type: Component, args: [{
|
|
2419
|
-
selector: 'granite-checkbox',
|
|
2420
|
-
exportAs: 'graniteCheckbox',
|
|
2421
|
-
host: {
|
|
2422
|
-
class: 'granite-checkbox',
|
|
2423
|
-
'[class.granite-checkbox-checked]': 'checked',
|
|
2424
|
-
'[class.granite-checkbox-disabled]': 'disabled',
|
|
2425
|
-
'[class.granite-checkbox-readonly]': 'readonly',
|
|
2426
|
-
'[class.granite-checkbox-label-before]': '_positionBefore',
|
|
2427
|
-
},
|
|
2428
|
-
template: "<label [attr.for]=\"id\" class=\"granite-checkbox-label\">\n <div class=\"granite-checkbox-box\">\n <input\n #input\n [id]=\"id\"\n class=\"granite-checkbox-input cdk-visually-hidden\"\n role=\"checkbox\"\n type=\"checkbox\"\n [attr.aria-checked]=\"checked.toString()\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [checked]=\"checked\"\n [disabled]=\"_checkboxDisabled\"\n [readonly]=\"readonly\"\n (click)=\"_checkboxClick()\"\n (change)=\"_checkboxChange()\"\n (blur)=\"_onBlur()\"\n />\n <div class=\"granite-checkbox-check\"></div>\n </div>\n <span class=\"granite-checkbox-text\"><ng-content></ng-content></span>\n</label>\n",
|
|
2429
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2430
|
-
styles: [".cdk-visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;outline:0;-webkit-appearance:none;-moz-appearance:none}:host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit;cursor:pointer}:host(.granite-checkbox){color:var(--granite-color-text)}:host(.granite-checkbox):not(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-label:hover .granite-checkbox-box{border-color:var(--granite-color-background-active)}:host(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-label:hover .granite-checkbox-box{background-color:var(--granite-color-background-active-hover);border-color:var(--granite-color-background-active-hover)}:host(.granite-checkbox-checked) .granite-checkbox-box{border-color:var(--granite-color-background-active);background-color:var(--granite-color-background-active)}:host(.granite-checkbox-checked) .granite-checkbox-box:focus-within{border-color:var(--granite-color-focus)}:host(.granite-checkbox-checked) .granite-checkbox-check{display:flex}:host(.granite-checkbox-checked):not(.granite-checkbox-readonly):not(.granite-checkbox-disabled) .granite-checkbox-box{-webkit-animation:fadeInAnimation .2s;animation:fadeInAnimation .2s;-webkit-animation-iteration-count:1;animation-iteration-count:1}:host(:not(.granite-checkbox-checked)) .granite-checkbox-box{-webkit-animation:fadeOutAnimation .2s;animation:fadeOutAnimation .2s;-webkit-animation-iteration-count:1;animation-iteration-count:1}:host(.granite-checkbox-readonly.granite-checkbox-checked) .granite-checkbox-box{background-color:var(--granite-color-text);border-color:var(--granite-color-text)}:host(.granite-checkbox-readonly.granite-checkbox-checked) .granite-checkbox-box .granite-checkbox-check{border-color:var(--granite-color-background)}:host(.granite-checkbox-disabled) .granite-checkbox-box{opacity:.3;background-color:var(--granite-color-border-soft)}:host(.granite-checkbox-disabled) .granite-checkbox-label{opacity:.6}:host(.granite-checkbox-disabled) *,:host(.granite-checkbox-readonly) *{cursor:default}:host(.granite-checkbox-label-before) .granite-checkbox-label{flex-direction:row-reverse}:host(.granite-checkbox-label-before) .granite-checkbox-text{-webkit-padding-start:0;padding-inline-start:0;-webkit-padding-end:var(--granite-spacing-s);padding-inline-end:var(--granite-spacing-s)}.granite-checkbox-label{display:flex;align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-margin-end:var(--granite-spacing-xl);margin-inline-end:var(--granite-spacing-xl)}.granite-checkbox-box{width:1rem;height:1rem;border:solid var(--granite-color-background-inactive);border-width:.0625rem;border-radius:.25rem;display:flex;justify-content:center;position:relative}.granite-checkbox-box:focus-within{border:.0625rem solid var(--granite-color-focus)}.granite-checkbox-check{position:relative;display:none;width:.5625rem;height:.3125rem;background-color:transparent;border:solid var(--granite-color-text-static-light);transform:rotate(-45deg);margin-top:var(--granite-spacing-xs);border-width:0 0 .125rem .125rem}.granite-checkbox-text{-webkit-padding-start:var(--granite-spacing-s);padding-inline-start:var(--granite-spacing-s)}.granite-checkbox-text:empty{display:none}@-webkit-keyframes fadeInAnimation{0%{opacity:0}to{opacity:1}}@keyframes fadeInAnimation{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeOutAnimation{0%{opacity:1}to{opacity:0}}@keyframes fadeOutAnimation{0%{opacity:1}to{opacity:0}}"]
|
|
2431
|
-
},] }
|
|
2432
|
-
];
|
|
2433
|
-
GraniteCheckboxComponent.ctorParameters = () => [
|
|
2434
|
-
{ type: FocusMonitor }
|
|
2435
|
-
];
|
|
2436
|
-
GraniteCheckboxComponent.propDecorators = {
|
|
2437
|
-
id: [{ type: Input }],
|
|
2438
|
-
checked: [{ type: Input }],
|
|
2439
|
-
disabled: [{ type: Input }],
|
|
2440
|
-
readonly: [{ type: Input }],
|
|
2441
|
-
labelPosition: [{ type: Input }],
|
|
2442
|
-
ariaLabel: [{ type: Input, args: ['aria-label',] }],
|
|
2443
|
-
ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }],
|
|
2444
|
-
valueChange: [{ type: Output }],
|
|
2445
|
-
checkboxChange: [{ type: Output }],
|
|
2446
|
-
checkboxBlur: [{ type: Output }],
|
|
2447
|
-
_inputElement: [{ type: ViewChild, args: ['input',] }]
|
|
2448
|
-
};
|
|
2449
|
-
|
|
2450
|
-
class GraniteCheckboxGroupComponent extends GraniteRadioCheckboxBase {
|
|
2451
|
-
}
|
|
2452
|
-
GraniteCheckboxGroupComponent.decorators = [
|
|
2453
|
-
{ type: Component, args: [{
|
|
2454
|
-
selector: 'granite-checkbox-group',
|
|
2455
|
-
host: {
|
|
2456
|
-
class: 'granite-checkbox-group',
|
|
2457
|
-
'[attr.role]': '"group"',
|
|
2458
|
-
'[attr.aria-labelledby]': 'ariaLabelledby',
|
|
2459
|
-
'[class.granite-radio-checkbox-base-layout-horizontal]': 'layout === "horizontal"',
|
|
2460
|
-
},
|
|
2461
|
-
template: '<ng-content></ng-content>',
|
|
2462
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2463
|
-
styles: [":host(.granite-radio-checkbox-base-layout-horizontal){display:flex;align-items:flex-start}"]
|
|
2464
|
-
},] }
|
|
2465
|
-
];
|
|
2466
|
-
|
|
2467
|
-
class GraniteCheckboxModule {
|
|
2468
|
-
}
|
|
2469
|
-
GraniteCheckboxModule.decorators = [
|
|
2470
|
-
{ type: NgModule, args: [{
|
|
2471
|
-
declarations: [GraniteCheckboxComponent, GraniteCheckboxGroupComponent],
|
|
2472
|
-
exports: [GraniteCheckboxComponent, GraniteCheckboxGroupComponent],
|
|
2473
|
-
},] }
|
|
2474
|
-
];
|
|
2475
|
-
|
|
2476
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2477
|
-
const disabledMixin = (Base = class {
|
|
2478
|
-
}) => {
|
|
2479
|
-
class Derived extends Base {
|
|
2480
|
-
constructor() {
|
|
2481
|
-
super(...arguments);
|
|
2482
|
-
this.disabled = false;
|
|
2483
|
-
}
|
|
2484
|
-
ngOnChanges(changes) {
|
|
2485
|
-
if (changes.disabled) {
|
|
2486
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
Derived.decorators = [
|
|
2491
|
-
{ type: Directive }
|
|
2492
|
-
];
|
|
2493
|
-
Derived.propDecorators = {
|
|
2494
|
-
disabled: [{ type: Input }]
|
|
2495
|
-
};
|
|
2496
|
-
return Derived;
|
|
2497
|
-
};
|
|
2498
|
-
|
|
2499
|
-
var ButtonSelectors;
|
|
2500
|
-
(function (ButtonSelectors) {
|
|
2501
|
-
ButtonSelectors["graniteButton"] = "granite-button";
|
|
2502
|
-
ButtonSelectors["granitePrimaryButton"] = "granite-primary-button";
|
|
2503
|
-
ButtonSelectors["graniteFlatButton"] = "granite-flat-button";
|
|
2504
|
-
ButtonSelectors["graniteToolbarButton"] = "granite-toolbar-button";
|
|
2505
|
-
})(ButtonSelectors || (ButtonSelectors = {}));
|
|
2506
|
-
const ButtonComponentMixin = disabledMixin();
|
|
2507
|
-
class GraniteButtonComponent extends ButtonComponentMixin {
|
|
2508
|
-
constructor(_focusMonitor, _elementRef) {
|
|
2509
|
-
super();
|
|
2510
|
-
this._focusMonitor = _focusMonitor;
|
|
2511
|
-
this._elementRef = _elementRef;
|
|
2512
|
-
this.toggled = false;
|
|
2513
|
-
this._buttonToggled = false;
|
|
2514
|
-
for (const selector of Object.keys(ButtonSelectors)) {
|
|
2515
|
-
if (this._getHostElement().hasAttribute(selector)) {
|
|
2516
|
-
this._getHostElement().classList.add(ButtonSelectors[selector]);
|
|
2517
|
-
}
|
|
2518
|
-
}
|
|
2519
|
-
}
|
|
2520
|
-
ngOnChanges(changes) {
|
|
2521
|
-
super.ngOnChanges(changes);
|
|
2522
|
-
if (changes.toggled &&
|
|
2523
|
-
(this._getHostElement().classList.contains(ButtonSelectors.graniteFlatButton) ||
|
|
2524
|
-
this._getHostElement().classList.contains(ButtonSelectors.graniteToolbarButton))) {
|
|
2525
|
-
this._buttonToggled = coerceBooleanProperty(changes.toggled.currentValue);
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
focus(origin = 'program', options) {
|
|
2529
|
-
this._focusMonitor.focusVia(this._getHostElement(), origin, options);
|
|
2530
|
-
}
|
|
2531
|
-
_getHostElement() {
|
|
2532
|
-
return this._elementRef.nativeElement;
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
GraniteButtonComponent.decorators = [
|
|
2536
|
-
{ type: Component, args: [{
|
|
2537
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2538
|
-
selector: `button[graniteButton],
|
|
2539
|
-
button[granitePrimaryButton],
|
|
2540
|
-
button[graniteFlatButton],
|
|
2541
|
-
button[graniteToolbarButton]
|
|
2542
|
-
`,
|
|
2543
|
-
host: {
|
|
2544
|
-
class: 'granite-button-base',
|
|
2545
|
-
'[class.granite-button-disabled]': 'disabled',
|
|
2546
|
-
'[class.granite-button-toggled]': '_buttonToggled',
|
|
2547
|
-
'[attr.disabled]': 'disabled || null',
|
|
2548
|
-
},
|
|
2549
|
-
exportAs: 'graniteButton',
|
|
2550
|
-
template: '<ng-content></ng-content>',
|
|
2551
|
-
inputs: ['disabled'],
|
|
2552
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2553
|
-
styles: [":host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit;cursor:pointer}button:host{background-color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;font:inherit;border-radius:inherit;height:inherit;font-weight:inherit;line-height:inherit;color:inherit;margin:inherit;cursor:pointer;padding:inherit}a:host,button:host{outline:none}:host.granite-button-base{border-radius:.25rem;font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);padding:var(--granite-spacing-s) var(--granite-spacing-s);position:relative;line-height:var(--granite-font-size-body);display:flex;justify-content:center;align-items:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host:focus:not(.granite-button-disabled):not(:active){outline-offset:-2px;outline-width:.125rem;outline-color:var(--granite-color-focus);outline-style:solid}button:host.granite-button{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);outline:.0625rem solid var(--granite-color-border-soft);outline-offset:-1px}button:host.granite-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}button:host.granite-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}button:host.granite-button.granite-button-toggled{background-color:none;color:none;outline:none}button:host.granite-primary-button{background-color:var(--granite-color-background-active);color:var(--granite-color-text-on-active);outline:none;outline-offset:-1px}button:host.granite-primary-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:none;outline:none}button:host.granite-primary-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:none;outline:none}button:host.granite-primary-button.granite-button-toggled{background-color:none;color:none;outline:none}button:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text);outline:none;outline-offset:-1px}button:host.granite-flat-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}button:host.granite-flat-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}button:host.granite-flat-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus);outline:none}button:host.granite-toolbar-button{background-color:var(--granite-color-background);color:var(--granite-color-text);outline:.0625rem solid var(--granite-color-border-soft);outline-offset:-1px}button:host.granite-toolbar-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}button:host.granite-toolbar-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}button:host.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus);outline:none}button:host.granite-button-disabled,button:host.granite-button-disabled:active,button:host.granite-button-disabled:focus,button:host.granite-button-disabled:hover{opacity:.4;cursor:default}a:host.granite-button{background-color:var(--granite-color-background);color:var(--granite-color-text-link);outline:.0625rem solid var(--granite-color-border-soft);outline-offset:-1px}a:host.granite-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}a:host.granite-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}a:host.granite-button.granite-button-toggled{background-color:none;color:none;outline:none}a:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text-link);outline:none;outline-offset:-1px}a:host.granite-flat-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}a:host.granite-flat-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}a:host.granite-flat-button.granite-button-toggled{background-color:none;color:none;outline:none}a:host.granite-button-disabled,a:host.granite-button-disabled:active,a:host.granite-button-disabled:focus,a:host.granite-button-disabled:hover{opacity:.4;text-decoration:none;cursor:default;pointer-events:none;-moz-user-select:none;-webkit-user-select:none;user-select:none}"]
|
|
2554
|
-
},] }
|
|
2555
|
-
];
|
|
2556
|
-
GraniteButtonComponent.ctorParameters = () => [
|
|
2557
|
-
{ type: FocusMonitor },
|
|
2558
|
-
{ type: ElementRef }
|
|
2559
|
-
];
|
|
2560
|
-
GraniteButtonComponent.propDecorators = {
|
|
2561
|
-
toggled: [{ type: Input }]
|
|
2562
|
-
};
|
|
2563
|
-
class GraniteAnchorComponent extends GraniteButtonComponent {
|
|
2564
|
-
constructor(_focusMonitor, _elementRef) {
|
|
2565
|
-
super(_focusMonitor, _elementRef);
|
|
2566
|
-
this._focusMonitor = _focusMonitor;
|
|
2567
|
-
this._elementRef = _elementRef;
|
|
2568
|
-
}
|
|
2569
|
-
_anchorClick(event) {
|
|
2570
|
-
if (this.disabled) {
|
|
2571
|
-
event.preventDefault();
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
ngOnChanges(changes) {
|
|
2575
|
-
super.ngOnChanges(changes);
|
|
2576
|
-
}
|
|
2577
|
-
}
|
|
2578
|
-
GraniteAnchorComponent.decorators = [
|
|
2579
|
-
{ type: Component, args: [{
|
|
2580
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2581
|
-
selector: `a[graniteButton],
|
|
2582
|
-
a[graniteFlatButton]`,
|
|
2583
|
-
host: {
|
|
2584
|
-
class: 'granite-button-base',
|
|
2585
|
-
'[attr.tabindex]': 'disabled ? -1 : 0',
|
|
2586
|
-
'[class.granite-button-disabled]': 'disabled',
|
|
2587
|
-
},
|
|
2588
|
-
exportAs: 'graniteAnchor',
|
|
2589
|
-
template: '<ng-content></ng-content>',
|
|
2590
|
-
inputs: ['disabled'],
|
|
2591
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2592
|
-
styles: [":host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit;cursor:pointer}button:host{background-color:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;font:inherit;border-radius:inherit;height:inherit;font-weight:inherit;line-height:inherit;color:inherit;margin:inherit;cursor:pointer;padding:inherit}a:host,button:host{outline:none}:host.granite-button-base{border-radius:.25rem;font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);padding:var(--granite-spacing-s) var(--granite-spacing-s);position:relative;line-height:var(--granite-font-size-body);display:flex;justify-content:center;align-items:center;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host:focus:not(.granite-button-disabled):not(:active){outline-offset:-2px;outline-width:.125rem;outline-color:var(--granite-color-focus);outline-style:solid}button:host.granite-button{background-color:var(--granite-color-background-variant);color:var(--granite-color-text);outline:.0625rem solid var(--granite-color-border-soft);outline-offset:-1px}button:host.granite-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}button:host.granite-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}button:host.granite-button.granite-button-toggled{background-color:none;color:none;outline:none}button:host.granite-primary-button{background-color:var(--granite-color-background-active);color:var(--granite-color-text-on-active);outline:none;outline-offset:-1px}button:host.granite-primary-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:none;outline:none}button:host.granite-primary-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:none;outline:none}button:host.granite-primary-button.granite-button-toggled{background-color:none;color:none;outline:none}button:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text);outline:none;outline-offset:-1px}button:host.granite-flat-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}button:host.granite-flat-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}button:host.granite-flat-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus);outline:none}button:host.granite-toolbar-button{background-color:var(--granite-color-background);color:var(--granite-color-text);outline:.0625rem solid var(--granite-color-border-soft);outline-offset:-1px}button:host.granite-toolbar-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}button:host.granite-toolbar-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}button:host.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus);outline:none}button:host.granite-button-disabled,button:host.granite-button-disabled:active,button:host.granite-button-disabled:focus,button:host.granite-button-disabled:hover{opacity:.4;cursor:default}a:host.granite-button{background-color:var(--granite-color-background);color:var(--granite-color-text-link);outline:.0625rem solid var(--granite-color-border-soft);outline-offset:-1px}a:host.granite-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}a:host.granite-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}a:host.granite-button.granite-button-toggled{background-color:none;color:none;outline:none}a:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text-link);outline:none;outline-offset:-1px}a:host.granite-flat-button:hover:not(.granite-button-disabled){background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active);outline:none}a:host.granite-flat-button:active:not(.granite-button-disabled){background-color:var(--granite-color-background-active-pressed);color:var(--granite-color-text-on-active);outline:none}a:host.granite-flat-button.granite-button-toggled{background-color:none;color:none;outline:none}a:host.granite-button-disabled,a:host.granite-button-disabled:active,a:host.granite-button-disabled:focus,a:host.granite-button-disabled:hover{opacity:.4;text-decoration:none;cursor:default;pointer-events:none;-moz-user-select:none;-webkit-user-select:none;user-select:none}"]
|
|
2593
|
-
},] }
|
|
2594
|
-
];
|
|
2595
|
-
GraniteAnchorComponent.ctorParameters = () => [
|
|
2596
|
-
{ type: FocusMonitor },
|
|
2597
|
-
{ type: ElementRef }
|
|
2598
|
-
];
|
|
2599
|
-
GraniteAnchorComponent.propDecorators = {
|
|
2600
|
-
_anchorClick: [{ type: HostListener, args: ['click', ['$event'],] }]
|
|
2601
|
-
};
|
|
2602
|
-
|
|
2603
|
-
class GraniteButtonModule {
|
|
2604
|
-
}
|
|
2605
|
-
GraniteButtonModule.decorators = [
|
|
2606
|
-
{ type: NgModule, args: [{
|
|
2607
|
-
declarations: [GraniteButtonComponent, GraniteAnchorComponent],
|
|
2608
|
-
exports: [GraniteButtonComponent, GraniteAnchorComponent],
|
|
2609
|
-
},] }
|
|
2610
|
-
];
|
|
2611
|
-
|
|
2612
|
-
class GraniteTableColumnDirective {
|
|
2613
|
-
}
|
|
2614
|
-
GraniteTableColumnDirective.decorators = [
|
|
2615
|
-
{ type: Directive, args: [{
|
|
2616
|
-
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
2617
|
-
selector: 'granite-table-column',
|
|
2618
|
-
},] }
|
|
2619
|
-
];
|
|
2620
|
-
GraniteTableColumnDirective.propDecorators = {
|
|
2621
|
-
name: [{ type: Input }],
|
|
2622
|
-
title: [{ type: Input }],
|
|
2623
|
-
staticType: [{ type: Input }],
|
|
2624
|
-
tableCellTemplateRef: [{ type: ContentChild, args: ['graniteTableCellTemplate', { static: false },] }]
|
|
2625
|
-
};
|
|
2626
|
-
|
|
2627
|
-
class TableConstants {
|
|
2628
|
-
}
|
|
2629
|
-
TableConstants.CELL_ID_PREFIX = 'granite-cell';
|
|
2630
|
-
|
|
2631
|
-
class GraniteTableComponent {
|
|
2632
|
-
constructor() {
|
|
2633
|
-
this.ariaLabel = null;
|
|
2634
|
-
this.cellIdPrefix = TableConstants.CELL_ID_PREFIX;
|
|
2635
|
-
}
|
|
2636
|
-
ngAfterContentInit() {
|
|
2637
|
-
this.columns = this.tableColumnsComponent.toArray();
|
|
2638
|
-
this.renderedColumns = this.columns.map((column) => column.name);
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
GraniteTableComponent.decorators = [
|
|
2642
|
-
{ type: Component, args: [{
|
|
2643
|
-
selector: 'granite-table',
|
|
2644
|
-
template: "<cdk-table\n [dataSource]=\"dataSource\"\n multiTemplateDataRows\n [trackBy]=\"trackBy\"\n [attr.aria-label]=\"ariaLabel\"\n>\n <ng-container\n *ngFor=\"let column of columns; index as columnI\"\n [cdkColumnDef]=\"column.name\"\n >\n <!-- Cell Header -->\n <cdk-header-cell *cdkHeaderCellDef graniteTableHeaderCell>\n {{ (column.title ? column.title : column.name) | graniteTitle }}\n </cdk-header-cell>\n\n <!-- Cell Data -->\n <cdk-cell\n graniteTableDataCell\n *cdkCellDef=\"let row; let rowI = dataIndex\"\n [id]=\"cellIdPrefix + '-' + rowI + '-' + columnI\"\n [value]=\"row[column.name]\"\n [rowIndex]=\"rowI\"\n [columnIndex]=\"columnI\"\n [staticType]=\"column.staticType\"\n [column]=\"column\"\n [tableCellTemplateRef]=\"column.tableCellTemplateRef\"\n [row]=\"row\"\n ></cdk-cell>\n </ng-container>\n\n <cdk-header-row *cdkHeaderRowDef=\"renderedColumns\"></cdk-header-row>\n <cdk-row\n *cdkRowDef=\"let row; let rowI = dataIndex; columns: renderedColumns\"\n [attr.aria-rowindex]=\"rowI + 1\"\n ></cdk-row>\n</cdk-table>\n",
|
|
2645
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2646
|
-
styles: [":host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit}cdk-table{flex-direction:column;background-color:var(--granite-color-background-variant)}cdk-header-row,cdk-row,cdk-table{display:flex}cdk-cell,cdk-header-cell{flex:1;height:2.5rem}cdk-cell{border-top:1px solid var(--granite-color-border-soft)}"]
|
|
2647
|
-
},] }
|
|
2648
|
-
];
|
|
2649
|
-
GraniteTableComponent.propDecorators = {
|
|
2650
|
-
dataSource: [{ type: Input }],
|
|
2651
|
-
trackBy: [{ type: Input }],
|
|
2652
|
-
ariaLabel: [{ type: Input, args: ['aria-label',] }],
|
|
2653
|
-
tableColumnsComponent: [{ type: ContentChildren, args: [GraniteTableColumnDirective,] }]
|
|
2654
|
-
};
|
|
2655
|
-
|
|
2656
|
-
class GraniteCell {
|
|
2657
|
-
}
|
|
2658
|
-
GraniteCell.decorators = [
|
|
2659
|
-
{ type: Directive }
|
|
2660
|
-
];
|
|
2661
|
-
GraniteCell.propDecorators = {
|
|
2662
|
-
id: [{ type: Input }],
|
|
2663
|
-
column: [{ type: Input }]
|
|
2664
|
-
};
|
|
2665
|
-
|
|
2666
|
-
class GraniteTableDataCellComponent extends GraniteCell {
|
|
2667
|
-
}
|
|
2668
|
-
GraniteTableDataCellComponent.decorators = [
|
|
2669
|
-
{ type: Component, args: [{
|
|
2670
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2671
|
-
selector: 'cdk-cell[graniteTableDataCell]',
|
|
2672
|
-
template: "<span class=\"granite-table-data-cell-static-container\">\n <ng-template\n [ngTemplateOutlet]=\"tableCellTemplateRef || defaultTableCellTemplate\"\n [ngTemplateOutletContext]=\"{\n data: value,\n rowIndex: rowIndex,\n columnIndex: columnIndex,\n column: column,\n row: row\n }\"\n ></ng-template>\n</span>\n\n<ng-template #defaultTableCellTemplate>\n <ng-container [ngSwitch]=\"staticType\">\n <ng-container *ngSwitchCase=\"'badge'\">\n <granite-badge>{{ value }}</granite-badge>\n </ng-container>\n <ng-container *ngSwitchDefault>{{ value }}</ng-container>\n </ng-container>\n</ng-template>\n",
|
|
2673
|
-
styles: [":host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit}.granite-table-data-cell-static-container{padding:var(--granite-spacing-s);height:inherit;font-size:var(--granite-font-size-body-small);line-height:var(--granite-line-height-regular);display:flex;justify-content:center;align-items:center;color:var(--granite-color-text)}"]
|
|
2674
|
-
},] }
|
|
2675
|
-
];
|
|
2676
|
-
GraniteTableDataCellComponent.propDecorators = {
|
|
2677
|
-
value: [{ type: Input }],
|
|
2678
|
-
staticType: [{ type: Input }],
|
|
2679
|
-
rowIndex: [{ type: Input }],
|
|
2680
|
-
columnIndex: [{ type: Input }],
|
|
2681
|
-
tableCellTemplateRef: [{ type: Input }],
|
|
2682
|
-
row: [{ type: Input }]
|
|
2683
|
-
};
|
|
2684
|
-
|
|
2685
|
-
class GraniteTableHeaderCellComponent extends GraniteCell {
|
|
2686
|
-
}
|
|
2687
|
-
GraniteTableHeaderCellComponent.decorators = [
|
|
2688
|
-
{ type: Component, args: [{
|
|
2689
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
2690
|
-
selector: 'cdk-header-cell[graniteTableHeaderCell]',
|
|
2691
|
-
template: "<span class=\"granite-table-header-cell-title\">\n <ng-content></ng-content>\n</span>\n",
|
|
2692
|
-
styles: [":host{box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit}.granite-table-header-cell-title{padding:var(--granite-spacing-s);height:inherit;font-size:var(--granite-font-size-micro);line-height:var(--granite-line-height-flowing);letter-spacing:.015em;font-weight:400;display:flex;justify-content:center;align-items:center;color:var(--granite-color-text-weak)}"]
|
|
2693
|
-
},] }
|
|
2694
|
-
];
|
|
2695
|
-
|
|
2696
|
-
class GraniteTitlePipe {
|
|
2697
|
-
transform(value) {
|
|
2698
|
-
const words = value.split(/(?=[A-Z ])/);
|
|
2699
|
-
return words
|
|
2700
|
-
.map((word) => word.trim())
|
|
2701
|
-
.filter(Boolean)
|
|
2702
|
-
.map((word) => word.charAt(0).toLocaleUpperCase() + word.slice(1))
|
|
2703
|
-
.join(' ');
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
GraniteTitlePipe.decorators = [
|
|
2707
|
-
{ type: Pipe, args: [{
|
|
2708
|
-
name: 'graniteTitle',
|
|
2709
|
-
},] }
|
|
2710
|
-
];
|
|
2711
|
-
|
|
2712
|
-
class PurePipesModule {
|
|
2713
|
-
}
|
|
2714
|
-
PurePipesModule.decorators = [
|
|
2715
|
-
{ type: NgModule, args: [{
|
|
2716
|
-
exports: [GraniteTitlePipe],
|
|
2717
|
-
declarations: [GraniteTitlePipe],
|
|
2718
|
-
},] }
|
|
2719
|
-
];
|
|
2720
|
-
|
|
2721
|
-
class GraniteTableModule {
|
|
2722
|
-
}
|
|
2723
|
-
GraniteTableModule.decorators = [
|
|
2724
|
-
{ type: NgModule, args: [{
|
|
2725
|
-
declarations: [
|
|
2726
|
-
GraniteTableComponent,
|
|
2727
|
-
GraniteTableDataCellComponent,
|
|
2728
|
-
GraniteTableHeaderCellComponent,
|
|
2729
|
-
GraniteTableColumnDirective,
|
|
2730
|
-
],
|
|
2731
|
-
imports: [CommonModule, CdkTableModule, GraniteBadgeModule, PurePipesModule],
|
|
2732
|
-
exports: [GraniteTableComponent, GraniteTableColumnDirective],
|
|
2733
|
-
},] }
|
|
2734
|
-
];
|
|
2735
|
-
|
|
2736
|
-
const GRANITE_INPUT_INCLUDES = ['text', 'number', 'password', 'textarea'];
|
|
2737
|
-
class GraniteInputFieldComponent {
|
|
2738
|
-
constructor(_focusMonitor) {
|
|
2739
|
-
this._focusMonitor = _focusMonitor;
|
|
2740
|
-
this.id = null;
|
|
2741
|
-
this.name = null;
|
|
2742
|
-
this.type = 'text';
|
|
2743
|
-
this.value = '';
|
|
2744
|
-
this.required = false;
|
|
2745
|
-
this.readonly = false;
|
|
2746
|
-
this.invalid = false;
|
|
2747
|
-
this.disabled = false;
|
|
2748
|
-
this.placeholder = '';
|
|
2749
|
-
this.maxlength = 255;
|
|
2750
|
-
this.countcharacters = false;
|
|
2751
|
-
this.ariaLabel = null;
|
|
2752
|
-
this.ariaLabelledby = null;
|
|
2753
|
-
this.valueChange = new EventEmitter();
|
|
2754
|
-
this._supported = true;
|
|
2755
|
-
this._empty = false;
|
|
2756
|
-
this._passwordFieldIcon = 'view';
|
|
2757
|
-
this._passwordField = false;
|
|
2758
|
-
this._currentCharCount = 0;
|
|
2759
|
-
this._passwordToggled = false;
|
|
2760
|
-
}
|
|
2761
|
-
ngOnInit() {
|
|
2762
|
-
this._validateType();
|
|
2763
|
-
this._passwordField = this.type == 'password';
|
|
2764
|
-
this._empty = this.value == null || this.value === '';
|
|
2765
|
-
}
|
|
2766
|
-
ngOnChanges(changes) {
|
|
2767
|
-
if (changes.required) {
|
|
2768
|
-
this.required = coerceBooleanProperty(changes.required.currentValue);
|
|
2769
|
-
}
|
|
2770
|
-
if (changes.readonly) {
|
|
2771
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2772
|
-
}
|
|
2773
|
-
if (changes.invalid) {
|
|
2774
|
-
this.invalid = coerceBooleanProperty(changes.invalid.currentValue);
|
|
2775
|
-
}
|
|
2776
|
-
if (changes.disabled) {
|
|
2777
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2778
|
-
}
|
|
2779
|
-
if (changes.countcharacters) {
|
|
2780
|
-
this.countcharacters = coerceBooleanProperty(changes.countcharacters.currentValue);
|
|
2781
|
-
}
|
|
2782
|
-
if (changes.value) {
|
|
2783
|
-
this._empty = this.value == null || this.value === '';
|
|
2784
|
-
}
|
|
2785
|
-
if (changes.type) {
|
|
2786
|
-
this._validateType();
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
focus(origin = 'program', options) {
|
|
2790
|
-
if (this.type === 'text') {
|
|
2791
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2792
|
-
}
|
|
2793
|
-
else if (this.type === 'textarea') {
|
|
2794
|
-
this._focusMonitor.focusVia(this._getTextareaElement(), origin, options);
|
|
2795
|
-
}
|
|
2796
|
-
}
|
|
2797
|
-
_togglePassword() {
|
|
2798
|
-
if (this._passwordToggled) {
|
|
2799
|
-
this._passwordToggled = false;
|
|
2800
|
-
this.type = 'password';
|
|
2801
|
-
this._passwordFieldIcon = 'view';
|
|
2802
|
-
}
|
|
2803
|
-
else {
|
|
2804
|
-
this._passwordToggled = true;
|
|
2805
|
-
this.type = 'text';
|
|
2806
|
-
this._passwordFieldIcon = 'view-disabled';
|
|
2807
|
-
}
|
|
2808
|
-
}
|
|
2809
|
-
_onKeyUp(event) {
|
|
2810
|
-
const inputEvent = event.target;
|
|
2811
|
-
this._applyCharacterCount(inputEvent.value);
|
|
2812
|
-
this._empty = inputEvent.value == null || inputEvent.value === '';
|
|
2813
|
-
this.valueChange.emit(inputEvent.value);
|
|
2814
|
-
}
|
|
2815
|
-
_onInput(event) {
|
|
2816
|
-
const inputEvent = event.target;
|
|
2817
|
-
this._empty = inputEvent.value == null || inputEvent.value === '';
|
|
2818
|
-
this.valueChange.emit(inputEvent.value);
|
|
2819
|
-
}
|
|
2820
|
-
_validateType() {
|
|
2821
|
-
if (GRANITE_INPUT_INCLUDES.indexOf(this.type) < 0) {
|
|
2822
|
-
this._supported = false;
|
|
2823
|
-
throw Error(`Input type "${this.type}" isn't supported by graniteInputField.`);
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
_applyCharacterCount(inputString) {
|
|
2827
|
-
if (this.countcharacters) {
|
|
2828
|
-
this._currentCharCount = inputString.length;
|
|
2829
|
-
if (this._currentCharCount > this.maxlength) {
|
|
2830
|
-
inputString = inputString.slice(0, this.maxlength);
|
|
2831
|
-
this._currentCharCount = this.maxlength;
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
_getInputElement() {
|
|
2836
|
-
return this._inputElement.nativeElement;
|
|
2837
|
-
}
|
|
2838
|
-
_getTextareaElement() {
|
|
2839
|
-
return this._textareaElement.nativeElement;
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
GraniteInputFieldComponent.decorators = [
|
|
2843
|
-
{ type: Component, args: [{
|
|
2844
|
-
selector: 'granite-input-field',
|
|
2845
|
-
exportAs: 'graniteInputField',
|
|
2846
|
-
template: "<div\n *ngIf=\"_supported\"\n class=\"granite-input-container\"\n [class.granite-input-disabled]=\"disabled\"\n [class.granite-input-readonly]=\"readonly\"\n [class.granite-input-disabled]=\"disabled\"\n [class.granite-input-readonly]=\"readonly\"\n>\n <div\n class=\"granite-input-top-row\"\n [class.granite-input-required]=\"required\"\n [class.granite-input-empty]=\"_empty\"\n [class.granite-input-disabled]=\"disabled\"\n [class.granite-input-readonly]=\"readonly\"\n >\n <div\n *ngIf=\"prefixicon\"\n class=\"granite-input-prepend\"\n [class.granite-input-required]=\"required\"\n [class.granite-input-empty]=\"_empty\"\n >\n <granite-icon class=\"granite-input-prepend-icon\">\n {{ prefixicon }}\n </granite-icon>\n </div>\n\n <ng-container\n *ngIf=\"type != 'textarea'; then inputElement; else textareaElement\"\n ></ng-container>\n\n <ng-template #inputElement>\n <input\n #input\n [id]=\"id\"\n class=\"granite-input-base\"\n [class.granite-input-invalid]=\"invalid\"\n [class.granite-input-empty]=\"_empty\"\n [name]=\"name\"\n [attr.type]=\"type\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [attr.maxlength]=\"maxlength\"\n [value]=\"value\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-invalid]=\"invalid\"\n (keyup)=\"_onKeyUp($event)\"\n (input)=\"_onInput($event)\"\n />\n </ng-template>\n\n <button\n *ngIf=\"_passwordField\"\n class=\"granite-input-append\"\n [class.granite-input-required]=\"required\"\n [class.granite-input-empty]=\"_empty\"\n (click)=\"_togglePassword()\"\n >\n <granite-icon class=\"granite-input-password-toggle-icon\">\n {{ _passwordFieldIcon }}\n </granite-icon>\n </button>\n\n <ng-template #textareaElement>\n <textarea\n #textarea\n [id]=\"id\"\n class=\"granite-input-base granite-text-area\"\n [class.granite-input-invalid]=\"invalid\"\n [class.granite-input-empty]=\"_empty\"\n rows=\"1\"\n [name]=\"name\"\n [attr.type]=\"type\"\n [required]=\"required\"\n [readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [value]=\"value\"\n [attr.maxlength]=\"maxlength\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledby\"\n [attr.aria-required]=\"required\"\n [attr.aria-invalid]=\"invalid\"\n (keyup)=\"_onKeyUp($event)\"\n (input)=\"_onInput($event)\"\n ></textarea>\n </ng-template>\n\n <div\n class=\"granite-input-hover-bar\"\n [class.granite-input-invalid]=\"invalid\"\n [class.granite-input-empty]=\"_empty\"\n ></div>\n </div>\n\n <div *ngIf=\"countcharacters\" class=\"granite-input-bottom-row\">\n <div class=\"granite-input-char-count\">\n {{ _currentCharCount }}/{{ maxlength }}\n </div>\n </div>\n</div>\n",
|
|
2847
|
-
host: {
|
|
2848
|
-
class: 'granite-input-field',
|
|
2849
|
-
},
|
|
2850
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2851
|
-
styles: [":host{transition:all .2s ease-out;width:14.5rem;box-sizing:border-box}:host *,:host :after,:host :before{box-sizing:inherit}.granite-input-container{width:inherit;font-size:var(--granite-font-size-body-small)}.granite-input-container .granite-input-top-row{display:inline-flex;width:inherit;position:relative;background:var(--granite-color-background)}.granite-input-container .granite-input-top-row:hover .granite-input-hover-bar{height:.125rem}.granite-input-container .granite-input-top-row:hover .granite-input-hover-bar.granite-input-invalid.granite-input-empty{background-color:var(--granite-color-focus)}.granite-input-container .granite-input-top-row .granite-text-area{min-width:14.5rem;min-height:2rem}.granite-input-container .granite-input-top-row.granite-input-disabled,.granite-input-container .granite-input-top-row.granite-input-readonly{background-color:transparent;box-shadow:none}.granite-input-container .granite-input-top-row.granite-input-disabled .granite-input-hover-bar,.granite-input-container .granite-input-top-row.granite-input-readonly .granite-input-hover-bar{background-color:transparent}.granite-input-container .granite-input-top-row .granite-input-base{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none;background-color:var(--granite-color-background-input);padding:var(--granite-spacing-s);width:inherit;color:var(--granite-color-text);font:inherit;font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-regular)}.granite-input-container .granite-input-top-row .granite-input-base:required.granite-input-empty{background-color:var(--granite-color-background-failure)}.granite-input-container .granite-input-top-row .granite-input-base:required::-moz-placeholder{color:var(--granite-color-text-weak)}.granite-input-container .granite-input-top-row .granite-input-base:required::placeholder{color:var(--granite-color-text-weak)}.granite-input-container .granite-input-top-row .granite-input-base:-moz-read-only{background-color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:read-only{background-color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:disabled{opacity:.3}.granite-input-container .granite-input-top-row .granite-input-base::-moz-placeholder{color:var(--granite-color-text-hint)}.granite-input-container .granite-input-top-row .granite-input-base::placeholder{color:var(--granite-color-text-hint)}.granite-input-container .granite-input-top-row .granite-input-base:hover::-moz-placeholder{color:var(--granite-color-text)}.granite-input-container .granite-input-top-row .granite-input-base:hover::placeholder{color:var(--granite-color-text)}.granite-input-container .granite-input-top-row .granite-input-base:focus{box-shadow:inset 0 .125rem var(--granite-color-focus),inset .125rem 0 var(--granite-color-focus),inset -.125rem 0 var(--granite-color-focus),inset 0 -.125rem var(--granite-color-focus)}.granite-input-container .granite-input-top-row .granite-input-base:focus.granite-input-invalid{box-shadow:inset 0 -.125rem var(--granite-color-signal-failure),inset 0 .125rem var(--granite-color-focus),inset .125rem 0 var(--granite-color-focus),inset -.125rem 0 var(--granite-color-focus)}.granite-input-container .granite-input-top-row .granite-input-base:focus::-moz-placeholder{color:transparent}.granite-input-container .granite-input-top-row .granite-input-base:focus::placeholder{color:transparent}.granite-input-container .granite-input-top-row .granite-input-hover-bar{height:.0625rem;background-color:var(--granite-color-border-hard);position:absolute;width:inherit;bottom:0}.granite-input-container .granite-input-top-row .granite-input-hover-bar.granite-input-invalid{background-color:var(--granite-color-signal-failure)}.granite-input-container .granite-input-top-row:focus-within .granite-input-hover-bar{background-color:transparent}.granite-input-container .granite-input-prepend{display:flex;align-items:center;padding:0 var(--granite-spacing-s);background:var(--granite-color-background-input)}.granite-input-container .granite-input-prepend .granite-input-prepend-icon{width:1rem;height:1rem;color:var(--granite-color-text);box-shadow:none}.granite-input-container .granite-input-prepend.granite-input-required.granite-input-empty{background-color:var(--granite-color-background-failure)}.granite-input-container .granite-input-append{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none;background-color:var(--granite-color-background-input);position:relative}.granite-input-container .granite-input-append:focus{box-shadow:inset 0 .125rem var(--granite-color-focus),inset .125rem 0 var(--granite-color-focus),inset -.125rem 0 var(--granite-color-focus),inset 0 -.125rem var(--granite-color-focus)}.granite-input-container .granite-input-append .granite-input-password-toggle-icon{width:-webkit-max-content;width:-moz-max-content;width:max-content;height:-webkit-max-content;height:-moz-max-content;height:max-content;color:var(--granite-color-text);box-shadow:none}.granite-input-container .granite-input-append.granite-input-required.granite-input-empty{background-color:var(--granite-color-background-failure)}.granite-input-container .granite-input-bottom-row{box-shadow:none}.granite-input-container .granite-input-char-count{background:var(--granite-color-background-warning);border-radius:0 0 .25rem .25rem;padding:var(--granite-spacing-s);background-size:contain;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;box-shadow:none}.granite-input-container.granite-input-disabled,.granite-input-container.granite-input-readonly{background-color:transparent}"]
|
|
2852
|
-
},] }
|
|
2853
|
-
];
|
|
2854
|
-
GraniteInputFieldComponent.ctorParameters = () => [
|
|
2855
|
-
{ type: FocusMonitor }
|
|
2856
|
-
];
|
|
2857
|
-
GraniteInputFieldComponent.propDecorators = {
|
|
2858
|
-
id: [{ type: Input }],
|
|
2859
|
-
name: [{ type: Input }],
|
|
2860
|
-
type: [{ type: Input }],
|
|
2861
|
-
value: [{ type: Input }],
|
|
2862
|
-
required: [{ type: Input }],
|
|
2863
|
-
readonly: [{ type: Input }],
|
|
2864
|
-
invalid: [{ type: Input }],
|
|
2865
|
-
disabled: [{ type: Input }],
|
|
2866
|
-
placeholder: [{ type: Input }],
|
|
2867
|
-
prefixicon: [{ type: Input }],
|
|
2868
|
-
maxlength: [{ type: Input }],
|
|
2869
|
-
countcharacters: [{ type: Input }],
|
|
2870
|
-
ariaLabel: [{ type: Input, args: ['aria-label',] }],
|
|
2871
|
-
ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }],
|
|
2872
|
-
valueChange: [{ type: Output }],
|
|
2873
|
-
_inputElement: [{ type: ViewChild, args: ['input',] }],
|
|
2874
|
-
_textareaElement: [{ type: ViewChild, args: ['textarea',] }]
|
|
2875
|
-
};
|
|
2876
|
-
|
|
2877
|
-
class GraniteInputFieldModule {
|
|
2878
|
-
}
|
|
2879
|
-
GraniteInputFieldModule.decorators = [
|
|
2880
|
-
{ type: NgModule, args: [{
|
|
2881
|
-
imports: [CommonModule, GraniteIconModule, GraniteButtonModule],
|
|
2882
|
-
declarations: [GraniteInputFieldComponent],
|
|
2883
|
-
exports: [GraniteInputFieldComponent],
|
|
2884
|
-
},] }
|
|
2885
|
-
];
|
|
2886
|
-
|
|
2887
|
-
const ɵ0 = deviceDesktop.output;
|
|
2888
|
-
/**
|
|
2889
|
-
* Directive used to tell components and their sub components that client output
|
|
2890
|
-
* should be adapted for desktop devices like personal computers.
|
|
2891
|
-
*/
|
|
2892
|
-
class ClientOutputDesktopDirective {
|
|
2893
|
-
}
|
|
2894
|
-
ClientOutputDesktopDirective.decorators = [
|
|
2895
|
-
{ type: Directive, args: [{
|
|
2896
|
-
selector: `[graniteClientOutputDesktop]`,
|
|
2897
|
-
providers: [
|
|
2898
|
-
{
|
|
2899
|
-
provide: GRANITE_CLIENT_OUTPUT,
|
|
2900
|
-
useValue: ɵ0,
|
|
2901
|
-
},
|
|
2902
|
-
],
|
|
2903
|
-
},] }
|
|
2904
|
-
];
|
|
2905
|
-
|
|
2906
|
-
const ɵ0$1 = deviceTouch.output;
|
|
2907
|
-
/**
|
|
2908
|
-
* Directive used to tell components and their sub components that client output
|
|
2909
|
-
* should be adapted for touch devices like mobiles and tablets.
|
|
2910
|
-
*/
|
|
2911
|
-
class ClientOutputTouchDirective {
|
|
2912
|
-
}
|
|
2913
|
-
ClientOutputTouchDirective.decorators = [
|
|
2914
|
-
{ type: Directive, args: [{
|
|
2915
|
-
selector: `[graniteClientOutputTouch]`,
|
|
2916
|
-
providers: [
|
|
2917
|
-
{
|
|
2918
|
-
provide: GRANITE_CLIENT_OUTPUT,
|
|
2919
|
-
useValue: ɵ0$1,
|
|
2920
|
-
},
|
|
2921
|
-
],
|
|
2922
|
-
},] }
|
|
2923
|
-
];
|
|
2924
|
-
|
|
2925
|
-
const ɵ0$2 = deviceDesktop.input;
|
|
2926
|
-
/**
|
|
2927
|
-
* Directive used to tell components and their sub components that client input
|
|
2928
|
-
* should be adapted for desktop devices, like personal computers.
|
|
2929
|
-
*/
|
|
2930
|
-
class ClientInputDesktopDirective {
|
|
2931
|
-
}
|
|
2932
|
-
ClientInputDesktopDirective.decorators = [
|
|
2933
|
-
{ type: Directive, args: [{
|
|
2934
|
-
selector: `[graniteClientInputDesktop]`,
|
|
2935
|
-
providers: [
|
|
2936
|
-
{
|
|
2937
|
-
provide: GRANITE_CLIENT_INPUT,
|
|
2938
|
-
useValue: ɵ0$2,
|
|
2939
|
-
},
|
|
2940
|
-
],
|
|
2941
|
-
},] }
|
|
2942
|
-
];
|
|
2943
|
-
|
|
2944
|
-
const ɵ0$3 = deviceTouch.input;
|
|
2945
|
-
/**
|
|
2946
|
-
* Directive used to tell components and their sub components that client input
|
|
2947
|
-
* should be adapted for touch devices, like mobiles and tablets.
|
|
2948
|
-
*/
|
|
2949
|
-
class ClientInputTouchDirective {
|
|
2950
|
-
}
|
|
2951
|
-
ClientInputTouchDirective.decorators = [
|
|
2952
|
-
{ type: Directive, args: [{
|
|
2953
|
-
selector: `[graniteClientInputTouch]`,
|
|
2954
|
-
providers: [
|
|
2955
|
-
{
|
|
2956
|
-
provide: GRANITE_CLIENT_INPUT,
|
|
2957
|
-
useValue: ɵ0$3,
|
|
2958
|
-
},
|
|
2959
|
-
],
|
|
2960
|
-
},] }
|
|
2961
|
-
];
|
|
2962
|
-
|
|
2963
|
-
// TODO: Move client devices into a separate module
|
|
2964
|
-
class GraniteCoreModule {
|
|
2965
|
-
}
|
|
2966
|
-
GraniteCoreModule.decorators = [
|
|
2967
|
-
{ type: NgModule, args: [{
|
|
2968
|
-
declarations: [
|
|
2969
|
-
ClientOutputDesktopDirective,
|
|
2970
|
-
ClientOutputTouchDirective,
|
|
2971
|
-
ClientInputDesktopDirective,
|
|
2972
|
-
ClientInputTouchDirective,
|
|
2973
|
-
],
|
|
2974
|
-
exports: [
|
|
2975
|
-
ClientOutputDesktopDirective,
|
|
2976
|
-
ClientOutputTouchDirective,
|
|
2977
|
-
ClientInputDesktopDirective,
|
|
2978
|
-
ClientInputTouchDirective,
|
|
2979
|
-
],
|
|
2980
|
-
},] }
|
|
2981
|
-
];
|
|
2982
|
-
|
|
2983
|
-
/*
|
|
2984
|
-
* Public API Surface of ui
|
|
2985
|
-
*/
|
|
2986
|
-
|
|
2987
|
-
/**
|
|
2988
|
-
* Generated bundle index. Do not edit.
|
|
2989
|
-
*/
|
|
2990
|
-
|
|
2991
|
-
export { ButtonSelectors, ClientInputDesktopDirective, ClientInputTouchDirective, ClientOutputDesktopDirective, ClientOutputTouchDirective, GRANITE_CLIENT_INPUT, GRANITE_CLIENT_OUTPUT, GraniteAnchorComponent, GraniteArrangeGridComponent, GraniteArrangeGridItemComponent, GraniteArrangeGridModule, GraniteArrangeGridOrientation, GraniteBadgeComponent, GraniteBadgeHarness, GraniteBadgeModule, GraniteButtonComponent, GraniteButtonModule, GraniteCheckboxComponent, GraniteCheckboxGroupComponent, GraniteCheckboxModule, GraniteCoreModule, GraniteDividerDirective, GraniteGridComponent, GraniteGridItemComponent, GraniteGridModule, GraniteIconComponent, GraniteIconModule, GraniteInputFieldComponent, GraniteInputFieldModule, GraniteMenuComponent, GraniteMenuHarness, GraniteMenuItemComponent, GraniteMenuItemHarness, GraniteMenuModule, GraniteMenuTouchCloseComponent, GraniteMenuTouchTitleItemComponent, GraniteMenuTriggerForDirective, GraniteRadioButtonComponent, GraniteRadioButtonModule, GraniteRadioGroupComponent, GraniteTableColumnDirective, GraniteTableComponent, GraniteTableModule, GraniteTitleDirective, GraniteToggleSwitchComponent, GraniteToggleSwitchModule, _MenuBaseComponent, deviceDesktop, deviceTouch, disabledMixin, graniteMenuDesktopAnimations, graniteMenuTouchAnimations, ɵ0$1 as ɵ0, GRANITE_MENU_PANEL as ɵa, getEaseOutSteep as ɵc, getEaseLinear as ɵd, GraniteRadioCheckboxBase as ɵe, GraniteTableDataCellComponent as ɵf, GraniteCell as ɵg, GraniteTableHeaderCellComponent as ɵh, PurePipesModule as ɵi, GraniteTitlePipe as ɵj };
|
|
2992
|
-
//# sourceMappingURL=ifsworld-granite-components.js.map
|