@acorex/platform 18.2.2 → 18.2.4

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 (324) hide show
  1. package/common/lib/app/operators.d.ts +1 -0
  2. package/common/lib/common.module.d.ts +6 -7
  3. package/common/lib/data/filter-middleware.service.d.ts +28 -0
  4. package/common/lib/data/index.d.ts +3 -1
  5. package/common/lib/data/operators.service.d.ts +14 -0
  6. package/common/lib/layout/index.d.ts +0 -2
  7. package/common/lib/schema/widgets/dateTime/dateTime-widget-edit.component.d.ts +0 -2
  8. package/common/lib/schema/widgets/dateTime/dateTime-widget-filter.component.d.ts +1 -0
  9. package/common/lib/schema/widgets/email/email-widget-edit.component.d.ts +0 -2
  10. package/common/lib/schema/widgets/phone/phone-widget-edit.component.d.ts +0 -2
  11. package/common/lib/schema/widgets/text/text-widget-edit.component.d.ts +0 -2
  12. package/common/lib/settings/setting-definition.provider.d.ts +6 -6
  13. package/common/lib/settings/settings.types.d.ts +18 -9
  14. package/esm2022/common/lib/app/operators.mjs +16 -1
  15. package/esm2022/common/lib/common.module.mjs +23 -12
  16. package/esm2022/common/lib/data/filter-middleware.service.mjs +53 -0
  17. package/esm2022/common/lib/data/index.mjs +4 -2
  18. package/esm2022/common/lib/data/operators.service.mjs +15 -0
  19. package/esm2022/common/lib/layout/index.mjs +1 -3
  20. package/esm2022/common/lib/layout/menu/menu.service.mjs +2 -2
  21. package/esm2022/common/lib/layout/sticky.directive.mjs +15 -11
  22. package/esm2022/common/lib/schema/widgets/dateTime/dateTime-widget-edit.component.mjs +7 -8
  23. package/esm2022/common/lib/schema/widgets/dateTime/dateTime-widget-filter.component.mjs +47 -25
  24. package/esm2022/common/lib/schema/widgets/email/email-widget-edit.component.mjs +6 -7
  25. package/esm2022/common/lib/schema/widgets/phone/phone-widget-edit.component.mjs +6 -7
  26. package/esm2022/common/lib/schema/widgets/text/text-widget-edit.component.mjs +6 -7
  27. package/esm2022/common/lib/settings/setting-definition.provider.mjs +141 -187
  28. package/esm2022/common/lib/settings/settings.types.mjs +2 -7
  29. package/esm2022/common/lib/utils/data-generator.mjs +1 -1
  30. package/esm2022/layout/builder/lib/builder/widget-catalog.mjs +2 -1
  31. package/esm2022/layout/builder/lib/builder/widget-column-renderer.mjs +22 -11
  32. package/esm2022/layout/builder/lib/builder/widget.types.mjs +11 -6
  33. package/esm2022/layout/designer/lib/designer/components/header-menu/header-menu.component.mjs +2 -7
  34. package/esm2022/layout/designer/lib/designer/components/size-mode/view-size-toolbar.component.mjs +27 -32
  35. package/esm2022/layout/entity/lib/entity-detail-list.viewmodel.mjs +8 -6
  36. package/esm2022/layout/entity/lib/entity-master-create.viewmodel.mjs +4 -3
  37. package/esm2022/layout/entity/lib/entity-master-list.viewmodel.mjs +39 -12
  38. package/esm2022/layout/entity/lib/entity-master-single.viewmodel.mjs +4 -3
  39. package/esm2022/layout/entity/lib/entity-master-update.viewmodel.mjs +3 -3
  40. package/esm2022/layout/entity/lib/entity.module.mjs +1 -6
  41. package/esm2022/layout/entity/lib/index.mjs +5 -4
  42. package/esm2022/layout/setting/acorex-platform-layout-setting.mjs +5 -0
  43. package/esm2022/layout/setting/index.mjs +2 -0
  44. package/esm2022/layout/setting/lib/convert-setting-data.mjs +59 -0
  45. package/esm2022/layout/setting/lib/setting.viewmodel.mjs +132 -0
  46. package/esm2022/layouts/lib/admin/admin.module.mjs +17 -5
  47. package/esm2022/layouts/lib/admin/entity-layout/entity-create-view/entity-create-view.config.mjs +3 -3
  48. package/esm2022/layouts/lib/admin/entity-layout/entity-details-view/detail-view.config.mjs +4 -3
  49. package/esm2022/layouts/lib/admin/entity-layout/entity-details-view/entity-details-view.component.mjs +8 -23
  50. package/esm2022/layouts/lib/admin/entity-layout/entity-list-view/components/list-view-option-columns/list-view-option-columns.component.mjs +2 -6
  51. package/esm2022/layouts/lib/admin/entity-layout/entity-list-view/components/list-view-option-conditions/list-view-option-conditions.component.mjs +4 -5
  52. package/esm2022/layouts/lib/admin/entity-layout/entity-list-view/entity-list-view.component.mjs +4 -8
  53. package/esm2022/layouts/lib/admin/entity-layout/entity-list-view/list-view.config.mjs +12 -10
  54. package/esm2022/layouts/lib/admin/entity-layout/entity-modify-view/entity-modify-view.config.mjs +3 -3
  55. package/esm2022/layouts/lib/admin/entity-layout/entity-quick-view/entity-quick-view.component.mjs +1 -3
  56. package/esm2022/themes/default/index.mjs +2 -1
  57. package/esm2022/themes/default/lib/default.module.mjs +83 -39
  58. package/esm2022/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.mjs +18 -24
  59. package/esm2022/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.mjs +21 -24
  60. package/esm2022/themes/default/lib/layouts/entity-layouts/entity-master-list-view/list-view-option-columns/list-view-option-columns.component.mjs +18 -12
  61. package/esm2022/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.mjs +6 -8
  62. package/esm2022/themes/default/lib/layouts/root-layout/components/header/header.component.mjs +6 -8
  63. package/esm2022/themes/default/lib/layouts/root-layout/components/menu/root-menu.component.mjs +1 -1
  64. package/esm2022/themes/default/lib/layouts/root-layout/root-layout.component.mjs +11 -38
  65. package/esm2022/themes/default/lib/layouts/setting-layout/index.mjs +3 -0
  66. package/esm2022/themes/default/lib/layouts/setting-layout/setting-menu/setting-menu.component.mjs +28 -0
  67. package/esm2022/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.mjs +42 -0
  68. package/esm2022/themes/shared/lib/services/theme.service.mjs +183 -19
  69. package/esm2022/widgets/lib/properties/layout.props.mjs +13 -13
  70. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget-column.component.mjs +20 -0
  71. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget-designer.component.mjs +18 -0
  72. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget-edit.component.mjs +24 -0
  73. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget-filter.component.mjs +20 -0
  74. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget-print.component.mjs +19 -0
  75. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget-view.component.mjs +22 -0
  76. package/esm2022/widgets/lib/widgets/advance/cron-job/cron-job-widget.config.mjs +32 -0
  77. package/esm2022/widgets/lib/widgets/advance/cron-job/index.mjs +8 -0
  78. package/esm2022/widgets/lib/widgets/editors/selection-list/selection-list-widget-designer.component.mjs +4 -9
  79. package/esm2022/widgets/lib/widgets/editors/selection-list/selection-list-widget-edit.component.mjs +2 -9
  80. package/esm2022/widgets/lib/widgets/layout/block/block-widget.config.mjs +6 -7
  81. package/esm2022/widgets/lib/widgets.module.mjs +5 -2
  82. package/esm2022/workflow/lib/workflow.service.mjs +1 -1
  83. package/fesm2022/{acorex-platform-common-avatar-widget-edit.component-vDhYokEG.mjs → acorex-platform-common-avatar-widget-edit.component-DtC2IaE8.mjs} +3 -4
  84. package/fesm2022/{acorex-platform-common-avatar-widget-edit.component-vDhYokEG.mjs.map → acorex-platform-common-avatar-widget-edit.component-DtC2IaE8.mjs.map} +1 -1
  85. package/fesm2022/{acorex-platform-common-avatar-widget-view.component-Dew3CVLm.mjs → acorex-platform-common-avatar-widget-view.component-BOIV0Be1.mjs} +4 -5
  86. package/fesm2022/acorex-platform-common-avatar-widget-view.component-BOIV0Be1.mjs.map +1 -0
  87. package/fesm2022/{acorex-platform-common-boolean-widget-filter.component-BdE7WOK5.mjs → acorex-platform-common-boolean-widget-filter.component-S4-3SmKA.mjs} +3 -4
  88. package/fesm2022/acorex-platform-common-boolean-widget-filter.component-S4-3SmKA.mjs.map +1 -0
  89. package/fesm2022/{acorex-platform-common-checkbox-widget-column.component-Bj5rjEk1.mjs → acorex-platform-common-checkbox-widget-column.component-DOoneR7g.mjs} +4 -5
  90. package/fesm2022/{acorex-platform-common-checkbox-widget-column.component-Bj5rjEk1.mjs.map → acorex-platform-common-checkbox-widget-column.component-DOoneR7g.mjs.map} +1 -1
  91. package/fesm2022/{acorex-platform-common-checkbox-widget-edit.component-ChXbJsuG.mjs → acorex-platform-common-checkbox-widget-edit.component-PFRq-XS-.mjs} +4 -5
  92. package/fesm2022/acorex-platform-common-checkbox-widget-edit.component-PFRq-XS-.mjs.map +1 -0
  93. package/fesm2022/{acorex-platform-common-checkbox-widget-view.component-CbQwjE_u.mjs → acorex-platform-common-checkbox-widget-view.component-CKz8XnjT.mjs} +4 -5
  94. package/fesm2022/{acorex-platform-common-checkbox-widget-view.component-CbQwjE_u.mjs.map → acorex-platform-common-checkbox-widget-view.component-CKz8XnjT.mjs.map} +1 -1
  95. package/fesm2022/{acorex-platform-common-dateTime-widget-column.component-QUYyDVw8.mjs → acorex-platform-common-dateTime-widget-column.component-DG0leXAo.mjs} +4 -5
  96. package/fesm2022/acorex-platform-common-dateTime-widget-column.component-DG0leXAo.mjs.map +1 -0
  97. package/fesm2022/{acorex-platform-common-dateTime-widget-edit.component-CzLb3xnR.mjs → acorex-platform-common-dateTime-widget-edit.component-D8W-XEcx.mjs} +10 -13
  98. package/fesm2022/acorex-platform-common-dateTime-widget-edit.component-D8W-XEcx.mjs.map +1 -0
  99. package/fesm2022/{acorex-platform-common-dateTime-widget-filter.component-DZRQ6yVk.mjs → acorex-platform-common-dateTime-widget-filter.component-DngCKwFY.mjs} +49 -28
  100. package/fesm2022/acorex-platform-common-dateTime-widget-filter.component-DngCKwFY.mjs.map +1 -0
  101. package/fesm2022/{acorex-platform-common-dateTime-widget-view.component-DxNwm_5m.mjs → acorex-platform-common-dateTime-widget-view.component-KGgJkiKB.mjs} +4 -5
  102. package/fesm2022/{acorex-platform-common-dateTime-widget-view.component-DxNwm_5m.mjs.map → acorex-platform-common-dateTime-widget-view.component-KGgJkiKB.mjs.map} +1 -1
  103. package/fesm2022/{acorex-platform-common-email-widget-column.component-Cm-fhlNZ.mjs → acorex-platform-common-email-widget-column.component-CLNqSuB7.mjs} +4 -5
  104. package/fesm2022/acorex-platform-common-email-widget-column.component-CLNqSuB7.mjs.map +1 -0
  105. package/fesm2022/{acorex-platform-common-email-widget-edit.component-BfXFBLF6.mjs → acorex-platform-common-email-widget-edit.component--0gaRm4s.mjs} +9 -11
  106. package/fesm2022/acorex-platform-common-email-widget-edit.component--0gaRm4s.mjs.map +1 -0
  107. package/fesm2022/{acorex-platform-common-email-widget-view.component-ClRjKVy6.mjs → acorex-platform-common-email-widget-view.component-C3AUr1HO.mjs} +4 -5
  108. package/fesm2022/{acorex-platform-common-email-widget-view.component-ClRjKVy6.mjs.map → acorex-platform-common-email-widget-view.component-C3AUr1HO.mjs.map} +1 -1
  109. package/fesm2022/{acorex-platform-common-file-widget-column.component-B0v2rSWI.mjs → acorex-platform-common-file-widget-column.component-C9AHk2UP.mjs} +4 -5
  110. package/fesm2022/acorex-platform-common-file-widget-column.component-C9AHk2UP.mjs.map +1 -0
  111. package/fesm2022/{acorex-platform-common-file-widget-edit.component-DsIqehpt.mjs → acorex-platform-common-file-widget-edit.component-L7bln9k0.mjs} +4 -5
  112. package/fesm2022/{acorex-platform-common-file-widget-edit.component-DsIqehpt.mjs.map → acorex-platform-common-file-widget-edit.component-L7bln9k0.mjs.map} +1 -1
  113. package/fesm2022/{acorex-platform-common-file-widget-filter.component-C3uBjqF-.mjs → acorex-platform-common-file-widget-filter.component-Ce35mqny.mjs} +4 -5
  114. package/fesm2022/acorex-platform-common-file-widget-filter.component-Ce35mqny.mjs.map +1 -0
  115. package/fesm2022/{acorex-platform-common-file-widget-view.component-DTl_Rehd.mjs → acorex-platform-common-file-widget-view.component-BvMzrs5C.mjs} +4 -5
  116. package/fesm2022/{acorex-platform-common-file-widget-view.component-DTl_Rehd.mjs.map → acorex-platform-common-file-widget-view.component-BvMzrs5C.mjs.map} +1 -1
  117. package/fesm2022/{acorex-platform-common-gallery-widget-edit.component-DHeFVg5x.mjs → acorex-platform-common-gallery-widget-edit.component-BVuV2Ib8.mjs} +3 -4
  118. package/fesm2022/{acorex-platform-common-gallery-widget-edit.component-DHeFVg5x.mjs.map → acorex-platform-common-gallery-widget-edit.component-BVuV2Ib8.mjs.map} +1 -1
  119. package/fesm2022/{acorex-platform-common-gallery-widget-filter.component-Di446i2c.mjs → acorex-platform-common-gallery-widget-filter.component-C8tdM6PX.mjs} +4 -5
  120. package/fesm2022/acorex-platform-common-gallery-widget-filter.component-C8tdM6PX.mjs.map +1 -0
  121. package/fesm2022/{acorex-platform-common-gallery-widget-view.component-CkcRvfv-.mjs → acorex-platform-common-gallery-widget-view.component-D8YmSi9C.mjs} +3 -4
  122. package/fesm2022/{acorex-platform-common-gallery-widget-view.component-CkcRvfv-.mjs.map → acorex-platform-common-gallery-widget-view.component-D8YmSi9C.mjs.map} +1 -1
  123. package/fesm2022/{acorex-platform-common-largetext-widget-edit.component-D89AlBSm.mjs → acorex-platform-common-largetext-widget-edit.component-DGMxpnsr.mjs} +4 -5
  124. package/fesm2022/acorex-platform-common-largetext-widget-edit.component-DGMxpnsr.mjs.map +1 -0
  125. package/fesm2022/{acorex-platform-common-lookup-widget-column.component-CB0ehp_y.mjs → acorex-platform-common-lookup-widget-column.component-B-cEaNjv.mjs} +4 -5
  126. package/fesm2022/acorex-platform-common-lookup-widget-column.component-B-cEaNjv.mjs.map +1 -0
  127. package/fesm2022/{acorex-platform-common-lookup-widget-edit.component-B0HQnsb8.mjs → acorex-platform-common-lookup-widget-edit.component-DqB_g9Zz.mjs} +4 -5
  128. package/fesm2022/{acorex-platform-common-lookup-widget-edit.component-B0HQnsb8.mjs.map → acorex-platform-common-lookup-widget-edit.component-DqB_g9Zz.mjs.map} +1 -1
  129. package/fesm2022/{acorex-platform-common-lookup-widget-filter.component-Dxj_XEYV.mjs → acorex-platform-common-lookup-widget-filter.component-0TPWNWSd.mjs} +3 -4
  130. package/fesm2022/acorex-platform-common-lookup-widget-filter.component-0TPWNWSd.mjs.map +1 -0
  131. package/fesm2022/{acorex-platform-common-lookup-widget-view.component-BtO3feA9.mjs → acorex-platform-common-lookup-widget-view.component-DYAg76YH.mjs} +4 -5
  132. package/fesm2022/acorex-platform-common-lookup-widget-view.component-DYAg76YH.mjs.map +1 -0
  133. package/fesm2022/{acorex-platform-common-map-widget-edit.component-hXIZrhzg.mjs → acorex-platform-common-map-widget-edit.component-C3cpsXD5.mjs} +4 -5
  134. package/fesm2022/acorex-platform-common-map-widget-edit.component-C3cpsXD5.mjs.map +1 -0
  135. package/fesm2022/{acorex-platform-common-map-widget-view.component-RgV-r8q6.mjs → acorex-platform-common-map-widget-view.component-C-DCNaJi.mjs} +4 -5
  136. package/fesm2022/acorex-platform-common-map-widget-view.component-C-DCNaJi.mjs.map +1 -0
  137. package/fesm2022/{acorex-platform-common-messenger-widget-column.component-DGWQWuzM.mjs → acorex-platform-common-messenger-widget-column.component-B2A7ZBEP.mjs} +4 -5
  138. package/fesm2022/acorex-platform-common-messenger-widget-column.component-B2A7ZBEP.mjs.map +1 -0
  139. package/fesm2022/{acorex-platform-common-messenger-widget-edit.component-Blv1qL4e.mjs → acorex-platform-common-messenger-widget-edit.component-DC8vQDo0.mjs} +4 -5
  140. package/fesm2022/acorex-platform-common-messenger-widget-edit.component-DC8vQDo0.mjs.map +1 -0
  141. package/fesm2022/{acorex-platform-common-messenger-widget-view.component-DEbnPggG.mjs → acorex-platform-common-messenger-widget-view.component-B6FavkmG.mjs} +4 -5
  142. package/fesm2022/{acorex-platform-common-messenger-widget-view.component-DEbnPggG.mjs.map → acorex-platform-common-messenger-widget-view.component-B6FavkmG.mjs.map} +1 -1
  143. package/fesm2022/{acorex-platform-common-number-widget-edit.component-gQCEBhPv.mjs → acorex-platform-common-number-widget-edit.component-Bc5-ZUw4.mjs} +4 -5
  144. package/fesm2022/acorex-platform-common-number-widget-edit.component-Bc5-ZUw4.mjs.map +1 -0
  145. package/fesm2022/{acorex-platform-common-number-widget-filter.component-CvEw3awN.mjs → acorex-platform-common-number-widget-filter.component-DxfJ90n4.mjs} +4 -5
  146. package/fesm2022/acorex-platform-common-number-widget-filter.component-DxfJ90n4.mjs.map +1 -0
  147. package/fesm2022/{acorex-platform-common-number-widget-view.component-ROrdklif.mjs → acorex-platform-common-number-widget-view.component-DGfLSGw1.mjs} +4 -5
  148. package/fesm2022/acorex-platform-common-number-widget-view.component-DGfLSGw1.mjs.map +1 -0
  149. package/fesm2022/{acorex-platform-common-password-widget-column.component-vXdE4UjM.mjs → acorex-platform-common-password-widget-column.component-DEHaVLGK.mjs} +4 -5
  150. package/fesm2022/{acorex-platform-common-password-widget-column.component-vXdE4UjM.mjs.map → acorex-platform-common-password-widget-column.component-DEHaVLGK.mjs.map} +1 -1
  151. package/fesm2022/{acorex-platform-common-password-widget-edit.component-BCOoHtGl.mjs → acorex-platform-common-password-widget-edit.component-DrYyu5v-.mjs} +4 -5
  152. package/fesm2022/acorex-platform-common-password-widget-edit.component-DrYyu5v-.mjs.map +1 -0
  153. package/fesm2022/{acorex-platform-common-password-widget-view.component-rpjAeimk.mjs → acorex-platform-common-password-widget-view.component-B_HU-3J1.mjs} +4 -4
  154. package/fesm2022/{acorex-platform-common-password-widget-view.component-rpjAeimk.mjs.map → acorex-platform-common-password-widget-view.component-B_HU-3J1.mjs.map} +1 -1
  155. package/fesm2022/{acorex-platform-common-phone-widget-column.component-BbuUbPCu.mjs → acorex-platform-common-phone-widget-column.component-D99ncxxJ.mjs} +4 -5
  156. package/fesm2022/{acorex-platform-common-phone-widget-column.component-BbuUbPCu.mjs.map → acorex-platform-common-phone-widget-column.component-D99ncxxJ.mjs.map} +1 -1
  157. package/fesm2022/{acorex-platform-common-phone-widget-edit.component-Bo_aOxfZ.mjs → acorex-platform-common-phone-widget-edit.component-a5EAI9FK.mjs} +8 -10
  158. package/fesm2022/acorex-platform-common-phone-widget-edit.component-a5EAI9FK.mjs.map +1 -0
  159. package/fesm2022/{acorex-platform-common-phone-widget-view.component-DDBCR_QY.mjs → acorex-platform-common-phone-widget-view.component-BlFVuoNN.mjs} +4 -5
  160. package/fesm2022/{acorex-platform-common-phone-widget-view.component-DDBCR_QY.mjs.map → acorex-platform-common-phone-widget-view.component-BlFVuoNN.mjs.map} +1 -1
  161. package/fesm2022/{acorex-platform-common-rich-text-widget-column.component-BHiq7hdp.mjs → acorex-platform-common-rich-text-widget-column.component-DOdv5I2s.mjs} +4 -5
  162. package/fesm2022/{acorex-platform-common-rich-text-widget-column.component-BHiq7hdp.mjs.map → acorex-platform-common-rich-text-widget-column.component-DOdv5I2s.mjs.map} +1 -1
  163. package/fesm2022/{acorex-platform-common-rich-text-widget-edit.component-12odUyzb.mjs → acorex-platform-common-rich-text-widget-edit.component-DL5UyAqe.mjs} +4 -5
  164. package/fesm2022/acorex-platform-common-rich-text-widget-edit.component-DL5UyAqe.mjs.map +1 -0
  165. package/fesm2022/{acorex-platform-common-rich-text-widget-view.component-Xr0ohz5L.mjs → acorex-platform-common-rich-text-widget-view.component-B9WB-mx9.mjs} +4 -5
  166. package/fesm2022/acorex-platform-common-rich-text-widget-view.component-B9WB-mx9.mjs.map +1 -0
  167. package/fesm2022/{acorex-platform-common-selection-list-widget-column.component-C2JikSdw.mjs → acorex-platform-common-selection-list-widget-column.component-CkOuYy0Z.mjs} +4 -5
  168. package/fesm2022/{acorex-platform-common-selection-list-widget-column.component-C2JikSdw.mjs.map → acorex-platform-common-selection-list-widget-column.component-CkOuYy0Z.mjs.map} +1 -1
  169. package/fesm2022/{acorex-platform-common-selection-list-widget-edit.component-C1QPfHCm.mjs → acorex-platform-common-selection-list-widget-edit.component-BmbDQ1LH.mjs} +4 -5
  170. package/fesm2022/acorex-platform-common-selection-list-widget-edit.component-BmbDQ1LH.mjs.map +1 -0
  171. package/fesm2022/{acorex-platform-common-selection-list-widget-filter.component-DIgxHmqa.mjs → acorex-platform-common-selection-list-widget-filter.component-Dm_1-7eT.mjs} +3 -4
  172. package/fesm2022/acorex-platform-common-selection-list-widget-filter.component-Dm_1-7eT.mjs.map +1 -0
  173. package/fesm2022/{acorex-platform-common-selection-list-widget-view.component-D-VQ4JNC.mjs → acorex-platform-common-selection-list-widget-view.component-3hinF85C.mjs} +4 -5
  174. package/fesm2022/acorex-platform-common-selection-list-widget-view.component-3hinF85C.mjs.map +1 -0
  175. package/fesm2022/{acorex-platform-common-signature-pad-widget-edit.component-BimaJ4_d.mjs → acorex-platform-common-signature-pad-widget-edit.component-DmmPbw-A.mjs} +3 -4
  176. package/fesm2022/{acorex-platform-common-signature-pad-widget-edit.component-BimaJ4_d.mjs.map → acorex-platform-common-signature-pad-widget-edit.component-DmmPbw-A.mjs.map} +1 -1
  177. package/fesm2022/{acorex-platform-common-signature-pad-widget-view.component-USd0U707.mjs → acorex-platform-common-signature-pad-widget-view.component-DkFaMNk8.mjs} +4 -5
  178. package/fesm2022/acorex-platform-common-signature-pad-widget-view.component-DkFaMNk8.mjs.map +1 -0
  179. package/fesm2022/{acorex-platform-common-string-widget-filter.component-wI9D-Ju5.mjs → acorex-platform-common-string-widget-filter.component-DAqR2PUN.mjs} +4 -5
  180. package/fesm2022/acorex-platform-common-string-widget-filter.component-DAqR2PUN.mjs.map +1 -0
  181. package/fesm2022/{acorex-platform-common-text-widget-column.component-Be7Nr0lJ.mjs → acorex-platform-common-text-widget-column.component-DVczwvKA.mjs} +4 -5
  182. package/fesm2022/{acorex-platform-common-text-widget-column.component-Be7Nr0lJ.mjs.map → acorex-platform-common-text-widget-column.component-DVczwvKA.mjs.map} +1 -1
  183. package/fesm2022/{acorex-platform-common-text-widget-edit.component-feJTTnye.mjs → acorex-platform-common-text-widget-edit.component-DC_GnFhe.mjs} +9 -12
  184. package/fesm2022/acorex-platform-common-text-widget-edit.component-DC_GnFhe.mjs.map +1 -0
  185. package/fesm2022/{acorex-platform-common-text-widget-view.component-DsUAJ-md.mjs → acorex-platform-common-text-widget-view.component-BK3HZGgb.mjs} +4 -5
  186. package/fesm2022/{acorex-platform-common-text-widget-view.component-DsUAJ-md.mjs.map → acorex-platform-common-text-widget-view.component-BK3HZGgb.mjs.map} +1 -1
  187. package/fesm2022/{acorex-platform-common-toggle-widget-column.component-BFwzsY4-.mjs → acorex-platform-common-toggle-widget-column.component-Bp1d7SAE.mjs} +4 -5
  188. package/fesm2022/{acorex-platform-common-toggle-widget-column.component-BFwzsY4-.mjs.map → acorex-platform-common-toggle-widget-column.component-Bp1d7SAE.mjs.map} +1 -1
  189. package/fesm2022/{acorex-platform-common-toggle-widget-edit.component-Cuf9_RrU.mjs → acorex-platform-common-toggle-widget-edit.component-D64m4agx.mjs} +4 -5
  190. package/fesm2022/acorex-platform-common-toggle-widget-edit.component-D64m4agx.mjs.map +1 -0
  191. package/fesm2022/{acorex-platform-common-toggle-widget-view.component-DYz6VTey.mjs → acorex-platform-common-toggle-widget-view.component-BTaXXZ88.mjs} +4 -5
  192. package/fesm2022/{acorex-platform-common-toggle-widget-view.component-DYz6VTey.mjs.map → acorex-platform-common-toggle-widget-view.component-BTaXXZ88.mjs.map} +1 -1
  193. package/fesm2022/acorex-platform-common.mjs +846 -981
  194. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  195. package/fesm2022/acorex-platform-layout-builder.mjs +28 -11
  196. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  197. package/fesm2022/acorex-platform-layout-designer.mjs +26 -36
  198. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  199. package/fesm2022/acorex-platform-layout-entity.mjs +843 -819
  200. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  201. package/fesm2022/acorex-platform-layout-setting.mjs +197 -0
  202. package/fesm2022/acorex-platform-layout-setting.mjs.map +1 -0
  203. package/fesm2022/acorex-platform-layouts.mjs +37 -46
  204. package/fesm2022/acorex-platform-layouts.mjs.map +1 -1
  205. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-Cf5ttvrG.mjs → acorex-platform-themes-default-entity-master-create-view.component-Bs6fn6z2.mjs} +5 -5
  206. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-Cf5ttvrG.mjs.map → acorex-platform-themes-default-entity-master-create-view.component-Bs6fn6z2.mjs.map} +1 -1
  207. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DPHXeucj.mjs +310 -0
  208. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DPHXeucj.mjs.map +1 -0
  209. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-CCvE7XiE.mjs → acorex-platform-themes-default-entity-master-modify-view.component-CWrpcOC2.mjs} +5 -5
  210. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-CCvE7XiE.mjs.map → acorex-platform-themes-default-entity-master-modify-view.component-CWrpcOC2.mjs.map} +1 -1
  211. package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-CwrgQFY7.mjs → acorex-platform-themes-default-entity-master-single-view.component-DHfe0Qtu.mjs} +19 -21
  212. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-DHfe0Qtu.mjs.map +1 -0
  213. package/fesm2022/acorex-platform-themes-default.mjs +173 -135
  214. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  215. package/fesm2022/acorex-platform-themes-shared.mjs +184 -20
  216. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  217. package/fesm2022/{acorex-platform-widgets-template-widget-edit.component-JlCVB-Aq.mjs → acorex-platform-widgets-template-widget-edit.component-DwPYeF0y.mjs} +2 -1
  218. package/fesm2022/{acorex-platform-widgets-template-widget-edit.component-JlCVB-Aq.mjs.map → acorex-platform-widgets-template-widget-edit.component-DwPYeF0y.mjs.map} +1 -1
  219. package/fesm2022/acorex-platform-widgets.mjs +181 -34
  220. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  221. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  222. package/layout/builder/lib/builder/widget-column-renderer.d.ts +1 -1
  223. package/layout/builder/lib/builder/widget.types.d.ts +1 -2
  224. package/layout/entity/lib/entity-detail-list.viewmodel.d.ts +1 -0
  225. package/layout/entity/lib/entity-master-create.viewmodel.d.ts +2 -2
  226. package/layout/entity/lib/entity-master-list.viewmodel.d.ts +7 -2
  227. package/layout/entity/lib/index.d.ts +4 -3
  228. package/layout/setting/README.md +3 -0
  229. package/layout/setting/index.d.ts +1 -0
  230. package/layout/setting/lib/convert-setting-data.d.ts +21 -0
  231. package/layout/setting/lib/setting.viewmodel.d.ts +39 -0
  232. package/layouts/lib/admin/admin.module.d.ts +6 -3
  233. package/layouts/lib/admin/entity-layout/entity-details-view/entity-details-view.component.d.ts +42 -9
  234. package/layouts/lib/admin/entity-layout/entity-list-view/components/list-view-option-columns/list-view-option-columns.component.d.ts +0 -2
  235. package/layouts/lib/admin/entity-layout/entity-list-view/entity-list-view.component.d.ts +0 -2
  236. package/layouts/lib/admin/entity-layout/entity-list-view/list-view.config.d.ts +4 -2
  237. package/layouts/lib/admin/entity-layout/entity-quick-view/entity-quick-view.component.d.ts +0 -1
  238. package/package.json +12 -12
  239. package/themes/default/index.d.ts +1 -0
  240. package/themes/default/lib/default.module.d.ts +3 -4
  241. package/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.d.ts +43 -8
  242. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +42 -4
  243. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/list-view-option-columns/list-view-option-columns.component.d.ts +3 -2
  244. package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +42 -3
  245. package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +42 -2
  246. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +42 -11
  247. package/themes/default/lib/layouts/setting-layout/index.d.ts +2 -0
  248. package/themes/default/lib/layouts/setting-layout/setting-menu/setting-menu.component.d.ts +12 -0
  249. package/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.d.ts +7 -0
  250. package/themes/shared/lib/components/theme-slot.component.d.ts +31 -5
  251. package/themes/shared/lib/services/theme.service.d.ts +45 -5
  252. package/widgets/lib/widgets/advance/cron-job/cron-job-widget-column.component.d.ts +6 -0
  253. package/widgets/lib/widgets/advance/cron-job/cron-job-widget-designer.component.d.ts +6 -0
  254. package/widgets/lib/widgets/advance/cron-job/cron-job-widget-edit.component.d.ts +7 -0
  255. package/widgets/lib/widgets/advance/cron-job/cron-job-widget-filter.component.d.ts +6 -0
  256. package/widgets/lib/widgets/advance/cron-job/cron-job-widget-print.component.d.ts +6 -0
  257. package/widgets/lib/widgets/advance/cron-job/cron-job-widget-view.component.d.ts +7 -0
  258. package/widgets/lib/widgets/advance/cron-job/cron-job-widget.config.d.ts +7 -0
  259. package/widgets/lib/widgets/advance/cron-job/index.d.ts +7 -0
  260. package/workflow/lib/workflow.service.d.ts +1 -1
  261. package/common/lib/layout/layout.service.d.ts +0 -19
  262. package/common/lib/layout/theme/store/admin-layout.actions.d.ts +0 -7
  263. package/common/lib/layout/theme/store/admin-layout.effects.d.ts +0 -9
  264. package/common/lib/layout/theme/store/admin-layout.reducers.d.ts +0 -19
  265. package/common/lib/layout/theme/store/admin-layout.selectors.d.ts +0 -4
  266. package/common/lib/layout/theme/store/admin-layout.state.d.ts +0 -11
  267. package/common/lib/layout/theme/store/index.d.ts +0 -5
  268. package/esm2022/common/lib/layout/layout.service.mjs +0 -79
  269. package/esm2022/common/lib/layout/theme/store/admin-layout.actions.mjs +0 -11
  270. package/esm2022/common/lib/layout/theme/store/admin-layout.effects.mjs +0 -21
  271. package/esm2022/common/lib/layout/theme/store/admin-layout.reducers.mjs +0 -64
  272. package/esm2022/common/lib/layout/theme/store/admin-layout.selectors.mjs +0 -7
  273. package/esm2022/common/lib/layout/theme/store/admin-layout.state.mjs +0 -13
  274. package/esm2022/common/lib/layout/theme/store/index.mjs +0 -6
  275. package/esm2022/mocks/acorex-platform-mocks.mjs +0 -5
  276. package/esm2022/mocks/index.mjs +0 -7
  277. package/esm2022/mocks/lib/mocks.module.mjs +0 -15
  278. package/esm2022/mocks/lib/services/mocker.service.mjs +0 -114
  279. package/esm2022/mocks/lib/storage/storage.mock.service.mjs +0 -183
  280. package/esm2022/themes/default/lib/layout.routes.mjs +0 -20
  281. package/fesm2022/acorex-platform-common-avatar-widget-view.component-Dew3CVLm.mjs.map +0 -1
  282. package/fesm2022/acorex-platform-common-boolean-widget-filter.component-BdE7WOK5.mjs.map +0 -1
  283. package/fesm2022/acorex-platform-common-checkbox-widget-edit.component-ChXbJsuG.mjs.map +0 -1
  284. package/fesm2022/acorex-platform-common-dateTime-widget-column.component-QUYyDVw8.mjs.map +0 -1
  285. package/fesm2022/acorex-platform-common-dateTime-widget-edit.component-CzLb3xnR.mjs.map +0 -1
  286. package/fesm2022/acorex-platform-common-dateTime-widget-filter.component-DZRQ6yVk.mjs.map +0 -1
  287. package/fesm2022/acorex-platform-common-email-widget-column.component-Cm-fhlNZ.mjs.map +0 -1
  288. package/fesm2022/acorex-platform-common-email-widget-edit.component-BfXFBLF6.mjs.map +0 -1
  289. package/fesm2022/acorex-platform-common-file-widget-column.component-B0v2rSWI.mjs.map +0 -1
  290. package/fesm2022/acorex-platform-common-file-widget-filter.component-C3uBjqF-.mjs.map +0 -1
  291. package/fesm2022/acorex-platform-common-gallery-widget-filter.component-Di446i2c.mjs.map +0 -1
  292. package/fesm2022/acorex-platform-common-largetext-widget-edit.component-D89AlBSm.mjs.map +0 -1
  293. package/fesm2022/acorex-platform-common-lookup-widget-column.component-CB0ehp_y.mjs.map +0 -1
  294. package/fesm2022/acorex-platform-common-lookup-widget-filter.component-Dxj_XEYV.mjs.map +0 -1
  295. package/fesm2022/acorex-platform-common-lookup-widget-view.component-BtO3feA9.mjs.map +0 -1
  296. package/fesm2022/acorex-platform-common-map-widget-edit.component-hXIZrhzg.mjs.map +0 -1
  297. package/fesm2022/acorex-platform-common-map-widget-view.component-RgV-r8q6.mjs.map +0 -1
  298. package/fesm2022/acorex-platform-common-messenger-widget-column.component-DGWQWuzM.mjs.map +0 -1
  299. package/fesm2022/acorex-platform-common-messenger-widget-edit.component-Blv1qL4e.mjs.map +0 -1
  300. package/fesm2022/acorex-platform-common-number-widget-edit.component-gQCEBhPv.mjs.map +0 -1
  301. package/fesm2022/acorex-platform-common-number-widget-filter.component-CvEw3awN.mjs.map +0 -1
  302. package/fesm2022/acorex-platform-common-number-widget-view.component-ROrdklif.mjs.map +0 -1
  303. package/fesm2022/acorex-platform-common-password-widget-edit.component-BCOoHtGl.mjs.map +0 -1
  304. package/fesm2022/acorex-platform-common-phone-widget-edit.component-Bo_aOxfZ.mjs.map +0 -1
  305. package/fesm2022/acorex-platform-common-rich-text-widget-edit.component-12odUyzb.mjs.map +0 -1
  306. package/fesm2022/acorex-platform-common-rich-text-widget-view.component-Xr0ohz5L.mjs.map +0 -1
  307. package/fesm2022/acorex-platform-common-selection-list-widget-edit.component-C1QPfHCm.mjs.map +0 -1
  308. package/fesm2022/acorex-platform-common-selection-list-widget-filter.component-DIgxHmqa.mjs.map +0 -1
  309. package/fesm2022/acorex-platform-common-selection-list-widget-view.component-D-VQ4JNC.mjs.map +0 -1
  310. package/fesm2022/acorex-platform-common-signature-pad-widget-view.component-USd0U707.mjs.map +0 -1
  311. package/fesm2022/acorex-platform-common-string-widget-filter.component-wI9D-Ju5.mjs.map +0 -1
  312. package/fesm2022/acorex-platform-common-text-widget-edit.component-feJTTnye.mjs.map +0 -1
  313. package/fesm2022/acorex-platform-common-toggle-widget-edit.component-Cuf9_RrU.mjs.map +0 -1
  314. package/fesm2022/acorex-platform-mocks.mjs +0 -319
  315. package/fesm2022/acorex-platform-mocks.mjs.map +0 -1
  316. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-BLb_4pK5.mjs +0 -306
  317. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-BLb_4pK5.mjs.map +0 -1
  318. package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-CwrgQFY7.mjs.map +0 -1
  319. package/mocks/README.md +0 -3
  320. package/mocks/index.d.ts +0 -3
  321. package/mocks/lib/mocks.module.d.ts +0 -7
  322. package/mocks/lib/services/mocker.service.d.ts +0 -29
  323. package/mocks/lib/storage/storage.mock.service.d.ts +0 -25
  324. package/themes/default/lib/layout.routes.d.ts +0 -2
@@ -1,20 +1,21 @@
1
+ import * as i2$1 from '@acorex/components/common';
2
+ import { AXDataSource, AXCommonModule } from '@acorex/components/common';
1
3
  import { AXFormatService } from '@acorex/core/format';
2
- import { cloneDeep, set, merge, isNil, get, sortBy } from 'lodash-es';
4
+ import { resolveActionLook, AXPFilterOperatorMiddlewareService, AXPEntityCommandScope, getEntityInfo, AXPSettingsService, AXPWorkflowNavigateAction } from '@acorex/platform/common';
5
+ import * as i1$3 from '@acorex/platform/workflow';
6
+ import { AXPWorkflowService, createWorkFlowEvent, AXPWorkflowAction, ofType, AXPWorkflowModule } from '@acorex/platform/workflow';
3
7
  import * as i0 from '@angular/core';
4
8
  import { InjectionToken, inject, Injectable, computed, signal, Injector, effect, HostBinding, ChangeDetectionStrategy, Component, DestroyRef, ViewChild, NgModule } from '@angular/core';
5
- import * as i1$3 from '@acorex/platform/workflow';
6
- import { createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowService, ofType, AXPWorkflowModule } from '@acorex/platform/workflow';
9
+ import { cloneDeep, set, merge, isNil, get, sortBy } from 'lodash-es';
10
+ import { AXPLayoutThemeService } from '@acorex/platform/themes/shared';
7
11
  import { AXPSessionService, AXPAuthGuard } from '@acorex/platform/auth';
8
- import { resolveActionLook, AXPLayoutService, AXPEntityCommandScope, getEntityInfo, AXPWorkflowNavigateAction } from '@acorex/platform/common';
12
+ import { Subject, takeUntil } from 'rxjs';
9
13
  import { AXDialogService } from '@acorex/components/dialog';
10
14
  import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
11
15
  import * as i8 from '@acorex/core/translation';
12
16
  import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
13
17
  import { AXPopupService } from '@acorex/components/popup';
14
18
  import { AXPlatform } from '@acorex/core/platform';
15
- import * as i2$1 from '@acorex/components/common';
16
- import { AXDataSource, AXCommonModule } from '@acorex/components/common';
17
- import { Subject, takeUntil } from 'rxjs';
18
19
  import * as i7 from '@acorex/platform/layout/builder';
19
20
  import { AXPWidgetComponent, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPColumnWidgetComponent, AXPWidgetsCatalog, AXP_WIDGETS_EDITOR_GROUP, AXPWidgetRegistryService } from '@acorex/platform/layout/builder';
20
21
  import { RouterModule, ROUTES } from '@angular/router';
@@ -74,6 +75,213 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
74
75
  args: [{ providedIn: 'root' }]
75
76
  }] });
76
77
 
78
+ class AXPEntityCommandTriggerViewModel {
79
+ constructor(entity, action) {
80
+ this.name = action.command;
81
+ const resolvedLook = resolveActionLook(action);
82
+ this.priority = action.priority;
83
+ this.title = action.title;
84
+ this.separated = action.separated ?? false;
85
+ this.color = action.color ?? resolvedLook.color;
86
+ this.icon = action.icon ?? resolvedLook.icon;
87
+ this.scope = action.scope;
88
+ }
89
+ }
90
+ class AXPEntityListViewColumnViewModel {
91
+ constructor(property, column) {
92
+ this.property = property;
93
+ this.column = column;
94
+ this.name = this.property.name;
95
+ this.title = this.column.title ?? this.property.title;
96
+ this.visible = this.column?.options?.visible ?? true;
97
+ this.dir = this.column.sort?.dir;
98
+ this.sortEnabled = this.property.options?.sort?.enabled;
99
+ this.node = computed(() => {
100
+ const widget = this.property.schema.interface;
101
+ return {
102
+ path: this.column.options?.dataPath ?? this.name,
103
+ type: widget.type,
104
+ options: { ...widget?.options, ...this.column?.options },
105
+ };
106
+ });
107
+ }
108
+ }
109
+
110
+ class AXPEntityDetailListViewModel {
111
+ constructor(injector, detailEntityConfig, parent) {
112
+ this.injector = injector;
113
+ this.detailEntityConfig = detailEntityConfig;
114
+ this.parent = parent;
115
+ this.detailEntity = signal(null);
116
+ this.formatService = this.injector.get(AXFormatService);
117
+ this.workflow = this.injector.get(AXPWorkflowService);
118
+ this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
119
+ this.dataSource = new AXDataSource({
120
+ byKey: (key) => {
121
+ const func = this.detailEntity()?.queries.byKey.execute;
122
+ return func();
123
+ },
124
+ load: (e) => {
125
+ const func = this.detailEntity()?.queries.list?.execute;
126
+ return func(e);
127
+ },
128
+ pageSize: 5,
129
+ key: 'id',
130
+ });
131
+ this.selectedItems = signal([]);
132
+ this.hasSelectedItems = computed(() => {
133
+ return this.selectedItems().length > 0;
134
+ });
135
+ //****************** Title ******************//
136
+ this.title = computed(() => {
137
+ return (this.detailEntityConfig.title ??
138
+ this.detailEntity()?.interfaces?.detail?.list?.title ??
139
+ this.detailEntity()?.formats.plural);
140
+ });
141
+ //****************** Inline filter ******************//
142
+ this.inlineFiltersPlaceholders = computed(() => {
143
+ //return this.entityDef.properties.filter(p => p.options?.filter?.inline?.enabled).map(c => c.title);
144
+ return [];
145
+ });
146
+ this.hasInlineFilters = computed(() => {
147
+ return this.inlineFiltersPlaceholders().length > 0;
148
+ });
149
+ //****************** Actions ******************//
150
+ this.allActions = computed(() => {
151
+ const list = this.detailEntity()?.interfaces?.master?.list?.actions ?? [];
152
+ return list.map((tr) => new AXPEntityCommandTriggerViewModel(this.detailEntity(), tr)) ?? [];
153
+ });
154
+ this.primaryActions = computed(() => {
155
+ return this.allActions().filter((a) => a.priority == 'primary' &&
156
+ ((a.scope == AXPEntityCommandScope.Selected && this.hasSelectedItems()) ||
157
+ (a.scope == AXPEntityCommandScope.TypeLevel && !this.hasSelectedItems())));
158
+ });
159
+ this.secondaryActions = computed(() => {
160
+ return this.allActions().filter((a) => a.priority == 'secondary' &&
161
+ ((a.scope == AXPEntityCommandScope.Selected && this.hasSelectedItems()) ||
162
+ (a.scope == AXPEntityCommandScope.TypeLevel && !this.hasSelectedItems())));
163
+ });
164
+ this.primaryRowActions = computed(() => this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Individual && a.priority === 'primary'));
165
+ this.secondaryRowActions = computed(() => this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Individual && a.priority === 'secondary'));
166
+ //****************** Filter ******************//
167
+ this.inlineFilters = {
168
+ field: null,
169
+ logic: 'or',
170
+ operator: null,
171
+ filters: [],
172
+ };
173
+ //****************** Columns ******************//
174
+ this.columns = computed(() => {
175
+ if (this.detailEntity()) {
176
+ const detailColumns = this.detailEntityConfig.columns ?? [];
177
+ const columns = this.detailEntity()?.columns?.map((c) => c.name) ?? [];
178
+ const props = this.detailEntity()?.properties.filter((p) => p.schema.hidden != true && (detailColumns?.length == 0 || detailColumns?.includes(p.name))) ?? [];
179
+ const displayColumns = props.filter((p) => columns.some((c) => c == p.name));
180
+ return displayColumns.map((p) => {
181
+ return new AXPEntityListViewColumnViewModel(p, this.detailEntity()?.columns?.find((c) => c.name == p.name));
182
+ });
183
+ }
184
+ return [];
185
+ });
186
+ this.initialize();
187
+ }
188
+ async initialize() {
189
+ const entityResolver = this.injector.get(AXPEntityResolver);
190
+ const [moduleName, entityName] = this.detailEntityConfig.entity.split('.');
191
+ const entity = await entityResolver.get(moduleName, entityName);
192
+ if (!entity) {
193
+ throw Error(`Invalid enitity name: ${this.detailEntityConfig.entity}`);
194
+ }
195
+ this.detailEntity.set(entity);
196
+ this.applyFilterAndSort();
197
+ }
198
+ clearSelection() {
199
+ this.selectedItems.set([]);
200
+ }
201
+ applyInlineFilter(value) {
202
+ // const props = this.entityDef.properties.filter(c => c.options?.filter?.inline?.enabled);
203
+ // this.inlineFilters.filters = [];
204
+ // if (value) {
205
+ // props.forEach(p => {
206
+ // this.inlineFilters.filters?.push({
207
+ // field: p.name,
208
+ // operator: {
209
+ // type: 'contains'
210
+ // },
211
+ // value
212
+ // })
213
+ // })
214
+ // }
215
+ this.applyFilterAndSort();
216
+ }
217
+ applyFilterAndSort() {
218
+ this.dataSource.clearFilter();
219
+ //
220
+ //this.dataSource.sort(...this.detailEntity.().map(s => ({ dir: s.dir, field: s.name } as AXDataSourceSortOption)));
221
+ //
222
+ const parentFilters = this.detailEntityConfig.conditions?.map((c) => {
223
+ return {
224
+ field: c.name,
225
+ operator: c.operator,
226
+ value: this.parent.data?.id,
227
+ };
228
+ }) ?? [];
229
+ const parentFilterWrapper = {
230
+ field: null,
231
+ logic: 'and',
232
+ operator: null,
233
+ filters: parentFilters,
234
+ };
235
+ //
236
+ const inline = this.inlineFilters.filters?.length ?? 0;
237
+ const parent = parentFilterWrapper.filters?.length ?? 0;
238
+ //
239
+ debugger;
240
+ if (inline) {
241
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter(this.inlineFilters));
242
+ }
243
+ else if (!inline && parent) {
244
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter(parentFilterWrapper));
245
+ }
246
+ else if (inline && parent) {
247
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter({
248
+ field: null,
249
+ logic: 'and',
250
+ operator: null,
251
+ filters: [this.inlineFilters, parentFilterWrapper],
252
+ }));
253
+ }
254
+ //
255
+ this.dataSource.refresh();
256
+ }
257
+ //****************** Commands ******************//
258
+ async executeCommand(commandName, data = null) {
259
+ const action = this.allActions().find((c) => c.name == commandName &&
260
+ ((this.selectedItems().length
261
+ ? c.scope == AXPEntityCommandScope.Selected
262
+ : c.scope == AXPEntityCommandScope.Individual) ||
263
+ c.scope == AXPEntityCommandScope.TypeLevel));
264
+ if (action?.scope == AXPEntityCommandScope.TypeLevel) {
265
+ if (data == null) {
266
+ data = {};
267
+ }
268
+ let relatedColumn = null;
269
+ this.detailEntityConfig.conditions?.forEach((condition) => {
270
+ if (condition.value == 'id') {
271
+ relatedColumn = condition.name;
272
+ }
273
+ });
274
+ if (relatedColumn != null) {
275
+ data[relatedColumn] = this.parent.data['id'];
276
+ }
277
+ }
278
+ await this.workflow.execute(commandName, {
279
+ entity: getEntityInfo(this.detailEntity()).source,
280
+ data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
281
+ });
282
+ }
283
+ }
284
+
77
285
  class AXPEntityDefinitionRegistryService {
78
286
  constructor() {
79
287
  // Stores AXPEntityConfig objects, keyed by a combination of module and entity name.
@@ -140,37 +348,141 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
140
348
  }]
141
349
  }] });
142
350
 
143
- class AXPEntityCommandTriggerViewModel {
144
- constructor(entity, action) {
145
- this.name = action.command;
146
- const resolvedLook = resolveActionLook(action);
147
- this.priority = action.priority;
148
- this.title = action.title;
149
- this.separated = action.separated ?? false;
150
- this.color = action.color ?? resolvedLook.color;
151
- this.icon = action.icon ?? resolvedLook.icon;
152
- this.scope = action.scope;
351
+ class AXPEntityCreateViewSectionViewModel {
352
+ constructor(entity, section) {
353
+ this.entity = entity;
354
+ this.section = section;
355
+ this.group = this.entity.groups?.find(c => c.id == this.section.id);
356
+ this.name = signal(this.group.id);
357
+ this.title = computed(() => {
358
+ return this.group.title ?? this.group.id;
359
+ });
360
+ this.description = computed(() => {
361
+ return this.group.description;
362
+ ;
363
+ });
364
+ this.layout = computed(() => {
365
+ const source = cloneDeep(this.section.layout ?? {});
366
+ set(source, "positions.default.colSpan", 12);
367
+ return source;
368
+ });
369
+ this.elements = computed(() => {
370
+ const { interfaces, properties } = this.entity;
371
+ const createProps = interfaces?.master?.create?.properties ?? [];
372
+ const createPropNames = new Set(createProps.map(({ name }) => name));
373
+ const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id &&
374
+ !schema.hidden &&
375
+ createPropNames.has(name));
376
+ return filteredProperties.map(property => {
377
+ const createProp = createProps.find(({ name }) => name === property.name);
378
+ return new AXPEntityCreateViewElementViewModel(this.entity, this, property, createProp);
379
+ });
380
+ });
153
381
  }
154
382
  }
155
- class AXPEntityListViewColumnViewModel {
156
- constructor(property, column) {
157
- this.property = property;
158
- this.column = column;
159
- this.name = this.property.name;
160
- this.title = this.column.title ?? this.property.title;
161
- this.visible = this.column?.options?.visible ?? true;
162
- this.dir = this.column.sort?.dir;
163
- this.sortEnabled = this.property.options?.sort?.enabled;
383
+ class AXPEntityCreateViewElementViewModel {
384
+ constructor(entity, section, property, createProp) {
385
+ this.entity = entity;
386
+ this.section = section;
387
+ this.property = property;
388
+ this.createProp = createProp;
389
+ this.name = signal(this.property.name);
390
+ this.title = signal(this.property.title);
391
+ this.description = signal(this.property.description);
392
+ this.editable = computed(() => {
393
+ return !(this.property.schema.readonly ?? false);
394
+ });
395
+ this.isRequired = computed(() => {
396
+ return this.property.validations?.some(c => c.rule == 'required') || false;
397
+ });
398
+ this.layout = computed(() => {
399
+ const source = cloneDeep(this.createProp.layout ?? {});
400
+ set(source, "positions.default.colSpan", 12);
401
+ return source;
402
+ });
164
403
  this.node = computed(() => {
165
- const widget = this.property.schema.interface;
404
+ const schema = this.property.schema;
405
+ const widget = schema.interface;
166
406
  return {
167
- path: this.column.options?.dataPath ?? this.name,
168
407
  type: widget.type,
169
- options: { ...widget?.options, ...this.column?.options },
408
+ mode: this.editable() ? 'edit' : 'view',
409
+ path: this.name(),
410
+ children: widget.children,
411
+ formula: widget.formula,
412
+ triggers: widget.triggers,
413
+ options: merge(schema.interface?.options,
414
+ //this.property.options?.create?.widget,
415
+ { validationRules: this.property.validations })
170
416
  };
171
417
  });
172
418
  }
173
419
  }
420
+ class AXPEntityMasterCreateViewModel {
421
+ constructor(injector, config, initialData = {}) {
422
+ this.injector = injector;
423
+ this.config = config;
424
+ this.initialData = initialData;
425
+ this.entityDef = cloneDeep(this.config);
426
+ this.workflow = this.injector.get(AXPWorkflowService);
427
+ this.context = signal(this.initialData ?? {});
428
+ this.isInProgress = signal(false);
429
+ this.sections = computed(() => {
430
+ const { interfaces, properties } = this.entityDef;
431
+ const createProps = interfaces?.master?.create?.properties?.map(({ name }) => name) ?? [];
432
+ const visibleProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && createProps.includes(name));
433
+ const sections = interfaces?.master?.create?.sections?.filter(({ id }) => visibleProperties.some(({ groupId }) => groupId === id)) ?? [];
434
+ return sections.map(section => new AXPEntityCreateViewSectionViewModel(this.entityDef, section));
435
+ });
436
+ if (!initialData)
437
+ initialData = {};
438
+ this.config.properties
439
+ .filter(c => c.schema.defaultValue != null)
440
+ .forEach(p => {
441
+ if (typeof p.schema.defaultValue === 'function') {
442
+ const func = p.schema.defaultValue;
443
+ set(initialData, p.name, func(initialData));
444
+ }
445
+ else {
446
+ set(initialData, p.name, p.schema.defaultValue);
447
+ }
448
+ });
449
+ this.context.set(initialData);
450
+ }
451
+ async save() {
452
+ try {
453
+ this.isInProgress.set(true);
454
+ const exec = this.entityDef.commands?.create?.execute;
455
+ return await exec((this.context()));
456
+ }
457
+ finally {
458
+ this.isInProgress.set(false);
459
+ }
460
+ }
461
+ async createNewOne() {
462
+ await this.workflow.execute('create-entity', {
463
+ entity: getEntityInfo(this.entityDef).source
464
+ });
465
+ }
466
+ }
467
+ class AXPEntityCreateViewModelFactory {
468
+ constructor() {
469
+ this.entityService = inject(AXPEntityDefinitionRegistryService);
470
+ this.layout = inject(AXPLayoutThemeService);
471
+ this.injector = inject(Injector);
472
+ }
473
+ async create(moduleName, entityName, initialData = null) {
474
+ this.layout.setNavigationLoading(true);
475
+ const config = await this.entityService.resolve(moduleName, entityName);
476
+ this.layout.setNavigationLoading(false);
477
+ return new AXPEntityMasterCreateViewModel(this.injector, config, initialData);
478
+ }
479
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityCreateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
480
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityCreateViewModelFactory, providedIn: 'root' }); }
481
+ }
482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityCreateViewModelFactory, decorators: [{
483
+ type: Injectable,
484
+ args: [{ providedIn: 'root' }]
485
+ }] });
174
486
 
175
487
  const AXPEntityDeletedEvent = createWorkFlowEvent('[Entity] Deleted');
176
488
  class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
@@ -295,206 +607,44 @@ const AXPDeleteEntityWorkflow = {
295
607
  },
296
608
  };
297
609
 
298
- class AXPEntityMasterUpdateElementViewModel {
299
- constructor(entity, property) {
610
+ class AXPEntityMasterListViewQueryViewModel {
611
+ constructor(entity, section, view) {
300
612
  this.entity = entity;
301
- this.property = property;
302
- this.name = signal(this.property.name);
303
- this.title = signal(this.property.title);
304
- this.description = signal(this.property.description);
305
- this.editable = computed(() => {
306
- return !(this.property.schema.readonly ?? false);
307
- });
308
- this.isRequired = computed(() => {
309
- return this.property.validations?.some(c => c.rule == 'required') || false;
310
- });
311
- this.layout = computed(() => {
312
- const updateProp = this.entity.interfaces?.master?.update?.properties?.find(c => c.name == this.property.name);
313
- const source = cloneDeep(updateProp?.layout ?? {});
314
- set(source, "positions.default.colSpan", 12);
315
- return source;
316
- });
317
- this.node = computed(() => {
318
- const schema = this.property.schema;
319
- const widget = schema.interface;
320
- return {
321
- type: widget.type,
322
- mode: this.editable() ? 'edit' : 'view',
323
- path: this.name(),
324
- children: widget.children,
325
- formula: widget.formula,
326
- triggers: widget.triggers,
327
- options: merge(schema.interface?.options,
328
- //this.property.options?.create?.widget,
329
- { validationRules: this.property.validations })
330
- };
331
- });
613
+ this.section = section;
614
+ this.view = view;
615
+ this.name = this.view.name;
616
+ this.title = this.view.title;
617
+ this.sorts = this.view.sorts;
618
+ this.columns = this.view.columns;
619
+ this.conditions = this.view.conditions;
332
620
  }
333
621
  }
334
- class AXPEntityMasterUpdateViewModel {
335
- constructor(injector, config, entityData, props) {
622
+ class AXPEntityMasterListViewModel {
623
+ constructor(injector, config) {
336
624
  this.injector = injector;
337
625
  this.config = config;
338
- this.entityData = entityData;
339
- this.props = props;
340
626
  this.entityDef = cloneDeep(this.config);
627
+ this._viewDef = cloneDeep(this.entityDef.interfaces?.master?.list);
628
+ this.formatService = this.injector.get(AXFormatService);
629
+ this.session = this.injector.get(AXPSessionService);
341
630
  this.workflow = this.injector.get(AXPWorkflowService);
342
- this.isInProgress = signal(false);
343
- this.context = signal(cloneDeep(this.entityData));
344
- this.elements = computed(() => {
345
- const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
346
- c.schema.hidden != true);
347
- return props.map(e => {
348
- return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
349
- });
350
- });
351
- }
352
- async save() {
353
- this.isInProgress.set(true);
354
- try {
355
- const com = this.entityDef.commands?.update;
356
- if (com) {
357
- const exec = com.execute;
358
- return await exec(this.context());
359
- }
360
- }
361
- finally {
362
- this.isInProgress.set(false);
363
- }
364
- }
365
- reset() {
366
- this.context.set(cloneDeep(this.entityData));
367
- }
368
- }
369
- class AXPEntityMasterUpdateViewModelFactory {
370
- constructor() {
371
- this.entityService = inject(AXPEntityDefinitionRegistryService);
372
- this.layout = inject(AXPLayoutService);
373
- this.injector = inject(Injector);
374
- }
375
- async create(moduleName, entityName, id, props) {
376
- const config = await this.entityService.resolve(moduleName, entityName);
377
- this.layout.setNavigationLoading(true);
378
- if (config.queries.byKey) {
379
- const func = config.queries.byKey.execute;
380
- const data = await func(id);
381
- this.layout.setNavigationLoading(false);
382
- return new AXPEntityMasterUpdateViewModel(this.injector, config, data, props);
383
- }
384
- this.layout.setNavigationLoading(false);
385
- return Promise.reject('cannot fetch ');
386
- }
387
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
388
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, providedIn: 'root' }); }
389
- }
390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, decorators: [{
391
- type: Injectable,
392
- args: [{ providedIn: 'root' }]
393
- }] });
394
-
395
- const AXPEntityModifyEvent = createWorkFlowEvent('[Entity] Modified');
396
- class AXPEntityModifySectionPopupAction extends AXPWorkflowAction {
397
- constructor() {
398
- super(...arguments);
399
- this.popupService = inject(AXPopupService);
400
- this.platform = inject(AXPlatform);
401
- this.translateService = inject(AXTranslationService);
402
- this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
403
- this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
404
- this.factory = inject(AXPEntityMasterUpdateViewModelFactory);
405
- }
406
- async execute(context) {
407
- const [moduleName, entityName] = context.getVariable('entity').split('.');
408
- const { properties, id, title } = context.getVariable('data');
409
- const entityRef = await this.entityRegistery.resolve(moduleName, entityName);
410
- const vm = await this.factory.create(moduleName, entityName, id, properties);
411
- const com = await this.config.viewers.master.modify();
412
- const popup = await this.popupService.open(com, {
413
- title: title ?? `${this.translateService.translateSync('entity.modify')} ${this.translateService.translateSync(entityRef.formats.individual)}`,
414
- size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
415
- data: {
416
- vm,
417
- properties,
418
- entity: entityRef,
631
+ this.settings = this.injector.get(AXPSettingsService);
632
+ this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
633
+ this.settingListViewKey = '';
634
+ this.settingSelectedViewKey = '';
635
+ this.destroyed = new Subject();
636
+ this.events$ = new Subject();
637
+ this.dataSource = new AXDataSource({
638
+ byKey: (key) => {
639
+ const func = this.entityDef.queries.byKey.execute;
640
+ return func();
641
+ },
642
+ load: (e) => {
643
+ const func = this.entityDef.queries.list?.execute;
644
+ return func(e);
419
645
  },
420
- });
421
- context.setOutput('result', false);
422
- if (popup.data?.result == true) {
423
- context.setOutput('result', true);
424
- context.setVariable('data', cloneDeep(popup.data.context));
425
- }
426
- }
427
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifySectionPopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
428
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifySectionPopupAction }); }
429
- }
430
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifySectionPopupAction, decorators: [{
431
- type: Injectable
432
- }] });
433
- class AXPEntityModifyConfirmedAction extends AXPWorkflowAction {
434
- async execute(context) {
435
- const updatedData = context.getVariable('data');
436
- this.dispatch(AXPEntityModifyEvent({ entity: context.getVariable('entity'), values: updatedData }));
437
- }
438
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifyConfirmedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
439
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifyConfirmedAction }); }
440
- }
441
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifyConfirmedAction, decorators: [{
442
- type: Injectable
443
- }] });
444
- const AXPModifyEntitySectionWorkflow = {
445
- startStepId: 'modifyPopup',
446
- steps: {
447
- modifyPopup: {
448
- id: 'modifyPopup',
449
- action: 'AXPEntityModifySectionPopupAction',
450
- nextSteps: [
451
- {
452
- conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
453
- nextStepId: 'successToast',
454
- },
455
- ],
456
- },
457
- successToast: {
458
- id: 'successToast',
459
- action: 'AXPToastAction',
460
- input: {
461
- color: 'success',
462
- title: 'workflow.entity-modified-title',
463
- content: 'workflow.entity-modified-body',
464
- },
465
- nextSteps: [
466
- {
467
- conditions: [],
468
- nextStepId: 'modifyConfirmed',
469
- },
470
- ],
471
- },
472
- modifyConfirmed: {
473
- id: 'modifyConfirmed',
474
- action: 'AXPEntityModifyConfirmedAction',
475
- },
476
- },
477
- };
478
-
479
- class AXPEntityDetailListViewModel {
480
- constructor(injector, detailEntityConfig, parent) {
481
- this.injector = injector;
482
- this.detailEntityConfig = detailEntityConfig;
483
- this.parent = parent;
484
- this.detailEntity = signal(null);
485
- this.formatService = this.injector.get(AXFormatService);
486
- this.workflow = this.injector.get(AXPWorkflowService);
487
- this.dataSource = new AXDataSource({
488
- byKey: (key) => {
489
- const func = this.detailEntity()?.queries.byKey.execute;
490
- return func();
491
- },
492
- load: (e) => {
493
- const func = this.detailEntity()?.queries.list?.execute;
494
- return func(e);
495
- },
496
- pageSize: 5,
497
- key: 'id',
646
+ pageSize: 10,
647
+ key: 'id',
498
648
  });
499
649
  this.selectedItems = signal([]);
500
650
  this.hasSelectedItems = computed(() => {
@@ -502,22 +652,44 @@ class AXPEntityDetailListViewModel {
502
652
  });
503
653
  //****************** Title ******************//
504
654
  this.title = computed(() => {
505
- return (this.detailEntityConfig.title ??
506
- this.detailEntity()?.interfaces?.detail?.list?.title ??
507
- this.detailEntity()?.formats.plural);
655
+ return this._viewDef.title ?? this.entityDef.formats.plural;
656
+ });
657
+ //****************** Description ******************//
658
+ this.description = computed(() => {
659
+ return this._viewDef.description ?? null;
508
660
  });
509
661
  //****************** Inline filter ******************//
510
662
  this.inlineFiltersPlaceholders = computed(() => {
511
- //return this.entityDef.properties.filter(p => p.options?.filter?.inline?.enabled).map(c => c.title);
512
- return [];
663
+ return this.entityDef.properties.filter((p) => p.options?.filter?.inline?.enabled).map((c) => c.title ?? c.name);
513
664
  });
514
665
  this.hasInlineFilters = computed(() => {
515
666
  return this.inlineFiltersPlaceholders().length > 0;
516
667
  });
668
+ //****************** Beardcrumbs ******************//
669
+ this.beardcrumbs = computed(() => {
670
+ return [
671
+ {
672
+ title: 'entity.home',
673
+ icon: 'fa-solid fa-home ax-text-xs ax-me-2',
674
+ url: [`/${this.session.application?.name}`],
675
+ },
676
+ {
677
+ title: this.title(),
678
+ url: [
679
+ `/${this.session.application?.name}`,
680
+ 'm',
681
+ `${this.entityDef.module}`,
682
+ 'e',
683
+ `${this.entityDef.name}`,
684
+ 'list',
685
+ ],
686
+ },
687
+ ];
688
+ });
517
689
  //****************** Actions ******************//
518
690
  this.allActions = computed(() => {
519
- const list = this.detailEntity()?.interfaces?.master?.list?.actions ?? [];
520
- return list.map((tr) => new AXPEntityCommandTriggerViewModel(this.detailEntity(), tr)) ?? [];
691
+ const list = this.entityDef.interfaces?.master?.list?.actions ?? [];
692
+ return list.map((tr) => new AXPEntityCommandTriggerViewModel(this.entityDef, tr)) ?? [];
521
693
  });
522
694
  this.primaryActions = computed(() => {
523
695
  return this.allActions().filter((a) => a.priority == 'primary' &&
@@ -538,167 +710,256 @@ class AXPEntityDetailListViewModel {
538
710
  operator: null,
539
711
  filters: [],
540
712
  };
713
+ this.advanceFilters = {
714
+ field: null,
715
+ logic: 'and',
716
+ operator: null,
717
+ filters: [],
718
+ };
541
719
  //****************** Columns ******************//
542
- this.columns = computed(() => {
543
- if (this.detailEntity()) {
544
- const detailColumns = this.detailEntityConfig.columns ?? [];
545
- const columns = this.detailEntity()?.columns?.map((c) => c.name) ?? [];
546
- const props = this.detailEntity()?.properties.filter((p) => p.schema.hidden != true && (detailColumns?.length == 0 || detailColumns?.includes(p.name))) ?? [];
547
- const displayColumns = props.filter((p) => columns.some((c) => c == p.name));
548
- return displayColumns.map((p) => {
549
- return new AXPEntityListViewColumnViewModel(p, this.detailEntity()?.columns?.find((c) => c.name == p.name));
550
- });
720
+ this.allAvailableColumns = () => {
721
+ const { columns = [], properties } = this.entityDef;
722
+ const visibleProperties = properties.filter(({ schema }) => !schema?.hidden);
723
+ const visiblePropNames = new Set(visibleProperties.map(({ name }) => name));
724
+ return columns
725
+ .filter(({ name }) => visiblePropNames.has(name))
726
+ .map((column) => {
727
+ const property = visibleProperties.find(({ name }) => name === column.name);
728
+ return new AXPEntityListViewColumnViewModel(property, column);
729
+ });
730
+ };
731
+ this.visibleColumnCount = () => {
732
+ return this.columns().filter((c) => c.visible == true).length;
733
+ };
734
+ this.columns = signal([]);
735
+ //****************** Sort ******************//
736
+ this.sortableFields = () => {
737
+ const props = this.entityDef.properties.filter((c) => c.options?.sort?.enabled);
738
+ return props.map((e) => {
739
+ return {
740
+ name: e.name,
741
+ title: e.title,
742
+ dir: undefined,
743
+ };
744
+ });
745
+ };
746
+ this.sortableFieldsCount = () => {
747
+ return this.entityDef.properties.filter((c) => c.options?.sort?.enabled).length ?? 0;
748
+ };
749
+ this.canSort = () => {
750
+ return this.sortableFieldsCount() > 0;
751
+ };
752
+ this.canAddMoreSort = () => {
753
+ return this.sortedCount() < this.sortableFieldsCount();
754
+ };
755
+ this.sortedCount = () => {
756
+ return this.sortedFields().filter((i) => i.dir).length;
757
+ };
758
+ this.sortedFields = signal([]);
759
+ this.views = computed(() => {
760
+ const views = this.entityDef.interfaces?.master?.list?.views ?? [];
761
+ return views.map((v) => {
762
+ return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
763
+ });
764
+ });
765
+ this.view = signal(this.views()[0]);
766
+ this.workflow.events$
767
+ .pipe(ofType(AXPEntityDeletedEvent))
768
+ .pipe(takeUntil(this.destroyed))
769
+ .subscribe((event) => {
770
+ if (event.payload.entity == getEntityInfo(this.entityDef).source) {
771
+ this.selectedItems.set([]);
772
+ this.events$.next({ action: 'refresh' });
551
773
  }
552
- return [];
553
774
  });
554
- this.initialize();
775
+ this.sortedFields.set(this.sortableFields());
555
776
  }
556
- async initialize() {
557
- const entityResolver = this.injector.get(AXPEntityResolver);
558
- const [moduleName, entityName] = this.detailEntityConfig.entity.split('.');
559
- const entity = await entityResolver.get(moduleName, entityName);
560
- if (!entity) {
561
- throw Error(`Invalid enitity name: ${this.detailEntityConfig.entity}`);
777
+ async applySettings() {
778
+ this.settingListViewKey = `${this.config.module}:${this.config.name}:list-view:${this.view().name}`;
779
+ const listViewSetting = await this.settings.get(this.settingListViewKey);
780
+ if (listViewSetting) {
781
+ const columnVisibilityMap = new Map(listViewSetting.columns.map((col) => [col.name, col.visible]));
782
+ this.columns.update((prev) => prev
783
+ .map((c) => ({ ...c, visible: columnVisibilityMap.get(c.name) ?? c.visible })) // Update visibility
784
+ .sort((a, b) => listViewSetting.columns.findIndex((col) => col.name === a.name) -
785
+ listViewSetting.columns.findIndex((col) => col.name === b.name)));
562
786
  }
563
- this.detailEntity.set(entity);
564
- this.applyFilterAndSort();
565
787
  }
566
788
  clearSelection() {
567
789
  this.selectedItems.set([]);
568
790
  }
569
791
  applyInlineFilter(value) {
570
- // const props = this.entityDef.properties.filter(c => c.options?.filter?.inline?.enabled);
571
- // this.inlineFilters.filters = [];
572
- // if (value) {
573
- // props.forEach(p => {
574
- // this.inlineFilters.filters?.push({
575
- // field: p.name,
576
- // operator: {
577
- // type: 'contains'
578
- // },
579
- // value
580
- // })
581
- // })
582
- // }
792
+ const props = this.entityDef.properties.filter((c) => c.options?.filter?.inline?.enabled);
793
+ this.inlineFilters.filters = [];
794
+ if (value) {
795
+ props.forEach((p) => {
796
+ this.inlineFilters.filters?.push({
797
+ field: p.name,
798
+ operator: {
799
+ type: 'contains',
800
+ },
801
+ value,
802
+ });
803
+ });
804
+ }
583
805
  this.applyFilterAndSort();
584
806
  }
585
807
  applyFilterAndSort() {
586
808
  this.dataSource.clearFilter();
587
809
  //
588
- //this.dataSource.sort(...this.detailEntity.().map(s => ({ dir: s.dir, field: s.name } as AXDataSourceSortOption)));
810
+ this.dataSource.sort(...this.sortedFields().map((s) => ({ dir: s.dir, field: s.name })));
589
811
  //
590
- const parentFilters = this.detailEntityConfig.conditions?.map((c) => {
591
- return {
592
- field: c.name,
593
- operator: c.operator,
594
- value: this.parent.data?.id,
595
- };
596
- }) ?? [];
597
- const parentFilterWrapper = {
598
- field: null,
599
- logic: 'and',
600
- operator: null,
601
- filters: parentFilters,
602
- };
812
+ this.advanceFilters.filters = this.view().conditions.map((f) => ({
813
+ field: f.name,
814
+ operator: f.operator,
815
+ value: f.value,
816
+ }));
603
817
  //
604
818
  const inline = this.inlineFilters.filters?.length ?? 0;
605
- const parent = parentFilterWrapper.filters?.length ?? 0;
606
- //
607
- if (inline) {
608
- this.dataSource.filter(this.inlineFilters);
819
+ const advance = this.advanceFilters.filters?.length ?? 0;
820
+ if (inline && !advance) {
821
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter(this.inlineFilters));
609
822
  }
610
- else if (!inline && parent) {
611
- this.dataSource.filter(parentFilterWrapper);
823
+ else if (!inline && advance) {
824
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter(this.advanceFilters));
612
825
  }
613
- else if (inline && parent) {
614
- this.dataSource.filter({
826
+ else if (inline && advance) {
827
+ this.dataSource.filter(this.filterOperatorMiddleware.transformFilter({
615
828
  field: null,
616
829
  logic: 'and',
617
830
  operator: null,
618
- filters: [this.inlineFilters, parentFilterWrapper],
619
- });
831
+ filters: [this.inlineFilters, this.advanceFilters],
832
+ }));
620
833
  }
621
834
  //
622
835
  this.dataSource.refresh();
623
836
  }
624
- //****************** Commands ******************//
625
- async executeCommand(commandName, data = null) {
626
- const action = this.allActions().find((c) => c.name == commandName &&
627
- ((this.selectedItems().length
628
- ? c.scope == AXPEntityCommandScope.Selected
629
- : c.scope == AXPEntityCommandScope.Individual) ||
630
- c.scope == AXPEntityCommandScope.TypeLevel));
631
- if (action?.scope == AXPEntityCommandScope.TypeLevel) {
632
- if (data == null) {
633
- data = {};
634
- }
635
- let relatedColumn = null;
636
- this.detailEntityConfig.conditions?.forEach((condition) => {
637
- if (condition.value == 'id') {
638
- relatedColumn = condition.name;
639
- }
837
+ resetColumns() {
838
+ this.applyViewColumns();
839
+ }
840
+ async onColumnsChanged(columns) {
841
+ const listViewSetting = await this.settings.get(this.settingListViewKey);
842
+ console.log(this.settingListViewKey);
843
+ if (this.settingListViewKey) {
844
+ this.settings.set(this.settingListViewKey, {
845
+ ...listViewSetting,
846
+ columns: columns.map((c) => ({ name: c.name, visible: c.visible })),
640
847
  });
641
- if (relatedColumn != null) {
642
- data[relatedColumn] = this.parent.data['id'];
643
- }
644
848
  }
849
+ }
850
+ applyViewColumns() {
851
+ const cols = this.view().columns;
852
+ const cloned = this.allAvailableColumns().map((c) => {
853
+ const column = this.entityDef.columns?.find((cc) => cc.name == c.name);
854
+ const prop = this.entityDef.properties.find((p) => p.name == c.name);
855
+ const col = new AXPEntityListViewColumnViewModel(prop, column);
856
+ col.visible = !cols.some((c) => c == col.name) && col.visible != false;
857
+ return col;
858
+ });
859
+ this.columns.set(cloned);
860
+ }
861
+ resetSorts() {
862
+ this.applyViewSorts();
863
+ }
864
+ applySorts() {
865
+ this.applyFilterAndSort();
866
+ }
867
+ addSort() {
868
+ const prop = this.sortableFields().find((c) => !this.sortedFields().some((s) => s.name == c.name));
869
+ if (prop) {
870
+ this.sortedFields.set([...this.sortedFields(), ...[prop]]);
871
+ }
872
+ }
873
+ removeSort(name) {
874
+ this.sortedFields.set(this.sortedFields().filter((c) => c.name != name));
875
+ }
876
+ applyViewSorts() {
877
+ const viewSorts = this.view().sorts;
878
+ this.sortedFields.update((prev) => {
879
+ const viewSortsMap = new Map(viewSorts.map((vs) => [vs.name, vs]));
880
+ return prev.map((sf) => {
881
+ const updatedSort = viewSortsMap.get(sf.name);
882
+ if (updatedSort) {
883
+ return { ...updatedSort, title: sf.title };
884
+ }
885
+ return sf;
886
+ });
887
+ });
888
+ }
889
+ //****************** Views ******************//
890
+ async setView(viewName = null) {
891
+ this.settingSelectedViewKey = `${this.config.module}:${this.config.name}:selected-view`;
892
+ const savedViewName = await this.settings.get(this.settingSelectedViewKey);
893
+ // this.settings.set()
894
+ if (viewName != this.view().name) {
895
+ this.view.set(this.views().find((c) => c.name == (viewName || savedViewName)) ?? this.views()[0]);
896
+ this.settings.set(this.settingSelectedViewKey, this.view().name);
897
+ this.applyViewSorts();
898
+ this.applyViewColumns();
899
+ this.applyFilterAndSort();
900
+ this.applySettings();
901
+ }
902
+ }
903
+ //****************** Commands ******************//
904
+ async executeCommand(commandName, data = null) {
905
+ const action = this.allActions().find((c) => c.name == commandName &&
906
+ ((this.selectedItems().length
907
+ ? c.scope == AXPEntityCommandScope.Selected
908
+ : c.scope == AXPEntityCommandScope.Individual) ||
909
+ c.scope == AXPEntityCommandScope.TypeLevel));
645
910
  await this.workflow.execute(commandName, {
646
- entity: getEntityInfo(this.detailEntity()).source,
911
+ entity: getEntityInfo(this.entityDef).source,
647
912
  data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
648
913
  });
649
914
  }
915
+ //
916
+ destroy() {
917
+ this.destroyed.next();
918
+ this.destroyed.complete();
919
+ }
650
920
  }
651
-
652
- class AXPEntityMasterSingleViewGroupViewModel {
653
- constructor(entity, section) {
654
- this.entity = entity;
655
- this.section = section;
656
- this.group = this.entity.groups?.find(c => c.id == this.section.id);
657
- this.name = signal(this.group.id);
658
- this.isLoading = signal(false);
659
- this.title = computed(() => {
660
- return this.group.title ?? this.group.id;
661
- });
662
- this.description = computed(() => {
663
- return this.group.description;
664
- });
665
- this.layout = computed(() => {
666
- const source = cloneDeep(this.section.layout ?? {});
667
- set(source, "positions.default.colSpan", 12);
668
- return source;
669
- });
670
- this.props = computed(() => {
671
- const { properties, interfaces } = this.entity;
672
- const groupProperties = properties
673
- .filter(({ groupId, schema }) => groupId === this.group.id && !schema.hidden)
674
- .map(({ name }) => name);
675
- const viewProperties = interfaces?.master?.single?.properties?.filter(({ name }) => groupProperties.includes(name)) ?? [];
676
- return viewProperties.map(prop => new AXPEntityMasterSingleElementViewModel(this.entity, this, prop));
677
- });
678
- this.editableProps = computed(() => {
679
- const { properties, interfaces } = this.entity;
680
- const editablePropertyNames = interfaces?.master?.update?.properties?.map(({ name }) => name) ?? [];
681
- const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id && !schema.hidden && editablePropertyNames.includes(name));
682
- return filteredProperties.map(prop => new AXPEntityMasterSingleElementViewModel(this.entity, this, prop));
683
- });
684
- this.editable = computed(() => {
685
- return this.editableProps().length > 0;
686
- });
921
+ class AXPEntityListViewModelFactory {
922
+ constructor() {
923
+ this.entityService = inject(AXPEntityDefinitionRegistryService);
924
+ this.layout = inject(AXPLayoutThemeService);
925
+ this.injector = inject(Injector);
926
+ }
927
+ async create(moduleName, entityName) {
928
+ this.layout.setNavigationLoading(true);
929
+ const config = await this.entityService.resolve(moduleName, entityName);
930
+ this.layout.setNavigationLoading(false);
931
+ return new AXPEntityMasterListViewModel(this.injector, config);
687
932
  }
933
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityListViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
934
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityListViewModelFactory, providedIn: 'root' }); }
688
935
  }
689
- class AXPEntityMasterSingleElementViewModel {
690
- constructor(entity, section, propertyView) {
936
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityListViewModelFactory, decorators: [{
937
+ type: Injectable,
938
+ args: [{ providedIn: 'root' }]
939
+ }] });
940
+ const AXPEntityListViewModelResolver = (route, state, service = inject(AXPEntityListViewModelFactory)) => {
941
+ const moduleName = route.parent?.paramMap.get('module');
942
+ const entityName = route.paramMap.get('entity');
943
+ //
944
+ return service.create(moduleName, entityName);
945
+ };
946
+
947
+ class AXPEntityMasterUpdateElementViewModel {
948
+ constructor(entity, property) {
691
949
  this.entity = entity;
692
- this.section = section;
693
- this.propertyView = propertyView;
694
- this.property = this.entity.properties.find(c => c.name == this.propertyView.name);
950
+ this.property = property;
695
951
  this.name = signal(this.property.name);
696
952
  this.title = signal(this.property.title);
697
- this.showLabel = signal(this.propertyView.layout?.label?.visible != false);
698
953
  this.description = signal(this.property.description);
954
+ this.editable = computed(() => {
955
+ return !(this.property.schema.readonly ?? false);
956
+ });
957
+ this.isRequired = computed(() => {
958
+ return this.property.validations?.some(c => c.rule == 'required') || false;
959
+ });
699
960
  this.layout = computed(() => {
700
- const viewProp = this.entity.interfaces?.master?.single?.properties?.find(c => c.name == this.property.name);
701
- const source = cloneDeep(viewProp?.layout ?? {});
961
+ const updateProp = this.entity.interfaces?.master?.update?.properties?.find(c => c.name == this.property.name);
962
+ const source = cloneDeep(updateProp?.layout ?? {});
702
963
  set(source, "positions.default.colSpan", 12);
703
964
  return source;
704
965
  });
@@ -707,209 +968,213 @@ class AXPEntityMasterSingleElementViewModel {
707
968
  const widget = schema.interface;
708
969
  return {
709
970
  type: widget.type,
710
- mode: 'view',
971
+ mode: this.editable() ? 'edit' : 'view',
711
972
  path: this.name(),
712
973
  children: widget.children,
713
974
  formula: widget.formula,
714
- options: merge(schema.interface?.options)
975
+ triggers: widget.triggers,
976
+ options: merge(schema.interface?.options,
977
+ //this.property.options?.create?.widget,
978
+ { validationRules: this.property.validations })
715
979
  };
716
980
  });
717
981
  }
718
982
  }
719
- class AXPEntityMasterSingleViewModel {
720
- constructor(injector, config, entityData) {
983
+ class AXPEntityMasterUpdateViewModel {
984
+ constructor(injector, config, entityData, props) {
721
985
  this.injector = injector;
722
986
  this.config = config;
723
987
  this.entityData = entityData;
988
+ this.props = props;
724
989
  this.entityDef = cloneDeep(this.config);
725
- this._viewDef = cloneDeep(this.entityDef.interfaces?.master?.single);
726
- this.session = this.injector.get(AXPSessionService);
727
- this.formatService = this.injector.get(AXFormatService);
728
990
  this.workflow = this.injector.get(AXPWorkflowService);
729
- this.destroyed = new Subject();
730
- this.translateService = this.injector.get(AXTranslationService);
991
+ this.isInProgress = signal(false);
731
992
  this.context = signal(cloneDeep(this.entityData));
732
- this.actions = computed(() => {
733
- return this.entityDef.interfaces?.master?.single?.actions?.map((tr) => new AXPEntityCommandTriggerViewModel(this.entityDef, tr)) ?? [];
734
- });
735
- this.primaryActions = computed(() => {
736
- return this.actions().filter(c => c.priority == 'primary');
737
- });
738
- this.secondaryActions = computed(() => {
739
- return this.actions().filter(c => c.priority == 'secondary');
740
- });
741
- this.sections = computed(() => {
742
- const { interfaces, properties } = this.entityDef;
743
- const viewProps = interfaces?.master?.single?.properties?.map(({ name }) => name) ?? [];
744
- const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && viewProps.includes(name));
745
- const groups = interfaces?.master?.single?.sections?.filter(({ id }) => filteredProperties.some(({ groupId }) => groupId === id)) ?? [];
746
- return groups.map(section => new AXPEntityMasterSingleViewGroupViewModel(this.entityDef, section));
747
- });
748
- //****************** Title ******************//
749
- this.title = computed(() => {
750
- const suggestedProps = this.entityDef.properties.find((c) => ['title', 'name', 'code'].includes(c.name));
751
- let suggestedFormat = 'Item #{{id}}';
752
- if (suggestedProps)
753
- suggestedFormat = `{{${suggestedProps.name}}}`;
754
- return this.formatService.format(this._viewDef.title ?? suggestedFormat, 'string', this.context());
755
- });
756
- //****************** Description ******************//
757
- this.description = computed(() => {
758
- return this._viewDef.description ? this.formatService.format(this._viewDef.description, 'string', this.context()) : null;
759
- });
760
- //****************** Beardcrumbs ******************//
761
- this.beardcrumbs = computed(() => {
762
- return [
763
- {
764
- title: this.translateService.translateSync('entity.home'),
765
- icon: "fa-solid fa-home ax-text-xs ax-me-2",
766
- url: [`/${this.session.application?.name}`]
767
- },
768
- {
769
- title: this.entityDef.formats.plural ?? this.entityDef.formats.individual,
770
- url: [`/${this.session.application?.name}`, 'm', `${this.entityDef.module}`, 'e', `${this.entityDef.name}`, 'list']
771
- },
772
- {
773
- title: this.title(),
774
- }
775
- ];
776
- });
777
- this.relatedEntities = computed(() => {
778
- return this.entityDef.relatedEntities?.map(re => new AXPEntityDetailListViewModel(this.injector, re, { entity: this.entityDef, data: this.entityData })) ?? [];
779
- });
780
- this.workflow.events$
781
- .pipe(ofType(AXPEntityDeletedEvent))
782
- .pipe(takeUntil(this.destroyed))
783
- .subscribe((event) => {
784
- if (event.payload.entity == getEntityInfo(this.entityDef).source &&
785
- event.payload.ids.includes(this.context().id)) {
786
- this.workflow.execute('show-list-view', {
787
- entity: getEntityInfo(this.entityDef).source
788
- });
789
- }
790
- });
791
- this.workflow.events$
792
- .pipe(ofType(AXPEntityModifyEvent))
793
- .pipe(takeUntil(this.destroyed))
794
- .subscribe(async (event) => {
795
- if (event.payload.entity == getEntityInfo(this.entityDef).source &&
796
- event.payload.values.id === this.context().id) {
797
- this.context.set(event.payload.values);
798
- }
993
+ this.elements = computed(() => {
994
+ const props = this.entityDef.properties.filter(c => this.props.includes(c.name) &&
995
+ c.schema.hidden != true);
996
+ return props.map(e => {
997
+ return new AXPEntityMasterUpdateElementViewModel(this.entityDef, e);
998
+ });
799
999
  });
800
1000
  }
801
- async executeCommand(commandName, data = null) {
802
- //TODO: syntact for workflow
803
- switch (commandName) {
804
- case 'modify-entity-section': {
805
- this.workflow.execute('modify-entity-section', {
806
- entity: getEntityInfo(this.entityDef).source,
807
- data: {
808
- id: this.context().id,
809
- properties: data.editableProps().map(m => m.name()),
810
- },
811
- });
812
- break;
1001
+ async save() {
1002
+ this.isInProgress.set(true);
1003
+ try {
1004
+ const com = this.entityDef.commands?.update;
1005
+ if (com) {
1006
+ const exec = com.execute;
1007
+ return await exec(this.context());
813
1008
  }
814
- default:
815
- {
816
- const action = this.actions().find(c => c.name == commandName);
817
- this.workflow.execute(commandName, {
818
- entity: getEntityInfo(this.entityDef).source,
819
- data: action?.scope == AXPEntityCommandScope.Individual ? this.context() : null
820
- });
821
- }
1009
+ }
1010
+ finally {
1011
+ this.isInProgress.set(false);
822
1012
  }
823
1013
  }
824
- //
825
- //
826
- destroy() {
827
- this.destroyed.next();
828
- this.destroyed.complete();
1014
+ reset() {
1015
+ this.context.set(cloneDeep(this.entityData));
829
1016
  }
830
1017
  }
831
- class AXPEntityDetailViewModelFactory {
1018
+ class AXPEntityMasterUpdateViewModelFactory {
832
1019
  constructor() {
833
1020
  this.entityService = inject(AXPEntityDefinitionRegistryService);
834
- this.layout = inject(AXPLayoutService);
1021
+ this.layout = inject(AXPLayoutThemeService);
835
1022
  this.injector = inject(Injector);
836
1023
  }
837
- async create(moduleName, entityName, id) {
1024
+ async create(moduleName, entityName, id, props) {
838
1025
  const config = await this.entityService.resolve(moduleName, entityName);
839
1026
  this.layout.setNavigationLoading(true);
840
1027
  if (config.queries.byKey) {
841
1028
  const func = config.queries.byKey.execute;
842
1029
  const data = await func(id);
843
1030
  this.layout.setNavigationLoading(false);
844
- return new AXPEntityMasterSingleViewModel(this.injector, config, data);
1031
+ return new AXPEntityMasterUpdateViewModel(this.injector, config, data, props);
845
1032
  }
846
1033
  this.layout.setNavigationLoading(false);
847
1034
  return Promise.reject('cannot fetch ');
848
1035
  }
849
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityDetailViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
850
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityDetailViewModelFactory, providedIn: 'root' }); }
1036
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1037
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, providedIn: 'root' }); }
1038
+ }
1039
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityMasterUpdateViewModelFactory, decorators: [{
1040
+ type: Injectable,
1041
+ args: [{ providedIn: 'root' }]
1042
+ }] });
1043
+
1044
+ const AXPEntityModifyEvent = createWorkFlowEvent('[Entity] Modified');
1045
+ class AXPEntityModifySectionPopupAction extends AXPWorkflowAction {
1046
+ constructor() {
1047
+ super(...arguments);
1048
+ this.popupService = inject(AXPopupService);
1049
+ this.platform = inject(AXPlatform);
1050
+ this.translateService = inject(AXTranslationService);
1051
+ this.entityRegistery = inject(AXPEntityDefinitionRegistryService);
1052
+ this.config = inject(AXP_ENTITY_CONFIG_TOKEN);
1053
+ this.factory = inject(AXPEntityMasterUpdateViewModelFactory);
1054
+ }
1055
+ async execute(context) {
1056
+ const [moduleName, entityName] = context.getVariable('entity').split('.');
1057
+ const { properties, id, title } = context.getVariable('data');
1058
+ const entityRef = await this.entityRegistery.resolve(moduleName, entityName);
1059
+ const vm = await this.factory.create(moduleName, entityName, id, properties);
1060
+ const com = await this.config.viewers.master.modify();
1061
+ const popup = await this.popupService.open(com, {
1062
+ title: title ?? `${this.translateService.translateSync('entity.modify')} ${this.translateService.translateSync(entityRef.formats.individual)}`,
1063
+ size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
1064
+ data: {
1065
+ vm,
1066
+ properties,
1067
+ entity: entityRef,
1068
+ },
1069
+ });
1070
+ context.setOutput('result', false);
1071
+ if (popup.data?.result == true) {
1072
+ context.setOutput('result', true);
1073
+ context.setVariable('data', cloneDeep(popup.data.context));
1074
+ }
1075
+ }
1076
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifySectionPopupAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1077
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifySectionPopupAction }); }
851
1078
  }
852
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityDetailViewModelFactory, decorators: [{
853
- type: Injectable,
854
- args: [{ providedIn: 'root' }]
1079
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifySectionPopupAction, decorators: [{
1080
+ type: Injectable
855
1081
  }] });
856
- const AXPEntityDetailViewModelResolver = (route, state, service = inject(AXPEntityDetailViewModelFactory)) => {
857
- const moduleName = route.parent?.paramMap.get('module');
858
- const entityName = route.paramMap.get('entity');
859
- const id = route.paramMap.get('id');
860
- //
861
- return service.create(moduleName, entityName, id);
1082
+ class AXPEntityModifyConfirmedAction extends AXPWorkflowAction {
1083
+ async execute(context) {
1084
+ const updatedData = context.getVariable('data');
1085
+ this.dispatch(AXPEntityModifyEvent({ entity: context.getVariable('entity'), values: updatedData }));
1086
+ }
1087
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifyConfirmedAction, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1088
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifyConfirmedAction }); }
1089
+ }
1090
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityModifyConfirmedAction, decorators: [{
1091
+ type: Injectable
1092
+ }] });
1093
+ const AXPModifyEntitySectionWorkflow = {
1094
+ startStepId: 'modifyPopup',
1095
+ steps: {
1096
+ modifyPopup: {
1097
+ id: 'modifyPopup',
1098
+ action: 'AXPEntityModifySectionPopupAction',
1099
+ nextSteps: [
1100
+ {
1101
+ conditions: [{ type: 'SINGLE', expression: 'context.getOutput("result") == true' }],
1102
+ nextStepId: 'successToast',
1103
+ },
1104
+ ],
1105
+ },
1106
+ successToast: {
1107
+ id: 'successToast',
1108
+ action: 'AXPToastAction',
1109
+ input: {
1110
+ color: 'success',
1111
+ title: 'workflow.entity-modified-title',
1112
+ content: 'workflow.entity-modified-body',
1113
+ },
1114
+ nextSteps: [
1115
+ {
1116
+ conditions: [],
1117
+ nextStepId: 'modifyConfirmed',
1118
+ },
1119
+ ],
1120
+ },
1121
+ modifyConfirmed: {
1122
+ id: 'modifyConfirmed',
1123
+ action: 'AXPEntityModifyConfirmedAction',
1124
+ },
1125
+ },
862
1126
  };
863
1127
 
864
- class AXPEntityCreateViewSectionViewModel {
1128
+ class AXPEntityMasterSingleViewGroupViewModel {
865
1129
  constructor(entity, section) {
866
1130
  this.entity = entity;
867
1131
  this.section = section;
868
1132
  this.group = this.entity.groups?.find(c => c.id == this.section.id);
869
1133
  this.name = signal(this.group.id);
1134
+ this.isLoading = signal(false);
870
1135
  this.title = computed(() => {
871
1136
  return this.group.title ?? this.group.id;
872
1137
  });
873
1138
  this.description = computed(() => {
874
1139
  return this.group.description;
875
- ;
876
1140
  });
877
1141
  this.layout = computed(() => {
878
1142
  const source = cloneDeep(this.section.layout ?? {});
879
1143
  set(source, "positions.default.colSpan", 12);
880
1144
  return source;
881
1145
  });
882
- this.elements = computed(() => {
883
- const { interfaces, properties } = this.entity;
884
- const createProps = interfaces?.master?.create?.properties ?? [];
885
- const createPropNames = new Set(createProps.map(({ name }) => name));
886
- const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id &&
887
- !schema.hidden &&
888
- createPropNames.has(name));
889
- return filteredProperties.map(property => {
890
- const createProp = createProps.find(({ name }) => name === property.name);
891
- return new AXPEntityCreateViewElementViewModel(this.entity, this, property, createProp);
892
- });
1146
+ this.props = computed(() => {
1147
+ const { properties, interfaces } = this.entity;
1148
+ const groupProperties = properties
1149
+ .filter(({ groupId, schema }) => groupId === this.group.id && !schema.hidden)
1150
+ .map(({ name }) => name);
1151
+ const viewProperties = interfaces?.master?.single?.properties?.filter(({ name }) => groupProperties.includes(name)) ?? [];
1152
+ return viewProperties.map(prop => new AXPEntityMasterSingleElementViewModel(this.entity, this, prop));
1153
+ });
1154
+ this.editableProps = computed(() => {
1155
+ const { properties, interfaces } = this.entity;
1156
+ const editablePropertyNames = interfaces?.master?.update?.properties?.map(({ name }) => name) ?? [];
1157
+ const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id && !schema.hidden && editablePropertyNames.includes(name));
1158
+ return filteredProperties.map(prop => new AXPEntityMasterSingleElementViewModel(this.entity, this, prop));
1159
+ });
1160
+ this.editable = computed(() => {
1161
+ return this.editableProps().length > 0;
893
1162
  });
894
1163
  }
895
1164
  }
896
- class AXPEntityCreateViewElementViewModel {
897
- constructor(entity, section, property, createProp) {
1165
+ class AXPEntityMasterSingleElementViewModel {
1166
+ constructor(entity, section, propertyView) {
898
1167
  this.entity = entity;
899
1168
  this.section = section;
900
- this.property = property;
901
- this.createProp = createProp;
1169
+ this.propertyView = propertyView;
1170
+ this.property = this.entity.properties.find(c => c.name == this.propertyView.name);
902
1171
  this.name = signal(this.property.name);
903
1172
  this.title = signal(this.property.title);
1173
+ this.showLabel = signal(this.propertyView.layout?.label?.visible != false);
904
1174
  this.description = signal(this.property.description);
905
- this.editable = computed(() => {
906
- return !(this.property.schema.readonly ?? false);
907
- });
908
- this.isRequired = computed(() => {
909
- return this.property.validations?.some(c => c.rule == 'required') || false;
910
- });
911
1175
  this.layout = computed(() => {
912
- const source = cloneDeep(this.createProp.layout ?? {});
1176
+ const viewProp = this.entity.interfaces?.master?.single?.properties?.find(c => c.name == this.property.name);
1177
+ const source = cloneDeep(viewProp?.layout ?? {});
913
1178
  set(source, "positions.default.colSpan", 12);
914
1179
  return source;
915
1180
  });
@@ -918,394 +1183,158 @@ class AXPEntityCreateViewElementViewModel {
918
1183
  const widget = schema.interface;
919
1184
  return {
920
1185
  type: widget.type,
921
- mode: this.editable() ? 'edit' : 'view',
1186
+ mode: 'view',
922
1187
  path: this.name(),
923
1188
  children: widget.children,
924
1189
  formula: widget.formula,
925
- triggers: widget.triggers,
926
- options: merge(schema.interface?.options,
927
- //this.property.options?.create?.widget,
928
- { validationRules: this.property.validations })
1190
+ options: merge(schema.interface?.options)
929
1191
  };
930
1192
  });
931
1193
  }
932
1194
  }
933
- class AXPEntityMasterCreateViewModel {
934
- constructor(injector, config, initialData = {}) {
935
- this.injector = injector;
936
- this.config = config;
937
- this.initialData = initialData;
938
- this.entityDef = cloneDeep(this.config);
939
- this.workflow = this.injector.get(AXPWorkflowService);
940
- this.context = signal(this.initialData ?? {});
941
- this.isInProgress = signal(false);
942
- this.sections = computed(() => {
943
- const { interfaces, properties } = this.entityDef;
944
- const createProps = interfaces?.master?.create?.properties?.map(({ name }) => name) ?? [];
945
- const visibleProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && createProps.includes(name));
946
- const sections = interfaces?.master?.create?.sections?.filter(({ id }) => visibleProperties.some(({ groupId }) => groupId === id)) ?? [];
947
- return sections.map(section => new AXPEntityCreateViewSectionViewModel(this.entityDef, section));
948
- });
949
- if (!initialData)
950
- initialData = {};
951
- this.config.properties
952
- .filter(c => c.schema.defaultValue != null)
953
- .forEach(p => {
954
- if (typeof p.schema.defaultValue === 'function') {
955
- const func = p.schema.defaultValue;
956
- set(initialData, p.name, func(initialData));
957
- }
958
- else {
959
- set(initialData, p.name, p.schema.defaultValue);
960
- }
961
- });
962
- this.context.set(initialData);
963
- }
964
- async save() {
965
- try {
966
- this.isInProgress.set(true);
967
- const exec = this.entityDef.commands?.create?.execute;
968
- return await exec((this.context()));
969
- }
970
- finally {
971
- this.isInProgress.set(false);
972
- }
973
- }
974
- async createNewOne() {
975
- await this.workflow.execute('create-entity', {
976
- entity: getEntityInfo(this.entityDef).source
977
- });
978
- }
979
- }
980
- class AXPEntityCreateViewModelFactory {
981
- constructor() {
982
- this.entityService = inject(AXPEntityDefinitionRegistryService);
983
- this.layout = inject(AXPLayoutService);
984
- this.injector = inject(Injector);
985
- }
986
- async create(moduleName, entityName, initialData = null) {
987
- this.layout.setNavigationLoading(true);
988
- const config = await this.entityService.resolve(moduleName, entityName);
989
- this.layout.setNavigationLoading(false);
990
- return new AXPEntityMasterCreateViewModel(this.injector, config, initialData);
991
- }
992
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityCreateViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
993
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityCreateViewModelFactory, providedIn: 'root' }); }
994
- }
995
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityCreateViewModelFactory, decorators: [{
996
- type: Injectable,
997
- args: [{ providedIn: 'root' }]
998
- }] });
999
-
1000
- class AXPEntityMasterListViewQueryViewModel {
1001
- constructor(entity, section, view) {
1002
- this.entity = entity;
1003
- this.section = section;
1004
- this.view = view;
1005
- this.name = this.view.name;
1006
- this.title = this.view.title;
1007
- this.sorts = this.view.sorts;
1008
- this.columns = this.view.columns;
1009
- this.conditions = this.view.conditions;
1010
- }
1011
- }
1012
- class AXPEntityMasterListViewModel {
1013
- constructor(injector, config) {
1195
+ class AXPEntityMasterSingleViewModel {
1196
+ constructor(injector, config, entityData) {
1014
1197
  this.injector = injector;
1015
1198
  this.config = config;
1199
+ this.entityData = entityData;
1016
1200
  this.entityDef = cloneDeep(this.config);
1017
- this._viewDef = cloneDeep(this.entityDef.interfaces?.master?.list);
1018
- this.formatService = this.injector.get(AXFormatService);
1201
+ this._viewDef = cloneDeep(this.entityDef.interfaces?.master?.single);
1019
1202
  this.session = this.injector.get(AXPSessionService);
1203
+ this.formatService = this.injector.get(AXFormatService);
1020
1204
  this.workflow = this.injector.get(AXPWorkflowService);
1021
1205
  this.destroyed = new Subject();
1022
- this.events$ = new Subject();
1023
- this.dataSource = new AXDataSource({
1024
- byKey: (key) => {
1025
- const func = this.entityDef.queries.byKey.execute;
1026
- return func();
1027
- },
1028
- load: (e) => {
1029
- const func = this.entityDef.queries.list?.execute;
1030
- return func(e);
1031
- },
1032
- pageSize: 10,
1033
- key: 'id',
1206
+ this.translateService = this.injector.get(AXTranslationService);
1207
+ this.context = signal(cloneDeep(this.entityData));
1208
+ this.actions = computed(() => {
1209
+ return this.entityDef.interfaces?.master?.single?.actions?.map((tr) => new AXPEntityCommandTriggerViewModel(this.entityDef, tr)) ?? [];
1034
1210
  });
1035
- this.selectedItems = signal([]);
1036
- this.hasSelectedItems = computed(() => {
1037
- return this.selectedItems().length > 0;
1211
+ this.primaryActions = computed(() => {
1212
+ return this.actions().filter(c => c.priority == 'primary');
1213
+ });
1214
+ this.secondaryActions = computed(() => {
1215
+ return this.actions().filter(c => c.priority == 'secondary');
1216
+ });
1217
+ this.sections = computed(() => {
1218
+ const { interfaces, properties } = this.entityDef;
1219
+ const viewProps = interfaces?.master?.single?.properties?.map(({ name }) => name) ?? [];
1220
+ const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && viewProps.includes(name));
1221
+ const groups = interfaces?.master?.single?.sections?.filter(({ id }) => filteredProperties.some(({ groupId }) => groupId === id)) ?? [];
1222
+ return groups.map(section => new AXPEntityMasterSingleViewGroupViewModel(this.entityDef, section));
1038
1223
  });
1039
1224
  //****************** Title ******************//
1040
1225
  this.title = computed(() => {
1041
- return this._viewDef.title ?? this.entityDef.formats.plural;
1226
+ const suggestedProps = this.entityDef.properties.find((c) => ['title', 'name', 'code'].includes(c.name));
1227
+ let suggestedFormat = 'Item #{{id}}';
1228
+ if (suggestedProps)
1229
+ suggestedFormat = `{{${suggestedProps.name}}}`;
1230
+ return this.formatService.format(this._viewDef.title ?? suggestedFormat, 'string', this.context());
1042
1231
  });
1043
1232
  //****************** Description ******************//
1044
1233
  this.description = computed(() => {
1045
- return this._viewDef.description ?? null;
1046
- });
1047
- //****************** Inline filter ******************//
1048
- this.inlineFiltersPlaceholders = computed(() => {
1049
- return this.entityDef.properties.filter((p) => p.options?.filter?.inline?.enabled).map((c) => c.title ?? c.name);
1050
- });
1051
- this.hasInlineFilters = computed(() => {
1052
- return this.inlineFiltersPlaceholders().length > 0;
1234
+ return this._viewDef.description ? this.formatService.format(this._viewDef.description, 'string', this.context()) : null;
1053
1235
  });
1054
1236
  //****************** Beardcrumbs ******************//
1055
1237
  this.beardcrumbs = computed(() => {
1056
1238
  return [
1057
1239
  {
1058
- title: 'entity.home',
1059
- icon: 'fa-solid fa-home ax-text-xs ax-me-2',
1060
- url: [`/${this.session.application?.name}`],
1240
+ title: this.translateService.translateSync('entity.home'),
1241
+ icon: "fa-solid fa-home ax-text-xs ax-me-2",
1242
+ url: [`/${this.session.application?.name}`]
1243
+ },
1244
+ {
1245
+ title: this.entityDef.formats.plural ?? this.entityDef.formats.individual,
1246
+ url: [`/${this.session.application?.name}`, 'm', `${this.entityDef.module}`, 'e', `${this.entityDef.name}`, 'list']
1061
1247
  },
1062
1248
  {
1063
1249
  title: this.title(),
1064
- url: [
1065
- `/${this.session.application?.name}`,
1066
- 'm',
1067
- `${this.entityDef.module}`,
1068
- 'e',
1069
- `${this.entityDef.name}`,
1070
- 'list',
1071
- ],
1072
- },
1250
+ }
1073
1251
  ];
1074
1252
  });
1075
- //****************** Actions ******************//
1076
- this.allActions = computed(() => {
1077
- const list = this.entityDef.interfaces?.master?.list?.actions ?? [];
1078
- return list.map((tr) => new AXPEntityCommandTriggerViewModel(this.entityDef, tr)) ?? [];
1079
- });
1080
- this.primaryActions = computed(() => {
1081
- return this.allActions().filter((a) => a.priority == 'primary' &&
1082
- ((a.scope == AXPEntityCommandScope.Selected && this.hasSelectedItems()) ||
1083
- (a.scope == AXPEntityCommandScope.TypeLevel && !this.hasSelectedItems())));
1084
- });
1085
- this.secondaryActions = computed(() => {
1086
- return this.allActions().filter((a) => a.priority == 'secondary' &&
1087
- ((a.scope == AXPEntityCommandScope.Selected && this.hasSelectedItems()) ||
1088
- (a.scope == AXPEntityCommandScope.TypeLevel && !this.hasSelectedItems())));
1089
- });
1090
- this.primaryRowActions = computed(() => this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Individual && a.priority === 'primary'));
1091
- this.secondaryRowActions = computed(() => this.allActions().filter((a) => a.scope == AXPEntityCommandScope.Individual && a.priority === 'secondary'));
1092
- //****************** Filter ******************//
1093
- this.inlineFilters = {
1094
- field: null,
1095
- logic: 'or',
1096
- operator: null,
1097
- filters: [],
1098
- };
1099
- this.advanceFilters = {
1100
- field: null,
1101
- logic: 'and',
1102
- operator: null,
1103
- filters: [],
1104
- };
1105
- //****************** Columns ******************//
1106
- this.allAvailableColumns = () => {
1107
- const { columns = [], properties } = this.entityDef;
1108
- const visibleProperties = properties.filter(({ schema }) => !schema?.hidden);
1109
- const visiblePropNames = new Set(visibleProperties.map(({ name }) => name));
1110
- return columns
1111
- .filter(({ name }) => visiblePropNames.has(name))
1112
- .map((column) => {
1113
- const property = visibleProperties.find(({ name }) => name === column.name);
1114
- return new AXPEntityListViewColumnViewModel(property, column);
1115
- });
1116
- };
1117
- this.visibleColumnCount = () => {
1118
- return this.columns().filter((c) => c.visible == true).length;
1119
- };
1120
- this.columns = signal([]);
1121
- //****************** Sort ******************//
1122
- this.sortableFields = () => {
1123
- const props = this.entityDef.properties.filter((c) => c.options?.sort?.enabled);
1124
- return props.map((e) => {
1125
- return {
1126
- name: e.name,
1127
- title: e.title,
1128
- dir: undefined,
1129
- };
1130
- });
1131
- };
1132
- this.sortableFieldsCount = () => {
1133
- return this.entityDef.properties.filter((c) => c.options?.sort?.enabled).length ?? 0;
1134
- };
1135
- this.canSort = () => {
1136
- return this.sortableFieldsCount() > 0;
1137
- };
1138
- this.canAddMoreSort = () => {
1139
- return this.sortedCount() < this.sortableFieldsCount();
1140
- };
1141
- this.sortedCount = () => {
1142
- return this.sortedFields().filter((i) => i.dir).length;
1143
- };
1144
- this.sortedFields = signal([]);
1145
- this.views = computed(() => {
1146
- const views = this.entityDef.interfaces?.master?.list?.views ?? [];
1147
- return views.map((v) => {
1148
- return new AXPEntityMasterListViewQueryViewModel(this.entityDef, this, v);
1149
- });
1253
+ this.relatedEntities = computed(() => {
1254
+ return this.entityDef.relatedEntities?.map(re => new AXPEntityDetailListViewModel(this.injector, re, { entity: this.entityDef, data: this.entityData })) ?? [];
1150
1255
  });
1151
- this.view = signal(this.views()[0]);
1152
1256
  this.workflow.events$
1153
1257
  .pipe(ofType(AXPEntityDeletedEvent))
1154
1258
  .pipe(takeUntil(this.destroyed))
1155
1259
  .subscribe((event) => {
1156
- if (event.payload.entity == getEntityInfo(this.entityDef).source) {
1157
- this.selectedItems.set([]);
1158
- this.events$.next({ action: 'refresh' });
1260
+ if (event.payload.entity == getEntityInfo(this.entityDef).source &&
1261
+ event.payload.ids.includes(this.context().id)) {
1262
+ this.workflow.execute('show-list-view', {
1263
+ entity: getEntityInfo(this.entityDef).source
1264
+ });
1265
+ }
1266
+ });
1267
+ this.workflow.events$
1268
+ .pipe(ofType(AXPEntityModifyEvent))
1269
+ .pipe(takeUntil(this.destroyed))
1270
+ .subscribe(async (event) => {
1271
+ if (event.payload.entity == getEntityInfo(this.entityDef).source &&
1272
+ event.payload.values.id === this.context().id) {
1273
+ this.context.set(event.payload.values);
1159
1274
  }
1160
1275
  });
1161
- console.log(this.sortableFields());
1162
- this.sortedFields.set(this.sortableFields());
1163
- }
1164
- clearSelection() {
1165
- this.selectedItems.set([]);
1166
1276
  }
1167
- applyInlineFilter(value) {
1168
- const props = this.entityDef.properties.filter((c) => c.options?.filter?.inline?.enabled);
1169
- this.inlineFilters.filters = [];
1170
- if (value) {
1171
- props.forEach((p) => {
1172
- this.inlineFilters.filters?.push({
1173
- field: p.name,
1174
- operator: {
1175
- type: 'contains',
1277
+ async executeCommand(commandName, data = null) {
1278
+ //TODO: syntact for workflow
1279
+ switch (commandName) {
1280
+ case 'modify-entity-section': {
1281
+ this.workflow.execute('modify-entity-section', {
1282
+ entity: getEntityInfo(this.entityDef).source,
1283
+ data: {
1284
+ id: this.context().id,
1285
+ properties: data.editableProps().map(m => m.name()),
1176
1286
  },
1177
- value,
1178
1287
  });
1179
- });
1180
- }
1181
- this.applyFilterAndSort();
1182
- }
1183
- applyFilterAndSort() {
1184
- this.dataSource.clearFilter();
1185
- //
1186
- this.dataSource.sort(...this.sortedFields().map((s) => ({ dir: s.dir, field: s.name })));
1187
- //
1188
- this.advanceFilters.filters = this.view().conditions.map((f) => ({
1189
- field: f.name,
1190
- operator: f.operator,
1191
- value: f.value,
1192
- }));
1193
- //
1194
- const inline = this.inlineFilters.filters?.length ?? 0;
1195
- const advance = this.advanceFilters.filters?.length ?? 0;
1196
- if (inline && !advance) {
1197
- this.dataSource.filter(this.inlineFilters);
1198
- }
1199
- else if (!inline && advance) {
1200
- this.dataSource.filter(this.advanceFilters);
1201
- }
1202
- else if (inline && advance) {
1203
- this.dataSource.filter({
1204
- field: null,
1205
- logic: 'and',
1206
- operator: null,
1207
- filters: [this.inlineFilters, this.advanceFilters],
1208
- });
1209
- }
1210
- //
1211
- this.dataSource.refresh();
1212
- }
1213
- resetColumns() {
1214
- this.applyViewColumns();
1215
- }
1216
- applyColumns() {
1217
- //this.columns.set(this.clonedColumns())
1218
- }
1219
- applyViewColumns() {
1220
- const cols = this.view().columns;
1221
- const cloned = this.allAvailableColumns().map((c) => {
1222
- const column = this.entityDef.columns?.find((cc) => cc.name == c.name);
1223
- const prop = this.entityDef.properties.find((p) => p.name == c.name);
1224
- const col = new AXPEntityListViewColumnViewModel(prop, column);
1225
- col.visible = !cols.some((c) => c == col.name) && col.visible != false;
1226
- return col;
1227
- });
1228
- this.columns.set(cloned);
1229
- }
1230
- resetSorts() {
1231
- this.applyViewSorts();
1232
- }
1233
- applySorts() {
1234
- this.applyFilterAndSort();
1235
- }
1236
- addSort() {
1237
- const prop = this.sortableFields().find((c) => !this.sortedFields().some((s) => s.name == c.name));
1238
- if (prop) {
1239
- this.sortedFields.set([...this.sortedFields(), ...[prop]]);
1240
- }
1241
- }
1242
- removeSort(name) {
1243
- this.sortedFields.set(this.sortedFields().filter((c) => c.name != name));
1244
- }
1245
- applyViewSorts() {
1246
- const viewSorts = this.view().sorts;
1247
- this.sortedFields.update((prev) => {
1248
- const viewSortsMap = new Map(viewSorts.map((vs) => [vs.name, vs]));
1249
- return prev.map((sf) => {
1250
- const updatedSort = viewSortsMap.get(sf.name);
1251
- if (updatedSort) {
1252
- return { ...updatedSort, title: sf.title };
1288
+ break;
1289
+ }
1290
+ default:
1291
+ {
1292
+ const action = this.actions().find(c => c.name == commandName);
1293
+ this.workflow.execute(commandName, {
1294
+ entity: getEntityInfo(this.entityDef).source,
1295
+ data: action?.scope == AXPEntityCommandScope.Individual ? this.context() : null
1296
+ });
1253
1297
  }
1254
- return sf;
1255
- });
1256
- });
1257
- }
1258
- //****************** Views ******************//
1259
- setView(viewName = null) {
1260
- if (viewName != this.view().name) {
1261
- this.view.set(this.views().find((c) => c.name == viewName) ?? this.views()[0]);
1262
- this.applyViewSorts();
1263
- this.applyViewColumns();
1264
- this.applyFilterAndSort();
1265
1298
  }
1266
1299
  }
1267
- //****************** Commands ******************//
1268
- async executeCommand(commandName, data = null) {
1269
- const action = this.allActions().find((c) => c.name == commandName &&
1270
- ((this.selectedItems().length
1271
- ? c.scope == AXPEntityCommandScope.Selected
1272
- : c.scope == AXPEntityCommandScope.Individual) ||
1273
- c.scope == AXPEntityCommandScope.TypeLevel));
1274
- await this.workflow.execute(commandName, {
1275
- entity: getEntityInfo(this.entityDef).source,
1276
- data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data,
1277
- });
1278
- }
1300
+ //
1279
1301
  //
1280
1302
  destroy() {
1281
1303
  this.destroyed.next();
1282
1304
  this.destroyed.complete();
1283
1305
  }
1284
1306
  }
1285
- class AXPEntityListViewModelFactory {
1307
+ class AXPEntityDetailViewModelFactory {
1286
1308
  constructor() {
1287
1309
  this.entityService = inject(AXPEntityDefinitionRegistryService);
1288
- this.layout = inject(AXPLayoutService);
1310
+ this.layout = inject(AXPLayoutThemeService);
1289
1311
  this.injector = inject(Injector);
1290
1312
  }
1291
- async create(moduleName, entityName) {
1292
- this.layout.setNavigationLoading(true);
1313
+ async create(moduleName, entityName, id) {
1293
1314
  const config = await this.entityService.resolve(moduleName, entityName);
1315
+ this.layout.setNavigationLoading(true);
1316
+ if (config.queries.byKey) {
1317
+ const func = config.queries.byKey.execute;
1318
+ const data = await func(id);
1319
+ this.layout.setNavigationLoading(false);
1320
+ return new AXPEntityMasterSingleViewModel(this.injector, config, data);
1321
+ }
1294
1322
  this.layout.setNavigationLoading(false);
1295
- return new AXPEntityMasterListViewModel(this.injector, config);
1323
+ return Promise.reject('cannot fetch ');
1296
1324
  }
1297
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityListViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1298
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityListViewModelFactory, providedIn: 'root' }); }
1325
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityDetailViewModelFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1326
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityDetailViewModelFactory, providedIn: 'root' }); }
1299
1327
  }
1300
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityListViewModelFactory, decorators: [{
1328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXPEntityDetailViewModelFactory, decorators: [{
1301
1329
  type: Injectable,
1302
1330
  args: [{ providedIn: 'root' }]
1303
1331
  }] });
1304
- const AXPEntityListViewModelResolver = (route, state, service = inject(AXPEntityListViewModelFactory)) => {
1332
+ const AXPEntityDetailViewModelResolver = (route, state, service = inject(AXPEntityDetailViewModelFactory)) => {
1305
1333
  const moduleName = route.parent?.paramMap.get('module');
1306
1334
  const entityName = route.paramMap.get('entity');
1335
+ const id = route.paramMap.get('id');
1307
1336
  //
1308
- return service.create(moduleName, entityName);
1337
+ return service.create(moduleName, entityName, id);
1309
1338
  };
1310
1339
 
1311
1340
  class AXPLookupWidgetViewComponent extends AXPWidgetComponent {
@@ -2380,11 +2409,6 @@ function routesFacory() {
2380
2409
  {
2381
2410
  path: ':module',
2382
2411
  children: [
2383
- // {
2384
- // path: 'e/:entity/:id/view/:section',
2385
- // resolve: { loader: AXPEntityDetailViewLoaderResolver },
2386
- // component: AXPEntityDetailsViewComponent,
2387
- // },
2388
2412
  {
2389
2413
  path: 'e/:entity/list',
2390
2414
  loadComponent: () => {
@@ -2512,5 +2536,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImpor
2512
2536
  * Generated bundle index. Do not edit.
2513
2537
  */
2514
2538
 
2515
- export { AXPEntityCreateViewElementViewModel, AXPEntityCreateViewModelFactory, AXPEntityCreateViewSectionViewModel, AXPEntityDefinitionRegistryService, AXPEntityDetailListViewModel, AXPEntityDetailViewModelFactory, AXPEntityDetailViewModelResolver, AXPEntityListViewModelFactory, AXPEntityListViewModelResolver, AXPEntityMasterCreateViewModel, AXPEntityMasterListViewModel, AXPEntityMasterListViewQueryViewModel, AXPEntityMasterSingleElementViewModel, AXPEntityMasterSingleViewGroupViewModel, AXPEntityMasterSingleViewModel, AXPEntityMasterUpdateElementViewModel, AXPEntityMasterUpdateViewModel, AXPEntityMasterUpdateViewModelFactory, AXPEntityModule, AXPEntityResolver, AXPEntityService, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER };
2539
+ export { AXPEntityCommandTriggerViewModel, AXPEntityCreateViewElementViewModel, AXPEntityCreateViewModelFactory, AXPEntityCreateViewSectionViewModel, AXPEntityDefinitionRegistryService, AXPEntityDetailListViewModel, AXPEntityDetailViewModelFactory, AXPEntityDetailViewModelResolver, AXPEntityListViewColumnViewModel, AXPEntityListViewModelFactory, AXPEntityListViewModelResolver, AXPEntityMasterCreateViewModel, AXPEntityMasterListViewModel, AXPEntityMasterListViewQueryViewModel, AXPEntityMasterSingleElementViewModel, AXPEntityMasterSingleViewGroupViewModel, AXPEntityMasterSingleViewModel, AXPEntityMasterUpdateElementViewModel, AXPEntityMasterUpdateViewModel, AXPEntityMasterUpdateViewModelFactory, AXPEntityModule, AXPEntityResolver, AXPEntityService, AXP_ENTITY_CONFIG_TOKEN, AXP_ENTITY_DEFINITION_LOADER };
2516
2540
  //# sourceMappingURL=acorex-platform-layout-entity.mjs.map