@verisoft/ui-govcz 20.1.1 → 20.1.2

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 (244) hide show
  1. package/fesm2022/verisoft-ui-govcz.mjs +3770 -0
  2. package/fesm2022/verisoft-ui-govcz.mjs.map +1 -0
  3. package/index.d.ts +1013 -0
  4. package/package.json +19 -7
  5. package/.eslintrc.json +0 -60
  6. package/jest.config.ts +0 -21
  7. package/ng-package.json +0 -28
  8. package/project.json +0 -49
  9. package/src/config.d.ts +0 -10
  10. package/src/index.ts +0 -1
  11. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -25
  12. package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -0
  13. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -21
  14. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -28
  15. package/src/lib/components/breadcrumb/index.ts +0 -1
  16. package/src/lib/components/button/button.component.html +0 -28
  17. package/src/lib/components/button/button.component.scss +0 -21
  18. package/src/lib/components/button/button.component.ts +0 -77
  19. package/src/lib/components/button/index.ts +0 -1
  20. package/src/lib/components/calendar/calendar.component.html +0 -28
  21. package/src/lib/components/calendar/calendar.component.scss +0 -0
  22. package/src/lib/components/calendar/calendar.component.ts +0 -77
  23. package/src/lib/components/calendar/index.ts +0 -1
  24. package/src/lib/components/checkbox/checkbox.component.html +0 -23
  25. package/src/lib/components/checkbox/checkbox.component.scss +0 -0
  26. package/src/lib/components/checkbox/checkbox.component.ts +0 -61
  27. package/src/lib/components/checkbox/index.ts +0 -1
  28. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +0 -50
  29. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +0 -4
  30. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +0 -79
  31. package/src/lib/components/confirm-dialog/index.ts +0 -1
  32. package/src/lib/components/dropdown/dropdown-item.component.html +0 -8
  33. package/src/lib/components/dropdown/dropdown-item.component.ts +0 -18
  34. package/src/lib/components/dropdown/dropdown.component.html +0 -91
  35. package/src/lib/components/dropdown/dropdown.component.scss +0 -108
  36. package/src/lib/components/dropdown/dropdown.component.spec.ts +0 -21
  37. package/src/lib/components/dropdown/dropdown.component.ts +0 -296
  38. package/src/lib/components/dropdown/dropdown.model.ts +0 -6
  39. package/src/lib/components/dropdown/index.ts +0 -1
  40. package/src/lib/components/dropdown-button/dropdown-button.component.html +0 -31
  41. package/src/lib/components/dropdown-button/dropdown-button.component.ts +0 -34
  42. package/src/lib/components/dropdown-button/index.ts +0 -1
  43. package/src/lib/components/errors/error.component.html +0 -11
  44. package/src/lib/components/errors/error.component.scss +0 -0
  45. package/src/lib/components/errors/error.component.spec.ts +0 -19
  46. package/src/lib/components/errors/error.component.ts +0 -29
  47. package/src/lib/components/errors/index.ts +0 -1
  48. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +0 -32
  49. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +0 -8
  50. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +0 -20
  51. package/src/lib/components/feature-list/feature-list-page.component.ts +0 -30
  52. package/src/lib/components/feature-list/feature-list-page.model.ts +0 -42
  53. package/src/lib/components/feature-list/feature-list.component.html +0 -67
  54. package/src/lib/components/feature-list/feature-list.component.scss +0 -10
  55. package/src/lib/components/feature-list/feature-list.component.ts +0 -360
  56. package/src/lib/components/feature-list/index.ts +0 -5
  57. package/src/lib/components/filter/directives/filter-field.directive.ts +0 -35
  58. package/src/lib/components/filter/filter.component.html +0 -78
  59. package/src/lib/components/filter/filter.component.scss +0 -32
  60. package/src/lib/components/filter/filter.component.spec.ts +0 -21
  61. package/src/lib/components/filter/filter.component.stories.ts +0 -23
  62. package/src/lib/components/filter/filter.component.ts +0 -286
  63. package/src/lib/components/filter/filter.model.ts +0 -18
  64. package/src/lib/components/filter/index.ts +0 -2
  65. package/src/lib/components/form-field/form-field.component.html +0 -14
  66. package/src/lib/components/form-field/form-field.component.scss +0 -0
  67. package/src/lib/components/form-field/form-field.component.spec.ts +0 -21
  68. package/src/lib/components/form-field/form-field.component.ts +0 -76
  69. package/src/lib/components/form-field/index.ts +0 -1
  70. package/src/lib/components/header/header.component.html +0 -122
  71. package/src/lib/components/header/header.component.scss +0 -0
  72. package/src/lib/components/header/header.component.ts +0 -90
  73. package/src/lib/components/header/index.ts +0 -1
  74. package/src/lib/components/icon/icon.component.html +0 -11
  75. package/src/lib/components/icon/icon.component.scss +0 -20
  76. package/src/lib/components/icon/icon.component.ts +0 -110
  77. package/src/lib/components/icon/index.ts +0 -2
  78. package/src/lib/components/index.ts +0 -37
  79. package/src/lib/components/input-group/index.ts +0 -1
  80. package/src/lib/components/input-group/input-group.component.html +0 -41
  81. package/src/lib/components/input-group/input-group.component.scss +0 -0
  82. package/src/lib/components/input-group/input-group.component.ts +0 -75
  83. package/src/lib/components/loader/index.ts +0 -1
  84. package/src/lib/components/loader/loader.component.html +0 -7
  85. package/src/lib/components/loader/loader.component.scss +0 -0
  86. package/src/lib/components/loader/loader.component.spec.ts +0 -21
  87. package/src/lib/components/loader/loader.component.ts +0 -33
  88. package/src/lib/components/multiselect/index.ts +0 -1
  89. package/src/lib/components/multiselect/multiselect.component.html +0 -21
  90. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  91. package/src/lib/components/multiselect/multiselect.component.spec.ts +0 -21
  92. package/src/lib/components/multiselect/multiselect.component.ts +0 -117
  93. package/src/lib/components/number-input/index.ts +0 -1
  94. package/src/lib/components/number-input/number-input.component.html +0 -48
  95. package/src/lib/components/number-input/number-input.component.scss +0 -0
  96. package/src/lib/components/number-input/number-input.component.ts +0 -80
  97. package/src/lib/components/page-header/index.ts +0 -1
  98. package/src/lib/components/page-header/page-header.component.html +0 -3
  99. package/src/lib/components/page-header/page-header.component.scss +0 -11
  100. package/src/lib/components/page-header/page-header.component.spec.ts +0 -21
  101. package/src/lib/components/page-header/page-header.component.ts +0 -27
  102. package/src/lib/components/password/index.ts +0 -1
  103. package/src/lib/components/password/password.component.html +0 -31
  104. package/src/lib/components/password/password.component.scss +0 -0
  105. package/src/lib/components/password/password.component.spec.ts +0 -21
  106. package/src/lib/components/password/password.component.ts +0 -83
  107. package/src/lib/components/radiobutton/index.ts +0 -1
  108. package/src/lib/components/radiobutton/radiobutton.component.html +0 -23
  109. package/src/lib/components/radiobutton/radiobutton.component.scss +0 -0
  110. package/src/lib/components/radiobutton/radiobutton.component.ts +0 -61
  111. package/src/lib/components/search/index.ts +0 -1
  112. package/src/lib/components/search/search.component.html +0 -23
  113. package/src/lib/components/search/search.component.scss +0 -0
  114. package/src/lib/components/search/search.component.ts +0 -45
  115. package/src/lib/components/section/index.ts +0 -1
  116. package/src/lib/components/section/section.component.html +0 -26
  117. package/src/lib/components/section/section.component.scss +0 -0
  118. package/src/lib/components/section/section.component.ts +0 -55
  119. package/src/lib/components/shared-components/action-button-group/action-button-group.component.html +0 -25
  120. package/src/lib/components/shared-components/action-button-group/action-button-group.component.scss +0 -0
  121. package/src/lib/components/shared-components/action-button-group/action-button-group.component.spec.ts +0 -21
  122. package/src/lib/components/shared-components/action-button-group/action-button-group.component.ts +0 -111
  123. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.html +0 -10
  124. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.scss +0 -0
  125. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.spec.ts +0 -21
  126. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +0 -69
  127. package/src/lib/components/shared-components/action-button-group/index.ts +0 -2
  128. package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +0 -142
  129. package/src/lib/components/shared-components/dynamic-component/dynamic-component.component.ts +0 -56
  130. package/src/lib/components/shared-components/dynamic-component/index.ts +0 -2
  131. package/src/lib/components/shared-components/generic-field/generic-field.component.html +0 -98
  132. package/src/lib/components/shared-components/generic-field/generic-field.component.spec.ts +0 -21
  133. package/src/lib/components/shared-components/generic-field/generic-field.component.ts +0 -90
  134. package/src/lib/components/shared-components/generic-field/index.ts +0 -1
  135. package/src/lib/components/shared-components/generic-form/generic-form.component.html +0 -46
  136. package/src/lib/components/shared-components/generic-form/generic-form.component.spec.ts +0 -21
  137. package/src/lib/components/shared-components/generic-form/generic-form.component.ts +0 -56
  138. package/src/lib/components/shared-components/generic-form/generic-form.model.spec.ts +0 -82
  139. package/src/lib/components/shared-components/generic-form/generic-form.model.ts +0 -68
  140. package/src/lib/components/shared-components/generic-form/index.ts +0 -2
  141. package/src/lib/components/shared-components/index.ts +0 -4
  142. package/src/lib/components/side-menu/index.ts +0 -2
  143. package/src/lib/components/side-menu/side-menu.component.html +0 -22
  144. package/src/lib/components/side-menu/side-menu.component.scss +0 -17
  145. package/src/lib/components/side-menu/side-menu.component.ts +0 -42
  146. package/src/lib/components/side-menu/side-menu.module.ts +0 -56
  147. package/src/lib/components/snackbar/index.ts +0 -2
  148. package/src/lib/components/snackbar/services/snackbar.service.ts +0 -73
  149. package/src/lib/components/snackbar/snackbar.component.html +0 -14
  150. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  151. package/src/lib/components/snackbar/snackbar.component.spec.ts +0 -21
  152. package/src/lib/components/snackbar/snackbar.component.ts +0 -44
  153. package/src/lib/components/snackbar/snackbar.model.ts +0 -10
  154. package/src/lib/components/stepper/index.ts +0 -1
  155. package/src/lib/components/stepper/stepper.component.html +0 -35
  156. package/src/lib/components/stepper/stepper.component.scss +0 -9
  157. package/src/lib/components/stepper/stepper.component.ts +0 -60
  158. package/src/lib/components/switch/index.ts +0 -1
  159. package/src/lib/components/switch/switch.component.html +0 -16
  160. package/src/lib/components/switch/switch.component.scss +0 -0
  161. package/src/lib/components/switch/switch.component.ts +0 -39
  162. package/src/lib/components/tab-view/index.ts +0 -2
  163. package/src/lib/components/tab-view/tab-view-item.component.ts +0 -23
  164. package/src/lib/components/tab-view/tab-view.component.html +0 -51
  165. package/src/lib/components/tab-view/tab-view.component.scss +0 -43
  166. package/src/lib/components/tab-view/tab-view.component.ts +0 -64
  167. package/src/lib/components/tab-view/tab-view.module.ts +0 -25
  168. package/src/lib/components/table/index.ts +0 -1
  169. package/src/lib/components/table/table-pagination-info.component.html +0 -9
  170. package/src/lib/components/table/table-pagination-info.component.ts +0 -22
  171. package/src/lib/components/table/table.component.html +0 -199
  172. package/src/lib/components/table/table.component.scss +0 -192
  173. package/src/lib/components/table/table.component.ts +0 -390
  174. package/src/lib/components/table/table.model.ts +0 -17
  175. package/src/lib/components/table/table.models.ts +0 -12
  176. package/src/lib/components/tag/index.ts +0 -3
  177. package/src/lib/components/tag/tag.component.html +0 -12
  178. package/src/lib/components/tag/tag.component.scss +0 -4
  179. package/src/lib/components/tag/tag.component.ts +0 -44
  180. package/src/lib/components/tag/tag.model.ts +0 -7
  181. package/src/lib/components/textarea/index.ts +0 -1
  182. package/src/lib/components/textarea/textarea.component.html +0 -50
  183. package/src/lib/components/textarea/textarea.component.scss +0 -0
  184. package/src/lib/components/textarea/textarea.component.ts +0 -77
  185. package/src/lib/components/textfield/index.ts +0 -1
  186. package/src/lib/components/textfield/textfield.component.html +0 -34
  187. package/src/lib/components/textfield/textfield.component.scss +0 -0
  188. package/src/lib/components/textfield/textfield.component.ts +0 -112
  189. package/src/lib/components/tooltip/index.ts +0 -1
  190. package/src/lib/components/tooltip/tooltip.component.html +0 -9
  191. package/src/lib/components/tooltip/tooltip.component.ts +0 -19
  192. package/src/lib/icons.ts +0 -36
  193. package/src/lib/index.ts +0 -5
  194. package/src/lib/init.service.ts +0 -11
  195. package/src/lib/interceptors/http-error-message.interceptor.ts +0 -45
  196. package/src/lib/pages/bad-request-page/bad-request-page.component.html +0 -5
  197. package/src/lib/pages/bad-request-page/bad-request-page.component.scss +0 -0
  198. package/src/lib/pages/bad-request-page/bad-request-page.component.ts +0 -14
  199. package/src/lib/pages/error-page/error-page.component.html +0 -5
  200. package/src/lib/pages/error-page/error-page.component.scss +0 -0
  201. package/src/lib/pages/error-page/error-page.component.ts +0 -31
  202. package/src/lib/pages/error-page/error-page.constants.ts +0 -19
  203. package/src/lib/pages/index.ts +0 -3
  204. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.html +0 -5
  205. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.scss +0 -0
  206. package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.ts +0 -15
  207. package/src/lib/pages/not-authenticated/index.ts +0 -1
  208. package/src/lib/pages/not-authenticated/not-authenticated.component.html +0 -5
  209. package/src/lib/pages/not-authenticated/not-authenticated.component.ts +0 -13
  210. package/src/lib/pages/not-authorized/index.ts +0 -1
  211. package/src/lib/pages/not-authorized/not-authorized.component.html +0 -5
  212. package/src/lib/pages/not-authorized/not-authorized.component.ts +0 -17
  213. package/src/lib/pages/not-found/index.ts +0 -1
  214. package/src/lib/pages/not-found/not-found.component.html +0 -5
  215. package/src/lib/pages/not-found/not-found.component.ts +0 -17
  216. package/src/lib/pages/not-found-page/not-found-page.component.html +0 -6
  217. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  218. package/src/lib/pages/not-found-page/not-found-page.component.ts +0 -15
  219. package/src/lib/pipes/color/color.pipe.ts +0 -24
  220. package/src/lib/pipes/index.ts +0 -3
  221. package/src/lib/pipes/multiselect/multiselect-options.pipe.ts +0 -61
  222. package/src/lib/pipes/size/size.pipe.ts +0 -24
  223. package/src/test-setup.ts +0 -8
  224. package/tsconfig.json +0 -30
  225. package/tsconfig.lib.json +0 -17
  226. package/tsconfig.lib.prod.json +0 -9
  227. package/tsconfig.spec.json +0 -16
  228. /package/{src → styles}/sass/foundations/_colors.scss +0 -0
  229. /package/{src → styles}/sass/foundations/index.scss +0 -0
  230. /package/{src → styles}/sass/header.css +0 -0
  231. /package/{src → styles}/sass/header.scss +0 -0
  232. /package/{src → styles}/sass/integrations/_bootstrap.scss +0 -0
  233. /package/{src → styles}/sass/integrations/index.scss +0 -0
  234. /package/{src → styles}/sass/main.scss +0 -0
  235. /package/{src → styles}/sass/overrides/_gov.scss +0 -0
  236. /package/{src → styles}/sass/overrides/index.scss +0 -0
  237. /package/{src → styles}/sass/scrollbar.scss +0 -0
  238. /package/{src → styles}/sass/tokens/_theme-dark.scss +0 -0
  239. /package/{src → styles}/sass/tokens/_theme-light.scss +0 -0
  240. /package/{src → styles}/sass/tokens/index.scss +0 -0
  241. /package/{src → styles}/sass/utils/_table_filter.scss +0 -0
  242. /package/{src → styles}/sass/utils/_utils.scss +0 -0
  243. /package/{src → styles}/sass/utils/index.scss +0 -0
  244. /package/{src → styles}/sass/vendors/_bootstrap.scss +0 -0
@@ -1,50 +0,0 @@
1
- <gov-dialog
2
- [open]="visible"
3
- [attr.block-close]="data.closable !== undefined ? !data.closable : false"
4
- [attr.block-backdrop-close]="data.closable !== undefined ? !data.closable : false"
5
- [style.--dialog-max-width]="data.width"
6
- [style.--dialog-max-height]="data.height"
7
- role="dialog"
8
- accessible-close-label="Close dialog box with more information"
9
- (gov-close)="data.cancelButtonFn ? dialogClick(false) : (visible = false)"
10
- >
11
- <gov-icon
12
- type="components"
13
- [name]="data.headerIcon"
14
- slot="icon"
15
- [color]="data.severity | govColor"
16
- />
17
-
18
- <h2 slot="title">{{ data.title ?? 'Title' }}</h2>
19
-
20
- @if (data && data.innerHTML) {
21
- <div [innerHTML]="data.innerHTML"></div>
22
- } @else if (data.componentType) {
23
- <v-dynamic-component
24
- [componentType]="data.componentType"
25
- [data]="$any(data.data)"
26
- ></v-dynamic-component>
27
- }
28
-
29
- <gov-button
30
- color="primary"
31
- size="m"
32
- type="solid"
33
- slot="footer"
34
- (gov-click)="data.confirmButtonFn ? dialogClick(true) : (visible = false)"
35
- >
36
- {{ data.confirmButtonText ?? 'Yes'}}
37
- </gov-button>
38
-
39
- <gov-button
40
- [ngClass]="!data.showCancelButton ? 'd-none' : ''"
41
- color="primary"
42
- size="m"
43
- type="outlined"
44
- slot="footer"
45
- [disabled]="!data.showCancelButton"
46
- (gov-click)="data.cancelButtonFn ? dialogClick(false) : (visible = false)"
47
- >
48
- {{ data.cancelButtonText ?? 'No' }}
49
- </gov-button>
50
- </gov-dialog>
@@ -1,4 +0,0 @@
1
- :host ::ng-deep dialog {
2
- max-width: var(--dialog-max-width, 95%); // default 52.5rem
3
- max-height: var(--dialog-max-height, 95%); // default 100%
4
- }
@@ -1,79 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, inject } from '@angular/core';
3
- import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
4
- import {
5
- CONFIRM_DIALOG_COMPONENT_TOKEN,
6
- ConfirmDialogCore,
7
- DialogData,
8
- DialogService,
9
- UnsubscribeComponent,
10
- } from '@verisoft/ui-core';
11
- import { takeUntil } from 'rxjs';
12
- import { GovColorPipe } from '../../pipes';
13
- import { DynamicComponent } from '../shared-components/dynamic-component';
14
-
15
- @Component({
16
- selector: 'v-confirm-dialog',
17
- imports: [
18
- CommonModule,
19
- GovDesignSystemModule,
20
- GovColorPipe,
21
- DynamicComponent,
22
- ],
23
- templateUrl: './confirm-dialog.component.html',
24
- styleUrl: './confirm-dialog.component.scss',
25
- providers: [
26
- {
27
- provide: CONFIRM_DIALOG_COMPONENT_TOKEN,
28
- useExisting: ConfirmDialogComponent,
29
- },
30
- ]
31
- })
32
- export class ConfirmDialogComponent
33
- extends UnsubscribeComponent
34
- implements OnInit, ConfirmDialogCore
35
- {
36
- constructor(
37
- private readonly dialogService: DialogService,
38
- private readonly cdr: ChangeDetectorRef
39
- ) {
40
- super();
41
- }
42
-
43
- visible = false;
44
- protected closable = false;
45
- data: DialogData = { severity: 'primary', headerIcon: 'info-circle' };
46
-
47
- ngOnInit(): void {
48
- this.dialogService.showEvent
49
- .pipe(takeUntil(this.destroyed$))
50
- .subscribe((x: DialogData) => {
51
- this.data = x;
52
- this.visible = true;
53
- this.cdr.detectChanges();
54
- });
55
-
56
- this.dialogService.closeEvent
57
- .pipe(takeUntil(this.destroyed$))
58
- .subscribe(() => {
59
- this.data = {};
60
- this.visible = false;
61
- this.cdr.detectChanges();
62
- })
63
- }
64
-
65
- protected dialogClick(confirm: boolean) {
66
- const { confirmButtonFn, cancelButtonFn } = this.data;
67
-
68
- if (confirm && confirmButtonFn) {
69
- confirmButtonFn();
70
- }
71
-
72
- if (!confirm && cancelButtonFn) {
73
- cancelButtonFn();
74
- }
75
-
76
- this.visible = false;
77
- this.cdr.detectChanges();
78
- }
79
- }
@@ -1 +0,0 @@
1
- export * from './confirm-dialog.component';
@@ -1,8 +0,0 @@
1
- <li
2
- role="option"
3
- class="v-dropdown__item"
4
- [attr.aria-selected]="item?.selected"
5
- [class.is-active]="item?.selected"
6
- >
7
- {{item?.label}}
8
- </li>
@@ -1,18 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- Component,
4
- Input,
5
- ViewEncapsulation,
6
- } from '@angular/core';
7
- import { DropDownItemData } from './dropdown.model';
8
-
9
- @Component({
10
- selector: 'v-dropdown-item',
11
- standalone: true,
12
- templateUrl: './dropdown-item.component.html',
13
- changeDetection: ChangeDetectionStrategy.OnPush,
14
- encapsulation: ViewEncapsulation.None,
15
- })
16
- export class DropdownItemComponent<T> {
17
- @Input() item : DropDownItemData<T> | undefined;
18
- }
@@ -1,91 +0,0 @@
1
- <div
2
- class="v-dropdown mb-3"
3
- (keydown)="onKeyDown($event)"
4
- >
5
- <gov-form-control [disabled]="this.ngControl?.disabled">
6
- @if (label && !floatLabel) {
7
- <gov-form-label
8
- slot="top"
9
- [ngClass]="labelClasses"
10
- >
11
- <span [ngClass]="labelClasses">
12
- {{ label | translate }}
13
- @if (tooltip) {
14
- <v-tooltip [message]="tooltip | translate" />
15
- }
16
- </span>
17
- </gov-form-label>
18
- }
19
- <div
20
- class="gov-form-input"
21
- [ngStyle]="forceMinWidth ? {'min-width': '16rem'} : {}"
22
- [ngClass]="inputClasses"
23
- >
24
- <div
25
- class="element d-flex gov-form-input-child"
26
- [ngClass]="labelClasses"
27
- (click)="toggleDropdown()"
28
- >
29
- <div class="v-dropdown__value flex-grow-1 me-1">{{ selectedItem?.label ?? placeholder }}</div>
30
- @if (clearable && ngControl?.enabled && selectedItem !== undefined && selectedItem !== null) {
31
- <gov-icon
32
- [name]="icons.cross"
33
- size="m"
34
- class="v-dropdown__clear me-1"
35
- color="error"
36
- (click)="clearSelection($event)"
37
- />
38
- }
39
- @if (loading) {
40
- <div class="v-dropdown__loader">
41
- <gov-icon [name]="icons.loader" />
42
- </div>
43
- }
44
- <div class="v-dropdown__trigger">
45
- <gov-icon [name]="opened ? icons.chevronUp : icons.chevronDown" />
46
- </div>
47
- </div>
48
- </div>
49
- <div class="position-relative">
50
- @if (opened) {
51
- <div class="v-dropdown__container">
52
- @if (showFilter) {
53
- <div
54
- class="v-dropdown__filter"
55
- #filterTextField
56
- (keydown)="onKeyDown($event)"
57
- >
58
- <v-textfield
59
- placeholder="Search"
60
- [formControl]="filterControl"
61
- iconPos="right"
62
- [icon]="icons.search"
63
- />
64
- </div>
65
- }
66
- @if (!dropdownOptions?.length) {
67
- <div class="v-dropdown__no-item">No option was found.</div>
68
- } @else {
69
- <ul
70
- role="listbox"
71
- class="v-dropdown__list"
72
- >
73
- <cdk-virtual-scroll-viewport
74
- [itemSize]="30"
75
- class="v-dropdown__scroll"
76
- (scrolledIndexChange)="onScroll($event)"
77
- >
78
- <v-dropdown-item
79
- *cdkVirtualFor="let option of dropdownOptions;"
80
- [item]="option"
81
- (click)="selectItem(option, true)"
82
- />
83
- </cdk-virtual-scroll-viewport>
84
- </ul>
85
- }
86
- </div>
87
- }
88
- </div>
89
- <v-validation-message [ngControl]="ngControl" />
90
- </gov-form-control>
91
- </div>
@@ -1,108 +0,0 @@
1
- .v-dropdown__container {
2
- position: absolute;
3
- z-index: 100;
4
- background-color: var(--button-outlined-primary-hover);
5
- min-width: 100%;
6
- border-radius: var(--border-radius, var(--corner-radius-s));
7
- border: var(--border-width, 0.0625rem) solid var(--form-border-color, var(--border-neutral));
8
- }
9
-
10
- .v-dropdown__trigger {
11
- min-height: 1.5rem;
12
- display: flex;
13
- }
14
-
15
- .disabled {
16
- color: var(--form-state-value-disabled, var(--text-disabled));
17
- cursor: default !important;
18
- pointer-events: none;
19
-
20
- &-input {
21
- border-color: var(--form-state-border-disabled, var(--border-subtlest)) !important;
22
- background: var(--form-state-bg-disabled, transparent);
23
- }
24
- }
25
-
26
- .error {
27
- color: var(--form-state-label-error, var(--text-status-error));
28
-
29
- &-input {
30
- border-color: var(--form-state-border-error, var(--status-error)) !important;
31
- }
32
- }
33
-
34
- .gov-form-input-child {
35
- padding: 0.5rem 0.75rem;
36
- border: 0px !important;
37
- }
38
-
39
- .v-dropdown__no-item {
40
- padding: 0.5rem;
41
- }
42
-
43
- .v-dropdown__list {
44
- margin: 0;
45
- padding: 0;
46
- list-style-type: none;
47
- display: flex;
48
- flex-direction: column;
49
- overflow: auto;
50
- }
51
-
52
- .v-dropdown__scroll {
53
- height: 10rem;
54
- }
55
-
56
- .v-dropdown__filter {
57
- padding: 0.5rem;
58
- }
59
-
60
- .v-dropdown__item {
61
- padding: 0.25rem 0.5rem;
62
- cursor: pointer;
63
-
64
- &.is-active {
65
- background-color: var(--background-primary);
66
- color: var(--text-white);
67
-
68
- &:hover {
69
- opacity: 0.8;
70
-
71
- }
72
- }
73
-
74
- &:hover {
75
- background-color: var(--background-primary);
76
- ;
77
- color: var(--text-white);
78
- }
79
- }
80
-
81
- .v-dropdown__loader {
82
- width: 1.5rem;
83
- height: 1.5rem;
84
- margin-right: 1rem;
85
- animation: rotate 1s linear infinite;
86
- display: inline-block;
87
- transform-origin: center;
88
- color: var(--color-neutral-300)
89
- }
90
-
91
- .v-dropdown__clear {
92
- z-index: 99;
93
- cursor: pointer;
94
- }
95
-
96
- @keyframes rotate {
97
- from {
98
- transform: rotate(0deg);
99
- }
100
-
101
- to {
102
- transform: rotate(360deg);
103
- }
104
- }
105
-
106
- ::ng-deep .cdk-virtual-scrollable {
107
- contain: none;
108
- }
@@ -1,21 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
- import { MultiselectComponent } from './gov-multiselect.component';
3
-
4
- describe('MultiselectComponent', () => {
5
- let component: MultiselectComponent<any>;
6
- let fixture: ComponentFixture<MultiselectComponent<any>>;
7
-
8
- beforeEach(async () => {
9
- await TestBed.configureTestingModule({
10
- imports: [MultiselectComponent],
11
- }).compileComponents();
12
-
13
- fixture = TestBed.createComponent(MultiselectComponent);
14
- component = fixture.componentInstance;
15
- fixture.detectChanges();
16
- });
17
-
18
- it('should create', () => {
19
- expect(component).toBeTruthy();
20
- });
21
- });
@@ -1,296 +0,0 @@
1
- import { ScrollingModule } from '@angular/cdk/scrolling';
2
- import { CommonModule } from '@angular/common';
3
- import {
4
- ChangeDetectionStrategy,
5
- ChangeDetectorRef,
6
- Component,
7
- ElementRef,
8
- EventEmitter,
9
- HostListener,
10
- Input,
11
- NO_ERRORS_SCHEMA,
12
- OnChanges,
13
- OnDestroy,
14
- OnInit,
15
- Optional,
16
- Output,
17
- Self,
18
- SimpleChanges,
19
- ViewChild,
20
- ViewEncapsulation,
21
- } from '@angular/core';
22
- import {
23
- ControlValueAccessor,
24
- FormControl,
25
- NgControl,
26
- ReactiveFormsModule,
27
- } from '@angular/forms';
28
- import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
29
- import { TranslateModule } from '@ngx-translate/core';
30
- import { DEFAULT_PAGE_SIZE, FilterEvent, getValueByPath, LazyLoadEvent } from '@verisoft/core';
31
- import {
32
- BaseFormInputComponent,
33
- DropdownCore,
34
- DROPDOWN_COMPONENT_TOKEN,
35
- FieldSizeType,
36
- FieldSize,
37
- } from '@verisoft/ui-core';
38
- import { debounceTime, distinctUntilChanged, Subscription } from 'rxjs';
39
- import { Icons } from '../../icons';
40
- import { ErrorComponent } from '../errors';
41
- import { TextfieldComponent } from '../textfield';
42
- import { DropdownItemComponent } from './dropdown-item.component';
43
- import { DropDownItemData } from './dropdown.model';
44
-
45
- @Component({
46
- selector: 'v-dropdown',
47
- imports: [
48
- CommonModule,
49
- ReactiveFormsModule,
50
- GovDesignSystemModule,
51
- ErrorComponent,
52
- DropdownItemComponent,
53
- TextfieldComponent,
54
- ScrollingModule,
55
- TranslateModule,
56
- ],
57
- templateUrl: './dropdown.component.html',
58
- styleUrl: './dropdown.component.scss',
59
- changeDetection: ChangeDetectionStrategy.OnPush,
60
- encapsulation: ViewEncapsulation.None,
61
- providers: [
62
- {
63
- provide: DROPDOWN_COMPONENT_TOKEN,
64
- useExisting: DropdownComponent,
65
- },
66
- ],
67
- schemas: [
68
- NO_ERRORS_SCHEMA
69
- ]
70
- })
71
- export class DropdownComponent<T>
72
- extends BaseFormInputComponent
73
- implements ControlValueAccessor, DropdownCore<T>, OnInit, OnChanges, OnDestroy {
74
-
75
- @ViewChild('filterTextField', { static: false }) filterTextField!: ElementRef;
76
-
77
- @Input() options: T[] | undefined = [];
78
- @Input() optionLabel: string | undefined;
79
- @Input() optionValue: string | undefined;
80
- @Input() dropdownIcon: string | undefined;
81
- @Input() floatLabel: string | undefined;
82
- @Input() lazy!: boolean;
83
- @Input() filter!: boolean;
84
- @Input() editable!: boolean;
85
- @Input() loading!: boolean;
86
- @Input() size: FieldSizeType = FieldSize.medium;
87
- @Input() showFilter = true;
88
- @Input() localSearch = true;
89
- @Input() forceMinWidth = false;
90
-
91
- @Output() changed = new EventEmitter<any>();
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
- opened = false;
98
- icons = Icons;
99
- selectedItem: DropDownItemData<T> | undefined;
100
- filterControl = new FormControl('');
101
- filterSub: Subscription | undefined
102
- dropdownOptions: DropDownItemData<T>[] | undefined;
103
- private readonly pageSize = DEFAULT_PAGE_SIZE;
104
- private lastPage: number | undefined;
105
-
106
- get labelClasses() {
107
- return {
108
- disabled: this.ngControl?.disabled,
109
- error: this.ngControl?.invalid
110
- };
111
- }
112
-
113
- get inputClasses() {
114
- return {
115
- 'disabled-input': this.ngControl?.disabled,
116
- 'error-input': this.ngControl?.invalid
117
- };
118
- }
119
-
120
- constructor(@Optional() @Self() ngControl: NgControl,
121
- private changeDetectorRef: ChangeDetectorRef) {
122
- super(ngControl);
123
- }
124
-
125
- override ngOnInit() {
126
- super.ngOnInit();
127
- this.filterSub = this.filterControl.valueChanges.pipe(
128
- debounceTime(300),
129
- distinctUntilChanged()
130
- ).subscribe((value) => {
131
- this.filterOptions(value);
132
- });
133
- }
134
-
135
- override writeValue(value: any): void {
136
- const selectedItem = (value == undefined || value === "") ? undefined : (this.dropdownOptions?.find(x => x.value === value)
137
- ?? { value, label: '', option: undefined as T, selected: false } as unknown as DropDownItemData<T>)
138
- this.selectItem(selectedItem, false);
139
-
140
- this.changeDetectorRef.detectChanges();
141
- }
142
-
143
- ngOnChanges(changes: SimpleChanges) {
144
- if (changes['options'] || changes['loading']) {
145
- this.dropdownOptions = this.convertToOptions();
146
- if (this.selectedItem && !this.selectedItem?.item) {
147
- const item = this.dropdownOptions?.find(x => this.selectedItem?.value === x.value);
148
- if (item) {
149
- this.selectItem(item, false);
150
- }
151
- }
152
- }
153
-
154
- this.changeDetectorRef.detectChanges();
155
- }
156
-
157
- private convertToOptions(): DropDownItemData<T>[] | undefined {
158
- return this.options?.map((option) => ({
159
- label: (this.optionLabel ? getValueByPath(option, this.optionLabel) : option) as unknown as string,
160
- value: this.optionValue ? getValueByPath(option, this.optionValue) : option as unknown as string,
161
- item: option,
162
- selected: false,
163
- } as DropDownItemData<T>)
164
- );
165
- }
166
-
167
- ngOnDestroy() {
168
- this.filterSub?.unsubscribe();
169
- }
170
-
171
- toggleDropdown() {
172
- if (this.ngControl?.disabled) {
173
- return;
174
- }
175
-
176
- if (!this.opened) {
177
- this.openDropdown();
178
- } else {
179
- this.closeDropdown();
180
- }
181
- }
182
-
183
- protected clearSelection(event: MouseEvent) {
184
- event.stopPropagation();
185
- this.changed.emit(null);
186
- this.dropdownOptions = this.dropdownOptions?.map(x => ({ ...x, selected: false })) ?? [];
187
- this.ngControl?.control?.setValue(null);
188
- }
189
-
190
- private openDropdown() {
191
- this.opened = true;
192
- this.setFilterFocus();
193
- this.showed.emit();
194
- }
195
-
196
- selectItem(option: DropDownItemData<T> | undefined, emitChange: boolean) {
197
- if (option == undefined) {
198
- this.selectedItem = undefined;
199
- this.closeDropdown();
200
- return;
201
- }
202
-
203
- if (this.selectedItem && this.selectedItem != option) {
204
- this.selectedItem.selected = false;
205
- }
206
-
207
- option.selected = true;
208
- this.selectedItem = option;
209
-
210
- if (emitChange) {
211
- if (this.ngControl?.control?.value !== option.value) {
212
- this.changed.emit(option.value);
213
- this.ngControl?.control?.setValue(option?.value);
214
- }
215
- }
216
-
217
- this.closeDropdown();
218
- }
219
-
220
- @HostListener('document:click', ['$event'])
221
- onDocumentClick(event: MouseEvent) {
222
- const target = event.target as HTMLElement;
223
- if (!target.closest('v-dropdown')) {
224
- this.opened = false;
225
- }
226
- }
227
-
228
- onScroll(index: number) {
229
- this.loadDataForIndex(index);
230
- }
231
-
232
- onKeyDown(event: KeyboardEvent) {
233
- if (this.formControl.disabled || this.readonly || this.loading || !this.opened) {
234
- return;
235
- }
236
-
237
- switch (event.code) {
238
- case 'ArrowDown':
239
- break;
240
-
241
- case 'ArrowUp':
242
- break;
243
-
244
- case 'ArrowLeft':
245
- case 'ArrowRight':
246
- break;
247
- }
248
- }
249
-
250
- private loadDataForIndex(index: number) {
251
- if (this.lazy) {
252
- const currentPage = Math.floor(index / this.pageSize);
253
- const shouldLazyLoad = currentPage !== this.lastPage;
254
- if (shouldLazyLoad) {
255
- this.lastPage = currentPage;
256
- this.lazyLoad.emit({
257
- filter: this.createFilterObject(this.filterControl.value),
258
- offset: currentPage * this.pageSize,
259
- limit: this.pageSize,
260
- });
261
- }
262
- }
263
- }
264
-
265
- private setFilterFocus() {
266
- setTimeout(() => {
267
- this.filterTextField?.nativeElement?.querySelector("input").focus();
268
- }, 200);
269
- }
270
-
271
- private closeDropdown() {
272
- this.opened = false;
273
- }
274
-
275
- private filterOptions(value: string | null) {
276
- if (!this.localSearch) {
277
- this.filtered.emit({
278
- filter: !value ? undefined : value,
279
- });
280
- }
281
-
282
- if (this.lazy) {
283
- this.loadDataForIndex(0);
284
- } else {
285
- const loweredFilterValue = value?.toLocaleLowerCase();
286
- this.dropdownOptions = !loweredFilterValue ?
287
- this.convertToOptions()
288
- : this.convertToOptions()?.filter(x => x.label?.toLocaleLowerCase()?.indexOf(loweredFilterValue) !== -1);
289
- this.changeDetectorRef.detectChanges();
290
- }
291
- }
292
-
293
- private createFilterObject(filterValue: string | null): Partial<T> {
294
- return (this.optionLabel ? { [this.optionLabel]: filterValue } : filterValue) as unknown as Partial<T>
295
- }
296
- }
@@ -1,6 +0,0 @@
1
- export interface DropDownItemData<T> {
2
- label: string;
3
- value: string | number;
4
- item: T;
5
- selected: boolean;
6
- }
@@ -1 +0,0 @@
1
- export * from './dropdown.component';