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

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