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

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 (263) 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-0bc94d36.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-bcbc38c0.js} +2 -3
  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-3b94547d.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-38748460.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/form-config-fetcher.js +22 -4
  72. package/dist/components/form-config-fetcher.js +22 -4
  73. package/dist/components/index.d.ts +12 -0
  74. package/dist/components/index.js +12 -0
  75. package/dist/components/snk-crud.js +1 -212
  76. package/dist/components/snk-dynaform-config-header.d.ts +11 -0
  77. package/dist/components/snk-dynaform-config-header.js +6 -0
  78. package/dist/components/snk-dynaform-config-header2.js +103 -0
  79. package/dist/components/snk-dynaform-configs-button.d.ts +11 -0
  80. package/dist/components/snk-dynaform-configs-button.js +6 -0
  81. package/dist/components/snk-dynaform-configs-button2.js +76 -0
  82. package/dist/components/snk-dynaform-detail-view.d.ts +11 -0
  83. package/dist/components/snk-dynaform-detail-view.js +6 -0
  84. package/dist/components/snk-dynaform-detail-view2.js +1835 -0
  85. package/dist/components/snk-dynaform-field-config.d.ts +11 -0
  86. package/dist/components/snk-dynaform-field-config.js +6 -0
  87. package/dist/components/snk-dynaform-field-config2.js +605 -0
  88. package/dist/components/snk-dynaform-field-item.d.ts +11 -0
  89. package/dist/components/snk-dynaform-field-item.js +6 -0
  90. package/dist/components/snk-dynaform-field-item2.js +96 -0
  91. package/dist/components/snk-dynaform-fields-layout.d.ts +11 -0
  92. package/dist/components/snk-dynaform-fields-layout.js +6 -0
  93. package/dist/components/snk-dynaform-fields-layout2.js +428 -0
  94. package/dist/components/snk-dynaform-fields-selector.d.ts +11 -0
  95. package/dist/components/snk-dynaform-fields-selector.js +6 -0
  96. package/dist/components/snk-dynaform-fields-selector2.js +104 -0
  97. package/dist/components/snk-dynaform-form-config.d.ts +11 -0
  98. package/dist/components/snk-dynaform-form-config.js +6 -0
  99. package/dist/components/snk-dynaform-form-config2.js +430 -0
  100. package/dist/components/snk-dynaform-form-view.d.ts +11 -0
  101. package/dist/components/snk-dynaform-form-view.js +6 -0
  102. package/dist/components/snk-dynaform-form-view2.js +270 -0
  103. package/dist/components/snk-dynaform-guides-configurator.d.ts +11 -0
  104. package/dist/components/snk-dynaform-guides-configurator.js +6 -0
  105. package/dist/components/snk-dynaform-guides-configurator2.js +173 -0
  106. package/dist/components/snk-dynaform-guides-view.d.ts +11 -0
  107. package/dist/components/snk-dynaform-guides-view.js +6 -0
  108. package/dist/components/snk-dynaform.d.ts +11 -0
  109. package/dist/components/snk-dynaform.js +1003 -0
  110. package/dist/components/snk-grid2.js +1 -1
  111. package/dist/components/taskbarUtils.js +224 -0
  112. package/dist/esm/{ConfigStorage-76872695.js → ConfigStorage-e834d1ea.js} +2 -2
  113. package/dist/esm/{DataFetcher-e60f8d53.js → DataFetcher-5ed0a377.js} +2830 -3
  114. package/dist/esm/FormConfigHelper-efc29480.js +328 -0
  115. package/dist/esm/{ISave-4929c071.js → ISave-5b46d691.js} +1 -1
  116. package/dist/esm/{PersonalizedFilterUtils-d2439a9a.js → PersonalizedFilterUtils-45b5803c.js} +49 -2
  117. package/dist/esm/{SnkFormConfigManager-83f6b22f.js → SnkFormConfigManager-bfd575c2.js} +2 -2
  118. package/dist/esm/{SnkMultiSelectionListDataSource-18abafb1.js → SnkMultiSelectionListDataSource-9e9166ae.js} +4 -4
  119. package/dist/esm/{auth-fetcher-1a31c1e4.js → auth-fetcher-5283045d.js} +1 -1
  120. package/dist/esm/{dataunit-fetcher-c176e002.js → dataunit-fetcher-3b1ca96e.js} +1 -2
  121. package/dist/esm/{filter-type.enum-f6a8fe23.js → filter-type.enum-62b7fe88.js} +8 -1
  122. package/dist/esm/{form-config-fetcher-b44b2727.js → form-config-fetcher-db1bf140.js} +23 -5
  123. package/dist/esm/index-04f73a26.js +24 -36
  124. package/dist/esm/loader.js +1 -1
  125. package/dist/esm/pesquisa-grid_2.entry.js +4 -5
  126. package/dist/esm/sankhyablocks.js +1 -1
  127. package/dist/esm/snk-actions-button_9.entry.js +5 -6
  128. package/dist/esm/snk-application.entry.js +6 -7
  129. package/dist/esm/snk-attach_11.entry.js +2936 -0
  130. package/dist/esm/snk-crud.entry.js +6 -218
  131. package/dist/esm/snk-data-exporter.entry.js +5 -6
  132. package/dist/esm/{snk-data-unit-d8cfa950.js → snk-data-unit-dfde62cb.js} +2 -2
  133. package/dist/esm/snk-data-unit.entry.js +3 -4
  134. package/dist/esm/snk-detail-view.entry.js +7 -8
  135. package/dist/esm/snk-dynaform-config-header_5.entry.js +731 -0
  136. package/dist/esm/snk-dynaform-detail-view_2.entry.js +933 -0
  137. package/dist/esm/snk-dynaform-field-config_2.entry.js +322 -0
  138. package/dist/esm/snk-dynaform-guides-view-1f1455d6.js +744 -0
  139. package/dist/esm/snk-dynaform-guides-view.entry.js +15 -0
  140. package/dist/esm/snk-dynaform.entry.js +671 -0
  141. package/dist/esm/{snk-expression-group_2.entry.js → snk-expression-group_4.entry.js} +405 -4
  142. package/dist/esm/snk-filter-bar_4.entry.js +5 -8
  143. package/dist/esm/snk-form_2.entry.js +4 -5
  144. package/dist/esm/snk-grid.entry.js +7 -8
  145. package/dist/esm/{snk-guides-viewer-adf39ea2.js → snk-guides-viewer-95fefcaa.js} +1 -1
  146. package/dist/esm/snk-guides-viewer.entry.js +5 -6
  147. package/dist/esm/snk-layout-form-config.entry.js +4 -5
  148. package/dist/esm/snk-pesquisa.entry.js +4 -5
  149. package/dist/esm/taskbarUtils-8501d09e.js +225 -0
  150. package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
  151. package/dist/sankhyablocks/{p-f5ad0720.js → p-19d1ca14.js} +1 -1
  152. package/dist/sankhyablocks/{p-ab5e12fa.js → p-1cc4cf61.js} +1 -1
  153. package/dist/sankhyablocks/p-1edd6be6.entry.js +1 -0
  154. package/dist/sankhyablocks/p-22ddc1a5.entry.js +1 -0
  155. package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
  156. package/dist/sankhyablocks/{p-5c250661.js → p-2c00b93d.js} +1 -1
  157. package/dist/sankhyablocks/p-3623fddf.entry.js +1 -0
  158. package/dist/sankhyablocks/p-43c94ba5.entry.js +1 -0
  159. package/dist/sankhyablocks/p-449dfe55.entry.js +1 -0
  160. package/dist/sankhyablocks/p-451b5bcc.entry.js +1 -0
  161. package/dist/sankhyablocks/p-46d7e2de.js +1 -0
  162. package/dist/sankhyablocks/{p-3c990841.js → p-51e853f2.js} +1 -1
  163. package/dist/sankhyablocks/p-58709cf9.js +1 -0
  164. package/dist/sankhyablocks/p-589016e2.entry.js +1 -0
  165. package/dist/sankhyablocks/p-5d02c032.js +1 -0
  166. package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
  167. package/dist/sankhyablocks/p-61776b68.entry.js +1 -0
  168. package/dist/sankhyablocks/p-6b8a1ec3.js +1 -0
  169. package/dist/sankhyablocks/p-7038cf62.entry.js +1 -0
  170. package/dist/sankhyablocks/{p-b1bb4cf1.js → p-70c2ee5c.js} +1 -1
  171. package/dist/sankhyablocks/p-7628e04f.entry.js +1 -0
  172. package/dist/sankhyablocks/p-7798788b.entry.js +1 -0
  173. package/dist/sankhyablocks/p-77c26de0.js +1 -0
  174. package/dist/sankhyablocks/p-7c34a0f7.entry.js +1 -0
  175. package/dist/sankhyablocks/p-a4a0d9b7.entry.js +1 -0
  176. package/dist/sankhyablocks/{p-4f7adf97.js → p-b1bf9564.js} +1 -1
  177. package/dist/sankhyablocks/p-b4c2a99c.entry.js +1 -0
  178. package/dist/sankhyablocks/p-b75af274.entry.js +1 -0
  179. package/dist/sankhyablocks/p-c538bd6c.entry.js +1 -0
  180. package/dist/sankhyablocks/{p-3704bf1b.js → p-d5810110.js} +1 -1
  181. package/dist/sankhyablocks/p-d7fd447e.entry.js +1 -0
  182. package/dist/sankhyablocks/p-d88278f8.js +28 -0
  183. package/dist/sankhyablocks/p-f076d742.js +60 -0
  184. package/dist/sankhyablocks/{p-8fe740b7.entry.js → p-f1ef090f.entry.js} +2 -2
  185. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  186. package/dist/types/components/snk-dynaform/interfaces/PropsCustomEditor.d.ts +4 -0
  187. package/dist/types/components/snk-dynaform/interfaces/PropsCustomRender.d.ts +4 -0
  188. package/dist/types/components/snk-dynaform/subcomponents/CardFormResizeObserver.d.ts +1 -0
  189. package/dist/types/components/snk-dynaform/subcomponents/GuideBuilder.d.ts +14 -0
  190. package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.d.ts +158 -0
  191. package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.d.ts +107 -0
  192. package/dist/types/components/snk-dynaform-form-config/FormConfigHelper.d.ts +36 -0
  193. package/dist/types/components/snk-dynaform-form-config/SnkFormConfigManager.d.ts +35 -0
  194. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.d.ts +23 -0
  195. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.d.ts +19 -0
  196. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.d.ts +56 -0
  197. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.d.ts +74 -0
  198. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.d.ts +21 -0
  199. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-form-config.d.ts +95 -0
  200. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.d.ts +35 -0
  201. package/dist/types/components.d.ts +2403 -1322
  202. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +1 -0
  203. package/package.json +1 -1
  204. package/react/components.d.ts +12 -0
  205. package/react/components.js +12 -0
  206. package/react/components.js.map +1 -1
  207. package/dist/cjs/SnkMessageBuilder-a9300ebe.js +0 -2833
  208. package/dist/cjs/default-filters-a09bf82b.js +0 -8
  209. package/dist/cjs/index-62760a9c.js +0 -49
  210. package/dist/cjs/index-8d94b7e0.js +0 -7
  211. package/dist/cjs/snk-attach.cjs.entry.js +0 -948
  212. package/dist/cjs/snk-default-filter.cjs.entry.js +0 -77
  213. package/dist/cjs/snk-filter-advanced-mode_3.cjs.entry.js +0 -99
  214. package/dist/cjs/snk-filter-detail.cjs.entry.js +0 -198
  215. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +0 -408
  216. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +0 -109
  217. package/dist/cjs/snk-image-input.cjs.entry.js +0 -160
  218. package/dist/cjs/snk-personalized-filter.cjs.entry.js +0 -358
  219. package/dist/cjs/snk-simple-crud.cjs.entry.js +0 -865
  220. package/dist/esm/SnkMessageBuilder-1eb7a1af.js +0 -2831
  221. package/dist/esm/default-filters-50105e43.js +0 -8
  222. package/dist/esm/index-620ac460.js +0 -7
  223. package/dist/esm/index-8acbae97.js +0 -49
  224. package/dist/esm/snk-attach.entry.js +0 -944
  225. package/dist/esm/snk-default-filter.entry.js +0 -73
  226. package/dist/esm/snk-filter-advanced-mode_3.entry.js +0 -93
  227. package/dist/esm/snk-filter-detail.entry.js +0 -194
  228. package/dist/esm/snk-filter-field-search_2.entry.js +0 -403
  229. package/dist/esm/snk-filter-modal-item.entry.js +0 -105
  230. package/dist/esm/snk-image-input.entry.js +0 -156
  231. package/dist/esm/snk-personalized-filter.entry.js +0 -354
  232. package/dist/esm/snk-simple-crud.entry.js +0 -861
  233. package/dist/sankhyablocks/p-0a4cdcde.entry.js +0 -1
  234. package/dist/sankhyablocks/p-0afc64df.entry.js +0 -1
  235. package/dist/sankhyablocks/p-10f27dc6.entry.js +0 -1
  236. package/dist/sankhyablocks/p-20f03230.entry.js +0 -1
  237. package/dist/sankhyablocks/p-2af8aca3.js +0 -1
  238. package/dist/sankhyablocks/p-3870748a.js +0 -28
  239. package/dist/sankhyablocks/p-3d294185.entry.js +0 -1
  240. package/dist/sankhyablocks/p-438a225f.entry.js +0 -1
  241. package/dist/sankhyablocks/p-4d04bc75.entry.js +0 -1
  242. package/dist/sankhyablocks/p-554c0e54.js +0 -1
  243. package/dist/sankhyablocks/p-57c184a2.entry.js +0 -1
  244. package/dist/sankhyablocks/p-68c1a093.js +0 -1
  245. package/dist/sankhyablocks/p-6a4b21dd.js +0 -1
  246. package/dist/sankhyablocks/p-6ae7543b.entry.js +0 -1
  247. package/dist/sankhyablocks/p-6e278003.js +0 -60
  248. package/dist/sankhyablocks/p-82bcb4cf.entry.js +0 -1
  249. package/dist/sankhyablocks/p-84345e7a.js +0 -1
  250. package/dist/sankhyablocks/p-95af0bb1.entry.js +0 -1
  251. package/dist/sankhyablocks/p-a905712a.entry.js +0 -1
  252. package/dist/sankhyablocks/p-aff2d081.entry.js +0 -1
  253. package/dist/sankhyablocks/p-b0a357b4.entry.js +0 -1
  254. package/dist/sankhyablocks/p-b568c1d4.js +0 -1
  255. package/dist/sankhyablocks/p-bab4cde4.entry.js +0 -1
  256. package/dist/sankhyablocks/p-bd3c1aaa.entry.js +0 -1
  257. package/dist/sankhyablocks/p-cc64239c.entry.js +0 -1
  258. package/dist/sankhyablocks/p-cd00a3d1.entry.js +0 -1
  259. package/dist/sankhyablocks/p-d9ec8c4b.entry.js +0 -1
  260. package/dist/sankhyablocks/p-dbdbb77a.entry.js +0 -1
  261. package/dist/sankhyablocks/p-e8df1dea.entry.js +0 -1
  262. package/dist/sankhyablocks/p-ef9343c3.entry.js +0 -1
  263. package/dist/sankhyablocks/p-f4184ce7.js +0 -1
@@ -0,0 +1,2936 @@
1
+ import { r as registerInstance, e as createEvent, h, f as Host, F as Fragment, g as getElement } from './index-04f73a26.js';
2
+ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnitLoaderUtils, DataUnit, ElementIDUtils, ObjectUtils, KeyboardManager } from '@sankhyalabs/core';
3
+ import { D as DataFetcher, S as SnkMessageBuilder } from './DataFetcher-5ed0a377.js';
4
+ import { S as SaveErrorsEnum } from './ISave-5b46d691.js';
5
+ import { P as PresentationMode } from './index-b40568ff.js';
6
+ import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-3b1ca96e.js';
7
+ import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
8
+ import { F as FormConfigFetcher } from './form-config-fetcher-db1bf140.js';
9
+ import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7b422de0.js';
10
+ import { A as AutorizationType } from './auth-fetcher-5283045d.js';
11
+ import { T as TaskbarElement } from './taskbar-elements-63651ca7.js';
12
+ import { A as ActionDefaultFilter, F as FilterType } from './filter-type.enum-62b7fe88.js';
13
+ import { focusOnFieldSerch, SEARCH_FIELD_FULL_WIDTH, FormLayout, ApplicationUtils, CSSVarsUtils, buildFieldSearch } from '@sankhyalabs/ezui/dist/collection/utils';
14
+ import { DataBinder } from '@sankhyalabs/ezui/dist/collection/utils/form';
15
+ import { g as getPKs, b as base64ToBlob, s as sessionFileUpload, a as buildFileKey, d as downloadImage } from './ImageUtils-efbea0e4.js';
16
+ import { P as PersonalizedFilterUtils, a as FilterGroupCondition, D as DefaultFilter } from './PersonalizedFilterUtils-45b5803c.js';
17
+ import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
18
+ import { C as ConfigStorage, P as PersonalizedFilterFetcher } from './ConfigStorage-e834d1ea.js';
19
+ import { s as store } from './index-ea250be6.js';
20
+ import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, a as CrudUtils, b as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-9e9166ae.js';
21
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
22
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
23
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-bfd575c2.js';
24
+ import { C as ContinuousInsertUtils } from './ContinuousInsertUtils-bce77dc1.js';
25
+ import './PrintUtils-3e4ff0f5.js';
26
+ import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
27
+ import '@sankhyalabs/core/dist/utils/SortingUtils';
28
+ import './ResourceIDUtils-a114189a.js';
29
+ import './GetSelectedRecordsIDsInfo-9fa41508.js';
30
+ import './IFetchDataExporterParams-d73bed3d.js';
31
+ import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
32
+
33
+ const SERVICE$1 = {
34
+ save: "Attach.save",
35
+ delete: "Attach.remove",
36
+ view: "Attach.view",
37
+ repository: "RepositorioArquivoSP.abreArquivo"
38
+ };
39
+ class AttachFetcher {
40
+ constructor(dataUnitName) {
41
+ this.dataUnitName = dataUnitName;
42
+ }
43
+ async save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }) {
44
+ var _a, _b;
45
+ const isInsert = operation == "INSERT";
46
+ const dataBody = isInsert ? fields : record;
47
+ if (!isInsert && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) !== (record === null || record === void 0 ? void 0 : record.DESCRICAO)) {
48
+ throw new Error(SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED);
49
+ }
50
+ const reqBody = {
51
+ "anexo": {
52
+ "codata": isInsert ? fields === null || fields === void 0 ? void 0 : fields.REGISTER_KEY : record === null || record === void 0 ? void 0 : record.CODATA,
53
+ "sequencia": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.SEQUENCIA) || "0",
54
+ "tipo": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.TIPO) || "N",
55
+ "descricao": dataBody === null || dataBody === void 0 ? void 0 : dataBody.DESCRICAO,
56
+ "arquivo": (_b = (_a = fields.CAMINHO_ARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name,
57
+ "ehInclusao": isInsert ? "S" : "N",
58
+ "ehArquivoRepositorio": "N"
59
+ }
60
+ };
61
+ return new Promise((resolve, reject) => {
62
+ DataFetcher.get().callServiceBroker(SERVICE$1.save, JSON.stringify(reqBody))
63
+ .then(result => {
64
+ var _a;
65
+ return resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { __owner__dataunit__name__: (_a = this.dataUnitName) !== null && _a !== void 0 ? _a : dataUnitName })]);
66
+ })
67
+ .catch(error => reject(error));
68
+ });
69
+ }
70
+ async edit(change) {
71
+ throw new Error("Method not implemented.");
72
+ }
73
+ async delete(record) {
74
+ var request = {
75
+ anexo: {
76
+ codata: record.CODATA,
77
+ tipo: record.TIPO,
78
+ descricao: record.DESCRICAO,
79
+ }
80
+ };
81
+ const result = await DataFetcher.get().callServiceBroker(SERVICE$1.delete, JSON.stringify(request));
82
+ return Promise.resolve(result);
83
+ }
84
+ async getDownloadKey(record) {
85
+ var _a, _b, _c;
86
+ if (record.EHARQUIVOREPOSITORIO == 'S') {
87
+ const request = {
88
+ config: {
89
+ path: record.ARQUIVO,
90
+ tipoconteudo: record.TIPOCONTEUDO
91
+ }
92
+ };
93
+ const result = await DataFetcher.get().callServiceBroker(SERVICE$1.repository, JSON.stringify(request));
94
+ return Promise.resolve({
95
+ chave: {
96
+ valor: (_b = (_a = result === null || result === void 0 ? void 0 : result.responseBody) === null || _a === void 0 ? void 0 : _a.chave) === null || _b === void 0 ? void 0 : _b.valor
97
+ }
98
+ });
99
+ }
100
+ const criteria = {
101
+ anexo: {
102
+ codata: record.CODATA,
103
+ codemp: record.CODEMP,
104
+ sequencia: record.SEQUENCIA,
105
+ tipo: record.TIPO,
106
+ descricao: record.DESCRICAO,
107
+ tipoConteudo: record.TIPOCONTEUDO
108
+ }
109
+ };
110
+ const result = await DataFetcher.get().callServiceBroker(SERVICE$1.view, JSON.stringify(criteria));
111
+ if (result === null || result === void 0 ? void 0 : result.chaveAnexo) {
112
+ return Promise.resolve({
113
+ chave: {
114
+ valor: (_c = result === null || result === void 0 ? void 0 : result.chaveAnexo) === null || _c === void 0 ? void 0 : _c.idChaveAnexo
115
+ }
116
+ });
117
+ }
118
+ return Promise.reject(new Error("File not found."));
119
+ }
120
+ }
121
+
122
+ const SERVICE = {
123
+ save: "AnexoSistemaSP.salvar",
124
+ delete: "AnexoSistemaSP.excluir",
125
+ download: "AnexoSistemaSP.baixar",
126
+ };
127
+ class AnexoSistemaFetcher {
128
+ constructor(entityName, dataUnitName) {
129
+ var _a;
130
+ this.entityName = entityName;
131
+ this.dataUnitName = dataUnitName;
132
+ this.validateFields = (fields) => {
133
+ if (!!fields.LINK && !!fields.NOMEARQUIVO)
134
+ throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
135
+ if (!fields.LINK && !fields.NOMEARQUIVO)
136
+ throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
137
+ if (!this._registerKey)
138
+ throw new Error('Register key can not be null');
139
+ };
140
+ this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
141
+ }
142
+ set registerKey(registerKey) {
143
+ this._registerKey = registerKey;
144
+ }
145
+ async save(change) {
146
+ var _a, _b;
147
+ let { updatingFields: fields } = change;
148
+ fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
149
+ try {
150
+ this.validateFields(fields);
151
+ const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
152
+ const reqBody = {
153
+ serviceName: SERVICE.save,
154
+ requestBody: {
155
+ params: {
156
+ resourceID: this.resourceID,
157
+ description: fields.DESCRICAO,
158
+ fileSelect: fileInfo ? 1 : 0,
159
+ keySession: (_b = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _b === void 0 ? void 0 : _b.fileNameTmp,
160
+ nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
161
+ link: fields.LINK,
162
+ nameEntity: this.entityName,
163
+ pkEntity: this._registerKey,
164
+ typeAcess: fields.TIPOACESSO,
165
+ typeApres: fields.TIPOAPRES,
166
+ }
167
+ }
168
+ };
169
+ const result = await DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
170
+ return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
171
+ }
172
+ catch (error) {
173
+ return Promise.reject(error);
174
+ }
175
+ }
176
+ async edit(change) {
177
+ var _a, _b, _c;
178
+ let { updatingFields: fields, record } = change;
179
+ const getFieldValue = (fieldValue) => {
180
+ if (fields[fieldValue] !== undefined)
181
+ return fields[fieldValue];
182
+ return record[fieldValue];
183
+ };
184
+ const attachField = getFieldValue('NOMEARQUIVO');
185
+ const hasNewAttachment = (_b = (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.downloadURL;
186
+ fields = Object.assign(Object.assign({}, fields), { DESCRICAO: getFieldValue('DESCRICAO'), LINK: getFieldValue('LINK'), TIPOACESSO: getFieldValue('TIPOACESSO'), TIPOAPRES: getFieldValue('TIPOAPRES'), CHAVEARQUIVO: record.CHAVEARQUIVO, NOMEARQUIVO: attachField === null || attachField === void 0 ? void 0 : attachField[0] });
187
+ const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
188
+ try {
189
+ this.validateFields(fields);
190
+ const reqBody = {
191
+ serviceName: SERVICE.save,
192
+ requestBody: {
193
+ params: {
194
+ resourceID: this.resourceID,
195
+ nuAttach: record === null || record === void 0 ? void 0 : record.NUATTACH,
196
+ description: fields.DESCRICAO,
197
+ fileSelect: hasNewAttachment ? 1 : 0,
198
+ keySession: (_c = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _c === void 0 ? void 0 : _c.fileNameTmp,
199
+ keyAttach: fields.CHAVEARQUIVO,
200
+ nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
201
+ link: fields.LINK,
202
+ nameEntity: this.entityName,
203
+ pkEntity: this._registerKey,
204
+ typeAcess: fields.TIPOACESSO,
205
+ typeApres: fields.TIPOAPRES,
206
+ }
207
+ }
208
+ };
209
+ const result = await DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
210
+ return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
211
+ }
212
+ catch (error) {
213
+ return Promise.reject(error);
214
+ }
215
+ }
216
+ delete(record) {
217
+ var _a;
218
+ const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
219
+ const reqBody = {
220
+ serviceName: SERVICE.delete,
221
+ requestBody: {
222
+ paramsDelete: {
223
+ keyAttach: record.CHAVEARQUIVO,
224
+ nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
225
+ nameEntity: record.NOMEINSTANCIA,
226
+ nuAttach: record.NUATTACH,
227
+ pkEntity: record.PKREGISTRO
228
+ }
229
+ }
230
+ };
231
+ return new Promise((resolve, reject) => {
232
+ DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(reqBody))
233
+ .then(result => resolve(result))
234
+ .catch(error => reject(error));
235
+ });
236
+ }
237
+ getDownloadKey(record) {
238
+ var _a;
239
+ const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
240
+ const reqBody = {
241
+ serviceName: SERVICE.download,
242
+ requestBody: {
243
+ paramsDown: {
244
+ nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
245
+ nameEntity: record.NOMEINSTANCIA,
246
+ nuAttach: record.NUATTACH,
247
+ pkEntity: record.PKREGISTRO,
248
+ keyAttach: record.CHAVEARQUIVO,
249
+ }
250
+ }
251
+ };
252
+ return new Promise((resolve, reject) => {
253
+ DataFetcher.get().callServiceBroker(SERVICE.download, JSON.stringify(reqBody))
254
+ .then(result => resolve(result))
255
+ .catch(error => reject(error));
256
+ });
257
+ }
258
+ }
259
+
260
+ class AnexoSistemaDataUnitFactory {
261
+ constructor(entityName, getMessage) {
262
+ this.entityName = entityName;
263
+ this.getMessage = getMessage;
264
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
265
+ }
266
+ initLoaders(dataUnit, fetcher, onSuccess) {
267
+ if (!this.loader)
268
+ this.loader = dataUnit.dataLoader;
269
+ dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
270
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
271
+ if (recordIds.length)
272
+ onSuccess();
273
+ return recordIds;
274
+ });
275
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
276
+ if (recordIds.length)
277
+ onSuccess();
278
+ return recordIds;
279
+ });
280
+ }
281
+ metadataLoader(dataUnit) {
282
+ throw new Error("Method not implemented.");
283
+ }
284
+ dataLoader(dataUnit, request) {
285
+ return new Promise(resolve => {
286
+ this.loader(dataUnit, request).then(response => {
287
+ const records = ((response === null || response === void 0 ? void 0 : response.records) || []).map(record => {
288
+ let fileInfo;
289
+ if (!record.LINK)
290
+ fileInfo = [{
291
+ name: record.NOMEARQUIVO,
292
+ }];
293
+ return Object.assign(Object.assign({}, record), { ARQUIVOOULINK: !!record.LINK ? record.LINK : record.NOMEARQUIVO, NOMEARQUIVO: fileInfo });
294
+ });
295
+ resolve(Object.assign(Object.assign({}, response), { records }));
296
+ });
297
+ });
298
+ }
299
+ saveLoader(changes, fetcher) {
300
+ return new Promise((resolve) => {
301
+ var _a;
302
+ const change = Array.isArray(changes) ? changes[0] : {};
303
+ const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? fetcher.edit.bind(fetcher) : fetcher.save.bind(fetcher);
304
+ savePromise(change).then((records) => {
305
+ resolve(records);
306
+ }).catch((error) => {
307
+ if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
308
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
309
+ return resolve([]);
310
+ }
311
+ if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
312
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
313
+ return resolve([]);
314
+ }
315
+ if (error.message) {
316
+ this._application.error((error.title || error.name), error.message);
317
+ return resolve([]);
318
+ }
319
+ resolve([]);
320
+ });
321
+ });
322
+ }
323
+ removeLoader(dataUnit, ids, fetcher) {
324
+ return new Promise((resolve) => {
325
+ const { records } = dataUnit.getSelectionInfo();
326
+ const recordToDelete = records[0];
327
+ fetcher.delete(recordToDelete).then(() => {
328
+ PreloadManager.removeRecords(dataUnit, [recordToDelete]);
329
+ return resolve(ids);
330
+ });
331
+ });
332
+ }
333
+ getFilters(registerKey) {
334
+ return [
335
+ {
336
+ name: 'AttachmentsByPK',
337
+ expression: 'this.PKREGISTRO = :PKREGISTRO',
338
+ params: [{
339
+ name: "PKREGISTRO",
340
+ dataType: DataType.TEXT,
341
+ value: `${registerKey}_${this.entityName}`
342
+ }]
343
+ }
344
+ ];
345
+ }
346
+ getInterceptions(dataUnit, action, crudRef) {
347
+ return new Promise((resolve) => {
348
+ if (action.type === Action.EDITION_CANCELED) {
349
+ if (!dataUnit.isDirty())
350
+ return resolve(action);
351
+ return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
352
+ if (cancellationConfirmed) {
353
+ crudRef.goToView(VIEW_MODE.GRID);
354
+ return resolve(action);
355
+ }
356
+ return resolve(undefined);
357
+ });
358
+ }
359
+ if (action.type === Action.DATA_SAVED) {
360
+ dataUnit.loadData();
361
+ return resolve(action);
362
+ }
363
+ resolve(action);
364
+ });
365
+ }
366
+ }
367
+
368
+ let messageBuilderInstance;
369
+ const getMessage$1 = (key) => {
370
+ if (!messageBuilderInstance) {
371
+ messageBuilderInstance = new SnkMessageBuilder();
372
+ }
373
+ return messageBuilderInstance.getMessage(key);
374
+ };
375
+ const attachCrudConfig = {
376
+ grid: {
377
+ columns: [
378
+ { name: "CODATA", orderIndex: 0, width: 0 },
379
+ { name: "DESCRICAO", orderIndex: 1, width: 0 },
380
+ { name: "ARQUIVO", orderIndex: 2, width: 0 },
381
+ { name: "DTALTER", orderIndex: 3, width: 0 },
382
+ { name: "USUARIO", orderIndex: 4, width: 0 },
383
+ ],
384
+ },
385
+ form: {
386
+ emptyConfig: false,
387
+ fields: [
388
+ {
389
+ name: "DESCRICAO",
390
+ label: getMessage$1("snkAttach.attachMetadata.lblDescription"),
391
+ visible: true,
392
+ readOnly: false,
393
+ required: true,
394
+ },
395
+ {
396
+ name: "CAMINHO_ARQUIVO",
397
+ label: getMessage$1("snkAttach.attachMetadata.lblFile"),
398
+ visible: true,
399
+ readOnly: false,
400
+ required: true,
401
+ },
402
+ ],
403
+ },
404
+ };
405
+ const attachFetcherMetadataBuilder = {
406
+ name: "Attach",
407
+ label: "Attach List",
408
+ fields: [
409
+ { name: "CODATA", label: getMessage$1("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
410
+ { name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT, readOnly: false },
411
+ { name: "ARQUIVO", label: getMessage$1("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
412
+ { name: "USUARIO", label: getMessage$1("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
413
+ { name: "DTALTER", label: getMessage$1("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
414
+ {
415
+ name: "CAMINHO_ARQUIVO",
416
+ label: getMessage$1("snkAttach.attachMetadata.lblFileUpload"),
417
+ dataType: DataType.OBJECT,
418
+ userInterface: UserInterface.FILE,
419
+ readOnly: false,
420
+ required: true,
421
+ visible: true,
422
+ properties: {
423
+ subTitle: getMessage$1("snkAttach.attachMetadata.lblSubTitle"),
424
+ MAX_FILES: 1,
425
+ STORAGESTRATEGY: "SESSION",
426
+ INTERNAL_FILENAME: "Attach.upload",
427
+ }
428
+ },
429
+ ],
430
+ };
431
+
432
+ const SERVICE_LOAD = "Attach.load";
433
+ class AttachFetcherDataUnitFactory {
434
+ constructor(getMessage) {
435
+ this.getMessage = getMessage;
436
+ this._records = [];
437
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
438
+ }
439
+ initLoaders(dataUnit, fetcher, onSuccess) {
440
+ dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
441
+ dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
442
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
443
+ if (recordIds.length)
444
+ onSuccess();
445
+ return recordIds;
446
+ });
447
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
448
+ if (recordIds.length)
449
+ onSuccess();
450
+ return recordIds;
451
+ });
452
+ }
453
+ metadataLoader(_) {
454
+ return Promise.resolve(attachFetcherMetadataBuilder);
455
+ }
456
+ async dataLoader(dataUnit, request) {
457
+ if (!request.source) {
458
+ return Promise.resolve({ records: this._records });
459
+ }
460
+ if (!Number.isNaN(Number(request.source))) {
461
+ const criteria = {
462
+ criteria: {
463
+ codata: request.source,
464
+ tipoAnexo: "N"
465
+ }
466
+ };
467
+ const applicationDataFetcher = await this._application.getDataFetcher();
468
+ const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
469
+ const records = [];
470
+ anexo.forEach((param) => {
471
+ records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
472
+ name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
473
+ }] }, param));
474
+ });
475
+ this._records = records;
476
+ }
477
+ return DataUnitLoaderUtils.buildLoadDataResponse(this._records, dataUnit, request);
478
+ }
479
+ saveLoader(changes, fetcher) {
480
+ return new Promise((resolve) => {
481
+ const change = Array.isArray(changes) ? changes[0] : {};
482
+ fetcher.save(change)
483
+ .then(resolve)
484
+ .catch((error) => {
485
+ if (error.message === SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
486
+ this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
487
+ return resolve([]);
488
+ }
489
+ if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
490
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
491
+ return resolve([]);
492
+ }
493
+ if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
494
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
495
+ return resolve([]);
496
+ }
497
+ if (error.message) {
498
+ this._application.error((error.title || error.name), error.message);
499
+ return resolve([]);
500
+ }
501
+ resolve([]);
502
+ });
503
+ });
504
+ }
505
+ removeLoader(dataUnit, ids, fetcher) {
506
+ return new Promise((resolve) => {
507
+ dataUnit.getSelectionInfo().records.forEach(async (record) => {
508
+ this._application.hasAccess(AutorizationType.REMOVE)
509
+ .then(async (hasAccess) => {
510
+ if (hasAccess) {
511
+ await fetcher.delete(record);
512
+ resolve(ids);
513
+ }
514
+ });
515
+ });
516
+ });
517
+ }
518
+ getFilters() {
519
+ throw new Error('Method not implemented.');
520
+ }
521
+ getInterceptions(dataUnit, action, crudRef) {
522
+ return new Promise((resolve) => {
523
+ var _a, _b, _c, _d, _e, _f;
524
+ switch (action.type) {
525
+ case Action.EDITION_CANCELED:
526
+ if (!dataUnit.isDirty())
527
+ return resolve(action);
528
+ return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
529
+ if (cancellationConfirmed) {
530
+ crudRef.goToView(VIEW_MODE.GRID);
531
+ return resolve(action);
532
+ }
533
+ return resolve(undefined);
534
+ });
535
+ case Action.DATA_SAVED:
536
+ dataUnit.loadData(undefined, undefined, false, (_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.REGISTER_KEY);
537
+ return resolve(action);
538
+ case Action.RECORDS_REMOVED:
539
+ dataUnit.loadData(undefined, undefined, false, (_f = (_e = (_d = action === null || action === void 0 ? void 0 : action.payload) === null || _d === void 0 ? void 0 : _d.cachedRecords) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.CODATA);
540
+ return resolve(action);
541
+ }
542
+ resolve(action);
543
+ });
544
+ }
545
+ }
546
+
547
+ let messagesBuilder;
548
+ const getMessage = (key) => {
549
+ var _a;
550
+ if (!messagesBuilder) {
551
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
552
+ messagesBuilder = application === null || application === void 0 ? void 0 : application.messagesBuilder;
553
+ }
554
+ return (_a = messagesBuilder === null || messagesBuilder === void 0 ? void 0 : messagesBuilder.getMessage) === null || _a === void 0 ? void 0 : _a.call(messagesBuilder, key, null);
555
+ };
556
+ const TaskbarAttachButtons = {
557
+ DOWNLOAD: {
558
+ hint: getMessage("snkAttach.taskbar.titleDownload"),
559
+ name: "DOWNLOAD",
560
+ iconName: 'file-download'
561
+ },
562
+ LINK: {
563
+ hint: getMessage("snkAttach.taskbar.titleLink"),
564
+ name: "LINK",
565
+ iconName: "launch"
566
+ }
567
+ };
568
+ const buildTaskBarManager = () => {
569
+ const disabledButtonsWithoutSelection = [
570
+ TaskbarElement.REMOVE,
571
+ "DOWNLOAD",
572
+ "LINK"
573
+ ];
574
+ return {
575
+ getButtons: (_, dataState, currentButtons) => {
576
+ const refreshBtnIndex = currentButtons.indexOf(TaskbarElement.REFRESH);
577
+ if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
578
+ return currentButtons.reverse();
579
+ }
580
+ else if (refreshBtnIndex !== -1) {
581
+ currentButtons.splice(refreshBtnIndex, 1);
582
+ }
583
+ const { selectedRecord } = dataState || {};
584
+ const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
585
+ currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
586
+ const buttonsToRemove = [TaskbarElement.CLONE, TaskbarElement.DATA_EXPORTER];
587
+ const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
588
+ updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
589
+ return updatedButtons;
590
+ },
591
+ isEnabled: (_, dataState, currentButton) => {
592
+ const hasSelectedRecord = (dataState === null || dataState === void 0 ? void 0 : dataState.selectedRecord) !== undefined;
593
+ const disabledButton = disabledButtonsWithoutSelection.includes(currentButton);
594
+ if (disabledButton && !hasSelectedRecord)
595
+ return false;
596
+ return true;
597
+ }
598
+ };
599
+ };
600
+
601
+ const anexoSistemaCrudConfig = {
602
+ grid: {
603
+ columns: [
604
+ { name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
605
+ { name: "DESCRICAO", orderIndex: 1, width: 0 },
606
+ { name: "DHCAD", orderIndex: 2, width: 0 },
607
+ { name: "DHALTER", orderIndex: 3, width: 0 },
608
+ { name: "TIPOAPRES", orderIndex: 4, width: 0 },
609
+ { name: "TIPOACESSO", orderIndex: 5, width: 0 },
610
+ { name: "CODUSU", orderIndex: 6, width: 0 },
611
+ { name: "CODUSUALT", orderIndex: 7, width: 0 }
612
+ ]
613
+ },
614
+ form: {
615
+ emptyConfig: false,
616
+ fields: [
617
+ {
618
+ name: "DESCRICAO",
619
+ required: true
620
+ },
621
+ {
622
+ name: "TIPOAPRES",
623
+ required: true,
624
+ },
625
+ {
626
+ name: "TIPOACESSO",
627
+ required: true,
628
+ },
629
+ {
630
+ name: "LINK"
631
+ },
632
+ {
633
+ name: "NOMEARQUIVO"
634
+ }
635
+ ]
636
+ },
637
+ };
638
+
639
+ const snkAttachCss = ".snk-attach__header.sc-snk-attach{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--space--6, 6px)}.snk-attach__header.sc-snk-attach>section.sc-snk-attach{display:flex;align-items:center}.snk-attach__file-info.sc-snk-attach{display:flex;flex-direction:column;justify-content:center;gap:var(--space--8, 8px)}.snk-attach__main.sc-snk-attach{display:flex;flex-direction:column;height:100%}.ez-box__container.sc-snk-attach{height:100%}.snk-attach__crud-section.sc-snk-attach{padding:1px;display:flex;flex-direction:column;height:100%;width:100%}";
640
+
641
+ const RESOURCE_ID = 'AnexoSistema';
642
+ const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
643
+ const GRID_LEGACY_CONFIG_NAME = 'GrdCfgHtml5:grdcfg.dynaform.anexo';
644
+ const LINKORFILE_COLUMN_NAME = "ARQUIVOOULINK";
645
+ const SnkAttach = class {
646
+ constructor(hostRef) {
647
+ registerInstance(this, hostRef);
648
+ this.ezClosePopup = createEvent(this, "ezClosePopup", 7);
649
+ this.handleTaskbarClick = async ({ detail: taskbar }) => {
650
+ if (["DOWNLOAD", "LINK"].includes(taskbar))
651
+ return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());
652
+ if (this.fetcherType === "Attach" && ["SAVE"].includes(taskbar) && this._currentDataUnit.isDirty()) {
653
+ await this._currentDataUnit.setFieldValue("REGISTER_KEY", this.registerKey);
654
+ }
655
+ };
656
+ this.handleBack = () => {
657
+ this._currentDataUnit.cancelEdition().then((cancelationConfirmed) => {
658
+ if (cancelationConfirmed)
659
+ this.close();
660
+ });
661
+ };
662
+ this.handleFinish = () => {
663
+ if (!this._currentDataUnit.isDirty())
664
+ return this.close();
665
+ if (!this.validateAnexoSistema()) {
666
+ return;
667
+ }
668
+ this._currentDataUnit.saveData().then(() => {
669
+ this.showFinishedToast();
670
+ this.close();
671
+ });
672
+ };
673
+ this._isOpen = false;
674
+ this.gridLegacyConfigName = undefined;
675
+ this.fetcherType = undefined;
676
+ this.fetcher = undefined;
677
+ this.dataUnit = undefined;
678
+ this.dataUnitBuilder = undefined;
679
+ this.registerKey = undefined;
680
+ this.entityName = undefined;
681
+ this.messagesBuilder = undefined;
682
+ this._currentFetcher = undefined;
683
+ this._currentDataUnit = undefined;
684
+ this.crudConfig = undefined;
685
+ this._appResourceID = undefined;
686
+ }
687
+ // Garante que o popup só abre via método open()
688
+ // Não há mais caminhos alternativos de abertura
689
+ /**
690
+ * Abre o popup do SnkAttach.
691
+ */
692
+ /**
693
+ * Abre o popup do SnkAttach.
694
+ * Inicializa o componente apenas na abertura.
695
+ */
696
+ async open() {
697
+ this._isOpen = true;
698
+ // Inicialização só ocorre na abertura
699
+ if (!this._currentDataUnit) {
700
+ await this.initAttach();
701
+ }
702
+ if (this._refPopup) {
703
+ this._refPopup.opened = true;
704
+ }
705
+ if (!this.fetcherType) {
706
+ this.fetcherType = "AnexoSistema";
707
+ }
708
+ if (this._currentDataUnit == null) {
709
+ this.loadAttachmentDataUnit();
710
+ }
711
+ }
712
+ /**
713
+ * Fecha o popup do SnkAttach.
714
+ */
715
+ async close() {
716
+ this._isOpen = false;
717
+ if (this._refPopup) {
718
+ this._refPopup.opened = false;
719
+ }
720
+ }
721
+ async registerKeyWatcher(newRegisterKey, oldRegisterKey) {
722
+ var _a;
723
+ if (this._currentDataUnit == null) {
724
+ this.loadAttachmentDataUnit();
725
+ }
726
+ if (oldRegisterKey !== newRegisterKey) {
727
+ if (this._currentFetcher instanceof AnexoSistemaFetcher) {
728
+ this._currentFetcher.registerKey = newRegisterKey;
729
+ }
730
+ await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData());
731
+ }
732
+ }
733
+ getAnexoSistemaFetcherInstance() {
734
+ var _a;
735
+ const anexoSistemaFetcher = new AnexoSistemaFetcher(this.entityName, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
736
+ anexoSistemaFetcher.registerKey = this.registerKey;
737
+ return anexoSistemaFetcher;
738
+ }
739
+ async initAttach() {
740
+ var _a, _b, _c, _d, _e;
741
+ if (!this.fetcherType && !this.registerKey)
742
+ return;
743
+ if (!this.fetcherType) {
744
+ this.fetcherType = "AnexoSistema";
745
+ }
746
+ this.returnToGridMode();
747
+ if (this.fetcherType === "AnexoSistema") {
748
+ this._currentFetcher = this.getAnexoSistemaFetcherInstance();
749
+ (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
750
+ await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
751
+ return;
752
+ }
753
+ if (this.fetcherType === "Attach") {
754
+ const hasMoreOneItem = ((_c = this.registerKey) === null || _c === void 0 ? void 0 : _c.split("_").length) > 1;
755
+ if (hasMoreOneItem)
756
+ return;
757
+ }
758
+ await ((_d = this._currentDataUnit) === null || _d === void 0 ? void 0 : _d.loadMetadata());
759
+ await ((_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadData(undefined, undefined, true, this.registerKey));
760
+ }
761
+ /**
762
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
763
+ * através de um pequeno modulo na estrutura da aplicação:
764
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
765
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-attach.msg.ts"
766
+ */
767
+ getMessage(key, params) {
768
+ if (this.messagesBuilder)
769
+ return this.messagesBuilder.getMessage(key, params);
770
+ }
771
+ showFinishedToast() {
772
+ this._application.info(this.getMessage('snkAttach.finishedMessage'), { iconName: "check" });
773
+ }
774
+ downloadAttachment(selectedRecord) {
775
+ if (!selectedRecord)
776
+ throw new Error(this.getMessage("snkAttach.alertValidation.noRecordSelected.message"));
777
+ if (selectedRecord.LINK) {
778
+ window.open(`${selectedRecord.LINK}`);
779
+ return;
780
+ }
781
+ this._currentFetcher
782
+ .getDownloadKey(selectedRecord)
783
+ .then(({ chave }) => {
784
+ var _a;
785
+ let forceDownload = false;
786
+ if (!((_a = selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.ARQUIVO) === null || _a === void 0 ? void 0 : _a.endsWith(".pdf"))) {
787
+ forceDownload = true;
788
+ }
789
+ window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}${forceDownload ? "&forcarDownload=S" : ""}`);
790
+ });
791
+ }
792
+ returnToGridMode() {
793
+ var _a;
794
+ (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
795
+ if (this._crudElement)
796
+ this._crudElement.goToView(VIEW_MODE.GRID);
797
+ }
798
+ async loadAttachmentDataUnit() {
799
+ try {
800
+ switch (this.fetcherType) {
801
+ case "AnexoSistema":
802
+ await this.loadAnexoSistema();
803
+ break;
804
+ case "Attach":
805
+ await this.loadAttach();
806
+ break;
807
+ default:
808
+ this._currentFetcher = this.fetcher;
809
+ this._currentDataUnit = this.dataUnit;
810
+ this._currentDataUnitBuilder = this.dataUnitBuilder;
811
+ }
812
+ }
813
+ catch (error) {
814
+ throw new Error('There was an error while creating the data unit');
815
+ }
816
+ }
817
+ async loadAnexoSistema() {
818
+ var _a, _b;
819
+ this._currentDataUnit = new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
820
+ this._currentFetcher = this.getAnexoSistemaFetcherInstance();
821
+ let gridValidateForm;
822
+ if (!this._currentDataUnit.metadata) {
823
+ await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
824
+ this.crudConfig = this.entityName ? { form: anexoSistemaCrudConfig === null || anexoSistemaCrudConfig === void 0 ? void 0 : anexoSistemaCrudConfig.form } : Object.assign({}, anexoSistemaCrudConfig);
825
+ gridValidateForm = { grid: anexoSistemaCrudConfig === null || anexoSistemaCrudConfig === void 0 ? void 0 : anexoSistemaCrudConfig.grid };
826
+ }
827
+ this.initDataUnitLoaders();
828
+ this._currentDataUnit.addFilterProvider({
829
+ getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
830
+ });
831
+ this._currentDataUnit.addInterceptor({
832
+ interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
833
+ });
834
+ await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData());
835
+ this.disableEditFieldsNotInForm(gridValidateForm);
836
+ }
837
+ async loadAttach() {
838
+ var _a, _b;
839
+ this._currentFetcher = new AttachFetcher();
840
+ this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
841
+ this._currentDataUnit.pageSize = 150;
842
+ let gridValidateForm;
843
+ this.initDataUnitLoaders();
844
+ this._currentDataUnit.addInterceptor({
845
+ interceptAction: (action) => {
846
+ var _a;
847
+ if (action.type === Action.METADATA_LOADED) {
848
+ this.crudConfig = this.entityName ? { form: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.form } : Object.assign({}, attachCrudConfig);
849
+ gridValidateForm = { grid: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.grid };
850
+ (_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.updateConfig();
851
+ }
852
+ return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
853
+ }
854
+ });
855
+ if (!this._currentDataUnit.metadata) {
856
+ await ((_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata());
857
+ this.crudConfig = this.entityName ? { form: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.form } : Object.assign({}, attachCrudConfig);
858
+ gridValidateForm = { grid: attachCrudConfig === null || attachCrudConfig === void 0 ? void 0 : attachCrudConfig.grid };
859
+ await ((_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadData(undefined, undefined, true, this.registerKey));
860
+ this.disableEditFieldsNotInForm(gridValidateForm);
861
+ }
862
+ }
863
+ initDataUnitLoaders() {
864
+ var _a, _b;
865
+ if (this.fetcherType === "AnexoSistema") {
866
+ this._currentFetcher = this.getAnexoSistemaFetcherInstance();
867
+ this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
868
+ (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
869
+ }
870
+ if (this.fetcherType === "Attach") {
871
+ this._currentFetcher = new AttachFetcher();
872
+ this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
873
+ (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
874
+ this.returnToGridMode();
875
+ await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
876
+ });
877
+ }
878
+ }
879
+ disableEditFieldsNotInForm(gridValidateForm) {
880
+ var _a, _b, _c, _d, _e;
881
+ const gridColumns = ((_b = (_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.gridConfig) === null || _b === void 0 ? void 0 : _b.columns) || ((_c = gridValidateForm === null || gridValidateForm === void 0 ? void 0 : gridValidateForm.grid) === null || _c === void 0 ? void 0 : _c.columns) || ((_e = (_d = this.crudConfig) === null || _d === void 0 ? void 0 : _d.grid) === null || _e === void 0 ? void 0 : _e.columns);
882
+ if (!!this.getGridLegacyConfigName()) {
883
+ this._currentDataUnit.disableField(LINKORFILE_COLUMN_NAME);
884
+ }
885
+ gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach(column => {
886
+ var _a, _b;
887
+ const fieldName = column.name;
888
+ if (!((_b = (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form) === null || _b === void 0 ? void 0 : _b.fields.some(field => (field === null || field === void 0 ? void 0 : field.name) === fieldName))) {
889
+ this._currentDataUnit.disableField(fieldName);
890
+ }
891
+ });
892
+ }
893
+ validateAnexoSistema() {
894
+ var _a;
895
+ if (this._currentFetcher instanceof AnexoSistemaFetcher) {
896
+ try {
897
+ let fields = this._currentDataUnit.getSelectedRecord();
898
+ fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
899
+ this._currentFetcher.validateFields(fields);
900
+ }
901
+ catch (error) {
902
+ if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
903
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
904
+ return false;
905
+ }
906
+ if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
907
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
908
+ return false;
909
+ }
910
+ }
911
+ }
912
+ return true;
913
+ }
914
+ async componentWillLoad() {
915
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
916
+ if (this._application) {
917
+ this._appResourceID = await this._application.getResourceID();
918
+ }
919
+ await this.initAttach();
920
+ }
921
+ // Removido: não inicializa DataUnit no ciclo de vida, apenas na abertura
922
+ async handleOnDataStateChange({ detail }) {
923
+ if (this.fetcherType !== 'Attach')
924
+ return;
925
+ if (!detail.insertionMode) {
926
+ this._currentDataUnit.disableField('DESCRICAO');
927
+ }
928
+ else {
929
+ this._currentDataUnit.enableField('DESCRICAO');
930
+ }
931
+ await this._currentDataUnit.loadMetadata();
932
+ }
933
+ ;
934
+ isScreenVariation() {
935
+ var _a;
936
+ return !!((_a = this._appResourceID) === null || _a === void 0 ? void 0 : _a.includes('__'));
937
+ }
938
+ getGridLegacyConfigName() {
939
+ if (this.isScreenVariation()) {
940
+ return undefined;
941
+ }
942
+ if (this.gridLegacyConfigName)
943
+ return this.gridLegacyConfigName;
944
+ return this.entityName ? GRID_LEGACY_CONFIG_NAME + "." + this.entityName : this.entityName;
945
+ }
946
+ render() {
947
+ var _a, _b;
948
+ return (h("ez-popup", { ref: (el) => this._refPopup = el, size: 'x-large', ezTitle: this.getMessage("snkAttach.title"), useHeader: false, autoClose: false, onEzClosePopup: () => this.close() }, this._isOpen && this._currentDataUnit && (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("section", null, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.handleBack() }), h("div", { class: "snk-attach__file-info" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))), h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })), h("div", { class: "snk-attach__crud-section" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this), multipleSelection: true, configName: this.isScreenVariation() ? undefined : (this.entityName ? "AnexoSistema_" + this.entityName : undefined), ignoreReadOnlyFormFields: this.entityName ? true : false, gridLegacyConfigName: this.getGridLegacyConfigName(), outlineMode: true }))))));
949
+ }
950
+ static get watchers() { return {
951
+ "registerKey": ["registerKeyWatcher"]
952
+ }; }
953
+ };
954
+ SnkAttach.style = snkAttachCss;
955
+
956
+ const snkDefaultFilterCss = ".sc-snk-default-filter-h{display:flex;justify-content:flex-end}.default_container.sc-snk-default-filter{border:none;background:none;display:flex;align-items:center;gap:var(--space--3xs, 4px);font-family:var(--font-pattern);color:var(--title--primary, #2b3a54);font-size:var(--text--medium, 14px);padding:0;outline:none}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter{cursor:pointer}.default_container.sc-snk-default-filter ez-icon.sc-snk-default-filter:hover{color:var(--color--primary-600)}.new_filter.sc-snk-default-filter{cursor:pointer;margin:0 var(--space--3xs, 4px)}.new_filter.sc-snk-default-filter:hover{color:var(--color--primary-600)}";
957
+
958
+ const SnkDefaultFilter = class {
959
+ constructor(hostRef) {
960
+ registerInstance(this, hostRef);
961
+ this.actionSelected = createEvent(this, "actionSelected", 7);
962
+ this.OFFSET_HEIGHT = 5;
963
+ this.getMessage = undefined;
964
+ this.hasDefaultFilter = false;
965
+ this._opened = false;
966
+ }
967
+ repositionDropDown() {
968
+ if (!this._refIcon || !this._refDropdown) {
969
+ return;
970
+ }
971
+ const boundingIcon = this._refIcon.getBoundingClientRect();
972
+ const boundingDropDown = this._refDropdown.getBoundingClientRect();
973
+ this._refDropdown.style.top = (boundingIcon.y + boundingIcon.height + this.OFFSET_HEIGHT) + "px";
974
+ this._refDropdown.style.left = ((boundingIcon.x + (boundingIcon.width / 2)) - boundingDropDown.width) + "px";
975
+ }
976
+ toggleDropdown() {
977
+ this._opened = !this._opened;
978
+ }
979
+ closeDropdown(evt) {
980
+ const target = evt === null || evt === void 0 ? void 0 : evt.target;
981
+ if (!target) {
982
+ return;
983
+ }
984
+ if (!target.closest("#dropdown-parent-demo")) {
985
+ this._opened = false;
986
+ }
987
+ }
988
+ buildItems() {
989
+ return ([
990
+ {
991
+ id: ActionDefaultFilter.EDIT,
992
+ label: this.getMessage('defaultFilter.edit'),
993
+ },
994
+ {
995
+ id: ActionDefaultFilter.REMOVE,
996
+ label: this.getMessage('defaultFilter.remove'),
997
+ },
998
+ ]);
999
+ }
1000
+ onValueSelected({ detail: item }) {
1001
+ this._opened = false;
1002
+ this.actionSelected.emit(item.id);
1003
+ }
1004
+ openCreateNewFilter() {
1005
+ this.actionSelected.emit(ActionDefaultFilter.CREATE);
1006
+ }
1007
+ componentDidRender() {
1008
+ this.repositionDropDown();
1009
+ }
1010
+ componentWillLoad() {
1011
+ this._items = this.buildItems();
1012
+ document.removeEventListener("scroll", this.repositionDropDown.bind(this));
1013
+ document.addEventListener("scroll", this.repositionDropDown.bind(this));
1014
+ }
1015
+ render() {
1016
+ if (!this.hasDefaultFilter) {
1017
+ return (h(Host, null, h("button", { class: "default_container new_filter", onClick: this.openCreateNewFilter.bind(this) }, h("span", null, this.getMessage('defaultFilter.create')))));
1018
+ }
1019
+ return (h(Host, null, h("button", { class: "default_container", onClick: this.toggleDropdown.bind(this) }, h("span", null, this.getMessage('defaultFilter.title')), h("ez-icon", { ref: (ref) => this._refIcon = ref, iconName: 'dots-vertical' })), this._opened &&
1020
+ h("ez-dropdown", { ref: (ref) => this._refDropdown = ref, items: this._items, onEzClick: this.onValueSelected.bind(this), onEzOutsideClick: this.closeDropdown.bind(this) })));
1021
+ }
1022
+ };
1023
+ SnkDefaultFilter.style = snkDefaultFilterCss;
1024
+
1025
+ const snkDynaformFormViewCss = ".sc-snk-dynaform-form-view-h{display:flex;flex-direction:column;width:100%;flex-wrap:wrap;background-color:var(--background--xlight);padding:var(--space--12, 12px);border-radius:var(--border--radius-medium);border:1px solid var(--color--petroleum-100, #C8CCD3);--ez-form-card-summary-field-content-weight:700}ez-form-view.sc-snk-dynaform-form-view{padding:var(--space--6 ,6px) 0;--ez-form-view__item--padding:0}.level-path.sc-snk-dynaform-form-view{color:var(--color--title-primary, #2B3A54);font-weight:var(--text-weight--medium, 400);padding-right:3px}.summary-wrapper.sc-snk-dynaform-form-view{display:flex;overflow:hidden}.summary-header.sc-snk-dynaform-form-view{border-bottom:1px solid var(--color--strokes);margin-bottom:var(--space--medium);padding-bottom:var(--space--medium)}.summary-container.sc-snk-dynaform-form-view{display:flex;flex-direction:column}.summary-container.sc-snk-dynaform-form-view{padding-right:calc(var(--space--extra-large) / 1.5)}.summary-field.sc-snk-dynaform-form-view{min-width:30px;max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.summary-field__title.sc-snk-dynaform-form-view{color:var(--text--primary, #626e82);font-size:var(--title--small);white-space:nowrap;font-weight:var(--text-weight--medium)}.summary-field__content.sc-snk-dynaform-form-view{color:var(--title--primary, #2b3a54);font-size:var(--text--large);font-weight:var(--ez-form-card-summary-field-content-weight)}";
1026
+
1027
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
1028
+ var t = {};
1029
+ for (var p in s)
1030
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1031
+ t[p] = s[p];
1032
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1033
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1034
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1035
+ t[p[i]] = s[p[i]];
1036
+ }
1037
+ return t;
1038
+ };
1039
+ const SnkDynaformFormView = class {
1040
+ constructor(hostRef) {
1041
+ registerInstance(this, hostRef);
1042
+ this.snkContentCardChanged = createEvent(this, "snkContentCardChanged", 7);
1043
+ this.snkRequestClearFieldToFocus = createEvent(this, "snkRequestClearFieldToFocus", 7);
1044
+ this._customEditors = new Map();
1045
+ this._fieldProps = new Map();
1046
+ this.dataUnitObserver = async (action) => {
1047
+ var _a;
1048
+ if (action.type === Action.RECORDS_COPIED) {
1049
+ const sourcePK = this.buildSourceRecordPK(action);
1050
+ (_a = this.getImageField()) === null || _a === void 0 ? void 0 : _a.forEach(async (field) => {
1051
+ var _a;
1052
+ (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.setFieldValue(field.name, JSON.stringify(sourcePK));
1053
+ });
1054
+ }
1055
+ };
1056
+ this.customUiBuilders = new Map([
1057
+ [UserInterface.IMAGE, (_a) => {
1058
+ var { name } = _a, props = __rest(_a, ["name"]);
1059
+ return h("snk-image-input", Object.assign({ dataUnit: this.dataUnit, maxSize: Infinity, fieldName: name, entityName: this.entityPath }, props));
1060
+ }
1061
+ ]
1062
+ ]);
1063
+ this._singleColumn = false;
1064
+ this._currentFormLayout = undefined;
1065
+ this.fieldSearch = undefined;
1066
+ this.label = undefined;
1067
+ this.name = undefined;
1068
+ this.fields = undefined;
1069
+ this.formMetadata = undefined;
1070
+ this.dataUnit = undefined;
1071
+ this.recordsValidator = undefined;
1072
+ this.fieldToFocus = undefined;
1073
+ this.customEditors = undefined;
1074
+ this.fieldsProps = undefined;
1075
+ this.entityPath = undefined;
1076
+ }
1077
+ async showUp() {
1078
+ var _a, _b;
1079
+ if (this._formView) {
1080
+ (_b = (_a = this._formView).showUp) === null || _b === void 0 ? void 0 : _b.call(_a);
1081
+ }
1082
+ }
1083
+ /**
1084
+ * Registra um editor customizado para campos da grade e formulário
1085
+ */
1086
+ async addCustomEditor(fieldName, customEditor, detailContext) {
1087
+ var _a, _b;
1088
+ if (this._formView) {
1089
+ (_b = (_a = this._formView).addCustomEditor) === null || _b === void 0 ? void 0 : _b.call(_a, fieldName, customEditor, detailContext);
1090
+ return;
1091
+ }
1092
+ const newCustomEditors = new Map(this._customEditors);
1093
+ newCustomEditors.set(fieldName, { customEditor, detailContext: detailContext !== null && detailContext !== void 0 ? detailContext : "" });
1094
+ this._customEditors = newCustomEditors;
1095
+ }
1096
+ /**
1097
+ * Altera/adiciona uma propriedade nos metadados do campo.
1098
+ */
1099
+ async setFieldProp(fieldName, propName, value) {
1100
+ const props = this._fieldProps.get(fieldName) || [];
1101
+ this._fieldProps.set(fieldName, [...props, { propName, value }]);
1102
+ }
1103
+ /**
1104
+ * Exibe a busca de campos ancorada ao container de cabeçalho do snk-dynaform-form-view.
1105
+ */
1106
+ async showSearchField() {
1107
+ if (!this._headerContainer || !this._ezPopoverFieldColumn)
1108
+ return;
1109
+ const container = this._headerContainer.getBoundingClientRect();
1110
+ if (this.fieldSearch) {
1111
+ await focusOnFieldSerch(this.fieldSearch);
1112
+ this._ezPopoverFieldColumn.showUnder(this._headerContainer, { horizontalGap: container.width - (SEARCH_FIELD_FULL_WIDTH), verticalGap: container.height * -1 });
1113
+ }
1114
+ }
1115
+ observePropsCustomEditor(newValue) {
1116
+ for (const fieldName in newValue) {
1117
+ this.addCustomEditor(fieldName, newValue[fieldName]);
1118
+ }
1119
+ }
1120
+ async observeFieldsProps(newValue) {
1121
+ for (const field in newValue) {
1122
+ const fieldProps = newValue[field];
1123
+ const propNames = Object.keys(fieldProps);
1124
+ for (const propName of propNames) {
1125
+ await this.setFieldProp(field, propName, fieldProps[propName]);
1126
+ }
1127
+ }
1128
+ }
1129
+ async observeDataUnit(newValue, oldValue) {
1130
+ if (newValue !== oldValue && newValue) {
1131
+ newValue.subscribe(this.dataUnitObserver);
1132
+ }
1133
+ }
1134
+ bindFields(fields) {
1135
+ var _a;
1136
+ if (this._dataBinder == undefined && this.dataUnit != undefined) {
1137
+ this._dataBinder = new DataBinder(this.dataUnit);
1138
+ }
1139
+ if (this._dataBinder && this.dataUnit && this.formMetadata) {
1140
+ this._dataBinder.bind(fields, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.dataUnitId, this.formMetadata, this.recordsValidator);
1141
+ }
1142
+ }
1143
+ disconnectedCallback() {
1144
+ if (this._dataBinder != undefined) {
1145
+ this._dataBinder.onDisconnectedCallback();
1146
+ }
1147
+ if (this.dataUnit) {
1148
+ this.dataUnit.unsubscribe(this.dataUnitObserver);
1149
+ }
1150
+ }
1151
+ componentDidLoad() {
1152
+ if (this.customEditors) {
1153
+ this.observePropsCustomEditor(this.customEditors);
1154
+ }
1155
+ if (this.fieldsProps) {
1156
+ this.observeFieldsProps(this.fieldsProps);
1157
+ }
1158
+ this.initLayoutFormConfig();
1159
+ }
1160
+ async initLayoutFormConfig() {
1161
+ const _application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
1162
+ const layoutFormConfig = await (_application === null || _application === void 0 ? void 0 : _application.getLayoutFormConfig());
1163
+ if (layoutFormConfig) {
1164
+ this.setSingleColumn(layoutFormConfig);
1165
+ this.registerNotifyListeners(layoutFormConfig);
1166
+ }
1167
+ }
1168
+ setSingleColumn(layoutFormConfig) {
1169
+ this._singleColumn = (layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config) === FormLayout.CASCADE || (layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config) === FormLayout.CLASSIC_CASCADE;
1170
+ this._currentFormLayout = layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config;
1171
+ }
1172
+ registerNotifyListeners(layoutFormConfig) {
1173
+ var _a;
1174
+ if (!layoutFormConfig)
1175
+ return;
1176
+ (_a = layoutFormConfig.onConfigChange) === null || _a === void 0 ? void 0 : _a.call(layoutFormConfig, (config) => {
1177
+ this._singleColumn = (config === FormLayout.CASCADE || config === FormLayout.CLASSIC_CASCADE);
1178
+ this._currentFormLayout = config;
1179
+ });
1180
+ }
1181
+ componentDidRender() {
1182
+ var _a;
1183
+ this.setCustomEditors();
1184
+ this.setFieldProps();
1185
+ if (!this.fieldToFocus) {
1186
+ return;
1187
+ }
1188
+ if (!((_a = this.fields) === null || _a === void 0 ? void 0 : _a.some(item => item.name === this.fieldToFocus))) {
1189
+ return;
1190
+ }
1191
+ requestAnimationFrame(() => {
1192
+ var _a, _b;
1193
+ (_a = this._dataBinder) === null || _a === void 0 ? void 0 : _a.setFocus(this.fieldToFocus);
1194
+ (_b = this.snkRequestClearFieldToFocus) === null || _b === void 0 ? void 0 : _b.emit();
1195
+ });
1196
+ }
1197
+ setCustomEditors() {
1198
+ var _a, _b;
1199
+ if (!this._formView) {
1200
+ return;
1201
+ }
1202
+ for (const [fieldName, customEditorProps] of this._customEditors) {
1203
+ (_b = (_a = this._formView).addCustomEditor) === null || _b === void 0 ? void 0 : _b.call(_a, fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
1204
+ this._customEditors.delete(fieldName);
1205
+ }
1206
+ }
1207
+ setFieldProps() {
1208
+ if (!this._formView) {
1209
+ return;
1210
+ }
1211
+ for (const [fieldName, propsToChange] of this._fieldProps) {
1212
+ propsToChange.forEach(prop => {
1213
+ var _a, _b;
1214
+ (_b = (_a = this._formView).setFieldProp) === null || _b === void 0 ? void 0 : _b.call(_a, fieldName, prop.propName, prop.value);
1215
+ this._fieldProps.delete(fieldName);
1216
+ });
1217
+ }
1218
+ }
1219
+ buildSourceRecordPK(action) {
1220
+ var _a, _b, _c;
1221
+ const currentRecord = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a[0]) || {};
1222
+ const sourceBase64 = currentRecord["__record__source__id__"];
1223
+ const sourceRecord = JSON.parse(atob(sourceBase64 || ''));
1224
+ delete sourceRecord["__DATA_UNIT_NAME__"];
1225
+ if (!this.dataUnit) {
1226
+ return {};
1227
+ }
1228
+ const pks = (_b = getPKs(this.dataUnit)) !== null && _b !== void 0 ? _b : {};
1229
+ const pkFields = Object.keys(pks);
1230
+ const filteredSourceRecord = {};
1231
+ for (const pkField of pkFields) {
1232
+ filteredSourceRecord[pkField] = (_c = sourceRecord[pkField]) === null || _c === void 0 ? void 0 : _c.value;
1233
+ }
1234
+ return filteredSourceRecord;
1235
+ }
1236
+ getImageField() {
1237
+ var _a;
1238
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata.fields.filter(field => field.userInterface === UserInterface.IMAGE);
1239
+ }
1240
+ render() {
1241
+ return (h(Host, null, h("slot", null), h("ez-form-view", { ref: (ref) => this._formView = ref, fields: this.fields, onEzContentReady: evt => this.bindFields(evt.detail), singleColumn: this._singleColumn, customUiBuilders: this.customUiBuilders, formLayout: this._currentFormLayout }), this.fieldSearch && h("ez-popover", { ref: elem => (this._ezPopoverFieldColumn = elem), overlayType: "none" }, this.fieldSearch)));
1242
+ }
1243
+ static get watchers() { return {
1244
+ "customEditors": ["observePropsCustomEditor"],
1245
+ "fieldsProps": ["observeFieldsProps"],
1246
+ "dataUnit": ["observeDataUnit"]
1247
+ }; }
1248
+ };
1249
+ SnkDynaformFormView.style = snkDynaformFormViewCss;
1250
+
1251
+ const snkFilterAdvancedModeCss = ".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";
1252
+
1253
+ const SnkFilterAdvancedMode = class {
1254
+ constructor(hostRef) {
1255
+ registerInstance(this, hostRef);
1256
+ this.ezExpressionChange = createEvent(this, "ezExpressionChange", 7);
1257
+ this.filterAssistent = undefined;
1258
+ this.application = undefined;
1259
+ }
1260
+ getMessage(key, params) {
1261
+ return this.application.messagesBuilder.getMessage(key, params);
1262
+ }
1263
+ render() {
1264
+ var _a;
1265
+ return (h(Host, null, h("span", { class: "ez-title ez-title--small ez-padding-bottom--small snk-filter-advanced-mode__title" }, this.getMessage("snkPersonalizedFilter.info.applyExpression")), h("ez-text-area", { rows: 9, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.expression, onEzChange: (evt) => this.ezExpressionChange.emit(evt.detail) })));
1266
+ }
1267
+ };
1268
+ SnkFilterAdvancedMode.style = snkFilterAdvancedModeCss;
1269
+
1270
+ const snkFilterAssistentModeCss = ".sc-snk-filter-assistent-mode-h{display:flex;flex-direction:column;height:100%;--text-area--font-family:var(--font-pattern, Arial);--text-area__label--floating--top:var(--space--small, 6px);--snk-filter-assistent-mode__container--border-radius:var(--border--radius-medium, 12px);--snk-filter-assistent-mode__container--background:var(--background--medium, #f0f3f7);--snk-filter-assistent-mode__container--margin:var(--space--small, 6px) var(--space--medium, 12px)}.ez-box__container--external.sc-snk-filter-assistent-mode{height:100px;width:100%;overflow-y:auto;background-color:var(--snk-filter-assistent-mode__container--background);border-radius:var(--snk-filter-assistent-mode__container--border-radius)}.ez-box__container--internal.sc-snk-filter-assistent-mode{margin:var(--snk-filter-assistent-mode__container--margin)}.ez-box__container--title.sc-snk-filter-assistent-mode{display:block;user-select:none;font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--title--primary);top:var(--text-area__label--floating--top)}.ez-box__container--expression.sc-snk-filter-assistent-mode{display:block;font-family:var(--text-area--font-family);font-size:var(--text--medium);color:var(--title--primary);top:var(--text-area__label--floating--top)}.snk-personalized-filter__expression-input--line.sc-snk-filter-assistent-mode{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}";
1271
+
1272
+ const SnkFilterAssistentMode = class {
1273
+ constructor(hostRef) {
1274
+ registerInstance(this, hostRef);
1275
+ this.ezChangeFilter = createEvent(this, "ezChangeFilter", 7);
1276
+ this.filterAssistent = undefined;
1277
+ this.messagesBuilder = undefined;
1278
+ this.filterId = undefined;
1279
+ this.entityUri = undefined;
1280
+ this.application = undefined;
1281
+ this.isDefaultFilter = false;
1282
+ }
1283
+ getMessage(key, params) {
1284
+ return this.application.messagesBuilder.getMessage(key, params);
1285
+ }
1286
+ async handleFilterGroupChange() {
1287
+ const assistent = await this._mainExpressionGroup.getExpressionGroup();
1288
+ this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
1289
+ this.filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
1290
+ this.filterAssistent.expression = PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
1291
+ this.ezChangeFilter.emit(this.filterAssistent);
1292
+ }
1293
+ render() {
1294
+ var _a, _b;
1295
+ return (h(Host, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri, isDefaultFilter: this.isDefaultFilter })), h("div", { class: "ez-margin-top--auto" }, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container--external" }, h("div", { class: "ez-box__container--internal" }, h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
1296
+ }
1297
+ };
1298
+ SnkFilterAssistentMode.style = snkFilterAssistentModeCss;
1299
+
1300
+ const SnkFilterDetail = class {
1301
+ constructor(hostRef) {
1302
+ registerInstance(this, hostRef);
1303
+ this.filterChange = createEvent(this, "filterChange", 7);
1304
+ this.config = undefined;
1305
+ this.getMessage = undefined;
1306
+ this.showHardFixed = true;
1307
+ this.removalBlocked = false;
1308
+ }
1309
+ /**
1310
+ * Define o foco no campo do editor.
1311
+ */
1312
+ async setFocusField() {
1313
+ var _a, _b, _c, _d;
1314
+ if (!this._editor) {
1315
+ return;
1316
+ }
1317
+ if (this._editor["setFocus"]) {
1318
+ (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
1319
+ }
1320
+ else if (this._editor["focus"]) {
1321
+ (_d = (_c = this._editor) === null || _c === void 0 ? void 0 : _c["focus"]) === null || _d === void 0 ? void 0 : _d.call(_c);
1322
+ }
1323
+ }
1324
+ async clearValue() {
1325
+ if (!this._editor) {
1326
+ return;
1327
+ }
1328
+ if (this._editor["clearValue"]) {
1329
+ await this._editor["clearValue"]();
1330
+ }
1331
+ }
1332
+ observeConfig(newValue) {
1333
+ var _a, _b;
1334
+ this._editor && (this._editor["config"] = newValue);
1335
+ (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["reloadList"]) === null || _b === void 0 ? void 0 : _b.call(_a);
1336
+ this._customElementObject = this.getContentEditor();
1337
+ }
1338
+ componentDidLoad() {
1339
+ if (this._element) {
1340
+ ElementIDUtils.addIDInfo(this._element);
1341
+ const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1342
+ this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
1343
+ }
1344
+ }
1345
+ changeConfig(newConfig) {
1346
+ this.filterChange.emit(newConfig);
1347
+ }
1348
+ getContentEditor() {
1349
+ switch (this.config.type) {
1350
+ case FilterItemType.BINARY_SELECT:
1351
+ return { tag: "snk-filter-binary-select" };
1352
+ case FilterItemType.MULTI_SELECT:
1353
+ return { tag: "snk-filter-multi-select" };
1354
+ case FilterItemType.PERIOD:
1355
+ return { tag: "snk-filter-period" };
1356
+ case FilterItemType.SEARCH:
1357
+ return { tag: "snk-filter-search" };
1358
+ case FilterItemType.NUMBER:
1359
+ return { tag: "snk-filter-number" };
1360
+ case FilterItemType.PERSONALIZED:
1361
+ const snkFilterPersonalizedProps = {
1362
+ tag: "snk-personalized-filter-editor", props: {
1363
+ presentationMode: EPresentationMode.CHIP,
1364
+ onValueChanged: evt => this.handleValueChanged(evt),
1365
+ }
1366
+ };
1367
+ return snkFilterPersonalizedProps;
1368
+ case FilterItemType.CHECK_BOX_LIST:
1369
+ return {
1370
+ tag: "snk-filter-checkbox-list",
1371
+ props: {
1372
+ onValueChanged: evt => this.config = Object.assign(Object.assign({}, this.config), { value: evt.detail })
1373
+ }
1374
+ };
1375
+ case FilterItemType.MULTI_LIST:
1376
+ return {
1377
+ tag: "snk-entity-list",
1378
+ props: {
1379
+ onValueChanged: evt => this.config = Object.assign(Object.assign({}, this.config), { value: evt.detail })
1380
+ }
1381
+ };
1382
+ }
1383
+ return { tag: "snk-filter-text" };
1384
+ }
1385
+ handleValueChanged({ detail }) {
1386
+ const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
1387
+ this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
1388
+ }
1389
+ removeItem() {
1390
+ const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
1391
+ const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
1392
+ const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: newValue });
1393
+ if (removedConfig.groupedItems != undefined) {
1394
+ removedConfig.groupedItems = removedConfig.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined })));
1395
+ }
1396
+ this.changeConfig(removedConfig);
1397
+ }
1398
+ removeItemFromGroup(item) {
1399
+ return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
1400
+ }
1401
+ getPopUpHeaderButtons() {
1402
+ return (h(Fragment, null, !this.removalBlocked && !this.config.removalBlocked &&
1403
+ this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), this.showHardFixed && !this.config.hardFixed &&
1404
+ this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
1405
+ }
1406
+ buildIcon(title, iconName, action) {
1407
+ return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", ref: elem => elem && this.buildIdButton(elem, title) }, h("ez-icon", Object.assign({ title: title, iconName: iconName }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`_${title}`)}` }))));
1408
+ }
1409
+ buildIdButton(buttonElement, title) {
1410
+ if (!buttonElement)
1411
+ return;
1412
+ const dataElement = { id: title };
1413
+ buttonElement.removeAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1414
+ ElementIDUtils.addIDInfoIfNotExists(buttonElement, "button", dataElement);
1415
+ }
1416
+ clearBinarySelectValues() {
1417
+ var _a;
1418
+ const editor = this._editor || {};
1419
+ (_a = editor.resetValues) === null || _a === void 0 ? void 0 : _a.call(editor);
1420
+ this.config = ObjectUtils.copy(this.originalConfig);
1421
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
1422
+ }
1423
+ apply() {
1424
+ const isValid = PersonalizedFilterUtils.validateVariableValues(this.config, this._editor["value"]);
1425
+ if (!isValid) {
1426
+ return ApplicationUtils.alert(this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.title'), this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.message'));
1427
+ }
1428
+ const valuesArray = this._editor["value"] !== undefined ? this._editor["value"] : this.config.value;
1429
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: this.isVisible(), value: valuesArray }));
1430
+ }
1431
+ isVisible() {
1432
+ if (this.config.groupedItems && this.config.groupedItems.length > 0) {
1433
+ return this.config.groupedItems.filter(item => item.visible).length > 0;
1434
+ }
1435
+ return true;
1436
+ }
1437
+ clear() {
1438
+ var _a;
1439
+ if (this.config.type === FilterItemType.BINARY_SELECT) {
1440
+ this.clearBinarySelectValues();
1441
+ return;
1442
+ }
1443
+ if (FilterItemType.MULTI_LIST === this.config.type) {
1444
+ const configCopy = ObjectUtils.copy(this.config);
1445
+ (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.forEach(value => !!value && (value.check = false));
1446
+ this.config = ObjectUtils.copy(configCopy);
1447
+ return;
1448
+ }
1449
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
1450
+ }
1451
+ filterCanBeCleared() {
1452
+ return this.config.type !== FilterItemType.PERSONALIZED;
1453
+ }
1454
+ onKeyDonwListener(event) {
1455
+ if (event.key === "Enter") {
1456
+ this.apply();
1457
+ }
1458
+ }
1459
+ buildRightSlot(item) {
1460
+ return h("ez-icon", { iconName: "delete", onClick: () => this.removeValueFromConfig(item) });
1461
+ }
1462
+ removeValueFromConfig(item) {
1463
+ var _a, _b;
1464
+ if (this.config) {
1465
+ const configCopy = ObjectUtils.copy(this.config);
1466
+ const index = (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.findIndex(i => (i === null || i === void 0 ? void 0 : i.id) === item.id);
1467
+ (_b = configCopy.value) === null || _b === void 0 ? void 0 : _b.splice(index, 1);
1468
+ this.config = ObjectUtils.copy(configCopy);
1469
+ }
1470
+ }
1471
+ componentWillLoad() {
1472
+ this.originalConfig = ObjectUtils.copy(this.config);
1473
+ this._customElementObject = this.getContentEditor();
1474
+ }
1475
+ render() {
1476
+ const { tag: CustomElement, props } = this._customElementObject;
1477
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
1478
+ }
1479
+ get _element() { return getElement(this); }
1480
+ static get watchers() { return {
1481
+ "config": ["observeConfig"]
1482
+ }; }
1483
+ };
1484
+
1485
+ const snkFilterModalItemCss = ".grow{flex-grow:1}.gap{gap:4px}";
1486
+
1487
+ const SnkFilterModalItem = class {
1488
+ constructor(hostRef) {
1489
+ registerInstance(this, hostRef);
1490
+ this.filterChange = createEvent(this, "filterChange", 7);
1491
+ this.editPersonalizedFilter = createEvent(this, "editPersonalizedFilter", 7);
1492
+ this.addPersonalizedFilter = createEvent(this, "addPersonalizedFilter", 7);
1493
+ this.filterItem = undefined;
1494
+ this.configName = undefined;
1495
+ this.resourceID = undefined;
1496
+ }
1497
+ getContentEditorConfig() {
1498
+ const props = { presentationMode: EPresentationMode.MODAL };
1499
+ switch (this.filterItem.type) {
1500
+ case FilterItemType.BINARY_SELECT:
1501
+ return { tag: "snk-filter-binary-select", props };
1502
+ case FilterItemType.MULTI_SELECT:
1503
+ return { tag: "snk-filter-multi-select" };
1504
+ case FilterItemType.PERIOD:
1505
+ return { tag: "snk-filter-period", props };
1506
+ case FilterItemType.SEARCH:
1507
+ return { tag: "snk-filter-search" };
1508
+ case FilterItemType.NUMBER:
1509
+ return { tag: "snk-filter-number", props };
1510
+ case FilterItemType.PERSONALIZED:
1511
+ return this.buildSnkFilterPersonalizedProps();
1512
+ case FilterItemType.CHECK_BOX_LIST:
1513
+ return { tag: "snk-filter-checkbox-list", props };
1514
+ case FilterItemType.MULTI_LIST:
1515
+ return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
1516
+ }
1517
+ return { tag: "snk-filter-text" };
1518
+ }
1519
+ buildSnkFilterPersonalizedProps() {
1520
+ return {
1521
+ tag: "snk-personalized-filter-editor", props: {
1522
+ onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
1523
+ onAddFilter: () => this.addPersonalizedFilter.emit(),
1524
+ }
1525
+ };
1526
+ }
1527
+ isVisible(newValue) {
1528
+ return !this.filterItem.visible ? newValue !== undefined : true;
1529
+ }
1530
+ updateFilterValue(data) {
1531
+ var _a, _b;
1532
+ const newValue = (data === null || data === void 0 ? void 0 : data.value) !== undefined ? data.value : data;
1533
+ if (this.filterItem.groupedItems != undefined) {
1534
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
1535
+ }
1536
+ else {
1537
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === (FilterItemType.SEARCH || FilterItemType.CHECK_BOX_LIST) ? data : newValue, visible: this.isVisible(newValue) });
1538
+ }
1539
+ this._editor && (this._editor["config"] = this.filterItem);
1540
+ (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
1541
+ this.filterChange.emit(this.filterItem);
1542
+ }
1543
+ handleDeleteFilter(filter, filterItemType) {
1544
+ if (filterItemType === FilterItemType.PERSONALIZED) {
1545
+ ConfigStorage.removePersonalizedFilter(filter, this.resourceID, this.configName);
1546
+ }
1547
+ }
1548
+ componentDidLoad() {
1549
+ if (this._element) {
1550
+ ElementIDUtils.addIDInfo(this._element);
1551
+ const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1552
+ this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
1553
+ }
1554
+ }
1555
+ buildRightSlot(item) {
1556
+ return (h("ez-icon", { iconName: "delete", onClick: () => this.removeValueFromConfig(item) }));
1557
+ }
1558
+ removeValueFromConfig(item) {
1559
+ var _a, _b, _c;
1560
+ const index = (_b = (_a = this.filterItem) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.findIndex(({ id }) => id === item.id);
1561
+ const filterItemCopy = ObjectUtils.copy(this.filterItem);
1562
+ (_c = filterItemCopy === null || filterItemCopy === void 0 ? void 0 : filterItemCopy.value) === null || _c === void 0 ? void 0 : _c.splice(index, 1);
1563
+ this.updateFilterValue(filterItemCopy.value);
1564
+ }
1565
+ canShowDetailModal() {
1566
+ const { CUSTOM_FILTER, OTHER_FILTERS } = FilterType;
1567
+ return ![CUSTOM_FILTER, OTHER_FILTERS].includes(this.filterItem.filterType) && this.filterItem.type !== FilterItemType.BINARY_SELECT;
1568
+ }
1569
+ render() {
1570
+ const { tag: ContentEditor, props } = this.getContentEditorConfig();
1571
+ return (h(Host, null, h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin-bottom--extra-small", htmlFor: `filter-item-${this.filterItem.id}` }, this.filterItem.detailModal)), h(ContentEditor, Object.assign({ ref: ref => this._editor = ref, id: `filter-item-${this.filterItem.id}`, config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, props)))));
1572
+ }
1573
+ get _element() { return getElement(this); }
1574
+ };
1575
+ SnkFilterModalItem.style = snkFilterModalItemCss;
1576
+
1577
+ const snkImageInputCss = ":host{display:block}";
1578
+
1579
+ const SnkImageInput = class {
1580
+ constructor(hostRef) {
1581
+ registerInstance(this, hostRef);
1582
+ this.imageError = createEvent(this, "imageError", 7);
1583
+ this.dataUnitObserver = async (action) => {
1584
+ var _a;
1585
+ const actionsMoveSelection = [Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
1586
+ if (actionsMoveSelection.includes(action.type)) {
1587
+ await this.loadImage();
1588
+ return;
1589
+ }
1590
+ const selection = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.selection) || [];
1591
+ if (action.type === Action.SELECTION_CHANGED && selection.length > 0) {
1592
+ await this.loadImage();
1593
+ return;
1594
+ }
1595
+ if (action.type === Action.RECORDS_ADDED) {
1596
+ await this.clearImage();
1597
+ return;
1598
+ }
1599
+ if (action.type === Action.EDITION_CANCELED) {
1600
+ await this.loadImage();
1601
+ return;
1602
+ }
1603
+ };
1604
+ this.dataUnit = undefined;
1605
+ this.fieldName = undefined;
1606
+ this.entityName = undefined;
1607
+ this.enabled = true;
1608
+ this.acceptType = undefined;
1609
+ this.maxSize = undefined;
1610
+ this.label = undefined;
1611
+ this.imageValue = undefined;
1612
+ this.loading = true;
1613
+ }
1614
+ /**
1615
+ * Força o reload da imagem
1616
+ */
1617
+ async reloadImage(pks) {
1618
+ await this.loadImage(pks);
1619
+ }
1620
+ getMessage(key, params) {
1621
+ if (!this.messagesBuilder) {
1622
+ this.messagesBuilder = new SnkMessageBuilder();
1623
+ }
1624
+ return this.messagesBuilder.getMessage(key, params);
1625
+ }
1626
+ async clearImage() {
1627
+ var _a;
1628
+ (_a = this._loadAbortController) === null || _a === void 0 ? void 0 : _a.abort();
1629
+ this.imageValue = undefined;
1630
+ }
1631
+ async handleImageChange(event) {
1632
+ const base64 = event.detail;
1633
+ if (!base64) {
1634
+ await this.clearImage();
1635
+ await this.updatedataUnitField(true);
1636
+ return;
1637
+ }
1638
+ const blob = await base64ToBlob(base64);
1639
+ if (this.maxSize && blob.size > this.maxSize * 1024) {
1640
+ const errorMsg = this.getMessage('snkImageInput.errorImageSize') + this.maxSize + '(KB)';
1641
+ this.imageError.emit(errorMsg);
1642
+ if (this.application) {
1643
+ await this.application.error(this.getMessage('snkImageInput.errorTitle'), errorMsg);
1644
+ }
1645
+ return;
1646
+ }
1647
+ this.imageValue = base64;
1648
+ await sessionFileUpload(blob, this.entityName, this.fieldName);
1649
+ await this.updatedataUnitField();
1650
+ }
1651
+ async updatedataUnitField(deleted = false) {
1652
+ if (!this.dataUnit || !this.dataUnit.getSelectedRecord()) {
1653
+ return;
1654
+ }
1655
+ if (deleted) {
1656
+ await this.dataUnit.setFieldValue(this.fieldName, 'deletado');
1657
+ }
1658
+ else {
1659
+ await this.dataUnit.setFieldValue(this.fieldName, `$file.session.key{${buildFileKey(this.entityName, this.fieldName)}}`);
1660
+ }
1661
+ }
1662
+ async handleImageError(event) {
1663
+ this.imageError.emit(event.detail);
1664
+ if (this.application) {
1665
+ await this.application.error(this.getMessage('snkImageInput.errorTitle'), event.detail);
1666
+ }
1667
+ }
1668
+ getPksFromDataUnit() {
1669
+ if (!this.dataUnit) {
1670
+ return undefined;
1671
+ }
1672
+ const selectedRecord = this.dataUnit.getSelectedRecord();
1673
+ if (!selectedRecord) {
1674
+ return undefined;
1675
+ }
1676
+ const fieldValue = selectedRecord[this.fieldName];
1677
+ if (!fieldValue) {
1678
+ return undefined;
1679
+ }
1680
+ try {
1681
+ const pk = JSON.parse(fieldValue);
1682
+ return pk;
1683
+ }
1684
+ catch (error) {
1685
+ console.error('Error parsing PK from data unit field:', error);
1686
+ return undefined;
1687
+ }
1688
+ }
1689
+ async loadImage(pks) {
1690
+ var _a, _b;
1691
+ (_a = this._loadAbortController) === null || _a === void 0 ? void 0 : _a.abort();
1692
+ const controller = new AbortController();
1693
+ this._loadAbortController = controller;
1694
+ this.loading = true;
1695
+ if (this.dataUnit && this.entityName) {
1696
+ pks = (_b = pks !== null && pks !== void 0 ? pks : this.getPksFromDataUnit()) !== null && _b !== void 0 ? _b : getPKs(this.dataUnit);
1697
+ const image = await downloadImage(pks, this.fieldName, this.entityName, controller.signal);
1698
+ if (controller.signal.aborted)
1699
+ return;
1700
+ this.imageValue = image;
1701
+ }
1702
+ this.loading = false;
1703
+ }
1704
+ async componentWillLoad() {
1705
+ this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
1706
+ if (!this.messagesBuilder) {
1707
+ this.messagesBuilder = new SnkMessageBuilder();
1708
+ }
1709
+ if (this.dataUnit) {
1710
+ this.dataUnit.subscribe(this.dataUnitObserver);
1711
+ }
1712
+ }
1713
+ disconnectedCallback() {
1714
+ if (this.dataUnit) {
1715
+ this.dataUnit.unsubscribe(this.dataUnitObserver);
1716
+ }
1717
+ }
1718
+ async componentDidLoad() {
1719
+ await this.loadImage();
1720
+ }
1721
+ render() {
1722
+ return (h(Host, null, h("ez-image-input", { enabled: this.enabled, label: this.label, name: this.fieldName, value: this.imageValue, maxFileSize: this.maxSize ? this.maxSize * 1024 : undefined, accept: this.acceptType || 'image/png,image/jpeg,image/gif', onEzChange: (e) => this.handleImageChange(e), onEzError: (e) => this.handleImageError(e), loading: this.loading })));
1723
+ }
1724
+ };
1725
+ SnkImageInput.style = snkImageInputCss;
1726
+
1727
+ const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";
1728
+
1729
+ const SnkPersonalizedFilter = class {
1730
+ constructor(hostRef) {
1731
+ registerInstance(this, hostRef);
1732
+ this.ezCancel = createEvent(this, "ezCancel", 7);
1733
+ this.ezSave = createEvent(this, "ezSave", 7);
1734
+ this.ezAfterSave = createEvent(this, "ezAfterSave", 7);
1735
+ this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
1736
+ this._filterMetadataStorage = new Map();
1737
+ this._dataSourceFetcher = {
1738
+ fetchData: async (entity) => {
1739
+ let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
1740
+ if (StringUtils.isEmpty(entityURI)) {
1741
+ entityURI = this.entityUri;
1742
+ }
1743
+ if (!this._filterMetadataStorage.has(entityURI)) {
1744
+ const filterMetadata = await this._personalizedFilterFetcher.loadFields(entityURI);
1745
+ this._filterMetadataStorage.set(entityURI, filterMetadata);
1746
+ }
1747
+ return this._filterMetadataStorage.get(entityURI);
1748
+ }
1749
+ };
1750
+ this._filterAssistentMode = true;
1751
+ this._filterAssistent = undefined;
1752
+ this.messagesBuilder = undefined;
1753
+ this.entityUri = undefined;
1754
+ this.filterId = undefined;
1755
+ this.configName = undefined;
1756
+ this.resourceID = undefined;
1757
+ this.isDefaultFilter = false;
1758
+ }
1759
+ /**
1760
+ * Cria um novo filtro personalizado caso não exista nenhum.
1761
+ * @method
1762
+ * @returns {Promise<void>}
1763
+ */
1764
+ async createPersonalizedFilter() {
1765
+ const newPersonalizedFilter = {
1766
+ name: "",
1767
+ active: true,
1768
+ expression: "",
1769
+ parameters: [],
1770
+ assistent: {
1771
+ id: StringUtils.generateUUID(),
1772
+ items: [
1773
+ {
1774
+ id: StringUtils.generateUUID(),
1775
+ entityName: "",
1776
+ fieldName: "",
1777
+ description: "",
1778
+ fieldLabel: this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),
1779
+ type: undefined,
1780
+ expression: undefined,
1781
+ operand: undefined,
1782
+ paramVariable: false,
1783
+ value: undefined,
1784
+ systemConfig: null,
1785
+ userConfig: null
1786
+ }
1787
+ ],
1788
+ childrenGroups: [],
1789
+ operand: FilterGroupCondition.AND
1790
+ }
1791
+ };
1792
+ if (this.isDefaultFilter) {
1793
+ this.buildDataDefaultFilter(newPersonalizedFilter);
1794
+ }
1795
+ this._originalFilterAssistent = ObjectUtils.copy(newPersonalizedFilter);
1796
+ this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
1797
+ }
1798
+ /**
1799
+ * Carrega o filtro personalizado com base no identificador informado.
1800
+ * @watch filterId
1801
+ * @param newValue Novo valor do filtroId.
1802
+ * @param oldValue Valor anterior do filtroId.
1803
+ */
1804
+ loadFilter(newValue, oldValue) {
1805
+ if (newValue == null || oldValue == newValue || this.resourceID == undefined) {
1806
+ return;
1807
+ }
1808
+ if (newValue === DefaultFilter.id) {
1809
+ ConfigStorage.loadDefaultFilter(newValue, this.resourceID, this.configName)
1810
+ .then((resp) => {
1811
+ const personalizedFilter = this.applyDefaultValues(resp);
1812
+ this._filterAssistent = personalizedFilter;
1813
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
1814
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
1815
+ });
1816
+ return;
1817
+ }
1818
+ ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
1819
+ .then((resp) => {
1820
+ const personalizedFilter = this.applyDefaultValues(resp);
1821
+ this._filterAssistent = personalizedFilter;
1822
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
1823
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
1824
+ });
1825
+ }
1826
+ componentWillLoad() {
1827
+ var _a;
1828
+ if (store.get(`filterFieldsDataSource.${this.entityUri}`) == undefined) {
1829
+ store.set(`filterFieldsDataSource.${this.entityUri}`, this._dataSourceFetcher);
1830
+ }
1831
+ if (!this.messagesBuilder) {
1832
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
1833
+ this.messagesBuilder = (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder;
1834
+ }
1835
+ this.loadFilter(this.filterId, undefined);
1836
+ }
1837
+ componentDidRender() {
1838
+ var _a;
1839
+ (_a = this._viewStackRef) === null || _a === void 0 ? void 0 : _a.show(this._filterAssistentMode ? 0 : 1);
1840
+ if (this._elButtonMode) {
1841
+ this._elButtonMode.setAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME, ElementIDUtils.getInternalIDInfo(`${this._filterAssistentMode ? "advancedMode_ezButton" : "assistentMode_ezButton"}`));
1842
+ }
1843
+ }
1844
+ buildDataDefaultFilter(data) {
1845
+ data.name = DefaultFilter.name;
1846
+ data.id = DefaultFilter.id;
1847
+ }
1848
+ getMessage(key, params) {
1849
+ return this._application.messagesBuilder.getMessage(key, params);
1850
+ }
1851
+ async saveFilter() {
1852
+ let response;
1853
+ if (this.isDefaultFilter) {
1854
+ response = await ConfigStorage.saveDefaultFilter(this._filterAssistent, this.resourceID, this.configName);
1855
+ }
1856
+ else {
1857
+ response = await ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
1858
+ }
1859
+ this._elButtonSave.enabled = false;
1860
+ const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
1861
+ ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
1862
+ const updatedFilterAssistent = Object.assign(Object.assign({}, response), this._filterAssistent);
1863
+ updatedFilterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
1864
+ this._originalFilterAssistent = ObjectUtils.copy(updatedFilterAssistent);
1865
+ this._filterAssistent = ObjectUtils.copy(updatedFilterAssistent);
1866
+ this.ezAfterSave.emit();
1867
+ }
1868
+ removeFilter() {
1869
+ ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
1870
+ }
1871
+ hasChangesToSave() {
1872
+ return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
1873
+ }
1874
+ async handleSave() {
1875
+ if (this._filterAssistentMode) {
1876
+ const isValid = PersonalizedFilterUtils.validateFields(this._filterAssistent.assistent);
1877
+ if (!isValid || !this._filterAssistent.name)
1878
+ return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
1879
+ this.saveAssistentMode();
1880
+ }
1881
+ else {
1882
+ if (!this._filterAssistent.expression || !this._filterAssistent.name)
1883
+ return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
1884
+ const isValidExpressionForAdvancedMode = await this.validateExpressionBeforeSaving();
1885
+ if (!isValidExpressionForAdvancedMode)
1886
+ return;
1887
+ this.saveAdvancedMode();
1888
+ }
1889
+ }
1890
+ saveAssistentMode() {
1891
+ const { assistent, expression } = this._filterAssistent;
1892
+ const expressionQuery = !!assistent ? PersonalizedFilterUtils.buildGroupExpression(assistent) : expression;
1893
+ this._filterAssistent.expression = expressionQuery;
1894
+ this.ezSave.emit(expressionQuery);
1895
+ this.saveFilter();
1896
+ }
1897
+ saveAdvancedMode() {
1898
+ if (this._originalFilterAssistent.expression !== this._filterAssistent.expression && this._filterAssistent.assistent) {
1899
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"), this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description"))
1900
+ .then((confirm) => {
1901
+ if (!confirm)
1902
+ return;
1903
+ this.saveAndTransformToAdvancedMode();
1904
+ });
1905
+ }
1906
+ else if (!this._filterAssistent.assistent) {
1907
+ this.saveAndTransformToAdvancedMode();
1908
+ }
1909
+ else {
1910
+ this.saveAssistentMode();
1911
+ }
1912
+ }
1913
+ saveAndTransformToAdvancedMode() {
1914
+ this._filterAssistent.assistent = undefined;
1915
+ this.ezSave.emit(this._filterAssistent.expression);
1916
+ this.saveFilter();
1917
+ }
1918
+ async validateExpressionBeforeSaving() {
1919
+ const { valid, message = "" } = await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri, this._filterAssistent.expression);
1920
+ valid || this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"), message.replace(/.*Exception: /, ''));
1921
+ return valid;
1922
+ }
1923
+ handleCancel() {
1924
+ if (this.hasChangesToSave()) {
1925
+ return this.ezCancel.emit();
1926
+ }
1927
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"), this.getMessage("snkPersonalizedFilter.confirmCancel.description"))
1928
+ .then((canCancel) => {
1929
+ var _a;
1930
+ if (!canCancel)
1931
+ return;
1932
+ this._filterAssistent = ObjectUtils.copy((_a = this._originalFilterAssistent) !== null && _a !== void 0 ? _a : {});
1933
+ this.ezCancel.emit();
1934
+ this._elButtonSave.enabled = false;
1935
+ });
1936
+ }
1937
+ handleTitleChange(name) {
1938
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { name });
1939
+ this._elButtonSave.enabled = !this.hasChangesToSave();
1940
+ }
1941
+ applyDefaultValues(personalizedFilter) {
1942
+ this.addLabelToItems(personalizedFilter);
1943
+ this.addFilterGroupCondition(personalizedFilter);
1944
+ return personalizedFilter;
1945
+ }
1946
+ addFilterGroupCondition(personalizedFilter) {
1947
+ if (personalizedFilter.assistent && !personalizedFilter.assistent.operand) {
1948
+ personalizedFilter.assistent.operand = FilterGroupCondition.AND;
1949
+ }
1950
+ }
1951
+ ;
1952
+ addLabelToItems(personalizedFilter) {
1953
+ //Workaround: Alguns filtros foram salvos sem o fieldLabel. Para evitar transtornos
1954
+ //tentamos usar o fieldLabel que pode estar informado no parametro.
1955
+ if (personalizedFilter.assistent && personalizedFilter.assistent.items && personalizedFilter.assistent.items.length > 0) {
1956
+ personalizedFilter.assistent.items.forEach(item => {
1957
+ if (item.fieldLabel == undefined) {
1958
+ const param = (personalizedFilter.parameters || []).find(param => param.fieldName === item.fieldName);
1959
+ if (param) {
1960
+ item.fieldLabel = param.label;
1961
+ }
1962
+ }
1963
+ });
1964
+ }
1965
+ }
1966
+ handleExpressionChangeAdvancedMode(expression) {
1967
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
1968
+ this._elButtonSave.enabled = !this.hasChangesToSave();
1969
+ }
1970
+ handleChangeFilterAssistentMode(filterAssistent) {
1971
+ this._elButtonSave.enabled = !this.hasChangesToSave();
1972
+ this._filterAssistent = Object.assign({}, filterAssistent);
1973
+ }
1974
+ selectField(fieldName) {
1975
+ if (!('name' in fieldName))
1976
+ return;
1977
+ const fieldExpression = this.buildExpression(fieldName.entityName, fieldName.name, fieldName.entityPath);
1978
+ const textAreaElement = this._elAdvancedMode.querySelector('ez-text-area');
1979
+ textAreaElement.appendTextToSelection(fieldExpression);
1980
+ }
1981
+ buildExpression(entityName, fieldName, entityPath) {
1982
+ if (entityPath.length > 0) {
1983
+ entityPath.shift();
1984
+ }
1985
+ return entityPath.length > 0 ? `${entityPath.join("->")}->${fieldName}` : `${entityName}.${fieldName}`;
1986
+ }
1987
+ onAddField(target) {
1988
+ const textAreaElement = this._elAdvancedMode.querySelector('ez-text-area');
1989
+ const options = { horizontalGap: 0, verticalGap: 12, fromRight: true };
1990
+ textAreaElement.setFocus();
1991
+ target.setBlur();
1992
+ if (this._elFilterFieldSearch)
1993
+ this._elFilterFieldSearch.show(target, options);
1994
+ }
1995
+ renderButtonAddField() {
1996
+ if (this._filterAssistentMode)
1997
+ return;
1998
+ return (h(Fragment, null, h("ez-button", { class: "snk-personalized-filter__button-mode", label: this.getMessage("snkPersonalizedFilter.info.addField"), enabled: true, onClick: (evt) => this.onAddField(evt.target) }, h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: "plus" })), h("snk-filter-field-search", { class: "ez-padding-left--medium", ref: ref => this._elFilterFieldSearch = ref, onEzSelectFilterItem: (evt) => this.selectField(evt.detail), fieldsDataSource: this._dataSourceFetcher })));
1999
+ }
2000
+ buildContainerPersonalizedFilter() {
2001
+ return (h("ez-view-stack", { ref: (ref) => this._viewStackRef = ref }, h("stack-item", null, this._filterAssistentMode &&
2002
+ h("snk-filter-assistent-mode", { filterAssistent: this._filterAssistent, messagesBuilder: this.messagesBuilder, filterId: this.filterId, entityUri: this.entityUri, application: this._application, onEzChangeFilter: (ev) => this.handleChangeFilterAssistentMode(ev.detail), isDefaultFilter: this.isDefaultFilter })), h("stack-item", null, h("snk-filter-advanced-mode", { ref: (ref) => this._elAdvancedMode = ref, filterAssistent: this._filterAssistent, application: this._application, onEzExpressionChange: (ev) => this.handleExpressionChangeAdvancedMode(ev.detail) }))));
2003
+ }
2004
+ handleModeChange() {
2005
+ var _a, _b;
2006
+ if (this._filterAssistentMode) {
2007
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"), this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description"))
2008
+ .then((canCancel) => {
2009
+ if (!canCancel)
2010
+ return;
2011
+ this._filterAssistentMode = !this._filterAssistentMode;
2012
+ if (!this.hasChangesToSave()) {
2013
+ const expression = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent);
2014
+ this._filterAssistent.expression = expression;
2015
+ this._elButtonSave.enabled = !this.hasChangesToSave();
2016
+ }
2017
+ });
2018
+ }
2019
+ else {
2020
+ if (((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.expression) === ((_b = this._originalFilterAssistent) === null || _b === void 0 ? void 0 : _b.expression)) {
2021
+ this._filterAssistentMode = !this._filterAssistentMode;
2022
+ }
2023
+ else {
2024
+ const expressionBefore = this._filterAssistent.expression;
2025
+ const expression = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent);
2026
+ if (expressionBefore !== expression) {
2027
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"), this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description"))
2028
+ .then((canCancel) => {
2029
+ if (!canCancel)
2030
+ return;
2031
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
2032
+ this._filterAssistentMode = !this._filterAssistentMode;
2033
+ });
2034
+ }
2035
+ else {
2036
+ this._filterAssistentMode = !this._filterAssistentMode;
2037
+ }
2038
+ }
2039
+ }
2040
+ }
2041
+ buildTitle() {
2042
+ if (this.isDefaultFilter && !this.filterId) {
2043
+ return this.getMessage("snkPersonalizedFilter.info.titleCreateDefault");
2044
+ }
2045
+ if (this.isDefaultFilter && this.filterId) {
2046
+ return this.getMessage("snkPersonalizedFilter.info.titleEditDefault");
2047
+ }
2048
+ if (this.filterId) {
2049
+ return this.getMessage("snkPersonalizedFilter.info.titleEdit");
2050
+ }
2051
+ return this.getMessage("snkPersonalizedFilter.info.titleAdd");
2052
+ }
2053
+ render() {
2054
+ var _a, _b, _c, _d;
2055
+ if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
2056
+ return;
2057
+ }
2058
+ return (h(Host, null, h("div", { class: "snk-personalized-filter" }, h("div", null, h("snk-simple-bar", { label: this.buildTitle(), onExit: () => this.handleCancel() }, h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, h("ez-button", { label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), h("ez-button", { ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, h("div", { class: "ez-box__container" }, h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("div", { class: "ez-flex" }, h("ez-tooltip", { message: this.getMessage("snkPersonalizedFilter.info.textInputDisabled"), active: this.isDefaultFilter }, h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail), enabled: !this.isDefaultFilter })), this.renderButtonAddField(), h("ez-button", { ref: (el) => this._elButtonMode = el, class: "snk-personalized-filter__button-mode", label: this._filterAssistentMode ? this.getMessage("snkPersonalizedFilter.info.activeModeAdvanced") : this.getMessage("snkPersonalizedFilter.info.activeModeAssistent"), onClick: () => this.handleModeChange(), "data-tooltip": !(this._filterAssistentMode || ((_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.assistent)) ? this.getMessage("snkPersonalizedFilter.info.tooltipDisabledAssistentMode") : undefined, "data-flow": "bottom", enabled: (!this._filterAssistent.name || Boolean(this._filterAssistentMode || ((_d = this._filterAssistent) === null || _d === void 0 ? void 0 : _d.assistent))) })), this.buildContainerPersonalizedFilter()))))));
2059
+ }
2060
+ static get watchers() { return {
2061
+ "filterId": ["loadFilter"]
2062
+ }; }
2063
+ };
2064
+ SnkPersonalizedFilter.style = snkPersonalizedFilterCss;
2065
+
2066
+ const snkSimpleBarCss = ".sc-snk-simple-bar-h{display:flex;height:100%;width:100%}.simple-bar__container.sc-snk-simple-bar{flex:1;display:flex;align-items:stretch;gap:var(--space--small)}.simple-bar__left-slot.sc-snk-simple-bar{min-width:280px;flex:1;display:flex;align-items:center}.simple-bar__right-slot.sc-snk-simple-bar{flex:1;display:flex;align-items:center;justify-content:flex-end}.simple-bar__column.sc-snk-simple-bar{flex:1;display:flex;flex-direction:column}";
2067
+
2068
+ const SnkSimpleBar = class {
2069
+ constructor(hostRef) {
2070
+ registerInstance(this, hostRef);
2071
+ this.clickBreadcrumbItem = createEvent(this, "clickBreadcrumbItem", 3);
2072
+ this.exit = createEvent(this, "exit", 3);
2073
+ this.label = undefined;
2074
+ this.breadcrumbItens = undefined;
2075
+ this.messagesBuilder = undefined;
2076
+ }
2077
+ /**
2078
+ * Permite customizar as mensagens dos blocos de construção
2079
+ * através de um pequeno módulo na estrutura da aplicação:
2080
+ * - Crie um arquivo no seguinte caminho: /messages/appmessages.msg.js.
2081
+ * Para conhecer os detalhes do módulo, veja o arquivo neste projeto: "/src/lib/message/resources/snk-simple-bar.msg.ts"
2082
+ */
2083
+ getMessage(key, params) {
2084
+ var _a;
2085
+ if (this.messagesBuilder)
2086
+ return this.messagesBuilder.getMessage(key, params);
2087
+ if ((_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder)
2088
+ return this._application.messagesBuilder.getMessage(key, params);
2089
+ }
2090
+ componentDidLoad() {
2091
+ if (!this._element)
2092
+ return;
2093
+ ElementIDUtils.addIDInfo(this._element);
2094
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
2095
+ }
2096
+ render() {
2097
+ return (h("div", { class: "simple-bar__container ez-margin-vertical--small ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
2098
+ }
2099
+ get _element() { return getElement(this); }
2100
+ };
2101
+ SnkSimpleBar.style = snkSimpleBarCss;
2102
+
2103
+ const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
2104
+ const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
2105
+
2106
+ const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid__container--shadow--outline:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
2107
+
2108
+ const SnkSimpleCrud = class {
2109
+ constructor(hostRef) {
2110
+ registerInstance(this, hostRef);
2111
+ this.dataStateChange = createEvent(this, "dataStateChange", 3);
2112
+ this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
2113
+ this.actionClick = createEvent(this, "actionClick", 7);
2114
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
2115
+ this.configuratorSave = createEvent(this, "configuratorSave", 7);
2116
+ this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
2117
+ this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
2118
+ this._formConfigFetcher = new FormConfigFetcher();
2119
+ this._customEditors = new Map();
2120
+ this._customRenders = new Map();
2121
+ this._container = undefined;
2122
+ this._showPopUpGridConfig = false;
2123
+ this._currentViewMode = VIEW_MODE.GRID;
2124
+ this._config = undefined;
2125
+ this._fieldToGetFocus = undefined;
2126
+ this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
2127
+ this.enableLockManagerLoadingComp = false;
2128
+ this.enableLockManagerTaskbarClick = false;
2129
+ this.dataState = undefined;
2130
+ this.dataUnit = undefined;
2131
+ this.entityName = undefined;
2132
+ this.mode = SIMPLE_CRUD_MODE.SERVER;
2133
+ this.gridConfig = undefined;
2134
+ this.formConfig = undefined;
2135
+ this._formFields = [];
2136
+ this._fieldsProps = new Map();
2137
+ this.enableContinuousInsert = false;
2138
+ this.multipleSelection = undefined;
2139
+ this.useCancelConfirm = true;
2140
+ this.pageSize = 150;
2141
+ this.resourceID = undefined;
2142
+ this.enableGridInsert = false;
2143
+ this.paginationCounterMode = 'auto';
2144
+ this.taskbarManager = undefined;
2145
+ this.messagesBuilder = undefined;
2146
+ this.useEnterLikeTab = false;
2147
+ this.actionsList = undefined;
2148
+ this.configName = undefined;
2149
+ this.showConfiguratorButtons = false;
2150
+ this.gridLegacyConfigName = undefined;
2151
+ this.formLegacyConfigName = undefined;
2152
+ this.ignoreReadOnlyFormFields = false;
2153
+ this.autoFocus = true;
2154
+ this.domainMessagesBuilder = undefined;
2155
+ this.multipleEditionEnabled = true;
2156
+ this.layoutFormConfig = true;
2157
+ this.disableGridEdition = false;
2158
+ this.autoLoad = undefined;
2159
+ this.outlineMode = false;
2160
+ }
2161
+ /**
2162
+ * @description Registra um editor customizado para campos da grade e do formulário.
2163
+ * @param {string} fieldName - O nome do campo.
2164
+ * @param {ICustomEditor} customEditor - A instância do editor customizado.
2165
+ * @returns {Promise<void>}
2166
+ */
2167
+ async addCustomEditor(fieldName, customEditor) {
2168
+ if (this._grid && this._form) {
2169
+ this._grid.addCustomEditor(fieldName, customEditor);
2170
+ this._form.addCustomEditor(fieldName, customEditor);
2171
+ return;
2172
+ }
2173
+ const newCustomEditors = new Map(this._customEditors);
2174
+ newCustomEditors.set(fieldName, customEditor);
2175
+ this._customEditors = newCustomEditors;
2176
+ }
2177
+ /**
2178
+ * @description Registra um renderizador customizado para colunas da grade.
2179
+ * @param {string} fieldName - O nome do campo.
2180
+ * @param {ICustomRender} customRender - A instância do renderizador customizado.
2181
+ * @returns {Promise<void>}
2182
+ */
2183
+ async addGridCustomRender(fieldName, customRender) {
2184
+ if (this._grid) {
2185
+ this._grid.addGridCustomRender(fieldName, customRender);
2186
+ return;
2187
+ }
2188
+ const newCustomRenders = new Map(this._customRenders);
2189
+ newCustomRenders.set(fieldName, customRender);
2190
+ this._customRenders = newCustomRenders;
2191
+ }
2192
+ async handleResourceIDChanged(newValue, oldValue) {
2193
+ if (StringUtils.isEmpty(newValue)) {
2194
+ return;
2195
+ }
2196
+ if (newValue === oldValue) {
2197
+ return;
2198
+ }
2199
+ await this.loadFormConfig(true);
2200
+ await this.loadGridConfig(true);
2201
+ }
2202
+ /**
2203
+ * @description Registra um formatador de valores para uma coluna da grade.
2204
+ * @param {string} columnName - O nome da coluna.
2205
+ * @param {ICustomFormatter} customFormatter - A instância do formatador customizado.
2206
+ * @returns {Promise<void>}
2207
+ */
2208
+ async addCustomValueFormatter(columnName, customFormatter) {
2209
+ this._grid.addCustomValueFormatter(columnName, customFormatter);
2210
+ }
2211
+ /**
2212
+ * @description Remove o formatador de valores de uma coluna da grade.
2213
+ * @param {string} columnName - O nome da coluna.
2214
+ * @returns {Promise<void>}
2215
+ */
2216
+ async removeCustomValueFormatter(columnName) {
2217
+ this._grid.removeCustomValueFormatter(columnName);
2218
+ }
2219
+ /**
2220
+ * @description Altera/adiciona uma propriedade nos metadados do campo.
2221
+ * @param {string} fieldName - O nome do campo.
2222
+ * @param {string} propName - O nome da propriedade.
2223
+ * @param {any} value - O valor da propriedade.
2224
+ * @returns {Promise<void>}
2225
+ */
2226
+ async setFieldProp(fieldName, propName, value) {
2227
+ const newCustomFieldProps = new Map(this._fieldsProps);
2228
+ const currentProps = this._fieldsProps.get(fieldName);
2229
+ newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
2230
+ this._fieldsProps = newCustomFieldProps;
2231
+ }
2232
+ loadTaskbarProcessor() {
2233
+ const taskbarIDs = {};
2234
+ taskbarIDs[TASKBAR_ID.FORM_REGULAR] = this.getButtons(false, [TaskbarElement.GRID_MODE], true);
2235
+ taskbarIDs[TASKBAR_ID.GRID_REGULAR] = this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
2236
+ taskbarIDs[TASKBAR_ID.FORM_SELECTED] = this.getButtons(true, [TaskbarElement.GRID_MODE], true);
2237
+ taskbarIDs[TASKBAR_ID.GRID_SELECTED] = this.getGridSelectedButtonsCallBack.bind(this);
2238
+ taskbarIDs[TASKBAR_ID.FINISH_EDITION] = this.getFinishEditionButtonsCallback.bind(this);
2239
+ taskbarIDs[TASKBAR_ID.MULTIPLE_EDITION] = [TaskbarElement.CANCEL];
2240
+ this._taskbarProcessor = new TaskbarProcessor(taskbarIDs);
2241
+ }
2242
+ getGridSelectedButtonsCallBack() {
2243
+ var _a, _b, _c;
2244
+ if (!this.multipleEditionEnabled || ((_c = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length) === 1) {
2245
+ return this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
2246
+ }
2247
+ return this.getButtons(true, [TaskbarElement.UPDATE_MULTIPLE, TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
2248
+ }
2249
+ getFinishEditionButtonsCallback() {
2250
+ const btns = [TaskbarElement.CANCEL, TaskbarElement.SAVE];
2251
+ if (this.enableGridInsert && this._currentViewMode !== VIEW_MODE.ATTACHMENT) {
2252
+ btns.push(this._currentViewMode === VIEW_MODE.GRID ? TaskbarElement.FORM_MODE : TaskbarElement.GRID_MODE);
2253
+ }
2254
+ return btns;
2255
+ }
2256
+ getButtons(selected, extraButtons, removeRefresh) {
2257
+ let btnList = selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS;
2258
+ if (removeRefresh || this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
2259
+ btnList = btnList.filter(item => item !== TaskbarElement.REFRESH);
2260
+ }
2261
+ return this.addConfigButton(btnList.concat(extraButtons));
2262
+ }
2263
+ addConfigButton(buttons) {
2264
+ if (this.configName === undefined || (this.configName && this.gridLegacyConfigName)) {
2265
+ return buttons;
2266
+ }
2267
+ return buttons.concat(TaskbarElement.CONFIGURATOR);
2268
+ }
2269
+ get application() {
2270
+ return ApplicationContext.getContextValue("__SNK__APPLICATION__");
2271
+ }
2272
+ /**
2273
+ * @description Usado para alternar a visão entre GRID e FORM externamente.
2274
+ * @param {VIEW_MODE} view - A visão para a qual navegar.
2275
+ * @returns {Promise<void>}
2276
+ */
2277
+ async goToView(view) {
2278
+ this._currentViewMode = view;
2279
+ if (this._viewStack) {
2280
+ if (view === VIEW_MODE.GRID)
2281
+ this.dataUnit.isMultipleEdition = false;
2282
+ this._viewStack.show(view);
2283
+ }
2284
+ if (view === VIEW_MODE.GRID) {
2285
+ requestAnimationFrame(() => this.focusToGrid());
2286
+ }
2287
+ if (view === VIEW_MODE.FORM) {
2288
+ requestAnimationFrame(() => this.focusToForm());
2289
+ }
2290
+ }
2291
+ actionClickListener(evt) {
2292
+ this.handleTaskbarAction(evt.detail);
2293
+ evt.stopPropagation();
2294
+ }
2295
+ handleTaskbarAction(action) {
2296
+ switch (action) {
2297
+ case TaskbarElement.CONFIGURATOR:
2298
+ this._snkConfigurator.open();
2299
+ break;
2300
+ case TaskbarElement.GRID_MODE:
2301
+ this.goToView(VIEW_MODE.GRID);
2302
+ break;
2303
+ case TaskbarElement.FORM_MODE:
2304
+ this.goToView(VIEW_MODE.FORM);
2305
+ break;
2306
+ case TaskbarElement.UPDATE_MULTIPLE:
2307
+ this.dataUnit.isMultipleEdition = true;
2308
+ this.goToView(VIEW_MODE.FORM);
2309
+ break;
2310
+ }
2311
+ }
2312
+ async onChangeEntityName(newValue) {
2313
+ if (this.dataUnit)
2314
+ return;
2315
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
2316
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
2317
+ }
2318
+ onModeChange() {
2319
+ if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
2320
+ this.initInMemoryDataUnit();
2321
+ }
2322
+ }
2323
+ observeDataState(newValue, oldValue) {
2324
+ this.handleDataStateChange(newValue, oldValue);
2325
+ }
2326
+ async observeFormLegacy(newValue, oldValue) {
2327
+ await this.handleUpdateFormLegacyConfig(newValue, oldValue);
2328
+ }
2329
+ async observeGridLegacy(newValue, oldValue) {
2330
+ await this.handleUpdateGridLegacyConfig(newValue, oldValue);
2331
+ }
2332
+ async handleDataStateChange(newValue, oldValue) {
2333
+ if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
2334
+ this.dataStateChange.emit(newValue);
2335
+ }
2336
+ await this.processRmPrecision();
2337
+ }
2338
+ async processRmPrecision() {
2339
+ var _a, _b;
2340
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
2341
+ for (const field of fieldsWithRmPrecision || []) {
2342
+ if (!field) {
2343
+ continue;
2344
+ }
2345
+ const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
2346
+ if (!rmPrecision && rmPrecision !== 0) {
2347
+ continue;
2348
+ }
2349
+ await this.setFieldProp(field, 'precision', rmPrecision);
2350
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
2351
+ }
2352
+ this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
2353
+ }
2354
+ async handleUpdateGridLegacyConfig(newValue, oldValue) {
2355
+ if (newValue == undefined || newValue == oldValue) {
2356
+ return;
2357
+ }
2358
+ if (!this._gridConfigAlreadyLoaded) {
2359
+ return;
2360
+ }
2361
+ await this.loadGridConfig(true);
2362
+ }
2363
+ async handleUpdateFormLegacyConfig(newValue, oldValue) {
2364
+ if (newValue == undefined || newValue == oldValue) {
2365
+ return;
2366
+ }
2367
+ if (!this._formConfigAlreadyLoaded) {
2368
+ return;
2369
+ }
2370
+ await this.loadFormConfig(true);
2371
+ }
2372
+ async openConfig(viewMode) {
2373
+ await this._snkConfigurator.close();
2374
+ if (viewMode === VIEW_MODE.GRID) {
2375
+ await this.openGridConfig();
2376
+ }
2377
+ else if (viewMode === VIEW_MODE.FORM) {
2378
+ await this.openFormConfig();
2379
+ }
2380
+ }
2381
+ async openGridConfig() {
2382
+ var _a, _b, _c, _d;
2383
+ const originalColumns = (_b = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumns())) !== null && _b !== void 0 ? _b : [];
2384
+ const gridColumns = (_d = await ((_c = this._grid) === null || _c === void 0 ? void 0 : _c.getColumnsState())) !== null && _d !== void 0 ? _d : [];
2385
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
2386
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
2387
+ this._snkGridConfig.selectedIndex = 0;
2388
+ this._showPopUpGridConfig = true;
2389
+ }
2390
+ async openFormConfig() {
2391
+ if (this.formLegacyConfigName || this.configName) {
2392
+ await this._snkSimpleFormConfig.show();
2393
+ }
2394
+ }
2395
+ addGridLegacyConfigName() {
2396
+ if (this.gridLegacyConfigName && this.configName) {
2397
+ ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
2398
+ }
2399
+ }
2400
+ loadGridConfig(forceUpdate) {
2401
+ if (this.configName === undefined) {
2402
+ return;
2403
+ }
2404
+ if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
2405
+ return;
2406
+ }
2407
+ this.addGridLegacyConfigName();
2408
+ this._gridConfigAlreadyLoaded = true;
2409
+ return new Promise((accept, reject) => {
2410
+ ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
2411
+ .then(config => {
2412
+ this.setGridConfig(config);
2413
+ accept();
2414
+ })
2415
+ .catch(reason => {
2416
+ reject(reason);
2417
+ });
2418
+ });
2419
+ }
2420
+ formConfigIsLoaded() {
2421
+ return this.formConfig != undefined || this._formConfigAlreadyLoaded;
2422
+ }
2423
+ async loadFormConfig(forceLoad = false, forceSetNewConfig = false) {
2424
+ if (this.configName === undefined) {
2425
+ return;
2426
+ }
2427
+ if (this._formConfigManager == undefined) {
2428
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID(), undefined, this.dataUnit);
2429
+ this._formConfigManager.setConfig(this.formConfig);
2430
+ }
2431
+ if (this.formConfigIsLoaded() && !forceLoad) {
2432
+ return;
2433
+ }
2434
+ this._formConfigAlreadyLoaded = true;
2435
+ let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
2436
+ if (loadedLegacyConfig != undefined) {
2437
+ this._formConfigManager.setConfig(loadedLegacyConfig);
2438
+ this.setFormConfig(loadedLegacyConfig, forceSetNewConfig);
2439
+ return;
2440
+ }
2441
+ this.setFormConfig(await this._formConfigManager.loadConfig());
2442
+ }
2443
+ async componentWillRender() {
2444
+ this.loadTaskbarProcessor();
2445
+ this._resourceID = await this.application.getResourceID();
2446
+ this.dataExporterProviderStore();
2447
+ this.dataExporterProviderStore();
2448
+ this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
2449
+ if (this.configName === undefined) {
2450
+ return;
2451
+ }
2452
+ if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
2453
+ return;
2454
+ }
2455
+ await this.addGridLegacyConfigName();
2456
+ await this.loadGridConfig();
2457
+ await this.loadFormConfig();
2458
+ }
2459
+ componentDidRender() {
2460
+ this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
2461
+ this.addGridCustomValueFormattters();
2462
+ this.setFieldsProps();
2463
+ this.setCustomRenders();
2464
+ this.setCustomEditors();
2465
+ }
2466
+ componentWillLoad() {
2467
+ this.processMetadata();
2468
+ this.onModeChange();
2469
+ this.configDatasource();
2470
+ this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
2471
+ this._continuousInsertUtils = new ContinuousInsertUtils(this.application, this.resolveResourceID(), this.configName);
2472
+ if (this.enableGridInsert) {
2473
+ this._continuousInsertUtils.getConfig().then(value => this.enableContinuousInsert = value);
2474
+ }
2475
+ }
2476
+ componentDidLoad() {
2477
+ CSSVarsUtils.applyVarsGrid(this._element, this._grid);
2478
+ this.initKeyboardManager();
2479
+ this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
2480
+ }
2481
+ async dataUnitActionHandler(action) {
2482
+ if (action.type === Action.EDITION_CANCELED || action.type === Action.DATA_SAVED) {
2483
+ if (this.dataUnit.isMultipleEdition) {
2484
+ this.goToView(VIEW_MODE.GRID);
2485
+ }
2486
+ }
2487
+ }
2488
+ getMessage(key, params) {
2489
+ var _a;
2490
+ return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
2491
+ }
2492
+ disconnectedCallback() {
2493
+ var _a;
2494
+ (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
2495
+ }
2496
+ setCustomRenders() {
2497
+ if (!this._grid) {
2498
+ return;
2499
+ }
2500
+ for (const [fieldName, customRender] of this._customRenders) {
2501
+ this._grid.addGridCustomRender(fieldName, customRender);
2502
+ this._customRenders.delete(fieldName);
2503
+ }
2504
+ }
2505
+ setCustomEditors() {
2506
+ if (!this._grid || !this._form) {
2507
+ return;
2508
+ }
2509
+ for (const [fieldName, customEditor] of this._customEditors) {
2510
+ this._grid.addCustomEditor(fieldName, customEditor);
2511
+ this._form.addCustomEditor(fieldName, customEditor);
2512
+ this._customEditors.delete(fieldName);
2513
+ }
2514
+ }
2515
+ configDatasource() {
2516
+ this._multiSelectionListDataSource.setApplication(this.application);
2517
+ this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
2518
+ }
2519
+ setFieldsProps() {
2520
+ if (!this._form) {
2521
+ return;
2522
+ }
2523
+ for (const [fieldName, props] of this._fieldsProps) {
2524
+ for (const prop in props) {
2525
+ this._form.setFieldProp(fieldName, prop, props[prop]);
2526
+ }
2527
+ this._fieldsProps.delete(fieldName);
2528
+ }
2529
+ }
2530
+ getTaskBarId() {
2531
+ var _a, _b;
2532
+ if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
2533
+ return TASKBAR_ID.FINISH_EDITION;
2534
+ }
2535
+ if (this.dataUnit.isMultipleEdition) {
2536
+ return TASKBAR_ID.MULTIPLE_EDITION;
2537
+ }
2538
+ if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
2539
+ !this.dataState.selectionInfo.isAllRecords() &&
2540
+ this.dataState.selectionInfo.length > 0) {
2541
+ return this._currentViewMode === VIEW_MODE.GRID ? TASKBAR_ID.GRID_SELECTED : TASKBAR_ID.FORM_SELECTED;
2542
+ }
2543
+ return this._currentViewMode === VIEW_MODE.GRID ? TASKBAR_ID.GRID_REGULAR : TASKBAR_ID.FORM_REGULAR;
2544
+ }
2545
+ initInMemoryDataUnit() {
2546
+ this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
2547
+ this.dataUnit = this._inMemoryLoader.dataUnit;
2548
+ this.dataUnitReady.emit(this.dataUnit);
2549
+ }
2550
+ /**
2551
+ * @description Define os metadados do DataUnit.
2552
+ * @param {UnitMetadata} metadata - Os metadados a serem definidos.
2553
+ * @returns {Promise<void>}
2554
+ */
2555
+ setMetadata(metadata) {
2556
+ if (this._inMemoryLoader) {
2557
+ this._inMemoryLoader.metadata = metadata;
2558
+ }
2559
+ else if (this.dataUnit) {
2560
+ this.dataUnit.metadata = metadata;
2561
+ }
2562
+ return Promise.resolve();
2563
+ }
2564
+ /**
2565
+ * @description Define os registros do DataUnit.
2566
+ * @param {Array<Record>} records - Os registros a serem definidos.
2567
+ * @returns {Promise<void>}
2568
+ */
2569
+ setRecords(records) {
2570
+ if (this._inMemoryLoader) {
2571
+ this._inMemoryLoader.records = records;
2572
+ }
2573
+ else if (this.dataUnit) {
2574
+ this.dataUnit.records = records;
2575
+ }
2576
+ return Promise.resolve();
2577
+ }
2578
+ /**
2579
+ * @description Obtém os registros do DataUnit.
2580
+ * @returns {Promise<Array<Record>>} Uma promessa que resolve com a lista de registros.
2581
+ */
2582
+ getRecords() {
2583
+ return Promise.resolve(this.dataUnit.records);
2584
+ }
2585
+ /**
2586
+ * @description Usado para abrir o configurador do CRUD.
2587
+ * @returns {Promise<void>}
2588
+ */
2589
+ async openConfigurator() {
2590
+ var _a;
2591
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.open();
2592
+ }
2593
+ /**
2594
+ * @description Usado para fechar o configurador do CRUD.
2595
+ * @returns {Promise<void>}
2596
+ */
2597
+ async closeConfigurator() {
2598
+ var _a;
2599
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
2600
+ }
2601
+ /**
2602
+ * @description Atualiza a configuração do formulário.
2603
+ * @returns {Promise<void>}
2604
+ */
2605
+ async updateConfig() {
2606
+ if (this._formConfigManager == undefined) {
2607
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
2608
+ }
2609
+ this._formConfigManager.setConfig(this.formConfig);
2610
+ }
2611
+ processMetadata() {
2612
+ const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
2613
+ const fieldMetadata = [];
2614
+ const formConfig = { fields: [], emptyConfig: false };
2615
+ fieldsMetadataElem.forEach(fieldElem => {
2616
+ const field = {
2617
+ name: fieldElem.getAttribute("name") || fieldElem.getAttribute("label"),
2618
+ label: fieldElem.getAttribute("label"),
2619
+ dataType: DataType[fieldElem.getAttribute("dataType")] || DataType.TEXT,
2620
+ userInterface: UserInterface[fieldElem.getAttribute("userInterface")] || UserInterface.SHORTTEXT,
2621
+ readOnly: fieldElem.getAttribute("readOnly") == "true",
2622
+ required: fieldElem.getAttribute("required") == "true",
2623
+ tab: fieldElem.getAttribute("tab") || undefined,
2624
+ visible: fieldElem.getAttribute("visible") != "false"
2625
+ };
2626
+ const fieldConfig = { name: field.name, tab: field.tab, visible: field.visible };
2627
+ formConfig.fields.push(fieldConfig);
2628
+ fieldMetadata.push(field);
2629
+ });
2630
+ if (fieldMetadata.length > 0) {
2631
+ if (!this.formConfig) {
2632
+ this.formConfig = formConfig;
2633
+ }
2634
+ this._metadata = {
2635
+ name: "SimpleCrud",
2636
+ label: "SimpleCrud",
2637
+ fields: fieldMetadata
2638
+ };
2639
+ }
2640
+ }
2641
+ addGridCustomValueFormattters() {
2642
+ var _a, _b, _c;
2643
+ const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
2644
+ if (!metadataFields) {
2645
+ return;
2646
+ }
2647
+ const fieldsWithRmPrecision = [];
2648
+ metadataFields.forEach((field) => {
2649
+ var _a;
2650
+ if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
2651
+ fieldsWithRmPrecision.push(field.name);
2652
+ }
2653
+ });
2654
+ fieldsWithRmPrecision.forEach(field => {
2655
+ this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
2656
+ });
2657
+ }
2658
+ onDataStateChange(evt) {
2659
+ this.dataState = Object.assign({}, evt.detail);
2660
+ }
2661
+ getTaskBarDisabledButtons() {
2662
+ var _a, _b, _c, _d, _e, _f;
2663
+ const disabledButtons = [];
2664
+ if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
2665
+ disabledButtons.push(TaskbarElement.NEXT);
2666
+ }
2667
+ if (!((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.hasPrevious)) {
2668
+ disabledButtons.push(TaskbarElement.PREVIOUS);
2669
+ }
2670
+ if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
2671
+ disabledButtons.push(TaskbarElement.FORM_MODE);
2672
+ }
2673
+ if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
2674
+ disabledButtons.push(TaskbarElement.CLONE);
2675
+ }
2676
+ return disabledButtons;
2677
+ }
2678
+ handleCancelEdit() {
2679
+ var _a;
2680
+ if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
2681
+ this.goToView(VIEW_MODE.GRID);
2682
+ this.dataUnit.clearSelection();
2683
+ }
2684
+ }
2685
+ handleConfiguratorEvent(evt, type) {
2686
+ evt.stopImmediatePropagation();
2687
+ if (type === 'SAVE') {
2688
+ this.configuratorSave.emit();
2689
+ return;
2690
+ }
2691
+ this.configuratorCancel.emit();
2692
+ }
2693
+ onSelectField(option) {
2694
+ if (option == undefined) {
2695
+ return;
2696
+ }
2697
+ this._fieldToGetFocus = option.value;
2698
+ }
2699
+ getFieldSearch(splitButton, item) {
2700
+ if (this._fieldSearch != undefined) {
2701
+ return this._fieldSearch;
2702
+ }
2703
+ this._splitButtonForm = splitButton;
2704
+ this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
2705
+ return this._fieldSearch;
2706
+ }
2707
+ getFormFields() {
2708
+ var _a, _b;
2709
+ return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
2710
+ }
2711
+ handleFormSetFields(fields) {
2712
+ if (!ObjectUtils.equals(this._formFields, fields)) {
2713
+ this._formFields = fields !== null && fields !== void 0 ? fields : [];
2714
+ }
2715
+ }
2716
+ fieldsOptionLoader(argument) {
2717
+ const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
2718
+ const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
2719
+ const filteredFields = allFields.filter(field => {
2720
+ var _a, _b;
2721
+ return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
2722
+ ((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
2723
+ });
2724
+ const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
2725
+ return Promise.resolve(options);
2726
+ }
2727
+ isGridInsertActive() {
2728
+ return this.enableGridInsert && this.dataUnit.hasNewRecord();
2729
+ }
2730
+ getColumnSearch(splitButton, item) {
2731
+ if (this._columnSearch != undefined) {
2732
+ return this._columnSearch;
2733
+ }
2734
+ this._splitButton = splitButton;
2735
+ this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
2736
+ this._grid.filterColumns(argument).then((columns) => {
2737
+ accept(columns
2738
+ .filter(column => !column.hidden)
2739
+ .map(column => ({ label: column.label, value: column.name })));
2740
+ });
2741
+ }), (option) => {
2742
+ if (option != undefined) {
2743
+ this._grid.locateColumn(option.value);
2744
+ }
2745
+ });
2746
+ return this._columnSearch;
2747
+ }
2748
+ getActionsList() {
2749
+ const hardList = [];
2750
+ if (this.enableGridInsert) {
2751
+ hardList.push(this._continuousInsertUtils.actionContinuousInsert(this.enableContinuousInsert, () => {
2752
+ this.enableContinuousInsert = !this.enableContinuousInsert;
2753
+ this._continuousInsertUtils.handleSaveConfig(this.enableContinuousInsert);
2754
+ }));
2755
+ }
2756
+ if (this.isGridInsertActive())
2757
+ return hardList;
2758
+ if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
2759
+ const taskbarID = this.getTopTaskBarId();
2760
+ return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
2761
+ }
2762
+ return hardList.concat(this.actionsList);
2763
+ }
2764
+ getSettingsListGrid() {
2765
+ const hardList = [{
2766
+ value: StringUtils.generateUUID(),
2767
+ label: this.getMessage("snkSimpleCrud.findColumn"),
2768
+ disableCloseOnSelect: true,
2769
+ eagerInitialize: true,
2770
+ itemBuilder: (splitButton, item) => this.getColumnSearch(splitButton, item)
2771
+ }];
2772
+ return hardList;
2773
+ }
2774
+ getSettingsListForm() {
2775
+ const hardList = [{
2776
+ value: StringUtils.generateUUID(),
2777
+ label: this.getMessage("snkSimpleCrud.findFields"),
2778
+ disableCloseOnSelect: true,
2779
+ eagerInitialize: true,
2780
+ itemBuilder: (splitButton, item) => this.getFieldSearch(splitButton, item)
2781
+ }];
2782
+ return hardList;
2783
+ }
2784
+ getTopTaskBarId() {
2785
+ var _a;
2786
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${PresentationMode.PRIMARY}` :
2787
+ `snkGridTopTaskbar.regular${PresentationMode.PRIMARY}`;
2788
+ }
2789
+ clearFieldToFocusHandler() {
2790
+ this._fieldToGetFocus = undefined;
2791
+ }
2792
+ gridConfigChangeHandler(evt) {
2793
+ evt.stopPropagation();
2794
+ if (!this.configName)
2795
+ return;
2796
+ const config = evt.detail;
2797
+ ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
2798
+ }
2799
+ modalConfigChangeHandler(evt) {
2800
+ const config = evt.detail;
2801
+ this._grid.setColumnsState(config.columns)
2802
+ .then(() => {
2803
+ this.setGridConfig(config);
2804
+ this.closeGridConfig();
2805
+ this.dataExporterProviderStore();
2806
+ });
2807
+ evt.stopPropagation();
2808
+ }
2809
+ async dataExporterProviderStore() {
2810
+ if (this.dataUnit == undefined) {
2811
+ return;
2812
+ }
2813
+ if (this._grid == undefined) {
2814
+ return;
2815
+ }
2816
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
2817
+ store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
2818
+ }
2819
+ getDataExporterStoreKey() {
2820
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
2821
+ }
2822
+ setGridConfig(config) {
2823
+ this.gridConfig = config;
2824
+ CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
2825
+ }
2826
+ setFormConfig(config, forceUpdate) {
2827
+ if (this.formConfig && !forceUpdate)
2828
+ return;
2829
+ this.formConfig = config;
2830
+ }
2831
+ closeGridConfig() {
2832
+ this._showPopUpGridConfig = false;
2833
+ }
2834
+ getPageSize() {
2835
+ if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
2836
+ return 0;
2837
+ }
2838
+ if (this.pageSize == undefined) {
2839
+ return 150;
2840
+ }
2841
+ return this.pageSize;
2842
+ }
2843
+ resolveResourceID() {
2844
+ return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
2845
+ }
2846
+ getFormConfig() {
2847
+ var _a;
2848
+ const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
2849
+ if (!this.configName && !configFromManager) {
2850
+ return this.formConfig;
2851
+ }
2852
+ return configFromManager;
2853
+ }
2854
+ updateFormConfig() {
2855
+ let newConfig = this.formConfig;
2856
+ if (this.formLegacyConfigName == undefined) {
2857
+ newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
2858
+ }
2859
+ this.setFormConfig(newConfig, true);
2860
+ if (this._formConfigManager == undefined) {
2861
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
2862
+ }
2863
+ this._formConfigManager.setConfig(this.formConfig);
2864
+ }
2865
+ handleDataUnitOnInsertionMode() {
2866
+ if (this.enableGridInsert)
2867
+ return;
2868
+ this.goToView(VIEW_MODE.FORM);
2869
+ }
2870
+ async initKeyboardManager() {
2871
+ var _a;
2872
+ this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
2873
+ const dataUnit = this.dataUnit || await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
2874
+ if (dataUnit == undefined) {
2875
+ return;
2876
+ }
2877
+ this._keyboardManager
2878
+ .bind("F7", () => dataUnit.saveData(), { description: this.getMessage("snkSimpleCrud.keyboardShortcuts.saveData"), element: this._element })
2879
+ .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: this.getMessage("snkSimpleCrud.keyboardShortcuts.addRecord"), element: this._element })
2880
+ .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: this.getMessage("snkSimpleCrud.keyboardShortcuts.removeRecord"), element: this._element })
2881
+ .bind("Escape", () => {
2882
+ if (dataUnit.isDirty()) {
2883
+ dataUnit.cancelEdition();
2884
+ }
2885
+ }, {
2886
+ debounceTime: 1000,
2887
+ description: this.getMessage("snkSimpleCrud.keyboardShortcuts.cancelAction"), element: this._element
2888
+ });
2889
+ }
2890
+ async handleFormConfigSaved() {
2891
+ await this.loadFormConfig(true, true);
2892
+ }
2893
+ focusToGrid() {
2894
+ const gridElement = this._grid;
2895
+ gridElement.focus();
2896
+ }
2897
+ focusToForm() {
2898
+ const formElement = this._form;
2899
+ formElement.focus();
2900
+ }
2901
+ renderTaskbarContent(layout) {
2902
+ var _a;
2903
+ return (h("snk-taskbar", { class: `ez-box--no-outline ez-box ${this._currentViewMode === VIEW_MODE.FORM ? (this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow-xsmall') + ' ez-padding--small' : ''}`, dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), actionsSettingsList: layout === VIEW_MODE.GRID ? this.getSettingsListGrid() : this.getSettingsListForm(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY, tabindex: "0" }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
2904
+ }
2905
+ /* istanbul ignore next */
2906
+ render() {
2907
+ var _a;
2908
+ if (this.dataUnit == undefined) {
2909
+ return;
2910
+ }
2911
+ return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: `ez-box ez-box--no-outline ${this.outlineMode ? 'ez-box--outline' : 'ez-box--shadow'} simple-crud__container-section`, ref: (ref) => this._container = ref, tabindex: "0" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large ez-box--no-outline", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
2912
+ ? undefined
2913
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this.enableContinuousInsert, enableLockManagerTaskbarClick: this.enableLockManagerTaskbarClick, enableLockManagerLoadingComp: this.enableLockManagerLoadingComp, outlineMode: this.outlineMode, tabindex: "0", paginationCounterMode: this.paginationCounterMode, canEdit: !this.disableGridEdition }, this.renderTaskbarContent(VIEW_MODE.GRID), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(VIEW_MODE.FORM), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ez-box--no-outline`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this), elementFocusSearchField: this._container, tabindex: "0" }), h("slot", { name: "snkSimpleCrudFormFooter" }), h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName, messagesBuilder: this.messagesBuilder })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId, layoutFormConfig: this.layoutFormConfig })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-popup", { size: "medium", heightMode: "auto", useHeader: false, opened: this._showPopUpGridConfig, onEzClosePopup: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
2914
+ }
2915
+ get _element() { return getElement(this); }
2916
+ static get watchers() { return {
2917
+ "resourceID": ["handleResourceIDChanged"],
2918
+ "entityName": ["onChangeEntityName"],
2919
+ "mode": ["onModeChange"],
2920
+ "dataState": ["observeDataState"],
2921
+ "formLegacyConfigName": ["observeFormLegacy"],
2922
+ "gridLegacyConfigName": ["observeGridLegacy"]
2923
+ }; }
2924
+ };
2925
+ var TASKBAR_ID;
2926
+ (function (TASKBAR_ID) {
2927
+ TASKBAR_ID["FORM_REGULAR"] = "snkSimpleCrudTaskbar.form_regular";
2928
+ TASKBAR_ID["GRID_REGULAR"] = "snkSimpleCrudTaskbar.grid_regular";
2929
+ TASKBAR_ID["FORM_SELECTED"] = "snkSimpleCrudTaskbar.form_selected";
2930
+ TASKBAR_ID["GRID_SELECTED"] = "snkSimpleCrudTaskbar.grid_selected";
2931
+ TASKBAR_ID["FINISH_EDITION"] = "snkSimpleCrudTaskbar.finish_edition";
2932
+ TASKBAR_ID["MULTIPLE_EDITION"] = "snkSimpleCrudTaskbar.multiple_edition";
2933
+ })(TASKBAR_ID || (TASKBAR_ID = {}));
2934
+ SnkSimpleCrud.style = snkSimpleCrudCss;
2935
+
2936
+ export { SnkAttach as snk_attach, SnkDefaultFilter as snk_default_filter, SnkDynaformFormView as snk_dynaform_form_view, SnkFilterAdvancedMode as snk_filter_advanced_mode, SnkFilterAssistentMode as snk_filter_assistent_mode, SnkFilterDetail as snk_filter_detail, SnkFilterModalItem as snk_filter_modal_item, SnkImageInput as snk_image_input, SnkPersonalizedFilter as snk_personalized_filter, SnkSimpleBar as snk_simple_bar, SnkSimpleCrud as snk_simple_crud };