i-tech-shared-components 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/autocomplete-select/autocomplete-select.component.mjs +392 -0
- package/esm2022/lib/components/button/button.component.mjs +2 -2
- package/esm2022/lib/components/clear-value/clear-value.component.mjs +34 -0
- package/esm2022/lib/interfaces/autocomplete-configs.interface.mjs +2 -0
- package/esm2022/lib/interfaces/button-types.enum.mjs +9 -0
- package/esm2022/lib/pipes/array-to-string.pipe.mjs +17 -0
- package/esm2022/lib/pipes/get-value-by-key-from-object.pipe.mjs +45 -0
- package/esm2022/public-api.mjs +6 -1
- package/fesm2022/i-tech-shared-components.mjs +475 -12
- package/fesm2022/i-tech-shared-components.mjs.map +1 -1
- package/lib/components/autocomplete-select/autocomplete-select.component.d.ts +67 -0
- package/lib/components/button/button.component.d.ts +1 -1
- package/lib/components/clear-value/clear-value.component.d.ts +9 -0
- package/lib/interfaces/autocomplete-configs.interface.d.ts +37 -0
- package/lib/pipes/array-to-string.pipe.d.ts +7 -0
- package/lib/pipes/get-value-by-key-from-object.pipe.d.ts +7 -0
- package/package.json +1 -1
- package/public-api.d.ts +5 -0
- package/esm2022/lib/interfaces/button-types.constants.mjs +0 -9
- /package/lib/interfaces/{button-types.constants.d.ts → button-types.enum.d.ts} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, inject, Injectable, Directive, Input, HostListener, EventEmitter, Component, Output } from '@angular/core';
|
|
2
|
+
import { Pipe, inject, Injectable, Directive, Input, HostListener, EventEmitter, Component, Output, ViewChild } from '@angular/core';
|
|
3
3
|
import * as i1 from '@ngx-translate/core';
|
|
4
4
|
import { TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
5
5
|
import * as i3 from '@angular/forms';
|
|
6
6
|
import { NgControl, FormControlName, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import { MatIconButton, MatFabButton, MatButton } from '@angular/material/button';
|
|
8
|
-
import { NgClass, NgIf } from '@angular/common';
|
|
8
|
+
import { NgClass, NgIf, NgOptimizedImage } from '@angular/common';
|
|
9
9
|
import { MatTooltip } from '@angular/material/tooltip';
|
|
10
10
|
import * as i1$1 from '@angular/material/icon';
|
|
11
11
|
import { MatIcon, MatIconModule } from '@angular/material/icon';
|
|
@@ -13,6 +13,7 @@ import { MatLabel, MatFormField, MatError, MatHint } from '@angular/material/for
|
|
|
13
13
|
import { MatInput } from '@angular/material/input';
|
|
14
14
|
import { NgxMaskDirective, NgxMaskPipe } from 'ngx-mask';
|
|
15
15
|
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|
16
|
+
import { MatLabel as MatLabel$1, MatPrefix, MatFormField as MatFormField$1, MatSelect, MatOption } from '@angular/material/select';
|
|
16
17
|
|
|
17
18
|
class GenerateErrorMessagesPipe {
|
|
18
19
|
constructor(translateService) {
|
|
@@ -42,6 +43,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
42
43
|
}]
|
|
43
44
|
}], ctorParameters: () => [{ type: i1.TranslateService }] });
|
|
44
45
|
|
|
46
|
+
class ArrayToStringPipe {
|
|
47
|
+
transform(value) {
|
|
48
|
+
return (typeof value === 'string') ? value : value.join(',');
|
|
49
|
+
}
|
|
50
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ArrayToStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
51
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: ArrayToStringPipe, isStandalone: true, name: "arrayToString" }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ArrayToStringPipe, decorators: [{
|
|
54
|
+
type: Pipe,
|
|
55
|
+
args: [{
|
|
56
|
+
name: 'arrayToString',
|
|
57
|
+
standalone: true
|
|
58
|
+
}]
|
|
59
|
+
}] });
|
|
60
|
+
|
|
61
|
+
class GetValueByKeyFromObjectPipe {
|
|
62
|
+
transform(keys, data, withParams = null, withParamSymbol) {
|
|
63
|
+
if (typeof keys === 'string') {
|
|
64
|
+
return data[keys];
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
let returnValue = data;
|
|
68
|
+
keys.forEach((key) => {
|
|
69
|
+
if (!returnValue) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
returnValue = returnValue[key];
|
|
73
|
+
});
|
|
74
|
+
if (withParams) {
|
|
75
|
+
withParams.forEach((param) => {
|
|
76
|
+
let include = data;
|
|
77
|
+
if (typeof param === 'object') {
|
|
78
|
+
param.forEach((key) => {
|
|
79
|
+
include = (include) ? include[key] : null;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
include = include[param];
|
|
84
|
+
}
|
|
85
|
+
if (include !== undefined && include !== null) {
|
|
86
|
+
returnValue += (withParamSymbol ? withParamSymbol : ' ') + include;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return ((returnValue !== "undefined") && (returnValue !== null)) ? returnValue : '---';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GetValueByKeyFromObjectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
94
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: GetValueByKeyFromObjectPipe, isStandalone: true, name: "getValueByKeyFromObject" }); }
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GetValueByKeyFromObjectPipe, decorators: [{
|
|
97
|
+
type: Pipe,
|
|
98
|
+
args: [{
|
|
99
|
+
name: 'getValueByKeyFromObject',
|
|
100
|
+
standalone: true
|
|
101
|
+
}]
|
|
102
|
+
}] });
|
|
103
|
+
|
|
45
104
|
class NoopValueAccessor {
|
|
46
105
|
writeValue() { }
|
|
47
106
|
registerOnChange() { }
|
|
@@ -68,6 +127,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
68
127
|
}]
|
|
69
128
|
}] });
|
|
70
129
|
|
|
130
|
+
var ButtonType;
|
|
131
|
+
(function (ButtonType) {
|
|
132
|
+
ButtonType["FILLED"] = "FILLED";
|
|
133
|
+
ButtonType["TONAL"] = "TONAL";
|
|
134
|
+
ButtonType["OUTLINE"] = "OUTLINE";
|
|
135
|
+
ButtonType["TEXT"] = "TEXT";
|
|
136
|
+
ButtonType["WARNING"] = "WARNING";
|
|
137
|
+
})(ButtonType || (ButtonType = {}));
|
|
138
|
+
|
|
71
139
|
class InputMaskDirective {
|
|
72
140
|
set min(value) {
|
|
73
141
|
this.minimumValue = Number(value);
|
|
@@ -258,15 +326,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
258
326
|
type: Output
|
|
259
327
|
}] } });
|
|
260
328
|
|
|
261
|
-
var ButtonType;
|
|
262
|
-
(function (ButtonType) {
|
|
263
|
-
ButtonType["FILLED"] = "FILLED";
|
|
264
|
-
ButtonType["TONAL"] = "TONAL";
|
|
265
|
-
ButtonType["OUTLINE"] = "OUTLINE";
|
|
266
|
-
ButtonType["TEXT"] = "TEXT";
|
|
267
|
-
ButtonType["WARNING"] = "WARNING";
|
|
268
|
-
})(ButtonType || (ButtonType = {}));
|
|
269
|
-
|
|
270
329
|
class ButtonComponent {
|
|
271
330
|
constructor() {
|
|
272
331
|
this.text = '';
|
|
@@ -333,6 +392,410 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
333
392
|
type: Output
|
|
334
393
|
}] } });
|
|
335
394
|
|
|
395
|
+
class ClearValueComponent {
|
|
396
|
+
constructor() {
|
|
397
|
+
this.reset = new EventEmitter();
|
|
398
|
+
}
|
|
399
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ClearValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
400
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ClearValueComponent, isStandalone: true, selector: "i-tech-clear-value", inputs: { className: "className", additionalClass: "additionalClass" }, outputs: { reset: "reset" }, ngImport: i0, template: `<img
|
|
401
|
+
class="pointer"
|
|
402
|
+
[ngClass]="className || 'standard'"
|
|
403
|
+
(click)="reset.emit()"
|
|
404
|
+
ngSrc="./ic_close.svg"
|
|
405
|
+
height="24" width="24" alt=""/>`, isInline: true, styles: ["img{position:absolute;width:15px;height:15px}.big{width:25px;height:25px}.range_date{right:-65px;top:15px}.standard{right:-20px;top:40px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }] }); }
|
|
406
|
+
}
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ClearValueComponent, decorators: [{
|
|
408
|
+
type: Component,
|
|
409
|
+
args: [{ selector: 'i-tech-clear-value', template: `<img
|
|
410
|
+
class="pointer"
|
|
411
|
+
[ngClass]="className || 'standard'"
|
|
412
|
+
(click)="reset.emit()"
|
|
413
|
+
ngSrc="./ic_close.svg"
|
|
414
|
+
height="24" width="24" alt=""/>`, imports: [
|
|
415
|
+
NgClass,
|
|
416
|
+
NgOptimizedImage
|
|
417
|
+
], standalone: true, styles: ["img{position:absolute;width:15px;height:15px}.big{width:25px;height:25px}.range_date{right:-65px;top:15px}.standard{right:-20px;top:40px}\n"] }]
|
|
418
|
+
}], propDecorators: { className: [{
|
|
419
|
+
type: Input
|
|
420
|
+
}], additionalClass: [{
|
|
421
|
+
type: Input
|
|
422
|
+
}], reset: [{
|
|
423
|
+
type: Output
|
|
424
|
+
}] } });
|
|
425
|
+
|
|
426
|
+
class AutocompleteSelectComponent {
|
|
427
|
+
set configs(data) {
|
|
428
|
+
this.selectConfig = data;
|
|
429
|
+
if (!data) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if ((typeof this.selectConfig.paginate) === 'function') {
|
|
433
|
+
if (this.firstRequest) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
this.getData();
|
|
437
|
+
this.firstRequest = true;
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
this.data = this.selectConfig.paginate;
|
|
441
|
+
this.findAndSetDefaultValueFromData();
|
|
442
|
+
}
|
|
443
|
+
;
|
|
444
|
+
handleVisibilityChange() {
|
|
445
|
+
this.tabVisibility = !document.hidden;
|
|
446
|
+
if (this.ngControl.control.value) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
this.closePanelAndUnsetFocus();
|
|
450
|
+
if (!document.hidden) {
|
|
451
|
+
this.isNeededForRecall = true;
|
|
452
|
+
this.pending = true;
|
|
453
|
+
setTimeout(() => {
|
|
454
|
+
this.pending = false;
|
|
455
|
+
}, 4000);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
constructor(inputService) {
|
|
459
|
+
this.inputService = inputService;
|
|
460
|
+
this.selectionChange = new EventEmitter();
|
|
461
|
+
this.emitAction = new EventEmitter();
|
|
462
|
+
this.pending = false;
|
|
463
|
+
this.data = [];
|
|
464
|
+
this.paginationData = { current: 1, last: 0 };
|
|
465
|
+
this.firstRequest = false;
|
|
466
|
+
this.showPlaceholder = true;
|
|
467
|
+
this.isNeededForRecall = false;
|
|
468
|
+
this.accessToNextRequest = true;
|
|
469
|
+
this.disabled = false;
|
|
470
|
+
this.blockRecallDefaultValueSetter = false;
|
|
471
|
+
this.requestLoading = false;
|
|
472
|
+
this.ButtonType = ButtonType;
|
|
473
|
+
this.customErrorStateMatcher = {
|
|
474
|
+
isErrorState: (control, form) => {
|
|
475
|
+
return !!(control && control.invalid && this.submitValue);
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
this.ngControl = this.inputService.injectNgControl();
|
|
479
|
+
}
|
|
480
|
+
ngOnChanges(changes) {
|
|
481
|
+
if (changes['selectConfig'] && this.selectConfig) {
|
|
482
|
+
if ((typeof this.selectConfig.paginate) === 'function') {
|
|
483
|
+
this.getData();
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
ngAfterViewInit() {
|
|
488
|
+
this.ngControl.control.valueChanges.subscribe((res) => {
|
|
489
|
+
if (this.data.length && res && !this.blockRecallDefaultValueSetter) {
|
|
490
|
+
this.findAndSetDefaultValueFromData();
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
hardReload() {
|
|
495
|
+
this.getData('', true);
|
|
496
|
+
}
|
|
497
|
+
getData(searchText, fromSearch) {
|
|
498
|
+
if (!fromSearch && !this.accessToNextRequest) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (this.requestLoading) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
if (fromSearch) {
|
|
505
|
+
this.paginationData.current = 1;
|
|
506
|
+
this.accessToNextRequest = true;
|
|
507
|
+
}
|
|
508
|
+
const functionToDo = this.selectConfig.paginate(this.paginationData.current, searchText);
|
|
509
|
+
this.requestLoading = true;
|
|
510
|
+
functionToDo?.subscribe((data) => {
|
|
511
|
+
const dataToAdd = ('content' in data) ? data.content : data;
|
|
512
|
+
if ('content' in data) {
|
|
513
|
+
this.accessToNextRequest = !data.last || (data.totalPages > this.paginationData.current);
|
|
514
|
+
}
|
|
515
|
+
this.data = (fromSearch || this.selectConfig?.blockPagination) ? dataToAdd : [...this.data, ...dataToAdd];
|
|
516
|
+
this.pending = false;
|
|
517
|
+
this.requestLoading = false;
|
|
518
|
+
if (!dataToAdd.length) {
|
|
519
|
+
this.paginationData.last = this.paginationData.current;
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
this.paginationData.current += 1;
|
|
523
|
+
this.paginationData.last += 1;
|
|
524
|
+
setTimeout(() => {
|
|
525
|
+
this.findAndSetDefaultValueFromData();
|
|
526
|
+
}, 10);
|
|
527
|
+
}, () => {
|
|
528
|
+
this.pending = false;
|
|
529
|
+
this.requestLoading = false;
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
findAndSetDefaultValueFromData() {
|
|
533
|
+
if (this.selectConfig.multiple) {
|
|
534
|
+
if (this.ngControl.value && this.ngControl.value.length == 1) {
|
|
535
|
+
this.setShowingValue(this.data.find((item) => item.id === this.ngControl.value[0]));
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
const isDisabled = this.ngControl.disabled;
|
|
540
|
+
if (isDisabled) {
|
|
541
|
+
// TODO Remove after migrating all selects
|
|
542
|
+
// this.ngControl.control.enable();
|
|
543
|
+
// if (!this.ngControl.value && !this.data.length) {
|
|
544
|
+
// this.ngControl.control.disable();
|
|
545
|
+
// return;
|
|
546
|
+
// }
|
|
547
|
+
// this.setDefaultValue();
|
|
548
|
+
// this.ngControl.control.disable();
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
if (!this.ngControl.value && !this.data) {
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
this.setDefaultValue();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
setDefaultValue() {
|
|
559
|
+
this.defaultValue = this.data.find((item) => item.id === this.ngControl.value);
|
|
560
|
+
this.baseData = this.defaultValue;
|
|
561
|
+
if (!this.defaultValue) {
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
this.selectionChange.emit();
|
|
565
|
+
this.setShowingValue(this.defaultValue);
|
|
566
|
+
}
|
|
567
|
+
optionClick(showingData) {
|
|
568
|
+
this.baseData = showingData;
|
|
569
|
+
if (!this.selectConfig.multiple) {
|
|
570
|
+
this.setShowingValue(showingData);
|
|
571
|
+
this.matSelect.close();
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (this.searchInput) {
|
|
575
|
+
if (this.selectConfig.multiple) {
|
|
576
|
+
this.searchInput?.nativeElement?.focus();
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
this.inputFocusOut();
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
this.setShowingValue(showingData);
|
|
583
|
+
this.showPlaceholder = false;
|
|
584
|
+
}
|
|
585
|
+
addNewItemEvent() {
|
|
586
|
+
this.isNeededForRecall = true;
|
|
587
|
+
this.emitAction.emit();
|
|
588
|
+
}
|
|
589
|
+
setShowingValue(data) {
|
|
590
|
+
if (!data) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
// TODO refactor this part fully
|
|
594
|
+
let include = data;
|
|
595
|
+
let includeOptional = data;
|
|
596
|
+
if (this.selectConfig.valueToShowByKey) {
|
|
597
|
+
this.selectConfig.valueToShowByKey.forEach((param) => {
|
|
598
|
+
if (typeof param === 'object') {
|
|
599
|
+
param.forEach((key) => {
|
|
600
|
+
include = (include) ? include[key] : null;
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
include = include[param];
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
if (this.selectConfig.showFullTextWithOptionalOnSelectedValue) {
|
|
608
|
+
this.selectConfig.valueToShowByParam?.forEach((param) => {
|
|
609
|
+
if (typeof param === 'object') {
|
|
610
|
+
param.forEach((key) => {
|
|
611
|
+
includeOptional = (includeOptional) ? includeOptional[key] : null;
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
includeOptional = includeOptional[param];
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
if (this.selectConfig.valueToShowByParam && typeof includeOptional === 'string') {
|
|
619
|
+
include += (this.selectConfig.withParamSymbol || '') + includeOptional;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
this.showingValue = include;
|
|
624
|
+
this.blockRecallDefaultValueSetter = true;
|
|
625
|
+
}
|
|
626
|
+
preventDefault(event) {
|
|
627
|
+
if (!this.selectConfig.multiple) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
event.preventDefault();
|
|
631
|
+
}
|
|
632
|
+
registerPanelScrollEvent(element) {
|
|
633
|
+
if (this.selectConfig.paginateOnScroll === false) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const panel = element.panel.nativeElement;
|
|
637
|
+
panel.addEventListener('scroll', (event) => this.loadDataOnScroll(event));
|
|
638
|
+
}
|
|
639
|
+
loadDataOnScroll(event) {
|
|
640
|
+
const pos = (event.target.scrollTop || event.target.scrollTop) + event.target.offsetHeight;
|
|
641
|
+
const max = event.target.scrollHeight;
|
|
642
|
+
if ((pos + 1) >= max) {
|
|
643
|
+
if (this.paginationData.current === this.paginationData.last || this.selectConfig.blockPagination) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
this.getData();
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
focusSearchInput() {
|
|
650
|
+
if (this.selectConfig.search && this.searchInput) {
|
|
651
|
+
this.searchInput.nativeElement.focus();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
inputFocusOut() {
|
|
655
|
+
this.isNeededForRecall = !!this.searchInput.nativeElement.value;
|
|
656
|
+
this.searchInput.nativeElement.value = '';
|
|
657
|
+
this.showPlaceholder = true;
|
|
658
|
+
this.clearTimeoutForSearch();
|
|
659
|
+
}
|
|
660
|
+
resetValue() {
|
|
661
|
+
this.selectionChange.emit(null);
|
|
662
|
+
this.ngControl.reset(null);
|
|
663
|
+
this.inputFocusOut();
|
|
664
|
+
}
|
|
665
|
+
getDataWithSearch(value, event) {
|
|
666
|
+
this.clearTimeoutForSearch();
|
|
667
|
+
if (value.length >= 1) {
|
|
668
|
+
this.searchTimeoutId = setTimeout(() => {
|
|
669
|
+
this.getData(value, true);
|
|
670
|
+
}, 800);
|
|
671
|
+
}
|
|
672
|
+
else if (value.length <= 1 && event.keyCode === 8) {
|
|
673
|
+
this.getData(value, true);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
clearTimeoutForSearch() {
|
|
677
|
+
if (this.searchTimeoutId) {
|
|
678
|
+
clearTimeout(this.searchTimeoutId);
|
|
679
|
+
this.searchTimeoutId = 0;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
openSelection() {
|
|
683
|
+
if (this.selectConfig.disabled || this.ngControl.control.disabled) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
this.showPlaceholder ? this.matSelect.open() : this.closePanelAndUnsetFocus();
|
|
687
|
+
this.showPlaceholder = !this.showPlaceholder;
|
|
688
|
+
if (!this.showPlaceholder) {
|
|
689
|
+
this.reCallData();
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
closePanelAndUnsetFocus() {
|
|
693
|
+
this.matSelect.close();
|
|
694
|
+
if (this.searchInput) {
|
|
695
|
+
this.searchInput.nativeElement.blur();
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
openedChange(event) {
|
|
699
|
+
if (event) {
|
|
700
|
+
if (this.isNeededForRecall) {
|
|
701
|
+
this.reCallData();
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
if (!this.selectConfig.search) {
|
|
705
|
+
this.pending = false;
|
|
706
|
+
this.reCallData();
|
|
707
|
+
}
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
this.showPlaceholder = true;
|
|
711
|
+
}
|
|
712
|
+
reCallData() {
|
|
713
|
+
// TODO refactor this part
|
|
714
|
+
if (!this.isNeededForRecall) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
this.data = [];
|
|
718
|
+
this.pending = true;
|
|
719
|
+
this.paginationData = {
|
|
720
|
+
current: 1,
|
|
721
|
+
last: 0
|
|
722
|
+
};
|
|
723
|
+
this.accessToNextRequest = true;
|
|
724
|
+
if ((typeof this.selectConfig.paginate) === 'function') {
|
|
725
|
+
this.getData();
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
this.pending = false;
|
|
729
|
+
this.data = this.selectConfig.paginate;
|
|
730
|
+
}
|
|
731
|
+
this.isNeededForRecall = false;
|
|
732
|
+
}
|
|
733
|
+
emitSelectionChangeAndClose(event) {
|
|
734
|
+
this.selectionChange.emit(event.value);
|
|
735
|
+
if (this.selectConfig.multiple) {
|
|
736
|
+
if (!event.value?.length) {
|
|
737
|
+
this.ngControl.control.reset();
|
|
738
|
+
}
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
this.matSelect.close();
|
|
742
|
+
}
|
|
743
|
+
iconClick(matSelect, searchInput) {
|
|
744
|
+
matSelect.open();
|
|
745
|
+
searchInput?.nativeElement?.focus();
|
|
746
|
+
}
|
|
747
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AutocompleteSelectComponent, deps: [{ token: InputService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
748
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AutocompleteSelectComponent, isStandalone: true, selector: "i-tech-autocomplete-select", inputs: { className: "className", submitValue: "submitValue", configs: "configs", detectChanges: "detectChanges" }, outputs: { selectionChange: "selectionChange", emitAction: "emitAction" }, host: { listeners: { "document:visibilitychange": "handleVisibilityChange()" } }, viewQueries: [{ propertyName: "matSelect", first: true, predicate: ["matSelect"], descendants: true }, { propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "allSelected", first: true, predicate: ["allSelected"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"new-mat-autocomplete\" id=\"mat_autocomplete\"\r\n [ngClass]=\"{\r\n 'mat-select-without_icon': !selectConfig.iconUrl && !selectConfig.activeStateIconUrl,\r\n 'mat-select-with-search': selectConfig.search,\r\n 'without-label': selectConfig.hideLabel,\r\n 'invalid_field': ngControl.control.errors && submitValue,\r\n 'readonly-field': selectConfig.readOnly || ngControl.control.disabled\r\n }\"\r\n [matTooltip]=\"(selectConfig.hover && !ngControl.control.disabled ? ((selectConfig.hover || '') | translate) : '')\"\r\n [matTooltipClass]=\"'mat-mdc-tooltip big-td-mat-tooltip'\"\r\n [matTooltipPosition]=\"'above'\"\r\n *ngIf=\"selectConfig && ngControl\">\r\n\r\n <div class=\"w-100\" *ngIf=\"!selectConfig.hideLabel\">\r\n <mat-label [ngClass]=\"{'readonly-color' : selectConfig.readOnly || ngControl.control.disabled}\">\r\n {{ selectConfig.label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"selectConfig.required\" class=\"required-input\" [ngClass]=\"{'readonly-color' : ngControl.control.disabled}\">*</span>\r\n </div>\r\n\r\n\r\n <!-- Search Input -->\r\n <div class=\"search-input w-100\"\r\n (click)=\"$event.stopPropagation();$event.preventDefault()\"\r\n [ngClass]=\"{ hide_input_placeholder: showPlaceholder || ngControl.control.disabled }\"\r\n *ngIf=\"selectConfig.search\"\r\n >\r\n <input autocomplete=\"off\"\r\n id=\"searchInput\"\r\n type=\"text\"\r\n [ngClass]=\"{'pr-25': !selectConfig.iconUrl}\"\r\n #searchInput\r\n [disabled]=\"ngControl.control.disabled || selectConfig.hover\"\r\n [placeholder]=\"(ngControl.control.disabled || selectConfig.hover) ? '' : 'Search'\"\r\n (focusout)=\"inputFocusOut()\"\r\n (focus)=\"openSelection()\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (keyup)=\"getDataWithSearch(searchInput.value,$event)\">\r\n\r\n <!-- Search Icon -->\r\n <span class=\"search-icon\">\r\n <i-tech-icon-button\r\n class=\"mr-10\"\r\n [ngClass]=\"selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n *ngIf=\"selectConfig.iconPrefix && !showPlaceholder\"\r\n [iconName]=\"selectConfig.iconPrefix || ''\"\r\n [disabled]=\"selectConfig.readOnly || false\"\r\n matPrefix\r\n >\r\n </i-tech-icon-button>\r\n </span>\r\n </div>\r\n\r\n <!-- Placeholder/Selected Value Display -->\r\n <ng-container *ngIf=\"showPlaceholder && selectConfig.search\">\r\n <div class=\"custom-placeholder\"\r\n *ngIf=\"(!ngControl?.value && !ngControl?.value?.length) ||\r\n (selectConfig.multiple && ngControl?.value && !ngControl?.value?.length)\"\r\n [ngClass]=\"selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n >\r\n {{ ((selectConfig.placeholder || '') | translate) }}\r\n </div>\r\n <div class=\"custom-placeholder custom-value ellipsis\"\r\n [ngClass]=\"{\r\n 'pr-42': selectConfig.iconUrl,\r\n 'readonly-color': selectConfig.readOnly || ngControl.control.disabled,\r\n 'default-form-icon-color': !(selectConfig.readOnly || ngControl.control.disabled)\r\n }\"\r\n *ngIf=\"ngControl?.value\"\r\n >\r\n {{ selectConfig?.multiple ? (ngControl.value | arrayToString) : showingValue }}\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Custom Icon -->\r\n <img class=\"left_icon_new pointer\"\r\n (click)=\"iconClick(matSelect, searchInput)\"\r\n *ngIf=\"!selectConfig.matIconName && (selectConfig.iconUrl || selectConfig.activeStateIconUrl)\"\r\n [src]=\"'assets/images/icons/global/' + (ngControl.control?.value && selectConfig?.activeStateIconUrl ? selectConfig.activeStateIconUrl : selectConfig.iconUrl)\">\r\n\r\n <mat-form-field appearance=\"outline\" class=\"w-100\" (click)=\"selectConfig?.search ? focusSearchInput() : null\">\r\n <!-- Material Select -->\r\n <mat-select #matSelect=\"matSelect\"\r\n [panelClass]=\"'autocomplete-transform-panel-location'\"\r\n [attr.aria-placeholder]=\"(selectConfig.placeholder || '') | translate\"\r\n [aria-label]=\"selectConfig.label | translate\"\r\n [id]=\"selectConfig.filtrationKey || ''\"\r\n (opened)=\"registerPanelScrollEvent(matSelect)\"\r\n (openedChange)=\"openedChange($event)\"\r\n [formControl]=\"ngControl.control\"\r\n [multiple]=\"selectConfig.multiple\"\r\n (selectionChange)=\"emitSelectionChangeAndClose($event)\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n [placeholder]=\"(selectConfig.placeholder || '') | translate\"\r\n [disabled]=\"ngControl.control.disabled\"\r\n >\r\n\r\n <!-- Loading State -->\r\n <mat-option *ngIf=\"pending\" class=\"option_loading relative\">\r\n <div class=\"request_loading\">\r\n <img ngSrc=\"./loader.svg\" alt=\"\" height=\"200\" width=\"200\"/>\r\n </div>\r\n </mat-option>\r\n\r\n <!-- Options -->\r\n <ng-container *ngIf=\"data?.length && !pending\">\r\n <!-- Add New Option -->\r\n <mat-option *ngIf=\"selectConfig.actions\"\r\n class=\"pointer add_new\"\r\n disabled\r\n (click)=\"closePanelAndUnsetFocus();addNewItemEvent()\">\r\n<!-- (click)=\"ngControl.control.reset(null);matSelect._onBlur();closePanelAndUnsetFocus();addNewItemEvent()\">-->\r\n <i-tech-button\r\n [type]=\"ButtonType.OUTLINE\"\r\n [fontIcon]=\"'add'\"\r\n [text]=\"('dropdown_add_item' | translate : {INPUT_NAME: (selectConfig.label | translate)}) \"\r\n [customClass]=\"'w-100 mat-autocomplete-select-button'\">\r\n </i-tech-button>\r\n </mat-option>\r\n\r\n <!-- Regular Options -->\r\n <ng-container *ngIf=\"!selectConfig?.changeText && data.length\">\r\n <mat-option *ngFor=\"let item of data\"\r\n [value]=\"selectConfig.valueByKey | getValueByKeyFromObject : item\"\r\n (mouseup)=\"optionClick(item)\"\r\n (mousedown)=\"preventDefault($event)\">\r\n {{ ((selectConfig.valueToShowByKey | getValueByKeyFromObject : item : selectConfig.valueToShowByParam : selectConfig.withParamSymbol) || '') | translate }}\r\n </mat-option>\r\n </ng-container>\r\n\r\n <!-- Custom Text Options -->\r\n <ng-container *ngIf=\"selectConfig?.changeText && data.length\">\r\n <mat-option *ngFor=\"let item of data\"\r\n [value]=\"selectConfig.valueByKey | getValueByKeyFromObject : item\"\r\n (mouseup)=\"optionClick(item)\"\r\n (mousedown)=\"preventDefault($event)\"\r\n [disabled]=\"selectConfig?.changeText[item].disabled\">\r\n {{ selectConfig?.changeText[item].text | translate }}\r\n </mat-option>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- Empty State -->\r\n <ng-container *ngIf=\"!pending && !data.length\">\r\n <mat-option disabled class=\"empty_selection_state\">\r\n <div class=\"actions_and_tile add_new flex_column w-100 flex_center_align_center\">\r\n <span>{{ 'dropdown_no_items' | translate }}</span>\r\n <div class=\"mt-10\">\r\n <i-tech-button\r\n *ngIf=\"selectConfig?.actions\"\r\n [type]=\"ButtonType.OUTLINE\"\r\n (buttonClick)=\"closePanelAndUnsetFocus();addNewItemEvent()\"\r\n [customClass]=\"'mat-autocomplete-select-button'\"\r\n [fontIcon]=\"'add'\"\r\n [text]=\"('dropdown_add_item' | translate : {INPUT_NAME: (selectConfig.label | translate)}) \">\r\n </i-tech-button>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon *ngIf=\"selectConfig.iconPrefix\"\r\n matPrefix\r\n [ngClass]=\"{\r\n 'readonly-color' : !selectConfig['iconPrefixColor'] && (selectConfig.readOnly || ngControl.control.disabled),\r\n 'default-form-icon-color' : !selectConfig['iconPrefixColor'] && !(selectConfig.readOnly || ngControl.control.disabled)\r\n }\"\r\n [matTooltip]=\"((selectConfig?.['iconPrefixTooltip'] || '') | translate)\"\r\n >{{ selectConfig.iconPrefix }}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"selectConfig['iconPrefixSvg']\"\r\n matPrefix\r\n [matTooltip]=\"((selectConfig?.['iconPrefixTooltip'] || '') | translate)\"\r\n [svgIcon]=\"selectConfig['iconPrefixSvg'] || ''\"\r\n ></mat-icon>\r\n\r\n <i-tech-icon-button\r\n *ngIf=\"selectConfig.search && selectConfig.clearable && !ngControl.control.disabled && !!ngControl.control.value\"\r\n iconName=\"cancel\"\r\n matSuffix\r\n [disabled]=\"selectConfig.readOnly || false\"\r\n [ngClass]=\"selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n (click)=\"$event.stopPropagation();$event.preventDefault();ngControl.control.reset(null);matSelect._onBlur();closePanelAndUnsetFocus()\"\r\n >\r\n </i-tech-icon-button>\r\n <mat-icon\r\n matSuffix\r\n class=\"select-arrow\"\r\n [class.open]=\"matSelect.panelOpen\"\r\n [ngClass]=\"{\r\n 'readonly-color': selectConfig.readOnly || ngControl.control.disabled,\r\n 'default-form-icon-color': !(selectConfig.readOnly || ngControl.control.disabled),\r\n 'mt-8': !!ngControl.control.value && selectConfig.clearable\r\n }\"\r\n >\r\n keyboard_arrow_down\r\n </mat-icon>\r\n <!-- Error Message -->\r\n <mat-error *ngIf=\"!!(ngControl.control.errors && submitValue)\">\r\n {{ ngControl.control | generateErrorMessages : selectConfig.label : selectConfig.defaultPatternKey}}\r\n </mat-error>\r\n </mat-form-field>\r\n\r\n <!-- Reset Button -->\r\n <i-tech-clear-value *ngIf=\"selectConfig.reset\" (reset)=\"resetValue()\"></i-tech-clear-value>\r\n</div>\r\n", styles: [".left_icon_new{position:absolute;right:2px;top:1px}::ng-deep .request_loading{width:40px;height:40px;background-color:#fff!important}::ng-deep .request_loading:hover{background-color:var(--primary99)!important}::ng-deep .request_loading:focus{background-color:var(--primary99)!important}::ng-deep .request_loading img{position:absolute;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%)}::ng-deep .mat-mdc-option.add_new{opacity:1!important;pointer-events:auto!important}::ng-deep .mat-mdc-option.add_new .mat-pseudo-checkbox{display:none!important}::ng-deep .mat-mdc-option.add_new .mdc-list-item__primary-text{display:inline-block!important;width:100%!important}::ng-deep .mat-mdc-option.add_new span{color:unset!important;font-size:unset!important;margin:unset!important;opacity:1!important}@media (min-width: 1920px) and (max-width: 2500px){.mat-autocomplete{height:90px!important}}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "directive", type: MatLabel$1, selector: "mat-label" }, { kind: "component", type: IconButtonComponent, selector: "i-tech-icon-button", inputs: ["size", "type", "iconSvg", "iconName", "tooltip", "disabled"], outputs: ["buttonClick"] }, { kind: "directive", type: MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "component", type: MatFormField$1, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: ButtonComponent, selector: "i-tech-button", inputs: ["text", "data_cy", "fontIcon", "svgIcon", "type", "customClass", "submit", "disabled", "activated", "color"], outputs: ["buttonClick"] }, { kind: "pipe", type: GetValueByKeyFromObjectPipe, name: "getValueByKeyFromObject" }, { kind: "pipe", type: ArrayToStringPipe, name: "arrayToString" }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "pipe", type: GenerateErrorMessagesPipe, name: "generateErrorMessages" }, { kind: "component", type: ClearValueComponent, selector: "i-tech-clear-value", inputs: ["className", "additionalClass"], outputs: ["reset"] }] }); }
|
|
749
|
+
}
|
|
750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AutocompleteSelectComponent, decorators: [{
|
|
751
|
+
type: Component,
|
|
752
|
+
args: [{ selector: 'i-tech-autocomplete-select', imports: [
|
|
753
|
+
NgClass,
|
|
754
|
+
MatTooltip,
|
|
755
|
+
NgIf,
|
|
756
|
+
TranslateModule,
|
|
757
|
+
MatLabel$1,
|
|
758
|
+
IconButtonComponent,
|
|
759
|
+
MatPrefix,
|
|
760
|
+
MatFormField$1,
|
|
761
|
+
MatSelect,
|
|
762
|
+
ReactiveFormsModule,
|
|
763
|
+
MatOption,
|
|
764
|
+
MatError,
|
|
765
|
+
ButtonComponent,
|
|
766
|
+
GetValueByKeyFromObjectPipe,
|
|
767
|
+
ArrayToStringPipe,
|
|
768
|
+
NgOptimizedImage,
|
|
769
|
+
MatIcon,
|
|
770
|
+
GenerateErrorMessagesPipe,
|
|
771
|
+
ClearValueComponent
|
|
772
|
+
], standalone: true, template: "<div class=\"new-mat-autocomplete\" id=\"mat_autocomplete\"\r\n [ngClass]=\"{\r\n 'mat-select-without_icon': !selectConfig.iconUrl && !selectConfig.activeStateIconUrl,\r\n 'mat-select-with-search': selectConfig.search,\r\n 'without-label': selectConfig.hideLabel,\r\n 'invalid_field': ngControl.control.errors && submitValue,\r\n 'readonly-field': selectConfig.readOnly || ngControl.control.disabled\r\n }\"\r\n [matTooltip]=\"(selectConfig.hover && !ngControl.control.disabled ? ((selectConfig.hover || '') | translate) : '')\"\r\n [matTooltipClass]=\"'mat-mdc-tooltip big-td-mat-tooltip'\"\r\n [matTooltipPosition]=\"'above'\"\r\n *ngIf=\"selectConfig && ngControl\">\r\n\r\n <div class=\"w-100\" *ngIf=\"!selectConfig.hideLabel\">\r\n <mat-label [ngClass]=\"{'readonly-color' : selectConfig.readOnly || ngControl.control.disabled}\">\r\n {{ selectConfig.label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"selectConfig.required\" class=\"required-input\" [ngClass]=\"{'readonly-color' : ngControl.control.disabled}\">*</span>\r\n </div>\r\n\r\n\r\n <!-- Search Input -->\r\n <div class=\"search-input w-100\"\r\n (click)=\"$event.stopPropagation();$event.preventDefault()\"\r\n [ngClass]=\"{ hide_input_placeholder: showPlaceholder || ngControl.control.disabled }\"\r\n *ngIf=\"selectConfig.search\"\r\n >\r\n <input autocomplete=\"off\"\r\n id=\"searchInput\"\r\n type=\"text\"\r\n [ngClass]=\"{'pr-25': !selectConfig.iconUrl}\"\r\n #searchInput\r\n [disabled]=\"ngControl.control.disabled || selectConfig.hover\"\r\n [placeholder]=\"(ngControl.control.disabled || selectConfig.hover) ? '' : 'Search'\"\r\n (focusout)=\"inputFocusOut()\"\r\n (focus)=\"openSelection()\"\r\n (keydown)=\"$event.stopPropagation()\"\r\n (keyup)=\"getDataWithSearch(searchInput.value,$event)\">\r\n\r\n <!-- Search Icon -->\r\n <span class=\"search-icon\">\r\n <i-tech-icon-button\r\n class=\"mr-10\"\r\n [ngClass]=\"selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n *ngIf=\"selectConfig.iconPrefix && !showPlaceholder\"\r\n [iconName]=\"selectConfig.iconPrefix || ''\"\r\n [disabled]=\"selectConfig.readOnly || false\"\r\n matPrefix\r\n >\r\n </i-tech-icon-button>\r\n </span>\r\n </div>\r\n\r\n <!-- Placeholder/Selected Value Display -->\r\n <ng-container *ngIf=\"showPlaceholder && selectConfig.search\">\r\n <div class=\"custom-placeholder\"\r\n *ngIf=\"(!ngControl?.value && !ngControl?.value?.length) ||\r\n (selectConfig.multiple && ngControl?.value && !ngControl?.value?.length)\"\r\n [ngClass]=\"selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n >\r\n {{ ((selectConfig.placeholder || '') | translate) }}\r\n </div>\r\n <div class=\"custom-placeholder custom-value ellipsis\"\r\n [ngClass]=\"{\r\n 'pr-42': selectConfig.iconUrl,\r\n 'readonly-color': selectConfig.readOnly || ngControl.control.disabled,\r\n 'default-form-icon-color': !(selectConfig.readOnly || ngControl.control.disabled)\r\n }\"\r\n *ngIf=\"ngControl?.value\"\r\n >\r\n {{ selectConfig?.multiple ? (ngControl.value | arrayToString) : showingValue }}\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Custom Icon -->\r\n <img class=\"left_icon_new pointer\"\r\n (click)=\"iconClick(matSelect, searchInput)\"\r\n *ngIf=\"!selectConfig.matIconName && (selectConfig.iconUrl || selectConfig.activeStateIconUrl)\"\r\n [src]=\"'assets/images/icons/global/' + (ngControl.control?.value && selectConfig?.activeStateIconUrl ? selectConfig.activeStateIconUrl : selectConfig.iconUrl)\">\r\n\r\n <mat-form-field appearance=\"outline\" class=\"w-100\" (click)=\"selectConfig?.search ? focusSearchInput() : null\">\r\n <!-- Material Select -->\r\n <mat-select #matSelect=\"matSelect\"\r\n [panelClass]=\"'autocomplete-transform-panel-location'\"\r\n [attr.aria-placeholder]=\"(selectConfig.placeholder || '') | translate\"\r\n [aria-label]=\"selectConfig.label | translate\"\r\n [id]=\"selectConfig.filtrationKey || ''\"\r\n (opened)=\"registerPanelScrollEvent(matSelect)\"\r\n (openedChange)=\"openedChange($event)\"\r\n [formControl]=\"ngControl.control\"\r\n [multiple]=\"selectConfig.multiple\"\r\n (selectionChange)=\"emitSelectionChangeAndClose($event)\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n [placeholder]=\"(selectConfig.placeholder || '') | translate\"\r\n [disabled]=\"ngControl.control.disabled\"\r\n >\r\n\r\n <!-- Loading State -->\r\n <mat-option *ngIf=\"pending\" class=\"option_loading relative\">\r\n <div class=\"request_loading\">\r\n <img ngSrc=\"./loader.svg\" alt=\"\" height=\"200\" width=\"200\"/>\r\n </div>\r\n </mat-option>\r\n\r\n <!-- Options -->\r\n <ng-container *ngIf=\"data?.length && !pending\">\r\n <!-- Add New Option -->\r\n <mat-option *ngIf=\"selectConfig.actions\"\r\n class=\"pointer add_new\"\r\n disabled\r\n (click)=\"closePanelAndUnsetFocus();addNewItemEvent()\">\r\n<!-- (click)=\"ngControl.control.reset(null);matSelect._onBlur();closePanelAndUnsetFocus();addNewItemEvent()\">-->\r\n <i-tech-button\r\n [type]=\"ButtonType.OUTLINE\"\r\n [fontIcon]=\"'add'\"\r\n [text]=\"('dropdown_add_item' | translate : {INPUT_NAME: (selectConfig.label | translate)}) \"\r\n [customClass]=\"'w-100 mat-autocomplete-select-button'\">\r\n </i-tech-button>\r\n </mat-option>\r\n\r\n <!-- Regular Options -->\r\n <ng-container *ngIf=\"!selectConfig?.changeText && data.length\">\r\n <mat-option *ngFor=\"let item of data\"\r\n [value]=\"selectConfig.valueByKey | getValueByKeyFromObject : item\"\r\n (mouseup)=\"optionClick(item)\"\r\n (mousedown)=\"preventDefault($event)\">\r\n {{ ((selectConfig.valueToShowByKey | getValueByKeyFromObject : item : selectConfig.valueToShowByParam : selectConfig.withParamSymbol) || '') | translate }}\r\n </mat-option>\r\n </ng-container>\r\n\r\n <!-- Custom Text Options -->\r\n <ng-container *ngIf=\"selectConfig?.changeText && data.length\">\r\n <mat-option *ngFor=\"let item of data\"\r\n [value]=\"selectConfig.valueByKey | getValueByKeyFromObject : item\"\r\n (mouseup)=\"optionClick(item)\"\r\n (mousedown)=\"preventDefault($event)\"\r\n [disabled]=\"selectConfig?.changeText[item].disabled\">\r\n {{ selectConfig?.changeText[item].text | translate }}\r\n </mat-option>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- Empty State -->\r\n <ng-container *ngIf=\"!pending && !data.length\">\r\n <mat-option disabled class=\"empty_selection_state\">\r\n <div class=\"actions_and_tile add_new flex_column w-100 flex_center_align_center\">\r\n <span>{{ 'dropdown_no_items' | translate }}</span>\r\n <div class=\"mt-10\">\r\n <i-tech-button\r\n *ngIf=\"selectConfig?.actions\"\r\n [type]=\"ButtonType.OUTLINE\"\r\n (buttonClick)=\"closePanelAndUnsetFocus();addNewItemEvent()\"\r\n [customClass]=\"'mat-autocomplete-select-button'\"\r\n [fontIcon]=\"'add'\"\r\n [text]=\"('dropdown_add_item' | translate : {INPUT_NAME: (selectConfig.label | translate)}) \">\r\n </i-tech-button>\r\n </div>\r\n </div>\r\n </mat-option>\r\n </ng-container>\r\n </mat-select>\r\n <mat-icon *ngIf=\"selectConfig.iconPrefix\"\r\n matPrefix\r\n [ngClass]=\"{\r\n 'readonly-color' : !selectConfig['iconPrefixColor'] && (selectConfig.readOnly || ngControl.control.disabled),\r\n 'default-form-icon-color' : !selectConfig['iconPrefixColor'] && !(selectConfig.readOnly || ngControl.control.disabled)\r\n }\"\r\n [matTooltip]=\"((selectConfig?.['iconPrefixTooltip'] || '') | translate)\"\r\n >{{ selectConfig.iconPrefix }}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"selectConfig['iconPrefixSvg']\"\r\n matPrefix\r\n [matTooltip]=\"((selectConfig?.['iconPrefixTooltip'] || '') | translate)\"\r\n [svgIcon]=\"selectConfig['iconPrefixSvg'] || ''\"\r\n ></mat-icon>\r\n\r\n <i-tech-icon-button\r\n *ngIf=\"selectConfig.search && selectConfig.clearable && !ngControl.control.disabled && !!ngControl.control.value\"\r\n iconName=\"cancel\"\r\n matSuffix\r\n [disabled]=\"selectConfig.readOnly || false\"\r\n [ngClass]=\"selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n (click)=\"$event.stopPropagation();$event.preventDefault();ngControl.control.reset(null);matSelect._onBlur();closePanelAndUnsetFocus()\"\r\n >\r\n </i-tech-icon-button>\r\n <mat-icon\r\n matSuffix\r\n class=\"select-arrow\"\r\n [class.open]=\"matSelect.panelOpen\"\r\n [ngClass]=\"{\r\n 'readonly-color': selectConfig.readOnly || ngControl.control.disabled,\r\n 'default-form-icon-color': !(selectConfig.readOnly || ngControl.control.disabled),\r\n 'mt-8': !!ngControl.control.value && selectConfig.clearable\r\n }\"\r\n >\r\n keyboard_arrow_down\r\n </mat-icon>\r\n <!-- Error Message -->\r\n <mat-error *ngIf=\"!!(ngControl.control.errors && submitValue)\">\r\n {{ ngControl.control | generateErrorMessages : selectConfig.label : selectConfig.defaultPatternKey}}\r\n </mat-error>\r\n </mat-form-field>\r\n\r\n <!-- Reset Button -->\r\n <i-tech-clear-value *ngIf=\"selectConfig.reset\" (reset)=\"resetValue()\"></i-tech-clear-value>\r\n</div>\r\n", styles: [".left_icon_new{position:absolute;right:2px;top:1px}::ng-deep .request_loading{width:40px;height:40px;background-color:#fff!important}::ng-deep .request_loading:hover{background-color:var(--primary99)!important}::ng-deep .request_loading:focus{background-color:var(--primary99)!important}::ng-deep .request_loading img{position:absolute;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%)}::ng-deep .mat-mdc-option.add_new{opacity:1!important;pointer-events:auto!important}::ng-deep .mat-mdc-option.add_new .mat-pseudo-checkbox{display:none!important}::ng-deep .mat-mdc-option.add_new .mdc-list-item__primary-text{display:inline-block!important;width:100%!important}::ng-deep .mat-mdc-option.add_new span{color:unset!important;font-size:unset!important;margin:unset!important;opacity:1!important}@media (min-width: 1920px) and (max-width: 2500px){.mat-autocomplete{height:90px!important}}\n"] }]
|
|
773
|
+
}], ctorParameters: () => [{ type: InputService }], propDecorators: { matSelect: [{
|
|
774
|
+
type: ViewChild,
|
|
775
|
+
args: ['matSelect']
|
|
776
|
+
}], searchInput: [{
|
|
777
|
+
type: ViewChild,
|
|
778
|
+
args: ['searchInput']
|
|
779
|
+
}], className: [{
|
|
780
|
+
type: Input
|
|
781
|
+
}], submitValue: [{
|
|
782
|
+
type: Input
|
|
783
|
+
}], configs: [{
|
|
784
|
+
type: Input
|
|
785
|
+
}], detectChanges: [{
|
|
786
|
+
type: Input
|
|
787
|
+
}], selectionChange: [{
|
|
788
|
+
type: Output
|
|
789
|
+
}], emitAction: [{
|
|
790
|
+
type: Output
|
|
791
|
+
}], allSelected: [{
|
|
792
|
+
type: ViewChild,
|
|
793
|
+
args: ['allSelected']
|
|
794
|
+
}], handleVisibilityChange: [{
|
|
795
|
+
type: HostListener,
|
|
796
|
+
args: ['document:visibilitychange']
|
|
797
|
+
}] } });
|
|
798
|
+
|
|
336
799
|
/*
|
|
337
800
|
* Public API Surface of shared-components
|
|
338
801
|
*/
|
|
@@ -341,5 +804,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
341
804
|
* Generated bundle index. Do not edit.
|
|
342
805
|
*/
|
|
343
806
|
|
|
344
|
-
export { ButtonComponent, GenerateErrorMessagesPipe, IconButtonComponent, InputMaskDirective, InputService, TextInputComponent };
|
|
807
|
+
export { ArrayToStringPipe, AutocompleteSelectComponent, ButtonComponent, ButtonType, GenerateErrorMessagesPipe, GetValueByKeyFromObjectPipe, IconButtonComponent, InputMaskDirective, InputService, TextInputComponent };
|
|
345
808
|
//# sourceMappingURL=i-tech-shared-components.mjs.map
|