@abgov/angular-components 1.8.0-beta.9 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -45
- package/abgov-angular-components.d.ts +1 -0
- package/bundles/abgov-angular-components.umd.js +142 -2453
- package/bundles/abgov-angular-components.umd.js.map +1 -1
- package/esm2015/abgov-angular-components.js +1 -1
- package/esm2015/index.js +2 -26
- package/esm2015/lib/angular-components.module.js +16 -91
- package/esm2015/lib/value-directive.js +133 -0
- package/fesm2015/abgov-angular-components.js +122 -1969
- package/fesm2015/abgov-angular-components.js.map +1 -1
- package/index.d.ts +1 -25
- package/lib/angular-components.module.d.ts +7 -0
- package/lib/value-directive.d.ts +34 -0
- package/package.json +8 -12
- package/LICENSE +0 -21
- package/abgov-angular-components.metadata.json +0 -1
- package/bundles/abgov-angular-components.umd.min.js +0 -2
- package/bundles/abgov-angular-components.umd.min.js.map +0 -1
- package/esm2015/abgov-angular-components.js.map +0 -1
- package/esm2015/abgov-angular-components.metadata.json +0 -1
- package/esm2015/experimental/app-version-header/app-version-header.component.js +0 -30
- package/esm2015/experimental/app-version-header/app-version-header.component.js.map +0 -1
- package/esm2015/experimental/app-version-header/app-version-header.component.metadata.json +0 -1
- package/esm2015/experimental/badge/badge.component.js +0 -24
- package/esm2015/experimental/badge/badge.component.js.map +0 -1
- package/esm2015/experimental/badge/badge.component.metadata.json +0 -1
- package/esm2015/experimental/components.module.js +0 -28
- package/esm2015/experimental/components.module.js.map +0 -1
- package/esm2015/experimental/components.module.metadata.json +0 -1
- package/esm2015/experimental/index.js +0 -5
- package/esm2015/experimental/index.js.map +0 -1
- package/esm2015/experimental/index.metadata.json +0 -1
- package/esm2015/experimental/number-input/number-input.component.js +0 -114
- package/esm2015/experimental/number-input/number-input.component.js.map +0 -1
- package/esm2015/experimental/number-input/number-input.component.metadata.json +0 -1
- package/esm2015/index.js.map +0 -1
- package/esm2015/index.metadata.json +0 -1
- package/esm2015/lib/angular-components.module.js.map +0 -1
- package/esm2015/lib/angular-components.module.metadata.json +0 -1
- package/esm2015/lib/button/button.component.js +0 -66
- package/esm2015/lib/button/button.component.js.map +0 -1
- package/esm2015/lib/button/button.component.metadata.json +0 -1
- package/esm2015/lib/button-link/button-link.component.js +0 -66
- package/esm2015/lib/button-link/button-link.component.js.map +0 -1
- package/esm2015/lib/button-link/button-link.component.metadata.json +0 -1
- package/esm2015/lib/callout/callout.component.js +0 -34
- package/esm2015/lib/callout/callout.component.js.map +0 -1
- package/esm2015/lib/callout/callout.component.metadata.json +0 -1
- package/esm2015/lib/card/card.component.js +0 -37
- package/esm2015/lib/card/card.component.js.map +0 -1
- package/esm2015/lib/card/card.component.metadata.json +0 -1
- package/esm2015/lib/card/content/card-content.component.js +0 -24
- package/esm2015/lib/card/content/card-content.component.js.map +0 -1
- package/esm2015/lib/card/content/card-content.component.metadata.json +0 -1
- package/esm2015/lib/card/footer/card-footer.component.js +0 -24
- package/esm2015/lib/card/footer/card-footer.component.js.map +0 -1
- package/esm2015/lib/card/footer/card-footer.component.metadata.json +0 -1
- package/esm2015/lib/card/header/card-header.component.js +0 -24
- package/esm2015/lib/card/header/card-header.component.js.map +0 -1
- package/esm2015/lib/card/header/card-header.component.metadata.json +0 -1
- package/esm2015/lib/card/thumb/card-thumb.component.js +0 -27
- package/esm2015/lib/card/thumb/card-thumb.component.js.map +0 -1
- package/esm2015/lib/card/thumb/card-thumb.component.metadata.json +0 -1
- package/esm2015/lib/card-group/card.group.component.js +0 -23
- package/esm2015/lib/card-group/card.group.component.js.map +0 -1
- package/esm2015/lib/card-group/card.group.component.metadata.json +0 -1
- package/esm2015/lib/checkbox/checkbox-change.js +0 -3
- package/esm2015/lib/checkbox/checkbox-change.js.map +0 -1
- package/esm2015/lib/checkbox/checkbox-change.metadata.json +0 -1
- package/esm2015/lib/checkbox/checkbox.component.js +0 -136
- package/esm2015/lib/checkbox/checkbox.component.js.map +0 -1
- package/esm2015/lib/checkbox/checkbox.component.metadata.json +0 -1
- package/esm2015/lib/dropdown/dropdown.component.js +0 -326
- package/esm2015/lib/dropdown/dropdown.component.js.map +0 -1
- package/esm2015/lib/dropdown/dropdown.component.metadata.json +0 -1
- package/esm2015/lib/dropdown/option/option.component.js +0 -48
- package/esm2015/lib/dropdown/option/option.component.js.map +0 -1
- package/esm2015/lib/dropdown/option/option.component.metadata.json +0 -1
- package/esm2015/lib/dropdown/option-group/option-group.component.js +0 -46
- package/esm2015/lib/dropdown/option-group/option-group.component.js.map +0 -1
- package/esm2015/lib/dropdown/option-group/option-group.component.metadata.json +0 -1
- package/esm2015/lib/element-load-indicator/element-load-indicator.component.js +0 -63
- package/esm2015/lib/element-load-indicator/element-load-indicator.component.js.map +0 -1
- package/esm2015/lib/element-load-indicator/element-load-indicator.component.metadata.json +0 -1
- package/esm2015/lib/header/header.component.js +0 -47
- package/esm2015/lib/header/header.component.js.map +0 -1
- package/esm2015/lib/header/header.component.metadata.json +0 -1
- package/esm2015/lib/hero-banner/content/hero-banner-content.component.js +0 -15
- package/esm2015/lib/hero-banner/content/hero-banner-content.component.js.map +0 -1
- package/esm2015/lib/hero-banner/content/hero-banner-content.component.metadata.json +0 -1
- package/esm2015/lib/hero-banner/hero-banner.component.js +0 -21
- package/esm2015/lib/hero-banner/hero-banner.component.js.map +0 -1
- package/esm2015/lib/hero-banner/hero-banner.component.metadata.json +0 -1
- package/esm2015/lib/hero-banner/link/hero-banner-link.component.js +0 -18
- package/esm2015/lib/hero-banner/link/hero-banner-link.component.js.map +0 -1
- package/esm2015/lib/hero-banner/link/hero-banner-link.component.metadata.json +0 -1
- package/esm2015/lib/microsite-logo/microsite-logo.component.js +0 -34
- package/esm2015/lib/microsite-logo/microsite-logo.component.js.map +0 -1
- package/esm2015/lib/microsite-logo/microsite-logo.component.metadata.json +0 -1
- package/esm2015/lib/notification/notification.component.js +0 -59
- package/esm2015/lib/notification/notification.component.js.map +0 -1
- package/esm2015/lib/notification/notification.component.metadata.json +0 -1
- package/esm2015/lib/notification-banner/notification-banner.component.js +0 -32
- package/esm2015/lib/notification-banner/notification-banner.component.js.map +0 -1
- package/esm2015/lib/notification-banner/notification-banner.component.metadata.json +0 -1
- package/esm2015/lib/page-load-indicator/page-load-indicator.component.js +0 -117
- package/esm2015/lib/page-load-indicator/page-load-indicator.component.js.map +0 -1
- package/esm2015/lib/page-load-indicator/page-load-indicator.component.metadata.json +0 -1
- package/esm2015/lib/radio/radio-change.js +0 -3
- package/esm2015/lib/radio/radio-change.js.map +0 -1
- package/esm2015/lib/radio/radio-change.metadata.json +0 -1
- package/esm2015/lib/radio/radio.component.js +0 -146
- package/esm2015/lib/radio/radio.component.js.map +0 -1
- package/esm2015/lib/radio/radio.component.metadata.json +0 -1
- package/esm2015/lib/radio/radio.service.js +0 -20
- package/esm2015/lib/radio/radio.service.js.map +0 -1
- package/esm2015/lib/radio/radio.service.metadata.json +0 -1
- package/esm2015/lib/radio-group/radio-group.component.js +0 -282
- package/esm2015/lib/radio-group/radio-group.component.js.map +0 -1
- package/esm2015/lib/radio-group/radio-group.component.metadata.json +0 -1
- package/esm2015/lib/skeleton/skeleton-element.component.js +0 -21
- package/esm2015/lib/skeleton/skeleton-element.component.js.map +0 -1
- package/esm2015/lib/skeleton/skeleton-element.component.metadata.json +0 -1
- package/esm2015/lib/skeleton/skeleton-image-content.component.js +0 -19
- package/esm2015/lib/skeleton/skeleton-image-content.component.js.map +0 -1
- package/esm2015/lib/skeleton/skeleton-image-content.component.metadata.json +0 -1
- package/experimental/app-version-header/app-version-header.component.d.ts +0 -10
- package/experimental/badge/badge.component.d.ts +0 -7
- package/experimental/components.module.d.ts +0 -2
- package/experimental/index.d.ts +0 -4
- package/experimental/number-input/number-input.component.d.ts +0 -58
- package/lib/button/button.component.d.ts +0 -37
- package/lib/button-link/button-link.component.d.ts +0 -38
- package/lib/callout/callout.component.d.ts +0 -20
- package/lib/card/card.component.d.ts +0 -23
- package/lib/card/content/card-content.component.d.ts +0 -14
- package/lib/card/footer/card-footer.component.d.ts +0 -14
- package/lib/card/header/card-header.component.d.ts +0 -14
- package/lib/card/thumb/card-thumb.component.d.ts +0 -22
- package/lib/card-group/card.group.component.d.ts +0 -32
- package/lib/checkbox/checkbox-change.d.ts +0 -7
- package/lib/checkbox/checkbox.component.d.ts +0 -100
- package/lib/dropdown/dropdown.component.d.ts +0 -193
- package/lib/dropdown/option/option.component.d.ts +0 -39
- package/lib/dropdown/option-group/option-group.component.d.ts +0 -38
- package/lib/element-load-indicator/element-load-indicator.component.d.ts +0 -38
- package/lib/header/header.component.d.ts +0 -29
- package/lib/hero-banner/content/hero-banner-content.component.d.ts +0 -5
- package/lib/hero-banner/hero-banner.component.d.ts +0 -9
- package/lib/hero-banner/link/hero-banner-link.component.d.ts +0 -6
- package/lib/microsite-logo/microsite-logo.component.d.ts +0 -20
- package/lib/notification/notification.component.d.ts +0 -43
- package/lib/notification-banner/notification-banner.component.d.ts +0 -22
- package/lib/page-load-indicator/page-load-indicator.component.d.ts +0 -55
- package/lib/radio/radio-change.d.ts +0 -7
- package/lib/radio/radio.component.d.ts +0 -119
- package/lib/radio/radio.service.d.ts +0 -7
- package/lib/radio-group/radio-group.component.d.ts +0 -190
- package/lib/skeleton/skeleton-element.component.d.ts +0 -5
- package/lib/skeleton/skeleton-image-content.component.d.ts +0 -5
- package/theme.css +0 -206
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { HostListener } from '@angular/core';
|
|
2
|
-
import { Component, Input, } from '@angular/core';
|
|
3
|
-
/**
|
|
4
|
-
* A page load indicator component with Government of Alberta styling.
|
|
5
|
-
* selector: goa-page-load-indicator
|
|
6
|
-
*/
|
|
7
|
-
export class GoAPageLoadIndicatorComponent {
|
|
8
|
-
constructor() {
|
|
9
|
-
/**
|
|
10
|
-
* Sets the page loader visibility state.
|
|
11
|
-
*/
|
|
12
|
-
this.visible = false;
|
|
13
|
-
/**
|
|
14
|
-
* The type of page loader, deterministic and indeterministic.
|
|
15
|
-
*/
|
|
16
|
-
this.type = 'infinite';
|
|
17
|
-
/**
|
|
18
|
-
* The message to display while loading.
|
|
19
|
-
*/
|
|
20
|
-
this.message = '';
|
|
21
|
-
/**
|
|
22
|
-
* Sets the percentage value of the page loader while set to progress type, 0 - 100 percent.
|
|
23
|
-
*/
|
|
24
|
-
this.value = 0;
|
|
25
|
-
/**
|
|
26
|
-
* Sets the page to locked and does not accept user input. When not set the component
|
|
27
|
-
* can be used as a child element without blocking user input.
|
|
28
|
-
*/
|
|
29
|
-
this.pagelock = true;
|
|
30
|
-
/**
|
|
31
|
-
* Sets the progress indicator display type size.
|
|
32
|
-
*/
|
|
33
|
-
this.displayType = 'large';
|
|
34
|
-
/**
|
|
35
|
-
* Set defaults
|
|
36
|
-
*/
|
|
37
|
-
this.strokeDashoffsetDefault = 280;
|
|
38
|
-
this.progressMaxValue = 283;
|
|
39
|
-
this.strokeDashoffset = 0;
|
|
40
|
-
}
|
|
41
|
-
ngOnInit() {
|
|
42
|
-
if (this.type !== 'progress') {
|
|
43
|
-
this.strokeDashoffset = this.strokeDashoffsetDefault;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
ngOnChanges(changes) {
|
|
47
|
-
if (changes.visible) {
|
|
48
|
-
this.blockScrollingToggle(changes.visible.currentValue);
|
|
49
|
-
}
|
|
50
|
-
if (changes.value) {
|
|
51
|
-
if (this.type === 'progress') {
|
|
52
|
-
this.setProgress(changes.value.currentValue);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Toggles the page scrolling based on page load indicator's visibility.
|
|
58
|
-
* @param isBlock The flag to enable/disable page scroll.
|
|
59
|
-
* @ignore
|
|
60
|
-
*/
|
|
61
|
-
blockScrollingToggle(isBlock) {
|
|
62
|
-
if (!isBlock || !this.pagelock) {
|
|
63
|
-
document.body.style.removeProperty('height');
|
|
64
|
-
document.body.style.removeProperty('overflow');
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
document.body.style.height = '100%';
|
|
68
|
-
document.body.style.overflow = 'hidden';
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Blocks the keyboard input when page load indicator is visible.
|
|
73
|
-
* @ignore
|
|
74
|
-
*/
|
|
75
|
-
disableKeyboardInputHandler(event) {
|
|
76
|
-
if (this.visible) {
|
|
77
|
-
event.returnValue = false;
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
ngOnDestroy() {
|
|
82
|
-
this.blockScrollingToggle(false);
|
|
83
|
-
}
|
|
84
|
-
setProgress(progress) {
|
|
85
|
-
if (this.type !== 'progress') {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
;
|
|
89
|
-
if (progress === 0) {
|
|
90
|
-
this.strokeDashoffset = this.progressMaxValue;
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (progress >= 100) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const value = this.progressMaxValue - Math.round(this.progressMaxValue * progress / 100);
|
|
97
|
-
this.strokeDashoffset = value;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
GoAPageLoadIndicatorComponent.decorators = [
|
|
101
|
-
{ type: Component, args: [{
|
|
102
|
-
selector: 'goa-page-load-indicator',
|
|
103
|
-
template: "<div *ngIf=\"visible\" class=\"progress-container--{{ displayType }}\">\n <svg\n [ngClass]=\"{\n 'svg': displayType === 'large',\n 'svg--small': displayType === 'small'\n }\"\n fill=\"none\"\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <circle class=\"base-circle\" cx=\"50\" cy=\"50\" r=\"45\"/>\n <circle\n [ngClass]=\"{\n 'progress-circle--infinite': type === 'infinite',\n 'progress-circle': type === 'progress'\n }\"\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n [style.stroke-dashoffset]=\"strokeDashoffset\"/>\n </svg>\n\n <span class=\"progress-message--{{ displayType }}\">\n {{ message }}\n </span>\n</div>\n",
|
|
104
|
-
styles: [".svg{max-width:100px}.svg--small{max-width:65px}@-webkit-keyframes circle-animation{0%{stroke-dashoffset:75;transform:rotate(0)}to{stroke-dashoffset:75;transform:rotate(1turn)}}@keyframes circle-animation{0%{stroke-dashoffset:75;transform:rotate(0)}to{stroke-dashoffset:75;transform:rotate(1turn)}}.base-circle{display:block;fill:transparent;stroke:#c8eef9;stroke-width:7px}.progress-circle,.progress-circle--infinite{display:block;fill:transparent;stroke:#0070c4;stroke-linecap:round;stroke-dasharray:283;stroke-dashoffset:280;stroke-width:7px;transform-origin:50% 50%}.progress-circle--infinite{-webkit-animation:circle-animation 1.2s linear infinite;animation:circle-animation 1.2s linear infinite}.progress-message,.progress-message--large,.progress-message--small{font-style:normal;font-weight:400}.progress-message--large{margin-top:32px;font-size:24px;color:#000}.progress-message--small{margin-top:18px;font-size:18px;color:#000}.progress-container,.progress-container--large,.progress-container--small{display:flex;flex-direction:column;align-items:center;justify-content:center;background:#fff}.progress-container--large{width:100%;height:100%}"]
|
|
105
|
-
},] }
|
|
106
|
-
];
|
|
107
|
-
GoAPageLoadIndicatorComponent.ctorParameters = () => [];
|
|
108
|
-
GoAPageLoadIndicatorComponent.propDecorators = {
|
|
109
|
-
visible: [{ type: Input }],
|
|
110
|
-
type: [{ type: Input }],
|
|
111
|
-
message: [{ type: Input }],
|
|
112
|
-
value: [{ type: Input }],
|
|
113
|
-
pagelock: [{ type: Input }],
|
|
114
|
-
displayType: [{ type: Input }],
|
|
115
|
-
disableKeyboardInputHandler: [{ type: HostListener, args: ['document:keydown', ['$event'],] }]
|
|
116
|
-
};
|
|
117
|
-
//# sourceMappingURL=page-load-indicator.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-load-indicator.component.js","sourceRoot":"","sources":["../../../../../../libs/angular-components/src/lib/page-load-indicator/page-load-indicator.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAa,MAAM,eAAe,CAAC;AAExD,OAAO,EACL,SAAS,EACT,KAAK,GAIN,MAAM,eAAe,CAAC;AAGvB;;;GAGG;AAMH,MAAM,OAAO,6BAA6B;IAExC;QAGA;;WAEG;QACM,YAAO,GAAG,KAAK,CAAC;QAEzB;;WAEG;QACM,SAAI,GAA4B,UAAU,CAAC;QAEpD;;UAEE;QACO,YAAO,GAAG,EAAE,CAAC;QAEtB;;WAEG;QACM,UAAK,GAAG,CAAC,CAAC;QAEnB;;;WAGG;QAEH,aAAQ,GAAG,IAAI,CAAC;QAEhB;;WAEG;QACM,gBAAW,GAAsB,OAAO,CAAC;QAElD;;WAEG;QACH,4BAAuB,GAAG,GAAG,CAAC;QAC9B,qBAAgB,GAAG,GAAG,CAAC;QACvB,qBAAgB,GAAG,CAAC,CAAC;IAvCrB,CAAC;IAyCD,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;YAC5B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,uBAAuB,CAAC;SACtD;IACH,CAAC;IAED,WAAW,CAAC,OAAsB;QAChC,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;SACzD;QACD,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;gBAC5B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;aAC9C;SACF;IACH,CAAC;IAED;;;;OAIG;IACK,oBAAoB,CAAC,OAAgB;QAC3C,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC9B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC7C,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;SAChD;aAAM;YACL,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;YACpC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;SACzC;IACH,CAAC;IAED;;;OAGG;IAEH,2BAA2B,CAAC,KAAoB;QAC9C,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;YAC1B,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;IACH,CAAC;IAED,WAAW;QACT,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,WAAW,CAAC,QAAgB;QAC1B,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE;YAC5B,OAAO;SACR;QAAA,CAAC;QAEF,IAAI,QAAQ,KAAK,CAAC,EAAE;YAClB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;YAC9C,OAAO;SACR;QAED,IAAI,QAAQ,IAAI,GAAG,EAAE;YACnB,OAAO;SACR;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;QACzF,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;IAChC,CAAC;;;YAjHF,SAAS,SAAC;gBACT,QAAQ,EAAE,yBAAyB;gBACnC,wuBAAmD;;aAEpD;;;;sBASE,KAAK;mBAKL,KAAK;sBAKL,KAAK;oBAKL,KAAK;uBAML,KAAK;0BAML,KAAK;0CA6CL,YAAY,SAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import { HostListener, OnDestroy } from '@angular/core';\n\nimport {\n Component,\n Input,\n OnChanges,\n OnInit,\n SimpleChanges,\n} from '@angular/core';\nimport { __values } from 'tslib';\n\n/**\n * A page load indicator component with Government of Alberta styling.\n * selector: goa-page-load-indicator\n */\n@Component({\n selector: 'goa-page-load-indicator',\n templateUrl: './page-load-indicator.component.html',\n styleUrls: ['./page-load-indicator.component.scss'],\n})\nexport class GoAPageLoadIndicatorComponent implements OnInit, OnChanges, OnDestroy {\n\n constructor() {\n }\n\n /**\n * Sets the page loader visibility state.\n */\n @Input() visible = false;\n\n /**\n * The type of page loader, deterministic and indeterministic.\n */\n @Input() type: 'progress' | 'infinite' = 'infinite';\n\n /**\n * The message to display while loading.\n */\n @Input() message = '';\n\n /**\n * Sets the percentage value of the page loader while set to progress type, 0 - 100 percent.\n */\n @Input() value = 0;\n\n /**\n * Sets the page to locked and does not accept user input. When not set the component\n * can be used as a child element without blocking user input.\n */\n @Input()\n pagelock = true;\n\n /**\n * Sets the progress indicator display type size.\n */\n @Input() displayType: 'large' | 'small' = 'large';\n\n /**\n * Set defaults\n */\n strokeDashoffsetDefault = 280;\n progressMaxValue = 283;\n strokeDashoffset = 0;\n\n ngOnInit(): void {\n if (this.type !== 'progress') {\n this.strokeDashoffset = this.strokeDashoffsetDefault;\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.visible) {\n this.blockScrollingToggle(changes.visible.currentValue);\n }\n if (changes.value) {\n if (this.type === 'progress') {\n this.setProgress(changes.value.currentValue);\n }\n }\n }\n\n /**\n * Toggles the page scrolling based on page load indicator's visibility.\n * @param isBlock The flag to enable/disable page scroll.\n * @ignore\n */\n private blockScrollingToggle(isBlock: boolean): void {\n if (!isBlock || !this.pagelock) {\n document.body.style.removeProperty('height');\n document.body.style.removeProperty('overflow');\n } else {\n document.body.style.height = '100%';\n document.body.style.overflow = 'hidden';\n }\n }\n\n /**\n * Blocks the keyboard input when page load indicator is visible.\n * @ignore\n */\n @HostListener('document:keydown', ['$event'])\n disableKeyboardInputHandler(event: KeyboardEvent) {\n if (this.visible) {\n event.returnValue = false;\n event.preventDefault();\n }\n }\n\n ngOnDestroy(): void {\n this.blockScrollingToggle(false);\n }\n\n setProgress(progress: number): void {\n if (this.type !== 'progress') {\n return;\n };\n\n if (progress === 0) {\n this.strokeDashoffset = this.progressMaxValue;\n return;\n }\n\n if (progress >= 100) {\n return;\n }\n\n const value = this.progressMaxValue - Math.round(this.progressMaxValue * progress / 100);\n this.strokeDashoffset = value;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GoAPageLoadIndicatorComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":15,"character":1},"arguments":[{"selector":"goa-page-load-indicator","template":"<div *ngIf=\"visible\" class=\"progress-container--{{ displayType }}\">\n <svg\n [ngClass]=\"{\n 'svg': displayType === 'large',\n 'svg--small': displayType === 'small'\n }\"\n fill=\"none\"\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <circle class=\"base-circle\" cx=\"50\" cy=\"50\" r=\"45\"/>\n <circle\n [ngClass]=\"{\n 'progress-circle--infinite': type === 'infinite',\n 'progress-circle': type === 'progress'\n }\"\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n [style.stroke-dashoffset]=\"strokeDashoffset\"/>\n </svg>\n\n <span class=\"progress-message--{{ displayType }}\">\n {{ message }}\n </span>\n</div>\n","styles":[".svg{max-width:100px}.svg--small{max-width:65px}@-webkit-keyframes circle-animation{0%{stroke-dashoffset:75;transform:rotate(0)}to{stroke-dashoffset:75;transform:rotate(1turn)}}@keyframes circle-animation{0%{stroke-dashoffset:75;transform:rotate(0)}to{stroke-dashoffset:75;transform:rotate(1turn)}}.base-circle{display:block;fill:transparent;stroke:#c8eef9;stroke-width:7px}.progress-circle,.progress-circle--infinite{display:block;fill:transparent;stroke:#0070c4;stroke-linecap:round;stroke-dasharray:283;stroke-dashoffset:280;stroke-width:7px;transform-origin:50% 50%}.progress-circle--infinite{-webkit-animation:circle-animation 1.2s linear infinite;animation:circle-animation 1.2s linear infinite}.progress-message,.progress-message--large,.progress-message--small{font-style:normal;font-weight:400}.progress-message--large{margin-top:32px;font-size:24px;color:#000}.progress-message--small{margin-top:18px;font-size:18px;color:#000}.progress-container,.progress-container--large,.progress-container--small{display:flex;flex-direction:column;align-items:center;justify-content:center;background:#fff}.progress-container--large{width:100%;height:100%}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"visible":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":28,"character":3}}]}],"type":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"message":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":3}}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":3}}]}],"pagelock":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"displayType":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":55,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"blockScrollingToggle":[{"__symbolic":"method"}],"disableKeyboardInputHandler":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":100,"character":3},"arguments":["document:keydown",["$event"]]}]}],"ngOnDestroy":[{"__symbolic":"method"}],"setProgress":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio-change.js","sourceRoot":"","sources":["../../../../../../libs/angular-components/src/lib/radio/radio-change.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;CAKxB","sourcesContent":["import { GoARadioComponent } from './radio.component';\n\nexport class GoARadioChange {\n /** The source radiobutton of the event. */\n source: GoARadioComponent;\n /** The new `checked` value of the radiobutton. */\n checked: boolean;\n }\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GoARadioChange":{"__symbolic":"class"}}}]
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, forwardRef, Input, Output, EventEmitter, ChangeDetectorRef } from '@angular/core';
|
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
-
import { GoARadioService } from './radio.service';
|
|
4
|
-
/**
|
|
5
|
-
* Control value accessor to use for the component's provider
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
export const GOA_RADIO_CONTROL_VALUE_ACCESSOR = {
|
|
9
|
-
provide: NG_VALUE_ACCESSOR,
|
|
10
|
-
useExisting: forwardRef(() => GoARadioComponent),
|
|
11
|
-
multi: true
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Radiobutton component with Government of Alberta styling.
|
|
15
|
-
*/
|
|
16
|
-
export class GoARadioComponent {
|
|
17
|
-
constructor(_changeDetector, _radioService) {
|
|
18
|
-
this._changeDetector = _changeDetector;
|
|
19
|
-
this._radioService = _radioService;
|
|
20
|
-
/**
|
|
21
|
-
* The position to display the label/text for the radiobutton. Valid values are before and after.
|
|
22
|
-
*/
|
|
23
|
-
this.labelPosition = 'after';
|
|
24
|
-
/**
|
|
25
|
-
* Event emitted containing the source radiobutton, and whether or not it is checked.
|
|
26
|
-
*/
|
|
27
|
-
this.selectionChange = new EventEmitter();
|
|
28
|
-
/**
|
|
29
|
-
* @ignore
|
|
30
|
-
*/
|
|
31
|
-
this._propagateChange = (_) => { };
|
|
32
|
-
this.uniqueId = `goa-radiobutton-${GoARadioComponent.idNum++}`;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Lifecycle hook OnInit. Used to subscribe to radio change messages from the radioService in order to know whether or not
|
|
36
|
-
* this radio should be checked or not.
|
|
37
|
-
* @ignore
|
|
38
|
-
*/
|
|
39
|
-
ngOnInit() {
|
|
40
|
-
this.radioServiceSubscription = this._radioService.radioChangeMessage.subscribe(rcm => {
|
|
41
|
-
if (rcm && rcm.source && rcm.source.name === this.name && rcm.source.uniqueId !== this.uniqueId) {
|
|
42
|
-
this.checked = false;
|
|
43
|
-
this._changeDetector.detectChanges();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Lifecycle hook OnDestroy. Used to unsubscribe from the radio change messages.
|
|
49
|
-
* @ignore
|
|
50
|
-
*/
|
|
51
|
-
ngOnDestroy() {
|
|
52
|
-
this.radioServiceSubscription.unsubscribe();
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Boolean indicating if the radiobutton is required and not checked
|
|
56
|
-
* @ignore
|
|
57
|
-
*/
|
|
58
|
-
hasError() {
|
|
59
|
-
return this.required && !this.checked;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Marks the radio button as needing checking for change detection.
|
|
63
|
-
* This method is exposed because the parent radio group will directly
|
|
64
|
-
* update bound properties of the radio button.
|
|
65
|
-
*/
|
|
66
|
-
markForCheck() {
|
|
67
|
-
// When group value changes, the button will not be notified. Use `markForCheck` to explicitly
|
|
68
|
-
// update radio button's status
|
|
69
|
-
this._changeDetector.markForCheck();
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Implemented as part of ControlValueAccessor.
|
|
73
|
-
* @param value The model bound property, i.e. the value of checked
|
|
74
|
-
* @ignore
|
|
75
|
-
*/
|
|
76
|
-
writeValue(value) {
|
|
77
|
-
if ((value !== undefined) && (value !== null)) {
|
|
78
|
-
this.checked = value;
|
|
79
|
-
this._changeDetector.detectChanges();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Implemented as part of ControlValueAccessor.
|
|
84
|
-
* @param fn The function to call on change. Provided by ControlValueAccessor
|
|
85
|
-
* @ignore
|
|
86
|
-
*/
|
|
87
|
-
registerOnChange(fn) {
|
|
88
|
-
this._propagateChange = fn;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Implemented as part of ControlValueAccessor.
|
|
92
|
-
* @param fn The function to call on touch. Provided by ControlValueAccessor
|
|
93
|
-
* @ignore
|
|
94
|
-
*/
|
|
95
|
-
registerOnTouched(fn) {
|
|
96
|
-
this._onTouchedCallback = fn;
|
|
97
|
-
}
|
|
98
|
-
;
|
|
99
|
-
/**
|
|
100
|
-
* User interaction event on click of the radiobutton or its label to indicate toggling of the current checked status.
|
|
101
|
-
* Emits selectionChange to parent components.
|
|
102
|
-
* @ignore
|
|
103
|
-
*/
|
|
104
|
-
onClick() {
|
|
105
|
-
// flip the checked state of this radio
|
|
106
|
-
this.checked = !this.checked;
|
|
107
|
-
// emit radio change event for those interested
|
|
108
|
-
const radioChange = {
|
|
109
|
-
source: this,
|
|
110
|
-
checked: this.checked
|
|
111
|
-
};
|
|
112
|
-
this._propagateChange(this.checked);
|
|
113
|
-
this.selectionChange.emit(radioChange);
|
|
114
|
-
// notify other radios in group/with same name via radio service so they know to flip their states to not checked
|
|
115
|
-
this._radioService.selectRadio(radioChange);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Used to generate unique Id for this component
|
|
120
|
-
* @ignore
|
|
121
|
-
*/
|
|
122
|
-
GoARadioComponent.idNum = 0;
|
|
123
|
-
GoARadioComponent.decorators = [
|
|
124
|
-
{ type: Component, args: [{
|
|
125
|
-
selector: 'goa-radio',
|
|
126
|
-
template: "<div\n class=\"goa-radio\"\n [ngClass]=\"{\n 'goa-radio-disabled': disabled,\n 'has-error': hasError(),\n 'goa-radio-label-before': labelPosition === 'before'\n }\"\n>\n <div class=\"goa-radio-inline-block\">\n <label class=\"goa-radio-layout\" [attr.for]=\"uniqueId\">\n <div\n class=\"goa-radio-container\"\n [ngClass]=\"{ 'goa-radio-selected': checked }\"\n >\n <input\n type=\"radio\"\n [id]=\"uniqueId\"\n [(checked)]=\"checked\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.value]=\"value\"\n [name]=\"name\"\n (change)=\"onClick()\"\n />\n <svg\n *ngIf=\"checked\"\n id=\"radiomark\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n >\n <circle\n id=\"Ellipse_128\"\n data-name=\"Ellipse 128\"\n cx=\"6\"\n cy=\"6\"\n r=\"6\"\n fill=\"#fff\"\n />\n </svg>\n </div>\n <span class=\"goa-radio-label\">\n <ng-content></ng-content>\n </span>\n </label>\n </div>\n</div>\n",
|
|
127
|
-
//register our custom ControlValueAccessor with angular DI system so angular knows how to get instance of it for ngModel binding
|
|
128
|
-
providers: [GOA_RADIO_CONTROL_VALUE_ACCESSOR],
|
|
129
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
130
|
-
styles: [".goa-radio{margin-bottom:10px}.goa-radio input[type=radio]{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;outline:0;-webkit-appearance:none}.goa-radio .goa-radio-label{z-index:2;box-sizing:border-box;margin:0;padding:0 0 0 8px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.goa-radio.goa-radio-disabled{opacity:1%}.goa-radio.goa-radio-disabled .goa-radio-label{cursor:default}.goa-radio.has-error .goa-radio-container{border:2px solid #fc1921;color:#fc1921}.goa-radio.has-error .goa-radio-container svg{fill:#fc1921}.goa-radio .goa-radio-container{z-index:2;box-sizing:border-box;margin:0;border:1px solid #666;border-radius:12px;height:24px;width:24px;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:3px}.goa-radio .goa-radio-container svg{fill:#fff}.goa-radio .goa-radio-container.goa-radio-selected{background-color:#0070c4}.goa-radio .goa-radio-container.goa-radio-selected .goa-radiomark{display:block!important}.goa-radio .goa-radio-container:hover:not(.goa-radio-selected){background-color:#f1f1f1}.goa-radio .goa-radio-container:focus-within{box-shadow:0 0 0 3px #feba35;outline:none}.goa-radio.goa-radio-label-before .goa-radio-container{order:1;margin-left:8px;margin-right:auto}.goa-radio-layout{display:flex;flex-direction:row;align-items:center}.goa-radio-inline-block{display:inline-block;margin-bottom:5px;margin-top:5px;margin-left:5px}"]
|
|
131
|
-
},] }
|
|
132
|
-
];
|
|
133
|
-
GoARadioComponent.ctorParameters = () => [
|
|
134
|
-
{ type: ChangeDetectorRef },
|
|
135
|
-
{ type: GoARadioService }
|
|
136
|
-
];
|
|
137
|
-
GoARadioComponent.propDecorators = {
|
|
138
|
-
name: [{ type: Input }],
|
|
139
|
-
value: [{ type: Input }],
|
|
140
|
-
checked: [{ type: Input }],
|
|
141
|
-
disabled: [{ type: Input }],
|
|
142
|
-
required: [{ type: Input }],
|
|
143
|
-
labelPosition: [{ type: Input }],
|
|
144
|
-
selectionChange: [{ type: Output }]
|
|
145
|
-
};
|
|
146
|
-
//# sourceMappingURL=radio.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../../../../libs/angular-components/src/lib/radio/radio.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAET,uBAAuB,EACvB,UAAU,EACV,KAAK,EACL,MAAM,EACN,YAAY,EACZ,iBAAiB,EAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC;IAChD,KAAK,EAAE,IAAI;CACZ,CAAA;AAED;;GAEG;AASH,MAAM,OAAO,iBAAiB;IAgE5B,YAAoB,eAAkC,EAClC,aAA8B;QAD9B,oBAAe,GAAf,eAAe,CAAmB;QAClC,kBAAa,GAAb,aAAa,CAAiB;QArBlD;;WAEG;QACM,kBAAa,GAAuB,OAAO,CAAC;QAEpD;;UAEE;QACO,oBAAe,GAAiC,IAAI,YAAY,EAAkB,CAAC;QAO7F;;WAEG;QACH,qBAAgB,GAAG,CAAC,CAAM,EAAE,EAAE,GAAG,CAAC,CAAC;QAIjC,IAAI,CAAC,QAAQ,GAAG,mBAAmB,iBAAiB,CAAC,KAAK,EAAE,EAAE,CAAC;IACjE,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;YACpF,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE;gBAC/F,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;gBACrB,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;aACtC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,WAAW;QACT,IAAI,CAAC,wBAAwB,CAAC,WAAW,EAAE,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,YAAY;QACV,8FAA8F;QAC9F,+BAA+B;QAC/B,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,KAAU;QACnB,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,EAAE;YAC7C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;SACtC;IACH,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,EAAO;QACtB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,EAAO;QACvB,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF;;;;OAIG;IACH,OAAO;QACL,uCAAuC;QACvC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAE7B,+CAA+C;QAC/C,MAAM,WAAW,GAAG;YAClB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI,CAAC,OAAO;SACJ,CAAC;QAEpB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEvC,iHAAiH;QACjH,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC;;AA/JD;;;GAGG;AACI,uBAAK,GAAG,CAAC,CAAC;;YAblB,SAAS,SAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,2uCAAqC;gBAErC,gIAAgI;gBAChI,SAAS,EAAE,CAAC,gCAAgC,CAAC;gBAC7C,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YA5BC,iBAAiB;YAMV,eAAe;;;mBA6CrB,KAAK;oBAKL,KAAK;sBAKL,KAAK;uBAKL,KAAK;uBAKL,KAAK;4BAKL,KAAK;8BAKL,MAAM","sourcesContent":["import {\n Component,\n OnInit,\n ChangeDetectionStrategy,\n forwardRef,\n Input,\n Output,\n EventEmitter,\n ChangeDetectorRef,\n OnDestroy\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { GoARadioChange } from './radio-change';\nimport { GoARadioService } from './radio.service';\n\n/**\n * Control value accessor to use for the component's provider\n * @ignore\n */\nexport const GOA_RADIO_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => GoARadioComponent),\n multi: true\n}\n\n/**\n * Radiobutton component with Government of Alberta styling.\n */\n@Component({\n selector: 'goa-radio',\n templateUrl: './radio.component.html',\n styleUrls: ['./radio.component.scss'],\n //register our custom ControlValueAccessor with angular DI system so angular knows how to get instance of it for ngModel binding\n providers: [GOA_RADIO_CONTROL_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class GoARadioComponent implements ControlValueAccessor, OnInit, OnDestroy {\n /**\n * Used to generate unique Id for this component\n * @ignore\n */\n static idNum = 0;\n\n /**\n * Unique Id for this component\n * @ignore\n */\n uniqueId: string;\n\n /**\n * Reference to the subscription to the radio change events so it can be unsubscribed on destroy\n * @ignore\n */\n radioServiceSubscription: Subscription;\n\n /**\n * Indicates the \"group\" or set of radios this radio belongs to.\n */\n @Input() name: string;\n\n /**\n * Value/unique identifier for the object the radiobutton represents.\n */\n @Input() value: any;\n\n /**\n * Boolean indicating whether or not the radiobutton is checked/selected.\n */\n @Input() checked: boolean;\n\n /**\n * Boolean indicating whether or not the radiobutton is disabled.\n */\n @Input() disabled: boolean;\n\n /**\n * Boolean indicating whether or not the radiobutton is required.\n */\n @Input() required: boolean;\n\n /**\n * The position to display the label/text for the radiobutton. Valid values are before and after.\n */\n @Input() labelPosition: 'before' | 'after' = 'after';\n\n /**\n * Event emitted containing the source radiobutton, and whether or not it is checked.\n */\n @Output() selectionChange: EventEmitter<GoARadioChange> = new EventEmitter<GoARadioChange>();\n\n /**\n * @ignore\n */\n _onTouchedCallback: () => void;\n\n /**\n * @ignore\n */\n _propagateChange = (_: any) => { };\n\n constructor(private _changeDetector: ChangeDetectorRef,\n private _radioService: GoARadioService) {\n this.uniqueId = `goa-radiobutton-${GoARadioComponent.idNum++}`;\n }\n\n /**\n * Lifecycle hook OnInit. Used to subscribe to radio change messages from the radioService in order to know whether or not\n * this radio should be checked or not.\n * @ignore\n */\n ngOnInit() {\n this.radioServiceSubscription = this._radioService.radioChangeMessage.subscribe(rcm => {\n if (rcm && rcm.source && rcm.source.name === this.name && rcm.source.uniqueId !== this.uniqueId) {\n this.checked = false;\n this._changeDetector.detectChanges();\n }\n });\n }\n\n /**\n * Lifecycle hook OnDestroy. Used to unsubscribe from the radio change messages.\n * @ignore\n */\n ngOnDestroy(): void {\n this.radioServiceSubscription.unsubscribe();\n }\n\n /**\n * Boolean indicating if the radiobutton is required and not checked\n * @ignore\n */\n hasError(): boolean {\n return this.required && !this.checked;\n }\n\n /**\n * Marks the radio button as needing checking for change detection.\n * This method is exposed because the parent radio group will directly\n * update bound properties of the radio button.\n */\n markForCheck(): void {\n // When group value changes, the button will not be notified. Use `markForCheck` to explicitly\n // update radio button's status\n this._changeDetector.markForCheck();\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n * @param value The model bound property, i.e. the value of checked\n * @ignore\n */\n writeValue(value: any) {\n if ((value !== undefined) && (value !== null)) {\n this.checked = value;\n this._changeDetector.detectChanges();\n }\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n * @param fn The function to call on change. Provided by ControlValueAccessor\n * @ignore\n */\n registerOnChange(fn: any) {\n this._propagateChange = fn;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n * @param fn The function to call on touch. Provided by ControlValueAccessor\n * @ignore\n */\n registerOnTouched(fn: any) {\n this._onTouchedCallback = fn;\n };\n\n /**\n * User interaction event on click of the radiobutton or its label to indicate toggling of the current checked status.\n * Emits selectionChange to parent components.\n * @ignore\n */\n onClick() {\n // flip the checked state of this radio\n this.checked = !this.checked;\n\n // emit radio change event for those interested\n const radioChange = {\n source: this,\n checked: this.checked\n } as GoARadioChange;\n\n this._propagateChange(this.checked);\n this.selectionChange.emit(radioChange);\n\n // notify other radios in group/with same name via radio service so they know to flip their states to not checked\n this._radioService.selectRadio(radioChange);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GOA_RADIO_CONTROL_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":21,"character":11},"useExisting":{"__symbolic":"reference","name":"GoARadioComponent"},"multi":true},"GoARadioComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":29,"character":1},"arguments":[{"selector":"goa-radio","providers":[{"__symbolic":"reference","name":"GOA_RADIO_CONTROL_VALUE_ACCESSOR"}],"changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":35,"character":19},"member":"OnPush"},"template":"<div\n class=\"goa-radio\"\n [ngClass]=\"{\n 'goa-radio-disabled': disabled,\n 'has-error': hasError(),\n 'goa-radio-label-before': labelPosition === 'before'\n }\"\n>\n <div class=\"goa-radio-inline-block\">\n <label class=\"goa-radio-layout\" [attr.for]=\"uniqueId\">\n <div\n class=\"goa-radio-container\"\n [ngClass]=\"{ 'goa-radio-selected': checked }\"\n >\n <input\n type=\"radio\"\n [id]=\"uniqueId\"\n [(checked)]=\"checked\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.value]=\"value\"\n [name]=\"name\"\n (change)=\"onClick()\"\n />\n <svg\n *ngIf=\"checked\"\n id=\"radiomark\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n >\n <circle\n id=\"Ellipse_128\"\n data-name=\"Ellipse 128\"\n cx=\"6\"\n cy=\"6\"\n r=\"6\"\n fill=\"#fff\"\n />\n </svg>\n </div>\n <span class=\"goa-radio-label\">\n <ng-content></ng-content>\n </span>\n </label>\n </div>\n</div>\n","styles":[".goa-radio{margin-bottom:10px}.goa-radio input[type=radio]{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;outline:0;-webkit-appearance:none}.goa-radio .goa-radio-label{z-index:2;box-sizing:border-box;margin:0;padding:0 0 0 8px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.goa-radio.goa-radio-disabled{opacity:1%}.goa-radio.goa-radio-disabled .goa-radio-label{cursor:default}.goa-radio.has-error .goa-radio-container{border:2px solid #fc1921;color:#fc1921}.goa-radio.has-error .goa-radio-container svg{fill:#fc1921}.goa-radio .goa-radio-container{z-index:2;box-sizing:border-box;margin:0;border:1px solid #666;border-radius:12px;height:24px;width:24px;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:3px}.goa-radio .goa-radio-container svg{fill:#fff}.goa-radio .goa-radio-container.goa-radio-selected{background-color:#0070c4}.goa-radio .goa-radio-container.goa-radio-selected .goa-radiomark{display:block!important}.goa-radio .goa-radio-container:hover:not(.goa-radio-selected){background-color:#f1f1f1}.goa-radio .goa-radio-container:focus-within{box-shadow:0 0 0 3px #feba35;outline:none}.goa-radio.goa-radio-label-before .goa-radio-container{order:1;margin-left:8px;margin-right:auto}.goa-radio-layout{display:flex;flex-direction:row;align-items:center}.goa-radio-inline-block{display:inline-block;margin-bottom:5px;margin-top:5px;margin-left:5px}"]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":59,"character":3}}]}],"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":64,"character":3}}]}],"checked":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":69,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":74,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":79,"character":3}}]}],"labelPosition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":84,"character":3}}]}],"selectionChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":89,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":101,"character":39},{"__symbolic":"reference","module":"./radio.service","name":"GoARadioService","line":102,"character":37}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"hasError":[{"__symbolic":"method"}],"markForCheck":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"onClick":[{"__symbolic":"method"}]},"statics":{"idNum":0}}}}]
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { BehaviorSubject } from 'rxjs';
|
|
3
|
-
import { GoARadioChange } from './radio-change';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export class GoARadioService {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.radioChangeMessage = new BehaviorSubject(new GoARadioChange());
|
|
8
|
-
}
|
|
9
|
-
selectRadio(radioChange) {
|
|
10
|
-
this.radioChangeMessage.next(radioChange);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
GoARadioService.ɵprov = i0.ɵɵdefineInjectable({ factory: function GoARadioService_Factory() { return new GoARadioService(); }, token: GoARadioService, providedIn: "root" });
|
|
14
|
-
GoARadioService.decorators = [
|
|
15
|
-
{ type: Injectable, args: [{
|
|
16
|
-
providedIn: 'root',
|
|
17
|
-
},] }
|
|
18
|
-
];
|
|
19
|
-
GoARadioService.ctorParameters = () => [];
|
|
20
|
-
//# sourceMappingURL=radio.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"radio.service.js","sourceRoot":"","sources":["../../../../../../libs/angular-components/src/lib/radio/radio.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;;AAKhD,MAAM,OAAO,eAAe;IAG1B;QAFA,uBAAkB,GAAG,IAAI,eAAe,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;IAEhD,CAAC;IAEhB,WAAW,CAAC,WAAW;QACrB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;;;;YAVF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\nimport { GoARadioChange } from './radio-change';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GoARadioService {\n radioChangeMessage = new BehaviorSubject(new GoARadioChange());\n\n constructor() {}\n\n selectRadio(radioChange) {\n this.radioChangeMessage.next(radioChange);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GoARadioService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":4,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"selectRadio":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}}}]
|