@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,136 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter, forwardRef, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
-
export const GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
|
|
4
|
-
provide: NG_VALUE_ACCESSOR,
|
|
5
|
-
useExisting: forwardRef(() => GoACheckboxComponent),
|
|
6
|
-
multi: true
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Checkbox component with Government of Alberta styling.
|
|
10
|
-
* selector: goa-checkbox
|
|
11
|
-
*/
|
|
12
|
-
export class GoACheckboxComponent {
|
|
13
|
-
constructor(_changeDetectorRef) {
|
|
14
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
15
|
-
/**
|
|
16
|
-
* @ignore
|
|
17
|
-
*/
|
|
18
|
-
this._indeterminate = false;
|
|
19
|
-
/**
|
|
20
|
-
* The position to display the label/text for the checbox. Valid values are before and after.
|
|
21
|
-
*/
|
|
22
|
-
this.labelPosition = 'after';
|
|
23
|
-
/**
|
|
24
|
-
* Event emitted containing the source checkbox, and whether or not it is checked.
|
|
25
|
-
*/
|
|
26
|
-
this.selectionChange = new EventEmitter();
|
|
27
|
-
/**
|
|
28
|
-
* @ignore
|
|
29
|
-
*/
|
|
30
|
-
this._propagateChange = (_) => { };
|
|
31
|
-
this.uniqueId = `goa-checkbox-${GoACheckboxComponent.idNum++}`;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Boolean indicating whether or not the checkbox should display as indeterminate
|
|
35
|
-
* (i.e. it has associated 'child' checkboxes, some of which are selected).
|
|
36
|
-
*/
|
|
37
|
-
get indeterminate() { return this._indeterminate; }
|
|
38
|
-
set indeterminate(value) {
|
|
39
|
-
// only do something if value has changed from current
|
|
40
|
-
if (value !== this.indeterminate) {
|
|
41
|
-
this._indeterminate = value;
|
|
42
|
-
// can't be indeterminate and checked, so clear checked
|
|
43
|
-
if (this._indeterminate) {
|
|
44
|
-
this.checked = false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Boolean indicating if the checkbox is required and not checked
|
|
50
|
-
* @ignore
|
|
51
|
-
*/
|
|
52
|
-
hasError() {
|
|
53
|
-
return this.required && !this.checked;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Implemented as part of ControlValueAccessor.
|
|
57
|
-
* @param value The model bound property, i.e. the value of checked
|
|
58
|
-
* @ignore
|
|
59
|
-
*/
|
|
60
|
-
writeValue(value) {
|
|
61
|
-
if ((value !== undefined) && (value !== null)) {
|
|
62
|
-
this.checked = value;
|
|
63
|
-
this._changeDetectorRef.detectChanges();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Implemented as part of ControlValueAccessor.
|
|
68
|
-
* @param fn The function to call on change. Provided by ControlValueAccessor
|
|
69
|
-
* @ignore
|
|
70
|
-
*/
|
|
71
|
-
registerOnChange(fn) {
|
|
72
|
-
this._propagateChange = fn;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Implemented as part of ControlValueAccessor.
|
|
76
|
-
* @param fn The function to call on touch. Provided by ControlValueAccessor
|
|
77
|
-
* @ignore
|
|
78
|
-
*/
|
|
79
|
-
registerOnTouched(fn) {
|
|
80
|
-
this._onTouchedCallback = fn;
|
|
81
|
-
}
|
|
82
|
-
;
|
|
83
|
-
/**
|
|
84
|
-
* Toggles the checked value of the checkbox
|
|
85
|
-
* @ignore
|
|
86
|
-
*/
|
|
87
|
-
toggle() {
|
|
88
|
-
this.checked = !this.checked;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* User interaction event on click of the checkbox or its label to indicate toggling of the current checked status.
|
|
92
|
-
* Emits selectionChange to parent components.
|
|
93
|
-
* @ignore
|
|
94
|
-
*/
|
|
95
|
-
onChange(event) {
|
|
96
|
-
event.stopPropagation();
|
|
97
|
-
this.toggle();
|
|
98
|
-
// user manually clicking overrides indeterminate and sets it to false
|
|
99
|
-
// this is because if they click and set to checked/unchecked, all 'child' checkboxes should get set to
|
|
100
|
-
// checked/unchecked (by user routine, not here), so this checkbox is no longer indeterminate
|
|
101
|
-
this.indeterminate = false;
|
|
102
|
-
const checkBoxChange = {
|
|
103
|
-
source: this,
|
|
104
|
-
checked: this.checked
|
|
105
|
-
};
|
|
106
|
-
this._propagateChange(this.checked);
|
|
107
|
-
this.selectionChange.emit(checkBoxChange);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @ignore
|
|
112
|
-
*/
|
|
113
|
-
GoACheckboxComponent.idNum = 0;
|
|
114
|
-
GoACheckboxComponent.decorators = [
|
|
115
|
-
{ type: Component, args: [{
|
|
116
|
-
selector: 'goa-checkbox',
|
|
117
|
-
template: "\n<div class=\"goa-checkbox\" [ngClass]=\"{'goa-checkbox-disabled': disabled, 'has-error': hasError(), 'goa-checkbox-label-before': labelPosition === 'before'}\">\n <label class=\"goa-checkbox-layout\" [attr.for]=\"uniqueId\">\n <div class=\"goa-checkbox-container\"\n [ngClass]=\"{'goa-checkbox-selected': checked, 'goa-checkbox-indeterminate': indeterminate}\">\n <input type=\"checkbox\"\n [id]=\"uniqueId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.value]=\"value\"\n (change)=\"onChange($event)\"\n />\n <svg *ngIf=\"checked\" id='checkmark' xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 12.18\" class=\"goa-checkmark\">\n <path d=\"M5.09,9.64,1.27,5.82,0,7.09l5.09,5.09L16,1.27,14.73,0Z\"/>\n </svg>\n <svg *ngIf=\"indeterminate\" id='dashmark' xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 15 2\" class=\"goa-indeterminate\">\n <rect width=\"15\" height=\"2\"/>\n </svg>\n </div>\n <div class=\"goa-checkbox-label\">\n <ng-content></ng-content>\n </div>\n </label>\n</div>\n",
|
|
118
|
-
//register our custom ControlValueAccessor with angular DI system so angular knows how to get instance of it for ngModel binding
|
|
119
|
-
providers: [GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR],
|
|
120
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
121
|
-
styles: [".goa-checkbox input[type=checkbox]{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-checkbox .goa-checkbox-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;height:46px;display:flex;align-items:center}.goa-checkbox.goa-checkbox-disabled{opacity:1%}.goa-checkbox.goa-checkbox-disabled .goa-checkbox-label{cursor:default}.goa-checkbox.has-error .goa-checkbox-container{border:2px solid #fc1921;color:#fc1921}.goa-checkbox.has-error .goa-checkbox-container svg{fill:#fc1921}.goa-checkbox .goa-checkbox-container{box-sizing:border-box;border:1px solid #666;border-radius:2px;height:24px;line-height:24px;width:24px;display:flex;flex-direction:column;justify-content:center;padding:3px}.goa-checkbox .goa-checkbox-container svg{display:none;flex:1 1 auto;fill:#fff}.goa-checkbox .goa-checkbox-container.goa-checkbox-selected{background-color:#0070c4}.goa-checkbox .goa-checkbox-container.goa-checkbox-selected .goa-checkmark{display:block!important}.goa-checkbox .goa-checkbox-container.goa-checkbox-selected .goa-indeterminate{display:none!important}.goa-checkbox .goa-checkbox-container.goa-checkbox-indeterminate{background-color:#0070c4}.goa-checkbox .goa-checkbox-container.goa-checkbox-indeterminate .goa-checkmark{display:none}.goa-checkbox .goa-checkbox-container.goa-checkbox-indeterminate .goa-indeterminate{display:block}.goa-checkbox .goa-checkbox-container:hover:not(.goa-checkbox-selected):not(.goa-checkbox-indeterminate){background-color:#f1f1f1}.goa-checkbox .goa-checkbox-container:focus-within{box-shadow:0 0 0 3px #feba35;outline:none}.goa-checkbox.goa-checkbox-label-before .goa-checkbox-container{order:1;margin-left:8px;margin-right:auto}.goa-checkbox-layout{display:inline-flex;align-items:center;line-height:2.5rem}"]
|
|
122
|
-
},] }
|
|
123
|
-
];
|
|
124
|
-
GoACheckboxComponent.ctorParameters = () => [
|
|
125
|
-
{ type: ChangeDetectorRef }
|
|
126
|
-
];
|
|
127
|
-
GoACheckboxComponent.propDecorators = {
|
|
128
|
-
value: [{ type: Input }],
|
|
129
|
-
checked: [{ type: Input }],
|
|
130
|
-
disabled: [{ type: Input }],
|
|
131
|
-
required: [{ type: Input }],
|
|
132
|
-
indeterminate: [{ type: Input }],
|
|
133
|
-
labelPosition: [{ type: Input }],
|
|
134
|
-
selectionChange: [{ type: Output }]
|
|
135
|
-
};
|
|
136
|
-
//# sourceMappingURL=checkbox.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.component.js","sourceRoot":"","sources":["../../../../../../libs/angular-components/src/lib/checkbox/checkbox.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGzE,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;IACnD,KAAK,EAAE,IAAI;CACZ,CAAA;AAED;;;GAGG;AASH,MAAM,OAAO,oBAAoB;IAyE/B,YAAoB,kBAAqC;QAArC,uBAAkB,GAAlB,kBAAkB,CAAmB;QA1CzD;;WAEG;QACK,mBAAc,GAAG,KAAK,CAAC;QAmB/B;;WAEG;QACM,kBAAa,GAAuB,OAAO,CAAC;QAEpD;;UAEE;QACO,oBAAe,GAAoC,IAAI,YAAY,EAAqB,CAAC;QAOnG;;WAEG;QACH,qBAAgB,GAAG,CAAC,CAAM,EAAE,EAAE,GAAG,CAAC,CAAC;QAGjC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAA;IAChE,CAAC;IAxCD;;;OAGG;IACH,IACI,aAAa,KAAc,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAC5D,IAAI,aAAa,CAAC,KAAc;QAC9B,sDAAsD;QACtD,IAAI,KAAK,KAAK,IAAI,CAAC,aAAa,EAAE;YAChC,IAAI,CAAC,cAAc,GAAG,KAAK,CA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C,CAAC;;YAblB,SAAS,SAAC;gBACT,QAAQ,EAAE,cAAc;gBACxB,0wCAAwC;gBAExC,gIAAgI;gBAChI,SAAS,EAAE,CAAC,mCAAmC,CAAC;gBAChD,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;YAvBC,iBAAiB;;;oBAsChB,KAAK;sBAKL,KAAK;uBAKL,KAAK;uBAKL,KAAK;4BAUL,KAAK;4BAiBL,KAAK;8BAKL,MAAM","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n forwardRef,\n ChangeDetectorRef,\n ChangeDetectionStrategy\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { GoACheckboxChange } from './checkbox-change';\n\nexport const GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => GoACheckboxComponent),\n multi: true\n}\n\n/**\n * Checkbox component with Government of Alberta styling.\n * selector: goa-checkbox\n */\n@Component({\n selector: 'goa-checkbox',\n templateUrl: './checkbox.component.html',\n styleUrls: ['./checkbox.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_CHECKBOX_CONTROL_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class GoACheckboxComponent implements ControlValueAccessor {\n\n /**\n * @ignore\n */\n static idNum = 0;\n /**\n * @ignore\n */\n uniqueId: string;\n\n /**\n * Value/unique identifier for the object the checkbox represents.\n */\n @Input() value: string;\n\n /**\n * Boolean indicating whether or not the checkbox is checked/selected.\n */\n @Input() checked: boolean;\n\n /**\n * Boolean indicating whether or not the checkbox is disabled.\n */\n @Input() disabled: boolean;\n\n /**\n * Boolean indicating whether or not the checkbox is required.\n */\n @Input() required: boolean;\n\n /**\n * @ignore\n */\n private _indeterminate = false;\n /**\n * Boolean indicating whether or not the checkbox should display as indeterminate\n * (i.e. it has associated 'child' checkboxes, some of which are selected).\n */\n @Input()\n get indeterminate(): boolean { return this._indeterminate; }\n set indeterminate(value: boolean) {\n // only do something if value has changed from current\n if (value !== this.indeterminate) {\n this._indeterminate = value;\n\n // can't be indeterminate and checked, so clear checked\n if (this._indeterminate){\n this.checked = false;\n }\n }\n }\n\n /**\n * The position to display the label/text for the checbox. Valid values are before and after.\n */\n @Input() labelPosition: 'before' | 'after' = 'after';\n\n /**\n * Event emitted containing the source checkbox, and whether or not it is checked.\n */\n @Output() selectionChange: EventEmitter<GoACheckboxChange> = new EventEmitter<GoACheckboxChange>();\n\n /**\n * @ignore\n */\n _onTouchedCallback: () => void;\n\n /**\n * @ignore\n */\n _propagateChange = (_: any) => { };\n\n constructor(private _changeDetectorRef: ChangeDetectorRef,) {\n this.uniqueId = `goa-checkbox-${GoACheckboxComponent.idNum++}`\n }\n\n /**\n * Boolean indicating if the checkbox is required and not checked\n * @ignore\n */\n hasError(): boolean {\n return this.required && !this.checked;\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._changeDetectorRef.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 * Toggles the checked value of the checkbox\n * @ignore\n */\n toggle(): void {\n this.checked = !this.checked;\n }\n\n /**\n * User interaction event on click of the checkbox or its label to indicate toggling of the current checked status.\n * Emits selectionChange to parent components.\n * @ignore\n */\n onChange(event) {\n event.stopPropagation();\n\n this.toggle();\n\n // user manually clicking overrides indeterminate and sets it to false\n // this is because if they click and set to checked/unchecked, all 'child' checkboxes should get set to\n // checked/unchecked (by user routine, not here), so this checkbox is no longer indeterminate\n this.indeterminate = false;\n\n const checkBoxChange = {\n source: this,\n checked: this.checked\n } as GoACheckboxChange;\n\n this._propagateChange(this.checked);\n this.selectionChange.emit(checkBoxChange);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR":{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":13,"character":11},"useExisting":{"__symbolic":"reference","name":"GoACheckboxComponent"},"multi":true},"GoACheckboxComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":22,"character":1},"arguments":[{"selector":"goa-checkbox","providers":[{"__symbolic":"reference","name":"GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR"}],"changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":28,"character":19},"member":"OnPush"},"template":"\n<div class=\"goa-checkbox\" [ngClass]=\"{'goa-checkbox-disabled': disabled, 'has-error': hasError(), 'goa-checkbox-label-before': labelPosition === 'before'}\">\n <label class=\"goa-checkbox-layout\" [attr.for]=\"uniqueId\">\n <div class=\"goa-checkbox-container\"\n [ngClass]=\"{'goa-checkbox-selected': checked, 'goa-checkbox-indeterminate': indeterminate}\">\n <input type=\"checkbox\"\n [id]=\"uniqueId\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n [required]=\"required\"\n [attr.value]=\"value\"\n (change)=\"onChange($event)\"\n />\n <svg *ngIf=\"checked\" id='checkmark' xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 12.18\" class=\"goa-checkmark\">\n <path d=\"M5.09,9.64,1.27,5.82,0,7.09l5.09,5.09L16,1.27,14.73,0Z\"/>\n </svg>\n <svg *ngIf=\"indeterminate\" id='dashmark' xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 15 2\" class=\"goa-indeterminate\">\n <rect width=\"15\" height=\"2\"/>\n </svg>\n </div>\n <div class=\"goa-checkbox-label\">\n <ng-content></ng-content>\n </div>\n </label>\n</div>\n","styles":[".goa-checkbox input[type=checkbox]{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-checkbox .goa-checkbox-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;height:46px;display:flex;align-items:center}.goa-checkbox.goa-checkbox-disabled{opacity:1%}.goa-checkbox.goa-checkbox-disabled .goa-checkbox-label{cursor:default}.goa-checkbox.has-error .goa-checkbox-container{border:2px solid #fc1921;color:#fc1921}.goa-checkbox.has-error .goa-checkbox-container svg{fill:#fc1921}.goa-checkbox .goa-checkbox-container{box-sizing:border-box;border:1px solid #666;border-radius:2px;height:24px;line-height:24px;width:24px;display:flex;flex-direction:column;justify-content:center;padding:3px}.goa-checkbox .goa-checkbox-container svg{display:none;flex:1 1 auto;fill:#fff}.goa-checkbox .goa-checkbox-container.goa-checkbox-selected{background-color:#0070c4}.goa-checkbox .goa-checkbox-container.goa-checkbox-selected .goa-checkmark{display:block!important}.goa-checkbox .goa-checkbox-container.goa-checkbox-selected .goa-indeterminate{display:none!important}.goa-checkbox .goa-checkbox-container.goa-checkbox-indeterminate{background-color:#0070c4}.goa-checkbox .goa-checkbox-container.goa-checkbox-indeterminate .goa-checkmark{display:none}.goa-checkbox .goa-checkbox-container.goa-checkbox-indeterminate .goa-indeterminate{display:block}.goa-checkbox .goa-checkbox-container:hover:not(.goa-checkbox-selected):not(.goa-checkbox-indeterminate){background-color:#f1f1f1}.goa-checkbox .goa-checkbox-container:focus-within{box-shadow:0 0 0 3px #feba35;outline:none}.goa-checkbox.goa-checkbox-label-before .goa-checkbox-container{order:1;margin-left:8px;margin-right:auto}.goa-checkbox-layout{display:inline-flex;align-items:center;line-height:2.5rem}"]}]}],"members":{"value":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":3}}]}],"checked":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":54,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":59,"character":3}}]}],"indeterminate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":69,"character":3}}]}],"labelPosition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":86,"character":3}}]}],"selectionChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":91,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":103,"character":42}]}],"hasError":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"toggle":[{"__symbolic":"method"}],"onChange":[{"__symbolic":"method"}]},"statics":{"idNum":0}}}}]
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, ContentChildren, EventEmitter, ViewChild, ElementRef, QueryList, ChangeDetectorRef } from '@angular/core';
|
|
2
|
-
import { GoAOptionComponent } from './option/option.component';
|
|
3
|
-
import { GoAOptionGroupComponent } from './option-group/option-group.component';
|
|
4
|
-
/**
|
|
5
|
-
* A dropdown component with Government of Alberta styling.
|
|
6
|
-
* selector: goa-dropdown
|
|
7
|
-
*/
|
|
8
|
-
export class GoADropdownComponent {
|
|
9
|
-
constructor(cdr) {
|
|
10
|
-
this.cdr = cdr;
|
|
11
|
-
/**
|
|
12
|
-
* boolean for if the dropdown is open.
|
|
13
|
-
* @ignore
|
|
14
|
-
*/
|
|
15
|
-
this._isOpen = false;
|
|
16
|
-
/**
|
|
17
|
-
* Is the required error tripped?
|
|
18
|
-
* @ignore
|
|
19
|
-
*/
|
|
20
|
-
this._requiredError = false;
|
|
21
|
-
/**
|
|
22
|
-
* This position config ensures that the top "start" corner of the overlay
|
|
23
|
-
* is aligned with with the bottom "start" of the origin by default (overlapping
|
|
24
|
-
* the trigger completely). If the panel cannot fit below the trigger, it
|
|
25
|
-
* will fall back to a position above the trigger.
|
|
26
|
-
* @ignore
|
|
27
|
-
*/
|
|
28
|
-
this._positions = [
|
|
29
|
-
{
|
|
30
|
-
originX: 'start',
|
|
31
|
-
originY: 'bottom',
|
|
32
|
-
overlayX: 'start',
|
|
33
|
-
overlayY: 'top',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
originX: 'start',
|
|
37
|
-
originY: 'top',
|
|
38
|
-
overlayX: 'start',
|
|
39
|
-
overlayY: 'bottom',
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
/**
|
|
43
|
-
* All options currently matching filter including groups.
|
|
44
|
-
* @ignore
|
|
45
|
-
*/
|
|
46
|
-
this._allFilteredOptions = [];
|
|
47
|
-
/**
|
|
48
|
-
* Whats the mode for typeahead.
|
|
49
|
-
*/
|
|
50
|
-
this.typeaheadMode = 'none';
|
|
51
|
-
/**
|
|
52
|
-
* Is the select disabled.
|
|
53
|
-
*/
|
|
54
|
-
this.disabled = false;
|
|
55
|
-
/**
|
|
56
|
-
* @ignore
|
|
57
|
-
*/
|
|
58
|
-
this._multiple = false;
|
|
59
|
-
/**
|
|
60
|
-
* @ignore
|
|
61
|
-
*/
|
|
62
|
-
this._required = false;
|
|
63
|
-
/**
|
|
64
|
-
* Event emitted containing the value field of all selected options when the selection changes.
|
|
65
|
-
*/
|
|
66
|
-
this.selectionChange = new EventEmitter();
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Update the selected options, select the options with the given ids
|
|
70
|
-
*/
|
|
71
|
-
set selectedIds(ids) {
|
|
72
|
-
if (this.allOptions === undefined) {
|
|
73
|
-
// aren't initialized yet, return
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (ids === null || ids === undefined) {
|
|
77
|
-
ids = [];
|
|
78
|
-
}
|
|
79
|
-
if (ids.length > 1 && this.multiple === false) {
|
|
80
|
-
throw new Error('Cannot select multiple options when the dropdown has multiple set to false.');
|
|
81
|
-
}
|
|
82
|
-
const selectedOptions = [];
|
|
83
|
-
this.allOptions.forEach(option => {
|
|
84
|
-
if (ids.includes(option.id)) {
|
|
85
|
-
option.selected = true;
|
|
86
|
-
selectedOptions.push(option);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
option.selected = false;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
this.selectionChanged(selectedOptions, true);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Is multiple selection?
|
|
96
|
-
*/
|
|
97
|
-
set multiple(value) {
|
|
98
|
-
this._multiple = value;
|
|
99
|
-
if (this._multiple === false) {
|
|
100
|
-
// If we have changed from multiple to no multiple then deselect everything.
|
|
101
|
-
this.selectedItems.forEach(option => {
|
|
102
|
-
option.selected = false;
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
get multiple() {
|
|
107
|
-
return this._multiple;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Is a selection required?
|
|
111
|
-
*/
|
|
112
|
-
set required(value) {
|
|
113
|
-
this._required = value;
|
|
114
|
-
this._requiredError = this.selectedItems.length === 0 && this._required === true;
|
|
115
|
-
}
|
|
116
|
-
get required() {
|
|
117
|
-
return this._required;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Lifecycle hook OnInit
|
|
121
|
-
* @ignore
|
|
122
|
-
*/
|
|
123
|
-
/* eslint-disable @angular-eslint/no-empty-lifecycle-method */
|
|
124
|
-
ngOnInit() { }
|
|
125
|
-
/**
|
|
126
|
-
* Lifecycle hook AfterViewInit
|
|
127
|
-
* @ignore
|
|
128
|
-
*/
|
|
129
|
-
ngAfterViewInit() {
|
|
130
|
-
this._triggerRect = this.textInput.nativeElement.getBoundingClientRect();
|
|
131
|
-
this._filteredOptions = [...this.options];
|
|
132
|
-
this._allFilteredOptions = [...this.allOptions];
|
|
133
|
-
if (this.selectedItems.length > 0) {
|
|
134
|
-
this.setTextInput(this.selectedItems[0].label);
|
|
135
|
-
}
|
|
136
|
-
// The template output cache is populated by child components during render,
|
|
137
|
-
// so tell angular that there have been changes during the render here.
|
|
138
|
-
this.cdr.detectChanges();
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Called when user updates the text in the searchbox.
|
|
142
|
-
* @param text The text of the input
|
|
143
|
-
* @ignore
|
|
144
|
-
*/
|
|
145
|
-
onFilterChange(text) {
|
|
146
|
-
// open the dropdown if it is not already
|
|
147
|
-
if (!this._isOpen === true) {
|
|
148
|
-
this._isOpen = true;
|
|
149
|
-
}
|
|
150
|
-
this.filterOptions(text);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Handler for keyboard events when menu is open.
|
|
154
|
-
* @param event keyboard event
|
|
155
|
-
* @ignore
|
|
156
|
-
*/
|
|
157
|
-
overlayKeydown(event) {
|
|
158
|
-
if (event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
159
|
-
this.optionClicked(this._activeOption);
|
|
160
|
-
}
|
|
161
|
-
else if (event.code === 'ArrowDown') {
|
|
162
|
-
this._activeIndex = (this._activeIndex + 1) % this._allFilteredOptions.length;
|
|
163
|
-
this._activeOption = this._allFilteredOptions[this._activeIndex];
|
|
164
|
-
}
|
|
165
|
-
else if (event.code === 'ArrowUp') {
|
|
166
|
-
if (this._activeIndex > 0) {
|
|
167
|
-
this._activeIndex = this._activeIndex - 1;
|
|
168
|
-
this._activeOption = this._allFilteredOptions[this._activeIndex];
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Sets the active option. Active option is the option that when enter is pressed is selected.
|
|
174
|
-
* @param option The option to make the active option
|
|
175
|
-
* @ignore
|
|
176
|
-
*/
|
|
177
|
-
setActiveOption(option) {
|
|
178
|
-
this._activeOption = option;
|
|
179
|
-
this._activeIndex = this._allFilteredOptions.findIndex((filteredOption) => filteredOption.id === option.id);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Handler for when the input is clicked.
|
|
183
|
-
* @ignore
|
|
184
|
-
*/
|
|
185
|
-
inputClicked() {
|
|
186
|
-
if (this.disabled === false) {
|
|
187
|
-
this._isOpen = !this._isOpen;
|
|
188
|
-
// set the active option to the first in the list
|
|
189
|
-
if (this._allFilteredOptions.length > 0) {
|
|
190
|
-
this._activeOption = this._allFilteredOptions[0];
|
|
191
|
-
this._activeIndex = 0;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Handler for when descendant an option is clicked.
|
|
197
|
-
* @ignore
|
|
198
|
-
*/
|
|
199
|
-
optionClicked(option) {
|
|
200
|
-
let selectedOptions = [];
|
|
201
|
-
if (this.multiple === true) {
|
|
202
|
-
option.selected = !option.selected;
|
|
203
|
-
selectedOptions = this.selectedItems;
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
option.selected = !option.selected;
|
|
207
|
-
this.selectedItems.forEach((o) => {
|
|
208
|
-
if (option.id !== o.id) {
|
|
209
|
-
// change all options that weren't selected to false without notifying change
|
|
210
|
-
o.selected = false;
|
|
211
|
-
}
|
|
212
|
-
selectedOptions = [option];
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
this.selectionChanged(selectedOptions, true);
|
|
216
|
-
if (this.multiple === false) {
|
|
217
|
-
// close the dropdown if we are in single selection mode
|
|
218
|
-
this._isOpen = false;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Update view when selection changes
|
|
223
|
-
* @param options
|
|
224
|
-
* @ignore
|
|
225
|
-
*/
|
|
226
|
-
selectionChanged(options, emitEvent) {
|
|
227
|
-
if (options.length > 0) {
|
|
228
|
-
const selectedOptions = options.map(o => o.label).join(', ');
|
|
229
|
-
this._requiredError = false;
|
|
230
|
-
this.setTextInput(selectedOptions);
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
this._requiredError = this.required;
|
|
234
|
-
this.setTextInput('');
|
|
235
|
-
}
|
|
236
|
-
if (emitEvent === true) {
|
|
237
|
-
this.emitChange(options);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Emit selection change
|
|
242
|
-
* @ignore
|
|
243
|
-
*/
|
|
244
|
-
emitChange(options) {
|
|
245
|
-
const values = options.map((option) => option.value);
|
|
246
|
-
this.selectionChange.emit(values);
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Gets all the currently selected options
|
|
250
|
-
* @ignore
|
|
251
|
-
*/
|
|
252
|
-
get selectedItems() {
|
|
253
|
-
if (this.allOptions === undefined) {
|
|
254
|
-
return [];
|
|
255
|
-
}
|
|
256
|
-
return [...this.allOptions.filter((option) => option.selected === true)];
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Set the text of the input.
|
|
260
|
-
* @param value The value to set
|
|
261
|
-
* @ignore
|
|
262
|
-
*/
|
|
263
|
-
setTextInput(value) {
|
|
264
|
-
if (this.textInput) {
|
|
265
|
-
this.textInput.nativeElement.value = value;
|
|
266
|
-
// Exact matches show whole list?
|
|
267
|
-
this.filterOptions('');
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Update the filtered options with the passed in filter text.
|
|
272
|
-
* @param filterText The text to filter by
|
|
273
|
-
* @ignore
|
|
274
|
-
*/
|
|
275
|
-
filterOptions(filterText) {
|
|
276
|
-
this.optionGroups.forEach(group => {
|
|
277
|
-
group._filteredOptions = group.options.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));
|
|
278
|
-
});
|
|
279
|
-
this._filteredOptions = this.options.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));
|
|
280
|
-
this._allFilteredOptions = this.allOptions.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));
|
|
281
|
-
// The filters have changed so update the active option incase it has been filtered out.
|
|
282
|
-
this._activeOption = this._allFilteredOptions[this._activeIndex % this._allFilteredOptions.length];
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Filter for typeahead with logic for what mode we are in.
|
|
286
|
-
* @param option
|
|
287
|
-
* @ignore
|
|
288
|
-
*/
|
|
289
|
-
typeaheadFilter(filterText, typeaheadMode, option) {
|
|
290
|
-
if (typeaheadMode === 'none' || this.typeaheadMode === undefined) {
|
|
291
|
-
return true;
|
|
292
|
-
}
|
|
293
|
-
if (typeaheadMode === 'startsWith') {
|
|
294
|
-
return option.label.toLocaleLowerCase().startsWith(filterText.toLocaleLowerCase());
|
|
295
|
-
}
|
|
296
|
-
if (typeaheadMode === 'contains') {
|
|
297
|
-
return option.label.toLocaleLowerCase().includes(filterText.toLocaleLowerCase());
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
GoADropdownComponent.decorators = [
|
|
302
|
-
{ type: Component, args: [{
|
|
303
|
-
selector: 'goa-dropdown',
|
|
304
|
-
template: "<div class=\"goa-dropdown\" [ngClass]=\"{\n 'single-selection': multiple === false,\n 'has-error': _requiredError === true,\n 'opened': _isOpen,\n 'disabled': disabled === true\n }\"> \n <label class=\"dropdown-label\">{{label}}\n <span *ngIf=\"required\" class=\"required-label\" i18n=\"Required label for dropdown\">(Required)</span>\n <div (click)=\"inputClicked()\" class=\"dropdown-grouping\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n <i class=\"goa-select-icon\"></i>\n <input class=\"dropdown-textbox margin-override\" \n #textInput \n (input)=\"onFilterChange($event.target.value)\"\n type=\"text\" \n [attr.readonly]=\"typeaheadMode === 'none' ? 'readonly' : null\"\n [attr.disabled]=\"disabled === true ? 'true' : null\"\n placeholder=\"{{description}}\"> \n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"20\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"_isOpen = false\"\n (overlayKeydown)=\"overlayKeydown($event)\"\n (detach)=\"_isOpen = false\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"_isOpen\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n [cdkConnectedOverlayMinWidth]=\"_triggerRect?.width\"\n [cdkConnectedOverlayHeight]=\"menuHeight\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n >\n <div class=\"dropdown-menu\">\n <div *ngFor=\"let optionGroup of optionGroups\" class=\"option-group\">\n <div *ngIf=\"optionGroup._filteredOptions.length > 0\">\n <div class=\"option-group-label\">\n {{optionGroup.label}}\n </div>\n <!--Grab the <option> template from the GoAOption -->\n <div class=\"option\"\n [ngClass]=\"{\n 'selected': option.selected,\n 'active': option.id === _activeOption.id\n }\"\n *ngFor=\"let option of (optionGroup._filteredOptions)\" \n (click)=\"optionClicked(option)\"\n (mouseover)=\"setActiveOption(option)\">\n <ng-template [ngTemplateOutlet]=\"option.optionTemplate\"></ng-template>\n </div>\n </div>\n </div>\n <!--Grab the <option> template from the GoAOption -->\n <div class=\"option\" \n [ngClass]=\"{\n 'selected': option.selected,\n 'active': option.id === _activeOption.id\n }\"\n *ngFor=\"let option of (_filteredOptions)\" \n (click)=\"optionClicked(option)\"\n (mouseover)=\"setActiveOption(option)\"> \n <ng-template [ngTemplateOutlet]=\"option.optionTemplate\"></ng-template>\n </div>\n </div> \n </ng-template> \n </div>\n <span *ngIf=\"!_requiredError\" class=\"helper-text\">{{description}}</span>\n <span *ngIf=\"_requiredError === true\" class=\"error-text\" i18n=\"Required warning for dropdown\">At least one item must be selected.</span> \n </label>\n</div>\n",
|
|
305
|
-
styles: [".dropdown-overlay{position:absolute;top:0;left:0;right:0;bottom:0}.dropdown-menu{border:1px solid #dcdcdc;border-radius:4px;background:#fff;padding:0;margin-top:3px;width:100%;overflow-y:auto}.dropdown-menu .option-group .option-group-label{font-weight:700;padding:4px 12px}.dropdown-menu .option-group .option{font-weight:400;padding:4px 24px}.dropdown-menu .option{padding:4px 12px;color:#0070c4;border:1px solid #f1f1f1}.dropdown-menu .option.selected{background-color:#0070c4;color:#fff}.dropdown-menu .option.selected.active{background-color:#004f84;color:#fff}.dropdown-menu .option.active{background-color:#f1f1f1;color:#333}.goa-dropdown{position:relative}.goa-dropdown .dropdown-grouping input[type=text]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:30px!important}.goa-dropdown .dropdown-grouping.disabled{opacity:1%}.goa-dropdown .dropdown-grouping .dropdown-textbox{box-sizing:border-box;width:100%;margin:8px 0 0;padding:12px 8px 12px 12px;border-radius:4px;border:1px solid #666;font-size:18px;font-weight:400;color:#0070c4;-webkit-appearance:none;-moz-appearance:none;appearance:none}.goa-dropdown .dropdown-grouping .dropdown-textbox:disabled{opacity:.3;pointer-events:none}.goa-dropdown .dropdown-grouping .dropdown-textbox::-ms-expand{display:none}.goa-dropdown .dropdown-grouping .dropdown-textbox:hover{border:1px solid #0070c4}.goa-dropdown .dropdown-grouping .dropdown-textbox:focus{box-shadow:0 0 0 3px #feba35;outline:none}.goa-dropdown .dropdown-grouping .dropdown-textbox.margin-override{margin:0}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter{font-size:14px!important;border:none!important;margin:0!important;box-sizing:border-box;width:100%;margin:8px 0 0;padding:12px 8px 12px 12px;border-radius:4px;border:1px solid #666;font-size:18px;font-weight:400;color:#0070c4;-webkit-appearance:none;-moz-appearance:none;appearance:none}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter:disabled{opacity:.3;pointer-events:none}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter::-ms-expand{display:none}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter:hover{border:1px solid #0070c4}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter:focus{box-shadow:0 0 0 3px #feba35;box-shadow:none!important;outline:none}.goa-dropdown i.goa-select-icon{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cpath class='' opacity='1' d='M11.29,15.7a1,1,0,0,0,1.41,0l6-6A1,1,0,1,0,17.29,8.3L12,13.58,6.71,8.3a1,1,0,0,0-1.42,0,1,1,0,0,0,0,1.41Z'/%3E%3C/svg%3E%0A\");left:auto;right:8px;width:24px;height:24px;pointer-events:none;position:absolute;margin-top:16px;color:#0070c4}.goa-dropdown.disabled i.goa-select-icon,.goa-dropdown i.goa-select-icon{background-repeat:no-repeat;background-size:contain;background-position:50%}.goa-dropdown.disabled i.goa-select-icon{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cpath class='' opacity='0.3' d='M11.29,15.7a1,1,0,0,0,1.41,0l6-6A1,1,0,1,0,17.29,8.3L12,13.58,6.71,8.3a1,1,0,0,0-1.42,0,1,1,0,0,0,0,1.41Z'/%3E%3C/svg%3E%0A\")}.goa-dropdown.opened i.goa-select-icon{transform:rotate(180deg)}.goa-dropdown.has-error .dropdown-grouping .dropdown-textbox{border:2px solid #fc1921}.goa-dropdown .dropdown-label{font-size:18px;font-weight:700;color:#333}.goa-dropdown .required-label{margin-left:8px;font-size:14px;color:#666}.goa-dropdown .helper-text{font-size:14px;font-weight:400;color:#333}.goa-dropdown .error-text{color:#fc1921;font-size:14px}"]
|
|
306
|
-
},] }
|
|
307
|
-
];
|
|
308
|
-
GoADropdownComponent.ctorParameters = () => [
|
|
309
|
-
{ type: ChangeDetectorRef }
|
|
310
|
-
];
|
|
311
|
-
GoADropdownComponent.propDecorators = {
|
|
312
|
-
typeaheadMode: [{ type: Input }],
|
|
313
|
-
menuHeight: [{ type: Input }],
|
|
314
|
-
label: [{ type: Input }],
|
|
315
|
-
description: [{ type: Input }],
|
|
316
|
-
selectedIds: [{ type: Input }],
|
|
317
|
-
disabled: [{ type: Input }],
|
|
318
|
-
multiple: [{ type: Input }],
|
|
319
|
-
required: [{ type: Input }],
|
|
320
|
-
textInput: [{ type: ViewChild, args: ['textInput',] }],
|
|
321
|
-
allOptions: [{ type: ContentChildren, args: [GoAOptionComponent, { descendants: true },] }],
|
|
322
|
-
options: [{ type: ContentChildren, args: [GoAOptionComponent, { descendants: false },] }],
|
|
323
|
-
optionGroups: [{ type: ContentChildren, args: [GoAOptionGroupComponent, { descendants: false },] }],
|
|
324
|
-
selectionChange: [{ type: Output }]
|
|
325
|
-
};
|
|
326
|
-
//# sourceMappingURL=dropdown.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.js","sourceRoot":"","sources":["../../../../../../libs/angular-components/src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,KAAK,EACL,MAAM,EACN,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EACV,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAIhF;;;GAGG;AAMH,MAAM,OAAO,oBAAoB;IA4L/B,YAAoB,GAAsB;QAAtB,QAAG,GAAH,GAAG,CAAmB;QA3L1C;;;WAGG;QACH,YAAO,GAAG,KAAK,CAAC;QAEhB;;;WAGG;QACH,mBAAc,GAAG,KAAK,CAA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xB,42HAAwC;;aAEzC;;;YAhBC,iBAAiB;;;4BAqFhB,KAAK;yBAKL,KAAK;oBAKL,KAAK;0BAKL,KAAK;0BAKL,KAAK;uBAgCL,KAAK;uBAKL,KAAK;uBAqBL,KAAK;wBAiBL,SAAS,SAAC,WAAW;yBAMrB,eAAe,SAAC,kBAAkB,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;sBAMzD,eAAe,SAAC,kBAAkB,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;2BAM1D,eAAe,SAAC,uBAAuB,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;8BAK/D,MAAM","sourcesContent":["import {\n Component,\n OnInit,\n AfterViewInit,\n Input,\n Output,\n ContentChildren,\n EventEmitter,\n ViewChild,\n ElementRef,\n QueryList,\n ChangeDetectorRef\n} from '@angular/core';\n\nimport { GoAOptionComponent } from './option/option.component';\nimport { GoAOptionGroupComponent } from './option-group/option-group.component';\n\nimport { ConnectedPosition } from '@angular/cdk/overlay';\n\n/**\n * A dropdown component with Government of Alberta styling.\n * selector: goa-dropdown\n */\n@Component({\n selector: 'goa-dropdown',\n templateUrl: './dropdown.component.html',\n styleUrls: ['./dropdown.component.scss']\n})\nexport class GoADropdownComponent implements OnInit, AfterViewInit {\n /**\n * boolean for if the dropdown is open.\n * @ignore\n */\n _isOpen = false;\n\n /**\n * Is the required error tripped?\n * @ignore\n */\n _requiredError = false;\n\n /**\n * Bounding box of textInput.\n * @ignore\n */\n _triggerRect;\n\n /**\n * This position config ensures that the top \"start\" corner of the overlay\n * is aligned with with the bottom \"start\" of the origin by default (overlapping\n * the trigger completely). If the panel cannot fit below the trigger, it\n * will fall back to a position above the trigger.\n * @ignore\n */\n _positions: ConnectedPosition[] = [\n {\n originX: 'start',\n originY: 'bottom',\n overlayX: 'start',\n overlayY: 'top',\n },\n {\n originX: 'start',\n originY: 'top',\n overlayX: 'start',\n overlayY: 'bottom',\n },\n ];\n\n /**\n * The current active option\n * @ignore\n */\n _activeOption: GoAOptionComponent;\n\n /**\n * The current active index\n * @ignore\n */\n _activeIndex;\n\n /**\n * All options currently matching filter including groups.\n * @ignore\n */\n _allFilteredOptions: Array<GoAOptionComponent> = [];\n\n /**\n * The list of filtered options to show in the view.\n * @ignore\n */\n _filteredOptions: Array<GoAOptionComponent>;\n\n /**\n * Whats the mode for typeahead.\n */\n @Input() typeaheadMode: 'none' | 'contains' | 'startsWith' = 'none';\n\n /**\n * The height for the dropdown. If none is set the dropdown grows until it reaches the viewport edge.\n */\n @Input() menuHeight: number;\n\n /**\n * The label for the dropdown.\n */\n @Input() label: string;\n\n /**\n * Helper text description of the dropdown.\n */\n @Input() description: string;\n\n /**\n * Update the selected options, select the options with the given ids\n */\n @Input()\n set selectedIds(ids: Array<string>) {\n if (this.allOptions === undefined) {\n // aren't initialized yet, return\n return;\n }\n\n if (ids === null || ids === undefined) {\n ids = [];\n }\n\n if (ids.length > 1 && this.multiple === false) {\n throw new Error('Cannot select multiple options when the dropdown has multiple set to false.');\n }\n\n const selectedOptions = [];\n this.allOptions.forEach(option => {\n if (ids.includes(option.id)) {\n option.selected = true;\n selectedOptions.push(option);\n }\n else {\n option.selected = false;\n }\n });\n\n this.selectionChanged(selectedOptions, true);\n }\n\n /**\n * Is the select disabled.\n */\n @Input() disabled = false;\n\n /**\n * Is multiple selection?\n */\n @Input()\n set multiple(value: boolean) {\n this._multiple = value;\n if (this._multiple === false) {\n // If we have changed from multiple to no multiple then deselect everything.\n this.selectedItems.forEach(option => {\n option.selected = false;\n });\n }\n }\n get multiple(): boolean {\n return this._multiple;\n }\n /**\n * @ignore\n */\n private _multiple = false;\n\n /**\n * Is a selection required?\n */\n @Input()\n set required(value: boolean) {\n this._required = value;\n this._requiredError = this.selectedItems.length === 0 && this._required === true;\n }\n get required(): boolean {\n return this._required;\n }\n /**\n * @ignore\n */\n private _required = false;\n\n /**\n * The select element.\n * @ignore\n */\n @ViewChild('textInput') textInput: ElementRef<HTMLInputElement>;\n\n /**\n * All options.\n * @ignore\n */\n @ContentChildren(GoAOptionComponent, { descendants: true }) allOptions: QueryList<GoAOptionComponent>;\n\n /**\n * The top level options for rendering options.\n * @ignore\n */\n @ContentChildren(GoAOptionComponent, { descendants: false }) options: QueryList<GoAOptionComponent>;\n\n /**\n * The option groups for rendering.\n * @ignore\n */\n @ContentChildren(GoAOptionGroupComponent, { descendants: false }) optionGroups: QueryList<GoAOptionGroupComponent>;\n\n /**\n * Event emitted containing the value field of all selected options when the selection changes.\n */\n @Output() selectionChange = new EventEmitter<Array<any>>();\n\n constructor(private cdr: ChangeDetectorRef) { }\n\n /**\n * Lifecycle hook OnInit\n * @ignore\n */\n /* eslint-disable @angular-eslint/no-empty-lifecycle-method */\n ngOnInit() { }\n\n /**\n * Lifecycle hook AfterViewInit\n * @ignore\n */\n ngAfterViewInit() {\n this._triggerRect = this.textInput.nativeElement.getBoundingClientRect();\n\n this._filteredOptions = [...this.options];\n this._allFilteredOptions = [...this.allOptions];\n\n if (this.selectedItems.length > 0) {\n this.setTextInput(this.selectedItems[0].label);\n }\n\n // The template output cache is populated by child components during render,\n // so tell angular that there have been changes during the render here.\n this.cdr.detectChanges();\n }\n\n /**\n * Called when user updates the text in the searchbox.\n * @param text The text of the input\n * @ignore\n */\n onFilterChange(text: string) {\n // open the dropdown if it is not already\n if (!this._isOpen === true) {\n this._isOpen = true;\n }\n\n this.filterOptions(text);\n }\n\n /**\n * Handler for keyboard events when menu is open.\n * @param event keyboard event\n * @ignore\n */\n overlayKeydown(event: KeyboardEvent) {\n if (event.code === 'Enter' || event.code === 'NumpadEnter') {\n this.optionClicked(this._activeOption);\n }\n else if (event.code === 'ArrowDown') {\n this._activeIndex = (this._activeIndex + 1) % this._allFilteredOptions.length;\n this._activeOption = this._allFilteredOptions[this._activeIndex];\n }\n else if (event.code === 'ArrowUp') {\n if (this._activeIndex > 0) {\n this._activeIndex = this._activeIndex - 1;\n this._activeOption = this._allFilteredOptions[this._activeIndex];\n }\n }\n }\n\n /**\n * Sets the active option. Active option is the option that when enter is pressed is selected.\n * @param option The option to make the active option\n * @ignore\n */\n setActiveOption(option) {\n this._activeOption = option;\n this._activeIndex = this._allFilteredOptions.findIndex(\n (filteredOption) => filteredOption.id === option.id\n );\n }\n\n /**\n * Handler for when the input is clicked.\n * @ignore\n */\n inputClicked() {\n if (this.disabled === false) {\n this._isOpen = !this._isOpen;\n\n // set the active option to the first in the list\n if (this._allFilteredOptions.length > 0) {\n this._activeOption = this._allFilteredOptions[0];\n this._activeIndex = 0;\n }\n }\n }\n\n /**\n * Handler for when descendant an option is clicked.\n * @ignore\n */\n optionClicked(option: GoAOptionComponent) {\n let selectedOptions = [];\n\n if (this.multiple === true) {\n option.selected = !option.selected;\n selectedOptions = this.selectedItems;\n }\n else {\n option.selected = !option.selected;\n this.selectedItems.forEach((o) => {\n if (option.id !== o.id) {\n // change all options that weren't selected to false without notifying change\n o.selected = false;\n }\n\n selectedOptions = [option];\n });\n }\n\n this.selectionChanged(selectedOptions, true);\n\n if (this.multiple === false) {\n // close the dropdown if we are in single selection mode\n this._isOpen = false;\n }\n }\n\n /**\n * Update view when selection changes\n * @param options\n * @ignore\n */\n private selectionChanged(options: Array<GoAOptionComponent>, emitEvent: boolean) {\n if (options.length > 0) {\n const selectedOptions = options.map(o => o.label).join(', ')\n this._requiredError = false;\n this.setTextInput(selectedOptions);\n }\n else {\n this._requiredError = this.required;\n this.setTextInput('');\n }\n\n if (emitEvent === true) {\n this.emitChange(options);\n }\n }\n\n /**\n * Emit selection change\n * @ignore\n */\n private emitChange(options: Array<GoAOptionComponent>) {\n const values = options.map(\n (option) => option.value\n );\n\n this.selectionChange.emit(values);\n }\n\n /**\n * Gets all the currently selected options\n * @ignore\n */\n private get selectedItems(): Array<GoAOptionComponent> {\n if (this.allOptions === undefined) {\n return [];\n }\n\n return [...this.allOptions.filter(\n (option) => option.selected === true\n )];\n }\n\n /**\n * Set the text of the input.\n * @param value The value to set\n * @ignore\n */\n private setTextInput(value: string) {\n if (this.textInput) {\n this.textInput.nativeElement.value = value;\n // Exact matches show whole list?\n this.filterOptions('');\n }\n }\n\n /**\n * Update the filtered options with the passed in filter text.\n * @param filterText The text to filter by\n * @ignore\n */\n private filterOptions(filterText: string) {\n this.optionGroups.forEach(group => {\n group._filteredOptions = group.options.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));\n });\n\n this._filteredOptions = this.options.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));\n this._allFilteredOptions = this.allOptions.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));\n\n // The filters have changed so update the active option incase it has been filtered out.\n this._activeOption = this._allFilteredOptions[this._activeIndex % this._allFilteredOptions.length];\n }\n\n /**\n * Filter for typeahead with logic for what mode we are in.\n * @param option\n * @ignore\n */\n private typeaheadFilter(filterText: string, typeaheadMode: 'none' | 'startsWith' | 'contains', option: GoAOptionComponent) {\n if (typeaheadMode === 'none' || this.typeaheadMode === undefined) {\n return true;\n }\n\n if (typeaheadMode === 'startsWith') {\n return option.label.toLocaleLowerCase().startsWith(filterText.toLocaleLowerCase());\n }\n\n if (typeaheadMode === 'contains') {\n return option.label.toLocaleLowerCase().includes(filterText.toLocaleLowerCase());\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GoADropdownComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":23,"character":1},"arguments":[{"selector":"goa-dropdown","template":"<div class=\"goa-dropdown\" [ngClass]=\"{\n 'single-selection': multiple === false,\n 'has-error': _requiredError === true,\n 'opened': _isOpen,\n 'disabled': disabled === true\n }\"> \n <label class=\"dropdown-label\">{{label}}\n <span *ngIf=\"required\" class=\"required-label\" i18n=\"Required label for dropdown\">(Required)</span>\n <div (click)=\"inputClicked()\" class=\"dropdown-grouping\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n <i class=\"goa-select-icon\"></i>\n <input class=\"dropdown-textbox margin-override\" \n #textInput \n (input)=\"onFilterChange($event.target.value)\"\n type=\"text\" \n [attr.readonly]=\"typeaheadMode === 'none' ? 'readonly' : null\"\n [attr.disabled]=\"disabled === true ? 'true' : null\"\n placeholder=\"{{description}}\"> \n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayLockPosition\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayViewportMargin]=\"20\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"_isOpen = false\"\n (overlayKeydown)=\"overlayKeydown($event)\"\n (detach)=\"_isOpen = false\"\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"_isOpen\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n [cdkConnectedOverlayMinWidth]=\"_triggerRect?.width\"\n [cdkConnectedOverlayHeight]=\"menuHeight\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n >\n <div class=\"dropdown-menu\">\n <div *ngFor=\"let optionGroup of optionGroups\" class=\"option-group\">\n <div *ngIf=\"optionGroup._filteredOptions.length > 0\">\n <div class=\"option-group-label\">\n {{optionGroup.label}}\n </div>\n <!--Grab the <option> template from the GoAOption -->\n <div class=\"option\"\n [ngClass]=\"{\n 'selected': option.selected,\n 'active': option.id === _activeOption.id\n }\"\n *ngFor=\"let option of (optionGroup._filteredOptions)\" \n (click)=\"optionClicked(option)\"\n (mouseover)=\"setActiveOption(option)\">\n <ng-template [ngTemplateOutlet]=\"option.optionTemplate\"></ng-template>\n </div>\n </div>\n </div>\n <!--Grab the <option> template from the GoAOption -->\n <div class=\"option\" \n [ngClass]=\"{\n 'selected': option.selected,\n 'active': option.id === _activeOption.id\n }\"\n *ngFor=\"let option of (_filteredOptions)\" \n (click)=\"optionClicked(option)\"\n (mouseover)=\"setActiveOption(option)\"> \n <ng-template [ngTemplateOutlet]=\"option.optionTemplate\"></ng-template>\n </div>\n </div> \n </ng-template> \n </div>\n <span *ngIf=\"!_requiredError\" class=\"helper-text\">{{description}}</span>\n <span *ngIf=\"_requiredError === true\" class=\"error-text\" i18n=\"Required warning for dropdown\">At least one item must be selected.</span> \n </label>\n</div>\n","styles":[".dropdown-overlay{position:absolute;top:0;left:0;right:0;bottom:0}.dropdown-menu{border:1px solid #dcdcdc;border-radius:4px;background:#fff;padding:0;margin-top:3px;width:100%;overflow-y:auto}.dropdown-menu .option-group .option-group-label{font-weight:700;padding:4px 12px}.dropdown-menu .option-group .option{font-weight:400;padding:4px 24px}.dropdown-menu .option{padding:4px 12px;color:#0070c4;border:1px solid #f1f1f1}.dropdown-menu .option.selected{background-color:#0070c4;color:#fff}.dropdown-menu .option.selected.active{background-color:#004f84;color:#fff}.dropdown-menu .option.active{background-color:#f1f1f1;color:#333}.goa-dropdown{position:relative}.goa-dropdown .dropdown-grouping input[type=text]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-right:30px!important}.goa-dropdown .dropdown-grouping.disabled{opacity:1%}.goa-dropdown .dropdown-grouping .dropdown-textbox{box-sizing:border-box;width:100%;margin:8px 0 0;padding:12px 8px 12px 12px;border-radius:4px;border:1px solid #666;font-size:18px;font-weight:400;color:#0070c4;-webkit-appearance:none;-moz-appearance:none;appearance:none}.goa-dropdown .dropdown-grouping .dropdown-textbox:disabled{opacity:.3;pointer-events:none}.goa-dropdown .dropdown-grouping .dropdown-textbox::-ms-expand{display:none}.goa-dropdown .dropdown-grouping .dropdown-textbox:hover{border:1px solid #0070c4}.goa-dropdown .dropdown-grouping .dropdown-textbox:focus{box-shadow:0 0 0 3px #feba35;outline:none}.goa-dropdown .dropdown-grouping .dropdown-textbox.margin-override{margin:0}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter{font-size:14px!important;border:none!important;margin:0!important;box-sizing:border-box;width:100%;margin:8px 0 0;padding:12px 8px 12px 12px;border-radius:4px;border:1px solid #666;font-size:18px;font-weight:400;color:#0070c4;-webkit-appearance:none;-moz-appearance:none;appearance:none}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter:disabled{opacity:.3;pointer-events:none}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter::-ms-expand{display:none}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter:hover{border:1px solid #0070c4}.goa-dropdown .dropdown-grouping .dropdown-textbox-filter:focus{box-shadow:0 0 0 3px #feba35;box-shadow:none!important;outline:none}.goa-dropdown i.goa-select-icon{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cpath class='' opacity='1' d='M11.29,15.7a1,1,0,0,0,1.41,0l6-6A1,1,0,1,0,17.29,8.3L12,13.58,6.71,8.3a1,1,0,0,0-1.42,0,1,1,0,0,0,0,1.41Z'/%3E%3C/svg%3E%0A\");left:auto;right:8px;width:24px;height:24px;pointer-events:none;position:absolute;margin-top:16px;color:#0070c4}.goa-dropdown.disabled i.goa-select-icon,.goa-dropdown i.goa-select-icon{background-repeat:no-repeat;background-size:contain;background-position:50%}.goa-dropdown.disabled i.goa-select-icon{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cpath class='' opacity='0.3' d='M11.29,15.7a1,1,0,0,0,1.41,0l6-6A1,1,0,1,0,17.29,8.3L12,13.58,6.71,8.3a1,1,0,0,0-1.42,0,1,1,0,0,0,0,1.41Z'/%3E%3C/svg%3E%0A\")}.goa-dropdown.opened i.goa-select-icon{transform:rotate(180deg)}.goa-dropdown.has-error .dropdown-grouping .dropdown-textbox{border:2px solid #fc1921}.goa-dropdown .dropdown-label{font-size:18px;font-weight:700;color:#333}.goa-dropdown .required-label{margin-left:8px;font-size:14px;color:#666}.goa-dropdown .helper-text{font-size:14px;font-weight:400;color:#333}.goa-dropdown .error-text{color:#fc1921;font-size:14px}"]}]}],"members":{"typeaheadMode":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":96,"character":3}}]}],"menuHeight":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":101,"character":3}}]}],"label":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":106,"character":3}}]}],"description":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":111,"character":3}}]}],"selectedIds":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":116,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":148,"character":3}}]}],"multiple":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":153,"character":3}}]}],"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":174,"character":3}}]}],"textInput":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":191,"character":3},"arguments":["textInput"]}]}],"allOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren","line":197,"character":3},"arguments":[{"__symbolic":"reference","module":"./option/option.component","name":"GoAOptionComponent","line":197,"character":19},{"descendants":true}]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren","line":203,"character":3},"arguments":[{"__symbolic":"reference","module":"./option/option.component","name":"GoAOptionComponent","line":203,"character":19},{"descendants":false}]}]}],"optionGroups":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ContentChildren","line":209,"character":3},"arguments":[{"__symbolic":"reference","module":"./option-group/option-group.component","name":"GoAOptionGroupComponent","line":209,"character":19},{"descendants":false}]}]}],"selectionChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":214,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":216,"character":27}]}],"ngOnInit":[{"__symbolic":"method"}],"ngAfterViewInit":[{"__symbolic":"method"}],"onFilterChange":[{"__symbolic":"method"}],"overlayKeydown":[{"__symbolic":"method"}],"setActiveOption":[{"__symbolic":"method"}],"inputClicked":[{"__symbolic":"method"}],"optionClicked":[{"__symbolic":"method"}],"selectionChanged":[{"__symbolic":"method"}],"emitChange":[{"__symbolic":"method"}],"setTextInput":[{"__symbolic":"method"}],"filterOptions":[{"__symbolic":"method"}],"typeaheadFilter":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Component, Input, TemplateRef, ViewChild, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Option component with to use with GoADropdown.
|
|
4
|
-
* selector: goa-option
|
|
5
|
-
*/
|
|
6
|
-
export class GoAOptionComponent {
|
|
7
|
-
constructor() {
|
|
8
|
-
/**
|
|
9
|
-
* Is the option currently selected
|
|
10
|
-
* @ignore
|
|
11
|
-
*/
|
|
12
|
-
this.selected = false;
|
|
13
|
-
/**
|
|
14
|
-
* Is the option selected by default?
|
|
15
|
-
*/
|
|
16
|
-
this.defaultSelected = false;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Lifecycle hook OnInit
|
|
20
|
-
* @ignore
|
|
21
|
-
*/
|
|
22
|
-
ngOnInit() {
|
|
23
|
-
if (this.id === undefined || this.id === null) {
|
|
24
|
-
throw new TypeError(`Input 'id' is required.`);
|
|
25
|
-
}
|
|
26
|
-
if (this.label === undefined || this.label === null) {
|
|
27
|
-
throw new TypeError(`Input 'label' is required.`);
|
|
28
|
-
}
|
|
29
|
-
this.selected = this.defaultSelected;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
GoAOptionComponent.decorators = [
|
|
33
|
-
{ type: Component, args: [{
|
|
34
|
-
selector: 'goa-option',
|
|
35
|
-
template: "<ng-template #optionTemplate>\n <div class=\"goa-option\">\n <ng-content></ng-content>\n </div>\n</ng-template>",
|
|
36
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
|
-
styles: [""]
|
|
38
|
-
},] }
|
|
39
|
-
];
|
|
40
|
-
GoAOptionComponent.ctorParameters = () => [];
|
|
41
|
-
GoAOptionComponent.propDecorators = {
|
|
42
|
-
id: [{ type: Input }],
|
|
43
|
-
value: [{ type: Input }],
|
|
44
|
-
label: [{ type: Input }],
|
|
45
|
-
defaultSelected: [{ type: Input }],
|
|
46
|
-
optionTemplate: [{ type: ViewChild, args: ['optionTemplate',] }]
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=option.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option.component.js","sourceRoot":"","sources":["../../../../../../../libs/angular-components/src/lib/dropdown/option/option.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAU,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAgB,MAAM,eAAe,CAAC;AAExH;;;GAGG;AAOH,MAAM,OAAO,kBAAkB;IAkC7B;QAhCA;;;WAGG;QACH,aAAQ,GAAG,KAAK,CAAC;QAiBjB;;WAEG;QACM,oBAAe,GAAG,KAAK,CAAC;IAQlB,CAAC;IAEhB;;;OAGG;IACH,QAAQ;QACN,IAAG,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE;YAC5C,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAC;SAChD;QAED,IAAG,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE;YAClD,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC;IACvC,CAAC;;;YAxDF,SAAS,SAAC;gBACT,QAAQ,EAAE,YAAY;gBACtB,wIAAsC;gBAEtC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;aAChD;;;;iBAYE,KAAK;oBAKL,KAAK;oBAKL,KAAK;8BAKL,KAAK;6BAML,SAAS,SAAC,gBAAgB","sourcesContent":["import { Component, OnInit, Input, TemplateRef, ViewChild, ChangeDetectionStrategy, EventEmitter } from '@angular/core';\n\n/**\n * Option component with to use with GoADropdown.\n * selector: goa-option\n */\n@Component({\n selector: 'goa-option',\n templateUrl: './option.component.html',\n styleUrls: ['./option.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class GoAOptionComponent implements OnInit {\n\n /**\n * Is the option currently selected\n * @ignore\n */\n selected = false;\n\n /**\n * The unique id of the option.\n */\n @Input() id: string;\n\n /**\n * The value for the option\n */\n @Input() value: any;\n\n /**\n * Label to be used for option.\n */\n @Input() label: string;\n\n /**\n * Is the option selected by default?\n */\n @Input() defaultSelected = false;\n\n /**\n * The option template\n * @ignore\n */\n @ViewChild('optionTemplate') optionTemplate: TemplateRef<any>;\n\n constructor() {}\n\n /**\n * Lifecycle hook OnInit\n * @ignore\n */\n ngOnInit() {\n if(this.id === undefined || this.id === null) {\n throw new TypeError(`Input 'id' is required.`);\n }\n\n if(this.label === undefined || this.label === null) {\n throw new TypeError(`Input 'label' is required.`);\n }\n\n this.selected = this.defaultSelected;\n }\n}\n"]}
|