@skyux/forms 5.6.2 → 6.0.0-beta.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/documentation.json +630 -630
- package/esm2020/index.mjs +43 -0
- package/esm2020/lib/modules/character-counter/character-counter-indicator.component.mjs +32 -0
- package/esm2020/lib/modules/character-counter/character-counter.directive.mjs +84 -0
- package/esm2020/lib/modules/character-counter/character-counter.module.mjs +46 -0
- package/esm2020/lib/modules/checkbox/checkbox-change.mjs +6 -0
- package/esm2020/lib/modules/checkbox/checkbox-label.component.mjs +14 -0
- package/esm2020/lib/modules/checkbox/checkbox-required-validator.directive.mjs +32 -0
- package/esm2020/lib/modules/checkbox/checkbox.component.mjs +237 -0
- package/esm2020/lib/modules/checkbox/checkbox.module.mjs +34 -0
- package/esm2020/lib/modules/file-attachment/file-attachment-label.component.mjs +14 -0
- package/esm2020/lib/modules/file-attachment/file-attachment.component.mjs +325 -0
- package/esm2020/lib/modules/file-attachment/file-attachment.service.mjs +94 -0
- package/esm2020/lib/modules/file-attachment/file-attachments.module.mjs +68 -0
- package/esm2020/lib/modules/file-attachment/file-drop.component.mjs +217 -0
- package/esm2020/lib/modules/file-attachment/file-item-error-type.mjs +2 -0
- package/esm2020/lib/modules/file-attachment/file-item.component.mjs +112 -0
- package/esm2020/lib/modules/file-attachment/file-item.mjs +2 -0
- package/esm2020/lib/modules/file-attachment/file-item.service.mjs +72 -0
- package/esm2020/lib/modules/file-attachment/file-link.mjs +2 -0
- package/esm2020/lib/modules/file-attachment/file-size.pipe.mjs +60 -0
- package/esm2020/lib/modules/file-attachment/types/file-attachment-change.mjs +2 -0
- package/esm2020/lib/modules/file-attachment/types/file-attachment-click.mjs +2 -0
- package/esm2020/lib/modules/file-attachment/types/file-drop-change.mjs +2 -0
- package/esm2020/lib/modules/input-box/input-box-adapter.service.mjs +35 -0
- package/esm2020/lib/modules/input-box/input-box-host.service.mjs +19 -0
- package/esm2020/lib/modules/input-box/input-box-populate-args.mjs +2 -0
- package/esm2020/lib/modules/input-box/input-box.component.mjs +89 -0
- package/esm2020/lib/modules/input-box/input-box.module.mjs +19 -0
- package/esm2020/lib/modules/radio/radio-group.component.mjs +220 -0
- package/esm2020/lib/modules/radio/radio-label.component.mjs +23 -0
- package/esm2020/lib/modules/radio/radio.component.mjs +256 -0
- package/esm2020/lib/modules/radio/radio.module.mjs +28 -0
- package/esm2020/lib/modules/radio/types/radio-change.mjs +2 -0
- package/esm2020/lib/modules/selection-box/selection-box-adapter.service.mjs +124 -0
- package/esm2020/lib/modules/selection-box/selection-box-description.component.mjs +14 -0
- package/esm2020/lib/modules/selection-box/selection-box-grid.component.mjs +126 -0
- package/esm2020/lib/modules/selection-box/selection-box-header.component.mjs +14 -0
- package/esm2020/lib/modules/selection-box/selection-box.component.mjs +101 -0
- package/esm2020/lib/modules/selection-box/selection-box.module.mjs +40 -0
- package/esm2020/lib/modules/selection-box/types/selection-box-grid-align-items-type.mjs +2 -0
- package/esm2020/lib/modules/selection-box/types/selection-box-grid-align-items.mjs +2 -0
- package/esm2020/lib/modules/shared/forms-utility.mjs +26 -0
- package/esm2020/lib/modules/shared/sky-forms-resources.module.mjs +89 -0
- package/esm2020/lib/modules/toggle-switch/toggle-switch-label.component.mjs +14 -0
- package/esm2020/lib/modules/toggle-switch/toggle-switch.component.mjs +153 -0
- package/esm2020/lib/modules/toggle-switch/toggle-switch.module.mjs +20 -0
- package/esm2020/lib/modules/toggle-switch/types/toggle-switch-change.mjs +2 -0
- package/esm2020/skyux-forms.mjs +5 -0
- package/esm2020/testing/checkbox-fixture.mjs +88 -0
- package/esm2020/testing/public-api.mjs +2 -0
- package/esm2020/testing/skyux-forms-testing.mjs +5 -0
- package/fesm2015/{skyux-forms-testing.js → skyux-forms-testing.mjs} +1 -1
- package/fesm2015/skyux-forms-testing.mjs.map +1 -0
- package/fesm2015/skyux-forms.mjs +2691 -0
- package/fesm2015/skyux-forms.mjs.map +1 -0
- package/{esm2015/testing/checkbox-fixture.js → fesm2020/skyux-forms-testing.mjs} +9 -2
- package/fesm2020/skyux-forms-testing.mjs.map +1 -0
- package/fesm2020/skyux-forms.mjs +2685 -0
- package/fesm2020/skyux-forms.mjs.map +1 -0
- package/lib/modules/shared/sky-forms-resources.module.d.ts +1 -1
- package/package.json +36 -15
- package/testing/package.json +5 -5
- package/bundles/skyux-forms-testing.umd.js +0 -123
- package/bundles/skyux-forms.umd.js +0 -3422
- package/esm2015/index.js +0 -43
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/modules/character-counter/character-counter-indicator.component.js +0 -37
- package/esm2015/lib/modules/character-counter/character-counter-indicator.component.js.map +0 -1
- package/esm2015/lib/modules/character-counter/character-counter.directive.js +0 -84
- package/esm2015/lib/modules/character-counter/character-counter.directive.js.map +0 -1
- package/esm2015/lib/modules/character-counter/character-counter.module.js +0 -46
- package/esm2015/lib/modules/character-counter/character-counter.module.js.map +0 -1
- package/esm2015/lib/modules/checkbox/checkbox-change.js +0 -6
- package/esm2015/lib/modules/checkbox/checkbox-change.js.map +0 -1
- package/esm2015/lib/modules/checkbox/checkbox-label.component.js +0 -17
- package/esm2015/lib/modules/checkbox/checkbox-label.component.js.map +0 -1
- package/esm2015/lib/modules/checkbox/checkbox-required-validator.directive.js +0 -32
- package/esm2015/lib/modules/checkbox/checkbox-required-validator.directive.js.map +0 -1
- package/esm2015/lib/modules/checkbox/checkbox.component.js +0 -241
- package/esm2015/lib/modules/checkbox/checkbox.component.js.map +0 -1
- package/esm2015/lib/modules/checkbox/checkbox.module.js +0 -34
- package/esm2015/lib/modules/checkbox/checkbox.module.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-attachment-label.component.js +0 -19
- package/esm2015/lib/modules/file-attachment/file-attachment-label.component.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-attachment.component.js +0 -331
- package/esm2015/lib/modules/file-attachment/file-attachment.component.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-attachment.service.js +0 -94
- package/esm2015/lib/modules/file-attachment/file-attachment.service.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-attachments.module.js +0 -68
- package/esm2015/lib/modules/file-attachment/file-attachments.module.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-drop.component.js +0 -222
- package/esm2015/lib/modules/file-attachment/file-drop.component.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-item-error-type.js +0 -2
- package/esm2015/lib/modules/file-attachment/file-item-error-type.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-item.component.js +0 -116
- package/esm2015/lib/modules/file-attachment/file-item.component.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-item.js +0 -2
- package/esm2015/lib/modules/file-attachment/file-item.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-item.service.js +0 -72
- package/esm2015/lib/modules/file-attachment/file-item.service.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-link.js +0 -2
- package/esm2015/lib/modules/file-attachment/file-link.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/file-size.pipe.js +0 -60
- package/esm2015/lib/modules/file-attachment/file-size.pipe.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/types/file-attachment-change.js +0 -2
- package/esm2015/lib/modules/file-attachment/types/file-attachment-change.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/types/file-attachment-click.js +0 -2
- package/esm2015/lib/modules/file-attachment/types/file-attachment-click.js.map +0 -1
- package/esm2015/lib/modules/file-attachment/types/file-drop-change.js +0 -2
- package/esm2015/lib/modules/file-attachment/types/file-drop-change.js.map +0 -1
- package/esm2015/lib/modules/input-box/input-box-adapter.service.js +0 -35
- package/esm2015/lib/modules/input-box/input-box-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/input-box/input-box-host.service.js +0 -19
- package/esm2015/lib/modules/input-box/input-box-host.service.js.map +0 -1
- package/esm2015/lib/modules/input-box/input-box-populate-args.js +0 -2
- package/esm2015/lib/modules/input-box/input-box-populate-args.js.map +0 -1
- package/esm2015/lib/modules/input-box/input-box.component.js +0 -97
- package/esm2015/lib/modules/input-box/input-box.component.js.map +0 -1
- package/esm2015/lib/modules/input-box/input-box.module.js +0 -19
- package/esm2015/lib/modules/input-box/input-box.module.js.map +0 -1
- package/esm2015/lib/modules/radio/radio-group.component.js +0 -223
- package/esm2015/lib/modules/radio/radio-group.component.js.map +0 -1
- package/esm2015/lib/modules/radio/radio-label.component.js +0 -26
- package/esm2015/lib/modules/radio/radio-label.component.js.map +0 -1
- package/esm2015/lib/modules/radio/radio.component.js +0 -262
- package/esm2015/lib/modules/radio/radio.component.js.map +0 -1
- package/esm2015/lib/modules/radio/radio.module.js +0 -28
- package/esm2015/lib/modules/radio/radio.module.js.map +0 -1
- package/esm2015/lib/modules/radio/types/radio-change.js +0 -2
- package/esm2015/lib/modules/radio/types/radio-change.js.map +0 -1
- package/esm2015/lib/modules/selection-box/selection-box-adapter.service.js +0 -124
- package/esm2015/lib/modules/selection-box/selection-box-adapter.service.js.map +0 -1
- package/esm2015/lib/modules/selection-box/selection-box-description.component.js +0 -17
- package/esm2015/lib/modules/selection-box/selection-box-description.component.js.map +0 -1
- package/esm2015/lib/modules/selection-box/selection-box-grid.component.js +0 -132
- package/esm2015/lib/modules/selection-box/selection-box-grid.component.js.map +0 -1
- package/esm2015/lib/modules/selection-box/selection-box-header.component.js +0 -17
- package/esm2015/lib/modules/selection-box/selection-box-header.component.js.map +0 -1
- package/esm2015/lib/modules/selection-box/selection-box.component.js +0 -107
- package/esm2015/lib/modules/selection-box/selection-box.component.js.map +0 -1
- package/esm2015/lib/modules/selection-box/selection-box.module.js +0 -40
- package/esm2015/lib/modules/selection-box/selection-box.module.js.map +0 -1
- package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items-type.js +0 -2
- package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items-type.js.map +0 -1
- package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items.js +0 -2
- package/esm2015/lib/modules/selection-box/types/selection-box-grid-align-items.js.map +0 -1
- package/esm2015/lib/modules/shared/forms-utility.js +0 -26
- package/esm2015/lib/modules/shared/forms-utility.js.map +0 -1
- package/esm2015/lib/modules/shared/sky-forms-resources.module.js +0 -89
- package/esm2015/lib/modules/shared/sky-forms-resources.module.js.map +0 -1
- package/esm2015/lib/modules/toggle-switch/toggle-switch-label.component.js +0 -18
- package/esm2015/lib/modules/toggle-switch/toggle-switch-label.component.js.map +0 -1
- package/esm2015/lib/modules/toggle-switch/toggle-switch.component.js +0 -159
- package/esm2015/lib/modules/toggle-switch/toggle-switch.component.js.map +0 -1
- package/esm2015/lib/modules/toggle-switch/toggle-switch.module.js +0 -20
- package/esm2015/lib/modules/toggle-switch/toggle-switch.module.js.map +0 -1
- package/esm2015/lib/modules/toggle-switch/types/toggle-switch-change.js +0 -2
- package/esm2015/lib/modules/toggle-switch/types/toggle-switch-change.js.map +0 -1
- package/esm2015/skyux-forms.js +0 -5
- package/esm2015/skyux-forms.js.map +0 -1
- package/esm2015/testing/checkbox-fixture.js.map +0 -1
- package/esm2015/testing/public-api.js +0 -2
- package/esm2015/testing/public-api.js.map +0 -1
- package/esm2015/testing/skyux-forms-testing.js +0 -5
- package/esm2015/testing/skyux-forms-testing.js.map +0 -1
- package/fesm2015/skyux-forms-testing.js.map +0 -1
- package/fesm2015/skyux-forms.js +0 -2765
- package/fesm2015/skyux-forms.js.map +0 -1
|
@@ -0,0 +1,2691 @@
|
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
|
+
import { CommonModule, DecimalPipe } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { NgModule, Component, ChangeDetectionStrategy, Directive, Input, forwardRef, EventEmitter, Self, Optional, Output, Injectable, ViewChild, ContentChildren, Pipe, ViewEncapsulation, ContentChild, HostListener, ElementRef } from '@angular/core';
|
|
5
|
+
import * as i4 from '@angular/forms';
|
|
6
|
+
import { NG_VALIDATORS, FormsModule, ReactiveFormsModule, CheckboxRequiredValidator, FormControlDirective, FormControlName, NgModel, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
+
import * as i2 from '@skyux/i18n';
|
|
8
|
+
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
9
|
+
import * as i2$1 from '@skyux/indicators';
|
|
10
|
+
import { SkyIconModule } from '@skyux/indicators';
|
|
11
|
+
import { BehaviorSubject, Subject } from 'rxjs';
|
|
12
|
+
import * as i1$1 from '@skyux/theme';
|
|
13
|
+
import { SkyThemeModule } from '@skyux/theme';
|
|
14
|
+
import { takeUntil } from 'rxjs/operators';
|
|
15
|
+
import * as i2$2 from '@skyux/core';
|
|
16
|
+
import { SkyMediaBreakpoints } from '@skyux/core';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
20
|
+
* The contents of this file were automatically generated by
|
|
21
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-forms' schematic.
|
|
22
|
+
* To update this file, simply rerun the command.
|
|
23
|
+
*/
|
|
24
|
+
const RESOURCES = {
|
|
25
|
+
'EN-US': {
|
|
26
|
+
skyux_character_count_message: { message: 'characters out of' },
|
|
27
|
+
skyux_character_count_over_limit: {
|
|
28
|
+
message: 'You are over the character limit.',
|
|
29
|
+
},
|
|
30
|
+
skyux_file_attachment_button_label_choose_file: { message: 'Choose file' },
|
|
31
|
+
skyux_file_attachment_button_label_replace_file: {
|
|
32
|
+
message: 'Replace file',
|
|
33
|
+
},
|
|
34
|
+
skyux_file_attachment_file_item_delete: { message: 'Delete file' },
|
|
35
|
+
skyux_file_attachment_file_size_b_plural: { message: '{0} bytes' },
|
|
36
|
+
skyux_file_attachment_file_size_b_singular: { message: '{0} byte' },
|
|
37
|
+
skyux_file_attachment_file_size_gb: { message: '{0} GB' },
|
|
38
|
+
skyux_file_attachment_file_size_kb: { message: '{0} KB' },
|
|
39
|
+
skyux_file_attachment_file_size_mb: { message: '{0} MB' },
|
|
40
|
+
skyux_file_attachment_file_upload_drag_file_here: {
|
|
41
|
+
message: 'Drag a file here',
|
|
42
|
+
},
|
|
43
|
+
skyux_file_attachment_file_upload_drag_or_click: {
|
|
44
|
+
message: 'Drag a file here or click to browse',
|
|
45
|
+
},
|
|
46
|
+
skyux_file_attachment_file_upload_drop_files_here: {
|
|
47
|
+
message: 'Drop files here',
|
|
48
|
+
},
|
|
49
|
+
skyux_file_attachment_file_upload_image_preview_alt_text: {
|
|
50
|
+
message: 'Image preview',
|
|
51
|
+
},
|
|
52
|
+
skyux_file_attachment_file_upload_invalid_file: {
|
|
53
|
+
message: 'This file type is invalid',
|
|
54
|
+
},
|
|
55
|
+
skyux_file_attachment_file_upload_link_input: {
|
|
56
|
+
message: 'Add a link to a file',
|
|
57
|
+
},
|
|
58
|
+
skyux_file_attachment_file_upload_link_placeholder: {
|
|
59
|
+
message: 'http://www.something.com/file',
|
|
60
|
+
},
|
|
61
|
+
skyux_file_attachment_file_upload_or_click_to_browse: {
|
|
62
|
+
message: 'or click to browse',
|
|
63
|
+
},
|
|
64
|
+
skyux_file_attachment_file_upload_paste_link: {
|
|
65
|
+
message: 'Paste a link to a file',
|
|
66
|
+
},
|
|
67
|
+
skyux_file_attachment_file_upload_paste_link_done: { message: 'Done' },
|
|
68
|
+
skyux_file_attachment_label_no_file_chosen: { message: 'No file chosen' },
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
class SkyFormsResourcesProvider {
|
|
72
|
+
getString(localeInfo, name) {
|
|
73
|
+
return getLibStringForLocale(RESOURCES, localeInfo.locale, name);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Import into any component library module that needs to use resource strings.
|
|
78
|
+
*/
|
|
79
|
+
class SkyFormsResourcesModule {
|
|
80
|
+
}
|
|
81
|
+
SkyFormsResourcesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFormsResourcesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
82
|
+
SkyFormsResourcesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFormsResourcesModule, exports: [SkyI18nModule] });
|
|
83
|
+
SkyFormsResourcesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFormsResourcesModule, providers: [
|
|
84
|
+
{
|
|
85
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
86
|
+
useClass: SkyFormsResourcesProvider,
|
|
87
|
+
multi: true,
|
|
88
|
+
},
|
|
89
|
+
], imports: [SkyI18nModule] });
|
|
90
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFormsResourcesModule, decorators: [{
|
|
91
|
+
type: NgModule,
|
|
92
|
+
args: [{
|
|
93
|
+
exports: [SkyI18nModule],
|
|
94
|
+
providers: [
|
|
95
|
+
{
|
|
96
|
+
provide: SKY_LIB_RESOURCES_PROVIDERS,
|
|
97
|
+
useClass: SkyFormsResourcesProvider,
|
|
98
|
+
multi: true,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
}]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
104
|
+
class SkyCharacterCounterIndicatorComponent {
|
|
105
|
+
constructor(changeDetector) {
|
|
106
|
+
this.changeDetector = changeDetector;
|
|
107
|
+
this.currentCharacterCountLimit = 0;
|
|
108
|
+
this.currentCharacterCount = 0;
|
|
109
|
+
}
|
|
110
|
+
get characterCount() {
|
|
111
|
+
return this.currentCharacterCount;
|
|
112
|
+
}
|
|
113
|
+
set characterCount(count) {
|
|
114
|
+
this.currentCharacterCount = count;
|
|
115
|
+
this.changeDetector.markForCheck();
|
|
116
|
+
}
|
|
117
|
+
get characterCountLimit() {
|
|
118
|
+
return this.currentCharacterCountLimit;
|
|
119
|
+
}
|
|
120
|
+
set characterCountLimit(limit) {
|
|
121
|
+
this.currentCharacterCountLimit = limit;
|
|
122
|
+
this.changeDetector.markForCheck();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
SkyCharacterCounterIndicatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterIndicatorComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
126
|
+
SkyCharacterCounterIndicatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyCharacterCounterIndicatorComponent, selector: "sky-character-counter-indicator", ngImport: i0, template: "<span\n class=\"sky-character-count-label sky-deemphasized\"\n [ngClass]=\"{ 'sky-error-label': characterCount > characterCountLimit }\"\n>\n {{ characterCount + '/' + characterCountLimit }}\n</span>\n<span aria-live=\"polite\" class=\"sky-screen-reader-only\">\n {{ characterCount }} {{ 'skyux_character_count_message' | skyLibResources }}\n {{ characterCountLimit }}.\n {{\n characterCount > characterCountLimit\n ? ('skyux_character_count_over_limit' | skyLibResources)\n : ''\n }}\n</span>\n", styles: [":host{flex-shrink:.0001}.sky-character-count-label.sky-error-label{margin:0}.sky-character-count-label.sky-error-label:before{font-style:normal}.sky-screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:none;white-space:nowrap}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "skyLibResources": i2.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
127
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterIndicatorComponent, decorators: [{
|
|
128
|
+
type: Component,
|
|
129
|
+
args: [{ selector: 'sky-character-counter-indicator', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span\n class=\"sky-character-count-label sky-deemphasized\"\n [ngClass]=\"{ 'sky-error-label': characterCount > characterCountLimit }\"\n>\n {{ characterCount + '/' + characterCountLimit }}\n</span>\n<span aria-live=\"polite\" class=\"sky-screen-reader-only\">\n {{ characterCount }} {{ 'skyux_character_count_message' | skyLibResources }}\n {{ characterCountLimit }}.\n {{\n characterCount > characterCountLimit\n ? ('skyux_character_count_over_limit' | skyLibResources)\n : ''\n }}\n</span>\n", styles: [":host{flex-shrink:.0001}.sky-character-count-label.sky-error-label{margin:0}.sky-character-count-label.sky-error-label:before{font-style:normal}.sky-screen-reader-only{width:0;height:0;padding:0;opacity:0;position:absolute;margin:-1px;border:0;overflow:hidden;clip:rect(0,0,0,0);outline:none;white-space:nowrap}\n"] }]
|
|
130
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Creates an input field that validates the number of characters. Place this directive on
|
|
134
|
+
* an `input` or `textarea` element. If users enter more characters than allowed, then the
|
|
135
|
+
* input field is invalid and the component displays an error indicator.
|
|
136
|
+
* @required
|
|
137
|
+
*/
|
|
138
|
+
class SkyCharacterCounterInputDirective {
|
|
139
|
+
constructor() {
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
141
|
+
this._validatorChange = () => { };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Specifies the maximum number of characters allowed in the input field. Place this directive
|
|
145
|
+
* on an `input` or `textarea` element. This property accepts `number` values.
|
|
146
|
+
* @required
|
|
147
|
+
*/
|
|
148
|
+
set skyCharacterCounterLimit(value) {
|
|
149
|
+
this._skyCharacterCounterLimit = value;
|
|
150
|
+
this.updateIndicatorLimit(this.skyCharacterCounterLimit);
|
|
151
|
+
this._validatorChange();
|
|
152
|
+
}
|
|
153
|
+
get skyCharacterCounterLimit() {
|
|
154
|
+
return this._skyCharacterCounterLimit || 0;
|
|
155
|
+
}
|
|
156
|
+
validate(control) {
|
|
157
|
+
const value = control.value;
|
|
158
|
+
this.updateIndicatorCount((value && value.length) || 0);
|
|
159
|
+
if (!value) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (value.length > this.skyCharacterCounterLimit) {
|
|
163
|
+
// This is needed to apply the appropriate error styles to the input.
|
|
164
|
+
control.markAsTouched();
|
|
165
|
+
return {
|
|
166
|
+
skyCharacterCounter: {
|
|
167
|
+
invalid: value,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
registerOnValidatorChange(fn) {
|
|
173
|
+
this._validatorChange = fn;
|
|
174
|
+
}
|
|
175
|
+
updateIndicatorCount(count) {
|
|
176
|
+
if (this.skyCharacterCounterIndicator) {
|
|
177
|
+
this.skyCharacterCounterIndicator.characterCount = count;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
updateIndicatorLimit(limit) {
|
|
181
|
+
if (this.skyCharacterCounterIndicator) {
|
|
182
|
+
this.skyCharacterCounterIndicator.characterCountLimit = limit;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
SkyCharacterCounterInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
187
|
+
SkyCharacterCounterInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.7", type: SkyCharacterCounterInputDirective, selector: "[skyCharacterCounter]", inputs: { skyCharacterCounterIndicator: "skyCharacterCounterIndicator", skyCharacterCounterLimit: "skyCharacterCounterLimit" }, providers: [
|
|
188
|
+
{
|
|
189
|
+
provide: NG_VALIDATORS,
|
|
190
|
+
useExisting: SkyCharacterCounterInputDirective,
|
|
191
|
+
multi: true,
|
|
192
|
+
},
|
|
193
|
+
], ngImport: i0 });
|
|
194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterInputDirective, decorators: [{
|
|
195
|
+
type: Directive,
|
|
196
|
+
args: [{
|
|
197
|
+
selector: '[skyCharacterCounter]',
|
|
198
|
+
providers: [
|
|
199
|
+
{
|
|
200
|
+
provide: NG_VALIDATORS,
|
|
201
|
+
useExisting: SkyCharacterCounterInputDirective,
|
|
202
|
+
multi: true,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
}]
|
|
206
|
+
}], propDecorators: { skyCharacterCounterIndicator: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], skyCharacterCounterLimit: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}] } });
|
|
211
|
+
|
|
212
|
+
class SkyCharacterCounterModule {
|
|
213
|
+
}
|
|
214
|
+
SkyCharacterCounterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
215
|
+
SkyCharacterCounterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterModule, declarations: [SkyCharacterCounterInputDirective,
|
|
216
|
+
SkyCharacterCounterIndicatorComponent], imports: [CommonModule,
|
|
217
|
+
FormsModule,
|
|
218
|
+
ReactiveFormsModule,
|
|
219
|
+
SkyFormsResourcesModule,
|
|
220
|
+
SkyI18nModule], exports: [SkyCharacterCounterInputDirective,
|
|
221
|
+
SkyCharacterCounterIndicatorComponent] });
|
|
222
|
+
SkyCharacterCounterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterModule, imports: [[
|
|
223
|
+
CommonModule,
|
|
224
|
+
FormsModule,
|
|
225
|
+
ReactiveFormsModule,
|
|
226
|
+
SkyFormsResourcesModule,
|
|
227
|
+
SkyI18nModule,
|
|
228
|
+
]] });
|
|
229
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCharacterCounterModule, decorators: [{
|
|
230
|
+
type: NgModule,
|
|
231
|
+
args: [{
|
|
232
|
+
declarations: [
|
|
233
|
+
SkyCharacterCounterInputDirective,
|
|
234
|
+
SkyCharacterCounterIndicatorComponent,
|
|
235
|
+
],
|
|
236
|
+
imports: [
|
|
237
|
+
CommonModule,
|
|
238
|
+
FormsModule,
|
|
239
|
+
ReactiveFormsModule,
|
|
240
|
+
SkyFormsResourcesModule,
|
|
241
|
+
SkyI18nModule,
|
|
242
|
+
],
|
|
243
|
+
exports: [
|
|
244
|
+
SkyCharacterCounterInputDirective,
|
|
245
|
+
SkyCharacterCounterIndicatorComponent,
|
|
246
|
+
],
|
|
247
|
+
}]
|
|
248
|
+
}] });
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Fires when users select or deselect the checkbox.
|
|
252
|
+
*/
|
|
253
|
+
class SkyCheckboxChange {
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Specifies a label for the checkbox.
|
|
258
|
+
*/
|
|
259
|
+
class SkyCheckboxLabelComponent {
|
|
260
|
+
}
|
|
261
|
+
SkyCheckboxLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
262
|
+
SkyCheckboxLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyCheckboxLabelComponent, selector: "sky-checkbox-label", ngImport: i0, template: "<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n" });
|
|
263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxLabelComponent, decorators: [{
|
|
264
|
+
type: Component,
|
|
265
|
+
args: [{ selector: 'sky-checkbox-label', template: "<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n" }]
|
|
266
|
+
}] });
|
|
267
|
+
|
|
268
|
+
// tslint:disable:no-forward-ref
|
|
269
|
+
const SKY_CHECKBOX_REQUIRED_VALIDATOR = {
|
|
270
|
+
provide: NG_VALIDATORS,
|
|
271
|
+
useExisting: forwardRef(() => SkyCheckboxRequiredValidatorDirective),
|
|
272
|
+
multi: true,
|
|
273
|
+
};
|
|
274
|
+
// tslint:enable
|
|
275
|
+
/**
|
|
276
|
+
* Validator support for the `required` input on `sky-checkbox`.
|
|
277
|
+
* Angular's `CheckboxRequiredValidator` only works with `input type=checkbox`. This directive
|
|
278
|
+
* extends the angular validator to work with `sky-checkbox` tags.
|
|
279
|
+
* This is based on Angular Material's similar implementation:
|
|
280
|
+
* https://github.com/angular/components/blob/a415b52ead2ec202ba37edb7d7866b29dd790394/src/material/checkbox/checkbox-required-validator.ts
|
|
281
|
+
* @internal
|
|
282
|
+
*/
|
|
283
|
+
class SkyCheckboxRequiredValidatorDirective extends CheckboxRequiredValidator {
|
|
284
|
+
}
|
|
285
|
+
SkyCheckboxRequiredValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxRequiredValidatorDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
286
|
+
SkyCheckboxRequiredValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.7", type: SkyCheckboxRequiredValidatorDirective, selector: "sky-checkbox[required][formControlName],\n sky-checkbox[required][formControl], sky-checkbox[required][ngModel]", providers: [SKY_CHECKBOX_REQUIRED_VALIDATOR], usesInheritance: true, ngImport: i0 });
|
|
287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxRequiredValidatorDirective, decorators: [{
|
|
288
|
+
type: Directive,
|
|
289
|
+
args: [{
|
|
290
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
291
|
+
selector: `sky-checkbox[required][formControlName],
|
|
292
|
+
sky-checkbox[required][formControl], sky-checkbox[required][ngModel]`,
|
|
293
|
+
providers: [SKY_CHECKBOX_REQUIRED_VALIDATOR],
|
|
294
|
+
}]
|
|
295
|
+
}] });
|
|
296
|
+
|
|
297
|
+
// Need to add the following to classes which contain static methods.
|
|
298
|
+
// See: https://github.com/ng-packagr/ng-packagr/issues/641
|
|
299
|
+
// @dynamic
|
|
300
|
+
class SkyFormsUtility {
|
|
301
|
+
/** Coerces a data-bound value (typically a string) to a boolean. */
|
|
302
|
+
static coerceBooleanProperty(value) {
|
|
303
|
+
return value !== undefined && `${value}` !== 'false';
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Gets the required state of the checkbox.
|
|
307
|
+
* Currently, Angular doesn't offer a way to get this easily, so we have to create an empty
|
|
308
|
+
* control using the current validator to see if it throws a `required` validation error.
|
|
309
|
+
* https://github.com/angular/angular/issues/13461#issuecomment-340368046
|
|
310
|
+
*/
|
|
311
|
+
static hasRequiredValidation(ngControl) {
|
|
312
|
+
const abstractControl = ngControl.control;
|
|
313
|
+
if (abstractControl && abstractControl.validator) {
|
|
314
|
+
const validator = abstractControl.validator({});
|
|
315
|
+
if (validator && validator.required) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Monotonically increasing integer used to auto-generate unique ids for checkbox components.
|
|
325
|
+
*/
|
|
326
|
+
let nextId = 0;
|
|
327
|
+
/**
|
|
328
|
+
* Replaces the HTML input element with `type="checkbox"`. When users select a checkbox, its value
|
|
329
|
+
* is driven through an `ngModel` attribute that you specify on the `sky-checkbox` element.
|
|
330
|
+
*/
|
|
331
|
+
class SkyCheckboxComponent {
|
|
332
|
+
constructor(ngControl) {
|
|
333
|
+
this.ngControl = ngControl;
|
|
334
|
+
/**
|
|
335
|
+
* Specifies an ID for the checkbox.
|
|
336
|
+
* @default a unique, auto-incrementing integer. For example: `sky-checkbox-1`
|
|
337
|
+
*/
|
|
338
|
+
this.id = `sky-checkbox-${++nextId}`;
|
|
339
|
+
/**
|
|
340
|
+
* Specifies an index for the checkbox. If not defined, the index is set to the position of the
|
|
341
|
+
* checkbox on load.
|
|
342
|
+
*/
|
|
343
|
+
this.tabindex = 0;
|
|
344
|
+
/**
|
|
345
|
+
* Specifies a name for a group of checkboxes.
|
|
346
|
+
* @default a unique, auto-incrementing integer. For example: `sky-checkbox-1`
|
|
347
|
+
*/
|
|
348
|
+
this.name = `sky-checkbox-${++nextId}`;
|
|
349
|
+
/**
|
|
350
|
+
* Fires when the selected value changes.
|
|
351
|
+
*/
|
|
352
|
+
this.change = new EventEmitter();
|
|
353
|
+
this.isFirstChange = true;
|
|
354
|
+
this._checked = false;
|
|
355
|
+
this._checkedChange = new BehaviorSubject(this._checked);
|
|
356
|
+
this._disabled = false;
|
|
357
|
+
this._disabledChange = new BehaviorSubject(this._disabled);
|
|
358
|
+
this._required = false;
|
|
359
|
+
/** Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. */
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
361
|
+
this.onTouched = () => { };
|
|
362
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
363
|
+
this._controlValueAccessorChangeFn = (value) => { };
|
|
364
|
+
if (this.ngControl) {
|
|
365
|
+
this.ngControl.valueAccessor = this;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Indicates whether to disable the checkbox.
|
|
370
|
+
* @default false
|
|
371
|
+
*/
|
|
372
|
+
set disabled(value) {
|
|
373
|
+
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
374
|
+
if (coercedValue !== this.disabled) {
|
|
375
|
+
this._disabled = coercedValue;
|
|
376
|
+
this._disabledChange.next(this._disabled);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Indicates whether the checkbox is disabled.
|
|
381
|
+
*/
|
|
382
|
+
get disabled() {
|
|
383
|
+
return this._disabled;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Specifies a type to set the background color after users select a checkbox where the
|
|
387
|
+
* `icon` property displays an icon in place of the checkbox. The valid options correspond to
|
|
388
|
+
* [the label component's](https://developer.blackbaud.com/skyux/components/label)
|
|
389
|
+
* label types. `"info"` creates a blue background, `"success"` creates a green
|
|
390
|
+
* background, `"warning"` creates an orange background, and `"danger"` creates a red background.
|
|
391
|
+
* @default "info"
|
|
392
|
+
*/
|
|
393
|
+
set checkboxType(value) {
|
|
394
|
+
if (value) {
|
|
395
|
+
this._checkboxType = value.toLowerCase();
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
get checkboxType() {
|
|
399
|
+
return this._checkboxType || 'info';
|
|
400
|
+
}
|
|
401
|
+
get inputId() {
|
|
402
|
+
return `input-${this.id}`;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Indicates whether the checkbox is selected.
|
|
406
|
+
* @default false
|
|
407
|
+
*/
|
|
408
|
+
set checked(checked) {
|
|
409
|
+
if (checked !== this.checked) {
|
|
410
|
+
this._checked = checked;
|
|
411
|
+
this._controlValueAccessorChangeFn(checked);
|
|
412
|
+
this._checkedChange.next(this._checked);
|
|
413
|
+
// Do not mark the field as "dirty"
|
|
414
|
+
// if the field has been initialized with a value.
|
|
415
|
+
if (this.isFirstChange && this.ngControl && this.ngControl.control) {
|
|
416
|
+
this.ngControl.control.markAsPristine();
|
|
417
|
+
this.isFirstChange = false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Indicates whether the checkbox is selected.
|
|
423
|
+
*/
|
|
424
|
+
get checked() {
|
|
425
|
+
return this._checked;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Indicates whether the input is required for form validation.
|
|
429
|
+
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
430
|
+
* attributes to the input element so that forms display an invalid state until the input element
|
|
431
|
+
* is complete.
|
|
432
|
+
* @default false
|
|
433
|
+
*/
|
|
434
|
+
set required(value) {
|
|
435
|
+
this._required = SkyFormsUtility.coerceBooleanProperty(value);
|
|
436
|
+
}
|
|
437
|
+
get required() {
|
|
438
|
+
return this._required;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Fires when users select or deselect the checkbox.
|
|
442
|
+
*/
|
|
443
|
+
get checkedChange() {
|
|
444
|
+
return this._checkedChange;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Fires when the selected value changes.
|
|
448
|
+
*/
|
|
449
|
+
get disabledChange() {
|
|
450
|
+
return this._disabledChange;
|
|
451
|
+
}
|
|
452
|
+
ngOnInit() {
|
|
453
|
+
if (this.ngControl) {
|
|
454
|
+
// Backwards compatibility support for anyone still using Validators.Required.
|
|
455
|
+
this.required =
|
|
456
|
+
this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Implemented as part of ControlValueAccessor.
|
|
461
|
+
*/
|
|
462
|
+
writeValue(value) {
|
|
463
|
+
this.checked = !!value;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Implemented as part of ControlValueAccessor.
|
|
467
|
+
*/
|
|
468
|
+
registerOnChange(fn) {
|
|
469
|
+
this._controlValueAccessorChangeFn = fn;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Implemented as part of ControlValueAccessor.
|
|
473
|
+
*/
|
|
474
|
+
registerOnTouched(fn) {
|
|
475
|
+
this.onTouched = fn;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Implemented as part of ControlValueAccessor.
|
|
479
|
+
*/
|
|
480
|
+
setDisabledState(isDisabled) {
|
|
481
|
+
this.disabled = isDisabled;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Event handler for checkbox input element.
|
|
485
|
+
* Toggles checked state if element is not disabled.
|
|
486
|
+
*/
|
|
487
|
+
onInteractionEvent(event) {
|
|
488
|
+
// We always have to stop propagation on the change event.
|
|
489
|
+
// Otherwise the change event, from the input element, will bubble up and
|
|
490
|
+
// emit its event object to the `change` output.
|
|
491
|
+
event.stopPropagation();
|
|
492
|
+
if (!this.disabled) {
|
|
493
|
+
this._toggle();
|
|
494
|
+
this._emitChangeEvent();
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
onInputBlur() {
|
|
498
|
+
this.onTouched();
|
|
499
|
+
}
|
|
500
|
+
_emitChangeEvent() {
|
|
501
|
+
const event = new SkyCheckboxChange();
|
|
502
|
+
event.source = this;
|
|
503
|
+
event.checked = this._checked;
|
|
504
|
+
this._controlValueAccessorChangeFn(this._checked);
|
|
505
|
+
this.change.emit(event);
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Toggles the `checked` value between true and false
|
|
509
|
+
*/
|
|
510
|
+
_toggle() {
|
|
511
|
+
this.checked = !this.checked;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
SkyCheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxComponent, deps: [{ token: i4.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
515
|
+
SkyCheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyCheckboxComponent, selector: "sky-checkbox", inputs: { label: "label", labelledBy: "labelledBy", id: "id", disabled: "disabled", tabindex: "tabindex", name: "name", icon: "icon", checkboxType: "checkboxType", checked: "checked", required: "required" }, outputs: { change: "change", checkedChange: "checkedChange", disabledChange: "disabledChange" }, ngImport: i0, template: "<label\n class=\"sky-checkbox-wrapper sky-switch\"\n [ngClass]=\"{\n 'sky-control-label-required': required,\n 'sky-switch-disabled': disabled\n }\"\n>\n <input\n class=\"sky-checkbox-input sky-switch-input\"\n type=\"checkbox\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n [attr.aria-label]=\"label\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.aria-required]=\"required ? true : null\"\n (blur)=\"onInputBlur()\"\n (change)=\"onInteractionEvent($event)\"\n />\n <span\n class=\"sky-switch-control sky-rounded-corners\"\n [ngClass]=\"{\n 'sky-switch-control-icon': icon,\n 'sky-switch-control-info': checkboxType === 'info',\n 'sky-switch-control-success': checkboxType === 'success',\n 'sky-switch-control-warning': checkboxType === 'warning',\n 'sky-switch-control-danger': checkboxType === 'danger'\n }\"\n >\n <sky-icon\n *ngIf=\"icon || checked\"\n class=\"sky-checkbox-icon-default\"\n fixedWidth=\"true\"\n [icon]=\"icon || 'check'\"\n >\n </sky-icon>\n <div class=\"sky-checkbox-icon-modern\">\n <sky-icon\n *ngIf=\"icon; else checkedTemplate\"\n fixedWidth=\"true\"\n [icon]=\"icon\"\n >\n </sky-icon>\n <ng-template #checkedTemplate>\n <sky-icon\n *ngIf=\"checked\"\n class=\"sky-checkbox-icon-modern-checked\"\n fixedWidth=\"true\"\n icon=\"check\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </ng-template>\n </div>\n </span>\n <ng-content select=\"sky-checkbox-label\"> </ng-content>\n</label>\n", styles: [".sky-checkbox-icon-modern{display:none}:host-context(.sky-theme-modern) .sky-checkbox-icon-default{display:none}:host-context(.sky-theme-modern) .sky-checkbox-icon-modern{display:inline}:host-context(.sky-theme-modern) .sky-checkbox-icon-modern-checked{color:#1870b8}:host-context(.sky-theme-modern) .sky-checkbox-input:disabled+.sky-switch-control .sky-checkbox-icon-modern-checked{color:#212327}:host-context(.sky-theme-modern) .sky-switch-control{border-radius:6px}.sky-theme-modern .sky-checkbox-icon-default{display:none}.sky-theme-modern .sky-checkbox-icon-modern{display:inline}.sky-theme-modern .sky-checkbox-icon-modern-checked{color:#1870b8}.sky-theme-modern .sky-checkbox-input:disabled+.sky-switch-control .sky-checkbox-icon-modern-checked{color:#212327}.sky-theme-modern .sky-switch-control{border-radius:6px}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
516
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxComponent, decorators: [{
|
|
517
|
+
type: Component,
|
|
518
|
+
args: [{ selector: 'sky-checkbox', template: "<label\n class=\"sky-checkbox-wrapper sky-switch\"\n [ngClass]=\"{\n 'sky-control-label-required': required,\n 'sky-switch-disabled': disabled\n }\"\n>\n <input\n class=\"sky-checkbox-input sky-switch-input\"\n type=\"checkbox\"\n [id]=\"inputId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n [required]=\"required\"\n [tabIndex]=\"tabindex\"\n [attr.aria-label]=\"label\"\n [attr.aria-labelledby]=\"labelledBy\"\n [attr.aria-required]=\"required ? true : null\"\n (blur)=\"onInputBlur()\"\n (change)=\"onInteractionEvent($event)\"\n />\n <span\n class=\"sky-switch-control sky-rounded-corners\"\n [ngClass]=\"{\n 'sky-switch-control-icon': icon,\n 'sky-switch-control-info': checkboxType === 'info',\n 'sky-switch-control-success': checkboxType === 'success',\n 'sky-switch-control-warning': checkboxType === 'warning',\n 'sky-switch-control-danger': checkboxType === 'danger'\n }\"\n >\n <sky-icon\n *ngIf=\"icon || checked\"\n class=\"sky-checkbox-icon-default\"\n fixedWidth=\"true\"\n [icon]=\"icon || 'check'\"\n >\n </sky-icon>\n <div class=\"sky-checkbox-icon-modern\">\n <sky-icon\n *ngIf=\"icon; else checkedTemplate\"\n fixedWidth=\"true\"\n [icon]=\"icon\"\n >\n </sky-icon>\n <ng-template #checkedTemplate>\n <sky-icon\n *ngIf=\"checked\"\n class=\"sky-checkbox-icon-modern-checked\"\n fixedWidth=\"true\"\n icon=\"check\"\n iconType=\"skyux\"\n >\n </sky-icon>\n </ng-template>\n </div>\n </span>\n <ng-content select=\"sky-checkbox-label\"> </ng-content>\n</label>\n", styles: [".sky-checkbox-icon-modern{display:none}:host-context(.sky-theme-modern) .sky-checkbox-icon-default{display:none}:host-context(.sky-theme-modern) .sky-checkbox-icon-modern{display:inline}:host-context(.sky-theme-modern) .sky-checkbox-icon-modern-checked{color:#1870b8}:host-context(.sky-theme-modern) .sky-checkbox-input:disabled+.sky-switch-control .sky-checkbox-icon-modern-checked{color:#212327}:host-context(.sky-theme-modern) .sky-switch-control{border-radius:6px}.sky-theme-modern .sky-checkbox-icon-default{display:none}.sky-theme-modern .sky-checkbox-icon-modern{display:inline}.sky-theme-modern .sky-checkbox-icon-modern-checked{color:#1870b8}.sky-theme-modern .sky-checkbox-input:disabled+.sky-switch-control .sky-checkbox-icon-modern-checked{color:#212327}.sky-theme-modern .sky-switch-control{border-radius:6px}\n"] }]
|
|
519
|
+
}], ctorParameters: function () {
|
|
520
|
+
return [{ type: i4.NgControl, decorators: [{
|
|
521
|
+
type: Self
|
|
522
|
+
}, {
|
|
523
|
+
type: Optional
|
|
524
|
+
}] }];
|
|
525
|
+
}, propDecorators: { label: [{
|
|
526
|
+
type: Input
|
|
527
|
+
}], labelledBy: [{
|
|
528
|
+
type: Input
|
|
529
|
+
}], id: [{
|
|
530
|
+
type: Input
|
|
531
|
+
}], disabled: [{
|
|
532
|
+
type: Input
|
|
533
|
+
}], tabindex: [{
|
|
534
|
+
type: Input
|
|
535
|
+
}], name: [{
|
|
536
|
+
type: Input
|
|
537
|
+
}], change: [{
|
|
538
|
+
type: Output
|
|
539
|
+
}], icon: [{
|
|
540
|
+
type: Input
|
|
541
|
+
}], checkboxType: [{
|
|
542
|
+
type: Input
|
|
543
|
+
}], checked: [{
|
|
544
|
+
type: Input
|
|
545
|
+
}], required: [{
|
|
546
|
+
type: Input
|
|
547
|
+
}], checkedChange: [{
|
|
548
|
+
type: Output
|
|
549
|
+
}], disabledChange: [{
|
|
550
|
+
type: Output
|
|
551
|
+
}] } });
|
|
552
|
+
|
|
553
|
+
class SkyCheckboxModule {
|
|
554
|
+
}
|
|
555
|
+
SkyCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
556
|
+
SkyCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxModule, declarations: [SkyCheckboxComponent,
|
|
557
|
+
SkyCheckboxLabelComponent,
|
|
558
|
+
SkyCheckboxRequiredValidatorDirective], imports: [CommonModule, FormsModule, SkyIconModule], exports: [SkyCheckboxComponent,
|
|
559
|
+
SkyCheckboxLabelComponent,
|
|
560
|
+
SkyCheckboxRequiredValidatorDirective] });
|
|
561
|
+
SkyCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxModule, imports: [[CommonModule, FormsModule, SkyIconModule]] });
|
|
562
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyCheckboxModule, decorators: [{
|
|
563
|
+
type: NgModule,
|
|
564
|
+
args: [{
|
|
565
|
+
declarations: [
|
|
566
|
+
SkyCheckboxComponent,
|
|
567
|
+
SkyCheckboxLabelComponent,
|
|
568
|
+
SkyCheckboxRequiredValidatorDirective,
|
|
569
|
+
],
|
|
570
|
+
imports: [CommonModule, FormsModule, SkyIconModule],
|
|
571
|
+
exports: [
|
|
572
|
+
SkyCheckboxComponent,
|
|
573
|
+
SkyCheckboxLabelComponent,
|
|
574
|
+
SkyCheckboxRequiredValidatorDirective,
|
|
575
|
+
],
|
|
576
|
+
}]
|
|
577
|
+
}] });
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Displays a label above the file attachment element.
|
|
581
|
+
*/
|
|
582
|
+
class SkyFileAttachmentLabelComponent {
|
|
583
|
+
}
|
|
584
|
+
SkyFileAttachmentLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
585
|
+
SkyFileAttachmentLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyFileAttachmentLabelComponent, selector: "sky-file-attachment-label", ngImport: i0, template: "<span class=\"sky-control-label\">\n <ng-content></ng-content>\n</span>\n", styles: [":host-context(.sky-theme-modern) .sky-control-label{color:#686c73;font-size:13px}.sky-theme-modern .sky-control-label{color:#686c73;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentLabelComponent, decorators: [{
|
|
587
|
+
type: Component,
|
|
588
|
+
args: [{ selector: 'sky-file-attachment-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"sky-control-label\">\n <ng-content></ng-content>\n</span>\n", styles: [":host-context(.sky-theme-modern) .sky-control-label{color:#686c73;font-size:13px}.sky-theme-modern .sky-control-label{color:#686c73;font-size:13px}\n"] }]
|
|
589
|
+
}] });
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* @internal
|
|
593
|
+
*/
|
|
594
|
+
class SkyFileAttachmentService {
|
|
595
|
+
checkFiles(files, minFileSize, maxFileSize, acceptedTypes, validateFn) {
|
|
596
|
+
const fileResults = [];
|
|
597
|
+
for (let index = 0; index < files.length; index++) {
|
|
598
|
+
const fileItem = {
|
|
599
|
+
file: files.item(index),
|
|
600
|
+
};
|
|
601
|
+
if (fileItem.file.size < minFileSize) {
|
|
602
|
+
fileItem.errorType = 'minFileSize';
|
|
603
|
+
fileItem.errorParam = minFileSize.toString();
|
|
604
|
+
fileResults.push(fileItem);
|
|
605
|
+
}
|
|
606
|
+
else if (fileItem.file.size > maxFileSize) {
|
|
607
|
+
fileItem.errorType = 'maxFileSize';
|
|
608
|
+
fileItem.errorParam = maxFileSize.toString();
|
|
609
|
+
fileResults.push(fileItem);
|
|
610
|
+
}
|
|
611
|
+
else if (this.fileTypeRejected(fileItem.file.type, acceptedTypes)) {
|
|
612
|
+
fileItem.errorType = 'fileType';
|
|
613
|
+
fileItem.errorParam = acceptedTypes;
|
|
614
|
+
fileResults.push(fileItem);
|
|
615
|
+
}
|
|
616
|
+
else if (validateFn) {
|
|
617
|
+
const errorParam = validateFn(fileItem);
|
|
618
|
+
if (errorParam) {
|
|
619
|
+
fileItem.errorType = 'validate';
|
|
620
|
+
fileItem.errorParam = errorParam;
|
|
621
|
+
}
|
|
622
|
+
fileResults.push(fileItem);
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
fileResults.push(fileItem);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return fileResults;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Returns `true` if a directory is found in the provided `files` parameter.
|
|
632
|
+
*/
|
|
633
|
+
hasDirectory(files) {
|
|
634
|
+
for (let index = 0; index < files.length; index++) {
|
|
635
|
+
const file = files.item(index);
|
|
636
|
+
if (file.webkitGetAsEntry &&
|
|
637
|
+
file.webkitGetAsEntry() &&
|
|
638
|
+
file.webkitGetAsEntry().isDirectory) {
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
fileTypeRejected(fileType, acceptedTypes) {
|
|
645
|
+
if (!acceptedTypes) {
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
if (!fileType) {
|
|
649
|
+
return true;
|
|
650
|
+
}
|
|
651
|
+
const acceptedTypesUpper = acceptedTypes.toUpperCase();
|
|
652
|
+
const typeArray = acceptedTypesUpper.split(',');
|
|
653
|
+
return !this.fileTypeInArray(typeArray, fileType.toUpperCase());
|
|
654
|
+
}
|
|
655
|
+
fileTypeInArray(typeArray, fileType) {
|
|
656
|
+
if (typeArray.indexOf(fileType) !== -1) {
|
|
657
|
+
return true;
|
|
658
|
+
}
|
|
659
|
+
for (let index = 0; index < typeArray.length; index++) {
|
|
660
|
+
const type = typeArray[index];
|
|
661
|
+
const validSubtype = this.getMimeSubtype(type);
|
|
662
|
+
if (validSubtype === '*') {
|
|
663
|
+
if (this.getMimeMainType(type) === this.getMimeMainType(fileType)) {
|
|
664
|
+
return true;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
getMimeSubtype(type) {
|
|
671
|
+
return type.substr(type.indexOf('/') + 1, type.length);
|
|
672
|
+
}
|
|
673
|
+
getMimeMainType(type) {
|
|
674
|
+
return type.substr(0, type.indexOf('/'));
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
SkyFileAttachmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
678
|
+
SkyFileAttachmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentService });
|
|
679
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentService, decorators: [{
|
|
680
|
+
type: Injectable
|
|
681
|
+
}] });
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* @internal
|
|
685
|
+
*/
|
|
686
|
+
class SkyFileItemService {
|
|
687
|
+
isFile(fileItem) {
|
|
688
|
+
const file = fileItem.file;
|
|
689
|
+
/* tslint:disable */
|
|
690
|
+
return (file &&
|
|
691
|
+
file !== undefined &&
|
|
692
|
+
file !== null &&
|
|
693
|
+
file.size !== undefined &&
|
|
694
|
+
file.size !== null);
|
|
695
|
+
/* tslint:enable */
|
|
696
|
+
}
|
|
697
|
+
isImage(fileItem) {
|
|
698
|
+
const fileTypeUpper = this.getFileTypeUpper(fileItem);
|
|
699
|
+
const slashIndex = fileTypeUpper.indexOf('/');
|
|
700
|
+
if (slashIndex >= 0) {
|
|
701
|
+
switch (fileTypeUpper.substr(fileTypeUpper.indexOf('/') + 1)) {
|
|
702
|
+
case 'BMP':
|
|
703
|
+
case 'GIF':
|
|
704
|
+
case 'JPEG':
|
|
705
|
+
case 'PNG':
|
|
706
|
+
return true;
|
|
707
|
+
default:
|
|
708
|
+
break;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
getFileExtensionUpper(fileItem) {
|
|
714
|
+
let extension = '', name;
|
|
715
|
+
/* istanbul ignore else */
|
|
716
|
+
/* sanity check */
|
|
717
|
+
if (fileItem) {
|
|
718
|
+
const file = fileItem.file;
|
|
719
|
+
if (file) {
|
|
720
|
+
/* istanbul ignore next */
|
|
721
|
+
name = file.name || '';
|
|
722
|
+
/* istanbul ignore next */
|
|
723
|
+
extension = name.substr(name.lastIndexOf('.')) || '';
|
|
724
|
+
}
|
|
725
|
+
else {
|
|
726
|
+
extension = '';
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return extension.toUpperCase();
|
|
730
|
+
}
|
|
731
|
+
getFileTypeUpper(fileItem) {
|
|
732
|
+
let fileType = '';
|
|
733
|
+
/* istanbul ignore else */
|
|
734
|
+
/* sanity check */
|
|
735
|
+
if (fileItem) {
|
|
736
|
+
const file = fileItem.file;
|
|
737
|
+
if (file) {
|
|
738
|
+
fileType = file.type || '';
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
fileType = '';
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return fileType.toUpperCase();
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
SkyFileItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileItemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
748
|
+
SkyFileItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileItemService });
|
|
749
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileItemService, decorators: [{
|
|
750
|
+
type: Injectable
|
|
751
|
+
}] });
|
|
752
|
+
|
|
753
|
+
let uniqueId$1 = 0;
|
|
754
|
+
/**
|
|
755
|
+
* Provides an element to attach a single local file.
|
|
756
|
+
*/
|
|
757
|
+
class SkyFileAttachmentComponent {
|
|
758
|
+
constructor(themeSvc, changeDetector, fileAttachmentService, fileItemService, ngControl) {
|
|
759
|
+
this.themeSvc = themeSvc;
|
|
760
|
+
this.changeDetector = changeDetector;
|
|
761
|
+
this.fileAttachmentService = fileAttachmentService;
|
|
762
|
+
this.fileItemService = fileItemService;
|
|
763
|
+
this.ngControl = ngControl;
|
|
764
|
+
/**
|
|
765
|
+
* Specifies the maximum size in bytes for valid files.
|
|
766
|
+
*/
|
|
767
|
+
this.maxFileSize = 500000;
|
|
768
|
+
/**
|
|
769
|
+
* Specifies the minimum size in bytes for valid files.
|
|
770
|
+
*/
|
|
771
|
+
this.minFileSize = 0;
|
|
772
|
+
/**
|
|
773
|
+
* Fires when users add or remove files.
|
|
774
|
+
*/
|
|
775
|
+
this.fileChange = new EventEmitter();
|
|
776
|
+
/**
|
|
777
|
+
* Fires when users select the file name link. Make sure to bind the event.
|
|
778
|
+
* If you do not, the file name link will be a dead link.
|
|
779
|
+
*/
|
|
780
|
+
this.fileClick = new EventEmitter();
|
|
781
|
+
this.acceptedOver = false;
|
|
782
|
+
this.rejectedOver = false;
|
|
783
|
+
/**
|
|
784
|
+
* Indicates whether the input is required for form validation.
|
|
785
|
+
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
786
|
+
* attributes to the input element so that forms display an invalid state until the input element
|
|
787
|
+
* is complete.
|
|
788
|
+
*/
|
|
789
|
+
this.required = false;
|
|
790
|
+
this.fileAttachmentId = uniqueId$1++;
|
|
791
|
+
this.ngUnsubscribe = new Subject();
|
|
792
|
+
this._disabled = false;
|
|
793
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
794
|
+
this._onChange = (_) => { };
|
|
795
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
796
|
+
this._onTouched = () => { };
|
|
797
|
+
this.labelElementId = `sky-file-attachment-label-${this.fileAttachmentId}`;
|
|
798
|
+
this.fileDropDescriptionElementId = `sky-file-attachment-drop-description-${this.fileAttachmentId}`;
|
|
799
|
+
if (this.ngControl) {
|
|
800
|
+
this.ngControl.valueAccessor = this;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Indicates whether to disable the input.
|
|
805
|
+
* @default false
|
|
806
|
+
*/
|
|
807
|
+
set disabled(value) {
|
|
808
|
+
const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);
|
|
809
|
+
if (this._disabled !== newDisabledState) {
|
|
810
|
+
this._disabled = newDisabledState;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
get disabled() {
|
|
814
|
+
return this._disabled;
|
|
815
|
+
}
|
|
816
|
+
get hasLabelComponent() {
|
|
817
|
+
return this.labelComponents.length > 0;
|
|
818
|
+
}
|
|
819
|
+
set value(value) {
|
|
820
|
+
// The null check is needed to address a bug in Angular 4.
|
|
821
|
+
// writeValue is being called twice, first time with a phantom null value
|
|
822
|
+
// See: https://github.com/angular/angular/issues/14988
|
|
823
|
+
// tslint:disable-next-line:no-null-keyword
|
|
824
|
+
const isNewValue = value !== this.value && value !== null;
|
|
825
|
+
if (isNewValue) {
|
|
826
|
+
this._value = value;
|
|
827
|
+
this._onChange(value);
|
|
828
|
+
this.updateFileAttachmentButton();
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
get value() {
|
|
832
|
+
return this._value;
|
|
833
|
+
}
|
|
834
|
+
ngOnInit() {
|
|
835
|
+
this.themeSvc.settingsChange
|
|
836
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
837
|
+
.subscribe((themeSettings) => {
|
|
838
|
+
this.currentThemeName = themeSettings.currentSettings.theme.name;
|
|
839
|
+
this.updateFileAttachmentButton();
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
ngAfterViewInit() {
|
|
843
|
+
// This is needed to address a bug in Angular 7.
|
|
844
|
+
// When a control value is set intially, its value is not represented on the view.
|
|
845
|
+
// See: https://github.com/angular/angular/issues/13792
|
|
846
|
+
// Of note is the parent check which allows us to determine if the form is reactive.
|
|
847
|
+
// Without this check there is a changed before checked error
|
|
848
|
+
/* istanbul ignore else */
|
|
849
|
+
if (this.ngControl) {
|
|
850
|
+
setTimeout(() => {
|
|
851
|
+
this.ngControl.control.setValue(this.value, {
|
|
852
|
+
emitEvent: false,
|
|
853
|
+
});
|
|
854
|
+
this.changeDetector.markForCheck();
|
|
855
|
+
});
|
|
856
|
+
// Backwards compatibility support for anyone still using Validators.Required.
|
|
857
|
+
this.required =
|
|
858
|
+
this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
ngAfterContentInit() {
|
|
862
|
+
// Handles updating classes when label changes
|
|
863
|
+
this.labelComponents.changes
|
|
864
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
865
|
+
.subscribe(() => {
|
|
866
|
+
this.changeDetector.detectChanges();
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
isImage() {
|
|
870
|
+
return this.fileItemService.isImage(this.value);
|
|
871
|
+
}
|
|
872
|
+
onDropClicked() {
|
|
873
|
+
this._onTouched();
|
|
874
|
+
this.inputEl.nativeElement.click();
|
|
875
|
+
}
|
|
876
|
+
fileChangeEvent(fileChangeEvent) {
|
|
877
|
+
this.handleFiles(fileChangeEvent.target.files);
|
|
878
|
+
}
|
|
879
|
+
fileDragEnter(dragEnterEvent) {
|
|
880
|
+
// Save this target to know when the drag event leaves
|
|
881
|
+
this.enterEventTarget = dragEnterEvent.target;
|
|
882
|
+
dragEnterEvent.stopPropagation();
|
|
883
|
+
dragEnterEvent.preventDefault();
|
|
884
|
+
}
|
|
885
|
+
fileDragOver(dragOverEvent) {
|
|
886
|
+
const transfer = dragOverEvent.dataTransfer;
|
|
887
|
+
dragOverEvent.stopPropagation();
|
|
888
|
+
dragOverEvent.preventDefault();
|
|
889
|
+
if (transfer) {
|
|
890
|
+
if (transfer.items) {
|
|
891
|
+
const files = transfer.items;
|
|
892
|
+
for (let index = 0; index < files.length; index++) {
|
|
893
|
+
const file = files[index];
|
|
894
|
+
if (file.type &&
|
|
895
|
+
this.fileAttachmentService.fileTypeRejected(file.type, this.acceptedTypes)) {
|
|
896
|
+
this.rejectedOver = true;
|
|
897
|
+
this.acceptedOver = false;
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (files.length > 0 && !this.acceptedOver) {
|
|
902
|
+
this.rejectedOver = false;
|
|
903
|
+
this.acceptedOver = true;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
else if (transfer.files) {
|
|
907
|
+
// If the browser does not support DataTransfer.items,
|
|
908
|
+
// defer file-type checking to drop handler.
|
|
909
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility
|
|
910
|
+
this.rejectedOver = false;
|
|
911
|
+
this.acceptedOver = true;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
fileDrop(dropEvent) {
|
|
916
|
+
dropEvent.stopPropagation();
|
|
917
|
+
dropEvent.preventDefault();
|
|
918
|
+
this.enterEventTarget = undefined;
|
|
919
|
+
this.rejectedOver = false;
|
|
920
|
+
this.acceptedOver = false;
|
|
921
|
+
if (dropEvent.dataTransfer && dropEvent.dataTransfer.files) {
|
|
922
|
+
if (dropEvent.dataTransfer.files.length > 1) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
if (this.fileAttachmentService.hasDirectory(dropEvent.dataTransfer.files)) {
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
this.handleFiles(dropEvent.dataTransfer.files);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
fileDragLeave(dragLeaveEvent) {
|
|
932
|
+
if (this.enterEventTarget === dragLeaveEvent.target) {
|
|
933
|
+
this.rejectedOver = false;
|
|
934
|
+
this.acceptedOver = false;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
deleteFileAttachment() {
|
|
938
|
+
this.value = undefined;
|
|
939
|
+
this.changeDetector.markForCheck();
|
|
940
|
+
this.emitFileChangeEvent(this.value);
|
|
941
|
+
}
|
|
942
|
+
getFileName(truncate = true) {
|
|
943
|
+
if (this.value) {
|
|
944
|
+
// tslint:disable-next-line: max-line-length
|
|
945
|
+
const dropName = this.fileItemService.isFile(this.value) && this.value.file.name
|
|
946
|
+
? this.value.file.name
|
|
947
|
+
: this.value.url;
|
|
948
|
+
if (truncate && dropName.length > 26) {
|
|
949
|
+
return dropName.slice(0, 26) + '...';
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
return dropName;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
else {
|
|
956
|
+
return undefined;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
ngOnDestroy() {
|
|
960
|
+
this.fileChange.complete();
|
|
961
|
+
this.ngUnsubscribe.next();
|
|
962
|
+
this.ngUnsubscribe.complete();
|
|
963
|
+
}
|
|
964
|
+
registerOnChange(fn) {
|
|
965
|
+
this._onChange = fn;
|
|
966
|
+
}
|
|
967
|
+
registerOnTouched(fn) {
|
|
968
|
+
this._onTouched = fn;
|
|
969
|
+
}
|
|
970
|
+
writeValue(value) {
|
|
971
|
+
this.value = value;
|
|
972
|
+
this.changeDetector.markForCheck();
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* @internal
|
|
976
|
+
* Sets the disabled state of the control. Implemented as a part of ControlValueAccessor.
|
|
977
|
+
* @param isDisabled Whether the control should be disabled.
|
|
978
|
+
*/
|
|
979
|
+
setDisabledState(isDisabled) {
|
|
980
|
+
this.disabled = isDisabled;
|
|
981
|
+
this.changeDetector.markForCheck();
|
|
982
|
+
}
|
|
983
|
+
emitClick() {
|
|
984
|
+
this.fileClick.emit({
|
|
985
|
+
file: this.value,
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
emitFileChangeEvent(currentFile) {
|
|
989
|
+
if (currentFile && !currentFile.errorType) {
|
|
990
|
+
this.writeValue(currentFile);
|
|
991
|
+
}
|
|
992
|
+
this.fileChange.emit({
|
|
993
|
+
file: currentFile,
|
|
994
|
+
});
|
|
995
|
+
this.inputEl.nativeElement.value = '';
|
|
996
|
+
}
|
|
997
|
+
loadFile(file) {
|
|
998
|
+
const reader = new FileReader();
|
|
999
|
+
reader.addEventListener('load', (event) => {
|
|
1000
|
+
file.url = event.target.result;
|
|
1001
|
+
this.emitFileChangeEvent(file);
|
|
1002
|
+
});
|
|
1003
|
+
reader.addEventListener('error', (event) => {
|
|
1004
|
+
this.emitFileChangeEvent(file);
|
|
1005
|
+
});
|
|
1006
|
+
reader.addEventListener('abort', (event) => {
|
|
1007
|
+
this.emitFileChangeEvent(file);
|
|
1008
|
+
});
|
|
1009
|
+
reader.readAsDataURL(file.file);
|
|
1010
|
+
}
|
|
1011
|
+
handleFiles(files) {
|
|
1012
|
+
// tslint:disable-next-line: max-line-length
|
|
1013
|
+
const processedFiles = this.fileAttachmentService.checkFiles(files, this.minFileSize, this.maxFileSize, this.acceptedTypes, this.validateFn);
|
|
1014
|
+
for (const file of processedFiles) {
|
|
1015
|
+
if (file.errorType) {
|
|
1016
|
+
this.emitFileChangeEvent(file);
|
|
1017
|
+
}
|
|
1018
|
+
else {
|
|
1019
|
+
this.loadFile(file);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
updateFileAttachmentButton() {
|
|
1024
|
+
this.showFileAttachmentButton = !(this.value && this.currentThemeName === 'modern');
|
|
1025
|
+
this.changeDetector.markForCheck();
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
SkyFileAttachmentComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentComponent, deps: [{ token: i1$1.SkyThemeService }, { token: i0.ChangeDetectorRef }, { token: SkyFileAttachmentService }, { token: SkyFileItemService }, { token: i4.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1029
|
+
SkyFileAttachmentComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyFileAttachmentComponent, selector: "sky-file-attachment", inputs: { acceptedTypes: "acceptedTypes", disabled: "disabled", maxFileSize: "maxFileSize", minFileSize: "minFileSize", validateFn: "validateFn", required: "required" }, outputs: { fileChange: "fileChange", fileClick: "fileClick" }, providers: [SkyFileAttachmentService], queries: [{ propertyName: "labelComponents", predicate: SkyFileAttachmentLabelComponent }], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n", styles: [".sky-file-attachment-wrapper{display:inline-block}.sky-file-attachment-upload{padding-right:8px;display:block;border:1px solid transparent}.sky-file-attachment-accept{border-color:#72bf44;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}.sky-file-attachment-reject{border-color:#ef4044;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}:host(.ng-invalid.ng-dirty) .sky-file-attachment-btn{box-shadow:0 0 8px #ef404499;border:1px solid #ef4044}.sky-file-attachment-name{padding:0 5px}.sky-file-attachment-name a{cursor:pointer}.sky-file-attachment-delete{border:none;color:#cdcfd2;cursor:pointer;padding:0}.sky-file-attachment-delete:hover{color:#979ba2;transition:color .15s}.sky-file-attachment-preview-img{max-width:25%;height:auto;box-shadow:0 0 5px #666;margin:10px}.sky-file-attachment-drop-description{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}:host-context(.sky-theme-modern) .sky-file-attachment-none{font-size:13px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}.sky-theme-modern .sky-file-attachment-none{font-size:13px}.sky-theme-modern .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1$1.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }], pipes: { "skyLibResources": i2.SkyLibResourcesPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1030
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentComponent, decorators: [{
|
|
1031
|
+
type: Component,
|
|
1032
|
+
args: [{ selector: 'sky-file-attachment', providers: [SkyFileAttachmentService], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"sky-file-attachment-wrapper\">\n <div\n class=\"sky-file-attachment-label-wrapper\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.id]=\"labelElementId\"\n [ngClass]=\"{ 'sky-control-label-required': required && hasLabelComponent }\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"></ng-container>\n </div>\n <div\n class=\"sky-file-attachment-upload sky-file-attachment sky-file-attachment-target\"\n [ngClass]=\"{\n 'sky-file-attachment-accept': acceptedOver,\n 'sky-file-attachment-reject': rejectedOver\n }\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragover)=\"fileDragOver($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n >\n <div\n aria-hidden=\"true\"\n class=\"sky-file-attachment-drop-description\"\n role=\"tooltip\"\n [attr.id]=\"fileDropDescriptionElementId\"\n >\n {{ 'skyux_file_attachment_file_upload_drag_or_click' | skyLibResources }}\n </div>\n <input\n hidden\n tabindex=\"-1\"\n type=\"file\"\n [attr.accept]=\"acceptedTypes || null\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n <button\n *ngIf=\"showFileAttachmentButton\"\n class=\"sky-file-attachment-btn sky-btn sky-btn-default\"\n type=\"button\"\n [attr.aria-describedby]=\"fileDropDescriptionElementId\"\n [disabled]=\"disabled\"\n (click)=\"onDropClicked()\"\n >\n <sky-icon icon=\"folder-open-o\"></sky-icon>\n {{\n value\n ? ('skyux_file_attachment_button_label_replace_file'\n | skyLibResources)\n : ('skyux_file_attachment_button_label_choose_file' | skyLibResources)\n }}\n </button>\n <sky-icon\n *ngIf=\"value && !isImage() && currentThemeName === 'modern'\"\n class=\"sky-file-attachment-icon sky-deemphasized\"\n icon=\"file-o\"\n size=\"2x\"\n >\n </sky-icon>\n <span\n *ngIf=\"value || currentThemeName === 'default'\"\n class=\"sky-file-attachment-name\"\n >\n <a\n *ngIf=\"value; else noFile\"\n [attr.title]=\"getFileName(false)\"\n (click)=\"emitClick()\"\n >\n {{ getFileName() }}\n </a>\n </span>\n <ng-template #noFile>\n <span class=\"sky-file-attachment-none sky-deemphasized\">\n {{ 'skyux_file_attachment_label_no_file_chosen' | skyLibResources }}\n </span>\n </ng-template>\n <button\n *ngIf=\"value\"\n class=\"sky-btn sky-btn-borderless sky-file-attachment-delete\"\n type=\"button\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n [disabled]=\"disabled\"\n [skyThemeClass]=\"{\n 'sky-btn-icon-borderless': 'modern'\n }\"\n (click)=\"deleteFileAttachment()\"\n >\n <sky-icon icon=\"trash-o\" size=\"md\"> </sky-icon>\n </button>\n </div>\n\n <img\n *ngIf=\"value && isImage()\"\n class=\"sky-file-attachment-preview-img\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n [src]=\"value.url\"\n />\n</div>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-file-attachment-label\"></ng-content>\n</ng-template>\n", styles: [".sky-file-attachment-wrapper{display:inline-block}.sky-file-attachment-upload{padding-right:8px;display:block;border:1px solid transparent}.sky-file-attachment-accept{border-color:#72bf44;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}.sky-file-attachment-reject{border-color:#ef4044;border-style:dashed;border-width:1px;border-radius:5px;color:#212327}:host(.ng-invalid.ng-dirty) .sky-file-attachment-btn{box-shadow:0 0 8px #ef404499;border:1px solid #ef4044}.sky-file-attachment-name{padding:0 5px}.sky-file-attachment-name a{cursor:pointer}.sky-file-attachment-delete{border:none;color:#cdcfd2;cursor:pointer;padding:0}.sky-file-attachment-delete:hover{color:#979ba2;transition:color .15s}.sky-file-attachment-preview-img{max-width:25%;height:auto;box-shadow:0 0 5px #666;margin:10px}.sky-file-attachment-drop-description{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}:host-context(.sky-theme-modern) .sky-file-attachment-none{font-size:13px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}:host-context(.sky-theme-modern) .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}.sky-theme-modern .sky-file-attachment-none{font-size:13px}.sky-theme-modern .sky-file-attachment-wrapper{display:flex;flex-wrap:wrap}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-label-wrapper{width:100%}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-preview-img{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;box-shadow:none;margin:0 10px 0 0;width:100px;flex:0;order:1}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-btn{margin:0 10px 0 0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-icon{margin:5px 10px 5px 5px}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload{flex:1;order:2;display:flex;align-items:flex-start}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-upload .sky-file-attachment-name{margin:10px 10px 0 0;padding:0}.sky-theme-modern .sky-file-attachment-wrapper .sky-file-attachment-delete{width:40px;height:40px;color:#686c73!important}\n"] }]
|
|
1033
|
+
}], ctorParameters: function () {
|
|
1034
|
+
return [{ type: i1$1.SkyThemeService }, { type: i0.ChangeDetectorRef }, { type: SkyFileAttachmentService }, { type: SkyFileItemService }, { type: i4.NgControl, decorators: [{
|
|
1035
|
+
type: Self
|
|
1036
|
+
}, {
|
|
1037
|
+
type: Optional
|
|
1038
|
+
}] }];
|
|
1039
|
+
}, propDecorators: { acceptedTypes: [{
|
|
1040
|
+
type: Input
|
|
1041
|
+
}], disabled: [{
|
|
1042
|
+
type: Input
|
|
1043
|
+
}], maxFileSize: [{
|
|
1044
|
+
type: Input
|
|
1045
|
+
}], minFileSize: [{
|
|
1046
|
+
type: Input
|
|
1047
|
+
}], validateFn: [{
|
|
1048
|
+
type: Input
|
|
1049
|
+
}], fileChange: [{
|
|
1050
|
+
type: Output
|
|
1051
|
+
}], fileClick: [{
|
|
1052
|
+
type: Output
|
|
1053
|
+
}], required: [{
|
|
1054
|
+
type: Input
|
|
1055
|
+
}], inputEl: [{
|
|
1056
|
+
type: ViewChild,
|
|
1057
|
+
args: ['fileInput']
|
|
1058
|
+
}], labelComponents: [{
|
|
1059
|
+
type: ContentChildren,
|
|
1060
|
+
args: [SkyFileAttachmentLabelComponent]
|
|
1061
|
+
}] } });
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Provides an element to attach multiple files where users can browse or drag and drop local files
|
|
1065
|
+
* or provide hyperlinks to external files. You can leave the contents of the component
|
|
1066
|
+
* blank to display the drop zone's default UI, or you can specify custom content to
|
|
1067
|
+
* display instead. When the module initializes, it disables the ability to drag and
|
|
1068
|
+
* drop files for the entire window to prevent the browser from opening files that are
|
|
1069
|
+
* accidentally dropped outside the target zone. If you implement your own file drop functionality
|
|
1070
|
+
* outside of the file drop component, you can place the `sky-file-drop-target` CSS class
|
|
1071
|
+
* on the element that receives drop events to exempt it from the drop exclusion rule.
|
|
1072
|
+
*/
|
|
1073
|
+
class SkyFileDropComponent {
|
|
1074
|
+
constructor(fileAttachmentService) {
|
|
1075
|
+
this.fileAttachmentService = fileAttachmentService;
|
|
1076
|
+
/**
|
|
1077
|
+
* Fires when users add or remove files.
|
|
1078
|
+
*/
|
|
1079
|
+
this.filesChanged = new EventEmitter();
|
|
1080
|
+
/**
|
|
1081
|
+
* Fires when the link input box triggers a blur event.
|
|
1082
|
+
*/
|
|
1083
|
+
this.linkInputBlur = new EventEmitter();
|
|
1084
|
+
/**
|
|
1085
|
+
* Fires when users add or remove links.
|
|
1086
|
+
*/
|
|
1087
|
+
this.linkChanged = new EventEmitter();
|
|
1088
|
+
/**
|
|
1089
|
+
* Specifies the minimum size in bytes for valid files.
|
|
1090
|
+
*/
|
|
1091
|
+
this.minFileSize = 0;
|
|
1092
|
+
/**
|
|
1093
|
+
* Specifies the maximum size in bytes for valid files.
|
|
1094
|
+
*/
|
|
1095
|
+
this.maxFileSize = 500000;
|
|
1096
|
+
/**
|
|
1097
|
+
* Indicates whether users can drag and drop multiple files at the same time.
|
|
1098
|
+
*/
|
|
1099
|
+
this.multiple = true;
|
|
1100
|
+
/**
|
|
1101
|
+
* Indicates whether to disable the option to browse for files to attach.
|
|
1102
|
+
*/
|
|
1103
|
+
this.noClick = false;
|
|
1104
|
+
/**
|
|
1105
|
+
* Indicates whether to display the option to attach files from URLs rather than from local devices.
|
|
1106
|
+
*/
|
|
1107
|
+
this.allowLinks = false;
|
|
1108
|
+
this.rejectedOver = false;
|
|
1109
|
+
this.acceptedOver = false;
|
|
1110
|
+
}
|
|
1111
|
+
ngOnDestroy() {
|
|
1112
|
+
this.filesChanged.complete();
|
|
1113
|
+
this.linkChanged.complete();
|
|
1114
|
+
this.linkInputBlur.complete();
|
|
1115
|
+
}
|
|
1116
|
+
dropClicked() {
|
|
1117
|
+
if (!this.noClick) {
|
|
1118
|
+
this.inputEl.nativeElement.click();
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
fileChangeEvent(fileChangeEvent) {
|
|
1122
|
+
this.handleFiles(fileChangeEvent.target.files);
|
|
1123
|
+
}
|
|
1124
|
+
fileDragEnter(dragEnterEvent) {
|
|
1125
|
+
// Save this target to know when the drag event leaves
|
|
1126
|
+
this.enterEventTarget = dragEnterEvent.target;
|
|
1127
|
+
dragEnterEvent.stopPropagation();
|
|
1128
|
+
dragEnterEvent.preventDefault();
|
|
1129
|
+
}
|
|
1130
|
+
fileDragOver(dragOverEvent) {
|
|
1131
|
+
const transfer = dragOverEvent.dataTransfer;
|
|
1132
|
+
dragOverEvent.stopPropagation();
|
|
1133
|
+
dragOverEvent.preventDefault();
|
|
1134
|
+
if (transfer) {
|
|
1135
|
+
if (transfer.items) {
|
|
1136
|
+
const files = transfer.items;
|
|
1137
|
+
for (let index = 0; index < files.length; index++) {
|
|
1138
|
+
const file = files[index];
|
|
1139
|
+
if (file.type &&
|
|
1140
|
+
this.fileAttachmentService.fileTypeRejected(file.type, this.acceptedTypes)) {
|
|
1141
|
+
this.rejectedOver = true;
|
|
1142
|
+
this.acceptedOver = false;
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (files.length > 0 && !this.acceptedOver) {
|
|
1147
|
+
this.rejectedOver = false;
|
|
1148
|
+
this.acceptedOver = true;
|
|
1149
|
+
}
|
|
1150
|
+
} /* istanbul ignore next: untestable */
|
|
1151
|
+
else if (transfer.files) {
|
|
1152
|
+
// If the browser does not support DataTransfer.items,
|
|
1153
|
+
// defer file-type checking to drop handler.
|
|
1154
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/items#Browser_compatibility
|
|
1155
|
+
this.rejectedOver = false;
|
|
1156
|
+
this.acceptedOver = true;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
fileDrop(dropEvent) {
|
|
1161
|
+
dropEvent.stopPropagation();
|
|
1162
|
+
dropEvent.preventDefault();
|
|
1163
|
+
this.enterEventTarget = undefined;
|
|
1164
|
+
this.rejectedOver = false;
|
|
1165
|
+
this.acceptedOver = false;
|
|
1166
|
+
if (dropEvent.dataTransfer && dropEvent.dataTransfer.files) {
|
|
1167
|
+
const hasDirectory = this.fileAttachmentService.hasDirectory(dropEvent.dataTransfer.files);
|
|
1168
|
+
const invalidNumberOfFiles = !this.multiple && dropEvent.dataTransfer.files.length > 1;
|
|
1169
|
+
if (hasDirectory || invalidNumberOfFiles) {
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
this.handleFiles(dropEvent.dataTransfer.files);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
fileDragLeave(dragLeaveEvent) {
|
|
1176
|
+
if (this.enterEventTarget === dragLeaveEvent.target) {
|
|
1177
|
+
this.rejectedOver = false;
|
|
1178
|
+
this.acceptedOver = false;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
addLinkEnter(event) {
|
|
1182
|
+
if (event.which === 13) {
|
|
1183
|
+
this.addLink(event);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
addLink(event) {
|
|
1187
|
+
event.preventDefault();
|
|
1188
|
+
this.linkChanged.emit({ url: this.linkUrl });
|
|
1189
|
+
this.linkUrl = undefined;
|
|
1190
|
+
}
|
|
1191
|
+
onLinkBlur() {
|
|
1192
|
+
this.linkInputBlur.emit();
|
|
1193
|
+
}
|
|
1194
|
+
emitFileChangeEvent(totalFiles, rejectedFileArray, validFileArray) {
|
|
1195
|
+
if (totalFiles === rejectedFileArray.length + validFileArray.length) {
|
|
1196
|
+
this.filesChanged.emit({
|
|
1197
|
+
files: validFileArray,
|
|
1198
|
+
rejectedFiles: rejectedFileArray,
|
|
1199
|
+
});
|
|
1200
|
+
this.inputEl.nativeElement.value = '';
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
filesRejected(file, validFileArray, rejectedFileArray, totalFiles) {
|
|
1204
|
+
rejectedFileArray.push(file);
|
|
1205
|
+
this.emitFileChangeEvent(totalFiles, rejectedFileArray, validFileArray);
|
|
1206
|
+
}
|
|
1207
|
+
loadFile(fileDrop, file, validFileArray, rejectedFileArray, totalFiles) {
|
|
1208
|
+
const reader = new FileReader();
|
|
1209
|
+
reader.addEventListener('load', (event) => {
|
|
1210
|
+
file.url = event.target.result;
|
|
1211
|
+
validFileArray.push(file);
|
|
1212
|
+
fileDrop.emitFileChangeEvent(totalFiles, rejectedFileArray, validFileArray);
|
|
1213
|
+
});
|
|
1214
|
+
reader.addEventListener('error', (event) => {
|
|
1215
|
+
fileDrop.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
|
|
1216
|
+
});
|
|
1217
|
+
reader.addEventListener('abort', (event) => {
|
|
1218
|
+
fileDrop.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
|
|
1219
|
+
});
|
|
1220
|
+
reader.readAsDataURL(file.file);
|
|
1221
|
+
}
|
|
1222
|
+
handleFiles(files) {
|
|
1223
|
+
const validFileArray = [];
|
|
1224
|
+
const rejectedFileArray = [];
|
|
1225
|
+
const totalFiles = files.length;
|
|
1226
|
+
// tslint:disable-next-line: max-line-length
|
|
1227
|
+
const processedFiles = this.fileAttachmentService.checkFiles(files, this.minFileSize, this.maxFileSize, this.acceptedTypes, this.validateFn);
|
|
1228
|
+
for (const file of processedFiles) {
|
|
1229
|
+
if (file.errorType) {
|
|
1230
|
+
this.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
|
|
1231
|
+
}
|
|
1232
|
+
else {
|
|
1233
|
+
this.loadFile(this, file, validFileArray, rejectedFileArray, totalFiles);
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
SkyFileDropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileDropComponent, deps: [{ token: SkyFileAttachmentService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1239
|
+
SkyFileDropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyFileDropComponent, selector: "sky-file-drop", inputs: { fileUploadAriaLabel: "fileUploadAriaLabel", linkUploadAriaLabel: "linkUploadAriaLabel", minFileSize: "minFileSize", maxFileSize: "maxFileSize", multiple: "multiple", validateFn: "validateFn", acceptedTypes: "acceptedTypes", noClick: "noClick", allowLinks: "allowLinks" }, outputs: { filesChanged: "filesChanged", linkInputBlur: "linkInputBlur", linkChanged: "linkChanged" }, providers: [SkyFileAttachmentService], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div\n class=\"sky-file-drop-row\"\n [ngClass]=\"{ 'sky-file-drop-allow-links': allowLinks }\"\n>\n <div\n class=\"sky-file-drop-col\"\n [ngClass]=\"{\n 'sky-file-drop-accept': acceptedOver,\n 'sky-file-drop-reject': rejectedOver\n }\"\n >\n <button\n class=\"sky-file-drop sky-file-drop-target\"\n type=\"button\"\n (click)=\"dropClicked()\"\n (dragover)=\"fileDragOver($event)\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n [attr.aria-label]=\"\n fileUploadAriaLabel ||\n ('skyux_file_attachment_file_upload_drag_or_click' | skyLibResources)\n \"\n ></button>\n\n <input\n tabindex=\"-1\"\n aria-hidden=\"true\"\n type=\"file\"\n class=\"sky-file-input-hidden\"\n [attr.multiple]=\"multiple ? multiple : null\"\n [attr.accept]=\"acceptedTypes ? acceptedTypes : null\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n\n <div\n class=\"sky-file-drop-contents sky-padding-even-default\"\n *ngIf=\"customEl.children.length === 0\"\n >\n <div class=\"sky-file-drop-contents-not-over\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_drag_file_here' | skyLibResources\n }}\n </div>\n <div class=\"sky-file-drop-text\">\n {{\n 'skyux_file_attachment_file_upload_or_click_to_browse'\n | skyLibResources\n }}\n </div>\n <sky-icon icon=\"cloud-upload\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n\n <!-- This will appear when file is dragged over and is valid -->\n <div class=\"sky-file-drop-contents-accept\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_drop_files_here'\n | skyLibResources\n }}\n </div>\n <sky-icon icon=\"bullseye\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n\n <!-- This will appear when file is dragged over and is invalid -->\n <div class=\"sky-file-drop-contents-reject\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_invalid_file' | skyLibResources\n }}\n </div>\n <sky-icon icon=\"times-circle\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n </div>\n\n <div class=\"sky-file-drop-contents-custom\" #customEl>\n <ng-content></ng-content>\n </div>\n </div>\n <div class=\"sky-file-drop-col\" *ngIf=\"allowLinks\">\n <div class=\"sky-file-drop-contents sky-padding-even-default\">\n <div class=\"sky-file-drop-link\">\n <div class=\"sky-file-drop-link-header\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_paste_link' | skyLibResources\n }}\n </div>\n </div>\n <div class=\"sky-form-group\">\n <input\n type=\"text\"\n class=\"sky-form-control\"\n [attr.aria-label]=\"\n linkUploadAriaLabel ||\n ('skyux_file_attachment_file_upload_link_input' | skyLibResources)\n \"\n [attr.placeholder]=\"\n 'skyux_file_attachment_file_upload_link_placeholder'\n | skyLibResources\n \"\n [(ngModel)]=\"linkUrl\"\n (blur)=\"onLinkBlur()\"\n (keyup)=\"addLinkEnter($event)\"\n />\n </div>\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!linkUrl\"\n (click)=\"addLink($event)\"\n >\n {{\n 'skyux_file_attachment_file_upload_paste_link_done'\n | skyLibResources\n }}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".sky-file-drop-col{margin-bottom:10px;padding-left:5px;padding-right:5px;position:relative}:host .sky-file-drop-row{display:block}:host .sky-file-drop-col{flex-basis:auto}:host .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:auto}:host-context(.sky-responsive-container-xs) .sky-file-drop-row,:host-context(.sky-responsive-container-sm) .sky-file-drop-row,:host-context(.sky-responsive-container-md) .sky-file-drop-row,:host-context(.sky-responsive-container-lg) .sky-file-drop-row{display:block}:host-context(.sky-responsive-container-xs) .sky-file-drop-col,:host-context(.sky-responsive-container-sm) .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-col{flex-basis:auto}:host-context(.sky-responsive-container-xs) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-sm) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:auto}@media (min-width: 768px){:host .sky-file-drop-row{display:flex}:host .sky-file-drop-col{flex-basis:100%}:host .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:50%}}:host-context(.sky-responsive-container-sm) .sky-file-drop-row,:host-context(.sky-responsive-container-md) .sky-file-drop-row,:host-context(.sky-responsive-container-lg) .sky-file-drop-row{display:flex}:host-context(.sky-responsive-container-sm) .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-col{flex-basis:100%}:host-context(.sky-responsive-container-sm) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:50%}button.sky-file-drop{height:100%;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1}button.sky-file-drop:hover{cursor:pointer}.sky-file-drop-contents{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;background-color:#eeeeef;color:#212327;cursor:pointer;width:100%;text-align:center;height:100%}.sky-file-drop-contents .sky-file-drop-link-header{margin-bottom:5px}.sky-file-drop-noclick .sky-file-drop-contents{cursor:default}.sky-file-drop-accept .sky-file-drop-contents,.sky-file-drop-reject .sky-file-drop-contents{border-style:dashed;border-width:1px}.sky-file-drop-accept .sky-file-drop-contents-not-over,.sky-file-drop-reject .sky-file-drop-contents-not-over{display:none}.sky-file-drop-accept .sky-file-drop-contents{border-color:#72bf44;color:#212327}.sky-file-drop-accept .sky-file-drop-contents-accept{display:block}.sky-file-drop-reject .sky-file-drop-contents{border-color:#ef4044;color:#212327}.sky-file-drop-reject .sky-file-drop-contents-reject{display:block}.sky-file-drop-contents-accept,.sky-file-drop-contents-reject{display:none}.sky-file-upload-icon{display:block;font-size:40px;max-height:40px;margin-top:10px}.sky-file-drop-link{cursor:default}.sky-file-drop-text-header{margin:0}.sky-file-drop-text{font-size:15px;margin-top:5px;margin-bottom:20px}.sky-file-drop-text,.sky-file-drop-text-header{line-height:1.1;display:block}.sky-file-upload-icon{color:#686c73}.sky-file-drop{background-color:transparent;border:none;display:block;-webkit-appearance:none;width:100%;padding:0}.sky-file-input-hidden{display:none}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "skyLibResources": i2.SkyLibResourcesPipe } });
|
|
1240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileDropComponent, decorators: [{
|
|
1241
|
+
type: Component,
|
|
1242
|
+
args: [{ selector: 'sky-file-drop', providers: [SkyFileAttachmentService], template: "<div\n class=\"sky-file-drop-row\"\n [ngClass]=\"{ 'sky-file-drop-allow-links': allowLinks }\"\n>\n <div\n class=\"sky-file-drop-col\"\n [ngClass]=\"{\n 'sky-file-drop-accept': acceptedOver,\n 'sky-file-drop-reject': rejectedOver\n }\"\n >\n <button\n class=\"sky-file-drop sky-file-drop-target\"\n type=\"button\"\n (click)=\"dropClicked()\"\n (dragover)=\"fileDragOver($event)\"\n (dragenter)=\"fileDragEnter($event)\"\n (dragleave)=\"fileDragLeave($event)\"\n (drop)=\"fileDrop($event)\"\n [attr.aria-label]=\"\n fileUploadAriaLabel ||\n ('skyux_file_attachment_file_upload_drag_or_click' | skyLibResources)\n \"\n ></button>\n\n <input\n tabindex=\"-1\"\n aria-hidden=\"true\"\n type=\"file\"\n class=\"sky-file-input-hidden\"\n [attr.multiple]=\"multiple ? multiple : null\"\n [attr.accept]=\"acceptedTypes ? acceptedTypes : null\"\n (change)=\"fileChangeEvent($event)\"\n #fileInput\n />\n\n <div\n class=\"sky-file-drop-contents sky-padding-even-default\"\n *ngIf=\"customEl.children.length === 0\"\n >\n <div class=\"sky-file-drop-contents-not-over\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_drag_file_here' | skyLibResources\n }}\n </div>\n <div class=\"sky-file-drop-text\">\n {{\n 'skyux_file_attachment_file_upload_or_click_to_browse'\n | skyLibResources\n }}\n </div>\n <sky-icon icon=\"cloud-upload\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n\n <!-- This will appear when file is dragged over and is valid -->\n <div class=\"sky-file-drop-contents-accept\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_drop_files_here'\n | skyLibResources\n }}\n </div>\n <sky-icon icon=\"bullseye\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n\n <!-- This will appear when file is dragged over and is invalid -->\n <div class=\"sky-file-drop-contents-reject\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_invalid_file' | skyLibResources\n }}\n </div>\n <sky-icon icon=\"times-circle\" class=\"sky-file-upload-icon\"></sky-icon>\n </div>\n </div>\n\n <div class=\"sky-file-drop-contents-custom\" #customEl>\n <ng-content></ng-content>\n </div>\n </div>\n <div class=\"sky-file-drop-col\" *ngIf=\"allowLinks\">\n <div class=\"sky-file-drop-contents sky-padding-even-default\">\n <div class=\"sky-file-drop-link\">\n <div class=\"sky-file-drop-link-header\">\n <div class=\"sky-file-drop-text-header sky-headline\">\n {{\n 'skyux_file_attachment_file_upload_paste_link' | skyLibResources\n }}\n </div>\n </div>\n <div class=\"sky-form-group\">\n <input\n type=\"text\"\n class=\"sky-form-control\"\n [attr.aria-label]=\"\n linkUploadAriaLabel ||\n ('skyux_file_attachment_file_upload_link_input' | skyLibResources)\n \"\n [attr.placeholder]=\"\n 'skyux_file_attachment_file_upload_link_placeholder'\n | skyLibResources\n \"\n [(ngModel)]=\"linkUrl\"\n (blur)=\"onLinkBlur()\"\n (keyup)=\"addLinkEnter($event)\"\n />\n </div>\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!linkUrl\"\n (click)=\"addLink($event)\"\n >\n {{\n 'skyux_file_attachment_file_upload_paste_link_done'\n | skyLibResources\n }}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".sky-file-drop-col{margin-bottom:10px;padding-left:5px;padding-right:5px;position:relative}:host .sky-file-drop-row{display:block}:host .sky-file-drop-col{flex-basis:auto}:host .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:auto}:host-context(.sky-responsive-container-xs) .sky-file-drop-row,:host-context(.sky-responsive-container-sm) .sky-file-drop-row,:host-context(.sky-responsive-container-md) .sky-file-drop-row,:host-context(.sky-responsive-container-lg) .sky-file-drop-row{display:block}:host-context(.sky-responsive-container-xs) .sky-file-drop-col,:host-context(.sky-responsive-container-sm) .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-col{flex-basis:auto}:host-context(.sky-responsive-container-xs) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-sm) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:auto}@media (min-width: 768px){:host .sky-file-drop-row{display:flex}:host .sky-file-drop-col{flex-basis:100%}:host .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:50%}}:host-context(.sky-responsive-container-sm) .sky-file-drop-row,:host-context(.sky-responsive-container-md) .sky-file-drop-row,:host-context(.sky-responsive-container-lg) .sky-file-drop-row{display:flex}:host-context(.sky-responsive-container-sm) .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-col{flex-basis:100%}:host-context(.sky-responsive-container-sm) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-md) .sky-file-drop-allow-links .sky-file-drop-col,:host-context(.sky-responsive-container-lg) .sky-file-drop-allow-links .sky-file-drop-col{flex-basis:50%}button.sky-file-drop{height:100%;position:absolute;top:0;right:0;bottom:0;left:0;z-index:1}button.sky-file-drop:hover{cursor:pointer}.sky-file-drop-contents{border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2;background-color:#eeeeef;color:#212327;cursor:pointer;width:100%;text-align:center;height:100%}.sky-file-drop-contents .sky-file-drop-link-header{margin-bottom:5px}.sky-file-drop-noclick .sky-file-drop-contents{cursor:default}.sky-file-drop-accept .sky-file-drop-contents,.sky-file-drop-reject .sky-file-drop-contents{border-style:dashed;border-width:1px}.sky-file-drop-accept .sky-file-drop-contents-not-over,.sky-file-drop-reject .sky-file-drop-contents-not-over{display:none}.sky-file-drop-accept .sky-file-drop-contents{border-color:#72bf44;color:#212327}.sky-file-drop-accept .sky-file-drop-contents-accept{display:block}.sky-file-drop-reject .sky-file-drop-contents{border-color:#ef4044;color:#212327}.sky-file-drop-reject .sky-file-drop-contents-reject{display:block}.sky-file-drop-contents-accept,.sky-file-drop-contents-reject{display:none}.sky-file-upload-icon{display:block;font-size:40px;max-height:40px;margin-top:10px}.sky-file-drop-link{cursor:default}.sky-file-drop-text-header{margin:0}.sky-file-drop-text{font-size:15px;margin-top:5px;margin-bottom:20px}.sky-file-drop-text,.sky-file-drop-text-header{line-height:1.1;display:block}.sky-file-upload-icon{color:#686c73}.sky-file-drop{background-color:transparent;border:none;display:block;-webkit-appearance:none;width:100%;padding:0}.sky-file-input-hidden{display:none}\n"] }]
|
|
1243
|
+
}], ctorParameters: function () { return [{ type: SkyFileAttachmentService }]; }, propDecorators: { filesChanged: [{
|
|
1244
|
+
type: Output
|
|
1245
|
+
}], linkInputBlur: [{
|
|
1246
|
+
type: Output
|
|
1247
|
+
}], linkChanged: [{
|
|
1248
|
+
type: Output
|
|
1249
|
+
}], fileUploadAriaLabel: [{
|
|
1250
|
+
type: Input
|
|
1251
|
+
}], linkUploadAriaLabel: [{
|
|
1252
|
+
type: Input
|
|
1253
|
+
}], minFileSize: [{
|
|
1254
|
+
type: Input
|
|
1255
|
+
}], maxFileSize: [{
|
|
1256
|
+
type: Input
|
|
1257
|
+
}], multiple: [{
|
|
1258
|
+
type: Input
|
|
1259
|
+
}], validateFn: [{
|
|
1260
|
+
type: Input
|
|
1261
|
+
}], acceptedTypes: [{
|
|
1262
|
+
type: Input
|
|
1263
|
+
}], noClick: [{
|
|
1264
|
+
type: Input
|
|
1265
|
+
}], allowLinks: [{
|
|
1266
|
+
type: Input
|
|
1267
|
+
}], inputEl: [{
|
|
1268
|
+
type: ViewChild,
|
|
1269
|
+
args: ['fileInput']
|
|
1270
|
+
}] } });
|
|
1271
|
+
|
|
1272
|
+
/**
|
|
1273
|
+
* @internal
|
|
1274
|
+
*/
|
|
1275
|
+
class SkyFileSizePipe {
|
|
1276
|
+
constructor(decimalPipe, resourcesService) {
|
|
1277
|
+
this.decimalPipe = decimalPipe;
|
|
1278
|
+
this.resourcesService = resourcesService;
|
|
1279
|
+
}
|
|
1280
|
+
transform(input) {
|
|
1281
|
+
let decimalPlaces = 0, dividend = 1, template;
|
|
1282
|
+
/* tslint:disable */
|
|
1283
|
+
if (input === null || input === undefined) {
|
|
1284
|
+
return '';
|
|
1285
|
+
}
|
|
1286
|
+
/* tslint:enable */
|
|
1287
|
+
if (Math.abs(input) === 1) {
|
|
1288
|
+
template = 'skyux_file_attachment_file_size_b_singular';
|
|
1289
|
+
}
|
|
1290
|
+
else if (input < 1000) {
|
|
1291
|
+
template = 'skyux_file_attachment_file_size_b_plural';
|
|
1292
|
+
}
|
|
1293
|
+
else if (input < 1e6) {
|
|
1294
|
+
template = 'skyux_file_attachment_file_size_kb';
|
|
1295
|
+
dividend = 1000;
|
|
1296
|
+
}
|
|
1297
|
+
else if (input < 1e9) {
|
|
1298
|
+
template = 'skyux_file_attachment_file_size_mb';
|
|
1299
|
+
dividend = 1e6;
|
|
1300
|
+
decimalPlaces = 1;
|
|
1301
|
+
}
|
|
1302
|
+
else {
|
|
1303
|
+
template = 'skyux_file_attachment_file_size_gb';
|
|
1304
|
+
dividend = 1e9;
|
|
1305
|
+
decimalPlaces = 1;
|
|
1306
|
+
}
|
|
1307
|
+
const roundedSize = Math.floor(input / (dividend / Math.pow(10, decimalPlaces))) /
|
|
1308
|
+
Math.pow(10, decimalPlaces);
|
|
1309
|
+
const formattedSize = this.decimalPipe.transform(roundedSize, '.0-3');
|
|
1310
|
+
return this.getString(template, formattedSize);
|
|
1311
|
+
}
|
|
1312
|
+
getString(key, ...args) {
|
|
1313
|
+
// TODO: Need to implement the async `getString` method in a breaking change.
|
|
1314
|
+
return this.resourcesService.getStringForLocale({ locale: 'en-US' }, key, ...args);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
SkyFileSizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileSizePipe, deps: [{ token: i1.DecimalPipe }, { token: i2.SkyLibResourcesService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1318
|
+
SkyFileSizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileSizePipe, name: "skyFileSize" });
|
|
1319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileSizePipe, decorators: [{
|
|
1320
|
+
type: Pipe,
|
|
1321
|
+
args: [{
|
|
1322
|
+
name: 'skyFileSize',
|
|
1323
|
+
}]
|
|
1324
|
+
}], ctorParameters: function () { return [{ type: i1.DecimalPipe }, { type: i2.SkyLibResourcesService }]; } });
|
|
1325
|
+
|
|
1326
|
+
class SkyFileItemComponent {
|
|
1327
|
+
constructor(differs, fileItemService) {
|
|
1328
|
+
this.differs = differs;
|
|
1329
|
+
this.fileItemService = fileItemService;
|
|
1330
|
+
/**
|
|
1331
|
+
* Fires when users select the delete button for an item. The deleted item is passed to the
|
|
1332
|
+
* function.
|
|
1333
|
+
*/
|
|
1334
|
+
this.deleteFile = new EventEmitter();
|
|
1335
|
+
this.differ = this.differs.find({}).create();
|
|
1336
|
+
}
|
|
1337
|
+
get fileName() {
|
|
1338
|
+
return this.fileItem.file.name;
|
|
1339
|
+
}
|
|
1340
|
+
get fileSize() {
|
|
1341
|
+
return this.fileItem.file.size;
|
|
1342
|
+
}
|
|
1343
|
+
get url() {
|
|
1344
|
+
return this.fileItem.url;
|
|
1345
|
+
}
|
|
1346
|
+
ngDoCheck() {
|
|
1347
|
+
const changes = this.differ.diff(this.fileItem);
|
|
1348
|
+
if (changes) {
|
|
1349
|
+
let cls;
|
|
1350
|
+
const extensionUpper = this.fileItemService.getFileExtensionUpper(this.fileItem);
|
|
1351
|
+
let fileTypeUpper;
|
|
1352
|
+
switch (extensionUpper) {
|
|
1353
|
+
case '.PDF':
|
|
1354
|
+
cls = 'pdf';
|
|
1355
|
+
break;
|
|
1356
|
+
case '.GZ':
|
|
1357
|
+
case '.RAR':
|
|
1358
|
+
case '.TGZ':
|
|
1359
|
+
case '.ZIP':
|
|
1360
|
+
cls = 'archive';
|
|
1361
|
+
break;
|
|
1362
|
+
case '.PPT':
|
|
1363
|
+
case '.PPTX':
|
|
1364
|
+
cls = 'powerpoint';
|
|
1365
|
+
break;
|
|
1366
|
+
case '.DOC':
|
|
1367
|
+
case '.DOCX':
|
|
1368
|
+
cls = 'word';
|
|
1369
|
+
break;
|
|
1370
|
+
case '.XLS':
|
|
1371
|
+
case '.XLSX':
|
|
1372
|
+
cls = 'excel';
|
|
1373
|
+
break;
|
|
1374
|
+
case '.TXT':
|
|
1375
|
+
cls = 'text';
|
|
1376
|
+
break;
|
|
1377
|
+
case '.HTM':
|
|
1378
|
+
case '.HTML':
|
|
1379
|
+
cls = 'code';
|
|
1380
|
+
break;
|
|
1381
|
+
default:
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
if (!cls) {
|
|
1385
|
+
fileTypeUpper = this.fileItemService.getFileTypeUpper(this.fileItem);
|
|
1386
|
+
switch (fileTypeUpper.substr(0, fileTypeUpper.indexOf('/'))) {
|
|
1387
|
+
case 'AUDIO':
|
|
1388
|
+
cls = 'audio';
|
|
1389
|
+
break;
|
|
1390
|
+
case 'IMAGE':
|
|
1391
|
+
// Normally images are displayed as thumbnails, but if an image type is not recognized
|
|
1392
|
+
// as being widely supported by modern browsers (e.g. TIFF files) then an icon should
|
|
1393
|
+
// be displayed instead.
|
|
1394
|
+
cls = 'image';
|
|
1395
|
+
break;
|
|
1396
|
+
case 'TEXT':
|
|
1397
|
+
cls = 'text';
|
|
1398
|
+
break;
|
|
1399
|
+
case 'VIDEO':
|
|
1400
|
+
cls = 'video';
|
|
1401
|
+
break;
|
|
1402
|
+
default:
|
|
1403
|
+
break;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
this.icon = 'file-' + (cls ? cls + '-' : '') + 'o';
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
itemDelete() {
|
|
1410
|
+
this.deleteFile.emit(this.fileItem);
|
|
1411
|
+
}
|
|
1412
|
+
isFile() {
|
|
1413
|
+
return this.fileItemService.isFile(this.fileItem);
|
|
1414
|
+
}
|
|
1415
|
+
isImage() {
|
|
1416
|
+
return this.fileItemService.isImage(this.fileItem);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
SkyFileItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileItemComponent, deps: [{ token: i0.KeyValueDiffers }, { token: SkyFileItemService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1420
|
+
SkyFileItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyFileItemComponent, selector: "sky-file-item", inputs: { fileItem: "fileItem" }, outputs: { deleteFile: "deleteFile" }, ngImport: i0, template: "<div class=\"sky-file-item sky-padding-even-default\">\n <div class=\"sky-file-item-title\">\n <div class=\"sky-file-item-name-container\">\n <div class=\"sky-file-item-name\">\n <strong *ngIf=\"isFile()\">{{ fileName }}</strong>\n <strong *ngIf=\"!isFile()\">{{ url }}</strong>\n </div>\n <div class=\"sky-file-item-size\" *ngIf=\"isFile()\">\n ({{ fileSize | skyFileSize }})\n </div>\n </div>\n <div class=\"sky-file-item-controls\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-file-item-btn-delete\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n (click)=\"itemDelete()\"\n >\n <sky-icon icon=\"trash-o\" size=\"lg\"></sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-file-item-content\">\n <div class=\"sky-file-item-preview\">\n <div *ngIf=\"isImage()\" class=\"sky-file-item-preview-img-container\">\n <img\n class=\"sky-file-item-preview-img\"\n [src]=\"url\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n />\n </div>\n <div *ngIf=\"!isImage()\" class=\"sky-file-item-preview-other\">\n <sky-icon [icon]=\"icon\"></sky-icon>\n </div>\n </div>\n <div class=\"sky-file-item-content-custom\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n", styles: [".sky-file-item{border-top:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;border-right:1px solid #e2e3e4;background-color:#eeeeef;margin-bottom:10px}.sky-file-item-name-container{flex:1 1 auto;overflow:hidden}.sky-file-item-controls{flex:0 1 auto;padding-left:15px}.sky-file-item-name{white-space:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis}.sky-file-item-title{margin-bottom:10px;display:flex}.sky-file-item-content{display:flex}.sky-file-item-preview{flex-basis:25%}.sky-file-item-content-custom{flex-basis:75%}.sky-file-item-preview-img-container{text-align:center}.sky-file-item-preview-img{max-width:100%;height:auto;box-shadow:0 0 5px #666}.sky-file-item-preview-other{color:#686c73;font-size:100px;line-height:1;text-align:center;width:100%}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "skyFileSize": SkyFileSizePipe, "skyLibResources": i2.SkyLibResourcesPipe } });
|
|
1421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileItemComponent, decorators: [{
|
|
1422
|
+
type: Component,
|
|
1423
|
+
args: [{ selector: 'sky-file-item', template: "<div class=\"sky-file-item sky-padding-even-default\">\n <div class=\"sky-file-item-title\">\n <div class=\"sky-file-item-name-container\">\n <div class=\"sky-file-item-name\">\n <strong *ngIf=\"isFile()\">{{ fileName }}</strong>\n <strong *ngIf=\"!isFile()\">{{ url }}</strong>\n </div>\n <div class=\"sky-file-item-size\" *ngIf=\"isFile()\">\n ({{ fileSize | skyFileSize }})\n </div>\n </div>\n <div class=\"sky-file-item-controls\">\n <button\n type=\"button\"\n class=\"sky-btn sky-btn-default sky-file-item-btn-delete\"\n [attr.aria-label]=\"\n 'skyux_file_attachment_file_item_delete' | skyLibResources\n \"\n (click)=\"itemDelete()\"\n >\n <sky-icon icon=\"trash-o\" size=\"lg\"></sky-icon>\n </button>\n </div>\n </div>\n <div class=\"sky-file-item-content\">\n <div class=\"sky-file-item-preview\">\n <div *ngIf=\"isImage()\" class=\"sky-file-item-preview-img-container\">\n <img\n class=\"sky-file-item-preview-img\"\n [src]=\"url\"\n [alt]=\"\n 'skyux_file_attachment_file_upload_image_preview_alt_text'\n | skyLibResources\n \"\n />\n </div>\n <div *ngIf=\"!isImage()\" class=\"sky-file-item-preview-other\">\n <sky-icon [icon]=\"icon\"></sky-icon>\n </div>\n </div>\n <div class=\"sky-file-item-content-custom\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n", styles: [".sky-file-item{border-top:1px solid #e2e3e4;border-bottom:1px solid #e2e3e4;border-left:1px solid #e2e3e4;border-right:1px solid #e2e3e4;background-color:#eeeeef;margin-bottom:10px}.sky-file-item-name-container{flex:1 1 auto;overflow:hidden}.sky-file-item-controls{flex:0 1 auto;padding-left:15px}.sky-file-item-name{white-space:nowrap;overflow:hidden;-ms-text-overflow:ellipsis;text-overflow:ellipsis}.sky-file-item-title{margin-bottom:10px;display:flex}.sky-file-item-content{display:flex}.sky-file-item-preview{flex-basis:25%}.sky-file-item-content-custom{flex-basis:75%}.sky-file-item-preview-img-container{text-align:center}.sky-file-item-preview-img{max-width:100%;height:auto;box-shadow:0 0 5px #666}.sky-file-item-preview-other{color:#686c73;font-size:100px;line-height:1;text-align:center;width:100%}\n"] }]
|
|
1424
|
+
}], ctorParameters: function () { return [{ type: i0.KeyValueDiffers }, { type: SkyFileItemService }]; }, propDecorators: { fileItem: [{
|
|
1425
|
+
type: Input
|
|
1426
|
+
}], deleteFile: [{
|
|
1427
|
+
type: Output
|
|
1428
|
+
}] } });
|
|
1429
|
+
|
|
1430
|
+
class SkyFileAttachmentsModule {
|
|
1431
|
+
}
|
|
1432
|
+
SkyFileAttachmentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1433
|
+
SkyFileAttachmentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentsModule, declarations: [SkyFileAttachmentComponent,
|
|
1434
|
+
SkyFileAttachmentLabelComponent,
|
|
1435
|
+
SkyFileDropComponent,
|
|
1436
|
+
SkyFileItemComponent,
|
|
1437
|
+
SkyFileSizePipe], imports: [CommonModule,
|
|
1438
|
+
FormsModule,
|
|
1439
|
+
SkyFormsResourcesModule,
|
|
1440
|
+
SkyI18nModule,
|
|
1441
|
+
SkyIconModule,
|
|
1442
|
+
SkyThemeModule], exports: [SkyFileAttachmentComponent,
|
|
1443
|
+
SkyFileAttachmentLabelComponent,
|
|
1444
|
+
SkyFileDropComponent,
|
|
1445
|
+
SkyFileItemComponent,
|
|
1446
|
+
SkyFileSizePipe] });
|
|
1447
|
+
SkyFileAttachmentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentsModule, providers: [DecimalPipe, SkyFileItemService], imports: [[
|
|
1448
|
+
CommonModule,
|
|
1449
|
+
FormsModule,
|
|
1450
|
+
SkyFormsResourcesModule,
|
|
1451
|
+
SkyI18nModule,
|
|
1452
|
+
SkyIconModule,
|
|
1453
|
+
SkyThemeModule,
|
|
1454
|
+
]] });
|
|
1455
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyFileAttachmentsModule, decorators: [{
|
|
1456
|
+
type: NgModule,
|
|
1457
|
+
args: [{
|
|
1458
|
+
declarations: [
|
|
1459
|
+
SkyFileAttachmentComponent,
|
|
1460
|
+
SkyFileAttachmentLabelComponent,
|
|
1461
|
+
SkyFileDropComponent,
|
|
1462
|
+
SkyFileItemComponent,
|
|
1463
|
+
SkyFileSizePipe,
|
|
1464
|
+
],
|
|
1465
|
+
imports: [
|
|
1466
|
+
CommonModule,
|
|
1467
|
+
FormsModule,
|
|
1468
|
+
SkyFormsResourcesModule,
|
|
1469
|
+
SkyI18nModule,
|
|
1470
|
+
SkyIconModule,
|
|
1471
|
+
SkyThemeModule,
|
|
1472
|
+
],
|
|
1473
|
+
exports: [
|
|
1474
|
+
SkyFileAttachmentComponent,
|
|
1475
|
+
SkyFileAttachmentLabelComponent,
|
|
1476
|
+
SkyFileDropComponent,
|
|
1477
|
+
SkyFileItemComponent,
|
|
1478
|
+
SkyFileSizePipe,
|
|
1479
|
+
],
|
|
1480
|
+
providers: [DecimalPipe, SkyFileItemService],
|
|
1481
|
+
}]
|
|
1482
|
+
}] });
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* @internal
|
|
1486
|
+
*/
|
|
1487
|
+
class SkyInputBoxAdapterService {
|
|
1488
|
+
focusControl(elRef) {
|
|
1489
|
+
const control = elRef.nativeElement.querySelector('.sky-form-control');
|
|
1490
|
+
/* istanbul ignore else */
|
|
1491
|
+
if (control) {
|
|
1492
|
+
control.focus();
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns the inline help element.
|
|
1497
|
+
*/
|
|
1498
|
+
getInlineHelpElement(elRef) {
|
|
1499
|
+
return elRef.nativeElement.querySelector('.sky-control-help');
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Returns true if the provided element contains the focused element.
|
|
1503
|
+
*/
|
|
1504
|
+
isFocusInElement(el) {
|
|
1505
|
+
if (el) {
|
|
1506
|
+
return (el === document.activeElement || el.contains(document.activeElement));
|
|
1507
|
+
}
|
|
1508
|
+
return false;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
SkyInputBoxAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1512
|
+
SkyInputBoxAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxAdapterService });
|
|
1513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxAdapterService, decorators: [{
|
|
1514
|
+
type: Injectable
|
|
1515
|
+
}] });
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* @internal
|
|
1519
|
+
*/
|
|
1520
|
+
class SkyInputBoxHostService {
|
|
1521
|
+
init(host) {
|
|
1522
|
+
this.host = host;
|
|
1523
|
+
}
|
|
1524
|
+
populate(args) {
|
|
1525
|
+
this.host.populate(args);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
SkyInputBoxHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxHostService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1529
|
+
SkyInputBoxHostService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxHostService });
|
|
1530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxHostService, decorators: [{
|
|
1531
|
+
type: Injectable
|
|
1532
|
+
}] });
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Creates a wrapper to provide styling for `input` and `label` elements. To render the
|
|
1536
|
+
* component correctly, include the `sky-form-control` CSS class on the `input` element
|
|
1537
|
+
* and the `sky-control-label` CSS class on the `label` element. To display a help button
|
|
1538
|
+
* beside the label, include a help button element in the `sky-input-box` element and a
|
|
1539
|
+
* `sky-control-help` CSS class on that element.
|
|
1540
|
+
*/
|
|
1541
|
+
class SkyInputBoxComponent {
|
|
1542
|
+
constructor(changeRef, inputBoxHostSvc, adapterService, elementRef) {
|
|
1543
|
+
this.changeRef = changeRef;
|
|
1544
|
+
this.inputBoxHostSvc = inputBoxHostSvc;
|
|
1545
|
+
this.adapterService = adapterService;
|
|
1546
|
+
this.elementRef = elementRef;
|
|
1547
|
+
}
|
|
1548
|
+
get hasErrorsComputed() {
|
|
1549
|
+
if (this.hasErrors === undefined) {
|
|
1550
|
+
return (this.controlHasErrors(this.formControl) ||
|
|
1551
|
+
this.controlHasErrors(this.formControlByName) ||
|
|
1552
|
+
this.controlHasErrors(this.ngModel));
|
|
1553
|
+
}
|
|
1554
|
+
return this.hasErrors;
|
|
1555
|
+
}
|
|
1556
|
+
ngOnInit() {
|
|
1557
|
+
this.inputBoxHostSvc.init(this);
|
|
1558
|
+
}
|
|
1559
|
+
formControlFocusIn() {
|
|
1560
|
+
const inlineHelpEl = this.adapterService.getInlineHelpElement(this.elementRef);
|
|
1561
|
+
if (!this.adapterService.isFocusInElement(inlineHelpEl)) {
|
|
1562
|
+
this.updateHasFocus(true);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
formControlFocusOut() {
|
|
1566
|
+
this.updateHasFocus(false);
|
|
1567
|
+
}
|
|
1568
|
+
onInsetIconClick() {
|
|
1569
|
+
if (!this.disabled) {
|
|
1570
|
+
this.adapterService.focusControl(this.elementRef);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
populate(args) {
|
|
1574
|
+
this.hostInputTemplate = args.inputTemplate;
|
|
1575
|
+
this.hostButtonsTemplate = args.buttonsTemplate;
|
|
1576
|
+
this.hostButtonsLeftTemplate = args.buttonsLeftTemplate;
|
|
1577
|
+
this.hostButtonsInsetTemplate = args.buttonsInsetTemplate;
|
|
1578
|
+
this.hostIconsInsetTemplate = args.iconsInsetTemplate;
|
|
1579
|
+
this.hostIconsInsetLeftTemplate = args.iconsInsetLeftTemplate;
|
|
1580
|
+
}
|
|
1581
|
+
updateHasFocus(hasFocus) {
|
|
1582
|
+
// Some components manipulate the focus of elements inside an input box programmatically,
|
|
1583
|
+
// which can cause an `ExpressionChangedAfterItHasBeenCheckedError` if focus was set after
|
|
1584
|
+
// initial change detection. Using `setTimeout()` here fixes it.
|
|
1585
|
+
setTimeout(() => {
|
|
1586
|
+
this.formControlHasFocus = hasFocus;
|
|
1587
|
+
this.changeRef.markForCheck();
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
controlHasErrors(control) {
|
|
1591
|
+
return control && control.invalid && (control.dirty || control.touched);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
SkyInputBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkyInputBoxHostService }, { token: SkyInputBoxAdapterService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1595
|
+
SkyInputBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyInputBoxComponent, selector: "sky-input-box", inputs: { hasErrors: "hasErrors", disabled: "disabled" }, providers: [SkyInputBoxAdapterService, SkyInputBoxHostService], queries: [{ propertyName: "formControl", first: true, predicate: FormControlDirective, descendants: true }, { propertyName: "formControlByName", first: true, predicate: FormControlName, descendants: true }, { propertyName: "ngModel", first: true, predicate: NgModel, descendants: true }], ngImport: i0, template: "<div\n *skyThemeIf=\"'default'\"\n class=\"sky-input-box\"\n [ngClass]=\"{\n 'sky-input-box-disabled': disabled\n }\"\n>\n <div class=\"sky-form-group\">\n <div class=\"sky-input-box-label-wrapper\">\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inlineHelpTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"characterCountTemplate\"></ng-container>\n </div>\n <div class=\"sky-input-group\">\n <ng-container *ngTemplateOutlet=\"buttonsLeftTemplate\"></ng-container>\n <div\n class=\"sky-input-box-input-group-inner\"\n [ngClass]=\"{\n 'sky-field-status-active': formControlHasFocus,\n 'sky-field-status-invalid': hasErrorsComputed\n }\"\n (focusin)=\"formControlFocusIn()\"\n (focusout)=\"formControlFocusOut()\"\n >\n <ng-container *ngTemplateOutlet=\"iconsInsetLeftTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"iconsInsetTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"errorLabelTemplate\"></ng-container>\n </div>\n</div>\n\n<div\n *skyThemeIf=\"'modern'\"\n class=\"sky-input-box\"\n [ngClass]=\"{\n 'sky-input-box-disabled': disabled\n }\"\n>\n <div class=\"sky-input-box-group\">\n <ng-container *ngTemplateOutlet=\"buttonsLeftTemplate\"></ng-container>\n <div\n class=\"sky-input-box-group-form-control\"\n [ngClass]=\"{\n 'sky-input-box-group-form-control-focus': formControlHasFocus,\n 'sky-input-box-group-form-control-invalid': hasErrorsComputed\n }\"\n (focusin)=\"formControlFocusIn()\"\n (focusout)=\"formControlFocusOut()\"\n >\n <div class=\"sky-form-group\">\n <ng-container *ngTemplateOutlet=\"iconsInsetLeftTemplate\"></ng-container>\n <div class=\"sky-input-box-form-group-inner\">\n <div class=\"sky-input-box-label-wrapper\">\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inlineHelpTemplate\"></ng-container>\n <ng-container\n *ngTemplateOutlet=\"characterCountTemplate\"\n ></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"iconsInsetTemplate\"></ng-container>\n </div>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"errorLabelTemplate\"></ng-container>\n</div>\n\n<ng-template #labelTemplate>\n <ng-content select=\".sky-control-label\"></ng-content>\n</ng-template>\n\n<ng-template #inlineHelpTemplate>\n <ng-content select=\".sky-control-help\"></ng-content>\n</ng-template>\n\n<ng-template #characterCountTemplate>\n <ng-content select=\"sky-character-counter-indicator\"></ng-content>\n</ng-template>\n\n<ng-template #inputTemplate>\n <ng-content select=\".sky-form-control\"></ng-content>\n <ng-container *ngTemplateOutlet=\"hostInputTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsLeftTemplate>\n <ng-content select=\".sky-input-group-btn.sky-input-box-btn-left\"></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsLeftTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsTemplate>\n <ng-content\n select=\".sky-input-group-btn:not(.sky-input-box-btn-left):not(.sky-input-box-btn-inset)\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsInsetTemplate>\n <ng-content\n select=\".sky-input-group-btn.sky-input-box-btn-inset\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsInsetTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #iconsInsetTemplate>\n <div class=\"sky-input-box-icon-inset-wrapper\" (click)=\"onInsetIconClick()\">\n <ng-content\n select=\".sky-input-group-icon.sky-input-box-icon-inset\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostIconsInsetTemplate\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #iconsInsetLeftTemplate>\n <div\n class=\"sky-input-box-icon-inset-left-wrapper\"\n (click)=\"onInsetIconClick()\"\n >\n <ng-content\n select=\".sky-input-group-icon.sky-input-box-icon-inset-left\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostIconsInsetLeftTemplate\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #errorLabelTemplate>\n <ng-content select=\".sky-error-label\"></ng-content>\n</ng-template>\n", styles: ["sky-input-box{display:block}sky-input-box .sky-input-box-input-container{width:100%}sky-input-box .sky-form-group{display:flex;flex-wrap:wrap}sky-input-box .sky-form-group .sky-control-help{margin:0 0 0 4px}sky-input-box .sky-form-group .sky-input-box-label-wrapper{display:flex;width:100%}sky-input-box .sky-input-box-input-group-inner{display:flex;background-color:#fff;width:100%;z-index:1}sky-input-box .sky-input-box-input-group-inner:not(.sky-field-status-active):not(.sky-field-status-invalid){border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2}sky-input-box .sky-input-box-btn-inset .sky-btn{background-color:transparent;border:none}sky-input-box .sky-input-box-icon-inset-wrapper,sky-input-box .sky-input-box-icon-inset-left-wrapper{display:flex}sky-input-box .sky-input-box-icon-inset-wrapper .sky-input-group-icon,sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-group-icon{width:33px;display:flex;align-items:center;justify-content:center}sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-wrapper,sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper{background-color:#cdcfd2}sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-wrapper .sky-icon,sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper .sky-icon{color:#686c73}sky-input-box sky-character-counter-indicator{flex-grow:1;text-align:right;margin-bottom:5px;margin-left:auto}sky-input-box .sky-control-label+sky-character-counter-indicator{flex-grow:0;flex-shrink:.001}sky-input-box .sky-form-control,sky-input-box .sky-form-control:focus{border:none;flex-basis:100%}sky-input-box .sky-form-control:focus,sky-input-box .sky-form-control.ng-invalid.ng-touched,sky-input-box .sky-form-control:focus:focus,sky-input-box .sky-form-control:focus.ng-invalid.ng-touched{border:none;box-shadow:none}sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 0 0 10px;width:initial}.sky-theme-modern .sky-input-box .sky-input-box-group{display:flex}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control{flex-grow:1;position:relative}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control:first-child .sky-form-group{border-top-left-radius:6px;border-bottom-left-radius:6px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control:last-child .sky-form-group{border-top-right-radius:6px;border-bottom-right-radius:6px}.sky-theme-modern .sky-input-box .sky-input-box-form-group-inner{display:flex;flex-grow:1;flex-wrap:wrap}.sky-theme-modern .sky-input-box .sky-input-group-btn .sky-btn{border-radius:0;color:#686c73;margin:0;padding:0;position:relative;transition:border-color .15s,box-shadow .15s,color .15s;width:55px}.sky-theme-modern .sky-input-box .sky-input-group-btn .sky-btn .sky-icon{font-size:24px}.sky-theme-modern .sky-input-box .sky-input-group-btn:first-child .sky-btn{border-top-left-radius:6px;border-bottom-left-radius:6px;margin-right:-1px}.sky-theme-modern .sky-input-box .sky-input-group-btn:first-child .sky-btn:focus{z-index:1}.sky-theme-modern .sky-input-box .sky-input-group-btn:last-child .sky-btn{border-top-right-radius:6px;border-bottom-right-radius:6px}.sky-theme-modern .sky-input-box .sky-input-group-icon{width:55px}.sky-theme-modern .sky-input-box .sky-input-group-icon .sky-icon{color:#686c73;font-size:24px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:last-child),.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-invalid:not(:last-child),.sky-theme-modern .sky-input-box .sky-input-group-btn:focus-within:not(:last-child){z-index:1}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control+.sky-input-group-btn .sky-btn{margin-left:-2px}.sky-theme-modern .sky-input-box .sky-input-group-btn+.sky-input-group-btn .sky-btn{margin-left:-1px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active),.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid{z-index:1}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active) .sky-form-group,.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d;color:#1870b8}.sky-theme-modern .sky-input-box .sky-form-group{background-color:#fff;border:none;box-shadow:inset 0 0 0 1px #d2d2d2;color:#686c73;flex-wrap:nowrap;margin-bottom:0;padding:0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper{display:flex;padding:0 15px;width:100%}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper sky-character-counter-indicator{margin-bottom:0;position:relative;z-index:2}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label{padding:6px 0 1px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-character-count-label{font-size:13px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help{margin:0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help .sky-help-inline{font-size:16px;padding:3px 10px 0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help:last-child .sky-help-inline{padding:3px 0 0 10px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper sky-character-counter-indicator{margin-left:auto;padding:3px 0 0}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control{background-color:transparent;border:none;border-radius:6px;font-size:16px;height:auto;line-height:18px;margin-top:-23px;padding:26px 15px 10px;position:relative}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:first-line{line-height:19px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:focus,.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control.ng-invalid{box-shadow:none;outline:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control::-webkit-input-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control::-moz-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-controlinput:-moz-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:-ms-input-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-btn-inset .sky-btn{background-color:transparent;border-radius:6px;transition-property:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-btn-inset .sky-btn:not(:active):not(:focus):not(:hover){box-shadow:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper:empty+.sky-form-control,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper:empty+* .sky-form-control{margin-top:0;padding-top:10px}@-moz-document url-prefix(){.sky-theme-modern .sky-input-box .sky-form-group select.sky-form-control{padding-left:10px}}.sky-theme-modern .sky-input-box .sky-form-group select.sky-form-control{background-position-x:calc(100% - 10px);z-index:3}.sky-theme-modern .sky-input-box .sky-form-group textarea.sky-form-control{resize:vertical}.sky-theme-modern .sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 0 0 15px;width:initial}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:hover{z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:hover .sky-form-group{border:none;box-shadow:inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn{border:none;box-shadow:inset 0 0 0 1px #d2d2d2}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:hover{border:none;box-shadow:inset 0 0 0 1px #1870b8;z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:active,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:focus{border:none;box-shadow:inset 0 0 0 2px #1870b8;color:#212327;z-index:2}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:focus:not(:active){outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:active .sky-form-group,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-invalid:active .sky-form-group{color:#1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active),.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid{z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active) .sky-form-group,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d;color:#1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-form-group{transition:border-color .15s,box-shadow .15s,color .15s}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-form-group .sky-control-label{transition:border-color .15s,box-shadow .15s,color .15s}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-form-control,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-control-label,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-group-btn{cursor:not-allowed}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-box-icon-inset-wrapper,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper{background-color:transparent}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-form-group{background-color:#ededee}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-group-btn .sky-btn{background-color:#ededee;border:none;box-shadow:inset 0 0 0 1px #d2d2d2;opacity:1}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group{background-color:transparent;border:none;box-shadow:inset 0 0 0 1px #686c73;color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group .sky-form-control,.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group .sky-input-group-btn .sky-btn{background-color:transparent;color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-focus .sky-form-group,.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-focus.sky-input-box-group-form-control-invalid .sky-form-group{color:#1870b8}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn{border:none;box-shadow:inset 0 0 0 1px #686c73;color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn.sky-btn-default{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn:focus{border-color:#1870b8;color:#fbfcfe}\n"], directives: [{ type: i1$1.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
1596
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxComponent, decorators: [{
|
|
1597
|
+
type: Component,
|
|
1598
|
+
args: [{ selector: 'sky-input-box', providers: [SkyInputBoxAdapterService, SkyInputBoxHostService], encapsulation: ViewEncapsulation.None, template: "<div\n *skyThemeIf=\"'default'\"\n class=\"sky-input-box\"\n [ngClass]=\"{\n 'sky-input-box-disabled': disabled\n }\"\n>\n <div class=\"sky-form-group\">\n <div class=\"sky-input-box-label-wrapper\">\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inlineHelpTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"characterCountTemplate\"></ng-container>\n </div>\n <div class=\"sky-input-group\">\n <ng-container *ngTemplateOutlet=\"buttonsLeftTemplate\"></ng-container>\n <div\n class=\"sky-input-box-input-group-inner\"\n [ngClass]=\"{\n 'sky-field-status-active': formControlHasFocus,\n 'sky-field-status-invalid': hasErrorsComputed\n }\"\n (focusin)=\"formControlFocusIn()\"\n (focusout)=\"formControlFocusOut()\"\n >\n <ng-container *ngTemplateOutlet=\"iconsInsetLeftTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"iconsInsetTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"errorLabelTemplate\"></ng-container>\n </div>\n</div>\n\n<div\n *skyThemeIf=\"'modern'\"\n class=\"sky-input-box\"\n [ngClass]=\"{\n 'sky-input-box-disabled': disabled\n }\"\n>\n <div class=\"sky-input-box-group\">\n <ng-container *ngTemplateOutlet=\"buttonsLeftTemplate\"></ng-container>\n <div\n class=\"sky-input-box-group-form-control\"\n [ngClass]=\"{\n 'sky-input-box-group-form-control-focus': formControlHasFocus,\n 'sky-input-box-group-form-control-invalid': hasErrorsComputed\n }\"\n (focusin)=\"formControlFocusIn()\"\n (focusout)=\"formControlFocusOut()\"\n >\n <div class=\"sky-form-group\">\n <ng-container *ngTemplateOutlet=\"iconsInsetLeftTemplate\"></ng-container>\n <div class=\"sky-input-box-form-group-inner\">\n <div class=\"sky-input-box-label-wrapper\">\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inlineHelpTemplate\"></ng-container>\n <ng-container\n *ngTemplateOutlet=\"characterCountTemplate\"\n ></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"inputTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"iconsInsetTemplate\"></ng-container>\n </div>\n </div>\n <ng-container *ngTemplateOutlet=\"buttonsTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"errorLabelTemplate\"></ng-container>\n</div>\n\n<ng-template #labelTemplate>\n <ng-content select=\".sky-control-label\"></ng-content>\n</ng-template>\n\n<ng-template #inlineHelpTemplate>\n <ng-content select=\".sky-control-help\"></ng-content>\n</ng-template>\n\n<ng-template #characterCountTemplate>\n <ng-content select=\"sky-character-counter-indicator\"></ng-content>\n</ng-template>\n\n<ng-template #inputTemplate>\n <ng-content select=\".sky-form-control\"></ng-content>\n <ng-container *ngTemplateOutlet=\"hostInputTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsLeftTemplate>\n <ng-content select=\".sky-input-group-btn.sky-input-box-btn-left\"></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsLeftTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsTemplate>\n <ng-content\n select=\".sky-input-group-btn:not(.sky-input-box-btn-left):not(.sky-input-box-btn-inset)\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #buttonsInsetTemplate>\n <ng-content\n select=\".sky-input-group-btn.sky-input-box-btn-inset\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostButtonsInsetTemplate\"></ng-container>\n</ng-template>\n\n<ng-template #iconsInsetTemplate>\n <div class=\"sky-input-box-icon-inset-wrapper\" (click)=\"onInsetIconClick()\">\n <ng-content\n select=\".sky-input-group-icon.sky-input-box-icon-inset\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostIconsInsetTemplate\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #iconsInsetLeftTemplate>\n <div\n class=\"sky-input-box-icon-inset-left-wrapper\"\n (click)=\"onInsetIconClick()\"\n >\n <ng-content\n select=\".sky-input-group-icon.sky-input-box-icon-inset-left\"\n ></ng-content>\n <ng-container *ngTemplateOutlet=\"hostIconsInsetLeftTemplate\"></ng-container>\n </div>\n</ng-template>\n\n<ng-template #errorLabelTemplate>\n <ng-content select=\".sky-error-label\"></ng-content>\n</ng-template>\n", styles: ["sky-input-box{display:block}sky-input-box .sky-input-box-input-container{width:100%}sky-input-box .sky-form-group{display:flex;flex-wrap:wrap}sky-input-box .sky-form-group .sky-control-help{margin:0 0 0 4px}sky-input-box .sky-form-group .sky-input-box-label-wrapper{display:flex;width:100%}sky-input-box .sky-input-box-input-group-inner{display:flex;background-color:#fff;width:100%;z-index:1}sky-input-box .sky-input-box-input-group-inner:not(.sky-field-status-active):not(.sky-field-status-invalid){border-top:1px solid #cdcfd2;border-bottom:1px solid #cdcfd2;border-left:1px solid #cdcfd2;border-right:1px solid #cdcfd2}sky-input-box .sky-input-box-btn-inset .sky-btn{background-color:transparent;border:none}sky-input-box .sky-input-box-icon-inset-wrapper,sky-input-box .sky-input-box-icon-inset-left-wrapper{display:flex}sky-input-box .sky-input-box-icon-inset-wrapper .sky-input-group-icon,sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-group-icon{width:33px;display:flex;align-items:center;justify-content:center}sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-wrapper,sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper{background-color:#cdcfd2}sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-wrapper .sky-icon,sky-input-box .sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper .sky-icon{color:#686c73}sky-input-box sky-character-counter-indicator{flex-grow:1;text-align:right;margin-bottom:5px;margin-left:auto}sky-input-box .sky-control-label+sky-character-counter-indicator{flex-grow:0;flex-shrink:.001}sky-input-box .sky-form-control,sky-input-box .sky-form-control:focus{border:none;flex-basis:100%}sky-input-box .sky-form-control:focus,sky-input-box .sky-form-control.ng-invalid.ng-touched,sky-input-box .sky-form-control:focus:focus,sky-input-box .sky-form-control:focus.ng-invalid.ng-touched{border:none;box-shadow:none}sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 0 0 10px;width:initial}.sky-theme-modern .sky-input-box .sky-input-box-group{display:flex}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control{flex-grow:1;position:relative}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control:first-child .sky-form-group{border-top-left-radius:6px;border-bottom-left-radius:6px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control:last-child .sky-form-group{border-top-right-radius:6px;border-bottom-right-radius:6px}.sky-theme-modern .sky-input-box .sky-input-box-form-group-inner{display:flex;flex-grow:1;flex-wrap:wrap}.sky-theme-modern .sky-input-box .sky-input-group-btn .sky-btn{border-radius:0;color:#686c73;margin:0;padding:0;position:relative;transition:border-color .15s,box-shadow .15s,color .15s;width:55px}.sky-theme-modern .sky-input-box .sky-input-group-btn .sky-btn .sky-icon{font-size:24px}.sky-theme-modern .sky-input-box .sky-input-group-btn:first-child .sky-btn{border-top-left-radius:6px;border-bottom-left-radius:6px;margin-right:-1px}.sky-theme-modern .sky-input-box .sky-input-group-btn:first-child .sky-btn:focus{z-index:1}.sky-theme-modern .sky-input-box .sky-input-group-btn:last-child .sky-btn{border-top-right-radius:6px;border-bottom-right-radius:6px}.sky-theme-modern .sky-input-box .sky-input-group-icon{width:55px}.sky-theme-modern .sky-input-box .sky-input-group-icon .sky-icon{color:#686c73;font-size:24px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:last-child),.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-invalid:not(:last-child),.sky-theme-modern .sky-input-box .sky-input-group-btn:focus-within:not(:last-child){z-index:1}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control+.sky-input-group-btn .sky-btn{margin-left:-2px}.sky-theme-modern .sky-input-box .sky-input-group-btn+.sky-input-group-btn .sky-btn{margin-left:-1px}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active),.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid{z-index:1}.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active) .sky-form-group,.sky-theme-modern .sky-input-box .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d;color:#1870b8}.sky-theme-modern .sky-input-box .sky-form-group{background-color:#fff;border:none;box-shadow:inset 0 0 0 1px #d2d2d2;color:#686c73;flex-wrap:nowrap;margin-bottom:0;padding:0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper{display:flex;padding:0 15px;width:100%}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper sky-character-counter-indicator{margin-bottom:0;position:relative;z-index:2}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label{padding:6px 0 1px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-label,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-character-count-label{font-size:13px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help{margin:0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help .sky-help-inline{font-size:16px;padding:3px 10px 0}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper .sky-control-help:last-child .sky-help-inline{padding:3px 0 0 10px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper sky-character-counter-indicator{margin-left:auto;padding:3px 0 0}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control{background-color:transparent;border:none;border-radius:6px;font-size:16px;height:auto;line-height:18px;margin-top:-23px;padding:26px 15px 10px;position:relative}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:first-line{line-height:19px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:focus,.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control.ng-invalid{box-shadow:none;outline:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control::-webkit-input-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control::-moz-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-controlinput:-moz-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-form-control:-ms-input-placeholder{font-size:16px}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-btn-inset .sky-btn{background-color:transparent;border-radius:6px;transition-property:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-btn-inset .sky-btn:not(:active):not(:focus):not(:hover){box-shadow:none}.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper:empty+.sky-form-control,.sky-theme-modern .sky-input-box .sky-form-group .sky-input-box-label-wrapper:empty+* .sky-form-control{margin-top:0;padding-top:10px}@-moz-document url-prefix(){.sky-theme-modern .sky-input-box .sky-form-group select.sky-form-control{padding-left:10px}}.sky-theme-modern .sky-input-box .sky-form-group select.sky-form-control{background-position-x:calc(100% - 10px);z-index:3}.sky-theme-modern .sky-input-box .sky-form-group textarea.sky-form-control{resize:vertical}.sky-theme-modern .sky-input-box .sky-input-box-icon-inset-left-wrapper .sky-input-box-icon-inset-left{padding:0 0 0 15px;width:initial}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:hover{z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:hover .sky-form-group{border:none;box-shadow:inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn{border:none;box-shadow:inset 0 0 0 1px #d2d2d2}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:hover{border:none;box-shadow:inset 0 0 0 1px #1870b8;z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:active,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:focus{border:none;box-shadow:inset 0 0 0 2px #1870b8;color:#212327;z-index:2}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-group-btn .sky-btn:focus:not(:active){outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control:active .sky-form-group,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-invalid:active .sky-form-group{color:#1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active),.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid{z-index:1}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active) .sky-form-group,.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-input-box-group-form-control-focus:not(:active).sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #1870b8,0 1px 3px #0000004d;color:#1870b8}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-form-group{transition:border-color .15s,box-shadow .15s,color .15s}.sky-theme-modern .sky-input-box:not(.sky-input-box-disabled) .sky-form-group .sky-control-label{transition:border-color .15s,box-shadow .15s,color .15s}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-form-control,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-control-label,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-group-btn{cursor:not-allowed}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-box-icon-inset-wrapper,.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-box-icon-inset-left-wrapper{background-color:transparent}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-form-group{background-color:#ededee}.sky-theme-modern .sky-input-box.sky-input-box-disabled .sky-input-group-btn .sky-btn{background-color:#ededee;border:none;box-shadow:inset 0 0 0 1px #d2d2d2;opacity:1}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group{background-color:transparent;border:none;box-shadow:inset 0 0 0 1px #686c73;color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group .sky-form-control,.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-form-group .sky-input-group-btn .sky-btn{background-color:transparent;color:#fbfcfe}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-focus .sky-form-group,.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-focus.sky-input-box-group-form-control-invalid .sky-form-group{color:#1870b8}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-box-group-form-control-invalid .sky-form-group{border:none;box-shadow:inset 0 0 0 2px #ef4044;color:#d93a3d}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn{border:none;box-shadow:inset 0 0 0 1px #686c73;color:#c0c2c5}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn.sky-btn-default{background-color:transparent}.sky-theme-modern.sky-theme-mode-dark .sky-input-box .sky-input-group-btn .sky-btn:focus{border-color:#1870b8;color:#fbfcfe}\n"] }]
|
|
1599
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkyInputBoxHostService }, { type: SkyInputBoxAdapterService }, { type: i0.ElementRef }]; }, propDecorators: { hasErrors: [{
|
|
1600
|
+
type: Input
|
|
1601
|
+
}], disabled: [{
|
|
1602
|
+
type: Input
|
|
1603
|
+
}], formControl: [{
|
|
1604
|
+
type: ContentChild,
|
|
1605
|
+
args: [FormControlDirective]
|
|
1606
|
+
}], formControlByName: [{
|
|
1607
|
+
type: ContentChild,
|
|
1608
|
+
args: [FormControlName]
|
|
1609
|
+
}], ngModel: [{
|
|
1610
|
+
type: ContentChild,
|
|
1611
|
+
args: [NgModel]
|
|
1612
|
+
}] } });
|
|
1613
|
+
|
|
1614
|
+
class SkyInputBoxModule {
|
|
1615
|
+
}
|
|
1616
|
+
SkyInputBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1617
|
+
SkyInputBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxModule, declarations: [SkyInputBoxComponent], imports: [CommonModule, SkyThemeModule], exports: [SkyInputBoxComponent] });
|
|
1618
|
+
SkyInputBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxModule, imports: [[CommonModule, SkyThemeModule]] });
|
|
1619
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyInputBoxModule, decorators: [{
|
|
1620
|
+
type: NgModule,
|
|
1621
|
+
args: [{
|
|
1622
|
+
declarations: [SkyInputBoxComponent],
|
|
1623
|
+
imports: [CommonModule, SkyThemeModule],
|
|
1624
|
+
exports: [SkyInputBoxComponent],
|
|
1625
|
+
}]
|
|
1626
|
+
}] });
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* Auto-incrementing integer that generates unique IDs for radio components.
|
|
1630
|
+
*/
|
|
1631
|
+
let nextUniqueId$1 = 0;
|
|
1632
|
+
/**
|
|
1633
|
+
* Provider Expression that allows sky-radio to register as a ControlValueAccessor.
|
|
1634
|
+
* This allows it to support [(ngModel)].
|
|
1635
|
+
*/
|
|
1636
|
+
// tslint:disable:no-forward-ref no-use-before-declare
|
|
1637
|
+
const SKY_RADIO_CONTROL_VALUE_ACCESSOR = {
|
|
1638
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1639
|
+
useExisting: forwardRef(() => SkyRadioComponent),
|
|
1640
|
+
multi: true,
|
|
1641
|
+
};
|
|
1642
|
+
// tslint:enable
|
|
1643
|
+
/**
|
|
1644
|
+
* Renders a SKY UX-themed replacement for an HTML `input` element
|
|
1645
|
+
* with `type="radio"`. When users select a radio button, its value is driven through an
|
|
1646
|
+
* `ngModel` attribute that you specify on the `sky-radio` element or the parent `sky-radio-group` element.
|
|
1647
|
+
*/
|
|
1648
|
+
class SkyRadioComponent {
|
|
1649
|
+
constructor(changeDetector) {
|
|
1650
|
+
this.changeDetector = changeDetector;
|
|
1651
|
+
/**
|
|
1652
|
+
* Fires when users focus off a radio button.
|
|
1653
|
+
*/
|
|
1654
|
+
this.blur = new Subject();
|
|
1655
|
+
/**
|
|
1656
|
+
* Specifies an ID for the radio button.
|
|
1657
|
+
* @default a unique, auto-incrementing integer. For example: `sky-radio-1`
|
|
1658
|
+
*/
|
|
1659
|
+
this.id = `sky-radio-${++nextUniqueId$1}`;
|
|
1660
|
+
this._change = new EventEmitter();
|
|
1661
|
+
this._checked = false;
|
|
1662
|
+
this._checkedChange = new BehaviorSubject(this._checked);
|
|
1663
|
+
this._disabled = false;
|
|
1664
|
+
this._disabledChange = new BehaviorSubject(this._disabled);
|
|
1665
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1666
|
+
this.removeUniqueSelectionListener = () => { };
|
|
1667
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1668
|
+
this.onChangeCallback = (value) => { };
|
|
1669
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1670
|
+
this.onTouchedCallback = () => { };
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Indicates whether the radio button is selected.
|
|
1674
|
+
* @default false
|
|
1675
|
+
*/
|
|
1676
|
+
set checked(value) {
|
|
1677
|
+
const newCheckedState = !!value;
|
|
1678
|
+
if (this._checked !== newCheckedState) {
|
|
1679
|
+
this._checked = newCheckedState;
|
|
1680
|
+
this._checkedChange.next(this._checked);
|
|
1681
|
+
if (newCheckedState) {
|
|
1682
|
+
this.selectedValue = this.value;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
this.changeDetector.markForCheck();
|
|
1686
|
+
}
|
|
1687
|
+
get checked() {
|
|
1688
|
+
return this._checked;
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Indicates whether to disable the input.
|
|
1692
|
+
* @default false
|
|
1693
|
+
*/
|
|
1694
|
+
set disabled(value) {
|
|
1695
|
+
const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);
|
|
1696
|
+
if (coercedValue !== this.disabled) {
|
|
1697
|
+
this._disabled = coercedValue;
|
|
1698
|
+
this._disabledChange.next(this._disabled);
|
|
1699
|
+
this.changeDetector.markForCheck();
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
get disabled() {
|
|
1703
|
+
return this._disabled;
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* This property is deprecated in favor of the `name` property on the `sky-radio-group element`.
|
|
1707
|
+
* We recommend using the `sky-radio-group` element with all radio buttons, but if you opt not to,
|
|
1708
|
+
* then this property specifies a name for a group of radio buttons.
|
|
1709
|
+
* @deprecated
|
|
1710
|
+
*/
|
|
1711
|
+
set name(value) {
|
|
1712
|
+
this._name = value;
|
|
1713
|
+
this.changeDetector.markForCheck();
|
|
1714
|
+
}
|
|
1715
|
+
get name() {
|
|
1716
|
+
return this._name;
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* This property is deprecated in favor of
|
|
1720
|
+
* the `tabIndex` property on the `sky-radio-group` element. It specifies an index for the radio
|
|
1721
|
+
* button. If the index is not defined, it is set to the position of the radio button on load.
|
|
1722
|
+
* @deprecated
|
|
1723
|
+
*/
|
|
1724
|
+
set tabindex(value) {
|
|
1725
|
+
console.warn('The sky-radio `tabindex` property is deprecated. Please use the `tabindex` property on the sky-radio-group component.');
|
|
1726
|
+
this._tabindex = value;
|
|
1727
|
+
this.changeDetector.markForCheck();
|
|
1728
|
+
}
|
|
1729
|
+
get tabindex() {
|
|
1730
|
+
return this._tabindex || 0;
|
|
1731
|
+
}
|
|
1732
|
+
// For setting the tabindex from the radio group
|
|
1733
|
+
set groupTabIndex(value) {
|
|
1734
|
+
this._tabindex = value;
|
|
1735
|
+
this.changeDetector.markForCheck();
|
|
1736
|
+
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Specifies and binds a value to the radio button's `value` property. The value usually
|
|
1739
|
+
* corresponds to the radio button's label, which you specify with the `sky-radio-label`
|
|
1740
|
+
* component.
|
|
1741
|
+
* @required
|
|
1742
|
+
*/
|
|
1743
|
+
set value(value) {
|
|
1744
|
+
/* istanbul ignore else */
|
|
1745
|
+
if (this._value !== value) {
|
|
1746
|
+
if (this.selectedValue && this.selectedValue === this._value) {
|
|
1747
|
+
this.selectedValue = value;
|
|
1748
|
+
this.onChangeCallback(this.selectedValue);
|
|
1749
|
+
this.onTouchedCallback();
|
|
1750
|
+
}
|
|
1751
|
+
this._value = value;
|
|
1752
|
+
}
|
|
1753
|
+
this.changeDetector.markForCheck();
|
|
1754
|
+
}
|
|
1755
|
+
get value() {
|
|
1756
|
+
return this._value;
|
|
1757
|
+
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Specifies a type to set the background color after users select an icon radio button.
|
|
1760
|
+
* The valid options correspond
|
|
1761
|
+
* [the label component's](https://developer.blackbaud.com/skyux/components/label)
|
|
1762
|
+
* label types. `danger` creates a red background, `info` creates a blue background,
|
|
1763
|
+
* `success` creates a green background, and `warning` creates an orange background.
|
|
1764
|
+
* @default "info"
|
|
1765
|
+
*/
|
|
1766
|
+
get radioType() {
|
|
1767
|
+
return this._radioType || 'info';
|
|
1768
|
+
}
|
|
1769
|
+
set radioType(value) {
|
|
1770
|
+
if (value) {
|
|
1771
|
+
this._radioType = value.toLowerCase();
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Fires when users select a radio button.
|
|
1776
|
+
*/
|
|
1777
|
+
get change() {
|
|
1778
|
+
return this._change;
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Fires when the selected value changes.
|
|
1782
|
+
*/
|
|
1783
|
+
get checkedChange() {
|
|
1784
|
+
return this._checkedChange;
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Fires when the selected value changes.
|
|
1788
|
+
*/
|
|
1789
|
+
get disabledChange() {
|
|
1790
|
+
return this._disabledChange;
|
|
1791
|
+
}
|
|
1792
|
+
get inputId() {
|
|
1793
|
+
return `sky-radio-${this.id}-input`;
|
|
1794
|
+
}
|
|
1795
|
+
set selectedValue(value) {
|
|
1796
|
+
if (value !== this._selectedValue) {
|
|
1797
|
+
this._selectedValue = value;
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
get selectedValue() {
|
|
1801
|
+
return this._selectedValue;
|
|
1802
|
+
}
|
|
1803
|
+
ngOnDestroy() {
|
|
1804
|
+
this.removeUniqueSelectionListener();
|
|
1805
|
+
}
|
|
1806
|
+
writeValue(value) {
|
|
1807
|
+
if (value === undefined) {
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
this.selectedValue = value;
|
|
1811
|
+
this.checked = this.value === this.selectedValue;
|
|
1812
|
+
this.changeDetector.markForCheck();
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* @internal
|
|
1816
|
+
* Indicates whether to disable the control. Implemented as a part of ControlValueAccessor.
|
|
1817
|
+
*/
|
|
1818
|
+
setDisabledState(isDisabled) {
|
|
1819
|
+
this.disabled = isDisabled;
|
|
1820
|
+
}
|
|
1821
|
+
registerOnChange(fn) {
|
|
1822
|
+
this.onChangeCallback = fn;
|
|
1823
|
+
}
|
|
1824
|
+
registerOnTouched(fn) {
|
|
1825
|
+
this.onTouchedCallback = fn;
|
|
1826
|
+
}
|
|
1827
|
+
onInputChange(event) {
|
|
1828
|
+
event.stopPropagation();
|
|
1829
|
+
if (!this.disabled) {
|
|
1830
|
+
this.checked = true;
|
|
1831
|
+
this._change.emit({
|
|
1832
|
+
source: this,
|
|
1833
|
+
value: this._value,
|
|
1834
|
+
});
|
|
1835
|
+
this.onInputFocusChange(undefined);
|
|
1836
|
+
this.onChangeCallback(this.value);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
onInputFocusChange(event) {
|
|
1840
|
+
this.onTouchedCallback();
|
|
1841
|
+
this.blur.next();
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
SkyRadioComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1845
|
+
SkyRadioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyRadioComponent, selector: "sky-radio", inputs: { checked: "checked", disabled: "disabled", id: "id", label: "label", labelledBy: "labelledBy", name: "name", tabindex: "tabindex", value: "value", icon: "icon", radioType: "radioType" }, outputs: { change: "change", checkedChange: "checkedChange", disabledChange: "disabledChange" }, providers: [SKY_RADIO_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<label\n class=\"sky-radio-wrapper sky-switch\"\n [ngClass]=\"{ 'sky-switch-disabled': disabled }\"\n>\n <input\n class=\"sky-radio-input sky-switch-input\"\n type=\"radio\"\n [attr.aria-label]=\"label\"\n [attr.aria-labelledby]=\"labelledBy\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [id]=\"inputId\"\n [name]=\"name\"\n [tabIndex]=\"tabindex\"\n [value]=\"value\"\n (blur)=\"onInputFocusChange($event)\"\n (change)=\"onInputChange($event)\"\n />\n <span\n class=\"sky-switch-control\"\n [ngClass]=\"{\n 'sky-switch-control-icon': icon,\n 'sky-rounded-corners': icon,\n 'sky-rounded-circle': !icon,\n 'sky-switch-control-info': icon && radioType === 'info',\n 'sky-switch-control-success': icon && radioType === 'success',\n 'sky-switch-control-warning': icon && radioType === 'warning',\n 'sky-switch-control-danger': icon && radioType === 'danger'\n }\"\n >\n <sky-icon *ngIf=\"icon\" fixedWidth=\"true\" [icon]=\"icon\"> </sky-icon>\n </span>\n <ng-content select=\"sky-radio-label\"></ng-content>\n</label>\n", styles: [".sky-switch-control:not(.sky-switch-control-icon) sky-icon{font-size:70%}.sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{content:\"\";display:inline-block;width:10px;height:10px;background:#000000;border-radius:50%}:host-context(.sky-theme-modern) .sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{background:#1870B8}:host-context(.sky-theme-modern) .sky-radio-input:disabled+.sky-switch-control .sky-radio-icon-modern-checked{background-color:#212327}.sky-theme-modern .sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{background:#1870B8}.sky-theme-modern .sky-radio-input:disabled+.sky-switch-control .sky-radio-icon-modern-checked{background-color:#212327}\n"], components: [{ type: i2$1.λ4, selector: "sky-icon", inputs: ["icon", "iconType", "size", "fixedWidth", "variant"] }], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1846
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioComponent, decorators: [{
|
|
1847
|
+
type: Component,
|
|
1848
|
+
args: [{ selector: 'sky-radio', providers: [SKY_RADIO_CONTROL_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, template: "<label\n class=\"sky-radio-wrapper sky-switch\"\n [ngClass]=\"{ 'sky-switch-disabled': disabled }\"\n>\n <input\n class=\"sky-radio-input sky-switch-input\"\n type=\"radio\"\n [attr.aria-label]=\"label\"\n [attr.aria-labelledby]=\"labelledBy\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [id]=\"inputId\"\n [name]=\"name\"\n [tabIndex]=\"tabindex\"\n [value]=\"value\"\n (blur)=\"onInputFocusChange($event)\"\n (change)=\"onInputChange($event)\"\n />\n <span\n class=\"sky-switch-control\"\n [ngClass]=\"{\n 'sky-switch-control-icon': icon,\n 'sky-rounded-corners': icon,\n 'sky-rounded-circle': !icon,\n 'sky-switch-control-info': icon && radioType === 'info',\n 'sky-switch-control-success': icon && radioType === 'success',\n 'sky-switch-control-warning': icon && radioType === 'warning',\n 'sky-switch-control-danger': icon && radioType === 'danger'\n }\"\n >\n <sky-icon *ngIf=\"icon\" fixedWidth=\"true\" [icon]=\"icon\"> </sky-icon>\n </span>\n <ng-content select=\"sky-radio-label\"></ng-content>\n</label>\n", styles: [".sky-switch-control:not(.sky-switch-control-icon) sky-icon{font-size:70%}.sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{content:\"\";display:inline-block;width:10px;height:10px;background:#000000;border-radius:50%}:host-context(.sky-theme-modern) .sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{background:#1870B8}:host-context(.sky-theme-modern) .sky-radio-input:disabled+.sky-switch-control .sky-radio-icon-modern-checked{background-color:#212327}.sky-theme-modern .sky-switch-input:checked+.sky-switch-control:not(.sky-switch-control-icon):after{background:#1870B8}.sky-theme-modern .sky-radio-input:disabled+.sky-switch-control .sky-radio-icon-modern-checked{background-color:#212327}\n"] }]
|
|
1849
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { checked: [{
|
|
1850
|
+
type: Input
|
|
1851
|
+
}], disabled: [{
|
|
1852
|
+
type: Input
|
|
1853
|
+
}], id: [{
|
|
1854
|
+
type: Input
|
|
1855
|
+
}], label: [{
|
|
1856
|
+
type: Input
|
|
1857
|
+
}], labelledBy: [{
|
|
1858
|
+
type: Input
|
|
1859
|
+
}], name: [{
|
|
1860
|
+
type: Input
|
|
1861
|
+
}], tabindex: [{
|
|
1862
|
+
type: Input
|
|
1863
|
+
}], value: [{
|
|
1864
|
+
type: Input
|
|
1865
|
+
}], icon: [{
|
|
1866
|
+
type: Input
|
|
1867
|
+
}], radioType: [{
|
|
1868
|
+
type: Input
|
|
1869
|
+
}], change: [{
|
|
1870
|
+
type: Output
|
|
1871
|
+
}], checkedChange: [{
|
|
1872
|
+
type: Output
|
|
1873
|
+
}], disabledChange: [{
|
|
1874
|
+
type: Output
|
|
1875
|
+
}] } });
|
|
1876
|
+
|
|
1877
|
+
let nextUniqueId = 0;
|
|
1878
|
+
/**
|
|
1879
|
+
* Organizes radio buttons into a group. It is required for radio
|
|
1880
|
+
* buttons on Angular reactive forms, and we recommend using it with all radio buttons.
|
|
1881
|
+
* On Angular forms, the component manages the selected values and keeps the forms up-to-date.
|
|
1882
|
+
* When users select a radio button, its value is driven through an `ngModel` attribute that you specify on the `sky-radio-group` element.
|
|
1883
|
+
*/
|
|
1884
|
+
class SkyRadioGroupComponent {
|
|
1885
|
+
constructor(changeDetector, ngControl) {
|
|
1886
|
+
this.changeDetector = changeDetector;
|
|
1887
|
+
this.ngControl = ngControl;
|
|
1888
|
+
/**
|
|
1889
|
+
* Indicates whether the input is required for form validation.
|
|
1890
|
+
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
1891
|
+
* attributes to the input element so that forms display an invalid state until the input element
|
|
1892
|
+
* is complete.
|
|
1893
|
+
* @default false
|
|
1894
|
+
*/
|
|
1895
|
+
this.required = false;
|
|
1896
|
+
this.ngUnsubscribe = new Subject();
|
|
1897
|
+
this._disabled = false;
|
|
1898
|
+
this._name = `sky-radio-group-${nextUniqueId++}`;
|
|
1899
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1900
|
+
this.onChange = () => { };
|
|
1901
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1902
|
+
this.onTouched = () => { };
|
|
1903
|
+
if (this.ngControl) {
|
|
1904
|
+
this.ngControl.valueAccessor = this;
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
/**
|
|
1908
|
+
* Indicates whether to disable the input.
|
|
1909
|
+
* @default false
|
|
1910
|
+
*/
|
|
1911
|
+
set disabled(value) {
|
|
1912
|
+
const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);
|
|
1913
|
+
if (this._disabled !== newDisabledState) {
|
|
1914
|
+
this._disabled = newDisabledState;
|
|
1915
|
+
this.updateRadioButtonDisabled();
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
get disabled() {
|
|
1919
|
+
return this._disabled;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Specifies a name for the collection of radio buttons that the component groups together.
|
|
1923
|
+
* This property overwrites the deprecated `name` property on individual `sky-radio` elements,
|
|
1924
|
+
* and it is required unless the `name` property is set on individual `sky-radio` elements.
|
|
1925
|
+
* @required
|
|
1926
|
+
*/
|
|
1927
|
+
set name(value) {
|
|
1928
|
+
this._name = value;
|
|
1929
|
+
this.updateRadioButtonNames();
|
|
1930
|
+
}
|
|
1931
|
+
get name() {
|
|
1932
|
+
return this._name;
|
|
1933
|
+
}
|
|
1934
|
+
/**
|
|
1935
|
+
* Specifies the value of the radio button to select by default when the group loads.
|
|
1936
|
+
* The value corresponds to the `value` property of an individual `sky-radio` element within the
|
|
1937
|
+
* group.
|
|
1938
|
+
*/
|
|
1939
|
+
set value(value) {
|
|
1940
|
+
const isNewValue = value !== this._value;
|
|
1941
|
+
/* istanbul ignore else */
|
|
1942
|
+
if (isNewValue) {
|
|
1943
|
+
this._value = value;
|
|
1944
|
+
this.onChange(this._value);
|
|
1945
|
+
this.updateCheckedRadioFromValue();
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
get value() {
|
|
1949
|
+
return this._value;
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Specifies an index for all the radio buttons in the group. If the index is not defined,
|
|
1953
|
+
* the indices for individual radio buttons are set to their positions on load.
|
|
1954
|
+
* This property supports accessibility by placing focus on the currently selected radio
|
|
1955
|
+
* button. If no radio button is selected, it places focus on the first or last button
|
|
1956
|
+
* depending on how users navigate to the radio button group.
|
|
1957
|
+
*/
|
|
1958
|
+
set tabIndex(value) {
|
|
1959
|
+
if (this._tabIndex !== value) {
|
|
1960
|
+
this._tabIndex = value;
|
|
1961
|
+
this.updateRadioButtonTabIndexes();
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
get tabIndex() {
|
|
1965
|
+
return this._tabIndex;
|
|
1966
|
+
}
|
|
1967
|
+
ngAfterContentInit() {
|
|
1968
|
+
// Let child radio components render before updating.
|
|
1969
|
+
setTimeout(() => {
|
|
1970
|
+
this.resetRadioButtons();
|
|
1971
|
+
});
|
|
1972
|
+
// Watch for radio selections.
|
|
1973
|
+
this.watchForSelections();
|
|
1974
|
+
this.radios.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
1975
|
+
// Wait for child radio components to finish any rendering updates.
|
|
1976
|
+
setTimeout(() => {
|
|
1977
|
+
this.resetRadioButtons();
|
|
1978
|
+
});
|
|
1979
|
+
// Subscribe to the new radio buttons
|
|
1980
|
+
this.watchForSelections();
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
ngAfterViewInit() {
|
|
1984
|
+
if (this.ngControl) {
|
|
1985
|
+
// Backwards compatibility support for anyone still using Validators.Required.
|
|
1986
|
+
this.required =
|
|
1987
|
+
this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
|
|
1988
|
+
// Avoid an ExpressionChangedAfterItHasBeenCheckedError.
|
|
1989
|
+
this.changeDetector.detectChanges();
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
watchForSelections() {
|
|
1993
|
+
this.radios.forEach((radio) => {
|
|
1994
|
+
radio.change
|
|
1995
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
1996
|
+
.subscribe((change) => {
|
|
1997
|
+
this.onTouched();
|
|
1998
|
+
this.writeValue(change.value);
|
|
1999
|
+
});
|
|
2000
|
+
radio.blur.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
2001
|
+
this.onTouched();
|
|
2002
|
+
this.changeDetector.markForCheck();
|
|
2003
|
+
});
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
ngOnDestroy() {
|
|
2007
|
+
this.ngUnsubscribe.next();
|
|
2008
|
+
this.ngUnsubscribe.complete();
|
|
2009
|
+
}
|
|
2010
|
+
writeValue(value) {
|
|
2011
|
+
this.value = value;
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* @internal
|
|
2015
|
+
* Indicates whether to disable the control. Implemented as a part of ControlValueAccessor.
|
|
2016
|
+
*/
|
|
2017
|
+
setDisabledState(isDisabled) {
|
|
2018
|
+
this.disabled = isDisabled;
|
|
2019
|
+
}
|
|
2020
|
+
registerOnChange(fn) {
|
|
2021
|
+
this.onChange = fn;
|
|
2022
|
+
}
|
|
2023
|
+
registerOnTouched(fn) {
|
|
2024
|
+
this.onTouched = fn;
|
|
2025
|
+
}
|
|
2026
|
+
updateRadioButtonDisabled() {
|
|
2027
|
+
if (this.radios) {
|
|
2028
|
+
this.radios.forEach((radio) => {
|
|
2029
|
+
radio.disabled = this.disabled;
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
updateRadioButtonNames() {
|
|
2034
|
+
if (this.radios) {
|
|
2035
|
+
this.radios.forEach((radio) => {
|
|
2036
|
+
radio.name = this.name;
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
updateRadioButtonTabIndexes() {
|
|
2041
|
+
if (this.radios) {
|
|
2042
|
+
this.radios.forEach((radio) => {
|
|
2043
|
+
radio.groupTabIndex = this.tabIndex;
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
updateCheckedRadioFromValue() {
|
|
2048
|
+
if (!this.radios) {
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
this.radios.forEach((radio) => {
|
|
2052
|
+
radio.checked = this._value === radio.value;
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
resetRadioButtons() {
|
|
2056
|
+
this.updateCheckedRadioFromValue();
|
|
2057
|
+
this.updateRadioButtonNames();
|
|
2058
|
+
this.updateRadioButtonTabIndexes();
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
SkyRadioGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioGroupComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i4.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
2062
|
+
SkyRadioGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyRadioGroupComponent, selector: "sky-radio-group", inputs: { ariaLabelledBy: "ariaLabelledBy", ariaLabel: "ariaLabel", disabled: "disabled", name: "name", required: "required", value: "value", tabIndex: "tabIndex" }, queries: [{ propertyName: "radios", predicate: SkyRadioComponent, descendants: true }], ngImport: i0, template: "<div\n class=\"sky-radio-group\"\n role=\"radiogroup\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.required]=\"required ? '' : null\"\n>\n <ng-content></ng-content>\n</div>\n" });
|
|
2063
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioGroupComponent, decorators: [{
|
|
2064
|
+
type: Component,
|
|
2065
|
+
args: [{ selector: 'sky-radio-group', template: "<div\n class=\"sky-radio-group\"\n role=\"radiogroup\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"ariaLabelledBy\"\n [attr.aria-required]=\"required ? true : null\"\n [attr.required]=\"required ? '' : null\"\n>\n <ng-content></ng-content>\n</div>\n" }]
|
|
2066
|
+
}], ctorParameters: function () {
|
|
2067
|
+
return [{ type: i0.ChangeDetectorRef }, { type: i4.NgControl, decorators: [{
|
|
2068
|
+
type: Self
|
|
2069
|
+
}, {
|
|
2070
|
+
type: Optional
|
|
2071
|
+
}] }];
|
|
2072
|
+
}, propDecorators: { ariaLabelledBy: [{
|
|
2073
|
+
type: Input
|
|
2074
|
+
}], ariaLabel: [{
|
|
2075
|
+
type: Input
|
|
2076
|
+
}], disabled: [{
|
|
2077
|
+
type: Input
|
|
2078
|
+
}], name: [{
|
|
2079
|
+
type: Input
|
|
2080
|
+
}], required: [{
|
|
2081
|
+
type: Input
|
|
2082
|
+
}], value: [{
|
|
2083
|
+
type: Input
|
|
2084
|
+
}], tabIndex: [{
|
|
2085
|
+
type: Input
|
|
2086
|
+
}], radios: [{
|
|
2087
|
+
type: ContentChildren,
|
|
2088
|
+
args: [SkyRadioComponent, { descendants: true }]
|
|
2089
|
+
}] } });
|
|
2090
|
+
|
|
2091
|
+
/**
|
|
2092
|
+
* Specifies a label for the radio button.
|
|
2093
|
+
*/
|
|
2094
|
+
class SkyRadioLabelComponent {
|
|
2095
|
+
// When clicking on a checkbox label, Angular registers two click events.
|
|
2096
|
+
// This handler ignores all events except for those that deal
|
|
2097
|
+
// with the checkbox input explicitly.
|
|
2098
|
+
onClick(event) {
|
|
2099
|
+
event.stopPropagation();
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
SkyRadioLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2103
|
+
SkyRadioLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyRadioLabelComponent, selector: "sky-radio-label", host: { listeners: { "click": "onClick($event)" } }, ngImport: i0, template: "<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n" });
|
|
2104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioLabelComponent, decorators: [{
|
|
2105
|
+
type: Component,
|
|
2106
|
+
args: [{ selector: 'sky-radio-label', template: "<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n" }]
|
|
2107
|
+
}], propDecorators: { onClick: [{
|
|
2108
|
+
type: HostListener,
|
|
2109
|
+
args: ['click', ['$event']]
|
|
2110
|
+
}] } });
|
|
2111
|
+
|
|
2112
|
+
class SkyRadioModule {
|
|
2113
|
+
}
|
|
2114
|
+
SkyRadioModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2115
|
+
SkyRadioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioModule, declarations: [SkyRadioComponent,
|
|
2116
|
+
SkyRadioGroupComponent,
|
|
2117
|
+
SkyRadioLabelComponent], imports: [CommonModule, FormsModule, SkyIconModule], exports: [SkyRadioComponent, SkyRadioGroupComponent, SkyRadioLabelComponent] });
|
|
2118
|
+
SkyRadioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioModule, imports: [[CommonModule, FormsModule, SkyIconModule]] });
|
|
2119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyRadioModule, decorators: [{
|
|
2120
|
+
type: NgModule,
|
|
2121
|
+
args: [{
|
|
2122
|
+
declarations: [
|
|
2123
|
+
SkyRadioComponent,
|
|
2124
|
+
SkyRadioGroupComponent,
|
|
2125
|
+
SkyRadioLabelComponent,
|
|
2126
|
+
],
|
|
2127
|
+
imports: [CommonModule, FormsModule, SkyIconModule],
|
|
2128
|
+
exports: [SkyRadioComponent, SkyRadioGroupComponent, SkyRadioLabelComponent],
|
|
2129
|
+
}]
|
|
2130
|
+
}] });
|
|
2131
|
+
|
|
2132
|
+
const RESPONSIVE_CLASS_XS = 'sky-selection-box-container-xs';
|
|
2133
|
+
const RESPONSIVE_CLASS_SM = 'sky-selection-box-container-sm';
|
|
2134
|
+
const RESPONSIVE_CLASS_MD = 'sky-selection-box-container-md';
|
|
2135
|
+
const RESPONSIVE_CLASS_LG = 'sky-selection-box-container-lg';
|
|
2136
|
+
const BREAKPOINT_XS_MAX_PIXELS = 767;
|
|
2137
|
+
const BREAKPOINT_SM_MIN_PIXELS = 768;
|
|
2138
|
+
const BREAKPOINT_SM_MAX_PIXELS = 991;
|
|
2139
|
+
const BREAKPOINT_MD_MIN_PIXELS = 992;
|
|
2140
|
+
const BREAKPOINT_MD_MAX_PIXELS = 1439;
|
|
2141
|
+
/**
|
|
2142
|
+
* @internal
|
|
2143
|
+
*/
|
|
2144
|
+
class SkySelectionBoxAdapterService {
|
|
2145
|
+
constructor(coreAdapterService, rendererFactory) {
|
|
2146
|
+
this.coreAdapterService = coreAdapterService;
|
|
2147
|
+
this.renderer = rendererFactory.createRenderer(undefined, undefined);
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Sets focus on the specified element.
|
|
2151
|
+
*/
|
|
2152
|
+
focus(el) {
|
|
2153
|
+
el.nativeElement.focus();
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2156
|
+
* Returns a child element with the `.sky-switch` class.
|
|
2157
|
+
* Useful for getting SKY UX-themed radio buttons or checkboxes.
|
|
2158
|
+
*/
|
|
2159
|
+
getControl(el) {
|
|
2160
|
+
return el.nativeElement.querySelector('.sky-switch');
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Returns a breakpoint based on the width.
|
|
2164
|
+
* @param width Width of the element in pixels.
|
|
2165
|
+
*/
|
|
2166
|
+
getBreakpointForWidth(width) {
|
|
2167
|
+
if (width <= BREAKPOINT_XS_MAX_PIXELS) {
|
|
2168
|
+
return SkyMediaBreakpoints.xs;
|
|
2169
|
+
}
|
|
2170
|
+
else if (width >= BREAKPOINT_SM_MIN_PIXELS &&
|
|
2171
|
+
width <= BREAKPOINT_SM_MAX_PIXELS) {
|
|
2172
|
+
return SkyMediaBreakpoints.sm;
|
|
2173
|
+
}
|
|
2174
|
+
else if (width >= BREAKPOINT_MD_MIN_PIXELS &&
|
|
2175
|
+
width <= BREAKPOINT_MD_MAX_PIXELS) {
|
|
2176
|
+
return SkyMediaBreakpoints.md;
|
|
2177
|
+
}
|
|
2178
|
+
else {
|
|
2179
|
+
return SkyMediaBreakpoints.lg;
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Returns the width of the `parentNode` of the provided `element`.
|
|
2184
|
+
*/
|
|
2185
|
+
getParentWidth(element) {
|
|
2186
|
+
return element.nativeElement.parentNode.getBoundingClientRect().width;
|
|
2187
|
+
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Returns `true` if the `childEl` is a descendant of the `parentEl`.
|
|
2190
|
+
*/
|
|
2191
|
+
isDescendant(parentEl, childEl) {
|
|
2192
|
+
return parentEl.nativeElement.contains(childEl);
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* Sets the `tabIndex` of all focusable children of the `element` to the provided `tabIndex`.
|
|
2196
|
+
*/
|
|
2197
|
+
setChildrenTabIndex(element, tabIndex) {
|
|
2198
|
+
const el = element.nativeElement;
|
|
2199
|
+
const focusableElems = this.coreAdapterService.getFocusableChildren(el, {
|
|
2200
|
+
ignoreVisibility: true,
|
|
2201
|
+
});
|
|
2202
|
+
let index = focusableElems.length;
|
|
2203
|
+
while (index--) {
|
|
2204
|
+
focusableElems[index].tabIndex = tabIndex;
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Adds a responsive CSS class on the provided element based on its current width.
|
|
2209
|
+
*/
|
|
2210
|
+
setResponsiveClass(element, breakpoint) {
|
|
2211
|
+
const nativeEl = element.nativeElement;
|
|
2212
|
+
this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_XS);
|
|
2213
|
+
this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_SM);
|
|
2214
|
+
this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_MD);
|
|
2215
|
+
this.renderer.removeClass(nativeEl, RESPONSIVE_CLASS_LG);
|
|
2216
|
+
let newClass;
|
|
2217
|
+
// tslint:disable-next-line: switch-default
|
|
2218
|
+
switch (breakpoint) {
|
|
2219
|
+
case SkyMediaBreakpoints.xs: {
|
|
2220
|
+
newClass = RESPONSIVE_CLASS_XS;
|
|
2221
|
+
break;
|
|
2222
|
+
}
|
|
2223
|
+
case SkyMediaBreakpoints.sm: {
|
|
2224
|
+
newClass = RESPONSIVE_CLASS_SM;
|
|
2225
|
+
break;
|
|
2226
|
+
}
|
|
2227
|
+
case SkyMediaBreakpoints.md: {
|
|
2228
|
+
newClass = RESPONSIVE_CLASS_MD;
|
|
2229
|
+
break;
|
|
2230
|
+
}
|
|
2231
|
+
case SkyMediaBreakpoints.lg: {
|
|
2232
|
+
newClass = RESPONSIVE_CLASS_LG;
|
|
2233
|
+
break;
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
this.renderer.addClass(nativeEl, newClass);
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Sets the `tabIndex` of the `element` to the provided `tabIndex`.
|
|
2240
|
+
*/
|
|
2241
|
+
setTabIndex(element, tabIndex) {
|
|
2242
|
+
const el = element.nativeElement;
|
|
2243
|
+
el.tabIndex = tabIndex;
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
SkySelectionBoxAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxAdapterService, deps: [{ token: i2$2.SkyCoreAdapterService }, { token: i0.RendererFactory2 }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2247
|
+
SkySelectionBoxAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxAdapterService });
|
|
2248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxAdapterService, decorators: [{
|
|
2249
|
+
type: Injectable
|
|
2250
|
+
}], ctorParameters: function () { return [{ type: i2$2.SkyCoreAdapterService }, { type: i0.RendererFactory2 }]; } });
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Specifies the description to display in a selection box.
|
|
2254
|
+
*/
|
|
2255
|
+
class SkySelectionBoxDescriptionComponent {
|
|
2256
|
+
}
|
|
2257
|
+
SkySelectionBoxDescriptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxDescriptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2258
|
+
SkySelectionBoxDescriptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkySelectionBoxDescriptionComponent, selector: "sky-selection-box-description", ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
2259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxDescriptionComponent, decorators: [{
|
|
2260
|
+
type: Component,
|
|
2261
|
+
args: [{ selector: 'sky-selection-box-description', template: "<ng-content></ng-content>\n" }]
|
|
2262
|
+
}] });
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Creates a button to present users with a choice or question before proceeding with a one-time process.
|
|
2266
|
+
*/
|
|
2267
|
+
class SkySelectionBoxComponent {
|
|
2268
|
+
constructor(changeDetector, selectionBoxAdapterService) {
|
|
2269
|
+
this.changeDetector = changeDetector;
|
|
2270
|
+
this.selectionBoxAdapterService = selectionBoxAdapterService;
|
|
2271
|
+
this.ngUnsubscribe = new Subject();
|
|
2272
|
+
}
|
|
2273
|
+
set checked(value) {
|
|
2274
|
+
this._checked = value;
|
|
2275
|
+
this.changeDetector.markForCheck();
|
|
2276
|
+
}
|
|
2277
|
+
get checked() {
|
|
2278
|
+
return this._checked;
|
|
2279
|
+
}
|
|
2280
|
+
set disabled(value) {
|
|
2281
|
+
this.selectionBoxAdapterService.setTabIndex(this.selectionBoxEl, value ? -1 : 0);
|
|
2282
|
+
this._disabled = value;
|
|
2283
|
+
this.changeDetector.markForCheck();
|
|
2284
|
+
}
|
|
2285
|
+
get disabled() {
|
|
2286
|
+
return this._disabled || false;
|
|
2287
|
+
}
|
|
2288
|
+
ngAfterViewInit() {
|
|
2289
|
+
// Wait for consumer form controls to initialize before setting selected/disabled states.
|
|
2290
|
+
setTimeout(() => {
|
|
2291
|
+
this.selectionBoxAdapterService.setChildrenTabIndex(this.selectionBoxEl, -1);
|
|
2292
|
+
this.updateCheckedOnControlChange();
|
|
2293
|
+
this.updateDisabledState();
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
ngOnDestroy() {
|
|
2297
|
+
this.ngUnsubscribe.next();
|
|
2298
|
+
this.ngUnsubscribe.complete();
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Since we are programatically firing a click on the control,
|
|
2302
|
+
* make sure user is not clicking on the control before firing click logic.
|
|
2303
|
+
*/
|
|
2304
|
+
onClick(event) {
|
|
2305
|
+
const isControlClick = this.selectionBoxAdapterService.isDescendant(this.controlEl, event.target);
|
|
2306
|
+
if (!isControlClick) {
|
|
2307
|
+
this.selectControl();
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
onKeydown(event) {
|
|
2311
|
+
/* istanbul ignore else */
|
|
2312
|
+
if (event.key === ' ') {
|
|
2313
|
+
this.selectControl();
|
|
2314
|
+
event.preventDefault();
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
selectControl() {
|
|
2318
|
+
this.selectionBoxAdapterService.getControl(this.controlEl).click();
|
|
2319
|
+
this.selectionBoxAdapterService.focus(this.selectionBoxEl);
|
|
2320
|
+
}
|
|
2321
|
+
updateCheckedOnControlChange() {
|
|
2322
|
+
this.control.checkedChange
|
|
2323
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
2324
|
+
.subscribe((value) => {
|
|
2325
|
+
this.checked = value;
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2328
|
+
updateDisabledState() {
|
|
2329
|
+
this.control.disabledChange
|
|
2330
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
2331
|
+
.subscribe((value) => {
|
|
2332
|
+
this.disabled = value;
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
SkySelectionBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: SkySelectionBoxAdapterService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2337
|
+
SkySelectionBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkySelectionBoxComponent, selector: "sky-selection-box", inputs: { control: "control" }, viewQueries: [{ propertyName: "controlEl", first: true, predicate: ["control"], descendants: true, read: ElementRef }, { propertyName: "selectionBoxEl", first: true, predicate: ["selectionBox"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div\n class=\"sky-selection-box sky-rounded-corners sky-btn sky-btn-default\"\n role=\"button\"\n tabindex=\"0\"\n [attr.disabled]=\"disabled ? true : null\"\n [ngClass]=\"{\n 'sky-selection-box-selected': checked,\n 'sky-selection-box-disabled': disabled\n }\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-box sky-elevation-1': 'modern'\n }\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n #selectionBox\n>\n <div\n class=\"sky-selection-box-icon\"\n [ngStyle]=\"{\n display: !icon.innerHTML.trim() ? 'none' : ''\n }\"\n #icon\n >\n <ng-content select=\"sky-icon\"> </ng-content>\n </div>\n\n <div class=\"sky-selection-box-content\">\n <div\n class=\"sky-selection-box-header\"\n [ngClass]=\"{\n 'sky-font-heading-2': icon.innerHTML.trim(),\n 'sky-font-heading-3': !icon.innerHTML.trim()\n }\"\n >\n <ng-content select=\"sky-selection-box-header\"></ng-content>\n </div>\n <div\n class=\"sky-selection-box-description\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n <ng-content select=\"sky-selection-box-description\"> </ng-content>\n </div>\n </div>\n\n <div class=\"sky-selection-box-control\" #control>\n <ng-content select=\"sky-radio\"> </ng-content>\n <ng-content select=\"sky-checkbox\"> </ng-content>\n </div>\n</div>\n", styles: [".sky-selection-box{display:flex;flex-flow:row nowrap;padding:15px;text-align:left}.sky-selection-box:hover{background:#ffffff;box-shadow:0 0 5px #0000004d,inset 0 0 0 1px #00b4f1}.sky-selection-box:hover .sky-switch-control{border:solid 1px #00b4f1}.sky-selection-box:focus .sky-switch-control{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}.sky-selection-box.sky-selection-box-selected{background:#f1eef6}.sky-selection-box.sky-selection-box-disabled{background:#eeeeef}.sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{color:#686c73}.sky-selection-box .sky-selection-box-icon{color:#0974a1;margin:0 10px 0 0;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.sky-selection-box .sky-selection-box-icon .sky-icon{font-size:24px!important}.sky-selection-box .sky-selection-box-content{flex:1 1 auto;margin:0 10px 0 0;white-space:initial}.sky-selection-box .sky-selection-box-header{padding-top:3px}.sky-selection-box .sky-selection-box-control{flex:0 0 auto;padding-top:5px}:host-context(.sky-theme-modern) .sky-selection-box{padding:30px}:host-context(.sky-theme-modern) .sky-selection-box:hover{box-shadow:0 1px 3px #0000004d,inset 0 0 0 1px #1870b8}:host-context(.sky-theme-modern) .sky-selection-box:hover .sky-switch-control{border:solid 1px #1870B8}:host-context(.sky-theme-modern) .sky-selection-box:focus .sky-switch-input:not(:disabled):checked+.sky-switch-control{border:none}:host-context(.sky-theme-modern) .sky-selection-box:focus .sky-switch-control{outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8}:host-context(.sky-theme-modern) .sky-selection-box.sky-selection-box-selected,:host-context(.sky-theme-modern) .sky-selection-box:focus.sky-selection-box-selected{background:#e8f8ff;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d,inset 6px 0 #0974a1}:host-context(.sky-theme-modern) .sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{background:#d2d2d2;color:#686c73}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-icon{color:#0974a1;background:#e8f8ff;margin:0 15px 0 0;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-content{margin:0 30px 0 0}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-description{margin:3px 0 0}.sky-theme-modern .sky-selection-box{padding:30px}.sky-theme-modern .sky-selection-box:hover{box-shadow:0 1px 3px #0000004d,inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-selection-box:hover .sky-switch-control{border:solid 1px #1870B8}.sky-theme-modern .sky-selection-box:focus .sky-switch-input:not(:disabled):checked+.sky-switch-control{border:none}.sky-theme-modern .sky-selection-box:focus .sky-switch-control{outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern .sky-selection-box.sky-selection-box-selected,.sky-theme-modern .sky-selection-box:focus.sky-selection-box-selected{background:#e8f8ff;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d,inset 6px 0 #0974a1}.sky-theme-modern .sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{background:#d2d2d2;color:#686c73}.sky-theme-modern .sky-selection-box .sky-selection-box-icon{color:#0974a1;background:#e8f8ff;margin:0 15px 0 0;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.sky-theme-modern .sky-selection-box .sky-selection-box-content{margin:0 30px 0 0}.sky-theme-modern .sky-selection-box .sky-selection-box-description{margin:3px 0 0}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1$1.λ2, selector: "[skyThemeClass]", inputs: ["class", "skyThemeClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxComponent, decorators: [{
|
|
2339
|
+
type: Component,
|
|
2340
|
+
args: [{ selector: 'sky-selection-box', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"sky-selection-box sky-rounded-corners sky-btn sky-btn-default\"\n role=\"button\"\n tabindex=\"0\"\n [attr.disabled]=\"disabled ? true : null\"\n [ngClass]=\"{\n 'sky-selection-box-selected': checked,\n 'sky-selection-box-disabled': disabled\n }\"\n [skyThemeClass]=\"{\n 'sky-shadow': 'default',\n 'sky-box sky-elevation-1': 'modern'\n }\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n #selectionBox\n>\n <div\n class=\"sky-selection-box-icon\"\n [ngStyle]=\"{\n display: !icon.innerHTML.trim() ? 'none' : ''\n }\"\n #icon\n >\n <ng-content select=\"sky-icon\"> </ng-content>\n </div>\n\n <div class=\"sky-selection-box-content\">\n <div\n class=\"sky-selection-box-header\"\n [ngClass]=\"{\n 'sky-font-heading-2': icon.innerHTML.trim(),\n 'sky-font-heading-3': !icon.innerHTML.trim()\n }\"\n >\n <ng-content select=\"sky-selection-box-header\"></ng-content>\n </div>\n <div\n class=\"sky-selection-box-description\"\n [skyThemeClass]=\"{\n 'sky-font-deemphasized': 'modern',\n 'sky-deemphasized': 'default'\n }\"\n >\n <ng-content select=\"sky-selection-box-description\"> </ng-content>\n </div>\n </div>\n\n <div class=\"sky-selection-box-control\" #control>\n <ng-content select=\"sky-radio\"> </ng-content>\n <ng-content select=\"sky-checkbox\"> </ng-content>\n </div>\n</div>\n", styles: [".sky-selection-box{display:flex;flex-flow:row nowrap;padding:15px;text-align:left}.sky-selection-box:hover{background:#ffffff;box-shadow:0 0 5px #0000004d,inset 0 0 0 1px #00b4f1}.sky-selection-box:hover .sky-switch-control{border:solid 1px #00b4f1}.sky-selection-box:focus .sky-switch-control{outline:thin dotted;outline:-webkit-focus-ring-color auto 5px}.sky-selection-box.sky-selection-box-selected{background:#f1eef6}.sky-selection-box.sky-selection-box-disabled{background:#eeeeef}.sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{color:#686c73}.sky-selection-box .sky-selection-box-icon{color:#0974a1;margin:0 10px 0 0;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.sky-selection-box .sky-selection-box-icon .sky-icon{font-size:24px!important}.sky-selection-box .sky-selection-box-content{flex:1 1 auto;margin:0 10px 0 0;white-space:initial}.sky-selection-box .sky-selection-box-header{padding-top:3px}.sky-selection-box .sky-selection-box-control{flex:0 0 auto;padding-top:5px}:host-context(.sky-theme-modern) .sky-selection-box{padding:30px}:host-context(.sky-theme-modern) .sky-selection-box:hover{box-shadow:0 1px 3px #0000004d,inset 0 0 0 1px #1870b8}:host-context(.sky-theme-modern) .sky-selection-box:hover .sky-switch-control{border:solid 1px #1870B8}:host-context(.sky-theme-modern) .sky-selection-box:focus .sky-switch-input:not(:disabled):checked+.sky-switch-control{border:none}:host-context(.sky-theme-modern) .sky-selection-box:focus .sky-switch-control{outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8}:host-context(.sky-theme-modern) .sky-selection-box.sky-selection-box-selected,:host-context(.sky-theme-modern) .sky-selection-box:focus.sky-selection-box-selected{background:#e8f8ff;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d,inset 6px 0 #0974a1}:host-context(.sky-theme-modern) .sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{background:#d2d2d2;color:#686c73}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-icon{color:#0974a1;background:#e8f8ff;margin:0 15px 0 0;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-content{margin:0 30px 0 0}:host-context(.sky-theme-modern) .sky-selection-box .sky-selection-box-description{margin:3px 0 0}.sky-theme-modern .sky-selection-box{padding:30px}.sky-theme-modern .sky-selection-box:hover{box-shadow:0 1px 3px #0000004d,inset 0 0 0 1px #1870b8}.sky-theme-modern .sky-selection-box:hover .sky-switch-control{border:solid 1px #1870B8}.sky-theme-modern .sky-selection-box:focus .sky-switch-input:not(:disabled):checked+.sky-switch-control{border:none}.sky-theme-modern .sky-selection-box:focus .sky-switch-control{outline:none;border:none;box-shadow:inset 0 0 0 2px #1870b8}.sky-theme-modern .sky-selection-box.sky-selection-box-selected,.sky-theme-modern .sky-selection-box:focus.sky-selection-box-selected{background:#e8f8ff;box-shadow:inset 0 0 0 2px #1870b8,0 1px 8px #0000004d,inset 6px 0 #0974a1}.sky-theme-modern .sky-selection-box.sky-selection-box-disabled .sky-selection-box-icon{background:#d2d2d2;color:#686c73}.sky-theme-modern .sky-selection-box .sky-selection-box-icon{color:#0974a1;background:#e8f8ff;margin:0 15px 0 0;border-radius:50%;width:42px;height:42px;display:flex;align-items:center;justify-content:center;flex:0 0 auto}.sky-theme-modern .sky-selection-box .sky-selection-box-content{margin:0 30px 0 0}.sky-theme-modern .sky-selection-box .sky-selection-box-description{margin:3px 0 0}\n"] }]
|
|
2341
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: SkySelectionBoxAdapterService }]; }, propDecorators: { control: [{
|
|
2342
|
+
type: Input
|
|
2343
|
+
}], controlEl: [{
|
|
2344
|
+
type: ViewChild,
|
|
2345
|
+
args: ['control', {
|
|
2346
|
+
read: ElementRef,
|
|
2347
|
+
static: false,
|
|
2348
|
+
}]
|
|
2349
|
+
}], selectionBoxEl: [{
|
|
2350
|
+
type: ViewChild,
|
|
2351
|
+
args: ['selectionBox', {
|
|
2352
|
+
read: ElementRef,
|
|
2353
|
+
static: false,
|
|
2354
|
+
}]
|
|
2355
|
+
}] } });
|
|
2356
|
+
|
|
2357
|
+
const SKY_SELECTION_BOX_CLASS_NAME = '.sky-selection-box';
|
|
2358
|
+
/**
|
|
2359
|
+
* Creates a grid layout for an array of selection boxes.
|
|
2360
|
+
*/
|
|
2361
|
+
class SkySelectionBoxGridComponent {
|
|
2362
|
+
constructor(themeSvc, coreAdapterService, selectionBoxAdapter, hostElRef, mutationObserverSvc, ngZone) {
|
|
2363
|
+
this.themeSvc = themeSvc;
|
|
2364
|
+
this.coreAdapterService = coreAdapterService;
|
|
2365
|
+
this.selectionBoxAdapter = selectionBoxAdapter;
|
|
2366
|
+
this.hostElRef = hostElRef;
|
|
2367
|
+
this.mutationObserverSvc = mutationObserverSvc;
|
|
2368
|
+
this.ngZone = ngZone;
|
|
2369
|
+
this.ngUnsubscribe = new Subject();
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* @internal
|
|
2373
|
+
* Specifies how to display the selection boxes in the grid.
|
|
2374
|
+
* @default 'center'
|
|
2375
|
+
*/
|
|
2376
|
+
set alignItems(value) {
|
|
2377
|
+
this._alignItems = value;
|
|
2378
|
+
}
|
|
2379
|
+
get alignItems() {
|
|
2380
|
+
return this._alignItems || 'center';
|
|
2381
|
+
}
|
|
2382
|
+
set currentBreakpoint(value) {
|
|
2383
|
+
if (value !== this._currentBreakpoint) {
|
|
2384
|
+
this._currentBreakpoint = value;
|
|
2385
|
+
this.selectionBoxAdapter.setResponsiveClass(this.elementRef, value);
|
|
2386
|
+
this.updateChildrenHeights();
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
ngOnInit() {
|
|
2390
|
+
/* istanbul ignore else */
|
|
2391
|
+
if (this.themeSvc) {
|
|
2392
|
+
this.themeSvc.settingsChange
|
|
2393
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
2394
|
+
.subscribe(() => {
|
|
2395
|
+
this.updateBreakpointClass();
|
|
2396
|
+
this.updateChildrenHeights();
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
ngAfterViewInit() {
|
|
2401
|
+
this.updateBreakpointClass();
|
|
2402
|
+
this.updateChildrenHeights();
|
|
2403
|
+
this.initMutationObserver();
|
|
2404
|
+
}
|
|
2405
|
+
ngOnDestroy() {
|
|
2406
|
+
this.ngUnsubscribe.next();
|
|
2407
|
+
this.ngUnsubscribe.complete();
|
|
2408
|
+
this.destroyMutationObserver();
|
|
2409
|
+
}
|
|
2410
|
+
onWindowResize() {
|
|
2411
|
+
this.updateBreakpointClass();
|
|
2412
|
+
}
|
|
2413
|
+
initMutationObserver() {
|
|
2414
|
+
/* istanbul ignore else */
|
|
2415
|
+
if (!this.mutationObserver) {
|
|
2416
|
+
const el = this.elementRef.nativeElement;
|
|
2417
|
+
// MutationObserver is patched by Zone.js and therefore becomes part of the
|
|
2418
|
+
// Angular change detection cycle, but this can lead to infinite loops in some
|
|
2419
|
+
// scenarios. This will keep MutationObserver from triggering change detection.
|
|
2420
|
+
this.ngZone.runOutsideAngular(() => {
|
|
2421
|
+
this.mutationObserver = this.mutationObserverSvc.create(() => {
|
|
2422
|
+
this.updateChildrenHeights();
|
|
2423
|
+
});
|
|
2424
|
+
this.mutationObserver.observe(el, {
|
|
2425
|
+
characterData: true,
|
|
2426
|
+
subtree: true,
|
|
2427
|
+
});
|
|
2428
|
+
});
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
destroyMutationObserver() {
|
|
2432
|
+
/* istanbul ignore else */
|
|
2433
|
+
if (this.mutationObserver) {
|
|
2434
|
+
this.mutationObserver.disconnect();
|
|
2435
|
+
this.mutationObserver = undefined;
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
updateBreakpointClass() {
|
|
2439
|
+
const parentWidth = this.selectionBoxAdapter.getParentWidth(this.hostElRef);
|
|
2440
|
+
this.currentBreakpoint =
|
|
2441
|
+
this.selectionBoxAdapter.getBreakpointForWidth(parentWidth);
|
|
2442
|
+
}
|
|
2443
|
+
updateChildrenHeights() {
|
|
2444
|
+
this.coreAdapterService.resetHeight(this.elementRef, SKY_SELECTION_BOX_CLASS_NAME);
|
|
2445
|
+
this.coreAdapterService.syncMaxHeight(this.elementRef, SKY_SELECTION_BOX_CLASS_NAME);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
SkySelectionBoxGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxGridComponent, deps: [{ token: i1$1.SkyThemeService }, { token: i2$2.SkyCoreAdapterService }, { token: SkySelectionBoxAdapterService }, { token: i0.ElementRef }, { token: i2$2.MutationObserverService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2449
|
+
SkySelectionBoxGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkySelectionBoxGridComponent, selector: "sky-selection-box-grid", inputs: { alignItems: "alignItems" }, host: { listeners: { "window:resize": "onWindowResize()" } }, queries: [{ propertyName: "selectionBoxes", predicate: SkySelectionBoxComponent, read: SkySelectionBoxComponent }], viewQueries: [{ propertyName: "elementRef", first: true, predicate: ["container"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div\n class=\"sky-selection-box-grid\"\n [ngClass]=\"'sky-selection-box-grid-align-' + alignItems\"\n #container\n>\n <ng-content select=\"sky-selection-box\"></ng-content>\n</div>\n", styles: [":host{display:block}.sky-selection-box-grid{display:flex;flex-flow:row wrap;padding:0 7.5px;margin:0 auto}.sky-selection-box-grid.sky-selection-box-grid-align-center{justify-content:center}.sky-selection-box-grid.sky-selection-box-grid-align-left{justify-content:flex-start}.sky-selection-box-grid>sky-selection-box{margin:0 7.5px 15px;height:100%}.sky-selection-box-grid.sky-selection-box-container-xs{max-width:374px}.sky-selection-box-grid.sky-selection-box-container-xs>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-sm{max-width:733px}.sky-selection-box-grid.sky-selection-box-container-sm>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-md{max-width:937px}.sky-selection-box-grid.sky-selection-box-container-md>sky-selection-box{flex:0 1 446px}.sky-selection-box-grid.sky-selection-box-container-lg{max-width:1398px}.sky-selection-box-grid.sky-selection-box-container-lg>sky-selection-box{flex:0 1 446px}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2450
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxGridComponent, decorators: [{
|
|
2451
|
+
type: Component,
|
|
2452
|
+
args: [{ selector: 'sky-selection-box-grid', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<div\n class=\"sky-selection-box-grid\"\n [ngClass]=\"'sky-selection-box-grid-align-' + alignItems\"\n #container\n>\n <ng-content select=\"sky-selection-box\"></ng-content>\n</div>\n", styles: [":host{display:block}.sky-selection-box-grid{display:flex;flex-flow:row wrap;padding:0 7.5px;margin:0 auto}.sky-selection-box-grid.sky-selection-box-grid-align-center{justify-content:center}.sky-selection-box-grid.sky-selection-box-grid-align-left{justify-content:flex-start}.sky-selection-box-grid>sky-selection-box{margin:0 7.5px 15px;height:100%}.sky-selection-box-grid.sky-selection-box-container-xs{max-width:374px}.sky-selection-box-grid.sky-selection-box-container-xs>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-xs .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-sm{max-width:733px}.sky-selection-box-grid.sky-selection-box-container-sm>sky-selection-box{flex:0 1 344px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box{padding:15px}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-icon{display:none}.sky-selection-box-grid.sky-selection-box-container-sm .sky-selection-box .sky-selection-box-header{font-size:20px;font-weight:400}.sky-selection-box-grid.sky-selection-box-container-md{max-width:937px}.sky-selection-box-grid.sky-selection-box-container-md>sky-selection-box{flex:0 1 446px}.sky-selection-box-grid.sky-selection-box-container-lg{max-width:1398px}.sky-selection-box-grid.sky-selection-box-container-lg>sky-selection-box{flex:0 1 446px}\n"] }]
|
|
2453
|
+
}], ctorParameters: function () { return [{ type: i1$1.SkyThemeService }, { type: i2$2.SkyCoreAdapterService }, { type: SkySelectionBoxAdapterService }, { type: i0.ElementRef }, { type: i2$2.MutationObserverService }, { type: i0.NgZone }]; }, propDecorators: { alignItems: [{
|
|
2454
|
+
type: Input
|
|
2455
|
+
}], selectionBoxes: [{
|
|
2456
|
+
type: ContentChildren,
|
|
2457
|
+
args: [SkySelectionBoxComponent, {
|
|
2458
|
+
read: SkySelectionBoxComponent,
|
|
2459
|
+
}]
|
|
2460
|
+
}], elementRef: [{
|
|
2461
|
+
type: ViewChild,
|
|
2462
|
+
args: ['container', {
|
|
2463
|
+
read: ElementRef,
|
|
2464
|
+
static: true,
|
|
2465
|
+
}]
|
|
2466
|
+
}], onWindowResize: [{
|
|
2467
|
+
type: HostListener,
|
|
2468
|
+
args: ['window:resize']
|
|
2469
|
+
}] } });
|
|
2470
|
+
|
|
2471
|
+
/**
|
|
2472
|
+
* Specifies the header to display in a selection box.
|
|
2473
|
+
*/
|
|
2474
|
+
class SkySelectionBoxHeaderComponent {
|
|
2475
|
+
}
|
|
2476
|
+
SkySelectionBoxHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2477
|
+
SkySelectionBoxHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkySelectionBoxHeaderComponent, selector: "sky-selection-box-header", ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
2478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxHeaderComponent, decorators: [{
|
|
2479
|
+
type: Component,
|
|
2480
|
+
args: [{ selector: 'sky-selection-box-header', template: "<ng-content></ng-content>\n" }]
|
|
2481
|
+
}] });
|
|
2482
|
+
|
|
2483
|
+
class SkySelectionBoxModule {
|
|
2484
|
+
}
|
|
2485
|
+
SkySelectionBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2486
|
+
SkySelectionBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxModule, declarations: [SkySelectionBoxGridComponent,
|
|
2487
|
+
SkySelectionBoxComponent,
|
|
2488
|
+
SkySelectionBoxDescriptionComponent,
|
|
2489
|
+
SkySelectionBoxHeaderComponent], imports: [CommonModule, SkyThemeModule], exports: [SkySelectionBoxGridComponent,
|
|
2490
|
+
SkySelectionBoxComponent,
|
|
2491
|
+
SkySelectionBoxDescriptionComponent,
|
|
2492
|
+
SkySelectionBoxHeaderComponent] });
|
|
2493
|
+
SkySelectionBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxModule, providers: [SkySelectionBoxAdapterService], imports: [[CommonModule, SkyThemeModule]] });
|
|
2494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkySelectionBoxModule, decorators: [{
|
|
2495
|
+
type: NgModule,
|
|
2496
|
+
args: [{
|
|
2497
|
+
declarations: [
|
|
2498
|
+
SkySelectionBoxGridComponent,
|
|
2499
|
+
SkySelectionBoxComponent,
|
|
2500
|
+
SkySelectionBoxDescriptionComponent,
|
|
2501
|
+
SkySelectionBoxHeaderComponent,
|
|
2502
|
+
],
|
|
2503
|
+
imports: [CommonModule, SkyThemeModule],
|
|
2504
|
+
exports: [
|
|
2505
|
+
SkySelectionBoxGridComponent,
|
|
2506
|
+
SkySelectionBoxComponent,
|
|
2507
|
+
SkySelectionBoxDescriptionComponent,
|
|
2508
|
+
SkySelectionBoxHeaderComponent,
|
|
2509
|
+
],
|
|
2510
|
+
providers: [SkySelectionBoxAdapterService],
|
|
2511
|
+
}]
|
|
2512
|
+
}] });
|
|
2513
|
+
|
|
2514
|
+
/**
|
|
2515
|
+
* Specifies the label to display beside the toggle switch.
|
|
2516
|
+
*/
|
|
2517
|
+
class SkyToggleSwitchLabelComponent {
|
|
2518
|
+
}
|
|
2519
|
+
SkyToggleSwitchLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2520
|
+
SkyToggleSwitchLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyToggleSwitchLabelComponent, selector: "sky-toggle-switch-label", ngImport: i0, template: "<ng-content></ng-content>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchLabelComponent, decorators: [{
|
|
2522
|
+
type: Component,
|
|
2523
|
+
args: [{ selector: 'sky-toggle-switch-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content></ng-content>\n" }]
|
|
2524
|
+
}] });
|
|
2525
|
+
|
|
2526
|
+
// tslint:disable:no-forward-ref no-use-before-declare
|
|
2527
|
+
const SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR = {
|
|
2528
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2529
|
+
useExisting: forwardRef(() => SkyToggleSwitchComponent),
|
|
2530
|
+
multi: true,
|
|
2531
|
+
};
|
|
2532
|
+
const SKY_TOGGLE_SWITCH_VALIDATOR = {
|
|
2533
|
+
provide: NG_VALIDATORS,
|
|
2534
|
+
useExisting: forwardRef(() => SkyToggleSwitchComponent),
|
|
2535
|
+
multi: true,
|
|
2536
|
+
};
|
|
2537
|
+
// tslint:enable
|
|
2538
|
+
let uniqueId = 0;
|
|
2539
|
+
class SkyToggleSwitchComponent {
|
|
2540
|
+
constructor(changeDetector) {
|
|
2541
|
+
this.changeDetector = changeDetector;
|
|
2542
|
+
/**
|
|
2543
|
+
* Indicates whether to disable the toggle switch.
|
|
2544
|
+
*/
|
|
2545
|
+
this.disabled = false;
|
|
2546
|
+
/**
|
|
2547
|
+
* Specifies a tab index for the toggle switch. If not defined, the index is set to the position
|
|
2548
|
+
* of the toggle switch on load.
|
|
2549
|
+
*/
|
|
2550
|
+
this.tabIndex = 0;
|
|
2551
|
+
/**
|
|
2552
|
+
* Fires when the checked state of a toggle switch changes.
|
|
2553
|
+
*/
|
|
2554
|
+
this.toggleChange = new EventEmitter();
|
|
2555
|
+
this.enableIndicatorAnimation = false;
|
|
2556
|
+
this.isFirstChange = true;
|
|
2557
|
+
this.ngUnsubscribe = new Subject();
|
|
2558
|
+
this.toggleSwitchId = uniqueId++;
|
|
2559
|
+
this._checked = false;
|
|
2560
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2561
|
+
this.onTouched = () => { };
|
|
2562
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2563
|
+
this.onChange = () => { };
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* Indicates whether the toggle switch is selected.
|
|
2567
|
+
* @default false
|
|
2568
|
+
*/
|
|
2569
|
+
set checked(checked) {
|
|
2570
|
+
if (checked !== this.checked) {
|
|
2571
|
+
this._checked = checked;
|
|
2572
|
+
this.onChange(checked);
|
|
2573
|
+
// Do not mark the field as "dirty"
|
|
2574
|
+
// if the field has been initialized with a value.
|
|
2575
|
+
if (this.isFirstChange && this.control) {
|
|
2576
|
+
this.control.markAsPristine();
|
|
2577
|
+
this.isFirstChange = false;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
get checked() {
|
|
2582
|
+
return this._checked || false;
|
|
2583
|
+
}
|
|
2584
|
+
get hasLabelComponent() {
|
|
2585
|
+
return this.labelComponents.length > 0;
|
|
2586
|
+
}
|
|
2587
|
+
get labelElementId() {
|
|
2588
|
+
return `sky-toggle-switch-label-${this.toggleSwitchId}`;
|
|
2589
|
+
}
|
|
2590
|
+
ngAfterContentInit() {
|
|
2591
|
+
this.labelComponents.changes
|
|
2592
|
+
.pipe(takeUntil(this.ngUnsubscribe))
|
|
2593
|
+
.subscribe(() => {
|
|
2594
|
+
// Allow the template to reload any ARIA attributes that are relying on the
|
|
2595
|
+
// label component existing in the DOM.
|
|
2596
|
+
this.changeDetector.markForCheck();
|
|
2597
|
+
});
|
|
2598
|
+
// Wait for the view to render before applying animation effects.
|
|
2599
|
+
// (Some browsers, such as Firefox, apply the animation too early.)
|
|
2600
|
+
setTimeout(() => {
|
|
2601
|
+
this.enableIndicatorAnimation = true;
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
ngOnDestroy() {
|
|
2605
|
+
this.ngUnsubscribe.next();
|
|
2606
|
+
this.ngUnsubscribe.complete();
|
|
2607
|
+
}
|
|
2608
|
+
writeValue(value) {
|
|
2609
|
+
this.checked = !!value;
|
|
2610
|
+
this.changeDetector.markForCheck();
|
|
2611
|
+
}
|
|
2612
|
+
validate(control) {
|
|
2613
|
+
if (!this.control) {
|
|
2614
|
+
this.control = control;
|
|
2615
|
+
}
|
|
2616
|
+
return;
|
|
2617
|
+
}
|
|
2618
|
+
registerOnChange(fn) {
|
|
2619
|
+
this.onChange = fn;
|
|
2620
|
+
}
|
|
2621
|
+
registerOnTouched(fn) {
|
|
2622
|
+
this.onTouched = fn;
|
|
2623
|
+
}
|
|
2624
|
+
setDisabledState(disabled) {
|
|
2625
|
+
this.disabled = disabled;
|
|
2626
|
+
this.changeDetector.markForCheck();
|
|
2627
|
+
}
|
|
2628
|
+
onButtonClick(event) {
|
|
2629
|
+
event.stopPropagation();
|
|
2630
|
+
this.toggleChecked();
|
|
2631
|
+
this.emitChangeEvent();
|
|
2632
|
+
}
|
|
2633
|
+
onButtonBlur() {
|
|
2634
|
+
this.onTouched();
|
|
2635
|
+
}
|
|
2636
|
+
emitChangeEvent() {
|
|
2637
|
+
this.onChange(this._checked);
|
|
2638
|
+
this.toggleChange.emit({
|
|
2639
|
+
checked: this._checked,
|
|
2640
|
+
});
|
|
2641
|
+
}
|
|
2642
|
+
toggleChecked() {
|
|
2643
|
+
this.checked = !this.checked;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
SkyToggleSwitchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2647
|
+
SkyToggleSwitchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.7", type: SkyToggleSwitchComponent, selector: "sky-toggle-switch", inputs: { ariaLabel: "ariaLabel", checked: "checked", disabled: "disabled", tabIndex: "tabIndex" }, outputs: { toggleChange: "toggleChange" }, providers: [
|
|
2648
|
+
SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR,
|
|
2649
|
+
SKY_TOGGLE_SWITCH_VALIDATOR,
|
|
2650
|
+
], queries: [{ propertyName: "labelComponents", predicate: SkyToggleSwitchLabelComponent }], ngImport: i0, template: "<span class=\"sky-toggle-switch\">\n <button\n class=\"sky-toggle-switch-button\"\n role=\"switch\"\n type=\"button\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"hasLabelComponent ? labelElementId : null\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'sky-toggle-switch-checked': checked,\n 'sky-toggle-switch-disabled': disabled\n }\"\n [tabIndex]=\"tabIndex\"\n (blur)=\"onButtonBlur()\"\n (click)=\"onButtonClick($event)\"\n >\n <i\n aria-hidden=\"true\"\n class=\"sky-toggle-switch-indicator\"\n [ngClass]=\"{\n 'sky-toggle-switch-transition': enableIndicatorAnimation\n }\"\n role=\"presentation\"\n > </i\n >\n <!-- Non-breaking space needed to align switch to baseline! -->\n </button>\n\n <label\n *ngIf=\"hasLabelComponent\"\n class=\"sky-toggle-switch-label\"\n [attr.id]=\"labelElementId\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"> </ng-container>\n </label>\n</span>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-toggle-switch-label\"></ng-content>\n</ng-template>\n", styles: [".sky-toggle-switch{display:inline-flex;align-items:baseline}.sky-toggle-switch-button{border:1px solid #cdcfd2;background-color:#eeeeef;padding:1px;border-radius:24px;flex:1 0 46px;line-height:1.428571429}.sky-toggle-switch-button:hover:not(.sky-toggle-switch-disabled){border-color:#00b4f1;border-width:2px;padding:0;cursor:pointer}.sky-toggle-switch-button.sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#00b4f1;border-width:2px;padding:0}.sky-toggle-switch-button.sky-toggle-switch-checked .sky-toggle-switch-indicator{left:100%}.sky-toggle-switch-button.sky-toggle-switch-disabled{background-color:#cdcfd2;border-color:transparent}.sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#eeeeef}.sky-toggle-switch-button+.sky-toggle-switch-label{margin-left:10px;flex:1 0 auto}.sky-toggle-switch-indicator{height:22px;width:22px;display:block;position:relative;top:0;left:22px;margin-left:-22px;border-radius:100%;box-shadow:0 1px 2px #000000bf;background-color:#fff}.sky-toggle-switch-indicator.sky-toggle-switch-transition{transition:left .15s}:host-context(.sky-theme-modern) .sky-toggle-switch-button{background-color:#fff;border-width:1px;flex-basis:48px;transition:border-color .15s,box-shadow .15s}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled{border-color:#d2d2d2;cursor:not-allowed}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled,:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#ededee}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-checked{padding:1px}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled).sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#1870b8}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):active,:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):focus{outline:none;border:solid 2px #1870B8;padding:0}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):focus{box-shadow:0 1px 8px #0000004d}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):hover:not(:focus){padding:1px;border:solid 1px #1870B8}:host-context(.sky-theme-modern) .sky-toggle-switch-indicator{box-shadow:0 1px 2px #00000080}.sky-theme-modern .sky-toggle-switch-button{background-color:#fff;border-width:1px;flex-basis:48px;transition:border-color .15s,box-shadow .15s}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled{border-color:#d2d2d2;cursor:not-allowed}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled,.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#ededee}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-checked{padding:1px}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled).sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#1870b8}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):active,.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):focus{outline:none;border:solid 2px #1870B8;padding:0}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):focus{box-shadow:0 1px 8px #0000004d}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):hover:not(:focus){padding:1px;border:solid 1px #1870B8}.sky-theme-modern .sky-toggle-switch-indicator{box-shadow:0 1px 2px #00000080}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-toggle-switch-button{background-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-toggle-switch-button{background-color:#121212}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2651
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchComponent, decorators: [{
|
|
2652
|
+
type: Component,
|
|
2653
|
+
args: [{ selector: 'sky-toggle-switch', providers: [
|
|
2654
|
+
SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR,
|
|
2655
|
+
SKY_TOGGLE_SWITCH_VALIDATOR,
|
|
2656
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<span class=\"sky-toggle-switch\">\n <button\n class=\"sky-toggle-switch-button\"\n role=\"switch\"\n type=\"button\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.aria-labelledby]=\"hasLabelComponent ? labelElementId : null\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'sky-toggle-switch-checked': checked,\n 'sky-toggle-switch-disabled': disabled\n }\"\n [tabIndex]=\"tabIndex\"\n (blur)=\"onButtonBlur()\"\n (click)=\"onButtonClick($event)\"\n >\n <i\n aria-hidden=\"true\"\n class=\"sky-toggle-switch-indicator\"\n [ngClass]=\"{\n 'sky-toggle-switch-transition': enableIndicatorAnimation\n }\"\n role=\"presentation\"\n > </i\n >\n <!-- Non-breaking space needed to align switch to baseline! -->\n </button>\n\n <label\n *ngIf=\"hasLabelComponent\"\n class=\"sky-toggle-switch-label\"\n [attr.id]=\"labelElementId\"\n >\n <ng-container *ngTemplateOutlet=\"labelContent\"> </ng-container>\n </label>\n</span>\n\n<ng-template #labelContent>\n <ng-content select=\"sky-toggle-switch-label\"></ng-content>\n</ng-template>\n", styles: [".sky-toggle-switch{display:inline-flex;align-items:baseline}.sky-toggle-switch-button{border:1px solid #cdcfd2;background-color:#eeeeef;padding:1px;border-radius:24px;flex:1 0 46px;line-height:1.428571429}.sky-toggle-switch-button:hover:not(.sky-toggle-switch-disabled){border-color:#00b4f1;border-width:2px;padding:0;cursor:pointer}.sky-toggle-switch-button.sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#00b4f1;border-width:2px;padding:0}.sky-toggle-switch-button.sky-toggle-switch-checked .sky-toggle-switch-indicator{left:100%}.sky-toggle-switch-button.sky-toggle-switch-disabled{background-color:#cdcfd2;border-color:transparent}.sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#eeeeef}.sky-toggle-switch-button+.sky-toggle-switch-label{margin-left:10px;flex:1 0 auto}.sky-toggle-switch-indicator{height:22px;width:22px;display:block;position:relative;top:0;left:22px;margin-left:-22px;border-radius:100%;box-shadow:0 1px 2px #000000bf;background-color:#fff}.sky-toggle-switch-indicator.sky-toggle-switch-transition{transition:left .15s}:host-context(.sky-theme-modern) .sky-toggle-switch-button{background-color:#fff;border-width:1px;flex-basis:48px;transition:border-color .15s,box-shadow .15s}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled{border-color:#d2d2d2;cursor:not-allowed}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled,:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#ededee}:host-context(.sky-theme-modern) .sky-toggle-switch-button.sky-toggle-switch-checked{padding:1px}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled).sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#1870b8}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):active,:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):focus{outline:none;border:solid 2px #1870B8;padding:0}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):focus{box-shadow:0 1px 8px #0000004d}:host-context(.sky-theme-modern) .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):hover:not(:focus){padding:1px;border:solid 1px #1870B8}:host-context(.sky-theme-modern) .sky-toggle-switch-indicator{box-shadow:0 1px 2px #00000080}.sky-theme-modern .sky-toggle-switch-button{background-color:#fff;border-width:1px;flex-basis:48px;transition:border-color .15s,box-shadow .15s}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled{border-color:#d2d2d2;cursor:not-allowed}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled,.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-disabled .sky-toggle-switch-indicator{background-color:#ededee}.sky-theme-modern .sky-toggle-switch-button.sky-toggle-switch-checked{padding:1px}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled).sky-toggle-switch-checked{background-color:#c1e8fb;border-color:#1870b8}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):active,.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):focus{outline:none;border:solid 2px #1870B8;padding:0}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):focus{box-shadow:0 1px 8px #0000004d}.sky-theme-modern .sky-toggle-switch-button:not(.sky-toggle-switch-disabled):not(:active):hover:not(:focus){padding:1px;border:solid 1px #1870B8}.sky-theme-modern .sky-toggle-switch-indicator{box-shadow:0 1px 2px #00000080}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-toggle-switch-button{background-color:#121212}.sky-theme-modern.sky-theme-mode-dark .sky-toggle-switch-button{background-color:#121212}\n"] }]
|
|
2657
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { ariaLabel: [{
|
|
2658
|
+
type: Input
|
|
2659
|
+
}], checked: [{
|
|
2660
|
+
type: Input
|
|
2661
|
+
}], disabled: [{
|
|
2662
|
+
type: Input
|
|
2663
|
+
}], tabIndex: [{
|
|
2664
|
+
type: Input
|
|
2665
|
+
}], toggleChange: [{
|
|
2666
|
+
type: Output
|
|
2667
|
+
}], labelComponents: [{
|
|
2668
|
+
type: ContentChildren,
|
|
2669
|
+
args: [SkyToggleSwitchLabelComponent]
|
|
2670
|
+
}] } });
|
|
2671
|
+
|
|
2672
|
+
class SkyToggleSwitchModule {
|
|
2673
|
+
}
|
|
2674
|
+
SkyToggleSwitchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2675
|
+
SkyToggleSwitchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchModule, declarations: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent], imports: [CommonModule, FormsModule], exports: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent] });
|
|
2676
|
+
SkyToggleSwitchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchModule, imports: [[CommonModule, FormsModule]] });
|
|
2677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: SkyToggleSwitchModule, decorators: [{
|
|
2678
|
+
type: NgModule,
|
|
2679
|
+
args: [{
|
|
2680
|
+
declarations: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent],
|
|
2681
|
+
imports: [CommonModule, FormsModule],
|
|
2682
|
+
exports: [SkyToggleSwitchLabelComponent, SkyToggleSwitchComponent],
|
|
2683
|
+
}]
|
|
2684
|
+
}] });
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* Generated bundle index. Do not edit.
|
|
2688
|
+
*/
|
|
2689
|
+
|
|
2690
|
+
export { SkyCharacterCounterModule, SkyCheckboxChange, SkyCheckboxModule, SkyFileAttachmentsModule, SkyFileSizePipe, SkyInputBoxHostService, SkyInputBoxModule, SkyRadioModule, SkySelectionBoxModule, SkyToggleSwitchModule, SkyCharacterCounterIndicatorComponent as λ1, SkyInputBoxComponent as λ10, SkyRadioGroupComponent as λ11, SkyRadioLabelComponent as λ12, SkyRadioComponent as λ13, SkySelectionBoxDescriptionComponent as λ14, SkySelectionBoxGridComponent as λ15, SkySelectionBoxHeaderComponent as λ16, SkySelectionBoxComponent as λ17, SkyToggleSwitchLabelComponent as λ18, SkyToggleSwitchComponent as λ19, SkyCharacterCounterInputDirective as λ2, SkyCheckboxComponent as λ3, SkyCheckboxLabelComponent as λ4, SkyCheckboxRequiredValidatorDirective as λ5, SkyFileAttachmentLabelComponent as λ6, SkyFileAttachmentComponent as λ7, SkyFileDropComponent as λ8, SkyFileItemComponent as λ9 };
|
|
2691
|
+
//# sourceMappingURL=skyux-forms.mjs.map
|