i-tech-shared-components 1.1.6 → 1.1.9
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/README.md +23 -23
- 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 +111 -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/menu/menu.component.mjs +51 -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/interfaces/dropdown-selection.constants.mjs +12 -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 +20 -0
- package/fesm2022/i-tech-shared-components.mjs +1216 -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 +35 -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/menu/menu.component.d.ts +28 -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/interfaces/dropdown-selection.constants.d.ts +10 -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} +16 -20
- package/theme/_buttons.scss +63 -63
- package/theme/_color_themes.scss +136 -136
- package/theme/_date_picker.scss +77 -77
- package/theme/_form_fields.scss +112 -112
- package/theme/_icon-button.scss +123 -123
- package/theme/_label.scss +119 -119
- package/theme/_mat-selects.scss +248 -248
- package/theme/_menu.scss +9 -9
- package/theme/_text_input.scss +28 -28
- package/theme/variables/_colors.scss +20 -20
- package/theme.scss +31 -33
- 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,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Directive,
|
|
3
|
-
ElementRef,
|
|
4
|
-
HostListener,
|
|
5
|
-
Injector, Input
|
|
6
|
-
} from '@angular/core';
|
|
7
|
-
import { NgxMaskDirective, NgxMaskService} from 'ngx-mask';
|
|
8
|
-
import {MatDatepicker} from "@angular/material/datepicker";
|
|
9
|
-
import {AbstractControl} from "@angular/forms";
|
|
10
|
-
|
|
11
|
-
@Directive({
|
|
12
|
-
selector: '[dateMask]',
|
|
13
|
-
providers:[NgxMaskDirective],
|
|
14
|
-
standalone: true
|
|
15
|
-
})
|
|
16
|
-
export class DateMaskDirective {
|
|
17
|
-
@Input() maskType!: string;
|
|
18
|
-
@Input() matDatepicker!: MatDatepicker<any>;
|
|
19
|
-
@Input() rangeFormControl!: AbstractControl;
|
|
20
|
-
|
|
21
|
-
expressions = {
|
|
22
|
-
DMY: 'M0/d0/0000',
|
|
23
|
-
DM: 'M0/d0'
|
|
24
|
-
}
|
|
25
|
-
maskService: any;
|
|
26
|
-
dateRegex = new RegExp(/^\s*(1[012]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/((?:19|20)\d{2})\s*$/);
|
|
27
|
-
dayMonthRegex = new RegExp(/^\s*(1[012]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])$/);
|
|
28
|
-
previousValue = '';
|
|
29
|
-
|
|
30
|
-
constructor(
|
|
31
|
-
private elementRef: ElementRef,
|
|
32
|
-
private injector: Injector,
|
|
33
|
-
) {
|
|
34
|
-
this.maskService = this.injector.get(NgxMaskService);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@HostListener('input')
|
|
38
|
-
onInput() {
|
|
39
|
-
let value = this.elementRef.nativeElement.value;
|
|
40
|
-
|
|
41
|
-
if (this.existsZerosInString(value)) {
|
|
42
|
-
value = this.previousValue;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const maskedValue = this.maskService.applyMask(
|
|
46
|
-
value,
|
|
47
|
-
this.maskType === 'DAY_MONTH' ? this.expressions.DM : this.expressions.DMY
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
if (this.maskType !== 'DAY_MONTH' && !isNaN(new Date(maskedValue).getTime())) {
|
|
51
|
-
if (this.matDatepicker) {
|
|
52
|
-
this.matDatepicker.select(new Date(maskedValue));
|
|
53
|
-
} else if (this.rangeFormControl) {
|
|
54
|
-
this.rangeFormControl.setValue(new Date(maskedValue));
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (isNaN(new Date(maskedValue).getTime())) {
|
|
59
|
-
this.matDatepicker.select(null)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this.elementRef.nativeElement.value = maskedValue || null;
|
|
63
|
-
this.previousValue = maskedValue || null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@HostListener('paste', ['$event'])
|
|
67
|
-
onPaste(event: ClipboardEvent) {
|
|
68
|
-
const pastedValue = event.clipboardData?.getData('text/plain');
|
|
69
|
-
if (!pastedValue) { return; }
|
|
70
|
-
if (this.maskType === 'DAY_MONTH') {
|
|
71
|
-
if (!this.dayMonthRegex.test(pastedValue)) {
|
|
72
|
-
event?.preventDefault();
|
|
73
|
-
}
|
|
74
|
-
} else {
|
|
75
|
-
if (!this.dateRegex.test(pastedValue)) {
|
|
76
|
-
event?.preventDefault();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
existsZerosInString(date: string): boolean {
|
|
82
|
-
const dateToArray = date.split('/');
|
|
83
|
-
let isValid;
|
|
84
|
-
if (this.maskType === 'DAY_MONTH') {
|
|
85
|
-
isValid = !!dateToArray.find((part: string) => part.includes('00'));
|
|
86
|
-
} else {
|
|
87
|
-
if (dateToArray.length < 3) {
|
|
88
|
-
isValid = !!dateToArray.find((part: string) => part.includes('00'));
|
|
89
|
-
} else {
|
|
90
|
-
isValid = (dateToArray[2][0] == '0') || (+dateToArray[2][0] > 2);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
return isValid;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Directive,
|
|
3
|
-
ElementRef, HostListener,
|
|
4
|
-
Input
|
|
5
|
-
} from '@angular/core';
|
|
6
|
-
|
|
7
|
-
@Directive({
|
|
8
|
-
selector: '[inputMask]',
|
|
9
|
-
standalone: true
|
|
10
|
-
})
|
|
11
|
-
export class InputMaskDirective {
|
|
12
|
-
@Input() inputMask!: 'number' | 'string';
|
|
13
|
-
@Input() set min(value: string) {
|
|
14
|
-
this.minimumValue = Number(value);
|
|
15
|
-
}
|
|
16
|
-
@Input() set max(value: string) {
|
|
17
|
-
this.maximumValue = Number(value);
|
|
18
|
-
}
|
|
19
|
-
@Input() set float(value: string) {
|
|
20
|
-
this.isFloat = value === 'true';
|
|
21
|
-
}
|
|
22
|
-
minimumValue!: number;
|
|
23
|
-
maximumValue!: number;
|
|
24
|
-
isFloat!: boolean;
|
|
25
|
-
regexFloat = new RegExp(/^([0-9]*[.])?[0-9]+$/);
|
|
26
|
-
regexOnlyNumbers = new RegExp(/^-?[0-9]+(?:\.[0-9]+)?$/);
|
|
27
|
-
|
|
28
|
-
@HostListener('paste', ['$event'])
|
|
29
|
-
onPaste(event: any) {
|
|
30
|
-
this.makeValidation(event, true)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
constructor(private elementRef: ElementRef) {
|
|
34
|
-
this.elementRef.nativeElement.addEventListener('keypress', (event: Event) => {
|
|
35
|
-
this.makeValidation(event)
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
makeValidation(event: any, fromPaste = false): boolean {
|
|
40
|
-
let value: any;
|
|
41
|
-
let newChar: any;
|
|
42
|
-
|
|
43
|
-
if (!fromPaste) {
|
|
44
|
-
newChar = String.fromCharCode(event.keyCode);
|
|
45
|
-
const cursorPos = event.target.selectionStart;
|
|
46
|
-
const inputText = event.target.value;
|
|
47
|
-
value = `${inputText.slice(0, cursorPos)}${newChar}${inputText.slice(cursorPos, inputText.length)}`;
|
|
48
|
-
} else {
|
|
49
|
-
value = event.clipboardData?.getData('text/plain');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (this.inputMask === 'number') {
|
|
53
|
-
return this.checkingForNumbers(value, event, newChar, fromPaste);
|
|
54
|
-
} else {
|
|
55
|
-
return this.checkingForTexts(value, event);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
checkingForNumbers(value: any, event: any, newChar: string, fromPaste = false): boolean {
|
|
60
|
-
if ((isNaN(this.minimumValue) || this.minimumValue < 0) && value === '-') { value = Number('-0'); }
|
|
61
|
-
|
|
62
|
-
if (this.isFloat && (newChar === '.')) {
|
|
63
|
-
value += '0';
|
|
64
|
-
}
|
|
65
|
-
if (!this.isFloat && fromPaste && value.includes('.')) {
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const regex = (this.isFloat) ? this.regexFloat : this.regexOnlyNumbers;
|
|
71
|
-
|
|
72
|
-
if (!regex.test(value) ||
|
|
73
|
-
(this.minimumValue && value < this.minimumValue) ||
|
|
74
|
-
(this.maximumValue && value > this.maximumValue)
|
|
75
|
-
) {
|
|
76
|
-
event.preventDefault();
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
checkingForTexts(value: any, event: any): boolean {
|
|
84
|
-
let regex = new RegExp(/^[A-Za-z0-9]*$/);
|
|
85
|
-
if (!regex.test(value)) {
|
|
86
|
-
event.preventDefault();
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface AppInputInterface {
|
|
2
|
-
activeStateIconUrl?: string
|
|
3
|
-
clearable?: boolean,
|
|
4
|
-
containerClass?: string,
|
|
5
|
-
datePicker?: boolean,
|
|
6
|
-
disabled?: boolean,
|
|
7
|
-
dontResetValueInClearAction?: boolean,
|
|
8
|
-
hint?: string,
|
|
9
|
-
iconPrefix?: string,
|
|
10
|
-
iconPrefixSvg?: string,
|
|
11
|
-
iconPrefixTooltip?: string,
|
|
12
|
-
iconPrefixColor?: string,
|
|
13
|
-
iconPrefixVariant?: string,
|
|
14
|
-
iconSuffix?: string,
|
|
15
|
-
// TODO - Remove iconUrl when all inputs are updated
|
|
16
|
-
iconUrl?: string,
|
|
17
|
-
inputClass?: string,
|
|
18
|
-
inputMask?: 'number' | 'string',
|
|
19
|
-
label?: string,
|
|
20
|
-
leadZeroDateTime?: boolean,
|
|
21
|
-
mask?: string,
|
|
22
|
-
pattern?: string | RegExp,
|
|
23
|
-
placeholder: string,
|
|
24
|
-
prefix?: string,
|
|
25
|
-
required?: boolean,
|
|
26
|
-
readOnly?: boolean,
|
|
27
|
-
submit: boolean,
|
|
28
|
-
textarea?: boolean,
|
|
29
|
-
type: string,
|
|
30
|
-
defaultPatternKey?: string,
|
|
31
|
-
focusOutEmit?: boolean
|
|
32
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export interface AutocompleteConfigsInterface {
|
|
2
|
-
label: string,
|
|
3
|
-
hideLabel?: boolean,
|
|
4
|
-
paginate: any,
|
|
5
|
-
paginateOnScroll?: boolean,
|
|
6
|
-
valueByKey: Array<string>,
|
|
7
|
-
valueToShowByKey: Array<string>,
|
|
8
|
-
valueToShowByParam?: Array<string | Array<string | number>>,
|
|
9
|
-
withParamSymbol?: string,
|
|
10
|
-
multiple?: boolean,
|
|
11
|
-
hideSelectAllOption?: boolean,
|
|
12
|
-
reset?: boolean,
|
|
13
|
-
search?: boolean,
|
|
14
|
-
disabled?: boolean,
|
|
15
|
-
errorMessage?: string,
|
|
16
|
-
placeholder?: string,
|
|
17
|
-
filtrationKey?: string,
|
|
18
|
-
required?: boolean,
|
|
19
|
-
hover?: string,
|
|
20
|
-
changeText?: any,
|
|
21
|
-
iconUrl?: string,
|
|
22
|
-
activeStateIconUrl?: string,
|
|
23
|
-
matIconName?: string,
|
|
24
|
-
matIconSvg?: string,
|
|
25
|
-
actions?: any,
|
|
26
|
-
blockPagination?: boolean,
|
|
27
|
-
valueById?: string,
|
|
28
|
-
showFullTextWithOptionalOnSelectedValue?: boolean,
|
|
29
|
-
iconPrefix?: string,
|
|
30
|
-
readOnly?: boolean,
|
|
31
|
-
iconSuffix?: string,
|
|
32
|
-
clearable?: boolean,
|
|
33
|
-
defaultPatternKey?: string,
|
|
34
|
-
iconPrefixTooltip?: string,
|
|
35
|
-
iconPrefixSvg?: string,
|
|
36
|
-
iconPrefixColor?: string
|
|
37
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum representing different types of buttons.
|
|
3
|
-
*/
|
|
4
|
-
export enum ButtonType {
|
|
5
|
-
/** A filled button with solid background, typically used for primary actions. */
|
|
6
|
-
FILLED = 'FILLED',
|
|
7
|
-
|
|
8
|
-
/** A tonal button with lighter background, used for secondary actions. */
|
|
9
|
-
TONAL = 'TONAL',
|
|
10
|
-
|
|
11
|
-
/** An outlined button with a border and no background. */
|
|
12
|
-
OUTLINE = 'OUTLINE',
|
|
13
|
-
|
|
14
|
-
/** A text button with no background or border, ideal for minimal UI. */
|
|
15
|
-
TEXT = 'TEXT',
|
|
16
|
-
|
|
17
|
-
/** A warning button with special styling to indicate caution or alert actions. */
|
|
18
|
-
WARNING = 'WARNING',
|
|
19
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export enum DropdownSelectionType {
|
|
2
|
-
UPLOAD = "UPLOAD",
|
|
3
|
-
DOWNLOAD = "DOWNLOAD",
|
|
4
|
-
BLANK = "BLANK"
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const DropdownItemIcon = {
|
|
8
|
-
[DropdownSelectionType.UPLOAD]: 'upload',
|
|
9
|
-
[DropdownSelectionType.DOWNLOAD]: 'download',
|
|
10
|
-
[DropdownSelectionType.BLANK]: 'blank',
|
|
11
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export enum LabelTypeEnum {
|
|
2
|
-
'purple' = 'purple',
|
|
3
|
-
'teal' = 'teal',
|
|
4
|
-
'olive' = 'olive',
|
|
5
|
-
'orange' = 'orange',
|
|
6
|
-
'blue' = 'blue',
|
|
7
|
-
'cyan' = 'cyan',
|
|
8
|
-
'raspberry' = 'raspberry',
|
|
9
|
-
'yellow' = 'yellow',
|
|
10
|
-
'wine' = 'wine',
|
|
11
|
-
'primary' = 'primary',
|
|
12
|
-
'green' = 'green',
|
|
13
|
-
'red' = 'red',
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Pipe({
|
|
4
|
-
name: 'arrayToString',
|
|
5
|
-
standalone: true
|
|
6
|
-
})
|
|
7
|
-
export class ArrayToStringPipe implements PipeTransform {
|
|
8
|
-
|
|
9
|
-
transform(value: Array<string | number> | string): string {
|
|
10
|
-
return (typeof value === 'string') ? value : value.join(',');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import {TranslateService} from "@ngx-translate/core";
|
|
3
|
-
|
|
4
|
-
@Pipe({
|
|
5
|
-
name: 'generateErrorMessages',
|
|
6
|
-
standalone: true,
|
|
7
|
-
pure: true
|
|
8
|
-
})
|
|
9
|
-
export class GenerateErrorMessagesPipe implements PipeTransform {
|
|
10
|
-
|
|
11
|
-
constructor(private translateService: TranslateService) {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
transform(control: any,label: string,defaultPatternKey: string = 'fixed'): string {
|
|
15
|
-
|
|
16
|
-
if (!control.errors) {
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
let translateParams!: {ERROR_KEY: string};
|
|
20
|
-
let errorMessageKey = ''
|
|
21
|
-
|
|
22
|
-
const key = (Object.keys(control.errors)[0]);
|
|
23
|
-
|
|
24
|
-
translateParams = {ERROR_KEY: this.translateService.instant(label) || 'Field'};
|
|
25
|
-
errorMessageKey = (key === 'pattern') ?
|
|
26
|
-
'errorMessages.pattern.' + defaultPatternKey : 'errorMessages.' + key;
|
|
27
|
-
|
|
28
|
-
return this.translateService.instant(errorMessageKey,translateParams);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Pipe({
|
|
4
|
-
name: 'getValueByKeyFromObject',
|
|
5
|
-
standalone: true
|
|
6
|
-
})
|
|
7
|
-
export class GetValueByKeyFromObjectPipe implements PipeTransform {
|
|
8
|
-
|
|
9
|
-
transform(
|
|
10
|
-
keys: string | Array<string | number>,
|
|
11
|
-
data: any,
|
|
12
|
-
withParams: Array<string | Array<string | number>> | null = null,
|
|
13
|
-
withParamSymbol?: string
|
|
14
|
-
): string {
|
|
15
|
-
if (typeof keys === 'string') {
|
|
16
|
-
return data[keys];
|
|
17
|
-
} else {
|
|
18
|
-
let returnValue: any = data;
|
|
19
|
-
keys.forEach((key: string | number) => {
|
|
20
|
-
if (!returnValue) { return; }
|
|
21
|
-
returnValue = returnValue[key];
|
|
22
|
-
})
|
|
23
|
-
if (withParams) {
|
|
24
|
-
|
|
25
|
-
withParams.forEach((param: Array<string | number> | string) => {
|
|
26
|
-
let include = data;
|
|
27
|
-
|
|
28
|
-
if (typeof param === 'object') {
|
|
29
|
-
param.forEach((key: string | number) => {
|
|
30
|
-
include = (include) ? include[key] : null;
|
|
31
|
-
})
|
|
32
|
-
} else {
|
|
33
|
-
include = include[param];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (include !== undefined && include !== null) {
|
|
37
|
-
returnValue += (withParamSymbol ? withParamSymbol : ' ') + include;
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return ((returnValue !== "undefined") && (returnValue !== null) ) ? returnValue : '---';
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {ControlValueAccessor, FormControlName, NgControl} from "@angular/forms";
|
|
2
|
-
import {inject, Injectable} from "@angular/core";
|
|
3
|
-
|
|
4
|
-
class NoopValueAccessor implements ControlValueAccessor {
|
|
5
|
-
writeValue() {}
|
|
6
|
-
registerOnChange() {}
|
|
7
|
-
|
|
8
|
-
registerOnTouched() {}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
@Injectable({
|
|
12
|
-
providedIn: 'root'
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export class InputService {
|
|
16
|
-
injectNgControl(): FormControlName {
|
|
17
|
-
const ngControl = inject(NgControl, {self: true, optional: true});
|
|
18
|
-
|
|
19
|
-
if (!ngControl) throw new Error('...');
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
ngControl instanceof FormControlName
|
|
23
|
-
) {
|
|
24
|
-
ngControl.valueAccessor = new NoopValueAccessor();
|
|
25
|
-
return ngControl;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
throw new Error(`...`);
|
|
29
|
-
}
|
|
30
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/lib",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"inlineSources": true,
|
|
10
|
-
"types": []
|
|
11
|
-
},
|
|
12
|
-
"exclude": [
|
|
13
|
-
"**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "./tsconfig.lib.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"declarationMap": false
|
|
7
|
-
},
|
|
8
|
-
"angularCompilerOptions": {
|
|
9
|
-
"compilationMode": "partial"
|
|
10
|
-
}
|
|
11
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/spec",
|
|
7
|
-
"types": [
|
|
8
|
-
"jasmine"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"**/*.spec.ts",
|
|
13
|
-
"**/*.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|