@mediusinc/mng-commons 0.0.1-rc.3 → 0.2.1-rc

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 (488) hide show
  1. package/.browserslistrc +16 -0
  2. package/README.md +96 -1
  3. package/assets/i18n/en.json +156 -0
  4. package/assets/i18n/sl.json +156 -0
  5. package/assets/images/effect-ondark.png +0 -0
  6. package/assets/images/effect-ondark.svg +38 -0
  7. package/assets/images/effect-ondark@2x.png +0 -0
  8. package/assets/images/effect-onlight.png +0 -0
  9. package/assets/images/effect-onlight.svg +38 -0
  10. package/assets/images/effect-onlight@2x.png +0 -0
  11. package/assets/images/pages/exception-ondark.png +0 -0
  12. package/assets/images/pages/exception-onlight.png +0 -0
  13. package/assets/images/pages/login-ondark.png +0 -0
  14. package/assets/images/pages/login-onlight.png +0 -0
  15. package/assets/templates/tableview-route.component.html +5 -0
  16. package/karma.conf.js +51 -0
  17. package/ng-package.json +14 -0
  18. package/package.json +3 -24
  19. package/scss/common/layout/_breadcrumb.scss +96 -0
  20. package/scss/common/layout/_config.scss +101 -0
  21. package/scss/common/layout/_dashboard.scss +16 -0
  22. package/scss/common/layout/_exception.scss +131 -0
  23. package/scss/common/layout/_footer.scss +29 -0
  24. package/scss/common/layout/_help.scss +157 -0
  25. package/scss/common/layout/_inlinemenu.scss +55 -0
  26. package/scss/common/layout/_invoice.scss +176 -0
  27. package/scss/common/layout/_landing.scss +639 -0
  28. package/scss/common/layout/_layout_dark.scss +23 -0
  29. package/scss/common/layout/_layout_light.scss +23 -0
  30. package/scss/common/layout/_loader.scss +18 -0
  31. package/scss/common/layout/_login.scss +106 -0
  32. package/scss/common/layout/_main.scss +45 -0
  33. package/scss/common/layout/_mixins.scss +214 -0
  34. package/scss/common/layout/_rightmenu.scss +125 -0
  35. package/scss/common/layout/_topbar.scss +189 -0
  36. package/scss/common/layout/_typography.scss +63 -0
  37. package/scss/common/layout/_utils.scss +96 -0
  38. package/scss/common/layout/_widgets.scss +391 -0
  39. package/scss/common/layout/menu/_menu.scss +7 -0
  40. package/scss/common/layout/menu/_menu_common.scss +183 -0
  41. package/scss/common/layout/menu/_menu_overlay.scss +52 -0
  42. package/scss/common/layout/menu/_menu_sidebar.scss +232 -0
  43. package/scss/common/layout/menu/_menu_slim.scss +138 -0
  44. package/scss/common/layout/menu/_menu_static.scss +70 -0
  45. package/scss/common/layout/menu/_menu_theme.scss +365 -0
  46. package/scss/common/theme/_theme_dark.scss +5 -0
  47. package/scss/common/theme/_theme_light.scss +5 -0
  48. package/scss/common/theme/designer/_colors.scss +18 -0
  49. package/scss/common/theme/designer/_common.scss +40 -0
  50. package/scss/common/theme/designer/_components.scss +101 -0
  51. package/scss/common/theme/designer/_mixins.scss +174 -0
  52. package/scss/common/theme/designer/components/button/_button.scss +560 -0
  53. package/scss/common/theme/designer/components/button/_speeddial.scss +79 -0
  54. package/scss/common/theme/designer/components/button/_splitbutton.scss +1 -0
  55. package/scss/common/theme/designer/components/data/_carousel.scss +37 -0
  56. package/scss/common/theme/designer/components/data/_datatable.scss +266 -0
  57. package/scss/common/theme/designer/components/data/_dataview.scss +55 -0
  58. package/scss/common/theme/designer/components/data/_filter.scss +138 -0
  59. package/scss/common/theme/designer/components/data/_fullcalendar.scss +324 -0
  60. package/scss/common/theme/designer/components/data/_orderlist.scss +91 -0
  61. package/scss/common/theme/designer/components/data/_organizationchart.scss +50 -0
  62. package/scss/common/theme/designer/components/data/_paginator.scss +83 -0
  63. package/scss/common/theme/designer/components/data/_picklist.scss +91 -0
  64. package/scss/common/theme/designer/components/data/_timeline.scss +38 -0
  65. package/scss/common/theme/designer/components/data/_tree.scss +144 -0
  66. package/scss/common/theme/designer/components/data/_treetable.scss +242 -0
  67. package/scss/common/theme/designer/components/data/_virtualscroller.scss +28 -0
  68. package/scss/common/theme/designer/components/file/_fileupload.scss +58 -0
  69. package/scss/common/theme/designer/components/input/_autocomplete.scss +103 -0
  70. package/scss/common/theme/designer/components/input/_calendar.scss +212 -0
  71. package/scss/common/theme/designer/components/input/_cascadeselect.scss +98 -0
  72. package/scss/common/theme/designer/components/input/_checkbox.scss +85 -0
  73. package/scss/common/theme/designer/components/input/_chips.scss +41 -0
  74. package/scss/common/theme/designer/components/input/_colorpicker.scss +19 -0
  75. package/scss/common/theme/designer/components/input/_dropdown.scss +136 -0
  76. package/scss/common/theme/designer/components/input/_editor.scss +122 -0
  77. package/scss/common/theme/designer/components/input/_inputgroup.scss +69 -0
  78. package/scss/common/theme/designer/components/input/_inputmask.scss +3 -0
  79. package/scss/common/theme/designer/components/input/_inputnumber.scss +3 -0
  80. package/scss/common/theme/designer/components/input/_inputswitch.scss +58 -0
  81. package/scss/common/theme/designer/components/input/_inputtext.scss +97 -0
  82. package/scss/common/theme/designer/components/input/_listbox.scss +82 -0
  83. package/scss/common/theme/designer/components/input/_multiselect.scss +164 -0
  84. package/scss/common/theme/designer/components/input/_password.scss +33 -0
  85. package/scss/common/theme/designer/components/input/_radiobutton.scss +78 -0
  86. package/scss/common/theme/designer/components/input/_rating.scss +48 -0
  87. package/scss/common/theme/designer/components/input/_selectbutton.scss +50 -0
  88. package/scss/common/theme/designer/components/input/_slider.scss +69 -0
  89. package/scss/common/theme/designer/components/input/_togglebutton.scss +48 -0
  90. package/scss/common/theme/designer/components/input/_treeselect.scss +89 -0
  91. package/scss/common/theme/designer/components/menu/_breadcrumb.scss +42 -0
  92. package/scss/common/theme/designer/components/menu/_contextmenu.scss +50 -0
  93. package/scss/common/theme/designer/components/menu/_dock.scss +51 -0
  94. package/scss/common/theme/designer/components/menu/_megamenu.scss +102 -0
  95. package/scss/common/theme/designer/components/menu/_menu.scss +41 -0
  96. package/scss/common/theme/designer/components/menu/_menubar.scss +179 -0
  97. package/scss/common/theme/designer/components/menu/_panelmenu.scss +137 -0
  98. package/scss/common/theme/designer/components/menu/_slidemenu.scss +55 -0
  99. package/scss/common/theme/designer/components/menu/_steps.scss +55 -0
  100. package/scss/common/theme/designer/components/menu/_tabmenu.scss +49 -0
  101. package/scss/common/theme/designer/components/menu/_tieredmenu.scss +56 -0
  102. package/scss/common/theme/designer/components/messages/_inlinemessage.scss +64 -0
  103. package/scss/common/theme/designer/components/messages/_message.scss +102 -0
  104. package/scss/common/theme/designer/components/messages/_toast.scss +95 -0
  105. package/scss/common/theme/designer/components/misc/_avatar.scss +30 -0
  106. package/scss/common/theme/designer/components/misc/_badge.scss +48 -0
  107. package/scss/common/theme/designer/components/misc/_blockui.scss +3 -0
  108. package/scss/common/theme/designer/components/misc/_chip.scss +36 -0
  109. package/scss/common/theme/designer/components/misc/_inplace.scss +17 -0
  110. package/scss/common/theme/designer/components/misc/_progressbar.scss +17 -0
  111. package/scss/common/theme/designer/components/misc/_scrolltop.scss +20 -0
  112. package/scss/common/theme/designer/components/misc/_skeleton.scss +8 -0
  113. package/scss/common/theme/designer/components/misc/_tag.scss +33 -0
  114. package/scss/common/theme/designer/components/misc/_terminal.scss +11 -0
  115. package/scss/common/theme/designer/components/multimedia/_galleria.scss +141 -0
  116. package/scss/common/theme/designer/components/overlay/_confirmpopup.scss +67 -0
  117. package/scss/common/theme/designer/components/overlay/_dialog.scss +63 -0
  118. package/scss/common/theme/designer/components/overlay/_overlaypanel.scss +62 -0
  119. package/scss/common/theme/designer/components/overlay/_sidebar.scss +27 -0
  120. package/scss/common/theme/designer/components/overlay/_tooltip.scss +33 -0
  121. package/scss/common/theme/designer/components/panel/_accordion.scss +119 -0
  122. package/scss/common/theme/designer/components/panel/_card.scss +30 -0
  123. package/scss/common/theme/designer/components/panel/_divider.scss +31 -0
  124. package/scss/common/theme/designer/components/panel/_fieldset.scss +47 -0
  125. package/scss/common/theme/designer/components/panel/_panel.scss +42 -0
  126. package/scss/common/theme/designer/components/panel/_scrollpanel.scss +6 -0
  127. package/scss/common/theme/designer/components/panel/_splitter.scss +19 -0
  128. package/scss/common/theme/designer/components/panel/_tabview.scss +66 -0
  129. package/scss/common/theme/designer/components/panel/_toolbar.scss +10 -0
  130. package/scss/common/theme/extensions/_button.scss +99 -0
  131. package/scss/common/theme/extensions/_calendar.scss +18 -0
  132. package/scss/common/theme/extensions/_card.scss +6 -0
  133. package/scss/common/theme/extensions/_carousel.scss +13 -0
  134. package/scss/common/theme/extensions/_checkbox.scss +10 -0
  135. package/scss/common/theme/extensions/_contextmenu.scss +16 -0
  136. package/scss/common/theme/extensions/_datatable.scss +83 -0
  137. package/scss/common/theme/extensions/_dialog.scss +14 -0
  138. package/scss/common/theme/extensions/_fieldset.scss +6 -0
  139. package/scss/common/theme/extensions/_galleria.scss +25 -0
  140. package/scss/common/theme/extensions/_megamenu.scss +18 -0
  141. package/scss/common/theme/extensions/_menu.scss +14 -0
  142. package/scss/common/theme/extensions/_menubar.scss +14 -0
  143. package/scss/common/theme/extensions/_orderlist.scss +38 -0
  144. package/scss/common/theme/extensions/_paginator.scss +19 -0
  145. package/scss/common/theme/extensions/_panelmenu.scss +20 -0
  146. package/scss/common/theme/extensions/_password.scss +5 -0
  147. package/scss/common/theme/extensions/_picklist.scss +38 -0
  148. package/scss/common/theme/extensions/_radiobutton.scss +8 -0
  149. package/scss/common/theme/extensions/_sidebar.scss +19 -0
  150. package/scss/common/theme/extensions/_slidemenu.scss +10 -0
  151. package/scss/common/theme/extensions/_slider.scss +6 -0
  152. package/scss/common/theme/extensions/_steps.scss +50 -0
  153. package/scss/common/theme/extensions/_tieredmenu.scss +14 -0
  154. package/scss/common/theme/extensions/_toast.scss +6 -0
  155. package/scss/common/theme/extensions/_tree.scss +36 -0
  156. package/scss/common/theme/extensions/_treetable.scss +35 -0
  157. package/scss/common/theme/extensions/_vendor_extensions.scss +27 -0
  158. package/scss/common/variables/layout/_common.scss +12 -0
  159. package/scss/common/variables/layout/_layout_dark.scss +71 -0
  160. package/scss/common/variables/layout/_layout_light.scss +71 -0
  161. package/scss/common/variables/theme/_theme_dark.scss +897 -0
  162. package/scss/common/variables/theme/_theme_light.scss +885 -0
  163. package/scss/layout/default/_mng-variables-layout-dark.scss +2 -0
  164. package/scss/layout/default/_mng-variables-layout-light.scss +2 -0
  165. package/scss/layout/default/layout-dark.scss +2 -0
  166. package/scss/layout/default/layout-light.scss +2 -0
  167. package/scss/mng-commons-dark.scss +5 -0
  168. package/scss/mng-commons-light.scss +5 -0
  169. package/scss/mng-overrides/_layout_action.scss +3 -0
  170. package/scss/mng-overrides/_layout_dialog.scss +34 -0
  171. package/scss/mng-overrides/_layout_forms.scss +31 -0
  172. package/scss/mng-overrides/_layout_radio.scss +3 -0
  173. package/scss/mng-overrides/_layout_styles.scss +4 -0
  174. package/scss/mng-overrides/_theme_datatable.scss +9 -0
  175. package/scss/mng-overrides/_theme_dialog.scss +9 -0
  176. package/scss/mng-overrides/_theme_dropdown.scss +6 -0
  177. package/scss/mng-overrides/_theme_styles.scss +9 -0
  178. package/scss/mng-overrides/_theme_tableview.scss +94 -0
  179. package/scss/theme/default/_mng-variables-theme-dark.scss +8 -0
  180. package/scss/theme/default/_mng-variables-theme-light.scss +8 -0
  181. package/scss/theme/default/theme-dark.scss +2 -0
  182. package/scss/theme/default/theme-light.scss +2 -0
  183. package/src/lib/api/models/builders/query-param.builder.ts +54 -0
  184. package/src/lib/api/models/filter-match-type.model.ts +25 -0
  185. package/src/lib/api/models/filter-param.model.ts +59 -0
  186. package/{lib/api/models/index.d.ts → src/lib/api/models/index.ts} +10 -8
  187. package/src/lib/api/models/mappers.ts +18 -0
  188. package/{lib/api/models/query-mode.model.d.ts → src/lib/api/models/query-mode.model.ts} +18 -16
  189. package/src/lib/api/models/query-param.model.ts +99 -0
  190. package/src/lib/api/models/query-result.model.ts +77 -0
  191. package/{lib/api/models/serialization.model.d.ts → src/lib/api/models/serialization.model.ts} +9 -8
  192. package/src/lib/api/services/crud-api.abstract.service.ts +113 -0
  193. package/src/lib/api/services/index.ts +1 -0
  194. package/{lib/api/utils/index.d.ts → src/lib/api/utils/index.ts} +2 -2
  195. package/src/lib/api/utils/medius-rest.util.ts +146 -0
  196. package/src/lib/api/utils/object-serializer.util.ts +227 -0
  197. package/src/lib/components/action/action.component.html +30 -0
  198. package/src/lib/components/action/action.component.ts +77 -0
  199. package/src/lib/components/action/dialog/action-dialog.component.html +26 -0
  200. package/src/lib/components/action/dialog/action-dialog.component.ts +171 -0
  201. package/{lib/components/action/index.d.ts → src/lib/components/action/index.ts} +3 -3
  202. package/src/lib/components/action/models/action-confirmation-service.model.ts +7 -0
  203. package/src/lib/components/action/models/action-execution.model.ts +81 -0
  204. package/src/lib/components/action/models/index.ts +2 -0
  205. package/src/lib/components/action/route/action-route.component.html +1 -0
  206. package/src/lib/components/action/route/action-route.component.ts +159 -0
  207. package/src/lib/components/form/autocomplete/autocomplete.component.html +16 -0
  208. package/src/lib/components/form/autocomplete/autocomplete.component.ts +113 -0
  209. package/src/lib/components/form/dropdown/dropdown.component.html +29 -0
  210. package/src/lib/components/form/dropdown/dropdown.component.ts +109 -0
  211. package/src/lib/components/form/editor/form-editor.component.html +5 -0
  212. package/src/lib/components/form/editor/form-editor.component.ts +149 -0
  213. package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.html +7 -0
  214. package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.ts +21 -0
  215. package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.html +9 -0
  216. package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.ts +22 -0
  217. package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.html +8 -0
  218. package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.ts +10 -0
  219. package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.html +56 -0
  220. package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.ts +22 -0
  221. package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.html +13 -0
  222. package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.scss +4 -0
  223. package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.ts +114 -0
  224. package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.html +37 -0
  225. package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.ts +133 -0
  226. package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.html +10 -0
  227. package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.ts +10 -0
  228. package/{lib/components/form/formly/fields/index.d.ts → src/lib/components/form/formly/fields/index.ts} +7 -7
  229. package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.html +7 -0
  230. package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.ts +13 -0
  231. package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.html +6 -0
  232. package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.ts +13 -0
  233. package/{lib/components/form/formly/wrappers/index.d.ts → src/lib/components/form/formly/wrappers/index.ts} +2 -2
  234. package/src/lib/components/form/index.ts +3 -0
  235. package/src/lib/components/form/models/form-editor.event.ts +7 -0
  236. package/src/lib/components/form/models/index.ts +1 -0
  237. package/src/lib/components/layout/breadcrumb.component.html +5 -0
  238. package/src/lib/components/layout/breadcrumb.component.ts +12 -0
  239. package/src/lib/components/layout/footer.component.html +7 -0
  240. package/src/lib/components/layout/footer.component.ts +15 -0
  241. package/src/lib/components/layout/index.ts +6 -0
  242. package/src/lib/components/layout/main-layout.component.html +26 -0
  243. package/src/lib/components/layout/main-layout.component.ts +54 -0
  244. package/src/lib/components/layout/menu-item.component.html +41 -0
  245. package/src/lib/components/layout/menu-item.component.ts +170 -0
  246. package/src/lib/components/layout/menu.component.html +27 -0
  247. package/src/lib/components/layout/menu.component.ts +17 -0
  248. package/src/lib/components/layout/services/index.ts +1 -0
  249. package/src/lib/components/layout/services/main-layout.component.service.ts +231 -0
  250. package/src/lib/components/layout/topbar.component.html +38 -0
  251. package/src/lib/components/layout/topbar.component.ts +62 -0
  252. package/{lib/components/tableview/index.d.ts → src/lib/components/tableview/index.ts} +5 -3
  253. package/src/lib/components/tableview/models/index.ts +1 -0
  254. package/src/lib/components/tableview/models/table.event.ts +22 -0
  255. package/src/lib/components/tableview/route/tableview-route.abstract.component.ts +31 -0
  256. package/src/lib/components/tableview/services/index.ts +1 -0
  257. package/src/lib/components/tableview/services/tableview.component.service.ts +22 -0
  258. package/src/lib/components/tableview/table/column-filter/column-filter.component.html +36 -0
  259. package/src/lib/components/tableview/table/column-filter/column-filter.component.ts +70 -0
  260. package/src/lib/components/tableview/table/column-value/column-value.component.html +14 -0
  261. package/src/lib/components/tableview/table/column-value/column-value.component.ts +19 -0
  262. package/src/lib/components/tableview/table/table.component.html +110 -0
  263. package/src/lib/components/tableview/table/table.component.ts +327 -0
  264. package/src/lib/components/tableview/tableview.component.html +37 -0
  265. package/src/lib/components/tableview/tableview.component.ts +78 -0
  266. package/src/lib/config/formly.config.ts +154 -0
  267. package/{lib/config/index.d.ts → src/lib/config/index.ts} +1 -1
  268. package/{lib/models/config/index.d.ts → src/lib/config/models/index.ts} +1 -1
  269. package/src/lib/config/models/mng-config.model.ts +35 -0
  270. package/src/lib/data-providers/base.data-provider.ts +42 -0
  271. package/src/lib/data-providers/editor.data-provider.ts +60 -0
  272. package/src/lib/data-providers/index.ts +5 -0
  273. package/src/lib/data-providers/lookup.data-provider.ts +29 -0
  274. package/src/lib/data-providers/table.data-provider.ts +8 -0
  275. package/src/lib/data-providers/tableview.data-provider.ts +29 -0
  276. package/src/lib/descriptors/action.descriptor.ts +439 -0
  277. package/src/lib/descriptors/editor.descriptor.ts +880 -0
  278. package/src/lib/descriptors/field.validator.ts +35 -0
  279. package/src/lib/descriptors/index.ts +7 -0
  280. package/src/lib/descriptors/lookup.descriptor.ts +20 -0
  281. package/src/lib/descriptors/model.descriptor.ts +47 -0
  282. package/src/lib/descriptors/table.descriptor.ts +514 -0
  283. package/src/lib/descriptors/tableview.descriptor.ts +180 -0
  284. package/src/lib/directives/component.directive.ts +18 -0
  285. package/src/lib/directives/index.ts +2 -0
  286. package/src/lib/directives/template.directive.ts +24 -0
  287. package/src/lib/mng-commons.module.ts +240 -0
  288. package/src/lib/models/index.ts +2 -0
  289. package/src/lib/models/router.model.ts +16 -0
  290. package/src/lib/models/user.model.ts +9 -0
  291. package/src/lib/pipes/boolean.pipe.ts +17 -0
  292. package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +2 -1
  293. package/src/lib/pipes/property-path.pipe.ts +30 -0
  294. package/src/lib/services/action.service.ts +310 -0
  295. package/src/lib/services/commons.service.ts +407 -0
  296. package/src/lib/services/configuration.service.ts +98 -0
  297. package/{lib/services/index.d.ts → src/lib/services/index.ts} +4 -6
  298. package/src/lib/services/navigation.service.ts +42 -0
  299. package/src/lib/services/providers/commons-init.provider.ts +5 -0
  300. package/src/lib/services/providers/config-service.provider.ts +22 -0
  301. package/src/lib/services/providers/formly-config.provider.ts +39 -0
  302. package/{lib/services/providers/index.d.ts → src/lib/services/providers/index.ts} +3 -2
  303. package/src/lib/services/tokens/browser-storage.token.ts +9 -0
  304. package/src/lib/services/tokens/index.ts +2 -0
  305. package/src/lib/services/tokens/module-config.token.ts +5 -0
  306. package/{lib/models/types/index.d.ts → src/lib/types/index.ts} +2 -2
  307. package/src/lib/types/type.decorator.ts +7 -0
  308. package/src/lib/types/type.model.ts +12 -0
  309. package/src/lib/utils/editor-formly.util.ts +193 -0
  310. package/src/lib/utils/i18n.util.ts +148 -0
  311. package/{lib/utils/index.d.ts → src/lib/utils/index.ts} +5 -4
  312. package/src/lib/utils/model.util.ts +66 -0
  313. package/src/lib/utils/toast.util.ts +49 -0
  314. package/src/lib/utils/type.util.ts +44 -0
  315. package/{public-api.d.ts → src/public-api.ts} +42 -22
  316. package/src/test.ts +26 -0
  317. package/tsconfig.lib.json +15 -0
  318. package/tsconfig.lib.prod.json +10 -0
  319. package/tsconfig.spec.json +17 -0
  320. package/esm2020/lib/api/models/builders/query-param.builder.mjs +0 -49
  321. package/esm2020/lib/api/models/filter-match-type.model.mjs +0 -24
  322. package/esm2020/lib/api/models/filter-param.model.mjs +0 -46
  323. package/esm2020/lib/api/models/index.mjs +0 -9
  324. package/esm2020/lib/api/models/mappers.mjs +0 -17
  325. package/esm2020/lib/api/models/query-mode.model.mjs +0 -19
  326. package/esm2020/lib/api/models/query-param.model.mjs +0 -69
  327. package/esm2020/lib/api/models/query-result.model.mjs +0 -45
  328. package/esm2020/lib/api/models/serialization.model.mjs +0 -2
  329. package/esm2020/lib/api/services/abstract-crud-api.service.mjs +0 -72
  330. package/esm2020/lib/api/services/index.mjs +0 -2
  331. package/esm2020/lib/api/utils/index.mjs +0 -3
  332. package/esm2020/lib/api/utils/medius-rest.util.mjs +0 -70
  333. package/esm2020/lib/api/utils/object-serializer.util.mjs +0 -226
  334. package/esm2020/lib/components/action/action.component.mjs +0 -63
  335. package/esm2020/lib/components/action/dialog/action-dialog.component.mjs +0 -148
  336. package/esm2020/lib/components/action/index.mjs +0 -4
  337. package/esm2020/lib/components/action/route/action-route.component.mjs +0 -144
  338. package/esm2020/lib/components/form/editor/form-editor.component.mjs +0 -140
  339. package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +0 -58
  340. package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +0 -51
  341. package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +0 -16
  342. package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +0 -26
  343. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +0 -94
  344. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +0 -124
  345. package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +0 -17
  346. package/esm2020/lib/components/form/formly/fields/index.mjs +0 -8
  347. package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +0 -17
  348. package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +0 -16
  349. package/esm2020/lib/components/form/formly/wrappers/index.mjs +0 -3
  350. package/esm2020/lib/components/form/index.mjs +0 -2
  351. package/esm2020/lib/components/layout/app.breadcrumb.component.mjs +0 -27
  352. package/esm2020/lib/components/layout/app.footer.component.mjs +0 -35
  353. package/esm2020/lib/components/layout/app.main.component.mjs +0 -25
  354. package/esm2020/lib/components/layout/app.main.component.service.mjs +0 -133
  355. package/esm2020/lib/components/layout/app.menu.component.mjs +0 -38
  356. package/esm2020/lib/components/layout/app.menuitem.component.mjs +0 -243
  357. package/esm2020/lib/components/layout/app.topbar.component.mjs +0 -135
  358. package/esm2020/lib/components/layout/index.mjs +0 -7
  359. package/esm2020/lib/components/tableview/index.mjs +0 -4
  360. package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +0 -31
  361. package/esm2020/lib/components/tableview/table/table.component.mjs +0 -173
  362. package/esm2020/lib/components/tableview/tableview.component.mjs +0 -82
  363. package/esm2020/lib/components/tableview/tableview.component.service.mjs +0 -18
  364. package/esm2020/lib/config/formly.config.mjs +0 -165
  365. package/esm2020/lib/config/index.mjs +0 -2
  366. package/esm2020/lib/directives/index.mjs +0 -2
  367. package/esm2020/lib/directives/template.directive.mjs +0 -25
  368. package/esm2020/lib/mng-commons.module.mjs +0 -338
  369. package/esm2020/lib/models/action/action.model.mjs +0 -58
  370. package/esm2020/lib/models/action/index.mjs +0 -2
  371. package/esm2020/lib/models/config/index.mjs +0 -2
  372. package/esm2020/lib/models/config/mng-config.model.mjs +0 -3
  373. package/esm2020/lib/models/descriptors/action-descriptor.model.mjs +0 -283
  374. package/esm2020/lib/models/descriptors/editor-descriptor.model.mjs +0 -647
  375. package/esm2020/lib/models/descriptors/index.mjs +0 -6
  376. package/esm2020/lib/models/descriptors/model-descriptor.model.mjs +0 -34
  377. package/esm2020/lib/models/descriptors/table-descriptor.model.mjs +0 -123
  378. package/esm2020/lib/models/descriptors/tableview-descriptor.model.mjs +0 -124
  379. package/esm2020/lib/models/events/editor-event.model.mjs +0 -14
  380. package/esm2020/lib/models/events/index.mjs +0 -3
  381. package/esm2020/lib/models/events/table-event.model.mjs +0 -16
  382. package/esm2020/lib/models/interfaces/confirmation-service.model.mjs +0 -2
  383. package/esm2020/lib/models/interfaces/index.mjs +0 -2
  384. package/esm2020/lib/models/providers/data-provider.model.mjs +0 -86
  385. package/esm2020/lib/models/providers/index.mjs +0 -2
  386. package/esm2020/lib/models/types/index.mjs +0 -3
  387. package/esm2020/lib/models/types/type.decorator.mjs +0 -8
  388. package/esm2020/lib/models/types/type.model.mjs +0 -2
  389. package/esm2020/lib/models/validators/field.validator.mjs +0 -21
  390. package/esm2020/lib/models/validators/index.mjs +0 -2
  391. package/esm2020/lib/pipes/index.mjs +0 -2
  392. package/esm2020/lib/pipes/property-path.pipe.mjs +0 -36
  393. package/esm2020/lib/services/action.service.mjs +0 -239
  394. package/esm2020/lib/services/breadcrumb.service.mjs +0 -21
  395. package/esm2020/lib/services/configuration.service.mjs +0 -77
  396. package/esm2020/lib/services/index.mjs +0 -7
  397. package/esm2020/lib/services/menu.service.mjs +0 -26
  398. package/esm2020/lib/services/navigation.service.mjs +0 -49
  399. package/esm2020/lib/services/providers/config-service.provider.mjs +0 -12
  400. package/esm2020/lib/services/providers/formly-config.provider.mjs +0 -31
  401. package/esm2020/lib/services/providers/index.mjs +0 -3
  402. package/esm2020/lib/services/settings.service.mjs +0 -40
  403. package/esm2020/lib/utils/editor-formly.util.mjs +0 -165
  404. package/esm2020/lib/utils/i18n.util.mjs +0 -75
  405. package/esm2020/lib/utils/index.mjs +0 -5
  406. package/esm2020/lib/utils/model.util.mjs +0 -38
  407. package/esm2020/lib/utils/type.util.mjs +0 -43
  408. package/esm2020/mediusinc-mng-commons.mjs +0 -5
  409. package/esm2020/public-api.mjs +0 -33
  410. package/fesm2015/mediusinc-mng-commons.mjs +0 -5056
  411. package/fesm2015/mediusinc-mng-commons.mjs.map +0 -1
  412. package/fesm2020/mediusinc-mng-commons.mjs +0 -5012
  413. package/fesm2020/mediusinc-mng-commons.mjs.map +0 -1
  414. package/lib/api/models/builders/query-param.builder.d.ts +0 -11
  415. package/lib/api/models/filter-match-type.model.d.ts +0 -21
  416. package/lib/api/models/filter-param.model.d.ts +0 -23
  417. package/lib/api/models/mappers.d.ts +0 -6
  418. package/lib/api/models/query-param.model.d.ts +0 -31
  419. package/lib/api/models/query-result.model.d.ts +0 -36
  420. package/lib/api/services/abstract-crud-api.service.d.ts +0 -23
  421. package/lib/api/services/index.d.ts +0 -1
  422. package/lib/api/utils/medius-rest.util.d.ts +0 -6
  423. package/lib/api/utils/object-serializer.util.d.ts +0 -30
  424. package/lib/components/action/action.component.d.ts +0 -36
  425. package/lib/components/action/dialog/action-dialog.component.d.ts +0 -48
  426. package/lib/components/action/route/action-route.component.d.ts +0 -32
  427. package/lib/components/form/editor/form-editor.component.d.ts +0 -37
  428. package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +0 -21
  429. package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +0 -19
  430. package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +0 -6
  431. package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +0 -12
  432. package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -17
  433. package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +0 -36
  434. package/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +0 -6
  435. package/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +0 -8
  436. package/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.d.ts +0 -8
  437. package/lib/components/form/index.d.ts +0 -1
  438. package/lib/components/layout/app.breadcrumb.component.d.ts +0 -16
  439. package/lib/components/layout/app.footer.component.d.ts +0 -8
  440. package/lib/components/layout/app.main.component.d.ts +0 -12
  441. package/lib/components/layout/app.main.component.service.d.ts +0 -40
  442. package/lib/components/layout/app.menu.component.d.ts +0 -14
  443. package/lib/components/layout/app.menuitem.component.d.ts +0 -31
  444. package/lib/components/layout/app.topbar.component.d.ts +0 -16
  445. package/lib/components/layout/index.d.ts +0 -6
  446. package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +0 -15
  447. package/lib/components/tableview/table/table.component.d.ts +0 -47
  448. package/lib/components/tableview/tableview.component.d.ts +0 -36
  449. package/lib/components/tableview/tableview.component.service.d.ts +0 -11
  450. package/lib/config/formly.config.d.ts +0 -8
  451. package/lib/directives/index.d.ts +0 -1
  452. package/lib/directives/template.directive.d.ts +0 -11
  453. package/lib/mng-commons.module.d.ts +0 -74
  454. package/lib/models/action/action.model.d.ts +0 -53
  455. package/lib/models/action/index.d.ts +0 -1
  456. package/lib/models/config/mng-config.model.d.ts +0 -19
  457. package/lib/models/descriptors/action-descriptor.model.d.ts +0 -124
  458. package/lib/models/descriptors/editor-descriptor.model.d.ts +0 -248
  459. package/lib/models/descriptors/index.d.ts +0 -5
  460. package/lib/models/descriptors/model-descriptor.model.d.ts +0 -15
  461. package/lib/models/descriptors/table-descriptor.model.d.ts +0 -45
  462. package/lib/models/descriptors/tableview-descriptor.model.d.ts +0 -38
  463. package/lib/models/events/editor-event.model.d.ts +0 -11
  464. package/lib/models/events/index.d.ts +0 -2
  465. package/lib/models/events/table-event.model.d.ts +0 -17
  466. package/lib/models/interfaces/confirmation-service.model.d.ts +0 -6
  467. package/lib/models/interfaces/index.d.ts +0 -1
  468. package/lib/models/providers/data-provider.model.d.ts +0 -62
  469. package/lib/models/providers/index.d.ts +0 -1
  470. package/lib/models/types/type.decorator.d.ts +0 -2
  471. package/lib/models/types/type.model.d.ts +0 -10
  472. package/lib/models/validators/field.validator.d.ts +0 -18
  473. package/lib/models/validators/index.d.ts +0 -1
  474. package/lib/pipes/property-path.pipe.d.ts +0 -7
  475. package/lib/services/action.service.d.ts +0 -92
  476. package/lib/services/breadcrumb.service.d.ts +0 -9
  477. package/lib/services/configuration.service.d.ts +0 -35
  478. package/lib/services/menu.service.d.ts +0 -11
  479. package/lib/services/navigation.service.d.ts +0 -14
  480. package/lib/services/providers/config-service.provider.d.ts +0 -5
  481. package/lib/services/providers/formly-config.provider.d.ts +0 -4
  482. package/lib/services/settings.service.d.ts +0 -18
  483. package/lib/utils/editor-formly.util.d.ts +0 -9
  484. package/lib/utils/i18n.util.d.ts +0 -14
  485. package/lib/utils/model.util.d.ts +0 -5
  486. package/lib/utils/type.util.d.ts +0 -15
  487. package/mediusinc-mng-commons-0.0.1-rc.3.tgz +0 -0
  488. package/mediusinc-mng-commons.d.ts +0 -5
@@ -0,0 +1,171 @@
1
+ import {ChangeDetectionStrategy, Component, ContentChildren, ElementRef, EventEmitter, Injector, Input, OnDestroy, OnInit, Output, QueryList, ViewChild} from '@angular/core';
2
+
3
+ import {TranslateService} from '@ngx-translate/core';
4
+ import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
5
+ import {Observable, of, ReplaySubject, Subscription} from 'rxjs';
6
+ import {catchError, finalize, first, mergeMap} from 'rxjs/operators';
7
+
8
+ import {ActionData, ActionError, ActionRunResult} from '../models';
9
+ import {ActionDescriptor, ActionEditorDescriptor} from '../../../descriptors';
10
+ import {IdType} from '../../../types';
11
+ import {IEditorDataProvider} from '../../../data-providers';
12
+ import {MngFormEditorSubmitEvent} from '../../form/models';
13
+ import {MngActionService, MngCommonsService} from '../../../services';
14
+ import {MngTemplateDirective} from '../../../directives';
15
+ import {MngFormEditorComponent} from '../../form';
16
+ import {I18nUtil, ToastUtil} from '../../../utils';
17
+ import {TableviewComponentService} from '../../tableview/services';
18
+
19
+ @Component({
20
+ selector: 'mng-action-dialog',
21
+ templateUrl: './action-dialog.component.html',
22
+ changeDetection: ChangeDetectionStrategy.OnPush
23
+ })
24
+ export class MngActionDialogComponent<T, S> implements OnInit, OnDestroy {
25
+
26
+ // metadata and editor mode input
27
+ @Input() public action!: ActionEditorDescriptor<T>;
28
+
29
+ // data source inputs
30
+ @Input() public itemId?: IdType;
31
+ @Input() public item?: T;
32
+ @Input() public actionData?: ActionData;
33
+ @Input() public dataProvider?: IEditorDataProvider<T, S>;
34
+
35
+ // content and view queries
36
+ @ContentChildren(MngTemplateDirective) templates!: QueryList<MngTemplateDirective>;
37
+
38
+ @ViewChild('submitButton') private submitButtonElementRef!: ElementRef;
39
+ @ViewChild(MngFormEditorComponent) private editorComponent!: MngFormEditorComponent<T>;
40
+
41
+ public cmpId: string = Math.random().toString(36).substring(2);
42
+
43
+ private loadingSubject = new ReplaySubject<boolean>(1);
44
+ private submitLoadingSubject = new ReplaySubject<boolean>(1);
45
+ public loading$: Observable<boolean> = this.loadingSubject.asObservable();
46
+ public submitLoading$: Observable<boolean> = this.submitLoadingSubject.asObservable();
47
+ public isSaveButton = true;
48
+
49
+ private tableviewService?: TableviewComponentService<T, S>;
50
+ private sourceComponent: any = this;
51
+ private subscriptions: Array<Subscription> = [];
52
+
53
+ constructor(
54
+ private injector: Injector,
55
+ private translate: TranslateService,
56
+ public dialogRef: DynamicDialogRef,
57
+ public dialogConfig: DynamicDialogConfig,
58
+ private actionService: MngActionService,
59
+ // private mngCommonsService: MngCommonsService
60
+ ) {
61
+ }
62
+
63
+ public ngOnInit() {
64
+
65
+ if (this.dialogConfig.data) {
66
+ if (this.dialogConfig.data.action) {
67
+ this.action = this.dialogConfig.data.action;
68
+ }
69
+ if (this.dialogConfig.data.item) {
70
+ this.item = this.dialogConfig.data.item;
71
+ }
72
+ if (this.dialogConfig.data.itemId) {
73
+ this.itemId = this.dialogConfig.data.itemId;
74
+ }
75
+ if (this.dialogConfig.data.actionData) {
76
+ this.actionData = this.dialogConfig.data.actionData;
77
+ }
78
+ if (this.dialogConfig.data.tableview) {
79
+ this.tableviewService = this.dialogConfig.data.tableview;
80
+ if (!this.dataProvider && this.tableviewService?.dataProvider) {
81
+ this.dataProvider = this.tableviewService.dataProvider;
82
+ }
83
+ }
84
+ if (this.dialogConfig.data.sourceComponent) {
85
+ this.sourceComponent = this.dialogConfig.data.sourceComponent;
86
+ }
87
+ }
88
+
89
+ this.isSaveButton = typeof this.action.submitFunction === 'function';
90
+ this.setDialogHeaderTitle();
91
+
92
+ this.loadItemWithDataProvider();
93
+ }
94
+
95
+ public ngOnDestroy() {
96
+ this.subscriptions.forEach(s => s.unsubscribe());
97
+ }
98
+
99
+ public onSubmit(event: MngFormEditorSubmitEvent<T>) {
100
+ if (event.success) {
101
+ if (typeof this.action.submitFunction !== 'function') {
102
+ return;
103
+ }
104
+ this.submitLoadingSubject.next(true);
105
+ this.actionService.runEditorSave(this.action, this.itemId, event.formItem, this.dataProvider, this.sourceComponent, this.tableviewService, this.actionData)
106
+ .pipe(
107
+ first(),
108
+ finalize(() => this.submitLoadingSubject.next(false))
109
+ )
110
+ .subscribe(res => {
111
+ this.closeDialog(res);
112
+ });
113
+ }
114
+ }
115
+
116
+ public closeDialog(result?: ActionRunResult<T, any, any>) {
117
+ this.dialogRef.close(result ? result : new ActionRunResult(undefined, undefined, new ActionError(null, true)));
118
+ }
119
+
120
+ public saveItem() {
121
+ this.editorComponent.submit();
122
+ }
123
+
124
+ private loadItemWithDataProvider() {
125
+ if (typeof this.action.fetchFunction !== 'function') {
126
+ return;
127
+ }
128
+ this.loadingSubject.next(true);
129
+ this.actionService.runEditorFetch(this.action, this.itemId, this.dataProvider, this.sourceComponent, this.tableviewService)
130
+ .pipe(
131
+ first(),
132
+ catchError(err => {
133
+ if (this.action.hasRunNotificationError) {
134
+ ToastUtil.actionNotificationError(this.translate, this.action, err, 'fetch', this.tableviewService, this.item);
135
+ }
136
+ throw err;
137
+ }),
138
+ finalize(() => this.loadingSubject.next(false))
139
+ )
140
+ .subscribe(res => {
141
+ this.item = res.result;
142
+ if (this.action.hasFetchNotificationSuccess) {
143
+ ToastUtil.actionNotificationSuccess(this.translate, this.action, 'fetch', this.action.fetchNotificationSuccessTitle,
144
+ this.action.fetchNotificationSuccessMessage,this.tableviewService, this.item);
145
+ }
146
+ this.setDialogHeaderTitle();
147
+ });
148
+ }
149
+
150
+ private setDialogHeaderTitle() {
151
+ if (this.action.editorTitle === null) {
152
+ requestAnimationFrame(() => {
153
+ this.dialogConfig.header = undefined;
154
+ });
155
+ return;
156
+ }
157
+ const subscription = I18nUtil.streamActionTranslation(this.translate, this.action as ActionDescriptor<T>, 'dialog.title', undefined, this.item)
158
+ .pipe(
159
+ mergeMap(i18nDialogTitle => i18nDialogTitle === null
160
+ ? I18nUtil.getActionTranslation(this.translate, this.action as ActionDescriptor<T>, 'title', this.action.editorTitle, this.item)
161
+ : of(i18nDialogTitle))
162
+ )
163
+ .subscribe(t => {
164
+ requestAnimationFrame(() => {
165
+ this.dialogConfig.header = t ?? undefined;
166
+ // this.mngCommonsService.setPageTitle(t ?? undefined);
167
+ });
168
+ });
169
+ this.subscriptions.push(subscription);
170
+ }
171
+ }
@@ -1,3 +1,3 @@
1
- export * from './action.component';
2
- export * from './route/action-route.component';
3
- export * from './dialog/action-dialog.component';
1
+ export * from './action.component';
2
+ export * from './route/action-route.component';
3
+ export * from './dialog/action-dialog.component';
@@ -0,0 +1,7 @@
1
+ import {ConfirmationService} from 'primeng/api';
2
+ import {ActionDescriptor} from '../../../descriptors';
3
+
4
+ export interface IActionConfirmationService {
5
+ getConfirmationService(): ConfirmationService;
6
+ getConfirmationServiceInstanceKey(action: ActionDescriptor<any>): string;
7
+ }
@@ -0,0 +1,81 @@
1
+ import {DynamicDialogRef} from 'primeng/dynamicdialog';
2
+ import {Observable} from 'rxjs';
3
+
4
+ import {IdType} from '../../../types';
5
+ import {IDataProvider} from '../../../data-providers';
6
+ import {TableviewComponentService} from '../../tableview/services';
7
+
8
+ export class ActionExecContext<T, S, DP extends IDataProvider<T, S>> {
9
+ constructor(
10
+ public readonly dataProvider?: DP,
11
+ public readonly serviceInstance?: S,
12
+ public readonly data?: {
13
+ item?: T;
14
+ itemId?: IdType;
15
+ actionData?: ActionData;
16
+ },
17
+ public readonly sourceComponent: any = null,
18
+ public readonly tableview: TableviewComponentService<T, S>|null = null
19
+ ) {}
20
+ }
21
+
22
+ export class ActionError {
23
+ constructor(
24
+ public readonly error: any, // error details
25
+ public readonly dismissed: boolean = false // by user
26
+ ) {}
27
+ }
28
+
29
+ export class ActionRunResult<T, S, DP extends IDataProvider<T, S>> {
30
+ constructor(
31
+ public readonly context?: ActionExecContext<T, S, DP>,
32
+ public readonly result?: T,
33
+ public readonly error?: ActionError
34
+ ) {}
35
+ }
36
+
37
+ export class ActionActivationResult<T, S, DP extends IDataProvider<T, S>> {
38
+ constructor(
39
+ public readonly runResult?: ActionRunResult<T, S, DP>,
40
+ public readonly dialogRef?: DynamicDialogRef
41
+ ) {}
42
+
43
+ public get runContext() {
44
+ return this.runResult ? this.runResult.context : null;
45
+ }
46
+
47
+ public get result() {
48
+ return this.runResult ? this.runResult.result : null;
49
+ }
50
+
51
+ public get error() {
52
+ return this.runResult ? this.runResult.error : null;
53
+ }
54
+ }
55
+
56
+ export class ActionTriggerResult<T, S, DP extends IDataProvider<T, S>> {
57
+ constructor(
58
+ public readonly activationResult?: ActionActivationResult<T, S, DP>,
59
+ public readonly routerNavigation?: Observable<boolean>
60
+ ) {}
61
+
62
+ public get runContext() {
63
+ return this.activationResult ? this.activationResult.runResult : null;
64
+ }
65
+
66
+ public get result() {
67
+ return this.activationResult ? this.activationResult.result : null;
68
+ }
69
+
70
+ public get error() {
71
+ return this.activationResult ? this.activationResult.error : null;
72
+ }
73
+
74
+ public get dialogRef() {
75
+ return this.activationResult ? this.activationResult.dialogRef : null;
76
+ }
77
+ }
78
+
79
+ export type ActionData = {
80
+ [key: string]: any;
81
+ };
@@ -0,0 +1,2 @@
1
+ export * from './action-confirmation-service.model';
2
+ export * from './action-execution.model';
@@ -0,0 +1 @@
1
+ <p-confirmDialog [key]="'actionRoute_' + cmpId" [baseZIndex]="50" appendTo="body"></p-confirmDialog>
@@ -0,0 +1,159 @@
1
+ import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core';
2
+ import {ActivatedRoute, Params, Router} from '@angular/router';
3
+
4
+ import {ConfirmationService, MessageService} from 'primeng/api';
5
+ import {DynamicDialogRef} from 'primeng/dynamicdialog';
6
+ import {Subscription} from 'rxjs';
7
+ import {first} from 'rxjs/operators';
8
+
9
+ import {ActionDescriptor, ActionActivationTriggerEnum} from '../../../descriptors';
10
+ import {IActionConfirmationService, ActionData, ActionRunResult} from '../models';
11
+ import {MngActionService, MngNavigationService} from '../../../services';
12
+ import {TableviewComponentService} from '../../tableview/services';
13
+
14
+ @Component({
15
+ selector: 'mng-action-route',
16
+ templateUrl: './action-route.component.html',
17
+ changeDetection: ChangeDetectionStrategy.OnPush,
18
+ providers: [MessageService, ConfirmationService]
19
+ })
20
+ export class MngActionRouteComponent<T, S> implements OnInit, OnDestroy, IActionConfirmationService {
21
+
22
+ private actions: Array<ActionDescriptor<T>> = [];
23
+ private activeAction?: ActionDescriptor<T>;
24
+
25
+ private dialogRef?: DynamicDialogRef;
26
+ private dialogCloseSubscription?: Subscription;
27
+
28
+ private subscriptions: Array<Subscription> = [];
29
+
30
+ public cmpId: string = Math.random().toString(36).substring(2);
31
+
32
+ constructor(
33
+ private router: Router,
34
+ private route: ActivatedRoute,
35
+ private confirmationService: ConfirmationService,
36
+ private navigationService: MngNavigationService,
37
+ private actionService: MngActionService,
38
+ private tableviewService: TableviewComponentService<T, S>
39
+ ) {}
40
+
41
+ public ngOnInit() {
42
+
43
+ this.actions = this.tableviewService?.actions.filter(a => a.activationTrigger === ActionActivationTriggerEnum.OnRoute) ?? [];
44
+ const subscription = this.route.params.subscribe(p => {
45
+ const action = this.findActiveAction(p);
46
+ if (action) {
47
+ this.activateAction(action, p, this.route.snapshot.queryParams);
48
+ }
49
+ });
50
+ this.subscriptions.push(subscription);
51
+ }
52
+
53
+ public ngOnDestroy() {
54
+ this.subscriptions.forEach(s => s.unsubscribe());
55
+ if (this.dialogRef) {
56
+ this.dialogRef.close();
57
+ }
58
+ }
59
+
60
+ public getConfirmationService() {
61
+ return this.confirmationService;
62
+ }
63
+
64
+ public getConfirmationServiceInstanceKey(action: ActionDescriptor<any>) {
65
+ return `actionRoute_${this.cmpId}`;
66
+ }
67
+
68
+ private activateAction(action: ActionDescriptor<T>, p: Params, qp: Params) {
69
+ this.activeAction = action;
70
+ const itemId = p['itemId'];
71
+ const actionData: ActionData = {};
72
+ for (let key in p) {
73
+ if (key === 'itemId') {
74
+ continue;
75
+ }
76
+ actionData[key] = p[key];
77
+ }
78
+ for (let key in qp) {
79
+ actionData[key] = p[key];
80
+ }
81
+ this.actionService.activateAction(action, itemId, undefined, actionData, this.tableviewService, this)
82
+ .pipe(first())
83
+ .subscribe(res => {
84
+ if (res.dialogRef) {
85
+ this.dialogRef = res.dialogRef;
86
+ this.dialogCloseSubscription = this.dialogRef?.onClose.subscribe(e => {
87
+ const actionEv = e as ActionRunResult<T, S, any>;
88
+ if (!actionEv?.error || !actionEv?.error?.dismissed) {
89
+ this.tableviewService.reloadTable(); // reload only if no error in action and
90
+ }
91
+ this.deactivateAction();
92
+ });
93
+ }
94
+ });
95
+ }
96
+
97
+ private deactivateAction() {
98
+ if (this.dialogCloseSubscription) {
99
+ this.dialogCloseSubscription.unsubscribe();
100
+ this.dialogCloseSubscription = undefined;
101
+ }
102
+ if (this.navigationService.getPreviousLocation()) {
103
+ // there are internal history records, so back can be normally called
104
+ this.navigationService.back();
105
+ } else {
106
+ // there is no internal history records, figure out the base url by eliminating action specific url
107
+ let url = this.navigationService.getCurrentLocation();
108
+ if (!url) {
109
+ this.navigationService.back();
110
+ } else {
111
+ if (url.startsWith('/')) {
112
+ url = url.substring(1);
113
+ }
114
+ const urlPathSegments = url.split('?')[0].split('#')[0].split('/');
115
+ let actionUrl = this.activeAction?.routeUrl ?? '';
116
+ if (actionUrl.startsWith('/')) {
117
+ actionUrl = actionUrl.substring(1);
118
+ }
119
+ const actionUrlSegments = actionUrl.split('/');
120
+ const redirectUrl = urlPathSegments.slice(0, urlPathSegments.length - actionUrlSegments.length).join('/');
121
+ this.router.navigateByUrl(`/${redirectUrl}`, { replaceUrl: true });
122
+ }
123
+ }
124
+ this.activeAction = undefined;
125
+ this.dialogRef = undefined;
126
+ }
127
+
128
+ private findActiveAction(params: Params): ActionDescriptor<T>|null {
129
+ const urlSegments = this.route.snapshot.url;
130
+ for (const action of this.actions) {
131
+ let actionUrl = action.routeUrl ?? '';
132
+ // TODO: dont strip '/', but use it accordingly with Angular's router patterns (/, ./, ../)
133
+ if (actionUrl.startsWith('/')) {
134
+ actionUrl = actionUrl.substring(1);
135
+ }
136
+ const actionUrlSegments = actionUrl.split('/');
137
+ if (actionUrlSegments.length !== urlSegments.length) {
138
+ continue;
139
+ }
140
+ let isMatch = true;
141
+ for (let i = 0; i < actionUrlSegments.length; i++) {
142
+ if (actionUrlSegments[i].startsWith(':')) {
143
+ const paramName = actionUrlSegments[i].substring(1);
144
+ if (!params[paramName]) {
145
+ isMatch = false;
146
+ break;
147
+ }
148
+ } else if (actionUrlSegments[i] !== urlSegments[i].path) {
149
+ isMatch = false;
150
+ break;
151
+ }
152
+ }
153
+ if (isMatch) {
154
+ return action;
155
+ }
156
+ }
157
+ return null;
158
+ }
159
+ }
@@ -0,0 +1,16 @@
1
+ <p-autoComplete [formControl]="autocompleteFormControl"
2
+ [placeholder]="$any(placeholder)"
3
+ [dropdown]="true"
4
+ [dataKey]="$any(dataKeyProperty)"
5
+ [field]="$any(itemsLabelProperty)"
6
+ [suggestions]="(suggestions$ | async) ?? []"
7
+ [multiple]="multiselect"
8
+ [showEmptyMessage]="true"
9
+ [emptyMessage]="'mngAutcomplete.noMatches' | translate"
10
+ [styleClass]="$any(className)"
11
+ [panelStyleClass]="$any(dropdownClassName)"
12
+ (completeMethod)="onSearch($event)"
13
+ (onSelect)="onSelect($event)"
14
+ appendTo="body"
15
+ dropdownMode="current">
16
+ </p-autoComplete>
@@ -0,0 +1,113 @@
1
+ import {ChangeDetectionStrategy, Component, EventEmitter, ExistingProvider, forwardRef, Injector, Input, OnInit, Output, ViewChild} from '@angular/core';
2
+ import {ControlValueAccessor, FormControl, NG_VALUE_ACCESSOR} from '@angular/forms';
3
+
4
+ import {Observable, Subject, Subscription} from 'rxjs';
5
+ import {finalize, first} from 'rxjs/operators';
6
+ import {AutoComplete} from 'primeng/autocomplete';
7
+
8
+ import {MediusFilterMatchType, MediusQueryParamBuilder} from '../../../api/models';
9
+ import {ILookupDataProvider} from '../../../data-providers';
10
+
11
+ export const MNG_AUTOCOMPLETE_VALUE_ACCESSOR: ExistingProvider = {
12
+ provide: NG_VALUE_ACCESSOR,
13
+ useExisting: forwardRef(() => MngAutocompleteComponent),
14
+ multi: true
15
+ };
16
+
17
+ @Component({
18
+ selector: 'mng-autocomplete',
19
+ templateUrl: './autocomplete.component.html',
20
+ providers: [MNG_AUTOCOMPLETE_VALUE_ACCESSOR],
21
+ changeDetection: ChangeDetectionStrategy.OnPush
22
+ })
23
+ export class MngAutocompleteComponent implements OnInit, ControlValueAccessor {
24
+
25
+ @Input() dataProvider?: ILookupDataProvider<any, any>;
26
+ @Input() dataKeyProperty?: string;
27
+ @Input() itemsLabelProperty?: string;
28
+ @Input() multiselect: boolean = false;
29
+ @Input() placeholder?: string;
30
+ @Input() className: string|null = null;
31
+ @Input() dropdownClassName: string|null = null;
32
+
33
+ @Output() onChange = new EventEmitter();
34
+
35
+ @ViewChild(AutoComplete) private primeAutocomplete?: AutoComplete;
36
+
37
+ private suggestionsSubject: Subject<Array<any>> = new Subject<Array<any>>();
38
+ private searchSubscription: Subscription|null = null;
39
+ private dataProviderService: any = null;
40
+ private onChangeFn: any = () => { };
41
+ private onTouchedFn: any = () => { };
42
+
43
+ public autocompleteFormControl: FormControl = new FormControl();
44
+ public suggestions$: Observable<Array<any>> = this.suggestionsSubject.asObservable();
45
+ public isLoading = false;
46
+
47
+ constructor(private injector: Injector) {
48
+ }
49
+
50
+ ngOnInit() {
51
+ if (this.dataProvider) {
52
+ this.dataProviderService = this.dataProvider.serviceType
53
+ ? this.injector.get<any>(this.dataProvider.serviceType)
54
+ : null;
55
+ } else {
56
+ console.warn(`Data provider should be provided for MngAutocompleteComponent.`);
57
+ }
58
+ }
59
+
60
+ onSearch(event: any) {
61
+ if (this.searchSubscription) {
62
+ // try to cancel existing HTTP request subscription
63
+ this.searchSubscription.unsubscribe();
64
+ }
65
+
66
+ if (this.dataProvider) {
67
+ this.isLoading = true;
68
+ const queryParamBuilder = MediusQueryParamBuilder.create();
69
+ if (this.itemsLabelProperty) {
70
+ queryParamBuilder.withSort(this.itemsLabelProperty);
71
+ }
72
+ if (event.query && event.query.length > 0 && this.itemsLabelProperty) {
73
+ queryParamBuilder.withFilter(this.itemsLabelProperty, event.query, undefined, MediusFilterMatchType.StartsWith)
74
+ }
75
+ this.searchSubscription = this.dataProvider.lookup(queryParamBuilder.build(), this.dataProviderService, event.query)
76
+ .pipe(
77
+ first(),
78
+ finalize(() => this.isLoading = false)
79
+ )
80
+ .subscribe((res: any) => {
81
+ this.suggestionsSubject.next(res);
82
+ });
83
+ }
84
+ }
85
+
86
+ onSelect(value: any) {
87
+ this.onChangeFn(value);
88
+ this.onChange.next(value);
89
+ }
90
+
91
+ registerOnChange(fn: any): void {
92
+ this.onChangeFn = fn;
93
+ }
94
+
95
+ registerOnTouched(fn: any): void {
96
+ this.onTouchedFn = fn;
97
+ }
98
+
99
+ setDisabledState(isDisabled: boolean): void {
100
+ if (isDisabled) {
101
+ this.autocompleteFormControl.disable();
102
+ } else {
103
+ this.autocompleteFormControl.enable();
104
+ }
105
+ }
106
+
107
+ writeValue(obj: any): void {
108
+ this.autocompleteFormControl.setValue(obj, { emitEvent: false });
109
+ if (this.primeAutocomplete) {
110
+ this.primeAutocomplete.writeValue(obj);
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,29 @@
1
+ <p-dropdown *ngIf="!multiselect; else pMultiselect"
2
+ [formControl]="dropdownFormControl"
3
+ [placeholder]="$any(placeholder)"
4
+ [dataKey]="$any(dataKeyProperty)"
5
+ [optionLabel]="$any(itemsLabelProperty)"
6
+ [optionValue]="$any(itemsValueProperty)"
7
+ [options]="(items$ | async) ?? []"
8
+ [showClear]="showClear"
9
+ [autoDisplayFirst]="false"
10
+ [styleClass]="$any(className)"
11
+ [panelStyleClass]="$any(dropdownClassName)"
12
+ (onChange)="onChange.emit($event.value)"
13
+ appendTo="body">
14
+ </p-dropdown>
15
+ <ng-template #pMultiselect>
16
+ <p-multiSelect display="chip"
17
+ [formControl]="dropdownFormControl"
18
+ [defaultLabel]="$any(placeholder)"
19
+ [dataKey]="$any(dataKeyProperty)"
20
+ [optionLabel]="$any(itemsLabelProperty)"
21
+ [optionValue]="$any(itemsValueProperty)"
22
+ [options]="(items$ | async) ?? []"
23
+ [styleClass]="$any(className)"
24
+ [panelStyleClass]="$any(dropdownClassName)"
25
+ [filter]="false"
26
+ (onChange)="onChange.emit($event.value)"
27
+ appendTo="body">
28
+ </p-multiSelect>
29
+ </ng-template>