@flywheel-io/vision 0.5.0 → 0.7.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/README.md +1 -19
- package/assets/fonts/Flywheel-Vision-Icons.svg +239 -0
- package/assets/fonts/{flywheel.eot → Flywheel-Vision-Icons.ttf} +0 -0
- package/assets/fonts/{flywheel.ttf → Flywheel-Vision-Icons.woff} +0 -0
- package/components/button/button.component.d.ts +3 -0
- package/components/button/button.module.d.ts +7 -0
- package/components/button-group/button-group.component.d.ts +3 -0
- package/components/button-group/button-group.module.d.ts +5 -0
- package/components/dialog/choice-dialog.component.d.ts +11 -5
- package/components/dialog/confirm-dialog.component.d.ts +3 -0
- package/components/dialog/dialog.module.d.ts +14 -0
- package/components/dialog/dialog.service.d.ts +3 -0
- package/components/dialog/error-dialog.component.d.ts +3 -0
- package/components/dialog/portal-dialog.component.d.ts +3 -0
- package/components/icon/icon.component.d.ts +5 -0
- package/components/icon/icon.module.d.ts +8 -0
- package/components/notification/notification/notification.component.d.ts +3 -0
- package/components/notification/notification-container/notification-container.component.d.ts +3 -0
- package/components/notification/notification.module.d.ts +11 -0
- package/components/notification/notification.service.d.ts +3 -0
- package/components/popover/popover-trigger.component.d.ts +3 -0
- package/components/popover/popover-trigger.directive.d.ts +3 -0
- package/components/popover/popover.component.d.ts +3 -0
- package/components/popover/popover.module.d.ts +8 -0
- package/components/shared/pipes/pipes.module.d.ts +6 -0
- package/components/shared/pipes/translate.pipe.d.ts +3 -0
- package/components/shared/pipes/trusthtml.pipe.d.ts +3 -0
- package/components/shared/translation.service.d.ts +3 -0
- package/components/table/table.component.d.ts +3 -0
- package/components/table/table.module.d.ts +12 -0
- package/elements/README.md +20 -0
- package/elements/flywheel-io-vision-elements.d.ts +1 -0
- package/elements/package.json +5 -6
- package/esm2020/components/button/button.component.mjs +32 -0
- package/esm2020/components/button/button.module.mjs +33 -0
- package/esm2020/components/button-group/button-group.component.mjs +25 -0
- package/esm2020/components/button-group/button-group.module.mjs +23 -0
- package/esm2020/components/dialog/choice-dialog.component.mjs +90 -0
- package/esm2020/components/dialog/confirm-dialog.component.mjs +57 -0
- package/{esm2015/components/dialog/dialog.module.js → esm2020/components/dialog/dialog.module.mjs} +58 -31
- package/esm2020/components/dialog/dialog.service.mjs +72 -0
- package/esm2020/components/dialog/error-dialog.component.mjs +45 -0
- package/esm2020/components/dialog/portal-dialog.component.mjs +112 -0
- package/esm2020/components/icon/icon.component.mjs +19 -0
- package/esm2020/components/icon/icon.module.mjs +26 -0
- package/esm2020/components/notification/notification/notification.component.mjs +69 -0
- package/{esm2015/components/notification/notification/notification.model.js → esm2020/components/notification/notification/notification.model.mjs} +0 -0
- package/esm2020/components/notification/notification-container/notification-container.component.mjs +86 -0
- package/{esm2015/components/notification/notification-timer.service.js → esm2020/components/notification/notification-timer.service.mjs} +0 -0
- package/esm2020/components/notification/notification.module.mjs +56 -0
- package/{esm2015/components/notification/notification.service.js → esm2020/components/notification/notification.service.mjs} +9 -7
- package/esm2020/components/popover/popover-trigger.component.mjs +56 -0
- package/esm2020/components/popover/popover-trigger.directive.mjs +133 -0
- package/esm2020/components/popover/popover.component.mjs +29 -0
- package/esm2020/components/popover/popover.module.mjs +46 -0
- package/esm2020/components/shared/pipes/pipes.module.mjs +36 -0
- package/esm2020/components/shared/pipes/translate.pipe.mjs +39 -0
- package/esm2020/components/shared/pipes/trusthtml.pipe.mjs +21 -0
- package/esm2020/components/shared/translation.service.mjs +25 -0
- package/esm2020/components/table/table.component.mjs +179 -0
- package/esm2020/components/table/table.module.mjs +56 -0
- package/esm2020/elements/elements.mjs +61 -0
- package/{esm2015/elements/flywheel-io-vision-elements.js → esm2020/elements/flywheel-io-vision-elements.mjs} +0 -0
- package/{esm2015/elements/polyfills.js → esm2020/elements/polyfills.mjs} +0 -0
- package/{esm2015/elements/public-api.js → esm2020/elements/public-api.mjs} +0 -0
- package/esm2020/flywheel-io-vision.mjs +5 -0
- package/esm2020/public-api.mjs +25 -0
- package/fesm2015/{flywheel-io-vision-elements.js → flywheel-io-vision-elements.mjs} +19 -14
- package/fesm2015/flywheel-io-vision-elements.mjs.map +1 -0
- package/fesm2015/flywheel-io-vision.mjs +1402 -0
- package/fesm2015/flywheel-io-vision.mjs.map +1 -0
- package/fesm2020/flywheel-io-vision-elements.mjs +85 -0
- package/fesm2020/flywheel-io-vision-elements.mjs.map +1 -0
- package/fesm2020/flywheel-io-vision.mjs +1392 -0
- package/fesm2020/flywheel-io-vision.mjs.map +1 -0
- package/flywheel-io-vision.d.ts +1 -4
- package/package.json +43 -19
- package/public-api.d.ts +2 -0
- package/scss/atoms/ghost.scss +30 -0
- package/scss/config/theme.scss +6 -6
- package/scss/icons/_icon-font-face.scss +5 -6
- package/scss/icons/_icon-glyphs.scss +96 -16
- package/scss/material/overrides.scss +6 -1
- package/styles.css +274 -202
- package/styles.scss +8 -9
- package/assets/fonts/flywheel.svg +0 -101
- package/assets/fonts/flywheel.woff +0 -0
- package/bundles/flywheel-io-vision-elements.umd.js +0 -425
- package/bundles/flywheel-io-vision-elements.umd.js.map +0 -1
- package/bundles/flywheel-io-vision-elements.umd.min.js +0 -2
- package/bundles/flywheel-io-vision-elements.umd.min.js.map +0 -1
- package/bundles/flywheel-io-vision.umd.js +0 -1578
- package/bundles/flywheel-io-vision.umd.js.map +0 -1
- package/bundles/flywheel-io-vision.umd.min.js +0 -2
- package/bundles/flywheel-io-vision.umd.min.js.map +0 -1
- package/elements/flywheel-io-vision-elements.metadata.json +0 -1
- package/esm2015/components/button/button.component.js +0 -29
- package/esm2015/components/button/button.module.js +0 -24
- package/esm2015/components/button-group/button-group.component.js +0 -27
- package/esm2015/components/button-group/button-group.module.js +0 -18
- package/esm2015/components/dialog/choice-dialog.component.js +0 -52
- package/esm2015/components/dialog/confirm-dialog.component.js +0 -40
- package/esm2015/components/dialog/dialog.service.js +0 -69
- package/esm2015/components/dialog/error-dialog.component.js +0 -32
- package/esm2015/components/dialog/portal-dialog.component.js +0 -88
- package/esm2015/components/notification/notification/notification.component.js +0 -73
- package/esm2015/components/notification/notification-container/notification-container.component.js +0 -89
- package/esm2015/components/notification/notification.module.js +0 -37
- package/esm2015/components/popover/popover-trigger.component.js +0 -49
- package/esm2015/components/popover/popover-trigger.directive.js +0 -134
- package/esm2015/components/popover/popover.component.js +0 -23
- package/esm2015/components/popover/popover.module.js +0 -33
- package/esm2015/components/shared/pipes/pipes.module.js +0 -24
- package/esm2015/components/shared/pipes/translate.pipe.js +0 -40
- package/esm2015/components/shared/pipes/trusthtml.pipe.js +0 -20
- package/esm2015/components/shared/translation.service.js +0 -22
- package/esm2015/components/table/table.component.js +0 -165
- package/esm2015/components/table/table.module.js +0 -35
- package/esm2015/elements/elements.js +0 -56
- package/esm2015/flywheel-io-vision.js +0 -9
- package/esm2015/public-api.js +0 -23
- package/fesm2015/flywheel-io-vision-elements.js.map +0 -1
- package/fesm2015/flywheel-io-vision.js +0 -1168
- package/fesm2015/flywheel-io-vision.js.map +0 -1
- package/flywheel-io-vision.metadata.json +0 -1
|
@@ -1,1168 +0,0 @@
|
|
|
1
|
-
import { Component, ViewEncapsulation, Input, NgModule, Inject, Injectable, SimpleChange, ViewContainerRef, Pipe, ChangeDetectorRef, ɵɵdefineInjectable, ChangeDetectionStrategy, EventEmitter, Output, HostBinding, Directive, ElementRef, ViewChild, TemplateRef } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
4
|
-
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef, MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
|
|
5
|
-
import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
6
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
7
|
-
import { Subject, of, BehaviorSubject, Subscription } from 'rxjs';
|
|
8
|
-
import { takeUntil, debounceTime } from 'rxjs/operators';
|
|
9
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
10
|
-
import { Overlay } from '@angular/cdk/overlay';
|
|
11
|
-
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
12
|
-
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
13
|
-
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
14
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
15
|
-
import { MatInputModule } from '@angular/material/input';
|
|
16
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
17
|
-
|
|
18
|
-
class FwButtonGroupComponent {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.layout = 'basic';
|
|
21
|
-
this.size = 'medium';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
FwButtonGroupComponent.decorators = [
|
|
25
|
-
{ type: Component, args: [{
|
|
26
|
-
host: {
|
|
27
|
-
'class': 'fw-button-group',
|
|
28
|
-
'[class.small]': 'size === "small"',
|
|
29
|
-
'[class.medium]': 'size === "medium"',
|
|
30
|
-
'[class.large]': 'size === "large"',
|
|
31
|
-
'[class.compact]': 'layout === "compact"',
|
|
32
|
-
},
|
|
33
|
-
selector: 'fw-button-group',
|
|
34
|
-
template: `<ng-content></ng-content>`,
|
|
35
|
-
encapsulation: ViewEncapsulation.None,
|
|
36
|
-
styles: ["fw-button-group.fw-button-group{border-radius:4px;display:inline-flex;align-items:stretch}fw-button-group.fw-button-group.compact button{line-height:24px;height:24px}fw-button-group.fw-button-group.small button{font-size:12px}fw-button-group.fw-button-group.medium button{font-size:14px}fw-button-group.fw-button-group.large button{font-size:18px}fw-button-group.fw-button-group button{min-width:0;margin:0!important;border-radius:0}fw-button-group.fw-button-group>button:first-of-type,fw-button-group.fw-button-group>fw-button:first-of-type>button{border-top-left-radius:4px;border-bottom-left-radius:4px}fw-button-group.fw-button-group>button:last-of-type,fw-button-group.fw-button-group>fw-button:last-of-type>button{border-top-right-radius:4px;border-bottom-right-radius:4px}fw-button-group.fw-button-group>button.mat-stroked-button,fw-button-group.fw-button-group>button.mat-stroked-button+button.mat-stroke-button,fw-button-group.fw-button-group>fw-button[ng-reflect-type=stroked]+fw-button[ng-reflect-type=stroked]>button,fw-button-group.fw-button-group>fw-button[ng-reflect-type=stroked]>button,fw-button-group.fw-button-group>fw-button[type=stroked]+fw-button[type=stroked]>button,fw-button-group.fw-button-group>fw-button[type=stroked]>button{border-right-width:0}fw-button-group.fw-button-group>button.mat-stroked-button:last-of-type,fw-button-group.fw-button-group>fw-button[ng-reflect-type=stroked]:last-of-type>button,fw-button-group.fw-button-group>fw-button[type=stroked]:last-of-type>button{border-right-width:1px!important}fw-button-group.fw-button-group>button:not(.mat-stroked-button)+button.mat-stroked-button,fw-button-group.fw-button-group>fw-button:not([ng-reflect-type=stroked])+fw-button[ng-reflect-type=stroked]>button,fw-button-group.fw-button-group>fw-button:not([type=stroked])+fw-button[type=stroked]>button{border-left-width:0}"]
|
|
37
|
-
},] }
|
|
38
|
-
];
|
|
39
|
-
FwButtonGroupComponent.propDecorators = {
|
|
40
|
-
layout: [{ type: Input }],
|
|
41
|
-
size: [{ type: Input }]
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
class FwButtonGroupModule {
|
|
45
|
-
}
|
|
46
|
-
FwButtonGroupModule.decorators = [
|
|
47
|
-
{ type: NgModule, args: [{
|
|
48
|
-
exports: [
|
|
49
|
-
FwButtonGroupComponent,
|
|
50
|
-
],
|
|
51
|
-
declarations: [
|
|
52
|
-
FwButtonGroupComponent,
|
|
53
|
-
],
|
|
54
|
-
entryComponents: [
|
|
55
|
-
FwButtonGroupComponent,
|
|
56
|
-
]
|
|
57
|
-
},] }
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
class FwButtonComponent {
|
|
61
|
-
constructor() {
|
|
62
|
-
this.layout = 'basic';
|
|
63
|
-
this.size = 'medium';
|
|
64
|
-
this.type = 'basic';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
FwButtonComponent.decorators = [
|
|
68
|
-
{ type: Component, args: [{
|
|
69
|
-
host: {
|
|
70
|
-
'class': 'fw-button',
|
|
71
|
-
'[class.small]': 'size === "small"',
|
|
72
|
-
'[class.medium]': 'size === "medium"',
|
|
73
|
-
'[class.large]': 'size === "large"',
|
|
74
|
-
'[class.compact]': 'layout === "compact"',
|
|
75
|
-
},
|
|
76
|
-
selector: 'fw-button',
|
|
77
|
-
template: "<ng-container [ngSwitch]=\"type\">\n <button *ngSwitchCase=\"'raised'\" mat-raised-button [color]=\"color\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </button>\n <button *ngSwitchCase=\"'stroked'\" mat-stroked-button [color]=\"color\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </button>\n <button *ngSwitchCase=\"'flat'\" mat-flat-button [color]=\"color\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </button>\n <button *ngSwitchDefault mat-button [color]=\"color\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </button>\n</ng-container>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>\n",
|
|
78
|
-
styles: [":host.compact>button{line-height:24px}:host.small{font-size:12px}:host.medium{font-size:14px}:host.large{font-size:18px}button{font-size:inherit}"]
|
|
79
|
-
},] }
|
|
80
|
-
];
|
|
81
|
-
FwButtonComponent.propDecorators = {
|
|
82
|
-
color: [{ type: Input }],
|
|
83
|
-
layout: [{ type: Input }],
|
|
84
|
-
size: [{ type: Input }],
|
|
85
|
-
type: [{ type: Input }]
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
class FwButtonModule {
|
|
89
|
-
}
|
|
90
|
-
FwButtonModule.decorators = [
|
|
91
|
-
{ type: NgModule, args: [{
|
|
92
|
-
imports: [
|
|
93
|
-
CommonModule,
|
|
94
|
-
MatButtonModule,
|
|
95
|
-
],
|
|
96
|
-
exports: [
|
|
97
|
-
FwButtonComponent,
|
|
98
|
-
],
|
|
99
|
-
declarations: [
|
|
100
|
-
FwButtonComponent,
|
|
101
|
-
],
|
|
102
|
-
entryComponents: [
|
|
103
|
-
FwButtonComponent,
|
|
104
|
-
],
|
|
105
|
-
},] }
|
|
106
|
-
];
|
|
107
|
-
|
|
108
|
-
class FwChoiceDialog {
|
|
109
|
-
constructor(data) {
|
|
110
|
-
this.data = data;
|
|
111
|
-
this.alignActions = this.data.alignActions
|
|
112
|
-
? this.data.alignActions === 'start'
|
|
113
|
-
? null
|
|
114
|
-
: this.data.alignActions
|
|
115
|
-
: 'center';
|
|
116
|
-
this.choices = this.data.choices;
|
|
117
|
-
this.content = this.data.content;
|
|
118
|
-
this.title = this.data.title;
|
|
119
|
-
}
|
|
120
|
-
getTestId(choice) {
|
|
121
|
-
var _a;
|
|
122
|
-
return choice.testId || `${String((_a = choice.label) !== null && _a !== void 0 ? _a : choice.value).toLowerCase()}-button`;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
FwChoiceDialog.decorators = [
|
|
126
|
-
{ type: Component, args: [{
|
|
127
|
-
host: {
|
|
128
|
-
class: 'mat-dialog-component',
|
|
129
|
-
'test-id': 'choice-dialog',
|
|
130
|
-
},
|
|
131
|
-
selector: 'fw-choice-dialog',
|
|
132
|
-
template: `
|
|
133
|
-
<h1 mat-dialog-title *ngIf="title">{{ title }}</h1>
|
|
134
|
-
<div mat-dialog-content>{{ content }}</div>
|
|
135
|
-
<div mat-dialog-actions [align]="alignActions">
|
|
136
|
-
<ng-container *ngFor="let choice of choices" [ngSwitch]="choice.variant">
|
|
137
|
-
<button *ngSwitchCase="'raised'" mat-raised-button [color]="choice.color" [attr.test-id]="getTestId(choice)"
|
|
138
|
-
[mat-dialog-close]="choice.value">{{ choice.label }}</button>
|
|
139
|
-
<button *ngSwitchCase="'stroked'" mat-stroked-button [color]="choice.color" [attr.test-id]="getTestId(choice)"
|
|
140
|
-
[mat-dialog-close]="choice.value">{{ choice.label }}</button>
|
|
141
|
-
<button *ngSwitchCase="'flat'" mat-flat-button [color]="choice.color" [attr.test-id]="getTestId(choice)"
|
|
142
|
-
[mat-dialog-close]="choice.value">{{ choice.label }}</button>
|
|
143
|
-
<ng-container *ngSwitchDefault>
|
|
144
|
-
<button *ngIf="choice.color" mat-flat-button [color]="choice.color" [attr.test-id]="getTestId(choice)"
|
|
145
|
-
[mat-dialog-close]="choice.value">{{ choice.label }}</button>
|
|
146
|
-
<button *ngIf="!choice.color" mat-stroked-button [attr.test-id]="getTestId(choice)"
|
|
147
|
-
[mat-dialog-close]="choice.value">{{ choice.label }}</button>
|
|
148
|
-
</ng-container>
|
|
149
|
-
</ng-container>
|
|
150
|
-
</div>
|
|
151
|
-
`
|
|
152
|
-
},] }
|
|
153
|
-
];
|
|
154
|
-
FwChoiceDialog.ctorParameters = () => [
|
|
155
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
|
|
156
|
-
];
|
|
157
|
-
|
|
158
|
-
class FwConfirmDialog {
|
|
159
|
-
constructor(data) {
|
|
160
|
-
this.data = data;
|
|
161
|
-
this.title = this.data.title;
|
|
162
|
-
this.content = this.data.content;
|
|
163
|
-
this.html = this.data.html;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
FwConfirmDialog.decorators = [
|
|
167
|
-
{ type: Component, args: [{
|
|
168
|
-
host: {
|
|
169
|
-
class: 'mat-dialog-component',
|
|
170
|
-
'test-id': 'confirm-dialog',
|
|
171
|
-
},
|
|
172
|
-
selector: 'fw-confirm-dialog',
|
|
173
|
-
template: `
|
|
174
|
-
<h1 mat-dialog-title *ngIf="title">{{ title }}</h1>
|
|
175
|
-
<div mat-dialog-content *ngIf="html" class="markup" [innerHTML]="html | trusthtml"></div>
|
|
176
|
-
<div mat-dialog-content *ngIf="!html">{{ content || ('confirmDialog.body' | translate ) }}</div>
|
|
177
|
-
<div mat-dialog-actions align="center">
|
|
178
|
-
<button test-id="no-button" mat-stroked-button [mat-dialog-close]="false">{{ 'confirmDialog.no' | translate }}</button>
|
|
179
|
-
<button test-id="yes-button" mat-flat-button color="primary" [mat-dialog-close]="true">{{ 'confirmDialog.yes' | translate }}</button>
|
|
180
|
-
</div>
|
|
181
|
-
`,
|
|
182
|
-
styles: [`
|
|
183
|
-
[mat-dialog-content] {
|
|
184
|
-
text-align: center;
|
|
185
|
-
}
|
|
186
|
-
[mat-dialog-content].markup {
|
|
187
|
-
text-align: inherit;
|
|
188
|
-
}
|
|
189
|
-
`]
|
|
190
|
-
},] }
|
|
191
|
-
];
|
|
192
|
-
FwConfirmDialog.ctorParameters = () => [
|
|
193
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] }
|
|
194
|
-
];
|
|
195
|
-
|
|
196
|
-
class FwDialogService {
|
|
197
|
-
constructor(matDialog) {
|
|
198
|
-
this.matDialog = matDialog;
|
|
199
|
-
this.dialogs = [];
|
|
200
|
-
this.config = new Map();
|
|
201
|
-
}
|
|
202
|
-
closeAll(component) {
|
|
203
|
-
if (component) {
|
|
204
|
-
this.dialogs
|
|
205
|
-
.filter((el) => el.component === component)
|
|
206
|
-
.forEach((el) => el.ref.close());
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
this.matDialog.closeAll();
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
open(component, config) {
|
|
213
|
-
const index = this.dialogs.findIndex(el => el.component === component);
|
|
214
|
-
let ref = null;
|
|
215
|
-
const baseConfig = Object.assign({ multi: 'allow' }, this.config.get(component));
|
|
216
|
-
switch (baseConfig.multi) {
|
|
217
|
-
case 'ignore':
|
|
218
|
-
// if an existing dialog of the same type doesn't exist, open one
|
|
219
|
-
if (index === -1) {
|
|
220
|
-
ref = this.matDialog.open(component, Object.assign(Object.assign({}, baseConfig), config));
|
|
221
|
-
this.dialogs.push({ component, ref });
|
|
222
|
-
}
|
|
223
|
-
break;
|
|
224
|
-
case 'replace':
|
|
225
|
-
// if an existing dialog of the same type exists, replace it.
|
|
226
|
-
if (index > -1) {
|
|
227
|
-
this.dialogs[index].ref.close();
|
|
228
|
-
ref = this.matDialog.open(component, Object.assign(Object.assign({}, baseConfig), config));
|
|
229
|
-
this.dialogs.splice(index, 1, { component, ref });
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
ref = this.matDialog.open(component, Object.assign(Object.assign({}, baseConfig), config));
|
|
233
|
-
this.dialogs.push({ component, ref });
|
|
234
|
-
}
|
|
235
|
-
break;
|
|
236
|
-
default:
|
|
237
|
-
ref = this.matDialog.open(component, Object.assign(Object.assign({}, baseConfig), config));
|
|
238
|
-
this.dialogs.push({ component, ref });
|
|
239
|
-
break;
|
|
240
|
-
}
|
|
241
|
-
if (ref) {
|
|
242
|
-
ref.afterClosed().subscribe(() => {
|
|
243
|
-
// clean up open dialog reference
|
|
244
|
-
const index = this.dialogs.findIndex(el => el.ref === ref);
|
|
245
|
-
if (index >= 0) {
|
|
246
|
-
this.dialogs.splice(index, 1);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
return ref;
|
|
251
|
-
}
|
|
252
|
-
registerDialog(component, config) {
|
|
253
|
-
this.config.set(component, config);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
FwDialogService.decorators = [
|
|
257
|
-
{ type: Injectable }
|
|
258
|
-
];
|
|
259
|
-
FwDialogService.ctorParameters = () => [
|
|
260
|
-
{ type: MatDialog }
|
|
261
|
-
];
|
|
262
|
-
|
|
263
|
-
class FwErrorDialog {
|
|
264
|
-
constructor(data, ref) {
|
|
265
|
-
this.data = data;
|
|
266
|
-
this.ref = ref;
|
|
267
|
-
this.message = this.data.message;
|
|
268
|
-
this.ref.disableClose = false;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
FwErrorDialog.decorators = [
|
|
272
|
-
{ type: Component, args: [{
|
|
273
|
-
host: {
|
|
274
|
-
class: 'mat-dialog-component',
|
|
275
|
-
'test-id': 'error-dialog',
|
|
276
|
-
},
|
|
277
|
-
selector: 'fw-error-dialog',
|
|
278
|
-
template: `
|
|
279
|
-
<div mat-dialog-content>{{ message }}</div>
|
|
280
|
-
<div mat-dialog-actions align="end">
|
|
281
|
-
<button test-id="close-button" mat-stroked-button mat-dialog-close>
|
|
282
|
-
{{ 'common.actions.close' | translate }}
|
|
283
|
-
</button>
|
|
284
|
-
</div>
|
|
285
|
-
`
|
|
286
|
-
},] }
|
|
287
|
-
];
|
|
288
|
-
FwErrorDialog.ctorParameters = () => [
|
|
289
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
|
|
290
|
-
{ type: MatDialogRef }
|
|
291
|
-
];
|
|
292
|
-
|
|
293
|
-
class FwPortalDialog {
|
|
294
|
-
constructor(data, viewContainerRef) {
|
|
295
|
-
this.data = data;
|
|
296
|
-
this.viewContainerRef = viewContainerRef;
|
|
297
|
-
this.content = this.data.content;
|
|
298
|
-
this.title = this.data.title;
|
|
299
|
-
this.destroyed$ = new Subject();
|
|
300
|
-
if (this.data.component) {
|
|
301
|
-
this.portal = new ComponentPortal(this.data.component.type, this.viewContainerRef);
|
|
302
|
-
}
|
|
303
|
-
else if (this.data.template) {
|
|
304
|
-
this.portal = new TemplatePortal(this.data.template, this.viewContainerRef);
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
throw new Error('One of [component, template] was not provided.');
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
ngOnDestroy() {
|
|
311
|
-
this.destroyed$.next();
|
|
312
|
-
}
|
|
313
|
-
attached(ref) {
|
|
314
|
-
var _a, _b;
|
|
315
|
-
if (this.data.component) {
|
|
316
|
-
ref = ref;
|
|
317
|
-
if (this.data.component.outputs) {
|
|
318
|
-
for (const [key, observer] of Object.entries(this.data.component.outputs)) {
|
|
319
|
-
const output$ = ref[key];
|
|
320
|
-
if (typeof (output$ === null || output$ === void 0 ? void 0 : output$.pipe) === 'function' && typeof output$.subscribe === 'function') {
|
|
321
|
-
output$.pipe(takeUntil(this.destroyed$)).subscribe(observer);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
if (this.data.component.inputs) {
|
|
326
|
-
const changes = {};
|
|
327
|
-
for (const [key, value] of Object.entries(this.data.component.inputs)) {
|
|
328
|
-
ref.instance[key] = value;
|
|
329
|
-
changes[key] = new SimpleChange(value, value, true);
|
|
330
|
-
}
|
|
331
|
-
(_b = (_a = ref.instance).ngOnChanges) === null || _b === void 0 ? void 0 : _b.call(_a, changes);
|
|
332
|
-
ref.changeDetectorRef.markForCheck();
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
FwPortalDialog.decorators = [
|
|
338
|
-
{ type: Component, args: [{
|
|
339
|
-
host: {
|
|
340
|
-
class: 'mat-dialog-component',
|
|
341
|
-
'test-id': 'portal-dialog',
|
|
342
|
-
},
|
|
343
|
-
selector: 'fw-portal-dialog',
|
|
344
|
-
template: `
|
|
345
|
-
<ng-container *ngIf="title">
|
|
346
|
-
<h1 mat-dialog-title>{{ title }}</h1>
|
|
347
|
-
<button test-id="dialog-close-corner" mat-icon-button mat-dialog-close>
|
|
348
|
-
<mat-icon>close</mat-icon>
|
|
349
|
-
</button>
|
|
350
|
-
</ng-container>
|
|
351
|
-
<mat-dialog-content>
|
|
352
|
-
<p *ngIf="content" class="content">{{ content }}</p>
|
|
353
|
-
<ng-template [cdkPortalOutlet]="portal" (attached)="attached($event)"></ng-template>
|
|
354
|
-
</mat-dialog-content>
|
|
355
|
-
<mat-dialog-actions align="end">
|
|
356
|
-
<button test-id="dialog-close-button" mat-stroked-button mat-dialog-close>
|
|
357
|
-
{{ 'common.actions.close' | translate }}
|
|
358
|
-
</button>
|
|
359
|
-
</mat-dialog-actions>
|
|
360
|
-
`,
|
|
361
|
-
styles: [`
|
|
362
|
-
:host {
|
|
363
|
-
min-width: 200px;
|
|
364
|
-
}
|
|
365
|
-
.content {
|
|
366
|
-
margin-bottom: 30px;
|
|
367
|
-
}
|
|
368
|
-
`]
|
|
369
|
-
},] }
|
|
370
|
-
];
|
|
371
|
-
FwPortalDialog.ctorParameters = () => [
|
|
372
|
-
{ type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] },
|
|
373
|
-
{ type: ViewContainerRef }
|
|
374
|
-
];
|
|
375
|
-
|
|
376
|
-
class TranslationService {
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Very basic i18n implementation. Consumer apps can provide their own implementation of TranslationService to override.
|
|
380
|
-
*/
|
|
381
|
-
class MinimalTranslationService {
|
|
382
|
-
getMessage(key, silent) {
|
|
383
|
-
return of(MinimalTranslationService.messages[key]);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
MinimalTranslationService.messages = {
|
|
387
|
-
'common.actions.close': 'Close',
|
|
388
|
-
'confirmDialog.body': 'Are you sure?',
|
|
389
|
-
'confirmDialog.no': 'No',
|
|
390
|
-
'confirmDialog.yes': 'Yes',
|
|
391
|
-
};
|
|
392
|
-
MinimalTranslationService.decorators = [
|
|
393
|
-
{ type: Injectable }
|
|
394
|
-
];
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Translate a message given a nested key to a location in the loaded locale copy.
|
|
398
|
-
*/
|
|
399
|
-
class TranslatePipe {
|
|
400
|
-
constructor(cdr, translationService) {
|
|
401
|
-
this.cdr = cdr;
|
|
402
|
-
this.translationService = translationService;
|
|
403
|
-
this.subscriptions = {};
|
|
404
|
-
this.messages = {};
|
|
405
|
-
}
|
|
406
|
-
ngOnDestroy() {
|
|
407
|
-
for (const subscription of Object.values(this.subscriptions)) {
|
|
408
|
-
subscription.unsubscribe();
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
transform(key, silent = false) {
|
|
412
|
-
if (!(key in this.subscriptions)) {
|
|
413
|
-
this.subscriptions[key] = this.translationService.getMessage(key, silent).subscribe(message => {
|
|
414
|
-
this.messages[key] = message;
|
|
415
|
-
// trigger change detection to support components with ChangeDetectionStrategy.OnPush
|
|
416
|
-
this.cdr.markForCheck();
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
return this.messages[key] || '';
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
TranslatePipe.decorators = [
|
|
423
|
-
{ type: Pipe, args: [{
|
|
424
|
-
name: 'translate',
|
|
425
|
-
pure: false,
|
|
426
|
-
},] }
|
|
427
|
-
];
|
|
428
|
-
TranslatePipe.ctorParameters = () => [
|
|
429
|
-
{ type: ChangeDetectorRef },
|
|
430
|
-
{ type: TranslationService }
|
|
431
|
-
];
|
|
432
|
-
|
|
433
|
-
class TrustHtmlPipe {
|
|
434
|
-
constructor(sanitizer) {
|
|
435
|
-
this.sanitizer = sanitizer;
|
|
436
|
-
}
|
|
437
|
-
transform(html) {
|
|
438
|
-
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
TrustHtmlPipe.decorators = [
|
|
442
|
-
{ type: Pipe, args: [{
|
|
443
|
-
name: 'trusthtml',
|
|
444
|
-
pure: true,
|
|
445
|
-
},] }
|
|
446
|
-
];
|
|
447
|
-
TrustHtmlPipe.ctorParameters = () => [
|
|
448
|
-
{ type: DomSanitizer }
|
|
449
|
-
];
|
|
450
|
-
|
|
451
|
-
const exports = [
|
|
452
|
-
TranslatePipe,
|
|
453
|
-
TrustHtmlPipe,
|
|
454
|
-
];
|
|
455
|
-
class PipesModule {
|
|
456
|
-
}
|
|
457
|
-
PipesModule.decorators = [
|
|
458
|
-
{ type: NgModule, args: [{
|
|
459
|
-
declarations: exports,
|
|
460
|
-
exports: exports,
|
|
461
|
-
providers: [
|
|
462
|
-
{
|
|
463
|
-
provide: TranslationService,
|
|
464
|
-
useClass: MinimalTranslationService,
|
|
465
|
-
},
|
|
466
|
-
],
|
|
467
|
-
},] }
|
|
468
|
-
];
|
|
469
|
-
|
|
470
|
-
const ɵ0 = {
|
|
471
|
-
disableClose: true,
|
|
472
|
-
hasBackdrop: true,
|
|
473
|
-
};
|
|
474
|
-
class FwDialogModule {
|
|
475
|
-
}
|
|
476
|
-
FwDialogModule.decorators = [
|
|
477
|
-
{ type: NgModule, args: [{
|
|
478
|
-
declarations: [
|
|
479
|
-
FwChoiceDialog,
|
|
480
|
-
FwConfirmDialog,
|
|
481
|
-
FwErrorDialog,
|
|
482
|
-
FwPortalDialog,
|
|
483
|
-
],
|
|
484
|
-
imports: [
|
|
485
|
-
CommonModule,
|
|
486
|
-
MatButtonModule,
|
|
487
|
-
MatDialogModule,
|
|
488
|
-
MatIconModule,
|
|
489
|
-
PipesModule,
|
|
490
|
-
PortalModule,
|
|
491
|
-
],
|
|
492
|
-
providers: [
|
|
493
|
-
FwDialogService,
|
|
494
|
-
{
|
|
495
|
-
provide: MAT_DIALOG_DEFAULT_OPTIONS,
|
|
496
|
-
useValue: ɵ0
|
|
497
|
-
}
|
|
498
|
-
],
|
|
499
|
-
},] }
|
|
500
|
-
];
|
|
501
|
-
|
|
502
|
-
function genId() {
|
|
503
|
-
return String.prototype.padStart(24, Math.floor(Math.random() * Date.now()).toString(16));
|
|
504
|
-
}
|
|
505
|
-
class FwNotificationService {
|
|
506
|
-
constructor() {
|
|
507
|
-
this.notifications$ = new BehaviorSubject([]);
|
|
508
|
-
this.notificationQueue = [];
|
|
509
|
-
}
|
|
510
|
-
show(notification) {
|
|
511
|
-
if (!notification.id) {
|
|
512
|
-
notification.id = genId();
|
|
513
|
-
}
|
|
514
|
-
this.notificationQueue.push(notification);
|
|
515
|
-
this.notifications$.next(this.notificationQueue);
|
|
516
|
-
}
|
|
517
|
-
dismiss(notificationId) {
|
|
518
|
-
this.notificationQueue = this.notificationQueue.filter((v) => v.id !== notificationId);
|
|
519
|
-
this.notifications$.next(this.notificationQueue);
|
|
520
|
-
}
|
|
521
|
-
dismissAll() {
|
|
522
|
-
this.notificationQueue = [];
|
|
523
|
-
this.notifications$.next(this.notificationQueue);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
FwNotificationService.ɵprov = ɵɵdefineInjectable({ factory: function FwNotificationService_Factory() { return new FwNotificationService(); }, token: FwNotificationService, providedIn: "root" });
|
|
527
|
-
FwNotificationService.decorators = [
|
|
528
|
-
{ type: Injectable, args: [{
|
|
529
|
-
providedIn: 'root'
|
|
530
|
-
},] }
|
|
531
|
-
];
|
|
532
|
-
|
|
533
|
-
class FwNotificationContainerComponent {
|
|
534
|
-
constructor(cdr, notificationService) {
|
|
535
|
-
this.cdr = cdr;
|
|
536
|
-
this.notificationService = notificationService;
|
|
537
|
-
this.limit = 3;
|
|
538
|
-
this.notifications = [];
|
|
539
|
-
this.expanded = false;
|
|
540
|
-
this.subscriptions = {
|
|
541
|
-
notifications: Subscription.EMPTY,
|
|
542
|
-
};
|
|
543
|
-
this.subscriptions.notifications = this.notificationService.notifications$.subscribe((notifications) => {
|
|
544
|
-
this.notifications = notifications;
|
|
545
|
-
if (notifications.length === 0) {
|
|
546
|
-
this.expanded = false;
|
|
547
|
-
}
|
|
548
|
-
this.cdr.markForCheck();
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
ngOnDestroy() {
|
|
552
|
-
for (const subscription of Object.values(this.subscriptions)) {
|
|
553
|
-
subscription.unsubscribe();
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
notificationClass(index) {
|
|
557
|
-
let cssClass;
|
|
558
|
-
const level = this.notifications.length > this.limit
|
|
559
|
-
? index - (this.notifications.length - this.limit)
|
|
560
|
-
: index;
|
|
561
|
-
if (this.expanded) {
|
|
562
|
-
cssClass = 'default';
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
cssClass = level >= 0 ? `level-${level}` : 'hidden';
|
|
566
|
-
}
|
|
567
|
-
return cssClass;
|
|
568
|
-
}
|
|
569
|
-
getEmptyNotification(notification) {
|
|
570
|
-
return Object.assign(Object.assign({}, notification), { message: ' ' }); // take up a line but show no content
|
|
571
|
-
}
|
|
572
|
-
onReady(notification) {
|
|
573
|
-
const currentNotification = this.notifications[this.notifications.length - 1];
|
|
574
|
-
currentNotification.ref = notification;
|
|
575
|
-
notification.startTimer();
|
|
576
|
-
}
|
|
577
|
-
onDismiss(notificationId) {
|
|
578
|
-
const notification = this.notifications.find(currentNotification => currentNotification.id === notificationId);
|
|
579
|
-
if (notification === null || notification === void 0 ? void 0 : notification.ref) {
|
|
580
|
-
notification.ref.stopTimer();
|
|
581
|
-
}
|
|
582
|
-
if (notification === null || notification === void 0 ? void 0 : notification.id) {
|
|
583
|
-
this.notificationService.dismiss(notification.id);
|
|
584
|
-
}
|
|
585
|
-
this.cdr.markForCheck();
|
|
586
|
-
}
|
|
587
|
-
clearAll() {
|
|
588
|
-
this.notificationService.dismissAll();
|
|
589
|
-
this.cdr.markForCheck();
|
|
590
|
-
}
|
|
591
|
-
onShowMore() {
|
|
592
|
-
this.expanded = true;
|
|
593
|
-
this.cdr.markForCheck();
|
|
594
|
-
}
|
|
595
|
-
onShowLess() {
|
|
596
|
-
this.expanded = false;
|
|
597
|
-
this.cdr.markForCheck();
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
FwNotificationContainerComponent.decorators = [
|
|
601
|
-
{ type: Component, args: [{
|
|
602
|
-
host: {
|
|
603
|
-
'class': 'fw-notification-container',
|
|
604
|
-
'[class.duo]': 'notifications.length === 2',
|
|
605
|
-
'[class.triple]': 'notifications.length >= 3',
|
|
606
|
-
},
|
|
607
|
-
selector: 'fw-notification-container',
|
|
608
|
-
template: "<div role=\"list\">\n <fw-notification *ngFor=\"let notification of notifications; index as $index\"\n (ready)=\"onReady($event)\"\n (dismiss)=\"onDismiss($event)\"\n [class]=\"notificationClass($index)\"\n [notification]=\"expanded || $index === notifications.length - 1 ? notification : getEmptyNotification(notification)\"\n [attr.aria-label]=\"notification.type + ' : ' + notification.message\"\n role=\"listitem\"\n ></fw-notification>\n <div class=\"buttons\">\n <fw-button *ngIf=\"expanded\" (click)=\"onShowLess()\" mat-button aria-label=\"show less\" layout=\"compact\" size=\"small\">\n <mat-icon>expand_less</mat-icon>\n </fw-button>\n <fw-button *ngIf=\"!expanded && notifications.length > 1\" (click)=\"onShowMore()\" mat-button aria-label=\"show more\" layout=\"compact\" size=\"small\">\n <mat-icon>expand_more</mat-icon>\n </fw-button>\n <fw-button (click)=\"clearAll()\" mat-button class=\"clear-all\" aria-label=\"clear all\" layout=\"compact\" size=\"small\">\n Clear All\n </fw-button>\n </div>\n</div>\n",
|
|
609
|
-
encapsulation: ViewEncapsulation.None,
|
|
610
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
611
|
-
styles: ["fw-notification-container{position:absolute;right:0;top:0;margin-top:20px;z-index:999999}fw-notification-container>div{display:flex;flex-direction:column-reverse}fw-notification-container .buttons{display:none;position:absolute;top:-5px;right:25px}fw-notification-container .buttons button{color:#fff;background-color:#919292;margin-left:2px}fw-notification-container .buttons button.mat-button{line-height:24px!important;margin:0 0 0 2px!important}fw-notification-container:hover .buttons{display:flex}fw-notification-container .hidden{display:none}fw-notification-container fw-notification:last-of-type{margin-top:24px}fw-notification-container.duo fw-notification.level-0,fw-notification-container.triple fw-notification.level-1{transform:scale(.95) translateY(-51px)}fw-notification-container.triple fw-notification.level-0{transform:scale(.9) translateY(-108px)}"]
|
|
612
|
-
},] }
|
|
613
|
-
];
|
|
614
|
-
FwNotificationContainerComponent.ctorParameters = () => [
|
|
615
|
-
{ type: ChangeDetectorRef },
|
|
616
|
-
{ type: FwNotificationService }
|
|
617
|
-
];
|
|
618
|
-
|
|
619
|
-
class FwNotificationTimerService {
|
|
620
|
-
constructor() {
|
|
621
|
-
this.now = 0;
|
|
622
|
-
this.remainingDuration = 0;
|
|
623
|
-
}
|
|
624
|
-
start(duration) {
|
|
625
|
-
return new Promise((resolve) => {
|
|
626
|
-
this.remainingDuration = duration;
|
|
627
|
-
this.resolver = resolve;
|
|
628
|
-
this.continue();
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
stop() {
|
|
632
|
-
clearTimeout(this.timerId);
|
|
633
|
-
this.remainingDuration = 0;
|
|
634
|
-
}
|
|
635
|
-
pause() {
|
|
636
|
-
clearTimeout(this.timerId);
|
|
637
|
-
this.remainingDuration =
|
|
638
|
-
this.remainingDuration - new Date().getTime() - this.now;
|
|
639
|
-
}
|
|
640
|
-
continue() {
|
|
641
|
-
this.now = new Date().getTime();
|
|
642
|
-
this.timerId = window.setTimeout(() => {
|
|
643
|
-
this.resolver();
|
|
644
|
-
}, this.remainingDuration);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
var FwNotificationType;
|
|
649
|
-
(function (FwNotificationType) {
|
|
650
|
-
FwNotificationType["Error"] = "error";
|
|
651
|
-
FwNotificationType["Info"] = "info";
|
|
652
|
-
FwNotificationType["Success"] = "success";
|
|
653
|
-
FwNotificationType["Wait"] = "wait";
|
|
654
|
-
FwNotificationType["Warning"] = "warning";
|
|
655
|
-
})(FwNotificationType || (FwNotificationType = {}));
|
|
656
|
-
|
|
657
|
-
class FwNotificationComponent {
|
|
658
|
-
constructor(cdr, timerService) {
|
|
659
|
-
this.cdr = cdr;
|
|
660
|
-
this.timerService = timerService;
|
|
661
|
-
this.notificationDuration = 9000;
|
|
662
|
-
this.ready = new EventEmitter();
|
|
663
|
-
this.dismiss = new EventEmitter();
|
|
664
|
-
}
|
|
665
|
-
get cssClass() {
|
|
666
|
-
var _a;
|
|
667
|
-
let cssClass = 'fw-notification';
|
|
668
|
-
switch ((_a = this.notification) === null || _a === void 0 ? void 0 : _a.type) {
|
|
669
|
-
case FwNotificationType.Error:
|
|
670
|
-
return cssClass += ' error';
|
|
671
|
-
case FwNotificationType.Info:
|
|
672
|
-
return cssClass += ' info';
|
|
673
|
-
case FwNotificationType.Success:
|
|
674
|
-
return cssClass += ' success';
|
|
675
|
-
case FwNotificationType.Wait:
|
|
676
|
-
return cssClass += ' wait';
|
|
677
|
-
case FwNotificationType.Warning:
|
|
678
|
-
return cssClass += ' warning';
|
|
679
|
-
default:
|
|
680
|
-
return cssClass;
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
ngAfterViewInit() {
|
|
684
|
-
this.ready.emit(this);
|
|
685
|
-
this.cdr.markForCheck();
|
|
686
|
-
}
|
|
687
|
-
startTimer() {
|
|
688
|
-
this.timerService.start(this.notificationDuration).then(() => {
|
|
689
|
-
this.onClickDismiss();
|
|
690
|
-
this.cdr.markForCheck();
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
stopTimer() {
|
|
694
|
-
this.timerService.stop();
|
|
695
|
-
this.cdr.markForCheck();
|
|
696
|
-
}
|
|
697
|
-
onClickDismiss() {
|
|
698
|
-
this.dismiss.emit(this.notification.id);
|
|
699
|
-
this.cdr.markForCheck();
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
FwNotificationComponent.decorators = [
|
|
703
|
-
{ type: Component, args: [{
|
|
704
|
-
host: {
|
|
705
|
-
'(click)': 'onClickDismiss()'
|
|
706
|
-
},
|
|
707
|
-
selector: 'fw-notification',
|
|
708
|
-
template: `{{ notification?.message }}`,
|
|
709
|
-
providers: [FwNotificationTimerService],
|
|
710
|
-
encapsulation: ViewEncapsulation.None,
|
|
711
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
712
|
-
styles: ["fw-notification{display:block;border-radius:4px;box-sizing:border-box;margin:5px 24px;max-width:33vw;min-width:344px;padding:14px 16px;transform-origin:center;background-color:#2f96b4;border:1px solid hsla(0,0%,100%,.7019607843);box-shadow:0 0 12px #999;color:#fff;opacity:.99;white-space:pre-wrap}fw-notification.error{background-color:#bd362f}fw-notification.info{background-color:#2f96b4}fw-notification.success{background-color:#51a351}fw-notification.wait{background-color:#2f96b4}fw-notification.warning{background-color:#f89406}"]
|
|
713
|
-
},] }
|
|
714
|
-
];
|
|
715
|
-
FwNotificationComponent.ctorParameters = () => [
|
|
716
|
-
{ type: ChangeDetectorRef },
|
|
717
|
-
{ type: FwNotificationTimerService }
|
|
718
|
-
];
|
|
719
|
-
FwNotificationComponent.propDecorators = {
|
|
720
|
-
notification: [{ type: Input }],
|
|
721
|
-
notificationDuration: [{ type: Input }],
|
|
722
|
-
ready: [{ type: Output }],
|
|
723
|
-
dismiss: [{ type: Output }],
|
|
724
|
-
cssClass: [{ type: HostBinding, args: ['class',] }]
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
class FwNotificationModule {
|
|
728
|
-
}
|
|
729
|
-
FwNotificationModule.decorators = [
|
|
730
|
-
{ type: NgModule, args: [{
|
|
731
|
-
imports: [
|
|
732
|
-
CommonModule,
|
|
733
|
-
FwButtonModule,
|
|
734
|
-
FwButtonGroupModule,
|
|
735
|
-
MatButtonModule,
|
|
736
|
-
MatIconModule,
|
|
737
|
-
],
|
|
738
|
-
exports: [
|
|
739
|
-
FwNotificationComponent,
|
|
740
|
-
FwNotificationContainerComponent
|
|
741
|
-
],
|
|
742
|
-
declarations: [
|
|
743
|
-
FwNotificationComponent,
|
|
744
|
-
FwNotificationContainerComponent,
|
|
745
|
-
],
|
|
746
|
-
entryComponents: [
|
|
747
|
-
FwNotificationComponent,
|
|
748
|
-
],
|
|
749
|
-
providers: [
|
|
750
|
-
FwNotificationService,
|
|
751
|
-
]
|
|
752
|
-
},] }
|
|
753
|
-
];
|
|
754
|
-
|
|
755
|
-
class FwPopoverTriggerDirective {
|
|
756
|
-
constructor(element, overlay, viewContainerRef) {
|
|
757
|
-
this.element = element;
|
|
758
|
-
this.overlay = overlay;
|
|
759
|
-
this.viewContainerRef = viewContainerRef;
|
|
760
|
-
this.popoverMargin = 15;
|
|
761
|
-
this.positionMap = {
|
|
762
|
-
'left': { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },
|
|
763
|
-
'right': { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },
|
|
764
|
-
'above': { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },
|
|
765
|
-
'below': { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },
|
|
766
|
-
};
|
|
767
|
-
this.position = 'below';
|
|
768
|
-
this.subscriptions = {
|
|
769
|
-
positionChanges: Subscription.EMPTY,
|
|
770
|
-
};
|
|
771
|
-
}
|
|
772
|
-
ngOnChanges(changes) {
|
|
773
|
-
if (changes.position && this.overlayRef) {
|
|
774
|
-
this.overlayRef.dispose();
|
|
775
|
-
this.overlayRef = null;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
ngOnDestroy() {
|
|
779
|
-
if (this.overlayRef) {
|
|
780
|
-
this.overlayRef.dispose();
|
|
781
|
-
this.overlayRef = null;
|
|
782
|
-
}
|
|
783
|
-
for (const subscription of Object.values(this.subscriptions)) {
|
|
784
|
-
subscription.unsubscribe();
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
showPopover() {
|
|
788
|
-
var _a;
|
|
789
|
-
if ((_a = this.popover) === null || _a === void 0 ? void 0 : _a.templateRef) {
|
|
790
|
-
this.getOverlay().attach(new TemplatePortal(this.popover.templateRef, this.viewContainerRef));
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
hidePopover(e) {
|
|
794
|
-
var _a;
|
|
795
|
-
if (!((_a = e.relatedTarget) === null || _a === void 0 ? void 0 : _a.classList.contains('fw-popover-panel'))) {
|
|
796
|
-
this.getOverlay().detach();
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
setPopoverCaretPosition(position) {
|
|
800
|
-
const caret = this.overlayRef.overlayElement.querySelector('.fw-popover-caret');
|
|
801
|
-
const caretRect = this.overlayRef.overlayElement.getBoundingClientRect();
|
|
802
|
-
const triggerRect = this.element.nativeElement.getBoundingClientRect();
|
|
803
|
-
this.overlayRef.overlayElement.querySelector('.fw-popover-content-wrapper').style.margin = `${this.popoverMargin}px`;
|
|
804
|
-
if (['left', 'right', 'before', 'after'].includes(position)) {
|
|
805
|
-
caret.style.top = `${triggerRect.top - caretRect.top - this.popoverMargin + (triggerRect.height / 2)}px`;
|
|
806
|
-
}
|
|
807
|
-
else {
|
|
808
|
-
caret.style.left = `${triggerRect.left - caretRect.left - this.popoverMargin + (triggerRect.width / 2)}px`;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
setPopoverPosition(positionChange) {
|
|
812
|
-
const position = this.positionMap[this.mainPosition] === positionChange.connectionPair
|
|
813
|
-
? this.mainPosition
|
|
814
|
-
: this.positionMap[this.fallbackPosition] === positionChange.connectionPair
|
|
815
|
-
? this.fallbackPosition
|
|
816
|
-
: this.mainPosition;
|
|
817
|
-
this.overlayRef.removePanelClass(['fw-popover-above', 'fw-popover-below', 'fw-popover-left', 'fw-popover-right']);
|
|
818
|
-
this.overlayRef.addPanelClass(`fw-popover-${position}`);
|
|
819
|
-
this.setPopoverCaretPosition(position);
|
|
820
|
-
}
|
|
821
|
-
getOverlay() {
|
|
822
|
-
if (!this.overlayRef) {
|
|
823
|
-
this.overlayRef = this.overlay.create({
|
|
824
|
-
positionStrategy: this.overlay.position()
|
|
825
|
-
.flexibleConnectedTo(this.element)
|
|
826
|
-
.withPositions(this.getPositions()),
|
|
827
|
-
panelClass: 'fw-popover-panel',
|
|
828
|
-
});
|
|
829
|
-
this.overlayRef.overlayElement.addEventListener('mouseleave', e => this.hidePopover(e));
|
|
830
|
-
this.subscriptions.positionChanges = this.overlayRef.getConfig().positionStrategy.positionChanges
|
|
831
|
-
.subscribe(positionChange => this.setPopoverPosition(positionChange));
|
|
832
|
-
}
|
|
833
|
-
return this.overlayRef;
|
|
834
|
-
}
|
|
835
|
-
getMainPosition() {
|
|
836
|
-
return this.mainPosition =
|
|
837
|
-
['left', 'before'].includes(this.position)
|
|
838
|
-
? 'left'
|
|
839
|
-
: ['right', 'after'].includes(this.position)
|
|
840
|
-
? 'right'
|
|
841
|
-
: this.position === 'above'
|
|
842
|
-
? 'above'
|
|
843
|
-
: 'below';
|
|
844
|
-
}
|
|
845
|
-
getFallbackPosition() {
|
|
846
|
-
return this.fallbackPosition =
|
|
847
|
-
['left', 'before'].includes(this.position)
|
|
848
|
-
? 'right'
|
|
849
|
-
: ['right', 'after'].includes(this.position)
|
|
850
|
-
? 'left'
|
|
851
|
-
: this.position === 'above'
|
|
852
|
-
? 'below'
|
|
853
|
-
: 'above';
|
|
854
|
-
}
|
|
855
|
-
getPositions() {
|
|
856
|
-
return [
|
|
857
|
-
// main position
|
|
858
|
-
this.positionMap[this.getMainPosition()],
|
|
859
|
-
// fallback position (inverse of main)
|
|
860
|
-
this.positionMap[this.getFallbackPosition()],
|
|
861
|
-
];
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
FwPopoverTriggerDirective.decorators = [
|
|
865
|
-
{ type: Directive, args: [{
|
|
866
|
-
host: {
|
|
867
|
-
'class': 'fw-popover-trigger',
|
|
868
|
-
'(mouseenter)': 'showPopover()',
|
|
869
|
-
'(mouseleave)': 'hidePopover($event)',
|
|
870
|
-
},
|
|
871
|
-
selector: '[fwPopoverTriggerFor]',
|
|
872
|
-
exportAs: 'fwPopoverTrigger',
|
|
873
|
-
},] }
|
|
874
|
-
];
|
|
875
|
-
FwPopoverTriggerDirective.ctorParameters = () => [
|
|
876
|
-
{ type: ElementRef },
|
|
877
|
-
{ type: Overlay },
|
|
878
|
-
{ type: ViewContainerRef }
|
|
879
|
-
];
|
|
880
|
-
FwPopoverTriggerDirective.propDecorators = {
|
|
881
|
-
popover: [{ type: Input, args: ['fwPopoverTriggerFor',] }],
|
|
882
|
-
position: [{ type: Input, args: ['fwPopoverPosition',] }]
|
|
883
|
-
};
|
|
884
|
-
|
|
885
|
-
class FwPopoverTriggerComponent extends FwPopoverTriggerDirective {
|
|
886
|
-
constructor(element, overlay, viewContainerRef) {
|
|
887
|
-
super(element, overlay, viewContainerRef);
|
|
888
|
-
this.element = element;
|
|
889
|
-
this.overlay = overlay;
|
|
890
|
-
this.viewContainerRef = viewContainerRef;
|
|
891
|
-
this.position = 'below';
|
|
892
|
-
}
|
|
893
|
-
showPopover() {
|
|
894
|
-
const overlay = this.getOverlay();
|
|
895
|
-
overlay.detach();
|
|
896
|
-
if (this.popoverId) {
|
|
897
|
-
// as a web component it is not possible to have a reference to this.popover
|
|
898
|
-
this.popoverHTML = document.querySelector(`fw-popover#${this.popoverId}`).innerHTML;
|
|
899
|
-
overlay.attach(new TemplatePortal(this.popoverTemplateRef, this.viewContainerRef));
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
FwPopoverTriggerComponent.decorators = [
|
|
904
|
-
{ type: Component, args: [{
|
|
905
|
-
host: {
|
|
906
|
-
'class': 'fw-popover-trigger',
|
|
907
|
-
'(mouseenter)': 'showPopover()',
|
|
908
|
-
'(mouseleave)': 'hidePopover($event)',
|
|
909
|
-
},
|
|
910
|
-
selector: 'fw-popover-trigger',
|
|
911
|
-
template: `<ng-content></ng-content>
|
|
912
|
-
<!-- for web component support -->
|
|
913
|
-
<ng-template>
|
|
914
|
-
<div [innerHTML]="popoverHTML"></div>
|
|
915
|
-
</ng-template>`
|
|
916
|
-
},] }
|
|
917
|
-
];
|
|
918
|
-
FwPopoverTriggerComponent.ctorParameters = () => [
|
|
919
|
-
{ type: ElementRef },
|
|
920
|
-
{ type: Overlay },
|
|
921
|
-
{ type: ViewContainerRef }
|
|
922
|
-
];
|
|
923
|
-
FwPopoverTriggerComponent.propDecorators = {
|
|
924
|
-
popoverId: [{ type: Input, args: ['trigger-for',] }],
|
|
925
|
-
position: [{ type: Input, args: ['position',] }],
|
|
926
|
-
popoverTemplateRef: [{ type: ViewChild, args: [TemplateRef,] }]
|
|
927
|
-
};
|
|
928
|
-
|
|
929
|
-
class FwPopoverComponent {
|
|
930
|
-
}
|
|
931
|
-
FwPopoverComponent.decorators = [
|
|
932
|
-
{ type: Component, args: [{
|
|
933
|
-
host: { 'class': 'fw-popover' },
|
|
934
|
-
selector: 'fw-popover',
|
|
935
|
-
template: `
|
|
936
|
-
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
937
|
-
<ng-template #content>
|
|
938
|
-
<div class="fw-popover-content-wrapper">
|
|
939
|
-
<ng-content></ng-content>
|
|
940
|
-
<div class="fw-popover-caret"></div>
|
|
941
|
-
</div>
|
|
942
|
-
</ng-template>`,
|
|
943
|
-
encapsulation: ViewEncapsulation.None,
|
|
944
|
-
styles: [".white{color:#fff!important}.fill-white{background-color:#fff!important}.border-top-white,.border-white{border-color:#fff!important}.border-top-white{border-top:1px solid}.border-right-white{border-right:1px solid;border-color:#fff!important}.border-bottom-white{border-bottom:1px solid;border-color:#fff!important}.border-left-white{border-left:1px solid;border-color:#fff!important}.black{color:#000!important}.fill-black{background-color:#000!important}.border-black,.border-top-black{border-color:#000!important}.border-top-black{border-top:1px solid}.border-right-black{border-right:1px solid;border-color:#000!important}.border-bottom-black{border-bottom:1px solid;border-color:#000!important}.border-left-black{border-left:1px solid;border-color:#000!important}.green{color:#59b96b!important}.fill-green{background-color:#59b96b!important}.border-green,.border-top-green{border-color:#59b96b!important}.border-top-green{border-top:1px solid}.border-right-green{border-right:1px solid;border-color:#59b96b!important}.border-bottom-green{border-bottom:1px solid;border-color:#59b96b!important}.border-left-green{border-left:1px solid;border-color:#59b96b!important}.orange{color:#f7941d!important}.fill-orange{background-color:#f7941d!important}.border-orange,.border-top-orange{border-color:#f7941d!important}.border-top-orange{border-top:1px solid}.border-right-orange{border-right:1px solid;border-color:#f7941d!important}.border-bottom-orange{border-bottom:1px solid;border-color:#f7941d!important}.border-left-orange{border-left:1px solid;border-color:#f7941d!important}.red{color:#de584c!important}.fill-red{background-color:#de584c!important}.border-red,.border-top-red{border-color:#de584c!important}.border-top-red{border-top:1px solid}.border-right-red{border-right:1px solid;border-color:#de584c!important}.border-bottom-red{border-bottom:1px solid;border-color:#de584c!important}.border-left-red{border-left:1px solid;border-color:#de584c!important}.light-red{color:#f8e5e4!important}.fill-light-red{background-color:#f8e5e4!important}.border-light-red,.border-top-light-red{border-color:#f8e5e4!important}.border-top-light-red{border-top:1px solid}.border-right-light-red{border-right:1px solid;border-color:#f8e5e4!important}.border-bottom-light-red{border-bottom:1px solid;border-color:#f8e5e4!important}.border-left-light-red{border-left:1px solid;border-color:#f8e5e4!important}.blue{color:#5871a2!important}.fill-blue{background-color:#5871a2!important}.border-blue,.border-top-blue{border-color:#5871a2!important}.border-top-blue{border-top:1px solid}.border-right-blue{border-right:1px solid;border-color:#5871a2!important}.border-bottom-blue{border-bottom:1px solid;border-color:#5871a2!important}.border-left-blue{border-left:1px solid;border-color:#5871a2!important}.focus-blue{color:#23527c!important}.fill-focus-blue{background-color:#23527c!important}.border-focus-blue,.border-top-focus-blue{border-color:#23527c!important}.border-top-focus-blue{border-top:1px solid}.border-right-focus-blue{border-right:1px solid;border-color:#23527c!important}.border-bottom-focus-blue{border-bottom:1px solid;border-color:#23527c!important}.border-left-focus-blue{border-left:1px solid;border-color:#23527c!important}.dark-blue{color:#394256!important}.fill-dark-blue{background-color:#394256!important}.border-dark-blue,.border-top-dark-blue{border-color:#394256!important}.border-top-dark-blue{border-top:1px solid}.border-right-dark-blue{border-right:1px solid;border-color:#394256!important}.border-bottom-dark-blue{border-bottom:1px solid;border-color:#394256!important}.border-left-dark-blue{border-left:1px solid;border-color:#394256!important}.light-blue{color:#e7effe!important}.fill-light-blue{background-color:#e7effe!important}.border-light-blue,.border-top-light-blue{border-color:#e7effe!important}.border-top-light-blue{border-top:1px solid}.border-right-light-blue{border-right:1px solid;border-color:#e7effe!important}.border-bottom-light-blue{border-bottom:1px solid;border-color:#e7effe!important}.border-left-light-blue{border-left:1px solid;border-color:#e7effe!important}.bright-blue{color:#1b68fa!important}.fill-bright-blue{background-color:#1b68fa!important}.border-bright-blue,.border-top-bright-blue{border-color:#1b68fa!important}.border-top-bright-blue{border-top:1px solid}.border-right-bright-blue{border-right:1px solid;border-color:#1b68fa!important}.border-bottom-bright-blue{border-bottom:1px solid;border-color:#1b68fa!important}.border-left-bright-blue{border-left:1px solid;border-color:#1b68fa!important}.admin-black{color:#01010a!important}.fill-admin-black{background-color:#01010a!important}.border-admin-black,.border-top-admin-black{border-color:#01010a!important}.border-top-admin-black{border-top:1px solid}.border-right-admin-black{border-right:1px solid;border-color:#01010a!important}.border-bottom-admin-black{border-bottom:1px solid;border-color:#01010a!important}.border-left-admin-black{border-left:1px solid;border-color:#01010a!important}.accent-purple{color:#b080fc!important}.fill-accent-purple{background-color:#b080fc!important}.border-accent-purple,.border-top-accent-purple{border-color:#b080fc!important}.border-top-accent-purple{border-top:1px solid}.border-right-accent-purple{border-right:1px solid;border-color:#b080fc!important}.border-bottom-accent-purple{border-bottom:1px solid;border-color:#b080fc!important}.border-left-accent-purple{border-left:1px solid;border-color:#b080fc!important}.grey{color:#58595b!important}.fill-grey{background-color:#58595b!important}.border-grey,.border-top-grey{border-color:#58595b!important}.border-top-grey{border-top:1px solid}.border-right-grey{border-right:1px solid;border-color:#58595b!important}.border-bottom-grey{border-bottom:1px solid;border-color:#58595b!important}.border-left-grey{border-left:1px solid;border-color:#58595b!important}.soft-grey{color:#dddede!important}.fill-soft-grey{background-color:#dddede!important}.border-soft-grey,.border-top-soft-grey{border-color:#dddede!important}.border-top-soft-grey{border-top:1px solid}.border-right-soft-grey{border-right:1px solid;border-color:#dddede!important}.border-bottom-soft-grey{border-bottom:1px solid;border-color:#dddede!important}.border-left-soft-grey{border-left:1px solid;border-color:#dddede!important}.light-grey{color:#eee!important}.fill-light-grey{background-color:#eee!important}.border-light-grey,.border-top-light-grey{border-color:#eee!important}.border-top-light-grey{border-top:1px solid}.border-right-light-grey{border-right:1px solid;border-color:#eee!important}.border-bottom-light-grey{border-bottom:1px solid;border-color:#eee!important}.border-left-light-grey{border-left:1px solid;border-color:#eee!important}.medium-grey{color:#ccc!important}.fill-medium-grey{background-color:#ccc!important}.border-medium-grey,.border-top-medium-grey{border-color:#ccc!important}.border-top-medium-grey{border-top:1px solid}.border-right-medium-grey{border-right:1px solid;border-color:#ccc!important}.border-bottom-medium-grey{border-bottom:1px solid;border-color:#ccc!important}.border-left-medium-grey{border-left:1px solid;border-color:#ccc!important}.medium-dark-grey{color:#999!important}.fill-medium-dark-grey{background-color:#999!important}.border-medium-dark-grey{border-color:#999!important}.border-top-medium-dark-grey{border-top:1px solid;border-color:#999!important}.border-right-medium-dark-grey{border-right:1px solid;border-color:#999!important}.border-bottom-medium-dark-grey{border-bottom:1px solid;border-color:#999!important}.border-left-medium-dark-grey{border-left:1px solid;border-color:#999!important}.dark-grey{color:#222!important}.fill-dark-grey{background-color:#222!important}.border-dark-grey,.border-top-dark-grey{border-color:#222!important}.border-top-dark-grey{border-top:1px solid}.border-right-dark-grey{border-right:1px solid;border-color:#222!important}.border-bottom-dark-grey{border-bottom:1px solid;border-color:#222!important}.border-left-dark-grey{border-left:1px solid;border-color:#222!important}.soft-blue{color:#eff1f5!important}.fill-soft-blue{background-color:#eff1f5!important}.border-soft-blue,.border-top-soft-blue{border-color:#eff1f5!important}.border-top-soft-blue{border-top:1px solid}.border-right-soft-blue{border-right:1px solid;border-color:#eff1f5!important}.border-bottom-soft-blue{border-bottom:1px solid;border-color:#eff1f5!important}.border-left-soft-blue{border-left:1px solid;border-color:#eff1f5!important}.dark-soft-blue{color:#e9ecf1!important}.fill-dark-soft-blue{background-color:#e9ecf1!important}.border-dark-soft-blue,.border-top-dark-soft-blue{border-color:#e9ecf1!important}.border-top-dark-soft-blue{border-top:1px solid}.border-right-dark-soft-blue{border-right:1px solid;border-color:#e9ecf1!important}.border-bottom-dark-soft-blue{border-bottom:1px solid;border-color:#e9ecf1!important}.border-left-dark-soft-blue{border-left:1px solid;border-color:#e9ecf1!important}.darker-soft-blue{color:#e6e9ef!important}.fill-darker-soft-blue{background-color:#e6e9ef!important}.border-darker-soft-blue,.border-top-darker-soft-blue{border-color:#e6e9ef!important}.border-top-darker-soft-blue{border-top:1px solid}.border-right-darker-soft-blue{border-right:1px solid;border-color:#e6e9ef!important}.border-bottom-darker-soft-blue{border-bottom:1px solid;border-color:#e6e9ef!important}.border-left-darker-soft-blue{border-left:1px solid;border-color:#e6e9ef!important}.light-soft-blue{color:#f5f6f9!important}.fill-light-soft-blue{background-color:#f5f6f9!important}.border-light-soft-blue,.border-top-light-soft-blue{border-color:#f5f6f9!important}.border-top-light-soft-blue{border-top:1px solid}.border-right-light-soft-blue{border-right:1px solid;border-color:#f5f6f9!important}.border-bottom-light-soft-blue{border-bottom:1px solid;border-color:#f5f6f9!important}.border-left-light-soft-blue{border-left:1px solid;border-color:#f5f6f9!important}.lighter-soft-blue{color:#f8f9fb!important}.fill-lighter-soft-blue{background-color:#f8f9fb!important}.border-lighter-soft-blue,.border-top-lighter-soft-blue{border-color:#f8f9fb!important}.border-top-lighter-soft-blue{border-top:1px solid}.border-right-lighter-soft-blue{border-right:1px solid;border-color:#f8f9fb!important}.border-bottom-lighter-soft-blue{border-bottom:1px solid;border-color:#f8f9fb!important}.border-left-lighter-soft-blue{border-left:1px solid;border-color:#f8f9fb!important}:root{--color-gray:var(--color-gray-100);--color-gray-50:#f6f7f8;--color-gray-100:#eff1f4;--color-gray-200:#e3e5e8;--color-gray-300:#d7d9dc;--color-gray-400:#cbcdcf;--color-gray-500:#bfc1c3;--color-primary:var(--color-primary-500);--color-primary-50:#e4edfe;--color-primary-100:#bbd2fe;--color-primary-200:#8db4fd;--color-primary-300:#5f95fc;--color-primary-400:#3d7ffb;--color-primary-500:#1b68fa;--color-primary-600:#1860f9;--color-primary-700:#1455f9;--color-primary-800:#104bf8;--color-primary-900:#083af6;--color-primary-A100:#fff;--color-primary-A200:#ebefff;--color-primary-A400:#b8c4ff;--color-primary-A700:#9fafff;--color-secondary:var(--color-secondary-500);--color-secondary-50:#ebf7ed;--color-secondary-100:#cdead3;--color-secondary-200:#acdcb5;--color-secondary-300:#8bce97;--color-secondary-400:#72c481;--color-secondary-500:#59b96b;--color-secondary-600:#51b263;--color-secondary-700:#48aa58;--color-secondary-800:#3ea24e;--color-secondary-900:#2e933c;--color-secondary-A100:#d9ffde;--color-secondary-A200:#a6ffb1;--color-secondary-A400:#73ff84;--color-secondary-A700:#59ff6e}fw-popover{display:none}.fw-popover-panel .fw-popover-content-wrapper{position:relative;background:#fff;border-radius:4px;box-shadow:0 1px 4px rgba(0,0,0,.15)!important;border:1px solid #d6dbe5;padding:16px}.fw-popover-panel .fw-popover-content-wrapper .fw-popover-caret{position:absolute;overflow:hidden;width:25px;height:25px}.fw-popover-panel .fw-popover-content-wrapper .fw-popover-caret:after{display:block;content:\"\";width:16px;height:16px;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.15)!important;border:1px solid #d6dbe5;transform:rotate(45deg);position:relative}.fw-popover-panel.fw-popover-above{margin-bottom:-20px;padding-bottom:20px}.fw-popover-panel.fw-popover-above .fw-popover-caret{left:0;bottom:-16px;height:16px}.fw-popover-panel.fw-popover-above .fw-popover-caret:after{margin:-8px auto}.fw-popover-panel.fw-popover-below{margin-top:-20px;padding-top:20px}.fw-popover-panel.fw-popover-below .fw-popover-caret{left:0;top:-16px;height:16px}.fw-popover-panel.fw-popover-below .fw-popover-caret:after{top:16px;margin:-8px auto}.fw-popover-panel.fw-popover-left{margin-right:-20px;padding-right:20px}.fw-popover-panel.fw-popover-left .fw-popover-caret{right:-16px;top:0;width:16px}.fw-popover-panel.fw-popover-left .fw-popover-caret:after{top:calc(50% - 8px);left:-8px}.fw-popover-panel.fw-popover-right{margin-left:-20px;padding-left:20px}.fw-popover-panel.fw-popover-right .fw-popover-caret{left:-16px;top:0;width:16px}.fw-popover-panel.fw-popover-right .fw-popover-caret:after{top:calc(50% - 8px);right:-8px}"]
|
|
945
|
-
},] }
|
|
946
|
-
];
|
|
947
|
-
FwPopoverComponent.propDecorators = {
|
|
948
|
-
templateRef: [{ type: ViewChild, args: ['content',] }]
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
class FwPopoverModule {
|
|
952
|
-
}
|
|
953
|
-
FwPopoverModule.decorators = [
|
|
954
|
-
{ type: NgModule, args: [{
|
|
955
|
-
imports: [
|
|
956
|
-
CommonModule,
|
|
957
|
-
],
|
|
958
|
-
exports: [
|
|
959
|
-
FwPopoverComponent,
|
|
960
|
-
FwPopoverTriggerComponent,
|
|
961
|
-
FwPopoverTriggerDirective,
|
|
962
|
-
],
|
|
963
|
-
declarations: [
|
|
964
|
-
FwPopoverComponent,
|
|
965
|
-
FwPopoverTriggerComponent,
|
|
966
|
-
FwPopoverTriggerDirective,
|
|
967
|
-
],
|
|
968
|
-
entryComponents: [
|
|
969
|
-
FwPopoverComponent,
|
|
970
|
-
FwPopoverTriggerComponent,
|
|
971
|
-
],
|
|
972
|
-
providers: [
|
|
973
|
-
Overlay,
|
|
974
|
-
],
|
|
975
|
-
},] }
|
|
976
|
-
];
|
|
977
|
-
|
|
978
|
-
class FwTableComponent {
|
|
979
|
-
constructor(changeDetectorRef) {
|
|
980
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
981
|
-
this.columns = [];
|
|
982
|
-
this.dataSource = [];
|
|
983
|
-
this.layout = 'basic';
|
|
984
|
-
this.pageSize = null;
|
|
985
|
-
this.webCompPageSize = null;
|
|
986
|
-
this.sort = null;
|
|
987
|
-
this.sortColumn = '';
|
|
988
|
-
this.sortOrder = 'asc';
|
|
989
|
-
this.displayedColumns = [];
|
|
990
|
-
this.filters = new FormGroup({});
|
|
991
|
-
// to support updating column header labels
|
|
992
|
-
this.trackByIndex = i => i;
|
|
993
|
-
}
|
|
994
|
-
ngOnInit() {
|
|
995
|
-
this.setDataSource();
|
|
996
|
-
this.setColumns();
|
|
997
|
-
this.addFilterControls();
|
|
998
|
-
this.setFilter();
|
|
999
|
-
this.matDataSource.filterPredicate = (row, filter) => {
|
|
1000
|
-
const filters = JSON.parse(filter);
|
|
1001
|
-
for (const filter in filters) {
|
|
1002
|
-
const filterValue = filters[filter];
|
|
1003
|
-
const rowValue = row[filter];
|
|
1004
|
-
// multi-select
|
|
1005
|
-
if (Array.isArray(filterValue) && filterValue.length > 0 && !filterValue.includes(rowValue)) {
|
|
1006
|
-
return false;
|
|
1007
|
-
}
|
|
1008
|
-
// input or select
|
|
1009
|
-
if (!Array.isArray(filterValue) && !String(rowValue).toLowerCase().includes(String(filterValue !== null && filterValue !== void 0 ? filterValue : '').toLowerCase())) {
|
|
1010
|
-
return false;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
return true;
|
|
1014
|
-
};
|
|
1015
|
-
this.filters.valueChanges.pipe(debounceTime(200)).subscribe(() => this.setFilter());
|
|
1016
|
-
}
|
|
1017
|
-
ngAfterViewInit() {
|
|
1018
|
-
this.setSort();
|
|
1019
|
-
this.setPaginator();
|
|
1020
|
-
}
|
|
1021
|
-
ngOnChanges(changes) {
|
|
1022
|
-
if (changes.columns) {
|
|
1023
|
-
this.setColumns();
|
|
1024
|
-
}
|
|
1025
|
-
if (changes.dataSource) {
|
|
1026
|
-
this.setDataSource();
|
|
1027
|
-
}
|
|
1028
|
-
if (changes.sort || changes.dataSource) {
|
|
1029
|
-
this.setSort();
|
|
1030
|
-
}
|
|
1031
|
-
if (changes.pageSize || changes['page-size']) {
|
|
1032
|
-
this.setPaginator();
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
get isCompact() {
|
|
1036
|
-
return this.layout === 'compact';
|
|
1037
|
-
}
|
|
1038
|
-
get paginationSize() {
|
|
1039
|
-
return this.pageSize || this.webCompPageSize || 0;
|
|
1040
|
-
}
|
|
1041
|
-
get isSortEnabled() {
|
|
1042
|
-
return this.sort !== null;
|
|
1043
|
-
}
|
|
1044
|
-
addFilterControls() {
|
|
1045
|
-
for (const column of this.columns) {
|
|
1046
|
-
this.filters.addControl(column.key, new FormControl());
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
setDataSource() {
|
|
1050
|
-
this.matDataSource = new MatTableDataSource(this.dataSource);
|
|
1051
|
-
}
|
|
1052
|
-
setColumns() {
|
|
1053
|
-
this.displayedColumns = this.columns.map(column => column.key);
|
|
1054
|
-
}
|
|
1055
|
-
setFilter() {
|
|
1056
|
-
this.matDataSource.filter = JSON.stringify(this.filters.value);
|
|
1057
|
-
}
|
|
1058
|
-
setSort() {
|
|
1059
|
-
if (!this.matSort || this.sort === null) {
|
|
1060
|
-
return;
|
|
1061
|
-
}
|
|
1062
|
-
const sortSplit = this.sort.split(' ');
|
|
1063
|
-
this.sortColumn = sortSplit[0];
|
|
1064
|
-
if (['asc', 'desc'].includes(sortSplit[1])) {
|
|
1065
|
-
this.sortOrder = sortSplit[1];
|
|
1066
|
-
}
|
|
1067
|
-
else {
|
|
1068
|
-
console.warn(`Sort order '${sortSplit[1]}' is not 'asc' or 'desc', defaulting to 'asc'`);
|
|
1069
|
-
}
|
|
1070
|
-
if (this.sortColumn) {
|
|
1071
|
-
this.matSort.sort({ id: this.sortColumn, start: this.sortOrder, disableClear: false });
|
|
1072
|
-
const sortHeader = this.matSort.sortables.get(this.sortColumn);
|
|
1073
|
-
if (sortHeader) {
|
|
1074
|
-
sortHeader._setAnimationTransitionState({ toState: 'active' });
|
|
1075
|
-
}
|
|
1076
|
-
else {
|
|
1077
|
-
console.warn(`Unable to find sort column '${this.sortColumn}'. Initial sort failed.`);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
this.matDataSource.sort = this.matSort;
|
|
1081
|
-
}
|
|
1082
|
-
setPaginator() {
|
|
1083
|
-
// ensures ui updates correctly when paginator options change
|
|
1084
|
-
this.changeDetectorRef.detectChanges();
|
|
1085
|
-
this.matDataSource.paginator = this.matPaginator;
|
|
1086
|
-
}
|
|
1087
|
-
// necessary for web component to trigger this.filter.valueChanges
|
|
1088
|
-
onInputFilter(event, column) {
|
|
1089
|
-
// defer setting filter control as event.target.value is not set yet
|
|
1090
|
-
setTimeout(() => this.filters.get(column.key).setValue(event.target.value));
|
|
1091
|
-
}
|
|
1092
|
-
// necessary for web component to trigger this.filter.valueChanges
|
|
1093
|
-
onSelectFilter(event, column) {
|
|
1094
|
-
const innerText = event.target.innerText;
|
|
1095
|
-
this.filters.get(column.key).setValue(innerText === '- none -' ? null : innerText);
|
|
1096
|
-
}
|
|
1097
|
-
// necessary for web component to trigger this.filter.valueChanges
|
|
1098
|
-
onMultiSelectFilter(event, column) {
|
|
1099
|
-
let value = this.filters.controls[column.key].value || [];
|
|
1100
|
-
const innerText = event.target.parentElement.innerText;
|
|
1101
|
-
if (value.includes(innerText)) {
|
|
1102
|
-
value = value.filter(v => v !== innerText);
|
|
1103
|
-
}
|
|
1104
|
-
else {
|
|
1105
|
-
value.push(innerText);
|
|
1106
|
-
}
|
|
1107
|
-
this.filters.get(column.key).setValue(value.length === 1 && innerText === ''
|
|
1108
|
-
? null // when all checboxes have been deselected
|
|
1109
|
-
: value);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
FwTableComponent.decorators = [
|
|
1113
|
-
{ type: Component, args: [{
|
|
1114
|
-
host: {
|
|
1115
|
-
'class': 'fw-table',
|
|
1116
|
-
'[class.compact]': 'isCompact',
|
|
1117
|
-
},
|
|
1118
|
-
selector: 'fw-table',
|
|
1119
|
-
template: "<table mat-table [dataSource]=\"matDataSource\" matSort>\n <ng-container *ngFor=\"let column of columns; trackBy: trackByIndex\">\n <ng-container [matColumnDef]=\"column.key\">\n\n <ng-template #tableHeaders>\n <ng-container [ngSwitch]=\"column.filter?.control\">\n <ng-container *ngSwitchCase=\"'input'\">\n <mat-form-field *ngIf=\"filters.get(column.key) as control\" appearance=\"outline\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"!isCompact\">{{ column.label }}</mat-label>\n <input matInput [formControl]=\"control\" [placeholder]=\"column.filter.placeholder\" (keydown)=\"$event.stopPropagation(); onInputFilter($event, column);\">\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"'select'\">\n <mat-form-field *ngIf=\"filters.get(column.key) as control\" appearance=\"outline\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"!isCompact\">{{ column.label }}</mat-label>\n <mat-select [formControl]=\"control\" [placeholder]=\"column.filter.placeholder\">\n <mat-option (click)=\"onSelectFilter($event, column);\">- none -</mat-option>\n <mat-option *ngFor=\"let option of column.filter.options\" [value]=\"option\" (click)=\"onSelectFilter($event, column);\">{{ option }}</mat-option>\n </mat-select>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchCase=\"'multi-select'\">\n <mat-form-field *ngIf=\"filters.get(column.key) as control\" appearance=\"outline\" (click)=\"$event.stopPropagation()\">\n <mat-label *ngIf=\"!isCompact\">{{ column.label }}</mat-label>\n <mat-select [formControl]=\"control\" [placeholder]=\"column.filter.placeholder\" multiple=\"true\">\n <mat-option *ngFor=\"let option of column.filter.options\" [value]=\"option\" (click)=\"onMultiSelectFilter($event, column);\">{{ option }}</mat-option>\n </mat-select>\n </mat-form-field>\n </ng-container>\n <ng-container *ngSwitchDefault>{{ column.label }}</ng-container>\n </ng-container>\n </ng-template>\n\n <ng-container *ngIf=\"isSortEnabled\">\n <th mat-header-cell *matHeaderCellDef mat-sort-header>\n <ng-container [ngTemplateOutlet]=\"tableHeaders\"></ng-container>\n </th>\n </ng-container>\n\n <ng-container *ngIf=\"!isSortEnabled\">\n <th mat-header-cell *matHeaderCellDef>\n <ng-container [ngTemplateOutlet]=\"tableHeaders\"></ng-container>\n </th>\n </ng-container>\n\n <td mat-cell *matCellDef=\"let element\"> {{ element[column.key] }} </td>\n </ng-container>\n </ng-container>\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns;\"></tr>\n</table>\n<mat-paginator *ngIf=\"paginationSize > 0\" [pageSize]=\"paginationSize\"></mat-paginator>\n\n\n\n",
|
|
1120
|
-
styles: [":host{display:block;width:100%}:host:not(.compact) table.mat-table tr.mat-header-row,:host:not(.compact) table.mat-table tr.mat-row{height:56px}:host.compact table.mat-table tr.mat-header-row,:host.compact table.mat-table tr.mat-row{height:32px}:host.compact mat-paginator.mat-paginator{align-items:center;display:flex;height:32px;justify-content:flex-end}table.mat-table{width:100%}table.mat-table td,table.mat-table th{vertical-align:middle}table.mat-table td.mat-cell,table.mat-table td.mat-header-cell,table.mat-table th.mat-cell,table.mat-table th.mat-header-cell{border-bottom-color:var(--color-gray)}"]
|
|
1121
|
-
},] }
|
|
1122
|
-
];
|
|
1123
|
-
FwTableComponent.ctorParameters = () => [
|
|
1124
|
-
{ type: ChangeDetectorRef }
|
|
1125
|
-
];
|
|
1126
|
-
FwTableComponent.propDecorators = {
|
|
1127
|
-
columns: [{ type: Input }],
|
|
1128
|
-
dataSource: [{ type: Input }],
|
|
1129
|
-
layout: [{ type: Input }],
|
|
1130
|
-
pageSize: [{ type: Input }],
|
|
1131
|
-
webCompPageSize: [{ type: Input, args: ['page-size',] }],
|
|
1132
|
-
sort: [{ type: Input }],
|
|
1133
|
-
matPaginator: [{ type: ViewChild, args: [MatPaginator,] }],
|
|
1134
|
-
matSort: [{ type: ViewChild, args: [MatSort,] }]
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
class FwTableModule {
|
|
1138
|
-
}
|
|
1139
|
-
FwTableModule.decorators = [
|
|
1140
|
-
{ type: NgModule, args: [{
|
|
1141
|
-
imports: [
|
|
1142
|
-
CommonModule,
|
|
1143
|
-
FormsModule,
|
|
1144
|
-
ReactiveFormsModule,
|
|
1145
|
-
MatInputModule,
|
|
1146
|
-
MatPaginatorModule,
|
|
1147
|
-
MatSelectModule,
|
|
1148
|
-
MatSortModule,
|
|
1149
|
-
MatTableModule,
|
|
1150
|
-
],
|
|
1151
|
-
exports: [
|
|
1152
|
-
FwTableComponent,
|
|
1153
|
-
],
|
|
1154
|
-
declarations: [
|
|
1155
|
-
FwTableComponent,
|
|
1156
|
-
],
|
|
1157
|
-
entryComponents: [
|
|
1158
|
-
FwTableComponent,
|
|
1159
|
-
]
|
|
1160
|
-
},] }
|
|
1161
|
-
];
|
|
1162
|
-
|
|
1163
|
-
/**
|
|
1164
|
-
* Generated bundle index. Do not edit.
|
|
1165
|
-
*/
|
|
1166
|
-
|
|
1167
|
-
export { FwButtonComponent, FwButtonGroupComponent, FwButtonGroupModule, FwButtonModule, FwChoiceDialog, FwConfirmDialog, FwDialogModule, FwDialogService, FwErrorDialog, FwNotificationComponent, FwNotificationContainerComponent, FwNotificationModule, FwNotificationService, FwNotificationType, FwPopoverComponent, FwPopoverModule, FwPopoverTriggerComponent, FwPopoverTriggerDirective, FwPortalDialog, FwTableComponent, FwTableModule, MinimalTranslationService, TranslationService, genId, ɵ0, PipesModule as ɵa, TranslatePipe as ɵb, TrustHtmlPipe as ɵc, FwNotificationTimerService as ɵd };
|
|
1168
|
-
//# sourceMappingURL=flywheel-io-vision.js.map
|