@metadev/lux 0.16.3 → 0.19.0

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 +20 -8
  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,4345 @@
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 { AngularResizedEventModule } 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.1", ngImport: i0, type: AutocompleteComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
501
+ AutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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.1", 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 = Object.assign(Object.assign({}, item), { labelPrefix,
581
+ labelMatch,
582
+ labelPostfix });
583
+ return newItem;
584
+ };
585
+ const findLabelForId = (data, id) => {
586
+ const found = data.find((it) => it.key === id);
587
+ return found ? found.label : null;
588
+ };
589
+ const selectElement = (completionList, label) => {
590
+ label = (label || '').toLowerCase();
591
+ if (!completionList || completionList.length === 0) {
592
+ return null;
593
+ }
594
+ if (completionList.length === 1) {
595
+ return completionList[0];
596
+ }
597
+ const found = completionList.find((it) => it.label.toLowerCase() === label);
598
+ return found || completionList[0];
599
+ };
600
+
601
+ class AutocompleteListComponent {
602
+ constructor() {
603
+ this.literals = {
604
+ en: {
605
+ placeholder: 'new item',
606
+ deleteLabelTemplate: 'Delete <<label>>',
607
+ addMessage: 'Add'
608
+ },
609
+ es: {
610
+ placeholder: 'nuevo elemento',
611
+ deleteLabelTemplate: 'Eliminar <<label>>',
612
+ addMessage: 'Añadir'
613
+ }
614
+ };
615
+ this.internalDataSource = [];
616
+ this.autoPopulate = false;
617
+ this._value = [];
618
+ this.labels = [];
619
+ this.canAdd = false;
620
+ this.touched = false;
621
+ this._lang = languageDetector();
622
+ this.dataSource = [];
623
+ this.disabled = false;
624
+ this.required = false;
625
+ this.resolveLabelsFunction = undefined;
626
+ this.populateFunction = undefined;
627
+ this.valueChange = new EventEmitter();
628
+ // ControlValueAccessor Interface
629
+ this.onChange = (value) => { };
630
+ this.onTouched = () => { };
631
+ }
632
+ set value(val) {
633
+ if (val === this._value) {
634
+ return;
635
+ }
636
+ const initialAndEmpty = isInitialAndEmpty(this._value, val);
637
+ this._value = val;
638
+ this.ensureLabelsForIds();
639
+ this.populateWith('');
640
+ this.onChange(this._value);
641
+ if (!initialAndEmpty) {
642
+ this.valueChange.emit(this._value);
643
+ }
644
+ }
645
+ get value() {
646
+ return this._value;
647
+ }
648
+ get lang() {
649
+ return this._lang;
650
+ }
651
+ set lang(l) {
652
+ if (l === this._lang) {
653
+ return;
654
+ }
655
+ if (Object.keys(this.literals).includes(l)) {
656
+ this._lang = l;
657
+ }
658
+ else {
659
+ this._lang = 'en';
660
+ }
661
+ }
662
+ writeValue(value) {
663
+ this.value = value;
664
+ }
665
+ registerOnChange(onChange) {
666
+ this.onChange = onChange;
667
+ }
668
+ registerOnTouched(onTouched) {
669
+ this.onTouched = onTouched;
670
+ }
671
+ markAsTouched() {
672
+ if (!this.touched && !this.disabled) {
673
+ this.onTouched();
674
+ this.touched = true;
675
+ }
676
+ }
677
+ setDisabledState(disabled) {
678
+ this.disabled = disabled;
679
+ }
680
+ // End ControlValueAccessor Interface
681
+ // Validator interface
682
+ registerOnValidatorChange() { }
683
+ validate(control) {
684
+ const value = control.value;
685
+ if (this.required &&
686
+ (value === '' || value === null || value === undefined)) {
687
+ return { required: { value, reason: 'Required field.' } };
688
+ }
689
+ return null;
690
+ }
691
+ // End of Validator interface
692
+ ngOnInit() {
693
+ this.inputId = this.inputId
694
+ ? this.inputId
695
+ : `autocompletelist${AutocompleteListComponent.idCounter++}`;
696
+ this.autoPopulate =
697
+ !!this.resolveLabelsFunction && !!this.populateFunction && this.instance;
698
+ this.ensureLabelsForIds();
699
+ }
700
+ ensureLabelsForIds() {
701
+ if (this.autoPopulate && this.resolveLabelsFunction) {
702
+ this.resolveLabelsFunction(this.instance, this._value)
703
+ .pipe(first())
704
+ .subscribe((data) => {
705
+ const res = [];
706
+ (this._value || []).map((id) => {
707
+ const found = data.find((it) => it.key === id);
708
+ if (found) {
709
+ res.push(found.label);
710
+ }
711
+ else {
712
+ res.push('(unset)');
713
+ }
714
+ });
715
+ this.labels = res;
716
+ });
717
+ }
718
+ else if (this.dataSource) {
719
+ const res = [];
720
+ (this._value || []).map((id) => {
721
+ const found = this.dataSource.find((it) => it.key === id);
722
+ if (found) {
723
+ res.push(found.label);
724
+ }
725
+ else {
726
+ res.push('(unset)');
727
+ }
728
+ });
729
+ this.labels = res;
730
+ }
731
+ else {
732
+ this.labels = this._value.map((it) => (it ? it.toString() : '(unset)'));
733
+ }
734
+ }
735
+ removeAt(index) {
736
+ if (this._value.length > index) {
737
+ const key = this._value.splice(index, 1)[0];
738
+ const label = this.labels.splice(index, 1)[0];
739
+ this.internalDataSource.push({ key, label });
740
+ }
741
+ this.markAsTouched();
742
+ }
743
+ onValueChange() {
744
+ this.updateCanAdd();
745
+ }
746
+ onNewEntryChange(event, auto) {
747
+ if (event.key === 'Enter' && !!auto.value) {
748
+ this.addNew(auto);
749
+ }
750
+ else if (event.key === 'Delete' || event.key === 'Backspace') {
751
+ // todo
752
+ }
753
+ else {
754
+ this.populateWith(auto.label + event.key);
755
+ }
756
+ this.updateCanAdd();
757
+ }
758
+ populateWith(searchText) {
759
+ if (this.autoPopulate && this.populateFunction && this.instance) {
760
+ this.populateFunction(this.instance, searchText)
761
+ .pipe(first())
762
+ .subscribe((data) => {
763
+ this.internalDataSource = data.filter((it) => !(this._value || []).includes(it.key));
764
+ });
765
+ }
766
+ else if (this.dataSource) {
767
+ this.internalDataSource = this.dataSource.filter((it) => !(this._value || []).includes(it.key));
768
+ }
769
+ }
770
+ updateCanAdd() {
771
+ this.canAdd =
772
+ !this.disabled &&
773
+ this.auto &&
774
+ !!this.auto.value && // has value
775
+ !this.value.find((it) => it === this.auto.value); // not already in
776
+ }
777
+ addNew(auto) {
778
+ this.value.push(auto.value);
779
+ this.ensureLabelsForIds();
780
+ this.newEntry = '';
781
+ this.internalDataSource = this.internalDataSource.filter((it) => !this._value.includes(it.key));
782
+ this.markAsTouched();
783
+ }
784
+ getDeleteMessage(label) {
785
+ var _a;
786
+ return ((_a = this.deleteLabelTemplate) !== null && _a !== void 0 ? _a : this.literals[this.lang].deleteLabelTemplate).replace('<<label>>', label);
787
+ }
788
+ }
789
+ AutocompleteListComponent.idCounter = 0;
790
+ AutocompleteListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AutocompleteListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
791
+ AutocompleteListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: [
792
+ {
793
+ provide: NG_VALUE_ACCESSOR,
794
+ multi: true,
795
+ useExisting: forwardRef(() => AutocompleteListComponent)
796
+ },
797
+ {
798
+ provide: NG_VALIDATORS,
799
+ multi: true,
800
+ useExisting: forwardRef(() => AutocompleteListComponent)
801
+ }
802
+ ], 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"] }] });
803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AutocompleteListComponent, decorators: [{
804
+ type: Component,
805
+ args: [{ selector: 'lux-autocomplete-list', providers: [
806
+ {
807
+ provide: NG_VALUE_ACCESSOR,
808
+ multi: true,
809
+ useExisting: forwardRef(() => AutocompleteListComponent)
810
+ },
811
+ {
812
+ provide: NG_VALIDATORS,
813
+ multi: true,
814
+ useExisting: forwardRef(() => AutocompleteListComponent)
815
+ }
816
+ ], 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"] }]
817
+ }], propDecorators: { auto: [{
818
+ type: ViewChild,
819
+ args: ['auto']
820
+ }], value: [{
821
+ type: Input
822
+ }], lang: [{
823
+ type: Input
824
+ }], inputId: [{
825
+ type: Input
826
+ }], dataSource: [{
827
+ type: Input
828
+ }], placeholder: [{
829
+ type: Input
830
+ }], disabled: [{
831
+ type: Input
832
+ }], deleteLabelTemplate: [{
833
+ type: Input
834
+ }], addMessage: [{
835
+ type: Input
836
+ }], required: [{
837
+ type: Input
838
+ }], resolveLabelsFunction: [{
839
+ type: Input
840
+ }], populateFunction: [{
841
+ type: Input
842
+ }], instance: [{
843
+ type: Input
844
+ }], valueChange: [{
845
+ type: Output
846
+ }] } });
847
+
848
+ class LuxBreadcrumbComponent {
849
+ constructor(route, activedRoute) {
850
+ this.route = route;
851
+ this.activedRoute = activedRoute;
852
+ this.subs = [];
853
+ this.imagePath = '../assets/img/arrow-forward.svg';
854
+ }
855
+ ngOnInit() {
856
+ this.subs.push(this.route.events
857
+ .pipe(filter((event) => event instanceof NavigationEnd))
858
+ .subscribe((_) => {
859
+ this.breadcrumbs = [];
860
+ this.addBreadcrumbs(this.activedRoute.snapshot.root, true, null);
861
+ }));
862
+ }
863
+ ngOnDestroy() {
864
+ this.subs.forEach((s) => s.unsubscribe());
865
+ this.subs = [];
866
+ }
867
+ addBreadcrumbs(activedRouteSnapshot, isRoot, urlPrefix) {
868
+ const routeConfig = activedRouteSnapshot.routeConfig;
869
+ let url = urlPrefix || '';
870
+ url += routeConfig ? '/' + this.getUrl(activedRouteSnapshot) : '';
871
+ const label = routeConfig
872
+ ? this.getLabel(activedRouteSnapshot)
873
+ : isRoot
874
+ ? 'Home'
875
+ : '';
876
+ if (label && url !== '/') {
877
+ const breadcrumb = { label, url };
878
+ this.breadcrumbs.push(breadcrumb);
879
+ }
880
+ if (activedRouteSnapshot.children.length) {
881
+ this.addBreadcrumbs(activedRouteSnapshot.children[0], false, url);
882
+ }
883
+ }
884
+ getUrl(activedRouteSnapshot) {
885
+ if (!activedRouteSnapshot.url[0]) {
886
+ return '';
887
+ }
888
+ const id = activedRouteSnapshot.params.id;
889
+ return id
890
+ ? `${activedRouteSnapshot.url[0]}/${id}`
891
+ : activedRouteSnapshot.routeConfig.path || '';
892
+ }
893
+ getLabel(activedRouteSnapshot) {
894
+ const routeConfig = activedRouteSnapshot.routeConfig;
895
+ if (!routeConfig) {
896
+ return null;
897
+ }
898
+ if (activedRouteSnapshot.data && activedRouteSnapshot.data.title) {
899
+ const data = activedRouteSnapshot.data;
900
+ if (data.objectTitle) {
901
+ return `${data.title} ${data.objectTitle}`;
902
+ }
903
+ else {
904
+ return data.title;
905
+ }
906
+ }
907
+ return activedRouteSnapshot.params.id || routeConfig.path;
908
+ }
909
+ }
910
+ LuxBreadcrumbComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxBreadcrumbComponent, deps: [{ token: i1$1.Router }, { token: i1$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
911
+ LuxBreadcrumbComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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"] }] });
912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxBreadcrumbComponent, decorators: [{
913
+ type: Component,
914
+ 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"] }]
915
+ }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i1$1.ActivatedRoute }]; } });
916
+
917
+ const KEY_SPACE = ' ';
918
+ class CheckboxComponent {
919
+ constructor() {
920
+ this._lang = languageDetector();
921
+ this.label = null;
922
+ this.name = null;
923
+ this._disabled = false;
924
+ this.literals = {
925
+ en: {
926
+ yesLabel: 'Yes',
927
+ noLabel: 'No'
928
+ },
929
+ es: {
930
+ yesLabel: 'Sí',
931
+ noLabel: 'No'
932
+ }
933
+ };
934
+ this.touched = false;
935
+ this.valueChange = new EventEmitter();
936
+ // ControlValueAccessor Interface
937
+ this.onChange = (value) => { };
938
+ this.onTouched = () => { };
939
+ }
940
+ set lang(l) {
941
+ if (l === this._lang) {
942
+ return;
943
+ }
944
+ if (Object.keys(this.literals).includes(l)) {
945
+ this._lang = l;
946
+ }
947
+ else {
948
+ this._lang = 'en';
949
+ }
950
+ }
951
+ get lang() {
952
+ return this._lang;
953
+ }
954
+ get value() {
955
+ return this.internalValue;
956
+ }
957
+ set value(v) {
958
+ if (this.internalValue === v) {
959
+ return;
960
+ }
961
+ const initialAndEmpty = isInitialAndEmpty(this.internalValue, v);
962
+ this.internalValue = v;
963
+ this.syncModel();
964
+ this.onChange(v);
965
+ if (!initialAndEmpty) {
966
+ this.valueChange.emit(v);
967
+ }
968
+ }
969
+ get tabindexValue() {
970
+ return this.disabled ? null : '0';
971
+ }
972
+ get disabled() {
973
+ return this._disabled;
974
+ }
975
+ set disabled(v) {
976
+ if (v === this._disabled) {
977
+ return;
978
+ }
979
+ this._disabled = v;
980
+ this.syncModel();
981
+ }
982
+ writeValue(value) {
983
+ this.value = !!value;
984
+ }
985
+ registerOnChange(onChange) {
986
+ this.onChange = onChange;
987
+ }
988
+ registerOnTouched(onTouched) {
989
+ this.onTouched = onTouched;
990
+ }
991
+ markAsTouched() {
992
+ if (!this.touched) {
993
+ this.onTouched();
994
+ this.touched = true;
995
+ }
996
+ }
997
+ setDisabledState(disabled) {
998
+ this.disabled = disabled;
999
+ }
1000
+ // End ControlValueAccessor Interface
1001
+ ngOnInit() {
1002
+ this.inputId = this.inputId
1003
+ ? this.inputId
1004
+ : `${this.name || 'checkbox'}$${CheckboxComponent.idCounter++}`;
1005
+ }
1006
+ ngAfterViewInit() {
1007
+ this.syncModel();
1008
+ }
1009
+ clicked() {
1010
+ if (!this.disabled) {
1011
+ this.value = !this.internalValue;
1012
+ this.markAsTouched();
1013
+ }
1014
+ }
1015
+ onKey(event) {
1016
+ if (event.key === KEY_SPACE && !this.disabled) {
1017
+ this.value = !this.internalValue;
1018
+ this.markAsTouched();
1019
+ event.preventDefault();
1020
+ }
1021
+ }
1022
+ syncModel() {
1023
+ if (this.ck) {
1024
+ this.ck.nativeElement.checked = this.internalValue;
1025
+ }
1026
+ }
1027
+ }
1028
+ CheckboxComponent.idCounter = 0;
1029
+ CheckboxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1030
+ CheckboxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: CheckboxComponent, selector: "lux-checkbox", inputs: { lang: "lang", value: "value", label: "label", name: "name", disabled: "disabled", inputId: "inputId" }, outputs: { valueChange: "valueChange" }, providers: [
1031
+ {
1032
+ provide: NG_VALUE_ACCESSOR,
1033
+ multi: true,
1034
+ useExisting: forwardRef(() => CheckboxComponent)
1035
+ }
1036
+ ], 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"] }] });
1037
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: CheckboxComponent, decorators: [{
1038
+ type: Component,
1039
+ args: [{ selector: 'lux-checkbox', providers: [
1040
+ {
1041
+ provide: NG_VALUE_ACCESSOR,
1042
+ multi: true,
1043
+ useExisting: forwardRef(() => CheckboxComponent)
1044
+ }
1045
+ ], 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"] }]
1046
+ }], ctorParameters: function () { return []; }, propDecorators: { ck: [{
1047
+ type: ViewChild,
1048
+ args: ['ck', { static: false }]
1049
+ }], lang: [{
1050
+ type: Input
1051
+ }], value: [{
1052
+ type: Input
1053
+ }], label: [{
1054
+ type: Input
1055
+ }], name: [{
1056
+ type: Input
1057
+ }], disabled: [{
1058
+ type: Input
1059
+ }], inputId: [{
1060
+ type: Input
1061
+ }], valueChange: [{
1062
+ type: Output
1063
+ }] } });
1064
+
1065
+ class DatetimeComponent {
1066
+ constructor() {
1067
+ this.touched = false;
1068
+ this.dirty = false;
1069
+ this.lastErrors = null;
1070
+ this.dateValue = undefined;
1071
+ this.timeValue = undefined;
1072
+ this.userErrors = {
1073
+ en: {
1074
+ required: 'Required field.',
1075
+ min: 'Minimum value is $min.',
1076
+ max: 'Maximum value is $max.'
1077
+ },
1078
+ es: {
1079
+ required: 'El campo es obligatorio.',
1080
+ min: 'El valor mínimo es $min.',
1081
+ max: 'El valor máximo es $max.'
1082
+ }
1083
+ };
1084
+ this.min = '1900-01-01T00:00:00Z';
1085
+ this.max = '2100-01-01T00:00:00Z';
1086
+ this.includeSeconds = true;
1087
+ this.localTime = true;
1088
+ this.lang = languageDetector();
1089
+ this.inlineErrors = false;
1090
+ this.readonly = null;
1091
+ this.valueChange = new EventEmitter();
1092
+ this.keyPress = new EventEmitter();
1093
+ this.onChange = (_value) => { };
1094
+ this.onTouched = () => { };
1095
+ }
1096
+ get className() {
1097
+ return this.checkClassName();
1098
+ }
1099
+ set disabled(v) {
1100
+ v = typeof v === 'string' && v !== 'false' ? true : v;
1101
+ this._disabled = v;
1102
+ }
1103
+ get disabled() {
1104
+ return this._disabled;
1105
+ }
1106
+ set required(v) {
1107
+ this._required = v;
1108
+ }
1109
+ get required() {
1110
+ return this._required;
1111
+ }
1112
+ set value(v) {
1113
+ if (v === this._value) {
1114
+ return; // prevent events when there is no changes
1115
+ }
1116
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
1117
+ const datetime = new Date(v);
1118
+ if (!v) {
1119
+ this._value = null;
1120
+ this.setDateInControl(null);
1121
+ this.setTimeInControl(null);
1122
+ }
1123
+ else if (!isValidDate(datetime)) {
1124
+ this._value = v;
1125
+ // we don't set value in control if the value is not valid
1126
+ // if we do, the content of the control changes and can erase what the user is typing
1127
+ }
1128
+ else {
1129
+ this._value = datetime.toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1130
+ this.setValueInControl(datetime);
1131
+ }
1132
+ this.onChange(v);
1133
+ if (!initialAndEmpty) {
1134
+ this.valueChange.emit(v);
1135
+ }
1136
+ }
1137
+ get value() {
1138
+ return this._value;
1139
+ }
1140
+ // ControlValueAccessor Interface implementation
1141
+ writeValue(value) {
1142
+ this.value = value;
1143
+ }
1144
+ registerOnChange(onChange) {
1145
+ this.onChange = onChange;
1146
+ }
1147
+ registerOnTouched(onTouched) {
1148
+ this.onTouched = onTouched;
1149
+ }
1150
+ markAsTouched() {
1151
+ if (!this.touched) {
1152
+ this.onTouched();
1153
+ this.touched = true;
1154
+ }
1155
+ }
1156
+ setDisabledState(disabled) {
1157
+ this.disabled = disabled;
1158
+ }
1159
+ // End of ControlValueAccessor Interface implementation
1160
+ setDateInControl(date) {
1161
+ // this.dateInput.nativeElement.value = date;
1162
+ this.dateValue = date;
1163
+ }
1164
+ setTimeInControl(time) {
1165
+ // this.timeInput.nativeElement.value = time;
1166
+ this.timeValue = time;
1167
+ }
1168
+ setValueInControl(datetime) {
1169
+ const offsetDatetime = this.localTime
1170
+ ? addTimezoneOffset(datetime)
1171
+ : datetime;
1172
+ const offsetDatetimeString = offsetDatetime.toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1173
+ this.setDateInControl(offsetDatetimeString.slice(0, 10)); // YYYY-MM-DD
1174
+ if (this.includeSeconds) {
1175
+ this.setTimeInControl(offsetDatetimeString.slice(11, 19)); // hh:mm:ss
1176
+ }
1177
+ else {
1178
+ this.setTimeInControl(offsetDatetimeString.slice(11, 16)); // hh:mm
1179
+ }
1180
+ }
1181
+ clear() {
1182
+ this.setDateInControl(null);
1183
+ this.setTimeInControl(null);
1184
+ this.value = null;
1185
+ }
1186
+ isClearable() {
1187
+ return hasValue(this.value);
1188
+ }
1189
+ // Validator interface
1190
+ registerOnValidatorChange() { }
1191
+ validate(control) {
1192
+ const value = control.value;
1193
+ let result = null;
1194
+ if (this.required &&
1195
+ !hasValue(value) &&
1196
+ !hasValue(this.dateValue) &&
1197
+ !hasValue(this.timeValue)) {
1198
+ result = result || {};
1199
+ result.required = { value, reason: 'Required field.' };
1200
+ }
1201
+ if (!hasValue(this.dateValue) && hasValue(this.timeValue)) {
1202
+ result = result || {};
1203
+ result.existsDate = {
1204
+ value,
1205
+ reason: 'Date not specified.'
1206
+ };
1207
+ }
1208
+ if (hasValue(this.dateValue) && !hasValue(this.timeValue)) {
1209
+ result = result || {};
1210
+ result.existsTime = {
1211
+ value,
1212
+ reason: 'Time not specified.'
1213
+ };
1214
+ }
1215
+ if (hasValue(this.min) &&
1216
+ hasValue(value) &&
1217
+ hasValue(this.dateValue) &&
1218
+ hasValue(this.timeValue) &&
1219
+ String(value).localeCompare(this.min) === -1) {
1220
+ result = result || {};
1221
+ result.min = {
1222
+ value,
1223
+ min: this.min,
1224
+ reason: `Value is lower than minimum value: ${this.min}.`
1225
+ };
1226
+ }
1227
+ if (hasValue(this.max) &&
1228
+ hasValue(value) &&
1229
+ hasValue(this.dateValue) &&
1230
+ hasValue(this.timeValue) &&
1231
+ String(value).localeCompare(this.max) !== -1) {
1232
+ result = result || {};
1233
+ result.max = {
1234
+ value,
1235
+ max: this.max,
1236
+ reason: `Value is greater than than maximum value: ${this.max}.`
1237
+ };
1238
+ }
1239
+ this.lastErrors = result;
1240
+ return result;
1241
+ }
1242
+ // End of Validator interface
1243
+ ngOnInit() {
1244
+ this.inputId = this.inputId
1245
+ ? this.inputId
1246
+ : `datetime$${DatetimeComponent.idCounter++}`;
1247
+ this.setPatterns();
1248
+ }
1249
+ onLostFocus() {
1250
+ this.markAsTouched();
1251
+ }
1252
+ onKeyPress(event) {
1253
+ this.keyPress.emit(event);
1254
+ }
1255
+ onEventDatetime(newDate, newTime) {
1256
+ if (this.disabled || this.readonly) {
1257
+ return;
1258
+ }
1259
+ const newValue = '' + newDate + ' ' + newTime;
1260
+ if (!newValue) {
1261
+ this.value = null;
1262
+ }
1263
+ else {
1264
+ const datetime = new Date(newValue);
1265
+ if (isValidDate(datetime)) {
1266
+ let datetimeString;
1267
+ if (this.localTime) {
1268
+ datetimeString = datetime.toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1269
+ }
1270
+ else {
1271
+ datetimeString = addTimezoneOffset(datetime).toISOString(); // YYYY-MM-DDThh:mm:ss.SSSZ
1272
+ }
1273
+ if (this.includeSeconds) {
1274
+ this.value = datetimeString.slice(0, 19) + 'Z'; // YYYY-MM-DDThh:mm:ssZ
1275
+ }
1276
+ else {
1277
+ this.value = datetimeString.slice(0, 16) + 'Z'; // YYYY-MM-DDThh:mmZ
1278
+ }
1279
+ }
1280
+ else {
1281
+ this.value = newValue;
1282
+ }
1283
+ }
1284
+ }
1285
+ checkClassName() {
1286
+ return this.disabled
1287
+ ? this.readonly
1288
+ ? 'disabled readonly'
1289
+ : 'disabled'
1290
+ : this.readonly
1291
+ ? 'readonly'
1292
+ : '';
1293
+ }
1294
+ setPatterns() {
1295
+ this.min = this.min || '1900-01-01';
1296
+ this.max = this.max || '2100-01-01';
1297
+ }
1298
+ }
1299
+ DatetimeComponent.idCounter = 0;
1300
+ DatetimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatetimeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1301
+ DatetimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: [
1302
+ {
1303
+ provide: NG_VALUE_ACCESSOR,
1304
+ multi: true,
1305
+ useExisting: forwardRef(() => DatetimeComponent)
1306
+ },
1307
+ {
1308
+ provide: NG_VALIDATORS,
1309
+ multi: true,
1310
+ useExisting: forwardRef(() => DatetimeComponent)
1311
+ }
1312
+ ], 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"] }] });
1313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: DatetimeComponent, decorators: [{
1314
+ type: Component,
1315
+ args: [{ selector: 'lux-datetime', providers: [
1316
+ {
1317
+ provide: NG_VALUE_ACCESSOR,
1318
+ multi: true,
1319
+ useExisting: forwardRef(() => DatetimeComponent)
1320
+ },
1321
+ {
1322
+ provide: NG_VALIDATORS,
1323
+ multi: true,
1324
+ useExisting: forwardRef(() => DatetimeComponent)
1325
+ }
1326
+ ], 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"] }]
1327
+ }], ctorParameters: function () { return []; }, propDecorators: { dateInput: [{
1328
+ type: ViewChild,
1329
+ args: ['dateInput', { static: true }]
1330
+ }], timeInput: [{
1331
+ type: ViewChild,
1332
+ args: ['timeInput', { static: true }]
1333
+ }], min: [{
1334
+ type: Input
1335
+ }], max: [{
1336
+ type: Input
1337
+ }], includeSeconds: [{
1338
+ type: Input
1339
+ }], localTime: [{
1340
+ type: Input
1341
+ }], lang: [{
1342
+ type: Input
1343
+ }], inlineErrors: [{
1344
+ type: Input
1345
+ }], inputId: [{
1346
+ type: Input
1347
+ }], ariaLabel: [{
1348
+ type: Input,
1349
+ args: ['aria-label']
1350
+ }], readonly: [{
1351
+ type: Input
1352
+ }], disabled: [{
1353
+ type: Input
1354
+ }], required: [{
1355
+ type: Input
1356
+ }], value: [{
1357
+ type: Input
1358
+ }], valueChange: [{
1359
+ type: Output
1360
+ }], keyPress: [{
1361
+ type: Output
1362
+ }] } });
1363
+
1364
+ /** Filter component to query for objects. */
1365
+ class FilterComponent {
1366
+ constructor() {
1367
+ this.touched = false;
1368
+ this._searchValue = '';
1369
+ this.disabled = false;
1370
+ /** Placeholder default text. */
1371
+ this.placeholder = '';
1372
+ /** Search on type: (default true) Auto-search when user types in. */
1373
+ this.searchOnType = true;
1374
+ this.debounceValue = 300; // 300 ms
1375
+ /** Search value changed by user. */
1376
+ this.searchValueChange = new EventEmitter();
1377
+ this.subject = new Subject();
1378
+ // ControlValueAccessor Interface
1379
+ this.onChange = (value) => { };
1380
+ this.onTouched = () => { };
1381
+ this.recreateObservable();
1382
+ }
1383
+ /** Search value introduced by the user. */
1384
+ get searchValue() {
1385
+ return this._searchValue;
1386
+ }
1387
+ set searchValue(v) {
1388
+ v = (v || '').toString();
1389
+ if (v === this._searchValue) {
1390
+ return;
1391
+ }
1392
+ this.onChange(v);
1393
+ this._searchValue = v;
1394
+ }
1395
+ /** Debounce time in milliseconds. (defaults to 300 ms) */
1396
+ set debounce(val) {
1397
+ this.debounceValue = val;
1398
+ this.recreateObservable();
1399
+ }
1400
+ get debounce() {
1401
+ return this.debounceValue;
1402
+ }
1403
+ writeValue(value) {
1404
+ this.searchValue = (value || '').toString();
1405
+ }
1406
+ registerOnChange(onChange) {
1407
+ this.onChange = onChange;
1408
+ }
1409
+ registerOnTouched(onTouched) {
1410
+ this.onTouched = onTouched;
1411
+ }
1412
+ markAsTouched() {
1413
+ if (!this.touched) {
1414
+ this.onTouched();
1415
+ this.touched = true;
1416
+ }
1417
+ }
1418
+ setDisabledState(disabled) {
1419
+ this.disabled = disabled;
1420
+ }
1421
+ // End ControlValueAccessor Interface
1422
+ ngOnInit() {
1423
+ this.inputId = this.inputId
1424
+ ? this.inputId
1425
+ : `filter$${FilterComponent.idCounter++}`;
1426
+ }
1427
+ ngOnDestroy() {
1428
+ this.freeSubscriptions();
1429
+ }
1430
+ clear() {
1431
+ this.searchValue = '';
1432
+ this.search();
1433
+ }
1434
+ search() {
1435
+ this.searchValueChange.emit(this.searchValue);
1436
+ }
1437
+ keyup(event, newValue) {
1438
+ this.markAsTouched();
1439
+ this.searchValue = newValue;
1440
+ if (event.key === 'Enter') {
1441
+ this.searchNow(this.searchValue);
1442
+ }
1443
+ if (this.searchOnType) {
1444
+ this.addEvent();
1445
+ }
1446
+ }
1447
+ onInputValueChange(newValue) {
1448
+ this.markAsTouched();
1449
+ this.searchValue = newValue;
1450
+ }
1451
+ recreateObservable() {
1452
+ this.searchValue$ = this.subject
1453
+ .asObservable()
1454
+ .pipe(debounceTime(this.debounce));
1455
+ this.freeSubscriptions();
1456
+ this.sub = this.searchValue$.subscribe((value) => {
1457
+ this.searchValueChange.emit(value);
1458
+ });
1459
+ }
1460
+ freeSubscriptions() {
1461
+ if (this.sub) {
1462
+ this.sub.unsubscribe();
1463
+ this.sub = null;
1464
+ }
1465
+ }
1466
+ searchNow(value) {
1467
+ this.searchValueChange.emit(value);
1468
+ }
1469
+ addEvent() {
1470
+ this.subject.next(this.searchValue);
1471
+ }
1472
+ }
1473
+ FilterComponent.idCounter = 0;
1474
+ FilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1475
+ FilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: [
1476
+ {
1477
+ provide: NG_VALUE_ACCESSOR,
1478
+ multi: true,
1479
+ useExisting: forwardRef(() => FilterComponent)
1480
+ }
1481
+ ], 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"] }] });
1482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: FilterComponent, decorators: [{
1483
+ type: Component,
1484
+ args: [{ selector: 'lux-filter', providers: [
1485
+ {
1486
+ provide: NG_VALUE_ACCESSOR,
1487
+ multi: true,
1488
+ useExisting: forwardRef(() => FilterComponent)
1489
+ }
1490
+ ], 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"] }]
1491
+ }], ctorParameters: function () { return []; }, propDecorators: { disabled: [{
1492
+ type: Input
1493
+ }], inputId: [{
1494
+ type: Input
1495
+ }], placeholder: [{
1496
+ type: Input
1497
+ }], searchValue: [{
1498
+ type: Input
1499
+ }], searchOnType: [{
1500
+ type: Input
1501
+ }], ariaLabel: [{
1502
+ type: Input,
1503
+ args: ['aria-label']
1504
+ }], debounce: [{
1505
+ type: Input
1506
+ }], searchValueChange: [{
1507
+ type: Output
1508
+ }] } });
1509
+
1510
+ class ActiveModal {
1511
+ close(result) { }
1512
+ dismiss(reason) { }
1513
+ }
1514
+ class ModalRef {
1515
+ constructor(_windowCmptRef, _contentRef, _backdropCmptRef, _beforeDismiss) {
1516
+ this._windowCmptRef = _windowCmptRef;
1517
+ this._contentRef = _contentRef;
1518
+ this._backdropCmptRef = _backdropCmptRef;
1519
+ this._beforeDismiss = _beforeDismiss;
1520
+ _windowCmptRef.instance.dismissEvent.subscribe((reason) => {
1521
+ this.dismiss(reason);
1522
+ });
1523
+ this.result = new Promise((resolve, reject) => {
1524
+ this._resolve = resolve;
1525
+ this._reject = reject;
1526
+ });
1527
+ this.result.then(null, () => { });
1528
+ }
1529
+ /**
1530
+ * The instance of a component used for the modal content.
1531
+ *
1532
+ * When a `TemplateRef` is used as the content, will return `undefined`.
1533
+ */
1534
+ get componentInstance() {
1535
+ if (this._contentRef.componentRef) {
1536
+ return this._contentRef.componentRef.instance;
1537
+ }
1538
+ }
1539
+ /**
1540
+ * Closes the modal with an optional `result` value.
1541
+ *
1542
+ * The `NgbMobalRef.result` promise will be resolved with the provided value.
1543
+ */
1544
+ close(result) {
1545
+ if (this._windowCmptRef) {
1546
+ if (this._resolve) {
1547
+ this._resolve(result);
1548
+ }
1549
+ this._removeModalElements();
1550
+ }
1551
+ }
1552
+ _dismiss(reason) {
1553
+ if (this._reject) {
1554
+ this._reject(reason);
1555
+ }
1556
+ this._removeModalElements();
1557
+ }
1558
+ /**
1559
+ * Dismisses the modal with an optional `reason` value.
1560
+ *
1561
+ * The `NgbModalRef.result` promise will be rejected with the provided value.
1562
+ */
1563
+ dismiss(reason) {
1564
+ if (this._windowCmptRef) {
1565
+ if (!this._beforeDismiss) {
1566
+ this._dismiss(reason);
1567
+ }
1568
+ else {
1569
+ const dismiss = this._beforeDismiss();
1570
+ if (dismiss && dismiss.then) {
1571
+ dismiss.then((result) => {
1572
+ if (result !== false) {
1573
+ this._dismiss(reason);
1574
+ }
1575
+ }, () => { });
1576
+ }
1577
+ else if (dismiss !== false) {
1578
+ this._dismiss(reason);
1579
+ }
1580
+ }
1581
+ }
1582
+ }
1583
+ _removeModalElements() {
1584
+ const windowNativeEl = this._windowCmptRef.location.nativeElement;
1585
+ windowNativeEl.parentNode.removeChild(windowNativeEl);
1586
+ this._windowCmptRef.destroy();
1587
+ if (this._backdropCmptRef) {
1588
+ const backdropNativeEl = this._backdropCmptRef.location.nativeElement;
1589
+ backdropNativeEl.parentNode.removeChild(backdropNativeEl);
1590
+ this._backdropCmptRef.destroy();
1591
+ }
1592
+ if (this._contentRef && this._contentRef.viewRef) {
1593
+ this._contentRef.viewRef.destroy();
1594
+ }
1595
+ this._windowCmptRef = null;
1596
+ this._backdropCmptRef = null;
1597
+ this._contentRef = null;
1598
+ }
1599
+ }
1600
+
1601
+ const FOCUS = 'focus';
1602
+ var Key;
1603
+ (function (Key) {
1604
+ Key[Key["Tab"] = 9] = "Tab";
1605
+ Key[Key["Enter"] = 13] = "Enter";
1606
+ Key[Key["Escape"] = 27] = "Escape";
1607
+ Key[Key["Space"] = 32] = "Space";
1608
+ Key[Key["PageUp"] = 33] = "PageUp";
1609
+ Key[Key["PageDown"] = 34] = "PageDown";
1610
+ Key[Key["End"] = 35] = "End";
1611
+ Key[Key["Home"] = 36] = "Home";
1612
+ Key[Key["ArrowLeft"] = 37] = "ArrowLeft";
1613
+ Key[Key["ArrowUp"] = 38] = "ArrowUp";
1614
+ Key[Key["ArrowRight"] = 39] = "ArrowRight";
1615
+ Key[Key["ArrowDown"] = 40] = "ArrowDown";
1616
+ })(Key || (Key = {}));
1617
+ const isDefined = (value) => value !== undefined && value !== null;
1618
+ class ContentRef {
1619
+ constructor(nodes, viewRef, componentRef) {
1620
+ this.nodes = nodes;
1621
+ this.viewRef = viewRef;
1622
+ this.componentRef = componentRef;
1623
+ }
1624
+ }
1625
+ const FOCUSABLE_ELEMENTS_SELECTOR = [
1626
+ 'a[href]',
1627
+ 'button:not([disabled])',
1628
+ 'input:not([disabled]):not([type="hidden"])',
1629
+ 'select:not([disabled])',
1630
+ 'textarea:not([disabled])',
1631
+ '[contenteditable]',
1632
+ '[tabindex]:not([tabindex="-1"])'
1633
+ ].join(', ');
1634
+ /**
1635
+ * Returns first and last focusable elements inside of a given element based on specific CSS selector
1636
+ */
1637
+ const getFocusableBoundaryElements = (element) => {
1638
+ const list = Array.from(element.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR)).filter((el) => el.tabIndex !== -1);
1639
+ return [list[0], list[list.length - 1]];
1640
+ };
1641
+ /**
1642
+ * Function that enforces browser focus to be trapped inside a DOM element.
1643
+ *
1644
+ * Works only for clicks inside the element and navigation with 'Tab', ignoring clicks outside of the element
1645
+ *
1646
+ * @param element The element around which focus will be trapped inside
1647
+ * @param stopFocusTrap$ The observable stream. When completed the focus trap will clean up listeners
1648
+ * and free internal resources
1649
+ * @param refocusOnClick Put the focus back to the last focused element whenever a click occurs on element (default to
1650
+ * false)
1651
+ */
1652
+ const focusTrap = (element, stopFocusTrap$, refocusOnClick = false) => {
1653
+ // last focused element
1654
+ const lastFocusedElement$ = fromEvent(element, 'focusin').pipe(takeUntil(stopFocusTrap$), map((e) => e.target));
1655
+ // 'tab' / 'shift+tab' stream
1656
+ fromEvent(element, 'keydown')
1657
+ .pipe(takeUntil(stopFocusTrap$),
1658
+ /* eslint-disable import/no-deprecated */
1659
+ filter((e) => e.which === Key.Tab),
1660
+ /* eslint-enable import/no-deprecated */
1661
+ withLatestFrom(lastFocusedElement$))
1662
+ .subscribe(([tabEvent, focusedElement]) => {
1663
+ const [first, last] = getFocusableBoundaryElements(element);
1664
+ if ((focusedElement === first || focusedElement === element) &&
1665
+ tabEvent.shiftKey) {
1666
+ last.focus();
1667
+ tabEvent.preventDefault();
1668
+ }
1669
+ if (focusedElement === last && !tabEvent.shiftKey) {
1670
+ first.focus();
1671
+ tabEvent.preventDefault();
1672
+ }
1673
+ });
1674
+ // inside click
1675
+ if (refocusOnClick) {
1676
+ fromEvent(element, 'click')
1677
+ .pipe(takeUntil(stopFocusTrap$), withLatestFrom(lastFocusedElement$), map((arr) => arr[1]))
1678
+ .subscribe((lastFocusedElement) => lastFocusedElement.focus());
1679
+ }
1680
+ };
1681
+
1682
+ var ModalDismissReasons;
1683
+ (function (ModalDismissReasons) {
1684
+ ModalDismissReasons[ModalDismissReasons["BackdropClick"] = 0] = "BackdropClick";
1685
+ ModalDismissReasons[ModalDismissReasons["Esc"] = 1] = "Esc";
1686
+ })(ModalDismissReasons || (ModalDismissReasons = {}));
1687
+
1688
+ class LuxModalWindowComponent {
1689
+ constructor(_document, _elRef) {
1690
+ this._document = _document;
1691
+ this._elRef = _elRef;
1692
+ this.backdrop = false;
1693
+ this.keyboard = true;
1694
+ this.dismissEvent = new EventEmitter();
1695
+ this.role = 'dialog';
1696
+ this.tabindex = '-1';
1697
+ this.ariamodal = true;
1698
+ }
1699
+ get class() {
1700
+ return `modal ${this.windowClass || ''}`;
1701
+ }
1702
+ get hostAriaLabelledBy() {
1703
+ return this.ariaLabelledBy;
1704
+ }
1705
+ get hostAriaDescribedBy() {
1706
+ return this.ariaDescribedBy;
1707
+ }
1708
+ backdropClick(btn) {
1709
+ if (this.backdrop === true && this._elRef.nativeElement === btn) {
1710
+ this.dismiss(ModalDismissReasons.BackdropClick);
1711
+ }
1712
+ }
1713
+ escKey(event) {
1714
+ if (this.keyboard && !event.defaultPrevented) {
1715
+ this.dismiss(ModalDismissReasons.Esc);
1716
+ }
1717
+ }
1718
+ dismiss(reason) {
1719
+ this.dismissEvent.emit(reason);
1720
+ }
1721
+ ngOnInit() {
1722
+ this._elWithFocus = this._document.activeElement;
1723
+ }
1724
+ ngAfterViewInit() {
1725
+ if (!this._elRef.nativeElement.contains(document.activeElement)) {
1726
+ const firstFocusable = getFocusableBoundaryElements(this._elRef.nativeElement)[0];
1727
+ const elementToFocus = firstFocusable || this._elRef.nativeElement;
1728
+ elementToFocus.focus();
1729
+ }
1730
+ }
1731
+ ngOnDestroy() {
1732
+ const body = this._document.body;
1733
+ const elWithFocus = this._elWithFocus;
1734
+ let elementToFocus;
1735
+ if (elWithFocus && elWithFocus[FOCUS] && body.contains(elWithFocus)) {
1736
+ elementToFocus = elWithFocus;
1737
+ }
1738
+ else {
1739
+ elementToFocus = body;
1740
+ }
1741
+ elementToFocus.focus();
1742
+ this._elWithFocus = null;
1743
+ }
1744
+ }
1745
+ LuxModalWindowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModalWindowComponent, deps: [{ token: DOCUMENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
1746
+ LuxModalWindowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: `
1747
+ <div class="modal-dialog" role="document">
1748
+ <div class="modal-content"><ng-content></ng-content></div>
1749
+ </div>
1750
+ `, isInline: true });
1751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModalWindowComponent, decorators: [{
1752
+ type: Component,
1753
+ args: [{
1754
+ selector: 'lux-modal-window',
1755
+ template: `
1756
+ <div class="modal-dialog" role="document">
1757
+ <div class="modal-content"><ng-content></ng-content></div>
1758
+ </div>
1759
+ `
1760
+ }]
1761
+ }], ctorParameters: function () {
1762
+ return [{ type: undefined, decorators: [{
1763
+ type: Inject,
1764
+ args: [DOCUMENT]
1765
+ }] }, { type: i0.ElementRef }];
1766
+ }, 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.1", ngImport: i0, type: LuxModalBackdropComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1811
+ LuxModalBackdropComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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.1", 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.1", ngImport: i0, type: LuxModalConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1834
+ LuxModalConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModalConfig, providedIn: 'root' });
1835
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", 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.1", 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.1", ngImport: i0, type: ModalStack, providedIn: 'root' });
2001
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ModalStack, decorators: [{
2002
+ type: Injectable,
2003
+ args: [{ providedIn: 'root' }]
2004
+ }], ctorParameters: function () {
2005
+ return [{ type: i0.ApplicationRef }, { type: undefined, decorators: [{
2006
+ type: Inject,
2007
+ args: [DOCUMENT]
2008
+ }] }, { type: i0.Injector }, { type: i0.RendererFactory2 }, { type: LuxModalConfig }];
2009
+ } });
2010
+
2011
+ /**
2012
+ * A service that it allow open an close modal components
2013
+ */
2014
+ class ModalService {
2015
+ constructor(modalStack, moduleCFR) {
2016
+ this.modalStack = modalStack;
2017
+ this.moduleCFR = moduleCFR;
2018
+ }
2019
+ /**Open a modal component
2020
+ * @param content TemplateRef
2021
+ */
2022
+ open(content, options = {}) {
2023
+ return this.modalStack.open(this.moduleCFR, content, options);
2024
+ }
2025
+ }
2026
+ ModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ModalService, deps: [{ token: ModalStack }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable });
2027
+ ModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ModalService, providedIn: 'root' });
2028
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: ModalService, decorators: [{
2029
+ type: Injectable,
2030
+ args: [{ providedIn: 'root' }]
2031
+ }], ctorParameters: function () { return [{ type: ModalStack }, { type: i0.ComponentFactoryResolver }]; } });
2032
+
2033
+ class GeolocationService {
2034
+ constructor(http) {
2035
+ this.http = http;
2036
+ this.debouncePeriodMs = 300; // ms
2037
+ this.cacheSize = 20;
2038
+ this.lastQueriesWithResults = new Map();
2039
+ this.lastQueriesLru = [];
2040
+ this.currentSearch$ = new Subject();
2041
+ const typed$ = this.currentSearch$
2042
+ .asObservable()
2043
+ .pipe(distinctUntilChanged());
2044
+ this.currentQuery$ = typed$.pipe(debounceTime(this.debouncePeriodMs), switchMap((currentQuery) => {
2045
+ const data = this.getFromCache(currentQuery);
2046
+ if (data !== undefined) {
2047
+ return of(data);
2048
+ }
2049
+ // Nominatim search documentation:
2050
+ // https://nominatim.org/release-docs/develop/api/Search/
2051
+ const url = 'https://nominatim.openstreetmap.org/search?format=json&limit=20&q=' +
2052
+ encodeURIComponent(currentQuery);
2053
+ const headers = {
2054
+ 'Content-Type': 'application/json'
2055
+ };
2056
+ this.addToCache(currentQuery, []);
2057
+ return this.http.get(url, { headers }).pipe(map((response) => {
2058
+ const searchResults = response;
2059
+ const uniqueResults = distinct(searchResults);
2060
+ return this.addToCache(currentQuery, uniqueResults);
2061
+ }));
2062
+ }));
2063
+ }
2064
+ searchGeolocation(query) {
2065
+ this.currentSearch$.next(query);
2066
+ return this.currentQuery$;
2067
+ }
2068
+ getLabels(instance, keys) {
2069
+ const searchResults = instance.lastQueriesWithResults
2070
+ .get(instance.getLatestQuery())
2071
+ .filter((searchResult) => samePosition(searchResult, keys));
2072
+ return of(searchResults.map((searchResult) => {
2073
+ const key = {
2074
+ type: 'Point',
2075
+ coordinates: [searchResult.lon, searchResult.lat]
2076
+ };
2077
+ return {
2078
+ key,
2079
+ label: searchResult.display_name
2080
+ };
2081
+ }));
2082
+ }
2083
+ getData(instance, search) {
2084
+ return instance.searchGeolocation(search).pipe(map((searchResults) => searchResults.map((searchResult) => {
2085
+ const key = {
2086
+ type: 'Point',
2087
+ coordinates: [searchResult.lon, searchResult.lat]
2088
+ };
2089
+ const label = searchResult.display_name;
2090
+ return { key, label };
2091
+ })));
2092
+ }
2093
+ // Cache implemementation ---
2094
+ getFromCache(query) {
2095
+ if (this.lastQueriesWithResults.has(query)) {
2096
+ return this.lastQueriesWithResults.get(query);
2097
+ }
2098
+ return undefined;
2099
+ }
2100
+ addToCache(query, data) {
2101
+ if (this.lastQueriesWithResults.keys.length >= this.cacheSize) {
2102
+ const deletedQuery = this.lastQueriesLru[0];
2103
+ this.revomeFromCache(deletedQuery);
2104
+ }
2105
+ this.lastQueriesWithResults.set(query, data);
2106
+ this.lastQueriesLru.push(query);
2107
+ return data;
2108
+ }
2109
+ revomeFromCache(query) {
2110
+ this.lastQueriesWithResults.delete(query);
2111
+ const index = this.lastQueriesLru.findIndex((it) => it === query);
2112
+ this.lastQueriesLru.splice(index, 1);
2113
+ }
2114
+ getLatestQuery() {
2115
+ return this.lastQueriesLru.length
2116
+ ? this.lastQueriesLru[this.lastQueriesLru.length - 1]
2117
+ : null;
2118
+ }
2119
+ }
2120
+ GeolocationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: GeolocationService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2121
+ GeolocationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: GeolocationService, providedIn: 'root' });
2122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: GeolocationService, decorators: [{
2123
+ type: Injectable,
2124
+ args: [{ providedIn: 'root' }]
2125
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
2126
+ const samePosition = (searchResult, keys) => {
2127
+ let found = false;
2128
+ keys.forEach((item) => {
2129
+ if (searchResult.lon === item.coordinates[0] &&
2130
+ searchResult.lat === item.coordinates[1]) {
2131
+ found = true;
2132
+ }
2133
+ });
2134
+ return found;
2135
+ };
2136
+ const distinct = (data) => {
2137
+ const unique = {};
2138
+ return data.filter((r) => {
2139
+ if (unique[r.display_name]) {
2140
+ return false;
2141
+ }
2142
+ unique[r.display_name] = 1;
2143
+ return true;
2144
+ });
2145
+ };
2146
+
2147
+ let openLayersIsInstalled = false;
2148
+ class OpenLayerLoaderService {
2149
+ load() {
2150
+ if (window.ol) {
2151
+ return of(true);
2152
+ }
2153
+ const openLayerJsUrl = 'https://openlayers.org/en/v5.3.0/build/ol.js';
2154
+ const openLayerCssUrl = 'https://openlayers.org/en/v5.3.0/css/ol.css';
2155
+ if (!openLayersIsInstalled) {
2156
+ openLayersIsInstalled = true; // only try to install it once
2157
+ loadCss(openLayerCssUrl, () => { });
2158
+ return from(new Promise((resolve, _) => {
2159
+ loadScript(openLayerJsUrl, () => resolve(true));
2160
+ }));
2161
+ }
2162
+ return of(true);
2163
+ }
2164
+ }
2165
+ OpenLayerLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: OpenLayerLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2166
+ OpenLayerLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: OpenLayerLoaderService, providedIn: 'root' });
2167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: OpenLayerLoaderService, decorators: [{
2168
+ type: Injectable,
2169
+ args: [{ providedIn: 'root' }]
2170
+ }] });
2171
+ /** Dynamically load a script from url and return a callback */
2172
+ const loadScript = (url, callback) => {
2173
+ const script = document.createElement('script');
2174
+ script.type = 'text/javascript';
2175
+ if (script.readyState) {
2176
+ // for old IE
2177
+ script.onreadystatechange = () => {
2178
+ if (script.readyState === 'loaded' || script.readyState === 'complete') {
2179
+ script.onreadystatechange = null;
2180
+ callback();
2181
+ }
2182
+ };
2183
+ }
2184
+ else {
2185
+ // Others browsers
2186
+ script.onload = () => {
2187
+ callback();
2188
+ };
2189
+ }
2190
+ script.src = url;
2191
+ document.getElementsByTagName('head')[0].appendChild(script);
2192
+ };
2193
+ /** Dynamically load css from url and return a callback */
2194
+ const loadCss = (url, callback) => {
2195
+ const link = document.createElement('link');
2196
+ link.type = 'text/css';
2197
+ link.rel = 'stylesheet';
2198
+ link.type = 'text/javascript';
2199
+ link.href = url;
2200
+ link.onload = () => {
2201
+ callback();
2202
+ };
2203
+ document.getElementsByTagName('head')[0].appendChild(link);
2204
+ };
2205
+
2206
+ class MapComponent {
2207
+ constructor(olLoader) {
2208
+ this.loaded$ = new BehaviorSubject(false);
2209
+ this.valueChange = new EventEmitter();
2210
+ olLoader.load().subscribe((_) => {
2211
+ // Initialize
2212
+ this._markerSource = new ol.source.Vector();
2213
+ this._markerStyle = new ol.style.Style({
2214
+ image: new ol.style.Icon({
2215
+ anchor: [0.5, 1],
2216
+ scale: 0.25,
2217
+ src: '/assets/img/marker.png'
2218
+ })
2219
+ });
2220
+ this.loaded$.next(true);
2221
+ });
2222
+ }
2223
+ set zoom(zoom) {
2224
+ if (!isNaN(zoom)) {
2225
+ this._zoom = zoom;
2226
+ if (this._map) {
2227
+ this._map.getView().setZoom(zoom);
2228
+ }
2229
+ }
2230
+ }
2231
+ get zoom() {
2232
+ return this._zoom;
2233
+ }
2234
+ set center(center) {
2235
+ if (center && center.coordinates && center.coordinates.length === 2) {
2236
+ this._center = center;
2237
+ if (this._map) {
2238
+ this._map.getView().setCenter(ol.proj.fromLonLat(center.coordinates));
2239
+ }
2240
+ }
2241
+ }
2242
+ get center() {
2243
+ return this._center;
2244
+ }
2245
+ set readonly(readonly) {
2246
+ if (!readonly) {
2247
+ if (this._map) {
2248
+ this._map.on('click', (args) => {
2249
+ // args.coordinate is in EPSG:3857 (meters), we transform it into EPSG:4326 (degrees)
2250
+ const coordinates = ol.proj.toLonLat(args.coordinate);
2251
+ // alternatively: const lonLat = ol.proj.transform(args.coordinate,'EPSG:3857','EPSG:4326');
2252
+ this.addMarkerAtCoordinates(coordinates);
2253
+ });
2254
+ this._map.on('pointermove', (event) => {
2255
+ const pixel = this._map.getEventPixel(event.originalEvent);
2256
+ const hit = this._map.hasFeatureAtPixel(pixel);
2257
+ this._map.getViewport().style.cursor = hit ? 'move' : 'grab';
2258
+ });
2259
+ }
2260
+ }
2261
+ else {
2262
+ if (this._map) {
2263
+ this._map.on('click', (args) => { });
2264
+ this._map.on('pointermove', (event) => { });
2265
+ this._map.getViewport().style.cursor = 'grab';
2266
+ }
2267
+ }
2268
+ this._readonly = readonly;
2269
+ // reset marker coordinates so marker interactions can be created or recreated accordingly
2270
+ // to the changes to readonly
2271
+ this.markerCoordinates = this.markerCoordinates;
2272
+ }
2273
+ get readonly() {
2274
+ return this._readonly;
2275
+ }
2276
+ set markerCoordinates(markerCoordinates) {
2277
+ if (markerCoordinates && markerCoordinates.length === 2) {
2278
+ this._markerCoordinates = markerCoordinates;
2279
+ if (this._map) {
2280
+ this.addMarkerAtCoordinates(markerCoordinates);
2281
+ }
2282
+ }
2283
+ else {
2284
+ this._markerCoordinates = undefined;
2285
+ if (this._map) {
2286
+ this.removeMarker();
2287
+ }
2288
+ }
2289
+ }
2290
+ get markerCoordinates() {
2291
+ return this._markerCoordinates;
2292
+ }
2293
+ set markerPoint(markerPoint) {
2294
+ if (!markerPoint ||
2295
+ !(markerPoint.coordinates && markerPoint.coordinates.length === 2)) {
2296
+ this.markerCoordinates = undefined;
2297
+ }
2298
+ else {
2299
+ this.markerCoordinates = [
2300
+ +markerPoint.coordinates[0],
2301
+ +markerPoint.coordinates[1]
2302
+ ];
2303
+ }
2304
+ this.valueChange.emit(markerPoint);
2305
+ }
2306
+ get markerPoint() {
2307
+ return {
2308
+ type: 'Point',
2309
+ coordinates: this.markerCoordinates
2310
+ };
2311
+ }
2312
+ ngOnInit() {
2313
+ this.mapId = this.mapId ? this.mapId : 'map' + MapComponent.idCounter++;
2314
+ }
2315
+ ngAfterViewInit() {
2316
+ this.loaded$.subscribe((loaded) => {
2317
+ if (loaded) {
2318
+ this.initMap();
2319
+ }
2320
+ });
2321
+ }
2322
+ initMap() {
2323
+ this._map = new ol.Map({
2324
+ target: this.mapId,
2325
+ controls: ol.control.defaults({ attribution: false }),
2326
+ layers: [
2327
+ new ol.layer.Tile({
2328
+ source: new ol.source.OSM()
2329
+ }),
2330
+ new ol.layer.Vector({
2331
+ source: this._markerSource,
2332
+ style: this._markerStyle
2333
+ })
2334
+ ],
2335
+ view: new ol.View({
2336
+ center: ol.proj.fromLonLat(this.center !== undefined ? this.center.coordinates : [0, 0]),
2337
+ zoom: this.zoom
2338
+ })
2339
+ });
2340
+ if (this.center === undefined || this.center === null) {
2341
+ // if the center is not set, we set its default value
2342
+ if ('geolocation' in navigator) {
2343
+ navigator.geolocation.getCurrentPosition((position) => {
2344
+ this.center = {
2345
+ type: 'Point',
2346
+ coordinates: [position.coords.longitude, position.coords.latitude]
2347
+ };
2348
+ }, (error) => {
2349
+ this.center = {
2350
+ type: 'Point',
2351
+ coordinates: [0, 0]
2352
+ };
2353
+ });
2354
+ }
2355
+ else {
2356
+ this.center = {
2357
+ type: 'Point',
2358
+ coordinates: [0, 0]
2359
+ };
2360
+ }
2361
+ }
2362
+ else {
2363
+ // the center needs the map to be properly set, so if it was set before the map was initialized,
2364
+ // we set the center again to perform necessary adjustements
2365
+ this.center = this.center;
2366
+ }
2367
+ if (this.zoom === undefined || this.zoom === null) {
2368
+ // if the zoom is not set, we set its default value
2369
+ this.zoom = 18;
2370
+ }
2371
+ else {
2372
+ // the zoom needs the map to be properly set, so if it was set before the map was initialized,
2373
+ // we set the zoom again to perform necessary adjustements
2374
+ this.zoom = this.zoom;
2375
+ }
2376
+ if (this.readonly === undefined || this.readonly === null) {
2377
+ // if readonly is not set, we set its default value
2378
+ this.readonly = false;
2379
+ }
2380
+ else {
2381
+ // readonly needs the map to be properly set, so if it was set before the map was initialized,
2382
+ // we set readonly again to perform necessary adjustements
2383
+ this.readonly = this.readonly;
2384
+ }
2385
+ if (this.markerCoordinates !== undefined &&
2386
+ this.markerCoordinates !== null) {
2387
+ // the marker coordinates need the map to be properly set, so if they were set before the map was initialized,
2388
+ // we set the marker coordinates again to perform necessary adjustements
2389
+ this.markerCoordinates = this.markerCoordinates;
2390
+ }
2391
+ }
2392
+ addMarkerAtCoordinates(coordinates) {
2393
+ if (coordinates && coordinates.length === 2) {
2394
+ if (this._marker !== undefined) {
2395
+ this.removeMarker();
2396
+ }
2397
+ this._marker = new ol.Feature({
2398
+ geometry: new ol.geom.Point(
2399
+ // [lon, lat] is in EPSG:4326 (degrees), we transform it into EPSG:3857 (meters)
2400
+ ol.proj.transform(coordinates, 'EPSG:4326', 'EPSG:3857'))
2401
+ });
2402
+ this._markerSource.addFeature(this._marker);
2403
+ this._markerCoordinates = this.getMarkerCoordinates();
2404
+ if (!this.readonly) {
2405
+ const dragInteraction = new ol.interaction.Modify({
2406
+ features: new ol.Collection([this._marker]),
2407
+ style: this._markerStyle,
2408
+ pixelTolerance: 50,
2409
+ hitDetection: true
2410
+ });
2411
+ this._markerInteraction = dragInteraction;
2412
+ this._map.addInteraction(dragInteraction);
2413
+ }
2414
+ this._marker.on('change', () => {
2415
+ this._markerCoordinates = this.getMarkerCoordinates();
2416
+ }, this._marker);
2417
+ }
2418
+ }
2419
+ removeMarker() {
2420
+ if (this._marker !== undefined) {
2421
+ this._markerSource.removeFeature(this._marker);
2422
+ this._marker = undefined;
2423
+ }
2424
+ if (this._markerInteraction !== undefined) {
2425
+ this._map.getInteractions().pop();
2426
+ this._markerInteraction = undefined;
2427
+ }
2428
+ }
2429
+ getMarkerCoordinates() {
2430
+ if (this._marker === undefined || this._marker == null) {
2431
+ return this._marker;
2432
+ }
2433
+ const coordinates = this._marker.getGeometry().getCoordinates();
2434
+ // coordinates is in EPSG:3857 (meters), we transform it into EPSG:4326 (degrees)
2435
+ return ol.proj.transform(coordinates, 'EPSG:3857', 'EPSG:4326');
2436
+ }
2437
+ onResize() {
2438
+ if (this._map) {
2439
+ this._map.updateSize();
2440
+ }
2441
+ }
2442
+ }
2443
+ MapComponent.idCounter = 0;
2444
+ MapComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MapComponent, deps: [{ token: OpenLayerLoaderService }], target: i0.ɵɵFactoryTarget.Component });
2445
+ MapComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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"] }] });
2446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MapComponent, decorators: [{
2447
+ type: Component,
2448
+ 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"] }]
2449
+ }], ctorParameters: function () { return [{ type: OpenLayerLoaderService }]; }, propDecorators: { mapId: [{
2450
+ type: Input
2451
+ }], zoom: [{
2452
+ type: Input
2453
+ }], center: [{
2454
+ type: Input
2455
+ }], readonly: [{
2456
+ type: Input
2457
+ }], markerCoordinates: [{
2458
+ type: Input
2459
+ }], markerPoint: [{
2460
+ type: Input
2461
+ }], valueChange: [{
2462
+ type: Output
2463
+ }] } });
2464
+
2465
+ class GeolocationComponent {
2466
+ constructor(modalService, locationService) {
2467
+ this.modalService = modalService;
2468
+ this.locationService = locationService;
2469
+ this.touched = false;
2470
+ this.dirty = false;
2471
+ this.lastErrors = null;
2472
+ this.latitudeValue = undefined;
2473
+ this.longitudeValue = undefined;
2474
+ this.isValidNumber = isValidNumber;
2475
+ this.i18n = {
2476
+ en: {
2477
+ lat: 'latitude',
2478
+ lon: 'longitude',
2479
+ selectLocation: 'Select location',
2480
+ location: 'Location',
2481
+ selectAction: 'Select',
2482
+ cancelAction: 'Cancel',
2483
+ closeAction: 'Close',
2484
+ typeToSearch: 'type to search',
2485
+ cardinalPoints: {
2486
+ north: 'N',
2487
+ south: 'S',
2488
+ east: 'E',
2489
+ west: 'W'
2490
+ },
2491
+ userErrors: {
2492
+ required: 'Required field.',
2493
+ minLatitude: 'Minimum latitude is $minLatitude.',
2494
+ maxLatitude: 'Maximum latitude is $maxLatitude.',
2495
+ minLongitude: 'Minimum longitude is $minLongitude.',
2496
+ maxLongitude: 'Maximum longitude is $maxLongitude.'
2497
+ }
2498
+ },
2499
+ es: {
2500
+ lat: 'latitud',
2501
+ lon: 'longitud',
2502
+ selectLocation: 'Seleccione ubicación',
2503
+ location: 'Ubicación',
2504
+ selectAction: 'Seleccionar',
2505
+ cancelAction: 'Cancelar',
2506
+ closeAction: 'Cerrar',
2507
+ typeToSearch: 'escribe para buscar',
2508
+ cardinalPoints: {
2509
+ north: 'N',
2510
+ south: 'S',
2511
+ east: 'E',
2512
+ west: 'O'
2513
+ },
2514
+ userErrors: {
2515
+ required: 'El campo es obligatorio.',
2516
+ minLatitude: 'La latitud mínima es $minLatitude.',
2517
+ maxLatitude: 'La latitud máxima es $maxLatitude.',
2518
+ minLongitude: 'La longitud mínima es $minLongitude.',
2519
+ maxLongitude: 'La longitud máxima es $maxLongitude.'
2520
+ }
2521
+ }
2522
+ };
2523
+ this.lang = languageDetector();
2524
+ this.inlineErrors = false;
2525
+ this.readonly = null;
2526
+ this.valueChange = new EventEmitter();
2527
+ this.keyPress = new EventEmitter();
2528
+ this.onChange = (value) => { };
2529
+ this.onTouched = () => { };
2530
+ }
2531
+ get className() {
2532
+ return this.checkClassName();
2533
+ }
2534
+ set disabled(v) {
2535
+ v = typeof v === 'string' && v !== 'false' ? true : v;
2536
+ this._disabled = v;
2537
+ }
2538
+ get disabled() {
2539
+ return this._disabled;
2540
+ }
2541
+ set required(v) {
2542
+ this._required = v;
2543
+ }
2544
+ get required() {
2545
+ return this._required;
2546
+ }
2547
+ set value(v) {
2548
+ if (v === this._value) {
2549
+ return; // prevent events when there is no changes
2550
+ }
2551
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
2552
+ if (v &&
2553
+ v.coordinates &&
2554
+ v.coordinates.length === 2 &&
2555
+ exists(v.coordinates[0] && exists(v.coordinates[1]))) {
2556
+ this._value = v;
2557
+ this.setLatitudeInControl(v.coordinates[1]);
2558
+ this.setLongitudeInControl(v.coordinates[0]);
2559
+ }
2560
+ else if (!v) {
2561
+ this._value = null;
2562
+ this.setLatitudeInControl(null);
2563
+ this.setLongitudeInControl(null);
2564
+ }
2565
+ else {
2566
+ this._value = v;
2567
+ // we don't set value in control if the value is not valid
2568
+ // if we do, the content of the control changes and can erase what the user is typing
2569
+ }
2570
+ this.onChange(v);
2571
+ if (!initialAndEmpty) {
2572
+ this.valueChange.emit(v);
2573
+ }
2574
+ }
2575
+ get value() {
2576
+ return this._value;
2577
+ }
2578
+ // ControlValueAccessor Interface implementation
2579
+ writeValue(value) {
2580
+ this.value = value;
2581
+ }
2582
+ registerOnChange(onChange) {
2583
+ this.onChange = onChange;
2584
+ }
2585
+ registerOnTouched(onTouched) {
2586
+ this.onTouched = onTouched;
2587
+ }
2588
+ markAsTouched() {
2589
+ if (!this.touched) {
2590
+ this.onTouched();
2591
+ this.touched = true;
2592
+ }
2593
+ }
2594
+ setDisabledState(disabled) {
2595
+ this.disabled = disabled;
2596
+ }
2597
+ // End of ControlValueAccessor Interface implementation
2598
+ setLatitudeInControl(latitude) {
2599
+ // this.latitude.nativeElement.value = latitude;
2600
+ this.latitudeValue = latitude;
2601
+ }
2602
+ setLongitudeInControl(longitude) {
2603
+ // this.longitude.nativeElement.value = longitude;
2604
+ this.longitudeValue = longitude;
2605
+ }
2606
+ clear() {
2607
+ this.setLatitudeInControl(null);
2608
+ this.setLongitudeInControl(null);
2609
+ this.value = null;
2610
+ }
2611
+ isClearable() {
2612
+ return (isValidNumber(this.latitudeValue) || isValidNumber(this.longitudeValue));
2613
+ }
2614
+ // Validator interface
2615
+ registerOnValidatorChange() { }
2616
+ validate(control) {
2617
+ const value = control.value;
2618
+ let result = null;
2619
+ if (this.required &&
2620
+ !hasValue(value) &&
2621
+ !exists(this.latitudeValue) &&
2622
+ !exists(this.longitudeValue)) {
2623
+ result = result || {};
2624
+ result.required = { value, reason: 'Required field.' };
2625
+ }
2626
+ if (!exists(this.latitudeValue) && exists(this.longitudeValue)) {
2627
+ result = result || {};
2628
+ result.existsLatitude = {
2629
+ value,
2630
+ reason: 'Latitude not specified.'
2631
+ };
2632
+ }
2633
+ if (exists(this.latitudeValue) && !exists(this.longitudeValue)) {
2634
+ result = result || {};
2635
+ result.existsLongitude = {
2636
+ value,
2637
+ reason: 'Longitude not specified.'
2638
+ };
2639
+ }
2640
+ if (exists(this.minLatitude) && this.latitudeValue < this.minLatitude) {
2641
+ result = result || {};
2642
+ result.minLatitude = {
2643
+ value,
2644
+ min: this.minLatitude,
2645
+ reason: `Latitude is lower than minimum value: ${this.minLatitude}.`
2646
+ };
2647
+ }
2648
+ if (exists(this.maxLatitude) && this.latitudeValue > this.maxLatitude) {
2649
+ result = result || {};
2650
+ result.maxLatitude = {
2651
+ value,
2652
+ max: this.maxLatitude,
2653
+ reason: `Latitude is higher than maximum value: ${this.maxLatitude}.`
2654
+ };
2655
+ }
2656
+ if (exists(this.minLongitude) && this.longitudeValue < this.minLongitude) {
2657
+ result = result || {};
2658
+ result.minLongitude = {
2659
+ value,
2660
+ min: this.minLongitude,
2661
+ reason: `Longitude is lower than minimum value: ${this.minLongitude}.`
2662
+ };
2663
+ }
2664
+ if (exists(this.maxLongitude) && this.longitudeValue > this.maxLongitude) {
2665
+ result = result || {};
2666
+ result.maxLongitude = {
2667
+ value,
2668
+ max: this.maxLongitude,
2669
+ reason: `Longitude is higher than maximum value: ${this.maxLongitude}.`
2670
+ };
2671
+ }
2672
+ this.lastErrors = result;
2673
+ return result;
2674
+ }
2675
+ // End of Validator interface
2676
+ ngOnInit() {
2677
+ this.inputId = this.inputId
2678
+ ? this.inputId
2679
+ : `geolocation$${GeolocationComponent.idCounter++}`;
2680
+ this.setPatterns();
2681
+ }
2682
+ roundToStepAndUpdateLatitudeAndLongitude(newLatitudeAndLongitude) {
2683
+ const newLatitude = roundToMultipleOf(newLatitudeAndLongitude[1], this.step);
2684
+ const newLongitude = roundToMultipleOf(newLatitudeAndLongitude[0], this.step);
2685
+ if (this.disabled || this.readonly) {
2686
+ return;
2687
+ }
2688
+ if (!exists(newLatitudeAndLongitude)) {
2689
+ this.value = null;
2690
+ }
2691
+ this.value = {
2692
+ type: 'Point',
2693
+ coordinates: [newLongitude, newLatitude]
2694
+ };
2695
+ }
2696
+ onLostFocus() {
2697
+ this.markAsTouched();
2698
+ }
2699
+ onEventLatitude(newLatitude) {
2700
+ if (this.disabled || this.readonly) {
2701
+ return;
2702
+ }
2703
+ const newLatitudeValue = isValidNumber(newLatitude) ? +newLatitude : null;
2704
+ if (!(exists(this.value) && exists(this.value.coordinates[0])) &&
2705
+ !exists(newLatitudeValue)) {
2706
+ this.value = null;
2707
+ }
2708
+ else {
2709
+ this.value = {
2710
+ type: 'Point',
2711
+ coordinates: [
2712
+ this.value ? this.value.coordinates[0] : undefined,
2713
+ newLatitudeValue
2714
+ ]
2715
+ };
2716
+ }
2717
+ this.markAsTouched();
2718
+ }
2719
+ onEventLongitude(newLongitude) {
2720
+ if (this.disabled || this.readonly) {
2721
+ return;
2722
+ }
2723
+ const newLongitudeValue = isValidNumber(newLongitude)
2724
+ ? +newLongitude
2725
+ : null;
2726
+ if (!exists(newLongitudeValue) &&
2727
+ !(exists(this.value) && exists(this._value.coordinates[1]))) {
2728
+ this.value = null;
2729
+ }
2730
+ else {
2731
+ this.value = {
2732
+ type: 'Point',
2733
+ coordinates: [
2734
+ newLongitudeValue,
2735
+ this.value ? this.value.coordinates[1] : undefined
2736
+ ]
2737
+ };
2738
+ }
2739
+ this.markAsTouched();
2740
+ }
2741
+ onKeyPress(event) {
2742
+ this.keyPress.emit(event);
2743
+ }
2744
+ checkClassName() {
2745
+ return this.disabled
2746
+ ? this.readonly
2747
+ ? 'disabled readonly'
2748
+ : 'disabled'
2749
+ : this.readonly
2750
+ ? 'readonly'
2751
+ : '';
2752
+ }
2753
+ openModalMap(modal) {
2754
+ this.modalService.open(modal).result.then((result) => {
2755
+ if (result !== 'cancel') {
2756
+ this.roundToStepAndUpdateLatitudeAndLongitude(result);
2757
+ }
2758
+ }, (_) => { });
2759
+ }
2760
+ onSearchLocationChanged(newValue, map) {
2761
+ map.markerPoint = newValue;
2762
+ map.center = map.markerPoint;
2763
+ }
2764
+ get mapTitle() {
2765
+ return this._disabled || !!this.readonly
2766
+ ? this.i18n[this.lang].location
2767
+ : this.i18n[this.lang].selectLocation;
2768
+ }
2769
+ get self() {
2770
+ return this;
2771
+ }
2772
+ getLabels(instance, keys) {
2773
+ return instance.locationService.getLabels(instance.locationService, keys);
2774
+ }
2775
+ getData(instance, search) {
2776
+ return instance.locationService.getData(instance.locationService, search);
2777
+ }
2778
+ setPatterns() {
2779
+ this.step = this.step || 0.00001; // 0.00001 degrees = 1.11 meters
2780
+ this.zoom = this.zoom || 18; // (360/2^18) degrees ~ 0.00137 degrees ~ 153 meters
2781
+ this.minLatitude = this.minLatitude || -90;
2782
+ this.maxLatitude = this.maxLatitude || +90;
2783
+ this.minLongitude = this.minLongitude || -180;
2784
+ this.maxLongitude = this.maxLongitude || +180;
2785
+ }
2786
+ }
2787
+ GeolocationComponent.idCounter = 0;
2788
+ GeolocationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: GeolocationComponent, deps: [{ token: ModalService }, { token: GeolocationService }], target: i0.ɵɵFactoryTarget.Component });
2789
+ GeolocationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: [
2790
+ {
2791
+ provide: NG_VALUE_ACCESSOR,
2792
+ multi: true,
2793
+ useExisting: forwardRef(() => GeolocationComponent)
2794
+ },
2795
+ {
2796
+ provide: NG_VALIDATORS,
2797
+ multi: true,
2798
+ useExisting: forwardRef(() => GeolocationComponent)
2799
+ }
2800
+ ], 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"] }] });
2801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: GeolocationComponent, decorators: [{
2802
+ type: Component,
2803
+ args: [{ selector: 'lux-geolocation', providers: [
2804
+ {
2805
+ provide: NG_VALUE_ACCESSOR,
2806
+ multi: true,
2807
+ useExisting: forwardRef(() => GeolocationComponent)
2808
+ },
2809
+ {
2810
+ provide: NG_VALIDATORS,
2811
+ multi: true,
2812
+ useExisting: forwardRef(() => GeolocationComponent)
2813
+ }
2814
+ ], 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"] }]
2815
+ }], ctorParameters: function () { return [{ type: ModalService }, { type: GeolocationService }]; }, propDecorators: { latitude: [{
2816
+ type: ViewChild,
2817
+ args: ['latitude', { static: true }]
2818
+ }], longitude: [{
2819
+ type: ViewChild,
2820
+ args: ['longitude', { static: true }]
2821
+ }], map: [{
2822
+ type: ViewChild,
2823
+ args: ['map', { static: false }]
2824
+ }], minLatitude: [{
2825
+ type: Input
2826
+ }], maxLatitude: [{
2827
+ type: Input
2828
+ }], minLongitude: [{
2829
+ type: Input
2830
+ }], maxLongitude: [{
2831
+ type: Input
2832
+ }], step: [{
2833
+ type: Input
2834
+ }], zoom: [{
2835
+ type: Input
2836
+ }], lang: [{
2837
+ type: Input
2838
+ }], inlineErrors: [{
2839
+ type: Input
2840
+ }], inputId: [{
2841
+ type: Input
2842
+ }], ariaLabel: [{
2843
+ type: Input,
2844
+ args: ['aria-label']
2845
+ }], readonly: [{
2846
+ type: Input
2847
+ }], disabled: [{
2848
+ type: Input
2849
+ }], required: [{
2850
+ type: Input
2851
+ }], value: [{
2852
+ type: Input
2853
+ }], valueChange: [{
2854
+ type: Output
2855
+ }], keyPress: [{
2856
+ type: Output
2857
+ }] } });
2858
+
2859
+ /**
2860
+ * A service that holds the functionality for advanced handling of regular expressions
2861
+ */
2862
+ class RegexpService {
2863
+ constructor() { }
2864
+ removeOuterRoundBrackets(regularExpressionString) {
2865
+ while (regularExpressionString[0] === '(' &&
2866
+ regularExpressionString[regularExpressionString.length - 1] === ')') {
2867
+ regularExpressionString = regularExpressionString.slice(1, regularExpressionString.length - 1);
2868
+ }
2869
+ return regularExpressionString;
2870
+ }
2871
+ isQuantifier(quantifier) {
2872
+ switch (quantifier) {
2873
+ case '{':
2874
+ case '?':
2875
+ case '+':
2876
+ case '*':
2877
+ return true;
2878
+ }
2879
+ return false;
2880
+ }
2881
+ parseMinimalAmountOfQuantifier(quantifier) {
2882
+ switch (quantifier[0]) {
2883
+ case '?':
2884
+ case '*':
2885
+ return 0;
2886
+ case '+':
2887
+ return 1;
2888
+ case '{':
2889
+ for (let index = 1; index < quantifier.length; ++index) {
2890
+ if (quantifier[index] < '0' || quantifier[index] > '9') {
2891
+ return Number(quantifier.slice(1, index));
2892
+ }
2893
+ }
2894
+ }
2895
+ return 0;
2896
+ }
2897
+ sliceRegexByOr(regularExpressionString) {
2898
+ const result = [];
2899
+ let slicedRegex = '';
2900
+ let lastSliceIndex = 0;
2901
+ let roundBracketCount = 0;
2902
+ let squareBracketCount = 0;
2903
+ let curlyBracketCount = 0;
2904
+ let index = 0;
2905
+ for (; index < regularExpressionString.length; ++index) {
2906
+ switch (regularExpressionString[index]) {
2907
+ case '\\':
2908
+ // escape sequence; skip the next character
2909
+ ++index;
2910
+ break;
2911
+ case '(':
2912
+ roundBracketCount += 1;
2913
+ break;
2914
+ case ')':
2915
+ roundBracketCount -= 1;
2916
+ break;
2917
+ case '[':
2918
+ squareBracketCount += 1;
2919
+ break;
2920
+ case ']':
2921
+ squareBracketCount -= 1;
2922
+ break;
2923
+ case '{':
2924
+ curlyBracketCount += 1;
2925
+ break;
2926
+ case '}':
2927
+ curlyBracketCount -= 1;
2928
+ break;
2929
+ case '|':
2930
+ if (roundBracketCount === 0 &&
2931
+ squareBracketCount === 0 &&
2932
+ curlyBracketCount === 0) {
2933
+ slicedRegex = this.removeOuterRoundBrackets(regularExpressionString.slice(lastSliceIndex, index));
2934
+ result.push(slicedRegex);
2935
+ lastSliceIndex = index + 1;
2936
+ }
2937
+ break;
2938
+ }
2939
+ }
2940
+ slicedRegex = this.removeOuterRoundBrackets(regularExpressionString.slice(lastSliceIndex, index));
2941
+ result.push(slicedRegex);
2942
+ return result;
2943
+ }
2944
+ sliceRegexByThen(regularExpressionString) {
2945
+ // the actual result
2946
+ const resultStart = [];
2947
+ // the remainder of the regex in each case
2948
+ const resultRemainder = [];
2949
+ let roundBracketCount = 0;
2950
+ let squareBracketCount = 0;
2951
+ let curlyBracketCount = 0;
2952
+ for (let index = 0; index < regularExpressionString.length; ++index) {
2953
+ switch (regularExpressionString[index]) {
2954
+ case '\\':
2955
+ // escape sequence; skip the next character
2956
+ ++index;
2957
+ break;
2958
+ case '(':
2959
+ roundBracketCount += 1;
2960
+ break;
2961
+ case ')':
2962
+ roundBracketCount -= 1;
2963
+ break;
2964
+ case '[':
2965
+ squareBracketCount += 1;
2966
+ break;
2967
+ case ']':
2968
+ squareBracketCount -= 1;
2969
+ break;
2970
+ case '{':
2971
+ curlyBracketCount += 1;
2972
+ break;
2973
+ case '}':
2974
+ curlyBracketCount -= 1;
2975
+ break;
2976
+ }
2977
+ if (roundBracketCount === 0 &&
2978
+ squareBracketCount === 0 &&
2979
+ curlyBracketCount === 0) {
2980
+ if (!this.isQuantifier(regularExpressionString[index + 1])) {
2981
+ resultStart.push(regularExpressionString.slice(0, index + 1));
2982
+ resultRemainder.push(regularExpressionString.slice(index + 1));
2983
+ }
2984
+ else {
2985
+ // let minimalAmountOfRepeats = parseMinimalAmountOfQuantifier(regularExpressionString.slice(index + 1));
2986
+ // TODO
2987
+ }
2988
+ }
2989
+ }
2990
+ return [resultStart, resultRemainder];
2991
+ }
2992
+ suggestion(beginning, regularExpressionString) {
2993
+ if (new RegExp(regularExpressionString).test(beginning)) {
2994
+ // TODO: RETURN AN EMPTY STRING
2995
+ return 'YA ES IGUAL, NO HAY MÁS QUE SUGERIR';
2996
+ }
2997
+ const regexOptions = this.sliceRegexByOr(regularExpressionString);
2998
+ if (regexOptions.length > 1) {
2999
+ for (let regexOptionIndex = 0; regexOptionIndex < regexOptions.length; ++regexOptionIndex) {
3000
+ const regexParts = this.sliceRegexByThen(regexOptions[regexOptionIndex]);
3001
+ const regexPartsStarts = regexParts[0];
3002
+ const regexPartsRemainders = regexParts[1];
3003
+ // for each option, test if the first part of the regex matches
3004
+ // if it doesn't, continue
3005
+ // if it does, keep checking until what part it matches
3006
+ if (!new RegExp(regexPartsStarts[0]).test(beginning)) {
3007
+ // if there are no more options
3008
+ if (regexOptionIndex === regexOptions.length - 1) {
3009
+ // we return the first option, but we could return any option
3010
+ // TODO: RETURN ANY TEXT THAT MATCHES regexOptions[0]
3011
+ return regexOptions[0];
3012
+ }
3013
+ }
3014
+ else {
3015
+ for (let regexPartIndex = 1; regexPartIndex < regexPartsStarts.length; ++regexPartIndex) {
3016
+ if (!new RegExp(regexPartsStarts[regexPartIndex]).test(beginning)) {
3017
+ // TODO: RETURN ANY TEXT THAT MATCHES regexPartsRemainders[regexPartIndex - 1]
3018
+ return regexPartsRemainders[regexPartIndex - 1];
3019
+ }
3020
+ }
3021
+ }
3022
+ }
3023
+ }
3024
+ else if (regexOptions.length === 1) {
3025
+ const regexParts = this.sliceRegexByThen(regexOptions[0]);
3026
+ const regexPartsStarts = regexParts[0];
3027
+ const regexPartsRemainders = regexParts[1];
3028
+ if (!new RegExp(regexPartsStarts[0]).test(beginning)) {
3029
+ // TODO: RETURN ANY TEXT THAT MATCHES regularExpressionString
3030
+ return regularExpressionString;
3031
+ }
3032
+ else {
3033
+ for (let regexPartIndex = 1; regexPartIndex < regexPartsStarts.length; ++regexPartIndex) {
3034
+ if (!new RegExp(regexPartsStarts[regexPartIndex]).test(beginning)) {
3035
+ // TODO: RETURN ANY TEXT THAT MATCHES regexPartsRemainders[regexPartIndex - 1]
3036
+ return regexPartsRemainders[regexPartIndex - 1];
3037
+ }
3038
+ }
3039
+ }
3040
+ }
3041
+ // TODO: RETURN AN EMPTY STRING
3042
+ return 'NO DEBERÍA SER POSIBLE';
3043
+ }
3044
+ }
3045
+ RegexpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RegexpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3046
+ RegexpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RegexpService, providedIn: 'root' });
3047
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RegexpService, decorators: [{
3048
+ type: Injectable,
3049
+ args: [{ providedIn: 'root' }]
3050
+ }], ctorParameters: function () { return []; } });
3051
+
3052
+ class InputComponent {
3053
+ constructor(regexpService) {
3054
+ this.regexpService = regexpService;
3055
+ this.touched = false;
3056
+ this.dirty = false;
3057
+ this.lastErrors = null;
3058
+ this._value = '';
3059
+ this._pattern = undefined;
3060
+ this._regexp = undefined;
3061
+ this.userErrors = {
3062
+ en: {
3063
+ required: 'Required field.',
3064
+ min: 'Minimum value is $min.',
3065
+ max: 'Maximum value is $max.',
3066
+ email: 'Format should match example@example.com.',
3067
+ url: 'Format should match https://example.com.',
3068
+ color: 'Format should match #XXXXXX.'
3069
+ },
3070
+ es: {
3071
+ required: 'El campo es obligatorio.',
3072
+ min: 'El valor mínimo es $min.',
3073
+ max: 'El valor máximo es $max.',
3074
+ email: 'El campo debe tener un formato como ejemplo@ejemplo.com.',
3075
+ url: 'El campo debe tener un formato como https://ejemplo.com.',
3076
+ color: 'El campo debe tener un formato como #XXXXXX.'
3077
+ }
3078
+ };
3079
+ this.lang = languageDetector();
3080
+ this.inlineErrors = false;
3081
+ this.readonly = null;
3082
+ this.valueChange = new EventEmitter();
3083
+ this.keyPress = new EventEmitter();
3084
+ this.onChange = (value) => { };
3085
+ this.onTouched = () => { };
3086
+ }
3087
+ get className() {
3088
+ return this.checkClassName();
3089
+ }
3090
+ get color() {
3091
+ return this.checkColor();
3092
+ }
3093
+ set disabled(v) {
3094
+ v = typeof v === 'string' ? true : v;
3095
+ this._disabled = v;
3096
+ }
3097
+ get disabled() {
3098
+ return this._disabled;
3099
+ }
3100
+ set pattern(p) {
3101
+ this._pattern = p;
3102
+ if (p === undefined) {
3103
+ this._regexp = undefined;
3104
+ }
3105
+ else {
3106
+ try {
3107
+ this._regexp = new RegExp(p);
3108
+ }
3109
+ catch (e) {
3110
+ this._pattern = undefined;
3111
+ this._regexp = undefined;
3112
+ }
3113
+ }
3114
+ }
3115
+ get pattern() {
3116
+ return this._pattern;
3117
+ }
3118
+ set currency(v) {
3119
+ this._currency = v.toUpperCase();
3120
+ }
3121
+ get currency() {
3122
+ return this._currency;
3123
+ }
3124
+ set placeholder(v) {
3125
+ this._placeholder = v;
3126
+ }
3127
+ get placeholder() {
3128
+ return this._placeholder ? this._placeholder : '';
3129
+ }
3130
+ set required(v) {
3131
+ this._required = v;
3132
+ }
3133
+ get required() {
3134
+ return this._required;
3135
+ }
3136
+ set type(v) {
3137
+ this._type = v.toLowerCase();
3138
+ this.domain = v.toLowerCase();
3139
+ this.checkType(v);
3140
+ }
3141
+ get type() {
3142
+ return this._type ? this._type : 'text';
3143
+ }
3144
+ set value(v) {
3145
+ v = v === undefined ? null : v;
3146
+ if (v === this._value) {
3147
+ return; // prevent events when there is no changes
3148
+ }
3149
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
3150
+ if (this.type === 'date') {
3151
+ v = normalizeDate(v);
3152
+ }
3153
+ this._value = v;
3154
+ this.onChange(v);
3155
+ if (!initialAndEmpty) {
3156
+ this.valueChange.emit(v);
3157
+ }
3158
+ }
3159
+ get value() {
3160
+ if (this.isPercentage() || this.isPermillage() || this.isNumber()) {
3161
+ const numVal = parseFloat(this._value);
3162
+ if (!Number.isNaN(numVal)) {
3163
+ return numVal;
3164
+ }
3165
+ }
3166
+ return this._value;
3167
+ }
3168
+ // ControlValueAccessor Interface implementation
3169
+ writeValue(value) {
3170
+ this.value = value;
3171
+ this.setValueInControl(value);
3172
+ }
3173
+ registerOnChange(onChange) {
3174
+ this.onChange = onChange;
3175
+ }
3176
+ registerOnTouched(onTouched) {
3177
+ this.onTouched = onTouched;
3178
+ }
3179
+ markAsTouched() {
3180
+ if (!this.touched) {
3181
+ this.onTouched();
3182
+ this.touched = true;
3183
+ }
3184
+ }
3185
+ setDisabledState(disabled) {
3186
+ this.disabled = disabled;
3187
+ }
3188
+ // End of ControlValueAccessor Interface implementation
3189
+ setValueInControl(v) {
3190
+ if (this.domain === 'date') {
3191
+ v = normalizeDate(v);
3192
+ }
3193
+ if (this.input) {
3194
+ this.input.nativeElement.value = v;
3195
+ }
3196
+ if (this.textarea) {
3197
+ this.textarea.nativeElement.value = v;
3198
+ }
3199
+ }
3200
+ // Validator interface
3201
+ registerOnValidatorChange() { }
3202
+ validate(control) {
3203
+ const value = control.value;
3204
+ let result = null;
3205
+ if (this.required && !hasValue(value)) {
3206
+ result = result || {};
3207
+ result.required = { value, reason: 'Required field.' };
3208
+ }
3209
+ if (this._regexp && hasValue(value) && !this._regexp.test(value)) {
3210
+ result = result || {};
3211
+ result.pattern = {
3212
+ value,
3213
+ reason: `Value must follow the pattern: ${this._pattern}`
3214
+ };
3215
+ }
3216
+ if (this.type === 'email' && hasValue(value) && !isValidEmail(value)) {
3217
+ result = result || {};
3218
+ result.email = { value, reason: 'Invalid email.' };
3219
+ }
3220
+ if (this.type === 'url' && hasValue(value) && !isValidUrl(value)) {
3221
+ result = result || {};
3222
+ result.url = { value, reason: 'Invalid URL.' };
3223
+ }
3224
+ if (this.type === 'color' && hasValue(value) && !isValidColor(value)) {
3225
+ result = result || {};
3226
+ result.color = { value, reason: 'Invalid color.' };
3227
+ }
3228
+ if (this.type === 'number' && hasValue(value) && !isValidNumber(value)) {
3229
+ result = result || {};
3230
+ result.numeric = { value, reason: 'Invalid number.' };
3231
+ }
3232
+ if (this.type === 'date' ||
3233
+ this.type === 'time' ||
3234
+ this.type === 'timestamp') {
3235
+ if (typeof this.min === 'string' &&
3236
+ hasValue(value) &&
3237
+ String(value).localeCompare(this.min) === -1) {
3238
+ result = result || {};
3239
+ result.min = {
3240
+ value,
3241
+ min: this.min,
3242
+ reason: `Value is lower than minimum value: ${this.min}.`
3243
+ };
3244
+ }
3245
+ if (typeof this.max === 'string' &&
3246
+ hasValue(value) &&
3247
+ String(value).localeCompare(this.max) !== -1) {
3248
+ result = result || {};
3249
+ result.max = {
3250
+ value,
3251
+ max: this.max,
3252
+ reason: `Value is greater than than maximum value: ${this.max}.`
3253
+ };
3254
+ }
3255
+ }
3256
+ if (this.type === 'percentage' ||
3257
+ this.type === 'permillage' ||
3258
+ this.type === 'number' ||
3259
+ this.type === 'currency') {
3260
+ if (hasValue(this.min) && hasValue(value) && value < +this.min) {
3261
+ result = result || {};
3262
+ result.min = {
3263
+ value,
3264
+ min: this.min,
3265
+ reason: `Value is lower than minimum value: ${this.min}.`
3266
+ };
3267
+ }
3268
+ if (hasValue(this.max) && hasValue(value) && value > +this.max) {
3269
+ result = result || {};
3270
+ result.max = {
3271
+ value,
3272
+ max: this.max,
3273
+ reason: `Value is greater than than maximum value: ${this.max}.`
3274
+ };
3275
+ }
3276
+ }
3277
+ this.lastErrors = result;
3278
+ return result;
3279
+ }
3280
+ // End of Validator interface
3281
+ ngOnInit() {
3282
+ this.inputId = this.inputId
3283
+ ? this.inputId
3284
+ : `${this.type}$${InputComponent.idCounter++}`;
3285
+ }
3286
+ onLostFocus() {
3287
+ this.markAsTouched();
3288
+ }
3289
+ onKeyUp(newValue) {
3290
+ this.value = newValue;
3291
+ }
3292
+ onChangeValue(newValue) {
3293
+ this.value = newValue;
3294
+ if (this.isColor()) {
3295
+ this.colorpicker.nativeElement.value = undefined;
3296
+ }
3297
+ this.markAsTouched();
3298
+ }
3299
+ onKeyPress(event) {
3300
+ this.keyPress.emit(event);
3301
+ }
3302
+ onColorPicked(newValue) {
3303
+ this.onChangeValue(newValue);
3304
+ this.setValueInControl(newValue);
3305
+ }
3306
+ isUrl() {
3307
+ return this.type === 'url';
3308
+ }
3309
+ isColor() {
3310
+ return this.type === 'color';
3311
+ }
3312
+ isNumber() {
3313
+ return this.type === 'number';
3314
+ }
3315
+ isPercentage() {
3316
+ return this.type === 'percentage';
3317
+ }
3318
+ isPermillage() {
3319
+ return this.type === 'permillage';
3320
+ }
3321
+ hasPrefix() {
3322
+ return this.currency === 'USD';
3323
+ }
3324
+ hasPostfix() {
3325
+ return (this.currency === 'EUR' ||
3326
+ this.isPercentage() ||
3327
+ this.isPermillage() ||
3328
+ (this.isUrl() && !!this.value) ||
3329
+ this.isColor());
3330
+ }
3331
+ checkClassName() {
3332
+ return this.disabled
3333
+ ? this.readonly
3334
+ ? 'disabled readonly'
3335
+ : 'disabled'
3336
+ : this.readonly
3337
+ ? 'readonly'
3338
+ : '';
3339
+ }
3340
+ checkColor() {
3341
+ return this.type === 'color' && isValidColor(this.value)
3342
+ ? this.value
3343
+ : 'initial';
3344
+ }
3345
+ checkType(type) {
3346
+ switch (type) {
3347
+ case 'email':
3348
+ this.setEmailPatterns();
3349
+ break;
3350
+ case 'url':
3351
+ this.setUrlPatterns();
3352
+ break;
3353
+ case 'color':
3354
+ this.setColorPatterns();
3355
+ break;
3356
+ case 'date':
3357
+ this.setDatePatterns();
3358
+ break;
3359
+ case 'time':
3360
+ this.setTimePatterns();
3361
+ break;
3362
+ case 'password':
3363
+ this.setPasswordPatterns();
3364
+ break;
3365
+ case 'number':
3366
+ this.setNumberPatterns();
3367
+ break;
3368
+ case 'currency':
3369
+ this.setCurrencyPatterns();
3370
+ break;
3371
+ case 'percentage':
3372
+ this.setPercentagePatterns();
3373
+ break;
3374
+ case 'permillage':
3375
+ this.setPermillagePatterns();
3376
+ break;
3377
+ default:
3378
+ break;
3379
+ }
3380
+ }
3381
+ setEmailPatterns() { }
3382
+ setUrlPatterns() { }
3383
+ setColorPatterns() {
3384
+ this.domain = 'text';
3385
+ }
3386
+ setDatePatterns() {
3387
+ this.min = this.min || '1900-01-01';
3388
+ this.max = this.max || '2100-01-01';
3389
+ }
3390
+ setTimePatterns() { }
3391
+ setPasswordPatterns() { }
3392
+ setNumberPatterns() {
3393
+ this.domain = 'number';
3394
+ this.placeholder = '0';
3395
+ }
3396
+ setCurrencyPatterns() {
3397
+ this.domain = 'number';
3398
+ this.step = this.step || 0.1;
3399
+ this.min = this.min || 0.0;
3400
+ this.max = this.max || 10000.0;
3401
+ this.value = 0.0;
3402
+ }
3403
+ setPercentagePatterns() {
3404
+ this.domain = 'number';
3405
+ this.step = this.step || 0.01;
3406
+ this.min = this.min || 0.0;
3407
+ this.max = this.max || 100.0;
3408
+ this.placeholder = '0.00';
3409
+ }
3410
+ setPermillagePatterns() {
3411
+ this.domain = 'number';
3412
+ this.step = this.step || 0.01;
3413
+ this.min = this.min || 0.0;
3414
+ this.max = this.max || 1000.0;
3415
+ this.placeholder = '0.00';
3416
+ }
3417
+ }
3418
+ InputComponent.idCounter = 0;
3419
+ InputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: InputComponent, deps: [{ token: RegexpService }], target: i0.ɵɵFactoryTarget.Component });
3420
+ InputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: [
3421
+ {
3422
+ provide: NG_VALUE_ACCESSOR,
3423
+ multi: true,
3424
+ useExisting: forwardRef(() => InputComponent)
3425
+ },
3426
+ {
3427
+ provide: NG_VALIDATORS,
3428
+ multi: true,
3429
+ useExisting: forwardRef(() => InputComponent)
3430
+ }
3431
+ ], 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"] }] });
3432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: InputComponent, decorators: [{
3433
+ type: Component,
3434
+ args: [{ selector: 'lux-input', providers: [
3435
+ {
3436
+ provide: NG_VALUE_ACCESSOR,
3437
+ multi: true,
3438
+ useExisting: forwardRef(() => InputComponent)
3439
+ },
3440
+ {
3441
+ provide: NG_VALIDATORS,
3442
+ multi: true,
3443
+ useExisting: forwardRef(() => InputComponent)
3444
+ }
3445
+ ], 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"] }]
3446
+ }], ctorParameters: function () { return [{ type: RegexpService }]; }, propDecorators: { input: [{
3447
+ type: ViewChild,
3448
+ args: ['input', { static: false }]
3449
+ }], textarea: [{
3450
+ type: ViewChild,
3451
+ args: ['textarea', { static: false }]
3452
+ }], colorpicker: [{
3453
+ type: ViewChild,
3454
+ args: ['colorpicker', { static: false }]
3455
+ }], rows: [{
3456
+ type: Input
3457
+ }], cols: [{
3458
+ type: Input
3459
+ }], step: [{
3460
+ type: Input
3461
+ }], min: [{
3462
+ type: Input
3463
+ }], max: [{
3464
+ type: Input
3465
+ }], lang: [{
3466
+ type: Input
3467
+ }], inlineErrors: [{
3468
+ type: Input
3469
+ }], inputId: [{
3470
+ type: Input
3471
+ }], ariaLabel: [{
3472
+ type: Input,
3473
+ args: ['aria-label']
3474
+ }], readonly: [{
3475
+ type: Input
3476
+ }], disabled: [{
3477
+ type: Input
3478
+ }], pattern: [{
3479
+ type: Input
3480
+ }], currency: [{
3481
+ type: Input
3482
+ }], placeholder: [{
3483
+ type: Input
3484
+ }], required: [{
3485
+ type: Input
3486
+ }], type: [{
3487
+ type: Input
3488
+ }], value: [{
3489
+ type: Input
3490
+ }], valueChange: [{
3491
+ type: Output
3492
+ }], keyPress: [{
3493
+ type: Output
3494
+ }] } });
3495
+
3496
+ var Placement;
3497
+ (function (Placement) {
3498
+ Placement["Top"] = "top";
3499
+ Placement["Bottom"] = "bottom";
3500
+ Placement["Left"] = "left";
3501
+ Placement["Right"] = "right";
3502
+ })(Placement || (Placement = {}));
3503
+
3504
+ /**
3505
+ * Default Tooltip Component
3506
+ */
3507
+ class TooltipComponent {
3508
+ constructor() { }
3509
+ }
3510
+ TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3511
+ TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: TooltipComponent, selector: "ng-component", inputs: { context: "context" }, ngImport: i0, template: `
3512
+ <span class="lux-tooltip" style="transition: opacity 200ms">{{context.message}}</span>
3513
+ `, isInline: true });
3514
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TooltipComponent, decorators: [{
3515
+ type: Component,
3516
+ args: [{
3517
+ template: `
3518
+ <span class="lux-tooltip" style="transition: opacity 200ms">{{context.message}}</span>
3519
+ `
3520
+ }]
3521
+ }], ctorParameters: function () { return []; }, propDecorators: { context: [{
3522
+ type: Input
3523
+ }] } });
3524
+
3525
+ class TooltipContentRef {
3526
+ constructor(viewRef, componentRef) {
3527
+ this.viewRef = viewRef;
3528
+ this.componentRef = componentRef;
3529
+ }
3530
+ }
3531
+
3532
+ class TooltipService {
3533
+ constructor(_injector, _crf, _applicationRef) {
3534
+ this._injector = _injector;
3535
+ this._crf = _crf;
3536
+ this._applicationRef = _applicationRef;
3537
+ }
3538
+ appendComponentToBody(content, elHost, placement) {
3539
+ const tooltipContentRef = this.getTooltipContentRef(content);
3540
+ if (tooltipContentRef) {
3541
+ let domElem = tooltipContentRef.viewRef
3542
+ .rootNodes[0];
3543
+ document.body.appendChild(domElem);
3544
+ if (tooltipContentRef.componentRef) {
3545
+ tooltipContentRef.componentRef.changeDetectorRef.detectChanges();
3546
+ }
3547
+ domElem = this.setStyle(domElem, placement);
3548
+ domElem = this.setPosition(domElem, elHost, placement);
3549
+ return tooltipContentRef;
3550
+ }
3551
+ return null;
3552
+ }
3553
+ removeComponentFromBody(tooltipContentRef) {
3554
+ this._applicationRef.detachView(tooltipContentRef.viewRef);
3555
+ if (tooltipContentRef.componentRef) {
3556
+ tooltipContentRef.componentRef.destroy();
3557
+ }
3558
+ }
3559
+ getTooltipContentRef(content) {
3560
+ if (!content) {
3561
+ // nothing to show
3562
+ }
3563
+ else if (content instanceof TemplateRef) {
3564
+ return this.createFromTemplateRef(content);
3565
+ }
3566
+ else if (typeof content === 'string') {
3567
+ return this.createFromComponent(TooltipComponent, { message: content });
3568
+ }
3569
+ else {
3570
+ return this.createFromComponent(content);
3571
+ }
3572
+ }
3573
+ createFromTemplateRef(content) {
3574
+ const viewRef = content.createEmbeddedView({});
3575
+ this._applicationRef.attachView(viewRef);
3576
+ return new TooltipContentRef(viewRef);
3577
+ }
3578
+ createFromComponent(component, context) {
3579
+ const componentRef = this._crf
3580
+ .resolveComponentFactory(component)
3581
+ .create(this._injector);
3582
+ if (context) {
3583
+ componentRef.instance.context = context;
3584
+ }
3585
+ this._applicationRef.attachView(componentRef.hostView);
3586
+ return new TooltipContentRef(componentRef.hostView, componentRef);
3587
+ }
3588
+ setStyle(domElem, placement) {
3589
+ domElem.style.position = 'absolute';
3590
+ domElem.style.minWidth = 'min-content';
3591
+ domElem.style.minHeight = 'min-content';
3592
+ const tooltipElement = this.getTooltipElementFromHTMLElemnt(domElem);
3593
+ placement =
3594
+ placement !== undefined
3595
+ ? placement.toLocaleLowerCase()
3596
+ : 'top'; // 'Top' is the default value of placement
3597
+ tooltipElement.classList.add(`lux-tooltip-${placement}`);
3598
+ tooltipElement.classList.add('lux-tooltip-show');
3599
+ return domElem;
3600
+ }
3601
+ getTooltipElementFromHTMLElemnt(domElem) {
3602
+ const elementsArray = Array.from(domElem.classList).filter((className) => className === 'lux-tooltip');
3603
+ if (elementsArray.length !== 0) {
3604
+ return domElem;
3605
+ }
3606
+ else if (domElem.hasChildNodes()) {
3607
+ const childrenArray = Array.from(domElem.children).filter((child) => this.getTooltipElementFromHTMLElemnt(child) !== null);
3608
+ if (childrenArray.length !== 0) {
3609
+ return this.getTooltipElementFromHTMLElemnt(childrenArray[0]);
3610
+ }
3611
+ else {
3612
+ return null;
3613
+ }
3614
+ }
3615
+ else {
3616
+ return null;
3617
+ }
3618
+ }
3619
+ setPosition(domElem, elHost, placement) {
3620
+ const hostPos = elHost.nativeElement.getBoundingClientRect();
3621
+ const tooltipPos = domElem.getBoundingClientRect();
3622
+ const scrollPos = window.pageYOffset ||
3623
+ document.documentElement.scrollTop ||
3624
+ document.body.scrollTop ||
3625
+ 0;
3626
+ let top = 0;
3627
+ let left = 0;
3628
+ const offset = 10;
3629
+ switch (placement) {
3630
+ case Placement.Bottom:
3631
+ top = hostPos.bottom + offset;
3632
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
3633
+ break;
3634
+ case Placement.Left:
3635
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
3636
+ left = hostPos.left - tooltipPos.width - offset;
3637
+ break;
3638
+ case Placement.Right:
3639
+ top = hostPos.top + (hostPos.height - tooltipPos.height) / 2;
3640
+ left = hostPos.right + offset;
3641
+ break;
3642
+ case Placement.Top:
3643
+ default:
3644
+ top = hostPos.top - tooltipPos.height - offset;
3645
+ left = hostPos.left + (hostPos.width - tooltipPos.width) / 2;
3646
+ break;
3647
+ }
3648
+ top = Math.max(0, top);
3649
+ left = Math.max(0, left);
3650
+ domElem.style.top = `${top + scrollPos}px`;
3651
+ domElem.style.left = `${left}px`;
3652
+ return domElem;
3653
+ }
3654
+ }
3655
+ TooltipService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TooltipService, deps: [{ token: i0.Injector }, { token: i0.ComponentFactoryResolver }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
3656
+ TooltipService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TooltipService });
3657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: TooltipService, decorators: [{
3658
+ type: Injectable
3659
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.ComponentFactoryResolver }, { type: i0.ApplicationRef }]; } });
3660
+
3661
+ /**
3662
+ * Tooltip directive
3663
+ */
3664
+ class LuxTooltipDirective {
3665
+ constructor(elHost, tooltipService) {
3666
+ this.elHost = elHost;
3667
+ this.tooltipService = tooltipService;
3668
+ }
3669
+ onMouseEnter() {
3670
+ if (!this.tooltipRef) {
3671
+ this.tooltipRef = this.show(this.content, this.elHost, this.placement);
3672
+ }
3673
+ }
3674
+ onMouseLeave() {
3675
+ if (this.tooltipRef) {
3676
+ this.remove(this.tooltipRef);
3677
+ this.tooltipRef = null;
3678
+ }
3679
+ }
3680
+ onClick() {
3681
+ if (this.tooltipRef) {
3682
+ this.remove(this.tooltipRef);
3683
+ this.tooltipRef = null;
3684
+ }
3685
+ }
3686
+ show(component, elHost, placement) {
3687
+ return this.tooltipService.appendComponentToBody(component, elHost, placement);
3688
+ }
3689
+ remove(tooltipRef) {
3690
+ this.tooltipService.removeComponentFromBody(tooltipRef);
3691
+ }
3692
+ }
3693
+ LuxTooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxTooltipDirective, deps: [{ token: i0.ElementRef }, { token: TooltipService }], target: i0.ɵɵFactoryTarget.Directive });
3694
+ LuxTooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: LuxTooltipDirective, selector: "[luxTooltip]", inputs: { luxTooltip: "luxTooltip", content: "content", placement: "placement" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "click": "onClick()" } }, ngImport: i0 });
3695
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxTooltipDirective, decorators: [{
3696
+ type: Directive,
3697
+ args: [{
3698
+ selector: '[luxTooltip]'
3699
+ }]
3700
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: TooltipService }]; }, propDecorators: { luxTooltip: [{
3701
+ type: Input
3702
+ }], content: [{
3703
+ type: Input
3704
+ }], placement: [{
3705
+ type: Input
3706
+ }], onMouseEnter: [{
3707
+ type: HostListener,
3708
+ args: ['mouseenter']
3709
+ }], onMouseLeave: [{
3710
+ type: HostListener,
3711
+ args: ['mouseleave']
3712
+ }], onClick: [{
3713
+ type: HostListener,
3714
+ args: ['click']
3715
+ }] } });
3716
+
3717
+ class PaginationComponent {
3718
+ constructor() {
3719
+ this.literals = {
3720
+ en: {
3721
+ first: 'First',
3722
+ previous: 'Previous',
3723
+ next: 'Next',
3724
+ last: 'Last'
3725
+ },
3726
+ es: {
3727
+ first: 'Primero',
3728
+ previous: 'Anterior',
3729
+ next: 'Siguiente',
3730
+ last: 'Último'
3731
+ }
3732
+ };
3733
+ this.showPagination = false;
3734
+ this.hidePrevious = false;
3735
+ this.lastPage = false;
3736
+ this.totalPages = 0;
3737
+ this.displayNextEllipsis = false;
3738
+ this.displayPreviousEllipsis = false;
3739
+ this.pages = [];
3740
+ this.goToPage = new EventEmitter();
3741
+ this.pageSizeChange = new EventEmitter();
3742
+ this.lang = languageDetector();
3743
+ }
3744
+ set lang(l) {
3745
+ if (l === this._lang) {
3746
+ return;
3747
+ }
3748
+ if (Object.keys(this.literals).includes(l)) {
3749
+ this._lang = l;
3750
+ }
3751
+ else {
3752
+ this._lang = 'en';
3753
+ }
3754
+ this.loadLanguage();
3755
+ }
3756
+ get lang() {
3757
+ return this._lang;
3758
+ }
3759
+ set paginationInfo(value) {
3760
+ this.paginationInfoValue = value;
3761
+ this.syncState();
3762
+ }
3763
+ get paginationInfo() {
3764
+ return this.paginationInfoValue;
3765
+ }
3766
+ ngOnInit() {
3767
+ this.calculatePages();
3768
+ }
3769
+ pageSizeChanged(pageSize) {
3770
+ this.paginationInfo.pageSize = pageSize;
3771
+ this.syncState();
3772
+ this.pageSizeChange.emit(pageSize);
3773
+ }
3774
+ onPage(n) {
3775
+ this.goToPage.emit(n);
3776
+ }
3777
+ onFirst() {
3778
+ this.goToPage.emit(0);
3779
+ }
3780
+ onLast() {
3781
+ this.goToPage.emit(this.totalPages - 1);
3782
+ }
3783
+ onNext() {
3784
+ const page = (this.paginationInfo.page || 0) + 1;
3785
+ this.goToPage.emit(page);
3786
+ }
3787
+ onPrevious() {
3788
+ const page = (this.paginationInfo.page || 0) - 1;
3789
+ this.goToPage.emit(page);
3790
+ }
3791
+ syncState() {
3792
+ this.pages = this.calculatePages();
3793
+ this.showPagination =
3794
+ this.paginationInfo.total > this.paginationInfo.pageSize;
3795
+ this.hidePrevious = this.paginationInfo.page === 0;
3796
+ this.lastPage =
3797
+ this.paginationInfo.pageSize * (this.paginationInfo.page + 1) >=
3798
+ this.paginationInfo.total;
3799
+ this.totalPages =
3800
+ Math.ceil(this.paginationInfo.total / this.paginationInfo.pageSize) || 0;
3801
+ this.displayNextEllipsis = !this.pages.includes(this.totalPages - 1);
3802
+ this.displayPreviousEllipsis = !this.pages.includes(0);
3803
+ }
3804
+ calculatePages() {
3805
+ const totalPages = Math.ceil(this.paginationInfo.total / this.paginationInfo.pageSize) - 1; // 0-index
3806
+ const p = this.paginationInfo.page || 0;
3807
+ const pagesToShow = this.paginationInfo.pagesToShow;
3808
+ const pages = [];
3809
+ pages.push(p);
3810
+ const times = pagesToShow - 1;
3811
+ for (let i = 0; i < times; i++) {
3812
+ if (pages.length < pagesToShow) {
3813
+ if (Math.min(...pages) > 0) {
3814
+ pages.unshift(Math.min(...pages) - 1);
3815
+ }
3816
+ }
3817
+ if (pages.length < pagesToShow) {
3818
+ if (Math.max(...pages) < totalPages) {
3819
+ pages.push(Math.max(...pages) + 1);
3820
+ }
3821
+ }
3822
+ }
3823
+ pages.sort((a, b) => a - b);
3824
+ return pages;
3825
+ }
3826
+ loadLanguage() {
3827
+ const l = this.literals[this.lang];
3828
+ this.first = l.first;
3829
+ this.previous = l.previous;
3830
+ this.next = l.next;
3831
+ this.last = l.last;
3832
+ }
3833
+ }
3834
+ PaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3835
+ PaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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"] }] });
3836
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: PaginationComponent, decorators: [{
3837
+ type: Component,
3838
+ 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"] }]
3839
+ }], ctorParameters: function () { return []; }, propDecorators: { goToPage: [{
3840
+ type: Output
3841
+ }], pageSizeChange: [{
3842
+ type: Output
3843
+ }], lang: [{
3844
+ type: Input
3845
+ }], paginationInfo: [{
3846
+ type: Input
3847
+ }] } });
3848
+
3849
+ class RadiogroupComponent {
3850
+ constructor() {
3851
+ this.touched = false;
3852
+ this.name = 'radiogroup1';
3853
+ this.disabled = false;
3854
+ this.readonly = false;
3855
+ this.required = false;
3856
+ this.itemsChange = new EventEmitter();
3857
+ this.valueChange = new EventEmitter();
3858
+ this._value = undefined;
3859
+ this._items = [];
3860
+ // ControlValueAccessor Interface
3861
+ this.onChange = (value) => { };
3862
+ this.onTouched = () => { };
3863
+ }
3864
+ set items(col) {
3865
+ this._items = (col || []).map((it, index) => this.ensureHasUniqueName(it, index));
3866
+ this.itemsChange.emit(col);
3867
+ }
3868
+ get items() {
3869
+ return this._items;
3870
+ }
3871
+ set value(v) {
3872
+ if (v === this._value) {
3873
+ return;
3874
+ }
3875
+ const initialAndEmpty = isInitialAndEmpty(this._value, v);
3876
+ this._value = v;
3877
+ this.onChange(v);
3878
+ if (!initialAndEmpty) {
3879
+ this.valueChange.emit(v);
3880
+ }
3881
+ }
3882
+ get value() {
3883
+ return this._value;
3884
+ }
3885
+ writeValue(value) {
3886
+ this.value = value;
3887
+ }
3888
+ registerOnChange(onChange) {
3889
+ this.onChange = onChange;
3890
+ }
3891
+ registerOnTouched(onTouched) {
3892
+ this.onTouched = onTouched;
3893
+ }
3894
+ markAsTouched() {
3895
+ if (!this.touched) {
3896
+ this.onTouched();
3897
+ this.touched = true;
3898
+ }
3899
+ }
3900
+ setDisabledState(disabled) {
3901
+ this.disabled = disabled;
3902
+ }
3903
+ // End ControlValueAccessor Interface
3904
+ // Validator interface
3905
+ registerOnValidatorChange() { }
3906
+ validate(control) {
3907
+ const value = control.value;
3908
+ if (this.required &&
3909
+ (value === '' || value === null || value === undefined)) {
3910
+ return { required: { value, reason: 'Required field.' } };
3911
+ }
3912
+ return null;
3913
+ }
3914
+ // End of Validator interface
3915
+ setValue(event, item) {
3916
+ if (!this.disabled && !this.readonly) {
3917
+ this.value = item.value;
3918
+ this.markAsTouched();
3919
+ }
3920
+ event.preventDefault();
3921
+ }
3922
+ ensureHasUniqueName(item, index) {
3923
+ if (!item.name) {
3924
+ item.name = `${this.name}_${index}`;
3925
+ }
3926
+ return item;
3927
+ }
3928
+ }
3929
+ RadiogroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RadiogroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3930
+ RadiogroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", type: RadiogroupComponent, selector: "lux-radiogroup", inputs: { name: "name", disabled: "disabled", readonly: "readonly", required: "required", items: "items", value: "value" }, outputs: { itemsChange: "itemsChange", valueChange: "valueChange" }, providers: [
3931
+ {
3932
+ provide: NG_VALUE_ACCESSOR,
3933
+ multi: true,
3934
+ useExisting: forwardRef(() => RadiogroupComponent)
3935
+ },
3936
+ {
3937
+ provide: NG_VALIDATORS,
3938
+ multi: true,
3939
+ useExisting: forwardRef(() => RadiogroupComponent)
3940
+ }
3941
+ ], 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"] }] });
3942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: RadiogroupComponent, decorators: [{
3943
+ type: Component,
3944
+ args: [{ selector: 'lux-radiogroup', providers: [
3945
+ {
3946
+ provide: NG_VALUE_ACCESSOR,
3947
+ multi: true,
3948
+ useExisting: forwardRef(() => RadiogroupComponent)
3949
+ },
3950
+ {
3951
+ provide: NG_VALIDATORS,
3952
+ multi: true,
3953
+ useExisting: forwardRef(() => RadiogroupComponent)
3954
+ }
3955
+ ], 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"] }]
3956
+ }], ctorParameters: function () { return []; }, propDecorators: { name: [{
3957
+ type: Input
3958
+ }], disabled: [{
3959
+ type: Input
3960
+ }], readonly: [{
3961
+ type: Input
3962
+ }], required: [{
3963
+ type: Input
3964
+ }], items: [{
3965
+ type: Input
3966
+ }], itemsChange: [{
3967
+ type: Output
3968
+ }], value: [{
3969
+ type: Input
3970
+ }], valueChange: [{
3971
+ type: Output
3972
+ }] } });
3973
+
3974
+ let sequencer = 0;
3975
+ class SelectComponent {
3976
+ constructor() {
3977
+ this.id = 'stringList' + sequencer++;
3978
+ this.disabled = false;
3979
+ this.required = false;
3980
+ /** Allow multiple elements */
3981
+ this.multiple = true;
3982
+ this.value = [];
3983
+ this.valueChange = new EventEmitter();
3984
+ this.placeholder = 'Add new';
3985
+ /** If set, check there is no duplicates in the data. */
3986
+ this.unique = true;
3987
+ /** Validation function for new items. Returns error or null if valid */
3988
+ this.validateItem = (_) => null;
3989
+ this.newEntry = '';
3990
+ this.error = null;
3991
+ this.isValidNewEntry = false;
3992
+ this.touched = false;
3993
+ // ControlValueAccessor Interface
3994
+ this.onChange = (value) => { };
3995
+ this.onTouched = () => { };
3996
+ }
3997
+ writeValue(value) {
3998
+ this.value = value;
3999
+ }
4000
+ registerOnChange(onChange) {
4001
+ this.onChange = onChange;
4002
+ }
4003
+ registerOnTouched(onTouched) {
4004
+ this.onTouched = onTouched;
4005
+ }
4006
+ markAsTouched() {
4007
+ if (!this.touched) {
4008
+ this.onTouched();
4009
+ this.touched = true;
4010
+ }
4011
+ }
4012
+ setDisabledState(disabled) {
4013
+ this.disabled = disabled;
4014
+ }
4015
+ // End ControlValueAccessor Interface
4016
+ // Validator interface
4017
+ registerOnValidatorChange() { }
4018
+ validate(control) {
4019
+ const value = control.value;
4020
+ if (this.required &&
4021
+ (value === '' || value === null || value === undefined)) {
4022
+ return { required: { value, reason: 'Required field.' } };
4023
+ }
4024
+ return null;
4025
+ }
4026
+ // End of Validator interface
4027
+ get canAdd() {
4028
+ return this.multiple || this.value.length === 0;
4029
+ }
4030
+ add(val) {
4031
+ this.value.push(val);
4032
+ this.newEntry = '';
4033
+ this.markAsTouched();
4034
+ this.valueChange.emit(this.value);
4035
+ }
4036
+ remove(index) {
4037
+ if (this.value.length > index) {
4038
+ this.value.splice(index, 1);
4039
+ this.markAsTouched();
4040
+ this.valueChange.emit(this.value);
4041
+ }
4042
+ }
4043
+ onKeyPress(event) {
4044
+ if (event.key === 'Enter' && !this.error && this.newEntry !== '') {
4045
+ // Add on pressing Enter/Return
4046
+ this.markAsTouched();
4047
+ this.add(this.newEntry);
4048
+ }
4049
+ }
4050
+ onChangeNewEntry(newValue) {
4051
+ this.markAsTouched();
4052
+ if (!newValue) {
4053
+ this.isValidNewEntry = false;
4054
+ this.error = null;
4055
+ return;
4056
+ }
4057
+ if (this.unique) {
4058
+ const found = (this.value || []).find((it) => it === newValue);
4059
+ this.isValidNewEntry = !found;
4060
+ this.error = found
4061
+ ? `Value '${newValue}' is already in. Cannot add duplicates.`
4062
+ : null;
4063
+ if (!this.isValidNewEntry) {
4064
+ return;
4065
+ }
4066
+ }
4067
+ this.error = this.validateItem(newValue);
4068
+ this.isValidNewEntry = !this.error;
4069
+ }
4070
+ }
4071
+ SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4072
+ SelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.1.1", 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: [
4073
+ {
4074
+ provide: NG_VALUE_ACCESSOR,
4075
+ multi: true,
4076
+ useExisting: forwardRef(() => SelectComponent)
4077
+ },
4078
+ {
4079
+ provide: NG_VALIDATORS,
4080
+ multi: true,
4081
+ useExisting: forwardRef(() => SelectComponent)
4082
+ }
4083
+ ], 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"] }] });
4084
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: SelectComponent, decorators: [{
4085
+ type: Component,
4086
+ args: [{ selector: 'lux-select', providers: [
4087
+ {
4088
+ provide: NG_VALUE_ACCESSOR,
4089
+ multi: true,
4090
+ useExisting: forwardRef(() => SelectComponent)
4091
+ },
4092
+ {
4093
+ provide: NG_VALIDATORS,
4094
+ multi: true,
4095
+ useExisting: forwardRef(() => SelectComponent)
4096
+ }
4097
+ ], 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"] }]
4098
+ }], ctorParameters: function () { return []; }, propDecorators: { id: [{
4099
+ type: Input
4100
+ }], disabled: [{
4101
+ type: Input
4102
+ }], required: [{
4103
+ type: Input
4104
+ }], multiple: [{
4105
+ type: Input
4106
+ }], value: [{
4107
+ type: Input
4108
+ }], valueChange: [{
4109
+ type: Output
4110
+ }], placeholder: [{
4111
+ type: Input
4112
+ }], unique: [{
4113
+ type: Input
4114
+ }], validateItem: [{
4115
+ type: Input
4116
+ }] } });
4117
+
4118
+ class VoiceRecognitionDirective {
4119
+ constructor(el, renderer) {
4120
+ this.el = el;
4121
+ this.renderer = renderer;
4122
+ this.isRecognizing = false;
4123
+ const speechRecognition = window.webkitSpeechRecognition;
4124
+ if (speechRecognition) {
4125
+ this.recognition = new speechRecognition();
4126
+ }
4127
+ }
4128
+ ngOnInit() {
4129
+ if (this.recognition) {
4130
+ // API is available
4131
+ this.recognition.lang = this.language || window.navigator.language;
4132
+ this.recognition.interimResults = false;
4133
+ this.recognition.maxAlternatives = 1;
4134
+ // Add mic icon
4135
+ this.mic = document.createElement('div');
4136
+ this.mic.setAttribute('class', 'lux-microphone');
4137
+ const parent = this.el.nativeElement.parentElement;
4138
+ parent.appendChild(this.mic);
4139
+ // Add event handlers
4140
+ this.mic.onclick = () => this.microphoneClick();
4141
+ this.recognition.onresult = (event) => this.onRecognized(event);
4142
+ }
4143
+ }
4144
+ microphoneClick() {
4145
+ if (this.isRecognizing) {
4146
+ // stop
4147
+ this.isRecognizing = false;
4148
+ this.renderer.removeClass(this.mic, 'lux-recording');
4149
+ this.recognition.abort();
4150
+ }
4151
+ else {
4152
+ // start
4153
+ this.el.nativeElement.value = getRecordingMessage(this.language);
4154
+ this.isRecognizing = true;
4155
+ this.renderer.addClass(this.mic, 'lux-recording');
4156
+ this.recognition.start();
4157
+ }
4158
+ }
4159
+ onRecognized(event) {
4160
+ const recognizedText = event.results[0][0].transcript;
4161
+ this.isRecognizing = false;
4162
+ this.el.nativeElement.value = recognizedText;
4163
+ this.renderer.removeClass(this.mic, 'lux-recording');
4164
+ }
4165
+ }
4166
+ VoiceRecognitionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: VoiceRecognitionDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
4167
+ VoiceRecognitionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.1", type: VoiceRecognitionDirective, selector: "[luxVoiceRecognition]", inputs: { language: "language" }, ngImport: i0 });
4168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: VoiceRecognitionDirective, decorators: [{
4169
+ type: Directive,
4170
+ args: [{
4171
+ selector: '[luxVoiceRecognition]'
4172
+ }]
4173
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { language: [{
4174
+ type: Input
4175
+ }] } });
4176
+ const getRecordingMessage = (lang) => {
4177
+ switch (lang.toLowerCase()) {
4178
+ case 'es':
4179
+ case 'es-es':
4180
+ return 'Grabando...';
4181
+ case 'en':
4182
+ case 'en-uk':
4183
+ case 'en-us':
4184
+ default:
4185
+ return 'Recording...';
4186
+ }
4187
+ };
4188
+
4189
+ /* Create a new injection token for injecting the window into a component. */
4190
+ const WINDOW = new InjectionToken('WindowToken');
4191
+ /* Define abstract class for obtaining reference to the global window object. */
4192
+ class WindowRef {
4193
+ // eslint-disable-next-line @typescript-eslint/ban-types
4194
+ get nativeWindow() {
4195
+ throw new Error('Not implemented.');
4196
+ }
4197
+ }
4198
+ /* Define class that implements the abstract class and returns the native window object. */
4199
+ class BrowserWindowRef extends WindowRef {
4200
+ constructor() {
4201
+ super();
4202
+ }
4203
+ // eslint-disable-next-line @typescript-eslint/ban-types
4204
+ get nativeWindow() {
4205
+ return window;
4206
+ }
4207
+ }
4208
+ /* Create an factory function that returns the native window object. */
4209
+ // eslint-disable-next-line @typescript-eslint/ban-types
4210
+ const windowFactory = (browserWindowRef, platformId) => {
4211
+ if (isPlatformBrowser(platformId)) {
4212
+ return browserWindowRef.nativeWindow;
4213
+ }
4214
+ return new Object();
4215
+ };
4216
+ /* Create a injectable provider for the WindowRef token that uses the BrowserWindowRef class. */
4217
+ const browserWindowProvider = {
4218
+ provide: WindowRef,
4219
+ useClass: BrowserWindowRef
4220
+ };
4221
+ /* Create an injectable provider that uses the windowFactory function for returning the native window object. */
4222
+ const windowProvider = {
4223
+ provide: WINDOW,
4224
+ useFactory: windowFactory,
4225
+ deps: [WindowRef, PLATFORM_ID]
4226
+ };
4227
+ /* Create an array of providers. */
4228
+ const WINDOW_PROVIDERS = [
4229
+ browserWindowProvider,
4230
+ windowProvider
4231
+ ];
4232
+
4233
+ class LuxModule {
4234
+ }
4235
+ LuxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4236
+ LuxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModule, declarations: [AutocompleteComponent,
4237
+ AutocompleteListComponent,
4238
+ FilterComponent,
4239
+ CheckboxComponent,
4240
+ DatetimeComponent,
4241
+ InputComponent,
4242
+ GeolocationComponent,
4243
+ LuxTooltipDirective,
4244
+ LuxModalWindowComponent,
4245
+ LuxModalBackdropComponent,
4246
+ LuxBreadcrumbComponent,
4247
+ MapComponent,
4248
+ SelectComponent,
4249
+ TooltipComponent,
4250
+ PaginationComponent,
4251
+ RadiogroupComponent,
4252
+ VoiceRecognitionDirective], imports: [AngularResizedEventModule,
4253
+ FormsModule,
4254
+ HttpClientModule,
4255
+ ReactiveFormsModule,
4256
+ RouterModule,
4257
+ CommonModule], exports: [AutocompleteComponent,
4258
+ AutocompleteListComponent,
4259
+ FilterComponent,
4260
+ CheckboxComponent,
4261
+ DatetimeComponent,
4262
+ InputComponent,
4263
+ GeolocationComponent,
4264
+ LuxTooltipDirective,
4265
+ LuxBreadcrumbComponent,
4266
+ LuxBreadcrumbComponent,
4267
+ MapComponent,
4268
+ SelectComponent,
4269
+ PaginationComponent,
4270
+ RadiogroupComponent,
4271
+ VoiceRecognitionDirective] });
4272
+ LuxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModule, providers: [ModalService, TooltipService, WINDOW_PROVIDERS], imports: [[
4273
+ AngularResizedEventModule,
4274
+ FormsModule,
4275
+ HttpClientModule,
4276
+ ReactiveFormsModule,
4277
+ RouterModule,
4278
+ CommonModule
4279
+ ]] });
4280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: LuxModule, decorators: [{
4281
+ type: NgModule,
4282
+ args: [{
4283
+ declarations: [
4284
+ AutocompleteComponent,
4285
+ AutocompleteListComponent,
4286
+ FilterComponent,
4287
+ CheckboxComponent,
4288
+ DatetimeComponent,
4289
+ InputComponent,
4290
+ GeolocationComponent,
4291
+ LuxTooltipDirective,
4292
+ LuxModalWindowComponent,
4293
+ LuxModalBackdropComponent,
4294
+ LuxBreadcrumbComponent,
4295
+ MapComponent,
4296
+ SelectComponent,
4297
+ TooltipComponent,
4298
+ PaginationComponent,
4299
+ RadiogroupComponent,
4300
+ VoiceRecognitionDirective
4301
+ ],
4302
+ entryComponents: [
4303
+ LuxModalWindowComponent,
4304
+ LuxModalBackdropComponent,
4305
+ TooltipComponent
4306
+ ],
4307
+ providers: [ModalService, TooltipService, WINDOW_PROVIDERS],
4308
+ imports: [
4309
+ AngularResizedEventModule,
4310
+ FormsModule,
4311
+ HttpClientModule,
4312
+ ReactiveFormsModule,
4313
+ RouterModule,
4314
+ CommonModule
4315
+ ],
4316
+ exports: [
4317
+ AutocompleteComponent,
4318
+ AutocompleteListComponent,
4319
+ FilterComponent,
4320
+ CheckboxComponent,
4321
+ DatetimeComponent,
4322
+ InputComponent,
4323
+ GeolocationComponent,
4324
+ LuxTooltipDirective,
4325
+ LuxBreadcrumbComponent,
4326
+ LuxBreadcrumbComponent,
4327
+ MapComponent,
4328
+ SelectComponent,
4329
+ PaginationComponent,
4330
+ RadiogroupComponent,
4331
+ VoiceRecognitionDirective
4332
+ ]
4333
+ }]
4334
+ }] });
4335
+
4336
+ /*
4337
+ * Public API Surface of lux
4338
+ */
4339
+
4340
+ /**
4341
+ * Generated bundle index. Do not edit.
4342
+ */
4343
+
4344
+ export { AutocompleteComponent, AutocompleteListComponent, CheckboxComponent, DatetimeComponent, FilterComponent, GeolocationComponent, InputComponent, LuxBreadcrumbComponent, LuxModule, LuxTooltipDirective, MapComponent, ModalRef, ModalService, PaginationComponent, RadiogroupComponent, SelectComponent, VoiceRecognitionDirective };
4345
+ //# sourceMappingURL=metadev-lux.mjs.map