@verisoft/ui-govcz 20.1.0 → 20.1.2

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 (223) hide show
  1. package/fesm2022/verisoft-ui-govcz.mjs +3770 -0
  2. package/fesm2022/verisoft-ui-govcz.mjs.map +1 -0
  3. package/index.d.ts +1013 -0
  4. package/package.json +19 -7
  5. package/styles/dist/main.css +13 -0
  6. package/styles/dist/main.css.map +1 -0
  7. package/.eslintrc.json +0 -60
  8. package/jest.config.ts +0 -21
  9. package/ng-package.json +0 -28
  10. package/project.json +0 -49
  11. package/src/config.d.ts +0 -10
  12. package/src/index.ts +0 -1
  13. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -25
  14. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -0
  15. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -21
  16. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -28
  17. package/src/lib/components/breadcrumb/index.ts +0 -1
  18. package/src/lib/components/button/button.component.html +0 -28
  19. package/src/lib/components/button/button.component.scss +0 -21
  20. package/src/lib/components/button/button.component.ts +0 -77
  21. package/src/lib/components/button/index.ts +0 -1
  22. package/src/lib/components/calendar/calendar.component.html +0 -28
  23. package/src/lib/components/calendar/calendar.component.scss +0 -0
  24. package/src/lib/components/calendar/calendar.component.ts +0 -77
  25. package/src/lib/components/calendar/index.ts +0 -1
  26. package/src/lib/components/checkbox/checkbox.component.html +0 -23
  27. package/src/lib/components/checkbox/checkbox.component.scss +0 -0
  28. package/src/lib/components/checkbox/checkbox.component.ts +0 -61
  29. package/src/lib/components/checkbox/index.ts +0 -1
  30. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +0 -50
  31. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +0 -4
  32. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +0 -79
  33. package/src/lib/components/confirm-dialog/index.ts +0 -1
  34. package/src/lib/components/dropdown/dropdown-item.component.html +0 -8
  35. package/src/lib/components/dropdown/dropdown-item.component.ts +0 -18
  36. package/src/lib/components/dropdown/dropdown.component.html +0 -91
  37. package/src/lib/components/dropdown/dropdown.component.scss +0 -108
  38. package/src/lib/components/dropdown/dropdown.component.spec.ts +0 -21
  39. package/src/lib/components/dropdown/dropdown.component.ts +0 -296
  40. package/src/lib/components/dropdown/dropdown.model.ts +0 -6
  41. package/src/lib/components/dropdown/index.ts +0 -1
  42. package/src/lib/components/dropdown-button/dropdown-button.component.html +0 -31
  43. package/src/lib/components/dropdown-button/dropdown-button.component.ts +0 -34
  44. package/src/lib/components/dropdown-button/index.ts +0 -1
  45. package/src/lib/components/errors/error.component.html +0 -11
  46. package/src/lib/components/errors/error.component.scss +0 -0
  47. package/src/lib/components/errors/error.component.spec.ts +0 -19
  48. package/src/lib/components/errors/error.component.ts +0 -29
  49. package/src/lib/components/errors/index.ts +0 -1
  50. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +0 -32
  51. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +0 -8
  52. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +0 -20
  53. package/src/lib/components/feature-list/feature-list-page.component.ts +0 -30
  54. package/src/lib/components/feature-list/feature-list-page.model.ts +0 -42
  55. package/src/lib/components/feature-list/feature-list.component.html +0 -67
  56. package/src/lib/components/feature-list/feature-list.component.scss +0 -10
  57. package/src/lib/components/feature-list/feature-list.component.ts +0 -360
  58. package/src/lib/components/feature-list/index.ts +0 -5
  59. package/src/lib/components/filter/directives/filter-field.directive.ts +0 -35
  60. package/src/lib/components/filter/filter.component.html +0 -78
  61. package/src/lib/components/filter/filter.component.scss +0 -32
  62. package/src/lib/components/filter/filter.component.spec.ts +0 -21
  63. package/src/lib/components/filter/filter.component.stories.ts +0 -23
  64. package/src/lib/components/filter/filter.component.ts +0 -286
  65. package/src/lib/components/filter/filter.model.ts +0 -18
  66. package/src/lib/components/filter/index.ts +0 -2
  67. package/src/lib/components/form-field/form-field.component.html +0 -14
  68. package/src/lib/components/form-field/form-field.component.scss +0 -0
  69. package/src/lib/components/form-field/form-field.component.spec.ts +0 -21
  70. package/src/lib/components/form-field/form-field.component.ts +0 -76
  71. package/src/lib/components/form-field/index.ts +0 -1
  72. package/src/lib/components/header/header.component.html +0 -122
  73. package/src/lib/components/header/header.component.scss +0 -0
  74. package/src/lib/components/header/header.component.ts +0 -90
  75. package/src/lib/components/header/index.ts +0 -1
  76. package/src/lib/components/icon/icon.component.html +0 -11
  77. package/src/lib/components/icon/icon.component.scss +0 -20
  78. package/src/lib/components/icon/icon.component.ts +0 -110
  79. package/src/lib/components/icon/index.ts +0 -2
  80. package/src/lib/components/index.ts +0 -37
  81. package/src/lib/components/input-group/index.ts +0 -1
  82. package/src/lib/components/input-group/input-group.component.html +0 -41
  83. package/src/lib/components/input-group/input-group.component.scss +0 -0
  84. package/src/lib/components/input-group/input-group.component.ts +0 -75
  85. package/src/lib/components/loader/index.ts +0 -1
  86. package/src/lib/components/loader/loader.component.html +0 -7
  87. package/src/lib/components/loader/loader.component.scss +0 -0
  88. package/src/lib/components/loader/loader.component.spec.ts +0 -21
  89. package/src/lib/components/loader/loader.component.ts +0 -33
  90. package/src/lib/components/multiselect/index.ts +0 -1
  91. package/src/lib/components/multiselect/multiselect.component.html +0 -21
  92. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  93. package/src/lib/components/multiselect/multiselect.component.spec.ts +0 -21
  94. package/src/lib/components/multiselect/multiselect.component.ts +0 -117
  95. package/src/lib/components/number-input/index.ts +0 -1
  96. package/src/lib/components/number-input/number-input.component.html +0 -48
  97. package/src/lib/components/number-input/number-input.component.scss +0 -0
  98. package/src/lib/components/number-input/number-input.component.ts +0 -80
  99. package/src/lib/components/page-header/index.ts +0 -1
  100. package/src/lib/components/page-header/page-header.component.html +0 -3
  101. package/src/lib/components/page-header/page-header.component.scss +0 -11
  102. package/src/lib/components/page-header/page-header.component.spec.ts +0 -21
  103. package/src/lib/components/page-header/page-header.component.ts +0 -27
  104. package/src/lib/components/password/index.ts +0 -1
  105. package/src/lib/components/password/password.component.html +0 -31
  106. package/src/lib/components/password/password.component.scss +0 -0
  107. package/src/lib/components/password/password.component.spec.ts +0 -21
  108. package/src/lib/components/password/password.component.ts +0 -83
  109. package/src/lib/components/radiobutton/index.ts +0 -1
  110. package/src/lib/components/radiobutton/radiobutton.component.html +0 -23
  111. package/src/lib/components/radiobutton/radiobutton.component.scss +0 -0
  112. package/src/lib/components/radiobutton/radiobutton.component.ts +0 -61
  113. package/src/lib/components/search/index.ts +0 -1
  114. package/src/lib/components/search/search.component.html +0 -23
  115. package/src/lib/components/search/search.component.scss +0 -0
  116. package/src/lib/components/search/search.component.ts +0 -45
  117. package/src/lib/components/section/index.ts +0 -1
  118. package/src/lib/components/section/section.component.html +0 -26
  119. package/src/lib/components/section/section.component.scss +0 -0
  120. package/src/lib/components/section/section.component.ts +0 -55
  121. package/src/lib/components/side-menu/index.ts +0 -2
  122. package/src/lib/components/side-menu/side-menu.component.html +0 -22
  123. package/src/lib/components/side-menu/side-menu.component.scss +0 -17
  124. package/src/lib/components/side-menu/side-menu.component.ts +0 -42
  125. package/src/lib/components/side-menu/side-menu.module.ts +0 -56
  126. package/src/lib/components/snackbar/index.ts +0 -2
  127. package/src/lib/components/snackbar/services/snackbar.service.ts +0 -73
  128. package/src/lib/components/snackbar/snackbar.component.html +0 -14
  129. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  130. package/src/lib/components/snackbar/snackbar.component.spec.ts +0 -21
  131. package/src/lib/components/snackbar/snackbar.component.ts +0 -44
  132. package/src/lib/components/snackbar/snackbar.model.ts +0 -10
  133. package/src/lib/components/stepper/index.ts +0 -1
  134. package/src/lib/components/stepper/stepper.component.html +0 -35
  135. package/src/lib/components/stepper/stepper.component.scss +0 -9
  136. package/src/lib/components/stepper/stepper.component.ts +0 -60
  137. package/src/lib/components/switch/index.ts +0 -1
  138. package/src/lib/components/switch/switch.component.html +0 -16
  139. package/src/lib/components/switch/switch.component.scss +0 -0
  140. package/src/lib/components/switch/switch.component.ts +0 -39
  141. package/src/lib/components/tab-view/index.ts +0 -2
  142. package/src/lib/components/tab-view/tab-view-item.component.ts +0 -23
  143. package/src/lib/components/tab-view/tab-view.component.html +0 -51
  144. package/src/lib/components/tab-view/tab-view.component.scss +0 -43
  145. package/src/lib/components/tab-view/tab-view.component.ts +0 -64
  146. package/src/lib/components/tab-view/tab-view.module.ts +0 -25
  147. package/src/lib/components/table/index.ts +0 -1
  148. package/src/lib/components/table/table-pagination-info.component.html +0 -9
  149. package/src/lib/components/table/table-pagination-info.component.ts +0 -22
  150. package/src/lib/components/table/table.component.html +0 -199
  151. package/src/lib/components/table/table.component.scss +0 -192
  152. package/src/lib/components/table/table.component.ts +0 -390
  153. package/src/lib/components/table/table.model.ts +0 -17
  154. package/src/lib/components/table/table.models.ts +0 -12
  155. package/src/lib/components/tag/index.ts +0 -3
  156. package/src/lib/components/tag/tag.component.html +0 -12
  157. package/src/lib/components/tag/tag.component.scss +0 -4
  158. package/src/lib/components/tag/tag.component.ts +0 -44
  159. package/src/lib/components/tag/tag.model.ts +0 -7
  160. package/src/lib/components/textarea/index.ts +0 -1
  161. package/src/lib/components/textarea/textarea.component.html +0 -50
  162. package/src/lib/components/textarea/textarea.component.scss +0 -0
  163. package/src/lib/components/textarea/textarea.component.ts +0 -77
  164. package/src/lib/components/textfield/index.ts +0 -1
  165. package/src/lib/components/textfield/textfield.component.html +0 -34
  166. package/src/lib/components/textfield/textfield.component.scss +0 -0
  167. package/src/lib/components/textfield/textfield.component.ts +0 -112
  168. package/src/lib/components/tooltip/index.ts +0 -1
  169. package/src/lib/components/tooltip/tooltip.component.html +0 -9
  170. package/src/lib/components/tooltip/tooltip.component.ts +0 -19
  171. package/src/lib/icons.ts +0 -36
  172. package/src/lib/index.ts +0 -5
  173. package/src/lib/init.service.ts +0 -11
  174. package/src/lib/interceptors/http-error-message.interceptor.ts +0 -45
  175. package/src/lib/pages/bad-request-page/bad-request-page.component.html +0 -5
  176. package/src/lib/pages/bad-request-page/bad-request-page.component.scss +0 -0
  177. package/src/lib/pages/bad-request-page/bad-request-page.component.ts +0 -14
  178. package/src/lib/pages/error-page/error-page.component.html +0 -5
  179. package/src/lib/pages/error-page/error-page.component.scss +0 -0
  180. package/src/lib/pages/error-page/error-page.component.ts +0 -31
  181. package/src/lib/pages/error-page/error-page.constants.ts +0 -19
  182. package/src/lib/pages/index.ts +0 -3
  183. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.html +0 -5
  184. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.scss +0 -0
  185. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.ts +0 -15
  186. package/src/lib/pages/not-authenticated/index.ts +0 -1
  187. package/src/lib/pages/not-authenticated/not-authenticated.component.html +0 -5
  188. package/src/lib/pages/not-authenticated/not-authenticated.component.ts +0 -13
  189. package/src/lib/pages/not-authorized/index.ts +0 -1
  190. package/src/lib/pages/not-authorized/not-authorized.component.html +0 -5
  191. package/src/lib/pages/not-authorized/not-authorized.component.ts +0 -17
  192. package/src/lib/pages/not-found/index.ts +0 -1
  193. package/src/lib/pages/not-found/not-found.component.html +0 -5
  194. package/src/lib/pages/not-found/not-found.component.ts +0 -17
  195. package/src/lib/pages/not-found-page/not-found-page.component.html +0 -6
  196. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  197. package/src/lib/pages/not-found-page/not-found-page.component.ts +0 -15
  198. package/src/lib/pipes/color/color.pipe.ts +0 -24
  199. package/src/lib/pipes/index.ts +0 -3
  200. package/src/lib/pipes/multiselect/multiselect-options.pipe.ts +0 -61
  201. package/src/lib/pipes/size/size.pipe.ts +0 -24
  202. package/src/test-setup.ts +0 -8
  203. package/tsconfig.json +0 -30
  204. package/tsconfig.lib.json +0 -17
  205. package/tsconfig.lib.prod.json +0 -9
  206. package/tsconfig.spec.json +0 -16
  207. /package/{src → styles}/sass/foundations/_colors.scss +0 -0
  208. /package/{src → styles}/sass/foundations/index.scss +0 -0
  209. /package/{src → styles}/sass/header.css +0 -0
  210. /package/{src → styles}/sass/header.scss +0 -0
  211. /package/{src → styles}/sass/integrations/_bootstrap.scss +0 -0
  212. /package/{src → styles}/sass/integrations/index.scss +0 -0
  213. /package/{src → styles}/sass/main.scss +0 -0
  214. /package/{src → styles}/sass/overrides/_gov.scss +0 -0
  215. /package/{src → styles}/sass/overrides/index.scss +0 -0
  216. /package/{src → styles}/sass/scrollbar.scss +0 -0
  217. /package/{src → styles}/sass/tokens/_theme-dark.scss +0 -0
  218. /package/{src → styles}/sass/tokens/_theme-light.scss +0 -0
  219. /package/{src → styles}/sass/tokens/index.scss +0 -0
  220. /package/{src → styles}/sass/utils/_table_filter.scss +0 -0
  221. /package/{src → styles}/sass/utils/_utils.scss +0 -0
  222. /package/{src → styles}/sass/utils/index.scss +0 -0
  223. /package/{src → styles}/sass/vendors/_bootstrap.scss +0 -0
@@ -1,390 +0,0 @@
1
- import { CommonModule, NgTemplateOutlet } from '@angular/common';
2
- import {
3
- AfterViewInit,
4
- ChangeDetectionStrategy,
5
- ChangeDetectorRef,
6
- Component,
7
- ContentChild,
8
- ContentChildren,
9
- effect,
10
- EventEmitter,
11
- inject,
12
- Input,
13
- OnChanges,
14
- Output,
15
- QueryList,
16
- SimpleChanges,
17
- TemplateRef,
18
- } from '@angular/core';
19
- import { ActivatedRoute, Router, RouterModule } from '@angular/router';
20
- import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
21
- import {
22
- FormCheckboxEvent,
23
- FormSelectEvent,
24
- } from '@gov-design-system-ce/components';
25
- import { TranslateModule } from '@ngx-translate/core';
26
- import {
27
- DEFAULT_SEARCH_LIMIT,
28
- LazyLoadEvent,
29
- multiSort,
30
- Sort,
31
- SortDirectionType,
32
- } from '@verisoft/core';
33
- import {
34
- ColumnDefinition,
35
- ColumnModel,
36
- ColumnProvider,
37
- DEFAULT_PAGINATION,
38
- FieldSize,
39
- FieldSizeType,
40
- MAX_COLUMN_CHAR_COUNT,
41
- RowModel,
42
- TABLE_COLUMN_PROVIDER,
43
- TABLE_COMPONENT_TOKEN,
44
- TableCore,
45
- TableSelectionMode,
46
- TableService,
47
- } from '@verisoft/ui-core';
48
- import { Icons } from '../../icons';
49
- import { GovSizePipe } from '../../pipes';
50
- import { LoaderComponent } from '../loader';
51
- import { TablePaginationInfoComponent } from './table-pagination-info.component';
52
- import { getNextSortDirection } from './table.model';
53
-
54
- @Component({
55
- selector: 'v-table',
56
- imports: [
57
- CommonModule,
58
- RouterModule,
59
- GovDesignSystemModule,
60
- NgTemplateOutlet,
61
- TranslateModule,
62
- GovSizePipe,
63
- LoaderComponent,
64
- TablePaginationInfoComponent,
65
- ],
66
- templateUrl: './table.component.html',
67
- changeDetection: ChangeDetectionStrategy.OnPush,
68
- styleUrl: './table.component.scss',
69
- providers: [
70
- {
71
- provide: TABLE_COMPONENT_TOKEN,
72
- useExisting: TableComponent,
73
- },
74
- ]
75
- })
76
- export class TableComponent<T>
77
- implements OnChanges, AfterViewInit, TableCore<T>
78
- {
79
- @ContentChildren(TABLE_COLUMN_PROVIDER)
80
- viewColumns!: QueryList<ColumnProvider<T>>;
81
-
82
- @ContentChild('rowDetail', { static: false })
83
- rowDetailTemplate!: TemplateRef<{ $implicit: T }>;
84
-
85
- @ContentChild('rowDetailButton', { static: false })
86
- rowDetailButtonTemplate!: TemplateRef<{ $implicit: T }>;
87
-
88
- @Input() sorters!: Sort[];
89
- @Input() data!: T[];
90
- @Input() total = 0;
91
- @Input() filter: Partial<T> | undefined;
92
- @Input() extraFilter: Partial<T> | undefined;
93
- @Input() loading = false;
94
- @Input() scrollable = true;
95
- @Input() pageSize = DEFAULT_SEARCH_LIMIT;
96
- @Input() currentPage = 1;
97
- @Input() showPaginator = true;
98
- @Input() userTableWrapper = true;
99
- @Input() sortMultiple = false;
100
- @Input() lazy = false;
101
- @Input() selectionMode: 'single' | 'multiple' | undefined;
102
- @Input() selection: T[] = [];
103
- @Input() showPageSizePicker = true;
104
- @Input() entityKey: string | undefined;
105
- @Input() customRoute: string | undefined;
106
- @Input() disableCustomClicks = false;
107
- @Input() tableName?: string;
108
- @Input() size: FieldSizeType = FieldSize.medium;
109
- @Input() showActionButtons = false;
110
- @Input() maximumColumnLength = MAX_COLUMN_CHAR_COUNT;
111
-
112
- @Input()
113
- set columns(value: ColumnDefinition<T>[]) {
114
- this._columns = value;
115
- this.updateColumnModels();
116
- }
117
-
118
- get columns(): ColumnDefinition<T>[] {
119
- return this._columns;
120
- }
121
-
122
- @Output() selectionChange = new EventEmitter<T[]>();
123
- @Output() lazyLoad = new EventEmitter<LazyLoadEvent>();
124
- @Output() download = new EventEmitter<RowModel<T>[]>();
125
- @Output() delete = new EventEmitter<RowModel<T>[]>();
126
- @Output() save = new EventEmitter<RowModel<T>[]>();
127
-
128
- private readonly cdRef = inject(ChangeDetectorRef);
129
- private readonly router = inject(Router);
130
- private readonly route = inject(ActivatedRoute);
131
- private readonly service = inject(TableService);
132
- private _columns: ColumnDefinition<T, keyof T>[] = [];
133
-
134
- tableColumns: ColumnModel<T>[] = [];
135
- tableRows: RowModel<T>[] = [];
136
- pageSizeOptions = DEFAULT_PAGINATION.map((x: number) => ({ value: x.toString() }));
137
- allSelected = false;
138
- icons = Icons;
139
-
140
- get govPageSize() {
141
- return this.pageSize.toString();
142
- }
143
-
144
- get tableRowView(): RowModel<T>[] {
145
- if (this.lazy) {
146
- return this.tableRows;
147
- } else {
148
- const start = (this.currentPage - 1) * this.pageSize;
149
- const end = start + this.pageSize;
150
- return this.tableRows.slice(start, end);
151
- }
152
- }
153
-
154
- get selected(): RowModel<T>[] {
155
- return this.tableRows.filter(r => r.selected);
156
- }
157
-
158
- get selectedCount(): number {
159
- return this.selected.length;
160
- }
161
-
162
- constructor() {
163
- effect(() => {
164
- this.reactToSignals();
165
- })
166
- }
167
-
168
- ngOnChanges(changes: SimpleChanges): void {
169
- if (changes['data']) {
170
- this.updateRowModels();
171
- if (!this.lazy && this.data) {
172
- this.total = this.data.length;
173
- }
174
- }
175
-
176
- if (changes['total']) {
177
- this.cdRef.markForCheck();
178
- }
179
-
180
- if (changes['selection']) {
181
- this.selectSelected();
182
- }
183
-
184
- if (changes['filter']) {
185
- this.updateFilter();
186
- }
187
- }
188
-
189
- ngAfterViewInit(): void {
190
- if (this.viewColumns?.length) {
191
- this.updateColumnModels();
192
- this.cdRef.detectChanges();
193
- }
194
- }
195
-
196
- protected sortColumn(column: ColumnModel<T>) {
197
- if (column.sortable) {
198
- column.sortDirection = getNextSortDirection(
199
- column.sortDirection,
200
- this.sortMultiple
201
- );
202
-
203
- if (!this.sortMultiple) {
204
- this.tableColumns
205
- .filter((x) => x !== column)
206
- .forEach((x) => {
207
- x.sortDirection = undefined;
208
- });
209
- }
210
-
211
- const sorts: Sort[] = this.getSorts().map((x) => ({
212
- field: 'row.' + x.field,
213
- direction: x.direction,
214
- }));
215
-
216
- if (!this.lazy) {
217
- this.tableRows = multiSort(this.tableRows, sorts);
218
- } else {
219
- this.fireLazyLoad();
220
- }
221
- }
222
- }
223
-
224
- protected changePage(event: { detail: { pagination: { currentPage: number } } }) {
225
- this.currentPage = event.detail.pagination.currentPage;
226
- this.fireLazyLoad();
227
- }
228
-
229
- protected changePageSize(event: CustomEvent<FormSelectEvent>) {
230
- this.pageSize = parseInt(event.detail.value);
231
- this.currentPage = 1;
232
- this.fireLazyLoad();
233
- }
234
-
235
- protected selectRow(row: RowModel<T>, event: MouseEvent) {
236
- if (event.ctrlKey || event.metaKey) {
237
- this.navigate(row, event);
238
- return;
239
- }
240
-
241
- if (this.selectionMode === 'single') {
242
- row.selected = !row.selected;
243
- this.tableRows.forEach((x) => (x !== row ? (x.selected = false) : null));
244
- this.fireSelectionChange();
245
- } else if (this.selectionMode === 'multiple') {
246
- row.selected = !row.selected;
247
- this.fireSelectionChange();
248
- }
249
- }
250
-
251
- protected navigate(row: RowModel<T>, event: MouseEvent) {
252
- if (this.disableCustomClicks) {
253
- return;
254
- }
255
-
256
- event.preventDefault();
257
- const targetUrl = this.createUrl(row);
258
-
259
- if (event.ctrlKey || event.metaKey) {
260
- setTimeout(() => {
261
- window.open(
262
- this.router.serializeUrl(this.router.createUrlTree([targetUrl], { relativeTo: this.route })),
263
- '_blank'
264
- );
265
- }, 0);
266
- } else {
267
- this.router.navigate([targetUrl], { relativeTo: this.route });
268
- }
269
- }
270
-
271
- protected navigateNewWindow(row: RowModel<T>, event: MouseEvent) {
272
- if (this.disableCustomClicks || event.button !== 1) {
273
- return;
274
- }
275
-
276
- event.preventDefault();
277
- const targetUrl = this.createUrl(row);
278
-
279
- window.open(this.router.serializeUrl(this.router.createUrlTree([targetUrl], { relativeTo: this.route })), '_blank');
280
- }
281
-
282
- protected toggleAll(event: CustomEvent<FormCheckboxEvent>) {
283
- this.allSelected = event.detail.checked;
284
- this.tableRows.forEach((x) => (x.selected = this.allSelected));
285
- this.fireSelectionChange();
286
- }
287
-
288
- protected toggleDetail(row: RowModel<T>) {
289
- row.expanded = !row.expanded;
290
- this.cdRef.detectChanges();
291
- }
292
-
293
- protected selectRowCheckbox(row: RowModel<T>, event: CustomEvent<FormCheckboxEvent>) {
294
- row.selected = event.detail.checked;
295
- this.allSelected = this.tableRows.every((x) => x.selected);
296
- this.fireSelectionChange();
297
- }
298
-
299
- protected truncate(text: string): string {
300
- return text.length > this.maximumColumnLength
301
- ? text.slice(0, this.maximumColumnLength) + '...'
302
- : text;
303
- }
304
-
305
- protected deselectAll() {
306
- this.allSelected = false;
307
- this.tableRows.forEach(x => (x.selected = this.allSelected));
308
- }
309
-
310
- private createUrl(row: RowModel<T>): string {
311
- if (row.customRoute) {
312
- return row.customRoute;
313
- }
314
-
315
- return row.id.toString();
316
- }
317
-
318
- private reactToSignals(): void {
319
- const reload = this.service.reload();
320
-
321
- if (typeof reload === 'symbol') {
322
- this.fireLazyLoad();
323
- } else if (reload.name === this.tableName) {
324
- this.fireLazyLoad()
325
- }
326
-
327
- this.deselectAll();
328
- }
329
-
330
- private updateColumnModels() {
331
- const viewColumns = this.viewColumns
332
- ?.toArray()
333
- .map((x) => x.getDefinition());
334
- this.tableColumns = [...(this._columns ?? []), ...(viewColumns ?? [])].map(
335
- (x) => new ColumnModel(x)
336
- );
337
- }
338
-
339
- private updateRowModels(): void {
340
- this.tableRows = (this.data ?? []).map(
341
- (x) => new RowModel(x, false, false, undefined, undefined, undefined, this.customRoute, this.entityKey)
342
- );
343
- }
344
-
345
- private fireSelectionChange() {
346
- const selectedRows = this.tableRows
347
- .filter((x) => x.selected)
348
- .map((x) => x.row);
349
- this.selectionChange.emit(selectedRows);
350
- }
351
-
352
- private selectSelected() {
353
- if (this.selection?.length && this.selectionMode) {
354
- const selection =
355
- this.selectionMode === TableSelectionMode.single
356
- ? [this.selection[0]]
357
- : this.selection;
358
- const selectionSet = new Set(selection);
359
- this.tableRows.forEach((item) => {
360
- item.selected = selectionSet.has(item.row);
361
- });
362
-
363
- this.allSelected = this.tableRows.every((x) => x.selected);
364
- }
365
- }
366
-
367
- private fireLazyLoad() {
368
- const lazyLoadEvent: LazyLoadEvent = {
369
- sort: this.getSorts(),
370
- offset: (this.currentPage - 1) * this.pageSize,
371
- limit: this.pageSize,
372
- filter: this.filter,
373
- };
374
-
375
- this.lazyLoad.emit(lazyLoadEvent);
376
- }
377
-
378
- private updateFilter() {
379
- this.fireLazyLoad();
380
- }
381
-
382
- private getSorts(): Sort[] {
383
- return this.tableColumns
384
- .filter((x) => x.sortable && x.sortDirection)
385
- .map((x) => ({
386
- field: x.id,
387
- direction: <SortDirectionType>x.sortDirection,
388
- }));
389
- }
390
- }
@@ -1,17 +0,0 @@
1
- import { SortDirection, SortDirectionType } from '@verisoft/core';
2
-
3
- export function getNextSortDirection(
4
- sortDirection: SortDirectionType | undefined,
5
- isNullable = false
6
- ): SortDirectionType | undefined {
7
- return isNullable && sortDirection === SortDirection.desc
8
- ? undefined
9
- : !sortDirection || sortDirection === SortDirection.desc
10
- ? SortDirection.asc
11
- : SortDirection.desc;
12
- }
13
- export function createCustomRoute<T>(row: T, entityKey?: string, customRoute?: string) {
14
- return customRoute && entityKey
15
- ? customRoute + (row as { [key: string]: string })[entityKey]
16
- : undefined;
17
- }
@@ -1,12 +0,0 @@
1
- import { SortDirection, SortDirectionType } from '@verisoft/core';
2
-
3
- export function getNextSortDirection(
4
- sortDirection: SortDirectionType | undefined,
5
- isNullable = false
6
- ): SortDirectionType | undefined {
7
- return isNullable && sortDirection === SortDirection.desc
8
- ? undefined
9
- : !sortDirection || sortDirection === SortDirection.desc
10
- ? SortDirection.asc
11
- : SortDirection.desc;
12
- }
@@ -1,3 +0,0 @@
1
- export * from './tag.component';
2
- export * from './tag.model';
3
-
@@ -1,12 +0,0 @@
1
- <gov-tag
2
- [color]="severity() | govColor"
3
- [type]="variant()"
4
- [size]="size() | govSize"
5
- >
6
- @if (label()) {
7
- {{ label() | translate }}
8
- } @else {
9
- <ng-content></ng-content>
10
- }
11
- </gov-tag>
12
-
@@ -1,4 +0,0 @@
1
- :host {
2
- display: inline-block;
3
- }
4
-
@@ -1,44 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- input,
5
- } from "@angular/core";
6
- import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
7
- import { TranslateModule } from "@ngx-translate/core";
8
- import {
9
- ControlSeverity,
10
- ControlSeverityType,
11
- FieldSize,
12
- FieldSizeType,
13
- TagCore,
14
- TAG_COMPONENT_TOKEN,
15
- TagVariant,
16
- } from "@verisoft/ui-core";
17
- import { GovColorPipe, GovSizePipe } from "../../pipes";
18
- import { GovTagType } from "./tag.model";
19
-
20
- @Component({
21
- selector: "v-tag",
22
- styleUrl: "./tag.component.scss",
23
- templateUrl: './tag.component.html',
24
- imports: [
25
- GovDesignSystemModule,
26
- GovSizePipe,
27
- GovColorPipe,
28
- TranslateModule
29
- ],
30
- changeDetection: ChangeDetectionStrategy.OnPush,
31
- providers: [
32
- {
33
- provide: TAG_COMPONENT_TOKEN,
34
- useExisting: TagComponent,
35
- }
36
- ],
37
- })
38
- export class TagComponent implements TagCore {
39
- label = input<string | undefined>();
40
- severity = input<ControlSeverityType | undefined>(ControlSeverity.primary);
41
- variant = input<TagVariant>(GovTagType.bold);
42
- size = input<FieldSizeType>(FieldSize.medium);
43
- }
44
-
@@ -1,7 +0,0 @@
1
- export enum GovTagType {
2
- bold = 'bold',
3
- subtle = 'subtle',
4
- }
5
-
6
- export type GovTagTypeType = keyof typeof GovTagType;
7
-
@@ -1 +0,0 @@
1
- export * from './textarea.component';
@@ -1,50 +0,0 @@
1
- <gov-form-control class="mb-3">
2
- @if (label) {
3
- <gov-form-label
4
- [slot]="labelSlot"
5
- [size]="size | govSize"
6
- >
7
- {{ label | translate }}
8
- </gov-form-label>
9
- }
10
- <gov-form-group>
11
- <gov-form-input [type]="type"
12
- [formControl]="formControl"
13
- [minlength]="minlength"
14
- [maxlength]="maxlength"
15
- [size]='size | govSize'
16
- [name]='name'
17
- [role]='role'
18
- [required]="required"
19
- [readonly]="readonly"
20
- [invalid]="ngControl?.errors ? true : false"
21
- [multiline]="true"
22
- [rows]="rows"
23
- [cols]="cols"
24
- >
25
- @if (icon) {
26
- <gov-icon
27
- [name]="icon"
28
- [slot]="iconPos === 'left' ? 'icon-start' : 'icon-end'"
29
- />
30
- } @if (prefix) {
31
- <p slot="prefix">
32
- {{ prefix }}
33
- </p>
34
- } @if (sufix) {
35
- <p slot="sufix">
36
- {{ sufix }}
37
- </p>
38
- }
39
- </gov-form-input>
40
- </gov-form-group>
41
- <v-validation-message [ngControl]="ngControl"></v-validation-message>
42
- @if (message) {
43
- <gov-form-message
44
- [slot]="messageSlot"
45
- color="neutral"
46
- >
47
- {{ message | translate }}
48
- </gov-form-message>
49
- }
50
- </gov-form-control>
@@ -1,77 +0,0 @@
1
-
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- Input,
6
- Optional,
7
- Self,
8
- } from '@angular/core';
9
- import {
10
- ControlValueAccessor,
11
- NgControl,
12
- ReactiveFormsModule,
13
- } from '@angular/forms';
14
- import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
15
- import { TranslateModule } from '@ngx-translate/core';
16
- import {
17
- TextfieldCore,
18
- FieldType,
19
- BaseFormInputComponent,
20
- FieldSizeType,
21
- FieldSize,
22
- IconPositionType,
23
- IconPosition,
24
- SlotPositionType,
25
- SlotPosition,
26
- TEXTAREA_COMPONENT_TOKEN,
27
- TextareaCore,
28
- } from '@verisoft/ui-core';
29
- import { Icons } from '../../icons';
30
- import { GovSizePipe } from '../../pipes';
31
- import { ErrorComponent } from '../errors';
32
- @Component({
33
- selector: 'v-textarea',
34
- imports: [
35
- ReactiveFormsModule,
36
- GovDesignSystemModule,
37
- GovSizePipe,
38
- ErrorComponent,
39
- TranslateModule
40
- ],
41
- templateUrl: './textarea.component.html',
42
- styleUrl: './textarea.component.scss',
43
- changeDetection: ChangeDetectionStrategy.OnPush,
44
- providers: [
45
- {
46
- provide: TEXTAREA_COMPONENT_TOKEN,
47
- useExisting: TextareaComponent,
48
- },
49
- ]
50
- })
51
- export class TextareaComponent
52
- extends BaseFormInputComponent
53
- implements ControlValueAccessor, TextareaCore {
54
- @Input() floatLabel!: string | undefined;
55
- @Input() type = FieldType.text;
56
- @Input() minlength = 0;
57
- @Input() maxlength = 524288;
58
- @Input() prefix!: string;
59
- @Input() sufix!: string;
60
- @Input() message!: string;
61
- @Input() name!: string;
62
- @Input() role!: string;
63
- @Input() size: FieldSizeType = FieldSize.medium;
64
- @Input() icon!: string;
65
- @Input() iconPos: IconPositionType = IconPosition.right;
66
- @Input() labelSlot: SlotPositionType = SlotPosition.top;
67
- @Input() messageSlot: SlotPositionType = SlotPosition.bottom;
68
- @Input() rows = 0;
69
- @Input() cols = 0;
70
- @Input() autoResize = false;
71
-
72
- icons = Icons;
73
-
74
- constructor(@Optional() @Self() ngControl: NgControl) {
75
- super(ngControl);
76
- }
77
- }
@@ -1 +0,0 @@
1
- export * from './textfield.component';
@@ -1,34 +0,0 @@
1
- <gov-form-control>
2
- @if (label) {
3
- <gov-form-label [slot]="labelSlot" [size]="size | govSize">
4
- {{ label | translate }}
5
- @if (tooltip) {
6
- <v-tooltip [tooltipText]="tooltip | translate" />
7
- }
8
- </gov-form-label>
9
- }
10
- <gov-form-group>
11
- <gov-form-input [inputType]="type" [formControl]="formControl" [minlength]="minlength" [maxlength]="maxlength"
12
- [min]="min" [max]="max" [size]='size | govSize' [name]='name' [role]='role' [required]="required"
13
- [attr.disabled]="disabled ? 'true' : 'false'" [invalid]="ngControl?.errors ? true : false"
14
- [placeholder]="placeholder">
15
- @if (icon) {
16
- <gov-icon [name]="icon" [slot]="iconPos === 'left' ? 'icon-start' : 'icon-end'" />
17
- } @if (prefix) {
18
- <p slot="prefix">
19
- {{ prefix }}
20
- </p>
21
- } @if (sufix) {
22
- <p slot="sufix">
23
- {{ sufix }}
24
- </p>
25
- }
26
- </gov-form-input>
27
- <v-validation-message [ngControl]="ngControl" />
28
- @if (message) {
29
- <gov-form-message [slot]="messageSlot" color="neutral">
30
- {{ message }}
31
- </gov-form-message>
32
- }
33
- </gov-form-group>
34
- </gov-form-control>