@verisoft/ui-primeng 18.0.0 → 18.3.1

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 (157) hide show
  1. package/{src/assets → assets}/sass/base/_typography.scss +2 -2
  2. package/assets/sass/layout/_button.scss +57 -0
  3. package/{src/assets → assets}/sass/layout/_sidemenu.scss +1 -15
  4. package/package.json +5 -4
  5. package/src/index.ts +2 -4
  6. package/src/lib/components/breadcrumb/breadcrumb.component.html +2 -2
  7. package/src/lib/components/breadcrumb/breadcrumb.component.ts +6 -1
  8. package/src/lib/components/breadcrumb/breadcrumb.pipe.ts +13 -0
  9. package/src/lib/components/button/button.component.html +2 -2
  10. package/src/lib/components/button/button.component.ts +7 -1
  11. package/src/lib/components/button/index.ts +0 -1
  12. package/src/lib/components/calendar/calendar.component.html +2 -2
  13. package/src/lib/components/calendar/calendar.component.ts +7 -2
  14. package/src/lib/components/checkbox/checkbox.component.html +1 -1
  15. package/src/lib/components/checkbox/checkbox.component.ts +5 -1
  16. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +3 -3
  17. package/src/lib/components/confirm-dialog/index.ts +0 -1
  18. package/src/lib/components/dropdown/dropdown.component.html +1 -1
  19. package/src/lib/components/dropdown/dropdown.component.ts +8 -3
  20. package/src/lib/components/errors/error.component.html +6 -0
  21. package/src/lib/components/errors/error.component.scss +3 -0
  22. package/src/lib/components/errors/error.component.ts +35 -0
  23. package/src/lib/components/errors/index.ts +1 -0
  24. package/src/lib/components/form-field/form-field.component.html +3 -8
  25. package/src/lib/components/form-field/form-field.component.ts +17 -13
  26. package/src/lib/components/header/header.component.html +2 -3
  27. package/src/lib/components/header/header.component.ts +3 -1
  28. package/src/lib/components/header/services/header-provider.service.ts +1 -1
  29. package/src/lib/components/input-group/input-group.component.html +1 -3
  30. package/src/lib/components/multiselect/multiselect.component.html +2 -1
  31. package/src/lib/components/multiselect/multiselect.component.ts +5 -3
  32. package/src/lib/components/number-input/number-input.component.html +1 -1
  33. package/src/lib/components/number-input/number-input.component.ts +3 -0
  34. package/src/lib/components/page-header/index.ts +0 -1
  35. package/src/lib/components/page-header/page-header.component.html +1 -1
  36. package/src/lib/components/page-header/page-header.component.ts +6 -34
  37. package/src/lib/components/password/password.component.html +1 -1
  38. package/src/lib/components/password/password.component.ts +3 -1
  39. package/src/lib/components/radiobutton/radiobutton.component.html +1 -1
  40. package/src/lib/components/radiobutton/radiobutton.component.ts +2 -0
  41. package/src/lib/components/section/section.component.html +1 -2
  42. package/src/lib/components/section/section.component.ts +4 -2
  43. package/src/lib/components/{action-button-group → shared-components/action-button-group}/action-button-group.component.html +2 -4
  44. package/src/lib/components/{action-button-group → shared-components/action-button-group}/action-button-group.component.ts +21 -11
  45. package/src/lib/components/{action-button-group → shared-components/action-button-group}/components/action-button/action-button.component.html +1 -2
  46. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +71 -0
  47. package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +142 -0
  48. package/src/lib/components/{dynamic-component → shared-components/dynamic-component}/dynamic-component.component.ts +5 -4
  49. package/src/lib/components/shared-components/dynamic-component/index.ts +2 -0
  50. package/src/lib/components/shared-components/feature-list/directives/feature-list-column.directive.ts +32 -0
  51. package/src/lib/components/shared-components/feature-list/directives/feature-list-filter-field.directive.ts +8 -0
  52. package/src/lib/components/shared-components/feature-list/feature-list-filter.pipe.ts +21 -0
  53. package/src/lib/components/shared-components/feature-list/feature-list-page.component.ts +31 -0
  54. package/src/lib/components/shared-components/feature-list/feature-list-page.model.ts +42 -0
  55. package/src/lib/components/shared-components/feature-list/feature-list.component.html +59 -0
  56. package/src/lib/components/shared-components/feature-list/feature-list.component.scss +10 -0
  57. package/src/lib/components/shared-components/feature-list/feature-list.component.ts +342 -0
  58. package/src/lib/components/shared-components/feature-list/index.ts +5 -0
  59. package/src/lib/components/shared-components/filter/directives/filter-field.directive.ts +35 -0
  60. package/src/lib/components/{filter → shared-components/filter}/filter.component.html +8 -7
  61. package/src/lib/components/{filter → shared-components/filter}/filter.component.ts +53 -26
  62. package/src/lib/components/shared-components/filter/filter.model.ts +18 -0
  63. package/src/lib/components/{filter → shared-components/filter}/index.ts +0 -1
  64. package/src/lib/components/shared-components/generic-field/generic-field.component.html +97 -0
  65. package/src/lib/components/{generic-field → shared-components/generic-field}/generic-field.component.ts +28 -10
  66. package/src/lib/components/{generic-field → shared-components/generic-field}/index.ts +0 -1
  67. package/src/lib/components/shared-components/generic-form/generic-form.component.html +46 -0
  68. package/src/lib/components/{generic-form → shared-components/generic-form}/generic-form.component.ts +11 -2
  69. package/src/lib/components/{generic-form → shared-components/generic-form}/generic-form.model.ts +11 -19
  70. package/src/lib/components/shared-components/index.ts +6 -0
  71. package/src/lib/components/side-menu/side-menu.component.html +7 -10
  72. package/src/lib/components/side-menu/side-menu.component.ts +7 -6
  73. package/src/lib/components/slider/slider.component.html +2 -2
  74. package/src/lib/components/slider/slider.component.ts +2 -0
  75. package/src/lib/components/stepper/stepper.component.html +2 -2
  76. package/src/lib/components/stepper/stepper.component.ts +16 -1
  77. package/src/lib/components/switch/switch.component.html +1 -2
  78. package/src/lib/components/switch/switch.component.ts +2 -0
  79. package/src/lib/components/tab-view/tab-menu.pipe.ts +22 -0
  80. package/src/lib/components/tab-view/tab-view-item.component.ts +2 -0
  81. package/src/lib/components/tab-view/tab-view.component.html +2 -3
  82. package/src/lib/components/tab-view/tab-view.component.ts +4 -4
  83. package/src/lib/components/tab-view/tab-view.module.ts +2 -1
  84. package/src/lib/components/table/index.ts +0 -1
  85. package/src/lib/components/table/table-filter.pipe.ts +59 -0
  86. package/src/lib/components/table/table.component.html +120 -180
  87. package/src/lib/components/table/table.component.scss +11 -0
  88. package/src/lib/components/table/table.component.ts +131 -98
  89. package/src/lib/components/table/table.models.ts +26 -0
  90. package/src/lib/components/textarea/textarea.component.html +1 -1
  91. package/src/lib/components/textarea/textarea.component.ts +2 -0
  92. package/src/lib/components/textfield/textfield.component.html +1 -1
  93. package/src/lib/components/textfield/textfield.component.ts +6 -1
  94. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.html +2 -2
  95. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.ts +4 -0
  96. package/src/lib/icons.ts +36 -0
  97. package/src/lib/pages/not-found-page/not-found-page.component.html +1 -2
  98. package/src/assets/sass/layout/_button.scss +0 -57
  99. package/src/lib/components/action-button-group/components/action-button/action-button.component.ts +0 -36
  100. package/src/lib/components/button/directives/shortcut.directive.ts +0 -37
  101. package/src/lib/components/confirm-dialog/services/confirm-dialog.service.ts +0 -14
  102. package/src/lib/components/dynamic-component/dynamic-component-factory.service.ts +0 -90
  103. package/src/lib/components/filter/directives/filter-field.directive.ts +0 -25
  104. package/src/lib/components/filter/directives/table-filter.directive.ts +0 -22
  105. package/src/lib/components/filter/filter.model.ts +0 -18
  106. package/src/lib/components/generic-field/generic-field.component.html +0 -54
  107. package/src/lib/components/generic-field/generic-field.model.ts +0 -9
  108. package/src/lib/components/generic-form/generic-form.component.html +0 -33
  109. package/src/lib/components/page-header/services/page-header.service.ts +0 -9
  110. package/src/lib/components/table/directives/table-store.directive.ts +0 -61
  111. package/src/lib/components/table-filter/filter.component.html +0 -205
  112. package/src/lib/components/table-filter/filter.component.scss +0 -0
  113. package/src/lib/components/table-filter/filter.component.spec.ts +0 -21
  114. package/src/lib/components/table-filter/filter.component.stories.ts +0 -23
  115. package/src/lib/services/screen-size.service.ts +0 -25
  116. /package/{src/assets → assets}/.gitkeep +0 -0
  117. /package/{src/assets → assets}/fonts/orbitron-black.ttf +0 -0
  118. /package/{src/assets → assets}/fonts/orbitron-bold.otf +0 -0
  119. /package/{src/assets → assets}/icons/complex/v-logo.svg +0 -0
  120. /package/{src/assets → assets}/images/_global/elon.jpg +0 -0
  121. /package/{src/assets → assets}/images/_global/jara.png +0 -0
  122. /package/{src/assets → assets}/images/_global/logos/v-logo.webp +0 -0
  123. /package/{src/assets → assets}/sass/base/_scrollbar.scss +0 -0
  124. /package/{src/assets → assets}/sass/layout/_app.scss +0 -0
  125. /package/{src/assets → assets}/sass/layout/_checkbox.scss +0 -0
  126. /package/{src/assets → assets}/sass/layout/_dialog.scss +0 -0
  127. /package/{src/assets → assets}/sass/layout/_dropdown.scss +0 -0
  128. /package/{src/assets → assets}/sass/layout/_formField.scss +0 -0
  129. /package/{src/assets → assets}/sass/layout/_header.scss +0 -0
  130. /package/{src/assets → assets}/sass/layout/_icons.scss +0 -0
  131. /package/{src/assets → assets}/sass/layout/_inputSwitch.scss +0 -0
  132. /package/{src/assets → assets}/sass/layout/_layout.scss +0 -0
  133. /package/{src/assets → assets}/sass/layout/_loader.scss +0 -0
  134. /package/{src/assets → assets}/sass/layout/_radiobutton.scss +0 -0
  135. /package/{src/assets → assets}/sass/layout/_snackbar.scss +0 -0
  136. /package/{src/assets → assets}/sass/layout/_tables.scss +0 -0
  137. /package/{src/assets → assets}/sass/layout/_tree.scss +0 -0
  138. /package/{src/assets → assets}/sass/layout/_tristatecheckbox.scss +0 -0
  139. /package/{src/assets → assets}/sass/main.scss +0 -0
  140. /package/{src/assets → assets}/sass/themes/_verisoft_theme.scss +0 -0
  141. /package/{src/assets → assets}/sass/utils/_mixins.scss +0 -0
  142. /package/{src/assets → assets}/sass/utils/_utils.scss +0 -0
  143. /package/{src/assets → assets}/sass/utils/_variables.scss +0 -0
  144. /package/{src/assets → assets}/sass/vendors/_bootstrap.scss +0 -0
  145. /package/{src/assets → assets}/sass/vendors/_primeng.scss +0 -0
  146. /package/src/lib/components/{action-button-group → shared-components/action-button-group}/action-button-group.component.scss +0 -0
  147. /package/src/lib/components/{action-button-group → shared-components/action-button-group}/action-button-group.component.spec.ts +0 -0
  148. /package/src/lib/components/{action-button-group → shared-components/action-button-group}/components/action-button/action-button.component.scss +0 -0
  149. /package/src/lib/components/{action-button-group → shared-components/action-button-group}/components/action-button/action-button.component.spec.ts +0 -0
  150. /package/src/lib/components/{action-button-group → shared-components/action-button-group}/index.ts +0 -0
  151. /package/src/lib/components/{filter → shared-components/filter}/filter.component.scss +0 -0
  152. /package/src/lib/components/{filter → shared-components/filter}/filter.component.spec.ts +0 -0
  153. /package/src/lib/components/{filter → shared-components/filter}/filter.component.stories.ts +0 -0
  154. /package/src/lib/components/{generic-field → shared-components/generic-field}/generic-field.component.spec.ts +0 -0
  155. /package/src/lib/components/{generic-form → shared-components/generic-form}/generic-form.component.spec.ts +0 -0
  156. /package/src/lib/components/{generic-form → shared-components/generic-form}/generic-form.model.spec.ts +0 -0
  157. /package/src/lib/components/{generic-form → shared-components/generic-form}/index.ts +0 -0
@@ -10,27 +10,38 @@ import {
10
10
  inject,
11
11
  Input,
12
12
  OnChanges,
13
- OnInit,
14
13
  Output,
14
+ QueryList,
15
15
  SimpleChanges,
16
16
  TemplateRef,
17
+ ViewChild,
17
18
  ViewEncapsulation,
18
19
  } from '@angular/core';
19
20
  import { ActivatedRoute, Router, RouterModule } from '@angular/router';
20
- import { DEFAULT_SEARCH_LIMIT, Page, Sort } from '@verisoft/core';
21
+ import {
22
+ DEFAULT_SEARCH_LIMIT,
23
+ LazyLoadEvent,
24
+ Sort,
25
+ SortDirection,
26
+ SortDirectionType,
27
+ } from '@verisoft/core';
21
28
  import {
22
29
  ColumnDefinition,
23
30
  ColumnModel,
24
31
  ColumnProvider,
25
32
  RowModel,
26
33
  TABLE_COLUMN_PROVIDER,
34
+ TABLE_COMPONENT_TOKEN,
35
+ TableCore,
36
+ TableSelectionModeType,
27
37
  } from '@verisoft/ui-core';
28
38
  import { SortMeta } from 'primeng/api';
29
39
  import { ButtonModule } from 'primeng/button';
30
40
  import { RippleModule } from 'primeng/ripple';
31
- import { TableModule, TablePageEvent } from 'primeng/table';
32
- import { ScreenSizeService } from '../../services/screen-size.service';
33
- import { ActionButtonGroupComponent } from '../action-button-group';
41
+ import { Table, TableLazyLoadEvent, TableModule, TablePageEvent } from 'primeng/table';
42
+ import { Icons } from '../../icons';
43
+ import { TableFilterPipe } from './table-filter.pipe';
44
+ import { convertToFilter } from './table.models';
34
45
 
35
46
  @Component({
36
47
  selector: 'v-table',
@@ -41,20 +52,30 @@ import { ActionButtonGroupComponent } from '../action-button-group';
41
52
  RouterModule,
42
53
  ButtonModule,
43
54
  RippleModule,
55
+ TableFilterPipe,
56
+ ],
57
+ providers: [
58
+ {
59
+ provide: TABLE_COMPONENT_TOKEN,
60
+ useExisting: TableComponent,
61
+ },
44
62
  ],
45
63
  templateUrl: './table.component.html',
46
64
  styleUrl: './table.component.scss',
47
65
  encapsulation: ViewEncapsulation.None,
48
66
  changeDetection: ChangeDetectionStrategy.OnPush,
49
67
  })
50
- export class TableComponent<T> implements OnInit, AfterViewInit, OnChanges {
51
- @ContentChildren(TABLE_COLUMN_PROVIDER) viewColumns!: ColumnProvider<T>[];
68
+ export class TableComponent<T>
69
+ implements AfterViewInit, OnChanges, TableCore<T>
70
+ {
71
+ @ContentChildren(TABLE_COLUMN_PROVIDER) viewColumns!: QueryList<
72
+ ColumnProvider<T>
73
+ >;
52
74
 
53
- @ContentChild(ActionButtonGroupComponent)
54
- actionButtonGroup!: ActionButtonGroupComponent;
75
+ @ViewChild('table') table: Table | undefined;
55
76
 
56
- @ContentChild('rowExpansion', { static: false })
57
- rowExpansionTemplate!: TemplateRef<any>;
77
+ @ContentChild('rowDetail', { static: false })
78
+ rowDetailTemplate!: TemplateRef<any>;
58
79
 
59
80
  sorters!: Sort[];
60
81
 
@@ -62,13 +83,12 @@ export class TableComponent<T> implements OnInit, AfterViewInit, OnChanges {
62
83
  data!: T[];
63
84
 
64
85
  @Input()
65
- total!: number;
86
+ total = 0;
66
87
 
67
- @Input()
68
- loading!: boolean;
88
+ @Input() filter: Partial<T> | undefined;
69
89
 
70
90
  @Input()
71
- scrollHeight = '100%';
91
+ loading!: boolean;
72
92
 
73
93
  @Input()
74
94
  scrollable = true;
@@ -86,38 +106,34 @@ export class TableComponent<T> implements OnInit, AfterViewInit, OnChanges {
86
106
  sortMultiple = false;
87
107
 
88
108
  @Input()
89
- lazy = true;
109
+ lazy = false;
90
110
 
91
111
  @Input()
92
- selectionMode: 'single' | 'multiple' | null | undefined;
112
+ selectionMode: TableSelectionModeType | undefined;
93
113
 
94
114
  @Input()
95
- multipleSelect = false;
115
+ showPageSizePicker = true;
96
116
 
97
117
  @Input()
98
- autoIndex = false;
118
+ entityKey: string | undefined;
99
119
 
100
120
  @Input()
101
- showPageSizePicker = true;
121
+ maximumColumnLength = 0;
102
122
 
103
123
  @Input()
104
- page!: Page<T> | undefined;
124
+ disableCustomClicks = false;
105
125
 
106
126
  @Input()
107
- entityId!: string;
108
-
109
- @Input()
110
- set columnDefinitions(value: ColumnDefinition<T>[]) {
111
- this._columnDefinitions = value;
127
+ set columns(value: ColumnDefinition<T>[]) {
128
+ this._columns = value;
112
129
  this.tableColumns = (value ?? []).map((x) => new ColumnModel(x));
113
130
  }
114
131
 
115
- get columnDefinitions(): ColumnDefinition<T>[] {
116
- return this._columnDefinitions;
132
+ get columns(): ColumnDefinition<T>[] {
133
+ return this._columns;
117
134
  }
118
135
 
119
- @Input()
120
- filter?: Partial<T>;
136
+ @Input() selection: T[] = [];
121
137
 
122
138
  @Output()
123
139
  pageSizeChange = new EventEmitter<number>();
@@ -131,82 +147,74 @@ export class TableComponent<T> implements OnInit, AfterViewInit, OnChanges {
131
147
  @Output()
132
148
  sortChange = new EventEmitter<Sort[]>();
133
149
 
134
- sortColumn: Sort[] = [];
150
+ @Output()
151
+ lazyLoad = new EventEmitter<LazyLoadEvent>();
135
152
 
136
153
  sorted!: boolean;
137
154
 
138
155
  cdRef = inject(ChangeDetectorRef);
139
156
 
140
- selection: T[] = [];
141
-
142
157
  tableColumns: ColumnModel<T>[] = [];
143
158
 
144
159
  tableRows: RowModel<T>[] = [];
145
160
 
161
+ tableSelection: RowModel<T>[] | RowModel<T> | undefined;
162
+
146
163
  expandedRows = {};
147
164
 
148
165
  expansionTemplate!: { template: TemplateRef<any> };
149
166
 
150
- protected sortMeta: SortMeta[] | null | undefined;
167
+ sortMeta: SortMeta[] | undefined;
151
168
 
152
- protected router = inject(Router);
169
+ sortSignleColumn: SortMeta | undefined;
153
170
 
154
- protected route = inject(ActivatedRoute);
171
+ globalFilterFields: string[] | undefined;
155
172
 
156
- protected screenSizeService = inject(ScreenSizeService);
173
+ router = inject(Router);
157
174
 
158
- protected keyGroup!: any[][];
175
+ route = inject(ActivatedRoute);
159
176
 
160
- private _columnDefinitions!: ColumnDefinition<T>[];
177
+ icons = Icons;
161
178
 
162
- ngOnInit(): void {
163
- this.updateData();
164
- }
179
+ private _columns!: ColumnDefinition<T>[];
165
180
 
166
181
  ngOnChanges(changes: SimpleChanges): void {
167
182
  if (changes['data']) {
168
- this.updateData();
183
+ this.updateRowModels();
184
+ }
185
+
186
+ if (changes['selection'] || changes['data']) {
187
+ this.tableSelection = this.selection
188
+ ? this.tableRows.filter((x) => this.selection.includes(x.row))
189
+ : undefined;
190
+ }
191
+
192
+ if (changes['filter'] && !changes['filter'].isFirstChange()) {
193
+ this.globalFilterFields = this.columns.filter(x => x.id).map(x => 'row.' + x.id);
194
+ setTimeout(() => {
195
+ this.table?._filter();
196
+ }, 0);
169
197
  }
170
198
  }
171
199
 
172
200
  ngAfterViewInit(): void {
173
- if (!this.viewColumns?.length) {
174
- return;
201
+ if (this.viewColumns?.length) {
202
+ const templateColumnModel = this.viewColumns
203
+ .toArray()
204
+ .map((provider) => new ColumnModel(provider.getDefinition()));
205
+ this.tableColumns = [...this.tableColumns, ...templateColumnModel];
175
206
  }
176
207
 
177
- this.viewColumns.forEach((x) => {
178
- if (x.index) {
179
- this._columnDefinitions.splice(x.index, 0, x.getDefinition());
180
- this.columnDefinitions = [...this._columnDefinitions];
181
- } else {
182
- this.columnDefinitions = [
183
- ...this._columnDefinitions,
184
- x.getDefinition(),
185
- ];
186
- }
187
- });
188
- this.keyGroup = this.groupKeys(this.tableColumns, 3);
189
208
  this.expansionTemplate = {
190
- template: this.rowExpansionTemplate,
209
+ template: this.rowDetailTemplate,
191
210
  };
192
211
  this.cdRef.detectChanges();
193
212
  }
194
213
 
195
- updateData(): void {
196
- this.getPage(this.page);
197
- this.tableRows = (this.data ?? []).map((x) => new RowModel(x, false));
198
- }
199
-
200
- getPage(page?: Page<T>) {
201
- if (page) {
202
- this.total = page.total;
203
- this.pageSize = page.limit;
204
- this.data = page.data;
205
- this.currentPage = Math.round(page.offset / page.limit);
206
- }
207
- else {
208
- this.total = 0;
209
- }
214
+ updateRowModels(): void {
215
+ this.tableRows = (this.data ?? []).map(
216
+ (x) => new RowModel(x, false, false)
217
+ );
210
218
  }
211
219
 
212
220
  pageChanged(page: TablePageEvent) {
@@ -218,39 +226,64 @@ export class TableComponent<T> implements OnInit, AfterViewInit, OnChanges {
218
226
  this.pageSize = pageSize;
219
227
  }
220
228
 
221
- sortChanged(event: any) {
222
- this.sortColumn = event?.multisortmeta?.flatMap((event: any) => [
223
- {
224
- field: event.field,
225
- direction: event.order,
226
- } as Sort,
227
- ]);
229
+ sortChanged(event: SortMeta | { multisortmeta: SortMeta[] }) {
230
+ let eventEmiterArg: Sort[];
231
+ if ((<SortMeta>event).field) {
232
+ const singleEvent = <SortMeta>event;
233
+ eventEmiterArg = this.getSorts([singleEvent]) as Sort[];
234
+ this.sortMeta = undefined;
235
+ this.sortSignleColumn = singleEvent;
236
+ } else {
237
+ const multiEvent = <{ multisortmeta: SortMeta[] }>event;
238
+ eventEmiterArg = this.getSorts(multiEvent.multisortmeta) as Sort[];
239
+ this.sortMeta = multiEvent.multisortmeta;
240
+ this.sortSignleColumn = undefined;
241
+ }
228
242
 
229
- this.sortMeta = event?.multisortmeta;
243
+ this.sortChange.emit(eventEmiterArg);
244
+ }
230
245
 
231
- this.sortChange.emit(this.sortColumn);
246
+ selectionChanged(event: RowModel<T>[] | RowModel<T>) {
247
+ this.tableSelection = event;
248
+ if (this.selectionMode) {
249
+ const eventArgArray = Array.isArray(event) ? event : [event];
250
+ const selection = event ? eventArgArray.map((x) => x.row) : [];
251
+ this.selectionChange.emit(selection);
252
+ }
232
253
  }
233
254
 
234
- toggleSelection(row: any) {
235
- const index = this.selection.indexOf(row);
236
- if (index === -1) {
237
- this.selection.push(row);
238
- } else {
239
- this.selection.splice(index, 1);
255
+ fireLazyLoad(event: TableLazyLoadEvent) {
256
+ if (this.lazy) {
257
+ const sort = this.sortSignleColumn
258
+ ? this.getSorts([this.sortSignleColumn])
259
+ : this.sortMeta
260
+ ? this.getSorts(this.sortMeta)
261
+ : undefined;
262
+ const lazyLoadEvent: LazyLoadEvent = {
263
+ sort,
264
+ offset: event.first ?? 0,
265
+ limit: event.rows ?? this.pageSize,
266
+ filter: convertToFilter(event.filters),
267
+ };
268
+
269
+ this.lazyLoad.emit(lazyLoadEvent);
240
270
  }
241
- this.selection = [...this.selection];
242
271
  }
243
272
 
244
- selectionChanged($event: RowModel<any>[]) {
245
- const selection = $event.map((x: RowModel<any>) => x.row);
246
- this.selectionChange.emit(selection);
273
+ private removePrefix(input: string, prefix: string): string {
274
+ return input.startsWith(prefix) ? input.slice(prefix.length) : input;
247
275
  }
248
276
 
249
- groupKeys(keys: any[], size: number): any[][] {
250
- const groups = [];
251
- for (let i = 0; i < keys.length; i += size) {
252
- groups.push(keys.slice(i, i + size));
253
- }
254
- return groups;
277
+ private convertToSortDirection(value: number): SortDirectionType {
278
+ return value === 1 ? SortDirection.asc : SortDirection.desc;
279
+ }
280
+
281
+ private getSorts(value: SortMeta[] | undefined) {
282
+ return value
283
+ ? value.map((x: SortMeta) => ({
284
+ field: this.removePrefix(x.field, 'row.'),
285
+ direction: this.convertToSortDirection(x.order),
286
+ }))
287
+ : undefined;
255
288
  }
256
289
  }
@@ -0,0 +1,26 @@
1
+ import { FilterMetadata } from 'primeng/api';
2
+
3
+ export function convertToFilter<T>(
4
+ value:
5
+ | {
6
+ [s: string]: FilterMetadata | FilterMetadata[] | undefined;
7
+ }
8
+ | Partial<T>
9
+ | undefined
10
+ ): Partial<T> | undefined {
11
+ if (value == undefined) {
12
+ return undefined;
13
+ }
14
+
15
+ const filter: { [key: string]: unknown } = {};
16
+ Object.keys(value).map((key) => {
17
+ const filterValue = (value as { [s: string]: unknown })[key];
18
+ if (filterValue != undefined && typeof filterValue === 'object') {
19
+ filter[key] = (filterValue as FilterMetadata).value;
20
+ } else {
21
+ filter[key] = filterValue;
22
+ }
23
+ });
24
+
25
+ return filter as Partial<T>;
26
+ }
@@ -2,7 +2,6 @@
2
2
  <ng-container *ngIf="!floatLabel">
3
3
  <v-form-field
4
4
  [label]="label"
5
- [ngControl]="ngControl"
6
5
  [tooltip]="tooltip"
7
6
  [required]="isRequired()"
8
7
  [display]="formDisplay"
@@ -19,6 +18,7 @@
19
18
  [autoResize]="autoResize"
20
19
  ></textarea>
21
20
  </v-form-field>
21
+ <v-validation-message [ngControl]="ngControl"></v-validation-message>
22
22
  </ng-container>
23
23
  <ng-container *ngIf="floatLabel">
24
24
  <p-floatLabel>
@@ -14,6 +14,7 @@ import {
14
14
  import { BaseFormInputComponent, BaseInputControls, TEXTAREA_COMPONENT_TOKEN, TextareaCore } from '@verisoft/ui-core';
15
15
  import { FloatLabelModule } from 'primeng/floatlabel';
16
16
  import { InputTextareaModule } from 'primeng/inputtextarea';
17
+ import { ErrorComponent } from '../errors';
17
18
  import { FormFieldComponent } from '../form-field/form-field.component';
18
19
 
19
20
  @Component({
@@ -25,6 +26,7 @@ import { FormFieldComponent } from '../form-field/form-field.component';
25
26
  ReactiveFormsModule,
26
27
  FormFieldComponent,
27
28
  FloatLabelModule,
29
+ ErrorComponent
28
30
  ],
29
31
  templateUrl: './textarea.component.html',
30
32
  styleUrl: './textarea.component.scss',
@@ -5,7 +5,6 @@
5
5
  [label]="label"
6
6
  [tooltip]="tooltip"
7
7
  [required]="isRequired()"
8
- [ngControl]="ngControl"
9
8
  [testId]="testId"
10
9
  [display]="formDisplay"
11
10
  >
@@ -43,6 +42,7 @@
43
42
  </ng-container>
44
43
  </span>
45
44
  </v-form-field>
45
+ <v-validation-message [ngControl]="ngControl"></v-validation-message>
46
46
  </ng-container>
47
47
  <ng-template #floatLabelInput>
48
48
  <span
@@ -24,6 +24,8 @@ import {
24
24
  } from '@verisoft/ui-core';
25
25
  import { FloatLabelModule } from 'primeng/floatlabel';
26
26
  import { InputTextModule } from 'primeng/inputtext';
27
+ import { Icons } from '../../icons';
28
+ import { ErrorComponent } from '../errors';
27
29
  import { FormFieldComponent } from '../form-field/form-field.component';
28
30
 
29
31
  @Component({
@@ -35,6 +37,7 @@ import { FormFieldComponent } from '../form-field/form-field.component';
35
37
  ReactiveFormsModule,
36
38
  FormFieldComponent,
37
39
  FloatLabelModule,
40
+ ErrorComponent
38
41
  ],
39
42
  templateUrl: './textfield.component.html',
40
43
  styleUrl: './textfield.component.scss',
@@ -54,11 +57,13 @@ export class TextfieldComponent
54
57
  extends BaseFormInputComponent
55
58
  implements ControlValueAccessor, TextfieldCore
56
59
  {
60
+ icons = Icons;
61
+
57
62
  constructor(@Optional() @Self() ngControl: NgControl) {
58
63
  super(ngControl);
59
64
  }
60
65
 
61
- @Input() size?: FieldSizeType = FieldSize.medium;
66
+ @Input() size: FieldSizeType | undefined = FieldSize.medium;
62
67
  @Input() type: FieldTypeType = FieldType.text;
63
68
  @Input() floatLabel = false;
64
69
  }
@@ -4,7 +4,6 @@
4
4
  [label]="label"
5
5
  [tooltip]="tooltip"
6
6
  [required]="isRequired()"
7
- [ngControl]="ngControl"
8
7
  [testId]="testId"
9
8
  [display]="formDisplay"
10
9
  >
@@ -17,7 +16,8 @@
17
16
  [required]="required"
18
17
  [readonly]="readonly"
19
18
  [inputId]="testId"
20
- checkboxFalseIcon="pi pi-minus"
19
+ [checkboxFalseIcon]="icons.minus"
21
20
  />
21
+ <v-validation-message [ngControl]="ngControl"></v-validation-message>
22
22
  </v-form-field>
23
23
  </div>
@@ -12,6 +12,8 @@ import {
12
12
  TristateCheckboxCore,
13
13
  } from '@verisoft/ui-core';
14
14
  import { TriStateCheckboxModule } from 'primeng/tristatecheckbox';
15
+ import { Icons } from '../../icons';
16
+ import { ErrorComponent } from '../errors';
15
17
  import { FormFieldComponent } from '../form-field';
16
18
 
17
19
  @Component({
@@ -22,6 +24,7 @@ import { FormFieldComponent } from '../form-field';
22
24
  TriStateCheckboxModule,
23
25
  ReactiveFormsModule,
24
26
  FormFieldComponent,
27
+ ErrorComponent
25
28
  ],
26
29
  templateUrl: './tristatecheckbox.component.html',
27
30
  styleUrl: './tristatecheckbox.component.scss',
@@ -40,6 +43,7 @@ export class TristatecheckboxComponent
40
43
  extends BaseFormInputComponent
41
44
  implements ControlValueAccessor, TristateCheckboxCore
42
45
  {
46
+ icons = Icons;
43
47
  constructor(@Optional() @Self() ngControl: NgControl) {
44
48
  super(ngControl);
45
49
  }
@@ -0,0 +1,36 @@
1
+ import { CommonIcons } from '@verisoft/ui-core';
2
+
3
+ export const Icons: CommonIcons = {
4
+ add: 'pi pi-plus',
5
+ minus: 'pi pi-minus',
6
+ delete: 'pi pi-trash',
7
+ filter: 'pi pi-filter',
8
+ download: 'pi pi-download',
9
+ save: 'pi pi-save',
10
+ print: 'pi pi-print',
11
+ calendar: 'pi pi-calendar',
12
+ edit: 'pi pi-pencil',
13
+ settings: 'pi pi-cog',
14
+ house: 'pi pi-home',
15
+ chevronRight: 'pi pi-chevron-right',
16
+ chevronLeft: 'pi pi-chevron-left',
17
+ chevronDown: 'pi pi-chevron-down',
18
+ chevronUp: 'pi pi-chevron-up',
19
+ checkbox: 'pi pi-check',
20
+ warning: 'pi pi-exclamation-triangle',
21
+ search: 'pi pi-search',
22
+ action: 'pi pi-bars',
23
+ user: 'pi pi-user',
24
+ logout: 'pi pi-user',
25
+ crossCircle: 'pi pi-times-circle',
26
+ infoCircle: 'pi pi-info-circle',
27
+ cross: 'pi pi-times',
28
+ arrowLeft: 'pi pi-arrow-left',
29
+ arrowRight: 'pi pi-arrow-right',
30
+ questionCircle: 'pi pi-question-circle',
31
+ checkCircle: 'pi pi-check-circle',
32
+ sitemap: 'pi pi-sitemap',
33
+ check: 'pi pi-check',
34
+ envelope: 'pi pi-envelope',
35
+ loader: 'pi pi-loader',
36
+ };
@@ -2,8 +2,7 @@
2
2
  <div class="error-message p-4">
3
3
  <h1 class="text-primary">404 - PAGE NOT FOUND</h1>
4
4
  <p class="text-default">
5
- This is not the page you are looking for.<br />Try searching for something
6
- else.
5
+ Sorry, the page you are looking for does not exist or has been moved.
7
6
  </p>
8
7
  <v-button
9
8
  class="back-button"
@@ -1,57 +0,0 @@
1
- .p-button:not(.p-button-outlined) {
2
- color: var(--white-color);
3
- }
4
-
5
- .p-button.p-button-danger:not(.p-button-outlined),
6
- .p-button-group.p-button-danger>.p-button,
7
- .p-splitbutton.p-button-danger>.p-button {
8
- border-color: var(--error-color);
9
- background-color: var(--error-color);
10
-
11
- &:hover {
12
- border-color: #e60017;
13
- background-color: #e60017;
14
- }
15
- }
16
-
17
- .p-button.p-button-success:not(.p-button-outlined),
18
- .p-button-group.p-button-success>.p-button,
19
- .p-splitbutton.p-button-success>.p-button {
20
- border-color: var(--success-color);
21
- background-color: var(--success-color);
22
- color: var(--white-color);
23
-
24
- &:hover {
25
- border-color: #439446;
26
- background-color: #439446;
27
- }
28
- }
29
-
30
- .p-button-icon-only.p-button-danger:not(.p-button-outlined) {
31
- border-color: var(--error-color);
32
- background-color: var(--error-color);
33
-
34
- .pi {
35
- color: var(--white-color) !important;
36
- }
37
-
38
- &:hover {
39
- border-color: #e60017;
40
- background-color: #e60017;
41
- }
42
- }
43
-
44
- .p-button-icon-only.p-button-success:not(.p-button-outlined) {
45
- border-color: var(--success-color);
46
- background-color: var(--success-color);
47
-
48
- &:hover {
49
- border-color: #57b44c;
50
- background-color: #57b44c !important;
51
- }
52
- }
53
-
54
- .p-button-icon-only.p-button-secondary:not(.p-button-outlined) {
55
- border-color: var(--secondary-color);
56
- background-color: var(--secondary-color);
57
- }
@@ -1,36 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- EventEmitter,
5
- Input,
6
- Output,
7
- } from '@angular/core';
8
- import { ActionButton, ControlSeverityType, FieldSizeType } from '@verisoft/ui-core';
9
- import { TooltipModule } from 'primeng/tooltip';
10
- import { ButtonComponent } from '../../../button';
11
-
12
- @Component({
13
- selector: 'v-action-button',
14
- standalone: true,
15
- imports: [ButtonComponent, TooltipModule],
16
- templateUrl: './action-button.component.html',
17
- styleUrl: './action-button.component.scss',
18
- changeDetection: ChangeDetectionStrategy.OnPush,
19
- })
20
- export class ActionButtonComponent implements ActionButton {
21
- @Input() disabled = false;
22
- @Input() toolTip?: string;
23
- @Input() id?: string;
24
- @Input() icon?: string;
25
- @Input() outlined = false;
26
- @Input() raised = false;
27
- @Input() text = true;
28
- @Input() severity?: ControlSeverityType;
29
- @Input() label?: string;
30
- @Input() size?: FieldSizeType;
31
- @Output() clickEvent = new EventEmitter<void>();
32
-
33
- handleClick() {
34
- this.clickEvent.emit();
35
- }
36
- }