@sankhyalabs/sankhyablocks 8.16.0-dev.4 → 8.16.0-dev.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) hide show
  1. package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-ecc0ed20.js} +3 -2
  2. package/dist/cjs/{IExporterProvider-597949f9.js → ContinuousInsertUtils-c7e35e3b.js} +39 -6
  3. package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-cadeef8e.js} +21 -15
  4. package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
  5. package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-f1c92f79.js} +74 -20
  6. package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-bae64d0d.js} +7 -3
  7. package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-d68841bc.js} +1 -1
  8. package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-a36ae041.js} +48 -20
  9. package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
  10. package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-ed497282.js} +5 -2
  11. package/dist/cjs/index-f9e81701.js +8 -28
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-490a86c3.js} +7 -2
  14. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  15. package/dist/cjs/snk-actions-button_4.cjs.entry.js +17 -14
  16. package/dist/cjs/snk-application.cjs.entry.js +7 -7
  17. package/dist/cjs/snk-attach.cjs.entry.js +38 -29
  18. package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +381 -7
  19. package/dist/cjs/snk-crud.cjs.entry.js +16 -7
  20. package/dist/cjs/snk-data-exporter.cjs.entry.js +19 -18
  21. package/dist/cjs/{snk-data-unit-685272e7.js → snk-data-unit-b460f1da.js} +42 -22
  22. package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
  23. package/dist/cjs/snk-detail-view.cjs.entry.js +12 -13
  24. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +1411 -0
  26. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  27. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  28. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  29. package/dist/cjs/snk-grid.cjs.entry.js +58 -21
  30. package/dist/cjs/{snk-guides-viewer-67605336.js → snk-guides-viewer-de0a5c57.js} +27 -14
  31. package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
  32. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  34. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  35. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-simple-crud.cjs.entry.js +66 -27
  37. package/dist/cjs/snk-taskbar.cjs.entry.js +24 -1
  38. package/dist/collection/collection-manifest.json +11 -31
  39. package/dist/collection/components/snk-actions-button/actions/index.js +12 -9
  40. package/dist/collection/components/snk-attach/snk-attach.js +25 -16
  41. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
  42. package/dist/collection/components/snk-crud/snk-crud.js +97 -2
  43. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +3 -4
  44. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
  45. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +70 -7
  46. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  47. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +4 -4
  48. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +5 -5
  49. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +1 -1
  50. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  51. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
  52. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  53. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +4 -4
  54. package/dist/collection/components/snk-data-unit/snk-data-unit.js +57 -20
  55. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  56. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
  57. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +1 -1
  58. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
  59. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +59 -21
  60. package/dist/collection/components/snk-form/snk-form.js +2 -2
  61. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +72 -18
  62. package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
  63. package/dist/collection/components/snk-form-config/snk-form-config.js +32 -3
  64. package/dist/collection/components/snk-grid/snk-grid.css +2 -0
  65. package/dist/collection/components/snk-grid/snk-grid.js +74 -8
  66. package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
  67. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
  68. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +0 -1
  69. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +91 -16
  70. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
  71. package/dist/collection/components/snk-taskbar/snk-taskbar.js +65 -0
  72. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
  73. package/dist/collection/lib/configs/ConfigStorage.js +1 -0
  74. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
  75. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
  76. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +22 -16
  77. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
  78. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
  79. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +9 -2
  80. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +4 -1
  81. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
  82. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
  83. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  84. package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
  85. package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
  86. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  87. package/dist/collection/sw.js +46 -0
  88. package/dist/components/ConfigStorage.js +1 -0
  89. package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +40 -5
  90. package/dist/components/DataFetcher.js +22 -16
  91. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  92. package/dist/components/SnkFormConfigManager.js +72 -18
  93. package/dist/components/SnkMessageBuilder.js +7 -3
  94. package/dist/components/dataunit-fetcher.js +47 -17
  95. package/dist/components/form-config-fetcher.js +4 -1
  96. package/dist/components/pesquisa-fetcher.js +6 -1
  97. package/dist/components/snk-actions-button2.js +12 -9
  98. package/dist/components/snk-attach2.js +34 -25
  99. package/dist/components/snk-crud.js +15 -2
  100. package/dist/components/snk-data-exporter2.js +12 -11
  101. package/dist/components/snk-data-unit2.js +44 -60
  102. package/dist/components/snk-detail-view2.js +28 -13
  103. package/dist/components/snk-exporter-email-sender2.js +1 -1
  104. package/dist/components/snk-filter-bar2.js +35 -22
  105. package/dist/components/snk-filter-binary-select.js +1 -1
  106. package/dist/components/snk-filter-checkbox-list.js +1 -1
  107. package/dist/components/snk-form-config2.js +17 -4
  108. package/dist/components/snk-form.js +2 -2
  109. package/dist/components/snk-grid2.js +51 -12
  110. package/dist/components/snk-personalized-filter-editor.js +1 -1
  111. package/dist/components/snk-print-selector.js +1 -1
  112. package/dist/components/snk-simple-bar2.js +1 -1
  113. package/dist/components/snk-simple-crud2.js +59 -16
  114. package/dist/components/snk-taskbar2.js +25 -2
  115. package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-7b36d041.js} +3 -2
  116. package/dist/esm/{IExporterProvider-63a188b6.js → ContinuousInsertUtils-3e520a07.js} +40 -8
  117. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-a9c598f2.js} +22 -16
  118. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  119. package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-f1a0fc92.js} +74 -20
  120. package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-6fff4a4c.js} +7 -3
  121. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-749d880f.js} +1 -1
  122. package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
  123. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-fd58c640.js} +48 -18
  124. package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
  125. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-adbe5d34.js} +5 -2
  126. package/dist/esm/index-a7d3d3f1.js +8 -28
  127. package/dist/esm/loader.js +1 -1
  128. package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-50fc7e6b.js} +7 -2
  129. package/dist/esm/sankhyablocks.js +1 -1
  130. package/dist/esm/snk-actions-button_4.entry.js +18 -15
  131. package/dist/esm/snk-application.entry.js +7 -7
  132. package/dist/esm/snk-attach.entry.js +39 -30
  133. package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +382 -10
  134. package/dist/esm/snk-configurator.entry.js +1 -1
  135. package/dist/esm/snk-crud.entry.js +17 -8
  136. package/dist/esm/snk-data-exporter.entry.js +20 -19
  137. package/dist/esm/{snk-data-unit-63f83504.js → snk-data-unit-590225b5.js} +42 -22
  138. package/dist/esm/snk-data-unit.entry.js +5 -5
  139. package/dist/esm/snk-detail-view.entry.js +13 -14
  140. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  141. package/dist/esm/snk-field-config.entry.js +1 -1
  142. package/dist/esm/snk-filter-bar_4.entry.js +1404 -0
  143. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  144. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  145. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  146. package/dist/esm/snk-grid.entry.js +53 -16
  147. package/dist/esm/{snk-guides-viewer-151f6091.js → snk-guides-viewer-2f4dcdc5.js} +28 -15
  148. package/dist/esm/snk-guides-viewer.entry.js +9 -9
  149. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  150. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  151. package/dist/esm/snk-print-selector.entry.js +1 -1
  152. package/dist/esm/snk-simple-bar.entry.js +1 -1
  153. package/dist/esm/snk-simple-crud.entry.js +63 -24
  154. package/dist/esm/snk-tab-config.entry.js +1 -1
  155. package/dist/esm/snk-taskbar.entry.js +24 -1
  156. package/dist/sankhyablocks/p-052213ba.entry.js +1 -0
  157. package/dist/sankhyablocks/{p-df5451c7.js → p-06421fdb.js} +2 -2
  158. package/dist/sankhyablocks/p-0b6cd238.entry.js +1 -0
  159. package/dist/sankhyablocks/p-0e320bd2.entry.js +1 -0
  160. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  161. package/dist/sankhyablocks/p-17425c72.js +1 -0
  162. package/dist/sankhyablocks/{p-a1d72395.entry.js → p-212213d9.entry.js} +1 -1
  163. package/dist/sankhyablocks/p-23736d75.js +1 -0
  164. package/dist/sankhyablocks/p-275de842.entry.js +1 -0
  165. package/dist/sankhyablocks/p-2aae03a1.entry.js +1 -0
  166. package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
  167. package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
  168. package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
  169. package/dist/sankhyablocks/p-47bce500.js +60 -0
  170. package/dist/sankhyablocks/{p-aff76a53.js → p-4d9549cf.js} +2 -2
  171. package/dist/sankhyablocks/p-583517ba.entry.js +1 -0
  172. package/dist/sankhyablocks/p-5b51491f.entry.js +1 -0
  173. package/dist/sankhyablocks/p-5e51e833.entry.js +1 -0
  174. package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
  175. package/dist/sankhyablocks/p-656f0e51.entry.js +1 -0
  176. package/dist/sankhyablocks/p-72c10005.entry.js +1 -0
  177. package/dist/sankhyablocks/p-7bd9683d.js +1 -0
  178. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  179. package/dist/sankhyablocks/{p-af8efd95.js → p-8a9638ae.js} +2 -2
  180. package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
  181. package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
  182. package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
  183. package/dist/sankhyablocks/p-9f9b99d9.js +1 -0
  184. package/dist/sankhyablocks/p-ab1645fb.entry.js +1 -0
  185. package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
  186. package/dist/sankhyablocks/{p-913a9979.js → p-ca5ec380.js} +1 -1
  187. package/dist/sankhyablocks/p-cefb0ee1.entry.js +1 -0
  188. package/dist/sankhyablocks/{p-82a0bfb0.entry.js → p-dbe6174a.entry.js} +2 -2
  189. package/dist/sankhyablocks/p-f3434fc4.js +1 -0
  190. package/dist/sankhyablocks/p-fa6c5826.entry.js +1 -0
  191. package/dist/sankhyablocks/p-fadc8339.js +1 -0
  192. package/dist/sankhyablocks/{p-eae7a817.entry.js → p-fb34e0cf.entry.js} +1 -1
  193. package/dist/sankhyablocks/p-fd13b4d2.js +1 -0
  194. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  195. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  196. package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
  197. package/dist/types/components/snk-crud/snk-crud.d.ts +17 -0
  198. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
  199. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +3 -3
  200. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +7 -0
  201. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
  202. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +9 -4
  203. package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
  204. package/dist/types/components/snk-grid/snk-grid.d.ts +11 -0
  205. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +13 -0
  206. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
  207. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  208. package/dist/types/components.d.ts +113 -0
  209. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
  210. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
  211. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +1 -1
  212. package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
  213. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  214. package/package.json +4 -3
  215. package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
  216. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -714
  217. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
  218. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
  219. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
  220. package/dist/cjs/snk-form.cjs.entry.js +0 -143
  221. package/dist/esm/snk-config-options.entry.js +0 -235
  222. package/dist/esm/snk-filter-bar.entry.js +0 -710
  223. package/dist/esm/snk-filter-item.entry.js +0 -308
  224. package/dist/esm/snk-filter-list.entry.js +0 -148
  225. package/dist/esm/snk-filter-modal.entry.js +0 -245
  226. package/dist/esm/snk-form.entry.js +0 -139
  227. package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
  228. package/dist/sankhyablocks/p-14b9f964.entry.js +0 -1
  229. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  230. package/dist/sankhyablocks/p-3a212712.js +0 -1
  231. package/dist/sankhyablocks/p-3a216b81.entry.js +0 -1
  232. package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
  233. package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
  234. package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
  235. package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
  236. package/dist/sankhyablocks/p-75f83d1d.entry.js +0 -1
  237. package/dist/sankhyablocks/p-7a337364.js +0 -1
  238. package/dist/sankhyablocks/p-829d4045.js +0 -1
  239. package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
  240. package/dist/sankhyablocks/p-8fc470e5.entry.js +0 -1
  241. package/dist/sankhyablocks/p-941bf3ef.entry.js +0 -1
  242. package/dist/sankhyablocks/p-9863d682.js +0 -1
  243. package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
  244. package/dist/sankhyablocks/p-b4b21558.entry.js +0 -1
  245. package/dist/sankhyablocks/p-bad55caa.entry.js +0 -1
  246. package/dist/sankhyablocks/p-c053256c.entry.js +0 -1
  247. package/dist/sankhyablocks/p-c2495304.js +0 -1
  248. package/dist/sankhyablocks/p-c5268346.entry.js +0 -1
  249. package/dist/sankhyablocks/p-cefba299.js +0 -1
  250. package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
  251. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
  252. package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
  253. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  254. package/dist/sankhyablocks/p-fcac4dfc.js +0 -1
  255. package/dist/sankhyablocks/p-fe79f83a.js +0 -60
  256. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -1,714 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index$1 = require('./index-f9e81701.js');
6
- const core = require('@sankhyalabs/core');
7
- const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
8
- const ConfigStorage = require('./ConfigStorage-942ce74b.js');
9
- const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
10
- const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
11
- const index = require('./index-c5771aba.js');
12
- const filterNumberVariation = require('./filterNumberVariation-d65332da.js');
13
- const utils = require('@sankhyalabs/ezui/dist/collection/utils');
14
- const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
15
- require('./form-config-fetcher-2dd00e5b.js');
16
- require('./DataFetcher-313debd8.js');
17
- require('./PrintUtils-bcaeb82f.js');
18
- require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
19
-
20
- const buildFilter = (item) => {
21
- switch (item.type) {
22
- case filterItemType_enum.FilterItemType.DEFAULT_FILTER:
23
- return buildDefault(item);
24
- case filterItemType_enum.FilterItemType.BINARY_SELECT:
25
- return buildBinary(item);
26
- case filterItemType_enum.FilterItemType.MULTI_SELECT:
27
- return buildMultSelect(item);
28
- case filterItemType_enum.FilterItemType.MULTI_LIST:
29
- return buildMultiList(item);
30
- case filterItemType_enum.FilterItemType.PERIOD:
31
- return buildPeriod(item);
32
- case filterItemType_enum.FilterItemType.SEARCH:
33
- return buildSearch(item);
34
- case filterItemType_enum.FilterItemType.TEXT:
35
- return buildText(item);
36
- case filterItemType_enum.FilterItemType.NUMBER:
37
- return buildNumber(item);
38
- case filterItemType_enum.FilterItemType.PERSONALIZED:
39
- return buildPersonalized(item);
40
- case filterItemType_enum.FilterItemType.CHECK_BOX_LIST:
41
- return buildCheckboxList(item);
42
- default:
43
- return undefined;
44
- }
45
- };
46
- function buildDefault(item) {
47
- return { name: item.id, expression: item.props.expression, params: [] };
48
- }
49
- function buildBinary(item) {
50
- const { id, value, props } = item;
51
- const options = props.options;
52
- const selectedOption = options.find(opt => opt.name === value);
53
- return { name: id, expression: selectedOption.expression, params: [] };
54
- }
55
- function buildMultSelect(item) {
56
- const { id, value, props } = item;
57
- return { name: id, expression: props.expression, params: [{ name: id, dataType: core.DataType.TEXT, value }] };
58
- }
59
- function buildMultiList(item) {
60
- const { id, value, props } = item;
61
- const parsedValues = parseMultiListValues(value);
62
- if (parsedValues.length > 0) {
63
- return {
64
- name: id,
65
- expression: props.expression,
66
- params: [{
67
- name: id,
68
- dataType: core.DataType.TEXT,
69
- value: JSON.stringify(parsedValues)
70
- }]
71
- };
72
- }
73
- }
74
- function buildCheckboxList(item) {
75
- var _a;
76
- const { id, value, props } = item;
77
- const selectedOptionNames = Object.entries(value !== null && value !== void 0 ? value : {})
78
- .filter(([_, valueChecked]) => valueChecked === true)
79
- .map(([key, _]) => key);
80
- const selectedOptionsObject = (_a = props.options) === null || _a === void 0 ? void 0 : _a.filter(option => selectedOptionNames.includes(option.name));
81
- return { name: id, expression: buildCheckboxListExpression(selectedOptionsObject), params: [] };
82
- }
83
- function buildCheckboxListExpression(options) {
84
- let expression = "";
85
- options.forEach((option, index) => {
86
- var _a;
87
- expression += ` ${index > 0 ? ((_a = option.operand) !== null && _a !== void 0 ? _a : 'OR') : ''} ${option.expression}`;
88
- });
89
- return expression.trim();
90
- }
91
- function parseMultiListValues(multiListValue) {
92
- var _a, _b;
93
- 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;
94
- return value.filter(item => item === null || item === void 0 ? void 0 : item.check).map(({ id }) => Number.isNaN(+id) ? String(id) : Number(id));
95
- }
96
- function buildPeriod(item) {
97
- const { id, value, props } = item;
98
- let { end, start } = value;
99
- if (typeof end === "string") {
100
- end = new Date(end);
101
- }
102
- if (typeof start === "string") {
103
- start = new Date(start);
104
- }
105
- const params = [];
106
- let expression;
107
- if (end && start) {
108
- expression = props.expression.fullfill;
109
- params.push({ name: `${id}.START`, dataType: core.DataType.DATE, value: DataType.toString(core.DataType.DATE, start) }, { name: `${id}.END`, dataType: core.DataType.DATE, value: DataType.toString(core.DataType.DATE, end) });
110
- }
111
- else {
112
- if (start) {
113
- expression = props.expression.onlystart;
114
- params.push({ name: id, dataType: core.DataType.DATE, value: DataType.toString(core.DataType.DATE, start) });
115
- }
116
- else {
117
- expression = props.expression.onlyend;
118
- params.push({ name: id, dataType: core.DataType.DATE, value: DataType.toString(core.DataType.DATE, end) });
119
- }
120
- }
121
- return { name: id, expression, params };
122
- }
123
- function buildSearch(item) {
124
- const { id, value, props } = item;
125
- const expression = props.expression;
126
- return { name: id, expression, params: [{ name: id, dataType: core.DataType.TEXT, value: DataType.toString(core.DataType.TEXT, value.value) }] };
127
- }
128
- function buildText(item) {
129
- let { id, value, props } = item;
130
- const expression = props.expression;
131
- if (!core.StringUtils.isEmpty(props.likeAs)) {
132
- value = buildLikeValue(value, props.likeAs);
133
- }
134
- return { name: id, expression, params: [{ name: id, dataType: core.DataType.TEXT, value: DataType.toString(core.DataType.TEXT, value) }] };
135
- }
136
- function buildNumber(item) {
137
- const { id, value, props } = item;
138
- const variation = props.variation;
139
- if (variation === filterNumberVariation.FilterNumberVariation.INTERVAL) {
140
- const { start, end } = value !== null && value !== void 0 ? value : { start: 0, end: 0 };
141
- if (start && end) {
142
- return {
143
- name: id,
144
- expression: props.intervalExpression.fullfill,
145
- params: [
146
- { name: `${id}.START`, dataType: core.DataType.NUMBER, value: DataType.toString(core.DataType.NUMBER, start) },
147
- { name: `${id}.END`, dataType: core.DataType.NUMBER, value: DataType.toString(core.DataType.NUMBER, end) }
148
- ]
149
- };
150
- }
151
- if (start) {
152
- return {
153
- name: id,
154
- expression: props.intervalExpression.onlystart,
155
- params: [
156
- { name: id, dataType: core.DataType.NUMBER, value: DataType.toString(core.DataType.NUMBER, start) }
157
- ]
158
- };
159
- }
160
- if (end) {
161
- return {
162
- name: id,
163
- expression: props.intervalExpression.onlyend,
164
- params: [
165
- { name: id, dataType: core.DataType.NUMBER, value: DataType.toString(core.DataType.NUMBER, end) }
166
- ]
167
- };
168
- }
169
- }
170
- const expression = props.expression;
171
- return { name: id, expression, params: [{ name: id, dataType: core.DataType.NUMBER, value: DataType.toString(core.DataType.NUMBER, value) }] };
172
- }
173
- function buildLikeValue(valueAsString, likeAs) {
174
- if (likeAs === "CONTANIS") {
175
- return `%${valueAsString}%`;
176
- }
177
- else if (likeAs === "STARTS_WITH") {
178
- return `${valueAsString}%`;
179
- }
180
- else if (likeAs === "ENDS_WITH") {
181
- return `%${valueAsString}`;
182
- }
183
- return valueAsString;
184
- }
185
- function buildPersonalized(item) {
186
- const { id, groupedItems = [] } = item;
187
- const activeFilters = groupedItems.filter(groupItem => !!groupItem.visible);
188
- const filters = activeFilters.map(item => {
189
- var _a;
190
- const expression = item.props.expression;
191
- const params = (((_a = item.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
192
- const valuesArray = Array.from(item.value || 0);
193
- const dataType = param.dataType;
194
- let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
195
- if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
196
- paramValue = paramValue["value"];
197
- }
198
- if (paramValue == undefined && dataType === core.DataType.BOOLEAN) {
199
- paramValue = false;
200
- }
201
- return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : DataType.toString(dataType, paramValue) };
202
- });
203
- return { expression, name: item.id, params };
204
- });
205
- const expression = filters.map(filter => `(${filter.expression})`).join(` ${index.FilterOperand.AND} `);
206
- const params = filters.flatMap(filter => filter.params);
207
- return { name: id, expression, params };
208
- }
209
-
210
- class SnkFilterModalFactory {
211
- constructor({ filterConfig, configName, onComplete, getMessage, disablePersonalizedFilter, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
212
- this._filterConfig = filterConfig;
213
- this._configName = configName;
214
- this._onComplete = onComplete;
215
- this._getMessage = getMessage;
216
- this._disablePersonalizedFilter = disablePersonalizedFilter;
217
- this._addPersonalizedFilterFn = onAddPersonalizedFilter;
218
- this._editPersonalizedFilterFn = onEditPersonalizedFilter;
219
- this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
220
- }
221
- applyFilters(newFilterConfig) {
222
- this._onComplete(newFilterConfig);
223
- this._closeModal();
224
- }
225
- buildFilterModal() {
226
- const filterModal = document.createElement("snk-filter-modal");
227
- filterModal.className = "ez-size-height--full";
228
- filterModal.filters = this._filterConfig;
229
- filterModal.configName = this._configName;
230
- filterModal.disablePersonalizedFilter = this._disablePersonalizedFilter;
231
- filterModal.getMessage = this._getMessage.bind(this);
232
- filterModal.applyFilters = this.applyFilters.bind(this);
233
- filterModal.closeModal = () => this._closeModal();
234
- filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
235
- filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
236
- filterModal.deletePersonalizedFilter = (filter, configName) => this._onDeletePersonalizedFilter(filter, configName);
237
- return filterModal;
238
- }
239
- async showModal() {
240
- const filterModal = this.buildFilterModal();
241
- const modalProps = {
242
- content: filterModal,
243
- position: 'left',
244
- heightMode: 'full',
245
- closeOutsideClick: false,
246
- useScrimLight: true
247
- };
248
- this._closeModal = await utils.ApplicationUtils.showModal(modalProps);
249
- }
250
- async closeModal() {
251
- this._closeModal();
252
- }
253
- }
254
-
255
- 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:8px}[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__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-self:center}.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%}";
256
-
257
- const SnkFilterBar = class {
258
- constructor(hostRef) {
259
- index$1.registerInstance(this, hostRef);
260
- this.configUpdated = index$1.createEvent(this, "configUpdated", 7);
261
- this._updateSequence = [];
262
- this._loadingPending = false;
263
- this._configUpdated = false;
264
- this._firstLoad = true;
265
- this._pendingVariables = false;
266
- this._customfiltersToBeUpdated = [];
267
- this._calculateSortIndex = (item) => {
268
- let index = item.hardFixed ? 1000000 : 0;
269
- //campos Hard Fixed não variam a ordem
270
- if (!item.hardFixed) {
271
- index += item.fixed ? 100000 : 0;
272
- index += item.value == undefined ? 0 : 10000;
273
- index += this._updateSequence.lastIndexOf(item.id) + 1;
274
- }
275
- return index;
276
- };
277
- this._filtersComparator = (a, b) => {
278
- return this._calculateSortIndex(b) - this._calculateSortIndex(a);
279
- };
280
- this.dataUnit = undefined;
281
- this.title = undefined;
282
- this.configName = undefined;
283
- this.resourceID = undefined;
284
- this.mode = "regular";
285
- this.filterConfig = undefined;
286
- this.messagesBuilder = undefined;
287
- this.disablePersonalizedFilter = undefined;
288
- this.filterBarLegacyConfigName = undefined;
289
- this.autoLoad = undefined;
290
- this.allowDefault = undefined;
291
- this.scrollerLocked = false;
292
- this.showPersonalizedFilter = false;
293
- this.personalizedFilterId = undefined;
294
- }
295
- observeFilterConfig(newValue, oldValue) {
296
- if (core.ObjectUtils.equals(newValue, oldValue))
297
- return;
298
- this.handleFilterConfigsChanged(oldValue, newValue);
299
- }
300
- handleFilterConfigsChanged(oldValue, newValue) {
301
- if (oldValue != undefined && newValue == undefined) {
302
- this._loadingPending = true;
303
- this._configUpdated = true;
304
- }
305
- else {
306
- const oldItems = new Map(oldValue ? oldValue.map(item => [item.id, item]) : undefined);
307
- if (oldItems.size === 0 && newValue.length > 0) {
308
- this._loadingPending = true;
309
- this._configUpdated = false;
310
- }
311
- else {
312
- newValue.forEach(newItem => {
313
- const oldItem = oldItems.get(newItem.id);
314
- if (oldItem != undefined) {
315
- this._configUpdated = this._configUpdated || core.ObjectUtils.objectToString(oldItem) != core.ObjectUtils.objectToString(newItem);
316
- this._loadingPending = this._loadingPending || core.ObjectUtils.objectToString(oldItem.value) !== core.ObjectUtils.objectToString(newItem.value);
317
- if (!this._loadingPending) {
318
- const groupedChanged = core.ObjectUtils.objectToString(oldItem.groupedItems) != core.ObjectUtils.objectToString(newItem.groupedItems);
319
- this._configUpdated = this._configUpdated || groupedChanged;
320
- this._loadingPending = this._loadingPending || groupedChanged;
321
- }
322
- }
323
- else {
324
- this._configUpdated = true;
325
- this._loadingPending = this._loadingPending || newItem.value != undefined;
326
- }
327
- });
328
- }
329
- }
330
- if (this._loadingPending || this._configUpdated)
331
- this.configUpdated.emit(newValue);
332
- this.processAfterUpdateConfig();
333
- }
334
- /**
335
- * Faz o recarregamento da filterbar buscando o state no servidor.
336
- */
337
- async reload() {
338
- this.loadConfigFromStorage(true);
339
- }
340
- /**
341
- * Retorna um item de filtro pelo ID.
342
- */
343
- async getFilterItem(id) {
344
- const item = this.filterConfig.find(item => item.id === id);
345
- return Promise.resolve(core.ObjectUtils.copy(item));
346
- }
347
- /**
348
- * Atualiza um item do filtro.
349
- *
350
- * @param filterItem - Item com as informações atualizadas, caso o item não seja encontrado no array ele mão será modificado
351
- */
352
- async updateFilterItem(newFilterItem) {
353
- const itemIndex = this.filterConfig.findIndex(item => item.id === newFilterItem.id);
354
- if (itemIndex == -1) {
355
- console.warn("[SnkFilterBar.updateFilterItem] FilterItem não encontrado, o mesmo não será atualizado.");
356
- return Promise.resolve();
357
- }
358
- this._loadingPending = true;
359
- this.updateFilter(newFilterItem);
360
- return Promise.resolve();
361
- }
362
- /**
363
- * Adiciona um item de filtro.
364
- *
365
- * @param filterItem - Item a ser adicionado, caso o item já exista com o ID ele não será adicionado novamente
366
- */
367
- async addFilterItem(filterItem) {
368
- const itemIndex = this.filterConfig.findIndex(item => item.id === filterItem.id);
369
- if (itemIndex > -1) {
370
- console.warn("[SnkFilterBar.addFilterItem] FilterItem já existe , o mesmo não será adicionado novamente.");
371
- return Promise.resolve();
372
- }
373
- this.filterConfig.push(filterItem);
374
- this._loadingPending = true;
375
- this.updateFilter(filterItem);
376
- return Promise.resolve();
377
- }
378
- /**
379
- * Remove um item de filtro.
380
- *
381
- * @param filterID - ID do a ser adicionado
382
- *
383
- * @returns {Promise<SnkFilterItemConfig|undefined>} - Retorna o item de filtro removido, ou undefined caso não encontrado.
384
- */
385
- async removeFilterItem(filterID) {
386
- const itemIndex = this.filterConfig.findIndex(item => item.id === filterID);
387
- if (itemIndex == -1) {
388
- console.warn("[SnkFilterBar.removeFilterItem] FilterItem não encontrado");
389
- return Promise.resolve(undefined);
390
- }
391
- const itemToRemove = this.filterConfig[itemIndex];
392
- this.filterConfig = this.filterConfig.filter(item => item.id !== filterID);
393
- return Promise.resolve(itemToRemove);
394
- }
395
- componentDidLoad() {
396
- if (this._element) {
397
- const dataInfo = { dataUnit: this.dataUnit };
398
- core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
399
- }
400
- }
401
- processPendingFilter() {
402
- if (this._pendingVariables) {
403
- const popUp = this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");
404
- if (popUp) {
405
- popUp.showUp(true).then(() => {
406
- this.processAfterUpdateConfig();
407
- });
408
- }
409
- }
410
- else {
411
- this.processAfterUpdateConfig();
412
- }
413
- }
414
- getPersonalizedFilterItem() {
415
- return this.filterConfig.find(item => item.type === filterItemType_enum.FilterItemType.PERSONALIZED);
416
- }
417
- async processAfterUpdateConfig() {
418
- if (this._loadingPending) {
419
- if (await this._application.isLoadedByPk() && !this._configUpdated)
420
- return;
421
- const personalizedFilter = this.getPersonalizedFilterItem();
422
- this._pendingVariables = !PersonalizedFilterUtils.PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
423
- if (this._pendingVariables) {
424
- return;
425
- }
426
- this._loadingPending = false;
427
- this.doLoadData(this.dataUnit.getLastLoadRequest() != undefined);
428
- }
429
- if (this._configUpdated) {
430
- this._configUpdated = false;
431
- ConfigStorage.ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
432
- }
433
- }
434
- async doLoadData(forceReload = false) {
435
- try {
436
- if (this._firstLoad && this.autoLoad === false) {
437
- return;
438
- }
439
- if (this._firstLoad && !forceReload && this.autoLoad === undefined) {
440
- let autoLoad = await this._application.getBooleanParam("global.carregar.registros.iniciar.tela");
441
- if (!autoLoad) {
442
- return;
443
- }
444
- }
445
- this.dataUnit.loadData(undefined, undefined, true);
446
- }
447
- finally {
448
- this._firstLoad = false;
449
- }
450
- }
451
- /**
452
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
453
- * através de um pequeno modulo na estrutura da aplicação:
454
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
455
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
456
- */
457
- getMessage(key, params, defaultValue) {
458
- var _a;
459
- if (this.messagesBuilder == undefined && this._application) {
460
- this.messagesBuilder = this._application.messagesBuilder;
461
- }
462
- return ((_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params)) || defaultValue;
463
- }
464
- getFilter(_dataUnit) {
465
- var _a;
466
- const filters = [];
467
- (_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => this.isActiveFilter(item)).forEach(item => {
468
- const filter = buildFilter(item);
469
- if (filter) {
470
- filters.push(filter);
471
- }
472
- });
473
- return filters;
474
- }
475
- isActiveFilter(item) {
476
- /*
477
- - O filtro padrão também deve sempre ser condiderado ativo, pois, sempre deve
478
- ser aplicado.
479
- */
480
- if (item.type === filterItemType_enum.FilterItemType.DEFAULT_FILTER) {
481
- return true;
482
- }
483
- return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
484
- }
485
- registryFilterProvider() {
486
- this.dataUnit.addFilterProvider(this);
487
- if (this.filterConfig) {
488
- this.doLoadData();
489
- }
490
- }
491
- itemFocused(selectedItem) {
492
- this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
493
- if (item.id === selectedItem) {
494
- if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
495
- item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
496
- }
497
- }
498
- else {
499
- item["hideDetail"]();
500
- }
501
- });
502
- }
503
- filterActiveFilter(item) {
504
- return item.visible || item.removalBlocked;
505
- }
506
- filterPersonalizedItems(item) {
507
- return item.type === filterItemType_enum.FilterItemType.PERSONALIZED;
508
- }
509
- getPersonalizedFilterVariableItems() {
510
- return this.filterConfig
511
- .filter(this.filterPersonalizedItems)
512
- .map(item => {
513
- const itemId = `filter-${item.id}`;
514
- return (index$1.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 }));
515
- });
516
- }
517
- getFilterItems() {
518
- const pinnedItems = [];
519
- const unpinnedItems = [];
520
- this.filterConfig
521
- .filter(this.filterActiveFilter)
522
- .forEach((item, index) => {
523
- item = core.ObjectUtils.copy(item);
524
- const itemId = `filter-${item.id}`;
525
- const filterItem = (index$1.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 }));
526
- if (item.fixed || item.hardFixed) {
527
- pinnedItems.push(filterItem);
528
- }
529
- else {
530
- unpinnedItems.push(filterItem);
531
- }
532
- return filterItem;
533
- });
534
- const elements = [];
535
- elements.push(...pinnedItems);
536
- if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
537
- elements.push(index$1.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
538
- }
539
- elements.push(...unpinnedItems);
540
- return elements;
541
- }
542
- calculateUpdateSequence(item) {
543
- if (item) {
544
- this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
545
- this._updateSequence.push(item.id);
546
- }
547
- }
548
- normalizeItem(item) {
549
- const normalized = Object.assign({}, item);
550
- const optionals = ["props", "value", "hardFixed", "fixed"];
551
- optionals.forEach(prop => {
552
- if (normalized[prop] == undefined) {
553
- delete normalized[prop];
554
- }
555
- });
556
- if (item.value === "") {
557
- delete item.value;
558
- }
559
- return normalized;
560
- }
561
- updateFilter(newItem) {
562
- this.filterConfig = this.filterConfig.map(item => {
563
- newItem = this.normalizeItem(newItem);
564
- if (item.id === newItem.id) {
565
- if (core.ObjectUtils.objectToString(item) != core.ObjectUtils.objectToString(newItem)) {
566
- this.calculateUpdateSequence(newItem);
567
- }
568
- return newItem;
569
- }
570
- return item;
571
- }).sort((a, b) => this._filtersComparator(a, b));
572
- }
573
- loadPermitions() {
574
- this._application.isUserSup().then(value => this.allowDefault = value);
575
- }
576
- addFilterBarLegacyConfigName() {
577
- if (this.filterBarLegacyConfigName && this.configName) {
578
- ConfigStorage.ConfigStorage.addFilterBarLegacyConfig(this.configName, this.filterBarLegacyConfigName);
579
- }
580
- }
581
- async loadConfigFromStorage(clearCache) {
582
- if (clearCache) {
583
- await ConfigStorage.ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
584
- }
585
- return new Promise(accept => {
586
- ConfigStorage.ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
587
- .then((filters) => {
588
- accept();
589
- this.filterConfig = filters.map(item => this.normalizeItem(item));
590
- })
591
- .catch(reason => {
592
- throw new core.ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
593
- });
594
- });
595
- }
596
- attachDataUnit() {
597
- if (this.dataUnit == undefined) {
598
- let parent = this._element.parentElement;
599
- while (parent) {
600
- if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
601
- const snkDataUnit = parent;
602
- this.dataUnit = snkDataUnit.dataUnit;
603
- if (this.dataUnit) {
604
- this.registryFilterProvider();
605
- }
606
- else {
607
- snkDataUnit.addEventListener("dataUnitReady", (evt) => {
608
- this.dataUnit = evt.detail;
609
- this.registryFilterProvider();
610
- });
611
- }
612
- break;
613
- }
614
- }
615
- parent = parent.parentElement;
616
- }
617
- else {
618
- this.registryFilterProvider();
619
- }
620
- }
621
- /**
622
- * Emitido quando acontece a alteração do estado do filtro.
623
- */
624
- filterChangeListener(evt) {
625
- this.updateFilter(evt.detail);
626
- }
627
- /**
628
- * Abre o modal de filtros
629
- */
630
- async showFilterModal() {
631
- const callbackOnApplyFilter = (filters) => {
632
- this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
633
- };
634
- let filtersConfigCopy = core.ObjectUtils.copy(this.filterConfig);
635
- filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
636
- return itemA.originOrder - itemB.originOrder;
637
- });
638
- const factoryParams = {
639
- filterConfig: filtersConfigCopy,
640
- configName: this.configName,
641
- onComplete: callbackOnApplyFilter,
642
- disablePersonalizedFilter: this.disablePersonalizedFilter,
643
- getMessage: (key, props) => this.getMessage(key, props),
644
- onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
645
- onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id),
646
- onDeletePersonalizedFilter: (filter, configName) => this.deletePersonalizedFilter(filter, filterItemType_enum.FilterItemType.PERSONALIZED, configName),
647
- };
648
- this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
649
- await this._filterModalFactory.showModal();
650
- }
651
- addPersonalizedFilter() {
652
- this._filterModalFactory.closeModal();
653
- this.personalizedFilterId = undefined;
654
- this.showPersonalizedFilter = true;
655
- window.requestAnimationFrame(() => {
656
- this._elPersonalizedFilter.createPersonalizedFilter();
657
- });
658
- }
659
- editPersonalizedFilter(id) {
660
- this._filterModalFactory.closeModal();
661
- this.showPersonalizedFilter = true;
662
- this.personalizedFilterId = id;
663
- }
664
- deletePersonalizedFilter(filter, filterItemType, configName) {
665
- if (filterItemType === filterItemType_enum.FilterItemType.PERSONALIZED) {
666
- ConfigStorage.ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
667
- }
668
- }
669
- handleHidePersonalizedFilter(reloadFilterBar) {
670
- if (reloadFilterBar) {
671
- this.loadConfigFromStorage().then(() => {
672
- this.hidePersonalizedFilter();
673
- });
674
- }
675
- else {
676
- this.hidePersonalizedFilter();
677
- }
678
- }
679
- hidePersonalizedFilter() {
680
- this.personalizedFilterId = undefined;
681
- this.showPersonalizedFilter = false;
682
- }
683
- componentWillLoad() {
684
- this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
685
- if (this._application) {
686
- this.loadPermitions();
687
- this.addFilterBarLegacyConfigName();
688
- this.loadConfigFromStorage();
689
- }
690
- this.attachDataUnit();
691
- }
692
- componentDidRender() {
693
- this.processPendingFilter();
694
- }
695
- render() {
696
- if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
697
- return undefined;
698
- }
699
- if (this.showPersonalizedFilter) {
700
- return index$1.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 });
701
- }
702
- if (this.mode !== "regular") {
703
- return (index$1.h(index$1.Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (index$1.h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }))));
704
- }
705
- return (index$1.h(index$1.Host, null, index$1.h("div", null, index$1.h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), index$1.h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, index$1.h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), index$1.h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, index$1.h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
706
- }
707
- get _element() { return index$1.getElement(this); }
708
- static get watchers() { return {
709
- "filterConfig": ["observeFilterConfig"]
710
- }; }
711
- };
712
- SnkFilterBar.style = snkFilterBarCss;
713
-
714
- exports.snk_filter_bar = SnkFilterBar;