@mediusinc/mng-commons 0.2.0 → 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 (328) hide show
  1. package/.browserslistrc +16 -0
  2. package/karma.conf.js +51 -0
  3. package/ng-package.json +14 -0
  4. package/package.json +3 -24
  5. package/src/lib/api/models/builders/query-param.builder.ts +54 -0
  6. package/src/lib/api/models/filter-match-type.model.ts +25 -0
  7. package/src/lib/api/models/filter-param.model.ts +59 -0
  8. package/{lib/api/models/index.d.ts → src/lib/api/models/index.ts} +10 -8
  9. package/src/lib/api/models/mappers.ts +18 -0
  10. package/{lib/api/models/filter-match-type.model.d.ts → src/lib/api/models/query-mode.model.ts} +18 -23
  11. package/src/lib/api/models/query-param.model.ts +99 -0
  12. package/src/lib/api/models/query-result.model.ts +77 -0
  13. package/{lib/api/models/serialization.model.d.ts → src/lib/api/models/serialization.model.ts} +9 -8
  14. package/src/lib/api/services/crud-api.abstract.service.ts +113 -0
  15. package/{lib/api/services/index.d.ts → src/lib/api/services/index.ts} +1 -1
  16. package/{lib/api/utils/index.d.ts → src/lib/api/utils/index.ts} +2 -2
  17. package/src/lib/api/utils/medius-rest.util.ts +146 -0
  18. package/src/lib/api/utils/object-serializer.util.ts +227 -0
  19. package/src/lib/components/action/action.component.html +30 -0
  20. package/src/lib/components/action/action.component.ts +77 -0
  21. package/src/lib/components/action/dialog/action-dialog.component.html +26 -0
  22. package/src/lib/components/action/dialog/action-dialog.component.ts +171 -0
  23. package/{lib/components/action/index.d.ts → src/lib/components/action/index.ts} +3 -3
  24. package/{lib/components/action/models/action-confirmation-service.model.d.ts → src/lib/components/action/models/action-confirmation-service.model.ts} +7 -6
  25. package/src/lib/components/action/models/action-execution.model.ts +81 -0
  26. package/{lib/components/action/models/index.d.ts → src/lib/components/action/models/index.ts} +2 -2
  27. package/src/lib/components/action/route/action-route.component.html +1 -0
  28. package/src/lib/components/action/route/action-route.component.ts +159 -0
  29. package/src/lib/components/form/autocomplete/autocomplete.component.html +16 -0
  30. package/src/lib/components/form/autocomplete/autocomplete.component.ts +113 -0
  31. package/src/lib/components/form/dropdown/dropdown.component.html +29 -0
  32. package/src/lib/components/form/dropdown/dropdown.component.ts +109 -0
  33. package/src/lib/components/form/editor/form-editor.component.html +5 -0
  34. package/src/lib/components/form/editor/form-editor.component.ts +149 -0
  35. package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.html +7 -0
  36. package/src/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.ts +21 -0
  37. package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.html +9 -0
  38. package/src/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.ts +22 -0
  39. package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.html +8 -0
  40. package/src/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.ts +10 -0
  41. package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.html +56 -0
  42. package/src/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.ts +22 -0
  43. package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.html +13 -0
  44. package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.scss +4 -0
  45. package/src/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.ts +114 -0
  46. package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.html +37 -0
  47. package/src/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.ts +133 -0
  48. package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.html +10 -0
  49. package/src/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.ts +10 -0
  50. package/{lib/components/form/formly/fields/index.d.ts → src/lib/components/form/formly/fields/index.ts} +7 -7
  51. package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.html +7 -0
  52. package/src/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.ts +13 -0
  53. package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.html +6 -0
  54. package/src/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.ts +13 -0
  55. package/{lib/components/form/formly/wrappers/index.d.ts → src/lib/components/form/formly/wrappers/index.ts} +2 -2
  56. package/{lib/components/form/index.d.ts → src/lib/components/form/index.ts} +3 -3
  57. package/src/lib/components/form/models/form-editor.event.ts +7 -0
  58. package/{lib/components/form/models/index.d.ts → src/lib/components/form/models/index.ts} +1 -1
  59. package/src/lib/components/layout/breadcrumb.component.html +5 -0
  60. package/src/lib/components/layout/breadcrumb.component.ts +12 -0
  61. package/src/lib/components/layout/footer.component.html +7 -0
  62. package/src/lib/components/layout/footer.component.ts +15 -0
  63. package/{lib/components/layout/index.d.ts → src/lib/components/layout/index.ts} +6 -6
  64. package/src/lib/components/layout/main-layout.component.html +26 -0
  65. package/src/lib/components/layout/main-layout.component.ts +54 -0
  66. package/src/lib/components/layout/menu-item.component.html +41 -0
  67. package/src/lib/components/layout/menu-item.component.ts +170 -0
  68. package/src/lib/components/layout/menu.component.html +27 -0
  69. package/src/lib/components/layout/menu.component.ts +17 -0
  70. package/{lib/components/layout/services/index.d.ts → src/lib/components/layout/services/index.ts} +1 -1
  71. package/src/lib/components/layout/services/main-layout.component.service.ts +231 -0
  72. package/src/lib/components/layout/topbar.component.html +38 -0
  73. package/src/lib/components/layout/topbar.component.ts +62 -0
  74. package/{lib/components/tableview/index.d.ts → src/lib/components/tableview/index.ts} +5 -5
  75. package/{lib/components/tableview/models/index.d.ts → src/lib/components/tableview/models/index.ts} +1 -1
  76. package/src/lib/components/tableview/models/table.event.ts +22 -0
  77. package/src/lib/components/tableview/route/tableview-route.abstract.component.ts +31 -0
  78. package/{lib/components/tableview/services/index.d.ts → src/lib/components/tableview/services/index.ts} +1 -1
  79. package/src/lib/components/tableview/services/tableview.component.service.ts +22 -0
  80. package/src/lib/components/tableview/table/column-filter/column-filter.component.html +36 -0
  81. package/src/lib/components/tableview/table/column-filter/column-filter.component.ts +70 -0
  82. package/src/lib/components/tableview/table/column-value/column-value.component.html +14 -0
  83. package/src/lib/components/tableview/table/column-value/column-value.component.ts +19 -0
  84. package/src/lib/components/tableview/table/table.component.html +110 -0
  85. package/src/lib/components/tableview/table/table.component.ts +327 -0
  86. package/src/lib/components/tableview/tableview.component.html +37 -0
  87. package/src/lib/components/tableview/tableview.component.ts +78 -0
  88. package/src/lib/config/formly.config.ts +154 -0
  89. package/{lib/config/index.d.ts → src/lib/config/index.ts} +1 -1
  90. package/{lib/config/models/index.d.ts → src/lib/config/models/index.ts} +1 -1
  91. package/{lib/config/models/mng-config.model.d.ts → src/lib/config/models/mng-config.model.ts} +35 -34
  92. package/src/lib/data-providers/base.data-provider.ts +42 -0
  93. package/src/lib/data-providers/editor.data-provider.ts +60 -0
  94. package/{lib/data-providers/index.d.ts → src/lib/data-providers/index.ts} +5 -5
  95. package/src/lib/data-providers/lookup.data-provider.ts +29 -0
  96. package/{lib/data-providers/table.data-provider.d.ts → src/lib/data-providers/table.data-provider.ts} +8 -6
  97. package/src/lib/data-providers/tableview.data-provider.ts +29 -0
  98. package/src/lib/descriptors/action.descriptor.ts +439 -0
  99. package/src/lib/descriptors/editor.descriptor.ts +880 -0
  100. package/src/lib/descriptors/field.validator.ts +35 -0
  101. package/{lib/descriptors/index.d.ts → src/lib/descriptors/index.ts} +7 -7
  102. package/{lib/descriptors/lookup.descriptor.d.ts → src/lib/descriptors/lookup.descriptor.ts} +20 -17
  103. package/src/lib/descriptors/model.descriptor.ts +47 -0
  104. package/src/lib/descriptors/table.descriptor.ts +514 -0
  105. package/src/lib/descriptors/tableview.descriptor.ts +180 -0
  106. package/src/lib/directives/component.directive.ts +18 -0
  107. package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +2 -2
  108. package/src/lib/directives/template.directive.ts +24 -0
  109. package/src/lib/mng-commons.module.ts +240 -0
  110. package/{lib/models/index.d.ts → src/lib/models/index.ts} +2 -2
  111. package/src/lib/models/router.model.ts +16 -0
  112. package/{lib/models/user.model.d.ts → src/lib/models/user.model.ts} +9 -8
  113. package/src/lib/pipes/boolean.pipe.ts +17 -0
  114. package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +2 -2
  115. package/src/lib/pipes/property-path.pipe.ts +30 -0
  116. package/src/lib/services/action.service.ts +310 -0
  117. package/src/lib/services/commons.service.ts +407 -0
  118. package/src/lib/services/configuration.service.ts +98 -0
  119. package/{lib/services/index.d.ts → src/lib/services/index.ts} +4 -4
  120. package/src/lib/services/navigation.service.ts +42 -0
  121. package/src/lib/services/providers/commons-init.provider.ts +5 -0
  122. package/src/lib/services/providers/config-service.provider.ts +22 -0
  123. package/src/lib/services/providers/formly-config.provider.ts +39 -0
  124. package/{lib/services/providers/index.d.ts → src/lib/services/providers/index.ts} +3 -3
  125. package/src/lib/services/tokens/browser-storage.token.ts +9 -0
  126. package/{lib/services/tokens/index.d.ts → src/lib/services/tokens/index.ts} +2 -2
  127. package/src/lib/services/tokens/module-config.token.ts +5 -0
  128. package/{lib/types/index.d.ts → src/lib/types/index.ts} +2 -2
  129. package/src/lib/types/type.decorator.ts +7 -0
  130. package/src/lib/types/type.model.ts +12 -0
  131. package/src/lib/utils/editor-formly.util.ts +193 -0
  132. package/src/lib/utils/i18n.util.ts +148 -0
  133. package/{lib/utils/index.d.ts → src/lib/utils/index.ts} +5 -5
  134. package/src/lib/utils/model.util.ts +66 -0
  135. package/src/lib/utils/toast.util.ts +49 -0
  136. package/src/lib/utils/type.util.ts +44 -0
  137. package/{public-api.d.ts → src/public-api.ts} +42 -25
  138. package/src/test.ts +26 -0
  139. package/tsconfig.lib.json +15 -0
  140. package/tsconfig.lib.prod.json +10 -0
  141. package/tsconfig.spec.json +17 -0
  142. package/esm2020/lib/api/models/builders/query-param.builder.mjs +0 -48
  143. package/esm2020/lib/api/models/filter-match-type.model.mjs +0 -26
  144. package/esm2020/lib/api/models/filter-param.model.mjs +0 -46
  145. package/esm2020/lib/api/models/index.mjs +0 -9
  146. package/esm2020/lib/api/models/mappers.mjs +0 -17
  147. package/esm2020/lib/api/models/query-mode.model.mjs +0 -19
  148. package/esm2020/lib/api/models/query-param.model.mjs +0 -69
  149. package/esm2020/lib/api/models/query-result.model.mjs +0 -45
  150. package/esm2020/lib/api/models/serialization.model.mjs +0 -2
  151. package/esm2020/lib/api/services/crud-api.abstract.service.mjs +0 -72
  152. package/esm2020/lib/api/services/index.mjs +0 -2
  153. package/esm2020/lib/api/utils/index.mjs +0 -3
  154. package/esm2020/lib/api/utils/medius-rest.util.mjs +0 -122
  155. package/esm2020/lib/api/utils/object-serializer.util.mjs +0 -226
  156. package/esm2020/lib/components/action/action.component.mjs +0 -65
  157. package/esm2020/lib/components/action/dialog/action-dialog.component.mjs +0 -148
  158. package/esm2020/lib/components/action/index.mjs +0 -4
  159. package/esm2020/lib/components/action/models/action-confirmation-service.model.mjs +0 -2
  160. package/esm2020/lib/components/action/models/action-execution.model.mjs +0 -58
  161. package/esm2020/lib/components/action/models/index.mjs +0 -3
  162. package/esm2020/lib/components/action/route/action-route.component.mjs +0 -144
  163. package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +0 -114
  164. package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +0 -113
  165. package/esm2020/lib/components/form/editor/form-editor.component.mjs +0 -141
  166. package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +0 -19
  167. package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +0 -19
  168. package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +0 -16
  169. package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +0 -26
  170. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +0 -109
  171. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +0 -122
  172. package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +0 -17
  173. package/esm2020/lib/components/form/formly/fields/index.mjs +0 -8
  174. package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +0 -17
  175. package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +0 -16
  176. package/esm2020/lib/components/form/formly/wrappers/index.mjs +0 -3
  177. package/esm2020/lib/components/form/index.mjs +0 -4
  178. package/esm2020/lib/components/form/models/form-editor.event.mjs +0 -7
  179. package/esm2020/lib/components/form/models/index.mjs +0 -2
  180. package/esm2020/lib/components/layout/breadcrumb.component.mjs +0 -17
  181. package/esm2020/lib/components/layout/footer.component.mjs +0 -17
  182. package/esm2020/lib/components/layout/index.mjs +0 -7
  183. package/esm2020/lib/components/layout/main-layout.component.mjs +0 -54
  184. package/esm2020/lib/components/layout/menu-item.component.mjs +0 -173
  185. package/esm2020/lib/components/layout/menu.component.mjs +0 -20
  186. package/esm2020/lib/components/layout/services/index.mjs +0 -2
  187. package/esm2020/lib/components/layout/services/main-layout.component.service.mjs +0 -190
  188. package/esm2020/lib/components/layout/topbar.component.mjs +0 -59
  189. package/esm2020/lib/components/tableview/index.mjs +0 -6
  190. package/esm2020/lib/components/tableview/models/index.mjs +0 -2
  191. package/esm2020/lib/components/tableview/models/table.event.mjs +0 -16
  192. package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +0 -24
  193. package/esm2020/lib/components/tableview/services/index.mjs +0 -2
  194. package/esm2020/lib/components/tableview/services/tableview.component.service.mjs +0 -17
  195. package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +0 -74
  196. package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +0 -25
  197. package/esm2020/lib/components/tableview/table/table.component.mjs +0 -307
  198. package/esm2020/lib/components/tableview/tableview.component.mjs +0 -82
  199. package/esm2020/lib/config/formly.config.mjs +0 -136
  200. package/esm2020/lib/config/index.mjs +0 -2
  201. package/esm2020/lib/config/models/index.mjs +0 -2
  202. package/esm2020/lib/config/models/mng-config.model.mjs +0 -2
  203. package/esm2020/lib/data-providers/base.data-provider.mjs +0 -24
  204. package/esm2020/lib/data-providers/editor.data-provider.mjs +0 -37
  205. package/esm2020/lib/data-providers/index.mjs +0 -6
  206. package/esm2020/lib/data-providers/lookup.data-provider.mjs +0 -16
  207. package/esm2020/lib/data-providers/table.data-provider.mjs +0 -2
  208. package/esm2020/lib/data-providers/tableview.data-provider.mjs +0 -17
  209. package/esm2020/lib/descriptors/action.descriptor.mjs +0 -332
  210. package/esm2020/lib/descriptors/editor.descriptor.mjs +0 -670
  211. package/esm2020/lib/descriptors/field.validator.mjs +0 -21
  212. package/esm2020/lib/descriptors/index.mjs +0 -8
  213. package/esm2020/lib/descriptors/lookup.descriptor.mjs +0 -2
  214. package/esm2020/lib/descriptors/model.descriptor.mjs +0 -34
  215. package/esm2020/lib/descriptors/table.descriptor.mjs +0 -401
  216. package/esm2020/lib/descriptors/tableview.descriptor.mjs +0 -131
  217. package/esm2020/lib/directives/component.directive.mjs +0 -23
  218. package/esm2020/lib/directives/index.mjs +0 -3
  219. package/esm2020/lib/directives/template.directive.mjs +0 -29
  220. package/esm2020/lib/mng-commons.module.mjs +0 -410
  221. package/esm2020/lib/models/index.mjs +0 -3
  222. package/esm2020/lib/models/router.model.mjs +0 -2
  223. package/esm2020/lib/models/user.model.mjs +0 -2
  224. package/esm2020/lib/pipes/boolean.pipe.mjs +0 -22
  225. package/esm2020/lib/pipes/index.mjs +0 -3
  226. package/esm2020/lib/pipes/property-path.pipe.mjs +0 -36
  227. package/esm2020/lib/services/action.service.mjs +0 -269
  228. package/esm2020/lib/services/commons.service.mjs +0 -353
  229. package/esm2020/lib/services/configuration.service.mjs +0 -78
  230. package/esm2020/lib/services/index.mjs +0 -5
  231. package/esm2020/lib/services/navigation.service.mjs +0 -48
  232. package/esm2020/lib/services/providers/commons-init.provider.mjs +0 -4
  233. package/esm2020/lib/services/providers/config-service.provider.mjs +0 -20
  234. package/esm2020/lib/services/providers/formly-config.provider.mjs +0 -31
  235. package/esm2020/lib/services/providers/index.mjs +0 -4
  236. package/esm2020/lib/services/tokens/browser-storage.token.mjs +0 -6
  237. package/esm2020/lib/services/tokens/index.mjs +0 -3
  238. package/esm2020/lib/services/tokens/module-config.token.mjs +0 -3
  239. package/esm2020/lib/types/index.mjs +0 -3
  240. package/esm2020/lib/types/type.decorator.mjs +0 -7
  241. package/esm2020/lib/types/type.model.mjs +0 -2
  242. package/esm2020/lib/utils/editor-formly.util.mjs +0 -176
  243. package/esm2020/lib/utils/i18n.util.mjs +0 -125
  244. package/esm2020/lib/utils/index.mjs +0 -6
  245. package/esm2020/lib/utils/model.util.mjs +0 -57
  246. package/esm2020/lib/utils/toast.util.mjs +0 -39
  247. package/esm2020/lib/utils/type.util.mjs +0 -39
  248. package/esm2020/mediusinc-mng-commons.mjs +0 -5
  249. package/esm2020/public-api.mjs +0 -36
  250. package/fesm2015/mediusinc-mng-commons.mjs +0 -6250
  251. package/fesm2015/mediusinc-mng-commons.mjs.map +0 -1
  252. package/fesm2020/mediusinc-mng-commons.mjs +0 -6176
  253. package/fesm2020/mediusinc-mng-commons.mjs.map +0 -1
  254. package/lib/api/models/builders/query-param.builder.d.ts +0 -11
  255. package/lib/api/models/filter-param.model.d.ts +0 -23
  256. package/lib/api/models/mappers.d.ts +0 -6
  257. package/lib/api/models/query-mode.model.d.ts +0 -16
  258. package/lib/api/models/query-param.model.d.ts +0 -31
  259. package/lib/api/models/query-result.model.d.ts +0 -36
  260. package/lib/api/services/crud-api.abstract.service.d.ts +0 -23
  261. package/lib/api/utils/medius-rest.util.d.ts +0 -12
  262. package/lib/api/utils/object-serializer.util.d.ts +0 -30
  263. package/lib/components/action/action.component.d.ts +0 -36
  264. package/lib/components/action/dialog/action-dialog.component.d.ts +0 -46
  265. package/lib/components/action/models/action-execution.model.d.ts +0 -53
  266. package/lib/components/action/route/action-route.component.d.ts +0 -32
  267. package/lib/components/form/autocomplete/autocomplete.component.d.ts +0 -36
  268. package/lib/components/form/dropdown/dropdown.component.d.ts +0 -34
  269. package/lib/components/form/editor/form-editor.component.d.ts +0 -39
  270. package/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.d.ts +0 -11
  271. package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +0 -11
  272. package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +0 -6
  273. package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +0 -12
  274. package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -17
  275. package/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.d.ts +0 -36
  276. package/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.d.ts +0 -6
  277. package/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.d.ts +0 -8
  278. package/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.d.ts +0 -8
  279. package/lib/components/form/models/form-editor.event.d.ts +0 -5
  280. package/lib/components/layout/breadcrumb.component.d.ts +0 -8
  281. package/lib/components/layout/footer.component.d.ts +0 -9
  282. package/lib/components/layout/main-layout.component.d.ts +0 -21
  283. package/lib/components/layout/menu-item.component.d.ts +0 -29
  284. package/lib/components/layout/menu.component.d.ts +0 -10
  285. package/lib/components/layout/services/main-layout.component.service.d.ts +0 -65
  286. package/lib/components/layout/topbar.component.d.ts +0 -25
  287. package/lib/components/tableview/models/table.event.d.ts +0 -17
  288. package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +0 -14
  289. package/lib/components/tableview/services/tableview.component.service.d.ts +0 -13
  290. package/lib/components/tableview/table/column-filter/column-filter.component.d.ts +0 -22
  291. package/lib/components/tableview/table/column-value/column-value.component.d.ts +0 -12
  292. package/lib/components/tableview/table/table.component.d.ts +0 -79
  293. package/lib/components/tableview/tableview.component.d.ts +0 -35
  294. package/lib/config/formly.config.d.ts +0 -14
  295. package/lib/data-providers/base.data-provider.d.ts +0 -17
  296. package/lib/data-providers/editor.data-provider.d.ts +0 -25
  297. package/lib/data-providers/lookup.data-provider.d.ts +0 -14
  298. package/lib/data-providers/tableview.data-provider.d.ts +0 -15
  299. package/lib/descriptors/action.descriptor.d.ts +0 -148
  300. package/lib/descriptors/editor.descriptor.d.ts +0 -255
  301. package/lib/descriptors/field.validator.d.ts +0 -18
  302. package/lib/descriptors/model.descriptor.d.ts +0 -15
  303. package/lib/descriptors/table.descriptor.d.ts +0 -164
  304. package/lib/descriptors/tableview.descriptor.d.ts +0 -39
  305. package/lib/directives/component.directive.d.ts +0 -11
  306. package/lib/directives/template.directive.d.ts +0 -13
  307. package/lib/mng-commons.module.d.ts +0 -79
  308. package/lib/models/router.model.d.ts +0 -14
  309. package/lib/pipes/boolean.pipe.d.ts +0 -7
  310. package/lib/pipes/property-path.pipe.d.ts +0 -7
  311. package/lib/services/action.service.d.ts +0 -92
  312. package/lib/services/commons.service.d.ts +0 -72
  313. package/lib/services/configuration.service.d.ts +0 -35
  314. package/lib/services/navigation.service.d.ts +0 -14
  315. package/lib/services/providers/commons-init.provider.d.ts +0 -2
  316. package/lib/services/providers/config-service.provider.d.ts +0 -5
  317. package/lib/services/providers/formly-config.provider.d.ts +0 -4
  318. package/lib/services/tokens/browser-storage.token.d.ts +0 -2
  319. package/lib/services/tokens/module-config.token.d.ts +0 -3
  320. package/lib/types/type.decorator.d.ts +0 -2
  321. package/lib/types/type.model.d.ts +0 -10
  322. package/lib/utils/editor-formly.util.d.ts +0 -9
  323. package/lib/utils/i18n.util.d.ts +0 -18
  324. package/lib/utils/model.util.d.ts +0 -7
  325. package/lib/utils/toast.util.d.ts +0 -13
  326. package/lib/utils/type.util.d.ts +0 -15
  327. package/mediusinc-mng-commons-0.2.0.tgz +0 -0
  328. package/mediusinc-mng-commons.d.ts +0 -5
@@ -0,0 +1,439 @@
1
+ import {Observable, of, throwError} from 'rxjs';
2
+
3
+ import {ClassType} from '../types';
4
+ import {EditorDescriptor, ModelDescriptor} from './';
5
+ import {IDataProvider, IEditorDataProvider} from '../data-providers';
6
+ import {ActionExecContext} from '../components/action/models';
7
+ import {TypeUtil} from '../utils';
8
+
9
+ export class ActionDescriptor<T> {
10
+ protected readonly _model: ModelDescriptor<T>;
11
+ protected readonly _actionName: string;
12
+ protected readonly _parentType?: ClassType<any>;
13
+ protected readonly _parentTypeName?: string;
14
+ protected readonly _parentProperty?: string;
15
+ protected readonly _i18nModelActionBaseKey: string;
16
+
17
+ protected _type: ActionTypeEnum = ActionTypeEnum.Direct;
18
+ protected _activationTrigger: ActionActivationTriggerEnum = ActionActivationTriggerEnum.OnClick;
19
+ protected _position: ActionPositionEnum = ActionPositionEnum.ToolbarRight;
20
+ protected _level: ActionLevelEnum = ActionLevelEnum.Default;
21
+
22
+ protected _routeUrl: string|null = null;
23
+
24
+ protected _title?: string|null;
25
+ protected _icon?: string;
26
+ protected _className: string = '';
27
+ protected _tooltip?: string|null;
28
+
29
+ protected _runFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T>;
30
+ protected _isVisibleFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>;
31
+ protected _isEnabledFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>;
32
+
33
+ private _hasRunConfirmation: boolean = false;
34
+ private _runConfirmationIcon?: string;
35
+ private _runConfirmationTitle?: string;
36
+ private _runConfirmationMessage?: string;
37
+ private _runConfirmationAcceptTitle?: string;
38
+ private _runConfirmationRejectTitle?: string;
39
+
40
+ protected _hasRunNotificationSuccess: boolean = true;
41
+ private _runNotificationSuccessTitle?: string;
42
+ private _runNotificationSuccessMessage?: string;
43
+
44
+ private _hasRunNotificationError: boolean = true;
45
+ private _runNotificationErrorTitle?: string;
46
+ private _runNotificationErrorMessage?: string;
47
+
48
+ constructor(model: ModelDescriptor<T>, actionName: string, parentType?: ClassType<any>, parentProperty?: string) {
49
+ this._model = model;
50
+ this._actionName = actionName;
51
+
52
+ if ((parentType && !parentProperty) || (!parentProperty && parentProperty)) {
53
+ throw new Error(`Provide both the parent type and parent property or none: ${parentType}, ${parentProperty}.`);
54
+ }
55
+ this._parentType = parentType;
56
+ this._parentTypeName = parentType ? TypeUtil.findTypeName(parentType) : undefined;
57
+ this._parentProperty = parentProperty;
58
+
59
+ this._i18nModelActionBaseKey = this._parentTypeName
60
+ ? `${this._parentTypeName}.actions.${this._parentProperty}_${actionName}`
61
+ : `${this._model.typeName}.actions.${actionName}`;
62
+ }
63
+
64
+ public get model() {
65
+ return this._model;
66
+ }
67
+
68
+ public get parentTypeName() {
69
+ return this._parentTypeName;
70
+ }
71
+
72
+ public get parentProperty() {
73
+ return this._parentProperty;
74
+ }
75
+
76
+ public get i18nModelActionBaseKey() {
77
+ return this._i18nModelActionBaseKey;
78
+ }
79
+
80
+ public get type() {
81
+ return this._type;
82
+ }
83
+
84
+ public get activationTrigger() {
85
+ return this._activationTrigger;
86
+ }
87
+
88
+ public get position() {
89
+ return this._position;
90
+ }
91
+
92
+ public get level() {
93
+ return this._level;
94
+ }
95
+
96
+ public get routeUrl() {
97
+ return this._routeUrl;
98
+ }
99
+
100
+ public get title() {
101
+ return this._title;
102
+ }
103
+
104
+ public get icon() {
105
+ return this._icon;
106
+ }
107
+
108
+ public get tooltip() {
109
+ return this._tooltip;
110
+ }
111
+
112
+ public get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T> {
113
+ if (!this._runFunction) {
114
+ throw new Error('Run function is not defined and cannot be invoked');
115
+ }
116
+ return this._runFunction;
117
+ }
118
+
119
+ public get isVisibleFunction() {
120
+ return this._isVisibleFunction;
121
+ }
122
+
123
+ public get isEnabledFunction() {
124
+ return this._isEnabledFunction;
125
+ }
126
+
127
+ public get actionName() {
128
+ return this._actionName;
129
+ }
130
+
131
+ public get className() {
132
+ return this._className;
133
+ }
134
+
135
+ get hasRunConfirmation() {
136
+ return this._hasRunConfirmation;
137
+ }
138
+
139
+ get runConfirmationIcon() {
140
+ return this._runConfirmationIcon;
141
+ }
142
+
143
+ get runConfirmationTitle() {
144
+ return this._runConfirmationTitle;
145
+ }
146
+
147
+ get runConfirmationMessage() {
148
+ return this._runConfirmationMessage;
149
+ }
150
+
151
+ get runConfirmationAcceptTitle() {
152
+ return this._runConfirmationAcceptTitle;
153
+ }
154
+
155
+ get runConfirmationRejectTitle() {
156
+ return this._runConfirmationRejectTitle;
157
+ }
158
+
159
+ get hasRunNotificationSuccess() {
160
+ return this._hasRunNotificationSuccess;
161
+ }
162
+
163
+ get runNotificationSuccessTitle() {
164
+ return this._runNotificationSuccessTitle;
165
+ }
166
+
167
+ get runNotificationSuccessMessage() {
168
+ return this._runNotificationSuccessMessage;
169
+ }
170
+
171
+ get hasRunNotificationError() {
172
+ return this._hasRunNotificationError;
173
+ }
174
+
175
+ get runNotificationErrorTitle() {
176
+ return this._runNotificationErrorTitle;
177
+ }
178
+
179
+ get runNotificationErrorMessage() {
180
+ return this._runNotificationErrorMessage;
181
+ }
182
+
183
+ public withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T>): this {
184
+ this._runFunction = fn;
185
+ return this;
186
+ }
187
+
188
+ public withIsVisibleFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<boolean>): this {
189
+ this._isVisibleFunction = fn;
190
+ return this;
191
+ }
192
+
193
+ public withIsEnabledFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<boolean>): this {
194
+ this._isEnabledFunction = fn;
195
+ return this;
196
+ }
197
+
198
+ public withRouteTrigger(routeUrl: string): this {
199
+ this._activationTrigger = ActionActivationTriggerEnum.OnRoute;
200
+ this._routeUrl = routeUrl;
201
+ return this;
202
+ }
203
+
204
+ public withLevel(level: ActionLevelEnum): this {
205
+ this._level = level;
206
+ return this;
207
+ }
208
+
209
+ /**
210
+ * Overrides default title key with model action key (${model.typeName}.actions.${actionName}). Not relevant if parentType name is provided.
211
+ */
212
+ public withModelTitle(): this {
213
+ this._title = `${this._i18nModelActionBaseKey}.title`;
214
+ return this;
215
+ }
216
+
217
+ /**
218
+ * Overrides default title key (${actionName}.title). If null, no title will be shown.
219
+ * @param title Title i18n key or title.
220
+ */
221
+ public withTitle(title: string|null): this {
222
+ this._title = title;
223
+ return this;
224
+ }
225
+
226
+ public withIcon(icon: string): this {
227
+ this._icon = icon;
228
+ return this;
229
+ }
230
+
231
+ public withTooltip(tooltip: string|null): this {
232
+ this._title = tooltip;
233
+ return this;
234
+ }
235
+
236
+ public withClassName(className: string): this {
237
+ this._className = className;
238
+ return this;
239
+ }
240
+
241
+ public withPosition(position: ActionPositionEnum): this {
242
+ this._position = position;
243
+ return this;
244
+ }
245
+
246
+ public withRunConfirmation(icon: string = 'pi pi-exclamation-triangle', title?: string, message?: string, acceptTitle?: string, rejectTitle?: string): this {
247
+ this._hasRunConfirmation = true;
248
+ this._runConfirmationIcon = icon;
249
+ this._runConfirmationTitle = title;
250
+ this._runConfirmationMessage = message;
251
+ this._runConfirmationAcceptTitle = acceptTitle;
252
+ this._runConfirmationRejectTitle = rejectTitle;
253
+ return this;
254
+ }
255
+
256
+ public withRunNotificationSuccess(title?: string, message?: string, hasNotification: boolean = true) {
257
+ this._hasRunNotificationSuccess = hasNotification;
258
+ this._runNotificationSuccessTitle = title;
259
+ this._runNotificationSuccessMessage = message;
260
+ }
261
+
262
+ public withRunNotificationError(title?: string, message?: string, hasNotification: boolean = true) {
263
+ this._hasRunNotificationError = hasNotification;
264
+ this._runNotificationErrorTitle = title;
265
+ this._runNotificationErrorMessage = message;
266
+ }
267
+ }
268
+
269
+ export class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
270
+
271
+ private readonly _editorDescriptor: EditorDescriptor<T>;
272
+
273
+ protected _editorTitle?: string = undefined;
274
+
275
+ private _hasFetchNotificationSuccess: boolean = false;
276
+ private _fetchNotificationSuccessTitle?: string;
277
+ private _fetchNotificationSuccessMessage?: string;
278
+
279
+ protected _fetchFunction?: (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>;
280
+ protected _submitFunction?: (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>;
281
+
282
+ constructor(editorDescriptor: EditorDescriptor<T>, actionName: string, parentType?: ClassType<any>, parentProperty?: string) {
283
+ super(editorDescriptor.model, actionName, parentType, parentProperty);
284
+ this._type = ActionTypeEnum.Editor;
285
+ this._editorDescriptor = editorDescriptor;
286
+ }
287
+
288
+ public get editorTitle() {
289
+ return this._editorTitle;
290
+ }
291
+
292
+ public get editorDescriptor() {
293
+ return this._editorDescriptor;
294
+ }
295
+
296
+ get hasFetchNotificationSuccess() {
297
+ return this._hasFetchNotificationSuccess;
298
+ }
299
+
300
+ get fetchNotificationSuccessTitle() {
301
+ return this._fetchNotificationSuccessTitle;
302
+ }
303
+
304
+ get fetchNotificationSuccessMessage() {
305
+ return this._fetchNotificationSuccessMessage;
306
+ }
307
+
308
+ public override get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T> {
309
+ throw new Error('Run function cannot be used in editor action. Use submit function instead!');
310
+ }
311
+
312
+ public get fetchFunction(): (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T> {
313
+ if (!this._fetchFunction) {
314
+ return (ctx) => {
315
+ console.warn(`Fetch function is not provided for function ${this._actionName}, using default and returning context item`, ctx.data?.item);
316
+ return of(ctx.data?.item ? ctx.data.item : {} as T);
317
+ }
318
+ }
319
+ return this._fetchFunction;
320
+ }
321
+
322
+ public get submitFunction() {
323
+ return this._submitFunction;
324
+ }
325
+
326
+ public withEditorTitle(title: string): this {
327
+ this._editorTitle = title;
328
+ return this;
329
+ }
330
+
331
+ public override withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T>): this {
332
+ return this.withSubmitFunction(fn as (ctx: ActionExecContext<T, S, IEditorDataProvider<T, S>>) => Observable<T>);
333
+ }
334
+
335
+ public withFetchFunction<S>(fn: (ctx: ActionExecContext<T, S, IEditorDataProvider<T, S>>) => Observable<T>): this {
336
+ this._fetchFunction = fn;
337
+ return this;
338
+ }
339
+
340
+ public withSubmitFunction<S>(fn: (ctx: ActionExecContext<T, S, IEditorDataProvider<T, S>>) => Observable<T>): this {
341
+ this._submitFunction = fn;
342
+ return this;
343
+ }
344
+
345
+ public withFetchNotificationError(title?: string, message?: string, hasNotification: boolean = true) {
346
+ this._hasFetchNotificationSuccess = hasNotification;
347
+ this._fetchNotificationSuccessTitle = title;
348
+ this._fetchNotificationSuccessMessage = message;
349
+ }
350
+ }
351
+
352
+ export class ActionEditorDetailsDescriptor<T> extends ActionEditorDescriptor<T> {
353
+ constructor(editorDescriptor: EditorDescriptor<T>) {
354
+ super(editorDescriptor, 'details');
355
+ this.withPosition(ActionPositionEnum.RowClick);
356
+ this.withRouteTrigger(':itemId');
357
+ this.withFetchFunction(ctx => ctx.dataProvider?.fetch && ctx.data?.itemId
358
+ ? ctx.dataProvider.fetch(ctx.data?.itemId, ctx.serviceInstance)
359
+ : throwError(new Error(`Data provider fetch function or item id ${ctx.data?.itemId} is missing.`)));
360
+ this.withClassName('mng-details-dynamic-dialog');
361
+ }
362
+ }
363
+
364
+ export class ActionEditorAddDescriptor<T> extends ActionEditorDescriptor<T> {
365
+ constructor(editorDescriptor: EditorDescriptor<T>) {
366
+ super(editorDescriptor, 'add');
367
+ this.withPosition(ActionPositionEnum.ToolbarLeft);
368
+ this.withRouteTrigger('add');
369
+ this.withSubmitFunction(ctx => ctx.dataProvider?.create
370
+ ? ctx.dataProvider.create(ctx.data?.item, ctx.serviceInstance)
371
+ : throwError(new Error(`Data provider create function is missing.`)));
372
+ this.withLevel(ActionLevelEnum.Success);
373
+ this.withIcon('pi pi-plus');
374
+ this.withClassName('mng-details-dynamic-dialog');
375
+ }
376
+ }
377
+
378
+ export class ActionEditorEditDescriptor<T> extends ActionEditorDescriptor<T> {
379
+ constructor(editorDescriptor: EditorDescriptor<T>) {
380
+ super(editorDescriptor, 'edit');
381
+ this.withPosition(ActionPositionEnum.RowInline);
382
+ this.withTitle(null);
383
+ this.withRouteTrigger(':itemId/edit');
384
+ this.withFetchFunction(ctx => ctx.dataProvider?.fetch && ctx.data?.itemId
385
+ ? ctx.dataProvider.fetch(ctx.data.itemId, ctx.serviceInstance)
386
+ : throwError(new Error(`Data provider fetch function or item id ${ctx.data?.itemId} is missing.`)));
387
+ this.withSubmitFunction(ctx => ctx.dataProvider?.update && ctx.data?.itemId
388
+ ? ctx.dataProvider.update(ctx.data.itemId, ctx.data?.item, ctx.serviceInstance)
389
+ : throwError(new Error(`Data provider update function or item id ${ctx.data?.itemId} is missing.`)));
390
+ this.withIcon('pi pi-pencil');
391
+ this.withClassName('mng-details-dynamic-dialog');
392
+ }
393
+ }
394
+
395
+ export class ActionDeleteDescriptor<T> extends ActionDescriptor<T> {
396
+ constructor(model: ModelDescriptor<T>) {
397
+ super(model, 'delete');
398
+ this.withPosition(ActionPositionEnum.RowInline);
399
+ this.withTitle(null);
400
+ this.withRunFunction(ctx => {
401
+ const editorDataProvider = ctx.dataProvider as IEditorDataProvider<T, any>;
402
+ return editorDataProvider?.delete && ctx.data?.itemId
403
+ ? editorDataProvider.delete(ctx.data.itemId, ctx.data.item, ctx.serviceInstance)
404
+ : throwError(new Error(`Data provider delete function or item id ${ctx.data?.itemId} is missing.`))
405
+ });
406
+ this.withLevel(ActionLevelEnum.Danger);
407
+ this.withIcon('pi pi-trash');
408
+ this.withRunConfirmation(undefined);
409
+ }
410
+ }
411
+
412
+ export enum ActionPositionEnum {
413
+ ToolbarLeft,
414
+ ToolbarRight,
415
+ TableHeader,
416
+ RowInline,
417
+ RowClick
418
+ }
419
+
420
+ export enum ActionActivationTriggerEnum {
421
+ OnClick, // action is triggered for activation on click
422
+ OnRoute // action is triggered for activation by route url
423
+ }
424
+
425
+ export enum ActionTypeEnum {
426
+ Direct, // action is directly activated and executed
427
+ Editor // editor providing middle step for activation
428
+ }
429
+
430
+ export enum ActionLevelEnum {
431
+ Default,
432
+ Primary,
433
+ Secondary,
434
+ Info,
435
+ Help,
436
+ Success,
437
+ Warning,
438
+ Danger
439
+ }