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