@verisoft/ui-govcz 20.0.1 → 20.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/.eslintrc.json +60 -0
  2. package/assets/i18n/cs.json +2 -0
  3. package/assets/i18n/en.json +2 -0
  4. package/jest.config.ts +21 -0
  5. package/ng-package.json +28 -0
  6. package/package.json +9 -19
  7. package/project.json +49 -0
  8. package/src/config.d.ts +10 -0
  9. package/src/index.ts +1 -0
  10. package/src/lib/components/breadcrumb/breadcrumb.component.html +25 -0
  11. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -0
  12. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
  13. package/src/lib/components/breadcrumb/breadcrumb.component.ts +28 -0
  14. package/src/lib/components/breadcrumb/index.ts +1 -0
  15. package/src/lib/components/button/button.component.html +28 -0
  16. package/src/lib/components/button/button.component.scss +21 -0
  17. package/src/lib/components/button/button.component.ts +77 -0
  18. package/src/lib/components/button/index.ts +1 -0
  19. package/src/lib/components/calendar/calendar.component.html +28 -0
  20. package/src/lib/components/calendar/calendar.component.scss +0 -0
  21. package/src/lib/components/calendar/calendar.component.ts +77 -0
  22. package/src/lib/components/calendar/index.ts +1 -0
  23. package/src/lib/components/checkbox/checkbox.component.html +23 -0
  24. package/src/lib/components/checkbox/checkbox.component.scss +0 -0
  25. package/src/lib/components/checkbox/checkbox.component.ts +61 -0
  26. package/src/lib/components/checkbox/index.ts +1 -0
  27. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +50 -0
  28. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +4 -0
  29. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +79 -0
  30. package/src/lib/components/confirm-dialog/index.ts +1 -0
  31. package/src/lib/components/dropdown/dropdown-item.component.html +8 -0
  32. package/src/lib/components/dropdown/dropdown-item.component.ts +18 -0
  33. package/src/lib/components/dropdown/dropdown.component.html +91 -0
  34. package/src/lib/components/dropdown/dropdown.component.scss +108 -0
  35. package/src/lib/components/dropdown/dropdown.component.spec.ts +21 -0
  36. package/src/lib/components/dropdown/dropdown.component.ts +296 -0
  37. package/src/lib/components/dropdown/dropdown.model.ts +6 -0
  38. package/src/lib/components/dropdown/index.ts +1 -0
  39. package/src/lib/components/dropdown-button/dropdown-button.component.html +31 -0
  40. package/src/lib/components/dropdown-button/dropdown-button.component.ts +34 -0
  41. package/src/lib/components/dropdown-button/index.ts +1 -0
  42. package/src/lib/components/errors/error.component.html +11 -0
  43. package/src/lib/components/errors/error.component.scss +0 -0
  44. package/src/lib/components/errors/error.component.spec.ts +19 -0
  45. package/src/lib/components/errors/error.component.ts +29 -0
  46. package/src/lib/components/errors/index.ts +1 -0
  47. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +32 -0
  48. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +8 -0
  49. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +20 -0
  50. package/src/lib/components/feature-list/feature-list-page.component.ts +30 -0
  51. package/src/lib/components/feature-list/feature-list-page.model.ts +42 -0
  52. package/src/lib/components/feature-list/feature-list.component.html +67 -0
  53. package/src/lib/components/feature-list/feature-list.component.scss +10 -0
  54. package/src/lib/components/feature-list/feature-list.component.ts +360 -0
  55. package/src/lib/components/feature-list/index.ts +5 -0
  56. package/src/lib/components/filter/directives/filter-field.directive.ts +35 -0
  57. package/src/lib/components/filter/filter.component.html +78 -0
  58. package/src/lib/components/filter/filter.component.scss +32 -0
  59. package/src/lib/components/filter/filter.component.spec.ts +21 -0
  60. package/src/lib/components/filter/filter.component.stories.ts +23 -0
  61. package/src/lib/components/filter/filter.component.ts +286 -0
  62. package/src/lib/components/filter/filter.model.ts +18 -0
  63. package/src/lib/components/filter/index.ts +2 -0
  64. package/src/lib/components/form-field/form-field.component.html +14 -0
  65. package/src/lib/components/form-field/form-field.component.scss +0 -0
  66. package/src/lib/components/form-field/form-field.component.spec.ts +21 -0
  67. package/src/lib/components/form-field/form-field.component.ts +76 -0
  68. package/src/lib/components/form-field/index.ts +1 -0
  69. package/src/lib/components/header/header.component.html +122 -0
  70. package/src/lib/components/header/header.component.scss +0 -0
  71. package/src/lib/components/header/header.component.ts +90 -0
  72. package/src/lib/components/header/index.ts +1 -0
  73. package/src/lib/components/icon/icon.component.html +11 -0
  74. package/src/lib/components/icon/icon.component.scss +20 -0
  75. package/src/lib/components/icon/icon.component.ts +110 -0
  76. package/src/lib/components/icon/index.ts +2 -0
  77. package/src/lib/components/index.ts +37 -0
  78. package/src/lib/components/input-group/index.ts +1 -0
  79. package/src/lib/components/input-group/input-group.component.html +41 -0
  80. package/src/lib/components/input-group/input-group.component.scss +0 -0
  81. package/src/lib/components/input-group/input-group.component.ts +75 -0
  82. package/src/lib/components/loader/index.ts +1 -0
  83. package/src/lib/components/loader/loader.component.html +7 -0
  84. package/src/lib/components/loader/loader.component.scss +0 -0
  85. package/src/lib/components/loader/loader.component.spec.ts +21 -0
  86. package/src/lib/components/loader/loader.component.ts +33 -0
  87. package/src/lib/components/multiselect/index.ts +1 -0
  88. package/src/lib/components/multiselect/multiselect.component.html +21 -0
  89. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  90. package/src/lib/components/multiselect/multiselect.component.spec.ts +21 -0
  91. package/src/lib/components/multiselect/multiselect.component.ts +117 -0
  92. package/src/lib/components/number-input/index.ts +1 -0
  93. package/src/lib/components/number-input/number-input.component.html +48 -0
  94. package/src/lib/components/number-input/number-input.component.scss +0 -0
  95. package/src/lib/components/number-input/number-input.component.ts +80 -0
  96. package/src/lib/components/page-header/index.ts +1 -0
  97. package/src/lib/components/page-header/page-header.component.html +3 -0
  98. package/src/lib/components/page-header/page-header.component.scss +11 -0
  99. package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
  100. package/src/lib/components/page-header/page-header.component.ts +27 -0
  101. package/src/lib/components/password/index.ts +1 -0
  102. package/src/lib/components/password/password.component.html +31 -0
  103. package/src/lib/components/password/password.component.scss +0 -0
  104. package/src/lib/components/password/password.component.spec.ts +21 -0
  105. package/src/lib/components/password/password.component.ts +83 -0
  106. package/src/lib/components/radiobutton/index.ts +1 -0
  107. package/src/lib/components/radiobutton/radiobutton.component.html +23 -0
  108. package/src/lib/components/radiobutton/radiobutton.component.scss +0 -0
  109. package/src/lib/components/radiobutton/radiobutton.component.ts +61 -0
  110. package/src/lib/components/search/index.ts +1 -0
  111. package/src/lib/components/search/search.component.html +23 -0
  112. package/src/lib/components/search/search.component.scss +0 -0
  113. package/src/lib/components/search/search.component.ts +45 -0
  114. package/src/lib/components/section/index.ts +1 -0
  115. package/src/lib/components/section/section.component.html +26 -0
  116. package/src/lib/components/section/section.component.scss +0 -0
  117. package/src/lib/components/section/section.component.ts +55 -0
  118. package/src/lib/components/side-menu/index.ts +2 -0
  119. package/src/lib/components/side-menu/side-menu.component.html +22 -0
  120. package/src/lib/components/side-menu/side-menu.component.scss +17 -0
  121. package/src/lib/components/side-menu/side-menu.component.ts +42 -0
  122. package/src/lib/components/side-menu/side-menu.module.ts +56 -0
  123. package/src/lib/components/snackbar/index.ts +2 -0
  124. package/src/lib/components/snackbar/services/snackbar.service.ts +73 -0
  125. package/src/lib/components/snackbar/snackbar.component.html +14 -0
  126. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  127. package/src/lib/components/snackbar/snackbar.component.spec.ts +21 -0
  128. package/src/lib/components/snackbar/snackbar.component.ts +44 -0
  129. package/src/lib/components/snackbar/snackbar.model.ts +10 -0
  130. package/src/lib/components/stepper/index.ts +1 -0
  131. package/src/lib/components/stepper/stepper.component.html +35 -0
  132. package/src/lib/components/stepper/stepper.component.scss +9 -0
  133. package/src/lib/components/stepper/stepper.component.ts +60 -0
  134. package/src/lib/components/switch/index.ts +1 -0
  135. package/src/lib/components/switch/switch.component.html +16 -0
  136. package/src/lib/components/switch/switch.component.scss +0 -0
  137. package/src/lib/components/switch/switch.component.ts +39 -0
  138. package/src/lib/components/tab-view/index.ts +2 -0
  139. package/src/lib/components/tab-view/tab-view-item.component.ts +23 -0
  140. package/src/lib/components/tab-view/tab-view.component.html +51 -0
  141. package/src/lib/components/tab-view/tab-view.component.scss +43 -0
  142. package/src/lib/components/tab-view/tab-view.component.ts +64 -0
  143. package/src/lib/components/tab-view/tab-view.module.ts +25 -0
  144. package/src/lib/components/table/index.ts +1 -0
  145. package/src/lib/components/table/table-pagination-info.component.html +9 -0
  146. package/src/lib/components/table/table-pagination-info.component.ts +22 -0
  147. package/src/lib/components/table/table.component.html +199 -0
  148. package/src/lib/components/table/table.component.scss +192 -0
  149. package/src/lib/components/table/table.component.ts +390 -0
  150. package/src/lib/components/table/table.model.ts +17 -0
  151. package/src/lib/components/table/table.models.ts +12 -0
  152. package/src/lib/components/tag/index.ts +3 -0
  153. package/src/lib/components/tag/tag.component.html +12 -0
  154. package/src/lib/components/tag/tag.component.scss +4 -0
  155. package/src/lib/components/tag/tag.component.ts +44 -0
  156. package/src/lib/components/tag/tag.model.ts +7 -0
  157. package/src/lib/components/textarea/index.ts +1 -0
  158. package/src/lib/components/textarea/textarea.component.html +50 -0
  159. package/src/lib/components/textarea/textarea.component.scss +0 -0
  160. package/src/lib/components/textarea/textarea.component.ts +77 -0
  161. package/src/lib/components/textfield/index.ts +1 -0
  162. package/src/lib/components/textfield/textfield.component.html +34 -0
  163. package/src/lib/components/textfield/textfield.component.scss +0 -0
  164. package/src/lib/components/textfield/textfield.component.ts +112 -0
  165. package/src/lib/components/tooltip/index.ts +1 -0
  166. package/src/lib/components/tooltip/tooltip.component.html +9 -0
  167. package/src/lib/components/tooltip/tooltip.component.ts +19 -0
  168. package/src/lib/icons.ts +36 -0
  169. package/src/lib/index.ts +5 -0
  170. package/src/lib/init.service.ts +11 -0
  171. package/src/lib/interceptors/http-error-message.interceptor.ts +45 -0
  172. package/src/lib/pages/bad-request-page/bad-request-page.component.html +5 -0
  173. package/src/lib/pages/bad-request-page/bad-request-page.component.scss +0 -0
  174. package/src/lib/pages/bad-request-page/bad-request-page.component.ts +14 -0
  175. package/src/lib/pages/error-page/error-page.component.html +5 -0
  176. package/src/lib/pages/error-page/error-page.component.scss +0 -0
  177. package/src/lib/pages/error-page/error-page.component.ts +31 -0
  178. package/src/lib/pages/error-page/error-page.constants.ts +19 -0
  179. package/src/lib/pages/index.ts +3 -0
  180. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.html +5 -0
  181. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.scss +0 -0
  182. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.ts +15 -0
  183. package/src/lib/pages/not-authenticated/index.ts +1 -0
  184. package/src/lib/pages/not-authenticated/not-authenticated.component.html +5 -0
  185. package/src/lib/pages/not-authenticated/not-authenticated.component.ts +13 -0
  186. package/src/lib/pages/not-authorized/index.ts +1 -0
  187. package/src/lib/pages/not-authorized/not-authorized.component.html +5 -0
  188. package/src/lib/pages/not-authorized/not-authorized.component.ts +17 -0
  189. package/src/lib/pages/not-found/index.ts +1 -0
  190. package/src/lib/pages/not-found/not-found.component.html +5 -0
  191. package/src/lib/pages/not-found/not-found.component.ts +17 -0
  192. package/src/lib/pages/not-found-page/not-found-page.component.html +6 -0
  193. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  194. package/src/lib/pages/not-found-page/not-found-page.component.ts +15 -0
  195. package/src/lib/pipes/color/color.pipe.ts +24 -0
  196. package/src/lib/pipes/index.ts +3 -0
  197. package/src/lib/pipes/multiselect/multiselect-options.pipe.ts +61 -0
  198. package/src/lib/pipes/size/size.pipe.ts +24 -0
  199. package/src/sass/foundations/_colors.scss +4 -0
  200. package/src/sass/foundations/index.scss +1 -0
  201. package/src/sass/integrations/_bootstrap.scss +4 -0
  202. package/src/sass/integrations/index.scss +1 -0
  203. package/src/sass/main.scss +12 -0
  204. package/src/sass/overrides/_gov.scss +4 -0
  205. package/src/sass/overrides/index.scss +1 -0
  206. package/src/sass/tokens/_theme-dark.scss +18 -0
  207. package/src/sass/tokens/_theme-light.scss +9 -0
  208. package/src/sass/tokens/index.scss +3 -0
  209. package/src/sass/utils/_table_filter.scss +4 -0
  210. package/src/sass/utils/index.scss +2 -0
  211. package/{styles → src}/sass/vendors/_bootstrap.scss +1 -0
  212. package/src/test-setup.ts +8 -0
  213. package/tsconfig.json +30 -0
  214. package/tsconfig.lib.json +17 -0
  215. package/tsconfig.lib.prod.json +9 -0
  216. package/tsconfig.spec.json +16 -0
  217. package/fesm2022/verisoft-ui-govcz.mjs +0 -3582
  218. package/fesm2022/verisoft-ui-govcz.mjs.map +0 -1
  219. package/index.d.ts +0 -955
  220. package/styles/dist/main.css +0 -9
  221. package/styles/dist/main.css.map +0 -1
  222. package/styles/sass/main.scss +0 -10
  223. package/styles/sass/utils/_variables.scss +0 -3
  224. package/styles/sass/utils/index.scss +0 -2
  225. /package/{styles → src}/sass/header.css +0 -0
  226. /package/{styles → src}/sass/header.scss +0 -0
  227. /package/{styles → src}/sass/scrollbar.scss +0 -0
  228. /package/{styles → src}/sass/utils/_utils.scss +0 -0
@@ -0,0 +1,31 @@
1
+ <gov-dropdown position="left">
2
+ <v-button
3
+ [label]="label()"
4
+ [icon]="icon()"
5
+ [rounded]="rounded() ?? false"
6
+ [outlined]="outlined() ?? false"
7
+ [raised]="raised() ?? false"
8
+ [severity]="severity()"
9
+ [type]="type()"
10
+ [size]="size()"
11
+ />
12
+
13
+ @if (items()?.length) {
14
+ <ul slot="list">
15
+ @for (item of items(); track item.id) {
16
+ <li>
17
+ <v-button
18
+ class="w-100"
19
+ [label]="item.label"
20
+ [icon]="item.icon"
21
+ [severity]="$any('normal')"
22
+ [size]="'medium'"
23
+ [type]="type()"
24
+ (click)="fireClickItem(item)"
25
+ />
26
+ </li>
27
+ }
28
+ </ul>
29
+ }
30
+ </gov-dropdown>
31
+
@@ -0,0 +1,34 @@
1
+ import { Component, input, output } from "@angular/core";
2
+ import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
3
+ import { DropdownButtonCore, DROPDOWN_BUTTON_COMPONENT_TOKEN, ButtonCore, ControlSeverityType, ControlSeverity, FieldSizeType, MenuItem, GovButtonTypeType, GovButtonType } from "@verisoft/ui-core";
4
+ import { ButtonComponent } from "../button";
5
+
6
+ @Component({
7
+ selector: 'v-dropdown-button',
8
+ templateUrl: './dropdown-button.component.html',
9
+ imports: [ GovDesignSystemModule, ButtonComponent],
10
+ providers: [
11
+ { provide: DROPDOWN_BUTTON_COMPONENT_TOKEN, useExisting: DropdownButtonComponent }
12
+ ]
13
+ })
14
+ export class DropdownButtonComponent implements DropdownButtonCore {
15
+ label = input<string | undefined>();
16
+ icon = input<string | undefined>();
17
+ rounded = input<boolean | undefined>(false);
18
+ raised = input<boolean | undefined>(false);
19
+ outlined = input<boolean | undefined>(false);
20
+ severity = input<ControlSeverityType | undefined>(ControlSeverity.primary);
21
+ size = input<FieldSizeType | undefined>();
22
+ type = input<GovButtonTypeType>(GovButtonType.solid);
23
+ items = input<MenuItem[] | undefined>(undefined);
24
+
25
+ fireClick = output<MenuItem>();
26
+
27
+ fireClickItem(item: MenuItem): void {
28
+ if (item.command) {
29
+ item.command();
30
+ } else {
31
+ this.fireClick.emit(item);
32
+ }
33
+ }
34
+ }
@@ -0,0 +1 @@
1
+ export * from './dropdown-button.component';
@@ -0,0 +1,11 @@
1
+ @if (ngControl && ngControl.errors) {
2
+ <gov-form-message
3
+ [slot]="errorSlot"
4
+ color="error"
5
+ >
6
+ {{ getErrorMessage(ngControl.errors) | async }}
7
+ <gov-icon
8
+ [name]="icons.warning"
9
+ slot="validation-icon" />
10
+ </gov-form-message>
11
+ }
File without changes
@@ -0,0 +1,19 @@
1
+ describe('Extract first key from errors object', () => {
2
+ it('should return the first key from an object with multiple keys', () => {
3
+ const errors = { name: 'Required', email: 'Invalid' };
4
+ const key = Object.keys(errors)[0];
5
+ expect(key).toBe('name');
6
+ });
7
+
8
+ it('should return undefined for an empty object', () => {
9
+ const errors = {};
10
+ const key = Object.keys(errors)[0];
11
+ expect(key).toBeUndefined();
12
+ });
13
+
14
+ it('should return the only key in a single-key object', () => {
15
+ const errors = { password: 'Too short' };
16
+ const key = Object.keys(errors)[0];
17
+ expect(key).toBe('password');
18
+ });
19
+ });
@@ -0,0 +1,29 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { Component, inject, Input, } from "@angular/core";
3
+ import { NgControl, ValidationErrors } from "@angular/forms";
4
+ import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
5
+ import { ERROR_PROVIDER_TOKEN } from "@verisoft/core";
6
+ import { SlotPosition, SlotPositionType } from "@verisoft/ui-core";
7
+ import { Observable } from "rxjs";
8
+ import { Icons } from "../../icons";
9
+
10
+ @Component({
11
+ selector: "v-validation-message",
12
+ templateUrl: "./error.component.html",
13
+ styleUrl: "./error.component.scss",
14
+ imports: [CommonModule, GovDesignSystemModule]
15
+ })
16
+ export class ErrorComponent {
17
+ @Input({ required: true }) ngControl?: NgControl;
18
+
19
+ @Input() errorSlot: SlotPositionType = SlotPosition.bottom
20
+
21
+ @Input() messageSlot: SlotPositionType = SlotPosition.bottom
22
+
23
+ readonly errorService = inject(ERROR_PROVIDER_TOKEN);
24
+ icons = Icons
25
+
26
+ getErrorMessage(errors: ValidationErrors): Observable<string | undefined> {
27
+ return this.errorService.mapError(errors);
28
+ }
29
+ }
@@ -0,0 +1 @@
1
+ export * from './error.component';
@@ -0,0 +1,32 @@
1
+ import { Directive, Input } from '@angular/core';
2
+ import { GenericFieldType, GenericFieldTypeType, TableColumnDirective } from '@verisoft/ui-core';
3
+ import { FEATURE_LIST_COLUMN_PROVIDER, FeatureListColumnDefinition, FeatureListColumnProvider } from '../feature-list-page.model';
4
+
5
+ @Directive({
6
+ // eslint-disable-next-line @angular-eslint/directive-selector
7
+ selector: 'v-feature-list-column',
8
+ standalone: true,
9
+ providers: [
10
+ {
11
+ provide: FEATURE_LIST_COLUMN_PROVIDER,
12
+ useExisting: FeatureListColumnDirective,
13
+ multi: true,
14
+ },
15
+ ],
16
+ })
17
+ export class FeatureListColumnDirective<T>
18
+ extends TableColumnDirective<T>
19
+ implements FeatureListColumnProvider<T>
20
+ {
21
+ @Input() filter = false;
22
+
23
+ @Input() type: GenericFieldTypeType = GenericFieldType.text;
24
+
25
+ override getDefinition(): FeatureListColumnDefinition<T> {
26
+ const definition = super.getDefinition() as FeatureListColumnDefinition<T>;
27
+ definition.filter = this.filter;
28
+ definition.type = this.type;
29
+ definition.format = this.format;
30
+ return definition;
31
+ }
32
+ }
@@ -0,0 +1,8 @@
1
+ import { Directive } from '@angular/core';
2
+ import { FilterFieldDirective } from '../../filter';
3
+
4
+ @Directive({
5
+ // eslint-disable-next-line @angular-eslint/directive-selector
6
+ selector: 'v-feature-list-filter-field',
7
+ })
8
+ export class FeatureListFilterFieldDirective extends FilterFieldDirective {}
@@ -0,0 +1,20 @@
1
+ import { Pipe, PipeTransform } from "@angular/core";
2
+ import { GenericFieldDefinition, GenericFieldType } from "@verisoft/ui-core";
3
+ import { FeatureListColumnDefinition } from "./feature-list-page.model";
4
+
5
+ @Pipe({
6
+ name: 'featureListColumn',
7
+ })
8
+ export class FeatureListFilterPipe<T> implements PipeTransform {
9
+ transform(value: FeatureListColumnDefinition<T>[] | undefined): GenericFieldDefinition[] | undefined {
10
+ if (!value){
11
+ return undefined;
12
+ }
13
+
14
+ return value.filter(x => x.filter).map((x, index) => ({
15
+ name: x.id,
16
+ label: typeof x.headerName === 'function'? x.headerName(x.id, index) : x.headerName ?? '',
17
+ type: x.type as GenericFieldType,
18
+ }));
19
+ }
20
+ }
@@ -0,0 +1,30 @@
1
+ import { Component } from '@angular/core';
2
+ import { ActivatedRoute } from '@angular/router';
3
+ import {
4
+ FEATURE_LIST_PAGE_CONFIG_PROPERTY,
5
+ FeatureListPageConfig,
6
+ } from './feature-list-page.model';
7
+ import { FeatureListComponent } from './feature-list.component';
8
+
9
+ @Component({
10
+ selector: 'v-feature-list-page',
11
+ imports: [FeatureListComponent],
12
+ template: `
13
+ <v-feature-list
14
+ [title]="config.title"
15
+ [tableName]="config.tableName"
16
+ [showAdd]="config.showAdd ?? true"
17
+ [showDownload]="config.showDownload ?? true"
18
+ [showDelete]="config.showDelete ?? true"
19
+ >
20
+ </v-feature-list>
21
+ `
22
+ })
23
+ export class FeatureListPageComponent {
24
+ config!: FeatureListPageConfig;
25
+
26
+ constructor(activatedRoute: ActivatedRoute) {
27
+ this.config =
28
+ activatedRoute.snapshot.data[FEATURE_LIST_PAGE_CONFIG_PROPERTY];
29
+ }
30
+ }
@@ -0,0 +1,42 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { Route } from '@angular/router';
3
+ import { ColumnDefinition, GenericFieldTypeType } from '@verisoft/ui-core';
4
+ import { FeatureListPageComponent } from './feature-list-page.component';
5
+
6
+ export interface FeatureListPageConfig {
7
+ title: string;
8
+ datasource: string;
9
+ tableName: string;
10
+ showAdd?: boolean;
11
+ showDownload?: boolean;
12
+ showDelete?: boolean;
13
+ }
14
+
15
+ export const FEATURE_LIST_PAGE_CONFIG_PROPERTY = 'feature_list_config';
16
+
17
+ export function addFeatureListPage(
18
+ value: Partial<Route> & { config: FeatureListPageConfig }
19
+ ): Route {
20
+ const { config, ...route } = value;
21
+ return {
22
+ component: FeatureListPageComponent,
23
+ ...route,
24
+ data: {
25
+ [FEATURE_LIST_PAGE_CONFIG_PROPERTY]: config,
26
+ ...(route.data ?? {}),
27
+ },
28
+ };
29
+ }
30
+
31
+ export interface FeatureListColumnDefinition<T> extends ColumnDefinition<T> {
32
+ filter?: boolean;
33
+ type?: GenericFieldTypeType;
34
+ }
35
+
36
+ export const FEATURE_LIST_COLUMN_PROVIDER = new InjectionToken(
37
+ 'FEATURE_LIST_COLUMN_PROVIDER'
38
+ );
39
+
40
+ export interface FeatureListColumnProvider<T> {
41
+ getDefinition: () => FeatureListColumnDefinition<T>;
42
+ }
@@ -0,0 +1,67 @@
1
+ <div class="feature-list__container full-height-container">
2
+ <v-filter
3
+ #filter
4
+ [title]="title"
5
+ [total]="tableTotal"
6
+ [recordsText]="recordsText"
7
+ [fields]="columns | featureListColumn"
8
+ [filters]="filters"
9
+ [fulltextFieldName]="fulltextFieldName"
10
+ [showFulltext]="showFulltext"
11
+ [showFilters]="showExtendedFilter"
12
+ [applyLabel]="applyLabel"
13
+ [clearLabel]="clearLabel"
14
+ [buttonType]="buttonType"
15
+ [buttonOutlined]="buttonOutlined"
16
+ >
17
+ <v-action-button-group
18
+ [maxItems]="maxVisibleActions"
19
+ [maxItemsMobile]="maxVisibleMobileActions"
20
+ >
21
+ @if (showAdd) {
22
+ <v-action-button
23
+ [icon]="icons.add"
24
+ label="Add"
25
+ [disabled]="!canAdd"
26
+ (click)="addClick.emit()"
27
+ />
28
+ } @if (showDelete){
29
+ <v-action-button
30
+ [icon]="icons.delete"
31
+ label="Delete"
32
+ [disabled]="!canDelete || !selection.length"
33
+ (click)="startDeleteItems()"
34
+ />
35
+ } @if (showDownload){
36
+ <v-action-button
37
+ [icon]="icons.download"
38
+ label="Download"
39
+ [disabled]="!canDownload"
40
+ (click)="startDownload()"
41
+ />
42
+ }
43
+ </v-action-button-group>
44
+ </v-filter>
45
+ <div class="feature-list__table-container full-height-container">
46
+ <div class="full-height-container">
47
+ <v-table
48
+ #table
49
+ useDatasource
50
+ useFilter
51
+ [filterComponent]="filter"
52
+ class="full-height-container"
53
+ [selectionMode]="selectionMode"
54
+ [tableName]="tableName"
55
+ [autoBind]="true"
56
+ [datasource]="datasource"
57
+ [columns]="columns"
58
+ [extraFilter]="extraFilter"
59
+ [maximumColumnLength]="maximumColumnLength"
60
+ [disableCustomClicks]="disableCustomClicks"
61
+ (selectionChange)="selectItems($event)"
62
+ >
63
+ <ng-content />
64
+ </v-table>
65
+ </div>
66
+ </div>
67
+ </div>
@@ -0,0 +1,10 @@
1
+ .full-height-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ flex-grow: 1;
5
+ height: 100%;
6
+ }
7
+
8
+ :host {
9
+ @extend .full-height-container;
10
+ }