i-tech-shared-components 1.1.6 → 1.1.8
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/.npmignore +2 -0
- package/esm2022/i-tech-shared-components.mjs +5 -0
- package/esm2022/lib/components/autocomplete-select/autocomplete-select.component.mjs +409 -0
- package/esm2022/lib/components/button/button.component.mjs +122 -0
- package/esm2022/lib/components/clear-value/clear-value.component.mjs +34 -0
- package/esm2022/lib/components/date-picker/date-picker.component.mjs +97 -0
- package/esm2022/lib/components/date-range-datepicker/date-range-datepicker.component.mjs +118 -0
- package/esm2022/lib/components/icon-button/icon-button.component.mjs +49 -0
- package/esm2022/lib/components/text/text-input.component.mjs +73 -0
- package/esm2022/lib/directives/date-mask.directive.mjs +92 -0
- package/esm2022/lib/directives/input-mask.directive.mjs +92 -0
- package/esm2022/lib/interfaces/app-input.interface.mjs +2 -0
- package/esm2022/lib/interfaces/autocomplete-configs.interface.mjs +2 -0
- package/esm2022/lib/interfaces/button-types.enum.mjs +17 -0
- package/esm2022/lib/pipes/array-to-string.pipe.mjs +17 -0
- package/esm2022/lib/pipes/generate-error-messages.pipe.mjs +31 -0
- package/esm2022/lib/pipes/get-value-by-key-from-object.pipe.mjs +45 -0
- package/esm2022/lib/services/input.service.mjs +29 -0
- package/esm2022/public-api.mjs +19 -0
- package/fesm2022/i-tech-shared-components.mjs +1149 -0
- package/fesm2022/i-tech-shared-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/autocomplete-select/autocomplete-select.component.d.ts +84 -0
- package/lib/components/button/button.component.d.ts +65 -0
- package/lib/components/clear-value/clear-value.component.d.ts +9 -0
- package/lib/components/date-picker/date-picker.component.d.ts +32 -0
- package/lib/components/date-range-datepicker/date-range-datepicker.component.d.ts +36 -0
- package/lib/components/icon-button/icon-button.component.d.ts +14 -0
- package/lib/components/text/text-input.component.d.ts +21 -0
- package/lib/directives/date-mask.directive.d.ts +25 -0
- package/lib/directives/input-mask.directive.d.ts +21 -0
- package/lib/interfaces/app-input.interface.d.ts +31 -0
- package/lib/interfaces/autocomplete-configs.interface.d.ts +37 -0
- package/lib/interfaces/button-types.enum.d.ts +15 -0
- package/lib/pipes/array-to-string.pipe.d.ts +7 -0
- package/lib/pipes/generate-error-messages.pipe.d.ts +10 -0
- package/lib/pipes/get-value-by-key-from-object.pipe.d.ts +7 -0
- package/lib/services/input.service.d.ts +7 -0
- package/package.json +32 -19
- package/{src/public-api.ts → public-api.d.ts} +15 -20
- package/theme.scss +2 -4
- package/docs/README.md +0 -87
- package/docs/components/autocomplete-select/autocomplete-select.component/README.md +0 -13
- package/docs/components/autocomplete-select/autocomplete-select.component/classes/AutocompleteSelectComponent.md +0 -793
- package/docs/components/button/button.component/README.md +0 -13
- package/docs/components/button/button.component/classes/ButtonComponent.md +0 -191
- package/docs/components/button/button.component.spec/README.md +0 -7
- package/docs/components/clear-value/clear-value.component/README.md +0 -13
- package/docs/components/clear-value/clear-value.component/classes/ClearValueComponent.md +0 -47
- package/docs/components/date-picker/date-picker.component/README.md +0 -13
- package/docs/components/date-picker/date-picker.component/classes/DatePickerComponent.md +0 -253
- package/docs/components/date-range-datepicker/date-range-datepicker.component/README.md +0 -13
- package/docs/components/date-range-datepicker/date-range-datepicker.component/classes/DateRangeDatepickerComponent.md +0 -341
- package/docs/components/icon-button/icon-button.component/README.md +0 -13
- package/docs/components/icon-button/icon-button.component/classes/IconButtonComponent.md +0 -107
- package/docs/components/label/label.component/README.md +0 -13
- package/docs/components/label/label.component/classes/LabelComponent.md +0 -97
- package/docs/components/menu/menu.component/README.md +0 -13
- package/docs/components/menu/menu.component/classes/MenuComponent.md +0 -139
- package/docs/components/text/text-input.component/README.md +0 -13
- package/docs/components/text/text-input.component/classes/TextInputComponent.md +0 -133
- package/docs/interfaces/app-input.interface/README.md +0 -13
- package/docs/interfaces/app-input.interface/interfaces/AppInputInterface.md +0 -297
- package/docs/interfaces/autocomplete-configs.interface/README.md +0 -13
- package/docs/interfaces/autocomplete-configs.interface/interfaces/AutocompleteConfigsInterface.md +0 -357
- package/docs/interfaces/button-types.enum/README.md +0 -13
- package/docs/interfaces/button-types.enum/enumerations/ButtonType.md +0 -69
- package/docs/interfaces/dropdown-selection.constants/README.md +0 -17
- package/docs/interfaces/dropdown-selection.constants/enumerations/DropdownSelectionType.md +0 -37
- package/docs/interfaces/dropdown-selection.constants/variables/DropdownItemIcon.md +0 -27
- package/docs/interfaces/label-type.enum/README.md +0 -13
- package/docs/interfaces/label-type.enum/enumerations/LabelTypeEnum.md +0 -127
- package/docs/services/input.service/README.md +0 -13
- package/docs/services/input.service/classes/InputService.md +0 -31
- package/ng-package.json +0 -17
- package/src/README.md +0 -0
- package/src/lib/components/autocomplete-select/autocomplete-select.component.html +0 -211
- package/src/lib/components/autocomplete-select/autocomplete-select.component.scss +0 -58
- package/src/lib/components/autocomplete-select/autocomplete-select.component.ts +0 -430
- package/src/lib/components/autocomplete-select/loader.svg +0 -6
- package/src/lib/components/button/button.component.css +0 -0
- package/src/lib/components/button/button.component.html +0 -48
- package/src/lib/components/button/button.component.spec.ts +0 -23
- package/src/lib/components/button/button.component.ts +0 -106
- package/src/lib/components/clear-value/clear-value.component.ts +0 -44
- package/src/lib/components/date-picker/date-picker.component.html +0 -61
- package/src/lib/components/date-picker/date-picker.component.ts +0 -75
- package/src/lib/components/date-range-datepicker/date-range-datepicker.component.html +0 -44
- package/src/lib/components/date-range-datepicker/date-range-datepicker.component.ts +0 -105
- package/src/lib/components/icon-button/icon-button.component.html +0 -27
- package/src/lib/components/icon-button/icon-button.component.scss +0 -0
- package/src/lib/components/icon-button/icon-button.component.ts +0 -37
- package/src/lib/components/label/label.component.html +0 -15
- package/src/lib/components/label/label.component.ts +0 -33
- package/src/lib/components/menu/menu.component.html +0 -20
- package/src/lib/components/menu/menu.component.scss +0 -9
- package/src/lib/components/menu/menu.component.ts +0 -39
- package/src/lib/components/text/text-input.component.html +0 -91
- package/src/lib/components/text/text-input.component.ts +0 -73
- package/src/lib/directives/date-mask.directive.ts +0 -97
- package/src/lib/directives/input-mask.directive.ts +0 -93
- package/src/lib/interfaces/app-input.interface.ts +0 -32
- package/src/lib/interfaces/autocomplete-configs.interface.ts +0 -37
- package/src/lib/interfaces/button-types.enum.ts +0 -19
- package/src/lib/interfaces/dropdown-selection.constants.ts +0 -11
- package/src/lib/interfaces/label-type.enum.ts +0 -14
- package/src/lib/pipes/array-to-string.pipe.ts +0 -13
- package/src/lib/pipes/generate-error-messages.pipe.ts +0 -31
- package/src/lib/pipes/get-value-by-key-from-object.pipe.ts +0 -46
- package/src/lib/services/input.service.ts +0 -30
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -0,0 +1,1149 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, inject, Injectable, Directive, Input, HostListener, EventEmitter, Component, Output, ViewChild } from '@angular/core';
|
|
3
|
+
import * as i2 from '@ngx-translate/core';
|
|
4
|
+
import { TranslateModule, TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
5
|
+
import * as i3 from '@angular/forms';
|
|
6
|
+
import { NgControl, FormControlName, ReactiveFormsModule, UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
|
|
7
|
+
import { MatIconButton, MatFabButton, MatButton } from '@angular/material/button';
|
|
8
|
+
import { NgClass, NgIf, NgOptimizedImage, NgFor } from '@angular/common';
|
|
9
|
+
import { MatTooltip } from '@angular/material/tooltip';
|
|
10
|
+
import * as i1 from '@angular/material/icon';
|
|
11
|
+
import { MatIcon, MatIconModule } from '@angular/material/icon';
|
|
12
|
+
import * as i4 from '@angular/material/form-field';
|
|
13
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
14
|
+
import { MatInput } from '@angular/material/input';
|
|
15
|
+
import { NgxMaskDirective, NgxMaskPipe, NgxMaskService } from 'ngx-mask';
|
|
16
|
+
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|
17
|
+
import * as i5 from '@angular/material/select';
|
|
18
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
19
|
+
import * as i6 from '@angular/material/core';
|
|
20
|
+
import * as i3$1 from '@angular/material/datepicker';
|
|
21
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
22
|
+
|
|
23
|
+
class GenerateErrorMessagesPipe {
|
|
24
|
+
constructor(translateService) {
|
|
25
|
+
this.translateService = translateService;
|
|
26
|
+
}
|
|
27
|
+
transform(control, label, defaultPatternKey = 'fixed') {
|
|
28
|
+
if (!control.errors) {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
let translateParams;
|
|
32
|
+
let errorMessageKey = '';
|
|
33
|
+
const key = (Object.keys(control.errors)[0]);
|
|
34
|
+
translateParams = { ERROR_KEY: this.translateService.instant(label) || 'Field' };
|
|
35
|
+
errorMessageKey = (key === 'pattern') ?
|
|
36
|
+
'errorMessages.pattern.' + defaultPatternKey : 'errorMessages.' + key;
|
|
37
|
+
return this.translateService.instant(errorMessageKey, translateParams);
|
|
38
|
+
}
|
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GenerateErrorMessagesPipe, deps: [{ token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
40
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: GenerateErrorMessagesPipe, isStandalone: true, name: "generateErrorMessages" }); }
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GenerateErrorMessagesPipe, decorators: [{
|
|
43
|
+
type: Pipe,
|
|
44
|
+
args: [{
|
|
45
|
+
name: 'generateErrorMessages',
|
|
46
|
+
standalone: true,
|
|
47
|
+
pure: true
|
|
48
|
+
}]
|
|
49
|
+
}], ctorParameters: () => [{ type: i2.TranslateService }] });
|
|
50
|
+
|
|
51
|
+
class ArrayToStringPipe {
|
|
52
|
+
transform(value) {
|
|
53
|
+
return (typeof value === 'string') ? value : value.join(',');
|
|
54
|
+
}
|
|
55
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ArrayToStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
56
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: ArrayToStringPipe, isStandalone: true, name: "arrayToString" }); }
|
|
57
|
+
}
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ArrayToStringPipe, decorators: [{
|
|
59
|
+
type: Pipe,
|
|
60
|
+
args: [{
|
|
61
|
+
name: 'arrayToString',
|
|
62
|
+
standalone: true
|
|
63
|
+
}]
|
|
64
|
+
}] });
|
|
65
|
+
|
|
66
|
+
class GetValueByKeyFromObjectPipe {
|
|
67
|
+
transform(keys, data, withParams = null, withParamSymbol) {
|
|
68
|
+
if (typeof keys === 'string') {
|
|
69
|
+
return data[keys];
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
let returnValue = data;
|
|
73
|
+
keys.forEach((key) => {
|
|
74
|
+
if (!returnValue) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
returnValue = returnValue[key];
|
|
78
|
+
});
|
|
79
|
+
if (withParams) {
|
|
80
|
+
withParams.forEach((param) => {
|
|
81
|
+
let include = data;
|
|
82
|
+
if (typeof param === 'object') {
|
|
83
|
+
param.forEach((key) => {
|
|
84
|
+
include = (include) ? include[key] : null;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
include = include[param];
|
|
89
|
+
}
|
|
90
|
+
if (include !== undefined && include !== null) {
|
|
91
|
+
returnValue += (withParamSymbol ? withParamSymbol : ' ') + include;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return ((returnValue !== "undefined") && (returnValue !== null)) ? returnValue : '---';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GetValueByKeyFromObjectPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
99
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: GetValueByKeyFromObjectPipe, isStandalone: true, name: "getValueByKeyFromObject" }); }
|
|
100
|
+
}
|
|
101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: GetValueByKeyFromObjectPipe, decorators: [{
|
|
102
|
+
type: Pipe,
|
|
103
|
+
args: [{
|
|
104
|
+
name: 'getValueByKeyFromObject',
|
|
105
|
+
standalone: true
|
|
106
|
+
}]
|
|
107
|
+
}] });
|
|
108
|
+
|
|
109
|
+
class NoopValueAccessor {
|
|
110
|
+
writeValue() { }
|
|
111
|
+
registerOnChange() { }
|
|
112
|
+
registerOnTouched() { }
|
|
113
|
+
}
|
|
114
|
+
class InputService {
|
|
115
|
+
injectNgControl() {
|
|
116
|
+
const ngControl = inject(NgControl, { self: true, optional: true });
|
|
117
|
+
if (!ngControl)
|
|
118
|
+
throw new Error('...');
|
|
119
|
+
if (ngControl instanceof FormControlName) {
|
|
120
|
+
ngControl.valueAccessor = new NoopValueAccessor();
|
|
121
|
+
return ngControl;
|
|
122
|
+
}
|
|
123
|
+
throw new Error(`...`);
|
|
124
|
+
}
|
|
125
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
126
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputService, providedIn: 'root' }); }
|
|
127
|
+
}
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputService, decorators: [{
|
|
129
|
+
type: Injectable,
|
|
130
|
+
args: [{
|
|
131
|
+
providedIn: 'root'
|
|
132
|
+
}]
|
|
133
|
+
}] });
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Enum representing different types of buttons.
|
|
137
|
+
*/
|
|
138
|
+
var ButtonType;
|
|
139
|
+
(function (ButtonType) {
|
|
140
|
+
/** A filled button with solid background, typically used for primary actions. */
|
|
141
|
+
ButtonType["FILLED"] = "FILLED";
|
|
142
|
+
/** A tonal button with lighter background, used for secondary actions. */
|
|
143
|
+
ButtonType["TONAL"] = "TONAL";
|
|
144
|
+
/** An outlined button with a border and no background. */
|
|
145
|
+
ButtonType["OUTLINE"] = "OUTLINE";
|
|
146
|
+
/** A text button with no background or border, ideal for minimal UI. */
|
|
147
|
+
ButtonType["TEXT"] = "TEXT";
|
|
148
|
+
/** A warning button with special styling to indicate caution or alert actions. */
|
|
149
|
+
ButtonType["WARNING"] = "WARNING";
|
|
150
|
+
})(ButtonType || (ButtonType = {}));
|
|
151
|
+
|
|
152
|
+
class InputMaskDirective {
|
|
153
|
+
set min(value) {
|
|
154
|
+
this.minimumValue = Number(value);
|
|
155
|
+
}
|
|
156
|
+
set max(value) {
|
|
157
|
+
this.maximumValue = Number(value);
|
|
158
|
+
}
|
|
159
|
+
set float(value) {
|
|
160
|
+
this.isFloat = value === 'true';
|
|
161
|
+
}
|
|
162
|
+
onPaste(event) {
|
|
163
|
+
this.makeValidation(event, true);
|
|
164
|
+
}
|
|
165
|
+
constructor(elementRef) {
|
|
166
|
+
this.elementRef = elementRef;
|
|
167
|
+
this.regexFloat = new RegExp(/^([0-9]*[.])?[0-9]+$/);
|
|
168
|
+
this.regexOnlyNumbers = new RegExp(/^-?[0-9]+(?:\.[0-9]+)?$/);
|
|
169
|
+
this.elementRef.nativeElement.addEventListener('keypress', (event) => {
|
|
170
|
+
this.makeValidation(event);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
makeValidation(event, fromPaste = false) {
|
|
174
|
+
let value;
|
|
175
|
+
let newChar;
|
|
176
|
+
if (!fromPaste) {
|
|
177
|
+
newChar = String.fromCharCode(event.keyCode);
|
|
178
|
+
const cursorPos = event.target.selectionStart;
|
|
179
|
+
const inputText = event.target.value;
|
|
180
|
+
value = `${inputText.slice(0, cursorPos)}${newChar}${inputText.slice(cursorPos, inputText.length)}`;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
value = event.clipboardData?.getData('text/plain');
|
|
184
|
+
}
|
|
185
|
+
if (this.inputMask === 'number') {
|
|
186
|
+
return this.checkingForNumbers(value, event, newChar, fromPaste);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return this.checkingForTexts(value, event);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
checkingForNumbers(value, event, newChar, fromPaste = false) {
|
|
193
|
+
if ((isNaN(this.minimumValue) || this.minimumValue < 0) && value === '-') {
|
|
194
|
+
value = Number('-0');
|
|
195
|
+
}
|
|
196
|
+
if (this.isFloat && (newChar === '.')) {
|
|
197
|
+
value += '0';
|
|
198
|
+
}
|
|
199
|
+
if (!this.isFloat && fromPaste && value.includes('.')) {
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
const regex = (this.isFloat) ? this.regexFloat : this.regexOnlyNumbers;
|
|
204
|
+
if (!regex.test(value) ||
|
|
205
|
+
(this.minimumValue && value < this.minimumValue) ||
|
|
206
|
+
(this.maximumValue && value > this.maximumValue)) {
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
checkingForTexts(value, event) {
|
|
213
|
+
let regex = new RegExp(/^[A-Za-z0-9]*$/);
|
|
214
|
+
if (!regex.test(value)) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputMaskDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
221
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: InputMaskDirective, isStandalone: true, selector: "[inputMask]", inputs: { inputMask: "inputMask", min: "min", max: "max", float: "float" }, host: { listeners: { "paste": "onPaste($event)" } }, ngImport: i0 }); }
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: InputMaskDirective, decorators: [{
|
|
224
|
+
type: Directive,
|
|
225
|
+
args: [{
|
|
226
|
+
selector: '[inputMask]',
|
|
227
|
+
standalone: true
|
|
228
|
+
}]
|
|
229
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { inputMask: [{
|
|
230
|
+
type: Input
|
|
231
|
+
}], min: [{
|
|
232
|
+
type: Input
|
|
233
|
+
}], max: [{
|
|
234
|
+
type: Input
|
|
235
|
+
}], float: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], onPaste: [{
|
|
238
|
+
type: HostListener,
|
|
239
|
+
args: ['paste', ['$event']]
|
|
240
|
+
}] } });
|
|
241
|
+
|
|
242
|
+
class IconButtonComponent {
|
|
243
|
+
constructor() {
|
|
244
|
+
this.size = 'medium';
|
|
245
|
+
this.type = 'tonal';
|
|
246
|
+
this.buttonClick = new EventEmitter();
|
|
247
|
+
}
|
|
248
|
+
onClick(event) {
|
|
249
|
+
if (!this.disabled) {
|
|
250
|
+
this.buttonClick.emit();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: IconButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
254
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: IconButtonComponent, isStandalone: true, selector: "i-tech-icon-button", inputs: { size: "size", type: "type", iconSvg: "iconSvg", iconName: "iconName", tooltip: "tooltip", disabled: "disabled" }, outputs: { buttonClick: "buttonClick" }, ngImport: i0, template: "<button\r\n *ngIf=\"['tonal','standard'].includes(type)\"\r\n mat-icon-button\r\n [ngClass]=\"{small: size === 'small', tonal: type === 'tonal', standard: type === 'standard'}\"\r\n [matTooltip]=\"tooltip | translate\"\r\n [matTooltipDisabled]=\"!tooltip\"\r\n [disabled]=\"disabled || false\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"iconSvg\" [svgIcon]=\"iconSvg\"></mat-icon>\r\n <mat-icon *ngIf=\"iconName\">{{iconName}}</mat-icon>\r\n</button>\r\n\r\n<button\r\n *ngIf=\"type === 'filled'\"\r\n mat-fab\r\n class=\"filled\"\r\n [ngClass]=\"{small: size === 'small'}\"\r\n [matTooltip]=\"tooltip | translate\"\r\n [matTooltipDisabled]=\"!tooltip\"\r\n [color]=\"'primary'\"\r\n [disabled]=\"disabled || false\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"iconSvg\" [svgIcon]=\"iconSvg\"></mat-icon>\r\n <mat-icon *ngIf=\"iconName\">{{iconName}}</mat-icon>\r\n</button>\r\n", styles: [""], dependencies: [{ kind: "component", type: MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { 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: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatFabButton, selector: "button[mat-fab]", inputs: ["extended"], exportAs: ["matButton"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
255
|
+
}
|
|
256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: IconButtonComponent, decorators: [{
|
|
257
|
+
type: Component,
|
|
258
|
+
args: [{ selector: 'i-tech-icon-button', imports: [
|
|
259
|
+
MatIconButton,
|
|
260
|
+
NgClass,
|
|
261
|
+
MatTooltip,
|
|
262
|
+
TranslateModule,
|
|
263
|
+
MatIcon,
|
|
264
|
+
MatFabButton,
|
|
265
|
+
NgIf
|
|
266
|
+
], standalone: true, template: "<button\r\n *ngIf=\"['tonal','standard'].includes(type)\"\r\n mat-icon-button\r\n [ngClass]=\"{small: size === 'small', tonal: type === 'tonal', standard: type === 'standard'}\"\r\n [matTooltip]=\"tooltip | translate\"\r\n [matTooltipDisabled]=\"!tooltip\"\r\n [disabled]=\"disabled || false\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"iconSvg\" [svgIcon]=\"iconSvg\"></mat-icon>\r\n <mat-icon *ngIf=\"iconName\">{{iconName}}</mat-icon>\r\n</button>\r\n\r\n<button\r\n *ngIf=\"type === 'filled'\"\r\n mat-fab\r\n class=\"filled\"\r\n [ngClass]=\"{small: size === 'small'}\"\r\n [matTooltip]=\"tooltip | translate\"\r\n [matTooltipDisabled]=\"!tooltip\"\r\n [color]=\"'primary'\"\r\n [disabled]=\"disabled || false\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"iconSvg\" [svgIcon]=\"iconSvg\"></mat-icon>\r\n <mat-icon *ngIf=\"iconName\">{{iconName}}</mat-icon>\r\n</button>\r\n" }]
|
|
267
|
+
}], propDecorators: { size: [{
|
|
268
|
+
type: Input
|
|
269
|
+
}], type: [{
|
|
270
|
+
type: Input
|
|
271
|
+
}], iconSvg: [{
|
|
272
|
+
type: Input
|
|
273
|
+
}], iconName: [{
|
|
274
|
+
type: Input
|
|
275
|
+
}], tooltip: [{
|
|
276
|
+
type: Input
|
|
277
|
+
}], disabled: [{
|
|
278
|
+
type: Input
|
|
279
|
+
}], buttonClick: [{
|
|
280
|
+
type: Output
|
|
281
|
+
}] } });
|
|
282
|
+
|
|
283
|
+
class TextInputComponent {
|
|
284
|
+
set inputData(data) {
|
|
285
|
+
// If submit becomes true, mark the control as touched
|
|
286
|
+
if (data?.submit && this.ngControl.control) {
|
|
287
|
+
this.ngControl.control.markAsTouched();
|
|
288
|
+
}
|
|
289
|
+
this._inputData = data;
|
|
290
|
+
}
|
|
291
|
+
get inputData() {
|
|
292
|
+
return this._inputData;
|
|
293
|
+
}
|
|
294
|
+
constructor(inputService) {
|
|
295
|
+
this.inputService = inputService;
|
|
296
|
+
this.focusOutEmitter = new EventEmitter();
|
|
297
|
+
this.customErrorStateMatcher = {
|
|
298
|
+
isErrorState: (control, form) => {
|
|
299
|
+
return !!(control && control.invalid && this.inputData?.submit);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
this.ngControl = this.inputService.injectNgControl();
|
|
303
|
+
}
|
|
304
|
+
onFocusOut() {
|
|
305
|
+
if (this._inputData.focusOutEmit) {
|
|
306
|
+
this.focusOutEmitter.emit();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
clear() {
|
|
310
|
+
if (this.ngControl) {
|
|
311
|
+
this.ngControl.control.reset();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextInputComponent, deps: [{ token: InputService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
315
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: TextInputComponent, isStandalone: true, selector: "i-tech-text-input", inputs: { inputData: "inputData" }, outputs: { focusOutEmitter: "focusOutEmitter" }, ngImport: i0, template: "<div *ngIf=\"inputData && ngControl\">\r\n <div class=\"w-100\">\r\n <mat-label [ngClass]=\"{\r\n 'readonly-color' : inputData.readOnly || ngControl.control.disabled,\r\n 'invalid-label-color': !!(ngControl.control.errors && inputData.submit)\r\n }\"\r\n *ngIf=\"inputData.label\">\r\n {{ inputData.label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"inputData.required\" class=\"required-input\"\r\n [ngClass]=\"{'readonly-color' : inputData.readOnly || ngControl.control.disabled}\">*</span>\r\n </div>\r\n <mat-form-field appearance=\"outline\" class=\"w-100\"\r\n [class.readonly-field]=\"inputData.readOnly || ngControl.control.disabled\"\r\n >\r\n <!-- Leading Icon -->\r\n <mat-icon *ngIf=\"inputData.iconPrefix\"\r\n matPrefix\r\n [ngClass]=\"{\r\n 'readonly-color' : !inputData.iconPrefixColor && (inputData.readOnly || ngControl.control.disabled),\r\n 'default-form-icon-color' : !inputData.iconPrefixColor && !(inputData.readOnly || ngControl.control.disabled)\r\n }\"\r\n [matTooltip]=\"((inputData.iconPrefixTooltip || '') | translate)\"\r\n [style.color]=\"inputData.iconPrefixColor || null\"\r\n >{{ inputData.iconPrefix }}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"inputData.iconPrefixSvg\"\r\n matPrefix\r\n [matTooltip]=\"((inputData.iconPrefixTooltip || '') | translate)\"\r\n [svgIcon]=\"inputData.iconPrefixSvg\"\r\n ></mat-icon>\r\n\r\n <!-- Input Field -->\r\n <input matInput\r\n *ngIf=\"!inputData.textarea\"\r\n [type]=\"inputData.type || 'text'\"\r\n [readonly]=\"inputData.readOnly\"\r\n [placeholder]=\"(inputData.placeholder || '') | translate\"\r\n [pattern]=\"inputData.pattern!\"\r\n [formControl]=\"ngControl.control\"\r\n [mask]=\"inputData.mask || ''\"\r\n [ngClass]=\"{'readonly-color readonly-cursor' : inputData.readOnly || ngControl.control.disabled}\"\r\n [inputMask]=\"inputData.inputMask!\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n (blur)=\"onFocusOut()\"\r\n >\r\n\r\n <textarea matInput\r\n *ngIf=\"inputData.textarea\"\r\n [type]=\"inputData.type || 'text'\"\r\n [readonly]=\"inputData.readOnly\"\r\n [placeholder]=\"(inputData.placeholder || '') | translate\"\r\n [pattern]=\"inputData.pattern!\"\r\n [formControl]=\"ngControl.control\"\r\n [ngClass]=\"{'readonly-color' : inputData.readOnly || ngControl.control.disabled}\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n ></textarea>\r\n\r\n <!-- Clear Icon -->\r\n <i-tech-icon-button\r\n *ngIf=\"inputData.clearable\"\r\n iconName=\"cancel\"\r\n matSuffix\r\n [disabled]=\"inputData.readOnly || ngControl.control.disabled || false\"\r\n [ngClass]=\"inputData.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n (click)=\"clear()\"\r\n >\r\n </i-tech-icon-button>\r\n\r\n <!-- Trailing Icon -->\r\n <i-tech-icon-button\r\n *ngIf=\"inputData.iconSuffix\"\r\n [iconName]=\"inputData.iconSuffix\"\r\n [disabled]=\"inputData.readOnly || ngControl.control.disabled || false\"\r\n [ngClass]=\"inputData.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n matSuffix\r\n >\r\n </i-tech-icon-button>\r\n\r\n <!-- Error Messages -->\r\n <mat-error *ngIf=\"!!(ngControl.control.errors && inputData.submit)\">\r\n {{ ngControl.control | generateErrorMessages : (inputData.label || '') : inputData.defaultPatternKey }}\r\n </mat-error>\r\n\r\n <!-- Helper Text -->\r\n <mat-hint *ngIf=\"!(!!(ngControl.control.errors && inputData.submit)) && inputData.hint\">\r\n {{ inputData.hint | translate }}\r\n </mat-hint>\r\n </mat-form-field>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: GenerateErrorMessagesPipe, name: "generateErrorMessages" }, { kind: "component", type: IconButtonComponent, selector: "i-tech-icon-button", inputs: ["size", "type", "iconSvg", "iconName", "tooltip", "disabled"], outputs: ["buttonClick"] }, { kind: "directive", type: InputMaskDirective, selector: "[inputMask]", inputs: ["inputMask", "min", "max", "float"] }, { kind: "directive", type: NgxMaskDirective, selector: "input[mask], textarea[mask]", inputs: ["mask", "specialCharacters", "patterns", "prefix", "suffix", "thousandSeparator", "decimalMarker", "dropSpecialCharacters", "hiddenInput", "showMaskTyped", "placeHolderCharacter", "shownMaskExpression", "showTemplate", "clearIfNotMatch", "validation", "separatorLimit", "allowNegativeNumbers", "leadZeroDateTime", "leadZero", "triggerOnMaskChange", "apm", "inputTransformFn", "outputTransformFn", "keepCharacterPositions"], outputs: ["maskFilled"], exportAs: ["mask", "ngxMask"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }] }); }
|
|
316
|
+
}
|
|
317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
318
|
+
type: Component,
|
|
319
|
+
args: [{ selector: 'i-tech-text-input', imports: [
|
|
320
|
+
TranslateModule,
|
|
321
|
+
NgClass,
|
|
322
|
+
MatIcon,
|
|
323
|
+
MatTooltip,
|
|
324
|
+
MatInput,
|
|
325
|
+
ReactiveFormsModule,
|
|
326
|
+
NgIf,
|
|
327
|
+
GenerateErrorMessagesPipe,
|
|
328
|
+
IconButtonComponent,
|
|
329
|
+
InputMaskDirective,
|
|
330
|
+
NgxMaskDirective,
|
|
331
|
+
MatFormFieldModule
|
|
332
|
+
], standalone: true, template: "<div *ngIf=\"inputData && ngControl\">\r\n <div class=\"w-100\">\r\n <mat-label [ngClass]=\"{\r\n 'readonly-color' : inputData.readOnly || ngControl.control.disabled,\r\n 'invalid-label-color': !!(ngControl.control.errors && inputData.submit)\r\n }\"\r\n *ngIf=\"inputData.label\">\r\n {{ inputData.label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"inputData.required\" class=\"required-input\"\r\n [ngClass]=\"{'readonly-color' : inputData.readOnly || ngControl.control.disabled}\">*</span>\r\n </div>\r\n <mat-form-field appearance=\"outline\" class=\"w-100\"\r\n [class.readonly-field]=\"inputData.readOnly || ngControl.control.disabled\"\r\n >\r\n <!-- Leading Icon -->\r\n <mat-icon *ngIf=\"inputData.iconPrefix\"\r\n matPrefix\r\n [ngClass]=\"{\r\n 'readonly-color' : !inputData.iconPrefixColor && (inputData.readOnly || ngControl.control.disabled),\r\n 'default-form-icon-color' : !inputData.iconPrefixColor && !(inputData.readOnly || ngControl.control.disabled)\r\n }\"\r\n [matTooltip]=\"((inputData.iconPrefixTooltip || '') | translate)\"\r\n [style.color]=\"inputData.iconPrefixColor || null\"\r\n >{{ inputData.iconPrefix }}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"inputData.iconPrefixSvg\"\r\n matPrefix\r\n [matTooltip]=\"((inputData.iconPrefixTooltip || '') | translate)\"\r\n [svgIcon]=\"inputData.iconPrefixSvg\"\r\n ></mat-icon>\r\n\r\n <!-- Input Field -->\r\n <input matInput\r\n *ngIf=\"!inputData.textarea\"\r\n [type]=\"inputData.type || 'text'\"\r\n [readonly]=\"inputData.readOnly\"\r\n [placeholder]=\"(inputData.placeholder || '') | translate\"\r\n [pattern]=\"inputData.pattern!\"\r\n [formControl]=\"ngControl.control\"\r\n [mask]=\"inputData.mask || ''\"\r\n [ngClass]=\"{'readonly-color readonly-cursor' : inputData.readOnly || ngControl.control.disabled}\"\r\n [inputMask]=\"inputData.inputMask!\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n (blur)=\"onFocusOut()\"\r\n >\r\n\r\n <textarea matInput\r\n *ngIf=\"inputData.textarea\"\r\n [type]=\"inputData.type || 'text'\"\r\n [readonly]=\"inputData.readOnly\"\r\n [placeholder]=\"(inputData.placeholder || '') | translate\"\r\n [pattern]=\"inputData.pattern!\"\r\n [formControl]=\"ngControl.control\"\r\n [ngClass]=\"{'readonly-color' : inputData.readOnly || ngControl.control.disabled}\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n ></textarea>\r\n\r\n <!-- Clear Icon -->\r\n <i-tech-icon-button\r\n *ngIf=\"inputData.clearable\"\r\n iconName=\"cancel\"\r\n matSuffix\r\n [disabled]=\"inputData.readOnly || ngControl.control.disabled || false\"\r\n [ngClass]=\"inputData.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n (click)=\"clear()\"\r\n >\r\n </i-tech-icon-button>\r\n\r\n <!-- Trailing Icon -->\r\n <i-tech-icon-button\r\n *ngIf=\"inputData.iconSuffix\"\r\n [iconName]=\"inputData.iconSuffix\"\r\n [disabled]=\"inputData.readOnly || ngControl.control.disabled || false\"\r\n [ngClass]=\"inputData.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n matSuffix\r\n >\r\n </i-tech-icon-button>\r\n\r\n <!-- Error Messages -->\r\n <mat-error *ngIf=\"!!(ngControl.control.errors && inputData.submit)\">\r\n {{ ngControl.control | generateErrorMessages : (inputData.label || '') : inputData.defaultPatternKey }}\r\n </mat-error>\r\n\r\n <!-- Helper Text -->\r\n <mat-hint *ngIf=\"!(!!(ngControl.control.errors && inputData.submit)) && inputData.hint\">\r\n {{ inputData.hint | translate }}\r\n </mat-hint>\r\n </mat-form-field>\r\n</div>\r\n" }]
|
|
333
|
+
}], ctorParameters: () => [{ type: InputService }], propDecorators: { inputData: [{
|
|
334
|
+
type: Input
|
|
335
|
+
}], focusOutEmitter: [{
|
|
336
|
+
type: Output
|
|
337
|
+
}] } });
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* A reusable button component with Material Design styling and custom functionality.
|
|
341
|
+
*/
|
|
342
|
+
class ButtonComponent {
|
|
343
|
+
constructor() {
|
|
344
|
+
/**
|
|
345
|
+
* The text displayed inside the button.
|
|
346
|
+
*/
|
|
347
|
+
this.text = '';
|
|
348
|
+
/**
|
|
349
|
+
* Data attribute used for Cypress or other testing frameworks.
|
|
350
|
+
*/
|
|
351
|
+
this.data_cy = '';
|
|
352
|
+
/**
|
|
353
|
+
* Font icon class for displaying an icon (e.g., Material Icons).
|
|
354
|
+
*/
|
|
355
|
+
this.fontIcon = '';
|
|
356
|
+
/**
|
|
357
|
+
* SVG icon name for displaying an SVG icon.
|
|
358
|
+
*/
|
|
359
|
+
this.svgIcon = '';
|
|
360
|
+
/**
|
|
361
|
+
* Defines the type of button (e.g., `FILLED`, `OUTLINED`).
|
|
362
|
+
*/
|
|
363
|
+
this.type = ButtonType.FILLED;
|
|
364
|
+
/**
|
|
365
|
+
* Additional custom classes to style the button.
|
|
366
|
+
*/
|
|
367
|
+
this.customClass = '';
|
|
368
|
+
/**
|
|
369
|
+
* If true, the button acts as a submit button.
|
|
370
|
+
*/
|
|
371
|
+
this.submit = false;
|
|
372
|
+
/**
|
|
373
|
+
* If true, the button is disabled and cannot be clicked.
|
|
374
|
+
*/
|
|
375
|
+
this.disabled = false;
|
|
376
|
+
/**
|
|
377
|
+
* Indicates whether the button is currently activated.
|
|
378
|
+
*/
|
|
379
|
+
this.activated = false;
|
|
380
|
+
/**
|
|
381
|
+
* The color of the button (e.g., `primary`, `warn`).
|
|
382
|
+
*/
|
|
383
|
+
this.color = 'primary';
|
|
384
|
+
/**
|
|
385
|
+
* Emits an event when the button is clicked.
|
|
386
|
+
*/
|
|
387
|
+
this.buttonClick = new EventEmitter();
|
|
388
|
+
/**
|
|
389
|
+
* Enum reference for `ButtonType` to use in templates.
|
|
390
|
+
*/
|
|
391
|
+
this.ButtonType = ButtonType;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Handles the button click event.
|
|
395
|
+
*
|
|
396
|
+
* @param event - The mouse event triggered by clicking the button.
|
|
397
|
+
*/
|
|
398
|
+
onClick(event) {
|
|
399
|
+
if (!this.disabled && !this.submit) {
|
|
400
|
+
this.buttonClick.emit();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
404
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ButtonComponent, isStandalone: true, selector: "i-tech-button", inputs: { text: "text", data_cy: "data_cy", fontIcon: "fontIcon", svgIcon: "svgIcon", type: "type", customClass: "customClass", submit: "submit", disabled: "disabled", activated: "activated", color: "color" }, outputs: { buttonClick: "buttonClick" }, providers: [
|
|
405
|
+
NgxMaskDirective,
|
|
406
|
+
NgxMaskPipe,
|
|
407
|
+
TranslatePipe,
|
|
408
|
+
TranslateService
|
|
409
|
+
], ngImport: i0, template: "<button *ngIf=\"[ButtonType.FILLED,ButtonType.WARNING].includes(type)\"\r\n mat-flat-button\r\n [attr.data-cy]=\"data_cy\"\r\n [color]=\"type === ButtonType.WARNING ? 'warn' : color\"\r\n [class.activated]=\"activated\"\r\n [ngClass]=\"(customClass || '')\"\r\n [disabled]=\"disabled || submit\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <span *ngIf=\"submit\" class=\"spinner-overlay\">\r\n <mat-spinner diameter=\"16\"></mat-spinner>\r\n </span>\r\n <mat-icon *ngIf=\"fontIcon && !submit\">{{fontIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"svgIcon && !submit\" [svgIcon]=\"svgIcon\"></mat-icon>\r\n <span>{{text | translate}}</span>\r\n</button>\r\n<button *ngIf=\"[ButtonType.TONAL,ButtonType.TEXT].includes(type)\"\r\n mat-button\r\n [attr.data-cy]=\"data_cy\"\r\n [ngClass]=\"(type === ButtonType.TONAL ? 'tertiary ' : '') + (customClass || '')\"\r\n [class.activated]=\"activated\"\r\n [disabled]=\"disabled || submit\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <span *ngIf=\"submit\" class=\"spinner-overlay\">\r\n <mat-spinner diameter=\"16\"></mat-spinner>\r\n </span>\r\n <mat-icon *ngIf=\"fontIcon && !submit\">{{fontIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"svgIcon && !submit\" [svgIcon]=\"svgIcon\"></mat-icon>\r\n\r\n <span>{{text | translate}}</span>\r\n</button>\r\n<button *ngIf=\"type === ButtonType.OUTLINE\"\r\n [color]=\"color\"\r\n mat-stroked-button\r\n [attr.data-cy]=\"data_cy\"\r\n [ngClass]=\"(customClass || '') \"\r\n [disabled]=\"disabled || submit\"\r\n (click)=\"onClick($event)\"\r\n [class.activated]=\"activated\"\r\n>\r\n <span *ngIf=\"submit\" class=\"spinner-overlay\">\r\n <mat-spinner diameter=\"16\"></mat-spinner>\r\n </span>\r\n <mat-icon *ngIf=\"fontIcon && !submit\" >{{fontIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"svgIcon && !submit\" [svgIcon]=\"svgIcon\"></mat-icon>\r\n <span>{{text | translate}}</span>\r\n</button>\r\n", styles: [""], dependencies: [{ kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] }); }
|
|
410
|
+
}
|
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
412
|
+
type: Component,
|
|
413
|
+
args: [{ selector: 'i-tech-button', standalone: true, imports: [
|
|
414
|
+
MatButton,
|
|
415
|
+
NgClass,
|
|
416
|
+
MatProgressSpinner,
|
|
417
|
+
NgIf,
|
|
418
|
+
MatIconModule,
|
|
419
|
+
TranslateModule
|
|
420
|
+
], providers: [
|
|
421
|
+
NgxMaskDirective,
|
|
422
|
+
NgxMaskPipe,
|
|
423
|
+
TranslatePipe,
|
|
424
|
+
TranslateService
|
|
425
|
+
], template: "<button *ngIf=\"[ButtonType.FILLED,ButtonType.WARNING].includes(type)\"\r\n mat-flat-button\r\n [attr.data-cy]=\"data_cy\"\r\n [color]=\"type === ButtonType.WARNING ? 'warn' : color\"\r\n [class.activated]=\"activated\"\r\n [ngClass]=\"(customClass || '')\"\r\n [disabled]=\"disabled || submit\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <span *ngIf=\"submit\" class=\"spinner-overlay\">\r\n <mat-spinner diameter=\"16\"></mat-spinner>\r\n </span>\r\n <mat-icon *ngIf=\"fontIcon && !submit\">{{fontIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"svgIcon && !submit\" [svgIcon]=\"svgIcon\"></mat-icon>\r\n <span>{{text | translate}}</span>\r\n</button>\r\n<button *ngIf=\"[ButtonType.TONAL,ButtonType.TEXT].includes(type)\"\r\n mat-button\r\n [attr.data-cy]=\"data_cy\"\r\n [ngClass]=\"(type === ButtonType.TONAL ? 'tertiary ' : '') + (customClass || '')\"\r\n [class.activated]=\"activated\"\r\n [disabled]=\"disabled || submit\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <span *ngIf=\"submit\" class=\"spinner-overlay\">\r\n <mat-spinner diameter=\"16\"></mat-spinner>\r\n </span>\r\n <mat-icon *ngIf=\"fontIcon && !submit\">{{fontIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"svgIcon && !submit\" [svgIcon]=\"svgIcon\"></mat-icon>\r\n\r\n <span>{{text | translate}}</span>\r\n</button>\r\n<button *ngIf=\"type === ButtonType.OUTLINE\"\r\n [color]=\"color\"\r\n mat-stroked-button\r\n [attr.data-cy]=\"data_cy\"\r\n [ngClass]=\"(customClass || '') \"\r\n [disabled]=\"disabled || submit\"\r\n (click)=\"onClick($event)\"\r\n [class.activated]=\"activated\"\r\n>\r\n <span *ngIf=\"submit\" class=\"spinner-overlay\">\r\n <mat-spinner diameter=\"16\"></mat-spinner>\r\n </span>\r\n <mat-icon *ngIf=\"fontIcon && !submit\" >{{fontIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"svgIcon && !submit\" [svgIcon]=\"svgIcon\"></mat-icon>\r\n <span>{{text | translate}}</span>\r\n</button>\r\n" }]
|
|
426
|
+
}], ctorParameters: () => [], propDecorators: { text: [{
|
|
427
|
+
type: Input
|
|
428
|
+
}], data_cy: [{
|
|
429
|
+
type: Input
|
|
430
|
+
}], fontIcon: [{
|
|
431
|
+
type: Input
|
|
432
|
+
}], svgIcon: [{
|
|
433
|
+
type: Input
|
|
434
|
+
}], type: [{
|
|
435
|
+
type: Input
|
|
436
|
+
}], customClass: [{
|
|
437
|
+
type: Input
|
|
438
|
+
}], submit: [{
|
|
439
|
+
type: Input
|
|
440
|
+
}], disabled: [{
|
|
441
|
+
type: Input
|
|
442
|
+
}], activated: [{
|
|
443
|
+
type: Input
|
|
444
|
+
}], color: [{
|
|
445
|
+
type: Input
|
|
446
|
+
}], buttonClick: [{
|
|
447
|
+
type: Output
|
|
448
|
+
}] } });
|
|
449
|
+
|
|
450
|
+
class ClearValueComponent {
|
|
451
|
+
constructor() {
|
|
452
|
+
this.reset = new EventEmitter();
|
|
453
|
+
}
|
|
454
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ClearValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
455
|
+
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
|
|
456
|
+
class="pointer"
|
|
457
|
+
[ngClass]="className || 'standard'"
|
|
458
|
+
(click)="reset.emit()"
|
|
459
|
+
ngSrc="./ic_close.svg"
|
|
460
|
+
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"] }] }); }
|
|
461
|
+
}
|
|
462
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ClearValueComponent, decorators: [{
|
|
463
|
+
type: Component,
|
|
464
|
+
args: [{ selector: 'i-tech-clear-value', template: `<img
|
|
465
|
+
class="pointer"
|
|
466
|
+
[ngClass]="className || 'standard'"
|
|
467
|
+
(click)="reset.emit()"
|
|
468
|
+
ngSrc="./ic_close.svg"
|
|
469
|
+
height="24" width="24" alt=""/>`, imports: [
|
|
470
|
+
NgClass,
|
|
471
|
+
NgOptimizedImage
|
|
472
|
+
], 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"] }]
|
|
473
|
+
}], propDecorators: { className: [{
|
|
474
|
+
type: Input
|
|
475
|
+
}], additionalClass: [{
|
|
476
|
+
type: Input
|
|
477
|
+
}], reset: [{
|
|
478
|
+
type: Output
|
|
479
|
+
}] } });
|
|
480
|
+
|
|
481
|
+
class AutocompleteSelectComponent {
|
|
482
|
+
/**
|
|
483
|
+
* For working configs.
|
|
484
|
+
*/
|
|
485
|
+
set configs(data) {
|
|
486
|
+
this.selectConfig = data;
|
|
487
|
+
if (!data) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if ((typeof this.selectConfig.paginate) === 'function') {
|
|
491
|
+
if (this.firstRequest) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
this.getData();
|
|
495
|
+
this.firstRequest = true;
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
this.data = this.selectConfig.paginate;
|
|
499
|
+
this.findAndSetDefaultValueFromData();
|
|
500
|
+
}
|
|
501
|
+
;
|
|
502
|
+
handleVisibilityChange() {
|
|
503
|
+
this.tabVisibility = !document.hidden;
|
|
504
|
+
if (this.ngControl.control.value) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
this.closePanelAndUnsetFocus();
|
|
508
|
+
if (!document.hidden) {
|
|
509
|
+
this.isNeededForRecall = true;
|
|
510
|
+
this.pending = true;
|
|
511
|
+
setTimeout(() => {
|
|
512
|
+
this.pending = false;
|
|
513
|
+
}, 4000);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
constructor(inputService) {
|
|
517
|
+
this.inputService = inputService;
|
|
518
|
+
this.selectionChange = new EventEmitter();
|
|
519
|
+
this.emitAction = new EventEmitter();
|
|
520
|
+
this.pending = false;
|
|
521
|
+
this.data = [];
|
|
522
|
+
this.paginationData = { current: 1, last: 0 };
|
|
523
|
+
this.firstRequest = false;
|
|
524
|
+
this.showPlaceholder = true;
|
|
525
|
+
this.isNeededForRecall = false;
|
|
526
|
+
this.accessToNextRequest = true;
|
|
527
|
+
this.disabled = false;
|
|
528
|
+
this.blockRecallDefaultValueSetter = false;
|
|
529
|
+
this.requestLoading = false;
|
|
530
|
+
this.ButtonType = ButtonType;
|
|
531
|
+
this.customErrorStateMatcher = {
|
|
532
|
+
isErrorState: (control, form) => {
|
|
533
|
+
return !!(control && control.invalid && this.submitValue);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
this.ngControl = this.inputService.injectNgControl();
|
|
537
|
+
}
|
|
538
|
+
ngOnChanges(changes) {
|
|
539
|
+
if (changes['selectConfig'] && this.selectConfig) {
|
|
540
|
+
if ((typeof this.selectConfig.paginate) === 'function') {
|
|
541
|
+
this.getData();
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
ngAfterViewInit() {
|
|
546
|
+
this.ngControl.control.valueChanges.subscribe((res) => {
|
|
547
|
+
if (this.data.length && res && !this.blockRecallDefaultValueSetter) {
|
|
548
|
+
this.findAndSetDefaultValueFromData();
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
hardReload() {
|
|
553
|
+
this.getData('', true);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Dynamic request for select data.
|
|
557
|
+
* @param searchText - The input value to search options by.
|
|
558
|
+
* @param fromSearch - Access for search .
|
|
559
|
+
* @returns Select data.
|
|
560
|
+
*/
|
|
561
|
+
getData(searchText, fromSearch) {
|
|
562
|
+
if (!fromSearch && !this.accessToNextRequest) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (this.requestLoading) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
if (fromSearch) {
|
|
569
|
+
this.paginationData.current = 1;
|
|
570
|
+
this.accessToNextRequest = true;
|
|
571
|
+
}
|
|
572
|
+
const functionToDo = this.selectConfig.paginate(this.paginationData.current, searchText);
|
|
573
|
+
this.requestLoading = true;
|
|
574
|
+
functionToDo?.subscribe((data) => {
|
|
575
|
+
const dataToAdd = ('content' in data) ? data.content : data;
|
|
576
|
+
if ('content' in data) {
|
|
577
|
+
this.accessToNextRequest = !data.last || (data.totalPages > this.paginationData.current);
|
|
578
|
+
}
|
|
579
|
+
this.data = (fromSearch || this.selectConfig?.blockPagination) ? dataToAdd : [...this.data, ...dataToAdd];
|
|
580
|
+
this.pending = false;
|
|
581
|
+
this.requestLoading = false;
|
|
582
|
+
if (!dataToAdd.length) {
|
|
583
|
+
this.paginationData.last = this.paginationData.current;
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
this.paginationData.current += 1;
|
|
587
|
+
this.paginationData.last += 1;
|
|
588
|
+
setTimeout(() => {
|
|
589
|
+
this.findAndSetDefaultValueFromData();
|
|
590
|
+
}, 10);
|
|
591
|
+
}, () => {
|
|
592
|
+
this.pending = false;
|
|
593
|
+
this.requestLoading = false;
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
findAndSetDefaultValueFromData() {
|
|
597
|
+
if (this.selectConfig.multiple) {
|
|
598
|
+
if (this.ngControl.value && this.ngControl.value.length == 1) {
|
|
599
|
+
this.setShowingValue(this.data.find((item) => item.id === this.ngControl.value[0]));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
const isDisabled = this.ngControl.disabled;
|
|
604
|
+
if (isDisabled) {
|
|
605
|
+
// TODO Remove after migrating all selects
|
|
606
|
+
// this.ngControl.control.enable();
|
|
607
|
+
// if (!this.ngControl.value && !this.data.length) {
|
|
608
|
+
// this.ngControl.control.disable();
|
|
609
|
+
// return;
|
|
610
|
+
// }
|
|
611
|
+
// this.setDefaultValue();
|
|
612
|
+
// this.ngControl.control.disable();
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
if (!this.ngControl.value && !this.data) {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
this.setDefaultValue();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
setDefaultValue() {
|
|
623
|
+
this.defaultValue = this.data.find((item) => item.id === this.ngControl.value);
|
|
624
|
+
this.baseData = this.defaultValue;
|
|
625
|
+
if (!this.defaultValue) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
this.selectionChange.emit();
|
|
629
|
+
this.setShowingValue(this.defaultValue);
|
|
630
|
+
}
|
|
631
|
+
optionClick(showingData) {
|
|
632
|
+
this.baseData = showingData;
|
|
633
|
+
if (!this.selectConfig.multiple) {
|
|
634
|
+
this.setShowingValue(showingData);
|
|
635
|
+
this.matSelect.close();
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (this.searchInput) {
|
|
639
|
+
if (this.selectConfig.multiple) {
|
|
640
|
+
this.searchInput?.nativeElement?.focus();
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
this.inputFocusOut();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
this.setShowingValue(showingData);
|
|
647
|
+
this.showPlaceholder = false;
|
|
648
|
+
}
|
|
649
|
+
addNewItemEvent() {
|
|
650
|
+
this.isNeededForRecall = true;
|
|
651
|
+
this.emitAction.emit();
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Filter and show.
|
|
655
|
+
* @param data - Existing chosen data.
|
|
656
|
+
*/
|
|
657
|
+
setShowingValue(data) {
|
|
658
|
+
if (!data) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
// TODO refactor this part fully
|
|
662
|
+
let include = data;
|
|
663
|
+
let includeOptional = data;
|
|
664
|
+
if (this.selectConfig.valueToShowByKey) {
|
|
665
|
+
this.selectConfig.valueToShowByKey.forEach((param) => {
|
|
666
|
+
if (typeof param === 'object') {
|
|
667
|
+
param.forEach((key) => {
|
|
668
|
+
include = (include) ? include[key] : null;
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
include = include[param];
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
if (this.selectConfig.showFullTextWithOptionalOnSelectedValue) {
|
|
676
|
+
this.selectConfig.valueToShowByParam?.forEach((param) => {
|
|
677
|
+
if (typeof param === 'object') {
|
|
678
|
+
param.forEach((key) => {
|
|
679
|
+
includeOptional = (includeOptional) ? includeOptional[key] : null;
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
includeOptional = includeOptional[param];
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
if (this.selectConfig.valueToShowByParam && typeof includeOptional === 'string') {
|
|
687
|
+
include += (this.selectConfig.withParamSymbol || '') + includeOptional;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
this.showingValue = include;
|
|
692
|
+
this.blockRecallDefaultValueSetter = true;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Block another events.
|
|
696
|
+
* @param event - Element click event.
|
|
697
|
+
*/
|
|
698
|
+
preventDefault(event) {
|
|
699
|
+
if (!this.selectConfig.multiple) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
event.preventDefault();
|
|
703
|
+
}
|
|
704
|
+
registerPanelScrollEvent(element) {
|
|
705
|
+
if (this.selectConfig.paginateOnScroll === false) {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
const panel = element.panel.nativeElement;
|
|
709
|
+
panel.addEventListener('scroll', (event) => this.loadDataOnScroll(event));
|
|
710
|
+
}
|
|
711
|
+
loadDataOnScroll(event) {
|
|
712
|
+
const pos = (event.target.scrollTop || event.target.scrollTop) + event.target.offsetHeight;
|
|
713
|
+
const max = event.target.scrollHeight;
|
|
714
|
+
if ((pos + 1) >= max) {
|
|
715
|
+
if (this.paginationData.current === this.paginationData.last || this.selectConfig.blockPagination) {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
this.getData();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
focusSearchInput() {
|
|
722
|
+
if (this.selectConfig.search && this.searchInput) {
|
|
723
|
+
this.searchInput.nativeElement.focus();
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
inputFocusOut() {
|
|
727
|
+
this.isNeededForRecall = !!this.searchInput.nativeElement.value;
|
|
728
|
+
this.searchInput.nativeElement.value = '';
|
|
729
|
+
this.showPlaceholder = true;
|
|
730
|
+
this.clearTimeoutForSearch();
|
|
731
|
+
}
|
|
732
|
+
resetValue() {
|
|
733
|
+
this.selectionChange.emit(null);
|
|
734
|
+
this.ngControl.reset(null);
|
|
735
|
+
this.inputFocusOut();
|
|
736
|
+
}
|
|
737
|
+
getDataWithSearch(value, event) {
|
|
738
|
+
this.clearTimeoutForSearch();
|
|
739
|
+
if (value.length >= 1) {
|
|
740
|
+
this.searchTimeoutId = setTimeout(() => {
|
|
741
|
+
this.getData(value, true);
|
|
742
|
+
}, 800);
|
|
743
|
+
}
|
|
744
|
+
else if (value.length <= 1 && event.keyCode === 8) {
|
|
745
|
+
this.getData(value, true);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
clearTimeoutForSearch() {
|
|
749
|
+
if (this.searchTimeoutId) {
|
|
750
|
+
clearTimeout(this.searchTimeoutId);
|
|
751
|
+
this.searchTimeoutId = 0;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
openSelection() {
|
|
755
|
+
if (this.selectConfig.disabled || this.ngControl.control.disabled) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
this.showPlaceholder ? this.matSelect.open() : this.closePanelAndUnsetFocus();
|
|
759
|
+
this.showPlaceholder = !this.showPlaceholder;
|
|
760
|
+
if (!this.showPlaceholder) {
|
|
761
|
+
this.reCallData();
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
closePanelAndUnsetFocus() {
|
|
765
|
+
this.matSelect.close();
|
|
766
|
+
if (this.searchInput) {
|
|
767
|
+
this.searchInput.nativeElement.blur();
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
openedChange(event) {
|
|
771
|
+
if (event) {
|
|
772
|
+
if (this.isNeededForRecall) {
|
|
773
|
+
this.reCallData();
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
if (!this.selectConfig.search) {
|
|
777
|
+
this.pending = false;
|
|
778
|
+
this.reCallData();
|
|
779
|
+
}
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
this.showPlaceholder = true;
|
|
783
|
+
}
|
|
784
|
+
reCallData() {
|
|
785
|
+
// TODO refactor this part
|
|
786
|
+
if (!this.isNeededForRecall) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
this.data = [];
|
|
790
|
+
this.pending = true;
|
|
791
|
+
this.paginationData = {
|
|
792
|
+
current: 1,
|
|
793
|
+
last: 0
|
|
794
|
+
};
|
|
795
|
+
this.accessToNextRequest = true;
|
|
796
|
+
if ((typeof this.selectConfig.paginate) === 'function') {
|
|
797
|
+
this.getData();
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
this.pending = false;
|
|
801
|
+
this.data = this.selectConfig.paginate;
|
|
802
|
+
}
|
|
803
|
+
this.isNeededForRecall = false;
|
|
804
|
+
}
|
|
805
|
+
emitSelectionChangeAndClose(event) {
|
|
806
|
+
this.selectionChange.emit(event.value);
|
|
807
|
+
if (this.selectConfig.multiple) {
|
|
808
|
+
if (!event.value?.length) {
|
|
809
|
+
this.ngControl.control.reset();
|
|
810
|
+
}
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
this.matSelect.close();
|
|
814
|
+
}
|
|
815
|
+
iconClick(matSelect, searchInput) {
|
|
816
|
+
matSelect.open();
|
|
817
|
+
searchInput?.nativeElement?.focus();
|
|
818
|
+
}
|
|
819
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AutocompleteSelectComponent, deps: [{ token: InputService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
820
|
+
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]=\"{\r\n 'readonly-color' : selectConfig.readOnly || ngControl.control.disabled,\r\n 'invalid-label-color': !!(ngControl.control.errors && submitValue)\r\n }\">\r\n {{ selectConfig.label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"selectConfig.required\" class=\"required-input\"\r\n [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: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: IconButtonComponent, selector: "i-tech-icon-button", inputs: ["size", "type", "iconSvg", "iconName", "tooltip", "disabled"], outputs: ["buttonClick"] }, { 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: "ngmodule", type: MatSelectModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i5.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: "component", type: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { 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"] }, { kind: "ngmodule", type: MatFormFieldModule }] }); }
|
|
821
|
+
}
|
|
822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AutocompleteSelectComponent, decorators: [{
|
|
823
|
+
type: Component,
|
|
824
|
+
args: [{ selector: 'i-tech-autocomplete-select', imports: [
|
|
825
|
+
NgClass,
|
|
826
|
+
MatTooltip,
|
|
827
|
+
NgIf,
|
|
828
|
+
NgFor,
|
|
829
|
+
TranslateModule,
|
|
830
|
+
IconButtonComponent,
|
|
831
|
+
ReactiveFormsModule,
|
|
832
|
+
MatSelectModule,
|
|
833
|
+
ButtonComponent,
|
|
834
|
+
GetValueByKeyFromObjectPipe,
|
|
835
|
+
ArrayToStringPipe,
|
|
836
|
+
NgOptimizedImage,
|
|
837
|
+
MatIcon,
|
|
838
|
+
GenerateErrorMessagesPipe,
|
|
839
|
+
ClearValueComponent,
|
|
840
|
+
MatFormFieldModule
|
|
841
|
+
], 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]=\"{\r\n 'readonly-color' : selectConfig.readOnly || ngControl.control.disabled,\r\n 'invalid-label-color': !!(ngControl.control.errors && submitValue)\r\n }\">\r\n {{ selectConfig.label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"selectConfig.required\" class=\"required-input\"\r\n [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"] }]
|
|
842
|
+
}], ctorParameters: () => [{ type: InputService }], propDecorators: { matSelect: [{
|
|
843
|
+
type: ViewChild,
|
|
844
|
+
args: ['matSelect']
|
|
845
|
+
}], searchInput: [{
|
|
846
|
+
type: ViewChild,
|
|
847
|
+
args: ['searchInput']
|
|
848
|
+
}], className: [{
|
|
849
|
+
type: Input
|
|
850
|
+
}], submitValue: [{
|
|
851
|
+
type: Input
|
|
852
|
+
}], configs: [{
|
|
853
|
+
type: Input
|
|
854
|
+
}], detectChanges: [{
|
|
855
|
+
type: Input
|
|
856
|
+
}], selectionChange: [{
|
|
857
|
+
type: Output
|
|
858
|
+
}], emitAction: [{
|
|
859
|
+
type: Output
|
|
860
|
+
}], allSelected: [{
|
|
861
|
+
type: ViewChild,
|
|
862
|
+
args: ['allSelected']
|
|
863
|
+
}], handleVisibilityChange: [{
|
|
864
|
+
type: HostListener,
|
|
865
|
+
args: ['document:visibilitychange']
|
|
866
|
+
}] } });
|
|
867
|
+
|
|
868
|
+
class DateMaskDirective {
|
|
869
|
+
constructor(elementRef, injector) {
|
|
870
|
+
this.elementRef = elementRef;
|
|
871
|
+
this.injector = injector;
|
|
872
|
+
this.expressions = {
|
|
873
|
+
DMY: 'M0/d0/0000',
|
|
874
|
+
DM: 'M0/d0'
|
|
875
|
+
};
|
|
876
|
+
this.dateRegex = new RegExp(/^\s*(1[012]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/((?:19|20)\d{2})\s*$/);
|
|
877
|
+
this.dayMonthRegex = new RegExp(/^\s*(1[012]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])$/);
|
|
878
|
+
this.previousValue = '';
|
|
879
|
+
this.maskService = this.injector.get(NgxMaskService);
|
|
880
|
+
}
|
|
881
|
+
onInput() {
|
|
882
|
+
let value = this.elementRef.nativeElement.value;
|
|
883
|
+
if (this.existsZerosInString(value)) {
|
|
884
|
+
value = this.previousValue;
|
|
885
|
+
}
|
|
886
|
+
const maskedValue = this.maskService.applyMask(value, this.maskType === 'DAY_MONTH' ? this.expressions.DM : this.expressions.DMY);
|
|
887
|
+
if (this.maskType !== 'DAY_MONTH' && !isNaN(new Date(maskedValue).getTime())) {
|
|
888
|
+
if (this.matDatepicker) {
|
|
889
|
+
this.matDatepicker.select(new Date(maskedValue));
|
|
890
|
+
}
|
|
891
|
+
else if (this.rangeFormControl) {
|
|
892
|
+
this.rangeFormControl.setValue(new Date(maskedValue));
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
if (isNaN(new Date(maskedValue).getTime())) {
|
|
896
|
+
this.matDatepicker.select(null);
|
|
897
|
+
}
|
|
898
|
+
this.elementRef.nativeElement.value = maskedValue || null;
|
|
899
|
+
this.previousValue = maskedValue || null;
|
|
900
|
+
}
|
|
901
|
+
onPaste(event) {
|
|
902
|
+
const pastedValue = event.clipboardData?.getData('text/plain');
|
|
903
|
+
if (!pastedValue) {
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
if (this.maskType === 'DAY_MONTH') {
|
|
907
|
+
if (!this.dayMonthRegex.test(pastedValue)) {
|
|
908
|
+
event?.preventDefault();
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
if (!this.dateRegex.test(pastedValue)) {
|
|
913
|
+
event?.preventDefault();
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
existsZerosInString(date) {
|
|
918
|
+
const dateToArray = date.split('/');
|
|
919
|
+
let isValid;
|
|
920
|
+
if (this.maskType === 'DAY_MONTH') {
|
|
921
|
+
isValid = !!dateToArray.find((part) => part.includes('00'));
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
if (dateToArray.length < 3) {
|
|
925
|
+
isValid = !!dateToArray.find((part) => part.includes('00'));
|
|
926
|
+
}
|
|
927
|
+
else {
|
|
928
|
+
isValid = (dateToArray[2][0] == '0') || (+dateToArray[2][0] > 2);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return isValid;
|
|
932
|
+
}
|
|
933
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DateMaskDirective, deps: [{ token: i0.ElementRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
934
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: DateMaskDirective, isStandalone: true, selector: "[dateMask]", inputs: { maskType: "maskType", matDatepicker: "matDatepicker", rangeFormControl: "rangeFormControl" }, host: { listeners: { "input": "onInput()", "paste": "onPaste($event)" } }, providers: [NgxMaskDirective], ngImport: i0 }); }
|
|
935
|
+
}
|
|
936
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DateMaskDirective, decorators: [{
|
|
937
|
+
type: Directive,
|
|
938
|
+
args: [{
|
|
939
|
+
selector: '[dateMask]',
|
|
940
|
+
providers: [NgxMaskDirective],
|
|
941
|
+
standalone: true
|
|
942
|
+
}]
|
|
943
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Injector }], propDecorators: { maskType: [{
|
|
944
|
+
type: Input
|
|
945
|
+
}], matDatepicker: [{
|
|
946
|
+
type: Input
|
|
947
|
+
}], rangeFormControl: [{
|
|
948
|
+
type: Input
|
|
949
|
+
}], onInput: [{
|
|
950
|
+
type: HostListener,
|
|
951
|
+
args: ['input']
|
|
952
|
+
}], onPaste: [{
|
|
953
|
+
type: HostListener,
|
|
954
|
+
args: ['paste', ['$event']]
|
|
955
|
+
}] } });
|
|
956
|
+
|
|
957
|
+
class DatePickerComponent {
|
|
958
|
+
constructor(inputService) {
|
|
959
|
+
this.inputService = inputService;
|
|
960
|
+
this.label = '';
|
|
961
|
+
this.required = false;
|
|
962
|
+
this.hintText = '';
|
|
963
|
+
this.placeholder = 'MM/DD/YYYY';
|
|
964
|
+
this.submit = false;
|
|
965
|
+
this.valueChangeEmitter = new EventEmitter();
|
|
966
|
+
this.isOpen = false;
|
|
967
|
+
this.focused = false;
|
|
968
|
+
this.customErrorStateMatcher = {
|
|
969
|
+
isErrorState: (control, form) => {
|
|
970
|
+
return !!(control && control.invalid && this.submit);
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
this.ngControl = this.inputService.injectNgControl();
|
|
974
|
+
}
|
|
975
|
+
emitChange() {
|
|
976
|
+
if (!this.valueChangeEmit) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
this.valueChangeEmitter.emit();
|
|
980
|
+
}
|
|
981
|
+
clickForFocusOut() {
|
|
982
|
+
setTimeout(() => {
|
|
983
|
+
this.inputElement.nativeElement.focus();
|
|
984
|
+
this.inputElement.nativeElement.blur();
|
|
985
|
+
}, 120);
|
|
986
|
+
}
|
|
987
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatePickerComponent, deps: [{ token: InputService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
988
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DatePickerComponent, isStandalone: true, selector: "i-tech-date-picker", inputs: { label: "label", defaultPatternKey: "defaultPatternKey", required: "required", hintText: "hintText", placeholder: "placeholder", iconPrefix: "iconPrefix", iconPrefixSvg: "iconPrefixSvg", iconPrefixTooltip: "iconPrefixTooltip", iconPrefixColor: "iconPrefixColor", iconPrefixVariant: "iconPrefixVariant", valueChangeEmit: "valueChangeEmit", submit: "submit" }, outputs: { valueChangeEmitter: "valueChangeEmitter" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }], ngImport: i0, template: "<div class=\"flex_column relative mat-date-range-input\" *ngIf=\"ngControl\" [ngClass]=\"{'check_requirements': submit}\">\r\n <div class=\"w-100\">\r\n <mat-label [ngClass]=\"{\r\n 'readonly-color' : ngControl.control.disabled,\r\n 'invalid-label-color': !!(ngControl.control.errors && submit)\r\n }\">\r\n {{ label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"required\" class=\"required-input\" [ngClass]=\"{'readonly-color' : ngControl.control.disabled}\">*</span>\r\n </div>\r\n <mat-form-field appearance=\"outline\" [ngClass]=\"{'opened_calendar': isOpen}\"\r\n [class.readonly-field]=\"ngControl.control.disabled\">\r\n <input matInput #inputElement\r\n type=\"text\"\r\n [formControl]=\"ngControl.control\"\r\n [placeholder]=\"placeholder | translate\"\r\n dateMask\r\n [matDatepicker]=\"datePicker\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n (focus)=\"focused = true\"\r\n (click)=\"datePicker.open();\"\r\n (dateChange)=\"emitChange()\"\r\n >\r\n\r\n <mat-icon *ngIf=\"iconPrefix\"\r\n matPrefix\r\n [matTooltip]=\"((iconPrefixTooltip || '') | translate)\"\r\n [style.color]=\"iconPrefixColor\"\r\n >{{ iconPrefix }}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"iconPrefixSvg\"\r\n matPrefix\r\n [matTooltip]=\"((iconPrefixTooltip || '') | translate)\"\r\n [svgIcon]=\"iconPrefixSvg\"\r\n ></mat-icon>\r\n\r\n <i-tech-icon-button matSuffix\r\n [iconName]=\"'date_range'\"\r\n [disabled]=\"ngControl.control.disabled\"\r\n (click)=\"datePicker.open()\"\r\n [ngClass]=\"ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n ></i-tech-icon-button>\r\n\r\n <mat-datepicker #datePicker (closed)=\"isOpen = false;clickForFocusOut()\"\r\n (opened)=\"isOpen = true;focused = true\"></mat-datepicker>\r\n\r\n <!-- Error Messages -->\r\n <mat-error *ngIf=\"!!(ngControl.control.errors && submit)\">\r\n {{ ngControl.control | generateErrorMessages : label : defaultPatternKey }}\r\n </mat-error>\r\n\r\n <!-- Helper Text -->\r\n <mat-hint *ngIf=\"!(!!(ngControl.control.errors && submit)) && hintText\"\r\n [ngClass]=\"{'readonly-color' : ngControl.control.disabled}\"\r\n >\r\n {{ hintText | translate }}\r\n </mat-hint>\r\n\r\n </mat-form-field>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i3$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i3$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: DateMaskDirective, selector: "[dateMask]", inputs: ["maskType", "matDatepicker", "rangeFormControl"] }, { kind: "pipe", type: GenerateErrorMessagesPipe, name: "generateErrorMessages" }, { kind: "component", type: IconButtonComponent, selector: "i-tech-icon-button", inputs: ["size", "type", "iconSvg", "iconName", "tooltip", "disabled"], outputs: ["buttonClick"] }] }); }
|
|
989
|
+
}
|
|
990
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
991
|
+
type: Component,
|
|
992
|
+
args: [{ selector: 'i-tech-date-picker', imports: [
|
|
993
|
+
NgClass, NgIf,
|
|
994
|
+
TranslateModule,
|
|
995
|
+
ReactiveFormsModule,
|
|
996
|
+
MatFormFieldModule,
|
|
997
|
+
MatDatepickerModule,
|
|
998
|
+
MatInput,
|
|
999
|
+
MatTooltip,
|
|
1000
|
+
MatIconModule,
|
|
1001
|
+
DateMaskDirective,
|
|
1002
|
+
GenerateErrorMessagesPipe, IconButtonComponent
|
|
1003
|
+
], standalone: true, template: "<div class=\"flex_column relative mat-date-range-input\" *ngIf=\"ngControl\" [ngClass]=\"{'check_requirements': submit}\">\r\n <div class=\"w-100\">\r\n <mat-label [ngClass]=\"{\r\n 'readonly-color' : ngControl.control.disabled,\r\n 'invalid-label-color': !!(ngControl.control.errors && submit)\r\n }\">\r\n {{ label | translate }}\r\n </mat-label>\r\n <span *ngIf=\"required\" class=\"required-input\" [ngClass]=\"{'readonly-color' : ngControl.control.disabled}\">*</span>\r\n </div>\r\n <mat-form-field appearance=\"outline\" [ngClass]=\"{'opened_calendar': isOpen}\"\r\n [class.readonly-field]=\"ngControl.control.disabled\">\r\n <input matInput #inputElement\r\n type=\"text\"\r\n [formControl]=\"ngControl.control\"\r\n [placeholder]=\"placeholder | translate\"\r\n dateMask\r\n [matDatepicker]=\"datePicker\"\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n (focus)=\"focused = true\"\r\n (click)=\"datePicker.open();\"\r\n (dateChange)=\"emitChange()\"\r\n >\r\n\r\n <mat-icon *ngIf=\"iconPrefix\"\r\n matPrefix\r\n [matTooltip]=\"((iconPrefixTooltip || '') | translate)\"\r\n [style.color]=\"iconPrefixColor\"\r\n >{{ iconPrefix }}\r\n </mat-icon>\r\n\r\n <mat-icon *ngIf=\"iconPrefixSvg\"\r\n matPrefix\r\n [matTooltip]=\"((iconPrefixTooltip || '') | translate)\"\r\n [svgIcon]=\"iconPrefixSvg\"\r\n ></mat-icon>\r\n\r\n <i-tech-icon-button matSuffix\r\n [iconName]=\"'date_range'\"\r\n [disabled]=\"ngControl.control.disabled\"\r\n (click)=\"datePicker.open()\"\r\n [ngClass]=\"ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'\"\r\n ></i-tech-icon-button>\r\n\r\n <mat-datepicker #datePicker (closed)=\"isOpen = false;clickForFocusOut()\"\r\n (opened)=\"isOpen = true;focused = true\"></mat-datepicker>\r\n\r\n <!-- Error Messages -->\r\n <mat-error *ngIf=\"!!(ngControl.control.errors && submit)\">\r\n {{ ngControl.control | generateErrorMessages : label : defaultPatternKey }}\r\n </mat-error>\r\n\r\n <!-- Helper Text -->\r\n <mat-hint *ngIf=\"!(!!(ngControl.control.errors && submit)) && hintText\"\r\n [ngClass]=\"{'readonly-color' : ngControl.control.disabled}\"\r\n >\r\n {{ hintText | translate }}\r\n </mat-hint>\r\n\r\n </mat-form-field>\r\n</div>\r\n" }]
|
|
1004
|
+
}], ctorParameters: () => [{ type: InputService }], propDecorators: { label: [{
|
|
1005
|
+
type: Input
|
|
1006
|
+
}], defaultPatternKey: [{
|
|
1007
|
+
type: Input
|
|
1008
|
+
}], required: [{
|
|
1009
|
+
type: Input
|
|
1010
|
+
}], hintText: [{
|
|
1011
|
+
type: Input
|
|
1012
|
+
}], placeholder: [{
|
|
1013
|
+
type: Input
|
|
1014
|
+
}], iconPrefix: [{
|
|
1015
|
+
type: Input
|
|
1016
|
+
}], iconPrefixSvg: [{
|
|
1017
|
+
type: Input
|
|
1018
|
+
}], iconPrefixTooltip: [{
|
|
1019
|
+
type: Input
|
|
1020
|
+
}], iconPrefixColor: [{
|
|
1021
|
+
type: Input
|
|
1022
|
+
}], iconPrefixVariant: [{
|
|
1023
|
+
type: Input
|
|
1024
|
+
}], valueChangeEmit: [{
|
|
1025
|
+
type: Input
|
|
1026
|
+
}], submit: [{
|
|
1027
|
+
type: Input
|
|
1028
|
+
}], inputElement: [{
|
|
1029
|
+
type: ViewChild,
|
|
1030
|
+
args: ['inputElement']
|
|
1031
|
+
}], valueChangeEmitter: [{
|
|
1032
|
+
type: Output
|
|
1033
|
+
}] } });
|
|
1034
|
+
|
|
1035
|
+
class DateRangeDatepickerComponent {
|
|
1036
|
+
constructor() {
|
|
1037
|
+
this.submit = false;
|
|
1038
|
+
this.clearValue = true;
|
|
1039
|
+
this.errorMessage = '';
|
|
1040
|
+
this.hintText = 'MM/DD/YYYY - MM/DD/YYYY';
|
|
1041
|
+
this.resetForm = new EventEmitter();
|
|
1042
|
+
this.selectionChange = new EventEmitter();
|
|
1043
|
+
this.isOpen = false;
|
|
1044
|
+
this.dateRangeForm = new UntypedFormGroup({
|
|
1045
|
+
startDate: new UntypedFormControl('', [Validators.maxLength(10)]),
|
|
1046
|
+
endDate: new UntypedFormControl('', [Validators.maxLength(10)]),
|
|
1047
|
+
});
|
|
1048
|
+
this.customErrorStateMatcher = {
|
|
1049
|
+
isErrorState: (control, form) => {
|
|
1050
|
+
return !!(control && control.invalid && this.submit);
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
ngAfterViewInit() {
|
|
1055
|
+
setTimeout(() => {
|
|
1056
|
+
if (this.defaultValue?.length) {
|
|
1057
|
+
this.dateRangeForm.patchValue({
|
|
1058
|
+
startDate: this.defaultValue[0],
|
|
1059
|
+
endDate: this.defaultValue[1]
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
ngOnChanges(changes) {
|
|
1065
|
+
setTimeout(() => {
|
|
1066
|
+
if (changes['value']?.currentValue && !(changes['value'].currentValue[0])) {
|
|
1067
|
+
if (this.picker) {
|
|
1068
|
+
this.dateRangeForm.reset();
|
|
1069
|
+
this.picker.select(null);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
else if (changes['value'] && this.value?.length) {
|
|
1073
|
+
this.dateRangeForm.setValue({
|
|
1074
|
+
startDate: new Date(this.value[0] || ''),
|
|
1075
|
+
endDate: new Date(this.value[1] || '')
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
}, 10);
|
|
1079
|
+
}
|
|
1080
|
+
clickForFocusOut() {
|
|
1081
|
+
setTimeout(() => {
|
|
1082
|
+
this.min.nativeElement.focus();
|
|
1083
|
+
this.min.nativeElement.blur();
|
|
1084
|
+
}, 120);
|
|
1085
|
+
}
|
|
1086
|
+
setDate(value, element) {
|
|
1087
|
+
this.selectionChange.emit(value);
|
|
1088
|
+
element.blur();
|
|
1089
|
+
}
|
|
1090
|
+
keyEventHandler(event, value, element) {
|
|
1091
|
+
if (event.code === 'Enter') {
|
|
1092
|
+
this.setDate(value, element);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DateRangeDatepickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1096
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: DateRangeDatepickerComponent, isStandalone: true, selector: "app-mat-range-datepicker", inputs: { label: "label", placeholder: "placeholder", value: "value", defaultValue: "defaultValue", key: "key", submit: "submit", clearValue: "clearValue", errorMessage: "errorMessage", onePlaceholder: "onePlaceholder", hintText: "hintText" }, outputs: { resetForm: "resetForm", selectionChange: "selectionChange" }, viewQueries: [{ propertyName: "picker", first: true, predicate: ["picker"], descendants: true }, { propertyName: "min", first: true, predicate: ["min"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"flex_column relative mat-date-range-input\"\r\n [formGroup]=\"dateRangeForm\"\r\n>\r\n <div class=\"w-100\">\r\n <mat-label>\r\n {{(label || '') | translate}}\r\n </mat-label>\r\n </div>\r\n <mat-form-field appearance=\"outline\" [ngClass]=\"{'opened_calendar': isOpen}\">\r\n <mat-date-range-input [rangePicker]=\"picker\">\r\n <input formControlName=\"startDate\"\r\n [placeholder]=\" (placeholder ? placeholder[0] : 'Start Date')\"\r\n [title]=\"key ? key.title : 'Date'\"\r\n [attr.data-accessKey]=\"key ? key.start : 'minStartDate'\"\r\n [attr.data-parentKey]=\"key ? (key.start + '_' + key.end) : 'minStartDate_maxEndDate'\"\r\n matStartDate #min\r\n dateMask\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n [rangeFormControl]=\"dateRangeForm.controls['startDate']\"\r\n (keydown)=\"keyEventHandler($event,[min.value, max.value || null],min)\"\r\n (dateChange)=\"setDate([min.value, max.value || null],min)\">\r\n <input formControlName=\"endDate\"\r\n [placeholder]=\"(placeholder ? placeholder[1] : 'End Date')\"\r\n [title]=\"key ? key.title : 'Date'\"\r\n [attr.data-accessKey]=\"key ? key.end : 'maxEndDate'\"\r\n [attr.data-parentKey]=\"key ? (key.start + '_' + key.end) : 'minStartDate_maxEndDate'\"\r\n matEndDate #max\r\n dateMask\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n [rangeFormControl]=\"dateRangeForm.controls['endDate']\"\r\n (keydown)=\"keyEventHandler($event,[min.value, max.value || null],max)\"\r\n (dateChange)=\"setDate([min.value, max.value || null],max)\">\r\n </mat-date-range-input>\r\n <i-tech-icon-button matSuffix\r\n [iconName]=\"'cancel'\"\r\n (buttonClick)=\"selectionChange.emit([null, null])\"\r\n class=\"default-form-icon-color\"\r\n *ngIf=\"dateRangeForm.get('startDate')?.value && this.dateRangeForm.get('endDate')?.value\"\r\n ></i-tech-icon-button>\r\n <i-tech-icon-button matSuffix [iconName]=\"'date_range'\" (buttonClick)=\"picker.open()\" class=\"default-form-icon-color\"></i-tech-icon-button>\r\n <mat-date-range-picker #picker (closed)=\"isOpen = false;clickForFocusOut()\" (opened)=\"isOpen = true\"></mat-date-range-picker>\r\n <mat-hint *ngIf=\"hintText && !errorMessage\">{{hintText}}</mat-hint>\r\n </mat-form-field>\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i3$1.MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "directive", type: i3$1.MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: i3$1.MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: i3$1.MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "component", type: IconButtonComponent, selector: "i-tech-icon-button", inputs: ["size", "type", "iconSvg", "iconName", "tooltip", "disabled"], outputs: ["buttonClick"] }, { kind: "directive", type: DateMaskDirective, selector: "[dateMask]", inputs: ["maskType", "matDatepicker", "rangeFormControl"] }] }); }
|
|
1097
|
+
}
|
|
1098
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: DateRangeDatepickerComponent, decorators: [{
|
|
1099
|
+
type: Component,
|
|
1100
|
+
args: [{ selector: 'app-mat-range-datepicker', imports: [
|
|
1101
|
+
MatFormFieldModule,
|
|
1102
|
+
ReactiveFormsModule,
|
|
1103
|
+
MatDatepickerModule,
|
|
1104
|
+
NgClass, NgIf,
|
|
1105
|
+
TranslateModule,
|
|
1106
|
+
IconButtonComponent, DateMaskDirective
|
|
1107
|
+
], standalone: true, template: "<div class=\"flex_column relative mat-date-range-input\"\r\n [formGroup]=\"dateRangeForm\"\r\n>\r\n <div class=\"w-100\">\r\n <mat-label>\r\n {{(label || '') | translate}}\r\n </mat-label>\r\n </div>\r\n <mat-form-field appearance=\"outline\" [ngClass]=\"{'opened_calendar': isOpen}\">\r\n <mat-date-range-input [rangePicker]=\"picker\">\r\n <input formControlName=\"startDate\"\r\n [placeholder]=\" (placeholder ? placeholder[0] : 'Start Date')\"\r\n [title]=\"key ? key.title : 'Date'\"\r\n [attr.data-accessKey]=\"key ? key.start : 'minStartDate'\"\r\n [attr.data-parentKey]=\"key ? (key.start + '_' + key.end) : 'minStartDate_maxEndDate'\"\r\n matStartDate #min\r\n dateMask\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n [rangeFormControl]=\"dateRangeForm.controls['startDate']\"\r\n (keydown)=\"keyEventHandler($event,[min.value, max.value || null],min)\"\r\n (dateChange)=\"setDate([min.value, max.value || null],min)\">\r\n <input formControlName=\"endDate\"\r\n [placeholder]=\"(placeholder ? placeholder[1] : 'End Date')\"\r\n [title]=\"key ? key.title : 'Date'\"\r\n [attr.data-accessKey]=\"key ? key.end : 'maxEndDate'\"\r\n [attr.data-parentKey]=\"key ? (key.start + '_' + key.end) : 'minStartDate_maxEndDate'\"\r\n matEndDate #max\r\n dateMask\r\n [errorStateMatcher]=\"customErrorStateMatcher\"\r\n [rangeFormControl]=\"dateRangeForm.controls['endDate']\"\r\n (keydown)=\"keyEventHandler($event,[min.value, max.value || null],max)\"\r\n (dateChange)=\"setDate([min.value, max.value || null],max)\">\r\n </mat-date-range-input>\r\n <i-tech-icon-button matSuffix\r\n [iconName]=\"'cancel'\"\r\n (buttonClick)=\"selectionChange.emit([null, null])\"\r\n class=\"default-form-icon-color\"\r\n *ngIf=\"dateRangeForm.get('startDate')?.value && this.dateRangeForm.get('endDate')?.value\"\r\n ></i-tech-icon-button>\r\n <i-tech-icon-button matSuffix [iconName]=\"'date_range'\" (buttonClick)=\"picker.open()\" class=\"default-form-icon-color\"></i-tech-icon-button>\r\n <mat-date-range-picker #picker (closed)=\"isOpen = false;clickForFocusOut()\" (opened)=\"isOpen = true\"></mat-date-range-picker>\r\n <mat-hint *ngIf=\"hintText && !errorMessage\">{{hintText}}</mat-hint>\r\n </mat-form-field>\r\n</div>\r\n" }]
|
|
1108
|
+
}], propDecorators: { label: [{
|
|
1109
|
+
type: Input
|
|
1110
|
+
}], placeholder: [{
|
|
1111
|
+
type: Input
|
|
1112
|
+
}], value: [{
|
|
1113
|
+
type: Input
|
|
1114
|
+
}], defaultValue: [{
|
|
1115
|
+
type: Input
|
|
1116
|
+
}], key: [{
|
|
1117
|
+
type: Input
|
|
1118
|
+
}], submit: [{
|
|
1119
|
+
type: Input
|
|
1120
|
+
}], clearValue: [{
|
|
1121
|
+
type: Input
|
|
1122
|
+
}], errorMessage: [{
|
|
1123
|
+
type: Input
|
|
1124
|
+
}], onePlaceholder: [{
|
|
1125
|
+
type: Input
|
|
1126
|
+
}], hintText: [{
|
|
1127
|
+
type: Input
|
|
1128
|
+
}], resetForm: [{
|
|
1129
|
+
type: Output
|
|
1130
|
+
}], selectionChange: [{
|
|
1131
|
+
type: Output
|
|
1132
|
+
}], picker: [{
|
|
1133
|
+
type: ViewChild,
|
|
1134
|
+
args: ['picker']
|
|
1135
|
+
}], min: [{
|
|
1136
|
+
type: ViewChild,
|
|
1137
|
+
args: ['min']
|
|
1138
|
+
}] } });
|
|
1139
|
+
|
|
1140
|
+
/*
|
|
1141
|
+
* Public API Surface of shared-components
|
|
1142
|
+
*/
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Generated bundle index. Do not edit.
|
|
1146
|
+
*/
|
|
1147
|
+
|
|
1148
|
+
export { ArrayToStringPipe, AutocompleteSelectComponent, ButtonComponent, ButtonType, ClearValueComponent, DatePickerComponent, DateRangeDatepickerComponent, GenerateErrorMessagesPipe, GetValueByKeyFromObjectPipe, IconButtonComponent, InputMaskDirective, InputService, TextInputComponent };
|
|
1149
|
+
//# sourceMappingURL=i-tech-shared-components.mjs.map
|