@sankhyalabs/sankhyablocks 10.1.0-dev.52 → 10.1.0-dev.54

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 (265) hide show
  1. package/dist/cjs/{ConfigStorage-a1fab5ca.js → ConfigStorage-4201dd3d.js} +2 -2
  2. package/dist/cjs/{DataFetcher-384d2ce8.js → DataFetcher-b3a8075d.js} +2830 -2
  3. package/dist/cjs/FormConfigHelper-c5f5473a.js +342 -0
  4. package/dist/cjs/{ISave-ecbe9336.js → ISave-4674c283.js} +1 -1
  5. package/dist/cjs/{PersonalizedFilterUtils-eccb267a.js → PersonalizedFilterUtils-263e4d24.js} +52 -5
  6. package/dist/cjs/{SnkFormConfigManager-44386305.js → SnkFormConfigManager-c3a49038.js} +2 -2
  7. package/dist/cjs/{SnkMultiSelectionListDataSource-d341dd02.js → SnkMultiSelectionListDataSource-3a13fd34.js} +4 -4
  8. package/dist/cjs/{auth-fetcher-6b134ec4.js → auth-fetcher-0ecc53ff.js} +1 -1
  9. package/dist/cjs/{dataunit-fetcher-b9822794.js → dataunit-fetcher-c7e66f0d.js} +13 -4
  10. package/dist/cjs/{filter-type.enum-2bb46d2a.js → filter-type.enum-b3b388af.js} +7 -0
  11. package/dist/cjs/{form-config-fetcher-45d1964c.js → form-config-fetcher-f80dbc3b.js} +23 -5
  12. package/dist/cjs/index-1894343a.js +24 -36
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -5
  15. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  16. package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -6
  17. package/dist/cjs/snk-application.cjs.entry.js +7 -8
  18. package/dist/cjs/snk-attach_11.cjs.entry.js +2950 -0
  19. package/dist/cjs/snk-crud.cjs.entry.js +31 -243
  20. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -6
  21. package/dist/cjs/{snk-data-unit-4b6dc396.js → snk-data-unit-35f10e01.js} +11 -11
  22. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -4
  23. package/dist/cjs/snk-detail-view.cjs.entry.js +9 -10
  24. package/dist/cjs/snk-dynaform-config-header_5.cjs.entry.js +739 -0
  25. package/dist/cjs/snk-dynaform-detail-view_2.cjs.entry.js +938 -0
  26. package/dist/cjs/snk-dynaform-field-config_2.cjs.entry.js +327 -0
  27. package/dist/cjs/snk-dynaform-guides-view-e98f7f3a.js +747 -0
  28. package/dist/cjs/snk-dynaform-guides-view.cjs.entry.js +23 -0
  29. package/dist/cjs/snk-dynaform.cjs.entry.js +675 -0
  30. package/dist/cjs/{snk-expression-group_2.cjs.entry.js → snk-expression-group_4.cjs.entry.js} +421 -18
  31. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +41 -44
  32. package/dist/cjs/snk-form_2.cjs.entry.js +4 -5
  33. package/dist/cjs/snk-grid.cjs.entry.js +7 -8
  34. package/dist/cjs/{snk-guides-viewer-8e7a503b.js → snk-guides-viewer-3054d541.js} +1 -1
  35. package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -6
  36. package/dist/cjs/snk-layout-form-config.cjs.entry.js +4 -5
  37. package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -5
  38. package/dist/cjs/taskbarUtils-383c596e.js +231 -0
  39. package/dist/collection/collection-manifest.json +17 -0
  40. package/dist/collection/components/snk-dynaform/interfaces/PropsCustomEditor.js +1 -0
  41. package/dist/collection/components/snk-dynaform/interfaces/PropsCustomRender.js +1 -0
  42. package/dist/collection/components/snk-dynaform/snk-dynaform.css +64 -0
  43. package/dist/collection/components/snk-dynaform/snk-dynaform.js +1657 -0
  44. package/dist/collection/components/snk-dynaform/subcomponents/CardFormResizeObserver.js +26 -0
  45. package/dist/collection/components/snk-dynaform/subcomponents/GuideBuilder.js +51 -0
  46. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.css +112 -0
  47. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.js +992 -0
  48. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.css +64 -0
  49. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.js +588 -0
  50. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.css +98 -0
  51. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.js +1167 -0
  52. package/dist/collection/components/snk-dynaform-form-config/FormConfigHelper.js +325 -0
  53. package/dist/collection/components/snk-dynaform-form-config/SnkFormConfigManager.js +212 -0
  54. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.css +17 -0
  55. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.js +236 -0
  56. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.css +41 -0
  57. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.js +170 -0
  58. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.css +22 -0
  59. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.js +408 -0
  60. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.css +88 -0
  61. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.js +209 -0
  62. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.css +167 -0
  63. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.js +655 -0
  64. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.css +42 -0
  65. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.js +171 -0
  66. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.css +66 -0
  67. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.js +557 -0
  68. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.css +80 -0
  69. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.js +326 -0
  70. package/dist/collection/components/snk-grid/snk-grid.css +4 -2
  71. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -1
  72. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +22 -4
  73. package/dist/components/dataunit-fetcher.js +11 -1
  74. package/dist/components/form-config-fetcher.js +22 -4
  75. package/dist/components/index.d.ts +12 -0
  76. package/dist/components/index.js +12 -0
  77. package/dist/components/snk-crud.js +1 -212
  78. package/dist/components/snk-dynaform-config-header.d.ts +11 -0
  79. package/dist/components/snk-dynaform-config-header.js +6 -0
  80. package/dist/components/snk-dynaform-config-header2.js +103 -0
  81. package/dist/components/snk-dynaform-configs-button.d.ts +11 -0
  82. package/dist/components/snk-dynaform-configs-button.js +6 -0
  83. package/dist/components/snk-dynaform-configs-button2.js +76 -0
  84. package/dist/components/snk-dynaform-detail-view.d.ts +11 -0
  85. package/dist/components/snk-dynaform-detail-view.js +6 -0
  86. package/dist/components/snk-dynaform-detail-view2.js +1835 -0
  87. package/dist/components/snk-dynaform-field-config.d.ts +11 -0
  88. package/dist/components/snk-dynaform-field-config.js +6 -0
  89. package/dist/components/snk-dynaform-field-config2.js +605 -0
  90. package/dist/components/snk-dynaform-field-item.d.ts +11 -0
  91. package/dist/components/snk-dynaform-field-item.js +6 -0
  92. package/dist/components/snk-dynaform-field-item2.js +96 -0
  93. package/dist/components/snk-dynaform-fields-layout.d.ts +11 -0
  94. package/dist/components/snk-dynaform-fields-layout.js +6 -0
  95. package/dist/components/snk-dynaform-fields-layout2.js +428 -0
  96. package/dist/components/snk-dynaform-fields-selector.d.ts +11 -0
  97. package/dist/components/snk-dynaform-fields-selector.js +6 -0
  98. package/dist/components/snk-dynaform-fields-selector2.js +104 -0
  99. package/dist/components/snk-dynaform-form-config.d.ts +11 -0
  100. package/dist/components/snk-dynaform-form-config.js +6 -0
  101. package/dist/components/snk-dynaform-form-config2.js +430 -0
  102. package/dist/components/snk-dynaform-form-view.d.ts +11 -0
  103. package/dist/components/snk-dynaform-form-view.js +6 -0
  104. package/dist/components/snk-dynaform-form-view2.js +270 -0
  105. package/dist/components/snk-dynaform-guides-configurator.d.ts +11 -0
  106. package/dist/components/snk-dynaform-guides-configurator.js +6 -0
  107. package/dist/components/snk-dynaform-guides-configurator2.js +173 -0
  108. package/dist/components/snk-dynaform-guides-view.d.ts +11 -0
  109. package/dist/components/snk-dynaform-guides-view.js +6 -0
  110. package/dist/components/snk-dynaform.d.ts +11 -0
  111. package/dist/components/snk-dynaform.js +1003 -0
  112. package/dist/components/snk-grid2.js +1 -1
  113. package/dist/components/taskbarUtils.js +224 -0
  114. package/dist/esm/{ConfigStorage-76872695.js → ConfigStorage-e834d1ea.js} +2 -2
  115. package/dist/esm/{DataFetcher-e60f8d53.js → DataFetcher-5ed0a377.js} +2830 -3
  116. package/dist/esm/FormConfigHelper-efc29480.js +328 -0
  117. package/dist/esm/{ISave-4929c071.js → ISave-5b46d691.js} +1 -1
  118. package/dist/esm/{PersonalizedFilterUtils-d2439a9a.js → PersonalizedFilterUtils-45b5803c.js} +49 -2
  119. package/dist/esm/{SnkFormConfigManager-83f6b22f.js → SnkFormConfigManager-bfd575c2.js} +2 -2
  120. package/dist/esm/{SnkMultiSelectionListDataSource-18abafb1.js → SnkMultiSelectionListDataSource-22b50dd6.js} +4 -4
  121. package/dist/esm/{auth-fetcher-1a31c1e4.js → auth-fetcher-5283045d.js} +1 -1
  122. package/dist/esm/{dataunit-fetcher-c176e002.js → dataunit-fetcher-2200fdd6.js} +12 -3
  123. package/dist/esm/{filter-type.enum-f6a8fe23.js → filter-type.enum-62b7fe88.js} +8 -1
  124. package/dist/esm/{form-config-fetcher-b44b2727.js → form-config-fetcher-db1bf140.js} +23 -5
  125. package/dist/esm/index-04f73a26.js +24 -36
  126. package/dist/esm/loader.js +1 -1
  127. package/dist/esm/pesquisa-grid_2.entry.js +4 -5
  128. package/dist/esm/sankhyablocks.js +1 -1
  129. package/dist/esm/snk-actions-button_9.entry.js +5 -6
  130. package/dist/esm/snk-application.entry.js +6 -7
  131. package/dist/esm/snk-attach_11.entry.js +2936 -0
  132. package/dist/esm/snk-crud.entry.js +6 -218
  133. package/dist/esm/snk-data-exporter.entry.js +5 -6
  134. package/dist/esm/{snk-data-unit-d8cfa950.js → snk-data-unit-e8bd4143.js} +2 -2
  135. package/dist/esm/snk-data-unit.entry.js +3 -4
  136. package/dist/esm/snk-detail-view.entry.js +7 -8
  137. package/dist/esm/snk-dynaform-config-header_5.entry.js +731 -0
  138. package/dist/esm/snk-dynaform-detail-view_2.entry.js +933 -0
  139. package/dist/esm/snk-dynaform-field-config_2.entry.js +322 -0
  140. package/dist/esm/snk-dynaform-guides-view-1f1455d6.js +744 -0
  141. package/dist/esm/snk-dynaform-guides-view.entry.js +15 -0
  142. package/dist/esm/snk-dynaform.entry.js +671 -0
  143. package/dist/esm/{snk-expression-group_2.entry.js → snk-expression-group_4.entry.js} +405 -4
  144. package/dist/esm/snk-filter-bar_4.entry.js +5 -8
  145. package/dist/esm/snk-form_2.entry.js +4 -5
  146. package/dist/esm/snk-grid.entry.js +7 -8
  147. package/dist/esm/{snk-guides-viewer-adf39ea2.js → snk-guides-viewer-95fefcaa.js} +1 -1
  148. package/dist/esm/snk-guides-viewer.entry.js +5 -6
  149. package/dist/esm/snk-layout-form-config.entry.js +4 -5
  150. package/dist/esm/snk-pesquisa.entry.js +4 -5
  151. package/dist/esm/taskbarUtils-682ca78c.js +225 -0
  152. package/dist/sankhyablocks/p-06b6c284.entry.js +1 -0
  153. package/dist/sankhyablocks/p-09e2255b.entry.js +1 -0
  154. package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
  155. package/dist/sankhyablocks/{p-5c250661.js → p-1a04f537.js} +1 -1
  156. package/dist/sankhyablocks/{p-ab5e12fa.js → p-1cc4cf61.js} +1 -1
  157. package/dist/sankhyablocks/{p-f5ad0720.js → p-2040953e.js} +1 -1
  158. package/dist/sankhyablocks/p-22ddc1a5.entry.js +1 -0
  159. package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
  160. package/dist/sankhyablocks/p-2b581179.entry.js +1 -0
  161. package/dist/sankhyablocks/p-449dfe55.entry.js +1 -0
  162. package/dist/sankhyablocks/p-451b5bcc.entry.js +1 -0
  163. package/dist/sankhyablocks/p-46d7e2de.js +1 -0
  164. package/dist/sankhyablocks/{p-3c990841.js → p-51e853f2.js} +1 -1
  165. package/dist/sankhyablocks/p-51f1485c.entry.js +1 -0
  166. package/dist/sankhyablocks/p-58709cf9.js +1 -0
  167. package/dist/sankhyablocks/p-589016e2.entry.js +1 -0
  168. package/dist/sankhyablocks/p-5c6eede7.js +60 -0
  169. package/dist/sankhyablocks/p-5d02c032.js +1 -0
  170. package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
  171. package/dist/sankhyablocks/p-670c43e3.entry.js +1 -0
  172. package/dist/sankhyablocks/{p-b1bb4cf1.js → p-70c2ee5c.js} +1 -1
  173. package/dist/sankhyablocks/p-77c26de0.js +1 -0
  174. package/dist/sankhyablocks/p-92c71225.entry.js +1 -0
  175. package/dist/sankhyablocks/p-9c89a76a.entry.js +1 -0
  176. package/dist/sankhyablocks/{p-4f7adf97.js → p-b1bf9564.js} +1 -1
  177. package/dist/sankhyablocks/p-c538bd6c.entry.js +1 -0
  178. package/dist/sankhyablocks/p-ccd61eb8.entry.js +1 -0
  179. package/dist/sankhyablocks/{p-3704bf1b.js → p-d5810110.js} +1 -1
  180. package/dist/sankhyablocks/p-d88278f8.js +28 -0
  181. package/dist/sankhyablocks/p-dc45e9e5.entry.js +1 -0
  182. package/dist/sankhyablocks/{p-8fe740b7.entry.js → p-dc83c70f.entry.js} +2 -2
  183. package/dist/sankhyablocks/p-e5362a5c.js +1 -0
  184. package/dist/sankhyablocks/p-edd44079.entry.js +1 -0
  185. package/dist/sankhyablocks/p-eff38390.entry.js +1 -0
  186. package/dist/sankhyablocks/p-ff28e5e4.entry.js +1 -0
  187. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  188. package/dist/types/components/snk-dynaform/interfaces/PropsCustomEditor.d.ts +4 -0
  189. package/dist/types/components/snk-dynaform/interfaces/PropsCustomRender.d.ts +4 -0
  190. package/dist/types/components/snk-dynaform/subcomponents/CardFormResizeObserver.d.ts +1 -0
  191. package/dist/types/components/snk-dynaform/subcomponents/GuideBuilder.d.ts +14 -0
  192. package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.d.ts +158 -0
  193. package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.d.ts +107 -0
  194. package/dist/types/components/snk-dynaform-form-config/FormConfigHelper.d.ts +36 -0
  195. package/dist/types/components/snk-dynaform-form-config/SnkFormConfigManager.d.ts +35 -0
  196. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.d.ts +23 -0
  197. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.d.ts +19 -0
  198. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.d.ts +56 -0
  199. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.d.ts +74 -0
  200. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.d.ts +21 -0
  201. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-form-config.d.ts +95 -0
  202. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.d.ts +35 -0
  203. package/dist/types/components.d.ts +2403 -1322
  204. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +1 -0
  205. package/package.json +5 -1
  206. package/react/components.d.ts +12 -0
  207. package/react/components.js +12 -0
  208. package/react/components.js.map +1 -1
  209. package/dist/cjs/SnkMessageBuilder-a9300ebe.js +0 -2833
  210. package/dist/cjs/default-filters-a09bf82b.js +0 -8
  211. package/dist/cjs/index-62760a9c.js +0 -49
  212. package/dist/cjs/index-8d94b7e0.js +0 -7
  213. package/dist/cjs/snk-attach.cjs.entry.js +0 -948
  214. package/dist/cjs/snk-default-filter.cjs.entry.js +0 -77
  215. package/dist/cjs/snk-filter-advanced-mode_3.cjs.entry.js +0 -99
  216. package/dist/cjs/snk-filter-detail.cjs.entry.js +0 -198
  217. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +0 -408
  218. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +0 -109
  219. package/dist/cjs/snk-image-input.cjs.entry.js +0 -160
  220. package/dist/cjs/snk-personalized-filter.cjs.entry.js +0 -358
  221. package/dist/cjs/snk-simple-crud.cjs.entry.js +0 -865
  222. package/dist/esm/SnkMessageBuilder-1eb7a1af.js +0 -2831
  223. package/dist/esm/default-filters-50105e43.js +0 -8
  224. package/dist/esm/index-620ac460.js +0 -7
  225. package/dist/esm/index-8acbae97.js +0 -49
  226. package/dist/esm/snk-attach.entry.js +0 -944
  227. package/dist/esm/snk-default-filter.entry.js +0 -73
  228. package/dist/esm/snk-filter-advanced-mode_3.entry.js +0 -93
  229. package/dist/esm/snk-filter-detail.entry.js +0 -194
  230. package/dist/esm/snk-filter-field-search_2.entry.js +0 -403
  231. package/dist/esm/snk-filter-modal-item.entry.js +0 -105
  232. package/dist/esm/snk-image-input.entry.js +0 -156
  233. package/dist/esm/snk-personalized-filter.entry.js +0 -354
  234. package/dist/esm/snk-simple-crud.entry.js +0 -861
  235. package/dist/sankhyablocks/p-0a4cdcde.entry.js +0 -1
  236. package/dist/sankhyablocks/p-0afc64df.entry.js +0 -1
  237. package/dist/sankhyablocks/p-10f27dc6.entry.js +0 -1
  238. package/dist/sankhyablocks/p-20f03230.entry.js +0 -1
  239. package/dist/sankhyablocks/p-2af8aca3.js +0 -1
  240. package/dist/sankhyablocks/p-3870748a.js +0 -28
  241. package/dist/sankhyablocks/p-3d294185.entry.js +0 -1
  242. package/dist/sankhyablocks/p-438a225f.entry.js +0 -1
  243. package/dist/sankhyablocks/p-4d04bc75.entry.js +0 -1
  244. package/dist/sankhyablocks/p-554c0e54.js +0 -1
  245. package/dist/sankhyablocks/p-57c184a2.entry.js +0 -1
  246. package/dist/sankhyablocks/p-68c1a093.js +0 -1
  247. package/dist/sankhyablocks/p-6a4b21dd.js +0 -1
  248. package/dist/sankhyablocks/p-6ae7543b.entry.js +0 -1
  249. package/dist/sankhyablocks/p-6e278003.js +0 -60
  250. package/dist/sankhyablocks/p-82bcb4cf.entry.js +0 -1
  251. package/dist/sankhyablocks/p-84345e7a.js +0 -1
  252. package/dist/sankhyablocks/p-95af0bb1.entry.js +0 -1
  253. package/dist/sankhyablocks/p-a905712a.entry.js +0 -1
  254. package/dist/sankhyablocks/p-aff2d081.entry.js +0 -1
  255. package/dist/sankhyablocks/p-b0a357b4.entry.js +0 -1
  256. package/dist/sankhyablocks/p-b568c1d4.js +0 -1
  257. package/dist/sankhyablocks/p-bab4cde4.entry.js +0 -1
  258. package/dist/sankhyablocks/p-bd3c1aaa.entry.js +0 -1
  259. package/dist/sankhyablocks/p-cc64239c.entry.js +0 -1
  260. package/dist/sankhyablocks/p-cd00a3d1.entry.js +0 -1
  261. package/dist/sankhyablocks/p-d9ec8c4b.entry.js +0 -1
  262. package/dist/sankhyablocks/p-dbdbb77a.entry.js +0 -1
  263. package/dist/sankhyablocks/p-e8df1dea.entry.js +0 -1
  264. package/dist/sankhyablocks/p-ef9343c3.entry.js +0 -1
  265. package/dist/sankhyablocks/p-f4184ce7.js +0 -1
@@ -0,0 +1,938 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1894343a.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const snkDynaformGuidesView = require('./snk-dynaform-guides-view-e98f7f3a.js');
8
+ const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
9
+ const DataFetcher = require('./DataFetcher-b3a8075d.js');
10
+ require('./ISave-4674c283.js');
11
+ const index$1 = require('./index-e3e39724.js');
12
+ require('@sankhyalabs/ezui/dist/collection/utils/constants');
13
+ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
+ require('./dataunit-fetcher-c7e66f0d.js');
15
+ require('./filter-item-type.enum-a7ffdaa6.js');
16
+ const formConfigFetcher = require('./form-config-fetcher-f80dbc3b.js');
17
+ const constants = require('./constants-6d82e405.js');
18
+ const taskbarElements = require('./taskbar-elements-80eddec8.js');
19
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
20
+ const taskbarUtils = require('./taskbarUtils-383c596e.js');
21
+ const FormConfigHelper = require('./FormConfigHelper-c5f5473a.js');
22
+ require('./ConfigStorage-4201dd3d.js');
23
+ require('./PrintUtils-bcaeb82f.js');
24
+ require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
25
+ require('@sankhyalabs/core/dist/utils/SortingUtils');
26
+ require('./ResourceIDUtils-5ff86aa7.js');
27
+ require('./index-f0fe7e6e.js');
28
+
29
+ const snkDynaformDetailViewCss = ".sc-snk-dynaform-detail-view-h{display:flex;row-gap:24px;flex-direction:column;width:100%;height:100%;overflow:hidden}.level-path.sc-snk-dynaform-detail-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.grid-container.sc-snk-dynaform-detail-view{min-height:100px;height:100%;width:100%;display:flex;flex-wrap:wrap;text-decoration:none;border-radius:var(--border--radius-medium);background-color:var(--color--gray-70, #FFFFFF);border:1px solid var(--color--petroleum-100, #C8CCD3)}.detail-header.sc-snk-dynaform-detail-view{padding-bottom:0}snk-data-unit.sc-snk-dynaform-detail-view{flex:1;gap:var(--space--12, 12px);display:flex;flex-direction:column}snk-grid.sc-snk-dynaform-detail-view{height:100%;--snk-grid-margin:0px;--snk-grid-box-shadow:none}.form-and-detail-container.sc-snk-dynaform-detail-view{display:flex;flex-direction:column;height:100%;width:100%;overflow:auto;padding:var(--space--12, 12px)}.ez-tabselector-internal.sc-snk-dynaform-detail-view{margin:var(--space--8, 8px) 0}.selected-record-header.sc-snk-dynaform-detail-view{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space--8, 8px) var(--space--12, 12px);padding:var(--space--12, 12px) var(--space--16, 16px);margin-bottom:var(--space--12, 12px);background:var(--color--gray-80, #F9F9F9);border-radius:var(--border--radius-12, 12px);font-family:var(--font--pattern);border:1px solid var(--color--petroleum-100, #C8CCD3);border-left:4px solid var(--color--ocean-green-500, #00B07E)}.selected-record-header--message.sc-snk-dynaform-detail-view{border-left-color:var(--color--primary, #007EFF)}.selected-record-header__message.sc-snk-dynaform-detail-view{font-size:var(--font-size--default, 14px);font-weight:var(--font-weight--medium, 500);color:var(--color--title-primary, #2B3A54)}.selected-record-header__chip.sc-snk-dynaform-detail-view{display:inline-flex;flex-direction:row;align-items:center;gap:var(--space--4, 4px);min-width:0}.selected-record-header__label.sc-snk-dynaform-detail-view{font-size:var(--font-size--xs, 11px);font-weight:var(--font-weight--medium, 500);text-transform:uppercase;letter-spacing:0.04em;color:var(--color--text-secondary, #6E7A8A)}.selected-record-header__value.sc-snk-dynaform-detail-view{font-size:var(--font-size--md, 15px);font-weight:var(--font-weight--semibold, 600);color:var(--color--ocean-green-1000, #00281D);line-height:1.2;word-break:break-word}.selected-record-header__separator.sc-snk-dynaform-detail-view{display:inline-block;align-self:stretch;width:1px;background:var(--color--petroleum-100, #C8CCD3);margin:0 var(--space--4, 4px)}";
30
+
31
+ const SnkDynaformDetailView = class {
32
+ constructor(hostRef) {
33
+ index.registerInstance(this, hostRef);
34
+ this._taskbarProcessor = new taskbarUtils.SimpleTaskbarProcessor(taskbarUtils.DEFAULT_TASKBAR_BUTTONS);
35
+ this._currentView = 0;
36
+ this.attachmentRegisterKey = undefined;
37
+ this._fieldToGetFocus = undefined;
38
+ this._hasToCreateFieldSearch = true;
39
+ this._selectedSheet = undefined;
40
+ this._internalErrorTabs = new Set();
41
+ this._selectedRecordPKDisplay = undefined;
42
+ this.formConfigManager = undefined;
43
+ this.dataUnitName = undefined;
44
+ this.resourceID = undefined;
45
+ this.entityName = undefined;
46
+ this.label = undefined;
47
+ this.dataUnit = undefined;
48
+ this.selectedForm = undefined;
49
+ this.dataState = undefined;
50
+ this.messagesBuilder = undefined;
51
+ this.canEdit = true;
52
+ this.taskbarCustomContainerId = undefined;
53
+ this.customEditors = undefined;
54
+ this.customRenders = undefined;
55
+ this.presentationMode = index$1.PresentationMode.SECONDARY;
56
+ }
57
+ observeDataUnit(newDataUnit, oldDataUnit) {
58
+ newDataUnit === null || newDataUnit === void 0 ? void 0 : newDataUnit.subscribe(this.dataUnitActionHandler.bind(this));
59
+ oldDataUnit === null || oldDataUnit === void 0 ? void 0 : oldDataUnit.unsubscribe(this.dataUnitActionHandler);
60
+ }
61
+ observerDataState(newValue, oldValue) {
62
+ const openInsertion = !(oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && (newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
63
+ const closeInsertion = (oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) && !(newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode);
64
+ if (openInsertion || closeInsertion) {
65
+ this.loadMetadata();
66
+ }
67
+ if (this._formMetadata == undefined) {
68
+ return;
69
+ }
70
+ if (!this.selectedSheetIsDetail()) {
71
+ if (openInsertion) {
72
+ setTimeout(() => {
73
+ this.changeViewMode(constants.VIEW_MODE.FORM);
74
+ }, 0);
75
+ }
76
+ if (closeInsertion) {
77
+ this.changeViewMode(constants.VIEW_MODE.GRID);
78
+ }
79
+ }
80
+ }
81
+ /**
82
+ * Muda o modo de visualização do componente entre VIEW_MODE.GRID e VIEW_MODE.FORM
83
+ * @param mode - Novo modo que o componente deve ser apresentado.
84
+ */
85
+ async changeViewMode(mode) {
86
+ if (!this._viewStack) {
87
+ return;
88
+ }
89
+ this._viewStack.show(mode);
90
+ this._currentView = mode;
91
+ }
92
+ /**
93
+ * Abre o configurador de grid.
94
+ */
95
+ async configGrid() {
96
+ if (this._snkGrid) {
97
+ this._snkGrid.showConfig();
98
+ }
99
+ }
100
+ async showUp() {
101
+ if (this._snkFormView) {
102
+ this._snkFormView.showUp();
103
+ }
104
+ if (this._snkGrid) {
105
+ this._snkGrid.scrollIntoView({ behavior: "smooth", block: "start" });
106
+ }
107
+ }
108
+ /**
109
+ * Registra um editor customizado para campos da grade e formulário.
110
+ */
111
+ async addCustomEditor(fieldName, customEditor) {
112
+ var _a, _b;
113
+ const detailContext = this.normalizeDataUnitName();
114
+ (_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.addCustomEditor(fieldName, customEditor, detailContext);
115
+ (_b = this._snkFormView) === null || _b === void 0 ? void 0 : _b.addCustomEditor(fieldName, customEditor, detailContext);
116
+ }
117
+ async observerPropsCustomEditor(newValue) {
118
+ for (const fieldName in newValue) {
119
+ await this.addCustomEditor(fieldName, newValue[fieldName]);
120
+ }
121
+ }
122
+ /**
123
+ * Registra um render customizado para colunas da grid.
124
+ */
125
+ async addGridCustomRender(fieldName, customRender) {
126
+ var _a;
127
+ const detailContext = this.normalizeDataUnitName();
128
+ await ((_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.addGridCustomRender(fieldName, customRender, detailContext));
129
+ }
130
+ onContentCardChanged(evt) {
131
+ snkDynaformGuidesView.SnkDynaformGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this.formConfigManager).then(() => index.forceUpdate(this));
132
+ evt.stopPropagation();
133
+ }
134
+ async observeCustomRenders(newValue) {
135
+ for (const field in newValue) {
136
+ const customRender = newValue[field];
137
+ await this.addGridCustomRender(field, customRender);
138
+ }
139
+ }
140
+ loadMetadata() {
141
+ if (!this.dataUnit || !this.formConfigManager) {
142
+ return;
143
+ }
144
+ if (!this.formConfigManager.isLoaded) {
145
+ return;
146
+ }
147
+ const formConfig = this.formConfigManager.getConfig(this.dataUnit);
148
+ this._formMetadata = form.buildFormMetadata(formConfig == undefined || formConfig.fields.length === 0 ? undefined : formConfig, this.dataUnit, true);
149
+ this.initSelectedSheet();
150
+ }
151
+ initSelectedSheet() {
152
+ if (!this._formMetadata) {
153
+ this._selectedSheet = undefined;
154
+ return;
155
+ }
156
+ const sheets = this._formMetadata.getAllSheets();
157
+ if (!sheets || sheets.size === 0) {
158
+ this._selectedSheet = undefined;
159
+ return;
160
+ }
161
+ // Mantém a aba atual caso ela ainda exista e não seja a área principal.
162
+ if (this._selectedSheet && this._selectedSheet.name !== SnkDynaformDetailView.MAIN_TAB) {
163
+ const current = sheets.get(this._selectedSheet.name);
164
+ if (current) {
165
+ this._selectedSheet = current;
166
+ return;
167
+ }
168
+ }
169
+ // Caso contrário, seleciona o primeiro sheet que não seja a área principal (primeira aba).
170
+ this._selectedSheet = this.getFirstNonMainSheet(sheets);
171
+ }
172
+ getFirstNonMainSheet(sheets) {
173
+ for (const [name, sheet] of sheets) {
174
+ if (name !== SnkDynaformDetailView.MAIN_TAB) {
175
+ return sheet;
176
+ }
177
+ }
178
+ return undefined;
179
+ }
180
+ dataUnitReadyHandler(evt) {
181
+ this.dataUnit = evt.detail;
182
+ this.loadMetadata();
183
+ }
184
+ getFormFields() {
185
+ var _a, _b, _c;
186
+ const mainSheet = (_b = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets()) === null || _b === void 0 ? void 0 : _b.get(SnkDynaformDetailView.MAIN_TAB);
187
+ return (_c = mainSheet === null || mainSheet === void 0 ? void 0 : mainSheet.fields) !== null && _c !== void 0 ? _c : [];
188
+ }
189
+ hasNonMainSheets() {
190
+ if (!this._formMetadata) {
191
+ return false;
192
+ }
193
+ for (const name of this._formMetadata.getAllSheets().keys()) {
194
+ if (name !== SnkDynaformDetailView.MAIN_TAB) {
195
+ return true;
196
+ }
197
+ }
198
+ return false;
199
+ }
200
+ selectedSheetIsDetail() {
201
+ return !!this._selectedSheet && form.FormMetadata.getDetailName(this._selectedSheet.name) != undefined;
202
+ }
203
+ isSheetDisabled(sheet) {
204
+ var _a;
205
+ if (form.FormMetadata.getDetailName(sheet.name) == undefined) {
206
+ return false;
207
+ }
208
+ const currentRecord = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecord();
209
+ if (!currentRecord || !this.dataUnit) {
210
+ return true;
211
+ }
212
+ return this.dataUnit.isNewRecord(currentRecord.__record__id__) || this.dataUnit.isMultipleEdition;
213
+ }
214
+ buildInternalTabItems() {
215
+ if (!this._formMetadata) {
216
+ return [];
217
+ }
218
+ const sheets = Array.from(this._formMetadata.getAllSheets().values());
219
+ const nonMainSheets = sheets.filter((sheet) => sheet.name !== SnkDynaformDetailView.MAIN_TAB);
220
+ return nonMainSheets.map((sheet, index) => ({
221
+ tabKey: sheet.name,
222
+ label: sheet.label,
223
+ index,
224
+ disabled: this.isSheetDisabled(sheet),
225
+ rightIcon: this._internalErrorTabs.has(sheet.name) ? 'alert-circle-inverted' : undefined,
226
+ }));
227
+ }
228
+ onInternalTabChange(tab) {
229
+ var _a, _b;
230
+ // A área principal (__main) é sempre visível e não é uma aba selecionável.
231
+ if (tab.tabKey === SnkDynaformDetailView.MAIN_TAB) {
232
+ return;
233
+ }
234
+ const matchedSheet = (_b = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets()) === null || _b === void 0 ? void 0 : _b.get(tab.tabKey);
235
+ if (!matchedSheet || this.isSheetDisabled(matchedSheet)) {
236
+ return;
237
+ }
238
+ this._selectedSheet = matchedSheet;
239
+ }
240
+ executeActionHandler(evt) {
241
+ var _a;
242
+ if (evt.detail === taskbarElements.TaskbarElement.GRID_MODE) {
243
+ this.changeViewMode(constants.VIEW_MODE.GRID);
244
+ evt.stopPropagation();
245
+ }
246
+ if (evt.detail === taskbarElements.TaskbarElement.UPDATE_MULTIPLE && this.dataUnit) {
247
+ this.dataUnit.isMultipleEdition = true;
248
+ this.changeViewMode(constants.VIEW_MODE.FORM);
249
+ evt.stopPropagation();
250
+ }
251
+ if (evt.detail === taskbarElements.TaskbarElement.FORM_MODE || evt.detail === taskbarElements.TaskbarElement.UPDATE || evt.detail === taskbarElements.TaskbarElement.INSERT) {
252
+ this.changeViewMode(constants.VIEW_MODE.FORM);
253
+ evt.stopPropagation();
254
+ }
255
+ if (evt.detail === taskbarElements.TaskbarElement.ATTACH) {
256
+ (_a = this._snkAttach) === null || _a === void 0 ? void 0 : _a.open();
257
+ evt.stopPropagation();
258
+ }
259
+ }
260
+ async getAttachmentRegisterKey() {
261
+ if (!this._snkDataUnit) {
262
+ return;
263
+ }
264
+ const recordCriteria = await this._snkDataUnit.getSelectedRecordsIDsInfo();
265
+ const joinedPrimaryKeys = recordCriteria.map(({ value }) => value).join('_');
266
+ return joinedPrimaryKeys;
267
+ }
268
+ async handleDataStateChange({ detail: dataState }) {
269
+ var _a;
270
+ this.dataState = dataState;
271
+ if (dataState.selectedRecord !== undefined && this._snkDataUnit) {
272
+ this.attachmentRegisterKey = (_a = await this.getAttachmentRegisterKey()) !== null && _a !== void 0 ? _a : undefined;
273
+ }
274
+ this._selectedRecordPKDisplay = this.buildSelectedRecordPKDisplay();
275
+ }
276
+ buildSelectedRecordPKDisplay() {
277
+ var _a, _b, _c, _d, _e, _f, _g;
278
+ if (!this.dataUnit) {
279
+ return undefined;
280
+ }
281
+ if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.insertionMode) {
282
+ const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkCrud.newRecord");
283
+ return message ? { message } : undefined;
284
+ }
285
+ const selectedRecord = this.dataUnit.getSelectedRecord();
286
+ if (!selectedRecord) {
287
+ return undefined;
288
+ }
289
+ const items = [];
290
+ const fields = (_d = (_c = this.dataUnit.metadata) === null || _c === void 0 ? void 0 : _c.fields) !== null && _d !== void 0 ? _d : [];
291
+ for (const field of fields) {
292
+ if (((_e = field.properties) === null || _e === void 0 ? void 0 : _e.isPrimaryKey) !== "true") {
293
+ continue;
294
+ }
295
+ const rawValue = selectedRecord[field.name];
296
+ const value = (_f = rawValue === null || rawValue === void 0 ? void 0 : rawValue.value) !== null && _f !== void 0 ? _f : rawValue;
297
+ if (value === undefined || value === null || value === "") {
298
+ continue;
299
+ }
300
+ items.push({ label: (_g = field.label) !== null && _g !== void 0 ? _g : field.name, value: String(value) });
301
+ }
302
+ return items.length ? { items } : undefined;
303
+ }
304
+ renderSelectedRecordHeader() {
305
+ var _a;
306
+ if (!this.label && !this._selectedRecordPKDisplay) {
307
+ return undefined;
308
+ }
309
+ const display = this._selectedRecordPKDisplay;
310
+ if (!display) {
311
+ return undefined;
312
+ }
313
+ if (display.message) {
314
+ return (index.h("div", { class: "selected-record-header selected-record-header--message" }, index.h("span", { class: "selected-record-header__message" }, display.message)));
315
+ }
316
+ if (!((_a = display.items) === null || _a === void 0 ? void 0 : _a.length)) {
317
+ return undefined;
318
+ }
319
+ return (index.h("div", { class: "selected-record-header", role: "group" }, display.items.map((item, index$1) => [
320
+ index$1 > 0 && index.h("span", { class: "selected-record-header__separator", "aria-hidden": "true" }),
321
+ index.h("div", { class: "selected-record-header__chip" }, index.h("span", { class: "selected-record-header__label" }, item.label, ":"), index.h("span", { class: "selected-record-header__value" }, item.value))
322
+ ])));
323
+ }
324
+ componentWillLoad() {
325
+ var _a;
326
+ this._configName = `dynaform.${this.entityName}`;
327
+ this.formConfigManager = new snkDynaformGuidesView.SnkFormConfigManager(this._configName, (_a = this.resourceID) !== null && _a !== void 0 ? _a : '', () => this.loadMetadata(), this.dataUnit);
328
+ this.formConfigManager.loadConfig();
329
+ if (this.messagesBuilder == undefined) {
330
+ this.messagesBuilder = new DataFetcher.SnkMessageBuilder(this.entityName);
331
+ }
332
+ }
333
+ componentWillRender() {
334
+ this.initializeTaskbarProcessor();
335
+ }
336
+ initializeTaskbarProcessor() {
337
+ if (!this.dataState) {
338
+ return;
339
+ }
340
+ const detailTaskbarManager = this.buildDetailTaskbarManager();
341
+ const topTaskbarId = taskbarUtils.getTopTaskBarId(this.dataState, this.presentationMode);
342
+ this._taskbarProcessor.process(topTaskbarId, detailTaskbarManager, this.dataState, [], []);
343
+ }
344
+ buildDetailTaskbarManager() {
345
+ const EDITION_MODE_BUTTONS = [
346
+ taskbarElements.TaskbarElement.CANCEL,
347
+ taskbarElements.TaskbarElement.SAVE,
348
+ ];
349
+ const currentView = this._currentView;
350
+ return {
351
+ getButtons: (taskbarID, dataState, defaultButtons) => {
352
+ var _a, _b, _c;
353
+ if (!taskbarID) {
354
+ return [];
355
+ }
356
+ const isInEditionMode = (dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty);
357
+ if (isInEditionMode) {
358
+ return EDITION_MODE_BUTTONS;
359
+ }
360
+ let buttons = [...defaultButtons];
361
+ if (currentView === constants.VIEW_MODE.FORM) {
362
+ const indexFormMode = buttons.indexOf(taskbarElements.TaskbarElement.FORM_MODE);
363
+ if (indexFormMode > -1) {
364
+ buttons = [
365
+ ...buttons.slice(0, indexFormMode),
366
+ taskbarElements.TaskbarElement.GRID_MODE,
367
+ ...buttons.slice(indexFormMode + 1),
368
+ ];
369
+ }
370
+ }
371
+ if (((_c = (_b = (_a = dataState === null || dataState === void 0 ? void 0 : dataState.selectionInfo) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 1) {
372
+ const indexUpdate = buttons.indexOf(taskbarElements.TaskbarElement.UPDATE);
373
+ if (indexUpdate > -1) {
374
+ buttons = [
375
+ ...buttons.slice(0, indexUpdate),
376
+ taskbarElements.TaskbarElement.UPDATE_MULTIPLE,
377
+ ...buttons.slice(indexUpdate + 1),
378
+ ];
379
+ }
380
+ }
381
+ return buttons;
382
+ },
383
+ isEnabled: (_, dataState, buttonName, originalValue) => {
384
+ if (!dataState) {
385
+ return originalValue;
386
+ }
387
+ const hasSelectedRecord = dataState.selectedRecord !== undefined;
388
+ const buttonsRequiringSelection = [
389
+ taskbarElements.TaskbarElement.UPDATE,
390
+ taskbarElements.TaskbarElement.REMOVE,
391
+ taskbarElements.TaskbarElement.ATTACH,
392
+ taskbarElements.TaskbarElement.CLONE,
393
+ ];
394
+ if (!hasSelectedRecord && buttonsRequiringSelection.includes(buttonName)) {
395
+ return false;
396
+ }
397
+ if (buttonName === taskbarElements.TaskbarElement.PREVIOUS && !dataState.hasPrevious) {
398
+ return false;
399
+ }
400
+ if (buttonName === taskbarElements.TaskbarElement.NEXT && !dataState.hasNext) {
401
+ return false;
402
+ }
403
+ if (buttonName === taskbarElements.TaskbarElement.INSERT && dataState.insertionMode) {
404
+ return false;
405
+ }
406
+ return originalValue;
407
+ },
408
+ };
409
+ }
410
+ async componentDidLoad() {
411
+ if (this.customEditors) {
412
+ await this.observerPropsCustomEditor(this.customEditors);
413
+ }
414
+ if (this.customRenders) {
415
+ await this.observeCustomRenders(this.customRenders);
416
+ }
417
+ this.initKeyboardManager();
418
+ }
419
+ disconnectedCallback() {
420
+ var _a;
421
+ (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
422
+ }
423
+ async dataUnitActionHandler(action) {
424
+ var _a;
425
+ if (action.type === core.Action.FIELD_INVALIDATED) {
426
+ const sheetName = this.findSheetOfField((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fieldName);
427
+ if (sheetName) {
428
+ this._internalErrorTabs = new Set([...this._internalErrorTabs, sheetName]);
429
+ }
430
+ }
431
+ }
432
+ findSheetOfField(fieldName) {
433
+ var _a;
434
+ if (!fieldName || !this._formMetadata) {
435
+ return undefined;
436
+ }
437
+ const sheets = this._formMetadata.getAllSheets();
438
+ for (const [sheetName, sheet] of sheets) {
439
+ if ((_a = sheet.fields) === null || _a === void 0 ? void 0 : _a.some((f) => f.name === fieldName)) {
440
+ return sheetName;
441
+ }
442
+ }
443
+ return undefined;
444
+ }
445
+ normalizeDataUnitName() {
446
+ var _a, _b;
447
+ return (_b = (_a = this.dataUnitName) === null || _a === void 0 ? void 0 : _a.replace(/\//g, '>')) !== null && _b !== void 0 ? _b : '';
448
+ }
449
+ getSettingsListForm() {
450
+ var _a, _b;
451
+ const hardList = [{
452
+ value: core.StringUtils.generateUUID(),
453
+ label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "",
454
+ disableCloseOnSelect: true,
455
+ eagerInitialize: true,
456
+ itemBuilder: (_, item) => this.getFieldsSearch(item)
457
+ }];
458
+ return hardList;
459
+ }
460
+ getFieldsSearch(item) {
461
+ var _a;
462
+ if (this._fieldSearch === undefined || this._hasToCreateFieldSearch) {
463
+ this._hasToCreateFieldSearch = false;
464
+ this._fieldSearch = utils.buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
465
+ }
466
+ return (_a = this._fieldSearch) !== null && _a !== void 0 ? _a : document.createElement('div');
467
+ }
468
+ fieldsOptionLoader(argument) {
469
+ const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
470
+ const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
471
+ const filteredFields = allFields.filter(field => {
472
+ var _a, _b;
473
+ if (!field) {
474
+ return;
475
+ }
476
+ return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
477
+ ((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
478
+ });
479
+ const options = filteredFields.map((field) => {
480
+ if (!field) {
481
+ return;
482
+ }
483
+ return ({ value: field.name, label: field.label });
484
+ });
485
+ return Promise.resolve(options);
486
+ }
487
+ onSelectField(option) {
488
+ if (option == undefined) {
489
+ return;
490
+ }
491
+ this._fieldToGetFocus = option.value;
492
+ }
493
+ clearFieldToFocusHandler() {
494
+ this._fieldToGetFocus = undefined;
495
+ }
496
+ getColumnSearch(item) {
497
+ var _a;
498
+ if (this._columnSearch !== undefined) {
499
+ return this._columnSearch;
500
+ }
501
+ this._columnSearch = utils.buildFieldSearch(item, ({ argument }) => new Promise(accept => {
502
+ var _a;
503
+ (_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.filterColumns(argument).then((columns) => {
504
+ accept(columns
505
+ .filter(column => !column.hidden)
506
+ .map(column => ({ label: column.label, value: column.name })));
507
+ });
508
+ }), (option) => {
509
+ var _a;
510
+ if (option != undefined) {
511
+ (_a = this._snkGrid) === null || _a === void 0 ? void 0 : _a.locateColumn(option.value);
512
+ }
513
+ });
514
+ return (_a = this._columnSearch) !== null && _a !== void 0 ? _a : document.createElement('div');
515
+ }
516
+ buildTaskbarCustomActionsList() {
517
+ return [this.buildSearchColumnTaskbarAction()];
518
+ }
519
+ buildSearchColumnTaskbarAction() {
520
+ var _a, _b;
521
+ return {
522
+ value: core.StringUtils.generateUUID(),
523
+ label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage('snkGrid.findColumn', {})) !== null && _b !== void 0 ? _b : "",
524
+ disableCloseOnSelect: true,
525
+ eagerInitialize: true,
526
+ itemBuilder: (_, item) => { var _a; return (_a = this.getColumnSearch(item)) !== null && _a !== void 0 ? _a : document.createElement('div'); },
527
+ };
528
+ }
529
+ async initKeyboardManager() {
530
+ var _a;
531
+ this._keyboardManager = new core.KeyboardManager({ propagate: false, element: this._element });
532
+ this._keyboardManager.bind(utils.SHORTCUT_SEARCH_FIELD, async () => {
533
+ var _a;
534
+ await ((_a = this._snkFormView) === null || _a === void 0 ? void 0 : _a.showSearchField());
535
+ }, { description: (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findFields"), element: this._element });
536
+ }
537
+ renderTabSelector() {
538
+ if (!this.hasNonMainSheets()) {
539
+ return undefined;
540
+ }
541
+ const selectedKey = this._selectedSheet && this._selectedSheet.name !== SnkDynaformDetailView.MAIN_TAB
542
+ ? this._selectedSheet.name
543
+ : undefined;
544
+ return (index.h("ez-tabselector", { class: "ez-tabselector-internal", tabs: this.buildInternalTabItems(), selectedTab: selectedKey, onEzChange: (evt) => this.onInternalTabChange(evt.detail) }));
545
+ }
546
+ /**
547
+ * Renderiza o conteúdo da aba selecionada, seguindo as mesmas regras do
548
+ * formulário master (snk-dynaform-guides-view.getContent):
549
+ * - Sheet de detalhe (child[...]) → snk-dynaform-detail-view aninhado.
550
+ * - Sheet de formulário (ex.: "Geral") → snk-dynaform-form-view com os campos do sheet.
551
+ */
552
+ renderSelectedSheetContent() {
553
+ if (!this._selectedSheet || this._selectedSheet.name === SnkDynaformDetailView.MAIN_TAB) {
554
+ return undefined;
555
+ }
556
+ const childEntityName = form.FormMetadata.getDetailName(this._selectedSheet.name);
557
+ if (childEntityName) {
558
+ return (index.h("snk-dynaform-detail-view", { key: `sub_${this.dataUnitName}_${this._selectedSheet.name}`, dataUnitName: `${this.dataUnitName}/${childEntityName}`, entityName: childEntityName, label: this._selectedSheet.label, resourceID: this.resourceID, canEdit: this.canEdit, messagesBuilder: this.messagesBuilder, customEditors: this.customEditors, customRenders: this.customRenders, presentationMode: this.presentationMode, taskbarCustomContainerId: this.taskbarCustomContainerId }));
559
+ }
560
+ return (index.h("snk-dynaform-form-view", { key: `sheet_${this._selectedSheet.name}`, name: this._selectedSheet.name, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this._selectedSheet.fields, fieldToFocus: this._fieldToGetFocus, label: this._selectedSheet.label, onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }));
561
+ }
562
+ renderViewStack() {
563
+ var _a, _b;
564
+ return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, index.h("stack-item", { class: "ez-size-width--full ez-size-height--full" }, index.h("snk-grid", { class: "ez-size-width--full ez-size-height--full", ref: (ref) => {
565
+ if (ref)
566
+ this._snkGrid = ref;
567
+ }, configName: this._configName, messagesBuilder: this.messagesBuilder, onGridDoubleClick: () => this.changeViewMode(constants.VIEW_MODE.FORM), onActionClick: (evt) => this.executeActionHandler(evt), presentationMode: this.presentationMode, canEdit: this.canEdit, isDetail: true, taskbarCustomContainerId: this.taskbarCustomContainerId, gridHeaderCustomSlotId: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS", topTaskbarCustomSlotId: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS", outlineMode: true, enableGridInsert: true, autoLoad: true, multipleEditionEnabled: true, multipleSelection: true, hideHeader: true, hideGridTaskbar: true })), index.h("stack-item", { class: "ez-size-width--full ez-size-height--full grid-container" }, index.h("div", { class: "form-and-detail-container" }, index.h("snk-dynaform-form-view", { ref: (ref) => {
568
+ if (ref)
569
+ this._snkFormView = ref;
570
+ }, name: SnkDynaformDetailView.MAIN_TAB, formMetadata: this._formMetadata, dataUnit: this.dataUnit, fields: this.getFormFields(), fieldToFocus: this._fieldToGetFocus, label: this.label, onSnkRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), fieldSearch: this._fieldSearch }, this.renderSelectedRecordHeader()), this.renderTabSelector(), this.renderSelectedSheetContent())), index.h("snk-attach", { ref: (ref) => this._snkAttach = ref, registerKey: (_a = this.attachmentRegisterKey) !== null && _a !== void 0 ? _a : '', messagesBuilder: this.messagesBuilder, entityName: (_b = this.entityName) !== null && _b !== void 0 ? _b : '' })));
571
+ }
572
+ render() {
573
+ return (index.h(index.Host, null, index.h("snk-data-unit", { ref: (el) => {
574
+ if (el)
575
+ this._snkDataUnit = el;
576
+ }, dataUnitName: `${this.dataUnitName}`, onDataUnitReady: evt => this.dataUnitReadyHandler(evt), entityName: this.entityName, onDataStateChange: this.handleDataStateChange.bind(this), ignoreSaveMessage: this._currentView === constants.VIEW_MODE.GRID, messagesBuilder: this.messagesBuilder, configName: this._configName }, index.h("snk-taskbar", { key: "detailViewTaskbar", class: "form-taskbar", "data-element-id": "detail_top", configName: this._configName, messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, primaryButton: "INSERT", overflowStrategy: "hiddenItems", alignRigth: true, sizeButtons: 'small', presentationMode: this.presentationMode, onActionClick: evt => this.executeActionHandler(evt), dataUnit: this.dataUnit, resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: "DETAIL_TASKBAR_CUSTOM_ELEMENTS", actionsSettingsList: this.getSettingsListForm(), customActionsList: this.buildTaskbarCustomActionsList() }, index.h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" })), this.renderViewStack())));
577
+ }
578
+ get _element() { return index.getElement(this); }
579
+ static get watchers() { return {
580
+ "dataUnit": ["observeDataUnit"],
581
+ "dataState": ["observerDataState"],
582
+ "customEditors": ["observerPropsCustomEditor"],
583
+ "customRenders": ["observeCustomRenders"]
584
+ }; }
585
+ };
586
+ SnkDynaformDetailView.MAIN_TAB = "__main";
587
+ SnkDynaformDetailView.style = snkDynaformDetailViewCss;
588
+
589
+ const snkDynaformFormConfigCss = ".sc-snk-dynaform-form-config-h{display:flex;flex-direction:column;height:100vh;width:100%;font-family:var(--font-pattern, \"Roboto\");background:white;color:#2b3a54;--snk-form-config-container-height:calc(100vh - 95px);outline:none}.form-config-body.sc-snk-dynaform-form-config{height:var(--snk-form-config-container-height);overflow:hidden;padding-top:var(--space--12, 12px)}.form-config-layout.sc-snk-dynaform-form-config{display:flex;flex-direction:row;height:100%;gap:20px;align-items:stretch}.main-editing-area.sc-snk-dynaform-form-config{display:flex;flex-direction:column;flex:1;min-width:0;height:100%;overflow:hidden;gap:12px}.main-editing-area.sc-snk-dynaform-form-config>snk-dynaform-fields-layout.sc-snk-dynaform-form-config{flex:1 1 auto;min-height:0;overflow:auto;flex-direction:row}.main-editing-area.sc-snk-dynaform-form-config>snk-dynaform-guides-configurator.sc-snk-dynaform-form-config{flex:0 0 auto}.main-fields-section.sc-snk-dynaform-form-config{flex:0 0 40vh;display:flex;flex-direction:column;min-height:0;overflow:hidden}.guide-header.sc-snk-dynaform-form-config{display:flex;width:100%;padding-bottom:12px;border-bottom:1px solid #dce0e8;height:30px;font-weight:500;font-size:16px}";
590
+
591
+ const SnkDynaformFormConfig = class {
592
+ constructor(hostRef) {
593
+ index.registerInstance(this, hostRef);
594
+ this.configClose = index.createEvent(this, "configClose", 7);
595
+ this.configChange = index.createEvent(this, "configChange", 7);
596
+ this.guidesMap = new Map();
597
+ this.availableFields = [];
598
+ this.guidesList = [];
599
+ this.groupsList = [];
600
+ this.mainGuide = undefined;
601
+ this.mainGroupsList = [];
602
+ this.selectedGuide = undefined;
603
+ this._formConfig = {};
604
+ this.configOptions = [];
605
+ this.originalConfigSelected = undefined;
606
+ this.configSelected = undefined;
607
+ this.hasChanges = false;
608
+ this.optionConfigChanged = false;
609
+ this.dataUnit = undefined;
610
+ this.configManager = undefined;
611
+ this.ignoreReadOnlyFormFields = undefined;
612
+ this.messagesBuilder = undefined;
613
+ this.customGuidesConfig = [];
614
+ }
615
+ handleFieldConfigChanged() {
616
+ this.hasChanges = true;
617
+ }
618
+ async handleFormConfigOptionSelected({ detail }) {
619
+ this.configSelected = detail;
620
+ this.selectedGuide = undefined;
621
+ await this.loadConfigByUser();
622
+ this.optionConfigChanged = !core.ObjectUtils.equals(this.configSelected, this.originalConfigSelected);
623
+ if (this.configSelected.origin === formConfigFetcher.UserConfigType.DEFAULT) {
624
+ this.hasChanges = false;
625
+ }
626
+ }
627
+ async handleAddFieldToGuide({ detail: fieldItem }) {
628
+ var _a, _b;
629
+ const hasValidSecondaryGuide = this.selectedGuide
630
+ && !this.selectedGuide.isCustom
631
+ && !this.selectedGuide.isDetail;
632
+ if (!hasValidSecondaryGuide && this.selectedGuide && (this.selectedGuide.isCustom || this.selectedGuide.isDetail)) {
633
+ this.showCanNotAddFieldToGuideDialog();
634
+ return;
635
+ }
636
+ if (!hasValidSecondaryGuide && !this.mainGuide) {
637
+ this.showNoGuideSelectedDialog();
638
+ return;
639
+ }
640
+ this.availableFields = [...this.availableFields.filter(f => f.name !== fieldItem.name)];
641
+ if (hasValidSecondaryGuide) {
642
+ await ((_a = this.refFieldsLayout) === null || _a === void 0 ? void 0 : _a.addFieldToLayout(fieldItem));
643
+ }
644
+ else {
645
+ await ((_b = this.refMainFieldsLayout) === null || _b === void 0 ? void 0 : _b.addFieldToLayout(fieldItem));
646
+ }
647
+ }
648
+ async handleSetFieldAsAvailable({ detail }) {
649
+ const hasField = this.availableFields.some(f => f.name === detail.name);
650
+ if (hasField)
651
+ return;
652
+ this.availableFields = [...this.availableFields, detail];
653
+ }
654
+ async handleRemoveFieldFromAvailable({ detail }) {
655
+ this.availableFields = this.availableFields.filter(f => f.name !== detail.name);
656
+ }
657
+ observeSelectedGuide(guide) {
658
+ var _a, _b;
659
+ if ((guide === null || guide === void 0 ? void 0 : guide.name) && ((_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name) && guide.name === this.mainGuide.name) {
660
+ this.selectedGuide = undefined;
661
+ return;
662
+ }
663
+ const guideGroups = (_b = this.guidesMap.get(guide === null || guide === void 0 ? void 0 : guide.name)) !== null && _b !== void 0 ? _b : [];
664
+ this.groupsList = [...guideGroups];
665
+ }
666
+ observeConfigManager() {
667
+ this.loadFormConfig();
668
+ }
669
+ showNoGuideSelectedDialog() {
670
+ const title = this.getMessage('snkFormConfig.noGuideSelected.title');
671
+ const message = this.getMessage('snkFormConfig.noGuideSelected.message');
672
+ utils.ApplicationUtils.alert(title, message);
673
+ }
674
+ showCanNotAddFieldToGuideDialog() {
675
+ const title = this.getMessage('snkFormConfig.canNotAddFieldToGuide.title');
676
+ const message = this.getMessage('snkFormConfig.canNotAddFieldToGuide.message');
677
+ utils.ApplicationUtils.alert(title, message);
678
+ }
679
+ /**
680
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
681
+ * através de um pequeno modulo na estrutura da aplicação:
682
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
683
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
684
+ */
685
+ getMessage(key, params) {
686
+ return this.messagesBuilder.getMessage(key, params);
687
+ }
688
+ async initializeUserConfig() {
689
+ if (this.configManager == undefined)
690
+ return;
691
+ try {
692
+ const userConfig = await this.configManager.fetchUserAvailableConfigs();
693
+ this.configOptions = userConfig;
694
+ const isDefault = this._formConfig != undefined ? this._formConfig.defaultConfiguration : true;
695
+ const origin = (isDefault ? formConfigFetcher.UserConfigType.DEFAULT : formConfigFetcher.UserConfigType.USER);
696
+ this.configSelected = userConfig === null || userConfig === void 0 ? void 0 : userConfig.find((config) => config.origin === origin);
697
+ this.originalConfigSelected = userConfig === null || userConfig === void 0 ? void 0 : userConfig.find((config) => config.origin === origin);
698
+ }
699
+ catch (error) {
700
+ console.error(this.getMessage('snkFormConfig.errors.failFetchUserConfig'));
701
+ console.error(error);
702
+ }
703
+ }
704
+ async loadConfigByUser() {
705
+ if (!this.configManager || !this.configSelected)
706
+ return;
707
+ if (this.isConfigDefaultSelected()) {
708
+ await this.handleLoadDefaultConfig();
709
+ }
710
+ else {
711
+ this.loadFormConfig();
712
+ }
713
+ }
714
+ async handleLoadDefaultConfig() {
715
+ const defaultConfig = await this.configManager.fetchDefaultConfig();
716
+ if (defaultConfig) {
717
+ this.loadFormConfig(defaultConfig);
718
+ return;
719
+ }
720
+ const emptyConfig = this.configManager.getEmptyConfig();
721
+ if (emptyConfig) {
722
+ this.loadFormConfig(emptyConfig);
723
+ }
724
+ }
725
+ isConfigDefaultSelected() {
726
+ return this.configSelected.origin === formConfigFetcher.UserConfigType.DEFAULT;
727
+ }
728
+ loadFormConfig(config) {
729
+ this._formConfig = config ? config : this.getConfig();
730
+ this.loadGuides();
731
+ this.initializeAvailableFields();
732
+ }
733
+ initializeAvailableFields() {
734
+ var _a;
735
+ if (((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields) == undefined)
736
+ return;
737
+ const fieldsFormConfig = [...this._formConfig.fields];
738
+ const fieldsMetadata = this.dataUnit.metadata.fields;
739
+ this.availableFields = fieldsMetadata.filter(({ name: fieldName, visible: fieldVisible, properties }) => {
740
+ const hasCfg = fieldsFormConfig.some(({ name: fieldFormName }) => fieldFormName === fieldName);
741
+ /**
742
+ * Quando a visibilidade de um campo é alterada pelo dataunit, mas o desenvolvedor deseja que o mesmo continue
743
+ * sendo apresentado no configurador, precisamos fazer essa tratativa, verificando se o campo não tem configuração
744
+ */
745
+ if (!hasCfg && properties.visibleOnConfig === true && !fieldVisible)
746
+ return properties.visibleOnConfig;
747
+ return fieldVisible === true && hasCfg === false;
748
+ });
749
+ }
750
+ getInitialOrder(guidesList) {
751
+ var _a, _b;
752
+ if (Array.isArray((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.tabs)) {
753
+ return (_b = this._formConfig.tabs) === null || _b === void 0 ? void 0 : _b.length;
754
+ }
755
+ if (guidesList.length > 0) {
756
+ return Math.max(...guidesList.map(g => g.order));
757
+ }
758
+ return 0;
759
+ }
760
+ loadGuides() {
761
+ var _a, _b, _c, _d;
762
+ this.guidesList = [];
763
+ this.guidesList.push(...FormConfigHelper.buildGuides(this._formConfig, this.getMessage('snkFormConfig.form.mainArea'), this.dataUnit, constants.TAB_NAMES.general));
764
+ this.guidesList.push(...FormConfigHelper.buildChildrenGuides(this.dataUnit, this.getInitialOrder(this.guidesList), this.guidesList));
765
+ this.guidesList.push(...FormConfigHelper.buildCustomGuides(this.customGuidesConfig, this.guidesList));
766
+ this.guidesMap = FormConfigHelper.buildGuidesMap((_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.fields, this.guidesList, this.dataUnit, constants.TAB_NAMES.general);
767
+ this.mainGuide = this.guidesList.find(g => g.name === constants.TAB_NAMES.main);
768
+ this.mainGroupsList = ((_b = this.mainGuide) === null || _b === void 0 ? void 0 : _b.name)
769
+ ? [...((_d = (_c = this.guidesMap) === null || _c === void 0 ? void 0 : _c.get(this.mainGuide.name)) !== null && _d !== void 0 ? _d : [])]
770
+ : [];
771
+ this.ensureSelectedGuide();
772
+ }
773
+ ensureSelectedGuide() {
774
+ const stillValid = this.selectedGuide
775
+ && this.guidesList.some(g => g.name === this.selectedGuide.name);
776
+ if (stillValid)
777
+ return;
778
+ const firstSelectable = this.guidesList
779
+ .filter(g => { var _a; return g.visible && g.name !== ((_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name); })
780
+ .sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : Number.MAX_VALUE) - ((_b = b.order) !== null && _b !== void 0 ? _b : Number.MAX_VALUE); })[0];
781
+ this.selectedGuide = firstSelectable;
782
+ }
783
+ getConfig() {
784
+ let config = this.configManager.getConfig(this.dataUnit, false);
785
+ if (config.fields && config.fields.length === 0) {
786
+ config = undefined;
787
+ }
788
+ if (config == undefined) {
789
+ config = form.buildFormConfigFromDataUnit(this.dataUnit);
790
+ }
791
+ return core.ObjectUtils.copy(config);
792
+ }
793
+ handleSelectGuide({ detail: selectedGuide }) {
794
+ this.selectedGuide = selectedGuide;
795
+ }
796
+ handleLayoutChanged({ detail: newGroupList }) {
797
+ if (!this.selectedGuide)
798
+ return;
799
+ this.hasChanges = true;
800
+ this.groupsList = [...newGroupList];
801
+ this.guidesMap.set(this.selectedGuide.name, [...newGroupList]);
802
+ }
803
+ handleMainLayoutChanged({ detail: newGroupList }) {
804
+ var _a;
805
+ if (!((_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name))
806
+ return;
807
+ this.hasChanges = true;
808
+ this.mainGroupsList = [...newGroupList];
809
+ this.guidesMap.set(this.mainGuide.name, [...newGroupList]);
810
+ }
811
+ getIsDefaultConfig() {
812
+ var _a;
813
+ const optionSelected = (_a = this.configSelected) === null || _a === void 0 ? void 0 : _a.origin;
814
+ return optionSelected === formConfigFetcher.UserConfigType.DEFAULT
815
+ && this.optionConfigChanged === true
816
+ && this.hasChanges === false;
817
+ }
818
+ getTabsToSave() {
819
+ return this.guidesList.map(tab => {
820
+ return {
821
+ name: tab.name,
822
+ label: tab.name === constants.TAB_NAMES.main ? tab.name : tab.label,
823
+ order: tab.name === constants.TAB_NAMES.main ? 0 : tab.order,
824
+ visible: tab.visible,
825
+ };
826
+ });
827
+ }
828
+ async handleSaveConfig() {
829
+ var _a;
830
+ const savedConfig = await this.configManager.saveConfig(this.buildConfigToSave());
831
+ this.configSelected = (_a = this.configOptions) === null || _a === void 0 ? void 0 : _a.find((config) => {
832
+ return config.origin === (this.hasChanges ? formConfigFetcher.UserConfigType.USER : formConfigFetcher.UserConfigType.DEFAULT);
833
+ });
834
+ this.originalConfigSelected = this.configSelected;
835
+ this.hasChanges = false;
836
+ this.optionConfigChanged = false;
837
+ utils.ApplicationUtils.info(this.getMessage('snkFormConfig.info.successfullyConfigSaved'), { iconName: 'check' });
838
+ this.configChange.emit(savedConfig);
839
+ }
840
+ buildConfigToSave() {
841
+ const formConfig = core.ObjectUtils.copy(this._formConfig);
842
+ formConfig.tabs = this.getTabsToSave();
843
+ formConfig.fields = FormConfigHelper.getFieldsToSave(this.guidesMap);
844
+ formConfig.defaultConfiguration = this.getIsDefaultConfig();
845
+ return formConfig;
846
+ }
847
+ handleAvailableFieldListChanged({ detail: updatedList }) {
848
+ this.availableFields = [...updatedList];
849
+ }
850
+ handleSetFieldListAsAvailable({ detail: updatedList }) {
851
+ this.availableFields = [...this.availableFields, ...updatedList];
852
+ }
853
+ handleGuideDeleted({ detail: guide }) {
854
+ var _a, _b;
855
+ const guideName = guide.name;
856
+ const guideGroups = (_a = this.guidesMap.get(guideName)) !== null && _a !== void 0 ? _a : [];
857
+ const fieldsToAvailable = [];
858
+ guideGroups.forEach(group => fieldsToAvailable.push(...group.fields));
859
+ this.availableFields = [...this.availableFields, ...fieldsToAvailable];
860
+ this.guidesList = [...this.guidesList.filter(g => g.name !== guideName)];
861
+ this.guidesMap.delete(guideName);
862
+ if (((_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.name) === guideName) {
863
+ this.selectedGuide = undefined;
864
+ this.ensureSelectedGuide();
865
+ }
866
+ this.hasChanges = true;
867
+ }
868
+ handleGuideListChanged({ detail: updatedList }) {
869
+ this.hasChanges = true;
870
+ this.guidesList = [...updatedList];
871
+ }
872
+ handleGuideRenamed({ detail: updatedName }) {
873
+ var _a;
874
+ const previousGuide = this.selectedGuide;
875
+ if (!(previousGuide === null || previousGuide === void 0 ? void 0 : previousGuide.name))
876
+ return;
877
+ const previousName = previousGuide.name;
878
+ const guideGroups = (_a = this.guidesMap.get(previousName)) !== null && _a !== void 0 ? _a : [];
879
+ const updatedGroups = FormConfigHelper.updateTabInFieldsFromGroupList(guideGroups, updatedName);
880
+ this.guidesMap.delete(previousName);
881
+ this.guidesMap.set(updatedName, updatedGroups);
882
+ const updatedGuide = {
883
+ name: updatedName,
884
+ label: updatedName,
885
+ visible: previousGuide.visible,
886
+ order: previousGuide.order,
887
+ };
888
+ this.guidesList = [...this.guidesList.map(guide => (guide.name === previousName) ? updatedGuide : guide)];
889
+ this.groupsList = [...updatedGroups];
890
+ this.selectedGuide = updatedGuide;
891
+ this.hasChanges = true;
892
+ }
893
+ handleCreateNewGuide() {
894
+ const newGuideName = FormConfigHelper.buildNewGuideName(this.guidesList, this.getMessage.bind(this));
895
+ const newGuide = {
896
+ name: newGuideName,
897
+ label: newGuideName,
898
+ visible: true,
899
+ order: this.guidesList.length + 1,
900
+ };
901
+ const newGuideFixedGroup = {
902
+ name: constants.GROUP_NAMES.noGroup,
903
+ fields: [],
904
+ };
905
+ this.guidesList = [...this.guidesList, newGuide];
906
+ this.guidesMap.set(newGuideName, [newGuideFixedGroup]);
907
+ this.selectedGuide = newGuide;
908
+ this.hasChanges = true;
909
+ }
910
+ getGuideNames() {
911
+ return [
912
+ ...this.guidesList.map(g => g.name.toLowerCase()),
913
+ this.getMessage('snkFormConfig.form.mainArea').toLowerCase(),
914
+ ];
915
+ }
916
+ async componentWillRender() {
917
+ if (this.messagesBuilder == undefined) {
918
+ const application = core.ApplicationContext.getContextValue('__SNK__APPLICATION__');
919
+ this.messagesBuilder = application.messagesBuilder;
920
+ }
921
+ }
922
+ async componentWillLoad() {
923
+ this.loadFormConfig();
924
+ await this.initializeUserConfig();
925
+ }
926
+ render() {
927
+ var _a;
928
+ return (index.h(index.Host, null, index.h("snk-dynaform-config-header", { configOptions: this.configOptions, selectedConfig: this.configSelected, messagesBuilder: this.messagesBuilder, hasChanges: this.hasChanges, optionConfigChanged: this.optionConfigChanged, onConfigClose: () => this.configClose.emit(), onSaveConfig: async () => await this.handleSaveConfig() }), index.h("div", { class: "form-config-body" }, index.h("div", { class: "form-config-layout" }, index.h("snk-dynaform-fields-selector", { dataUnit: this.dataUnit, availableFields: this.availableFields, onFieldListChanged: this.handleAvailableFieldListChanged.bind(this), messagesBuilder: this.messagesBuilder }), index.h("div", { class: "main-editing-area" }, this.mainGuide && (index.h("div", { class: "main-fields-section" }, index.h("snk-dynaform-fields-layout", { ref: ref => this.refMainFieldsLayout = ref, selectedGuide: this.mainGuide, guideNames: this.getGuideNames(), groupsList: this.mainGroupsList, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, isMainSection: true, onLayoutChanged: this.handleMainLayoutChanged.bind(this), onSetFieldListAsAvailable: this.handleSetFieldListAsAvailable.bind(this) }))), index.h("snk-dynaform-guides-configurator", { messagesBuilder: this.messagesBuilder, guidesList: this.guidesList, selectedGuide: this.selectedGuide, mainGuideName: (_a = this.mainGuide) === null || _a === void 0 ? void 0 : _a.name, onGuideSelected: this.handleSelectGuide.bind(this), onGuideListChanged: this.handleGuideListChanged.bind(this), onCreateNewGuide: this.handleCreateNewGuide.bind(this), onGuideDeleted: this.handleGuideDeleted.bind(this) }), index.h("snk-dynaform-fields-layout", { ref: ref => this.refFieldsLayout = ref, selectedGuide: this.selectedGuide, guideNames: this.getGuideNames(), groupsList: this.groupsList, messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, onGuideRenamed: this.handleGuideRenamed.bind(this), onLayoutChanged: this.handleLayoutChanged.bind(this), onSetFieldListAsAvailable: this.handleSetFieldListAsAvailable.bind(this) }))))));
929
+ }
930
+ static get watchers() { return {
931
+ "selectedGuide": ["observeSelectedGuide"],
932
+ "configManager": ["observeConfigManager"]
933
+ }; }
934
+ };
935
+ SnkDynaformFormConfig.style = snkDynaformFormConfigCss;
936
+
937
+ exports.snk_dynaform_detail_view = SnkDynaformDetailView;
938
+ exports.snk_dynaform_form_config = SnkDynaformFormConfig;