@skyux/forms 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/skyux-forms.umd.js +26 -23
- package/documentation.json +259 -599
- package/esm2015/lib/modules/character-counter/character-counter.directive.js +1 -0
- package/esm2015/lib/modules/character-counter/character-counter.directive.js.map +1 -1
- package/esm2015/lib/modules/checkbox/checkbox.component.js +3 -2
- package/esm2015/lib/modules/checkbox/checkbox.component.js.map +1 -1
- package/esm2015/lib/modules/file-attachment/file-attachment.component.js +3 -3
- package/esm2015/lib/modules/file-attachment/file-attachment.component.js.map +1 -1
- package/esm2015/lib/modules/file-attachment/file-drop.component.js +1 -2
- package/esm2015/lib/modules/file-attachment/file-drop.component.js.map +1 -1
- package/esm2015/lib/modules/file-attachment/file-item.component.js +3 -1
- package/esm2015/lib/modules/file-attachment/file-item.component.js.map +1 -1
- package/esm2015/lib/modules/file-attachment/file-item.service.js +2 -2
- package/esm2015/lib/modules/file-attachment/file-item.service.js.map +1 -1
- package/esm2015/lib/modules/file-attachment/file-size.pipe.js +4 -5
- package/esm2015/lib/modules/file-attachment/file-size.pipe.js.map +1 -1
- package/esm2015/lib/modules/radio/radio-group.component.js +3 -3
- package/esm2015/lib/modules/radio/radio-group.component.js.map +1 -1
- package/esm2015/lib/modules/radio/radio.component.js +3 -3
- package/esm2015/lib/modules/radio/radio.component.js.map +1 -1
- package/esm2015/lib/modules/shared/sky-forms-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-forms-resources.module.js.map +1 -1
- package/esm2015/lib/modules/toggle-switch/toggle-switch.component.js +2 -1
- package/esm2015/lib/modules/toggle-switch/toggle-switch.component.js.map +1 -1
- package/fesm2015/skyux-forms.js +26 -23
- package/fesm2015/skyux-forms.js.map +1 -1
- package/lib/modules/checkbox/checkbox.component.d.ts +1 -1
- package/lib/modules/file-attachment/file-attachment.component.d.ts +1 -1
- package/lib/modules/radio/radio-group.component.d.ts +1 -1
- package/lib/modules/shared/sky-forms-resources.module.d.ts +1 -1
- package/package.json +15 -12
|
@@ -1 +1 @@
|
|
|
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,SAAoB;QADxC,mBAAc,GAAd,cAAc,CAAmB;QACb,cAAS,GAAT,SAAS,CAAW;QA/DlD;;;;;;WAMG;QAEI,aAAQ,GAAG,KAAK,CAAC;QA2ChB,kBAAa,GAAG,IAAI,OAAO,EAAE,CAAC;QAE9B,cAAS,GAAG,KAAK,CAAC;QAElB,UAAK,GAAG,mBAAmB,YAAY,EAAE,EAAE,CAAC;QAsFpD,0BAA0B;QAClB,aAAQ,GAAyB,GAAG,EAAE,GAAE,CAAC,CAAC;QAClD,0BAA0B;QAClB,cAAS,GAAc,GAAG,EAAE,GAAE,CAAC,CAAC;QA/EtC,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC;SACrC;IACH,CAAC;IApGD;;;OAGG;IACH,IACW,QAA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AO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,KAAK,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,2BAA2B,EAAE,CAAC;QACnC,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC9B,IAAI,CAAC,2BAA2B,EAAE,CAAC;IACrC,CAAC;;oHA7OU,sBAAsB;wGAAtB,sBAAsB,oPAqGhB,iBAAiB,gDCvIpC,mRAUA;4FDwBa,sBAAsB;kBAJlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,WAAW,EAAE,8BAA8B;iBAC5C;;0BAqHI,IAAI;;0BAAI,QAAQ;4CA1GZ,cAAc;sBADpB,KAAK;gBAUC,SAAS;sBADf,KAAK;gBAQK,QAAQ;sBADlB,KAAK;gBAoBK,IAAI;sBADd,KAAK;gBAiBC,QAAQ;sBADd,KAAK;gBASK,KAAK;sBADf,KAAK;gBAuBK,QAAQ;sBADlB,KAAK;gBAYE,MAAM;sBADb,eAAe;uBAAC,iBAAiB,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 /* istanbul ignore next */\n private onChange: (value: any) => void = () => {};\n /* istanbul ignore next */\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
|
+
{"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,gBA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S;mBAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,WAAW,EAAE,8BAA8B;iBAC5C;;0BAqHI,IAAI;;0BAAI,QAAQ;4CA1GZ,cAAc;sBADpB,KAAK;gBAUC,SAAS;sBADf,KAAK;gBAQK,QAAQ;sBADlB,KAAK;gBAoBK,IAAI;sBADd,KAAK;gBAiBC,QAAQ;sBADd,KAAK;gBASK,KAAK;sBADf,KAAK;gBAuBK,QAAQ;sBADlB,KAAK;gBAYE,MAAM;sBADb,eAAe;uBAAC,iBAAiB,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"]}
|
|
@@ -42,11 +42,11 @@ export class SkyRadioComponent {
|
|
|
42
42
|
this._checkedChange = new BehaviorSubject(this._checked);
|
|
43
43
|
this._disabled = false;
|
|
44
44
|
this._disabledChange = new BehaviorSubject(this._disabled);
|
|
45
|
-
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
46
46
|
this.removeUniqueSelectionListener = () => { };
|
|
47
|
-
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
48
48
|
this.onChangeCallback = (value) => { };
|
|
49
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
50
50
|
this.onTouchedCallback = () => { };
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/radio/radio.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/radio/radio.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS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AAC;SACnC;IACH,CAAC;IAEM,kBAAkB,CAAC,KAAY;QACpC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;;+GAzQU,iBAAiB;mGAAjB,iBAAiB,yUAHjB,CAAC,gCAAgC,CAAC,0BC7C/C,6lCAkCA;4FDca,iBAAiB;kBAP7B,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,WAAW,EAAE,wBAAwB;oBACrC,SAAS,EAAE,CAAC,wBAAwB,CAAC;oBACrC,SAAS,EAAE,CAAC,gCAAgC,CAAC;oBAC7C,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;wGAYY,OAAO;sBADjB,KAAK;gBAyBK,QAAQ;sBADlB,KAAK;gBAmBC,EAAE;sBADR,KAAK;gBAUC,KAAK;sBADX,KAAK;gBAUC,UAAU;sBADhB,KAAK;gBAUK,IAAI;sBADd,KAAK;gBAiBK,QAAQ;sBADlB,KAAK;gBAyBK,KAAK;sBADf,KAAK;gBA0BC,IAAI;sBADV,KAAK;gBAYK,SAAS;sBADnB,KAAK;gBAeK,MAAM;sBAFhB,MAAM;gBAUI,aAAa;sBADvB,MAAM;gBASI,cAAc;sBADxB,MAAM","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n Provider,\n forwardRef,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { BehaviorSubject, Observable, Subject } from 'rxjs';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { SkyRadioChange } from './types/radio-change';\n\n/**\n * Auto-incrementing integer that generates unique IDs for radio components.\n */\nlet nextUniqueId = 0;\n\n/**\n * Provider Expression that allows sky-radio to register as a ControlValueAccessor.\n * This allows it to support [(ngModel)].\n */\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_RADIO_CONTROL_VALUE_ACCESSOR: Provider = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyRadioComponent),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Renders a SKY UX-themed replacement for an HTML `input` element\n * with `type=\"radio\"`. When users select a radio button, its value is driven through an\n * `ngModel` attribute that you specify on the `sky-radio` element or the parent `sky-radio-group` element.\n */\n@Component({\n selector: 'sky-radio',\n templateUrl: './radio.component.html',\n styleUrls: ['./radio.component.scss'],\n providers: [SKY_RADIO_CONTROL_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyRadioComponent implements OnDestroy, ControlValueAccessor {\n /**\n * Fires when users focus off a radio button.\n */\n public blur = new Subject<void>();\n\n /**\n * Indicates whether the radio button is selected.\n * @default false\n */\n @Input()\n public set checked(value: boolean) {\n const newCheckedState = !!value;\n\n if (this._checked !== newCheckedState) {\n this._checked = newCheckedState;\n this._checkedChange.next(this._checked);\n\n if (newCheckedState) {\n this.selectedValue = this.value;\n }\n }\n\n this.changeDetector.markForCheck();\n }\n\n public get checked(): boolean {\n return this._checked;\n }\n\n /**\n * Indicates whether to disable the input.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);\n if (coercedValue !== this.disabled) {\n this._disabled = coercedValue;\n this._disabledChange.next(this._disabled);\n this.changeDetector.markForCheck();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Specifies an ID for the radio button.\n * @default a unique, auto-incrementing integer. For example: `sky-radio-1`\n */\n @Input()\n public id = `sky-radio-${++nextUniqueId}`;\n\n /**\n * Specifies an ARIA label for the radio button. This sets the radio button's `aria-label`\n * attribute [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility)\n * when the radio button does not include a visible label. You must set this property for icon\n * radio buttons. If the radio button includes a visible label, use `labelledBy` instead.\n */\n @Input()\n public label: string;\n\n /**\n * Specifies the HTML element ID (without the leading `#`) of the element that labels\n * the radio button. This sets the radio button's `aria-labelledby` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * If the radio button does not include a visible label, use `label` instead.\n */\n @Input()\n public labelledBy: string;\n\n /**\n * This property is deprecated in favor of the `name` property on the `sky-radio-group element`.\n * We recommend using the `sky-radio-group` element with all radio buttons, but if you opt not to,\n * then this property specifies a name for a group of radio buttons.\n * @deprecated\n */\n @Input()\n public set name(value: string) {\n this._name = value;\n this.changeDetector.markForCheck();\n }\n\n public get name(): string {\n return this._name;\n }\n\n /**\n * This property is deprecated in favor of\n * the `tabIndex` property on the `sky-radio-group` element. It specifies an index for the radio\n * button. If the index is not defined, it is set to the position of the radio button on load.\n * @deprecated\n */\n @Input()\n public set tabindex(value: number) {\n console.warn(\n 'The sky-radio `tabindex` property is deprecated. Please use the `tabindex` property on the sky-radio-group component.'\n );\n this._tabindex = value;\n this.changeDetector.markForCheck();\n }\n public get tabindex(): number {\n return this._tabindex || 0;\n }\n\n // For setting the tabindex from the radio group\n public set groupTabIndex(value: number) {\n this._tabindex = value;\n this.changeDetector.markForCheck();\n }\n\n /**\n * Specifies and binds a value to the radio button's `value` property. The value usually\n * corresponds to the radio button's label, which you specify with the `sky-radio-label`\n * component.\n * @required\n */\n @Input()\n public set value(value: any) {\n /* istanbul ignore else */\n if (this._value !== value) {\n if (this.selectedValue && this.selectedValue === this._value) {\n this.selectedValue = value;\n this.onChangeCallback(this.selectedValue);\n this.onTouchedCallback();\n }\n\n this._value = value;\n }\n\n this.changeDetector.markForCheck();\n }\n\n public get value(): any {\n return this._value;\n }\n\n /**\n * Specifies an icon to display in place of the radio button. To group radio buttons like in\n * the demo above, place the `sky-switch-icon-group` class on the direct parent element of the\n * radio buttons.\n */\n @Input()\n public icon: string;\n\n /**\n * Specifies a type to set the background color after users select an icon radio button.\n * The valid options correspond\n * [the label component's](https://developer.blackbaud.com/skyux/components/label)\n * label types. `danger` creates a red background, `info` creates a blue background,\n * `success` creates a green background, and `warning` creates an orange background.\n * @default \"info\"\n */\n @Input()\n public get radioType(): string {\n return this._radioType || 'info';\n }\n public set radioType(value: string) {\n if (value) {\n this._radioType = value.toLowerCase();\n }\n }\n\n /**\n * Fires when users select a radio button.\n */\n @Output()\n // eslint-disable-next-line @angular-eslint/no-output-native\n public get change(): Observable<SkyRadioChange> {\n return this._change;\n }\n\n /**\n * Fires when the selected value changes.\n */\n @Output()\n public get checkedChange(): Observable<boolean> {\n return this._checkedChange;\n }\n\n /**\n * Fires when the selected value changes.\n */\n @Output()\n public get disabledChange(): Observable<boolean> {\n return this._disabledChange;\n }\n\n public get inputId(): string {\n return `sky-radio-${this.id}-input`;\n }\n\n public set selectedValue(value: any) {\n if (value !== this._selectedValue) {\n this._selectedValue = value;\n }\n }\n public get selectedValue(): any {\n return this._selectedValue;\n }\n\n private _change = new EventEmitter<SkyRadioChange>();\n private _checked = false;\n private _checkedChange = new BehaviorSubject<boolean>(this._checked);\n private _disabled = false;\n private _disabledChange = new BehaviorSubject<boolean>(this._disabled);\n private _name: string;\n private _radioType: string;\n private _selectedValue: any;\n private _tabindex: number;\n private _value: any;\n\n constructor(private changeDetector: ChangeDetectorRef) {}\n\n public ngOnDestroy(): void {\n this.removeUniqueSelectionListener();\n }\n\n public writeValue(value: any): void {\n if (value === undefined) {\n return;\n }\n\n this.selectedValue = value;\n this.checked = this.value === this.selectedValue;\n\n this.changeDetector.markForCheck();\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: any): void {\n this.onChangeCallback = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouchedCallback = fn;\n }\n\n public onInputChange(event: Event): void {\n event.stopPropagation();\n\n if (!this.disabled) {\n this.checked = true;\n this._change.emit({\n source: this,\n value: this._value,\n });\n\n this.onInputFocusChange(undefined);\n this.onChangeCallback(this.value);\n }\n }\n\n public onInputFocusChange(event: Event): void {\n this.onTouchedCallback();\n this.blur.next();\n }\n\n /* istanbul ignore next */\n private removeUniqueSelectionListener = () => {};\n /* istanbul ignore next */\n private onChangeCallback = (value: any) => {};\n /* istanbul ignore next */\n private onTouchedCallback = () => {};\n}\n","<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"]}
|
|
1
|
+
{"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/radio/radio.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/radio/radio.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,KAAK,EAEL,MAAM,EAEN,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE5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,CAAC,0BC7C/C,6lCAkCA;4FDca,iBAAiB;kBAP7B,SAAS;mBAAC;oBACT,QAAQ,EAAE,WAAW;oBACrB,WAAW,EAAE,wBAAwB;oBACrC,SAAS,EAAE,CAAC,wBAAwB,CAAC;oBACrC,SAAS,EAAE,CAAC,gCAAgC,CAAC;oBAC7C,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;wGAYY,OAAO;sBADjB,KAAK;gBAyBK,QAAQ;sBADlB,KAAK;gBAmBC,EAAE;sBADR,KAAK;gBAUC,KAAK;sBADX,KAAK;gBAUC,UAAU;sBADhB,KAAK;gBAUK,IAAI;sBADd,KAAK;gBAiBK,QAAQ;sBADlB,KAAK;gBAyBK,KAAK;sBADf,KAAK;gBA0BC,IAAI;sBADV,KAAK;gBAYK,SAAS;sBADnB,KAAK;gBAeK,MAAM;sBAFhB,MAAM;gBAUI,aAAa;sBADvB,MAAM;gBASI,cAAc;sBADxB,MAAM","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n Provider,\n forwardRef,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nimport { BehaviorSubject, Observable, Subject } from 'rxjs';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { SkyRadioChange } from './types/radio-change';\n\n/**\n * Auto-incrementing integer that generates unique IDs for radio components.\n */\nlet nextUniqueId = 0;\n\n/**\n * Provider Expression that allows sky-radio to register as a ControlValueAccessor.\n * This allows it to support [(ngModel)].\n */\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_RADIO_CONTROL_VALUE_ACCESSOR: Provider = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyRadioComponent),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Renders a SKY UX-themed replacement for an HTML `input` element\n * with `type=\"radio\"`. When users select a radio button, its value is driven through an\n * `ngModel` attribute that you specify on the `sky-radio` element or the parent `sky-radio-group` element.\n */\n@Component({\n selector: 'sky-radio',\n templateUrl: './radio.component.html',\n styleUrls: ['./radio.component.scss'],\n providers: [SKY_RADIO_CONTROL_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyRadioComponent implements OnDestroy, ControlValueAccessor {\n /**\n * Fires when users focus off a radio button.\n */\n public blur = new Subject<void>();\n\n /**\n * Indicates whether the radio button is selected.\n * @default false\n */\n @Input()\n public set checked(value: boolean) {\n const newCheckedState = !!value;\n\n if (this._checked !== newCheckedState) {\n this._checked = newCheckedState;\n this._checkedChange.next(this._checked);\n\n if (newCheckedState) {\n this.selectedValue = this.value;\n }\n }\n\n this.changeDetector.markForCheck();\n }\n\n public get checked(): boolean {\n return this._checked;\n }\n\n /**\n * Indicates whether to disable the input.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);\n if (coercedValue !== this.disabled) {\n this._disabled = coercedValue;\n this._disabledChange.next(this._disabled);\n this.changeDetector.markForCheck();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Specifies an ID for the radio button.\n * @default a unique, auto-incrementing integer. For example: `sky-radio-1`\n */\n @Input()\n public id = `sky-radio-${++nextUniqueId}`;\n\n /**\n * Specifies an ARIA label for the radio button. This sets the radio button's `aria-label`\n * attribute [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility)\n * when the radio button does not include a visible label. You must set this property for icon\n * radio buttons. If the radio button includes a visible label, use `labelledBy` instead.\n */\n @Input()\n public label: string;\n\n /**\n * Specifies the HTML element ID (without the leading `#`) of the element that labels\n * the radio button. This sets the radio button's `aria-labelledby` attribute\n * [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * If the radio button does not include a visible label, use `label` instead.\n */\n @Input()\n public labelledBy: string;\n\n /**\n * This property is deprecated in favor of the `name` property on the `sky-radio-group element`.\n * We recommend using the `sky-radio-group` element with all radio buttons, but if you opt not to,\n * then this property specifies a name for a group of radio buttons.\n * @deprecated\n */\n @Input()\n public set name(value: string) {\n this._name = value;\n this.changeDetector.markForCheck();\n }\n\n public get name(): string {\n return this._name;\n }\n\n /**\n * This property is deprecated in favor of\n * the `tabIndex` property on the `sky-radio-group` element. It specifies an index for the radio\n * button. If the index is not defined, it is set to the position of the radio button on load.\n * @deprecated\n */\n @Input()\n public set tabindex(value: number) {\n console.warn(\n 'The sky-radio `tabindex` property is deprecated. Please use the `tabindex` property on the sky-radio-group component.'\n );\n this._tabindex = value;\n this.changeDetector.markForCheck();\n }\n public get tabindex(): number {\n return this._tabindex || 0;\n }\n\n // For setting the tabindex from the radio group\n public set groupTabIndex(value: number) {\n this._tabindex = value;\n this.changeDetector.markForCheck();\n }\n\n /**\n * Specifies and binds a value to the radio button's `value` property. The value usually\n * corresponds to the radio button's label, which you specify with the `sky-radio-label`\n * component.\n * @required\n */\n @Input()\n public set value(value: any) {\n /* istanbul ignore else */\n if (this._value !== value) {\n if (this.selectedValue && this.selectedValue === this._value) {\n this.selectedValue = value;\n this.onChangeCallback(this.selectedValue);\n this.onTouchedCallback();\n }\n\n this._value = value;\n }\n\n this.changeDetector.markForCheck();\n }\n\n public get value(): any {\n return this._value;\n }\n\n /**\n * Specifies an icon to display in place of the radio button. To group radio buttons like in\n * the demo above, place the `sky-switch-icon-group` class on the direct parent element of the\n * radio buttons.\n */\n @Input()\n public icon: string;\n\n /**\n * Specifies a type to set the background color after users select an icon radio button.\n * The valid options correspond\n * [the label component's](https://developer.blackbaud.com/skyux/components/label)\n * label types. `danger` creates a red background, `info` creates a blue background,\n * `success` creates a green background, and `warning` creates an orange background.\n * @default \"info\"\n */\n @Input()\n public get radioType(): string {\n return this._radioType || 'info';\n }\n public set radioType(value: string) {\n if (value) {\n this._radioType = value.toLowerCase();\n }\n }\n\n /**\n * Fires when users select a radio button.\n */\n @Output()\n // eslint-disable-next-line @angular-eslint/no-output-native\n public get change(): Observable<SkyRadioChange> {\n return this._change;\n }\n\n /**\n * Fires when the selected value changes.\n */\n @Output()\n public get checkedChange(): Observable<boolean> {\n return this._checkedChange;\n }\n\n /**\n * Fires when the selected value changes.\n */\n @Output()\n public get disabledChange(): Observable<boolean> {\n return this._disabledChange;\n }\n\n public get inputId(): string {\n return `sky-radio-${this.id}-input`;\n }\n\n public set selectedValue(value: any) {\n if (value !== this._selectedValue) {\n this._selectedValue = value;\n }\n }\n public get selectedValue(): any {\n return this._selectedValue;\n }\n\n private _change = new EventEmitter<SkyRadioChange>();\n private _checked = false;\n private _checkedChange = new BehaviorSubject<boolean>(this._checked);\n private _disabled = false;\n private _disabledChange = new BehaviorSubject<boolean>(this._disabled);\n private _name: string;\n private _radioType: string;\n private _selectedValue: any;\n private _tabindex: number;\n private _value: any;\n\n constructor(private changeDetector: ChangeDetectorRef) {}\n\n public ngOnDestroy(): void {\n this.removeUniqueSelectionListener();\n }\n\n public writeValue(value: any): void {\n if (value === undefined) {\n return;\n }\n\n this.selectedValue = value;\n this.checked = this.value === this.selectedValue;\n\n this.changeDetector.markForCheck();\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: any): void {\n this.onChangeCallback = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouchedCallback = fn;\n }\n\n public onInputChange(event: Event): void {\n event.stopPropagation();\n\n if (!this.disabled) {\n this.checked = true;\n this._change.emit({\n source: this,\n value: this._value,\n });\n\n this.onInputFocusChange(undefined);\n this.onChangeCallback(this.value);\n }\n }\n\n public onInputFocusChange(event: Event): void {\n this.onTouchedCallback();\n this.blur.next();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private removeUniqueSelectionListener = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChangeCallback = (value: any) => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouchedCallback = () => {};\n}\n","<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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
3
3
|
* The contents of this file were automatically generated by
|
|
4
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-forms' schematic.
|
|
4
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-forms' schematic.
|
|
5
5
|
* To update this file, simply rerun the command.
|
|
6
6
|
*/
|
|
7
7
|
import { NgModule } from '@angular/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sky-forms-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/shared/sky-forms-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,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IAC7B,SAAS,
|
|
1
|
+
{"version":3,"file":"sky-forms-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/shared/sky-forms-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,6BAA6B,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE;QAC/D,gCAAgC,EAAE;YAChC,OAAO,EAAE,mCAAmC;SAC7C;QACD,8CAA8C,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QAC1E,+CAA+C,EAAE;YAC/C,OAAO,EAAE,cAAc;SACxB;QACD,sCAAsC,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;QAClE,wCAAwC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE;QAClE,0CAA0C,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;QACnE,kCAAkC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACzD,kCAAkC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACzD,kCAAkC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACzD,gDAAgD,EAAE;YAChD,OAAO,EAAE,kBAAkB;SAC5B;QACD,+CAA+C,EAAE;YAC/C,OAAO,EAAE,qCAAqC;SAC/C;QACD,iDAAiD,EAAE;YACjD,OAAO,EAAE,iBAAiB;SAC3B;QACD,wDAAwD,EAAE;YACxD,OAAO,EAAE,eAAe;SACzB;QACD,8CAA8C,EAAE;YAC9C,OAAO,EAAE,2BAA2B;SACrC;QACD,4CAA4C,EAAE;YAC5C,OAAO,EAAE,sBAAsB;SAChC;QACD,kDAAkD,EAAE;YAClD,OAAO,EAAE,+BAA+B;SACzC;QACD,oDAAoD,EAAE;YACpD,OAAO,EAAE,oBAAoB;SAC9B;QACD,4CAA4C,EAAE;YAC5C,OAAO,EAAE,wBAAwB;SAClC;QACD,iDAAiD,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACtE,0CAA0C,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;KAC1E;CACF,CAAC;AAEF,MAAM,OAAO,yBAAyB;IAC7B,SAAS,CACd,UAA4B,EAC5B,IAAY;QAEZ,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,uBAAuB;;qHAAvB,uBAAuB;sHAAvB,uBAAuB,YATxB,aAAa;sHASZ,uBAAuB,aARvB;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,yBAAyB;YACnC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,uBAAuB;kBAVnC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,yBAAyB;4BACnC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-forms' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_character_count_message: { message: 'characters out of' },\n skyux_character_count_over_limit: {\n message: 'You are over the character limit.',\n },\n skyux_file_attachment_button_label_choose_file: { message: 'Choose file' },\n skyux_file_attachment_button_label_replace_file: {\n message: 'Replace file',\n },\n skyux_file_attachment_file_item_delete: { message: 'Delete file' },\n skyux_file_attachment_file_size_b_plural: { message: '{0} bytes' },\n skyux_file_attachment_file_size_b_singular: { message: '{0} byte' },\n skyux_file_attachment_file_size_gb: { message: '{0} GB' },\n skyux_file_attachment_file_size_kb: { message: '{0} KB' },\n skyux_file_attachment_file_size_mb: { message: '{0} MB' },\n skyux_file_attachment_file_upload_drag_file_here: {\n message: 'Drag a file here',\n },\n skyux_file_attachment_file_upload_drag_or_click: {\n message: 'Drag a file here or click to browse',\n },\n skyux_file_attachment_file_upload_drop_files_here: {\n message: 'Drop files here',\n },\n skyux_file_attachment_file_upload_image_preview_alt_text: {\n message: 'Image preview',\n },\n skyux_file_attachment_file_upload_invalid_file: {\n message: 'This file type is invalid',\n },\n skyux_file_attachment_file_upload_link_input: {\n message: 'Add a link to a file',\n },\n skyux_file_attachment_file_upload_link_placeholder: {\n message: 'http://www.something.com/file',\n },\n skyux_file_attachment_file_upload_or_click_to_browse: {\n message: 'or click to browse',\n },\n skyux_file_attachment_file_upload_paste_link: {\n message: 'Paste a link to a file',\n },\n skyux_file_attachment_file_upload_paste_link_done: { message: 'Done' },\n skyux_file_attachment_label_no_file_chosen: { message: 'No file chosen' },\n },\n};\n\nexport class SkyFormsResourcesProvider implements SkyLibResourcesProvider {\n public getString(\n localeInfo: SkyAppLocaleInfo,\n name: string\n ): string | undefined {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyFormsResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyFormsResourcesModule {}\n"]}
|
|
@@ -39,8 +39,9 @@ export class SkyToggleSwitchComponent {
|
|
|
39
39
|
this.ngUnsubscribe = new Subject();
|
|
40
40
|
this.toggleSwitchId = uniqueId++;
|
|
41
41
|
this._checked = false;
|
|
42
|
-
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
43
43
|
this.onTouched = () => { };
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
44
45
|
this.onChange = () => { };
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-switch.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/toggle-switch/toggle-switch.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/toggle-switch/toggle-switch.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,KAAK,EAEL,MAAM,EACN,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;;;AAGhF,sDAAsD;AACtD,MAAM,wCAAwC,GAAQ;IACpD,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC;IACvD,KAAK,EAAE,IAAI;CACZ,CAAC;AACF,MAAM,2BAA2B,GAAG;IAClC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC;IACvD,KAAK,EAAE,IAAI;CACZ,CAAC;AACF,gBAAgB;AAEhB,IAAI,QAAQ,GAAG,CAAC,CAAC;AAYjB,MAAM,OAAO,wBAAwB;IAyEnC,YAAoB,cAAiC;QAAjC,mBAAc,GAAd,cAAc,CAAmB;QAvCrD;;WAEG;QAEI,a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,YAAY,CAAC,IAAI,CAAC;YACrB,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;;sHAjJU,wBAAwB;0GAAxB,wBAAwB,2LANxB;QACT,wCAAwC;QACxC,2BAA2B;KAC5B,0DAkEgB,6BAA6B,6BCpHhD,opCAyCA;4FDYa,wBAAwB;kBAVpC,SAAS;mBAAC;oBACT,QAAQ,EAAE,mBAAmB;oBAC7B,WAAW,EAAE,gCAAgC;oBAC7C,SAAS,EAAE,CAAC,gCAAgC,CAAC;oBAC7C,SAAS,EAAE;wBACT,wCAAwC;wBACxC,2BAA2B;qBAC5B;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;wGAUQ,SAAS;sBADf,KAAK;gBAQK,OAAO;sBADjB,KAAK;gBAuBC,QAAQ;sBADd,KAAK;gBAQC,QAAQ;sBADd,KAAK;gBAOC,YAAY;sBADlB,MAAM;gBAcC,eAAe;sBADtB,eAAe;uBAAC,6BAA6B","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n QueryList,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyToggleSwitchLabelComponent } from './toggle-switch-label.component';\nimport { SkyToggleSwitchChange } from './types/toggle-switch-change';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyToggleSwitchComponent),\n multi: true,\n};\nconst SKY_TOGGLE_SWITCH_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyToggleSwitchComponent),\n multi: true,\n};\n// tslint:enable\n\nlet uniqueId = 0;\n\n@Component({\n selector: 'sky-toggle-switch',\n templateUrl: './toggle-switch.component.html',\n styleUrls: ['./toggle-switch.component.scss'],\n providers: [\n SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR,\n SKY_TOGGLE_SWITCH_VALIDATOR,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyToggleSwitchComponent\n implements AfterContentInit, OnDestroy, ControlValueAccessor, Validator\n{\n /**\n * Specifies an ARIA label for the toggle switch. This sets the toggle switch's `aria-label`\n * attribute [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * If the `sky-toggle-switch-label` component displays a visible label, do not use this property.\n */\n @Input()\n public ariaLabel: string;\n\n /**\n * Indicates whether the toggle switch is selected.\n * @default false\n */\n @Input()\n public set checked(checked: boolean) {\n if (checked !== this.checked) {\n this._checked = checked;\n this.onChange(checked);\n\n // Do not mark the field as \"dirty\"\n // if the field has been initialized with a value.\n if (this.isFirstChange && this.control) {\n this.control.markAsPristine();\n this.isFirstChange = false;\n }\n }\n }\n\n public get checked(): boolean {\n return this._checked || false;\n }\n\n /**\n * Indicates whether to disable the toggle switch.\n */\n @Input()\n public disabled = false;\n\n /**\n * Specifies a tab index for the toggle switch. If not defined, the index is set to the position\n * of the toggle switch on load.\n */\n @Input()\n public tabIndex = 0;\n\n /**\n * Fires when the checked state of a toggle switch changes.\n */\n @Output()\n public toggleChange = new EventEmitter<SkyToggleSwitchChange>();\n\n public get hasLabelComponent(): boolean {\n return this.labelComponents.length > 0;\n }\n\n public enableIndicatorAnimation = false;\n\n public get labelElementId(): string {\n return `sky-toggle-switch-label-${this.toggleSwitchId}`;\n }\n\n @ContentChildren(SkyToggleSwitchLabelComponent)\n private labelComponents: QueryList<SkyToggleSwitchLabelComponent>;\n\n private control: AbstractControl;\n private isFirstChange = true;\n private ngUnsubscribe = new Subject<void>();\n private toggleSwitchId = uniqueId++;\n\n private _checked = false;\n\n constructor(private changeDetector: ChangeDetectorRef) {}\n\n public ngAfterContentInit(): void {\n this.labelComponents.changes\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n // Allow the template to reload any ARIA attributes that are relying on the\n // label component existing in the DOM.\n this.changeDetector.markForCheck();\n });\n\n // Wait for the view to render before applying animation effects.\n // (Some browsers, such as Firefox, apply the animation too early.)\n setTimeout(() => {\n this.enableIndicatorAnimation = true;\n });\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public writeValue(value: boolean): void {\n this.checked = !!value;\n this.changeDetector.markForCheck();\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n return;\n }\n\n public registerOnChange(fn: (value: any) => void) {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n public setDisabledState(disabled: boolean): void {\n this.disabled = disabled;\n this.changeDetector.markForCheck();\n }\n\n public onButtonClick(event: any): void {\n event.stopPropagation();\n this.toggleChecked();\n this.emitChangeEvent();\n }\n\n public onButtonBlur(): void {\n this.onTouched();\n }\n\n /* istanbul ignore next */\n private onTouched: () => any = () => {};\n private onChange: (value: any) => void = () => {};\n\n private emitChangeEvent(): void {\n this.onChange(this._checked);\n this.toggleChange.emit({\n checked: this._checked,\n });\n }\n\n private toggleChecked(): void {\n this.checked = !this.checked;\n }\n}\n","<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"]}
|
|
1
|
+
{"version":3,"file":"toggle-switch.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/forms/src/lib/modules/toggle-switch/toggle-switch.component.ts","../../../../../../../../libs/components/forms/src/lib/modules/toggle-switch/toggle-switch.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,KAAK,EAEL,MAAM,EACN,SAAS,EACT,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;;;AAGhF,sDAAsD;AACtD,MAAM,wCAAwC,GAAQ;IACpD,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC;IACvD,KAAK,EAAE,IAAI;CACZ,CAAC;AACF,MAAM,2BAA2B,GAAG;IAClC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG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QACxB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAEM,YAAY;QACjB,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAOO,eAAe;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;YACrB,OAAO,EAAE,IAAI,CAAC,QAAQ;SACvB,CAAC,CAAC;IACL,CAAC;IAEO,aAAa;QACnB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,CAAC;;sHAlJU,wBAAwB;0GAAxB,wBAAwB,2LANxB;QACT,wCAAwC;QACxC,2BAA2B;KAC5B,0DAkEgB,6BAA6B,6BCpHhD,opCAyCA;4FDYa,wBAAwB;kBAVpC,SAAS;mBAAC;oBACT,QAAQ,EAAE,mBAAmB;oBAC7B,WAAW,EAAE,gCAAgC;oBAC7C,SAAS,EAAE,CAAC,gCAAgC,CAAC;oBAC7C,SAAS,EAAE;wBACT,wCAAwC;wBACxC,2BAA2B;qBAC5B;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD;wGAUQ,SAAS;sBADf,KAAK;gBAQK,OAAO;sBADjB,KAAK;gBAuBC,QAAQ;sBADd,KAAK;gBAQC,QAAQ;sBADd,KAAK;gBAOC,YAAY;sBADlB,MAAM;gBAcC,eAAe;sBADtB,eAAe;uBAAC,6BAA6B","sourcesContent":["import {\n AfterContentInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n QueryList,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyToggleSwitchLabelComponent } from './toggle-switch-label.component';\nimport { SkyToggleSwitchChange } from './types/toggle-switch-change';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyToggleSwitchComponent),\n multi: true,\n};\nconst SKY_TOGGLE_SWITCH_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyToggleSwitchComponent),\n multi: true,\n};\n// tslint:enable\n\nlet uniqueId = 0;\n\n@Component({\n selector: 'sky-toggle-switch',\n templateUrl: './toggle-switch.component.html',\n styleUrls: ['./toggle-switch.component.scss'],\n providers: [\n SKY_TOGGLE_SWITCH_CONTROL_VALUE_ACCESSOR,\n SKY_TOGGLE_SWITCH_VALIDATOR,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SkyToggleSwitchComponent\n implements AfterContentInit, OnDestroy, ControlValueAccessor, Validator\n{\n /**\n * Specifies an ARIA label for the toggle switch. This sets the toggle switch's `aria-label`\n * attribute [to support accessibility](https://developer.blackbaud.com/skyux/learn/accessibility).\n * If the `sky-toggle-switch-label` component displays a visible label, do not use this property.\n */\n @Input()\n public ariaLabel: string;\n\n /**\n * Indicates whether the toggle switch is selected.\n * @default false\n */\n @Input()\n public set checked(checked: boolean) {\n if (checked !== this.checked) {\n this._checked = checked;\n this.onChange(checked);\n\n // Do not mark the field as \"dirty\"\n // if the field has been initialized with a value.\n if (this.isFirstChange && this.control) {\n this.control.markAsPristine();\n this.isFirstChange = false;\n }\n }\n }\n\n public get checked(): boolean {\n return this._checked || false;\n }\n\n /**\n * Indicates whether to disable the toggle switch.\n */\n @Input()\n public disabled = false;\n\n /**\n * Specifies a tab index for the toggle switch. If not defined, the index is set to the position\n * of the toggle switch on load.\n */\n @Input()\n public tabIndex = 0;\n\n /**\n * Fires when the checked state of a toggle switch changes.\n */\n @Output()\n public toggleChange = new EventEmitter<SkyToggleSwitchChange>();\n\n public get hasLabelComponent(): boolean {\n return this.labelComponents.length > 0;\n }\n\n public enableIndicatorAnimation = false;\n\n public get labelElementId(): string {\n return `sky-toggle-switch-label-${this.toggleSwitchId}`;\n }\n\n @ContentChildren(SkyToggleSwitchLabelComponent)\n private labelComponents: QueryList<SkyToggleSwitchLabelComponent>;\n\n private control: AbstractControl;\n private isFirstChange = true;\n private ngUnsubscribe = new Subject<void>();\n private toggleSwitchId = uniqueId++;\n\n private _checked = false;\n\n constructor(private changeDetector: ChangeDetectorRef) {}\n\n public ngAfterContentInit(): void {\n this.labelComponents.changes\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n // Allow the template to reload any ARIA attributes that are relying on the\n // label component existing in the DOM.\n this.changeDetector.markForCheck();\n });\n\n // Wait for the view to render before applying animation effects.\n // (Some browsers, such as Firefox, apply the animation too early.)\n setTimeout(() => {\n this.enableIndicatorAnimation = true;\n });\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public writeValue(value: boolean): void {\n this.checked = !!value;\n this.changeDetector.markForCheck();\n }\n\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n return;\n }\n\n public registerOnChange(fn: (value: any) => void) {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n public setDisabledState(disabled: boolean): void {\n this.disabled = disabled;\n this.changeDetector.markForCheck();\n }\n\n public onButtonClick(event: any): void {\n event.stopPropagation();\n this.toggleChecked();\n this.emitChangeEvent();\n }\n\n public onButtonBlur(): void {\n this.onTouched();\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched: () => any = () => {};\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange: (value: any) => void = () => {};\n\n private emitChangeEvent(): void {\n this.onChange(this._checked);\n this.toggleChange.emit({\n checked: this._checked,\n });\n }\n\n private toggleChecked(): void {\n this.checked = !this.checked;\n }\n}\n","<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"]}
|
package/fesm2015/skyux-forms.js
CHANGED
|
@@ -18,7 +18,7 @@ import { SkyMediaBreakpoints } from '@skyux/core';
|
|
|
18
18
|
/**
|
|
19
19
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
20
20
|
* The contents of this file were automatically generated by
|
|
21
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-forms' schematic.
|
|
21
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-forms' schematic.
|
|
22
22
|
* To update this file, simply rerun the command.
|
|
23
23
|
*/
|
|
24
24
|
const RESOURCES = {
|
|
@@ -142,6 +142,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
142
142
|
*/
|
|
143
143
|
class SkyCharacterCounterInputDirective {
|
|
144
144
|
constructor() {
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
145
146
|
this._validatorChange = () => { };
|
|
146
147
|
}
|
|
147
148
|
/**
|
|
@@ -364,8 +365,9 @@ class SkyCheckboxComponent {
|
|
|
364
365
|
this._disabledChange = new BehaviorSubject(this._disabled);
|
|
365
366
|
this._required = false;
|
|
366
367
|
/** Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. */
|
|
367
|
-
|
|
368
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
368
369
|
this.onTouched = () => { };
|
|
370
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
369
371
|
this._controlValueAccessorChangeFn = (value) => { };
|
|
370
372
|
if (this.ngControl) {
|
|
371
373
|
this.ngControl.valueAccessor = this;
|
|
@@ -433,7 +435,7 @@ class SkyCheckboxComponent {
|
|
|
433
435
|
/**
|
|
434
436
|
* Indicates whether the input is required for form validation.
|
|
435
437
|
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
436
|
-
* attributes to the input element so that forms display an invalid state until the
|
|
438
|
+
* attributes to the input element so that forms display an invalid state until the input element
|
|
437
439
|
* is complete.
|
|
438
440
|
* @default false
|
|
439
441
|
*/
|
|
@@ -708,8 +710,8 @@ class SkyFileItemService {
|
|
|
708
710
|
/* tslint:enable */
|
|
709
711
|
}
|
|
710
712
|
isImage(fileItem) {
|
|
711
|
-
|
|
712
|
-
slashIndex = fileTypeUpper.indexOf('/');
|
|
713
|
+
const fileTypeUpper = this.getFileTypeUpper(fileItem);
|
|
714
|
+
const slashIndex = fileTypeUpper.indexOf('/');
|
|
713
715
|
if (slashIndex >= 0) {
|
|
714
716
|
switch (fileTypeUpper.substr(fileTypeUpper.indexOf('/') + 1)) {
|
|
715
717
|
case 'BMP':
|
|
@@ -796,16 +798,16 @@ class SkyFileAttachmentComponent {
|
|
|
796
798
|
/**
|
|
797
799
|
* Indicates whether the input is required for form validation.
|
|
798
800
|
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
799
|
-
* attributes to the input element so that forms display an invalid state until the
|
|
801
|
+
* attributes to the input element so that forms display an invalid state until the input element
|
|
800
802
|
* is complete.
|
|
801
803
|
*/
|
|
802
804
|
this.required = false;
|
|
803
805
|
this.fileAttachmentId = uniqueId$1++;
|
|
804
806
|
this.ngUnsubscribe = new Subject();
|
|
805
807
|
this._disabled = false;
|
|
806
|
-
|
|
808
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
807
809
|
this._onChange = (_) => { };
|
|
808
|
-
|
|
810
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
809
811
|
this._onTouched = () => { };
|
|
810
812
|
this.labelElementId = `sky-file-attachment-label-${this.fileAttachmentId}`;
|
|
811
813
|
this.fileDropDescriptionElementId = `sky-file-attachment-drop-description-${this.fileAttachmentId}`;
|
|
@@ -1240,7 +1242,6 @@ class SkyFileDropComponent {
|
|
|
1240
1242
|
const validFileArray = [];
|
|
1241
1243
|
const rejectedFileArray = [];
|
|
1242
1244
|
const totalFiles = files.length;
|
|
1243
|
-
const fileDrop = this;
|
|
1244
1245
|
// tslint:disable-next-line: max-line-length
|
|
1245
1246
|
const processedFiles = this.fileAttachmentService.checkFiles(files, this.minFileSize, this.maxFileSize, this.acceptedTypes, this.validateFn);
|
|
1246
1247
|
for (const file of processedFiles) {
|
|
@@ -1248,7 +1249,7 @@ class SkyFileDropComponent {
|
|
|
1248
1249
|
this.filesRejected(file, validFileArray, rejectedFileArray, totalFiles);
|
|
1249
1250
|
}
|
|
1250
1251
|
else {
|
|
1251
|
-
this.loadFile(
|
|
1252
|
+
this.loadFile(this, file, validFileArray, rejectedFileArray, totalFiles);
|
|
1252
1253
|
}
|
|
1253
1254
|
}
|
|
1254
1255
|
}
|
|
@@ -1301,7 +1302,7 @@ class SkyFileSizePipe {
|
|
|
1301
1302
|
this.resourcesService = resourcesService;
|
|
1302
1303
|
}
|
|
1303
1304
|
transform(input) {
|
|
1304
|
-
let decimalPlaces = 0, dividend = 1,
|
|
1305
|
+
let decimalPlaces = 0, dividend = 1, template;
|
|
1305
1306
|
/* tslint:disable */
|
|
1306
1307
|
if (input === null || input === undefined) {
|
|
1307
1308
|
return '';
|
|
@@ -1327,10 +1328,9 @@ class SkyFileSizePipe {
|
|
|
1327
1328
|
dividend = 1e9;
|
|
1328
1329
|
decimalPlaces = 1;
|
|
1329
1330
|
}
|
|
1330
|
-
roundedSize =
|
|
1331
|
-
Math.
|
|
1332
|
-
|
|
1333
|
-
formattedSize = this.decimalPipe.transform(roundedSize, '.0-3');
|
|
1331
|
+
const roundedSize = Math.floor(input / (dividend / Math.pow(10, decimalPlaces))) /
|
|
1332
|
+
Math.pow(10, decimalPlaces);
|
|
1333
|
+
const formattedSize = this.decimalPipe.transform(roundedSize, '.0-3');
|
|
1334
1334
|
return this.getString(template, formattedSize);
|
|
1335
1335
|
}
|
|
1336
1336
|
getString(key, ...args) {
|
|
@@ -1370,7 +1370,9 @@ class SkyFileItemComponent {
|
|
|
1370
1370
|
ngDoCheck() {
|
|
1371
1371
|
const changes = this.differ.diff(this.fileItem);
|
|
1372
1372
|
if (changes) {
|
|
1373
|
-
let cls
|
|
1373
|
+
let cls;
|
|
1374
|
+
const extensionUpper = this.fileItemService.getFileExtensionUpper(this.fileItem);
|
|
1375
|
+
let fileTypeUpper;
|
|
1374
1376
|
switch (extensionUpper) {
|
|
1375
1377
|
case '.PDF':
|
|
1376
1378
|
cls = 'pdf';
|
|
@@ -1696,11 +1698,11 @@ class SkyRadioComponent {
|
|
|
1696
1698
|
this._checkedChange = new BehaviorSubject(this._checked);
|
|
1697
1699
|
this._disabled = false;
|
|
1698
1700
|
this._disabledChange = new BehaviorSubject(this._disabled);
|
|
1699
|
-
|
|
1701
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1700
1702
|
this.removeUniqueSelectionListener = () => { };
|
|
1701
|
-
|
|
1703
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1702
1704
|
this.onChangeCallback = (value) => { };
|
|
1703
|
-
|
|
1705
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1704
1706
|
this.onTouchedCallback = () => { };
|
|
1705
1707
|
}
|
|
1706
1708
|
/**
|
|
@@ -1928,7 +1930,7 @@ class SkyRadioGroupComponent {
|
|
|
1928
1930
|
/**
|
|
1929
1931
|
* Indicates whether the input is required for form validation.
|
|
1930
1932
|
* When you set this property to `true`, the component adds `aria-required` and `required`
|
|
1931
|
-
* attributes to the input element so that forms display an invalid state until the
|
|
1933
|
+
* attributes to the input element so that forms display an invalid state until the input element
|
|
1932
1934
|
* is complete.
|
|
1933
1935
|
* @default false
|
|
1934
1936
|
*/
|
|
@@ -1936,9 +1938,9 @@ class SkyRadioGroupComponent {
|
|
|
1936
1938
|
this.ngUnsubscribe = new Subject();
|
|
1937
1939
|
this._disabled = false;
|
|
1938
1940
|
this._name = `sky-radio-group-${nextUniqueId++}`;
|
|
1939
|
-
|
|
1941
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1940
1942
|
this.onChange = () => { };
|
|
1941
|
-
|
|
1943
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1942
1944
|
this.onTouched = () => { };
|
|
1943
1945
|
if (this.ngControl) {
|
|
1944
1946
|
this.ngControl.valueAccessor = this;
|
|
@@ -2623,8 +2625,9 @@ class SkyToggleSwitchComponent {
|
|
|
2623
2625
|
this.ngUnsubscribe = new Subject();
|
|
2624
2626
|
this.toggleSwitchId = uniqueId++;
|
|
2625
2627
|
this._checked = false;
|
|
2626
|
-
|
|
2628
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2627
2629
|
this.onTouched = () => { };
|
|
2630
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2628
2631
|
this.onChange = () => { };
|
|
2629
2632
|
}
|
|
2630
2633
|
/**
|