@ifsworld/granite-components 10.0.1 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/date-picker/lib/date-picker-base.d.ts +1 -1
- package/date-picker/lib/date-picker-trigger-for.directive.d.ts +1 -1
- package/date-picker/lib/date-picker.component.d.ts +1 -1
- package/date-picker/lib/date-range-picker.component.d.ts +1 -1
- package/{esm2020 → esm2022}/date-picker/lib/date-picker-base.mjs +4 -4
- package/{esm2020 → esm2022}/date-picker/lib/date-picker-trigger-for.directive.mjs +4 -4
- package/{esm2020 → esm2022}/date-picker/lib/date-picker.component.mjs +4 -4
- package/{esm2020 → esm2022}/date-picker/lib/date-picker.module.mjs +21 -21
- package/{esm2020 → esm2022}/date-picker/lib/date-range-picker.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/arrange-grid/arrange-grid-item.component.mjs +12 -12
- package/{esm2020 → esm2022}/lib/arrange-grid/arrange-grid.component.mjs +7 -7
- package/{esm2020 → esm2022}/lib/arrange-grid/arrange-grid.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/badge/badge.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/badge/badge.module.mjs +5 -5
- package/esm2022/lib/badge/testing/badge.harness.mjs +25 -0
- package/esm2022/lib/button/button.component.mjs +87 -0
- package/{esm2020 → esm2022}/lib/button/button.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/checkbox/checkbox-group.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/checkbox/checkbox.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/checkbox/checkbox.module.mjs +5 -5
- package/esm2022/lib/chips/chip-input.mjs +195 -0
- package/esm2022/lib/chips/chip-list.component.mjs +567 -0
- package/esm2022/lib/chips/chip.component.mjs +287 -0
- package/{esm2020 → esm2022}/lib/chips/chips.module.mjs +9 -9
- package/{esm2020 → esm2022}/lib/core/common-behaviors/disabled.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/core.module.mjs +11 -11
- package/esm2022/lib/core/devices/client-input-desktop.directive.mjs +29 -0
- package/esm2022/lib/core/devices/client-input-touch.directive.mjs +29 -0
- package/esm2022/lib/core/devices/client-output-desktop.directive.mjs +29 -0
- package/esm2022/lib/core/devices/client-output-touch.directive.mjs +29 -0
- package/{esm2020 → esm2022}/lib/core/pipes/pure-pipes.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/core/pipes/title.pipe.mjs +4 -4
- package/{esm2020 → esm2022}/lib/core/radio-checkbox-base.mjs +4 -4
- package/{esm2020 → esm2022}/lib/grid/grid.component.mjs +7 -7
- package/{esm2020 → esm2022}/lib/grid/grid.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/icon/icon.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/icon/icon.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/input-field/input-field.component.mjs +5 -5
- package/{esm2020 → esm2022}/lib/input-field/input-field.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/label/label.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/label/label.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/menu/divider.directive.mjs +4 -4
- package/{esm2020 → esm2022}/lib/menu/menu-base.mjs +4 -4
- package/{esm2020 → esm2022}/lib/menu/menu-item.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/menu/menu-touch-close.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/menu/menu-touch-title.component.mjs +6 -6
- package/{esm2020 → esm2022}/lib/menu/menu-trigger-for.directive.mjs +4 -4
- package/{esm2020 → esm2022}/lib/menu/menu.component.mjs +10 -10
- package/{esm2020 → esm2022}/lib/menu/menu.module.mjs +17 -17
- package/esm2022/lib/menu/testing/menu.harness.mjs +109 -0
- package/{esm2020 → esm2022}/lib/menu/title.directive.mjs +4 -4
- package/{esm2020 → esm2022}/lib/radio-button/radio-button.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/radio-button/radio-button.module.mjs +5 -5
- package/{esm2020 → esm2022}/lib/radio-button/radio-group.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/toggle-switch/toggle-switch.component.mjs +4 -4
- package/{esm2020 → esm2022}/lib/toggle-switch/toggle-switch.module.mjs +5 -5
- package/{esm2020 → esm2022}/table/lib/cell/cell-align/cell-align-classes.directive.mjs +4 -4
- package/{esm2020 → esm2022}/table/lib/cell/cell.mjs +4 -4
- package/{esm2020 → esm2022}/table/lib/cell/table-data-cell.component.mjs +5 -5
- package/{esm2020 → esm2022}/table/lib/cell/table-header-cell.component.mjs +4 -4
- package/{esm2020 → esm2022}/table/lib/column/table-column.directive.mjs +4 -4
- package/esm2022/table/lib/table-constants.library.mjs +9 -0
- package/{esm2020 → esm2022}/table/lib/table.component.mjs +4 -4
- package/{esm2020 → esm2022}/table/lib/table.module.mjs +9 -9
- package/{esm2020 → esm2022}/tooltip/lib/tooltip-constants.library.mjs +2 -2
- package/{esm2020 → esm2022}/tooltip/lib/tooltip-trigger-for.directive.mjs +4 -4
- package/{esm2020 → esm2022}/tooltip/lib/tooltip.component.mjs +4 -4
- package/{esm2020 → esm2022}/tooltip/lib/tooltip.module.mjs +5 -5
- package/{fesm2020 → fesm2022}/ifsworld-granite-components-date-picker.mjs +32 -32
- package/{fesm2020 → fesm2022}/ifsworld-granite-components-date-picker.mjs.map +1 -1
- package/fesm2022/ifsworld-granite-components-table.mjs +190 -0
- package/{fesm2015 → fesm2022}/ifsworld-granite-components-table.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ifsworld-granite-components-tooltip.mjs +11 -11
- package/{fesm2020 → fesm2022}/ifsworld-granite-components-tooltip.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/ifsworld-granite-components.mjs +337 -337
- package/fesm2022/ifsworld-granite-components.mjs.map +1 -0
- package/lib/arrange-grid/arrange-grid-item.component.d.ts +5 -5
- package/lib/arrange-grid/arrange-grid.component.d.ts +3 -3
- package/lib/badge/badge.component.d.ts +1 -1
- package/lib/button/button.component.d.ts +2 -2
- package/lib/checkbox/checkbox.component.d.ts +1 -1
- package/lib/chips/chip-input.d.ts +9 -9
- package/lib/chips/chip-list.component.d.ts +33 -33
- package/lib/chips/chip.component.d.ts +22 -22
- package/lib/core/radio-checkbox-base.d.ts +1 -1
- package/lib/grid/grid.component.d.ts +2 -2
- package/lib/icon/icon.component.d.ts +1 -1
- package/lib/input-field/input-field.component.d.ts +1 -1
- package/lib/label/label.component.d.ts +1 -1
- package/lib/menu/divider.directive.d.ts +1 -1
- package/lib/menu/menu-base.d.ts +1 -1
- package/lib/menu/menu-item.component.d.ts +1 -1
- package/lib/menu/menu-trigger-for.directive.d.ts +1 -1
- package/lib/radio-button/radio-button.component.d.ts +1 -1
- package/lib/toggle-switch/toggle-switch.component.d.ts +1 -1
- package/package.json +21 -40
- package/table/lib/cell/cell-align/cell-align-classes.directive.d.ts +1 -1
- package/table/lib/cell/cell.d.ts +1 -1
- package/table/lib/cell/table-data-cell.component.d.ts +1 -1
- package/table/lib/column/table-column.directive.d.ts +1 -1
- package/table/lib/table.component.d.ts +1 -1
- package/tooltip/lib/tooltip-trigger-for.directive.d.ts +1 -1
- package/esm2020/lib/badge/testing/badge.harness.mjs +0 -25
- package/esm2020/lib/button/button.component.mjs +0 -87
- package/esm2020/lib/chips/chip-input.mjs +0 -195
- package/esm2020/lib/chips/chip-list.component.mjs +0 -567
- package/esm2020/lib/chips/chip.component.mjs +0 -287
- package/esm2020/lib/core/devices/client-input-desktop.directive.mjs +0 -29
- package/esm2020/lib/core/devices/client-input-touch.directive.mjs +0 -29
- package/esm2020/lib/core/devices/client-output-desktop.directive.mjs +0 -29
- package/esm2020/lib/core/devices/client-output-touch.directive.mjs +0 -29
- package/esm2020/lib/menu/testing/menu.harness.mjs +0 -109
- package/esm2020/table/lib/table-constants.library.mjs +0 -9
- package/fesm2015/ifsworld-granite-components-date-picker.mjs +0 -401
- package/fesm2015/ifsworld-granite-components-date-picker.mjs.map +0 -1
- package/fesm2015/ifsworld-granite-components-table.mjs +0 -190
- package/fesm2015/ifsworld-granite-components-tooltip.mjs +0 -169
- package/fesm2015/ifsworld-granite-components-tooltip.mjs.map +0 -1
- package/fesm2015/ifsworld-granite-components.mjs +0 -4132
- package/fesm2015/ifsworld-granite-components.mjs.map +0 -1
- package/fesm2020/ifsworld-granite-components-table.mjs +0 -190
- package/fesm2020/ifsworld-granite-components-table.mjs.map +0 -1
- package/fesm2020/ifsworld-granite-components.mjs.map +0 -1
- /package/{esm2020 → esm2022}/date-picker/ifsworld-granite-components-date-picker.mjs +0 -0
- /package/{esm2020 → esm2022}/date-picker/index.mjs +0 -0
- /package/{esm2020 → esm2022}/ifsworld-granite-components.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/animation.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/client-environment.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/theme.library.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/core/types.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/menu/menu-desktop-animations.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/menu/menu-errors.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/menu/menu-panel.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/menu/menu-positions.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/menu/menu-touch-animations.mjs +0 -0
- /package/{esm2020 → esm2022}/table/ifsworld-granite-components-table.mjs +0 -0
- /package/{esm2020 → esm2022}/table/index.mjs +0 -0
- /package/{esm2020 → esm2022}/table/lib/table.types.mjs +0 -0
- /package/{esm2020 → esm2022}/tooltip/ifsworld-granite-components-tooltip.mjs +0 -0
- /package/{esm2020 → esm2022}/tooltip/index.mjs +0 -0
|
@@ -1,4132 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, ChangeDetectionStrategy, Input, HostBinding, ContentChildren, NgModule, InjectionToken, Attribute, Inject, Optional, EventEmitter, QueryList, TemplateRef, Directive, ViewChild, Output, Self, HostListener, ViewEncapsulation, Pipe } from '@angular/core';
|
|
3
|
-
import * as i1$1 from '@angular/common';
|
|
4
|
-
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
5
|
-
import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
6
|
-
import { Subject, BehaviorSubject, combineLatest, Subscription, merge, of, asapScheduler, fromEvent } from 'rxjs';
|
|
7
|
-
import { takeUntil, filter, map, startWith, switchMap, take, delay } from 'rxjs/operators';
|
|
8
|
-
import { __awaiter } from 'tslib';
|
|
9
|
-
import { ComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';
|
|
10
|
-
import * as i1$2 from '@angular/cdk/overlay';
|
|
11
|
-
import { OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
12
|
-
import { TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
13
|
-
import { trigger, state, style, transition, group, query, animate, sequence } from '@angular/animations';
|
|
14
|
-
import * as i1 from '@angular/cdk/a11y';
|
|
15
|
-
import { FocusKeyManager, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
|
|
16
|
-
import { hasModifierKey, SPACE, BACKSPACE, DELETE, ENTER, TAB } from '@angular/cdk/keycodes';
|
|
17
|
-
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
18
|
-
import * as i3 from '@angular/cdk/bidi';
|
|
19
|
-
import * as i2 from '@angular/cdk/collections';
|
|
20
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
21
|
-
import * as i2$1 from '@angular/forms';
|
|
22
|
-
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
23
|
-
|
|
24
|
-
class GraniteArrangeGridItemComponent {
|
|
25
|
-
/**
|
|
26
|
-
* Number of cells the item would span. Used by arrange grid in column
|
|
27
|
-
* orientation to fill any unused space caused by wrapped items.
|
|
28
|
-
*/
|
|
29
|
-
set columnSpan(value) {
|
|
30
|
-
this._columnSpan = value;
|
|
31
|
-
this.updateStyles();
|
|
32
|
-
}
|
|
33
|
-
constructor(element) {
|
|
34
|
-
this.element = element;
|
|
35
|
-
/**
|
|
36
|
-
* Column span to render.
|
|
37
|
-
* For use in template only. Do not use outside of this component.
|
|
38
|
-
* @ignore
|
|
39
|
-
*/
|
|
40
|
-
this._columnSpan = null;
|
|
41
|
-
/* no-op */
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Update element styles
|
|
45
|
-
*/
|
|
46
|
-
updateStyles() {
|
|
47
|
-
this.setCssProperty('--column-span', this._columnSpan ? this._columnSpan.toString() : null);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Set CSS variable value or remove it if a null value is given.
|
|
51
|
-
* Would of course rather have used property binding but that is not
|
|
52
|
-
* supported until (perhaps) Angular 9.
|
|
53
|
-
* See: https://github.com/angular/angular/issues/9343
|
|
54
|
-
*/
|
|
55
|
-
setCssProperty(variable, value) {
|
|
56
|
-
this.element.nativeElement.style.setProperty(variable, value);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
GraniteArrangeGridItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridItemComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
60
|
-
GraniteArrangeGridItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteArrangeGridItemComponent, selector: "granite-arrange-grid-item", ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{--column-span: $default-column-span;display:grid;grid-column:span var(--column-span, 1)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
61
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridItemComponent, decorators: [{
|
|
62
|
-
type: Component,
|
|
63
|
-
args: [{ selector: 'granite-arrange-grid-item', template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{--column-span: $default-column-span;display:grid;grid-column:span var(--column-span, 1)}\n"] }]
|
|
64
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
|
65
|
-
|
|
66
|
-
var GraniteArrangeGridOrientation;
|
|
67
|
-
(function (GraniteArrangeGridOrientation) {
|
|
68
|
-
GraniteArrangeGridOrientation["columns"] = "columns";
|
|
69
|
-
GraniteArrangeGridOrientation["rows"] = "rows";
|
|
70
|
-
})(GraniteArrangeGridOrientation || (GraniteArrangeGridOrientation = {}));
|
|
71
|
-
class GraniteArrangeGridComponent {
|
|
72
|
-
/**
|
|
73
|
-
* Number of grid columns to use when orientation is set to `column`. The
|
|
74
|
-
* default is two columns.
|
|
75
|
-
*/
|
|
76
|
-
set cols(value) {
|
|
77
|
-
this._cols = Math.max(1, Math.round(coerceNumberProperty(value)));
|
|
78
|
-
}
|
|
79
|
-
get cols() {
|
|
80
|
-
return this._cols;
|
|
81
|
-
}
|
|
82
|
-
set rows(value) {
|
|
83
|
-
// Prevent pointless usage
|
|
84
|
-
throw Error('Explicitly setting rows value for arrange grid is unsupported');
|
|
85
|
-
}
|
|
86
|
-
get rows() {
|
|
87
|
-
return this._rows;
|
|
88
|
-
}
|
|
89
|
-
constructor(element) {
|
|
90
|
-
this.element = element;
|
|
91
|
-
/** How to present grid items; `columns` (default) or `rows` */
|
|
92
|
-
this.orientation = GraniteArrangeGridOrientation.columns;
|
|
93
|
-
/** Exposes column orientation to template */
|
|
94
|
-
this.classColumnOrientation = false;
|
|
95
|
-
/** Exposes row orientation to template */
|
|
96
|
-
this.classRowOrientation = false;
|
|
97
|
-
/** Number of columns to render */
|
|
98
|
-
this._cols = GraniteArrangeGridComponent.defaultCols;
|
|
99
|
-
/** Nexted on component destruction to complete other observables. */
|
|
100
|
-
this.destroy$ = new Subject();
|
|
101
|
-
/* no-op */
|
|
102
|
-
}
|
|
103
|
-
ngAfterContentInit() {
|
|
104
|
-
// Update style whenever grid item components change in content
|
|
105
|
-
this.arrangeGridItemComponents.changes
|
|
106
|
-
.pipe(takeUntil(this.destroy$))
|
|
107
|
-
.subscribe(() => this.updateStyles());
|
|
108
|
-
this.updateStyles();
|
|
109
|
-
}
|
|
110
|
-
ngOnChanges(changes) {
|
|
111
|
-
if ((changes.orientation && !changes.orientation.isFirstChange()) ||
|
|
112
|
-
(changes.cols && !changes.cols.isFirstChange())) {
|
|
113
|
-
this.updateStyles();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
ngOnDestroy() {
|
|
117
|
-
this.destroy$.next();
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Update grid row template style.
|
|
121
|
-
*
|
|
122
|
-
* Use content height of all but last row and let the last grow
|
|
123
|
-
* to take up any remaining space.
|
|
124
|
-
*/
|
|
125
|
-
updateStyles() {
|
|
126
|
-
const children = (this.arrangeGridItemComponents || []).length;
|
|
127
|
-
if (this.orientation === GraniteArrangeGridOrientation.columns) {
|
|
128
|
-
// If too many items was placed into too few colums, there would
|
|
129
|
-
// be some wrapping. Take that into account when calculating the
|
|
130
|
-
// number of rows.
|
|
131
|
-
this._rows = Math.trunc((children - 1) / (this._cols || 1)) + 1;
|
|
132
|
-
this.classColumnOrientation = true;
|
|
133
|
-
this.classRowOrientation = false;
|
|
134
|
-
if (children > 0) {
|
|
135
|
-
// Fill any unused space caused by wrapped items by making the
|
|
136
|
-
// last item also span over remaining cells.
|
|
137
|
-
this.arrangeGridItemComponents.forEach((c) => (c.columnSpan = null));
|
|
138
|
-
this.arrangeGridItemComponents.last.columnSpan =
|
|
139
|
-
this._rows * this._cols - children + 1;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
this._cols = 1; // In row orientation, there is just a single column
|
|
144
|
-
this._rows = children;
|
|
145
|
-
this.classColumnOrientation = false;
|
|
146
|
-
this.classRowOrientation = true;
|
|
147
|
-
}
|
|
148
|
-
this.setCssProperty('--cols', this._cols.toString());
|
|
149
|
-
this.setCssProperty('--rows', this._rows.toString());
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Set CSS variable value or remove it if a null value is given.
|
|
153
|
-
* Would of course rather have used property binding but that is not
|
|
154
|
-
* supported until (perhaps) Angular 9.
|
|
155
|
-
* See: https://github.com/angular/angular/issues/9343
|
|
156
|
-
*
|
|
157
|
-
* TODO: Replace with property binding with Angular 9 upgrade
|
|
158
|
-
*/
|
|
159
|
-
setCssProperty(variable, value) {
|
|
160
|
-
this.element.nativeElement.style.setProperty(variable, value);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/** Default number of columns to use in column orientation */
|
|
164
|
-
GraniteArrangeGridComponent.defaultCols = 2;
|
|
165
|
-
GraniteArrangeGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
166
|
-
GraniteArrangeGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteArrangeGridComponent, selector: "granite-arrange-grid", inputs: { orientation: "orientation", cols: "cols" }, host: { properties: { "class.column-orientation": "this.classColumnOrientation", "class.row-orientation": "this.classRowOrientation" } }, queries: [{ propertyName: "arrangeGridItemComponents", predicate: GraniteArrangeGridItemComponent }], usesOnChanges: true, ngImport: i0, template: "<ng-content select=\"granite-arrange-grid-item\"></ng-content>\n", styles: ["@media only screen and (min-width: 960px){:host{--cols: 1;--rows: 1;display:grid;grid-template-columns:repeat(var(--cols, 1),1fr);column-gap:.5rem;row-gap:.5rem}:host.row-orientation{grid-template-columns:auto;grid-template-rows:repeat(calc(var(--rows, 1) - 1),max-content)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridComponent, decorators: [{
|
|
168
|
-
type: Component,
|
|
169
|
-
args: [{ selector: 'granite-arrange-grid', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content select=\"granite-arrange-grid-item\"></ng-content>\n", styles: ["@media only screen and (min-width: 960px){:host{--cols: 1;--rows: 1;display:grid;grid-template-columns:repeat(var(--cols, 1),1fr);column-gap:.5rem;row-gap:.5rem}:host.row-orientation{grid-template-columns:auto;grid-template-rows:repeat(calc(var(--rows, 1) - 1),max-content)}}\n"] }]
|
|
170
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { orientation: [{
|
|
171
|
-
type: Input
|
|
172
|
-
}], classColumnOrientation: [{
|
|
173
|
-
type: HostBinding,
|
|
174
|
-
args: ['class.column-orientation']
|
|
175
|
-
}], classRowOrientation: [{
|
|
176
|
-
type: HostBinding,
|
|
177
|
-
args: ['class.row-orientation']
|
|
178
|
-
}], arrangeGridItemComponents: [{
|
|
179
|
-
type: ContentChildren,
|
|
180
|
-
args: [GraniteArrangeGridItemComponent]
|
|
181
|
-
}], cols: [{
|
|
182
|
-
type: Input
|
|
183
|
-
}] } });
|
|
184
|
-
|
|
185
|
-
class GraniteArrangeGridModule {
|
|
186
|
-
}
|
|
187
|
-
GraniteArrangeGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
188
|
-
GraniteArrangeGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridModule, declarations: [GraniteArrangeGridComponent, GraniteArrangeGridItemComponent], imports: [CommonModule], exports: [GraniteArrangeGridComponent, GraniteArrangeGridItemComponent] });
|
|
189
|
-
GraniteArrangeGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridModule, imports: [CommonModule] });
|
|
190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteArrangeGridModule, decorators: [{
|
|
191
|
-
type: NgModule,
|
|
192
|
-
args: [{
|
|
193
|
-
declarations: [GraniteArrangeGridComponent, GraniteArrangeGridItemComponent],
|
|
194
|
-
imports: [CommonModule],
|
|
195
|
-
exports: [GraniteArrangeGridComponent, GraniteArrangeGridItemComponent],
|
|
196
|
-
}]
|
|
197
|
-
}] });
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Grid item component
|
|
201
|
-
*
|
|
202
|
-
* Merely a wrapper for CSS Grid items, accepting item style as input parameters.
|
|
203
|
-
*/
|
|
204
|
-
class GraniteGridItemComponent {
|
|
205
|
-
constructor(element, renderer) {
|
|
206
|
-
this.element = element;
|
|
207
|
-
this.renderer = renderer;
|
|
208
|
-
}
|
|
209
|
-
ngOnChanges() {
|
|
210
|
-
this.updateStyles();
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Update element styles
|
|
214
|
-
*/
|
|
215
|
-
updateStyles() {
|
|
216
|
-
this.setStyle('gridColumnStart', this.columnStart);
|
|
217
|
-
this.setStyle('gridColumnEnd', this.columnEnd);
|
|
218
|
-
this.setStyle('gridRowStart', this.rowStart);
|
|
219
|
-
this.setStyle('gridRowEnd', this.rowEnd);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Sets the element style. Needs to be set manually to avoid "Changed after
|
|
223
|
-
* checked" errors that would occur with HostBinding.
|
|
224
|
-
*/
|
|
225
|
-
setStyle(property, value) {
|
|
226
|
-
this.renderer.setStyle(this.element.nativeElement, property, value || '');
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
GraniteGridItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridItemComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
230
|
-
GraniteGridItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteGridItemComponent, selector: "granite-grid-item", inputs: { columnStart: "columnStart", columnEnd: "columnEnd", rowStart: "rowStart", rowEnd: "rowEnd" }, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridItemComponent, decorators: [{
|
|
232
|
-
type: Component,
|
|
233
|
-
args: [{
|
|
234
|
-
selector: 'granite-grid-item',
|
|
235
|
-
template: '<ng-content></ng-content>',
|
|
236
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
237
|
-
}]
|
|
238
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { columnStart: [{
|
|
239
|
-
type: Input
|
|
240
|
-
}], columnEnd: [{
|
|
241
|
-
type: Input
|
|
242
|
-
}], rowStart: [{
|
|
243
|
-
type: Input
|
|
244
|
-
}], rowEnd: [{
|
|
245
|
-
type: Input
|
|
246
|
-
}] } });
|
|
247
|
-
/**
|
|
248
|
-
* Grid
|
|
249
|
-
*
|
|
250
|
-
* A wrapper around a native CSS Grid. Anything can be used for grid items, but
|
|
251
|
-
* `GridItemComponent` is recommended for common cases.
|
|
252
|
-
*/
|
|
253
|
-
class GraniteGridComponent {
|
|
254
|
-
/**
|
|
255
|
-
* Number of grid columns, unless set via styling (grid-template-columns)
|
|
256
|
-
*
|
|
257
|
-
* Setting this value will produce equally sized columns
|
|
258
|
-
*/
|
|
259
|
-
set cols(value) {
|
|
260
|
-
this._cols = Math.max(1, Math.round(coerceNumberProperty(value)));
|
|
261
|
-
}
|
|
262
|
-
get cols() {
|
|
263
|
-
return this._cols;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Number of grid rows, unless set via styling (grid-template-rows)
|
|
267
|
-
*
|
|
268
|
-
* Setting this value will produce equally sized rows
|
|
269
|
-
*/
|
|
270
|
-
set rows(value) {
|
|
271
|
-
this._rows = Math.max(1, Math.round(coerceNumberProperty(value)));
|
|
272
|
-
}
|
|
273
|
-
get rows() {
|
|
274
|
-
return this._rows;
|
|
275
|
-
}
|
|
276
|
-
constructor(element) {
|
|
277
|
-
this.element = element;
|
|
278
|
-
}
|
|
279
|
-
ngAfterContentInit() {
|
|
280
|
-
this.updateStyles();
|
|
281
|
-
}
|
|
282
|
-
ngOnChanges(changes) {
|
|
283
|
-
if ((changes.cols && !changes.cols.isFirstChange()) ||
|
|
284
|
-
(changes.rows && !changes.rows.isFirstChange())) {
|
|
285
|
-
this.updateStyles();
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
/** Update element styles */
|
|
289
|
-
updateStyles() {
|
|
290
|
-
this.updateColumnStyles();
|
|
291
|
-
this.updateRowStyles();
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Set CSS variable value or remove it if a null value is given.
|
|
295
|
-
* Would of course rather have used property binding but that is not
|
|
296
|
-
* supported until (perhaps) Angular 9.
|
|
297
|
-
* See: https://github.com/angular/angular/issues/9343
|
|
298
|
-
*
|
|
299
|
-
* TODO: Replace with property binding with Angular 9 upgrade
|
|
300
|
-
*/
|
|
301
|
-
setCssProperty(variable, value) {
|
|
302
|
-
this.element.nativeElement.style.setProperty(variable, value);
|
|
303
|
-
}
|
|
304
|
-
/** Update grid column template style */
|
|
305
|
-
updateColumnStyles() {
|
|
306
|
-
this.setCssProperty('--cols', (this._cols && this._cols.toString()) || null);
|
|
307
|
-
}
|
|
308
|
-
/** Update grid row template style */
|
|
309
|
-
updateRowStyles() {
|
|
310
|
-
this.setCssProperty('--rows', (this._rows && this._rows.toString()) || null);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
GraniteGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
314
|
-
GraniteGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteGridComponent, selector: "granite-grid", inputs: { cols: "cols", rows: "rows" }, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{--cols: 1;--rows: 1;display:grid;grid-template-columns:repeat(var(--cols, 1),1fr);grid-template-rows:repeat(var(--rows, 1),1fr)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
315
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridComponent, decorators: [{
|
|
316
|
-
type: Component,
|
|
317
|
-
args: [{ selector: 'granite-grid', template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{--cols: 1;--rows: 1;display:grid;grid-template-columns:repeat(var(--cols, 1),1fr);grid-template-rows:repeat(var(--rows, 1),1fr)}\n"] }]
|
|
318
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { cols: [{
|
|
319
|
-
type: Input
|
|
320
|
-
}], rows: [{
|
|
321
|
-
type: Input
|
|
322
|
-
}] } });
|
|
323
|
-
|
|
324
|
-
class GraniteGridModule {
|
|
325
|
-
}
|
|
326
|
-
GraniteGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
327
|
-
GraniteGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridModule, declarations: [GraniteGridComponent, GraniteGridItemComponent], imports: [CommonModule], exports: [GraniteGridComponent, GraniteGridItemComponent] });
|
|
328
|
-
GraniteGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridModule, imports: [CommonModule] });
|
|
329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteGridModule, decorators: [{
|
|
330
|
-
type: NgModule,
|
|
331
|
-
args: [{
|
|
332
|
-
declarations: [GraniteGridComponent, GraniteGridItemComponent],
|
|
333
|
-
imports: [CommonModule],
|
|
334
|
-
exports: [GraniteGridComponent, GraniteGridItemComponent],
|
|
335
|
-
}]
|
|
336
|
-
}] });
|
|
337
|
-
|
|
338
|
-
const TOKEN_PREFIX = 'granite-';
|
|
339
|
-
const TOKEN_PREFIX_OLD = 'fnd-'; // TODO: Remove this when all tokens have 'granite-' as the prefix
|
|
340
|
-
/**
|
|
341
|
-
* Get the theme that corresponds to a given ID
|
|
342
|
-
*/
|
|
343
|
-
function getThemeById(themes, id) {
|
|
344
|
-
const theme = id !== undefined ? themes.find((t) => t.id === id) : undefined;
|
|
345
|
-
return theme;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Apply a theme to a DOM element by iterating though all tokens,
|
|
349
|
-
* setting a CSS variable for each one.
|
|
350
|
-
*
|
|
351
|
-
* @param theme Theme to set
|
|
352
|
-
* @param element Target element
|
|
353
|
-
*/
|
|
354
|
-
function applyTheme(theme, element) {
|
|
355
|
-
applyTokens(theme.tokens, element);
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Set a CSS variable for each token on the specified element.
|
|
359
|
-
*
|
|
360
|
-
* @param theme Theme to set
|
|
361
|
-
* @param element Target element
|
|
362
|
-
*/
|
|
363
|
-
function applyTokens(tokens, element) {
|
|
364
|
-
for (const token of Object.keys(tokens)) {
|
|
365
|
-
element.style.setProperty(token, tokens[token]);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Remove theme token CSS variables from an element using the specified keys
|
|
370
|
-
*
|
|
371
|
-
* @param theme Theme with tokens to clear
|
|
372
|
-
* @param element Target element
|
|
373
|
-
*/
|
|
374
|
-
function clearTheme(theme, element) {
|
|
375
|
-
clearTokens(Object.keys(theme.tokens), element);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Remove token CSS variables from an element using the specified keys.
|
|
379
|
-
*
|
|
380
|
-
* @param keys Token keys
|
|
381
|
-
* @param element Target element
|
|
382
|
-
*/
|
|
383
|
-
function clearTokens(keys, element) {
|
|
384
|
-
for (const token of keys) {
|
|
385
|
-
element.style.removeProperty(token);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
function isValidToken(key) {
|
|
389
|
-
return (key && (key.startsWith(TOKEN_PREFIX) || key.startsWith(TOKEN_PREFIX_OLD)));
|
|
390
|
-
}
|
|
391
|
-
function setPropertyValue(name, value, element) {
|
|
392
|
-
if (element && element.style && value != null) {
|
|
393
|
-
element.style.setProperty(name, isValidToken(value) ? `var(--${value})` : value);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
class GraniteBadgeComponent {
|
|
398
|
-
constructor(elementRef) {
|
|
399
|
-
this.elementRef = elementRef;
|
|
400
|
-
/** Pill style badge */
|
|
401
|
-
this.pill = false;
|
|
402
|
-
}
|
|
403
|
-
ngOnChanges(changes) {
|
|
404
|
-
if (changes.backgroundColor) {
|
|
405
|
-
if (changes.backgroundColor.previousValue !==
|
|
406
|
-
changes.backgroundColor.currentValue) {
|
|
407
|
-
setPropertyValue('background-color', changes.backgroundColor.currentValue, this.elementRef.nativeElement);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
if (changes.color) {
|
|
411
|
-
if (changes.color.previousValue !== changes.color.currentValue) {
|
|
412
|
-
setPropertyValue('color', changes.color.currentValue, this.elementRef.nativeElement);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
GraniteBadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteBadgeComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
418
|
-
GraniteBadgeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteBadgeComponent, selector: "granite-badge", inputs: { backgroundColor: "backgroundColor", color: "color", pill: "pill" }, host: { properties: { "class.granite-badge-pill": "pill" }, classAttribute: "granite-badge" }, exportAs: ["graniteBadge"], usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, 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);border-radius:var(--granite-radius-s);font-size:var(--granite-font-size-body-small);padding-inline:var(--granite-spacing-8);padding-block:var(--granite-spacing-4)}:host(.granite-badge-pill){border-radius:var(--granite-radius-l)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
419
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteBadgeComponent, decorators: [{
|
|
420
|
-
type: Component,
|
|
421
|
-
args: [{ selector: 'granite-badge', exportAs: 'graniteBadge', host: {
|
|
422
|
-
class: 'granite-badge',
|
|
423
|
-
'[class.granite-badge-pill]': 'pill',
|
|
424
|
-
}, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, 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);border-radius:var(--granite-radius-s);font-size:var(--granite-font-size-body-small);padding-inline:var(--granite-spacing-8);padding-block:var(--granite-spacing-4)}:host(.granite-badge-pill){border-radius:var(--granite-radius-l)}\n"] }]
|
|
425
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { backgroundColor: [{
|
|
426
|
-
type: Input
|
|
427
|
-
}], color: [{
|
|
428
|
-
type: Input
|
|
429
|
-
}], pill: [{
|
|
430
|
-
type: Input
|
|
431
|
-
}] } });
|
|
432
|
-
|
|
433
|
-
class GraniteBadgeModule {
|
|
434
|
-
}
|
|
435
|
-
GraniteBadgeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteBadgeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
436
|
-
GraniteBadgeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteBadgeModule, declarations: [GraniteBadgeComponent], imports: [CommonModule], exports: [GraniteBadgeComponent] });
|
|
437
|
-
GraniteBadgeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteBadgeModule, imports: [CommonModule] });
|
|
438
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteBadgeModule, decorators: [{
|
|
439
|
-
type: NgModule,
|
|
440
|
-
args: [{
|
|
441
|
-
declarations: [GraniteBadgeComponent],
|
|
442
|
-
imports: [CommonModule],
|
|
443
|
-
exports: [GraniteBadgeComponent],
|
|
444
|
-
}]
|
|
445
|
-
}] });
|
|
446
|
-
|
|
447
|
-
class GraniteBadgeHarness extends ComponentHarness {
|
|
448
|
-
/**
|
|
449
|
-
* Gets a `HarnessPredicate` that can be used to search for a `GraniteBadgeHarness` that meets
|
|
450
|
-
* certain criteria.
|
|
451
|
-
* @param options Options for filtering which badge instances are considered a match.
|
|
452
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
453
|
-
*/
|
|
454
|
-
static with(options = {}) {
|
|
455
|
-
const predicate = new HarnessPredicate(GraniteBadgeHarness, options);
|
|
456
|
-
predicate.addOption('text', options.text, (harness, label) => HarnessPredicate.stringMatches(harness.getText(), label));
|
|
457
|
-
predicate.addOption('pill', options.pill, (harness, pill) => __awaiter(this, void 0, void 0, function* () { return (yield harness.isPill()) === pill; }));
|
|
458
|
-
return predicate;
|
|
459
|
-
}
|
|
460
|
-
/** Gets the Badge text. */
|
|
461
|
-
getText() {
|
|
462
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
463
|
-
return (yield this.host()).text();
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
/** Whether it's a Pill type badge. */
|
|
467
|
-
isPill() {
|
|
468
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
469
|
-
return (yield this.host()).hasClass('granite-badge-pill');
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
GraniteBadgeHarness.hostSelector = 'granite-badge';
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Returns an ease-out CSS animation string with a slightly steeper curve
|
|
477
|
-
* than usual.
|
|
478
|
-
*
|
|
479
|
-
* @param duration Duration in milliseconds
|
|
480
|
-
* @param delay Delay in milliseconds
|
|
481
|
-
*/
|
|
482
|
-
function getEaseOutSteep(duration, delay) {
|
|
483
|
-
return (`${duration}ms ` +
|
|
484
|
-
(delay !== undefined ? ` ${delay}ms ` : '') +
|
|
485
|
-
'cubic-bezier(0, 0, 0.2, 1)');
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Returns an ease-out-back CSS animation string with a slightly steeper
|
|
489
|
-
* curve than usual.
|
|
490
|
-
*
|
|
491
|
-
* @param duration Duration in milliseconds
|
|
492
|
-
* @param delay Delay in milliseconds
|
|
493
|
-
*/
|
|
494
|
-
function getEaseOutSteepBack(duration, delay) {
|
|
495
|
-
return (`${duration}ms ` +
|
|
496
|
-
(delay !== undefined ? ` ${delay}ms ` : '') +
|
|
497
|
-
'cubic-bezier(.37,1.3,.77,1)');
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* Returns a linear CSS animation string
|
|
501
|
-
*
|
|
502
|
-
* @param duration Duration in milliseconds
|
|
503
|
-
* @param delay Delay in milliseconds
|
|
504
|
-
*/
|
|
505
|
-
function getEaseLinear(duration, delay) {
|
|
506
|
-
return (`${duration}ms ` + (delay !== undefined ? ` ${delay}ms ` : '') + 'linear');
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
const easeOut120 = getEaseOutSteep(120);
|
|
510
|
-
/**
|
|
511
|
-
* Animations used by the `granite-menu` component, showing the desktop interface.
|
|
512
|
-
* @docs-private
|
|
513
|
-
*/
|
|
514
|
-
const graniteMenuDesktopAnimations = {
|
|
515
|
-
transformMenuDesktop: trigger('transformMenuDesktop', [
|
|
516
|
-
state('void', style({
|
|
517
|
-
opacity: 0,
|
|
518
|
-
transform: 'scale(0.9)',
|
|
519
|
-
})),
|
|
520
|
-
transition('void => enter', group([
|
|
521
|
-
query('.granite-menu-content', animate(getEaseLinear(100), style({
|
|
522
|
-
opacity: 1,
|
|
523
|
-
}))),
|
|
524
|
-
animate(easeOut120, style({ transform: 'scale(1)' })),
|
|
525
|
-
])),
|
|
526
|
-
transition('* => void', animate(getEaseLinear(100, 25), style({ opacity: 0 }))),
|
|
527
|
-
]),
|
|
528
|
-
};
|
|
529
|
-
|
|
530
|
-
const defaultDuration = 300;
|
|
531
|
-
const defaultDelay = 200;
|
|
532
|
-
const easeOut = getEaseOutSteep(defaultDuration);
|
|
533
|
-
const linear = getEaseLinear(defaultDuration);
|
|
534
|
-
const linearDelayed = getEaseLinear(defaultDuration, defaultDelay);
|
|
535
|
-
/**
|
|
536
|
-
* Insanely fast travel somewhere on or off the stage,
|
|
537
|
-
* to set a great starting position.
|
|
538
|
-
*
|
|
539
|
-
* For some reason this has to be animated with > 0ms time.
|
|
540
|
-
* Setting style directly gets ignored.
|
|
541
|
-
*/
|
|
542
|
-
const teleport = '1ms linear';
|
|
543
|
-
/**
|
|
544
|
-
* Style used by our menu stars to make grand entrée et sortie from/to below
|
|
545
|
-
* the viewport stage.
|
|
546
|
-
*/
|
|
547
|
-
const inTheOrchestraPit = style({
|
|
548
|
-
transform: 'translateX(0) translateY(100%)',
|
|
549
|
-
opacity: 0,
|
|
550
|
-
});
|
|
551
|
-
/** Style for a menu at the center of attention, on the viewport stage */
|
|
552
|
-
const onStage = style({
|
|
553
|
-
opacity: 1,
|
|
554
|
-
transform: 'translateX(0) translateY(0)',
|
|
555
|
-
});
|
|
556
|
-
/**
|
|
557
|
-
* Style for a (sub) menu starting position at the side of the stage, waiting
|
|
558
|
-
* to make an entrance by sliding into view, pushing the previous (parent)
|
|
559
|
-
* menu off.
|
|
560
|
-
*/
|
|
561
|
-
const awaitingCue = style({
|
|
562
|
-
opacity: 0,
|
|
563
|
-
transform: 'translateX(100vw) translateY(0)',
|
|
564
|
-
});
|
|
565
|
-
/**
|
|
566
|
-
* Style for a (parent) menu that has been pushed aside by a debutant
|
|
567
|
-
* (sub) menu and therefore, although maybe temporarily, left the spotlight.
|
|
568
|
-
*
|
|
569
|
-
* @param translateY Where to place on Y axis
|
|
570
|
-
*/
|
|
571
|
-
const retired = style({
|
|
572
|
-
opacity: 1,
|
|
573
|
-
transform: `translateX(-100vw) translateY(0)`,
|
|
574
|
-
});
|
|
575
|
-
/**
|
|
576
|
-
* Style for an active (sub) menu that dances across the stage, along with its
|
|
577
|
-
* parent menu, as a result of the user panning. Requires an `xOffset`
|
|
578
|
-
* parameter for the distance.
|
|
579
|
-
*/
|
|
580
|
-
const futsalShuffle = style({
|
|
581
|
-
transform: 'translateX({{ xOffset }}px)',
|
|
582
|
-
});
|
|
583
|
-
/**
|
|
584
|
-
* Style for a parent menu sweeping across the stage, right beside the
|
|
585
|
-
* starlet sub menu, either off the stage or back onto it (for a great comeback).
|
|
586
|
-
* Requires an `xOffset` parameter for the distance.
|
|
587
|
-
*/
|
|
588
|
-
const moonwalk = style({
|
|
589
|
-
transform: 'translateX(calc(-100vw + {{ xOffset }}px))',
|
|
590
|
-
});
|
|
591
|
-
const onStageHidden = style({
|
|
592
|
-
opacity: 0,
|
|
593
|
-
transform: 'translateX(0) translateY(0)',
|
|
594
|
-
});
|
|
595
|
-
/**
|
|
596
|
-
* Animations used by the `granite-menu` component, showing the touch interface.
|
|
597
|
-
* @docs-private
|
|
598
|
-
*/
|
|
599
|
-
const graniteMenuTouchAnimations = {
|
|
600
|
-
transformMenuTouch: trigger('transformMenuTouch', [
|
|
601
|
-
// Set up cast positions
|
|
602
|
-
state('void', awaitingCue),
|
|
603
|
-
state('enter, enter-from-below', onStage),
|
|
604
|
-
state('pan-hidden', moonwalk, { params: { xOffset: 0 } }),
|
|
605
|
-
state('pan', futsalShuffle, { params: { xOffset: 0 } }),
|
|
606
|
-
state('below-with-delay', inTheOrchestraPit),
|
|
607
|
-
state('hide', retired),
|
|
608
|
-
// General movement across the stage. Transitions to 'pan' and 'pan-hidden'
|
|
609
|
-
// states are intentionally left out as we want the menu position to update
|
|
610
|
-
// instantly as the user moves their finger.
|
|
611
|
-
transition('pan => enter, ' +
|
|
612
|
-
'pan => enter-from-below, ' +
|
|
613
|
-
'pan => void, ' +
|
|
614
|
-
'enter <=> hide, ' +
|
|
615
|
-
'enter-from-below <=> hide, ' +
|
|
616
|
-
'pan-hidden => hide, ' +
|
|
617
|
-
'pan-hidden => enter', animate(easeOut)),
|
|
618
|
-
transition(
|
|
619
|
-
// Jump straight onto the stage, from the orchestra pit.
|
|
620
|
-
// Excitement fills the air. Spotlight. Showtime.
|
|
621
|
-
'void => enter-from-below', sequence([
|
|
622
|
-
animate(teleport, inTheOrchestraPit),
|
|
623
|
-
animate(easeOut, onStage),
|
|
624
|
-
])),
|
|
625
|
-
transition(
|
|
626
|
-
// Go stand in the curtains, then make a grand entrance from the side
|
|
627
|
-
'void => enter', sequence([animate(teleport, awaitingCue), animate(easeOut, onStage)])),
|
|
628
|
-
transition(
|
|
629
|
-
// Get off the stage, back into the curtains on the side
|
|
630
|
-
'enter => void', animate(easeOut, awaitingCue)),
|
|
631
|
-
transition(
|
|
632
|
-
// Take the side stairs down from the stage
|
|
633
|
-
'hide => below', animate(linear, retired)),
|
|
634
|
-
transition(
|
|
635
|
-
// Wait for a bit, then take the side stairs down from the stage
|
|
636
|
-
'hide => below-with-delay', sequence([animate(teleport, retired), animate(linearDelayed, retired)])),
|
|
637
|
-
transition(
|
|
638
|
-
// Stage dive into the orchestra pit
|
|
639
|
-
'enter => below, enter-from-below => below', sequence([animate(teleport, onStage), animate(linear, inTheOrchestraPit)])),
|
|
640
|
-
transition(
|
|
641
|
-
// Receive the standing ovations, then stage dive into the orchestra pit
|
|
642
|
-
'enter => below-with-delay, enter-from-below => below-with-delay', sequence([
|
|
643
|
-
animate(teleport, onStage),
|
|
644
|
-
animate(linearDelayed, inTheOrchestraPit),
|
|
645
|
-
])),
|
|
646
|
-
]),
|
|
647
|
-
transformCloseButton: trigger('transformCloseButton', [
|
|
648
|
-
state('void, below, below-with-delay', onStageHidden),
|
|
649
|
-
state('enter, enter-from-below, pan-hidden, pan, hide', onStage),
|
|
650
|
-
transition('void => enter-from-below', sequence([
|
|
651
|
-
animate(teleport, onStageHidden),
|
|
652
|
-
animate(getEaseLinear(50, defaultDuration / 2), onStage),
|
|
653
|
-
])),
|
|
654
|
-
transition('enter => below, enter-from-below => below', sequence([
|
|
655
|
-
animate(teleport, onStage),
|
|
656
|
-
animate(getEaseLinear(25), onStageHidden),
|
|
657
|
-
])),
|
|
658
|
-
transition('enter => below-with-delay, enter-from-below => below-with-delay', sequence([
|
|
659
|
-
animate(teleport, onStage),
|
|
660
|
-
animate(getEaseLinear(50, defaultDelay), onStageHidden),
|
|
661
|
-
])),
|
|
662
|
-
]),
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
* Injection token used to provide the parent menu to menu-specific components.
|
|
667
|
-
* @docs-private
|
|
668
|
-
*/
|
|
669
|
-
const GRANITE_MENU_PANEL = new InjectionToken('GRANITE_MENU_PANEL');
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
* @license
|
|
673
|
-
* Copyright Google LLC All Rights Reserved.
|
|
674
|
-
*
|
|
675
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
676
|
-
* found in the LICENSE file at https://angular.io/license
|
|
677
|
-
*/
|
|
678
|
-
/**
|
|
679
|
-
* Throws an exception for the case when menu trigger doesn't have a valid granite-menu instance
|
|
680
|
-
* @docs-private
|
|
681
|
-
*/
|
|
682
|
-
function throwGraniteMenuMissingError() {
|
|
683
|
-
throw Error(`graniteMenuTriggerFor: must pass in an granite-menu instance.
|
|
684
|
-
|
|
685
|
-
Example:
|
|
686
|
-
<granite-menu #menu="graniteMenu"></granite-menu>
|
|
687
|
-
<button [graniteMenuTriggerFor]="menu"></button>`);
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* Throws an exception for the case when menu's x-position value isn't valid.
|
|
691
|
-
* In other words, it doesn't match 'before' or 'after'.
|
|
692
|
-
* @docs-private
|
|
693
|
-
*/
|
|
694
|
-
function throwGraniteMenuInvalidPositionX() {
|
|
695
|
-
throw Error(`xPosition value must be either 'before' or after'.
|
|
696
|
-
Example: <granite-menu xPosition="before" #menu="graniteMenu"></granite-menu>`);
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Throws an exception for the case when menu's y-position value isn't valid.
|
|
700
|
-
* In other words, it doesn't match 'above' or 'below'.
|
|
701
|
-
* @docs-private
|
|
702
|
-
*/
|
|
703
|
-
function throwGraniteMenuInvalidPositionY() {
|
|
704
|
-
throw Error(`yPosition value must be either 'above' or below'.
|
|
705
|
-
Example: <granite-menu yPosition="above" #menu="graniteMenu"></granite-menu>`);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
class GraniteIconComponent {
|
|
709
|
-
constructor(_elementRef, renderer, ariaHidden) {
|
|
710
|
-
this._elementRef = _elementRef;
|
|
711
|
-
this.renderer = renderer;
|
|
712
|
-
// aria-hidden will be set to true by default, unless it's overridden by the developer
|
|
713
|
-
if (!ariaHidden) {
|
|
714
|
-
this.renderer.setAttribute(_elementRef.nativeElement, 'aria-hidden', 'true');
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
ngOnChanges(changes) {
|
|
718
|
-
if (changes.fontIcon) {
|
|
719
|
-
this._updateFontIcon();
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
_updateFontIcon() {
|
|
723
|
-
if (this.fontIcon !== this._previousFontIconClass) {
|
|
724
|
-
if (this._previousFontIconClass) {
|
|
725
|
-
this.renderer.removeClass(this._elementRef.nativeElement, this._previousFontIconClass);
|
|
726
|
-
}
|
|
727
|
-
if (this.fontIcon) {
|
|
728
|
-
this.renderer.addClass(this._elementRef.nativeElement, this.fontIcon);
|
|
729
|
-
}
|
|
730
|
-
this._previousFontIconClass = this.fontIcon;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
GraniteIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteIconComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: 'aria-hidden', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
735
|
-
GraniteIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteIconComponent, selector: "granite-icon", inputs: { fontIcon: "fontIcon" }, host: { attributes: { "role": "img" }, classAttribute: "granite-icon" }, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host.granite-icon{background-repeat:no-repeat;display:inline-block;padding:0 calc(var(--granite-spacing-4) / 2);font-size:1em;line-height:1em;position:relative;top:.1em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
736
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteIconComponent, decorators: [{
|
|
737
|
-
type: Component,
|
|
738
|
-
args: [{ selector: 'granite-icon', template: '<ng-content></ng-content>', host: {
|
|
739
|
-
role: 'img',
|
|
740
|
-
class: 'granite-icon',
|
|
741
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host.granite-icon{background-repeat:no-repeat;display:inline-block;padding:0 calc(var(--granite-spacing-4) / 2);font-size:1em;line-height:1em;position:relative;top:.1em}\n"] }]
|
|
742
|
-
}], ctorParameters: function () {
|
|
743
|
-
return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
744
|
-
type: Attribute,
|
|
745
|
-
args: ['aria-hidden']
|
|
746
|
-
}] }];
|
|
747
|
-
}, propDecorators: { fontIcon: [{
|
|
748
|
-
type: Input
|
|
749
|
-
}] } });
|
|
750
|
-
|
|
751
|
-
class GraniteMenuItemComponent {
|
|
752
|
-
constructor(_elementRef, _focusMonitor, _parentMenu) {
|
|
753
|
-
this._elementRef = _elementRef;
|
|
754
|
-
this._focusMonitor = _focusMonitor;
|
|
755
|
-
this._parentMenu = _parentMenu;
|
|
756
|
-
/** ARIA role for the menu item. */
|
|
757
|
-
this.role = 'menuitem';
|
|
758
|
-
/** Stream that emits when the menu item is hovered. */
|
|
759
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
760
|
-
this._hovered = new Subject();
|
|
761
|
-
/** Stream that emits when the menu item is focused. */
|
|
762
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
763
|
-
this._focused = new Subject();
|
|
764
|
-
/** Whether the menu item acts as a trigger for a sub-menu (used for styling) */
|
|
765
|
-
this._triggersSubmenu = false;
|
|
766
|
-
/**
|
|
767
|
-
* Whether the menu item is highlighted, e.g. in the "breadcrumb" parent chain
|
|
768
|
-
* of sub menu trigger items
|
|
769
|
-
*/
|
|
770
|
-
this._highlighted = false;
|
|
771
|
-
// Start monitoring the element so it gets the appropriate focused classes. We want
|
|
772
|
-
// to show the focus style for menu items only when the focus was not caused by a
|
|
773
|
-
// mouse or touch interaction.
|
|
774
|
-
_focusMonitor.monitor(this._elementRef, false);
|
|
775
|
-
}
|
|
776
|
-
ngOnDestroy() {
|
|
777
|
-
this._focusMonitor.stopMonitoring(this._elementRef);
|
|
778
|
-
this._hovered.complete();
|
|
779
|
-
this._focused.complete();
|
|
780
|
-
}
|
|
781
|
-
/** Focuses the menu item. */
|
|
782
|
-
focus(origin = 'program', options) {
|
|
783
|
-
this._focusMonitor.focusVia(this._getHostElement(), origin, options);
|
|
784
|
-
this._focused.next(this);
|
|
785
|
-
}
|
|
786
|
-
/** Returns the host DOM element. */
|
|
787
|
-
_getHostElement() {
|
|
788
|
-
return this._elementRef.nativeElement;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
GraniteMenuItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuItemComponent, deps: [{ token: i0.ElementRef }, { token: i1.FocusMonitor }, { token: GRANITE_MENU_PANEL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
792
|
-
GraniteMenuItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteMenuItemComponent, selector: "[graniteMenuItem]", inputs: { role: "role" }, host: { listeners: { "mouseenter": "_hovered.next(this)" }, properties: { "attr.role": "role", "class.granite-menu-item": "true", "class.granite-menu-item-highlighted": "_highlighted", "class.granite-menu-item-submenu-trigger": "_triggersSubmenu", "class.granite-device-output-touch": "_clientOutput?.device === \"touch\"" } }, exportAs: ["graniteMenuItem"], ngImport: i0, template: `<ng-content></ng-content>
|
|
793
|
-
<ng-container *ngIf="_triggersSubmenu">
|
|
794
|
-
<granite-icon
|
|
795
|
-
class="caret-left"
|
|
796
|
-
[fontIcon]="'icon-caret-left'"
|
|
797
|
-
></granite-icon>
|
|
798
|
-
<granite-icon
|
|
799
|
-
class="caret-right"
|
|
800
|
-
[fontIcon]="'icon-caret-right'"
|
|
801
|
-
></granite-icon>
|
|
802
|
-
</ng-container>`, isInline: true, styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-8);width:100%;max-width:100%;-webkit-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{-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-program-focused,:host.cdk-keyboard-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{padding-inline-end:var(--granite-spacing-24)}html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left{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-24)}: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-24)}: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)}}html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: GraniteIconComponent, selector: "granite-icon", inputs: ["fontIcon"] }] });
|
|
803
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuItemComponent, decorators: [{
|
|
804
|
-
type: Component,
|
|
805
|
-
args: [{ selector: '[graniteMenuItem]', template: `<ng-content></ng-content>
|
|
806
|
-
<ng-container *ngIf="_triggersSubmenu">
|
|
807
|
-
<granite-icon
|
|
808
|
-
class="caret-left"
|
|
809
|
-
[fontIcon]="'icon-caret-left'"
|
|
810
|
-
></granite-icon>
|
|
811
|
-
<granite-icon
|
|
812
|
-
class="caret-right"
|
|
813
|
-
[fontIcon]="'icon-caret-right'"
|
|
814
|
-
></granite-icon>
|
|
815
|
-
</ng-container>`, exportAs: 'graniteMenuItem', host: {
|
|
816
|
-
'[attr.role]': 'role',
|
|
817
|
-
'[class.granite-menu-item]': 'true',
|
|
818
|
-
'[class.granite-menu-item-highlighted]': '_highlighted',
|
|
819
|
-
'[class.granite-menu-item-submenu-trigger]': '_triggersSubmenu',
|
|
820
|
-
//#region --- Touch device customizations ---
|
|
821
|
-
'[class.granite-device-output-touch]': '_clientOutput?.device === "touch"',
|
|
822
|
-
//#endregion --- Touch device customizations ---
|
|
823
|
-
'(mouseenter)': '_hovered.next(this)',
|
|
824
|
-
}, styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-8);width:100%;max-width:100%;-webkit-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{-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-program-focused,:host.cdk-keyboard-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{padding-inline-end:var(--granite-spacing-24)}html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left{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-24)}: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-24)}: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)}}html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}\n"] }]
|
|
825
|
-
}], ctorParameters: function () {
|
|
826
|
-
return [{ type: i0.ElementRef }, { type: i1.FocusMonitor }, { type: undefined, decorators: [{
|
|
827
|
-
type: Inject,
|
|
828
|
-
args: [GRANITE_MENU_PANEL]
|
|
829
|
-
}, {
|
|
830
|
-
type: Optional
|
|
831
|
-
}] }];
|
|
832
|
-
}, propDecorators: { role: [{
|
|
833
|
-
type: Input
|
|
834
|
-
}] } });
|
|
835
|
-
|
|
836
|
-
/** Counter for panel ID generation */
|
|
837
|
-
let menuPanelUid = 0;
|
|
838
|
-
/** Menu panel animation default transform values */
|
|
839
|
-
const transformMenuDefault = {
|
|
840
|
-
value: 'void',
|
|
841
|
-
params: {
|
|
842
|
-
xOffset: 0,
|
|
843
|
-
},
|
|
844
|
-
};
|
|
845
|
-
/** Base class with all of the menu functionality. */
|
|
846
|
-
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
847
|
-
class _MenuBaseComponent {
|
|
848
|
-
/** Position of the menu in the X axis. */
|
|
849
|
-
get xPosition() {
|
|
850
|
-
return this._xPosition;
|
|
851
|
-
}
|
|
852
|
-
set xPosition(value) {
|
|
853
|
-
if (value !== 'before' && value !== 'after') {
|
|
854
|
-
throwGraniteMenuInvalidPositionX();
|
|
855
|
-
}
|
|
856
|
-
this._xPosition = value;
|
|
857
|
-
}
|
|
858
|
-
/** Position of the menu in the Y axis. */
|
|
859
|
-
get yPosition() {
|
|
860
|
-
return this._yPosition;
|
|
861
|
-
}
|
|
862
|
-
set yPosition(value) {
|
|
863
|
-
if (value !== 'above' && value !== 'below') {
|
|
864
|
-
throwGraniteMenuInvalidPositionY();
|
|
865
|
-
}
|
|
866
|
-
this._yPosition = value;
|
|
867
|
-
}
|
|
868
|
-
/** Current state of the panel animation. */
|
|
869
|
-
set _panelAnimationState(state) {
|
|
870
|
-
this._transformMenu.next({
|
|
871
|
-
value: state,
|
|
872
|
-
params: { xOffset: this.xOffset },
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
constructor(_changeDetectorRef) {
|
|
876
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
877
|
-
this.openOnHover = true;
|
|
878
|
-
/**
|
|
879
|
-
* Event emitted when the menu is closed
|
|
880
|
-
*/
|
|
881
|
-
this.closed = new EventEmitter();
|
|
882
|
-
/**
|
|
883
|
-
* Used for locating the panel in tests and setting the aria-control attribute
|
|
884
|
-
* for the menu trigger.
|
|
885
|
-
*/
|
|
886
|
-
this.panelId = `granite-menu-panel-${menuPanelUid++}`;
|
|
887
|
-
/** Whether to show back button in touch menu title bar */
|
|
888
|
-
this.showBackButton = false;
|
|
889
|
-
/** Whether to show touch menu title bar */
|
|
890
|
-
this.showTitle = false;
|
|
891
|
-
/** Whether to add a close button below the menu */
|
|
892
|
-
this.showCloseButton = false;
|
|
893
|
-
/** Observable current state of the panel animation. */
|
|
894
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
895
|
-
this._transformMenu = new BehaviorSubject(transformMenuDefault);
|
|
896
|
-
/** Emits whenever an animation on the menu completes. */
|
|
897
|
-
// eslint-disable-next-line rxjs/no-exposed-subjects
|
|
898
|
-
this._animationDone = new Subject();
|
|
899
|
-
this._menuEmpty$ = new BehaviorSubject(false);
|
|
900
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
901
|
-
this._isMenuEmpty$ = combineLatest([
|
|
902
|
-
this._menuEmpty$,
|
|
903
|
-
this._animationDone,
|
|
904
|
-
]).pipe(filter(([m, a]) => m && a != null), map(() => true));
|
|
905
|
-
/** Only the direct descendant menu items. */
|
|
906
|
-
this._directDescendantItems = new QueryList();
|
|
907
|
-
/** Subscription to tab events on the menu panel */
|
|
908
|
-
this._tabSubscription = Subscription.EMPTY;
|
|
909
|
-
this._xPosition = 'after';
|
|
910
|
-
this._yPosition = 'below';
|
|
911
|
-
/**
|
|
912
|
-
* Current horizontal offset. Used with `pan` and `pan-hidden`
|
|
913
|
-
* animation states.
|
|
914
|
-
*/
|
|
915
|
-
this.xOffset = 0;
|
|
916
|
-
}
|
|
917
|
-
ngAfterContentChecked() {
|
|
918
|
-
this._menuEmpty$.next(this._allItems.length < 1 ? true : false);
|
|
919
|
-
}
|
|
920
|
-
ngAfterContentInit() {
|
|
921
|
-
this._updateDirectDescendants();
|
|
922
|
-
this._keyManager = new FocusKeyManager(this._directDescendantItems)
|
|
923
|
-
.withWrap()
|
|
924
|
-
.skipPredicate((menuItem) => {
|
|
925
|
-
const hostElement = menuItem._getHostElement();
|
|
926
|
-
return hostElement instanceof HTMLButtonElement
|
|
927
|
-
? hostElement.disabled
|
|
928
|
-
: hostElement.hasAttribute('graniteTitle');
|
|
929
|
-
});
|
|
930
|
-
this._tabSubscription = this._keyManager.tabOut.subscribe(() => {
|
|
931
|
-
this.closed.emit('tab');
|
|
932
|
-
});
|
|
933
|
-
// If a user manually (programatically) focuses a menu item, we need to reflect that focus
|
|
934
|
-
// change back to the key manager. Note that we don't need to unsubscribe here because _focused
|
|
935
|
-
// is internal and we know that it gets completed on destroy.
|
|
936
|
-
this._directDescendantItems.changes
|
|
937
|
-
.pipe(startWith(this._directDescendantItems), switchMap((items) => merge(...items.map((item) => item._focused))))
|
|
938
|
-
.subscribe((focusedItem) => this._keyManager.updateActiveItem(focusedItem));
|
|
939
|
-
}
|
|
940
|
-
ngOnDestroy() {
|
|
941
|
-
this._directDescendantItems.destroy();
|
|
942
|
-
this._tabSubscription.unsubscribe();
|
|
943
|
-
this.closed.complete();
|
|
944
|
-
}
|
|
945
|
-
/**
|
|
946
|
-
* Stream that combines the `_hovered` observables of all the menu's items
|
|
947
|
-
* into a single observable. Emits whenever the hovered menu item changes.
|
|
948
|
-
*/
|
|
949
|
-
_hovered() {
|
|
950
|
-
// Coerce the `changes` property because Angular types it as `Observable<any>`
|
|
951
|
-
const itemChanges = this._directDescendantItems.changes;
|
|
952
|
-
return itemChanges.pipe(startWith(this._directDescendantItems),
|
|
953
|
-
// Hovering is not applicable when producing touch output
|
|
954
|
-
filter(() => {
|
|
955
|
-
var _a;
|
|
956
|
-
return ((_a = this._clientOutput) === null || _a === void 0 ? void 0 : _a.device) !== 'touch';
|
|
957
|
-
}), switchMap((items) => merge(...items.map((item) => item._hovered))));
|
|
958
|
-
}
|
|
959
|
-
/** Handle a keyboard event from the menu, delegating to the appropriate action. */
|
|
960
|
-
_handleKeydown(event) {
|
|
961
|
-
const key = event.key;
|
|
962
|
-
const manager = this._keyManager;
|
|
963
|
-
switch (key) {
|
|
964
|
-
case 'Escape':
|
|
965
|
-
if (!hasModifierKey(event)) {
|
|
966
|
-
event.preventDefault();
|
|
967
|
-
this.closed.emit('keydown');
|
|
968
|
-
}
|
|
969
|
-
break;
|
|
970
|
-
case 'ArrowLeft':
|
|
971
|
-
if (this.parentMenu && this.direction === 'ltr') {
|
|
972
|
-
this.closed.emit('keydown');
|
|
973
|
-
}
|
|
974
|
-
break;
|
|
975
|
-
case 'ArrowRight':
|
|
976
|
-
if (this.parentMenu && this.direction === 'rtl') {
|
|
977
|
-
this.closed.emit('keydown');
|
|
978
|
-
}
|
|
979
|
-
break;
|
|
980
|
-
case 'Home':
|
|
981
|
-
case 'End':
|
|
982
|
-
if (!hasModifierKey(event)) {
|
|
983
|
-
key === 'Home'
|
|
984
|
-
? manager.setFirstItemActive()
|
|
985
|
-
: manager.setLastItemActive();
|
|
986
|
-
event.preventDefault();
|
|
987
|
-
}
|
|
988
|
-
break;
|
|
989
|
-
default:
|
|
990
|
-
if (key === 'ArrowUp' || key === 'ArrowDown') {
|
|
991
|
-
manager.setFocusOrigin('keyboard');
|
|
992
|
-
}
|
|
993
|
-
manager.onKeydown(event);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
/**
|
|
997
|
-
* Focus the first item in the menu.
|
|
998
|
-
* @param origin Action from which the focus originated. Used to set the correct styling.
|
|
999
|
-
*/
|
|
1000
|
-
focusFirstItem(origin = 'program') {
|
|
1001
|
-
this._keyManager.setFocusOrigin(origin).setFirstItemActive();
|
|
1002
|
-
}
|
|
1003
|
-
/** Updates the `showTitle` property for touch device UI */
|
|
1004
|
-
_updateShowTitle() {
|
|
1005
|
-
this.showTitle = !!this.title || this.showBackButton;
|
|
1006
|
-
}
|
|
1007
|
-
/** Starts the enter animation */
|
|
1008
|
-
_startAnimation() {
|
|
1009
|
-
this._panelAnimationState = 'enter';
|
|
1010
|
-
}
|
|
1011
|
-
/** Resets the panel animation to its initial state. */
|
|
1012
|
-
_resetAnimation() {
|
|
1013
|
-
this._panelAnimationState = 'void';
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Starts the 'below' animation, moving a menu down, out of view below the
|
|
1017
|
-
* viewport. Used to close the whole menu, for example when clicking
|
|
1018
|
-
* the backdrop.
|
|
1019
|
-
*/
|
|
1020
|
-
_startTouchCloseDownAnimation() {
|
|
1021
|
-
this._panelAnimationState = 'below';
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Starts the 'below-with-delay' animation, moving a menu down, out of view below the
|
|
1025
|
-
* viewport. Used to close the whole menu as a response to the user tapping
|
|
1026
|
-
* a menu item. There is a short delay before the animation starts, to that
|
|
1027
|
-
* the user gets a visual feedback on what item was selected.
|
|
1028
|
-
*/
|
|
1029
|
-
_startTouchCloseDownAnimationWithDelay() {
|
|
1030
|
-
this._panelAnimationState = 'below-with-delay';
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Starts the 'void' animation, moving a (sub) menu out of view to the side
|
|
1034
|
-
* of the viewport. Used when going "back" from a sub menu.
|
|
1035
|
-
*/
|
|
1036
|
-
_startTouchCloseSideAnimation() {
|
|
1037
|
-
this._resetAnimation();
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Starts the enter-from-below animation, moving a (root) menu into view,
|
|
1041
|
-
* Animates upwards from a starting position below the viewport.
|
|
1042
|
-
*/
|
|
1043
|
-
_startTouchRootEnterAnimation() {
|
|
1044
|
-
this._panelAnimationState = 'enter-from-below';
|
|
1045
|
-
this.xOffset = 0;
|
|
1046
|
-
}
|
|
1047
|
-
/** Starts the enter animation, moving a (sub) menu into view. */
|
|
1048
|
-
_startTouchSubmenuEnterAnimation() {
|
|
1049
|
-
this._panelAnimationState = 'enter';
|
|
1050
|
-
this.xOffset = 0;
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Starts the pan animation, to position a submenu in a response
|
|
1054
|
-
* to user dragging sideways (panning).
|
|
1055
|
-
*/
|
|
1056
|
-
_startTouchPanAnimation(xOffset) {
|
|
1057
|
-
this._panelAnimationState = 'pan';
|
|
1058
|
-
this.xOffset = xOffset;
|
|
1059
|
-
}
|
|
1060
|
-
/**
|
|
1061
|
-
* Starts the pan-hidden animation, to position a parent menu next to an
|
|
1062
|
-
* active submenu that the user is dragging sideways (panning).
|
|
1063
|
-
*/
|
|
1064
|
-
_startTouchHidePanAnimation(xOffset) {
|
|
1065
|
-
this._panelAnimationState = 'pan-hidden';
|
|
1066
|
-
this.xOffset = xOffset;
|
|
1067
|
-
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Starts the hide animation, to make a parent menu slide out to leave
|
|
1070
|
-
* space for a submenu.
|
|
1071
|
-
*/
|
|
1072
|
-
_startTouchHideAnimation() {
|
|
1073
|
-
this._panelAnimationState = 'hide';
|
|
1074
|
-
this.xOffset = 0;
|
|
1075
|
-
}
|
|
1076
|
-
/** Callback that is invoked when the panel animation completes. */
|
|
1077
|
-
_onAnimationDone(event) {
|
|
1078
|
-
this._animationDone.next(event);
|
|
1079
|
-
this._isAnimating = false;
|
|
1080
|
-
}
|
|
1081
|
-
_onAnimationStart(event) {
|
|
1082
|
-
this._isAnimating = true;
|
|
1083
|
-
// Scroll the content element to the top as soon as the animation starts. This is necessary,
|
|
1084
|
-
// because we move focus to the first item while it's still being animated, which can throw
|
|
1085
|
-
// the browser off when it determines the scroll position. Alternatively we can move focus
|
|
1086
|
-
// when the animation is done, however moving focus asynchronously will interrupt screen
|
|
1087
|
-
// readers which are in the process of reading out the menu already. We take the `element`
|
|
1088
|
-
// from the `event` since we can't use a `ViewChild` to access the pane.
|
|
1089
|
-
if ((event.toState === 'enter' || event.toState === 'enter-from-below') &&
|
|
1090
|
-
this._keyManager.activeItemIndex === 0) {
|
|
1091
|
-
event.element.scrollTop = 0;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
/**
|
|
1095
|
-
* Handle click on the menu by emitting on the `closed` emitter
|
|
1096
|
-
* with a `click` reason
|
|
1097
|
-
*/
|
|
1098
|
-
_handleClick() {
|
|
1099
|
-
this.closed.emit('click');
|
|
1100
|
-
}
|
|
1101
|
-
/**
|
|
1102
|
-
* Handle click on the close button by emitting on the `closed` emitter
|
|
1103
|
-
* without any particular reason
|
|
1104
|
-
*/
|
|
1105
|
-
_handleCloseClick() {
|
|
1106
|
-
this.closed.emit();
|
|
1107
|
-
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Handle click on the back icon by emitting on the `clicked` emitter
|
|
1110
|
-
*/
|
|
1111
|
-
_handleBackClick(e) {
|
|
1112
|
-
if (this.showBackButton) {
|
|
1113
|
-
// Close submenu keydown-style: close only this menu and leave parents open
|
|
1114
|
-
this.closed.emit('keydown');
|
|
1115
|
-
}
|
|
1116
|
-
e.stopPropagation();
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Update client device information for the menu and its menu items.
|
|
1120
|
-
*/
|
|
1121
|
-
_setDevice(clientInput, clientOutput) {
|
|
1122
|
-
this._clientInput = clientInput;
|
|
1123
|
-
this._clientOutput = clientOutput;
|
|
1124
|
-
this._directDescendantItems.forEach((item) => {
|
|
1125
|
-
item._clientInput = clientInput;
|
|
1126
|
-
item._clientOutput = clientOutput;
|
|
1127
|
-
});
|
|
1128
|
-
this._changeDetectorRef.markForCheck();
|
|
1129
|
-
}
|
|
1130
|
-
/**
|
|
1131
|
-
* Resets the active item in the menu. This is used when the menu is opened, allowing
|
|
1132
|
-
* the user to start from the first option when pressing the down arrow.
|
|
1133
|
-
*/
|
|
1134
|
-
resetActiveItem() {
|
|
1135
|
-
this._keyManager.setActiveItem(-1);
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Sets up a stream that will keep track of any newly-added menu items and will update the list
|
|
1139
|
-
* of direct descendants. We collect the descendants this way, because `_allItems` can include
|
|
1140
|
-
* items that are part of child menus, and using a custom way of registering items is unreliable
|
|
1141
|
-
* when it comes to maintaining the item order.
|
|
1142
|
-
*/
|
|
1143
|
-
_updateDirectDescendants() {
|
|
1144
|
-
this._allItems.changes
|
|
1145
|
-
.pipe(startWith(this._allItems))
|
|
1146
|
-
.subscribe((items) => {
|
|
1147
|
-
this._directDescendantItems.reset(items.filter((item) => item._parentMenu === this));
|
|
1148
|
-
this._directDescendantItems.notifyOnChanges();
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
_MenuBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: _MenuBaseComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1153
|
-
_MenuBaseComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: _MenuBaseComponent, inputs: { xPosition: "xPosition", yPosition: "yPosition", title: "title", closeLabel: "closeLabel", openOnHover: "openOnHover" }, outputs: { closed: "closed" }, queries: [{ propertyName: "_allItems", predicate: GraniteMenuItemComponent, descendants: true }], viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
|
|
1154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: _MenuBaseComponent, decorators: [{
|
|
1155
|
-
type: Directive
|
|
1156
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { xPosition: [{
|
|
1157
|
-
type: Input
|
|
1158
|
-
}], yPosition: [{
|
|
1159
|
-
type: Input
|
|
1160
|
-
}], title: [{
|
|
1161
|
-
type: Input
|
|
1162
|
-
}], closeLabel: [{
|
|
1163
|
-
type: Input
|
|
1164
|
-
}], openOnHover: [{
|
|
1165
|
-
type: Input
|
|
1166
|
-
}], templateRef: [{
|
|
1167
|
-
type: ViewChild,
|
|
1168
|
-
args: [TemplateRef]
|
|
1169
|
-
}], _allItems: [{
|
|
1170
|
-
type: ContentChildren,
|
|
1171
|
-
args: [GraniteMenuItemComponent, { descendants: true }]
|
|
1172
|
-
}], closed: [{
|
|
1173
|
-
type: Output
|
|
1174
|
-
}] } });
|
|
1175
|
-
|
|
1176
|
-
class GraniteMenuTouchCloseComponent {
|
|
1177
|
-
}
|
|
1178
|
-
GraniteMenuTouchCloseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuTouchCloseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1179
|
-
GraniteMenuTouchCloseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteMenuTouchCloseComponent, selector: "[graniteMenuTouchCloseItem]", host: { properties: { "class.granite-device-output-touch": "true" } }, exportAs: ["graniteMenuTouchCloseItem"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-8);width:100%;max-width:100%;-webkit-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{-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-program-focused,:host.cdk-keyboard-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{padding-inline-end:var(--granite-spacing-24)}html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left{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-24)}: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-24)}: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)}}html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}\n"] });
|
|
1180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuTouchCloseComponent, decorators: [{
|
|
1181
|
-
type: Component,
|
|
1182
|
-
args: [{ selector: '[graniteMenuTouchCloseItem]', template: '<ng-content></ng-content>', exportAs: 'graniteMenuTouchCloseItem', host: {
|
|
1183
|
-
'[class.granite-device-output-touch]': 'true',
|
|
1184
|
-
}, styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-8);width:100%;max-width:100%;-webkit-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{-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-program-focused,:host.cdk-keyboard-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{padding-inline-end:var(--granite-spacing-24)}html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left{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-24)}: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-24)}: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)}}html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}\n"] }]
|
|
1185
|
-
}] });
|
|
1186
|
-
|
|
1187
|
-
class GraniteMenuTouchTitleItemComponent {
|
|
1188
|
-
constructor(
|
|
1189
|
-
/** If this is an item on a _submenu_, its parent menu will have a parent */
|
|
1190
|
-
_parentMenu) {
|
|
1191
|
-
/**
|
|
1192
|
-
* Whether the menu item acts as a trigger to return to a parent menu
|
|
1193
|
-
* (used for styling)
|
|
1194
|
-
*/
|
|
1195
|
-
this._triggersBack = false;
|
|
1196
|
-
this._triggersBack = !!_parentMenu.parentMenu;
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
GraniteMenuTouchTitleItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuTouchTitleItemComponent, deps: [{ token: GRANITE_MENU_PANEL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1200
|
-
GraniteMenuTouchTitleItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteMenuTouchTitleItemComponent, selector: "[graniteMenuTouchTitleItem]", host: { properties: { "class.granite-menu-item-title": "true", "class.granite-menu-item-back-trigger": "_triggersBack", "class.granite-device-output-touch": "true" } }, exportAs: ["graniteMenuTouchTitleItem"], ngImport: i0, template: `
|
|
1201
|
-
<ng-container *ngIf="_triggersBack">
|
|
1202
|
-
<granite-icon
|
|
1203
|
-
class="caret-left"
|
|
1204
|
-
[fontIcon]="'icon-caret-left'"
|
|
1205
|
-
></granite-icon>
|
|
1206
|
-
<granite-icon
|
|
1207
|
-
class="caret-right"
|
|
1208
|
-
[fontIcon]="'icon-caret-right'"
|
|
1209
|
-
></granite-icon>
|
|
1210
|
-
</ng-container>
|
|
1211
|
-
<ng-content></ng-content>
|
|
1212
|
-
`, isInline: true, styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-8);width:100%;max-width:100%;-webkit-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{-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-program-focused,:host.cdk-keyboard-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{padding-inline-end:var(--granite-spacing-24)}html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left{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-24)}: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-24)}: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)}}html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: GraniteIconComponent, selector: "granite-icon", inputs: ["fontIcon"] }] });
|
|
1213
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuTouchTitleItemComponent, decorators: [{
|
|
1214
|
-
type: Component,
|
|
1215
|
-
args: [{ selector: '[graniteMenuTouchTitleItem]', template: `
|
|
1216
|
-
<ng-container *ngIf="_triggersBack">
|
|
1217
|
-
<granite-icon
|
|
1218
|
-
class="caret-left"
|
|
1219
|
-
[fontIcon]="'icon-caret-left'"
|
|
1220
|
-
></granite-icon>
|
|
1221
|
-
<granite-icon
|
|
1222
|
-
class="caret-right"
|
|
1223
|
-
[fontIcon]="'icon-caret-right'"
|
|
1224
|
-
></granite-icon>
|
|
1225
|
-
</ng-container>
|
|
1226
|
-
<ng-content></ng-content>
|
|
1227
|
-
`, exportAs: 'graniteMenuTouchTitleItem', host: {
|
|
1228
|
-
'[class.granite-menu-item-title]': 'true',
|
|
1229
|
-
'[class.granite-menu-item-back-trigger]': '_triggersBack',
|
|
1230
|
-
'[class.granite-device-output-touch]': 'true',
|
|
1231
|
-
}, styles: [":host{display:block;position:relative;line-height:2rem;padding:0 var(--granite-spacing-8);width:100%;max-width:100%;-webkit-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{-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-program-focused,:host.cdk-keyboard-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{padding-inline-end:var(--granite-spacing-24)}html[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-menu-item-submenu-trigger granite-icon{right:var(--granite-spacing-4)}html[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-menu-item-submenu-trigger granite-icon{left:var(--granite-spacing-4)}[dir=rtl] :host.granite-menu-item-submenu-trigger granite-icon.caret-right{display:none}[dir=ltr] :host.granite-menu-item-submenu-trigger granite-icon.caret-left{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-24)}: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-24)}: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)}}html[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}:host-context([dir=ltr]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{left:var(--granite-spacing-4)}html[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}:host-context([dir=rtl]) :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon{right:var(--granite-spacing-4)}[dir=rtl] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-left{display:none}[dir=ltr] :host.granite-device-output-touch.granite-menu-item-back-trigger granite-icon.caret-right{display:none}:host:disabled:not(.granite-menu-item-title){opacity:.4;cursor:default}\n"] }]
|
|
1232
|
-
}], ctorParameters: function () {
|
|
1233
|
-
return [{ type: _MenuBaseComponent, decorators: [{
|
|
1234
|
-
type: Inject,
|
|
1235
|
-
args: [GRANITE_MENU_PANEL]
|
|
1236
|
-
}, {
|
|
1237
|
-
type: Optional
|
|
1238
|
-
}] }];
|
|
1239
|
-
} });
|
|
1240
|
-
|
|
1241
|
-
class GraniteMenuComponent extends _MenuBaseComponent {
|
|
1242
|
-
}
|
|
1243
|
-
GraniteMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1244
|
-
GraniteMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteMenuComponent, selector: "granite-menu", providers: [
|
|
1245
|
-
{ provide: GRANITE_MENU_PANEL, useExisting: GraniteMenuComponent },
|
|
1246
|
-
], exportAs: ["graniteMenu"], usesInheritance: true, ngImport: i0, 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", 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;outline:0;-webkit-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-4)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-thumb{background-color:var(--granite-color-border-hard);border-radius:calc(var(--granite-spacing-16) * .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;outline:0;-webkit-user-select:none;user-select:none;filter:drop-shadow(var(--granite-shadow-l));border-radius:.25rem}.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-4)}.granite-menu.granite-device-output-touch.close{margin-inline-start:var(--granite-spacing-4);margin-inline-end:var(--granite-spacing-4);margin-block-end:var(--granite-spacing-4)}.granite-menu.granite-device-output-touch .header-container{position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{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;outline:0;-webkit-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-4)}.close:not(:empty).close{margin-inline-start:var(--granite-spacing-4);margin-inline-end:var(--granite-spacing-4);margin-block-end:var(--granite-spacing-4)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: GraniteMenuTouchCloseComponent, selector: "[graniteMenuTouchCloseItem]", exportAs: ["graniteMenuTouchCloseItem"] }, { kind: "component", type: GraniteMenuTouchTitleItemComponent, selector: "[graniteMenuTouchTitleItem]", exportAs: ["graniteMenuTouchTitleItem"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], animations: [
|
|
1247
|
-
graniteMenuDesktopAnimations.transformMenuDesktop,
|
|
1248
|
-
graniteMenuTouchAnimations.transformMenuTouch,
|
|
1249
|
-
graniteMenuTouchAnimations.transformCloseButton,
|
|
1250
|
-
], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1251
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuComponent, decorators: [{
|
|
1252
|
-
type: Component,
|
|
1253
|
-
args: [{ selector: 'granite-menu', changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'graniteMenu', animations: [
|
|
1254
|
-
graniteMenuDesktopAnimations.transformMenuDesktop,
|
|
1255
|
-
graniteMenuTouchAnimations.transformMenuTouch,
|
|
1256
|
-
graniteMenuTouchAnimations.transformCloseButton,
|
|
1257
|
-
], providers: [
|
|
1258
|
-
{ provide: GRANITE_MENU_PANEL, useExisting: GraniteMenuComponent },
|
|
1259
|
-
], 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", 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;outline:0;-webkit-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-4)}.granite-menu:not(.granite-device-output-touch)::-webkit-scrollbar-thumb{background-color:var(--granite-color-border-hard);border-radius:calc(var(--granite-spacing-16) * .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;outline:0;-webkit-user-select:none;user-select:none;filter:drop-shadow(var(--granite-shadow-l));border-radius:.25rem}.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-4)}.granite-menu.granite-device-output-touch.close{margin-inline-start:var(--granite-spacing-4);margin-inline-end:var(--granite-spacing-4);margin-block-end:var(--granite-spacing-4)}.granite-menu.granite-device-output-touch .header-container{position:sticky;top:0;background-color:var(--granite-color-background-variant);z-index:1}.granite-menu.granite-device-output-touch .footer-container{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;outline:0;-webkit-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-4)}.close:not(:empty).close{margin-inline-start:var(--granite-spacing-4);margin-inline-end:var(--granite-spacing-4);margin-block-end:var(--granite-spacing-4)}\n"] }]
|
|
1260
|
-
}] });
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* Injection token used to provide components knowledge of what device types
|
|
1264
|
-
* are being used for input.
|
|
1265
|
-
*/
|
|
1266
|
-
const GRANITE_CLIENT_INPUT = new InjectionToken('GRANITE_CLIENT_INPUT');
|
|
1267
|
-
/**
|
|
1268
|
-
* Injection token used to provide components knowledge of what device type
|
|
1269
|
-
* is being used for output.
|
|
1270
|
-
*/
|
|
1271
|
-
const GRANITE_CLIENT_OUTPUT = new InjectionToken('GRANITE_CLIENT_OUTPUT');
|
|
1272
|
-
const deviceDesktop = {
|
|
1273
|
-
input: { devices: ['mouse', 'keyboard'] },
|
|
1274
|
-
output: { device: 'desktop' },
|
|
1275
|
-
};
|
|
1276
|
-
const deviceTouch = {
|
|
1277
|
-
input: { devices: ['touch', 'onscreen-keyboard'] },
|
|
1278
|
-
output: { device: 'touch' },
|
|
1279
|
-
};
|
|
1280
|
-
|
|
1281
|
-
/** Options for binding a passive event listener. */
|
|
1282
|
-
const passiveEventListenerOptions = normalizePassiveListenerOptions({
|
|
1283
|
-
passive: true,
|
|
1284
|
-
});
|
|
1285
|
-
//#endregion --- Touch device customizations ---
|
|
1286
|
-
/**
|
|
1287
|
-
* Directive used to turn a button element into a (popup) menu trigger
|
|
1288
|
-
*
|
|
1289
|
-
* Stripped-down version of Angular Material's menu trigger directive (.../menu/menu-trigger.ts)
|
|
1290
|
-
*/
|
|
1291
|
-
class GraniteMenuTriggerForDirective {
|
|
1292
|
-
constructor(_overlay, _element, _viewContainerRef,
|
|
1293
|
-
/** If this is a _submenu_ trigger, it will have a parent menu */
|
|
1294
|
-
_parentMenu,
|
|
1295
|
-
//#region --- Touch device customizations ---
|
|
1296
|
-
/** Client input device information */
|
|
1297
|
-
_clientInput,
|
|
1298
|
-
/** Client output device information */
|
|
1299
|
-
_clientOutput,
|
|
1300
|
-
//#endregion --- Touch device customizations ---
|
|
1301
|
-
/**
|
|
1302
|
-
* If this is a _submenu_ trigger, there should be a corresponding menu
|
|
1303
|
-
* item directive present as well:
|
|
1304
|
-
*
|
|
1305
|
-
* <button graniteMenuItem [graniteMenuTriggerFor]="...">
|
|
1306
|
-
* ^-- This one
|
|
1307
|
-
*/
|
|
1308
|
-
_menuItemInstance, _dir, _focusMonitor,
|
|
1309
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1310
|
-
document) {
|
|
1311
|
-
this._overlay = _overlay;
|
|
1312
|
-
this._element = _element;
|
|
1313
|
-
this._viewContainerRef = _viewContainerRef;
|
|
1314
|
-
this._parentMenu = _parentMenu;
|
|
1315
|
-
this._clientInput = _clientInput;
|
|
1316
|
-
this._clientOutput = _clientOutput;
|
|
1317
|
-
this._menuItemInstance = _menuItemInstance;
|
|
1318
|
-
this._dir = _dir;
|
|
1319
|
-
this._focusMonitor = _focusMonitor;
|
|
1320
|
-
this.openOnClick = true;
|
|
1321
|
-
/** Whether the associated menu is open */
|
|
1322
|
-
this._isMenuOpen = false;
|
|
1323
|
-
// Tracking input type is necessary so it's possible to only auto-focus
|
|
1324
|
-
// the first item of the list when the menu is opened via the keyboard
|
|
1325
|
-
this._openedBy = null;
|
|
1326
|
-
this._hoverSubscription = Subscription.EMPTY;
|
|
1327
|
-
this._menuCloseSubscription = Subscription.EMPTY;
|
|
1328
|
-
this._closingActionsSubscription = Subscription.EMPTY;
|
|
1329
|
-
this._portal = null;
|
|
1330
|
-
this._overlayRef = null;
|
|
1331
|
-
this._touchTouchingElement = false;
|
|
1332
|
-
/**
|
|
1333
|
-
* Handles touch start events on the trigger.
|
|
1334
|
-
* Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
|
|
1335
|
-
*/
|
|
1336
|
-
this._handleTouchStart = () => {
|
|
1337
|
-
this._openedBy = 'touch';
|
|
1338
|
-
};
|
|
1339
|
-
// ----------------------------------------- //
|
|
1340
|
-
// --- Here be poor man's touch gestures --- //
|
|
1341
|
-
// ----------------------------------------- //
|
|
1342
|
-
// TODO: Replace with Hammer or other gesture library
|
|
1343
|
-
/**
|
|
1344
|
-
* Handles touch start events on the overlay host element (wrapper).
|
|
1345
|
-
* Needs to be an arrow function so we can easily use addEventListener and removeEventListener.
|
|
1346
|
-
*/
|
|
1347
|
-
this._handleOverlayTouchStart = (event) => {
|
|
1348
|
-
if (this.menu._isAnimating) {
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
this._touchStartTime = new Date().getTime();
|
|
1352
|
-
this._touchStartX = event.changedTouches[0].clientX;
|
|
1353
|
-
this._touchStartY = event.changedTouches[0].clientY;
|
|
1354
|
-
this._touchCurrentX = this._touchStartX;
|
|
1355
|
-
this._touchCurrentY = this._touchStartY;
|
|
1356
|
-
this._touchTranslateX = 0;
|
|
1357
|
-
this._touchMaxX =
|
|
1358
|
-
this._overlayRef.hostElement.getBoundingClientRect().width;
|
|
1359
|
-
this._touchLockedX = null;
|
|
1360
|
-
this._touchTouchingElement = true;
|
|
1361
|
-
};
|
|
1362
|
-
this._handleOverlayTouchMove = (event) => {
|
|
1363
|
-
if (!this._touchTouchingElement || this.menu._isAnimating) {
|
|
1364
|
-
return;
|
|
1365
|
-
}
|
|
1366
|
-
if (this._touchLockedX) {
|
|
1367
|
-
return;
|
|
1368
|
-
}
|
|
1369
|
-
this._touchCurrentX = event.changedTouches[0].clientX;
|
|
1370
|
-
this._touchCurrentY = event.changedTouches[0].clientY;
|
|
1371
|
-
// Lock X-axis pan if initiating pan on Y-axis
|
|
1372
|
-
if (this._touchLockedX === null) {
|
|
1373
|
-
const dy = Math.abs(this._touchCurrentY - this._touchStartY);
|
|
1374
|
-
const dx = Math.abs(this._touchCurrentX - this._touchStartX);
|
|
1375
|
-
if (dx > 10 || dy > 10) {
|
|
1376
|
-
this._touchLockedX = dy > dx;
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
// Restrict to right pan/swipe and make menu movement extremely slow when
|
|
1381
|
-
// moved past allowed limits.
|
|
1382
|
-
const menuMargin = 16;
|
|
1383
|
-
this._touchTranslateX = this._touchCurrentX - this._touchStartX;
|
|
1384
|
-
if (this._touchTranslateX < 0) {
|
|
1385
|
-
this._touchTranslateX = this.easeOutExpo(this._touchTranslateX, 0, -menuMargin / 2, this._touchMaxX * -4);
|
|
1386
|
-
}
|
|
1387
|
-
else if (!this._parentMenu) {
|
|
1388
|
-
this._touchTranslateX = this.easeOutExpo(this._touchTranslateX, 0, menuMargin / 2, this._touchMaxX * 4);
|
|
1389
|
-
}
|
|
1390
|
-
else if (this._touchTranslateX > this._touchMaxX) {
|
|
1391
|
-
this._touchTranslateX = this.easeOutExpo(this._touchTranslateX - this._touchMaxX, this._touchMaxX, menuMargin / 2, this._touchMaxX * 4);
|
|
1392
|
-
}
|
|
1393
|
-
// Set new sub menu position and tell any parent to follow;
|
|
1394
|
-
this.animateSetMenuPosition(this._touchTranslateX);
|
|
1395
|
-
};
|
|
1396
|
-
this._handleOverlayTouchEnd = () => {
|
|
1397
|
-
if (!this._touchTouchingElement || this.menu._isAnimating) {
|
|
1398
|
-
return;
|
|
1399
|
-
}
|
|
1400
|
-
this._touchTranslateX = this._touchCurrentX - this._touchStartX;
|
|
1401
|
-
if (this._touchTranslateX === 0) {
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
this._touchTouchingElement = false;
|
|
1405
|
-
this._touchTimeTaken = new Date().getTime() - this._touchStartTime;
|
|
1406
|
-
const swipeMinDistance = 10;
|
|
1407
|
-
const swipeMinTime = 50;
|
|
1408
|
-
const swipeMaxTime = 300;
|
|
1409
|
-
const pannedHalfwayRight = this._touchTranslateX > this._touchMaxX / 2;
|
|
1410
|
-
const swipedRight = this._touchTranslateX > this._touchMaxX / swipeMinDistance &&
|
|
1411
|
-
this._touchTimeTaken > swipeMinTime &&
|
|
1412
|
-
this._touchTimeTaken < swipeMaxTime;
|
|
1413
|
-
if (!!this._parentMenu && (swipedRight || pannedHalfwayRight)) {
|
|
1414
|
-
// Close submenu keydown-style: close only this menu and leave parents open
|
|
1415
|
-
this.menu.closed.emit('keydown');
|
|
1416
|
-
}
|
|
1417
|
-
else {
|
|
1418
|
-
// Pan ended but the menu was not moved far enough. Reset menus to
|
|
1419
|
-
// where they were before panning stared.
|
|
1420
|
-
this.animateOpenMenu();
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1423
|
-
_element.nativeElement.addEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
|
|
1424
|
-
if (_menuItemInstance) {
|
|
1425
|
-
_menuItemInstance._triggersSubmenu = this.triggersSubmenu();
|
|
1426
|
-
}
|
|
1427
|
-
this._document = document;
|
|
1428
|
-
}
|
|
1429
|
-
ngOnChanges(changes) {
|
|
1430
|
-
if (changes.menu) {
|
|
1431
|
-
this._handleMenuChange();
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
ngAfterContentInit() {
|
|
1435
|
-
// removed checkMenu here to avoid errors in dynamically genarated menus
|
|
1436
|
-
// menu is checked when opening the menu
|
|
1437
|
-
// this._checkMenu();
|
|
1438
|
-
this._handleHover();
|
|
1439
|
-
}
|
|
1440
|
-
ngOnDestroy() {
|
|
1441
|
-
if (this._overlayRef) {
|
|
1442
|
-
//#region --- Touch device customizations ---
|
|
1443
|
-
this.removeOverlayListeners();
|
|
1444
|
-
//#endregion --- Touch device customizations ---
|
|
1445
|
-
this._overlayRef.dispose();
|
|
1446
|
-
this._overlayRef = null;
|
|
1447
|
-
}
|
|
1448
|
-
this._element.nativeElement.removeEventListener('touchstart', this._handleTouchStart, passiveEventListenerOptions);
|
|
1449
|
-
this._hoverSubscription.unsubscribe();
|
|
1450
|
-
this._menuCloseSubscription.unsubscribe();
|
|
1451
|
-
this._closingActionsSubscription.unsubscribe();
|
|
1452
|
-
}
|
|
1453
|
-
/** Handles change of associated menu */
|
|
1454
|
-
_handleMenuChange() {
|
|
1455
|
-
this._menuCloseSubscription.unsubscribe();
|
|
1456
|
-
// Close the menu overlay when the menu itself says it wants to be closed
|
|
1457
|
-
if (this.menu) {
|
|
1458
|
-
const closed = this.menu.closed;
|
|
1459
|
-
this._menuCloseSubscription = closed.subscribe((reason) => {
|
|
1460
|
-
//#region --- Touch device customizations ---
|
|
1461
|
-
if (this.menu._isClosing) {
|
|
1462
|
-
return;
|
|
1463
|
-
}
|
|
1464
|
-
this.menu._isClosing = true;
|
|
1465
|
-
// Get rid of the menu and tell any parent to restore its position
|
|
1466
|
-
if (this._clientOutput.device === 'touch') {
|
|
1467
|
-
// First we wait for any running animation to complete
|
|
1468
|
-
const runningAnimationDone = this.menu._isAnimating
|
|
1469
|
-
? this.menu._animationDone
|
|
1470
|
-
: of([null]);
|
|
1471
|
-
runningAnimationDone
|
|
1472
|
-
.pipe(take(1), delay(0, asapScheduler))
|
|
1473
|
-
// eslint-disable-next-line rxjs/no-nested-subscribe
|
|
1474
|
-
.subscribe(() => {
|
|
1475
|
-
this.animateCloseMenu(reason !== 'keydown', reason === 'click');
|
|
1476
|
-
this.menu._animationDone
|
|
1477
|
-
.pipe(take(1), delay(0, asapScheduler))
|
|
1478
|
-
// eslint-disable-next-line rxjs/no-nested-subscribe
|
|
1479
|
-
.subscribe(() => this._destroyMenu());
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
else {
|
|
1483
|
-
//#endregion --- Touch device customizations ---
|
|
1484
|
-
this._destroyMenu();
|
|
1485
|
-
}
|
|
1486
|
-
// If a click closed the menu, we should close the entire chain of nested menus.
|
|
1487
|
-
if ((reason === 'click' || reason === 'tab') && this._parentMenu) {
|
|
1488
|
-
this._parentMenu.closed.emit(reason);
|
|
1489
|
-
}
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
isOpen() {
|
|
1494
|
-
return this._isMenuOpen;
|
|
1495
|
-
}
|
|
1496
|
-
/** Open the associated menu */
|
|
1497
|
-
openMenu() {
|
|
1498
|
-
var _a;
|
|
1499
|
-
if (this._isMenuOpen) {
|
|
1500
|
-
return;
|
|
1501
|
-
}
|
|
1502
|
-
this._checkMenu();
|
|
1503
|
-
this.menu.parentMenu = this.triggersSubmenu()
|
|
1504
|
-
? this._parentMenu
|
|
1505
|
-
: undefined;
|
|
1506
|
-
this.menu.direction = this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
1507
|
-
if (this._parentMenu) {
|
|
1508
|
-
// Menu triggers inherit target device types from their parent.
|
|
1509
|
-
// Ultimately it is the root trigger that determines device types for
|
|
1510
|
-
// the whole menu hierarchy.
|
|
1511
|
-
this._clientInput = this._parentMenu._clientInput;
|
|
1512
|
-
this._clientOutput = this._parentMenu._clientOutput;
|
|
1513
|
-
}
|
|
1514
|
-
//#region --- Touch device customizations ---
|
|
1515
|
-
// Make the menu we're about to open use the same devices as the trigger
|
|
1516
|
-
this.menu._setDevice(this._clientInput, this._clientOutput);
|
|
1517
|
-
if (this._clientOutput.device === 'touch') {
|
|
1518
|
-
this.menu.showBackButton = !!this._parentMenu;
|
|
1519
|
-
this.menu._updateShowTitle();
|
|
1520
|
-
if (!this.menu.closeLabel) {
|
|
1521
|
-
this.menu.closeLabel = (_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a.closeLabel;
|
|
1522
|
-
}
|
|
1523
|
-
this.menu.showCloseButton = !!this.menu.closeLabel;
|
|
1524
|
-
}
|
|
1525
|
-
this.menu._isClosing = false;
|
|
1526
|
-
const panelClass = [];
|
|
1527
|
-
if (this._clientOutput.device === 'touch') {
|
|
1528
|
-
panelClass.push('granite-overlay-pane-fill-width-bottom');
|
|
1529
|
-
}
|
|
1530
|
-
const scrollStrategy = this._clientOutput.device !== 'touch'
|
|
1531
|
-
? this._overlay.scrollStrategies.reposition()
|
|
1532
|
-
: undefined;
|
|
1533
|
-
const hasBackdrop = this._clientOutput.device === 'touch' && !this.triggersSubmenu();
|
|
1534
|
-
//#endregion --- Touch device customizations ---
|
|
1535
|
-
// Create an overlay to stuff the menu (portal) into below
|
|
1536
|
-
if (!this._overlayRef) {
|
|
1537
|
-
const config = new OverlayConfig({
|
|
1538
|
-
positionStrategy: this._positionStrategy(),
|
|
1539
|
-
backdropClass: 'granite-overlay-dark-glass-backdrop',
|
|
1540
|
-
scrollStrategy,
|
|
1541
|
-
direction: this._dir,
|
|
1542
|
-
panelClass,
|
|
1543
|
-
hasBackdrop,
|
|
1544
|
-
});
|
|
1545
|
-
this._overlayRef = this._overlay.create(config);
|
|
1546
|
-
//#region --- Touch device customizations ---
|
|
1547
|
-
// Add touch listener for submenu back pan/swipe
|
|
1548
|
-
if (this._clientOutput.device === 'touch') {
|
|
1549
|
-
this.addOverlayListeners();
|
|
1550
|
-
}
|
|
1551
|
-
//#endregion --- Touch device customizations ---
|
|
1552
|
-
}
|
|
1553
|
-
else {
|
|
1554
|
-
// Reset animation state for reused overlays
|
|
1555
|
-
if (this._clientOutput.device === 'touch') {
|
|
1556
|
-
this.menu._panelAnimationState = 'void';
|
|
1557
|
-
}
|
|
1558
|
-
}
|
|
1559
|
-
// Create portal from associated menu's template
|
|
1560
|
-
if (!this._portal || this._portal.templateRef !== this.menu.templateRef) {
|
|
1561
|
-
this._portal = new TemplatePortal(this.menu.templateRef, this._viewContainerRef);
|
|
1562
|
-
}
|
|
1563
|
-
// Attach menu portal to overlay ref (which is a portal outlet)
|
|
1564
|
-
this._overlayRef.attach(this._portal);
|
|
1565
|
-
// Subscribe to stream that emits whenever an action that should close the menu occurs
|
|
1566
|
-
this._closingActionsSubscription = this._menuClosingActions().subscribe(() => this.closeMenu());
|
|
1567
|
-
this.animateOpenMenu();
|
|
1568
|
-
this._setIsMenuOpen(true);
|
|
1569
|
-
this.menu.focusFirstItem(this._openedBy || 'program');
|
|
1570
|
-
}
|
|
1571
|
-
/** Whether the menu triggers a sub-menu or a top-level one. */
|
|
1572
|
-
triggersSubmenu() {
|
|
1573
|
-
return !!(this._menuItemInstance && this._parentMenu);
|
|
1574
|
-
}
|
|
1575
|
-
/** Toggles the menu between the open and closed states. */
|
|
1576
|
-
toggleMenu() {
|
|
1577
|
-
if (this._isMenuOpen) {
|
|
1578
|
-
this.closeMenu();
|
|
1579
|
-
}
|
|
1580
|
-
else if (this.openOnClick) {
|
|
1581
|
-
this.openMenu();
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
/** Close the associated menu */
|
|
1585
|
-
closeMenu() {
|
|
1586
|
-
this.menu.closed.emit();
|
|
1587
|
-
}
|
|
1588
|
-
/**
|
|
1589
|
-
* Focuses the menu trigger.
|
|
1590
|
-
* @param origin Source of the menu trigger's focus.
|
|
1591
|
-
*/
|
|
1592
|
-
focus(origin = 'program', options) {
|
|
1593
|
-
if (this._focusMonitor) {
|
|
1594
|
-
this._focusMonitor.focusVia(this._element, origin, options);
|
|
1595
|
-
}
|
|
1596
|
-
else {
|
|
1597
|
-
this._element.nativeElement.focus(options);
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
/** Detach menu portal from overlay and update open state */
|
|
1601
|
-
_destroyMenu() {
|
|
1602
|
-
if (!this._overlayRef || !this._isMenuOpen) {
|
|
1603
|
-
return;
|
|
1604
|
-
}
|
|
1605
|
-
this._closingActionsSubscription.unsubscribe();
|
|
1606
|
-
this._overlayRef.detach();
|
|
1607
|
-
this._restoreFocus();
|
|
1608
|
-
this.menu._resetAnimation();
|
|
1609
|
-
this._setIsMenuOpen(false);
|
|
1610
|
-
}
|
|
1611
|
-
/** Handles mouse presses on the trigger. */
|
|
1612
|
-
_handleMousedown(event) {
|
|
1613
|
-
if (!isFakeMousedownFromScreenReader(event)) {
|
|
1614
|
-
if (this._openedBy !== 'touch') {
|
|
1615
|
-
// Since right or middle button clicks won't trigger the `click` event,
|
|
1616
|
-
// we shouldn't consider the menu as opened by mouse in those cases.
|
|
1617
|
-
this._openedBy = event.button === 0 ? 'mouse' : null;
|
|
1618
|
-
}
|
|
1619
|
-
// Since clicking on the trigger won't close the menu if it opens a sub-menu,
|
|
1620
|
-
// we should prevent focus from moving onto it via click to avoid the
|
|
1621
|
-
// highlight from lingering on the menu item.
|
|
1622
|
-
if (this.triggersSubmenu() && !this._toggleOnSubmenuClick()) {
|
|
1623
|
-
event.preventDefault();
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
/** Handles key presses on the trigger. */
|
|
1628
|
-
_handleKeydown(event) {
|
|
1629
|
-
const key = event.key;
|
|
1630
|
-
if (this.triggersSubmenu() &&
|
|
1631
|
-
((key === 'ArrowRight' && this._dir.value === 'ltr') ||
|
|
1632
|
-
(key === 'ArrowLeft' && this._dir.value === 'rtl'))) {
|
|
1633
|
-
this.openMenu();
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
/** Handles click events on the trigger. */
|
|
1637
|
-
_handleClick(event) {
|
|
1638
|
-
if (this.triggersSubmenu()) {
|
|
1639
|
-
// Stop event propagation to avoid closing the parent menu.
|
|
1640
|
-
event.stopPropagation();
|
|
1641
|
-
this._toggleOnSubmenuClick() ? this.toggleMenu() : this.openMenu();
|
|
1642
|
-
}
|
|
1643
|
-
else {
|
|
1644
|
-
this.toggleMenu();
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
/** Handles the cases where the user hovers over the trigger. */
|
|
1648
|
-
_handleHover() {
|
|
1649
|
-
// Subscribe to changes in the hovered item in order to toggle the panel.
|
|
1650
|
-
if (!this.triggersSubmenu() || !this._parentMenu) {
|
|
1651
|
-
return;
|
|
1652
|
-
}
|
|
1653
|
-
this._hoverSubscription = this._parentMenu
|
|
1654
|
-
._hovered()
|
|
1655
|
-
.pipe(filter(() => this._openOnHover()),
|
|
1656
|
-
// Since we might have multiple competing triggers for the same menu (e.g. a sub-menu
|
|
1657
|
-
// with different data and triggers), we have to delay it by a tick to ensure that
|
|
1658
|
-
// it won't be closed immediately after it is opened.
|
|
1659
|
-
filter((active) => active === this._menuItemInstance /*&& !active.disabled*/), delay(0, asapScheduler))
|
|
1660
|
-
.subscribe(() => {
|
|
1661
|
-
this._openedBy = 'mouse';
|
|
1662
|
-
// If the same menu is used between multiple triggers, it might still be animating
|
|
1663
|
-
// while the new trigger tries to re-open it. Wait for the animation to finish
|
|
1664
|
-
// before doing so. Also interrupt if the user moves to another item.
|
|
1665
|
-
if (this.menu instanceof _MenuBaseComponent && this.menu._isAnimating) {
|
|
1666
|
-
// We need the `delay(0)` here in order to avoid
|
|
1667
|
-
// 'changed after checked' errors in some cases. See Angular Material #12194.
|
|
1668
|
-
this.menu._animationDone
|
|
1669
|
-
.pipe(take(1), delay(0, asapScheduler), takeUntil(this._parentMenu._hovered()))
|
|
1670
|
-
// eslint-disable-next-line rxjs/no-nested-subscribe
|
|
1671
|
-
.subscribe(() => this.openMenu());
|
|
1672
|
-
}
|
|
1673
|
-
else {
|
|
1674
|
-
this.openMenu();
|
|
1675
|
-
}
|
|
1676
|
-
});
|
|
1677
|
-
}
|
|
1678
|
-
/**
|
|
1679
|
-
* Restores focus to the element that was focused before the menu was open.
|
|
1680
|
-
* Could be the root trigger button or a submenu trigger item
|
|
1681
|
-
*/
|
|
1682
|
-
_restoreFocus() {
|
|
1683
|
-
// We should reset focus if the user is navigating using a keyboard or
|
|
1684
|
-
// if we have a top-level trigger which might cause focus to be lost
|
|
1685
|
-
// when clicking outside of the menu.
|
|
1686
|
-
if (!this._openedBy) {
|
|
1687
|
-
// Note that the focus style will show up both for `program` and
|
|
1688
|
-
// `keyboard` so we don't have to specify which one it is.
|
|
1689
|
-
this.focus();
|
|
1690
|
-
}
|
|
1691
|
-
else if (!this.triggersSubmenu()) {
|
|
1692
|
-
this.focus(this._openedBy);
|
|
1693
|
-
}
|
|
1694
|
-
this._openedBy = null;
|
|
1695
|
-
}
|
|
1696
|
-
// Set state rather than toggle to support triggers sharing a menu
|
|
1697
|
-
_setIsMenuOpen(isOpen) {
|
|
1698
|
-
this._isMenuOpen = isOpen;
|
|
1699
|
-
if (this.triggersSubmenu()) {
|
|
1700
|
-
this._menuItemInstance._highlighted =
|
|
1701
|
-
isOpen && this._clientOutput.device !== 'touch';
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
/**
|
|
1705
|
-
* This method checks that a valid instance of MenuComponent has been passed into
|
|
1706
|
-
* graniteMenuTriggerFor. If not, an exception is thrown.
|
|
1707
|
-
*/
|
|
1708
|
-
_checkMenu() {
|
|
1709
|
-
if (!this.menu) {
|
|
1710
|
-
throwGraniteMenuMissingError();
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
/**
|
|
1714
|
-
* Returns strategy for positioning the overlay for desktop devices:
|
|
1715
|
-
* Place adjacent to the trigger button (preferably immediately below)
|
|
1716
|
-
* in order to show as much of the menu as possible.
|
|
1717
|
-
*/
|
|
1718
|
-
_desktopPositionStrategy() {
|
|
1719
|
-
const positionStrategy = this._overlay
|
|
1720
|
-
.position()
|
|
1721
|
-
.flexibleConnectedTo(this._element)
|
|
1722
|
-
.withLockedPosition()
|
|
1723
|
-
.withTransformOriginOn('.granite-menu');
|
|
1724
|
-
this._setPosition(positionStrategy);
|
|
1725
|
-
return positionStrategy;
|
|
1726
|
-
}
|
|
1727
|
-
/**
|
|
1728
|
-
* Sets the appropriate positions on a position strategy
|
|
1729
|
-
* so the overlay connects with the trigger correctly.
|
|
1730
|
-
* @param positionStrategy Strategy whose position to update.
|
|
1731
|
-
*/
|
|
1732
|
-
_setPosition(positionStrategy) {
|
|
1733
|
-
const MENU_PANEL_TOP_PADDING = 0;
|
|
1734
|
-
let [originX, originFallbackX] = this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'];
|
|
1735
|
-
const [overlayY, overlayFallbackY] = this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];
|
|
1736
|
-
let [originY, originFallbackY] = [overlayY, overlayFallbackY];
|
|
1737
|
-
let [overlayX, overlayFallbackX] = [originX, originFallbackX];
|
|
1738
|
-
let offsetY = 0;
|
|
1739
|
-
if (this.triggersSubmenu()) {
|
|
1740
|
-
// When the menu is a sub-menu, it should always align itself
|
|
1741
|
-
// to the edges of the trigger, instead of overlapping it.
|
|
1742
|
-
overlayFallbackX = originX =
|
|
1743
|
-
this.menu.xPosition === 'before' ? 'start' : 'end';
|
|
1744
|
-
originFallbackX = overlayX = originX === 'end' ? 'start' : 'end';
|
|
1745
|
-
offsetY =
|
|
1746
|
-
overlayY === 'bottom'
|
|
1747
|
-
? MENU_PANEL_TOP_PADDING
|
|
1748
|
-
: -MENU_PANEL_TOP_PADDING;
|
|
1749
|
-
}
|
|
1750
|
-
else {
|
|
1751
|
-
originY = overlayY === 'top' ? 'bottom' : 'top';
|
|
1752
|
-
originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
|
|
1753
|
-
}
|
|
1754
|
-
positionStrategy.withPositions([
|
|
1755
|
-
{ originX, originY, overlayX, overlayY, offsetY },
|
|
1756
|
-
{
|
|
1757
|
-
originX: originFallbackX,
|
|
1758
|
-
originY,
|
|
1759
|
-
overlayX: overlayFallbackX,
|
|
1760
|
-
overlayY,
|
|
1761
|
-
offsetY,
|
|
1762
|
-
},
|
|
1763
|
-
{
|
|
1764
|
-
originX,
|
|
1765
|
-
originY: originFallbackY,
|
|
1766
|
-
overlayX,
|
|
1767
|
-
overlayY: overlayFallbackY,
|
|
1768
|
-
offsetY: -offsetY,
|
|
1769
|
-
},
|
|
1770
|
-
{
|
|
1771
|
-
originX: originFallbackX,
|
|
1772
|
-
originY: originFallbackY,
|
|
1773
|
-
overlayX: overlayFallbackX,
|
|
1774
|
-
overlayY: overlayFallbackY,
|
|
1775
|
-
offsetY: -offsetY,
|
|
1776
|
-
},
|
|
1777
|
-
]);
|
|
1778
|
-
}
|
|
1779
|
-
/** Returns a stream that emits whenever an action that should close the menu occurs. */
|
|
1780
|
-
_menuClosingActions() {
|
|
1781
|
-
var _a;
|
|
1782
|
-
const detachments = (_a = this._overlayRef) === null || _a === void 0 ? void 0 : _a.detachments();
|
|
1783
|
-
const parentClose = this._parentMenu
|
|
1784
|
-
? this._parentMenu.closed
|
|
1785
|
-
: of();
|
|
1786
|
-
const hover = this._clientOutput.device === 'desktop' && this._parentMenu
|
|
1787
|
-
? this._parentMenu._hovered().pipe(filter((item) => item !== this._menuItemInstance), filter(() => this._isMenuOpen))
|
|
1788
|
-
: of();
|
|
1789
|
-
// Note: Quick fix. Feature reportedly exists in CDK for Angular 10
|
|
1790
|
-
// Filter to prevent closing when animating added though. Applied to
|
|
1791
|
-
// root menu only.
|
|
1792
|
-
const outsideClick = !this._parentMenu
|
|
1793
|
-
? fromEvent(this._document, 'click').pipe(filter((e) => e.target !== this._element.nativeElement &&
|
|
1794
|
-
e.target.closest('.granite-menu') === null), filter(() => !this.menu._isAnimating))
|
|
1795
|
-
: of();
|
|
1796
|
-
return merge(detachments, hover, parentClose, outsideClick);
|
|
1797
|
-
}
|
|
1798
|
-
/**
|
|
1799
|
-
* Whether to automatically open submenus on hover. This is true when showing
|
|
1800
|
-
* desktop menus and having mouse support.
|
|
1801
|
-
*/
|
|
1802
|
-
_openOnHover() {
|
|
1803
|
-
var _a, _b;
|
|
1804
|
-
return ((this.triggersSubmenu()
|
|
1805
|
-
? this._parentMenu.openOnHover
|
|
1806
|
-
: this.menu.openOnHover) &&
|
|
1807
|
-
((_a = this._parentMenu._clientOutput) === null || _a === void 0 ? void 0 : _a.device) === 'desktop' &&
|
|
1808
|
-
((_b = this._parentMenu._clientInput) === null || _b === void 0 ? void 0 : _b.devices.includes('mouse')));
|
|
1809
|
-
}
|
|
1810
|
-
/**
|
|
1811
|
-
* Whether to toggle submenus on click. This is true when showing desktop menus
|
|
1812
|
-
* without mouse support. Which, by the way, is not a great idea to begin with.
|
|
1813
|
-
*/
|
|
1814
|
-
_toggleOnSubmenuClick() {
|
|
1815
|
-
var _a, _b;
|
|
1816
|
-
return (!(this.triggersSubmenu()
|
|
1817
|
-
? this._parentMenu.openOnHover
|
|
1818
|
-
: this.menu.openOnHover) ||
|
|
1819
|
-
(((_a = this._parentMenu._clientOutput) === null || _a === void 0 ? void 0 : _a.device) === 'desktop' &&
|
|
1820
|
-
!((_b = this._parentMenu._clientInput) === null || _b === void 0 ? void 0 : _b.devices.includes('mouse'))));
|
|
1821
|
-
}
|
|
1822
|
-
// ------------------------------------------- //
|
|
1823
|
-
// --- Here be touch device customizations --- //
|
|
1824
|
-
// ------------------------------------------- //
|
|
1825
|
-
/** Set animation state to bring a newly opened menu into view */
|
|
1826
|
-
animateOpenMenu() {
|
|
1827
|
-
this._clientOutput.device === 'touch'
|
|
1828
|
-
? this.animateTouchOpenMenu()
|
|
1829
|
-
: this.menu._startAnimation();
|
|
1830
|
-
}
|
|
1831
|
-
animateTouchOpenMenu() {
|
|
1832
|
-
if (this.triggersSubmenu()) {
|
|
1833
|
-
// Slide newly opened sub menu into view from the side,
|
|
1834
|
-
// pushing any parent menu out of view on the other side
|
|
1835
|
-
this.menu._startTouchSubmenuEnterAnimation();
|
|
1836
|
-
this._parentMenu._startTouchHideAnimation();
|
|
1837
|
-
}
|
|
1838
|
-
else {
|
|
1839
|
-
// Slide root menu into view from below
|
|
1840
|
-
this.menu._startTouchRootEnterAnimation();
|
|
1841
|
-
}
|
|
1842
|
-
}
|
|
1843
|
-
/** Set animation state to close the active menu */
|
|
1844
|
-
animateCloseMenu(toBelow, withDelay) {
|
|
1845
|
-
this._clientOutput.device === 'touch'
|
|
1846
|
-
? this._animateTouchCloseMenu(toBelow, withDelay)
|
|
1847
|
-
: this._parentMenu._resetAnimation();
|
|
1848
|
-
}
|
|
1849
|
-
_animateTouchCloseMenu(toBelow, withDelay) {
|
|
1850
|
-
var _a;
|
|
1851
|
-
if (toBelow) {
|
|
1852
|
-
// Slide menu out of view below the viewport
|
|
1853
|
-
withDelay
|
|
1854
|
-
? this.menu._startTouchCloseDownAnimationWithDelay()
|
|
1855
|
-
: this.menu._startTouchCloseDownAnimation();
|
|
1856
|
-
}
|
|
1857
|
-
else {
|
|
1858
|
-
// Slide the closed menu out of view to the side
|
|
1859
|
-
// and slide any parent menu back into view
|
|
1860
|
-
this.menu._startTouchCloseSideAnimation();
|
|
1861
|
-
(_a = this._parentMenu) === null || _a === void 0 ? void 0 : _a._startTouchSubmenuEnterAnimation();
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
/**
|
|
1865
|
-
* Set animation state to place the menu and any parent at the given
|
|
1866
|
-
* horizontal position, i.e. following touch pan movement.
|
|
1867
|
-
*
|
|
1868
|
-
* @param xOffset Horizontal offset
|
|
1869
|
-
*/
|
|
1870
|
-
animateSetMenuPosition(xOffset) {
|
|
1871
|
-
this.menu._startTouchPanAnimation(xOffset);
|
|
1872
|
-
if (this._parentMenu) {
|
|
1873
|
-
this._parentMenu._startTouchHidePanAnimation(xOffset);
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
/**
|
|
1877
|
-
* Returns strategy for positioning the overlay depending on what type of
|
|
1878
|
-
* device the menu is being shown on
|
|
1879
|
-
*/
|
|
1880
|
-
_positionStrategy() {
|
|
1881
|
-
return this._clientOutput.device === 'touch'
|
|
1882
|
-
? this._touchPositionStrategy()
|
|
1883
|
-
: this._desktopPositionStrategy();
|
|
1884
|
-
}
|
|
1885
|
-
/**
|
|
1886
|
-
* Returns strategy for positioning the overlay for touch devices:
|
|
1887
|
-
* Place centered at the bottom of the screen.
|
|
1888
|
-
*/
|
|
1889
|
-
_touchPositionStrategy() {
|
|
1890
|
-
return this._overlay.position().global();
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Remove touch device pan/swipe listeners from overlay host element
|
|
1894
|
-
*/
|
|
1895
|
-
addOverlayListeners() {
|
|
1896
|
-
this._overlayRef.hostElement.addEventListener('touchstart', this._handleOverlayTouchStart, passiveEventListenerOptions);
|
|
1897
|
-
this._overlayRef.hostElement.addEventListener('touchmove', this._handleOverlayTouchMove, passiveEventListenerOptions);
|
|
1898
|
-
this._overlayRef.hostElement.addEventListener('touchend', this._handleOverlayTouchEnd, passiveEventListenerOptions);
|
|
1899
|
-
}
|
|
1900
|
-
/**
|
|
1901
|
-
* Remove touch device pan/swipe listeners from overlay host element
|
|
1902
|
-
*/
|
|
1903
|
-
removeOverlayListeners() {
|
|
1904
|
-
this._overlayRef.hostElement.removeEventListener('touchstart', this._handleOverlayTouchStart, passiveEventListenerOptions);
|
|
1905
|
-
this._overlayRef.hostElement.removeEventListener('touchmove', this._handleOverlayTouchMove, passiveEventListenerOptions);
|
|
1906
|
-
this._overlayRef.hostElement.removeEventListener('touchend', this._handleOverlayTouchEnd, passiveEventListenerOptions);
|
|
1907
|
-
}
|
|
1908
|
-
/**
|
|
1909
|
-
* Standard exponential ease out function
|
|
1910
|
-
*
|
|
1911
|
-
* @param current Current value
|
|
1912
|
-
* @param offset Offset value, to which calculated value will be added
|
|
1913
|
-
* @param target The target value
|
|
1914
|
-
* @param end Value to which current value is compared
|
|
1915
|
-
*/
|
|
1916
|
-
easeOutExpo(current, offset, target, end) {
|
|
1917
|
-
return current === end
|
|
1918
|
-
? offset + target
|
|
1919
|
-
: target * (-Math.pow(2, (-10 * current) / end) + 1) + offset;
|
|
1920
|
-
}
|
|
1921
|
-
}
|
|
1922
|
-
GraniteMenuTriggerForDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuTriggerForDirective, deps: [{ token: i1$2.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: GRANITE_MENU_PANEL, optional: true }, { token: GRANITE_CLIENT_INPUT, optional: true }, { token: GRANITE_CLIENT_OUTPUT, optional: true }, { token: GraniteMenuItemComponent, optional: true, self: true }, { token: i3.Directionality, optional: true }, { token: i1.FocusMonitor }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1923
|
-
GraniteMenuTriggerForDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: GraniteMenuTriggerForDirective, selector: "[graniteMenuTriggerFor]", inputs: { menu: ["graniteMenuTriggerFor", "menu"], openOnClick: "openOnClick" }, host: { attributes: { "aria-haspopup": "true" }, listeners: { "mousedown": "_handleMousedown($event)", "keydown": "_handleKeydown($event)", "click": "_handleClick($event)" }, properties: { "attr.aria-expanded": "_isMenuOpen || null", "attr.aria-controls": "_isMenuOpen ? menu.panelId : null" }, classAttribute: "granite-menu-trigger" }, usesOnChanges: true, ngImport: i0 });
|
|
1924
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuTriggerForDirective, decorators: [{
|
|
1925
|
-
type: Directive,
|
|
1926
|
-
args: [{
|
|
1927
|
-
selector: `[graniteMenuTriggerFor]`,
|
|
1928
|
-
host: {
|
|
1929
|
-
class: 'granite-menu-trigger',
|
|
1930
|
-
'aria-haspopup': 'true',
|
|
1931
|
-
'[attr.aria-expanded]': '_isMenuOpen || null',
|
|
1932
|
-
'[attr.aria-controls]': '_isMenuOpen ? menu.panelId : null',
|
|
1933
|
-
'(mousedown)': '_handleMousedown($event)',
|
|
1934
|
-
'(keydown)': '_handleKeydown($event)',
|
|
1935
|
-
'(click)': '_handleClick($event)',
|
|
1936
|
-
},
|
|
1937
|
-
}]
|
|
1938
|
-
}], ctorParameters: function () {
|
|
1939
|
-
return [{ type: i1$2.Overlay }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: _MenuBaseComponent, decorators: [{
|
|
1940
|
-
type: Inject,
|
|
1941
|
-
args: [GRANITE_MENU_PANEL]
|
|
1942
|
-
}, {
|
|
1943
|
-
type: Optional
|
|
1944
|
-
}] }, { type: undefined, decorators: [{
|
|
1945
|
-
type: Inject,
|
|
1946
|
-
args: [GRANITE_CLIENT_INPUT]
|
|
1947
|
-
}, {
|
|
1948
|
-
type: Optional
|
|
1949
|
-
}] }, { type: undefined, decorators: [{
|
|
1950
|
-
type: Inject,
|
|
1951
|
-
args: [GRANITE_CLIENT_OUTPUT]
|
|
1952
|
-
}, {
|
|
1953
|
-
type: Optional
|
|
1954
|
-
}] }, { type: GraniteMenuItemComponent, decorators: [{
|
|
1955
|
-
type: Optional
|
|
1956
|
-
}, {
|
|
1957
|
-
type: Self
|
|
1958
|
-
}] }, { type: i3.Directionality, decorators: [{
|
|
1959
|
-
type: Optional
|
|
1960
|
-
}] }, { type: i1.FocusMonitor }, { type: undefined, decorators: [{
|
|
1961
|
-
type: Inject,
|
|
1962
|
-
args: [DOCUMENT]
|
|
1963
|
-
}] }];
|
|
1964
|
-
}, propDecorators: { menu: [{
|
|
1965
|
-
type: Input,
|
|
1966
|
-
args: ['graniteMenuTriggerFor']
|
|
1967
|
-
}], openOnClick: [{
|
|
1968
|
-
type: Input
|
|
1969
|
-
}] } });
|
|
1970
|
-
|
|
1971
|
-
class GraniteDividerDirective {
|
|
1972
|
-
constructor() {
|
|
1973
|
-
this.dividerDirection = 'top';
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
GraniteDividerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteDividerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1977
|
-
GraniteDividerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: GraniteDividerDirective, selector: "[graniteDivider]", inputs: { dividerDirection: "dividerDirection" }, host: { properties: { "class.granite-divider-top": "dividerDirection === \"top\"", "class.granite-divider-bottom": "dividerDirection === \"bottom\"" } }, exportAs: ["graniteDivider"], ngImport: i0 });
|
|
1978
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteDividerDirective, decorators: [{
|
|
1979
|
-
type: Directive,
|
|
1980
|
-
args: [{
|
|
1981
|
-
selector: '[graniteDivider]',
|
|
1982
|
-
exportAs: 'graniteDivider',
|
|
1983
|
-
host: {
|
|
1984
|
-
'[class.granite-divider-top]': 'dividerDirection === "top"',
|
|
1985
|
-
'[class.granite-divider-bottom]': 'dividerDirection === "bottom"',
|
|
1986
|
-
},
|
|
1987
|
-
}]
|
|
1988
|
-
}], propDecorators: { dividerDirection: [{
|
|
1989
|
-
type: Input
|
|
1990
|
-
}] } });
|
|
1991
|
-
|
|
1992
|
-
class GraniteIconModule {
|
|
1993
|
-
}
|
|
1994
|
-
GraniteIconModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteIconModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1995
|
-
GraniteIconModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteIconModule, declarations: [GraniteIconComponent], exports: [GraniteIconComponent] });
|
|
1996
|
-
GraniteIconModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteIconModule });
|
|
1997
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteIconModule, decorators: [{
|
|
1998
|
-
type: NgModule,
|
|
1999
|
-
args: [{
|
|
2000
|
-
declarations: [GraniteIconComponent],
|
|
2001
|
-
exports: [GraniteIconComponent],
|
|
2002
|
-
}]
|
|
2003
|
-
}] });
|
|
2004
|
-
|
|
2005
|
-
class GraniteTitleDirective {
|
|
2006
|
-
}
|
|
2007
|
-
GraniteTitleDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2008
|
-
GraniteTitleDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: GraniteTitleDirective, selector: "[graniteTitle]", host: { properties: { "class.granite-title": "true" } }, exportAs: ["graniteTitle"], ngImport: i0 });
|
|
2009
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteTitleDirective, decorators: [{
|
|
2010
|
-
type: Directive,
|
|
2011
|
-
args: [{
|
|
2012
|
-
selector: '[graniteTitle]',
|
|
2013
|
-
exportAs: 'graniteTitle',
|
|
2014
|
-
host: {
|
|
2015
|
-
'[class.granite-title]': 'true',
|
|
2016
|
-
},
|
|
2017
|
-
}]
|
|
2018
|
-
}] });
|
|
2019
|
-
|
|
2020
|
-
class GraniteMenuModule {
|
|
2021
|
-
}
|
|
2022
|
-
GraniteMenuModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2023
|
-
GraniteMenuModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuModule, declarations: [GraniteMenuComponent,
|
|
2024
|
-
GraniteMenuItemComponent,
|
|
2025
|
-
GraniteMenuTriggerForDirective,
|
|
2026
|
-
GraniteMenuTouchCloseComponent,
|
|
2027
|
-
GraniteMenuTouchTitleItemComponent,
|
|
2028
|
-
GraniteDividerDirective,
|
|
2029
|
-
GraniteTitleDirective], imports: [CommonModule, OverlayModule, PortalModule, GraniteIconModule], exports: [GraniteMenuComponent,
|
|
2030
|
-
GraniteMenuItemComponent,
|
|
2031
|
-
GraniteMenuTriggerForDirective,
|
|
2032
|
-
GraniteMenuTouchCloseComponent,
|
|
2033
|
-
GraniteMenuTouchTitleItemComponent,
|
|
2034
|
-
GraniteDividerDirective,
|
|
2035
|
-
GraniteTitleDirective] });
|
|
2036
|
-
GraniteMenuModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuModule, imports: [CommonModule, OverlayModule, PortalModule, GraniteIconModule] });
|
|
2037
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteMenuModule, decorators: [{
|
|
2038
|
-
type: NgModule,
|
|
2039
|
-
args: [{
|
|
2040
|
-
declarations: [
|
|
2041
|
-
GraniteMenuComponent,
|
|
2042
|
-
GraniteMenuItemComponent,
|
|
2043
|
-
GraniteMenuTriggerForDirective,
|
|
2044
|
-
GraniteMenuTouchCloseComponent,
|
|
2045
|
-
GraniteMenuTouchTitleItemComponent,
|
|
2046
|
-
GraniteDividerDirective,
|
|
2047
|
-
GraniteTitleDirective,
|
|
2048
|
-
],
|
|
2049
|
-
imports: [CommonModule, OverlayModule, PortalModule, GraniteIconModule],
|
|
2050
|
-
exports: [
|
|
2051
|
-
GraniteMenuComponent,
|
|
2052
|
-
GraniteMenuItemComponent,
|
|
2053
|
-
GraniteMenuTriggerForDirective,
|
|
2054
|
-
GraniteMenuTouchCloseComponent,
|
|
2055
|
-
GraniteMenuTouchTitleItemComponent,
|
|
2056
|
-
GraniteDividerDirective,
|
|
2057
|
-
GraniteTitleDirective,
|
|
2058
|
-
],
|
|
2059
|
-
}]
|
|
2060
|
-
}] });
|
|
2061
|
-
|
|
2062
|
-
/**
|
|
2063
|
-
* Test harness for menu component
|
|
2064
|
-
*
|
|
2065
|
-
* Stripped-down version of the Angular Material menu test harness (.../menu/menu-harness.ts)
|
|
2066
|
-
* just to get things going.
|
|
2067
|
-
*/
|
|
2068
|
-
class GraniteMenuHarness extends ComponentHarness {
|
|
2069
|
-
constructor() {
|
|
2070
|
-
super(...arguments);
|
|
2071
|
-
this._documentRootLocator = this.documentRootLocatorFactory();
|
|
2072
|
-
}
|
|
2073
|
-
/**
|
|
2074
|
-
* Gets a `HarnessPredicate` that can be used to search for a `MenuHarness` that meets
|
|
2075
|
-
* certain criteria.
|
|
2076
|
-
* @param options Options for filtering which menu item instances are considered a match.
|
|
2077
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
2078
|
-
*/
|
|
2079
|
-
static with(options = {}) {
|
|
2080
|
-
return new HarnessPredicate(GraniteMenuHarness, options).addOption('text', options.text,
|
|
2081
|
-
/* @dynamic */ (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
2082
|
-
}
|
|
2083
|
-
/** Gets the text of the menu trigger */
|
|
2084
|
-
getText() {
|
|
2085
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2086
|
-
return (yield this.host()).text();
|
|
2087
|
-
});
|
|
2088
|
-
}
|
|
2089
|
-
/** Opens the menu, unless already open */
|
|
2090
|
-
open() {
|
|
2091
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2092
|
-
if (!(yield this.isOpen())) {
|
|
2093
|
-
yield (yield this.host()).click();
|
|
2094
|
-
// This is necessary so that we wait for the opening animation to finish.
|
|
2095
|
-
return this.forceStabilize();
|
|
2096
|
-
}
|
|
2097
|
-
});
|
|
2098
|
-
}
|
|
2099
|
-
/** Closes the menu, unless already closed */
|
|
2100
|
-
close() {
|
|
2101
|
-
var _a;
|
|
2102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2103
|
-
yield ((_a = (yield this._getMenuPanel())) === null || _a === void 0 ? void 0 : _a.sendKeys(TestKey.ESCAPE));
|
|
2104
|
-
// This is necessary so that we wait for the closing animation to finish.
|
|
2105
|
-
return this.forceStabilize();
|
|
2106
|
-
});
|
|
2107
|
-
}
|
|
2108
|
-
/** Whether the menu is open */
|
|
2109
|
-
isOpen() {
|
|
2110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2111
|
-
return !!(yield this._getMenuPanel());
|
|
2112
|
-
});
|
|
2113
|
-
}
|
|
2114
|
-
/**
|
|
2115
|
-
* Gets a list of `GraniteMenuItemHarness` representing the items in the menu.
|
|
2116
|
-
* @param filters Optionally filters which menu items are included.
|
|
2117
|
-
*/
|
|
2118
|
-
getItems(filters = {}) {
|
|
2119
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2120
|
-
const panelId = yield this._getPanelId();
|
|
2121
|
-
if (panelId) {
|
|
2122
|
-
return this._documentRootLocator.locatorForAll(GraniteMenuItemHarness.with(Object.assign(Object.assign({}, filters), { ancestor: `#${panelId}` })))();
|
|
2123
|
-
}
|
|
2124
|
-
return [];
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
|
-
/** Gets the menu panel (popup) associated with the menu */
|
|
2128
|
-
_getMenuPanel() {
|
|
2129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2130
|
-
const panelId = yield this._getPanelId();
|
|
2131
|
-
return panelId
|
|
2132
|
-
? this._documentRootLocator.locatorForOptional(`#${panelId}`)()
|
|
2133
|
-
: null;
|
|
2134
|
-
});
|
|
2135
|
-
}
|
|
2136
|
-
/** Gets the id of the menu panel (popup) associated with this menu */
|
|
2137
|
-
_getPanelId() {
|
|
2138
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2139
|
-
const panelId = yield (yield this.host()).getAttribute('aria-controls');
|
|
2140
|
-
return panelId || null;
|
|
2141
|
-
});
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
/**
|
|
2145
|
-
* The selector for the host element of a `MenuComponent` instance,
|
|
2146
|
-
* i.e. the button element used to open the menu.
|
|
2147
|
-
*/
|
|
2148
|
-
GraniteMenuHarness.hostSelector = '.granite-menu-trigger';
|
|
2149
|
-
class GraniteMenuItemHarness extends ComponentHarness {
|
|
2150
|
-
/**
|
|
2151
|
-
* Gets a `HarnessPredicate` that can be used to search for a `GraniteMenuItemHarness` that meets
|
|
2152
|
-
* certain criteria.
|
|
2153
|
-
* @param options Options for filtering which menu item instances are considered a match.
|
|
2154
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
2155
|
-
*/
|
|
2156
|
-
static with(options = {}) {
|
|
2157
|
-
return new HarnessPredicate(GraniteMenuItemHarness, options).addOption('text', options.text,
|
|
2158
|
-
/* @dynamic */ (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text));
|
|
2159
|
-
}
|
|
2160
|
-
/** Gets the text of the menu item. */
|
|
2161
|
-
getText() {
|
|
2162
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2163
|
-
return (yield this.host()).text();
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
/** Whether this item has a submenu. */
|
|
2167
|
-
hasSubmenu() {
|
|
2168
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2169
|
-
return (yield this.host()).matchesSelector(GraniteMenuHarness.hostSelector);
|
|
2170
|
-
});
|
|
2171
|
-
}
|
|
2172
|
-
/** Gets the submenu associated with this menu item, or null if none. */
|
|
2173
|
-
getSubmenu() {
|
|
2174
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2175
|
-
if (yield this.hasSubmenu()) {
|
|
2176
|
-
return new GraniteMenuHarness(this.locatorFactory);
|
|
2177
|
-
}
|
|
2178
|
-
return null;
|
|
2179
|
-
});
|
|
2180
|
-
}
|
|
2181
|
-
/** Clicks the menu item. */
|
|
2182
|
-
click() {
|
|
2183
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2184
|
-
yield (yield this.host()).click();
|
|
2185
|
-
// This is necessary so that we wait for the opening animation to finish. (i.e. if it opens another menu)
|
|
2186
|
-
return this.forceStabilize();
|
|
2187
|
-
});
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
/** The selector for the host element of a `MenuItemComponent` instance. */
|
|
2191
|
-
GraniteMenuItemHarness.hostSelector = '.granite-menu-item';
|
|
2192
|
-
|
|
2193
|
-
class GraniteToggleSwitchComponent {
|
|
2194
|
-
constructor(_focusMonitor) {
|
|
2195
|
-
this._focusMonitor = _focusMonitor;
|
|
2196
|
-
this.id = null;
|
|
2197
|
-
this.checked = false;
|
|
2198
|
-
this.disabled = false;
|
|
2199
|
-
this.readonly = false;
|
|
2200
|
-
this.labelPosition = 'after';
|
|
2201
|
-
this.ariaLabel = null;
|
|
2202
|
-
this.ariaLabelledby = null;
|
|
2203
|
-
this.valueChange = new EventEmitter();
|
|
2204
|
-
this.toggleChange = new EventEmitter();
|
|
2205
|
-
this.toggleBlur = new EventEmitter();
|
|
2206
|
-
this._positionBefore = false;
|
|
2207
|
-
this._toggleSwitchDisabled = false;
|
|
2208
|
-
}
|
|
2209
|
-
ngOnChanges(changes) {
|
|
2210
|
-
if (changes.checked) {
|
|
2211
|
-
this.checked = coerceBooleanProperty(changes.checked.currentValue);
|
|
2212
|
-
}
|
|
2213
|
-
if (changes.disabled) {
|
|
2214
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2215
|
-
}
|
|
2216
|
-
if (changes.readonly) {
|
|
2217
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2218
|
-
}
|
|
2219
|
-
if (changes.labelPosition != null) {
|
|
2220
|
-
this._positionBefore =
|
|
2221
|
-
changes.labelPosition.currentValue != null &&
|
|
2222
|
-
changes.labelPosition.currentValue === 'before';
|
|
2223
|
-
}
|
|
2224
|
-
// conditional checker if the control is either/both in readonly or disabled state
|
|
2225
|
-
if (changes.disabled || changes.readonly) {
|
|
2226
|
-
if (this.disabled || this.readonly) {
|
|
2227
|
-
this._toggleSwitchDisabled = true;
|
|
2228
|
-
}
|
|
2229
|
-
else
|
|
2230
|
-
this._toggleSwitchDisabled = false;
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
focus(origin = 'program', options) {
|
|
2234
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2235
|
-
}
|
|
2236
|
-
_onBlur() {
|
|
2237
|
-
this.toggleBlur.emit();
|
|
2238
|
-
}
|
|
2239
|
-
_toggleSwitchChange() {
|
|
2240
|
-
this.checked = this._getInputElement().checked;
|
|
2241
|
-
this.valueChange.emit(this.checked);
|
|
2242
|
-
}
|
|
2243
|
-
_toggleSwitchClick() {
|
|
2244
|
-
this.toggleChange.emit();
|
|
2245
|
-
}
|
|
2246
|
-
_getInputElement() {
|
|
2247
|
-
return this._inputElement.nativeElement;
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
GraniteToggleSwitchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteToggleSwitchComponent, deps: [{ token: i1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
|
|
2251
|
-
GraniteToggleSwitchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteToggleSwitchComponent, selector: "granite-toggle-switch", inputs: { id: "id", checked: "checked", disabled: "disabled", readonly: "readonly", labelPosition: "labelPosition", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, outputs: { valueChange: "valueChange", toggleChange: "toggleChange", toggleBlur: "toggleBlur" }, host: { properties: { "class.granite-toggle-switch-checked": "checked", "class.granite-toggle-switch-disabled": "disabled", "class.granite-toggle-switch-readonly": "readonly", "class.granite-toggle-switch-label-before": "_positionBefore" }, classAttribute: "granite-toggle-switch" }, viewQueries: [{ propertyName: "_inputElement", first: true, predicate: ["input"], descendants: true }], exportAs: ["graniteToggleSwitch"], usesOnChanges: true, ngImport: i0, 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", 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;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}:host{box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit;cursor:pointer}:host(.granite-toggle-switch){color:var(--granite-color-text)}.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}html[dir=ltr] .granite-toggle-switch-thumb{float:left}:host-context([dir=ltr]) .granite-toggle-switch-thumb{float:left}html[dir=rtl] .granite-toggle-switch-thumb{float:right}:host-context([dir=rtl]) .granite-toggle-switch-thumb{float:right}: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)}html[dir=ltr] :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:right}:host-context([dir=ltr]) :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:right}html[dir=rtl] :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:left}:host-context([dir=rtl]) :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:left}.granite-toggle-switch-label{display:flex;align-items:center;width:max-content}:host(.granite-toggle-switch-disabled) .granite-toggle-switch-label{opacity:.6}:host(.granite-toggle-switch-disabled) *{cursor:default}:host(.granite-toggle-switch-readonly) *{cursor:default}.granite-toggle-switch-text{padding-inline-start:var(--granite-spacing-8);font-size:var(--granite-font-size-body-small)}.granite-toggle-switch-text:empty{display:none}:host(.granite-toggle-switch-label-before) .granite-toggle-switch-label{flex-direction:row-reverse}:host(.granite-toggle-switch-label-before) .granite-toggle-switch-text{padding-inline-start:0;padding-inline-end:var(--granite-spacing-8)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteToggleSwitchComponent, decorators: [{
|
|
2253
|
-
type: Component,
|
|
2254
|
-
args: [{ selector: 'granite-toggle-switch', exportAs: 'graniteToggleSwitch', host: {
|
|
2255
|
-
class: 'granite-toggle-switch',
|
|
2256
|
-
'[class.granite-toggle-switch-checked]': 'checked',
|
|
2257
|
-
'[class.granite-toggle-switch-disabled]': 'disabled',
|
|
2258
|
-
'[class.granite-toggle-switch-readonly]': 'readonly',
|
|
2259
|
-
'[class.granite-toggle-switch-label-before]': '_positionBefore',
|
|
2260
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, 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", 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;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}:host{box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit;cursor:pointer}:host(.granite-toggle-switch){color:var(--granite-color-text)}.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}html[dir=ltr] .granite-toggle-switch-thumb{float:left}:host-context([dir=ltr]) .granite-toggle-switch-thumb{float:left}html[dir=rtl] .granite-toggle-switch-thumb{float:right}:host-context([dir=rtl]) .granite-toggle-switch-thumb{float:right}: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)}html[dir=ltr] :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:right}:host-context([dir=ltr]) :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:right}html[dir=rtl] :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:left}:host-context([dir=rtl]) :host(.granite-toggle-switch-checked) .granite-toggle-switch-thumb{float:left}.granite-toggle-switch-label{display:flex;align-items:center;width:max-content}:host(.granite-toggle-switch-disabled) .granite-toggle-switch-label{opacity:.6}:host(.granite-toggle-switch-disabled) *{cursor:default}:host(.granite-toggle-switch-readonly) *{cursor:default}.granite-toggle-switch-text{padding-inline-start:var(--granite-spacing-8);font-size:var(--granite-font-size-body-small)}.granite-toggle-switch-text:empty{display:none}:host(.granite-toggle-switch-label-before) .granite-toggle-switch-label{flex-direction:row-reverse}:host(.granite-toggle-switch-label-before) .granite-toggle-switch-text{padding-inline-start:0;padding-inline-end:var(--granite-spacing-8)}\n"] }]
|
|
2261
|
-
}], ctorParameters: function () { return [{ type: i1.FocusMonitor }]; }, propDecorators: { id: [{
|
|
2262
|
-
type: Input
|
|
2263
|
-
}], checked: [{
|
|
2264
|
-
type: Input
|
|
2265
|
-
}], disabled: [{
|
|
2266
|
-
type: Input
|
|
2267
|
-
}], readonly: [{
|
|
2268
|
-
type: Input
|
|
2269
|
-
}], labelPosition: [{
|
|
2270
|
-
type: Input
|
|
2271
|
-
}], ariaLabel: [{
|
|
2272
|
-
type: Input,
|
|
2273
|
-
args: ['aria-label']
|
|
2274
|
-
}], ariaLabelledby: [{
|
|
2275
|
-
type: Input,
|
|
2276
|
-
args: ['aria-labelledby']
|
|
2277
|
-
}], valueChange: [{
|
|
2278
|
-
type: Output
|
|
2279
|
-
}], toggleChange: [{
|
|
2280
|
-
type: Output
|
|
2281
|
-
}], toggleBlur: [{
|
|
2282
|
-
type: Output
|
|
2283
|
-
}], _inputElement: [{
|
|
2284
|
-
type: ViewChild,
|
|
2285
|
-
args: ['input']
|
|
2286
|
-
}] } });
|
|
2287
|
-
|
|
2288
|
-
class GraniteToggleSwitchModule {
|
|
2289
|
-
}
|
|
2290
|
-
GraniteToggleSwitchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteToggleSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2291
|
-
GraniteToggleSwitchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteToggleSwitchModule, declarations: [GraniteToggleSwitchComponent], exports: [GraniteToggleSwitchComponent] });
|
|
2292
|
-
GraniteToggleSwitchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteToggleSwitchModule });
|
|
2293
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteToggleSwitchModule, decorators: [{
|
|
2294
|
-
type: NgModule,
|
|
2295
|
-
args: [{
|
|
2296
|
-
declarations: [GraniteToggleSwitchComponent],
|
|
2297
|
-
exports: [GraniteToggleSwitchComponent],
|
|
2298
|
-
}]
|
|
2299
|
-
}] });
|
|
2300
|
-
|
|
2301
|
-
class GraniteRadioButtonComponent {
|
|
2302
|
-
constructor(_focusMonitor, _radioDispatcher) {
|
|
2303
|
-
this._focusMonitor = _focusMonitor;
|
|
2304
|
-
this._radioDispatcher = _radioDispatcher;
|
|
2305
|
-
this.id = null;
|
|
2306
|
-
this.checked = false;
|
|
2307
|
-
this.required = false;
|
|
2308
|
-
this.disabled = false;
|
|
2309
|
-
this.readonly = false;
|
|
2310
|
-
this.labelPosition = 'after';
|
|
2311
|
-
this.ariaLabel = null;
|
|
2312
|
-
this.ariaLabelledby = null;
|
|
2313
|
-
this.radioChange = new EventEmitter();
|
|
2314
|
-
this.radioBlur = new EventEmitter();
|
|
2315
|
-
this._positionBefore = false;
|
|
2316
|
-
this._radioDisabled = false;
|
|
2317
|
-
this._removeUniqueSelectionListenerFn = _radioDispatcher.listen((id, name) => {
|
|
2318
|
-
if (id !== this.id && name === this.name) {
|
|
2319
|
-
this.checked = false;
|
|
2320
|
-
}
|
|
2321
|
-
});
|
|
2322
|
-
}
|
|
2323
|
-
ngOnChanges(changes) {
|
|
2324
|
-
if (changes.checked) {
|
|
2325
|
-
this.checked = coerceBooleanProperty(changes.checked.currentValue);
|
|
2326
|
-
}
|
|
2327
|
-
if (changes.required) {
|
|
2328
|
-
this.required = coerceBooleanProperty(changes.required.currentValue);
|
|
2329
|
-
}
|
|
2330
|
-
if (changes.readonly) {
|
|
2331
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2332
|
-
}
|
|
2333
|
-
if (changes.disabled) {
|
|
2334
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2335
|
-
}
|
|
2336
|
-
if (changes.labelPosition != null) {
|
|
2337
|
-
this._positionBefore =
|
|
2338
|
-
changes.labelPosition.currentValue != null &&
|
|
2339
|
-
changes.labelPosition.currentValue === 'before';
|
|
2340
|
-
}
|
|
2341
|
-
if (changes.disabled || changes.readonly) {
|
|
2342
|
-
if (this.disabled || this.readonly) {
|
|
2343
|
-
this._radioDisabled = true;
|
|
2344
|
-
}
|
|
2345
|
-
else
|
|
2346
|
-
this._radioDisabled = false;
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
ngOnDestroy() {
|
|
2350
|
-
if (this._removeUniqueSelectionListenerFn instanceof Function) {
|
|
2351
|
-
this._removeUniqueSelectionListenerFn();
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
// Focuses the radio button.
|
|
2355
|
-
focus(origin = 'program', options) {
|
|
2356
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2357
|
-
}
|
|
2358
|
-
_radioChange(element) {
|
|
2359
|
-
this.checked = this._getInputElement().checked;
|
|
2360
|
-
// Notify all radio buttons with the same name to un-check
|
|
2361
|
-
this._radioDispatcher.notify(this.id, this.name);
|
|
2362
|
-
this.radioChange.emit(element === null || element === void 0 ? void 0 : element.value);
|
|
2363
|
-
}
|
|
2364
|
-
_onBlur() {
|
|
2365
|
-
this.radioBlur.emit();
|
|
2366
|
-
}
|
|
2367
|
-
_getInputElement() {
|
|
2368
|
-
return this._inputElement.nativeElement;
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
GraniteRadioButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioButtonComponent, deps: [{ token: i1.FocusMonitor }, { token: i2.UniqueSelectionDispatcher }], target: i0.ɵɵFactoryTarget.Component });
|
|
2372
|
-
GraniteRadioButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteRadioButtonComponent, selector: "granite-radio-button", inputs: { value: "value", id: "id", name: "name", checked: "checked", required: "required", disabled: "disabled", readonly: "readonly", labelPosition: "labelPosition", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, outputs: { radioChange: "radioChange", radioBlur: "radioBlur" }, host: { properties: { "class.granite-radio-button-disabled": "disabled", "class.granite-radio-button-label-before": "_positionBefore", "class.granite-radio-button-checked": "checked", "class.granite-radio-button-readonly": "readonly" }, classAttribute: "granite-radio-button" }, viewQueries: [{ propertyName: "_inputElement", first: true, predicate: ["input"], descendants: true }], exportAs: ["graniteRadioButton"], usesOnChanges: true, ngImport: i0, 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 (change)=\"_radioChange($event.target)\"\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", 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;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}: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):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-outer-circle .granite-radio-button-label:hover{cursor:pointer}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-outer-circle .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-outer-circle .granite-radio-button-label:hover .granite-radio-button-inner-circle{background-color:var(--granite-color-background-active-hover)}:host(.granite-radio-button-label-before) .granite-radio-button-label{flex-direction:row-reverse}:host(.granite-radio-button-label-before) .granite-radio-button-text{padding-inline-start:0;padding-inline-end:var(--granite-spacing-8)}:host(.granite-radio-button-checked) .granite-radio-button-inner-circle{visibility:visible;animation:grow-animation .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{padding-inline-start:var(--granite-spacing-8);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small)}.granite-radio-button-text:empty{display:none}.granite-radio-button-label{display:flex;align-items:center;width:max-content;margin-inline-end:var(--granite-spacing-32);margin-block-end:var(--granite-spacing-4)}: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}@keyframes grow-animation{0%{transform:scale(0)}to{transform:scale(1)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2373
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioButtonComponent, decorators: [{
|
|
2374
|
-
type: Component,
|
|
2375
|
-
args: [{ selector: 'granite-radio-button', exportAs: 'graniteRadioButton', host: {
|
|
2376
|
-
class: 'granite-radio-button',
|
|
2377
|
-
'[class.granite-radio-button-disabled]': 'disabled',
|
|
2378
|
-
'[class.granite-radio-button-label-before]': '_positionBefore',
|
|
2379
|
-
'[class.granite-radio-button-checked]': 'checked',
|
|
2380
|
-
'[class.granite-radio-button-readonly]': 'readonly',
|
|
2381
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, 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 (change)=\"_radioChange($event.target)\"\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", 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;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}: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):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-outer-circle .granite-radio-button-label:hover{cursor:pointer}:host(.granite-radio-button):not(.granite-radio-button-readonly):not(.granite-radio-button-disabled) .granite-radio-button-outer-circle .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-outer-circle .granite-radio-button-label:hover .granite-radio-button-inner-circle{background-color:var(--granite-color-background-active-hover)}:host(.granite-radio-button-label-before) .granite-radio-button-label{flex-direction:row-reverse}:host(.granite-radio-button-label-before) .granite-radio-button-text{padding-inline-start:0;padding-inline-end:var(--granite-spacing-8)}:host(.granite-radio-button-checked) .granite-radio-button-inner-circle{visibility:visible;animation:grow-animation .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{padding-inline-start:var(--granite-spacing-8);color:var(--granite-color-text);font-size:var(--granite-font-size-body-small)}.granite-radio-button-text:empty{display:none}.granite-radio-button-label{display:flex;align-items:center;width:max-content;margin-inline-end:var(--granite-spacing-32);margin-block-end:var(--granite-spacing-4)}: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}@keyframes grow-animation{0%{transform:scale(0)}to{transform:scale(1)}}\n"] }]
|
|
2382
|
-
}], ctorParameters: function () { return [{ type: i1.FocusMonitor }, { type: i2.UniqueSelectionDispatcher }]; }, propDecorators: { value: [{
|
|
2383
|
-
type: Input
|
|
2384
|
-
}], id: [{
|
|
2385
|
-
type: Input
|
|
2386
|
-
}], name: [{
|
|
2387
|
-
type: Input
|
|
2388
|
-
}], checked: [{
|
|
2389
|
-
type: Input
|
|
2390
|
-
}], required: [{
|
|
2391
|
-
type: Input
|
|
2392
|
-
}], disabled: [{
|
|
2393
|
-
type: Input
|
|
2394
|
-
}], readonly: [{
|
|
2395
|
-
type: Input
|
|
2396
|
-
}], labelPosition: [{
|
|
2397
|
-
type: Input
|
|
2398
|
-
}], ariaLabel: [{
|
|
2399
|
-
type: Input,
|
|
2400
|
-
args: ['aria-label']
|
|
2401
|
-
}], ariaLabelledby: [{
|
|
2402
|
-
type: Input,
|
|
2403
|
-
args: ['aria-labelledby']
|
|
2404
|
-
}], radioChange: [{
|
|
2405
|
-
type: Output
|
|
2406
|
-
}], radioBlur: [{
|
|
2407
|
-
type: Output
|
|
2408
|
-
}], _inputElement: [{
|
|
2409
|
-
type: ViewChild,
|
|
2410
|
-
args: ['input']
|
|
2411
|
-
}] } });
|
|
2412
|
-
|
|
2413
|
-
class GraniteRadioCheckboxBase {
|
|
2414
|
-
constructor() {
|
|
2415
|
-
this.layout = 'horizontal';
|
|
2416
|
-
this.ariaLabelledby = null;
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
GraniteRadioCheckboxBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioCheckboxBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2420
|
-
GraniteRadioCheckboxBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: GraniteRadioCheckboxBase, inputs: { layout: "layout", ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, ngImport: i0 });
|
|
2421
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioCheckboxBase, decorators: [{
|
|
2422
|
-
type: Directive
|
|
2423
|
-
}], propDecorators: { layout: [{
|
|
2424
|
-
type: Input
|
|
2425
|
-
}], ariaLabelledby: [{
|
|
2426
|
-
type: Input,
|
|
2427
|
-
args: ['aria-labelledby']
|
|
2428
|
-
}] } });
|
|
2429
|
-
|
|
2430
|
-
class GraniteRadioGroupComponent extends GraniteRadioCheckboxBase {
|
|
2431
|
-
}
|
|
2432
|
-
GraniteRadioGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2433
|
-
GraniteRadioGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteRadioGroupComponent, selector: "granite-radio-group", host: { properties: { "attr.role": "\"radiogroup\"", "attr.aria-labelledby": "ariaLabelledby", "class.granite-radio-checkbox-base-layout-horizontal": "layout === \"horizontal\"" }, classAttribute: "granite-radio-group" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host(.granite-radio-checkbox-base-layout-horizontal){display:flex;align-items:flex-start}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2434
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioGroupComponent, decorators: [{
|
|
2435
|
-
type: Component,
|
|
2436
|
-
args: [{ selector: 'granite-radio-group', host: {
|
|
2437
|
-
class: 'granite-radio-group',
|
|
2438
|
-
'[attr.role]': '"radiogroup"',
|
|
2439
|
-
'[attr.aria-labelledby]': 'ariaLabelledby',
|
|
2440
|
-
'[class.granite-radio-checkbox-base-layout-horizontal]': 'layout === "horizontal"',
|
|
2441
|
-
}, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host(.granite-radio-checkbox-base-layout-horizontal){display:flex;align-items:flex-start}\n"] }]
|
|
2442
|
-
}] });
|
|
2443
|
-
|
|
2444
|
-
class GraniteRadioButtonModule {
|
|
2445
|
-
}
|
|
2446
|
-
GraniteRadioButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2447
|
-
GraniteRadioButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioButtonModule, declarations: [GraniteRadioButtonComponent, GraniteRadioGroupComponent], exports: [GraniteRadioButtonComponent, GraniteRadioGroupComponent] });
|
|
2448
|
-
GraniteRadioButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioButtonModule });
|
|
2449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteRadioButtonModule, decorators: [{
|
|
2450
|
-
type: NgModule,
|
|
2451
|
-
args: [{
|
|
2452
|
-
declarations: [GraniteRadioButtonComponent, GraniteRadioGroupComponent],
|
|
2453
|
-
exports: [GraniteRadioButtonComponent, GraniteRadioGroupComponent],
|
|
2454
|
-
}]
|
|
2455
|
-
}] });
|
|
2456
|
-
|
|
2457
|
-
class GraniteCheckboxComponent {
|
|
2458
|
-
constructor(_focusMonitor) {
|
|
2459
|
-
this._focusMonitor = _focusMonitor;
|
|
2460
|
-
this.id = null;
|
|
2461
|
-
this.checked = false;
|
|
2462
|
-
this.disabled = false;
|
|
2463
|
-
this.readonly = false;
|
|
2464
|
-
this.labelPosition = 'after';
|
|
2465
|
-
this.ariaLabel = null;
|
|
2466
|
-
this.ariaLabelledby = null;
|
|
2467
|
-
this.valueChange = new EventEmitter();
|
|
2468
|
-
this.checkboxChange = new EventEmitter();
|
|
2469
|
-
this.checkboxBlur = new EventEmitter();
|
|
2470
|
-
this._positionBefore = false;
|
|
2471
|
-
this._checkboxDisabled = false;
|
|
2472
|
-
}
|
|
2473
|
-
ngOnChanges(changes) {
|
|
2474
|
-
if (changes.checked) {
|
|
2475
|
-
this.checked = coerceBooleanProperty(changes.checked.currentValue);
|
|
2476
|
-
}
|
|
2477
|
-
if (changes.disabled) {
|
|
2478
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2479
|
-
}
|
|
2480
|
-
if (changes.readonly) {
|
|
2481
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2482
|
-
}
|
|
2483
|
-
if (changes.labelPosition != null) {
|
|
2484
|
-
this._positionBefore =
|
|
2485
|
-
changes.labelPosition.currentValue != null &&
|
|
2486
|
-
changes.labelPosition.currentValue === 'before';
|
|
2487
|
-
}
|
|
2488
|
-
if (changes.disabled || changes.readonly) {
|
|
2489
|
-
if (this.disabled || this.readonly) {
|
|
2490
|
-
this._checkboxDisabled = true;
|
|
2491
|
-
}
|
|
2492
|
-
else
|
|
2493
|
-
this._checkboxDisabled = false;
|
|
2494
|
-
}
|
|
2495
|
-
}
|
|
2496
|
-
focus(origin = 'program', options) {
|
|
2497
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2498
|
-
}
|
|
2499
|
-
_onBlur() {
|
|
2500
|
-
this.checkboxBlur.emit();
|
|
2501
|
-
}
|
|
2502
|
-
_checkboxChange() {
|
|
2503
|
-
this.checked = this._getInputElement().checked;
|
|
2504
|
-
this.valueChange.emit(this.checked);
|
|
2505
|
-
}
|
|
2506
|
-
_checkboxClick() {
|
|
2507
|
-
this.checkboxChange.emit();
|
|
2508
|
-
}
|
|
2509
|
-
_getInputElement() {
|
|
2510
|
-
return this._inputElement.nativeElement;
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
GraniteCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxComponent, deps: [{ token: i1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
|
|
2514
|
-
GraniteCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteCheckboxComponent, selector: "granite-checkbox", inputs: { id: "id", checked: "checked", disabled: "disabled", readonly: "readonly", labelPosition: "labelPosition", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, outputs: { valueChange: "valueChange", checkboxChange: "checkboxChange", checkboxBlur: "checkboxBlur" }, host: { properties: { "class.granite-checkbox-checked": "checked", "class.granite-checkbox-disabled": "disabled", "class.granite-checkbox-readonly": "readonly", "class.granite-checkbox-label-before": "_positionBefore" }, classAttribute: "granite-checkbox" }, viewQueries: [{ propertyName: "_inputElement", first: true, predicate: ["input"], descendants: true }], exportAs: ["graniteCheckbox"], usesOnChanges: true, ngImport: i0, 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", 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;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}:host{box-sizing:border-box}:host *,:host *:before,:host *:after{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-box{animation:fade-in-animation .2s;animation-iteration-count:1}: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(:not(.granite-checkbox-checked)) .granite-checkbox-box{animation:fade-out-animation .2s;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) *{cursor:default}: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{padding-inline-start:0;padding-inline-end:var(--granite-spacing-8)}.granite-checkbox-label{display:flex;align-items:center;width:max-content;margin-inline-end:var(--granite-spacing-32);margin-block-end:var(--granite-spacing-4)}.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-4);border-width:0 0 .125rem .125rem}.granite-checkbox-text{padding-inline-start:var(--granite-spacing-8);font-size:var(--granite-font-size-body-small)}.granite-checkbox-text:empty{display:none}@keyframes fade-in-animation{0%{opacity:0}to{opacity:1}}@keyframes fade-out-animation{0%{opacity:1}to{opacity:0}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2515
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxComponent, decorators: [{
|
|
2516
|
-
type: Component,
|
|
2517
|
-
args: [{ selector: 'granite-checkbox', exportAs: 'graniteCheckbox', host: {
|
|
2518
|
-
class: 'granite-checkbox',
|
|
2519
|
-
'[class.granite-checkbox-checked]': 'checked',
|
|
2520
|
-
'[class.granite-checkbox-disabled]': 'disabled',
|
|
2521
|
-
'[class.granite-checkbox-readonly]': 'readonly',
|
|
2522
|
-
'[class.granite-checkbox-label-before]': '_positionBefore',
|
|
2523
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, 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", 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;left:0}[dir=rtl] .cdk-visually-hidden{left:auto;right:0}:host{box-sizing:border-box}:host *,:host *:before,:host *:after{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-box{animation:fade-in-animation .2s;animation-iteration-count:1}: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(:not(.granite-checkbox-checked)) .granite-checkbox-box{animation:fade-out-animation .2s;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) *{cursor:default}: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{padding-inline-start:0;padding-inline-end:var(--granite-spacing-8)}.granite-checkbox-label{display:flex;align-items:center;width:max-content;margin-inline-end:var(--granite-spacing-32);margin-block-end:var(--granite-spacing-4)}.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-4);border-width:0 0 .125rem .125rem}.granite-checkbox-text{padding-inline-start:var(--granite-spacing-8);font-size:var(--granite-font-size-body-small)}.granite-checkbox-text:empty{display:none}@keyframes fade-in-animation{0%{opacity:0}to{opacity:1}}@keyframes fade-out-animation{0%{opacity:1}to{opacity:0}}\n"] }]
|
|
2524
|
-
}], ctorParameters: function () { return [{ type: i1.FocusMonitor }]; }, propDecorators: { id: [{
|
|
2525
|
-
type: Input
|
|
2526
|
-
}], checked: [{
|
|
2527
|
-
type: Input
|
|
2528
|
-
}], disabled: [{
|
|
2529
|
-
type: Input
|
|
2530
|
-
}], readonly: [{
|
|
2531
|
-
type: Input
|
|
2532
|
-
}], labelPosition: [{
|
|
2533
|
-
type: Input
|
|
2534
|
-
}], ariaLabel: [{
|
|
2535
|
-
type: Input,
|
|
2536
|
-
args: ['aria-label']
|
|
2537
|
-
}], ariaLabelledby: [{
|
|
2538
|
-
type: Input,
|
|
2539
|
-
args: ['aria-labelledby']
|
|
2540
|
-
}], valueChange: [{
|
|
2541
|
-
type: Output
|
|
2542
|
-
}], checkboxChange: [{
|
|
2543
|
-
type: Output
|
|
2544
|
-
}], checkboxBlur: [{
|
|
2545
|
-
type: Output
|
|
2546
|
-
}], _inputElement: [{
|
|
2547
|
-
type: ViewChild,
|
|
2548
|
-
args: ['input']
|
|
2549
|
-
}] } });
|
|
2550
|
-
|
|
2551
|
-
class GraniteCheckboxGroupComponent extends GraniteRadioCheckboxBase {
|
|
2552
|
-
}
|
|
2553
|
-
GraniteCheckboxGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2554
|
-
GraniteCheckboxGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteCheckboxGroupComponent, selector: "granite-checkbox-group", host: { properties: { "attr.role": "\"group\"", "attr.aria-labelledby": "ariaLabelledby", "class.granite-radio-checkbox-base-layout-horizontal": "layout === \"horizontal\"" }, classAttribute: "granite-checkbox-group" }, usesInheritance: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host(.granite-radio-checkbox-base-layout-horizontal){display:flex;align-items:flex-start}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxGroupComponent, decorators: [{
|
|
2556
|
-
type: Component,
|
|
2557
|
-
args: [{ selector: 'granite-checkbox-group', host: {
|
|
2558
|
-
class: 'granite-checkbox-group',
|
|
2559
|
-
'[attr.role]': '"group"',
|
|
2560
|
-
'[attr.aria-labelledby]': 'ariaLabelledby',
|
|
2561
|
-
'[class.granite-radio-checkbox-base-layout-horizontal]': 'layout === "horizontal"',
|
|
2562
|
-
}, template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host(.granite-radio-checkbox-base-layout-horizontal){display:flex;align-items:flex-start}\n"] }]
|
|
2563
|
-
}] });
|
|
2564
|
-
|
|
2565
|
-
class GraniteCheckboxModule {
|
|
2566
|
-
}
|
|
2567
|
-
GraniteCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2568
|
-
GraniteCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxModule, declarations: [GraniteCheckboxComponent, GraniteCheckboxGroupComponent], exports: [GraniteCheckboxComponent, GraniteCheckboxGroupComponent] });
|
|
2569
|
-
GraniteCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxModule });
|
|
2570
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCheckboxModule, decorators: [{
|
|
2571
|
-
type: NgModule,
|
|
2572
|
-
args: [{
|
|
2573
|
-
declarations: [GraniteCheckboxComponent, GraniteCheckboxGroupComponent],
|
|
2574
|
-
exports: [GraniteCheckboxComponent, GraniteCheckboxGroupComponent],
|
|
2575
|
-
}]
|
|
2576
|
-
}] });
|
|
2577
|
-
|
|
2578
|
-
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2579
|
-
const disabledMixin = (Base = class {
|
|
2580
|
-
}) => {
|
|
2581
|
-
class Derived extends Base {
|
|
2582
|
-
constructor() {
|
|
2583
|
-
super(...arguments);
|
|
2584
|
-
this.disabled = false;
|
|
2585
|
-
}
|
|
2586
|
-
ngOnChanges(changes) {
|
|
2587
|
-
if (changes.disabled) {
|
|
2588
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
Derived.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Derived, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2593
|
-
Derived.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: Derived, inputs: { disabled: "disabled" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
|
|
2594
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: Derived, decorators: [{
|
|
2595
|
-
type: Directive
|
|
2596
|
-
}], propDecorators: { disabled: [{
|
|
2597
|
-
type: Input
|
|
2598
|
-
}] } });
|
|
2599
|
-
return Derived;
|
|
2600
|
-
};
|
|
2601
|
-
|
|
2602
|
-
var ButtonSelectors;
|
|
2603
|
-
(function (ButtonSelectors) {
|
|
2604
|
-
ButtonSelectors["graniteButton"] = "granite-button";
|
|
2605
|
-
ButtonSelectors["granitePrimaryButton"] = "granite-primary-button";
|
|
2606
|
-
ButtonSelectors["graniteFlatButton"] = "granite-flat-button";
|
|
2607
|
-
ButtonSelectors["graniteToolbarButton"] = "granite-toolbar-button";
|
|
2608
|
-
})(ButtonSelectors || (ButtonSelectors = {}));
|
|
2609
|
-
const ButtonComponentMixin = disabledMixin();
|
|
2610
|
-
class GraniteButtonComponent extends ButtonComponentMixin {
|
|
2611
|
-
constructor(_focusMonitor, _elementRef) {
|
|
2612
|
-
super();
|
|
2613
|
-
this._focusMonitor = _focusMonitor;
|
|
2614
|
-
this._elementRef = _elementRef;
|
|
2615
|
-
this.toggled = false;
|
|
2616
|
-
this._buttonToggled = false;
|
|
2617
|
-
for (const selector of Object.keys(ButtonSelectors)) {
|
|
2618
|
-
if (this._getHostElement().hasAttribute(selector)) {
|
|
2619
|
-
this._getHostElement().classList.add(ButtonSelectors[selector]);
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
ngOnChanges(changes) {
|
|
2624
|
-
super.ngOnChanges(changes);
|
|
2625
|
-
if (changes.toggled) {
|
|
2626
|
-
this._buttonToggled = coerceBooleanProperty(changes.toggled.currentValue);
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
focus(origin = 'program', options) {
|
|
2630
|
-
this._focusMonitor.focusVia(this._getHostElement(), origin, options);
|
|
2631
|
-
}
|
|
2632
|
-
_getHostElement() {
|
|
2633
|
-
return this._elementRef.nativeElement;
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
GraniteButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteButtonComponent, deps: [{ token: i1.FocusMonitor }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2637
|
-
GraniteButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteButtonComponent, selector: "button[graniteButton],\n button[granitePrimaryButton],\n button[graniteFlatButton],\n button[graniteToolbarButton]\n ", inputs: { disabled: "disabled", toggled: "toggled" }, host: { properties: { "class.granite-button-disabled": "disabled", "class.granite-button-toggled": "_buttonToggled", "attr.disabled": "disabled || null" }, classAttribute: "granite-button-base" }, exportAs: ["graniteButton"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit;cursor:pointer}: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-8) var(--granite-spacing-8);position:relative;line-height:var(--granite-font-size-body);display:flex;justify-content:center;align-items:center;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{background-color:inherit;-webkit-appearance:none;appearance:none;outline:none;border:none;font:inherit;border-radius:inherit;height:inherit;font-weight:inherit;line-height:inherit;color:inherit;margin:inherit;cursor:pointer;padding:inherit}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}button:host.granite-primary-button{background-color:var(--granite-color-background-active);color:var(--granite-color-text-on-active);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:none}button:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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{outline:none}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}a:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text-link);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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;-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2638
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteButtonComponent, decorators: [{
|
|
2639
|
-
type: Component,
|
|
2640
|
-
args: [{ selector: `button[graniteButton],
|
|
2641
|
-
button[granitePrimaryButton],
|
|
2642
|
-
button[graniteFlatButton],
|
|
2643
|
-
button[graniteToolbarButton]
|
|
2644
|
-
`, host: {
|
|
2645
|
-
class: 'granite-button-base',
|
|
2646
|
-
'[class.granite-button-disabled]': 'disabled',
|
|
2647
|
-
'[class.granite-button-toggled]': '_buttonToggled',
|
|
2648
|
-
'[attr.disabled]': 'disabled || null',
|
|
2649
|
-
}, exportAs: 'graniteButton', template: '<ng-content></ng-content>', inputs: ['disabled'], changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit;cursor:pointer}: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-8) var(--granite-spacing-8);position:relative;line-height:var(--granite-font-size-body);display:flex;justify-content:center;align-items:center;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{background-color:inherit;-webkit-appearance:none;appearance:none;outline:none;border:none;font:inherit;border-radius:inherit;height:inherit;font-weight:inherit;line-height:inherit;color:inherit;margin:inherit;cursor:pointer;padding:inherit}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}button:host.granite-primary-button{background-color:var(--granite-color-background-active);color:var(--granite-color-text-on-active);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:none}button:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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{outline:none}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}a:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text-link);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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;-webkit-user-select:none;user-select:none}\n"] }]
|
|
2650
|
-
}], ctorParameters: function () { return [{ type: i1.FocusMonitor }, { type: i0.ElementRef }]; }, propDecorators: { toggled: [{
|
|
2651
|
-
type: Input
|
|
2652
|
-
}] } });
|
|
2653
|
-
class GraniteAnchorComponent extends GraniteButtonComponent {
|
|
2654
|
-
constructor(_focusMonitor, _elementRef) {
|
|
2655
|
-
super(_focusMonitor, _elementRef);
|
|
2656
|
-
this._focusMonitor = _focusMonitor;
|
|
2657
|
-
this._elementRef = _elementRef;
|
|
2658
|
-
}
|
|
2659
|
-
_anchorClick(event) {
|
|
2660
|
-
if (this.disabled) {
|
|
2661
|
-
event.preventDefault();
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
ngOnChanges(changes) {
|
|
2665
|
-
super.ngOnChanges(changes);
|
|
2666
|
-
}
|
|
2667
|
-
}
|
|
2668
|
-
GraniteAnchorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteAnchorComponent, deps: [{ token: i1.FocusMonitor }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2669
|
-
GraniteAnchorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteAnchorComponent, selector: "a[graniteButton],\n a[graniteFlatButton]", inputs: { disabled: "disabled" }, host: { listeners: { "click": "_anchorClick($event)" }, properties: { "attr.tabindex": "disabled ? -1 : 0", "class.granite-button-disabled": "disabled" }, classAttribute: "granite-button-base" }, exportAs: ["graniteAnchor"], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: [":host{box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit;cursor:pointer}: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-8) var(--granite-spacing-8);position:relative;line-height:var(--granite-font-size-body);display:flex;justify-content:center;align-items:center;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{background-color:inherit;-webkit-appearance:none;appearance:none;outline:none;border:none;font:inherit;border-radius:inherit;height:inherit;font-weight:inherit;line-height:inherit;color:inherit;margin:inherit;cursor:pointer;padding:inherit}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}button:host.granite-primary-button{background-color:var(--granite-color-background-active);color:var(--granite-color-text-on-active);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:none}button:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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{outline:none}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}a:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text-link);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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;-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteAnchorComponent, decorators: [{
|
|
2671
|
-
type: Component,
|
|
2672
|
-
args: [{ selector: `a[graniteButton],
|
|
2673
|
-
a[graniteFlatButton]`, host: {
|
|
2674
|
-
class: 'granite-button-base',
|
|
2675
|
-
'[attr.tabindex]': 'disabled ? -1 : 0',
|
|
2676
|
-
'[class.granite-button-disabled]': 'disabled',
|
|
2677
|
-
}, exportAs: 'graniteAnchor', template: '<ng-content></ng-content>', inputs: ['disabled'], changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit;cursor:pointer}: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-8) var(--granite-spacing-8);position:relative;line-height:var(--granite-font-size-body);display:flex;justify-content:center;align-items:center;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{background-color:inherit;-webkit-appearance:none;appearance:none;outline:none;border:none;font:inherit;border-radius:inherit;height:inherit;font-weight:inherit;line-height:inherit;color:inherit;margin:inherit;cursor:pointer;padding:inherit}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}button:host.granite-primary-button{background-color:var(--granite-color-background-active);color:var(--granite-color-text-on-active);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-primary-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-primary-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:none}button:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled{background-color:var(--granite-color-background-selected);color:var(--granite-color-focus)}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:not(:focus),button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}button:host.granite-toolbar-button.granite-flat-button.granite-button-toggled:hover,button:host.granite-toolbar-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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{outline:none}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}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}a:host.granite-flat-button{background-color:transparent;color:var(--granite-color-text-link);outline:none;outline-offset:-1px}@media (hover: hover) and (pointer: fine){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-flat-button.granite-button-toggled,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled{background-color:none;color:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:not(:focus),a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:not(:focus){outline:none}a:host.granite-flat-button.granite-flat-button.granite-button-toggled:hover,a:host.granite-flat-button.granite-toolbar-button.granite-button-toggled:hover{background-color:var(--granite-color-background-active-hover);color:var(--granite-color-text-on-active)}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;-webkit-user-select:none;user-select:none}\n"] }]
|
|
2678
|
-
}], ctorParameters: function () { return [{ type: i1.FocusMonitor }, { type: i0.ElementRef }]; }, propDecorators: { _anchorClick: [{
|
|
2679
|
-
type: HostListener,
|
|
2680
|
-
args: ['click', ['$event']]
|
|
2681
|
-
}] } });
|
|
2682
|
-
|
|
2683
|
-
class GraniteButtonModule {
|
|
2684
|
-
}
|
|
2685
|
-
GraniteButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2686
|
-
GraniteButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteButtonModule, declarations: [GraniteButtonComponent, GraniteAnchorComponent], exports: [GraniteButtonComponent, GraniteAnchorComponent] });
|
|
2687
|
-
GraniteButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteButtonModule });
|
|
2688
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteButtonModule, decorators: [{
|
|
2689
|
-
type: NgModule,
|
|
2690
|
-
args: [{
|
|
2691
|
-
declarations: [GraniteButtonComponent, GraniteAnchorComponent],
|
|
2692
|
-
exports: [GraniteButtonComponent, GraniteAnchorComponent],
|
|
2693
|
-
}]
|
|
2694
|
-
}] });
|
|
2695
|
-
|
|
2696
|
-
const GRANITE_INPUT_INCLUDES = ['text', 'number', 'password', 'textarea'];
|
|
2697
|
-
class GraniteInputFieldComponent {
|
|
2698
|
-
constructor(_focusMonitor) {
|
|
2699
|
-
this._focusMonitor = _focusMonitor;
|
|
2700
|
-
this.id = null;
|
|
2701
|
-
this.name = null;
|
|
2702
|
-
this.type = 'text';
|
|
2703
|
-
this.value = '';
|
|
2704
|
-
this.required = false;
|
|
2705
|
-
this.readonly = false;
|
|
2706
|
-
this.invalid = false;
|
|
2707
|
-
this.disabled = false;
|
|
2708
|
-
this.placeholder = '';
|
|
2709
|
-
this.maxlength = 255;
|
|
2710
|
-
this.countcharacters = false;
|
|
2711
|
-
this.ariaLabel = null;
|
|
2712
|
-
this.ariaLabelledby = null;
|
|
2713
|
-
this.valueChange = new EventEmitter();
|
|
2714
|
-
this._supported = true;
|
|
2715
|
-
this._empty = false;
|
|
2716
|
-
this._passwordFieldIcon = 'view';
|
|
2717
|
-
this._passwordField = false;
|
|
2718
|
-
this._currentCharCount = 0;
|
|
2719
|
-
this._passwordToggled = false;
|
|
2720
|
-
}
|
|
2721
|
-
ngOnInit() {
|
|
2722
|
-
this._validateType();
|
|
2723
|
-
this._passwordField = this.type == 'password';
|
|
2724
|
-
this._empty = this.value == null || this.value === '';
|
|
2725
|
-
}
|
|
2726
|
-
ngOnChanges(changes) {
|
|
2727
|
-
if (changes.required) {
|
|
2728
|
-
this.required = coerceBooleanProperty(changes.required.currentValue);
|
|
2729
|
-
}
|
|
2730
|
-
if (changes.readonly) {
|
|
2731
|
-
this.readonly = coerceBooleanProperty(changes.readonly.currentValue);
|
|
2732
|
-
}
|
|
2733
|
-
if (changes.invalid) {
|
|
2734
|
-
this.invalid = coerceBooleanProperty(changes.invalid.currentValue);
|
|
2735
|
-
}
|
|
2736
|
-
if (changes.disabled) {
|
|
2737
|
-
this.disabled = coerceBooleanProperty(changes.disabled.currentValue);
|
|
2738
|
-
}
|
|
2739
|
-
if (changes.countcharacters) {
|
|
2740
|
-
this.countcharacters = coerceBooleanProperty(changes.countcharacters.currentValue);
|
|
2741
|
-
}
|
|
2742
|
-
if (changes.value) {
|
|
2743
|
-
this._empty = this.value == null || this.value === '';
|
|
2744
|
-
}
|
|
2745
|
-
if (changes.type) {
|
|
2746
|
-
this._validateType();
|
|
2747
|
-
}
|
|
2748
|
-
}
|
|
2749
|
-
focus(origin = 'program', options) {
|
|
2750
|
-
if (this.type === 'text') {
|
|
2751
|
-
this._focusMonitor.focusVia(this._getInputElement(), origin, options);
|
|
2752
|
-
}
|
|
2753
|
-
else if (this.type === 'textarea') {
|
|
2754
|
-
this._focusMonitor.focusVia(this._getTextareaElement(), origin, options);
|
|
2755
|
-
}
|
|
2756
|
-
}
|
|
2757
|
-
_togglePassword() {
|
|
2758
|
-
if (this._passwordToggled) {
|
|
2759
|
-
this._passwordToggled = false;
|
|
2760
|
-
this.type = 'password';
|
|
2761
|
-
this._passwordFieldIcon = 'view';
|
|
2762
|
-
}
|
|
2763
|
-
else {
|
|
2764
|
-
this._passwordToggled = true;
|
|
2765
|
-
this.type = 'text';
|
|
2766
|
-
this._passwordFieldIcon = 'view-disabled';
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
_onKeyUp(event) {
|
|
2770
|
-
const inputEvent = event.target;
|
|
2771
|
-
this._applyCharacterCount(inputEvent.value);
|
|
2772
|
-
this._empty = inputEvent.value == null || inputEvent.value === '';
|
|
2773
|
-
this.valueChange.emit(inputEvent.value);
|
|
2774
|
-
}
|
|
2775
|
-
_onInput(event) {
|
|
2776
|
-
const inputEvent = event.target;
|
|
2777
|
-
this._empty = inputEvent.value == null || inputEvent.value === '';
|
|
2778
|
-
this.valueChange.emit(inputEvent.value);
|
|
2779
|
-
}
|
|
2780
|
-
_validateType() {
|
|
2781
|
-
if (GRANITE_INPUT_INCLUDES.indexOf(this.type) < 0) {
|
|
2782
|
-
this._supported = false;
|
|
2783
|
-
throw Error(`Input type "${this.type}" isn't supported by graniteInputField.`);
|
|
2784
|
-
}
|
|
2785
|
-
}
|
|
2786
|
-
_applyCharacterCount(inputString) {
|
|
2787
|
-
if (this.countcharacters) {
|
|
2788
|
-
this._currentCharCount = inputString.length;
|
|
2789
|
-
if (this._currentCharCount > this.maxlength) {
|
|
2790
|
-
inputString = inputString.slice(0, this.maxlength);
|
|
2791
|
-
this._currentCharCount = this.maxlength;
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
_getInputElement() {
|
|
2796
|
-
return this._inputElement.nativeElement;
|
|
2797
|
-
}
|
|
2798
|
-
_getTextareaElement() {
|
|
2799
|
-
return this._textareaElement.nativeElement;
|
|
2800
|
-
}
|
|
2801
|
-
}
|
|
2802
|
-
GraniteInputFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteInputFieldComponent, deps: [{ token: i1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component });
|
|
2803
|
-
GraniteInputFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteInputFieldComponent, selector: "granite-input-field", inputs: { id: "id", name: "name", type: "type", value: "value", required: "required", readonly: "readonly", invalid: "invalid", disabled: "disabled", placeholder: "placeholder", prefixicon: "prefixicon", maxlength: "maxlength", countcharacters: "countcharacters", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, outputs: { valueChange: "valueChange" }, host: { classAttribute: "granite-input-field" }, viewQueries: [{ propertyName: "_inputElement", first: true, predicate: ["input"], descendants: true }, { propertyName: "_textareaElement", first: true, predicate: ["textarea"], descendants: true }], exportAs: ["graniteInputField"], usesOnChanges: true, ngImport: i0, 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", styles: [":host{transition:all .2s ease-out;width:14.5rem;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.granite-input-hover-bar{height:.0625rem;background-color:var(--granite-color-border-hard);position:absolute;width:inherit;bottom:0}.granite-input-hover-bar.granite-input-invalid{background-color:var(--granite-color-signal-failure)}.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;appearance:none;outline:none;border:none;background-color:var(--granite-color-background-input);padding:var(--granite-spacing-8);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::placeholder{color:var(--granite-color-text-hint)}.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::placeholder{color:var(--granite-color-text-weak)}.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: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::placeholder{color:transparent}.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-8);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;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: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-8);background-size:contain;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}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: GraniteIconComponent, selector: "granite-icon", inputs: ["fontIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2804
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteInputFieldComponent, decorators: [{
|
|
2805
|
-
type: Component,
|
|
2806
|
-
args: [{ selector: 'granite-input-field', exportAs: 'graniteInputField', host: {
|
|
2807
|
-
class: 'granite-input-field',
|
|
2808
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: [":host{transition:all .2s ease-out;width:14.5rem;box-sizing:border-box}:host *,:host *:before,:host *:after{box-sizing:inherit}.granite-input-hover-bar{height:.0625rem;background-color:var(--granite-color-border-hard);position:absolute;width:inherit;bottom:0}.granite-input-hover-bar.granite-input-invalid{background-color:var(--granite-color-signal-failure)}.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;appearance:none;outline:none;border:none;background-color:var(--granite-color-background-input);padding:var(--granite-spacing-8);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::placeholder{color:var(--granite-color-text-hint)}.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::placeholder{color:var(--granite-color-text-weak)}.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: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::placeholder{color:transparent}.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-8);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;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: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-8);background-size:contain;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}\n"] }]
|
|
2809
|
-
}], ctorParameters: function () { return [{ type: i1.FocusMonitor }]; }, propDecorators: { id: [{
|
|
2810
|
-
type: Input
|
|
2811
|
-
}], name: [{
|
|
2812
|
-
type: Input
|
|
2813
|
-
}], type: [{
|
|
2814
|
-
type: Input
|
|
2815
|
-
}], value: [{
|
|
2816
|
-
type: Input
|
|
2817
|
-
}], required: [{
|
|
2818
|
-
type: Input
|
|
2819
|
-
}], readonly: [{
|
|
2820
|
-
type: Input
|
|
2821
|
-
}], invalid: [{
|
|
2822
|
-
type: Input
|
|
2823
|
-
}], disabled: [{
|
|
2824
|
-
type: Input
|
|
2825
|
-
}], placeholder: [{
|
|
2826
|
-
type: Input
|
|
2827
|
-
}], prefixicon: [{
|
|
2828
|
-
type: Input
|
|
2829
|
-
}], maxlength: [{
|
|
2830
|
-
type: Input
|
|
2831
|
-
}], countcharacters: [{
|
|
2832
|
-
type: Input
|
|
2833
|
-
}], ariaLabel: [{
|
|
2834
|
-
type: Input,
|
|
2835
|
-
args: ['aria-label']
|
|
2836
|
-
}], ariaLabelledby: [{
|
|
2837
|
-
type: Input,
|
|
2838
|
-
args: ['aria-labelledby']
|
|
2839
|
-
}], valueChange: [{
|
|
2840
|
-
type: Output
|
|
2841
|
-
}], _inputElement: [{
|
|
2842
|
-
type: ViewChild,
|
|
2843
|
-
args: ['input']
|
|
2844
|
-
}], _textareaElement: [{
|
|
2845
|
-
type: ViewChild,
|
|
2846
|
-
args: ['textarea']
|
|
2847
|
-
}] } });
|
|
2848
|
-
|
|
2849
|
-
class GraniteInputFieldModule {
|
|
2850
|
-
}
|
|
2851
|
-
GraniteInputFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteInputFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2852
|
-
GraniteInputFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteInputFieldModule, declarations: [GraniteInputFieldComponent], imports: [CommonModule, GraniteIconModule, GraniteButtonModule], exports: [GraniteInputFieldComponent] });
|
|
2853
|
-
GraniteInputFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteInputFieldModule, imports: [CommonModule, GraniteIconModule, GraniteButtonModule] });
|
|
2854
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteInputFieldModule, decorators: [{
|
|
2855
|
-
type: NgModule,
|
|
2856
|
-
args: [{
|
|
2857
|
-
imports: [CommonModule, GraniteIconModule, GraniteButtonModule],
|
|
2858
|
-
declarations: [GraniteInputFieldComponent],
|
|
2859
|
-
exports: [GraniteInputFieldComponent],
|
|
2860
|
-
}]
|
|
2861
|
-
}] });
|
|
2862
|
-
|
|
2863
|
-
/** Event object emitted by GraniteChip when selected or deselected. */
|
|
2864
|
-
class GraniteChipSelectionChangeEvent {
|
|
2865
|
-
constructor() {
|
|
2866
|
-
/** Whether the selection change was a result of a user interaction. */
|
|
2867
|
-
this.isUserInput = false;
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
class GraniteChipComponent {
|
|
2871
|
-
/** Whether the chip is selected. */
|
|
2872
|
-
get selected() {
|
|
2873
|
-
return this._selected;
|
|
2874
|
-
}
|
|
2875
|
-
set selected(value) {
|
|
2876
|
-
const coercedValue = coerceBooleanProperty(value);
|
|
2877
|
-
if (coercedValue !== this._selected) {
|
|
2878
|
-
this._selected = coercedValue;
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
/** The value of the chip. Defaults to the text content inside `<granite-chip>` tags. */
|
|
2882
|
-
get value() {
|
|
2883
|
-
return this._value != null
|
|
2884
|
-
? this._value
|
|
2885
|
-
: this._elementRef.nativeElement.textContent;
|
|
2886
|
-
}
|
|
2887
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
2888
|
-
set value(val) {
|
|
2889
|
-
this._value = val;
|
|
2890
|
-
}
|
|
2891
|
-
/**
|
|
2892
|
-
* Whether or not the chip is selectable. When a chip is not selectable,
|
|
2893
|
-
* changes to its selected state are always ignored. By default a chip is
|
|
2894
|
-
* selectable, and it becomes non-selectable if its parent chip list is
|
|
2895
|
-
* not selectable.
|
|
2896
|
-
*/
|
|
2897
|
-
get selectable() {
|
|
2898
|
-
return this._selectable && this._chipListSelectable;
|
|
2899
|
-
}
|
|
2900
|
-
set selectable(value) {
|
|
2901
|
-
this._selectable = coerceBooleanProperty(value);
|
|
2902
|
-
}
|
|
2903
|
-
/** Whether the chip is disabled. Also the individual chips are disabled when chip list is disabled */
|
|
2904
|
-
get disabled() {
|
|
2905
|
-
return this._chipListDisabled || this._disabled;
|
|
2906
|
-
}
|
|
2907
|
-
set disabled(value) {
|
|
2908
|
-
this._disabled = coerceBooleanProperty(value);
|
|
2909
|
-
}
|
|
2910
|
-
/**
|
|
2911
|
-
* Whether the chip can be removed from the list
|
|
2912
|
-
*/
|
|
2913
|
-
get removable() {
|
|
2914
|
-
return this._removable;
|
|
2915
|
-
}
|
|
2916
|
-
set removable(value) {
|
|
2917
|
-
this._removable = coerceBooleanProperty(value);
|
|
2918
|
-
}
|
|
2919
|
-
/** Whether the chip is in an invalid state. */
|
|
2920
|
-
get invalid() {
|
|
2921
|
-
return this._invalid;
|
|
2922
|
-
}
|
|
2923
|
-
set invalid(value) {
|
|
2924
|
-
this._invalid = coerceBooleanProperty(value);
|
|
2925
|
-
}
|
|
2926
|
-
constructor(_elementRef, _ngZone, _changeDetectorRef, tabIndex) {
|
|
2927
|
-
this._elementRef = _elementRef;
|
|
2928
|
-
this._ngZone = _ngZone;
|
|
2929
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
2930
|
-
/** Whether the chip has focus. */
|
|
2931
|
-
this._hasFocus = false;
|
|
2932
|
-
/** Whether the chip list is selectable */
|
|
2933
|
-
this._chipListSelectable = true;
|
|
2934
|
-
/** Whether the chip list is in multi-selection mode. */
|
|
2935
|
-
this._chipListMultiple = false;
|
|
2936
|
-
/** Whether the chip list as a whole is disabled. */
|
|
2937
|
-
this._chipListDisabled = false;
|
|
2938
|
-
/** ARIA role that should be applied to the chip. */
|
|
2939
|
-
this.role = 'option';
|
|
2940
|
-
this._selected = false;
|
|
2941
|
-
this._selectable = true;
|
|
2942
|
-
this._disabled = false;
|
|
2943
|
-
this._removable = false;
|
|
2944
|
-
this._invalid = false;
|
|
2945
|
-
this.ariaLabel = null;
|
|
2946
|
-
this.ariaLabelledby = null;
|
|
2947
|
-
/** Emitted when the chip is selected or deselected. */
|
|
2948
|
-
this.selectionChange = new EventEmitter();
|
|
2949
|
-
/** Emitted when a chip is to be removed. */
|
|
2950
|
-
this.removed = new EventEmitter();
|
|
2951
|
-
/** Emitted when the chip is destroyed. */
|
|
2952
|
-
this.destroyed = new EventEmitter();
|
|
2953
|
-
this.tabIndex = -1;
|
|
2954
|
-
this.inputChip = false;
|
|
2955
|
-
/** Emits when the chip is focused. */
|
|
2956
|
-
this.chipFocus = new EventEmitter();
|
|
2957
|
-
/** Emits when the chip is blurred. */
|
|
2958
|
-
this.chipBlur = new EventEmitter();
|
|
2959
|
-
const inputChipAttrName = 'granite-input-chip';
|
|
2960
|
-
const element = this._elementRef.nativeElement;
|
|
2961
|
-
if (element.hasAttribute(inputChipAttrName) ||
|
|
2962
|
-
element.tagName.toLowerCase() === inputChipAttrName) {
|
|
2963
|
-
this.inputChip = true;
|
|
2964
|
-
}
|
|
2965
|
-
this.tabIndex = tabIndex != null ? parseInt(tabIndex) || -1 : -1;
|
|
2966
|
-
}
|
|
2967
|
-
ngOnDestroy() {
|
|
2968
|
-
this.destroyed.emit({ chip: this });
|
|
2969
|
-
}
|
|
2970
|
-
/** Selects the chip. */
|
|
2971
|
-
select(isUserInput = false) {
|
|
2972
|
-
if (!this._selected) {
|
|
2973
|
-
this._selected = true;
|
|
2974
|
-
this._dispatchSelectionChange(isUserInput);
|
|
2975
|
-
this._changeDetectorRef.markForCheck();
|
|
2976
|
-
}
|
|
2977
|
-
}
|
|
2978
|
-
/** Deselects the chip. */
|
|
2979
|
-
deselect() {
|
|
2980
|
-
if (this._selected) {
|
|
2981
|
-
this._selected = false;
|
|
2982
|
-
this._dispatchSelectionChange();
|
|
2983
|
-
this._changeDetectorRef.markForCheck();
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2986
|
-
/** Toggles the current selected state of this chip. */
|
|
2987
|
-
toggleSelected(isUserInput = false) {
|
|
2988
|
-
this._selected = !this.selected;
|
|
2989
|
-
this._dispatchSelectionChange(isUserInput);
|
|
2990
|
-
this._changeDetectorRef.markForCheck();
|
|
2991
|
-
return this.selected;
|
|
2992
|
-
}
|
|
2993
|
-
/** Allows for programmatic focusing of the chip unless it's disabled. */
|
|
2994
|
-
focus() {
|
|
2995
|
-
if (!this.disabled) {
|
|
2996
|
-
if (!this._hasFocus) {
|
|
2997
|
-
this._elementRef.nativeElement.focus();
|
|
2998
|
-
this.chipFocus.next({ chip: this });
|
|
2999
|
-
}
|
|
3000
|
-
this._hasFocus = true;
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
/**
|
|
3004
|
-
* Allows for programmatic removal of the chip.
|
|
3005
|
-
* Called by the GraniteChipList when the DELETE or BACKSPACE keys are pressed.
|
|
3006
|
-
* Informs any listeners of the removal request. Does not remove the chip from the DOM.
|
|
3007
|
-
*/
|
|
3008
|
-
remove() {
|
|
3009
|
-
if (this.removable || this.inputChip) {
|
|
3010
|
-
this.removed.emit({ chip: this });
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
/** Handles click events on the chip. */
|
|
3014
|
-
_handleClick(event) {
|
|
3015
|
-
if (this.disabled) {
|
|
3016
|
-
event.preventDefault();
|
|
3017
|
-
return;
|
|
3018
|
-
}
|
|
3019
|
-
if (this.selectable) {
|
|
3020
|
-
this.toggleSelected(true);
|
|
3021
|
-
}
|
|
3022
|
-
}
|
|
3023
|
-
/** Handle custom key presses. */
|
|
3024
|
-
_handleKeydown(event) {
|
|
3025
|
-
if (this.disabled) {
|
|
3026
|
-
return;
|
|
3027
|
-
}
|
|
3028
|
-
switch (event.keyCode) {
|
|
3029
|
-
case DELETE:
|
|
3030
|
-
case BACKSPACE:
|
|
3031
|
-
// If the chip is removable, remove the focused chip
|
|
3032
|
-
this.remove();
|
|
3033
|
-
// Always prevent so page navigation does not occur
|
|
3034
|
-
event.preventDefault();
|
|
3035
|
-
break;
|
|
3036
|
-
case SPACE:
|
|
3037
|
-
// If we are selectable, toggle the focused chip
|
|
3038
|
-
if (this.selectable) {
|
|
3039
|
-
this.toggleSelected(true);
|
|
3040
|
-
}
|
|
3041
|
-
// Always prevent space from scrolling the page since the list has focus
|
|
3042
|
-
event.preventDefault();
|
|
3043
|
-
break;
|
|
3044
|
-
}
|
|
3045
|
-
}
|
|
3046
|
-
_handleRemoveClick(event) {
|
|
3047
|
-
this.remove();
|
|
3048
|
-
// We need to stop event propagation because otherwise the event will bubble up to the
|
|
3049
|
-
// form field and cause the `onContainerClick` method to be invoked. This method would then
|
|
3050
|
-
// reset the focused chip that has been focused after chip removal.
|
|
3051
|
-
event.stopPropagation();
|
|
3052
|
-
event.preventDefault();
|
|
3053
|
-
}
|
|
3054
|
-
_blur() {
|
|
3055
|
-
// When animations are enabled, Angular may end up removing the chip from the DOM a little
|
|
3056
|
-
// earlier than usual, causing it to be blurred and throwing off the logic in the chip list
|
|
3057
|
-
// that moves focus not the next item. To work around the issue, we defer marking the chip
|
|
3058
|
-
// as not focused until the next time the zone stabilizes.
|
|
3059
|
-
this._ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
3060
|
-
this._ngZone.run(() => {
|
|
3061
|
-
this._hasFocus = false;
|
|
3062
|
-
this.chipBlur.next({ chip: this });
|
|
3063
|
-
});
|
|
3064
|
-
});
|
|
3065
|
-
}
|
|
3066
|
-
_dispatchSelectionChange(isUserInput = false) {
|
|
3067
|
-
this.selectionChange.emit({
|
|
3068
|
-
source: this,
|
|
3069
|
-
isUserInput,
|
|
3070
|
-
selected: this._selected,
|
|
3071
|
-
});
|
|
3072
|
-
}
|
|
3073
|
-
/** The ARIA selected applied to the chip. */
|
|
3074
|
-
get ariaSelected() {
|
|
3075
|
-
// Remove the `aria-selected` when the chip is deselected in single-selection mode, because
|
|
3076
|
-
// it adds noise to NVDA users where "not selected" will be read out for each chip.
|
|
3077
|
-
return this.selectable && (this._chipListMultiple || this.selected)
|
|
3078
|
-
? this.selected.toString()
|
|
3079
|
-
: null;
|
|
3080
|
-
}
|
|
3081
|
-
}
|
|
3082
|
-
GraniteChipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef, optional: true }, { token: 'tabindex', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
3083
|
-
GraniteChipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteChipComponent, selector: "granite-chip, granite-input-chip", inputs: { tabIndex: "tabIndex", role: "role", selected: "selected", value: "value", selectable: "selectable", disabled: "disabled", removable: "removable", invalid: "invalid", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"] }, outputs: { selectionChange: "selectionChange", removed: "removed", destroyed: "destroyed", chipFocus: "chipFocus", chipBlur: "chipBlur" }, host: { listeners: { "click": "_handleClick($event)", "keydown": "_handleKeydown($event)", "blur": "_blur()", "focus": "focus()" }, properties: { "class.granite-chip-input": "inputChip", "class.granite-chip-selectable": "selectable", "class.granite-chip-selected": "selected", "class.granite-chip-disabled": "disabled", "class.granite-chip-invalid": "invalid", "class.granite-chip-removable": "!disabled && (removable || inputChip)", "attr.tabindex": "disabled ? null : tabIndex", "attr.role": "role", "attr.disabled": "disabled || null", "attr.aria-label": "ariaLabel", "attr.aria-labelledby": "ariaLabelledby", "attr.aria-disabled": "disabled.toString()", "attr.aria-selected": "ariaSelected" }, classAttribute: "granite-chip" }, exportAs: ["graniteChip"], ngImport: i0, template: "<ng-content></ng-content>\n<button\n *ngIf=\"!disabled && (removable || inputChip)\"\n class=\"granite-chip-remove\"\n (click)=\"_handleRemoveClick($event)\"\n>\n <granite-icon\n fontIcon=\"icon-close\"\n class=\"granite-chip-remove-icon\"\n [class.granite-chip-remove-icon-invalid]=\"invalid\"\n ></granite-icon>\n</button>\n", styles: [":host.granite-chip{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;-webkit-user-select:none;user-select:none;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;border:none;-webkit-appearance:none;-moz-appearance:none;justify-content:center;align-items:center;padding-inline:var(--granite-spacing-16);margin-inline-start:var(--granite-spacing-2);margin-inline-end:var(--granite-spacing-2);padding-top:var(--granite-spacing-8);padding-bottom:var(--granite-spacing-8);height:inherit;color:var(--granite-color-text-weak);background-color:var(--granite-color-background);border-radius:var(--granite-radius-l);border-style:solid;border-width:var(--granite-border-width-regular);border-color:var(--granite-color-border-hard)}:host.granite-chip:hover{background-color:var(--granite-color-background-hover);cursor:pointer}:host.granite-chip.granite-chip-disabled{background-color:var(--granite-color-background);color:var(--granite-color-text-hint)}:host.granite-chip.granite-chip-disabled:hover{background-color:var(--granite-color-background);cursor:auto}:host.granite-chip:not(.granite-chip-selectable):hover{background-color:var(--granite-color-background);cursor:auto}:host.granite-chip.granite-chip-removable{padding-inline-end:var(--granite-spacing-8)}:host.granite-chip.granite-chip-invalid{background-color:var(--granite-color-background-failure);border-color:var(--granite-color-background-failure)}:host.granite-chip.granite-chip-invalid:hover{border-color:var(--granite-color-signal-failure)}:host.granite-chip.granite-chip-selected:not(.granite-chip-disabled):not(.granite-chip-input){border-color:var(--granite-color-background-active);background-color:var(--granite-color-background-info)}:host.granite-chip.granite-chip-selected:not(.granite-chip-disabled):not(.granite-chip-input):hover{background-color:var(--granite-color-background-hover)}:host.granite-chip.granite-chip-input{padding-top:var(--granite-spacing-4);padding-bottom:var(--granite-spacing-4);padding-inline:var(--granite-spacing-8)}:host.granite-chip.granite-chip-input:hover{background-color:var(--granite-color-background-hover)}:host.granite-chip.granite-chip-input:hover.granite-chip-invalid{background-color:var(--granite-color-background-failure)}:host.granite-chip.granite-chip-input:hover.granite-chip-invalid:hover{border-color:var(--granite-color-signal-failure)}.granite-chip-remove{display:flex;justify-content:center;align-items:center;background-color:transparent;outline:none;border:none;cursor:pointer;margin-inline-start:var(--granite-spacing-4);margin-inline-end:0;padding:0}[dir=rtl] .granite-chip-remove{margin-inline-end:var(--granite-spacing-4);margin-inline-start:0}.granite-chip-remove .granite-chip-remove-icon{position:relative;overflow:hidden;background-repeat:no-repeat;color:var(--granite-color-text-hint);line-height:inherit}.granite-chip-remove .granite-chip-remove-icon:hover{color:var(--granite-color-text)}.granite-chip-remove .granite-chip-remove-icon.granite-chip-remove-icon-invalid{color:var(--granite-color-signal-failure)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: GraniteIconComponent, selector: "granite-icon", inputs: ["fontIcon"] }] });
|
|
3084
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipComponent, decorators: [{
|
|
3085
|
-
type: Component,
|
|
3086
|
-
args: [{ selector: `granite-chip, granite-input-chip`, inputs: ['tabIndex'], exportAs: 'graniteChip', host: {
|
|
3087
|
-
class: 'granite-chip',
|
|
3088
|
-
'[class.granite-chip-input]': 'inputChip',
|
|
3089
|
-
'[class.granite-chip-selectable]': 'selectable',
|
|
3090
|
-
'[class.granite-chip-selected]': 'selected',
|
|
3091
|
-
'[class.granite-chip-disabled]': 'disabled',
|
|
3092
|
-
'[class.granite-chip-invalid]': 'invalid',
|
|
3093
|
-
'[class.granite-chip-removable]': '!disabled && (removable || inputChip)',
|
|
3094
|
-
'[attr.tabindex]': 'disabled ? null : tabIndex',
|
|
3095
|
-
'[attr.role]': 'role',
|
|
3096
|
-
'[attr.disabled]': 'disabled || null',
|
|
3097
|
-
'[attr.aria-label]': 'ariaLabel',
|
|
3098
|
-
'[attr.aria-labelledby]': 'ariaLabelledby',
|
|
3099
|
-
'[attr.aria-disabled]': 'disabled.toString()',
|
|
3100
|
-
'[attr.aria-selected]': 'ariaSelected',
|
|
3101
|
-
'(click)': '_handleClick($event)',
|
|
3102
|
-
'(keydown)': '_handleKeydown($event)',
|
|
3103
|
-
'(blur)': '_blur()',
|
|
3104
|
-
'(focus)': 'focus()',
|
|
3105
|
-
}, template: "<ng-content></ng-content>\n<button\n *ngIf=\"!disabled && (removable || inputChip)\"\n class=\"granite-chip-remove\"\n (click)=\"_handleRemoveClick($event)\"\n>\n <granite-icon\n fontIcon=\"icon-close\"\n class=\"granite-chip-remove-icon\"\n [class.granite-chip-remove-icon-invalid]=\"invalid\"\n ></granite-icon>\n</button>\n", styles: [":host.granite-chip{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;-webkit-user-select:none;user-select:none;position:relative;box-sizing:border-box;-webkit-tap-highlight-color:transparent;border:none;-webkit-appearance:none;-moz-appearance:none;justify-content:center;align-items:center;padding-inline:var(--granite-spacing-16);margin-inline-start:var(--granite-spacing-2);margin-inline-end:var(--granite-spacing-2);padding-top:var(--granite-spacing-8);padding-bottom:var(--granite-spacing-8);height:inherit;color:var(--granite-color-text-weak);background-color:var(--granite-color-background);border-radius:var(--granite-radius-l);border-style:solid;border-width:var(--granite-border-width-regular);border-color:var(--granite-color-border-hard)}:host.granite-chip:hover{background-color:var(--granite-color-background-hover);cursor:pointer}:host.granite-chip.granite-chip-disabled{background-color:var(--granite-color-background);color:var(--granite-color-text-hint)}:host.granite-chip.granite-chip-disabled:hover{background-color:var(--granite-color-background);cursor:auto}:host.granite-chip:not(.granite-chip-selectable):hover{background-color:var(--granite-color-background);cursor:auto}:host.granite-chip.granite-chip-removable{padding-inline-end:var(--granite-spacing-8)}:host.granite-chip.granite-chip-invalid{background-color:var(--granite-color-background-failure);border-color:var(--granite-color-background-failure)}:host.granite-chip.granite-chip-invalid:hover{border-color:var(--granite-color-signal-failure)}:host.granite-chip.granite-chip-selected:not(.granite-chip-disabled):not(.granite-chip-input){border-color:var(--granite-color-background-active);background-color:var(--granite-color-background-info)}:host.granite-chip.granite-chip-selected:not(.granite-chip-disabled):not(.granite-chip-input):hover{background-color:var(--granite-color-background-hover)}:host.granite-chip.granite-chip-input{padding-top:var(--granite-spacing-4);padding-bottom:var(--granite-spacing-4);padding-inline:var(--granite-spacing-8)}:host.granite-chip.granite-chip-input:hover{background-color:var(--granite-color-background-hover)}:host.granite-chip.granite-chip-input:hover.granite-chip-invalid{background-color:var(--granite-color-background-failure)}:host.granite-chip.granite-chip-input:hover.granite-chip-invalid:hover{border-color:var(--granite-color-signal-failure)}.granite-chip-remove{display:flex;justify-content:center;align-items:center;background-color:transparent;outline:none;border:none;cursor:pointer;margin-inline-start:var(--granite-spacing-4);margin-inline-end:0;padding:0}[dir=rtl] .granite-chip-remove{margin-inline-end:var(--granite-spacing-4);margin-inline-start:0}.granite-chip-remove .granite-chip-remove-icon{position:relative;overflow:hidden;background-repeat:no-repeat;color:var(--granite-color-text-hint);line-height:inherit}.granite-chip-remove .granite-chip-remove-icon:hover{color:var(--granite-color-text)}.granite-chip-remove .granite-chip-remove-icon.granite-chip-remove-icon-invalid{color:var(--granite-color-signal-failure)}\n"] }]
|
|
3106
|
-
}], ctorParameters: function () {
|
|
3107
|
-
return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
3108
|
-
type: Optional
|
|
3109
|
-
}] }, { type: undefined, decorators: [{
|
|
3110
|
-
type: Attribute,
|
|
3111
|
-
args: ['tabindex']
|
|
3112
|
-
}] }];
|
|
3113
|
-
}, propDecorators: { role: [{
|
|
3114
|
-
type: Input
|
|
3115
|
-
}], selected: [{
|
|
3116
|
-
type: Input
|
|
3117
|
-
}], value: [{
|
|
3118
|
-
type: Input
|
|
3119
|
-
}], selectable: [{
|
|
3120
|
-
type: Input
|
|
3121
|
-
}], disabled: [{
|
|
3122
|
-
type: Input
|
|
3123
|
-
}], removable: [{
|
|
3124
|
-
type: Input
|
|
3125
|
-
}], invalid: [{
|
|
3126
|
-
type: Input
|
|
3127
|
-
}], ariaLabel: [{
|
|
3128
|
-
type: Input,
|
|
3129
|
-
args: ['aria-label']
|
|
3130
|
-
}], ariaLabelledby: [{
|
|
3131
|
-
type: Input,
|
|
3132
|
-
args: ['aria-labelledby']
|
|
3133
|
-
}], selectionChange: [{
|
|
3134
|
-
type: Output
|
|
3135
|
-
}], removed: [{
|
|
3136
|
-
type: Output
|
|
3137
|
-
}], destroyed: [{
|
|
3138
|
-
type: Output
|
|
3139
|
-
}], chipFocus: [{
|
|
3140
|
-
type: Output
|
|
3141
|
-
}], chipBlur: [{
|
|
3142
|
-
type: Output
|
|
3143
|
-
}] } });
|
|
3144
|
-
|
|
3145
|
-
class GraniteChipListBase {
|
|
3146
|
-
constructor(_parentForm, _parentFormGroup, ngControl) {
|
|
3147
|
-
this._parentForm = _parentForm;
|
|
3148
|
-
this._parentFormGroup = _parentFormGroup;
|
|
3149
|
-
this.ngControl = ngControl;
|
|
3150
|
-
this.stateChanges = new EventEmitter();
|
|
3151
|
-
}
|
|
3152
|
-
}
|
|
3153
|
-
// Increasing integer for generating unique ids for chip-list components.
|
|
3154
|
-
let nextUniqueId$1 = 0;
|
|
3155
|
-
class GraniteChipListComponent extends GraniteChipListBase {
|
|
3156
|
-
/** The ARIA role applied to the chip list. */
|
|
3157
|
-
get role() {
|
|
3158
|
-
if (this._explicitRole) {
|
|
3159
|
-
return this._explicitRole;
|
|
3160
|
-
}
|
|
3161
|
-
return this.empty ? null : 'listbox';
|
|
3162
|
-
}
|
|
3163
|
-
set role(role) {
|
|
3164
|
-
this._explicitRole = role;
|
|
3165
|
-
}
|
|
3166
|
-
/** Whether the user should be allowed to select multiselect chips. */
|
|
3167
|
-
get multiselect() {
|
|
3168
|
-
return this._multiple;
|
|
3169
|
-
}
|
|
3170
|
-
set multiselect(value) {
|
|
3171
|
-
this._multiple = coerceBooleanProperty(value);
|
|
3172
|
-
this._syncChipsState();
|
|
3173
|
-
}
|
|
3174
|
-
/**
|
|
3175
|
-
* Whether the chip list is disabled.
|
|
3176
|
-
*/
|
|
3177
|
-
get disabled() {
|
|
3178
|
-
return this.ngControl ? !!this.ngControl.disabled : this._disabled;
|
|
3179
|
-
}
|
|
3180
|
-
set disabled(value) {
|
|
3181
|
-
this._disabled = coerceBooleanProperty(value);
|
|
3182
|
-
this._syncChipsState();
|
|
3183
|
-
}
|
|
3184
|
-
/**
|
|
3185
|
-
* Whether or not this chip list is selectable. When a chip list is not selectable,
|
|
3186
|
-
* the selected states for all the chips inside the chip list are always ignored.
|
|
3187
|
-
*/
|
|
3188
|
-
get selectable() {
|
|
3189
|
-
return this._selectable;
|
|
3190
|
-
}
|
|
3191
|
-
set selectable(value) {
|
|
3192
|
-
this._selectable = coerceBooleanProperty(value);
|
|
3193
|
-
if (this.chips) {
|
|
3194
|
-
this.chips.forEach((chip) => (chip._chipListSelectable = this._selectable));
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
set tabindex(value) {
|
|
3198
|
-
this._userTabIndex = value;
|
|
3199
|
-
this._tabIndex = value;
|
|
3200
|
-
}
|
|
3201
|
-
/** Unique identifier for the chip list. */
|
|
3202
|
-
get id() {
|
|
3203
|
-
return this._chipInput ? this._chipInput.id : this._uid;
|
|
3204
|
-
}
|
|
3205
|
-
/** Whether any chips or the matChipInput inside of this chip-list has focus. */
|
|
3206
|
-
get focused() {
|
|
3207
|
-
return ((this._chipInput && this._chipInput.focused) || this._hasFocusedChip());
|
|
3208
|
-
}
|
|
3209
|
-
/** Whether the chip list is empty. */
|
|
3210
|
-
get empty() {
|
|
3211
|
-
return ((!this._chipInput || this._chipInput.empty) &&
|
|
3212
|
-
(!this.chips || this.chips.length === 0));
|
|
3213
|
-
}
|
|
3214
|
-
/** The array of selected chips inside chip list. */
|
|
3215
|
-
get selected() {
|
|
3216
|
-
var _a, _b;
|
|
3217
|
-
return this.multiselect
|
|
3218
|
-
? ((_a = this._selectionModel) === null || _a === void 0 ? void 0 : _a.selected) || []
|
|
3219
|
-
: (_b = this._selectionModel) === null || _b === void 0 ? void 0 : _b.selected[0];
|
|
3220
|
-
}
|
|
3221
|
-
/** Combined stream of all of the child chips' selection change events. */
|
|
3222
|
-
get chipSelectionChanges() {
|
|
3223
|
-
return merge(...this.chips.map((chip) => chip.selectionChange));
|
|
3224
|
-
}
|
|
3225
|
-
/** Combined stream of all of the child chips' focus change events. */
|
|
3226
|
-
get chipFocusChanges() {
|
|
3227
|
-
return merge(...this.chips.map((chip) => chip.chipFocus));
|
|
3228
|
-
}
|
|
3229
|
-
/** Combined stream of all of the child chips' blur change events. */
|
|
3230
|
-
get chipBlurChanges() {
|
|
3231
|
-
return merge(...this.chips.map((chip) => chip.chipBlur));
|
|
3232
|
-
}
|
|
3233
|
-
/** Combined stream of all of the child chips' remove change events. */
|
|
3234
|
-
get chipRemoveChanges() {
|
|
3235
|
-
return merge(...this.chips.map((chip) => chip.destroyed));
|
|
3236
|
-
}
|
|
3237
|
-
constructor(_elementRef, _changeDetectorRef, _dir, _parentForm, _parentFormGroup, ngControl) {
|
|
3238
|
-
super(_parentForm, _parentFormGroup, ngControl);
|
|
3239
|
-
this._elementRef = _elementRef;
|
|
3240
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
3241
|
-
this._dir = _dir;
|
|
3242
|
-
this.controlType = 'granite-chip-list';
|
|
3243
|
-
/**
|
|
3244
|
-
* When a chip is destroyed, we store the index of the destroyed chip until the chips
|
|
3245
|
-
* query list notifies about the update. This is necessary because we cannot determine an
|
|
3246
|
-
* appropriate chip that should receive focus until the array of chips updated completely.
|
|
3247
|
-
*/
|
|
3248
|
-
this._lastDestroyedChipIndex = null;
|
|
3249
|
-
/** Subject that emits when the component has been destroyed. */
|
|
3250
|
-
this._destroyed = new Subject();
|
|
3251
|
-
/** Uid of the chip list */
|
|
3252
|
-
this._uid = `granite-chip-list-${nextUniqueId$1++}`;
|
|
3253
|
-
/** Tab index for the chip list. */
|
|
3254
|
-
this._tabIndex = 0;
|
|
3255
|
-
/**
|
|
3256
|
-
* User defined tab index.
|
|
3257
|
-
* When it is not null, use user defined tab index. Otherwise use _tabIndex
|
|
3258
|
-
*/
|
|
3259
|
-
this._userTabIndex = null;
|
|
3260
|
-
this._multiple = false;
|
|
3261
|
-
this._disabled = false;
|
|
3262
|
-
this._selectable = true;
|
|
3263
|
-
this.ariaLabel = null;
|
|
3264
|
-
this.ariaLabelledby = null;
|
|
3265
|
-
this.ariaOrientation = 'horizontal';
|
|
3266
|
-
/** Function when changed */
|
|
3267
|
-
this._onChange = () => {
|
|
3268
|
-
// Implemented as part of ControlValueAccessor
|
|
3269
|
-
};
|
|
3270
|
-
/** Function when changed */
|
|
3271
|
-
this._onTouched = () => {
|
|
3272
|
-
// Implemented as part of ControlValueAccessor
|
|
3273
|
-
};
|
|
3274
|
-
this._compareWith = (o1, o2) => o1 === o2;
|
|
3275
|
-
if (this.ngControl) {
|
|
3276
|
-
this.ngControl.valueAccessor = this;
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3279
|
-
ngAfterContentInit() {
|
|
3280
|
-
this._keyManager = new FocusKeyManager(this.chips)
|
|
3281
|
-
.withWrap()
|
|
3282
|
-
.withVerticalOrientation()
|
|
3283
|
-
.withHomeAndEnd()
|
|
3284
|
-
.withHorizontalOrientation(this._dir ? this._dir.value : 'ltr');
|
|
3285
|
-
if (this._dir) {
|
|
3286
|
-
this._dir.change
|
|
3287
|
-
.pipe(takeUntil(this._destroyed))
|
|
3288
|
-
.subscribe((dir) => this._keyManager.withHorizontalOrientation(dir));
|
|
3289
|
-
}
|
|
3290
|
-
this._keyManager.tabOut.pipe(takeUntil(this._destroyed)).subscribe(() => {
|
|
3291
|
-
this._allowFocusEscape();
|
|
3292
|
-
});
|
|
3293
|
-
// When the list changes, re-subscribe
|
|
3294
|
-
this.chips.changes
|
|
3295
|
-
.pipe(startWith(null), takeUntil(this._destroyed))
|
|
3296
|
-
.subscribe(() => {
|
|
3297
|
-
if (this.disabled) {
|
|
3298
|
-
// Since this happens after the content has been
|
|
3299
|
-
// checked, we need to defer it to the next tick.
|
|
3300
|
-
Promise.resolve().then(() => {
|
|
3301
|
-
this._syncChipsState();
|
|
3302
|
-
});
|
|
3303
|
-
}
|
|
3304
|
-
this._resetChips();
|
|
3305
|
-
// Reset chips selected/deselected status
|
|
3306
|
-
this._initializeSelection();
|
|
3307
|
-
// Check to see if we need to update our tab index
|
|
3308
|
-
this._updateTabIndex();
|
|
3309
|
-
// Check to see if we have a destroyed chip and need to refocus
|
|
3310
|
-
this._updateFocusForDestroyedChips();
|
|
3311
|
-
this.stateChanges.next();
|
|
3312
|
-
});
|
|
3313
|
-
}
|
|
3314
|
-
ngOnInit() {
|
|
3315
|
-
this._selectionModel = new SelectionModel(this.multiselect, undefined, false);
|
|
3316
|
-
this.stateChanges.next();
|
|
3317
|
-
}
|
|
3318
|
-
ngDoCheck() {
|
|
3319
|
-
if (this.ngControl) {
|
|
3320
|
-
// We need to re-evaluate this on every change detection cycle, because there are some
|
|
3321
|
-
// error triggers that we can't subscribe to (e.g. parent form submissions). This means
|
|
3322
|
-
// that whatever logic is in here has to be super lean or we risk destroying the performance.
|
|
3323
|
-
if (this.ngControl.disabled !== this._disabled) {
|
|
3324
|
-
this.disabled = !!this.ngControl.disabled;
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
ngOnDestroy() {
|
|
3329
|
-
this._destroyed.next();
|
|
3330
|
-
this._destroyed.complete();
|
|
3331
|
-
this.stateChanges.complete();
|
|
3332
|
-
this._dropSubscriptions();
|
|
3333
|
-
}
|
|
3334
|
-
/** Associates an HTML input element with this chip list. */
|
|
3335
|
-
registerInput(inputElement) {
|
|
3336
|
-
this._chipInput = inputElement;
|
|
3337
|
-
// We use this attribute to match the chip list to its input in test harnesses.
|
|
3338
|
-
// Set the attribute directly here to avoid "changed after checked" errors.
|
|
3339
|
-
this._elementRef.nativeElement.setAttribute('data-granite-chip-input', inputElement.id);
|
|
3340
|
-
}
|
|
3341
|
-
// Implemented as part of ControlValueAccessor.
|
|
3342
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
3343
|
-
writeValue(value) {
|
|
3344
|
-
if (this.chips) {
|
|
3345
|
-
this._setSelectionByValue(value, false);
|
|
3346
|
-
}
|
|
3347
|
-
}
|
|
3348
|
-
// Implemented as part of ControlValueAccessor.
|
|
3349
|
-
registerOnChange(fn) {
|
|
3350
|
-
this._onChange = fn;
|
|
3351
|
-
}
|
|
3352
|
-
// Implemented as part of ControlValueAccessor.
|
|
3353
|
-
registerOnTouched(fn) {
|
|
3354
|
-
this._onTouched = fn;
|
|
3355
|
-
}
|
|
3356
|
-
// Implemented as part of ControlValueAccessor.
|
|
3357
|
-
setDisabledState(isDisabled) {
|
|
3358
|
-
this.disabled = isDisabled;
|
|
3359
|
-
this.stateChanges.next();
|
|
3360
|
-
}
|
|
3361
|
-
/**
|
|
3362
|
-
* Focus chip list when click on the container.
|
|
3363
|
-
*/
|
|
3364
|
-
onContainerClick(event) {
|
|
3365
|
-
if (!this._originatesFromChip(event)) {
|
|
3366
|
-
this.focus();
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
/**
|
|
3370
|
-
* Focuses the first non-disabled chip in this chip list, or the associated input when there
|
|
3371
|
-
* are no eligible chips.
|
|
3372
|
-
*/
|
|
3373
|
-
focus(options) {
|
|
3374
|
-
if (this.disabled) {
|
|
3375
|
-
return;
|
|
3376
|
-
}
|
|
3377
|
-
// Focus on first element if there's no chipInput inside chip-list
|
|
3378
|
-
if (this._chipInput && this._chipInput.focused) {
|
|
3379
|
-
// do nothing
|
|
3380
|
-
}
|
|
3381
|
-
else if (this.chips.length > 0) {
|
|
3382
|
-
this._keyManager.setFirstItemActive();
|
|
3383
|
-
this.stateChanges.next();
|
|
3384
|
-
}
|
|
3385
|
-
else {
|
|
3386
|
-
this._focusInput(options);
|
|
3387
|
-
this.stateChanges.next();
|
|
3388
|
-
}
|
|
3389
|
-
}
|
|
3390
|
-
/** Attempt to focus an input if we have one. */
|
|
3391
|
-
_focusInput(options) {
|
|
3392
|
-
if (this._chipInput) {
|
|
3393
|
-
this._chipInput.setFocus(options);
|
|
3394
|
-
}
|
|
3395
|
-
}
|
|
3396
|
-
/**
|
|
3397
|
-
* Pass events to the keyboard manager. Available here for tests.
|
|
3398
|
-
*/
|
|
3399
|
-
_keydown(event) {
|
|
3400
|
-
const target = event.target;
|
|
3401
|
-
if (target && target.classList.contains('granite-chip')) {
|
|
3402
|
-
this._keyManager.onKeydown(event);
|
|
3403
|
-
this.stateChanges.next();
|
|
3404
|
-
}
|
|
3405
|
-
}
|
|
3406
|
-
/**
|
|
3407
|
-
* Check the tab index as you should not be allowed to focus an empty list.
|
|
3408
|
-
*/
|
|
3409
|
-
_updateTabIndex() {
|
|
3410
|
-
// If we have 0 chips, we should not allow keyboard focus
|
|
3411
|
-
this._tabIndex = this._userTabIndex || (this.chips.length === 0 ? -1 : 0);
|
|
3412
|
-
}
|
|
3413
|
-
/**
|
|
3414
|
-
* If the amount of chips changed, we need to update the
|
|
3415
|
-
* key manager state and focus the next closest chip.
|
|
3416
|
-
*/
|
|
3417
|
-
_updateFocusForDestroyedChips() {
|
|
3418
|
-
// Move focus to the closest chip. If no other chips remain, focus the chip-list itself.
|
|
3419
|
-
if (this._lastDestroyedChipIndex != null) {
|
|
3420
|
-
if (this.chips.length) {
|
|
3421
|
-
const newChipIndex = Math.min(this._lastDestroyedChipIndex, this.chips.length - 1);
|
|
3422
|
-
this._keyManager.setActiveItem(newChipIndex);
|
|
3423
|
-
}
|
|
3424
|
-
else {
|
|
3425
|
-
this.focus();
|
|
3426
|
-
}
|
|
3427
|
-
}
|
|
3428
|
-
this._lastDestroyedChipIndex = null;
|
|
3429
|
-
}
|
|
3430
|
-
/**
|
|
3431
|
-
* Utility to ensure all indexes are valid.
|
|
3432
|
-
*
|
|
3433
|
-
* @param index The index to be checked.
|
|
3434
|
-
* @returns True if the index is valid for our list of chips.
|
|
3435
|
-
*/
|
|
3436
|
-
_isValidIndex(index) {
|
|
3437
|
-
return index >= 0 && index < this.chips.length;
|
|
3438
|
-
}
|
|
3439
|
-
_setSelectionByValue(value, isUserInput = true) {
|
|
3440
|
-
this._clearSelection();
|
|
3441
|
-
this.chips.forEach((chip) => chip.deselect());
|
|
3442
|
-
if (Array.isArray(value)) {
|
|
3443
|
-
value.forEach((currentValue) => this._selectValue(currentValue, isUserInput));
|
|
3444
|
-
this._sortValues();
|
|
3445
|
-
}
|
|
3446
|
-
else {
|
|
3447
|
-
const correspondingChip = this._selectValue(value, isUserInput);
|
|
3448
|
-
// Shift focus to the active item. Note that we shouldn't do this in multiselect
|
|
3449
|
-
// mode, because we don't know what chip the user interacted with last.
|
|
3450
|
-
if (correspondingChip) {
|
|
3451
|
-
if (isUserInput) {
|
|
3452
|
-
this._keyManager.setActiveItem(correspondingChip);
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
}
|
|
3456
|
-
}
|
|
3457
|
-
/**
|
|
3458
|
-
* Finds and selects the chip based on its value.
|
|
3459
|
-
* @returns Chip that has the corresponding value.
|
|
3460
|
-
*/
|
|
3461
|
-
_selectValue(value, isUserInput = true) {
|
|
3462
|
-
const correspondingChip = this.chips.find((chip) => {
|
|
3463
|
-
return chip.value != null && this._compareWith(chip.value, value);
|
|
3464
|
-
});
|
|
3465
|
-
if (correspondingChip) {
|
|
3466
|
-
correspondingChip.select(isUserInput);
|
|
3467
|
-
this._selectionModel.select(correspondingChip);
|
|
3468
|
-
}
|
|
3469
|
-
return correspondingChip;
|
|
3470
|
-
}
|
|
3471
|
-
_initializeSelection() {
|
|
3472
|
-
// Defer setting the value in order to avoid the "Expression
|
|
3473
|
-
// has changed after it was checked" errors from Angular.
|
|
3474
|
-
Promise.resolve().then(() => {
|
|
3475
|
-
if (this.ngControl) {
|
|
3476
|
-
this._setSelectionByValue(this.ngControl.value, false);
|
|
3477
|
-
this.stateChanges.next();
|
|
3478
|
-
}
|
|
3479
|
-
});
|
|
3480
|
-
}
|
|
3481
|
-
/**
|
|
3482
|
-
* Deselects every chip in the list.
|
|
3483
|
-
* @param skip Chip that should not be deselected.
|
|
3484
|
-
*/
|
|
3485
|
-
_clearSelection(skip) {
|
|
3486
|
-
this._selectionModel.clear();
|
|
3487
|
-
this.chips.forEach((chip) => {
|
|
3488
|
-
if (chip !== skip) {
|
|
3489
|
-
chip.deselect();
|
|
3490
|
-
}
|
|
3491
|
-
});
|
|
3492
|
-
this.stateChanges.next();
|
|
3493
|
-
}
|
|
3494
|
-
/**
|
|
3495
|
-
* Sorts the model values, ensuring that they keep the same
|
|
3496
|
-
* order that they have in the panel.
|
|
3497
|
-
*/
|
|
3498
|
-
_sortValues() {
|
|
3499
|
-
if (this._multiple) {
|
|
3500
|
-
this._selectionModel.clear();
|
|
3501
|
-
this.chips.forEach((chip) => {
|
|
3502
|
-
if (chip.selected) {
|
|
3503
|
-
this._selectionModel.select(chip);
|
|
3504
|
-
}
|
|
3505
|
-
});
|
|
3506
|
-
this.stateChanges.next();
|
|
3507
|
-
}
|
|
3508
|
-
}
|
|
3509
|
-
/** When blurred, mark the field as touched when focus moved outside the chip list. */
|
|
3510
|
-
_blur() {
|
|
3511
|
-
if (!this._hasFocusedChip()) {
|
|
3512
|
-
this._keyManager.setActiveItem(-1);
|
|
3513
|
-
}
|
|
3514
|
-
if (!this.disabled) {
|
|
3515
|
-
if (this._chipInput) {
|
|
3516
|
-
// If there's a chip input, we should check whether the focus moved to chip input.
|
|
3517
|
-
// If the focus is not moved to chip input, mark the field as touched. If the focus moved
|
|
3518
|
-
// to chip input, do nothing.
|
|
3519
|
-
// Timeout is needed to wait for the focus() event trigger on chip input.
|
|
3520
|
-
setTimeout(() => {
|
|
3521
|
-
if (!this.focused) {
|
|
3522
|
-
this._markAsTouched();
|
|
3523
|
-
}
|
|
3524
|
-
});
|
|
3525
|
-
}
|
|
3526
|
-
else {
|
|
3527
|
-
// If there's no chip input, then mark the field as touched.
|
|
3528
|
-
this._markAsTouched();
|
|
3529
|
-
}
|
|
3530
|
-
}
|
|
3531
|
-
}
|
|
3532
|
-
/** Mark the field as touched */
|
|
3533
|
-
_markAsTouched() {
|
|
3534
|
-
this._onTouched();
|
|
3535
|
-
this._changeDetectorRef.markForCheck();
|
|
3536
|
-
this.stateChanges.next();
|
|
3537
|
-
}
|
|
3538
|
-
/**
|
|
3539
|
-
* Removes the `tabindex` from the chip list and resets it back afterwards, allowing the
|
|
3540
|
-
* user to tab out of it. This prevents the list from capturing focus and redirecting
|
|
3541
|
-
* it back to the first chip, creating a focus trap, if it user tries to tab away.
|
|
3542
|
-
*/
|
|
3543
|
-
_allowFocusEscape() {
|
|
3544
|
-
if (this._tabIndex !== -1) {
|
|
3545
|
-
this._tabIndex = -1;
|
|
3546
|
-
setTimeout(() => {
|
|
3547
|
-
this._tabIndex = this._userTabIndex || 0;
|
|
3548
|
-
this._changeDetectorRef.markForCheck();
|
|
3549
|
-
});
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
_resetChips() {
|
|
3553
|
-
this._dropSubscriptions();
|
|
3554
|
-
this._listenToChipsFocus();
|
|
3555
|
-
this._listenToChipsSelection();
|
|
3556
|
-
this._listenToChipsRemoved();
|
|
3557
|
-
}
|
|
3558
|
-
_dropSubscriptions() {
|
|
3559
|
-
if (this._chipFocusSubscription) {
|
|
3560
|
-
this._chipFocusSubscription.unsubscribe();
|
|
3561
|
-
this._chipFocusSubscription = null;
|
|
3562
|
-
}
|
|
3563
|
-
if (this._chipBlurSubscription) {
|
|
3564
|
-
this._chipBlurSubscription.unsubscribe();
|
|
3565
|
-
this._chipBlurSubscription = null;
|
|
3566
|
-
}
|
|
3567
|
-
if (this._chipSelectionSubscription) {
|
|
3568
|
-
this._chipSelectionSubscription.unsubscribe();
|
|
3569
|
-
this._chipSelectionSubscription = null;
|
|
3570
|
-
}
|
|
3571
|
-
if (this._chipRemoveSubscription) {
|
|
3572
|
-
this._chipRemoveSubscription.unsubscribe();
|
|
3573
|
-
this._chipRemoveSubscription = null;
|
|
3574
|
-
}
|
|
3575
|
-
}
|
|
3576
|
-
/** Listens to user-generated selection events on each chip. */
|
|
3577
|
-
_listenToChipsSelection() {
|
|
3578
|
-
this._chipSelectionSubscription = this.chipSelectionChanges.subscribe((event) => {
|
|
3579
|
-
event.source.selected
|
|
3580
|
-
? this._selectionModel.select(event.source)
|
|
3581
|
-
: this._selectionModel.deselect(event.source);
|
|
3582
|
-
// For single selection chip list, make sure the deselected value is unselected.
|
|
3583
|
-
if (!this.multiselect) {
|
|
3584
|
-
this.chips.forEach((chip) => {
|
|
3585
|
-
if (!this._selectionModel.isSelected(chip) && chip.selected) {
|
|
3586
|
-
chip.deselect();
|
|
3587
|
-
}
|
|
3588
|
-
});
|
|
3589
|
-
}
|
|
3590
|
-
});
|
|
3591
|
-
}
|
|
3592
|
-
/** Listens to user-generated selection events on each chip. */
|
|
3593
|
-
_listenToChipsFocus() {
|
|
3594
|
-
this._chipFocusSubscription = this.chipFocusChanges.subscribe((event) => {
|
|
3595
|
-
const chipIndex = this.chips.toArray().indexOf(event.chip);
|
|
3596
|
-
if (this._isValidIndex(chipIndex)) {
|
|
3597
|
-
this._keyManager.updateActiveItem(chipIndex);
|
|
3598
|
-
}
|
|
3599
|
-
this.stateChanges.next();
|
|
3600
|
-
});
|
|
3601
|
-
this._chipBlurSubscription = this.chipBlurChanges.subscribe(() => {
|
|
3602
|
-
this._blur();
|
|
3603
|
-
this.stateChanges.next();
|
|
3604
|
-
});
|
|
3605
|
-
}
|
|
3606
|
-
_listenToChipsRemoved() {
|
|
3607
|
-
this._chipRemoveSubscription = this.chipRemoveChanges.subscribe((event) => {
|
|
3608
|
-
const chip = event.chip;
|
|
3609
|
-
const chipIndex = this.chips.toArray().indexOf(event.chip);
|
|
3610
|
-
// In case the chip that will be removed is currently focused, we temporarily store
|
|
3611
|
-
// the index in order to be able to determine an appropriate sibling chip that will
|
|
3612
|
-
// receive focus.
|
|
3613
|
-
if (this._isValidIndex(chipIndex) && chip._hasFocus) {
|
|
3614
|
-
this._lastDestroyedChipIndex = chipIndex;
|
|
3615
|
-
}
|
|
3616
|
-
});
|
|
3617
|
-
}
|
|
3618
|
-
/** Checks whether an event comes from inside a chip element. */
|
|
3619
|
-
_originatesFromChip(event) {
|
|
3620
|
-
let currentElement = event.target;
|
|
3621
|
-
while (currentElement &&
|
|
3622
|
-
currentElement !== this._elementRef.nativeElement) {
|
|
3623
|
-
if (currentElement.classList.contains('granite-chip')) {
|
|
3624
|
-
return true;
|
|
3625
|
-
}
|
|
3626
|
-
currentElement = currentElement.parentElement;
|
|
3627
|
-
}
|
|
3628
|
-
return false;
|
|
3629
|
-
}
|
|
3630
|
-
/** Checks whether any of the chips is focused. */
|
|
3631
|
-
_hasFocusedChip() {
|
|
3632
|
-
return this.chips && this.chips.some((chip) => chip._hasFocus);
|
|
3633
|
-
}
|
|
3634
|
-
/** Syncs the list's state with the individual chips. */
|
|
3635
|
-
_syncChipsState() {
|
|
3636
|
-
if (this.chips) {
|
|
3637
|
-
this.chips.forEach((chip) => {
|
|
3638
|
-
chip._chipListDisabled = this._disabled;
|
|
3639
|
-
chip._chipListMultiple = this.multiselect;
|
|
3640
|
-
});
|
|
3641
|
-
}
|
|
3642
|
-
}
|
|
3643
|
-
}
|
|
3644
|
-
GraniteChipListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i3.Directionality, optional: true }, { token: i2$1.NgForm, optional: true }, { token: i2$1.FormGroupDirective, optional: true }, { token: i2$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
3645
|
-
GraniteChipListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteChipListComponent, selector: "granite-chip-list", inputs: { role: "role", multiselect: "multiselect", disabled: "disabled", selectable: "selectable", tabindex: "tabindex", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaOrientation: ["aria-orientation", "ariaOrientation"] }, host: { listeners: { "focus": "focus()", "blur": "_blur()", "keydown": "_keydown($event)" }, properties: { "class.granite-chip-list-disabled": "disabled", "attr.tabindex": "disabled ? null : _tabIndex", "attr.role": "role", "attr.aria-label": "ariaLabel", "attr.aria-labelledby": "ariaLabelledby", "attr.aria-disabled": "disabled.toString()", "attr.aria-multiselectable": "multiselect", "attr.aria-orientation": "ariaOrientation", "id": "_uid" }, classAttribute: "granite-chip-list" }, queries: [{ propertyName: "chips", predicate: GraniteChipComponent, descendants: true }], exportAs: ["graniteChipList"], usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [".granite-chip-list{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;align-content:center;font-weight:400;font-size:var(--granite-font-size-body-small);line-height:var(--granite-line-height-regular);overflow:auto;padding:0;margin:0}input.granite-chip-input{outline:none;border:none;background-color:transparent;color:var(--granite-color-text);margin:var(--granite-spacing-4)}granite-icon{color:var(--granite-color-text);background-color:transparent}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3646
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipListComponent, decorators: [{
|
|
3647
|
-
type: Component,
|
|
3648
|
-
args: [{ selector: 'granite-chip-list', template: `<ng-content></ng-content>`, exportAs: 'graniteChipList', host: {
|
|
3649
|
-
class: 'granite-chip-list',
|
|
3650
|
-
'[class.granite-chip-list-disabled]': 'disabled',
|
|
3651
|
-
'[attr.tabindex]': 'disabled ? null : _tabIndex',
|
|
3652
|
-
'[attr.role]': 'role',
|
|
3653
|
-
'[attr.aria-label]': 'ariaLabel',
|
|
3654
|
-
'[attr.aria-labelledby]': 'ariaLabelledby',
|
|
3655
|
-
'[attr.aria-disabled]': 'disabled.toString()',
|
|
3656
|
-
'[attr.aria-multiselectable]': 'multiselect',
|
|
3657
|
-
'[attr.aria-orientation]': 'ariaOrientation',
|
|
3658
|
-
'[id]': '_uid',
|
|
3659
|
-
'(focus)': 'focus()',
|
|
3660
|
-
'(blur)': '_blur()',
|
|
3661
|
-
'(keydown)': '_keydown($event)',
|
|
3662
|
-
}, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".granite-chip-list{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start;align-items:center;align-content:center;font-weight:400;font-size:var(--granite-font-size-body-small);line-height:var(--granite-line-height-regular);overflow:auto;padding:0;margin:0}input.granite-chip-input{outline:none;border:none;background-color:transparent;color:var(--granite-color-text);margin:var(--granite-spacing-4)}granite-icon{color:var(--granite-color-text);background-color:transparent}\n"] }]
|
|
3663
|
-
}], ctorParameters: function () {
|
|
3664
|
-
return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i3.Directionality, decorators: [{
|
|
3665
|
-
type: Optional
|
|
3666
|
-
}] }, { type: i2$1.NgForm, decorators: [{
|
|
3667
|
-
type: Optional
|
|
3668
|
-
}] }, { type: i2$1.FormGroupDirective, decorators: [{
|
|
3669
|
-
type: Optional
|
|
3670
|
-
}] }, { type: i2$1.NgControl, decorators: [{
|
|
3671
|
-
type: Optional
|
|
3672
|
-
}, {
|
|
3673
|
-
type: Self
|
|
3674
|
-
}] }];
|
|
3675
|
-
}, propDecorators: { role: [{
|
|
3676
|
-
type: Input
|
|
3677
|
-
}], multiselect: [{
|
|
3678
|
-
type: Input
|
|
3679
|
-
}], disabled: [{
|
|
3680
|
-
type: Input
|
|
3681
|
-
}], selectable: [{
|
|
3682
|
-
type: Input
|
|
3683
|
-
}], tabindex: [{
|
|
3684
|
-
type: Input
|
|
3685
|
-
}], ariaLabel: [{
|
|
3686
|
-
type: Input,
|
|
3687
|
-
args: ['aria-label']
|
|
3688
|
-
}], ariaLabelledby: [{
|
|
3689
|
-
type: Input,
|
|
3690
|
-
args: ['aria-labelledby']
|
|
3691
|
-
}], ariaOrientation: [{
|
|
3692
|
-
type: Input,
|
|
3693
|
-
args: ['aria-orientation']
|
|
3694
|
-
}], chips: [{
|
|
3695
|
-
type: ContentChildren,
|
|
3696
|
-
args: [GraniteChipComponent, {
|
|
3697
|
-
// We need to use `descendants: true`, because Ivy will no longer match
|
|
3698
|
-
// indirect descendants if it's left as false.
|
|
3699
|
-
descendants: true,
|
|
3700
|
-
}]
|
|
3701
|
-
}] } });
|
|
3702
|
-
|
|
3703
|
-
let nextUniqueId = 0;
|
|
3704
|
-
class GraniteChipInputDirective {
|
|
3705
|
-
/** Register input for chip list */
|
|
3706
|
-
set graniteChipInputFor(value) {
|
|
3707
|
-
if (value) {
|
|
3708
|
-
this._chipList = value;
|
|
3709
|
-
this._chipList.registerInput(this);
|
|
3710
|
-
}
|
|
3711
|
-
}
|
|
3712
|
-
/**
|
|
3713
|
-
* Whether or not the chipEnd event will be emitted when the input is blurred.
|
|
3714
|
-
*/
|
|
3715
|
-
get graniteChipInputAddOnBlur() {
|
|
3716
|
-
return this._addOnBlur;
|
|
3717
|
-
}
|
|
3718
|
-
set graniteChipInputAddOnBlur(value) {
|
|
3719
|
-
this._addOnBlur = coerceBooleanProperty(value);
|
|
3720
|
-
}
|
|
3721
|
-
/**
|
|
3722
|
-
* Whether this is a required field, currently we use it only for setting aria-required.
|
|
3723
|
-
*/
|
|
3724
|
-
get required() {
|
|
3725
|
-
return this._required;
|
|
3726
|
-
}
|
|
3727
|
-
set required(value) {
|
|
3728
|
-
this._required = coerceBooleanProperty(value);
|
|
3729
|
-
}
|
|
3730
|
-
/** Whether the input is disabled. */
|
|
3731
|
-
get disabled() {
|
|
3732
|
-
return this._disabled || (this._chipList && this._chipList.disabled);
|
|
3733
|
-
}
|
|
3734
|
-
set disabled(value) {
|
|
3735
|
-
this._disabled = coerceBooleanProperty(value);
|
|
3736
|
-
}
|
|
3737
|
-
constructor(_elementRef) {
|
|
3738
|
-
this._elementRef = _elementRef;
|
|
3739
|
-
/** Unique id for the input. */
|
|
3740
|
-
this.id = `granite-chip-list-input-${nextUniqueId++}`;
|
|
3741
|
-
/** The input's placeholder text. */
|
|
3742
|
-
this.placeholder = '';
|
|
3743
|
-
/**
|
|
3744
|
-
* The list of key codes that will trigger a chipEnd event.
|
|
3745
|
-
*
|
|
3746
|
-
* Defaults to `[ENTER]`.
|
|
3747
|
-
*/
|
|
3748
|
-
this.graniteChipInputSeparatorKeyCodes = [
|
|
3749
|
-
ENTER,
|
|
3750
|
-
];
|
|
3751
|
-
this._addOnBlur = true;
|
|
3752
|
-
this._disabled = false;
|
|
3753
|
-
/** Emitted when a chip is to be added. */
|
|
3754
|
-
this.graniteChipInputTokenEnd = new EventEmitter();
|
|
3755
|
-
this.focused = false;
|
|
3756
|
-
this.inputElement = this._elementRef.nativeElement;
|
|
3757
|
-
}
|
|
3758
|
-
ngOnChanges() {
|
|
3759
|
-
this._chipList.stateChanges.next();
|
|
3760
|
-
}
|
|
3761
|
-
ngOnDestroy() {
|
|
3762
|
-
this.graniteChipInputTokenEnd.complete();
|
|
3763
|
-
}
|
|
3764
|
-
ngAfterContentInit() {
|
|
3765
|
-
this._focusLastChipOnBackspace = this.empty;
|
|
3766
|
-
}
|
|
3767
|
-
/** Utility method to make host definition/tests more clear. */
|
|
3768
|
-
_keydown(event) {
|
|
3769
|
-
if (event) {
|
|
3770
|
-
// Allow the user's focus to escape when they're tabbing forward. Note that we don't
|
|
3771
|
-
// want to do this when going backwards, because focus should go back to the first chip.
|
|
3772
|
-
if (event.keyCode === TAB && !hasModifierKey(event, 'shiftKey')) {
|
|
3773
|
-
this._chipList._allowFocusEscape();
|
|
3774
|
-
}
|
|
3775
|
-
// To prevent the user from accidentally deleting chips when pressing BACKSPACE continuously,
|
|
3776
|
-
// We focus the last chip on backspace only after the user has released the backspace button,
|
|
3777
|
-
// and the input is empty (see behaviour in _keyup)
|
|
3778
|
-
if (event.keyCode === BACKSPACE && this._focusLastChipOnBackspace) {
|
|
3779
|
-
this._chipList._keyManager.setLastItemActive();
|
|
3780
|
-
event.preventDefault();
|
|
3781
|
-
return;
|
|
3782
|
-
}
|
|
3783
|
-
else {
|
|
3784
|
-
this._focusLastChipOnBackspace = false;
|
|
3785
|
-
}
|
|
3786
|
-
}
|
|
3787
|
-
this._emitChipEnd(event);
|
|
3788
|
-
}
|
|
3789
|
-
/**
|
|
3790
|
-
* Pass events to the keyboard manager. Available here for tests.
|
|
3791
|
-
*/
|
|
3792
|
-
_keyup(event) {
|
|
3793
|
-
// Allow user to move focus to chips next time he presses backspace
|
|
3794
|
-
if (!this._focusLastChipOnBackspace &&
|
|
3795
|
-
event.keyCode === BACKSPACE &&
|
|
3796
|
-
this.empty) {
|
|
3797
|
-
this._focusLastChipOnBackspace = true;
|
|
3798
|
-
event.preventDefault();
|
|
3799
|
-
}
|
|
3800
|
-
}
|
|
3801
|
-
/** Checks to see if the blur should emit the (chipEnd) event. */
|
|
3802
|
-
_blur() {
|
|
3803
|
-
if (this.graniteChipInputAddOnBlur) {
|
|
3804
|
-
this._emitChipEnd();
|
|
3805
|
-
}
|
|
3806
|
-
this.focused = false;
|
|
3807
|
-
// Blur the chip list if it is not focused
|
|
3808
|
-
if (!this._chipList.focused) {
|
|
3809
|
-
this._chipList._blur();
|
|
3810
|
-
}
|
|
3811
|
-
this._chipList.stateChanges.next();
|
|
3812
|
-
}
|
|
3813
|
-
_focus() {
|
|
3814
|
-
this.focused = true;
|
|
3815
|
-
this._focusLastChipOnBackspace = this.empty;
|
|
3816
|
-
this._chipList.stateChanges.next();
|
|
3817
|
-
}
|
|
3818
|
-
/** Checks to see if the (chipEnd) event needs to be emitted. */
|
|
3819
|
-
_emitChipEnd(event) {
|
|
3820
|
-
if (!this.inputElement.value && !!event) {
|
|
3821
|
-
this._chipList._keydown(event);
|
|
3822
|
-
}
|
|
3823
|
-
if (!event || this._isSeparatorKey(event)) {
|
|
3824
|
-
this.graniteChipInputTokenEnd.emit({
|
|
3825
|
-
input: this.inputElement,
|
|
3826
|
-
value: this.inputElement.value,
|
|
3827
|
-
chipInput: this,
|
|
3828
|
-
});
|
|
3829
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
_onInput() {
|
|
3833
|
-
// Let chip list know whenever the value changes.
|
|
3834
|
-
this._chipList.stateChanges.next();
|
|
3835
|
-
}
|
|
3836
|
-
/** Focuses the input (called from parent level). */
|
|
3837
|
-
setFocus(options) {
|
|
3838
|
-
this.inputElement.focus(options);
|
|
3839
|
-
}
|
|
3840
|
-
/** Clears the input */
|
|
3841
|
-
clear() {
|
|
3842
|
-
this.inputElement.value = '';
|
|
3843
|
-
this._focusLastChipOnBackspace = true;
|
|
3844
|
-
}
|
|
3845
|
-
/** Whether the input is empty. */
|
|
3846
|
-
get empty() {
|
|
3847
|
-
return !this.inputElement.value;
|
|
3848
|
-
}
|
|
3849
|
-
/** Checks whether a keycode is one of the configured separators. */
|
|
3850
|
-
_isSeparatorKey(event) {
|
|
3851
|
-
return (!hasModifierKey(event) &&
|
|
3852
|
-
new Set(this.graniteChipInputSeparatorKeyCodes).has(event.keyCode));
|
|
3853
|
-
}
|
|
3854
|
-
}
|
|
3855
|
-
GraniteChipInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipInputDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3856
|
-
GraniteChipInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: GraniteChipInputDirective, selector: "input[graniteChipInputFor]", inputs: { id: "id", placeholder: "placeholder", graniteChipInputFor: "graniteChipInputFor", graniteChipInputSeparatorKeyCodes: "graniteChipInputSeparatorKeyCodes", graniteChipInputAddOnBlur: "graniteChipInputAddOnBlur", required: "required", disabled: "disabled" }, outputs: { graniteChipInputTokenEnd: "graniteChipInputTokenEnd" }, host: { listeners: { "keydown": "_keydown($event)", "keyup": "_keyup($event)", "blur": "_blur()", "focus": "_focus()", "input": "_onInput()" }, properties: { "id": "id", "attr.disabled": "disabled || null", "attr.placeholder": "placeholder || null", "attr.aria-required": "required || null" }, classAttribute: "granite-chip-input" }, exportAs: ["graniteChipInput", "graniteChipInputFor"], usesOnChanges: true, ngImport: i0 });
|
|
3857
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipInputDirective, decorators: [{
|
|
3858
|
-
type: Directive,
|
|
3859
|
-
args: [{
|
|
3860
|
-
selector: 'input[graniteChipInputFor]',
|
|
3861
|
-
exportAs: 'graniteChipInput, graniteChipInputFor',
|
|
3862
|
-
host: {
|
|
3863
|
-
class: 'granite-chip-input',
|
|
3864
|
-
'[id]': 'id',
|
|
3865
|
-
'[attr.disabled]': 'disabled || null',
|
|
3866
|
-
'[attr.placeholder]': 'placeholder || null',
|
|
3867
|
-
'[attr.aria-required]': 'required || null',
|
|
3868
|
-
'(keydown)': '_keydown($event)',
|
|
3869
|
-
'(keyup)': '_keyup($event)',
|
|
3870
|
-
'(blur)': '_blur()',
|
|
3871
|
-
'(focus)': '_focus()',
|
|
3872
|
-
'(input)': '_onInput()',
|
|
3873
|
-
},
|
|
3874
|
-
}]
|
|
3875
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { id: [{
|
|
3876
|
-
type: Input
|
|
3877
|
-
}], placeholder: [{
|
|
3878
|
-
type: Input
|
|
3879
|
-
}], graniteChipInputFor: [{
|
|
3880
|
-
type: Input
|
|
3881
|
-
}], graniteChipInputSeparatorKeyCodes: [{
|
|
3882
|
-
type: Input
|
|
3883
|
-
}], graniteChipInputAddOnBlur: [{
|
|
3884
|
-
type: Input
|
|
3885
|
-
}], required: [{
|
|
3886
|
-
type: Input
|
|
3887
|
-
}], disabled: [{
|
|
3888
|
-
type: Input
|
|
3889
|
-
}], graniteChipInputTokenEnd: [{
|
|
3890
|
-
type: Output
|
|
3891
|
-
}] } });
|
|
3892
|
-
|
|
3893
|
-
const CHIP_DECLARATIONS = [
|
|
3894
|
-
GraniteChipListComponent,
|
|
3895
|
-
GraniteChipComponent,
|
|
3896
|
-
GraniteChipInputDirective,
|
|
3897
|
-
];
|
|
3898
|
-
class GraniteChipsModule {
|
|
3899
|
-
}
|
|
3900
|
-
GraniteChipsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3901
|
-
GraniteChipsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipsModule, declarations: [GraniteChipListComponent,
|
|
3902
|
-
GraniteChipComponent,
|
|
3903
|
-
GraniteChipInputDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, GraniteIconModule], exports: [GraniteChipListComponent,
|
|
3904
|
-
GraniteChipComponent,
|
|
3905
|
-
GraniteChipInputDirective] });
|
|
3906
|
-
GraniteChipsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipsModule, imports: [CommonModule, FormsModule, ReactiveFormsModule, GraniteIconModule] });
|
|
3907
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteChipsModule, decorators: [{
|
|
3908
|
-
type: NgModule,
|
|
3909
|
-
args: [{
|
|
3910
|
-
imports: [CommonModule, FormsModule, ReactiveFormsModule, GraniteIconModule],
|
|
3911
|
-
declarations: CHIP_DECLARATIONS,
|
|
3912
|
-
exports: CHIP_DECLARATIONS,
|
|
3913
|
-
}]
|
|
3914
|
-
}] });
|
|
3915
|
-
|
|
3916
|
-
class GraniteLabelComponent {
|
|
3917
|
-
constructor() {
|
|
3918
|
-
this.for = null;
|
|
3919
|
-
this.form = null;
|
|
3920
|
-
this.required = false;
|
|
3921
|
-
}
|
|
3922
|
-
ngOnChanges(changes) {
|
|
3923
|
-
if (changes.required) {
|
|
3924
|
-
this.required = coerceBooleanProperty(changes.required.currentValue);
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
}
|
|
3928
|
-
GraniteLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3929
|
-
GraniteLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GraniteLabelComponent, selector: "granite-label", inputs: { for: "for", form: "form", required: "required" }, host: { classAttribute: "granite-label" }, exportAs: ["graniteLabel"], usesOnChanges: true, ngImport: i0, template: "<label [attr.for]=\"for\" [attr.form]=\"form\">\n <i *ngIf=\"required\" aria-label=\"required\">*</i>\n <ng-content></ng-content>\n</label>\n", styles: [":host{box-sizing:border-box;font:inherit;font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}:host *,:host *:before,:host *:after{box-sizing:inherit}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3930
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteLabelComponent, decorators: [{
|
|
3931
|
-
type: Component,
|
|
3932
|
-
args: [{ selector: 'granite-label', exportAs: 'graniteLabel', host: {
|
|
3933
|
-
class: 'granite-label',
|
|
3934
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<label [attr.for]=\"for\" [attr.form]=\"form\">\n <i *ngIf=\"required\" aria-label=\"required\">*</i>\n <ng-content></ng-content>\n</label>\n", styles: [":host{box-sizing:border-box;font:inherit;font-size:var(--granite-font-size-micro);color:var(--granite-color-text-weak)}:host *,:host *:before,:host *:after{box-sizing:inherit}\n"] }]
|
|
3935
|
-
}], propDecorators: { for: [{
|
|
3936
|
-
type: Input
|
|
3937
|
-
}], form: [{
|
|
3938
|
-
type: Input
|
|
3939
|
-
}], required: [{
|
|
3940
|
-
type: Input
|
|
3941
|
-
}] } });
|
|
3942
|
-
|
|
3943
|
-
class GraniteLabelModule {
|
|
3944
|
-
}
|
|
3945
|
-
GraniteLabelModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteLabelModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3946
|
-
GraniteLabelModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteLabelModule, declarations: [GraniteLabelComponent], imports: [CommonModule], exports: [GraniteLabelComponent] });
|
|
3947
|
-
GraniteLabelModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteLabelModule, imports: [CommonModule] });
|
|
3948
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteLabelModule, decorators: [{
|
|
3949
|
-
type: NgModule,
|
|
3950
|
-
args: [{
|
|
3951
|
-
declarations: [GraniteLabelComponent],
|
|
3952
|
-
imports: [CommonModule],
|
|
3953
|
-
exports: [GraniteLabelComponent],
|
|
3954
|
-
}]
|
|
3955
|
-
}] });
|
|
3956
|
-
|
|
3957
|
-
/**
|
|
3958
|
-
* Directive used to tell components and their sub components that client output
|
|
3959
|
-
* should be adapted for desktop devices like personal computers.
|
|
3960
|
-
*/
|
|
3961
|
-
class ClientOutputDesktopDirective {
|
|
3962
|
-
}
|
|
3963
|
-
ClientOutputDesktopDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientOutputDesktopDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3964
|
-
ClientOutputDesktopDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ClientOutputDesktopDirective, selector: "[graniteClientOutputDesktop]", providers: [
|
|
3965
|
-
{
|
|
3966
|
-
provide: GRANITE_CLIENT_OUTPUT,
|
|
3967
|
-
useValue: deviceDesktop.output,
|
|
3968
|
-
},
|
|
3969
|
-
], ngImport: i0 });
|
|
3970
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientOutputDesktopDirective, decorators: [{
|
|
3971
|
-
type: Directive,
|
|
3972
|
-
args: [{
|
|
3973
|
-
selector: `[graniteClientOutputDesktop]`,
|
|
3974
|
-
providers: [
|
|
3975
|
-
{
|
|
3976
|
-
provide: GRANITE_CLIENT_OUTPUT,
|
|
3977
|
-
useValue: deviceDesktop.output,
|
|
3978
|
-
},
|
|
3979
|
-
],
|
|
3980
|
-
}]
|
|
3981
|
-
}] });
|
|
3982
|
-
|
|
3983
|
-
/**
|
|
3984
|
-
* Directive used to tell components and their sub components that client output
|
|
3985
|
-
* should be adapted for touch devices like mobiles and tablets.
|
|
3986
|
-
*/
|
|
3987
|
-
class ClientOutputTouchDirective {
|
|
3988
|
-
}
|
|
3989
|
-
ClientOutputTouchDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientOutputTouchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
3990
|
-
ClientOutputTouchDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ClientOutputTouchDirective, selector: "[graniteClientOutputTouch]", providers: [
|
|
3991
|
-
{
|
|
3992
|
-
provide: GRANITE_CLIENT_OUTPUT,
|
|
3993
|
-
useValue: deviceTouch.output,
|
|
3994
|
-
},
|
|
3995
|
-
], ngImport: i0 });
|
|
3996
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientOutputTouchDirective, decorators: [{
|
|
3997
|
-
type: Directive,
|
|
3998
|
-
args: [{
|
|
3999
|
-
selector: `[graniteClientOutputTouch]`,
|
|
4000
|
-
providers: [
|
|
4001
|
-
{
|
|
4002
|
-
provide: GRANITE_CLIENT_OUTPUT,
|
|
4003
|
-
useValue: deviceTouch.output,
|
|
4004
|
-
},
|
|
4005
|
-
],
|
|
4006
|
-
}]
|
|
4007
|
-
}] });
|
|
4008
|
-
|
|
4009
|
-
/**
|
|
4010
|
-
* Directive used to tell components and their sub components that client input
|
|
4011
|
-
* should be adapted for desktop devices, like personal computers.
|
|
4012
|
-
*/
|
|
4013
|
-
class ClientInputDesktopDirective {
|
|
4014
|
-
}
|
|
4015
|
-
ClientInputDesktopDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientInputDesktopDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4016
|
-
ClientInputDesktopDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ClientInputDesktopDirective, selector: "[graniteClientInputDesktop]", providers: [
|
|
4017
|
-
{
|
|
4018
|
-
provide: GRANITE_CLIENT_INPUT,
|
|
4019
|
-
useValue: deviceDesktop.input,
|
|
4020
|
-
},
|
|
4021
|
-
], ngImport: i0 });
|
|
4022
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientInputDesktopDirective, decorators: [{
|
|
4023
|
-
type: Directive,
|
|
4024
|
-
args: [{
|
|
4025
|
-
selector: `[graniteClientInputDesktop]`,
|
|
4026
|
-
providers: [
|
|
4027
|
-
{
|
|
4028
|
-
provide: GRANITE_CLIENT_INPUT,
|
|
4029
|
-
useValue: deviceDesktop.input,
|
|
4030
|
-
},
|
|
4031
|
-
],
|
|
4032
|
-
}]
|
|
4033
|
-
}] });
|
|
4034
|
-
|
|
4035
|
-
/**
|
|
4036
|
-
* Directive used to tell components and their sub components that client input
|
|
4037
|
-
* should be adapted for touch devices, like mobiles and tablets.
|
|
4038
|
-
*/
|
|
4039
|
-
class ClientInputTouchDirective {
|
|
4040
|
-
}
|
|
4041
|
-
ClientInputTouchDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientInputTouchDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4042
|
-
ClientInputTouchDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ClientInputTouchDirective, selector: "[graniteClientInputTouch]", providers: [
|
|
4043
|
-
{
|
|
4044
|
-
provide: GRANITE_CLIENT_INPUT,
|
|
4045
|
-
useValue: deviceTouch.input,
|
|
4046
|
-
},
|
|
4047
|
-
], ngImport: i0 });
|
|
4048
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClientInputTouchDirective, decorators: [{
|
|
4049
|
-
type: Directive,
|
|
4050
|
-
args: [{
|
|
4051
|
-
selector: `[graniteClientInputTouch]`,
|
|
4052
|
-
providers: [
|
|
4053
|
-
{
|
|
4054
|
-
provide: GRANITE_CLIENT_INPUT,
|
|
4055
|
-
useValue: deviceTouch.input,
|
|
4056
|
-
},
|
|
4057
|
-
],
|
|
4058
|
-
}]
|
|
4059
|
-
}] });
|
|
4060
|
-
|
|
4061
|
-
// TODO: Move client devices into a separate module
|
|
4062
|
-
class GraniteCoreModule {
|
|
4063
|
-
}
|
|
4064
|
-
GraniteCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4065
|
-
GraniteCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteCoreModule, declarations: [ClientOutputDesktopDirective,
|
|
4066
|
-
ClientOutputTouchDirective,
|
|
4067
|
-
ClientInputDesktopDirective,
|
|
4068
|
-
ClientInputTouchDirective], exports: [ClientOutputDesktopDirective,
|
|
4069
|
-
ClientOutputTouchDirective,
|
|
4070
|
-
ClientInputDesktopDirective,
|
|
4071
|
-
ClientInputTouchDirective] });
|
|
4072
|
-
GraniteCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCoreModule });
|
|
4073
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteCoreModule, decorators: [{
|
|
4074
|
-
type: NgModule,
|
|
4075
|
-
args: [{
|
|
4076
|
-
declarations: [
|
|
4077
|
-
ClientOutputDesktopDirective,
|
|
4078
|
-
ClientOutputTouchDirective,
|
|
4079
|
-
ClientInputDesktopDirective,
|
|
4080
|
-
ClientInputTouchDirective,
|
|
4081
|
-
],
|
|
4082
|
-
exports: [
|
|
4083
|
-
ClientOutputDesktopDirective,
|
|
4084
|
-
ClientOutputTouchDirective,
|
|
4085
|
-
ClientInputDesktopDirective,
|
|
4086
|
-
ClientInputTouchDirective,
|
|
4087
|
-
],
|
|
4088
|
-
}]
|
|
4089
|
-
}] });
|
|
4090
|
-
|
|
4091
|
-
class GraniteTitlePipe {
|
|
4092
|
-
transform(value) {
|
|
4093
|
-
const words = value.split(/(?=[A-Z ])/);
|
|
4094
|
-
return words
|
|
4095
|
-
.map((word) => word.trim())
|
|
4096
|
-
.filter(Boolean)
|
|
4097
|
-
.map((word) => word.charAt(0).toLocaleUpperCase() + word.slice(1))
|
|
4098
|
-
.join(' ');
|
|
4099
|
-
}
|
|
4100
|
-
}
|
|
4101
|
-
GraniteTitlePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteTitlePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
4102
|
-
GraniteTitlePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: GraniteTitlePipe, name: "graniteTitle" });
|
|
4103
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GraniteTitlePipe, decorators: [{
|
|
4104
|
-
type: Pipe,
|
|
4105
|
-
args: [{
|
|
4106
|
-
name: 'graniteTitle',
|
|
4107
|
-
}]
|
|
4108
|
-
}] });
|
|
4109
|
-
|
|
4110
|
-
class PurePipesModule {
|
|
4111
|
-
}
|
|
4112
|
-
PurePipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PurePipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4113
|
-
PurePipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: PurePipesModule, declarations: [GraniteTitlePipe], exports: [GraniteTitlePipe] });
|
|
4114
|
-
PurePipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PurePipesModule });
|
|
4115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: PurePipesModule, decorators: [{
|
|
4116
|
-
type: NgModule,
|
|
4117
|
-
args: [{
|
|
4118
|
-
exports: [GraniteTitlePipe],
|
|
4119
|
-
declarations: [GraniteTitlePipe],
|
|
4120
|
-
}]
|
|
4121
|
-
}] });
|
|
4122
|
-
|
|
4123
|
-
/*
|
|
4124
|
-
* Public API Surface of ui
|
|
4125
|
-
*/
|
|
4126
|
-
|
|
4127
|
-
/**
|
|
4128
|
-
* Generated bundle index. Do not edit.
|
|
4129
|
-
*/
|
|
4130
|
-
|
|
4131
|
-
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, GraniteChipComponent, GraniteChipInputDirective, GraniteChipListComponent, GraniteChipSelectionChangeEvent, GraniteChipsModule, GraniteCoreModule, GraniteDividerDirective, GraniteGridComponent, GraniteGridItemComponent, GraniteGridModule, GraniteIconComponent, GraniteIconModule, GraniteInputFieldComponent, GraniteInputFieldModule, GraniteLabelComponent, GraniteLabelModule, GraniteMenuComponent, GraniteMenuHarness, GraniteMenuItemComponent, GraniteMenuItemHarness, GraniteMenuModule, GraniteMenuTouchCloseComponent, GraniteMenuTouchTitleItemComponent, GraniteMenuTriggerForDirective, GraniteRadioButtonComponent, GraniteRadioButtonModule, GraniteRadioGroupComponent, GraniteTitleDirective, GraniteTitlePipe, GraniteToggleSwitchComponent, GraniteToggleSwitchModule, PurePipesModule, deviceDesktop, deviceTouch, disabledMixin, graniteMenuDesktopAnimations, graniteMenuTouchAnimations };
|
|
4132
|
-
//# sourceMappingURL=ifsworld-granite-components.mjs.map
|