i-tech-shared-components 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/docs/README.md +12 -5
  2. package/ng-package.json +17 -0
  3. package/package.json +19 -32
  4. package/src/README.md +0 -0
  5. package/src/lib/components/autocomplete-select/autocomplete-select.component.html +211 -0
  6. package/src/lib/components/autocomplete-select/autocomplete-select.component.scss +58 -0
  7. package/src/lib/components/autocomplete-select/autocomplete-select.component.ts +430 -0
  8. package/src/lib/components/autocomplete-select/loader.svg +6 -0
  9. package/src/lib/components/button/button.component.css +0 -0
  10. package/src/lib/components/button/button.component.html +48 -0
  11. package/src/lib/components/button/button.component.spec.ts +23 -0
  12. package/src/lib/components/button/button.component.ts +106 -0
  13. package/src/lib/components/clear-value/clear-value.component.ts +44 -0
  14. package/src/lib/components/date-picker/date-picker.component.html +61 -0
  15. package/src/lib/components/date-picker/date-picker.component.ts +75 -0
  16. package/src/lib/components/date-range-datepicker/date-range-datepicker.component.html +44 -0
  17. package/src/lib/components/date-range-datepicker/date-range-datepicker.component.ts +105 -0
  18. package/src/lib/components/icon-button/icon-button.component.html +27 -0
  19. package/src/lib/components/icon-button/icon-button.component.scss +0 -0
  20. package/src/lib/components/icon-button/icon-button.component.ts +37 -0
  21. package/src/lib/components/label/label.component.html +15 -0
  22. package/src/lib/components/label/label.component.ts +33 -0
  23. package/src/lib/components/menu/menu.component.html +20 -0
  24. package/src/lib/components/menu/menu.component.scss +9 -0
  25. package/src/lib/components/menu/menu.component.ts +39 -0
  26. package/src/lib/components/text/text-input.component.html +91 -0
  27. package/src/lib/components/text/text-input.component.ts +73 -0
  28. package/src/lib/directives/date-mask.directive.ts +97 -0
  29. package/src/lib/directives/input-mask.directive.ts +93 -0
  30. package/src/lib/interfaces/app-input.interface.ts +32 -0
  31. package/src/lib/interfaces/autocomplete-configs.interface.ts +37 -0
  32. package/src/lib/interfaces/button-types.enum.ts +19 -0
  33. package/src/lib/interfaces/dropdown-selection.constants.ts +11 -0
  34. package/src/lib/interfaces/label-type.enum.ts +14 -0
  35. package/src/lib/pipes/array-to-string.pipe.ts +13 -0
  36. package/src/lib/pipes/generate-error-messages.pipe.ts +31 -0
  37. package/src/lib/pipes/get-value-by-key-from-object.pipe.ts +46 -0
  38. package/src/lib/services/input.service.ts +30 -0
  39. package/{public-api.d.ts → src/public-api.ts} +20 -15
  40. package/theme.scss +4 -2
  41. package/tsconfig.lib.json +15 -0
  42. package/tsconfig.lib.prod.json +11 -0
  43. package/tsconfig.spec.json +15 -0
  44. package/.npmignore +0 -2
  45. package/esm2022/i-tech-shared-components.mjs +0 -5
  46. package/esm2022/lib/components/autocomplete-select/autocomplete-select.component.mjs +0 -409
  47. package/esm2022/lib/components/button/button.component.mjs +0 -122
  48. package/esm2022/lib/components/clear-value/clear-value.component.mjs +0 -34
  49. package/esm2022/lib/components/date-picker/date-picker.component.mjs +0 -97
  50. package/esm2022/lib/components/date-range-datepicker/date-range-datepicker.component.mjs +0 -118
  51. package/esm2022/lib/components/icon-button/icon-button.component.mjs +0 -49
  52. package/esm2022/lib/components/text/text-input.component.mjs +0 -73
  53. package/esm2022/lib/directives/date-mask.directive.mjs +0 -92
  54. package/esm2022/lib/directives/input-mask.directive.mjs +0 -92
  55. package/esm2022/lib/interfaces/app-input.interface.mjs +0 -2
  56. package/esm2022/lib/interfaces/autocomplete-configs.interface.mjs +0 -2
  57. package/esm2022/lib/interfaces/button-types.enum.mjs +0 -17
  58. package/esm2022/lib/pipes/array-to-string.pipe.mjs +0 -17
  59. package/esm2022/lib/pipes/generate-error-messages.pipe.mjs +0 -31
  60. package/esm2022/lib/pipes/get-value-by-key-from-object.pipe.mjs +0 -45
  61. package/esm2022/lib/services/input.service.mjs +0 -29
  62. package/esm2022/public-api.mjs +0 -19
  63. package/fesm2022/i-tech-shared-components.mjs +0 -1149
  64. package/fesm2022/i-tech-shared-components.mjs.map +0 -1
  65. package/index.d.ts +0 -5
  66. package/lib/components/autocomplete-select/autocomplete-select.component.d.ts +0 -84
  67. package/lib/components/button/button.component.d.ts +0 -65
  68. package/lib/components/clear-value/clear-value.component.d.ts +0 -9
  69. package/lib/components/date-picker/date-picker.component.d.ts +0 -32
  70. package/lib/components/date-range-datepicker/date-range-datepicker.component.d.ts +0 -36
  71. package/lib/components/icon-button/icon-button.component.d.ts +0 -14
  72. package/lib/components/text/text-input.component.d.ts +0 -21
  73. package/lib/directives/date-mask.directive.d.ts +0 -25
  74. package/lib/directives/input-mask.directive.d.ts +0 -21
  75. package/lib/interfaces/app-input.interface.d.ts +0 -31
  76. package/lib/interfaces/autocomplete-configs.interface.d.ts +0 -37
  77. package/lib/interfaces/button-types.enum.d.ts +0 -15
  78. package/lib/pipes/array-to-string.pipe.d.ts +0 -7
  79. package/lib/pipes/generate-error-messages.pipe.d.ts +0 -10
  80. package/lib/pipes/get-value-by-key-from-object.pipe.d.ts +0 -7
  81. package/lib/services/input.service.d.ts +0 -7
package/docs/README.md CHANGED
@@ -45,11 +45,18 @@ Here shown example how can use components
45
45
 
46
46
  #### **Tables**
47
47
  ```markdown
48
- | Input | Type | Default | Description |
49
- |------------|-----------|----------|---------------------------------------------------------------------------------|
50
- | `type` | `string` | `FILLED` | Button type (e.g., FILLED, TEXT). |
51
- | `disabled` | `boolean` | `false` | Disables the button when true. |
52
- | `icon` | `string` | `add` | Set a material or font icon, also you can register and submit your own SVG. |
48
+ | Input | Type | Default | Description |
49
+ |--------------|-----------|----------|---------------------------------------------------------------------------------|
50
+ | `type` | `string` | `FILLED` | Button type (e.g., FILLED, TEXT). |
51
+ | `disabled` | `boolean` | `false` | Disables the button when true. |
52
+ | `icon` | `string` | `add` | Set a material or font icon, also you can register and submit your own SVG. |
53
+ | `customClass`| `string` | ` ` | Set your custom class. |
54
+ | `submit` | `boolean` | `false` | For button loading state. |
55
+
56
+ ```markdown
57
+ | Output | Type | Default | Description |
58
+ |--------------|------------|----------|------------------------------------------------------------------------------|
59
+ | `buttonClick`| `void` | `void` | For output and handle button click. | |
53
60
 
54
61
  ```
55
62
  ### Icon Button Component
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/shared-components",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts",
6
+ "styleIncludePaths": [
7
+ "src"
8
+ ]
9
+ },
10
+ "assets": [
11
+ "theme.scss",
12
+ "theme/**/*.scss"
13
+ ],
14
+ "allowedNonPeerDependencies": [
15
+ "src"
16
+ ]
17
+ }
package/package.json CHANGED
@@ -1,32 +1,19 @@
1
- {
2
- "name": "i-tech-shared-components",
3
- "version": "1.1.4",
4
- "peerDependencies": {
5
- "@angular/cdk": "^18.2.14",
6
- "@angular/material": "^18.2.14",
7
- "@angular/animations": "^18.0.0",
8
- "@ngx-translate/core": "^15.0.0",
9
- "@ngx-translate/http-loader": "^8.0.0",
10
- "ngx-mask": "^16.0.0"
11
- },
12
- "dependencies": {
13
- "tslib": "^2.3.0"
14
- },
15
- "sideEffects": false,
16
- "files": [
17
- "**/*"
18
- ],
19
- "module": "fesm2022/i-tech-shared-components.mjs",
20
- "typings": "index.d.ts",
21
- "exports": {
22
- "./package.json": {
23
- "default": "./package.json"
24
- },
25
- ".": {
26
- "types": "./index.d.ts",
27
- "esm2022": "./esm2022/i-tech-shared-components.mjs",
28
- "esm": "./esm2022/i-tech-shared-components.mjs",
29
- "default": "./fesm2022/i-tech-shared-components.mjs"
30
- }
31
- }
32
- }
1
+ {
2
+ "name": "i-tech-shared-components",
3
+ "version": "1.1.6",
4
+ "peerDependencies": {
5
+ "@angular/cdk": "^19.0.4",
6
+ "@angular/material": "^19.0.4",
7
+ "@angular/animations": "^19.0.5",
8
+ "@ngx-translate/core": "^15.0.0",
9
+ "@ngx-translate/http-loader": "^8.0.0",
10
+ "ngx-mask": "^16.0.0"
11
+ },
12
+ "dependencies": {
13
+ "tslib": "^2.3.0"
14
+ },
15
+ "sideEffects": false,
16
+ "files": [
17
+ "**/*"
18
+ ]
19
+ }
package/src/README.md ADDED
File without changes
@@ -0,0 +1,211 @@
1
+ <div class="new-mat-autocomplete" id="mat_autocomplete"
2
+ [ngClass]="{
3
+ 'mat-select-without_icon': !selectConfig.iconUrl && !selectConfig.activeStateIconUrl,
4
+ 'mat-select-with-search': selectConfig.search,
5
+ 'without-label': selectConfig.hideLabel,
6
+ 'invalid_field': ngControl.control.errors && submitValue,
7
+ 'readonly-field': selectConfig.readOnly || ngControl.control.disabled
8
+ }"
9
+ [matTooltip]="(selectConfig.hover && !ngControl.control.disabled ? ((selectConfig.hover || '') | translate) : '')"
10
+ [matTooltipClass]="'mat-mdc-tooltip big-td-mat-tooltip'"
11
+ [matTooltipPosition]="'above'"
12
+ *ngIf="selectConfig && ngControl">
13
+
14
+ <div class="w-100" *ngIf="!selectConfig.hideLabel">
15
+ <mat-label [ngClass]="{
16
+ 'readonly-color' : selectConfig.readOnly || ngControl.control.disabled,
17
+ 'invalid-label-color': !!(ngControl.control.errors && submitValue)
18
+ }">
19
+ {{ selectConfig.label | translate }}
20
+ </mat-label>
21
+ <span *ngIf="selectConfig.required" class="required-input"
22
+ [ngClass]="{'readonly-color' : ngControl.control.disabled}">*</span>
23
+ </div>
24
+
25
+
26
+ <!-- Search Input -->
27
+ <div class="search-input w-100"
28
+ (click)="$event.stopPropagation();$event.preventDefault()"
29
+ [ngClass]="{ hide_input_placeholder: showPlaceholder || ngControl.control.disabled }"
30
+ *ngIf="selectConfig.search"
31
+ >
32
+ <input autocomplete="off"
33
+ id="searchInput"
34
+ type="text"
35
+ [ngClass]="{'pr-25': !selectConfig.iconUrl}"
36
+ #searchInput
37
+ [disabled]="ngControl.control.disabled || selectConfig.hover"
38
+ [placeholder]="(ngControl.control.disabled || selectConfig.hover) ? '' : 'Search'"
39
+ (focusout)="inputFocusOut()"
40
+ (focus)="openSelection()"
41
+ (keydown)="$event.stopPropagation()"
42
+ (keyup)="getDataWithSearch(searchInput.value,$event)">
43
+
44
+ <!-- Search Icon -->
45
+ <span class="search-icon">
46
+ <i-tech-icon-button
47
+ class="mr-10"
48
+ [ngClass]="selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'"
49
+ *ngIf="selectConfig.iconPrefix && !showPlaceholder"
50
+ [iconName]="selectConfig.iconPrefix || ''"
51
+ [disabled]="selectConfig.readOnly || false"
52
+ matPrefix
53
+ >
54
+ </i-tech-icon-button>
55
+ </span>
56
+ </div>
57
+
58
+ <!-- Placeholder/Selected Value Display -->
59
+ <ng-container *ngIf="showPlaceholder && selectConfig.search">
60
+ <div class="custom-placeholder"
61
+ *ngIf="(!ngControl?.value && !ngControl?.value?.length) ||
62
+ (selectConfig.multiple && ngControl?.value && !ngControl?.value?.length)"
63
+ [ngClass]="selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'"
64
+ >
65
+ {{ ((selectConfig.placeholder || '') | translate) }}
66
+ </div>
67
+ <div class="custom-placeholder custom-value ellipsis"
68
+ [ngClass]="{
69
+ 'pr-42': selectConfig.iconUrl,
70
+ 'readonly-color': selectConfig.readOnly || ngControl.control.disabled,
71
+ 'default-form-icon-color': !(selectConfig.readOnly || ngControl.control.disabled)
72
+ }"
73
+ *ngIf="ngControl?.value"
74
+ >
75
+ {{ selectConfig?.multiple ? (ngControl.value | arrayToString) : showingValue }}
76
+ </div>
77
+ </ng-container>
78
+
79
+ <!-- Custom Icon -->
80
+ <img class="left_icon_new pointer"
81
+ (click)="iconClick(matSelect, searchInput)"
82
+ *ngIf="!selectConfig.matIconName && (selectConfig.iconUrl || selectConfig.activeStateIconUrl)"
83
+ [src]="'assets/images/icons/global/' + (ngControl.control?.value && selectConfig?.activeStateIconUrl ? selectConfig.activeStateIconUrl : selectConfig.iconUrl)">
84
+
85
+ <mat-form-field appearance="outline" class="w-100" (click)="selectConfig?.search ? focusSearchInput() : null">
86
+ <!-- Material Select -->
87
+ <mat-select #matSelect="matSelect"
88
+ [panelClass]="'autocomplete-transform-panel-location'"
89
+ [attr.aria-placeholder]="(selectConfig.placeholder || '') | translate"
90
+ [aria-label]="selectConfig.label | translate"
91
+ [id]="selectConfig.filtrationKey || ''"
92
+ (opened)="registerPanelScrollEvent(matSelect)"
93
+ (openedChange)="openedChange($event)"
94
+ [formControl]="ngControl.control"
95
+ [multiple]="selectConfig.multiple"
96
+ (selectionChange)="emitSelectionChangeAndClose($event)"
97
+ [errorStateMatcher]="customErrorStateMatcher"
98
+ [placeholder]="(selectConfig.placeholder || '') | translate"
99
+ [disabled]="ngControl.control.disabled"
100
+ >
101
+
102
+ <!-- Loading State -->
103
+ <mat-option *ngIf="pending" class="option_loading relative">
104
+ <div class="request_loading">
105
+ <img ngSrc="./loader.svg" alt="" height="200" width="200"/>
106
+ </div>
107
+ </mat-option>
108
+
109
+ <!-- Options -->
110
+ <ng-container *ngIf="data?.length && !pending">
111
+ <!-- Add New Option -->
112
+ <mat-option *ngIf="selectConfig.actions"
113
+ class="pointer add_new"
114
+ disabled
115
+ (click)="closePanelAndUnsetFocus();addNewItemEvent()">
116
+ <!-- (click)="ngControl.control.reset(null);matSelect._onBlur();closePanelAndUnsetFocus();addNewItemEvent()">-->
117
+ <i-tech-button
118
+ [type]="ButtonType.OUTLINE"
119
+ [fontIcon]="'add'"
120
+ [text]="('dropdown_add_item' | translate : {INPUT_NAME: (selectConfig.label | translate)}) "
121
+ [customClass]="'w-100 mat-autocomplete-select-button'">
122
+ </i-tech-button>
123
+ </mat-option>
124
+
125
+ <!-- Regular Options -->
126
+ <ng-container *ngIf="!selectConfig?.changeText && data.length">
127
+ <mat-option *ngFor="let item of data"
128
+ [value]="selectConfig.valueByKey | getValueByKeyFromObject : item"
129
+ (mouseup)="optionClick(item)"
130
+ (mousedown)="preventDefault($event)">
131
+ {{ ((selectConfig.valueToShowByKey | getValueByKeyFromObject : item : selectConfig.valueToShowByParam : selectConfig.withParamSymbol) || '') | translate }}
132
+ </mat-option>
133
+ </ng-container>
134
+
135
+ <!-- Custom Text Options -->
136
+ <ng-container *ngIf="selectConfig?.changeText && data.length">
137
+ <mat-option *ngFor="let item of data"
138
+ [value]="selectConfig.valueByKey | getValueByKeyFromObject : item"
139
+ (mouseup)="optionClick(item)"
140
+ (mousedown)="preventDefault($event)"
141
+ [disabled]="selectConfig?.changeText[item].disabled">
142
+ {{ selectConfig?.changeText[item].text | translate }}
143
+ </mat-option>
144
+ </ng-container>
145
+ </ng-container>
146
+
147
+ <!-- Empty State -->
148
+ <ng-container *ngIf="!pending && !data.length">
149
+ <mat-option disabled class="empty_selection_state">
150
+ <div class="actions_and_tile add_new flex_column w-100 flex_center_align_center">
151
+ <span>{{ 'dropdown_no_items' | translate }}</span>
152
+ <div class="mt-10">
153
+ <i-tech-button
154
+ *ngIf="selectConfig?.actions"
155
+ [type]="ButtonType.OUTLINE"
156
+ (buttonClick)="closePanelAndUnsetFocus();addNewItemEvent()"
157
+ [customClass]="'mat-autocomplete-select-button'"
158
+ [fontIcon]="'add'"
159
+ [text]="('dropdown_add_item' | translate : {INPUT_NAME: (selectConfig.label | translate)}) ">
160
+ </i-tech-button>
161
+ </div>
162
+ </div>
163
+ </mat-option>
164
+ </ng-container>
165
+ </mat-select>
166
+ <mat-icon *ngIf="selectConfig.iconPrefix"
167
+ matPrefix
168
+ [ngClass]="{
169
+ 'readonly-color' : !selectConfig['iconPrefixColor'] && (selectConfig.readOnly || ngControl.control.disabled),
170
+ 'default-form-icon-color' : !selectConfig['iconPrefixColor'] && !(selectConfig.readOnly || ngControl.control.disabled)
171
+ }"
172
+ [matTooltip]="((selectConfig?.['iconPrefixTooltip'] || '') | translate)"
173
+ >{{ selectConfig.iconPrefix }}
174
+ </mat-icon>
175
+
176
+ <mat-icon *ngIf="selectConfig['iconPrefixSvg']"
177
+ matPrefix
178
+ [matTooltip]="((selectConfig?.['iconPrefixTooltip'] || '') | translate)"
179
+ [svgIcon]="selectConfig['iconPrefixSvg'] || ''"
180
+ ></mat-icon>
181
+
182
+ <i-tech-icon-button
183
+ *ngIf="selectConfig.search && selectConfig.clearable && !ngControl.control.disabled && !!ngControl.control.value"
184
+ iconName="cancel"
185
+ matSuffix
186
+ [disabled]="selectConfig.readOnly || false"
187
+ [ngClass]="selectConfig.readOnly || ngControl.control.disabled ? 'readonly-color' : 'default-form-icon-color'"
188
+ (click)="$event.stopPropagation();$event.preventDefault();ngControl.control.reset(null);matSelect._onBlur();closePanelAndUnsetFocus()"
189
+ >
190
+ </i-tech-icon-button>
191
+ <mat-icon
192
+ matSuffix
193
+ class="select-arrow"
194
+ [class.open]="matSelect.panelOpen"
195
+ [ngClass]="{
196
+ 'readonly-color': selectConfig.readOnly || ngControl.control.disabled,
197
+ 'default-form-icon-color': !(selectConfig.readOnly || ngControl.control.disabled),
198
+ 'mt-8': !!ngControl.control.value && selectConfig.clearable
199
+ }"
200
+ >
201
+ keyboard_arrow_down
202
+ </mat-icon>
203
+ <!-- Error Message -->
204
+ <mat-error *ngIf="!!(ngControl.control.errors && submitValue)">
205
+ {{ ngControl.control | generateErrorMessages : selectConfig.label : selectConfig.defaultPatternKey }}
206
+ </mat-error>
207
+ </mat-form-field>
208
+
209
+ <!-- Reset Button -->
210
+ <i-tech-clear-value *ngIf="selectConfig.reset" (reset)="resetValue()"></i-tech-clear-value>
211
+ </div>
@@ -0,0 +1,58 @@
1
+ .left_icon_new {
2
+ position: absolute;
3
+ right: 2px;
4
+ top: 1px;
5
+ }
6
+
7
+ ::ng-deep {
8
+ .request_loading {
9
+ width: 40px;
10
+ height: 40px;
11
+ background-color: white !important;
12
+ &:hover {
13
+ background-color: var(--primary99) !important;
14
+ }
15
+ &:focus {
16
+ background-color: var(--primary99) !important;
17
+ }
18
+ img {
19
+ position: absolute;
20
+ left: 50%;
21
+ top: 50%;
22
+ width: 100%;
23
+ height: 100%;
24
+ transform: translate(-50%, -50%);
25
+ }
26
+ }
27
+ }
28
+
29
+ ::ng-deep {
30
+ .mat-mdc-option.add_new {
31
+ opacity: 1 !important;
32
+ pointer-events: auto !important;
33
+
34
+ .mat-pseudo-checkbox {
35
+ display: none !important;
36
+ }
37
+
38
+ .mdc-list-item__primary-text {
39
+ display: inline-block !important;
40
+ width: 100% !important;
41
+ }
42
+
43
+ }
44
+
45
+ .mat-mdc-option.add_new span {
46
+ color: unset !important;
47
+ font-size: unset !important;
48
+ margin: unset !important;
49
+ opacity: 1 !important;
50
+ }
51
+ }
52
+
53
+ @media (min-width: 1920px) and (max-width: 2500px) {
54
+ .mat-autocomplete {
55
+ height: 90px !important;
56
+ }
57
+ }
58
+