@verisoft/ui-primeng 20.1.1 → 20.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/fesm2022/verisoft-ui-primeng.mjs +3005 -0
  2. package/fesm2022/verisoft-ui-primeng.mjs.map +1 -0
  3. package/index.d.ts +752 -0
  4. package/package.json +18 -6
  5. package/.eslintrc.json +0 -43
  6. package/assets/.gitkeep +0 -0
  7. package/jest.config.ts +0 -22
  8. package/ng-package.json +0 -14
  9. package/project.json +0 -36
  10. package/src/index.ts +0 -34
  11. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -11
  12. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -18
  13. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -21
  14. package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +0 -36
  15. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -27
  16. package/src/lib/components/breadcrumb/breadcrumb.pipe.ts +0 -13
  17. package/src/lib/components/breadcrumb/index.ts +0 -1
  18. package/src/lib/components/button/button-severity.pipe.ts +0 -20
  19. package/src/lib/components/button/button.component.html +0 -20
  20. package/src/lib/components/button/button.component.scss +0 -0
  21. package/src/lib/components/button/button.component.spec.ts +0 -21
  22. package/src/lib/components/button/button.component.ts +0 -49
  23. package/src/lib/components/button/index.ts +0 -1
  24. package/src/lib/components/calendar/calendar.component.html +0 -53
  25. package/src/lib/components/calendar/calendar.component.scss +0 -0
  26. package/src/lib/components/calendar/calendar.component.spec.ts +0 -21
  27. package/src/lib/components/calendar/calendar.component.ts +0 -70
  28. package/src/lib/components/calendar/index.ts +0 -1
  29. package/src/lib/components/checkbox/checkbox.component.html +0 -20
  30. package/src/lib/components/checkbox/checkbox.component.scss +0 -15
  31. package/src/lib/components/checkbox/checkbox.component.spec.ts +0 -21
  32. package/src/lib/components/checkbox/checkbox.component.stories.ts +0 -72
  33. package/src/lib/components/checkbox/checkbox.component.ts +0 -46
  34. package/src/lib/components/checkbox/index.ts +0 -1
  35. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +0 -51
  36. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +0 -3
  37. package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +0 -21
  38. package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +0 -74
  39. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +0 -73
  40. package/src/lib/components/confirm-dialog/index.ts +0 -1
  41. package/src/lib/components/dropdown/dropdown.component.html +0 -93
  42. package/src/lib/components/dropdown/dropdown.component.scss +0 -16
  43. package/src/lib/components/dropdown/dropdown.component.spec.ts +0 -21
  44. package/src/lib/components/dropdown/dropdown.component.ts +0 -139
  45. package/src/lib/components/dropdown/index.ts +0 -1
  46. package/src/lib/components/dropdown-button/dropdown-button.component.html +0 -1
  47. package/src/lib/components/dropdown-button/dropdown-button.component.ts +0 -20
  48. package/src/lib/components/dropdown-button/index.ts +0 -1
  49. package/src/lib/components/errors/error.component.html +0 -7
  50. package/src/lib/components/errors/error.component.scss +0 -3
  51. package/src/lib/components/errors/error.component.ts +0 -34
  52. package/src/lib/components/errors/index.ts +0 -1
  53. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +0 -32
  54. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +0 -8
  55. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +0 -21
  56. package/src/lib/components/feature-list/feature-list-page.component.ts +0 -32
  57. package/src/lib/components/feature-list/feature-list-page.model.ts +0 -42
  58. package/src/lib/components/feature-list/feature-list.component.html +0 -59
  59. package/src/lib/components/feature-list/feature-list.component.scss +0 -10
  60. package/src/lib/components/feature-list/feature-list.component.ts +0 -341
  61. package/src/lib/components/feature-list/index.ts +0 -5
  62. package/src/lib/components/filter/directives/filter-field.directive.ts +0 -34
  63. package/src/lib/components/filter/filter.component.html +0 -68
  64. package/src/lib/components/filter/filter.component.scss +0 -0
  65. package/src/lib/components/filter/filter.component.spec.ts +0 -21
  66. package/src/lib/components/filter/filter.component.stories.ts +0 -23
  67. package/src/lib/components/filter/filter.component.ts +0 -281
  68. package/src/lib/components/filter/filter.model.ts +0 -18
  69. package/src/lib/components/filter/index.ts +0 -2
  70. package/src/lib/components/form-field/form-field.component.html +0 -42
  71. package/src/lib/components/form-field/form-field.component.scss +0 -0
  72. package/src/lib/components/form-field/form-field.component.spec.ts +0 -21
  73. package/src/lib/components/form-field/form-field.component.stories.ts +0 -69
  74. package/src/lib/components/form-field/form-field.component.ts +0 -37
  75. package/src/lib/components/form-field/index.ts +0 -1
  76. package/src/lib/components/header/header.component.html +0 -84
  77. package/src/lib/components/header/header.component.scss +0 -0
  78. package/src/lib/components/header/header.component.spec.ts +0 -21
  79. package/src/lib/components/header/header.component.stories.ts +0 -24
  80. package/src/lib/components/header/header.component.ts +0 -65
  81. package/src/lib/components/header/index.ts +0 -2
  82. package/src/lib/components/header/services/header-provider.service.ts +0 -15
  83. package/src/lib/components/icon/icon.component.html +0 -2
  84. package/src/lib/components/icon/icon.component.scss +0 -51
  85. package/src/lib/components/icon/icon.component.ts +0 -86
  86. package/src/lib/components/icon/index.ts +0 -2
  87. package/src/lib/components/input-group/index.ts +0 -1
  88. package/src/lib/components/input-group/input-group.component.html +0 -34
  89. package/src/lib/components/input-group/input-group.component.spec.ts +0 -21
  90. package/src/lib/components/input-group/input-group.component.ts +0 -58
  91. package/src/lib/components/loader/index.ts +0 -1
  92. package/src/lib/components/loader/loader.component.html +0 -5
  93. package/src/lib/components/loader/loader.component.scss +0 -0
  94. package/src/lib/components/loader/loader.component.spec.ts +0 -21
  95. package/src/lib/components/loader/loader.component.ts +0 -16
  96. package/src/lib/components/multiselect/index.ts +0 -1
  97. package/src/lib/components/multiselect/multiselect.component.html +0 -67
  98. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  99. package/src/lib/components/multiselect/multiselect.component.spec.ts +0 -21
  100. package/src/lib/components/multiselect/multiselect.component.ts +0 -120
  101. package/src/lib/components/number-input/index.ts +0 -1
  102. package/src/lib/components/number-input/number-input.component.html +0 -22
  103. package/src/lib/components/number-input/number-input.component.spec.ts +0 -21
  104. package/src/lib/components/number-input/number-input.component.ts +0 -55
  105. package/src/lib/components/page-header/index.ts +0 -1
  106. package/src/lib/components/page-header/page-header.component.html +0 -35
  107. package/src/lib/components/page-header/page-header.component.scss +0 -0
  108. package/src/lib/components/page-header/page-header.component.spec.ts +0 -21
  109. package/src/lib/components/page-header/page-header.component.ts +0 -31
  110. package/src/lib/components/password/index.ts +0 -1
  111. package/src/lib/components/password/password.component.html +0 -24
  112. package/src/lib/components/password/password.component.scss +0 -0
  113. package/src/lib/components/password/password.component.spec.ts +0 -21
  114. package/src/lib/components/password/password.component.ts +0 -56
  115. package/src/lib/components/radiobutton/index.ts +0 -1
  116. package/src/lib/components/radiobutton/radiobutton.component.html +0 -34
  117. package/src/lib/components/radiobutton/radiobutton.component.scss +0 -6
  118. package/src/lib/components/radiobutton/radiobutton.component.spec.ts +0 -21
  119. package/src/lib/components/radiobutton/radiobutton.component.stories.ts +0 -71
  120. package/src/lib/components/radiobutton/radiobutton.component.ts +0 -61
  121. package/src/lib/components/section/index.ts +0 -1
  122. package/src/lib/components/section/section.component.html +0 -25
  123. package/src/lib/components/section/section.component.scss +0 -0
  124. package/src/lib/components/section/section.component.spec.ts +0 -21
  125. package/src/lib/components/section/section.component.ts +0 -31
  126. package/src/lib/components/shared-components/.eslintrc.json +0 -42
  127. package/src/lib/components/shared-components/action-button-group/action-button-group.component.html +0 -25
  128. package/src/lib/components/shared-components/action-button-group/action-button-group.component.scss +0 -0
  129. package/src/lib/components/shared-components/action-button-group/action-button-group.component.spec.ts +0 -21
  130. package/src/lib/components/shared-components/action-button-group/action-button-group.component.ts +0 -111
  131. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.html +0 -10
  132. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.scss +0 -0
  133. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.spec.ts +0 -21
  134. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +0 -69
  135. package/src/lib/components/shared-components/action-button-group/index.ts +0 -2
  136. package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +0 -142
  137. package/src/lib/components/shared-components/dynamic-component/dynamic-component.component.ts +0 -56
  138. package/src/lib/components/shared-components/dynamic-component/index.ts +0 -2
  139. package/src/lib/components/shared-components/generic-field/generic-field.component.html +0 -98
  140. package/src/lib/components/shared-components/generic-field/generic-field.component.spec.ts +0 -21
  141. package/src/lib/components/shared-components/generic-field/generic-field.component.ts +0 -90
  142. package/src/lib/components/shared-components/generic-field/index.ts +0 -1
  143. package/src/lib/components/shared-components/generic-form/generic-form.component.html +0 -46
  144. package/src/lib/components/shared-components/generic-form/generic-form.component.spec.ts +0 -21
  145. package/src/lib/components/shared-components/generic-form/generic-form.component.ts +0 -56
  146. package/src/lib/components/shared-components/generic-form/generic-form.model.spec.ts +0 -82
  147. package/src/lib/components/shared-components/generic-form/generic-form.model.ts +0 -68
  148. package/src/lib/components/shared-components/generic-form/index.ts +0 -2
  149. package/src/lib/components/shared-components/index.ts +0 -4
  150. package/src/lib/components/side-menu/index.ts +0 -2
  151. package/src/lib/components/side-menu/side-menu.component.html +0 -53
  152. package/src/lib/components/side-menu/side-menu.component.scss +0 -0
  153. package/src/lib/components/side-menu/side-menu.component.spec.ts +0 -21
  154. package/src/lib/components/side-menu/side-menu.component.ts +0 -96
  155. package/src/lib/components/side-menu/side-menu.module.ts +0 -66
  156. package/src/lib/components/slider/index.ts +0 -1
  157. package/src/lib/components/slider/slider.component.html +0 -19
  158. package/src/lib/components/slider/slider.component.spec.ts +0 -21
  159. package/src/lib/components/slider/slider.component.ts +0 -56
  160. package/src/lib/components/snackbar/index.ts +0 -2
  161. package/src/lib/components/snackbar/services/snackbar.service.ts +0 -45
  162. package/src/lib/components/snackbar/snackbar.component.html +0 -3
  163. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  164. package/src/lib/components/snackbar/snackbar.component.spec.ts +0 -21
  165. package/src/lib/components/snackbar/snackbar.component.stories.ts +0 -70
  166. package/src/lib/components/snackbar/snackbar.component.ts +0 -25
  167. package/src/lib/components/stepper/index.ts +0 -1
  168. package/src/lib/components/stepper/stepper.component.html +0 -35
  169. package/src/lib/components/stepper/stepper.component.spec.ts +0 -21
  170. package/src/lib/components/stepper/stepper.component.ts +0 -39
  171. package/src/lib/components/switch/index.ts +0 -1
  172. package/src/lib/components/switch/switch.component.html +0 -18
  173. package/src/lib/components/switch/switch.component.scss +0 -0
  174. package/src/lib/components/switch/switch.component.spec.ts +0 -21
  175. package/src/lib/components/switch/switch.component.stories.ts +0 -65
  176. package/src/lib/components/switch/switch.component.ts +0 -52
  177. package/src/lib/components/tab-view/index.ts +0 -2
  178. package/src/lib/components/tab-view/tab-view-item.component.ts +0 -22
  179. package/src/lib/components/tab-view/tab-view.component.html +0 -41
  180. package/src/lib/components/tab-view/tab-view.component.ts +0 -55
  181. package/src/lib/components/table/index.ts +0 -1
  182. package/src/lib/components/table/table-filter.pipe.ts +0 -59
  183. package/src/lib/components/table/table.component.html +0 -127
  184. package/src/lib/components/table/table.component.scss +0 -11
  185. package/src/lib/components/table/table.component.spec.ts +0 -21
  186. package/src/lib/components/table/table.component.stories.ts +0 -55
  187. package/src/lib/components/table/table.component.ts +0 -288
  188. package/src/lib/components/table/table.models.ts +0 -26
  189. package/src/lib/components/tag/index.ts +0 -2
  190. package/src/lib/components/tag/tag.component.html +0 -12
  191. package/src/lib/components/tag/tag.component.scss +0 -33
  192. package/src/lib/components/tag/tag.component.ts +0 -83
  193. package/src/lib/components/textarea/index.ts +0 -1
  194. package/src/lib/components/textarea/textarea.component.html +0 -40
  195. package/src/lib/components/textarea/textarea.component.scss +0 -5
  196. package/src/lib/components/textarea/textarea.component.spec.ts +0 -21
  197. package/src/lib/components/textarea/textarea.component.stories.ts +0 -98
  198. package/src/lib/components/textarea/textarea.component.ts +0 -62
  199. package/src/lib/components/textfield/index.ts +0 -1
  200. package/src/lib/components/textfield/textfield.component.html +0 -82
  201. package/src/lib/components/textfield/textfield.component.scss +0 -23
  202. package/src/lib/components/textfield/textfield.component.spec.ts +0 -21
  203. package/src/lib/components/textfield/textfield.component.stories.ts +0 -85
  204. package/src/lib/components/textfield/textfield.component.ts +0 -68
  205. package/src/lib/components/tooltip/index.ts +0 -1
  206. package/src/lib/components/tooltip/tooltip.component.html +0 -3
  207. package/src/lib/components/tooltip/tooltip.component.ts +0 -17
  208. package/src/lib/icons.ts +0 -36
  209. package/src/lib/interceptors/http-error-message.interceptor.ts +0 -35
  210. package/src/lib/pages/not-found-page/not-found-page.component.html +0 -26
  211. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  212. package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +0 -21
  213. package/src/lib/pages/not-found-page/not-found-page.component.ts +0 -16
  214. package/src/tab-view.ts +0 -1
  215. package/src/test-setup.ts +0 -8
  216. package/tsconfig.json +0 -29
  217. package/tsconfig.lib.json +0 -18
  218. package/tsconfig.lib.prod.json +0 -9
  219. package/tsconfig.spec.json +0 -16
@@ -1,111 +0,0 @@
1
- import {
2
- AfterContentInit,
3
- ChangeDetectionStrategy,
4
- ChangeDetectorRef,
5
- Component,
6
- ContentChildren,
7
- Input,
8
- QueryList,
9
- } from '@angular/core';
10
- import {
11
- ACTION_BUTTON_GROUP_COMPONENT_TOKEN,
12
- ActionButton,
13
- ActionButtonGroupCore,
14
- IconPositionType,
15
- MenuItem,
16
- queryListChanged,
17
- ScreenSizeService,
18
- UnsubscribeComponent,
19
- } from '@verisoft/ui-core';
20
- import {
21
- combineLatestWith,
22
- takeUntil,
23
- } from 'rxjs';
24
- import { Icons } from '../../../icons';
25
- import { DropdownButtonComponent } from '../../dropdown-button';
26
- import { ActionButtonComponent } from './components/action-button/action-button.component';
27
-
28
- @Component({
29
- selector: 'v-action-button-group',
30
- imports: [ActionButtonComponent, DropdownButtonComponent],
31
- templateUrl: './action-button-group.component.html',
32
- styleUrl: './action-button-group.component.scss',
33
- changeDetection: ChangeDetectionStrategy.OnPush,
34
- providers: [
35
- {
36
- provide: ACTION_BUTTON_GROUP_COMPONENT_TOKEN,
37
- useExisting: ActionButtonGroupComponent,
38
- },
39
- ]
40
- })
41
- export class ActionButtonGroupComponent
42
- extends UnsubscribeComponent
43
- implements AfterContentInit, ActionButtonGroupCore {
44
- @ContentChildren(ActionButtonComponent)
45
- actions!: QueryList<ActionButtonComponent>;
46
-
47
- @Input() maxItems = 3;
48
-
49
- @Input() maxItemsMobile = 0;
50
-
51
- @Input() items: ActionButton[] = [];
52
-
53
- @Input() menuIconPos: IconPositionType = 'right';
54
-
55
- @Input() menuIcon = Icons.action;
56
-
57
- @Input() label?: string;
58
-
59
- @Input() icon?: string;
60
-
61
- icons = Icons;
62
- allItems: ActionButton[] = [];
63
- visibleActions: ActionButton[] = [];
64
- menuItems: MenuItem[] = [];
65
-
66
- constructor(
67
- private readonly changeDetectorRef: ChangeDetectorRef,
68
- readonly screenSizeService: ScreenSizeService
69
- ) {
70
- super();
71
- }
72
-
73
- ngAfterContentInit(): void {
74
- this.subscribeItemChange();
75
- }
76
-
77
- fireClick(item: ActionButton, event: MouseEvent) {
78
- event.stopPropagation();
79
- item.click.emit();
80
- }
81
-
82
- private subscribeItemChange(): void {
83
- const screenResize$ = this.screenSizeService.isMobileBlock;
84
-
85
- const actions$ = queryListChanged(this.actions);
86
-
87
- screenResize$
88
- .pipe(takeUntil(this.destroyed$), combineLatestWith(actions$))
89
- .subscribe(([isMobile, actions]) => {
90
- this.computeItems(actions, isMobile);
91
- });
92
- }
93
-
94
- private computeItems(actions: ActionButton[], isMobile: boolean) {
95
- const allItems = [...(this.items ?? []), ...actions];
96
- const maxItems = isMobile ? this.maxItemsMobile : this.maxItems;
97
- this.visibleActions = allItems.slice(0, maxItems);
98
- this.menuItems = allItems.slice(maxItems).map(this.convertToMenuItem);
99
- this.changeDetectorRef.detectChanges();
100
- }
101
-
102
- private convertToMenuItem(item: ActionButton): MenuItem {
103
- return {
104
- label: item.label,
105
- icon: item.icon,
106
- command: () => {
107
- item.click.emit();
108
- },
109
- };
110
- }
111
- }
@@ -1,10 +0,0 @@
1
- <v-button
2
- [label]="label"
3
- [disabled]="disabled"
4
- [icon]="icon"
5
- [outlined]="outlined"
6
- tooltipPosition="bottom"
7
- [size]="size"
8
- [severity]="severity"
9
- (click)="handleClick($event)"
10
- />
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { ActionButtonComponent } from './action-button.component';
3
-
4
- describe('ActionButtonComponent', () => {
5
- let component: ActionButtonComponent;
6
- let fixture: ComponentFixture<ActionButtonComponent>;
7
-
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [ActionButtonComponent],
11
- }).compileComponents();
12
-
13
- fixture = TestBed.createComponent(ActionButtonComponent);
14
- component = fixture.componentInstance;
15
- fixture.detectChanges();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });
@@ -1,69 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- EventEmitter,
5
- inject,
6
- Input,
7
- OnChanges,
8
- Output,
9
- SimpleChanges,
10
- } from '@angular/core';
11
- import {
12
- ACTION_BUTTON_GROUP_COMPONENT_TOKEN,
13
- ActionButton,
14
- ActionButtonGroupCore,
15
- ControlSeverityType,
16
- FieldSizeType,
17
- } from '@verisoft/ui-core';
18
- import { Observable, Subject } from 'rxjs';
19
- import { Icons } from '../../../../../icons';
20
- import { ButtonComponent } from '../../../../button';
21
-
22
- @Component({
23
- selector: 'v-action-button',
24
- imports: [ButtonComponent],
25
- templateUrl: './action-button.component.html',
26
- styleUrl: './action-button.component.scss',
27
- changeDetection: ChangeDetectionStrategy.OnPush
28
- })
29
- export class ActionButtonComponent implements ActionButton, OnChanges {
30
- @Input() disabled = false;
31
- @Input() toolTip?: string;
32
- @Input() id?: string;
33
- @Input() icon?: string;
34
- @Input() outlined = false;
35
- @Input() raised = false;
36
- @Input() severity?: ControlSeverityType;
37
- @Input() label?: string;
38
- @Input() size?: FieldSizeType;
39
- // eslint-disable-next-line @angular-eslint/no-output-native
40
- @Output() click = new EventEmitter<MouseEvent>();
41
-
42
- icons = Icons
43
-
44
- private propertyChangeSubject = new Subject();
45
-
46
- propertyChanged: Observable<unknown> =
47
- this.propertyChangeSubject.asObservable();
48
-
49
- buttonGroup: ActionButtonGroupCore | null = inject<ActionButtonGroupCore>(
50
- ACTION_BUTTON_GROUP_COMPONENT_TOKEN,
51
- {
52
- optional: true,
53
- }
54
- );
55
-
56
- ngOnChanges(changes: SimpleChanges): void {
57
- const isValueChange = Object.keys(changes).some(
58
- (x) => !changes[x].firstChange
59
- );
60
- if (isValueChange) {
61
- this.propertyChangeSubject.next(null);
62
- }
63
- }
64
-
65
- handleClick(event: MouseEvent) {
66
- event.stopPropagation();
67
- this.click.emit(event);
68
- }
69
- }
@@ -1,2 +0,0 @@
1
- export * from './action-button-group.component';
2
- export * from './components/action-button/action-button.component';
@@ -1,142 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import {
3
- Injectable,
4
- ViewContainerRef,
5
- Type,
6
- ComponentFactoryResolver,
7
- Injector,
8
- ComponentRef,
9
- ComponentFactory,
10
- OnChanges,
11
- SimpleChanges,
12
- SimpleChange,
13
- EventEmitter,
14
- OnDestroy,
15
- } from '@angular/core';
16
- import { ExtendedComponent } from '@verisoft/ui-core';
17
- import { Subscription } from 'rxjs';
18
-
19
- @Injectable({
20
- providedIn: 'root',
21
- })
22
- export class DynamicComponentFactoryService implements OnDestroy {
23
- constructor(private componentFactoryResolver: ComponentFactoryResolver) { }
24
-
25
- ngOnDestroy(): void {
26
- this.unsubscribeComponentEvents(this);
27
- }
28
-
29
- async createDynamicComponent<TComponent>(
30
- componentType: Type<TComponent>,
31
- viewContainerRef: ViewContainerRef,
32
- inputs: ExtendedComponent<TComponent>,
33
- injector: Injector | undefined = undefined
34
- ) {
35
- const componentFactory =
36
- this.componentFactoryResolver.resolveComponentFactory(componentType);
37
- viewContainerRef.clear();
38
- const component = viewContainerRef.createComponent(
39
- componentFactory,
40
- undefined,
41
- injector
42
- );
43
- this.setComponentDataInt(componentFactory, component, inputs);
44
- this.fireComponentEvents(component.instance, inputs);
45
- return component;
46
- }
47
-
48
- setComponentData<TComponent>(
49
- component: ComponentRef<TComponent>,
50
- inputs: Partial<TComponent>
51
- ) {
52
- const factory = this.componentFactoryResolver.resolveComponentFactory(
53
- component.componentType
54
- );
55
-
56
- this.setComponentDataInt(factory, component, inputs);
57
- }
58
-
59
- private unsubscribeComponentEvents<TComponent>(instance: TComponent) {
60
- const subscriptionStoreKey = '__outputSubscriptions__';
61
- const subscriptions = (instance as any)[subscriptionStoreKey] as Map<string, Subscription>;
62
-
63
- if (subscriptions) {
64
- subscriptions.forEach((sub) => sub.unsubscribe());
65
- subscriptions.clear();
66
- }
67
- }
68
-
69
- private fireComponentEvents<TComponent>(
70
- instance: TComponent,
71
- inputs: ExtendedComponent<TComponent>
72
- ) {
73
- if (!instance || typeof instance !== 'object') return;
74
-
75
- this.fireInputComponentEvents(instance, inputs);
76
- this.fireOutputComponentEvents(instance, inputs);
77
- }
78
-
79
- private setComponentDataInt<TComponent>(
80
- factory: ComponentFactory<TComponent>,
81
- component: ComponentRef<TComponent>,
82
- inputs: Partial<TComponent>
83
- ) {
84
- if (inputs) {
85
- const propertyNames = factory.inputs.map((x) => x.propName);
86
- const inputsHash = new Set(propertyNames);
87
- Object.keys(inputs)
88
- .filter((x) => inputsHash.has(x))
89
- .forEach((x) => {
90
- (<{ [key: string]: unknown }>component.instance)[x] = (<
91
- { [key: string]: unknown }
92
- >inputs)[x];
93
- });
94
- }
95
- }
96
-
97
- private fireInputComponentEvents<TComponent>(
98
- instance: TComponent,
99
- inputs: ExtendedComponent<TComponent>
100
- ) {
101
- const onChangeComponent = instance as unknown as OnChanges;
102
- if (onChangeComponent.ngOnChanges && inputs) {
103
- const changeEventArgs = Object.keys(inputs).reduce((changes: SimpleChanges, key: string) => {
104
- const inputValue = (inputs as { [key: string]: unknown })[key];
105
- changes[key] = new SimpleChange(undefined, inputValue, true);
106
- return changes;
107
- }, {} as SimpleChanges);
108
-
109
- onChangeComponent.ngOnChanges(changeEventArgs);
110
- }
111
- }
112
-
113
- private fireOutputComponentEvents<TComponent>(
114
- instance: TComponent & object,
115
- inputs: ExtendedComponent<TComponent>
116
- ) {
117
- const outputs = Object.keys(inputs).filter((key) => {
118
- const emitter = (instance as Record<string, any>)[key];
119
- return emitter instanceof EventEmitter;
120
- });
121
-
122
- const subscriptionStoreKey = '__outputSubscriptions__';
123
- if (!(subscriptionStoreKey in instance)) {
124
- (instance as any)[subscriptionStoreKey] = new Map<string, Subscription>();
125
- }
126
- const subscriptions = (instance as any)[subscriptionStoreKey] as Map<string, Subscription>;
127
-
128
- for (const outputKey of outputs) {
129
- const eventEmitter = (instance as Record<string, any>)[outputKey] as EventEmitter<any>;
130
- const callback = inputs[outputKey] as (value: any) => void;
131
-
132
- if (eventEmitter && typeof callback === 'function') {
133
- if (subscriptions.has(outputKey)) {
134
- subscriptions.get(outputKey)!.unsubscribe();
135
- }
136
-
137
- const subscription = eventEmitter.subscribe((value: any) => callback(value));
138
- subscriptions.set(outputKey, subscription);
139
- }
140
- }
141
- }
142
- }
@@ -1,56 +0,0 @@
1
- import {
2
- AfterViewInit,
3
- ChangeDetectionStrategy,
4
- ChangeDetectorRef,
5
- Component,
6
- inject,
7
- Injector,
8
- Input,
9
- OnChanges,
10
- Type,
11
- ViewChild,
12
- ViewContainerRef,
13
- } from '@angular/core';
14
- import { ExtendedComponent } from '@verisoft/ui-core';
15
- import { DynamicComponentFactoryService } from './dynamic-component-factory.service';
16
-
17
- @Component({
18
- selector: 'v-dynamic-component',
19
- standalone: true,
20
- changeDetection: ChangeDetectionStrategy.OnPush,
21
- template: `<ng-container #dynamicContainer></ng-container>`,
22
- })
23
- export class DynamicComponent<TComponent> implements AfterViewInit, OnChanges {
24
- @Input() componentType!: Type<TComponent>;
25
-
26
- @Input() data!: ExtendedComponent<TComponent>;
27
-
28
- @ViewChild('dynamicContainer', { read: ViewContainerRef, static: true })
29
- container!: ViewContainerRef;
30
-
31
- private factoryServices = inject(DynamicComponentFactoryService);
32
-
33
- private changeDetectorRef = inject(ChangeDetectorRef);
34
-
35
- private injector = inject(Injector);
36
-
37
- ngOnChanges(): void {
38
- this.createComponent();
39
- }
40
-
41
- ngAfterViewInit(): void {
42
- this.createComponent();
43
- this.changeDetectorRef.detectChanges();
44
- }
45
-
46
- private createComponent() {
47
- if (this.container) {
48
- this.factoryServices.createDynamicComponent(
49
- this.componentType,
50
- this.container,
51
- this.data,
52
- this.injector
53
- );
54
- }
55
- }
56
- }
@@ -1,2 +0,0 @@
1
- export * from './dynamic-component-factory.service';
2
- export * from './dynamic-component.component';
@@ -1,98 +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
- />
8
- } @else if (type === fieldTypes.dropdown && !datasource) {
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
- [forceMinWidth]="true"
18
- [formControl]="formControl"
19
- [showFilter]="showFilter ?? false"
20
- [localSearch]="localSearch ?? false"
21
- (changeEvent)="changed.emit($event)"
22
- (clearEvent)="cleared.emit($event)"
23
- (lazyLoadEvent)="lazyLoad.emit($any($event))"
24
- (showEvent)="showed.emit($event)"
25
- />
26
- } @else if (type === fieldTypes.dropdown && datasource) {
27
- <v-dropdown
28
- useDatasource
29
- [forceMinWidth]="true"
30
- [datasource]="datasource"
31
- [optionLabel]="optionLabel"
32
- [optionValue]="optionValue ?? optionLabel"
33
- [label]="!floatLabel ? label : ''"
34
- [floatLabel]="floatLabel ? label : ''"
35
- [testId]="testId"
36
- [loading]="loading"
37
- [formControl]="formControl"
38
- [showFilter]="showFilter ?? false"
39
- [filterField]="filterField ?? 'fulltext'"
40
- [localSearch]="localSearch ?? false"
41
- (changeEvent)="changed.emit($event)"
42
- (clearEvent)="cleared.emit($event)"
43
- (lazyLoadEvent)="lazyLoad.emit($any($event))"
44
- (showEvent)="showed.emit($event)"
45
- />
46
- } @else if (type === fieldTypes.multiselect && !datasource) {
47
- <v-multiselect
48
- [label]="!floatLabel ? label : ''"
49
- [floatLabel]="floatLabel ? label : ''"
50
- [testId]="testId"
51
- [options]="options"
52
- [optionLabel]="optionLabel"
53
- [optionValue]="optionValue ?? optionLabel"
54
- [loading]="loading"
55
- [formControl]="formControl"
56
- (changeEvent)="changed.emit($event)"
57
- (clearEvent)="cleared.emit($event)"
58
- (lazyLoadEvent)="lazyLoad.emit($any($event))"
59
- (showEvent)="showed.emit($event)"
60
- />
61
- } @else if (type === fieldTypes.multiselect && datasource) {
62
- <v-multiselect
63
- useDatasource
64
- [datasource]="datasource"
65
- [optionLabel]="optionLabel"
66
- [optionValue]="optionValue ?? optionLabel"
67
- [label]="!floatLabel ? label : ''"
68
- [floatLabel]="floatLabel ? label : ''"
69
- [testId]="testId"
70
- [loading]="loading"
71
- [formControl]="formControl"
72
- (changeEvent)="changed.emit($event)"
73
- (clearEvent)="cleared.emit($event)"
74
- (lazyLoadEvent)="lazyLoad.emit($any($event))"
75
- (showEvent)="showed.emit($event)"
76
- />
77
- } @else if (type === fieldTypes.checkbox) {
78
- <v-checkbox
79
- [label]="label"
80
- [testId]="testId"
81
- [formControl]="formControl"
82
- [indeterminate]="true"
83
- />
84
- } @else if (type === fieldTypes.simplecheckbox) {
85
- <v-checkbox
86
- [label]="label"
87
- [testId]="testId"
88
- [formControl]="formControl"
89
- />
90
- } @else if (type === fieldTypes.calendar) {
91
- <v-calendar
92
- [label]="!floatLabel ? label : ''"
93
- [floatLabel]="floatLabel ? label : ''"
94
- [testId]="testId"
95
- [formControl]="formControl"
96
- [icon]="icons.calendar"
97
- />
98
- }
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { GenericFieldComponent } from './generic-field.component';
3
-
4
- describe('GenericFieldComponent', () => {
5
- let component: GenericFieldComponent<string>;
6
- let fixture: ComponentFixture<GenericFieldComponent<string>>;
7
-
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [GenericFieldComponent],
11
- }).compileComponents();
12
-
13
- fixture = TestBed.createComponent(GenericFieldComponent<string>);
14
- component = fixture.componentInstance;
15
- fixture.detectChanges();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });
@@ -1,90 +0,0 @@
1
-
2
- import {
3
- ChangeDetectionStrategy,
4
- Component,
5
- EventEmitter,
6
- Input,
7
- Output,
8
- } from '@angular/core';
9
- import { ReactiveFormsModule } from '@angular/forms';
10
- import {
11
- DatasourceType,
12
- FilterEvent,
13
- LazyLoadEvent,
14
- } from '@verisoft/core';
15
- import {
16
- BaseFormInputComponent,
17
- DatasourceDirective,
18
- FieldSize,
19
- FieldSizeType,
20
- GENERIC_FIELD_COMPONENT_TOKEN,
21
- GenericFieldCore,
22
- GenericFieldType,
23
- GenericFieldTypeType,
24
- } from '@verisoft/ui-core';
25
- import { Icons } from '../../../icons';
26
- import { CalendarComponent } from '../../calendar';
27
- import { CheckboxComponent } from '../../checkbox';
28
- import { DropdownComponent } from '../../dropdown';
29
- import { MultiselectComponent } from '../../multiselect';
30
- import { TextfieldComponent } from '../../textfield';
31
-
32
- @Component({
33
- selector: 'v-generic-field',
34
- imports: [
35
- DropdownComponent,
36
- CalendarComponent,
37
- MultiselectComponent,
38
- TextfieldComponent,
39
- ReactiveFormsModule,
40
- CheckboxComponent,
41
- DatasourceDirective
42
- ],
43
- providers: [
44
- {
45
- provide: GENERIC_FIELD_COMPONENT_TOKEN,
46
- useExisting: GenericFieldComponent,
47
- },
48
- ],
49
- templateUrl: './generic-field.component.html',
50
- changeDetection: ChangeDetectionStrategy.OnPush
51
- })
52
- export class GenericFieldComponent<T>
53
- extends BaseFormInputComponent
54
- implements GenericFieldCore<T>
55
- {
56
- @Input() type?: GenericFieldTypeType = GenericFieldType.text;
57
-
58
- @Input() floatLabel?: boolean;
59
-
60
- @Input() optionLabel: string | undefined;
61
-
62
- @Input() optionValue: string | undefined;
63
-
64
- @Input() options: T[] | undefined;
65
-
66
- @Input() size?: FieldSizeType = FieldSize.medium;
67
-
68
- @Input() loading = false;
69
-
70
- @Input() lazy = false;
71
-
72
- @Input() filter = true;
73
-
74
- @Input() datasource?: DatasourceType<T>
75
-
76
- @Input() filterField?: string;
77
-
78
- @Input() showFilter?: boolean;
79
-
80
- @Input() localSearch?: boolean;
81
-
82
- @Output() changed = new EventEmitter<any>();
83
- @Output() showed = new EventEmitter<any>();
84
- @Output() cleared = new EventEmitter<any>();
85
- @Output() lazyLoad = new EventEmitter<LazyLoadEvent>();
86
- @Output() filtered = new EventEmitter<FilterEvent>();
87
-
88
- fieldTypes = GenericFieldType;
89
- icons = Icons;
90
- }
@@ -1 +0,0 @@
1
- export * from './generic-field.component';
@@ -1,46 +0,0 @@
1
- @if (formGroupComputed) {
2
- <div
3
- class="v-generic-form"
4
- [ngClass]="showAsRow ? 'd-flex flex-row' : 'row'"
5
- [formGroup]="formGroupComputed"
6
- >
7
- @for(field of fields; track field) { @if (columnClass) {
8
- <div class="v-generic-form__column {{ columnClass }}">
9
- <v-generic-field
10
- [type]="field.type"
11
- [label]="field.label ?? 'NOT SET' | translate"
12
- [floatLabel]="field.floatLabel"
13
- [testId]="field.testId"
14
- [options]="field.options"
15
- [optionLabel]="field.optionLabel"
16
- [optionValue]="field.optionValue ?? field.optionLabel"
17
- [options]="field.options"
18
- [size]="field.size"
19
- [formControlName]="field.name"
20
- [datasource]="field.datasource"
21
- [showFilter]="field.showFilter"
22
- [filterField]="field.filterField"
23
- [localSearch]="field.localSearch"
24
- ></v-generic-field>
25
- </div>
26
- } @else {
27
- <v-generic-field
28
- class="me-4"
29
- [type]="field.type"
30
- [label]="field.label ?? 'NOT SET' | translate"
31
- [floatLabel]="field.floatLabel"
32
- [testId]="field.testId"
33
- [options]="field.options"
34
- [optionLabel]="field.optionLabel"
35
- [optionValue]="field.optionValue ?? field.optionLabel"
36
- [options]="field.options"
37
- [size]="field.size"
38
- [formControlName]="field.name"
39
- [datasource]="field.datasource"
40
- [showFilter]="field.showFilter"
41
- [filterField]="field.filterField"
42
- [localSearch]="field.localSearch"
43
- ></v-generic-field>
44
- } }
45
- </div>
46
- }