@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
@@ -1,37 +0,0 @@
1
- import { Directive, HostListener, Input } from "@angular/core";
2
-
3
- @Directive({
4
- // eslint-disable-next-line @angular-eslint/directive-selector
5
- selector: 'v-button[useShortCut]',
6
- exportAs: 'useShortCut',
7
- standalone: true,
8
- })
9
- export class ButtonShortCutDirective
10
- {
11
- @Input() shortCutFn?: () => void;
12
- @Input() shortCutKey!: string;
13
-
14
- private keyMap: { [key: string]: boolean } = {};
15
-
16
- @HostListener('document:keydown', ['$event'])
17
- onKeyDown(event: KeyboardEvent) {
18
- this.keyMap[event.key.toLowerCase()] = true;
19
- this.checkShortcut();
20
- }
21
-
22
- @HostListener('document:keyup', ['$event'])
23
- onKeyUp(event: KeyboardEvent) {
24
- this.keyMap[event.key.toLowerCase()] = false;
25
- }
26
-
27
- private checkShortcut() {
28
- if (this.shortCutKey && this.shortCutFn) {
29
- const keys = this.shortCutKey.toLowerCase().split('+');
30
- const isShortcutPressed = keys.every((key) => this.keyMap[key]);
31
- if (isShortcutPressed) {
32
- this.shortCutFn?.();
33
- keys.forEach((key) => (this.keyMap[key] = false));
34
- }
35
- }
36
- }
37
- }
@@ -1,14 +0,0 @@
1
- import { EventEmitter, Injectable, Output } from '@angular/core';
2
- import { DialogData } from '@verisoft/ui-core';
3
-
4
- @Injectable({
5
- providedIn: 'root',
6
- })
7
- export class DialogService {
8
- @Output() showEvent: EventEmitter<DialogData> =
9
- new EventEmitter<DialogData>();
10
-
11
- showDialog(data: DialogData): void {
12
- this.showEvent.emit(data);
13
- }
14
- }
@@ -1,90 +0,0 @@
1
- import {
2
- Injectable,
3
- ViewContainerRef,
4
- Type,
5
- ComponentFactoryResolver,
6
- Injector,
7
- ComponentRef,
8
- ComponentFactory,
9
- OnInit,
10
- OnChanges,
11
- SimpleChanges,
12
- SimpleChange,
13
- } from '@angular/core';
14
-
15
- @Injectable({
16
- providedIn: 'root',
17
- })
18
- export class DynamicComponentFactoryService {
19
- constructor(private componentFactoryResolver: ComponentFactoryResolver) {}
20
-
21
- async createDynamicComponent<TComponent>(
22
- componentType: Type<TComponent>,
23
- viewContainerRef: ViewContainerRef,
24
- inputs: Partial<TComponent>,
25
- injector: Injector | undefined = undefined
26
- ) {
27
- const componentFactory =
28
- this.componentFactoryResolver.resolveComponentFactory(componentType);
29
- viewContainerRef.clear();
30
- const component = viewContainerRef.createComponent(
31
- componentFactory,
32
- undefined,
33
- injector
34
- );
35
-
36
- this.setComponentDataInt(componentFactory, component, inputs);
37
- this.fireComponentEvents(component.instance, inputs);
38
- return component;
39
- }
40
-
41
- setComponentData<TComponent>(
42
- component: ComponentRef<TComponent>,
43
- inputs: Partial<TComponent>
44
- ) {
45
- const factory = this.componentFactoryResolver.resolveComponentFactory(
46
- component.componentType
47
- );
48
-
49
- this.setComponentDataInt(factory, component, inputs);
50
- }
51
-
52
- private fireComponentEvents<TComponent>(instance: TComponent, inputs: Partial<TComponent>) {
53
- if (instance) {
54
- const onChangeComponent = instance as unknown as OnChanges;
55
- if (onChangeComponent.ngOnChanges && inputs) {
56
- const changeEventArgs = Object.keys(inputs).reduce((changes: SimpleChanges, key: string) => {
57
- const inputValue = (inputs as { [key: string]: unknown })[key];
58
- changes[key] = new SimpleChange(undefined, inputValue, true);
59
- return changes;
60
- }, {} as SimpleChanges);
61
-
62
-
63
- onChangeComponent.ngOnChanges(changeEventArgs);
64
- }
65
-
66
- const onInitComponent = instance as unknown as OnInit;
67
- if (onInitComponent.ngOnInit) {
68
- onInitComponent.ngOnInit();
69
- }
70
- }
71
- }
72
-
73
- private setComponentDataInt<TComponent>(
74
- factory: ComponentFactory<TComponent>,
75
- component: ComponentRef<TComponent>,
76
- inputs: Partial<TComponent>
77
- ) {
78
- if (inputs) {
79
- const propertyNames = factory.inputs.map((x) => x.propName);
80
- const inputsHash = new Set(propertyNames);
81
- Object.keys(inputs)
82
- .filter((x) => inputsHash.has(x))
83
- .forEach((x) => {
84
- (<{ [key: string]: unknown }>component.instance)[x] = (<
85
- { [key: string]: unknown }
86
- >inputs)[x];
87
- });
88
- }
89
- }
90
- }
@@ -1,25 +0,0 @@
1
- import { Directive, Input } from '@angular/core';
2
- import { GenericFieldType, GenericFieldTypeType } from '../../generic-field';
3
- import { GenericFieldDefinition } from '../../generic-form';
4
-
5
- @Directive({
6
- // eslint-disable-next-line @angular-eslint/directive-selector
7
- selector: 'v-filter-field',
8
- standalone: true,
9
- })
10
- export class FilterFieldDirective implements GenericFieldDefinition {
11
-
12
- @Input({ required: true }) name!: string;
13
-
14
- @Input() type?: GenericFieldTypeType | undefined = GenericFieldType.text;
15
-
16
- @Input() label?: string | undefined;
17
-
18
- @Input() optionLabel!: string;
19
-
20
- @Input() optionValue?: string | undefined;
21
-
22
- @Input() options?: unknown[] | undefined;
23
-
24
- @Input() value?: unknown;
25
- }
@@ -1,22 +0,0 @@
1
- import { Directive, inject, Input } from '@angular/core';
2
- import { UnsubscribeComponent } from '@verisoft/ui-core';
3
- import { TableComponent } from '../../table/table.component';
4
- import { FilterComponent } from '../filter.component';
5
-
6
- @Directive({
7
- // eslint-disable-next-line @angular-eslint/directive-selector
8
- selector: 'v-filter[tableFilter]',
9
- exportAs: 'tableFilter',
10
- standalone: true,
11
- })
12
- export class TableFilterDirective<T> extends UnsubscribeComponent {
13
- @Input({ required: true }) for!: TableComponent<T>;
14
-
15
- @Input() ignoreQueryParamsFor?: string[];
16
-
17
- @Input() useRouter = false;
18
-
19
- protected removeIds: string[] = [];
20
-
21
- filterComponent = inject(FilterComponent, { self: true });
22
- }
@@ -1,18 +0,0 @@
1
- import { FormGroup } from "@angular/forms";
2
-
3
- export function getFilledControlCount(formGroup: FormGroup){
4
- let count = 0;
5
- Object.keys(formGroup.controls).forEach((key) => {
6
- const control = formGroup.get(key);
7
- if (control?.value) {
8
- if (typeof control.value === 'boolean') {
9
- count++;
10
- }
11
- if (typeof control.value === 'string' && control.value.trim() !== '') {
12
- count++;
13
- }
14
- }
15
- });
16
-
17
- return count;
18
- }
@@ -1,54 +0,0 @@
1
- @if (!type || type === fieldTypes.text) {
2
- <v-textfield
3
- [label]="label"
4
- [floatLabel]="floatLabel === true"
5
- [size]="size"
6
- [formControl]="formControl"
7
- ></v-textfield>
8
- } @if (type === fieldTypes.dropdown) {
9
- <v-dropdown
10
- [label]="!floatLabel ? label : ''"
11
- [floatLabel]="floatLabel ? label : ''"
12
- [testId]="testId"
13
- [options]="options"
14
- [optionLabel]="optionLabel"
15
- [optionValue]="optionValue ?? optionLabel"
16
- [loading]="loading"
17
- [formControl]="formControl"
18
- (changeEvent)="changed.emit($event)"
19
- (clearEvent)="cleared.emit($event)"
20
- (lazyLoadEvent)="lazyLoad.emit($any($event))"
21
- (showEvent)="showed.emit($event)"
22
- >
23
- </v-dropdown>
24
- } @else if (type === fieldTypes.multiselect) {
25
- <v-multiselect
26
- [label]="!floatLabel ? label : ''"
27
- [floatLabel]="floatLabel ? label : ''"
28
- [testId]="testId"
29
- [options]="options"
30
- [optionLabel]="optionLabel"
31
- [optionValue]="optionValue ?? optionLabel"
32
- [loading]="loading"
33
- [formControl]="formControl"
34
- (changeEvent)="changed.emit($event)"
35
- (clearEvent)="cleared.emit($event)"
36
- (lazyLoadEvent)="lazyLoad.emit($any($event))"
37
- (showEvent)="showed.emit($event)"
38
- >
39
- </v-multiselect>
40
- } @else if (type === fieldTypes.checkbox) {
41
- <v-tristatecheckbox
42
- [label]="label"
43
- [testId]="testId"
44
- [formControl]="formControl"
45
- ></v-tristatecheckbox>
46
- } @else if (type === fieldTypes.calendar) {
47
- <v-calendar
48
- [label]="!floatLabel ? label : ''"
49
- [floatLabel]="floatLabel ? label : ''"
50
- [testId]="testId"
51
- [formControl]="formControl"
52
- icon="pi pi-calendar"
53
- ></v-calendar>
54
- }
@@ -1,9 +0,0 @@
1
- export enum GenericFieldType {
2
- 'dropdown' = 'dropdown',
3
- 'checkbox' = 'checkbox',
4
- 'calendar' = 'calendar',
5
- 'multiselect' = 'multiselect',
6
- 'text' = 'text',
7
- }
8
-
9
- export type GenericFieldTypeType = keyof typeof GenericFieldType;
@@ -1,33 +0,0 @@
1
- @if (formGroupComputed) {
2
- <div class="v-generic-form row" [formGroup]="formGroupComputed">
3
- @for(field of fields; track field){ @if (columnClass) {
4
- <div class="v-generic-form__column {{ columnClass }}">
5
- <v-generic-field
6
- [type]="field.type"
7
- [label]="field.label"
8
- [floatLabel]="field.floatLabel"
9
- [testId]="field.testId"
10
- [options]="field.options"
11
- [optionLabel]="field.optionLabel"
12
- [optionValue]="field.optionValue ?? field.optionLabel"
13
- [options]="field.options"
14
- [size]="field.size"
15
- [formControlName]="field.name"
16
- ></v-generic-field>
17
- </div>
18
- } @else {
19
- <v-generic-field
20
- [type]="field.type"
21
- [label]="field.label"
22
- [floatLabel]="field.floatLabel"
23
- [testId]="field.testId"
24
- [options]="field.options"
25
- [optionLabel]="field.optionLabel"
26
- [optionValue]="field.optionValue ?? field.optionLabel"
27
- [options]="field.options"
28
- [size]="field.size"
29
- [formControlName]="field.name"
30
- ></v-generic-field>
31
- } }
32
- </div>
33
- }
@@ -1,9 +0,0 @@
1
- import { EventEmitter, Injectable, Output } from '@angular/core';
2
- import { PageHeader } from '@verisoft/ui-core';
3
-
4
- @Injectable({
5
- providedIn: 'root',
6
- })
7
- export class PageHeaderService {
8
- @Output() pageHeader = new EventEmitter<PageHeader>();
9
- }
@@ -1,61 +0,0 @@
1
- import { AfterViewInit, Directive, inject, Input, OnInit } from '@angular/core';
2
- import { Store } from '@ngrx/store';
3
- import { DatasourceType } from '@verisoft/core';
4
- import {
5
- createGetPageTableAction,
6
- } from '@verisoft/store';
7
- import { UnsubscribeComponent } from '@verisoft/ui-core';
8
- import { TableComponent } from '../table.component';
9
-
10
- @Directive({
11
- // eslint-disable-next-line @angular-eslint/directive-selector
12
- selector: 'v-table[tableStore]',
13
- exportAs: 'useTableStore',
14
- standalone: true,
15
- })
16
- export class TableStoreDirective<T>
17
- extends UnsubscribeComponent
18
- implements OnInit, AfterViewInit
19
- {
20
- store = inject(Store);
21
- table = inject(TableComponent, { self: true });
22
-
23
- @Input() autoBind = false;
24
-
25
- @Input() ngrxFeatureKey?: string;
26
-
27
- @Input({ required: true }) tableName!: string;
28
-
29
- @Input() debounceTime = 0;
30
-
31
- @Input() defaultFilter!: Partial<any>;
32
-
33
- @Input() datasource?: DatasourceType<T>;
34
-
35
- ngOnInit(): void {
36
- if (!this.tableName) {
37
- throw new Error('Property tableName must be defined.');
38
- }
39
- }
40
-
41
- ngAfterViewInit(): void {
42
- if (this.autoBind) {
43
- this.submit(true);
44
- }
45
- }
46
-
47
- submit(resetPagination: boolean) {
48
- const filter = {
49
- ...this.defaultFilter,
50
- };
51
- const sorters = this.table.sorters;
52
- this.store.dispatch(
53
- createGetPageTableAction(this.tableName)({
54
- page: resetPagination ? 0 : this.table.currentPage,
55
- size: this.table.pageSize,
56
- filter: filter,
57
- sort: sorters,
58
- })
59
- );
60
- }
61
- }
@@ -1,205 +0,0 @@
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>
@@ -1,21 +0,0 @@
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
- });
@@ -1,23 +0,0 @@
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
- };
@@ -1,25 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { BehaviorSubject } from 'rxjs';
3
-
4
- @Injectable({
5
- providedIn: 'root',
6
- })
7
- export class ScreenSizeService {
8
- isMobileBlock = new BehaviorSubject<boolean>(false);
9
- prevState = false;
10
-
11
- constructor() {
12
- this.checkScreenSize();
13
- window.addEventListener('resize', async () => {
14
- await this.checkScreenSize();
15
- });
16
- }
17
-
18
- async checkScreenSize() {
19
- const isMobile = window.matchMedia('(max-width: 768px)').matches;
20
- if (isMobile !== this.prevState) {
21
- this.prevState = isMobile;
22
- this.isMobileBlock.next(isMobile);
23
- }
24
- }
25
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes