@sankhyalabs/sankhyablocks 10.1.0-dev.6 → 10.1.0-dev.61

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 (590) hide show
  1. package/LICENSE +4 -1
  2. package/dist/cjs/{ConfigStorage-72f34bd4.js → ConfigStorage-156bfcac.js} +19 -2
  3. package/dist/cjs/ContinuousInsertUtils-1ae0c6ac.js +41 -0
  4. package/dist/cjs/{DataFetcher-991b0349.js → DataFetcher-d13b4637.js} +121 -69
  5. package/dist/cjs/{FormConfigHelper-e253a418.js → FormConfigHelper-28fe4668.js} +3 -1
  6. package/dist/cjs/FormConfigHelper-c5f5473a.js +342 -0
  7. package/dist/cjs/{ISave-ebf6b4ed.js → ISave-55d9dcc3.js} +1 -1
  8. package/dist/cjs/ImageUtils-d6139911.js +144 -0
  9. package/dist/cjs/{PersonalizedFilterUtils-7259cf65.js → PersonalizedFilterUtils-263e4d24.js} +65 -5
  10. package/dist/cjs/{SnkFormConfigManager-cdbb29d4.js → SnkFormConfigManager-5cb9a39c.js} +5 -5
  11. package/dist/cjs/{SnkMultiSelectionListDataSource-011bec79.js → SnkMultiSelectionListDataSource-5c5badfc.js} +146 -74
  12. package/dist/cjs/{auth-fetcher-c3cac878.js → auth-fetcher-d1715459.js} +1 -1
  13. package/dist/cjs/config-header.cjs.entry.js +1 -1
  14. package/dist/cjs/configs-button.cjs.entry.js +1 -1
  15. package/dist/cjs/css-shim-a27d231b.js +6 -0
  16. package/dist/cjs/{dataunit-fetcher-8bf469e7.js → dataunit-fetcher-fae710c5.js} +91 -110
  17. package/dist/cjs/dom-ff96a4bc.js +75 -0
  18. package/dist/cjs/field-config_2.cjs.entry.js +3 -3
  19. package/dist/cjs/fields-layout.cjs.entry.js +6 -6
  20. package/dist/cjs/fields-selector.cjs.entry.js +3 -3
  21. package/dist/cjs/{filter-type.enum-2bb46d2a.js → filter-type.enum-b3b388af.js} +7 -0
  22. package/dist/cjs/{form-config-fetcher-c7af90d8.js → form-config-fetcher-bbebdcb8.js} +41 -5
  23. package/dist/cjs/guides-configurator.cjs.entry.js +3 -3
  24. package/dist/cjs/{index-1cf293c1.js → index-1894343a.js} +1547 -207
  25. package/dist/cjs/{index-e3e39724.js → index-bc950921.js} +6 -0
  26. package/dist/cjs/{index-13d05f03.js → index-f0fe7e6e.js} +90 -21
  27. package/dist/cjs/loader.cjs.js +16 -2
  28. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +6 -6
  29. package/dist/cjs/sankhyablocks.cjs.js +132 -4
  30. package/dist/cjs/shadow-css-7e3e0ab1.js +389 -0
  31. package/dist/cjs/snk-actions-button_9.cjs.entry.js +169 -120
  32. package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-application.cjs.entry.js +28 -9
  34. package/dist/cjs/snk-attach_11.cjs.entry.js +2971 -0
  35. package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-configurator.cjs.entry.js +3 -1
  37. package/dist/cjs/snk-crud.cjs.entry.js +149 -102
  38. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +1 -1
  39. package/dist/cjs/snk-custom-slot-guide.cjs.entry.js +40 -0
  40. package/dist/cjs/snk-data-exporter.cjs.entry.js +62 -16
  41. package/dist/cjs/{snk-data-unit-7d587ad5.js → snk-data-unit-32237a2d.js} +12 -3
  42. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  43. package/dist/cjs/snk-detail-view.cjs.entry.js +32 -20
  44. package/dist/cjs/snk-dynaform-config-header_5.cjs.entry.js +739 -0
  45. package/dist/cjs/snk-dynaform-detail-view_2.cjs.entry.js +961 -0
  46. package/dist/cjs/snk-dynaform-field-config_2.cjs.entry.js +327 -0
  47. package/dist/cjs/snk-dynaform-guides-view-2c7c6ce4.js +1094 -0
  48. package/dist/cjs/snk-dynaform-guides-view.cjs.entry.js +23 -0
  49. package/dist/cjs/snk-dynaform.cjs.entry.js +679 -0
  50. package/dist/cjs/snk-entity-list.cjs.entry.js +1 -1
  51. package/dist/cjs/snk-entity-search.cjs.entry.js +211 -0
  52. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +2 -2
  53. package/dist/cjs/{snk-expression-group_2.cjs.entry.js → snk-expression-group_4.cjs.entry.js} +422 -19
  54. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +175 -121
  55. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  56. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  57. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  58. package/dist/cjs/snk-filter-number.cjs.entry.js +11 -7
  59. package/dist/cjs/snk-filter-period.cjs.entry.js +14 -7
  60. package/dist/cjs/snk-filter-search.cjs.entry.js +11 -1
  61. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -2
  62. package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
  63. package/dist/cjs/snk-form-view.cjs.entry.js +70 -8
  64. package/dist/cjs/snk-form_2.cjs.entry.js +21 -11
  65. package/dist/cjs/snk-grid.cjs.entry.js +91 -36
  66. package/dist/cjs/{snk-guides-viewer-366d5c32.js → snk-guides-viewer-67b9cca9.js} +78 -214
  67. package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -18
  68. package/dist/cjs/snk-layout-form-config.cjs.entry.js +71 -0
  69. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
  70. package/dist/cjs/snk-pesquisa.cjs.entry.js +6 -7
  71. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  72. package/dist/cjs/snk-taskbar.cjs.entry.js +184 -127
  73. package/dist/cjs/{sortable.esm-9a110bb7.js → sortable.esm-b87669ab.js} +76 -90
  74. package/dist/cjs/taskbar-elements-25f800b3.js +152 -0
  75. package/dist/cjs/taskbarUtils-99aaa01f.js +236 -0
  76. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  77. package/dist/collection/collection-manifest.json +26 -0
  78. package/dist/collection/components/snk-actions-button/actions/executor/launch-screen.executor.js +6 -3
  79. package/dist/collection/components/snk-actions-button/snk-actions-button.js +30 -6
  80. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +1 -0
  81. package/dist/collection/components/snk-application/snk-application.js +20 -2
  82. package/dist/collection/components/snk-attach/snk-attach.css +29 -7
  83. package/dist/collection/components/snk-attach/snk-attach.js +93 -18
  84. package/dist/collection/components/snk-configurator/snk-configurator.js +2 -0
  85. package/dist/collection/components/snk-crud/snk-crud.css +55 -0
  86. package/dist/collection/components/snk-crud/snk-crud.js +169 -98
  87. package/dist/collection/components/snk-crud/subcomponents/GuideBuilder.js +1 -1
  88. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.css +4 -1
  89. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +21 -7
  90. package/dist/collection/components/snk-crud/subcomponents/snk-entity-search.css +17 -0
  91. package/dist/collection/components/snk-crud/subcomponents/snk-entity-search.js +330 -0
  92. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +90 -8
  93. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +22 -8
  94. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +89 -204
  95. package/dist/collection/components/snk-crud/utils/taskbarUtils.js +163 -0
  96. package/dist/collection/components/snk-custom-slot-guide/snk-custom-slot-guide.css +3 -0
  97. package/dist/collection/components/snk-custom-slot-guide/snk-custom-slot-guide.js +95 -0
  98. package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +1 -1
  99. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +2 -2
  100. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +78 -23
  101. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +28 -5
  102. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +43 -2
  103. package/dist/collection/components/snk-data-unit/snk-data-unit.js +9 -0
  104. package/dist/collection/components/snk-dynaform/interfaces/PropsCustomEditor.js +1 -0
  105. package/dist/collection/components/snk-dynaform/interfaces/PropsCustomRender.js +1 -0
  106. package/dist/collection/components/snk-dynaform/snk-dynaform.css +69 -0
  107. package/dist/collection/components/snk-dynaform/snk-dynaform.js +1661 -0
  108. package/dist/collection/components/snk-dynaform/subcomponents/CardFormResizeObserver.js +26 -0
  109. package/dist/collection/components/snk-dynaform/subcomponents/GuideBuilder.js +51 -0
  110. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.css +182 -0
  111. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.js +1015 -0
  112. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.css +98 -0
  113. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.js +590 -0
  114. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.css +321 -0
  115. package/dist/collection/components/snk-dynaform/subcomponents/snk-dynaform-guides-view/snk-dynaform-guides-view.js +1587 -0
  116. package/dist/collection/components/snk-dynaform-form-config/FormConfigHelper.js +325 -0
  117. package/dist/collection/components/snk-dynaform-form-config/SnkFormConfigManager.js +219 -0
  118. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.css +17 -0
  119. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.js +236 -0
  120. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.css +41 -0
  121. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.js +170 -0
  122. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.css +22 -0
  123. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.js +408 -0
  124. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.css +88 -0
  125. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-item.js +209 -0
  126. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.css +167 -0
  127. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.js +655 -0
  128. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.css +42 -0
  129. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.js +171 -0
  130. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.css +66 -0
  131. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-form-config.js +557 -0
  132. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.css +80 -0
  133. package/dist/collection/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.js +326 -0
  134. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +12 -8
  135. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +14 -7
  136. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +30 -0
  137. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
  138. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +10 -4
  139. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.css +5 -1
  140. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +28 -2
  141. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +7 -1
  142. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +27 -9
  143. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +33 -0
  144. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -6
  145. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +166 -78
  146. package/dist/collection/components/snk-form-config/FormConfigHelper.js +3 -1
  147. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
  148. package/dist/collection/components/snk-form-config/field-item/field-config/field-config.css +1 -0
  149. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.css +16 -0
  150. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.js +4 -4
  151. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.css +3 -4
  152. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.js +2 -2
  153. package/dist/collection/components/snk-form-config/snk-form-config.js +15 -5
  154. package/dist/collection/components/snk-grid/snk-grid.css +33 -5
  155. package/dist/collection/components/snk-grid/snk-grid.js +199 -24
  156. package/dist/collection/components/snk-grid-config/snk-grid-config.js +153 -51
  157. package/dist/collection/components/snk-image-input/snk-image-input.css +3 -0
  158. package/dist/collection/components/snk-image-input/snk-image-input.js +338 -0
  159. package/dist/collection/components/snk-image-input/utils/ImageUtils.js +135 -0
  160. package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.js +1 -1
  161. package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.js +1 -1
  162. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +1 -1
  163. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +13 -0
  164. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +0 -4
  165. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +34 -22
  166. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.css +8 -0
  167. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +38 -2
  168. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +54 -37
  169. package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.js +27 -1
  170. package/dist/collection/components/snk-taskbar/processor/simple-taskbar-processor.js +55 -0
  171. package/dist/collection/components/snk-taskbar/snk-taskbar.css +44 -1
  172. package/dist/collection/components/snk-taskbar/snk-taskbar.js +248 -132
  173. package/dist/collection/components/snk-taskbar/subcomponents/snk-taskbar-skeleton.css +12 -0
  174. package/dist/collection/components/snk-taskbar/subcomponents/snk-taskbar-skeleton.js +19 -0
  175. package/dist/collection/lib/@types/index.js +6 -0
  176. package/dist/collection/lib/configs/ConfigStorage.js +5 -0
  177. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +1 -1
  178. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +51 -4
  179. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +24 -2
  180. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.js +15 -104
  181. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +22 -4
  182. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +12 -0
  183. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +18 -0
  184. package/dist/collection/lib/message/SnkMessageBuilder.js +11 -2
  185. package/dist/collection/lib/message/messageResourceEnUSUtils.js +2 -0
  186. package/dist/collection/lib/message/messageResourceEsESUtils.js +2 -0
  187. package/dist/collection/lib/message/messageResourcePtBRUtils.js +2 -0
  188. package/dist/collection/lib/message/resources/en-us/dataUnitDataLoaderHelper.msg.js +0 -13
  189. package/dist/collection/lib/message/resources/en-us/snk-crud.msg.js +13 -1
  190. package/dist/collection/lib/message/resources/en-us/snk-form.msg.js +1 -0
  191. package/dist/collection/lib/message/resources/en-us/snk-image-input.msg.js +11 -0
  192. package/dist/collection/lib/message/resources/en-us/snk-layout-form-config.msg.js +10 -2
  193. package/dist/collection/lib/message/resources/es-es/dataUnitDataLoaderHelper.msg.js +0 -13
  194. package/dist/collection/lib/message/resources/es-es/snk-crud.msg.js +13 -1
  195. package/dist/collection/lib/message/resources/es-es/snk-form.msg.js +1 -0
  196. package/dist/collection/lib/message/resources/es-es/snk-image-input.msg.js +11 -0
  197. package/dist/collection/lib/message/resources/es-es/snk-layout-form-config.msg.js +8 -0
  198. package/dist/collection/lib/message/resources/pt-br/dataUnitDataLoaderHelper.msg.js +0 -13
  199. package/dist/collection/lib/message/resources/pt-br/snk-configurator.msg.js +1 -1
  200. package/dist/collection/lib/message/resources/pt-br/snk-crud.msg.js +13 -1
  201. package/dist/collection/lib/message/resources/pt-br/snk-form.msg.js +1 -0
  202. package/dist/collection/lib/message/resources/pt-br/snk-image-input.msg.js +11 -0
  203. package/dist/collection/lib/message/resources/pt-br/snk-layout-form-config.msg.js +10 -2
  204. package/dist/collection/lib/utils/CrudUtils.js +7 -4
  205. package/dist/components/ConfigStorage.js +17 -0
  206. package/dist/components/ContinuousInsertUtils.js +86 -28
  207. package/dist/components/DataFetcher.js +3 -2731
  208. package/dist/components/ISave.js +6 -0
  209. package/dist/components/PersonalizedFilterUtils.js +13 -0
  210. package/dist/components/SnkFormConfigManager.js +3 -3
  211. package/dist/components/SnkMessageBuilder.js +2804 -0
  212. package/dist/components/dataunit-fetcher.js +91 -110
  213. package/dist/components/field-config2.js +4 -2
  214. package/dist/components/fields-layout2.js +4 -4
  215. package/dist/components/form-config-fetcher.js +40 -4
  216. package/dist/components/guides-configurator2.js +2 -2
  217. package/dist/components/index.d.ts +16 -0
  218. package/dist/components/index.js +16 -0
  219. package/dist/components/index2.js +90 -21
  220. package/dist/components/snk-actions-button2.js +15 -9
  221. package/dist/components/snk-application2.js +22 -2
  222. package/dist/components/snk-attach2.js +69 -27
  223. package/dist/components/snk-configurator2.js +2 -0
  224. package/dist/components/snk-crud.js +240 -176
  225. package/dist/components/snk-custom-slot-guide.d.ts +11 -0
  226. package/dist/components/snk-custom-slot-guide.js +55 -0
  227. package/dist/components/snk-data-exporter2.js +56 -9
  228. package/dist/components/snk-data-unit2.js +10 -1
  229. package/dist/components/snk-detail-view2.js +227 -318
  230. package/dist/components/snk-dynaform-config-header.d.ts +11 -0
  231. package/dist/components/snk-dynaform-config-header.js +6 -0
  232. package/dist/components/snk-dynaform-config-header2.js +103 -0
  233. package/dist/components/snk-dynaform-configs-button.d.ts +11 -0
  234. package/dist/components/snk-dynaform-configs-button.js +6 -0
  235. package/dist/components/snk-dynaform-configs-button2.js +76 -0
  236. package/dist/components/snk-dynaform-detail-view.d.ts +11 -0
  237. package/dist/components/snk-dynaform-detail-view.js +6 -0
  238. package/dist/components/snk-dynaform-detail-view2.js +2213 -0
  239. package/dist/components/snk-dynaform-field-config.d.ts +11 -0
  240. package/dist/components/snk-dynaform-field-config.js +6 -0
  241. package/dist/components/snk-dynaform-field-config2.js +605 -0
  242. package/dist/components/snk-dynaform-field-item.d.ts +11 -0
  243. package/dist/components/snk-dynaform-field-item.js +6 -0
  244. package/dist/components/snk-dynaform-field-item2.js +96 -0
  245. package/dist/components/snk-dynaform-fields-layout.d.ts +11 -0
  246. package/dist/components/snk-dynaform-fields-layout.js +6 -0
  247. package/dist/components/snk-dynaform-fields-layout2.js +428 -0
  248. package/dist/components/snk-dynaform-fields-selector.d.ts +11 -0
  249. package/dist/components/snk-dynaform-fields-selector.js +6 -0
  250. package/dist/components/snk-dynaform-fields-selector2.js +104 -0
  251. package/dist/components/snk-dynaform-form-config.d.ts +11 -0
  252. package/dist/components/snk-dynaform-form-config.js +6 -0
  253. package/dist/components/snk-dynaform-form-config2.js +430 -0
  254. package/dist/components/snk-dynaform-form-view.d.ts +11 -0
  255. package/dist/components/snk-dynaform-form-view.js +6 -0
  256. package/dist/components/snk-dynaform-form-view2.js +272 -0
  257. package/dist/components/snk-dynaform-guides-configurator.d.ts +11 -0
  258. package/dist/components/snk-dynaform-guides-configurator.js +6 -0
  259. package/dist/components/snk-dynaform-guides-configurator2.js +173 -0
  260. package/dist/components/snk-dynaform-guides-view.d.ts +11 -0
  261. package/dist/components/snk-dynaform-guides-view.js +6 -0
  262. package/dist/components/snk-dynaform.d.ts +11 -0
  263. package/dist/components/snk-dynaform.js +1007 -0
  264. package/dist/components/snk-entity-search.d.ts +11 -0
  265. package/dist/components/snk-entity-search.js +6 -0
  266. package/dist/components/snk-entity-search2.js +231 -0
  267. package/dist/components/snk-exporter-email-sender2.js +1 -1
  268. package/dist/components/snk-filter-bar2.js +116 -80
  269. package/dist/components/snk-filter-detail2.js +10 -4
  270. package/dist/components/snk-filter-item2.js +9 -3
  271. package/dist/components/snk-filter-modal-item2.js +15 -1
  272. package/dist/components/snk-filter-modal2.js +27 -10
  273. package/dist/components/snk-filter-number.js +11 -7
  274. package/dist/components/snk-filter-period.js +13 -6
  275. package/dist/components/snk-filter-search.js +12 -1
  276. package/dist/components/snk-filter-text.js +1 -1
  277. package/dist/components/snk-form-config2.js +15 -5
  278. package/dist/components/snk-form-view2.js +79 -10
  279. package/dist/components/snk-grid-config2.js +109 -50
  280. package/dist/components/snk-grid2.js +132 -65
  281. package/dist/components/snk-image-input.d.ts +11 -0
  282. package/dist/components/snk-image-input.js +6 -0
  283. package/dist/components/snk-image-input2.js +316 -0
  284. package/dist/components/snk-layout-form-config2.js +1 -1
  285. package/dist/components/snk-personalized-filter2.js +1 -1
  286. package/dist/components/snk-pesquisa2.js +0 -1
  287. package/dist/components/snk-simple-crud2.js +46 -45
  288. package/dist/components/snk-taskbar-skeleton.d.ts +11 -0
  289. package/dist/components/snk-taskbar-skeleton.js +6 -0
  290. package/dist/components/snk-taskbar-skeleton2.js +29 -0
  291. package/dist/components/snk-taskbar2.js +256 -176
  292. package/dist/components/snk-view-representation2.js +1 -1
  293. package/dist/components/sortable.esm.js +76 -90
  294. package/dist/components/taskbar-actions-button2.js +21 -2
  295. package/dist/components/taskbar-split-button2.js +10 -1
  296. package/dist/components/taskbarUtils.js +229 -0
  297. package/dist/esm/{ConfigStorage-22324b6b.js → ConfigStorage-0d1c0695.js} +19 -2
  298. package/dist/esm/ContinuousInsertUtils-bce77dc1.js +39 -0
  299. package/dist/esm/{DataFetcher-450828a0.js → DataFetcher-70de9419.js} +121 -49
  300. package/dist/esm/{FormConfigHelper-e89ca25c.js → FormConfigHelper-d09669f3.js} +3 -1
  301. package/dist/esm/FormConfigHelper-efc29480.js +328 -0
  302. package/dist/esm/{ISave-61153166.js → ISave-f5704813.js} +1 -1
  303. package/dist/esm/ImageUtils-efbea0e4.js +138 -0
  304. package/dist/esm/{PersonalizedFilterUtils-2db38ff2.js → PersonalizedFilterUtils-45b5803c.js} +62 -2
  305. package/dist/esm/{SnkFormConfigManager-b5a92e12.js → SnkFormConfigManager-e7f05f79.js} +5 -5
  306. package/dist/esm/{SnkMultiSelectionListDataSource-d7ce2e54.js → SnkMultiSelectionListDataSource-6ac291a9.js} +141 -69
  307. package/dist/esm/{auth-fetcher-eef9d01e.js → auth-fetcher-e34880e5.js} +1 -1
  308. package/dist/esm/config-header.entry.js +1 -1
  309. package/dist/esm/configs-button.entry.js +1 -1
  310. package/dist/esm/css-shim-9f2d321e.js +4 -0
  311. package/dist/esm/{dataunit-fetcher-da9596f6.js → dataunit-fetcher-d26e4a08.js} +91 -110
  312. package/dist/esm/dom-64053c71.js +73 -0
  313. package/dist/esm/field-config_2.entry.js +3 -3
  314. package/dist/esm/fields-layout.entry.js +6 -6
  315. package/dist/esm/fields-selector.entry.js +3 -3
  316. package/dist/esm/{filter-type.enum-f6a8fe23.js → filter-type.enum-62b7fe88.js} +8 -1
  317. package/dist/esm/{form-config-fetcher-8d0a5e1c.js → form-config-fetcher-98c42169.js} +41 -5
  318. package/dist/esm/guides-configurator.entry.js +3 -3
  319. package/dist/esm/{index-479e1293.js → index-04f73a26.js} +1539 -207
  320. package/dist/esm/{index-b40568ff.js → index-c6721886.js} +6 -0
  321. package/dist/esm/{index-446f9341.js → index-ea250be6.js} +90 -21
  322. package/dist/esm/loader.js +17 -3
  323. package/dist/esm/pesquisa-grid_2.entry.js +6 -6
  324. package/dist/esm/sankhyablocks.js +133 -5
  325. package/dist/esm/shadow-css-98135883.js +387 -0
  326. package/dist/esm/snk-actions-button_9.entry.js +170 -121
  327. package/dist/esm/snk-actions-form.entry.js +1 -1
  328. package/dist/esm/snk-application.entry.js +28 -9
  329. package/dist/esm/snk-attach_11.entry.js +2957 -0
  330. package/dist/esm/snk-client-confirm.entry.js +1 -1
  331. package/dist/esm/snk-configurator.entry.js +3 -1
  332. package/dist/esm/snk-crud.entry.js +149 -102
  333. package/dist/esm/snk-custom-slot-elements.entry.js +1 -1
  334. package/dist/esm/snk-custom-slot-guide.entry.js +36 -0
  335. package/dist/esm/snk-data-exporter.entry.js +62 -16
  336. package/dist/esm/{snk-data-unit-99616a07.js → snk-data-unit-ff57ac90.js} +12 -3
  337. package/dist/esm/snk-data-unit.entry.js +4 -4
  338. package/dist/esm/snk-detail-view.entry.js +32 -20
  339. package/dist/esm/snk-dynaform-config-header_5.entry.js +731 -0
  340. package/dist/esm/snk-dynaform-detail-view_2.entry.js +956 -0
  341. package/dist/esm/snk-dynaform-field-config_2.entry.js +322 -0
  342. package/dist/esm/snk-dynaform-guides-view-0dfbefc1.js +1091 -0
  343. package/dist/esm/snk-dynaform-guides-view.entry.js +15 -0
  344. package/dist/esm/snk-dynaform.entry.js +675 -0
  345. package/dist/esm/snk-entity-list.entry.js +1 -1
  346. package/dist/esm/snk-entity-search.entry.js +207 -0
  347. package/dist/esm/snk-exporter-email-sender.entry.js +2 -2
  348. package/dist/esm/{snk-expression-group_2.entry.js → snk-expression-group_4.entry.js} +407 -6
  349. package/dist/esm/snk-filter-bar_4.entry.js +153 -99
  350. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  351. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  352. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  353. package/dist/esm/snk-filter-number.entry.js +11 -7
  354. package/dist/esm/snk-filter-period.entry.js +14 -7
  355. package/dist/esm/snk-filter-search.entry.js +11 -1
  356. package/dist/esm/snk-filter-text.entry.js +2 -2
  357. package/dist/esm/snk-form-summary.entry.js +1 -1
  358. package/dist/esm/snk-form-view.entry.js +71 -9
  359. package/dist/esm/snk-form_2.entry.js +21 -11
  360. package/dist/esm/snk-grid.entry.js +89 -34
  361. package/dist/esm/{snk-guides-viewer-240de636.js → snk-guides-viewer-31a0a23d.js} +79 -215
  362. package/dist/esm/snk-guides-viewer.entry.js +10 -18
  363. package/dist/esm/snk-layout-form-config.entry.js +67 -0
  364. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  365. package/dist/esm/snk-pesquisa.entry.js +6 -7
  366. package/dist/esm/snk-print-selector.entry.js +1 -1
  367. package/dist/esm/snk-taskbar.entry.js +185 -128
  368. package/dist/esm/{sortable.esm-842f85a3.js → sortable.esm-bc277c12.js} +76 -90
  369. package/dist/esm/taskbar-elements-ba9d6889.js +149 -0
  370. package/dist/esm/taskbarUtils-cb9db0d9.js +230 -0
  371. package/dist/esm/teste-pesquisa.entry.js +1 -1
  372. package/dist/sankhyablocks/{p-840fb68c.js → p-097d75b3.js} +2 -2
  373. package/dist/sankhyablocks/{p-7f7fe6c4.entry.js → p-0a160fb5.entry.js} +1 -1
  374. package/dist/sankhyablocks/p-0dbd53d9.js +1 -0
  375. package/dist/sankhyablocks/p-12579574.entry.js +1 -0
  376. package/dist/sankhyablocks/p-129a4906.entry.js +1 -0
  377. package/dist/sankhyablocks/{p-162bddae.entry.js → p-175c9576.entry.js} +1 -1
  378. package/dist/sankhyablocks/p-19351985.entry.js +1 -0
  379. package/dist/sankhyablocks/p-1d31aec3.entry.js +1 -0
  380. package/dist/sankhyablocks/{p-cb4343c4.entry.js → p-1d7d5814.entry.js} +1 -1
  381. package/dist/sankhyablocks/p-24b059ee.entry.js +1 -0
  382. package/dist/sankhyablocks/{p-f5e942b7.entry.js → p-250b273e.entry.js} +1 -1
  383. package/dist/sankhyablocks/p-26f1919e.entry.js +1 -0
  384. package/dist/sankhyablocks/p-2c4f7fdd.entry.js +1 -0
  385. package/dist/sankhyablocks/p-2c9d0870.js +2 -0
  386. package/dist/sankhyablocks/{p-75af335e.entry.js → p-2ebda226.entry.js} +1 -1
  387. package/dist/sankhyablocks/p-2ec98523.js +1 -0
  388. package/dist/sankhyablocks/p-3a35917e.entry.js +1 -0
  389. package/dist/sankhyablocks/p-449dfe55.entry.js +1 -0
  390. package/dist/sankhyablocks/p-46d7e2de.js +1 -0
  391. package/dist/sankhyablocks/p-4dd574d6.js +1 -0
  392. package/dist/sankhyablocks/p-541c72ec.entry.js +1 -0
  393. package/dist/sankhyablocks/p-58709cf9.js +1 -0
  394. package/dist/sankhyablocks/{p-27482793.entry.js → p-5aae5c74.entry.js} +1 -1
  395. package/dist/sankhyablocks/p-5aeae67f.js +1 -0
  396. package/dist/sankhyablocks/p-5d50f59a.entry.js +1 -0
  397. package/dist/sankhyablocks/p-5ef0e9a8.entry.js +1 -0
  398. package/dist/sankhyablocks/p-6e0ec0e4.entry.js +1 -0
  399. package/dist/sankhyablocks/p-6f60df43.js +1 -0
  400. package/dist/sankhyablocks/{p-825098c1.entry.js → p-752c57f4.entry.js} +1 -1
  401. package/dist/sankhyablocks/{p-e258de96.entry.js → p-76729994.entry.js} +1 -1
  402. package/dist/sankhyablocks/{p-62e9b9b8.entry.js → p-846d8f79.entry.js} +1 -1
  403. package/dist/sankhyablocks/p-855ccf64.entry.js +1 -0
  404. package/dist/sankhyablocks/p-885262ce.entry.js +1 -0
  405. package/dist/sankhyablocks/{p-118c221e.js → p-8b4d6719.js} +1 -1
  406. package/dist/sankhyablocks/p-8d1ef77a.js +60 -0
  407. package/dist/sankhyablocks/{p-7d6f1285.js → p-8d81c8d3.js} +2 -2
  408. package/dist/sankhyablocks/{p-3d41f5a8.entry.js → p-8d946600.entry.js} +1 -1
  409. package/dist/sankhyablocks/p-8f5dd87d.entry.js +1 -0
  410. package/dist/sankhyablocks/p-90037547.js +1 -0
  411. package/dist/sankhyablocks/{p-96d45943.entry.js → p-90ae6c2e.entry.js} +1 -1
  412. package/dist/sankhyablocks/{p-0b9a42ad.entry.js → p-9742ea0e.entry.js} +1 -1
  413. package/dist/sankhyablocks/p-9e02a785.js +1 -0
  414. package/dist/sankhyablocks/{p-2fdac5e6.entry.js → p-9e109f5e.entry.js} +1 -1
  415. package/dist/sankhyablocks/p-9e7dc97d.entry.js +1 -0
  416. package/dist/sankhyablocks/p-a25ab2ff.entry.js +1 -0
  417. package/dist/sankhyablocks/p-a2a9f520.entry.js +1 -0
  418. package/dist/sankhyablocks/p-a46ac091.js +1 -0
  419. package/dist/sankhyablocks/p-a696bbcd.entry.js +1 -0
  420. package/dist/sankhyablocks/p-a73b6b00.js +1 -0
  421. package/dist/sankhyablocks/p-a9012341.entry.js +11 -0
  422. package/dist/sankhyablocks/p-abcb646d.js +1 -0
  423. package/dist/sankhyablocks/{p-180716b2.entry.js → p-ae326d06.entry.js} +1 -1
  424. package/dist/sankhyablocks/p-af673291.js +1 -0
  425. package/dist/sankhyablocks/p-b555ce38.entry.js +1 -0
  426. package/dist/sankhyablocks/p-bd2a845c.js +1 -0
  427. package/dist/sankhyablocks/p-c3ec6642.js +19 -0
  428. package/dist/sankhyablocks/p-c4b34e2b.entry.js +1 -0
  429. package/dist/sankhyablocks/{p-92cfc028.js → p-c9440c8a.js} +1 -1
  430. package/dist/sankhyablocks/p-ca3728c0.entry.js +1 -0
  431. package/dist/sankhyablocks/p-cbb8e351.js +7 -0
  432. package/dist/sankhyablocks/p-cd153f71.entry.js +1 -0
  433. package/dist/sankhyablocks/p-ce8ccd72.entry.js +1 -0
  434. package/dist/sankhyablocks/{p-4c763b10.entry.js → p-d657f71f.entry.js} +1 -1
  435. package/dist/sankhyablocks/p-da455c82.js +12 -0
  436. package/dist/sankhyablocks/p-e5a3711f.js +1 -0
  437. package/dist/sankhyablocks/{p-9a63f3f7.entry.js → p-e737fd5a.entry.js} +1 -1
  438. package/dist/sankhyablocks/p-eac48627.js +1 -0
  439. package/dist/sankhyablocks/p-ec7c87bb.js +28 -0
  440. package/dist/sankhyablocks/p-ee56dda6.entry.js +1 -0
  441. package/dist/sankhyablocks/{p-667cab42.entry.js → p-f152ef98.entry.js} +1 -1
  442. package/dist/sankhyablocks/{p-7e250432.entry.js → p-f7170e10.entry.js} +1 -1
  443. package/dist/sankhyablocks/{p-7345782c.entry.js → p-f921270b.entry.js} +1 -1
  444. package/dist/sankhyablocks/p-fb6e3c65.entry.js +1 -0
  445. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  446. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +4 -0
  447. package/dist/types/components/snk-application/snk-application.d.ts +1 -1
  448. package/dist/types/components/snk-attach/snk-attach.d.ts +22 -4
  449. package/dist/types/components/snk-crud/snk-crud.d.ts +33 -11
  450. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +3 -2
  451. package/dist/types/components/snk-crud/subcomponents/snk-entity-search.d.ts +62 -0
  452. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +12 -0
  453. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -25
  454. package/dist/types/components/snk-crud/utils/taskbarUtils.d.ts +13 -0
  455. package/dist/types/components/snk-custom-slot-guide/snk-custom-slot-guide.d.ts +16 -0
  456. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +8 -0
  457. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +4 -0
  458. package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +16 -0
  459. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +1 -0
  460. package/dist/types/components/snk-dynaform/interfaces/PropsCustomEditor.d.ts +4 -0
  461. package/dist/types/components/snk-dynaform/interfaces/PropsCustomRender.d.ts +4 -0
  462. package/dist/types/components/snk-dynaform/subcomponents/CardFormResizeObserver.d.ts +1 -0
  463. package/dist/types/components/snk-dynaform/subcomponents/GuideBuilder.d.ts +14 -0
  464. package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-detail-view/snk-dynaform-detail-view.d.ts +169 -0
  465. package/dist/types/components/snk-dynaform/subcomponents/snk-dynaform-form-view/snk-dynaform-form-view.d.ts +108 -0
  466. package/dist/types/components/snk-dynaform-form-config/FormConfigHelper.d.ts +36 -0
  467. package/dist/types/components/snk-dynaform-form-config/SnkFormConfigManager.d.ts +35 -0
  468. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-config-header.d.ts +23 -0
  469. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-config-header/snk-dynaform-configs-button/snk-dynaform-configs-button.d.ts +19 -0
  470. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-field-item/snk-dynaform-field-config/snk-dynaform-field-config.d.ts +56 -0
  471. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-layout/snk-dynaform-fields-layout.d.ts +74 -0
  472. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-fields-selector/snk-dynaform-fields-selector.d.ts +21 -0
  473. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-form-config.d.ts +95 -0
  474. package/dist/types/components/snk-dynaform-form-config/snk-dynaform-guides-configurator/snk-dynaform-guides-configurator.d.ts +35 -0
  475. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +1 -1
  476. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +1 -0
  477. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +1 -0
  478. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -1
  479. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +5 -1
  480. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +2 -1
  481. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +1 -0
  482. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +33 -16
  483. package/dist/types/components/snk-form-config/FormConfigHelper.d.ts +1 -1
  484. package/dist/types/components/snk-form-config/fields-layout/fields-layout.d.ts +2 -2
  485. package/dist/types/components/snk-form-config/guides-configurator/guides-configurator.d.ts +1 -1
  486. package/dist/types/components/snk-form-config/snk-form-config.d.ts +2 -1
  487. package/dist/types/components/snk-grid/snk-grid.d.ts +37 -1
  488. package/dist/types/components/snk-grid-config/snk-grid-config.d.ts +11 -0
  489. package/dist/types/components/snk-image-input/snk-image-input.d.ts +57 -0
  490. package/dist/types/components/snk-image-input/utils/ImageUtils.d.ts +15 -0
  491. package/dist/types/components/snk-personalized-filter/interfaces/IParameter.d.ts +1 -0
  492. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +0 -1
  493. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -1
  494. package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +6 -0
  495. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +29 -2
  496. package/dist/types/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.d.ts +5 -0
  497. package/dist/types/components/snk-taskbar/processor/simple-taskbar-processor.d.ts +31 -0
  498. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +32 -21
  499. package/dist/types/components/snk-taskbar/subcomponents/snk-taskbar-skeleton.d.ts +3 -0
  500. package/dist/types/components.d.ts +2640 -1183
  501. package/dist/types/lib/@types/index.d.ts +6 -0
  502. package/dist/types/lib/configs/ConfigStorage.d.ts +1 -0
  503. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  504. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -1
  505. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.d.ts +3 -1
  506. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -0
  507. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +1 -0
  508. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -0
  509. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  510. package/dist/types/lib/message/resources/en-us/snk-image-input.msg.d.ts +1 -0
  511. package/dist/types/lib/message/resources/es-es/snk-image-input.msg.d.ts +1 -0
  512. package/dist/types/lib/message/resources/pt-br/snk-image-input.msg.d.ts +1 -0
  513. package/package.json +11 -8
  514. package/react/components.d.ts +16 -0
  515. package/react/components.js +16 -0
  516. package/react/components.js.map +1 -1
  517. package/dist/cjs/default-filters-a09bf82b.js +0 -8
  518. package/dist/cjs/index-62760a9c.js +0 -49
  519. package/dist/cjs/index-8d94b7e0.js +0 -7
  520. package/dist/cjs/snk-attach.cjs.entry.js +0 -910
  521. package/dist/cjs/snk-default-filter.cjs.entry.js +0 -77
  522. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +0 -61
  523. package/dist/cjs/snk-filter-detail.cjs.entry.js +0 -198
  524. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +0 -408
  525. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +0 -108
  526. package/dist/cjs/snk-personalized-filter.cjs.entry.js +0 -357
  527. package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -45
  528. package/dist/cjs/snk-simple-crud.cjs.entry.js +0 -870
  529. package/dist/cjs/taskbar-elements-fb5d1e08.js +0 -132
  530. package/dist/cjs/taskbar-processor-2fba34a8.js +0 -53
  531. package/dist/esm/default-filters-50105e43.js +0 -8
  532. package/dist/esm/index-620ac460.js +0 -7
  533. package/dist/esm/index-8acbae97.js +0 -49
  534. package/dist/esm/snk-attach.entry.js +0 -906
  535. package/dist/esm/snk-default-filter.entry.js +0 -73
  536. package/dist/esm/snk-filter-advanced-mode_2.entry.js +0 -56
  537. package/dist/esm/snk-filter-detail.entry.js +0 -194
  538. package/dist/esm/snk-filter-field-search_2.entry.js +0 -403
  539. package/dist/esm/snk-filter-modal-item.entry.js +0 -104
  540. package/dist/esm/snk-personalized-filter.entry.js +0 -353
  541. package/dist/esm/snk-simple-bar.entry.js +0 -41
  542. package/dist/esm/snk-simple-crud.entry.js +0 -866
  543. package/dist/esm/taskbar-elements-faaf5d8f.js +0 -129
  544. package/dist/esm/taskbar-processor-3436124c.js +0 -51
  545. package/dist/sankhyablocks/p-002d4d2b.js +0 -1
  546. package/dist/sankhyablocks/p-093f58fa.entry.js +0 -1
  547. package/dist/sankhyablocks/p-0948dc0a.entry.js +0 -11
  548. package/dist/sankhyablocks/p-0f3698af.js +0 -1
  549. package/dist/sankhyablocks/p-1a0caadb.js +0 -1
  550. package/dist/sankhyablocks/p-1a9c5684.entry.js +0 -1
  551. package/dist/sankhyablocks/p-1d589380.entry.js +0 -1
  552. package/dist/sankhyablocks/p-21107f0d.entry.js +0 -1
  553. package/dist/sankhyablocks/p-28f50632.js +0 -1
  554. package/dist/sankhyablocks/p-39be771c.js +0 -1
  555. package/dist/sankhyablocks/p-3ed04f0d.entry.js +0 -1
  556. package/dist/sankhyablocks/p-471b34f4.entry.js +0 -1
  557. package/dist/sankhyablocks/p-4963dd2a.entry.js +0 -1
  558. package/dist/sankhyablocks/p-49ddc27a.entry.js +0 -1
  559. package/dist/sankhyablocks/p-51833248.js +0 -7
  560. package/dist/sankhyablocks/p-55798617.js +0 -1
  561. package/dist/sankhyablocks/p-55f6fef2.entry.js +0 -1
  562. package/dist/sankhyablocks/p-56f16390.entry.js +0 -1
  563. package/dist/sankhyablocks/p-58683e28.js +0 -60
  564. package/dist/sankhyablocks/p-5ea893c5.entry.js +0 -1
  565. package/dist/sankhyablocks/p-60dd1d27.entry.js +0 -1
  566. package/dist/sankhyablocks/p-62aef37a.js +0 -1
  567. package/dist/sankhyablocks/p-669bb869.entry.js +0 -1
  568. package/dist/sankhyablocks/p-6a4b21dd.js +0 -1
  569. package/dist/sankhyablocks/p-6ee2ca7a.entry.js +0 -1
  570. package/dist/sankhyablocks/p-7cac3870.entry.js +0 -1
  571. package/dist/sankhyablocks/p-84345e7a.js +0 -1
  572. package/dist/sankhyablocks/p-86e54841.entry.js +0 -1
  573. package/dist/sankhyablocks/p-88b337fe.entry.js +0 -1
  574. package/dist/sankhyablocks/p-91005a00.entry.js +0 -1
  575. package/dist/sankhyablocks/p-91a9abb6.entry.js +0 -1
  576. package/dist/sankhyablocks/p-988afe78.js +0 -1
  577. package/dist/sankhyablocks/p-ada013c0.entry.js +0 -1
  578. package/dist/sankhyablocks/p-b568c1d4.js +0 -1
  579. package/dist/sankhyablocks/p-b7e891cc.entry.js +0 -1
  580. package/dist/sankhyablocks/p-b987e15d.js +0 -1
  581. package/dist/sankhyablocks/p-c35fc941.js +0 -26
  582. package/dist/sankhyablocks/p-c3dbf441.entry.js +0 -1
  583. package/dist/sankhyablocks/p-c4fcf1fb.entry.js +0 -1
  584. package/dist/sankhyablocks/p-c98c79c3.entry.js +0 -1
  585. package/dist/sankhyablocks/p-cadf4846.entry.js +0 -1
  586. package/dist/sankhyablocks/p-d8d8169b.js +0 -2
  587. package/dist/sankhyablocks/p-e91c3c57.entry.js +0 -1
  588. package/dist/sankhyablocks/p-ea729922.entry.js +0 -1
  589. package/dist/sankhyablocks/p-ec5fbad8.js +0 -1
  590. package/dist/sankhyablocks/p-f4184ce7.js +0 -1
@@ -0,0 +1,2957 @@
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-70de9419.js';
4
+ import { S as SaveErrorsEnum } from './ISave-f5704813.js';
5
+ import { P as PresentationMode } from './index-c6721886.js';
6
+ import { P as PreloadManager, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-d26e4a08.js';
7
+ import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
8
+ import { F as FormConfigFetcher } from './form-config-fetcher-98c42169.js';
9
+ import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7b422de0.js';
10
+ import { A as AutorizationType } from './auth-fetcher-e34880e5.js';
11
+ import { T as TaskbarElement } from './taskbar-elements-ba9d6889.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-0d1c0695.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-6ac291a9.js';
21
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
22
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
23
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-e7f05f79.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);padding-right:0;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-right:var(--space--12, 12px);--ez-form-view__item--padding:0;min-height:0;overflow-y:auto;scrollbar-width:auto;scrollbar-color:var(--color--strokes, #E1E2E5) transparent}ez-form-view.sc-snk-dynaform-form-view::-webkit-scrollbar{width:14px;height:14px}ez-form-view.sc-snk-dynaform-form-view::-webkit-scrollbar-track{background:transparent}ez-form-view.sc-snk-dynaform-form-view::-webkit-scrollbar-thumb{background-color:var(--color--strokes, #E1E2E5);border-radius:999px;border:2px solid transparent;background-clip:padding-box}ez-form-view.sc-snk-dynaform-form-view::-webkit-scrollbar-thumb:hover{background-color:var(--color--petroleum-100, #C8CCD3);background-clip:padding-box}ez-form-view.sc-snk-dynaform-form-view::-webkit-scrollbar-corner{background:transparent}.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
+ async componentWillLoad() {
1152
+ await this.initLayoutFormConfig();
1153
+ }
1154
+ componentDidLoad() {
1155
+ if (this.customEditors) {
1156
+ this.observePropsCustomEditor(this.customEditors);
1157
+ }
1158
+ if (this.fieldsProps) {
1159
+ this.observeFieldsProps(this.fieldsProps);
1160
+ }
1161
+ }
1162
+ async initLayoutFormConfig() {
1163
+ const _application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
1164
+ const layoutFormConfig = await (_application === null || _application === void 0 ? void 0 : _application.getLayoutFormConfig());
1165
+ if (layoutFormConfig) {
1166
+ this.setSingleColumn(layoutFormConfig);
1167
+ this.registerNotifyListeners(layoutFormConfig);
1168
+ }
1169
+ }
1170
+ setSingleColumn(layoutFormConfig) {
1171
+ 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;
1172
+ this._currentFormLayout = layoutFormConfig === null || layoutFormConfig === void 0 ? void 0 : layoutFormConfig.config;
1173
+ }
1174
+ registerNotifyListeners(layoutFormConfig) {
1175
+ var _a;
1176
+ if (!layoutFormConfig)
1177
+ return;
1178
+ (_a = layoutFormConfig.onConfigChange) === null || _a === void 0 ? void 0 : _a.call(layoutFormConfig, (config) => {
1179
+ this._singleColumn = (config === FormLayout.CASCADE || config === FormLayout.CLASSIC_CASCADE);
1180
+ this._currentFormLayout = config;
1181
+ });
1182
+ }
1183
+ componentDidRender() {
1184
+ var _a;
1185
+ this.setCustomEditors();
1186
+ this.setFieldProps();
1187
+ if (!this.fieldToFocus) {
1188
+ return;
1189
+ }
1190
+ if (!((_a = this.fields) === null || _a === void 0 ? void 0 : _a.some(item => item.name === this.fieldToFocus))) {
1191
+ return;
1192
+ }
1193
+ requestAnimationFrame(() => {
1194
+ var _a, _b;
1195
+ (_a = this._dataBinder) === null || _a === void 0 ? void 0 : _a.setFocus(this.fieldToFocus);
1196
+ (_b = this.snkRequestClearFieldToFocus) === null || _b === void 0 ? void 0 : _b.emit();
1197
+ });
1198
+ }
1199
+ setCustomEditors() {
1200
+ var _a, _b;
1201
+ if (!this._formView) {
1202
+ return;
1203
+ }
1204
+ for (const [fieldName, customEditorProps] of this._customEditors) {
1205
+ (_b = (_a = this._formView).addCustomEditor) === null || _b === void 0 ? void 0 : _b.call(_a, fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
1206
+ this._customEditors.delete(fieldName);
1207
+ }
1208
+ }
1209
+ setFieldProps() {
1210
+ if (!this._formView) {
1211
+ return;
1212
+ }
1213
+ for (const [fieldName, propsToChange] of this._fieldProps) {
1214
+ propsToChange.forEach(prop => {
1215
+ var _a, _b;
1216
+ (_b = (_a = this._formView).setFieldProp) === null || _b === void 0 ? void 0 : _b.call(_a, fieldName, prop.propName, prop.value);
1217
+ this._fieldProps.delete(fieldName);
1218
+ });
1219
+ }
1220
+ }
1221
+ buildSourceRecordPK(action) {
1222
+ var _a, _b, _c;
1223
+ const currentRecord = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a[0]) || {};
1224
+ const sourceBase64 = currentRecord["__record__source__id__"];
1225
+ const sourceRecord = JSON.parse(atob(sourceBase64 || ''));
1226
+ delete sourceRecord["__DATA_UNIT_NAME__"];
1227
+ if (!this.dataUnit) {
1228
+ return {};
1229
+ }
1230
+ const pks = (_b = getPKs(this.dataUnit)) !== null && _b !== void 0 ? _b : {};
1231
+ const pkFields = Object.keys(pks);
1232
+ const filteredSourceRecord = {};
1233
+ for (const pkField of pkFields) {
1234
+ filteredSourceRecord[pkField] = (_c = sourceRecord[pkField]) === null || _c === void 0 ? void 0 : _c.value;
1235
+ }
1236
+ return filteredSourceRecord;
1237
+ }
1238
+ getImageField() {
1239
+ var _a;
1240
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata.fields.filter(field => field.userInterface === UserInterface.IMAGE);
1241
+ }
1242
+ render() {
1243
+ 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)));
1244
+ }
1245
+ static get watchers() { return {
1246
+ "customEditors": ["observePropsCustomEditor"],
1247
+ "fieldsProps": ["observeFieldsProps"],
1248
+ "dataUnit": ["observeDataUnit"]
1249
+ }; }
1250
+ };
1251
+ SnkDynaformFormView.style = snkDynaformFormViewCss;
1252
+
1253
+ 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)}";
1254
+
1255
+ const SnkFilterAdvancedMode = class {
1256
+ constructor(hostRef) {
1257
+ registerInstance(this, hostRef);
1258
+ this.ezExpressionChange = createEvent(this, "ezExpressionChange", 7);
1259
+ this.filterAssistent = undefined;
1260
+ this.application = undefined;
1261
+ }
1262
+ getMessage(key, params) {
1263
+ return this.application.messagesBuilder.getMessage(key, params);
1264
+ }
1265
+ render() {
1266
+ var _a;
1267
+ 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) })));
1268
+ }
1269
+ };
1270
+ SnkFilterAdvancedMode.style = snkFilterAdvancedModeCss;
1271
+
1272
+ 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)}";
1273
+
1274
+ const SnkFilterAssistentMode = class {
1275
+ constructor(hostRef) {
1276
+ registerInstance(this, hostRef);
1277
+ this.ezChangeFilter = createEvent(this, "ezChangeFilter", 7);
1278
+ this.filterAssistent = undefined;
1279
+ this.messagesBuilder = undefined;
1280
+ this.filterId = undefined;
1281
+ this.entityUri = undefined;
1282
+ this.application = undefined;
1283
+ this.isDefaultFilter = false;
1284
+ }
1285
+ getMessage(key, params) {
1286
+ return this.application.messagesBuilder.getMessage(key, params);
1287
+ }
1288
+ async handleFilterGroupChange() {
1289
+ const assistent = await this._mainExpressionGroup.getExpressionGroup();
1290
+ this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
1291
+ this.filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
1292
+ this.filterAssistent.expression = PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
1293
+ this.ezChangeFilter.emit(this.filterAssistent);
1294
+ }
1295
+ render() {
1296
+ var _a, _b;
1297
+ 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))))))));
1298
+ }
1299
+ };
1300
+ SnkFilterAssistentMode.style = snkFilterAssistentModeCss;
1301
+
1302
+ const SnkFilterDetail = class {
1303
+ constructor(hostRef) {
1304
+ registerInstance(this, hostRef);
1305
+ this.filterChange = createEvent(this, "filterChange", 7);
1306
+ this.config = undefined;
1307
+ this.getMessage = undefined;
1308
+ this.showHardFixed = true;
1309
+ this.removalBlocked = false;
1310
+ }
1311
+ /**
1312
+ * Define o foco no campo do editor.
1313
+ */
1314
+ async setFocusField() {
1315
+ var _a, _b, _c, _d;
1316
+ if (!this._editor) {
1317
+ return;
1318
+ }
1319
+ if (this._editor["setFocus"]) {
1320
+ (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["setFocus"]) === null || _b === void 0 ? void 0 : _b.call(_a);
1321
+ }
1322
+ else if (this._editor["focus"]) {
1323
+ (_d = (_c = this._editor) === null || _c === void 0 ? void 0 : _c["focus"]) === null || _d === void 0 ? void 0 : _d.call(_c);
1324
+ }
1325
+ }
1326
+ async clearValue() {
1327
+ if (!this._editor) {
1328
+ return;
1329
+ }
1330
+ if (this._editor["clearValue"]) {
1331
+ await this._editor["clearValue"]();
1332
+ }
1333
+ }
1334
+ observeConfig(newValue) {
1335
+ var _a, _b;
1336
+ this._editor && (this._editor["config"] = newValue);
1337
+ (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["reloadList"]) === null || _b === void 0 ? void 0 : _b.call(_a);
1338
+ this._customElementObject = this.getContentEditor();
1339
+ }
1340
+ componentDidLoad() {
1341
+ if (this._element) {
1342
+ ElementIDUtils.addIDInfo(this._element);
1343
+ const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1344
+ this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
1345
+ }
1346
+ }
1347
+ changeConfig(newConfig) {
1348
+ this.filterChange.emit(newConfig);
1349
+ }
1350
+ getContentEditor() {
1351
+ switch (this.config.type) {
1352
+ case FilterItemType.BINARY_SELECT:
1353
+ return { tag: "snk-filter-binary-select" };
1354
+ case FilterItemType.MULTI_SELECT:
1355
+ return { tag: "snk-filter-multi-select" };
1356
+ case FilterItemType.PERIOD:
1357
+ return { tag: "snk-filter-period" };
1358
+ case FilterItemType.SEARCH:
1359
+ return { tag: "snk-filter-search" };
1360
+ case FilterItemType.NUMBER:
1361
+ return { tag: "snk-filter-number" };
1362
+ case FilterItemType.PERSONALIZED:
1363
+ const snkFilterPersonalizedProps = {
1364
+ tag: "snk-personalized-filter-editor", props: {
1365
+ presentationMode: EPresentationMode.CHIP,
1366
+ onValueChanged: evt => this.handleValueChanged(evt),
1367
+ }
1368
+ };
1369
+ return snkFilterPersonalizedProps;
1370
+ case FilterItemType.CHECK_BOX_LIST:
1371
+ return {
1372
+ tag: "snk-filter-checkbox-list",
1373
+ props: {
1374
+ onValueChanged: evt => this.config = Object.assign(Object.assign({}, this.config), { value: evt.detail })
1375
+ }
1376
+ };
1377
+ case FilterItemType.MULTI_LIST:
1378
+ return {
1379
+ tag: "snk-entity-list",
1380
+ props: {
1381
+ onValueChanged: evt => this.config = Object.assign(Object.assign({}, this.config), { value: evt.detail })
1382
+ }
1383
+ };
1384
+ }
1385
+ return { tag: "snk-filter-text" };
1386
+ }
1387
+ handleValueChanged({ detail }) {
1388
+ const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
1389
+ this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
1390
+ }
1391
+ removeItem() {
1392
+ const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
1393
+ const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
1394
+ const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: newValue });
1395
+ if (removedConfig.groupedItems != undefined) {
1396
+ removedConfig.groupedItems = removedConfig.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined })));
1397
+ }
1398
+ this.changeConfig(removedConfig);
1399
+ }
1400
+ removeItemFromGroup(item) {
1401
+ return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
1402
+ }
1403
+ getPopUpHeaderButtons() {
1404
+ return (h(Fragment, null, !this.removalBlocked && !this.config.removalBlocked &&
1405
+ this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), this.showHardFixed && !this.config.hardFixed &&
1406
+ 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 })))));
1407
+ }
1408
+ buildIcon(title, iconName, action) {
1409
+ 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}`)}` }))));
1410
+ }
1411
+ buildIdButton(buttonElement, title) {
1412
+ if (!buttonElement)
1413
+ return;
1414
+ const dataElement = { id: title };
1415
+ buttonElement.removeAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1416
+ ElementIDUtils.addIDInfoIfNotExists(buttonElement, "button", dataElement);
1417
+ }
1418
+ clearBinarySelectValues() {
1419
+ var _a;
1420
+ const editor = this._editor || {};
1421
+ (_a = editor.resetValues) === null || _a === void 0 ? void 0 : _a.call(editor);
1422
+ this.config = ObjectUtils.copy(this.originalConfig);
1423
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
1424
+ }
1425
+ async apply() {
1426
+ var _a, _b;
1427
+ // Aguarda o valor resolvido do editor (SEARCH) em vez de ler o cru — evita filtro sem valor.
1428
+ let editorValue = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["value"];
1429
+ if (typeof ((_b = this._editor) === null || _b === void 0 ? void 0 : _b["getValueAsync"]) === "function") {
1430
+ editorValue = await this._editor["getValueAsync"]();
1431
+ }
1432
+ const isValid = PersonalizedFilterUtils.validateVariableValues(this.config, editorValue);
1433
+ if (!isValid) {
1434
+ return ApplicationUtils.alert(this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.title'), this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.message'));
1435
+ }
1436
+ const valuesArray = editorValue !== undefined ? editorValue : this.config.value;
1437
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: this.isVisible(), value: valuesArray }));
1438
+ }
1439
+ isVisible() {
1440
+ if (this.config.groupedItems && this.config.groupedItems.length > 0) {
1441
+ return this.config.groupedItems.filter(item => item.visible).length > 0;
1442
+ }
1443
+ return true;
1444
+ }
1445
+ clear() {
1446
+ var _a;
1447
+ if (this.config.type === FilterItemType.BINARY_SELECT) {
1448
+ this.clearBinarySelectValues();
1449
+ return;
1450
+ }
1451
+ if (FilterItemType.MULTI_LIST === this.config.type) {
1452
+ const configCopy = ObjectUtils.copy(this.config);
1453
+ (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.forEach(value => !!value && (value.check = false));
1454
+ this.config = ObjectUtils.copy(configCopy);
1455
+ return;
1456
+ }
1457
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
1458
+ }
1459
+ filterCanBeCleared() {
1460
+ return this.config.type !== FilterItemType.PERSONALIZED;
1461
+ }
1462
+ onKeyDonwListener(event) {
1463
+ if (event.key === "Enter") {
1464
+ this.apply();
1465
+ }
1466
+ }
1467
+ buildRightSlot(item) {
1468
+ return h("ez-icon", { iconName: "delete", onClick: () => this.removeValueFromConfig(item) });
1469
+ }
1470
+ removeValueFromConfig(item) {
1471
+ var _a, _b;
1472
+ if (this.config) {
1473
+ const configCopy = ObjectUtils.copy(this.config);
1474
+ 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);
1475
+ (_b = configCopy.value) === null || _b === void 0 ? void 0 : _b.splice(index, 1);
1476
+ this.config = ObjectUtils.copy(configCopy);
1477
+ }
1478
+ }
1479
+ componentWillLoad() {
1480
+ this.originalConfig = ObjectUtils.copy(this.config);
1481
+ this._customElementObject = this.getContentEditor();
1482
+ }
1483
+ render() {
1484
+ const { tag: CustomElement, props } = this._customElementObject;
1485
+ 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" }))));
1486
+ }
1487
+ get _element() { return getElement(this); }
1488
+ static get watchers() { return {
1489
+ "config": ["observeConfig"]
1490
+ }; }
1491
+ };
1492
+
1493
+ const snkFilterModalItemCss = ".grow{flex-grow:1}.gap{gap:4px}";
1494
+
1495
+ const SnkFilterModalItem = class {
1496
+ constructor(hostRef) {
1497
+ registerInstance(this, hostRef);
1498
+ this.filterChange = createEvent(this, "filterChange", 7);
1499
+ this.editPersonalizedFilter = createEvent(this, "editPersonalizedFilter", 7);
1500
+ this.addPersonalizedFilter = createEvent(this, "addPersonalizedFilter", 7);
1501
+ this.filterItem = undefined;
1502
+ this.configName = undefined;
1503
+ this.resourceID = undefined;
1504
+ }
1505
+ getContentEditorConfig() {
1506
+ const props = { presentationMode: EPresentationMode.MODAL };
1507
+ switch (this.filterItem.type) {
1508
+ case FilterItemType.BINARY_SELECT:
1509
+ return { tag: "snk-filter-binary-select", props };
1510
+ case FilterItemType.MULTI_SELECT:
1511
+ return { tag: "snk-filter-multi-select" };
1512
+ case FilterItemType.PERIOD:
1513
+ return { tag: "snk-filter-period", props };
1514
+ case FilterItemType.SEARCH:
1515
+ return { tag: "snk-filter-search" };
1516
+ case FilterItemType.NUMBER:
1517
+ return { tag: "snk-filter-number", props };
1518
+ case FilterItemType.PERSONALIZED:
1519
+ return this.buildSnkFilterPersonalizedProps();
1520
+ case FilterItemType.CHECK_BOX_LIST:
1521
+ return { tag: "snk-filter-checkbox-list", props };
1522
+ case FilterItemType.MULTI_LIST:
1523
+ return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
1524
+ }
1525
+ return { tag: "snk-filter-text" };
1526
+ }
1527
+ buildSnkFilterPersonalizedProps() {
1528
+ return {
1529
+ tag: "snk-personalized-filter-editor", props: {
1530
+ onEditFilter: (event) => this.editPersonalizedFilter.emit(event.detail),
1531
+ onAddFilter: () => this.addPersonalizedFilter.emit(),
1532
+ }
1533
+ };
1534
+ }
1535
+ isVisible(newValue) {
1536
+ return !this.filterItem.visible ? newValue !== undefined : true;
1537
+ }
1538
+ updateFilterValue(data) {
1539
+ var _a, _b;
1540
+ const newValue = (data === null || data === void 0 ? void 0 : data.value) !== undefined ? data.value : data;
1541
+ if (this.filterItem.groupedItems != undefined) {
1542
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
1543
+ }
1544
+ else {
1545
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === (FilterItemType.SEARCH || FilterItemType.CHECK_BOX_LIST) ? data : newValue, visible: this.isVisible(newValue) });
1546
+ }
1547
+ this._editor && (this._editor["config"] = this.filterItem);
1548
+ (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
1549
+ this.filterChange.emit(this.filterItem);
1550
+ }
1551
+ // Resolve o valor do editor (SEARCH) sob demanda — no modal a resolução via ezChange pode
1552
+ // não ter concluído; o "Aplicar" do modal chama isto antes de montar os filtros.
1553
+ async syncEditorValue() {
1554
+ const editor = this._editor;
1555
+ if (editor && typeof editor.getValueAsync === "function") {
1556
+ const resolved = await editor.getValueAsync();
1557
+ // Editor SEARCH vazio resolve para undefined — nada a sincronizar (evita crash em
1558
+ // updateFilterValue ao acessar data.items).
1559
+ if (resolved != null) {
1560
+ this.updateFilterValue(resolved);
1561
+ }
1562
+ }
1563
+ }
1564
+ handleDeleteFilter(filter, filterItemType) {
1565
+ if (filterItemType === FilterItemType.PERSONALIZED) {
1566
+ ConfigStorage.removePersonalizedFilter(filter, this.resourceID, this.configName);
1567
+ }
1568
+ }
1569
+ componentDidLoad() {
1570
+ if (this._element) {
1571
+ ElementIDUtils.addIDInfo(this._element);
1572
+ const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1573
+ this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
1574
+ }
1575
+ }
1576
+ buildRightSlot(item) {
1577
+ return (h("ez-icon", { iconName: "delete", onClick: () => this.removeValueFromConfig(item) }));
1578
+ }
1579
+ removeValueFromConfig(item) {
1580
+ var _a, _b, _c;
1581
+ 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);
1582
+ const filterItemCopy = ObjectUtils.copy(this.filterItem);
1583
+ (_c = filterItemCopy === null || filterItemCopy === void 0 ? void 0 : filterItemCopy.value) === null || _c === void 0 ? void 0 : _c.splice(index, 1);
1584
+ this.updateFilterValue(filterItemCopy.value);
1585
+ }
1586
+ canShowDetailModal() {
1587
+ const { CUSTOM_FILTER, OTHER_FILTERS } = FilterType;
1588
+ return ![CUSTOM_FILTER, OTHER_FILTERS].includes(this.filterItem.filterType) && this.filterItem.type !== FilterItemType.BINARY_SELECT;
1589
+ }
1590
+ render() {
1591
+ const { tag: ContentEditor, props } = this.getContentEditorConfig();
1592
+ 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)))));
1593
+ }
1594
+ get _element() { return getElement(this); }
1595
+ };
1596
+ SnkFilterModalItem.style = snkFilterModalItemCss;
1597
+
1598
+ const snkImageInputCss = ":host{display:block}";
1599
+
1600
+ const SnkImageInput = class {
1601
+ constructor(hostRef) {
1602
+ registerInstance(this, hostRef);
1603
+ this.imageError = createEvent(this, "imageError", 7);
1604
+ this.dataUnitObserver = async (action) => {
1605
+ var _a;
1606
+ const actionsMoveSelection = [Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
1607
+ if (actionsMoveSelection.includes(action.type)) {
1608
+ await this.loadImage();
1609
+ return;
1610
+ }
1611
+ const selection = ((_a = action.payload) === null || _a === void 0 ? void 0 : _a.selection) || [];
1612
+ if (action.type === Action.SELECTION_CHANGED && selection.length > 0) {
1613
+ await this.loadImage();
1614
+ return;
1615
+ }
1616
+ if (action.type === Action.RECORDS_ADDED) {
1617
+ await this.clearImage();
1618
+ return;
1619
+ }
1620
+ if (action.type === Action.EDITION_CANCELED) {
1621
+ await this.loadImage();
1622
+ return;
1623
+ }
1624
+ };
1625
+ this.dataUnit = undefined;
1626
+ this.fieldName = undefined;
1627
+ this.entityName = undefined;
1628
+ this.enabled = true;
1629
+ this.acceptType = undefined;
1630
+ this.maxSize = undefined;
1631
+ this.label = undefined;
1632
+ this.imageValue = undefined;
1633
+ this.loading = true;
1634
+ }
1635
+ /**
1636
+ * Força o reload da imagem
1637
+ */
1638
+ async reloadImage(pks) {
1639
+ await this.loadImage(pks);
1640
+ }
1641
+ getMessage(key, params) {
1642
+ if (!this.messagesBuilder) {
1643
+ this.messagesBuilder = new SnkMessageBuilder();
1644
+ }
1645
+ return this.messagesBuilder.getMessage(key, params);
1646
+ }
1647
+ async clearImage() {
1648
+ var _a;
1649
+ (_a = this._loadAbortController) === null || _a === void 0 ? void 0 : _a.abort();
1650
+ this.imageValue = undefined;
1651
+ }
1652
+ async handleImageChange(event) {
1653
+ const base64 = event.detail;
1654
+ if (!base64) {
1655
+ await this.clearImage();
1656
+ await this.updatedataUnitField(true);
1657
+ return;
1658
+ }
1659
+ const blob = await base64ToBlob(base64);
1660
+ if (this.maxSize && blob.size > this.maxSize * 1024) {
1661
+ const errorMsg = this.getMessage('snkImageInput.errorImageSize') + this.maxSize + '(KB)';
1662
+ this.imageError.emit(errorMsg);
1663
+ if (this.application) {
1664
+ await this.application.error(this.getMessage('snkImageInput.errorTitle'), errorMsg);
1665
+ }
1666
+ return;
1667
+ }
1668
+ this.imageValue = base64;
1669
+ await sessionFileUpload(blob, this.entityName, this.fieldName);
1670
+ await this.updatedataUnitField();
1671
+ }
1672
+ async updatedataUnitField(deleted = false) {
1673
+ if (!this.dataUnit || !this.dataUnit.getSelectedRecord()) {
1674
+ return;
1675
+ }
1676
+ if (deleted) {
1677
+ await this.dataUnit.setFieldValue(this.fieldName, 'deletado');
1678
+ }
1679
+ else {
1680
+ await this.dataUnit.setFieldValue(this.fieldName, `$file.session.key{${buildFileKey(this.entityName, this.fieldName)}}`);
1681
+ }
1682
+ }
1683
+ async handleImageError(event) {
1684
+ this.imageError.emit(event.detail);
1685
+ if (this.application) {
1686
+ await this.application.error(this.getMessage('snkImageInput.errorTitle'), event.detail);
1687
+ }
1688
+ }
1689
+ getPksFromDataUnit() {
1690
+ if (!this.dataUnit) {
1691
+ return undefined;
1692
+ }
1693
+ const selectedRecord = this.dataUnit.getSelectedRecord();
1694
+ if (!selectedRecord) {
1695
+ return undefined;
1696
+ }
1697
+ const fieldValue = selectedRecord[this.fieldName];
1698
+ if (!fieldValue) {
1699
+ return undefined;
1700
+ }
1701
+ try {
1702
+ const pk = JSON.parse(fieldValue);
1703
+ return pk;
1704
+ }
1705
+ catch (error) {
1706
+ console.error('Error parsing PK from data unit field:', error);
1707
+ return undefined;
1708
+ }
1709
+ }
1710
+ async loadImage(pks) {
1711
+ var _a, _b;
1712
+ (_a = this._loadAbortController) === null || _a === void 0 ? void 0 : _a.abort();
1713
+ const controller = new AbortController();
1714
+ this._loadAbortController = controller;
1715
+ this.loading = true;
1716
+ if (this.dataUnit && this.entityName) {
1717
+ pks = (_b = pks !== null && pks !== void 0 ? pks : this.getPksFromDataUnit()) !== null && _b !== void 0 ? _b : getPKs(this.dataUnit);
1718
+ const image = await downloadImage(pks, this.fieldName, this.entityName, controller.signal);
1719
+ if (controller.signal.aborted)
1720
+ return;
1721
+ this.imageValue = image;
1722
+ }
1723
+ this.loading = false;
1724
+ }
1725
+ async componentWillLoad() {
1726
+ this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
1727
+ if (!this.messagesBuilder) {
1728
+ this.messagesBuilder = new SnkMessageBuilder();
1729
+ }
1730
+ if (this.dataUnit) {
1731
+ this.dataUnit.subscribe(this.dataUnitObserver);
1732
+ }
1733
+ }
1734
+ disconnectedCallback() {
1735
+ if (this.dataUnit) {
1736
+ this.dataUnit.unsubscribe(this.dataUnitObserver);
1737
+ }
1738
+ }
1739
+ async componentDidLoad() {
1740
+ await this.loadImage();
1741
+ }
1742
+ render() {
1743
+ 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 })));
1744
+ }
1745
+ };
1746
+ SnkImageInput.style = snkImageInputCss;
1747
+
1748
+ 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}";
1749
+
1750
+ const SnkPersonalizedFilter = class {
1751
+ constructor(hostRef) {
1752
+ registerInstance(this, hostRef);
1753
+ this.ezCancel = createEvent(this, "ezCancel", 7);
1754
+ this.ezSave = createEvent(this, "ezSave", 7);
1755
+ this.ezAfterSave = createEvent(this, "ezAfterSave", 7);
1756
+ this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
1757
+ this._filterMetadataStorage = new Map();
1758
+ this._dataSourceFetcher = {
1759
+ fetchData: async (entity) => {
1760
+ let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
1761
+ if (StringUtils.isEmpty(entityURI)) {
1762
+ entityURI = this.entityUri;
1763
+ }
1764
+ if (!this._filterMetadataStorage.has(entityURI)) {
1765
+ const filterMetadata = await this._personalizedFilterFetcher.loadFields(entityURI);
1766
+ this._filterMetadataStorage.set(entityURI, filterMetadata);
1767
+ }
1768
+ return this._filterMetadataStorage.get(entityURI);
1769
+ }
1770
+ };
1771
+ this._filterAssistentMode = true;
1772
+ this._filterAssistent = undefined;
1773
+ this.messagesBuilder = undefined;
1774
+ this.entityUri = undefined;
1775
+ this.filterId = undefined;
1776
+ this.configName = undefined;
1777
+ this.resourceID = undefined;
1778
+ this.isDefaultFilter = false;
1779
+ }
1780
+ /**
1781
+ * Cria um novo filtro personalizado caso não exista nenhum.
1782
+ * @method
1783
+ * @returns {Promise<void>}
1784
+ */
1785
+ async createPersonalizedFilter() {
1786
+ const newPersonalizedFilter = {
1787
+ name: "",
1788
+ active: true,
1789
+ expression: "",
1790
+ parameters: [],
1791
+ assistent: {
1792
+ id: StringUtils.generateUUID(),
1793
+ items: [
1794
+ {
1795
+ id: StringUtils.generateUUID(),
1796
+ entityName: "",
1797
+ fieldName: "",
1798
+ description: "",
1799
+ fieldLabel: this.getMessage("snkPersonalizedFilter.info.labelDefaultValue"),
1800
+ type: undefined,
1801
+ expression: undefined,
1802
+ operand: undefined,
1803
+ paramVariable: false,
1804
+ value: undefined,
1805
+ systemConfig: null,
1806
+ userConfig: null
1807
+ }
1808
+ ],
1809
+ childrenGroups: [],
1810
+ operand: FilterGroupCondition.AND
1811
+ }
1812
+ };
1813
+ if (this.isDefaultFilter) {
1814
+ this.buildDataDefaultFilter(newPersonalizedFilter);
1815
+ }
1816
+ this._originalFilterAssistent = ObjectUtils.copy(newPersonalizedFilter);
1817
+ this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
1818
+ }
1819
+ /**
1820
+ * Carrega o filtro personalizado com base no identificador informado.
1821
+ * @watch filterId
1822
+ * @param newValue Novo valor do filtroId.
1823
+ * @param oldValue Valor anterior do filtroId.
1824
+ */
1825
+ loadFilter(newValue, oldValue) {
1826
+ if (newValue == null || oldValue == newValue || this.resourceID == undefined) {
1827
+ return;
1828
+ }
1829
+ if (newValue === DefaultFilter.id) {
1830
+ ConfigStorage.loadDefaultFilter(newValue, this.resourceID, this.configName)
1831
+ .then((resp) => {
1832
+ const personalizedFilter = this.applyDefaultValues(resp);
1833
+ this._filterAssistent = personalizedFilter;
1834
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
1835
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
1836
+ });
1837
+ return;
1838
+ }
1839
+ ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
1840
+ .then((resp) => {
1841
+ const personalizedFilter = this.applyDefaultValues(resp);
1842
+ this._filterAssistent = personalizedFilter;
1843
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
1844
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
1845
+ });
1846
+ }
1847
+ componentWillLoad() {
1848
+ var _a;
1849
+ if (store.get(`filterFieldsDataSource.${this.entityUri}`) == undefined) {
1850
+ store.set(`filterFieldsDataSource.${this.entityUri}`, this._dataSourceFetcher);
1851
+ }
1852
+ if (!this.messagesBuilder) {
1853
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
1854
+ this.messagesBuilder = (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder;
1855
+ }
1856
+ this.loadFilter(this.filterId, undefined);
1857
+ }
1858
+ componentDidRender() {
1859
+ var _a;
1860
+ (_a = this._viewStackRef) === null || _a === void 0 ? void 0 : _a.show(this._filterAssistentMode ? 0 : 1);
1861
+ if (this._elButtonMode) {
1862
+ this._elButtonMode.setAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME, ElementIDUtils.getInternalIDInfo(`${this._filterAssistentMode ? "advancedMode_ezButton" : "assistentMode_ezButton"}`));
1863
+ }
1864
+ }
1865
+ buildDataDefaultFilter(data) {
1866
+ data.name = DefaultFilter.name;
1867
+ data.id = DefaultFilter.id;
1868
+ }
1869
+ getMessage(key, params) {
1870
+ return this._application.messagesBuilder.getMessage(key, params);
1871
+ }
1872
+ async saveFilter() {
1873
+ let response;
1874
+ if (this.isDefaultFilter) {
1875
+ response = await ConfigStorage.saveDefaultFilter(this._filterAssistent, this.resourceID, this.configName);
1876
+ }
1877
+ else {
1878
+ response = await ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
1879
+ }
1880
+ this._elButtonSave.enabled = false;
1881
+ const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
1882
+ ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
1883
+ const updatedFilterAssistent = Object.assign(Object.assign({}, response), this._filterAssistent);
1884
+ updatedFilterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
1885
+ this._originalFilterAssistent = ObjectUtils.copy(updatedFilterAssistent);
1886
+ this._filterAssistent = ObjectUtils.copy(updatedFilterAssistent);
1887
+ this.ezAfterSave.emit();
1888
+ }
1889
+ removeFilter() {
1890
+ ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
1891
+ }
1892
+ hasChangesToSave() {
1893
+ return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
1894
+ }
1895
+ async handleSave() {
1896
+ if (this._filterAssistentMode) {
1897
+ const isValid = PersonalizedFilterUtils.validateFields(this._filterAssistent.assistent);
1898
+ if (!isValid || !this._filterAssistent.name)
1899
+ return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
1900
+ this.saveAssistentMode();
1901
+ }
1902
+ else {
1903
+ if (!this._filterAssistent.expression || !this._filterAssistent.name)
1904
+ return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
1905
+ const isValidExpressionForAdvancedMode = await this.validateExpressionBeforeSaving();
1906
+ if (!isValidExpressionForAdvancedMode)
1907
+ return;
1908
+ this.saveAdvancedMode();
1909
+ }
1910
+ }
1911
+ saveAssistentMode() {
1912
+ const { assistent, expression } = this._filterAssistent;
1913
+ const expressionQuery = !!assistent ? PersonalizedFilterUtils.buildGroupExpression(assistent) : expression;
1914
+ this._filterAssistent.expression = expressionQuery;
1915
+ this.ezSave.emit(expressionQuery);
1916
+ this.saveFilter();
1917
+ }
1918
+ saveAdvancedMode() {
1919
+ if (this._originalFilterAssistent.expression !== this._filterAssistent.expression && this._filterAssistent.assistent) {
1920
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.title"), this.getMessage("snkPersonalizedFilter.confirmSaveModeAdvanced.description"))
1921
+ .then((confirm) => {
1922
+ if (!confirm)
1923
+ return;
1924
+ this.saveAndTransformToAdvancedMode();
1925
+ });
1926
+ }
1927
+ else if (!this._filterAssistent.assistent) {
1928
+ this.saveAndTransformToAdvancedMode();
1929
+ }
1930
+ else {
1931
+ this.saveAssistentMode();
1932
+ }
1933
+ }
1934
+ saveAndTransformToAdvancedMode() {
1935
+ this._filterAssistent.assistent = undefined;
1936
+ this.ezSave.emit(this._filterAssistent.expression);
1937
+ this.saveFilter();
1938
+ }
1939
+ async validateExpressionBeforeSaving() {
1940
+ const { valid, message = "" } = await this._personalizedFilterFetcher.validatePersonalizedFilter(this.entityUri, this._filterAssistent.expression);
1941
+ valid || this._application.error(this.getMessage("snkPersonalizedFilter.errorValidation.title"), message.replace(/.*Exception: /, ''));
1942
+ return valid;
1943
+ }
1944
+ handleCancel() {
1945
+ if (this.hasChangesToSave()) {
1946
+ return this.ezCancel.emit();
1947
+ }
1948
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"), this.getMessage("snkPersonalizedFilter.confirmCancel.description"))
1949
+ .then((canCancel) => {
1950
+ var _a;
1951
+ if (!canCancel)
1952
+ return;
1953
+ this._filterAssistent = ObjectUtils.copy((_a = this._originalFilterAssistent) !== null && _a !== void 0 ? _a : {});
1954
+ this.ezCancel.emit();
1955
+ this._elButtonSave.enabled = false;
1956
+ });
1957
+ }
1958
+ handleTitleChange(name) {
1959
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { name });
1960
+ this._elButtonSave.enabled = !this.hasChangesToSave();
1961
+ }
1962
+ applyDefaultValues(personalizedFilter) {
1963
+ this.addLabelToItems(personalizedFilter);
1964
+ this.addFilterGroupCondition(personalizedFilter);
1965
+ return personalizedFilter;
1966
+ }
1967
+ addFilterGroupCondition(personalizedFilter) {
1968
+ if (personalizedFilter.assistent && !personalizedFilter.assistent.operand) {
1969
+ personalizedFilter.assistent.operand = FilterGroupCondition.AND;
1970
+ }
1971
+ }
1972
+ ;
1973
+ addLabelToItems(personalizedFilter) {
1974
+ //Workaround: Alguns filtros foram salvos sem o fieldLabel. Para evitar transtornos
1975
+ //tentamos usar o fieldLabel que pode estar informado no parametro.
1976
+ if (personalizedFilter.assistent && personalizedFilter.assistent.items && personalizedFilter.assistent.items.length > 0) {
1977
+ personalizedFilter.assistent.items.forEach(item => {
1978
+ if (item.fieldLabel == undefined) {
1979
+ const param = (personalizedFilter.parameters || []).find(param => param.fieldName === item.fieldName);
1980
+ if (param) {
1981
+ item.fieldLabel = param.label;
1982
+ }
1983
+ }
1984
+ });
1985
+ }
1986
+ }
1987
+ handleExpressionChangeAdvancedMode(expression) {
1988
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
1989
+ this._elButtonSave.enabled = !this.hasChangesToSave();
1990
+ }
1991
+ handleChangeFilterAssistentMode(filterAssistent) {
1992
+ this._elButtonSave.enabled = !this.hasChangesToSave();
1993
+ this._filterAssistent = Object.assign({}, filterAssistent);
1994
+ }
1995
+ selectField(fieldName) {
1996
+ if (!('name' in fieldName))
1997
+ return;
1998
+ const fieldExpression = this.buildExpression(fieldName.entityName, fieldName.name, fieldName.entityPath);
1999
+ const textAreaElement = this._elAdvancedMode.querySelector('ez-text-area');
2000
+ textAreaElement.appendTextToSelection(fieldExpression);
2001
+ }
2002
+ buildExpression(entityName, fieldName, entityPath) {
2003
+ if (entityPath.length > 0) {
2004
+ entityPath.shift();
2005
+ }
2006
+ return entityPath.length > 0 ? `${entityPath.join("->")}->${fieldName}` : `${entityName}.${fieldName}`;
2007
+ }
2008
+ onAddField(target) {
2009
+ const textAreaElement = this._elAdvancedMode.querySelector('ez-text-area');
2010
+ const options = { horizontalGap: 0, verticalGap: 12, fromRight: true };
2011
+ textAreaElement.setFocus();
2012
+ target.setBlur();
2013
+ if (this._elFilterFieldSearch)
2014
+ this._elFilterFieldSearch.show(target, options);
2015
+ }
2016
+ renderButtonAddField() {
2017
+ if (this._filterAssistentMode)
2018
+ return;
2019
+ 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 })));
2020
+ }
2021
+ buildContainerPersonalizedFilter() {
2022
+ return (h("ez-view-stack", { ref: (ref) => this._viewStackRef = ref }, h("stack-item", null, this._filterAssistentMode &&
2023
+ 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) }))));
2024
+ }
2025
+ handleModeChange() {
2026
+ var _a, _b;
2027
+ if (this._filterAssistentMode) {
2028
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.title"), this.getMessage("snkPersonalizedFilter.confirmChangeModeAssistent.description"))
2029
+ .then((canCancel) => {
2030
+ if (!canCancel)
2031
+ return;
2032
+ this._filterAssistentMode = !this._filterAssistentMode;
2033
+ if (!this.hasChangesToSave()) {
2034
+ const expression = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent);
2035
+ this._filterAssistent.expression = expression;
2036
+ this._elButtonSave.enabled = !this.hasChangesToSave();
2037
+ }
2038
+ });
2039
+ }
2040
+ else {
2041
+ if (((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.expression) === ((_b = this._originalFilterAssistent) === null || _b === void 0 ? void 0 : _b.expression)) {
2042
+ this._filterAssistentMode = !this._filterAssistentMode;
2043
+ }
2044
+ else {
2045
+ const expressionBefore = this._filterAssistent.expression;
2046
+ const expression = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent);
2047
+ if (expressionBefore !== expression) {
2048
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.title"), this.getMessage("snkPersonalizedFilter.confirmChangeModeAdvanced.description"))
2049
+ .then((canCancel) => {
2050
+ if (!canCancel)
2051
+ return;
2052
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
2053
+ this._filterAssistentMode = !this._filterAssistentMode;
2054
+ });
2055
+ }
2056
+ else {
2057
+ this._filterAssistentMode = !this._filterAssistentMode;
2058
+ }
2059
+ }
2060
+ }
2061
+ }
2062
+ buildTitle() {
2063
+ if (this.isDefaultFilter && !this.filterId) {
2064
+ return this.getMessage("snkPersonalizedFilter.info.titleCreateDefault");
2065
+ }
2066
+ if (this.isDefaultFilter && this.filterId) {
2067
+ return this.getMessage("snkPersonalizedFilter.info.titleEditDefault");
2068
+ }
2069
+ if (this.filterId) {
2070
+ return this.getMessage("snkPersonalizedFilter.info.titleEdit");
2071
+ }
2072
+ return this.getMessage("snkPersonalizedFilter.info.titleAdd");
2073
+ }
2074
+ render() {
2075
+ var _a, _b, _c, _d;
2076
+ if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
2077
+ return;
2078
+ }
2079
+ 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()))))));
2080
+ }
2081
+ static get watchers() { return {
2082
+ "filterId": ["loadFilter"]
2083
+ }; }
2084
+ };
2085
+ SnkPersonalizedFilter.style = snkPersonalizedFilterCss;
2086
+
2087
+ 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}";
2088
+
2089
+ const SnkSimpleBar = class {
2090
+ constructor(hostRef) {
2091
+ registerInstance(this, hostRef);
2092
+ this.clickBreadcrumbItem = createEvent(this, "clickBreadcrumbItem", 3);
2093
+ this.exit = createEvent(this, "exit", 3);
2094
+ this.label = undefined;
2095
+ this.breadcrumbItens = undefined;
2096
+ this.messagesBuilder = undefined;
2097
+ }
2098
+ /**
2099
+ * Permite customizar as mensagens dos blocos de construção
2100
+ * através de um pequeno módulo na estrutura da aplicação:
2101
+ * - Crie um arquivo no seguinte caminho: /messages/appmessages.msg.js.
2102
+ * Para conhecer os detalhes do módulo, veja o arquivo neste projeto: "/src/lib/message/resources/snk-simple-bar.msg.ts"
2103
+ */
2104
+ getMessage(key, params) {
2105
+ var _a;
2106
+ if (this.messagesBuilder)
2107
+ return this.messagesBuilder.getMessage(key, params);
2108
+ if ((_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder)
2109
+ return this._application.messagesBuilder.getMessage(key, params);
2110
+ }
2111
+ componentDidLoad() {
2112
+ if (!this._element)
2113
+ return;
2114
+ ElementIDUtils.addIDInfo(this._element);
2115
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
2116
+ }
2117
+ render() {
2118
+ 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" }))));
2119
+ }
2120
+ get _element() { return getElement(this); }
2121
+ };
2122
+ SnkSimpleBar.style = snkSimpleBarCss;
2123
+
2124
+ const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
2125
+ const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
2126
+
2127
+ 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}";
2128
+
2129
+ const SnkSimpleCrud = class {
2130
+ constructor(hostRef) {
2131
+ registerInstance(this, hostRef);
2132
+ this.dataStateChange = createEvent(this, "dataStateChange", 3);
2133
+ this.dataUnitReady = createEvent(this, "dataUnitReady", 3);
2134
+ this.actionClick = createEvent(this, "actionClick", 7);
2135
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
2136
+ this.configuratorSave = createEvent(this, "configuratorSave", 7);
2137
+ this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
2138
+ this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
2139
+ this._formConfigFetcher = new FormConfigFetcher();
2140
+ this._customEditors = new Map();
2141
+ this._customRenders = new Map();
2142
+ this._container = undefined;
2143
+ this._showPopUpGridConfig = false;
2144
+ this._currentViewMode = VIEW_MODE.GRID;
2145
+ this._config = undefined;
2146
+ this._fieldToGetFocus = undefined;
2147
+ this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
2148
+ this.enableLockManagerLoadingComp = false;
2149
+ this.enableLockManagerTaskbarClick = false;
2150
+ this.dataState = undefined;
2151
+ this.dataUnit = undefined;
2152
+ this.entityName = undefined;
2153
+ this.mode = SIMPLE_CRUD_MODE.SERVER;
2154
+ this.gridConfig = undefined;
2155
+ this.formConfig = undefined;
2156
+ this._formFields = [];
2157
+ this._fieldsProps = new Map();
2158
+ this.enableContinuousInsert = false;
2159
+ this.multipleSelection = undefined;
2160
+ this.useCancelConfirm = true;
2161
+ this.pageSize = 150;
2162
+ this.resourceID = undefined;
2163
+ this.enableGridInsert = false;
2164
+ this.paginationCounterMode = 'auto';
2165
+ this.taskbarManager = undefined;
2166
+ this.messagesBuilder = undefined;
2167
+ this.useEnterLikeTab = false;
2168
+ this.actionsList = undefined;
2169
+ this.configName = undefined;
2170
+ this.showConfiguratorButtons = false;
2171
+ this.gridLegacyConfigName = undefined;
2172
+ this.formLegacyConfigName = undefined;
2173
+ this.ignoreReadOnlyFormFields = false;
2174
+ this.autoFocus = true;
2175
+ this.domainMessagesBuilder = undefined;
2176
+ this.multipleEditionEnabled = true;
2177
+ this.layoutFormConfig = true;
2178
+ this.disableGridEdition = false;
2179
+ this.autoLoad = undefined;
2180
+ this.outlineMode = false;
2181
+ }
2182
+ /**
2183
+ * @description Registra um editor customizado para campos da grade e do formulário.
2184
+ * @param {string} fieldName - O nome do campo.
2185
+ * @param {ICustomEditor} customEditor - A instância do editor customizado.
2186
+ * @returns {Promise<void>}
2187
+ */
2188
+ async addCustomEditor(fieldName, customEditor) {
2189
+ if (this._grid && this._form) {
2190
+ this._grid.addCustomEditor(fieldName, customEditor);
2191
+ this._form.addCustomEditor(fieldName, customEditor);
2192
+ return;
2193
+ }
2194
+ const newCustomEditors = new Map(this._customEditors);
2195
+ newCustomEditors.set(fieldName, customEditor);
2196
+ this._customEditors = newCustomEditors;
2197
+ }
2198
+ /**
2199
+ * @description Registra um renderizador customizado para colunas da grade.
2200
+ * @param {string} fieldName - O nome do campo.
2201
+ * @param {ICustomRender} customRender - A instância do renderizador customizado.
2202
+ * @returns {Promise<void>}
2203
+ */
2204
+ async addGridCustomRender(fieldName, customRender) {
2205
+ if (this._grid) {
2206
+ this._grid.addGridCustomRender(fieldName, customRender);
2207
+ return;
2208
+ }
2209
+ const newCustomRenders = new Map(this._customRenders);
2210
+ newCustomRenders.set(fieldName, customRender);
2211
+ this._customRenders = newCustomRenders;
2212
+ }
2213
+ async handleResourceIDChanged(newValue, oldValue) {
2214
+ if (StringUtils.isEmpty(newValue)) {
2215
+ return;
2216
+ }
2217
+ if (newValue === oldValue) {
2218
+ return;
2219
+ }
2220
+ await this.loadFormConfig(true);
2221
+ await this.loadGridConfig(true);
2222
+ }
2223
+ /**
2224
+ * @description Registra um formatador de valores para uma coluna da grade.
2225
+ * @param {string} columnName - O nome da coluna.
2226
+ * @param {ICustomFormatter} customFormatter - A instância do formatador customizado.
2227
+ * @returns {Promise<void>}
2228
+ */
2229
+ async addCustomValueFormatter(columnName, customFormatter) {
2230
+ this._grid.addCustomValueFormatter(columnName, customFormatter);
2231
+ }
2232
+ /**
2233
+ * @description Remove o formatador de valores de uma coluna da grade.
2234
+ * @param {string} columnName - O nome da coluna.
2235
+ * @returns {Promise<void>}
2236
+ */
2237
+ async removeCustomValueFormatter(columnName) {
2238
+ this._grid.removeCustomValueFormatter(columnName);
2239
+ }
2240
+ /**
2241
+ * @description Altera/adiciona uma propriedade nos metadados do campo.
2242
+ * @param {string} fieldName - O nome do campo.
2243
+ * @param {string} propName - O nome da propriedade.
2244
+ * @param {any} value - O valor da propriedade.
2245
+ * @returns {Promise<void>}
2246
+ */
2247
+ async setFieldProp(fieldName, propName, value) {
2248
+ const newCustomFieldProps = new Map(this._fieldsProps);
2249
+ const currentProps = this._fieldsProps.get(fieldName);
2250
+ newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
2251
+ this._fieldsProps = newCustomFieldProps;
2252
+ }
2253
+ loadTaskbarProcessor() {
2254
+ const taskbarIDs = {};
2255
+ taskbarIDs[TASKBAR_ID.FORM_REGULAR] = this.getButtons(false, [TaskbarElement.GRID_MODE], true);
2256
+ taskbarIDs[TASKBAR_ID.GRID_REGULAR] = this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
2257
+ taskbarIDs[TASKBAR_ID.FORM_SELECTED] = this.getButtons(true, [TaskbarElement.GRID_MODE], true);
2258
+ taskbarIDs[TASKBAR_ID.GRID_SELECTED] = this.getGridSelectedButtonsCallBack.bind(this);
2259
+ taskbarIDs[TASKBAR_ID.FINISH_EDITION] = this.getFinishEditionButtonsCallback.bind(this);
2260
+ taskbarIDs[TASKBAR_ID.MULTIPLE_EDITION] = [TaskbarElement.CANCEL];
2261
+ this._taskbarProcessor = new TaskbarProcessor(taskbarIDs);
2262
+ }
2263
+ getGridSelectedButtonsCallBack() {
2264
+ var _a, _b, _c;
2265
+ 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) {
2266
+ return this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
2267
+ }
2268
+ return this.getButtons(true, [TaskbarElement.UPDATE_MULTIPLE, TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]);
2269
+ }
2270
+ getFinishEditionButtonsCallback() {
2271
+ const btns = [TaskbarElement.CANCEL, TaskbarElement.SAVE];
2272
+ if (this.enableGridInsert && this._currentViewMode !== VIEW_MODE.ATTACHMENT) {
2273
+ btns.push(this._currentViewMode === VIEW_MODE.GRID ? TaskbarElement.FORM_MODE : TaskbarElement.GRID_MODE);
2274
+ }
2275
+ return btns;
2276
+ }
2277
+ getButtons(selected, extraButtons, removeRefresh) {
2278
+ let btnList = selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS;
2279
+ if (removeRefresh || this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
2280
+ btnList = btnList.filter(item => item !== TaskbarElement.REFRESH);
2281
+ }
2282
+ return this.addConfigButton(btnList.concat(extraButtons));
2283
+ }
2284
+ addConfigButton(buttons) {
2285
+ if (this.configName === undefined || (this.configName && this.gridLegacyConfigName)) {
2286
+ return buttons;
2287
+ }
2288
+ return buttons.concat(TaskbarElement.CONFIGURATOR);
2289
+ }
2290
+ get application() {
2291
+ return ApplicationContext.getContextValue("__SNK__APPLICATION__");
2292
+ }
2293
+ /**
2294
+ * @description Usado para alternar a visão entre GRID e FORM externamente.
2295
+ * @param {VIEW_MODE} view - A visão para a qual navegar.
2296
+ * @returns {Promise<void>}
2297
+ */
2298
+ async goToView(view) {
2299
+ this._currentViewMode = view;
2300
+ if (this._viewStack) {
2301
+ if (view === VIEW_MODE.GRID)
2302
+ this.dataUnit.isMultipleEdition = false;
2303
+ this._viewStack.show(view);
2304
+ }
2305
+ if (view === VIEW_MODE.GRID) {
2306
+ requestAnimationFrame(() => this.focusToGrid());
2307
+ }
2308
+ if (view === VIEW_MODE.FORM) {
2309
+ requestAnimationFrame(() => this.focusToForm());
2310
+ }
2311
+ }
2312
+ actionClickListener(evt) {
2313
+ this.handleTaskbarAction(evt.detail);
2314
+ evt.stopPropagation();
2315
+ }
2316
+ handleTaskbarAction(action) {
2317
+ switch (action) {
2318
+ case TaskbarElement.CONFIGURATOR:
2319
+ this._snkConfigurator.open();
2320
+ break;
2321
+ case TaskbarElement.GRID_MODE:
2322
+ this.goToView(VIEW_MODE.GRID);
2323
+ break;
2324
+ case TaskbarElement.FORM_MODE:
2325
+ this.goToView(VIEW_MODE.FORM);
2326
+ break;
2327
+ case TaskbarElement.UPDATE_MULTIPLE:
2328
+ this.dataUnit.isMultipleEdition = true;
2329
+ this.goToView(VIEW_MODE.FORM);
2330
+ break;
2331
+ }
2332
+ }
2333
+ async onChangeEntityName(newValue) {
2334
+ if (this.dataUnit)
2335
+ return;
2336
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
2337
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
2338
+ }
2339
+ onModeChange() {
2340
+ if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
2341
+ this.initInMemoryDataUnit();
2342
+ }
2343
+ }
2344
+ observeDataState(newValue, oldValue) {
2345
+ this.handleDataStateChange(newValue, oldValue);
2346
+ }
2347
+ async observeFormLegacy(newValue, oldValue) {
2348
+ await this.handleUpdateFormLegacyConfig(newValue, oldValue);
2349
+ }
2350
+ async observeGridLegacy(newValue, oldValue) {
2351
+ await this.handleUpdateGridLegacyConfig(newValue, oldValue);
2352
+ }
2353
+ async handleDataStateChange(newValue, oldValue) {
2354
+ if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
2355
+ this.dataStateChange.emit(newValue);
2356
+ }
2357
+ await this.processRmPrecision();
2358
+ }
2359
+ async processRmPrecision() {
2360
+ var _a, _b;
2361
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
2362
+ for (const field of fieldsWithRmPrecision || []) {
2363
+ if (!field) {
2364
+ continue;
2365
+ }
2366
+ 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);
2367
+ if (!rmPrecision && rmPrecision !== 0) {
2368
+ continue;
2369
+ }
2370
+ await this.setFieldProp(field, 'precision', rmPrecision);
2371
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
2372
+ }
2373
+ this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
2374
+ }
2375
+ async handleUpdateGridLegacyConfig(newValue, oldValue) {
2376
+ if (newValue == undefined || newValue == oldValue) {
2377
+ return;
2378
+ }
2379
+ if (!this._gridConfigAlreadyLoaded) {
2380
+ return;
2381
+ }
2382
+ await this.loadGridConfig(true);
2383
+ }
2384
+ async handleUpdateFormLegacyConfig(newValue, oldValue) {
2385
+ if (newValue == undefined || newValue == oldValue) {
2386
+ return;
2387
+ }
2388
+ if (!this._formConfigAlreadyLoaded) {
2389
+ return;
2390
+ }
2391
+ await this.loadFormConfig(true);
2392
+ }
2393
+ async openConfig(viewMode) {
2394
+ await this._snkConfigurator.close();
2395
+ if (viewMode === VIEW_MODE.GRID) {
2396
+ await this.openGridConfig();
2397
+ }
2398
+ else if (viewMode === VIEW_MODE.FORM) {
2399
+ await this.openFormConfig();
2400
+ }
2401
+ }
2402
+ async openGridConfig() {
2403
+ var _a, _b, _c, _d;
2404
+ const originalColumns = (_b = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumns())) !== null && _b !== void 0 ? _b : [];
2405
+ const gridColumns = (_d = await ((_c = this._grid) === null || _c === void 0 ? void 0 : _c.getColumnsState())) !== null && _d !== void 0 ? _d : [];
2406
+ this._snkGridConfig.columns = gridColumns.filter(c => c.name);
2407
+ this._snkGridConfig.originalColumns = originalColumns.filter(c => c.name);
2408
+ this._snkGridConfig.selectedIndex = 0;
2409
+ this._showPopUpGridConfig = true;
2410
+ }
2411
+ async openFormConfig() {
2412
+ if (this.formLegacyConfigName || this.configName) {
2413
+ await this._snkSimpleFormConfig.show();
2414
+ }
2415
+ }
2416
+ addGridLegacyConfigName() {
2417
+ if (this.gridLegacyConfigName && this.configName) {
2418
+ ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
2419
+ }
2420
+ }
2421
+ loadGridConfig(forceUpdate) {
2422
+ if (this.configName === undefined) {
2423
+ return;
2424
+ }
2425
+ if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
2426
+ return;
2427
+ }
2428
+ this.addGridLegacyConfigName();
2429
+ this._gridConfigAlreadyLoaded = true;
2430
+ return new Promise((accept, reject) => {
2431
+ ConfigStorage.loadGridConfig(this.configName, this.resolveResourceID())
2432
+ .then(config => {
2433
+ this.setGridConfig(config);
2434
+ accept();
2435
+ })
2436
+ .catch(reason => {
2437
+ reject(reason);
2438
+ });
2439
+ });
2440
+ }
2441
+ formConfigIsLoaded() {
2442
+ return this.formConfig != undefined || this._formConfigAlreadyLoaded;
2443
+ }
2444
+ async loadFormConfig(forceLoad = false, forceSetNewConfig = false) {
2445
+ if (this.configName === undefined) {
2446
+ return;
2447
+ }
2448
+ if (this._formConfigManager == undefined) {
2449
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID(), undefined, this.dataUnit);
2450
+ this._formConfigManager.setConfig(this.formConfig);
2451
+ }
2452
+ if (this.formConfigIsLoaded() && !forceLoad) {
2453
+ return;
2454
+ }
2455
+ this._formConfigAlreadyLoaded = true;
2456
+ let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
2457
+ if (loadedLegacyConfig != undefined) {
2458
+ this._formConfigManager.setConfig(loadedLegacyConfig);
2459
+ this.setFormConfig(loadedLegacyConfig, forceSetNewConfig);
2460
+ return;
2461
+ }
2462
+ this.setFormConfig(await this._formConfigManager.loadConfig());
2463
+ }
2464
+ async componentWillRender() {
2465
+ this.loadTaskbarProcessor();
2466
+ this._resourceID = await this.application.getResourceID();
2467
+ this.dataExporterProviderStore();
2468
+ this.dataExporterProviderStore();
2469
+ this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
2470
+ if (this.configName === undefined) {
2471
+ return;
2472
+ }
2473
+ if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
2474
+ return;
2475
+ }
2476
+ await this.addGridLegacyConfigName();
2477
+ await this.loadGridConfig();
2478
+ await this.loadFormConfig();
2479
+ }
2480
+ componentDidRender() {
2481
+ this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
2482
+ this.addGridCustomValueFormattters();
2483
+ this.setFieldsProps();
2484
+ this.setCustomRenders();
2485
+ this.setCustomEditors();
2486
+ }
2487
+ componentWillLoad() {
2488
+ this.processMetadata();
2489
+ this.onModeChange();
2490
+ this.configDatasource();
2491
+ this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
2492
+ this._continuousInsertUtils = new ContinuousInsertUtils(this.application, this.resolveResourceID(), this.configName);
2493
+ if (this.enableGridInsert) {
2494
+ this._continuousInsertUtils.getConfig().then(value => this.enableContinuousInsert = value);
2495
+ }
2496
+ }
2497
+ componentDidLoad() {
2498
+ CSSVarsUtils.applyVarsGrid(this._element, this._grid);
2499
+ this.initKeyboardManager();
2500
+ this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
2501
+ }
2502
+ async dataUnitActionHandler(action) {
2503
+ if (action.type === Action.EDITION_CANCELED || action.type === Action.DATA_SAVED) {
2504
+ if (this.dataUnit.isMultipleEdition) {
2505
+ this.goToView(VIEW_MODE.GRID);
2506
+ }
2507
+ }
2508
+ }
2509
+ getMessage(key, params) {
2510
+ var _a;
2511
+ return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
2512
+ }
2513
+ disconnectedCallback() {
2514
+ var _a;
2515
+ (_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
2516
+ }
2517
+ setCustomRenders() {
2518
+ if (!this._grid) {
2519
+ return;
2520
+ }
2521
+ for (const [fieldName, customRender] of this._customRenders) {
2522
+ this._grid.addGridCustomRender(fieldName, customRender);
2523
+ this._customRenders.delete(fieldName);
2524
+ }
2525
+ }
2526
+ setCustomEditors() {
2527
+ if (!this._grid || !this._form) {
2528
+ return;
2529
+ }
2530
+ for (const [fieldName, customEditor] of this._customEditors) {
2531
+ this._grid.addCustomEditor(fieldName, customEditor);
2532
+ this._form.addCustomEditor(fieldName, customEditor);
2533
+ this._customEditors.delete(fieldName);
2534
+ }
2535
+ }
2536
+ configDatasource() {
2537
+ this._multiSelectionListDataSource.setApplication(this.application);
2538
+ this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
2539
+ }
2540
+ setFieldsProps() {
2541
+ if (!this._form) {
2542
+ return;
2543
+ }
2544
+ for (const [fieldName, props] of this._fieldsProps) {
2545
+ for (const prop in props) {
2546
+ this._form.setFieldProp(fieldName, prop, props[prop]);
2547
+ }
2548
+ this._fieldsProps.delete(fieldName);
2549
+ }
2550
+ }
2551
+ getTaskBarId() {
2552
+ var _a, _b;
2553
+ if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
2554
+ return TASKBAR_ID.FINISH_EDITION;
2555
+ }
2556
+ if (this.dataUnit.isMultipleEdition) {
2557
+ return TASKBAR_ID.MULTIPLE_EDITION;
2558
+ }
2559
+ if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
2560
+ !this.dataState.selectionInfo.isAllRecords() &&
2561
+ this.dataState.selectionInfo.length > 0) {
2562
+ return this._currentViewMode === VIEW_MODE.GRID ? TASKBAR_ID.GRID_SELECTED : TASKBAR_ID.FORM_SELECTED;
2563
+ }
2564
+ return this._currentViewMode === VIEW_MODE.GRID ? TASKBAR_ID.GRID_REGULAR : TASKBAR_ID.FORM_REGULAR;
2565
+ }
2566
+ initInMemoryDataUnit() {
2567
+ this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
2568
+ this.dataUnit = this._inMemoryLoader.dataUnit;
2569
+ this.dataUnitReady.emit(this.dataUnit);
2570
+ }
2571
+ /**
2572
+ * @description Define os metadados do DataUnit.
2573
+ * @param {UnitMetadata} metadata - Os metadados a serem definidos.
2574
+ * @returns {Promise<void>}
2575
+ */
2576
+ setMetadata(metadata) {
2577
+ if (this._inMemoryLoader) {
2578
+ this._inMemoryLoader.metadata = metadata;
2579
+ }
2580
+ else if (this.dataUnit) {
2581
+ this.dataUnit.metadata = metadata;
2582
+ }
2583
+ return Promise.resolve();
2584
+ }
2585
+ /**
2586
+ * @description Define os registros do DataUnit.
2587
+ * @param {Array<Record>} records - Os registros a serem definidos.
2588
+ * @returns {Promise<void>}
2589
+ */
2590
+ setRecords(records) {
2591
+ if (this._inMemoryLoader) {
2592
+ this._inMemoryLoader.records = records;
2593
+ }
2594
+ else if (this.dataUnit) {
2595
+ this.dataUnit.records = records;
2596
+ }
2597
+ return Promise.resolve();
2598
+ }
2599
+ /**
2600
+ * @description Obtém os registros do DataUnit.
2601
+ * @returns {Promise<Array<Record>>} Uma promessa que resolve com a lista de registros.
2602
+ */
2603
+ getRecords() {
2604
+ return Promise.resolve(this.dataUnit.records);
2605
+ }
2606
+ /**
2607
+ * @description Usado para abrir o configurador do CRUD.
2608
+ * @returns {Promise<void>}
2609
+ */
2610
+ async openConfigurator() {
2611
+ var _a;
2612
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.open();
2613
+ }
2614
+ /**
2615
+ * @description Usado para fechar o configurador do CRUD.
2616
+ * @returns {Promise<void>}
2617
+ */
2618
+ async closeConfigurator() {
2619
+ var _a;
2620
+ (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
2621
+ }
2622
+ /**
2623
+ * @description Atualiza a configuração do formulário.
2624
+ * @returns {Promise<void>}
2625
+ */
2626
+ async updateConfig() {
2627
+ if (this._formConfigManager == undefined) {
2628
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
2629
+ }
2630
+ this._formConfigManager.setConfig(this.formConfig);
2631
+ }
2632
+ processMetadata() {
2633
+ const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
2634
+ const fieldMetadata = [];
2635
+ const formConfig = { fields: [], emptyConfig: false };
2636
+ fieldsMetadataElem.forEach(fieldElem => {
2637
+ const field = {
2638
+ name: fieldElem.getAttribute("name") || fieldElem.getAttribute("label"),
2639
+ label: fieldElem.getAttribute("label"),
2640
+ dataType: DataType[fieldElem.getAttribute("dataType")] || DataType.TEXT,
2641
+ userInterface: UserInterface[fieldElem.getAttribute("userInterface")] || UserInterface.SHORTTEXT,
2642
+ readOnly: fieldElem.getAttribute("readOnly") == "true",
2643
+ required: fieldElem.getAttribute("required") == "true",
2644
+ tab: fieldElem.getAttribute("tab") || undefined,
2645
+ visible: fieldElem.getAttribute("visible") != "false"
2646
+ };
2647
+ const fieldConfig = { name: field.name, tab: field.tab, visible: field.visible };
2648
+ formConfig.fields.push(fieldConfig);
2649
+ fieldMetadata.push(field);
2650
+ });
2651
+ if (fieldMetadata.length > 0) {
2652
+ if (!this.formConfig) {
2653
+ this.formConfig = formConfig;
2654
+ }
2655
+ this._metadata = {
2656
+ name: "SimpleCrud",
2657
+ label: "SimpleCrud",
2658
+ fields: fieldMetadata
2659
+ };
2660
+ }
2661
+ }
2662
+ addGridCustomValueFormattters() {
2663
+ var _a, _b, _c;
2664
+ 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);
2665
+ if (!metadataFields) {
2666
+ return;
2667
+ }
2668
+ const fieldsWithRmPrecision = [];
2669
+ metadataFields.forEach((field) => {
2670
+ var _a;
2671
+ if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
2672
+ fieldsWithRmPrecision.push(field.name);
2673
+ }
2674
+ });
2675
+ fieldsWithRmPrecision.forEach(field => {
2676
+ this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
2677
+ });
2678
+ }
2679
+ onDataStateChange(evt) {
2680
+ this.dataState = Object.assign({}, evt.detail);
2681
+ }
2682
+ getTaskBarDisabledButtons() {
2683
+ var _a, _b, _c, _d, _e, _f;
2684
+ const disabledButtons = [];
2685
+ if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
2686
+ disabledButtons.push(TaskbarElement.NEXT);
2687
+ }
2688
+ if (!((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.hasPrevious)) {
2689
+ disabledButtons.push(TaskbarElement.PREVIOUS);
2690
+ }
2691
+ if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
2692
+ disabledButtons.push(TaskbarElement.FORM_MODE);
2693
+ }
2694
+ if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
2695
+ disabledButtons.push(TaskbarElement.CLONE);
2696
+ }
2697
+ return disabledButtons;
2698
+ }
2699
+ handleCancelEdit() {
2700
+ var _a;
2701
+ if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
2702
+ this.goToView(VIEW_MODE.GRID);
2703
+ this.dataUnit.clearSelection();
2704
+ }
2705
+ }
2706
+ handleConfiguratorEvent(evt, type) {
2707
+ evt.stopImmediatePropagation();
2708
+ if (type === 'SAVE') {
2709
+ this.configuratorSave.emit();
2710
+ return;
2711
+ }
2712
+ this.configuratorCancel.emit();
2713
+ }
2714
+ onSelectField(option) {
2715
+ if (option == undefined) {
2716
+ return;
2717
+ }
2718
+ this._fieldToGetFocus = option.value;
2719
+ }
2720
+ getFieldSearch(splitButton, item) {
2721
+ if (this._fieldSearch != undefined) {
2722
+ return this._fieldSearch;
2723
+ }
2724
+ this._splitButtonForm = splitButton;
2725
+ this._fieldSearch = buildFieldSearch(item, ({ argument }) => this.fieldsOptionLoader(argument), (option) => this.onSelectField(option));
2726
+ return this._fieldSearch;
2727
+ }
2728
+ getFormFields() {
2729
+ var _a, _b;
2730
+ return (_b = (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.fields) !== null && _b !== void 0 ? _b : this._formFields;
2731
+ }
2732
+ handleFormSetFields(fields) {
2733
+ if (!ObjectUtils.equals(this._formFields, fields)) {
2734
+ this._formFields = fields !== null && fields !== void 0 ? fields : [];
2735
+ }
2736
+ }
2737
+ fieldsOptionLoader(argument) {
2738
+ const searchTerm = argument === null || argument === void 0 ? void 0 : argument.toLowerCase();
2739
+ const allFields = this.getFormFields().map(field => { var _a; return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field.name); });
2740
+ const filteredFields = allFields.filter(field => {
2741
+ var _a, _b;
2742
+ return ((_a = field.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchTerm)) ||
2743
+ ((_b = field.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchTerm));
2744
+ });
2745
+ const options = filteredFields.map(field => ({ value: field.name, label: field.label }));
2746
+ return Promise.resolve(options);
2747
+ }
2748
+ isGridInsertActive() {
2749
+ return this.enableGridInsert && this.dataUnit.hasNewRecord();
2750
+ }
2751
+ getColumnSearch(splitButton, item) {
2752
+ if (this._columnSearch != undefined) {
2753
+ return this._columnSearch;
2754
+ }
2755
+ this._splitButton = splitButton;
2756
+ this._columnSearch = buildFieldSearch(item, ({ argument }) => new Promise(accept => {
2757
+ this._grid.filterColumns(argument).then((columns) => {
2758
+ accept(columns
2759
+ .filter(column => !column.hidden)
2760
+ .map(column => ({ label: column.label, value: column.name })));
2761
+ });
2762
+ }), (option) => {
2763
+ if (option != undefined) {
2764
+ this._grid.locateColumn(option.value);
2765
+ }
2766
+ });
2767
+ return this._columnSearch;
2768
+ }
2769
+ getActionsList() {
2770
+ const hardList = [];
2771
+ if (this.enableGridInsert) {
2772
+ hardList.push(this._continuousInsertUtils.actionContinuousInsert(this.enableContinuousInsert, () => {
2773
+ this.enableContinuousInsert = !this.enableContinuousInsert;
2774
+ this._continuousInsertUtils.handleSaveConfig(this.enableContinuousInsert);
2775
+ }));
2776
+ }
2777
+ if (this.isGridInsertActive())
2778
+ return hardList;
2779
+ if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
2780
+ const taskbarID = this.getTopTaskBarId();
2781
+ return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
2782
+ }
2783
+ return hardList.concat(this.actionsList);
2784
+ }
2785
+ getSettingsListGrid() {
2786
+ const hardList = [{
2787
+ value: StringUtils.generateUUID(),
2788
+ label: this.getMessage("snkSimpleCrud.findColumn"),
2789
+ disableCloseOnSelect: true,
2790
+ eagerInitialize: true,
2791
+ itemBuilder: (splitButton, item) => this.getColumnSearch(splitButton, item)
2792
+ }];
2793
+ return hardList;
2794
+ }
2795
+ getSettingsListForm() {
2796
+ const hardList = [{
2797
+ value: StringUtils.generateUUID(),
2798
+ label: this.getMessage("snkSimpleCrud.findFields"),
2799
+ disableCloseOnSelect: true,
2800
+ eagerInitialize: true,
2801
+ itemBuilder: (splitButton, item) => this.getFieldSearch(splitButton, item)
2802
+ }];
2803
+ return hardList;
2804
+ }
2805
+ getTopTaskBarId() {
2806
+ var _a;
2807
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${PresentationMode.PRIMARY}` :
2808
+ `snkGridTopTaskbar.regular${PresentationMode.PRIMARY}`;
2809
+ }
2810
+ clearFieldToFocusHandler() {
2811
+ this._fieldToGetFocus = undefined;
2812
+ }
2813
+ gridConfigChangeHandler(evt) {
2814
+ evt.stopPropagation();
2815
+ if (!this.configName)
2816
+ return;
2817
+ const config = evt.detail;
2818
+ ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
2819
+ }
2820
+ modalConfigChangeHandler(evt) {
2821
+ const config = evt.detail;
2822
+ this._grid.setColumnsState(config.columns)
2823
+ .then(() => {
2824
+ this.setGridConfig(config);
2825
+ this.closeGridConfig();
2826
+ this.dataExporterProviderStore();
2827
+ });
2828
+ evt.stopPropagation();
2829
+ }
2830
+ async dataExporterProviderStore() {
2831
+ if (this.dataUnit == undefined) {
2832
+ return;
2833
+ }
2834
+ if (this._grid == undefined) {
2835
+ return;
2836
+ }
2837
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
2838
+ store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
2839
+ }
2840
+ getDataExporterStoreKey() {
2841
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
2842
+ }
2843
+ setGridConfig(config) {
2844
+ this.gridConfig = config;
2845
+ CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
2846
+ }
2847
+ setFormConfig(config, forceUpdate) {
2848
+ if (this.formConfig && !forceUpdate)
2849
+ return;
2850
+ this.formConfig = config;
2851
+ }
2852
+ closeGridConfig() {
2853
+ this._showPopUpGridConfig = false;
2854
+ }
2855
+ getPageSize() {
2856
+ if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
2857
+ return 0;
2858
+ }
2859
+ if (this.pageSize == undefined) {
2860
+ return 150;
2861
+ }
2862
+ return this.pageSize;
2863
+ }
2864
+ resolveResourceID() {
2865
+ return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
2866
+ }
2867
+ getFormConfig() {
2868
+ var _a;
2869
+ const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
2870
+ if (!this.configName && !configFromManager) {
2871
+ return this.formConfig;
2872
+ }
2873
+ return configFromManager;
2874
+ }
2875
+ updateFormConfig() {
2876
+ let newConfig = this.formConfig;
2877
+ if (this.formLegacyConfigName == undefined) {
2878
+ newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
2879
+ }
2880
+ this.setFormConfig(newConfig, true);
2881
+ if (this._formConfigManager == undefined) {
2882
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
2883
+ }
2884
+ this._formConfigManager.setConfig(this.formConfig);
2885
+ }
2886
+ handleDataUnitOnInsertionMode() {
2887
+ if (this.enableGridInsert)
2888
+ return;
2889
+ this.goToView(VIEW_MODE.FORM);
2890
+ }
2891
+ async initKeyboardManager() {
2892
+ var _a;
2893
+ this._keyboardManager = new KeyboardManager({ propagate: false, element: this._element });
2894
+ const dataUnit = this.dataUnit || await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
2895
+ if (dataUnit == undefined) {
2896
+ return;
2897
+ }
2898
+ this._keyboardManager
2899
+ .bind("F7", () => dataUnit.saveData(), { description: this.getMessage("snkSimpleCrud.keyboardShortcuts.saveData"), element: this._element })
2900
+ .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: this.getMessage("snkSimpleCrud.keyboardShortcuts.addRecord"), element: this._element })
2901
+ .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: this.getMessage("snkSimpleCrud.keyboardShortcuts.removeRecord"), element: this._element })
2902
+ .bind("Escape", () => {
2903
+ if (dataUnit.isDirty()) {
2904
+ dataUnit.cancelEdition();
2905
+ }
2906
+ }, {
2907
+ debounceTime: 1000,
2908
+ description: this.getMessage("snkSimpleCrud.keyboardShortcuts.cancelAction"), element: this._element
2909
+ });
2910
+ }
2911
+ async handleFormConfigSaved() {
2912
+ await this.loadFormConfig(true, true);
2913
+ }
2914
+ focusToGrid() {
2915
+ const gridElement = this._grid;
2916
+ gridElement.focus();
2917
+ }
2918
+ focusToForm() {
2919
+ const formElement = this._form;
2920
+ formElement.focus();
2921
+ }
2922
+ renderTaskbarContent(layout) {
2923
+ var _a;
2924
+ 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" })));
2925
+ }
2926
+ /* istanbul ignore next */
2927
+ render() {
2928
+ var _a;
2929
+ if (this.dataUnit == undefined) {
2930
+ return;
2931
+ }
2932
+ 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)
2933
+ ? undefined
2934
+ : 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() }))));
2935
+ }
2936
+ get _element() { return getElement(this); }
2937
+ static get watchers() { return {
2938
+ "resourceID": ["handleResourceIDChanged"],
2939
+ "entityName": ["onChangeEntityName"],
2940
+ "mode": ["onModeChange"],
2941
+ "dataState": ["observeDataState"],
2942
+ "formLegacyConfigName": ["observeFormLegacy"],
2943
+ "gridLegacyConfigName": ["observeGridLegacy"]
2944
+ }; }
2945
+ };
2946
+ var TASKBAR_ID;
2947
+ (function (TASKBAR_ID) {
2948
+ TASKBAR_ID["FORM_REGULAR"] = "snkSimpleCrudTaskbar.form_regular";
2949
+ TASKBAR_ID["GRID_REGULAR"] = "snkSimpleCrudTaskbar.grid_regular";
2950
+ TASKBAR_ID["FORM_SELECTED"] = "snkSimpleCrudTaskbar.form_selected";
2951
+ TASKBAR_ID["GRID_SELECTED"] = "snkSimpleCrudTaskbar.grid_selected";
2952
+ TASKBAR_ID["FINISH_EDITION"] = "snkSimpleCrudTaskbar.finish_edition";
2953
+ TASKBAR_ID["MULTIPLE_EDITION"] = "snkSimpleCrudTaskbar.multiple_edition";
2954
+ })(TASKBAR_ID || (TASKBAR_ID = {}));
2955
+ SnkSimpleCrud.style = snkSimpleCrudCss;
2956
+
2957
+ 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 };