@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,193 @@
1
+ import {FormlyFieldConfig} from '@ngx-formly/core';
2
+
3
+ import {FieldLookupDescriptor,
4
+ EditorDescriptor,
5
+ FieldLookupEnumDescriptor,
6
+ AFieldDescriptor,
7
+ FieldTabGroupDescriptor,
8
+ FieldManyEditorDescriptor,
9
+ FieldManyToManyEditorDescriptor,
10
+ FieldInputDescriptor,
11
+ FieldGroupDescriptor
12
+ } from '../descriptors';
13
+
14
+ export class EditorFormlyUtil {
15
+ public static createFormlyConfigFromDescriptor(descriptor: EditorDescriptor<any>): FormlyFieldConfig[] {
16
+ const fields: FormlyFieldConfig[] = [];
17
+
18
+ if (descriptor.tabs.length === 1 && descriptor.tabs[0].default) {
19
+ // dont use tabs
20
+ fields.push(...EditorFormlyUtil.createFormlyGroupType(descriptor.tabs[0].fields));
21
+ } else {
22
+ fields.push(...EditorFormlyUtil.createFormlyTabType(descriptor.tabs));
23
+ }
24
+
25
+ return fields;
26
+ }
27
+
28
+ public static createFormlyTabType(tabGroups: FieldTabGroupDescriptor<any>[]): FormlyFieldConfig[] {
29
+ const tabsField: FormlyFieldConfig = {
30
+ type: 'tabs',
31
+ fieldGroup: []
32
+ };
33
+ for (const tab of tabGroups) {
34
+ const tabField: FormlyFieldConfig = {
35
+ id: tab.name,
36
+ templateOptions: {},
37
+ fieldGroup: []
38
+ };
39
+ if (tab.title) {
40
+ // @ts-ignore
41
+ tabField.templateOptions.label = tab.title;
42
+ }
43
+ // @ts-ignore
44
+ tabField.fieldGroup.push(...EditorFormlyUtil.createFormlyGroupType(tab.fields));
45
+ // @ts-ignore
46
+ tabsField.fieldGroup.push(tabField);
47
+ }
48
+ return [tabsField];
49
+ }
50
+
51
+ public static createFormlyGroupType(groups: FieldGroupDescriptor<any>[]): FormlyFieldConfig[] {
52
+ if (groups.length === 1 && groups[0].default) {
53
+ // dont use fieldset, just create fields
54
+ return EditorFormlyUtil.createFormlyFields(groups[0]);
55
+ } else {
56
+ const groupsField: FormlyFieldConfig = {
57
+ type: 'fieldset',
58
+ fieldGroup: []
59
+ };
60
+ for (const group of groups) {
61
+ const groupField: FormlyFieldConfig = {
62
+ id: group.name,
63
+ templateOptions: {
64
+ descriptor: group
65
+ },
66
+ fieldGroup: []
67
+ };
68
+ if (group.title) {
69
+ // @ts-ignore
70
+ groupField.templateOptions.label = group.title;
71
+ }
72
+ // @ts-ignore
73
+ groupField.fieldGroup.push(...EditorFormlyUtil.createFormlyFields(group));
74
+ // @ts-ignore
75
+ groupsField.fieldGroup.push(groupField);
76
+ }
77
+ return [groupsField];
78
+ }
79
+ }
80
+
81
+ public static createFormlyFields(descriptor: FieldGroupDescriptor<any>): FormlyFieldConfig[] {
82
+ const fields: FormlyFieldConfig[] = [];
83
+ for (const descriptorField of descriptor.fields) {
84
+ fields.push(EditorFormlyUtil.createFormlyField(descriptorField));
85
+ }
86
+ // wrap in group to be able to use flex grid
87
+ const wrapperGroup = {
88
+ fieldGroupClassName: 'p-fluid formgrid grid',
89
+ fieldGroup: fields,
90
+ validators: {}
91
+ };
92
+
93
+ for (const validator of descriptor.validators) {
94
+ // @ts-ignore
95
+ wrapperGroup.validators[validator.name] = {expression: validator.expression, message: validator.message};
96
+ }
97
+
98
+ return [wrapperGroup];
99
+ }
100
+
101
+ public static createFormlyField(descriptor: AFieldDescriptor<any, any>): FormlyFieldConfig {
102
+ const field: FormlyFieldConfig = {
103
+ key: descriptor.property,
104
+ expressionProperties: {},
105
+ templateOptions: {},
106
+ validators: {}
107
+ };
108
+
109
+ let className = descriptor.className;
110
+ if (!className) {
111
+ // assign default field width through entire row
112
+ className = 'col-12';
113
+ }
114
+ if (className.indexOf('col-') < 0) {
115
+ // class was provided, but does not contain col- definition
116
+ className = `col-12 ${descriptor.className}`;
117
+ }
118
+ field.className = className;
119
+
120
+ // @ts-ignore
121
+ field.templateOptions.descriptor = descriptor;
122
+ if (descriptor instanceof FieldInputDescriptor) {
123
+ switch (descriptor.fieldType) {
124
+ case FieldInputDescriptor.TypeEnum.Textarea:
125
+ field.type = 'textarea';
126
+ break;
127
+ case FieldInputDescriptor.TypeEnum.Number:
128
+ field.type = 'number';
129
+ // @ts-ignore
130
+ field.templateOptions.min = descriptor.numberMin;
131
+ // @ts-ignore
132
+ field.templateOptions.max = descriptor.numberMax;
133
+ break;
134
+ case FieldInputDescriptor.TypeEnum.Switch:
135
+ field.type = 'switch';
136
+ break;
137
+ case FieldInputDescriptor.TypeEnum.Radio:
138
+ field.type = 'radio';
139
+ break;
140
+ case FieldInputDescriptor.TypeEnum.Datepicker:
141
+ field.type = 'datepicker';
142
+ break;
143
+ default:
144
+ field.type = 'input';
145
+ // @ts-ignore
146
+ field.templateOptions.minLength = descriptor.minLength;
147
+ // @ts-ignore
148
+ field.templateOptions.maxLength = descriptor.maxLength;
149
+ // @ts-ignore
150
+ field.templateOptions.pattern = descriptor.pattern;
151
+ break;
152
+ }
153
+ } else if (descriptor instanceof FieldLookupEnumDescriptor) {
154
+ field.type = 'enum';
155
+ } else if (descriptor instanceof FieldLookupDescriptor) {
156
+ switch (descriptor.lookupType) {
157
+ case FieldLookupDescriptor.LookupTypeEnum.Autocomplete:
158
+ field.type = 'autocomplete';
159
+ break;
160
+ case FieldLookupDescriptor.LookupTypeEnum.Dropdown:
161
+ default:
162
+ field.type = 'dropdown';
163
+ break;
164
+ }
165
+ } else if (descriptor instanceof FieldManyToManyEditorDescriptor) {
166
+ field.type = 'table-dialog-multiselect';
167
+ } else if (descriptor instanceof FieldManyEditorDescriptor) {
168
+ field.type = 'table-dialog-form';
169
+ }
170
+
171
+ if (descriptor.label) {
172
+ // @ts-ignore
173
+ field.templateOptions.label = descriptor.label;
174
+ }
175
+ if (descriptor.required) {
176
+ // @ts-ignore
177
+ field.templateOptions.required = true;
178
+ }
179
+ if (descriptor.disabled) {
180
+ // @ts-ignore
181
+ field.templateOptions.disabled = true;
182
+ } else {
183
+ // @ts-ignore
184
+ field.expressionProperties['templateOptions.disabled'] = 'formState.disabled';
185
+ }
186
+
187
+ for (const validator of descriptor.validators) {
188
+ field.validators[validator.name] = {expression: validator.expression, message: validator.message};
189
+ }
190
+
191
+ return field;
192
+ }
193
+ }
@@ -0,0 +1,148 @@
1
+ import {TranslateService} from '@ngx-translate/core';
2
+ import {Observable} from 'rxjs';
3
+ import {first, map, mergeMap} from 'rxjs/operators';
4
+
5
+ import {ActionDescriptor, ModelDescriptor} from '../descriptors';
6
+
7
+ export class I18nUtil {
8
+
9
+ public static instantModelTranslation(translate: TranslateService, model: ModelDescriptor<any>, keyPath: string, customKey?: string, item?: any,
10
+ fallbackKey?: string, i18nParams?: any): string|null {
11
+ const keys = I18nUtil.getModelKeysByPriority(model, keyPath, customKey, fallbackKey);
12
+ const i18nModelName = I18nUtil.instantModelName(translate, model, true);
13
+ const i18n = translate.instant(keys, I18nUtil.getModelI18nParams(model, item, i18nModelName ?? undefined, i18nParams));
14
+ return I18nUtil.selectKeyByPriority(keys, i18n);
15
+ }
16
+
17
+ public static instantActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any,
18
+ fallbackKey?: string, functionNameKey?: string, i18nParams?: any): string|null {
19
+ const keys = I18nUtil.getActionKeysByPriority(action, keyPath, customKey, fallbackKey);
20
+ const i18nModelName = I18nUtil.instantModelName(translate, action?.model, true);
21
+ const i18nFunctionTitle = I18nUtil.getFunctionTitle(translate, functionNameKey);
22
+ const i18n = translate.instant(keys, I18nUtil.getActionI18nParams(action, item, i18nModelName ?? undefined, i18nParams, i18nFunctionTitle));
23
+ return I18nUtil.selectKeyByPriority(keys, i18n);
24
+ }
25
+
26
+ public static streamActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string): Observable<string|null> {
27
+ return I18nUtil.getActionTranslation(translate, action, keyPath, customKey, item, fallbackKey, false);
28
+ }
29
+
30
+ public static getActionTranslation(translate: TranslateService, action: ActionDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string, oneTime: boolean = true): Observable<string|null> {
31
+ const keys = I18nUtil.getActionKeysByPriority(action, keyPath, customKey, fallbackKey);
32
+ return I18nUtil.getModelName(translate, action?.model, oneTime, true).pipe(
33
+ mergeMap(i18nModelName => translate.get(keys, I18nUtil.getActionI18nParams(action, item, i18nModelName ?? undefined))),
34
+ map(i18n => I18nUtil.selectKeyByPriority(keys, i18n))
35
+ );
36
+ }
37
+
38
+ private static getModelKeysByPriority(model: ModelDescriptor<any>, keyPath: string, customKey?: string, fallbackKey?: string) {
39
+ const keys = [];
40
+ if (customKey) {
41
+ keys.push(customKey);
42
+ }
43
+ const modelActionKey = `${model.typeName}.${keyPath}`;
44
+ keys.push(modelActionKey);
45
+ if (fallbackKey) {
46
+ keys.push(fallbackKey);
47
+ }
48
+ return keys;
49
+ }
50
+
51
+ private static getActionKeysByPriority(action: ActionDescriptor<any>, keyPath: string, customKey?: string, fallbackKey?: string) {
52
+ const keys = [];
53
+ if (customKey) {
54
+ keys.push(customKey);
55
+ }
56
+ const modelActionKey = `${action.i18nModelActionBaseKey}.${keyPath}`;
57
+ const actionKey = `${action.actionName}.${keyPath}`;
58
+ keys.push(modelActionKey, actionKey);
59
+ if (fallbackKey) {
60
+ keys.push(fallbackKey);
61
+ }
62
+ return keys;
63
+ }
64
+
65
+ public static getModelI18nParams(model: ModelDescriptor<any>, item: any, i18nModelName?: string, i18nParameters: any = {}) {
66
+ i18nParameters.itemId = ''
67
+ i18nParameters.itemTitle = ''
68
+
69
+ if (i18nModelName) {
70
+ i18nParameters.modelName = i18nModelName;
71
+ }
72
+ if (item) {
73
+ if (model.idPropertyName && item[model.idPropertyName]) {
74
+ i18nParameters.itemId = item[model.idPropertyName];
75
+ }
76
+ if (model.titlePropertyName && item[model.titlePropertyName]) {
77
+ i18nParameters.itemTitle = item[model.titlePropertyName];
78
+ }
79
+ }
80
+ return i18nParameters;
81
+ }
82
+
83
+ public static getActionI18nParams(action: ActionDescriptor<any>, item: any, i18nModelName?: string, i18nParameters: any = {}, functionTitle?: string) {
84
+ i18nParameters.itemId = ''
85
+ i18nParameters.itemTitle = ''
86
+
87
+ if (functionTitle) {
88
+ i18nParameters.functionTitle = functionTitle;
89
+ }
90
+ if (i18nModelName) {
91
+ i18nParameters.modelName = i18nModelName;
92
+ }
93
+ if (item) {
94
+ if (action.model.idPropertyName && item[action.model.idPropertyName]) {
95
+ i18nParameters.itemId = item[action.model.idPropertyName];
96
+ }
97
+ if (action.model.titlePropertyName && item[action.model.titlePropertyName]) {
98
+ i18nParameters.itemTitle = item[action.model.titlePropertyName];
99
+ }
100
+ }
101
+ return i18nParameters;
102
+ }
103
+
104
+ public static instantModelName(translate: TranslateService, model: ModelDescriptor<any>, singular?: boolean): string|null {
105
+ const keys = I18nUtil.getModelNameKeys(model, singular);
106
+ const i18n = translate.instant(keys);
107
+ return I18nUtil.selectKeyByPriority(keys, i18n);
108
+ }
109
+
110
+ public static getModelName(translate: TranslateService, model: ModelDescriptor<any>, oneTime: boolean = true, singular?: boolean): Observable<string|null> {
111
+ const keys = I18nUtil.getModelNameKeys(model, singular);
112
+ const obs = translate.stream(keys);
113
+ if (oneTime) {
114
+ obs.pipe(first())
115
+ }
116
+ return obs.pipe(map(i18n => I18nUtil.selectKeyByPriority(keys, i18n)));
117
+ }
118
+
119
+ public static getModelNameKeys(model: ModelDescriptor<any>, singular?: boolean) {
120
+ let keys = [];
121
+ if (singular !== undefined) {
122
+ keys.push(singular ? `${model?.typeName}.nameSingular` : `${model?.typeName}.namePlural`);
123
+ }
124
+ keys.push(`${model?.typeName}.name`);
125
+ return keys;
126
+ }
127
+
128
+ private static selectKeyByPriority(keys: string[], i18n: any): string|null {
129
+ for (const key of keys) {
130
+ if (key !== i18n[key]) {
131
+ return i18n[key];
132
+ }
133
+ }
134
+ return null;
135
+ }
136
+
137
+ private static getFunctionTitle(translate: TranslateService, functionTitle?: string) {
138
+ if (functionTitle) {
139
+ const translation = translate.instant(`mngAction.functions.${functionTitle}.title`);
140
+ if (translation === functionTitle) {
141
+ return null;
142
+ }
143
+ return translation;
144
+ } else {
145
+ return null;
146
+ }
147
+ }
148
+ }
@@ -1,4 +1,5 @@
1
- export * from './editor-formly.util';
2
- export * from './i18n.util';
3
- export * from './model.util';
4
- export * from './type.util';
1
+ export * from './editor-formly.util';
2
+ export * from './i18n.util';
3
+ export * from './model.util';
4
+ export * from './toast.util';
5
+ export * from './type.util';
@@ -0,0 +1,66 @@
1
+ import {ClassType} from '../types';
2
+
3
+ import {ObjectSerializer} from '../api/utils';
4
+ import {ILookupDescriptor} from '../descriptors';
5
+
6
+ export class ModelUtil {
7
+ public static findIdAttribute<T>(classType: ClassType<T>): string|null {
8
+ const objSerializer = ObjectSerializer.get();
9
+ const attributes = objSerializer.findAttributesDefinitionByClassType(classType);
10
+ if (!attributes) {
11
+ return null;
12
+ }
13
+
14
+ let idAttribute = attributes.find(a => a.name === 'id');
15
+ if (!idAttribute) {
16
+ // if no id, try with code
17
+ idAttribute = attributes.find(a => a.name === 'code');
18
+ if (!idAttribute) {
19
+ // if no id or code, take the first attribute
20
+ idAttribute = attributes[0];
21
+ }
22
+ }
23
+
24
+ return idAttribute?.name ?? null;
25
+ }
26
+
27
+ public static findTitleAttribute<T>(classType: ClassType<T>): string|null {
28
+ const objSerializer = ObjectSerializer.get();
29
+ const attributes = objSerializer.findAttributesDefinitionByClassType(classType);
30
+ if (!attributes) {
31
+ return null;
32
+ }
33
+
34
+ let titleAttribute = attributes.find(a => a.type === 'string' && a.name === 'name');
35
+ if (!titleAttribute) {
36
+ // if no name, try with title
37
+ titleAttribute = attributes.find(a => a.type === 'string' && a.name === 'title');
38
+ if (!titleAttribute) {
39
+ // if no name or title, take the first attribute
40
+ titleAttribute = attributes[0];
41
+ }
42
+ }
43
+
44
+ return titleAttribute?.name ?? null;
45
+ }
46
+
47
+ public static trySetLookupItemsProperties<T>(lookup: ILookupDescriptor<T>) {
48
+ if (lookup.modelType) {
49
+ if (!lookup.itemsValueProperty || !lookup.dataKeyProperty) {
50
+ const idProperty = ModelUtil.findIdAttribute(lookup.modelType) ?? undefined;
51
+ if (idProperty && !lookup.itemsValueProperty) {
52
+ lookup.withItemsValueProperty(idProperty);
53
+ }
54
+ if (idProperty && !lookup.dataKeyProperty) {
55
+ lookup.withDataKeyProperty(idProperty);
56
+ }
57
+ }
58
+ if (!lookup.itemsLabelProperty) {
59
+ const labelProperty = ModelUtil.findTitleAttribute(lookup.modelType);
60
+ if (labelProperty) {
61
+ lookup.withItemsLabelProperty(labelProperty);
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,49 @@
1
+ import {TranslateService} from '@ngx-translate/core';
2
+ import {ActionDescriptor, TableDescriptor} from '../descriptors';
3
+ import {TableviewComponentService} from '../components/tableview/services';
4
+ import {I18nUtil} from './i18n.util';
5
+
6
+ export class ToastUtil {
7
+
8
+ public static tableNotificationError(translationService: TranslateService, table: TableDescriptor<any>, error: any, tableview?: TableviewComponentService<any, any>) {
9
+ const params: any = {}
10
+ if (error?.message) {
11
+ params.errorMessage = `: ${error.message}`;
12
+ } else {
13
+ params.errorMessage = '.';
14
+ }
15
+ console.log(params)
16
+ const tableErrorTitle = I18nUtil.instantModelTranslation(translationService, table.model, 'table.error.title', undefined, undefined, 'general.error', params) ?? undefined;
17
+ const tableErrorMessage = I18nUtil.instantModelTranslation(translationService, table.model, 'table.error.message', undefined, undefined, 'general.errorMessage', params) ?? undefined;
18
+
19
+ tableview?.messageService?.add({severity: 'error', summary: tableErrorTitle, detail: tableErrorMessage});
20
+ }
21
+
22
+ public static actionNotificationSuccess(translationService: TranslateService, action: ActionDescriptor<any>, functionName: string, customTitleKey?: string, customMessageKey?: string, tableview?: TableviewComponentService<any, any>, item?: any) {
23
+ const actionSuccessTitle = I18nUtil.instantActionTranslation(translationService, action, 'success.title', customTitleKey, item, 'general.success', functionName) ?? undefined;
24
+ const actionSuccessMessage = I18nUtil.instantActionTranslation(translationService, action, 'success.message', customMessageKey, item, 'general.successMessage', functionName) ?? undefined;
25
+
26
+ tableview?.messageService?.add({severity: 'success', summary: actionSuccessTitle, detail: actionSuccessMessage});
27
+ }
28
+
29
+ public static actionNotificationError(translationService: TranslateService, action: ActionDescriptor<any>, error: any, functionName: string, tableview?: TableviewComponentService<any, any>, item?: any) {
30
+ const params: any = {}
31
+ if (error?.message) {
32
+ params.errorMessage = `: ${error.message}`;
33
+ } else {
34
+ params.errorMessage = '.';
35
+ }
36
+ const actionErrorTitle = I18nUtil.instantActionTranslation(translationService, action, 'error.title', action.runNotificationErrorTitle,
37
+ item, 'general.error', functionName, params) ?? undefined;
38
+ const actionErrorMessage = I18nUtil.instantActionTranslation(translationService, action, 'error.message', action.runNotificationErrorMessage,
39
+ item, 'general.errorMessage', functionName, params) ?? undefined;
40
+
41
+ tableview?.messageService?.add({severity: 'error', summary: actionErrorTitle, detail: actionErrorMessage});
42
+ }
43
+
44
+ public static getFormEditorWarningMessage(translationService: TranslateService, title: string, message: string) {
45
+ const actionErrorTitle = translationService.instant(title) ?? undefined;
46
+ const actionErrorMessage = translationService.instant(message) ?? undefined;
47
+ return {severity:'warn', summary: actionErrorTitle, detail: actionErrorMessage};
48
+ }
49
+ }
@@ -0,0 +1,44 @@
1
+ import 'reflect-metadata';
2
+
3
+ import {ClassType, typeNameDecoratorPropertyName} from '../types';
4
+
5
+ export class TypeUtil {
6
+
7
+ public static defineReflectTypeName(targetType: ClassType<any>, typeName?: string) {
8
+ if (!typeName) {
9
+ typeName = TypeUtil.getDecoratorTypeName(targetType);
10
+ if (!typeName) {
11
+ console.warn(`Type name not provided for target ${targetType}, nor could be retrieved from decorator. Type name was not registered to reflect.`);
12
+ return;
13
+ }
14
+ }
15
+
16
+ if (!Reflect.hasOwnMetadata(typeNameDecoratorPropertyName, targetType)) {
17
+ Reflect.defineMetadata(typeNameDecoratorPropertyName, typeName, targetType);
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Gets type name from either decorator or reflect metadata.
23
+ * @param type Class.
24
+ */
25
+ public static findTypeName(type: ClassType<any>): string {
26
+ let decoratorName = TypeUtil.getDecoratorTypeName(type);
27
+ if (decoratorName) {
28
+ return decoratorName;
29
+ }
30
+ decoratorName = Reflect.getMetadata(typeNameDecoratorPropertyName, type);
31
+ if (decoratorName) {
32
+ return decoratorName;
33
+ }
34
+ return type.name;
35
+ }
36
+
37
+ /**
38
+ * Get value from decorator defined property name
39
+ * @param type Class.
40
+ */
41
+ public static getDecoratorTypeName(type: Function): string|undefined {
42
+ return (type as any)[typeNameDecoratorPropertyName];
43
+ }
44
+ }
@@ -1,22 +1,42 @@
1
- export * from './lib/mng-commons.module';
2
- export * from './lib/api/services';
3
- export * from './lib/services';
4
- export * from './lib/services/providers';
5
- export * from './lib/api/utils';
6
- export * from './lib/utils';
7
- export * from './lib/components/action';
8
- export * from './lib/components/form';
9
- export * from './lib/components/form/formly/fields';
10
- export * from './lib/components/form/formly/wrappers';
11
- export * from './lib/components/layout';
12
- export * from './lib/components/tableview';
13
- export * from './lib/directives';
14
- export * from './lib/pipes';
15
- export * from './lib/api/models';
16
- export * from './lib/models/config';
17
- export * from './lib/models/descriptors';
18
- export * from './lib/models/events';
19
- export * from './lib/models/interfaces';
20
- export * from './lib/models/providers';
21
- export * from './lib/models/types';
22
- export * from './lib/models/validators';
1
+ /*
2
+ * Public API Surface of mng-commons
3
+ */
4
+
5
+ // module
6
+ export * from './lib/mng-commons.module';
7
+
8
+ // services
9
+ export * from './lib/api/services';
10
+ export * from './lib/components/layout/services';
11
+ export * from './lib/components/tableview/services';
12
+ export * from './lib/services';
13
+ export * from './lib/services/providers';
14
+
15
+ // utils
16
+ export * from './lib/api/utils';
17
+ export * from './lib/utils';
18
+
19
+ // components
20
+ export * from './lib/components/action';
21
+ export * from './lib/components/form';
22
+ export * from './lib/components/form/formly/fields';
23
+ export * from './lib/components/form/formly/wrappers';
24
+ export * from './lib/components/layout';
25
+ export * from './lib/components/tableview';
26
+
27
+ // directives
28
+ export * from './lib/directives';
29
+
30
+ // pipes
31
+ export * from './lib/pipes';
32
+
33
+ // models&other
34
+ export * from './lib/api/models';
35
+ export * from './lib/components/action/models';
36
+ export * from './lib/components/form/models';
37
+ export * from './lib/config/models';
38
+ export * from './lib/config';
39
+ export * from './lib/data-providers';
40
+ export * from './lib/descriptors';
41
+ export * from './lib/models';
42
+ export * from './lib/types';
package/src/test.ts ADDED
@@ -0,0 +1,26 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js';
4
+ import 'zone.js/testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: {
12
+ context(path: string, deep?: boolean, filter?: RegExp): {
13
+ keys(): string[];
14
+ <T>(id: string): T;
15
+ };
16
+ };
17
+
18
+ // First, initialize the Angular testing environment.
19
+ getTestBed().initTestEnvironment(
20
+ BrowserDynamicTestingModule,
21
+ platformBrowserDynamicTesting()
22
+ );
23
+ // Then we find all the tests.
24
+ const context = require.context('./', true, /\.spec\.ts$/);
25
+ // And load the modules.
26
+ context.keys().map(context);
@@ -0,0 +1,15 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/lib",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "inlineSources": true,
9
+ "types": []
10
+ },
11
+ "exclude": [
12
+ "src/test.ts",
13
+ "**/*.spec.ts"
14
+ ]
15
+ }
@@ -0,0 +1,10 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.lib.json",
4
+ "compilerOptions": {
5
+ "declarationMap": false
6
+ },
7
+ "angularCompilerOptions": {
8
+ "compilationMode": "partial"
9
+ }
10
+ }
@@ -0,0 +1,17 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "../../tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "../../out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }