@verisoft/ui-core 18.7.0 → 19.0.0-rc001

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