@abgov/angular-components 2.0.0-alpha.4 → 2.0.0-alpha.6

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.
Files changed (82) hide show
  1. package/README.md +3 -45
  2. package/abgov-angular-components.d.ts +1 -0
  3. package/bundles/abgov-angular-components.umd.js +176 -2565
  4. package/bundles/abgov-angular-components.umd.js.map +1 -1
  5. package/esm2015/index.js +3 -27
  6. package/esm2015/lib/angular-components.module.js +16 -94
  7. package/esm2015/lib/value-directive.js +133 -0
  8. package/fesm2015/abgov-angular-components.js +119 -2007
  9. package/fesm2015/abgov-angular-components.js.map +1 -1
  10. package/index.d.ts +2 -26
  11. package/lib/angular-components.module.d.ts +7 -0
  12. package/lib/value-directive.d.ts +34 -0
  13. package/package.json +8 -13
  14. package/abgov-angular-components.metadata.json +0 -1
  15. package/esm2015/experimental/app-version-header/app-version-header.component.js +0 -30
  16. package/esm2015/experimental/badge/badge.component.js +0 -24
  17. package/esm2015/experimental/components.module.js +0 -29
  18. package/esm2015/experimental/index.js +0 -5
  19. package/esm2015/experimental/number-input/number-input.component.js +0 -151
  20. package/esm2015/lib/button/button.component.js +0 -66
  21. package/esm2015/lib/button-link/button-link.component.js +0 -66
  22. package/esm2015/lib/callout/callout.component.js +0 -34
  23. package/esm2015/lib/card/card.component.js +0 -37
  24. package/esm2015/lib/card/content/card-content.component.js +0 -24
  25. package/esm2015/lib/card/footer/card-footer.component.js +0 -24
  26. package/esm2015/lib/card/header/card-header.component.js +0 -24
  27. package/esm2015/lib/card/thumb/card-thumb.component.js +0 -27
  28. package/esm2015/lib/card-group/card.group.component.js +0 -23
  29. package/esm2015/lib/checkbox/checkbox-change.js +0 -3
  30. package/esm2015/lib/checkbox/checkbox.component.js +0 -136
  31. package/esm2015/lib/dropdown/dropdown.component.js +0 -326
  32. package/esm2015/lib/dropdown/option/option.component.js +0 -48
  33. package/esm2015/lib/dropdown/option-group/option-group.component.js +0 -46
  34. package/esm2015/lib/element-load-indicator/element-load-indicator.component.js +0 -63
  35. package/esm2015/lib/header/header.component.js +0 -47
  36. package/esm2015/lib/hero-banner/content/hero-banner-content.component.js +0 -15
  37. package/esm2015/lib/hero-banner/hero-banner.component.js +0 -21
  38. package/esm2015/lib/hero-banner/link/hero-banner-link.component.js +0 -18
  39. package/esm2015/lib/microsite-logo/microsite-logo.component.js +0 -34
  40. package/esm2015/lib/notification/notification.component.js +0 -59
  41. package/esm2015/lib/notification-banner/notification-banner.component.js +0 -32
  42. package/esm2015/lib/page-load-indicator/page-load-indicator.component.js +0 -117
  43. package/esm2015/lib/radio/radio-change.js +0 -3
  44. package/esm2015/lib/radio/radio.component.js +0 -146
  45. package/esm2015/lib/radio/radio.service.js +0 -20
  46. package/esm2015/lib/radio-group/radio-group.component.js +0 -282
  47. package/esm2015/lib/skeleton/skeleton-element.component.js +0 -21
  48. package/esm2015/lib/skeleton/skeleton-image-content.component.js +0 -19
  49. package/experimental/app-version-header/app-version-header.component.d.ts +0 -10
  50. package/experimental/badge/badge.component.d.ts +0 -7
  51. package/experimental/components.module.d.ts +0 -2
  52. package/experimental/index.d.ts +0 -4
  53. package/experimental/number-input/number-input.component.d.ts +0 -66
  54. package/lib/button/button.component.d.ts +0 -37
  55. package/lib/button-link/button-link.component.d.ts +0 -38
  56. package/lib/callout/callout.component.d.ts +0 -20
  57. package/lib/card/card.component.d.ts +0 -23
  58. package/lib/card/content/card-content.component.d.ts +0 -14
  59. package/lib/card/footer/card-footer.component.d.ts +0 -14
  60. package/lib/card/header/card-header.component.d.ts +0 -14
  61. package/lib/card/thumb/card-thumb.component.d.ts +0 -22
  62. package/lib/card-group/card.group.component.d.ts +0 -32
  63. package/lib/checkbox/checkbox-change.d.ts +0 -7
  64. package/lib/checkbox/checkbox.component.d.ts +0 -100
  65. package/lib/dropdown/dropdown.component.d.ts +0 -193
  66. package/lib/dropdown/option/option.component.d.ts +0 -39
  67. package/lib/dropdown/option-group/option-group.component.d.ts +0 -38
  68. package/lib/element-load-indicator/element-load-indicator.component.d.ts +0 -38
  69. package/lib/header/header.component.d.ts +0 -29
  70. package/lib/hero-banner/content/hero-banner-content.component.d.ts +0 -5
  71. package/lib/hero-banner/hero-banner.component.d.ts +0 -9
  72. package/lib/hero-banner/link/hero-banner-link.component.d.ts +0 -6
  73. package/lib/microsite-logo/microsite-logo.component.d.ts +0 -20
  74. package/lib/notification/notification.component.d.ts +0 -43
  75. package/lib/notification-banner/notification-banner.component.d.ts +0 -22
  76. package/lib/page-load-indicator/page-load-indicator.component.d.ts +0 -55
  77. package/lib/radio/radio-change.d.ts +0 -7
  78. package/lib/radio/radio.component.d.ts +0 -119
  79. package/lib/radio/radio.service.d.ts +0 -7
  80. package/lib/radio-group/radio-group.component.d.ts +0 -190
  81. package/lib/skeleton/skeleton-element.component.d.ts +0 -5
  82. package/lib/skeleton/skeleton-image-content.component.d.ts +0 -5
@@ -1,2583 +1,194 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@abgov/web-components'), require('@angular/core'), require('@angular/common'), require('@angular/cdk/overlay'), require('@angular/forms'), require('rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@abgov/angular-components', ['exports', '@abgov/web-components', '@angular/core', '@angular/common', '@angular/cdk/overlay', '@angular/forms', 'rxjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.abgov = global.abgov || {}, global.abgov["angular-components"] = {}), null, global.ng.core, global.ng.common, global.ng.cdk.overlay, global.ng.forms, global.rxjs));
5
- })(this, (function (exports, webComponents, i0, common, overlay, forms, rxjs) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
-
27
- /**
28
- * A Government of Alberta styled button.
29
- * selector: button[goa-button], input[type="button"][goa-button], input[type="submit"][goa-button]
30
- */
31
- var GoAButtonComponent = /** @class */ (function () {
32
- function GoAButtonComponent() {
33
- /**
34
- * The appearance style of the button.
35
- */
36
- this.buttonType = 'primary';
37
- /**
38
- * The size of the button, controls font size and padding.
39
- */
40
- this.buttonSize = 'normal';
41
- }
42
- Object.defineProperty(GoAButtonComponent.prototype, "primaryBinding", {
43
- /**
44
- * Adds class goa-button to the host.
45
- * @ignore
46
- */
47
- get: function () {
48
- return true;
49
- },
50
- enumerable: false,
51
- configurable: true
52
- });
53
- Object.defineProperty(GoAButtonComponent.prototype, "secondaryBinding", {
54
- /**
55
- * Adds class goa--secondary to the host if the buttonStyle = secondary.
56
- * @ignore
57
- */
58
- get: function () {
59
- return this.buttonType === 'secondary';
60
- },
61
- enumerable: false,
62
- configurable: true
63
- });
64
- Object.defineProperty(GoAButtonComponent.prototype, "tertiaryBinding", {
65
- /**
66
- * Adds class goa--tertiary to the host if the buttonStyle = tertiary.
67
- * @ignore
68
- */
69
- get: function () {
70
- return this.buttonType === 'tertiary';
71
- },
72
- enumerable: false,
73
- configurable: true
74
- });
75
- Object.defineProperty(GoAButtonComponent.prototype, "smallBinding", {
76
- /**
77
- * Adds class btn-small to the host if the buttonSize = small.
78
- * @ignore
79
- */
80
- get: function () {
81
- return this.buttonSize === 'small';
82
- },
83
- enumerable: false,
84
- configurable: true
85
- });
86
- /* eslint-disable @angular-eslint/no-empty-lifecycle-method */
87
- GoAButtonComponent.prototype.ngOnInit = function () { };
88
- return GoAButtonComponent;
89
- }());
90
- GoAButtonComponent.decorators = [
91
- { type: i0.Component, args: [{
92
- selector:
93
- // eslint-disable-next-line @angular-eslint/component-selector
94
- 'button[goa-button], input[type="button"][goa-button], input[type="submit"][goa-button]',
95
- template: "<ng-content></ng-content>\n",
96
- styles: [""]
97
- },] }
98
- ];
99
- GoAButtonComponent.ctorParameters = function () { return []; };
100
- GoAButtonComponent.propDecorators = {
101
- primaryBinding: [{ type: i0.HostBinding, args: ['class.goa-button',] }],
102
- secondaryBinding: [{ type: i0.HostBinding, args: ['class.goa--secondary',] }],
103
- tertiaryBinding: [{ type: i0.HostBinding, args: ['class.goa--tertiary',] }],
104
- smallBinding: [{ type: i0.HostBinding, args: ['class.btn-small',] }],
105
- buttonType: [{ type: i0.Input }],
106
- buttonSize: [{ type: i0.Input }]
107
- };
108
-
109
- /**
110
- * A logo for a Government of Alberta hosted microsite.
111
- * selector: goa-microsite-logo
112
- */
113
- var GoAMicrositeLogoComponent = /** @class */ (function () {
114
- function GoAMicrositeLogoComponent() {
115
- /**
116
- * The home page URL of the microsite.
117
- */
118
- this.serviceHome = 'https://www.alberta.ca/index.aspx';
119
- }
120
- /**
121
- * @ignore
122
- */
123
- GoAMicrositeLogoComponent.prototype.ngOnInit = function () {
124
- if (this.serviceName === undefined || this.serviceName === null) {
125
- throw new TypeError("Input 'serviceName' is required.");
126
- }
127
- };
128
- return GoAMicrositeLogoComponent;
129
- }());
130
- GoAMicrositeLogoComponent.decorators = [
131
- { type: i0.Component, args: [{
132
- selector: 'goa-microsite-logo',
133
- template: "<a href=\"{{serviceHome}}\" attr.aria-label=\"{{serviceHome}}\" class=\"microsite-link\">\n <span class=\"image-desktop-tablet\"></span>\n <span class=\"image-mobile\"></span>\n <span class=\"name\">\n {{serviceName}}\n </span>\n</a>\n",
134
- styles: [""]
135
- },] }
136
- ];
137
- GoAMicrositeLogoComponent.ctorParameters = function () { return []; };
138
- GoAMicrositeLogoComponent.propDecorators = {
139
- serviceName: [{ type: i0.Input }],
140
- serviceHome: [{ type: i0.Input }]
141
- };
142
-
143
- /**
144
- * A header component for a Government of Alberta hosted microsite.
145
- * selector: goa-header
146
- */
147
- var GoAHeaderComponent = /** @class */ (function () {
148
- // ServiceLevel = this.ServiceLevel;
149
- function GoAHeaderComponent() {
150
- /**
151
- * The home page URL of the microsite.
152
- */
153
- this.serviceHome = 'https://www.alberta.ca/index.aspx';
154
- }
155
- /**
156
- * @ignore
157
- */
158
- GoAHeaderComponent.prototype.ngOnInit = function () {
159
- this.checkRequiredProps('serviceLevel', 'serviceName', 'serviceHome');
160
- };
161
- GoAHeaderComponent.prototype.serviceLevelCssClass = function () {
162
- return "service-level--" + this.serviceLevel.toLowerCase();
163
- };
164
- GoAHeaderComponent.prototype.serviceLevelFormatted = function () {
165
- return this.serviceLevel.toLowerCase();
166
- };
167
- GoAHeaderComponent.prototype.checkRequiredProps = function () {
168
- var _this = this;
169
- var props = [];
170
- for (var _i = 0; _i < arguments.length; _i++) {
171
- props[_i] = arguments[_i];
172
- }
173
- props.forEach(function (prop) {
174
- if (!_this[prop]) {
175
- throw new TypeError("Input '" + prop + "' is required.");
176
- }
177
- });
178
- };
179
- return GoAHeaderComponent;
180
- }());
181
- GoAHeaderComponent.decorators = [
182
- { type: i0.Component, args: [{
183
- selector: 'goa-header',
184
- template: "<header class=\"goa-header goa-official-site-header\">\n <div>\n <span class=\"service-level\" [ngClass]=\"serviceLevelCssClass()\">\n {{ serviceLevelFormatted() }}\n </span>\n </div>\n <div\n *ngIf=\"serviceLevel === 'live'; else elseNotLive\"\n class=\"site-text\"\n i18n=\"Alberta.ca official site text on header\"\n >\n An official site of the\n <a href=\"https://www.alberta.ca/index.aspx\" class=\"web-link\"\n >Alberta Government</a\n >\n </div>\n <ng-template #elseNotLive>\n <div class=\"site-text\" i18n=\"Alberta.ca site text on header\">\n This is a new\n <a href=\"https://www.alberta.ca/index.aspx\" class=\"web-link\"\n >Alberta Government</a\n >\n service\n </div>\n </ng-template>\n</header>\n<header class=\"goa-header goa-microsite-header\">\n <goa-microsite-logo\n [serviceName]=\"serviceName\"\n [serviceHome]=\"serviceHome\"\n ></goa-microsite-logo>\n <ng-content></ng-content>\n</header>\n",
185
- styles: [""]
186
- },] }
187
- ];
188
- GoAHeaderComponent.ctorParameters = function () { return []; };
189
- GoAHeaderComponent.propDecorators = {
190
- serviceName: [{ type: i0.Input }],
191
- serviceHome: [{ type: i0.Input }],
192
- serviceLevel: [{ type: i0.Input }]
193
- };
194
-
195
- /**
196
- * Styles an anchor Design system compliant.
197
- * selector: a[goa-button]
198
- * @example <a goa-button linkType='right' href='...'>Text</a>
199
- */
200
- var GoAButtonLinkComponent = /** @class */ (function () {
201
- function GoAButtonLinkComponent() {
202
- /**
203
- * The type of arrow to use.
204
- */
205
- this.linkType = 'right';
206
- /**
207
- * The size of the button, controls font size and padding.
208
- */
209
- this.buttonSize = 'normal';
210
- }
211
- Object.defineProperty(GoAButtonLinkComponent.prototype, "primaryBinding", {
212
- /**
213
- * Adds class goa-link-button to the host.
214
- * @ignore
215
- */
216
- get: function () {
217
- return true;
218
- },
219
- enumerable: false,
220
- configurable: true
221
- });
222
- Object.defineProperty(GoAButtonLinkComponent.prototype, "rightBinding", {
223
- /**
224
- * Adds class right-arrow to the host if the linkType = right.
225
- * @ignore
226
- */
227
- get: function () {
228
- return this.linkType === 'right';
229
- },
230
- enumerable: false,
231
- configurable: true
232
- });
233
- Object.defineProperty(GoAButtonLinkComponent.prototype, "upBinding", {
234
- /**
235
- * Adds class right-arrow to the host if the linkType = right.
236
- * @ignore
237
- */
238
- get: function () {
239
- return this.linkType === 'up';
240
- },
241
- enumerable: false,
242
- configurable: true
243
- });
244
- Object.defineProperty(GoAButtonLinkComponent.prototype, "smallBinding", {
245
- /**
246
- * Adds class btn-small to the host if the buttonSize = small.
247
- * @ignore
248
- */
249
- get: function () {
250
- return this.buttonSize === 'small';
251
- },
252
- enumerable: false,
253
- configurable: true
254
- });
255
- /* eslint-disable @angular-eslint/no-empty-lifecycle-method */
256
- GoAButtonLinkComponent.prototype.ngOnInit = function () { };
257
- return GoAButtonLinkComponent;
258
- }());
259
- GoAButtonLinkComponent.decorators = [
260
- { type: i0.Component, args: [{
261
- // eslint-disable-next-line @angular-eslint/component-selector
262
- selector: 'a[goa-button]',
263
- template: "<span>\n <ng-content></ng-content>\n</span>",
264
- styles: [""]
265
- },] }
266
- ];
267
- GoAButtonLinkComponent.ctorParameters = function () { return []; };
268
- GoAButtonLinkComponent.propDecorators = {
269
- primaryBinding: [{ type: i0.HostBinding, args: ['class.goa-link-button',] }],
270
- rightBinding: [{ type: i0.HostBinding, args: ['class.right-arrow',] }],
271
- upBinding: [{ type: i0.HostBinding, args: ['class.up-arrow',] }],
272
- smallBinding: [{ type: i0.HostBinding, args: ['class.btn-small',] }],
273
- linkType: [{ type: i0.Input }],
274
- buttonSize: [{ type: i0.Input }]
275
- };
276
-
277
- /**
278
- * Option component with to use with GoADropdown.
279
- * selector: goa-option
280
- */
281
- var GoAOptionComponent = /** @class */ (function () {
282
- function GoAOptionComponent() {
283
- /**
284
- * Is the option currently selected
285
- * @ignore
286
- */
287
- this.selected = false;
288
- /**
289
- * Is the option selected by default?
290
- */
291
- this.defaultSelected = false;
292
- }
293
- /**
294
- * Lifecycle hook OnInit
295
- * @ignore
296
- */
297
- GoAOptionComponent.prototype.ngOnInit = function () {
298
- if (this.id === undefined || this.id === null) {
299
- throw new TypeError("Input 'id' is required.");
300
- }
301
- if (this.label === undefined || this.label === null) {
302
- throw new TypeError("Input 'label' is required.");
303
- }
304
- this.selected = this.defaultSelected;
305
- };
306
- return GoAOptionComponent;
307
- }());
308
- GoAOptionComponent.decorators = [
309
- { type: i0.Component, args: [{
310
- selector: 'goa-option',
311
- template: "<ng-template #optionTemplate>\n <div class=\"goa-option\">\n <ng-content></ng-content>\n </div>\n</ng-template>",
312
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
313
- styles: [""]
314
- },] }
315
- ];
316
- GoAOptionComponent.ctorParameters = function () { return []; };
317
- GoAOptionComponent.propDecorators = {
318
- id: [{ type: i0.Input }],
319
- value: [{ type: i0.Input }],
320
- label: [{ type: i0.Input }],
321
- defaultSelected: [{ type: i0.Input }],
322
- optionTemplate: [{ type: i0.ViewChild, args: ['optionTemplate',] }]
323
- };
324
-
325
- /*! *****************************************************************************
326
- Copyright (c) Microsoft Corporation.
327
-
328
- Permission to use, copy, modify, and/or distribute this software for any
329
- purpose with or without fee is hereby granted.
330
-
331
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
332
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
333
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
334
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
335
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
336
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
337
- PERFORMANCE OF THIS SOFTWARE.
338
- ***************************************************************************** */
339
- /* global Reflect, Promise */
340
- var extendStatics = function (d, b) {
341
- extendStatics = Object.setPrototypeOf ||
342
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
343
- function (d, b) { for (var p in b)
344
- if (Object.prototype.hasOwnProperty.call(b, p))
345
- d[p] = b[p]; };
346
- return extendStatics(d, b);
347
- };
348
- function __extends(d, b) {
349
- if (typeof b !== "function" && b !== null)
350
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
351
- extendStatics(d, b);
352
- function __() { this.constructor = d; }
353
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
354
- }
355
- var __assign = function () {
356
- __assign = Object.assign || function __assign(t) {
357
- for (var s, i = 1, n = arguments.length; i < n; i++) {
358
- s = arguments[i];
359
- for (var p in s)
360
- if (Object.prototype.hasOwnProperty.call(s, p))
361
- t[p] = s[p];
362
- }
363
- return t;
364
- };
365
- return __assign.apply(this, arguments);
366
- };
367
- function __rest(s, e) {
368
- var t = {};
369
- for (var p in s)
370
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
371
- t[p] = s[p];
372
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
373
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
374
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
375
- t[p[i]] = s[p[i]];
376
- }
377
- return t;
378
- }
379
- function __decorate(decorators, target, key, desc) {
380
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
381
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
382
- r = Reflect.decorate(decorators, target, key, desc);
383
- else
384
- for (var i = decorators.length - 1; i >= 0; i--)
385
- if (d = decorators[i])
386
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
387
- return c > 3 && r && Object.defineProperty(target, key, r), r;
388
- }
389
- function __param(paramIndex, decorator) {
390
- return function (target, key) { decorator(target, key, paramIndex); };
391
- }
392
- function __metadata(metadataKey, metadataValue) {
393
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
394
- return Reflect.metadata(metadataKey, metadataValue);
395
- }
396
- function __awaiter(thisArg, _arguments, P, generator) {
397
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
398
- return new (P || (P = Promise))(function (resolve, reject) {
399
- function fulfilled(value) { try {
400
- step(generator.next(value));
401
- }
402
- catch (e) {
403
- reject(e);
404
- } }
405
- function rejected(value) { try {
406
- step(generator["throw"](value));
407
- }
408
- catch (e) {
409
- reject(e);
410
- } }
411
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
412
- step((generator = generator.apply(thisArg, _arguments || [])).next());
413
- });
414
- }
415
- function __generator(thisArg, body) {
416
- var _ = { label: 0, sent: function () { if (t[0] & 1)
417
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
418
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
419
- function verb(n) { return function (v) { return step([n, v]); }; }
420
- function step(op) {
421
- if (f)
422
- throw new TypeError("Generator is already executing.");
423
- while (_)
424
- try {
425
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
426
- return t;
427
- if (y = 0, t)
428
- op = [op[0] & 2, t.value];
429
- switch (op[0]) {
430
- case 0:
431
- case 1:
432
- t = op;
433
- break;
434
- case 4:
435
- _.label++;
436
- return { value: op[1], done: false };
437
- case 5:
438
- _.label++;
439
- y = op[1];
440
- op = [0];
441
- continue;
442
- case 7:
443
- op = _.ops.pop();
444
- _.trys.pop();
445
- continue;
446
- default:
447
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
448
- _ = 0;
449
- continue;
450
- }
451
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
452
- _.label = op[1];
453
- break;
454
- }
455
- if (op[0] === 6 && _.label < t[1]) {
456
- _.label = t[1];
457
- t = op;
458
- break;
459
- }
460
- if (t && _.label < t[2]) {
461
- _.label = t[2];
462
- _.ops.push(op);
463
- break;
464
- }
465
- if (t[2])
466
- _.ops.pop();
467
- _.trys.pop();
468
- continue;
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@abgov/web-components')) :
3
+ typeof define === 'function' && define.amd ? define('@abgov/angular-components', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@abgov/web-components'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.abgov = global.abgov || {}, global.abgov["angular-components"] = {}), global.ng.core, global.ng.common, global.ng.forms));
5
+ })(this, (function (exports, i0, common, forms) { 'use strict';
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+
27
+ var AngularComponentsModule = /** @class */ (function () {
28
+ function AngularComponentsModule() {
29
+ }
30
+ return AngularComponentsModule;
31
+ }());
32
+ AngularComponentsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: AngularComponentsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
33
+ AngularComponentsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: AngularComponentsModule, imports: [common.CommonModule, forms.FormsModule, forms.ReactiveFormsModule] });
34
+ AngularComponentsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: AngularComponentsModule, imports: [[common.CommonModule, forms.FormsModule, forms.ReactiveFormsModule]] });
35
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: AngularComponentsModule, decorators: [{
36
+ type: i0.NgModule,
37
+ args: [{
38
+ imports: [common.CommonModule, forms.FormsModule, forms.ReactiveFormsModule],
39
+ schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
40
+ }]
41
+ }] });
42
+
43
+ /* eslint-disable @typescript-eslint/no-explicit-any */
44
+ var ValueDirective = /** @class */ (function () {
45
+ function ValueDirective(elementRef) {
46
+ this.elementRef = elementRef;
47
+ this._value = "";
48
+ this.onChange = function () { };
49
+ this.onTouched = function () { };
50
+ }
51
+ Object.defineProperty(ValueDirective.prototype, "value", {
52
+ get: function () {
53
+ return this._value;
54
+ },
55
+ set: function (val) {
56
+ if (val !== this._value) {
57
+ this._value = val;
58
+ this.onChange(this._value);
59
+ this.onTouched();
60
+ this.elementRef.nativeElement.value = val;
469
61
  }
470
- op = body.call(thisArg, _);
471
- }
472
- catch (e) {
473
- op = [6, e];
474
- y = 0;
475
- }
476
- finally {
477
- f = t = 0;
478
- }
479
- if (op[0] & 5)
480
- throw op[1];
481
- return { value: op[0] ? op[1] : void 0, done: true };
482
- }
483
- }
484
- var __createBinding = Object.create ? (function (o, m, k, k2) {
485
- if (k2 === undefined)
486
- k2 = k;
487
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
488
- }) : (function (o, m, k, k2) {
489
- if (k2 === undefined)
490
- k2 = k;
491
- o[k2] = m[k];
492
- });
493
- function __exportStar(m, o) {
494
- for (var p in m)
495
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
496
- __createBinding(o, m, p);
497
- }
498
- function __values(o) {
499
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
500
- if (m)
501
- return m.call(o);
502
- if (o && typeof o.length === "number")
503
- return {
504
- next: function () {
505
- if (o && i >= o.length)
506
- o = void 0;
507
- return { value: o && o[i++], done: !o };
62
+ },
63
+ enumerable: false,
64
+ configurable: true
65
+ });
66
+ ValueDirective.prototype.writeValue = function (value) {
67
+ if (value) {
68
+ this.value = value;
508
69
  }
509
70
  };
510
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
511
- }
512
- function __read(o, n) {
513
- var m = typeof Symbol === "function" && o[Symbol.iterator];
514
- if (!m)
515
- return o;
516
- var i = m.call(o), r, ar = [], e;
517
- try {
518
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
519
- ar.push(r.value);
520
- }
521
- catch (error) {
522
- e = { error: error };
523
- }
524
- finally {
525
- try {
526
- if (r && !r.done && (m = i["return"]))
527
- m.call(i);
528
- }
529
- finally {
530
- if (e)
531
- throw e.error;
532
- }
533
- }
534
- return ar;
535
- }
536
- /** @deprecated */
537
- function __spread() {
538
- for (var ar = [], i = 0; i < arguments.length; i++)
539
- ar = ar.concat(__read(arguments[i]));
540
- return ar;
541
- }
542
- /** @deprecated */
543
- function __spreadArrays() {
544
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
545
- s += arguments[i].length;
546
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
547
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
548
- r[k] = a[j];
549
- return r;
550
- }
551
- function __spreadArray(to, from, pack) {
552
- if (pack || arguments.length === 2)
553
- for (var i = 0, l = from.length, ar; i < l; i++) {
554
- if (ar || !(i in from)) {
555
- if (!ar)
556
- ar = Array.prototype.slice.call(from, 0, i);
557
- ar[i] = from[i];
558
- }
559
- }
560
- return to.concat(ar || Array.prototype.slice.call(from));
561
- }
562
- function __await(v) {
563
- return this instanceof __await ? (this.v = v, this) : new __await(v);
564
- }
565
- function __asyncGenerator(thisArg, _arguments, generator) {
566
- if (!Symbol.asyncIterator)
567
- throw new TypeError("Symbol.asyncIterator is not defined.");
568
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
569
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
570
- function verb(n) { if (g[n])
571
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
572
- function resume(n, v) { try {
573
- step(g[n](v));
574
- }
575
- catch (e) {
576
- settle(q[0][3], e);
577
- } }
578
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
579
- function fulfill(value) { resume("next", value); }
580
- function reject(value) { resume("throw", value); }
581
- function settle(f, v) { if (f(v), q.shift(), q.length)
582
- resume(q[0][0], q[0][1]); }
583
- }
584
- function __asyncDelegator(o) {
585
- var i, p;
586
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
587
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
588
- }
589
- function __asyncValues(o) {
590
- if (!Symbol.asyncIterator)
591
- throw new TypeError("Symbol.asyncIterator is not defined.");
592
- var m = o[Symbol.asyncIterator], i;
593
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
594
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
595
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
596
- }
597
- function __makeTemplateObject(cooked, raw) {
598
- if (Object.defineProperty) {
599
- Object.defineProperty(cooked, "raw", { value: raw });
600
- }
601
- else {
602
- cooked.raw = raw;
603
- }
604
- return cooked;
605
- }
606
- ;
607
- var __setModuleDefault = Object.create ? (function (o, v) {
608
- Object.defineProperty(o, "default", { enumerable: true, value: v });
609
- }) : function (o, v) {
610
- o["default"] = v;
611
- };
612
- function __importStar(mod) {
613
- if (mod && mod.__esModule)
614
- return mod;
615
- var result = {};
616
- if (mod != null)
617
- for (var k in mod)
618
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
619
- __createBinding(result, mod, k);
620
- __setModuleDefault(result, mod);
621
- return result;
622
- }
623
- function __importDefault(mod) {
624
- return (mod && mod.__esModule) ? mod : { default: mod };
625
- }
626
- function __classPrivateFieldGet(receiver, state, kind, f) {
627
- if (kind === "a" && !f)
628
- throw new TypeError("Private accessor was defined without a getter");
629
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
630
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
631
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
632
- }
633
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
634
- if (kind === "m")
635
- throw new TypeError("Private method is not writable");
636
- if (kind === "a" && !f)
637
- throw new TypeError("Private accessor was defined without a setter");
638
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
639
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
640
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
641
- }
642
-
643
- /**
644
- * Option grouping component with to use with GoADropdown.
645
- * selector: goa-option-group
646
- */
647
- var GoAOptionGroupComponent = /** @class */ (function () {
648
- function GoAOptionGroupComponent(cdr) {
649
- this.cdr = cdr;
650
- }
651
- /**
652
- * Lifecycle hook OnInit
653
- * @ignore
654
- */
655
- GoAOptionGroupComponent.prototype.ngOnInit = function () {
656
- if (this.label === undefined || this.label === null || this.label === '') {
657
- throw new TypeError("The input 'label' is required.");
658
- }
659
- };
660
- /**
661
- * Lifecycle hook AfterViewInit
662
- * @ignore
663
- */
664
- GoAOptionGroupComponent.prototype.ngAfterViewInit = function () {
665
- this._filteredOptions = __spreadArray([], __read(this.options));
666
- // The template output cache is populated by child components during render, so tell angular that
667
- // there have been changes during the render here.
668
- this.cdr.detectChanges();
669
- };
670
- return GoAOptionGroupComponent;
671
- }());
672
- GoAOptionGroupComponent.decorators = [
673
- { type: i0.Component, args: [{
674
- selector: 'goa-option-group',
675
- template: "<!--Grab the <option> template from the GoAOption -->\n<ng-template #optionGroupTemplate>\n <div class=\"goa-option-group\">\n {{label}}\n <div class=\"group-options\">\n <ng-container class=\"goa-option\"> \n <ng-template *ngFor=\"let option of _filteredOptions\" [ngTemplateOutlet]=\"option.optionTemplate\"></ng-template>\n </ng-container>\n </div>\n </div>\n</ng-template>",
676
- styles: [".goa-option-group{font-weight:bold}.goa-option-group .group-options{padding-left:1em;font-weight:normal}\n"]
677
- },] }
678
- ];
679
- GoAOptionGroupComponent.ctorParameters = function () { return [
680
- { type: i0.ChangeDetectorRef }
681
- ]; };
682
- GoAOptionGroupComponent.propDecorators = {
683
- label: [{ type: i0.Input }],
684
- options: [{ type: i0.ContentChildren, args: [GoAOptionComponent, { descendants: true },] }],
685
- optionGroupTemplate: [{ type: i0.ViewChild, args: ['optionGroupTemplate',] }]
686
- };
687
-
688
- /**
689
- * A dropdown component with Government of Alberta styling.
690
- * selector: goa-dropdown
691
- */
692
- var GoADropdownComponent = /** @class */ (function () {
693
- function GoADropdownComponent(cdr) {
694
- this.cdr = cdr;
695
- /**
696
- * boolean for if the dropdown is open.
697
- * @ignore
698
- */
699
- this._isOpen = false;
700
- /**
701
- * Is the required error tripped?
702
- * @ignore
703
- */
704
- this._requiredError = false;
705
- /**
706
- * This position config ensures that the top "start" corner of the overlay
707
- * is aligned with with the bottom "start" of the origin by default (overlapping
708
- * the trigger completely). If the panel cannot fit below the trigger, it
709
- * will fall back to a position above the trigger.
710
- * @ignore
711
- */
712
- this._positions = [
71
+ ValueDirective.prototype.registerOnChange = function (fn) {
72
+ this.onChange = fn;
73
+ };
74
+ ValueDirective.prototype.registerOnTouched = function (fn) {
75
+ this.onTouched = fn;
76
+ };
77
+ ValueDirective.prototype.listenForValueChange = function (value) {
78
+ this.value = value;
79
+ };
80
+ return ValueDirective;
81
+ }());
82
+ ValueDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ValueDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
83
+ ValueDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: ValueDirective, selector: "[goaValue]", host: { listeners: { "_change": "listenForValueChange($event.detail.value)" } }, providers: [
713
84
  {
714
- originX: 'start',
715
- originY: 'bottom',
716
- overlayX: 'start',
717
- overlayY: 'top',
85
+ provide: forms.NG_VALUE_ACCESSOR,
86
+ useExisting: i0.forwardRef(function () { return ValueDirective; }),
87
+ multi: true,
718
88
  },
719
- {
720
- originX: 'start',
721
- originY: 'top',
722
- overlayX: 'start',
723
- overlayY: 'bottom',
89
+ ], ngImport: i0__namespace });
90
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ValueDirective, decorators: [{
91
+ type: i0.Directive,
92
+ args: [{
93
+ selector: "[goaValue]",
94
+ providers: [
95
+ {
96
+ provide: forms.NG_VALUE_ACCESSOR,
97
+ useExisting: i0.forwardRef(function () { return ValueDirective; }),
98
+ multi: true,
99
+ },
100
+ ],
101
+ }]
102
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { listenForValueChange: [{
103
+ type: i0.HostListener,
104
+ args: ["_change", ["$event.detail.value"]]
105
+ }] } });
106
+ var ValuesDirective = /** @class */ (function () {
107
+ function ValuesDirective(elementRef) {
108
+ this.elementRef = elementRef;
109
+ this._value = [];
110
+ this.onChange = function () { };
111
+ this.onTouched = function () { };
112
+ }
113
+ Object.defineProperty(ValuesDirective.prototype, "value", {
114
+ get: function () {
115
+ return this._value;
724
116
  },
725
- ];
726
- /**
727
- * All options currently matching filter including groups.
728
- * @ignore
729
- */
730
- this._allFilteredOptions = [];
731
- /**
732
- * Whats the mode for typeahead.
733
- */
734
- this.typeaheadMode = 'none';
735
- /**
736
- * Is the select disabled.
737
- */
738
- this.disabled = false;
739
- /**
740
- * @ignore
741
- */
742
- this._multiple = false;
743
- /**
744
- * @ignore
745
- */
746
- this._required = false;
747
- /**
748
- * Event emitted containing the value field of all selected options when the selection changes.
749
- */
750
- this.selectionChange = new i0.EventEmitter();
751
- }
752
- Object.defineProperty(GoADropdownComponent.prototype, "selectedIds", {
753
- /**
754
- * Update the selected options, select the options with the given ids
755
- */
756
- set: function (ids) {
757
- if (this.allOptions === undefined) {
758
- // aren't initialized yet, return
759
- return;
760
- }
761
- if (ids === null || ids === undefined) {
762
- ids = [];
763
- }
764
- if (ids.length > 1 && this.multiple === false) {
765
- throw new Error('Cannot select multiple options when the dropdown has multiple set to false.');
766
- }
767
- var selectedOptions = [];
768
- this.allOptions.forEach(function (option) {
769
- if (ids.includes(option.id)) {
770
- option.selected = true;
771
- selectedOptions.push(option);
772
- }
773
- else {
774
- option.selected = false;
775
- }
776
- });
777
- this.selectionChanged(selectedOptions, true);
778
- },
779
- enumerable: false,
780
- configurable: true
781
- });
782
- Object.defineProperty(GoADropdownComponent.prototype, "multiple", {
783
- get: function () {
784
- return this._multiple;
785
- },
786
- /**
787
- * Is multiple selection?
788
- */
789
- set: function (value) {
790
- this._multiple = value;
791
- if (this._multiple === false) {
792
- // If we have changed from multiple to no multiple then deselect everything.
793
- this.selectedItems.forEach(function (option) {
794
- option.selected = false;
795
- });
796
- }
797
- },
798
- enumerable: false,
799
- configurable: true
800
- });
801
- Object.defineProperty(GoADropdownComponent.prototype, "required", {
802
- get: function () {
803
- return this._required;
804
- },
805
- /**
806
- * Is a selection required?
807
- */
808
- set: function (value) {
809
- this._required = value;
810
- this._requiredError = this.selectedItems.length === 0 && this._required === true;
811
- },
812
- enumerable: false,
813
- configurable: true
814
- });
815
- /**
816
- * Lifecycle hook OnInit
817
- * @ignore
818
- */
819
- /* eslint-disable @angular-eslint/no-empty-lifecycle-method */
820
- GoADropdownComponent.prototype.ngOnInit = function () { };
821
- /**
822
- * Lifecycle hook AfterViewInit
823
- * @ignore
824
- */
825
- GoADropdownComponent.prototype.ngAfterViewInit = function () {
826
- this._triggerRect = this.textInput.nativeElement.getBoundingClientRect();
827
- this._filteredOptions = __spreadArray([], __read(this.options));
828
- this._allFilteredOptions = __spreadArray([], __read(this.allOptions));
829
- if (this.selectedItems.length > 0) {
830
- this.setTextInput(this.selectedItems[0].label);
831
- }
832
- // The template output cache is populated by child components during render,
833
- // so tell angular that there have been changes during the render here.
834
- this.cdr.detectChanges();
835
- };
836
- /**
837
- * Called when user updates the text in the searchbox.
838
- * @param text The text of the input
839
- * @ignore
840
- */
841
- GoADropdownComponent.prototype.onFilterChange = function (text) {
842
- // open the dropdown if it is not already
843
- if (!this._isOpen === true) {
844
- this._isOpen = true;
845
- }
846
- this.filterOptions(text);
847
- };
848
- /**
849
- * Handler for keyboard events when menu is open.
850
- * @param event keyboard event
851
- * @ignore
852
- */
853
- GoADropdownComponent.prototype.overlayKeydown = function (event) {
854
- if (event.code === 'Enter' || event.code === 'NumpadEnter') {
855
- this.optionClicked(this._activeOption);
856
- }
857
- else if (event.code === 'ArrowDown') {
858
- this._activeIndex = (this._activeIndex + 1) % this._allFilteredOptions.length;
859
- this._activeOption = this._allFilteredOptions[this._activeIndex];
860
- }
861
- else if (event.code === 'ArrowUp') {
862
- if (this._activeIndex > 0) {
863
- this._activeIndex = this._activeIndex - 1;
864
- this._activeOption = this._allFilteredOptions[this._activeIndex];
865
- }
866
- }
867
- };
868
- /**
869
- * Sets the active option. Active option is the option that when enter is pressed is selected.
870
- * @param option The option to make the active option
871
- * @ignore
872
- */
873
- GoADropdownComponent.prototype.setActiveOption = function (option) {
874
- this._activeOption = option;
875
- this._activeIndex = this._allFilteredOptions.findIndex(function (filteredOption) { return filteredOption.id === option.id; });
876
- };
877
- /**
878
- * Handler for when the input is clicked.
879
- * @ignore
880
- */
881
- GoADropdownComponent.prototype.inputClicked = function () {
882
- if (this.disabled === false) {
883
- this._isOpen = !this._isOpen;
884
- // set the active option to the first in the list
885
- if (this._allFilteredOptions.length > 0) {
886
- this._activeOption = this._allFilteredOptions[0];
887
- this._activeIndex = 0;
888
- }
889
- }
890
- };
891
- /**
892
- * Handler for when descendant an option is clicked.
893
- * @ignore
894
- */
895
- GoADropdownComponent.prototype.optionClicked = function (option) {
896
- var selectedOptions = [];
897
- if (this.multiple === true) {
898
- option.selected = !option.selected;
899
- selectedOptions = this.selectedItems;
900
- }
901
- else {
902
- option.selected = !option.selected;
903
- this.selectedItems.forEach(function (o) {
904
- if (option.id !== o.id) {
905
- // change all options that weren't selected to false without notifying change
906
- o.selected = false;
117
+ set: function (val) {
118
+ if (val && val !== this._value) {
119
+ this._setValue(val);
120
+ this.elementRef.nativeElement.value = JSON.stringify(val);
907
121
  }
908
- selectedOptions = [option];
909
- });
910
- }
911
- this.selectionChanged(selectedOptions, true);
912
- if (this.multiple === false) {
913
- // close the dropdown if we are in single selection mode
914
- this._isOpen = false;
915
- }
916
- };
917
- /**
918
- * Update view when selection changes
919
- * @param options
920
- * @ignore
921
- */
922
- GoADropdownComponent.prototype.selectionChanged = function (options, emitEvent) {
923
- if (options.length > 0) {
924
- var selectedOptions = options.map(function (o) { return o.label; }).join(', ');
925
- this._requiredError = false;
926
- this.setTextInput(selectedOptions);
927
- }
928
- else {
929
- this._requiredError = this.required;
930
- this.setTextInput('');
931
- }
932
- if (emitEvent === true) {
933
- this.emitChange(options);
934
- }
935
- };
936
- /**
937
- * Emit selection change
938
- * @ignore
939
- */
940
- GoADropdownComponent.prototype.emitChange = function (options) {
941
- var values = options.map(function (option) { return option.value; });
942
- this.selectionChange.emit(values);
943
- };
944
- Object.defineProperty(GoADropdownComponent.prototype, "selectedItems", {
945
- /**
946
- * Gets all the currently selected options
947
- * @ignore
948
- */
949
- get: function () {
950
- if (this.allOptions === undefined) {
951
- return [];
952
- }
953
- return __spreadArray([], __read(this.allOptions.filter(function (option) { return option.selected === true; })));
954
- },
955
- enumerable: false,
956
- configurable: true
957
- });
958
- /**
959
- * Set the text of the input.
960
- * @param value The value to set
961
- * @ignore
962
- */
963
- GoADropdownComponent.prototype.setTextInput = function (value) {
964
- if (this.textInput) {
965
- this.textInput.nativeElement.value = value;
966
- // Exact matches show whole list?
967
- this.filterOptions('');
968
- }
969
- };
970
- /**
971
- * Update the filtered options with the passed in filter text.
972
- * @param filterText The text to filter by
973
- * @ignore
974
- */
975
- GoADropdownComponent.prototype.filterOptions = function (filterText) {
976
- var _this = this;
977
- this.optionGroups.forEach(function (group) {
978
- group._filteredOptions = group.options.filter(_this.typeaheadFilter.bind(_this, filterText, _this.typeaheadMode));
122
+ },
123
+ enumerable: false,
124
+ configurable: true
979
125
  });
980
- this._filteredOptions = this.options.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));
981
- this._allFilteredOptions = this.allOptions.filter(this.typeaheadFilter.bind(this, filterText, this.typeaheadMode));
982
- // The filters have changed so update the active option incase it has been filtered out.
983
- this._activeOption = this._allFilteredOptions[this._activeIndex % this._allFilteredOptions.length];
984
- };
985
- /**
986
- * Filter for typeahead with logic for what mode we are in.
987
- * @param option
988
- * @ignore
989
- */
990
- GoADropdownComponent.prototype.typeaheadFilter = function (filterText, typeaheadMode, option) {
991
- if (typeaheadMode === 'none' || this.typeaheadMode === undefined) {
992
- return true;
993
- }
994
- if (typeaheadMode === 'startsWith') {
995
- return option.label.toLocaleLowerCase().startsWith(filterText.toLocaleLowerCase());
996
- }
997
- if (typeaheadMode === 'contains') {
998
- return option.label.toLocaleLowerCase().includes(filterText.toLocaleLowerCase());
999
- }
1000
- };
1001
- return GoADropdownComponent;
1002
- }());
1003
- GoADropdownComponent.decorators = [
1004
- { type: i0.Component, args: [{
1005
- selector: 'goa-dropdown',
1006
- 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",
1007
- styles: [""]
1008
- },] }
1009
- ];
1010
- GoADropdownComponent.ctorParameters = function () { return [
1011
- { type: i0.ChangeDetectorRef }
1012
- ]; };
1013
- GoADropdownComponent.propDecorators = {
1014
- typeaheadMode: [{ type: i0.Input }],
1015
- menuHeight: [{ type: i0.Input }],
1016
- label: [{ type: i0.Input }],
1017
- description: [{ type: i0.Input }],
1018
- selectedIds: [{ type: i0.Input }],
1019
- disabled: [{ type: i0.Input }],
1020
- multiple: [{ type: i0.Input }],
1021
- required: [{ type: i0.Input }],
1022
- textInput: [{ type: i0.ViewChild, args: ['textInput',] }],
1023
- allOptions: [{ type: i0.ContentChildren, args: [GoAOptionComponent, { descendants: true },] }],
1024
- options: [{ type: i0.ContentChildren, args: [GoAOptionComponent, { descendants: false },] }],
1025
- optionGroups: [{ type: i0.ContentChildren, args: [GoAOptionGroupComponent, { descendants: false },] }],
1026
- selectionChange: [{ type: i0.Output }]
1027
- };
1028
-
1029
- var GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR = {
1030
- provide: forms.NG_VALUE_ACCESSOR,
1031
- useExisting: i0.forwardRef(function () { return GoACheckboxComponent; }),
1032
- multi: true
1033
- };
1034
- /**
1035
- * Checkbox component with Government of Alberta styling.
1036
- * selector: goa-checkbox
1037
- */
1038
- var GoACheckboxComponent = /** @class */ (function () {
1039
- function GoACheckboxComponent(_changeDetectorRef) {
1040
- this._changeDetectorRef = _changeDetectorRef;
1041
- /**
1042
- * @ignore
1043
- */
1044
- this._indeterminate = false;
1045
- /**
1046
- * The position to display the label/text for the checbox. Valid values are before and after.
1047
- */
1048
- this.labelPosition = 'after';
1049
- /**
1050
- * Event emitted containing the source checkbox, and whether or not it is checked.
1051
- */
1052
- this.selectionChange = new i0.EventEmitter();
1053
- /**
1054
- * @ignore
1055
- */
1056
- this._propagateChange = function (_) { };
1057
- this.uniqueId = "goa-checkbox-" + GoACheckboxComponent.idNum++;
1058
- }
1059
- Object.defineProperty(GoACheckboxComponent.prototype, "indeterminate", {
1060
- /**
1061
- * Boolean indicating whether or not the checkbox should display as indeterminate
1062
- * (i.e. it has associated 'child' checkboxes, some of which are selected).
1063
- */
1064
- get: function () { return this._indeterminate; },
1065
- set: function (value) {
1066
- // only do something if value has changed from current
1067
- if (value !== this.indeterminate) {
1068
- this._indeterminate = value;
1069
- // can't be indeterminate and checked, so clear checked
1070
- if (this._indeterminate) {
1071
- this.checked = false;
1072
- }
126
+ ValuesDirective.prototype.writeValue = function (value) {
127
+ if (value) {
128
+ this.value = value;
1073
129
  }
1074
- },
1075
- enumerable: false,
1076
- configurable: true
1077
- });
1078
- /**
1079
- * Boolean indicating if the checkbox is required and not checked
1080
- * @ignore
1081
- */
1082
- GoACheckboxComponent.prototype.hasError = function () {
1083
- return this.required && !this.checked;
1084
- };
1085
- /**
1086
- * Implemented as part of ControlValueAccessor.
1087
- * @param value The model bound property, i.e. the value of checked
1088
- * @ignore
1089
- */
1090
- GoACheckboxComponent.prototype.writeValue = function (value) {
1091
- if ((value !== undefined) && (value !== null)) {
1092
- this.checked = value;
1093
- this._changeDetectorRef.detectChanges();
1094
- }
1095
- };
1096
- /**
1097
- * Implemented as part of ControlValueAccessor.
1098
- * @param fn The function to call on change. Provided by ControlValueAccessor
1099
- * @ignore
1100
- */
1101
- GoACheckboxComponent.prototype.registerOnChange = function (fn) {
1102
- this._propagateChange = fn;
1103
- };
1104
- /**
1105
- * Implemented as part of ControlValueAccessor.
1106
- * @param fn The function to call on touch. Provided by ControlValueAccessor
1107
- * @ignore
1108
- */
1109
- GoACheckboxComponent.prototype.registerOnTouched = function (fn) {
1110
- this._onTouchedCallback = fn;
1111
- };
1112
- ;
1113
- /**
1114
- * Toggles the checked value of the checkbox
1115
- * @ignore
1116
- */
1117
- GoACheckboxComponent.prototype.toggle = function () {
1118
- this.checked = !this.checked;
1119
- };
1120
- /**
1121
- * User interaction event on click of the checkbox or its label to indicate toggling of the current checked status.
1122
- * Emits selectionChange to parent components.
1123
- * @ignore
1124
- */
1125
- GoACheckboxComponent.prototype.onChange = function (event) {
1126
- event.stopPropagation();
1127
- this.toggle();
1128
- // user manually clicking overrides indeterminate and sets it to false
1129
- // this is because if they click and set to checked/unchecked, all 'child' checkboxes should get set to
1130
- // checked/unchecked (by user routine, not here), so this checkbox is no longer indeterminate
1131
- this.indeterminate = false;
1132
- var checkBoxChange = {
1133
- source: this,
1134
- checked: this.checked
1135
130
  };
1136
- this._propagateChange(this.checked);
1137
- this.selectionChange.emit(checkBoxChange);
1138
- };
1139
- return GoACheckboxComponent;
1140
- }());
1141
- /**
1142
- * @ignore
1143
- */
1144
- GoACheckboxComponent.idNum = 0;
1145
- GoACheckboxComponent.decorators = [
1146
- { type: i0.Component, args: [{
1147
- selector: 'goa-checkbox',
1148
- 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",
1149
- //register our custom ControlValueAccessor with angular DI system so angular knows how to get instance of it for ngModel binding
1150
- providers: [GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR],
1151
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1152
- styles: [""]
1153
- },] }
1154
- ];
1155
- GoACheckboxComponent.ctorParameters = function () { return [
1156
- { type: i0.ChangeDetectorRef }
1157
- ]; };
1158
- GoACheckboxComponent.propDecorators = {
1159
- value: [{ type: i0.Input }],
1160
- checked: [{ type: i0.Input }],
1161
- disabled: [{ type: i0.Input }],
1162
- required: [{ type: i0.Input }],
1163
- indeterminate: [{ type: i0.Input }],
1164
- labelPosition: [{ type: i0.Input }],
1165
- selectionChange: [{ type: i0.Output }]
1166
- };
1167
-
1168
- var GoARadioChange = /** @class */ (function () {
1169
- function GoARadioChange() {
1170
- }
1171
- return GoARadioChange;
1172
- }());
1173
-
1174
- var GoARadioService = /** @class */ (function () {
1175
- function GoARadioService() {
1176
- this.radioChangeMessage = new rxjs.BehaviorSubject(new GoARadioChange());
1177
- }
1178
- GoARadioService.prototype.selectRadio = function (radioChange) {
1179
- this.radioChangeMessage.next(radioChange);
1180
- };
1181
- return GoARadioService;
1182
- }());
1183
- GoARadioService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GoARadioService_Factory() { return new GoARadioService(); }, token: GoARadioService, providedIn: "root" });
1184
- GoARadioService.decorators = [
1185
- { type: i0.Injectable, args: [{
1186
- providedIn: 'root',
1187
- },] }
1188
- ];
1189
- GoARadioService.ctorParameters = function () { return []; };
1190
-
1191
- /**
1192
- * Control value accessor to use for the component's provider
1193
- * @ignore
1194
- */
1195
- var GOA_RADIO_CONTROL_VALUE_ACCESSOR = {
1196
- provide: forms.NG_VALUE_ACCESSOR,
1197
- useExisting: i0.forwardRef(function () { return GoARadioComponent; }),
1198
- multi: true
1199
- };
1200
- /**
1201
- * Radiobutton component with Government of Alberta styling.
1202
- */
1203
- var GoARadioComponent = /** @class */ (function () {
1204
- function GoARadioComponent(_changeDetector, _radioService) {
1205
- this._changeDetector = _changeDetector;
1206
- this._radioService = _radioService;
1207
- /**
1208
- * The position to display the label/text for the radiobutton. Valid values are before and after.
1209
- */
1210
- this.labelPosition = 'after';
1211
- /**
1212
- * Event emitted containing the source radiobutton, and whether or not it is checked.
1213
- */
1214
- this.selectionChange = new i0.EventEmitter();
1215
- /**
1216
- * @ignore
1217
- */
1218
- this._propagateChange = function (_) { };
1219
- this.uniqueId = "goa-radiobutton-" + GoARadioComponent.idNum++;
1220
- }
1221
- /**
1222
- * Lifecycle hook OnInit. Used to subscribe to radio change messages from the radioService in order to know whether or not
1223
- * this radio should be checked or not.
1224
- * @ignore
1225
- */
1226
- GoARadioComponent.prototype.ngOnInit = function () {
1227
- var _this = this;
1228
- this.radioServiceSubscription = this._radioService.radioChangeMessage.subscribe(function (rcm) {
1229
- if (rcm && rcm.source && rcm.source.name === _this.name && rcm.source.uniqueId !== _this.uniqueId) {
1230
- _this.checked = false;
1231
- _this._changeDetector.detectChanges();
1232
- }
1233
- });
1234
- };
1235
- /**
1236
- * Lifecycle hook OnDestroy. Used to unsubscribe from the radio change messages.
1237
- * @ignore
1238
- */
1239
- GoARadioComponent.prototype.ngOnDestroy = function () {
1240
- this.radioServiceSubscription.unsubscribe();
1241
- };
1242
- /**
1243
- * Boolean indicating if the radiobutton is required and not checked
1244
- * @ignore
1245
- */
1246
- GoARadioComponent.prototype.hasError = function () {
1247
- return this.required && !this.checked;
1248
- };
1249
- /**
1250
- * Marks the radio button as needing checking for change detection.
1251
- * This method is exposed because the parent radio group will directly
1252
- * update bound properties of the radio button.
1253
- */
1254
- GoARadioComponent.prototype.markForCheck = function () {
1255
- // When group value changes, the button will not be notified. Use `markForCheck` to explicitly
1256
- // update radio button's status
1257
- this._changeDetector.markForCheck();
1258
- };
1259
- /**
1260
- * Implemented as part of ControlValueAccessor.
1261
- * @param value The model bound property, i.e. the value of checked
1262
- * @ignore
1263
- */
1264
- GoARadioComponent.prototype.writeValue = function (value) {
1265
- if ((value !== undefined) && (value !== null)) {
1266
- this.checked = value;
1267
- this._changeDetector.detectChanges();
1268
- }
1269
- };
1270
- /**
1271
- * Implemented as part of ControlValueAccessor.
1272
- * @param fn The function to call on change. Provided by ControlValueAccessor
1273
- * @ignore
1274
- */
1275
- GoARadioComponent.prototype.registerOnChange = function (fn) {
1276
- this._propagateChange = fn;
1277
- };
1278
- /**
1279
- * Implemented as part of ControlValueAccessor.
1280
- * @param fn The function to call on touch. Provided by ControlValueAccessor
1281
- * @ignore
1282
- */
1283
- GoARadioComponent.prototype.registerOnTouched = function (fn) {
1284
- this._onTouchedCallback = fn;
1285
- };
1286
- ;
1287
- /**
1288
- * User interaction event on click of the radiobutton or its label to indicate toggling of the current checked status.
1289
- * Emits selectionChange to parent components.
1290
- * @ignore
1291
- */
1292
- GoARadioComponent.prototype.onClick = function () {
1293
- // flip the checked state of this radio
1294
- this.checked = !this.checked;
1295
- // emit radio change event for those interested
1296
- var radioChange = {
1297
- source: this,
1298
- checked: this.checked
131
+ ValuesDirective.prototype.registerOnChange = function (fn) {
132
+ this.onChange = fn;
1299
133
  };
1300
- this._propagateChange(this.checked);
1301
- this.selectionChange.emit(radioChange);
1302
- // notify other radios in group/with same name via radio service so they know to flip their states to not checked
1303
- this._radioService.selectRadio(radioChange);
1304
- };
1305
- return GoARadioComponent;
1306
- }());
1307
- /**
1308
- * Used to generate unique Id for this component
1309
- * @ignore
1310
- */
1311
- GoARadioComponent.idNum = 0;
1312
- GoARadioComponent.decorators = [
1313
- { type: i0.Component, args: [{
1314
- selector: 'goa-radio',
1315
- 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",
1316
- //register our custom ControlValueAccessor with angular DI system so angular knows how to get instance of it for ngModel binding
1317
- providers: [GOA_RADIO_CONTROL_VALUE_ACCESSOR],
1318
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1319
- styles: [""]
1320
- },] }
1321
- ];
1322
- GoARadioComponent.ctorParameters = function () { return [
1323
- { type: i0.ChangeDetectorRef },
1324
- { type: GoARadioService }
1325
- ]; };
1326
- GoARadioComponent.propDecorators = {
1327
- name: [{ type: i0.Input }],
1328
- value: [{ type: i0.Input }],
1329
- checked: [{ type: i0.Input }],
1330
- disabled: [{ type: i0.Input }],
1331
- required: [{ type: i0.Input }],
1332
- labelPosition: [{ type: i0.Input }],
1333
- selectionChange: [{ type: i0.Output }]
1334
- };
1335
-
1336
- /**
1337
- * Control value accessor to use for the component's provider
1338
- * @ignore
1339
- */
1340
- var GOA_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = {
1341
- provide: forms.NG_VALUE_ACCESSOR,
1342
- useExisting: i0.forwardRef(function () { return GoARadioGroupComponent; }),
1343
- multi: true
1344
- };
1345
- /**
1346
- * Injection token that can be used to inject instances of `GoARadioGroupComponent`. It serves as
1347
- * alternative token to the actual `GoARadioGroupComponent` class which could cause unnecessary
1348
- * retention of the class and its component metadata.
1349
- * @ignore
1350
- */
1351
- var GOA_RADIO_GROUP = new i0.InjectionToken('GoARadioGroup');
1352
- /**
1353
- * Radiobutton group component with Government of Alberta styling. Used to group a set of related radio buttons.
1354
- */
1355
- var GoARadioGroupComponent = /** @class */ (function () {
1356
- function GoARadioGroupComponent(_changeDetector, _radioService) {
1357
- this._changeDetector = _changeDetector;
1358
- this._radioService = _radioService;
1359
- /**
1360
- * @ignore
1361
- */
1362
- this._name = "goa-radio-group-" + GoARadioGroupComponent.idNum++;
1363
- /**
1364
- * @ignore
1365
- */
1366
- this._value = null;
1367
- /**
1368
- * @ignore
1369
- */
1370
- this._labelPosition = 'after';
1371
- /**
1372
- * The error message to display when the radio group selection is required and nothing has been selected
1373
- */
1374
- this.requiredErrorMessage = 'Please select one of the provided options.';
1375
- /**
1376
- * Event emitted containing the source radiobutton, and whether or not it is checked.
1377
- */
1378
- this.selectionChange = new i0.EventEmitter();
1379
- /**
1380
- * @ignore
1381
- */
1382
- this._propagateChange = function (_) { };
1383
- this.uniqueId = "goa-radiobutton-group-" + GoARadioGroupComponent.idNum++;
1384
- }
1385
- Object.defineProperty(GoARadioGroupComponent.prototype, "name", {
1386
- /**
1387
- * Indicates the "group" or set of radios this radio belongs to.
1388
- */
1389
- get: function () { return this._name; },
1390
- set: function (value) {
1391
- this._name = value;
1392
- this._updateRadioButtonNames();
1393
- },
1394
- enumerable: false,
1395
- configurable: true
1396
- });
1397
- Object.defineProperty(GoARadioGroupComponent.prototype, "value", {
1398
- /**
1399
- * Value/unique identifier for the object the radiobutton represents.
1400
- */
1401
- get: function () { return this._value; },
1402
- set: function (newValue) {
1403
- if (this._value !== newValue) {
1404
- // Set this before proceeding to ensure no circular loop occurs with selection.
1405
- this._value = newValue;
1406
- this._updateSelectedRadioFromValue();
1407
- this._setSelectedRadioToChecked();
1408
- }
1409
- },
1410
- enumerable: false,
1411
- configurable: true
1412
- });
1413
- Object.defineProperty(GoARadioGroupComponent.prototype, "selected", {
1414
- /**
1415
- * The currently selected radio.
1416
- */
1417
- get: function () { return this._selected; },
1418
- set: function (selected) {
1419
- this._selected = selected;
1420
- this.value = selected ? selected.value : null;
1421
- this._setSelectedRadioToChecked();
1422
- },
1423
- enumerable: false,
1424
- configurable: true
1425
- });
1426
- Object.defineProperty(GoARadioGroupComponent.prototype, "disabled", {
1427
- /**
1428
- * Boolean indicating whether or not the radiobutton is disabled.
1429
- */
1430
- get: function () { return this._disabled; },
1431
- set: function (value) {
1432
- this._disabled = value;
1433
- this._updateRadioButtonDisabled();
1434
- },
1435
- enumerable: false,
1436
- configurable: true
1437
- });
1438
- Object.defineProperty(GoARadioGroupComponent.prototype, "required", {
1439
- /**
1440
- * Boolean indicating whether or not the radiobutton is required.
1441
- */
1442
- get: function () { return this._required; },
1443
- set: function (value) {
1444
- this._required = value;
1445
- this._updateRadioButtonRequired();
1446
- },
1447
- enumerable: false,
1448
- configurable: true
1449
- });
1450
- Object.defineProperty(GoARadioGroupComponent.prototype, "labelPosition", {
1451
- /**
1452
- * The position to display the label/text for the radiobutton. Valid values are before and after.
1453
- */
1454
- get: function () {
1455
- return this._labelPosition;
1456
- },
1457
- set: function (position) {
1458
- this._labelPosition = position === 'before' ? 'before' : 'after';
1459
- this._updateRadioButtonLabelPosition();
1460
- },
1461
- enumerable: false,
1462
- configurable: true
1463
- });
1464
- /**
1465
- * Lifecycle hook AfterContentInit. Used to set properties on child radios based on the radio group's properties.
1466
- * @ignore
1467
- */
1468
- GoARadioGroupComponent.prototype.ngAfterContentInit = function () {
1469
- this._updateRadioButtonNames();
1470
- this._updateRadioButtonDisabled();
1471
- this._updateRadioButtonRequired();
1472
- this._updateRadioButtonLabelPosition();
1473
- this._updateSelectedRadioFromValue();
1474
- };
1475
- /**
1476
- * Lifecycle hook OnInit. Used to subscribe to radio change messages from the radioService in order to set the 'selected' property
1477
- * of the radio group based on which radio was selected
1478
- * @ignore
1479
- */
1480
- GoARadioGroupComponent.prototype.ngOnInit = function () {
1481
- var _this = this;
1482
- this.radioServiceSubscription = this._radioService.radioChangeMessage.subscribe(function (rcm) {
1483
- if (rcm && rcm.source && rcm.source.name === _this.name && rcm.checked) {
1484
- _this.selected = _this._radios.find(function (r) { return r.uniqueId === rcm.source.uniqueId; });
1485
- _this.selectionChange.emit(rcm);
1486
- }
1487
- });
1488
- };
1489
- /**
1490
- * Lifecycle hook OnDestroy. Used to unsubscribe from the radio change messages.
1491
- * @ignore
1492
- */
1493
- GoARadioGroupComponent.prototype.ngOnDestroy = function () {
1494
- this.radioServiceSubscription.unsubscribe();
1495
- };
1496
- /**
1497
- * Updates the `selected` radio button from the internal _value state.
1498
- */
1499
- GoARadioGroupComponent.prototype._updateSelectedRadioFromValue = function () {
1500
- var _this = this;
1501
- // If the value already matches the selected radio, do nothing.
1502
- var isAlreadySelected = this._selected !== undefined && this._selected !== null && this._selected.value === this._value;
1503
- // need to wrap in setTimeout because _radios hasnt resolved yet when Input setter fires, need to get to next cycle in page lifecycle
1504
- setTimeout(function () {
1505
- if (_this._radios && !isAlreadySelected) {
1506
- _this._selected = null;
1507
- _this._radios.forEach(function (radio) {
1508
- radio.checked = _this.value === radio.value;
1509
- if (radio.checked) {
1510
- _this._selected = radio;
1511
- }
1512
- });
1513
- }
1514
- });
1515
- };
1516
- /**
1517
- * Sets the selected radio to checked if it is not already checked
1518
- */
1519
- GoARadioGroupComponent.prototype._setSelectedRadioToChecked = function () {
1520
- if (this.selected && !this.selected.checked) {
1521
- this.selected.checked = true;
1522
- }
1523
- };
1524
- /**
1525
- * Updates the 'name' property of the child radio buttons to match that of the group so they all function together
1526
- */
1527
- GoARadioGroupComponent.prototype._updateRadioButtonNames = function () {
1528
- var _this = this;
1529
- if (this._radios) {
1530
- this._radios.forEach(function (radio) {
1531
- radio.name = _this.name;
1532
- radio.markForCheck();
1533
- });
1534
- }
1535
- };
1536
- /**
1537
- * Updates the 'disabled' property of the child radio buttons to match the disabled state of the radio group
1538
- */
1539
- GoARadioGroupComponent.prototype._updateRadioButtonDisabled = function () {
1540
- var _this = this;
1541
- if (this._radios) {
1542
- this._radios.forEach(function (radio) {
1543
- radio.required = _this._required;
1544
- radio.markForCheck();
1545
- });
1546
- }
1547
- };
1548
- /**
1549
- * Updates the 'required' property of the child radio buttons to match the required state of the radio group
1550
- */
1551
- GoARadioGroupComponent.prototype._updateRadioButtonRequired = function () {
1552
- var _this = this;
1553
- if (this._radios) {
1554
- this._radios.forEach(function (radio) {
1555
- radio.required = _this._required;
1556
- radio.markForCheck();
1557
- });
1558
- }
1559
- };
1560
- /**
1561
- * Updates the 'labelPosition' property of the child radio buttons to match the labelPosition state of the radio group
1562
- */
1563
- GoARadioGroupComponent.prototype._updateRadioButtonLabelPosition = function () {
1564
- var _this = this;
1565
- if (this._radios) {
1566
- this._radios.forEach(function (radio) {
1567
- radio.labelPosition = _this._labelPosition;
1568
- radio.markForCheck();
1569
- });
1570
- }
1571
- };
1572
- /**
1573
- * Boolean indicating if the radiobutton is required and not checked
1574
- * @ignore
1575
- */
1576
- GoARadioGroupComponent.prototype.hasError = function () {
1577
- var hasSelectedRadio = this._radios.some(function (r) { return r.checked; });
1578
- return this.required && !hasSelectedRadio;
1579
- };
1580
- /**
1581
- * Implemented as part of ControlValueAccessor.
1582
- * @param value The model bound property, i.e. the value of checked
1583
- * @ignore
1584
- */
1585
- GoARadioGroupComponent.prototype.writeValue = function (value) {
1586
- if ((value !== undefined) && (value !== null)) {
1587
- this.selected = value;
1588
- this._changeDetector.detectChanges();
1589
- }
1590
- };
1591
- /**
1592
- * Implemented as part of ControlValueAccessor.
1593
- * @param fn The function to call on change. Provided by ControlValueAccessor
1594
- * @ignore
1595
- */
1596
- GoARadioGroupComponent.prototype.registerOnChange = function (fn) {
1597
- this._propagateChange = fn;
1598
- };
1599
- /**
1600
- * Implemented as part of ControlValueAccessor.
1601
- * @param fn The function to call on touch. Provided by ControlValueAccessor
1602
- * @ignore
1603
- */
1604
- GoARadioGroupComponent.prototype.registerOnTouched = function (fn) {
1605
- this._onTouchedCallback = fn;
1606
- };
1607
- ;
1608
- return GoARadioGroupComponent;
1609
- }());
1610
- /**
1611
- * Used to generate unique Id for this component
1612
- * @ignore
1613
- */
1614
- GoARadioGroupComponent.idNum = 0;
1615
- GoARadioGroupComponent.decorators = [
1616
- { type: i0.Component, args: [{
1617
- selector: 'goa-radio-group',
1618
- template: "<div class=\"goa-radio-group\" [ngClass]=\"{'goa-radio-group-disabled': disabled}\">\n <span *ngIf=\"title\" class=\"radio-group-title\">{{title}}</span>\n <span *ngIf=\"required\" class=\"required-label\" i18n=\"Required label for dropdown\">(Required)</span>\n <div *ngIf=\"helperText\" class=\"helper-text\">{{helperText}}</div>\n <div class=\"goa-radios\">\n <ng-content></ng-content>\n </div>\n <div *ngIf=\"hasError()\" class=\"error-text\">{{requiredErrorMessage}}</div>\n</div>\n",
1619
- providers: [
1620
- GOA_RADIO_GROUP_CONTROL_VALUE_ACCESSOR,
1621
- { provide: GOA_RADIO_GROUP, useExisting: GoARadioGroupComponent }
1622
- ],
1623
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1624
- styles: [""]
1625
- },] }
1626
- ];
1627
- GoARadioGroupComponent.ctorParameters = function () { return [
1628
- { type: i0.ChangeDetectorRef },
1629
- { type: GoARadioService }
1630
- ]; };
1631
- GoARadioGroupComponent.propDecorators = {
1632
- _radios: [{ type: i0.ContentChildren, args: [i0.forwardRef(function () { return GoARadioComponent; }), { descendants: true },] }],
1633
- title: [{ type: i0.Input }],
1634
- helperText: [{ type: i0.Input }],
1635
- requiredErrorMessage: [{ type: i0.Input }],
1636
- name: [{ type: i0.Input }],
1637
- value: [{ type: i0.Input }],
1638
- selected: [{ type: i0.Input }],
1639
- disabled: [{ type: i0.Input }],
1640
- required: [{ type: i0.Input }],
1641
- labelPosition: [{ type: i0.Input }],
1642
- selectionChange: [{ type: i0.Output }]
1643
- };
1644
-
1645
- /**
1646
- * Callout component to describe important changes or facts.
1647
- * selector: goa-callout
1648
- */
1649
- var GoACalloutComponent = /** @class */ (function () {
1650
- function GoACalloutComponent() {
1651
- /**
1652
- * The type of the callout, changes stylings and icons.
1653
- */
1654
- this.type = 'information';
1655
- }
1656
- /**
1657
- * @ignore
1658
- */
1659
- GoACalloutComponent.prototype.ngOnInit = function () {
1660
- if (this.title === undefined || this.title === null) {
1661
- throw new TypeError("Input 'title' is required.");
1662
- }
1663
- };
1664
- return GoACalloutComponent;
1665
- }());
1666
- GoACalloutComponent.decorators = [
1667
- { type: i0.Component, args: [{
1668
- selector: 'goa-callout',
1669
- template: "<div\n class=\"goa-callout\"\n [ngClass]=\"{\n 'goa--event': type === 'event',\n 'goa--important': type === 'important',\n 'goa--emergency': type === 'emergency',\n 'goa--success': type === 'success'\n }\"\n>\n <div>\n <h3>{{ title }}</h3>\n <div class=\"messages\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n",
1670
- styles: [""]
1671
- },] }
1672
- ];
1673
- GoACalloutComponent.ctorParameters = function () { return []; };
1674
- GoACalloutComponent.propDecorators = {
1675
- type: [{ type: i0.Input }],
1676
- title: [{ type: i0.Input }]
1677
- };
1678
-
1679
- /**
1680
- * Government of Alberta styled notification, comes in 4 variants: emergency, event, information, important.
1681
- * Can set the message and optionally a link url.
1682
- * selector: goa-notification
1683
- */
1684
- var GoANotificationComponent = /** @class */ (function () {
1685
- function GoANotificationComponent(_changeDetectorRef) {
1686
- this._changeDetectorRef = _changeDetectorRef;
1687
- /**
1688
- * Whether or not the notification has been dismissed.
1689
- * @ignore
1690
- */
1691
- this._isDismissed = false;
1692
- /**
1693
- * The type of the notification, changes stylings and icons.
1694
- */
1695
- this.type = 'information';
1696
- /**
1697
- * Can the notification be dismissed?
1698
- */
1699
- this.isDismissable = true;
1700
- /**
1701
- * Event emitted when the notification has been dismissed by the user.
1702
- */
1703
- this.dismiss = new i0.EventEmitter();
1704
- }
1705
- /**
1706
- * @ignore
1707
- */
1708
- GoANotificationComponent.prototype.ngOnInit = function () {
1709
- };
1710
- /**
1711
- * @ignore
1712
- */
1713
- GoANotificationComponent.prototype.dismissClick = function () {
1714
- this._isDismissed = true;
1715
- this._changeDetectorRef.detectChanges();
1716
- this.dismiss.emit();
1717
- };
1718
- return GoANotificationComponent;
1719
- }());
1720
- GoANotificationComponent.decorators = [
1721
- { type: i0.Component, args: [{
1722
- selector: 'goa-notification',
1723
- template: "\n<div class=\"goa-notification\"\n [ngClass]=\"{\n 'dismissed': _isDismissed === true,\n 'goa--event': type === 'event',\n 'goa--important': type === 'important',\n 'goa--emergency': type === 'emergency'\n }\">\n <div class=\"content\">\n <a *ngIf=\"notificationUrl\" class=\"message\" href={{notificationUrl}}>{{message}}</a>\n <span *ngIf=\"!notificationUrl\" class=\"message\">{{message}}</span>\n <a *ngIf=\"isDismissable === true\" class=\"close\" i18n-title title=\"Dismiss\" (click)=\"dismissClick()\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n <path d=\"M 15.99 14.54C 15.99 14.54 14.54 15.99 14.54 15.99 14.54 15.99 8 9.45 8 9.45 8 9.45 1.46 15.99 1.46 15.99 1.46 15.99 0.01 14.54 0.01 14.54 0.01 14.54 6.55 8 6.55 8 6.55 8 0.01 1.46 0.01 1.46 0.01 1.46 1.46 0.01 1.46 0.01 1.46 0.01 8 6.55 8 6.55 8 6.55 14.54 0.01 14.54 0.01 14.54 0.01 15.99 1.46 15.99 1.46 15.99 1.46 9.45 8 9.45 8 9.45 8 15.99 14.54 15.99 14.54Z\"/>\n </svg>\n </a>\n </div>\n</div>\n\n",
1724
- styles: [""]
1725
- },] }
1726
- ];
1727
- GoANotificationComponent.ctorParameters = function () { return [
1728
- { type: i0.ChangeDetectorRef }
1729
- ]; };
1730
- GoANotificationComponent.propDecorators = {
1731
- type: [{ type: i0.Input }],
1732
- message: [{ type: i0.Input }],
1733
- notificationUrl: [{ type: i0.Input }],
1734
- isDismissable: [{ type: i0.Input }],
1735
- dismiss: [{ type: i0.Output }]
1736
- };
1737
-
1738
- /**
1739
- * Government of Alberta styled notification banner. Contains one or more notifications.
1740
- * selector: goa-notification-banner
1741
- */
1742
- var GoANotificationBannerComponent = /** @class */ (function () {
1743
- function GoANotificationBannerComponent() {
1744
- /**
1745
- * The accessibility title for the notification banner. Is not displayed.
1746
- */
1747
- this.title = 'Notifications';
1748
- }
1749
- /**
1750
- * @ignore
1751
- */
1752
- GoANotificationBannerComponent.prototype.ngOnInit = function () {
1753
- };
1754
- return GoANotificationBannerComponent;
1755
- }());
1756
- GoANotificationBannerComponent.decorators = [
1757
- { type: i0.Component, args: [{
1758
- selector: 'goa-notification-banner',
1759
- template: "<div class=\"goa-notifications\">\r\n <h2 class=\"title\">{{title}}</h2>\r\n <ng-content></ng-content>\r\n</div>\r\n\r\n",
1760
- styles: [""]
1761
- },] }
1762
- ];
1763
- GoANotificationBannerComponent.ctorParameters = function () { return []; };
1764
- GoANotificationBannerComponent.propDecorators = {
1765
- title: [{ type: i0.Input }],
1766
- _notifications: [{ type: i0.ContentChildren, args: [GoANotificationComponent, { descendants: false },] }]
1767
- };
1768
-
1769
- var GoASkeletonImageContentComponent = /** @class */ (function () {
1770
- function GoASkeletonImageContentComponent() {
1771
- this.rows = 1;
1772
- this.arr = Array;
1773
- }
1774
- return GoASkeletonImageContentComponent;
1775
- }());
1776
- GoASkeletonImageContentComponent.decorators = [
1777
- { type: i0.Component, args: [{
1778
- selector: 'goa-skeleton-image-content',
1779
- template: "<div class=\"skeleton-image-content\">\n <goa-skeleton-element type=\"thumbnail\"></goa-skeleton-element>\n <div class=\"skeleton-image-content__text\">\n <goa-skeleton-element\n type=\"title\"\n *ngFor=\"let i of arr(rows).fill(1)\"\n ></goa-skeleton-element>\n </div>\n</div>\n",
1780
- styles: [""]
1781
- },] }
1782
- ];
1783
- GoASkeletonImageContentComponent.ctorParameters = function () { return []; };
1784
- GoASkeletonImageContentComponent.propDecorators = {
1785
- rows: [{ type: i0.Input }]
1786
- };
1787
-
1788
- var GoASkeletonElementComponent = /** @class */ (function () {
1789
- function GoASkeletonElementComponent() {
1790
- this.type = 'text';
1791
- }
1792
- Object.defineProperty(GoASkeletonElementComponent.prototype, "elementClass", {
1793
- get: function () {
1794
- return "skeleton " + this.type;
1795
- },
1796
- enumerable: false,
1797
- configurable: true
1798
- });
1799
- return GoASkeletonElementComponent;
1800
- }());
1801
- GoASkeletonElementComponent.decorators = [
1802
- { type: i0.Component, args: [{
1803
- selector: 'goa-skeleton-element',
1804
- template: "<div [ngClass]=\"elementClass\"></div>",
1805
- styles: [""]
1806
- },] }
1807
- ];
1808
- GoASkeletonElementComponent.ctorParameters = function () { return []; };
1809
- GoASkeletonElementComponent.propDecorators = {
1810
- type: [{ type: i0.Input }]
1811
- };
1812
-
1813
- /**
1814
- * Header component used for Government of Alberta cards.
1815
- * Put header content inside of component and it will project to the header section of the card.
1816
- * selector: goa-card-header
1817
- * @example <goa-card><goa-card-header>My content</goa-card-header></goa-card>
1818
- */
1819
- var GoACardHeaderComponent = /** @class */ (function () {
1820
- function GoACardHeaderComponent() {
1821
- }
1822
- /**
1823
- * @ignore
1824
- */
1825
- GoACardHeaderComponent.prototype.ngOnInit = function () {
1826
- };
1827
- return GoACardHeaderComponent;
1828
- }());
1829
- GoACardHeaderComponent.decorators = [
1830
- { type: i0.Component, args: [{
1831
- selector: 'goa-card-header',
1832
- template: "<ng-container>\n <ng-content></ng-content>\n</ng-container>",
1833
- styles: [""]
1834
- },] }
1835
- ];
1836
- GoACardHeaderComponent.ctorParameters = function () { return []; };
1837
-
1838
- /**
1839
- * Footer component used for Government of Alberta cards.
1840
- * Put footer content inside of component and it will project to the confootertent section of the card.
1841
- * selector: goa-card-footer
1842
- * @example <goa-card><goa-card-footer>My content</goa-card-footer></goa-card>
1843
- */
1844
- var GoACardFooterComponent = /** @class */ (function () {
1845
- function GoACardFooterComponent() {
1846
- }
1847
- /**
1848
- * @ignore
1849
- */
1850
- GoACardFooterComponent.prototype.ngOnInit = function () {
1851
- };
1852
- return GoACardFooterComponent;
1853
- }());
1854
- GoACardFooterComponent.decorators = [
1855
- { type: i0.Component, args: [{
1856
- selector: 'goa-card-footer',
1857
- template: "<ng-container>\n <ng-content></ng-content>\n</ng-container>",
1858
- styles: [""]
1859
- },] }
1860
- ];
1861
- GoACardFooterComponent.ctorParameters = function () { return []; };
1862
-
1863
- /**
1864
- * cardImage image component used for Government of Alberta cards.
1865
- * It will project to the content section of the card.
1866
- * selector: goa-card-thumb-image
1867
- * @example <goa-card><goa-card-thumb-image url="" alt=""></goa-card-thumb-image></goa-card>
1868
- */
1869
- var GoACardThumbImageComponent = /** @class */ (function () {
1870
- function GoACardThumbImageComponent() {
1871
- }
1872
- /**
1873
- * @ignore
1874
- */
1875
- GoACardThumbImageComponent.prototype.ngOnInit = function () { };
1876
- return GoACardThumbImageComponent;
1877
- }());
1878
- GoACardThumbImageComponent.decorators = [
1879
- { type: i0.Component, args: [{
1880
- selector: 'goa-card-thumb-image',
1881
- template: "<ng-container>\n <img src=\"{{url}}\" [attr.alt]=\"alt\">\n</ng-container>",
1882
- styles: [":host img,:host iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:none}\n"]
1883
- },] }
1884
- ];
1885
- GoACardThumbImageComponent.ctorParameters = function () { return []; };
1886
- GoACardThumbImageComponent.propDecorators = {
1887
- url: [{ type: i0.Input }],
1888
- alt: [{ type: i0.Input }]
1889
- };
1890
-
1891
- /**
1892
- * Content component used for Government of Alberta cards.
1893
- * Put content inside of component and it will project to the content section of the card.
1894
- * selector: goa-card-content
1895
- * @example <goa-card><goa-card-content>My content</goa-card-content></goa-card>
1896
- */
1897
- var GoACardContentComponent = /** @class */ (function () {
1898
- function GoACardContentComponent() {
1899
- }
1900
- /**
1901
- * @ignore
1902
- */
1903
- GoACardContentComponent.prototype.ngOnInit = function () {
1904
- };
1905
- return GoACardContentComponent;
1906
- }());
1907
- GoACardContentComponent.decorators = [
1908
- { type: i0.Component, args: [{
1909
- selector: 'goa-card-content',
1910
- template: "<ng-container>\n <ng-content></ng-content>\n</ng-container>",
1911
- styles: [""]
1912
- },] }
1913
- ];
1914
- GoACardContentComponent.ctorParameters = function () { return []; };
1915
-
1916
- /**
1917
- * Card component with Government of Alberta styling.
1918
- * Place desired sub-components (goa-card-thumb-image, goa-card-header, goa-card-content, goa-card-footer) inside of content.
1919
- * selector: goa-card
1920
- */
1921
- var GoACardComponent = /** @class */ (function () {
1922
- function GoACardComponent() {
1923
- /**
1924
- * What percentage of container width to take.
1925
- */
1926
- this.cardSize = 'full';
1927
- }
1928
- /**
1929
- * @ignore
1930
- */
1931
- GoACardComponent.prototype.ngOnInit = function () {
1932
- };
1933
- return GoACardComponent;
1934
- }());
1935
- GoACardComponent.decorators = [
1936
- { type: i0.Component, args: [{
1937
- selector: 'goa-card',
1938
- template: "<div\n class=\"goa-card\"\n [ngClass]=\"{\n 'card-auto': cardSize === 'auto'\n }\" [attr.data-skeleton]=\"isSkeleton ? '' : null\"\n>\n <div class=\"goa-poster\">\n <ng-content select=\"goa-card-thumb-image\"></ng-content>\n </div>\n <div class=\"card-content\">\n <a class=\"goa-title\" href=\"{{ titleUrl }}\">\n <ng-content select=\"goa-card-header\"></ng-content>\n </a>\n <div class=\"goa-text\">\n <ng-content select=\"goa-card-content\"></ng-content>\n </div>\n <div class=\"goa-footer\">\n <ng-content select=\"goa-card-footer\"></ng-content>\n </div>\n </div>\n</div>\n",
1939
- styles: [""]
1940
- },] }
1941
- ];
1942
- GoACardComponent.ctorParameters = function () { return []; };
1943
- GoACardComponent.propDecorators = {
1944
- cardSize: [{ type: i0.Input }],
1945
- titleUrl: [{ type: i0.Input }],
1946
- isSkeleton: [{ type: i0.Input }]
1947
- };
1948
-
1949
- /**
1950
- * A wrapper/group for a set of card display
1951
- */
1952
- var GoACardGroupComponent = /** @class */ (function () {
1953
- function GoACardGroupComponent() {
1954
- }
1955
- /* eslint-disable @angular-eslint/no-empty-lifecycle-method */
1956
- GoACardGroupComponent.prototype.ngOnInit = function () { };
1957
- return GoACardGroupComponent;
1958
- }());
1959
- GoACardGroupComponent.decorators = [
1960
- { type: i0.Component, args: [{
1961
- selector: 'goa-card-group',
1962
- template: "<ng-container>\n <div class=\"goa-card-group\">\n <div class=\"card-group-title\">{{ title }}</div>\n <div\n [ngClass]=\"{\n 'card-group-basic': layout === 'basic',\n 'card-group-column': layout === 'column'\n }\"\n >\n <ng-content></ng-content>\n <div *ngFor=\"let card of cardItems\">\n <goa-card titleUrl=\"{{ card.titleUrl }}\">\n <goa-card-thumb-image\n url=\"{{ card.cardImageUrl }}\"\n alt=\"hero pic\"\n ></goa-card-thumb-image>\n <goa-card-header>{{ card.title }}</goa-card-header>\n <goa-card-content>{{ card.description }}</goa-card-content>\n </goa-card>\n </div>\n </div>\n </div>\n</ng-container>\n",
1963
- styles: [""]
1964
- },] }
1965
- ];
1966
- GoACardGroupComponent.ctorParameters = function () { return []; };
1967
- GoACardGroupComponent.propDecorators = {
1968
- layout: [{ type: i0.Input }],
1969
- title: [{ type: i0.Input }],
1970
- cardItems: [{ type: i0.Input }]
1971
- };
1972
-
1973
- var GoAHeroBannerContentComponent = /** @class */ (function () {
1974
- function GoAHeroBannerContentComponent() {
1975
- }
1976
- GoAHeroBannerContentComponent.prototype.ngOnInit = function () {
1977
- };
1978
- return GoAHeroBannerContentComponent;
1979
- }());
1980
- GoAHeroBannerContentComponent.decorators = [
1981
- { type: i0.Component, args: [{
1982
- selector: 'goa-hero-banner-content',
1983
- template: "<ng-container>\n <p class=\"goa-hero-banner-content\" role=\"note\">\n <ng-content></ng-content>\n </p>\n</ng-container>\n",
1984
- styles: [""]
1985
- },] }
1986
- ];
1987
- GoAHeroBannerContentComponent.ctorParameters = function () { return []; };
1988
-
1989
- var GoAHeroBannerLinkComponent = /** @class */ (function () {
1990
- function GoAHeroBannerLinkComponent() {
1991
- }
1992
- GoAHeroBannerLinkComponent.prototype.ngOnInit = function () {
1993
- };
1994
- return GoAHeroBannerLinkComponent;
1995
- }());
1996
- GoAHeroBannerLinkComponent.decorators = [
1997
- { type: i0.Component, args: [{
1998
- selector: 'goa-hero-banner-link',
1999
- template: "<ng-container>\n <a class=\"goa-link-button right-arrow\" [href]=\"url\" role=\"link\">\n <ng-content></ng-content>\n </a>\n</ng-container>\n",
2000
- styles: [""]
2001
- },] }
2002
- ];
2003
- GoAHeroBannerLinkComponent.ctorParameters = function () { return []; };
2004
- GoAHeroBannerLinkComponent.propDecorators = {
2005
- url: [{ type: i0.Input }]
2006
- };
2007
-
2008
- var GoAHeroBannerComponent = /** @class */ (function () {
2009
- function GoAHeroBannerComponent() {
2010
- }
2011
- GoAHeroBannerComponent.prototype.ngOnInit = function () {
2012
- };
2013
- return GoAHeroBannerComponent;
2014
- }());
2015
- GoAHeroBannerComponent.decorators = [
2016
- { type: i0.Component, args: [{
2017
- selector: 'goa-hero-banner',
2018
- template: "<div class=\"goa-hero\"\n style=\"background-image: linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.40) 40%, rgba(0, 0, 0, 0.6) 100%), url({{backgroundUrl}});\"\n>\n <h1 role=\"heading\">{{ title }}</h1>\n <ng-content select=\"goa-hero-banner-content\"></ng-content>\n <ng-content select=\"goa-hero-banner-link\"></ng-content>\n</div>\n",
2019
- styles: [""]
2020
- },] }
2021
- ];
2022
- GoAHeroBannerComponent.ctorParameters = function () { return []; };
2023
- GoAHeroBannerComponent.propDecorators = {
2024
- title: [{ type: i0.Input }],
2025
- backgroundUrl: [{ type: i0.Input }]
2026
- };
2027
-
2028
- /**
2029
- * A page load indicator component with Government of Alberta styling.
2030
- * selector: goa-page-load-indicator
2031
- */
2032
- var GoAPageLoadIndicatorComponent = /** @class */ (function () {
2033
- function GoAPageLoadIndicatorComponent() {
2034
- /**
2035
- * Sets the page loader visibility state.
2036
- */
2037
- this.visible = false;
2038
- /**
2039
- * The type of page loader, deterministic and indeterministic.
2040
- */
2041
- this.type = 'infinite';
2042
- /**
2043
- * The message to display while loading.
2044
- */
2045
- this.message = '';
2046
- /**
2047
- * Sets the percentage value of the page loader while set to progress type, 0 - 100 percent.
2048
- */
2049
- this.value = 0;
2050
- /**
2051
- * Sets the page to locked and does not accept user input. When not set the component
2052
- * can be used as a child element without blocking user input.
2053
- */
2054
- this.pagelock = true;
2055
- /**
2056
- * Sets the progress indicator display type size.
2057
- */
2058
- this.displayType = 'large';
2059
- /**
2060
- * Set defaults
2061
- */
2062
- this.strokeDashoffsetDefault = 280;
2063
- this.progressMaxValue = 283;
2064
- this.strokeDashoffset = 0;
2065
- }
2066
- GoAPageLoadIndicatorComponent.prototype.ngOnInit = function () {
2067
- if (this.type !== 'progress') {
2068
- this.strokeDashoffset = this.strokeDashoffsetDefault;
2069
- }
2070
- };
2071
- GoAPageLoadIndicatorComponent.prototype.ngOnChanges = function (changes) {
2072
- if (changes.visible) {
2073
- this.blockScrollingToggle(changes.visible.currentValue);
2074
- }
2075
- if (changes.value) {
2076
- if (this.type === 'progress') {
2077
- this.setProgress(changes.value.currentValue);
134
+ ValuesDirective.prototype.registerOnTouched = function (fn) {
135
+ this.onTouched = fn;
136
+ };
137
+ ValuesDirective.prototype.listenForValueChange = function (value) {
138
+ if (!value) {
139
+ this._setValue(undefined);
140
+ return;
2078
141
  }
2079
- }
2080
- };
2081
- /**
2082
- * Toggles the page scrolling based on page load indicator's visibility.
2083
- * @param isBlock The flag to enable/disable page scroll.
2084
- * @ignore
2085
- */
2086
- GoAPageLoadIndicatorComponent.prototype.blockScrollingToggle = function (isBlock) {
2087
- if (!isBlock || !this.pagelock) {
2088
- document.body.style.removeProperty('height');
2089
- document.body.style.removeProperty('overflow');
2090
- }
2091
- else {
2092
- document.body.style.height = '100%';
2093
- document.body.style.overflow = 'hidden';
2094
- }
2095
- };
2096
- /**
2097
- * Blocks the keyboard input when page load indicator is visible.
2098
- * @ignore
2099
- */
2100
- GoAPageLoadIndicatorComponent.prototype.disableKeyboardInputHandler = function (event) {
2101
- if (this.visible) {
2102
- event.returnValue = false;
2103
- event.preventDefault();
2104
- }
2105
- };
2106
- GoAPageLoadIndicatorComponent.prototype.ngOnDestroy = function () {
2107
- this.blockScrollingToggle(false);
2108
- };
2109
- GoAPageLoadIndicatorComponent.prototype.setProgress = function (progress) {
2110
- if (this.type !== 'progress') {
2111
- return;
2112
- }
2113
- ;
2114
- if (progress === 0) {
2115
- this.strokeDashoffset = this.progressMaxValue;
2116
- return;
2117
- }
2118
- if (progress >= 100) {
2119
- return;
2120
- }
2121
- var value = this.progressMaxValue - Math.round(this.progressMaxValue * progress / 100);
2122
- this.strokeDashoffset = value;
2123
- };
2124
- return GoAPageLoadIndicatorComponent;
2125
- }());
2126
- GoAPageLoadIndicatorComponent.decorators = [
2127
- { type: i0.Component, args: [{
2128
- selector: 'goa-page-load-indicator',
2129
- 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",
2130
- styles: [""]
2131
- },] }
2132
- ];
2133
- GoAPageLoadIndicatorComponent.ctorParameters = function () { return []; };
2134
- GoAPageLoadIndicatorComponent.propDecorators = {
2135
- visible: [{ type: i0.Input }],
2136
- type: [{ type: i0.Input }],
2137
- message: [{ type: i0.Input }],
2138
- value: [{ type: i0.Input }],
2139
- pagelock: [{ type: i0.Input }],
2140
- displayType: [{ type: i0.Input }],
2141
- disableKeyboardInputHandler: [{ type: i0.HostListener, args: ['document:keydown', ['$event'],] }]
2142
- };
2143
-
2144
- /**
2145
- * A page load indicator component with Government of Alberta styling.
2146
- * selector: goa-element-load-indicator
2147
- */
2148
- var GoAElementLoadIndicatorComponent = /** @class */ (function () {
2149
- function GoAElementLoadIndicatorComponent() {
2150
- /**
2151
- * Sets the page loader visibility state.
2152
- */
2153
- this.visible = true;
2154
- /**
2155
- * The diameter of the loader in pixels.
2156
- */
2157
- this.size = 'default';
2158
- /**
2159
- * The base color of the spinner.
2160
- */
2161
- this.baseColour = '#c8eef9';
2162
- /**
2163
- * The spinner color of the spinner.
2164
- */
2165
- this.spinnerColour = '#0070c4';
2166
- this.radius = this.size === 'small' ? 16 : 18;
2167
- this.innerRadius = this.radius - 4;
2168
- this.diameter = this.radius * 2;
2169
- this.dashArray = this.innerRadius * Math.PI * 2;
2170
- this.dashOffset = this.innerRadius * Math.PI * 0.5;
2171
- this.viewBox = "0 0 " + this.diameter + " " + this.diameter;
2172
- }
2173
- /**
2174
- * @ignore
2175
- */
2176
- GoAElementLoadIndicatorComponent.prototype.ngOnChanges = function (changes) {
2177
- if (changes.size) {
2178
- this.radius = changes.size.currentValue === 'small' ? 16 : 18;
2179
- this.innerRadius = this.radius - 4;
2180
- this.diameter = this.radius * 2;
2181
- this.viewBox = "0 0 " + this.diameter + " " + this.diameter;
2182
- this.dashArray = this.innerRadius * Math.PI * 2;
2183
- this.dashOffset = this.innerRadius * Math.PI * 0.5;
2184
- }
2185
- };
2186
- /**
2187
- * @ignore
2188
- */
2189
- GoAElementLoadIndicatorComponent.prototype.ngOnInit = function () { };
2190
- return GoAElementLoadIndicatorComponent;
2191
- }());
2192
- GoAElementLoadIndicatorComponent.decorators = [
2193
- { type: i0.Component, args: [{
2194
- selector: 'goa-element-load-indicator',
2195
- template: "<div *ngIf=\"visible\">\n <svg\n fill=\"none\"\n [attr.viewBox]=\"viewBox\"\n [attr.width]=\"radius\"\n [attr.height]=\"radius\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n class=\"base-circle\"\n [attr.cx]=\"radius\"\n [attr.cy]=\"radius\"\n [attr.r]=\"innerRadius\"\n [style.stroke]=\"baseColour\"\n />\n <circle\n class=\"rotating-circle\"\n [attr.cx]=\"radius\"\n [style.stroke-dasharray]=\"dashArray\"\n [style.stroke-dashoffset]=\"dashOffset\"\n [attr.cy]=\"radius\"\n [attr.r]=\"innerRadius\"\n [style.stroke]=\"spinnerColour\"\n />\n </svg>\n</div>\n",
2196
- styles: [""]
2197
- },] }
2198
- ];
2199
- GoAElementLoadIndicatorComponent.ctorParameters = function () { return []; };
2200
- GoAElementLoadIndicatorComponent.propDecorators = {
2201
- visible: [{ type: i0.Input }],
2202
- size: [{ type: i0.Input }],
2203
- baseColour: [{ type: i0.Input }],
2204
- spinnerColour: [{ type: i0.Input }]
2205
- };
2206
-
2207
- var AngularComponentsModule = /** @class */ (function () {
2208
- function AngularComponentsModule() {
2209
- }
2210
- return AngularComponentsModule;
2211
- }());
2212
- AngularComponentsModule.decorators = [
2213
- { type: i0.NgModule, args: [{
2214
- imports: [common.CommonModule, overlay.OverlayModule],
2215
- exports: [
2216
- forms.FormsModule,
2217
- overlay.OverlayModule,
2218
- common.CommonModule,
2219
- GoAButtonComponent,
2220
- GoAMicrositeLogoComponent,
2221
- GoAHeaderComponent,
2222
- GoAButtonLinkComponent,
2223
- GoAOptionComponent,
2224
- GoADropdownComponent,
2225
- GoAOptionGroupComponent,
2226
- GoACheckboxComponent,
2227
- GoACalloutComponent,
2228
- GoACardGroupComponent,
2229
- GoANotificationComponent,
2230
- GoANotificationBannerComponent,
2231
- GoACardComponent,
2232
- GoACardHeaderComponent,
2233
- GoACardFooterComponent,
2234
- GoACardContentComponent,
2235
- GoACardThumbImageComponent,
2236
- GoARadioComponent,
2237
- GoARadioGroupComponent,
2238
- GoAHeroBannerComponent,
2239
- GoAHeroBannerContentComponent,
2240
- GoAHeroBannerLinkComponent,
2241
- GoAPageLoadIndicatorComponent,
2242
- GoASkeletonImageContentComponent,
2243
- GoASkeletonElementComponent,
2244
- GoAElementLoadIndicatorComponent,
2245
- ],
2246
- declarations: [
2247
- GoAButtonComponent,
2248
- GoAMicrositeLogoComponent,
2249
- GoAHeaderComponent,
2250
- GoAButtonLinkComponent,
2251
- GoAOptionComponent,
2252
- GoADropdownComponent,
2253
- GoAOptionGroupComponent,
2254
- GoACheckboxComponent,
2255
- GoACalloutComponent,
2256
- GoACardGroupComponent,
2257
- GoANotificationComponent,
2258
- GoANotificationBannerComponent,
2259
- GoACardComponent,
2260
- GoACardHeaderComponent,
2261
- GoACardFooterComponent,
2262
- GoACardContentComponent,
2263
- GoACardThumbImageComponent,
2264
- GoARadioComponent,
2265
- GoARadioGroupComponent,
2266
- GoAHeroBannerComponent,
2267
- GoAHeroBannerContentComponent,
2268
- GoAHeroBannerLinkComponent,
2269
- GoAPageLoadIndicatorComponent,
2270
- GoASkeletonImageContentComponent,
2271
- GoASkeletonElementComponent,
2272
- GoAElementLoadIndicatorComponent,
2273
- ],
2274
- providers: [GoARadioService],
2275
- schemas: [
2276
- i0.CUSTOM_ELEMENTS_SCHEMA
2277
- ]
2278
- },] }
2279
- ];
2280
-
2281
- var GoACheckboxChange = /** @class */ (function () {
2282
- function GoACheckboxChange() {
2283
- }
2284
- return GoACheckboxChange;
2285
- }());
2286
-
2287
- var GoABadgeComponent = /** @class */ (function () {
2288
- function GoABadgeComponent() {
2289
- this.type = 'light';
2290
- }
2291
- Object.defineProperty(GoABadgeComponent.prototype, "badgeClass", {
2292
- get: function () {
2293
- return "badge-" + this.type;
2294
- },
2295
- enumerable: false,
2296
- configurable: true
2297
- });
2298
- /* eslint-disable @angular-eslint/no-empty-lifecycle-method */
2299
- GoABadgeComponent.prototype.ngOnInit = function () { };
2300
- return GoABadgeComponent;
2301
- }());
2302
- GoABadgeComponent.decorators = [
2303
- { type: i0.Component, args: [{
2304
- selector: 'goa-badge',
2305
- template: "<div class=\"goa-badge\" [ngClass]=\"badgeClass\">\n <ng-content class=\"goa-badge-icon\" select=\"mat-icon,.goa-badge-icon\"></ng-content>\n <div class=\"goa-badge-content\">\n <ng-content></ng-content>\n </div>\n</div>\n",
2306
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2307
- styles: [""]
2308
- },] }
2309
- ];
2310
- GoABadgeComponent.ctorParameters = function () { return []; };
2311
- GoABadgeComponent.propDecorators = {
2312
- type: [{ type: i0.Input }]
2313
- };
2314
-
2315
- var GoAAppVersionHeaderComponent = /** @class */ (function () {
2316
- function GoAAppVersionHeaderComponent() {
2317
- this.isProdEnvironment = false;
2318
- this.environment = '';
2319
- this.version = '';
2320
- this.closed = new i0.EventEmitter();
2321
- }
2322
- GoAAppVersionHeaderComponent.prototype.ngOnInit = function () {
2323
- };
2324
- GoAAppVersionHeaderComponent.prototype.onCloseClick = function () {
2325
- this.closed.next(true);
2326
- };
2327
- return GoAAppVersionHeaderComponent;
2328
- }());
2329
- GoAAppVersionHeaderComponent.decorators = [
2330
- { type: i0.Component, args: [{
2331
- selector: 'goa-app-version-header',
2332
- template: "<div\n *ngIf=\"!isProdEnvironment && (closed | async) === null\"\n class=\"goa-app-version-header\"\n>\n <span class=\"content-wrapper\">\n <span class=\"environment-and-version\">{{ environment }} {{ version }}</span>\n <span class=\"close\" (click)=\"onCloseClick()\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"ionicon\"\n viewBox=\"0 0 512 512\"\n >\n <title>Close</title>\n <path\n fill=\"currentColor\"\n stroke=\"currentColor\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"32\"\n d=\"M368 368L144 144M368 144L144 368\"\n />\n </svg>\n </span>\n </span>\n</div>\n",
2333
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
2334
- styles: [""]
2335
- },] }
2336
- ];
2337
- GoAAppVersionHeaderComponent.ctorParameters = function () { return []; };
2338
- GoAAppVersionHeaderComponent.propDecorators = {
2339
- isProdEnvironment: [{ type: i0.Input }],
2340
- environment: [{ type: i0.Input }],
2341
- version: [{ type: i0.Input }],
2342
- closed: [{ type: i0.Output }]
2343
- };
2344
-
2345
- var GoANumberInputComponent = /** @class */ (function () {
2346
- function GoANumberInputComponent() {
2347
- this._isTouched = false;
2348
- /**
2349
- * Sets the step value that is used when incrementing / decrementing
2350
- *
2351
- * @memberof GoANumberInputComponent
2352
- */
2353
- this.step = 1;
2354
- /**
2355
- * An event that fires whenever the value is changed
2356
- *
2357
- * @type {EventEmitter<number | undefined | null>}
2358
- * @memberof GoANumberInputComponent
2359
- */
2360
- this.valueChanged = new i0.EventEmitter();
2361
- }
2362
- Object.defineProperty(GoANumberInputComponent.prototype, "input", {
2363
- get: function () {
2364
- var _a;
2365
- return (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.nativeElement;
2366
- },
2367
- enumerable: false,
2368
- configurable: true
2369
- });
2370
- Object.defineProperty(GoANumberInputComponent.prototype, "value", {
2371
- get: function () {
2372
- return this._value;
2373
- },
2374
- /**
2375
- * The value of the NumberInput
2376
- *
2377
- * @memberof GoANumberInputComponent
2378
- */
2379
- set: function (val) {
2380
- var _a;
2381
- var newVal = (val === undefined || val === null || Number.isNaN(val)) ? null : this.clampValue(val);
2382
- if (this._value !== newVal) {
2383
- this._value = newVal;
2384
- (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, newVal);
2385
- this.valueChanged.emit(newVal);
142
+ try {
143
+ this.value = JSON.parse(value);
2386
144
  }
2387
- if (this.input && this.input.valueAsNumber !== newVal) {
2388
- this.input.valueAsNumber = newVal;
145
+ catch (e) {
146
+ // we still need to trigger the events to prevent any previous valid value to remain set.
147
+ var v = value.match(/^[\w\s,]*$/) ? value.split(",") : undefined;
148
+ this._setValue(v);
2389
149
  }
2390
- },
2391
- enumerable: false,
2392
- configurable: true
2393
- });
2394
- Object.defineProperty(GoANumberInputComponent.prototype, "min", {
2395
- get: function () {
2396
- return this._min;
2397
- },
2398
- /**
2399
- * Sets the minimum value that the number input can take
2400
- *
2401
- * @memberof GoANumberInputComponent
2402
- */
2403
- set: function (min) {
2404
- this._min = min;
2405
- // force reevaluation / clamping
2406
- this.value = this._value;
2407
- },
2408
- enumerable: false,
2409
- configurable: true
2410
- });
2411
- Object.defineProperty(GoANumberInputComponent.prototype, "max", {
2412
- get: function () {
2413
- return this._max;
2414
- },
2415
- /**
2416
- * Sets the maximum value that the number input can take
2417
- *
2418
- * @memberof GoANumberInputComponent
2419
- */
2420
- set: function (max) {
2421
- this._max = max;
2422
- // force reevaluation / clamping
2423
- this.value = this._value;
2424
- },
2425
- enumerable: false,
2426
- configurable: true
2427
- });
2428
- GoANumberInputComponent.prototype.clampValue = function (val) {
2429
- if (Number.isFinite(this.max)) {
2430
- val = Math.min(this.max, val);
2431
- }
2432
- if (Number.isFinite(this.min)) {
2433
- val = Math.max(val, this.min);
2434
- }
2435
- return val;
2436
- };
2437
- GoANumberInputComponent.prototype.markTouched = function () {
2438
- var _a;
2439
- if (this._isTouched === false) {
2440
- this._isTouched = true;
2441
- (_a = this.onTouched) === null || _a === void 0 ? void 0 : _a.call(this);
2442
- }
2443
- };
2444
- GoANumberInputComponent.prototype.handleInput = function (event) {
2445
- var _a;
2446
- var inputString = (_a = event.data) !== null && _a !== void 0 ? _a : '';
2447
- // If someone is typing a negative number, let them
2448
- if (inputString.trim() !== '-') {
2449
- this.value = event.target.valueAsNumber;
2450
- }
2451
- };
2452
- /**
2453
- * Increment the number input
2454
- *
2455
- * @memberof GoANumberInputComponent
2456
- */
2457
- GoANumberInputComponent.prototype.increment = function () {
2458
- // use built-in browser increment logic
2459
- this.input.stepUp();
2460
- this.value = this.input.valueAsNumber;
2461
- };
2462
- /**
2463
- * Decrement the number input
2464
- *
2465
- * @memberof GoANumberInputComponent
2466
- */
2467
- GoANumberInputComponent.prototype.decrement = function () {
2468
- // use built-in browser decrement logic
2469
- this.input.stepDown();
2470
- this.value = this.input.valueAsNumber;
2471
- };
2472
- // CONTROL VALUE ACCESSOR INTERFACE
2473
- GoANumberInputComponent.prototype.writeValue = function (value) {
2474
- this.value = value;
2475
- };
2476
- GoANumberInputComponent.prototype.registerOnChange = function (handler) {
2477
- this.onChange = handler;
2478
- };
2479
- GoANumberInputComponent.prototype.registerOnTouched = function (handler) {
2480
- this.onTouched = handler;
2481
- };
2482
- GoANumberInputComponent.prototype.setDisabledState = function (isDisabled) {
2483
- this.disabled = isDisabled;
2484
- };
2485
- return GoANumberInputComponent;
2486
- }());
2487
- GoANumberInputComponent.decorators = [
2488
- { type: i0.Component, args: [{
2489
- selector: 'goa-number-input',
2490
- template: "<div (focusout)=\"markTouched()\" class=\"number-input-container\">\n <button\n [disabled]=\"disabled || (min !== undefined && value <= min)\"\n goa-button\n buttonType=\"primary\"\n buttonSize=\"small\"\n type=\"button\"\n (click)=\"decrement()\"\n >\n <svg width=\"1em\" height=\"100%\" viewBox=\"0 0 100 100\">\n <line x1=\"25%\" y1=\"50%\" x2=\"75%\" y2=\"50%\" stroke-width=\"15%\" />\n </svg>\n </button>\n\n <input\n #numberInput\n type=\"number\"\n [min]=\"min\"\n [max]=\"max\"\n [value]=\"value\"\n [step]=\"step\"\n [disabled]=\"disabled\"\n (input)=\"handleInput($event)\"\n />\n\n <button\n goa-button\n [disabled]=\"disabled || (max !== undefined && value >= max)\"\n buttonType=\"primary\"\n buttonSize=\"small\"\n type=\"button\"\n (click)=\"increment()\"\n >\n <svg width=\"1em\" height=\"100%\" viewBox=\"0 0 100 100\">\n <line x1=\"25%\" y1=\"50%\" x2=\"75%\" y2=\"50%\" stroke-width=\"15%\" />\n <line x1=\"50%\" y1=\"25%\" x2=\"50%\" y2=\"75%\" stroke-width=\"15%\" />\n </svg>\n </button>\n</div>\n",
2491
- providers: [
2492
- {
2493
- provide: forms.NG_VALUE_ACCESSOR,
2494
- useExisting: i0.forwardRef(function () { return GoANumberInputComponent; }),
2495
- multi: true
2496
- },
2497
- ],
2498
- styles: [""]
2499
- },] }
2500
- ];
2501
- GoANumberInputComponent.propDecorators = {
2502
- inputElement: [{ type: i0.ViewChild, args: ['numberInput',] }],
2503
- disabled: [{ type: i0.Input }],
2504
- step: [{ type: i0.Input }],
2505
- valueChanged: [{ type: i0.Output }],
2506
- value: [{ type: i0.Input }],
2507
- min: [{ type: i0.Input }],
2508
- max: [{ type: i0.Input }]
2509
- };
2510
-
2511
- var ExperimentalComponentsModule = /** @class */ (function () {
2512
- function ExperimentalComponentsModule() {
2513
- }
2514
- return ExperimentalComponentsModule;
2515
- }());
2516
- ExperimentalComponentsModule.decorators = [
2517
- { type: i0.NgModule, args: [{
2518
- imports: [
2519
- common.CommonModule,
2520
- AngularComponentsModule
2521
- ],
2522
- exports: [
2523
- GoABadgeComponent,
2524
- GoAAppVersionHeaderComponent,
2525
- GoANumberInputComponent,
2526
- ],
2527
- declarations: [
2528
- GoABadgeComponent,
2529
- GoAAppVersionHeaderComponent,
2530
- GoANumberInputComponent,
2531
- ],
2532
- providers: [],
2533
- schemas: [i0.CUSTOM_ELEMENTS_SCHEMA]
2534
- },] }
2535
- ];
2536
-
2537
- /**
2538
- * Generated bundle index. Do not edit.
2539
- */
2540
-
2541
- exports.AngularComponentsModule = AngularComponentsModule;
2542
- exports.ExperimentalComponentsModule = ExperimentalComponentsModule;
2543
- exports.GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR = GOA_CHECKBOX_CONTROL_VALUE_ACCESSOR;
2544
- exports.GOA_RADIO_CONTROL_VALUE_ACCESSOR = GOA_RADIO_CONTROL_VALUE_ACCESSOR;
2545
- exports.GOA_RADIO_GROUP = GOA_RADIO_GROUP;
2546
- exports.GOA_RADIO_GROUP_CONTROL_VALUE_ACCESSOR = GOA_RADIO_GROUP_CONTROL_VALUE_ACCESSOR;
2547
- exports.GoAAppVersionHeaderComponent = GoAAppVersionHeaderComponent;
2548
- exports.GoABadgeComponent = GoABadgeComponent;
2549
- exports.GoAButtonComponent = GoAButtonComponent;
2550
- exports.GoAButtonLinkComponent = GoAButtonLinkComponent;
2551
- exports.GoACalloutComponent = GoACalloutComponent;
2552
- exports.GoACardComponent = GoACardComponent;
2553
- exports.GoACardContentComponent = GoACardContentComponent;
2554
- exports.GoACardFooterComponent = GoACardFooterComponent;
2555
- exports.GoACardGroupComponent = GoACardGroupComponent;
2556
- exports.GoACardHeaderComponent = GoACardHeaderComponent;
2557
- exports.GoACardThumbImageComponent = GoACardThumbImageComponent;
2558
- exports.GoACheckboxChange = GoACheckboxChange;
2559
- exports.GoACheckboxComponent = GoACheckboxComponent;
2560
- exports.GoADropdownComponent = GoADropdownComponent;
2561
- exports.GoAElementLoadIndicatorComponent = GoAElementLoadIndicatorComponent;
2562
- exports.GoAHeaderComponent = GoAHeaderComponent;
2563
- exports.GoAHeroBannerComponent = GoAHeroBannerComponent;
2564
- exports.GoAHeroBannerContentComponent = GoAHeroBannerContentComponent;
2565
- exports.GoAHeroBannerLinkComponent = GoAHeroBannerLinkComponent;
2566
- exports.GoAMicrositeLogoComponent = GoAMicrositeLogoComponent;
2567
- exports.GoANotificationBannerComponent = GoANotificationBannerComponent;
2568
- exports.GoANotificationComponent = GoANotificationComponent;
2569
- exports.GoANumberInputComponent = GoANumberInputComponent;
2570
- exports.GoAOptionComponent = GoAOptionComponent;
2571
- exports.GoAOptionGroupComponent = GoAOptionGroupComponent;
2572
- exports.GoAPageLoadIndicatorComponent = GoAPageLoadIndicatorComponent;
2573
- exports.GoARadioChange = GoARadioChange;
2574
- exports.GoARadioComponent = GoARadioComponent;
2575
- exports.GoARadioGroupComponent = GoARadioGroupComponent;
2576
- exports.GoARadioService = GoARadioService;
2577
- exports.GoASkeletonElementComponent = GoASkeletonElementComponent;
2578
- exports.GoASkeletonImageContentComponent = GoASkeletonImageContentComponent;
2579
-
2580
- Object.defineProperty(exports, '__esModule', { value: true });
150
+ };
151
+ ValuesDirective.prototype._setValue = function (value) {
152
+ this._value = value;
153
+ this.onChange(value);
154
+ this.onTouched();
155
+ };
156
+ return ValuesDirective;
157
+ }());
158
+ ValuesDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ValuesDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
159
+ ValuesDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.13", type: ValuesDirective, selector: "[goaValues]", host: { listeners: { "_change": "listenForValueChange($event.detail.value)" } }, providers: [
160
+ {
161
+ provide: forms.NG_VALUE_ACCESSOR,
162
+ useExisting: i0.forwardRef(function () { return ValuesDirective; }),
163
+ multi: true,
164
+ },
165
+ ], ngImport: i0__namespace });
166
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.13", ngImport: i0__namespace, type: ValuesDirective, decorators: [{
167
+ type: i0.Directive,
168
+ args: [{
169
+ selector: "[goaValues]",
170
+ providers: [
171
+ {
172
+ provide: forms.NG_VALUE_ACCESSOR,
173
+ useExisting: i0.forwardRef(function () { return ValuesDirective; }),
174
+ multi: true,
175
+ },
176
+ ],
177
+ }]
178
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { listenForValueChange: [{
179
+ type: i0.HostListener,
180
+ args: ["_change", ["$event.detail.value"]]
181
+ }] } });
182
+
183
+ /**
184
+ * Generated bundle index. Do not edit.
185
+ */
186
+
187
+ exports.AngularComponentsModule = AngularComponentsModule;
188
+ exports.ValueDirective = ValueDirective;
189
+ exports.ValuesDirective = ValuesDirective;
190
+
191
+ Object.defineProperty(exports, '__esModule', { value: true });
2581
192
 
2582
193
  }));
2583
194
  //# sourceMappingURL=abgov-angular-components.umd.js.map