@verisoft/ui-primeng 19.0.1-1 → 20.1.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 (280) hide show
  1. package/.eslintrc.json +43 -0
  2. package/README.md +377 -3
  3. package/assets/.gitkeep +0 -0
  4. package/assets/sass/main.scss +9 -26
  5. package/assets/sass/themes/_verisoft_theme.scss +2 -0
  6. package/assets/sass/vendors/_bootstrap.scss +2 -2
  7. package/assets/sass/vendors/_primeng.scss +1 -2
  8. package/jest.config.ts +22 -0
  9. package/ng-package.json +14 -0
  10. package/package.json +14 -27
  11. package/project.json +36 -0
  12. package/{index.d.ts → src/index.ts} +4 -0
  13. package/src/lib/components/breadcrumb/breadcrumb.component.html +11 -0
  14. package/src/lib/components/breadcrumb/breadcrumb.component.scss +18 -0
  15. package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
  16. package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +36 -0
  17. package/src/lib/components/breadcrumb/breadcrumb.component.ts +27 -0
  18. package/src/lib/components/breadcrumb/breadcrumb.pipe.ts +13 -0
  19. package/src/lib/components/button/button-severity.pipe.ts +20 -0
  20. package/src/lib/components/button/button.component.html +20 -0
  21. package/src/lib/components/button/button.component.scss +0 -0
  22. package/src/lib/components/button/button.component.spec.ts +21 -0
  23. package/src/lib/components/button/button.component.ts +49 -0
  24. package/src/lib/components/calendar/calendar.component.html +53 -0
  25. package/src/lib/components/calendar/calendar.component.scss +0 -0
  26. package/src/lib/components/calendar/calendar.component.spec.ts +21 -0
  27. package/src/lib/components/calendar/calendar.component.ts +70 -0
  28. package/src/lib/components/checkbox/checkbox.component.html +20 -0
  29. package/src/lib/components/checkbox/checkbox.component.scss +15 -0
  30. package/src/lib/components/checkbox/checkbox.component.spec.ts +21 -0
  31. package/src/lib/components/checkbox/checkbox.component.stories.ts +72 -0
  32. package/src/lib/components/checkbox/checkbox.component.ts +46 -0
  33. package/src/lib/components/confirm-dialog/confirm-dialog.component.html +51 -0
  34. package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +3 -0
  35. package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
  36. package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +74 -0
  37. package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +73 -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-button/dropdown-button.component.html +1 -0
  43. package/src/lib/components/dropdown-button/dropdown-button.component.ts +20 -0
  44. package/src/lib/components/dropdown-button/index.ts +1 -0
  45. package/src/lib/components/errors/error.component.html +7 -0
  46. package/src/lib/components/errors/error.component.scss +3 -0
  47. package/src/lib/components/errors/error.component.ts +34 -0
  48. package/src/lib/components/errors/index.ts +1 -0
  49. package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +32 -0
  50. package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +8 -0
  51. package/src/lib/components/feature-list/feature-list-filter.pipe.ts +21 -0
  52. package/src/lib/components/feature-list/feature-list-page.component.ts +32 -0
  53. package/src/lib/components/feature-list/feature-list-page.model.ts +42 -0
  54. package/src/lib/components/feature-list/feature-list.component.html +59 -0
  55. package/src/lib/components/feature-list/feature-list.component.scss +10 -0
  56. package/src/lib/components/feature-list/feature-list.component.ts +341 -0
  57. package/src/lib/components/filter/directives/filter-field.directive.ts +34 -0
  58. package/src/lib/components/filter/filter.component.html +68 -0
  59. package/src/lib/components/filter/filter.component.scss +0 -0
  60. package/src/lib/components/filter/filter.component.spec.ts +21 -0
  61. package/src/lib/components/filter/filter.component.stories.ts +23 -0
  62. package/src/lib/components/filter/filter.component.ts +281 -0
  63. package/src/lib/components/filter/filter.model.ts +18 -0
  64. package/src/lib/components/form-field/form-field.component.html +42 -0
  65. package/src/lib/components/form-field/form-field.component.scss +0 -0
  66. package/src/lib/components/form-field/form-field.component.spec.ts +21 -0
  67. package/src/lib/components/form-field/form-field.component.stories.ts +69 -0
  68. package/src/lib/components/form-field/form-field.component.ts +37 -0
  69. package/src/lib/components/header/header.component.html +84 -0
  70. package/src/lib/components/header/header.component.scss +0 -0
  71. package/src/lib/components/header/header.component.spec.ts +21 -0
  72. package/src/lib/components/header/header.component.stories.ts +24 -0
  73. package/src/lib/components/header/header.component.ts +65 -0
  74. package/src/lib/components/header/services/header-provider.service.ts +15 -0
  75. package/src/lib/components/icon/icon.component.html +2 -0
  76. package/src/lib/components/icon/icon.component.scss +51 -0
  77. package/src/lib/components/icon/icon.component.ts +86 -0
  78. package/src/lib/components/icon/index.ts +2 -0
  79. package/src/lib/components/input-group/input-group.component.html +34 -0
  80. package/src/lib/components/input-group/input-group.component.spec.ts +21 -0
  81. package/src/lib/components/input-group/input-group.component.ts +58 -0
  82. package/src/lib/components/loader/loader.component.html +5 -0
  83. package/src/lib/components/loader/loader.component.scss +0 -0
  84. package/src/lib/components/loader/loader.component.spec.ts +21 -0
  85. package/src/lib/components/loader/loader.component.ts +16 -0
  86. package/src/lib/components/multiselect/multiselect.component.html +67 -0
  87. package/src/lib/components/multiselect/multiselect.component.scss +0 -0
  88. package/src/lib/components/multiselect/multiselect.component.spec.ts +21 -0
  89. package/src/lib/components/multiselect/multiselect.component.ts +120 -0
  90. package/src/lib/components/number-input/number-input.component.html +22 -0
  91. package/src/lib/components/number-input/number-input.component.spec.ts +21 -0
  92. package/src/lib/components/number-input/number-input.component.ts +55 -0
  93. package/src/lib/components/page-header/page-header.component.html +35 -0
  94. package/src/lib/components/page-header/page-header.component.scss +0 -0
  95. package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
  96. package/src/lib/components/page-header/page-header.component.ts +31 -0
  97. package/src/lib/components/password/password.component.html +24 -0
  98. package/src/lib/components/password/password.component.scss +0 -0
  99. package/src/lib/components/password/password.component.spec.ts +21 -0
  100. package/src/lib/components/password/password.component.ts +56 -0
  101. package/src/lib/components/radiobutton/radiobutton.component.html +34 -0
  102. package/src/lib/components/radiobutton/radiobutton.component.scss +6 -0
  103. package/src/lib/components/radiobutton/radiobutton.component.spec.ts +21 -0
  104. package/src/lib/components/radiobutton/radiobutton.component.stories.ts +71 -0
  105. package/src/lib/components/radiobutton/radiobutton.component.ts +61 -0
  106. package/src/lib/components/section/section.component.html +25 -0
  107. package/src/lib/components/section/section.component.scss +0 -0
  108. package/src/lib/components/section/section.component.spec.ts +21 -0
  109. package/src/lib/components/section/section.component.ts +31 -0
  110. package/src/lib/components/shared-components/.eslintrc.json +42 -0
  111. package/src/lib/components/shared-components/action-button-group/action-button-group.component.html +25 -0
  112. package/src/lib/components/shared-components/action-button-group/action-button-group.component.scss +0 -0
  113. package/src/lib/components/shared-components/action-button-group/action-button-group.component.spec.ts +21 -0
  114. package/src/lib/components/shared-components/action-button-group/action-button-group.component.ts +111 -0
  115. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.html +10 -0
  116. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.scss +0 -0
  117. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.spec.ts +21 -0
  118. package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +69 -0
  119. package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +142 -0
  120. package/src/lib/components/shared-components/dynamic-component/dynamic-component.component.ts +56 -0
  121. package/{lib/components/shared-components/dynamic-component/index.d.ts → src/lib/components/shared-components/dynamic-component/index.ts} +2 -2
  122. package/src/lib/components/shared-components/generic-field/generic-field.component.html +98 -0
  123. package/src/lib/components/shared-components/generic-field/generic-field.component.spec.ts +21 -0
  124. package/src/lib/components/shared-components/generic-field/generic-field.component.ts +90 -0
  125. package/{lib/components/shared-components/generic-field/index.d.ts → src/lib/components/shared-components/generic-field/index.ts} +1 -1
  126. package/src/lib/components/shared-components/generic-form/generic-form.component.html +46 -0
  127. package/src/lib/components/shared-components/generic-form/generic-form.component.spec.ts +21 -0
  128. package/src/lib/components/shared-components/generic-form/generic-form.component.ts +56 -0
  129. package/src/lib/components/shared-components/generic-form/generic-form.model.spec.ts +82 -0
  130. package/src/lib/components/shared-components/generic-form/generic-form.model.ts +68 -0
  131. package/{lib/components/shared-components/generic-form/index.d.ts → src/lib/components/shared-components/generic-form/index.ts} +2 -2
  132. package/{lib/components/shared-components/index.d.ts → src/lib/components/shared-components/index.ts} +4 -6
  133. package/src/lib/components/side-menu/side-menu.component.html +53 -0
  134. package/src/lib/components/side-menu/side-menu.component.scss +0 -0
  135. package/src/lib/components/side-menu/side-menu.component.spec.ts +21 -0
  136. package/src/lib/components/side-menu/side-menu.component.ts +96 -0
  137. package/src/lib/components/side-menu/side-menu.module.ts +66 -0
  138. package/src/lib/components/slider/slider.component.html +19 -0
  139. package/src/lib/components/slider/slider.component.spec.ts +21 -0
  140. package/src/lib/components/slider/slider.component.ts +56 -0
  141. package/src/lib/components/snackbar/services/snackbar.service.ts +45 -0
  142. package/src/lib/components/snackbar/snackbar.component.html +3 -0
  143. package/src/lib/components/snackbar/snackbar.component.scss +0 -0
  144. package/src/lib/components/snackbar/snackbar.component.spec.ts +21 -0
  145. package/src/lib/components/snackbar/snackbar.component.stories.ts +70 -0
  146. package/src/lib/components/snackbar/snackbar.component.ts +25 -0
  147. package/src/lib/components/stepper/stepper.component.html +35 -0
  148. package/src/lib/components/stepper/stepper.component.spec.ts +21 -0
  149. package/src/lib/components/stepper/stepper.component.ts +39 -0
  150. package/src/lib/components/switch/switch.component.html +18 -0
  151. package/src/lib/components/switch/switch.component.scss +0 -0
  152. package/src/lib/components/switch/switch.component.spec.ts +21 -0
  153. package/src/lib/components/switch/switch.component.stories.ts +65 -0
  154. package/src/lib/components/switch/switch.component.ts +52 -0
  155. package/src/lib/components/tab-view/tab-view-item.component.ts +22 -0
  156. package/src/lib/components/tab-view/tab-view.component.html +41 -0
  157. package/src/lib/components/tab-view/tab-view.component.ts +55 -0
  158. package/src/lib/components/table/table-filter.pipe.ts +59 -0
  159. package/src/lib/components/table/table.component.html +127 -0
  160. package/src/lib/components/table/table.component.scss +11 -0
  161. package/src/lib/components/table/table.component.spec.ts +21 -0
  162. package/src/lib/components/table/table.component.stories.ts +55 -0
  163. package/src/lib/components/table/table.component.ts +288 -0
  164. package/src/lib/components/table/table.models.ts +26 -0
  165. package/src/lib/components/tag/index.ts +2 -0
  166. package/src/lib/components/tag/tag.component.html +12 -0
  167. package/src/lib/components/tag/tag.component.scss +33 -0
  168. package/src/lib/components/tag/tag.component.ts +83 -0
  169. package/src/lib/components/textarea/textarea.component.html +40 -0
  170. package/src/lib/components/textarea/textarea.component.scss +5 -0
  171. package/src/lib/components/textarea/textarea.component.spec.ts +21 -0
  172. package/src/lib/components/textarea/textarea.component.stories.ts +98 -0
  173. package/src/lib/components/textarea/textarea.component.ts +62 -0
  174. package/src/lib/components/textfield/textfield.component.html +82 -0
  175. package/src/lib/components/textfield/textfield.component.scss +23 -0
  176. package/src/lib/components/textfield/textfield.component.spec.ts +21 -0
  177. package/src/lib/components/textfield/textfield.component.stories.ts +85 -0
  178. package/src/lib/components/textfield/textfield.component.ts +68 -0
  179. package/src/lib/components/tooltip/index.ts +1 -0
  180. package/src/lib/components/tooltip/tooltip.component.html +3 -0
  181. package/src/lib/components/tooltip/tooltip.component.ts +17 -0
  182. package/src/lib/icons.ts +36 -0
  183. package/src/lib/interceptors/http-error-message.interceptor.ts +35 -0
  184. package/src/lib/pages/not-found-page/not-found-page.component.html +26 -0
  185. package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
  186. package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +21 -0
  187. package/src/lib/pages/not-found-page/not-found-page.component.ts +16 -0
  188. package/src/tab-view.ts +1 -0
  189. package/src/test-setup.ts +8 -0
  190. package/tsconfig.json +29 -0
  191. package/tsconfig.lib.json +18 -0
  192. package/tsconfig.lib.prod.json +9 -0
  193. package/tsconfig.spec.json +16 -0
  194. package/fesm2022/verisoft-ui-primeng.mjs +0 -2880
  195. package/fesm2022/verisoft-ui-primeng.mjs.map +0 -1
  196. package/lib/components/breadcrumb/breadcrumb.component.d.ts +0 -6
  197. package/lib/components/breadcrumb/breadcrumb.pipe.d.ts +0 -9
  198. package/lib/components/button/button-severity.pipe.d.ts +0 -9
  199. package/lib/components/button/button.component.d.ts +0 -20
  200. package/lib/components/calendar/calendar.component.d.ts +0 -17
  201. package/lib/components/checkbox/checkbox.component.d.ts +0 -10
  202. package/lib/components/confirm-dialog/confirm-dialog.component.d.ts +0 -15
  203. package/lib/components/dropdown/dropdown.component.d.ts +0 -38
  204. package/lib/components/dropdown-button/dropdown-button.component.d.ts +0 -14
  205. package/lib/components/dropdown-button/index.d.ts +0 -1
  206. package/lib/components/errors/error.component.d.ts +0 -16
  207. package/lib/components/errors/index.d.ts +0 -1
  208. package/lib/components/form-field/form-field.component.d.ts +0 -12
  209. package/lib/components/header/header.component.d.ts +0 -23
  210. package/lib/components/header/services/header-provider.service.d.ts +0 -10
  211. package/lib/components/input-group/input-group.component.d.ts +0 -9
  212. package/lib/components/loader/loader.component.d.ts +0 -6
  213. package/lib/components/multiselect/multiselect.component.d.ts +0 -34
  214. package/lib/components/number-input/number-input.component.d.ts +0 -14
  215. package/lib/components/page-header/page-header.component.d.ts +0 -10
  216. package/lib/components/password/password.component.d.ts +0 -11
  217. package/lib/components/radiobutton/radiobutton.component.d.ts +0 -10
  218. package/lib/components/section/section.component.d.ts +0 -12
  219. package/lib/components/shared-components/action-button-group/action-button-group.component.d.ts +0 -28
  220. package/lib/components/shared-components/action-button-group/components/action-button/action-button.component.d.ts +0 -24
  221. package/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.d.ts +0 -17
  222. package/lib/components/shared-components/dynamic-component/dynamic-component.component.d.ts +0 -16
  223. package/lib/components/shared-components/feature-list/directives/feature-list-column.directive.d.ts +0 -10
  224. package/lib/components/shared-components/feature-list/directives/feature-list-filter-field.directive.d.ts +0 -6
  225. package/lib/components/shared-components/feature-list/feature-list-filter.pipe.d.ts +0 -9
  226. package/lib/components/shared-components/feature-list/feature-list-page.component.d.ts +0 -9
  227. package/lib/components/shared-components/feature-list/feature-list-page.model.d.ts +0 -23
  228. package/lib/components/shared-components/feature-list/feature-list.component.d.ts +0 -62
  229. package/lib/components/shared-components/filter/directives/filter-field.directive.d.ts +0 -20
  230. package/lib/components/shared-components/filter/filter.component.d.ts +0 -53
  231. package/lib/components/shared-components/filter/filter.model.d.ts +0 -2
  232. package/lib/components/shared-components/generic-field/generic-field.component.d.ts +0 -28
  233. package/lib/components/shared-components/generic-form/generic-form.component.d.ts +0 -15
  234. package/lib/components/shared-components/generic-form/generic-form.model.d.ts +0 -4
  235. package/lib/components/side-menu/side-menu.component.d.ts +0 -27
  236. package/lib/components/side-menu/side-menu.module.d.ts +0 -13
  237. package/lib/components/slider/slider.component.d.ts +0 -12
  238. package/lib/components/snackbar/services/snackbar.service.d.ts +0 -12
  239. package/lib/components/snackbar/snackbar.component.d.ts +0 -9
  240. package/lib/components/stepper/stepper.component.d.ts +0 -17
  241. package/lib/components/switch/switch.component.d.ts +0 -9
  242. package/lib/components/tab-view/tab-view-item.component.d.ts +0 -12
  243. package/lib/components/tab-view/tab-view.component.d.ts +0 -17
  244. package/lib/components/table/table-filter.pipe.d.ts +0 -13
  245. package/lib/components/table/table.component.d.ts +0 -67
  246. package/lib/components/table/table.models.d.ts +0 -4
  247. package/lib/components/textarea/textarea.component.d.ts +0 -12
  248. package/lib/components/textfield/textfield.component.d.ts +0 -12
  249. package/lib/components/tooltip/index.d.ts +0 -1
  250. package/lib/components/tooltip/tooltip.component.d.ts +0 -10
  251. package/lib/icons.d.ts +0 -2
  252. package/lib/interceptors/http-error-message.interceptor.d.ts +0 -11
  253. /package/{lib/components/breadcrumb/index.d.ts → src/lib/components/breadcrumb/index.ts} +0 -0
  254. /package/{lib/components/button/index.d.ts → src/lib/components/button/index.ts} +0 -0
  255. /package/{lib/components/calendar/index.d.ts → src/lib/components/calendar/index.ts} +0 -0
  256. /package/{lib/components/checkbox/index.d.ts → src/lib/components/checkbox/index.ts} +0 -0
  257. /package/{lib/components/confirm-dialog/index.d.ts → src/lib/components/confirm-dialog/index.ts} +0 -0
  258. /package/{lib/components/dropdown/index.d.ts → src/lib/components/dropdown/index.ts} +0 -0
  259. /package/{lib/components/shared-components/feature-list/index.d.ts → src/lib/components/feature-list/index.ts} +0 -0
  260. /package/{lib/components/shared-components/filter/index.d.ts → src/lib/components/filter/index.ts} +0 -0
  261. /package/{lib/components/form-field/index.d.ts → src/lib/components/form-field/index.ts} +0 -0
  262. /package/{lib/components/header/index.d.ts → src/lib/components/header/index.ts} +0 -0
  263. /package/{lib/components/input-group/index.d.ts → src/lib/components/input-group/index.ts} +0 -0
  264. /package/{lib/components/loader/index.d.ts → src/lib/components/loader/index.ts} +0 -0
  265. /package/{lib/components/multiselect/index.d.ts → src/lib/components/multiselect/index.ts} +0 -0
  266. /package/{lib/components/number-input/index.d.ts → src/lib/components/number-input/index.ts} +0 -0
  267. /package/{lib/components/page-header/index.d.ts → src/lib/components/page-header/index.ts} +0 -0
  268. /package/{lib/components/password/index.d.ts → src/lib/components/password/index.ts} +0 -0
  269. /package/{lib/components/radiobutton/index.d.ts → src/lib/components/radiobutton/index.ts} +0 -0
  270. /package/{lib/components/section/index.d.ts → src/lib/components/section/index.ts} +0 -0
  271. /package/{lib/components/shared-components/action-button-group/index.d.ts → src/lib/components/shared-components/action-button-group/index.ts} +0 -0
  272. /package/{lib/components/side-menu/index.d.ts → src/lib/components/side-menu/index.ts} +0 -0
  273. /package/{lib/components/slider/index.d.ts → src/lib/components/slider/index.ts} +0 -0
  274. /package/{lib/components/snackbar/index.d.ts → src/lib/components/snackbar/index.ts} +0 -0
  275. /package/{lib/components/stepper/index.d.ts → src/lib/components/stepper/index.ts} +0 -0
  276. /package/{lib/components/switch/index.d.ts → src/lib/components/switch/index.ts} +0 -0
  277. /package/{lib/components/tab-view/index.d.ts → src/lib/components/tab-view/index.ts} +0 -0
  278. /package/{lib/components/table/index.d.ts → src/lib/components/table/index.ts} +0 -0
  279. /package/{lib/components/textarea/index.d.ts → src/lib/components/textarea/index.ts} +0 -0
  280. /package/{lib/components/textfield/index.d.ts → src/lib/components/textfield/index.ts} +0 -0
@@ -0,0 +1,39 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
3
+ import {
4
+ StepperCore,
5
+ STEPPER_COMPONENT_TOKEN,
6
+ StepperItem,
7
+ LayoutType,
8
+ LayoutTypeType,
9
+ FieldSizeType,
10
+ FieldSize
11
+ } from '@verisoft/ui-core';
12
+ import { StepperModule } from 'primeng/stepper';
13
+ import { Icons } from '../../icons';
14
+ import { ButtonComponent } from '../button';
15
+
16
+ @Component({
17
+ selector: 'v-stepper',
18
+ imports: [CommonModule, ButtonComponent, StepperModule],
19
+ templateUrl: './stepper.component.html',
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ providers: [
22
+ { provide: STEPPER_COMPONENT_TOKEN, useExisting: StepperComponent },
23
+ ]
24
+ })
25
+ export class StepperComponent
26
+ implements StepperCore
27
+ {
28
+ @Input() items!: StepperItem[];
29
+
30
+ icons = Icons;
31
+ @Input() prefix!: string;
32
+ @Input() label!: string;
33
+ @Input() size: FieldSizeType | undefined = FieldSize.medium;
34
+ @Input() layout: LayoutTypeType = LayoutType.horizontal;
35
+ @Input() icon!: string;
36
+ @Input() activeIndex = 0;
37
+ @Input() annotation!: string;
38
+ @Output() activeIndexChange = new EventEmitter<number>();
39
+ }
@@ -0,0 +1,18 @@
1
+ <div class="v-switch d-flex align-items-center">
2
+ <v-form-field
3
+ class="w-100"
4
+ [label]="label"
5
+ [tooltip]="tooltip"
6
+ [required]="isRequired()"
7
+ [testId]="testId"
8
+ [display]="formDisplay"
9
+ >
10
+ <p-toggle-switch
11
+ [formControl]="formControl"
12
+ [required]="isRequired()"
13
+ [title]="label"
14
+ [readonly]="readonly"
15
+ [inputId]="id"
16
+ /><v-validation-message [ngControl]="ngControl"></v-validation-message>
17
+ </v-form-field>
18
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { SwitchComponent } from './switch.component';
3
+
4
+ describe('SwitchComponent', () => {
5
+ let component: SwitchComponent;
6
+ let fixture: ComponentFixture<SwitchComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SwitchComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SwitchComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,65 @@
1
+ import {
2
+ FormControl,
3
+ FormGroup,
4
+ ReactiveFormsModule,
5
+ Validators,
6
+ } from '@angular/forms';
7
+ import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
8
+ import { SwitchComponent } from './switch.component';
9
+
10
+ const meta: Meta<SwitchComponent> = {
11
+ component: SwitchComponent,
12
+ title: 'SwitchComponent',
13
+ decorators: [
14
+ moduleMetadata({
15
+ imports: [ReactiveFormsModule],
16
+ }),
17
+ ],
18
+ };
19
+ export default meta;
20
+ type Story = StoryObj<SwitchComponent>;
21
+ const formGroup = new FormGroup({
22
+ switch: new FormControl(null),
23
+ switchRequired: new FormControl(null, [Validators.requiredTrue]),
24
+ });
25
+ export const Primary: Story = {
26
+ render: (args: any) => ({
27
+ props: {
28
+ ...args,
29
+ formGroup: formGroup,
30
+ },
31
+ template: `
32
+ <form [formGroup]="formGroup">
33
+ <v-switch
34
+ [disabled]="disabled"
35
+ [readonly]="readonly"
36
+ formControlName="switch"
37
+ [required]="required"/>
38
+ </form>`,
39
+ }),
40
+ args: {
41
+ disabled: false,
42
+ readonly: false,
43
+ },
44
+ };
45
+
46
+ export const SwitchRequired: Story = {
47
+ render: (args: any) => ({
48
+ props: {
49
+ ...args,
50
+ formGroup: formGroup,
51
+ },
52
+ template: `
53
+ <form [formGroup]="formGroup">
54
+ <v-switch
55
+ [disabled]="disabled"
56
+ [readonly]="readonly"
57
+ formControlName="switchRequired"
58
+ [required]="required"/>
59
+ </form>`,
60
+ }),
61
+ args: {
62
+ disabled: false,
63
+ readonly: false,
64
+ },
65
+ };
@@ -0,0 +1,52 @@
1
+
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ forwardRef,
6
+ Optional,
7
+ Self,
8
+ } from '@angular/core';
9
+ import {
10
+ ControlValueAccessor,
11
+ NgControl,
12
+ ReactiveFormsModule,
13
+ } from '@angular/forms';
14
+ import { BaseFormInputComponent, BaseInputControls, SWITCH_COMPONENT_TOKEN, SwitchCore } from '@verisoft/ui-core';
15
+ import { ToggleSwitch } from 'primeng/toggleswitch';
16
+ import { v4 as uuidv4 } from 'uuid';
17
+ import { ErrorComponent } from '../errors';
18
+ import { FormFieldComponent } from '../form-field';
19
+
20
+ @Component({
21
+ selector: 'v-switch',
22
+ imports: [
23
+ ToggleSwitch,
24
+ ReactiveFormsModule,
25
+ FormFieldComponent,
26
+ ErrorComponent
27
+ ],
28
+ templateUrl: './switch.component.html',
29
+ styleUrl: './switch.component.scss',
30
+ changeDetection: ChangeDetectionStrategy.OnPush,
31
+ providers: [
32
+ {
33
+ provide: BaseInputControls,
34
+ useExisting: forwardRef(() => SwitchComponent),
35
+ multi: true,
36
+ },
37
+ {
38
+ provide: SWITCH_COMPONENT_TOKEN,
39
+ useExisting: SwitchComponent,
40
+ },
41
+ ]
42
+ })
43
+ export class SwitchComponent
44
+ extends BaseFormInputComponent
45
+ implements ControlValueAccessor, SwitchCore
46
+ {
47
+ constructor(@Optional() @Self() ngControl: NgControl) {
48
+ super(ngControl);
49
+ }
50
+
51
+ id = uuidv4();
52
+ }
@@ -0,0 +1,22 @@
1
+ import { Component, Input, TemplateRef, ViewChild } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'v-tab-view-item',
5
+ template: `<ng-template #contentTemplate>
6
+ <ng-content></ng-content>
7
+ </ng-template>`,
8
+
9
+ })
10
+ export class TabViewItemComponent {
11
+ @ViewChild('contentTemplate', { static: true }) contentTemplate!: TemplateRef<any>;
12
+
13
+ @Input() title!: string;
14
+
15
+ @Input() url?: string;
16
+
17
+ @Input() icon?: string;
18
+
19
+ @Input() disabled?: boolean;
20
+
21
+ @Input() content?: string;
22
+ }
@@ -0,0 +1,41 @@
1
+ <div class="v-tab-view">
2
+ @if (useRouting) {
3
+ <p-tabs [value]="activeIndex">
4
+ <p-tablist>
5
+ @for(tab of mergedItems; track tab.url; let index = $index){
6
+ <p-tab [value]="index" [routerLink]="tab.url" (valueChange)="activeItemChanged(index)">
7
+ @if (tab.icon) {
8
+ <i [class]="tab.icon"></i>
9
+ }
10
+ <span>{{ tab.title }}</span>
11
+ </p-tab>
12
+ }
13
+ </p-tablist>
14
+ </p-tabs>
15
+ <router-outlet></router-outlet>
16
+ } @else {
17
+ <p-tabs [value]="activeIndex">
18
+ <p-tablist>
19
+ @for (tab of mergedItems; track tab; let index = $index) {
20
+ <p-tab [value]="index" (valueChange)="activeItemChanged(index)">
21
+ @if (tab.icon) {
22
+ <i [class]="tab.icon"></i>
23
+ }
24
+ <span>{{ tab.title }}</span>
25
+ </p-tab>
26
+ }
27
+ </p-tablist>
28
+ <p-tabpanels>
29
+ @for (tab of mergedItems; track tab; let index = $index) {
30
+ <p-tabpanel [value]="index">
31
+ @if (tab.contentTemplate){
32
+ <ng-container *ngTemplateOutlet="tab.contentTemplate"></ng-container>
33
+ } @else if (tab.content) {
34
+ {{ tab.content }}
35
+ }
36
+ </p-tabpanel>
37
+ }
38
+ </p-tabpanels>
39
+ </p-tabs>
40
+ }
41
+ </div>
@@ -0,0 +1,55 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import {
3
+ AfterContentInit,
4
+ Component,
5
+ ContentChildren,
6
+ EventEmitter,
7
+ Input,
8
+ Output,
9
+ QueryList,
10
+ } from '@angular/core';
11
+ import { RouterLink, RouterOutlet } from '@angular/router';
12
+ import { TAB_VIEW_COMPONENT_TOKEN, TabViewCore, TabViewItemCore } from '@verisoft/ui-core';
13
+ import { MenuItem } from 'primeng/api';
14
+ import { TabsModule } from 'primeng/tabs';
15
+ import { TabViewItemComponent } from './tab-view-item.component';
16
+ @Component({
17
+ selector: 'v-tab-view',
18
+ templateUrl: './tab-view.component.html',
19
+ imports: [RouterOutlet, RouterLink, TabsModule, NgTemplateOutlet],
20
+ providers: [
21
+ { provide: TAB_VIEW_COMPONENT_TOKEN, useExisting: TabViewComponent }],
22
+
23
+ })
24
+ export class TabViewComponent
25
+ implements AfterContentInit, TabViewCore {
26
+ @ContentChildren(TabViewItemComponent)
27
+ children!: QueryList<TabViewItemComponent>;
28
+
29
+ @Input() items: TabViewItemCore[] = [];
30
+
31
+ @Input() useRouting = false;
32
+
33
+ @Input() activeIndex = 0;
34
+
35
+ @Output() activeIndexChange = new EventEmitter<number>();
36
+
37
+ mergedItems: TabViewItemCore[] = [];
38
+
39
+ ngAfterContentInit(): void {
40
+ this.mergedItems = [...this.items, ...this.children.toArray()];
41
+ }
42
+
43
+ protected activeItemChanged(item: MenuItem | number): void {
44
+ let index: number;
45
+ if (typeof item === 'number') {
46
+ index = item;
47
+ } else {
48
+ index = this.items.indexOf(item as TabViewItemCore);
49
+ }
50
+
51
+ if (index != -1) {
52
+ this.activeIndexChange.emit(index);
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,59 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { FilterMetadata } from 'primeng/api';
3
+
4
+ type PrimeNgFilterDefinition = {
5
+ [s: string]: FilterMetadata | FilterMetadata[];
6
+ };
7
+
8
+ @Pipe({
9
+ name: 'primengFilter',
10
+ standalone: true,
11
+ })
12
+ export class TableFilterPipe<T> implements PipeTransform {
13
+ transform(value: Partial<T>): PrimeNgFilterDefinition | undefined {
14
+ if (value == undefined) {
15
+ return undefined;
16
+ }
17
+
18
+ return Object.entries(value)
19
+ .filter((x) => x[0] != undefined)
20
+ .reduce((currentFilter: PrimeNgFilterDefinition, [key, value]) => {
21
+ const filterValue = this.convertToFilterMetadata(value);
22
+ if (filterValue) {
23
+ if (key === 'searchField') {
24
+ key = 'global';
25
+ }
26
+
27
+ currentFilter[key] = filterValue;
28
+ }
29
+
30
+ return currentFilter;
31
+ }, {});
32
+ }
33
+
34
+ private convertToFilterMetadata(
35
+ value: unknown
36
+ ): FilterMetadata | FilterMetadata[] | undefined {
37
+ if (value == undefined) {
38
+ return undefined;
39
+ }
40
+
41
+ if (typeof value == 'string') {
42
+ return {
43
+ matchMode: 'contains',
44
+ value: value,
45
+ };
46
+ }
47
+
48
+ if (Array.isArray(value)) {
49
+ return value.map((x) =>
50
+ this.convertToFilterMetadata(x)
51
+ ) as FilterMetadata[];
52
+ }
53
+
54
+ return {
55
+ matchMode: 'equals',
56
+ value: value,
57
+ };
58
+ }
59
+ }
@@ -0,0 +1,127 @@
1
+ <div class="v-table">
2
+ <p-table
3
+ #table
4
+ class="v-table"
5
+ [value]="tableRows"
6
+ [filters]="filter | primengFilter"
7
+ [paginator]="showPaginator"
8
+ [rows]="pageSize"
9
+ [totalRecords]="total"
10
+ [loading]="loading"
11
+ [lazy]="lazy"
12
+ dataKey="id"
13
+ [scrollable]="scrollable"
14
+ [sortMode]="sortMultiple ? 'multiple' : 'single'"
15
+ [scrollHeight]="'flex'"
16
+ [selectionMode]="selectionMode"
17
+ [selection]="tableSelection"
18
+ [rowsPerPageOptions]="[10, 25, 50, 100]"
19
+ [expandedRowKeys]="expandedRows"
20
+ [showCurrentPageReport]="true"
21
+ currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
22
+ [customSort]="lazy"
23
+ [multiSortMeta]="sortMeta"
24
+ [resizableColumns]="true"
25
+ columnResizeMode="expand"
26
+ [globalFilterFields]="globalFilterFields"
27
+ (onPage)="pageChanged($event)"
28
+ (onSort)="sortChanged($event)"
29
+ (selectionChange)="selectionChanged($event)"
30
+ (onLazyLoad)="fireLazyLoad($event)"
31
+ >
32
+ <ng-template pTemplate="header">
33
+ <tr>
34
+ @if (selectionMode === 'multiple') {
35
+ <th>
36
+ <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
37
+ </th>
38
+ } @for (column of tableColumns; track column; let index = $index) {
39
+ @if (column.sortable) {
40
+ <th
41
+ pResizableColumn
42
+ [pSortableColumn]="'row.' + column.id"
43
+ [style.width]="column.width"
44
+ >
45
+ {{ column.headerGetter(column.id, index) }}
46
+ <p-sortIcon [field]="'row.' + column.id"></p-sortIcon>
47
+ </th>
48
+ }
49
+ @if (!column.sortable) {
50
+ <th
51
+ pResizableColumn
52
+ [class.v-auto-cell]="column.template"
53
+ [style.width]="column.width"
54
+ >
55
+ {{ column.headerGetter(column.id, index) }}
56
+ </th>
57
+ }
58
+ } @if (rowDetailTemplate){
59
+ <th></th>
60
+ }
61
+ </tr>
62
+ </ng-template>
63
+ <ng-template pTemplate="body" let-row let-expanded="expanded">
64
+ <tr
65
+ [pSelectableRow]="row"
66
+ [pSelectableRowDisabled]="selectionMode !== 'single'"
67
+ (dblclick)="
68
+ router.navigate(['./' + row.row[entityKey ?? 'id']], {
69
+ relativeTo: route
70
+ })
71
+ "
72
+ >
73
+ @if (selectionMode === 'multiple'){
74
+ <td>
75
+ <p-tableCheckbox [value]="row"></p-tableCheckbox>
76
+ </td>
77
+ }
78
+ @for (cd of tableColumns; track cd; let index = $index) {
79
+ <td
80
+ [class]="cd.columnClass!"
81
+ [class.v-auto-cell]="cd.template"
82
+ >
83
+ @if (cd.template) {
84
+ <ng-container
85
+ *ngTemplateOutlet="cd.template; context: { $implicit: row.row }"
86
+ ></ng-container>
87
+ }
88
+ @if (!row.template) {
89
+ <span
90
+ [queryParams]="cd.queryParams ? cd.queryParams : undefined"
91
+ [routerLink]="cd.routerLink ? cd.routerLink(row.row) : undefined"
92
+ [innerHTML]="cd.valueGetter(row.row, index)"
93
+ ></span>
94
+ }
95
+ </td>
96
+ }
97
+ @if (rowDetailTemplate){
98
+ <td>
99
+ <p-button
100
+ type="button"
101
+ pRipple
102
+ severity="primary"
103
+ [pRowToggler]="row"
104
+ [text]="true"
105
+ [rounded]="true"
106
+ [plain]="true"
107
+ [icon]="expanded ? icons.chevronDown : icons.chevronRight"
108
+ />
109
+ </td>
110
+ }
111
+ </tr>
112
+ </ng-template>
113
+ <ng-template pTemplate="rowexpansion" let-row>
114
+ <tr>
115
+ <td [attr.colspan]="tableColumns.length + 1">
116
+ <ng-container
117
+ class="w-100"
118
+ *ngTemplateOutlet="
119
+ expansionTemplate.template;
120
+ context: { $implicit: row.row }
121
+ "
122
+ ></ng-container>
123
+ </td>
124
+ </tr>
125
+ </ng-template>
126
+ </p-table>
127
+ </div>
@@ -0,0 +1,11 @@
1
+ .v-auto-cell {
2
+ width: 1%;
3
+ white-space: nowrap;
4
+ }
5
+
6
+ .v-table {
7
+ height: 100%;
8
+ display: flex;
9
+ flex-direction: column;
10
+ height: 100%;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { TableComponent } from './table.component';
3
+
4
+ describe('TableComponent', () => {
5
+ let component: TableComponent<any>;
6
+ let fixture: ComponentFixture<TableComponent<any>>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [TableComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(TableComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,55 @@
1
+ import type { Meta, StoryObj } from '@storybook/angular';
2
+ import { within, expect } from '@storybook/test';
3
+ import { DEFAULT_SEARCH_LIMIT } from '@verisoft/core';
4
+ import { TableComponent } from './table.component';
5
+
6
+ const meta: Meta<TableComponent<any>> = {
7
+ component: TableComponent,
8
+ title: 'TableComponent',
9
+ };
10
+ export default meta;
11
+ type Story = StoryObj<TableComponent<any>>;
12
+
13
+ export const Primary: Story = {
14
+ args: {
15
+ tableRepository: '',
16
+ total: 0,
17
+ loading: false,
18
+ scrollHeight: '100%',
19
+ scrollable: true,
20
+ pageSize: DEFAULT_SEARCH_LIMIT,
21
+ currentPage: 0,
22
+ showPaginator: true,
23
+ sortMultiple: false,
24
+ lazy: true,
25
+ multipleSelect: false,
26
+ autoIndex: false,
27
+ showPageSizePicker: true,
28
+ entityId: '',
29
+ columnDefinitions: [],
30
+ },
31
+ };
32
+
33
+ export const Heading: Story = {
34
+ args: {
35
+ tableRepository: '',
36
+ total: 0,
37
+ loading: false,
38
+ scrollHeight: '100%',
39
+ scrollable: true,
40
+ pageSize: DEFAULT_SEARCH_LIMIT,
41
+ currentPage: 0,
42
+ showPaginator: true,
43
+ sortMultiple: false,
44
+ lazy: true,
45
+ multipleSelect: false,
46
+ autoIndex: false,
47
+ showPageSizePicker: true,
48
+ entityId: '',
49
+ columnDefinitions: [],
50
+ },
51
+ play: async ({ canvasElement }: any) => {
52
+ const canvas = within(canvasElement);
53
+ expect(canvas.getByText(/verisoft-table works!/gi)).toBeTruthy();
54
+ },
55
+ };