@ifsworld/granite-components 12.1.2 → 12.3.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/esm2022/index.mjs +4 -1
- package/esm2022/lib/file-upload/directives/file-drag-and-drop.directive.mjs +102 -0
- package/esm2022/lib/file-upload/file-upload.component.mjs +168 -0
- package/esm2022/lib/file-upload/file-upload.constants.mjs +39 -0
- package/esm2022/lib/file-upload/file-upload.module.mjs +21 -0
- package/esm2022/lib/file-upload/file-upload.utils.mjs +13 -0
- package/esm2022/lib/progress-bar/progress-bar-legend/progress-bar-legend.component.mjs +19 -0
- package/esm2022/lib/progress-bar/progress-bar-legend-base.mjs +20 -0
- package/esm2022/lib/progress-bar/progress-bar-legend-trigger-for.directive.mjs +191 -0
- package/esm2022/lib/progress-bar/progress-bar.component.mjs +18 -3
- package/esm2022/lib/progress-bar/progress-bar.model.mjs +2 -0
- package/esm2022/lib/progress-bar/progress-bar.module.mjs +29 -5
- package/fesm2022/ifsworld-granite-components.mjs +590 -23
- package/fesm2022/ifsworld-granite-components.mjs.map +1 -1
- package/index.d.ts +3 -0
- package/lib/file-upload/directives/file-drag-and-drop.directive.d.ts +18 -0
- package/lib/file-upload/file-upload.component.d.ts +48 -0
- package/lib/file-upload/file-upload.constants.d.ts +35 -0
- package/lib/file-upload/file-upload.module.d.ts +11 -0
- package/lib/file-upload/file-upload.utils.d.ts +1 -0
- package/lib/progress-bar/progress-bar-legend/progress-bar-legend.component.d.ts +8 -0
- package/lib/progress-bar/progress-bar-legend-base.d.ts +17 -0
- package/lib/progress-bar/progress-bar-legend-trigger-for.directive.d.ts +41 -0
- package/lib/progress-bar/progress-bar.component.d.ts +5 -8
- package/lib/progress-bar/progress-bar.model.d.ts +11 -0
- package/lib/progress-bar/progress-bar.module.d.ts +8 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
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, ContentChild, Pipe, inject } from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, Input, HostBinding, ContentChildren, NgModule, InjectionToken, Attribute, Inject, Optional, EventEmitter, QueryList, TemplateRef, Directive, ViewChild, Output, Self, HostListener, ContentChild, Pipe, ElementRef, inject } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DOCUMENT } from '@angular/common';
|
|
5
5
|
import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
@@ -13,13 +13,13 @@ import { trigger, state, style, transition, group, query, animate, sequence } fr
|
|
|
13
13
|
import * as i1 from '@angular/cdk/a11y';
|
|
14
14
|
import { FocusKeyManager, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';
|
|
15
15
|
import { hasModifierKey, SPACE, BACKSPACE, DELETE, ENTER, TAB } from '@angular/cdk/keycodes';
|
|
16
|
-
import * as
|
|
16
|
+
import * as i2 from '@angular/cdk/bidi';
|
|
17
17
|
import { normalizePassiveListenerOptions } from '@angular/cdk/platform';
|
|
18
|
-
import * as i2 from '@angular/cdk/collections';
|
|
18
|
+
import * as i2$1 from '@angular/cdk/collections';
|
|
19
19
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
20
|
-
import * as i2$
|
|
20
|
+
import * as i2$2 from '@angular/forms';
|
|
21
21
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
22
|
-
import * as i3
|
|
22
|
+
import * as i3 from '@ifsworld/granite-components/tooltip';
|
|
23
23
|
import { GraniteTooltipModule } from '@ifsworld/granite-components/tooltip';
|
|
24
24
|
|
|
25
25
|
class GraniteArrangeGridItemComponent {
|
|
@@ -1923,7 +1923,7 @@ class GraniteMenuTriggerForDirective {
|
|
|
1923
1923
|
? offset + target
|
|
1924
1924
|
: target * (-Math.pow(2, (-10 * current) / end) + 1) + offset;
|
|
1925
1925
|
}
|
|
1926
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteMenuTriggerForDirective, deps: [{ token: i1$2.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { 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:
|
|
1926
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteMenuTriggerForDirective, deps: [{ token: i1$2.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { 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: i2.Directionality, optional: true }, { token: i1.FocusMonitor }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1927
1927
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.4", 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": "isMenuOpened || null", "attr.aria-controls": "isMenuOpened ? menu.panelId : null" }, classAttribute: "granite-menu-trigger" }, exportAs: ["graniteMenuTriggerFor"], usesOnChanges: true, ngImport: i0 }); }
|
|
1928
1928
|
}
|
|
1929
1929
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteMenuTriggerForDirective, decorators: [{
|
|
@@ -1960,7 +1960,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
1960
1960
|
type: Optional
|
|
1961
1961
|
}, {
|
|
1962
1962
|
type: Self
|
|
1963
|
-
}] }, { type:
|
|
1963
|
+
}] }, { type: i2.Directionality, decorators: [{
|
|
1964
1964
|
type: Optional
|
|
1965
1965
|
}] }, { type: i1.FocusMonitor }, { type: undefined, decorators: [{
|
|
1966
1966
|
type: Inject,
|
|
@@ -2348,7 +2348,7 @@ class GraniteRadioButtonComponent {
|
|
|
2348
2348
|
_getInputElement() {
|
|
2349
2349
|
return this._inputElement.nativeElement;
|
|
2350
2350
|
}
|
|
2351
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteRadioButtonComponent, deps: [{ token: i1.FocusMonitor }, { token: i2.UniqueSelectionDispatcher }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2351
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteRadioButtonComponent, deps: [{ token: i1.FocusMonitor }, { token: i2$1.UniqueSelectionDispatcher }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2352
2352
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", 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 }); }
|
|
2353
2353
|
}
|
|
2354
2354
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteRadioButtonComponent, decorators: [{
|
|
@@ -2360,7 +2360,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
2360
2360
|
'[class.granite-radio-button-checked]': 'checked',
|
|
2361
2361
|
'[class.granite-radio-button-readonly]': 'readonly',
|
|
2362
2362
|
}, 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"] }]
|
|
2363
|
-
}], ctorParameters: () => [{ type: i1.FocusMonitor }, { type: i2.UniqueSelectionDispatcher }], propDecorators: { value: [{
|
|
2363
|
+
}], ctorParameters: () => [{ type: i1.FocusMonitor }, { type: i2$1.UniqueSelectionDispatcher }], propDecorators: { value: [{
|
|
2364
2364
|
type: Input
|
|
2365
2365
|
}], id: [{
|
|
2366
2366
|
type: Input
|
|
@@ -3618,7 +3618,7 @@ class GraniteChipListComponent extends GraniteChipListBase {
|
|
|
3618
3618
|
});
|
|
3619
3619
|
}
|
|
3620
3620
|
}
|
|
3621
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteChipListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token:
|
|
3621
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteChipListComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i2.Directionality, optional: true }, { token: i2$2.NgForm, optional: true }, { token: i2$2.FormGroupDirective, optional: true }, { token: i2$2.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3622
3622
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: GraniteChipListComponent, selector: "granite-chip-list", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], ariaOrientation: ["aria-orientation", "ariaOrientation"], role: "role", multiselect: "multiselect", disabled: "disabled", selectable: "selectable", tabindex: "tabindex" }, 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: [":host.granite-chip-list{display:flex;flex-direction:row;flex-wrap:wrap;place-content:center flex-start;align-items: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}:host ::ng-deep input.granite-chip-input{outline:none;border:none;background-color:transparent;color:var(--granite-color-text);margin:var(--granite-spacing-4)}:host ::ng-deep granite-icon{color:var(--granite-color-text);background-color:transparent}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3623
3623
|
}
|
|
3624
3624
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteChipListComponent, decorators: [{
|
|
@@ -3638,13 +3638,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
3638
3638
|
'(blur)': '_blur()',
|
|
3639
3639
|
'(keydown)': '_keydown($event)',
|
|
3640
3640
|
}, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host.granite-chip-list{display:flex;flex-direction:row;flex-wrap:wrap;place-content:center flex-start;align-items: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}:host ::ng-deep input.granite-chip-input{outline:none;border:none;background-color:transparent;color:var(--granite-color-text);margin:var(--granite-spacing-4)}:host ::ng-deep granite-icon{color:var(--granite-color-text);background-color:transparent}\n"] }]
|
|
3641
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type:
|
|
3641
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i2.Directionality, decorators: [{
|
|
3642
3642
|
type: Optional
|
|
3643
|
-
}] }, { type: i2$
|
|
3643
|
+
}] }, { type: i2$2.NgForm, decorators: [{
|
|
3644
3644
|
type: Optional
|
|
3645
|
-
}] }, { type: i2$
|
|
3645
|
+
}] }, { type: i2$2.FormGroupDirective, decorators: [{
|
|
3646
3646
|
type: Optional
|
|
3647
|
-
}] }, { type: i2$
|
|
3647
|
+
}] }, { type: i2$2.NgControl, decorators: [{
|
|
3648
3648
|
type: Optional
|
|
3649
3649
|
}, {
|
|
3650
3650
|
type: Self
|
|
@@ -4312,7 +4312,7 @@ class GraniteContactsTriggerForDirective {
|
|
|
4312
4312
|
_touchPositionStrategy() {
|
|
4313
4313
|
return this._overlay.position().global();
|
|
4314
4314
|
}
|
|
4315
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteContactsTriggerForDirective, deps: [{ token: i1$2.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i1$2.OverlayOutsideClickDispatcher }, { token: GRANITE_CLIENT_INPUT, optional: true }, { token: GRANITE_CLIENT_OUTPUT, optional: true }, { token:
|
|
4315
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteContactsTriggerForDirective, deps: [{ token: i1$2.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i1$2.OverlayOutsideClickDispatcher }, { token: GRANITE_CLIENT_INPUT, optional: true }, { token: GRANITE_CLIENT_OUTPUT, optional: true }, { token: i2.Directionality, optional: true }, { token: i1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4316
4316
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.4", type: GraniteContactsTriggerForDirective, selector: "[graniteContactsTriggerFor]", inputs: { contacts: ["graniteContactsTriggerFor", "contacts"] }, host: { attributes: { "aria-haspopup": "true" }, listeners: { "keydown": "_handleKeydown($event)", "click": "_handleClick($event)" }, properties: { "attr.aria-expanded": "_isContactsOpen || null", "attr.aria-controls": "_isContactsOpen ? contacts.panelId : null" }, classAttribute: "granite-contacts-trigger" }, ngImport: i0 }); }
|
|
4317
4317
|
}
|
|
4318
4318
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteContactsTriggerForDirective, decorators: [{
|
|
@@ -4338,7 +4338,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
4338
4338
|
args: [GRANITE_CLIENT_OUTPUT]
|
|
4339
4339
|
}, {
|
|
4340
4340
|
type: Optional
|
|
4341
|
-
}] }, { type:
|
|
4341
|
+
}] }, { type: i2.Directionality, decorators: [{
|
|
4342
4342
|
type: Optional
|
|
4343
4343
|
}] }, { type: i1.FocusMonitor }], propDecorators: { contacts: [{
|
|
4344
4344
|
type: Input,
|
|
@@ -4464,15 +4464,230 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
4464
4464
|
}]
|
|
4465
4465
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }] });
|
|
4466
4466
|
|
|
4467
|
+
let legendPanelUid = 0;
|
|
4468
|
+
class LegendBaseComponent {
|
|
4469
|
+
constructor() {
|
|
4470
|
+
this.xPosition = 'after';
|
|
4471
|
+
this.yPosition = 'below';
|
|
4472
|
+
this.panelId = `granite-progress-bar-legend-panel-${legendPanelUid++}`;
|
|
4473
|
+
}
|
|
4474
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: LegendBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4475
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.4", type: LegendBaseComponent, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 }); }
|
|
4476
|
+
}
|
|
4477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: LegendBaseComponent, decorators: [{
|
|
4478
|
+
type: Directive,
|
|
4479
|
+
args: [{}]
|
|
4480
|
+
}], propDecorators: { templateRef: [{
|
|
4481
|
+
type: ViewChild,
|
|
4482
|
+
args: [TemplateRef]
|
|
4483
|
+
}] } });
|
|
4484
|
+
|
|
4485
|
+
class GraniteProgressBarLegendComponent extends LegendBaseComponent {
|
|
4486
|
+
constructor() {
|
|
4487
|
+
super(...arguments);
|
|
4488
|
+
this.legendItems = [];
|
|
4489
|
+
}
|
|
4490
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarLegendComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4491
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: GraniteProgressBarLegendComponent, selector: "granite-progress-bar-legend", inputs: { legendItems: "legendItems" }, usesInheritance: true, ngImport: i0, template: "<ng-template>\n <div class=\"legend\" data-fnd=\"legend\">\n <div\n *ngFor=\"let item of legendItems\"\n class=\"legend-item\"\n data-fnd=\"legend-item\"\n >\n <div class=\"legend-label-text\">{{ item.label }}</div>\n <div\n [style.background-color]=\"item.backgroundColor\"\n class=\"color-box\"\n ></div>\n </div>\n </div>\n</ng-template>\n", styles: [".legend{display:flex;flex-direction:column;align-items:flex-start;padding:var(--granite-spacing-8);margin-top:var(--granite-spacing-4);gap:var(--granite-spacing-8);background-color:var(--granite-color-background-page);border:solid var(--granite-border-width-regular) var(--granite-color-border-contrast);border-radius:var(--granite-radius-s)}.legend-item{display:flex;align-items:center;justify-content:space-between;align-self:stretch;flex-wrap:wrap;padding:0 var(--granite-spacing-4);gap:var(--granite-spacing-8)}.legend-label-text{font-size:var(--granite-font-size-body-small);line-height:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);color:var(--granite-color-text);width:max-content}.color-box{width:8px;height:8px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4492
|
+
}
|
|
4493
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarLegendComponent, decorators: [{
|
|
4494
|
+
type: Component,
|
|
4495
|
+
args: [{ selector: 'granite-progress-bar-legend', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template>\n <div class=\"legend\" data-fnd=\"legend\">\n <div\n *ngFor=\"let item of legendItems\"\n class=\"legend-item\"\n data-fnd=\"legend-item\"\n >\n <div class=\"legend-label-text\">{{ item.label }}</div>\n <div\n [style.background-color]=\"item.backgroundColor\"\n class=\"color-box\"\n ></div>\n </div>\n </div>\n</ng-template>\n", styles: [".legend{display:flex;flex-direction:column;align-items:flex-start;padding:var(--granite-spacing-8);margin-top:var(--granite-spacing-4);gap:var(--granite-spacing-8);background-color:var(--granite-color-background-page);border:solid var(--granite-border-width-regular) var(--granite-color-border-contrast);border-radius:var(--granite-radius-s)}.legend-item{display:flex;align-items:center;justify-content:space-between;align-self:stretch;flex-wrap:wrap;padding:0 var(--granite-spacing-4);gap:var(--granite-spacing-8)}.legend-label-text{font-size:var(--granite-font-size-body-small);line-height:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);color:var(--granite-color-text);width:max-content}.color-box{width:8px;height:8px}\n"] }]
|
|
4496
|
+
}], propDecorators: { legendItems: [{
|
|
4497
|
+
type: Input
|
|
4498
|
+
}] } });
|
|
4499
|
+
|
|
4500
|
+
class GraniteProgressBarLegendTriggerForDirective {
|
|
4501
|
+
constructor(_overlay, _element, _viewContainerRef, _outsideClickDispatcher,
|
|
4502
|
+
/** Client input device information */
|
|
4503
|
+
_clientInput,
|
|
4504
|
+
/** Client output device information */
|
|
4505
|
+
_clientOutput, _dir, _focusMonitor) {
|
|
4506
|
+
this._overlay = _overlay;
|
|
4507
|
+
this._element = _element;
|
|
4508
|
+
this._viewContainerRef = _viewContainerRef;
|
|
4509
|
+
this._outsideClickDispatcher = _outsideClickDispatcher;
|
|
4510
|
+
this._clientInput = _clientInput;
|
|
4511
|
+
this._clientOutput = _clientOutput;
|
|
4512
|
+
this._dir = _dir;
|
|
4513
|
+
this._focusMonitor = _focusMonitor;
|
|
4514
|
+
this._isLegendOpen = false;
|
|
4515
|
+
this._portal = null;
|
|
4516
|
+
this._overlayRef = null;
|
|
4517
|
+
}
|
|
4518
|
+
ngOnDestroy() {
|
|
4519
|
+
if (this._overlayRef) {
|
|
4520
|
+
this._overlayRef.dispose();
|
|
4521
|
+
this._overlayRef = null;
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
openLegend() {
|
|
4525
|
+
if (this._isLegendOpen) {
|
|
4526
|
+
return;
|
|
4527
|
+
}
|
|
4528
|
+
this.legend.direction = this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
|
4529
|
+
this.legend.clientInput = this._clientInput;
|
|
4530
|
+
this.legend.clientOutput = this._clientOutput;
|
|
4531
|
+
const panelClass = [];
|
|
4532
|
+
if (this._clientOutput?.device === 'touch') {
|
|
4533
|
+
panelClass.push('granite-overlay-pane-center');
|
|
4534
|
+
}
|
|
4535
|
+
const scrollStrategy = this._clientOutput?.device !== 'touch'
|
|
4536
|
+
? this._overlay.scrollStrategies.reposition()
|
|
4537
|
+
: this._overlay.scrollStrategies.block();
|
|
4538
|
+
const hasBackdrop = this._clientOutput?.device === 'touch';
|
|
4539
|
+
if (!this._overlayRef) {
|
|
4540
|
+
const config = new OverlayConfig({
|
|
4541
|
+
positionStrategy: this._positionStrategy(),
|
|
4542
|
+
backdropClass: 'granite-overlay-dark-glass-backdrop',
|
|
4543
|
+
scrollStrategy,
|
|
4544
|
+
direction: this._dir,
|
|
4545
|
+
panelClass,
|
|
4546
|
+
hasBackdrop,
|
|
4547
|
+
});
|
|
4548
|
+
this._overlayRef = this._overlay.create(config);
|
|
4549
|
+
}
|
|
4550
|
+
if (!this._portal || this._portal.templateRef !== this.legend.templateRef) {
|
|
4551
|
+
this._portal = new TemplatePortal(this.legend.templateRef, this._viewContainerRef);
|
|
4552
|
+
}
|
|
4553
|
+
this._overlayRef.attach(this._portal);
|
|
4554
|
+
this._outsideClickDispatcher.add(this._overlayRef);
|
|
4555
|
+
this._overlayRef.outsidePointerEvents().subscribe((event) => {
|
|
4556
|
+
event.stopPropagation();
|
|
4557
|
+
this.closeLegend();
|
|
4558
|
+
});
|
|
4559
|
+
this._isLegendOpen = true;
|
|
4560
|
+
}
|
|
4561
|
+
toggleLegend() {
|
|
4562
|
+
if (this._isLegendOpen) {
|
|
4563
|
+
this.closeLegend();
|
|
4564
|
+
}
|
|
4565
|
+
else {
|
|
4566
|
+
this.openLegend();
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
closeLegend() {
|
|
4570
|
+
if (!this._overlayRef || !this._isLegendOpen) {
|
|
4571
|
+
return;
|
|
4572
|
+
}
|
|
4573
|
+
this._outsideClickDispatcher.remove(this._overlayRef);
|
|
4574
|
+
this._overlayRef.detach();
|
|
4575
|
+
this._restoreFocus();
|
|
4576
|
+
this._isLegendOpen = false;
|
|
4577
|
+
}
|
|
4578
|
+
_handleKeydown(event) {
|
|
4579
|
+
if (event.key === 'Enter') {
|
|
4580
|
+
event.preventDefault();
|
|
4581
|
+
this.toggleLegend();
|
|
4582
|
+
}
|
|
4583
|
+
}
|
|
4584
|
+
_handleClick() {
|
|
4585
|
+
this.toggleLegend();
|
|
4586
|
+
}
|
|
4587
|
+
_restoreFocus(origin = 'program', options) {
|
|
4588
|
+
if (this._focusMonitor) {
|
|
4589
|
+
this._focusMonitor.focusVia(this._element, origin, options);
|
|
4590
|
+
}
|
|
4591
|
+
else {
|
|
4592
|
+
this._element.nativeElement.focus(options);
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
_desktopPositionStrategy() {
|
|
4596
|
+
const positionStrategy = this._overlay
|
|
4597
|
+
.position()
|
|
4598
|
+
.flexibleConnectedTo(this._element)
|
|
4599
|
+
.withLockedPosition()
|
|
4600
|
+
.withTransformOriginOn('.granite-progress-bar-legend')
|
|
4601
|
+
.withPush(false);
|
|
4602
|
+
this._setPosition(positionStrategy);
|
|
4603
|
+
return positionStrategy;
|
|
4604
|
+
}
|
|
4605
|
+
_setPosition(positionStrategy) {
|
|
4606
|
+
const [originX, originFallbackX] = this.legend.xPosition === 'before' ? ['end', 'start'] : ['start', 'end'];
|
|
4607
|
+
const [overlayY, overlayFallbackY] = this.legend.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom'];
|
|
4608
|
+
let [originY, originFallbackY] = [overlayY, overlayFallbackY];
|
|
4609
|
+
const [overlayX, overlayFallbackX] = [originX, originFallbackX];
|
|
4610
|
+
const offsetY = 0;
|
|
4611
|
+
originY = overlayY === 'top' ? 'bottom' : 'top';
|
|
4612
|
+
originFallbackY = overlayFallbackY === 'top' ? 'bottom' : 'top';
|
|
4613
|
+
positionStrategy.withPositions([
|
|
4614
|
+
{ originX, originY, overlayX, overlayY, offsetY },
|
|
4615
|
+
{
|
|
4616
|
+
originX: originFallbackX,
|
|
4617
|
+
originY,
|
|
4618
|
+
overlayX: overlayFallbackX,
|
|
4619
|
+
overlayY,
|
|
4620
|
+
offsetY,
|
|
4621
|
+
},
|
|
4622
|
+
{
|
|
4623
|
+
originX,
|
|
4624
|
+
originY: originFallbackY,
|
|
4625
|
+
overlayX,
|
|
4626
|
+
overlayY: overlayFallbackY,
|
|
4627
|
+
offsetY: -offsetY,
|
|
4628
|
+
},
|
|
4629
|
+
{
|
|
4630
|
+
originX: originFallbackX,
|
|
4631
|
+
originY: originFallbackY,
|
|
4632
|
+
overlayX: overlayFallbackX,
|
|
4633
|
+
overlayY: overlayFallbackY,
|
|
4634
|
+
offsetY: -offsetY,
|
|
4635
|
+
},
|
|
4636
|
+
]);
|
|
4637
|
+
}
|
|
4638
|
+
_positionStrategy() {
|
|
4639
|
+
if (this._clientOutput?.device !== 'touch') {
|
|
4640
|
+
return this._desktopPositionStrategy();
|
|
4641
|
+
}
|
|
4642
|
+
return this._touchPositionStrategy();
|
|
4643
|
+
}
|
|
4644
|
+
_touchPositionStrategy() {
|
|
4645
|
+
return this._overlay.position().global();
|
|
4646
|
+
}
|
|
4647
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarLegendTriggerForDirective, deps: [{ token: i1$2.Overlay }, { token: i0.ElementRef }, { token: i0.ViewContainerRef }, { token: i1$2.OverlayOutsideClickDispatcher }, { token: GRANITE_CLIENT_INPUT, optional: true }, { token: GRANITE_CLIENT_OUTPUT, optional: true }, { token: i2.Directionality, optional: true }, { token: i1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
4648
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.4", type: GraniteProgressBarLegendTriggerForDirective, selector: "[graniteProgressBarLegendTriggerFor]", inputs: { legend: ["graniteProgressBarLegendTriggerFor", "legend"] }, host: { attributes: { "aria-haspopup": "true" }, listeners: { "keydown": "_handleKeydown($event)", "click": "_handleClick($event)" }, properties: { "attr.aria-expanded": "_isLegendOpen || null", "attr.aria-controls": "_isLegendOpen ? legend.panelId : null" }, classAttribute: "granite-progress-bar-legend-trigger" }, ngImport: i0 }); }
|
|
4649
|
+
}
|
|
4650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarLegendTriggerForDirective, decorators: [{
|
|
4651
|
+
type: Directive,
|
|
4652
|
+
args: [{
|
|
4653
|
+
selector: '[graniteProgressBarLegendTriggerFor]',
|
|
4654
|
+
host: {
|
|
4655
|
+
class: 'granite-progress-bar-legend-trigger',
|
|
4656
|
+
'aria-haspopup': 'true',
|
|
4657
|
+
'[attr.aria-expanded]': '_isLegendOpen || null',
|
|
4658
|
+
'[attr.aria-controls]': '_isLegendOpen ? legend.panelId : null',
|
|
4659
|
+
'(keydown)': '_handleKeydown($event)',
|
|
4660
|
+
'(click)': '_handleClick($event)',
|
|
4661
|
+
},
|
|
4662
|
+
}]
|
|
4663
|
+
}], ctorParameters: () => [{ type: i1$2.Overlay }, { type: i0.ElementRef }, { type: i0.ViewContainerRef }, { type: i1$2.OverlayOutsideClickDispatcher }, { type: undefined, decorators: [{
|
|
4664
|
+
type: Inject,
|
|
4665
|
+
args: [GRANITE_CLIENT_INPUT]
|
|
4666
|
+
}, {
|
|
4667
|
+
type: Optional
|
|
4668
|
+
}] }, { type: undefined, decorators: [{
|
|
4669
|
+
type: Inject,
|
|
4670
|
+
args: [GRANITE_CLIENT_OUTPUT]
|
|
4671
|
+
}, {
|
|
4672
|
+
type: Optional
|
|
4673
|
+
}] }, { type: i2.Directionality, decorators: [{
|
|
4674
|
+
type: Optional
|
|
4675
|
+
}] }, { type: i1.FocusMonitor }], propDecorators: { legend: [{
|
|
4676
|
+
type: Input,
|
|
4677
|
+
args: ['graniteProgressBarLegendTriggerFor']
|
|
4678
|
+
}] } });
|
|
4679
|
+
|
|
4467
4680
|
class GraniteProgressBarComponent {
|
|
4468
4681
|
constructor() {
|
|
4469
4682
|
this.progressBarData = [];
|
|
4470
4683
|
this.showLabel = false;
|
|
4684
|
+
this.showLegend = false;
|
|
4471
4685
|
this.DEFAULT_TOTAL = 100;
|
|
4472
4686
|
this.DEFAULT_BACKGROUND = '--granite-color-background-selected';
|
|
4473
4687
|
this.DEFAULT_STACK_COLOR = '--granite-color-categorical-3';
|
|
4474
4688
|
this.DEFAULT_COLOR = '--granite-color-text';
|
|
4475
4689
|
this.total = this.DEFAULT_TOTAL;
|
|
4690
|
+
this.legendItems = [];
|
|
4476
4691
|
}
|
|
4477
4692
|
getBackgroundColor() {
|
|
4478
4693
|
return this.getColorVar(this.DEFAULT_BACKGROUND);
|
|
@@ -4505,23 +4720,32 @@ class GraniteProgressBarComponent {
|
|
|
4505
4720
|
getStackTotal() {
|
|
4506
4721
|
return this.progressBarData.reduce((acc, curr) => acc + curr.value, 0);
|
|
4507
4722
|
}
|
|
4723
|
+
setLegendItems() {
|
|
4724
|
+
this.legendItems = this.progressBarData.map(({ label, backgroundColor }) => {
|
|
4725
|
+
const legendItemColor = this.getStackColor(backgroundColor);
|
|
4726
|
+
return { label, backgroundColor: legendItemColor };
|
|
4727
|
+
});
|
|
4728
|
+
}
|
|
4508
4729
|
ngOnChanges(changes) {
|
|
4509
4730
|
if (changes.progressBarData &&
|
|
4510
4731
|
JSON.stringify(changes.progressBarData.currentValue) !==
|
|
4511
4732
|
JSON.stringify(changes.progressBarData.previousValue)) {
|
|
4512
4733
|
this.checkStackTotal();
|
|
4734
|
+
this.setLegendItems();
|
|
4513
4735
|
}
|
|
4514
4736
|
}
|
|
4515
4737
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4516
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: GraniteProgressBarComponent, selector: "granite-progress-bar", inputs: { progressBarData: "progressBarData", showLabel: "showLabel" }, exportAs: ["graniteProgressBar"], usesOnChanges: true, ngImport: i0, template: "<div\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n class=\"progress\"\n [style.background-color]=\"getBackgroundColor()\"\n>\n <div\n *ngFor=\"let bar of progressBarData; let i = index\"\n [style.background-color]=\"getStackColor(bar.backgroundColor)\"\n [style.width]=\"getStringOfWidth(getWidth(bar.value))\"\n [style.color]=\"getFontColor(bar.foregroundColor)\"\n [graniteTooltipTriggerFor]=\"tooltip\"\n class=\"progress-bar\"\n >\n <label *ngIf=\"showLabel\" graniteHideOnOverflow>{{ bar.valueLabel }}</label>\n <granite-tooltip #tooltip> {{ bar.valueLabel }} </granite-tooltip>\n </div>\n</div>\n", styles: [":host{width:100%;height:.5rem;line-height:.5rem;box-sizing:border-box;border-radius:var(--granite-radius-s);font-size:.25rem}.progress{display:flex;width:inherit;height:inherit;overflow:hidden;border-radius:inherit;background-color:var(--granite-color-background-selected)}.progress-bar{display:flex;align-items:center;box-sizing:border-box;width:inherit;height:inherit;line-height:inherit;font-size:inherit;vertical-align:middle;text-overflow:ellipsis;white-space:nowrap;color:var(--granite-color-text);overflow:hidden;text-align:center;justify-content:center}.progress-bar label{width:100%}.progress-bar:last-child{justify-content:flex-end;text-align:end;padding-inline-end:var(--granite-spacing-16)}.progress-bar:first-child{justify-content:flex-start;text-align:start;padding-inline-start:var(--granite-spacing-16)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: GraniteHideOnOverflowDirective, selector: "[graniteHideOnOverflow]", exportAs: ["graniteHideOnOverflow"] }, { kind: "component", type: i3
|
|
4738
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: GraniteProgressBarComponent, selector: "granite-progress-bar", inputs: { progressBarData: "progressBarData", showLabel: "showLabel", showLegend: "showLegend" }, exportAs: ["graniteProgressBar"], usesOnChanges: true, ngImport: i0, template: "<div\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n class=\"progress\"\n [style.background-color]=\"getBackgroundColor()\"\n>\n <div\n *ngFor=\"let bar of progressBarData; let i = index\"\n [style.background-color]=\"getStackColor(bar.backgroundColor)\"\n [style.width]=\"getStringOfWidth(getWidth(bar.value))\"\n [style.color]=\"getFontColor(bar.foregroundColor)\"\n [graniteTooltipTriggerFor]=\"tooltip\"\n class=\"progress-bar\"\n >\n <label *ngIf=\"showLabel\" graniteHideOnOverflow>{{ bar.valueLabel }}</label>\n <granite-tooltip #tooltip> {{ bar.valueLabel }} </granite-tooltip>\n </div>\n</div>\n\n<ng-container *ngIf=\"showLegend\">\n <button\n graniteFlatButton\n [graniteProgressBarLegendTriggerFor]=\"legend\"\n class=\"legend-btn\"\n >\n <granite-icon>caret-down</granite-icon>\n </button>\n</ng-container>\n\n<granite-progress-bar-legend\n #legend\n [legendItems]=\"legendItems\"\n></granite-progress-bar-legend>\n", styles: [":host{width:100%;display:flex;align-items:center;gap:var(--granite-spacing-16);height:.5rem;line-height:.5rem;box-sizing:border-box;border-radius:var(--granite-radius-s);font-size:.25rem}.progress{display:flex;width:inherit;height:inherit;overflow:hidden;border-radius:inherit;background-color:var(--granite-color-background-selected)}.progress-bar{display:flex;align-items:center;box-sizing:border-box;width:inherit;height:inherit;line-height:inherit;font-size:inherit;vertical-align:middle;text-overflow:ellipsis;white-space:nowrap;color:var(--granite-color-text);overflow:hidden;text-align:center;justify-content:center}.progress-bar label{width:100%}.progress-bar:last-child{justify-content:flex-end;text-align:end;padding-inline-end:var(--granite-spacing-16)}.progress-bar:first-child{justify-content:flex-start;text-align:start;padding-inline-start:var(--granite-spacing-16)}.legend-btn{width:16px;height:16px}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: GraniteHideOnOverflowDirective, selector: "[graniteHideOnOverflow]", exportAs: ["graniteHideOnOverflow"] }, { kind: "component", type: i3.GraniteTooltipComponent, selector: "granite-tooltip" }, { kind: "directive", type: i3.GraniteTooltipTriggerForDirective, selector: "[graniteTooltipTriggerFor]", inputs: ["graniteTooltipTriggerFor", "hideDelay", "showDelay", "showOnKeyboardFocus", "showOnClick"] }, { kind: "component", type: GraniteIconComponent, selector: "granite-icon", inputs: ["fontIcon"] }, { kind: "component", type: GraniteButtonComponent, selector: "button[graniteButton],\n button[granitePrimaryButton],\n button[graniteFlatButton],\n button[graniteToolbarButton]\n ", inputs: ["disabled", "toggled"], exportAs: ["graniteButton"] }, { kind: "component", type: GraniteProgressBarLegendComponent, selector: "granite-progress-bar-legend", inputs: ["legendItems"] }, { kind: "directive", type: GraniteProgressBarLegendTriggerForDirective, selector: "[graniteProgressBarLegendTriggerFor]", inputs: ["graniteProgressBarLegendTriggerFor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4517
4739
|
}
|
|
4518
4740
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarComponent, decorators: [{
|
|
4519
4741
|
type: Component,
|
|
4520
|
-
args: [{ selector: 'granite-progress-bar', exportAs: 'graniteProgressBar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n class=\"progress\"\n [style.background-color]=\"getBackgroundColor()\"\n>\n <div\n *ngFor=\"let bar of progressBarData; let i = index\"\n [style.background-color]=\"getStackColor(bar.backgroundColor)\"\n [style.width]=\"getStringOfWidth(getWidth(bar.value))\"\n [style.color]=\"getFontColor(bar.foregroundColor)\"\n [graniteTooltipTriggerFor]=\"tooltip\"\n class=\"progress-bar\"\n >\n <label *ngIf=\"showLabel\" graniteHideOnOverflow>{{ bar.valueLabel }}</label>\n <granite-tooltip #tooltip> {{ bar.valueLabel }} </granite-tooltip>\n </div>\n</div>\n", styles: [":host{width:100%;height:.5rem;line-height:.5rem;box-sizing:border-box;border-radius:var(--granite-radius-s);font-size:.25rem}.progress{display:flex;width:inherit;height:inherit;overflow:hidden;border-radius:inherit;background-color:var(--granite-color-background-selected)}.progress-bar{display:flex;align-items:center;box-sizing:border-box;width:inherit;height:inherit;line-height:inherit;font-size:inherit;vertical-align:middle;text-overflow:ellipsis;white-space:nowrap;color:var(--granite-color-text);overflow:hidden;text-align:center;justify-content:center}.progress-bar label{width:100%}.progress-bar:last-child{justify-content:flex-end;text-align:end;padding-inline-end:var(--granite-spacing-16)}.progress-bar:first-child{justify-content:flex-start;text-align:start;padding-inline-start:var(--granite-spacing-16)}\n"] }]
|
|
4742
|
+
args: [{ selector: 'granite-progress-bar', exportAs: 'graniteProgressBar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n role=\"progressbar\"\n aria-valuemin=\"0\"\n aria-valuemax=\"100\"\n class=\"progress\"\n [style.background-color]=\"getBackgroundColor()\"\n>\n <div\n *ngFor=\"let bar of progressBarData; let i = index\"\n [style.background-color]=\"getStackColor(bar.backgroundColor)\"\n [style.width]=\"getStringOfWidth(getWidth(bar.value))\"\n [style.color]=\"getFontColor(bar.foregroundColor)\"\n [graniteTooltipTriggerFor]=\"tooltip\"\n class=\"progress-bar\"\n >\n <label *ngIf=\"showLabel\" graniteHideOnOverflow>{{ bar.valueLabel }}</label>\n <granite-tooltip #tooltip> {{ bar.valueLabel }} </granite-tooltip>\n </div>\n</div>\n\n<ng-container *ngIf=\"showLegend\">\n <button\n graniteFlatButton\n [graniteProgressBarLegendTriggerFor]=\"legend\"\n class=\"legend-btn\"\n >\n <granite-icon>caret-down</granite-icon>\n </button>\n</ng-container>\n\n<granite-progress-bar-legend\n #legend\n [legendItems]=\"legendItems\"\n></granite-progress-bar-legend>\n", styles: [":host{width:100%;display:flex;align-items:center;gap:var(--granite-spacing-16);height:.5rem;line-height:.5rem;box-sizing:border-box;border-radius:var(--granite-radius-s);font-size:.25rem}.progress{display:flex;width:inherit;height:inherit;overflow:hidden;border-radius:inherit;background-color:var(--granite-color-background-selected)}.progress-bar{display:flex;align-items:center;box-sizing:border-box;width:inherit;height:inherit;line-height:inherit;font-size:inherit;vertical-align:middle;text-overflow:ellipsis;white-space:nowrap;color:var(--granite-color-text);overflow:hidden;text-align:center;justify-content:center}.progress-bar label{width:100%}.progress-bar:last-child{justify-content:flex-end;text-align:end;padding-inline-end:var(--granite-spacing-16)}.progress-bar:first-child{justify-content:flex-start;text-align:start;padding-inline-start:var(--granite-spacing-16)}.legend-btn{width:16px;height:16px}\n"] }]
|
|
4521
4743
|
}], propDecorators: { progressBarData: [{
|
|
4522
4744
|
type: Input
|
|
4523
4745
|
}], showLabel: [{
|
|
4524
4746
|
type: Input
|
|
4747
|
+
}], showLegend: [{
|
|
4748
|
+
type: Input
|
|
4525
4749
|
}] } });
|
|
4526
4750
|
|
|
4527
4751
|
/**
|
|
@@ -4664,15 +4888,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
4664
4888
|
|
|
4665
4889
|
class GraniteProgressBarModule {
|
|
4666
4890
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
4667
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarModule, declarations: [GraniteProgressBarComponent
|
|
4668
|
-
|
|
4891
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarModule, declarations: [GraniteProgressBarComponent,
|
|
4892
|
+
GraniteProgressBarLegendComponent,
|
|
4893
|
+
GraniteProgressBarLegendTriggerForDirective], imports: [CommonModule,
|
|
4894
|
+
GraniteCoreModule,
|
|
4895
|
+
GraniteTooltipModule,
|
|
4896
|
+
GraniteIconModule,
|
|
4897
|
+
GraniteButtonModule], exports: [GraniteProgressBarComponent] }); }
|
|
4898
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarModule, imports: [CommonModule,
|
|
4899
|
+
GraniteCoreModule,
|
|
4900
|
+
GraniteTooltipModule,
|
|
4901
|
+
GraniteIconModule,
|
|
4902
|
+
GraniteButtonModule] }); }
|
|
4669
4903
|
}
|
|
4670
4904
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteProgressBarModule, decorators: [{
|
|
4671
4905
|
type: NgModule,
|
|
4672
4906
|
args: [{
|
|
4673
|
-
declarations: [
|
|
4907
|
+
declarations: [
|
|
4908
|
+
GraniteProgressBarComponent,
|
|
4909
|
+
GraniteProgressBarLegendComponent,
|
|
4910
|
+
GraniteProgressBarLegendTriggerForDirective,
|
|
4911
|
+
],
|
|
4674
4912
|
exports: [GraniteProgressBarComponent],
|
|
4675
|
-
imports: [
|
|
4913
|
+
imports: [
|
|
4914
|
+
CommonModule,
|
|
4915
|
+
GraniteCoreModule,
|
|
4916
|
+
GraniteTooltipModule,
|
|
4917
|
+
GraniteIconModule,
|
|
4918
|
+
GraniteButtonModule,
|
|
4919
|
+
],
|
|
4676
4920
|
}]
|
|
4677
4921
|
}] });
|
|
4678
4922
|
|
|
@@ -4864,6 +5108,329 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
4864
5108
|
}]
|
|
4865
5109
|
}] });
|
|
4866
5110
|
|
|
5111
|
+
const fileSizes = [
|
|
5112
|
+
'Bytes',
|
|
5113
|
+
'KB',
|
|
5114
|
+
'MB',
|
|
5115
|
+
'GB',
|
|
5116
|
+
'TB',
|
|
5117
|
+
'PB',
|
|
5118
|
+
'EB',
|
|
5119
|
+
'ZB',
|
|
5120
|
+
'YB',
|
|
5121
|
+
];
|
|
5122
|
+
var FileUploadStatus;
|
|
5123
|
+
(function (FileUploadStatus) {
|
|
5124
|
+
FileUploadStatus["NotStarted"] = "NotStarted";
|
|
5125
|
+
FileUploadStatus["InProgress"] = "InProgress";
|
|
5126
|
+
FileUploadStatus["Completed"] = "Completed";
|
|
5127
|
+
FileUploadStatus["Failed"] = "Failed";
|
|
5128
|
+
FileUploadStatus["Cancelled"] = "Cancelled";
|
|
5129
|
+
})(FileUploadStatus || (FileUploadStatus = {}));
|
|
5130
|
+
var FilUploadErrorTypes;
|
|
5131
|
+
(function (FilUploadErrorTypes) {
|
|
5132
|
+
FilUploadErrorTypes["ExtensionNotSupported"] = "ExtensionNotSupported";
|
|
5133
|
+
FilUploadErrorTypes["MultipleFilesNotSupported"] = "MultipleFilesNotSupported";
|
|
5134
|
+
})(FilUploadErrorTypes || (FilUploadErrorTypes = {}));
|
|
5135
|
+
const DEFAULT_MULTI_FILE_SUPPORT = false;
|
|
5136
|
+
const DEFAULT_ACCEPT_TYPE = '*.*';
|
|
5137
|
+
const DEFAULT_UPLOAD_TITLE = 'Upload Files';
|
|
5138
|
+
const DEFAULT_UPLOAD_ICON = 'icon-upload';
|
|
5139
|
+
const DEFAULT_FILE_BROWSE_BUTTON_ICON = 'icon-folder-alt';
|
|
5140
|
+
const DEFAULT_UPLOAD_FAILURE_ICON = 'icon-error';
|
|
5141
|
+
const DEFAULT_DROPZONE_TEXT = 'Drop here or';
|
|
5142
|
+
const DEFAULT_BROWSE_BUTTON_TEXT = 'Browse';
|
|
5143
|
+
const DEFAULT_DROP_PLACEHOLDER_TEXT = 'Drop files here';
|
|
5144
|
+
const DEFAULT_DROPZONE_HINT = '';
|
|
5145
|
+
const DEFAULT_REMOVE_BUTTON_TEXT = 'Remove';
|
|
5146
|
+
const DEFAULT_UPLOAD_BUTTON_TEXT = 'Upload';
|
|
5147
|
+
const DEFAULT_RETRY_BUTTON_TEXT = 'Retry';
|
|
5148
|
+
const DEFAULT_CANCEL_BUTTON_TEXT = 'Cancel';
|
|
5149
|
+
|
|
5150
|
+
function validFileTypes(mimeTypesStringToCheck, files) {
|
|
5151
|
+
const supportedFileMimeTypes = mimeTypesStringToCheck
|
|
5152
|
+
.split(',')
|
|
5153
|
+
.map((ext) => ext.trim());
|
|
5154
|
+
if (!files || files.length === 0) {
|
|
5155
|
+
return false;
|
|
5156
|
+
}
|
|
5157
|
+
return files.every((file) => {
|
|
5158
|
+
const fileType = file['type'];
|
|
5159
|
+
return fileType && supportedFileMimeTypes.includes(fileType);
|
|
5160
|
+
});
|
|
5161
|
+
}
|
|
5162
|
+
|
|
5163
|
+
class GraniteFileDragAndDropDirective {
|
|
5164
|
+
constructor() {
|
|
5165
|
+
this.currentFiles = [];
|
|
5166
|
+
this.droppedFiles = new EventEmitter();
|
|
5167
|
+
this.isFileOver = new EventEmitter();
|
|
5168
|
+
this.fileUploadValidation = new EventEmitter();
|
|
5169
|
+
}
|
|
5170
|
+
onDragOver(event) {
|
|
5171
|
+
event.preventDefault();
|
|
5172
|
+
event.stopPropagation();
|
|
5173
|
+
const transferFiles = event.dataTransfer?.items ?? [];
|
|
5174
|
+
if (!validFileTypes(this.accept, Array.from(transferFiles))) {
|
|
5175
|
+
this.fileBrowseError = true;
|
|
5176
|
+
this.fileUploadValidation.emit({
|
|
5177
|
+
isError: this.fileBrowseError,
|
|
5178
|
+
type: FilUploadErrorTypes.ExtensionNotSupported,
|
|
5179
|
+
});
|
|
5180
|
+
return;
|
|
5181
|
+
}
|
|
5182
|
+
if (!this.multiFileUploadEnabled &&
|
|
5183
|
+
(transferFiles.length > 1 || this.currentFiles.length >= 1)) {
|
|
5184
|
+
this.fileBrowseError = true;
|
|
5185
|
+
this.fileUploadValidation.emit({
|
|
5186
|
+
isError: this.fileBrowseError,
|
|
5187
|
+
type: FilUploadErrorTypes.MultipleFilesNotSupported,
|
|
5188
|
+
});
|
|
5189
|
+
return;
|
|
5190
|
+
}
|
|
5191
|
+
this.fileOver = true;
|
|
5192
|
+
this.isFileOver.emit(this.fileOver);
|
|
5193
|
+
}
|
|
5194
|
+
onDragLeave(event) {
|
|
5195
|
+
event.preventDefault();
|
|
5196
|
+
event.stopPropagation();
|
|
5197
|
+
this.fileOver = false;
|
|
5198
|
+
this.fileBrowseError = false;
|
|
5199
|
+
this.fileUploadValidation.emit({ isError: false, type: null });
|
|
5200
|
+
this.isFileOver.emit(this.fileOver);
|
|
5201
|
+
}
|
|
5202
|
+
onDrop(event) {
|
|
5203
|
+
event.preventDefault();
|
|
5204
|
+
event.stopPropagation();
|
|
5205
|
+
if (this.fileBrowseError) {
|
|
5206
|
+
this.fileBrowseError = false;
|
|
5207
|
+
this.fileUploadValidation.emit({
|
|
5208
|
+
isError: this.fileBrowseError,
|
|
5209
|
+
type: null,
|
|
5210
|
+
});
|
|
5211
|
+
return;
|
|
5212
|
+
}
|
|
5213
|
+
this.currentFiles = [
|
|
5214
|
+
...this.currentFiles,
|
|
5215
|
+
...Array.from(event.dataTransfer.files),
|
|
5216
|
+
];
|
|
5217
|
+
this.fileOver = false;
|
|
5218
|
+
this.isFileOver.emit(this.fileOver);
|
|
5219
|
+
if (this.currentFiles.length > 0) {
|
|
5220
|
+
this.droppedFiles.emit(this.currentFiles);
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileDragAndDropDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
5224
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.4", type: GraniteFileDragAndDropDirective, selector: "[graniteFileDragAndDrop]", inputs: { multiFileUploadEnabled: "multiFileUploadEnabled", accept: "accept", currentFiles: "currentFiles" }, outputs: { droppedFiles: "droppedFiles", isFileOver: "isFileOver", fileUploadValidation: "fileUploadValidation" }, host: { listeners: { "dragover": "onDragOver($event)", "dragleave": "onDragLeave($event)", "drop": "onDrop($event)" }, properties: { "class.file-over": "this.fileOver", "class.file-error": "this.fileBrowseError" } }, exportAs: ["graniteFileDragAndDrop"], ngImport: i0 }); }
|
|
5225
|
+
}
|
|
5226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileDragAndDropDirective, decorators: [{
|
|
5227
|
+
type: Directive,
|
|
5228
|
+
args: [{
|
|
5229
|
+
selector: '[graniteFileDragAndDrop]',
|
|
5230
|
+
exportAs: 'graniteFileDragAndDrop',
|
|
5231
|
+
}]
|
|
5232
|
+
}], propDecorators: { fileOver: [{
|
|
5233
|
+
type: HostBinding,
|
|
5234
|
+
args: ['class.file-over']
|
|
5235
|
+
}], fileBrowseError: [{
|
|
5236
|
+
type: HostBinding,
|
|
5237
|
+
args: ['class.file-error']
|
|
5238
|
+
}], multiFileUploadEnabled: [{
|
|
5239
|
+
type: Input
|
|
5240
|
+
}], accept: [{
|
|
5241
|
+
type: Input
|
|
5242
|
+
}], currentFiles: [{
|
|
5243
|
+
type: Input
|
|
5244
|
+
}], droppedFiles: [{
|
|
5245
|
+
type: Output
|
|
5246
|
+
}], isFileOver: [{
|
|
5247
|
+
type: Output
|
|
5248
|
+
}], fileUploadValidation: [{
|
|
5249
|
+
type: Output
|
|
5250
|
+
}], onDragOver: [{
|
|
5251
|
+
type: HostListener,
|
|
5252
|
+
args: ['dragover', ['$event']]
|
|
5253
|
+
}], onDragLeave: [{
|
|
5254
|
+
type: HostListener,
|
|
5255
|
+
args: ['dragleave', ['$event']]
|
|
5256
|
+
}], onDrop: [{
|
|
5257
|
+
type: HostListener,
|
|
5258
|
+
args: ['drop', ['$event']]
|
|
5259
|
+
}] } });
|
|
5260
|
+
|
|
5261
|
+
class GraniteFileUploadComponent {
|
|
5262
|
+
constructor() {
|
|
5263
|
+
this.accept = DEFAULT_ACCEPT_TYPE;
|
|
5264
|
+
this.uploadTitle = DEFAULT_UPLOAD_TITLE;
|
|
5265
|
+
this.uploadIcon = DEFAULT_UPLOAD_ICON;
|
|
5266
|
+
this.browseIcon = DEFAULT_FILE_BROWSE_BUTTON_ICON;
|
|
5267
|
+
this.errorIcon = DEFAULT_UPLOAD_FAILURE_ICON;
|
|
5268
|
+
this.dropZoneText = DEFAULT_DROPZONE_TEXT;
|
|
5269
|
+
this.browseButtonText = DEFAULT_BROWSE_BUTTON_TEXT;
|
|
5270
|
+
this.dropPlaceholderText = DEFAULT_DROP_PLACEHOLDER_TEXT;
|
|
5271
|
+
this.dropZoneHint = DEFAULT_DROPZONE_HINT;
|
|
5272
|
+
this.removeButtonText = DEFAULT_REMOVE_BUTTON_TEXT;
|
|
5273
|
+
this.uploadButtonText = DEFAULT_UPLOAD_BUTTON_TEXT;
|
|
5274
|
+
this.retryButtonText = DEFAULT_RETRY_BUTTON_TEXT;
|
|
5275
|
+
this.cancelButtonText = DEFAULT_CANCEL_BUTTON_TEXT;
|
|
5276
|
+
this.browseOrDragFiles = new EventEmitter();
|
|
5277
|
+
this.removeFiles = new EventEmitter();
|
|
5278
|
+
this.filesUpload = new EventEmitter();
|
|
5279
|
+
this.fileUploadValidation = new EventEmitter();
|
|
5280
|
+
this.selectedFiles = [];
|
|
5281
|
+
this.previewReadyFiles = [];
|
|
5282
|
+
this.isFileOnDropzone = false;
|
|
5283
|
+
this.FileUploadStatus = FileUploadStatus;
|
|
5284
|
+
this.fileError = false;
|
|
5285
|
+
// TODO: this becomes input when multiple file upload support with carousel component was done.
|
|
5286
|
+
this.supportMultiFileUpload = DEFAULT_MULTI_FILE_SUPPORT;
|
|
5287
|
+
this._uploadStatus = FileUploadStatus.NotStarted;
|
|
5288
|
+
this._autoUpload = true;
|
|
5289
|
+
}
|
|
5290
|
+
get uploadStatus() {
|
|
5291
|
+
return this._uploadStatus;
|
|
5292
|
+
}
|
|
5293
|
+
set uploadStatus(status) {
|
|
5294
|
+
this._uploadStatus = status;
|
|
5295
|
+
}
|
|
5296
|
+
get autoUpload() {
|
|
5297
|
+
return this._autoUpload;
|
|
5298
|
+
}
|
|
5299
|
+
set autoUpload(value) {
|
|
5300
|
+
this._autoUpload = coerceBooleanProperty(value);
|
|
5301
|
+
}
|
|
5302
|
+
fileBrowseHandler(event) {
|
|
5303
|
+
const target = event.target;
|
|
5304
|
+
const files = Array.from(target.files);
|
|
5305
|
+
if (!validFileTypes(this.accept, files)) {
|
|
5306
|
+
this.fileUploadValidation.emit({
|
|
5307
|
+
isError: true,
|
|
5308
|
+
type: FilUploadErrorTypes.ExtensionNotSupported,
|
|
5309
|
+
});
|
|
5310
|
+
this.fileDropRef.nativeElement.value = null;
|
|
5311
|
+
return;
|
|
5312
|
+
}
|
|
5313
|
+
this.selectedFiles = [...this.selectedFiles, ...files];
|
|
5314
|
+
this.previewReadyFiles = this.prepareSelectedFiles(this.selectedFiles);
|
|
5315
|
+
this.browseOrDragFiles.emit(this.previewReadyFiles);
|
|
5316
|
+
}
|
|
5317
|
+
fileRemoveHandler(index) {
|
|
5318
|
+
this.selectedFiles.splice(index, 1);
|
|
5319
|
+
this.previewReadyFiles.splice(index, 1);
|
|
5320
|
+
if (this.selectedFiles.length === 0 &&
|
|
5321
|
+
this.previewReadyFiles.length === 0) {
|
|
5322
|
+
this.fileDropRef.nativeElement.value = null;
|
|
5323
|
+
this.uploadStatus = FileUploadStatus.NotStarted;
|
|
5324
|
+
}
|
|
5325
|
+
this.removeFiles.emit(this.previewReadyFiles);
|
|
5326
|
+
}
|
|
5327
|
+
onFilesDropHandler(files) {
|
|
5328
|
+
if (!this.supportMultiFileUpload &&
|
|
5329
|
+
(this.selectedFiles.length === 1 || files.length !== 1)) {
|
|
5330
|
+
this.fileError = true;
|
|
5331
|
+
return;
|
|
5332
|
+
}
|
|
5333
|
+
this.selectedFiles = files;
|
|
5334
|
+
this.previewReadyFiles = this.prepareSelectedFiles(this.selectedFiles);
|
|
5335
|
+
this.browseOrDragFiles.emit(this.previewReadyFiles);
|
|
5336
|
+
}
|
|
5337
|
+
onFileOverDropzone(isFileOver) {
|
|
5338
|
+
this.isFileOnDropzone = isFileOver;
|
|
5339
|
+
}
|
|
5340
|
+
onFileDropError(validation) {
|
|
5341
|
+
this.fileError = validation.isError;
|
|
5342
|
+
this.fileDropErrorType = validation.type;
|
|
5343
|
+
}
|
|
5344
|
+
prepareSelectedFiles(files) {
|
|
5345
|
+
return files.map((file) => ({
|
|
5346
|
+
file,
|
|
5347
|
+
readableSize: this.formatBytesToReadableSize(file.size, 2),
|
|
5348
|
+
imageUrl: URL.createObjectURL(file),
|
|
5349
|
+
}));
|
|
5350
|
+
}
|
|
5351
|
+
uploadFiles() {
|
|
5352
|
+
this.filesUpload.emit();
|
|
5353
|
+
}
|
|
5354
|
+
retryUpload() {
|
|
5355
|
+
this.filesUpload.emit();
|
|
5356
|
+
}
|
|
5357
|
+
cancelUpload() {
|
|
5358
|
+
for (let i = 0; i < this.previewReadyFiles.length; i++) {
|
|
5359
|
+
this.fileRemoveHandler(i);
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5362
|
+
formatBytesToReadableSize(bytes, decimals) {
|
|
5363
|
+
if (bytes === 0) {
|
|
5364
|
+
return `0 ${fileSizes[0]}`;
|
|
5365
|
+
}
|
|
5366
|
+
const bytesPerKB = 1024;
|
|
5367
|
+
const decimalPoints = decimals <= 0 ? 0 : decimals || 2;
|
|
5368
|
+
const exp = Math.floor(Math.log(bytes) / Math.log(bytesPerKB));
|
|
5369
|
+
return `${parseFloat((bytes / Math.pow(bytesPerKB, exp)).toFixed(decimalPoints))} ${fileSizes[exp]}`;
|
|
5370
|
+
}
|
|
5371
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileUploadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
5372
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: GraniteFileUploadComponent, selector: "granite-file-upload", inputs: { accept: "accept", uploadTitle: "uploadTitle", uploadIcon: "uploadIcon", browseIcon: "browseIcon", errorIcon: "errorIcon", dropZoneText: "dropZoneText", browseButtonText: "browseButtonText", dropPlaceholderText: "dropPlaceholderText", dropZoneHint: "dropZoneHint", removeButtonText: "removeButtonText", uploadButtonText: "uploadButtonText", retryButtonText: "retryButtonText", cancelButtonText: "cancelButtonText", uploadStatus: "uploadStatus", autoUpload: "autoUpload" }, outputs: { browseOrDragFiles: "browseOrDragFiles", removeFiles: "removeFiles", filesUpload: "filesUpload", fileUploadValidation: "fileUploadValidation" }, viewQueries: [{ propertyName: "fileDropRef", first: true, predicate: ["fileDropRef"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"file-upload-wrapper\">\n <h2 class=\"file-upload-title\">{{ uploadTitle }}</h2>\n <div\n class=\"file-dropzone\"\n graniteFileDragAndDrop\n (droppedFiles)=\"onFilesDropHandler($event)\"\n (isFileOver)=\"onFileOverDropzone($event)\"\n (fileUploadValidation)=\"onFileDropError($event)\"\n [multiFileUploadEnabled]=\"supportMultiFileUpload\"\n [accept]=\"accept\"\n [currentFiles]=\"selectedFiles\"\n >\n <input\n class=\"file-input\"\n #fileDropRef\n type=\"file\"\n title=\"fileUpload\"\n (change)=\"fileBrowseHandler($event)\"\n [multiple]=\"supportMultiFileUpload\"\n [accept]=\"accept\"\n />\n <div class=\"file-upload-body\">\n <ng-template #dropPlaceholder>\n <p class=\"drop-area-placeholder\">\n {{ dropPlaceholderText }}\n </p>\n </ng-template>\n <ng-container\n *ngIf=\"!isFileOnDropzone && !fileError; else dropPlaceholder\"\n >\n <div\n class=\"file-upload-browse\"\n *ngIf=\"previewReadyFiles.length === 0; else filePreview\"\n >\n <granite-icon\n class=\"file-upload-icon\"\n [fontIcon]=\"uploadIcon\"\n ></granite-icon>\n <div class=\"file-selection\">\n <h2 class=\"file-upload-body-text\">{{ dropZoneText }}</h2>\n <button\n class=\"file-select-button\"\n graniteButton\n (click)=\"fileDropRef.click()\"\n >\n <granite-icon\n class=\"browse-button-icon\"\n [fontIcon]=\"browseIcon\"\n ></granite-icon>\n <div class=\"browse-button-text\">{{ browseButtonText }}</div>\n </button>\n </div>\n <p *ngIf=\"dropZoneHint\" class=\"file-upload-hint\">\n {{ dropZoneHint }}\n </p>\n </div>\n <ng-template #filePreview>\n <div\n class=\"file-preview-container\"\n *ngFor=\"let previewFile of previewReadyFiles; let i = index\"\n >\n <a\n class=\"file-preview-link\"\n [ngClass]=\"{\n 'uploading-in-progress':\n uploadStatus === FileUploadStatus.InProgress,\n 'upload-failed': uploadStatus === FileUploadStatus.Failed\n }\"\n [href]=\"previewFile?.imageUrl\"\n target=\"_blank\"\n >\n <div class=\"file-preview-holder\">\n <img\n role=\"presentation\"\n [src]=\"previewFile?.imageUrl\"\n [alt]=\"previewFile?.file?.name\"\n />\n </div>\n <p class=\"file-name\" [title]=\"previewFile?.file?.name\">\n {{ previewFile?.file?.name }}\n </p>\n <p class=\"file-size\">{{ previewFile?.readableSize }}</p>\n </a>\n <div\n class=\"loading-container\"\n *ngIf=\"uploadStatus === FileUploadStatus.InProgress\"\n >\n <div class=\"uploading-spinner\"></div>\n </div>\n <div\n class=\"failed-icon-container\"\n *ngIf=\"uploadStatus === FileUploadStatus.Failed\"\n >\n <granite-icon\n class=\"error-icon\"\n [fontIcon]=\"errorIcon\"\n ></granite-icon>\n </div>\n <button\n graniteButton\n *ngIf=\"\n [\n FileUploadStatus.Completed,\n FileUploadStatus.NotStarted\n ].includes(uploadStatus)\n \"\n (click)=\"fileRemoveHandler(i)\"\n >\n {{ removeButtonText }}\n </button>\n </div>\n </ng-template>\n </ng-container>\n </div>\n </div>\n <div class=\"file-upload-footer\">\n <div class=\"footer-container\" *ngIf=\"previewReadyFiles.length > 0\">\n <button\n *ngIf=\"!autoUpload && uploadStatus === FileUploadStatus.NotStarted\"\n granitePrimaryButton\n (click)=\"uploadFiles()\"\n >\n {{ uploadButtonText }}\n </button>\n <ng-container *ngIf=\"uploadStatus === FileUploadStatus.Failed\">\n <button graniteButton (click)=\"cancelUpload()\">\n {{ cancelButtonText }}\n </button>\n <button\n class=\"retry-upload-button\"\n granitePrimaryButton\n (click)=\"retryUpload()\"\n >\n {{ retryButtonText }}\n </button>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: [":host{width:100%}.file-upload-wrapper{display:flex;flex-direction:column;background-color:var(--granite-color-background);box-shadow:var(--granite-shadow-s);height:100%;width:100%}.file-upload-wrapper .file-upload-title{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-medium);font-weight:var(--granite-font-weight-bold);line-height:var(--granite-line-height-base-rem);color:var(--granite-color-text-weak);margin:0;padding:var(--granite-spacing-8) calc(var(--granite-spacing-16) * .813)}.file-upload-wrapper .file-dropzone{display:flex;flex-direction:column;border-width:var(--granite-border-width-focus);border-style:dashed;border-color:var(--granite-color-background-selected);border-radius:var(--granite-radius-m);margin:var(--granite-spacing-8);height:100%}.file-upload-wrapper .file-dropzone.file-error{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-flowing);color:var(--granite-color-text);text-align:center;background-color:var(--granite-color-background-lobby-failure);border-color:var(--granite-color-state-error);transition:background .15s ease}.file-upload-wrapper .file-dropzone.file-error .drop-area-placeholder{margin:0}.file-upload-wrapper .file-dropzone.file-over{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-flowing);color:var(--granite-color-text);text-align:center;background-color:var(--granite-color-background-lobby-info);border-color:var(--granite-color-background-active);transition:background .15s ease}.file-upload-wrapper .file-dropzone.file-over .drop-area-placeholder{margin:0}.file-upload-wrapper .file-dropzone .file-input{opacity:0;position:absolute;width:0}.file-upload-wrapper .file-dropzone .file-upload-body{display:flex;align-items:center;justify-content:center;height:100%}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse{display:flex;flex-direction:column;gap:var(--granite-spacing-4);justify-content:center;align-items:center;padding:0 var(--granite-spacing-16)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-upload-icon{font-size:var(--granite-font-size-display-small);color:var(--granite-color-text)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection{display:flex;justify-content:space-between;align-items:center}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-upload-body-text{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-flowing);color:var(--granite-color-text);text-align:center;width:100%;margin-inline-end:var(--granite-spacing-4)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button{display:flex;justify-content:space-between;align-items:center;color:var(--granite-color-text-link);padding-top:calc(var(--granite-spacing-24) / 4)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button .browse-button-icon{font-size:var(--granite-font-size-body);color:var(--granite-color-text-link);margin-inline-end:var(--granite-spacing-4);padding:0}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button .browse-button-text{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:calc(var(--granite-line-height-flowing) / 2);margin-top:var(--granite-spacing-4)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button:hover .browse-button-icon,.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button:hover .browse-button-text{color:var(--granite-color-text-inverse)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-upload-hint{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:18px;text-align:center;color:var(--granite-color-text-hint);margin:10px 0 0}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container{display:flex;flex-direction:column;align-items:center;width:100%;max-height:100%;padding:6px}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link{display:flex;flex-direction:column;align-items:center;width:100%;text-decoration:none}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link.uploading-in-progress,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link.upload-failed{opacity:.6;pointer-events:none}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link:hover .file-name,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link:hover .file-size{text-decoration:underline}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-preview-holder{width:80px;height:114px;background-color:var(--granite-color-background-variant)}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-preview-holder img{max-width:100%;max-height:100%;aspect-ratio:2/1;object-fit:cover;object-position:center}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-name{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-regular);line-height:10px;color:var(--granite-color-text-link);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:6px 0 0;width:100%;text-align:center}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-size{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-regular);line-height:10px;color:var(--granite-color-text-link);margin:0 0 14px}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .loading-container,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .failed-icon-container{position:absolute;transform:translateY(100%)}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .loading-container .uploading-spinner,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .failed-icon-container .uploading-spinner{width:50px;height:50px;border-radius:50%;border:6px solid;border-color:var(--granite-color-background-page);border-right-color:var(--granite-color-background-active);animation:loading-keyframe 1s infinite linear}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .loading-container .error-icon,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .failed-icon-container .error-icon{color:var(--granite-color-state-error);font-size:35px;padding:0}.file-upload-wrapper .file-upload-footer{margin-inline:var(--granite-spacing-8);margin-bottom:var(--granite-spacing-8)}.file-upload-wrapper .file-upload-footer .footer-container{display:flex;justify-content:flex-end;align-items:center}.file-upload-wrapper .file-upload-footer .footer-container .retry-upload-button{margin-inline-start:var(--granite-spacing-8)}@keyframes loading-keyframe{to{transform:rotate(360deg)}}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: GraniteButtonComponent, selector: "button[graniteButton],\n button[granitePrimaryButton],\n button[graniteFlatButton],\n button[graniteToolbarButton]\n ", inputs: ["disabled", "toggled"], exportAs: ["graniteButton"] }, { kind: "component", type: GraniteIconComponent, selector: "granite-icon", inputs: ["fontIcon"] }, { kind: "directive", type: GraniteFileDragAndDropDirective, selector: "[graniteFileDragAndDrop]", inputs: ["multiFileUploadEnabled", "accept", "currentFiles"], outputs: ["droppedFiles", "isFileOver", "fileUploadValidation"], exportAs: ["graniteFileDragAndDrop"] }] }); }
|
|
5373
|
+
}
|
|
5374
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileUploadComponent, decorators: [{
|
|
5375
|
+
type: Component,
|
|
5376
|
+
args: [{ selector: 'granite-file-upload', template: "<div class=\"file-upload-wrapper\">\n <h2 class=\"file-upload-title\">{{ uploadTitle }}</h2>\n <div\n class=\"file-dropzone\"\n graniteFileDragAndDrop\n (droppedFiles)=\"onFilesDropHandler($event)\"\n (isFileOver)=\"onFileOverDropzone($event)\"\n (fileUploadValidation)=\"onFileDropError($event)\"\n [multiFileUploadEnabled]=\"supportMultiFileUpload\"\n [accept]=\"accept\"\n [currentFiles]=\"selectedFiles\"\n >\n <input\n class=\"file-input\"\n #fileDropRef\n type=\"file\"\n title=\"fileUpload\"\n (change)=\"fileBrowseHandler($event)\"\n [multiple]=\"supportMultiFileUpload\"\n [accept]=\"accept\"\n />\n <div class=\"file-upload-body\">\n <ng-template #dropPlaceholder>\n <p class=\"drop-area-placeholder\">\n {{ dropPlaceholderText }}\n </p>\n </ng-template>\n <ng-container\n *ngIf=\"!isFileOnDropzone && !fileError; else dropPlaceholder\"\n >\n <div\n class=\"file-upload-browse\"\n *ngIf=\"previewReadyFiles.length === 0; else filePreview\"\n >\n <granite-icon\n class=\"file-upload-icon\"\n [fontIcon]=\"uploadIcon\"\n ></granite-icon>\n <div class=\"file-selection\">\n <h2 class=\"file-upload-body-text\">{{ dropZoneText }}</h2>\n <button\n class=\"file-select-button\"\n graniteButton\n (click)=\"fileDropRef.click()\"\n >\n <granite-icon\n class=\"browse-button-icon\"\n [fontIcon]=\"browseIcon\"\n ></granite-icon>\n <div class=\"browse-button-text\">{{ browseButtonText }}</div>\n </button>\n </div>\n <p *ngIf=\"dropZoneHint\" class=\"file-upload-hint\">\n {{ dropZoneHint }}\n </p>\n </div>\n <ng-template #filePreview>\n <div\n class=\"file-preview-container\"\n *ngFor=\"let previewFile of previewReadyFiles; let i = index\"\n >\n <a\n class=\"file-preview-link\"\n [ngClass]=\"{\n 'uploading-in-progress':\n uploadStatus === FileUploadStatus.InProgress,\n 'upload-failed': uploadStatus === FileUploadStatus.Failed\n }\"\n [href]=\"previewFile?.imageUrl\"\n target=\"_blank\"\n >\n <div class=\"file-preview-holder\">\n <img\n role=\"presentation\"\n [src]=\"previewFile?.imageUrl\"\n [alt]=\"previewFile?.file?.name\"\n />\n </div>\n <p class=\"file-name\" [title]=\"previewFile?.file?.name\">\n {{ previewFile?.file?.name }}\n </p>\n <p class=\"file-size\">{{ previewFile?.readableSize }}</p>\n </a>\n <div\n class=\"loading-container\"\n *ngIf=\"uploadStatus === FileUploadStatus.InProgress\"\n >\n <div class=\"uploading-spinner\"></div>\n </div>\n <div\n class=\"failed-icon-container\"\n *ngIf=\"uploadStatus === FileUploadStatus.Failed\"\n >\n <granite-icon\n class=\"error-icon\"\n [fontIcon]=\"errorIcon\"\n ></granite-icon>\n </div>\n <button\n graniteButton\n *ngIf=\"\n [\n FileUploadStatus.Completed,\n FileUploadStatus.NotStarted\n ].includes(uploadStatus)\n \"\n (click)=\"fileRemoveHandler(i)\"\n >\n {{ removeButtonText }}\n </button>\n </div>\n </ng-template>\n </ng-container>\n </div>\n </div>\n <div class=\"file-upload-footer\">\n <div class=\"footer-container\" *ngIf=\"previewReadyFiles.length > 0\">\n <button\n *ngIf=\"!autoUpload && uploadStatus === FileUploadStatus.NotStarted\"\n granitePrimaryButton\n (click)=\"uploadFiles()\"\n >\n {{ uploadButtonText }}\n </button>\n <ng-container *ngIf=\"uploadStatus === FileUploadStatus.Failed\">\n <button graniteButton (click)=\"cancelUpload()\">\n {{ cancelButtonText }}\n </button>\n <button\n class=\"retry-upload-button\"\n granitePrimaryButton\n (click)=\"retryUpload()\"\n >\n {{ retryButtonText }}\n </button>\n </ng-container>\n </div>\n </div>\n</div>\n", styles: [":host{width:100%}.file-upload-wrapper{display:flex;flex-direction:column;background-color:var(--granite-color-background);box-shadow:var(--granite-shadow-s);height:100%;width:100%}.file-upload-wrapper .file-upload-title{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-medium);font-weight:var(--granite-font-weight-bold);line-height:var(--granite-line-height-base-rem);color:var(--granite-color-text-weak);margin:0;padding:var(--granite-spacing-8) calc(var(--granite-spacing-16) * .813)}.file-upload-wrapper .file-dropzone{display:flex;flex-direction:column;border-width:var(--granite-border-width-focus);border-style:dashed;border-color:var(--granite-color-background-selected);border-radius:var(--granite-radius-m);margin:var(--granite-spacing-8);height:100%}.file-upload-wrapper .file-dropzone.file-error{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-flowing);color:var(--granite-color-text);text-align:center;background-color:var(--granite-color-background-lobby-failure);border-color:var(--granite-color-state-error);transition:background .15s ease}.file-upload-wrapper .file-dropzone.file-error .drop-area-placeholder{margin:0}.file-upload-wrapper .file-dropzone.file-over{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-flowing);color:var(--granite-color-text);text-align:center;background-color:var(--granite-color-background-lobby-info);border-color:var(--granite-color-background-active);transition:background .15s ease}.file-upload-wrapper .file-dropzone.file-over .drop-area-placeholder{margin:0}.file-upload-wrapper .file-dropzone .file-input{opacity:0;position:absolute;width:0}.file-upload-wrapper .file-dropzone .file-upload-body{display:flex;align-items:center;justify-content:center;height:100%}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse{display:flex;flex-direction:column;gap:var(--granite-spacing-4);justify-content:center;align-items:center;padding:0 var(--granite-spacing-16)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-upload-icon{font-size:var(--granite-font-size-display-small);color:var(--granite-color-text)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection{display:flex;justify-content:space-between;align-items:center}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-upload-body-text{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:var(--granite-line-height-flowing);color:var(--granite-color-text);text-align:center;width:100%;margin-inline-end:var(--granite-spacing-4)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button{display:flex;justify-content:space-between;align-items:center;color:var(--granite-color-text-link);padding-top:calc(var(--granite-spacing-24) / 4)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button .browse-button-icon{font-size:var(--granite-font-size-body);color:var(--granite-color-text-link);margin-inline-end:var(--granite-spacing-4);padding:0}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button .browse-button-text{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:calc(var(--granite-line-height-flowing) / 2);margin-top:var(--granite-spacing-4)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button:hover .browse-button-icon,.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-selection .file-select-button:hover .browse-button-text{color:var(--granite-color-text-inverse)}.file-upload-wrapper .file-dropzone .file-upload-body .file-upload-browse .file-upload-hint{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-body-small);font-weight:var(--granite-font-weight-regular);line-height:18px;text-align:center;color:var(--granite-color-text-hint);margin:10px 0 0}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container{display:flex;flex-direction:column;align-items:center;width:100%;max-height:100%;padding:6px}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link{display:flex;flex-direction:column;align-items:center;width:100%;text-decoration:none}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link.uploading-in-progress,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link.upload-failed{opacity:.6;pointer-events:none}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link:hover .file-name,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link:hover .file-size{text-decoration:underline}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-preview-holder{width:80px;height:114px;background-color:var(--granite-color-background-variant)}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-preview-holder img{max-width:100%;max-height:100%;aspect-ratio:2/1;object-fit:cover;object-position:center}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-name{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-regular);line-height:10px;color:var(--granite-color-text-link);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:6px 0 0;width:100%;text-align:center}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .file-preview-link .file-size{font-family:var(--granite-font-family-default);font-size:var(--granite-font-size-micro);font-weight:var(--granite-font-weight-regular);line-height:10px;color:var(--granite-color-text-link);margin:0 0 14px}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .loading-container,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .failed-icon-container{position:absolute;transform:translateY(100%)}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .loading-container .uploading-spinner,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .failed-icon-container .uploading-spinner{width:50px;height:50px;border-radius:50%;border:6px solid;border-color:var(--granite-color-background-page);border-right-color:var(--granite-color-background-active);animation:loading-keyframe 1s infinite linear}.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .loading-container .error-icon,.file-upload-wrapper .file-dropzone .file-upload-body .file-preview-container .failed-icon-container .error-icon{color:var(--granite-color-state-error);font-size:35px;padding:0}.file-upload-wrapper .file-upload-footer{margin-inline:var(--granite-spacing-8);margin-bottom:var(--granite-spacing-8)}.file-upload-wrapper .file-upload-footer .footer-container{display:flex;justify-content:flex-end;align-items:center}.file-upload-wrapper .file-upload-footer .footer-container .retry-upload-button{margin-inline-start:var(--granite-spacing-8)}@keyframes loading-keyframe{to{transform:rotate(360deg)}}\n"] }]
|
|
5377
|
+
}], propDecorators: { fileDropRef: [{
|
|
5378
|
+
type: ViewChild,
|
|
5379
|
+
args: ['fileDropRef', { read: ElementRef }]
|
|
5380
|
+
}], accept: [{
|
|
5381
|
+
type: Input
|
|
5382
|
+
}], uploadTitle: [{
|
|
5383
|
+
type: Input
|
|
5384
|
+
}], uploadIcon: [{
|
|
5385
|
+
type: Input
|
|
5386
|
+
}], browseIcon: [{
|
|
5387
|
+
type: Input
|
|
5388
|
+
}], errorIcon: [{
|
|
5389
|
+
type: Input
|
|
5390
|
+
}], dropZoneText: [{
|
|
5391
|
+
type: Input
|
|
5392
|
+
}], browseButtonText: [{
|
|
5393
|
+
type: Input
|
|
5394
|
+
}], dropPlaceholderText: [{
|
|
5395
|
+
type: Input
|
|
5396
|
+
}], dropZoneHint: [{
|
|
5397
|
+
type: Input
|
|
5398
|
+
}], removeButtonText: [{
|
|
5399
|
+
type: Input
|
|
5400
|
+
}], uploadButtonText: [{
|
|
5401
|
+
type: Input
|
|
5402
|
+
}], retryButtonText: [{
|
|
5403
|
+
type: Input
|
|
5404
|
+
}], cancelButtonText: [{
|
|
5405
|
+
type: Input
|
|
5406
|
+
}], browseOrDragFiles: [{
|
|
5407
|
+
type: Output
|
|
5408
|
+
}], removeFiles: [{
|
|
5409
|
+
type: Output
|
|
5410
|
+
}], filesUpload: [{
|
|
5411
|
+
type: Output
|
|
5412
|
+
}], fileUploadValidation: [{
|
|
5413
|
+
type: Output
|
|
5414
|
+
}], uploadStatus: [{
|
|
5415
|
+
type: Input
|
|
5416
|
+
}], autoUpload: [{
|
|
5417
|
+
type: Input
|
|
5418
|
+
}] } });
|
|
5419
|
+
|
|
5420
|
+
class GraniteFileUploadModule {
|
|
5421
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileUploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
5422
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileUploadModule, declarations: [GraniteFileUploadComponent, GraniteFileDragAndDropDirective], imports: [CommonModule, GraniteButtonModule, GraniteIconModule], exports: [GraniteFileUploadComponent] }); }
|
|
5423
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileUploadModule, imports: [CommonModule, GraniteButtonModule, GraniteIconModule] }); }
|
|
5424
|
+
}
|
|
5425
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: GraniteFileUploadModule, decorators: [{
|
|
5426
|
+
type: NgModule,
|
|
5427
|
+
args: [{
|
|
5428
|
+
declarations: [GraniteFileUploadComponent, GraniteFileDragAndDropDirective],
|
|
5429
|
+
exports: [GraniteFileUploadComponent],
|
|
5430
|
+
imports: [CommonModule, GraniteButtonModule, GraniteIconModule],
|
|
5431
|
+
}]
|
|
5432
|
+
}] });
|
|
5433
|
+
|
|
4867
5434
|
class GraniteCollapsibleConditionalBodyDirective {
|
|
4868
5435
|
constructor() {
|
|
4869
5436
|
this.template = inject(TemplateRef);
|
|
@@ -4961,5 +5528,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
|
|
|
4961
5528
|
* Generated bundle index. Do not edit.
|
|
4962
5529
|
*/
|
|
4963
5530
|
|
|
4964
|
-
export { ButtonSelectors, CONTACT_DEFAULT_STATUS, ClientInputDesktopDirective, ClientInputTouchDirective, ClientOutputDesktopDirective, ClientOutputTouchDirective, ContactItemDefaultStatusComponent, GRANITE_CLIENT_INPUT, GRANITE_CLIENT_OUTPUT, GraniteAnchorComponent, GraniteArrangeGridComponent, GraniteArrangeGridItemComponent, GraniteArrangeGridModule, GraniteArrangeGridOrientation, GraniteBadgeComponent, GraniteBadgeHarness, GraniteBadgeModule, GraniteButtonComponent, GraniteButtonModule, GraniteCardActionsComponent, GraniteCardAvatarComponent, GraniteCardBodyComponent, GraniteCardComponent, GraniteCardContentComponent, GraniteCardFooterComponent, GraniteCardHeaderComponent, GraniteCardHeaderSubTitleComponent, GraniteCardHeaderTitleComponent, GraniteCardListComponent, GraniteCardListModule, GraniteCheckboxComponent, GraniteCheckboxGroupComponent, GraniteCheckboxModule, GraniteChipComponent, GraniteChipInputDirective, GraniteChipListComponent, GraniteChipSelectionChangeEvent, GraniteChipsModule, GraniteCollapsibleConditionalBodyDirective, GraniteCollapsibleConditionalHeaderDirective, GraniteCollapsibleGroupComponent, GraniteCollapsibleGroupModule, GraniteContactItemComponent, GraniteContactItemTitleComponent, GraniteContactsComponent, GraniteContactsModule, GraniteContactsProfileComponent, GraniteContactsTriggerForDirective, GraniteCoreModule, GraniteCustomProfileDirective, GraniteCustomStatusDirective, GraniteDividerDirective, GraniteGridComponent, GraniteGridItemComponent, GraniteGridModule, GraniteHideOnOverflowDirective, GraniteIconComponent, GraniteIconModule, GraniteInputFieldComponent, GraniteInputFieldModule, GraniteLabelComponent, GraniteLabelModule, GraniteMenuComponent, GraniteMenuHarness, GraniteMenuItemComponent, GraniteMenuItemHarness, GraniteMenuModule, GraniteMenuTouchCloseComponent, GraniteMenuTouchTitleItemComponent, GraniteMenuTriggerForDirective, GraniteProgressBarComponent, GraniteProgressBarModule, GraniteRadioButtonComponent, GraniteRadioButtonModule, GraniteRadioGroupComponent, GraniteTitleDirective, GraniteTitlePipe, GraniteToggleSwitchComponent, GraniteToggleSwitchModule, PurePipesModule, deviceDesktop, deviceTouch, disabledMixin, graniteMenuDesktopAnimations, graniteMenuTouchAnimations };
|
|
5531
|
+
export { ButtonSelectors, CONTACT_DEFAULT_STATUS, ClientInputDesktopDirective, ClientInputTouchDirective, ClientOutputDesktopDirective, ClientOutputTouchDirective, ContactItemDefaultStatusComponent, GRANITE_CLIENT_INPUT, GRANITE_CLIENT_OUTPUT, GraniteAnchorComponent, GraniteArrangeGridComponent, GraniteArrangeGridItemComponent, GraniteArrangeGridModule, GraniteArrangeGridOrientation, GraniteBadgeComponent, GraniteBadgeHarness, GraniteBadgeModule, GraniteButtonComponent, GraniteButtonModule, GraniteCardActionsComponent, GraniteCardAvatarComponent, GraniteCardBodyComponent, GraniteCardComponent, GraniteCardContentComponent, GraniteCardFooterComponent, GraniteCardHeaderComponent, GraniteCardHeaderSubTitleComponent, GraniteCardHeaderTitleComponent, GraniteCardListComponent, GraniteCardListModule, GraniteCheckboxComponent, GraniteCheckboxGroupComponent, GraniteCheckboxModule, GraniteChipComponent, GraniteChipInputDirective, GraniteChipListComponent, GraniteChipSelectionChangeEvent, GraniteChipsModule, GraniteCollapsibleConditionalBodyDirective, GraniteCollapsibleConditionalHeaderDirective, GraniteCollapsibleGroupComponent, GraniteCollapsibleGroupModule, GraniteContactItemComponent, GraniteContactItemTitleComponent, GraniteContactsComponent, GraniteContactsModule, GraniteContactsProfileComponent, GraniteContactsTriggerForDirective, GraniteCoreModule, GraniteCustomProfileDirective, GraniteCustomStatusDirective, GraniteDividerDirective, GraniteFileUploadComponent, GraniteFileUploadModule, GraniteGridComponent, GraniteGridItemComponent, GraniteGridModule, GraniteHideOnOverflowDirective, GraniteIconComponent, GraniteIconModule, GraniteInputFieldComponent, GraniteInputFieldModule, GraniteLabelComponent, GraniteLabelModule, GraniteMenuComponent, GraniteMenuHarness, GraniteMenuItemComponent, GraniteMenuItemHarness, GraniteMenuModule, GraniteMenuTouchCloseComponent, GraniteMenuTouchTitleItemComponent, GraniteMenuTriggerForDirective, GraniteProgressBarComponent, GraniteProgressBarModule, GraniteRadioButtonComponent, GraniteRadioButtonModule, GraniteRadioGroupComponent, GraniteTitleDirective, GraniteTitlePipe, GraniteToggleSwitchComponent, GraniteToggleSwitchModule, PurePipesModule, deviceDesktop, deviceTouch, disabledMixin, graniteMenuDesktopAnimations, graniteMenuTouchAnimations };
|
|
4965
5532
|
//# sourceMappingURL=ifsworld-granite-components.mjs.map
|