@verisoft/ui-core 18.6.0 → 18.7.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 (333) hide show
  1. package/.eslintrc.json +48 -0
  2. package/README.md +52 -3
  3. package/jest.config.ts +21 -0
  4. package/ng-package.json +7 -0
  5. package/package.json +19 -35
  6. package/project.json +36 -0
  7. package/{index.d.ts → src/index.ts} +6 -6
  8. package/src/lib/common/angular-helper.ts +44 -0
  9. package/src/lib/common/constants.ts +5 -0
  10. package/src/lib/common/control.models.ts +71 -0
  11. package/src/lib/common/datasource-component.model.spec.ts +42 -0
  12. package/src/lib/common/datasource-component.model.ts +43 -0
  13. package/{lib/common/deactivate-guard.model.d.ts → src/lib/common/deactivate-guard.model.ts} +5 -4
  14. package/src/lib/common/download-file.ts +20 -0
  15. package/src/lib/common/filter.ts +7 -0
  16. package/{lib/common/icons.d.ts → src/lib/common/icons.ts} +34 -34
  17. package/{lib/common/index.d.ts → src/lib/common/index.ts} +10 -10
  18. package/{lib/common/notificable-property.model.d.ts → src/lib/common/notificable-property.model.ts} +5 -4
  19. package/src/lib/common/rxjs.spec.ts +58 -0
  20. package/src/lib/common/rxjs.ts +21 -0
  21. package/src/lib/components/action-button-group/action-button-group.model.ts +15 -0
  22. package/src/lib/components/action-button-group/action-button.model.ts +15 -0
  23. package/{lib/components/action-button-group/index.d.ts → src/lib/components/action-button-group/index.ts} +2 -2
  24. package/src/lib/components/base-form/base-form-input.component.ts +121 -0
  25. package/src/lib/components/base-form/base-form.component.ts +236 -0
  26. package/src/lib/components/base-form/directives/detail-store.directive.ts +219 -0
  27. package/{lib/components/base-form/index.d.ts → src/lib/components/base-form/index.ts} +4 -4
  28. package/src/lib/components/base-form/models/base-form-input.models.ts +11 -0
  29. package/src/lib/components/base-form/models/base-form.models.ts +31 -0
  30. package/{lib/components/base-form/models/index.d.ts → src/lib/components/base-form/models/index.ts} +2 -2
  31. package/{lib/components/breadcrumb/breadcrumb.model.d.ts → src/lib/components/breadcrumb/breadcrumb.model.ts} +21 -16
  32. package/src/lib/components/breadcrumb/breadcrumb.service.ts +9 -0
  33. package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +115 -0
  34. package/src/lib/components/breadcrumb/index.ts +3 -0
  35. package/{lib/components/button/button.model.d.ts → src/lib/components/button/button.model.ts} +21 -17
  36. package/src/lib/components/button/index.ts +1 -0
  37. package/{lib/components/calendar/calendar.model.d.ts → src/lib/components/calendar/calendar.model.ts} +16 -12
  38. package/src/lib/components/calendar/index.ts +1 -0
  39. package/src/lib/components/checkbox/checkbox.model.ts +8 -0
  40. package/src/lib/components/checkbox/index.ts +1 -0
  41. package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +31 -0
  42. package/src/lib/components/confirm-dialog/index.ts +1 -0
  43. package/{lib/components/dropdown/dropdown.model.d.ts → src/lib/components/dropdown/dropdown.model.ts} +16 -12
  44. package/src/lib/components/dropdown/index.ts +1 -0
  45. package/src/lib/components/dynamic-component/dynamic-component.model.ts +2 -0
  46. package/src/lib/components/dynamic-component/index.ts +1 -0
  47. package/src/lib/components/filter/filter.model.ts +17 -0
  48. package/{lib/components/filter/index.d.ts → src/lib/components/filter/index.ts} +1 -1
  49. package/{lib/components/form-field/form-field.model.d.ts → src/lib/components/form-field/form-field.model.ts} +15 -11
  50. package/src/lib/components/form-field/index.ts +1 -0
  51. package/{lib/components/generic-field/generic-field.model.d.ts → src/lib/components/generic-field/generic-field.model.ts} +10 -6
  52. package/src/lib/components/generic-field/index.ts +1 -0
  53. package/src/lib/components/generic-form/generic-form.component.ts +33 -0
  54. package/{lib/components/generic-form/index.d.ts → src/lib/components/generic-form/index.ts} +1 -1
  55. package/{lib/components/header/header.model.d.ts → src/lib/components/header/header.model.ts} +18 -11
  56. package/src/lib/components/header/index.ts +1 -0
  57. package/src/lib/components/icons/icons.component.ts +17 -0
  58. package/src/lib/components/icons/icons.model.ts +10 -0
  59. package/src/lib/components/icons/index.ts +2 -0
  60. package/{lib/components/index.d.ts → src/lib/components/index.ts} +35 -35
  61. package/src/lib/components/input-group/index.ts +1 -0
  62. package/{lib/components/input-group/input-group.model.d.ts → src/lib/components/input-group/input-group.model.ts} +17 -12
  63. package/src/lib/components/loader/index.ts +1 -0
  64. package/src/lib/components/loader/loader.model.ts +7 -0
  65. package/src/lib/components/multiselect/index.ts +1 -0
  66. package/{lib/components/multiselect/mutiselect.model.d.ts → src/lib/components/multiselect/mutiselect.model.ts} +13 -9
  67. package/src/lib/components/number-input/index.ts +1 -0
  68. package/{lib/components/number-input/number-input.model.d.ts → src/lib/components/number-input/number-input.model.ts} +14 -10
  69. package/{lib/components/page-header/index.d.ts → src/lib/components/page-header/index.ts} +3 -3
  70. package/{lib/components/page-header/page-header.model.d.ts → src/lib/components/page-header/page-header.model.ts} +11 -7
  71. package/src/lib/components/page-header/page-header.service.ts +9 -0
  72. package/src/lib/components/page-header/page-headercore.component.ts +40 -0
  73. package/src/lib/components/password/index.ts +1 -0
  74. package/{lib/components/password/password.model.d.ts → src/lib/components/password/password.model.ts} +25 -19
  75. package/src/lib/components/radiobutton/index.ts +1 -0
  76. package/{lib/components/radiobutton/radiobutton.model.d.ts → src/lib/components/radiobutton/radiobutton.model.ts} +16 -11
  77. package/src/lib/components/section/index.ts +1 -0
  78. package/{lib/components/section/section.model.d.ts → src/lib/components/section/section.model.ts} +11 -7
  79. package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +31 -0
  80. package/{lib/components/side-menu/index.d.ts → src/lib/components/side-menu/index.ts} +4 -4
  81. package/src/lib/components/side-menu/services/side-menu-provider.service.ts +13 -0
  82. package/src/lib/components/side-menu/services/side-menu.service.ts +62 -0
  83. package/src/lib/components/side-menu/side-menu.model.ts +67 -0
  84. package/src/lib/components/slider/index.ts +1 -0
  85. package/{lib/components/slider/slider.model.d.ts → src/lib/components/slider/slider.model.ts} +13 -9
  86. package/src/lib/components/snackbar/index.ts +1 -0
  87. package/src/lib/components/snackbar/snackbar.model.ts +7 -0
  88. package/src/lib/components/stepper/index.ts +1 -0
  89. package/{lib/components/stepper/stepper.model.d.ts → src/lib/components/stepper/stepper.model.ts} +24 -19
  90. package/src/lib/components/switch/index.ts +1 -0
  91. package/src/lib/components/switch/switch.model.ts +8 -0
  92. package/src/lib/components/tab-view/index.ts +1 -0
  93. package/{lib/components/tab-view/tab-view.model.d.ts → src/lib/components/tab-view/tab-view.model.ts} +22 -17
  94. package/src/lib/components/table/column-configuration.ts +38 -0
  95. package/{lib/components/table/index.d.ts → src/lib/components/table/index.ts} +4 -4
  96. package/src/lib/components/table/table-builder.ts +93 -0
  97. package/src/lib/components/table/table-column.directive.ts +62 -0
  98. package/src/lib/components/table/table.models.ts +261 -0
  99. package/src/lib/components/table-filter/index.ts +1 -0
  100. package/{lib/components/table-filter/table-filter.model.d.ts → src/lib/components/table-filter/table-filter.model.ts} +22 -17
  101. package/src/lib/components/textarea/index.ts +1 -0
  102. package/{lib/components/textarea/textarea.model.d.ts → src/lib/components/textarea/textarea.model.ts} +13 -9
  103. package/src/lib/components/textfield/index.ts +1 -0
  104. package/{lib/components/textfield/textfield.model.d.ts → src/lib/components/textfield/textfield.model.ts} +13 -9
  105. package/src/lib/components/tristatecheckbox/index.ts +1 -0
  106. package/src/lib/components/tristatecheckbox/tristatecheckbox.model.ts +8 -0
  107. package/src/lib/components/unsubscribe.component.ts +12 -0
  108. package/src/lib/directives/datasource.directive.ts +275 -0
  109. package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +4 -4
  110. package/src/lib/directives/shortcut.directive.ts +37 -0
  111. package/src/lib/directives/table-datasource.directive.ts +184 -0
  112. package/src/lib/directives/table-filter.directive.ts +69 -0
  113. package/src/lib/format/format.ts +74 -0
  114. package/src/lib/pipes/error/error.codes.ts +11 -0
  115. package/src/lib/pipes/error/error.models.ts +27 -0
  116. package/src/lib/pipes/error/error.pipe.ts +27 -0
  117. package/src/lib/pipes/error/warning.codes.ts +5 -0
  118. package/src/lib/pipes/error/warning.pipe.ts +27 -0
  119. package/src/lib/pipes/helper/enumToList.pipe.ts +16 -0
  120. package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +7 -7
  121. package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +23 -0
  122. package/src/lib/services/confirm-dialog.service.ts +44 -0
  123. package/{lib/services/index.d.ts → src/lib/services/index.ts} +4 -4
  124. package/src/lib/services/leave-form.service.ts +53 -0
  125. package/src/lib/services/screen-size.service.ts +25 -0
  126. package/src/lib/services/table.service.ts +22 -0
  127. package/src/test-setup.ts +8 -0
  128. package/tsconfig.json +28 -0
  129. package/tsconfig.lib.json +17 -0
  130. package/tsconfig.lib.prod.json +9 -0
  131. package/tsconfig.spec.json +16 -0
  132. package/esm2022/index.mjs +0 -7
  133. package/esm2022/lib/common/angular-helper.mjs +0 -23
  134. package/esm2022/lib/common/constants.mjs +0 -4
  135. package/esm2022/lib/common/control.models.mjs +0 -63
  136. package/esm2022/lib/common/datasource-component.model.mjs +0 -14
  137. package/esm2022/lib/common/deactivate-guard.model.mjs +0 -2
  138. package/esm2022/lib/common/download-file.mjs +0 -13
  139. package/esm2022/lib/common/filter.mjs +0 -7
  140. package/esm2022/lib/common/icons.mjs +0 -2
  141. package/esm2022/lib/common/index.mjs +0 -11
  142. package/esm2022/lib/common/notificable-property.model.mjs +0 -2
  143. package/esm2022/lib/common/rxjs.mjs +0 -11
  144. package/esm2022/lib/components/action-button-group/action-button-group.model.mjs +0 -3
  145. package/esm2022/lib/components/action-button-group/action-button.model.mjs +0 -2
  146. package/esm2022/lib/components/action-button-group/index.mjs +0 -3
  147. package/esm2022/lib/components/base-form/base-form-input.component.mjs +0 -100
  148. package/esm2022/lib/components/base-form/base-form.component.mjs +0 -187
  149. package/esm2022/lib/components/base-form/directives/detail-store.directive.mjs +0 -163
  150. package/esm2022/lib/components/base-form/index.mjs +0 -5
  151. package/esm2022/lib/components/base-form/models/base-form-input.models.mjs +0 -7
  152. package/esm2022/lib/components/base-form/models/base-form.models.mjs +0 -10
  153. package/esm2022/lib/components/base-form/models/index.mjs +0 -3
  154. package/esm2022/lib/components/breadcrumb/breadcrumb.model.mjs +0 -3
  155. package/esm2022/lib/components/breadcrumb/breadcrumb.service.mjs +0 -16
  156. package/esm2022/lib/components/breadcrumb/breadcrumbcore.component.mjs +0 -88
  157. package/esm2022/lib/components/breadcrumb/index.mjs +0 -4
  158. package/esm2022/lib/components/button/button.model.mjs +0 -3
  159. package/esm2022/lib/components/button/index.mjs +0 -2
  160. package/esm2022/lib/components/calendar/calendar.model.mjs +0 -3
  161. package/esm2022/lib/components/calendar/index.mjs +0 -2
  162. package/esm2022/lib/components/checkbox/checkbox.model.mjs +0 -3
  163. package/esm2022/lib/components/checkbox/index.mjs +0 -2
  164. package/esm2022/lib/components/confirm-dialog/confirm-dialog.model.mjs +0 -3
  165. package/esm2022/lib/components/confirm-dialog/index.mjs +0 -2
  166. package/esm2022/lib/components/dropdown/dropdown.model.mjs +0 -3
  167. package/esm2022/lib/components/dropdown/index.mjs +0 -2
  168. package/esm2022/lib/components/dynamic-component/dynamic-component.model.mjs +0 -2
  169. package/esm2022/lib/components/dynamic-component/index.mjs +0 -2
  170. package/esm2022/lib/components/filter/filter.model.mjs +0 -3
  171. package/esm2022/lib/components/filter/index.mjs +0 -2
  172. package/esm2022/lib/components/form-field/form-field.model.mjs +0 -3
  173. package/esm2022/lib/components/form-field/index.mjs +0 -2
  174. package/esm2022/lib/components/generic-field/generic-field.model.mjs +0 -3
  175. package/esm2022/lib/components/generic-field/index.mjs +0 -2
  176. package/esm2022/lib/components/generic-form/generic-form.component.mjs +0 -10
  177. package/esm2022/lib/components/generic-form/index.mjs +0 -2
  178. package/esm2022/lib/components/header/header.model.mjs +0 -4
  179. package/esm2022/lib/components/header/index.mjs +0 -2
  180. package/esm2022/lib/components/icons/icons.component.mjs +0 -29
  181. package/esm2022/lib/components/icons/icons.model.mjs +0 -3
  182. package/esm2022/lib/components/icons/index.mjs +0 -3
  183. package/esm2022/lib/components/index.mjs +0 -36
  184. package/esm2022/lib/components/input-group/index.mjs +0 -2
  185. package/esm2022/lib/components/input-group/input-group.model.mjs +0 -3
  186. package/esm2022/lib/components/loader/index.mjs +0 -2
  187. package/esm2022/lib/components/loader/loader.model.mjs +0 -3
  188. package/esm2022/lib/components/multiselect/index.mjs +0 -2
  189. package/esm2022/lib/components/multiselect/mutiselect.model.mjs +0 -3
  190. package/esm2022/lib/components/number-input/index.mjs +0 -2
  191. package/esm2022/lib/components/number-input/number-input.model.mjs +0 -3
  192. package/esm2022/lib/components/page-header/index.mjs +0 -4
  193. package/esm2022/lib/components/page-header/page-header.model.mjs +0 -3
  194. package/esm2022/lib/components/page-header/page-header.service.mjs +0 -16
  195. package/esm2022/lib/components/page-header/page-headercore.component.mjs +0 -52
  196. package/esm2022/lib/components/password/index.mjs +0 -2
  197. package/esm2022/lib/components/password/password.model.mjs +0 -11
  198. package/esm2022/lib/components/radiobutton/index.mjs +0 -2
  199. package/esm2022/lib/components/radiobutton/radiobutton.model.mjs +0 -3
  200. package/esm2022/lib/components/section/index.mjs +0 -2
  201. package/esm2022/lib/components/section/section.model.mjs +0 -3
  202. package/esm2022/lib/components/side-menu/directives/side-menu-service.directive.mjs +0 -31
  203. package/esm2022/lib/components/side-menu/index.mjs +0 -5
  204. package/esm2022/lib/components/side-menu/services/side-menu-provider.service.mjs +0 -25
  205. package/esm2022/lib/components/side-menu/services/side-menu.service.mjs +0 -50
  206. package/esm2022/lib/components/side-menu/side-menu.model.mjs +0 -6
  207. package/esm2022/lib/components/slider/index.mjs +0 -2
  208. package/esm2022/lib/components/slider/slider.model.mjs +0 -3
  209. package/esm2022/lib/components/snackbar/index.mjs +0 -2
  210. package/esm2022/lib/components/snackbar/snackbar.model.mjs +0 -3
  211. package/esm2022/lib/components/stepper/index.mjs +0 -2
  212. package/esm2022/lib/components/stepper/stepper.model.mjs +0 -3
  213. package/esm2022/lib/components/switch/index.mjs +0 -2
  214. package/esm2022/lib/components/switch/switch.model.mjs +0 -3
  215. package/esm2022/lib/components/tab-view/index.mjs +0 -2
  216. package/esm2022/lib/components/tab-view/tab-view.model.mjs +0 -3
  217. package/esm2022/lib/components/table/column-configuration.mjs +0 -32
  218. package/esm2022/lib/components/table/index.mjs +0 -5
  219. package/esm2022/lib/components/table/table-builder.mjs +0 -68
  220. package/esm2022/lib/components/table/table-column.directive.mjs +0 -86
  221. package/esm2022/lib/components/table/table.models.mjs +0 -150
  222. package/esm2022/lib/components/table-filter/index.mjs +0 -2
  223. package/esm2022/lib/components/table-filter/table-filter.model.mjs +0 -3
  224. package/esm2022/lib/components/textarea/index.mjs +0 -2
  225. package/esm2022/lib/components/textarea/textarea.model.mjs +0 -3
  226. package/esm2022/lib/components/textfield/index.mjs +0 -2
  227. package/esm2022/lib/components/textfield/textfield.model.mjs +0 -3
  228. package/esm2022/lib/components/tristatecheckbox/index.mjs +0 -2
  229. package/esm2022/lib/components/tristatecheckbox/tristatecheckbox.model.mjs +0 -3
  230. package/esm2022/lib/components/unsubscribe.component.mjs +0 -16
  231. package/esm2022/lib/directives/datasource.directive.mjs +0 -175
  232. package/esm2022/lib/directives/index.mjs +0 -5
  233. package/esm2022/lib/directives/shortcut.directive.mjs +0 -46
  234. package/esm2022/lib/directives/table-datasource.directive.mjs +0 -124
  235. package/esm2022/lib/directives/table-filter.directive.mjs +0 -56
  236. package/esm2022/lib/format/format.mjs +0 -63
  237. package/esm2022/lib/pipes/error/error.codes.mjs +0 -10
  238. package/esm2022/lib/pipes/error/error.models.mjs +0 -21
  239. package/esm2022/lib/pipes/error/error.pipe.mjs +0 -31
  240. package/esm2022/lib/pipes/error/warning.codes.mjs +0 -4
  241. package/esm2022/lib/pipes/error/warning.pipe.mjs +0 -31
  242. package/esm2022/lib/pipes/helper/enumToList.pipe.mjs +0 -22
  243. package/esm2022/lib/pipes/index.mjs +0 -8
  244. package/esm2022/lib/pipes/keyOrFn/keyOrFn.pipe.mjs +0 -31
  245. package/esm2022/lib/services/confirm-dialog.service.mjs +0 -45
  246. package/esm2022/lib/services/index.mjs +0 -5
  247. package/esm2022/lib/services/leave-form.service.mjs +0 -52
  248. package/esm2022/lib/services/screen-size.service.mjs +0 -29
  249. package/esm2022/lib/services/table.service.mjs +0 -27
  250. package/esm2022/verisoft-ui-core.mjs +0 -5
  251. package/fesm2022/verisoft-ui-core.mjs +0 -2014
  252. package/fesm2022/verisoft-ui-core.mjs.map +0 -1
  253. package/lib/common/angular-helper.d.ts +0 -1
  254. package/lib/common/constants.d.ts +0 -3
  255. package/lib/common/control.models.d.ts +0 -62
  256. package/lib/common/datasource-component.model.d.ts +0 -19
  257. package/lib/common/download-file.d.ts +0 -2
  258. package/lib/common/filter.d.ts +0 -1
  259. package/lib/common/rxjs.d.ts +0 -2
  260. package/lib/components/action-button-group/action-button-group.model.d.ts +0 -12
  261. package/lib/components/action-button-group/action-button.model.d.ts +0 -14
  262. package/lib/components/base-form/base-form-input.component.d.ts +0 -30
  263. package/lib/components/base-form/base-form.component.d.ts +0 -50
  264. package/lib/components/base-form/directives/detail-store.directive.d.ts +0 -35
  265. package/lib/components/base-form/models/base-form-input.models.d.ts +0 -7
  266. package/lib/components/base-form/models/base-form.models.d.ts +0 -18
  267. package/lib/components/breadcrumb/breadcrumb.service.d.ts +0 -8
  268. package/lib/components/breadcrumb/breadcrumbcore.component.d.ts +0 -30
  269. package/lib/components/breadcrumb/index.d.ts +0 -3
  270. package/lib/components/button/index.d.ts +0 -1
  271. package/lib/components/calendar/index.d.ts +0 -1
  272. package/lib/components/checkbox/checkbox.model.d.ts +0 -4
  273. package/lib/components/checkbox/index.d.ts +0 -1
  274. package/lib/components/confirm-dialog/confirm-dialog.model.d.ts +0 -25
  275. package/lib/components/confirm-dialog/index.d.ts +0 -1
  276. package/lib/components/dropdown/index.d.ts +0 -1
  277. package/lib/components/dynamic-component/dynamic-component.model.d.ts +0 -3
  278. package/lib/components/dynamic-component/index.d.ts +0 -1
  279. package/lib/components/filter/filter.model.d.ts +0 -13
  280. package/lib/components/form-field/index.d.ts +0 -1
  281. package/lib/components/generic-field/index.d.ts +0 -1
  282. package/lib/components/generic-form/generic-form.component.d.ts +0 -30
  283. package/lib/components/header/index.d.ts +0 -1
  284. package/lib/components/icons/icons.component.d.ts +0 -6
  285. package/lib/components/icons/icons.model.d.ts +0 -6
  286. package/lib/components/icons/index.d.ts +0 -2
  287. package/lib/components/input-group/index.d.ts +0 -1
  288. package/lib/components/loader/index.d.ts +0 -1
  289. package/lib/components/loader/loader.model.d.ts +0 -3
  290. package/lib/components/multiselect/index.d.ts +0 -1
  291. package/lib/components/number-input/index.d.ts +0 -1
  292. package/lib/components/page-header/page-header.service.d.ts +0 -8
  293. package/lib/components/page-header/page-headercore.component.d.ts +0 -20
  294. package/lib/components/password/index.d.ts +0 -1
  295. package/lib/components/radiobutton/index.d.ts +0 -1
  296. package/lib/components/section/index.d.ts +0 -1
  297. package/lib/components/side-menu/directives/side-menu-service.directive.d.ts +0 -11
  298. package/lib/components/side-menu/services/side-menu-provider.service.d.ts +0 -10
  299. package/lib/components/side-menu/services/side-menu.service.d.ts +0 -15
  300. package/lib/components/side-menu/side-menu.model.d.ts +0 -42
  301. package/lib/components/slider/index.d.ts +0 -1
  302. package/lib/components/snackbar/index.d.ts +0 -1
  303. package/lib/components/snackbar/snackbar.model.d.ts +0 -3
  304. package/lib/components/stepper/index.d.ts +0 -1
  305. package/lib/components/switch/index.d.ts +0 -1
  306. package/lib/components/switch/switch.model.d.ts +0 -4
  307. package/lib/components/tab-view/index.d.ts +0 -1
  308. package/lib/components/table/column-configuration.d.ts +0 -12
  309. package/lib/components/table/table-builder.d.ts +0 -15
  310. package/lib/components/table/table-column.directive.d.ts +0 -25
  311. package/lib/components/table/table.models.d.ts +0 -132
  312. package/lib/components/table-filter/index.d.ts +0 -1
  313. package/lib/components/textarea/index.d.ts +0 -1
  314. package/lib/components/textfield/index.d.ts +0 -1
  315. package/lib/components/tristatecheckbox/index.d.ts +0 -1
  316. package/lib/components/tristatecheckbox/tristatecheckbox.model.d.ts +0 -4
  317. package/lib/components/unsubscribe.component.d.ts +0 -9
  318. package/lib/directives/datasource.directive.d.ts +0 -32
  319. package/lib/directives/shortcut.directive.d.ts +0 -11
  320. package/lib/directives/table-datasource.directive.d.ts +0 -29
  321. package/lib/directives/table-filter.directive.d.ts +0 -17
  322. package/lib/format/format.d.ts +0 -9
  323. package/lib/pipes/error/error.codes.d.ts +0 -5
  324. package/lib/pipes/error/error.models.d.ts +0 -8
  325. package/lib/pipes/error/error.pipe.d.ts +0 -8
  326. package/lib/pipes/error/warning.codes.d.ts +0 -5
  327. package/lib/pipes/error/warning.pipe.d.ts +0 -8
  328. package/lib/pipes/helper/enumToList.pipe.d.ts +0 -7
  329. package/lib/pipes/keyOrFn/keyOrFn.pipe.d.ts +0 -7
  330. package/lib/services/confirm-dialog.service.d.ts +0 -12
  331. package/lib/services/leave-form.service.d.ts +0 -13
  332. package/lib/services/screen-size.service.d.ts +0 -10
  333. package/lib/services/table.service.d.ts +0 -13
@@ -0,0 +1,15 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { IconPositionType } from '../../common';
3
+ import { ActionButton } from './action-button.model';
4
+
5
+ export const ACTION_BUTTON_GROUP_COMPONENT_TOKEN =
6
+ new InjectionToken<ActionButtonGroupCore>('ActionButtonGroupComponentToken');
7
+
8
+ export interface ActionButtonGroupCore {
9
+ maxItems: number;
10
+ maxItemsMobile: number;
11
+ items: ActionButton[];
12
+ menuIconPos: IconPositionType;
13
+ menuIcon: string;
14
+ label?: string;
15
+ }
@@ -0,0 +1,15 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { ControlSeverityType, FieldSizeType, NotificableProperty } from '../../common';
3
+
4
+ export interface ActionButton extends NotificableProperty {
5
+ disabled: boolean;
6
+ toolTip?: string;
7
+ id?: string;
8
+ icon?: string;
9
+ outlined: boolean;
10
+ raised: boolean;
11
+ severity?: ControlSeverityType;
12
+ label?: string;
13
+ size?: FieldSizeType;
14
+ click: EventEmitter<MouseEvent>;
15
+ }
@@ -1,2 +1,2 @@
1
- export * from './action-button-group.model';
2
- export * from './action-button.model';
1
+ export * from './action-button-group.model';
2
+ export * from './action-button.model';
@@ -0,0 +1,121 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, inject, Input, OnInit } from '@angular/core';
3
+ import {
4
+ AbstractControl,
5
+ ControlValueAccessor,
6
+ FormControl,
7
+ FormControlDirective,
8
+ FormControlName,
9
+ FormGroupDirective,
10
+ NgControl,
11
+ NgModel,
12
+ ReactiveFormsModule,
13
+ } from '@angular/forms';
14
+ import { ERROR_PROVIDER_TOKEN } from '@verisoft/core';
15
+ import { BaseInputControls } from './models/base-form-input.models';
16
+
17
+ const noop = () => {
18
+ /* */
19
+ };
20
+
21
+ @Component({
22
+ template: '',
23
+ standalone: true,
24
+ imports: [CommonModule, ReactiveFormsModule],
25
+ })
26
+ export class BaseFormInputComponent
27
+ implements BaseInputControls<any>, ControlValueAccessor, OnInit
28
+ {
29
+ readonly ngControl?: NgControl;
30
+
31
+ readonly errorService = inject(ERROR_PROVIDER_TOKEN);
32
+
33
+ formControl!: FormControl;
34
+
35
+ constructor(private readonly control: NgControl) {
36
+ this.ngControl = control;
37
+ if (this.control) {
38
+ this.ngControl.valueAccessor = this;
39
+ }
40
+ }
41
+
42
+ @Input()
43
+ label?: string;
44
+
45
+ @Input()
46
+ required = false;
47
+
48
+ @Input()
49
+ readonly!: boolean;
50
+
51
+ @Input()
52
+ disabled!: boolean;
53
+
54
+ @Input()
55
+ tooltip!: string;
56
+
57
+ @Input()
58
+ formDisplay: 'flex' | 'block' = 'flex';
59
+
60
+ @Input()
61
+ clearable = true;
62
+
63
+ @Input()
64
+ placeholder?: string = '';
65
+
66
+ @Input()
67
+ testId?: string;
68
+
69
+ inputId = Math.random().toString(36).substring(2);
70
+
71
+ selectionChanged: any = noop;
72
+
73
+ onTouch: any = noop;
74
+
75
+ registerOnChange(fn: any): void {
76
+ this.selectionChanged = fn;
77
+ }
78
+
79
+ registerOnTouched(fn: any): void {
80
+ this.onTouch = fn;
81
+ }
82
+
83
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
84
+ writeValue(value: any): void {}
85
+
86
+ ngOnInit(): void {
87
+ if (this.ngControl) {
88
+ if (this.ngControl instanceof FormControlName) {
89
+ this.formControl =
90
+ this.ngControl.control ||
91
+ ((this.ngControl.formDirective as FormGroupDirective)?.form.controls[
92
+ this.ngControl.name as string
93
+ ] as FormControl);
94
+ } else if (
95
+ this.ngControl instanceof FormControlDirective ||
96
+ this.ngControl instanceof NgModel
97
+ ) {
98
+ this.formControl = this.ngControl.control;
99
+ if (this.ngControl instanceof NgModel) {
100
+ this.formControl.valueChanges.subscribe(() =>
101
+ this.ngControl?.viewToModelUpdate(this.control?.value)
102
+ );
103
+ }
104
+ } else {
105
+ this.formControl = new FormControl();
106
+ }
107
+ } else {
108
+ this.formControl = new FormControl();
109
+ }
110
+ }
111
+
112
+ isRequired() {
113
+ if (this.ngControl) {
114
+ const validator = this.ngControl?.control?.validator?.(
115
+ {} as AbstractControl
116
+ );
117
+ return this.required || (validator && validator['required']);
118
+ }
119
+ return this.required;
120
+ }
121
+ }
@@ -0,0 +1,236 @@
1
+ import {
2
+ AfterViewInit,
3
+ ChangeDetectorRef,
4
+ Directive,
5
+ EventEmitter,
6
+ HostListener,
7
+ inject,
8
+ Input,
9
+ OnChanges,
10
+ OnDestroy,
11
+ OnInit,
12
+ Output,
13
+ SimpleChanges,
14
+ ViewChild,
15
+ } from '@angular/core';
16
+ import { FormGroup } from '@angular/forms';
17
+ import { cloneDeep } from 'lodash-es';
18
+ import { Subject, takeUntil, filter, map, Observable } from 'rxjs';
19
+ import { PreventUnsavedChangesCore } from '../../common';
20
+ import { PreventUnsavedChangesDirective } from '../../services';
21
+ import { FormState, isFormStateEqual } from './models';
22
+ @Directive({
23
+ // eslint-disable-next-line @angular-eslint/directive-selector
24
+ selector: '[v-baseForm]',
25
+ standalone: true,
26
+ })
27
+ export abstract class BaseFormDirective<T extends object>
28
+ implements OnInit, OnChanges, OnDestroy, AfterViewInit, PreventUnsavedChangesCore
29
+ {
30
+ @Input() data!: T | any;
31
+ @Output() dataChange = new EventEmitter<T>();
32
+ @Output() statusChange = new EventEmitter<FormState>();
33
+ @Output() formSubmit = new EventEmitter<T>();
34
+ @Output() formClear = new EventEmitter<void>();
35
+
36
+ formDestroyed$ = new Subject<void>();
37
+ keys: { key: string; alias?: string; type?: string; readOnly: string }[] = [];
38
+ formGroup!: FormGroup;
39
+ cd = inject(ChangeDetectorRef);
40
+ valueInitialization = false;
41
+ lastState!: FormState;
42
+ guardViewChild!: ViewChild;
43
+ formSubmitted = false;
44
+ protected guard = inject(PreventUnsavedChangesDirective);
45
+
46
+ @HostListener('window:beforeunload', ['$event'])
47
+ unloadHandler(event: BeforeUnloadEvent) {
48
+ if (this.formGroup.dirty) {
49
+ event.preventDefault();
50
+ }
51
+ }
52
+
53
+ canDeactivate(): Observable<boolean> | Promise<boolean> | boolean {
54
+ if (this.formGroup.dirty && !this.formSubmitted) {
55
+ const result = this.guard.showConfirmationDialog();
56
+ return result;
57
+ }
58
+
59
+ return true;
60
+ }
61
+
62
+ ngOnInit(): void {
63
+ this.initializeFormGroup();
64
+ }
65
+
66
+ ngOnChanges(changes: SimpleChanges): void {
67
+ if (changes['data'] && this.formGroup) {
68
+ this.valueInitialization = true;
69
+ const dirty = this.formGroup.dirty;
70
+
71
+ this.formGroup.patchValue(this.fromModel(this.data), {
72
+ emitEvent: false,
73
+ onlySelf: true,
74
+ });
75
+
76
+ this.formGroup.updateValueAndValidity();
77
+ if (!dirty) {
78
+ this.formGroup.markAsPristine();
79
+ }
80
+
81
+ this.valueInitialization = false;
82
+ this.createAndEmitIfFormStateChanged();
83
+ }
84
+ }
85
+
86
+ ngAfterViewInit() {
87
+ this.cd.detectChanges();
88
+ }
89
+
90
+ ngOnDestroy(): void {
91
+ this.formDestroyed$.next();
92
+ this.formDestroyed$.complete();
93
+ }
94
+
95
+ abstract createFormGroup(): FormGroup;
96
+
97
+ createCompleteData() {
98
+ const change = this.toModel(this.formGroup?.value);
99
+ this.recursiveObjectAttributesTransformation(change);
100
+ const updatedData = this.applyChanges(
101
+ cloneDeep(this.data),
102
+ cloneDeep(change)
103
+ );
104
+
105
+ return updatedData;
106
+ }
107
+
108
+ submit() {
109
+ this.formSubmitted = true;
110
+ this.formGroup.markAllAsTouched();
111
+ if (!this.formGroup.invalid) {
112
+ this.formSubmit.emit(this.createCompleteData());
113
+ }
114
+ this.formGroup.markAsPristine();
115
+ }
116
+
117
+ clear() {
118
+ this.formClear.emit();
119
+ }
120
+
121
+ private initializeFormGroup() {
122
+ this.formGroup = this.createFormGroup();
123
+ this.valueInitialization = true;
124
+ this.formGroup.patchValue(this.fromModel(this.data), {
125
+ emitEvent: false,
126
+ onlySelf: true,
127
+ });
128
+
129
+ this.formGroup.markAsPristine();
130
+ this.initValueChanges();
131
+ this.initStatusChanges();
132
+ this.valueInitialization = false;
133
+ }
134
+
135
+ private initValueChanges() {
136
+ this.formGroup.valueChanges
137
+ .pipe(
138
+ takeUntil(this.formDestroyed$),
139
+ filter(() => !this.valueInitialization),
140
+ map((value) => {
141
+ const change = this.toModel(value);
142
+ this.recursiveObjectAttributesTransformation(change);
143
+ const updatedData = this.applyChanges(
144
+ cloneDeep(this.data),
145
+ cloneDeep(change)
146
+ );
147
+ return updatedData;
148
+ })
149
+ )
150
+ .subscribe((updatedData) => {
151
+ this.dataChange.emit(updatedData);
152
+ });
153
+ }
154
+
155
+ private initStatusChanges() {
156
+ this.formGroup.statusChanges
157
+ .pipe(takeUntil(this.formDestroyed$))
158
+ .subscribe(() => {
159
+ if (!this.valueInitialization) {
160
+ this.createAndEmitIfFormStateChanged();
161
+ }
162
+ });
163
+
164
+ this.createAndEmitIfFormStateChanged();
165
+ }
166
+
167
+ private createAndEmitIfFormStateChanged() {
168
+ const formState: FormState = {
169
+ valid: !this.formGroup.invalid,
170
+ dirty: this.formGroup.dirty,
171
+ };
172
+
173
+ if (!isFormStateEqual(formState, this.lastState)) {
174
+ this.lastState = formState;
175
+ this.statusChange.emit(formState);
176
+ }
177
+ }
178
+
179
+ protected applyChanges(data: T, changes: Partial<T>): T {
180
+ return Object.assign(data || ({} as T), changes);
181
+ }
182
+
183
+ protected toModel(data: T): Partial<T> {
184
+ return data || {};
185
+ }
186
+
187
+ protected fromModel(data: T): T {
188
+ return { ...(data || {}) } as T;
189
+ }
190
+
191
+ private recursiveObjectAttributesTransformation(obj: any): void {
192
+ this.recursiveObjectAttributesTraversal(
193
+ obj,
194
+ this.transformEmptyStringToNullStringFn
195
+ );
196
+ }
197
+
198
+ private recursiveObjectAttributesTraversal(
199
+ obj: any,
200
+ transformationFn: (obj: any, key: string) => void
201
+ ) {
202
+ if (
203
+ obj === null ||
204
+ transformationFn === null ||
205
+ typeof transformationFn !== 'function'
206
+ ) {
207
+ return;
208
+ }
209
+
210
+ const traverse = (obj: any) => {
211
+ for (const key in obj) {
212
+ // eslint-disable-next-line no-prototype-builtins
213
+ if (obj.hasOwnProperty(key)) {
214
+ transformationFn(obj, key);
215
+
216
+ if (typeof obj[key] === 'object') {
217
+ traverse(obj[key]);
218
+ }
219
+ }
220
+ }
221
+ };
222
+
223
+ traverse(obj);
224
+ }
225
+
226
+ private transformEmptyStringToNullStringFn(obj: any, key: string) {
227
+ // if empty string - transformation to null string
228
+ if (typeof obj[key] === 'string' && obj[key] === '') {
229
+ try {
230
+ obj[key] = null;
231
+ } catch (error) {
232
+ console.error(`Cannot modify ${key}: ${error}`)
233
+ }
234
+ }
235
+ }
236
+ }
@@ -0,0 +1,219 @@
1
+ import {
2
+ Directive,
3
+ AfterViewInit,
4
+ inject,
5
+ Input,
6
+ OnInit,
7
+ ChangeDetectorRef,
8
+ OnDestroy,
9
+ } from '@angular/core';
10
+ import { ActivatedRoute } from '@angular/router';
11
+ import { createFeatureSelector, createSelector, Store } from '@ngrx/store';
12
+ import {
13
+ BackendValidationError,
14
+ createInitDetailAction,
15
+ createInitNewDetailAction,
16
+ createResetStateAction,
17
+ createUpdateDetailAction,
18
+ createUpdateDetailSetErrorsAction,
19
+ createUpdateFormStateAction,
20
+ DetailState,
21
+ } from '@verisoft/store';
22
+ import { takeUntil } from 'rxjs';
23
+ import { UnsubscribeComponent } from '../../unsubscribe.component';
24
+ import { BaseFormDirective } from '../base-form.component';
25
+
26
+ @Directive({
27
+ // eslint-disable-next-line @angular-eslint/directive-selector
28
+ selector: '[v-useDetailStore]',
29
+ exportAs: 'useDetailStore',
30
+ standalone: true,
31
+ })
32
+ export class DetailStoreDirective
33
+ extends UnsubscribeComponent
34
+ implements OnInit, AfterViewInit, OnDestroy
35
+ {
36
+ @Input({ required: true }) form!: BaseFormDirective<any>;
37
+
38
+ @Input({ required: true }) detailsRepository!: string;
39
+
40
+ @Input() autoBind = true;
41
+
42
+ @Input() detailId!: string | number | undefined;
43
+
44
+ @Input({ required: true }) ngrxFeatureKey!: string;
45
+
46
+ @Input() destroyForm = true;
47
+
48
+ @Input() readonly = false;
49
+
50
+ @Input() readonlyControlNames: string[] = [];
51
+
52
+ store = inject(Store);
53
+ cdr = inject(ChangeDetectorRef);
54
+ route = inject(ActivatedRoute);
55
+
56
+ private itemCache: any = null;
57
+ private loaded!: boolean;
58
+
59
+ ngOnInit(): void {
60
+ if (!this.loaded) {
61
+ this.listenFormState();
62
+ }
63
+ this.listenFormChange();
64
+ this.listenFormStatusChange();
65
+ }
66
+
67
+ ngAfterViewInit(): void {
68
+ if (this.autoBind && !this.loaded) {
69
+ this.initForm();
70
+ }
71
+ }
72
+
73
+ override ngOnDestroy(): void {
74
+ super.ngOnDestroy();
75
+ if (this.destroyForm) {
76
+ this.store.dispatch(createResetStateAction(this.detailsRepository)());
77
+ }
78
+ }
79
+
80
+ private initForm() {
81
+ if (this.detailId === 'create') {
82
+ this.store.dispatch(createInitNewDetailAction(this.detailsRepository)());
83
+ } else {
84
+ this.store.dispatch(
85
+ createInitDetailAction(this.detailsRepository)({ obj: this.detailId })
86
+ );
87
+ }
88
+
89
+ if (this.readonly) {
90
+ this.form.formGroup.disable();
91
+ return;
92
+ }
93
+
94
+ this.readonlyControlNames.forEach(x => {
95
+ this.form.formGroup.get(x)?.disable();
96
+ });
97
+ }
98
+
99
+ private listenFormState() {
100
+ const selectIncomeData = createSelector(
101
+ createFeatureSelector<any>(this.ngrxFeatureKey),
102
+ (state: any) => state?.[this.detailsRepository] as DetailState<any>
103
+ );
104
+ this.store
105
+ .select(selectIncomeData)
106
+ .pipe(takeUntil(this.destroyed$))
107
+ .subscribe(
108
+ (
109
+ { item, loaded, backendValidationErrors } = {
110
+ item: undefined,
111
+ loaded: false,
112
+ saveItemState: { saveInProgress: false },
113
+ backendValidationErrors: []
114
+ }
115
+ ) => {
116
+ if (item
117
+ && ((item.validationErrors || item.validationWarnings) && !this.form.formGroup.dirty)
118
+ || backendValidationErrors.length
119
+ ) {
120
+ this.handleValidation(
121
+ 'propertyName',
122
+ item.validationWarnings || [],
123
+ 'validationWarning',
124
+ 'warningMessage'
125
+ );
126
+ this.handleValidation(
127
+ 'propertyName',
128
+ item.validationErrors || [],
129
+ 'validationError',
130
+ 'errorMessage'
131
+ );
132
+
133
+ if (this.itemCache && this.isStateChanged(item) && backendValidationErrors.length) {
134
+ backendValidationErrors = this.dispatchErrors(item, backendValidationErrors);
135
+ }
136
+
137
+ this.handleBackendValidation(backendValidationErrors);
138
+ this.cdr.markForCheck();
139
+ }
140
+
141
+ this.itemCache = item;
142
+
143
+ this.loaded = loaded;
144
+ this.cdr.detectChanges();
145
+ }
146
+ );
147
+ }
148
+
149
+ private listenFormChange() {
150
+ this.form.dataChange.pipe(takeUntil(this.destroyed$)).subscribe((item) => {
151
+ this.store.dispatch(
152
+ createUpdateDetailAction(this.detailsRepository)({ item })
153
+ );
154
+ });
155
+ }
156
+
157
+ private listenFormStatusChange() {
158
+ this.form.statusChange
159
+ .pipe(takeUntil(this.destroyed$))
160
+ .subscribe((formState) => {
161
+ this.store.dispatch(
162
+ createUpdateFormStateAction(this.detailsRepository)({ formState })
163
+ );
164
+ });
165
+ }
166
+
167
+ private handleValidation = (
168
+ controlName: string,
169
+ errors: any[],
170
+ errorKey: string,
171
+ messageKey: string
172
+ ) => {
173
+ if (errors.length > 0) return;
174
+ errors.forEach((error: any) => {
175
+ const control = this.form.formGroup.get(error[controlName]);
176
+ if (control) {
177
+ control.disabled
178
+ ? control.disable({ emitEvent: false, onlySelf: true })
179
+ : control.enable({ emitEvent: false, onlySelf: true });
180
+ control.setErrors(
181
+ { [errorKey]: error[messageKey] },
182
+ { emitEvent: true }
183
+ );
184
+ control.markAsDirty();
185
+ }
186
+ });
187
+ };
188
+
189
+ private handleBackendValidation(errors: BackendValidationError[]) {
190
+ errors.forEach(({ parameters, code }: BackendValidationError) => {
191
+ const control = this.form.formGroup.get(this.normalizePropertyNames(parameters));
192
+ if (!control) return;
193
+
194
+ control[control.disabled ? "disable" : "enable"]({ emitEvent: false, onlySelf: true });
195
+ control.setErrors({ "validationError": code }, { emitEvent: true });
196
+ control.markAsDirty();
197
+ });
198
+ }
199
+
200
+ private dispatchErrors(item: any, errors: BackendValidationError[]): BackendValidationError[] {
201
+ const error = errors.filter((e: BackendValidationError) => {
202
+ return this.itemCache[this.normalizePropertyNames(e.parameters)] === item[this.normalizePropertyNames(e.parameters)];
203
+ });
204
+
205
+ this.store.dispatch(
206
+ createUpdateDetailSetErrorsAction(this.detailsRepository)({ error })
207
+ );
208
+
209
+ return error;
210
+ }
211
+
212
+ private normalizePropertyNames(input: string): string {
213
+ return String(input[0]).toLocaleLowerCase() + String(input).slice(1);
214
+ }
215
+
216
+ private isStateChanged(item: any): boolean {
217
+ return item !== this.itemCache;
218
+ }
219
+ }
@@ -1,4 +1,4 @@
1
- export * from './base-form-input.component';
2
- export * from './base-form.component';
3
- export * from './directives/detail-store.directive';
4
- export * from './models';
1
+ export * from './base-form-input.component';
2
+ export * from './base-form.component'
3
+ export * from './directives/detail-store.directive';
4
+ export * from './models';
@@ -0,0 +1,11 @@
1
+ import { NgControl } from '@angular/forms';
2
+
3
+ export abstract class BaseInputControls<T> {
4
+ value?: T | null;
5
+
6
+ readonly ngControl?: NgControl;
7
+
8
+ readonly label?: string;
9
+
10
+ readonly required!: boolean;
11
+ }
@@ -0,0 +1,31 @@
1
+ export interface BaseFormCore {
2
+ label?: string;
3
+ required: boolean;
4
+ readonly: boolean;
5
+ tooltip: string;
6
+ formDisplay: 'flex' | 'block';
7
+ clearable: boolean;
8
+ placeholder?: string
9
+ testId?: string;
10
+ }
11
+
12
+ export interface BaseFormDirectiveCore<T> {
13
+ initialData: T | any;
14
+ }
15
+
16
+ export interface FormState {
17
+ dirty: boolean;
18
+ valid: boolean;
19
+ }
20
+
21
+ export function isFormStateEqual(current: FormState, other: FormState) {
22
+ if (!current && !other) {
23
+ return true;
24
+ }
25
+
26
+ if (current && other) {
27
+ return current.dirty === other.dirty && current.valid === other.valid;
28
+ }
29
+
30
+ return false;
31
+ }
@@ -1,2 +1,2 @@
1
- export * from './base-form-input.models';
2
- export * from './base-form.models';
1
+ export * from './base-form-input.models';
2
+ export * from './base-form.models';