@acpaas-ui/ngx-forms 5.4.0 → 6.0.0-beta.1

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 (166) hide show
  1. package/README.md +9 -11
  2. package/esm2020/acpaas-ui-ngx-forms.mjs +5 -0
  3. package/esm2020/lib/auto-complete/auto-complete.module.mjs +24 -0
  4. package/esm2020/lib/auto-complete/components/auto-complete/auto-complete.component.mjs +347 -0
  5. package/esm2020/lib/auto-complete/public-api.mjs +3 -0
  6. package/esm2020/lib/datepicker/components/datepicker/datepicker.component.mjs +273 -0
  7. package/esm2020/lib/datepicker/datepicker.conf.mjs +8 -0
  8. package/esm2020/lib/datepicker/datepicker.module.mjs +55 -0
  9. package/esm2020/lib/datepicker/public-api.mjs +4 -0
  10. package/esm2020/lib/datepicker/types/datepicker.types.mjs +2 -0
  11. package/esm2020/lib/range-slider/components/range-slider/range-slider.component.mjs +349 -0
  12. package/esm2020/lib/range-slider/public-api.mjs +3 -0
  13. package/esm2020/lib/range-slider/range-slider.module.mjs +20 -0
  14. package/esm2020/lib/range-slider/types/range-slider.types.mjs +2 -0
  15. package/esm2020/lib/search-filter/components/search-filter/search-filter.component.mjs +259 -0
  16. package/esm2020/lib/search-filter/public-api.mjs +3 -0
  17. package/esm2020/lib/search-filter/search-filter.module.mjs +22 -0
  18. package/esm2020/lib/search-filter/types/search-filter.types.mjs +2 -0
  19. package/esm2020/lib/shared/services/search.service.mjs +32 -0
  20. package/esm2020/lib/shared/types/search.types.mjs +2 -0
  21. package/esm2020/lib/timepicker/classes/timepicker.validators.mjs +49 -0
  22. package/esm2020/lib/timepicker/components/timepicker/timepicker.component.mjs +229 -0
  23. package/esm2020/lib/timepicker/public-api.mjs +5 -0
  24. package/esm2020/lib/timepicker/timepicker.module.mjs +22 -0
  25. package/esm2020/lib/timepicker/types/timepicker.types.mjs +7 -0
  26. package/esm2020/lib/upload/classes/uploader.class.mjs +112 -0
  27. package/esm2020/lib/upload/components/upload/upload.component.mjs +97 -0
  28. package/esm2020/lib/upload/components/upload-input/upload-input.component.mjs +56 -0
  29. package/esm2020/lib/upload/components/upload-queue/upload-queue.component.mjs +78 -0
  30. package/esm2020/lib/upload/components/upload-zone/upload-zone.component.mjs +252 -0
  31. package/esm2020/lib/upload/components/validation-list/validation-list.component.mjs +64 -0
  32. package/esm2020/lib/upload/public-api.mjs +10 -0
  33. package/esm2020/lib/upload/services/validation-messages.service.mjs +29 -0
  34. package/esm2020/lib/upload/types/upload.types.mjs +2 -0
  35. package/esm2020/lib/upload/upload.conf.mjs +12 -0
  36. package/esm2020/lib/upload/upload.module.mjs +45 -0
  37. package/esm2020/public-api.mjs +7 -0
  38. package/fesm2015/acpaas-ui-ngx-forms.mjs +2518 -0
  39. package/fesm2015/acpaas-ui-ngx-forms.mjs.map +1 -0
  40. package/fesm2020/acpaas-ui-ngx-forms.mjs +2339 -0
  41. package/fesm2020/acpaas-ui-ngx-forms.mjs.map +1 -0
  42. package/{acpaas-ui-ngx-forms.d.ts → index.d.ts} +1 -1
  43. package/lib/auto-complete/auto-complete.module.d.ts +9 -0
  44. package/lib/auto-complete/components/auto-complete/auto-complete.component.d.ts +5 -1
  45. package/lib/datepicker/components/datepicker/datepicker.component.d.ts +9 -8
  46. package/lib/datepicker/datepicker.conf.d.ts +0 -1
  47. package/lib/datepicker/datepicker.module.d.ts +11 -1
  48. package/lib/datepicker/public-api.d.ts +1 -1
  49. package/lib/range-slider/components/range-slider/range-slider.component.d.ts +8 -2
  50. package/lib/range-slider/range-slider.module.d.ts +7 -0
  51. package/lib/search-filter/components/search-filter/search-filter.component.d.ts +10 -4
  52. package/lib/search-filter/search-filter.module.d.ts +9 -0
  53. package/lib/shared/services/search.service.d.ts +3 -0
  54. package/lib/timepicker/components/timepicker/timepicker.component.d.ts +9 -4
  55. package/lib/timepicker/timepicker.module.d.ts +8 -0
  56. package/lib/upload/components/upload/upload.component.d.ts +5 -0
  57. package/lib/upload/components/upload-input/upload-input.component.d.ts +3 -0
  58. package/lib/upload/components/upload-queue/upload-queue.component.d.ts +3 -0
  59. package/lib/upload/components/upload-zone/upload-zone.component.d.ts +7 -0
  60. package/lib/upload/components/validation-list/validation-list.component.d.ts +3 -0
  61. package/lib/upload/services/validation-messages.service.d.ts +3 -0
  62. package/lib/upload/upload.module.d.ts +14 -1
  63. package/package.json +37 -26
  64. package/public-api.d.ts +0 -2
  65. package/acpaas-ui-ngx-forms.metadata.json +0 -1
  66. package/bundles/acpaas-ui-ngx-forms.umd.js +0 -3862
  67. package/bundles/acpaas-ui-ngx-forms.umd.js.map +0 -1
  68. package/bundles/acpaas-ui-ngx-forms.umd.min.js +0 -2
  69. package/bundles/acpaas-ui-ngx-forms.umd.min.js.map +0 -1
  70. package/esm2015/acpaas-ui-ngx-forms.js +0 -11
  71. package/esm2015/lib/auto-complete/auto-complete.module.js +0 -36
  72. package/esm2015/lib/auto-complete/components/auto-complete/auto-complete.component.js +0 -416
  73. package/esm2015/lib/auto-complete/public-api.js +0 -8
  74. package/esm2015/lib/datepicker/components/datepicker/datepicker.component.js +0 -343
  75. package/esm2015/lib/datepicker/datepicker.conf.js +0 -18
  76. package/esm2015/lib/datepicker/datepicker.module.js +0 -59
  77. package/esm2015/lib/datepicker/public-api.js +0 -9
  78. package/esm2015/lib/datepicker/types/datepicker.types.js +0 -20
  79. package/esm2015/lib/mask/directives/mask.directive.js +0 -51
  80. package/esm2015/lib/mask/mask.module.js +0 -25
  81. package/esm2015/lib/mask/public-api.js +0 -8
  82. package/esm2015/lib/range-slider/components/range-slider/range-slider.component.js +0 -424
  83. package/esm2015/lib/range-slider/public-api.js +0 -8
  84. package/esm2015/lib/range-slider/range-slider.module.js +0 -26
  85. package/esm2015/lib/range-slider/types/range-slider.types.js +0 -16
  86. package/esm2015/lib/search-filter/components/search-filter/search-filter.component.js +0 -219
  87. package/esm2015/lib/search-filter/public-api.js +0 -8
  88. package/esm2015/lib/search-filter/search-filter.module.js +0 -30
  89. package/esm2015/lib/search-filter/types/search-filter.types.js +0 -16
  90. package/esm2015/lib/shared/services/search.service.js +0 -58
  91. package/esm2015/lib/shared/types/search.types.js +0 -20
  92. package/esm2015/lib/timepicker/classes/timepicker.validators.js +0 -84
  93. package/esm2015/lib/timepicker/components/timepicker/timepicker.component.js +0 -227
  94. package/esm2015/lib/timepicker/public-api.js +0 -10
  95. package/esm2015/lib/timepicker/timepicker.module.js +0 -29
  96. package/esm2015/lib/timepicker/types/timepicker.types.js +0 -13
  97. package/esm2015/lib/upload/classes/uploader.class.js +0 -189
  98. package/esm2015/lib/upload/components/upload/upload.component.js +0 -100
  99. package/esm2015/lib/upload/components/upload-input/upload-input.component.js +0 -67
  100. package/esm2015/lib/upload/components/upload-queue/upload-queue.component.js +0 -68
  101. package/esm2015/lib/upload/components/upload-zone/upload-zone.component.js +0 -219
  102. package/esm2015/lib/upload/components/validation-list/validation-list.component.js +0 -62
  103. package/esm2015/lib/upload/public-api.js +0 -15
  104. package/esm2015/lib/upload/services/validation-messages.service.js +0 -48
  105. package/esm2015/lib/upload/types/upload.types.js +0 -48
  106. package/esm2015/lib/upload/upload.conf.js +0 -21
  107. package/esm2015/lib/upload/upload.module.js +0 -62
  108. package/esm2015/lib/wysiwyg/components/wysiwyg/wysiwyg.component.js +0 -158
  109. package/esm2015/lib/wysiwyg/public-api.js +0 -9
  110. package/esm2015/lib/wysiwyg/wysiwyg.conf.js +0 -24
  111. package/esm2015/lib/wysiwyg/wysiwyg.module.js +0 -29
  112. package/esm2015/public-api.js +0 -14
  113. package/esm5/acpaas-ui-ngx-forms.js +0 -11
  114. package/esm5/lib/auto-complete/auto-complete.module.js +0 -40
  115. package/esm5/lib/auto-complete/components/auto-complete/auto-complete.component.js +0 -506
  116. package/esm5/lib/auto-complete/public-api.js +0 -8
  117. package/esm5/lib/datepicker/components/datepicker/datepicker.component.js +0 -392
  118. package/esm5/lib/datepicker/datepicker.conf.js +0 -18
  119. package/esm5/lib/datepicker/datepicker.module.js +0 -69
  120. package/esm5/lib/datepicker/public-api.js +0 -9
  121. package/esm5/lib/datepicker/types/datepicker.types.js +0 -20
  122. package/esm5/lib/mask/directives/mask.directive.js +0 -58
  123. package/esm5/lib/mask/mask.module.js +0 -29
  124. package/esm5/lib/mask/public-api.js +0 -8
  125. package/esm5/lib/range-slider/components/range-slider/range-slider.component.js +0 -514
  126. package/esm5/lib/range-slider/public-api.js +0 -8
  127. package/esm5/lib/range-slider/range-slider.module.js +0 -30
  128. package/esm5/lib/range-slider/types/range-slider.types.js +0 -16
  129. package/esm5/lib/search-filter/components/search-filter/search-filter.component.js +0 -256
  130. package/esm5/lib/search-filter/public-api.js +0 -8
  131. package/esm5/lib/search-filter/search-filter.module.js +0 -34
  132. package/esm5/lib/search-filter/types/search-filter.types.js +0 -16
  133. package/esm5/lib/shared/services/search.service.js +0 -68
  134. package/esm5/lib/shared/types/search.types.js +0 -20
  135. package/esm5/lib/timepicker/classes/timepicker.validators.js +0 -102
  136. package/esm5/lib/timepicker/components/timepicker/timepicker.component.js +0 -259
  137. package/esm5/lib/timepicker/public-api.js +0 -10
  138. package/esm5/lib/timepicker/timepicker.module.js +0 -33
  139. package/esm5/lib/timepicker/types/timepicker.types.js +0 -13
  140. package/esm5/lib/upload/classes/uploader.class.js +0 -249
  141. package/esm5/lib/upload/components/upload/upload.component.js +0 -117
  142. package/esm5/lib/upload/components/upload-input/upload-input.component.js +0 -84
  143. package/esm5/lib/upload/components/upload-queue/upload-queue.component.js +0 -78
  144. package/esm5/lib/upload/components/upload-zone/upload-zone.component.js +0 -264
  145. package/esm5/lib/upload/components/validation-list/validation-list.component.js +0 -81
  146. package/esm5/lib/upload/public-api.js +0 -15
  147. package/esm5/lib/upload/services/validation-messages.service.js +0 -47
  148. package/esm5/lib/upload/types/upload.types.js +0 -48
  149. package/esm5/lib/upload/upload.conf.js +0 -21
  150. package/esm5/lib/upload/upload.module.js +0 -71
  151. package/esm5/lib/wysiwyg/components/wysiwyg/wysiwyg.component.js +0 -199
  152. package/esm5/lib/wysiwyg/public-api.js +0 -9
  153. package/esm5/lib/wysiwyg/wysiwyg.conf.js +0 -24
  154. package/esm5/lib/wysiwyg/wysiwyg.module.js +0 -33
  155. package/esm5/public-api.js +0 -14
  156. package/fesm2015/acpaas-ui-ngx-forms.js +0 -3079
  157. package/fesm2015/acpaas-ui-ngx-forms.js.map +0 -1
  158. package/fesm5/acpaas-ui-ngx-forms.js +0 -3635
  159. package/fesm5/acpaas-ui-ngx-forms.js.map +0 -1
  160. package/lib/mask/directives/mask.directive.d.ts +0 -8
  161. package/lib/mask/mask.module.d.ts +0 -2
  162. package/lib/mask/public-api.d.ts +0 -2
  163. package/lib/wysiwyg/components/wysiwyg/wysiwyg.component.d.ts +0 -43
  164. package/lib/wysiwyg/public-api.d.ts +0 -3
  165. package/lib/wysiwyg/wysiwyg.conf.d.ts +0 -18
  166. package/lib/wysiwyg/wysiwyg.module.d.ts +0 -2
@@ -1,3079 +0,0 @@
1
- import { Directive, ElementRef, Input, NgModule, Injectable, EventEmitter, Component, forwardRef, Output, ViewChild, ContentChild, TemplateRef, InjectionToken, ChangeDetectionStrategy, Inject, ChangeDetectorRef, HostBinding, HostListener, Renderer2 } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { NG_VALUE_ACCESSOR, FormsModule, NG_VALIDATORS, FormBuilder, ReactiveFormsModule, FormControl } from '@angular/forms';
4
- import { FlyoutDirective, FlyoutZoneDirective, FlyoutModule, FlyoutSize } from '@acpaas-ui/ngx-flyout';
5
- import { SelectableListModule } from '@acpaas-ui/ngx-selectable-list';
6
- import Inputmask from 'inputmask';
7
- import { get, isEqual, debounce } from 'lodash-es';
8
- import { Subject, Observable } from 'rxjs';
9
- import { takeUntil } from 'rxjs/operators';
10
- import { DateHelper } from '@acpaas-ui/js-date-utils';
11
- import { CALENDAR_DEFAULT_MONTH_LABELS, CALENDAR_DEFAULT_WEEKDAY_LABELS, CALENDAR_MONTH_LABELS, CALENDAR_WEEKDAY_LABELS, CalendarService, CalendarModule } from '@acpaas-ui/ngx-calendar';
12
- import { IntervalBuilder } from '@acpaas-ui/ngx-utils';
13
- import { IconModule } from '@acpaas-ui/ngx-icon';
14
- import { ProgressBarModule } from '@acpaas-ui/ngx-progress-bar';
15
- import { CKEditorModule } from 'ng2-ckeditor';
16
-
17
- /**
18
- * @fileoverview added by tsickle
19
- * Generated from: lib/mask/directives/mask.directive.ts
20
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
21
- */
22
- class MaskDirective {
23
- /**
24
- * @param {?} ref
25
- */
26
- constructor(ref) {
27
- this.ref = ref;
28
- }
29
- /**
30
- * @return {?}
31
- */
32
- ngOnChanges() {
33
- this.setMask(this.auiMask);
34
- }
35
- /**
36
- * @private
37
- * @param {?} mask
38
- * @return {?}
39
- */
40
- setMask(mask) {
41
- Inputmask(mask).mask(this.ref.nativeElement);
42
- }
43
- }
44
- MaskDirective.decorators = [
45
- { type: Directive, args: [{
46
- selector: '[auiMask]',
47
- },] }
48
- ];
49
- /** @nocollapse */
50
- MaskDirective.ctorParameters = () => [
51
- { type: ElementRef }
52
- ];
53
- MaskDirective.propDecorators = {
54
- auiMask: [{ type: Input }]
55
- };
56
- if (false) {
57
- /** @type {?} */
58
- MaskDirective.prototype.auiMask;
59
- /**
60
- * @type {?}
61
- * @private
62
- */
63
- MaskDirective.prototype.ref;
64
- }
65
-
66
- /**
67
- * @fileoverview added by tsickle
68
- * Generated from: lib/mask/mask.module.ts
69
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
70
- */
71
- class MaskModule {
72
- }
73
- MaskModule.decorators = [
74
- { type: NgModule, args: [{
75
- imports: [
76
- CommonModule,
77
- ],
78
- declarations: [
79
- MaskDirective,
80
- ],
81
- exports: [
82
- MaskDirective,
83
- ],
84
- providers: [],
85
- },] }
86
- ];
87
-
88
- /**
89
- * @fileoverview added by tsickle
90
- * Generated from: lib/shared/services/search.service.ts
91
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
92
- */
93
- class SearchService {
94
- constructor() {
95
- this.matchItemWithSearchString = (/**
96
- * @param {?} item
97
- * @param {?} searchString
98
- * @return {?}
99
- */
100
- (item, searchString) => {
101
- return String(item).toLowerCase().indexOf(searchString.toLowerCase()) > -1;
102
- });
103
- }
104
- /**
105
- * @param {?} data
106
- * @param {?=} options
107
- * @return {?}
108
- */
109
- search(data, options = {}) {
110
- /** @type {?} */
111
- const query = options.hasOwnProperty('query') ? options.query : '';
112
- /** @type {?} */
113
- const minLength = options.hasOwnProperty('minLength') ? options.minLength : 0;
114
- /** @type {?} */
115
- const key = options.hasOwnProperty('key') ? options.key : '';
116
- if ((!query && options.showAllByDefault) || query.length < minLength) {
117
- return [...data];
118
- }
119
- return [...data].filter((/**
120
- * @param {?} item
121
- * @return {?}
122
- */
123
- item => {
124
- if (key && !item.hasOwnProperty(key)) {
125
- return console.error(`"${key}" does not exist in item ${JSON.stringify(item, null, 2)}`);
126
- }
127
- if (key) {
128
- return this.matchItemWithSearchString(item[key], query);
129
- }
130
- return this.matchItemWithSearchString(item, query);
131
- }));
132
- }
133
- }
134
- SearchService.decorators = [
135
- { type: Injectable }
136
- ];
137
- if (false) {
138
- /**
139
- * @type {?}
140
- * @private
141
- */
142
- SearchService.prototype.matchItemWithSearchString;
143
- }
144
-
145
- /**
146
- * @fileoverview added by tsickle
147
- * Generated from: lib/auto-complete/components/auto-complete/auto-complete.component.ts
148
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
149
- */
150
- class AutoCompleteComponent {
151
- /**
152
- * @param {?} ref
153
- * @param {?} searchService
154
- */
155
- constructor(ref, searchService) {
156
- this.ref = ref;
157
- this.searchService = searchService;
158
- this.results = []; // The values for the selectable list
159
- // The values for the selectable list
160
- this.data = []; // The values to search in when remote search is disabled
161
- // The values to search in when remote search is disabled
162
- this.remote = false; // Disable or enamble remote search
163
- // Disable or enamble remote search
164
- this.minCharacters = 0;
165
- this.mask = null;
166
- this.clearInvalid = false;
167
- this.showAllByDefault = false;
168
- this.autoComplete = 'off';
169
- // Eventemitter for searchvalue (parent object should update the results with this param)
170
- this.search = new EventEmitter();
171
- this.select = new EventEmitter();
172
- this.query = '';
173
- this.index = -1; // index for active element in selectable list, by default -1 (so it starts in the input field)
174
- // index for active element in selectable list, by default -1 (so it starts in the input field)
175
- this.selectedItem = null; // keep a backup of the selectedItem
176
- // keep a backup of the selectedItem
177
- this.searching = false; // track remote search state
178
- // track remote search state
179
- this.focused = false;
180
- this.isDisabled = false;
181
- this.remoteValue = false;
182
- this.updateModel = (/**
183
- * @param {?} _
184
- * @return {?}
185
- */
186
- (_) => {
187
- });
188
- }
189
- // CONTROL_VALUE_ACCESSOR interface
190
- /**
191
- * @param {?=} value
192
- * @return {?}
193
- */
194
- writeValue(value = '') {
195
- if (this.value) {
196
- /** @type {?} */
197
- const selected = this.data.find((/**
198
- * @param {?} item
199
- * @return {?}
200
- */
201
- (item) => item[this.value] === value));
202
- if (selected) {
203
- return this.query = selected[this.label];
204
- }
205
- if (this.remote && !!value) {
206
- this.remoteValue = true;
207
- }
208
- }
209
- this.query = value;
210
- }
211
- // CONTROL_VALUE_ACCESSOR interface
212
- /**
213
- * @param {?} fn
214
- * @return {?}
215
- */
216
- registerOnChange(fn) {
217
- this.updateModel = fn;
218
- }
219
- // CONTROL_VALUE_ACCESSOR interface
220
- /**
221
- * @return {?}
222
- */
223
- registerOnTouched() {
224
- }
225
- /**
226
- * @param {?} isDisabled
227
- * @return {?}
228
- */
229
- setDisabledState(isDisabled) {
230
- this.isDisabled = isDisabled;
231
- }
232
- /**
233
- * @return {?}
234
- */
235
- ngOnInit() {
236
- if ((Array.isArray(this.data) && this.data.length > 0) && !this.query && this.showAllByDefault) {
237
- this.results = [...this.data];
238
- }
239
- }
240
- // OnChanges interface
241
- /**
242
- * @param {?} changes
243
- * @return {?}
244
- */
245
- ngOnChanges(changes) {
246
- if (!changes) {
247
- return;
248
- }
249
- /** @type {?} */
250
- const newData = get(changes, 'data.currentValue', []);
251
- if (!isEqual(newData, get(changes, 'data.previousValue', []))) {
252
- if (this.remote) {
253
- this.remoteSearch();
254
- }
255
- else {
256
- this.localSearch();
257
- }
258
- }
259
- if (changes.results && changes.results.currentValue) {
260
- this.searching = false;
261
- }
262
- }
263
- /**
264
- * @param {?} item
265
- * @return {?}
266
- */
267
- propagateChange(item) {
268
- this.query = item !== null ? (this.label ? item[this.label] : item) : '';
269
- this.select.emit(item);
270
- if (!item) {
271
- return;
272
- }
273
- /** @type {?} */
274
- const key = this.value ? this.value : this.label ? this.label : null;
275
- this.updateModel(key ? item[key] || '' : item);
276
- this.selectedItem = item;
277
- }
278
- /**
279
- * triggers on input value change
280
- * @return {?}
281
- */
282
- doSearch() {
283
- this.index = -1; // reset index
284
- this.searching = true;
285
- if (this.remote) {
286
- this.search.emit(this.query); // ask for new remote data
287
- }
288
- else {
289
- this.localSearch();
290
- }
291
- this.openFlyout(); // open the flyout when there is a change
292
- }
293
- /**
294
- * triggers on selectable-list:select -> onClick event in selectable-list
295
- * @param {?} item
296
- * @return {?}
297
- */
298
- onSelect(item) {
299
- this.propagateChange(item);
300
- this.closeFlyout(); // Close the flyout manually
301
- }
302
- /**
303
- * @return {?}
304
- */
305
- onFlyoutClosed() {
306
- // there is only 1 result, select it
307
- if (this.index >= 0 && this.results.length === 1) {
308
- return this.onSelect(this.results[0]);
309
- }
310
- // there is no query nor selected item, clear the selected item
311
- if (!this.query && this.index < 0) {
312
- return this.onSelect(null);
313
- }
314
- // reset the query for an invalid query if clearInvalid is true
315
- if (this.clearInvalid && this.query && !this.results.length && this.index < 0) {
316
- this.query = this.selectedItem ? this.label ? this.selectedItem[this.label] : this.selectedItem : '';
317
- }
318
- }
319
- /**
320
- * @return {?}
321
- */
322
- onKeyArrowDown() {
323
- if (this.index < this.results.length - 1) {
324
- this.scrollList(1);
325
- }
326
- this.openFlyout();
327
- }
328
- /**
329
- * @return {?}
330
- */
331
- onKeyArrowUp() {
332
- if (this.index >= 0) {
333
- this.scrollList(-1);
334
- }
335
- }
336
- /**
337
- * @param {?} event
338
- * @return {?}
339
- */
340
- onKeyEnter(event) {
341
- event.preventDefault(); // Do not submit form when selecting an item.
342
- // Do not submit form when selecting an item.
343
- /** @type {?} */
344
- const query = this.index >= 0 ? this.results[this.index] : this.query;
345
- this.propagateChange(query);
346
- this.closeFlyout();
347
- }
348
- /**
349
- * @return {?}
350
- */
351
- onKeyEscape() {
352
- this.closeFlyout();
353
- }
354
- /**
355
- * @return {?}
356
- */
357
- onFocus() {
358
- this.focused = true;
359
- this.openFlyout();
360
- }
361
- /**
362
- * @return {?}
363
- */
364
- openFlyout() {
365
- if (this.flyout) {
366
- this.flyout.open();
367
- }
368
- }
369
- /**
370
- * @return {?}
371
- */
372
- closeFlyout() {
373
- if (this.flyout) {
374
- this.flyout.close();
375
- }
376
- this.focused = false;
377
- }
378
- /**
379
- * @return {?}
380
- */
381
- localSearch() {
382
- this.results = this.searchService.search(this.data, {
383
- minLength: this.minCharacters,
384
- key: this.label,
385
- query: this.query,
386
- showAllByDefault: this.showAllByDefault,
387
- });
388
- if (this.results.length === 1 && this.query === this.results[0][this.label]) {
389
- this.index = 0;
390
- }
391
- this.searching = false;
392
- }
393
- /**
394
- * @return {?}
395
- */
396
- remoteSearch() {
397
- if (!this.remoteValue || !this.data) {
398
- return;
399
- }
400
- /** @type {?} */
401
- const selected = this.data.find((/**
402
- * @param {?} item
403
- * @return {?}
404
- */
405
- (item) => {
406
- if (this.value) {
407
- return item[this.value] === this.query;
408
- }
409
- return item === this.query;
410
- }));
411
- if (selected) {
412
- this.query = this.label ? selected[this.label] : selected;
413
- }
414
- else {
415
- this.query = '';
416
- }
417
- this.remoteValue = false;
418
- }
419
- /**
420
- * @param {?} factor
421
- * @return {?}
422
- */
423
- scrollList(factor) {
424
- this.index += factor;
425
- if (!this.flyoutZone) {
426
- return;
427
- }
428
- /** @type {?} */
429
- const liItems = this.flyoutZone.element.getElementsByTagName('li');
430
- /** @type {?} */
431
- const liHeight = (liItems[1] ? liItems[1].offsetHeight : liItems[0].offsetHeight);
432
- /** @type {?} */
433
- const zoneHeight = this.flyoutZone.element.offsetHeight;
434
- /** @type {?} */
435
- const offset = (zoneHeight / liHeight) / 2;
436
- this.flyoutZone.element.scrollTop = (this.index * liHeight) - (offset * liHeight);
437
- }
438
- }
439
- AutoCompleteComponent.decorators = [
440
- { type: Component, args: [{
441
- selector: 'aui-auto-complete',
442
- template: "<div (closed)=\"onFlyoutClosed()\" [toggleClick]=\"false\" aria-haspopup=\"listbox\"\n auiFlyout class=\"m-flyout--scrollable m-flyout--full o-auto-complete\">\n <input (focus)=\"onFocus()\"\n (keyArrowDown)=\"onKeyArrowDown()\"\n (keyArrowUp)=\"onKeyArrowUp()\"\n (keyEnter)=\"onKeyEnter($event)\"\n (keyEscape)=\"onKeyEscape()\"\n [(ngModel)]=\"query\"\n (ngModelChange)=\"doSearch()\"\n *ngIf=\"!mask\"\n [disabled]=\"isDisabled ? true : null\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n aria-autocomplete=\"list\"\n auiFlyoutAction\n auiSelectableActions\n [autocomplete]=\"autoComplete\"\n type=\"text\"\n />\n <input (focus)=\"onFocus()\"\n (keyArrowDown)=\"onKeyArrowDown()\"\n (keyArrowUp)=\"onKeyArrowUp()\"\n (keyEnter)=\"onKeyEnter($event)\"\n (keyEscape)=\"onKeyEscape()\"\n [(ngModel)]=\"query\"\n (ngModelChange)=\"doSearch()\"\n *ngIf=\"mask\"\n [auiMask]=\"mask\"\n [disabled]=\"isDisabled ? true : null\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n aria-autocomplete=\"list\"\n auiFlyoutAction\n auiSelectableActions\n [autocomplete]=\"autoComplete\"\n type=\"text\"\n />\n\n <div *ngIf=\"!isDisabled\" auiFlyoutZone>\n\t\t<span *ngIf=\"focused && loadingText && searching\" class=\"o-auto-complete__info u-text-light u-margin-xs\">\n\t\t\t<span class=\"a-spinner a-spinner--inline a-spinner--sm u-margin-right-xs\"></span>\n {{ loadingText }}\n\t\t</span>\n <span *ngIf=\"focused && searchIncentiveText && !searching && !query && !results.length\"\n class=\"o-auto-complete__info u-text-light u-margin-xs\">{{ searchIncentiveText }}</span>\n <span *ngIf=\"focused && noResultsText && !searching && query && !results.length\"\n class=\"o-auto-complete__info u-text-light u-margin-xs\">{{ noResultsText }}</span>\n\n <aui-selectable-list (selected)=\"onSelect($event)\" *ngIf=\"results.length > 0 && !(focused && loadingText && searching)\" [index]=\"index\" [itemTemplate]=\"template\"\n [items]=\"results\" [label]=\"label\"\n [search]=\"query\"></aui-selectable-list>\n </div>\n</div>\n",
443
- providers: [
444
- {
445
- provide: NG_VALUE_ACCESSOR,
446
- useExisting: forwardRef((/**
447
- * @return {?}
448
- */
449
- () => AutoCompleteComponent)),
450
- // tslint:disable-line
451
- multi: true,
452
- },
453
- ],
454
- styles: [".o-auto-complete,.o-auto-complete__info{display:block}"]
455
- }] }
456
- ];
457
- /** @nocollapse */
458
- AutoCompleteComponent.ctorParameters = () => [
459
- { type: ElementRef },
460
- { type: SearchService }
461
- ];
462
- AutoCompleteComponent.propDecorators = {
463
- id: [{ type: Input }],
464
- placeholder: [{ type: Input }],
465
- results: [{ type: Input }],
466
- data: [{ type: Input }],
467
- remote: [{ type: Input }],
468
- minCharacters: [{ type: Input }],
469
- mask: [{ type: Input }],
470
- clearInvalid: [{ type: Input }],
471
- searchIncentiveText: [{ type: Input }],
472
- loadingText: [{ type: Input }],
473
- noResultsText: [{ type: Input }],
474
- showAllByDefault: [{ type: Input }],
475
- autoComplete: [{ type: Input }],
476
- label: [{ type: Input }],
477
- value: [{ type: Input }],
478
- search: [{ type: Output }],
479
- select: [{ type: Output }],
480
- flyout: [{ type: ViewChild, args: [FlyoutDirective, { static: true },] }],
481
- flyoutZone: [{ type: ViewChild, args: [FlyoutZoneDirective, { static: true },] }],
482
- template: [{ type: ContentChild, args: [TemplateRef, { static: true },] }]
483
- };
484
- if (false) {
485
- /** @type {?} */
486
- AutoCompleteComponent.prototype.id;
487
- /** @type {?} */
488
- AutoCompleteComponent.prototype.placeholder;
489
- /** @type {?} */
490
- AutoCompleteComponent.prototype.results;
491
- /** @type {?} */
492
- AutoCompleteComponent.prototype.data;
493
- /** @type {?} */
494
- AutoCompleteComponent.prototype.remote;
495
- /** @type {?} */
496
- AutoCompleteComponent.prototype.minCharacters;
497
- /** @type {?} */
498
- AutoCompleteComponent.prototype.mask;
499
- /** @type {?} */
500
- AutoCompleteComponent.prototype.clearInvalid;
501
- /** @type {?} */
502
- AutoCompleteComponent.prototype.searchIncentiveText;
503
- /** @type {?} */
504
- AutoCompleteComponent.prototype.loadingText;
505
- /** @type {?} */
506
- AutoCompleteComponent.prototype.noResultsText;
507
- /** @type {?} */
508
- AutoCompleteComponent.prototype.showAllByDefault;
509
- /** @type {?} */
510
- AutoCompleteComponent.prototype.autoComplete;
511
- /** @type {?} */
512
- AutoCompleteComponent.prototype.label;
513
- /** @type {?} */
514
- AutoCompleteComponent.prototype.value;
515
- /** @type {?} */
516
- AutoCompleteComponent.prototype.search;
517
- /** @type {?} */
518
- AutoCompleteComponent.prototype.select;
519
- /** @type {?} */
520
- AutoCompleteComponent.prototype.flyout;
521
- /** @type {?} */
522
- AutoCompleteComponent.prototype.flyoutZone;
523
- /** @type {?} */
524
- AutoCompleteComponent.prototype.template;
525
- /** @type {?} */
526
- AutoCompleteComponent.prototype.query;
527
- /** @type {?} */
528
- AutoCompleteComponent.prototype.index;
529
- /** @type {?} */
530
- AutoCompleteComponent.prototype.selectedItem;
531
- /** @type {?} */
532
- AutoCompleteComponent.prototype.searching;
533
- /** @type {?} */
534
- AutoCompleteComponent.prototype.focused;
535
- /** @type {?} */
536
- AutoCompleteComponent.prototype.isDisabled;
537
- /**
538
- * @type {?}
539
- * @private
540
- */
541
- AutoCompleteComponent.prototype.remoteValue;
542
- /** @type {?} */
543
- AutoCompleteComponent.prototype.updateModel;
544
- /**
545
- * @type {?}
546
- * @private
547
- */
548
- AutoCompleteComponent.prototype.ref;
549
- /**
550
- * @type {?}
551
- * @private
552
- */
553
- AutoCompleteComponent.prototype.searchService;
554
- }
555
-
556
- /**
557
- * @fileoverview added by tsickle
558
- * Generated from: lib/auto-complete/auto-complete.module.ts
559
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
560
- */
561
- class AutoCompleteModule {
562
- }
563
- AutoCompleteModule.decorators = [
564
- { type: NgModule, args: [{
565
- imports: [
566
- CommonModule,
567
- FormsModule,
568
- FlyoutModule,
569
- SelectableListModule,
570
- MaskModule,
571
- ],
572
- declarations: [
573
- AutoCompleteComponent,
574
- ],
575
- exports: [
576
- AutoCompleteComponent,
577
- ],
578
- providers: [
579
- SearchService,
580
- ],
581
- },] }
582
- ];
583
-
584
- /**
585
- * @fileoverview added by tsickle
586
- * Generated from: lib/auto-complete/public-api.ts
587
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
588
- */
589
-
590
- /**
591
- * @fileoverview added by tsickle
592
- * Generated from: lib/datepicker/datepicker.conf.ts
593
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
594
- */
595
- /** @type {?} */
596
- const DATEPICKER_ERROR_LABELS = new InjectionToken('errorLabels');
597
- /** @type {?} */
598
- const DATEPICKER_DEFAULT_ERROR_LABELS = {
599
- ERRORS_INVALID_DATE: 'INVALID_DATE',
600
- ERRORS_INVALID_RANGE: 'INVALID_RANGE',
601
- };
602
- /** @type {?} */
603
- const DATEPICKER_SEPARATOR_CHAR = '/';
604
- /** @type {?} */
605
- const DATEPICKER_DATE_MASK = `99${DATEPICKER_SEPARATOR_CHAR}99${DATEPICKER_SEPARATOR_CHAR}9999`;
606
-
607
- /**
608
- * @fileoverview added by tsickle
609
- * Generated from: lib/datepicker/components/datepicker/datepicker.component.ts
610
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
611
- */
612
- class DatepickerComponent {
613
- /**
614
- * @param {?=} moduleMonthLabels
615
- * @param {?=} moduleWeekdayLabels
616
- * @param {?=} errorLabels
617
- * @param {?=} calendarService
618
- * @param {?=} formBuilder
619
- * @param {?=} ref
620
- */
621
- constructor(moduleMonthLabels = CALENDAR_DEFAULT_MONTH_LABELS, moduleWeekdayLabels = CALENDAR_DEFAULT_WEEKDAY_LABELS, errorLabels = DATEPICKER_DEFAULT_ERROR_LABELS, calendarService, formBuilder, ref) {
622
- this.moduleMonthLabels = moduleMonthLabels;
623
- this.moduleWeekdayLabels = moduleWeekdayLabels;
624
- this.errorLabels = errorLabels;
625
- this.calendarService = calendarService;
626
- this.formBuilder = formBuilder;
627
- this.ref = ref;
628
- this.placeholder = 'dd/mm/yyyy';
629
- this.blur = new EventEmitter();
630
- this.dateMask = { mask: DATEPICKER_DATE_MASK, showMaskOnHover: false };
631
- this.isDisabled = false;
632
- this.componentDestroyed$ = new Subject();
633
- this.onChange = (/**
634
- * @return {?}
635
- */
636
- () => undefined);
637
- this.onTouched = (/**
638
- * @return {?}
639
- */
640
- () => undefined);
641
- }
642
- /**
643
- * @return {?}
644
- */
645
- ngOnInit() {
646
- this.weekdayLabels = this.weekdayLabels || this.moduleWeekdayLabels;
647
- this.monthLabels = this.monthLabels || this.moduleMonthLabels;
648
- this.createInterval();
649
- this.formControl = this.formBuilder.control({ value: '', disabled: this.isDisabled });
650
- this.formControl.valueChanges
651
- .pipe(takeUntil(this.componentDestroyed$))
652
- .subscribe((/**
653
- * @param {?} value
654
- * @return {?}
655
- */
656
- (value) => {
657
- if (value) {
658
- /** @type {?} */
659
- const format = value.split(DATEPICKER_SEPARATOR_CHAR).reverse().join('-');
660
- /** @type {?} */
661
- const date = DateHelper.parseDate(format, 'yyyy-MM-dd');
662
- if (date) {
663
- this.selectedDate = date;
664
- this.onChange(date.toISOString());
665
- }
666
- else {
667
- // Change value with original value (and not null or '') so we can add an error in the validate function
668
- this.onChange(value);
669
- }
670
- }
671
- else {
672
- this.selectedDate = null;
673
- this.onChange('');
674
- }
675
- }));
676
- }
677
- /**
678
- * @param {?} changes
679
- * @return {?}
680
- */
681
- ngOnChanges(changes) {
682
- if (changes.min || changes.max) {
683
- this.createInterval();
684
- }
685
- }
686
- /**
687
- * @return {?}
688
- */
689
- ngOnDestroy() {
690
- this.componentDestroyed$.next(true);
691
- this.componentDestroyed$.complete();
692
- }
693
- /**
694
- * @private
695
- * @return {?}
696
- */
697
- createInterval() {
698
- if (!this.min && !this.max) {
699
- return;
700
- }
701
- // Create an interval if min/max is filled in
702
- this.interval = IntervalBuilder.dateInterval(this.min ? new Date(this.min) : null, this.max ? new Date(this.max) : null)
703
- .not()
704
- .build();
705
- }
706
- /**
707
- * @param {?} value
708
- * @return {?}
709
- */
710
- writeValue(value) {
711
- this.selectedDate = typeof value === 'string'
712
- ? this.isISODateFormat(value) ? new Date(value) : DateHelper.parseDate(value, 'dd/MM/yyyy')
713
- : value;
714
- /** @type {?} */
715
- const dateString = this.selectedDate ? this.formatDate(this.selectedDate) : '';
716
- this.formControl.setValue(dateString);
717
- }
718
- /**
719
- * @param {?} onChange
720
- * @return {?}
721
- */
722
- registerOnChange(onChange) {
723
- this.onChange = onChange;
724
- }
725
- /**
726
- * @param {?} onTouched
727
- * @return {?}
728
- */
729
- registerOnTouched(onTouched) {
730
- this.onTouched = onTouched;
731
- }
732
- /**
733
- * @param {?} isDisabled
734
- * @return {?}
735
- */
736
- setDisabledState(isDisabled) {
737
- this.isDisabled = isDisabled;
738
- if (this.formControl) {
739
- if (isDisabled && this.formControl.enabled) {
740
- this.formControl.disable();
741
- }
742
- else if (!isDisabled && this.formControl.disabled) {
743
- this.formControl.enable();
744
- }
745
- }
746
- this.ref.markForCheck();
747
- }
748
- /**
749
- * @param {?} result
750
- * @return {?}
751
- */
752
- selectDateFromCalendar(result) {
753
- if (result.complete) {
754
- this.formControl.setValue(this.formatDate(result.date));
755
- this.flyout.close();
756
- }
757
- }
758
- /**
759
- * @param {?} date
760
- * @return {?}
761
- */
762
- formatDate(date) {
763
- return DateHelper.formatDate(date, 'DD/MM/YYYY', {
764
- leadingZero: true,
765
- monthLabels: this.monthLabels,
766
- weekdayLabels: this.weekdayLabels,
767
- });
768
- }
769
- /**
770
- * @param {?} ctrl
771
- * @return {?}
772
- */
773
- validate(ctrl) {
774
- // no error on empty value (add required validator in app)
775
- if (ctrl.value === '' || ctrl.value === null) {
776
- return null;
777
- }
778
- // throw format error if no valid date was provided
779
- /** @type {?} */
780
- const date = DateHelper.parseDate(ctrl.value);
781
- if (!date) {
782
- return {
783
- format: this.errorLabels.ERRORS_INVALID_DATE,
784
- };
785
- }
786
- // no error if valid date an no range provided
787
- if (!this.range || !this.range.length) {
788
- return null;
789
- }
790
- // throw error when out of range
791
- /** @type {?} */
792
- const range = this.calendarService.getRangeForDate(date, this.range);
793
- return range.indexOf(date.getDate()) >= 0 ? {
794
- range: this.errorLabels.ERRORS_INVALID_RANGE,
795
- } : null;
796
- }
797
- /**
798
- * @param {?} e
799
- * @return {?}
800
- */
801
- handleBlur(e) {
802
- this.blur.emit(e);
803
- this.onTouched(e);
804
- }
805
- /**
806
- * @private
807
- * @param {?} value
808
- * @return {?}
809
- */
810
- isISODateFormat(value) {
811
- if (typeof value !== 'string') {
812
- return false;
813
- }
814
- return value.match(/\d{4}-\d{2}-\d{2}T.*/);
815
- }
816
- }
817
- DatepickerComponent.decorators = [
818
- { type: Component, args: [{
819
- selector: 'aui-datepicker',
820
- template: "<div aria-haspopup=\"grid\" auiFlyout class=\"aui-datepicker a-input__wrapper\">\n <input\n (blur)=\"handleBlur($event)\"\n [attr.disabled]=\"isDisabled ? true : null\"\n [auiMask]=\"dateMask.mask\"\n [autocomplete]=\"autocomplete\"\n [formControl]=\"formControl\"\n id=\"{{ id }}\"\n name=\"{{ name }}\"\n placeholder=\"{{ placeholder }}\"\n type=\"text\"\n >\n <aui-icon *ngIf=\"isDisabled\" name=\"ai-calendar-3\" role=\"button\" tabindex=\"0\"></aui-icon>\n\n <ng-container *ngIf=\"!isDisabled\">\n <aui-icon auiFlyoutAction [openOnFocus]=\"false\" name=\"ai-calendar-3\" className=\"is-clickable\" role=\"button\" tabindex=\"0\"></aui-icon>\n </ng-container>\n\n <ng-container *ngIf=\"!isDisabled\">\n <div auiFlyoutZone class=\"m-datepicker m-datepicker--fixed\" role=\"dialog\">\n <aui-calendar\n (selectDate)=\"selectDateFromCalendar($event)\"\n [range]=\"range\"\n [selectedDate]=\"selectedDate\"\n [interval]=\"interval\"\n [weekdayLabels]=\"weekdayLabels\"\n [monthLabels]=\"monthLabels\"\n ></aui-calendar>\n </div>\n </ng-container>\n</div>\n",
821
- changeDetection: ChangeDetectionStrategy.OnPush,
822
- providers: [{
823
- provide: NG_VALUE_ACCESSOR,
824
- useExisting: forwardRef((/**
825
- * @return {?}
826
- */
827
- () => DatepickerComponent)),
828
- // tslint:disable-line:no-forward-ref
829
- multi: true,
830
- }, {
831
- provide: NG_VALIDATORS,
832
- useExisting: forwardRef((/**
833
- * @return {?}
834
- */
835
- () => DatepickerComponent)),
836
- // tslint:disable-line:no-forward-ref
837
- multi: true,
838
- }],
839
- styles: [".aui-datepicker,:host{display:block}"]
840
- }] }
841
- ];
842
- /** @nocollapse */
843
- DatepickerComponent.ctorParameters = () => [
844
- { type: undefined, decorators: [{ type: Inject, args: [CALENDAR_MONTH_LABELS,] }] },
845
- { type: undefined, decorators: [{ type: Inject, args: [CALENDAR_WEEKDAY_LABELS,] }] },
846
- { type: undefined, decorators: [{ type: Inject, args: [DATEPICKER_ERROR_LABELS,] }] },
847
- { type: CalendarService },
848
- { type: FormBuilder },
849
- { type: ChangeDetectorRef }
850
- ];
851
- DatepickerComponent.propDecorators = {
852
- flyout: [{ type: ViewChild, args: [FlyoutDirective, { static: true },] }],
853
- id: [{ type: Input }],
854
- name: [{ type: Input }],
855
- placeholder: [{ type: Input }],
856
- range: [{ type: Input }],
857
- min: [{ type: Input }],
858
- max: [{ type: Input }],
859
- autocomplete: [{ type: Input }],
860
- weekdayLabels: [{ type: Input }],
861
- monthLabels: [{ type: Input }],
862
- blur: [{ type: Output }]
863
- };
864
- if (false) {
865
- /** @type {?} */
866
- DatepickerComponent.prototype.flyout;
867
- /** @type {?} */
868
- DatepickerComponent.prototype.id;
869
- /** @type {?} */
870
- DatepickerComponent.prototype.name;
871
- /** @type {?} */
872
- DatepickerComponent.prototype.placeholder;
873
- /** @type {?} */
874
- DatepickerComponent.prototype.range;
875
- /** @type {?} */
876
- DatepickerComponent.prototype.min;
877
- /** @type {?} */
878
- DatepickerComponent.prototype.max;
879
- /** @type {?} */
880
- DatepickerComponent.prototype.autocomplete;
881
- /** @type {?} */
882
- DatepickerComponent.prototype.weekdayLabels;
883
- /** @type {?} */
884
- DatepickerComponent.prototype.monthLabels;
885
- /** @type {?} */
886
- DatepickerComponent.prototype.blur;
887
- /** @type {?} */
888
- DatepickerComponent.prototype.dateMask;
889
- /** @type {?} */
890
- DatepickerComponent.prototype.formControl;
891
- /** @type {?} */
892
- DatepickerComponent.prototype.selectedDate;
893
- /** @type {?} */
894
- DatepickerComponent.prototype.isDisabled;
895
- /** @type {?} */
896
- DatepickerComponent.prototype.interval;
897
- /**
898
- * @type {?}
899
- * @private
900
- */
901
- DatepickerComponent.prototype.componentDestroyed$;
902
- /**
903
- * @type {?}
904
- * @private
905
- */
906
- DatepickerComponent.prototype.onChange;
907
- /**
908
- * @type {?}
909
- * @private
910
- */
911
- DatepickerComponent.prototype.onTouched;
912
- /**
913
- * @type {?}
914
- * @private
915
- */
916
- DatepickerComponent.prototype.moduleMonthLabels;
917
- /**
918
- * @type {?}
919
- * @private
920
- */
921
- DatepickerComponent.prototype.moduleWeekdayLabels;
922
- /**
923
- * @type {?}
924
- * @private
925
- */
926
- DatepickerComponent.prototype.errorLabels;
927
- /** @type {?} */
928
- DatepickerComponent.prototype.calendarService;
929
- /**
930
- * @type {?}
931
- * @private
932
- */
933
- DatepickerComponent.prototype.formBuilder;
934
- /**
935
- * @type {?}
936
- * @private
937
- */
938
- DatepickerComponent.prototype.ref;
939
- }
940
-
941
- /**
942
- * @fileoverview added by tsickle
943
- * Generated from: lib/datepicker/datepicker.module.ts
944
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
945
- */
946
- const ɵ0 = CALENDAR_DEFAULT_WEEKDAY_LABELS, ɵ1 = CALENDAR_DEFAULT_MONTH_LABELS, ɵ2 = DATEPICKER_DEFAULT_ERROR_LABELS;
947
- class DatepickerModule {
948
- /**
949
- * @param {?} weekdayLabels
950
- * @param {?} monthLabels
951
- * @param {?} errorLabels
952
- * @return {?}
953
- */
954
- static forChild(weekdayLabels, monthLabels, errorLabels) {
955
- return {
956
- ngModule: DatepickerModule,
957
- providers: [
958
- { provide: CALENDAR_WEEKDAY_LABELS, useValue: weekdayLabels },
959
- { provide: CALENDAR_MONTH_LABELS, useValue: monthLabels },
960
- { provide: DATEPICKER_ERROR_LABELS, useValue: errorLabels },
961
- ],
962
- };
963
- }
964
- }
965
- DatepickerModule.decorators = [
966
- { type: NgModule, args: [{
967
- imports: [
968
- CommonModule,
969
- FormsModule,
970
- ReactiveFormsModule,
971
- CalendarModule,
972
- IconModule,
973
- FlyoutModule,
974
- MaskModule,
975
- ],
976
- declarations: [
977
- DatepickerComponent,
978
- ],
979
- exports: [
980
- DatepickerComponent,
981
- ],
982
- providers: [
983
- { provide: CALENDAR_WEEKDAY_LABELS, useValue: ɵ0 },
984
- { provide: CALENDAR_MONTH_LABELS, useValue: ɵ1 },
985
- { provide: DATEPICKER_ERROR_LABELS, useValue: ɵ2 },
986
- ],
987
- },] }
988
- ];
989
-
990
- /**
991
- * @fileoverview added by tsickle
992
- * Generated from: lib/datepicker/public-api.ts
993
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
994
- */
995
-
996
- /**
997
- * @fileoverview added by tsickle
998
- * Generated from: lib/mask/public-api.ts
999
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1000
- */
1001
-
1002
- /**
1003
- * @fileoverview added by tsickle
1004
- * Generated from: lib/range-slider/components/range-slider/range-slider.component.ts
1005
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1006
- */
1007
- class RangeSliderComponent {
1008
- /**
1009
- * @param {?} elRef
1010
- */
1011
- constructor(elRef) {
1012
- this.elRef = elRef;
1013
- this.coreBranding = true;
1014
- this.min = 0;
1015
- this.max = 100;
1016
- this.minimalDistance = 1;
1017
- this.step = 0;
1018
- this.labelBefore = '';
1019
- this.labelAfter = '';
1020
- this.start = 0;
1021
- this.end = false;
1022
- this.steps = [];
1023
- this.active = null;
1024
- this.isDisabled = false;
1025
- this.hasFocus = false;
1026
- this.click = false;
1027
- this.propagateChange = (/**
1028
- * @param {?} value
1029
- * @return {?}
1030
- */
1031
- (value) => {
1032
- });
1033
- }
1034
- /**
1035
- * @return {?}
1036
- */
1037
- get disabledClass() {
1038
- return this.isDisabled;
1039
- }
1040
- /**
1041
- * @return {?}
1042
- */
1043
- ngOnInit() {
1044
- if (this.step > 0) {
1045
- for (let i = 0; i <= this.max; i += Number(this.step)) {
1046
- this.steps.push(i);
1047
- }
1048
- }
1049
- this.startPercentage = this.startToPercentage();
1050
- if (this.end) {
1051
- this.endPercentage = this.endToPercentage();
1052
- }
1053
- }
1054
- /**
1055
- * @param {?} value
1056
- * @return {?}
1057
- */
1058
- writeValue(value) {
1059
- if (value && value.start) {
1060
- this.start = value.start;
1061
- }
1062
- else if (!isNaN(value) && value !== '') {
1063
- this.start = Number(value);
1064
- }
1065
- else {
1066
- this.setStart(Number(this.min));
1067
- }
1068
- this.startPercentage = this.startToPercentage();
1069
- if (value && value.end) {
1070
- this.end = value.end;
1071
- this.endPercentage = this.endToPercentage();
1072
- }
1073
- }
1074
- /**
1075
- * @return {?}
1076
- */
1077
- registerOnTouched() {
1078
- }
1079
- /**
1080
- * @param {?} fn
1081
- * @return {?}
1082
- */
1083
- registerOnChange(fn) {
1084
- this.propagateChange = fn;
1085
- }
1086
- /**
1087
- * @param {?} isDisabled
1088
- * @return {?}
1089
- */
1090
- setDisabledState(isDisabled) {
1091
- this.isDisabled = isDisabled;
1092
- }
1093
- /**
1094
- * @param {?} handle
1095
- * @return {?}
1096
- */
1097
- onMouseDown(handle) {
1098
- if (this.isDisabled) {
1099
- return;
1100
- }
1101
- this.hasFocus = true;
1102
- this.active = handle;
1103
- }
1104
- /**
1105
- * @param {?} hasFocus
1106
- * @param {?} element
1107
- * @param {?} $event
1108
- * @return {?}
1109
- */
1110
- toggleFocus(hasFocus, element, $event) {
1111
- if (this.isDisabled) {
1112
- return;
1113
- }
1114
- $event.preventDefault();
1115
- this.hasFocus = hasFocus;
1116
- this.active = element;
1117
- }
1118
- /**
1119
- * @param {?} $event
1120
- * @return {?}
1121
- */
1122
- onKeyDown($event) {
1123
- if (!this.hasFocus) {
1124
- return;
1125
- }
1126
- /** @type {?} */
1127
- const key = $event.keyCode;
1128
- /** @type {?} */
1129
- const keyCodes = {
1130
- end: 35,
1131
- home: 36,
1132
- left: 37,
1133
- up: 38,
1134
- right: 39,
1135
- down: 40,
1136
- };
1137
- if (Object.keys(keyCodes).map((/**
1138
- * @param {?} e
1139
- * @return {?}
1140
- */
1141
- e => keyCodes[e])).indexOf(key) === -1) {
1142
- return;
1143
- }
1144
- /** @type {?} */
1145
- let increment = this.minimalDistance;
1146
- if (this.step > 0) {
1147
- increment = Number(this.step);
1148
- }
1149
- /** @type {?} */
1150
- const processValue = (/**
1151
- * @param {?} dir
1152
- * @return {?}
1153
- */
1154
- (dir) => {
1155
- /** @type {?} */
1156
- let newValue = (this.active === 'start' ? this.start : Number(this.end));
1157
- if (dir === 'up') {
1158
- newValue += increment;
1159
- }
1160
- else {
1161
- newValue -= increment;
1162
- }
1163
- /** @type {?} */
1164
- let newPercentage = (newValue - this.min) / (this.max - this.min) * 100;
1165
- if (newPercentage > 100) {
1166
- newPercentage = 100;
1167
- }
1168
- if (newPercentage < 0) {
1169
- newPercentage = 0;
1170
- }
1171
- return newPercentage;
1172
- });
1173
- switch (key) {
1174
- case keyCodes.right:
1175
- case keyCodes.up:
1176
- this.updateHandle(processValue('up'));
1177
- $event.preventDefault();
1178
- break;
1179
- case keyCodes.left:
1180
- case keyCodes.down:
1181
- this.updateHandle(processValue('down'));
1182
- $event.preventDefault();
1183
- break;
1184
- case keyCodes.end:
1185
- this.updateHandle(100);
1186
- $event.preventDefault();
1187
- break;
1188
- case keyCodes.home:
1189
- this.updateHandle(0);
1190
- $event.preventDefault();
1191
- break;
1192
- }
1193
- }
1194
- /**
1195
- * @param {?} event
1196
- * @return {?}
1197
- */
1198
- onMouseUp(event) {
1199
- if (this.active === 'start') {
1200
- this.setStart(this.round(this.start, this.step, 0));
1201
- this.startPercentage = this.startToPercentage();
1202
- }
1203
- if (this.active === 'end') {
1204
- this.setEnd(this.round(this.end, this.step, 0));
1205
- this.endPercentage = this.endToPercentage();
1206
- }
1207
- this.click = false;
1208
- }
1209
- /**
1210
- * @param {?} event
1211
- * @return {?}
1212
- */
1213
- mouseDown(event) {
1214
- this.click = true;
1215
- }
1216
- /**
1217
- * @param {?} event
1218
- * @return {?}
1219
- */
1220
- onMouseMove(event) {
1221
- if (!this.active || !this.click) {
1222
- return;
1223
- }
1224
- event.preventDefault(); // Do not select text while sliding
1225
- // Do not select text while sliding
1226
- /** @type {?} */
1227
- const x = ((/** @type {?} */ (event))).x !== undefined ? ((/** @type {?} */ (event))).x : ((/** @type {?} */ (event))).targetTouches[0].pageX;
1228
- /** @type {?} */
1229
- const rect = this.elRef.nativeElement.getBoundingClientRect();
1230
- /** @type {?} */
1231
- const newPercentage = this.calcPercentage(x, rect.width, rect.left);
1232
- this.updateHandle(newPercentage);
1233
- }
1234
- /**
1235
- * @param {?} newPercentage
1236
- * @return {?}
1237
- */
1238
- updateHandle(newPercentage) {
1239
- if (this.active === 'start') {
1240
- this.startPercentage = newPercentage;
1241
- this.setStart(this.percentageToStart());
1242
- if (this.minimalDistanceNotRespected()) {
1243
- this.setStart(Number(this.end) - Number(this.minimalDistance));
1244
- this.startPercentage = this.startToPercentage();
1245
- }
1246
- }
1247
- if (this.active === 'end' && this.endPercentage) {
1248
- this.endPercentage = newPercentage;
1249
- this.setEnd(this.percentageToEnd());
1250
- if (this.minimalDistanceNotRespected()) {
1251
- this.setEnd(Number(this.start) + Number(this.minimalDistance));
1252
- this.endPercentage = this.endToPercentage();
1253
- }
1254
- }
1255
- }
1256
- // ---------- HELPERS ---------- //
1257
- /**
1258
- * @param {?} value
1259
- * @return {?}
1260
- */
1261
- setStart(value) {
1262
- this.start = value;
1263
- if (this.end) {
1264
- this.propagateChange((/** @type {?} */ ({
1265
- start: this.start,
1266
- end: this.end,
1267
- })));
1268
- }
1269
- else {
1270
- this.propagateChange(this.start);
1271
- }
1272
- }
1273
- /**
1274
- * @param {?} value
1275
- * @return {?}
1276
- */
1277
- setEnd(value) {
1278
- this.end = value;
1279
- this.propagateChange((/** @type {?} */ ({
1280
- start: this.start,
1281
- end: this.end,
1282
- })));
1283
- }
1284
- /**
1285
- * @param {?} n
1286
- * @param {?} increment
1287
- * @param {?} offset
1288
- * @return {?}
1289
- */
1290
- round(n, increment, offset) {
1291
- if (increment > 0) {
1292
- return Math.round((n - offset) / increment) * increment + offset;
1293
- }
1294
- return n;
1295
- }
1296
- /**
1297
- * @return {?}
1298
- */
1299
- startToPercentage() {
1300
- return Math.round((this.start - this.min) / (this.max - this.min) * 100);
1301
- }
1302
- /**
1303
- * @return {?}
1304
- */
1305
- percentageToStart() {
1306
- return Math.round((this.startPercentage / 100) * (this.max - this.min) + Number(this.min));
1307
- }
1308
- /**
1309
- * @return {?}
1310
- */
1311
- endToPercentage() {
1312
- return Math.round((Number(this.end) - this.min) / (this.max - this.min) * 100);
1313
- }
1314
- /**
1315
- * @return {?}
1316
- */
1317
- percentageToEnd() {
1318
- return Math.round((this.endPercentage / 100) * (this.max - this.min) + Number(this.min));
1319
- }
1320
- /**
1321
- * @return {?}
1322
- */
1323
- minimalDistanceNotRespected() {
1324
- return this.minimalDistance >= 0 && this.end && this.start > Number(this.end) - this.minimalDistance;
1325
- }
1326
- /**
1327
- * @param {?} mouseX
1328
- * @param {?} width
1329
- * @param {?} offsetLeft
1330
- * @return {?}
1331
- */
1332
- calcPercentage(mouseX, width, offsetLeft) {
1333
- /** @type {?} */
1334
- const mousePos = mouseX - offsetLeft;
1335
- /** @type {?} */
1336
- let newPercentage = Math.round((mousePos / width) * 100);
1337
- if (newPercentage > 100) {
1338
- newPercentage = 100;
1339
- }
1340
- if (newPercentage < 0) {
1341
- newPercentage = 0;
1342
- }
1343
- return newPercentage;
1344
- }
1345
- }
1346
- RangeSliderComponent.decorators = [
1347
- { type: Component, args: [{
1348
- selector: 'aui-range-slider',
1349
- template: "<div class=\"m-range-slider__inner\">\n <div\n [style.left]=\"endPercentage ? startPercentage + '%' : false\"\n [style.width]=\"endPercentage ? endPercentage - startPercentage + '%' : startPercentage + '%'\"\n class=\"m-range-slider__bar\"\n ></div>\n <span\n (blur)=\"toggleFocus(false, null, $event)\"\n (dragexit)=\"onMouseUp($event)\"\n (focus)=\"toggleFocus(true, 'start', $event)\"\n (mousedown)=\"onMouseDown('start')\"\n (touchstart)=\"onMouseDown('start')\"\n [style.left]=\"startPercentage + '%'\"\n class=\"m-range-slider__handle\"\n tabindex=\"0\"\n >\n\t\t<div class=\"m-range-slider__tooltip a-tooltip a-tooltip--primary a-tooltip--top\">\n\t\t\t<p>{{ labelBefore }}{{ start }}{{ labelAfter }}</p>\n\t\t</div>\n\t</span>\n\n <span\n (blur)=\"toggleFocus(false, null, $event)\"\n (dragexit)=\"onMouseUp($event)\"\n (focus)=\"toggleFocus(true, 'end', $event)\"\n (mousedown)=\"onMouseDown('end')\"\n (touchstart)=\"onMouseDown('end')\"\n *ngIf=\"end\"\n [style.left]=\"endPercentage + '%'\"\n class=\"m-range-slider__handle\"\n name=\"m-range-slider__handle__end\"\n tabindex=\"0\"\n >\n\t\t<div class=\"m-range-slider__tooltip a-tooltip a-tooltip--primary a-tooltip--top\">\n\t\t\t<p>{{ labelBefore }}{{ end }}{{ labelAfter }}</p>\n\t\t</div>\n\t</span>\n</div>\n\n<div class=\"m-range-slider__steps\">\n <div *ngFor=\"let step of steps; let i = index\" class=\"m-range-slider__step\"></div>\n</div>\n\n<div class=\"m-range-slider__step-labels\">\n <div *ngFor=\"let step of steps; let i = index\" class=\"m-range-slider__step\">{{ step }}</div>\n</div>\n",
1350
- providers: [
1351
- {
1352
- provide: NG_VALUE_ACCESSOR,
1353
- useExisting: forwardRef((/**
1354
- * @return {?}
1355
- */
1356
- () => RangeSliderComponent)),
1357
- // tslint:disable-line
1358
- multi: true,
1359
- },
1360
- ],
1361
- styles: [":host{display:block;position:relative}:host.is-disabled{cursor:not-allowed}:host.is-disabled .m-range-slider__handle:hover{cursor:not-allowed}"]
1362
- }] }
1363
- ];
1364
- /** @nocollapse */
1365
- RangeSliderComponent.ctorParameters = () => [
1366
- { type: ElementRef }
1367
- ];
1368
- RangeSliderComponent.propDecorators = {
1369
- coreBranding: [{ type: HostBinding, args: ['class.m-range-slider',] }],
1370
- min: [{ type: Input }],
1371
- max: [{ type: Input }],
1372
- minimalDistance: [{ type: Input }],
1373
- step: [{ type: Input }],
1374
- labelBefore: [{ type: Input }],
1375
- labelAfter: [{ type: Input }],
1376
- disabledClass: [{ type: HostBinding, args: ['class.is-disabled',] }],
1377
- onKeyDown: [{ type: HostListener, args: ['document:keydown', ['$event'],] }],
1378
- onMouseUp: [{ type: HostListener, args: ['touchend', ['$event'],] }, { type: HostListener, args: ['mouseup', ['$event'],] }],
1379
- mouseDown: [{ type: HostListener, args: ['touchstart', ['$event'],] }, { type: HostListener, args: ['mousedown', ['$event'],] }],
1380
- onMouseMove: [{ type: HostListener, args: ['touchmove', ['$event'],] }, { type: HostListener, args: ['mousemove', ['$event'],] }]
1381
- };
1382
- if (false) {
1383
- /** @type {?} */
1384
- RangeSliderComponent.prototype.coreBranding;
1385
- /** @type {?} */
1386
- RangeSliderComponent.prototype.min;
1387
- /** @type {?} */
1388
- RangeSliderComponent.prototype.max;
1389
- /** @type {?} */
1390
- RangeSliderComponent.prototype.minimalDistance;
1391
- /** @type {?} */
1392
- RangeSliderComponent.prototype.step;
1393
- /** @type {?} */
1394
- RangeSliderComponent.prototype.labelBefore;
1395
- /** @type {?} */
1396
- RangeSliderComponent.prototype.labelAfter;
1397
- /** @type {?} */
1398
- RangeSliderComponent.prototype.start;
1399
- /** @type {?} */
1400
- RangeSliderComponent.prototype.end;
1401
- /** @type {?} */
1402
- RangeSliderComponent.prototype.steps;
1403
- /** @type {?} */
1404
- RangeSliderComponent.prototype.startPercentage;
1405
- /** @type {?} */
1406
- RangeSliderComponent.prototype.endPercentage;
1407
- /** @type {?} */
1408
- RangeSliderComponent.prototype.active;
1409
- /** @type {?} */
1410
- RangeSliderComponent.prototype.isDisabled;
1411
- /** @type {?} */
1412
- RangeSliderComponent.prototype.hasFocus;
1413
- /** @type {?} */
1414
- RangeSliderComponent.prototype.click;
1415
- /** @type {?} */
1416
- RangeSliderComponent.prototype.propagateChange;
1417
- /**
1418
- * @type {?}
1419
- * @private
1420
- */
1421
- RangeSliderComponent.prototype.elRef;
1422
- }
1423
-
1424
- /**
1425
- * @fileoverview added by tsickle
1426
- * Generated from: lib/range-slider/range-slider.module.ts
1427
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1428
- */
1429
- class RangeSliderModule {
1430
- }
1431
- RangeSliderModule.decorators = [
1432
- { type: NgModule, args: [{
1433
- imports: [
1434
- CommonModule,
1435
- FormsModule,
1436
- ],
1437
- declarations: [
1438
- RangeSliderComponent,
1439
- ],
1440
- exports: [
1441
- RangeSliderComponent,
1442
- ],
1443
- },] }
1444
- ];
1445
-
1446
- /**
1447
- * @fileoverview added by tsickle
1448
- * Generated from: lib/range-slider/public-api.ts
1449
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1450
- */
1451
-
1452
- /**
1453
- * @fileoverview added by tsickle
1454
- * Generated from: lib/search-filter/components/search-filter/search-filter.component.ts
1455
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1456
- */
1457
- class SearchFilterComponent {
1458
- constructor() {
1459
- this.flyoutSize = FlyoutSize.Small;
1460
- this.label = 'Filter';
1461
- this.labelDeselect = 'Alles deselecteren';
1462
- this.labelResults = 'Resultaten';
1463
- this.labelNoResults = 'Geen resultaten gevonden.';
1464
- this.choices = [];
1465
- this.placeholder = 'Zoeken';
1466
- this.inputDelay = 150;
1467
- this.showAllByDefault = false;
1468
- this.size = 'default';
1469
- this.search = new EventEmitter();
1470
- this.query = '';
1471
- this.selectedItems = [];
1472
- this.filteredChoices = [];
1473
- this.loading = false;
1474
- this.isDisabled = false;
1475
- this.updateModel = (/**
1476
- * @return {?}
1477
- */
1478
- () => {
1479
- });
1480
- this.filterDataFromSearch = debounce(this.filterData.bind(this), this.inputDelay);
1481
- }
1482
- /**
1483
- * @param {?} value
1484
- * @return {?}
1485
- */
1486
- writeValue(value) {
1487
- this.selectedItems = Array.isArray(value) ? value : [];
1488
- }
1489
- /**
1490
- * @param {?} onChange
1491
- * @return {?}
1492
- */
1493
- registerOnChange(onChange) {
1494
- this.updateModel = onChange;
1495
- }
1496
- /**
1497
- * @return {?}
1498
- */
1499
- registerOnTouched() {
1500
- }
1501
- /**
1502
- * @param {?} isDisabled
1503
- * @return {?}
1504
- */
1505
- setDisabledState(isDisabled) {
1506
- this.isDisabled = isDisabled;
1507
- }
1508
- /**
1509
- * @return {?}
1510
- */
1511
- ngOnInit() {
1512
- if (this.showAllByDefault) {
1513
- this.filterData();
1514
- }
1515
- }
1516
- /**
1517
- * @param {?} changes
1518
- * @return {?}
1519
- */
1520
- ngOnChanges(changes) {
1521
- /** @type {?} */
1522
- const choices = get(changes, 'choices.currentValue', null);
1523
- if (!choices) {
1524
- return;
1525
- }
1526
- if (this.remote) {
1527
- this.filteredChoices = [...choices];
1528
- this.loading = false;
1529
- }
1530
- else {
1531
- this.filterData();
1532
- }
1533
- }
1534
- /**
1535
- * @return {?}
1536
- */
1537
- filterData() {
1538
- if (this.remote) {
1539
- this.loading = true;
1540
- return this.search.emit(this.query);
1541
- }
1542
- this.filterChoices();
1543
- }
1544
- /**
1545
- * @return {?}
1546
- */
1547
- clear() {
1548
- this.selectedItems = [];
1549
- this.query = '';
1550
- this.filterData();
1551
- this.updateModel(this.selectedItems);
1552
- }
1553
- /**
1554
- * @param {?} choice
1555
- * @return {?}
1556
- */
1557
- toggleSelected(choice) {
1558
- /** @type {?} */
1559
- const selected = this.selectedItems.indexOf(choice);
1560
- if (selected < 0) {
1561
- this.selectedItems = this.selectedItems.concat(choice);
1562
- }
1563
- else {
1564
- this.selectedItems = [
1565
- ...this.selectedItems.slice(0, selected),
1566
- ...this.selectedItems.slice(selected + 1),
1567
- ];
1568
- }
1569
- this.updateModel(this.selectedItems);
1570
- }
1571
- /**
1572
- * @private
1573
- * @return {?}
1574
- */
1575
- filterChoices() {
1576
- this.filteredChoices = this.choices.filter((/**
1577
- * @param {?} choice
1578
- * @return {?}
1579
- */
1580
- (choice) => {
1581
- return (this.selectedItems.indexOf(choice.value) < 0 &&
1582
- choice.label.toLowerCase().indexOf(this.query.toLowerCase()) >= 0);
1583
- }));
1584
- }
1585
- }
1586
- SearchFilterComponent.decorators = [
1587
- { type: Component, args: [{
1588
- selector: 'aui-search-filter',
1589
- template: "<div [align]=\"flyoutAlign\" [size]=\"flyoutSize\" auiFlyout class=\"m-search-filter\">\n <button class=\"has-icon-right a-button--default\" [attr.disabled]=\"isDisabled ? 'true' : null\" aria-haspopup=\u201Dtrue\u201D\n auiFlyoutAction\n [ngClass]=\"{\n 'a-button' : selectedItems.length,\n 'a-button-outline' : !selectedItems.length,\n 'a-button--large' : size === 'large',\n 'a-button--small': size === 'small',\n 'a-button--tiny' : size === 'tiny'\n }\">\n <span id=\"{{ id + '-label' }}\">{{ label }}</span>\n <span *ngIf=\"selectedItems.length\"> ({{ selectedItems.length }})</span>\n <aui-icon name=\"ai-arrow-down-1\"></aui-icon>\n </button>\n\n <div auiFlyoutZone class=\"m-search-filter__search m-search-filter__search--scroll\">\n <div *ngIf=\"!isDisabled\" class=\"m-search-filter__input a-input has-icon-right\">\n <div class=\"a-input__wrapper\">\n <input (input)=\"filterDataFromSearch()\" [(ngModel)]=\"query\" [attr.aria-labelledby]=\"id + '-label'\"\n [attr.placeholder]=\"placeholder\"\n aria-autocomplete=\"list\" id=\"{{ id + '-search' }}\" name=\"{{ name + '-search' }}\"\n type=\"text\">\n <aui-icon name=\"ai-search\"></aui-icon>\n </div>\n </div>\n\n <div *ngIf=\"!isDisabled && selectedItems.length > 0\" class=\"m-search-filter__clear\">\n <button (click)=\"clear()\" class=\"a-button-outline a-button--small a-button--danger has-icon-left\" type=\"button\">\n <aui-icon name=\"ai-close\"></aui-icon>\n {{ labelDeselect }}\n </button>\n </div>\n\n <p *ngIf=\"labelResults\" class=\"h6 m-search-filter__results-title u-margin-bottom-xs\">{{ labelResults }}</p>\n <div *ngIf=\"loading\" class=\"u-text-center u-padding a-spinner\"></div>\n <ul *ngIf=\"!loading\" class=\"a-list a-list--lined a-list--unstyled\">\n <li *ngIf=\"!filteredChoices.length\" class=\"m-search-filter__results-item a-list__item\">\n <p class=\"u-margin-xs\">{{ labelNoResults }}</p>\n </li>\n <li *ngFor=\"let choice of filteredChoices; index as i\" class=\"m-search-filter__results-item a-list__item\">\n <div class=\"a-input__checkbox\">\n <input\n (change)=\"toggleSelected(choice.value)\"\n [attr.disabled]=\"isDisabled ? true : null\"\n [checked]=\"selectedItems.indexOf(choice.value) >= 0\"\n id=\"{{ 'checkbox--' + i + '--' + id }}\"\n name=\"{{ 'checkbox--' + i + '--' + id }}\"\n type=\"checkbox\"\n />\n <label for=\"{{ 'checkbox--' + i + '--' + id }}\">{{ choice.label }}</label>\n </div>\n </li>\n </ul>\n </div>\n</div>\n",
1590
- providers: [{
1591
- provide: NG_VALUE_ACCESSOR,
1592
- useExisting: forwardRef((/**
1593
- * @return {?}
1594
- */
1595
- () => SearchFilterComponent)),
1596
- // tslint:disable-line:no-forward-ref
1597
- multi: true,
1598
- }]
1599
- }] }
1600
- ];
1601
- /** @nocollapse */
1602
- SearchFilterComponent.ctorParameters = () => [];
1603
- SearchFilterComponent.propDecorators = {
1604
- id: [{ type: Input }],
1605
- name: [{ type: Input }],
1606
- flyoutSize: [{ type: Input }],
1607
- flyoutAlign: [{ type: Input }],
1608
- label: [{ type: Input }],
1609
- labelDeselect: [{ type: Input }],
1610
- labelResults: [{ type: Input }],
1611
- labelNoResults: [{ type: Input }],
1612
- choices: [{ type: Input }],
1613
- remote: [{ type: Input }],
1614
- placeholder: [{ type: Input }],
1615
- inputDelay: [{ type: Input }],
1616
- showAllByDefault: [{ type: Input }],
1617
- size: [{ type: Input }],
1618
- search: [{ type: Output }]
1619
- };
1620
- if (false) {
1621
- /** @type {?} */
1622
- SearchFilterComponent.prototype.id;
1623
- /** @type {?} */
1624
- SearchFilterComponent.prototype.name;
1625
- /** @type {?} */
1626
- SearchFilterComponent.prototype.flyoutSize;
1627
- /** @type {?} */
1628
- SearchFilterComponent.prototype.flyoutAlign;
1629
- /** @type {?} */
1630
- SearchFilterComponent.prototype.label;
1631
- /** @type {?} */
1632
- SearchFilterComponent.prototype.labelDeselect;
1633
- /** @type {?} */
1634
- SearchFilterComponent.prototype.labelResults;
1635
- /** @type {?} */
1636
- SearchFilterComponent.prototype.labelNoResults;
1637
- /** @type {?} */
1638
- SearchFilterComponent.prototype.choices;
1639
- /** @type {?} */
1640
- SearchFilterComponent.prototype.remote;
1641
- /** @type {?} */
1642
- SearchFilterComponent.prototype.placeholder;
1643
- /** @type {?} */
1644
- SearchFilterComponent.prototype.inputDelay;
1645
- /** @type {?} */
1646
- SearchFilterComponent.prototype.showAllByDefault;
1647
- /** @type {?} */
1648
- SearchFilterComponent.prototype.size;
1649
- /** @type {?} */
1650
- SearchFilterComponent.prototype.search;
1651
- /** @type {?} */
1652
- SearchFilterComponent.prototype.query;
1653
- /** @type {?} */
1654
- SearchFilterComponent.prototype.selectedItems;
1655
- /** @type {?} */
1656
- SearchFilterComponent.prototype.filteredChoices;
1657
- /** @type {?} */
1658
- SearchFilterComponent.prototype.loading;
1659
- /** @type {?} */
1660
- SearchFilterComponent.prototype.isDisabled;
1661
- /** @type {?} */
1662
- SearchFilterComponent.prototype.filterDataFromSearch;
1663
- /** @type {?} */
1664
- SearchFilterComponent.prototype.updateModel;
1665
- }
1666
-
1667
- /**
1668
- * @fileoverview added by tsickle
1669
- * Generated from: lib/search-filter/search-filter.module.ts
1670
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1671
- */
1672
- class SearchFilterModule {
1673
- }
1674
- SearchFilterModule.decorators = [
1675
- { type: NgModule, args: [{
1676
- imports: [
1677
- CommonModule,
1678
- FlyoutModule,
1679
- FormsModule,
1680
- IconModule,
1681
- ],
1682
- declarations: [
1683
- SearchFilterComponent,
1684
- ],
1685
- exports: [
1686
- SearchFilterComponent,
1687
- ],
1688
- },] }
1689
- ];
1690
-
1691
- /**
1692
- * @fileoverview added by tsickle
1693
- * Generated from: lib/search-filter/public-api.ts
1694
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1695
- */
1696
-
1697
- /**
1698
- * @fileoverview added by tsickle
1699
- * Generated from: lib/timepicker/classes/timepicker.validators.ts
1700
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1701
- */
1702
- class TimePickerValidators {
1703
- // time `hh:mm` 24h format
1704
- /**
1705
- * @param {?} time
1706
- * @return {?}
1707
- */
1708
- static minTime(time) {
1709
- /** @type {?} */
1710
- const validator = (/**
1711
- * @param {?} control
1712
- * @return {?}
1713
- */
1714
- (control) => {
1715
- /** @type {?} */
1716
- const splittedControlValue = control.value.split(':');
1717
- /** @type {?} */
1718
- const controlHours = parseInt(splittedControlValue[0], 10);
1719
- /** @type {?} */
1720
- const controlMinutes = parseInt(splittedControlValue[1], 10);
1721
- /** @type {?} */
1722
- const splittedMinTime = time.split(':');
1723
- /** @type {?} */
1724
- const minHours = parseInt(splittedMinTime[0], 10);
1725
- /** @type {?} */
1726
- const minMinutes = parseInt(splittedMinTime[1], 10);
1727
- // Don't throw error --> use Validator.required
1728
- if (isNaN(controlHours) || isNaN(controlMinutes) || isNaN(minHours) || isNaN(minMinutes)) {
1729
- return null;
1730
- }
1731
- if (minHours < controlHours) {
1732
- return null;
1733
- }
1734
- if (minHours === controlHours && minMinutes <= controlMinutes) {
1735
- return null;
1736
- }
1737
- return { minTime: { value: control.value } };
1738
- });
1739
- return validator;
1740
- }
1741
- // time `hh:mm` 24h format
1742
- /**
1743
- * @param {?} time
1744
- * @return {?}
1745
- */
1746
- static maxTime(time) {
1747
- /** @type {?} */
1748
- const validator = (/**
1749
- * @param {?} control
1750
- * @return {?}
1751
- */
1752
- (control) => {
1753
- /** @type {?} */
1754
- const splittedControlValue = control.value.split(':');
1755
- /** @type {?} */
1756
- const controlHours = parseInt(splittedControlValue[0], 10);
1757
- /** @type {?} */
1758
- const controlMinutes = parseInt(splittedControlValue[1], 10);
1759
- /** @type {?} */
1760
- const splittedMinTime = time.split(':');
1761
- /** @type {?} */
1762
- const maxHours = parseInt(splittedMinTime[0], 10);
1763
- /** @type {?} */
1764
- const maxMinutes = parseInt(splittedMinTime[1], 10);
1765
- // Don't throw error --> use Validator.required
1766
- if (isNaN(controlHours) || isNaN(controlMinutes) || isNaN(maxHours) || isNaN(maxMinutes)) {
1767
- return null;
1768
- }
1769
- if (maxHours > controlHours) {
1770
- return null;
1771
- }
1772
- if (maxHours === controlHours && maxMinutes >= controlMinutes) {
1773
- return null;
1774
- }
1775
- return { maxTime: { value: control.value } };
1776
- });
1777
- return validator;
1778
- }
1779
- }
1780
-
1781
- /**
1782
- * @fileoverview added by tsickle
1783
- * Generated from: lib/timepicker/types/timepicker.types.ts
1784
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1785
- */
1786
- /** @enum {string} */
1787
- const TimepickerInputSize = {
1788
- Auto: "auto",
1789
- Small: "small",
1790
- Large: "large",
1791
- };
1792
-
1793
- /**
1794
- * @fileoverview added by tsickle
1795
- * Generated from: lib/timepicker/components/timepicker/timepicker.component.ts
1796
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1797
- */
1798
- class TimepickerComponent {
1799
- /**
1800
- * @param {?} formBuilder
1801
- * @param {?} renderer
1802
- */
1803
- constructor(formBuilder, renderer) {
1804
- this.formBuilder = formBuilder;
1805
- this.renderer = renderer;
1806
- this.id = 'aui-timepicker-' + Math.random().toString(36).substring(2);
1807
- this.hoursPlaceholder = 'uu';
1808
- this.minutesPlaceholder = 'mm';
1809
- this.hasError = false;
1810
- this.size = TimepickerInputSize.Auto;
1811
- this.ariaLabelHours = 'Uur';
1812
- this.ariaLabelMinutes = 'Minuten';
1813
- this.shouldUseFallback = false;
1814
- this.minutes = [];
1815
- this.hours = [];
1816
- this.timeControl = new FormControl();
1817
- this.componentDestroyed$ = new Subject();
1818
- }
1819
- /**
1820
- * @return {?}
1821
- */
1822
- ngOnInit() {
1823
- this.shouldUseFallback = this.supportsNativeTimepicker();
1824
- this.minutes = this.getMinutes();
1825
- this.hours = this.getHours();
1826
- this.fallbackForm = this.formBuilder.group({
1827
- hours: null,
1828
- minutes: null,
1829
- });
1830
- this.fallbackForm.valueChanges
1831
- .pipe(takeUntil(this.componentDestroyed$))
1832
- .subscribe((/**
1833
- * @param {?} formData
1834
- * @return {?}
1835
- */
1836
- (formData) => {
1837
- if (formData.hours && formData.minutes) {
1838
- this.updateModel(`${formData.hours}:${formData.minutes}`);
1839
- }
1840
- else {
1841
- this.updateModel('');
1842
- }
1843
- }));
1844
- this.timeControl.valueChanges
1845
- .pipe(takeUntil(this.componentDestroyed$))
1846
- .subscribe((/**
1847
- * @param {?} time
1848
- * @return {?}
1849
- */
1850
- (time) => {
1851
- this.updateModel(time);
1852
- }));
1853
- }
1854
- /**
1855
- * @return {?}
1856
- */
1857
- ngOnDestroy() {
1858
- this.componentDestroyed$.next(true);
1859
- this.componentDestroyed$.complete();
1860
- }
1861
- /**
1862
- * @param {?} value
1863
- * @return {?}
1864
- */
1865
- writeValue(value) {
1866
- this.timeControl.setValue(value, { emitEvent: false });
1867
- if (value) {
1868
- /** @type {?} */
1869
- const splitted = value.split(':');
1870
- this.fallbackForm.get('hours').setValue(splitted[0], { emitEvent: false });
1871
- this.fallbackForm.get('minutes').setValue(splitted[1], { emitEvent: false });
1872
- }
1873
- }
1874
- /**
1875
- * @param {?} onChange
1876
- * @return {?}
1877
- */
1878
- registerOnChange(onChange) {
1879
- this.updateModel = onChange;
1880
- }
1881
- /**
1882
- * @return {?}
1883
- */
1884
- registerOnTouched() {
1885
- }
1886
- /**
1887
- * @param {?} isDisabled
1888
- * @return {?}
1889
- */
1890
- setDisabledState(isDisabled) {
1891
- if (isDisabled) {
1892
- this.timeControl.disable({ emitEvent: false });
1893
- this.fallbackForm.disable({ emitEvent: false });
1894
- }
1895
- else {
1896
- this.timeControl.enable({ emitEvent: false });
1897
- this.fallbackForm.enable({ emitEvent: false });
1898
- }
1899
- }
1900
- /**
1901
- * @private
1902
- * @return {?}
1903
- */
1904
- supportsNativeTimepicker() {
1905
- /** @type {?} */
1906
- const element = this.renderer.createElement('input');
1907
- element.type = 'time';
1908
- return element.type === 'text';
1909
- }
1910
- /**
1911
- * @private
1912
- * @return {?}
1913
- */
1914
- getMinutes() {
1915
- return Array(60).fill('').map((/**
1916
- * @param {?} value
1917
- * @param {?} index
1918
- * @return {?}
1919
- */
1920
- (value, index) => {
1921
- return DateHelper.addLeadingZero(index);
1922
- }));
1923
- }
1924
- /**
1925
- * @private
1926
- * @return {?}
1927
- */
1928
- getHours() {
1929
- return Array(24).fill('').map((/**
1930
- * @param {?} value
1931
- * @param {?} index
1932
- * @return {?}
1933
- */
1934
- (value, index) => {
1935
- return DateHelper.addLeadingZero(index);
1936
- }));
1937
- }
1938
- }
1939
- TimepickerComponent.decorators = [
1940
- { type: Component, args: [{
1941
- selector: 'aui-timepicker',
1942
- template: "<div class=\"m-timepicker\">\n <div *ngIf=\"!shouldUseFallback\" [class]=\"'a-input--' + size\" [ngClass]=\"{ 'has-error': hasError }\" class=\"a-input\">\n <input [attr.aria-label]=\"ariaLabelHours + ':' + ariaLabelMinutes\" [formControl]=\"timeControl\" [id]=\"id\"\n type=\"time\">\n </div>\n\n <div *ngIf=\"shouldUseFallback\" [formGroup]=\"fallbackForm\">\n <div [class]=\"'a-input--' + size\" [ngClass]=\"{ 'has-error': hasError }\" class=\"a-input has-icon-right\">\n <div class=\"a-input__wrapper\">\n <select [attr.aria-label]=\"ariaLabelHours\" [id]=\"id\" formControlName=\"hours\">\n <option disabled value=\"null\">{{ hoursPlaceholder }}</option>\n <option *ngFor=\"let hour of hours\" [value]=\"hour\">{{ hour }}</option>\n </select>\n <aui-icon name=\"ai-arrow-down-1\"></aui-icon>\n </div>\n </div>\n\n <div [class]=\"'a-input--' + size\" [ngClass]=\"{ 'has-error': hasError }\" class=\"a-input has-icon-right\">\n <div class=\"a-input__wrapper\">\n <select [attr.aria-label]=\"ariaLabelMinutes\" formControlName=\"minutes\">\n <option disabled value=\"null\">{{ minutesPlaceholder }}</option>\n <option *ngFor=\"let minute of minutes\" [value]=\"minute\">{{ minute }}</option>\n </select>\n <aui-icon name=\"ai-arrow-down-1\"></aui-icon>\n </div>\n </div>\n </div>\n</div>\n",
1943
- changeDetection: ChangeDetectionStrategy.OnPush,
1944
- providers: [{
1945
- provide: NG_VALUE_ACCESSOR,
1946
- useExisting: forwardRef((/**
1947
- * @return {?}
1948
- */
1949
- () => TimepickerComponent)),
1950
- // tslint:disable-line:no-forward-ref
1951
- multi: true,
1952
- }],
1953
- styles: [":host{display:block}"]
1954
- }] }
1955
- ];
1956
- /** @nocollapse */
1957
- TimepickerComponent.ctorParameters = () => [
1958
- { type: FormBuilder },
1959
- { type: Renderer2 }
1960
- ];
1961
- TimepickerComponent.propDecorators = {
1962
- id: [{ type: Input }],
1963
- hoursPlaceholder: [{ type: Input }],
1964
- minutesPlaceholder: [{ type: Input }],
1965
- hasError: [{ type: Input }],
1966
- size: [{ type: Input }],
1967
- ariaLabelHours: [{ type: Input }],
1968
- ariaLabelMinutes: [{ type: Input }]
1969
- };
1970
- if (false) {
1971
- /** @type {?} */
1972
- TimepickerComponent.prototype.id;
1973
- /** @type {?} */
1974
- TimepickerComponent.prototype.hoursPlaceholder;
1975
- /** @type {?} */
1976
- TimepickerComponent.prototype.minutesPlaceholder;
1977
- /** @type {?} */
1978
- TimepickerComponent.prototype.hasError;
1979
- /** @type {?} */
1980
- TimepickerComponent.prototype.size;
1981
- /** @type {?} */
1982
- TimepickerComponent.prototype.ariaLabelHours;
1983
- /** @type {?} */
1984
- TimepickerComponent.prototype.ariaLabelMinutes;
1985
- /** @type {?} */
1986
- TimepickerComponent.prototype.shouldUseFallback;
1987
- /** @type {?} */
1988
- TimepickerComponent.prototype.minutes;
1989
- /** @type {?} */
1990
- TimepickerComponent.prototype.hours;
1991
- /** @type {?} */
1992
- TimepickerComponent.prototype.updateModel;
1993
- /** @type {?} */
1994
- TimepickerComponent.prototype.timeControl;
1995
- /** @type {?} */
1996
- TimepickerComponent.prototype.fallbackForm;
1997
- /**
1998
- * @type {?}
1999
- * @private
2000
- */
2001
- TimepickerComponent.prototype.componentDestroyed$;
2002
- /**
2003
- * @type {?}
2004
- * @private
2005
- */
2006
- TimepickerComponent.prototype.formBuilder;
2007
- /**
2008
- * @type {?}
2009
- * @private
2010
- */
2011
- TimepickerComponent.prototype.renderer;
2012
- }
2013
-
2014
- /**
2015
- * @fileoverview added by tsickle
2016
- * Generated from: lib/timepicker/timepicker.module.ts
2017
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2018
- */
2019
- class TimepickerModule {
2020
- }
2021
- TimepickerModule.decorators = [
2022
- { type: NgModule, args: [{
2023
- imports: [
2024
- ReactiveFormsModule,
2025
- CommonModule,
2026
- IconModule,
2027
- ],
2028
- declarations: [
2029
- TimepickerComponent,
2030
- ],
2031
- exports: [
2032
- TimepickerComponent,
2033
- ],
2034
- providers: [],
2035
- },] }
2036
- ];
2037
-
2038
- /**
2039
- * @fileoverview added by tsickle
2040
- * Generated from: lib/timepicker/public-api.ts
2041
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2042
- */
2043
-
2044
- /**
2045
- * @fileoverview added by tsickle
2046
- * Generated from: lib/upload/upload.conf.ts
2047
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2048
- */
2049
- /** @type {?} */
2050
- const UPLOAD_OPTIONS_DEFAULT = {
2051
- allowedMimeTypes: [],
2052
- allowedFileTypes: [],
2053
- autoUpload: false,
2054
- maxFileSize: 0,
2055
- // 0 is infinite
2056
- queueLimit: 0,
2057
- // 0 is infinite
2058
- type: 'drop',
2059
- url: '',
2060
- };
2061
- /** @type {?} */
2062
- const UPLOAD_VALIDATION_MESSAGES = new InjectionToken('uploadValidationMessages');
2063
-
2064
- /**
2065
- * @fileoverview added by tsickle
2066
- * Generated from: lib/upload/classes/uploader.class.ts
2067
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2068
- */
2069
- class Uploader {
2070
- /**
2071
- * @param {?=} options
2072
- */
2073
- constructor(options) {
2074
- this.options = UPLOAD_OPTIONS_DEFAULT;
2075
- this.setOptions(options);
2076
- }
2077
- /**
2078
- * @param {?} options
2079
- * @return {?}
2080
- */
2081
- setOptions(options) {
2082
- this.options = Object.assign({}, this.options, options);
2083
- }
2084
- /**
2085
- * @param {?} files
2086
- * @return {?}
2087
- */
2088
- uploadFiles(files) {
2089
- /** @type {?} */
2090
- const formData = this.filesToFormData(files);
2091
- return new Observable((/**
2092
- * @param {?} observer
2093
- * @return {?}
2094
- */
2095
- observer => {
2096
- /** @type {?} */
2097
- const xhr = new XMLHttpRequest();
2098
- // Progress callback
2099
- xhr.upload.addEventListener('progress', (/**
2100
- * @param {?} e
2101
- * @return {?}
2102
- */
2103
- (e) => {
2104
- if (e.lengthComputable) {
2105
- /** @type {?} */
2106
- const percentComplete = e.loaded / e.total;
2107
- observer.next({
2108
- progress: percentComplete,
2109
- data: null,
2110
- });
2111
- }
2112
- }));
2113
- // Complete callback
2114
- xhr.onload = (/**
2115
- * @return {?}
2116
- */
2117
- () => {
2118
- observer.next({
2119
- progress: 1,
2120
- data: xhr.response,
2121
- });
2122
- // observer.complete();
2123
- });
2124
- // Do request
2125
- xhr.responseType = 'json';
2126
- xhr.open('post', this.options.url);
2127
- xhr.send(formData);
2128
- }));
2129
- }
2130
- /**
2131
- * @param {?} files
2132
- * @return {?}
2133
- */
2134
- validateFiles(files) {
2135
- /** @type {?} */
2136
- const validFiles = [];
2137
- /** @type {?} */
2138
- const invalidFiles = [];
2139
- if (files.length > 0) {
2140
- for (const file of files) {
2141
- /** @type {?} */
2142
- const errors = [];
2143
- if (!this.validateFileType(file)) {
2144
- errors.push('INVALID_FILE_TYPE');
2145
- }
2146
- if (!this.validateFileSize(file)) {
2147
- errors.push('INVALID_FILE_SIZE');
2148
- }
2149
- if (!this.validateMimeType(file)) {
2150
- errors.push('INVALID_MIME_TYPE');
2151
- }
2152
- if (errors.length === 0) {
2153
- validFiles.push(file);
2154
- }
2155
- else {
2156
- invalidFiles.push({
2157
- reasons: errors,
2158
- file,
2159
- });
2160
- }
2161
- }
2162
- }
2163
- return {
2164
- validFiles,
2165
- invalidFiles,
2166
- };
2167
- }
2168
- /**
2169
- * @protected
2170
- * @param {?} files
2171
- * @return {?}
2172
- */
2173
- filesToFormData(files) {
2174
- /** @type {?} */
2175
- const formData = new FormData();
2176
- if (!this.options.url || this.options.url === '') {
2177
- throw new Error('Define the upload url.');
2178
- }
2179
- for (const file of files) {
2180
- formData.append('file', file);
2181
- }
2182
- return formData;
2183
- }
2184
- /**
2185
- * @protected
2186
- * @param {?} file
2187
- * @return {?}
2188
- */
2189
- getFileExtension(file) {
2190
- return file.name.split('.')[file.name.split('.').length - 1];
2191
- }
2192
- /**
2193
- * @protected
2194
- * @param {?} file
2195
- * @return {?}
2196
- */
2197
- validateFileType(file) {
2198
- /** @type {?} */
2199
- const allowedFileTypes = this.options.allowedFileTypes;
2200
- /** @type {?} */
2201
- const ext = this.getFileExtension(file);
2202
- // Filter defined?
2203
- if (!Array.isArray(allowedFileTypes) || allowedFileTypes.length === 0) {
2204
- return true;
2205
- }
2206
- // Make allowedFileTypes case insensitive
2207
- /** @type {?} */
2208
- const toUpper = (/**
2209
- * @param {?} x
2210
- * @return {?}
2211
- */
2212
- (x) => x.toUpperCase());
2213
- /** @type {?} */
2214
- const allowedFileTypesToUpper = allowedFileTypes.map(toUpper);
2215
- return allowedFileTypesToUpper.lastIndexOf(ext.toUpperCase()) !== -1;
2216
- }
2217
- /**
2218
- * @protected
2219
- * @param {?} file
2220
- * @return {?}
2221
- */
2222
- validateFileSize(file) {
2223
- /** @type {?} */
2224
- const maxFileSize = this.options.maxFileSize;
2225
- // Filter defined?
2226
- if (!maxFileSize || maxFileSize === 0) {
2227
- return true;
2228
- }
2229
- return maxFileSize > file.size;
2230
- }
2231
- /**
2232
- * @protected
2233
- * @param {?} file
2234
- * @return {?}
2235
- */
2236
- validateMimeType(file) {
2237
- /** @type {?} */
2238
- const allowedMimeTypes = this.options.allowedMimeTypes;
2239
- // Filter defined?
2240
- if (!Array.isArray(allowedMimeTypes) || allowedMimeTypes.length === 0) {
2241
- return true;
2242
- }
2243
- return allowedMimeTypes.lastIndexOf(file.type) !== -1;
2244
- }
2245
- }
2246
- if (false) {
2247
- /** @type {?} */
2248
- Uploader.prototype.options;
2249
- }
2250
-
2251
- /**
2252
- * @fileoverview added by tsickle
2253
- * Generated from: lib/upload/components/upload/upload.component.ts
2254
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2255
- */
2256
- class UploadComponent {
2257
- constructor() {
2258
- this.id = '';
2259
- this.accept = [];
2260
- this.capture = '';
2261
- this.ariaLabelRemove = 'Verwijder';
2262
- this.disabled = false;
2263
- this.multiple = true;
2264
- this.options = UPLOAD_OPTIONS_DEFAULT;
2265
- this.selectUploadedFiles = new EventEmitter();
2266
- this.uploadedFiles = [];
2267
- this.invalidFiles = [];
2268
- this.queuedFiles = [];
2269
- }
2270
- /**
2271
- * @return {?}
2272
- */
2273
- ngOnInit() {
2274
- if (!this.id) {
2275
- this.ariaId = 'aui-upload-' + Math.random().toString(36).substring(2);
2276
- }
2277
- this.uploader = new Uploader(this.options);
2278
- }
2279
- /**
2280
- * @param {?} files
2281
- * @return {?}
2282
- */
2283
- onUploadedFiles(files) {
2284
- this.uploadedFiles = this.uploadedFiles.concat(files);
2285
- this.selectUploadedFiles.emit(this.uploadedFiles);
2286
- }
2287
- /**
2288
- * @param {?} files
2289
- * @return {?}
2290
- */
2291
- onInvalidFiles(files) {
2292
- this.invalidFiles = files;
2293
- }
2294
- /**
2295
- * @param {?} files
2296
- * @return {?}
2297
- */
2298
- onQueuedFiles(files) {
2299
- this.queuedFiles = this.queuedFiles.concat(files);
2300
- }
2301
- }
2302
- UploadComponent.decorators = [
2303
- { type: Component, args: [{
2304
- selector: 'aui-upload',
2305
- template: "<div class=\"m-upload aui-upload\">\n <aui-upload-zone\n [id]=\"id\"\n [accept]=\"accept\"\n [capture]=\"capture\"\n [ariaId]=\"ariaId\"\n [disabled]=\"disabled\"\n [multiple]=\"multiple\"\n [uploader]=\"uploader\"\n (invalidFiles)=\"onInvalidFiles($event)\"\n (queuedFiles)=\"onQueuedFiles($event)\"\n (uploadedFiles)=\"onUploadedFiles($event)\">\n <div class=\"m-upload__message\">\n <ng-content select=\".m-upload__message\"></ng-content>\n </div>\n <div class=\"m-upload__description\">\n <ng-content select=\".m-upload__description\"></ng-content>\n </div>\n <div class=\"m-upload__button\">\n <ng-content select=\".m-upload__button\"></ng-content>\n </div>\n </aui-upload-zone>\n <aui-validation-list [ariaLabelRemove]=\"ariaLabelRemove\" [invalidFiles]=\"invalidFiles\"></aui-validation-list>\n <aui-upload-queue (uploadedFiles)=\"onUploadedFiles($event)\" *ngIf=\"!options?.autoUpload\" [ariaLabelRemove]=\"ariaLabelRemove\"\n [files]=\"queuedFiles\" [uploader]=\"uploader\"></aui-upload-queue>\n</div>\n",
2306
- styles: [".m-upload__button>.m-upload__input{display:none}"]
2307
- }] }
2308
- ];
2309
- UploadComponent.propDecorators = {
2310
- id: [{ type: Input }],
2311
- accept: [{ type: Input }],
2312
- capture: [{ type: Input }],
2313
- ariaLabelRemove: [{ type: Input }],
2314
- disabled: [{ type: Input }],
2315
- multiple: [{ type: Input }],
2316
- options: [{ type: Input }],
2317
- selectUploadedFiles: [{ type: Output }]
2318
- };
2319
- if (false) {
2320
- /** @type {?} */
2321
- UploadComponent.prototype.id;
2322
- /** @type {?} */
2323
- UploadComponent.prototype.accept;
2324
- /** @type {?} */
2325
- UploadComponent.prototype.capture;
2326
- /** @type {?} */
2327
- UploadComponent.prototype.ariaLabelRemove;
2328
- /** @type {?} */
2329
- UploadComponent.prototype.disabled;
2330
- /** @type {?} */
2331
- UploadComponent.prototype.multiple;
2332
- /** @type {?} */
2333
- UploadComponent.prototype.options;
2334
- /** @type {?} */
2335
- UploadComponent.prototype.selectUploadedFiles;
2336
- /** @type {?} */
2337
- UploadComponent.prototype.uploader;
2338
- /** @type {?} */
2339
- UploadComponent.prototype.ariaId;
2340
- /** @type {?} */
2341
- UploadComponent.prototype.uploadedFiles;
2342
- /** @type {?} */
2343
- UploadComponent.prototype.invalidFiles;
2344
- /** @type {?} */
2345
- UploadComponent.prototype.queuedFiles;
2346
- }
2347
-
2348
- /**
2349
- * @fileoverview added by tsickle
2350
- * Generated from: lib/upload/components/upload-input/upload-input.component.ts
2351
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2352
- */
2353
- class UploadInputComponent {
2354
- constructor() {
2355
- this.propagateChange = (/**
2356
- * @param {?} _
2357
- * @return {?}
2358
- */
2359
- (_) => undefined);
2360
- }
2361
- /**
2362
- * @param {?} value
2363
- * @return {?}
2364
- */
2365
- writeValue(value) {
2366
- }
2367
- /**
2368
- * @param {?} fn
2369
- * @return {?}
2370
- */
2371
- registerOnChange(fn) {
2372
- this.propagateChange = fn;
2373
- }
2374
- /**
2375
- * @return {?}
2376
- */
2377
- registerOnTouched() {
2378
- }
2379
- /**
2380
- * @param {?} files
2381
- * @return {?}
2382
- */
2383
- onUpload(files) {
2384
- /** @type {?} */
2385
- const data = (this.format ? this.format(files) : files);
2386
- this.propagateChange(data);
2387
- }
2388
- }
2389
- UploadInputComponent.decorators = [
2390
- { type: Component, args: [{
2391
- selector: 'aui-upload-input',
2392
- template: "<aui-upload (selectUploadedFiles)=\"onUpload($event)\" [options]=\"options\">\n <div class=\"m-upload__message\">\n <ng-content select=\".m-upload__message\"></ng-content>\n </div>\n <div class=\"m-upload__description\">\n <ng-content select=\".m-upload__description\"></ng-content>\n </div>\n <div class=\"m-upload__button\">\n <ng-content select=\".m-upload__button\"></ng-content>\n </div>\n</aui-upload>\n",
2393
- providers: [{
2394
- provide: NG_VALUE_ACCESSOR,
2395
- useExisting: UploadInputComponent,
2396
- multi: true,
2397
- }]
2398
- }] }
2399
- ];
2400
- UploadInputComponent.propDecorators = {
2401
- options: [{ type: Input }],
2402
- format: [{ type: Input }]
2403
- };
2404
- if (false) {
2405
- /** @type {?} */
2406
- UploadInputComponent.prototype.options;
2407
- /** @type {?} */
2408
- UploadInputComponent.prototype.format;
2409
- /** @type {?} */
2410
- UploadInputComponent.prototype.propagateChange;
2411
- }
2412
-
2413
- /**
2414
- * @fileoverview added by tsickle
2415
- * Generated from: lib/upload/components/upload-queue/upload-queue.component.ts
2416
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2417
- */
2418
- class UploadQueueComponent {
2419
- constructor() {
2420
- this.ariaLabelRemove = 'Verwijder';
2421
- this.uploadedFiles = new EventEmitter();
2422
- this.uploadProgress = 0;
2423
- }
2424
- /**
2425
- * @param {?} index
2426
- * @return {?}
2427
- */
2428
- remove(index) {
2429
- this.files.splice(index, 1);
2430
- }
2431
- /**
2432
- * @return {?}
2433
- */
2434
- uploadFiles() {
2435
- /** @type {?} */
2436
- const progress = undefined;
2437
- /** @type {?} */
2438
- const data = undefined;
2439
- this.uploader.uploadFiles(this.files).subscribe((/**
2440
- * @param {?} response
2441
- * @return {?}
2442
- */
2443
- (response) => {
2444
- if (response.progress) {
2445
- this.uploadProgress = Math.floor(response.progress * 100);
2446
- }
2447
- if (response.data) {
2448
- this.uploadedFiles.emit(response.data);
2449
- this.files = [];
2450
- }
2451
- }));
2452
- }
2453
- }
2454
- UploadQueueComponent.decorators = [
2455
- { type: Component, args: [{
2456
- selector: 'aui-upload-queue',
2457
- template: "<ul class=\"m-upload__files u-margin-bottom-xs\">\n <li *ngFor=\"let file of files; let i = index\">\n <aui-icon name=\"ai-common-file-empty\"></aui-icon>\n <span class=\"m-upload__filename\">{{ file.name }}</span>\n\n <button (click)=\"remove(i)\" class=\"m-upload__delete a-button-transparent a-button--default a-button--small has-icon\" type=\"button\">\n <aui-icon name=\"ai-close\" [ariaLabel]=\"ariaLabelRemove\"></aui-icon>\n </button>\n </li>\n</ul>\n\n<button (click)=\"uploadFiles()\" *ngIf=\"files.length > 0\" class=\"a-button\" type=\"button\">Upload</button>\n"
2458
- }] }
2459
- ];
2460
- UploadQueueComponent.propDecorators = {
2461
- files: [{ type: Input }],
2462
- uploader: [{ type: Input }],
2463
- ariaLabelRemove: [{ type: Input }],
2464
- uploadedFiles: [{ type: Output }]
2465
- };
2466
- if (false) {
2467
- /** @type {?} */
2468
- UploadQueueComponent.prototype.files;
2469
- /** @type {?} */
2470
- UploadQueueComponent.prototype.uploader;
2471
- /** @type {?} */
2472
- UploadQueueComponent.prototype.ariaLabelRemove;
2473
- /** @type {?} */
2474
- UploadQueueComponent.prototype.uploadedFiles;
2475
- /** @type {?} */
2476
- UploadQueueComponent.prototype.uploadProgress;
2477
- }
2478
-
2479
- /**
2480
- * @fileoverview added by tsickle
2481
- * Generated from: lib/upload/components/upload-zone/upload-zone.component.ts
2482
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2483
- */
2484
- class UploadZoneComponent {
2485
- /**
2486
- * @param {?} renderer
2487
- */
2488
- constructor(renderer) {
2489
- this.renderer = renderer;
2490
- this.id = '';
2491
- this.accept = [];
2492
- this.capture = '';
2493
- this.ariaId = '';
2494
- this.disabled = false;
2495
- this.multiple = true;
2496
- this.uploadedFiles = new EventEmitter();
2497
- this.queuedFiles = new EventEmitter();
2498
- this.invalidFiles = new EventEmitter();
2499
- this.hasDragOver = false;
2500
- this.uploadProgress = 0;
2501
- }
2502
- /**
2503
- * @param {?} event
2504
- * @return {?}
2505
- */
2506
- onDragOver(event) {
2507
- this.preventAndStop(event);
2508
- this.hasDragOver = true;
2509
- }
2510
- /**
2511
- * @param {?} event
2512
- * @return {?}
2513
- */
2514
- onDragLeave(event) {
2515
- this.preventAndStop(event);
2516
- this.hasDragOver = false;
2517
- }
2518
- /**
2519
- * @param {?} event
2520
- * @return {?}
2521
- */
2522
- onDrop(event) {
2523
- this.preventAndStop(event);
2524
- this.hasDragOver = false;
2525
- /** @type {?} */
2526
- const files = this.fileListToArray(event.dataTransfer.files);
2527
- this.handleFiles(files);
2528
- }
2529
- /**
2530
- * @return {?}
2531
- */
2532
- triggerFile() {
2533
- this.fileInput.nativeElement.click();
2534
- }
2535
- /**
2536
- * @return {?}
2537
- */
2538
- updateFiles() {
2539
- /** @type {?} */
2540
- const files = this.fileListToArray(this.fileInput.nativeElement.files);
2541
- this.handleFiles(files);
2542
- }
2543
- /**
2544
- * @param {?} event
2545
- * @return {?}
2546
- */
2547
- onFileClick(event) {
2548
- // When removing a file make sure you can add it again later
2549
- // See: https://stackoverflow.com/questions/59870335/ng2-file-upload-not-allowing-me-to-add-same-doc-after-ive-removed-it-from-que
2550
- event.target.value = '';
2551
- }
2552
- /**
2553
- * @return {?}
2554
- */
2555
- ngAfterViewInit() {
2556
- if (this.multiple !== false) {
2557
- this.renderer.setProperty(this.fileInput.nativeElement, 'multiple', 'multiple');
2558
- }
2559
- if (!!this.accept.length) {
2560
- this.renderer.setProperty(this.fileInput.nativeElement, 'accept', this.accept.join());
2561
- }
2562
- if (this.disabled) {
2563
- this.renderer.setProperty(this.fileInput.nativeElement, 'disabled', 'disabled');
2564
- }
2565
- if (this.capture !== '') {
2566
- this.renderer.setAttribute(this.fileInput.nativeElement, 'capture', this.capture);
2567
- }
2568
- }
2569
- /**
2570
- * @protected
2571
- * @param {?} files
2572
- * @return {?}
2573
- */
2574
- handleFiles(files) {
2575
- /** @type {?} */
2576
- const response = this.uploader.validateFiles(files);
2577
- this.invalidFiles.emit(response.invalidFiles);
2578
- if (this.uploader.options.autoUpload && response.validFiles.length > 0) {
2579
- this.uploadFiles(response.validFiles);
2580
- }
2581
- else {
2582
- this.queuedFiles.emit(response.validFiles);
2583
- }
2584
- }
2585
- /**
2586
- * @protected
2587
- * @param {?} files
2588
- * @return {?}
2589
- */
2590
- uploadFiles(files) {
2591
- // Reset progress
2592
- this.uploadProgress = 0;
2593
- this.uploadingFiles = files;
2594
- // upload
2595
- this.uploader.uploadFiles(files).subscribe((/**
2596
- * @param {?} response
2597
- * @return {?}
2598
- */
2599
- (response) => {
2600
- if (response.progress) {
2601
- this.uploadProgress = Math.floor(response.progress * 100);
2602
- }
2603
- if (response.data) {
2604
- this.uploadedFiles.emit(response.data);
2605
- }
2606
- }), (/**
2607
- * @param {?} err
2608
- * @return {?}
2609
- */
2610
- (err) => {
2611
- console.log(err);
2612
- }));
2613
- }
2614
- /**
2615
- * @protected
2616
- * @param {?} list
2617
- * @return {?}
2618
- */
2619
- fileListToArray(list) {
2620
- return Array.from(list);
2621
- }
2622
- /**
2623
- * @protected
2624
- * @param {?} event
2625
- * @return {?}
2626
- */
2627
- preventAndStop(event) {
2628
- event.preventDefault();
2629
- event.stopPropagation();
2630
- }
2631
- }
2632
- UploadZoneComponent.decorators = [
2633
- { type: Component, args: [{
2634
- selector: 'aui-upload-zone',
2635
- template: "<div *ngIf=\"uploader.options.type === 'drop'\" [class.is-disabled]=\"disabled\" class=\"m-upload\">\n <div class=\"m-upload__inner\">\n <div class=\"m-upload__dropzone\">\n <input\n #fileInput\n type=\"file\"\n class=\"m-upload__input\"\n [id]=\"id\"\n [attr.aria-labelledby]=\"ariaId\"\n (click)=\"onFileClick($event)\"\n (change)=\"updateFiles()\">\n\n <div *ngIf=\"!uploadProgress || uploadProgress === 0\" class=\"m-upload__content\">\n <p [id]=\"ariaId\" class=\"m-upload__message\">\n <ng-content select=\".m-upload__message\"></ng-content>\n </p>\n </div>\n\n <ng-container *ngIf=\"uploadProgress > 0\">\n <p class=\"m-upload__uploads u-text-bold u-margin-bottom-xs\">\n <ng-container *ngFor=\"let file of uploadingFiles; let last = last\">\n {{ file.name }}\n <ng-container *ngIf=\"!last\">,</ng-container>\n </ng-container>\n </p>\n <aui-progress-bar [value]=\"uploadProgress\" max=\"100\"></aui-progress-bar>\n </ng-container>\n </div>\n </div>\n\n <small class=\"m-upload__description\">\n <ng-content select=\".m-upload__description\"></ng-content>\n </small>\n</div>\n\n<button (click)=\"triggerFile()\" *ngIf=\"uploader.options.type === 'button'\" [disabled]=\"disabled\" class=\"a-button m-upload__button\"\n type=\"button\">\n <span [id]=\"ariaId\"><ng-content select=\".m-upload__button\"></ng-content></span>\n <input\n #fileInput\n type=\"file\"\n class=\"m-upload__input\"\n [id]=\"id\"\n [attr.aria-labelledby]=\"ariaId\"\n (click)=\"onFileClick($event)\"\n (change)=\"updateFiles()\">\n</button>\n"
2636
- }] }
2637
- ];
2638
- /** @nocollapse */
2639
- UploadZoneComponent.ctorParameters = () => [
2640
- { type: Renderer2 }
2641
- ];
2642
- UploadZoneComponent.propDecorators = {
2643
- fileInput: [{ type: ViewChild, args: ['fileInput', { static: false },] }],
2644
- uploader: [{ type: Input }],
2645
- id: [{ type: Input }],
2646
- accept: [{ type: Input }],
2647
- capture: [{ type: Input }],
2648
- ariaId: [{ type: Input }],
2649
- disabled: [{ type: Input }],
2650
- multiple: [{ type: Input }],
2651
- uploadedFiles: [{ type: Output }],
2652
- queuedFiles: [{ type: Output }],
2653
- invalidFiles: [{ type: Output }],
2654
- onDragOver: [{ type: HostListener, args: ['dragover', ['$event'],] }],
2655
- onDragLeave: [{ type: HostListener, args: ['dragleave', ['$event'],] }],
2656
- onDrop: [{ type: HostListener, args: ['drop', ['$event'],] }]
2657
- };
2658
- if (false) {
2659
- /** @type {?} */
2660
- UploadZoneComponent.prototype.fileInput;
2661
- /** @type {?} */
2662
- UploadZoneComponent.prototype.uploader;
2663
- /** @type {?} */
2664
- UploadZoneComponent.prototype.id;
2665
- /** @type {?} */
2666
- UploadZoneComponent.prototype.accept;
2667
- /** @type {?} */
2668
- UploadZoneComponent.prototype.capture;
2669
- /** @type {?} */
2670
- UploadZoneComponent.prototype.ariaId;
2671
- /** @type {?} */
2672
- UploadZoneComponent.prototype.disabled;
2673
- /** @type {?} */
2674
- UploadZoneComponent.prototype.multiple;
2675
- /** @type {?} */
2676
- UploadZoneComponent.prototype.uploadedFiles;
2677
- /** @type {?} */
2678
- UploadZoneComponent.prototype.queuedFiles;
2679
- /** @type {?} */
2680
- UploadZoneComponent.prototype.invalidFiles;
2681
- /** @type {?} */
2682
- UploadZoneComponent.prototype.hasDragOver;
2683
- /** @type {?} */
2684
- UploadZoneComponent.prototype.classNames;
2685
- /** @type {?} */
2686
- UploadZoneComponent.prototype.uploadProgress;
2687
- /** @type {?} */
2688
- UploadZoneComponent.prototype.uploadingFiles;
2689
- /**
2690
- * @type {?}
2691
- * @private
2692
- */
2693
- UploadZoneComponent.prototype.renderer;
2694
- }
2695
-
2696
- /**
2697
- * @fileoverview added by tsickle
2698
- * Generated from: lib/upload/services/validation-messages.service.ts
2699
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2700
- */
2701
- class ValidationMessagesService {
2702
- /**
2703
- * @param {?} initValues
2704
- */
2705
- constructor(initValues) {
2706
- this.initValues = initValues;
2707
- this.INVALID_FILE_TYPE = 'INVALID_FILE_TYPE';
2708
- this.INVALID_FILE_SIZE = 'INVALID_FILE_SIZE';
2709
- this.INVALID_MIME_TYPE = 'INVALID_MIME_TYPE';
2710
- if (initValues.INVALID_FILE_TYPE) {
2711
- this.INVALID_FILE_TYPE = initValues.INVALID_FILE_TYPE;
2712
- }
2713
- if (initValues.INVALID_FILE_SIZE) {
2714
- this.INVALID_FILE_SIZE = initValues.INVALID_FILE_SIZE;
2715
- }
2716
- if (initValues.INVALID_MIME_TYPE) {
2717
- this.INVALID_MIME_TYPE = initValues.INVALID_MIME_TYPE;
2718
- }
2719
- }
2720
- }
2721
- ValidationMessagesService.decorators = [
2722
- { type: Injectable }
2723
- ];
2724
- /** @nocollapse */
2725
- ValidationMessagesService.ctorParameters = () => [
2726
- { type: undefined, decorators: [{ type: Inject, args: [UPLOAD_VALIDATION_MESSAGES,] }] }
2727
- ];
2728
- if (false) {
2729
- /** @type {?} */
2730
- ValidationMessagesService.prototype.INVALID_FILE_TYPE;
2731
- /** @type {?} */
2732
- ValidationMessagesService.prototype.INVALID_FILE_SIZE;
2733
- /** @type {?} */
2734
- ValidationMessagesService.prototype.INVALID_MIME_TYPE;
2735
- /**
2736
- * @type {?}
2737
- * @private
2738
- */
2739
- ValidationMessagesService.prototype.initValues;
2740
- }
2741
-
2742
- /**
2743
- * @fileoverview added by tsickle
2744
- * Generated from: lib/upload/components/validation-list/validation-list.component.ts
2745
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2746
- */
2747
- class ValidationListComponent {
2748
- /**
2749
- * @param {?} messagesService
2750
- */
2751
- constructor(messagesService) {
2752
- this.messagesService = messagesService;
2753
- this.invalidFiles = [];
2754
- this.ariaLabelRemove = 'Verwijder';
2755
- }
2756
- /**
2757
- * @param {?} index
2758
- * @return {?}
2759
- */
2760
- remove(index) {
2761
- this.invalidFiles.splice(index, 1);
2762
- }
2763
- /**
2764
- * @param {?} reasons
2765
- * @return {?}
2766
- */
2767
- formatReasons(reasons) {
2768
- /** @type {?} */
2769
- const result = [];
2770
- for (const reason of reasons) {
2771
- result.push(this.messagesService[reason]);
2772
- }
2773
- return result.join(', ');
2774
- }
2775
- }
2776
- ValidationListComponent.decorators = [
2777
- { type: Component, args: [{
2778
- selector: 'aui-validation-list',
2779
- template: "<ul class=\"m-upload__files\">\n <li *ngFor=\"let invalidFile of invalidFiles; let i = index\" class=\"is-error\">\n <aui-icon name=\"ai-alert-triangle\"></aui-icon>\n <span class=\"m-upload__filename\">{{ invalidFile.file.name }}</span>\n <span class=\"m-upload__error\">{{ formatReasons(invalidFile.reasons) }}</span>\n\n <button (click)=\"remove(i)\" class=\"m-upload__delete a-button-transparent a-button--danger a-button--small has-icon\"\n type=\"button\">\n <aui-icon name=\"ai-close\" [ariaLabel]=\"ariaLabelRemove\"></aui-icon>\n </button>\n </li>\n</ul>\n"
2780
- }] }
2781
- ];
2782
- /** @nocollapse */
2783
- ValidationListComponent.ctorParameters = () => [
2784
- { type: ValidationMessagesService }
2785
- ];
2786
- ValidationListComponent.propDecorators = {
2787
- invalidFiles: [{ type: Input }],
2788
- ariaLabelRemove: [{ type: Input }]
2789
- };
2790
- if (false) {
2791
- /** @type {?} */
2792
- ValidationListComponent.prototype.invalidFiles;
2793
- /** @type {?} */
2794
- ValidationListComponent.prototype.ariaLabelRemove;
2795
- /**
2796
- * @type {?}
2797
- * @private
2798
- */
2799
- ValidationListComponent.prototype.messagesService;
2800
- }
2801
-
2802
- /**
2803
- * @fileoverview added by tsickle
2804
- * Generated from: lib/upload/upload.module.ts
2805
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2806
- */
2807
- const ɵ0$1 = {};
2808
- class UploadModule {
2809
- /**
2810
- * @param {?=} validationMessages
2811
- * @return {?}
2812
- */
2813
- static forChild(validationMessages = {}) {
2814
- return {
2815
- ngModule: UploadModule,
2816
- providers: [
2817
- { provide: UPLOAD_VALIDATION_MESSAGES, useValue: validationMessages },
2818
- ],
2819
- };
2820
- }
2821
- }
2822
- UploadModule.decorators = [
2823
- { type: NgModule, args: [{
2824
- imports: [
2825
- CommonModule,
2826
- ProgressBarModule,
2827
- FormsModule,
2828
- IconModule,
2829
- ],
2830
- declarations: [
2831
- UploadComponent,
2832
- UploadInputComponent,
2833
- UploadQueueComponent,
2834
- UploadZoneComponent,
2835
- ValidationListComponent,
2836
- ],
2837
- exports: [
2838
- UploadComponent,
2839
- UploadInputComponent,
2840
- UploadQueueComponent,
2841
- UploadZoneComponent,
2842
- ValidationListComponent,
2843
- ],
2844
- providers: [
2845
- ValidationMessagesService,
2846
- { provide: UPLOAD_VALIDATION_MESSAGES, useValue: ɵ0$1 },
2847
- ],
2848
- },] }
2849
- ];
2850
-
2851
- /**
2852
- * @fileoverview added by tsickle
2853
- * Generated from: lib/upload/public-api.ts
2854
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2855
- */
2856
-
2857
- /**
2858
- * @fileoverview added by tsickle
2859
- * Generated from: lib/wysiwyg/wysiwyg.conf.ts
2860
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2861
- */
2862
- /** @type {?} */
2863
- const WYSIWYG_DEFAULT_CONFIG = {
2864
- bodyClass: 'a-input ckeditor-editable-body',
2865
- contentsCss: ['https://cdn.antwerpen.be/core_branding_scss/5.0.0/main.min.css'],
2866
- extraPlugins: 'divarea',
2867
- find_highlight: {
2868
- element: 'span',
2869
- styles: { 'background-color': '#fffc00', color: '#0064b4' },
2870
- },
2871
- format_tags: 'p;h1;h2;h3;h4;h5;h6',
2872
- toolbar_Basic: [
2873
- ['Bold', 'Italic', 'Underline', '-', 'Format', '-', 'Source'],
2874
- ],
2875
- removeButtons: 'Styles',
2876
- removePlugins: 'about',
2877
- toolbar: null,
2878
- uiColor: '#d8d8d8',
2879
- };
2880
-
2881
- /**
2882
- * @fileoverview added by tsickle
2883
- * Generated from: lib/wysiwyg/components/wysiwyg/wysiwyg.component.ts
2884
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2885
- */
2886
- class WysiwygComponent {
2887
- constructor() {
2888
- this.setClass = true;
2889
- this.basic = false;
2890
- this.emitContent = new EventEmitter();
2891
- this.focus = new EventEmitter();
2892
- this.blur = new EventEmitter();
2893
- this.ckeditorConfig = WYSIWYG_DEFAULT_CONFIG;
2894
- this.isDisabled = false;
2895
- this.updateModel = (/**
2896
- * @param {...?} args
2897
- * @return {?}
2898
- */
2899
- (...args) => undefined);
2900
- }
2901
- // NG_VALUE_ACCESSOR_INTERFACE
2902
- /**
2903
- * @param {?} value
2904
- * @return {?}
2905
- */
2906
- writeValue(value) {
2907
- this.ckeditorContent = value;
2908
- this.updateModel(value);
2909
- this.emitContent.emit(this.ckeditorContent);
2910
- }
2911
- /**
2912
- * @param {?} value
2913
- * @return {?}
2914
- */
2915
- onFocus(value) {
2916
- this.focus.emit(value);
2917
- }
2918
- /**
2919
- * @param {?} value
2920
- * @return {?}
2921
- */
2922
- onBlur(value) {
2923
- this.blur.emit(value);
2924
- }
2925
- /**
2926
- * @param {?} onChange
2927
- * @return {?}
2928
- */
2929
- registerOnChange(onChange) {
2930
- this.updateModel = onChange;
2931
- }
2932
- /**
2933
- * @return {?}
2934
- */
2935
- registerOnTouched() {
2936
- }
2937
- /**
2938
- * @param {?} isDisabled
2939
- * @return {?}
2940
- */
2941
- setDisabledState(isDisabled) {
2942
- this.isDisabled = isDisabled;
2943
- }
2944
- /**
2945
- * @return {?}
2946
- */
2947
- ngOnInit() {
2948
- this.setConfig();
2949
- }
2950
- /**
2951
- * @private
2952
- * @return {?}
2953
- */
2954
- setConfig() {
2955
- if (this.customConfig) {
2956
- this.ckeditorConfig = this.customConfig;
2957
- }
2958
- else {
2959
- if (this.basic) {
2960
- this.ckeditorConfig.toolbar = 'Basic';
2961
- }
2962
- if (this.availableTags) {
2963
- this.ckeditorConfig.format_tags = this.availableTags;
2964
- }
2965
- if (this.uiColour) {
2966
- this.ckeditorConfig.uiColor = this.uiColour;
2967
- }
2968
- if (this.additionalStyling) {
2969
- this.ckeditorConfig.contentsCss.concat(this.additionalStyling);
2970
- }
2971
- }
2972
- }
2973
- }
2974
- WysiwygComponent.decorators = [
2975
- { type: Component, args: [{
2976
- selector: 'aui-wysiwyg',
2977
- template: "<div class=\"aui-wysiwyg__inner\">\n <ckeditor\n (blur)=\"onBlur($event)\"\n (change)=\"writeValue($event)\"\n (focus)=\"onFocus($event)\"\n [(ngModel)]=\"ckeditorContent\"\n [config]=\"ckeditorConfig\"\n [debounce]=\"debounce\"\n [readonly]=\"isDisabled\"\n ></ckeditor>\n</div>\n",
2978
- providers: [{
2979
- provide: NG_VALUE_ACCESSOR,
2980
- useExisting: forwardRef((/**
2981
- * @return {?}
2982
- */
2983
- () => WysiwygComponent)),
2984
- // tslint:disable-line:no-forward-ref
2985
- multi: true,
2986
- }],
2987
- styles: [":host ::ng-deep .cke .cke_chrome{border:1px solid #6f6f6f}:host ::ng-deep .cke .cke_top{border-color:#6f6f6f}:host ::ng-deep .cke .cke_bottom,:host ::ng-deep .cke .cke_top{background-color:#f3f3f3}:host ::ng-deep .cke .cke_wysiwyg_div{padding:.25rem}:host ::ng-deep .cke.cke_focus .cke_contents{box-shadow:0 0 0 1px #6f6f6f,0 0 0 4px #c0dffe;position:relative;z-index:1}"]
2988
- }] }
2989
- ];
2990
- WysiwygComponent.propDecorators = {
2991
- setClass: [{ type: HostBinding, args: ['class.aui-wysiwyg',] }],
2992
- additionalStyling: [{ type: Input }],
2993
- availableTags: [{ type: Input }],
2994
- basic: [{ type: Input }],
2995
- uiColour: [{ type: Input }],
2996
- customConfig: [{ type: Input }],
2997
- debounce: [{ type: Input }],
2998
- emitContent: [{ type: Output }],
2999
- focus: [{ type: Output }],
3000
- blur: [{ type: Output }]
3001
- };
3002
- if (false) {
3003
- /** @type {?} */
3004
- WysiwygComponent.prototype.setClass;
3005
- /** @type {?} */
3006
- WysiwygComponent.prototype.additionalStyling;
3007
- /** @type {?} */
3008
- WysiwygComponent.prototype.availableTags;
3009
- /** @type {?} */
3010
- WysiwygComponent.prototype.basic;
3011
- /** @type {?} */
3012
- WysiwygComponent.prototype.uiColour;
3013
- /** @type {?} */
3014
- WysiwygComponent.prototype.customConfig;
3015
- /** @type {?} */
3016
- WysiwygComponent.prototype.debounce;
3017
- /** @type {?} */
3018
- WysiwygComponent.prototype.emitContent;
3019
- /** @type {?} */
3020
- WysiwygComponent.prototype.focus;
3021
- /** @type {?} */
3022
- WysiwygComponent.prototype.blur;
3023
- /** @type {?} */
3024
- WysiwygComponent.prototype.ckeditorContent;
3025
- /** @type {?} */
3026
- WysiwygComponent.prototype.ckeditorConfig;
3027
- /** @type {?} */
3028
- WysiwygComponent.prototype.isDisabled;
3029
- /**
3030
- * @type {?}
3031
- * @private
3032
- */
3033
- WysiwygComponent.prototype.updateModel;
3034
- }
3035
-
3036
- /**
3037
- * @fileoverview added by tsickle
3038
- * Generated from: lib/wysiwyg/wysiwyg.module.ts
3039
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3040
- */
3041
- class WysiwygModule {
3042
- }
3043
- WysiwygModule.decorators = [
3044
- { type: NgModule, args: [{
3045
- imports: [
3046
- CommonModule,
3047
- FormsModule,
3048
- ReactiveFormsModule,
3049
- CKEditorModule,
3050
- ],
3051
- declarations: [
3052
- WysiwygComponent,
3053
- ],
3054
- exports: [
3055
- WysiwygComponent,
3056
- ],
3057
- },] }
3058
- ];
3059
-
3060
- /**
3061
- * @fileoverview added by tsickle
3062
- * Generated from: lib/wysiwyg/public-api.ts
3063
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3064
- */
3065
-
3066
- /**
3067
- * @fileoverview added by tsickle
3068
- * Generated from: public-api.ts
3069
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3070
- */
3071
-
3072
- /**
3073
- * @fileoverview added by tsickle
3074
- * Generated from: acpaas-ui-ngx-forms.ts
3075
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3076
- */
3077
-
3078
- export { AutoCompleteComponent, AutoCompleteModule, DATEPICKER_DATE_MASK, DATEPICKER_DEFAULT_ERROR_LABELS, DATEPICKER_ERROR_LABELS, DATEPICKER_SEPARATOR_CHAR, DatepickerComponent, DatepickerModule, MaskDirective, MaskModule, RangeSliderComponent, RangeSliderModule, SearchFilterComponent, SearchFilterModule, TimePickerValidators, TimepickerComponent, TimepickerInputSize, TimepickerModule, UPLOAD_OPTIONS_DEFAULT, UPLOAD_VALIDATION_MESSAGES, UploadComponent, UploadInputComponent, UploadModule, UploadQueueComponent, UploadZoneComponent, Uploader, ValidationListComponent, ValidationMessagesService, WYSIWYG_DEFAULT_CONFIG, WysiwygComponent, WysiwygModule, SearchService as ɵa };
3079
- //# sourceMappingURL=acpaas-ui-ngx-forms.js.map