@sankhyalabs/sankhyablocks 8.16.0-dev.11 → 8.16.0-dev.110

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 (438) hide show
  1. package/dist/cjs/ClientSideExporterProvider-a2753c93.js +378 -0
  2. package/dist/cjs/{ConfigStorage-e49214c6.js → ConfigStorage-df09fb78.js} +2 -2
  3. package/dist/cjs/{DataFetcher-77729a93.js → DataFetcher-1afdb18e.js} +231 -84
  4. package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
  5. package/dist/cjs/IFetchDataExporterParams-e78ec415.js +8 -0
  6. package/dist/cjs/ISave-c76e2c51.js +397 -0
  7. package/dist/cjs/{SnkFormConfigManager-beebf47a.js → SnkFormConfigManager-45a8d7b7.js} +75 -17
  8. package/dist/cjs/{SnkMessageBuilder-897ffd08.js → SnkMessageBuilder-aecd7c18.js} +37 -26
  9. package/dist/cjs/{auth-fetcher-29bb791c.js → auth-fetcher-1687ac0a.js} +1 -1
  10. package/dist/cjs/{constants-35ddd366.js → constants-77c1b8bd.js} +10 -0
  11. package/dist/cjs/{dataunit-fetcher-d4873076.js → dataunit-fetcher-a723f0dc.js} +225 -175
  12. package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
  13. package/dist/cjs/{form-config-fetcher-feb08214.js → form-config-fetcher-40d3f752.js} +56 -2
  14. package/dist/cjs/{index-1dfc7a6e.js → index-e3e39724.js} +5 -0
  15. package/dist/cjs/index-f9e81701.js +16 -32
  16. package/dist/cjs/loader.cjs.js +1 -1
  17. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +155 -0
  18. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  19. package/dist/cjs/{snk-actions-button_4.cjs.entry.js → snk-actions-button_7.cjs.entry.js} +203 -46
  20. package/dist/cjs/snk-application.cjs.entry.js +471 -79
  21. package/dist/cjs/snk-attach.cjs.entry.js +91 -50
  22. package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +401 -13
  23. package/dist/cjs/snk-configurator.cjs.entry.js +10 -3
  24. package/dist/cjs/snk-crud.cjs.entry.js +57 -60
  25. package/dist/cjs/snk-data-exporter.cjs.entry.js +38 -30
  26. package/dist/cjs/{snk-data-unit-ece44c4a.js → snk-data-unit-ebfdb9ba.js} +275 -37
  27. package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
  28. package/dist/cjs/snk-detail-view.cjs.entry.js +17 -17
  29. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  30. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  31. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +1438 -0
  32. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  34. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  35. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-filter-search.cjs.entry.js +18 -5
  37. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -1
  38. package/dist/cjs/snk-grid.cjs.entry.js +115 -33
  39. package/dist/cjs/{snk-guides-viewer-aafc3073.js → snk-guides-viewer-fd39f437.js} +120 -55
  40. package/dist/cjs/snk-guides-viewer.cjs.entry.js +11 -12
  41. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +4 -4
  42. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  43. package/dist/cjs/snk-pesquisa.cjs.entry.js +116 -31
  44. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  45. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  46. package/dist/cjs/snk-simple-crud.cjs.entry.js +179 -130
  47. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  48. package/dist/cjs/snk-taskbar.cjs.entry.js +73 -40
  49. package/dist/cjs/{taskbar-elements-9ad1f9c0.js → taskbar-elements-02379452.js} +4 -1
  50. package/dist/collection/collection-manifest.json +16 -31
  51. package/dist/collection/components/snk-actions-button/actions/index.js +16 -13
  52. package/dist/collection/components/snk-actions-button/interfaces/index.js +1 -0
  53. package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
  54. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +5 -2
  55. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +29 -0
  56. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  57. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  58. package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-plus.js +107 -0
  59. package/dist/collection/components/snk-application/snk-application.css +36 -0
  60. package/dist/collection/components/snk-application/snk-application.js +450 -72
  61. package/dist/collection/components/snk-attach/snk-attach.js +51 -16
  62. package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
  63. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +19 -18
  64. package/dist/collection/components/snk-configurator/snk-configurator.css +1 -1
  65. package/dist/collection/components/snk-configurator/snk-configurator.js +26 -1
  66. package/dist/collection/components/snk-crud/snk-crud.js +181 -52
  67. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.css +10 -1
  68. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +27 -3
  69. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
  70. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +165 -45
  71. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  72. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +8 -8
  73. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +9 -2
  74. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +41 -10
  75. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +18 -6
  76. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  77. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +10 -9
  78. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  79. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +4 -4
  80. package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +1 -1
  81. package/dist/collection/components/snk-data-unit/MultipleUpdateHelper.js +128 -0
  82. package/dist/collection/components/snk-data-unit/snk-data-unit.js +156 -37
  83. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +3 -3
  84. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  85. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
  86. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +1 -1
  87. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +18 -5
  88. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +2 -1
  89. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.css +13 -0
  90. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +3 -3
  91. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.js +8 -0
  92. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +10 -4
  93. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +1 -1
  94. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +3 -1
  95. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -6
  96. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +119 -29
  97. package/dist/collection/components/snk-form/snk-form.js +2 -2
  98. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +73 -15
  99. package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
  100. package/dist/collection/components/snk-form-config/snk-form-config.js +49 -8
  101. package/dist/collection/components/snk-form-config/subcomponents/snk-config-options/snk-config-options.js +5 -3
  102. package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +2 -2
  103. package/dist/collection/components/snk-grid/snk-grid.css +8 -0
  104. package/dist/collection/components/snk-grid/snk-grid.js +236 -18
  105. package/dist/collection/components/snk-grid-config/snk-grid-config.css +1 -1
  106. package/dist/collection/components/snk-grid-config/snk-grid-config.js +2 -0
  107. package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.css +3 -0
  108. package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.js +73 -0
  109. package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.css +78 -0
  110. package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.js +57 -0
  111. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +9 -0
  112. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +226 -0
  113. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +28 -0
  114. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +208 -0
  115. package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +99 -0
  116. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +35 -6
  117. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +181 -32
  118. package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
  119. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
  120. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +1 -1
  121. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +280 -51
  122. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.css +22 -0
  123. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.js +181 -0
  124. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.css +13 -0
  125. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +1 -1
  126. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
  127. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
  128. package/dist/collection/components/snk-taskbar/snk-taskbar.js +113 -39
  129. package/dist/collection/lib/@types/index.js +5 -0
  130. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +11 -5
  131. package/dist/collection/lib/configs/LayoutFormConfig.js +25 -0
  132. package/dist/collection/lib/dataUnit/InMemoryLoader.js +12 -103
  133. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +11 -32
  134. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +44 -29
  135. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
  136. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +59 -14
  137. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +21 -7
  138. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +5 -2
  139. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.js +108 -0
  140. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +23 -14
  141. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.js +6 -1
  142. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +59 -5
  143. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +7 -1
  144. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +133 -9
  145. package/dist/collection/lib/index.js +1 -0
  146. package/dist/collection/lib/message/SnkMessageBuilder.js +1 -0
  147. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +28 -23
  148. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  149. package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
  150. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  151. package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
  152. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  153. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  154. package/dist/collection/lib/utils/constants.js +10 -0
  155. package/dist/collection/sw.js +46 -0
  156. package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +186 -37
  157. package/dist/components/DataFetcher.js +231 -84
  158. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  159. package/dist/components/ISave.js +391 -1
  160. package/dist/components/SnkFormConfigManager.js +73 -15
  161. package/dist/components/SnkMessageBuilder.js +37 -26
  162. package/dist/components/constants.js +11 -1
  163. package/dist/components/dataunit-fetcher.js +243 -190
  164. package/dist/components/form-config-fetcher.js +55 -1
  165. package/dist/components/index.d.ts +5 -0
  166. package/dist/components/index.js +5 -0
  167. package/dist/components/pesquisa-grid.d.ts +11 -0
  168. package/dist/components/pesquisa-grid.js +6 -0
  169. package/dist/components/pesquisa-grid2.js +102 -0
  170. package/dist/components/pesquisa-tree.d.ts +11 -0
  171. package/dist/components/pesquisa-tree.js +6 -0
  172. package/dist/components/pesquisa-tree2.js +91 -0
  173. package/dist/components/snk-actions-button2.js +44 -40
  174. package/dist/components/snk-application2.js +494 -77
  175. package/dist/components/snk-attach2.js +103 -68
  176. package/dist/components/snk-config-options2.js +6 -4
  177. package/dist/components/snk-configurator2.js +23 -3
  178. package/dist/components/snk-crud.js +135 -113
  179. package/dist/components/snk-data-exporter2.js +37 -23
  180. package/dist/components/snk-data-unit2.js +275 -74
  181. package/dist/components/snk-detail-view2.js +230 -148
  182. package/dist/components/snk-exporter-email-sender2.js +1 -1
  183. package/dist/components/snk-filter-bar2.js +68 -34
  184. package/dist/components/snk-filter-binary-select.js +1 -1
  185. package/dist/components/snk-filter-checkbox-list.js +1 -1
  186. package/dist/components/snk-filter-item2.js +10 -4
  187. package/dist/components/snk-filter-modal.js +4 -2
  188. package/dist/components/snk-filter-number.js +1 -1
  189. package/dist/components/snk-filter-search.js +18 -5
  190. package/dist/components/snk-filter-text.js +2 -1
  191. package/dist/components/snk-form-config2.js +35 -10
  192. package/dist/components/snk-form.js +2 -2
  193. package/dist/components/snk-grid-config2.js +3 -1
  194. package/dist/components/snk-grid2.js +112 -23
  195. package/dist/components/snk-layout-form-config.d.ts +11 -0
  196. package/dist/components/snk-layout-form-config.js +6 -0
  197. package/dist/components/snk-layout-form-config2.js +73 -0
  198. package/dist/components/snk-personalized-filter-editor.js +4 -4
  199. package/dist/components/snk-pesquisa2.js +132 -33
  200. package/dist/components/snk-print-selector.js +1 -1
  201. package/dist/components/snk-simple-bar2.js +1 -1
  202. package/dist/components/snk-simple-crud2.js +176 -128
  203. package/dist/components/snk-simple-form-config.d.ts +11 -0
  204. package/dist/components/snk-simple-form-config.js +6 -0
  205. package/dist/components/snk-simple-form-config2.js +121 -0
  206. package/dist/components/snk-tab-config2.js +1 -1
  207. package/dist/components/snk-taskbar2.js +76 -40
  208. package/dist/components/snk-view-representation.d.ts +11 -0
  209. package/dist/components/snk-view-representation.js +6 -0
  210. package/dist/components/snk-view-representation2.js +41 -0
  211. package/dist/components/taskbar-actions-button2.js +2 -2
  212. package/dist/components/teste-pesquisa.js +13 -1
  213. package/dist/esm/ClientSideExporterProvider-b3871edb.js +367 -0
  214. package/dist/esm/{ConfigStorage-e476378d.js → ConfigStorage-71e6766f.js} +2 -2
  215. package/dist/esm/{DataFetcher-773a3e4b.js → DataFetcher-88e56266.js} +231 -84
  216. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  217. package/dist/esm/IFetchDataExporterParams-d73bed3d.js +8 -0
  218. package/dist/esm/ISave-5efafc97.js +394 -0
  219. package/dist/esm/{SnkFormConfigManager-298cd647.js → SnkFormConfigManager-be490a33.js} +75 -17
  220. package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-12f5fe1a.js} +37 -26
  221. package/dist/esm/{auth-fetcher-a411f73c.js → auth-fetcher-3510520e.js} +1 -1
  222. package/dist/esm/{constants-8457af36.js → constants-7db1128a.js} +11 -1
  223. package/dist/esm/{dataunit-fetcher-3d2ec959.js → dataunit-fetcher-0e025732.js} +227 -174
  224. package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
  225. package/dist/esm/{form-config-fetcher-e0382e5a.js → form-config-fetcher-fa208a6c.js} +56 -2
  226. package/dist/esm/index-a7d3d3f1.js +16 -32
  227. package/dist/esm/{index-3aa4977a.js → index-b40568ff.js} +6 -1
  228. package/dist/esm/loader.js +1 -1
  229. package/dist/esm/pesquisa-grid_2.entry.js +150 -0
  230. package/dist/esm/sankhyablocks.js +1 -1
  231. package/dist/esm/{snk-actions-button_4.entry.js → snk-actions-button_7.entry.js} +203 -49
  232. package/dist/esm/snk-application.entry.js +472 -80
  233. package/dist/esm/snk-attach.entry.js +92 -51
  234. package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +401 -15
  235. package/dist/esm/snk-configurator.entry.js +10 -3
  236. package/dist/esm/snk-crud.entry.js +58 -61
  237. package/dist/esm/snk-data-exporter.entry.js +38 -30
  238. package/dist/esm/{snk-data-unit-2a1d5d09.js → snk-data-unit-03654813.js} +275 -37
  239. package/dist/esm/snk-data-unit.entry.js +5 -5
  240. package/dist/esm/snk-detail-view.entry.js +17 -17
  241. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  242. package/dist/esm/snk-field-config.entry.js +1 -1
  243. package/dist/esm/snk-filter-bar_4.entry.js +1431 -0
  244. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  245. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  246. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  247. package/dist/esm/snk-filter-number.entry.js +1 -1
  248. package/dist/esm/snk-filter-search.entry.js +18 -5
  249. package/dist/esm/snk-filter-text.entry.js +2 -1
  250. package/dist/esm/snk-grid.entry.js +110 -28
  251. package/dist/esm/{snk-guides-viewer-62124f3d.js → snk-guides-viewer-75e06feb.js} +121 -56
  252. package/dist/esm/snk-guides-viewer.entry.js +11 -12
  253. package/dist/esm/snk-personalized-filter-editor.entry.js +4 -4
  254. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  255. package/dist/esm/snk-pesquisa.entry.js +116 -31
  256. package/dist/esm/snk-print-selector.entry.js +1 -1
  257. package/dist/esm/snk-simple-bar.entry.js +1 -1
  258. package/dist/esm/snk-simple-crud.entry.js +165 -116
  259. package/dist/esm/snk-tab-config.entry.js +1 -1
  260. package/dist/esm/snk-taskbar.entry.js +74 -41
  261. package/dist/esm/{taskbar-elements-d59867f1.js → taskbar-elements-c62b6c66.js} +4 -1
  262. package/dist/sankhyablocks/{p-3287a6cc.js → p-03b68a74.js} +1 -1
  263. package/dist/sankhyablocks/p-0f3698af.js +1 -0
  264. package/dist/sankhyablocks/{p-9dfda04a.entry.js → p-165cde3b.entry.js} +1 -1
  265. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  266. package/dist/sankhyablocks/p-1a51dfde.entry.js +1 -0
  267. package/dist/sankhyablocks/p-23736d75.js +1 -0
  268. package/dist/sankhyablocks/p-271c86d3.entry.js +1 -0
  269. package/dist/sankhyablocks/p-2c08fa3e.entry.js +11 -0
  270. package/dist/sankhyablocks/p-2d6df7e7.entry.js +1 -0
  271. package/dist/sankhyablocks/{p-95df461f.entry.js → p-3749dffb.entry.js} +1 -1
  272. package/dist/sankhyablocks/p-41da5310.js +1 -0
  273. package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
  274. package/dist/sankhyablocks/p-47178038.entry.js +1 -0
  275. package/dist/sankhyablocks/{p-bd008859.entry.js → p-490b75b5.entry.js} +1 -1
  276. package/dist/sankhyablocks/p-4a93daef.entry.js +1 -0
  277. package/dist/sankhyablocks/p-4e861843.entry.js +1 -0
  278. package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
  279. package/dist/sankhyablocks/p-5ffa0493.entry.js +1 -0
  280. package/dist/sankhyablocks/p-60137b7a.entry.js +1 -0
  281. package/dist/sankhyablocks/p-601b252b.js +26 -0
  282. package/dist/sankhyablocks/p-65be98c5.entry.js +1 -0
  283. package/dist/sankhyablocks/p-6a0c8ce0.entry.js +1 -0
  284. package/dist/sankhyablocks/p-6dd38d7b.js +6 -0
  285. package/dist/sankhyablocks/{p-0cd3c0a9.js → p-73285a8a.js} +1 -1
  286. package/dist/sankhyablocks/p-7993b2e3.js +60 -0
  287. package/dist/sankhyablocks/p-79f823f3.entry.js +1 -0
  288. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  289. package/dist/sankhyablocks/p-80f8c22c.js +1 -0
  290. package/dist/sankhyablocks/p-885802c3.js +1 -0
  291. package/dist/sankhyablocks/p-89c92727.entry.js +1 -0
  292. package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
  293. package/dist/sankhyablocks/p-8f3f2306.js +1 -0
  294. package/dist/sankhyablocks/p-90684a75.entry.js +1 -0
  295. package/dist/sankhyablocks/{p-b0ef4383.js → p-9261d8a0.js} +1 -1
  296. package/dist/sankhyablocks/p-a14a09c3.entry.js +1 -0
  297. package/dist/sankhyablocks/p-ad07f0c5.entry.js +1 -0
  298. package/dist/sankhyablocks/p-b0ab5066.entry.js +1 -0
  299. package/dist/sankhyablocks/p-b6200d32.entry.js +1 -0
  300. package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-c0eb761b.entry.js} +1 -1
  301. package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
  302. package/dist/sankhyablocks/p-cc8c3bca.entry.js +1 -0
  303. package/dist/sankhyablocks/p-cf1f25ed.entry.js +1 -0
  304. package/dist/sankhyablocks/p-ebdb9d89.js +1 -0
  305. package/dist/sankhyablocks/p-f4d5bb7f.js +1 -0
  306. package/dist/sankhyablocks/p-fb0f0087.js +1 -0
  307. package/dist/sankhyablocks/p-fbba7e3d.js +1 -0
  308. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  309. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  310. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
  311. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
  312. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  313. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  314. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  315. package/dist/types/components/snk-application/search-strategy/exec-prepared-search-plus.d.ts +5 -0
  316. package/dist/types/components/snk-application/snk-application.d.ts +55 -16
  317. package/dist/types/components/snk-attach/snk-attach.d.ts +2 -0
  318. package/dist/types/components/snk-configurator/snk-configurator.d.ts +6 -0
  319. package/dist/types/components/snk-crud/snk-crud.d.ts +30 -0
  320. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +5 -0
  321. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +20 -1
  322. package/dist/types/components/snk-data-exporter/data/export-result.d.ts +2 -1
  323. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +1 -0
  324. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +9 -1
  325. package/dist/types/components/snk-data-exporter/interfaces/IRecordID.d.ts +1 -0
  326. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +3 -1
  327. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +3 -3
  328. package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +1 -1
  329. package/dist/types/components/snk-data-unit/MultipleUpdateHelper.d.ts +9 -0
  330. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +19 -0
  331. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +5 -3
  332. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.d.ts +7 -0
  333. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
  334. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +15 -1
  335. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
  336. package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
  337. package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +2 -1
  338. package/dist/types/components/snk-grid/snk-grid.d.ts +38 -0
  339. package/dist/types/components/snk-grid-config/snk-grid-config.d.ts +1 -0
  340. package/dist/types/components/snk-layout-form-config/snk-layout-form-config.d.ts +15 -0
  341. package/dist/types/components/snk-layout-form-config/snk-view-representation/snk-view-representation.d.ts +10 -0
  342. package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +44 -0
  343. package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +33 -0
  344. package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +24 -0
  345. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +36 -1
  346. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +41 -5
  347. package/dist/types/components/snk-simple-form-config/snk-simple-form-config.d.ts +34 -0
  348. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  349. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
  350. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +12 -0
  351. package/dist/types/components.d.ts +501 -16
  352. package/dist/types/lib/@types/index.d.ts +4 -0
  353. package/dist/types/lib/configs/LayoutFormConfig.d.ts +11 -0
  354. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +4 -11
  355. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +9 -2
  356. package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +2 -2
  357. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  358. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
  359. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +9 -1
  360. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +4 -0
  361. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -1
  362. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.d.ts +6 -0
  363. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +4 -0
  364. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +3 -3
  365. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +6 -2
  366. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +14 -2
  367. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
  368. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +21 -2
  369. package/dist/types/lib/index.d.ts +1 -0
  370. package/dist/types/lib/message/SnkMessageBuilder.d.ts +2 -1
  371. package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
  372. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  373. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  374. package/dist/types/lib/utils/constants.d.ts +8 -0
  375. package/package.json +4 -3
  376. package/react/components.d.ts +5 -0
  377. package/react/components.js +5 -0
  378. package/react/components.js.map +1 -1
  379. package/dist/cjs/IExporterProvider-10b7fed5.js +0 -230
  380. package/dist/cjs/ISave-e91b70a7.js +0 -9
  381. package/dist/cjs/pesquisa-fetcher-a1d0353f.js +0 -166
  382. package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
  383. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -714
  384. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
  385. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
  386. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
  387. package/dist/cjs/snk-form.cjs.entry.js +0 -143
  388. package/dist/components/pesquisa-fetcher.js +0 -164
  389. package/dist/esm/IExporterProvider-d597f27d.js +0 -221
  390. package/dist/esm/ISave-d8c8bc59.js +0 -9
  391. package/dist/esm/pesquisa-fetcher-a87445a0.js +0 -164
  392. package/dist/esm/snk-config-options.entry.js +0 -235
  393. package/dist/esm/snk-filter-bar.entry.js +0 -710
  394. package/dist/esm/snk-filter-item.entry.js +0 -308
  395. package/dist/esm/snk-filter-list.entry.js +0 -148
  396. package/dist/esm/snk-filter-modal.entry.js +0 -245
  397. package/dist/esm/snk-form.entry.js +0 -139
  398. package/dist/sankhyablocks/p-01ba23cd.entry.js +0 -1
  399. package/dist/sankhyablocks/p-091ce761.js +0 -60
  400. package/dist/sankhyablocks/p-14b8b656.entry.js +0 -1
  401. package/dist/sankhyablocks/p-181975f1.js +0 -26
  402. package/dist/sankhyablocks/p-1e971cb0.entry.js +0 -1
  403. package/dist/sankhyablocks/p-21749402.js +0 -1
  404. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  405. package/dist/sankhyablocks/p-25f1fc39.js +0 -6
  406. package/dist/sankhyablocks/p-2e9c764c.entry.js +0 -1
  407. package/dist/sankhyablocks/p-30cf616e.js +0 -1
  408. package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
  409. package/dist/sankhyablocks/p-421bec84.entry.js +0 -1
  410. package/dist/sankhyablocks/p-42f7b05d.entry.js +0 -1
  411. package/dist/sankhyablocks/p-51999ab5.entry.js +0 -1
  412. package/dist/sankhyablocks/p-594bc21d.js +0 -1
  413. package/dist/sankhyablocks/p-5f016aed.js +0 -1
  414. package/dist/sankhyablocks/p-62f34e6f.entry.js +0 -1
  415. package/dist/sankhyablocks/p-631954eb.entry.js +0 -1
  416. package/dist/sankhyablocks/p-65f8c11c.entry.js +0 -1
  417. package/dist/sankhyablocks/p-684a2590.entry.js +0 -1
  418. package/dist/sankhyablocks/p-70001ac1.js +0 -1
  419. package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
  420. package/dist/sankhyablocks/p-7663f597.entry.js +0 -1
  421. package/dist/sankhyablocks/p-76a65660.js +0 -1
  422. package/dist/sankhyablocks/p-7e7a7473.js +0 -1
  423. package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
  424. package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
  425. package/dist/sankhyablocks/p-939e15d3.entry.js +0 -1
  426. package/dist/sankhyablocks/p-96a89d58.entry.js +0 -1
  427. package/dist/sankhyablocks/p-9863d682.js +0 -1
  428. package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
  429. package/dist/sankhyablocks/p-c2495304.js +0 -1
  430. package/dist/sankhyablocks/p-c8622597.entry.js +0 -1
  431. package/dist/sankhyablocks/p-d1791da2.entry.js +0 -1
  432. package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
  433. package/dist/sankhyablocks/p-d65d98ed.entry.js +0 -1
  434. package/dist/sankhyablocks/p-d6610d11.entry.js +0 -11
  435. package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
  436. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  437. package/dist/sankhyablocks/p-ffa5e4ff.js +0 -1
  438. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -0,0 +1,1431 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
+ import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext, LockManager, LockManagerOperation, FloatingManager, DateUtils, MaskFormatter, ArrayUtils } from '@sankhyalabs/core';
3
+ import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
4
+ import { C as ConfigStorage } from './ConfigStorage-71e6766f.js';
5
+ import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
+ import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
7
+ import { F as FilterOperand } from './index-ae591a44.js';
8
+ import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
9
+ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
10
+ import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
11
+ import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
12
+ import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
13
+ import './form-config-fetcher-fa208a6c.js';
14
+ import './DataFetcher-88e56266.js';
15
+ import './PrintUtils-3e4ff0f5.js';
16
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
17
+
18
+ const buildFilter = (item) => {
19
+ switch (item.type) {
20
+ case FilterItemType.DEFAULT_FILTER:
21
+ return buildDefault(item);
22
+ case FilterItemType.BINARY_SELECT:
23
+ return buildBinary(item);
24
+ case FilterItemType.MULTI_SELECT:
25
+ return buildMultSelect(item);
26
+ case FilterItemType.MULTI_LIST:
27
+ return buildMultiList(item);
28
+ case FilterItemType.PERIOD:
29
+ return buildPeriod(item);
30
+ case FilterItemType.SEARCH:
31
+ return buildSearch(item);
32
+ case FilterItemType.TEXT:
33
+ return buildText(item);
34
+ case FilterItemType.NUMBER:
35
+ return buildNumber(item);
36
+ case FilterItemType.PERSONALIZED:
37
+ return buildPersonalized(item);
38
+ case FilterItemType.CHECK_BOX_LIST:
39
+ return buildCheckboxList(item);
40
+ default:
41
+ return undefined;
42
+ }
43
+ };
44
+ function buildDefault(item) {
45
+ return { name: item.id, expression: item.props.expression, params: [] };
46
+ }
47
+ function buildBinary(item) {
48
+ const { id, value, props } = item;
49
+ const options = props.options;
50
+ const selectedOption = options.find(opt => opt.name === value);
51
+ return { name: id, expression: selectedOption.expression, params: [] };
52
+ }
53
+ function buildMultSelect(item) {
54
+ const { id, value, props } = item;
55
+ return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
56
+ }
57
+ function buildMultiList(item) {
58
+ const { id, value, props } = item;
59
+ const parsedValues = parseMultiListValues(value);
60
+ if (parsedValues.length > 0) {
61
+ return {
62
+ name: id,
63
+ expression: props.expression,
64
+ params: [{
65
+ name: id,
66
+ dataType: DataType.TEXT,
67
+ value: JSON.stringify(parsedValues)
68
+ }]
69
+ };
70
+ }
71
+ }
72
+ function buildCheckboxList(item) {
73
+ var _a;
74
+ const { id, value, props } = item;
75
+ const selectedOptionNames = Object.entries(value !== null && value !== void 0 ? value : {})
76
+ .filter(([_, valueChecked]) => valueChecked === true)
77
+ .map(([key, _]) => key);
78
+ const selectedOptionsObject = (_a = props.options) === null || _a === void 0 ? void 0 : _a.filter(option => selectedOptionNames.includes(option.name));
79
+ return { name: id, expression: buildCheckboxListExpression(selectedOptionsObject), params: [] };
80
+ }
81
+ function buildCheckboxListExpression(options) {
82
+ let expression = "";
83
+ options.forEach((option, index) => {
84
+ var _a;
85
+ expression += ` ${index > 0 ? ((_a = option.operand) !== null && _a !== void 0 ? _a : 'OR') : ''} ${option.expression}`;
86
+ });
87
+ return expression.trim();
88
+ }
89
+ function parseMultiListValues(multiListValue) {
90
+ var _a, _b;
91
+ const value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
92
+ return value.filter(item => item === null || item === void 0 ? void 0 : item.check).map(({ id }) => Number.isNaN(+id) ? String(id) : Number(id));
93
+ }
94
+ function buildPeriod(item) {
95
+ const { id, value, props } = item;
96
+ let { end, start } = value;
97
+ if (typeof end === "string") {
98
+ end = new Date(end);
99
+ }
100
+ if (typeof start === "string") {
101
+ start = new Date(start);
102
+ }
103
+ const params = [];
104
+ let expression;
105
+ if (end && start) {
106
+ expression = props.expression.fullfill;
107
+ params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
108
+ }
109
+ else {
110
+ if (start) {
111
+ expression = props.expression.onlystart;
112
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
113
+ }
114
+ else {
115
+ expression = props.expression.onlyend;
116
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
117
+ }
118
+ }
119
+ return { name: id, expression, params };
120
+ }
121
+ function buildSearch(item) {
122
+ const { id, value, props } = item;
123
+ const expression = props.expression;
124
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
125
+ }
126
+ function buildText(item) {
127
+ let { id, value, props } = item;
128
+ const expression = props.expression;
129
+ if (!StringUtils.isEmpty(props.likeAs)) {
130
+ value = buildLikeValue(value, props.likeAs);
131
+ }
132
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
133
+ }
134
+ function buildNumber(item) {
135
+ const { id, value, props } = item;
136
+ const variation = props.variation;
137
+ if (variation === FilterNumberVariation.INTERVAL) {
138
+ const { start, end } = value !== null && value !== void 0 ? value : { start: 0, end: 0 };
139
+ if (!isNaN(start) && !isNaN(end)) {
140
+ return {
141
+ name: id,
142
+ expression: props.intervalExpression.fullfill,
143
+ params: [
144
+ { name: `${id}.START`, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, start) },
145
+ { name: `${id}.END`, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, end) }
146
+ ]
147
+ };
148
+ }
149
+ if (!isNaN(start)) {
150
+ return {
151
+ name: id,
152
+ expression: props.intervalExpression.onlystart,
153
+ params: [
154
+ { name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, start) }
155
+ ]
156
+ };
157
+ }
158
+ if (!isNaN(end)) {
159
+ return {
160
+ name: id,
161
+ expression: props.intervalExpression.onlyend,
162
+ params: [
163
+ { name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, end) }
164
+ ]
165
+ };
166
+ }
167
+ }
168
+ const expression = props.expression;
169
+ return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
170
+ }
171
+ function buildLikeValue(valueAsString, likeAs) {
172
+ if (likeAs === "CONTANIS") {
173
+ return `%${valueAsString}%`;
174
+ }
175
+ else if (likeAs === "STARTS_WITH") {
176
+ return `${valueAsString}%`;
177
+ }
178
+ else if (likeAs === "ENDS_WITH") {
179
+ return `%${valueAsString}`;
180
+ }
181
+ return valueAsString;
182
+ }
183
+ function buildPersonalized(item) {
184
+ const { id, groupedItems = [] } = item;
185
+ const activeFilters = groupedItems.filter(groupItem => !!groupItem.visible);
186
+ const filters = activeFilters.map(item => {
187
+ var _a;
188
+ const expression = item.props.expression;
189
+ const params = (((_a = item.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
190
+ const valuesArray = Array.from(item.value || 0);
191
+ const dataType = param.dataType;
192
+ let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
193
+ if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
194
+ paramValue = paramValue["value"];
195
+ }
196
+ if (paramValue == undefined && dataType === DataType.BOOLEAN) {
197
+ paramValue = false;
198
+ }
199
+ return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : toString(dataType, paramValue) };
200
+ });
201
+ return { expression, name: item.id, params };
202
+ });
203
+ const expression = filters.map(filter => `(${filter.expression})`).join(` ${FilterOperand.AND} `);
204
+ const params = filters.flatMap(filter => filter.params);
205
+ return { name: id, expression, params };
206
+ }
207
+
208
+ class SnkFilterModalFactory {
209
+ constructor({ filterConfig, configName, onComplete, getMessage, disablePersonalizedFilter, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
210
+ this._filterConfig = filterConfig;
211
+ this._configName = configName;
212
+ this._onComplete = onComplete;
213
+ this._getMessage = getMessage;
214
+ this._disablePersonalizedFilter = disablePersonalizedFilter;
215
+ this._addPersonalizedFilterFn = onAddPersonalizedFilter;
216
+ this._editPersonalizedFilterFn = onEditPersonalizedFilter;
217
+ this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
218
+ }
219
+ applyFilters(newFilterConfig) {
220
+ this._onComplete(newFilterConfig);
221
+ this._closeModal();
222
+ }
223
+ buildFilterModal() {
224
+ const filterModal = document.createElement("snk-filter-modal");
225
+ filterModal.className = "ez-size-height--full";
226
+ filterModal.filters = this._filterConfig;
227
+ filterModal.configName = this._configName;
228
+ filterModal.disablePersonalizedFilter = this._disablePersonalizedFilter;
229
+ filterModal.getMessage = this._getMessage.bind(this);
230
+ filterModal.applyFilters = this.applyFilters.bind(this);
231
+ filterModal.closeModal = () => this._closeModal();
232
+ filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
233
+ filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
234
+ filterModal.deletePersonalizedFilter = (filter, configName) => this._onDeletePersonalizedFilter(filter, configName);
235
+ return filterModal;
236
+ }
237
+ async showModal() {
238
+ const filterModal = this.buildFilterModal();
239
+ const modalProps = {
240
+ content: filterModal,
241
+ position: 'left',
242
+ heightMode: 'full',
243
+ closeOutsideClick: false,
244
+ useScrimLight: true
245
+ };
246
+ this._closeModal = await ApplicationUtils.showModal(modalProps);
247
+ }
248
+ async closeModal() {
249
+ this._closeModal();
250
+ }
251
+ }
252
+
253
+ const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:12px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-items:start}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
254
+
255
+ const SnkFilterBar = class {
256
+ constructor(hostRef) {
257
+ registerInstance(this, hostRef);
258
+ this.configUpdated = createEvent(this, "configUpdated", 7);
259
+ this._updateSequence = [];
260
+ this._loadingPending = false;
261
+ this._configUpdated = false;
262
+ this._firstLoad = true;
263
+ this._pendingVariables = false;
264
+ this._customfiltersToBeUpdated = [];
265
+ this._resolveLoading = undefined;
266
+ this._calculateSortIndex = (item) => {
267
+ if (!item.visible)
268
+ return 0;
269
+ if (item.hardFixed)
270
+ return 1000000; //campos Hard Fixed não variam a ordem
271
+ let index = item.fixed ? 100000 : 0;
272
+ index += this.hasValidValue(item) ? 10000 : 0;
273
+ index += this._updateSequence.lastIndexOf(item.id) + 1;
274
+ return index;
275
+ };
276
+ this._filtersComparator = (a, b) => {
277
+ return this._calculateSortIndex(b) - this._calculateSortIndex(a);
278
+ };
279
+ this.enableLockManagerLoadingComp = false;
280
+ this.customFilterBarConfig = undefined;
281
+ this.dataUnit = undefined;
282
+ this.title = undefined;
283
+ this.configName = undefined;
284
+ this.resourceID = undefined;
285
+ this.mode = "regular";
286
+ this.filterConfig = undefined;
287
+ this.messagesBuilder = undefined;
288
+ this.disablePersonalizedFilter = undefined;
289
+ this.filterBarLegacyConfigName = undefined;
290
+ this.autoLoad = undefined;
291
+ this.afterApplyConfig = undefined;
292
+ this.allowDefault = undefined;
293
+ this.scrollerLocked = false;
294
+ this.showPersonalizedFilter = false;
295
+ this.personalizedFilterId = undefined;
296
+ }
297
+ hasValidValue(item) {
298
+ if (item.value === undefined || item.value === null)
299
+ return false;
300
+ if (!Array.isArray(item.value))
301
+ return true;
302
+ return item.value.some(filterItem => filterItem.check === true);
303
+ }
304
+ observeFilterConfig(newValue, oldValue) {
305
+ if (ObjectUtils.equals(newValue, oldValue))
306
+ return;
307
+ this.handleFilterConfigsChanged(oldValue, newValue);
308
+ }
309
+ handleFilterConfigsChanged(oldValue, newValue) {
310
+ if (oldValue != undefined && newValue == undefined) {
311
+ this._loadingPending = true;
312
+ this._configUpdated = true;
313
+ }
314
+ else {
315
+ const oldItems = new Map(oldValue ? oldValue.map(item => [item.id, item]) : undefined);
316
+ if (oldItems.size === 0 && newValue.length > 0) {
317
+ this._loadingPending = true;
318
+ this._configUpdated = false;
319
+ }
320
+ else {
321
+ newValue.forEach(newItem => {
322
+ const oldItem = oldItems.get(newItem.id);
323
+ if (oldItem != undefined) {
324
+ this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
325
+ this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
326
+ if (!this._loadingPending) {
327
+ const groupedChanged = ObjectUtils.objectToString(oldItem.groupedItems) != ObjectUtils.objectToString(newItem.groupedItems);
328
+ this._configUpdated = this._configUpdated || groupedChanged;
329
+ this._loadingPending = this._loadingPending || groupedChanged;
330
+ }
331
+ }
332
+ else {
333
+ this._configUpdated = true;
334
+ this._loadingPending = this._loadingPending || newItem.value != undefined;
335
+ }
336
+ });
337
+ }
338
+ }
339
+ if (this._loadingPending || this._configUpdated)
340
+ this.configUpdated.emit(newValue);
341
+ this.processAfterUpdateConfig();
342
+ }
343
+ /**
344
+ * Faz o recarregamento da filterbar buscando o state no servidor.
345
+ */
346
+ async reload() {
347
+ this.loadConfigFromStorage(true);
348
+ }
349
+ /**
350
+ * Retorna um item de filtro pelo ID.
351
+ */
352
+ async getFilterItem(id) {
353
+ const item = this.filterConfig.find(item => item.id === id);
354
+ return Promise.resolve(ObjectUtils.copy(item));
355
+ }
356
+ /**
357
+ * Atualiza um item do filtro.
358
+ *
359
+ * @param filterItem - Item com as informações atualizadas, caso o item não seja encontrado no array ele mão será modificado
360
+ */
361
+ async updateFilterItem(newFilterItem) {
362
+ const itemIndex = this.filterConfig.findIndex(item => item.id === newFilterItem.id);
363
+ if (itemIndex == -1) {
364
+ console.warn("[SnkFilterBar.updateFilterItem] FilterItem não encontrado, o mesmo não será atualizado.");
365
+ return Promise.resolve();
366
+ }
367
+ this._loadingPending = true;
368
+ this.updateFilter(newFilterItem);
369
+ return Promise.resolve();
370
+ }
371
+ /**
372
+ * Adiciona um item de filtro.
373
+ *
374
+ * @param filterItem - Item a ser adicionado, caso o item já exista com o ID ele não será adicionado novamente
375
+ */
376
+ async addFilterItem(filterItem) {
377
+ const itemIndex = this.filterConfig.findIndex(item => item.id === filterItem.id);
378
+ if (itemIndex > -1) {
379
+ console.warn("[SnkFilterBar.addFilterItem] FilterItem já existe , o mesmo não será adicionado novamente.");
380
+ return Promise.resolve();
381
+ }
382
+ this.filterConfig.push(filterItem);
383
+ this._loadingPending = true;
384
+ this.updateFilter(filterItem);
385
+ return Promise.resolve();
386
+ }
387
+ /**
388
+ * Remove um item de filtro.
389
+ *
390
+ * @param filterID - ID do a ser adicionado
391
+ *
392
+ * @returns {Promise<SnkFilterItemConfig|undefined>} - Retorna o item de filtro removido, ou undefined caso não encontrado.
393
+ */
394
+ async removeFilterItem(filterID) {
395
+ const itemIndex = this.filterConfig.findIndex(item => item.id === filterID);
396
+ if (itemIndex == -1) {
397
+ console.warn("[SnkFilterBar.removeFilterItem] FilterItem não encontrado");
398
+ return Promise.resolve(undefined);
399
+ }
400
+ const itemToRemove = this.filterConfig[itemIndex];
401
+ this.filterConfig = this.filterConfig.filter(item => item.id !== filterID);
402
+ return Promise.resolve(itemToRemove);
403
+ }
404
+ componentDidLoad() {
405
+ if (this._element) {
406
+ const dataInfo = { dataUnit: this.dataUnit };
407
+ ElementIDUtils.addIDInfo(this._element, null, dataInfo);
408
+ }
409
+ }
410
+ processPendingFilter() {
411
+ if (this._pendingVariables) {
412
+ const popUp = this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");
413
+ if (popUp) {
414
+ popUp.showUp(true).then(() => {
415
+ this.processAfterUpdateConfig();
416
+ });
417
+ }
418
+ }
419
+ else {
420
+ this.processAfterUpdateConfig();
421
+ }
422
+ }
423
+ getPersonalizedFilterItem() {
424
+ return this.filterConfig.find(item => item.type === FilterItemType.PERSONALIZED);
425
+ }
426
+ async processAfterUpdateConfig() {
427
+ var _a;
428
+ if (this._loadingPending) {
429
+ if (await this._application.isLoadedByPk() && !this._configUpdated)
430
+ return;
431
+ const personalizedFilter = this.getPersonalizedFilterItem();
432
+ this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
433
+ if (this._pendingVariables) {
434
+ return;
435
+ }
436
+ this._loadingPending = false;
437
+ this.doLoadData(this.dataUnit.getLastLoadRequest() != undefined);
438
+ }
439
+ if (this._configUpdated) {
440
+ this._configUpdated = false;
441
+ ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
442
+ (_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
443
+ }
444
+ }
445
+ async doLoadData(forceReload = false) {
446
+ try {
447
+ if (this._firstLoad && this.autoLoad === false) {
448
+ return;
449
+ }
450
+ if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
451
+ let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
452
+ if (!autoLoad) {
453
+ return;
454
+ }
455
+ }
456
+ this.dataUnit.loadData(undefined, undefined, true);
457
+ }
458
+ finally {
459
+ this._firstLoad = false;
460
+ }
461
+ }
462
+ /**
463
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
464
+ * através de um pequeno modulo na estrutura da aplicação:
465
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
466
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
467
+ */
468
+ getMessage(key, params, defaultValue) {
469
+ var _a;
470
+ if (this.messagesBuilder == undefined && this._application) {
471
+ this.messagesBuilder = this._application.messagesBuilder;
472
+ }
473
+ return ((_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params)) || defaultValue;
474
+ }
475
+ getFilter(_dataUnit) {
476
+ var _a;
477
+ const filters = [];
478
+ (_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => this.isActiveFilter(item)).forEach(item => {
479
+ const filter = buildFilter(item);
480
+ if (filter) {
481
+ filters.push(filter);
482
+ }
483
+ });
484
+ return filters;
485
+ }
486
+ isActiveFilter(item) {
487
+ /*
488
+ - O filtro padrão também deve sempre ser condiderado ativo, pois, sempre deve
489
+ ser aplicado.
490
+ */
491
+ if (item.type === FilterItemType.DEFAULT_FILTER) {
492
+ return true;
493
+ }
494
+ return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
495
+ }
496
+ registryFilterProvider() {
497
+ this.dataUnit.addFilterProvider(this);
498
+ if (this.filterConfig) {
499
+ this.doLoadData();
500
+ }
501
+ }
502
+ itemFocused(selectedItem) {
503
+ this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
504
+ if (item.id === selectedItem) {
505
+ if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
506
+ item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
507
+ }
508
+ }
509
+ else {
510
+ item["hideDetail"]();
511
+ }
512
+ });
513
+ }
514
+ filterActiveFilter(item) {
515
+ return item.visible || item.removalBlocked;
516
+ }
517
+ filterPersonalizedItems(item) {
518
+ return item.type === FilterItemType.PERSONALIZED;
519
+ }
520
+ getPersonalizedFilterVariableItems() {
521
+ return this.filterConfig
522
+ .filter(this.filterPersonalizedItems)
523
+ .map(item => {
524
+ const itemId = `filter-${item.id}`;
525
+ return (h("snk-filter-item", { key: item.id, id: itemId, config: Object.assign({}, item), onFocusin: () => this.itemFocused(itemId), onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), getMessage: (key, props) => this.getMessage(key, props), showChips: false }));
526
+ });
527
+ }
528
+ getFilterItems() {
529
+ const pinnedItems = [];
530
+ const unpinnedItems = [];
531
+ this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
532
+ .filter(this.filterActiveFilter)
533
+ .forEach((item, index) => {
534
+ item = ObjectUtils.copy(item);
535
+ const itemId = `filter-${item.id}`;
536
+ const filterItem = (h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
537
+ if (item.fixed || item.hardFixed) {
538
+ pinnedItems.push(filterItem);
539
+ }
540
+ else {
541
+ unpinnedItems.push(filterItem);
542
+ }
543
+ return filterItem;
544
+ });
545
+ const elements = [];
546
+ elements.push(...pinnedItems);
547
+ if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
548
+ elements.push(h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
549
+ }
550
+ elements.push(...unpinnedItems);
551
+ return elements;
552
+ }
553
+ calculateUpdateSequence(item) {
554
+ if (item) {
555
+ this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
556
+ this._updateSequence.push(item.id);
557
+ }
558
+ }
559
+ normalizeItem(item) {
560
+ const normalized = Object.assign({}, item);
561
+ const optionals = ["props", "value", "hardFixed", "fixed"];
562
+ optionals.forEach(prop => {
563
+ if (normalized[prop] == undefined) {
564
+ delete normalized[prop];
565
+ }
566
+ });
567
+ if (item.value === "") {
568
+ delete item.value;
569
+ }
570
+ return normalized;
571
+ }
572
+ updateFilter(newItem) {
573
+ this.filterConfig = this.filterConfig.map(item => {
574
+ newItem = this.normalizeItem(newItem);
575
+ if (item.id === newItem.id) {
576
+ if (ObjectUtils.objectToString(item) != ObjectUtils.objectToString(newItem)) {
577
+ this.calculateUpdateSequence(newItem);
578
+ }
579
+ return newItem;
580
+ }
581
+ return item;
582
+ }).sort((a, b) => this._filtersComparator(a, b));
583
+ }
584
+ loadPermitions() {
585
+ this._application.isUserSup().then(value => this.allowDefault = value);
586
+ }
587
+ addFilterBarLegacyConfigName() {
588
+ if (this.filterBarLegacyConfigName && this.configName) {
589
+ ConfigStorage.addFilterBarLegacyConfig(this.configName, this.filterBarLegacyConfigName);
590
+ }
591
+ }
592
+ async loadConfigFromStorage(clearCache) {
593
+ try {
594
+ if (clearCache) {
595
+ await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
596
+ }
597
+ let config;
598
+ if (this.customFilterBarConfig) {
599
+ config = await this.customFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
600
+ }
601
+ else {
602
+ config = await ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
603
+ }
604
+ this.filterConfig = config.map(item => this.normalizeItem(item));
605
+ this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
606
+ }
607
+ catch (e) {
608
+ throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), e);
609
+ }
610
+ }
611
+ attachDataUnit() {
612
+ if (this.dataUnit == undefined) {
613
+ let parent = this._element.parentElement;
614
+ while (parent) {
615
+ if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
616
+ const snkDataUnit = parent;
617
+ this.dataUnit = snkDataUnit.dataUnit;
618
+ if (this.dataUnit) {
619
+ this.registryFilterProvider();
620
+ }
621
+ else {
622
+ snkDataUnit.addEventListener("dataUnitReady", (evt) => {
623
+ this.dataUnit = evt.detail;
624
+ this.registryFilterProvider();
625
+ });
626
+ }
627
+ break;
628
+ }
629
+ }
630
+ parent = parent.parentElement;
631
+ }
632
+ else {
633
+ this.registryFilterProvider();
634
+ }
635
+ }
636
+ /**
637
+ * Emitido quando acontece a alteração do estado do filtro.
638
+ */
639
+ filterChangeListener(evt) {
640
+ this.updateFilter(evt.detail);
641
+ }
642
+ /**
643
+ * Abre o modal de filtros
644
+ */
645
+ async showFilterModal() {
646
+ const callbackOnApplyFilter = (filters) => {
647
+ var _a;
648
+ this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
649
+ (_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
650
+ };
651
+ let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
652
+ filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
653
+ return itemA.originOrder - itemB.originOrder;
654
+ });
655
+ const factoryParams = {
656
+ filterConfig: filtersConfigCopy,
657
+ configName: this.configName,
658
+ onComplete: callbackOnApplyFilter,
659
+ disablePersonalizedFilter: this.disablePersonalizedFilter,
660
+ getMessage: (key, props) => this.getMessage(key, props),
661
+ onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
662
+ onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
663
+ onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName),
664
+ };
665
+ this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
666
+ await this._filterModalFactory.showModal();
667
+ }
668
+ addPersonalizedFilter() {
669
+ this._filterModalFactory.closeModal();
670
+ this.personalizedFilterId = undefined;
671
+ this.showPersonalizedFilter = true;
672
+ window.requestAnimationFrame(() => {
673
+ this._elPersonalizedFilter.createPersonalizedFilter();
674
+ });
675
+ }
676
+ editPersonalizedFilter(id) {
677
+ this._filterModalFactory.closeModal();
678
+ this.showPersonalizedFilter = true;
679
+ this.personalizedFilterId = id;
680
+ }
681
+ deletePersonalizedFilter(filter, filterItemType, configName) {
682
+ if (filterItemType === FilterItemType.PERSONALIZED) {
683
+ ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
684
+ }
685
+ }
686
+ handleHidePersonalizedFilter(reloadFilterBar) {
687
+ if (reloadFilterBar) {
688
+ this.loadConfigFromStorage().then(() => {
689
+ this.hidePersonalizedFilter();
690
+ });
691
+ }
692
+ else {
693
+ this.hidePersonalizedFilter();
694
+ }
695
+ }
696
+ hidePersonalizedFilter() {
697
+ this.personalizedFilterId = undefined;
698
+ this.showPersonalizedFilter = false;
699
+ }
700
+ async componentWillLoad() {
701
+ var _a;
702
+ try {
703
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
704
+ await this.attachDataUnit();
705
+ if (this._application) {
706
+ if (this._application.enableLockManagerLoadingApp && this.enableLockManagerLoadingComp) {
707
+ const appLoadLockerID = LockManager.addLockManagerCtxId(this._element);
708
+ this._resolveLoading = LockManager.lock(appLoadLockerID, LockManagerOperation.APP_LOADING);
709
+ }
710
+ await Promise.all([
711
+ this.loadPermitions(),
712
+ this.addFilterBarLegacyConfigName(),
713
+ this.loadConfigFromStorage(),
714
+ ]);
715
+ }
716
+ }
717
+ finally {
718
+ (_a = this._resolveLoading) === null || _a === void 0 ? void 0 : _a.call(this);
719
+ }
720
+ }
721
+ componentDidRender() {
722
+ this.processPendingFilter();
723
+ }
724
+ render() {
725
+ if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
726
+ return undefined;
727
+ }
728
+ if (this.showPersonalizedFilter) {
729
+ return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
730
+ }
731
+ if (this.mode !== "regular") {
732
+ return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
733
+ }
734
+ return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium ez-margin-top--extra-small", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
735
+ }
736
+ get _element() { return getElement(this); }
737
+ static get watchers() { return {
738
+ "filterConfig": ["observeFilterConfig"]
739
+ }; }
740
+ };
741
+ SnkFilterBar.style = snkFilterBarCss;
742
+
743
+ const SnkFilterItem = class {
744
+ constructor(hostRef) {
745
+ registerInstance(this, hostRef);
746
+ this.visibleChanged = createEvent(this, "visibleChanged", 7);
747
+ this.filterChange = createEvent(this, "filterChange", 3);
748
+ this.innerClickCheck = (_floatingContainer, node) => {
749
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
750
+ return true;
751
+ }
752
+ this.detailIsVisible = false;
753
+ return false;
754
+ };
755
+ this.detailIsVisible = undefined;
756
+ this.config = undefined;
757
+ this.getMessage = undefined;
758
+ this.showChips = true;
759
+ }
760
+ observeDetailIsVisible(value) {
761
+ this.visibleChanged.emit(value);
762
+ }
763
+ /**
764
+ * Exibe os detalhes de um item da lista.
765
+ */
766
+ async showUp(open = false) {
767
+ return new Promise(resolve => {
768
+ var _a;
769
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
770
+ if (open) {
771
+ this._closeCallback = resolve;
772
+ (_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.blur();
773
+ window.requestAnimationFrame(() => {
774
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
775
+ this._popover.show();
776
+ this.detailIsVisible = true;
777
+ });
778
+ }
779
+ });
780
+ }
781
+ updatePosition() {
782
+ if (this._floatingID == undefined) {
783
+ return;
784
+ }
785
+ FloatingManager.updateFloatPosition(this._popover, this._popoverContainer, this.getFloatOptions());
786
+ }
787
+ getFloatOptions() {
788
+ return {
789
+ autoClose: true,
790
+ innerClickTest: this.innerClickCheck,
791
+ backClickListener: () => this.onDetailCloseCallback(),
792
+ left: this.getOffsetLeft(),
793
+ top: this.getOffsetTop(),
794
+ useOverlay: true,
795
+ overlayClassName: 'ez-scrim ez-scrim--light',
796
+ isFixed: true
797
+ };
798
+ }
799
+ getOffsetLeft() {
800
+ const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
801
+ const rect = this._filterItemElement.getBoundingClientRect();
802
+ // Width baseado no conteudo do snk-filter-detail. Nesse momento ele retorna 0px pois ainda não foi criado em tela.
803
+ const filterDetailWidth = 430;
804
+ const adjustRightPosition = filterDetailWidth - (document.body.clientWidth - rect.left);
805
+ return `calc(${rect.x}px + ${padding} - ${adjustRightPosition > 0 ? adjustRightPosition : 0}px)`;
806
+ }
807
+ getOffsetTop() {
808
+ const rect = this._filterItemElement.getBoundingClientRect();
809
+ return (rect.y + rect.height) + "px";
810
+ }
811
+ controlScrollPage() {
812
+ window.removeEventListener("scroll", this.updatePosition.bind(this));
813
+ window.addEventListener("scroll", this.updatePosition.bind(this));
814
+ }
815
+ getConfigChanges() {
816
+ var _a;
817
+ const configToBeCleared = this.config;
818
+ if (!!((_a = configToBeCleared.groupedItems) === null || _a === void 0 ? void 0 : _a.length)) {
819
+ configToBeCleared.visible = false;
820
+ configToBeCleared.groupedItems = configToBeCleared.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false })));
821
+ }
822
+ const hasMultiValues = configToBeCleared.type === FilterItemType.MULTI_LIST && Array.isArray(configToBeCleared.value);
823
+ const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
824
+ return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
825
+ }
826
+ /**
827
+ * Oculta os detalhes de um item da lista.
828
+ */
829
+ async hideDetail() {
830
+ if (this.detailIsVisible) {
831
+ if (this._floatingID != undefined) {
832
+ FloatingManager.close(this._floatingID);
833
+ }
834
+ }
835
+ }
836
+ onDetailCloseCallback() {
837
+ this._floatingID = undefined;
838
+ this.detailIsVisible = false;
839
+ if (this._closeCallback) {
840
+ this._closeCallback();
841
+ this._closeCallback = undefined;
842
+ }
843
+ }
844
+ //---------------------------------------------
845
+ // Event handlers
846
+ //---------------------------------------------
847
+ clickListener(evt) {
848
+ if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
849
+ if (evt.target === this._rightIconElement && this.canClearFilter()) {
850
+ const configChanged = this.getConfigChanges();
851
+ this.filterChange.emit(configChanged);
852
+ }
853
+ else {
854
+ if (this.detailIsVisible) {
855
+ this.hideDetail();
856
+ }
857
+ else {
858
+ this.showUp(true);
859
+ }
860
+ }
861
+ evt.preventDefault();
862
+ evt.stopImmediatePropagation();
863
+ evt.stopPropagation();
864
+ }
865
+ }
866
+ mouseDownListener(evt) {
867
+ if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
868
+ evt.preventDefault();
869
+ evt.stopImmediatePropagation();
870
+ evt.stopPropagation();
871
+ }
872
+ }
873
+ getLabel(isTooltipLabel = false) {
874
+ var _a, _b;
875
+ const { type, value, label, props, groupedItems = [] } = this.config;
876
+ if (value || groupedItems.length) {
877
+ if (type === FilterItemType.BINARY_SELECT) {
878
+ const [optOne, optTwo] = props.options;
879
+ const tooltip = this.getMessage('snkFilterBar.binarySelectTooltip');
880
+ if (optOne.name === value) {
881
+ return isTooltipLabel ? `${tooltip} ${String(optOne.label).toLowerCase()}` : optOne.label;
882
+ }
883
+ if (optTwo.name === value) {
884
+ return isTooltipLabel ? `${tooltip} ${String(optTwo.label).toLowerCase()}` : optTwo.label;
885
+ }
886
+ }
887
+ if (type === FilterItemType.MULTI_SELECT) {
888
+ const opt = props.options.find(opt => opt.value === value);
889
+ return `${label}: ${opt.label}`;
890
+ }
891
+ if (type === FilterItemType.PERIOD) {
892
+ let { end, start } = value;
893
+ if (typeof end === "string") {
894
+ end = new Date(end);
895
+ end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
896
+ }
897
+ if (typeof start === "string") {
898
+ start = new Date(start);
899
+ start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
900
+ }
901
+ const dateFormater = new Intl.DateTimeFormat("pt-BR");
902
+ if (end && start) {
903
+ const isSameYear = start.getFullYear() === end.getFullYear();
904
+ const formatOptions = Object.assign({ day: '2-digit', month: '2-digit' }, ((!isSameYear || isTooltipLabel) && { year: '2-digit' }));
905
+ const startLabel = DateUtils.formatDate(start, formatOptions);
906
+ const endLabel = DateUtils.formatDate(end, formatOptions);
907
+ if (isTooltipLabel) {
908
+ return this.getMessage('snkFilterBar.fullPeriodTooltip', { LABEL: label, START_LABEL: startLabel, END_LABEL: endLabel });
909
+ }
910
+ return `${label}: ${startLabel} \u2192 ${endLabel}`;
911
+ }
912
+ else {
913
+ if (start) {
914
+ return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${dateFormater.format(start)}`;
915
+ }
916
+ else if (end) {
917
+ return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${dateFormater.format(end)}`;
918
+ }
919
+ else {
920
+ return label;
921
+ }
922
+ }
923
+ }
924
+ if (type === FilterItemType.SEARCH) {
925
+ return `${label}: ${value.value} - ${value.label}`;
926
+ }
927
+ if (type === FilterItemType.PERSONALIZED) {
928
+ const activeCount = this.calculateActiveCount(groupedItems);
929
+ if (activeCount <= 0)
930
+ return label;
931
+ return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
932
+ }
933
+ if (type === FilterItemType.MULTI_LIST) {
934
+ const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
935
+ return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
936
+ }
937
+ if (type === FilterItemType.CHECK_BOX_LIST) {
938
+ const selectedValues = Object.entries(value !== null && value !== void 0 ? value : {})
939
+ .filter(([_, value]) => value === true)
940
+ .map(([key, _]) => key);
941
+ const options = (_b = props.options) !== null && _b !== void 0 ? _b : [];
942
+ const selectedOptions = options.filter(option => selectedValues.includes(option.name));
943
+ return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
944
+ }
945
+ if (type === FilterItemType.NUMBER && props.variation === FilterNumberVariation.INTERVAL) {
946
+ const { start, end } = value;
947
+ if (!isNaN(start) && !isNaN(end)) {
948
+ return this.getMessage('snkFilterBar.fullIntervalTooltip', { LABEL: label, START_LABEL: start, END_LABEL: end });
949
+ }
950
+ if (!isNaN(start)) {
951
+ return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${Number(start)}`;
952
+ }
953
+ if (!isNaN(end)) {
954
+ return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
955
+ }
956
+ }
957
+ if (this.config.mask) {
958
+ const _maskFormatter = new MaskFormatter(this.config.mask);
959
+ return `${label}: ${_maskFormatter.format(value)}`;
960
+ }
961
+ return `${label}: ${value}`;
962
+ }
963
+ return label;
964
+ }
965
+ getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel) {
966
+ const checkedAmount = selectedOptions.length;
967
+ if (checkedAmount === 0) {
968
+ return `${label}`;
969
+ }
970
+ if (checkedAmount > 1) {
971
+ if (isTooltipLabel) {
972
+ const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
973
+ return `${label}: ${selectedOptionsDescrptions.join(',')}`;
974
+ }
975
+ return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
976
+ }
977
+ return `${label}: ${selectedOptions[0].label}`;
978
+ }
979
+ calculateActiveCount(groupedItems) {
980
+ return groupedItems.reduce((total, item) => {
981
+ if (!!item.visible)
982
+ return total + 1;
983
+ return total;
984
+ }, 0);
985
+ }
986
+ componentDidLoad() {
987
+ if (this._filterItemElement) {
988
+ ElementIDUtils.addIDInfo(this._filterItemElement);
989
+ this._idSnkFilterDetail = `filterDetail_${this.config.id}`;
990
+ }
991
+ this.controlScrollPage();
992
+ }
993
+ componentDidRender() {
994
+ if (this._floatingID == undefined) {
995
+ if (this._popover) {
996
+ this._popover.remove();
997
+ }
998
+ }
999
+ }
1000
+ /**
1001
+ * Emitido quando o estado do filtro é alterado.
1002
+ */
1003
+ filterChangeListener() {
1004
+ this.hideDetail();
1005
+ }
1006
+ canClearFilter() {
1007
+ const { value, groupedItems = [] } = this.config;
1008
+ if (value != undefined && this.config.type === FilterItemType.MULTI_LIST) {
1009
+ return value.some((item) => item.check);
1010
+ }
1011
+ return value !== undefined || groupedItems.some(item => item.visible);
1012
+ }
1013
+ getRightIconName() {
1014
+ if (this.canClearFilter())
1015
+ return "close";
1016
+ return this.detailIsVisible ? "chevron-up" : "chevron-down";
1017
+ }
1018
+ getLeftIconName() {
1019
+ switch (this.config.type) {
1020
+ case FilterItemType.PERIOD:
1021
+ return "calendar";
1022
+ case FilterItemType.PERSONALIZED:
1023
+ return "tune";
1024
+ }
1025
+ return undefined;
1026
+ }
1027
+ hasActiveElements(value) {
1028
+ var _a, _b, _c;
1029
+ return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
1030
+ }
1031
+ hasActiveValue(config) {
1032
+ return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
1033
+ }
1034
+ getEnabledChip() {
1035
+ if (this.config.type === FilterItemType.PERSONALIZED) {
1036
+ const { groupedItems = [] } = this.config;
1037
+ return groupedItems.some(item => item.visible);
1038
+ }
1039
+ return this.hasActiveValue(this.config);
1040
+ }
1041
+ render() {
1042
+ const leftIcon = this.getLeftIconName();
1043
+ return (h(Host, null, this.showChips && (h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" }))), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
1044
+ }
1045
+ get _filterItemElement() { return getElement(this); }
1046
+ static get watchers() { return {
1047
+ "detailIsVisible": ["observeDetailIsVisible"]
1048
+ }; }
1049
+ };
1050
+
1051
+ const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
1052
+ const MAX_FILTERS = 5;
1053
+ const SnkFilterList = class {
1054
+ constructor(hostRef) {
1055
+ registerInstance(this, hostRef);
1056
+ this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
1057
+ this._preselection = -1;
1058
+ this.innerClickCheck = (_floatingContainer, node) => {
1059
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
1060
+ return true;
1061
+ }
1062
+ this._detailIsVisible = false;
1063
+ return false;
1064
+ };
1065
+ this._filterArgument = undefined;
1066
+ this._showAll = undefined;
1067
+ this.label = undefined;
1068
+ this.iconName = undefined;
1069
+ this.items = undefined;
1070
+ this.getMessage = undefined;
1071
+ this.emptyText = undefined;
1072
+ this.findFilterText = undefined;
1073
+ this.buttonClass = undefined;
1074
+ }
1075
+ showDetail() {
1076
+ this._preselection = -1;
1077
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
1078
+ autoClose: true,
1079
+ innerClickTest: this.innerClickCheck,
1080
+ backClickListener: () => this.onListCloseCallback(),
1081
+ useOverlay: true
1082
+ });
1083
+ this._detailIsVisible = true;
1084
+ this._showAll = false;
1085
+ this._filterArgument = "";
1086
+ this._filterInput.setFocus();
1087
+ }
1088
+ /**
1089
+ * Oculta os detalhes do componente snk-filter-list.
1090
+ */
1091
+ async hideDetail() {
1092
+ if (this._floatingID != undefined) {
1093
+ FloatingManager.close(this._floatingID);
1094
+ }
1095
+ }
1096
+ onListCloseCallback() {
1097
+ this._floatingID = undefined;
1098
+ this._detailIsVisible = false;
1099
+ }
1100
+ buttonClick() {
1101
+ if (this._detailIsVisible) {
1102
+ this.hideDetail();
1103
+ }
1104
+ else {
1105
+ this.showDetail();
1106
+ }
1107
+ }
1108
+ componentDidLoad() {
1109
+ if (this._element) {
1110
+ ElementIDUtils.addIDInfo(this._element);
1111
+ }
1112
+ }
1113
+ componentDidRender() {
1114
+ if (this._floatingID == undefined) {
1115
+ if (this._popover) {
1116
+ this._popover.remove();
1117
+ }
1118
+ }
1119
+ }
1120
+ buildIdElement(buttonElement, name) {
1121
+ if (!buttonElement)
1122
+ return;
1123
+ const dataElement = { id: name };
1124
+ buttonElement.removeAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
1125
+ ElementIDUtils.addIDInfoIfNotExists(buttonElement, "filterItemList", dataElement);
1126
+ }
1127
+ buildItemElement(item) {
1128
+ const itemId = ++this._selectableItemsCount;
1129
+ return (h("button", { ref: elem => elem && this.buildIdElement(elem, item.label), id: `filter-item${itemId}`, onFocusin: () => this._preselection = itemId, class: `ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item`, onClick: () => this.itemSelected(item.name), name: item.label, key: itemId }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
1130
+ }
1131
+ itemSelected(itemName) {
1132
+ if (itemName === SHOW_MORE_ITEM_NAME) {
1133
+ this._showAll = true;
1134
+ }
1135
+ else {
1136
+ this.hideDetail();
1137
+ this.snkItemSelected.emit(itemName);
1138
+ }
1139
+ }
1140
+ getFilterItems() {
1141
+ const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
1142
+ if (items.length === 0) {
1143
+ return h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
1144
+ }
1145
+ const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
1146
+ if (hideItems) {
1147
+ items.splice(MAX_FILTERS);
1148
+ items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
1149
+ }
1150
+ this._selectableItemsCount = 0;
1151
+ return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
1152
+ }
1153
+ getFooterItems() {
1154
+ return this.items.filter(item => item.kind === "FOOTER");
1155
+ }
1156
+ keyDownHandler(event) {
1157
+ switch (event.key) {
1158
+ case "ArrowDown":
1159
+ this.changePreselection(this._preselection + 1);
1160
+ //Paramos a propagação do evento para evitar scroll indesejado
1161
+ event.stopImmediatePropagation();
1162
+ event.stopPropagation();
1163
+ event.preventDefault();
1164
+ break;
1165
+ case "ArrowUp":
1166
+ this.changePreselection(this._preselection - 1);
1167
+ //Paramos a propagação do evento para evitar scroll indesejado
1168
+ event.stopImmediatePropagation();
1169
+ event.stopPropagation();
1170
+ event.preventDefault();
1171
+ break;
1172
+ }
1173
+ }
1174
+ changePreselection(newSelection) {
1175
+ if (newSelection < 0) {
1176
+ newSelection = this._selectableItemsCount;
1177
+ }
1178
+ this._preselection = newSelection > this._selectableItemsCount ? 0 : newSelection;
1179
+ if (this._preselection === 0) {
1180
+ this._filterInput.setFocus();
1181
+ }
1182
+ else {
1183
+ const item = this._element.querySelector(`#filter-item${this._preselection}`);
1184
+ if (item) {
1185
+ item.focus();
1186
+ }
1187
+ }
1188
+ }
1189
+ render() {
1190
+ return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--4", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, "data-element-id": "serachFilters", mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail, onFocus: () => this._preselection = 0 }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
1191
+ }
1192
+ get _element() { return getElement(this); }
1193
+ };
1194
+
1195
+ const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:hidden;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
1196
+
1197
+ const SnkFilterModal = class {
1198
+ constructor(hostRef) {
1199
+ registerInstance(this, hostRef);
1200
+ this.getMessage = undefined;
1201
+ this.configName = undefined;
1202
+ this.filters = undefined;
1203
+ this.applyFilters = undefined;
1204
+ this.closeModal = undefined;
1205
+ this.addPersonalizedFilter = undefined;
1206
+ this.editPersonalizedFilter = undefined;
1207
+ this.deletePersonalizedFilter = undefined;
1208
+ this.filtersToDelete = [];
1209
+ this.disablePersonalizedFilter = undefined;
1210
+ }
1211
+ /**
1212
+ * Emitido quando um filtro personalizado é deletado.
1213
+ */
1214
+ deletePersonalizedFilterListener(event) {
1215
+ this.filtersToDelete.push(event.detail);
1216
+ }
1217
+ getCustomMessage(key, params) {
1218
+ var _a;
1219
+ return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
1220
+ }
1221
+ //TODO: tratar clear all dos filtros personalizados
1222
+ handleClearAll() {
1223
+ const { customFilters, quickFilters, otherFilters, multiListFilters } = this.filters.reduce((acc, filter) => {
1224
+ if (filter.type === FilterItemType.MULTI_LIST) {
1225
+ acc.multiListFilters.push(filter);
1226
+ return acc;
1227
+ }
1228
+ if (filter.filterType === FilterType.QUICK_FILTER) {
1229
+ acc.quickFilters.push(filter);
1230
+ return acc;
1231
+ }
1232
+ if (filter.filterType === FilterType.CUSTOM_FILTER) {
1233
+ acc.customFilters.push(filter);
1234
+ return acc;
1235
+ }
1236
+ if (filter.filterType === FilterType.OTHER_FILTERS) {
1237
+ acc.otherFilters.push(filter);
1238
+ return acc;
1239
+ }
1240
+ return acc;
1241
+ }, { quickFilters: [], customFilters: [], otherFilters: [], multiListFilters: [] });
1242
+ this.handleClearFilterList(quickFilters);
1243
+ this.handleClearCustomFilters(customFilters);
1244
+ this.handleClearOthersFilters(otherFilters);
1245
+ multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
1246
+ }
1247
+ handleClearOthersFilters(otherFilters) {
1248
+ this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
1249
+ }
1250
+ handleClearCustomFilters(customFilters) {
1251
+ this.filters.forEach((filter, index) => {
1252
+ if (filter.filterType === FilterType.CUSTOM_FILTER)
1253
+ this.filters[index] = this.clearAllCustomFilter(customFilters).shift();
1254
+ });
1255
+ }
1256
+ clearAllCustomFilter(filterConfigSnapshot) {
1257
+ return filterConfigSnapshot.map(filterItem => {
1258
+ const copy = Object.assign({}, filterItem);
1259
+ delete copy.value;
1260
+ copy.visible = false;
1261
+ if (copy.groupedItems) {
1262
+ copy.groupedItems = this.clearAllCustomFilter(copy.groupedItems);
1263
+ }
1264
+ return copy;
1265
+ });
1266
+ }
1267
+ handleClose() {
1268
+ const hasChangesToSave = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
1269
+ if (!hasChangesToSave) {
1270
+ this.closeModal();
1271
+ return;
1272
+ }
1273
+ return ApplicationUtils.confirm(this.getCustomMessage('validations.notSaved.title'), this.getCustomMessage('validations.notSaved.message')).then((cancelAction) => {
1274
+ if (cancelAction)
1275
+ this.closeModal();
1276
+ });
1277
+ }
1278
+ handleApplyFilters() {
1279
+ const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER);
1280
+ if (this.isValidCustomFilter(filterPersonalized)) {
1281
+ this.applyFilters(this.filters);
1282
+ }
1283
+ if (this.filtersToDelete.length > 0) {
1284
+ this.filtersToDelete.forEach(filter => {
1285
+ this.deletePersonalizedFilter(filter, this.configName);
1286
+ });
1287
+ this.filtersToDelete = [];
1288
+ }
1289
+ }
1290
+ isValidCustomFilter(filterPersonalized) {
1291
+ const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
1292
+ if (!isValid) {
1293
+ ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
1294
+ return false;
1295
+ }
1296
+ return true;
1297
+ }
1298
+ modalActionListener(evt) {
1299
+ const modalAction = evt.detail;
1300
+ switch (modalAction) {
1301
+ case ModalAction.CANCEL:
1302
+ this.handleClearAll();
1303
+ break;
1304
+ case ModalAction.OK:
1305
+ this.handleApplyFilters();
1306
+ break;
1307
+ case ModalAction.CLOSE:
1308
+ this.handleClose();
1309
+ break;
1310
+ }
1311
+ }
1312
+ handleFilterChange(filterConfig) {
1313
+ this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
1314
+ }
1315
+ handleClearFilterList(filterList) {
1316
+ this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
1317
+ }
1318
+ handleClearSigleFilter(filterItem) {
1319
+ if (FilterItemType.MULTI_LIST === filterItem.type) {
1320
+ let filterItemCopy = ObjectUtils.copy(filterItem);
1321
+ this.uncheckFilterValues(filterItemCopy.value);
1322
+ const filterListCopy = ObjectUtils.copy(this.filters);
1323
+ const index = filterListCopy.findIndex(item => item.id === filterItem.id);
1324
+ filterListCopy.splice(index, 1, filterItemCopy);
1325
+ this.filters = ObjectUtils.copy(filterListCopy);
1326
+ return;
1327
+ }
1328
+ if (FilterItemType.CHECK_BOX_LIST === filterItem.type) {
1329
+ const filterListCopy = ObjectUtils.copy(this.filters);
1330
+ filterListCopy.find(filter => filter.id === filterItem.id).value = undefined;
1331
+ this.filters = ObjectUtils.copy(filterListCopy);
1332
+ return;
1333
+ }
1334
+ const filter = this.filters.find(filter => filter.id === filterItem.id);
1335
+ filter.value = undefined;
1336
+ this.filters = ObjectUtils.copy(this.filters);
1337
+ }
1338
+ uncheckFilterValues(valueList) {
1339
+ valueList.forEach(value => {
1340
+ if (!!value) {
1341
+ value.check = false;
1342
+ }
1343
+ });
1344
+ return valueList;
1345
+ }
1346
+ renderFilterItem(filterItem, fullRow) {
1347
+ return (h("snk-filter-modal-item", { class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event.detail), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
1348
+ }
1349
+ isDefaultFilterNumberVariation(filter) {
1350
+ var _a;
1351
+ return filter.type === FilterItemType.NUMBER
1352
+ && (!filter.props.variation || ((_a = filter.props) === null || _a === void 0 ? void 0 : _a.variation) === FilterNumberVariation.DEFAULT);
1353
+ }
1354
+ mountFiltersLines(filters) {
1355
+ const MAX_LINE_LENGTH = 2;
1356
+ let currentLine = 0;
1357
+ let forceAddCurrent = false;
1358
+ const filtersLines = {};
1359
+ for (let curr = 0; curr < filters.length; curr++) {
1360
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
1361
+ const item = filters[curr];
1362
+ const isLast = curr === filters.length - 1;
1363
+ const currentItemMatch = item.type === FilterItemType.TEXT || this.isDefaultFilterNumberVariation(item);
1364
+ const nextItemMatch = isLast ? false : filters[curr + 1].type === FilterItemType.TEXT || this.isDefaultFilterNumberVariation(filters[curr + 1]);
1365
+ if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
1366
+ filtersLines[currentLine].push(item);
1367
+ forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
1368
+ if (filtersLines[currentLine].length === MAX_LINE_LENGTH)
1369
+ ++currentLine;
1370
+ continue;
1371
+ }
1372
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
1373
+ filtersLines[currentLine].push(item);
1374
+ ++currentLine;
1375
+ }
1376
+ return Object.values(filtersLines);
1377
+ }
1378
+ renderFilterLine(filters) {
1379
+ const fullLine = filters.length === 1;
1380
+ return filters.map((filter) => this.renderFilterItem(filter, fullLine));
1381
+ }
1382
+ getIformedFiltersCount(listItems) {
1383
+ let countInformedItens = 0;
1384
+ listItems.forEach(item => {
1385
+ var _a, _b, _c, _d, _e, _f;
1386
+ if (FilterItemType.MULTI_LIST === item.type) {
1387
+ countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
1388
+ return;
1389
+ }
1390
+ if (FilterItemType.CHECK_BOX_LIST === item.type) {
1391
+ countInformedItens += Object.entries((_f = item.value) !== null && _f !== void 0 ? _f : {})
1392
+ .filter(([_, value]) => value === true)
1393
+ .map(([key, _]) => key).length;
1394
+ return;
1395
+ }
1396
+ if (item.groupedItems != undefined) {
1397
+ countInformedItens = item.groupedItems.filter(item => item.visible).length;
1398
+ return;
1399
+ }
1400
+ if (!!item.value) {
1401
+ countInformedItens++;
1402
+ }
1403
+ });
1404
+ return countInformedItens;
1405
+ }
1406
+ renderCollapsibleFilterBox(label, listItems, isSingleItem, shouldRenderFooter = true) {
1407
+ if (!listItems.length)
1408
+ return null;
1409
+ const appliedFilters = this.getIformedFiltersCount(listItems);
1410
+ const lines = this.mountFiltersLines(listItems);
1411
+ return (h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (h("ez-badge", { class: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
1412
+ }
1413
+ componentWillRender() {
1414
+ this._modalTitle = this.getCustomMessage('title');
1415
+ this._okButtonLabel = this.getCustomMessage('okButtonLabel');
1416
+ this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
1417
+ }
1418
+ componentDidLoad() {
1419
+ if (!this._originalFilterConfig)
1420
+ this._originalFilterConfig = this.filters;
1421
+ }
1422
+ render() {
1423
+ const customFilters = this.filters.filter(filter => filter.filterType === FilterType.CUSTOM_FILTER);
1424
+ const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
1425
+ const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
1426
+ return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
1427
+ }
1428
+ };
1429
+ SnkFilterModal.style = snkFilterModalCss;
1430
+
1431
+ export { SnkFilterBar as snk_filter_bar, SnkFilterItem as snk_filter_item, SnkFilterList as snk_filter_list, SnkFilterModal as snk_filter_modal };