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
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<div class="flex_column relative mat-date-range-input" *ngIf="ngControl" [ngClass]="{'check_requirements': submit}">
|
|
2
|
-
<div class="w-100">
|
|
3
|
-
<mat-label [ngClass]="{
|
|
4
|
-
'readonly-color' : ngControl.control.disabled,
|
|
5
|
-
'invalid-label-color': !!(ngControl.control.errors && submit)
|
|
6
|
-
}">
|
|
7
|
-
{{ label | translate }}
|
|
8
|
-
</mat-label>
|
|
9
|
-
<span *ngIf="required" class="required-input" [ngClass]="{'readonly-color' : ngControl.control.disabled}">*</span>
|
|
10
|
-
</div>
|
|
11
|
-
<mat-form-field appearance="outline" [ngClass]="{'opened_calendar': isOpen}"
|
|
12
|
-
[class.readonly-field]="ngControl.control.disabled">
|
|
13
|
-
<input matInput #inputElement
|
|
14
|
-
type="text"
|
|
15
|
-
[formControl]="ngControl.control"
|
|
16
|
-
[placeholder]="placeholder | translate"
|
|
17
|
-
dateMask
|
|
18
|
-
[matDatepicker]="datePicker"
|
|
19
|
-
[errorStateMatcher]="customErrorStateMatcher"
|
|
20
|
-
(focus)="focused = true"
|
|
21
|
-
(click)="datePicker.open();"
|
|
22
|
-
(dateChange)="emitChange()"
|
|
23
|
-
>
|
|
24
|
-
|
|
25
|
-
<mat-icon *ngIf="iconPrefix"
|
|
26
|
-
matPrefix
|
|
27
|
-
[matTooltip]="((iconPrefixTooltip || '') | translate)"
|
|
28
|
-
[style.color]="iconPrefixColor"
|
|
29
|
-
>{{ iconPrefix }}
|
|
30
|
-
</mat-icon>
|
|
31
|
-
|
|
32
|
-
<mat-icon *ngIf="iconPrefixSvg"
|
|
33
|
-
matPrefix
|
|
34
|
-
[matTooltip]="((iconPrefixTooltip || '') | translate)"
|
|
35
|
-
[svgIcon]="iconPrefixSvg"
|
|
36
|
-
></mat-icon>
|
|
37
|
-
|
|
38
|
-
<i-tech-icon-button matSuffix
|
|
39
|
-
[iconName]="'date_range'"
|
|
40
|
-
[disabled]="ngControl.control.disabled"
|
|
41
|
-
(click)="datePicker.open()"
|
|
42
|
-
[ngClass]="ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'"
|
|
43
|
-
></i-tech-icon-button>
|
|
44
|
-
|
|
45
|
-
<mat-datepicker #datePicker (closed)="isOpen = false;clickForFocusOut()"
|
|
46
|
-
(opened)="isOpen = true;focused = true"></mat-datepicker>
|
|
47
|
-
|
|
48
|
-
<!-- Error Messages -->
|
|
49
|
-
<mat-error *ngIf="!!(ngControl.control.errors && submit)">
|
|
50
|
-
{{ ngControl.control | generateErrorMessages : label : defaultPatternKey }}
|
|
51
|
-
</mat-error>
|
|
52
|
-
|
|
53
|
-
<!-- Helper Text -->
|
|
54
|
-
<mat-hint *ngIf="!(!!(ngControl.control.errors && submit)) && hintText"
|
|
55
|
-
[ngClass]="{'readonly-color' : ngControl.control.disabled}"
|
|
56
|
-
>
|
|
57
|
-
{{ hintText | translate }}
|
|
58
|
-
</mat-hint>
|
|
59
|
-
|
|
60
|
-
</mat-form-field>
|
|
61
|
-
</div>
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {Component, ElementRef, EventEmitter, Input, Output, ViewChild} from '@angular/core';
|
|
2
|
-
import {FormControlName, ReactiveFormsModule} from "@angular/forms";
|
|
3
|
-
import { InputService } from '../../services/input.service';
|
|
4
|
-
import {NgClass, NgIf} from "@angular/common";
|
|
5
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
6
|
-
import {MatFormFieldModule} from "@angular/material/form-field";
|
|
7
|
-
import {MatDatepickerModule} from "@angular/material/datepicker";
|
|
8
|
-
import {MatInput} from "@angular/material/input";
|
|
9
|
-
import {MatTooltip} from "@angular/material/tooltip";
|
|
10
|
-
import {MatIconModule} from "@angular/material/icon";
|
|
11
|
-
import {DateMaskDirective} from "../../directives/date-mask.directive";
|
|
12
|
-
import {GenerateErrorMessagesPipe} from "../../pipes/generate-error-messages.pipe";
|
|
13
|
-
import {IconButtonComponent} from "../icon-button/icon-button.component";
|
|
14
|
-
|
|
15
|
-
@Component({
|
|
16
|
-
selector: 'i-tech-date-picker',
|
|
17
|
-
templateUrl: './date-picker.component.html',
|
|
18
|
-
imports: [
|
|
19
|
-
NgClass, NgIf,
|
|
20
|
-
TranslateModule,
|
|
21
|
-
ReactiveFormsModule,
|
|
22
|
-
MatFormFieldModule,
|
|
23
|
-
MatDatepickerModule,
|
|
24
|
-
MatInput,
|
|
25
|
-
MatTooltip,
|
|
26
|
-
MatIconModule,
|
|
27
|
-
DateMaskDirective,
|
|
28
|
-
GenerateErrorMessagesPipe, IconButtonComponent
|
|
29
|
-
],
|
|
30
|
-
standalone: true
|
|
31
|
-
})
|
|
32
|
-
export class DatePickerComponent {
|
|
33
|
-
@Input() label: string = '';
|
|
34
|
-
@Input() defaultPatternKey!: string ;
|
|
35
|
-
@Input() required: boolean = false;
|
|
36
|
-
@Input() hintText: string = '';
|
|
37
|
-
@Input() placeholder: string = 'MM/DD/YYYY';
|
|
38
|
-
@Input() iconPrefix?: string;
|
|
39
|
-
@Input() iconPrefixSvg?: string;
|
|
40
|
-
@Input() iconPrefixTooltip?: string;
|
|
41
|
-
@Input() iconPrefixColor?: string;
|
|
42
|
-
@Input() iconPrefixVariant?: string;
|
|
43
|
-
@Input() valueChangeEmit?: boolean;
|
|
44
|
-
|
|
45
|
-
@Input() submit: boolean = false;
|
|
46
|
-
@ViewChild('inputElement') inputElement!: ElementRef;
|
|
47
|
-
@Output() valueChangeEmitter = new EventEmitter<void>();
|
|
48
|
-
|
|
49
|
-
isOpen = false;
|
|
50
|
-
focused = false;
|
|
51
|
-
|
|
52
|
-
ngControl: FormControlName;
|
|
53
|
-
|
|
54
|
-
constructor(private inputService: InputService) {
|
|
55
|
-
this.ngControl = this.inputService.injectNgControl() as FormControlName;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
emitChange(): void {
|
|
59
|
-
if (!this.valueChangeEmit) { return; }
|
|
60
|
-
this.valueChangeEmitter.emit();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
clickForFocusOut(): void {
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
this.inputElement.nativeElement.focus();
|
|
66
|
-
this.inputElement.nativeElement.blur();
|
|
67
|
-
},120)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
customErrorStateMatcher = {
|
|
71
|
-
isErrorState: (control: any, form: any): boolean => {
|
|
72
|
-
return !!(control && control.invalid && this.submit);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<div class="flex_column relative mat-date-range-input"
|
|
2
|
-
[formGroup]="dateRangeForm"
|
|
3
|
-
>
|
|
4
|
-
<div class="w-100">
|
|
5
|
-
<mat-label>
|
|
6
|
-
{{(label || '') | translate}}
|
|
7
|
-
</mat-label>
|
|
8
|
-
</div>
|
|
9
|
-
<mat-form-field appearance="outline" [ngClass]="{'opened_calendar': isOpen}">
|
|
10
|
-
<mat-date-range-input [rangePicker]="picker">
|
|
11
|
-
<input formControlName="startDate"
|
|
12
|
-
[placeholder]=" (placeholder ? placeholder[0] : 'Start Date')"
|
|
13
|
-
[title]="key ? key.title : 'Date'"
|
|
14
|
-
[attr.data-accessKey]="key ? key.start : 'minStartDate'"
|
|
15
|
-
[attr.data-parentKey]="key ? (key.start + '_' + key.end) : 'minStartDate_maxEndDate'"
|
|
16
|
-
matStartDate #min
|
|
17
|
-
dateMask
|
|
18
|
-
[errorStateMatcher]="customErrorStateMatcher"
|
|
19
|
-
[rangeFormControl]="dateRangeForm.controls['startDate']"
|
|
20
|
-
(keydown)="keyEventHandler($event,[min.value, max.value || null],min)"
|
|
21
|
-
(dateChange)="setDate([min.value, max.value || null],min)">
|
|
22
|
-
<input formControlName="endDate"
|
|
23
|
-
[placeholder]="(placeholder ? placeholder[1] : 'End Date')"
|
|
24
|
-
[title]="key ? key.title : 'Date'"
|
|
25
|
-
[attr.data-accessKey]="key ? key.end : 'maxEndDate'"
|
|
26
|
-
[attr.data-parentKey]="key ? (key.start + '_' + key.end) : 'minStartDate_maxEndDate'"
|
|
27
|
-
matEndDate #max
|
|
28
|
-
dateMask
|
|
29
|
-
[errorStateMatcher]="customErrorStateMatcher"
|
|
30
|
-
[rangeFormControl]="dateRangeForm.controls['endDate']"
|
|
31
|
-
(keydown)="keyEventHandler($event,[min.value, max.value || null],max)"
|
|
32
|
-
(dateChange)="setDate([min.value, max.value || null],max)">
|
|
33
|
-
</mat-date-range-input>
|
|
34
|
-
<i-tech-icon-button matSuffix
|
|
35
|
-
[iconName]="'cancel'"
|
|
36
|
-
(buttonClick)="selectionChange.emit([null, null])"
|
|
37
|
-
class="default-form-icon-color"
|
|
38
|
-
*ngIf="dateRangeForm.get('startDate')?.value && this.dateRangeForm.get('endDate')?.value"
|
|
39
|
-
></i-tech-icon-button>
|
|
40
|
-
<i-tech-icon-button matSuffix [iconName]="'date_range'" (buttonClick)="picker.open()" class="default-form-icon-color"></i-tech-icon-button>
|
|
41
|
-
<mat-date-range-picker #picker (closed)="isOpen = false;clickForFocusOut()" (opened)="isOpen = true"></mat-date-range-picker>
|
|
42
|
-
<mat-hint *ngIf="hintText && !errorMessage">{{hintText}}</mat-hint>
|
|
43
|
-
</mat-form-field>
|
|
44
|
-
</div>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AfterViewInit,
|
|
3
|
-
Component, ElementRef,
|
|
4
|
-
EventEmitter,
|
|
5
|
-
Input,
|
|
6
|
-
OnChanges,
|
|
7
|
-
Output,
|
|
8
|
-
SimpleChanges,
|
|
9
|
-
ViewChild
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import {MatDatepickerModule, MatDateRangePicker} from "@angular/material/datepicker";
|
|
12
|
-
import {ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators} from "@angular/forms";
|
|
13
|
-
import {MatFormFieldModule} from "@angular/material/form-field";
|
|
14
|
-
import {NgClass, NgIf} from "@angular/common";
|
|
15
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
16
|
-
import {IconButtonComponent} from "../icon-button/icon-button.component";
|
|
17
|
-
import {DateMaskDirective} from "../../directives/date-mask.directive";
|
|
18
|
-
|
|
19
|
-
@Component({
|
|
20
|
-
selector: 'app-mat-range-datepicker',
|
|
21
|
-
templateUrl: './date-range-datepicker.component.html',
|
|
22
|
-
imports: [
|
|
23
|
-
MatFormFieldModule,
|
|
24
|
-
ReactiveFormsModule,
|
|
25
|
-
MatDatepickerModule,
|
|
26
|
-
NgClass, NgIf,
|
|
27
|
-
TranslateModule,
|
|
28
|
-
IconButtonComponent, DateMaskDirective
|
|
29
|
-
],
|
|
30
|
-
standalone: true
|
|
31
|
-
})
|
|
32
|
-
export class DateRangeDatepickerComponent implements OnChanges, AfterViewInit {
|
|
33
|
-
@Input() label?: string;
|
|
34
|
-
@Input() placeholder?: Array<string>;
|
|
35
|
-
@Input() value?: Array<string | null>;
|
|
36
|
-
@Input() defaultValue?: Array<Date>;
|
|
37
|
-
@Input() key?: {start: string, end: string, title: string};
|
|
38
|
-
@Input() submit = false;
|
|
39
|
-
@Input() clearValue = true;
|
|
40
|
-
@Input() errorMessage = '';
|
|
41
|
-
@Input() onePlaceholder?: string;
|
|
42
|
-
@Input() hintText: string = 'MM/DD/YYYY - MM/DD/YYYY';
|
|
43
|
-
@Output() resetForm = new EventEmitter<any>();
|
|
44
|
-
@Output() selectionChange = new EventEmitter<any>();
|
|
45
|
-
@ViewChild('picker') picker!: MatDateRangePicker<any>;
|
|
46
|
-
@ViewChild('min') min!: ElementRef;
|
|
47
|
-
isOpen = false;
|
|
48
|
-
|
|
49
|
-
dateRangeForm = new UntypedFormGroup({
|
|
50
|
-
startDate: new UntypedFormControl('', [Validators.maxLength(10)]),
|
|
51
|
-
endDate: new UntypedFormControl('', [Validators.maxLength(10)]),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
ngAfterViewInit(): void {
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
if (this.defaultValue?.length) {
|
|
57
|
-
this.dateRangeForm.patchValue({
|
|
58
|
-
startDate: this.defaultValue[0],
|
|
59
|
-
endDate: this.defaultValue[1]
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
66
|
-
setTimeout(() => {
|
|
67
|
-
if (changes['value']?.currentValue && !(changes['value'].currentValue[0])) {
|
|
68
|
-
if (this.picker) {
|
|
69
|
-
this.dateRangeForm.reset();
|
|
70
|
-
this.picker.select(null)
|
|
71
|
-
}
|
|
72
|
-
} else if (changes['value'] && this.value?.length) {
|
|
73
|
-
this.dateRangeForm.setValue({
|
|
74
|
-
startDate: new Date(this.value[0] || ''),
|
|
75
|
-
endDate: new Date(this.value[1] || '')
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
}, 10)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
clickForFocusOut(): void {
|
|
82
|
-
setTimeout(() => {
|
|
83
|
-
this.min.nativeElement.focus();
|
|
84
|
-
this.min.nativeElement.blur();
|
|
85
|
-
},120)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
customErrorStateMatcher = {
|
|
89
|
-
isErrorState: (control: any, form: any): boolean => {
|
|
90
|
-
return !!(control && control.invalid && this.submit);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
setDate(value: Array<string | null>, element: any): void {
|
|
95
|
-
this.selectionChange.emit(value);
|
|
96
|
-
element.blur();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
keyEventHandler(event: KeyboardEvent,value: Array<string | null>, element: any): void {
|
|
100
|
-
if (event.code === 'Enter') {
|
|
101
|
-
this.setDate(value,element)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<button
|
|
2
|
-
*ngIf="['tonal','standard'].includes(type)"
|
|
3
|
-
mat-icon-button
|
|
4
|
-
[ngClass]="{small: size === 'small', tonal: type === 'tonal', standard: type === 'standard'}"
|
|
5
|
-
[matTooltip]="tooltip | translate"
|
|
6
|
-
[matTooltipDisabled]="!tooltip"
|
|
7
|
-
[disabled]="disabled || false"
|
|
8
|
-
(click)="onClick($event)"
|
|
9
|
-
>
|
|
10
|
-
<mat-icon *ngIf="iconSvg" [svgIcon]="iconSvg"></mat-icon>
|
|
11
|
-
<mat-icon *ngIf="iconName">{{iconName}}</mat-icon>
|
|
12
|
-
</button>
|
|
13
|
-
|
|
14
|
-
<button
|
|
15
|
-
*ngIf="type === 'filled'"
|
|
16
|
-
mat-fab
|
|
17
|
-
class="filled"
|
|
18
|
-
[ngClass]="{small: size === 'small'}"
|
|
19
|
-
[matTooltip]="tooltip | translate"
|
|
20
|
-
[matTooltipDisabled]="!tooltip"
|
|
21
|
-
[color]="'primary'"
|
|
22
|
-
[disabled]="disabled || false"
|
|
23
|
-
(click)="onClick($event)"
|
|
24
|
-
>
|
|
25
|
-
<mat-icon *ngIf="iconSvg" [svgIcon]="iconSvg"></mat-icon>
|
|
26
|
-
<mat-icon *ngIf="iconName">{{iconName}}</mat-icon>
|
|
27
|
-
</button>
|
|
File without changes
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
|
2
|
-
import {MatFabButton, MatIconButton} from "@angular/material/button";
|
|
3
|
-
import {NgClass, NgIf} from "@angular/common";
|
|
4
|
-
import {MatTooltip} from "@angular/material/tooltip";
|
|
5
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
6
|
-
import {MatIcon} from "@angular/material/icon";
|
|
7
|
-
|
|
8
|
-
@Component({
|
|
9
|
-
selector: 'i-tech-icon-button',
|
|
10
|
-
templateUrl: './icon-button.component.html',
|
|
11
|
-
styleUrl: './icon-button.component.scss',
|
|
12
|
-
imports: [
|
|
13
|
-
MatIconButton,
|
|
14
|
-
NgClass,
|
|
15
|
-
MatTooltip,
|
|
16
|
-
TranslateModule,
|
|
17
|
-
MatIcon,
|
|
18
|
-
MatFabButton,
|
|
19
|
-
NgIf
|
|
20
|
-
],
|
|
21
|
-
standalone: true
|
|
22
|
-
})
|
|
23
|
-
export class IconButtonComponent {
|
|
24
|
-
@Input() size: 'medium' | 'small' = 'medium';
|
|
25
|
-
@Input() type: 'standard' | 'filled' | 'tonal' = 'tonal';
|
|
26
|
-
@Input() iconSvg!: string;
|
|
27
|
-
@Input() iconName!: string;
|
|
28
|
-
@Input() tooltip!: string;
|
|
29
|
-
@Input() disabled!: boolean;
|
|
30
|
-
@Output() buttonClick = new EventEmitter<void>();
|
|
31
|
-
|
|
32
|
-
onClick(event: MouseEvent): void {
|
|
33
|
-
if (!this.disabled) {
|
|
34
|
-
this.buttonClick.emit();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<div [class]="iconName || iconSvg ? 'trailing-icon' : ''">
|
|
2
|
-
|
|
3
|
-
<mat-chip
|
|
4
|
-
[class]="'label_' + color"
|
|
5
|
-
[ngClass]="{bordered: bordered, small: size === 'small'}"
|
|
6
|
-
[matTooltip]="(tooltip || '') | translate"
|
|
7
|
-
[disableRipple]="disableRipple"
|
|
8
|
-
>
|
|
9
|
-
<div class="flex_align_center flex_gap">
|
|
10
|
-
<span>{{text | translate}}</span>
|
|
11
|
-
<mat-icon *ngIf="iconName">{{iconName}}</mat-icon>
|
|
12
|
-
<mat-icon *ngIf="iconSvg" [svgIcon]="iconSvg"></mat-icon>
|
|
13
|
-
</div>
|
|
14
|
-
</mat-chip>
|
|
15
|
-
</div>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {Component, Input} from '@angular/core';
|
|
2
|
-
import {LabelTypeEnum} from "../../interfaces/label-type.enum";
|
|
3
|
-
import {MatChip} from "@angular/material/chips";
|
|
4
|
-
import {MatTooltip} from "@angular/material/tooltip";
|
|
5
|
-
import {NgClass} from "@angular/common";
|
|
6
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
7
|
-
import {MatIcon} from "@angular/material/icon";
|
|
8
|
-
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'i-tech-label',
|
|
11
|
-
templateUrl: './label.component.html',
|
|
12
|
-
styleUrls: [],
|
|
13
|
-
imports: [
|
|
14
|
-
MatChip,
|
|
15
|
-
MatTooltip,
|
|
16
|
-
NgClass,
|
|
17
|
-
TranslateModule,
|
|
18
|
-
MatIcon
|
|
19
|
-
],
|
|
20
|
-
standalone: true
|
|
21
|
-
})
|
|
22
|
-
export class LabelComponent {
|
|
23
|
-
@Input() color: LabelTypeEnum = LabelTypeEnum.primary;
|
|
24
|
-
@Input() text!: string;
|
|
25
|
-
@Input() bordered: boolean = false;
|
|
26
|
-
@Input() tooltip?:string;
|
|
27
|
-
@Input() size: 'small' | 'standard' = 'standard';
|
|
28
|
-
@Input() iconName?: string;
|
|
29
|
-
@Input() iconSvg?: string;
|
|
30
|
-
@Input() disableRipple: boolean = false;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<div class="custom_dropdown_container"
|
|
2
|
-
[attr.data-name]="dataName"
|
|
3
|
-
[ngClass]="containerClass"
|
|
4
|
-
>
|
|
5
|
-
<i-tech-button
|
|
6
|
-
[matMenuTriggerFor]="beforeMenu"
|
|
7
|
-
[type]="ButtonType.OUTLINE"
|
|
8
|
-
[fontIcon]="'keyboard_arrow_down'"
|
|
9
|
-
[text]="(text || '') "
|
|
10
|
-
(menuOpened)="matMenuState = true"
|
|
11
|
-
(menuClosed)="matMenuState = false"
|
|
12
|
-
[activated]="matMenuState"
|
|
13
|
-
></i-tech-button>
|
|
14
|
-
<mat-menu #beforeMenu="matMenu" [xPosition]="positionX">
|
|
15
|
-
<button mat-menu-item *ngFor="let option of menuOptions" (click)="emitEvent.emit(option.value)">
|
|
16
|
-
<mat-icon *ngIf="option.type" [svgIcon]="DropdownItemIcon[option.type]"></mat-icon>
|
|
17
|
-
<mat-label class="meu_item_label">{{(option.text || '') | translate}}</mat-label>
|
|
18
|
-
</button>
|
|
19
|
-
</mat-menu>
|
|
20
|
-
</div>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {Component, EventEmitter, Input, Output} from "@angular/core";
|
|
2
|
-
import {ButtonType} from "../../interfaces/button-types.enum";
|
|
3
|
-
import {DropdownItemIcon, DropdownSelectionType} from "../../interfaces/dropdown-selection.constants";
|
|
4
|
-
import {MatMenu, MatMenuItem, MatMenuTrigger, MenuPositionX} from "@angular/material/menu";
|
|
5
|
-
import {MatIcon} from "@angular/material/icon";
|
|
6
|
-
import {NgClass, NgForOf, NgIf} from "@angular/common";
|
|
7
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
8
|
-
import {ButtonComponent} from "../button/button.component";
|
|
9
|
-
import {MatLabel} from "@angular/material/form-field";
|
|
10
|
-
|
|
11
|
-
@Component({
|
|
12
|
-
selector: "app-menu",
|
|
13
|
-
standalone: true,
|
|
14
|
-
imports: [
|
|
15
|
-
MatMenuTrigger,
|
|
16
|
-
MatMenu,
|
|
17
|
-
MatIcon,
|
|
18
|
-
NgIf,
|
|
19
|
-
NgForOf,
|
|
20
|
-
MatMenuItem,
|
|
21
|
-
TranslateModule,
|
|
22
|
-
NgClass,
|
|
23
|
-
ButtonComponent,
|
|
24
|
-
MatLabel
|
|
25
|
-
],
|
|
26
|
-
templateUrl: "./menu.component.html",
|
|
27
|
-
styleUrls: ["./menu.component.scss"]
|
|
28
|
-
})
|
|
29
|
-
export class MenuComponent {
|
|
30
|
-
@Input() text!: string;
|
|
31
|
-
@Input() dataName!: string;
|
|
32
|
-
@Input() containerClass!: string;
|
|
33
|
-
@Input() positionX: MenuPositionX = 'before';
|
|
34
|
-
@Input() menuOptions: Array<{value: string, text: string, src?: string, class?: string,type?: DropdownSelectionType}> = [];
|
|
35
|
-
@Output() emitEvent = new EventEmitter<any>();
|
|
36
|
-
protected readonly ButtonType = ButtonType;
|
|
37
|
-
protected readonly DropdownItemIcon = DropdownItemIcon;
|
|
38
|
-
matMenuState = false;
|
|
39
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<div *ngIf="inputData && ngControl">
|
|
2
|
-
<div class="w-100">
|
|
3
|
-
<mat-label [ngClass]="{
|
|
4
|
-
'readonly-color' : inputData.readOnly || ngControl.control.disabled,
|
|
5
|
-
'invalid-label-color': !!(ngControl.control.errors && inputData.submit)
|
|
6
|
-
}"
|
|
7
|
-
*ngIf="inputData.label">
|
|
8
|
-
{{ inputData.label | translate }}
|
|
9
|
-
</mat-label>
|
|
10
|
-
<span *ngIf="inputData.required" class="required-input"
|
|
11
|
-
[ngClass]="{'readonly-color' : inputData.readOnly || ngControl.control.disabled}">*</span>
|
|
12
|
-
</div>
|
|
13
|
-
<mat-form-field appearance="outline" class="w-100"
|
|
14
|
-
[class.readonly-field]="inputData.readOnly || ngControl.control.disabled"
|
|
15
|
-
>
|
|
16
|
-
<!-- Leading Icon -->
|
|
17
|
-
<mat-icon *ngIf="inputData.iconPrefix"
|
|
18
|
-
matPrefix
|
|
19
|
-
[ngClass]="{
|
|
20
|
-
'readonly-color' : !inputData.iconPrefixColor && (inputData.readOnly || ngControl.control.disabled),
|
|
21
|
-
'default-form-icon-color' : !inputData.iconPrefixColor && !(inputData.readOnly || ngControl.control.disabled)
|
|
22
|
-
}"
|
|
23
|
-
[matTooltip]="((inputData.iconPrefixTooltip || '') | translate)"
|
|
24
|
-
[style.color]="inputData.iconPrefixColor || null"
|
|
25
|
-
>{{ inputData.iconPrefix }}
|
|
26
|
-
</mat-icon>
|
|
27
|
-
|
|
28
|
-
<mat-icon *ngIf="inputData.iconPrefixSvg"
|
|
29
|
-
matPrefix
|
|
30
|
-
[matTooltip]="((inputData.iconPrefixTooltip || '') | translate)"
|
|
31
|
-
[svgIcon]="inputData.iconPrefixSvg"
|
|
32
|
-
></mat-icon>
|
|
33
|
-
|
|
34
|
-
<!-- Input Field -->
|
|
35
|
-
<input matInput
|
|
36
|
-
*ngIf="!inputData.textarea"
|
|
37
|
-
[type]="inputData.type || 'text'"
|
|
38
|
-
[readonly]="inputData.readOnly"
|
|
39
|
-
[placeholder]="(inputData.placeholder || '') | translate"
|
|
40
|
-
[pattern]="inputData.pattern!"
|
|
41
|
-
[formControl]="ngControl.control"
|
|
42
|
-
[mask]="inputData.mask || ''"
|
|
43
|
-
[ngClass]="{'readonly-color readonly-cursor' : inputData.readOnly || ngControl.control.disabled}"
|
|
44
|
-
[inputMask]="inputData.inputMask!"
|
|
45
|
-
[errorStateMatcher]="customErrorStateMatcher"
|
|
46
|
-
(blur)="onFocusOut()"
|
|
47
|
-
>
|
|
48
|
-
|
|
49
|
-
<textarea matInput
|
|
50
|
-
*ngIf="inputData.textarea"
|
|
51
|
-
[type]="inputData.type || 'text'"
|
|
52
|
-
[readonly]="inputData.readOnly"
|
|
53
|
-
[placeholder]="(inputData.placeholder || '') | translate"
|
|
54
|
-
[pattern]="inputData.pattern!"
|
|
55
|
-
[formControl]="ngControl.control"
|
|
56
|
-
[ngClass]="{'readonly-color' : inputData.readOnly || ngControl.control.disabled}"
|
|
57
|
-
[errorStateMatcher]="customErrorStateMatcher"
|
|
58
|
-
></textarea>
|
|
59
|
-
|
|
60
|
-
<!-- Clear Icon -->
|
|
61
|
-
<i-tech-icon-button
|
|
62
|
-
*ngIf="inputData.clearable"
|
|
63
|
-
iconName="cancel"
|
|
64
|
-
matSuffix
|
|
65
|
-
[disabled]="inputData.readOnly || ngControl.control.disabled || false"
|
|
66
|
-
[ngClass]="inputData.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'"
|
|
67
|
-
(click)="clear()"
|
|
68
|
-
>
|
|
69
|
-
</i-tech-icon-button>
|
|
70
|
-
|
|
71
|
-
<!-- Trailing Icon -->
|
|
72
|
-
<i-tech-icon-button
|
|
73
|
-
*ngIf="inputData.iconSuffix"
|
|
74
|
-
[iconName]="inputData.iconSuffix"
|
|
75
|
-
[disabled]="inputData.readOnly || ngControl.control.disabled || false"
|
|
76
|
-
[ngClass]="inputData.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'"
|
|
77
|
-
matSuffix
|
|
78
|
-
>
|
|
79
|
-
</i-tech-icon-button>
|
|
80
|
-
|
|
81
|
-
<!-- Error Messages -->
|
|
82
|
-
<mat-error *ngIf="!!(ngControl.control.errors && inputData.submit)">
|
|
83
|
-
{{ ngControl.control | generateErrorMessages : (inputData.label || '') : inputData.defaultPatternKey }}
|
|
84
|
-
</mat-error>
|
|
85
|
-
|
|
86
|
-
<!-- Helper Text -->
|
|
87
|
-
<mat-hint *ngIf="!(!!(ngControl.control.errors && inputData.submit)) && inputData.hint">
|
|
88
|
-
{{ inputData.hint | translate }}
|
|
89
|
-
</mat-hint>
|
|
90
|
-
</mat-form-field>
|
|
91
|
-
</div>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output} from '@angular/core';
|
|
2
|
-
import {FormControlName, ReactiveFormsModule} from '@angular/forms';
|
|
3
|
-
import { InputService } from '../../services/input.service';
|
|
4
|
-
import {AppInputInterface} from "../../interfaces/app-input.interface";
|
|
5
|
-
import {MatFormFieldModule} from "@angular/material/form-field";
|
|
6
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
7
|
-
import {NgClass, NgIf} from "@angular/common";
|
|
8
|
-
import {MatIcon} from "@angular/material/icon";
|
|
9
|
-
import {MatTooltip} from "@angular/material/tooltip";
|
|
10
|
-
import {MatInput} from "@angular/material/input";
|
|
11
|
-
import {GenerateErrorMessagesPipe} from "../../pipes/generate-error-messages.pipe";
|
|
12
|
-
import {IconButtonComponent} from "../icon-button/icon-button.component";
|
|
13
|
-
import {InputMaskDirective} from "../../directives/input-mask.directive";
|
|
14
|
-
import {NgxMaskDirective} from "ngx-mask";
|
|
15
|
-
|
|
16
|
-
@Component({
|
|
17
|
-
selector: 'i-tech-text-input',
|
|
18
|
-
templateUrl: './text-input.component.html',
|
|
19
|
-
styleUrls: [],
|
|
20
|
-
imports: [
|
|
21
|
-
TranslateModule,
|
|
22
|
-
NgClass,
|
|
23
|
-
MatIcon,
|
|
24
|
-
MatTooltip,
|
|
25
|
-
MatInput,
|
|
26
|
-
ReactiveFormsModule,
|
|
27
|
-
NgIf,
|
|
28
|
-
GenerateErrorMessagesPipe,
|
|
29
|
-
IconButtonComponent,
|
|
30
|
-
InputMaskDirective,
|
|
31
|
-
NgxMaskDirective,
|
|
32
|
-
MatFormFieldModule
|
|
33
|
-
],
|
|
34
|
-
standalone: true
|
|
35
|
-
})
|
|
36
|
-
export class TextInputComponent {
|
|
37
|
-
@Input() set inputData(data: AppInputInterface) {
|
|
38
|
-
// If submit becomes true, mark the control as touched
|
|
39
|
-
if (data?.submit && this.ngControl.control) {
|
|
40
|
-
this.ngControl.control.markAsTouched();
|
|
41
|
-
}
|
|
42
|
-
this._inputData = data;
|
|
43
|
-
}
|
|
44
|
-
get inputData(): AppInputInterface {
|
|
45
|
-
return this._inputData;
|
|
46
|
-
}
|
|
47
|
-
@Output() focusOutEmitter = new EventEmitter<void>();
|
|
48
|
-
|
|
49
|
-
private _inputData!: AppInputInterface;
|
|
50
|
-
ngControl: FormControlName;
|
|
51
|
-
|
|
52
|
-
constructor(private inputService: InputService) {
|
|
53
|
-
this.ngControl = this.inputService.injectNgControl();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
onFocusOut(): void {
|
|
57
|
-
if (this._inputData.focusOutEmit) {
|
|
58
|
-
this.focusOutEmitter.emit();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
clear(): void {
|
|
63
|
-
if (this.ngControl) {
|
|
64
|
-
this.ngControl.control.reset();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
customErrorStateMatcher = {
|
|
69
|
-
isErrorState: (control: any, form: any): boolean => {
|
|
70
|
-
return !!(control && control.invalid && this.inputData?.submit);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
}
|