@mediusinc/mng-commons 5.5.0 → 6.0.0-rc.3

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 (300) hide show
  1. package/core/action/action-parameters.model.d.ts +4 -4
  2. package/core/data-providers/base.data-provider.d.ts +4 -7
  3. package/core/data-providers/lookup.data-provider.d.ts +2 -2
  4. package/core/descriptors/model.descriptor.d.ts +1 -7
  5. package/core/descriptors/tableview.descriptor.d.ts +5 -5
  6. package/core/helpers/notification.d.ts +17 -1
  7. package/core/helpers/route.d.ts +0 -1
  8. package/core/helpers/type-helpers.d.ts +8 -0
  9. package/core/i18n/i18n-error.d.ts +2 -3
  10. package/core/index.d.ts +0 -3
  11. package/core/models/menu.model.d.ts +0 -4
  12. package/core/router/route-builder.d.ts +1 -1
  13. package/core/services/commons.service.d.ts +0 -32
  14. package/core/services/tokens/module-config.token.d.ts +0 -28
  15. package/esm2022/core/action/action-parameters.model.mjs +1 -1
  16. package/esm2022/core/data-providers/base.data-provider.mjs +2 -4
  17. package/esm2022/core/data-providers/lookup.data-provider.mjs +1 -1
  18. package/esm2022/core/descriptors/model.descriptor.mjs +1 -1
  19. package/esm2022/core/descriptors/tableview.descriptor.mjs +1 -1
  20. package/esm2022/core/helpers/notification.mjs +19 -4
  21. package/esm2022/core/helpers/type-helpers.mjs +1 -1
  22. package/esm2022/core/i18n/i18n-error.mjs +10 -8
  23. package/esm2022/core/index.mjs +1 -4
  24. package/esm2022/core/models/menu.model.mjs +1 -1
  25. package/esm2022/core/router/route-builder.mjs +2 -2
  26. package/esm2022/core/services/commons.service.mjs +1 -34
  27. package/esm2022/core/services/tokens/module-config.token.mjs +1 -1
  28. package/esm2022/filter/descriptors/filter-lookup.descriptor.mjs +5 -86
  29. package/esm2022/filter/descriptors/filter.descriptor.mjs +7 -29
  30. package/esm2022/form/api/data-providers/lookup-data-provider.factory.mjs +14 -41
  31. package/esm2022/form/api/data-providers/lookup.data-provider.mjs +3 -3
  32. package/esm2022/form/api/descriptors/action-button.descriptor.mjs +5 -17
  33. package/esm2022/form/api/descriptors/button-style.builder.mjs +80 -101
  34. package/esm2022/form/api/index.mjs +2 -1
  35. package/esm2022/form/api/models/button.model.mjs +2 -0
  36. package/esm2022/model/class/data-providers/base-from-class-data-provider.factory.mjs +5 -0
  37. package/esm2022/model/class/descriptors/model-class.descriptor.mjs +28 -0
  38. package/esm2022/model/class/descriptors/type-class.descriptor.mjs +6 -0
  39. package/esm2022/model/class/helpers/model.mjs +53 -0
  40. package/esm2022/model/class/index.mjs +8 -0
  41. package/esm2022/model/class/mediusinc-mng-commons-model-class.mjs +5 -0
  42. package/esm2022/model/data-providers/base-from-type-data-provider.factory.mjs +11 -6
  43. package/esm2022/model/descriptors/model.descriptor.mjs +11 -54
  44. package/esm2022/model/descriptors/type.descriptor.mjs +2 -10
  45. package/esm2022/model/helpers/i18n.mjs +14 -9
  46. package/esm2022/model/index.mjs +1 -2
  47. package/esm2022/table/api/class/class-table-attribute-converter.mjs +80 -0
  48. package/esm2022/table/api/class/class-table-attribute.model.mjs +2 -0
  49. package/esm2022/table/api/class/class-table-data-provider.factory.mjs +5 -0
  50. package/esm2022/table/api/class/class-table-descriptor-helpers.mjs +99 -0
  51. package/esm2022/table/api/class/class-table-descriptor.factory.mjs +21 -0
  52. package/esm2022/table/api/class/index.mjs +6 -0
  53. package/esm2022/table/api/class/mediusinc-mng-commons-table-api-class.mjs +5 -0
  54. package/esm2022/table/api/data-providers/table-data-provider.factory.mjs +14 -41
  55. package/esm2022/table/api/data-providers/table.data-provider.mjs +3 -9
  56. package/esm2022/table/api/descriptors/column.descriptor.mjs +8 -3
  57. package/esm2022/table/api/descriptors/table-descriptor.factory.mjs +10 -77
  58. package/esm2022/table/api/descriptors/table.descriptor.mjs +3 -3
  59. package/esm2022/table/api/helpers/column-converter.mjs +25 -0
  60. package/esm2022/table/api/helpers/table-data-provider-descriptor-convert.mjs +4 -4
  61. package/esm2022/table/api/index.mjs +2 -4
  62. package/esm2022/table/api/models/table-columns.model.mjs +1 -1
  63. package/esm2022/table/components/column-value/column-value.component.mjs +7 -5
  64. package/esm2022/table/components/filter/filter-active-tag/filter-active-tag.component.mjs +3 -3
  65. package/esm2022/table/components/filter/filter-form/filter-form.component.mjs +5 -5
  66. package/esm2022/table/components/table/table.component.mjs +17 -18
  67. package/esm2022/table/helpers/notification.mjs +19 -13
  68. package/esm2022/tableview/action/components/action/action.component.mjs +41 -37
  69. package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +22 -13
  70. package/esm2022/tableview/action/helpers/action-execution.mjs +1 -1
  71. package/esm2022/tableview/action/helpers/i18n.mjs +50 -30
  72. package/esm2022/tableview/action/helpers/notification.mjs +73 -12
  73. package/esm2022/tableview/action/helpers/styles.mjs +2 -2
  74. package/esm2022/tableview/action/models/execution/action-context.model.mjs +1 -1
  75. package/esm2022/tableview/action/models/execution/action-instance.model.mjs +1 -1
  76. package/esm2022/tableview/action/services/action-executor.service.mjs +92 -75
  77. package/esm2022/tableview/action/services/data-provider-executor.service.mjs +18 -3
  78. package/esm2022/tableview/api/action/descriptors/action-descriptor.factory.mjs +13 -104
  79. package/esm2022/tableview/api/action/descriptors/action-editor-descriptor.factory.mjs +15 -62
  80. package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +35 -82
  81. package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +20 -33
  82. package/esm2022/tableview/api/action/descriptors/action-link.descriptor.mjs +1 -1
  83. package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +54 -95
  84. package/esm2022/tableview/api/action/descriptors/editor-action-descriptor.factory.mjs +21 -0
  85. package/esm2022/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.mjs +21 -0
  86. package/esm2022/tableview/api/action/descriptors/table-action-descriptor.factory.mjs +37 -0
  87. package/esm2022/tableview/api/action/descriptors/table-action-editor-descriptor.factory.mjs +40 -0
  88. package/esm2022/tableview/api/action/helpers/data-provider-executors.mjs +25 -5
  89. package/esm2022/tableview/api/action/models/action-confirmation.model.mjs +2 -0
  90. package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +1 -1
  91. package/esm2022/tableview/api/action/models/action-error.model.mjs +1 -1
  92. package/esm2022/tableview/api/action/models/execution/action-context-validation.model.mjs +1 -1
  93. package/esm2022/tableview/api/action/models/execution/action-context.model.mjs +1 -1
  94. package/esm2022/tableview/api/action/models/execution/action-instance.model.mjs +1 -1
  95. package/esm2022/tableview/api/action/models/tableview-action-default-categories.model.mjs +6 -6
  96. package/esm2022/tableview/api/action/services/data-provider-executor.service.mjs +3 -3
  97. package/esm2022/tableview/api/class/editor/class-editor-attribute-converter.mjs +85 -0
  98. package/esm2022/tableview/api/class/editor/class-editor-attribute.model.mjs +2 -0
  99. package/esm2022/tableview/api/class/editor/class-editor-data-provider.factory.mjs +5 -0
  100. package/esm2022/tableview/api/class/editor/class-editor-descriptor-helpers.mjs +95 -0
  101. package/esm2022/tableview/api/class/editor/class-editor-descriptor.factory.mjs +21 -0
  102. package/esm2022/tableview/api/class/index.mjs +13 -0
  103. package/esm2022/tableview/api/class/mediusinc-mng-commons-tableview-api-class.mjs +5 -0
  104. package/esm2022/tableview/api/class/tableview/class-tableview-attribute-converter.mjs +35 -0
  105. package/esm2022/tableview/api/class/tableview/class-tableview-attribute.model.mjs +2 -0
  106. package/esm2022/tableview/api/class/tableview/class-tableview-data-provider.factory.mjs +5 -0
  107. package/esm2022/tableview/api/class/tableview/class-tableview-descriptor-helpers.mjs +111 -0
  108. package/esm2022/tableview/api/class/tableview/class-tableview-descriptor.factory.mjs +26 -0
  109. package/esm2022/tableview/api/editor/data-providers/editor-data-provider.factory.mjs +14 -32
  110. package/esm2022/tableview/api/editor/data-providers/editor.data-provider.mjs +40 -7
  111. package/esm2022/tableview/api/editor/descriptors/editor-descriptor.factory.mjs +7 -73
  112. package/esm2022/tableview/api/editor/descriptors/editor.descriptor.mjs +49 -134
  113. package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +14 -8
  114. package/esm2022/tableview/api/editor/descriptors/field-base.descriptor.mjs +11 -2
  115. package/esm2022/tableview/api/editor/descriptors/field-lookup.descriptor.mjs +3 -5
  116. package/esm2022/tableview/api/editor/descriptors/field-many.descriptor.mjs +2 -18
  117. package/esm2022/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.mjs +51 -0
  118. package/esm2022/tableview/api/editor/models/editor-fields.model.mjs +1 -1
  119. package/esm2022/tableview/api/editor/models/form-editor.event.mjs +1 -1
  120. package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +1 -1
  121. package/esm2022/tableview/api/index.mjs +9 -9
  122. package/esm2022/tableview/api/tableview/data-providers/tableview-data-provider.factory.mjs +13 -51
  123. package/esm2022/tableview/api/tableview/data-providers/tableview.data-provider.mjs +19 -11
  124. package/esm2022/tableview/api/tableview/descriptors/tableview-descriptor.factory.mjs +19 -96
  125. package/esm2022/tableview/api/tableview/descriptors/tableview.descriptor.mjs +29 -182
  126. package/esm2022/tableview/api/tableview/helpers/tableview-create.mjs +8 -6
  127. package/esm2022/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.mjs +4 -4
  128. package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +154 -106
  129. package/esm2022/tableview/api/tableview/helpers/tableview-input-builder.mjs +164 -7
  130. package/esm2022/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.mjs +2 -0
  131. package/esm2022/tableview/api/tableview/models/tableview-descriptor-helper.type.mjs +2 -0
  132. package/esm2022/tableview/api/tableview/models/tableview-input.model.mjs +1 -1
  133. package/esm2022/tableview/api/tableview/models/tableview-route.model.mjs +1 -1
  134. package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +5 -8
  135. package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +7 -5
  136. package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +34 -23
  137. package/esm2022/tableview/editor/helpers/editor-field.mjs +3 -3
  138. package/esm2022/tableview/editor/helpers/editor-formly.mjs +4 -4
  139. package/esm2022/tableview/editor/helpers/field-create.mjs +21 -0
  140. package/esm2022/tableview/index.mjs +3 -2
  141. package/esm2022/tableview/provide.mjs +44 -1
  142. package/esm2022/tableview/tableview/components/route/tableview-route.component.mjs +1 -1
  143. package/esm2022/tableview/tableview/components/tableview/tableview.component.mjs +3 -1
  144. package/fesm2022/mediusinc-mng-commons-core.mjs +715 -792
  145. package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
  146. package/fesm2022/mediusinc-mng-commons-filter.mjs +10 -113
  147. package/fesm2022/mediusinc-mng-commons-filter.mjs.map +1 -1
  148. package/fesm2022/mediusinc-mng-commons-form-api.mjs +144 -203
  149. package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
  150. package/fesm2022/mediusinc-mng-commons-model-class.mjs +97 -0
  151. package/fesm2022/mediusinc-mng-commons-model-class.mjs.map +1 -0
  152. package/fesm2022/mediusinc-mng-commons-model.mjs +35 -144
  153. package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
  154. package/fesm2022/mediusinc-mng-commons-table-api-class.mjs +204 -0
  155. package/fesm2022/mediusinc-mng-commons-table-api-class.mjs.map +1 -0
  156. package/fesm2022/mediusinc-mng-commons-table-api.mjs +55 -319
  157. package/fesm2022/mediusinc-mng-commons-table-api.mjs.map +1 -1
  158. package/fesm2022/mediusinc-mng-commons-table.mjs +45 -38
  159. package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
  160. package/fesm2022/mediusinc-mng-commons-tableview-api-class.mjs +367 -0
  161. package/fesm2022/mediusinc-mng-commons-tableview-api-class.mjs.map +1 -0
  162. package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +850 -1483
  163. package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
  164. package/fesm2022/mediusinc-mng-commons-tableview.mjs +421 -220
  165. package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
  166. package/filter/descriptors/filter-lookup.descriptor.d.ts +1 -26
  167. package/filter/descriptors/filter.descriptor.d.ts +5 -12
  168. package/form/api/data-providers/lookup-data-provider.factory.d.ts +17 -20
  169. package/form/api/data-providers/lookup.data-provider.d.ts +3 -3
  170. package/form/api/descriptors/action-button.descriptor.d.ts +11 -13
  171. package/form/api/descriptors/button-style.builder.d.ts +30 -44
  172. package/form/api/index.d.ts +1 -0
  173. package/form/api/models/button.model.d.ts +19 -0
  174. package/i18n/sl.json +56 -6
  175. package/model/class/README.md +8 -0
  176. package/model/class/data-providers/base-from-class-data-provider.factory.d.ts +3 -0
  177. package/model/class/descriptors/model-class.descriptor.d.ts +12 -0
  178. package/model/class/descriptors/type-class.descriptor.d.ts +3 -0
  179. package/model/{helpers → class/helpers}/model.d.ts +1 -2
  180. package/model/class/index.d.ts +4 -0
  181. package/model/data-providers/base-from-type-data-provider.factory.d.ts +13 -6
  182. package/model/descriptors/model.descriptor.d.ts +12 -27
  183. package/model/descriptors/type.descriptor.d.ts +0 -5
  184. package/model/helpers/i18n.d.ts +8 -3
  185. package/model/index.d.ts +0 -1
  186. package/package.json +25 -7
  187. package/table/api/class/README.md +10 -0
  188. package/table/api/{helpers/class-attribute-converter.d.ts → class/class-table-attribute-converter.d.ts} +2 -9
  189. package/table/api/{models → class}/class-table-attribute.model.d.ts +1 -1
  190. package/table/api/class/class-table-data-provider.factory.d.ts +4 -0
  191. package/table/api/{helpers/table-descriptor-helpers.d.ts → class/class-table-descriptor-helpers.d.ts} +2 -4
  192. package/table/api/class/class-table-descriptor.factory.d.ts +11 -0
  193. package/table/api/class/index.d.ts +5 -0
  194. package/table/api/data-providers/table-data-provider.factory.d.ts +17 -20
  195. package/table/api/data-providers/table.data-provider.d.ts +4 -12
  196. package/table/api/descriptors/column.descriptor.d.ts +5 -2
  197. package/table/api/descriptors/table-descriptor.factory.d.ts +3 -39
  198. package/table/api/descriptors/table.descriptor.d.ts +3 -3
  199. package/table/api/helpers/column-converter.d.ts +7 -0
  200. package/table/api/helpers/table-data-provider-descriptor-convert.d.ts +3 -3
  201. package/table/api/index.d.ts +1 -3
  202. package/table/api/models/table-columns.model.d.ts +2 -2
  203. package/table/components/column-value/column-value.component.d.ts +2 -0
  204. package/table/components/filter/filter-active-tag/filter-active-tag.component.d.ts +1 -1
  205. package/table/components/filter/filter-form/filter-form.component.d.ts +1 -1
  206. package/table/components/filter/filter-overlay-with-tag/filter-overlay-with-tag.component.d.ts +1 -1
  207. package/table/components/table/table.component.d.ts +0 -10
  208. package/table/helpers/notification.d.ts +10 -1
  209. package/tableview/action/components/action/action.component.d.ts +10 -13
  210. package/tableview/action/components/editor/action-editor.component.d.ts +1 -1
  211. package/tableview/action/components/editor/injector-context/action-editor-injector-context.component.d.ts +6 -5
  212. package/tableview/action/components/localization/data-language-dropdown.component.d.ts +3 -3
  213. package/tableview/action/components/table/action-table.component.d.ts +3 -3
  214. package/tableview/action/helpers/action-execution.d.ts +1 -1
  215. package/tableview/action/helpers/i18n.d.ts +36 -11
  216. package/tableview/action/helpers/notification.d.ts +37 -3
  217. package/tableview/action/models/execution/action-context.model.d.ts +3 -3
  218. package/tableview/action/models/execution/action-instance.model.d.ts +5 -5
  219. package/tableview/action/services/action-executor.service.d.ts +7 -7
  220. package/tableview/action/services/data-provider-executor.service.d.ts +16 -16
  221. package/tableview/action/services/view-container.service.d.ts +1 -1
  222. package/tableview/api/action/descriptors/action-descriptor.factory.d.ts +20 -31
  223. package/tableview/api/action/descriptors/action-editor-descriptor.factory.d.ts +18 -25
  224. package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +39 -47
  225. package/tableview/api/action/descriptors/action-link-descriptor.factory.d.ts +21 -13
  226. package/tableview/api/action/descriptors/action-link.descriptor.d.ts +3 -3
  227. package/tableview/api/action/descriptors/action.descriptor.d.ts +49 -60
  228. package/tableview/api/action/descriptors/editor-action-descriptor.factory.d.ts +21 -0
  229. package/tableview/api/action/descriptors/editor-action-editor-descriptor.factory.d.ts +21 -0
  230. package/tableview/api/action/descriptors/table-action-descriptor.factory.d.ts +36 -0
  231. package/tableview/api/action/descriptors/table-action-editor-descriptor.factory.d.ts +40 -0
  232. package/tableview/api/action/helpers/data-provider-executors.d.ts +13 -8
  233. package/tableview/api/action/models/action-confirmation.model.d.ts +14 -0
  234. package/tableview/api/action/models/action-descriptor.types.d.ts +6 -2
  235. package/tableview/api/action/models/action-error.model.d.ts +1 -1
  236. package/tableview/api/action/models/execution/action-context-validation.model.d.ts +2 -2
  237. package/tableview/api/action/models/execution/action-context.model.d.ts +2 -2
  238. package/tableview/api/action/models/execution/action-instance.model.d.ts +1 -1
  239. package/tableview/api/action/models/tableview-action-default-categories.model.d.ts +5 -5
  240. package/tableview/api/action/services/data-provider-executor.service.d.ts +26 -25
  241. package/tableview/api/class/README.md +13 -0
  242. package/tableview/api/{editor/helpers/class-attribute-converter.d.ts → class/editor/class-editor-attribute-converter.d.ts} +2 -2
  243. package/tableview/api/{editor/models/class-tableview-attribute.model.d.ts → class/editor/class-editor-attribute.model.d.ts} +1 -1
  244. package/tableview/api/class/editor/class-editor-data-provider.factory.d.ts +4 -0
  245. package/tableview/api/{editor/helpers/editor-descriptor-helpers.d.ts → class/editor/class-editor-descriptor-helpers.d.ts} +2 -5
  246. package/tableview/api/class/editor/class-editor-descriptor.factory.d.ts +11 -0
  247. package/tableview/api/class/index.d.ts +10 -0
  248. package/tableview/api/{tableview/helpers/class-attribute-converter.d.ts → class/tableview/class-tableview-attribute-converter.d.ts} +1 -1
  249. package/tableview/api/{tableview/models → class/tableview}/class-tableview-attribute.model.d.ts +2 -2
  250. package/tableview/api/class/tableview/class-tableview-data-provider.factory.d.ts +4 -0
  251. package/tableview/api/{tableview/helpers/tableview-descriptor-helpers.d.ts → class/tableview/class-tableview-descriptor-helpers.d.ts} +1 -2
  252. package/tableview/api/class/tableview/class-tableview-descriptor.factory.d.ts +12 -0
  253. package/tableview/api/editor/data-providers/editor-data-provider.factory.d.ts +17 -16
  254. package/tableview/api/editor/data-providers/editor.data-provider.d.ts +64 -29
  255. package/tableview/api/editor/descriptors/editor-descriptor.factory.d.ts +5 -38
  256. package/tableview/api/editor/descriptors/editor.descriptor.d.ts +48 -112
  257. package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +5 -5
  258. package/tableview/api/editor/descriptors/field-base.descriptor.d.ts +8 -1
  259. package/tableview/api/editor/descriptors/field-lookup.descriptor.d.ts +2 -3
  260. package/tableview/api/editor/descriptors/field-many.descriptor.d.ts +3 -11
  261. package/tableview/api/editor/descriptors/wrappers/editor-descriptor-nested-object-wrapper.d.ts +25 -0
  262. package/tableview/api/editor/models/editor-fields.model.d.ts +25 -21
  263. package/tableview/api/editor/models/form-editor.event.d.ts +0 -4
  264. package/tableview/api/index.d.ts +8 -7
  265. package/tableview/api/tableview/data-providers/tableview-data-provider.factory.d.ts +20 -25
  266. package/tableview/api/tableview/data-providers/tableview.data-provider.d.ts +22 -22
  267. package/tableview/api/tableview/descriptors/tableview-descriptor.factory.d.ts +20 -50
  268. package/tableview/api/tableview/descriptors/tableview.descriptor.d.ts +69 -163
  269. package/tableview/api/tableview/helpers/tableview-create.d.ts +18 -5
  270. package/tableview/api/tableview/helpers/tableview-data-provider-descriptor-convert.d.ts +2 -2
  271. package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +73 -20
  272. package/tableview/api/tableview/helpers/tableview-input-builder.d.ts +87 -9
  273. package/tableview/api/tableview/models/tableview-descriptor-fields-manage-helper.type.d.ts +9 -0
  274. package/tableview/api/tableview/models/tableview-descriptor-helper.type.d.ts +2 -0
  275. package/tableview/api/tableview/models/tableview-input.model.d.ts +1 -1
  276. package/tableview/api/tableview/models/tableview-route.model.d.ts +1 -1
  277. package/tableview/editor/helpers/field-create.d.ts +9 -0
  278. package/tableview/index.d.ts +2 -1
  279. package/tableview/provide.d.ts +7 -0
  280. package/tableview/tableview/components/route/tableview-route.component.d.ts +1 -1
  281. package/tableview/tableview/components/tableview/tableview.component.d.ts +6 -6
  282. package/version-info.json +6 -6
  283. package/core/components/pages/error/error.page.component.d.ts +0 -11
  284. package/core/components/pages/not-found/not-found.page.component.d.ts +0 -11
  285. package/core/data-providers/base-data-provider.factory.d.ts +0 -13
  286. package/esm2022/core/components/pages/error/error.page.component.mjs +0 -24
  287. package/esm2022/core/components/pages/not-found/not-found.page.component.mjs +0 -24
  288. package/esm2022/core/data-providers/base-data-provider.factory.mjs +0 -28
  289. package/esm2022/model/helpers/model.mjs +0 -71
  290. package/esm2022/table/api/helpers/class-attribute-converter.mjs +0 -104
  291. package/esm2022/table/api/helpers/table-descriptor-helpers.mjs +0 -98
  292. package/esm2022/table/api/models/class-table-attribute.model.mjs +0 -2
  293. package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +0 -88
  294. package/esm2022/tableview/api/editor/helpers/class-attribute-converter.mjs +0 -85
  295. package/esm2022/tableview/api/editor/helpers/editor-descriptor-helpers.mjs +0 -95
  296. package/esm2022/tableview/api/editor/models/class-tableview-attribute.model.mjs +0 -2
  297. package/esm2022/tableview/api/tableview/helpers/class-attribute-converter.mjs +0 -34
  298. package/esm2022/tableview/api/tableview/helpers/tableview-descriptor-helpers.mjs +0 -110
  299. package/esm2022/tableview/api/tableview/models/class-tableview-attribute.model.mjs +0 -2
  300. package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +0 -37
@@ -1,8 +1,8 @@
1
- import { DataProviderInst, StyleSizeEnum, StyleLevelEnum } from '@mediusinc/mng-commons/core';
1
+ import { DataProviderInst, StyleLevelEnum, StyleSizeEnum } from '@mediusinc/mng-commons/core';
2
2
 
3
3
  class LookupDataProviderInst extends DataProviderInst {
4
- constructor(type, serviceType) {
5
- super(type, serviceType);
4
+ constructor(serviceType) {
5
+ super(serviceType);
6
6
  this._lookup = () => [];
7
7
  }
8
8
  get lookup() {
@@ -14,102 +14,115 @@ class LookupDataProviderInst extends DataProviderInst {
14
14
  }
15
15
  }
16
16
 
17
- class LookupDataProvider extends LookupDataProviderInst {
18
- constructor() {
19
- super(undefined, undefined);
17
+ /**
18
+ * Creates and returns an instance of `LookupDataProviderInst` with the specified options for managing lookup data.
19
+ *
20
+ * @param {Object} [opts] - The options object to configure the data provider.
21
+ * @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.
22
+ * @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.
23
+ * @param {TypeDescriptor<CreateModel> | ModelDescriptor<CreateModel>} [opts.filtersType] - The descriptor defining the filters type.
24
+ * @param {TypeDescriptor<UpdateModel> | ModelDescriptor<UpdateModel>} [opts.sortsType] - The descriptor defining the sorts type.
25
+ * @return {LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>} An instance of `LookupDataProviderInst` configured according to the provided options.
26
+ */
27
+ function lookupDataProvider(opts) {
28
+ return new LookupDataProviderInst(opts?.service);
29
+ }
30
+
31
+ class ActionButtonDescriptor {
32
+ withLabel(label) {
33
+ this._label = label;
34
+ return this;
20
35
  }
21
- static create() {
22
- return lookupDataProvider();
36
+ withIcon(icon, iconPosition) {
37
+ this._icon = icon;
38
+ this._iconPosition = iconPosition;
39
+ return this;
23
40
  }
24
- static fromClass(type) {
25
- return lookupDataProviderFromClass(type);
41
+ withStyle(style) {
42
+ this._styleClass = style;
43
+ return this;
26
44
  }
27
- static fromClassWithService(type, serviceType) {
28
- return lookupDataProviderFromClass(type, serviceType);
45
+ withBadge(badge) {
46
+ this._badge = badge;
47
+ return this;
29
48
  }
30
- static fromService(serviceType) {
31
- return lookupDataProviderWithService(serviceType);
49
+ withTooltip(tooltip, position) {
50
+ this._tooltip = tooltip;
51
+ this._tooltipPosition = position ?? 'top';
52
+ return this;
32
53
  }
33
- }
34
- function lookupDataProvider(type, serviceTypeOrOpts,
35
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
36
- opts) {
37
- if (serviceTypeOrOpts === undefined || typeof serviceTypeOrOpts === 'function') {
38
- return new LookupDataProviderInst(undefined, serviceTypeOrOpts);
54
+ get label() {
55
+ return this._label;
39
56
  }
40
- else {
41
- return new LookupDataProviderInst(undefined, undefined);
57
+ get icon() {
58
+ return this._icon;
59
+ }
60
+ get iconPosition() {
61
+ return this._iconPosition;
62
+ }
63
+ get style() {
64
+ return this._styleClass;
65
+ }
66
+ get badge() {
67
+ return this._badge;
68
+ }
69
+ get tooltip() {
70
+ return this._tooltip;
71
+ }
72
+ get tooltipPosition() {
73
+ return this._tooltipPosition;
74
+ }
75
+ copy() {
76
+ const descriptor = new ActionButtonDescriptor();
77
+ descriptor._label = this._label;
78
+ descriptor._icon = this._icon;
79
+ descriptor._iconPosition = this._iconPosition;
80
+ descriptor._styleClass = { ...this._styleClass };
81
+ descriptor._badge = this._badge;
82
+ descriptor._tooltip = this._tooltip;
83
+ return descriptor;
42
84
  }
43
- }
44
- function lookupDataProviderWithService(serviceType,
45
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
46
- opts) {
47
- return new LookupDataProviderInst(undefined, serviceType);
48
- }
49
- function lookupDataProviderFromClass(type, serviceType) {
50
- return new LookupDataProviderInst(type, serviceType);
51
- }
52
- function lookupDataProviderFromModel(model, serviceTypeOrOpts, opts) {
53
- return typeof serviceTypeOrOpts === 'function'
54
- ? new LookupDataProviderInst(model.type, serviceTypeOrOpts)
55
- : new LookupDataProviderInst(model.type, undefined);
56
85
  }
57
86
 
58
87
  class ButtonStyleBuilder {
59
- constructor(level = StyleLevelEnum.Default, customClass) {
60
- this._size = StyleSizeEnum.Normal;
61
- this._textButton = false;
62
- this._outlineButton = false;
63
- this._raisedButton = false;
64
- this._roundedStyle = ButtonStyleRoundedEnum.DEFAULT;
65
- this._actionLevel = level;
66
- this._customClass = customClass;
88
+ static from(opts) {
89
+ const builder = new ButtonStyleBuilder();
90
+ builder._level = opts?.level;
91
+ builder._size = opts?.size;
92
+ builder._textButton = opts?.textButton;
93
+ builder._outlined = opts?.outlined;
94
+ builder._raised = opts?.raised;
95
+ builder._rounded = opts?.rounded;
96
+ builder._class = opts?.class;
97
+ return builder;
67
98
  }
68
- build(hasNoTitle = false) {
69
- const styles = [this.convertActionLevelToStyleClass(), this.convertSizeToStyleClass(), this._customClass];
70
- if (hasNoTitle && this._roundedStyle === ButtonStyleRoundedEnum.DEFAULT) {
71
- styles.push(`p-button-rounded mng-action-button-icon`);
72
- }
73
- if (this._textButton) {
74
- styles.push(`p-button-text`);
75
- }
76
- if (this._outlineButton) {
77
- styles.push(`p-button-outlined`);
78
- }
79
- if (this._raisedButton) {
80
- styles.push(`p-button-raised`);
81
- }
82
- if (this._roundedStyle === ButtonStyleRoundedEnum.ROUNDED) {
83
- styles.push('p-button-rounded');
84
- }
85
- return styles.join(' ');
99
+ get level() {
100
+ return this._level;
86
101
  }
87
- /**
88
- * creates instance of style builder with custom properties
89
- * @param actionLevel ActionLevelEnum
90
- * @param size ActionSizeEnum
91
- * @param textButton if true, text button will be applied
92
- * @param outlineButton if true, outlined button will be applied
93
- * @param raisedButton if true, raised button will be applied
94
- * @param customClass additional custom classes (will be added at generating)
95
- */
96
- static create(actionLevel, size, textButton, outlineButton, raisedButton, roundedButton, customClass) {
97
- const descriptor = new ButtonStyleBuilder(actionLevel, customClass);
98
- descriptor._actionLevel = actionLevel ?? descriptor._actionLevel;
99
- descriptor._size = size ?? descriptor._size;
100
- descriptor._textButton = textButton ?? descriptor._textButton;
101
- descriptor._outlineButton = outlineButton ?? descriptor._outlineButton;
102
- descriptor._raisedButton = raisedButton ?? descriptor._raisedButton;
103
- descriptor._roundedStyle = roundedButton ?? descriptor._roundedStyle;
104
- descriptor._customClass = customClass;
105
- return descriptor;
102
+ get size() {
103
+ return this._size;
104
+ }
105
+ get textButton() {
106
+ return this._textButton;
107
+ }
108
+ get outlined() {
109
+ return this._outlined;
110
+ }
111
+ get raised() {
112
+ return this._raised;
113
+ }
114
+ get rounded() {
115
+ return this._rounded;
116
+ }
117
+ get class() {
118
+ return this._class;
106
119
  }
107
120
  /**
108
121
  * sets custom action level and returns this object
109
- * @param actionLevel
122
+ * @param level
110
123
  */
111
- withActionLevel(actionLevel) {
112
- this._actionLevel = actionLevel;
124
+ withLevel(level) {
125
+ this._level = level;
113
126
  return this;
114
127
  }
115
128
  /**
@@ -122,42 +135,73 @@ class ButtonStyleBuilder {
122
135
  }
123
136
  /**
124
137
  * sets text button property
125
- * @param withText default true
138
+ * @param text default true
126
139
  */
127
- withTextButton(withText = true) {
128
- this._textButton = withText;
140
+ withTextButton(text = true) {
141
+ this._textButton = text;
129
142
  return this;
130
143
  }
131
144
  /**
132
145
  * sets outline button property
133
- * @param withOutline default true
146
+ * @param outlined default true
134
147
  */
135
- withOutlineButton(withOutline = true) {
136
- this._outlineButton = withOutline;
148
+ withOutlined(outlined = true) {
149
+ this._outlined = outlined;
137
150
  return this;
138
151
  }
139
152
  /**
140
153
  * sets raised button property
141
- * @param withRaised default true
154
+ * @param raised default true
142
155
  */
143
- withRaisedButton(withRaised = true) {
144
- this._raisedButton = withRaised;
156
+ withRaised(raised = true) {
157
+ this._raised = raised;
145
158
  return this;
146
159
  }
147
- withRoundedButton(roundedStyle = ButtonStyleRoundedEnum.ROUNDED) {
148
- this._roundedStyle = roundedStyle;
160
+ withRounded(rounded = true) {
161
+ this._rounded = rounded;
149
162
  return this;
150
163
  }
151
164
  /**
152
165
  * sets custom style class
153
166
  * @param customClass
154
167
  */
155
- withCustomClass(customClass) {
156
- this._customClass = customClass;
168
+ withClass(customClass) {
169
+ this._class = customClass;
157
170
  return this;
158
171
  }
159
- convertActionLevelToStyleClass() {
160
- switch (this._actionLevel) {
172
+ build(hasNoTitle = false) {
173
+ const styles = [this.levelToStyleClass(), this.sizeToStyleClass(), this._class];
174
+ if (hasNoTitle && this._rounded == null) {
175
+ styles.push(`p-button-rounded mng-action-button-icon`);
176
+ }
177
+ if (this._textButton) {
178
+ styles.push(`p-button-text`);
179
+ }
180
+ if (this._outlined) {
181
+ styles.push(`p-button-outlined`);
182
+ }
183
+ if (this._raised) {
184
+ styles.push(`p-button-raised`);
185
+ }
186
+ if (this._rounded) {
187
+ styles.push('p-button-rounded');
188
+ }
189
+ return styles.join(' ');
190
+ }
191
+ copy() {
192
+ const builder = new ButtonStyleBuilder();
193
+ builder._level = this._level;
194
+ builder._size = this._size;
195
+ builder._textButton = this._textButton;
196
+ builder._outlined = this._outlined;
197
+ builder._raised = this._raised;
198
+ builder._rounded = this._rounded;
199
+ builder._class = this._class;
200
+ return builder;
201
+ }
202
+ levelToStyleClass() {
203
+ switch (this._level) {
204
+ case undefined:
161
205
  case StyleLevelEnum.Default:
162
206
  case StyleLevelEnum.Primary:
163
207
  return 'p-button-primary';
@@ -175,7 +219,7 @@ class ButtonStyleBuilder {
175
219
  return 'p-button-danger';
176
220
  }
177
221
  }
178
- convertSizeToStyleClass() {
222
+ sizeToStyleClass() {
179
223
  switch (this._size) {
180
224
  case StyleSizeEnum.ExtraSmall:
181
225
  return 'p-button-sm mng-button-xs';
@@ -190,109 +234,6 @@ class ButtonStyleBuilder {
190
234
  return '';
191
235
  }
192
236
  }
193
- copy() {
194
- const builder = new ButtonStyleBuilder(this._actionLevel, this._customClass);
195
- builder._size = this._size;
196
- builder._textButton = this._textButton;
197
- builder._outlineButton = this._outlineButton;
198
- builder._raisedButton = this._raisedButton;
199
- builder._roundedStyle = this._roundedStyle;
200
- return builder;
201
- }
202
- get actionLevel() {
203
- return this._actionLevel;
204
- }
205
- get size() {
206
- return this._size;
207
- }
208
- get textButton() {
209
- return this._textButton;
210
- }
211
- get outlineButton() {
212
- return this._outlineButton;
213
- }
214
- get raisedButton() {
215
- return this._raisedButton;
216
- }
217
- get roundedStyle() {
218
- return this._roundedStyle;
219
- }
220
- get customClass() {
221
- return this._customClass;
222
- }
223
- }
224
- var ButtonStyleRoundedEnum;
225
- (function (ButtonStyleRoundedEnum) {
226
- ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["DEFAULT"] = 0] = "DEFAULT";
227
- ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["ROUNDED"] = 1] = "ROUNDED";
228
- ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["SQUARE"] = 2] = "SQUARE";
229
- })(ButtonStyleRoundedEnum || (ButtonStyleRoundedEnum = {}));
230
-
231
- class ActionButtonDescriptor {
232
- constructor() {
233
- this._iconPosition = 'left';
234
- this._styleClass = new ButtonStyleBuilder();
235
- }
236
- withLabel(label) {
237
- this._label = label;
238
- return this;
239
- }
240
- withIcon(icon) {
241
- this._icon = icon;
242
- return this;
243
- }
244
- withIconPosition(iconPosition) {
245
- this._iconPosition = iconPosition;
246
- return this;
247
- }
248
- withStyleClass(style) {
249
- this._styleClass = style;
250
- return this;
251
- }
252
- withBadge(badge) {
253
- this._badge = badge;
254
- return this;
255
- }
256
- withTooltip(tooltip, position) {
257
- this._tooltip = tooltip;
258
- this._tooltipPosition = position ?? 'top';
259
- return this;
260
- }
261
- withTooltipPosition(position) {
262
- this._tooltipPosition = position;
263
- return this;
264
- }
265
- get label() {
266
- return this._label;
267
- }
268
- get icon() {
269
- return this._icon;
270
- }
271
- get iconPosition() {
272
- return this._iconPosition;
273
- }
274
- get styleClass() {
275
- return this._styleClass;
276
- }
277
- get badge() {
278
- return this._badge;
279
- }
280
- get tooltip() {
281
- return this._tooltip;
282
- }
283
- get tooltipPosition() {
284
- return this._tooltipPosition;
285
- }
286
- copy() {
287
- const descriptor = new ActionButtonDescriptor();
288
- descriptor._label = this._label;
289
- descriptor._icon = this._icon;
290
- descriptor._iconPosition = this._iconPosition;
291
- descriptor._styleClass = this._styleClass.copy();
292
- descriptor._badge = this._badge;
293
- descriptor._tooltip = this._tooltip;
294
- return descriptor;
295
- }
296
237
  }
297
238
 
298
239
  // data providers
@@ -301,5 +242,5 @@ class ActionButtonDescriptor {
301
242
  * Generated bundle index. Do not edit.
302
243
  */
303
244
 
304
- export { ActionButtonDescriptor, ButtonStyleBuilder, ButtonStyleRoundedEnum, LookupDataProvider, LookupDataProviderInst, lookupDataProvider, lookupDataProviderFromClass, lookupDataProviderFromModel, lookupDataProviderWithService };
245
+ export { ActionButtonDescriptor, ButtonStyleBuilder, LookupDataProviderInst, lookupDataProvider };
305
246
  //# sourceMappingURL=mediusinc-mng-commons-form-api.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mediusinc-mng-commons-form-api.mjs","sources":["../../form/api/src/data-providers/lookup.data-provider.ts","../../form/api/src/data-providers/lookup-data-provider.factory.ts","../../form/api/src/descriptors/button-style.builder.ts","../../form/api/src/descriptors/action-button.descriptor.ts","../../form/api/src/index.ts","../../form/api/src/mediusinc-mng-commons-form-api.ts"],"sourcesContent":["import {ClassOptType, DataProviderInst, ILookupDataProvider, LookupDataProviderLookupFnType, ServiceClassOptType} from '@mediusinc/mng-commons/core';\n\nexport class LookupDataProviderInst<\n Model,\n Service = any,\n Sorts = keyof Model,\n Filters extends keyof any = keyof Model,\n ModelClass = ClassOptType<Model>,\n ServiceClass = ServiceClassOptType<Service>\n >\n extends DataProviderInst<Model, Service, ModelClass, ServiceClass>\n implements ILookupDataProvider<Model, Service, Sorts, Filters, ModelClass, ServiceClass>\n{\n protected _lookup: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters> = () => [];\n\n public constructor(type: ModelClass, serviceType: ServiceClass) {\n super(type, serviceType);\n }\n\n get lookup() {\n return this._lookup;\n }\n\n withLookup(fn: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters>): this {\n this._lookup = fn;\n return this;\n }\n}\n","import {ClassType, ServiceClassType} from '@mediusinc/mng-commons/core';\nimport {ModelDescriptor, TypeDescriptor} from '@mediusinc/mng-commons/model';\n\nimport {LookupDataProviderInst} from './lookup.data-provider';\n\nexport class LookupDataProvider extends LookupDataProviderInst<any> {\n protected constructor() {\n super(undefined, undefined);\n }\n\n public static create<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(): LookupDataProviderInst<Model, undefined, Sorts, Filters, undefined, undefined> {\n return lookupDataProvider<Model, Sorts, Filters>();\n }\n\n public static fromClass<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: ClassType<Model>\n ): LookupDataProviderInst<Model, undefined, Sorts, Filters, ClassType<Model>, undefined> {\n return lookupDataProviderFromClass<Model, Sorts, Filters>(type);\n }\n\n public static fromClassWithService<Model, Service, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: ClassType<Model>,\n serviceType: ServiceClassType<Service>\n ): LookupDataProviderInst<Model, Service, Sorts, Filters, ClassType<Model>, ServiceClassType<Service>> {\n return lookupDataProviderFromClass<Model, Service, Sorts, Filters>(type, serviceType);\n }\n\n public static fromService<Service, Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n serviceType: ServiceClassType<Service>\n ): LookupDataProviderInst<Model, Service, Sorts, Filters, undefined, ServiceClassType<Service>> {\n return lookupDataProviderWithService<Service, Model, Sorts, Filters>(serviceType);\n }\n}\n\nexport type LookupDataProviderCreateOptsType<TableModel, Sorts = keyof TableModel, Filters = keyof TableModel> = {\n filtersType?: TypeDescriptor<Filters>;\n sortsType?: TypeDescriptor<Sorts>;\n};\n\nexport function lookupDataProvider<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(): LookupDataProviderInst<\n Model,\n undefined,\n Sorts,\n Filters,\n undefined,\n undefined\n>;\nexport function lookupDataProvider<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: TypeDescriptor<Model>,\n opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>\n): LookupDataProviderInst<Model, undefined, Sorts, Filters, undefined, undefined>;\nexport function lookupDataProvider<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: TypeDescriptor<Model>,\n serviceType: ServiceClassType<Service>,\n opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>\n): LookupDataProviderInst<Model, Service, Sorts, Filters, undefined, ServiceClassType<Service>>;\nexport function lookupDataProvider<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model, ServiceClass = ServiceClassType<Service>>(\n type?: TypeDescriptor<Model>,\n serviceTypeOrOpts?: ServiceClass | LookupDataProviderCreateOptsType<Model, Sorts, Filters>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>\n) {\n if (serviceTypeOrOpts === undefined || typeof serviceTypeOrOpts === 'function') {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, undefined, ServiceClass>(undefined, serviceTypeOrOpts as ServiceClass);\n } else {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, undefined, ServiceClass>(undefined, undefined as ServiceClass);\n }\n}\n\nexport function lookupDataProviderWithService<Service, Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n serviceType: ServiceClassType<Service>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>\n): LookupDataProviderInst<Model, Service, Sorts, Filters, undefined, ServiceClassType<Service>> {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, undefined, ServiceClassType<Service>>(undefined, serviceType);\n}\n\nexport function lookupDataProviderFromClass<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: ClassType<Model>\n): LookupDataProviderInst<Model, undefined, Sorts, Filters, ClassType<Model>, undefined>;\nexport function lookupDataProviderFromClass<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model>(\n type: ClassType<Model>,\n serviceType: ServiceClassType<Service>\n): LookupDataProviderInst<Model, Service, Sorts, Filters, ClassType<Model>, ServiceClassType<Service>>;\nexport function lookupDataProviderFromClass<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model, ServiceClass = ServiceClassType<Service>>(\n type: ClassType<Model>,\n serviceType?: ServiceClass\n) {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, ClassType<Model>, ServiceClass>(type, serviceType as ServiceClass);\n}\n\nexport function lookupDataProviderFromModel<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model, ModelClass = ClassType<Model>>(\n model: ModelDescriptor<Model, ModelClass>,\n opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>\n): LookupDataProviderInst<Model, undefined, Sorts, Filters, ModelClass, undefined>;\nexport function lookupDataProviderFromModel<Model, Sorts = keyof Model, Filters extends keyof any = keyof Model, Service = any, ModelClass = ClassType<Model>>(\n model: ModelDescriptor<Model, ModelClass>,\n ServiceClass: ServiceClassType<Service>,\n opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>\n): LookupDataProviderInst<Model, Service, Sorts, Filters, ModelClass, ServiceClassType<Service>>;\nexport function lookupDataProviderFromModel<\n Model,\n Service = any,\n Sorts = keyof Model,\n Filters extends keyof any = keyof Model,\n ModelClass = ClassType<Model>,\n ServiceClass = ServiceClassType<Service>\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n>(model: ModelDescriptor<Model, ModelClass>, serviceTypeOrOpts?: ServiceClass, opts?: LookupDataProviderCreateOptsType<Model, Sorts, Filters>) {\n return typeof serviceTypeOrOpts === 'function'\n ? new LookupDataProviderInst<Model, Service, Sorts, Filters, ClassType<Model>, ServiceClassType<Service>>(\n model.type as ClassType<Model>,\n serviceTypeOrOpts as ServiceClassType<Service>\n )\n : new LookupDataProviderInst<Model, undefined, Sorts, Filters, ClassType<Model>, undefined>(model.type as ClassType<Model>, undefined);\n}\n","import {StyleLevelEnum, StyleSizeEnum} from '@mediusinc/mng-commons/core';\n\nexport class ButtonStyleBuilder {\n private _size: StyleSizeEnum = StyleSizeEnum.Normal;\n private _actionLevel: StyleLevelEnum;\n\n private _textButton = false;\n private _outlineButton = false;\n private _raisedButton = false;\n private _roundedStyle = ButtonStyleRoundedEnum.DEFAULT;\n private _customClass?: string;\n\n constructor(level = StyleLevelEnum.Default, customClass?: string) {\n this._actionLevel = level;\n this._customClass = customClass;\n }\n\n public build(hasNoTitle = false): string {\n const styles = [this.convertActionLevelToStyleClass(), this.convertSizeToStyleClass(), this._customClass];\n\n if (hasNoTitle && this._roundedStyle === ButtonStyleRoundedEnum.DEFAULT) {\n styles.push(`p-button-rounded mng-action-button-icon`);\n }\n\n if (this._textButton) {\n styles.push(`p-button-text`);\n }\n\n if (this._outlineButton) {\n styles.push(`p-button-outlined`);\n }\n\n if (this._raisedButton) {\n styles.push(`p-button-raised`);\n }\n\n if (this._roundedStyle === ButtonStyleRoundedEnum.ROUNDED) {\n styles.push('p-button-rounded');\n }\n\n return styles.join(' ');\n }\n\n /**\n * creates instance of style builder with custom properties\n * @param actionLevel ActionLevelEnum\n * @param size ActionSizeEnum\n * @param textButton if true, text button will be applied\n * @param outlineButton if true, outlined button will be applied\n * @param raisedButton if true, raised button will be applied\n * @param customClass additional custom classes (will be added at generating)\n */\n public static create(\n actionLevel?: StyleLevelEnum,\n size?: StyleSizeEnum,\n textButton?: boolean,\n outlineButton?: boolean,\n raisedButton?: boolean,\n roundedButton?: ButtonStyleRoundedEnum,\n customClass?: string\n ): ButtonStyleBuilder {\n const descriptor = new ButtonStyleBuilder(actionLevel, customClass);\n descriptor._actionLevel = actionLevel ?? descriptor._actionLevel;\n descriptor._size = size ?? descriptor._size;\n descriptor._textButton = textButton ?? descriptor._textButton;\n descriptor._outlineButton = outlineButton ?? descriptor._outlineButton;\n descriptor._raisedButton = raisedButton ?? descriptor._raisedButton;\n descriptor._roundedStyle = roundedButton ?? descriptor._roundedStyle;\n descriptor._customClass = customClass;\n\n return descriptor;\n }\n\n /**\n * sets custom action level and returns this object\n * @param actionLevel\n */\n public withActionLevel(actionLevel: StyleLevelEnum): ButtonStyleBuilder {\n this._actionLevel = actionLevel;\n return this;\n }\n\n /**\n * sets custom size and return this object\n * @param size\n */\n public withSize(size: StyleSizeEnum): ButtonStyleBuilder {\n this._size = size;\n return this;\n }\n\n /**\n * sets text button property\n * @param withText default true\n */\n public withTextButton(withText = true): ButtonStyleBuilder {\n this._textButton = withText;\n return this;\n }\n\n /**\n * sets outline button property\n * @param withOutline default true\n */\n public withOutlineButton(withOutline = true): ButtonStyleBuilder {\n this._outlineButton = withOutline;\n return this;\n }\n\n /**\n * sets raised button property\n * @param withRaised default true\n */\n public withRaisedButton(withRaised = true): ButtonStyleBuilder {\n this._raisedButton = withRaised;\n return this;\n }\n\n public withRoundedButton(roundedStyle = ButtonStyleRoundedEnum.ROUNDED): ButtonStyleBuilder {\n this._roundedStyle = roundedStyle;\n return this;\n }\n\n /**\n * sets custom style class\n * @param customClass\n */\n public withCustomClass(customClass: string): ButtonStyleBuilder {\n this._customClass = customClass;\n return this;\n }\n\n private convertActionLevelToStyleClass(): string {\n switch (this._actionLevel) {\n case StyleLevelEnum.Default:\n case StyleLevelEnum.Primary:\n return 'p-button-primary';\n case StyleLevelEnum.Secondary:\n return 'p-button-secondary';\n case StyleLevelEnum.Info:\n return 'p-button-info';\n case StyleLevelEnum.Help:\n return 'p-button-help';\n case StyleLevelEnum.Success:\n return 'p-button-success';\n case StyleLevelEnum.Warning:\n return 'p-button-warning';\n case StyleLevelEnum.Danger:\n return 'p-button-danger';\n }\n }\n\n private convertSizeToStyleClass(): string {\n switch (this._size) {\n case StyleSizeEnum.ExtraSmall:\n return 'p-button-sm mng-button-xs';\n case StyleSizeEnum.Small:\n return 'p-button-sm mng-button-sm';\n case StyleSizeEnum.Large:\n return 'p-button-lg mng-button-lg';\n case StyleSizeEnum.ExtraLarge:\n return 'p-button-lg mng-button-xl';\n case StyleSizeEnum.Normal:\n default:\n return '';\n }\n }\n\n public copy(): ButtonStyleBuilder {\n const builder = new ButtonStyleBuilder(this._actionLevel, this._customClass);\n\n builder._size = this._size;\n builder._textButton = this._textButton;\n builder._outlineButton = this._outlineButton;\n builder._raisedButton = this._raisedButton;\n builder._roundedStyle = this._roundedStyle;\n\n return builder;\n }\n\n public get actionLevel() {\n return this._actionLevel;\n }\n\n public get size() {\n return this._size;\n }\n\n public get textButton() {\n return this._textButton;\n }\n\n public get outlineButton() {\n return this._outlineButton;\n }\n\n public get raisedButton() {\n return this._raisedButton;\n }\n\n public get roundedStyle() {\n return this._roundedStyle;\n }\n\n public get customClass() {\n return this._customClass;\n }\n}\n\nexport enum ButtonStyleRoundedEnum {\n DEFAULT,\n ROUNDED,\n SQUARE\n}\n","import {ButtonStyleBuilder} from './button-style.builder';\n\nexport class ActionButtonDescriptor {\n private _label?: string | null;\n\n private _icon?: string | null;\n private _iconPosition: 'left' | 'right' = 'left';\n\n private _styleClass = new ButtonStyleBuilder();\n\n private _badge?: string;\n private _tooltip?: string;\n private _tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';\n\n public withLabel(label?: string | null): this {\n this._label = label;\n return this;\n }\n\n public withIcon(icon: string | null): this {\n this._icon = icon;\n return this;\n }\n\n public withIconPosition(iconPosition: 'left' | 'right'): this {\n this._iconPosition = iconPosition;\n return this;\n }\n\n public withStyleClass(style: ButtonStyleBuilder): this {\n this._styleClass = style;\n return this;\n }\n\n public withBadge(badge: string): this {\n this._badge = badge;\n return this;\n }\n\n public withTooltip(tooltip: string, position?: 'top' | 'bottom' | 'left' | 'right'): this {\n this._tooltip = tooltip;\n this._tooltipPosition = position ?? 'top';\n return this;\n }\n\n public withTooltipPosition(position: 'top' | 'bottom' | 'left' | 'right'): this {\n this._tooltipPosition = position;\n return this;\n }\n\n public get label() {\n return this._label;\n }\n\n public get icon() {\n return this._icon;\n }\n\n public get iconPosition() {\n return this._iconPosition;\n }\n\n public get styleClass() {\n return this._styleClass;\n }\n\n public get badge() {\n return this._badge;\n }\n\n public get tooltip() {\n return this._tooltip;\n }\n\n public get tooltipPosition() {\n return this._tooltipPosition;\n }\n\n public copy(): ActionButtonDescriptor {\n const descriptor = new ActionButtonDescriptor();\n descriptor._label = this._label;\n descriptor._icon = this._icon;\n descriptor._iconPosition = this._iconPosition;\n descriptor._styleClass = this._styleClass.copy();\n descriptor._badge = this._badge;\n descriptor._tooltip = this._tooltip;\n return descriptor;\n }\n}\n","// data providers\nexport * from './data-providers/lookup.data-provider';\nexport * from './data-providers/lookup-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/action-button.descriptor';\nexport * from './descriptors/button-style.builder';\n\n// models\nexport * from './models/trim.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEM,MAAO,sBAQT,SAAQ,gBAA0D,CAAA;IAKlE,WAAmB,CAAA,IAAgB,EAAE,WAAyB,EAAA;AAC1D,QAAA,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC;AAHlB,QAAA,IAAA,CAAA,OAAO,GAAmE,MAAM,EAAE;;AAM5F,IAAA,IAAI,MAAM,GAAA;QACN,OAAO,IAAI,CAAC,OAAO;;AAGvB,IAAA,UAAU,CAAC,EAAkE,EAAA;AACzE,QAAA,IAAI,CAAC,OAAO,GAAG,EAAE;AACjB,QAAA,OAAO,IAAI;;AAElB;;ACtBK,MAAO,kBAAmB,SAAQ,sBAA2B,CAAA;AAC/D,IAAA,WAAA,GAAA;AACI,QAAA,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;;AAGxB,IAAA,OAAO,MAAM,GAAA;QAChB,OAAO,kBAAkB,EAAyB;;IAG/C,OAAO,SAAS,CACnB,IAAsB,EAAA;AAEtB,QAAA,OAAO,2BAA2B,CAAwB,IAAI,CAAC;;AAG5D,IAAA,OAAO,oBAAoB,CAC9B,IAAsB,EACtB,WAAsC,EAAA;AAEtC,QAAA,OAAO,2BAA2B,CAAiC,IAAI,EAAE,WAAW,CAAC;;IAGlF,OAAO,WAAW,CACrB,WAAsC,EAAA;AAEtC,QAAA,OAAO,6BAA6B,CAAiC,WAAW,CAAC;;AAExF;AAwBe,SAAA,kBAAkB,CAC9B,IAA4B,EAC5B,iBAA0F;AAC1F;AACA,IAA8D,EAAA;IAE9D,IAAI,iBAAiB,KAAK,SAAS,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE;AAC5E,QAAA,OAAO,IAAI,sBAAsB,CAA0D,SAAS,EAAE,iBAAiC,CAAC;;SACrI;AACH,QAAA,OAAO,IAAI,sBAAsB,CAA0D,SAAS,EAAE,SAAyB,CAAC;;AAExI;A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AA,IAAI,CAAC,gBAAgB,GAAG,QAAQ;AAChC,QAAA,OAAO,IAAI;;AAGf,IAAA,IAAW,KAAK,GAAA;QACZ,OAAO,IAAI,CAAC,MAAM;;AAGtB,IAAA,IAAW,IAAI,GAAA;QACX,OAAO,IAAI,CAAC,KAAK;;AAGrB,IAAA,IAAW,YAAY,GAAA;QACnB,OAAO,IAAI,CAAC,aAAa;;AAG7B,IAAA,IAAW,UAAU,GAAA;QACjB,OAAO,IAAI,CAAC,WAAW;;AAG3B,IAAA,IAAW,KAAK,GAAA;QACZ,OAAO,IAAI,CAAC,MAAM;;AAGtB,IAAA,IAAW,OAAO,GAAA;QACd,OAAO,IAAI,CAAC,QAAQ;;AAGxB,IAAA,IAAW,eAAe,GAAA;QACtB,OAAO,IAAI,CAAC,gBAAgB;;IAGzB,IAAI,GAAA;AACP,QAAA,MAAM,UAAU,GAAG,IAAI,sBAAsB,EAAE;AAC/C,QAAA,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAC/B,QAAA,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK;AAC7B,QAAA,UAAU,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa;QAC7C,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;AAChD,QAAA,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;AAC/B,QAAA,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ;AACnC,QAAA,OAAO,UAAU;;AAExB;;ACxFD;;ACAA;;AAEG;;;;"}
1
+ {"version":3,"file":"mediusinc-mng-commons-form-api.mjs","sources":["../../form/api/src/data-providers/lookup.data-provider.ts","../../form/api/src/data-providers/lookup-data-provider.factory.ts","../../form/api/src/descriptors/action-button.descriptor.ts","../../form/api/src/descriptors/button-style.builder.ts","../../form/api/src/index.ts","../../form/api/src/mediusinc-mng-commons-form-api.ts"],"sourcesContent":["import {DataProviderInst, ILookupDataProvider, LookupDataProviderLookupFnType, ServiceClassOptType} from '@mediusinc/mng-commons/core';\n\nexport class LookupDataProviderInst<Model, Service = any, Sorts = keyof Model, Filters extends keyof any = keyof Model, ServiceClass = ServiceClassOptType<Service>>\n extends DataProviderInst<Model, Service, ServiceClass>\n implements ILookupDataProvider<Model, Service, Sorts, Filters, ServiceClass>\n{\n protected _lookup: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters> = () => [];\n\n public constructor(serviceType: ServiceClass) {\n super(serviceType);\n }\n\n get lookup() {\n return this._lookup;\n }\n\n withLookup(fn: LookupDataProviderLookupFnType<Model, Service, Sorts, Filters>): this {\n this._lookup = fn;\n return this;\n }\n}\n","import {ServiceClassType} from '@mediusinc/mng-commons/core';\nimport {ModelDescriptor, TypeDescriptor} from '@mediusinc/mng-commons/model';\n\nimport {LookupDataProviderInst} from './lookup.data-provider';\n\n/**\n * Creates and returns an instance of `LookupDataProviderInst` with the specified options for managing lookup data.\n *\n * @param {Object} [opts] - The options object to configure the data provider.\n * @param {TypeDescriptor<Model> | ModelDescriptor<Model>} [opts.type] - The descriptor defining the type of model.\n * @param {ServiceClassType<Service>} [opts.service] - The service class type associated with the data provider.\n * @param {TypeDescriptor<CreateModel> | ModelDescriptor<CreateModel>} [opts.filtersType] - The descriptor defining the filters type.\n * @param {TypeDescriptor<UpdateModel> | ModelDescriptor<UpdateModel>} [opts.sortsType] - The descriptor defining the sorts type.\n * @return {LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>} An instance of `LookupDataProviderInst` configured according to the provided options.\n */\nexport function lookupDataProvider<\n Model,\n Service = any,\n Sorts = keyof Model,\n Filters extends keyof any = keyof Model,\n ServiceClass = Service extends undefined ? undefined : ServiceClassType<Service>\n>(opts?: {\n type?: TypeDescriptor<Model> | ModelDescriptor<Model>;\n service?: ServiceClassType<Service>;\n filtersType?: TypeDescriptor<Filters> | ModelDescriptor<Filters>;\n sortsType?: TypeDescriptor<Sorts> | ModelDescriptor<Sorts>;\n}): LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass> {\n return new LookupDataProviderInst<Model, Service, Sorts, Filters, ServiceClass>(opts?.service as ServiceClass);\n}\n","import {IActionButtonDescriptor, IButtonStyleDescriptor} from '../models/button.model';\n\nexport class ActionButtonDescriptor implements IActionButtonDescriptor {\n private _label?: string | null;\n\n private _icon?: string | null;\n private _iconPosition?: 'left' | 'right';\n\n private _styleClass?: IButtonStyleDescriptor;\n\n private _badge?: string;\n private _tooltip?: string | null;\n private _tooltipPosition?: 'top' | 'bottom' | 'left' | 'right';\n\n public withLabel(label?: string | null): this {\n this._label = label;\n return this;\n }\n\n public withIcon(icon: string | null, iconPosition?: 'left' | 'right'): this {\n this._icon = icon;\n this._iconPosition = iconPosition;\n return this;\n }\n\n public withStyle(style?: IButtonStyleDescriptor): this {\n this._styleClass = style;\n return this;\n }\n\n public withBadge(badge: string): this {\n this._badge = badge;\n return this;\n }\n\n public withTooltip(tooltip: string | null, position?: 'top' | 'bottom' | 'left' | 'right'): this {\n this._tooltip = tooltip;\n this._tooltipPosition = position ?? 'top';\n return this;\n }\n\n public get label() {\n return this._label;\n }\n\n public get icon() {\n return this._icon;\n }\n\n public get iconPosition() {\n return this._iconPosition;\n }\n\n public get style() {\n return this._styleClass;\n }\n\n public get badge() {\n return this._badge;\n }\n\n public get tooltip() {\n return this._tooltip;\n }\n\n public get tooltipPosition() {\n return this._tooltipPosition;\n }\n\n public copy(): ActionButtonDescriptor {\n const descriptor = new ActionButtonDescriptor();\n descriptor._label = this._label;\n descriptor._icon = this._icon;\n descriptor._iconPosition = this._iconPosition;\n descriptor._styleClass = {...this._styleClass};\n descriptor._badge = this._badge;\n descriptor._tooltip = this._tooltip;\n return descriptor;\n }\n}\n","import {StyleLevelEnum, StyleSizeEnum} from '@mediusinc/mng-commons/core';\n\nimport {IButtonStyleDescriptor} from '../models/button.model';\n\nexport class ButtonStyleBuilder implements IButtonStyleDescriptor {\n private _level?: StyleLevelEnum;\n private _size?: StyleSizeEnum;\n private _textButton?: boolean;\n private _outlined?: boolean;\n private _raised?: boolean;\n private _rounded?: boolean;\n private _class?: string;\n\n public static from(opts?: IButtonStyleDescriptor): ButtonStyleBuilder {\n const builder = new ButtonStyleBuilder();\n builder._level = opts?.level;\n builder._size = opts?.size;\n builder._textButton = opts?.textButton;\n builder._outlined = opts?.outlined;\n builder._raised = opts?.raised;\n builder._rounded = opts?.rounded;\n builder._class = opts?.class;\n return builder;\n }\n\n public get level() {\n return this._level;\n }\n\n public get size() {\n return this._size;\n }\n\n public get textButton() {\n return this._textButton;\n }\n\n public get outlined() {\n return this._outlined;\n }\n\n public get raised() {\n return this._raised;\n }\n\n public get rounded() {\n return this._rounded;\n }\n\n public get class() {\n return this._class;\n }\n\n /**\n * sets custom action level and returns this object\n * @param level\n */\n public withLevel(level: StyleLevelEnum): ButtonStyleBuilder {\n this._level = level;\n return this;\n }\n\n /**\n * sets custom size and return this object\n * @param size\n */\n public withSize(size: StyleSizeEnum): ButtonStyleBuilder {\n this._size = size;\n return this;\n }\n\n /**\n * sets text button property\n * @param text default true\n */\n public withTextButton(text = true): ButtonStyleBuilder {\n this._textButton = text;\n return this;\n }\n\n /**\n * sets outline button property\n * @param outlined default true\n */\n public withOutlined(outlined = true): ButtonStyleBuilder {\n this._outlined = outlined;\n return this;\n }\n\n /**\n * sets raised button property\n * @param raised default true\n */\n public withRaised(raised = true): ButtonStyleBuilder {\n this._raised = raised;\n return this;\n }\n\n public withRounded(rounded = true): ButtonStyleBuilder {\n this._rounded = rounded;\n return this;\n }\n\n /**\n * sets custom style class\n * @param customClass\n */\n public withClass(customClass: string): ButtonStyleBuilder {\n this._class = customClass;\n return this;\n }\n\n public build(hasNoTitle = false): string {\n const styles = [this.levelToStyleClass(), this.sizeToStyleClass(), this._class];\n\n if (hasNoTitle && this._rounded == null) {\n styles.push(`p-button-rounded mng-action-button-icon`);\n }\n\n if (this._textButton) {\n styles.push(`p-button-text`);\n }\n\n if (this._outlined) {\n styles.push(`p-button-outlined`);\n }\n\n if (this._raised) {\n styles.push(`p-button-raised`);\n }\n\n if (this._rounded) {\n styles.push('p-button-rounded');\n }\n\n return styles.join(' ');\n }\n\n public copy(): ButtonStyleBuilder {\n const builder = new ButtonStyleBuilder();\n builder._level = this._level;\n builder._size = this._size;\n builder._textButton = this._textButton;\n builder._outlined = this._outlined;\n builder._raised = this._raised;\n builder._rounded = this._rounded;\n builder._class = this._class;\n return builder;\n }\n\n private levelToStyleClass(): string {\n switch (this._level) {\n case undefined:\n case StyleLevelEnum.Default:\n case StyleLevelEnum.Primary:\n return 'p-button-primary';\n case StyleLevelEnum.Secondary:\n return 'p-button-secondary';\n case StyleLevelEnum.Info:\n return 'p-button-info';\n case StyleLevelEnum.Help:\n return 'p-button-help';\n case StyleLevelEnum.Success:\n return 'p-button-success';\n case StyleLevelEnum.Warning:\n return 'p-button-warning';\n case StyleLevelEnum.Danger:\n return 'p-button-danger';\n }\n }\n\n private sizeToStyleClass(): string {\n switch (this._size) {\n case StyleSizeEnum.ExtraSmall:\n return 'p-button-sm mng-button-xs';\n case StyleSizeEnum.Small:\n return 'p-button-sm mng-button-sm';\n case StyleSizeEnum.Large:\n return 'p-button-lg mng-button-lg';\n case StyleSizeEnum.ExtraLarge:\n return 'p-button-lg mng-button-xl';\n case StyleSizeEnum.Normal:\n default:\n return '';\n }\n }\n}\n","// data providers\nexport * from './data-providers/lookup.data-provider';\nexport * from './data-providers/lookup-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/action-button.descriptor';\nexport * from './descriptors/button-style.builder';\n\n// models\nexport * from './models/button.model';\nexport * from './models/trim.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEM,MAAO,sBACT,SAAQ,gBAA8C,CAAA;AAKtD,IAAA,WAAA,CAAmB,WAAyB,EAAA;QACxC,KAAK,CAAC,WAAW,CAAC;AAHZ,QAAA,IAAA,CAAA,OAAO,GAAmE,MAAM,EAAE;;AAM5F,IAAA,IAA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CAAC,MAAM;AACf,YAAA,KAAK,SAAS;YACd,KAAK,cAAc,CAAC,OAAO;YAC3B,KAAK,cAAc,CAAC,OAAO;AACvB,gBAAA,OAAO,kBAAkB;YAC7B,KAAK,cAAc,CAAC,SAAS;AACzB,gBAAA,OAAO,oBAAoB;YAC/B,KAAK,cAAc,CAAC,IAAI;AACpB,gBAAA,OAAO,eAAe;YAC1B,KAAK,cAAc,CAAC,IAAI;AACpB,gBAAA,OAAO,eAAe;YAC1B,KAAK,cAAc,CAAC,OAAO;AACvB,gBAAA,OAAO,kBAAkB;YAC7B,KAAK,cAAc,CAAC,OAAO;AACvB,gBAAA,OAAO,kBAAkB;YAC7B,KAAK,cAAc,CAAC,MAAM;AACtB,gBAAA,OAAO,iBAAiB;;;IAI5B,gBAAgB,GAAA;AACpB,QAAA,QAAQ,IAAI,CAAC,KAAK;YACd,KAAK,aAAa,CAAC,UAAU;AACzB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,KAAK;AACpB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,KAAK;AACpB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,UAAU;AACzB,gBAAA,OAAO,2BAA2B;YACtC,KAAK,aAAa,CAAC,MAAM;AACzB,YAAA;AACI,gBAAA,OAAO,EAAE;;;AAGxB;;AC1LD;;ACAA;;AAEG;;;;"}
@@ -0,0 +1,97 @@
1
+ import { DataProviderInst, TypeRegistry, findReflectTypeName } from '@mediusinc/mng-commons/core';
2
+ import { ModelDescriptor, TypeDescriptor } from '@mediusinc/mng-commons/model';
3
+
4
+ function dataProviderFromClass(type, serviceType) {
5
+ return new DataProviderInst(serviceType);
6
+ }
7
+
8
+ function findClassIdAttribute(classType) {
9
+ if (!classType)
10
+ return null;
11
+ const attrDef = getClassAttributeDef(classType);
12
+ if (!attrDef) {
13
+ return null;
14
+ }
15
+ let idAttribute = findAttributeByTypeAndName(attrDef, ['string', 'number'], 'id', 'uuid', 'code', 'sifra');
16
+ if (!idAttribute) {
17
+ // if no id or code, take the first attribute
18
+ idAttribute = attrDef[0];
19
+ }
20
+ return idAttribute?.name ?? null;
21
+ }
22
+ function findClassTitleAttribute(classType) {
23
+ if (!classType)
24
+ return null;
25
+ const attrDef = getClassAttributeDef(classType);
26
+ if (!attrDef) {
27
+ return null;
28
+ }
29
+ let titleAttribute = findAttributeByTypeAndName(attrDef, ['string'], 'name', 'ime', 'title', 'naziv');
30
+ if (!titleAttribute) {
31
+ // if no name or title, take the first attribute
32
+ titleAttribute = attrDef[0];
33
+ }
34
+ return titleAttribute?.name ?? null;
35
+ }
36
+ function getClassAttributeDef(classType) {
37
+ if (!classType)
38
+ return null;
39
+ const attrDefByFn = classType.getAttributeTypeMap?.();
40
+ if (attrDefByFn)
41
+ return attrDefByFn;
42
+ const attrDefByProp = classType.attributeTypeMap;
43
+ if (attrDefByProp)
44
+ return attrDefByProp;
45
+ const attrByObjSer = TypeRegistry.get().findAttributesDefinitionByClassType(classType);
46
+ if (attrByObjSer)
47
+ return attrByObjSer;
48
+ return null;
49
+ }
50
+ function findAttributeByTypeAndName(attributes, types, ...names) {
51
+ for (const name of names) {
52
+ const attribute = attributes.find(a => types.some(t => t === a.type) && a.name === name);
53
+ if (attribute) {
54
+ return attribute;
55
+ }
56
+ }
57
+ return null;
58
+ }
59
+
60
+ class ModelClassDescriptor extends ModelDescriptor {
61
+ constructor(_type, idProperty, titleProperty, i18nBaseKey) {
62
+ super(idProperty, titleProperty, i18nBaseKey);
63
+ this._classType = _type;
64
+ }
65
+ get classType() {
66
+ return this._classType;
67
+ }
68
+ copy() {
69
+ return new ModelClassDescriptor(this._classType, this._idProperty, this._titleProperty, this._i18nBaseKey);
70
+ }
71
+ }
72
+ function modelClass(type, opts) {
73
+ let idProperty = opts?.id;
74
+ if (!idProperty && type) {
75
+ idProperty = findClassIdAttribute(type) ?? undefined;
76
+ }
77
+ let titleProp = opts?.title;
78
+ if (!titleProp && type) {
79
+ titleProp = findClassTitleAttribute(type) ?? undefined;
80
+ }
81
+ const i18nBaseKey = opts?.i18nBase != null ? (typeof opts?.i18nBase === 'string' ? opts.i18nBase : findReflectTypeName(opts.i18nBase)) : findReflectTypeName(type);
82
+ return new ModelClassDescriptor(type, idProperty, titleProp, i18nBaseKey ?? undefined);
83
+ }
84
+
85
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
+ function typeFromClass(type) {
87
+ return new TypeDescriptor();
88
+ }
89
+
90
+ // data providers
91
+
92
+ /**
93
+ * Generated bundle index. Do not edit.
94
+ */
95
+
96
+ export { ModelClassDescriptor, dataProviderFromClass, findClassIdAttribute, findClassTitleAttribute, getClassAttributeDef, modelClass, typeFromClass };
97
+ //# sourceMappingURL=mediusinc-mng-commons-model-class.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediusinc-mng-commons-model-class.mjs","sources":["../../model/class/src/data-providers/base-from-class-data-provider.factory.ts","../../model/class/src/helpers/model.ts","../../model/class/src/descriptors/model-class.descriptor.ts","../../model/class/src/descriptors/type-class.descriptor.ts","../../model/class/src/index.ts","../../model/class/src/mediusinc-mng-commons-model-class.ts"],"sourcesContent":["import {ClassType, DataProviderInst, ServiceClassType} from '@mediusinc/mng-commons/core';\n\nexport function dataProviderFromClass<Model>(type: ClassType<Model>): DataProviderInst<Model, undefined, undefined>;\nexport function dataProviderFromClass<Model, Service = any>(\n type: ClassType<Model>,\n ServiceClass: ServiceClassType<Service>\n): DataProviderInst<Model, Service, ServiceClassType<Service>>;\nexport function dataProviderFromClass<Model, Service = any, ServiceClass = ServiceClassType<Service>>(type: ClassType<Model>, serviceType?: ServiceClass) {\n return new DataProviderInst<Model, Service, ServiceClass>(serviceType as ServiceClass);\n}\n","import {ClassAttributeDef, ClassType, TypeRegistry} from '@mediusinc/mng-commons/core';\n\nexport function findClassIdAttribute<T>(classType?: ClassType<T>): string | null {\n if (!classType) return null;\n\n const attrDef = getClassAttributeDef(classType);\n if (!attrDef) {\n return null;\n }\n\n let idAttribute = findAttributeByTypeAndName(attrDef, ['string', 'number'], 'id', 'uuid', 'code', 'sifra');\n if (!idAttribute) {\n // if no id or code, take the first attribute\n idAttribute = attrDef[0];\n }\n\n return idAttribute?.name ?? null;\n}\n\nexport function findClassTitleAttribute<T>(classType?: ClassType<T>): string | null {\n if (!classType) return null;\n\n const attrDef = getClassAttributeDef(classType);\n if (!attrDef) {\n return null;\n }\n\n let titleAttribute = findAttributeByTypeAndName(attrDef, ['string'], 'name', 'ime', 'title', 'naziv');\n if (!titleAttribute) {\n // if no name or title, take the first attribute\n titleAttribute = attrDef[0];\n }\n\n return titleAttribute?.name ?? null;\n}\n\nexport function getClassAttributeDef<T>(classType?: ClassType<T>) {\n if (!classType) return null;\n const attrDefByFn = (classType as any).getAttributeTypeMap?.() as Array<ClassAttributeDef> | undefined;\n if (attrDefByFn) return attrDefByFn;\n const attrDefByProp = (classType as any).attributeTypeMap as Array<ClassAttributeDef> | undefined;\n if (attrDefByProp) return attrDefByProp;\n const attrByObjSer = TypeRegistry.get().findAttributesDefinitionByClassType(classType);\n if (attrByObjSer) return attrByObjSer;\n return null;\n}\n\nfunction findAttributeByTypeAndName(attributes: ClassAttributeDef[], types: string[], ...names: string[]): ClassAttributeDef | null {\n for (const name of names) {\n const attribute = attributes.find(a => types.some(t => t === a.type) && a.name === name);\n if (attribute) {\n return attribute;\n }\n }\n return null;\n}\n","import {ClassType, IModelDescriptor, findReflectTypeName} from '@mediusinc/mng-commons/core';\nimport {ModelDescriptor, ModelDescriptorCreateOpts} from '@mediusinc/mng-commons/model';\n\nimport {findClassIdAttribute, findClassTitleAttribute} from '../helpers/model';\n\nexport class ModelClassDescriptor<Model> extends ModelDescriptor<Model> implements IModelDescriptor<Model> {\n private readonly _classType: ClassType<Model>;\n\n public constructor(_type: ClassType<Model>, idProperty?: string, titleProperty?: string | ((item: Model) => string), i18nBaseKey?: string) {\n super(idProperty, titleProperty, i18nBaseKey);\n this._classType = _type;\n }\n\n public get classType() {\n return this._classType;\n }\n\n public override copy(): ModelClassDescriptor<Model> {\n return new ModelClassDescriptor<Model>(this._classType, this._idProperty, this._titleProperty, this._i18nBaseKey);\n }\n}\n\nexport type ModelClassDescriptorCreateOpts<Model> = Omit<ModelDescriptorCreateOpts<Model>, 'i18nBase'> & {\n i18nBase?: string | ClassType<unknown>;\n};\n\nexport function modelClass<Model>(type: ClassType<Model>, opts?: ModelClassDescriptorCreateOpts<Model>): ModelClassDescriptor<Model> {\n let idProperty = opts?.id as string | undefined;\n if (!idProperty && type) {\n idProperty = findClassIdAttribute(type as unknown as ClassType<Model>) ?? undefined;\n }\n let titleProp = opts?.title as string | ((item: Model) => string) | undefined;\n if (!titleProp && type) {\n titleProp = findClassTitleAttribute(type as unknown as ClassType<Model>) ?? undefined;\n }\n const i18nBaseKey =\n opts?.i18nBase != null ? (typeof opts?.i18nBase === 'string' ? opts.i18nBase : findReflectTypeName(opts.i18nBase)) : findReflectTypeName(type as ClassType<Model>);\n return new ModelClassDescriptor<Model>(type, idProperty, titleProp, i18nBaseKey ?? undefined);\n}\n","import {ClassType} from '@mediusinc/mng-commons/core';\nimport {TypeDescriptor} from '@mediusinc/mng-commons/model';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function typeFromClass<Type>(type: ClassType<Type>): TypeDescriptor<Type> {\n return new TypeDescriptor<Type>();\n}\n","// data providers\nexport * from './data-providers/base-from-class-data-provider.factory';\n\n// descriptors\nexport * from './descriptors/model-class.descriptor';\nexport * from './descriptors/type-class.descriptor';\n\n// helpers\nexport * from './helpers/model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAOgB,SAAA,qBAAqB,CAAiE,IAAsB,EAAE,WAA0B,EAAA;AACpJ,IAAA,OAAO,IAAI,gBAAgB,CAA+B,WAA2B,CAAC;AAC1F;;ACPM,SAAU,oBAAoB,CAAI,SAAwB,EAAA;AAC5D,IAAA,IAAI,CAAC,SAAS;AAAE,QA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