@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,744 @@
1
+ import { r as registerInstance, e as createEvent, h, F as Fragment, g as getElement } from './index-04f73a26.js';
2
+ import { ObjectUtils, StringUtils, Action, KeyboardManager, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { buildFieldSearch, SHORTCUT_SEARCH_FIELD } from '@sankhyalabs/ezui/dist/collection/utils';
4
+ import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
+ import { a as TAB_NAMES, V as VIEW_MODE } from './constants-7b422de0.js';
6
+ import { C as ConfigStorage } from './ConfigStorage-e834d1ea.js';
7
+ import { F as FormConfigFetcher } from './form-config-fetcher-db1bf140.js';
8
+ import { T as TaskbarElement } from './taskbar-elements-63651ca7.js';
9
+
10
+ class SnkFormConfigManager {
11
+ constructor(configName, resourceID, onConfigChange, dataUnit) {
12
+ this._resourceID = resourceID;
13
+ this._configName = configName;
14
+ this._onConfigChange = onConfigChange;
15
+ this._dataUnit = dataUnit;
16
+ }
17
+ addFormLegacyConfig(legacyConfigName) {
18
+ if (this._configName) {
19
+ ConfigStorage.addFormLegacyConfig(this._configName, legacyConfigName);
20
+ }
21
+ }
22
+ async loadConfig() {
23
+ return new Promise(resolve => {
24
+ ConfigStorage.loadFormConfig(this._configName, this._resourceID)
25
+ .then((config) => {
26
+ config = this.buildFormMetadataUITabs(config);
27
+ this.setConfig(config);
28
+ resolve(config);
29
+ })
30
+ .catch((error) => {
31
+ console.warn(error);
32
+ });
33
+ });
34
+ }
35
+ getEmptyConfig() {
36
+ return this.buildFormMetadataUITabs({ fields: [], emptyConfig: true }, true);
37
+ }
38
+ saveConfig(config) {
39
+ const configToSave = ObjectUtils.copy(config);
40
+ return new Promise(accept => {
41
+ ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
42
+ .then((response) => {
43
+ this.setConfig(Object.assign(Object.assign({}, configToSave), response));
44
+ accept(Object.assign(Object.assign({}, configToSave), response));
45
+ });
46
+ });
47
+ }
48
+ saveCardState(cardId, cardConfig, propertyChanged) {
49
+ return new Promise(resolve => {
50
+ var _a;
51
+ const cardsState = ((_a = this._config) === null || _a === void 0 ? void 0 : _a.cardsState) || new Map;
52
+ const currentConfig = cardsState.get(cardId);
53
+ cardsState.set(cardId, propertyChanged === "fixed" ?
54
+ this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
55
+ : Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
56
+ ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
57
+ .then(savedCardConfig => {
58
+ this._config = Object.assign(Object.assign({}, this._config), { cardsState });
59
+ resolve(savedCardConfig);
60
+ });
61
+ });
62
+ }
63
+ updateFixSequence(updatingCardConfig, cardsState) {
64
+ let maxSequence = -1;
65
+ Array.from(cardsState.values()).forEach(cardConfig => {
66
+ if (!cardConfig.fixed) {
67
+ delete updatingCardConfig.fixSequence;
68
+ }
69
+ if (cardConfig.fixSequence != undefined) {
70
+ maxSequence = Math.max(maxSequence, cardConfig.fixSequence);
71
+ }
72
+ });
73
+ if (updatingCardConfig.fixed) {
74
+ updatingCardConfig.fixSequence = maxSequence + 1;
75
+ }
76
+ else {
77
+ delete updatingCardConfig.fixSequence;
78
+ }
79
+ return updatingCardConfig;
80
+ }
81
+ hasConfig(config) {
82
+ var _a;
83
+ const currentConfig = config !== null && config !== void 0 ? config : this._config;
84
+ if (currentConfig && ((_a = currentConfig.fields) === null || _a === void 0 ? void 0 : _a.length)) {
85
+ return true;
86
+ }
87
+ return false;
88
+ }
89
+ getFieldsList(descriptionFilter, forceEmptyConfig = false) {
90
+ var _a, _b;
91
+ const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
92
+ const hasConfig = this.hasConfig();
93
+ if (hasConfig && !forceEmptyConfig) {
94
+ return fields.map(({ label, name, readOnly, visible, required, tab, group }) => {
95
+ var _a;
96
+ if (label == undefined) {
97
+ const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
98
+ if (!currentField)
99
+ return;
100
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab, group: group });
101
+ }
102
+ return { name, label, readOnly, visible, required, tab, group };
103
+ })
104
+ .filter(field => this.isFieldVisible(field, descriptionFilter));
105
+ }
106
+ if (!this._dataUnit || !((_b = this._dataUnit.metadata) === null || _b === void 0 ? void 0 : _b.fields)) {
107
+ return [];
108
+ }
109
+ const filteredFields = this._dataUnit.metadata.fields
110
+ .filter(field => this.isFieldVisible(field, descriptionFilter))
111
+ .map(({ label, name, readOnly, visible, required, properties }) => ({ label, name, readOnly, visible, required, tab: properties === null || properties === void 0 ? void 0 : properties.UITabName }));
112
+ return filteredFields;
113
+ }
114
+ isFieldVisible(field, descriptionFilter) {
115
+ if (field === undefined || field.visible === false) {
116
+ return false;
117
+ }
118
+ if (descriptionFilter == undefined) {
119
+ return true;
120
+ }
121
+ const normalizedText = StringUtils.replaceAccentuatedCharsLower((field.label || field.name).toLocaleLowerCase());
122
+ const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(descriptionFilter.toLocaleLowerCase());
123
+ return normalizedText.includes(normalizedFilter);
124
+ }
125
+ getFormConfig(dataUnit, ignoreReadOnlyFormFields, forceEmptyConfig = false) {
126
+ let fields = this.getFieldsList(undefined, forceEmptyConfig);
127
+ if (ignoreReadOnlyFormFields) {
128
+ fields = fields.filter(field => {
129
+ if (dataUnit) {
130
+ const def = dataUnit.getField(field.name);
131
+ if (def && def.readOnly) {
132
+ return false;
133
+ }
134
+ }
135
+ return !field.readOnly;
136
+ });
137
+ }
138
+ return Object.assign(Object.assign({}, this._config), { fields });
139
+ }
140
+ setConfig(config) {
141
+ this.isLoaded = true;
142
+ const { cardsState, summary, defaultVars } = this._config || {};
143
+ this._config = Object.assign({}, config);
144
+ if (cardsState) {
145
+ this._config.cardsState = cardsState;
146
+ }
147
+ if (summary) {
148
+ this._config.summary = summary;
149
+ }
150
+ if (defaultVars) {
151
+ this._config.defaultVars = defaultVars;
152
+ }
153
+ if (this._onConfigChange) {
154
+ this._onConfigChange(Object.assign({}, this._config));
155
+ }
156
+ }
157
+ getConfig(dataUnit, ignoreReadOnlyFormFields) {
158
+ return this.getFormConfig(dataUnit, ignoreReadOnlyFormFields);
159
+ }
160
+ getFormConfigFetcher() {
161
+ if (this._formConfigFetcher == undefined) {
162
+ this._formConfigFetcher = new FormConfigFetcher();
163
+ }
164
+ return this._formConfigFetcher;
165
+ }
166
+ async fetchUserAvailableConfigs() {
167
+ if (this._configName != undefined) {
168
+ //FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
169
+ return Promise.resolve(undefined);
170
+ }
171
+ return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
172
+ }
173
+ async fetchLegacyConfig() {
174
+ return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
175
+ }
176
+ async fetchDefaultConfig() {
177
+ return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
178
+ }
179
+ parseObjectList(object) {
180
+ if (!object) {
181
+ return [];
182
+ }
183
+ return Array.isArray(object) ? object : [object];
184
+ }
185
+ buildFormMetadataUITabs(config, forceEmptyConfig = false) {
186
+ var _a, _b, _c;
187
+ const hasConfig = this.hasConfig(config);
188
+ if (!forceEmptyConfig && (!this._dataUnit || hasConfig)) {
189
+ return config;
190
+ }
191
+ config = this.getFormConfig(this._dataUnit, false, true);
192
+ config.tabs = this.parseObjectList(config.tabs);
193
+ config.emptyConfig = false;
194
+ config.defaultConfiguration = true;
195
+ const fields = (_b = (_a = this._dataUnit.metadata) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : [];
196
+ for (const currentField of fields) {
197
+ const field = config.fields.find(field => field.name === currentField.name);
198
+ const uiTabName = (_c = currentField.properties) === null || _c === void 0 ? void 0 : _c.UITabName;
199
+ if (!uiTabName || uiTabName === TAB_NAMES.main) {
200
+ continue;
201
+ }
202
+ const haveTab = config.tabs.some((tab) => tab.label === uiTabName);
203
+ if (!haveTab) {
204
+ config.tabs.push({
205
+ label: uiTabName,
206
+ name: uiTabName,
207
+ order: 0,
208
+ visible: true,
209
+ });
210
+ }
211
+ if (field) {
212
+ field.tab = uiTabName;
213
+ }
214
+ }
215
+ return config;
216
+ }
217
+ }
218
+
219
+ const snkDynaformGuidesViewCss = ".sc-snk-dynaform-guides-view-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-small:var(--space--2xs, 8px);--snk-guides-viewer__header--min-height:68px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);display:block;height:100%;min-width:0;overflow-x:hidden}snk-dynaform-form-view.sc-snk-dynaform-guides-view{width:100%}.snk-guides-viewer.sc-snk-dynaform-guides-view{position:relative;display:flex;flex-direction:column;height:100%;overflow:hidden;padding:0px}.snk-guides-viewer__detail-container.sc-snk-dynaform-guides-view{display:flex;row-gap:24px;flex-direction:column;flex:1;max-height:none;min-height:0;overflow:hidden;margin-bottom:var(--space--12, 12px)}.snk-guides-viewer__container.sc-snk-dynaform-guides-view>snk-dynaform-form-view.sc-snk-dynaform-guides-view{max-height:300px;min-height:0;overflow-y:auto}.snk-guides-viewer__detail-container.sc-snk-dynaform-guides-view>snk-dynaform-form-view.sc-snk-dynaform-guides-view,.snk-guides-viewer__detail-container.sc-snk-dynaform-guides-view>snk-dynaform-detail-view.sc-snk-dynaform-guides-view{flex:1;min-height:0;overflow-y:auto}.snk-guides-viewer__header.sc-snk-dynaform-guides-view{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);padding:var(--snk-guides-viewer--space-small)}.snk-guides-viewer__header-breadcrumb.sc-snk-dynaform-guides-view{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-dynaform-guides-view{width:75%}.snk-guides-viewer__container.sc-snk-dynaform-guides-view{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;overflow:hidden}.snk-guides-viewer__tabselector.sc-snk-dynaform-guides-view{width:100%;min-width:0;box-sizing:border-box;padding:0 var(--space--12, 12px);flex-shrink:0}";
220
+
221
+ const SnkDynaformGuidesViewer = class {
222
+ constructor(hostRef) {
223
+ registerInstance(this, hostRef);
224
+ this.snkMasterFormConfigChange = createEvent(this, "snkMasterFormConfigChange", 7);
225
+ this.formConfigVisibilityChanged = createEvent(this, "formConfigVisibilityChanged", 7);
226
+ this.exit = createEvent(this, "exit", 7);
227
+ this.actionClick = createEvent(this, "actionClick", 7);
228
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
229
+ this.dataUnit = undefined;
230
+ this.dataState = undefined;
231
+ this.configName = undefined;
232
+ this.entityPath = undefined;
233
+ this.actionsList = undefined;
234
+ this.recordsValidator = undefined;
235
+ this.masterFormConfig = undefined;
236
+ this.selectedGuide = undefined;
237
+ this.taskbarManager = undefined;
238
+ this.messagesBuilder = undefined;
239
+ this.canEdit = true;
240
+ this.presentationMode = undefined;
241
+ this.resourceID = undefined;
242
+ this.detailTaskbarCustomContainerId = undefined;
243
+ this.formLegacyConfigName = undefined;
244
+ this.enableGridInsert = false;
245
+ this.ignoreReadOnlyFormFields = undefined;
246
+ this.getCustomTitle = undefined;
247
+ this.customGuidesConfig = [];
248
+ this._guides = [];
249
+ this._formEditorConfigManager = undefined;
250
+ this._formEditorDataUnit = undefined;
251
+ this._fieldToGetFocus = undefined;
252
+ this._customEditors = {};
253
+ this._customRenders = {};
254
+ this._fieldsProps = {};
255
+ this._mainForm = undefined;
256
+ this._mainFormName = undefined;
257
+ this._errorTabs = new Set();
258
+ this._hasToCreateFieldSearch = true;
259
+ }
260
+ observeDataUnit() {
261
+ this.loadGuides(true);
262
+ }
263
+ async observeFormConfigManager(value) {
264
+ var _a, _b;
265
+ const showFormConfig = !!value;
266
+ await ((_a = this._viewStack) === null || _a === void 0 ? void 0 : _a.show(showFormConfig ?
267
+ GUIDES_VIEWER_VIEW_MODE.CONFIG :
268
+ GUIDES_VIEWER_VIEW_MODE.GUIDES));
269
+ (_b = this.formConfigVisibilityChanged) === null || _b === void 0 ? void 0 : _b.emit(showFormConfig);
270
+ }
271
+ observeDataState(newValue, oldValue) {
272
+ var _a, _b, _c, _d, _e, _f;
273
+ const newRecordsIds = (_b = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.selectionInfo) === null || _a === void 0 ? void 0 : _a.recordIds) !== null && _b !== void 0 ? _b : (_c = newValue === null || newValue === void 0 ? void 0 : newValue.selectedRecord) === null || _c === void 0 ? void 0 : _c['__record__id__'];
274
+ const oldRecordsIds = (_e = (_d = oldValue === null || oldValue === void 0 ? void 0 : oldValue.selectionInfo) === null || _d === void 0 ? void 0 : _d.recordIds) !== null && _e !== void 0 ? _e : (_f = oldValue === null || oldValue === void 0 ? void 0 : oldValue.selectedRecord) === null || _f === void 0 ? void 0 : _f['__record__id__'];
275
+ if (!ObjectUtils.equals(newRecordsIds, oldRecordsIds)) {
276
+ this.loadGuides((oldValue === null || oldValue === void 0 ? void 0 : oldValue.insertionMode) != (newValue === null || newValue === void 0 ? void 0 : newValue.insertionMode));
277
+ }
278
+ }
279
+ observeMasterFormConfig() {
280
+ var _a;
281
+ this.loadGuides(this.noGuideSelected());
282
+ (_a = this.snkMasterFormConfigChange) === null || _a === void 0 ? void 0 : _a.emit(this.masterFormConfig);
283
+ }
284
+ /**
285
+ * Abre o configurador do formulário
286
+ * @param detail - Define se a configuração que está sendo carregada é
287
+ * referente a um form detail.
288
+ */
289
+ async showFormConfig(detail = false) {
290
+ var _a, _b;
291
+ const masterConfig = !detail || this._currentDetail == undefined;
292
+ this._formEditorConfigManager = masterConfig ? this._configManager : (_a = this._currentDetail) === null || _a === void 0 ? void 0 : _a.formConfigManager;
293
+ this._formEditorDataUnit = masterConfig ? this.dataUnit : (_b = this._currentDetail) === null || _b === void 0 ? void 0 : _b.dataUnit;
294
+ }
295
+ /**
296
+ * Registra um editor customizado para campos da grade e formulário
297
+ */
298
+ async addCustomEditor(fieldName, customEditor) {
299
+ this._customEditors = Object.assign(Object.assign({}, this._customEditors), { [fieldName]: customEditor });
300
+ }
301
+ /**
302
+ * Registra um render customizado para colunas da grid.
303
+ */
304
+ async addGridCustomRender(fieldName, customRender) {
305
+ this._customRenders = Object.assign(Object.assign({}, this._customRenders), { [fieldName]: customRender });
306
+ }
307
+ ;
308
+ /**
309
+ * Altera/adiciona uma propriedade nos metadados do campo.
310
+ */
311
+ async setFieldProp(fieldName, propName, value) {
312
+ const newFieldsProps = {
313
+ [fieldName]: Object.assign(Object.assign({}, this._fieldsProps[fieldName]), { [propName]: value })
314
+ };
315
+ this._fieldsProps = Object.assign(Object.assign({}, this._fieldsProps), newFieldsProps);
316
+ }
317
+ /**
318
+ * Atribui o foco para o componente.
319
+ */
320
+ async setFocus() {
321
+ var _a;
322
+ (_a = this._container) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
323
+ }
324
+ /**
325
+ * Recarrega os guias baseada nos metadados atuais.
326
+ */
327
+ async reloadGuides() {
328
+ this.loadGuides(false);
329
+ }
330
+ exitViewer() {
331
+ var _a, _b;
332
+ if (!this.enableGridInsert && ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.isDirty())) {
333
+ this.dataUnit.cancelEdition({ after: () => { var _a; return (_a = this.exit) === null || _a === void 0 ? void 0 : _a.emit(); } });
334
+ }
335
+ else {
336
+ (_b = this.exit) === null || _b === void 0 ? void 0 : _b.emit();
337
+ }
338
+ }
339
+ onActionClick(evt) {
340
+ var _a;
341
+ if (evt.detail === TaskbarElement.CONFIGURATOR) {
342
+ if (evt.target.dataset.taskbarOwner != "master") {
343
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.open();
344
+ evt.stopImmediatePropagation();
345
+ evt.stopPropagation();
346
+ }
347
+ }
348
+ }
349
+ onContentCardChanged(evt) {
350
+ if (!this._configManager || !this.dataUnit) {
351
+ return;
352
+ }
353
+ SnkDynaformGuidesViewer.updateContentCard(evt.detail.formName, evt.detail.cardConfig, evt.detail.propertyChanged, this._configManager)
354
+ .then(() => { var _a; return this.masterFormConfig = (_a = this._configManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit); });
355
+ }
356
+ /**
357
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
358
+ * através de um pequeno modulo na estrutura da aplicação:
359
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
360
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-crud.msg.ts"
361
+ */
362
+ getMessage(key) {
363
+ var _a, _b, _c, _d, _e, _f;
364
+ if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.isMultipleEdition) {
365
+ const selectedRecords = (_c = (_b = this.dataUnit.getSelectionInfo()) === null || _b === void 0 ? void 0 : _b.records) !== null && _c !== void 0 ? _c : [];
366
+ return (_d = this.messagesBuilder) === null || _d === void 0 ? void 0 : _d.getMessage("snkCrud.multipleEdition.editing", { COUNT: selectedRecords.length });
367
+ }
368
+ return (_e = this.messagesBuilder) === null || _e === void 0 ? void 0 : _e.getMessage(key, (_f = this.dataUnit) === null || _f === void 0 ? void 0 : _f.getSelectedRecord());
369
+ }
370
+ loadGuides(changeSelection) {
371
+ var _a;
372
+ if (!this.dataUnit || !this._configManager) {
373
+ return;
374
+ }
375
+ if (!this._configManager.isLoaded) {
376
+ return;
377
+ }
378
+ this._masterFormMetadata = buildFormMetadata(this.masterFormConfig, this.dataUnit, true, this.customGuidesConfig);
379
+ const allSheets = (_a = this._masterFormMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets();
380
+ if (!allSheets) {
381
+ return;
382
+ }
383
+ const currentRecord = this.dataUnit.getSelectedRecord();
384
+ const disableDetails = this.hasToDisableDetails(currentRecord);
385
+ const guides = [];
386
+ let mainFormName;
387
+ const listSheetsValues = Array.from(allSheets.values());
388
+ listSheetsValues.forEach((sheet) => {
389
+ if ((sheet === null || sheet === void 0 ? void 0 : sheet.name) === TAB_NAMES.main) {
390
+ mainFormName = sheet === null || sheet === void 0 ? void 0 : sheet.name;
391
+ return;
392
+ }
393
+ const item = { id: sheet === null || sheet === void 0 ? void 0 : sheet.name, label: sheet === null || sheet === void 0 ? void 0 : sheet.label };
394
+ if (this.isDetail(sheet === null || sheet === void 0 ? void 0 : sheet.name) && disableDetails) {
395
+ item.tooltip = this.getMessage("snkCrud.detail.tooltip.needSingleSelection");
396
+ item.disabled = true;
397
+ }
398
+ if (sheet.isCustom && sheet.ctxProps) {
399
+ Object.entries(sheet.ctxProps).forEach(([key, value]) => {
400
+ if (value !== undefined) {
401
+ item[key] = value;
402
+ }
403
+ });
404
+ }
405
+ if (!item.props) {
406
+ item.props = {};
407
+ }
408
+ item.props.isAdditional = sheet.name.includes("AD_");
409
+ item.props.isCustom = !!sheet.isCustom;
410
+ guides.push(item);
411
+ });
412
+ this._mainFormName = mainFormName;
413
+ this._guides = guides;
414
+ const currentStillExists = this.selectedGuide
415
+ && this._guides.some(g => g.id === this.selectedGuide.id);
416
+ if (changeSelection || !currentStillExists) {
417
+ this.selectedGuide = this._guides && this._guides.length > 0 ? this._guides[0] : undefined;
418
+ }
419
+ }
420
+ hasToDisableDetails(currentRecord) {
421
+ return !currentRecord
422
+ || !this.dataUnit
423
+ || this.dataUnit.isNewRecord(currentRecord.__record__id__)
424
+ || this.dataUnit.isMultipleEdition;
425
+ }
426
+ isDetail(formId) {
427
+ return FormMetadata.getDetailName(formId) != undefined;
428
+ }
429
+ buildTabItems() {
430
+ return this._guides.map((guide, index) => ({
431
+ tabKey: guide.id,
432
+ label: guide.label,
433
+ index,
434
+ disabled: guide.disabled,
435
+ rightIcon: this._errorTabs.has(guide.id) ? 'alert-circle-inverted' : undefined,
436
+ leftIcon: this.getTabLeftIcon(guide),
437
+ }));
438
+ }
439
+ getTabLeftIcon(guide) {
440
+ var _a, _b;
441
+ if (guide.icon) {
442
+ return guide.icon;
443
+ }
444
+ if ((_a = guide.props) === null || _a === void 0 ? void 0 : _a.isCustom) {
445
+ return 'puzzle-piece';
446
+ }
447
+ if ((_b = guide.props) === null || _b === void 0 ? void 0 : _b.isAdditional) {
448
+ return 'puzzle-piece';
449
+ }
450
+ return undefined;
451
+ }
452
+ isCustomGuide(guideId) {
453
+ var _a;
454
+ if (!guideId) {
455
+ return false;
456
+ }
457
+ return !!((_a = this.customGuidesConfig) === null || _a === void 0 ? void 0 : _a.some(g => g.id === guideId));
458
+ }
459
+ onTabChange(tab) {
460
+ const targetGuide = this._guides.find(g => g.id === tab.tabKey);
461
+ if (!targetGuide || targetGuide.disabled) {
462
+ return;
463
+ }
464
+ this.selectedGuide = targetGuide;
465
+ }
466
+ static updateContentCard(formName, cardConfig, propertyChanged, configManager) {
467
+ return configManager.saveCardState(formName, cardConfig, propertyChanged);
468
+ }
469
+ static buildMainForm(params) {
470
+ if (params.formMetadata == undefined || params.mainFormName == undefined) {
471
+ return undefined;
472
+ }
473
+ const mainSheet = params.formMetadata.getSheet(params.mainFormName);
474
+ if (mainSheet == undefined) {
475
+ return undefined;
476
+ }
477
+ return (h("snk-dynaform-form-view", { ref: (ref) => { var _a; return (_a = params.onMainFormRef) === null || _a === void 0 ? void 0 : _a.call(params, ref); }, label: mainSheet.label, name: params.mainFormName, fields: mainSheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, fieldToFocus: params.fieldToFocus, key: params.mainFormName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps, entityPath: params.entityPath, fieldSearch: params.fieldSearch }));
478
+ }
479
+ static buildFixedForms(params) {
480
+ var _a;
481
+ const cardsState = (_a = params.formConfig) === null || _a === void 0 ? void 0 : _a.cardsState;
482
+ if (cardsState == undefined || params.formMetadata == undefined) {
483
+ return undefined;
484
+ }
485
+ const fixedEntries = Array.from(cardsState.entries())
486
+ .filter(([formName, cardConfig]) => (cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed) && formName != params.selectedForm && formName != params.mainFormName)
487
+ .sort(([, cardConfigA], [, cardConfigB]) => {
488
+ const indexA = (cardConfigA === null || cardConfigA === void 0 ? void 0 : cardConfigA.fixSequence) || 0;
489
+ const indexB = (cardConfigB === null || cardConfigB === void 0 ? void 0 : cardConfigB.fixSequence) || 0;
490
+ return indexA - indexB;
491
+ });
492
+ if (fixedEntries.length === 0) {
493
+ return undefined;
494
+ }
495
+ return (h(Fragment, null, fixedEntries.map(([formName]) => {
496
+ const sheet = params.formMetadata.getSheet(formName);
497
+ if (sheet == undefined) {
498
+ return undefined;
499
+ }
500
+ return h("snk-dynaform-form-view", { label: sheet.label, name: formName, fields: sheet.fields, formMetadata: params.formMetadata, dataUnit: params.dataUnit, recordsValidator: params.recordsValidator, fieldToFocus: params.fieldToFocus, key: formName, onSnkRequestClearFieldToFocus: _ => { var _a; return (_a = params.onRequestClearFieldToFocus) === null || _a === void 0 ? void 0 : _a.call(params); }, customEditors: params.propsCustomEditor, fieldsProps: params.fieldsProps, entityPath: params.entityPath });
501
+ })));
502
+ }
503
+ getContent() {
504
+ var _a;
505
+ if (!this.selectedGuide) {
506
+ return undefined;
507
+ }
508
+ const guideId = this.selectedGuide.id;
509
+ if (this.isCustomGuide(guideId)) {
510
+ return h("slot", { name: guideId });
511
+ }
512
+ const childEntityName = FormMetadata.getDetailName(guideId);
513
+ if (childEntityName) {
514
+ return (h("snk-dynaform-detail-view", { ref: (ref) => {
515
+ if (ref)
516
+ this._currentDetail = ref;
517
+ }, dataUnitName: `${this.entityPath}/${childEntityName}`, entityName: childEntityName, label: this.selectedGuide.label, key: `detail_${guideId}`, canEdit: this.canEdit, resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders, presentationMode: this.presentationMode, messagesBuilder: this.messagesBuilder }));
518
+ }
519
+ if (guideId === this._mainFormName) {
520
+ return undefined;
521
+ }
522
+ const sheet = (_a = this._masterFormMetadata) === null || _a === void 0 ? void 0 : _a.getSheet(guideId);
523
+ if (!sheet) {
524
+ return undefined;
525
+ }
526
+ return (h("snk-dynaform-form-view", { name: guideId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch, entityPath: this.entityPath }));
527
+ }
528
+ clearFieldToFocusHandler() {
529
+ this._fieldToGetFocus = undefined;
530
+ }
531
+ getConfigViewMode() {
532
+ return VIEW_MODE.GRID;
533
+ }
534
+ changeConfigViewMode(mode) {
535
+ var _a, _b;
536
+ if (this._currentDetail) {
537
+ (_b = (_a = this._currentDetail).changeViewMode) === null || _b === void 0 ? void 0 : _b.call(_a, mode);
538
+ }
539
+ }
540
+ openConfig(mode) {
541
+ var _a, _b, _c, _d;
542
+ (_b = (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close) === null || _b === void 0 ? void 0 : _b.call(_a);
543
+ if (this._currentDetail) {
544
+ if (mode === VIEW_MODE.FORM) {
545
+ this.showFormConfig(true);
546
+ }
547
+ else {
548
+ (_d = (_c = this._currentDetail).configGrid) === null || _d === void 0 ? void 0 : _d.call(_c);
549
+ }
550
+ }
551
+ }
552
+ noGuideSelected() {
553
+ var _a;
554
+ return this.selectedGuide === undefined || TAB_NAMES.main === ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id);
555
+ }
556
+ addFormLegacyConfigName() {
557
+ var _a;
558
+ if (this.formLegacyConfigName) {
559
+ (_a = this._configManager) === null || _a === void 0 ? void 0 : _a.addFormLegacyConfig(this.formLegacyConfigName);
560
+ }
561
+ }
562
+ setMasterFormConfig(config) {
563
+ this.masterFormConfig = config;
564
+ }
565
+ componentWillLoad() {
566
+ var _a;
567
+ if (this.resourceID == undefined) {
568
+ throw new Error((_a = this.getMessage("snkCrud.errors.resourceIDNotProvided")) !== null && _a !== void 0 ? _a : "");
569
+ }
570
+ this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, this.setMasterFormConfig.bind(this), this.dataUnit);
571
+ this.addFormLegacyConfigName();
572
+ this._configManager.loadConfig();
573
+ }
574
+ async dataUnitActionHandler(action) {
575
+ var _a, _b;
576
+ switch (action.type) {
577
+ case Action.EDITION_CANCELED:
578
+ case Action.DATA_SAVED:
579
+ if ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.isMultipleEdition) {
580
+ this.exitViewer();
581
+ if (this.dataUnit) {
582
+ this.dataUnit.isMultipleEdition = false;
583
+ }
584
+ }
585
+ break;
586
+ case Action.FIELD_INVALIDATED:
587
+ const guideName = this.getGuideName((_b = action.payload) === null || _b === void 0 ? void 0 : _b.fieldName);
588
+ if (guideName) {
589
+ this._errorTabs = new Set([...this._errorTabs, guideName]);
590
+ }
591
+ break;
592
+ case Action.METADATA_LOADED:
593
+ case Action.MULTIPLE_EDITION_CHANGED:
594
+ this.loadGuides(this.noGuideSelected());
595
+ break;
596
+ }
597
+ }
598
+ getGuideName(fieldName) {
599
+ var _a, _b;
600
+ const sheets = (_a = this._masterFormMetadata) === null || _a === void 0 ? void 0 : _a.getAllSheets();
601
+ if (!sheets) {
602
+ return "";
603
+ }
604
+ for (const sheet of sheets) {
605
+ const formFields = (_b = sheet[1]) === null || _b === void 0 ? void 0 : _b.fields;
606
+ if (!formFields)
607
+ continue;
608
+ for (const field of formFields) {
609
+ if (field.name === fieldName) {
610
+ return sheet[0];
611
+ }
612
+ }
613
+ }
614
+ return "";
615
+ }
616
+ getTitle() {
617
+ var _a, _b, _c;
618
+ return (_c = (_b = (_a = this.getCustomTitle) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : this.getMessage("snkCrud.title")) !== null && _c !== void 0 ? _c : "";
619
+ }
620
+ getTitleTooltip() {
621
+ var _a;
622
+ if (!((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.isMultipleEdition))
623
+ return undefined;
624
+ return this.buildRecordIdsArray();
625
+ }
626
+ buildRecordIdsArray() {
627
+ var _a, _b, _c;
628
+ const selectedRecords = (_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo()) === null || _b === void 0 ? void 0 : _b.records) !== null && _c !== void 0 ? _c : [];
629
+ if (selectedRecords.length === 0) {
630
+ return "[]";
631
+ }
632
+ const labels = selectedRecords.map(record => { var _a; return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkCrud.title", record); });
633
+ return `[${labels.join(", ")}]`;
634
+ }
635
+ getFieldsSearch() {
636
+ var _a;
637
+ if (this._fieldSearch == undefined || this._hasToCreateFieldSearch) {
638
+ this._hasToCreateFieldSearch = false;
639
+ const item = {
640
+ label: (_a = this.getMessage("snkSimpleCrud.findFields")) !== null && _a !== void 0 ? _a : "Busca de campos",
641
+ value: "findFields",
642
+ };
643
+ this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
644
+ }
645
+ return this._fieldSearch;
646
+ }
647
+ fieldsOptionLoader(argument) {
648
+ var _a, _b;
649
+ return Promise.resolve((_b = (_a = this._configManager) === null || _a === void 0 ? void 0 : _a.getFieldsList(argument).map(field => ({ value: field.name, label: field.label }))) !== null && _b !== void 0 ? _b : []);
650
+ }
651
+ onSelectField(option) {
652
+ var _a, _b, _c;
653
+ if (option == undefined) {
654
+ return;
655
+ }
656
+ this._fieldToGetFocus = option.value;
657
+ const fieldGuideName = this.getGuideName(option.value);
658
+ if (!fieldGuideName) {
659
+ return;
660
+ }
661
+ if (fieldGuideName === this._mainFormName) {
662
+ (_b = (_a = this._mainForm) === null || _a === void 0 ? void 0 : _a.showUp) === null || _b === void 0 ? void 0 : _b.call(_a);
663
+ return;
664
+ }
665
+ if (fieldGuideName !== ((_c = this.selectedGuide) === null || _c === void 0 ? void 0 : _c.id)) {
666
+ const targetGuide = this._guides.find(g => g.id === fieldGuideName);
667
+ if (targetGuide && !targetGuide.disabled) {
668
+ this.selectedGuide = targetGuide;
669
+ }
670
+ }
671
+ }
672
+ componentDidLoad() {
673
+ var _a;
674
+ (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.subscribe(this.dataUnitActionHandler.bind(this));
675
+ this.initKeyboardManager();
676
+ this.getFieldsSearch();
677
+ }
678
+ disconnectedCallback() {
679
+ var _a;
680
+ (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
681
+ }
682
+ async initKeyboardManager() {
683
+ this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
684
+ if (this._keyboardManager) {
685
+ this._keyboardManager.bind(SHORTCUT_SEARCH_FIELD, async () => {
686
+ var _a, _b;
687
+ if (!this._mainForm)
688
+ return;
689
+ await ((_b = (_a = this._mainForm).showSearchField) === null || _b === void 0 ? void 0 : _b.call(_a));
690
+ }, { description: this.getMessage("snkSimpleCrud.findFields"), element: this._element });
691
+ }
692
+ }
693
+ render() {
694
+ var _a, _b, _c;
695
+ if (this._formEditorConfigManager != undefined) {
696
+ return (h("snk-dynaform-form-config", { ref: (ref) => {
697
+ if (ref)
698
+ this._container = ref;
699
+ }, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = undefined }));
700
+ }
701
+ if (!this.dataUnit || !((_a = this._configManager) === null || _a === void 0 ? void 0 : _a.isLoaded)) {
702
+ return undefined;
703
+ }
704
+ const showTabs = this._guides && this._guides.length > 0;
705
+ const fixedFormsParams = {
706
+ formConfig: this.masterFormConfig,
707
+ formMetadata: this._masterFormMetadata,
708
+ selectedForm: (_b = this.selectedGuide) === null || _b === void 0 ? void 0 : _b.id,
709
+ mainFormName: this._mainFormName,
710
+ dataUnit: this.dataUnit,
711
+ recordsValidator: this.recordsValidator,
712
+ fieldToFocus: this._fieldToGetFocus,
713
+ onRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this),
714
+ propsCustomEditor: this._customEditors,
715
+ fieldsProps: this._fieldsProps,
716
+ entityPath: this.entityPath,
717
+ fieldSearch: this._fieldSearch,
718
+ onMainFormRef: (ref) => { this._mainForm = ref; }
719
+ };
720
+ return (h("section", { class: "snk-guides-viewer", ref: (ref) => {
721
+ if (ref)
722
+ this._container = ref;
723
+ }, tabindex: -1 }, this.getTitle() && (h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center", key: "header" }, h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge", title: this.getTitleTooltip() }, this.getTitle()))))), h("div", { class: "snk-guides-viewer__container" }, SnkDynaformGuidesViewer.buildMainForm(fixedFormsParams), showTabs &&
724
+ h("ez-tabselector", Object.assign({ class: "snk-guides-viewer__tabselector", tabs: this.buildTabItems(), selectedTab: (_c = this.selectedGuide) === null || _c === void 0 ? void 0 : _c.id, onEzChange: (evt) => this.onTabChange(evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("tabselector")}` })), h("div", { class: "snk-guides-viewer__detail-container" }, SnkDynaformGuidesViewer.buildFixedForms(fixedFormsParams), this.getContent())), h("snk-configurator", { ref: (ref) => {
725
+ if (ref)
726
+ this._snkConfigurator = ref;
727
+ }, viewMode: this.getConfigViewMode(), onConfigSelected: (evt) => this.changeConfigViewMode(evt.detail), messagesBuilder: this.messagesBuilder, onOpenConfig: (evt) => this.openConfig(evt.detail), resourceID: this.resourceID })));
728
+ }
729
+ get _element() { return getElement(this); }
730
+ static get watchers() { return {
731
+ "dataUnit": ["observeDataUnit"],
732
+ "_formEditorConfigManager": ["observeFormConfigManager"],
733
+ "dataState": ["observeDataState"],
734
+ "masterFormConfig": ["observeMasterFormConfig"]
735
+ }; }
736
+ };
737
+ var GUIDES_VIEWER_VIEW_MODE;
738
+ (function (GUIDES_VIEWER_VIEW_MODE) {
739
+ GUIDES_VIEWER_VIEW_MODE[GUIDES_VIEWER_VIEW_MODE["GUIDES"] = 0] = "GUIDES";
740
+ GUIDES_VIEWER_VIEW_MODE[GUIDES_VIEWER_VIEW_MODE["CONFIG"] = 1] = "CONFIG";
741
+ })(GUIDES_VIEWER_VIEW_MODE || (GUIDES_VIEWER_VIEW_MODE = {}));
742
+ SnkDynaformGuidesViewer.style = snkDynaformGuidesViewCss;
743
+
744
+ export { SnkDynaformGuidesViewer as S, SnkFormConfigManager as a };