@verisoft/ui-core 20.1.1 → 20.1.3

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 (137) hide show
  1. package/fesm2022/verisoft-ui-core.mjs +2026 -0
  2. package/fesm2022/verisoft-ui-core.mjs.map +1 -0
  3. package/index.d.ts +1126 -0
  4. package/package.json +18 -6
  5. package/.eslintrc.json +0 -48
  6. package/jest.config.ts +0 -21
  7. package/ng-package.json +0 -11
  8. package/project.json +0 -36
  9. package/src/index.ts +0 -6
  10. package/src/lib/common/angular-helper.ts +0 -44
  11. package/src/lib/common/constants.ts +0 -5
  12. package/src/lib/common/control.models.ts +0 -80
  13. package/src/lib/common/datasource-component.model.spec.ts +0 -42
  14. package/src/lib/common/datasource-component.model.ts +0 -43
  15. package/src/lib/common/deactivate-guard.model.ts +0 -5
  16. package/src/lib/common/download-file.ts +0 -20
  17. package/src/lib/common/filter.ts +0 -7
  18. package/src/lib/common/icons.ts +0 -34
  19. package/src/lib/common/index.ts +0 -10
  20. package/src/lib/common/notificable-property.model.ts +0 -5
  21. package/src/lib/common/rxjs.spec.ts +0 -58
  22. package/src/lib/common/rxjs.ts +0 -21
  23. package/src/lib/components/action-button-group/action-button-group.model.ts +0 -15
  24. package/src/lib/components/action-button-group/action-button.model.ts +0 -15
  25. package/src/lib/components/action-button-group/index.ts +0 -2
  26. package/src/lib/components/base-form/base-form-input.component.ts +0 -120
  27. package/src/lib/components/base-form/base-form.component.ts +0 -236
  28. package/src/lib/components/base-form/directives/detail-store.directive.ts +0 -219
  29. package/src/lib/components/base-form/index.ts +0 -4
  30. package/src/lib/components/base-form/models/base-form-input.models.ts +0 -11
  31. package/src/lib/components/base-form/models/base-form.models.ts +0 -31
  32. package/src/lib/components/base-form/models/index.ts +0 -2
  33. package/src/lib/components/breadcrumb/breadcrumb.model.ts +0 -21
  34. package/src/lib/components/breadcrumb/breadcrumb.service.ts +0 -9
  35. package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +0 -117
  36. package/src/lib/components/breadcrumb/index.ts +0 -3
  37. package/src/lib/components/button/button.model.ts +0 -21
  38. package/src/lib/components/button/index.ts +0 -1
  39. package/src/lib/components/calendar/calendar.model.ts +0 -16
  40. package/src/lib/components/calendar/index.ts +0 -1
  41. package/src/lib/components/checkbox/checkbox.model.ts +0 -10
  42. package/src/lib/components/checkbox/index.ts +0 -1
  43. package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +0 -31
  44. package/src/lib/components/confirm-dialog/index.ts +0 -1
  45. package/src/lib/components/dropdown/dropdown.model.ts +0 -16
  46. package/src/lib/components/dropdown/index.ts +0 -1
  47. package/src/lib/components/dropdown-button/dropdown-button.model.ts +0 -18
  48. package/src/lib/components/dropdown-button/index.ts +0 -1
  49. package/src/lib/components/dynamic-component/dynamic-component.model.ts +0 -2
  50. package/src/lib/components/dynamic-component/index.ts +0 -1
  51. package/src/lib/components/filter/filter.model.ts +0 -17
  52. package/src/lib/components/filter/index.ts +0 -1
  53. package/src/lib/components/form-field/form-field.model.ts +0 -15
  54. package/src/lib/components/form-field/index.ts +0 -1
  55. package/src/lib/components/generic-field/generic-field.model.ts +0 -10
  56. package/src/lib/components/generic-field/index.ts +0 -1
  57. package/src/lib/components/generic-form/generic-form.component.ts +0 -33
  58. package/src/lib/components/generic-form/index.ts +0 -1
  59. package/src/lib/components/header/header.model.ts +0 -18
  60. package/src/lib/components/header/index.ts +0 -1
  61. package/src/lib/components/icons/icons.component.ts +0 -22
  62. package/src/lib/components/icons/icons.model.ts +0 -16
  63. package/src/lib/components/icons/index.ts +0 -2
  64. package/src/lib/components/index.ts +0 -37
  65. package/src/lib/components/input-group/index.ts +0 -1
  66. package/src/lib/components/input-group/input-group.model.ts +0 -17
  67. package/src/lib/components/loader/index.ts +0 -1
  68. package/src/lib/components/loader/loader.model.ts +0 -7
  69. package/src/lib/components/multiselect/index.ts +0 -1
  70. package/src/lib/components/multiselect/mutiselect.model.ts +0 -13
  71. package/src/lib/components/number-input/index.ts +0 -1
  72. package/src/lib/components/number-input/number-input.model.ts +0 -14
  73. package/src/lib/components/page-header/index.ts +0 -3
  74. package/src/lib/components/page-header/page-header.model.ts +0 -11
  75. package/src/lib/components/page-header/page-header.service.ts +0 -9
  76. package/src/lib/components/page-header/page-headercore.component.ts +0 -42
  77. package/src/lib/components/password/index.ts +0 -1
  78. package/src/lib/components/password/password.model.ts +0 -25
  79. package/src/lib/components/radiobutton/index.ts +0 -1
  80. package/src/lib/components/radiobutton/radiobutton.model.ts +0 -16
  81. package/src/lib/components/section/index.ts +0 -1
  82. package/src/lib/components/section/section.model.ts +0 -11
  83. package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +0 -31
  84. package/src/lib/components/side-menu/index.ts +0 -4
  85. package/src/lib/components/side-menu/services/side-menu-provider.service.ts +0 -13
  86. package/src/lib/components/side-menu/services/side-menu.service.ts +0 -62
  87. package/src/lib/components/side-menu/side-menu.model.ts +0 -67
  88. package/src/lib/components/slider/index.ts +0 -1
  89. package/src/lib/components/slider/slider.model.ts +0 -13
  90. package/src/lib/components/snackbar/index.ts +0 -1
  91. package/src/lib/components/snackbar/snackbar.model.ts +0 -7
  92. package/src/lib/components/stepper/index.ts +0 -1
  93. package/src/lib/components/stepper/stepper.model.ts +0 -24
  94. package/src/lib/components/switch/index.ts +0 -1
  95. package/src/lib/components/switch/switch.model.ts +0 -8
  96. package/src/lib/components/tab-view/index.ts +0 -1
  97. package/src/lib/components/tab-view/tab-view.model.ts +0 -22
  98. package/src/lib/components/table/column-configuration.ts +0 -38
  99. package/src/lib/components/table/index.ts +0 -4
  100. package/src/lib/components/table/table-builder.ts +0 -93
  101. package/src/lib/components/table/table-column.directive.ts +0 -62
  102. package/src/lib/components/table/table.models.ts +0 -261
  103. package/src/lib/components/table-filter/index.ts +0 -1
  104. package/src/lib/components/table-filter/table-filter.model.ts +0 -22
  105. package/src/lib/components/tag/index.ts +0 -1
  106. package/src/lib/components/tag/tag.model.ts +0 -13
  107. package/src/lib/components/textarea/index.ts +0 -1
  108. package/src/lib/components/textarea/textarea.model.ts +0 -13
  109. package/src/lib/components/textfield/index.ts +0 -1
  110. package/src/lib/components/textfield/textfield.model.ts +0 -13
  111. package/src/lib/components/tooltip/index.ts +0 -1
  112. package/src/lib/components/tooltip/tooltip.model.ts +0 -13
  113. package/src/lib/components/unsubscribe.component.ts +0 -12
  114. package/src/lib/directives/datasource.directive.ts +0 -275
  115. package/src/lib/directives/index.ts +0 -4
  116. package/src/lib/directives/shortcut.directive.ts +0 -37
  117. package/src/lib/directives/table-datasource.directive.ts +0 -184
  118. package/src/lib/directives/table-filter.directive.ts +0 -69
  119. package/src/lib/format/format.ts +0 -74
  120. package/src/lib/pipes/error/error.codes.ts +0 -11
  121. package/src/lib/pipes/error/error.models.ts +0 -27
  122. package/src/lib/pipes/error/error.pipe.ts +0 -27
  123. package/src/lib/pipes/error/warning.codes.ts +0 -5
  124. package/src/lib/pipes/error/warning.pipe.ts +0 -27
  125. package/src/lib/pipes/helper/enumToList.pipe.ts +0 -16
  126. package/src/lib/pipes/index.ts +0 -7
  127. package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +0 -23
  128. package/src/lib/services/confirm-dialog.service.ts +0 -44
  129. package/src/lib/services/index.ts +0 -4
  130. package/src/lib/services/leave-form.service.ts +0 -53
  131. package/src/lib/services/screen-size.service.ts +0 -25
  132. package/src/lib/services/table.service.ts +0 -22
  133. package/src/test-setup.ts +0 -8
  134. package/tsconfig.json +0 -28
  135. package/tsconfig.lib.json +0 -17
  136. package/tsconfig.lib.prod.json +0 -9
  137. package/tsconfig.spec.json +0 -16
@@ -0,0 +1,2026 @@
1
+ import * as i0 from '@angular/core';
2
+ import { SimpleChange, InjectionToken, inject, Input, Component, Injectable, EventEmitter, Output, signal, ChangeDetectorRef, HostListener, Directive, Optional, Inject, TemplateRef, ContentChild, input, Pipe } from '@angular/core';
3
+ import { startWith, switchMap, merge, map, debounceTime, BehaviorSubject, Subject, takeUntil, filter, tap, of, catchError } from 'rxjs';
4
+ import * as i1 from '@angular/forms';
5
+ import { FormControlName, FormControlDirective, NgModel, FormControl, ReactiveFormsModule } from '@angular/forms';
6
+ import { ERROR_PROVIDER_TOKEN, BASE_URL_PATH, normalizeRequest, DEFAULT_SEARCH_LIMIT, convertDatasource, BaseHttpService, toCzechDateTimeString } from '@verisoft/core';
7
+ import { cloneDeep } from 'lodash-es';
8
+ import { TranslateService } from '@ngx-translate/core';
9
+ import * as i1$1 from '@angular/router';
10
+ import { ActivatedRoute, Router, NavigationEnd } from '@angular/router';
11
+ import { Store, createSelector, createFeatureSelector } from '@ngrx/store';
12
+ import { createResetStateAction, createInitNewDetailAction, createInitDetailAction, createUpdateDetailAction, createUpdateFormStateAction, createUpdateDetailSetErrorsAction } from '@verisoft/store';
13
+ import { v4 } from 'uuid';
14
+ import { HttpClient } from '@angular/common/http';
15
+
16
+ function setComponentProperties(component, value, firstChange = false) {
17
+ if (!value || !component) {
18
+ return;
19
+ }
20
+ const simpleChanges = Object.keys(value).reduce((changes, property) => {
21
+ const indexedComponent = component;
22
+ const indexedValue = value;
23
+ const previousValue = indexedComponent[property];
24
+ const currentValue = indexedValue[property];
25
+ if (currentValue !== previousValue) {
26
+ indexedComponent[property] = currentValue;
27
+ const change = new SimpleChange(previousValue, currentValue, firstChange);
28
+ return { ...changes, [property]: change };
29
+ }
30
+ return changes;
31
+ }, {});
32
+ const changeableComponent = component;
33
+ if (changeableComponent['ngOnChanges']) {
34
+ changeableComponent.ngOnChanges(simpleChanges);
35
+ }
36
+ }
37
+
38
+ var ControlSeverity;
39
+ (function (ControlSeverity) {
40
+ ControlSeverity["success"] = "success";
41
+ ControlSeverity["info"] = "info";
42
+ ControlSeverity["warning"] = "warning";
43
+ ControlSeverity["danger"] = "danger";
44
+ ControlSeverity["help"] = "help";
45
+ ControlSeverity["primary"] = "primary";
46
+ ControlSeverity["secondary"] = "secondary";
47
+ ControlSeverity["contrast"] = "contrast";
48
+ })(ControlSeverity || (ControlSeverity = {}));
49
+ var GovControlSeverity;
50
+ (function (GovControlSeverity) {
51
+ GovControlSeverity["primary"] = "primary";
52
+ GovControlSeverity["secondary"] = "secondary";
53
+ GovControlSeverity["neutral"] = "neutral";
54
+ GovControlSeverity["error"] = "error";
55
+ GovControlSeverity["success"] = "success";
56
+ GovControlSeverity["warning"] = "warning";
57
+ })(GovControlSeverity || (GovControlSeverity = {}));
58
+ var GovButtonType;
59
+ (function (GovButtonType) {
60
+ GovButtonType["solid"] = "solid";
61
+ GovButtonType["outlined"] = "outlined";
62
+ GovButtonType["base"] = "base";
63
+ GovButtonType["link"] = "link";
64
+ })(GovButtonType || (GovButtonType = {}));
65
+ var IconPosition;
66
+ (function (IconPosition) {
67
+ IconPosition["left"] = "left";
68
+ IconPosition["right"] = "right";
69
+ })(IconPosition || (IconPosition = {}));
70
+ var SlotPosition;
71
+ (function (SlotPosition) {
72
+ SlotPosition["top"] = "top";
73
+ SlotPosition["bottom"] = "bottom";
74
+ })(SlotPosition || (SlotPosition = {}));
75
+ var Position;
76
+ (function (Position) {
77
+ Position["top"] = "top";
78
+ Position["bottom"] = "bottom";
79
+ Position["left"] = "left";
80
+ Position["right"] = "right";
81
+ })(Position || (Position = {}));
82
+ var FieldSize;
83
+ (function (FieldSize) {
84
+ FieldSize["small"] = "small";
85
+ FieldSize["medium"] = "medium";
86
+ FieldSize["large"] = "large";
87
+ FieldSize["xl"] = "xl";
88
+ })(FieldSize || (FieldSize = {}));
89
+ var FieldAlign;
90
+ (function (FieldAlign) {
91
+ FieldAlign["left"] = "left";
92
+ FieldAlign["center"] = "center";
93
+ FieldAlign["right"] = "right";
94
+ })(FieldAlign || (FieldAlign = {}));
95
+ var FieldType;
96
+ (function (FieldType) {
97
+ FieldType["text"] = "text";
98
+ FieldType["number"] = "number";
99
+ FieldType["password"] = "password";
100
+ FieldType["search"] = "search";
101
+ FieldType["date"] = "date";
102
+ })(FieldType || (FieldType = {}));
103
+ var LayoutType;
104
+ (function (LayoutType) {
105
+ LayoutType["horizontal"] = "horizontal";
106
+ LayoutType["vertical"] = "vertical";
107
+ })(LayoutType || (LayoutType = {}));
108
+
109
+ const DEFAULT_DEBOUNCE_TIME = 300;
110
+ const DEFAULT_PAGINATION = [10, 25, 50, 100];
111
+ const MAX_COLUMN_CHAR_COUNT = 30;
112
+
113
+ function setDataToArray(targetArray, data, offset = 0, total = undefined, defaultItem = undefined) {
114
+ const totalItems = total ?? data.length + offset;
115
+ if (!targetArray) {
116
+ targetArray = Array(totalItems).fill(defaultItem);
117
+ }
118
+ if (targetArray.length < totalItems) {
119
+ targetArray = targetArray.concat(new Array(totalItems - targetArray.length).fill(defaultItem));
120
+ }
121
+ for (let i = 0; i < data.length; i++) {
122
+ targetArray[i + offset] = data[i] ?? defaultItem;
123
+ }
124
+ return targetArray;
125
+ }
126
+
127
+ function isFilterEmpty(filter) {
128
+ if (filter == undefined) {
129
+ return true;
130
+ }
131
+ return !Object.entries(filter).some((x) => x[1] != undefined);
132
+ }
133
+
134
+ function queryListChanged(list) {
135
+ return list.changes.pipe(startWith({}), switchMap(() => {
136
+ const actionPropertyChanges$ = list
137
+ .toArray()
138
+ .filter((action) => action.propertyChanged)
139
+ .map((action) => action.propertyChanged);
140
+ return merge(...actionPropertyChanges$).pipe(startWith({}), map(() => list.toArray()));
141
+ }), debounceTime(50));
142
+ }
143
+
144
+ function downloadText(filename, text, mimeType = 'text/plain') {
145
+ const blob = new Blob([text], { type: mimeType });
146
+ downloadFile(filename, blob);
147
+ }
148
+ function downloadFile(filename, blob) {
149
+ const url = window.URL.createObjectURL(blob);
150
+ const a = document.createElement('a');
151
+ a.href = url;
152
+ a.download = filename;
153
+ a.click();
154
+ window.URL.revokeObjectURL(url);
155
+ }
156
+
157
+ const ACTION_BUTTON_GROUP_COMPONENT_TOKEN = new InjectionToken('ActionButtonGroupComponentToken');
158
+
159
+ const noop = () => {
160
+ /* */
161
+ };
162
+ class BaseFormInputComponent {
163
+ control;
164
+ ngControl;
165
+ errorService = inject(ERROR_PROVIDER_TOKEN);
166
+ formControl;
167
+ constructor(control) {
168
+ this.control = control;
169
+ this.ngControl = control;
170
+ if (this.control) {
171
+ this.ngControl.valueAccessor = this;
172
+ }
173
+ }
174
+ label;
175
+ required = false;
176
+ readonly;
177
+ disabled;
178
+ tooltip;
179
+ formDisplay = 'flex';
180
+ clearable = true;
181
+ placeholder = '';
182
+ testId;
183
+ inputId = Math.random().toString(36).substring(2);
184
+ selectionChanged = noop;
185
+ onTouch = noop;
186
+ registerOnChange(fn) {
187
+ this.selectionChanged = fn;
188
+ }
189
+ registerOnTouched(fn) {
190
+ this.onTouch = fn;
191
+ }
192
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
193
+ writeValue(value) { }
194
+ ngOnInit() {
195
+ if (this.ngControl) {
196
+ if (this.ngControl instanceof FormControlName) {
197
+ this.formControl =
198
+ this.ngControl.control ||
199
+ this.ngControl.formDirective?.form.controls[this.ngControl.name];
200
+ }
201
+ else if (this.ngControl instanceof FormControlDirective ||
202
+ this.ngControl instanceof NgModel) {
203
+ this.formControl = this.ngControl.control;
204
+ if (this.ngControl instanceof NgModel) {
205
+ this.formControl.valueChanges.subscribe(() => this.ngControl?.viewToModelUpdate(this.control?.value));
206
+ }
207
+ }
208
+ else {
209
+ this.formControl = new FormControl();
210
+ }
211
+ }
212
+ else {
213
+ this.formControl = new FormControl();
214
+ }
215
+ }
216
+ isRequired() {
217
+ if (this.ngControl) {
218
+ const validator = this.ngControl?.control?.validator?.({});
219
+ return this.required || (validator && validator['required']);
220
+ }
221
+ return this.required;
222
+ }
223
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BaseFormInputComponent, deps: [{ token: i1.NgControl }], target: i0.ɵɵFactoryTarget.Component });
224
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.1", type: BaseFormInputComponent, isStandalone: true, selector: "ng-component", inputs: { label: "label", required: "required", readonly: "readonly", disabled: "disabled", tooltip: "tooltip", formDisplay: "formDisplay", clearable: "clearable", placeholder: "placeholder", testId: "testId" }, ngImport: i0, template: '', isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }] });
225
+ }
226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BaseFormInputComponent, decorators: [{
227
+ type: Component,
228
+ args: [{
229
+ template: '',
230
+ imports: [ReactiveFormsModule]
231
+ }]
232
+ }], ctorParameters: () => [{ type: i1.NgControl }], propDecorators: { label: [{
233
+ type: Input
234
+ }], required: [{
235
+ type: Input
236
+ }], readonly: [{
237
+ type: Input
238
+ }], disabled: [{
239
+ type: Input
240
+ }], tooltip: [{
241
+ type: Input
242
+ }], formDisplay: [{
243
+ type: Input
244
+ }], clearable: [{
245
+ type: Input
246
+ }], placeholder: [{
247
+ type: Input
248
+ }], testId: [{
249
+ type: Input
250
+ }] } });
251
+
252
+ class ScreenSizeService {
253
+ isMobileBlock = new BehaviorSubject(false);
254
+ prevState = false;
255
+ constructor() {
256
+ this.checkScreenSize();
257
+ window.addEventListener('resize', async () => {
258
+ await this.checkScreenSize();
259
+ });
260
+ }
261
+ async checkScreenSize() {
262
+ const isMobile = window.matchMedia('(max-width: 768px)').matches;
263
+ if (isMobile !== this.prevState) {
264
+ this.prevState = isMobile;
265
+ this.isMobileBlock.next(isMobile);
266
+ }
267
+ }
268
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ScreenSizeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
269
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ScreenSizeService, providedIn: 'root' });
270
+ }
271
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ScreenSizeService, decorators: [{
272
+ type: Injectable,
273
+ args: [{
274
+ providedIn: 'root',
275
+ }]
276
+ }], ctorParameters: () => [] });
277
+
278
+ class DialogService {
279
+ showEvent = new EventEmitter();
280
+ closeEvent = new EventEmitter();
281
+ showDialog(data) {
282
+ const mappedData = this.mapInputAndOutpus(data);
283
+ this.showEvent.emit({
284
+ ...data,
285
+ data: mappedData,
286
+ });
287
+ }
288
+ mapInputAndOutpus(data) {
289
+ const inputsAndOutputs = data.data;
290
+ return {
291
+ ...data.data,
292
+ ...(Object.keys(inputsAndOutputs ?? {})
293
+ .filter((key) => typeof inputsAndOutputs[key] === 'function')
294
+ .reduce((acc, key) => {
295
+ acc[key] = (value) => {
296
+ if (typeof inputsAndOutputs[key] === 'function') {
297
+ inputsAndOutputs[key](value);
298
+ }
299
+ };
300
+ return acc;
301
+ }, {})),
302
+ };
303
+ }
304
+ closeModal() {
305
+ this.closeEvent.emit();
306
+ }
307
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
308
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DialogService, providedIn: 'root' });
309
+ }
310
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DialogService, decorators: [{
311
+ type: Injectable,
312
+ args: [{
313
+ providedIn: 'root',
314
+ }]
315
+ }], propDecorators: { showEvent: [{
316
+ type: Output
317
+ }], closeEvent: [{
318
+ type: Output
319
+ }] } });
320
+
321
+ class PreventUnsavedChangesDirective {
322
+ dialogService = inject(DialogService);
323
+ translateService = inject(TranslateService);
324
+ Icons;
325
+ canDeactivate(component) {
326
+ if (!component || !component.canDeactivate) {
327
+ return true;
328
+ }
329
+ const result = component.canDeactivate();
330
+ return result;
331
+ }
332
+ showConfirmationDialog() {
333
+ const resultSubject = new Subject();
334
+ const title = this.translateService.instant('VALIDATIONS.UNSAVED_CHANGES');
335
+ const message = this.translateService.instant('VALIDATIONS.LEAVING_UNSAVED_FORM');
336
+ const leaveButton = this.translateService.instant('BUTTONS.LEAVE');
337
+ const stayButton = this.translateService.instant('BUTTONS.STAY');
338
+ this.dialogService.showDialog({
339
+ title: title,
340
+ headerIcon: this.Icons.infoCircle,
341
+ innerHTML: `<p>${message}</p>`,
342
+ showCancelButton: true,
343
+ confirmButtonText: stayButton,
344
+ cancelButtonText: leaveButton,
345
+ confirmButtonFn: () => {
346
+ resultSubject.next(false);
347
+ resultSubject.complete();
348
+ this.dialogService.closeModal();
349
+ },
350
+ cancelButtonFn: () => {
351
+ resultSubject.next(true);
352
+ resultSubject.complete();
353
+ this.dialogService.closeModal();
354
+ },
355
+ });
356
+ return resultSubject.asObservable();
357
+ }
358
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PreventUnsavedChangesDirective, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
359
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PreventUnsavedChangesDirective, providedIn: 'root' });
360
+ }
361
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PreventUnsavedChangesDirective, decorators: [{
362
+ type: Injectable,
363
+ args: [{
364
+ providedIn: 'root',
365
+ }]
366
+ }] });
367
+
368
+ class TableService {
369
+ reload = signal(Symbol(), ...(ngDevMode ? [{ debugName: "reload" }] : []));
370
+ /**
371
+ * If name is set, reload a specific table with the set`[tableName]`
372
+ *
373
+ * If name is NOT set, reload all tables in the current DOM
374
+ * */
375
+ forceReload(name) {
376
+ if (name) {
377
+ this.reload.set({ name: name, symbol: Symbol() });
378
+ }
379
+ else {
380
+ this.reload.set(Symbol());
381
+ }
382
+ }
383
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
384
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableService, providedIn: 'root' });
385
+ }
386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableService, decorators: [{
387
+ type: Injectable,
388
+ args: [{
389
+ providedIn: 'root'
390
+ }]
391
+ }] });
392
+
393
+ class BaseInputControls {
394
+ value;
395
+ ngControl;
396
+ label;
397
+ required;
398
+ }
399
+
400
+ function isFormStateEqual(current, other) {
401
+ if (!current && !other) {
402
+ return true;
403
+ }
404
+ if (current && other) {
405
+ return current.dirty === other.dirty && current.valid === other.valid;
406
+ }
407
+ return false;
408
+ }
409
+
410
+ class BaseFormDirective {
411
+ data;
412
+ dataChange = new EventEmitter();
413
+ statusChange = new EventEmitter();
414
+ formSubmit = new EventEmitter();
415
+ formClear = new EventEmitter();
416
+ formDestroyed$ = new Subject();
417
+ keys = [];
418
+ formGroup;
419
+ cd = inject(ChangeDetectorRef);
420
+ valueInitialization = false;
421
+ lastState;
422
+ guardViewChild;
423
+ formSubmitted = false;
424
+ guard = inject(PreventUnsavedChangesDirective);
425
+ unloadHandler(event) {
426
+ if (this.formGroup.dirty) {
427
+ event.preventDefault();
428
+ }
429
+ }
430
+ canDeactivate() {
431
+ if (this.formGroup.dirty && !this.formSubmitted) {
432
+ const result = this.guard.showConfirmationDialog();
433
+ return result;
434
+ }
435
+ return true;
436
+ }
437
+ ngOnInit() {
438
+ this.initializeFormGroup();
439
+ }
440
+ ngOnChanges(changes) {
441
+ if (changes['data'] && this.formGroup) {
442
+ this.valueInitialization = true;
443
+ const dirty = this.formGroup.dirty;
444
+ this.formGroup.patchValue(this.fromModel(this.data), {
445
+ emitEvent: false,
446
+ onlySelf: true,
447
+ });
448
+ this.formGroup.updateValueAndValidity();
449
+ if (!dirty) {
450
+ this.formGroup.markAsPristine();
451
+ }
452
+ this.valueInitialization = false;
453
+ this.createAndEmitIfFormStateChanged();
454
+ }
455
+ }
456
+ ngAfterViewInit() {
457
+ this.cd.detectChanges();
458
+ }
459
+ ngOnDestroy() {
460
+ this.formDestroyed$.next();
461
+ this.formDestroyed$.complete();
462
+ }
463
+ createCompleteData() {
464
+ const change = this.toModel(this.formGroup?.value);
465
+ this.recursiveObjectAttributesTransformation(change);
466
+ const updatedData = this.applyChanges(cloneDeep(this.data), cloneDeep(change));
467
+ return updatedData;
468
+ }
469
+ submit() {
470
+ this.formSubmitted = true;
471
+ this.formGroup.markAllAsTouched();
472
+ if (!this.formGroup.invalid) {
473
+ this.formSubmit.emit(this.createCompleteData());
474
+ }
475
+ this.formGroup.markAsPristine();
476
+ }
477
+ clear() {
478
+ this.formClear.emit();
479
+ }
480
+ initializeFormGroup() {
481
+ this.formGroup = this.createFormGroup();
482
+ this.valueInitialization = true;
483
+ this.formGroup.patchValue(this.fromModel(this.data), {
484
+ emitEvent: false,
485
+ onlySelf: true,
486
+ });
487
+ this.formGroup.markAsPristine();
488
+ this.initValueChanges();
489
+ this.initStatusChanges();
490
+ this.valueInitialization = false;
491
+ }
492
+ initValueChanges() {
493
+ this.formGroup.valueChanges
494
+ .pipe(takeUntil(this.formDestroyed$), filter(() => !this.valueInitialization), map((value) => {
495
+ const change = this.toModel(value);
496
+ this.recursiveObjectAttributesTransformation(change);
497
+ const updatedData = this.applyChanges(cloneDeep(this.data), cloneDeep(change));
498
+ return updatedData;
499
+ }))
500
+ .subscribe((updatedData) => {
501
+ this.dataChange.emit(updatedData);
502
+ });
503
+ }
504
+ initStatusChanges() {
505
+ this.formGroup.statusChanges
506
+ .pipe(takeUntil(this.formDestroyed$))
507
+ .subscribe(() => {
508
+ if (!this.valueInitialization) {
509
+ this.createAndEmitIfFormStateChanged();
510
+ }
511
+ });
512
+ this.createAndEmitIfFormStateChanged();
513
+ }
514
+ createAndEmitIfFormStateChanged() {
515
+ const formState = {
516
+ valid: !this.formGroup.invalid,
517
+ dirty: this.formGroup.dirty,
518
+ };
519
+ if (!isFormStateEqual(formState, this.lastState)) {
520
+ this.lastState = formState;
521
+ this.statusChange.emit(formState);
522
+ }
523
+ }
524
+ applyChanges(data, changes) {
525
+ return Object.assign(data || {}, changes);
526
+ }
527
+ toModel(data) {
528
+ return data || {};
529
+ }
530
+ fromModel(data) {
531
+ return { ...(data || {}) };
532
+ }
533
+ recursiveObjectAttributesTransformation(obj) {
534
+ this.recursiveObjectAttributesTraversal(obj, this.transformEmptyStringToNullStringFn);
535
+ }
536
+ recursiveObjectAttributesTraversal(obj, transformationFn) {
537
+ if (obj === null ||
538
+ transformationFn === null ||
539
+ typeof transformationFn !== 'function') {
540
+ return;
541
+ }
542
+ const traverse = (obj) => {
543
+ for (const key in obj) {
544
+ // eslint-disable-next-line no-prototype-builtins
545
+ if (obj.hasOwnProperty(key)) {
546
+ transformationFn(obj, key);
547
+ if (typeof obj[key] === 'object') {
548
+ traverse(obj[key]);
549
+ }
550
+ }
551
+ }
552
+ };
553
+ traverse(obj);
554
+ }
555
+ transformEmptyStringToNullStringFn(obj, key) {
556
+ // if empty string - transformation to null string
557
+ if (typeof obj[key] === 'string' && obj[key] === '') {
558
+ try {
559
+ obj[key] = null;
560
+ }
561
+ catch (error) {
562
+ console.error(`Cannot modify ${key}: ${error}`);
563
+ }
564
+ }
565
+ }
566
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BaseFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
567
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: BaseFormDirective, isStandalone: true, selector: "[v-baseForm]", inputs: { data: "data" }, outputs: { dataChange: "dataChange", statusChange: "statusChange", formSubmit: "formSubmit", formClear: "formClear" }, host: { listeners: { "window:beforeunload": "unloadHandler($event)" } }, usesOnChanges: true, ngImport: i0 });
568
+ }
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BaseFormDirective, decorators: [{
570
+ type: Directive,
571
+ args: [{
572
+ // eslint-disable-next-line @angular-eslint/directive-selector
573
+ selector: '[v-baseForm]',
574
+ standalone: true,
575
+ }]
576
+ }], propDecorators: { data: [{
577
+ type: Input
578
+ }], dataChange: [{
579
+ type: Output
580
+ }], statusChange: [{
581
+ type: Output
582
+ }], formSubmit: [{
583
+ type: Output
584
+ }], formClear: [{
585
+ type: Output
586
+ }], unloadHandler: [{
587
+ type: HostListener,
588
+ args: ['window:beforeunload', ['$event']]
589
+ }] } });
590
+
591
+ class UnsubscribeComponent {
592
+ destroyed$ = new Subject();
593
+ ngOnDestroy() {
594
+ this.destroyed$.next();
595
+ this.destroyed$.complete();
596
+ }
597
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: UnsubscribeComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
598
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: UnsubscribeComponent, isStandalone: true, ngImport: i0 });
599
+ }
600
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: UnsubscribeComponent, decorators: [{
601
+ type: Directive
602
+ }] });
603
+
604
+ class DetailStoreDirective extends UnsubscribeComponent {
605
+ form;
606
+ detailsRepository;
607
+ autoBind = true;
608
+ detailId;
609
+ ngrxFeatureKey;
610
+ destroyForm = true;
611
+ readonly = false;
612
+ readonlyControlNames = [];
613
+ store = inject(Store);
614
+ cdr = inject(ChangeDetectorRef);
615
+ route = inject(ActivatedRoute);
616
+ itemCache = null;
617
+ loaded;
618
+ ngOnInit() {
619
+ if (!this.loaded) {
620
+ this.listenFormState();
621
+ }
622
+ this.listenFormChange();
623
+ this.listenFormStatusChange();
624
+ }
625
+ ngAfterViewInit() {
626
+ if (this.autoBind && !this.loaded) {
627
+ this.initForm();
628
+ }
629
+ }
630
+ ngOnDestroy() {
631
+ super.ngOnDestroy();
632
+ if (this.destroyForm) {
633
+ this.store.dispatch(createResetStateAction(this.detailsRepository)());
634
+ }
635
+ }
636
+ initForm() {
637
+ if (this.detailId === 'create') {
638
+ this.store.dispatch(createInitNewDetailAction(this.detailsRepository)());
639
+ }
640
+ else {
641
+ this.store.dispatch(createInitDetailAction(this.detailsRepository)({ obj: this.detailId }));
642
+ }
643
+ if (this.readonly) {
644
+ this.form.formGroup.disable();
645
+ return;
646
+ }
647
+ this.readonlyControlNames.forEach(x => {
648
+ this.form.formGroup.get(x)?.disable();
649
+ });
650
+ }
651
+ listenFormState() {
652
+ const selectIncomeData = createSelector(createFeatureSelector(this.ngrxFeatureKey), (state) => state?.[this.detailsRepository]);
653
+ this.store
654
+ .select(selectIncomeData)
655
+ .pipe(takeUntil(this.destroyed$))
656
+ .subscribe(({ item, loaded, backendValidationErrors } = {
657
+ item: undefined,
658
+ loaded: false,
659
+ saveItemState: { saveInProgress: false },
660
+ backendValidationErrors: []
661
+ }) => {
662
+ if (item
663
+ && ((item.validationErrors || item.validationWarnings) && !this.form.formGroup.dirty)
664
+ || backendValidationErrors.length) {
665
+ this.handleValidation('propertyName', item.validationWarnings || [], 'validationWarning', 'warningMessage');
666
+ this.handleValidation('propertyName', item.validationErrors || [], 'validationError', 'errorMessage');
667
+ if (this.itemCache && this.isStateChanged(item) && backendValidationErrors.length) {
668
+ backendValidationErrors = this.dispatchErrors(item, backendValidationErrors);
669
+ }
670
+ this.handleBackendValidation(backendValidationErrors);
671
+ this.cdr.markForCheck();
672
+ }
673
+ this.itemCache = item;
674
+ this.loaded = loaded;
675
+ this.cdr.detectChanges();
676
+ });
677
+ }
678
+ listenFormChange() {
679
+ this.form.dataChange.pipe(takeUntil(this.destroyed$)).subscribe((item) => {
680
+ this.store.dispatch(createUpdateDetailAction(this.detailsRepository)({ item }));
681
+ });
682
+ }
683
+ listenFormStatusChange() {
684
+ this.form.statusChange
685
+ .pipe(takeUntil(this.destroyed$))
686
+ .subscribe((formState) => {
687
+ this.store.dispatch(createUpdateFormStateAction(this.detailsRepository)({ formState }));
688
+ });
689
+ }
690
+ handleValidation = (controlName, errors, errorKey, messageKey) => {
691
+ if (errors.length > 0)
692
+ return;
693
+ errors.forEach((error) => {
694
+ const control = this.form.formGroup.get(error[controlName]);
695
+ if (control) {
696
+ control.disabled
697
+ ? control.disable({ emitEvent: false, onlySelf: true })
698
+ : control.enable({ emitEvent: false, onlySelf: true });
699
+ control.setErrors({ [errorKey]: error[messageKey] }, { emitEvent: true });
700
+ control.markAsDirty();
701
+ }
702
+ });
703
+ };
704
+ handleBackendValidation(errors) {
705
+ errors.forEach(({ parameters, code }) => {
706
+ const control = this.form.formGroup.get(this.normalizePropertyNames(parameters));
707
+ if (!control)
708
+ return;
709
+ control[control.disabled ? "disable" : "enable"]({ emitEvent: false, onlySelf: true });
710
+ control.setErrors({ "validationError": code }, { emitEvent: true });
711
+ control.markAsDirty();
712
+ });
713
+ }
714
+ dispatchErrors(item, errors) {
715
+ const error = errors.filter((e) => {
716
+ return this.itemCache[this.normalizePropertyNames(e.parameters)] === item[this.normalizePropertyNames(e.parameters)];
717
+ });
718
+ this.store.dispatch(createUpdateDetailSetErrorsAction(this.detailsRepository)({ error }));
719
+ return error;
720
+ }
721
+ normalizePropertyNames(input) {
722
+ return String(input[0]).toLocaleLowerCase() + String(input).slice(1);
723
+ }
724
+ isStateChanged(item) {
725
+ return item !== this.itemCache;
726
+ }
727
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DetailStoreDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
728
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: DetailStoreDirective, isStandalone: true, selector: "[v-useDetailStore]", inputs: { form: "form", detailsRepository: "detailsRepository", autoBind: "autoBind", detailId: "detailId", ngrxFeatureKey: "ngrxFeatureKey", destroyForm: "destroyForm", readonly: "readonly", readonlyControlNames: "readonlyControlNames" }, exportAs: ["useDetailStore"], usesInheritance: true, ngImport: i0 });
729
+ }
730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DetailStoreDirective, decorators: [{
731
+ type: Directive,
732
+ args: [{
733
+ // eslint-disable-next-line @angular-eslint/directive-selector
734
+ selector: '[v-useDetailStore]',
735
+ exportAs: 'useDetailStore',
736
+ standalone: true,
737
+ }]
738
+ }], propDecorators: { form: [{
739
+ type: Input,
740
+ args: [{ required: true }]
741
+ }], detailsRepository: [{
742
+ type: Input,
743
+ args: [{ required: true }]
744
+ }], autoBind: [{
745
+ type: Input
746
+ }], detailId: [{
747
+ type: Input
748
+ }], ngrxFeatureKey: [{
749
+ type: Input,
750
+ args: [{ required: true }]
751
+ }], destroyForm: [{
752
+ type: Input
753
+ }], readonly: [{
754
+ type: Input
755
+ }], readonlyControlNames: [{
756
+ type: Input
757
+ }] } });
758
+
759
+ const BREADCRUMB_COMPONENT_TOKEN = new InjectionToken('BreadcrumbComponentToken');
760
+
761
+ class BreadcrumbService {
762
+ routeChange = new EventEmitter();
763
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BreadcrumbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
764
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BreadcrumbService, providedIn: 'root' });
765
+ }
766
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BreadcrumbService, decorators: [{
767
+ type: Injectable,
768
+ args: [{
769
+ providedIn: 'root',
770
+ }]
771
+ }], propDecorators: { routeChange: [{
772
+ type: Output
773
+ }] } });
774
+
775
+ class BreadcrumbCoreComponent extends UnsubscribeComponent {
776
+ items = [];
777
+ homeRoute = '/';
778
+ useHomeRoute = false;
779
+ static ROUTE_DATA_BREADCRUMB = 'breadcrumb';
780
+ static ROUTE_DATA_BREADCRUMB_URL = 'breadcrumb_url';
781
+ static ROUTE_DATA_NO_BREADCRUMB_ROUTE = 'breadcrumb_no_route';
782
+ static BREADCRUMB_HIDE = 'breadcrumb_hide';
783
+ home = { icon: 'pi pi-home', routerLink: this.homeRoute };
784
+ router = inject(Router);
785
+ activatedRoute = inject(ActivatedRoute);
786
+ breadcrumbService = inject(BreadcrumbService);
787
+ cdr = inject(ChangeDetectorRef);
788
+ ngOnInit() {
789
+ this.initBreadcrumbsCreation();
790
+ this.initRouteChangeListen();
791
+ }
792
+ initBreadcrumbsCreation() {
793
+ this.router.events
794
+ .pipe(filter((event) => event instanceof NavigationEnd), takeUntil(this.destroyed$))
795
+ .subscribe(() => (this.items = this.createBreadcrumbs(this.activatedRoute.root)));
796
+ }
797
+ initRouteChangeListen() {
798
+ this.breadcrumbService.routeChange
799
+ .pipe(filter((x) => x.label !== 'Undefined'), takeUntil(this.destroyed$))
800
+ .subscribe((x) => {
801
+ this.items = [
802
+ ...this.items,
803
+ {
804
+ label: x.label,
805
+ routerLink: x.routerLink,
806
+ url: x.url,
807
+ class: 'breadcrumb',
808
+ },
809
+ ];
810
+ this.cdr.detectChanges();
811
+ });
812
+ }
813
+ createBreadcrumbs(route, routerLink = '', breadcrumbs = []) {
814
+ const children = route.children;
815
+ if (children.length === 0) {
816
+ return breadcrumbs;
817
+ }
818
+ for (const child of children) {
819
+ const routeURL = child.snapshot.url
820
+ .map((segment) => segment.path)
821
+ .join('/');
822
+ if (!child.snapshot.data[BreadcrumbCoreComponent.BREADCRUMB_HIDE]) {
823
+ if (BreadcrumbCoreComponent.ROUTE_DATA_BREADCRUMB_URL !== undefined) {
824
+ const route = child.snapshot.data[BreadcrumbCoreComponent.ROUTE_DATA_BREADCRUMB_URL];
825
+ routerLink += `/${route}`;
826
+ }
827
+ if (!BreadcrumbCoreComponent.ROUTE_DATA_BREADCRUMB_URL && routeURL !== '') {
828
+ routerLink += `/${routeURL}`;
829
+ }
830
+ const label = child.snapshot.data[BreadcrumbCoreComponent.ROUTE_DATA_BREADCRUMB];
831
+ if (label &&
832
+ BreadcrumbCoreComponent.ROUTE_DATA_NO_BREADCRUMB_ROUTE &&
833
+ child.snapshot.data[BreadcrumbCoreComponent.ROUTE_DATA_NO_BREADCRUMB_ROUTE]) {
834
+ breadcrumbs.push({ label, routerLink: undefined });
835
+ }
836
+ else if (label && child.snapshot.routeConfig?.path !== '') {
837
+ breadcrumbs.push({ label, routerLink: routerLink });
838
+ }
839
+ }
840
+ return this.createBreadcrumbs(child, routerLink, breadcrumbs);
841
+ }
842
+ }
843
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BreadcrumbCoreComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
844
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: BreadcrumbCoreComponent, isStandalone: true, inputs: { items: "items", homeRoute: "homeRoute", useHomeRoute: "useHomeRoute" }, usesInheritance: true, ngImport: i0 });
845
+ }
846
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: BreadcrumbCoreComponent, decorators: [{
847
+ type: Directive,
848
+ args: [{}]
849
+ }], propDecorators: { items: [{
850
+ type: Input
851
+ }], homeRoute: [{
852
+ type: Input
853
+ }], useHomeRoute: [{
854
+ type: Input
855
+ }] } });
856
+
857
+ const BUTTON_COMPONENT_TOKEN = new InjectionToken('ButtonComponentToken');
858
+
859
+ const DROPDOWN_BUTTON_COMPONENT_TOKEN = new InjectionToken('DropdownButtonComponentToken');
860
+
861
+ const CALENDAR_COMPONENT_TOKEN = new InjectionToken('CalendarComponentToken');
862
+
863
+ const CHECKBOX_COMPONENT_TOKEN = new InjectionToken('CheckboxComponentToken');
864
+
865
+ const CONFIRM_DIALOG_COMPONENT_TOKEN = new InjectionToken('ConfirmDialogComponentToken');
866
+
867
+ const DROPDOWN_COMPONENT_TOKEN = new InjectionToken('DropdownComponentToken');
868
+
869
+ const FILTER_COMPONENT_TOKEN = new InjectionToken('FilterComponentToken');
870
+
871
+ const FORM_FIELD_COMPONENT_TOKEN = new InjectionToken('FormFieldComponentToken');
872
+
873
+ const GENERIC_FIELD_COMPONENT_TOKEN = new InjectionToken('GenericFieldComponentToken');
874
+
875
+ var GenericFieldType;
876
+ (function (GenericFieldType) {
877
+ GenericFieldType["dropdown"] = "dropdown";
878
+ GenericFieldType["checkbox"] = "checkbox";
879
+ GenericFieldType["simplecheckbox"] = "simplecheckbox";
880
+ GenericFieldType["calendar"] = "calendar";
881
+ GenericFieldType["multiselect"] = "multiselect";
882
+ GenericFieldType["text"] = "text";
883
+ })(GenericFieldType || (GenericFieldType = {}));
884
+
885
+ const HEADER_COMPONENT_TOKEN = new InjectionToken('HeaderComponentToken');
886
+ const SETTINGS_MENU = new InjectionToken('SETTINGS_MENU');
887
+
888
+ const INPUT_GROUP_COMPONENT_TOKEN = new InjectionToken('HeaderComponentToken');
889
+
890
+ const LOADER_COMPONENT_TOKEN = new InjectionToken('LoaderComponentToken');
891
+
892
+ const MULTISELECT_COMPONENT_TOKEN = new InjectionToken('MultiselectComponentToken');
893
+
894
+ const NUMBER_INPUT_COMPONENT_TOKEN = new InjectionToken('NumberInputComponentToken');
895
+
896
+ const PAGE_HEADER_COMPONENT_TOKEN = new InjectionToken('PageHeaderComponentToken');
897
+
898
+ class PageHeaderService {
899
+ pageHeader = new EventEmitter();
900
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PageHeaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
901
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PageHeaderService, providedIn: 'root' });
902
+ }
903
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PageHeaderService, decorators: [{
904
+ type: Injectable,
905
+ args: [{
906
+ providedIn: 'root',
907
+ }]
908
+ }], propDecorators: { pageHeader: [{
909
+ type: Output
910
+ }] } });
911
+
912
+ class PageHeaderCoreComponent extends UnsubscribeComponent {
913
+ router;
914
+ cdr;
915
+ headerService;
916
+ title;
917
+ subtitle;
918
+ showBackButton;
919
+ size = FieldSize.small;
920
+ constructor(router, cdr, headerService) {
921
+ super();
922
+ this.router = router;
923
+ this.cdr = cdr;
924
+ this.headerService = headerService;
925
+ }
926
+ ngOnInit() {
927
+ this.headerService.pageHeader
928
+ .pipe(takeUntil(this.destroyed$))
929
+ .subscribe((x) => {
930
+ this.title = x.title;
931
+ this.subtitle = x.subtitle;
932
+ this.showBackButton = x.showBackButton ?? false;
933
+ this.cdr.detectChanges();
934
+ });
935
+ }
936
+ locationBack() {
937
+ history.back();
938
+ }
939
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PageHeaderCoreComponent, deps: [{ token: i1$1.Router }, { token: i0.ChangeDetectorRef }, { token: PageHeaderService }], target: i0.ɵɵFactoryTarget.Directive });
940
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: PageHeaderCoreComponent, isStandalone: true, inputs: { title: "title", subtitle: "subtitle", showBackButton: "showBackButton", size: "size" }, usesInheritance: true, ngImport: i0 });
941
+ }
942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: PageHeaderCoreComponent, decorators: [{
943
+ type: Directive,
944
+ args: [{}]
945
+ }], ctorParameters: () => [{ type: i1$1.Router }, { type: i0.ChangeDetectorRef }, { type: PageHeaderService }], propDecorators: { title: [{
946
+ type: Input
947
+ }], subtitle: [{
948
+ type: Input
949
+ }], showBackButton: [{
950
+ type: Input
951
+ }], size: [{
952
+ type: Input
953
+ }] } });
954
+
955
+ const PASSWORD_COMPONENT_TOKEN = new InjectionToken('PasswordComponentToken');
956
+ var PasswordStrength;
957
+ (function (PasswordStrength) {
958
+ PasswordStrength[PasswordStrength["None"] = 0] = "None";
959
+ PasswordStrength[PasswordStrength["Low"] = 1] = "Low";
960
+ PasswordStrength[PasswordStrength["Medium"] = 2] = "Medium";
961
+ PasswordStrength[PasswordStrength["High"] = 3] = "High";
962
+ PasswordStrength[PasswordStrength["Superb"] = 4] = "Superb";
963
+ })(PasswordStrength || (PasswordStrength = {}));
964
+
965
+ const RADIOBUTTON_COMPONENT_TOKEN = new InjectionToken('RadiobuttonComponentToken');
966
+
967
+ const SECTION_COMPONENT_TOKEN = new InjectionToken('SectionComponentToken');
968
+
969
+ const MENU_TOKEN = new InjectionToken('MENU');
970
+ const LOGO_ROUTER_ROUTE = new InjectionToken('LOGO_ROUTER_ROUTE');
971
+ const SIDE_MENU_COMPONENT_TOKEN = new InjectionToken('SideMenuComponentToken');
972
+ const SIDE_MENU_STATE_TOKEN = new InjectionToken('SideMenuStateToken');
973
+
974
+ class SideMenuService {
975
+ _menuItems = new BehaviorSubject([]);
976
+ stateToken = inject(SIDE_MENU_STATE_TOKEN);
977
+ menuItems$ = this._menuItems.asObservable();
978
+ menuMinimalized = false;
979
+ setMenu(items) {
980
+ this.resetSidemenuState(items);
981
+ this._menuItems.next(items);
982
+ }
983
+ saveMinimalizedState(minimalized) {
984
+ this.stateToken.minimalized = minimalized;
985
+ localStorage.setItem('SideMenuStateToken', JSON.stringify(this.stateToken));
986
+ }
987
+ saveExpandedState(item) {
988
+ const expanded = this.stateToken.expanded?.find((i) => i === item.label);
989
+ if (!expanded) {
990
+ this.stateToken.expanded?.push(item.label);
991
+ localStorage.setItem('SideMenuStateToken', JSON.stringify(this.stateToken));
992
+ return;
993
+ }
994
+ this.stateToken.expanded = this.stateToken.expanded?.filter((i) => i !== item.label);
995
+ localStorage.setItem('SideMenuStateToken', JSON.stringify(this.stateToken));
996
+ }
997
+ resetSidemenuState(items) {
998
+ if (typeof this.stateToken === 'string') {
999
+ this.stateToken = JSON.parse(this.stateToken);
1000
+ }
1001
+ this.menuMinimalized = this.stateToken.minimalized;
1002
+ const localStorageValue = this.stateToken.expanded;
1003
+ if (!localStorageValue)
1004
+ return;
1005
+ if (items) {
1006
+ for (let index = 0; index < items.length; index++) {
1007
+ const element = items[index];
1008
+ element.expanded = !!localStorageValue.find((i) => i === element.label);
1009
+ }
1010
+ }
1011
+ }
1012
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SideMenuService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1013
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SideMenuService, providedIn: 'root' });
1014
+ }
1015
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SideMenuService, decorators: [{
1016
+ type: Injectable,
1017
+ args: [{ providedIn: 'root' }]
1018
+ }] });
1019
+
1020
+ class SideMenuProviderService {
1021
+ menu;
1022
+ menuService;
1023
+ constructor(menu = [], menuService) {
1024
+ this.menu = menu;
1025
+ this.menuService = menuService;
1026
+ menuService.setMenu(menu);
1027
+ }
1028
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SideMenuProviderService, deps: [{ token: MENU_TOKEN, optional: true }, { token: SideMenuService }], target: i0.ɵɵFactoryTarget.Injectable });
1029
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SideMenuProviderService });
1030
+ }
1031
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: SideMenuProviderService, decorators: [{
1032
+ type: Injectable
1033
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
1034
+ type: Optional
1035
+ }, {
1036
+ type: Inject,
1037
+ args: [MENU_TOKEN]
1038
+ }] }, { type: SideMenuService }] });
1039
+
1040
+ class MenuServiceDirective extends UnsubscribeComponent {
1041
+ menuService = inject(SideMenuService);
1042
+ cdr = inject(ChangeDetectorRef);
1043
+ sideMenu = inject(SIDE_MENU_COMPONENT_TOKEN);
1044
+ ngAfterViewInit() {
1045
+ this.menuService.menuItems$.pipe(takeUntil(this.destroyed$)).subscribe((items) => {
1046
+ if (this.sideMenu) {
1047
+ this.sideMenu.items = items;
1048
+ }
1049
+ });
1050
+ this.cdr.detectChanges();
1051
+ }
1052
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: MenuServiceDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1053
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: MenuServiceDirective, isStandalone: true, selector: "v-side-menu[useMenuService]", exportAs: ["useMenuService"], usesInheritance: true, ngImport: i0 });
1054
+ }
1055
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: MenuServiceDirective, decorators: [{
1056
+ type: Directive,
1057
+ args: [{
1058
+ // eslint-disable-next-line @angular-eslint/directive-selector
1059
+ selector: 'v-side-menu[useMenuService]',
1060
+ exportAs: 'useMenuService',
1061
+ standalone: true,
1062
+ }]
1063
+ }] });
1064
+
1065
+ const SLIDER_COMPONENT_TOKEN = new InjectionToken('SliderComponentToken');
1066
+
1067
+ const SNACKBAR_COMPONENT_TOKEN = new InjectionToken('SnackbarComponentToken');
1068
+
1069
+ const STEPPER_COMPONENT_TOKEN = new InjectionToken('StepperComponentToken');
1070
+
1071
+ const SWITCH_COMPONENT_TOKEN = new InjectionToken('SwitchComponentToken');
1072
+
1073
+ const TAB_VIEW_COMPONENT_TOKEN = new InjectionToken('TabVIewComponentToken');
1074
+
1075
+ const TABLE_COMPONENT_TOKEN = new InjectionToken('TabVIewComponentToken');
1076
+ const TABLE_COLUMN_PROVIDER = new InjectionToken('TABLE_COLUMN_PROVIDER');
1077
+ var TableSelectionMode;
1078
+ (function (TableSelectionMode) {
1079
+ TableSelectionMode["single"] = "single";
1080
+ TableSelectionMode["multiple"] = "multiple";
1081
+ })(TableSelectionMode || (TableSelectionMode = {}));
1082
+ var TableButtonSeverity;
1083
+ (function (TableButtonSeverity) {
1084
+ TableButtonSeverity["success"] = "success";
1085
+ TableButtonSeverity["info"] = "info";
1086
+ TableButtonSeverity["warning"] = "warning";
1087
+ TableButtonSeverity["danger"] = "danger";
1088
+ TableButtonSeverity["help"] = "help";
1089
+ TableButtonSeverity["primary"] = "primary";
1090
+ TableButtonSeverity["secondary"] = "secondary";
1091
+ TableButtonSeverity["contrast"] = "contrast";
1092
+ })(TableButtonSeverity || (TableButtonSeverity = {}));
1093
+ var ColumnVisibility;
1094
+ (function (ColumnVisibility) {
1095
+ ColumnVisibility["visible"] = "visible";
1096
+ ColumnVisibility["hidden"] = "hidden";
1097
+ ColumnVisibility["default"] = "default";
1098
+ })(ColumnVisibility || (ColumnVisibility = {}));
1099
+ function LinkRenderer(text, href) {
1100
+ return (row, index) => {
1101
+ return '<a href="' + href + '">' + text + '</a>';
1102
+ };
1103
+ }
1104
+ function routerRenderer(link, text) {
1105
+ return (row, index) => {
1106
+ return { text: text, link: link };
1107
+ };
1108
+ }
1109
+ function Renderer(fnc) {
1110
+ return (row) => {
1111
+ return fnc(row);
1112
+ };
1113
+ }
1114
+ class ColumnModel {
1115
+ configuration;
1116
+ sortDirection = undefined;
1117
+ columnClass;
1118
+ queryParams;
1119
+ routerLink;
1120
+ valueGetter;
1121
+ headerGetter;
1122
+ template;
1123
+ actions;
1124
+ sortable;
1125
+ id;
1126
+ // eslint-disable-next-line @typescript-eslint/ban-types
1127
+ format;
1128
+ textAlign;
1129
+ width;
1130
+ forceVisibility = ColumnVisibility.default;
1131
+ visible = true;
1132
+ constructor(configuration) {
1133
+ this.configuration = configuration;
1134
+ this.id = this.configuration.id;
1135
+ if (this.configuration.format) {
1136
+ this.format = this.configuration.format;
1137
+ }
1138
+ if (this.configuration.value) {
1139
+ this.valueGetter = (row, index) => {
1140
+ const value = this.configuration.value?.(row, index) ?? '-';
1141
+ return this.format ? this.format(value, row) : value;
1142
+ };
1143
+ }
1144
+ else {
1145
+ this.valueGetter = (row) => {
1146
+ const value = (row?.[this.configuration.id]) ?? '';
1147
+ return this.format ? this.format(value, row) : value;
1148
+ };
1149
+ }
1150
+ if (this.configuration.actions) {
1151
+ this.actions = this.configuration.actions;
1152
+ }
1153
+ if (this.configuration.routerLink) {
1154
+ this.routerLink = this.configuration.routerLink;
1155
+ }
1156
+ if (this.configuration.columnClass) {
1157
+ this.columnClass = this.configuration.columnClass;
1158
+ }
1159
+ if (this.configuration.template) {
1160
+ this.template = this.configuration.template;
1161
+ }
1162
+ if (this.configuration.headerName) {
1163
+ this.headerGetter = (typeof this.configuration.headerName === 'string'
1164
+ ? () => this.configuration.headerName ?? ''
1165
+ : (columnId, index) => (this.configuration.headerName)?.(columnId, index) ?? this.id);
1166
+ }
1167
+ else {
1168
+ this.headerGetter = () => "";
1169
+ }
1170
+ if (this.configuration.queryParams) {
1171
+ this.queryParams = this.configuration.queryParams;
1172
+ }
1173
+ if (this.routerLink) {
1174
+ this.columnClass += ' ' + 'link';
1175
+ }
1176
+ if (this.configuration.sortable !== undefined) {
1177
+ this.sortable = this.configuration.sortable;
1178
+ }
1179
+ else {
1180
+ this.sortable = true;
1181
+ }
1182
+ if (this.configuration.width) {
1183
+ this.width = typeof this.configuration.width === "number" ? this.configuration.width + 'px' : this.configuration.width;
1184
+ }
1185
+ if (this.configuration.textAlign !== undefined) {
1186
+ this.textAlign = this.configuration.textAlign;
1187
+ }
1188
+ if (this.configuration.forceVisibility) {
1189
+ this.forceVisibility = this.configuration.forceVisibility;
1190
+ }
1191
+ if (this.configuration.visible !== undefined) {
1192
+ this.visible = this.configuration.visible;
1193
+ }
1194
+ }
1195
+ }
1196
+ class RowModel {
1197
+ row;
1198
+ index;
1199
+ id;
1200
+ selected;
1201
+ marked;
1202
+ focused;
1203
+ expanded;
1204
+ fnc;
1205
+ customRoute;
1206
+ constructor(row, selected, expanded, marked, index, fnc, customRoute, entityKey) {
1207
+ this.row = row;
1208
+ this.id = row['id'] ?? v4();
1209
+ this.index = index;
1210
+ this.selected = selected;
1211
+ this.expanded = expanded;
1212
+ this.marked = marked;
1213
+ this.fnc = fnc;
1214
+ this.customRoute = createCustomRoute(row, entityKey, customRoute);
1215
+ }
1216
+ }
1217
+ function createCustomRoute(row, entityKey, customRoute) {
1218
+ return customRoute && entityKey
1219
+ ? `${customRoute}/` + row[entityKey]
1220
+ : undefined;
1221
+ }
1222
+
1223
+ class TableColumnDirective {
1224
+ template;
1225
+ index = 0;
1226
+ id;
1227
+ columnClass;
1228
+ sortable;
1229
+ routerLink;
1230
+ queryParams;
1231
+ headerName;
1232
+ width;
1233
+ textAlign = FieldAlign.left;
1234
+ format;
1235
+ forceVisibility = ColumnVisibility.default;
1236
+ visible = true;
1237
+ getDefinition() {
1238
+ return {
1239
+ id: this.id,
1240
+ columnClass: this.columnClass,
1241
+ template: this.template,
1242
+ headerName: this.headerName,
1243
+ routerLink: this.routerLink,
1244
+ queryParams: this.queryParams,
1245
+ sortable: this.sortable,
1246
+ width: this.width,
1247
+ format: this.format,
1248
+ textAlign: this.textAlign,
1249
+ forceVisibility: this.forceVisibility,
1250
+ visible: this.visible,
1251
+ };
1252
+ }
1253
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableColumnDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1254
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: TableColumnDirective, isStandalone: true, selector: "v-table-column", inputs: { index: "index", id: "id", columnClass: "columnClass", sortable: "sortable", routerLink: "routerLink", queryParams: "queryParams", headerName: "headerName", width: "width", textAlign: "textAlign", format: "format", forceVisibility: "forceVisibility", visible: "visible" }, providers: [
1255
+ {
1256
+ provide: TABLE_COLUMN_PROVIDER,
1257
+ useExisting: TableColumnDirective,
1258
+ multi: true,
1259
+ },
1260
+ ], queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
1261
+ }
1262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableColumnDirective, decorators: [{
1263
+ type: Directive,
1264
+ args: [{
1265
+ // eslint-disable-next-line @angular-eslint/directive-selector
1266
+ selector: 'v-table-column',
1267
+ standalone: true,
1268
+ providers: [
1269
+ {
1270
+ provide: TABLE_COLUMN_PROVIDER,
1271
+ useExisting: TableColumnDirective,
1272
+ multi: true,
1273
+ },
1274
+ ],
1275
+ }]
1276
+ }], propDecorators: { template: [{
1277
+ type: ContentChild,
1278
+ args: [TemplateRef]
1279
+ }], index: [{
1280
+ type: Input
1281
+ }], id: [{
1282
+ type: Input
1283
+ }], columnClass: [{
1284
+ type: Input
1285
+ }], sortable: [{
1286
+ type: Input
1287
+ }], routerLink: [{
1288
+ type: Input
1289
+ }], queryParams: [{
1290
+ type: Input
1291
+ }], headerName: [{
1292
+ type: Input
1293
+ }], width: [{
1294
+ type: Input
1295
+ }], textAlign: [{
1296
+ type: Input
1297
+ }], format: [{
1298
+ type: Input
1299
+ }], forceVisibility: [{
1300
+ type: Input
1301
+ }], visible: [{
1302
+ type: Input
1303
+ }] } });
1304
+
1305
+ class ColumnConfiguration {
1306
+ id;
1307
+ column = {};
1308
+ constructor(id) {
1309
+ this.id = id;
1310
+ this.column.id = id;
1311
+ }
1312
+ headerName(headerName) {
1313
+ this.column.headerName = headerName;
1314
+ return this;
1315
+ }
1316
+ sortable(sortable) {
1317
+ this.column.sortable = sortable;
1318
+ return this;
1319
+ }
1320
+ columnClass(columnClass) {
1321
+ this.column.columnClass = columnClass;
1322
+ return this;
1323
+ }
1324
+ valueFunction(value) {
1325
+ this.column.value = value;
1326
+ return this;
1327
+ }
1328
+ type(type) {
1329
+ this.column.type = type;
1330
+ return this;
1331
+ }
1332
+ build() {
1333
+ return this.column;
1334
+ }
1335
+ }
1336
+
1337
+ class TableBuilder {
1338
+ columns = [];
1339
+ addColumn(id, config) {
1340
+ const columnConfig = new ColumnConfiguration(id);
1341
+ config?.(columnConfig);
1342
+ this.columns.push(columnConfig.build());
1343
+ return this;
1344
+ }
1345
+ addTextColumn(id, config) {
1346
+ return this.addColumn(id, (x) => {
1347
+ config?.(x);
1348
+ x.type('text');
1349
+ });
1350
+ }
1351
+ addNumberColumn(id, config) {
1352
+ return this.addColumn(id, (x) => {
1353
+ config?.(x);
1354
+ x.type('number').columnClass('text-end');
1355
+ });
1356
+ }
1357
+ addDateColumn(id, config) {
1358
+ return this.addColumn(id, (x) => {
1359
+ config?.(x);
1360
+ x.type('date').valueFunction((row) => covertFromDateToUserLocale(row, id));
1361
+ });
1362
+ }
1363
+ addBooleanColumn(id, config) {
1364
+ return this.addColumn(id, (x) => {
1365
+ config?.(x);
1366
+ x.type('boolean');
1367
+ });
1368
+ }
1369
+ addEnumColumn(id, config) {
1370
+ return this.addColumn(id, (x) => {
1371
+ config?.(x);
1372
+ x.type('enum');
1373
+ });
1374
+ }
1375
+ build() {
1376
+ return this.columns;
1377
+ }
1378
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableBuilder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1379
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableBuilder, providedIn: 'root' });
1380
+ }
1381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableBuilder, decorators: [{
1382
+ type: Injectable,
1383
+ args: [{
1384
+ providedIn: 'root',
1385
+ }]
1386
+ }] });
1387
+ function covertFromDateToUserLocale(row, id) {
1388
+ const value = row[id];
1389
+ if (value === undefined) {
1390
+ return '';
1391
+ }
1392
+ const locale = navigator.language;
1393
+ if (value instanceof Date) {
1394
+ return value.toLocaleDateString(locale);
1395
+ }
1396
+ if (typeof value === 'string' && !isNaN(Date.parse(value))) {
1397
+ return new Date(value).toLocaleDateString(locale);
1398
+ }
1399
+ return value;
1400
+ }
1401
+
1402
+ const TABLE_FILTER_COMPONENT_TOKEN = new InjectionToken('TableFilterComponentToken');
1403
+
1404
+ const TEXTAREA_COMPONENT_TOKEN = new InjectionToken('TextareaComponentToken');
1405
+
1406
+ const TEXTFIELD_COMPONENT_TOKEN = new InjectionToken('TextfieldComponentToken');
1407
+
1408
+ const TOOLTIP_COMPONENT_TOKEN = new InjectionToken('TooltipComponentToken');
1409
+
1410
+ const ICONS_COMPONENT_TOKEN = new InjectionToken('IconsComponentToken');
1411
+
1412
+ class IconsComponent {
1413
+ library = input('native', ...(ngDevMode ? [{ debugName: "library" }] : []));
1414
+ name = input.required(...(ngDevMode ? [{ debugName: "name" }] : []));
1415
+ size = input(...(ngDevMode ? [undefined, { debugName: "size" }] : []));
1416
+ severity = input(...(ngDevMode ? [undefined, { debugName: "severity" }] : []));
1417
+ class = input(...(ngDevMode ? [undefined, { debugName: "class" }] : []));
1418
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: IconsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1419
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.2.1", type: IconsComponent, isStandalone: true, selector: "ng-component", inputs: { library: { classPropertyName: "library", publicName: "library", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
1420
+ {
1421
+ provide: ICONS_COMPONENT_TOKEN,
1422
+ useExisting: IconsComponent
1423
+ }
1424
+ ], ngImport: i0, template: '', isInline: true });
1425
+ }
1426
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: IconsComponent, decorators: [{
1427
+ type: Component,
1428
+ args: [{
1429
+ standalone: true,
1430
+ template: '',
1431
+ providers: [
1432
+ {
1433
+ provide: ICONS_COMPONENT_TOKEN,
1434
+ useExisting: IconsComponent
1435
+ }
1436
+ ]
1437
+ }]
1438
+ }] });
1439
+
1440
+ const TAG_COMPONENT_TOKEN = new InjectionToken('TagComponentToken');
1441
+
1442
+ class DatasourceDirective extends UnsubscribeComponent {
1443
+ datasource;
1444
+ autoBind = true;
1445
+ loadingText = '... loading ...';
1446
+ filterField = 'fulltext';
1447
+ transformFn;
1448
+ extraFilter;
1449
+ get activeComponent() {
1450
+ return (this.dropdownComponent ??
1451
+ this.multiSelectComponent ??
1452
+ this.genericField);
1453
+ }
1454
+ httpClient = inject(HttpClient);
1455
+ baseUrl = inject(BASE_URL_PATH);
1456
+ changeDetectorRef = inject(ChangeDetectorRef);
1457
+ isAllDataLoaded = false;
1458
+ parameters$ = new BehaviorSubject({});
1459
+ lastParameter = {};
1460
+ dropdownComponent = inject(DROPDOWN_COMPONENT_TOKEN, { optional: true });
1461
+ multiSelectComponent = inject(MULTISELECT_COMPONENT_TOKEN, {
1462
+ optional: true,
1463
+ });
1464
+ genericField = inject(GENERIC_FIELD_COMPONENT_TOKEN, { optional: true });
1465
+ dataSourceService;
1466
+ loadingPlaceholderItem = {};
1467
+ ngOnInit() {
1468
+ this.activeComponent.showed
1469
+ .pipe(takeUntil(this.destroyed$))
1470
+ .subscribe(() => {
1471
+ if (!this.autoBind &&
1472
+ !this.activeComponent.options &&
1473
+ !this.activeComponent.loading) {
1474
+ this.parameters$.next({});
1475
+ }
1476
+ });
1477
+ this.activeComponent.lazyLoad
1478
+ .pipe(takeUntil(this.destroyed$))
1479
+ .subscribe((value) => {
1480
+ this.parameters$.next({ offset: value?.offset, limit: value?.limit });
1481
+ });
1482
+ this.activeComponent.filtered
1483
+ .pipe(takeUntil(this.destroyed$))
1484
+ .subscribe((value) => {
1485
+ const property = this.filterField ?? this.activeComponent.optionLabel;
1486
+ if (property) {
1487
+ this.parameters$.next({
1488
+ offset: 0,
1489
+ filter: {
1490
+ [property]: value.filter ? value.filter : undefined,
1491
+ ...(this.extraFilter ?? {})
1492
+ },
1493
+ useNewData: true,
1494
+ });
1495
+ }
1496
+ });
1497
+ this.parameters$
1498
+ .pipe(takeUntil(this.destroyed$), filter(request => !this.isDataForRequestLoaded(request)), map((request) => {
1499
+ const extendedParams = normalizeRequest({ ...this.lastParameter, ...request }, DEFAULT_SEARCH_LIMIT);
1500
+ extendedParams.useNewData = request.useNewData ?? false;
1501
+ return extendedParams;
1502
+ }), tap((request) => {
1503
+ this.lastParameter = request;
1504
+ }), debounceTime(DEFAULT_DEBOUNCE_TIME), tap(() => {
1505
+ this.changeComponent(this.activeComponent, {
1506
+ loading: true,
1507
+ });
1508
+ }), switchMap((request) => this.dataSourceService
1509
+ ? this.dataSourceService(request).pipe(map((response) => ({ request, response })))
1510
+ : of({
1511
+ request,
1512
+ response: {
1513
+ data: [],
1514
+ total: 0,
1515
+ limit: request.limit,
1516
+ offset: request.offset,
1517
+ },
1518
+ })), catchError((request) => {
1519
+ this.changeComponent(this.activeComponent, {
1520
+ loading: false,
1521
+ });
1522
+ return of({
1523
+ request: request,
1524
+ response: {
1525
+ data: [],
1526
+ total: 0,
1527
+ limit: request.limit,
1528
+ offset: request.offset,
1529
+ },
1530
+ });
1531
+ }))
1532
+ .subscribe(({ request, response }) => this.setDataToControl(request, response));
1533
+ }
1534
+ ngOnChanges(changes) {
1535
+ if (changes['datasource']) {
1536
+ this.dataSourceService = convertDatasource(this.datasource, this.baseUrl, this.httpClient);
1537
+ if (this.autoBind) {
1538
+ this.parameters$.next({ offset: 0 });
1539
+ }
1540
+ }
1541
+ }
1542
+ isDataForRequestLoaded(request) {
1543
+ if (request.useNewData) {
1544
+ return false;
1545
+ }
1546
+ const offset = request.offset ?? 0;
1547
+ const limit = request.limit ?? DEFAULT_SEARCH_LIMIT;
1548
+ const options = this.activeComponent.options;
1549
+ if (!options) {
1550
+ return false;
1551
+ }
1552
+ if (options.length < offset + limit) {
1553
+ return false;
1554
+ }
1555
+ const allItemsFilled = options.slice(offset, offset + limit).every(item => item !== undefined && item != this.loadingPlaceholderItem);
1556
+ return allItemsFilled;
1557
+ }
1558
+ setDataToControl(request, result) {
1559
+ this.isAllDataLoaded = result.total <= result.data.length;
1560
+ const data = result.data;
1561
+ const total = result.total;
1562
+ const offset = request.offset;
1563
+ const transferedData = this.transformFn
1564
+ ? data.map((x) => this.transformFn?.(x))
1565
+ : data;
1566
+ if (this.activeComponent.optionLabel) {
1567
+ this.loadingPlaceholderItem[this.activeComponent.optionLabel] =
1568
+ this.loadingText;
1569
+ }
1570
+ if (this.activeComponent.optionValue) {
1571
+ this.loadingPlaceholderItem[this.activeComponent.optionValue] = -1;
1572
+ }
1573
+ const options = request.useNewData ? undefined : this.activeComponent.options;
1574
+ const newOptions = setDataToArray(options, transferedData, offset, total, this.loadingPlaceholderItem);
1575
+ this.changeComponent(this.activeComponent, {
1576
+ options: newOptions,
1577
+ loading: false,
1578
+ lazy: !this.isAllDataLoaded,
1579
+ });
1580
+ }
1581
+ changeComponent(component, value) {
1582
+ setComponentProperties(component, value);
1583
+ this.changeDetectorRef.detectChanges();
1584
+ }
1585
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DatasourceDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1586
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: DatasourceDirective, isStandalone: true, selector: "v-dropdown[useDatasource], v-multiselect[useDatasource], v-generic-field[useDatasource]", inputs: { datasource: "datasource", autoBind: "autoBind", loadingText: "loadingText", filterField: "filterField", transformFn: "transformFn", extraFilter: "extraFilter" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1587
+ }
1588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: DatasourceDirective, decorators: [{
1589
+ type: Directive,
1590
+ args: [{
1591
+ selector:
1592
+ // eslint-disable-next-line @angular-eslint/directive-selector
1593
+ 'v-dropdown[useDatasource], v-multiselect[useDatasource], v-generic-field[useDatasource]',
1594
+ standalone: true,
1595
+ }]
1596
+ }], propDecorators: { datasource: [{
1597
+ type: Input
1598
+ }], autoBind: [{
1599
+ type: Input
1600
+ }], loadingText: [{
1601
+ type: Input
1602
+ }], filterField: [{
1603
+ type: Input
1604
+ }], transformFn: [{
1605
+ type: Input
1606
+ }], extraFilter: [{
1607
+ type: Input
1608
+ }] } });
1609
+
1610
+ class TableDatasourceDirective extends UnsubscribeComponent {
1611
+ store = inject(Store);
1612
+ autoBind = true;
1613
+ tableName;
1614
+ debounceTime = DEFAULT_DEBOUNCE_TIME;
1615
+ datasource;
1616
+ extraFilter;
1617
+ transformFn;
1618
+ tableComponent = inject(TABLE_COMPONENT_TOKEN, {
1619
+ self: true,
1620
+ });
1621
+ changeDetectorRef = inject(ChangeDetectorRef);
1622
+ httpClient = inject(HttpClient);
1623
+ baseUrl = inject(BASE_URL_PATH);
1624
+ dataSourceService;
1625
+ parameters$ = new BehaviorSubject({});
1626
+ params$ = this.parameters$.asObservable();
1627
+ ngOnInit() {
1628
+ if (!this.tableName) {
1629
+ throw new Error('Property tableName must be defined.');
1630
+ }
1631
+ this.tableComponent.lazyLoad.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
1632
+ this.parameters$.next({
1633
+ offset: value?.offset,
1634
+ limit: value?.limit,
1635
+ filter: { ...value?.filter, ...this.extraFilter },
1636
+ sort: value?.sort,
1637
+ });
1638
+ });
1639
+ this.parameters$
1640
+ .pipe(takeUntil(this.destroyed$), map((request) => normalizeRequest({
1641
+ ...request,
1642
+ filter: { ...request.filter, ...this.extraFilter },
1643
+ })), debounceTime(this.debounceTime), tap(() => {
1644
+ this.changeComponent(this.tableComponent, {
1645
+ lazy: true,
1646
+ loading: true,
1647
+ });
1648
+ }), switchMap((request) => this.dataSourceService
1649
+ ? this.dataSourceService(request).pipe(map((response) => ({ request, response })))
1650
+ : of({
1651
+ request,
1652
+ response: {
1653
+ data: [],
1654
+ total: 0,
1655
+ limit: request.limit,
1656
+ offset: request.offset,
1657
+ },
1658
+ })), catchError((request) => {
1659
+ this.changeComponent(this.tableComponent, {
1660
+ loading: false,
1661
+ });
1662
+ return of({
1663
+ request: request,
1664
+ response: {
1665
+ data: [],
1666
+ total: 0,
1667
+ limit: request.limit,
1668
+ offset: request.offset,
1669
+ },
1670
+ });
1671
+ }))
1672
+ .subscribe(({ request, response }) => this.setDataToControl(request, response));
1673
+ }
1674
+ ngOnChanges(changes) {
1675
+ if (changes['datasource']) {
1676
+ this.dataSourceService = convertDatasource(this.datasource, this.baseUrl, this.httpClient);
1677
+ if (this.autoBind) {
1678
+ this.parameters$.next({ offset: 0 });
1679
+ }
1680
+ }
1681
+ }
1682
+ reload() {
1683
+ this.parameters$.next({ ...this.parameters$.value });
1684
+ }
1685
+ changeComponent(component, value) {
1686
+ setComponentProperties(component, value);
1687
+ this.changeDetectorRef.detectChanges();
1688
+ }
1689
+ setDataToControl(request, result) {
1690
+ const data = result.data;
1691
+ const total = result.total;
1692
+ const transferedData = this.transformFn ? data.map((x) => this.transformFn?.(x)) : data;
1693
+ this.changeComponent(this.tableComponent, {
1694
+ lazy: !isFilterEmpty(request.filter) || data?.length < total || this.datasource instanceof BaseHttpService,
1695
+ data: transferedData,
1696
+ loading: false,
1697
+ total,
1698
+ });
1699
+ }
1700
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableDatasourceDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1701
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: TableDatasourceDirective, isStandalone: true, selector: "v-table[useDatasource]", inputs: { autoBind: "autoBind", tableName: "tableName", debounceTime: "debounceTime", datasource: "datasource", extraFilter: "extraFilter", transformFn: "transformFn" }, exportAs: ["useDatasource"], usesInheritance: true, usesOnChanges: true, ngImport: i0 });
1702
+ }
1703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableDatasourceDirective, decorators: [{
1704
+ type: Directive,
1705
+ args: [{
1706
+ // eslint-disable-next-line @angular-eslint/directive-selector
1707
+ selector: 'v-table[useDatasource]',
1708
+ exportAs: 'useDatasource',
1709
+ standalone: true,
1710
+ }]
1711
+ }], propDecorators: { autoBind: [{
1712
+ type: Input
1713
+ }], tableName: [{
1714
+ type: Input,
1715
+ args: [{ required: true }]
1716
+ }], debounceTime: [{
1717
+ type: Input
1718
+ }], datasource: [{
1719
+ type: Input
1720
+ }], extraFilter: [{
1721
+ type: Input
1722
+ }], transformFn: [{
1723
+ type: Input
1724
+ }] } });
1725
+
1726
+ class ButtonShortCutDirective {
1727
+ shortCutFn;
1728
+ shortCutKey;
1729
+ keyMap = {};
1730
+ onKeyDown(event) {
1731
+ this.keyMap[event.key.toLowerCase()] = true;
1732
+ this.checkShortcut();
1733
+ }
1734
+ onKeyUp(event) {
1735
+ this.keyMap[event.key.toLowerCase()] = false;
1736
+ }
1737
+ checkShortcut() {
1738
+ if (this.shortCutKey && this.shortCutFn) {
1739
+ const keys = this.shortCutKey.toLowerCase().split('+');
1740
+ const isShortcutPressed = keys.every((key) => this.keyMap[key]);
1741
+ if (isShortcutPressed) {
1742
+ this.shortCutFn?.();
1743
+ keys.forEach((key) => (this.keyMap[key] = false));
1744
+ }
1745
+ }
1746
+ }
1747
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ButtonShortCutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1748
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: ButtonShortCutDirective, isStandalone: true, selector: "v-button[useShortCut]", inputs: { shortCutFn: "shortCutFn", shortCutKey: "shortCutKey" }, host: { listeners: { "document:keydown": "onKeyDown($event)", "document:keyup": "onKeyUp($event)" } }, exportAs: ["useShortCut"], ngImport: i0 });
1749
+ }
1750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ButtonShortCutDirective, decorators: [{
1751
+ type: Directive,
1752
+ args: [{
1753
+ // eslint-disable-next-line @angular-eslint/directive-selector
1754
+ selector: 'v-button[useShortCut]',
1755
+ exportAs: 'useShortCut',
1756
+ standalone: true,
1757
+ }]
1758
+ }], propDecorators: { shortCutFn: [{
1759
+ type: Input
1760
+ }], shortCutKey: [{
1761
+ type: Input
1762
+ }], onKeyDown: [{
1763
+ type: HostListener,
1764
+ args: ['document:keydown', ['$event']]
1765
+ }], onKeyUp: [{
1766
+ type: HostListener,
1767
+ args: ['document:keyup', ['$event']]
1768
+ }] } });
1769
+
1770
+ class TableFilterDirective {
1771
+ filterComponent;
1772
+ filterChange$ = new Subject();
1773
+ subscription = undefined;
1774
+ tableComponent = inject(TABLE_COMPONENT_TOKEN);
1775
+ changeDetectorRef = inject(ChangeDetectorRef);
1776
+ ngOnChanges(changes) {
1777
+ if (changes['filterComponent']) {
1778
+ this.unRegister();
1779
+ this.register();
1780
+ }
1781
+ }
1782
+ onFilterChange(value) {
1783
+ if (this.tableComponent?.filter !== value) {
1784
+ setComponentProperties(this.tableComponent, {
1785
+ filter: value,
1786
+ currentPage: 1,
1787
+ });
1788
+ this.changeDetectorRef.detectChanges();
1789
+ }
1790
+ }
1791
+ ngOnDestroy() {
1792
+ this.unRegister();
1793
+ }
1794
+ unRegister() {
1795
+ this.subscription?.unsubscribe();
1796
+ }
1797
+ register() {
1798
+ this.filterComponent.registerOnChange((value) => {
1799
+ this.filterChange$.next(value);
1800
+ });
1801
+ this.subscription = this.filterChange$
1802
+ .pipe(debounceTime(this.filterComponent.debounceTime ? 0 : DEFAULT_DEBOUNCE_TIME))
1803
+ .subscribe((value) => this.onFilterChange(value));
1804
+ }
1805
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableFilterDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1806
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.1", type: TableFilterDirective, isStandalone: true, selector: "v-table[useFilter]", inputs: { filterComponent: "filterComponent" }, exportAs: ["tableFilterDirective"], usesOnChanges: true, ngImport: i0 });
1807
+ }
1808
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: TableFilterDirective, decorators: [{
1809
+ type: Directive,
1810
+ args: [{
1811
+ // eslint-disable-next-line @angular-eslint/directive-selector
1812
+ selector: 'v-table[useFilter]',
1813
+ standalone: true,
1814
+ exportAs: 'tableFilterDirective',
1815
+ }]
1816
+ }], propDecorators: { filterComponent: [{
1817
+ type: Input,
1818
+ args: [{ required: true }]
1819
+ }] } });
1820
+
1821
+ const ErrorCodesFns = {
1822
+ required: () => `This field is required!`,
1823
+ email: () => `Email is in wrong format!`,
1824
+ iban: () => `IBAN is in wrong format!`,
1825
+ lowStrength: () => `Password too weak!`,
1826
+ customPasswordRequirements: () => `Password does not meet minimal requirements.`,
1827
+ fieldsNotMatching: () => `Passwords are not the same!`,
1828
+ validationError: (value) => `${value}`,
1829
+ };
1830
+
1831
+ function getFirstErrorFromControl(control) {
1832
+ if (!control || !control.errors) {
1833
+ return null;
1834
+ }
1835
+ const errors = control.errors ?? false;
1836
+ if (errors) {
1837
+ const key = Object.keys(control.errors)[0];
1838
+ const value = control.errors[key];
1839
+ return { key, value };
1840
+ }
1841
+ return null;
1842
+ }
1843
+ function getFirstError(errors) {
1844
+ if (errors) {
1845
+ const key = Object.keys(errors)[0];
1846
+ const value = errors[key];
1847
+ return { key, value };
1848
+ }
1849
+ return null;
1850
+ }
1851
+
1852
+ const EMPTY$1 = '';
1853
+ class ErrorPipe {
1854
+ transform(errors) {
1855
+ if (!errors) {
1856
+ return EMPTY$1;
1857
+ }
1858
+ const error = getFirstError(errors);
1859
+ if (error) {
1860
+ const errorFn = ErrorCodesFns[error.key];
1861
+ if (!errorFn) {
1862
+ return EMPTY$1;
1863
+ }
1864
+ return ErrorCodesFns[error.key](error.value);
1865
+ }
1866
+ return EMPTY$1;
1867
+ }
1868
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ErrorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1869
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: ErrorPipe, isStandalone: true, name: "error" });
1870
+ }
1871
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ErrorPipe, decorators: [{
1872
+ type: Pipe,
1873
+ args: [{
1874
+ name: 'error',
1875
+ standalone: true,
1876
+ }]
1877
+ }] });
1878
+
1879
+ const WarningCodesFns = {
1880
+ validationWarning: (value) => `${value}`,
1881
+ };
1882
+
1883
+ const EMPTY = '';
1884
+ class WarningPipe {
1885
+ transform(warnings) {
1886
+ if (!warnings) {
1887
+ return EMPTY;
1888
+ }
1889
+ const error = getFirstError(warnings);
1890
+ if (error) {
1891
+ const errorFn = WarningCodesFns[error.key];
1892
+ if (!errorFn) {
1893
+ return EMPTY;
1894
+ }
1895
+ return WarningCodesFns[error.key](error.value);
1896
+ }
1897
+ return EMPTY;
1898
+ }
1899
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: WarningPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1900
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: WarningPipe, isStandalone: true, name: "warning" });
1901
+ }
1902
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: WarningPipe, decorators: [{
1903
+ type: Pipe,
1904
+ args: [{
1905
+ name: 'warning',
1906
+ standalone: true,
1907
+ }]
1908
+ }] });
1909
+
1910
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1911
+ class KeyOrFunctionPipe {
1912
+ transform(keyOrFn, row) {
1913
+ if (keyOrFn instanceof Function) {
1914
+ return keyOrFn(row);
1915
+ }
1916
+ else if (typeof keyOrFn === 'string') {
1917
+ const value = row[keyOrFn];
1918
+ if (value) {
1919
+ return value;
1920
+ }
1921
+ }
1922
+ else if (typeof keyOrFn === 'boolean') {
1923
+ return keyOrFn;
1924
+ }
1925
+ return '';
1926
+ }
1927
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: KeyOrFunctionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1928
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: KeyOrFunctionPipe, isStandalone: true, name: "keyOrFn", pure: false });
1929
+ }
1930
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: KeyOrFunctionPipe, decorators: [{
1931
+ type: Pipe,
1932
+ args: [{
1933
+ name: 'keyOrFn',
1934
+ pure: false,
1935
+ standalone: true,
1936
+ }]
1937
+ }] });
1938
+
1939
+ class EnumToListPipe {
1940
+ transform(data) {
1941
+ return Object.keys(data)
1942
+ .filter(key => isNaN(Number(key)))
1943
+ .map(key => ({
1944
+ label: key,
1945
+ value: data[key],
1946
+ }));
1947
+ }
1948
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: EnumToListPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1949
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.2.1", ngImport: i0, type: EnumToListPipe, isStandalone: true, name: "enumToList" });
1950
+ }
1951
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: EnumToListPipe, decorators: [{
1952
+ type: Pipe,
1953
+ args: [{
1954
+ name: 'enumToList',
1955
+ standalone: true,
1956
+ }]
1957
+ }] });
1958
+
1959
+ /* eslint-disable @typescript-eslint/ban-types */
1960
+ class Format {
1961
+ static concatArray(value, itemFormatter, delimeter = ';') {
1962
+ if (!value) {
1963
+ return '';
1964
+ }
1965
+ return value
1966
+ .map(item => itemFormatter ? itemFormatter(item) : item)
1967
+ .filter(item => item !== undefined && item !== null)
1968
+ .join(`${delimeter} `);
1969
+ }
1970
+ static czechDate(value) {
1971
+ return toCzechDateTimeString(value);
1972
+ }
1973
+ static date(value) {
1974
+ if (!value) {
1975
+ return '';
1976
+ }
1977
+ if (typeof value === 'string') {
1978
+ value = new Date(value);
1979
+ }
1980
+ return value.getDate() + '. ' + (value.getMonth() + 1) + '. ' + value.getFullYear();
1981
+ }
1982
+ static dateAndTime(value) {
1983
+ if (!value) {
1984
+ return '';
1985
+ }
1986
+ if (typeof value === 'string') {
1987
+ value = new Date(value);
1988
+ }
1989
+ return ('0' + value.getDate()).slice(-2)
1990
+ + '.' + ('0' + (value.getMonth() + 1)).slice(-2)
1991
+ + '.' + value.getFullYear() + ' ' + ('0' + value.getHours()).slice(-2)
1992
+ + ':' + ('0' + value.getMinutes()).slice(-2) + ':' + ('0' + value.getSeconds()).slice(-2);
1993
+ }
1994
+ static convertToUserLocaleDate(value) {
1995
+ if (!value) {
1996
+ return '';
1997
+ }
1998
+ if (typeof value === 'string') {
1999
+ value = new Date(value);
2000
+ }
2001
+ return value.toLocaleDateString(navigator.language, { timeZone: 'UTC' });
2002
+ }
2003
+ static bool(value) {
2004
+ if (value) {
2005
+ return 'Yes';
2006
+ }
2007
+ else {
2008
+ return 'No';
2009
+ }
2010
+ }
2011
+ static boolWithIcon(value) {
2012
+ if (value) {
2013
+ return `<span>✓</span>`;
2014
+ }
2015
+ else {
2016
+ return `<span>⨯</span>`;
2017
+ }
2018
+ }
2019
+ }
2020
+
2021
+ /**
2022
+ * Generated bundle index. Do not edit.
2023
+ */
2024
+
2025
+ export { ACTION_BUTTON_GROUP_COMPONENT_TOKEN, BREADCRUMB_COMPONENT_TOKEN, BUTTON_COMPONENT_TOKEN, BaseFormDirective, BaseFormInputComponent, BaseInputControls, BreadcrumbCoreComponent, BreadcrumbService, ButtonShortCutDirective, CALENDAR_COMPONENT_TOKEN, CHECKBOX_COMPONENT_TOKEN, CONFIRM_DIALOG_COMPONENT_TOKEN, ColumnConfiguration, ColumnModel, ColumnVisibility, ControlSeverity, DEFAULT_DEBOUNCE_TIME, DEFAULT_PAGINATION, DROPDOWN_BUTTON_COMPONENT_TOKEN, DROPDOWN_COMPONENT_TOKEN, DatasourceDirective, DetailStoreDirective, DialogService, EnumToListPipe, ErrorCodesFns, ErrorPipe, FILTER_COMPONENT_TOKEN, FORM_FIELD_COMPONENT_TOKEN, FieldAlign, FieldSize, FieldType, Format, GENERIC_FIELD_COMPONENT_TOKEN, GenericFieldType, GovButtonType, GovControlSeverity, HEADER_COMPONENT_TOKEN, ICONS_COMPONENT_TOKEN, INPUT_GROUP_COMPONENT_TOKEN, IconPosition, IconsComponent, KeyOrFunctionPipe, LOADER_COMPONENT_TOKEN, LOGO_ROUTER_ROUTE, LayoutType, LinkRenderer, MAX_COLUMN_CHAR_COUNT, MENU_TOKEN, MULTISELECT_COMPONENT_TOKEN, MenuServiceDirective, NUMBER_INPUT_COMPONENT_TOKEN, PAGE_HEADER_COMPONENT_TOKEN, PASSWORD_COMPONENT_TOKEN, PageHeaderCoreComponent, PageHeaderService, PasswordStrength, Position, PreventUnsavedChangesDirective, RADIOBUTTON_COMPONENT_TOKEN, Renderer, RowModel, SECTION_COMPONENT_TOKEN, SETTINGS_MENU, SIDE_MENU_COMPONENT_TOKEN, SIDE_MENU_STATE_TOKEN, SLIDER_COMPONENT_TOKEN, SNACKBAR_COMPONENT_TOKEN, STEPPER_COMPONENT_TOKEN, SWITCH_COMPONENT_TOKEN, ScreenSizeService, SideMenuProviderService, SideMenuService, SlotPosition, TABLE_COLUMN_PROVIDER, TABLE_COMPONENT_TOKEN, TABLE_FILTER_COMPONENT_TOKEN, TAB_VIEW_COMPONENT_TOKEN, TAG_COMPONENT_TOKEN, TEXTAREA_COMPONENT_TOKEN, TEXTFIELD_COMPONENT_TOKEN, TOOLTIP_COMPONENT_TOKEN, TableBuilder, TableButtonSeverity, TableColumnDirective, TableDatasourceDirective, TableFilterDirective, TableSelectionMode, TableService, UnsubscribeComponent, WarningCodesFns, WarningPipe, downloadFile, downloadText, getFirstError, getFirstErrorFromControl, isFilterEmpty, isFormStateEqual, queryListChanged, routerRenderer, setComponentProperties, setDataToArray };
2026
+ //# sourceMappingURL=verisoft-ui-core.mjs.map