@verisoft/ui-primeng 20.1.1 → 20.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/fesm2022/verisoft-ui-primeng.mjs +3005 -0
  2. package/fesm2022/verisoft-ui-primeng.mjs.map +1 -0
  3. package/index.d.ts +752 -0
  4. package/package.json +18 -6
  5. package/.eslintrc.json +0 -43
  6. package/assets/.gitkeep +0 -0
  7. package/jest.config.ts +0 -22
  8. package/ng-package.json +0 -14
  9. package/project.json +0 -36
  10. package/src/index.ts +0 -34
  11. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -11
  12. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -18
  13. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -21
  14. package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +0 -36
  15. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -27
  16. package/src/lib/components/breadcrumb/breadcrumb.pipe.ts +0 -13
  17. package/src/lib/components/breadcrumb/index.ts +0 -1
  18. package/src/lib/components/button/button-severity.pipe.ts +0 -20
  19. package/src/lib/components/button/button.component.html +0 -20
  20. package/src/lib/components/button/button.component.scss +0 -0
  21. package/src/lib/components/button/button.component.spec.ts +0 -21
  22. package/src/lib/components/button/button.component.ts +0 -49
  23. package/src/lib/components/button/index.ts +0 -1
  24. package/src/lib/components/calendar/calendar.component.html +0 -53
  25. package/src/lib/components/calendar/calendar.component.scss +0 -0
  26. package/src/lib/components/calendar/calendar.component.spec.ts +0 -21
  27. package/src/lib/components/calendar/calendar.component.ts +0 -70
  28. package/src/lib/components/calendar/index.ts +0 -1
  29. package/src/lib/components/checkbox/checkbox.component.html +0 -20
  30. package/src/lib/components/checkbox/checkbox.component.scss +0 -15
  31. package/src/lib/components/checkbox/checkbox.component.spec.ts +0 -21
  32. package/src/lib/components/checkbox/checkbox.component.stories.ts +0 -72
  33. package/src/lib/components/checkbox/checkbox.component.ts +0 -46
  34. package/src/lib/components/checkbox/index.ts +0 -1
  35. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +0 -51
  36. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +0 -3
  37. package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +0 -21
  38. package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +0 -74
  39. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +0 -73
  40. package/src/lib/components/confirm-dialog/index.ts +0 -1
  41. package/src/lib/components/dropdown/dropdown.component.html +0 -93
  42. package/src/lib/components/dropdown/dropdown.component.scss +0 -16
  43. package/src/lib/components/dropdown/dropdown.component.spec.ts +0 -21
  44. package/src/lib/components/dropdown/dropdown.component.ts +0 -139
  45. package/src/lib/components/dropdown/index.ts +0 -1
  46. package/src/lib/components/dropdown-button/dropdown-button.component.html +0 -1
  47. package/src/lib/components/dropdown-button/dropdown-button.component.ts +0 -20
  48. package/src/lib/components/dropdown-button/index.ts +0 -1
  49. package/src/lib/components/errors/error.component.html +0 -7
  50. package/src/lib/components/errors/error.component.scss +0 -3
  51. package/src/lib/components/errors/error.component.ts +0 -34
  52. package/src/lib/components/errors/index.ts +0 -1
  53. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +0 -32
  54. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +0 -8
  55. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +0 -21
  56. package/src/lib/components/feature-list/feature-list-page.component.ts +0 -32
  57. package/src/lib/components/feature-list/feature-list-page.model.ts +0 -42
  58. package/src/lib/components/feature-list/feature-list.component.html +0 -59
  59. package/src/lib/components/feature-list/feature-list.component.scss +0 -10
  60. package/src/lib/components/feature-list/feature-list.component.ts +0 -341
  61. package/src/lib/components/feature-list/index.ts +0 -5
  62. package/src/lib/components/filter/directives/filter-field.directive.ts +0 -34
  63. package/src/lib/components/filter/filter.component.html +0 -68
  64. package/src/lib/components/filter/filter.component.scss +0 -0
  65. package/src/lib/components/filter/filter.component.spec.ts +0 -21
  66. package/src/lib/components/filter/filter.component.stories.ts +0 -23
  67. package/src/lib/components/filter/filter.component.ts +0 -281
  68. package/src/lib/components/filter/filter.model.ts +0 -18
  69. package/src/lib/components/filter/index.ts +0 -2
  70. package/src/lib/components/form-field/form-field.component.html +0 -42
  71. package/src/lib/components/form-field/form-field.component.scss +0 -0
  72. package/src/lib/components/form-field/form-field.component.spec.ts +0 -21
  73. package/src/lib/components/form-field/form-field.component.stories.ts +0 -69
  74. package/src/lib/components/form-field/form-field.component.ts +0 -37
  75. package/src/lib/components/form-field/index.ts +0 -1
  76. package/src/lib/components/header/header.component.html +0 -84
  77. package/src/lib/components/header/header.component.scss +0 -0
  78. package/src/lib/components/header/header.component.spec.ts +0 -21
  79. package/src/lib/components/header/header.component.stories.ts +0 -24
  80. package/src/lib/components/header/header.component.ts +0 -65
  81. package/src/lib/components/header/index.ts +0 -2
  82. package/src/lib/components/header/services/header-provider.service.ts +0 -15
  83. package/src/lib/components/icon/icon.component.html +0 -2
  84. package/src/lib/components/icon/icon.component.scss +0 -51
  85. package/src/lib/components/icon/icon.component.ts +0 -86
  86. package/src/lib/components/icon/index.ts +0 -2
  87. package/src/lib/components/input-group/index.ts +0 -1
  88. package/src/lib/components/input-group/input-group.component.html +0 -34
  89. package/src/lib/components/input-group/input-group.component.spec.ts +0 -21
  90. package/src/lib/components/input-group/input-group.component.ts +0 -58
  91. package/src/lib/components/loader/index.ts +0 -1
  92. package/src/lib/components/loader/loader.component.html +0 -5
  93. package/src/lib/components/loader/loader.component.scss +0 -0
  94. package/src/lib/components/loader/loader.component.spec.ts +0 -21
  95. package/src/lib/components/loader/loader.component.ts +0 -16
  96. package/src/lib/components/multiselect/index.ts +0 -1
  97. package/src/lib/components/multiselect/multiselect.component.html +0 -67
  98. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  99. package/src/lib/components/multiselect/multiselect.component.spec.ts +0 -21
  100. package/src/lib/components/multiselect/multiselect.component.ts +0 -120
  101. package/src/lib/components/number-input/index.ts +0 -1
  102. package/src/lib/components/number-input/number-input.component.html +0 -22
  103. package/src/lib/components/number-input/number-input.component.spec.ts +0 -21
  104. package/src/lib/components/number-input/number-input.component.ts +0 -55
  105. package/src/lib/components/page-header/index.ts +0 -1
  106. package/src/lib/components/page-header/page-header.component.html +0 -35
  107. package/src/lib/components/page-header/page-header.component.scss +0 -0
  108. package/src/lib/components/page-header/page-header.component.spec.ts +0 -21
  109. package/src/lib/components/page-header/page-header.component.ts +0 -31
  110. package/src/lib/components/password/index.ts +0 -1
  111. package/src/lib/components/password/password.component.html +0 -24
  112. package/src/lib/components/password/password.component.scss +0 -0
  113. package/src/lib/components/password/password.component.spec.ts +0 -21
  114. package/src/lib/components/password/password.component.ts +0 -56
  115. package/src/lib/components/radiobutton/index.ts +0 -1
  116. package/src/lib/components/radiobutton/radiobutton.component.html +0 -34
  117. package/src/lib/components/radiobutton/radiobutton.component.scss +0 -6
  118. package/src/lib/components/radiobutton/radiobutton.component.spec.ts +0 -21
  119. package/src/lib/components/radiobutton/radiobutton.component.stories.ts +0 -71
  120. package/src/lib/components/radiobutton/radiobutton.component.ts +0 -61
  121. package/src/lib/components/section/index.ts +0 -1
  122. package/src/lib/components/section/section.component.html +0 -25
  123. package/src/lib/components/section/section.component.scss +0 -0
  124. package/src/lib/components/section/section.component.spec.ts +0 -21
  125. package/src/lib/components/section/section.component.ts +0 -31
  126. package/src/lib/components/shared-components/.eslintrc.json +0 -42
  127. package/src/lib/components/shared-components/action-button-group/action-button-group.component.html +0 -25
  128. package/src/lib/components/shared-components/action-button-group/action-button-group.component.scss +0 -0
  129. package/src/lib/components/shared-components/action-button-group/action-button-group.component.spec.ts +0 -21
  130. package/src/lib/components/shared-components/action-button-group/action-button-group.component.ts +0 -111
  131. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.html +0 -10
  132. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.scss +0 -0
  133. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.spec.ts +0 -21
  134. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +0 -69
  135. package/src/lib/components/shared-components/action-button-group/index.ts +0 -2
  136. package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +0 -142
  137. package/src/lib/components/shared-components/dynamic-component/dynamic-component.component.ts +0 -56
  138. package/src/lib/components/shared-components/dynamic-component/index.ts +0 -2
  139. package/src/lib/components/shared-components/generic-field/generic-field.component.html +0 -98
  140. package/src/lib/components/shared-components/generic-field/generic-field.component.spec.ts +0 -21
  141. package/src/lib/components/shared-components/generic-field/generic-field.component.ts +0 -90
  142. package/src/lib/components/shared-components/generic-field/index.ts +0 -1
  143. package/src/lib/components/shared-components/generic-form/generic-form.component.html +0 -46
  144. package/src/lib/components/shared-components/generic-form/generic-form.component.spec.ts +0 -21
  145. package/src/lib/components/shared-components/generic-form/generic-form.component.ts +0 -56
  146. package/src/lib/components/shared-components/generic-form/generic-form.model.spec.ts +0 -82
  147. package/src/lib/components/shared-components/generic-form/generic-form.model.ts +0 -68
  148. package/src/lib/components/shared-components/generic-form/index.ts +0 -2
  149. package/src/lib/components/shared-components/index.ts +0 -4
  150. package/src/lib/components/side-menu/index.ts +0 -2
  151. package/src/lib/components/side-menu/side-menu.component.html +0 -53
  152. package/src/lib/components/side-menu/side-menu.component.scss +0 -0
  153. package/src/lib/components/side-menu/side-menu.component.spec.ts +0 -21
  154. package/src/lib/components/side-menu/side-menu.component.ts +0 -96
  155. package/src/lib/components/side-menu/side-menu.module.ts +0 -66
  156. package/src/lib/components/slider/index.ts +0 -1
  157. package/src/lib/components/slider/slider.component.html +0 -19
  158. package/src/lib/components/slider/slider.component.spec.ts +0 -21
  159. package/src/lib/components/slider/slider.component.ts +0 -56
  160. package/src/lib/components/snackbar/index.ts +0 -2
  161. package/src/lib/components/snackbar/services/snackbar.service.ts +0 -45
  162. package/src/lib/components/snackbar/snackbar.component.html +0 -3
  163. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  164. package/src/lib/components/snackbar/snackbar.component.spec.ts +0 -21
  165. package/src/lib/components/snackbar/snackbar.component.stories.ts +0 -70
  166. package/src/lib/components/snackbar/snackbar.component.ts +0 -25
  167. package/src/lib/components/stepper/index.ts +0 -1
  168. package/src/lib/components/stepper/stepper.component.html +0 -35
  169. package/src/lib/components/stepper/stepper.component.spec.ts +0 -21
  170. package/src/lib/components/stepper/stepper.component.ts +0 -39
  171. package/src/lib/components/switch/index.ts +0 -1
  172. package/src/lib/components/switch/switch.component.html +0 -18
  173. package/src/lib/components/switch/switch.component.scss +0 -0
  174. package/src/lib/components/switch/switch.component.spec.ts +0 -21
  175. package/src/lib/components/switch/switch.component.stories.ts +0 -65
  176. package/src/lib/components/switch/switch.component.ts +0 -52
  177. package/src/lib/components/tab-view/index.ts +0 -2
  178. package/src/lib/components/tab-view/tab-view-item.component.ts +0 -22
  179. package/src/lib/components/tab-view/tab-view.component.html +0 -41
  180. package/src/lib/components/tab-view/tab-view.component.ts +0 -55
  181. package/src/lib/components/table/index.ts +0 -1
  182. package/src/lib/components/table/table-filter.pipe.ts +0 -59
  183. package/src/lib/components/table/table.component.html +0 -127
  184. package/src/lib/components/table/table.component.scss +0 -11
  185. package/src/lib/components/table/table.component.spec.ts +0 -21
  186. package/src/lib/components/table/table.component.stories.ts +0 -55
  187. package/src/lib/components/table/table.component.ts +0 -288
  188. package/src/lib/components/table/table.models.ts +0 -26
  189. package/src/lib/components/tag/index.ts +0 -2
  190. package/src/lib/components/tag/tag.component.html +0 -12
  191. package/src/lib/components/tag/tag.component.scss +0 -33
  192. package/src/lib/components/tag/tag.component.ts +0 -83
  193. package/src/lib/components/textarea/index.ts +0 -1
  194. package/src/lib/components/textarea/textarea.component.html +0 -40
  195. package/src/lib/components/textarea/textarea.component.scss +0 -5
  196. package/src/lib/components/textarea/textarea.component.spec.ts +0 -21
  197. package/src/lib/components/textarea/textarea.component.stories.ts +0 -98
  198. package/src/lib/components/textarea/textarea.component.ts +0 -62
  199. package/src/lib/components/textfield/index.ts +0 -1
  200. package/src/lib/components/textfield/textfield.component.html +0 -82
  201. package/src/lib/components/textfield/textfield.component.scss +0 -23
  202. package/src/lib/components/textfield/textfield.component.spec.ts +0 -21
  203. package/src/lib/components/textfield/textfield.component.stories.ts +0 -85
  204. package/src/lib/components/textfield/textfield.component.ts +0 -68
  205. package/src/lib/components/tooltip/index.ts +0 -1
  206. package/src/lib/components/tooltip/tooltip.component.html +0 -3
  207. package/src/lib/components/tooltip/tooltip.component.ts +0 -17
  208. package/src/lib/icons.ts +0 -36
  209. package/src/lib/interceptors/http-error-message.interceptor.ts +0 -35
  210. package/src/lib/pages/not-found-page/not-found-page.component.html +0 -26
  211. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  212. package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +0 -21
  213. package/src/lib/pages/not-found-page/not-found-page.component.ts +0 -16
  214. package/src/tab-view.ts +0 -1
  215. package/src/test-setup.ts +0 -8
  216. package/tsconfig.json +0 -29
  217. package/tsconfig.lib.json +0 -18
  218. package/tsconfig.lib.prod.json +0 -9
  219. package/tsconfig.spec.json +0 -16
@@ -1,34 +0,0 @@
1
- import { CommonModule } from "@angular/common";
2
- import { Component, inject, Input, } from "@angular/core";
3
- import { NgControl, ValidationErrors } from "@angular/forms";
4
- import { ERROR_PROVIDER_TOKEN } from "@verisoft/core";
5
- import { SlotPosition, SlotPositionType } from "@verisoft/ui-core";
6
- import { MessageModule } from "primeng/message";
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, MessageModule]
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
- @Input() variant = 'simple';
24
-
25
- @Input() severity = 'error';
26
-
27
- readonly errorService = inject(ERROR_PROVIDER_TOKEN);
28
-
29
- icons = Icons
30
-
31
- getErrorMessage(errors: ValidationErrors): Observable<string | undefined> {
32
- return this.errorService.mapError(errors);
33
- }
34
- }
@@ -1 +0,0 @@
1
- export * from './error.component';
@@ -1,32 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
1
- import { Directive } from '@angular/core';
2
- import { FilterFieldDirective } from '../../filter';
3
- @Directive({
4
- // eslint-disable-next-line @angular-eslint/directive-selector
5
- selector: 'v-feature-list-filter-field',
6
- standalone: true,
7
- })
8
- export class FeatureListFilterFieldDirective extends FilterFieldDirective {}
@@ -1,21 +0,0 @@
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
- standalone: true,
8
- })
9
- export class FeatureListFilterPipe<T> implements PipeTransform {
10
- transform(value: FeatureListColumnDefinition<T>[] | undefined): GenericFieldDefinition[] | undefined {
11
- if (!value){
12
- return undefined;
13
- }
14
-
15
- return value.filter(x => x.filter).map((x, index) => ({
16
- name: x.id,
17
- label: typeof x.headerName === 'function'? x.headerName(x.id, index) : x.headerName ?? '',
18
- type: x.type as GenericFieldType,
19
- }));
20
- }
21
- }
@@ -1,32 +0,0 @@
1
- import { Component, inject } 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
- private readonly activatedRoute = inject(ActivatedRoute);
27
-
28
- constructor() {
29
- this.config =
30
- this.activatedRoute.snapshot.data[FEATURE_LIST_PAGE_CONFIG_PROPERTY];
31
- }
32
- }
@@ -1,42 +0,0 @@
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
- }
@@ -1,59 +0,0 @@
1
- <div class="feature-list__container full-height-container">
2
- <v-filter
3
- #filter
4
- [title]="title"
5
- [fields]="columns | featureListColumn"
6
- [filters]="filters"
7
- [fulltextFieldName]="fulltextFieldName"
8
- [showFulltext]="showFulltext"
9
- [showFilters]="showExtendedFilter"
10
- >
11
- <v-action-button-group
12
- [maxItems]="maxVisibleActions"
13
- [maxItemsMobile]="maxVisibleMobileActions"
14
- >
15
- @if (showAdd) {
16
- <v-action-button
17
- [icon]="icons.add"
18
- label="Add"
19
- [disabled]="!canAdd"
20
- (click)="addClick.emit()"
21
- ></v-action-button>
22
- } @if (showDelete){
23
- <v-action-button
24
- [icon]="icons.delete"
25
- label="Delete"
26
- [disabled]="!canDelete || !selection.length"
27
- (click)="startDeleteItems()"
28
- ></v-action-button>
29
- } @if (showDownload){
30
- <v-action-button
31
- [icon]="icons.download"
32
- label="Download"
33
- [disabled]="!canDownload"
34
- (click)="startDownload()"
35
- ></v-action-button>
36
- }
37
- </v-action-button-group>
38
- </v-filter>
39
- <div class="feature-list__table-container full-height-container">
40
- <div class="full-height-container">
41
- <v-table
42
- useDatasource
43
- useFilter
44
- [filterComponent]="filter"
45
- class="full-height-container"
46
- [selectionMode]="selectionMode"
47
- [tableName]="tableName"
48
- [autoBind]="true"
49
- [datasource]="datasource"
50
- [columns]="columns"
51
- [extraFilter]="extraFilter"
52
- [maximumColumnLength]="maximumColumnLength"
53
- [disableCustomClicks]="disableCustomClicks"
54
- (selectionChange)="selectItems($event)"
55
- >
56
- </v-table>
57
- </div>
58
- </div>
59
- </div>
@@ -1,10 +0,0 @@
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
- }
@@ -1,341 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import {
3
- AfterViewInit,
4
- ChangeDetectionStrategy,
5
- ChangeDetectorRef,
6
- Component,
7
- ContentChildren,
8
- EventEmitter,
9
- inject,
10
- Input,
11
- Output,
12
- QueryList,
13
- ViewChild,
14
- } from '@angular/core';
15
- import {
16
- AllDataRequestParams,
17
- BASE_URL_PATH,
18
- BaseHttpService,
19
- convertDatasource,
20
- DatasourceType,
21
- DEFAULT_PAGE_SIZE,
22
- } from '@verisoft/core';
23
- import {
24
- ColumnModel,
25
- DialogService,
26
- downloadFile,
27
- GenericFieldDefinition,
28
- MAX_COLUMN_CHAR_COUNT,
29
- TableDatasourceDirective,
30
- TableFilterDirective,
31
- TableSelectionMode,
32
- TableSelectionModeType,
33
- } from '@verisoft/ui-core';
34
- import { take, switchMap, forkJoin, Observable, of } from 'rxjs';
35
- import { Icons } from '../../icons';
36
- import { FilterComponent } from '../filter';
37
- import {
38
- ActionButtonComponent,
39
- ActionButtonGroupComponent,
40
- } from '../shared-components/action-button-group';
41
- import { TableComponent } from '../table';
42
- import { FeatureListFilterFieldDirective } from './directives/feature-list-filter-field.directive';
43
- import { FeatureListFilterPipe } from './feature-list-filter.pipe';
44
- import {
45
- FEATURE_LIST_COLUMN_PROVIDER,
46
- FeatureListColumnDefinition,
47
- FeatureListColumnProvider,
48
- } from './feature-list-page.model';
49
-
50
- @Component({
51
- selector: 'v-feature-list',
52
- imports: [
53
- TableComponent,
54
- TableDatasourceDirective,
55
- FilterComponent,
56
- TableFilterDirective,
57
- ActionButtonGroupComponent,
58
- ActionButtonComponent,
59
- FeatureListFilterPipe,
60
- ],
61
- templateUrl: './feature-list.component.html',
62
- styleUrls: ['./feature-list.component.scss'],
63
- changeDetection: ChangeDetectionStrategy.OnPush
64
- })
65
- export class FeatureListComponent<T> implements AfterViewInit {
66
- @ContentChildren(FEATURE_LIST_COLUMN_PROVIDER) viewColumns!: QueryList<
67
- FeatureListColumnProvider<T>
68
- >;
69
-
70
- @ContentChildren(FeatureListFilterFieldDirective)
71
- fieldDeclarations!: QueryList<FeatureListFilterFieldDirective>;
72
-
73
- @ViewChild(TableDatasourceDirective)
74
- tableDatasourceDirective!: TableDatasourceDirective<T>;
75
-
76
- @Input() autoBind = true;
77
-
78
- @Input() title!: string;
79
-
80
- @Input() columns!: FeatureListColumnDefinition<T>[];
81
-
82
- @Input() filters!: GenericFieldDefinition[];
83
-
84
- @Input() maxVisibleActions = 2;
85
-
86
- @Input({ required: true }) tableName!: string;
87
-
88
- @Input() ngrxFeatureKey?: string;
89
-
90
- @Input() maxVisibleMobileActions = 0;
91
-
92
- @Input() showExtendedFilter = false;
93
-
94
- @Input() showDownload = false;
95
-
96
- @Input() showDelete = false;
97
-
98
- @Input() showAdd = false;
99
-
100
- @Input() canDownload = true;
101
-
102
- @Input() canDelete = true;
103
-
104
- @Input() canAdd = true;
105
-
106
- @Input() useRouterFilter = true;
107
-
108
- @Input() fulltextFieldName = 'searchField';
109
-
110
- @Input() showFulltext = true;
111
-
112
- @Input() deleteConfirmMessage: string | undefined;
113
-
114
- @Input() autoDeleteEnabled = true;
115
-
116
- @Input() autoDownloadEnabled = true;
117
-
118
- @Input() downloadFileName = 'export.csv';
119
-
120
- @Input() datasource!: DatasourceType<T>;
121
-
122
- @Input() extraFilter: Partial<T> | undefined;
123
-
124
- @Input() disableCustomClicks = false;
125
-
126
- @Input() maximumColumnLength = MAX_COLUMN_CHAR_COUNT;
127
-
128
- @Output() addClick = new EventEmitter();
129
-
130
- @Output() downloadClick = new EventEmitter();
131
-
132
- @Output() deleteClick = new EventEmitter<T[]>();
133
-
134
- @Output() selectionChange = new EventEmitter();
135
-
136
- @Input() set selectionMode(mode: TableSelectionModeType | undefined) {
137
- this._selectionMode = mode;
138
- }
139
-
140
- get selectionMode(): TableSelectionModeType | undefined {
141
- return this.canDelete
142
- ? TableSelectionMode.single
143
- : this._selectionMode;
144
- }
145
-
146
- icons = Icons;
147
-
148
- private httpClient = inject(HttpClient);
149
-
150
- private baseUrl: string = inject(BASE_URL_PATH);
151
-
152
- private _selectionMode: TableSelectionModeType | undefined;
153
-
154
- private cdRef = inject(ChangeDetectorRef);
155
-
156
- private dialogService = inject(DialogService);
157
-
158
- selection: T[] = [];
159
-
160
- ngAfterViewInit(): void {
161
- if (this.viewColumns?.length) {
162
- const vewColumns = this.viewColumns
163
- ?.toArray()
164
- .map((x) => x.getDefinition());
165
- this.columns = [...(this.columns ?? []), ...(vewColumns ?? [])];
166
- this.cdRef.detectChanges();
167
- }
168
-
169
- if (this.fieldDeclarations?.length) {
170
- this.filters = this.fieldDeclarations?.toArray();
171
- }
172
-
173
- this.cdRef.detectChanges();
174
- }
175
-
176
- selectItems(items: T[]) {
177
- this.selection = items ?? [];
178
-
179
- if (this.selectionMode !== undefined) {
180
- this.selectionChange.emit(
181
- this.selectionMode === 'multiple'
182
- ? this.selection
183
- : this.selection[0]
184
- );
185
- }
186
- }
187
-
188
- startDeleteItems() {
189
- if (!this.selection.length) {
190
- return;
191
- }
192
-
193
- if (this.deleteConfirmMessage) {
194
- const message = this.deleteConfirmMessage;
195
- this.dialogService.showDialog({
196
- innerHTML: message,
197
- confirmButtonFn: () => this.deleteItems(this.selection),
198
- });
199
- } else {
200
- this.deleteItems(this.selection);
201
- }
202
- }
203
-
204
- startDownload() {
205
- this.downloadClick.emit();
206
- if (!this.autoDownloadEnabled) {
207
- return;
208
- }
209
-
210
- const dowloadFn = this.createDownloadFn(this.datasource);
211
- if (dowloadFn) {
212
- this.tableDatasourceDirective.params$
213
- .pipe(
214
- take(1),
215
- switchMap((params) => dowloadFn(params))
216
- )
217
- .subscribe((blob) => {
218
- downloadFile(this.downloadFileName, blob);
219
- });
220
- }
221
- }
222
-
223
- private deleteItems(items: T[]) {
224
- if (!this.autoDeleteEnabled) {
225
- this.deleteClick.emit(items);
226
- } else {
227
- this.forceDelete(items);
228
- }
229
- }
230
-
231
- private forceDelete(items: T[]) {
232
- const deleteFn = this.createDeleteFn(this.datasource);
233
- if (deleteFn) {
234
- const deleteMethods = items.map((x) => deleteFn(x));
235
- forkJoin(deleteMethods)
236
- .pipe(take(1))
237
- .subscribe(() => this.finishDeletion(items));
238
- } else {
239
- this.finishDeletion(items);
240
- }
241
- }
242
-
243
- private createDeleteFn(
244
- datasource: DatasourceType<T>
245
- ): ((item: T) => Observable<unknown>) | undefined {
246
- if (!datasource) {
247
- return undefined;
248
- }
249
-
250
- if (typeof datasource === 'string') {
251
- const service = new BaseHttpService<T>(
252
- this.httpClient,
253
- this.baseUrl,
254
- datasource
255
- );
256
-
257
- return (item: T) => service.delete((item as { id: string }).id);
258
- }
259
-
260
- if (datasource instanceof BaseHttpService) {
261
- return (item: T) => datasource.delete((item as { id: string }).id);
262
- }
263
-
264
- return undefined;
265
- }
266
-
267
- private createDownloadFn(
268
- datasource: DatasourceType<T>
269
- ): ((request: AllDataRequestParams<T>) => Observable<Blob>) | undefined {
270
- if (!datasource) {
271
- return undefined;
272
- }
273
-
274
- if (typeof datasource === 'string') {
275
- const service = new BaseHttpService<T>(
276
- this.httpClient,
277
- this.baseUrl,
278
- datasource
279
- );
280
-
281
- return (request: AllDataRequestParams<T>) => service.export(request);
282
- }
283
-
284
- if (datasource instanceof BaseHttpService) {
285
- return (request: AllDataRequestParams<T>) => datasource.export(request);
286
- }
287
-
288
- const fetchFunction = convertDatasource(
289
- datasource,
290
- this.baseUrl,
291
- this.httpClient
292
- );
293
-
294
- return (request: AllDataRequestParams<T>) => {
295
- const allData: T[] = [];
296
- let offset = 0;
297
- const fetchAllData = (): Observable<Blob> => {
298
- return fetchFunction({
299
- ...request,
300
- offset,
301
- limit: DEFAULT_PAGE_SIZE,
302
- }).pipe(
303
- take(1),
304
- switchMap((response) => {
305
- allData.push(...response.data);
306
- if (allData.length < response.total) {
307
- offset = offset + DEFAULT_PAGE_SIZE;
308
- return fetchAllData();
309
- } else {
310
- return of(this.convertToBlob(allData));
311
- }
312
- })
313
- );
314
- };
315
-
316
- return fetchAllData();
317
- };
318
- }
319
-
320
- private finishDeletion(items: T[]) {
321
- if (this.datasource && Array.isArray(this.datasource)) {
322
- this.datasource = this.datasource.filter((x) => !items.includes(x));
323
- } else {
324
- this.tableDatasourceDirective.reload();
325
- }
326
-
327
- this.deleteClick.emit(items);
328
- }
329
-
330
- private convertToBlob(data: T[]): Blob {
331
- const columnModel = this.columns.map((x) => new ColumnModel(x));
332
- const headers = columnModel.map((x, index) => x.headerGetter(x.id, index));
333
- const dataValues = data.map((row, rowIndex) =>
334
- columnModel.map((column) => column.valueGetter(row, rowIndex))
335
- );
336
- const csvData = [headers, ...dataValues]
337
- .map((row) => row.join(','))
338
- .join('\n');
339
- return new Blob([csvData], { type: 'text/csv' });
340
- }
341
- }
@@ -1,5 +0,0 @@
1
- export * from './feature-list.component';
2
- export * from './feature-list-page.model';
3
- export * from './directives/feature-list-column.directive';
4
- export * from './directives/feature-list-filter-field.directive';
5
- export * from './feature-list-filter.pipe';
@@ -1,34 +0,0 @@
1
- import { Directive, Input } from '@angular/core';
2
- import { ValidatorFn } from '@angular/forms';
3
- import { DatasourceType } from '@verisoft/core';
4
- import { GenericFieldDefinition, GenericFieldType, GenericFieldTypeType } from '@verisoft/ui-core';
5
-
6
- @Directive({
7
- // eslint-disable-next-line @angular-eslint/directive-selector
8
- selector: 'v-filter-field',
9
- })
10
- export class FilterFieldDirective implements GenericFieldDefinition {
11
- @Input({ required: true }) name!: string;
12
-
13
- @Input() type: GenericFieldTypeType | undefined = GenericFieldType.text;
14
-
15
- @Input() label: string | undefined;
16
-
17
- @Input() optionLabel!: string;
18
-
19
- @Input() optionValue: string | undefined;
20
-
21
- @Input() options: unknown[] | undefined;
22
-
23
- @Input() value?: unknown;
24
-
25
- @Input() validator?: ValidatorFn[];
26
-
27
- @Input() datasource: DatasourceType<any> | undefined;
28
-
29
- @Input() filterField?: string;
30
-
31
- @Input() showFilter?: boolean;
32
-
33
- @Input() localSearch?: boolean;
34
- }
@@ -1,68 +0,0 @@
1
- <div class="v-filter w-100 p-3 bg-primary">
2
- @if (formGroup$ | async; as formGroup){
3
- <form [formGroup]="formGroup" class="d-flex align-items-center">
4
- @if (title) {
5
- <div class="v-filter_title pe-4">
6
- <h2 class="text-white m-0">{{ title }}</h2>
7
- </div>
8
- }
9
- <div class="v-filter__fulltext flex-grow-1 pe-4">
10
- @if (showFulltext){
11
- <v-textfield
12
- class="d-none d-lg-block"
13
- placeholder="Search"
14
- size="large"
15
- formControlName="searchField"
16
- type="search"
17
- [clearable]="true"
18
- >
19
- </v-textfield>
20
- }
21
- </div>
22
- @if (simpleFormFieldDefinitions$ | async; as declaration){
23
- @if (showFilters)
24
- {
25
- <div class="v-filter_filters d-none d-sm-block me-2">
26
- <v-generic-form
27
- [fields]="declaration"
28
- [formGroup]="formGroup"
29
- ></v-generic-form>
30
- <v-button label="X" class="mt-3" (click)="clear()" />
31
- </div>
32
- }
33
- <div class="v-filter_action-buttons d-flex">
34
- @if (declaration.length && !showFilters) {
35
- <v-button
36
- class="me-4"
37
- [icon]="icons.filter"
38
- [label]="$any(filledFiltersCount$ | async)"
39
- (click)="openFilter()"
40
- />
41
- } @if (!autoBind) {
42
- <v-button
43
- useShortCut
44
- [shortCutFn]="submitValue.bind(this)"
45
- shortCutKey="Enter"
46
- class="text-white mx-2"
47
- [outlined]="true"
48
- size="small"
49
- label="Apply"
50
- (click)="submitValue()"
51
- ></v-button>
52
- <v-button
53
- useShortCut
54
- [shortCutFn]="clear.bind(this)"
55
- shortCutKey="Escape"
56
- class="text-white"
57
- [outlined]="true"
58
- size="small"
59
- label="Clear"
60
- (click)="clear()"
61
- ></v-button>
62
- }
63
- </div>
64
- }
65
- <ng-content select="v-action-button-group"></ng-content>
66
- </form>
67
- }
68
- </div>