@ferhaps/easy-ui-lib 1.0.0 → 1.1.0

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 (56) hide show
  1. package/fesm2022/ferhaps-easy-ui-lib.mjs +551 -0
  2. package/fesm2022/ferhaps-easy-ui-lib.mjs.map +1 -0
  3. package/index.d.ts +5 -0
  4. package/lib/components/default-dialog/default-dialog.component.d.ts +11 -0
  5. package/lib/components/error-dispaly.component.d.ts +10 -0
  6. package/lib/components/error-handler/error-handler.component.d.ts +12 -0
  7. package/lib/components/error-handler/error-popup/error-popup.component.d.ts +9 -0
  8. package/lib/components/global-loader/global-loader.component.d.ts +7 -0
  9. package/lib/components/search-bar.component.d.ts +10 -0
  10. package/lib/components/table/table.component.d.ts +46 -0
  11. package/lib/components/table-sort-header/table-sort-header.component.d.ts +10 -0
  12. package/lib/directives/fields-match-validator.directive.d.ts +10 -0
  13. package/lib/directives/password-validator.directive.d.ts +7 -0
  14. package/lib/directives/phone-validation.directive.d.ts +7 -0
  15. package/lib/pipes/blank-filler.pipe.d.ts +7 -0
  16. package/lib/pipes/snake-case-parser.pipe.d.ts +7 -0
  17. package/lib/services/error.service.d.ts +9 -0
  18. package/lib/services/loader.service.d.ts +8 -0
  19. package/lib/utils/animations.d.ts +3 -0
  20. package/{src/lib/utils/types.ts → lib/utils/types.d.ts} +2 -3
  21. package/lib/utils/utils.d.ts +1 -0
  22. package/package.json +44 -26
  23. package/{src/public-api.ts → public-api.d.ts} +16 -20
  24. package/ng-package.json +0 -7
  25. package/src/lib/components/default-dialog/default-dialog.component.html +0 -19
  26. package/src/lib/components/default-dialog/default-dialog.component.scss +0 -41
  27. package/src/lib/components/default-dialog/default-dialog.component.ts +0 -23
  28. package/src/lib/components/error-dispaly.component.ts +0 -48
  29. package/src/lib/components/error-handler/error-handler.component.html +0 -0
  30. package/src/lib/components/error-handler/error-handler.component.scss +0 -0
  31. package/src/lib/components/error-handler/error-handler.component.ts +0 -44
  32. package/src/lib/components/error-handler/error-popup/error-popup.component.html +0 -13
  33. package/src/lib/components/error-handler/error-popup/error-popup.component.scss +0 -19
  34. package/src/lib/components/error-handler/error-popup/error-popup.component.ts +0 -21
  35. package/src/lib/components/global-loader/global-loader.component.html +0 -5
  36. package/src/lib/components/global-loader/global-loader.component.scss +0 -12
  37. package/src/lib/components/global-loader/global-loader.component.ts +0 -17
  38. package/src/lib/components/search-bar.component.ts +0 -70
  39. package/src/lib/components/table/table.component.html +0 -121
  40. package/src/lib/components/table/table.component.scss +0 -116
  41. package/src/lib/components/table/table.component.ts +0 -105
  42. package/src/lib/components/table-sort-header/table-sort-header.component.html +0 -7
  43. package/src/lib/components/table-sort-header/table-sort-header.component.scss +0 -17
  44. package/src/lib/components/table-sort-header/table-sort-header.component.ts +0 -31
  45. package/src/lib/directives/fields-match-validator.directive.ts +0 -35
  46. package/src/lib/directives/password-validator.directive.ts +0 -26
  47. package/src/lib/directives/phone-validation.directive.ts +0 -24
  48. package/src/lib/pipes/blank-filler.pipe.ts +0 -13
  49. package/src/lib/pipes/snake-case-parser.pipe.ts +0 -17
  50. package/src/lib/services/error.service.ts +0 -15
  51. package/src/lib/services/loader.service.ts +0 -14
  52. package/src/lib/utils/animations.ts +0 -29
  53. package/src/lib/utils/utils.ts +0 -65
  54. package/tsconfig.lib.json +0 -14
  55. package/tsconfig.lib.prod.json +0 -10
  56. package/tsconfig.spec.json +0 -14
@@ -0,0 +1,551 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, input, Directive, HostListener, output, Component, Input, viewChild, Injectable, inject, Inject } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
+ import { NG_VALIDATORS, FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
5
+ import * as i1$1 from '@angular/material/icon';
6
+ import { MatIconModule } from '@angular/material/icon';
7
+ import * as i3 from '@angular/material/dialog';
8
+ import { MatDialogModule, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
9
+ import * as i1 from '@angular/common';
10
+ import { CommonModule, AsyncPipe } from '@angular/common';
11
+ import * as i1$4 from '@angular/common/http';
12
+ import { HttpErrorResponse } from '@angular/common/http';
13
+ import { debounceTime, distinctUntilChanged, BehaviorSubject, Subject, Subscription } from 'rxjs';
14
+ import { trigger, transition, style, animate, state } from '@angular/animations';
15
+ import * as i1$2 from '@angular/material/menu';
16
+ import { MatMenuModule } from '@angular/material/menu';
17
+ import * as i3$1 from '@angular/material/button';
18
+ import { MatButtonModule } from '@angular/material/button';
19
+ import * as i4 from '@angular/cdk/drag-drop';
20
+ import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
21
+ import * as i1$3 from '@angular/material/progress-spinner';
22
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
23
+ import { NoopScrollStrategy } from '@angular/cdk/overlay';
24
+
25
+ class WhiteSpaceFillerPipe {
26
+ transform(value, fillWith = '-') {
27
+ if (value === 0) {
28
+ return '0';
29
+ }
30
+ return value ? value : fillWith;
31
+ }
32
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: WhiteSpaceFillerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
33
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: WhiteSpaceFillerPipe, isStandalone: true, name: "blankFiller" }); }
34
+ }
35
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: WhiteSpaceFillerPipe, decorators: [{
36
+ type: Pipe,
37
+ args: [{
38
+ name: 'blankFiller',
39
+ }]
40
+ }] });
41
+
42
+ class SnakeCaseParserPipe {
43
+ transform(str) {
44
+ if (str) {
45
+ let temp = str.split('_').map(word => {
46
+ return word.toLowerCase();
47
+ }).join(' ');
48
+ return temp.charAt(0).toUpperCase() + temp.slice(1);
49
+ }
50
+ return '';
51
+ }
52
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SnakeCaseParserPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
53
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.6", ngImport: i0, type: SnakeCaseParserPipe, isStandalone: true, name: "snakeCaseParser" }); }
54
+ }
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SnakeCaseParserPipe, decorators: [{
56
+ type: Pipe,
57
+ args: [{
58
+ name: 'snakeCaseParser',
59
+ }]
60
+ }] });
61
+
62
+ class FieldsMatchValidatorDirective {
63
+ constructor() {
64
+ this.fieldToMatch = input.required();
65
+ }
66
+ validate(control) {
67
+ const value = control.value;
68
+ if (!value) {
69
+ return null;
70
+ }
71
+ const matchingControl = control.root.get(this.fieldToMatch());
72
+ if (!matchingControl) {
73
+ return null;
74
+ }
75
+ if (value !== matchingControl.value) {
76
+ return { mismatch: true };
77
+ }
78
+ return null;
79
+ }
80
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FieldsMatchValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
81
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.6", type: FieldsMatchValidatorDirective, isStandalone: true, selector: "[libFieldsMatchValidator]", inputs: { fieldToMatch: { classPropertyName: "fieldToMatch", publicName: "fieldToMatch", isSignal: true, isRequired: true, transformFunction: null } }, providers: [
82
+ {
83
+ provide: NG_VALIDATORS,
84
+ useExisting: FieldsMatchValidatorDirective,
85
+ multi: true,
86
+ },
87
+ ], ngImport: i0 }); }
88
+ }
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: FieldsMatchValidatorDirective, decorators: [{
90
+ type: Directive,
91
+ args: [{
92
+ selector: '[libFieldsMatchValidator]',
93
+ providers: [
94
+ {
95
+ provide: NG_VALIDATORS,
96
+ useExisting: FieldsMatchValidatorDirective,
97
+ multi: true,
98
+ },
99
+ ],
100
+ }]
101
+ }] });
102
+
103
+ class PhoneValidationDirective {
104
+ onInput(event) {
105
+ const input = event.target;
106
+ if (!input.value.includes('+')) {
107
+ input.value = `+${input.value}`;
108
+ }
109
+ const regex = /^[0-9+]*$/;
110
+ if (!regex.test(input.value)) {
111
+ input.value = input.value.replace(/[^0-9+]/g, '');
112
+ }
113
+ }
114
+ onKeyDown(event) {
115
+ const inputValue = event.target.value;
116
+ if (event.key === 'Backspace' && inputValue === '+') {
117
+ event.preventDefault();
118
+ }
119
+ }
120
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: PhoneValidationDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
121
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: PhoneValidationDirective, isStandalone: true, selector: "[libPhoneValidation]", host: { listeners: { "input": "onInput($event)", "keydown": "onKeyDown($event)" } }, ngImport: i0 }); }
122
+ }
123
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: PhoneValidationDirective, decorators: [{
124
+ type: Directive,
125
+ args: [{
126
+ selector: '[libPhoneValidation]',
127
+ }]
128
+ }], propDecorators: { onInput: [{
129
+ type: HostListener,
130
+ args: ['input', ['$event']]
131
+ }], onKeyDown: [{
132
+ type: HostListener,
133
+ args: ['keydown', ['$event']]
134
+ }] } });
135
+
136
+ class PasswordValidatorDirective {
137
+ validate(control) {
138
+ const password = control.value;
139
+ const pattern = /^(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#\$%\^&\*])(?=.*\d).{8,}$/;
140
+ if (password && !pattern.test(password)) {
141
+ return { passwordInvalid: true };
142
+ }
143
+ return null;
144
+ }
145
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: PasswordValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
146
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.6", type: PasswordValidatorDirective, isStandalone: true, selector: "[libPasswordValidator]", providers: [
147
+ {
148
+ provide: NG_VALIDATORS,
149
+ useExisting: PasswordValidatorDirective,
150
+ multi: true
151
+ }
152
+ ], ngImport: i0 }); }
153
+ }
154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: PasswordValidatorDirective, decorators: [{
155
+ type: Directive,
156
+ args: [{
157
+ selector: '[libPasswordValidator]',
158
+ providers: [
159
+ {
160
+ provide: NG_VALIDATORS,
161
+ useExisting: PasswordValidatorDirective,
162
+ multi: true
163
+ }
164
+ ]
165
+ }]
166
+ }] });
167
+
168
+ class DefaultDialogComponent {
169
+ constructor() {
170
+ this.height = input();
171
+ this.dialogTitle = input();
172
+ this.withBack = input();
173
+ this.back = output();
174
+ }
175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DefaultDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
176
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: DefaultDialogComponent, isStandalone: true, selector: "lib-default-dialog", inputs: { temRef: { classPropertyName: "temRef", publicName: "temRef", isSignal: false, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, dialogTitle: { classPropertyName: "dialogTitle", publicName: "dialogTitle", isSignal: true, isRequired: false, transformFunction: null }, withBack: { classPropertyName: "withBack", publicName: "withBack", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { back: "back" }, ngImport: i0, template: "<div class=\"modal\" [style]=\"{'height': height()}\">\r\n <div class=\"dialog-title\">\r\n @if (withBack()) {\r\n <div class=\"back-arrow\" (click)=\"back.emit()\">\r\n <mat-icon>keyboard_arrow_left</mat-icon>\r\n </div>\r\n }\r\n <h4 class=\"title\">{{ dialogTitle() }}</h4>\r\n <div class=\"closer\" mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n </div>\r\n </div>\r\n\r\n <div class=\"dialog-content\">\r\n <ng-content select=\".dialog-content\"></ng-content>\r\n <ng-template #tempBody></ng-template>\r\n <ng-container *ngTemplateOutlet=\"temRef ? temRef: tempBody\" />\r\n </div>\r\n</div>", styles: [".modal{display:flex;flex-direction:column}.dialog-title{padding-inline:2rem;padding-top:1rem;margin-bottom:1rem;position:relative;display:flex;font-size:20px;justify-content:center}.dialog-title .back-arrow{cursor:pointer;margin-right:.5rem}.dialog-title .title{font-weight:700;font-size:24px;margin:0!important}.dialog-title .closer{right:3%;position:absolute;cursor:pointer}.dialog-content{flex:1;min-height:0;overflow:hidden;padding-bottom:1rem;display:flex;flex-direction:column;align-items:center}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i3.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] }); }
177
+ }
178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: DefaultDialogComponent, decorators: [{
179
+ type: Component,
180
+ args: [{ selector: 'lib-default-dialog', imports: [
181
+ CommonModule,
182
+ MatIconModule,
183
+ MatDialogModule
184
+ ], template: "<div class=\"modal\" [style]=\"{'height': height()}\">\r\n <div class=\"dialog-title\">\r\n @if (withBack()) {\r\n <div class=\"back-arrow\" (click)=\"back.emit()\">\r\n <mat-icon>keyboard_arrow_left</mat-icon>\r\n </div>\r\n }\r\n <h4 class=\"title\">{{ dialogTitle() }}</h4>\r\n <div class=\"closer\" mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n </div>\r\n </div>\r\n\r\n <div class=\"dialog-content\">\r\n <ng-content select=\".dialog-content\"></ng-content>\r\n <ng-template #tempBody></ng-template>\r\n <ng-container *ngTemplateOutlet=\"temRef ? temRef: tempBody\" />\r\n </div>\r\n</div>", styles: [".modal{display:flex;flex-direction:column}.dialog-title{padding-inline:2rem;padding-top:1rem;margin-bottom:1rem;position:relative;display:flex;font-size:20px;justify-content:center}.dialog-title .back-arrow{cursor:pointer;margin-right:.5rem}.dialog-title .title{font-weight:700;font-size:24px;margin:0!important}.dialog-title .closer{right:3%;position:absolute;cursor:pointer}.dialog-content{flex:1;min-height:0;overflow:hidden;padding-bottom:1rem;display:flex;flex-direction:column;align-items:center}\n"] }]
185
+ }], propDecorators: { temRef: [{
186
+ type: Input
187
+ }] } });
188
+
189
+ class ErrorDispalyComponent {
190
+ constructor() {
191
+ this.error = input.required();
192
+ this.displayError = '';
193
+ }
194
+ ngOnInit() {
195
+ if (this.error() instanceof HttpErrorResponse) {
196
+ if (typeof this.error().error === 'string') {
197
+ this.displayError = this.error().error;
198
+ }
199
+ else if (this.error && this.error()?.error?.message) {
200
+ this.displayError = this.error().error.message;
201
+ }
202
+ else {
203
+ this.displayError = 'Unknown error';
204
+ }
205
+ }
206
+ else if (typeof this.error() === 'string') {
207
+ this.displayError = this.error();
208
+ }
209
+ else {
210
+ this.displayError = 'Unknown error';
211
+ }
212
+ }
213
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorDispalyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
214
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.6", type: ErrorDispalyComponent, isStandalone: true, selector: "lib-error-dispaly", inputs: { error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `<strong class="err-container">{{ displayError | snakeCaseParser }}</strong>`, isInline: true, styles: [".err-container{display:block;max-width:300px;font-size:20px;text-align:center;border:1px solid red;border-radius:5px;padding:.5rem 1.5rem;background-color:#ffe6e6;color:red;overflow-wrap:break-word}\n"], dependencies: [{ kind: "pipe", type: SnakeCaseParserPipe, name: "snakeCaseParser" }] }); }
215
+ }
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorDispalyComponent, decorators: [{
217
+ type: Component,
218
+ args: [{ selector: 'lib-error-dispaly', imports: [
219
+ SnakeCaseParserPipe
220
+ ], template: `<strong class="err-container">{{ displayError | snakeCaseParser }}</strong>`, styles: [".err-container{display:block;max-width:300px;font-size:20px;text-align:center;border:1px solid red;border-radius:5px;padding:.5rem 1.5rem;background-color:#ffe6e6;color:red;overflow-wrap:break-word}\n"] }]
221
+ }] });
222
+
223
+ class SearchBarComponent {
224
+ constructor() {
225
+ this.for = input.required();
226
+ this.search = output();
227
+ this.searchForm = new FormGroup({
228
+ search: new FormControl('')
229
+ });
230
+ this.searchForm.get('search')?.valueChanges.
231
+ pipe(debounceTime(1000), distinctUntilChanged()).subscribe((searchTerm) => {
232
+ if (searchTerm.trim() !== '') {
233
+ this.search.emit(searchTerm);
234
+ }
235
+ });
236
+ }
237
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SearchBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
238
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.6", type: SearchBarComponent, isStandalone: true, selector: "lib-search-bar", inputs: { for: { classPropertyName: "for", publicName: "for", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { search: "search" }, ngImport: i0, template: `
239
+ <form class="search-bar" [formGroup]="searchForm">
240
+ <mat-icon>search</mat-icon>
241
+ <input class="search-input" type="search" name="field"
242
+ [placeholder]="'Search ' + for()" autocomplete="off" formControlName="search" />
243
+ </form>
244
+ `, isInline: true, styles: [".search-bar{width:270px;border:1px solid #A4A4A4;display:flex;align-items:center}.search-input{border:none;padding:7px 11px;height:100%;width:100%;background-color:transparent}mat-icon{margin-inline:8px}.search-input:focus{border:none;outline:none}@media (max-width: 1086px){.search-bar{width:170px}}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
245
+ }
246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: SearchBarComponent, decorators: [{
247
+ type: Component,
248
+ args: [{ selector: 'lib-search-bar', template: `
249
+ <form class="search-bar" [formGroup]="searchForm">
250
+ <mat-icon>search</mat-icon>
251
+ <input class="search-input" type="search" name="field"
252
+ [placeholder]="'Search ' + for()" autocomplete="off" formControlName="search" />
253
+ </form>
254
+ `, imports: [
255
+ MatIconModule,
256
+ ReactiveFormsModule
257
+ ], styles: [".search-bar{width:270px;border:1px solid #A4A4A4;display:flex;align-items:center}.search-input{border:none;padding:7px 11px;height:100%;width:100%;background-color:transparent}mat-icon{margin-inline:8px}.search-input:focus{border:none;outline:none}@media (max-width: 1086px){.search-bar{width:170px}}\n"] }]
258
+ }], ctorParameters: () => [] });
259
+
260
+ const fader = trigger('fadeInOut', [
261
+ transition(':enter', [
262
+ style({ opacity: 0 }),
263
+ animate('200ms', style({ opacity: 1 })),
264
+ ]),
265
+ transition(':leave', [
266
+ animate('200ms', style({ opacity: 0 })),
267
+ ]),
268
+ ]);
269
+ const openDropdown = trigger('open-close-dropdown', [
270
+ transition(':enter', [
271
+ style({ height: 0, overflow: 'hidden' }),
272
+ animate('200ms ease', style({ height: '*' }))
273
+ ]),
274
+ transition(':leave', [
275
+ style({ height: '*', overflow: 'hidden' }),
276
+ animate('200ms ease', style({ height: 0 }))
277
+ ])
278
+ ]);
279
+ const textFader = trigger('textFader', [
280
+ state('void', style({ opacity: 0 })),
281
+ state('*', style({ opacity: 1 })),
282
+ transition('void => *', [animate('0.3s 0.3s ease-in')]),
283
+ transition('* => void', [animate('0.3s ease-in')])
284
+ ]);
285
+
286
+ class TableSortHeaderComponent {
287
+ constructor() {
288
+ this.selected = input.required();
289
+ this.sort = output();
290
+ this.sortState = 'none';
291
+ }
292
+ onSortClick() {
293
+ if (this.sortState === 'none') {
294
+ this.sortState = 'desc';
295
+ }
296
+ else if (this.sortState === 'desc') {
297
+ this.sortState = 'asc';
298
+ }
299
+ else {
300
+ this.sortState = 'none';
301
+ }
302
+ this.sort.emit(this.sortState);
303
+ }
304
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TableSortHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
305
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.6", type: TableSortHeaderComponent, isStandalone: true, selector: "lib-table-sort-header", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { sort: "sort" }, ngImport: i0, template: "<div class=\"sorting-container\" (click)=\"onSortClick()\">\r\n <mat-icon\r\n [class.selected]=\"selected() && sortState != 'none'\"\r\n [class.rotated]=\"sortState == 'asc'\">\r\n sort\r\n </mat-icon>\r\n</div>", styles: [".sorting-container{display:flex;align-items:center}.sorting-container *{cursor:pointer}.sorting-container .selected{color:#31adff;background-color:#ebf7fc}.sorting-container .rotated{transform:rotate(180deg) scaleX(-1)}\n"], dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
306
+ }
307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TableSortHeaderComponent, decorators: [{
308
+ type: Component,
309
+ args: [{ selector: 'lib-table-sort-header', imports: [
310
+ MatIconModule,
311
+ ], template: "<div class=\"sorting-container\" (click)=\"onSortClick()\">\r\n <mat-icon\r\n [class.selected]=\"selected() && sortState != 'none'\"\r\n [class.rotated]=\"sortState == 'asc'\">\r\n sort\r\n </mat-icon>\r\n</div>", styles: [".sorting-container{display:flex;align-items:center}.sorting-container *{cursor:pointer}.sorting-container .selected{color:#31adff;background-color:#ebf7fc}.sorting-container .rotated{transform:rotate(180deg) scaleX(-1)}\n"] }]
312
+ }] });
313
+
314
+ class TableComponent {
315
+ constructor() {
316
+ this.config = input.required();
317
+ this.action = output();
318
+ this.scrollContainer = viewChild.required('scrollContainer');
319
+ this.selectedRowIndex = -1;
320
+ this.hoverRowIndex = -1;
321
+ this.currentSortColumn = -1;
322
+ }
323
+ getClass(obj, prop) {
324
+ if (!this.config().classRules)
325
+ return '';
326
+ const classes = [];
327
+ for (let rule of this.config().classRules) {
328
+ if (rule.condition(obj, prop)) {
329
+ classes.push(rule.className);
330
+ }
331
+ }
332
+ return classes.join(' ');
333
+ }
334
+ drop(event) {
335
+ if (this.config().draggable) {
336
+ moveItemInArray(this.config().data, event.previousIndex, event.currentIndex);
337
+ this.action.emit({ action: 'drag', obj: this.config().data[event.currentIndex], index: event.currentIndex });
338
+ }
339
+ }
340
+ onScroll() {
341
+ const container = this.scrollContainer().nativeElement;
342
+ // console.log(Math.ceil(container.scrollTop), container.offsetHeight, container.scrollHeight)
343
+ if ((Math.ceil(container.scrollTop) + container.offsetHeight) >= container.scrollHeight) {
344
+ this.action.emit({ action: 'scrolled' });
345
+ }
346
+ }
347
+ onRowClick(event, obj, index) {
348
+ this.selectedRowIndex = index === this.selectedRowIndex ? -1 : index;
349
+ this.action.emit({ action: 'rowClick', obj, index, selected: this.selectedRowIndex === index, event });
350
+ }
351
+ selectOption(оption, obj, index) {
352
+ this.action.emit({ action: оption.toLowerCase(), obj, index, selected: this.selectedRowIndex === index });
353
+ }
354
+ sortByProp(prop, sortState) {
355
+ this.action.emit({ action: 'sort', prop, sortState });
356
+ }
357
+ trackById(index, obj) {
358
+ return obj.id || index;
359
+ }
360
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
361
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: TableComponent, isStandalone: true, selector: "lib-table", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { action: "action" }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flexer\">\r\n @if (config().title) {\r\n <div class=\"row-heading-labels mb05\">{{config().title}}</div>\r\n }\r\n <ng-content select=\".upper-part\"></ng-content>\r\n @if (config().withAdd) {\r\n <div class=\"flexer action pointer gap05 mb05\" (click)=\"action.emit({action: 'add'})\">\r\n <mat-icon>add_circle_outline</mat-icon>\r\n <div>add</div>\r\n </div>\r\n }\r\n</div>\r\n\r\n<div class=\"scroll\" #scrollContainer (scroll)=\"onScroll()\">\r\n <table [class.with-options]=\"config().options?.length\">\r\n <thead>\r\n <tr>\r\n @for (heading of config().tableHeadings; track heading; let i = $index) {\r\n <th>\r\n <div class=\"flexer gap05\">\r\n {{heading}}\r\n @if (config().sortable && !config().draggable) {\r\n <lib-table-sort-header\r\n [selected]=\"currentSortColumn === i\"\r\n (click)=\"currentSortColumn = i\"\r\n (sort)=\"sortByProp(config().dataProps[i], $event)\"\r\n />\r\n }\r\n </div>\r\n </th>\r\n }\r\n @if (config().options?.length) {\r\n <th></th>\r\n }\r\n </tr>\r\n </thead>\r\n @if (config().draggable) {\r\n <tbody cdkDropList (cdkDropListDropped)=\"drop($event)\">\r\n @for (obj of config().data; track trackById(i, obj); let i = $index) {\r\n <tr\r\n (mouseover)=\"hoverRowIndex = i\"\r\n (mouseleave)=\"hoverRowIndex = -1\"\r\n cdkDrag cdkDragLockAxis=\"y\"\r\n [class.pointer]=\"config().selectableRows\"\r\n [class.hover-row]=\"hoverRowIndex == i\"\r\n [class.selected-row]=\"config().selectableRows && selectedRowIndex == i\"\r\n (click)=\"onRowClick($event, obj, i)\"\r\n @fadeInOut>\r\n @for (prop of config().dataProps; track prop; let cellIndex = $index) {\r\n <td\r\n [class.dragCol]=\"cellIndex === 0\">\r\n <div class=\"data\" [classList]=\"getClass(obj, prop)\"\r\n [class.flexer]=\"cellIndex === 0\">\r\n @if (cellIndex === 0) {\r\n <mat-icon class=\"draggable\" cdkDragHandle>\r\n drag_indicator\r\n </mat-icon>\r\n }\r\n {{obj[prop] | blankFiller}}\r\n </div>\r\n </td>\r\n }\r\n @if (config().options?.length) {\r\n <td class=\"right-align\" (click)=\"$event.stopPropagation()\">\r\n <button mat-icon-button class=\"pointer dots right\" [matMenuTriggerFor]=\"optionsMenu\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #optionsMenu=\"matMenu\">\r\n @for (option of config().options; track option) {\r\n <div\r\n mat-menu-item (click)=\"selectOption(option, obj, i)\"\r\n [class.red]=\"option == 'Remove' || option == 'Delete'\">\r\n {{option}}\r\n </div>\r\n }\r\n </mat-menu>\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n } @else {\r\n <tbody>\r\n @for (obj of config().data; track trackById(i, obj); let i = $index) {\r\n <tr\r\n (mouseover)=\"hoverRowIndex = i\"\r\n (mouseleave)=\"hoverRowIndex = -1\"\r\n [class.pointer]=\"config().selectableRows\"\r\n [class.hover-row]=\"hoverRowIndex == i\"\r\n [class.selected-row]=\"config().selectableRows && selectedRowIndex == i\"\r\n (click)=\"onRowClick($event, obj, i)\"\r\n @fadeInOut>\r\n @for (prop of config().dataProps; track prop; let cellIndex = $index) {\r\n <td>\r\n <div class=\"data\" [classList]=\"getClass(obj, prop)\">\r\n {{obj[prop] | blankFiller}}\r\n </div>\r\n </td>\r\n }\r\n @if (config().options?.length) {\r\n <td class=\"right-align\" (click)=\"$event.stopPropagation()\">\r\n <button mat-icon-button class=\"pointer dots right\" [matMenuTriggerFor]=\"optionsMenu\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #optionsMenu=\"matMenu\">\r\n @for (option of config().options; track option) {\r\n <div\r\n mat-menu-item (click)=\"selectOption(option, obj, i)\"\r\n [class.red]=\"option == 'Remove' || option == 'Delete'\">\r\n {{option}}\r\n </div>\r\n }\r\n </mat-menu>\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n }\r\n </table>\r\n</div>", styles: [".scroll{overflow-y:auto;max-height:94%}table{width:100%;border-collapse:collapse;border-spacing:0px}table.with-options td{padding-block:3px!important}.flexer{display:flex;align-items:center}.action{color:#009ddc;font-weight:500;text-align:right;margin-left:auto}.pointer{cursor:pointer}.gap05{gap:.5rem}.mb05{margin-bottom:.5}.data{white-space:pre-wrap}.row-heading-labels{font-weight:700;font-size:20px}.selected-row td{background-color:#d3edf8}.hover-row{background-color:#ebf7fc}.red{color:red}@media (max-width: 1086px){table td,table th{padding:3px!important;width:auto!important}}td,th{padding:.5rem 1rem;font-size:14px}th{background-color:#f6f6f6;text-align:left;position:sticky;top:0;z-index:2;border-top:2px solid #E5E4E7}td{border-bottom:2px solid #E5E4E7;border-top:2px solid #E5E4E7}.dots{width:fit-content}.draggable{cursor:grabbing}.dragCol{padding-left:0!important}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;font-size:1.5em;text-align:center;opacity:.8;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.dragdrop-placeholder{background:#ccc;border:dotted 3px #999;min-height:30px;transition:transform .1s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "pipe", type: WhiteSpaceFillerPipe, name: "blankFiller" }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i1$2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i1$2.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i1$2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3$1.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: TableSortHeaderComponent, selector: "lib-table-sort-header", inputs: ["selected"], outputs: ["sort"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i4.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i4.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i4.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }], animations: [fader] }); }
362
+ }
363
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: TableComponent, decorators: [{
364
+ type: Component,
365
+ args: [{ selector: 'lib-table', animations: [fader], imports: [
366
+ WhiteSpaceFillerPipe,
367
+ MatMenuModule,
368
+ MatIconModule,
369
+ MatButtonModule,
370
+ TableSortHeaderComponent,
371
+ DragDropModule
372
+ ], template: "<div class=\"flexer\">\r\n @if (config().title) {\r\n <div class=\"row-heading-labels mb05\">{{config().title}}</div>\r\n }\r\n <ng-content select=\".upper-part\"></ng-content>\r\n @if (config().withAdd) {\r\n <div class=\"flexer action pointer gap05 mb05\" (click)=\"action.emit({action: 'add'})\">\r\n <mat-icon>add_circle_outline</mat-icon>\r\n <div>add</div>\r\n </div>\r\n }\r\n</div>\r\n\r\n<div class=\"scroll\" #scrollContainer (scroll)=\"onScroll()\">\r\n <table [class.with-options]=\"config().options?.length\">\r\n <thead>\r\n <tr>\r\n @for (heading of config().tableHeadings; track heading; let i = $index) {\r\n <th>\r\n <div class=\"flexer gap05\">\r\n {{heading}}\r\n @if (config().sortable && !config().draggable) {\r\n <lib-table-sort-header\r\n [selected]=\"currentSortColumn === i\"\r\n (click)=\"currentSortColumn = i\"\r\n (sort)=\"sortByProp(config().dataProps[i], $event)\"\r\n />\r\n }\r\n </div>\r\n </th>\r\n }\r\n @if (config().options?.length) {\r\n <th></th>\r\n }\r\n </tr>\r\n </thead>\r\n @if (config().draggable) {\r\n <tbody cdkDropList (cdkDropListDropped)=\"drop($event)\">\r\n @for (obj of config().data; track trackById(i, obj); let i = $index) {\r\n <tr\r\n (mouseover)=\"hoverRowIndex = i\"\r\n (mouseleave)=\"hoverRowIndex = -1\"\r\n cdkDrag cdkDragLockAxis=\"y\"\r\n [class.pointer]=\"config().selectableRows\"\r\n [class.hover-row]=\"hoverRowIndex == i\"\r\n [class.selected-row]=\"config().selectableRows && selectedRowIndex == i\"\r\n (click)=\"onRowClick($event, obj, i)\"\r\n @fadeInOut>\r\n @for (prop of config().dataProps; track prop; let cellIndex = $index) {\r\n <td\r\n [class.dragCol]=\"cellIndex === 0\">\r\n <div class=\"data\" [classList]=\"getClass(obj, prop)\"\r\n [class.flexer]=\"cellIndex === 0\">\r\n @if (cellIndex === 0) {\r\n <mat-icon class=\"draggable\" cdkDragHandle>\r\n drag_indicator\r\n </mat-icon>\r\n }\r\n {{obj[prop] | blankFiller}}\r\n </div>\r\n </td>\r\n }\r\n @if (config().options?.length) {\r\n <td class=\"right-align\" (click)=\"$event.stopPropagation()\">\r\n <button mat-icon-button class=\"pointer dots right\" [matMenuTriggerFor]=\"optionsMenu\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #optionsMenu=\"matMenu\">\r\n @for (option of config().options; track option) {\r\n <div\r\n mat-menu-item (click)=\"selectOption(option, obj, i)\"\r\n [class.red]=\"option == 'Remove' || option == 'Delete'\">\r\n {{option}}\r\n </div>\r\n }\r\n </mat-menu>\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n } @else {\r\n <tbody>\r\n @for (obj of config().data; track trackById(i, obj); let i = $index) {\r\n <tr\r\n (mouseover)=\"hoverRowIndex = i\"\r\n (mouseleave)=\"hoverRowIndex = -1\"\r\n [class.pointer]=\"config().selectableRows\"\r\n [class.hover-row]=\"hoverRowIndex == i\"\r\n [class.selected-row]=\"config().selectableRows && selectedRowIndex == i\"\r\n (click)=\"onRowClick($event, obj, i)\"\r\n @fadeInOut>\r\n @for (prop of config().dataProps; track prop; let cellIndex = $index) {\r\n <td>\r\n <div class=\"data\" [classList]=\"getClass(obj, prop)\">\r\n {{obj[prop] | blankFiller}}\r\n </div>\r\n </td>\r\n }\r\n @if (config().options?.length) {\r\n <td class=\"right-align\" (click)=\"$event.stopPropagation()\">\r\n <button mat-icon-button class=\"pointer dots right\" [matMenuTriggerFor]=\"optionsMenu\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #optionsMenu=\"matMenu\">\r\n @for (option of config().options; track option) {\r\n <div\r\n mat-menu-item (click)=\"selectOption(option, obj, i)\"\r\n [class.red]=\"option == 'Remove' || option == 'Delete'\">\r\n {{option}}\r\n </div>\r\n }\r\n </mat-menu>\r\n </td>\r\n }\r\n </tr>\r\n }\r\n </tbody>\r\n }\r\n </table>\r\n</div>", styles: [".scroll{overflow-y:auto;max-height:94%}table{width:100%;border-collapse:collapse;border-spacing:0px}table.with-options td{padding-block:3px!important}.flexer{display:flex;align-items:center}.action{color:#009ddc;font-weight:500;text-align:right;margin-left:auto}.pointer{cursor:pointer}.gap05{gap:.5rem}.mb05{margin-bottom:.5}.data{white-space:pre-wrap}.row-heading-labels{font-weight:700;font-size:20px}.selected-row td{background-color:#d3edf8}.hover-row{background-color:#ebf7fc}.red{color:red}@media (max-width: 1086px){table td,table th{padding:3px!important;width:auto!important}}td,th{padding:.5rem 1rem;font-size:14px}th{background-color:#f6f6f6;text-align:left;position:sticky;top:0;z-index:2;border-top:2px solid #E5E4E7}td{border-bottom:2px solid #E5E4E7;border-top:2px solid #E5E4E7}.dots{width:fit-content}.draggable{cursor:grabbing}.dragCol{padding-left:0!important}.cdk-drag-preview{box-sizing:border-box;border-radius:4px;font-size:1.5em;text-align:center;opacity:.8;box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.dragdrop-placeholder{background:#ccc;border:dotted 3px #999;min-height:30px;transition:transform .1s cubic-bezier(0,0,.2,1)}\n"] }]
373
+ }] });
374
+
375
+ class LoaderService {
376
+ constructor() {
377
+ this.loadingSubject = new BehaviorSubject(false);
378
+ this.loading$ = this.loadingSubject.asObservable();
379
+ }
380
+ setLoading(loadingState) {
381
+ this.loadingSubject.next(loadingState);
382
+ }
383
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: LoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
384
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: LoaderService, providedIn: 'root' }); }
385
+ }
386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: LoaderService, decorators: [{
387
+ type: Injectable,
388
+ args: [{
389
+ providedIn: 'root'
390
+ }]
391
+ }] });
392
+
393
+ class GlobalLoaderComponent {
394
+ constructor() {
395
+ this.loaderService = inject(LoaderService);
396
+ }
397
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: GlobalLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
398
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: GlobalLoaderComponent, isStandalone: true, selector: "lib-global-loader", ngImport: i0, template: "@if (loaderService.loading$ | async) {\r\n <div class=\"loader\">\r\n <mat-spinner />\r\n </div>\r\n}", styles: [".loader{display:flex;justify-content:center;align-items:center;height:100%;width:100%;position:fixed;top:0;left:0;background-color:#0003;z-index:9999}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i1$3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] }); }
399
+ }
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: GlobalLoaderComponent, decorators: [{
401
+ type: Component,
402
+ args: [{ selector: 'lib-global-loader', imports: [
403
+ AsyncPipe,
404
+ MatProgressSpinnerModule
405
+ ], template: "@if (loaderService.loading$ | async) {\r\n <div class=\"loader\">\r\n <mat-spinner />\r\n </div>\r\n}", styles: [".loader{display:flex;justify-content:center;align-items:center;height:100%;width:100%;position:fixed;top:0;left:0;background-color:#0003;z-index:9999}\n"] }]
406
+ }] });
407
+
408
+ class ErrorService {
409
+ constructor() {
410
+ this.errorSubject = new Subject();
411
+ this.error$ = this.errorSubject.asObservable();
412
+ }
413
+ sendError(error) {
414
+ this.errorSubject.next(error);
415
+ }
416
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
417
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorService, providedIn: 'root' }); }
418
+ }
419
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorService, decorators: [{
420
+ type: Injectable,
421
+ args: [{
422
+ providedIn: 'root'
423
+ }]
424
+ }] });
425
+
426
+ const HTTP_STATUS_CODES = {
427
+ 100: 'Continue',
428
+ 101: 'Switching Protocols',
429
+ 102: 'Processing',
430
+ 103: 'Early Hints',
431
+ 200: 'OK',
432
+ 201: 'Created',
433
+ 202: 'Accepted',
434
+ 203: 'Non-Authoritative Information',
435
+ 204: 'No Content',
436
+ 205: 'Reset Content',
437
+ 206: 'Partial Content',
438
+ 207: 'Multi-Status',
439
+ 208: 'Already Reported',
440
+ 226: 'IM Used',
441
+ 300: 'Multiple Choices',
442
+ 301: 'Moved Permanently',
443
+ 302: 'Found',
444
+ 303: 'See Other',
445
+ 304: 'Not Modified',
446
+ 305: 'Use Proxy',
447
+ 306: '(Unused)',
448
+ 307: 'Temporary Redirect',
449
+ 308: 'Permanent Redirect',
450
+ 400: 'Bad Request',
451
+ 401: 'Unauthorized',
452
+ 402: 'Payment Required',
453
+ 403: 'Forbidden',
454
+ 404: 'Not Found',
455
+ 405: 'Method Not Allowed',
456
+ 406: 'Not Acceptable',
457
+ 407: 'Proxy Authentication Required',
458
+ 408: 'Request Timeout',
459
+ 409: 'Conflict',
460
+ 410: 'Gone',
461
+ 411: 'Length Required',
462
+ 412: 'Precondition Failed',
463
+ 413: 'Payload Too Large',
464
+ 414: 'URI Too Long',
465
+ 415: 'Unsupported Media Type',
466
+ 416: 'Range Not Satisfiable',
467
+ 417: 'Expectation Failed',
468
+ 418: "I'm a teapot",
469
+ 421: 'Misdirected Request',
470
+ 422: 'Unprocessable Entity',
471
+ 423: 'Locked',
472
+ 424: 'Failed Dependency',
473
+ 425: 'Too Early',
474
+ 426: 'Upgrade Required',
475
+ 428: 'Precondition Required',
476
+ 429: 'Too Many Requests',
477
+ 431: 'Request Header Fields Too Large',
478
+ 451: 'Unavailable For Legal Reasons',
479
+ 500: 'Internal Server Error',
480
+ 501: 'Not Implemented',
481
+ 502: 'Bad Gateway',
482
+ 503: 'Service Unavailable',
483
+ 504: 'Gateway Timeout',
484
+ 505: 'HTTP Version Not Supported',
485
+ 506: 'Variant Also Negotiates',
486
+ 507: 'Insufficient Storage',
487
+ 508: 'Loop Detected',
488
+ 510: 'Not Extended',
489
+ 511: 'Network Authentication Required'
490
+ };
491
+
492
+ class ErrorPopupComponent {
493
+ constructor(error) {
494
+ this.error = error;
495
+ this.httpStatusCodes = HTTP_STATUS_CODES;
496
+ }
497
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorPopupComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
498
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.6", type: ErrorPopupComponent, isStandalone: true, selector: "lib-error-popup", ngImport: i0, template: "<lib-default-dialog [dialogTitle]=\"'\u0410n error has occurred'\">\r\n <div class=\"dialog-content\">\r\n <div class=\"status-info\">\r\n <div>{{ error.status }}</div>\r\n @if (error.status) {\r\n <div>{{ httpStatusCodes[error.status] }}</div>\r\n }\r\n </div>\r\n <div class=\"error-info\">\r\n <lib-error-dispaly [error]=\"error\" />\r\n </div>\r\n </div>\r\n</lib-default-dialog>", styles: [".dialog-content{display:flex;flex-direction:column;align-items:center;padding-inline:1rem}.dialog-content .status-info{display:flex;margin-bottom:.5rem;font-weight:600;font-size:18px;gap:.5rem}.dialog-content .error-info{display:grid;place-items:center}\n"], dependencies: [{ kind: "component", type: DefaultDialogComponent, selector: "lib-default-dialog", inputs: ["temRef", "height", "dialogTitle", "withBack"], outputs: ["back"] }, { kind: "component", type: ErrorDispalyComponent, selector: "lib-error-dispaly", inputs: ["error"] }] }); }
499
+ }
500
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorPopupComponent, decorators: [{
501
+ type: Component,
502
+ args: [{ selector: 'lib-error-popup', imports: [
503
+ DefaultDialogComponent,
504
+ ErrorDispalyComponent
505
+ ], template: "<lib-default-dialog [dialogTitle]=\"'\u0410n error has occurred'\">\r\n <div class=\"dialog-content\">\r\n <div class=\"status-info\">\r\n <div>{{ error.status }}</div>\r\n @if (error.status) {\r\n <div>{{ httpStatusCodes[error.status] }}</div>\r\n }\r\n </div>\r\n <div class=\"error-info\">\r\n <lib-error-dispaly [error]=\"error\" />\r\n </div>\r\n </div>\r\n</lib-default-dialog>", styles: [".dialog-content{display:flex;flex-direction:column;align-items:center;padding-inline:1rem}.dialog-content .status-info{display:flex;margin-bottom:.5rem;font-weight:600;font-size:18px;gap:.5rem}.dialog-content .error-info{display:grid;place-items:center}\n"] }]
506
+ }], ctorParameters: () => [{ type: i1$4.HttpErrorResponse, decorators: [{
507
+ type: Inject,
508
+ args: [MAT_DIALOG_DATA]
509
+ }] }] });
510
+
511
+ class ErrorHandlerComponent {
512
+ constructor() {
513
+ this.errSubscriptions = new Subscription();
514
+ this.errorService = inject(ErrorService);
515
+ this.dialog = inject(MatDialog);
516
+ this.errSubscriptions.add(this.errorService.error$.subscribe((err) => {
517
+ console.log(err);
518
+ this.showPopup(err);
519
+ }));
520
+ }
521
+ showPopup(error) {
522
+ this.dialog.closeAll();
523
+ this.dialog.open(ErrorPopupComponent, {
524
+ data: error,
525
+ width: '400px',
526
+ scrollStrategy: new NoopScrollStrategy(),
527
+ });
528
+ }
529
+ ngOnDestroy() {
530
+ this.errSubscriptions.unsubscribe();
531
+ }
532
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorHandlerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
533
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.6", type: ErrorHandlerComponent, isStandalone: true, selector: "lib-error-handler", ngImport: i0, template: "", styles: [""], dependencies: [{ kind: "ngmodule", type: MatDialogModule }] }); }
534
+ }
535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImport: i0, type: ErrorHandlerComponent, decorators: [{
536
+ type: Component,
537
+ args: [{ selector: 'lib-error-handler', imports: [
538
+ MatDialogModule
539
+ ], template: "" }]
540
+ }], ctorParameters: () => [] });
541
+
542
+ /*
543
+ * Public API Surface of ui-lib
544
+ */
545
+
546
+ /**
547
+ * Generated bundle index. Do not edit.
548
+ */
549
+
550
+ export { DefaultDialogComponent, ErrorDispalyComponent, ErrorHandlerComponent, ErrorService, FieldsMatchValidatorDirective, GlobalLoaderComponent, LoaderService, PasswordValidatorDirective, PhoneValidationDirective, SearchBarComponent, SnakeCaseParserPipe, TableComponent, TableSortHeaderComponent, WhiteSpaceFillerPipe, fader, openDropdown, textFader };
551
+ //# sourceMappingURL=ferhaps-easy-ui-lib.mjs.map