@sankhyalabs/sankhyablocks 5.19.1 → 6.0.1

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 (298) hide show
  1. package/dist/cjs/ConfigStorage-0a738cdc.js +304 -0
  2. package/dist/cjs/IExpressionItem-1090c3fd.js +7 -0
  3. package/dist/cjs/PersonalizedFilterUtils-7d959e91.js +229 -0
  4. package/dist/cjs/{SnkFormConfigManager-69df3f74.js → SnkFormConfigManager-a583f503.js} +1 -1
  5. package/dist/cjs/{SnkMessageBuilder-3b5b5614.js → SnkMessageBuilder-8a2d3f26.js} +65 -4
  6. package/dist/cjs/{filter-bar-config-fetcher-a14536bf.js → filter-bar-config-fetcher-75219599.js} +34 -11
  7. package/dist/cjs/{index-de79181a.js → index-59a3e2de.js} +1 -1
  8. package/dist/cjs/{index-f400b1d6.js → index-614af008.js} +2 -0
  9. package/dist/cjs/{index-21bd01e1.js → index-aaaa2af5.js} +6 -1
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  12. package/dist/cjs/snk-actions-button.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
  14. package/dist/cjs/snk-application.cjs.entry.js +4 -4
  15. package/dist/cjs/snk-attach.cjs.entry.js +4 -4
  16. package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
  17. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-crud.cjs.entry.js +4 -4
  20. package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -4
  21. package/dist/cjs/{snk-data-unit-e9c20097.js → snk-data-unit-53fc9200.js} +2 -2
  22. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  23. package/dist/cjs/snk-detail-view.cjs.entry.js +10 -10
  24. package/dist/cjs/snk-entity-list.cjs.entry.js +6 -4
  25. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  26. package/dist/cjs/snk-expression-group.cjs.entry.js +246 -0
  27. package/dist/cjs/{snk-filter-field-search_2.cjs.entry.js → snk-expression-item_3.cjs.entry.js} +327 -66
  28. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-filter-bar.cjs.entry.js +162 -72
  30. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  31. package/dist/cjs/snk-filter-detail.cjs.entry.js +54 -69
  32. package/dist/cjs/snk-filter-item.cjs.entry.js +21 -7
  33. package/dist/cjs/snk-filter-list.cjs.entry.js +1 -1
  34. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +57 -29
  35. package/dist/cjs/snk-filter-modal.cjs.entry.js +67 -13
  36. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  37. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  38. package/dist/cjs/snk-filter-period.cjs.entry.js +5 -3
  39. package/dist/cjs/snk-filter-personalized.cjs.entry.js +135 -55
  40. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  41. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  42. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  43. package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
  44. package/dist/cjs/snk-form-view.cjs.entry.js +1 -1
  45. package/dist/cjs/snk-form.cjs.entry.js +4 -4
  46. package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
  47. package/dist/cjs/snk-grid.cjs.entry.js +7 -7
  48. package/dist/cjs/{snk-guides-viewer-c8843478.js → snk-guides-viewer-10ffca10.js} +5 -5
  49. package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
  50. package/dist/cjs/snk-personalized-filter.cjs.entry.js +166 -94
  51. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  52. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  53. package/dist/cjs/snk-simple-bar.cjs.entry.js +45 -0
  54. package/dist/cjs/{snk-simple-bar_2.cjs.entry.js → snk-simple-crud.cjs.entry.js} +5 -43
  55. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  56. package/dist/cjs/snk-taskbar.cjs.entry.js +4 -4
  57. package/dist/cjs/{taskbar-elements-3be287d6.js → taskbar-elements-068aa945.js} +3 -3
  58. package/dist/cjs/{taskbar-processor-02f0fc84.js → taskbar-processor-6442c585.js} +1 -1
  59. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  60. package/dist/collection/collection-manifest.json +2 -1
  61. package/dist/collection/components/snk-entity-list/snk-entity-list.js +6 -4
  62. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +34 -12
  63. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +4 -2
  64. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized/snk-filter-personalized.css +66 -0
  65. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized/snk-filter-personalized.js +370 -0
  66. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +52 -68
  67. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +20 -6
  68. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +15 -15
  69. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +111 -11
  70. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +98 -27
  71. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +21 -0
  72. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +100 -49
  73. package/dist/collection/components/snk-filter-bar/types/custom-element-filter.js +1 -0
  74. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +23 -3
  75. package/dist/collection/components/snk-filter-bar/utils/filters-mock.js +96 -0
  76. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.css +1 -1
  77. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +27 -6
  78. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +39 -2
  79. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +276 -30
  80. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.css +73 -0
  81. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +443 -0
  82. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +16 -24
  83. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +18 -4
  84. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +131 -21
  85. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionGroup.js +0 -0
  86. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.js +5 -1
  87. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IParameter.js +1 -0
  88. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IPersonalizedFilter.js +1 -0
  89. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/index.js +3 -0
  90. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +1 -1
  91. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +184 -15
  92. package/dist/collection/lib/@types/index.js +2 -0
  93. package/dist/collection/lib/configs/ConfigStorage.js +15 -0
  94. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +36 -13
  95. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +106 -4
  96. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +15 -2
  97. package/dist/collection/lib/message/resources/snk-filter-field-search.msg.js +2 -0
  98. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +48 -2
  99. package/dist/components/ConfigStorage.js +180 -1
  100. package/dist/components/PersonalizedFilterUtils.js +227 -0
  101. package/dist/components/SnkMessageBuilder.js +65 -4
  102. package/dist/components/filter-bar-config-fetcher.js +34 -11
  103. package/dist/components/index.d.ts +2 -1
  104. package/dist/components/index.js +1 -0
  105. package/dist/components/index2.js +3 -1
  106. package/dist/components/snk-crud.js +65 -35
  107. package/dist/components/snk-data-exporter2.js +1 -1
  108. package/dist/components/snk-detail-view2.js +99 -44
  109. package/dist/components/snk-entity-list.js +6 -4
  110. package/dist/components/snk-expression-group.d.ts +11 -0
  111. package/dist/components/snk-expression-group.js +6 -0
  112. package/dist/components/snk-expression-group2.js +296 -0
  113. package/dist/components/snk-expression-item2.js +133 -46
  114. package/dist/components/snk-filter-bar2.js +196 -68
  115. package/dist/components/snk-filter-detail2.js +52 -68
  116. package/dist/components/snk-filter-field-search2.js +26 -5
  117. package/dist/components/snk-filter-item2.js +20 -6
  118. package/dist/components/snk-filter-modal-item2.js +54 -27
  119. package/dist/components/snk-filter-modal.js +69 -13
  120. package/dist/components/snk-filter-param-config2.js +3 -57
  121. package/dist/components/snk-filter-period.js +4 -2
  122. package/dist/components/snk-filter-personalized.js +139 -58
  123. package/dist/components/snk-grid2.js +52 -16
  124. package/dist/components/snk-personalized-filter.js +1 -153
  125. package/dist/components/snk-personalized-filter2.js +238 -0
  126. package/dist/esm/ConfigStorage-9f4d2e67.js +300 -0
  127. package/dist/esm/IExpressionItem-2e922b2c.js +7 -0
  128. package/dist/esm/PersonalizedFilterUtils-202cd721.js +227 -0
  129. package/dist/esm/{SnkFormConfigManager-e60367a0.js → SnkFormConfigManager-def999fe.js} +1 -1
  130. package/dist/esm/{SnkMessageBuilder-188a38bb.js → SnkMessageBuilder-cc4d1599.js} +65 -4
  131. package/dist/esm/{filter-bar-config-fetcher-edc48f4b.js → filter-bar-config-fetcher-bd2070a3.js} +34 -11
  132. package/dist/esm/{index-cfd4bb13.js → index-8c3d76a6.js} +6 -1
  133. package/dist/esm/{index-507e19ec.js → index-a255b326.js} +3 -1
  134. package/dist/esm/{index-8efbf198.js → index-d60ca0ac.js} +1 -1
  135. package/dist/esm/loader.js +3 -3
  136. package/dist/esm/sankhyablocks.js +3 -3
  137. package/dist/esm/snk-actions-button.entry.js +2 -2
  138. package/dist/esm/snk-actions-form.entry.js +1 -1
  139. package/dist/esm/snk-application.entry.js +4 -4
  140. package/dist/esm/snk-attach.entry.js +4 -4
  141. package/dist/esm/snk-client-confirm.entry.js +1 -1
  142. package/dist/esm/snk-config-options.entry.js +1 -1
  143. package/dist/esm/snk-configurator.entry.js +1 -1
  144. package/dist/esm/snk-crud.entry.js +4 -4
  145. package/dist/esm/snk-data-exporter.entry.js +4 -4
  146. package/dist/esm/{snk-data-unit-79b1583a.js → snk-data-unit-97824457.js} +2 -2
  147. package/dist/esm/snk-data-unit.entry.js +3 -3
  148. package/dist/esm/snk-detail-view.entry.js +10 -10
  149. package/dist/esm/snk-entity-list.entry.js +7 -5
  150. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  151. package/dist/esm/snk-expression-group.entry.js +242 -0
  152. package/dist/esm/{snk-filter-field-search_2.entry.js → snk-expression-item_3.entry.js} +326 -66
  153. package/dist/esm/snk-field-config.entry.js +1 -1
  154. package/dist/esm/snk-filter-bar.entry.js +157 -67
  155. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  156. package/dist/esm/snk-filter-detail.entry.js +55 -70
  157. package/dist/esm/snk-filter-item.entry.js +21 -7
  158. package/dist/esm/snk-filter-list.entry.js +1 -1
  159. package/dist/esm/snk-filter-modal-item.entry.js +57 -29
  160. package/dist/esm/snk-filter-modal.entry.js +67 -13
  161. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  162. package/dist/esm/snk-filter-number.entry.js +1 -1
  163. package/dist/esm/snk-filter-period.entry.js +5 -3
  164. package/dist/esm/snk-filter-personalized.entry.js +135 -55
  165. package/dist/esm/snk-filter-search.entry.js +1 -1
  166. package/dist/esm/snk-filter-text.entry.js +1 -1
  167. package/dist/esm/snk-form-config.entry.js +1 -1
  168. package/dist/esm/snk-form-summary.entry.js +1 -1
  169. package/dist/esm/snk-form-view.entry.js +1 -1
  170. package/dist/esm/snk-form.entry.js +4 -4
  171. package/dist/esm/snk-grid-config.entry.js +3 -3
  172. package/dist/esm/snk-grid.entry.js +7 -7
  173. package/dist/esm/{snk-guides-viewer-59d3a78c.js → snk-guides-viewer-0380f3df.js} +5 -5
  174. package/dist/esm/snk-guides-viewer.entry.js +9 -9
  175. package/dist/esm/snk-personalized-filter.entry.js +166 -94
  176. package/dist/esm/snk-pesquisa.entry.js +1 -1
  177. package/dist/esm/snk-select-box.entry.js +1 -1
  178. package/dist/esm/snk-simple-bar.entry.js +41 -0
  179. package/dist/esm/{snk-simple-bar_2.entry.js → snk-simple-crud.entry.js} +7 -44
  180. package/dist/esm/snk-tab-config.entry.js +1 -1
  181. package/dist/esm/snk-taskbar.entry.js +4 -4
  182. package/dist/esm/{taskbar-elements-8ff33c26.js → taskbar-elements-26d0fba3.js} +3 -3
  183. package/dist/esm/{taskbar-processor-20de6616.js → taskbar-processor-dfef41a8.js} +1 -1
  184. package/dist/esm/teste-pesquisa.entry.js +1 -1
  185. package/dist/sankhyablocks/{p-f27dc5e9.entry.js → p-00d1cac4.entry.js} +1 -1
  186. package/dist/sankhyablocks/{p-b9667fbe.js → p-066ee142.js} +2 -2
  187. package/dist/sankhyablocks/p-09a058ba.entry.js +1 -0
  188. package/dist/sankhyablocks/{p-82bc4666.entry.js → p-0dec4d29.entry.js} +1 -1
  189. package/dist/sankhyablocks/{p-1e6a95f5.entry.js → p-12632b8e.entry.js} +1 -1
  190. package/dist/sankhyablocks/{p-384c4a6b.js → p-18b34bb4.js} +1 -1
  191. package/dist/sankhyablocks/{p-538c057a.entry.js → p-2ad89e28.entry.js} +1 -1
  192. package/dist/sankhyablocks/p-2d5108b3.js +1 -0
  193. package/dist/sankhyablocks/{p-ff398057.entry.js → p-34cd4b39.entry.js} +1 -1
  194. package/dist/sankhyablocks/p-36ecb6ab.js +1 -0
  195. package/dist/sankhyablocks/p-372e0185.entry.js +1 -0
  196. package/dist/sankhyablocks/p-3be34bd1.entry.js +1 -0
  197. package/dist/sankhyablocks/p-3d45107f.js +1 -0
  198. package/dist/sankhyablocks/{p-28c12f65.js → p-463e0936.js} +1 -1
  199. package/dist/sankhyablocks/{p-e701646c.entry.js → p-49d628d1.entry.js} +1 -1
  200. package/dist/sankhyablocks/{p-e642bf7a.entry.js → p-50db4bc4.entry.js} +1 -1
  201. package/dist/sankhyablocks/{p-093febff.entry.js → p-5427566a.entry.js} +1 -1
  202. package/dist/sankhyablocks/{p-6a02e236.js → p-590d8900.js} +1 -1
  203. package/dist/sankhyablocks/p-5a6c090e.entry.js +1 -0
  204. package/dist/sankhyablocks/{p-e2bb9c9a.entry.js → p-67a19b48.entry.js} +1 -1
  205. package/dist/sankhyablocks/{p-19692f92.js → p-69770075.js} +1 -1
  206. package/dist/sankhyablocks/p-6d4169fc.entry.js +1 -0
  207. package/dist/sankhyablocks/{p-0b40c655.js → p-708ee8ee.js} +1 -1
  208. package/dist/sankhyablocks/{p-9af04fc7.entry.js → p-718cc24b.entry.js} +1 -1
  209. package/dist/sankhyablocks/{p-2d0fc912.entry.js → p-7946512f.entry.js} +1 -1
  210. package/dist/sankhyablocks/{p-900b2889.entry.js → p-7a5e1be7.entry.js} +1 -1
  211. package/dist/sankhyablocks/p-801b8858.js +68 -0
  212. package/dist/sankhyablocks/{p-80e52e85.entry.js → p-847b9506.entry.js} +1 -1
  213. package/dist/sankhyablocks/{p-56d70073.entry.js → p-8d541539.entry.js} +1 -1
  214. package/dist/sankhyablocks/{p-584a315a.entry.js → p-8e98a893.entry.js} +1 -1
  215. package/dist/sankhyablocks/p-9731180c.entry.js +1 -0
  216. package/dist/sankhyablocks/{p-b680fa7a.entry.js → p-a655ea15.entry.js} +1 -1
  217. package/dist/sankhyablocks/{p-eae124e3.entry.js → p-a8b06801.entry.js} +1 -1
  218. package/dist/sankhyablocks/{p-b25450ab.js → p-a8e5ded0.js} +1 -1
  219. package/dist/sankhyablocks/{p-6ac29569.entry.js → p-b66b99d9.entry.js} +1 -1
  220. package/dist/sankhyablocks/p-b7efc49a.entry.js +1 -0
  221. package/dist/sankhyablocks/{p-9c7f7214.entry.js → p-b91ee370.entry.js} +1 -1
  222. package/dist/sankhyablocks/{p-e551b19a.entry.js → p-b940798f.entry.js} +1 -1
  223. package/dist/sankhyablocks/{p-72e78de0.entry.js → p-bbefb3b2.entry.js} +1 -1
  224. package/dist/sankhyablocks/p-bdd61fa8.entry.js +1 -0
  225. package/dist/sankhyablocks/{p-f8c66aa3.entry.js → p-c06973e7.entry.js} +1 -1
  226. package/dist/sankhyablocks/{p-257c71a7.entry.js → p-c17e19a2.entry.js} +1 -1
  227. package/dist/sankhyablocks/p-c6bf66e0.js +1 -0
  228. package/dist/sankhyablocks/p-cdfddb41.entry.js +1 -0
  229. package/dist/sankhyablocks/p-cf90a195.entry.js +1 -0
  230. package/dist/sankhyablocks/{p-44c2ed16.entry.js → p-d11c5026.entry.js} +1 -1
  231. package/dist/sankhyablocks/p-d5145c3f.entry.js +1 -0
  232. package/dist/sankhyablocks/p-de328b00.entry.js +1 -0
  233. package/dist/sankhyablocks/{p-971abcc2.entry.js → p-e500863b.entry.js} +1 -1
  234. package/dist/sankhyablocks/{p-22e44b9d.entry.js → p-e824aef2.entry.js} +1 -1
  235. package/dist/sankhyablocks/{p-4ce96831.entry.js → p-eb24c092.entry.js} +1 -1
  236. package/dist/sankhyablocks/{p-4c2015a9.js → p-eb90de43.js} +1 -1
  237. package/dist/sankhyablocks/p-ebb8de34.entry.js +1 -0
  238. package/dist/sankhyablocks/p-f55450d5.entry.js +1 -0
  239. package/dist/sankhyablocks/{p-8652d177.entry.js → p-fc512cbe.entry.js} +1 -1
  240. package/dist/sankhyablocks/{p-786ae316.entry.js → p-fced1d89.entry.js} +1 -1
  241. package/dist/sankhyablocks/{p-e0b4aec3.entry.js → p-fdb43927.entry.js} +1 -1
  242. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  243. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized/snk-filter-personalized.d.ts +85 -0
  244. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +6 -6
  245. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
  246. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +18 -1
  247. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +14 -6
  248. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +10 -3
  249. package/dist/types/components/snk-filter-bar/types/custom-element-filter.d.ts +6 -0
  250. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +10 -1
  251. package/dist/types/components/snk-filter-bar/utils/filters-mock.d.ts +92 -15
  252. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +5 -11
  253. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +3 -0
  254. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +39 -6
  255. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +82 -0
  256. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +1 -1
  257. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +13 -1
  258. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionGroup.d.ts +0 -0
  259. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +23 -3
  260. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IParameter.d.ts +21 -0
  261. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IPersonalizedFilter.d.ts +11 -0
  262. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/index.d.ts +3 -0
  263. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +14 -2
  264. package/dist/types/components.d.ts +169 -10
  265. package/dist/types/lib/@types/index.d.ts +3 -1
  266. package/dist/types/lib/configs/ConfigStorage.d.ts +5 -0
  267. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +4 -2
  268. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +5 -0
  269. package/dist/types/lib/store/index.d.ts +1 -2
  270. package/package.json +5 -5
  271. package/react/components.d.ts +1 -0
  272. package/react/components.js +1 -0
  273. package/react/components.js.map +1 -1
  274. package/dist/cjs/ConfigStorage-f68c3607.js +0 -124
  275. package/dist/cjs/index-8d94b7e0.js +0 -7
  276. package/dist/cjs/snk-expression-item.cjs.entry.js +0 -213
  277. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +0 -214
  278. package/dist/esm/ConfigStorage-e6c17998.js +0 -121
  279. package/dist/esm/index-620ac460.js +0 -7
  280. package/dist/esm/snk-expression-item.entry.js +0 -209
  281. package/dist/sankhyablocks/p-0b6ddb67.entry.js +0 -1
  282. package/dist/sankhyablocks/p-0c2afa63.entry.js +0 -1
  283. package/dist/sankhyablocks/p-343699ad.entry.js +0 -1
  284. package/dist/sankhyablocks/p-471568c7.entry.js +0 -1
  285. package/dist/sankhyablocks/p-6c2c71ca.js +0 -1
  286. package/dist/sankhyablocks/p-8ce9ea9f.entry.js +0 -1
  287. package/dist/sankhyablocks/p-8efb0f47.entry.js +0 -1
  288. package/dist/sankhyablocks/p-9a448ff9.entry.js +0 -1
  289. package/dist/sankhyablocks/p-9e50681c.entry.js +0 -1
  290. package/dist/sankhyablocks/p-9f66bc54.entry.js +0 -1
  291. package/dist/sankhyablocks/p-b1c02726.js +0 -1
  292. package/dist/sankhyablocks/p-b34d23fa.js +0 -1
  293. package/dist/sankhyablocks/p-c20dd153.entry.js +0 -1
  294. package/dist/sankhyablocks/p-cbb5c440.entry.js +0 -1
  295. package/dist/sankhyablocks/p-f3241ada.entry.js +0 -1
  296. package/dist/sankhyablocks/p-f4184ce7.js +0 -1
  297. package/dist/sankhyablocks/p-ff96b509.entry.js +0 -27
  298. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +0 -40
@@ -4,9 +4,17 @@ import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/
4
4
  import { C as ConfigStorage } from './ConfigStorage.js';
5
5
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
6
  import { F as FilterItemType } from './filter-item-type.enum.js';
7
+ import { F as FilterOperand } from './index2.js';
7
8
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
8
- import { d as defineCustomElement$2 } from './snk-filter-detail2.js';
9
- import { d as defineCustomElement$1 } from './snk-filter-item2.js';
9
+ import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
10
+ import { d as defineCustomElement$8 } from './snk-expression-group2.js';
11
+ import { d as defineCustomElement$7 } from './snk-expression-item2.js';
12
+ import { d as defineCustomElement$6 } from './snk-filter-detail2.js';
13
+ import { d as defineCustomElement$5 } from './snk-filter-field-search2.js';
14
+ import { d as defineCustomElement$4 } from './snk-filter-item2.js';
15
+ import { d as defineCustomElement$3 } from './snk-filter-param-config2.js';
16
+ import { d as defineCustomElement$2 } from './snk-personalized-filter2.js';
17
+ import { d as defineCustomElement$1 } from './snk-simple-bar2.js';
10
18
 
11
19
  const buildFilter = (item) => {
12
20
  switch (item.type) {
@@ -14,8 +22,8 @@ const buildFilter = (item) => {
14
22
  return buildDefault(item);
15
23
  case FilterItemType.BINARY_SELECT:
16
24
  return buildBinary(item);
17
- case FilterItemType.MULTI_SELECT:
18
- return buildMultSelect(item);
25
+ case FilterItemType.MULTI_LIST:
26
+ return buildMultiList(item);
19
27
  case FilterItemType.PERIOD:
20
28
  return buildPeriod(item);
21
29
  case FilterItemType.SEARCH:
@@ -39,9 +47,25 @@ function buildBinary(item) {
39
47
  const selectedOption = options.find(opt => opt.name === value);
40
48
  return { name: id, expression: selectedOption.expression, params: [] };
41
49
  }
42
- function buildMultSelect(item) {
50
+ function buildMultiList(item) {
43
51
  const { id, value, props } = item;
44
- return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
52
+ const parsedValues = parseMultiListValues(value);
53
+ if (parsedValues.length > 0) {
54
+ return {
55
+ name: id,
56
+ expression: props.expression,
57
+ params: [{
58
+ name: id,
59
+ dataType: DataType.TEXT,
60
+ value: JSON.stringify(parsedValues)
61
+ }]
62
+ };
63
+ }
64
+ }
65
+ function parseMultiListValues(multiListValue) {
66
+ var _a, _b;
67
+ 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;
68
+ return value.filter(item => item === null || item === void 0 ? void 0 : item.check).map(({ id }) => Number.isNaN(+id) ? String(id) : Number(id));
45
69
  }
46
70
  function buildPeriod(item) {
47
71
  const { id, value, props } = item;
@@ -86,12 +110,13 @@ function buildNumber(item) {
86
110
  return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
87
111
  }
88
112
  function buildPersonalized(item) {
89
- var _a;
90
- const { id, value, props } = item;
91
- const expression = props.expression;
92
- return {
93
- name: id, expression, params: (((_a = props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
94
- const valuesArray = Array.from(value);
113
+ const { id, groupedItems = [] } = item;
114
+ const activeFilters = groupedItems.filter(groupItem => !!groupItem.visible);
115
+ const filters = activeFilters.map(item => {
116
+ var _a;
117
+ const expression = item.props.expression;
118
+ const params = (((_a = item.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
119
+ const valuesArray = Array.from(item.value || 0);
95
120
  const dataType = param.dataType;
96
121
  let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
97
122
  if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
@@ -101,30 +126,50 @@ function buildPersonalized(item) {
101
126
  paramValue = false;
102
127
  }
103
128
  return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : toString(dataType, paramValue) };
104
- })
105
- };
129
+ });
130
+ return { expression, name: item.id, params };
131
+ });
132
+ const expression = filters.map(filter => `(${filter.expression})`).join(` ${FilterOperand.AND} `);
133
+ const params = filters.flatMap(filter => filter.params);
134
+ return { name: id, expression, params };
106
135
  }
107
136
 
108
137
  class SnkFilterModalFactory {
109
- constructor({ filterConfig, onComplete, getMessage }) {
138
+ constructor({ filterConfig, configName, onComplete, getMessage, onAddPersonalizedFilter, onEditPersonalizedFilter }) {
110
139
  this._filterConfig = filterConfig;
140
+ this._configName = configName;
111
141
  this._onComplete = onComplete;
112
142
  this._getMessage = getMessage;
143
+ this._addPersonalizedFilterFn = onAddPersonalizedFilter;
144
+ this._editPersonalizedFilterFn = onEditPersonalizedFilter;
113
145
  }
114
146
  applyFilters(newFilterConfig) {
115
147
  this._onComplete(newFilterConfig);
116
148
  this._closeModal();
117
149
  }
118
150
  clearAll(filterConfigSnapshot) {
119
- return filterConfigSnapshot.map(filterItem => (Object.assign(Object.assign({}, filterItem), { value: undefined })));
151
+ return filterConfigSnapshot.map(filterItem => {
152
+ const copy = Object.assign({}, filterItem);
153
+ delete copy.value;
154
+ if (filterItem.type === FilterItemType.PERSONALIZED) {
155
+ copy.visible = false;
156
+ }
157
+ if (copy.groupedItems) {
158
+ copy.groupedItems = this.clearAll(copy.groupedItems);
159
+ }
160
+ return copy;
161
+ });
120
162
  }
121
163
  buildFilterModal() {
122
164
  const filterModal = document.createElement("snk-filter-modal");
165
+ filterModal.className = "ez-size-height--full";
123
166
  filterModal.filters = this._filterConfig;
167
+ filterModal.configName = this._configName;
124
168
  filterModal.getMessage = this._getMessage.bind(this);
125
169
  filterModal.applyFilters = this.applyFilters.bind(this);
126
- filterModal.clearAll = this.clearAll.bind(this);
127
170
  filterModal.closeModal = () => this._closeModal();
171
+ filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
172
+ filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
128
173
  return filterModal;
129
174
  }
130
175
  async showModal() {
@@ -138,9 +183,12 @@ class SnkFilterModalFactory {
138
183
  };
139
184
  this._closeModal = await ApplicationUtils.showModal(modalProps);
140
185
  }
186
+ async closeModal() {
187
+ this._closeModal();
188
+ }
141
189
  }
142
190
 
143
- const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--most-visible, 3);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-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%}";
191
+ const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--more-visible, 2);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.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;z-index:var(--most-visible, 3);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-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%}";
144
192
 
145
193
  const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
146
194
  constructor() {
@@ -149,7 +197,8 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
149
197
  this._updateSequence = [];
150
198
  this._loadingPending = false;
151
199
  this._configUpdated = false;
152
- this._pendingFilters = [];
200
+ this._pendingVariables = false;
201
+ this._customfiltersToBeUpdated = [];
153
202
  this._calculateSortIndex = (item) => {
154
203
  let index = item.hardFixed ? 1000000 : 0;
155
204
  //campos Hard Fixed não variam a ordem
@@ -169,6 +218,8 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
169
218
  this.messagesBuilder = undefined;
170
219
  this.allowDefault = undefined;
171
220
  this.scrollerLocked = false;
221
+ this.showPersonalizedFilter = false;
222
+ this.personalizedFilterId = undefined;
172
223
  }
173
224
  observeFilterConfig(newValue, oldValue) {
174
225
  if (oldValue != undefined && newValue == undefined) {
@@ -177,17 +228,28 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
177
228
  }
178
229
  else {
179
230
  const oldItems = new Map(oldValue ? oldValue.map(item => [item.id, item]) : undefined);
180
- newValue.forEach(newItem => {
181
- const oldItem = oldItems.get(newItem.id);
182
- if (oldItem != undefined) {
183
- this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
184
- this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
185
- }
186
- else {
187
- this._configUpdated = true;
188
- this._loadingPending = this._loadingPending || newItem.value != undefined;
189
- }
190
- });
231
+ if (oldItems.size === 0 && newValue.length > 0) {
232
+ this._loadingPending = true;
233
+ this._configUpdated = false;
234
+ }
235
+ else {
236
+ newValue.forEach(newItem => {
237
+ const oldItem = oldItems.get(newItem.id);
238
+ if (oldItem != undefined) {
239
+ this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
240
+ this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
241
+ if (!this._loadingPending) {
242
+ const groupedChanged = ObjectUtils.objectToString(oldItem.groupedItems) != ObjectUtils.objectToString(newItem.groupedItems);
243
+ this._configUpdated = this._configUpdated || groupedChanged;
244
+ this._loadingPending = this._loadingPending || groupedChanged;
245
+ }
246
+ }
247
+ else {
248
+ this._configUpdated = true;
249
+ this._loadingPending = this._loadingPending || newItem.value != undefined;
250
+ }
251
+ });
252
+ }
191
253
  }
192
254
  this.processAfterUpdateConfig();
193
255
  }
@@ -204,30 +266,31 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
204
266
  }
205
267
  }
206
268
  processPendingFilter() {
207
- if (this._pendingFilters.length > 0 && this._currentPendingFilter == undefined) {
208
- this._currentPendingFilter = this._element.querySelector("#filter-" + this._pendingFilters.pop());
209
- if (this._currentPendingFilter) {
210
- this._currentPendingFilter.showUp(true).then(() => {
211
- this._currentPendingFilter = undefined;
212
- this.processPendingFilter();
269
+ if (this._pendingVariables) {
270
+ const popUp = this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");
271
+ if (popUp) {
272
+ popUp.showUp(true).then(() => {
273
+ this.processAfterUpdateConfig();
213
274
  });
214
275
  }
215
276
  }
216
- if (this._currentPendingFilter == undefined) {
277
+ else {
217
278
  this.processAfterUpdateConfig();
218
279
  }
219
280
  }
220
- processAfterUpdateConfig() {
221
- if (this._pendingFilters.length > 0) {
222
- return;
223
- }
281
+ async processAfterUpdateConfig() {
224
282
  if (this._loadingPending) {
225
- this._loadingPending = false;
226
- this._inProgressLoadFromConfig = new Promise((resolve) => {
227
- this.dataUnit.loadData().then(() => {
228
- resolve();
229
- });
283
+ const personalizedFilter = this.filterConfig.find(item => {
284
+ if (item.type === FilterItemType.PERSONALIZED) {
285
+ return true;
286
+ }
230
287
  });
288
+ this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
289
+ if (this._pendingVariables) {
290
+ return;
291
+ }
292
+ this._loadingPending = false;
293
+ this.dataUnit.loadData();
231
294
  }
232
295
  if (this._configUpdated) {
233
296
  this._configUpdated = false;
@@ -256,7 +319,14 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
256
319
  return filters;
257
320
  }
258
321
  isActiveFilter(item) {
259
- return (item.visible && item.value != undefined) || item.type === FilterItemType.DEFAULT_FILTER;
322
+ /*
323
+ - O filtro padrão também deve sempre ser condiderado ativo, pois, sempre deve
324
+ ser aplicado.
325
+ */
326
+ if (item.type === FilterItemType.DEFAULT_FILTER) {
327
+ return true;
328
+ }
329
+ return item.visible && (item.groupedItems || item.value != undefined);
260
330
  }
261
331
  registryFilterProvider() {
262
332
  this.dataUnit.addFilterProvider(this);
@@ -276,12 +346,16 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
276
346
  }
277
347
  });
278
348
  }
349
+ filterActiveFilter(item) {
350
+ return item.visible || item.removalBlocked;
351
+ }
279
352
  getFilterItems() {
280
353
  const pinnedItems = [];
281
354
  const unpinnedItems = [];
282
355
  this.filterConfig
283
- .filter(item => item.visible)
356
+ .filter(this.filterActiveFilter)
284
357
  .forEach((item, index) => {
358
+ item = ObjectUtils.copy(item);
285
359
  const itemId = `filter-${item.id}`;
286
360
  const filterItem = (h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.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 }));
287
361
  if (item.fixed || item.hardFixed) {
@@ -335,19 +409,16 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
335
409
  this._application.isUserSup().then(value => this.allowDefault = value);
336
410
  }
337
411
  loadConfigFromStorage() {
338
- ConfigStorage.get().then(instance => {
339
- instance.loadFilterBarConfig(this.configName)
340
- .then((filters) => {
341
- var _a;
342
- this.filterConfig = filters.map(item => this.normalizeItem(item));
343
- if (this._inProgressLoadFromConfig) {
344
- return;
345
- }
346
- (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true);
347
- this._inProgressLoadFromConfig = undefined;
348
- })
349
- .catch(reason => {
350
- throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
412
+ return new Promise(accept => {
413
+ ConfigStorage.get().then(instance => {
414
+ instance.loadFilterBarConfig(this.configName)
415
+ .then((filters) => {
416
+ accept();
417
+ this.filterConfig = filters.map(item => this.normalizeItem(item));
418
+ })
419
+ .catch(reason => {
420
+ throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
421
+ });
351
422
  });
352
423
  });
353
424
  }
@@ -387,12 +458,34 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
387
458
  this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
388
459
  };
389
460
  const factoryParams = {
390
- filterConfig: this.filterConfig,
461
+ filterConfig: ObjectUtils.copy(this.filterConfig),
462
+ configName: this.configName,
391
463
  onComplete: callbackOnApplyFilter,
392
- getMessage: (key, props) => this.getMessage(key, props)
464
+ getMessage: (key, props) => this.getMessage(key, props),
465
+ onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
466
+ onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id)
393
467
  };
394
- const factory = new SnkFilterModalFactory(factoryParams);
395
- await factory.showModal();
468
+ this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
469
+ await this._filterModalFactory.showModal();
470
+ }
471
+ addPersonalizedFilter() {
472
+ this._filterModalFactory.closeModal();
473
+ this.personalizedFilterId = undefined;
474
+ this.showPersonalizedFilter = true;
475
+ window.requestAnimationFrame(() => {
476
+ this._elPersonalizedFilter.createPersonalizedFilter();
477
+ });
478
+ }
479
+ editPersonalizedFilter(id) {
480
+ this._filterModalFactory.closeModal();
481
+ this.showPersonalizedFilter = true;
482
+ this.personalizedFilterId = id;
483
+ }
484
+ hidePersonalizedFilter() {
485
+ this.loadConfigFromStorage().then(() => {
486
+ this.personalizedFilterId = undefined;
487
+ this.showPersonalizedFilter = false;
488
+ });
396
489
  }
397
490
  componentWillLoad() {
398
491
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -409,7 +502,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
409
502
  if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
410
503
  return undefined;
411
504
  }
412
- return (h(Host, null, h("ez-scroller", { direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, this.getFilterItems()), h("ez-button", { class: "ez-padding-left--medium", 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" }))));
505
+ if (this.showPersonalizedFilter) {
506
+ return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName });
507
+ }
508
+ return h(Host, null, h("ez-scroller", { direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, this.getFilterItems()), h("ez-button", { class: "ez-padding-left--medium", 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" })));
413
509
  }
414
510
  get _element() { return this; }
415
511
  static get watchers() { return {
@@ -423,25 +519,57 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
423
519
  "messagesBuilder": [1040],
424
520
  "allowDefault": [32],
425
521
  "scrollerLocked": [32],
522
+ "showPersonalizedFilter": [32],
523
+ "personalizedFilterId": [32],
426
524
  "reload": [64]
427
525
  }, [[0, "filterChange", "filterChangeListener"]]]);
428
526
  function defineCustomElement() {
429
527
  if (typeof customElements === "undefined") {
430
528
  return;
431
529
  }
432
- const components = ["snk-filter-bar", "snk-filter-detail", "snk-filter-item"];
530
+ const components = ["snk-filter-bar", "snk-expression-group", "snk-expression-item", "snk-filter-detail", "snk-filter-field-search", "snk-filter-item", "snk-filter-param-config", "snk-personalized-filter", "snk-simple-bar"];
433
531
  components.forEach(tagName => { switch (tagName) {
434
532
  case "snk-filter-bar":
435
533
  if (!customElements.get(tagName)) {
436
534
  customElements.define(tagName, SnkFilterBar);
437
535
  }
438
536
  break;
537
+ case "snk-expression-group":
538
+ if (!customElements.get(tagName)) {
539
+ defineCustomElement$8();
540
+ }
541
+ break;
542
+ case "snk-expression-item":
543
+ if (!customElements.get(tagName)) {
544
+ defineCustomElement$7();
545
+ }
546
+ break;
439
547
  case "snk-filter-detail":
440
548
  if (!customElements.get(tagName)) {
441
- defineCustomElement$2();
549
+ defineCustomElement$6();
550
+ }
551
+ break;
552
+ case "snk-filter-field-search":
553
+ if (!customElements.get(tagName)) {
554
+ defineCustomElement$5();
442
555
  }
443
556
  break;
444
557
  case "snk-filter-item":
558
+ if (!customElements.get(tagName)) {
559
+ defineCustomElement$4();
560
+ }
561
+ break;
562
+ case "snk-filter-param-config":
563
+ if (!customElements.get(tagName)) {
564
+ defineCustomElement$3();
565
+ }
566
+ break;
567
+ case "snk-personalized-filter":
568
+ if (!customElements.get(tagName)) {
569
+ defineCustomElement$2();
570
+ }
571
+ break;
572
+ case "snk-simple-bar":
445
573
  if (!customElements.get(tagName)) {
446
574
  defineCustomElement$1();
447
575
  }
@@ -1,8 +1,10 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
2
2
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
3
  import { F as FilterItemType } from './filter-item-type.enum.js';
4
- import { ApplicationContext, ElementIDUtils, DataType } from '@sankhyalabs/core';
4
+ import { ApplicationContext, ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
5
5
  import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
6
+ import { E as EPresentationMode } from './presentationMode.js';
7
+ import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
6
8
 
7
9
  const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
10
  constructor() {
@@ -19,8 +21,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
19
21
  var _a, _b;
20
22
  (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["show"]) === null || _b === void 0 ? void 0 : _b.call(_a);
21
23
  }
22
- observeConfig() {
24
+ observeConfig(newValue) {
23
25
  var _a, _b;
26
+ this._editor && (this._editor["config"] = newValue);
24
27
  (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["reloadList"]) === null || _b === void 0 ? void 0 : _b.call(_a);
25
28
  }
26
29
  componentDidLoad() {
@@ -37,24 +40,37 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
37
40
  getContentEditor() {
38
41
  switch (this.config.type) {
39
42
  case FilterItemType.BINARY_SELECT:
40
- return "snk-filter-binary-select";
43
+ return { tag: "snk-filter-binary-select" };
41
44
  case FilterItemType.MULTI_SELECT:
42
- return "snk-filter-multi-select";
45
+ return { tag: "snk-filter-multi-select" };
43
46
  case FilterItemType.PERIOD:
44
- return "snk-filter-period";
47
+ return { tag: "snk-filter-period" };
45
48
  case FilterItemType.SEARCH:
46
- return "snk-filter-search";
49
+ return { tag: "snk-filter-search" };
47
50
  case FilterItemType.NUMBER:
48
- return "snk-filter-number";
51
+ return { tag: "snk-filter-number" };
49
52
  case FilterItemType.PERSONALIZED:
50
- return "snk-filter-personalized";
53
+ const snkFilterPersonalizedProps = {
54
+ tag: "snk-filter-personalized", props: {
55
+ presentationMode: EPresentationMode.CHIP,
56
+ onValueChanged: ({ detail }) => {
57
+ const groupedItems = (detail === null || detail === void 0 ? void 0 : detail.items) || this.config.groupedItems;
58
+ this.config = Object.assign(Object.assign({}, this.config), { groupedItems, visible: (groupedItems || []).filter(item => item.visible).length > 0 });
59
+ }
60
+ }
61
+ };
62
+ return snkFilterPersonalizedProps;
51
63
  case FilterItemType.MULTI_LIST:
52
- return "snk-entity-list";
64
+ return { tag: "snk-entity-list" };
53
65
  }
54
- return "snk-filter-text";
66
+ return { tag: "snk-filter-text" };
55
67
  }
56
68
  removeItem() {
57
- this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
69
+ const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined });
70
+ if (removedConfig.groupedItems != undefined) {
71
+ removedConfig.groupedItems = removedConfig.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined })));
72
+ }
73
+ this.changeConfig(removedConfig);
58
74
  }
59
75
  getPopUpHeaderButtons() {
60
76
  return (h(Fragment, null, !this.config.removalBlocked && this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), !this.config.hardFixed && this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
@@ -69,69 +85,34 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
69
85
  buttonElement.removeAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
70
86
  ElementIDUtils.addIDInfoIfNotExists(buttonElement, "button", dataElement);
71
87
  }
72
- getNormalizedValue(params, value) {
73
- return params.reduce((arrayValues, currentParam, index) => {
74
- if (currentParam.dataType === DataType.BOOLEAN && (arrayValues == undefined || arrayValues[index] == undefined)) {
75
- arrayValues = arrayValues || [];
76
- arrayValues[index] = false;
77
- }
78
- return arrayValues;
79
- }, value);
80
- }
81
88
  apply() {
82
- var _a;
83
- let value = this._editor["value"];
84
- let isValid = true;
85
- if (this.config.type === FilterItemType.PERSONALIZED) {
86
- const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
87
- value = this.getNormalizedValue(params, value);
88
- const paramsCount = params.length;
89
- if (paramsCount === 0) {
90
- //Valor do filtro personalizado sem parametros deve ser um array vazio
91
- value = [];
92
- }
93
- else {
94
- isValid = this.validateAllFilled(paramsCount, value);
95
- }
96
- }
97
- if (isValid) {
98
- this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
89
+ const isValid = PersonalizedFilterUtils.validateVariableValues(this.config, this._editor["value"]);
90
+ if (!isValid) {
91
+ return ApplicationUtils.alert(this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.title'), this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.message'));
99
92
  }
93
+ const valuesArray = this._editor["value"] || this.config.value;
94
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: this.isVisible(), value: valuesArray }));
100
95
  }
101
- /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
102
- validateAllFilled(paramsCount, value) {
103
- let isValid = true;
104
- if (value != undefined && paramsCount > 1) {
105
- if (paramsCount > value.length) {
106
- isValid = false;
107
- }
108
- else {
109
- value.forEach(item => {
110
- if (item == undefined) {
111
- isValid = false;
112
- }
113
- });
114
- }
96
+ isVisible() {
97
+ if (this.config.groupedItems && this.config.groupedItems.length > 0) {
98
+ return this.config.groupedItems.filter(item => item.visible).length > 0;
115
99
  }
116
- if (!isValid) {
117
- ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
118
- }
119
- return isValid;
100
+ return true;
120
101
  }
121
- /* WARNING: Temporário.*/
122
102
  clear() {
123
- var _a, _b;
103
+ var _a;
124
104
  if (FilterItemType.MULTI_LIST === this.config.type) {
125
- (_a = this.config.value) === null || _a === void 0 ? void 0 : _a.forEach(value => {
126
- if (!!value)
127
- value.check = false;
128
- });
129
- (_b = this._editor) === null || _b === void 0 ? void 0 : _b['reloadList']();
105
+ const configCopy = ObjectUtils.copy(this.config);
106
+ (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.forEach(value => !!value && (value.check = false));
107
+ this.config = ObjectUtils.copy(configCopy);
130
108
  }
131
109
  else {
132
110
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
133
111
  }
134
112
  }
113
+ filterCanBeCleared() {
114
+ return this.config.type !== FilterItemType.PERSONALIZED;
115
+ }
135
116
  onKeyDonwListener(event) {
136
117
  if (event.key === "Enter") {
137
118
  this._applyButton.setFocus().then(() => this.apply());
@@ -141,10 +122,13 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
141
122
  return h("ez-icon", { iconName: "delete", onClick: () => this.removeValueFromConfig(item) });
142
123
  }
143
124
  removeValueFromConfig(item) {
144
- var _a, _b, _c, _d, _e, _f;
145
- const index = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.findIndex(i => (i === null || i === void 0 ? void 0 : i.id) === item.id);
146
- (_d = (_c = this.config) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.splice(index, 1);
147
- (_f = (_e = this._editor) === null || _e === void 0 ? void 0 : _e["reloadList"]) === null || _f === void 0 ? void 0 : _f.call(_e);
125
+ var _a, _b;
126
+ if (this.config) {
127
+ const configCopy = ObjectUtils.copy(this.config);
128
+ const index = (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.findIndex(i => (i === null || i === void 0 ? void 0 : i.id) === item.id);
129
+ (_b = configCopy.value) === null || _b === void 0 ? void 0 : _b.splice(index, 1);
130
+ this.config = ObjectUtils.copy(configCopy);
131
+ }
148
132
  }
149
133
  saveConfig(newConfig) {
150
134
  var _a;
@@ -155,8 +139,8 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
155
139
  });
156
140
  }
157
141
  render() {
158
- const ContentEditor = this.getContentEditor();
159
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, onSaveConfig: evt => this.saveConfig(evt.detail), rightListSlotBuilder: item => this.buildRightSlot(item) }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
142
+ const { tag: CustomElement, props } = this.getContentEditor();
143
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, onSaveConfig: evt => this.saveConfig(evt.detail), rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
160
144
  }
161
145
  get _element() { return this; }
162
146
  static get watchers() { return {