@sankhyalabs/sankhyablocks 5.19.1 → 6.0.0

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 +161 -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 +66 -12
  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 +1 -0
  69. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +110 -10
  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 +22 -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 +195 -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 +68 -12
  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 +156 -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 +66 -12
  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-639be4aa.entry.js +1 -0
  205. package/dist/sankhyablocks/{p-e2bb9c9a.entry.js → p-67a19b48.entry.js} +1 -1
  206. package/dist/sankhyablocks/{p-19692f92.js → p-69770075.js} +1 -1
  207. package/dist/sankhyablocks/p-6d4169fc.entry.js +1 -0
  208. package/dist/sankhyablocks/{p-0b40c655.js → p-708ee8ee.js} +1 -1
  209. package/dist/sankhyablocks/{p-9af04fc7.entry.js → p-718cc24b.entry.js} +1 -1
  210. package/dist/sankhyablocks/{p-2d0fc912.entry.js → p-7946512f.entry.js} +1 -1
  211. package/dist/sankhyablocks/{p-900b2889.entry.js → p-7a5e1be7.entry.js} +1 -1
  212. package/dist/sankhyablocks/p-801b8858.js +68 -0
  213. package/dist/sankhyablocks/{p-80e52e85.entry.js → p-847b9506.entry.js} +1 -1
  214. package/dist/sankhyablocks/{p-56d70073.entry.js → p-8d541539.entry.js} +1 -1
  215. package/dist/sankhyablocks/{p-584a315a.entry.js → p-8e98a893.entry.js} +1 -1
  216. package/dist/sankhyablocks/p-9731180c.entry.js +1 -0
  217. package/dist/sankhyablocks/p-a6055eb9.entry.js +1 -0
  218. package/dist/sankhyablocks/{p-b680fa7a.entry.js → p-a655ea15.entry.js} +1 -1
  219. package/dist/sankhyablocks/{p-eae124e3.entry.js → p-a8b06801.entry.js} +1 -1
  220. package/dist/sankhyablocks/{p-b25450ab.js → p-a8e5ded0.js} +1 -1
  221. package/dist/sankhyablocks/{p-6ac29569.entry.js → p-b66b99d9.entry.js} +1 -1
  222. package/dist/sankhyablocks/p-b7efc49a.entry.js +1 -0
  223. package/dist/sankhyablocks/{p-9c7f7214.entry.js → p-b91ee370.entry.js} +1 -1
  224. package/dist/sankhyablocks/{p-e551b19a.entry.js → p-b940798f.entry.js} +1 -1
  225. package/dist/sankhyablocks/{p-72e78de0.entry.js → p-bbefb3b2.entry.js} +1 -1
  226. package/dist/sankhyablocks/p-bdd61fa8.entry.js +1 -0
  227. package/dist/sankhyablocks/{p-f8c66aa3.entry.js → p-c06973e7.entry.js} +1 -1
  228. package/dist/sankhyablocks/{p-257c71a7.entry.js → p-c17e19a2.entry.js} +1 -1
  229. package/dist/sankhyablocks/p-c6bf66e0.js +1 -0
  230. package/dist/sankhyablocks/p-cf90a195.entry.js +1 -0
  231. package/dist/sankhyablocks/{p-44c2ed16.entry.js → p-d11c5026.entry.js} +1 -1
  232. package/dist/sankhyablocks/p-d5145c3f.entry.js +1 -0
  233. package/dist/sankhyablocks/p-de328b00.entry.js +1 -0
  234. package/dist/sankhyablocks/{p-971abcc2.entry.js → p-e500863b.entry.js} +1 -1
  235. package/dist/sankhyablocks/{p-22e44b9d.entry.js → p-e824aef2.entry.js} +1 -1
  236. package/dist/sankhyablocks/{p-4ce96831.entry.js → p-eb24c092.entry.js} +1 -1
  237. package/dist/sankhyablocks/{p-4c2015a9.js → p-eb90de43.js} +1 -1
  238. package/dist/sankhyablocks/p-ebb8de34.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,49 @@ 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");
123
165
  filterModal.filters = this._filterConfig;
166
+ filterModal.configName = this._configName;
124
167
  filterModal.getMessage = this._getMessage.bind(this);
125
168
  filterModal.applyFilters = this.applyFilters.bind(this);
126
- filterModal.clearAll = this.clearAll.bind(this);
127
169
  filterModal.closeModal = () => this._closeModal();
170
+ filterModal.addPersonalizedFilter = () => this._addPersonalizedFilterFn();
171
+ filterModal.editPersonalizedFilter = (id) => this._editPersonalizedFilterFn(id);
128
172
  return filterModal;
129
173
  }
130
174
  async showModal() {
@@ -138,9 +182,12 @@ class SnkFilterModalFactory {
138
182
  };
139
183
  this._closeModal = await ApplicationUtils.showModal(modalProps);
140
184
  }
185
+ async closeModal() {
186
+ this._closeModal();
187
+ }
141
188
  }
142
189
 
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%}";
190
+ 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
191
 
145
192
  const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
146
193
  constructor() {
@@ -149,7 +196,8 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
149
196
  this._updateSequence = [];
150
197
  this._loadingPending = false;
151
198
  this._configUpdated = false;
152
- this._pendingFilters = [];
199
+ this._pendingVariables = false;
200
+ this._customfiltersToBeUpdated = [];
153
201
  this._calculateSortIndex = (item) => {
154
202
  let index = item.hardFixed ? 1000000 : 0;
155
203
  //campos Hard Fixed não variam a ordem
@@ -169,6 +217,8 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
169
217
  this.messagesBuilder = undefined;
170
218
  this.allowDefault = undefined;
171
219
  this.scrollerLocked = false;
220
+ this.showPersonalizedFilter = false;
221
+ this.personalizedFilterId = undefined;
172
222
  }
173
223
  observeFilterConfig(newValue, oldValue) {
174
224
  if (oldValue != undefined && newValue == undefined) {
@@ -177,17 +227,28 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
177
227
  }
178
228
  else {
179
229
  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
- });
230
+ if (oldItems.size === 0 && newValue.length > 0) {
231
+ this._loadingPending = true;
232
+ this._configUpdated = false;
233
+ }
234
+ else {
235
+ newValue.forEach(newItem => {
236
+ const oldItem = oldItems.get(newItem.id);
237
+ if (oldItem != undefined) {
238
+ this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
239
+ this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
240
+ if (!this._loadingPending) {
241
+ const groupedChanged = ObjectUtils.objectToString(oldItem.groupedItems) != ObjectUtils.objectToString(newItem.groupedItems);
242
+ this._configUpdated = this._configUpdated || groupedChanged;
243
+ this._loadingPending = this._loadingPending || groupedChanged;
244
+ }
245
+ }
246
+ else {
247
+ this._configUpdated = true;
248
+ this._loadingPending = this._loadingPending || newItem.value != undefined;
249
+ }
250
+ });
251
+ }
191
252
  }
192
253
  this.processAfterUpdateConfig();
193
254
  }
@@ -204,30 +265,31 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
204
265
  }
205
266
  }
206
267
  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();
268
+ if (this._pendingVariables) {
269
+ const popUp = this._element.querySelector("#filter-PERSONALIZED_FILTER_GROUP");
270
+ if (popUp) {
271
+ popUp.showUp(true).then(() => {
272
+ this.processAfterUpdateConfig();
213
273
  });
214
274
  }
215
275
  }
216
- if (this._currentPendingFilter == undefined) {
276
+ else {
217
277
  this.processAfterUpdateConfig();
218
278
  }
219
279
  }
220
- processAfterUpdateConfig() {
221
- if (this._pendingFilters.length > 0) {
222
- return;
223
- }
280
+ async processAfterUpdateConfig() {
224
281
  if (this._loadingPending) {
225
- this._loadingPending = false;
226
- this._inProgressLoadFromConfig = new Promise((resolve) => {
227
- this.dataUnit.loadData().then(() => {
228
- resolve();
229
- });
282
+ const personalizedFilter = this.filterConfig.find(item => {
283
+ if (item.type === FilterItemType.PERSONALIZED) {
284
+ return true;
285
+ }
230
286
  });
287
+ this._pendingVariables = !PersonalizedFilterUtils.validateVariableValues(personalizedFilter);
288
+ if (this._pendingVariables) {
289
+ return;
290
+ }
291
+ this._loadingPending = false;
292
+ this.dataUnit.loadData();
231
293
  }
232
294
  if (this._configUpdated) {
233
295
  this._configUpdated = false;
@@ -256,7 +318,14 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
256
318
  return filters;
257
319
  }
258
320
  isActiveFilter(item) {
259
- return (item.visible && item.value != undefined) || item.type === FilterItemType.DEFAULT_FILTER;
321
+ /*
322
+ - O filtro padrão também deve sempre ser condiderado ativo, pois, sempre deve
323
+ ser aplicado.
324
+ */
325
+ if (item.type === FilterItemType.DEFAULT_FILTER) {
326
+ return true;
327
+ }
328
+ return item.visible && (item.groupedItems || item.value != undefined);
260
329
  }
261
330
  registryFilterProvider() {
262
331
  this.dataUnit.addFilterProvider(this);
@@ -276,12 +345,16 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
276
345
  }
277
346
  });
278
347
  }
348
+ filterActiveFilter(item) {
349
+ return item.visible || item.removalBlocked;
350
+ }
279
351
  getFilterItems() {
280
352
  const pinnedItems = [];
281
353
  const unpinnedItems = [];
282
354
  this.filterConfig
283
- .filter(item => item.visible)
355
+ .filter(this.filterActiveFilter)
284
356
  .forEach((item, index) => {
357
+ item = ObjectUtils.copy(item);
285
358
  const itemId = `filter-${item.id}`;
286
359
  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
360
  if (item.fixed || item.hardFixed) {
@@ -335,19 +408,16 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
335
408
  this._application.isUserSup().then(value => this.allowDefault = value);
336
409
  }
337
410
  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);
411
+ return new Promise(accept => {
412
+ ConfigStorage.get().then(instance => {
413
+ instance.loadFilterBarConfig(this.configName)
414
+ .then((filters) => {
415
+ accept();
416
+ this.filterConfig = filters.map(item => this.normalizeItem(item));
417
+ })
418
+ .catch(reason => {
419
+ throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
420
+ });
351
421
  });
352
422
  });
353
423
  }
@@ -387,12 +457,34 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
387
457
  this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
388
458
  };
389
459
  const factoryParams = {
390
- filterConfig: this.filterConfig,
460
+ filterConfig: ObjectUtils.copy(this.filterConfig),
461
+ configName: this.configName,
391
462
  onComplete: callbackOnApplyFilter,
392
- getMessage: (key, props) => this.getMessage(key, props)
463
+ getMessage: (key, props) => this.getMessage(key, props),
464
+ onAddPersonalizedFilter: () => this.addPersonalizedFilter(),
465
+ onEditPersonalizedFilter: (id) => this.editPersonalizedFilter(id)
393
466
  };
394
- const factory = new SnkFilterModalFactory(factoryParams);
395
- await factory.showModal();
467
+ this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
468
+ await this._filterModalFactory.showModal();
469
+ }
470
+ addPersonalizedFilter() {
471
+ this._filterModalFactory.closeModal();
472
+ this.personalizedFilterId = undefined;
473
+ this.showPersonalizedFilter = true;
474
+ window.requestAnimationFrame(() => {
475
+ this._elPersonalizedFilter.createPersonalizedFilter();
476
+ });
477
+ }
478
+ editPersonalizedFilter(id) {
479
+ this._filterModalFactory.closeModal();
480
+ this.showPersonalizedFilter = true;
481
+ this.personalizedFilterId = id;
482
+ }
483
+ hidePersonalizedFilter() {
484
+ this.loadConfigFromStorage().then(() => {
485
+ this.personalizedFilterId = undefined;
486
+ this.showPersonalizedFilter = false;
487
+ });
396
488
  }
397
489
  componentWillLoad() {
398
490
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -409,7 +501,10 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
409
501
  if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
410
502
  return undefined;
411
503
  }
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" }))));
504
+ if (this.showPersonalizedFilter) {
505
+ 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 });
506
+ }
507
+ 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
508
  }
414
509
  get _element() { return this; }
415
510
  static get watchers() { return {
@@ -423,25 +518,57 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
423
518
  "messagesBuilder": [1040],
424
519
  "allowDefault": [32],
425
520
  "scrollerLocked": [32],
521
+ "showPersonalizedFilter": [32],
522
+ "personalizedFilterId": [32],
426
523
  "reload": [64]
427
524
  }, [[0, "filterChange", "filterChangeListener"]]]);
428
525
  function defineCustomElement() {
429
526
  if (typeof customElements === "undefined") {
430
527
  return;
431
528
  }
432
- const components = ["snk-filter-bar", "snk-filter-detail", "snk-filter-item"];
529
+ 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
530
  components.forEach(tagName => { switch (tagName) {
434
531
  case "snk-filter-bar":
435
532
  if (!customElements.get(tagName)) {
436
533
  customElements.define(tagName, SnkFilterBar);
437
534
  }
438
535
  break;
536
+ case "snk-expression-group":
537
+ if (!customElements.get(tagName)) {
538
+ defineCustomElement$8();
539
+ }
540
+ break;
541
+ case "snk-expression-item":
542
+ if (!customElements.get(tagName)) {
543
+ defineCustomElement$7();
544
+ }
545
+ break;
439
546
  case "snk-filter-detail":
440
547
  if (!customElements.get(tagName)) {
441
- defineCustomElement$2();
548
+ defineCustomElement$6();
549
+ }
550
+ break;
551
+ case "snk-filter-field-search":
552
+ if (!customElements.get(tagName)) {
553
+ defineCustomElement$5();
442
554
  }
443
555
  break;
444
556
  case "snk-filter-item":
557
+ if (!customElements.get(tagName)) {
558
+ defineCustomElement$4();
559
+ }
560
+ break;
561
+ case "snk-filter-param-config":
562
+ if (!customElements.get(tagName)) {
563
+ defineCustomElement$3();
564
+ }
565
+ break;
566
+ case "snk-personalized-filter":
567
+ if (!customElements.get(tagName)) {
568
+ defineCustomElement$2();
569
+ }
570
+ break;
571
+ case "snk-simple-bar":
445
572
  if (!customElements.get(tagName)) {
446
573
  defineCustomElement$1();
447
574
  }
@@ -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 {