@verisoft/ui-primeng 20.0.0 → 20.1.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 (219) hide show
  1. package/.eslintrc.json +43 -0
  2. package/assets/.gitkeep +0 -0
  3. package/jest.config.ts +22 -0
  4. package/ng-package.json +14 -0
  5. package/package.json +6 -18
  6. package/project.json +36 -0
  7. package/src/index.ts +34 -0
  8. package/src/lib/components/breadcrumb/breadcrumb.component.html +11 -0
  9. package/src/lib/components/breadcrumb/breadcrumb.component.scss +18 -0
  10. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
  11. package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +36 -0
  12. package/src/lib/components/breadcrumb/breadcrumb.component.ts +27 -0
  13. package/src/lib/components/breadcrumb/breadcrumb.pipe.ts +13 -0
  14. package/src/lib/components/breadcrumb/index.ts +1 -0
  15. package/src/lib/components/button/button-severity.pipe.ts +20 -0
  16. package/src/lib/components/button/button.component.html +20 -0
  17. package/src/lib/components/button/button.component.scss +0 -0
  18. package/src/lib/components/button/button.component.spec.ts +21 -0
  19. package/src/lib/components/button/button.component.ts +49 -0
  20. package/src/lib/components/button/index.ts +1 -0
  21. package/src/lib/components/calendar/calendar.component.html +53 -0
  22. package/src/lib/components/calendar/calendar.component.scss +0 -0
  23. package/src/lib/components/calendar/calendar.component.spec.ts +21 -0
  24. package/src/lib/components/calendar/calendar.component.ts +70 -0
  25. package/src/lib/components/calendar/index.ts +1 -0
  26. package/src/lib/components/checkbox/checkbox.component.html +20 -0
  27. package/src/lib/components/checkbox/checkbox.component.scss +15 -0
  28. package/src/lib/components/checkbox/checkbox.component.spec.ts +21 -0
  29. package/src/lib/components/checkbox/checkbox.component.stories.ts +72 -0
  30. package/src/lib/components/checkbox/checkbox.component.ts +46 -0
  31. package/src/lib/components/checkbox/index.ts +1 -0
  32. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +51 -0
  33. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +3 -0
  34. package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
  35. package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +74 -0
  36. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +73 -0
  37. package/src/lib/components/confirm-dialog/index.ts +1 -0
  38. package/src/lib/components/dropdown/dropdown.component.html +93 -0
  39. package/src/lib/components/dropdown/dropdown.component.scss +16 -0
  40. package/src/lib/components/dropdown/dropdown.component.spec.ts +21 -0
  41. package/src/lib/components/dropdown/dropdown.component.ts +139 -0
  42. package/src/lib/components/dropdown/index.ts +1 -0
  43. package/src/lib/components/dropdown-button/dropdown-button.component.html +1 -0
  44. package/src/lib/components/dropdown-button/dropdown-button.component.ts +20 -0
  45. package/src/lib/components/dropdown-button/index.ts +1 -0
  46. package/src/lib/components/errors/error.component.html +7 -0
  47. package/src/lib/components/errors/error.component.scss +3 -0
  48. package/src/lib/components/errors/error.component.ts +34 -0
  49. package/src/lib/components/errors/index.ts +1 -0
  50. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +32 -0
  51. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +8 -0
  52. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +21 -0
  53. package/src/lib/components/feature-list/feature-list-page.component.ts +32 -0
  54. package/src/lib/components/feature-list/feature-list-page.model.ts +42 -0
  55. package/src/lib/components/feature-list/feature-list.component.html +59 -0
  56. package/src/lib/components/feature-list/feature-list.component.scss +10 -0
  57. package/src/lib/components/feature-list/feature-list.component.ts +341 -0
  58. package/src/lib/components/feature-list/index.ts +5 -0
  59. package/src/lib/components/filter/directives/filter-field.directive.ts +34 -0
  60. package/src/lib/components/filter/filter.component.html +68 -0
  61. package/src/lib/components/filter/filter.component.scss +0 -0
  62. package/src/lib/components/filter/filter.component.spec.ts +21 -0
  63. package/src/lib/components/filter/filter.component.stories.ts +23 -0
  64. package/src/lib/components/filter/filter.component.ts +281 -0
  65. package/src/lib/components/filter/filter.model.ts +18 -0
  66. package/src/lib/components/filter/index.ts +2 -0
  67. package/src/lib/components/form-field/form-field.component.html +42 -0
  68. package/src/lib/components/form-field/form-field.component.scss +0 -0
  69. package/src/lib/components/form-field/form-field.component.spec.ts +21 -0
  70. package/src/lib/components/form-field/form-field.component.stories.ts +69 -0
  71. package/src/lib/components/form-field/form-field.component.ts +37 -0
  72. package/src/lib/components/form-field/index.ts +1 -0
  73. package/src/lib/components/header/header.component.html +84 -0
  74. package/src/lib/components/header/header.component.scss +0 -0
  75. package/src/lib/components/header/header.component.spec.ts +21 -0
  76. package/src/lib/components/header/header.component.stories.ts +24 -0
  77. package/src/lib/components/header/header.component.ts +65 -0
  78. package/src/lib/components/header/index.ts +2 -0
  79. package/src/lib/components/header/services/header-provider.service.ts +15 -0
  80. package/src/lib/components/icon/icon.component.html +2 -0
  81. package/src/lib/components/icon/icon.component.scss +51 -0
  82. package/src/lib/components/icon/icon.component.ts +86 -0
  83. package/src/lib/components/icon/index.ts +2 -0
  84. package/src/lib/components/input-group/index.ts +1 -0
  85. package/src/lib/components/input-group/input-group.component.html +34 -0
  86. package/src/lib/components/input-group/input-group.component.spec.ts +21 -0
  87. package/src/lib/components/input-group/input-group.component.ts +58 -0
  88. package/src/lib/components/loader/index.ts +1 -0
  89. package/src/lib/components/loader/loader.component.html +5 -0
  90. package/src/lib/components/loader/loader.component.scss +0 -0
  91. package/src/lib/components/loader/loader.component.spec.ts +21 -0
  92. package/src/lib/components/loader/loader.component.ts +16 -0
  93. package/src/lib/components/multiselect/index.ts +1 -0
  94. package/src/lib/components/multiselect/multiselect.component.html +67 -0
  95. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  96. package/src/lib/components/multiselect/multiselect.component.spec.ts +21 -0
  97. package/src/lib/components/multiselect/multiselect.component.ts +120 -0
  98. package/src/lib/components/number-input/index.ts +1 -0
  99. package/src/lib/components/number-input/number-input.component.html +22 -0
  100. package/src/lib/components/number-input/number-input.component.spec.ts +21 -0
  101. package/src/lib/components/number-input/number-input.component.ts +55 -0
  102. package/src/lib/components/page-header/index.ts +1 -0
  103. package/src/lib/components/page-header/page-header.component.html +35 -0
  104. package/src/lib/components/page-header/page-header.component.scss +0 -0
  105. package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
  106. package/src/lib/components/page-header/page-header.component.ts +31 -0
  107. package/src/lib/components/password/index.ts +1 -0
  108. package/src/lib/components/password/password.component.html +24 -0
  109. package/src/lib/components/password/password.component.scss +0 -0
  110. package/src/lib/components/password/password.component.spec.ts +21 -0
  111. package/src/lib/components/password/password.component.ts +56 -0
  112. package/src/lib/components/radiobutton/index.ts +1 -0
  113. package/src/lib/components/radiobutton/radiobutton.component.html +34 -0
  114. package/src/lib/components/radiobutton/radiobutton.component.scss +6 -0
  115. package/src/lib/components/radiobutton/radiobutton.component.spec.ts +21 -0
  116. package/src/lib/components/radiobutton/radiobutton.component.stories.ts +71 -0
  117. package/src/lib/components/radiobutton/radiobutton.component.ts +61 -0
  118. package/src/lib/components/section/index.ts +1 -0
  119. package/src/lib/components/section/section.component.html +25 -0
  120. package/src/lib/components/section/section.component.scss +0 -0
  121. package/src/lib/components/section/section.component.spec.ts +21 -0
  122. package/src/lib/components/section/section.component.ts +31 -0
  123. package/src/lib/components/shared-components/.eslintrc.json +42 -0
  124. package/src/lib/components/shared-components/action-button-group/action-button-group.component.html +25 -0
  125. package/src/lib/components/shared-components/action-button-group/action-button-group.component.scss +0 -0
  126. package/src/lib/components/shared-components/action-button-group/action-button-group.component.spec.ts +21 -0
  127. package/src/lib/components/shared-components/action-button-group/action-button-group.component.ts +111 -0
  128. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.html +10 -0
  129. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.scss +0 -0
  130. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.spec.ts +21 -0
  131. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +69 -0
  132. package/src/lib/components/shared-components/action-button-group/index.ts +2 -0
  133. package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +142 -0
  134. package/src/lib/components/shared-components/dynamic-component/dynamic-component.component.ts +56 -0
  135. package/src/lib/components/shared-components/dynamic-component/index.ts +2 -0
  136. package/src/lib/components/shared-components/generic-field/generic-field.component.html +98 -0
  137. package/src/lib/components/shared-components/generic-field/generic-field.component.spec.ts +21 -0
  138. package/src/lib/components/shared-components/generic-field/generic-field.component.ts +90 -0
  139. package/src/lib/components/shared-components/generic-field/index.ts +1 -0
  140. package/src/lib/components/shared-components/generic-form/generic-form.component.html +46 -0
  141. package/src/lib/components/shared-components/generic-form/generic-form.component.spec.ts +21 -0
  142. package/src/lib/components/shared-components/generic-form/generic-form.component.ts +56 -0
  143. package/src/lib/components/shared-components/generic-form/generic-form.model.spec.ts +82 -0
  144. package/src/lib/components/shared-components/generic-form/generic-form.model.ts +68 -0
  145. package/src/lib/components/shared-components/generic-form/index.ts +2 -0
  146. package/src/lib/components/shared-components/index.ts +4 -0
  147. package/src/lib/components/side-menu/index.ts +2 -0
  148. package/src/lib/components/side-menu/side-menu.component.html +53 -0
  149. package/src/lib/components/side-menu/side-menu.component.scss +0 -0
  150. package/src/lib/components/side-menu/side-menu.component.spec.ts +21 -0
  151. package/src/lib/components/side-menu/side-menu.component.ts +96 -0
  152. package/src/lib/components/side-menu/side-menu.module.ts +66 -0
  153. package/src/lib/components/slider/index.ts +1 -0
  154. package/src/lib/components/slider/slider.component.html +19 -0
  155. package/src/lib/components/slider/slider.component.spec.ts +21 -0
  156. package/src/lib/components/slider/slider.component.ts +56 -0
  157. package/src/lib/components/snackbar/index.ts +2 -0
  158. package/src/lib/components/snackbar/services/snackbar.service.ts +45 -0
  159. package/src/lib/components/snackbar/snackbar.component.html +3 -0
  160. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  161. package/src/lib/components/snackbar/snackbar.component.spec.ts +21 -0
  162. package/src/lib/components/snackbar/snackbar.component.stories.ts +70 -0
  163. package/src/lib/components/snackbar/snackbar.component.ts +25 -0
  164. package/src/lib/components/stepper/index.ts +1 -0
  165. package/src/lib/components/stepper/stepper.component.html +35 -0
  166. package/src/lib/components/stepper/stepper.component.spec.ts +21 -0
  167. package/src/lib/components/stepper/stepper.component.ts +39 -0
  168. package/src/lib/components/switch/index.ts +1 -0
  169. package/src/lib/components/switch/switch.component.html +18 -0
  170. package/src/lib/components/switch/switch.component.scss +0 -0
  171. package/src/lib/components/switch/switch.component.spec.ts +21 -0
  172. package/src/lib/components/switch/switch.component.stories.ts +65 -0
  173. package/src/lib/components/switch/switch.component.ts +52 -0
  174. package/src/lib/components/tab-view/index.ts +2 -0
  175. package/src/lib/components/tab-view/tab-view-item.component.ts +22 -0
  176. package/src/lib/components/tab-view/tab-view.component.html +41 -0
  177. package/src/lib/components/tab-view/tab-view.component.ts +55 -0
  178. package/src/lib/components/table/index.ts +1 -0
  179. package/src/lib/components/table/table-filter.pipe.ts +59 -0
  180. package/src/lib/components/table/table.component.html +127 -0
  181. package/src/lib/components/table/table.component.scss +11 -0
  182. package/src/lib/components/table/table.component.spec.ts +21 -0
  183. package/src/lib/components/table/table.component.stories.ts +55 -0
  184. package/src/lib/components/table/table.component.ts +288 -0
  185. package/src/lib/components/table/table.models.ts +26 -0
  186. package/src/lib/components/tag/index.ts +2 -0
  187. package/src/lib/components/tag/tag.component.html +12 -0
  188. package/src/lib/components/tag/tag.component.scss +33 -0
  189. package/src/lib/components/tag/tag.component.ts +83 -0
  190. package/src/lib/components/textarea/index.ts +1 -0
  191. package/src/lib/components/textarea/textarea.component.html +40 -0
  192. package/src/lib/components/textarea/textarea.component.scss +5 -0
  193. package/src/lib/components/textarea/textarea.component.spec.ts +21 -0
  194. package/src/lib/components/textarea/textarea.component.stories.ts +98 -0
  195. package/src/lib/components/textarea/textarea.component.ts +62 -0
  196. package/src/lib/components/textfield/index.ts +1 -0
  197. package/src/lib/components/textfield/textfield.component.html +82 -0
  198. package/src/lib/components/textfield/textfield.component.scss +23 -0
  199. package/src/lib/components/textfield/textfield.component.spec.ts +21 -0
  200. package/src/lib/components/textfield/textfield.component.stories.ts +85 -0
  201. package/src/lib/components/textfield/textfield.component.ts +68 -0
  202. package/src/lib/components/tooltip/index.ts +1 -0
  203. package/src/lib/components/tooltip/tooltip.component.html +3 -0
  204. package/src/lib/components/tooltip/tooltip.component.ts +17 -0
  205. package/src/lib/icons.ts +36 -0
  206. package/src/lib/interceptors/http-error-message.interceptor.ts +35 -0
  207. package/src/lib/pages/not-found-page/not-found-page.component.html +26 -0
  208. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  209. package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +21 -0
  210. package/src/lib/pages/not-found-page/not-found-page.component.ts +16 -0
  211. package/src/tab-view.ts +1 -0
  212. package/src/test-setup.ts +8 -0
  213. package/tsconfig.json +29 -0
  214. package/tsconfig.lib.json +18 -0
  215. package/tsconfig.lib.prod.json +9 -0
  216. package/tsconfig.spec.json +16 -0
  217. package/fesm2022/verisoft-ui-primeng.mjs +0 -2866
  218. package/fesm2022/verisoft-ui-primeng.mjs.map +0 -1
  219. package/index.d.ts +0 -729
@@ -0,0 +1,72 @@
1
+ import {
2
+ ReactiveFormsModule,
3
+ UntypedFormControl,
4
+ Validators,
5
+ } from '@angular/forms';
6
+ import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
7
+ import { CheckboxComponent } from './checkbox.component';
8
+
9
+ const meta: Meta<CheckboxComponent> = {
10
+ component: CheckboxComponent,
11
+ title: 'CheckboxComponent',
12
+ decorators: [
13
+ moduleMetadata({
14
+ imports: [ReactiveFormsModule],
15
+ }),
16
+ ],
17
+ };
18
+ export default meta;
19
+ type StoryOb = StoryObj<CheckboxComponent>;
20
+
21
+ export const Primary: StoryOb = {
22
+ parameters: {
23
+ controls: { expanded: true },
24
+ },
25
+ args: {
26
+ label: 'Test checkbox',
27
+ disabled: false,
28
+ readonly: false,
29
+ required: false,
30
+ },
31
+ argTypes: {
32
+ label: {
33
+ description:
34
+ 'Label shown on the right side of the `VerisoftCheckbox` input',
35
+ },
36
+ required: {
37
+ description: 'Can be set via formControl `Validators.requiredTrue`',
38
+ control: { disable: true },
39
+ },
40
+ disabled: {
41
+ description: 'Sets `disabled` state',
42
+ },
43
+ readonly: {
44
+ description: 'Sets `readonly` state',
45
+ },
46
+ },
47
+ };
48
+
49
+ export const CheckboxRequired: StoryOb = {
50
+ parameters: {
51
+ controls: { expanded: true },
52
+ },
53
+ args: {
54
+ label: 'Agree to terms and conditions',
55
+ formControl: new UntypedFormControl(false, Validators.requiredTrue),
56
+ disabled: false,
57
+ readonly: false,
58
+ },
59
+ argTypes: {
60
+ label: {
61
+ control: 'text',
62
+ description:
63
+ 'Represents the `label` of the `CheckboxComponent`. Label is also being used as `placeholder` if the placeholder is not set',
64
+ },
65
+ formControl: {
66
+ description: 'Form control with `Validators.requiredTrue` set',
67
+ control: { disable: true },
68
+ },
69
+ disabled: { description: 'Sets `disabled` state' },
70
+ readonly: { description: 'Sets `readonly` state' },
71
+ },
72
+ };
@@ -0,0 +1,46 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ input,
6
+ Optional,
7
+ Self,
8
+ } from '@angular/core';
9
+ import {
10
+ ControlValueAccessor,
11
+ NgControl,
12
+ ReactiveFormsModule,
13
+ } from '@angular/forms';
14
+ import { BaseFormInputComponent, BaseInputControls, CHECKBOX_COMPONENT_TOKEN, CheckboxCore } from '@verisoft/ui-core';
15
+ import { CheckboxModule } from 'primeng/checkbox';
16
+ import { Icons } from '../../icons';
17
+ import { ErrorComponent } from '../errors';
18
+ import { FormFieldComponent } from '../form-field';
19
+ @Component({
20
+ selector: 'v-checkbox',
21
+ imports: [CommonModule, CheckboxModule, ReactiveFormsModule, FormFieldComponent, ErrorComponent],
22
+ templateUrl: './checkbox.component.html',
23
+ styleUrl: './checkbox.component.scss',
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+ providers: [
26
+ {
27
+ provide: BaseInputControls,
28
+ useExisting: CheckboxComponent,
29
+ },
30
+ {
31
+ provide: CHECKBOX_COMPONENT_TOKEN,
32
+ useExisting: CheckboxComponent,
33
+ },
34
+ ]
35
+ })
36
+ export class CheckboxComponent
37
+ extends BaseFormInputComponent
38
+ implements ControlValueAccessor, CheckboxCore {
39
+ indeterminate = input(false);
40
+
41
+ icon = Icons
42
+
43
+ constructor(@Optional() @Self() ngControl: NgControl) {
44
+ super(ngControl);
45
+ }
46
+ }
@@ -0,0 +1 @@
1
+ export * from './checkbox.component';
@@ -0,0 +1,51 @@
1
+ @if (data) {
2
+ <div class="v-dialog d-flex justify-content-center">
3
+ <p-dialog
4
+ [(visible)]="visible"
5
+ [modal]="true"
6
+ [closable]="closable"
7
+ [style]="{ width: '25rem' }"
8
+ >
9
+ <ng-template pTemplate="header">
10
+ <div
11
+ class="v-dialog-header w-100 align-items-center d-flex justify-content-center"
12
+ >
13
+ <h1 class="text-center me-3">{{ data.title }}</h1>
14
+ <i class="{{ data.headerIcon }} text-{{ data.severity }}"></i>
15
+ </div>
16
+ </ng-template>
17
+ <div class="v-dialog-content w-100 align-items-center text-center">
18
+ @if (data.innerHTML) {
19
+ <div [innerHTML]="data.innerHTML"></div>
20
+ } @else if (data.componentType) {
21
+ <v-dynamic-component
22
+ [componentType]="data.componentType"
23
+ [data]="$any(data.data)"
24
+ ></v-dynamic-component>
25
+ }
26
+ </div>
27
+ <ng-template pTemplate="footer">
28
+ <div
29
+ class="v-dialog-footer d-flex justify-content-center w-100 gap-3"
30
+ [ngClass]="{
31
+ 'flex-row-reverse': data.buttonOrder === 'cancel-confirm'
32
+ }"
33
+ >
34
+ <v-button
35
+ [label]="data.confirmButtonText ?? 'Yes'"
36
+ [severity]="data.severity"
37
+ (click)="data.confirmButtonFn ? dialogClick(true) : (visible = false)"
38
+ />
39
+ @if (data.showCancelButton && data.severity !== 'success') {
40
+ <v-button
41
+ [label]="data.cancelButtonText ?? 'No'"
42
+ [outlined]="true"
43
+ [severity]="'secondary'"
44
+ (click)="data.cancelButtonFn ? dialogClick(false) : (visible = false)"
45
+ />
46
+ }
47
+ </div>
48
+ </ng-template>
49
+ </p-dialog>
50
+ </div>
51
+ }
@@ -0,0 +1,3 @@
1
+ .v-dialog-content * {
2
+ line-height: 1.5rem;
3
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { ConfirmDialogComponent } from './confirm-dialog.component';
3
+
4
+ describe('ConfirmDialogComponent', () => {
5
+ let component: ConfirmDialogComponent;
6
+ let fixture: ComponentFixture<ConfirmDialogComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [ConfirmDialogComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(ConfirmDialogComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,74 @@
1
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
2
+ import { ActivatedRoute } from '@angular/router';
3
+ import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
4
+ import { ButtonComponent } from '../button';
5
+ import { ConfirmDialogComponent } from './confirm-dialog.component';
6
+
7
+ const meta: Meta<ConfirmDialogComponent> = {
8
+ component: ConfirmDialogComponent,
9
+ title: 'ConfirmDialogComponent',
10
+ decorators: [
11
+ moduleMetadata({
12
+ imports: [BrowserAnimationsModule, ButtonComponent],
13
+ providers: [
14
+ {
15
+ provide: ActivatedRoute,
16
+ useValue: ActivatedRoute,
17
+ },
18
+ ],
19
+ }),
20
+ ],
21
+ };
22
+ export default meta;
23
+ type Story = StoryObj<ConfirmDialogComponent>;
24
+ const dataOptions = [
25
+ {
26
+ headerIcon: 'pi pi-times',
27
+ severity: 'danger',
28
+ confirmButtonText: 'Agreed',
29
+ innerHtml:
30
+ 'You are <b class="text-danger">not allowed</b> to do that. Please contact <b>admin</b>.',
31
+ label: 'Danger',
32
+ },
33
+ {
34
+ headerIcon: 'pi pi-check',
35
+ severity: 'success',
36
+ confirmButtonText: 'Agreed',
37
+ innerHtml: 'Item <b class="text-success">successfully</b> saved.',
38
+ label: 'Success',
39
+ },
40
+ {
41
+ headerIcon: 'pi pi-exclamation-triangle',
42
+ severity: 'primary',
43
+ confirmButtonText: 'Agreed',
44
+ innerHtml:
45
+ 'You might be <b class="text-primary">not allowed</b> to do that. Please contact <b>admin</b>.',
46
+ label: 'Warn',
47
+ },
48
+ ];
49
+
50
+ const dataOptionsMap = {
51
+ Danger: dataOptions[0],
52
+ Success: dataOptions[1],
53
+ Warn: dataOptions[2],
54
+ };
55
+
56
+ export const Primary = {
57
+ args: {
58
+ visible: true,
59
+ data: dataOptions[0],
60
+ },
61
+ argTypes: {
62
+ data: {
63
+ options: dataOptionsMap,
64
+ control: {
65
+ type: 'select',
66
+ labels: {
67
+ danger: 'Danger',
68
+ success: 'Success',
69
+ warn: 'Warn',
70
+ },
71
+ },
72
+ },
73
+ },
74
+ };
@@ -0,0 +1,73 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
3
+ import {
4
+ CONFIRM_DIALOG_COMPONENT_TOKEN,
5
+ ConfirmDialogCore,
6
+ DialogData,
7
+ DialogService,
8
+ UnsubscribeComponent,
9
+ } from '@verisoft/ui-core';
10
+ import { AvatarModule } from 'primeng/avatar';
11
+ import { DialogModule } from 'primeng/dialog';
12
+ import { takeUntil } from 'rxjs';
13
+ import { ButtonComponent } from '../button';
14
+ import { DynamicComponent } from '../shared-components';
15
+
16
+ @Component({
17
+ selector: 'v-confirm-dialog',
18
+ imports: [
19
+ CommonModule,
20
+ DialogModule,
21
+ ButtonComponent,
22
+ AvatarModule,
23
+ DynamicComponent,
24
+ ],
25
+ templateUrl: './confirm-dialog.component.html',
26
+ styleUrl: './confirm-dialog.component.scss',
27
+ providers: [
28
+ {
29
+ provide: CONFIRM_DIALOG_COMPONENT_TOKEN,
30
+ useExisting: ConfirmDialogComponent,
31
+ },
32
+ ]
33
+ })
34
+ export class ConfirmDialogComponent
35
+ extends UnsubscribeComponent
36
+ implements OnInit, ConfirmDialogCore
37
+ {
38
+ constructor(
39
+ private readonly dialogService: DialogService,
40
+ private readonly cdr: ChangeDetectorRef
41
+ ) {
42
+ super();
43
+ }
44
+
45
+ visible = false;
46
+ protected closable = false;
47
+ data!: DialogData;
48
+
49
+ ngOnInit(): void {
50
+ this.dialogService.showEvent
51
+ .pipe(takeUntil(this.destroyed$))
52
+ .subscribe((x: DialogData) => {
53
+ this.data = x;
54
+ this.visible = true;
55
+ this.cdr.detectChanges();
56
+ });
57
+ }
58
+
59
+ protected dialogClick(confirm: boolean) {
60
+ const { confirmButtonFn, cancelButtonFn } = this.data;
61
+
62
+ if (confirm && confirmButtonFn) {
63
+ confirmButtonFn();
64
+ }
65
+
66
+ if (!confirm && cancelButtonFn) {
67
+ cancelButtonFn();
68
+ }
69
+
70
+ this.visible = false;
71
+ this.cdr.detectChanges();
72
+ }
73
+ }
@@ -0,0 +1 @@
1
+ export * from './confirm-dialog.component';
@@ -0,0 +1,93 @@
1
+ <div class="v-dropdown">
2
+ @if (label && !floatLabel) {
3
+ <v-form-field
4
+ [label]="label"
5
+ [tooltip]="tooltip"
6
+ [required]="isRequired()"
7
+ [testId]="testId"
8
+ [display]="formDisplay"
9
+ >
10
+ <p-select
11
+ class="w-100"
12
+ appendTo="body"
13
+ [formControl]="formControl"
14
+ [filter]="filter"
15
+ [title]="label"
16
+ [options]="options"
17
+ [optionLabel]="optionLabel"
18
+ [optionValue]="optionValue"
19
+ [loading]="loading"
20
+ [placeholder]="placeholder ?? ''"
21
+ [virtualScroll]="lazy"
22
+ [virtualScrollItemSize]="virtualOptionSize"
23
+ [virtualScrollOptions]="virtualScrollOptions"
24
+ [tooltip]="tooltip"
25
+ [required]="isRequired()"
26
+ [showClear]="formControl && clearable && !readonly"
27
+ [editable]="editable"
28
+ [dataKey]="optionValue"
29
+ (showEvent)="onDropdownShow()"
30
+ (clearEvent)="onDropdownClear()"
31
+ (onFilter)="filterChange($event)"
32
+ >
33
+ </p-select>
34
+ </v-form-field>
35
+ <v-validation-message [ngControl]="ngControl"></v-validation-message>
36
+ }
37
+ @if (!label && !floatLabel) {
38
+ <p-select
39
+ class="w-100"
40
+ appendTo="body"
41
+ [formControl]="formControl"
42
+ [filter]="filter"
43
+ [title]="label"
44
+ [options]="options"
45
+ [optionLabel]="optionLabel"
46
+ [optionValue]="optionValue"
47
+ [loading]="loading"
48
+ [placeholder]="placeholder ? placeholder : label"
49
+ [tooltip]="tooltip"
50
+ [required]="isRequired()"
51
+ [showClear]="formControl && clearable && !readonly"
52
+ [editable]="editable"
53
+ [dataKey]="optionValue"
54
+ [virtualScroll]="lazy"
55
+ [virtualScrollItemSize]="virtualOptionSize"
56
+ [virtualScrollOptions]="virtualScrollOptions"
57
+ (showEvent)="onDropdownShow()"
58
+ (clearEvent)="onDropdownClear()"
59
+ (onFilter)="filterChange($event)"
60
+ >
61
+ </p-select>
62
+ }
63
+ @if (floatLabel && !label) {
64
+ <p-floatLabel>
65
+ <p-select
66
+ class="w-100"
67
+ appendTo="body"
68
+ [formControl]="formControl"
69
+ [title]="label"
70
+ [options]="options"
71
+ [optionLabel]="optionLabel"
72
+ [optionValue]="optionValue"
73
+ [loading]="loading"
74
+ [placeholder]="placeholder ? placeholder : label"
75
+ [filter]="filter"
76
+ [tooltip]="tooltip"
77
+ [required]="isRequired()"
78
+ [showClear]="formControl && clearable && !readonly"
79
+ [editable]="editable"
80
+ [dataKey]="optionValue"
81
+ [virtualScroll]="lazy"
82
+ [virtualScrollItemSize]="virtualOptionSize"
83
+ [virtualScrollOptions]="virtualScrollOptions"
84
+ (showEvent)="onDropdownShow()"
85
+ (clearEvent)="onDropdownClear()"
86
+ (onFilter)="filterChange($event)"
87
+ (lazyLoad)="onLazyLoad($any($event))"
88
+ >
89
+ </p-select>
90
+ <label [for]="inputId">{{ floatLabel }}</label>
91
+ </p-floatLabel>
92
+ }
93
+ </div>
@@ -0,0 +1,16 @@
1
+ .v-dropdown {
2
+ justify-content: center;
3
+ width: 100%;
4
+ }
5
+
6
+ .p-dropdown-items-wrapper,
7
+ .p-scroller-viewport,
8
+ .p-scroller {
9
+ min-width: 8rem !important;
10
+ overflow-x: hidden;
11
+ overflow-y: auto;
12
+ }
13
+
14
+ .p-dropdown {
15
+ width: 100%;
16
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { DropdownComponent } from './dropdown.component';
3
+
4
+ describe('DropdownComponent', () => {
5
+ let component: DropdownComponent<any>;
6
+ let fixture: ComponentFixture<DropdownComponent<any>>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [DropdownComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(DropdownComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,139 @@
1
+
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ EventEmitter,
6
+ forwardRef,
7
+ Input,
8
+ OnChanges,
9
+ OnDestroy,
10
+ Optional,
11
+ Output,
12
+ Self,
13
+ SimpleChanges,
14
+ ViewEncapsulation,
15
+ OnInit,
16
+ } from '@angular/core';
17
+ import {
18
+ ControlValueAccessor,
19
+ NgControl,
20
+ ReactiveFormsModule,
21
+ } from '@angular/forms';
22
+ import { FilterEvent, LazyLoadEvent } from '@verisoft/core';
23
+ import {
24
+ BaseFormInputComponent,
25
+ BaseInputControls,
26
+ DROPDOWN_COMPONENT_TOKEN,
27
+ DropdownCore
28
+ } from '@verisoft/ui-core';
29
+ import { ScrollerOptions } from 'primeng/api';
30
+ import { FloatLabelModule } from 'primeng/floatlabel';
31
+ import { MessageModule } from 'primeng/message';
32
+ import { ScrollerLazyLoadEvent } from 'primeng/scroller';
33
+ import { SelectModule, SelectFilterEvent } from 'primeng/select';
34
+ import { TooltipModule } from 'primeng/tooltip';
35
+ import { Subject } from 'rxjs';
36
+ import { ErrorComponent } from '../errors';
37
+ import { FormFieldComponent } from '../form-field';
38
+
39
+ @Component({
40
+ selector: 'v-dropdown',
41
+ imports: [
42
+ ReactiveFormsModule,
43
+ SelectModule,
44
+ TooltipModule,
45
+ FormFieldComponent,
46
+ MessageModule,
47
+ FloatLabelModule,
48
+ ErrorComponent
49
+ ],
50
+ templateUrl: './dropdown.component.html',
51
+ styleUrls: ['./dropdown.component.scss'],
52
+ changeDetection: ChangeDetectionStrategy.OnPush,
53
+ encapsulation: ViewEncapsulation.None,
54
+ providers: [
55
+ {
56
+ provide: BaseInputControls,
57
+ useExisting: forwardRef(() => DropdownComponent),
58
+ multi: true,
59
+ },
60
+ {
61
+ provide: DROPDOWN_COMPONENT_TOKEN,
62
+ useExisting: DropdownComponent,
63
+ },
64
+ ]
65
+ })
66
+ export class DropdownComponent<T>
67
+ extends BaseFormInputComponent
68
+ implements
69
+ ControlValueAccessor,
70
+ OnChanges,
71
+ OnDestroy,
72
+ OnInit,
73
+ DropdownCore<T>
74
+ {
75
+ constructor(@Optional() @Self() ngControl: NgControl) {
76
+ super(ngControl);
77
+ }
78
+
79
+ @Input() options: T[] | undefined = [];
80
+ @Input() optionLabel: string | undefined;
81
+ @Input() optionValue: string | undefined;
82
+ @Input() dropdownIcon?: string;
83
+ @Input() floatLabel?: string;
84
+ @Input() editable = false;
85
+ @Input() loading = false;
86
+ @Input() lazy = false;
87
+ @Input() filter = true;
88
+ @Input() forceMinWidth = false;
89
+ @Input() showFilter = false;
90
+ @Input() localSearch = false;
91
+
92
+ @Output() showed = new EventEmitter<any>();
93
+ @Output() cleared = new EventEmitter<any>();
94
+ @Output() lazyLoad = new EventEmitter<LazyLoadEvent>();
95
+ @Output() filtered = new EventEmitter<FilterEvent>();
96
+
97
+ private destroy$ = new Subject<void>();
98
+
99
+ virtualScrollOptions!: ScrollerOptions | undefined;
100
+ virtualOptionSize = 37.5;
101
+
102
+ ngOnChanges(changes: SimpleChanges): void {
103
+ if (changes['lazy'] || changes['loading']) {
104
+ this.virtualScrollOptions = this.lazy
105
+ ? {
106
+ showLoader: this.loading,
107
+ lazy: true,
108
+ onLazyLoad: this.onLazyLoad.bind(this),
109
+ }
110
+ : undefined;
111
+ }
112
+ }
113
+
114
+ ngOnDestroy(): void {
115
+ this.destroy$.next();
116
+ this.destroy$.complete();
117
+ }
118
+
119
+ onLazyLoad(event: ScrollerLazyLoadEvent): void {
120
+ this.lazyLoad.emit({
121
+ offset: event.first,
122
+ limit: event.last - event.first,
123
+ });
124
+ }
125
+
126
+ filterChange(event: SelectFilterEvent): void {
127
+ this.filtered.emit({
128
+ filter: event.filter,
129
+ });
130
+ }
131
+
132
+ onDropdownShow(): void {
133
+ this.showed.emit();
134
+ }
135
+
136
+ onDropdownClear(): void {
137
+ this.cleared.emit();
138
+ }
139
+ }
@@ -0,0 +1 @@
1
+ export * from './dropdown.component';
@@ -0,0 +1 @@
1
+ <p>NOT implemented </p>
@@ -0,0 +1,20 @@
1
+ import { Component, input } from "@angular/core";
2
+ import { DropdownButtonCore, DROPDOWN_BUTTON_COMPONENT_TOKEN, ControlSeverityType, ControlSeverity, FieldSizeType, MenuItem } from "@verisoft/ui-core";
3
+
4
+ @Component({
5
+ selector: 'v-dropdown-button',
6
+ templateUrl: './dropdown-button.component.html',
7
+ providers: [
8
+ { provide: DROPDOWN_BUTTON_COMPONENT_TOKEN, useExisting: DropdownButtonComponent }
9
+ ]
10
+ })
11
+ export class DropdownButtonComponent implements DropdownButtonCore {
12
+ label = input<string | undefined>();
13
+ icon = input<string | undefined>();
14
+ rounded = input<boolean | undefined>(false);
15
+ raised = input<boolean | undefined>(false);
16
+ outlined = input<boolean | undefined>(false);
17
+ severity = input<ControlSeverityType | undefined>(ControlSeverity.primary);
18
+ size = input<FieldSizeType | undefined>();
19
+ items = input<MenuItem[] | undefined>(undefined);
20
+ }
@@ -0,0 +1 @@
1
+ export * from './dropdown-button.component';
@@ -0,0 +1,7 @@
1
+
2
+ @if (ngControl && ngControl.errors) {
3
+ <p-message
4
+ [severity]="severity"
5
+ text="{{ getErrorMessage(ngControl.errors) | async }}">
6
+ </p-message>
7
+ }
@@ -0,0 +1,3 @@
1
+ .p-message-content {
2
+ color: #e60017;
3
+ }