@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-attachment-click.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/forms/src/lib/modules/file-attachment/types/file-attachment-click.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyFileItem } from '../file-item';\n\nexport interface SkyFileAttachmentClick {\n /**\n * Specifies the file that was clicked.\n */\n file: SkyFileItem;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-drop-change.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/forms/src/lib/modules/file-attachment/types/file-drop-change.ts"],"names":[],"mappings":"","sourcesContent":["import { SkyFileItem } from '../file-item';\n\nexport interface SkyFileDropChange {\n /**\n * Specifies an array of files that were added or removed.\n */\n files: Array<SkyFileItem>;\n /**\n * Specifies an array of files that were rejected.\n */\n rejectedFiles: Array<SkyFileItem>;\n}\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export class SkyInputBoxAdapterService {
|
|
7
|
-
focusControl(elRef) {
|
|
8
|
-
const control = elRef.nativeElement.querySelector('.sky-form-control');
|
|
9
|
-
/* istanbul ignore else */
|
|
10
|
-
if (control) {
|
|
11
|
-
control.focus();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Returns the inline help element.
|
|
16
|
-
*/
|
|
17
|
-
getInlineHelpElement(elRef) {
|
|
18
|
-
return elRef.nativeElement.querySelector('.sky-control-help');
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns true if the provided element contains the focused element.
|
|
22
|
-
*/
|
|
23
|
-
isFocusInElement(el) {
|
|
24
|
-
if (el) {
|
|
25
|
-
return (el === document.activeElement || el.contains(document.activeElement));
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
SkyInputBoxAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
31
|
-
SkyInputBoxAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxAdapterService });
|
|
32
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxAdapterService, decorators: [{
|
|
33
|
-
type: Injectable
|
|
34
|
-
}] });
|
|
35
|
-
//# sourceMappingURL=input-box-adapter.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-box-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/input-box/input-box-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;;AAEvD;;GAEG;AAEH,MAAM,OAAO,yBAAyB;IAC7B,YAAY,CAAC,KAAiB;QACnC,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;QACvE,0BAA0B;QAC1B,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,KAAK,EAAE,CAAC;SACjB;IACH,CAAC;IAED;;OAEG;IACI,oBAAoB,CAAC,KAAiB;QAC3C,OAAO,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,EAAe;QACrC,IAAI,EAAE,EAAE;YACN,OAAO,CACL,EAAE,KAAK,QAAQ,CAAC,aAAa,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,CACrE,CAAC;SACH;QACD,OAAO,KAAK,CAAC;IACf,CAAC;;uHA1BU,yBAAyB;2HAAzB,yBAAyB;4FAAzB,yBAAyB;kBADrC,UAAU","sourcesContent":["import { ElementRef, Injectable } from '@angular/core';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyInputBoxAdapterService {\n public focusControl(elRef: ElementRef): void {\n const control = elRef.nativeElement.querySelector('.sky-form-control');\n /* istanbul ignore else */\n if (control) {\n control.focus();\n }\n }\n\n /**\n * Returns the inline help element.\n */\n public getInlineHelpElement(elRef: ElementRef): HTMLElement {\n return elRef.nativeElement.querySelector('.sky-control-help');\n }\n\n /**\n * Returns true if the provided element contains the focused element.\n */\n public isFocusInElement(el: HTMLElement): boolean {\n if (el) {\n return (\n el === document.activeElement || el.contains(document.activeElement)\n );\n }\n return false;\n }\n}\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export class SkyInputBoxHostService {
|
|
7
|
-
init(host) {
|
|
8
|
-
this.host = host;
|
|
9
|
-
}
|
|
10
|
-
populate(args) {
|
|
11
|
-
this.host.populate(args);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
SkyInputBoxHostService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxHostService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
15
|
-
SkyInputBoxHostService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxHostService });
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxHostService, decorators: [{
|
|
17
|
-
type: Injectable
|
|
18
|
-
}] });
|
|
19
|
-
//# sourceMappingURL=input-box-host.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-box-host.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/input-box/input-box-host.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;AAK3C;;GAEG;AAEH,MAAM,OAAO,sBAAsB;IAG1B,IAAI,CAAC,IAA0B;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,QAAQ,CAAC,IAA6B;QAC3C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;;oHATU,sBAAsB;wHAAtB,sBAAsB;4FAAtB,sBAAsB;kBADlC,UAAU","sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { SkyInputBoxPopulateArgs } from './input-box-populate-args';\nimport { SkyInputBoxComponent } from './input-box.component';\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyInputBoxHostService {\n private host: SkyInputBoxComponent;\n\n public init(host: SkyInputBoxComponent): void {\n this.host = host;\n }\n\n public populate(args: SkyInputBoxPopulateArgs): void {\n this.host.populate(args);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-box-populate-args.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/input-box/input-box-populate-args.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateRef } from '@angular/core';\n\n/**\n * @internal\n */\nexport interface SkyInputBoxPopulateArgs {\n inputTemplate: TemplateRef<any>;\n\n buttonsTemplate?: TemplateRef<any>;\n\n buttonsLeftTemplate?: TemplateRef<any>;\n\n buttonsInsetTemplate?: TemplateRef<any>;\n\n iconsInsetTemplate?: TemplateRef<any>;\n\n iconsInsetLeftTemplate?: TemplateRef<any>;\n}\n"]}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, ContentChild, ElementRef, Input, ViewEncapsulation, } from '@angular/core';
|
|
2
|
-
import { FormControlDirective, FormControlName, NgModel, } from '@angular/forms';
|
|
3
|
-
import { SkyInputBoxAdapterService } from './input-box-adapter.service';
|
|
4
|
-
import { SkyInputBoxHostService } from './input-box-host.service';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "./input-box-host.service";
|
|
7
|
-
import * as i2 from "./input-box-adapter.service";
|
|
8
|
-
import * as i3 from "@skyux/theme";
|
|
9
|
-
import * as i4 from "@angular/common";
|
|
10
|
-
/**
|
|
11
|
-
* Creates a wrapper to provide styling for `input` and `label` elements. To render the
|
|
12
|
-
* component correctly, include the `sky-form-control` CSS class on the `input` element
|
|
13
|
-
* and the `sky-control-label` CSS class on the `label` element. To display a help button
|
|
14
|
-
* beside the label, include a help button element in the `sky-input-box` element and a
|
|
15
|
-
* `sky-control-help` CSS class on that element.
|
|
16
|
-
*/
|
|
17
|
-
export class SkyInputBoxComponent {
|
|
18
|
-
constructor(changeRef, inputBoxHostSvc, adapterService, elementRef) {
|
|
19
|
-
this.changeRef = changeRef;
|
|
20
|
-
this.inputBoxHostSvc = inputBoxHostSvc;
|
|
21
|
-
this.adapterService = adapterService;
|
|
22
|
-
this.elementRef = elementRef;
|
|
23
|
-
}
|
|
24
|
-
get hasErrorsComputed() {
|
|
25
|
-
if (this.hasErrors === undefined) {
|
|
26
|
-
return (this.controlHasErrors(this.formControl) ||
|
|
27
|
-
this.controlHasErrors(this.formControlByName) ||
|
|
28
|
-
this.controlHasErrors(this.ngModel));
|
|
29
|
-
}
|
|
30
|
-
return this.hasErrors;
|
|
31
|
-
}
|
|
32
|
-
ngOnInit() {
|
|
33
|
-
this.inputBoxHostSvc.init(this);
|
|
34
|
-
}
|
|
35
|
-
formControlFocusIn() {
|
|
36
|
-
const inlineHelpEl = this.adapterService.getInlineHelpElement(this.elementRef);
|
|
37
|
-
if (!this.adapterService.isFocusInElement(inlineHelpEl)) {
|
|
38
|
-
this.updateHasFocus(true);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
formControlFocusOut() {
|
|
42
|
-
this.updateHasFocus(false);
|
|
43
|
-
}
|
|
44
|
-
onInsetIconClick() {
|
|
45
|
-
if (!this.disabled) {
|
|
46
|
-
this.adapterService.focusControl(this.elementRef);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
populate(args) {
|
|
50
|
-
this.hostInputTemplate = args.inputTemplate;
|
|
51
|
-
this.hostButtonsTemplate = args.buttonsTemplate;
|
|
52
|
-
this.hostButtonsLeftTemplate = args.buttonsLeftTemplate;
|
|
53
|
-
this.hostButtonsInsetTemplate = args.buttonsInsetTemplate;
|
|
54
|
-
this.hostIconsInsetTemplate = args.iconsInsetTemplate;
|
|
55
|
-
this.hostIconsInsetLeftTemplate = args.iconsInsetLeftTemplate;
|
|
56
|
-
}
|
|
57
|
-
updateHasFocus(hasFocus) {
|
|
58
|
-
// Some components manipulate the focus of elements inside an input box programmatically,
|
|
59
|
-
// which can cause an `ExpressionChangedAfterItHasBeenCheckedError` if focus was set after
|
|
60
|
-
// initial change detection. Using `setTimeout()` here fixes it.
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
this.formControlHasFocus = hasFocus;
|
|
63
|
-
this.changeRef.markForCheck();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
controlHasErrors(control) {
|
|
67
|
-
return control && control.invalid && (control.dirty || control.touched);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
SkyInputBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.SkyInputBoxHostService }, { token: i2.SkyInputBoxAdapterService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
71
|
-
SkyInputBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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}.sky-theme-modern .sky-input-box .sky-form-group textarea.sky-form-control{margin-top:0;padding-top:5px}@-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: i3.λ3, selector: "[skyThemeIf]", inputs: ["skyThemeIf"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxComponent, decorators: [{
|
|
73
|
-
type: Component,
|
|
74
|
-
args: [{
|
|
75
|
-
selector: 'sky-input-box',
|
|
76
|
-
templateUrl: './input-box.component.html',
|
|
77
|
-
styleUrls: ['./input-box.component.scss'],
|
|
78
|
-
providers: [SkyInputBoxAdapterService, SkyInputBoxHostService],
|
|
79
|
-
// Note that change detection is not set to OnPush; default change detection allows the
|
|
80
|
-
// invalid CSS class to be added when the content control's invalid/dirty state changes.
|
|
81
|
-
encapsulation: ViewEncapsulation.None,
|
|
82
|
-
}]
|
|
83
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.SkyInputBoxHostService }, { type: i2.SkyInputBoxAdapterService }, { type: i0.ElementRef }]; }, propDecorators: { hasErrors: [{
|
|
84
|
-
type: Input
|
|
85
|
-
}], disabled: [{
|
|
86
|
-
type: Input
|
|
87
|
-
}], formControl: [{
|
|
88
|
-
type: ContentChild,
|
|
89
|
-
args: [FormControlDirective]
|
|
90
|
-
}], formControlByName: [{
|
|
91
|
-
type: ContentChild,
|
|
92
|
-
args: [FormControlName]
|
|
93
|
-
}], ngModel: [{
|
|
94
|
-
type: ContentChild,
|
|
95
|
-
args: [NgModel]
|
|
96
|
-
}] } });
|
|
97
|
-
//# sourceMappingURL=input-box.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-box.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/input-box/input-box.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/input-box/input-box.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,UAAU,EACV,KAAK,EAGL,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,oBAAoB,EACpB,eAAe,EACf,OAAO,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;;;;;;AAGlE;;;;;;GAMG;AAUH,MAAM,OAAO,oBAAoB;IAsD/B,YACU,SAA4B,EAC5B,eAAuC,EACvC,cAAyC,EACzC,UAAsB;QAHtB,cAAS,GAAT,SAAS,CAAmB;QAC5B,oBAAe,GAAf,eAAe,CAAwB;QACvC,mBAAc,GAAd,cAAc,CAA2B;QACzC,eAAU,GAAV,UAAU,CAAY;IAC7B,CAAC;IAjBJ,IAAW,iBAAiB;QAC1B,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE;YAChC,OAAO,CACL,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC;gBACvC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,iBAAiB,CAAC;gBAC7C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CACpC,CAAC;SACH;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IASM,QAAQ;QACb,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAEM,kBAAkB;QACvB,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,o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AE,sBAAsB,CAAC,mEAsChD,oBAAoB,oFAGpB,eAAe,0EAGf,OAAO,gDC5EvB,o3JAsIA;4FDjGa,oBAAoB;kBAThC,SAAS;mBAAC;oBACT,QAAQ,EAAE,eAAe;oBACzB,WAAW,EAAE,4BAA4B;oBACzC,SAAS,EAAE,CAAC,4BAA4B,CAAC;oBACzC,SAAS,EAAE,CAAC,yBAAyB,EAAE,sBAAsB,CAAC;oBAC9D,uFAAuF;oBACvF,wFAAwF;oBACxF,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;8MAQQ,SAAS;sBADf,KAAK;gBAWC,QAAQ;sBADd,KAAK;gBAkBC,WAAW;sBADjB,YAAY;uBAAC,oBAAoB;gBAI3B,iBAAiB;sBADvB,YAAY;uBAAC,eAAe;gBAItB,OAAO;sBADb,YAAY;uBAAC,OAAO","sourcesContent":["import {\n ChangeDetectorRef,\n Component,\n ContentChild,\n ElementRef,\n Input,\n OnInit,\n TemplateRef,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n AbstractControlDirective,\n FormControlDirective,\n FormControlName,\n NgModel,\n} from '@angular/forms';\n\nimport { SkyInputBoxAdapterService } from './input-box-adapter.service';\nimport { SkyInputBoxHostService } from './input-box-host.service';\nimport { SkyInputBoxPopulateArgs } from './input-box-populate-args';\n\n/**\n * Creates a wrapper to provide styling for `input` and `label` elements. To render the\n * component correctly, include the `sky-form-control` CSS class on the `input` element\n * and the `sky-control-label` CSS class on the `label` element. To display a help button\n * beside the label, include a help button element in the `sky-input-box` element and a\n * `sky-control-help` CSS class on that element.\n */\n@Component({\n selector: 'sky-input-box',\n templateUrl: './input-box.component.html',\n styleUrls: ['./input-box.component.scss'],\n providers: [SkyInputBoxAdapterService, SkyInputBoxHostService],\n // Note that change detection is not set to OnPush; default change detection allows the\n // invalid CSS class to be added when the content control's invalid/dirty state changes.\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkyInputBoxComponent implements OnInit {\n /**\n * Indicates whether to visually highlight the input box in an error state. If `hasErrors` is `false`, the input box still\n * displays in an error state when either the `ngModel` or the Angular `FormControl` contain an error.\n * @default false\n */\n @Input()\n public hasErrors: boolean;\n\n /**\n * Indicates whether to visually highlight the input box as disabled. To disable the input box's\n * `input` element, use the HTML `disabled` attribute or the Angular `FormControl.disabled`\n * property. You must set both properties to disable an `input` element and visually indicate\n * the disabled state on the input box.\n * @default false\n */\n @Input()\n public disabled: boolean;\n\n public hostInputTemplate: TemplateRef<any>;\n\n public hostButtonsTemplate: TemplateRef<any>;\n\n public hostButtonsInsetTemplate: TemplateRef<any>;\n\n public hostButtonsLeftTemplate: TemplateRef<any>;\n\n public formControlHasFocus: boolean;\n\n public hostIconsInsetTemplate: TemplateRef<any>;\n\n public hostIconsInsetLeftTemplate: TemplateRef<any>;\n\n @ContentChild(FormControlDirective)\n public formControl: FormControlDirective;\n\n @ContentChild(FormControlName)\n public formControlByName: FormControlName;\n\n @ContentChild(NgModel)\n public ngModel: NgModel;\n\n public get hasErrorsComputed(): boolean {\n if (this.hasErrors === undefined) {\n return (\n this.controlHasErrors(this.formControl) ||\n this.controlHasErrors(this.formControlByName) ||\n this.controlHasErrors(this.ngModel)\n );\n }\n\n return this.hasErrors;\n }\n\n constructor(\n private changeRef: ChangeDetectorRef,\n private inputBoxHostSvc: SkyInputBoxHostService,\n private adapterService: SkyInputBoxAdapterService,\n private elementRef: ElementRef\n ) {}\n\n public ngOnInit(): void {\n this.inputBoxHostSvc.init(this);\n }\n\n public formControlFocusIn(): void {\n const inlineHelpEl = this.adapterService.getInlineHelpElement(\n this.elementRef\n );\n if (!this.adapterService.isFocusInElement(inlineHelpEl)) {\n this.updateHasFocus(true);\n }\n }\n\n public formControlFocusOut(): void {\n this.updateHasFocus(false);\n }\n\n public onInsetIconClick(): void {\n if (!this.disabled) {\n this.adapterService.focusControl(this.elementRef);\n }\n }\n\n public populate(args: SkyInputBoxPopulateArgs): void {\n this.hostInputTemplate = args.inputTemplate;\n this.hostButtonsTemplate = args.buttonsTemplate;\n this.hostButtonsLeftTemplate = args.buttonsLeftTemplate;\n this.hostButtonsInsetTemplate = args.buttonsInsetTemplate;\n this.hostIconsInsetTemplate = args.iconsInsetTemplate;\n this.hostIconsInsetLeftTemplate = args.iconsInsetLeftTemplate;\n }\n\n private updateHasFocus(hasFocus: boolean): void {\n // Some components manipulate the focus of elements inside an input box programmatically,\n // which can cause an `ExpressionChangedAfterItHasBeenCheckedError` if focus was set after\n // initial change detection. Using `setTimeout()` here fixes it.\n setTimeout(() => {\n this.formControlHasFocus = hasFocus;\n this.changeRef.markForCheck();\n });\n }\n\n private controlHasErrors(control: AbstractControlDirective) {\n return control && control.invalid && (control.dirty || control.touched);\n }\n}\n","<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"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { NgModule } from '@angular/core';
|
|
3
|
-
import { SkyThemeModule } from '@skyux/theme';
|
|
4
|
-
import { SkyInputBoxComponent } from './input-box.component';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export class SkyInputBoxModule {
|
|
7
|
-
}
|
|
8
|
-
SkyInputBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
9
|
-
SkyInputBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, declarations: [SkyInputBoxComponent], imports: [CommonModule, SkyThemeModule], exports: [SkyInputBoxComponent] });
|
|
10
|
-
SkyInputBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, imports: [[CommonModule, SkyThemeModule]] });
|
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInputBoxModule, decorators: [{
|
|
12
|
-
type: NgModule,
|
|
13
|
-
args: [{
|
|
14
|
-
declarations: [SkyInputBoxComponent],
|
|
15
|
-
imports: [CommonModule, SkyThemeModule],
|
|
16
|
-
exports: [SkyInputBoxComponent],
|
|
17
|
-
}]
|
|
18
|
-
}] });
|
|
19
|
-
//# sourceMappingURL=input-box.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input-box.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/input-box/input-box.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;;AAO7D,MAAM,OAAO,iBAAiB;;+GAAjB,iBAAiB;gHAAjB,iBAAiB,iBAJb,oBAAoB,aACzB,YAAY,EAAE,cAAc,aAC5B,oBAAoB;gHAEnB,iBAAiB,YAHnB,CAAC,YAAY,EAAE,cAAc,CAAC;4FAG5B,iBAAiB;kBAL7B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,oBAAoB,CAAC;oBACpC,OAAO,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;oBACvC,OAAO,EAAE,CAAC,oBAAoB,CAAC;iBAChC","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { SkyThemeModule } from '@skyux/theme';\n\nimport { SkyInputBoxComponent } from './input-box.component';\n\n@NgModule({\n declarations: [SkyInputBoxComponent],\n imports: [CommonModule, SkyThemeModule],\n exports: [SkyInputBoxComponent],\n})\nexport class SkyInputBoxModule {}\n"]}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, Component, ContentChildren, Input, Optional, QueryList, Self, } from '@angular/core';
|
|
2
|
-
import { NgControl } from '@angular/forms';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { takeUntil } from 'rxjs/operators';
|
|
5
|
-
import { SkyFormsUtility } from '../shared/forms-utility';
|
|
6
|
-
import { SkyRadioComponent } from './radio.component';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "@angular/forms";
|
|
9
|
-
let nextUniqueId = 0;
|
|
10
|
-
/**
|
|
11
|
-
* Organizes radio buttons into a group. It is required for radio
|
|
12
|
-
* buttons on Angular reactive forms, and we recommend using it with all radio buttons.
|
|
13
|
-
* On Angular forms, the component manages the selected values and keeps the forms up-to-date.
|
|
14
|
-
* When users select a radio button, its value is driven through an `ngModel` attribute that you specify on the `sky-radio-group` element.
|
|
15
|
-
*/
|
|
16
|
-
export class SkyRadioGroupComponent {
|
|
17
|
-
constructor(changeDetector, ngControl) {
|
|
18
|
-
this.changeDetector = changeDetector;
|
|
19
|
-
this.ngControl = ngControl;
|
|
20
|
-
/**
|
|
21
|
-
* Indicates whether the input is required for form validation.
|
|
22
|
-
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
23
|
-
* attributes to the input element so that forms display an invalid state until the input element
|
|
24
|
-
* is complete.
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
this.required = false;
|
|
28
|
-
this.ngUnsubscribe = new Subject();
|
|
29
|
-
this._disabled = false;
|
|
30
|
-
this._name = `sky-radio-group-${nextUniqueId++}`;
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
32
|
-
this.onChange = () => { };
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
34
|
-
this.onTouched = () => { };
|
|
35
|
-
if (this.ngControl) {
|
|
36
|
-
this.ngControl.valueAccessor = this;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Indicates whether to disable the input.
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
set disabled(value) {
|
|
44
|
-
const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);
|
|
45
|
-
if (this._disabled !== newDisabledState) {
|
|
46
|
-
this._disabled = newDisabledState;
|
|
47
|
-
this.updateRadioButtonDisabled();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
get disabled() {
|
|
51
|
-
return this._disabled;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Specifies a name for the collection of radio buttons that the component groups together.
|
|
55
|
-
* This property overwrites the deprecated `name` property on individual `sky-radio` elements,
|
|
56
|
-
* and it is required unless the `name` property is set on individual `sky-radio` elements.
|
|
57
|
-
* @required
|
|
58
|
-
*/
|
|
59
|
-
set name(value) {
|
|
60
|
-
this._name = value;
|
|
61
|
-
this.updateRadioButtonNames();
|
|
62
|
-
}
|
|
63
|
-
get name() {
|
|
64
|
-
return this._name;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Specifies the value of the radio button to select by default when the group loads.
|
|
68
|
-
* The value corresponds to the `value` property of an individual `sky-radio` element within the
|
|
69
|
-
* group.
|
|
70
|
-
*/
|
|
71
|
-
set value(value) {
|
|
72
|
-
const isNewValue = value !== this._value;
|
|
73
|
-
/* istanbul ignore else */
|
|
74
|
-
if (isNewValue) {
|
|
75
|
-
this._value = value;
|
|
76
|
-
this.onChange(this._value);
|
|
77
|
-
this.updateCheckedRadioFromValue();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
get value() {
|
|
81
|
-
return this._value;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Specifies an index for all the radio buttons in the group. If the index is not defined,
|
|
85
|
-
* the indices for individual radio buttons are set to their positions on load.
|
|
86
|
-
* This property supports accessibility by placing focus on the currently selected radio
|
|
87
|
-
* button. If no radio button is selected, it places focus on the first or last button
|
|
88
|
-
* depending on how users navigate to the radio button group.
|
|
89
|
-
*/
|
|
90
|
-
set tabIndex(value) {
|
|
91
|
-
if (this._tabIndex !== value) {
|
|
92
|
-
this._tabIndex = value;
|
|
93
|
-
this.updateRadioButtonTabIndexes();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
get tabIndex() {
|
|
97
|
-
return this._tabIndex;
|
|
98
|
-
}
|
|
99
|
-
ngAfterContentInit() {
|
|
100
|
-
// Let child radio components render before updating.
|
|
101
|
-
setTimeout(() => {
|
|
102
|
-
this.resetRadioButtons();
|
|
103
|
-
});
|
|
104
|
-
// Watch for radio selections.
|
|
105
|
-
this.watchForSelections();
|
|
106
|
-
this.radios.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
107
|
-
// Wait for child radio components to finish any rendering updates.
|
|
108
|
-
setTimeout(() => {
|
|
109
|
-
this.resetRadioButtons();
|
|
110
|
-
});
|
|
111
|
-
// Subscribe to the new radio buttons
|
|
112
|
-
this.watchForSelections();
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
ngAfterViewInit() {
|
|
116
|
-
if (this.ngControl) {
|
|
117
|
-
// Backwards compatibility support for anyone still using Validators.Required.
|
|
118
|
-
this.required =
|
|
119
|
-
this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);
|
|
120
|
-
// Avoid an ExpressionChangedAfterItHasBeenCheckedError.
|
|
121
|
-
this.changeDetector.detectChanges();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
watchForSelections() {
|
|
125
|
-
this.radios.forEach((radio) => {
|
|
126
|
-
radio.change
|
|
127
|
-
.pipe(takeUntil(this.ngUnsubscribe))
|
|
128
|
-
.subscribe((change) => {
|
|
129
|
-
this.onTouched();
|
|
130
|
-
this.writeValue(change.value);
|
|
131
|
-
});
|
|
132
|
-
radio.blur.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {
|
|
133
|
-
this.onTouched();
|
|
134
|
-
this.changeDetector.markForCheck();
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
ngOnDestroy() {
|
|
139
|
-
this.ngUnsubscribe.next();
|
|
140
|
-
this.ngUnsubscribe.complete();
|
|
141
|
-
}
|
|
142
|
-
writeValue(value) {
|
|
143
|
-
this.value = value;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* @internal
|
|
147
|
-
* Indicates whether to disable the control. Implemented as a part of ControlValueAccessor.
|
|
148
|
-
*/
|
|
149
|
-
setDisabledState(isDisabled) {
|
|
150
|
-
this.disabled = isDisabled;
|
|
151
|
-
}
|
|
152
|
-
registerOnChange(fn) {
|
|
153
|
-
this.onChange = fn;
|
|
154
|
-
}
|
|
155
|
-
registerOnTouched(fn) {
|
|
156
|
-
this.onTouched = fn;
|
|
157
|
-
}
|
|
158
|
-
updateRadioButtonDisabled() {
|
|
159
|
-
if (this.radios) {
|
|
160
|
-
this.radios.forEach((radio) => {
|
|
161
|
-
radio.disabled = this.disabled;
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
updateRadioButtonNames() {
|
|
166
|
-
if (this.radios) {
|
|
167
|
-
this.radios.forEach((radio) => {
|
|
168
|
-
radio.name = this.name;
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
updateRadioButtonTabIndexes() {
|
|
173
|
-
if (this.radios) {
|
|
174
|
-
this.radios.forEach((radio) => {
|
|
175
|
-
radio.groupTabIndex = this.tabIndex;
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
updateCheckedRadioFromValue() {
|
|
180
|
-
if (!this.radios) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
this.radios.forEach((radio) => {
|
|
184
|
-
radio.checked = this._value === radio.value;
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
resetRadioButtons() {
|
|
188
|
-
this.updateCheckedRadioFromValue();
|
|
189
|
-
this.updateRadioButtonNames();
|
|
190
|
-
this.updateRadioButtonTabIndexes();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
SkyRadioGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioGroupComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
194
|
-
SkyRadioGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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" });
|
|
195
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioGroupComponent, decorators: [{
|
|
196
|
-
type: Component,
|
|
197
|
-
args: [{
|
|
198
|
-
selector: 'sky-radio-group',
|
|
199
|
-
templateUrl: './radio-group.component.html',
|
|
200
|
-
}]
|
|
201
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.NgControl, decorators: [{
|
|
202
|
-
type: Self
|
|
203
|
-
}, {
|
|
204
|
-
type: Optional
|
|
205
|
-
}] }]; }, propDecorators: { ariaLabelledBy: [{
|
|
206
|
-
type: Input
|
|
207
|
-
}], ariaLabel: [{
|
|
208
|
-
type: Input
|
|
209
|
-
}], disabled: [{
|
|
210
|
-
type: Input
|
|
211
|
-
}], name: [{
|
|
212
|
-
type: Input
|
|
213
|
-
}], required: [{
|
|
214
|
-
type: Input
|
|
215
|
-
}], value: [{
|
|
216
|
-
type: Input
|
|
217
|
-
}], tabIndex: [{
|
|
218
|
-
type: Input
|
|
219
|
-
}], radios: [{
|
|
220
|
-
type: ContentChildren,
|
|
221
|
-
args: [SkyRadioComponent, { descendants: true }]
|
|
222
|
-
}] } });
|
|
223
|
-
//# sourceMappingURL=radio-group.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/radio/radio-group.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/radio/radio-group.component.html"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,KAAK,EAEL,QAAQ,EACR,SAAS,EACT,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;;;AAGtD,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;GAKG;AAKH,MAAM,OAAO,sBAAsB;IAkHjC,YACU,cAAiC,EACb,SAA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AAiB,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE","sourcesContent":["import {\n AfterContentInit,\n AfterViewInit,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n Input,\n OnDestroy,\n Optional,\n QueryList,\n Self,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { SkyRadioComponent } from './radio.component';\nimport { SkyRadioChange } from './types/radio-change';\n\nlet nextUniqueId = 0;\n\n/**\n * Organizes radio buttons into a group. It is required for radio\n * buttons on Angular reactive forms, and we recommend using it with all radio buttons.\n * On Angular forms, the component manages the selected values and keeps the forms up-to-date.\n * When users select a radio button, its value is driven through an `ngModel` attribute that you specify on the `sky-radio-group` element.\n */\n@Component({\n selector: 'sky-radio-group',\n templateUrl: './radio-group.component.html',\n})\nexport class SkyRadioGroupComponent\n implements AfterContentInit, AfterViewInit, OnDestroy\n{\n /**\n * Specifies the HTML element ID (without the leading `#`) of the element that labels\n * the radio button group. This sets the radio button group's `aria-labelledby` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * If the radio button group does not include a visible label, use `ariaLabel` instead.\n */\n @Input()\n public ariaLabelledBy: string;\n\n /**\n * Specifies an ARIA label for the radio button group. This sets the\n * radio button group's `aria-label` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * If the radio button group includes a visible label, use `ariaLabelledBy` instead.\n */\n @Input()\n public ariaLabel: string;\n\n /**\n * Indicates whether to disable the input.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const newDisabledState = SkyFormsUtility.coerceBooleanProperty(value);\n if (this._disabled !== newDisabledState) {\n this._disabled = newDisabledState;\n this.updateRadioButtonDisabled();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Specifies a name for the collection of radio buttons that the component groups together.\n * This property overwrites the deprecated `name` property on individual `sky-radio` elements,\n * and it is required unless the `name` property is set on individual `sky-radio` elements.\n * @required\n */\n @Input()\n public set name(value: string) {\n this._name = value;\n this.updateRadioButtonNames();\n }\n public get name(): string {\n return this._name;\n }\n\n /**\n * Indicates whether the input is required for form validation.\n * When you set this property to `true`, the component adds `aria-required` and `required`\n * attributes to the input element so that forms display an invalid state until the input element\n * is complete.\n * @default false\n */\n @Input()\n public required = false;\n\n /**\n * Specifies the value of the radio button to select by default when the group loads.\n * The value corresponds to the `value` property of an individual `sky-radio` element within the\n * group.\n */\n @Input()\n public set value(value: any) {\n const isNewValue = value !== this._value;\n\n /* istanbul ignore else */\n if (isNewValue) {\n this._value = value;\n this.onChange(this._value);\n this.updateCheckedRadioFromValue();\n }\n }\n public get value(): any {\n return this._value;\n }\n\n /**\n * Specifies an index for all the radio buttons in the group. If the index is not defined,\n * the indices for individual radio buttons are set to their positions on load.\n * This property supports accessibility by placing focus on the currently selected radio\n * button. If no radio button is selected, it places focus on the first or last button\n * depending on how users navigate to the radio button group.\n */\n @Input()\n public set tabIndex(value: number) {\n if (this._tabIndex !== value) {\n this._tabIndex = value;\n this.updateRadioButtonTabIndexes();\n }\n }\n public get tabIndex(): number {\n return this._tabIndex;\n }\n\n @ContentChildren(SkyRadioComponent, { descendants: true })\n private radios: QueryList<SkyRadioComponent>;\n\n private ngUnsubscribe = new Subject();\n\n private _disabled = false;\n\n private _name = `sky-radio-group-${nextUniqueId++}`;\n\n private _tabIndex: number;\n\n private _value: any;\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n @Self() @Optional() private ngControl: NgControl\n ) {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n public ngAfterContentInit(): void {\n // Let child radio components render before updating.\n setTimeout(() => {\n this.resetRadioButtons();\n });\n\n // Watch for radio selections.\n this.watchForSelections();\n\n this.radios.changes.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n // Wait for child radio components to finish any rendering updates.\n setTimeout(() => {\n this.resetRadioButtons();\n });\n\n // Subscribe to the new radio buttons\n this.watchForSelections();\n });\n }\n\n public ngAfterViewInit(): void {\n if (this.ngControl) {\n // Backwards compatibility support for anyone still using Validators.Required.\n this.required =\n this.required || SkyFormsUtility.hasRequiredValidation(this.ngControl);\n\n // Avoid an ExpressionChangedAfterItHasBeenCheckedError.\n this.changeDetector.detectChanges();\n }\n }\n\n public watchForSelections() {\n this.radios.forEach((radio) => {\n radio.change\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((change: SkyRadioChange) => {\n this.onTouched();\n this.writeValue(change.value);\n });\n radio.blur.pipe(takeUntil(this.ngUnsubscribe)).subscribe(() => {\n this.onTouched();\n this.changeDetector.markForCheck();\n });\n });\n }\n\n public ngOnDestroy() {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public writeValue(value: any): void {\n this.value = value;\n }\n\n /**\n * @internal\n * Indicates whether to disable the control. Implemented as a part of ControlValueAccessor.\n */\n public setDisabledState(isDisabled: boolean) {\n this.disabled = isDisabled;\n }\n\n public registerOnChange(fn: (value: any) => void): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange: (value: any) => void = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched: () => any = () => {};\n\n private updateRadioButtonDisabled(): void {\n if (this.radios) {\n this.radios.forEach((radio) => {\n radio.disabled = this.disabled;\n });\n }\n }\n\n private updateRadioButtonNames(): void {\n if (this.radios) {\n this.radios.forEach((radio) => {\n radio.name = this.name;\n });\n }\n }\n\n private updateRadioButtonTabIndexes(): void {\n if (this.radios) {\n this.radios.forEach((radio) => {\n radio.groupTabIndex = this.tabIndex;\n });\n }\n }\n\n private updateCheckedRadioFromValue(): void {\n if (!this.radios) {\n return;\n }\n\n this.radios.forEach((radio) => {\n radio.checked = this._value === radio.value;\n });\n }\n\n private resetRadioButtons(): void {\n this.updateCheckedRadioFromValue();\n this.updateRadioButtonNames();\n this.updateRadioButtonTabIndexes();\n }\n}\n","<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"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Component, HostListener } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* Specifies a label for the radio button.
|
|
5
|
-
*/
|
|
6
|
-
export class SkyRadioLabelComponent {
|
|
7
|
-
// When clicking on a checkbox label, Angular registers two click events.
|
|
8
|
-
// This handler ignores all events except for those that deal
|
|
9
|
-
// with the checkbox input explicitly.
|
|
10
|
-
onClick(event) {
|
|
11
|
-
event.stopPropagation();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
SkyRadioLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
-
SkyRadioLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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" });
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyRadioLabelComponent, decorators: [{
|
|
17
|
-
type: Component,
|
|
18
|
-
args: [{
|
|
19
|
-
selector: 'sky-radio-label',
|
|
20
|
-
templateUrl: './radio-label.component.html',
|
|
21
|
-
}]
|
|
22
|
-
}], propDecorators: { onClick: [{
|
|
23
|
-
type: HostListener,
|
|
24
|
-
args: ['click', ['$event']]
|
|
25
|
-
}] } });
|
|
26
|
-
//# sourceMappingURL=radio-label.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio-label.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/radio/radio-label.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/radio/radio-label.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;;AAExD;;GAEG;AAKH,MAAM,OAAO,sBAAsB;IACjC,yEAAyE;IACzE,6DAA6D;IAC7D,sCAAsC;IAE/B,OAAO,CAAC,KAAiB;QAC9B,KAAK,CAAC,eAAe,EAAE,CAAC;IAC1B,CAAC;;oHAPU,sBAAsB;wGAAtB,sBAAsB,4GCTnC,2EAGA;4FDMa,sBAAsB;kBAJlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,WAAW,EAAE,8BAA8B;iBAC5C;8BAMQ,OAAO;sBADb,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import { Component, HostListener } from '@angular/core';\n\n/**\n * Specifies a label for the radio button.\n */\n@Component({\n selector: 'sky-radio-label',\n templateUrl: './radio-label.component.html',\n})\nexport class SkyRadioLabelComponent {\n // When clicking on a checkbox label, Angular registers two click events.\n // This handler ignores all events except for those that deal\n // with the checkbox input explicitly.\n @HostListener('click', ['$event'])\n public onClick(event: MouseEvent): void {\n event.stopPropagation();\n }\n}\n","<span class=\"sky-switch-label\">\n <ng-content></ng-content>\n</span>\n"]}
|