@verisoft/ui-primeng 18.0.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.
- package/.eslintrc.json +43 -0
- package/README.md +7 -0
- package/jest.config.ts +22 -0
- package/ng-package.json +7 -0
- package/package.json +21 -0
- package/project.json +36 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/fonts/orbitron-black.ttf +0 -0
- package/src/assets/fonts/orbitron-bold.otf +0 -0
- package/src/assets/icons/complex/v-logo.svg +4 -0
- package/src/assets/images/_global/elon.jpg +0 -0
- package/src/assets/images/_global/jara.png +0 -0
- package/src/assets/images/_global/logos/v-logo.webp +0 -0
- package/src/assets/sass/base/_scrollbar.scss +18 -0
- package/src/assets/sass/base/_typography.scss +25 -0
- package/src/assets/sass/layout/_app.scss +27 -0
- package/src/assets/sass/layout/_button.scss +57 -0
- package/src/assets/sass/layout/_checkbox.scss +33 -0
- package/src/assets/sass/layout/_dialog.scss +13 -0
- package/src/assets/sass/layout/_dropdown.scss +9 -0
- package/src/assets/sass/layout/_formField.scss +5 -0
- package/src/assets/sass/layout/_header.scss +63 -0
- package/src/assets/sass/layout/_icons.scss +13 -0
- package/src/assets/sass/layout/_inputSwitch.scss +13 -0
- package/src/assets/sass/layout/_layout.scss +6 -0
- package/src/assets/sass/layout/_loader.scss +9 -0
- package/src/assets/sass/layout/_radiobutton.scss +21 -0
- package/src/assets/sass/layout/_sidemenu.scss +187 -0
- package/src/assets/sass/layout/_snackbar.scss +8 -0
- package/src/assets/sass/layout/_tables.scss +5 -0
- package/src/assets/sass/layout/_tree.scss +12 -0
- package/src/assets/sass/layout/_tristatecheckbox.scss +15 -0
- package/src/assets/sass/main.scss +28 -0
- package/src/assets/sass/themes/_verisoft_theme.scss +46 -0
- package/src/assets/sass/utils/_mixins.scss +0 -0
- package/src/assets/sass/utils/_utils.scss +39 -0
- package/src/assets/sass/utils/_variables.scss +12 -0
- package/src/assets/sass/vendors/_bootstrap.scss +2 -0
- package/src/assets/sass/vendors/_primeng.scss +2 -0
- package/src/index.ts +31 -0
- package/src/lib/components/action-button-group/action-button-group.component.html +29 -0
- package/src/lib/components/action-button-group/action-button-group.component.scss +0 -0
- package/src/lib/components/action-button-group/action-button-group.component.spec.ts +21 -0
- package/src/lib/components/action-button-group/action-button-group.component.ts +104 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.html +12 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.scss +0 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.spec.ts +21 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.ts +36 -0
- package/src/lib/components/action-button-group/index.ts +2 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +12 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +18 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +36 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +24 -0
- package/src/lib/components/breadcrumb/index.ts +1 -0
- package/src/lib/components/button/button.component.html +20 -0
- package/src/lib/components/button/button.component.scss +0 -0
- package/src/lib/components/button/button.component.spec.ts +21 -0
- package/src/lib/components/button/button.component.ts +43 -0
- package/src/lib/components/button/directives/shortcut.directive.ts +37 -0
- package/src/lib/components/button/index.ts +2 -0
- package/src/lib/components/calendar/calendar.component.html +53 -0
- package/src/lib/components/calendar/calendar.component.scss +0 -0
- package/src/lib/components/calendar/calendar.component.spec.ts +21 -0
- package/src/lib/components/calendar/calendar.component.ts +67 -0
- package/src/lib/components/calendar/index.ts +1 -0
- package/src/lib/components/checkbox/checkbox.component.html +19 -0
- package/src/lib/components/checkbox/checkbox.component.scss +15 -0
- package/src/lib/components/checkbox/checkbox.component.spec.ts +21 -0
- package/src/lib/components/checkbox/checkbox.component.stories.ts +72 -0
- package/src/lib/components/checkbox/checkbox.component.ts +41 -0
- package/src/lib/components/checkbox/index.ts +1 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.html +48 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +3 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +74 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +74 -0
- package/src/lib/components/confirm-dialog/index.ts +2 -0
- package/src/lib/components/confirm-dialog/services/confirm-dialog.service.ts +14 -0
- package/src/lib/components/dropdown/dropdown.component.html +96 -0
- package/src/lib/components/dropdown/dropdown.component.scss +16 -0
- package/src/lib/components/dropdown/dropdown.component.spec.ts +21 -0
- package/src/lib/components/dropdown/dropdown.component.stories.ts +90 -0
- package/src/lib/components/dropdown/dropdown.component.ts +139 -0
- package/src/lib/components/dropdown/index.ts +1 -0
- package/src/lib/components/dynamic-component/dynamic-component-factory.service.ts +90 -0
- package/src/lib/components/dynamic-component/dynamic-component.component.ts +55 -0
- package/src/lib/components/filter/directives/filter-field.directive.ts +25 -0
- package/src/lib/components/filter/directives/table-filter.directive.ts +22 -0
- package/src/lib/components/filter/filter.component.html +67 -0
- package/src/lib/components/filter/filter.component.scss +0 -0
- package/src/lib/components/filter/filter.component.spec.ts +21 -0
- package/src/lib/components/filter/filter.component.stories.ts +23 -0
- package/src/lib/components/filter/filter.component.ts +257 -0
- package/src/lib/components/filter/filter.model.ts +18 -0
- package/src/lib/components/filter/index.ts +3 -0
- package/src/lib/components/form-field/form-field.component.html +41 -0
- package/src/lib/components/form-field/form-field.component.scss +0 -0
- package/src/lib/components/form-field/form-field.component.spec.ts +21 -0
- package/src/lib/components/form-field/form-field.component.stories.ts +69 -0
- package/src/lib/components/form-field/form-field.component.ts +34 -0
- package/src/lib/components/form-field/index.ts +1 -0
- package/src/lib/components/generic-field/generic-field.component.html +54 -0
- package/src/lib/components/generic-field/generic-field.component.spec.ts +21 -0
- package/src/lib/components/generic-field/generic-field.component.ts +76 -0
- package/src/lib/components/generic-field/generic-field.model.ts +9 -0
- package/src/lib/components/generic-field/index.ts +2 -0
- package/src/lib/components/generic-form/generic-form.component.html +33 -0
- package/src/lib/components/generic-form/generic-form.component.spec.ts +21 -0
- package/src/lib/components/generic-form/generic-form.component.ts +48 -0
- package/src/lib/components/generic-form/generic-form.model.spec.ts +82 -0
- package/src/lib/components/generic-form/generic-form.model.ts +76 -0
- package/src/lib/components/generic-form/index.ts +2 -0
- package/src/lib/components/header/header.component.html +85 -0
- package/src/lib/components/header/header.component.scss +0 -0
- package/src/lib/components/header/header.component.spec.ts +21 -0
- package/src/lib/components/header/header.component.stories.ts +24 -0
- package/src/lib/components/header/header.component.ts +64 -0
- package/src/lib/components/header/index.ts +2 -0
- package/src/lib/components/header/services/header-provider.service.ts +15 -0
- package/src/lib/components/input-group/index.ts +1 -0
- package/src/lib/components/input-group/input-group.component.html +32 -0
- package/src/lib/components/input-group/input-group.component.spec.ts +21 -0
- package/src/lib/components/input-group/input-group.component.ts +60 -0
- package/src/lib/components/loader/index.ts +1 -0
- package/src/lib/components/loader/loader.component.html +5 -0
- package/src/lib/components/loader/loader.component.scss +0 -0
- package/src/lib/components/loader/loader.component.spec.ts +21 -0
- package/src/lib/components/loader/loader.component.ts +17 -0
- package/src/lib/components/multiselect/index.ts +1 -0
- package/src/lib/components/multiselect/multiselect.component.html +69 -0
- package/src/lib/components/multiselect/multiselect.component.scss +0 -0
- package/src/lib/components/multiselect/multiselect.component.spec.ts +21 -0
- package/src/lib/components/multiselect/multiselect.component.ts +120 -0
- package/src/lib/components/number-input/index.ts +1 -0
- package/src/lib/components/number-input/number-input.component.html +22 -0
- package/src/lib/components/number-input/number-input.component.spec.ts +21 -0
- package/src/lib/components/number-input/number-input.component.ts +54 -0
- package/src/lib/components/page-header/index.ts +2 -0
- package/src/lib/components/page-header/page-header.component.html +31 -0
- package/src/lib/components/page-header/page-header.component.scss +0 -0
- package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
- package/src/lib/components/page-header/page-header.component.ts +60 -0
- package/src/lib/components/page-header/services/page-header.service.ts +9 -0
- package/src/lib/components/password/index.ts +1 -0
- package/src/lib/components/password/password.component.html +24 -0
- package/src/lib/components/password/password.component.scss +0 -0
- package/src/lib/components/password/password.component.spec.ts +21 -0
- package/src/lib/components/password/password.component.ts +56 -0
- package/src/lib/components/radiobutton/index.ts +1 -0
- package/src/lib/components/radiobutton/radiobutton.component.html +32 -0
- package/src/lib/components/radiobutton/radiobutton.component.scss +6 -0
- package/src/lib/components/radiobutton/radiobutton.component.spec.ts +21 -0
- package/src/lib/components/radiobutton/radiobutton.component.stories.ts +71 -0
- package/src/lib/components/radiobutton/radiobutton.component.ts +60 -0
- package/src/lib/components/section/index.ts +1 -0
- package/src/lib/components/section/section.component.html +24 -0
- package/src/lib/components/section/section.component.scss +0 -0
- package/src/lib/components/section/section.component.spec.ts +21 -0
- package/src/lib/components/section/section.component.ts +30 -0
- package/src/lib/components/side-menu/index.ts +2 -0
- package/src/lib/components/side-menu/side-menu.component.html +55 -0
- package/src/lib/components/side-menu/side-menu.component.scss +0 -0
- package/src/lib/components/side-menu/side-menu.component.spec.ts +21 -0
- package/src/lib/components/side-menu/side-menu.component.ts +97 -0
- package/src/lib/components/side-menu/side-menu.module.ts +66 -0
- package/src/lib/components/slider/index.ts +1 -0
- package/src/lib/components/slider/slider.component.html +19 -0
- package/src/lib/components/slider/slider.component.spec.ts +21 -0
- package/src/lib/components/slider/slider.component.ts +56 -0
- package/src/lib/components/snackbar/index.ts +2 -0
- package/src/lib/components/snackbar/services/snackbar.service.ts +45 -0
- package/src/lib/components/snackbar/snackbar.component.html +3 -0
- package/src/lib/components/snackbar/snackbar.component.scss +0 -0
- package/src/lib/components/snackbar/snackbar.component.spec.ts +21 -0
- package/src/lib/components/snackbar/snackbar.component.stories.ts +70 -0
- package/src/lib/components/snackbar/snackbar.component.ts +26 -0
- package/src/lib/components/stepper/index.ts +1 -0
- package/src/lib/components/stepper/stepper.component.html +43 -0
- package/src/lib/components/stepper/stepper.component.spec.ts +21 -0
- package/src/lib/components/stepper/stepper.component.ts +25 -0
- package/src/lib/components/switch/index.ts +1 -0
- package/src/lib/components/switch/switch.component.html +19 -0
- package/src/lib/components/switch/switch.component.scss +0 -0
- package/src/lib/components/switch/switch.component.spec.ts +21 -0
- package/src/lib/components/switch/switch.component.stories.ts +65 -0
- package/src/lib/components/switch/switch.component.ts +52 -0
- package/src/lib/components/tab-view/index.ts +3 -0
- package/src/lib/components/tab-view/tab-view-item.component.ts +20 -0
- package/src/lib/components/tab-view/tab-view.component.html +24 -0
- package/src/lib/components/tab-view/tab-view.component.ts +50 -0
- package/src/lib/components/tab-view/tab-view.module.ts +18 -0
- package/src/lib/components/table/directives/table-store.directive.ts +61 -0
- package/src/lib/components/table/index.ts +2 -0
- package/src/lib/components/table/table.component.html +183 -0
- package/src/lib/components/table/table.component.scss +0 -0
- package/src/lib/components/table/table.component.spec.ts +21 -0
- package/src/lib/components/table/table.component.stories.ts +55 -0
- package/src/lib/components/table/table.component.ts +256 -0
- package/src/lib/components/table-filter/filter.component.html +205 -0
- package/src/lib/components/table-filter/filter.component.scss +0 -0
- package/src/lib/components/table-filter/filter.component.spec.ts +21 -0
- package/src/lib/components/table-filter/filter.component.stories.ts +23 -0
- package/src/lib/components/textarea/index.ts +1 -0
- package/src/lib/components/textarea/textarea.component.html +40 -0
- package/src/lib/components/textarea/textarea.component.scss +5 -0
- package/src/lib/components/textarea/textarea.component.spec.ts +21 -0
- package/src/lib/components/textarea/textarea.component.stories.ts +98 -0
- package/src/lib/components/textarea/textarea.component.ts +62 -0
- package/src/lib/components/textfield/index.ts +1 -0
- package/src/lib/components/textfield/textfield.component.html +83 -0
- package/src/lib/components/textfield/textfield.component.scss +23 -0
- package/src/lib/components/textfield/textfield.component.spec.ts +21 -0
- package/src/lib/components/textfield/textfield.component.stories.ts +85 -0
- package/src/lib/components/textfield/textfield.component.ts +64 -0
- package/src/lib/components/tristatecheckbox/index.ts +1 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.html +23 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.scss +0 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.spec.ts +21 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.stories.ts +22 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.ts +46 -0
- package/src/lib/interceptors/http-error-message.interceptor.ts +35 -0
- package/src/lib/pages/not-found-page/not-found-page.component.html +27 -0
- package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
- package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +21 -0
- package/src/lib/pages/not-found-page/not-found-page.component.ts +17 -0
- package/src/lib/services/screen-size.service.ts +25 -0
- package/src/tab-view.ts +1 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +29 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
AfterViewInit,
|
|
4
|
+
ChangeDetectionStrategy,
|
|
5
|
+
ChangeDetectorRef,
|
|
6
|
+
Component,
|
|
7
|
+
ContentChild,
|
|
8
|
+
ContentChildren,
|
|
9
|
+
EventEmitter,
|
|
10
|
+
inject,
|
|
11
|
+
Input,
|
|
12
|
+
OnChanges,
|
|
13
|
+
OnInit,
|
|
14
|
+
Output,
|
|
15
|
+
SimpleChanges,
|
|
16
|
+
TemplateRef,
|
|
17
|
+
ViewEncapsulation,
|
|
18
|
+
} from '@angular/core';
|
|
19
|
+
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
20
|
+
import { DEFAULT_SEARCH_LIMIT, Page, Sort } from '@verisoft/core';
|
|
21
|
+
import {
|
|
22
|
+
ColumnDefinition,
|
|
23
|
+
ColumnModel,
|
|
24
|
+
ColumnProvider,
|
|
25
|
+
RowModel,
|
|
26
|
+
TABLE_COLUMN_PROVIDER,
|
|
27
|
+
} from '@verisoft/ui-core';
|
|
28
|
+
import { SortMeta } from 'primeng/api';
|
|
29
|
+
import { ButtonModule } from 'primeng/button';
|
|
30
|
+
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';
|
|
34
|
+
|
|
35
|
+
@Component({
|
|
36
|
+
selector: 'v-table',
|
|
37
|
+
standalone: true,
|
|
38
|
+
imports: [
|
|
39
|
+
CommonModule,
|
|
40
|
+
TableModule,
|
|
41
|
+
RouterModule,
|
|
42
|
+
ButtonModule,
|
|
43
|
+
RippleModule,
|
|
44
|
+
],
|
|
45
|
+
templateUrl: './table.component.html',
|
|
46
|
+
styleUrl: './table.component.scss',
|
|
47
|
+
encapsulation: ViewEncapsulation.None,
|
|
48
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
49
|
+
})
|
|
50
|
+
export class TableComponent<T> implements OnInit, AfterViewInit, OnChanges {
|
|
51
|
+
@ContentChildren(TABLE_COLUMN_PROVIDER) viewColumns!: ColumnProvider<T>[];
|
|
52
|
+
|
|
53
|
+
@ContentChild(ActionButtonGroupComponent)
|
|
54
|
+
actionButtonGroup!: ActionButtonGroupComponent;
|
|
55
|
+
|
|
56
|
+
@ContentChild('rowExpansion', { static: false })
|
|
57
|
+
rowExpansionTemplate!: TemplateRef<any>;
|
|
58
|
+
|
|
59
|
+
sorters!: Sort[];
|
|
60
|
+
|
|
61
|
+
@Input()
|
|
62
|
+
data!: T[];
|
|
63
|
+
|
|
64
|
+
@Input()
|
|
65
|
+
total!: number;
|
|
66
|
+
|
|
67
|
+
@Input()
|
|
68
|
+
loading!: boolean;
|
|
69
|
+
|
|
70
|
+
@Input()
|
|
71
|
+
scrollHeight = '100%';
|
|
72
|
+
|
|
73
|
+
@Input()
|
|
74
|
+
scrollable = true;
|
|
75
|
+
|
|
76
|
+
@Input()
|
|
77
|
+
pageSize = DEFAULT_SEARCH_LIMIT;
|
|
78
|
+
|
|
79
|
+
@Input()
|
|
80
|
+
currentPage!: number;
|
|
81
|
+
|
|
82
|
+
@Input()
|
|
83
|
+
showPaginator = true;
|
|
84
|
+
|
|
85
|
+
@Input()
|
|
86
|
+
sortMultiple = false;
|
|
87
|
+
|
|
88
|
+
@Input()
|
|
89
|
+
lazy = true;
|
|
90
|
+
|
|
91
|
+
@Input()
|
|
92
|
+
selectionMode: 'single' | 'multiple' | null | undefined;
|
|
93
|
+
|
|
94
|
+
@Input()
|
|
95
|
+
multipleSelect = false;
|
|
96
|
+
|
|
97
|
+
@Input()
|
|
98
|
+
autoIndex = false;
|
|
99
|
+
|
|
100
|
+
@Input()
|
|
101
|
+
showPageSizePicker = true;
|
|
102
|
+
|
|
103
|
+
@Input()
|
|
104
|
+
page!: Page<T> | undefined;
|
|
105
|
+
|
|
106
|
+
@Input()
|
|
107
|
+
entityId!: string;
|
|
108
|
+
|
|
109
|
+
@Input()
|
|
110
|
+
set columnDefinitions(value: ColumnDefinition<T>[]) {
|
|
111
|
+
this._columnDefinitions = value;
|
|
112
|
+
this.tableColumns = (value ?? []).map((x) => new ColumnModel(x));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
get columnDefinitions(): ColumnDefinition<T>[] {
|
|
116
|
+
return this._columnDefinitions;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@Input()
|
|
120
|
+
filter?: Partial<T>;
|
|
121
|
+
|
|
122
|
+
@Output()
|
|
123
|
+
pageSizeChange = new EventEmitter<number>();
|
|
124
|
+
|
|
125
|
+
@Output()
|
|
126
|
+
selectionChange = new EventEmitter<T[]>();
|
|
127
|
+
|
|
128
|
+
@Output()
|
|
129
|
+
pageChange = new EventEmitter<TablePageEvent>();
|
|
130
|
+
|
|
131
|
+
@Output()
|
|
132
|
+
sortChange = new EventEmitter<Sort[]>();
|
|
133
|
+
|
|
134
|
+
sortColumn: Sort[] = [];
|
|
135
|
+
|
|
136
|
+
sorted!: boolean;
|
|
137
|
+
|
|
138
|
+
cdRef = inject(ChangeDetectorRef);
|
|
139
|
+
|
|
140
|
+
selection: T[] = [];
|
|
141
|
+
|
|
142
|
+
tableColumns: ColumnModel<T>[] = [];
|
|
143
|
+
|
|
144
|
+
tableRows: RowModel<T>[] = [];
|
|
145
|
+
|
|
146
|
+
expandedRows = {};
|
|
147
|
+
|
|
148
|
+
expansionTemplate!: { template: TemplateRef<any> };
|
|
149
|
+
|
|
150
|
+
protected sortMeta: SortMeta[] | null | undefined;
|
|
151
|
+
|
|
152
|
+
protected router = inject(Router);
|
|
153
|
+
|
|
154
|
+
protected route = inject(ActivatedRoute);
|
|
155
|
+
|
|
156
|
+
protected screenSizeService = inject(ScreenSizeService);
|
|
157
|
+
|
|
158
|
+
protected keyGroup!: any[][];
|
|
159
|
+
|
|
160
|
+
private _columnDefinitions!: ColumnDefinition<T>[];
|
|
161
|
+
|
|
162
|
+
ngOnInit(): void {
|
|
163
|
+
this.updateData();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
167
|
+
if (changes['data']) {
|
|
168
|
+
this.updateData();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
ngAfterViewInit(): void {
|
|
173
|
+
if (!this.viewColumns?.length) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
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
|
+
this.expansionTemplate = {
|
|
190
|
+
template: this.rowExpansionTemplate,
|
|
191
|
+
};
|
|
192
|
+
this.cdRef.detectChanges();
|
|
193
|
+
}
|
|
194
|
+
|
|
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
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
pageChanged(page: TablePageEvent) {
|
|
213
|
+
this.pageChange.emit(page);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
pageSizeChanged(pageSize: number) {
|
|
217
|
+
this.pageSizeChange.emit(pageSize);
|
|
218
|
+
this.pageSize = pageSize;
|
|
219
|
+
}
|
|
220
|
+
|
|
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
|
+
]);
|
|
228
|
+
|
|
229
|
+
this.sortMeta = event?.multisortmeta;
|
|
230
|
+
|
|
231
|
+
this.sortChange.emit(this.sortColumn);
|
|
232
|
+
}
|
|
233
|
+
|
|
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);
|
|
240
|
+
}
|
|
241
|
+
this.selection = [...this.selection];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
selectionChanged($event: RowModel<any>[]) {
|
|
245
|
+
const selection = $event.map((x: RowModel<any>) => x.row);
|
|
246
|
+
this.selectionChange.emit(selection);
|
|
247
|
+
}
|
|
248
|
+
|
|
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;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<div class="v-table-filter w-100 p-3 bg-primary">
|
|
2
|
+
<form
|
|
3
|
+
[formGroup]="formGroup"
|
|
4
|
+
class="d-flex align-items-center justify-content-end gap-4"
|
|
5
|
+
>
|
|
6
|
+
<div class="col-2">
|
|
7
|
+
<h2 class="text-white m-0" [innerText]="title"></h2>
|
|
8
|
+
</div>
|
|
9
|
+
<div
|
|
10
|
+
*ngIf="(screenSizeService.isMobileBlock | async) === false"
|
|
11
|
+
class="w-50 align-items-center"
|
|
12
|
+
>
|
|
13
|
+
<v-textfield
|
|
14
|
+
*ngIf="!hideSearch"
|
|
15
|
+
class="w-100 d-none d-lg-block"
|
|
16
|
+
placeholder="Search"
|
|
17
|
+
size="large"
|
|
18
|
+
formControlName="searchField"
|
|
19
|
+
type="search"
|
|
20
|
+
[clearable]="true"
|
|
21
|
+
>
|
|
22
|
+
</v-textfield>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="d-flex w-100 align-items-center justify-content-end">
|
|
25
|
+
<ng-container *ngIf="(screenSizeService.isMobileBlock | async) === false">
|
|
26
|
+
<div class="extended-filters d-flex align-items-center gap-3">
|
|
27
|
+
<i
|
|
28
|
+
*ngIf="!hideSearch"
|
|
29
|
+
class="pi pi-search text-white d-block d-lg-none"
|
|
30
|
+
(click)="openSearch()"
|
|
31
|
+
></i>
|
|
32
|
+
<i
|
|
33
|
+
class="pi pi-filter text-white"
|
|
34
|
+
pBadge
|
|
35
|
+
[value]="activeFilters"
|
|
36
|
+
(click)="openFilter()"
|
|
37
|
+
></i>
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
*ngFor="let filter of filterDefinitions; let index = index"
|
|
41
|
+
class="filters gap-3"
|
|
42
|
+
>
|
|
43
|
+
<div
|
|
44
|
+
*ngIf="!filter.filterType || filter.filterType === 'dropdown'"
|
|
45
|
+
class="d-none d-sm-block"
|
|
46
|
+
>
|
|
47
|
+
<v-dropdown
|
|
48
|
+
useDatasource
|
|
49
|
+
[formControlName]="filter.optionLabel"
|
|
50
|
+
[floatLabel]="filter.label"
|
|
51
|
+
[optionLabel]="filter.optionLabel"
|
|
52
|
+
[testId]="filter.optionLabel + index"
|
|
53
|
+
[optionValue]="filter.optionValue ?? filter.optionLabel"
|
|
54
|
+
[entityName]="filter.url ?? service.entityName"
|
|
55
|
+
[datasourceService]="service"
|
|
56
|
+
>
|
|
57
|
+
</v-dropdown>
|
|
58
|
+
</div>
|
|
59
|
+
<div
|
|
60
|
+
*ngIf="filter.filterType === 'multiselect'"
|
|
61
|
+
class="d-none d-sm-block"
|
|
62
|
+
>
|
|
63
|
+
<v-multiselect
|
|
64
|
+
useDatasource
|
|
65
|
+
[formControlName]="filter.optionLabel"
|
|
66
|
+
[floatLabel]="filter.label"
|
|
67
|
+
[optionLabel]="filter.optionLabel"
|
|
68
|
+
[testId]="filter.optionLabel + index"
|
|
69
|
+
[optionValue]="filter.optionValue ?? filter.optionLabel"
|
|
70
|
+
[entityName]="filter.url ?? service.entityName"
|
|
71
|
+
[datasourceService]="service"
|
|
72
|
+
>
|
|
73
|
+
</v-multiselect>
|
|
74
|
+
</div>
|
|
75
|
+
<div
|
|
76
|
+
*ngIf="filter.filterType === 'checkbox'"
|
|
77
|
+
class="d-none d-sm-block"
|
|
78
|
+
>
|
|
79
|
+
<v-tristatecheckbox
|
|
80
|
+
[formControlName]="filter.optionLabel"
|
|
81
|
+
[label]="filter.label"
|
|
82
|
+
></v-tristatecheckbox>
|
|
83
|
+
</div>
|
|
84
|
+
<div
|
|
85
|
+
*ngIf="filter.filterType === 'calendar'"
|
|
86
|
+
class="d-none d-sm-block"
|
|
87
|
+
>
|
|
88
|
+
<v-calendar
|
|
89
|
+
[formControlName]="filter.optionLabel"
|
|
90
|
+
[floatLabel]="filter.label"
|
|
91
|
+
icon="pi pi-calendar"
|
|
92
|
+
></v-calendar>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</ng-container>
|
|
96
|
+
<ng-container *ngIf="screenSizeService.isMobileBlock | async">
|
|
97
|
+
<div class="extended-filters d-flex gap-2">
|
|
98
|
+
<i
|
|
99
|
+
*ngIf="!hideSearch"
|
|
100
|
+
class="pi pi-search text-white"
|
|
101
|
+
(click)="openSearch()"
|
|
102
|
+
></i>
|
|
103
|
+
<div class="d-none"></div>
|
|
104
|
+
<i
|
|
105
|
+
class="pi pi-filter text-white"
|
|
106
|
+
pBadge
|
|
107
|
+
[value]="activeFilters"
|
|
108
|
+
(click)="openFilter()"
|
|
109
|
+
></i>
|
|
110
|
+
</div>
|
|
111
|
+
</ng-container>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="verisoft-filter-action-buttons d-flex align-items-center gap-3">
|
|
114
|
+
<ng-container
|
|
115
|
+
*ngIf="
|
|
116
|
+
(screenSizeService.isMobileBlock | async) === false &&
|
|
117
|
+
filterDefinitions.length > 0
|
|
118
|
+
"
|
|
119
|
+
>
|
|
120
|
+
<div class="d-flex gap-2">
|
|
121
|
+
<v-button
|
|
122
|
+
useShortCut
|
|
123
|
+
[shortCutFn]="submit.bind(this)"
|
|
124
|
+
shortCutKey="Enter"
|
|
125
|
+
class="text-white"
|
|
126
|
+
[outlined]="true"
|
|
127
|
+
size="small"
|
|
128
|
+
label="Apply"
|
|
129
|
+
(click)="submit()"
|
|
130
|
+
></v-button>
|
|
131
|
+
<v-button
|
|
132
|
+
useShortCut
|
|
133
|
+
[shortCutFn]="clear.bind(this)"
|
|
134
|
+
shortCutKey="Escape"
|
|
135
|
+
class="text-white"
|
|
136
|
+
[outlined]="true"
|
|
137
|
+
size="small"
|
|
138
|
+
label="Clear"
|
|
139
|
+
(click)="clear()"
|
|
140
|
+
></v-button>
|
|
141
|
+
</div>
|
|
142
|
+
</ng-container>
|
|
143
|
+
<ng-container *ngIf="buttonGroup">
|
|
144
|
+
<ng-content></ng-content>
|
|
145
|
+
</ng-container>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="d-none">
|
|
148
|
+
<div class="w-100 p-4" #filter>
|
|
149
|
+
<div *ngFor="let filter of filterDefinitions; let index = index">
|
|
150
|
+
<div *ngIf="!filter.filterType || filter.filterType === 'dropdown'">
|
|
151
|
+
<v-dropdown
|
|
152
|
+
useDatasource
|
|
153
|
+
class="mb-4"
|
|
154
|
+
[formControlName]="filter.optionLabel"
|
|
155
|
+
[floatLabel]="filter.label"
|
|
156
|
+
[optionLabel]="filter.optionLabel"
|
|
157
|
+
[testId]="filter.optionLabel + index"
|
|
158
|
+
[optionValue]="filter.optionValue ?? filter.optionLabel"
|
|
159
|
+
[entityName]="filter.url ?? ''"
|
|
160
|
+
[datasourceService]="service"
|
|
161
|
+
>
|
|
162
|
+
</v-dropdown>
|
|
163
|
+
</div>
|
|
164
|
+
<div *ngIf="filter.filterType && filter.filterType === 'checkbox'">
|
|
165
|
+
<v-tristatecheckbox
|
|
166
|
+
[formControlName]="filter.optionLabel"
|
|
167
|
+
[label]="filter.label"
|
|
168
|
+
></v-tristatecheckbox>
|
|
169
|
+
</div>
|
|
170
|
+
<div *ngIf="filter.filterType === 'calendar'" class="w-100">
|
|
171
|
+
<v-calendar
|
|
172
|
+
[formControlName]="filter.optionLabel"
|
|
173
|
+
[floatLabel]="filter.label"
|
|
174
|
+
></v-calendar>
|
|
175
|
+
</div>
|
|
176
|
+
<div *ngIf="filter.filterType === 'multiselect'">
|
|
177
|
+
<v-multiselect
|
|
178
|
+
useDatasource
|
|
179
|
+
[formControlName]="filter.optionLabel"
|
|
180
|
+
[floatLabel]="filter.label"
|
|
181
|
+
[optionLabel]="filter.optionLabel"
|
|
182
|
+
[testId]="filter.optionLabel + index"
|
|
183
|
+
[optionValue]="filter.optionValue ?? filter.optionLabel"
|
|
184
|
+
[entityName]="filter.url ?? service.entityName"
|
|
185
|
+
[datasourceService]="service"
|
|
186
|
+
>
|
|
187
|
+
</v-multiselect>
|
|
188
|
+
</div>
|
|
189
|
+
<br />
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
<div class="w-100 py-2" #searchField>
|
|
193
|
+
<v-textfield
|
|
194
|
+
class="w-100"
|
|
195
|
+
placeholder="Search"
|
|
196
|
+
size="large"
|
|
197
|
+
formControlName="searchField"
|
|
198
|
+
type="search"
|
|
199
|
+
[clearable]="true"
|
|
200
|
+
>
|
|
201
|
+
</v-textfield>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
</form>
|
|
205
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { FilterComponent } from './filter.component';
|
|
3
|
+
|
|
4
|
+
describe('VerisoftTableFilterComponent', () => {
|
|
5
|
+
let component: FilterComponent<any>;
|
|
6
|
+
let fixture: ComponentFixture<FilterComponent<any>>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [FilterComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(FilterComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { FilterComponent } from './filter.component';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<FilterComponent<any>> = {
|
|
5
|
+
component: FilterComponent,
|
|
6
|
+
title: 'VerisoftTableFilterComponent',
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<FilterComponent<any>>;
|
|
10
|
+
|
|
11
|
+
export const Primary: Story = {
|
|
12
|
+
args: {
|
|
13
|
+
filterDefinitions: [],
|
|
14
|
+
debounceTime: 0,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const Heading: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
filterDefinitions: [],
|
|
21
|
+
debounceTime: 0,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './textarea.component';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<div class="v-textarea">
|
|
2
|
+
<ng-container *ngIf="!floatLabel">
|
|
3
|
+
<v-form-field
|
|
4
|
+
[label]="label"
|
|
5
|
+
[ngControl]="ngControl"
|
|
6
|
+
[tooltip]="tooltip"
|
|
7
|
+
[required]="isRequired()"
|
|
8
|
+
[display]="formDisplay"
|
|
9
|
+
>
|
|
10
|
+
<textarea
|
|
11
|
+
class="flex-grow-1"
|
|
12
|
+
pInputTextarea
|
|
13
|
+
[rows]="rows"
|
|
14
|
+
[cols]="cols"
|
|
15
|
+
[formControl]="formControl"
|
|
16
|
+
[placeholder]="placeholder"
|
|
17
|
+
[required]="isRequired()"
|
|
18
|
+
[readOnly]="readonly"
|
|
19
|
+
[autoResize]="autoResize"
|
|
20
|
+
></textarea>
|
|
21
|
+
</v-form-field>
|
|
22
|
+
</ng-container>
|
|
23
|
+
<ng-container *ngIf="floatLabel">
|
|
24
|
+
<p-floatLabel>
|
|
25
|
+
<textarea
|
|
26
|
+
class="flex-grow-1"
|
|
27
|
+
pInputTextarea
|
|
28
|
+
[rows]="rows"
|
|
29
|
+
[cols]="cols"
|
|
30
|
+
[id]="inputId"
|
|
31
|
+
[formControl]="formControl"
|
|
32
|
+
[placeholder]="placeholder"
|
|
33
|
+
[required]="isRequired()"
|
|
34
|
+
[readOnly]="readonly"
|
|
35
|
+
[autoResize]="autoResize"
|
|
36
|
+
></textarea>
|
|
37
|
+
<label [for]="inputId">{{ floatLabel }}</label>
|
|
38
|
+
</p-floatLabel>
|
|
39
|
+
</ng-container>
|
|
40
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { TextareaComponent } from './textarea.component';
|
|
3
|
+
|
|
4
|
+
describe('TextareaComponent', () => {
|
|
5
|
+
let component: TextareaComponent;
|
|
6
|
+
let fixture: ComponentFixture<TextareaComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [TextareaComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(TextareaComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
2
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
3
|
+
import { TextareaComponent } from './textarea.component';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<TextareaComponent> = {
|
|
6
|
+
component: TextareaComponent,
|
|
7
|
+
title: 'TextareaComponent',
|
|
8
|
+
decorators: [
|
|
9
|
+
moduleMetadata({
|
|
10
|
+
imports: [ReactiveFormsModule],
|
|
11
|
+
}),
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<TextareaComponent>;
|
|
16
|
+
const formGroup = new FormGroup({
|
|
17
|
+
textarea: new FormControl(''),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const Primary: Story = {
|
|
21
|
+
render: (args: any) => ({
|
|
22
|
+
props: {
|
|
23
|
+
...args,
|
|
24
|
+
formGroup,
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<form [formGroup]="formGroup">
|
|
28
|
+
<v-textarea
|
|
29
|
+
formControlName="textarea"
|
|
30
|
+
[label]="label"
|
|
31
|
+
[rows]="rows"
|
|
32
|
+
[cols]="cols"
|
|
33
|
+
[disabled]="disabled"
|
|
34
|
+
[readonly]="readonly"
|
|
35
|
+
[required]="required"
|
|
36
|
+
[tooltip]="tooltip"
|
|
37
|
+
[placeholder]="placeholder"
|
|
38
|
+
[testId]="testId"
|
|
39
|
+
[formDisplay]="formDisplay"
|
|
40
|
+
[autoResize]="autoResize"
|
|
41
|
+
></v-textarea>
|
|
42
|
+
</form>
|
|
43
|
+
`,
|
|
44
|
+
}),
|
|
45
|
+
args: {
|
|
46
|
+
label: 'Description',
|
|
47
|
+
rows: 5,
|
|
48
|
+
cols: 30,
|
|
49
|
+
formDisplay: 'block',
|
|
50
|
+
autoResize: false,
|
|
51
|
+
required: false,
|
|
52
|
+
disabled: false,
|
|
53
|
+
readonly: false,
|
|
54
|
+
placeholder:
|
|
55
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
56
|
+
testId: 'testId',
|
|
57
|
+
tooltip: 'This is a tooltip lorem ipsum',
|
|
58
|
+
},
|
|
59
|
+
argTypes: {
|
|
60
|
+
formDisplay: {
|
|
61
|
+
options: ['block', 'flex'],
|
|
62
|
+
control: { type: 'radio' },
|
|
63
|
+
description:
|
|
64
|
+
'Defines if the **TextareaComponent** is in `flex` or `block` display mode',
|
|
65
|
+
},
|
|
66
|
+
label: {
|
|
67
|
+
description:
|
|
68
|
+
'Label shown on the (top)left side of the **TextareaComponent** input',
|
|
69
|
+
},
|
|
70
|
+
rows: {
|
|
71
|
+
description: 'Number of `rows` of the **TextareaComponent** input',
|
|
72
|
+
},
|
|
73
|
+
cols: {
|
|
74
|
+
description: 'Number of `columns` of the **TextareaComponent** input',
|
|
75
|
+
},
|
|
76
|
+
tooltip: { description: 'Tooltip text of the **TextareaComponent**' },
|
|
77
|
+
required: {
|
|
78
|
+
description: 'Defines if the **TextareaComponent** is `required`',
|
|
79
|
+
},
|
|
80
|
+
autoResize: {
|
|
81
|
+
description:
|
|
82
|
+
'Defines if the **TextareaComponent** should be auto-resized',
|
|
83
|
+
},
|
|
84
|
+
disabled: {
|
|
85
|
+
description: 'Defines if the **TextareaComponent** is `disabled`',
|
|
86
|
+
},
|
|
87
|
+
readonly: {
|
|
88
|
+
description: 'Defines if the **TextareaComponent** is `readonly`',
|
|
89
|
+
},
|
|
90
|
+
testId: { description: 'Test ID of the **TextareaComponent**' },
|
|
91
|
+
placeholder: {
|
|
92
|
+
description: 'Placeholder text for the **TextareaComponent**',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
parameters: {
|
|
96
|
+
controls: { expanded: true },
|
|
97
|
+
},
|
|
98
|
+
};
|