@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.
Files changed (233) hide show
  1. package/.eslintrc.json +43 -0
  2. package/README.md +7 -0
  3. package/jest.config.ts +22 -0
  4. package/ng-package.json +7 -0
  5. package/package.json +21 -0
  6. package/project.json +36 -0
  7. package/src/assets/.gitkeep +0 -0
  8. package/src/assets/fonts/orbitron-black.ttf +0 -0
  9. package/src/assets/fonts/orbitron-bold.otf +0 -0
  10. package/src/assets/icons/complex/v-logo.svg +4 -0
  11. package/src/assets/images/_global/elon.jpg +0 -0
  12. package/src/assets/images/_global/jara.png +0 -0
  13. package/src/assets/images/_global/logos/v-logo.webp +0 -0
  14. package/src/assets/sass/base/_scrollbar.scss +18 -0
  15. package/src/assets/sass/base/_typography.scss +25 -0
  16. package/src/assets/sass/layout/_app.scss +27 -0
  17. package/src/assets/sass/layout/_button.scss +57 -0
  18. package/src/assets/sass/layout/_checkbox.scss +33 -0
  19. package/src/assets/sass/layout/_dialog.scss +13 -0
  20. package/src/assets/sass/layout/_dropdown.scss +9 -0
  21. package/src/assets/sass/layout/_formField.scss +5 -0
  22. package/src/assets/sass/layout/_header.scss +63 -0
  23. package/src/assets/sass/layout/_icons.scss +13 -0
  24. package/src/assets/sass/layout/_inputSwitch.scss +13 -0
  25. package/src/assets/sass/layout/_layout.scss +6 -0
  26. package/src/assets/sass/layout/_loader.scss +9 -0
  27. package/src/assets/sass/layout/_radiobutton.scss +21 -0
  28. package/src/assets/sass/layout/_sidemenu.scss +187 -0
  29. package/src/assets/sass/layout/_snackbar.scss +8 -0
  30. package/src/assets/sass/layout/_tables.scss +5 -0
  31. package/src/assets/sass/layout/_tree.scss +12 -0
  32. package/src/assets/sass/layout/_tristatecheckbox.scss +15 -0
  33. package/src/assets/sass/main.scss +28 -0
  34. package/src/assets/sass/themes/_verisoft_theme.scss +46 -0
  35. package/src/assets/sass/utils/_mixins.scss +0 -0
  36. package/src/assets/sass/utils/_utils.scss +39 -0
  37. package/src/assets/sass/utils/_variables.scss +12 -0
  38. package/src/assets/sass/vendors/_bootstrap.scss +2 -0
  39. package/src/assets/sass/vendors/_primeng.scss +2 -0
  40. package/src/index.ts +31 -0
  41. package/src/lib/components/action-button-group/action-button-group.component.html +29 -0
  42. package/src/lib/components/action-button-group/action-button-group.component.scss +0 -0
  43. package/src/lib/components/action-button-group/action-button-group.component.spec.ts +21 -0
  44. package/src/lib/components/action-button-group/action-button-group.component.ts +104 -0
  45. package/src/lib/components/action-button-group/components/action-button/action-button.component.html +12 -0
  46. package/src/lib/components/action-button-group/components/action-button/action-button.component.scss +0 -0
  47. package/src/lib/components/action-button-group/components/action-button/action-button.component.spec.ts +21 -0
  48. package/src/lib/components/action-button-group/components/action-button/action-button.component.ts +36 -0
  49. package/src/lib/components/action-button-group/index.ts +2 -0
  50. package/src/lib/components/breadcrumb/breadcrumb.component.html +12 -0
  51. package/src/lib/components/breadcrumb/breadcrumb.component.scss +18 -0
  52. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
  53. package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +36 -0
  54. package/src/lib/components/breadcrumb/breadcrumb.component.ts +24 -0
  55. package/src/lib/components/breadcrumb/index.ts +1 -0
  56. package/src/lib/components/button/button.component.html +20 -0
  57. package/src/lib/components/button/button.component.scss +0 -0
  58. package/src/lib/components/button/button.component.spec.ts +21 -0
  59. package/src/lib/components/button/button.component.ts +43 -0
  60. package/src/lib/components/button/directives/shortcut.directive.ts +37 -0
  61. package/src/lib/components/button/index.ts +2 -0
  62. package/src/lib/components/calendar/calendar.component.html +53 -0
  63. package/src/lib/components/calendar/calendar.component.scss +0 -0
  64. package/src/lib/components/calendar/calendar.component.spec.ts +21 -0
  65. package/src/lib/components/calendar/calendar.component.ts +67 -0
  66. package/src/lib/components/calendar/index.ts +1 -0
  67. package/src/lib/components/checkbox/checkbox.component.html +19 -0
  68. package/src/lib/components/checkbox/checkbox.component.scss +15 -0
  69. package/src/lib/components/checkbox/checkbox.component.spec.ts +21 -0
  70. package/src/lib/components/checkbox/checkbox.component.stories.ts +72 -0
  71. package/src/lib/components/checkbox/checkbox.component.ts +41 -0
  72. package/src/lib/components/checkbox/index.ts +1 -0
  73. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +48 -0
  74. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +3 -0
  75. package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
  76. package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +74 -0
  77. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +74 -0
  78. package/src/lib/components/confirm-dialog/index.ts +2 -0
  79. package/src/lib/components/confirm-dialog/services/confirm-dialog.service.ts +14 -0
  80. package/src/lib/components/dropdown/dropdown.component.html +96 -0
  81. package/src/lib/components/dropdown/dropdown.component.scss +16 -0
  82. package/src/lib/components/dropdown/dropdown.component.spec.ts +21 -0
  83. package/src/lib/components/dropdown/dropdown.component.stories.ts +90 -0
  84. package/src/lib/components/dropdown/dropdown.component.ts +139 -0
  85. package/src/lib/components/dropdown/index.ts +1 -0
  86. package/src/lib/components/dynamic-component/dynamic-component-factory.service.ts +90 -0
  87. package/src/lib/components/dynamic-component/dynamic-component.component.ts +55 -0
  88. package/src/lib/components/filter/directives/filter-field.directive.ts +25 -0
  89. package/src/lib/components/filter/directives/table-filter.directive.ts +22 -0
  90. package/src/lib/components/filter/filter.component.html +67 -0
  91. package/src/lib/components/filter/filter.component.scss +0 -0
  92. package/src/lib/components/filter/filter.component.spec.ts +21 -0
  93. package/src/lib/components/filter/filter.component.stories.ts +23 -0
  94. package/src/lib/components/filter/filter.component.ts +257 -0
  95. package/src/lib/components/filter/filter.model.ts +18 -0
  96. package/src/lib/components/filter/index.ts +3 -0
  97. package/src/lib/components/form-field/form-field.component.html +41 -0
  98. package/src/lib/components/form-field/form-field.component.scss +0 -0
  99. package/src/lib/components/form-field/form-field.component.spec.ts +21 -0
  100. package/src/lib/components/form-field/form-field.component.stories.ts +69 -0
  101. package/src/lib/components/form-field/form-field.component.ts +34 -0
  102. package/src/lib/components/form-field/index.ts +1 -0
  103. package/src/lib/components/generic-field/generic-field.component.html +54 -0
  104. package/src/lib/components/generic-field/generic-field.component.spec.ts +21 -0
  105. package/src/lib/components/generic-field/generic-field.component.ts +76 -0
  106. package/src/lib/components/generic-field/generic-field.model.ts +9 -0
  107. package/src/lib/components/generic-field/index.ts +2 -0
  108. package/src/lib/components/generic-form/generic-form.component.html +33 -0
  109. package/src/lib/components/generic-form/generic-form.component.spec.ts +21 -0
  110. package/src/lib/components/generic-form/generic-form.component.ts +48 -0
  111. package/src/lib/components/generic-form/generic-form.model.spec.ts +82 -0
  112. package/src/lib/components/generic-form/generic-form.model.ts +76 -0
  113. package/src/lib/components/generic-form/index.ts +2 -0
  114. package/src/lib/components/header/header.component.html +85 -0
  115. package/src/lib/components/header/header.component.scss +0 -0
  116. package/src/lib/components/header/header.component.spec.ts +21 -0
  117. package/src/lib/components/header/header.component.stories.ts +24 -0
  118. package/src/lib/components/header/header.component.ts +64 -0
  119. package/src/lib/components/header/index.ts +2 -0
  120. package/src/lib/components/header/services/header-provider.service.ts +15 -0
  121. package/src/lib/components/input-group/index.ts +1 -0
  122. package/src/lib/components/input-group/input-group.component.html +32 -0
  123. package/src/lib/components/input-group/input-group.component.spec.ts +21 -0
  124. package/src/lib/components/input-group/input-group.component.ts +60 -0
  125. package/src/lib/components/loader/index.ts +1 -0
  126. package/src/lib/components/loader/loader.component.html +5 -0
  127. package/src/lib/components/loader/loader.component.scss +0 -0
  128. package/src/lib/components/loader/loader.component.spec.ts +21 -0
  129. package/src/lib/components/loader/loader.component.ts +17 -0
  130. package/src/lib/components/multiselect/index.ts +1 -0
  131. package/src/lib/components/multiselect/multiselect.component.html +69 -0
  132. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  133. package/src/lib/components/multiselect/multiselect.component.spec.ts +21 -0
  134. package/src/lib/components/multiselect/multiselect.component.ts +120 -0
  135. package/src/lib/components/number-input/index.ts +1 -0
  136. package/src/lib/components/number-input/number-input.component.html +22 -0
  137. package/src/lib/components/number-input/number-input.component.spec.ts +21 -0
  138. package/src/lib/components/number-input/number-input.component.ts +54 -0
  139. package/src/lib/components/page-header/index.ts +2 -0
  140. package/src/lib/components/page-header/page-header.component.html +31 -0
  141. package/src/lib/components/page-header/page-header.component.scss +0 -0
  142. package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
  143. package/src/lib/components/page-header/page-header.component.ts +60 -0
  144. package/src/lib/components/page-header/services/page-header.service.ts +9 -0
  145. package/src/lib/components/password/index.ts +1 -0
  146. package/src/lib/components/password/password.component.html +24 -0
  147. package/src/lib/components/password/password.component.scss +0 -0
  148. package/src/lib/components/password/password.component.spec.ts +21 -0
  149. package/src/lib/components/password/password.component.ts +56 -0
  150. package/src/lib/components/radiobutton/index.ts +1 -0
  151. package/src/lib/components/radiobutton/radiobutton.component.html +32 -0
  152. package/src/lib/components/radiobutton/radiobutton.component.scss +6 -0
  153. package/src/lib/components/radiobutton/radiobutton.component.spec.ts +21 -0
  154. package/src/lib/components/radiobutton/radiobutton.component.stories.ts +71 -0
  155. package/src/lib/components/radiobutton/radiobutton.component.ts +60 -0
  156. package/src/lib/components/section/index.ts +1 -0
  157. package/src/lib/components/section/section.component.html +24 -0
  158. package/src/lib/components/section/section.component.scss +0 -0
  159. package/src/lib/components/section/section.component.spec.ts +21 -0
  160. package/src/lib/components/section/section.component.ts +30 -0
  161. package/src/lib/components/side-menu/index.ts +2 -0
  162. package/src/lib/components/side-menu/side-menu.component.html +55 -0
  163. package/src/lib/components/side-menu/side-menu.component.scss +0 -0
  164. package/src/lib/components/side-menu/side-menu.component.spec.ts +21 -0
  165. package/src/lib/components/side-menu/side-menu.component.ts +97 -0
  166. package/src/lib/components/side-menu/side-menu.module.ts +66 -0
  167. package/src/lib/components/slider/index.ts +1 -0
  168. package/src/lib/components/slider/slider.component.html +19 -0
  169. package/src/lib/components/slider/slider.component.spec.ts +21 -0
  170. package/src/lib/components/slider/slider.component.ts +56 -0
  171. package/src/lib/components/snackbar/index.ts +2 -0
  172. package/src/lib/components/snackbar/services/snackbar.service.ts +45 -0
  173. package/src/lib/components/snackbar/snackbar.component.html +3 -0
  174. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  175. package/src/lib/components/snackbar/snackbar.component.spec.ts +21 -0
  176. package/src/lib/components/snackbar/snackbar.component.stories.ts +70 -0
  177. package/src/lib/components/snackbar/snackbar.component.ts +26 -0
  178. package/src/lib/components/stepper/index.ts +1 -0
  179. package/src/lib/components/stepper/stepper.component.html +43 -0
  180. package/src/lib/components/stepper/stepper.component.spec.ts +21 -0
  181. package/src/lib/components/stepper/stepper.component.ts +25 -0
  182. package/src/lib/components/switch/index.ts +1 -0
  183. package/src/lib/components/switch/switch.component.html +19 -0
  184. package/src/lib/components/switch/switch.component.scss +0 -0
  185. package/src/lib/components/switch/switch.component.spec.ts +21 -0
  186. package/src/lib/components/switch/switch.component.stories.ts +65 -0
  187. package/src/lib/components/switch/switch.component.ts +52 -0
  188. package/src/lib/components/tab-view/index.ts +3 -0
  189. package/src/lib/components/tab-view/tab-view-item.component.ts +20 -0
  190. package/src/lib/components/tab-view/tab-view.component.html +24 -0
  191. package/src/lib/components/tab-view/tab-view.component.ts +50 -0
  192. package/src/lib/components/tab-view/tab-view.module.ts +18 -0
  193. package/src/lib/components/table/directives/table-store.directive.ts +61 -0
  194. package/src/lib/components/table/index.ts +2 -0
  195. package/src/lib/components/table/table.component.html +183 -0
  196. package/src/lib/components/table/table.component.scss +0 -0
  197. package/src/lib/components/table/table.component.spec.ts +21 -0
  198. package/src/lib/components/table/table.component.stories.ts +55 -0
  199. package/src/lib/components/table/table.component.ts +256 -0
  200. package/src/lib/components/table-filter/filter.component.html +205 -0
  201. package/src/lib/components/table-filter/filter.component.scss +0 -0
  202. package/src/lib/components/table-filter/filter.component.spec.ts +21 -0
  203. package/src/lib/components/table-filter/filter.component.stories.ts +23 -0
  204. package/src/lib/components/textarea/index.ts +1 -0
  205. package/src/lib/components/textarea/textarea.component.html +40 -0
  206. package/src/lib/components/textarea/textarea.component.scss +5 -0
  207. package/src/lib/components/textarea/textarea.component.spec.ts +21 -0
  208. package/src/lib/components/textarea/textarea.component.stories.ts +98 -0
  209. package/src/lib/components/textarea/textarea.component.ts +62 -0
  210. package/src/lib/components/textfield/index.ts +1 -0
  211. package/src/lib/components/textfield/textfield.component.html +83 -0
  212. package/src/lib/components/textfield/textfield.component.scss +23 -0
  213. package/src/lib/components/textfield/textfield.component.spec.ts +21 -0
  214. package/src/lib/components/textfield/textfield.component.stories.ts +85 -0
  215. package/src/lib/components/textfield/textfield.component.ts +64 -0
  216. package/src/lib/components/tristatecheckbox/index.ts +1 -0
  217. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.html +23 -0
  218. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.scss +0 -0
  219. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.spec.ts +21 -0
  220. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.stories.ts +22 -0
  221. package/src/lib/components/tristatecheckbox/tristatecheckbox.component.ts +46 -0
  222. package/src/lib/interceptors/http-error-message.interceptor.ts +35 -0
  223. package/src/lib/pages/not-found-page/not-found-page.component.html +27 -0
  224. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  225. package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +21 -0
  226. package/src/lib/pages/not-found-page/not-found-page.component.ts +17 -0
  227. package/src/lib/services/screen-size.service.ts +25 -0
  228. package/src/tab-view.ts +1 -0
  229. package/src/test-setup.ts +8 -0
  230. package/tsconfig.json +29 -0
  231. package/tsconfig.lib.json +18 -0
  232. package/tsconfig.lib.prod.json +9 -0
  233. package/tsconfig.spec.json +16 -0
@@ -0,0 +1,48 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ Input,
5
+ OnChanges,
6
+ SimpleChanges,
7
+ } from '@angular/core';
8
+ import { ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
9
+ import { GenericFieldComponent } from '../generic-field';
10
+ import {
11
+ generateFormGroup,
12
+ GenericFieldDefinition,
13
+ getColumnClass,
14
+ } from './generic-form.model';
15
+
16
+ @Component({
17
+ selector: 'v-generic-form',
18
+ standalone: true,
19
+ imports: [GenericFieldComponent, ReactiveFormsModule],
20
+ templateUrl: './generic-form.component.html',
21
+ changeDetection: ChangeDetectionStrategy.OnPush,
22
+ })
23
+ export class GenericFormComponent implements OnChanges {
24
+ @Input() formGroup?: UntypedFormGroup;
25
+
26
+ @Input() fields?: GenericFieldDefinition[];
27
+
28
+ @Input() columns?: number;
29
+
30
+ formGroupComputed!: UntypedFormGroup;
31
+
32
+ columnClass?: string;
33
+
34
+ ngOnChanges(changes: SimpleChanges): void {
35
+ if (changes['fields'] || changes['formGroup']) {
36
+ this.formGroupComputed = generateFormGroup(
37
+ this.fields,
38
+ this.formGroupComputed,
39
+ this.formGroup,
40
+ !!changes['formGroup']
41
+ );
42
+ }
43
+
44
+ if (changes['columns']) {
45
+ this.columnClass = getColumnClass(this.columns);
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,82 @@
1
+ import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
2
+ import { generateFormGroup, GenericFieldDefinition } from './generic-form.model';
3
+
4
+ describe('GenericFormModel', () => {
5
+ describe('generateFormGroup', () => {
6
+ const fields = [{ name: 'name' }, { name: 'age' }];
7
+
8
+ const containsField = (formGroup: UntypedFormGroup, field: GenericFieldDefinition) => expect(formGroup.get(field.name)).toBeDefined();
9
+
10
+ test('Should create a new group when no group was provided', () => {
11
+ const formGroup = generateFormGroup([], undefined, undefined, false);
12
+
13
+ expect(formGroup).toBeDefined();
14
+ });
15
+
16
+ test('Should create a new group when no fields are provided', () => {
17
+ const formGroup = generateFormGroup(
18
+ undefined,
19
+ undefined,
20
+ undefined,
21
+ false
22
+ );
23
+
24
+ expect(formGroup).toBeDefined();
25
+ });
26
+
27
+ test('Should create a new group with defined control when fields are provided', () => {
28
+ const formGroup = generateFormGroup(fields, undefined, undefined, false);
29
+
30
+ expect(formGroup).toBeDefined();
31
+ containsField(formGroup, fields[0]);
32
+ containsField(formGroup, fields[1]);
33
+ });
34
+
35
+ test('Should used input group and creates control when fields are provided and formgroup does not have a controls', () => {
36
+ const inputGroup = new UntypedFormGroup({});
37
+
38
+ const formGroup = generateFormGroup(fields, undefined, inputGroup, false);
39
+
40
+ expect(formGroup).toBe(inputGroup);
41
+ containsField(formGroup, fields[0]);
42
+ });
43
+
44
+ test('Should not remove control from input group when input group is provided and fields does not contain control definition.', () => {
45
+ const inputGroup = new UntypedFormGroup({
46
+ student: new UntypedFormControl(),
47
+ });
48
+
49
+ const formGroup = generateFormGroup(fields, undefined, inputGroup, false);
50
+
51
+ expect(formGroup.get('student')).toBeDefined();
52
+ });
53
+
54
+ test('Should use existing group when input group is provided but have already defined group.', () => {
55
+ const inputGroup = new UntypedFormGroup({
56
+ student: new UntypedFormControl(),
57
+ });
58
+
59
+ const lastGroup = new UntypedFormGroup({
60
+ });
61
+
62
+ const formGroup = generateFormGroup(fields, lastGroup, inputGroup, false);
63
+
64
+ expect(formGroup).toBe(lastGroup);
65
+ containsField(formGroup, fields[0]);
66
+ });
67
+
68
+ test('Should use existing a new input group when last form group exists, but input group was changed.', () => {
69
+ const inputGroup = new UntypedFormGroup({
70
+ student: new UntypedFormControl(),
71
+ });
72
+
73
+ const lastGroup = new UntypedFormGroup({
74
+ });
75
+
76
+ const formGroup = generateFormGroup(fields, lastGroup, inputGroup, true);
77
+
78
+ expect(formGroup).toBe(inputGroup);
79
+ containsField(formGroup, fields[0]);
80
+ });
81
+ });
82
+ });
@@ -0,0 +1,76 @@
1
+ import {
2
+ UntypedFormControl,
3
+ UntypedFormGroup,
4
+ ValidatorFn,
5
+ } from '@angular/forms';
6
+ import { FieldSizeType } from '@verisoft/ui-core';
7
+ import { GenericFieldTypeType } from '../generic-field';
8
+
9
+ export interface GenericFieldDefinition {
10
+ validator?: ValidatorFn[];
11
+ type?: GenericFieldTypeType;
12
+ label?: string;
13
+ floatLabel?: boolean;
14
+ name: string;
15
+ optionLabel?: string;
16
+ optionValue?: string;
17
+ options?: unknown[];
18
+ value?: unknown;
19
+ testId?: string;
20
+ size?: FieldSizeType;
21
+ }
22
+
23
+ export function generateFormGroup(
24
+ fields: GenericFieldDefinition[] | undefined,
25
+ lastGroupValue: UntypedFormGroup | undefined,
26
+ inputGroup: UntypedFormGroup | undefined,
27
+ inputGroupChanged = false
28
+ ): UntypedFormGroup {
29
+ const formGroup =
30
+ (inputGroupChanged
31
+ ? inputGroup ?? lastGroupValue
32
+ : lastGroupValue ?? inputGroup) ?? new UntypedFormGroup({});
33
+
34
+ fields?.forEach((field) => {
35
+ const control = formGroup.get(field.name);
36
+ if (!control) {
37
+ formGroup.addControl(
38
+ field.name,
39
+ new UntypedFormControl(field.value, field.validator)
40
+ );
41
+ } else {
42
+ control.setValidators(field.validator ?? null);
43
+ }
44
+ });
45
+ if (!inputGroupChanged) {
46
+ for (const field in formGroup.controls) {
47
+ const control = fields?.find((x) => x.name == field);
48
+ if (!control) {
49
+ formGroup.removeControl(field);
50
+ }
51
+ }
52
+ }
53
+
54
+ return formGroup;
55
+ }
56
+
57
+ export function getColumnClass(value?: number): string | undefined {
58
+ if (!value) {
59
+ return undefined;
60
+ }
61
+
62
+ switch (value) {
63
+ case 1:
64
+ return 'col-12';
65
+ case 2:
66
+ return 'col-12 col-md-6';
67
+ case 3:
68
+ return 'col-12 col-md-4';
69
+ case 4:
70
+ return 'col-12 col-md-3';
71
+ case 6:
72
+ return 'col-12 col-md-2';
73
+ }
74
+
75
+ return 'col-12 col-md-1';
76
+ }
@@ -0,0 +1,2 @@
1
+ export * from './generic-form.component';
2
+ export * from './generic-form.model';
@@ -0,0 +1,85 @@
1
+ <div
2
+ class="v-header d-flex w-100 text-align-end"
3
+ [ngStyle]="{ position: exampleHeader ? 'relative' : 'fixed' }"
4
+ >
5
+ <ng-container *ngIf="screenSizeService.isMobileBlock | async">
6
+ <div class="burger-menu">
7
+ <v-button
8
+ [text]="true"
9
+ [icon]="menuVisible ? 'pi pi-times' : 'pi pi-bars'"
10
+ (click)="toggleMenu()"
11
+ />
12
+ <div class="logo mt-3" [routerLink]="[logoRouterLink]">
13
+ <img [src]="logoUrl" alt=""/>
14
+ </div>
15
+ </div>
16
+ </ng-container>
17
+ <div class="v-header-title col-auto">
18
+ <p class="text-primary text-nowrap d-none d-md-block ps-3 m-0 w-100">
19
+ {{ title }}
20
+ </p>
21
+ <div class="col-8 col-md-auto ps-3 m-0 w-100">
22
+ <ng-content select="[module]"></ng-content>
23
+ </div>
24
+ </div>
25
+ <ng-container *ngIf="(screenSizeService.isMobileBlock | async) === false">
26
+ <div class="w-100 text-start justify-content-start align-content-center">
27
+ <ng-content select="[breadcrumbs]"></ng-content>
28
+ </div>
29
+ <div class="col-auto d-flex align-items-center justify-content-end p-4">
30
+ <div class="d-flex aling-items-center">
31
+ <p-avatar
32
+ image="assets/images/_global/jara.png"
33
+ styleClass="me-2"
34
+ size="large"
35
+ shape="circle"
36
+ />
37
+ <div class="card align-content-center pe-3">
38
+ <p
39
+ class="text-primary m-0 header-username"
40
+ [innerHTML]="userName"
41
+ ></p>
42
+ <p
43
+ class="text-default m-0 header-userrole"
44
+ [innerHTML]="userRole"
45
+ ></p>
46
+ </div>
47
+ </div>
48
+ <div class="d-flex gap-4 align-items-center">
49
+ <ng-content select="[useractions]"/>
50
+ </div>
51
+ </div>
52
+ </ng-container>
53
+ <ng-container *ngIf="screenSizeService.isMobileBlock | async">
54
+ <div class="user-info-container d-flex align-items-center">
55
+ <div class="d-flex">
56
+ <div class="card pe-3 align-content-center">
57
+ <p-avatar
58
+ image="assets/images/_global/jara.png"
59
+ styleClass="mr-2"
60
+ size="large"
61
+ shape="circle"
62
+ ></p-avatar>
63
+ </div>
64
+ <div class="card align-content-center pe-3 d-flex">
65
+ <div class="user-info">
66
+ <p
67
+ class="text-default m-0 header-username"
68
+ [innerHTML]="userName"
69
+ ></p>
70
+ <p
71
+ class="text-default m-0 header-userrole"
72
+ [innerHTML]="userRole"
73
+ ></p>
74
+ </div>
75
+ <div class="user-actions">
76
+ <ng-content select="[useractions]"></ng-content>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <div class="d-flex gap-4 align-items-center justify-content-center">
81
+ <ng-content select="[dbcontext]" />
82
+ </div>
83
+ </div>
84
+ </ng-container>
85
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { HeaderComponent } from './header.component';
3
+
4
+ describe('HeaderComponent', () => {
5
+ let component: HeaderComponent;
6
+ let fixture: ComponentFixture<HeaderComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [HeaderComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(HeaderComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,24 @@
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+ import { within, expect } from '@storybook/test';
3
+ import { HeaderComponent } from './header.component';
4
+
5
+ const meta: Meta<HeaderComponent> = {
6
+ component: HeaderComponent,
7
+ title: 'HeaderComponent',
8
+ };
9
+ export default meta;
10
+ type Story = StoryObj<HeaderComponent>;
11
+
12
+ export const Primary: Story = {
13
+ args: {
14
+ title: 'verisoft',
15
+ userName: 'Elon Musk',
16
+ userRole: 'Mars Owner',
17
+ },
18
+ play: async ({ canvasElement }: any) => {
19
+ const canvas = within(canvasElement);
20
+ expect(canvas.getByText('verisoft')).toBeTruthy();
21
+ expect(canvas.findByText('Elon Musk')).toBeTruthy();
22
+ expect(canvas.findByText('Mars Owner')).toBeTruthy();
23
+ },
24
+ };
@@ -0,0 +1,64 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ ChangeDetectorRef,
5
+ Component,
6
+ Input,
7
+ OnInit,
8
+ } from '@angular/core';
9
+ import { RouterModule } from '@angular/router';
10
+ import {
11
+ HEADER_COMPONENT_TOKEN,
12
+ HeaderCore,
13
+ UnsubscribeComponent,
14
+ } from '@verisoft/ui-core';
15
+ import { AvatarModule } from 'primeng/avatar';
16
+ import { ScreenSizeService } from '../../services/screen-size.service';
17
+ import { ButtonComponent } from '../button';
18
+ import { HeaderProviderService } from './services/header-provider.service';
19
+
20
+ @Component({
21
+ selector: 'v-header',
22
+ standalone: true,
23
+ imports: [CommonModule, AvatarModule, ButtonComponent, RouterModule],
24
+ templateUrl: './header.component.html',
25
+ styleUrl: './header.component.scss',
26
+ changeDetection: ChangeDetectionStrategy.OnPush,
27
+ providers: [
28
+ { provide: HEADER_COMPONENT_TOKEN, useExisting: HeaderComponent },
29
+ ],
30
+ })
31
+ export class HeaderComponent
32
+ extends UnsubscribeComponent
33
+ implements OnInit, HeaderCore
34
+ {
35
+ constructor(
36
+ readonly providerService: HeaderProviderService,
37
+ readonly screenSizeService: ScreenSizeService,
38
+ readonly cdr: ChangeDetectorRef
39
+ ) {
40
+ super();
41
+ }
42
+
43
+ @Input() title!: string;
44
+ @Input() logoUrl!: string;
45
+ @Input() userName!: string;
46
+ @Input() userRole!: any | any[] | undefined;
47
+ @Input() menuRef!: HTMLDivElement;
48
+ @Input() exampleHeader = false;
49
+
50
+ protected menuVisible = false;
51
+ protected logoRouterLink!: string;
52
+
53
+ ngOnInit(): void {
54
+ this.providerService.init();
55
+ }
56
+
57
+ toggleMenu() {
58
+ if (this.menuRef) {
59
+ this.menuVisible = !this.menuVisible;
60
+ this.menuRef.classList.toggle('menu-visible');
61
+ this.cdr.detectChanges();
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,2 @@
1
+ export * from './header.component';
2
+ export * from './services/header-provider.service';
@@ -0,0 +1,15 @@
1
+ import { Inject, Injectable } from '@angular/core';
2
+ import { SETTINGS_MENU } from '@verisoft/ui-core';
3
+ import { MenuItem } from 'primeng/api';
4
+
5
+ @Injectable({
6
+ providedIn: 'root',
7
+ })
8
+ export class HeaderProviderService {
9
+ constructor(@Inject(SETTINGS_MENU) private settingsMenu: MenuItem[]) {}
10
+ menu: MenuItem[] = [];
11
+
12
+ init(): void {
13
+ this.menu = this.settingsMenu;
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ export * from './input-group.component';
@@ -0,0 +1,32 @@
1
+ <div class="v-input-group w-100">
2
+ <v-form-field
3
+ [label]="label"
4
+ [required]="required"
5
+ [tooltip]="tooltip"
6
+ [ngControl]="ngControl"
7
+ >
8
+ <p-inputGroup>
9
+ <ng-container *ngFor="let item of items">
10
+ <p-inputGroupAddon *ngIf="item.position === 'left'">
11
+ <ng-container *ngIf="item.icon">
12
+ <i [class]="item.icon"></i>
13
+ </ng-container>
14
+ <ng-container *ngIf="item.text">
15
+ {{ item.text }}
16
+ </ng-container>
17
+ </p-inputGroupAddon>
18
+ </ng-container>
19
+ <input pInputText [formControl]="formControl" class="w-100" />
20
+ <ng-container *ngFor="let item of items">
21
+ <p-inputGroupAddon *ngIf="item.position === 'right'">
22
+ <ng-container *ngIf="item.icon">
23
+ <i [class]="item.icon"></i>
24
+ </ng-container>
25
+ <ng-container *ngIf="item.text">
26
+ {{ item.text }}
27
+ </ng-container>
28
+ </p-inputGroupAddon>
29
+ </ng-container>
30
+ </p-inputGroup>
31
+ </v-form-field>
32
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { InputGroupComponent } from './input-group.component';
3
+
4
+ describe('InputGroupComponent', () => {
5
+ let component: InputGroupComponent;
6
+ let fixture: ComponentFixture<InputGroupComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [InputGroupComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(InputGroupComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,60 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ forwardRef,
6
+ Input,
7
+ Optional,
8
+ Self,
9
+ } from '@angular/core';
10
+ import {
11
+ ControlValueAccessor,
12
+ NgControl,
13
+ ReactiveFormsModule,
14
+ } from '@angular/forms';
15
+ import {
16
+ BaseFormInputComponent,
17
+ BaseInputControls,
18
+ INPUT_GROUP_COMPONENT_TOKEN,
19
+ InputGroupCore,
20
+ InputGroupItem,
21
+ } from '@verisoft/ui-core';
22
+ import { InputGroupModule } from 'primeng/inputgroup';
23
+ import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
24
+ import { InputTextModule } from 'primeng/inputtext';
25
+ import { FormFieldComponent } from '../form-field';
26
+
27
+ @Component({
28
+ selector: 'v-input-group',
29
+ standalone: true,
30
+ imports: [
31
+ CommonModule,
32
+ InputGroupAddonModule,
33
+ InputGroupModule,
34
+ InputTextModule,
35
+ ReactiveFormsModule,
36
+ FormFieldComponent,
37
+ ],
38
+ templateUrl: './input-group.component.html',
39
+ changeDetection: ChangeDetectionStrategy.OnPush,
40
+ providers: [
41
+ {
42
+ provide: BaseInputControls,
43
+ useExisting: forwardRef(() => InputGroupComponent),
44
+ },
45
+ {
46
+ provide: INPUT_GROUP_COMPONENT_TOKEN,
47
+ useExisting: InputGroupComponent,
48
+ },
49
+ ],
50
+ })
51
+ export class InputGroupComponent
52
+ extends BaseFormInputComponent
53
+ implements ControlValueAccessor, InputGroupCore
54
+ {
55
+ constructor(@Optional() @Self() ngControl: NgControl) {
56
+ super(ngControl);
57
+ }
58
+
59
+ @Input() items!: InputGroupItem[];
60
+ }
@@ -0,0 +1 @@
1
+ export * from './loader.component';
@@ -0,0 +1,5 @@
1
+ <div class="v-loader d-flex justify-content-center">
2
+ <div>
3
+ <p-progressSpinner class="p-progress-spinner-circle"></p-progressSpinner>
4
+ </div>
5
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { LoaderComponent } from './loader.component';
3
+
4
+ describe('LoaderComponent', () => {
5
+ let component: LoaderComponent;
6
+ let fixture: ComponentFixture<LoaderComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [LoaderComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(LoaderComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,17 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { LOADER_COMPONENT_TOKEN, LoaderCore } from '@verisoft/ui-core';
4
+ import { ProgressSpinnerModule } from 'primeng/progressspinner';
5
+
6
+ @Component({
7
+ selector: 'v-loader',
8
+ standalone: true,
9
+ imports: [CommonModule, ProgressSpinnerModule],
10
+ templateUrl: './loader.component.html',
11
+ styleUrl: './loader.component.scss',
12
+ changeDetection: ChangeDetectionStrategy.OnPush,
13
+ providers: [
14
+ { provide: LOADER_COMPONENT_TOKEN, useExisting: LoaderComponent },
15
+ ],
16
+ })
17
+ export class LoaderComponent implements LoaderCore {}
@@ -0,0 +1 @@
1
+ export * from './multiselect.component';
@@ -0,0 +1,69 @@
1
+ <div class="v-multiple-select">
2
+ <ng-container *ngIf="label && !floatLabel">
3
+ <v-form-field
4
+ class="w-100"
5
+ [label]="label"
6
+ [tooltip]="tooltip"
7
+ [required]="isRequired()"
8
+ [ngControl]="ngControl"
9
+ [testId]="testId"
10
+ [display]="formDisplay"
11
+ >
12
+ <p-multiSelect
13
+ [baseZIndex]="9999"
14
+ class="w-100"
15
+ appendTo="body"
16
+ [formControl]="formControl"
17
+ [title]="label"
18
+ display="chip"
19
+ [options]="options"
20
+ [optionLabel]="optionLabel"
21
+ [optionValue]="optionValue"
22
+ [loading]="loading"
23
+ [placeholder]="placeholder ? placeholder : label"
24
+ [virtualScrollItemSize]="25"
25
+ [lazy]="true"
26
+ [tooltip]="tooltip"
27
+ [required]="isRequired()"
28
+ [showClear]="formControl && clearable && !readonly"
29
+ [virtualScroll]="lazy"
30
+ [virtualScrollItemSize]="virtualOptionSize"
31
+ [virtualScrollOptions]="virtualScrollOptions"
32
+ (showEvent)="onDropdownShow()"
33
+ (clearEvent)="onDropdownClear()"
34
+ (changeEvent)="selectionChange($event)"
35
+ (lazyLoadEvent)="onLazyLoad($any($event))"
36
+ ></p-multiSelect>
37
+ </v-form-field>
38
+ </ng-container>
39
+ <ng-container *ngIf="floatLabel">
40
+ <p-floatLabel>
41
+ <p-multiSelect
42
+ [baseZIndex]="9999"
43
+ class="w-100"
44
+ appendTo="body"
45
+ [formControl]="formControl"
46
+ [title]="label"
47
+ [options]="options"
48
+ [optionLabel]="optionLabel"
49
+ [optionValue]="optionValue"
50
+ [loading]="loading"
51
+ [placeholder]="placeholder ? placeholder : label"
52
+ [virtualScrollItemSize]="25"
53
+ [lazy]="true"
54
+ [tooltip]="tooltip"
55
+ [required]="isRequired()"
56
+ [inputId]="inputId"
57
+ [showClear]="formControl && clearable && !readonly"
58
+ [virtualScroll]="lazy"
59
+ [virtualScrollItemSize]="virtualOptionSize"
60
+ [virtualScrollOptions]="virtualScrollOptions"
61
+ (showEvent)="onDropdownShow()"
62
+ (clearEvent)="onDropdownClear()"
63
+ (changeEvent)="selectionChange($event)"
64
+ (lazyLoadEvent)="onLazyLoad($any($event))"
65
+ ></p-multiSelect>
66
+ <label [for]="inputId">{{ floatLabel }}</label>
67
+ </p-floatLabel>
68
+ </ng-container>
69
+ </div>