@metadev/lux 0.17.0 → 0.19.2

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 (102) hide show
  1. package/esm2020/lib/autocomplete/autocomplete.component.mjs +479 -0
  2. package/esm2020/lib/autocomplete-list/autocomplete-list.component.mjs +254 -0
  3. package/esm2020/lib/breadcrumb/breadcrumb.component.mjs +75 -0
  4. package/esm2020/lib/checkbox/checkbox.component.mjs +154 -0
  5. package/{esm2015/lib/datasource.js → esm2020/lib/datasource.mjs} +0 -0
  6. package/esm2020/lib/datetime/datetime.component.mjs +306 -0
  7. package/esm2020/lib/filter/filter.component.mjs +152 -0
  8. package/esm2020/lib/geolocation/geolocation.component.mjs +407 -0
  9. package/{esm2015/lib/geolocation/geolocation.service.js → esm2020/lib/geolocation/geolocation.service.mjs} +7 -11
  10. package/esm2020/lib/geolocation/openlayer-loader.service.mjs +62 -0
  11. package/esm2020/lib/helperFns.mjs +109 -0
  12. package/esm2020/lib/input/input.component.mjs +452 -0
  13. package/{esm2015/lib/input/regexp.service.js → esm2020/lib/input/regexp.service.mjs} +7 -6
  14. package/{esm2015/lib/lang.js → esm2020/lib/lang.mjs} +0 -0
  15. package/esm2020/lib/lux.module.mjs +130 -0
  16. package/{esm2015/lib/map/geopoint.js → esm2020/lib/map/geopoint.mjs} +0 -0
  17. package/esm2020/lib/map/map.component.mjs +265 -0
  18. package/esm2020/lib/modal/modal-backdrop.mjs +26 -0
  19. package/esm2020/lib/modal/modal-config.mjs +14 -0
  20. package/{esm2015/lib/modal/modal-dismiss-reasons.js → esm2020/lib/modal/modal-dismiss-reasons.mjs} +0 -0
  21. package/{esm2015/lib/modal/modal-ref.js → esm2020/lib/modal/modal-ref.mjs} +0 -0
  22. package/esm2020/lib/modal/modal-stack.mjs +179 -0
  23. package/esm2020/lib/modal/modal-window.mjs +119 -0
  24. package/esm2020/lib/modal/modal.service.mjs +26 -0
  25. package/{esm2015/lib/modal/util.js → esm2020/lib/modal/util.mjs} +0 -0
  26. package/esm2020/lib/pagination/pagination.component.mjs +137 -0
  27. package/{esm2015/lib/pagination/pagination.js → esm2020/lib/pagination/pagination.mjs} +0 -0
  28. package/esm2020/lib/radiogroup/radiogroup.component.mjs +130 -0
  29. package/esm2020/lib/select/select.component.mjs +149 -0
  30. package/{esm2015/lib/tooltip/placement.js → esm2020/lib/tooltip/placement.mjs} +0 -0
  31. package/{esm2015/lib/tooltip/tooltip-context.js → esm2020/lib/tooltip/tooltip-context.mjs} +0 -0
  32. package/esm2020/lib/tooltip/tooltip.component.mjs +23 -0
  33. package/esm2020/lib/tooltip/tooltip.directive.mjs +60 -0
  34. package/{esm2015/lib/tooltip/tooltip.service.js → esm2020/lib/tooltip/tooltip.service.mjs} +7 -9
  35. package/{esm2015/lib/tooltip/tooltop-content.js → esm2020/lib/tooltip/tooltop-content.mjs} +0 -0
  36. package/esm2020/lib/voice-recognition/voice-recognition.directive.mjs +73 -0
  37. package/{esm2015/lib/window/window.service.js → esm2020/lib/window/window.service.mjs} +0 -0
  38. package/esm2020/metadev-lux.mjs +5 -0
  39. package/esm2020/public-api.mjs +21 -0
  40. package/fesm2015/metadev-lux.mjs +4345 -0
  41. package/fesm2015/metadev-lux.mjs.map +1 -0
  42. package/fesm2020/metadev-lux.mjs +4343 -0
  43. package/fesm2020/metadev-lux.mjs.map +1 -0
  44. package/lib/autocomplete/autocomplete.component.d.ts +3 -0
  45. package/lib/autocomplete-list/autocomplete-list.component.d.ts +3 -0
  46. package/lib/breadcrumb/breadcrumb.component.d.ts +3 -0
  47. package/lib/checkbox/checkbox.component.d.ts +3 -0
  48. package/lib/datetime/datetime.component.d.ts +4 -0
  49. package/lib/filter/filter.component.d.ts +3 -0
  50. package/lib/geolocation/geolocation.component.d.ts +4 -0
  51. package/lib/geolocation/geolocation.service.d.ts +3 -0
  52. package/lib/geolocation/openlayer-loader.service.d.ts +3 -0
  53. package/lib/helperFns.d.ts +2 -0
  54. package/lib/input/input.component.d.ts +15 -0
  55. package/lib/input/regexp.service.d.ts +3 -0
  56. package/lib/lux.module.d.ts +26 -0
  57. package/lib/map/map.component.d.ts +3 -0
  58. package/lib/modal/modal-backdrop.d.ts +3 -0
  59. package/lib/modal/modal-config.d.ts +3 -0
  60. package/lib/modal/modal-stack.d.ts +3 -0
  61. package/lib/modal/modal-window.d.ts +3 -0
  62. package/lib/modal/modal.service.d.ts +3 -0
  63. package/lib/pagination/pagination.component.d.ts +3 -0
  64. package/lib/radiogroup/radiogroup.component.d.ts +3 -0
  65. package/lib/select/select.component.d.ts +3 -0
  66. package/lib/tooltip/tooltip.component.d.ts +3 -0
  67. package/lib/tooltip/tooltip.directive.d.ts +3 -0
  68. package/lib/tooltip/tooltip.service.d.ts +3 -0
  69. package/lib/voice-recognition/voice-recognition.directive.d.ts +3 -0
  70. package/metadev-lux.d.ts +1 -16
  71. package/package.json +23 -11
  72. package/public-api.d.ts +12 -7
  73. package/bundles/metadev-lux.umd.js +0 -4647
  74. package/bundles/metadev-lux.umd.js.map +0 -1
  75. package/esm2015/lib/autocomplete/autocomplete.component.js +0 -455
  76. package/esm2015/lib/autocomplete-list/autocomplete-list.component.js +0 -230
  77. package/esm2015/lib/breadcrumb/breadcrumb.component.js +0 -77
  78. package/esm2015/lib/checkbox/checkbox.component.js +0 -142
  79. package/esm2015/lib/datetime/datetime.component.js +0 -275
  80. package/esm2015/lib/filter/filter.component.js +0 -140
  81. package/esm2015/lib/geolocation/geolocation.component.js +0 -371
  82. package/esm2015/lib/geolocation/openlayer-loader.service.js +0 -63
  83. package/esm2015/lib/helperFns.js +0 -93
  84. package/esm2015/lib/input/input.component.js +0 -371
  85. package/esm2015/lib/lux.module.js +0 -83
  86. package/esm2015/lib/map/map.component.js +0 -261
  87. package/esm2015/lib/modal/modal-backdrop.js +0 -19
  88. package/esm2015/lib/modal/modal-config.js +0 -12
  89. package/esm2015/lib/modal/modal-stack.js +0 -182
  90. package/esm2015/lib/modal/modal-window.js +0 -92
  91. package/esm2015/lib/modal/modal.service.js +0 -28
  92. package/esm2015/lib/pagination/pagination.component.js +0 -134
  93. package/esm2015/lib/radiogroup/radiogroup.component.js +0 -114
  94. package/esm2015/lib/select/select.component.js +0 -131
  95. package/esm2015/lib/tooltip/tooltip.component.js +0 -19
  96. package/esm2015/lib/tooltip/tooltip.directive.js +0 -52
  97. package/esm2015/lib/voice-recognition/voice-recognition.directive.js +0 -76
  98. package/esm2015/metadev-lux.js +0 -21
  99. package/esm2015/public-api.js +0 -16
  100. package/fesm2015/metadev-lux.js +0 -4025
  101. package/fesm2015/metadev-lux.js.map +0 -1
  102. package/metadev-lux.metadata.json +0 -1
@@ -0,0 +1,4343 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, forwardRef, Component, ViewChild, Output, Input, Inject, HostBinding, HostListener, Injectable, TemplateRef, Directive, InjectionToken, PLATFORM_ID, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import { debounceTime, first, map, filter, takeUntil, withLatestFrom, distinctUntilChanged, switchMap } from 'rxjs/operators';
6
+ import { of, Subject, fromEvent, from, BehaviorSubject } from 'rxjs';
7
+ import * as i2 from 'angular-resize-event';
8
+ import { AngularResizeEventModule } from 'angular-resize-event';
9
+ import * as i2$1 from '@angular/common';
10
+ import { DOCUMENT, isPlatformBrowser, CommonModule } from '@angular/common';
11
+ import * as i1$1 from '@angular/router';
12
+ import { NavigationEnd, RouterModule } from '@angular/router';
13
+ import * as i1$2 from '@angular/common/http';
14
+ import { HttpClientModule } from '@angular/common/http';
15
+
16
+ // undefined and null functions
17
+ const exists = (value) => value !== null && value !== undefined;
18
+ const hasValue = (value) => exists(value) && (typeof value === 'string' ? !isEmptyString(value) : true);
19
+ // string functions
20
+ const isEmptyString = (value) => value.trim() === '';
21
+ const isValidEmail = (value) => {
22
+ const re = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
23
+ return re.test(String(value).toLowerCase().trim());
24
+ };
25
+ const isValidUrl = (value) => {
26
+ const re = /^([a-z]+?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(\:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?$/i;
27
+ return re.test(String(value).toLowerCase().trim());
28
+ };
29
+ const isValidColor = (value) => {
30
+ value = String(value).toLowerCase();
31
+ // valid values for CSS color property, yet not valid colors by themselves
32
+ if (value === 'currentcolor' ||
33
+ value === 'inherit' ||
34
+ value === 'initial' ||
35
+ value === 'revert' ||
36
+ value === 'unset') {
37
+ return false;
38
+ }
39
+ return CSS.supports('color', value);
40
+ };
41
+ // date functions
42
+ const isValidDate = (date) => exists(date) ? !isNaN(date.getTime()) : false;
43
+ const normalizeDate = (value) => {
44
+ if (typeof value === 'string' && value.length > 10) {
45
+ return value.substr(0, 10);
46
+ }
47
+ return value ? value.toString() : null;
48
+ };
49
+ const addTimezoneOffset = (date) => {
50
+ if (!isValidDate(date)) {
51
+ return date;
52
+ }
53
+ else {
54
+ return new Date(date.getTime() - date.getTimezoneOffset() * 60000);
55
+ }
56
+ };
57
+ // number functions
58
+ const isValidNumber = (value) => (hasValue(value) ? !Number.isNaN(Number(value)) : false);
59
+ const numberOfDecimalDigits = (x) => {
60
+ if (isValidNumber(x)) {
61
+ const xString = String(Number(x));
62
+ if (xString === 'Infinity') {
63
+ return 0;
64
+ }
65
+ const indexOfE = xString.indexOf('e');
66
+ if (indexOfE >= 0) {
67
+ return 0;
68
+ }
69
+ const indexOfDecimalPoint = xString.indexOf('.');
70
+ if (indexOfDecimalPoint < 0) {
71
+ return 0;
72
+ }
73
+ else {
74
+ return xString.length - indexOfDecimalPoint - 1;
75
+ }
76
+ }
77
+ return undefined;
78
+ };
79
+ const numberOfWholeDigits = (x) => {
80
+ if (isValidNumber(x)) {
81
+ let xString = String(Number(x));
82
+ if (xString.indexOf('-') === 0) {
83
+ xString = xString.slice(1, xString.length);
84
+ }
85
+ if (xString === 'Infinity') {
86
+ return Infinity;
87
+ }
88
+ if (xString.indexOf('0') === 0) {
89
+ xString = xString.slice(1, xString.length);
90
+ }
91
+ const indexOfE = xString.indexOf('e');
92
+ if (indexOfE >= 0) {
93
+ return Number(xString.slice(indexOfE + 1, xString.length)) + 1;
94
+ }
95
+ const indexOfDecimalPoint = xString.indexOf('.');
96
+ if (indexOfDecimalPoint < 0) {
97
+ return xString.length;
98
+ }
99
+ else {
100
+ return indexOfDecimalPoint;
101
+ }
102
+ }
103
+ return undefined;
104
+ };
105
+ const roundToMultipleOf = (x, modulo) => {
106
+ const moduloString = String(modulo);
107
+ // approximates the result
108
+ // prone to inexactitude because of floating point arithmetic
109
+ const approximation = Math.round(x / modulo) * modulo;
110
+ const approximationString = String(approximation);
111
+ // remove useless decimals
112
+ const uselessDecimalsInApproximation = numberOfDecimalDigits(approximationString) -
113
+ numberOfDecimalDigits(moduloString);
114
+ const resultString = approximationString.slice(0, approximationString.length - uselessDecimalsInApproximation);
115
+ return Number(resultString);
116
+ };
117
+ // other functions
118
+ const isInitialAndEmpty = (previousValue, newValue) => {
119
+ const isPrevArray = Array.isArray(previousValue);
120
+ const isNewArray = Array.isArray(newValue);
121
+ return !((isPrevArray ? previousValue.length !== 0 : Boolean(previousValue)) ||
122
+ (isNewArray ? newValue.length !== 0 : Boolean(newValue)));
123
+ };
124
+
125
+ /** Language detector based on Navigator preferences */
126
+ const languageDetector = () => {
127
+ const lang = navigator.language.split('-')[0];
128
+ if (lang === 'es' || lang === 'en') {
129
+ return lang;
130
+ }
131
+ return 'en'; // default
132
+ };
133
+
134
+ const LOST_FOCUS_TIME_WINDOW_MS = 200; // ms
135
+ class AutocompleteComponent {
136
+ constructor(cd) {
137
+ this.cd = cd;
138
+ this.lostFocusHandled = true;
139
+ this.t0 = 0;
140
+ this.showSpinner = false;
141
+ this.touched = false;
142
+ this.completionList = [];
143
+ this.showCompletion = false;
144
+ this.valueChange = new EventEmitter();
145
+ this.dataSourceChange = new EventEmitter();
146
+ this.disabled = null;
147
+ this.readonly = null;
148
+ this.label = '';
149
+ /** If canAddNewValues, user can type items not present in the data-source. */
150
+ this.canAddNewValues = false;
151
+ /** After cleaning the selection should the completion list remain open or closed:
152
+ * false: (default) close on filters, to clean a filter and select all.
153
+ * true: keep open (when the action most likely is to pick another one).
154
+ */
155
+ this.keepOpenAfterDelete = false;
156
+ this.required = false;
157
+ this.resolveLabelsFunction = undefined;
158
+ this.populateFunction = undefined;
159
+ // ControlValueAccessor Interface
160
+ this.onChange = (value) => { };
161
+ this.onTouched = () => { };
162
+ }
163
+ get value() {
164
+ return this._value;
165
+ }
166
+ set value(v) {
167
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
168
+ this._value = v;
169
+ this.onChange(v);
170
+ this.completeLabel();
171
+ if (!initialAndEmpty) {
172
+ this.valueChange.emit(v);
173
+ }
174
+ }
175
+ get dataSource() {
176
+ return this._dataSource;
177
+ }
178
+ set dataSource(v) {
179
+ this._dataSource = v;
180
+ this.dataSourceChange.emit(v);
181
+ }
182
+ set placeholder(v) {
183
+ this._placeholder = v;
184
+ }
185
+ get placeholder() {
186
+ return this._placeholder ? this._placeholder : '';
187
+ }
188
+ writeValue(value) {
189
+ this.value = value;
190
+ }
191
+ registerOnChange(onChange) {
192
+ this.onChange = onChange;
193
+ }
194
+ registerOnTouched(onTouched) {
195
+ this.onTouched = onTouched;
196
+ }
197
+ markAsTouched() {
198
+ if (!this.touched && !this.disabled) {
199
+ this.onTouched();
200
+ this.touched = true;
201
+ }
202
+ }
203
+ setDisabledState(disabled) {
204
+ this.disabled = disabled;
205
+ }
206
+ // End ControlValueAccessor Interface
207
+ // Validator interface
208
+ registerOnValidatorChange() { }
209
+ validate(control) {
210
+ const value = control.value;
211
+ if (this.required &&
212
+ (value === '' || value === null || value === undefined)) {
213
+ return { required: { value, reason: 'Required field.' } };
214
+ }
215
+ return null;
216
+ }
217
+ // End of Validator interface
218
+ clear() {
219
+ this.value = null;
220
+ this.toggleCompletion(this.keepOpenAfterDelete, '');
221
+ }
222
+ completeLabel() {
223
+ if (this.value) {
224
+ if (this.dataSource) {
225
+ this.label = findLabelForId(this.dataSource, this.value) || '';
226
+ }
227
+ else if (this.instance && this.resolveLabelsFunction) {
228
+ this.resolveLabelsFunction(this.instance, [this.value])
229
+ .pipe(debounceTime(1), first())
230
+ .subscribe((data) => {
231
+ this.label = findLabelForId(data, this.value) || '';
232
+ });
233
+ }
234
+ }
235
+ else {
236
+ this.label = '';
237
+ }
238
+ }
239
+ ngOnInit() {
240
+ this.inputId = this.inputId
241
+ ? this.inputId
242
+ : `autocompletelist${AutocompleteComponent.idCounter++}`;
243
+ this.completeLabel();
244
+ }
245
+ ngAfterViewInit() {
246
+ this.setSameWidth();
247
+ }
248
+ onInputResized() {
249
+ this.setSameWidth();
250
+ }
251
+ setSameWidth() {
252
+ const width = this.i0.nativeElement.getBoundingClientRect().width;
253
+ this.completeDiv.nativeElement.style.width = `${width}px`;
254
+ }
255
+ onKeydown(event, label) {
256
+ switch (event.key) {
257
+ case 'Tab':
258
+ if (label) {
259
+ this.pickSelectionOrFirstMatch(label);
260
+ }
261
+ this.showCompletion = false;
262
+ break;
263
+ }
264
+ this.markAsTouched();
265
+ }
266
+ onKeypress(event, label) {
267
+ switch (event.key) {
268
+ case 'Intro':
269
+ case 'Enter':
270
+ this.pickSelectionOrFirstMatch(label);
271
+ event.preventDefault();
272
+ break;
273
+ }
274
+ this.markAsTouched();
275
+ }
276
+ onKeyup(event, label) {
277
+ switch (event.key) {
278
+ case 'PageDown':
279
+ this.focusOnNext(5);
280
+ event.preventDefault();
281
+ break;
282
+ case 'ArrowDown':
283
+ this.focusOnNext(1);
284
+ event.preventDefault();
285
+ break;
286
+ case 'PageUp':
287
+ this.focusOnPrevious(5);
288
+ event.preventDefault();
289
+ break;
290
+ case 'ArrowUp':
291
+ this.focusOnPrevious(1);
292
+ event.preventDefault();
293
+ break;
294
+ case 'Escape':
295
+ this.complete(null);
296
+ event.preventDefault();
297
+ break;
298
+ case 'Intro':
299
+ case 'Enter':
300
+ event.preventDefault();
301
+ break;
302
+ default:
303
+ this.showCompletionList(label);
304
+ // event.preventDefault();
305
+ }
306
+ this.markAsTouched();
307
+ }
308
+ focusOnNext(offset) {
309
+ const list = this.completionList || [];
310
+ const index = list.findIndex((it) => this.focusItem && it.key === this.focusItem.key);
311
+ const indexNext = -1 && list.length > index + offset ? index + offset : list.length - 1;
312
+ const next = list[indexNext];
313
+ this.focusItem = next;
314
+ this.ensureItemVisible(index);
315
+ }
316
+ focusOnPrevious(offset) {
317
+ const list = this.completionList || [];
318
+ const index = list.findIndex((it) => this.focusItem && it.key === this.focusItem.key);
319
+ const indexPrevious = index !== -1 && index > offset ? index - offset : 0;
320
+ const next = list[indexPrevious];
321
+ this.focusItem = next;
322
+ this.ensureItemVisible(index);
323
+ }
324
+ onLostFocus(label) {
325
+ this.lostFocusHandled = false;
326
+ this.t0 = performance.now();
327
+ // console.log('Init LostFocus');
328
+ setTimeout(() => {
329
+ // needs to postpone actions some milliseconds to verify if
330
+ // lost focus was followed by a list selection -> then cancel
331
+ // if not -> make side effect
332
+ if (!this.lostFocusHandled) {
333
+ // console.log(
334
+ // 'Lost focus 2',
335
+ // this.lostFocusHandled,
336
+ // 'SIDE EFFECT',
337
+ // performance.now() - this.t0,
338
+ // 'label:',
339
+ // label
340
+ // );
341
+ if (label && this.label !== label) {
342
+ this.pickSelectionOrFirstMatch(label);
343
+ }
344
+ else {
345
+ this.lostFocusHandled = true;
346
+ }
347
+ this.toggleCompletion(false, label);
348
+ }
349
+ else {
350
+ // do nothing (list selection took place)
351
+ // console.log(
352
+ // 'onlost focus 2',
353
+ // this.lostFocusHandled,
354
+ // 'nothing',
355
+ // performance.now() - this.t0
356
+ // );
357
+ }
358
+ }, LOST_FOCUS_TIME_WINDOW_MS);
359
+ }
360
+ complete(item) {
361
+ if (!this.lostFocusHandled) {
362
+ this.lostFocusHandled = true; // prevent a previous lostFocus to trigger a side effect
363
+ const ellapsed = performance.now() - this.t0;
364
+ if (ellapsed > LOST_FOCUS_TIME_WINDOW_MS) {
365
+ console.warn('complete. lostfocus->click timeout of ', LOST_FOCUS_TIME_WINDOW_MS, 'ms exceed: ', performance.now() - this.t0, ' ms');
366
+ }
367
+ // console.log(
368
+ // 'complete. set to true. CANCELED side effect',
369
+ // performance.now() - this.t0
370
+ // );
371
+ }
372
+ if (item !== null) {
373
+ this.value = item.key;
374
+ this.label = item.label;
375
+ }
376
+ else {
377
+ this.value = null;
378
+ this.label = '';
379
+ }
380
+ this.toggleCompletion(false, null);
381
+ this.markAsTouched();
382
+ }
383
+ toggleCompletion(show, label) {
384
+ if (show && !this.disabled) {
385
+ this.showCompletionList(label);
386
+ }
387
+ else {
388
+ this.showCompletion = false;
389
+ if (this.canAddNewValues) {
390
+ this.syncCustomValue(this.label);
391
+ return;
392
+ }
393
+ }
394
+ this.cd.markForCheck();
395
+ }
396
+ get selectedOption() {
397
+ const index = this.completionList.findIndex((i) => i.key === this.focusItem.key);
398
+ if (index === -1 || !this.focusItem) {
399
+ return null;
400
+ }
401
+ return `${this.inputId}_${index}`;
402
+ }
403
+ ensureItemVisible(index) {
404
+ const target = this.completeDiv.nativeElement.querySelectorAll('li')[index];
405
+ if (target) {
406
+ target.scrollIntoView({ block: 'center' });
407
+ }
408
+ }
409
+ syncCustomValue(text) {
410
+ this.value = text;
411
+ this.label = text;
412
+ }
413
+ /** Pick selection based on text filtering (ingnores drowdown state) */
414
+ pickSelectionOrFirstMatch(text) {
415
+ if (this.canAddNewValues) {
416
+ this.syncCustomValue(text);
417
+ return;
418
+ }
419
+ const focusIndex = this.completionList.findIndex((it) => this.focusItem && it.key === this.focusItem.key);
420
+ if (this.showCompletion &&
421
+ focusIndex > 0 &&
422
+ this.focusItem &&
423
+ this.focusItem.label) {
424
+ if (text === this.focusItem.label && this.focusItem.key === this.value) {
425
+ // do nothing if value does not change & close dropdow
426
+ this.showCompletion = false;
427
+ return;
428
+ }
429
+ // complete selected using selected item on drowdown
430
+ this.complete(this.focusItem);
431
+ return;
432
+ }
433
+ const source = (text || '').trim();
434
+ if (!source) {
435
+ this.showCompletion = false;
436
+ // select null value
437
+ if (this.value !== null) {
438
+ this.value = null;
439
+ }
440
+ return;
441
+ }
442
+ this.completionList = [];
443
+ this.computeCompletionList(source).subscribe((suggestions) => {
444
+ const candidate = suggestions && suggestions.length > 0 ? suggestions[0] : null;
445
+ this.complete(candidate);
446
+ });
447
+ }
448
+ showCompletionList(text) {
449
+ this.setSameWidth();
450
+ const useSpinner = this.hasExternalDataSource();
451
+ this.spinnerVisibility(useSpinner, true);
452
+ setTimeout(() => {
453
+ // for spinner to be shown
454
+ this.computeCompletionList(text).subscribe({
455
+ next: (cl) => {
456
+ this.completionList = cl;
457
+ this.focusItem = selectElement(this.completionList, text);
458
+ this.showCompletion = true;
459
+ this.spinnerVisibility(useSpinner, false);
460
+ },
461
+ error: () => {
462
+ this.spinnerVisibility(useSpinner, false);
463
+ },
464
+ complete: () => {
465
+ this.spinnerVisibility(useSpinner, false);
466
+ }
467
+ });
468
+ }, 1);
469
+ }
470
+ spinnerVisibility(useSpinner, value) {
471
+ if (useSpinner) {
472
+ this.showSpinner = value;
473
+ }
474
+ }
475
+ hasExternalDataSource() {
476
+ return !this.dataSource && !!this.instance && !!this.populateFunction;
477
+ }
478
+ computeCompletionList(text) {
479
+ const searchText = (text || '').toLowerCase();
480
+ if (this.dataSource) {
481
+ const ds = (this.dataSource || [])
482
+ .filter((it) => ignoreAccentsInclude(it.label, searchText))
483
+ .sort((a, b) => a.label.localeCompare(b.label));
484
+ return of(decorateDataSource(ds, searchText));
485
+ }
486
+ else if (this.instance && this.populateFunction) {
487
+ return this.populateFunction(this.instance, searchText).pipe(debounceTime(1), first(), map((ds) => {
488
+ const dsFiltered = ds
489
+ .filter((it) => ignoreAccentsInclude(it.label, searchText))
490
+ .sort((a, b) => a.label.localeCompare(b.label));
491
+ return decorateDataSource(dsFiltered, searchText);
492
+ }));
493
+ }
494
+ else {
495
+ return of([]);
496
+ }
497
+ }
498
+ }
499
+ AutocompleteComponent.idCounter = 0;
500
+ AutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: AutocompleteComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
501
+ AutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: AutocompleteComponent, selector: "lux-autocomplete", inputs: { inputId: "inputId", disabled: "disabled", readonly: "readonly", label: "label", canAddNewValues: "canAddNewValues", keepOpenAfterDelete: "keepOpenAfterDelete", value: "value", dataSource: "dataSource", required: "required", placeholder: "placeholder", resolveLabelsFunction: "resolveLabelsFunction", populateFunction: "populateFunction", instance: "instance" }, outputs: { valueChange: "valueChange", dataSourceChange: "dataSourceChange" }, providers: [
502
+ {
503
+ provide: NG_VALUE_ACCESSOR,
504
+ multi: true,
505
+ useExisting: forwardRef(() => AutocompleteComponent)
506
+ },
507
+ {
508
+ provide: NG_VALIDATORS,
509
+ multi: true,
510
+ useExisting: forwardRef(() => AutocompleteComponent)
511
+ }
512
+ ], viewQueries: [{ propertyName: "i0", first: true, predicate: ["i0"], descendants: true, static: true }, { propertyName: "completeDiv", first: true, predicate: ["completeDiv"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"lux-autocomplete\" (blur)=\"toggleCompletion(false, i0.value)\">\n <div class=\"lux-autocomplete-box\">\n <input\n #i0\n [id]=\"inputId\"\n [(ngModel)]=\"label\"\n [placeholder]=\"placeholder\"\n [attr.disabled]=\"disabled || null\"\n [attr.readonly]=\"readonly || null\"\n (keydown)=\"onKeydown($event, i0.value)\"\n (keypress)=\"onKeypress($event, i0.value)\"\n (keyup)=\"onKeyup($event, i0.value)\"\n (blur)=\"onLostFocus(i0.value)\"\n (focus)=\"toggleCompletion(true, i0.value)\"\n (click)=\"toggleCompletion(true, i0.value)\"\n (resized)=\"onInputResized()\"\n (window:resize)=\"onInputResized()\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"showCompletion\"\n aria-haspopup=\"true\"\n attr.aria-owns=\"{{ inputId + '_list' }}\"\n [attr.aria-activedescendant]=\"selectedOption\"\n />\n <div *ngIf=\"canAddNewValues\" class=\"icon-suggestions\"></div>\n <div *ngIf=\"showSpinner; else noLoading\" class=\"icon-spinner\"></div>\n <ng-template #noLoading>\n <button\n *ngIf=\"!disabled && i0.value && !showCompletion; else dropdown\"\n type=\"button\"\n class=\"icon-clear\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n ></button>\n <ng-template #dropdown>\n <div\n class=\"icon-dropdown\"\n (click)=\"toggleCompletion(!showCompletion, i0.value)\"\n ></div>\n </ng-template>\n </ng-template>\n </div>\n <div\n #completeDiv\n [class.showCompletion]=\"showCompletion\"\n class=\"lux-completion-list\"\n id=\"{{ inputId + '_list' }}\"\n >\n <ul>\n <li\n *ngFor=\"let item of completionList; let index = index\"\n id=\"{{ inputId + '_' + index }}\"\n class=\"lux-completion-item\"\n [class.selected]=\"focusItem && item.key === focusItem.key\"\n (click)=\"complete(item)\"\n [attr.aria-label]=\"item.label\"\n >\n <span>{{ item.labelPrefix }}</span>\n <span class=\"bold\">{{ item.labelMatch }}</span>\n <span>{{ item.labelPostfix }}</span>\n </li>\n </ul>\n </div>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.lux-autocomplete .lux-autocomplete-box{display:grid;grid-template-columns:1fr -webkit-max-content;grid-template-columns:1fr max-content}.lux-autocomplete input{padding:.1rem 1.5rem .1rem .5rem;padding:var(--lux-autocomplete-input-padding, .1rem 1.5rem .1rem .5rem);text-overflow:ellipsis;grid-row:1;grid-column-start:1;grid-column-end:3}.lux-autocomplete .icon-suggestions{grid-row:1;grid-column:2;width:1.5rem;border:none;background-color:transparent;background:url(/assets/img/suggestions.svg) no-repeat center;background-size:.5rem .5rem;z-index:1;position:relative;left:-1rem}.lux-autocomplete .icon-clear{grid-row:1;grid-column:2;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);border:none;background-color:transparent;background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-autocomplete-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}.lux-autocomplete .icon-dropdown{grid-row:1;grid-column:2;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);height:1.3rem;height:var(--lux-autocomplete-icon-height, 1.3rem);border:none;background-color:transparent;background:url(/assets/img/drop-down-arrow.svg) no-repeat center;background:var(--lux-autocomplete-icon-dropdown, url(/assets/img/drop-down-arrow.svg) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}.lux-autocomplete .icon-spinner{grid-row:1;grid-column:2;width:1.5rem;border:none;background-color:transparent;background:url(/assets/img/spinner.svg) no-repeat center;background-size:1.2rem 1.2rem;z-index:1}.lux-completion-list{visibility:collapse;position:absolute;border:1px solid #ccc;margin:0rem;padding:0rem;max-height:10rem;overflow:auto;z-index:2}.lux-completion-list ul{list-style:none;margin:0rem;padding:0rem}.showCompletion{visibility:visible}.lux-completion-item{background-color:#fff;color:#000;padding:.1rem .5rem;cursor:pointer}.selected{background-color:#2e2eac;color:#fff}.disabled{background-color:#f0f0f0;color:#444}.disabled .selected{background-color:#9898ec;color:#fff}.bold{font-weight:700}\n"], directives: [{ type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2.ResizedDirective, selector: "[resized]", outputs: ["resized"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: AutocompleteComponent, decorators: [{
514
+ type: Component,
515
+ args: [{ selector: 'lux-autocomplete', providers: [
516
+ {
517
+ provide: NG_VALUE_ACCESSOR,
518
+ multi: true,
519
+ useExisting: forwardRef(() => AutocompleteComponent)
520
+ },
521
+ {
522
+ provide: NG_VALIDATORS,
523
+ multi: true,
524
+ useExisting: forwardRef(() => AutocompleteComponent)
525
+ }
526
+ ], template: "<div class=\"lux-autocomplete\" (blur)=\"toggleCompletion(false, i0.value)\">\n <div class=\"lux-autocomplete-box\">\n <input\n #i0\n [id]=\"inputId\"\n [(ngModel)]=\"label\"\n [placeholder]=\"placeholder\"\n [attr.disabled]=\"disabled || null\"\n [attr.readonly]=\"readonly || null\"\n (keydown)=\"onKeydown($event, i0.value)\"\n (keypress)=\"onKeypress($event, i0.value)\"\n (keyup)=\"onKeyup($event, i0.value)\"\n (blur)=\"onLostFocus(i0.value)\"\n (focus)=\"toggleCompletion(true, i0.value)\"\n (click)=\"toggleCompletion(true, i0.value)\"\n (resized)=\"onInputResized()\"\n (window:resize)=\"onInputResized()\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"showCompletion\"\n aria-haspopup=\"true\"\n attr.aria-owns=\"{{ inputId + '_list' }}\"\n [attr.aria-activedescendant]=\"selectedOption\"\n />\n <div *ngIf=\"canAddNewValues\" class=\"icon-suggestions\"></div>\n <div *ngIf=\"showSpinner; else noLoading\" class=\"icon-spinner\"></div>\n <ng-template #noLoading>\n <button\n *ngIf=\"!disabled && i0.value && !showCompletion; else dropdown\"\n type=\"button\"\n class=\"icon-clear\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n ></button>\n <ng-template #dropdown>\n <div\n class=\"icon-dropdown\"\n (click)=\"toggleCompletion(!showCompletion, i0.value)\"\n ></div>\n </ng-template>\n </ng-template>\n </div>\n <div\n #completeDiv\n [class.showCompletion]=\"showCompletion\"\n class=\"lux-completion-list\"\n id=\"{{ inputId + '_list' }}\"\n >\n <ul>\n <li\n *ngFor=\"let item of completionList; let index = index\"\n id=\"{{ inputId + '_' + index }}\"\n class=\"lux-completion-item\"\n [class.selected]=\"focusItem && item.key === focusItem.key\"\n (click)=\"complete(item)\"\n [attr.aria-label]=\"item.label\"\n >\n <span>{{ item.labelPrefix }}</span>\n <span class=\"bold\">{{ item.labelMatch }}</span>\n <span>{{ item.labelPostfix }}</span>\n </li>\n </ul>\n </div>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.lux-autocomplete .lux-autocomplete-box{display:grid;grid-template-columns:1fr -webkit-max-content;grid-template-columns:1fr max-content}.lux-autocomplete input{padding:.1rem 1.5rem .1rem .5rem;padding:var(--lux-autocomplete-input-padding, .1rem 1.5rem .1rem .5rem);text-overflow:ellipsis;grid-row:1;grid-column-start:1;grid-column-end:3}.lux-autocomplete .icon-suggestions{grid-row:1;grid-column:2;width:1.5rem;border:none;background-color:transparent;background:url(/assets/img/suggestions.svg) no-repeat center;background-size:.5rem .5rem;z-index:1;position:relative;left:-1rem}.lux-autocomplete .icon-clear{grid-row:1;grid-column:2;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);border:none;background-color:transparent;background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-autocomplete-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}.lux-autocomplete .icon-dropdown{grid-row:1;grid-column:2;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);height:1.3rem;height:var(--lux-autocomplete-icon-height, 1.3rem);border:none;background-color:transparent;background:url(/assets/img/drop-down-arrow.svg) no-repeat center;background:var(--lux-autocomplete-icon-dropdown, url(/assets/img/drop-down-arrow.svg) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}.lux-autocomplete .icon-spinner{grid-row:1;grid-column:2;width:1.5rem;border:none;background-color:transparent;background:url(/assets/img/spinner.svg) no-repeat center;background-size:1.2rem 1.2rem;z-index:1}.lux-completion-list{visibility:collapse;position:absolute;border:1px solid #ccc;margin:0rem;padding:0rem;max-height:10rem;overflow:auto;z-index:2}.lux-completion-list ul{list-style:none;margin:0rem;padding:0rem}.showCompletion{visibility:visible}.lux-completion-item{background-color:#fff;color:#000;padding:.1rem .5rem;cursor:pointer}.selected{background-color:#2e2eac;color:#fff}.disabled{background-color:#f0f0f0;color:#444}.disabled .selected{background-color:#9898ec;color:#fff}.bold{font-weight:700}\n"] }]
527
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { i0: [{
528
+ type: ViewChild,
529
+ args: ['i0', { static: true }]
530
+ }], completeDiv: [{
531
+ type: ViewChild,
532
+ args: ['completeDiv', { static: true }]
533
+ }], valueChange: [{
534
+ type: Output
535
+ }], dataSourceChange: [{
536
+ type: Output
537
+ }], inputId: [{
538
+ type: Input
539
+ }], disabled: [{
540
+ type: Input
541
+ }], readonly: [{
542
+ type: Input
543
+ }], label: [{
544
+ type: Input
545
+ }], canAddNewValues: [{
546
+ type: Input
547
+ }], keepOpenAfterDelete: [{
548
+ type: Input
549
+ }], value: [{
550
+ type: Input
551
+ }], dataSource: [{
552
+ type: Input
553
+ }], required: [{
554
+ type: Input
555
+ }], placeholder: [{
556
+ type: Input
557
+ }], resolveLabelsFunction: [{
558
+ type: Input
559
+ }], populateFunction: [{
560
+ type: Input
561
+ }], instance: [{
562
+ type: Input
563
+ }] } });
564
+ /** Returns true if text includes substring. No accents considered. Ignorecase */
565
+ const ignoreAccentsInclude = (text, substring) => {
566
+ text = normalizedString(text).toLowerCase();
567
+ substring = normalizedString(substring).toLowerCase();
568
+ return text.includes(substring);
569
+ };
570
+ /** Returns a normalized string with no accents: used for comparison */
571
+ const normalizedString = (a) => (a || '').normalize('NFD').replace(/[\u0300-\u036f]/g, '');
572
+ const decorateDataSource = (dataSource, subString) => dataSource.map((it) => decorateItem(it, subString));
573
+ const decorateItem = (item, tx) => {
574
+ const index = normalizedString(item.label)
575
+ .toLowerCase()
576
+ .indexOf(normalizedString(tx).toLowerCase());
577
+ const labelPrefix = index === -1 ? item.label : item.label.substr(0, index);
578
+ const labelMatch = index === -1 ? '' : item.label.substr(index, tx.length);
579
+ const labelPostfix = index === -1 ? '' : item.label.substr(index + tx.length);
580
+ const newItem = {
581
+ ...item,
582
+ labelPrefix,
583
+ labelMatch,
584
+ labelPostfix
585
+ };
586
+ return newItem;
587
+ };
588
+ const findLabelForId = (data, id) => {
589
+ const found = data.find((it) => it.key === id);
590
+ return found ? found.label : null;
591
+ };
592
+ const selectElement = (completionList, label) => {
593
+ label = (label || '').toLowerCase();
594
+ if (!completionList || completionList.length === 0) {
595
+ return null;
596
+ }
597
+ if (completionList.length === 1) {
598
+ return completionList[0];
599
+ }
600
+ const found = completionList.find((it) => it.label.toLowerCase() === label);
601
+ return found || completionList[0];
602
+ };
603
+
604
+ class AutocompleteListComponent {
605
+ constructor() {
606
+ this.literals = {
607
+ en: {
608
+ placeholder: 'new item',
609
+ deleteLabelTemplate: 'Delete <<label>>',
610
+ addMessage: 'Add'
611
+ },
612
+ es: {
613
+ placeholder: 'nuevo elemento',
614
+ deleteLabelTemplate: 'Eliminar <<label>>',
615
+ addMessage: 'Añadir'
616
+ }
617
+ };
618
+ this.internalDataSource = [];
619
+ this.autoPopulate = false;
620
+ this._value = [];
621
+ this.labels = [];
622
+ this.canAdd = false;
623
+ this.touched = false;
624
+ this._lang = languageDetector();
625
+ this.dataSource = [];
626
+ this.disabled = false;
627
+ this.required = false;
628
+ this.resolveLabelsFunction = undefined;
629
+ this.populateFunction = undefined;
630
+ this.valueChange = new EventEmitter();
631
+ // ControlValueAccessor Interface
632
+ this.onChange = (value) => { };
633
+ this.onTouched = () => { };
634
+ }
635
+ set value(val) {
636
+ if (val === this._value) {
637
+ return;
638
+ }
639
+ const initialAndEmpty = isInitialAndEmpty(this._value, val);
640
+ this._value = val;
641
+ this.ensureLabelsForIds();
642
+ this.populateWith('');
643
+ this.onChange(this._value);
644
+ if (!initialAndEmpty) {
645
+ this.valueChange.emit(this._value);
646
+ }
647
+ }
648
+ get value() {
649
+ return this._value;
650
+ }
651
+ get lang() {
652
+ return this._lang;
653
+ }
654
+ set lang(l) {
655
+ if (l === this._lang) {
656
+ return;
657
+ }
658
+ if (Object.keys(this.literals).includes(l)) {
659
+ this._lang = l;
660
+ }
661
+ else {
662
+ this._lang = 'en';
663
+ }
664
+ }
665
+ writeValue(value) {
666
+ this.value = value;
667
+ }
668
+ registerOnChange(onChange) {
669
+ this.onChange = onChange;
670
+ }
671
+ registerOnTouched(onTouched) {
672
+ this.onTouched = onTouched;
673
+ }
674
+ markAsTouched() {
675
+ if (!this.touched && !this.disabled) {
676
+ this.onTouched();
677
+ this.touched = true;
678
+ }
679
+ }
680
+ setDisabledState(disabled) {
681
+ this.disabled = disabled;
682
+ }
683
+ // End ControlValueAccessor Interface
684
+ // Validator interface
685
+ registerOnValidatorChange() { }
686
+ validate(control) {
687
+ const value = control.value;
688
+ if (this.required &&
689
+ (value === '' || value === null || value === undefined)) {
690
+ return { required: { value, reason: 'Required field.' } };
691
+ }
692
+ return null;
693
+ }
694
+ // End of Validator interface
695
+ ngOnInit() {
696
+ this.inputId = this.inputId
697
+ ? this.inputId
698
+ : `autocompletelist${AutocompleteListComponent.idCounter++}`;
699
+ this.autoPopulate =
700
+ !!this.resolveLabelsFunction && !!this.populateFunction && this.instance;
701
+ this.ensureLabelsForIds();
702
+ }
703
+ ensureLabelsForIds() {
704
+ if (this.autoPopulate && this.resolveLabelsFunction) {
705
+ this.resolveLabelsFunction(this.instance, this._value)
706
+ .pipe(first())
707
+ .subscribe((data) => {
708
+ const res = [];
709
+ (this._value || []).map((id) => {
710
+ const found = data.find((it) => it.key === id);
711
+ if (found) {
712
+ res.push(found.label);
713
+ }
714
+ else {
715
+ res.push('(unset)');
716
+ }
717
+ });
718
+ this.labels = res;
719
+ });
720
+ }
721
+ else if (this.dataSource) {
722
+ const res = [];
723
+ (this._value || []).map((id) => {
724
+ const found = this.dataSource.find((it) => it.key === id);
725
+ if (found) {
726
+ res.push(found.label);
727
+ }
728
+ else {
729
+ res.push('(unset)');
730
+ }
731
+ });
732
+ this.labels = res;
733
+ }
734
+ else {
735
+ this.labels = this._value.map((it) => (it ? it.toString() : '(unset)'));
736
+ }
737
+ }
738
+ removeAt(index) {
739
+ if (this._value.length > index) {
740
+ const key = this._value.splice(index, 1)[0];
741
+ const label = this.labels.splice(index, 1)[0];
742
+ this.internalDataSource.push({ key, label });
743
+ }
744
+ this.markAsTouched();
745
+ }
746
+ onValueChange() {
747
+ this.updateCanAdd();
748
+ }
749
+ onNewEntryChange(event, auto) {
750
+ if (event.key === 'Enter' && !!auto.value) {
751
+ this.addNew(auto);
752
+ }
753
+ else if (event.key === 'Delete' || event.key === 'Backspace') {
754
+ // todo
755
+ }
756
+ else {
757
+ this.populateWith(auto.label + event.key);
758
+ }
759
+ this.updateCanAdd();
760
+ }
761
+ populateWith(searchText) {
762
+ if (this.autoPopulate && this.populateFunction && this.instance) {
763
+ this.populateFunction(this.instance, searchText)
764
+ .pipe(first())
765
+ .subscribe((data) => {
766
+ this.internalDataSource = data.filter((it) => !(this._value || []).includes(it.key));
767
+ });
768
+ }
769
+ else if (this.dataSource) {
770
+ this.internalDataSource = this.dataSource.filter((it) => !(this._value || []).includes(it.key));
771
+ }
772
+ }
773
+ updateCanAdd() {
774
+ this.canAdd =
775
+ !this.disabled &&
776
+ this.auto &&
777
+ !!this.auto.value && // has value
778
+ !this.value.find((it) => it === this.auto.value); // not already in
779
+ }
780
+ addNew(auto) {
781
+ this.value.push(auto.value);
782
+ this.ensureLabelsForIds();
783
+ this.newEntry = '';
784
+ this.internalDataSource = this.internalDataSource.filter((it) => !this._value.includes(it.key));
785
+ this.markAsTouched();
786
+ }
787
+ getDeleteMessage(label) {
788
+ return (this.deleteLabelTemplate ?? this.literals[this.lang].deleteLabelTemplate).replace('<<label>>', label);
789
+ }
790
+ }
791
+ AutocompleteListComponent.idCounter = 0;
792
+ AutocompleteListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: AutocompleteListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
793
+ AutocompleteListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: AutocompleteListComponent, selector: "lux-autocomplete-list", inputs: { value: "value", lang: "lang", inputId: "inputId", dataSource: "dataSource", placeholder: "placeholder", disabled: "disabled", deleteLabelTemplate: "deleteLabelTemplate", addMessage: "addMessage", required: "required", resolveLabelsFunction: "resolveLabelsFunction", populateFunction: "populateFunction", instance: "instance" }, outputs: { valueChange: "valueChange" }, providers: [
794
+ {
795
+ provide: NG_VALUE_ACCESSOR,
796
+ multi: true,
797
+ useExisting: forwardRef(() => AutocompleteListComponent)
798
+ },
799
+ {
800
+ provide: NG_VALIDATORS,
801
+ multi: true,
802
+ useExisting: forwardRef(() => AutocompleteListComponent)
803
+ }
804
+ ], viewQueries: [{ propertyName: "auto", first: true, predicate: ["auto"], descendants: true }], ngImport: i0, template: "<div [id]=\"inputId\">\n <ul>\n <li *ngFor=\"let label of labels; let index = index\">\n <span>{{ label }}</span>\n <button\n *ngIf=\"!disabled\"\n class=\"remove-item\"\n (click)=\"removeAt(index)\"\n attr.aria-label=\"{{ getDeleteMessage(label) }}\"\n ></button>\n </li>\n </ul>\n <div *ngIf=\"!disabled\" class=\"new-entry\">\n <lux-autocomplete\n #auto\n [dataSource]=\"internalDataSource\"\n [placeholder]=\"placeholder ?? literals[lang].placeholder\"\n [(value)]=\"newEntry\"\n (valueChange)=\"onValueChange()\"\n (keypress)=\"onNewEntryChange($event, auto)\"\n >\n </lux-autocomplete>\n <button\n *ngIf=\"canAdd\"\n type=\"button\"\n class=\"add-item\"\n attr.aria-label=\"addMessage ?? literals[lang].addMessage\"\n (click)=\"addNew(auto)\"\n ></button>\n </div>\n</div>\n", styles: [".new-entry{margin-left:1.5rem;display:grid;grid-template-columns:-webkit-max-content -webkit-max-content;grid-template-columns:max-content max-content}.new-entry lux-autocomplete{grid-column:1;grid-row:1}.new-entry .add-item{grid-column:2;grid-row:1;border:none;background:url(/assets/img/create.png) no-repeat .2rem .2rem;background:var(--lux-autocomplete-list-add-icon, url(/assets/img/create.png) no-repeat .2rem .2rem);background-size:1.1rem;background-size:var(--lux-autocomplete-list-add-icon-size, 1.1rem);height:1.4rem;height:var(--lux-autocomplete-list-add-icon-height, 1.4rem);width:1.4rem;width:var(--lux-autocomplete-list-add-icon-width, 1.4rem)}.remove-item{margin-left:.5rem;border:none;background:url(/assets/img/delete.svg) no-repeat .2rem .1rem;background:var(--lux-autocomplete-list-remove-icon, url(/assets/img/delete.svg) no-repeat .2rem .1rem);height:1.2rem;height:var(--lux-autocomplete-list-remove-icon-height, 1.2rem);width:1.3rem;width:var(--lux-autocomplete-list-remove-icon-width, 1.3rem);position:relative;top:.2rem;top:var(--lux-autocomplete-list-remove-icon-top, .2rem);background-size:1rem 1rem;background-size:var(--lux-autocomplete-list-remove-icon-size, 1rem 1rem)}\n"], components: [{ type: AutocompleteComponent, selector: "lux-autocomplete", inputs: ["inputId", "disabled", "readonly", "label", "canAddNewValues", "keepOpenAfterDelete", "value", "dataSource", "required", "placeholder", "resolveLabelsFunction", "populateFunction", "instance"], outputs: ["valueChange", "dataSourceChange"] }], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
805
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: AutocompleteListComponent, decorators: [{
806
+ type: Component,
807
+ args: [{ selector: 'lux-autocomplete-list', providers: [
808
+ {
809
+ provide: NG_VALUE_ACCESSOR,
810
+ multi: true,
811
+ useExisting: forwardRef(() => AutocompleteListComponent)
812
+ },
813
+ {
814
+ provide: NG_VALIDATORS,
815
+ multi: true,
816
+ useExisting: forwardRef(() => AutocompleteListComponent)
817
+ }
818
+ ], template: "<div [id]=\"inputId\">\n <ul>\n <li *ngFor=\"let label of labels; let index = index\">\n <span>{{ label }}</span>\n <button\n *ngIf=\"!disabled\"\n class=\"remove-item\"\n (click)=\"removeAt(index)\"\n attr.aria-label=\"{{ getDeleteMessage(label) }}\"\n ></button>\n </li>\n </ul>\n <div *ngIf=\"!disabled\" class=\"new-entry\">\n <lux-autocomplete\n #auto\n [dataSource]=\"internalDataSource\"\n [placeholder]=\"placeholder ?? literals[lang].placeholder\"\n [(value)]=\"newEntry\"\n (valueChange)=\"onValueChange()\"\n (keypress)=\"onNewEntryChange($event, auto)\"\n >\n </lux-autocomplete>\n <button\n *ngIf=\"canAdd\"\n type=\"button\"\n class=\"add-item\"\n attr.aria-label=\"addMessage ?? literals[lang].addMessage\"\n (click)=\"addNew(auto)\"\n ></button>\n </div>\n</div>\n", styles: [".new-entry{margin-left:1.5rem;display:grid;grid-template-columns:-webkit-max-content -webkit-max-content;grid-template-columns:max-content max-content}.new-entry lux-autocomplete{grid-column:1;grid-row:1}.new-entry .add-item{grid-column:2;grid-row:1;border:none;background:url(/assets/img/create.png) no-repeat .2rem .2rem;background:var(--lux-autocomplete-list-add-icon, url(/assets/img/create.png) no-repeat .2rem .2rem);background-size:1.1rem;background-size:var(--lux-autocomplete-list-add-icon-size, 1.1rem);height:1.4rem;height:var(--lux-autocomplete-list-add-icon-height, 1.4rem);width:1.4rem;width:var(--lux-autocomplete-list-add-icon-width, 1.4rem)}.remove-item{margin-left:.5rem;border:none;background:url(/assets/img/delete.svg) no-repeat .2rem .1rem;background:var(--lux-autocomplete-list-remove-icon, url(/assets/img/delete.svg) no-repeat .2rem .1rem);height:1.2rem;height:var(--lux-autocomplete-list-remove-icon-height, 1.2rem);width:1.3rem;width:var(--lux-autocomplete-list-remove-icon-width, 1.3rem);position:relative;top:.2rem;top:var(--lux-autocomplete-list-remove-icon-top, .2rem);background-size:1rem 1rem;background-size:var(--lux-autocomplete-list-remove-icon-size, 1rem 1rem)}\n"] }]
819
+ }], propDecorators: { auto: [{
820
+ type: ViewChild,
821
+ args: ['auto']
822
+ }], value: [{
823
+ type: Input
824
+ }], lang: [{
825
+ type: Input
826
+ }], inputId: [{
827
+ type: Input
828
+ }], dataSource: [{
829
+ type: Input
830
+ }], placeholder: [{
831
+ type: Input
832
+ }], disabled: [{
833
+ type: Input
834
+ }], deleteLabelTemplate: [{
835
+ type: Input
836
+ }], addMessage: [{
837
+ type: Input
838
+ }], required: [{
839
+ type: Input
840
+ }], resolveLabelsFunction: [{
841
+ type: Input
842
+ }], populateFunction: [{
843
+ type: Input
844
+ }], instance: [{
845
+ type: Input
846
+ }], valueChange: [{
847
+ type: Output
848
+ }] } });
849
+
850
+ class LuxBreadcrumbComponent {
851
+ constructor(route, activedRoute) {
852
+ this.route = route;
853
+ this.activedRoute = activedRoute;
854
+ this.subs = [];
855
+ this.imagePath = '../assets/img/arrow-forward.svg';
856
+ }
857
+ ngOnInit() {
858
+ this.subs.push(this.route.events
859
+ .pipe(filter((event) => event instanceof NavigationEnd))
860
+ .subscribe((_) => {
861
+ this.breadcrumbs = [];
862
+ this.addBreadcrumbs(this.activedRoute.snapshot.root, true, null);
863
+ }));
864
+ }
865
+ ngOnDestroy() {
866
+ this.subs.forEach((s) => s.unsubscribe());
867
+ this.subs = [];
868
+ }
869
+ addBreadcrumbs(activedRouteSnapshot, isRoot, urlPrefix) {
870
+ const routeConfig = activedRouteSnapshot.routeConfig;
871
+ let url = urlPrefix || '';
872
+ url += routeConfig ? '/' + this.getUrl(activedRouteSnapshot) : '';
873
+ const label = routeConfig
874
+ ? this.getLabel(activedRouteSnapshot)
875
+ : isRoot
876
+ ? 'Home'
877
+ : '';
878
+ if (label && url !== '/') {
879
+ const breadcrumb = { label, url };
880
+ this.breadcrumbs.push(breadcrumb);
881
+ }
882
+ if (activedRouteSnapshot.children.length) {
883
+ this.addBreadcrumbs(activedRouteSnapshot.children[0], false, url);
884
+ }
885
+ }
886
+ getUrl(activedRouteSnapshot) {
887
+ if (!activedRouteSnapshot.url[0]) {
888
+ return '';
889
+ }
890
+ const id = activedRouteSnapshot.params.id;
891
+ return id
892
+ ? `${activedRouteSnapshot.url[0]}/${id}`
893
+ : activedRouteSnapshot.routeConfig.path || '';
894
+ }
895
+ getLabel(activedRouteSnapshot) {
896
+ const routeConfig = activedRouteSnapshot.routeConfig;
897
+ if (!routeConfig) {
898
+ return null;
899
+ }
900
+ if (activedRouteSnapshot.data && activedRouteSnapshot.data.title) {
901
+ const data = activedRouteSnapshot.data;
902
+ if (data.objectTitle) {
903
+ return `${data.title} ${data.objectTitle}`;
904
+ }
905
+ else {
906
+ return data.title;
907
+ }
908
+ }
909
+ return activedRouteSnapshot.params.id || routeConfig.path;
910
+ }
911
+ }
912
+ LuxBreadcrumbComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxBreadcrumbComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
913
+ LuxBreadcrumbComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: LuxBreadcrumbComponent, selector: "lux-breadcrumb", ngImport: i0, template: "<ul class=\"lux-breadcrumb\">\n <li *ngFor=\"let breadcrumb of breadcrumbs; last as isLast; first as isFirst\"\n class=\"lux-breadcrumb-item\">\n <a [class.first]=\"isFirst\" routerLink=\"{{ breadcrumb.url }}\">{{ breadcrumb.label }}</a>\n <div *ngIf=\"!isLast\" class=\"lux-breadcrumb-separator\"></div>\n </li>\n</ul>\n", styles: [".lux-breadcrumb{padding:10px 12px;list-style:none;list-style-type:none}.lux-breadcrumb li{display:inline;font-size:.8em}.lux-breadcrumb li a.first{font-weight:700}.lux-breadcrumb li+li:before{padding:8px;color:#000}.lux-breadcrumb li a,ol.lux-breadcrumb li a:hover{text-decoration:underline}.lux-breadcrumb a{cursor:hand}.lux-breadcrumb-separator{color:red;position:relative;top:5px;height:16px;padding:0 8px;background-image:url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox%3D%220 0 512 512%22%3E %3Cpath d%3D%22M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z%22%2F%3E%3C%2Fsvg%3E\");background-repeat:no-repeat;display:inline-block}\n"], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
914
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxBreadcrumbComponent, decorators: [{
915
+ type: Component,
916
+ args: [{ selector: 'lux-breadcrumb', template: "<ul class=\"lux-breadcrumb\">\n <li *ngFor=\"let breadcrumb of breadcrumbs; last as isLast; first as isFirst\"\n class=\"lux-breadcrumb-item\">\n <a [class.first]=\"isFirst\" routerLink=\"{{ breadcrumb.url }}\">{{ breadcrumb.label }}</a>\n <div *ngIf=\"!isLast\" class=\"lux-breadcrumb-separator\"></div>\n </li>\n</ul>\n", styles: [".lux-breadcrumb{padding:10px 12px;list-style:none;list-style-type:none}.lux-breadcrumb li{display:inline;font-size:.8em}.lux-breadcrumb li a.first{font-weight:700}.lux-breadcrumb li+li:before{padding:8px;color:#000}.lux-breadcrumb li a,ol.lux-breadcrumb li a:hover{text-decoration:underline}.lux-breadcrumb a{cursor:hand}.lux-breadcrumb-separator{color:red;position:relative;top:5px;height:16px;padding:0 8px;background-image:url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 viewBox%3D%220 0 512 512%22%3E %3Cpath d%3D%22M294.1 256L167 129c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.3 34 0L345 239c9.1 9.1 9.3 23.7.7 33.1L201.1 417c-4.7 4.7-10.9 7-17 7s-12.3-2.3-17-7c-9.4-9.4-9.4-24.6 0-33.9l127-127.1z%22%2F%3E%3C%2Fsvg%3E\");background-repeat:no-repeat;display:inline-block}\n"] }]
917
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
918
+
919
+ const KEY_SPACE = ' ';
920
+ class CheckboxComponent {
921
+ constructor() {
922
+ this._lang = languageDetector();
923
+ this.label = null;
924
+ this.name = null;
925
+ this._disabled = false;
926
+ this.literals = {
927
+ en: {
928
+ yesLabel: 'Yes',
929
+ noLabel: 'No'
930
+ },
931
+ es: {
932
+ yesLabel: 'Sí',
933
+ noLabel: 'No'
934
+ }
935
+ };
936
+ this.touched = false;
937
+ this.valueChange = new EventEmitter();
938
+ // ControlValueAccessor Interface
939
+ this.onChange = (value) => { };
940
+ this.onTouched = () => { };
941
+ }
942
+ set lang(l) {
943
+ if (l === this._lang) {
944
+ return;
945
+ }
946
+ if (Object.keys(this.literals).includes(l)) {
947
+ this._lang = l;
948
+ }
949
+ else {
950
+ this._lang = 'en';
951
+ }
952
+ }
953
+ get lang() {
954
+ return this._lang;
955
+ }
956
+ get value() {
957
+ return this.internalValue;
958
+ }
959
+ set value(v) {
960
+ if (this.internalValue === v) {
961
+ return;
962
+ }
963
+ const initialAndEmpty = isInitialAndEmpty(this.internalValue, v);
964
+ this.internalValue = v;
965
+ this.syncModel();
966
+ this.onChange(v);
967
+ if (!initialAndEmpty) {
968
+ this.valueChange.emit(v);
969
+ }
970
+ }
971
+ get tabindexValue() {
972
+ return this.disabled ? null : '0';
973
+ }
974
+ get disabled() {
975
+ return this._disabled;
976
+ }
977
+ set disabled(v) {
978
+ if (v === this._disabled) {
979
+ return;
980
+ }
981
+ this._disabled = v;
982
+ this.syncModel();
983
+ }
984
+ writeValue(value) {
985
+ this.value = !!value;
986
+ }
987
+ registerOnChange(onChange) {
988
+ this.onChange = onChange;
989
+ }
990
+ registerOnTouched(onTouched) {
991
+ this.onTouched = onTouched;
992
+ }
993
+ markAsTouched() {
994
+ if (!this.touched) {
995
+ this.onTouched();
996
+ this.touched = true;
997
+ }
998
+ }
999
+ setDisabledState(disabled) {
1000
+ this.disabled = disabled;
1001
+ }
1002
+ // End ControlValueAccessor Interface
1003
+ ngOnInit() {
1004
+ this.inputId = this.inputId
1005
+ ? this.inputId
1006
+ : `${this.name || 'checkbox'}$${CheckboxComponent.idCounter++}`;
1007
+ }
1008
+ ngAfterViewInit() {
1009
+ this.syncModel();
1010
+ }
1011
+ clicked() {
1012
+ if (!this.disabled) {
1013
+ this.value = !this.internalValue;
1014
+ this.markAsTouched();
1015
+ }
1016
+ }
1017
+ onKey(event) {
1018
+ if (event.key === KEY_SPACE && !this.disabled) {
1019
+ this.value = !this.internalValue;
1020
+ this.markAsTouched();
1021
+ event.preventDefault();
1022
+ }
1023
+ }
1024
+ syncModel() {
1025
+ if (this.ck) {
1026
+ this.ck.nativeElement.checked = this.internalValue;
1027
+ }
1028
+ }
1029
+ }
1030
+ CheckboxComponent.idCounter = 0;
1031
+ CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1032
+ CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: CheckboxComponent, selector: "lux-checkbox", inputs: { lang: "lang", value: "value", label: "label", name: "name", disabled: "disabled", inputId: "inputId" }, outputs: { valueChange: "valueChange" }, providers: [
1033
+ {
1034
+ provide: NG_VALUE_ACCESSOR,
1035
+ multi: true,
1036
+ useExisting: forwardRef(() => CheckboxComponent)
1037
+ }
1038
+ ], viewQueries: [{ propertyName: "ck", first: true, predicate: ["ck"], descendants: true }], ngImport: i0, template: "<div class=\"switch\">\n <div>\n <label *ngIf=\"label\" [for]=\"inputId\">{{ label }}</label>\n </div>\n <div *ngIf=\"!disabled\" class=\"switch-item\" (click)=\"clicked()\">\n <input #ck [name]=\"name\" type=\"checkbox\" [id]=\"inputId\" />\n <div\n class=\"slider round\"\n [class.on]=\"value\"\n [class.disabled]=\"disabled\"\n [tabindex]=\"tabindexValue\"\n (keyup)=\"onKey($event)\"\n ></div>\n </div>\n <div>\n <span class=\"checkbox-label\" *ngIf=\"value\">{{\n literals[lang].yesLabel\n }}</span>\n <span class=\"checkbox-label\" *ngIf=\"!value\">{{\n literals[lang].noLabel\n }}</span>\n </div>\n</div>\n", styles: [".switch{display:flex;flex-flow:row wrap;align-items:center}label{padding-right:1.1rem}.switch-item{padding-right:.5em}.slider.round{border-radius:.7rem;width:3.1rem;height:1.4rem}.slider.round:before{border-radius:50%}.switch input{opacity:0;width:0;height:0}.slider{cursor:pointer;position:relative;top:-.7rem;background-color:#ccc;transition:.4s}.slider.on{background-color:#2196f3}.slider:before{position:absolute;content:\"\";height:1rem;width:1rem;left:.2rem;bottom:.2rem;background-color:#fff;transition:.4s}.slider.on:before{transform:translate(26px)}input:focus+.slider{box-shadow:0 0 1px #2196f3}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CheckboxComponent, decorators: [{
1040
+ type: Component,
1041
+ args: [{ selector: 'lux-checkbox', providers: [
1042
+ {
1043
+ provide: NG_VALUE_ACCESSOR,
1044
+ multi: true,
1045
+ useExisting: forwardRef(() => CheckboxComponent)
1046
+ }
1047
+ ], template: "<div class=\"switch\">\n <div>\n <label *ngIf=\"label\" [for]=\"inputId\">{{ label }}</label>\n </div>\n <div *ngIf=\"!disabled\" class=\"switch-item\" (click)=\"clicked()\">\n <input #ck [name]=\"name\" type=\"checkbox\" [id]=\"inputId\" />\n <div\n class=\"slider round\"\n [class.on]=\"value\"\n [class.disabled]=\"disabled\"\n [tabindex]=\"tabindexValue\"\n (keyup)=\"onKey($event)\"\n ></div>\n </div>\n <div>\n <span class=\"checkbox-label\" *ngIf=\"value\">{{\n literals[lang].yesLabel\n }}</span>\n <span class=\"checkbox-label\" *ngIf=\"!value\">{{\n literals[lang].noLabel\n }}</span>\n </div>\n</div>\n", styles: [".switch{display:flex;flex-flow:row wrap;align-items:center}label{padding-right:1.1rem}.switch-item{padding-right:.5em}.slider.round{border-radius:.7rem;width:3.1rem;height:1.4rem}.slider.round:before{border-radius:50%}.switch input{opacity:0;width:0;height:0}.slider{cursor:pointer;position:relative;top:-.7rem;background-color:#ccc;transition:.4s}.slider.on{background-color:#2196f3}.slider:before{position:absolute;content:\"\";height:1rem;width:1rem;left:.2rem;bottom:.2rem;background-color:#fff;transition:.4s}.slider.on:before{transform:translate(26px)}input:focus+.slider{box-shadow:0 0 1px #2196f3}\n"] }]
1048
+ }], ctorParameters: function () { return []; }, propDecorators: { ck: [{
1049
+ type: ViewChild,
1050
+ args: ['ck', { static: false }]
1051
+ }], lang: [{
1052
+ type: Input
1053
+ }], value: [{
1054
+ type: Input
1055
+ }], label: [{
1056
+ type: Input
1057
+ }], name: [{
1058
+ type: Input
1059
+ }], disabled: [{
1060
+ type: Input
1061
+ }], inputId: [{
1062
+ type: Input
1063
+ }], valueChange: [{
1064
+ type: Output
1065
+ }] } });
1066
+
1067
+ class DatetimeComponent {
1068
+ constructor() {
1069
+ this.touched = false;
1070
+ this.dirty = false;
1071
+ this.lastErrors = null;
1072
+ this.dateValue = undefined;
1073
+ this.timeValue = undefined;
1074
+ this.userErrors = {
1075
+ en: {
1076
+ required: 'Required field.',
1077
+ min: 'Minimum value is $min.',
1078
+ max: 'Maximum value is $max.'
1079
+ },
1080
+ es: {
1081
+ required: 'El campo es obligatorio.',
1082
+ min: 'El valor mínimo es $min.',
1083
+ max: 'El valor máximo es $max.'
1084
+ }
1085
+ };
1086
+ this.min = '1900-01-01T00:00:00Z';
1087
+ this.max = '2100-01-01T00:00:00Z';
1088
+ this.includeSeconds = true;
1089
+ this.localTime = true;
1090
+ this.lang = languageDetector();
1091
+ this.inlineErrors = false;
1092
+ this.readonly = null;
1093
+ this.valueChange = new EventEmitter();
1094
+ this.keyPress = new EventEmitter();
1095
+ this.onChange = (_value) => { };
1096
+ this.onTouched = () => { };
1097
+ }
1098
+ get className() {
1099
+ return this.checkClassName();
1100
+ }
1101
+ set disabled(v) {
1102
+ v = typeof v === 'string' && v !== 'false' ? true : v;
1103
+ this._disabled = v;
1104
+ }
1105
+ get disabled() {
1106
+ return this._disabled;
1107
+ }
1108
+ set required(v) {
1109
+ this._required = v;
1110
+ }
1111
+ get required() {
1112
+ return this._required;
1113
+ }
1114
+ set value(v) {
1115
+ if (v === this._value) {
1116
+ return; // prevent events when there is no changes
1117
+ }
1118
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
1119
+ const datetime = new Date(v);
1120
+ if (!v) {
1121
+ this._value = null;
1122
+ this.setDateInControl(null);
1123
+ this.setTimeInControl(null);
1124
+ }
1125
+ else if (!isValidDate(datetime)) {
1126
+ this._value = v;
1127
+ // we don't set value in control if the value is not valid
1128
+ // if we do, the content of the control changes and can erase what the user is typing
1129
+ }
1130
+ else {
1131
+ this._value = datetime.toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1132
+ this.setValueInControl(datetime);
1133
+ }
1134
+ this.onChange(v);
1135
+ if (!initialAndEmpty) {
1136
+ this.valueChange.emit(v);
1137
+ }
1138
+ }
1139
+ get value() {
1140
+ return this._value;
1141
+ }
1142
+ // ControlValueAccessor Interface implementation
1143
+ writeValue(value) {
1144
+ this.value = value;
1145
+ }
1146
+ registerOnChange(onChange) {
1147
+ this.onChange = onChange;
1148
+ }
1149
+ registerOnTouched(onTouched) {
1150
+ this.onTouched = onTouched;
1151
+ }
1152
+ markAsTouched() {
1153
+ if (!this.touched) {
1154
+ this.onTouched();
1155
+ this.touched = true;
1156
+ }
1157
+ }
1158
+ setDisabledState(disabled) {
1159
+ this.disabled = disabled;
1160
+ }
1161
+ // End of ControlValueAccessor Interface implementation
1162
+ setDateInControl(date) {
1163
+ // this.dateInput.nativeElement.value = date;
1164
+ this.dateValue = date;
1165
+ }
1166
+ setTimeInControl(time) {
1167
+ // this.timeInput.nativeElement.value = time;
1168
+ this.timeValue = time;
1169
+ }
1170
+ setValueInControl(datetime) {
1171
+ const offsetDatetime = this.localTime
1172
+ ? addTimezoneOffset(datetime)
1173
+ : datetime;
1174
+ const offsetDatetimeString = offsetDatetime.toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1175
+ this.setDateInControl(offsetDatetimeString.slice(0, 10)); // YYYY-MM-DD
1176
+ if (this.includeSeconds) {
1177
+ this.setTimeInControl(offsetDatetimeString.slice(11, 19)); // hh:mm:ss
1178
+ }
1179
+ else {
1180
+ this.setTimeInControl(offsetDatetimeString.slice(11, 16)); // hh:mm
1181
+ }
1182
+ }
1183
+ clear() {
1184
+ this.setDateInControl(null);
1185
+ this.setTimeInControl(null);
1186
+ this.value = null;
1187
+ }
1188
+ isClearable() {
1189
+ return hasValue(this.value);
1190
+ }
1191
+ // Validator interface
1192
+ registerOnValidatorChange() { }
1193
+ validate(control) {
1194
+ const value = control.value;
1195
+ let result = null;
1196
+ if (this.required &&
1197
+ !hasValue(value) &&
1198
+ !hasValue(this.dateValue) &&
1199
+ !hasValue(this.timeValue)) {
1200
+ result = result || {};
1201
+ result.required = { value, reason: 'Required field.' };
1202
+ }
1203
+ if (!hasValue(this.dateValue) && hasValue(this.timeValue)) {
1204
+ result = result || {};
1205
+ result.existsDate = {
1206
+ value,
1207
+ reason: 'Date not specified.'
1208
+ };
1209
+ }
1210
+ if (hasValue(this.dateValue) && !hasValue(this.timeValue)) {
1211
+ result = result || {};
1212
+ result.existsTime = {
1213
+ value,
1214
+ reason: 'Time not specified.'
1215
+ };
1216
+ }
1217
+ if (hasValue(this.min) &&
1218
+ hasValue(value) &&
1219
+ hasValue(this.dateValue) &&
1220
+ hasValue(this.timeValue) &&
1221
+ String(value).localeCompare(this.min) === -1) {
1222
+ result = result || {};
1223
+ result.min = {
1224
+ value,
1225
+ min: this.min,
1226
+ reason: `Value is lower than minimum value: ${this.min}.`
1227
+ };
1228
+ }
1229
+ if (hasValue(this.max) &&
1230
+ hasValue(value) &&
1231
+ hasValue(this.dateValue) &&
1232
+ hasValue(this.timeValue) &&
1233
+ String(value).localeCompare(this.max) !== -1) {
1234
+ result = result || {};
1235
+ result.max = {
1236
+ value,
1237
+ max: this.max,
1238
+ reason: `Value is greater than than maximum value: ${this.max}.`
1239
+ };
1240
+ }
1241
+ this.lastErrors = result;
1242
+ return result;
1243
+ }
1244
+ // End of Validator interface
1245
+ ngOnInit() {
1246
+ this.inputId = this.inputId
1247
+ ? this.inputId
1248
+ : `datetime$${DatetimeComponent.idCounter++}`;
1249
+ this.setPatterns();
1250
+ }
1251
+ onLostFocus() {
1252
+ this.markAsTouched();
1253
+ }
1254
+ onKeyPress(event) {
1255
+ this.keyPress.emit(event);
1256
+ }
1257
+ onEventDatetime(newDate, newTime) {
1258
+ if (this.disabled || this.readonly) {
1259
+ return;
1260
+ }
1261
+ const newValue = '' + newDate + ' ' + newTime;
1262
+ if (!newValue) {
1263
+ this.value = null;
1264
+ }
1265
+ else {
1266
+ const datetime = new Date(newValue);
1267
+ if (isValidDate(datetime)) {
1268
+ let datetimeString;
1269
+ if (this.localTime) {
1270
+ datetimeString = datetime.toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1271
+ }
1272
+ else {
1273
+ datetimeString = addTimezoneOffset(datetime).toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1274
+ }
1275
+ if (this.includeSeconds) {
1276
+ this.value = datetimeString.slice(0, 19) + 'Z'; // YYYY-MM-DDThh:mm:ssZ
1277
+ }
1278
+ else {
1279
+ this.value = datetimeString.slice(0, 16) + 'Z'; // YYYY-MM-DDThh:mmZ
1280
+ }
1281
+ }
1282
+ else {
1283
+ this.value = newValue;
1284
+ }
1285
+ }
1286
+ }
1287
+ checkClassName() {
1288
+ return this.disabled
1289
+ ? this.readonly
1290
+ ? 'disabled readonly'
1291
+ : 'disabled'
1292
+ : this.readonly
1293
+ ? 'readonly'
1294
+ : '';
1295
+ }
1296
+ setPatterns() {
1297
+ this.min = this.min || '1900-01-01';
1298
+ this.max = this.max || '2100-01-01';
1299
+ }
1300
+ }
1301
+ DatetimeComponent.idCounter = 0;
1302
+ DatetimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: DatetimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1303
+ DatetimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: DatetimeComponent, selector: "lux-datetime", inputs: { min: "min", max: "max", includeSeconds: "includeSeconds", localTime: "localTime", lang: "lang", inlineErrors: "inlineErrors", inputId: "inputId", ariaLabel: ["aria-label", "ariaLabel"], readonly: "readonly", disabled: "disabled", required: "required", value: "value" }, outputs: { valueChange: "valueChange", keyPress: "keyPress" }, providers: [
1304
+ {
1305
+ provide: NG_VALUE_ACCESSOR,
1306
+ multi: true,
1307
+ useExisting: forwardRef(() => DatetimeComponent)
1308
+ },
1309
+ {
1310
+ provide: NG_VALIDATORS,
1311
+ multi: true,
1312
+ useExisting: forwardRef(() => DatetimeComponent)
1313
+ }
1314
+ ], viewQueries: [{ propertyName: "dateInput", first: true, predicate: ["dateInput"], descendants: true, static: true }, { propertyName: "timeInput", first: true, predicate: ["timeInput"], descendants: true, static: true }], ngImport: i0, template: "<input\n #dateInput\n class=\"rounded-left prefix\"\n [ngClass]=\"className\"\n type=\"date\"\n [id]=\"inputId + '$date'\"\n [(ngModel)]=\"dateValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [placeholder]=\"\"\n (keyup)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (change)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<input\n #timeInput\n [class]=\"(disabled || readonly || !isClearable()) && localTime ? 'rounded-right' : ''\"\n [ngClass]=\"className\"\n type=\"time\"\n [id]=\"inputId + '$time'\"\n [(ngModel)]=\"timeValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [placeholder]=\"\"\n [step]=\"includeSeconds ? 1 : 60\"\n (keyup)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (change)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<ng-container\n *ngIf=\"!localTime\"\n>\n <div\n [class]=\"disabled || readonly || !isClearable() ? 'rounded-right postfix symbol' : 'postfix symbol'\"\n [ngClass]=\"className\"\n >\n <span>{{ localTime ? '' : 'UTC' }}</span>\n </div>\n</ng-container>\n<button\n #clearButton\n *ngIf=\"!disabled && !readonly && isClearable()\"\n type=\"button\"\n class=\"rounded-right postfix bordered icon-clear\"\n [id]=\"inputId + '$clear'\"\n (click)=\"clear()\"\n aria-label=\"clear\"\n></button>\n\n<div *ngIf=\"inlineErrors && lastErrors && (dirty || touched)\" class=\"alert\">\n <div *ngIf=\"lastErrors.required\">\n {{ userErrors[lang].required }}\n </div>\n <div *ngIf=\"lastErrors.min\">\n {{ userErrors[lang].min.replace('$min', lastErrors.min.min) }}\n </div>\n <div *ngIf=\"lastErrors.max\">\n {{ userErrors[lang].max.replace('$max', lastErrors.max.max) }}\n </div>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}:host{display:flex;align-items:stretch}.readonly{border:none}.readonly:focus{border:none;outline:none}.disabled{background-color:#f1f1f1;background-color:var(--lux-disabled-color, #f1f1f1);border-color:#6d6d6d;border-color:var(--lux-disabled-border-color, #6d6d6d)}.icon-clear{grid-row:1;grid-column:2;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-autocomplete-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}\n"], directives: [{ type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: DatetimeComponent, decorators: [{
1316
+ type: Component,
1317
+ args: [{ selector: 'lux-datetime', providers: [
1318
+ {
1319
+ provide: NG_VALUE_ACCESSOR,
1320
+ multi: true,
1321
+ useExisting: forwardRef(() => DatetimeComponent)
1322
+ },
1323
+ {
1324
+ provide: NG_VALIDATORS,
1325
+ multi: true,
1326
+ useExisting: forwardRef(() => DatetimeComponent)
1327
+ }
1328
+ ], template: "<input\n #dateInput\n class=\"rounded-left prefix\"\n [ngClass]=\"className\"\n type=\"date\"\n [id]=\"inputId + '$date'\"\n [(ngModel)]=\"dateValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [placeholder]=\"\"\n (keyup)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (change)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<input\n #timeInput\n [class]=\"(disabled || readonly || !isClearable()) && localTime ? 'rounded-right' : ''\"\n [ngClass]=\"className\"\n type=\"time\"\n [id]=\"inputId + '$time'\"\n [(ngModel)]=\"timeValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [placeholder]=\"\"\n [step]=\"includeSeconds ? 1 : 60\"\n (keyup)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (change)=\"onEventDatetime(dateInput.value, timeInput.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<ng-container\n *ngIf=\"!localTime\"\n>\n <div\n [class]=\"disabled || readonly || !isClearable() ? 'rounded-right postfix symbol' : 'postfix symbol'\"\n [ngClass]=\"className\"\n >\n <span>{{ localTime ? '' : 'UTC' }}</span>\n </div>\n</ng-container>\n<button\n #clearButton\n *ngIf=\"!disabled && !readonly && isClearable()\"\n type=\"button\"\n class=\"rounded-right postfix bordered icon-clear\"\n [id]=\"inputId + '$clear'\"\n (click)=\"clear()\"\n aria-label=\"clear\"\n></button>\n\n<div *ngIf=\"inlineErrors && lastErrors && (dirty || touched)\" class=\"alert\">\n <div *ngIf=\"lastErrors.required\">\n {{ userErrors[lang].required }}\n </div>\n <div *ngIf=\"lastErrors.min\">\n {{ userErrors[lang].min.replace('$min', lastErrors.min.min) }}\n </div>\n <div *ngIf=\"lastErrors.max\">\n {{ userErrors[lang].max.replace('$max', lastErrors.max.max) }}\n </div>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}:host{display:flex;align-items:stretch}.readonly{border:none}.readonly:focus{border:none;outline:none}.disabled{background-color:#f1f1f1;background-color:var(--lux-disabled-color, #f1f1f1);border-color:#6d6d6d;border-color:var(--lux-disabled-border-color, #6d6d6d)}.icon-clear{grid-row:1;grid-column:2;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-autocomplete-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}\n"] }]
1329
+ }], ctorParameters: function () { return []; }, propDecorators: { dateInput: [{
1330
+ type: ViewChild,
1331
+ args: ['dateInput', { static: true }]
1332
+ }], timeInput: [{
1333
+ type: ViewChild,
1334
+ args: ['timeInput', { static: true }]
1335
+ }], min: [{
1336
+ type: Input
1337
+ }], max: [{
1338
+ type: Input
1339
+ }], includeSeconds: [{
1340
+ type: Input
1341
+ }], localTime: [{
1342
+ type: Input
1343
+ }], lang: [{
1344
+ type: Input
1345
+ }], inlineErrors: [{
1346
+ type: Input
1347
+ }], inputId: [{
1348
+ type: Input
1349
+ }], ariaLabel: [{
1350
+ type: Input,
1351
+ args: ['aria-label']
1352
+ }], readonly: [{
1353
+ type: Input
1354
+ }], disabled: [{
1355
+ type: Input
1356
+ }], required: [{
1357
+ type: Input
1358
+ }], value: [{
1359
+ type: Input
1360
+ }], valueChange: [{
1361
+ type: Output
1362
+ }], keyPress: [{
1363
+ type: Output
1364
+ }] } });
1365
+
1366
+ /** Filter component to query for objects. */
1367
+ class FilterComponent {
1368
+ constructor() {
1369
+ this.touched = false;
1370
+ this._searchValue = '';
1371
+ this.disabled = false;
1372
+ /** Placeholder default text. */
1373
+ this.placeholder = '';
1374
+ /** Search on type: (default true) Auto-search when user types in. */
1375
+ this.searchOnType = true;
1376
+ this.debounceValue = 300; // 300 ms
1377
+ /** Search value changed by user. */
1378
+ this.searchValueChange = new EventEmitter();
1379
+ this.subject = new Subject();
1380
+ // ControlValueAccessor Interface
1381
+ this.onChange = (value) => { };
1382
+ this.onTouched = () => { };
1383
+ this.recreateObservable();
1384
+ }
1385
+ /** Search value introduced by the user. */
1386
+ get searchValue() {
1387
+ return this._searchValue;
1388
+ }
1389
+ set searchValue(v) {
1390
+ v = (v || '').toString();
1391
+ if (v === this._searchValue) {
1392
+ return;
1393
+ }
1394
+ this.onChange(v);
1395
+ this._searchValue = v;
1396
+ }
1397
+ /** Debounce time in milliseconds. (defaults to 300 ms) */
1398
+ set debounce(val) {
1399
+ this.debounceValue = val;
1400
+ this.recreateObservable();
1401
+ }
1402
+ get debounce() {
1403
+ return this.debounceValue;
1404
+ }
1405
+ writeValue(value) {
1406
+ this.searchValue = (value || '').toString();
1407
+ }
1408
+ registerOnChange(onChange) {
1409
+ this.onChange = onChange;
1410
+ }
1411
+ registerOnTouched(onTouched) {
1412
+ this.onTouched = onTouched;
1413
+ }
1414
+ markAsTouched() {
1415
+ if (!this.touched) {
1416
+ this.onTouched();
1417
+ this.touched = true;
1418
+ }
1419
+ }
1420
+ setDisabledState(disabled) {
1421
+ this.disabled = disabled;
1422
+ }
1423
+ // End ControlValueAccessor Interface
1424
+ ngOnInit() {
1425
+ this.inputId = this.inputId
1426
+ ? this.inputId
1427
+ : `filter$${FilterComponent.idCounter++}`;
1428
+ }
1429
+ ngOnDestroy() {
1430
+ this.freeSubscriptions();
1431
+ }
1432
+ clear() {
1433
+ this.searchValue = '';
1434
+ this.search();
1435
+ }
1436
+ search() {
1437
+ this.searchValueChange.emit(this.searchValue);
1438
+ }
1439
+ keyup(event, newValue) {
1440
+ this.markAsTouched();
1441
+ this.searchValue = newValue;
1442
+ if (event.key === 'Enter') {
1443
+ this.searchNow(this.searchValue);
1444
+ }
1445
+ if (this.searchOnType) {
1446
+ this.addEvent();
1447
+ }
1448
+ }
1449
+ onInputValueChange(newValue) {
1450
+ this.markAsTouched();
1451
+ this.searchValue = newValue;
1452
+ }
1453
+ recreateObservable() {
1454
+ this.searchValue$ = this.subject
1455
+ .asObservable()
1456
+ .pipe(debounceTime(this.debounce));
1457
+ this.freeSubscriptions();
1458
+ this.sub = this.searchValue$.subscribe((value) => {
1459
+ this.searchValueChange.emit(value);
1460
+ });
1461
+ }
1462
+ freeSubscriptions() {
1463
+ if (this.sub) {
1464
+ this.sub.unsubscribe();
1465
+ this.sub = null;
1466
+ }
1467
+ }
1468
+ searchNow(value) {
1469
+ this.searchValueChange.emit(value);
1470
+ }
1471
+ addEvent() {
1472
+ this.subject.next(this.searchValue);
1473
+ }
1474
+ }
1475
+ FilterComponent.idCounter = 0;
1476
+ FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1477
+ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: FilterComponent, selector: "lux-filter", inputs: { disabled: "disabled", inputId: "inputId", placeholder: "placeholder", searchValue: "searchValue", searchOnType: "searchOnType", ariaLabel: ["aria-label", "ariaLabel"], debounce: "debounce" }, outputs: { searchValueChange: "searchValueChange" }, providers: [
1478
+ {
1479
+ provide: NG_VALUE_ACCESSOR,
1480
+ multi: true,
1481
+ useExisting: forwardRef(() => FilterComponent)
1482
+ }
1483
+ ], ngImport: i0, template: "<div class=\"filter\">\n <input\n #i0\n type=\"text\"\n [attr.aria-label]=\"ariaLabel\"\n [placeholder]=\"placeholder\"\n [id]=\"inputId\"\n [disabled]=\"disabled\"\n [value]=\"searchValue\"\n (valueChange)=\"onInputValueChange(i0.value)\"\n (keyup)=\"keyup($event, i0.value)\"\n />\n\n <button\n [class.hide]=\"!searchValue\"\n aria-label=\"Clear\"\n class=\"clear-indicator icon icon-clear\"\n type=\"button\"\n (click)=\"clear()\"\n ></button>\n <i *ngIf=\"1 || searchOnType\" class=\"search-indicator icon icon-search\"></i>\n <button\n class=\"btn-search\"\n *ngIf=\"!searchOnType\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"search()\"\n >\n Search\n </button>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.filter{display:grid;grid-template-columns:auto 1.5rem 1.5rem .5rem auto}.filter input{grid-row:1;grid-column-start:1;grid-column-end:4}.filter .hide{visibility:collapse}.filter .clear-indicator{grid-row:1;grid-column:2;border:none}.filter .search-indicator{grid-row:1;grid-column:3}.filter .btn-search{grid-row:1;grid-column:5}.filter .icon-search{background:url(/assets/img/filter-search.png) no-repeat center;background:var(--lux-filter-icon-search, url(/assets/img/filter-search.png) no-repeat center);background-size:1rem;background-size:var(--lux-filter-icon-bg-size, 1rem);background-position:center;width:1rem;width:var(--lux-filter-icon-width, 1rem)}.filter .icon-clear{background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-filter-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:1rem;background-size:var(--lux-filter-icon-bg-size, 1rem);background-position:center}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1484
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterComponent, decorators: [{
1485
+ type: Component,
1486
+ args: [{ selector: 'lux-filter', providers: [
1487
+ {
1488
+ provide: NG_VALUE_ACCESSOR,
1489
+ multi: true,
1490
+ useExisting: forwardRef(() => FilterComponent)
1491
+ }
1492
+ ], template: "<div class=\"filter\">\n <input\n #i0\n type=\"text\"\n [attr.aria-label]=\"ariaLabel\"\n [placeholder]=\"placeholder\"\n [id]=\"inputId\"\n [disabled]=\"disabled\"\n [value]=\"searchValue\"\n (valueChange)=\"onInputValueChange(i0.value)\"\n (keyup)=\"keyup($event, i0.value)\"\n />\n\n <button\n [class.hide]=\"!searchValue\"\n aria-label=\"Clear\"\n class=\"clear-indicator icon icon-clear\"\n type=\"button\"\n (click)=\"clear()\"\n ></button>\n <i *ngIf=\"1 || searchOnType\" class=\"search-indicator icon icon-search\"></i>\n <button\n class=\"btn-search\"\n *ngIf=\"!searchOnType\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"search()\"\n >\n Search\n </button>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.filter{display:grid;grid-template-columns:auto 1.5rem 1.5rem .5rem auto}.filter input{grid-row:1;grid-column-start:1;grid-column-end:4}.filter .hide{visibility:collapse}.filter .clear-indicator{grid-row:1;grid-column:2;border:none}.filter .search-indicator{grid-row:1;grid-column:3}.filter .btn-search{grid-row:1;grid-column:5}.filter .icon-search{background:url(/assets/img/filter-search.png) no-repeat center;background:var(--lux-filter-icon-search, url(/assets/img/filter-search.png) no-repeat center);background-size:1rem;background-size:var(--lux-filter-icon-bg-size, 1rem);background-position:center;width:1rem;width:var(--lux-filter-icon-width, 1rem)}.filter .icon-clear{background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-filter-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:1rem;background-size:var(--lux-filter-icon-bg-size, 1rem);background-position:center}\n"] }]
1493
+ }], ctorParameters: function () { return []; }, propDecorators: { disabled: [{
1494
+ type: Input
1495
+ }], inputId: [{
1496
+ type: Input
1497
+ }], placeholder: [{
1498
+ type: Input
1499
+ }], searchValue: [{
1500
+ type: Input
1501
+ }], searchOnType: [{
1502
+ type: Input
1503
+ }], ariaLabel: [{
1504
+ type: Input,
1505
+ args: ['aria-label']
1506
+ }], debounce: [{
1507
+ type: Input
1508
+ }], searchValueChange: [{
1509
+ type: Output
1510
+ }] } });
1511
+
1512
+ class ActiveModal {
1513
+ close(result) { }
1514
+ dismiss(reason) { }
1515
+ }
1516
+ class ModalRef {
1517
+ constructor(_windowCmptRef, _contentRef, _backdropCmptRef, _beforeDismiss) {
1518
+ this._windowCmptRef = _windowCmptRef;
1519
+ this._contentRef = _contentRef;
1520
+ this._backdropCmptRef = _backdropCmptRef;
1521
+ this._beforeDismiss = _beforeDismiss;
1522
+ _windowCmptRef.instance.dismissEvent.subscribe((reason) => {
1523
+ this.dismiss(reason);
1524
+ });
1525
+ this.result = new Promise((resolve, reject) => {
1526
+ this._resolve = resolve;
1527
+ this._reject = reject;
1528
+ });
1529
+ this.result.then(null, () => { });
1530
+ }
1531
+ /**
1532
+ * The instance of a component used for the modal content.
1533
+ *
1534
+ * When a `TemplateRef` is used as the content, will return `undefined`.
1535
+ */
1536
+ get componentInstance() {
1537
+ if (this._contentRef.componentRef) {
1538
+ return this._contentRef.componentRef.instance;
1539
+ }
1540
+ }
1541
+ /**
1542
+ * Closes the modal with an optional `result` value.
1543
+ *
1544
+ * The `NgbMobalRef.result` promise will be resolved with the provided value.
1545
+ */
1546
+ close(result) {
1547
+ if (this._windowCmptRef) {
1548
+ if (this._resolve) {
1549
+ this._resolve(result);
1550
+ }
1551
+ this._removeModalElements();
1552
+ }
1553
+ }
1554
+ _dismiss(reason) {
1555
+ if (this._reject) {
1556
+ this._reject(reason);
1557
+ }
1558
+ this._removeModalElements();
1559
+ }
1560
+ /**
1561
+ * Dismisses the modal with an optional `reason` value.
1562
+ *
1563
+ * The `NgbModalRef.result` promise will be rejected with the provided value.
1564
+ */
1565
+ dismiss(reason) {
1566
+ if (this._windowCmptRef) {
1567
+ if (!this._beforeDismiss) {
1568
+ this._dismiss(reason);
1569
+ }
1570
+ else {
1571
+ const dismiss = this._beforeDismiss();
1572
+ if (dismiss && dismiss.then) {
1573
+ dismiss.then((result) => {
1574
+ if (result !== false) {
1575
+ this._dismiss(reason);
1576
+ }
1577
+ }, () => { });
1578
+ }
1579
+ else if (dismiss !== false) {
1580
+ this._dismiss(reason);
1581
+ }
1582
+ }
1583
+ }
1584
+ }
1585
+ _removeModalElements() {
1586
+ const windowNativeEl = this._windowCmptRef.location.nativeElement;
1587
+ windowNativeEl.parentNode.removeChild(windowNativeEl);
1588
+ this._windowCmptRef.destroy();
1589
+ if (this._backdropCmptRef) {
1590
+ const backdropNativeEl = this._backdropCmptRef.location.nativeElement;
1591
+ backdropNativeEl.parentNode.removeChild(backdropNativeEl);
1592
+ this._backdropCmptRef.destroy();
1593
+ }
1594
+ if (this._contentRef && this._contentRef.viewRef) {
1595
+ this._contentRef.viewRef.destroy();
1596
+ }
1597
+ this._windowCmptRef = null;
1598
+ this._backdropCmptRef = null;
1599
+ this._contentRef = null;
1600
+ }
1601
+ }
1602
+
1603
+ const FOCUS = 'focus';
1604
+ var Key;
1605
+ (function (Key) {
1606
+ Key[Key["Tab"] = 9] = "Tab";
1607
+ Key[Key["Enter"] = 13] = "Enter";
1608
+ Key[Key["Escape"] = 27] = "Escape";
1609
+ Key[Key["Space"] = 32] = "Space";
1610
+ Key[Key["PageUp"] = 33] = "PageUp";
1611
+ Key[Key["PageDown"] = 34] = "PageDown";
1612
+ Key[Key["End"] = 35] = "End";
1613
+ Key[Key["Home"] = 36] = "Home";
1614
+ Key[Key["ArrowLeft"] = 37] = "ArrowLeft";
1615
+ Key[Key["ArrowUp"] = 38] = "ArrowUp";
1616
+ Key[Key["ArrowRight"] = 39] = "ArrowRight";
1617
+ Key[Key["ArrowDown"] = 40] = "ArrowDown";
1618
+ })(Key || (Key = {}));
1619
+ const isDefined = (value) => value !== undefined && value !== null;
1620
+ class ContentRef {
1621
+ constructor(nodes, viewRef, componentRef) {
1622
+ this.nodes = nodes;
1623
+ this.viewRef = viewRef;
1624
+ this.componentRef = componentRef;
1625
+ }
1626
+ }
1627
+ const FOCUSABLE_ELEMENTS_SELECTOR = [
1628
+ 'a[href]',
1629
+ 'button:not([disabled])',
1630
+ 'input:not([disabled]):not([type="hidden"])',
1631
+ 'select:not([disabled])',
1632
+ 'textarea:not([disabled])',
1633
+ '[contenteditable]',
1634
+ '[tabindex]:not([tabindex="-1"])'
1635
+ ].join(', ');
1636
+ /**
1637
+ * Returns first and last focusable elements inside of a given element based on specific CSS selector
1638
+ */
1639
+ const getFocusableBoundaryElements = (element) => {
1640
+ const list = Array.from(element.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR)).filter((el) => el.tabIndex !== -1);
1641
+ return [list[0], list[list.length - 1]];
1642
+ };
1643
+ /**
1644
+ * Function that enforces browser focus to be trapped inside a DOM element.
1645
+ *
1646
+ * Works only for clicks inside the element and navigation with 'Tab', ignoring clicks outside of the element
1647
+ *
1648
+ * @param element The element around which focus will be trapped inside
1649
+ * @param stopFocusTrap$ The observable stream. When completed the focus trap will clean up listeners
1650
+ * and free internal resources
1651
+ * @param refocusOnClick Put the focus back to the last focused element whenever a click occurs on element (default to
1652
+ * false)
1653
+ */
1654
+ const focusTrap = (element, stopFocusTrap$, refocusOnClick = false) => {
1655
+ // last focused element
1656
+ const lastFocusedElement$ = fromEvent(element, 'focusin').pipe(takeUntil(stopFocusTrap$), map((e) => e.target));
1657
+ // 'tab' / 'shift+tab' stream
1658
+ fromEvent(element, 'keydown')
1659
+ .pipe(takeUntil(stopFocusTrap$),
1660
+ /* eslint-disable import/no-deprecated */
1661
+ filter((e) => e.which === Key.Tab),
1662
+ /* eslint-enable import/no-deprecated */
1663
+ withLatestFrom(lastFocusedElement$))
1664
+ .subscribe(([tabEvent, focusedElement]) => {
1665
+ const [first, last] = getFocusableBoundaryElements(element);
1666
+ if ((focusedElement === first || focusedElement === element) &&
1667
+ tabEvent.shiftKey) {
1668
+ last.focus();
1669
+ tabEvent.preventDefault();
1670
+ }
1671
+ if (focusedElement === last && !tabEvent.shiftKey) {
1672
+ first.focus();
1673
+ tabEvent.preventDefault();
1674
+ }
1675
+ });
1676
+ // inside click
1677
+ if (refocusOnClick) {
1678
+ fromEvent(element, 'click')
1679
+ .pipe(takeUntil(stopFocusTrap$), withLatestFrom(lastFocusedElement$), map((arr) => arr[1]))
1680
+ .subscribe((lastFocusedElement) => lastFocusedElement.focus());
1681
+ }
1682
+ };
1683
+
1684
+ var ModalDismissReasons;
1685
+ (function (ModalDismissReasons) {
1686
+ ModalDismissReasons[ModalDismissReasons["BackdropClick"] = 0] = "BackdropClick";
1687
+ ModalDismissReasons[ModalDismissReasons["Esc"] = 1] = "Esc";
1688
+ })(ModalDismissReasons || (ModalDismissReasons = {}));
1689
+
1690
+ class LuxModalWindowComponent {
1691
+ constructor(_document, _elRef) {
1692
+ this._document = _document;
1693
+ this._elRef = _elRef;
1694
+ this.backdrop = false;
1695
+ this.keyboard = true;
1696
+ this.dismissEvent = new EventEmitter();
1697
+ this.role = 'dialog';
1698
+ this.tabindex = '-1';
1699
+ this.ariamodal = true;
1700
+ }
1701
+ get class() {
1702
+ return `modal ${this.windowClass || ''}`;
1703
+ }
1704
+ get hostAriaLabelledBy() {
1705
+ return this.ariaLabelledBy;
1706
+ }
1707
+ get hostAriaDescribedBy() {
1708
+ return this.ariaDescribedBy;
1709
+ }
1710
+ backdropClick(btn) {
1711
+ if (this.backdrop === true && this._elRef.nativeElement === btn) {
1712
+ this.dismiss(ModalDismissReasons.BackdropClick);
1713
+ }
1714
+ }
1715
+ escKey(event) {
1716
+ if (this.keyboard && !event.defaultPrevented) {
1717
+ this.dismiss(ModalDismissReasons.Esc);
1718
+ }
1719
+ }
1720
+ dismiss(reason) {
1721
+ this.dismissEvent.emit(reason);
1722
+ }
1723
+ ngOnInit() {
1724
+ this._elWithFocus = this._document.activeElement;
1725
+ }
1726
+ ngAfterViewInit() {
1727
+ if (!this._elRef.nativeElement.contains(document.activeElement)) {
1728
+ const firstFocusable = getFocusableBoundaryElements(this._elRef.nativeElement)[0];
1729
+ const elementToFocus = firstFocusable || this._elRef.nativeElement;
1730
+ elementToFocus.focus();
1731
+ }
1732
+ }
1733
+ ngOnDestroy() {
1734
+ const body = this._document.body;
1735
+ const elWithFocus = this._elWithFocus;
1736
+ let elementToFocus;
1737
+ if (elWithFocus && elWithFocus[FOCUS] && body.contains(elWithFocus)) {
1738
+ elementToFocus = elWithFocus;
1739
+ }
1740
+ else {
1741
+ elementToFocus = body;
1742
+ }
1743
+ elementToFocus.focus();
1744
+ this._elWithFocus = null;
1745
+ }
1746
+ }
1747
+ LuxModalWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalWindowComponent, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1748
+ LuxModalWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: LuxModalWindowComponent, selector: "lux-modal-window", inputs: { ariaDescribedBy: "ariaDescribedBy", ariaLabelledBy: "ariaLabelledBy", backdrop: "backdrop", keyboard: "keyboard", windowClass: "windowClass" }, outputs: { dismissEvent: "dismissEvent" }, host: { listeners: { "click": "backdropClick($event.target)", "keyup.esc": "escKey($event)" }, properties: { "class": "this.class", "attr.role": "this.role", "tabindex": "this.tabindex", "attr.aria-modal": "this.ariamodal", "attr.aria-labelledby": "this.hostAriaLabelledBy", "attr.aria-describedby": "this.hostAriaDescribedBy" } }, ngImport: i0, template: `
1749
+ <div class="modal-dialog" role="document">
1750
+ <div class="modal-content"><ng-content></ng-content></div>
1751
+ </div>
1752
+ `, isInline: true });
1753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalWindowComponent, decorators: [{
1754
+ type: Component,
1755
+ args: [{
1756
+ selector: 'lux-modal-window',
1757
+ template: `
1758
+ <div class="modal-dialog" role="document">
1759
+ <div class="modal-content"><ng-content></ng-content></div>
1760
+ </div>
1761
+ `
1762
+ }]
1763
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1764
+ type: Inject,
1765
+ args: [DOCUMENT]
1766
+ }] }, { type: i0.ElementRef }]; }, propDecorators: { ariaDescribedBy: [{
1767
+ type: Input
1768
+ }], ariaLabelledBy: [{
1769
+ type: Input
1770
+ }], backdrop: [{
1771
+ type: Input
1772
+ }], keyboard: [{
1773
+ type: Input
1774
+ }], windowClass: [{
1775
+ type: Input
1776
+ }], dismissEvent: [{
1777
+ type: Output
1778
+ }], class: [{
1779
+ type: HostBinding,
1780
+ args: ['class']
1781
+ }], role: [{
1782
+ type: HostBinding,
1783
+ args: ['attr.role']
1784
+ }], tabindex: [{
1785
+ type: HostBinding,
1786
+ args: ['tabindex']
1787
+ }], ariamodal: [{
1788
+ type: HostBinding,
1789
+ args: ['attr.aria-modal']
1790
+ }], hostAriaLabelledBy: [{
1791
+ type: HostBinding,
1792
+ args: ['attr.aria-labelledby']
1793
+ }], hostAriaDescribedBy: [{
1794
+ type: HostBinding,
1795
+ args: ['attr.aria-describedby']
1796
+ }], backdropClick: [{
1797
+ type: HostListener,
1798
+ args: ['click', ['$event.target']]
1799
+ }], escKey: [{
1800
+ type: HostListener,
1801
+ args: ['keyup.esc', ['$event']]
1802
+ }] } });
1803
+
1804
+ class LuxModalBackdropComponent {
1805
+ constructor() {
1806
+ this.class = 'modal-backdrop fade show';
1807
+ this.style = 'z-index: 1050';
1808
+ }
1809
+ }
1810
+ LuxModalBackdropComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1811
+ LuxModalBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: LuxModalBackdropComponent, selector: "lux-modal-backdrop", inputs: { backdropClass: "backdropClass" }, host: { properties: { "class": "this.class", "style": "this.style" } }, ngImport: i0, template: '', isInline: true });
1812
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalBackdropComponent, decorators: [{
1813
+ type: Component,
1814
+ args: [{
1815
+ selector: 'lux-modal-backdrop',
1816
+ template: ''
1817
+ }]
1818
+ }], propDecorators: { backdropClass: [{
1819
+ type: Input
1820
+ }], class: [{
1821
+ type: HostBinding,
1822
+ args: ['class']
1823
+ }], style: [{
1824
+ type: HostBinding,
1825
+ args: ['style']
1826
+ }] } });
1827
+
1828
+ class LuxModalConfig {
1829
+ constructor() {
1830
+ this.backdrop = true;
1831
+ }
1832
+ }
1833
+ LuxModalConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1834
+ LuxModalConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalConfig, providedIn: 'root' });
1835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModalConfig, decorators: [{
1836
+ type: Injectable,
1837
+ args: [{ providedIn: 'root' }]
1838
+ }] });
1839
+
1840
+ class ModalStack {
1841
+ constructor(_applicationRef, _document, _injector, _rendererFactory, modalConfig) {
1842
+ this._applicationRef = _applicationRef;
1843
+ this._document = _document;
1844
+ this._injector = _injector;
1845
+ this._rendererFactory = _rendererFactory;
1846
+ this.modalConfig = modalConfig;
1847
+ this._activeWindowCmptHasChanged = new Subject();
1848
+ this._modalRefs = [];
1849
+ this._windowCmpts = [];
1850
+ this._ariaHiddenValues = new Map();
1851
+ this._backdropAttributes = ['backdropClass'];
1852
+ this._windowAttributes = [
1853
+ 'ariaLabelledBy',
1854
+ 'backdrop',
1855
+ 'centered',
1856
+ 'keyboard',
1857
+ 'scrollable',
1858
+ 'size',
1859
+ 'windowClass'
1860
+ ];
1861
+ this._activeWindowCmptHasChanged.subscribe(() => {
1862
+ if (this._windowCmpts.length) {
1863
+ const activeWindowCmpt = this._windowCmpts[this._windowCmpts.length - 1];
1864
+ focusTrap(activeWindowCmpt.location.nativeElement, this._activeWindowCmptHasChanged);
1865
+ this._revertAriaHidden();
1866
+ this._setAriaHidden(activeWindowCmpt.location.nativeElement);
1867
+ }
1868
+ });
1869
+ }
1870
+ open(moduleCFR, content, options) {
1871
+ const config = Object.assign({}, this.modalConfig, options);
1872
+ const containerEl = this._document.body;
1873
+ const renderer = this._rendererFactory.createRenderer(null, null);
1874
+ const removeBodyClass = () => {
1875
+ if (!this._modalRefs.length) {
1876
+ renderer.removeClass(this._document.body, 'modal-open');
1877
+ this._revertAriaHidden();
1878
+ }
1879
+ };
1880
+ const activeModal = new ActiveModal();
1881
+ const contentRef = this.getContentRef(moduleCFR, content, activeModal);
1882
+ const backdropCmptRef = config.backdrop ? this._attachBackdrop(moduleCFR, containerEl) : null;
1883
+ const windowCmptRef = this._attachWindowComponent(moduleCFR, containerEl, contentRef);
1884
+ const modalRef = new ModalRef(windowCmptRef, contentRef, backdropCmptRef);
1885
+ this._registerModalRef(modalRef);
1886
+ this._registerWindowCmpt(windowCmptRef);
1887
+ modalRef.result.then(removeBodyClass, removeBodyClass);
1888
+ activeModal.close = (result) => {
1889
+ modalRef.close(result);
1890
+ };
1891
+ activeModal.dismiss = (reason) => {
1892
+ modalRef.dismiss(reason);
1893
+ };
1894
+ this._applyWindowOptions(windowCmptRef.instance, config);
1895
+ if (this._modalRefs.length === 1) {
1896
+ renderer.addClass(this._document.body, 'modal-open');
1897
+ }
1898
+ if (backdropCmptRef && backdropCmptRef.instance) {
1899
+ this._applyBackgroundOptions(backdropCmptRef.instance, config);
1900
+ backdropCmptRef.changeDetectorRef.detectChanges();
1901
+ }
1902
+ windowCmptRef.changeDetectorRef.detectChanges();
1903
+ return modalRef;
1904
+ }
1905
+ _applyWindowOptions(windowInstance, config) {
1906
+ this._windowAttributes.forEach((optionName) => {
1907
+ if (isDefined(config[optionName])) {
1908
+ windowInstance[optionName] = config[optionName];
1909
+ }
1910
+ });
1911
+ }
1912
+ _applyBackgroundOptions(backgroudInstance, config) {
1913
+ this._backdropAttributes.forEach((optionName) => {
1914
+ if (isDefined(config[optionName])) {
1915
+ backgroudInstance[optionName] = config[optionName];
1916
+ }
1917
+ });
1918
+ }
1919
+ _revertAriaHidden() {
1920
+ this._ariaHiddenValues.forEach((value, element) => {
1921
+ if (value) {
1922
+ element.setAttribute('aria-hidden', value);
1923
+ }
1924
+ else {
1925
+ element.removeAttribute('aria-hidden');
1926
+ }
1927
+ });
1928
+ this._ariaHiddenValues.clear();
1929
+ }
1930
+ getContentRef(moduleCFR, content, activeModal) {
1931
+ if (content instanceof TemplateRef) {
1932
+ return this.createFromTemplateRef(content, activeModal);
1933
+ }
1934
+ }
1935
+ createFromTemplateRef(content, activeModal) {
1936
+ const context = {
1937
+ $implicit: activeModal,
1938
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
1939
+ close(result) {
1940
+ activeModal.close(result);
1941
+ },
1942
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
1943
+ dismiss(reason) {
1944
+ activeModal.dismiss(reason);
1945
+ }
1946
+ };
1947
+ const viewRef = content.createEmbeddedView(context);
1948
+ this._applicationRef.attachView(viewRef);
1949
+ return new ContentRef([viewRef.rootNodes], viewRef);
1950
+ }
1951
+ _attachBackdrop(moduleCFR, containerEl) {
1952
+ const backdropFactory = moduleCFR.resolveComponentFactory(LuxModalBackdropComponent);
1953
+ const backdropCmptRef = backdropFactory.create(this._injector);
1954
+ this._applicationRef.attachView(backdropCmptRef.hostView);
1955
+ containerEl.appendChild(backdropCmptRef.location.nativeElement);
1956
+ return backdropCmptRef;
1957
+ }
1958
+ _attachWindowComponent(moduleCFR, containerEl, contentRef) {
1959
+ const windowFactory = moduleCFR.resolveComponentFactory(LuxModalWindowComponent);
1960
+ const windowCmptRef = windowFactory.create(this._injector, contentRef.nodes);
1961
+ this._applicationRef.attachView(windowCmptRef.hostView);
1962
+ containerEl.appendChild(windowCmptRef.location.nativeElement);
1963
+ return windowCmptRef;
1964
+ }
1965
+ _registerModalRef(modalRef) {
1966
+ const unregisterModalRef = () => {
1967
+ const index = this._modalRefs.indexOf(modalRef);
1968
+ if (index > -1) {
1969
+ this._modalRefs.splice(index, 1);
1970
+ }
1971
+ };
1972
+ this._modalRefs.push(modalRef);
1973
+ modalRef.result.then(unregisterModalRef, unregisterModalRef);
1974
+ }
1975
+ _registerWindowCmpt(windowCmpt) {
1976
+ this._windowCmpts.push(windowCmpt);
1977
+ this._activeWindowCmptHasChanged.next(null);
1978
+ windowCmpt.onDestroy(() => {
1979
+ const index = this._windowCmpts.indexOf(windowCmpt);
1980
+ if (index > -1) {
1981
+ this._windowCmpts.splice(index, 1);
1982
+ this._activeWindowCmptHasChanged.next(null);
1983
+ }
1984
+ });
1985
+ }
1986
+ _setAriaHidden(element) {
1987
+ const parent = element.parentElement;
1988
+ if (parent && element !== this._document.body) {
1989
+ Array.from(parent.children).forEach((sibling) => {
1990
+ if (sibling !== element && sibling.nodeName !== 'SCRIPT') {
1991
+ this._ariaHiddenValues.set(sibling, sibling.getAttribute('aria-hidden'));
1992
+ sibling.setAttribute('aria-hidden', 'true');
1993
+ }
1994
+ });
1995
+ this._setAriaHidden(parent);
1996
+ }
1997
+ }
1998
+ }
1999
+ ModalStack.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ModalStack, deps: [{ token: i0.ApplicationRef }, { token: DOCUMENT }, { token: i0.Injector }, { token: i0.RendererFactory2 }, { token: LuxModalConfig }], target: i0.ɵɵFactoryTarget.Injectable });
2000
+ ModalStack.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ModalStack, providedIn: 'root' });
2001
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ModalStack, decorators: [{
2002
+ type: Injectable,
2003
+ args: [{ providedIn: 'root' }]
2004
+ }], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: undefined, decorators: [{
2005
+ type: Inject,
2006
+ args: [DOCUMENT]
2007
+ }] }, { type: i0.Injector }, { type: i0.RendererFactory2 }, { type: LuxModalConfig }]; } });
2008
+
2009
+ /**
2010
+ * A service that it allow open an close modal components
2011
+ */
2012
+ class ModalService {
2013
+ constructor(modalStack, moduleCFR) {
2014
+ this.modalStack = modalStack;
2015
+ this.moduleCFR = moduleCFR;
2016
+ }
2017
+ /**Open a modal component
2018
+ * @param content TemplateRef
2019
+ */
2020
+ open(content, options = {}) {
2021
+ return this.modalStack.open(this.moduleCFR, content, options);
2022
+ }
2023
+ }
2024
+ ModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ModalService, deps: [{ token: ModalStack }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable });
2025
+ ModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ModalService, providedIn: 'root' });
2026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ModalService, decorators: [{
2027
+ type: Injectable,
2028
+ args: [{ providedIn: 'root' }]
2029
+ }], ctorParameters: function () { return [{ type: ModalStack }, { type: i0.ComponentFactoryResolver }]; } });
2030
+
2031
+ class GeolocationService {
2032
+ constructor(http) {
2033
+ this.http = http;
2034
+ this.debouncePeriodMs = 300; // ms
2035
+ this.cacheSize = 20;
2036
+ this.lastQueriesWithResults = new Map();
2037
+ this.lastQueriesLru = [];
2038
+ this.currentSearch$ = new Subject();
2039
+ const typed$ = this.currentSearch$
2040
+ .asObservable()
2041
+ .pipe(distinctUntilChanged());
2042
+ this.currentQuery$ = typed$.pipe(debounceTime(this.debouncePeriodMs), switchMap((currentQuery) => {
2043
+ const data = this.getFromCache(currentQuery);
2044
+ if (data !== undefined) {
2045
+ return of(data);
2046
+ }
2047
+ // Nominatim search documentation:
2048
+ // https://nominatim.org/release-docs/develop/api/Search/
2049
+ const url = 'https://nominatim.openstreetmap.org/search?format=json&limit=20&q=' +
2050
+ encodeURIComponent(currentQuery);
2051
+ const headers = {
2052
+ 'Content-Type': 'application/json'
2053
+ };
2054
+ this.addToCache(currentQuery, []);
2055
+ return this.http.get(url, { headers }).pipe(map((response) => {
2056
+ const searchResults = response;
2057
+ const uniqueResults = distinct(searchResults);
2058
+ return this.addToCache(currentQuery, uniqueResults);
2059
+ }));
2060
+ }));
2061
+ }
2062
+ searchGeolocation(query) {
2063
+ this.currentSearch$.next(query);
2064
+ return this.currentQuery$;
2065
+ }
2066
+ getLabels(instance, keys) {
2067
+ const searchResults = instance.lastQueriesWithResults
2068
+ .get(instance.getLatestQuery())
2069
+ .filter((searchResult) => samePosition(searchResult, keys));
2070
+ return of(searchResults.map((searchResult) => {
2071
+ const key = {
2072
+ type: 'Point',
2073
+ coordinates: [searchResult.lon, searchResult.lat]
2074
+ };
2075
+ return {
2076
+ key,
2077
+ label: searchResult.display_name
2078
+ };
2079
+ }));
2080
+ }
2081
+ getData(instance, search) {
2082
+ return instance.searchGeolocation(search).pipe(map((searchResults) => searchResults.map((searchResult) => {
2083
+ const key = {
2084
+ type: 'Point',
2085
+ coordinates: [searchResult.lon, searchResult.lat]
2086
+ };
2087
+ const label = searchResult.display_name;
2088
+ return { key, label };
2089
+ })));
2090
+ }
2091
+ // Cache implemementation ---
2092
+ getFromCache(query) {
2093
+ if (this.lastQueriesWithResults.has(query)) {
2094
+ return this.lastQueriesWithResults.get(query);
2095
+ }
2096
+ return undefined;
2097
+ }
2098
+ addToCache(query, data) {
2099
+ if (this.lastQueriesWithResults.keys.length >= this.cacheSize) {
2100
+ const deletedQuery = this.lastQueriesLru[0];
2101
+ this.revomeFromCache(deletedQuery);
2102
+ }
2103
+ this.lastQueriesWithResults.set(query, data);
2104
+ this.lastQueriesLru.push(query);
2105
+ return data;
2106
+ }
2107
+ revomeFromCache(query) {
2108
+ this.lastQueriesWithResults.delete(query);
2109
+ const index = this.lastQueriesLru.findIndex((it) => it === query);
2110
+ this.lastQueriesLru.splice(index, 1);
2111
+ }
2112
+ getLatestQuery() {
2113
+ return this.lastQueriesLru.length
2114
+ ? this.lastQueriesLru[this.lastQueriesLru.length - 1]
2115
+ : null;
2116
+ }
2117
+ }
2118
+ GeolocationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: GeolocationService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2119
+ GeolocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: GeolocationService, providedIn: 'root' });
2120
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: GeolocationService, decorators: [{
2121
+ type: Injectable,
2122
+ args: [{ providedIn: 'root' }]
2123
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
2124
+ const samePosition = (searchResult, keys) => {
2125
+ let found = false;
2126
+ keys.forEach((item) => {
2127
+ if (searchResult.lon === item.coordinates[0] &&
2128
+ searchResult.lat === item.coordinates[1]) {
2129
+ found = true;
2130
+ }
2131
+ });
2132
+ return found;
2133
+ };
2134
+ const distinct = (data) => {
2135
+ const unique = {};
2136
+ return data.filter((r) => {
2137
+ if (unique[r.display_name]) {
2138
+ return false;
2139
+ }
2140
+ unique[r.display_name] = 1;
2141
+ return true;
2142
+ });
2143
+ };
2144
+
2145
+ let openLayersIsInstalled = false;
2146
+ class OpenLayerLoaderService {
2147
+ load() {
2148
+ if (window.ol) {
2149
+ return of(true);
2150
+ }
2151
+ const openLayerJsUrl = 'https://openlayers.org/en/v5.3.0/build/ol.js';
2152
+ const openLayerCssUrl = 'https://openlayers.org/en/v5.3.0/css/ol.css';
2153
+ if (!openLayersIsInstalled) {
2154
+ openLayersIsInstalled = true; // only try to install it once
2155
+ loadCss(openLayerCssUrl, () => { });
2156
+ return from(new Promise((resolve, _) => {
2157
+ loadScript(openLayerJsUrl, () => resolve(true));
2158
+ }));
2159
+ }
2160
+ return of(true);
2161
+ }
2162
+ }
2163
+ OpenLayerLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: OpenLayerLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2164
+ OpenLayerLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: OpenLayerLoaderService, providedIn: 'root' });
2165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: OpenLayerLoaderService, decorators: [{
2166
+ type: Injectable,
2167
+ args: [{ providedIn: 'root' }]
2168
+ }] });
2169
+ /** Dynamically load a script from url and return a callback */
2170
+ const loadScript = (url, callback) => {
2171
+ const script = document.createElement('script');
2172
+ script.type = 'text/javascript';
2173
+ if (script.readyState) {
2174
+ // for old IE
2175
+ script.onreadystatechange = () => {
2176
+ if (script.readyState === 'loaded' || script.readyState === 'complete') {
2177
+ script.onreadystatechange = null;
2178
+ callback();
2179
+ }
2180
+ };
2181
+ }
2182
+ else {
2183
+ // Others browsers
2184
+ script.onload = () => {
2185
+ callback();
2186
+ };
2187
+ }
2188
+ script.src = url;
2189
+ document.getElementsByTagName('head')[0].appendChild(script);
2190
+ };
2191
+ /** Dynamically load css from url and return a callback */
2192
+ const loadCss = (url, callback) => {
2193
+ const link = document.createElement('link');
2194
+ link.type = 'text/css';
2195
+ link.rel = 'stylesheet';
2196
+ link.type = 'text/javascript';
2197
+ link.href = url;
2198
+ link.onload = () => {
2199
+ callback();
2200
+ };
2201
+ document.getElementsByTagName('head')[0].appendChild(link);
2202
+ };
2203
+
2204
+ class MapComponent {
2205
+ constructor(olLoader) {
2206
+ this.loaded$ = new BehaviorSubject(false);
2207
+ this.valueChange = new EventEmitter();
2208
+ olLoader.load().subscribe((_) => {
2209
+ // Initialize
2210
+ this._markerSource = new ol.source.Vector();
2211
+ this._markerStyle = new ol.style.Style({
2212
+ image: new ol.style.Icon({
2213
+ anchor: [0.5, 1],
2214
+ scale: 0.25,
2215
+ src: '/assets/img/marker.png'
2216
+ })
2217
+ });
2218
+ this.loaded$.next(true);
2219
+ });
2220
+ }
2221
+ set zoom(zoom) {
2222
+ if (!isNaN(zoom)) {
2223
+ this._zoom = zoom;
2224
+ if (this._map) {
2225
+ this._map.getView().setZoom(zoom);
2226
+ }
2227
+ }
2228
+ }
2229
+ get zoom() {
2230
+ return this._zoom;
2231
+ }
2232
+ set center(center) {
2233
+ if (center && center.coordinates && center.coordinates.length === 2) {
2234
+ this._center = center;
2235
+ if (this._map) {
2236
+ this._map.getView().setCenter(ol.proj.fromLonLat(center.coordinates));
2237
+ }
2238
+ }
2239
+ }
2240
+ get center() {
2241
+ return this._center;
2242
+ }
2243
+ set readonly(readonly) {
2244
+ if (!readonly) {
2245
+ if (this._map) {
2246
+ this._map.on('click', (args) => {
2247
+ // args.coordinate is in EPSG:3857 (meters), we transform it into EPSG:4326 (degrees)
2248
+ const coordinates = ol.proj.toLonLat(args.coordinate);
2249
+ // alternatively: const lonLat = ol.proj.transform(args.coordinate,'EPSG:3857','EPSG:4326');
2250
+ this.addMarkerAtCoordinates(coordinates);
2251
+ });
2252
+ this._map.on('pointermove', (event) => {
2253
+ const pixel = this._map.getEventPixel(event.originalEvent);
2254
+ const hit = this._map.hasFeatureAtPixel(pixel);
2255
+ this._map.getViewport().style.cursor = hit ? 'move' : 'grab';
2256
+ });
2257
+ }
2258
+ }
2259
+ else {
2260
+ if (this._map) {
2261
+ this._map.on('click', (args) => { });
2262
+ this._map.on('pointermove', (event) => { });
2263
+ this._map.getViewport().style.cursor = 'grab';
2264
+ }
2265
+ }
2266
+ this._readonly = readonly;
2267
+ // reset marker coordinates so marker interactions can be created or recreated accordingly
2268
+ // to the changes to readonly
2269
+ this.markerCoordinates = this.markerCoordinates;
2270
+ }
2271
+ get readonly() {
2272
+ return this._readonly;
2273
+ }
2274
+ set markerCoordinates(markerCoordinates) {
2275
+ if (markerCoordinates && markerCoordinates.length === 2) {
2276
+ this._markerCoordinates = markerCoordinates;
2277
+ if (this._map) {
2278
+ this.addMarkerAtCoordinates(markerCoordinates);
2279
+ }
2280
+ }
2281
+ else {
2282
+ this._markerCoordinates = undefined;
2283
+ if (this._map) {
2284
+ this.removeMarker();
2285
+ }
2286
+ }
2287
+ }
2288
+ get markerCoordinates() {
2289
+ return this._markerCoordinates;
2290
+ }
2291
+ set markerPoint(markerPoint) {
2292
+ if (!markerPoint ||
2293
+ !(markerPoint.coordinates && markerPoint.coordinates.length === 2)) {
2294
+ this.markerCoordinates = undefined;
2295
+ }
2296
+ else {
2297
+ this.markerCoordinates = [
2298
+ +markerPoint.coordinates[0],
2299
+ +markerPoint.coordinates[1]
2300
+ ];
2301
+ }
2302
+ this.valueChange.emit(markerPoint);
2303
+ }
2304
+ get markerPoint() {
2305
+ return {
2306
+ type: 'Point',
2307
+ coordinates: this.markerCoordinates
2308
+ };
2309
+ }
2310
+ ngOnInit() {
2311
+ this.mapId = this.mapId ? this.mapId : 'map' + MapComponent.idCounter++;
2312
+ }
2313
+ ngAfterViewInit() {
2314
+ this.loaded$.subscribe((loaded) => {
2315
+ if (loaded) {
2316
+ this.initMap();
2317
+ }
2318
+ });
2319
+ }
2320
+ initMap() {
2321
+ this._map = new ol.Map({
2322
+ target: this.mapId,
2323
+ controls: ol.control.defaults({ attribution: false }),
2324
+ layers: [
2325
+ new ol.layer.Tile({
2326
+ source: new ol.source.OSM()
2327
+ }),
2328
+ new ol.layer.Vector({
2329
+ source: this._markerSource,
2330
+ style: this._markerStyle
2331
+ })
2332
+ ],
2333
+ view: new ol.View({
2334
+ center: ol.proj.fromLonLat(this.center !== undefined ? this.center.coordinates : [0, 0]),
2335
+ zoom: this.zoom
2336
+ })
2337
+ });
2338
+ if (this.center === undefined || this.center === null) {
2339
+ // if the center is not set, we set its default value
2340
+ if ('geolocation' in navigator) {
2341
+ navigator.geolocation.getCurrentPosition((position) => {
2342
+ this.center = {
2343
+ type: 'Point',
2344
+ coordinates: [position.coords.longitude, position.coords.latitude]
2345
+ };
2346
+ }, (error) => {
2347
+ this.center = {
2348
+ type: 'Point',
2349
+ coordinates: [0, 0]
2350
+ };
2351
+ });
2352
+ }
2353
+ else {
2354
+ this.center = {
2355
+ type: 'Point',
2356
+ coordinates: [0, 0]
2357
+ };
2358
+ }
2359
+ }
2360
+ else {
2361
+ // the center needs the map to be properly set, so if it was set before the map was initialized,
2362
+ // we set the center again to perform necessary adjustements
2363
+ this.center = this.center;
2364
+ }
2365
+ if (this.zoom === undefined || this.zoom === null) {
2366
+ // if the zoom is not set, we set its default value
2367
+ this.zoom = 18;
2368
+ }
2369
+ else {
2370
+ // the zoom needs the map to be properly set, so if it was set before the map was initialized,
2371
+ // we set the zoom again to perform necessary adjustements
2372
+ this.zoom = this.zoom;
2373
+ }
2374
+ if (this.readonly === undefined || this.readonly === null) {
2375
+ // if readonly is not set, we set its default value
2376
+ this.readonly = false;
2377
+ }
2378
+ else {
2379
+ // readonly needs the map to be properly set, so if it was set before the map was initialized,
2380
+ // we set readonly again to perform necessary adjustements
2381
+ this.readonly = this.readonly;
2382
+ }
2383
+ if (this.markerCoordinates !== undefined &&
2384
+ this.markerCoordinates !== null) {
2385
+ // the marker coordinates need the map to be properly set, so if they were set before the map was initialized,
2386
+ // we set the marker coordinates again to perform necessary adjustements
2387
+ this.markerCoordinates = this.markerCoordinates;
2388
+ }
2389
+ }
2390
+ addMarkerAtCoordinates(coordinates) {
2391
+ if (coordinates && coordinates.length === 2) {
2392
+ if (this._marker !== undefined) {
2393
+ this.removeMarker();
2394
+ }
2395
+ this._marker = new ol.Feature({
2396
+ geometry: new ol.geom.Point(
2397
+ // [lon, lat] is in EPSG:4326 (degrees), we transform it into EPSG:3857 (meters)
2398
+ ol.proj.transform(coordinates, 'EPSG:4326', 'EPSG:3857'))
2399
+ });
2400
+ this._markerSource.addFeature(this._marker);
2401
+ this._markerCoordinates = this.getMarkerCoordinates();
2402
+ if (!this.readonly) {
2403
+ const dragInteraction = new ol.interaction.Modify({
2404
+ features: new ol.Collection([this._marker]),
2405
+ style: this._markerStyle,
2406
+ pixelTolerance: 50,
2407
+ hitDetection: true
2408
+ });
2409
+ this._markerInteraction = dragInteraction;
2410
+ this._map.addInteraction(dragInteraction);
2411
+ }
2412
+ this._marker.on('change', () => {
2413
+ this._markerCoordinates = this.getMarkerCoordinates();
2414
+ }, this._marker);
2415
+ }
2416
+ }
2417
+ removeMarker() {
2418
+ if (this._marker !== undefined) {
2419
+ this._markerSource.removeFeature(this._marker);
2420
+ this._marker = undefined;
2421
+ }
2422
+ if (this._markerInteraction !== undefined) {
2423
+ this._map.getInteractions().pop();
2424
+ this._markerInteraction = undefined;
2425
+ }
2426
+ }
2427
+ getMarkerCoordinates() {
2428
+ if (this._marker === undefined || this._marker == null) {
2429
+ return this._marker;
2430
+ }
2431
+ const coordinates = this._marker.getGeometry().getCoordinates();
2432
+ // coordinates is in EPSG:3857 (meters), we transform it into EPSG:4326 (degrees)
2433
+ return ol.proj.transform(coordinates, 'EPSG:3857', 'EPSG:4326');
2434
+ }
2435
+ onResize() {
2436
+ if (this._map) {
2437
+ this._map.updateSize();
2438
+ }
2439
+ }
2440
+ }
2441
+ MapComponent.idCounter = 0;
2442
+ MapComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MapComponent, deps: [{ token: OpenLayerLoaderService }], target: i0.ɵɵFactoryTarget.Component });
2443
+ MapComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: MapComponent, selector: "lux-map", inputs: { mapId: "mapId", zoom: "zoom", center: "center", readonly: "readonly", markerCoordinates: "markerCoordinates", markerPoint: "markerPoint" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div [id]=\"mapId\" class=\"map\" (resized)=\"onResize()\"></div>\n", styles: [".map{min-height:100px;height:100%;min-width:160px;width:100%}\n"], directives: [{ type: i2.ResizedDirective, selector: "[resized]", outputs: ["resized"] }] });
2444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: MapComponent, decorators: [{
2445
+ type: Component,
2446
+ args: [{ selector: 'lux-map', template: "<div [id]=\"mapId\" class=\"map\" (resized)=\"onResize()\"></div>\n", styles: [".map{min-height:100px;height:100%;min-width:160px;width:100%}\n"] }]
2447
+ }], ctorParameters: function () { return [{ type: OpenLayerLoaderService }]; }, propDecorators: { mapId: [{
2448
+ type: Input
2449
+ }], zoom: [{
2450
+ type: Input
2451
+ }], center: [{
2452
+ type: Input
2453
+ }], readonly: [{
2454
+ type: Input
2455
+ }], markerCoordinates: [{
2456
+ type: Input
2457
+ }], markerPoint: [{
2458
+ type: Input
2459
+ }], valueChange: [{
2460
+ type: Output
2461
+ }] } });
2462
+
2463
+ class GeolocationComponent {
2464
+ constructor(modalService, locationService) {
2465
+ this.modalService = modalService;
2466
+ this.locationService = locationService;
2467
+ this.touched = false;
2468
+ this.dirty = false;
2469
+ this.lastErrors = null;
2470
+ this.latitudeValue = undefined;
2471
+ this.longitudeValue = undefined;
2472
+ this.isValidNumber = isValidNumber;
2473
+ this.i18n = {
2474
+ en: {
2475
+ lat: 'latitude',
2476
+ lon: 'longitude',
2477
+ selectLocation: 'Select location',
2478
+ location: 'Location',
2479
+ selectAction: 'Select',
2480
+ cancelAction: 'Cancel',
2481
+ closeAction: 'Close',
2482
+ typeToSearch: 'type to search',
2483
+ cardinalPoints: {
2484
+ north: 'N',
2485
+ south: 'S',
2486
+ east: 'E',
2487
+ west: 'W'
2488
+ },
2489
+ userErrors: {
2490
+ required: 'Required field.',
2491
+ minLatitude: 'Minimum latitude is $minLatitude.',
2492
+ maxLatitude: 'Maximum latitude is $maxLatitude.',
2493
+ minLongitude: 'Minimum longitude is $minLongitude.',
2494
+ maxLongitude: 'Maximum longitude is $maxLongitude.'
2495
+ }
2496
+ },
2497
+ es: {
2498
+ lat: 'latitud',
2499
+ lon: 'longitud',
2500
+ selectLocation: 'Seleccione ubicación',
2501
+ location: 'Ubicación',
2502
+ selectAction: 'Seleccionar',
2503
+ cancelAction: 'Cancelar',
2504
+ closeAction: 'Cerrar',
2505
+ typeToSearch: 'escribe para buscar',
2506
+ cardinalPoints: {
2507
+ north: 'N',
2508
+ south: 'S',
2509
+ east: 'E',
2510
+ west: 'O'
2511
+ },
2512
+ userErrors: {
2513
+ required: 'El campo es obligatorio.',
2514
+ minLatitude: 'La latitud mínima es $minLatitude.',
2515
+ maxLatitude: 'La latitud máxima es $maxLatitude.',
2516
+ minLongitude: 'La longitud mínima es $minLongitude.',
2517
+ maxLongitude: 'La longitud máxima es $maxLongitude.'
2518
+ }
2519
+ }
2520
+ };
2521
+ this.lang = languageDetector();
2522
+ this.inlineErrors = false;
2523
+ this.readonly = null;
2524
+ this.valueChange = new EventEmitter();
2525
+ this.keyPress = new EventEmitter();
2526
+ this.onChange = (value) => { };
2527
+ this.onTouched = () => { };
2528
+ }
2529
+ get className() {
2530
+ return this.checkClassName();
2531
+ }
2532
+ set disabled(v) {
2533
+ v = typeof v === 'string' && v !== 'false' ? true : v;
2534
+ this._disabled = v;
2535
+ }
2536
+ get disabled() {
2537
+ return this._disabled;
2538
+ }
2539
+ set required(v) {
2540
+ this._required = v;
2541
+ }
2542
+ get required() {
2543
+ return this._required;
2544
+ }
2545
+ set value(v) {
2546
+ if (v === this._value) {
2547
+ return; // prevent events when there is no changes
2548
+ }
2549
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
2550
+ if (v &&
2551
+ v.coordinates &&
2552
+ v.coordinates.length === 2 &&
2553
+ exists(v.coordinates[0] && exists(v.coordinates[1]))) {
2554
+ this._value = v;
2555
+ this.setLatitudeInControl(v.coordinates[1]);
2556
+ this.setLongitudeInControl(v.coordinates[0]);
2557
+ }
2558
+ else if (!v) {
2559
+ this._value = null;
2560
+ this.setLatitudeInControl(null);
2561
+ this.setLongitudeInControl(null);
2562
+ }
2563
+ else {
2564
+ this._value = v;
2565
+ // we don't set value in control if the value is not valid
2566
+ // if we do, the content of the control changes and can erase what the user is typing
2567
+ }
2568
+ this.onChange(v);
2569
+ if (!initialAndEmpty) {
2570
+ this.valueChange.emit(v);
2571
+ }
2572
+ }
2573
+ get value() {
2574
+ return this._value;
2575
+ }
2576
+ // ControlValueAccessor Interface implementation
2577
+ writeValue(value) {
2578
+ this.value = value;
2579
+ }
2580
+ registerOnChange(onChange) {
2581
+ this.onChange = onChange;
2582
+ }
2583
+ registerOnTouched(onTouched) {
2584
+ this.onTouched = onTouched;
2585
+ }
2586
+ markAsTouched() {
2587
+ if (!this.touched) {
2588
+ this.onTouched();
2589
+ this.touched = true;
2590
+ }
2591
+ }
2592
+ setDisabledState(disabled) {
2593
+ this.disabled = disabled;
2594
+ }
2595
+ // End of ControlValueAccessor Interface implementation
2596
+ setLatitudeInControl(latitude) {
2597
+ // this.latitude.nativeElement.value = latitude;
2598
+ this.latitudeValue = latitude;
2599
+ }
2600
+ setLongitudeInControl(longitude) {
2601
+ // this.longitude.nativeElement.value = longitude;
2602
+ this.longitudeValue = longitude;
2603
+ }
2604
+ clear() {
2605
+ this.setLatitudeInControl(null);
2606
+ this.setLongitudeInControl(null);
2607
+ this.value = null;
2608
+ }
2609
+ isClearable() {
2610
+ return (isValidNumber(this.latitudeValue) || isValidNumber(this.longitudeValue));
2611
+ }
2612
+ // Validator interface
2613
+ registerOnValidatorChange() { }
2614
+ validate(control) {
2615
+ const value = control.value;
2616
+ let result = null;
2617
+ if (this.required &&
2618
+ !hasValue(value) &&
2619
+ !exists(this.latitudeValue) &&
2620
+ !exists(this.longitudeValue)) {
2621
+ result = result || {};
2622
+ result.required = { value, reason: 'Required field.' };
2623
+ }
2624
+ if (!exists(this.latitudeValue) && exists(this.longitudeValue)) {
2625
+ result = result || {};
2626
+ result.existsLatitude = {
2627
+ value,
2628
+ reason: 'Latitude not specified.'
2629
+ };
2630
+ }
2631
+ if (exists(this.latitudeValue) && !exists(this.longitudeValue)) {
2632
+ result = result || {};
2633
+ result.existsLongitude = {
2634
+ value,
2635
+ reason: 'Longitude not specified.'
2636
+ };
2637
+ }
2638
+ if (exists(this.minLatitude) && this.latitudeValue < this.minLatitude) {
2639
+ result = result || {};
2640
+ result.minLatitude = {
2641
+ value,
2642
+ min: this.minLatitude,
2643
+ reason: `Latitude is lower than minimum value: ${this.minLatitude}.`
2644
+ };
2645
+ }
2646
+ if (exists(this.maxLatitude) && this.latitudeValue > this.maxLatitude) {
2647
+ result = result || {};
2648
+ result.maxLatitude = {
2649
+ value,
2650
+ max: this.maxLatitude,
2651
+ reason: `Latitude is higher than maximum value: ${this.maxLatitude}.`
2652
+ };
2653
+ }
2654
+ if (exists(this.minLongitude) && this.longitudeValue < this.minLongitude) {
2655
+ result = result || {};
2656
+ result.minLongitude = {
2657
+ value,
2658
+ min: this.minLongitude,
2659
+ reason: `Longitude is lower than minimum value: ${this.minLongitude}.`
2660
+ };
2661
+ }
2662
+ if (exists(this.maxLongitude) && this.longitudeValue > this.maxLongitude) {
2663
+ result = result || {};
2664
+ result.maxLongitude = {
2665
+ value,
2666
+ max: this.maxLongitude,
2667
+ reason: `Longitude is higher than maximum value: ${this.maxLongitude}.`
2668
+ };
2669
+ }
2670
+ this.lastErrors = result;
2671
+ return result;
2672
+ }
2673
+ // End of Validator interface
2674
+ ngOnInit() {
2675
+ this.inputId = this.inputId
2676
+ ? this.inputId
2677
+ : `geolocation$${GeolocationComponent.idCounter++}`;
2678
+ this.setPatterns();
2679
+ }
2680
+ roundToStepAndUpdateLatitudeAndLongitude(newLatitudeAndLongitude) {
2681
+ const newLatitude = roundToMultipleOf(newLatitudeAndLongitude[1], this.step);
2682
+ const newLongitude = roundToMultipleOf(newLatitudeAndLongitude[0], this.step);
2683
+ if (this.disabled || this.readonly) {
2684
+ return;
2685
+ }
2686
+ if (!exists(newLatitudeAndLongitude)) {
2687
+ this.value = null;
2688
+ }
2689
+ this.value = {
2690
+ type: 'Point',
2691
+ coordinates: [newLongitude, newLatitude]
2692
+ };
2693
+ }
2694
+ onLostFocus() {
2695
+ this.markAsTouched();
2696
+ }
2697
+ onEventLatitude(newLatitude) {
2698
+ if (this.disabled || this.readonly) {
2699
+ return;
2700
+ }
2701
+ const newLatitudeValue = isValidNumber(newLatitude) ? +newLatitude : null;
2702
+ if (!(exists(this.value) && exists(this.value.coordinates[0])) &&
2703
+ !exists(newLatitudeValue)) {
2704
+ this.value = null;
2705
+ }
2706
+ else {
2707
+ this.value = {
2708
+ type: 'Point',
2709
+ coordinates: [
2710
+ this.value ? this.value.coordinates[0] : undefined,
2711
+ newLatitudeValue
2712
+ ]
2713
+ };
2714
+ }
2715
+ this.markAsTouched();
2716
+ }
2717
+ onEventLongitude(newLongitude) {
2718
+ if (this.disabled || this.readonly) {
2719
+ return;
2720
+ }
2721
+ const newLongitudeValue = isValidNumber(newLongitude)
2722
+ ? +newLongitude
2723
+ : null;
2724
+ if (!exists(newLongitudeValue) &&
2725
+ !(exists(this.value) && exists(this._value.coordinates[1]))) {
2726
+ this.value = null;
2727
+ }
2728
+ else {
2729
+ this.value = {
2730
+ type: 'Point',
2731
+ coordinates: [
2732
+ newLongitudeValue,
2733
+ this.value ? this.value.coordinates[1] : undefined
2734
+ ]
2735
+ };
2736
+ }
2737
+ this.markAsTouched();
2738
+ }
2739
+ onKeyPress(event) {
2740
+ this.keyPress.emit(event);
2741
+ }
2742
+ checkClassName() {
2743
+ return this.disabled
2744
+ ? this.readonly
2745
+ ? 'disabled readonly'
2746
+ : 'disabled'
2747
+ : this.readonly
2748
+ ? 'readonly'
2749
+ : '';
2750
+ }
2751
+ openModalMap(modal) {
2752
+ this.modalService.open(modal).result.then((result) => {
2753
+ if (result !== 'cancel') {
2754
+ this.roundToStepAndUpdateLatitudeAndLongitude(result);
2755
+ }
2756
+ }, (_) => { });
2757
+ }
2758
+ onSearchLocationChanged(newValue, map) {
2759
+ map.markerPoint = newValue;
2760
+ map.center = map.markerPoint;
2761
+ }
2762
+ get mapTitle() {
2763
+ return this._disabled || !!this.readonly
2764
+ ? this.i18n[this.lang].location
2765
+ : this.i18n[this.lang].selectLocation;
2766
+ }
2767
+ get self() {
2768
+ return this;
2769
+ }
2770
+ getLabels(instance, keys) {
2771
+ return instance.locationService.getLabels(instance.locationService, keys);
2772
+ }
2773
+ getData(instance, search) {
2774
+ return instance.locationService.getData(instance.locationService, search);
2775
+ }
2776
+ setPatterns() {
2777
+ this.step = this.step || 0.00001; // 0.00001 degrees = 1.11 meters
2778
+ this.zoom = this.zoom || 18; // (360/2^18) degrees ~ 0.00137 degrees ~ 153 meters
2779
+ this.minLatitude = this.minLatitude || -90;
2780
+ this.maxLatitude = this.maxLatitude || +90;
2781
+ this.minLongitude = this.minLongitude || -180;
2782
+ this.maxLongitude = this.maxLongitude || +180;
2783
+ }
2784
+ }
2785
+ GeolocationComponent.idCounter = 0;
2786
+ GeolocationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: GeolocationComponent, deps: [{ token: ModalService }, { token: GeolocationService }], target: i0.ɵɵFactoryTarget.Component });
2787
+ GeolocationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: GeolocationComponent, selector: "lux-geolocation", inputs: { minLatitude: "minLatitude", maxLatitude: "maxLatitude", minLongitude: "minLongitude", maxLongitude: "maxLongitude", step: "step", zoom: "zoom", lang: "lang", inlineErrors: "inlineErrors", inputId: "inputId", ariaLabel: ["aria-label", "ariaLabel"], readonly: "readonly", disabled: "disabled", required: "required", value: "value" }, outputs: { valueChange: "valueChange", keyPress: "keyPress" }, providers: [
2788
+ {
2789
+ provide: NG_VALUE_ACCESSOR,
2790
+ multi: true,
2791
+ useExisting: forwardRef(() => GeolocationComponent)
2792
+ },
2793
+ {
2794
+ provide: NG_VALIDATORS,
2795
+ multi: true,
2796
+ useExisting: forwardRef(() => GeolocationComponent)
2797
+ }
2798
+ ], viewQueries: [{ propertyName: "latitude", first: true, predicate: ["latitude"], descendants: true, static: true }, { propertyName: "longitude", first: true, predicate: ["longitude"], descendants: true, static: true }, { propertyName: "map", first: true, predicate: ["map"], descendants: true }], ngImport: i0, template: "<input\n #latitude\n class=\"rounded-left prefix\"\n [ngClass]=\"className\"\n type=\"number\"\n [id]=\"inputId + '$latitude'\"\n [(ngModel)]=\"latitudeValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.min]=\"\n minLatitude !== undefined && minLatitude !== null\n ? minLatitude.toString()\n : undefined\n \"\n [attr.max]=\"\n maxLatitude !== undefined && maxLatitude !== null\n ? maxLatitude.toString()\n : undefined\n \"\n [attr.step]=\"\n step !== undefined && step !== null ? step.toString() : undefined\n \"\n [placeholder]=\"i18n[lang].lat\"\n (keyup)=\"onEventLatitude(latitude.value)\"\n (change)=\"onEventLatitude(latitude.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<div\n class=\"infix symbol monospace clickable\"\n [ngClass]=\"className\"\n (click)=\"openModalMap(modalMap)\">\n <span *ngIf=\"isValidNumber(latitudeValue) && latitudeValue >= 0\">{{\n i18n[lang].cardinalPoints.north\n }}</span>\n <span *ngIf=\"isValidNumber(latitudeValue) && latitudeValue < 0\">{{\n i18n[lang].cardinalPoints.south\n }}</span>\n <span *ngIf=\"!isValidNumber(latitudeValue)\">-</span>\n</div>\n<input\n #longitude\n class=\"prefix\"\n [ngClass]=\"className\"\n type=\"number\"\n [id]=\"inputId + '$longitude'\"\n [(ngModel)]=\"longitudeValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.min]=\"\n minLongitude !== undefined && minLongitude !== null\n ? minLongitude.toString()\n : undefined\n \"\n [attr.max]=\"\n maxLongitude !== undefined && maxLongitude !== null\n ? maxLongitude.toString()\n : undefined\n \"\n [attr.step]=\"\n step !== undefined && step !== null ? step.toString() : undefined\n \"\n [placeholder]=\"i18n[lang].lon\"\n (keyup)=\"onEventLongitude(longitude.value)\"\n (change)=\"onEventLongitude(longitude.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<div\n class=\"infix symbol monospace clickable\"\n [ngClass]=\"className\"\n (click)=\"openModalMap(modalMap)\"\n>\n <span *ngIf=\"isValidNumber(longitudeValue) && longitudeValue >= 0\">{{\n i18n[lang].cardinalPoints.east\n }}</span>\n <span *ngIf=\"isValidNumber(longitudeValue) && longitudeValue < 0\">{{\n i18n[lang].cardinalPoints.west\n }}</span>\n <span *ngIf=\"!isValidNumber(longitudeValue)\">-</span>\n</div>\n<div\n [class]=\"\n disabled || readonly || !isClearable()\n ? 'clickable rounded-right postfix symbol'\n : 'clickable postfix symbol'\n \"\n [ngClass]=\"className\"\n (click)=\"openModalMap(modalMap)\"\n>\n <span class=\"icon-globe\"></span>\n</div>\n<button\n #clearButton\n *ngIf=\"!disabled && !readonly && isClearable()\"\n class=\"rounded-right postfix bordered icon icon-clear\"\n [id]=\"inputId + '$clear'\"\n type=\"button\"\n (click)=\"clear()\"\n aria-label=\"clear\"\n></button>\n\n<div *ngIf=\"inlineErrors && lastErrors && (dirty || touched)\" class=\"alert\">\n <div *ngIf=\"lastErrors.required\">\n {{ i18n[lang].userErrors.required }}\n </div>\n <div *ngIf=\"lastErrors.minLatitude\">\n {{\n i18n[lang].userErrors.minLatitude.replace(\n '$minLatitude',\n lastErrors.minLatitude.min\n )\n }}\n </div>\n <div *ngIf=\"lastErrors.maxLatitude\">\n {{\n i18n[lang].userErrors.maxLatitude.replace(\n '$maxLatitude',\n lastErrors.maxLatitude.max\n )\n }}\n </div>\n <div *ngIf=\"lastErrors.minLongitude\">\n {{\n i18n[lang].userErrors.minLongitude.replace(\n '$minLongitude',\n lastErrors.minLongitude.min\n )\n }}\n </div>\n <div *ngIf=\"lastErrors.maxLongitude\">\n {{\n i18n[lang].userErrors.maxLongitude.replace(\n '$maxLongitude',\n lastErrors.maxLongitude.max\n )\n }}\n </div>\n</div>\n\n<ng-template #modalMap let-modal>\n <div class=\"lux-modal-header\">\n <h4 class=\"modal-title default-font\" id=\"modal-basic-title\">{{ mapTitle }}</h4>\n <button\n type=\"button\"\n class=\"close\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss('Cross click')\"\n >\n <span aria-hidden=\"true\">\u00D7</span>\n </button>\n </div>\n <div class=\"lux-modal-body content\">\n <lux-autocomplete\n #searchBar\n [attr.aria-label]=\"i18n[lang].typeToSearch\"\n [placeholder]=\"i18n[lang].typeToSearch\"\n *ngIf=\"!disabled && !readonly\"\n [instance]=\"self\"\n [resolveLabelsFunction]=\"getLabels\"\n [populateFunction]=\"getData\"\n (valueChange)=\"onSearchLocationChanged(searchBar.value, map)\"\n ></lux-autocomplete>\n <div class=\"map-container\">\n <lux-map\n #map\n [center]=\"value\"\n [markerPoint]=\"value\"\n [zoom]=\"zoom\"\n [readonly]=\"readonly === true || disabled === true ? true : false\"\n ></lux-map>\n </div>\n </div>\n <div class=\"lux-modal-footer\">\n <button\n *ngIf=\"disabled || readonly\"\n type=\"button\"\n class=\"btn btn-cancel\"\n (click)=\"modal.close('cancel')\"\n >\n {{ i18n[lang].closeAction }}\n </button>\n <button\n *ngIf=\"!disabled && !readonly\"\n type=\"button\"\n class=\"btn btn-cancel\"\n (click)=\"modal.close('cancel')\"\n >\n {{ i18n[lang].cancelAction }}\n </button>\n <button\n *ngIf=\"!disabled && !readonly\"\n type=\"button\"\n class=\"btn btn-select\"\n (click)=\"modal.close(map.markerPoint.coordinates)\"\n >\n {{ i18n[lang].selectAction }}\n </button>\n </div>\n</ng-template>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}:host{display:flex;align-items:stretch}.btn-select{color:#fff;background-color:#4242d1;margin-left:2rem}.btn-cancel{color:#fff;background-color:#c22929}.readonly{border:none}.readonly:focus{border:none;outline:none}.disabled{background-color:#f1f1f1;background-color:var(--lux-disabled-color, #f1f1f1);border-color:#6d6d6d;border-color:var(--lux-disabled-border-color, #6d6d6d)}.icon,.icon-clear,.icon-globe{display:inline-block;background-size:1rem 1rem;background-position:center;background-repeat:no-repeat;min-width:1rem;min-height:1rem;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);z-index:1}.clickable{cursor:pointer}.icon-globe{background:url(/assets/img/globe.svg) no-repeat center;background:var(--lux-autocomplete-icon-globe, url(/assets/img/globe.svg) no-repeat center);background-size:1rem;height:100%}.icon-clear{width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-autocomplete-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}.lux-modal-body{padding:0}.map-container{height:45vh;height:var(--lux-geolocation-map-height, 45vh);width:90vw;width:var(--lux-geolocation-map-width, 90vw);max-width:100%}\n"], components: [{ type: AutocompleteComponent, selector: "lux-autocomplete", inputs: ["inputId", "disabled", "readonly", "label", "canAddNewValues", "keepOpenAfterDelete", "value", "dataSource", "required", "placeholder", "resolveLabelsFunction", "populateFunction", "instance"], outputs: ["valueChange", "dataSourceChange"] }, { type: MapComponent, selector: "lux-map", inputs: ["mapId", "zoom", "center", "readonly", "markerCoordinates", "markerPoint"], outputs: ["valueChange"] }], directives: [{ type: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2799
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: GeolocationComponent, decorators: [{
2800
+ type: Component,
2801
+ args: [{ selector: 'lux-geolocation', providers: [
2802
+ {
2803
+ provide: NG_VALUE_ACCESSOR,
2804
+ multi: true,
2805
+ useExisting: forwardRef(() => GeolocationComponent)
2806
+ },
2807
+ {
2808
+ provide: NG_VALIDATORS,
2809
+ multi: true,
2810
+ useExisting: forwardRef(() => GeolocationComponent)
2811
+ }
2812
+ ], template: "<input\n #latitude\n class=\"rounded-left prefix\"\n [ngClass]=\"className\"\n type=\"number\"\n [id]=\"inputId + '$latitude'\"\n [(ngModel)]=\"latitudeValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.min]=\"\n minLatitude !== undefined && minLatitude !== null\n ? minLatitude.toString()\n : undefined\n \"\n [attr.max]=\"\n maxLatitude !== undefined && maxLatitude !== null\n ? maxLatitude.toString()\n : undefined\n \"\n [attr.step]=\"\n step !== undefined && step !== null ? step.toString() : undefined\n \"\n [placeholder]=\"i18n[lang].lat\"\n (keyup)=\"onEventLatitude(latitude.value)\"\n (change)=\"onEventLatitude(latitude.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<div\n class=\"infix symbol monospace clickable\"\n [ngClass]=\"className\"\n (click)=\"openModalMap(modalMap)\">\n <span *ngIf=\"isValidNumber(latitudeValue) && latitudeValue >= 0\">{{\n i18n[lang].cardinalPoints.north\n }}</span>\n <span *ngIf=\"isValidNumber(latitudeValue) && latitudeValue < 0\">{{\n i18n[lang].cardinalPoints.south\n }}</span>\n <span *ngIf=\"!isValidNumber(latitudeValue)\">-</span>\n</div>\n<input\n #longitude\n class=\"prefix\"\n [ngClass]=\"className\"\n type=\"number\"\n [id]=\"inputId + '$longitude'\"\n [(ngModel)]=\"longitudeValue\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.min]=\"\n minLongitude !== undefined && minLongitude !== null\n ? minLongitude.toString()\n : undefined\n \"\n [attr.max]=\"\n maxLongitude !== undefined && maxLongitude !== null\n ? maxLongitude.toString()\n : undefined\n \"\n [attr.step]=\"\n step !== undefined && step !== null ? step.toString() : undefined\n \"\n [placeholder]=\"i18n[lang].lon\"\n (keyup)=\"onEventLongitude(longitude.value)\"\n (change)=\"onEventLongitude(longitude.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<div\n class=\"infix symbol monospace clickable\"\n [ngClass]=\"className\"\n (click)=\"openModalMap(modalMap)\"\n>\n <span *ngIf=\"isValidNumber(longitudeValue) && longitudeValue >= 0\">{{\n i18n[lang].cardinalPoints.east\n }}</span>\n <span *ngIf=\"isValidNumber(longitudeValue) && longitudeValue < 0\">{{\n i18n[lang].cardinalPoints.west\n }}</span>\n <span *ngIf=\"!isValidNumber(longitudeValue)\">-</span>\n</div>\n<div\n [class]=\"\n disabled || readonly || !isClearable()\n ? 'clickable rounded-right postfix symbol'\n : 'clickable postfix symbol'\n \"\n [ngClass]=\"className\"\n (click)=\"openModalMap(modalMap)\"\n>\n <span class=\"icon-globe\"></span>\n</div>\n<button\n #clearButton\n *ngIf=\"!disabled && !readonly && isClearable()\"\n class=\"rounded-right postfix bordered icon icon-clear\"\n [id]=\"inputId + '$clear'\"\n type=\"button\"\n (click)=\"clear()\"\n aria-label=\"clear\"\n></button>\n\n<div *ngIf=\"inlineErrors && lastErrors && (dirty || touched)\" class=\"alert\">\n <div *ngIf=\"lastErrors.required\">\n {{ i18n[lang].userErrors.required }}\n </div>\n <div *ngIf=\"lastErrors.minLatitude\">\n {{\n i18n[lang].userErrors.minLatitude.replace(\n '$minLatitude',\n lastErrors.minLatitude.min\n )\n }}\n </div>\n <div *ngIf=\"lastErrors.maxLatitude\">\n {{\n i18n[lang].userErrors.maxLatitude.replace(\n '$maxLatitude',\n lastErrors.maxLatitude.max\n )\n }}\n </div>\n <div *ngIf=\"lastErrors.minLongitude\">\n {{\n i18n[lang].userErrors.minLongitude.replace(\n '$minLongitude',\n lastErrors.minLongitude.min\n )\n }}\n </div>\n <div *ngIf=\"lastErrors.maxLongitude\">\n {{\n i18n[lang].userErrors.maxLongitude.replace(\n '$maxLongitude',\n lastErrors.maxLongitude.max\n )\n }}\n </div>\n</div>\n\n<ng-template #modalMap let-modal>\n <div class=\"lux-modal-header\">\n <h4 class=\"modal-title default-font\" id=\"modal-basic-title\">{{ mapTitle }}</h4>\n <button\n type=\"button\"\n class=\"close\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss('Cross click')\"\n >\n <span aria-hidden=\"true\">\u00D7</span>\n </button>\n </div>\n <div class=\"lux-modal-body content\">\n <lux-autocomplete\n #searchBar\n [attr.aria-label]=\"i18n[lang].typeToSearch\"\n [placeholder]=\"i18n[lang].typeToSearch\"\n *ngIf=\"!disabled && !readonly\"\n [instance]=\"self\"\n [resolveLabelsFunction]=\"getLabels\"\n [populateFunction]=\"getData\"\n (valueChange)=\"onSearchLocationChanged(searchBar.value, map)\"\n ></lux-autocomplete>\n <div class=\"map-container\">\n <lux-map\n #map\n [center]=\"value\"\n [markerPoint]=\"value\"\n [zoom]=\"zoom\"\n [readonly]=\"readonly === true || disabled === true ? true : false\"\n ></lux-map>\n </div>\n </div>\n <div class=\"lux-modal-footer\">\n <button\n *ngIf=\"disabled || readonly\"\n type=\"button\"\n class=\"btn btn-cancel\"\n (click)=\"modal.close('cancel')\"\n >\n {{ i18n[lang].closeAction }}\n </button>\n <button\n *ngIf=\"!disabled && !readonly\"\n type=\"button\"\n class=\"btn btn-cancel\"\n (click)=\"modal.close('cancel')\"\n >\n {{ i18n[lang].cancelAction }}\n </button>\n <button\n *ngIf=\"!disabled && !readonly\"\n type=\"button\"\n class=\"btn btn-select\"\n (click)=\"modal.close(map.markerPoint.coordinates)\"\n >\n {{ i18n[lang].selectAction }}\n </button>\n </div>\n</ng-template>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}:host{display:flex;align-items:stretch}.btn-select{color:#fff;background-color:#4242d1;margin-left:2rem}.btn-cancel{color:#fff;background-color:#c22929}.readonly{border:none}.readonly:focus{border:none;outline:none}.disabled{background-color:#f1f1f1;background-color:var(--lux-disabled-color, #f1f1f1);border-color:#6d6d6d;border-color:var(--lux-disabled-border-color, #6d6d6d)}.icon,.icon-clear,.icon-globe{display:inline-block;background-size:1rem 1rem;background-position:center;background-repeat:no-repeat;min-width:1rem;min-height:1rem;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);z-index:1}.clickable{cursor:pointer}.icon-globe{background:url(/assets/img/globe.svg) no-repeat center;background:var(--lux-autocomplete-icon-globe, url(/assets/img/globe.svg) no-repeat center);background-size:1rem;height:100%}.icon-clear{width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);background:url(/assets/img/filter-clear.png) no-repeat center;background:var(--lux-autocomplete-icon-clear, url(/assets/img/filter-clear.png) no-repeat center);background-size:.5rem .5rem;background-size:var(--lux-autocomplete-icon-bg-size, .5rem .5rem);z-index:1}.lux-modal-body{padding:0}.map-container{height:45vh;height:var(--lux-geolocation-map-height, 45vh);width:90vw;width:var(--lux-geolocation-map-width, 90vw);max-width:100%}\n"] }]
2813
+ }], ctorParameters: function () { return [{ type: ModalService }, { type: GeolocationService }]; }, propDecorators: { latitude: [{
2814
+ type: ViewChild,
2815
+ args: ['latitude', { static: true }]
2816
+ }], longitude: [{
2817
+ type: ViewChild,
2818
+ args: ['longitude', { static: true }]
2819
+ }], map: [{
2820
+ type: ViewChild,
2821
+ args: ['map', { static: false }]
2822
+ }], minLatitude: [{
2823
+ type: Input
2824
+ }], maxLatitude: [{
2825
+ type: Input
2826
+ }], minLongitude: [{
2827
+ type: Input
2828
+ }], maxLongitude: [{
2829
+ type: Input
2830
+ }], step: [{
2831
+ type: Input
2832
+ }], zoom: [{
2833
+ type: Input
2834
+ }], lang: [{
2835
+ type: Input
2836
+ }], inlineErrors: [{
2837
+ type: Input
2838
+ }], inputId: [{
2839
+ type: Input
2840
+ }], ariaLabel: [{
2841
+ type: Input,
2842
+ args: ['aria-label']
2843
+ }], readonly: [{
2844
+ type: Input
2845
+ }], disabled: [{
2846
+ type: Input
2847
+ }], required: [{
2848
+ type: Input
2849
+ }], value: [{
2850
+ type: Input
2851
+ }], valueChange: [{
2852
+ type: Output
2853
+ }], keyPress: [{
2854
+ type: Output
2855
+ }] } });
2856
+
2857
+ /**
2858
+ * A service that holds the functionality for advanced handling of regular expressions
2859
+ */
2860
+ class RegexpService {
2861
+ constructor() { }
2862
+ removeOuterRoundBrackets(regularExpressionString) {
2863
+ while (regularExpressionString[0] === '(' &&
2864
+ regularExpressionString[regularExpressionString.length - 1] === ')') {
2865
+ regularExpressionString = regularExpressionString.slice(1, regularExpressionString.length - 1);
2866
+ }
2867
+ return regularExpressionString;
2868
+ }
2869
+ isQuantifier(quantifier) {
2870
+ switch (quantifier) {
2871
+ case '{':
2872
+ case '?':
2873
+ case '+':
2874
+ case '*':
2875
+ return true;
2876
+ }
2877
+ return false;
2878
+ }
2879
+ parseMinimalAmountOfQuantifier(quantifier) {
2880
+ switch (quantifier[0]) {
2881
+ case '?':
2882
+ case '*':
2883
+ return 0;
2884
+ case '+':
2885
+ return 1;
2886
+ case '{':
2887
+ for (let index = 1; index < quantifier.length; ++index) {
2888
+ if (quantifier[index] < '0' || quantifier[index] > '9') {
2889
+ return Number(quantifier.slice(1, index));
2890
+ }
2891
+ }
2892
+ }
2893
+ return 0;
2894
+ }
2895
+ sliceRegexByOr(regularExpressionString) {
2896
+ const result = [];
2897
+ let slicedRegex = '';
2898
+ let lastSliceIndex = 0;
2899
+ let roundBracketCount = 0;
2900
+ let squareBracketCount = 0;
2901
+ let curlyBracketCount = 0;
2902
+ let index = 0;
2903
+ for (; index < regularExpressionString.length; ++index) {
2904
+ switch (regularExpressionString[index]) {
2905
+ case '\\':
2906
+ // escape sequence; skip the next character
2907
+ ++index;
2908
+ break;
2909
+ case '(':
2910
+ roundBracketCount += 1;
2911
+ break;
2912
+ case ')':
2913
+ roundBracketCount -= 1;
2914
+ break;
2915
+ case '[':
2916
+ squareBracketCount += 1;
2917
+ break;
2918
+ case ']':
2919
+ squareBracketCount -= 1;
2920
+ break;
2921
+ case '{':
2922
+ curlyBracketCount += 1;
2923
+ break;
2924
+ case '}':
2925
+ curlyBracketCount -= 1;
2926
+ break;
2927
+ case '|':
2928
+ if (roundBracketCount === 0 &&
2929
+ squareBracketCount === 0 &&
2930
+ curlyBracketCount === 0) {
2931
+ slicedRegex = this.removeOuterRoundBrackets(regularExpressionString.slice(lastSliceIndex, index));
2932
+ result.push(slicedRegex);
2933
+ lastSliceIndex = index + 1;
2934
+ }
2935
+ break;
2936
+ }
2937
+ }
2938
+ slicedRegex = this.removeOuterRoundBrackets(regularExpressionString.slice(lastSliceIndex, index));
2939
+ result.push(slicedRegex);
2940
+ return result;
2941
+ }
2942
+ sliceRegexByThen(regularExpressionString) {
2943
+ // the actual result
2944
+ const resultStart = [];
2945
+ // the remainder of the regex in each case
2946
+ const resultRemainder = [];
2947
+ let roundBracketCount = 0;
2948
+ let squareBracketCount = 0;
2949
+ let curlyBracketCount = 0;
2950
+ for (let index = 0; index < regularExpressionString.length; ++index) {
2951
+ switch (regularExpressionString[index]) {
2952
+ case '\\':
2953
+ // escape sequence; skip the next character
2954
+ ++index;
2955
+ break;
2956
+ case '(':
2957
+ roundBracketCount += 1;
2958
+ break;
2959
+ case ')':
2960
+ roundBracketCount -= 1;
2961
+ break;
2962
+ case '[':
2963
+ squareBracketCount += 1;
2964
+ break;
2965
+ case ']':
2966
+ squareBracketCount -= 1;
2967
+ break;
2968
+ case '{':
2969
+ curlyBracketCount += 1;
2970
+ break;
2971
+ case '}':
2972
+ curlyBracketCount -= 1;
2973
+ break;
2974
+ }
2975
+ if (roundBracketCount === 0 &&
2976
+ squareBracketCount === 0 &&
2977
+ curlyBracketCount === 0) {
2978
+ if (!this.isQuantifier(regularExpressionString[index + 1])) {
2979
+ resultStart.push(regularExpressionString.slice(0, index + 1));
2980
+ resultRemainder.push(regularExpressionString.slice(index + 1));
2981
+ }
2982
+ else {
2983
+ // let minimalAmountOfRepeats = parseMinimalAmountOfQuantifier(regularExpressionString.slice(index + 1));
2984
+ // TODO
2985
+ }
2986
+ }
2987
+ }
2988
+ return [resultStart, resultRemainder];
2989
+ }
2990
+ suggestion(beginning, regularExpressionString) {
2991
+ if (new RegExp(regularExpressionString).test(beginning)) {
2992
+ // TODO: RETURN AN EMPTY STRING
2993
+ return 'YA ES IGUAL, NO HAY MÁS QUE SUGERIR';
2994
+ }
2995
+ const regexOptions = this.sliceRegexByOr(regularExpressionString);
2996
+ if (regexOptions.length > 1) {
2997
+ for (let regexOptionIndex = 0; regexOptionIndex < regexOptions.length; ++regexOptionIndex) {
2998
+ const regexParts = this.sliceRegexByThen(regexOptions[regexOptionIndex]);
2999
+ const regexPartsStarts = regexParts[0];
3000
+ const regexPartsRemainders = regexParts[1];
3001
+ // for each option, test if the first part of the regex matches
3002
+ // if it doesn't, continue
3003
+ // if it does, keep checking until what part it matches
3004
+ if (!new RegExp(regexPartsStarts[0]).test(beginning)) {
3005
+ // if there are no more options
3006
+ if (regexOptionIndex === regexOptions.length - 1) {
3007
+ // we return the first option, but we could return any option
3008
+ // TODO: RETURN ANY TEXT THAT MATCHES regexOptions[0]
3009
+ return regexOptions[0];
3010
+ }
3011
+ }
3012
+ else {
3013
+ for (let regexPartIndex = 1; regexPartIndex < regexPartsStarts.length; ++regexPartIndex) {
3014
+ if (!new RegExp(regexPartsStarts[regexPartIndex]).test(beginning)) {
3015
+ // TODO: RETURN ANY TEXT THAT MATCHES regexPartsRemainders[regexPartIndex - 1]
3016
+ return regexPartsRemainders[regexPartIndex - 1];
3017
+ }
3018
+ }
3019
+ }
3020
+ }
3021
+ }
3022
+ else if (regexOptions.length === 1) {
3023
+ const regexParts = this.sliceRegexByThen(regexOptions[0]);
3024
+ const regexPartsStarts = regexParts[0];
3025
+ const regexPartsRemainders = regexParts[1];
3026
+ if (!new RegExp(regexPartsStarts[0]).test(beginning)) {
3027
+ // TODO: RETURN ANY TEXT THAT MATCHES regularExpressionString
3028
+ return regularExpressionString;
3029
+ }
3030
+ else {
3031
+ for (let regexPartIndex = 1; regexPartIndex < regexPartsStarts.length; ++regexPartIndex) {
3032
+ if (!new RegExp(regexPartsStarts[regexPartIndex]).test(beginning)) {
3033
+ // TODO: RETURN ANY TEXT THAT MATCHES regexPartsRemainders[regexPartIndex - 1]
3034
+ return regexPartsRemainders[regexPartIndex - 1];
3035
+ }
3036
+ }
3037
+ }
3038
+ }
3039
+ // TODO: RETURN AN EMPTY STRING
3040
+ return 'NO DEBERÍA SER POSIBLE';
3041
+ }
3042
+ }
3043
+ RegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: RegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3044
+ RegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: RegexpService, providedIn: 'root' });
3045
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: RegexpService, decorators: [{
3046
+ type: Injectable,
3047
+ args: [{ providedIn: 'root' }]
3048
+ }], ctorParameters: function () { return []; } });
3049
+
3050
+ class InputComponent {
3051
+ constructor(regexpService) {
3052
+ this.regexpService = regexpService;
3053
+ this.touched = false;
3054
+ this.dirty = false;
3055
+ this.lastErrors = null;
3056
+ this._value = '';
3057
+ this._pattern = undefined;
3058
+ this._regexp = undefined;
3059
+ this.userErrors = {
3060
+ en: {
3061
+ required: 'Required field.',
3062
+ min: 'Minimum value is $min.',
3063
+ max: 'Maximum value is $max.',
3064
+ email: 'Format should match example@example.com.',
3065
+ url: 'Format should match https://example.com.',
3066
+ color: 'Format should match #XXXXXX.'
3067
+ },
3068
+ es: {
3069
+ required: 'El campo es obligatorio.',
3070
+ min: 'El valor mínimo es $min.',
3071
+ max: 'El valor máximo es $max.',
3072
+ email: 'El campo debe tener un formato como ejemplo@ejemplo.com.',
3073
+ url: 'El campo debe tener un formato como https://ejemplo.com.',
3074
+ color: 'El campo debe tener un formato como #XXXXXX.'
3075
+ }
3076
+ };
3077
+ this.lang = languageDetector();
3078
+ this.inlineErrors = false;
3079
+ this.readonly = null;
3080
+ this.valueChange = new EventEmitter();
3081
+ this.keyPress = new EventEmitter();
3082
+ this.onChange = (value) => { };
3083
+ this.onTouched = () => { };
3084
+ }
3085
+ get className() {
3086
+ return this.checkClassName();
3087
+ }
3088
+ get color() {
3089
+ return this.checkColor();
3090
+ }
3091
+ set disabled(v) {
3092
+ v = typeof v === 'string' ? true : v;
3093
+ this._disabled = v;
3094
+ }
3095
+ get disabled() {
3096
+ return this._disabled;
3097
+ }
3098
+ set pattern(p) {
3099
+ this._pattern = p;
3100
+ if (p === undefined) {
3101
+ this._regexp = undefined;
3102
+ }
3103
+ else {
3104
+ try {
3105
+ this._regexp = new RegExp(p);
3106
+ }
3107
+ catch (e) {
3108
+ this._pattern = undefined;
3109
+ this._regexp = undefined;
3110
+ }
3111
+ }
3112
+ }
3113
+ get pattern() {
3114
+ return this._pattern;
3115
+ }
3116
+ set currency(v) {
3117
+ this._currency = v.toUpperCase();
3118
+ }
3119
+ get currency() {
3120
+ return this._currency;
3121
+ }
3122
+ set placeholder(v) {
3123
+ this._placeholder = v;
3124
+ }
3125
+ get placeholder() {
3126
+ return this._placeholder ? this._placeholder : '';
3127
+ }
3128
+ set required(v) {
3129
+ this._required = v;
3130
+ }
3131
+ get required() {
3132
+ return this._required;
3133
+ }
3134
+ set type(v) {
3135
+ this._type = v.toLowerCase();
3136
+ this.domain = v.toLowerCase();
3137
+ this.checkType(v);
3138
+ }
3139
+ get type() {
3140
+ return this._type ? this._type : 'text';
3141
+ }
3142
+ set value(v) {
3143
+ v = v === undefined ? null : v;
3144
+ if (v === this._value) {
3145
+ return; // prevent events when there is no changes
3146
+ }
3147
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
3148
+ if (this.type === 'date') {
3149
+ v = normalizeDate(v);
3150
+ }
3151
+ this._value = v;
3152
+ this.onChange(v);
3153
+ if (!initialAndEmpty) {
3154
+ this.valueChange.emit(v);
3155
+ }
3156
+ }
3157
+ get value() {
3158
+ if (this.isPercentage() || this.isPermillage() || this.isNumber()) {
3159
+ const numVal = parseFloat(this._value);
3160
+ if (!Number.isNaN(numVal)) {
3161
+ return numVal;
3162
+ }
3163
+ }
3164
+ return this._value;
3165
+ }
3166
+ // ControlValueAccessor Interface implementation
3167
+ writeValue(value) {
3168
+ this.value = value;
3169
+ this.setValueInControl(value);
3170
+ }
3171
+ registerOnChange(onChange) {
3172
+ this.onChange = onChange;
3173
+ }
3174
+ registerOnTouched(onTouched) {
3175
+ this.onTouched = onTouched;
3176
+ }
3177
+ markAsTouched() {
3178
+ if (!this.touched) {
3179
+ this.onTouched();
3180
+ this.touched = true;
3181
+ }
3182
+ }
3183
+ setDisabledState(disabled) {
3184
+ this.disabled = disabled;
3185
+ }
3186
+ // End of ControlValueAccessor Interface implementation
3187
+ setValueInControl(v) {
3188
+ if (this.domain === 'date') {
3189
+ v = normalizeDate(v);
3190
+ }
3191
+ if (this.input) {
3192
+ this.input.nativeElement.value = v;
3193
+ }
3194
+ if (this.textarea) {
3195
+ this.textarea.nativeElement.value = v;
3196
+ }
3197
+ }
3198
+ // Validator interface
3199
+ registerOnValidatorChange() { }
3200
+ validate(control) {
3201
+ const value = control.value;
3202
+ let result = null;
3203
+ if (this.required && !hasValue(value)) {
3204
+ result = result || {};
3205
+ result.required = { value, reason: 'Required field.' };
3206
+ }
3207
+ if (this._regexp && hasValue(value) && !this._regexp.test(value)) {
3208
+ result = result || {};
3209
+ result.pattern = {
3210
+ value,
3211
+ reason: `Value must follow the pattern: ${this._pattern}`
3212
+ };
3213
+ }
3214
+ if (this.type === 'email' && hasValue(value) && !isValidEmail(value)) {
3215
+ result = result || {};
3216
+ result.email = { value, reason: 'Invalid email.' };
3217
+ }
3218
+ if (this.type === 'url' && hasValue(value) && !isValidUrl(value)) {
3219
+ result = result || {};
3220
+ result.url = { value, reason: 'Invalid URL.' };
3221
+ }
3222
+ if (this.type === 'color' && hasValue(value) && !isValidColor(value)) {
3223
+ result = result || {};
3224
+ result.color = { value, reason: 'Invalid color.' };
3225
+ }
3226
+ if (this.type === 'number' && hasValue(value) && !isValidNumber(value)) {
3227
+ result = result || {};
3228
+ result.numeric = { value, reason: 'Invalid number.' };
3229
+ }
3230
+ if (this.type === 'date' ||
3231
+ this.type === 'time' ||
3232
+ this.type === 'timestamp') {
3233
+ if (typeof this.min === 'string' &&
3234
+ hasValue(value) &&
3235
+ String(value).localeCompare(this.min) === -1) {
3236
+ result = result || {};
3237
+ result.min = {
3238
+ value,
3239
+ min: this.min,
3240
+ reason: `Value is lower than minimum value: ${this.min}.`
3241
+ };
3242
+ }
3243
+ if (typeof this.max === 'string' &&
3244
+ hasValue(value) &&
3245
+ String(value).localeCompare(this.max) !== -1) {
3246
+ result = result || {};
3247
+ result.max = {
3248
+ value,
3249
+ max: this.max,
3250
+ reason: `Value is greater than than maximum value: ${this.max}.`
3251
+ };
3252
+ }
3253
+ }
3254
+ if (this.type === 'percentage' ||
3255
+ this.type === 'permillage' ||
3256
+ this.type === 'number' ||
3257
+ this.type === 'currency') {
3258
+ if (hasValue(this.min) && hasValue(value) && value < +this.min) {
3259
+ result = result || {};
3260
+ result.min = {
3261
+ value,
3262
+ min: this.min,
3263
+ reason: `Value is lower than minimum value: ${this.min}.`
3264
+ };
3265
+ }
3266
+ if (hasValue(this.max) && hasValue(value) && value > +this.max) {
3267
+ result = result || {};
3268
+ result.max = {
3269
+ value,
3270
+ max: this.max,
3271
+ reason: `Value is greater than than maximum value: ${this.max}.`
3272
+ };
3273
+ }
3274
+ }
3275
+ this.lastErrors = result;
3276
+ return result;
3277
+ }
3278
+ // End of Validator interface
3279
+ ngOnInit() {
3280
+ this.inputId = this.inputId
3281
+ ? this.inputId
3282
+ : `${this.type}$${InputComponent.idCounter++}`;
3283
+ }
3284
+ onLostFocus() {
3285
+ this.markAsTouched();
3286
+ }
3287
+ onKeyUp(newValue) {
3288
+ this.value = newValue;
3289
+ }
3290
+ onChangeValue(newValue) {
3291
+ this.value = newValue;
3292
+ if (this.isColor()) {
3293
+ this.colorpicker.nativeElement.value = undefined;
3294
+ }
3295
+ this.markAsTouched();
3296
+ }
3297
+ onKeyPress(event) {
3298
+ this.keyPress.emit(event);
3299
+ }
3300
+ onColorPicked(newValue) {
3301
+ this.onChangeValue(newValue);
3302
+ this.setValueInControl(newValue);
3303
+ }
3304
+ isUrl() {
3305
+ return this.type === 'url';
3306
+ }
3307
+ isColor() {
3308
+ return this.type === 'color';
3309
+ }
3310
+ isNumber() {
3311
+ return this.type === 'number';
3312
+ }
3313
+ isPercentage() {
3314
+ return this.type === 'percentage';
3315
+ }
3316
+ isPermillage() {
3317
+ return this.type === 'permillage';
3318
+ }
3319
+ hasPrefix() {
3320
+ return this.currency === 'USD';
3321
+ }
3322
+ hasPostfix() {
3323
+ return (this.currency === 'EUR' ||
3324
+ this.isPercentage() ||
3325
+ this.isPermillage() ||
3326
+ (this.isUrl() && !!this.value) ||
3327
+ this.isColor());
3328
+ }
3329
+ checkClassName() {
3330
+ return this.disabled
3331
+ ? this.readonly
3332
+ ? 'disabled readonly'
3333
+ : 'disabled'
3334
+ : this.readonly
3335
+ ? 'readonly'
3336
+ : '';
3337
+ }
3338
+ checkColor() {
3339
+ return this.type === 'color' && isValidColor(this.value)
3340
+ ? this.value
3341
+ : 'initial';
3342
+ }
3343
+ checkType(type) {
3344
+ switch (type) {
3345
+ case 'email':
3346
+ this.setEmailPatterns();
3347
+ break;
3348
+ case 'url':
3349
+ this.setUrlPatterns();
3350
+ break;
3351
+ case 'color':
3352
+ this.setColorPatterns();
3353
+ break;
3354
+ case 'date':
3355
+ this.setDatePatterns();
3356
+ break;
3357
+ case 'time':
3358
+ this.setTimePatterns();
3359
+ break;
3360
+ case 'password':
3361
+ this.setPasswordPatterns();
3362
+ break;
3363
+ case 'number':
3364
+ this.setNumberPatterns();
3365
+ break;
3366
+ case 'currency':
3367
+ this.setCurrencyPatterns();
3368
+ break;
3369
+ case 'percentage':
3370
+ this.setPercentagePatterns();
3371
+ break;
3372
+ case 'permillage':
3373
+ this.setPermillagePatterns();
3374
+ break;
3375
+ default:
3376
+ break;
3377
+ }
3378
+ }
3379
+ setEmailPatterns() { }
3380
+ setUrlPatterns() { }
3381
+ setColorPatterns() {
3382
+ this.domain = 'text';
3383
+ }
3384
+ setDatePatterns() {
3385
+ this.min = this.min || '1900-01-01';
3386
+ this.max = this.max || '2100-01-01';
3387
+ }
3388
+ setTimePatterns() { }
3389
+ setPasswordPatterns() { }
3390
+ setNumberPatterns() {
3391
+ this.domain = 'number';
3392
+ this.placeholder = '0';
3393
+ }
3394
+ setCurrencyPatterns() {
3395
+ this.domain = 'number';
3396
+ this.step = this.step || 0.1;
3397
+ this.min = this.min || 0.0;
3398
+ this.max = this.max || 10000.0;
3399
+ this.value = 0.0;
3400
+ }
3401
+ setPercentagePatterns() {
3402
+ this.domain = 'number';
3403
+ this.step = this.step || 0.01;
3404
+ this.min = this.min || 0.0;
3405
+ this.max = this.max || 100.0;
3406
+ this.placeholder = '0.00';
3407
+ }
3408
+ setPermillagePatterns() {
3409
+ this.domain = 'number';
3410
+ this.step = this.step || 0.01;
3411
+ this.min = this.min || 0.0;
3412
+ this.max = this.max || 1000.0;
3413
+ this.placeholder = '0.00';
3414
+ }
3415
+ }
3416
+ InputComponent.idCounter = 0;
3417
+ InputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: InputComponent, deps: [{ token: RegexpService }], target: i0.ɵɵFactoryTarget.Component });
3418
+ InputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: InputComponent, selector: "lux-input", inputs: { rows: "rows", cols: "cols", step: "step", min: "min", max: "max", lang: "lang", inlineErrors: "inlineErrors", inputId: "inputId", ariaLabel: ["aria-label", "ariaLabel"], readonly: "readonly", disabled: "disabled", pattern: "pattern", currency: "currency", placeholder: "placeholder", required: "required", type: "type", value: "value" }, outputs: { valueChange: "valueChange", keyPress: "keyPress" }, providers: [
3419
+ {
3420
+ provide: NG_VALUE_ACCESSOR,
3421
+ multi: true,
3422
+ useExisting: forwardRef(() => InputComponent)
3423
+ },
3424
+ {
3425
+ provide: NG_VALIDATORS,
3426
+ multi: true,
3427
+ useExisting: forwardRef(() => InputComponent)
3428
+ }
3429
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }, { propertyName: "textarea", first: true, predicate: ["textarea"], descendants: true }, { propertyName: "colorpicker", first: true, predicate: ["colorpicker"], descendants: true }], ngImport: i0, template: "<div *ngIf=\"currency && currency === 'USD'\" class=\"prefix rounded-left symbol\" [ngClass]=\"className\">\n <span>$</span>\n</div>\n<input\n #input\n *ngIf=\"type !== 'textarea'\"\n [class]=\"hasPrefix() ? (hasPostfix() ? 'infix' : 'postfix rounded-right') : (hasPostfix() ? 'prefix rounded-left' : 'rounded')\"\n [ngClass]=\"className\"\n placement=\"top\"\n [id]=\"inputId\"\n [type]=\"domain\"\n [attr.value]=\"value\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.min]=\"min?.toString() || undefined\"\n [attr.max]=\"max?.toString() || undefined\"\n [attr.step]=\"step?.toString() || undefined\"\n [attr.pattern]=\"pattern || undefined\"\n [placeholder]=\"placeholder\"\n (keyup)=\"onKeyUp(input.value)\"\n (change)=\"onChangeValue(input.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<textarea\n #textarea\n *ngIf=\"type === 'textarea'\"\n class=\"rounded\"\n [ngClass]=\"className\"\n placement=\"top\"\n [id]=\"inputId\"\n [attr.value]=\"value\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.cols]=\"cols?.toString() || undefined\"\n [attr.rows]=\"rows?.toString() || undefined\"\n [placeholder]=\"placeholder\"\n (keyup)=\"onKeyUp(textarea.value)\"\n (change)=\"onChangeValue(textarea.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n></textarea>\n<div *ngIf=\"currency && currency === 'EUR'\" class=\"postfix rounded-right symbol\" [ngClass]=\"className\">\n <span>\u20AC</span>\n</div>\n<div *ngIf=\"isPercentage()\" class=\"postfix rounded-right symbol\" [ngClass]=\"className\">\n <span>%</span>\n</div>\n<div *ngIf=\"isPermillage()\" class=\"postfix rounded-right symbol\" [ngClass]=\"className\">\n <span>\u2030</span>\n</div>\n<div *ngIf=\"isUrl() && !!value\" class=\"postfix rounded-right symbol clickable\" [ngClass]=\"className\">\n <a href=\"{{ value }}\" target=\"_blank\">\n <span class=\"icon-external\"></span>\n </a>\n</div>\n<div *ngIf=\"isColor()\" class=\"postfix rounded-right bordered transparency\" [ngClass]=\"className\">\n <div class=\"rounded-right full-space\" [ngStyle]=\"{'background-color': color}\">\n <input\n #colorpicker\n class=\"minimal-space clickable invisible rounded-right full-space\"\n [id]=\"inputId + '$colorpicker'\"\n type=\"color\"\n [attr.value]=\"value\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n (change)=\"onColorPicked(colorpicker.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n />\n </div>\n</div>\n\n<div *ngIf=\"inlineErrors && lastErrors && (dirty || touched)\" class=\"alert\">\n <div *ngIf=\"lastErrors.required\">\n {{ userErrors[this.lang].required }}\n </div>\n <div *ngIf=\"lastErrors.email\">{{ userErrors[this.lang].email }}</div>\n <div *ngIf=\"lastErrors.url\">{{ userErrors[this.lang].url }}</div>\n <div *ngIf=\"lastErrors.min\">\n {{ userErrors[this.lang].min.replace('$min', lastErrors.min.min) }}\n </div>\n <div *ngIf=\"lastErrors.max\">\n {{ userErrors[this.lang].max.replace('$max', lastErrors.max.max) }}\n </div>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}:host{display:flex;align-items:stretch;min-height:1.5rem}.readonly{border:none}.readonly:focus{border:none;outline:none}.disabled{background-color:#f1f1f1;background-color:var(--lux-disabled-color, #f1f1f1);border-color:#6d6d6d;border-color:var(--lux-disabled-border-color, #6d6d6d)}.clickable{cursor:pointer}.full-space{width:100%;height:100%;margin:0;padding:0}.minimal-space,.icon,.icon-external{min-width:1rem;min-height:1rem}.icon,.icon-external{display:inline-block;background-size:1rem 1rem;background-position:center;background-repeat:no-repeat;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);z-index:1}.icon-external{background:url(/assets/img/external.svg) no-repeat center;background:var(--lux-input-icon-external, url(/assets/img/external.svg) no-repeat center);background-size:1rem;background-position-y:.1rem;height:100%}.invisible{opacity:0}.transparency{background-image:conic-gradient(white 0deg 90deg,lightgray 90deg 180deg,white 180deg 270deg,lightgray 270deg 360deg)}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
3430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: InputComponent, decorators: [{
3431
+ type: Component,
3432
+ args: [{ selector: 'lux-input', providers: [
3433
+ {
3434
+ provide: NG_VALUE_ACCESSOR,
3435
+ multi: true,
3436
+ useExisting: forwardRef(() => InputComponent)
3437
+ },
3438
+ {
3439
+ provide: NG_VALIDATORS,
3440
+ multi: true,
3441
+ useExisting: forwardRef(() => InputComponent)
3442
+ }
3443
+ ], template: "<div *ngIf=\"currency && currency === 'USD'\" class=\"prefix rounded-left symbol\" [ngClass]=\"className\">\n <span>$</span>\n</div>\n<input\n #input\n *ngIf=\"type !== 'textarea'\"\n [class]=\"hasPrefix() ? (hasPostfix() ? 'infix' : 'postfix rounded-right') : (hasPostfix() ? 'prefix rounded-left' : 'rounded')\"\n [ngClass]=\"className\"\n placement=\"top\"\n [id]=\"inputId\"\n [type]=\"domain\"\n [attr.value]=\"value\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.min]=\"min?.toString() || undefined\"\n [attr.max]=\"max?.toString() || undefined\"\n [attr.step]=\"step?.toString() || undefined\"\n [attr.pattern]=\"pattern || undefined\"\n [placeholder]=\"placeholder\"\n (keyup)=\"onKeyUp(input.value)\"\n (change)=\"onChangeValue(input.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n/>\n<textarea\n #textarea\n *ngIf=\"type === 'textarea'\"\n class=\"rounded\"\n [ngClass]=\"className\"\n placement=\"top\"\n [id]=\"inputId\"\n [attr.value]=\"value\"\n [attr.aria-label]=\"ariaLabel\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n [attr.cols]=\"cols?.toString() || undefined\"\n [attr.rows]=\"rows?.toString() || undefined\"\n [placeholder]=\"placeholder\"\n (keyup)=\"onKeyUp(textarea.value)\"\n (change)=\"onChangeValue(textarea.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n></textarea>\n<div *ngIf=\"currency && currency === 'EUR'\" class=\"postfix rounded-right symbol\" [ngClass]=\"className\">\n <span>\u20AC</span>\n</div>\n<div *ngIf=\"isPercentage()\" class=\"postfix rounded-right symbol\" [ngClass]=\"className\">\n <span>%</span>\n</div>\n<div *ngIf=\"isPermillage()\" class=\"postfix rounded-right symbol\" [ngClass]=\"className\">\n <span>\u2030</span>\n</div>\n<div *ngIf=\"isUrl() && !!value\" class=\"postfix rounded-right symbol clickable\" [ngClass]=\"className\">\n <a href=\"{{ value }}\" target=\"_blank\">\n <span class=\"icon-external\"></span>\n </a>\n</div>\n<div *ngIf=\"isColor()\" class=\"postfix rounded-right bordered transparency\" [ngClass]=\"className\">\n <div class=\"rounded-right full-space\" [ngStyle]=\"{'background-color': color}\">\n <input\n #colorpicker\n class=\"minimal-space clickable invisible rounded-right full-space\"\n [id]=\"inputId + '$colorpicker'\"\n type=\"color\"\n [attr.value]=\"value\"\n [attr.disabled]=\"disabled === true ? 'true' : undefined\"\n [attr.readonly]=\"readonly === true ? 'true' : undefined\"\n (change)=\"onColorPicked(colorpicker.value)\"\n (keypress)=\"onKeyPress($event)\"\n (blur)=\"onLostFocus()\"\n />\n </div>\n</div>\n\n<div *ngIf=\"inlineErrors && lastErrors && (dirty || touched)\" class=\"alert\">\n <div *ngIf=\"lastErrors.required\">\n {{ userErrors[this.lang].required }}\n </div>\n <div *ngIf=\"lastErrors.email\">{{ userErrors[this.lang].email }}</div>\n <div *ngIf=\"lastErrors.url\">{{ userErrors[this.lang].url }}</div>\n <div *ngIf=\"lastErrors.min\">\n {{ userErrors[this.lang].min.replace('$min', lastErrors.min.min) }}\n </div>\n <div *ngIf=\"lastErrors.max\">\n {{ userErrors[this.lang].max.replace('$max', lastErrors.max.max) }}\n </div>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}:host{display:flex;align-items:stretch;min-height:1.5rem}.readonly{border:none}.readonly:focus{border:none;outline:none}.disabled{background-color:#f1f1f1;background-color:var(--lux-disabled-color, #f1f1f1);border-color:#6d6d6d;border-color:var(--lux-disabled-border-color, #6d6d6d)}.clickable{cursor:pointer}.full-space{width:100%;height:100%;margin:0;padding:0}.minimal-space,.icon,.icon-external{min-width:1rem;min-height:1rem}.icon,.icon-external{display:inline-block;background-size:1rem 1rem;background-position:center;background-repeat:no-repeat;width:1.5rem;width:var(--lux-autocomplete-icon-width, 1.5rem);z-index:1}.icon-external{background:url(/assets/img/external.svg) no-repeat center;background:var(--lux-input-icon-external, url(/assets/img/external.svg) no-repeat center);background-size:1rem;background-position-y:.1rem;height:100%}.invisible{opacity:0}.transparency{background-image:conic-gradient(white 0deg 90deg,lightgray 90deg 180deg,white 180deg 270deg,lightgray 270deg 360deg)}\n"] }]
3444
+ }], ctorParameters: function () { return [{ type: RegexpService }]; }, propDecorators: { input: [{
3445
+ type: ViewChild,
3446
+ args: ['input', { static: false }]
3447
+ }], textarea: [{
3448
+ type: ViewChild,
3449
+ args: ['textarea', { static: false }]
3450
+ }], colorpicker: [{
3451
+ type: ViewChild,
3452
+ args: ['colorpicker', { static: false }]
3453
+ }], rows: [{
3454
+ type: Input
3455
+ }], cols: [{
3456
+ type: Input
3457
+ }], step: [{
3458
+ type: Input
3459
+ }], min: [{
3460
+ type: Input
3461
+ }], max: [{
3462
+ type: Input
3463
+ }], lang: [{
3464
+ type: Input
3465
+ }], inlineErrors: [{
3466
+ type: Input
3467
+ }], inputId: [{
3468
+ type: Input
3469
+ }], ariaLabel: [{
3470
+ type: Input,
3471
+ args: ['aria-label']
3472
+ }], readonly: [{
3473
+ type: Input
3474
+ }], disabled: [{
3475
+ type: Input
3476
+ }], pattern: [{
3477
+ type: Input
3478
+ }], currency: [{
3479
+ type: Input
3480
+ }], placeholder: [{
3481
+ type: Input
3482
+ }], required: [{
3483
+ type: Input
3484
+ }], type: [{
3485
+ type: Input
3486
+ }], value: [{
3487
+ type: Input
3488
+ }], valueChange: [{
3489
+ type: Output
3490
+ }], keyPress: [{
3491
+ type: Output
3492
+ }] } });
3493
+
3494
+ var Placement;
3495
+ (function (Placement) {
3496
+ Placement["Top"] = "top";
3497
+ Placement["Bottom"] = "bottom";
3498
+ Placement["Left"] = "left";
3499
+ Placement["Right"] = "right";
3500
+ })(Placement || (Placement = {}));
3501
+
3502
+ /**
3503
+ * Default Tooltip Component
3504
+ */
3505
+ class TooltipComponent {
3506
+ constructor() { }
3507
+ }
3508
+ TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3509
+ TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: TooltipComponent, selector: "ng-component", inputs: { context: "context" }, ngImport: i0, template: `
3510
+ <span class="lux-tooltip" style="transition: opacity 200ms">{{context.message}}</span>
3511
+ `, isInline: true });
3512
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TooltipComponent, decorators: [{
3513
+ type: Component,
3514
+ args: [{
3515
+ template: `
3516
+ <span class="lux-tooltip" style="transition: opacity 200ms">{{context.message}}</span>
3517
+ `
3518
+ }]
3519
+ }], ctorParameters: function () { return []; }, propDecorators: { context: [{
3520
+ type: Input
3521
+ }] } });
3522
+
3523
+ class TooltipContentRef {
3524
+ constructor(viewRef, componentRef) {
3525
+ this.viewRef = viewRef;
3526
+ this.componentRef = componentRef;
3527
+ }
3528
+ }
3529
+
3530
+ class TooltipService {
3531
+ constructor(_injector, _crf, _applicationRef) {
3532
+ this._injector = _injector;
3533
+ this._crf = _crf;
3534
+ this._applicationRef = _applicationRef;
3535
+ }
3536
+ appendComponentToBody(content, elHost, placement) {
3537
+ const tooltipContentRef = this.getTooltipContentRef(content);
3538
+ if (tooltipContentRef) {
3539
+ let domElem = tooltipContentRef.viewRef
3540
+ .rootNodes[0];
3541
+ document.body.appendChild(domElem);
3542
+ if (tooltipContentRef.componentRef) {
3543
+ tooltipContentRef.componentRef.changeDetectorRef.detectChanges();
3544
+ }
3545
+ domElem = this.setStyle(domElem, placement);
3546
+ domElem = this.setPosition(domElem, elHost, placement);
3547
+ return tooltipContentRef;
3548
+ }
3549
+ return null;
3550
+ }
3551
+ removeComponentFromBody(tooltipContentRef) {
3552
+ this._applicationRef.detachView(tooltipContentRef.viewRef);
3553
+ if (tooltipContentRef.componentRef) {
3554
+ tooltipContentRef.componentRef.destroy();
3555
+ }
3556
+ }
3557
+ getTooltipContentRef(content) {
3558
+ if (!content) {
3559
+ // nothing to show
3560
+ }
3561
+ else if (content instanceof TemplateRef) {
3562
+ return this.createFromTemplateRef(content);
3563
+ }
3564
+ else if (typeof content === 'string') {
3565
+ return this.createFromComponent(TooltipComponent, { message: content });
3566
+ }
3567
+ else {
3568
+ return this.createFromComponent(content);
3569
+ }
3570
+ }
3571
+ createFromTemplateRef(content) {
3572
+ const viewRef = content.createEmbeddedView({});
3573
+ this._applicationRef.attachView(viewRef);
3574
+ return new TooltipContentRef(viewRef);
3575
+ }
3576
+ createFromComponent(component, context) {
3577
+ const componentRef = this._crf
3578
+ .resolveComponentFactory(component)
3579
+ .create(this._injector);
3580
+ if (context) {
3581
+ componentRef.instance.context = context;
3582
+ }
3583
+ this._applicationRef.attachView(componentRef.hostView);
3584
+ return new TooltipContentRef(componentRef.hostView, componentRef);
3585
+ }
3586
+ setStyle(domElem, placement) {
3587
+ domElem.style.position = 'absolute';
3588
+ domElem.style.minWidth = 'min-content';
3589
+ domElem.style.minHeight = 'min-content';
3590
+ const tooltipElement = this.getTooltipElementFromHTMLElemnt(domElem);
3591
+ placement =
3592
+ placement !== undefined
3593
+ ? placement.toLocaleLowerCase()
3594
+ : 'top'; // 'Top' is the default value of placement
3595
+ tooltipElement.classList.add(`lux-tooltip-${placement}`);
3596
+ tooltipElement.classList.add('lux-tooltip-show');
3597
+ return domElem;
3598
+ }
3599
+ getTooltipElementFromHTMLElemnt(domElem) {
3600
+ const elementsArray = Array.from(domElem.classList).filter((className) => className === 'lux-tooltip');
3601
+ if (elementsArray.length !== 0) {
3602
+ return domElem;
3603
+ }
3604
+ else if (domElem.hasChildNodes()) {
3605
+ const childrenArray = Array.from(domElem.children).filter((child) => this.getTooltipElementFromHTMLElemnt(child) !== null);
3606
+ if (childrenArray.length !== 0) {
3607
+ return this.getTooltipElementFromHTMLElemnt(childrenArray[0]);
3608
+ }
3609
+ else {
3610
+ return null;
3611
+ }
3612
+ }
3613
+ else {
3614
+ return null;
3615
+ }
3616
+ }
3617
+ setPosition(domElem, elHost, placement) {
3618
+ const hostPos = elHost.nativeElement.getBoundingClientRect();
3619
+ const tooltipPos = domElem.getBoundingClientRect();
3620
+ const scrollPos = window.pageYOffset ||
3621
+ document.documentElement.scrollTop ||
3622
+ document.body.scrollTop ||
3623
+ 0;
3624
+ let top = 0;
3625
+ let left = 0;
3626
+ const offset = 10;
3627
+ switch (placement) {
3628
+ case Placement.Bottom:
3629
+ top = hostPos.bottom + offset;
3630
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
3631
+ break;
3632
+ case Placement.Left:
3633
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
3634
+ left = hostPos.left - tooltipPos.width - offset;
3635
+ break;
3636
+ case Placement.Right:
3637
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
3638
+ left = hostPos.right + offset;
3639
+ break;
3640
+ case Placement.Top:
3641
+ default:
3642
+ top = hostPos.top - tooltipPos.height - offset;
3643
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
3644
+ break;
3645
+ }
3646
+ top = Math.max(0, top);
3647
+ left = Math.max(0, left);
3648
+ domElem.style.top = `${top + scrollPos}px`;
3649
+ domElem.style.left = `${left}px`;
3650
+ return domElem;
3651
+ }
3652
+ }
3653
+ TooltipService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TooltipService, deps: [{ token: i0.Injector }, { token: i0.ComponentFactoryResolver }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
3654
+ TooltipService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TooltipService });
3655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TooltipService, decorators: [{
3656
+ type: Injectable
3657
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }]; } });
3658
+
3659
+ /**
3660
+ * Tooltip directive
3661
+ */
3662
+ class LuxTooltipDirective {
3663
+ constructor(elHost, tooltipService) {
3664
+ this.elHost = elHost;
3665
+ this.tooltipService = tooltipService;
3666
+ }
3667
+ onMouseEnter() {
3668
+ if (!this.tooltipRef) {
3669
+ this.tooltipRef = this.show(this.content, this.elHost, this.placement);
3670
+ }
3671
+ }
3672
+ onMouseLeave() {
3673
+ if (this.tooltipRef) {
3674
+ this.remove(this.tooltipRef);
3675
+ this.tooltipRef = null;
3676
+ }
3677
+ }
3678
+ onClick() {
3679
+ if (this.tooltipRef) {
3680
+ this.remove(this.tooltipRef);
3681
+ this.tooltipRef = null;
3682
+ }
3683
+ }
3684
+ show(component, elHost, placement) {
3685
+ return this.tooltipService.appendComponentToBody(component, elHost, placement);
3686
+ }
3687
+ remove(tooltipRef) {
3688
+ this.tooltipService.removeComponentFromBody(tooltipRef);
3689
+ }
3690
+ }
3691
+ LuxTooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxTooltipDirective, deps: [{ token: i0.ElementRef }, { token: TooltipService }], target: i0.ɵɵFactoryTarget.Directive });
3692
+ LuxTooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: LuxTooltipDirective, selector: "[luxTooltip]", inputs: { luxTooltip: "luxTooltip", content: "content", placement: "placement" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick()" } }, ngImport: i0 });
3693
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxTooltipDirective, decorators: [{
3694
+ type: Directive,
3695
+ args: [{
3696
+ selector: '[luxTooltip]'
3697
+ }]
3698
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TooltipService }]; }, propDecorators: { luxTooltip: [{
3699
+ type: Input
3700
+ }], content: [{
3701
+ type: Input
3702
+ }], placement: [{
3703
+ type: Input
3704
+ }], onMouseEnter: [{
3705
+ type: HostListener,
3706
+ args: ['mouseenter']
3707
+ }], onMouseLeave: [{
3708
+ type: HostListener,
3709
+ args: ['mouseleave']
3710
+ }], onClick: [{
3711
+ type: HostListener,
3712
+ args: ['click']
3713
+ }] } });
3714
+
3715
+ class PaginationComponent {
3716
+ constructor() {
3717
+ this.literals = {
3718
+ en: {
3719
+ first: 'First',
3720
+ previous: 'Previous',
3721
+ next: 'Next',
3722
+ last: 'Last'
3723
+ },
3724
+ es: {
3725
+ first: 'Primero',
3726
+ previous: 'Anterior',
3727
+ next: 'Siguiente',
3728
+ last: 'Último'
3729
+ }
3730
+ };
3731
+ this.showPagination = false;
3732
+ this.hidePrevious = false;
3733
+ this.lastPage = false;
3734
+ this.totalPages = 0;
3735
+ this.displayNextEllipsis = false;
3736
+ this.displayPreviousEllipsis = false;
3737
+ this.pages = [];
3738
+ this.goToPage = new EventEmitter();
3739
+ this.pageSizeChange = new EventEmitter();
3740
+ this.lang = languageDetector();
3741
+ }
3742
+ set lang(l) {
3743
+ if (l === this._lang) {
3744
+ return;
3745
+ }
3746
+ if (Object.keys(this.literals).includes(l)) {
3747
+ this._lang = l;
3748
+ }
3749
+ else {
3750
+ this._lang = 'en';
3751
+ }
3752
+ this.loadLanguage();
3753
+ }
3754
+ get lang() {
3755
+ return this._lang;
3756
+ }
3757
+ set paginationInfo(value) {
3758
+ this.paginationInfoValue = value;
3759
+ this.syncState();
3760
+ }
3761
+ get paginationInfo() {
3762
+ return this.paginationInfoValue;
3763
+ }
3764
+ ngOnInit() {
3765
+ this.calculatePages();
3766
+ }
3767
+ pageSizeChanged(pageSize) {
3768
+ this.paginationInfo.pageSize = pageSize;
3769
+ this.syncState();
3770
+ this.pageSizeChange.emit(pageSize);
3771
+ }
3772
+ onPage(n) {
3773
+ this.goToPage.emit(n);
3774
+ }
3775
+ onFirst() {
3776
+ this.goToPage.emit(0);
3777
+ }
3778
+ onLast() {
3779
+ this.goToPage.emit(this.totalPages - 1);
3780
+ }
3781
+ onNext() {
3782
+ const page = (this.paginationInfo.page || 0) + 1;
3783
+ this.goToPage.emit(page);
3784
+ }
3785
+ onPrevious() {
3786
+ const page = (this.paginationInfo.page || 0) - 1;
3787
+ this.goToPage.emit(page);
3788
+ }
3789
+ syncState() {
3790
+ this.pages = this.calculatePages();
3791
+ this.showPagination =
3792
+ this.paginationInfo.total > this.paginationInfo.pageSize;
3793
+ this.hidePrevious = this.paginationInfo.page === 0;
3794
+ this.lastPage =
3795
+ this.paginationInfo.pageSize * (this.paginationInfo.page + 1) >=
3796
+ this.paginationInfo.total;
3797
+ this.totalPages =
3798
+ Math.ceil(this.paginationInfo.total / this.paginationInfo.pageSize) || 0;
3799
+ this.displayNextEllipsis = !this.pages.includes(this.totalPages - 1);
3800
+ this.displayPreviousEllipsis = !this.pages.includes(0);
3801
+ }
3802
+ calculatePages() {
3803
+ const totalPages = Math.ceil(this.paginationInfo.total / this.paginationInfo.pageSize) - 1; // 0-index
3804
+ const p = this.paginationInfo.page || 0;
3805
+ const pagesToShow = this.paginationInfo.pagesToShow;
3806
+ const pages = [];
3807
+ pages.push(p);
3808
+ const times = pagesToShow - 1;
3809
+ for (let i = 0; i < times; i++) {
3810
+ if (pages.length < pagesToShow) {
3811
+ if (Math.min(...pages) > 0) {
3812
+ pages.unshift(Math.min(...pages) - 1);
3813
+ }
3814
+ }
3815
+ if (pages.length < pagesToShow) {
3816
+ if (Math.max(...pages) < totalPages) {
3817
+ pages.push(Math.max(...pages) + 1);
3818
+ }
3819
+ }
3820
+ }
3821
+ pages.sort((a, b) => a - b);
3822
+ return pages;
3823
+ }
3824
+ loadLanguage() {
3825
+ const l = this.literals[this.lang];
3826
+ this.first = l.first;
3827
+ this.previous = l.previous;
3828
+ this.next = l.next;
3829
+ this.last = l.last;
3830
+ }
3831
+ }
3832
+ PaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3833
+ PaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: PaginationComponent, selector: "lux-pagination", inputs: { lang: "lang", paginationInfo: "paginationInfo" }, outputs: { goToPage: "goToPage", pageSizeChange: "pageSizeChange" }, ngImport: i0, template: "<div class=\"lux-pagination\" *ngIf=\"showPagination\">\n <ng-container *ngIf=\"!hidePrevious\">\n <a\n luxTooltip\n [content]=\"first\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onFirst()\"\n [ngClass]=\"{\n enabledFirstLast: !hidePrevious\n }\"\n class=\"button-pagination icon arrow-left-end\"\n ></a>\n <a\n luxTooltip\n [content]=\"previous\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onPrevious()\"\n [ngClass]=\"{\n enabledFirstLast: !hidePrevious\n }\"\n class=\"button-pagination icon arrow-left\"\n ></a>\n </ng-container>\n\n <span class=\"ellipsis\" *ngIf=\"displayPreviousEllipsis\">...</span>\n\n <ng-container *ngFor=\"let pageNum of pages\">\n <a\n placement=\"top\"\n delay=\"500\"\n [ngClass]=\"{\n disabled: pageNum === paginationInfo.page,\n enabled: pageNum !== paginationInfo.page\n }\"\n class=\"button-pagination\"\n (click)=\"onPage(pageNum)\"\n >{{ pageNum + 1 }}</a\n >\n </ng-container>\n\n <span class=\"ellipsis\" *ngIf=\"displayNextEllipsis\">...</span>\n\n <ng-container *ngIf=\"!lastPage\">\n <a\n luxTooltip\n [content]=\"next\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onNext()\"\n [ngClass]=\"{\n enabledFirstLast: !lastPage\n }\"\n class=\"button-pagination icon arrow-right\"\n ></a>\n <a\n luxTooltip\n [content]=\"last\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onLast()\"\n [ngClass]=\"{\n enabledFirstLast: !lastPage\n }\"\n class=\"button-pagination icon arrow-right-end\"\n ></a>\n </ng-container>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.lux-pagination{display:flex;flex-direction:row;margin:2% 0;width:100%;background:white;align-items:center}.disabled{cursor:not-allowed;border:1px solid #325c81;border:var(--lux-pagination-disabled-border, 1px solid #325c81);border-radius:10%;border-radius:var(--lux-pagination-disabled-border-radius, 10%);padding:1%;margin:0 .7%;color:#fff;color:var(--lux-pagination-disabled-color, white);background-color:#325c81;background-color:var(--lux-pagination-disabled-background-color, #325c81);text-decoration:none;pointer-events:none}.enabled{border:1px solid #cfcfcf;border:var(--lux-pagination-enabled-border, 1px solid #cfcfcf);border-radius:10%;border-radius:var(--lux-pagination-enabled-border-radius, 10%);padding:1%;margin:0 .7%;color:#325c81;color:var(--lux-pagination-enabled-color, #325c81);width:-webkit-min-content;width:-moz-min-content;width:min-content;cursor:pointer}.enabledFirstLast{border:1px solid #cfcfcf;border-radius:10%;padding:1%;color:#325c81;margin:0 .7%;width:-webkit-min-content;width:-moz-min-content;width:min-content;cursor:pointer}.ellipsis{margin:0rem .5rem;padding:0rem;color:#325c81;width:-webkit-min-content;width:-moz-min-content;width:min-content}.button-pagination{width:1em;width:var(--lux-pagination-button-width, 1em);height:1.2em;height:var(--lux-pagination-button-height, 1.2em);font-size:80%;font-size:var(--lux-pagination-font-size, 80%);text-align:center}.icon{background-size:1.3em 1.4em;background-position:center;background-repeat:no-repeat}.arrow-right{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-position:.4em}.arrow-left{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");transform:rotate(180deg);background-position:.4em}.arrow-right-end{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_3%22 points%3D%2241.8%2C45.7 30.4%2C44.3 50.8%2C24 30.4%2C3.7 41.8%2C2.3 63.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-position:.1em}.arrow-left-end{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_3%22 points%3D%2241.8%2C45.7 30.4%2C44.3 50.8%2C24 30.4%2C3.7 41.8%2C2.3 63.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-position:.1em;transform:rotate(180deg)}@media only screen and (min-width: 300px) and (max-width: 500px){.arrow-right,.arrow-left{background-position:.2em}.arrow-right-end,.arrow-left-end{background-position:0em}}@media only screen and (min-width: 500px) and (max-width: 850px){.arrow-right,.arrow-left{background-position:.3em}.arrow-right-end,.arrow-left-end{background-position:0em}}@media only screen and (min-width: 900px){.arrow-right,.arrow-left{background-position:.2em}.arrow-right-end,.arrow-left-end{background-position:0em}}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: LuxTooltipDirective, selector: "[luxTooltip]", inputs: ["luxTooltip", "content", "placement"] }, { type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
3834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: PaginationComponent, decorators: [{
3835
+ type: Component,
3836
+ args: [{ selector: 'lux-pagination', template: "<div class=\"lux-pagination\" *ngIf=\"showPagination\">\n <ng-container *ngIf=\"!hidePrevious\">\n <a\n luxTooltip\n [content]=\"first\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onFirst()\"\n [ngClass]=\"{\n enabledFirstLast: !hidePrevious\n }\"\n class=\"button-pagination icon arrow-left-end\"\n ></a>\n <a\n luxTooltip\n [content]=\"previous\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onPrevious()\"\n [ngClass]=\"{\n enabledFirstLast: !hidePrevious\n }\"\n class=\"button-pagination icon arrow-left\"\n ></a>\n </ng-container>\n\n <span class=\"ellipsis\" *ngIf=\"displayPreviousEllipsis\">...</span>\n\n <ng-container *ngFor=\"let pageNum of pages\">\n <a\n placement=\"top\"\n delay=\"500\"\n [ngClass]=\"{\n disabled: pageNum === paginationInfo.page,\n enabled: pageNum !== paginationInfo.page\n }\"\n class=\"button-pagination\"\n (click)=\"onPage(pageNum)\"\n >{{ pageNum + 1 }}</a\n >\n </ng-container>\n\n <span class=\"ellipsis\" *ngIf=\"displayNextEllipsis\">...</span>\n\n <ng-container *ngIf=\"!lastPage\">\n <a\n luxTooltip\n [content]=\"next\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onNext()\"\n [ngClass]=\"{\n enabledFirstLast: !lastPage\n }\"\n class=\"button-pagination icon arrow-right\"\n ></a>\n <a\n luxTooltip\n [content]=\"last\"\n placement=\"top\"\n delay=\"500\"\n (click)=\"onLast()\"\n [ngClass]=\"{\n enabledFirstLast: !lastPage\n }\"\n class=\"button-pagination icon arrow-right-end\"\n ></a>\n </ng-container>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.lux-pagination{display:flex;flex-direction:row;margin:2% 0;width:100%;background:white;align-items:center}.disabled{cursor:not-allowed;border:1px solid #325c81;border:var(--lux-pagination-disabled-border, 1px solid #325c81);border-radius:10%;border-radius:var(--lux-pagination-disabled-border-radius, 10%);padding:1%;margin:0 .7%;color:#fff;color:var(--lux-pagination-disabled-color, white);background-color:#325c81;background-color:var(--lux-pagination-disabled-background-color, #325c81);text-decoration:none;pointer-events:none}.enabled{border:1px solid #cfcfcf;border:var(--lux-pagination-enabled-border, 1px solid #cfcfcf);border-radius:10%;border-radius:var(--lux-pagination-enabled-border-radius, 10%);padding:1%;margin:0 .7%;color:#325c81;color:var(--lux-pagination-enabled-color, #325c81);width:-webkit-min-content;width:-moz-min-content;width:min-content;cursor:pointer}.enabledFirstLast{border:1px solid #cfcfcf;border-radius:10%;padding:1%;color:#325c81;margin:0 .7%;width:-webkit-min-content;width:-moz-min-content;width:min-content;cursor:pointer}.ellipsis{margin:0rem .5rem;padding:0rem;color:#325c81;width:-webkit-min-content;width:-moz-min-content;width:min-content}.button-pagination{width:1em;width:var(--lux-pagination-button-width, 1em);height:1.2em;height:var(--lux-pagination-button-height, 1.2em);font-size:80%;font-size:var(--lux-pagination-font-size, 80%);text-align:center}.icon{background-size:1.3em 1.4em;background-position:center;background-repeat:no-repeat}.arrow-right{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-position:.4em}.arrow-left{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");transform:rotate(180deg);background-position:.4em}.arrow-right-end{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_3%22 points%3D%2241.8%2C45.7 30.4%2C44.3 50.8%2C24 30.4%2C3.7 41.8%2C2.3 63.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-position:.1em}.arrow-left-end{background-image:url(\"data:image/svg+xml,%3Csvg width%3D%2268%22 height%3D%2248%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cg%3E %3Ctitle%3Ebackground%3C%2Ftitle%3E %3Crect fill%3D%22none%22 id%3D%22canvas_background%22 height%3D%22402%22 width%3D%221082%22 y%3D%22-1%22 x%3D%22-1%22%2F%3E %3C%2Fg%3E %3Cg%3E %3Ctitle%3ELayer 1%3C%2Ftitle%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_2%22 points%3D%2221.8%2C45.7 10.4%2C44.3 30.8%2C24 10.4%2C3.7 21.8%2C2.3 43.5%2C24 %22%2F%3E %3Cpolygon fill%3D%22%23325C81%22 id%3D%22svg_3%22 points%3D%2241.8%2C45.7 30.4%2C44.3 50.8%2C24 30.4%2C3.7 41.8%2C2.3 63.5%2C24 %22%2F%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-position:.1em;transform:rotate(180deg)}@media only screen and (min-width: 300px) and (max-width: 500px){.arrow-right,.arrow-left{background-position:.2em}.arrow-right-end,.arrow-left-end{background-position:0em}}@media only screen and (min-width: 500px) and (max-width: 850px){.arrow-right,.arrow-left{background-position:.3em}.arrow-right-end,.arrow-left-end{background-position:0em}}@media only screen and (min-width: 900px){.arrow-right,.arrow-left{background-position:.2em}.arrow-right-end,.arrow-left-end{background-position:0em}}\n"] }]
3837
+ }], ctorParameters: function () { return []; }, propDecorators: { goToPage: [{
3838
+ type: Output
3839
+ }], pageSizeChange: [{
3840
+ type: Output
3841
+ }], lang: [{
3842
+ type: Input
3843
+ }], paginationInfo: [{
3844
+ type: Input
3845
+ }] } });
3846
+
3847
+ class RadiogroupComponent {
3848
+ constructor() {
3849
+ this.touched = false;
3850
+ this.name = 'radiogroup1';
3851
+ this.disabled = false;
3852
+ this.readonly = false;
3853
+ this.required = false;
3854
+ this.itemsChange = new EventEmitter();
3855
+ this.valueChange = new EventEmitter();
3856
+ this._value = undefined;
3857
+ this._items = [];
3858
+ // ControlValueAccessor Interface
3859
+ this.onChange = (value) => { };
3860
+ this.onTouched = () => { };
3861
+ }
3862
+ set items(col) {
3863
+ this._items = (col || []).map((it, index) => this.ensureHasUniqueName(it, index));
3864
+ this.itemsChange.emit(col);
3865
+ }
3866
+ get items() {
3867
+ return this._items;
3868
+ }
3869
+ set value(v) {
3870
+ if (v === this._value) {
3871
+ return;
3872
+ }
3873
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
3874
+ this._value = v;
3875
+ this.onChange(v);
3876
+ if (!initialAndEmpty) {
3877
+ this.valueChange.emit(v);
3878
+ }
3879
+ }
3880
+ get value() {
3881
+ return this._value;
3882
+ }
3883
+ writeValue(value) {
3884
+ this.value = value;
3885
+ }
3886
+ registerOnChange(onChange) {
3887
+ this.onChange = onChange;
3888
+ }
3889
+ registerOnTouched(onTouched) {
3890
+ this.onTouched = onTouched;
3891
+ }
3892
+ markAsTouched() {
3893
+ if (!this.touched) {
3894
+ this.onTouched();
3895
+ this.touched = true;
3896
+ }
3897
+ }
3898
+ setDisabledState(disabled) {
3899
+ this.disabled = disabled;
3900
+ }
3901
+ // End ControlValueAccessor Interface
3902
+ // Validator interface
3903
+ registerOnValidatorChange() { }
3904
+ validate(control) {
3905
+ const value = control.value;
3906
+ if (this.required &&
3907
+ (value === '' || value === null || value === undefined)) {
3908
+ return { required: { value, reason: 'Required field.' } };
3909
+ }
3910
+ return null;
3911
+ }
3912
+ // End of Validator interface
3913
+ setValue(event, item) {
3914
+ if (!this.disabled && !this.readonly) {
3915
+ this.value = item.value;
3916
+ this.markAsTouched();
3917
+ }
3918
+ event.preventDefault();
3919
+ }
3920
+ ensureHasUniqueName(item, index) {
3921
+ if (!item.name) {
3922
+ item.name = `${this.name}_${index}`;
3923
+ }
3924
+ return item;
3925
+ }
3926
+ }
3927
+ RadiogroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: RadiogroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3928
+ RadiogroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: RadiogroupComponent, selector: "lux-radiogroup", inputs: { name: "name", disabled: "disabled", readonly: "readonly", required: "required", items: "items", value: "value" }, outputs: { itemsChange: "itemsChange", valueChange: "valueChange" }, providers: [
3929
+ {
3930
+ provide: NG_VALUE_ACCESSOR,
3931
+ multi: true,
3932
+ useExisting: forwardRef(() => RadiogroupComponent)
3933
+ },
3934
+ {
3935
+ provide: NG_VALIDATORS,
3936
+ multi: true,
3937
+ useExisting: forwardRef(() => RadiogroupComponent)
3938
+ }
3939
+ ], ngImport: i0, template: "<div class=\"radiogroup\"\n [class.disabled]=\"disabled || readonly\"\n >\n <ng-container *ngFor=\"let item of items; let first=first; let last=last\">\n <div [class.radio-start]=\"first\"\n [class.radio-end]=\"last\"\n class=\"radio-item\"\n [class.selected]=\"item.value === value\"\n (click)=\"setValue($event, item)\"\n >\n <input [id]=\"item.name\"\n type=\"radio\"\n [name]=\"name\"\n [attr.disabled]=\"disabled || null\"\n [attr.readonly]=\"readonly || null\"\n [value]=\"item.value\">\n <label [for]=\"item.name\"\n class=\"unselectable\"\n >{{ item.label }}</label>\n </div>\n</ng-container>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.radiogroup{display:flex}.radio-item{border-radius:0;border:1px solid #ccc;padding:0rem .5rem;padding:var(--lux-radiogroup-padding, 0rem .5rem)}.radio-item input{display:none}.radio-item label{color:initial;color:var(--lux-radiogroup-color, initial);font-size:initial;font-size:var(--lux-radiogroup-font-size, initial);margin-top:.3rem;margin-bottom:.3rem}.radio-item.selected{background-color:#2e2eac;background-color:var(--lux-radiogroup-selected-background-color, #2e2eac)}.radio-item.selected label{font-size:initial;font-size:var(--lux-radiogroup-font-size, initial);color:#fff;color:var(--lux-radiogroup-selected-color, white)}.radio-start{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.radio-end{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.disabled .radio-item{background-color:#f0f0f0;color:#444}.disabled .selected{font-size:initial;font-size:var(--lux-radiogroup-selected-disabled-font-size, initial);color:#fff;color:var(--lux-radiogroup-selected-disabled-color, white);background-color:#9898ec;background-color:var(--lux-radiogroup-selected-disabled-background-color, #9898ec)}.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}\n"], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
3940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: RadiogroupComponent, decorators: [{
3941
+ type: Component,
3942
+ args: [{ selector: 'lux-radiogroup', providers: [
3943
+ {
3944
+ provide: NG_VALUE_ACCESSOR,
3945
+ multi: true,
3946
+ useExisting: forwardRef(() => RadiogroupComponent)
3947
+ },
3948
+ {
3949
+ provide: NG_VALIDATORS,
3950
+ multi: true,
3951
+ useExisting: forwardRef(() => RadiogroupComponent)
3952
+ }
3953
+ ], template: "<div class=\"radiogroup\"\n [class.disabled]=\"disabled || readonly\"\n >\n <ng-container *ngFor=\"let item of items; let first=first; let last=last\">\n <div [class.radio-start]=\"first\"\n [class.radio-end]=\"last\"\n class=\"radio-item\"\n [class.selected]=\"item.value === value\"\n (click)=\"setValue($event, item)\"\n >\n <input [id]=\"item.name\"\n type=\"radio\"\n [name]=\"name\"\n [attr.disabled]=\"disabled || null\"\n [attr.readonly]=\"readonly || null\"\n [value]=\"item.value\">\n <label [for]=\"item.name\"\n class=\"unselectable\"\n >{{ item.label }}</label>\n </div>\n</ng-container>\n</div>\n", styles: [":focus{z-index:1}input,select,textarea{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057);margin:0rem;margin:var(--lux-input-margin, 0rem);padding:0rem .5rem;padding:var(--lux-input-padding, 0rem .5rem)}.alert{padding:.2rem 2rem;background:#fe2e2e;background:var(--lux-alert-background, #fe2e2e);color:#fff;color:var(--lux-alert-color, white);font-family:Consolas,monospace;width:45%;margin-right:1rem;display:inline-block}.symbol{display:inline-block;align-items:baseline;padding:0rem .5rem;margin-bottom:0;font-weight:400;color:default;color:var(--lux-symbol-color, default);text-align:center;white-space:nowrap;background:default;background:var(--lux-symbol-background, default);font-size:1rem;font-size:var(--lux-symbol-font-size, 1rem)}.bordered,.symbol{border:1px solid #495057;border:var(--lux-input-border, 1px solid) var(--lux-input-border-color, #495057)}.rounded,.rounded-right,.rounded-middle,.rounded-left{border-radius:.25rem;border-radius:var(--lux-border-radius, .25rem)}.rounded-left{border-top-right-radius:0;border-bottom-right-radius:0}.rounded-middle{border-radius:0}.rounded-right{border-top-left-radius:0;border-bottom-left-radius:0}.prefix{border-right:none}.infix{border-left:none;border-right:none}.postfix{border-left:none;display:flex;align-items:center}.monospace{font-family:monospace}.default-font{color:#000;color:var(--lux-font-color, black)}.radiogroup{display:flex}.radio-item{border-radius:0;border:1px solid #ccc;padding:0rem .5rem;padding:var(--lux-radiogroup-padding, 0rem .5rem)}.radio-item input{display:none}.radio-item label{color:initial;color:var(--lux-radiogroup-color, initial);font-size:initial;font-size:var(--lux-radiogroup-font-size, initial);margin-top:.3rem;margin-bottom:.3rem}.radio-item.selected{background-color:#2e2eac;background-color:var(--lux-radiogroup-selected-background-color, #2e2eac)}.radio-item.selected label{font-size:initial;font-size:var(--lux-radiogroup-font-size, initial);color:#fff;color:var(--lux-radiogroup-selected-color, white)}.radio-start{border-top-left-radius:.5rem;border-bottom-left-radius:.5rem}.radio-end{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.disabled .radio-item{background-color:#f0f0f0;color:#444}.disabled .selected{font-size:initial;font-size:var(--lux-radiogroup-selected-disabled-font-size, initial);color:#fff;color:var(--lux-radiogroup-selected-disabled-color, white);background-color:#9898ec;background-color:var(--lux-radiogroup-selected-disabled-background-color, #9898ec)}.unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}\n"] }]
3954
+ }], ctorParameters: function () { return []; }, propDecorators: { name: [{
3955
+ type: Input
3956
+ }], disabled: [{
3957
+ type: Input
3958
+ }], readonly: [{
3959
+ type: Input
3960
+ }], required: [{
3961
+ type: Input
3962
+ }], items: [{
3963
+ type: Input
3964
+ }], itemsChange: [{
3965
+ type: Output
3966
+ }], value: [{
3967
+ type: Input
3968
+ }], valueChange: [{
3969
+ type: Output
3970
+ }] } });
3971
+
3972
+ let sequencer = 0;
3973
+ class SelectComponent {
3974
+ constructor() {
3975
+ this.id = 'stringList' + sequencer++;
3976
+ this.disabled = false;
3977
+ this.required = false;
3978
+ /** Allow multiple elements */
3979
+ this.multiple = true;
3980
+ this.value = [];
3981
+ this.valueChange = new EventEmitter();
3982
+ this.placeholder = 'Add new';
3983
+ /** If set, check there is no duplicates in the data. */
3984
+ this.unique = true;
3985
+ /** Validation function for new items. Returns error or null if valid */
3986
+ this.validateItem = (_) => null;
3987
+ this.newEntry = '';
3988
+ this.error = null;
3989
+ this.isValidNewEntry = false;
3990
+ this.touched = false;
3991
+ // ControlValueAccessor Interface
3992
+ this.onChange = (value) => { };
3993
+ this.onTouched = () => { };
3994
+ }
3995
+ writeValue(value) {
3996
+ this.value = value;
3997
+ }
3998
+ registerOnChange(onChange) {
3999
+ this.onChange = onChange;
4000
+ }
4001
+ registerOnTouched(onTouched) {
4002
+ this.onTouched = onTouched;
4003
+ }
4004
+ markAsTouched() {
4005
+ if (!this.touched) {
4006
+ this.onTouched();
4007
+ this.touched = true;
4008
+ }
4009
+ }
4010
+ setDisabledState(disabled) {
4011
+ this.disabled = disabled;
4012
+ }
4013
+ // End ControlValueAccessor Interface
4014
+ // Validator interface
4015
+ registerOnValidatorChange() { }
4016
+ validate(control) {
4017
+ const value = control.value;
4018
+ if (this.required &&
4019
+ (value === '' || value === null || value === undefined)) {
4020
+ return { required: { value, reason: 'Required field.' } };
4021
+ }
4022
+ return null;
4023
+ }
4024
+ // End of Validator interface
4025
+ get canAdd() {
4026
+ return this.multiple || this.value.length === 0;
4027
+ }
4028
+ add(val) {
4029
+ this.value.push(val);
4030
+ this.newEntry = '';
4031
+ this.markAsTouched();
4032
+ this.valueChange.emit(this.value);
4033
+ }
4034
+ remove(index) {
4035
+ if (this.value.length > index) {
4036
+ this.value.splice(index, 1);
4037
+ this.markAsTouched();
4038
+ this.valueChange.emit(this.value);
4039
+ }
4040
+ }
4041
+ onKeyPress(event) {
4042
+ if (event.key === 'Enter' && !this.error && this.newEntry !== '') {
4043
+ // Add on pressing Enter/Return
4044
+ this.markAsTouched();
4045
+ this.add(this.newEntry);
4046
+ }
4047
+ }
4048
+ onChangeNewEntry(newValue) {
4049
+ this.markAsTouched();
4050
+ if (!newValue) {
4051
+ this.isValidNewEntry = false;
4052
+ this.error = null;
4053
+ return;
4054
+ }
4055
+ if (this.unique) {
4056
+ const found = (this.value || []).find((it) => it === newValue);
4057
+ this.isValidNewEntry = !found;
4058
+ this.error = found
4059
+ ? `Value '${newValue}' is already in. Cannot add duplicates.`
4060
+ : null;
4061
+ if (!this.isValidNewEntry) {
4062
+ return;
4063
+ }
4064
+ }
4065
+ this.error = this.validateItem(newValue);
4066
+ this.isValidNewEntry = !this.error;
4067
+ }
4068
+ }
4069
+ SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4070
+ SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.2", type: SelectComponent, selector: "lux-select", inputs: { id: "id", disabled: "disabled", required: "required", multiple: "multiple", value: "value", placeholder: "placeholder", unique: "unique", validateItem: "validateItem" }, outputs: { valueChange: "valueChange" }, providers: [
4071
+ {
4072
+ provide: NG_VALUE_ACCESSOR,
4073
+ multi: true,
4074
+ useExisting: forwardRef(() => SelectComponent)
4075
+ },
4076
+ {
4077
+ provide: NG_VALIDATORS,
4078
+ multi: true,
4079
+ useExisting: forwardRef(() => SelectComponent)
4080
+ }
4081
+ ], ngImport: i0, template: "<div class=\"lux-select\">\n <ul class=\"list\">\n <li *ngFor=\"let item of value; let i = index\">\n <span>{{ item }}</span>\n <button *ngIf=\"!disabled\"\n class=\"remove\"\n type=\"button\"\n (click)=\"remove(i)\"\n [attr.aria-label]=\"'Remove ' + item\"\n >Remove</button>\n </li>\n </ul>\n <div class=\"add-new-item\" *ngIf=\"!disabled\">\n <lux-input\n id=\"{{ id + 'addNew' }}\"\n type=\"string\"\n [placeholder]=\"placeholder\"\n [attr.aria-label]=\"placeholder\"\n [disabled]=\"disabled\"\n [(value)]=\"newEntry\"\n (keyPress)=\"onKeyPress($event)\"\n (valueChange)=\"onChangeNewEntry($event)\"\n >\n </lux-input>\n <div *ngIf=\"canAdd\">\n <button *ngIf=\"isValidNewEntry\" type=\"button\" (click)=\"add(newEntry)\">Add</button>\n </div>\n <div class=\"error\">\n {{ error }}\n </div>\n </div>\n</div>\n", styles: [".lux-select{margin-bottom:.5em}.lux-select .list{margin:1em;padding-bottom:.2em;list-style-type:square}.lux-select .list span{margin-bottom:.3em}.remove{margin-left:2em;font-size:.65em;color:#b22222;background:transparent;border:2px solid #BBB}.add-new-item{display:inline-flex;margin-left:2.2em;height:1.6em}.error{margin:.5em 0;color:#b22222}\n"], components: [{ type: InputComponent, selector: "lux-input", inputs: ["rows", "cols", "step", "min", "max", "lang", "inlineErrors", "inputId", "aria-label", "readonly", "disabled", "pattern", "currency", "placeholder", "required", "type", "value"], outputs: ["valueChange", "keyPress"] }], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4082
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SelectComponent, decorators: [{
4083
+ type: Component,
4084
+ args: [{ selector: 'lux-select', providers: [
4085
+ {
4086
+ provide: NG_VALUE_ACCESSOR,
4087
+ multi: true,
4088
+ useExisting: forwardRef(() => SelectComponent)
4089
+ },
4090
+ {
4091
+ provide: NG_VALIDATORS,
4092
+ multi: true,
4093
+ useExisting: forwardRef(() => SelectComponent)
4094
+ }
4095
+ ], template: "<div class=\"lux-select\">\n <ul class=\"list\">\n <li *ngFor=\"let item of value; let i = index\">\n <span>{{ item }}</span>\n <button *ngIf=\"!disabled\"\n class=\"remove\"\n type=\"button\"\n (click)=\"remove(i)\"\n [attr.aria-label]=\"'Remove ' + item\"\n >Remove</button>\n </li>\n </ul>\n <div class=\"add-new-item\" *ngIf=\"!disabled\">\n <lux-input\n id=\"{{ id + 'addNew' }}\"\n type=\"string\"\n [placeholder]=\"placeholder\"\n [attr.aria-label]=\"placeholder\"\n [disabled]=\"disabled\"\n [(value)]=\"newEntry\"\n (keyPress)=\"onKeyPress($event)\"\n (valueChange)=\"onChangeNewEntry($event)\"\n >\n </lux-input>\n <div *ngIf=\"canAdd\">\n <button *ngIf=\"isValidNewEntry\" type=\"button\" (click)=\"add(newEntry)\">Add</button>\n </div>\n <div class=\"error\">\n {{ error }}\n </div>\n </div>\n</div>\n", styles: [".lux-select{margin-bottom:.5em}.lux-select .list{margin:1em;padding-bottom:.2em;list-style-type:square}.lux-select .list span{margin-bottom:.3em}.remove{margin-left:2em;font-size:.65em;color:#b22222;background:transparent;border:2px solid #BBB}.add-new-item{display:inline-flex;margin-left:2.2em;height:1.6em}.error{margin:.5em 0;color:#b22222}\n"] }]
4096
+ }], ctorParameters: function () { return []; }, propDecorators: { id: [{
4097
+ type: Input
4098
+ }], disabled: [{
4099
+ type: Input
4100
+ }], required: [{
4101
+ type: Input
4102
+ }], multiple: [{
4103
+ type: Input
4104
+ }], value: [{
4105
+ type: Input
4106
+ }], valueChange: [{
4107
+ type: Output
4108
+ }], placeholder: [{
4109
+ type: Input
4110
+ }], unique: [{
4111
+ type: Input
4112
+ }], validateItem: [{
4113
+ type: Input
4114
+ }] } });
4115
+
4116
+ class VoiceRecognitionDirective {
4117
+ constructor(el, renderer) {
4118
+ this.el = el;
4119
+ this.renderer = renderer;
4120
+ this.isRecognizing = false;
4121
+ const speechRecognition = window.webkitSpeechRecognition;
4122
+ if (speechRecognition) {
4123
+ this.recognition = new speechRecognition();
4124
+ }
4125
+ }
4126
+ ngOnInit() {
4127
+ if (this.recognition) {
4128
+ // API is available
4129
+ this.recognition.lang = this.language || window.navigator.language;
4130
+ this.recognition.interimResults = false;
4131
+ this.recognition.maxAlternatives = 1;
4132
+ // Add mic icon
4133
+ this.mic = document.createElement('div');
4134
+ this.mic.setAttribute('class', 'lux-microphone');
4135
+ const parent = this.el.nativeElement.parentElement;
4136
+ parent.appendChild(this.mic);
4137
+ // Add event handlers
4138
+ this.mic.onclick = () => this.microphoneClick();
4139
+ this.recognition.onresult = (event) => this.onRecognized(event);
4140
+ }
4141
+ }
4142
+ microphoneClick() {
4143
+ if (this.isRecognizing) {
4144
+ // stop
4145
+ this.isRecognizing = false;
4146
+ this.renderer.removeClass(this.mic, 'lux-recording');
4147
+ this.recognition.abort();
4148
+ }
4149
+ else {
4150
+ // start
4151
+ this.el.nativeElement.value = getRecordingMessage(this.language);
4152
+ this.isRecognizing = true;
4153
+ this.renderer.addClass(this.mic, 'lux-recording');
4154
+ this.recognition.start();
4155
+ }
4156
+ }
4157
+ onRecognized(event) {
4158
+ const recognizedText = event.results[0][0].transcript;
4159
+ this.isRecognizing = false;
4160
+ this.el.nativeElement.value = recognizedText;
4161
+ this.renderer.removeClass(this.mic, 'lux-recording');
4162
+ }
4163
+ }
4164
+ VoiceRecognitionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VoiceRecognitionDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
4165
+ VoiceRecognitionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.2", type: VoiceRecognitionDirective, selector: "[luxVoiceRecognition]", inputs: { language: "language" }, ngImport: i0 });
4166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: VoiceRecognitionDirective, decorators: [{
4167
+ type: Directive,
4168
+ args: [{
4169
+ selector: '[luxVoiceRecognition]'
4170
+ }]
4171
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { language: [{
4172
+ type: Input
4173
+ }] } });
4174
+ const getRecordingMessage = (lang) => {
4175
+ switch (lang.toLowerCase()) {
4176
+ case 'es':
4177
+ case 'es-es':
4178
+ return 'Grabando...';
4179
+ case 'en':
4180
+ case 'en-uk':
4181
+ case 'en-us':
4182
+ default:
4183
+ return 'Recording...';
4184
+ }
4185
+ };
4186
+
4187
+ /* Create a new injection token for injecting the window into a component. */
4188
+ const WINDOW = new InjectionToken('WindowToken');
4189
+ /* Define abstract class for obtaining reference to the global window object. */
4190
+ class WindowRef {
4191
+ // eslint-disable-next-line @typescript-eslint/ban-types
4192
+ get nativeWindow() {
4193
+ throw new Error('Not implemented.');
4194
+ }
4195
+ }
4196
+ /* Define class that implements the abstract class and returns the native window object. */
4197
+ class BrowserWindowRef extends WindowRef {
4198
+ constructor() {
4199
+ super();
4200
+ }
4201
+ // eslint-disable-next-line @typescript-eslint/ban-types
4202
+ get nativeWindow() {
4203
+ return window;
4204
+ }
4205
+ }
4206
+ /* Create an factory function that returns the native window object. */
4207
+ // eslint-disable-next-line @typescript-eslint/ban-types
4208
+ const windowFactory = (browserWindowRef, platformId) => {
4209
+ if (isPlatformBrowser(platformId)) {
4210
+ return browserWindowRef.nativeWindow;
4211
+ }
4212
+ return new Object();
4213
+ };
4214
+ /* Create a injectable provider for the WindowRef token that uses the BrowserWindowRef class. */
4215
+ const browserWindowProvider = {
4216
+ provide: WindowRef,
4217
+ useClass: BrowserWindowRef
4218
+ };
4219
+ /* Create an injectable provider that uses the windowFactory function for returning the native window object. */
4220
+ const windowProvider = {
4221
+ provide: WINDOW,
4222
+ useFactory: windowFactory,
4223
+ deps: [WindowRef, PLATFORM_ID]
4224
+ };
4225
+ /* Create an array of providers. */
4226
+ const WINDOW_PROVIDERS = [
4227
+ browserWindowProvider,
4228
+ windowProvider
4229
+ ];
4230
+
4231
+ class LuxModule {
4232
+ }
4233
+ LuxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4234
+ LuxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModule, declarations: [AutocompleteComponent,
4235
+ AutocompleteListComponent,
4236
+ FilterComponent,
4237
+ CheckboxComponent,
4238
+ DatetimeComponent,
4239
+ InputComponent,
4240
+ GeolocationComponent,
4241
+ LuxTooltipDirective,
4242
+ LuxModalWindowComponent,
4243
+ LuxModalBackdropComponent,
4244
+ LuxBreadcrumbComponent,
4245
+ MapComponent,
4246
+ SelectComponent,
4247
+ TooltipComponent,
4248
+ PaginationComponent,
4249
+ RadiogroupComponent,
4250
+ VoiceRecognitionDirective], imports: [AngularResizeEventModule,
4251
+ FormsModule,
4252
+ HttpClientModule,
4253
+ ReactiveFormsModule,
4254
+ RouterModule,
4255
+ CommonModule], exports: [AutocompleteComponent,
4256
+ AutocompleteListComponent,
4257
+ FilterComponent,
4258
+ CheckboxComponent,
4259
+ DatetimeComponent,
4260
+ InputComponent,
4261
+ GeolocationComponent,
4262
+ LuxTooltipDirective,
4263
+ LuxBreadcrumbComponent,
4264
+ LuxBreadcrumbComponent,
4265
+ MapComponent,
4266
+ SelectComponent,
4267
+ PaginationComponent,
4268
+ RadiogroupComponent,
4269
+ VoiceRecognitionDirective] });
4270
+ LuxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModule, providers: [ModalService, TooltipService, WINDOW_PROVIDERS], imports: [[
4271
+ AngularResizeEventModule,
4272
+ FormsModule,
4273
+ HttpClientModule,
4274
+ ReactiveFormsModule,
4275
+ RouterModule,
4276
+ CommonModule
4277
+ ]] });
4278
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: LuxModule, decorators: [{
4279
+ type: NgModule,
4280
+ args: [{
4281
+ declarations: [
4282
+ AutocompleteComponent,
4283
+ AutocompleteListComponent,
4284
+ FilterComponent,
4285
+ CheckboxComponent,
4286
+ DatetimeComponent,
4287
+ InputComponent,
4288
+ GeolocationComponent,
4289
+ LuxTooltipDirective,
4290
+ LuxModalWindowComponent,
4291
+ LuxModalBackdropComponent,
4292
+ LuxBreadcrumbComponent,
4293
+ MapComponent,
4294
+ SelectComponent,
4295
+ TooltipComponent,
4296
+ PaginationComponent,
4297
+ RadiogroupComponent,
4298
+ VoiceRecognitionDirective
4299
+ ],
4300
+ entryComponents: [
4301
+ LuxModalWindowComponent,
4302
+ LuxModalBackdropComponent,
4303
+ TooltipComponent
4304
+ ],
4305
+ providers: [ModalService, TooltipService, WINDOW_PROVIDERS],
4306
+ imports: [
4307
+ AngularResizeEventModule,
4308
+ FormsModule,
4309
+ HttpClientModule,
4310
+ ReactiveFormsModule,
4311
+ RouterModule,
4312
+ CommonModule
4313
+ ],
4314
+ exports: [
4315
+ AutocompleteComponent,
4316
+ AutocompleteListComponent,
4317
+ FilterComponent,
4318
+ CheckboxComponent,
4319
+ DatetimeComponent,
4320
+ InputComponent,
4321
+ GeolocationComponent,
4322
+ LuxTooltipDirective,
4323
+ LuxBreadcrumbComponent,
4324
+ LuxBreadcrumbComponent,
4325
+ MapComponent,
4326
+ SelectComponent,
4327
+ PaginationComponent,
4328
+ RadiogroupComponent,
4329
+ VoiceRecognitionDirective
4330
+ ]
4331
+ }]
4332
+ }] });
4333
+
4334
+ /*
4335
+ * Public API Surface of lux
4336
+ */
4337
+
4338
+ /**
4339
+ * Generated bundle index. Do not edit.
4340
+ */
4341
+
4342
+ export { AutocompleteComponent, AutocompleteListComponent, CheckboxComponent, DatetimeComponent, FilterComponent, GeolocationComponent, InputComponent, LuxBreadcrumbComponent, LuxModule, LuxTooltipDirective, MapComponent, ModalRef, ModalService, PaginationComponent, RadiogroupComponent, SelectComponent, VoiceRecognitionDirective };
4343
+ //# sourceMappingURL=metadev-lux.mjs.map