@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
@@ -1,11 +1,13 @@
1
1
  import { Host, h } from '@stencil/core';
2
- import { ApplicationContext, UserInterface } from '@sankhyalabs/core';
2
+ import { ApplicationContext, ElementIDUtils, UserInterface } from '@sankhyalabs/core';
3
3
  import { SelectedItemType } from "../../../snk-filter-field-search/interfaces";
4
4
  import { CheckMode, ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
5
5
  import { fieldBuilder } from "@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder";
6
6
  import { FilterOperand } from '../../../../lib/@types';
7
7
  import { FilterOperandDefault, FilterOperandTypeTextSearch, FIELD_TYPE_SEARCH_AND_TEXT } from "./filter-operands/filter-operands";
8
8
  import store from '../../../../lib/store';
9
+ import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
10
+ const DEFAULT_FIELD_NAME = 'NOT_DEFINED';
9
11
  export class SnkExpressionItem {
10
12
  constructor() {
11
13
  this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -17,30 +19,107 @@ export class SnkExpressionItem {
17
19
  this.expression = undefined;
18
20
  this.canRemove = true;
19
21
  this.messagesBuilder = undefined;
22
+ this.entityURI = undefined;
20
23
  }
21
24
  expressionChanged(newValue, oldValue) {
22
25
  if (newValue !== oldValue) {
23
26
  this.ezFilterItemChange.emit(newValue);
27
+ this.updateFieldSelected();
24
28
  }
25
29
  }
26
30
  componentWillLoad() {
27
- this._dataSourceFetcher = store.get("filterFieldsDataSource");
28
- store.onChange('filterFieldsDataSource', () => {
29
- this._dataSourceFetcher = store.get("filterFieldsDataSource");
31
+ this._dataSourceFetcher = store.get(`filterFieldsDataSource.${this.entityURI}`);
32
+ store.onChange(`filterFieldsDataSource.${this.entityURI}`, () => {
33
+ this._dataSourceFetcher = store.get(`filterFieldsDataSource.${this.entityURI}`);
30
34
  });
35
+ if (this.expression) {
36
+ this.updateFieldSelected();
37
+ this._optionNotNull = this.expression.operand === 'NULL' || this.expression.operand === 'NOT_NULL';
38
+ }
39
+ }
40
+ componentDidRender() {
41
+ this._showValueVariable = this._elValueVariable.value;
42
+ }
43
+ updateFieldSelected() {
44
+ const field = {
45
+ dataType: this.expression.type,
46
+ description: this.expression.description,
47
+ name: this.expression.fieldName,
48
+ label: this.expression.fieldLabel,
49
+ entityName: this.expression.entityName,
50
+ onlyDate: false,
51
+ path: this.expression.description,
52
+ properties: this.expressionPropsToFieldProps(this.expression.props),
53
+ type: SelectedItemType.FIELD,
54
+ uri: "",
55
+ userInterface: this.expression.userInterface
56
+ };
57
+ this._fieldSelected = field;
58
+ }
59
+ buildExpression(entityName, fieldName, entityPath) {
60
+ if (entityPath.length > 0) {
61
+ entityPath.shift();
62
+ }
63
+ return entityPath.length > 0 ? `${entityPath.join("->")}->${fieldName}` : `${entityName}.${fieldName}`;
31
64
  }
32
65
  setValueExpression(key, value) {
33
- this.expression[key] = value;
66
+ if (key === "fieldName") {
67
+ this.expression.description = value.path;
68
+ this.expression.expression = this.buildExpression(value.entityName, value.name, value.entityPath);
69
+ this.expression.fieldName = value.name;
70
+ this.expression.fieldLabel = value.label;
71
+ this.expression.type = value.dataType;
72
+ this.expression.userInterface = value.userInterface;
73
+ this.expression.entityName = value.entityName;
74
+ this.expression.value = undefined;
75
+ this.expression.props = this.fieldPropsToExpressionProps(value.properties);
76
+ }
77
+ else {
78
+ this.expression[key] = value;
79
+ }
34
80
  this.expressionChanged(this.expression);
35
81
  }
82
+ fieldPropsToExpressionProps(properties) {
83
+ const parsedProps = [];
84
+ if (!properties) {
85
+ return parsedProps;
86
+ }
87
+ for (const key in properties) {
88
+ let propValue = properties[key];
89
+ if (typeof propValue == "object") {
90
+ propValue = JSON.stringify(propValue);
91
+ }
92
+ parsedProps.push({ name: key, value: propValue });
93
+ }
94
+ return parsedProps;
95
+ }
96
+ expressionPropsToFieldProps(properties) {
97
+ const parsedProps = {};
98
+ if (!properties) {
99
+ return parsedProps;
100
+ }
101
+ properties.forEach(prop => {
102
+ try {
103
+ parsedProps[prop.name] = JSON.parse(prop.value);
104
+ }
105
+ catch (_a) {
106
+ parsedProps[prop.name] = prop.value;
107
+ }
108
+ });
109
+ return parsedProps;
110
+ }
36
111
  getMessage(key, params) {
37
112
  return this.application.messagesBuilder.getMessage(key, params);
38
113
  }
39
114
  handleSelectItem(filterField) {
115
+ if (filterField.name === this.expression.fieldName) {
116
+ this._elFilterInput.value = filterField.path;
117
+ return;
118
+ }
40
119
  if (filterField.type === SelectedItemType.FIELD) {
41
120
  const field = filterField;
42
121
  this._fieldSelected = field;
43
- this.setValueExpression("fieldName", field.name);
122
+ this.setValueExpression("fieldName", field);
44
123
  }
45
124
  }
46
125
  handleFocus() {
@@ -56,6 +135,8 @@ export class SnkExpressionItem {
56
135
  this._elFieldDynamic.value = undefined;
57
136
  this._elFieldDynamic.enabled = !showValueVariable;
58
137
  }
138
+ this.expression["paramVariable"] = showValueVariable;
139
+ this.expressionChanged(this.expression);
59
140
  }
60
141
  openSnkFilterParamConfig() {
61
142
  var _a;
@@ -80,7 +161,8 @@ export class SnkExpressionItem {
80
161
  this.setValueExpression("operand", optionSelected);
81
162
  }
82
163
  checkOptionIsNull(optionSelected) {
83
- if (optionSelected === FilterOperand.NULL || optionSelected === FilterOperand.NOT_NULL) {
164
+ const filterOperandValue = FilterOperand[optionSelected];
165
+ if ([FilterOperand.NULL, FilterOperand.NOT_NULL].includes(filterOperandValue)) {
84
166
  this._optionNotNull = true;
85
167
  if (this._elFieldDynamic) {
86
168
  this._elFieldDynamic.enabled = false;
@@ -97,7 +179,7 @@ export class SnkExpressionItem {
97
179
  confirmRemove(evt) {
98
180
  evt.preventDefault();
99
181
  evt.stopPropagation();
100
- ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirm.title"), this.getMessage("snkPersonalizedFilter.confirm.description"))
182
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmExpression.title"), this.getMessage("snkPersonalizedFilter.confirmExpression.description"))
101
183
  .then((canRemove) => {
102
184
  if (canRemove) {
103
185
  this.ezFilterItemRemove.emit(this.expression);
@@ -105,18 +187,31 @@ export class SnkExpressionItem {
105
187
  });
106
188
  }
107
189
  buildFieldByType() {
108
- var _a, _b;
190
+ var _a, _b, _c;
109
191
  if (!this._fieldSelected)
110
192
  return;
111
193
  const inputFieldData = (_a = fieldBuilder(this.configureFieldByType())) === null || _a === void 0 ? void 0 : _a.$children$.shift();
112
- if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData) {
194
+ if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData || this.expression.paramVariable || this._showValueVariable || !((_c = this._fieldSelected) === null || _c === void 0 ? void 0 : _c.dataType)) {
113
195
  inputFieldData.$attrs$.enabled = false;
114
196
  }
197
+ if (this.expression.value) {
198
+ inputFieldData.$attrs$.value = this.getExpressiontValue(this.expression);
199
+ }
200
+ inputFieldData.$attrs$.onEzChange = (event) => {
201
+ this.setValueExpression("value", event.target.value);
202
+ };
203
+ if (this.expression.userInterface === 'SWITCH' && this.expression.value == undefined) {
204
+ this.setValueExpression("value", false);
205
+ }
115
206
  return h(inputFieldData.$tag$, Object.assign(Object.assign({}, inputFieldData.$attrs$), { ref: (el) => {
116
207
  this._elFieldDynamic = el;
117
- } }));
208
+ }, label: this.expression.fieldLabel || this._fieldSelected.label }));
209
+ }
210
+ getExpressiontValue(expression) {
211
+ return convertType(expression.type, expression.value);
118
212
  }
119
213
  configureFieldByType() {
214
+ var _a, _b;
120
215
  const field = {
121
216
  userInterface: this._fieldSelected.userInterface,
122
217
  name: this._fieldSelected.name,
@@ -126,10 +221,7 @@ export class SnkExpressionItem {
126
221
  switch (field.userInterface) {
127
222
  case UserInterface.OPTIONSELECTOR:
128
223
  field.props = {
129
- options: this._fieldSelected.properties.map(option => ({
130
- value: option.value,
131
- label: option.name,
132
- })),
224
+ options: (_b = (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.options,
133
225
  };
134
226
  break;
135
227
  case UserInterface.LONGTEXT:
@@ -144,25 +236,26 @@ export class SnkExpressionItem {
144
236
  return field;
145
237
  }
146
238
  setCriteriaSearch({ mode, argument }, application) {
239
+ var _a, _b;
147
240
  if (application == undefined)
148
241
  return;
149
242
  const searchOptions = {
150
243
  showInactives: false
151
244
  };
152
245
  const options = {
153
- entity: this._fieldSelected.properties.ENTITYNAME,
154
- searchOptions: searchOptions,
155
- entityDescription: this._fieldSelected.label
246
+ entity: (_b = (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.ENTITYNAME,
247
+ searchOptions,
248
+ entityDescription: this._fieldSelected.description
156
249
  };
157
250
  return application.executePreparedSearch(mode, argument, options);
158
251
  }
159
252
  render() {
160
253
  var _a;
161
- return (h(Host, null, h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", { value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", { label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => this.handleChangeOperator(evt.detail.value), suppressEmptyOption: true })), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
254
+ return (h(Host, null, h("div", { class: "dashes" }), h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || DEFAULT_FIELD_NAME}` })), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || DEFAULT_FIELD_NAME}` }))), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
162
255
  h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
163
256
  this.buildFieldByType()), h("div", { class: "box__container--input-value-variable", title: this.getMessage("snkPersonalizedFilter.info.titleTooltip") }, !this._optionNotNull &&
164
- h("ez-check", { ref: ref => this._elValueVariable = ref, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
165
- h("ez-icon", { class: "box__container--input-value-variable--icon", size: "large", iconName: "settings-inverted", onClick: () => this.openSnkFilterParamConfig() }), h("snk-filter-param-config", { ref: (el) => this._elFilterParamConfigRef = el, messagesBuilder: this.messagesBuilder })), h("div", { class: "box__container--button-delete" }, h("div", { class: "box__container--button-delete--icon" }, this.canRemove && h("ez-button", { mode: "icon", iconName: "delete", onClick: (evt) => this.confirmRemove(evt) })))))));
257
+ h("ez-check", { ref: ref => this._elValueVariable = ref, value: this.expression.paramVariable, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
258
+ h("ez-icon", Object.assign({ class: "box__container--input-value-variable--icon", size: "large", iconName: "settings-inverted" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: 'iconConfig' }, { onClick: () => this.openSnkFilterParamConfig() })), h("snk-filter-param-config", { ref: (el) => this._elFilterParamConfigRef = el, messagesBuilder: this.messagesBuilder })), h("div", { class: "box__container--button-delete" }, h("div", { class: "box__container--button-delete--icon" }, h("ez-button", { mode: "icon", iconName: "delete", enabled: this.canRemove, label: this.getMessage("snkPersonalizedFilter.info.labelDeleteItem"), onClick: (evt) => this.confirmRemove(evt) })))))));
166
259
  }
167
260
  static get is() { return "snk-expression-item"; }
168
261
  static get encapsulation() { return "scoped"; }
@@ -236,6 +329,23 @@ export class SnkExpressionItem {
236
329
  "tags": [],
237
330
  "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
238
331
  }
332
+ },
333
+ "entityURI": {
334
+ "type": "string",
335
+ "mutable": true,
336
+ "complexType": {
337
+ "original": "string",
338
+ "resolved": "string",
339
+ "references": {}
340
+ },
341
+ "required": false,
342
+ "optional": false,
343
+ "docs": {
344
+ "tags": [],
345
+ "text": "Identificador da unidade de dados."
346
+ },
347
+ "attribute": "entity-u-r-i",
348
+ "reflect": false
239
349
  }
240
350
  };
241
351
  }
@@ -1 +1,5 @@
1
- export {};
1
+ export var FilterGroupCondition;
2
+ (function (FilterGroupCondition) {
3
+ FilterGroupCondition["AND"] = "AND";
4
+ FilterGroupCondition["OR"] = "OR";
5
+ })(FilterGroupCondition || (FilterGroupCondition = {}));
@@ -0,0 +1,3 @@
1
+ export * from './IExpressionItem';
2
+ export * from './ISystemFilterConfig';
3
+ export * from './IUserFilterConfig';
@@ -142,7 +142,7 @@ export class SnkFilterParamConfig {
142
142
  };
143
143
  }
144
144
  onSearch({ mode, argument }, entity) {
145
- if (this._application == undefined) {
145
+ if (this._application == undefined || !this._opened) {
146
146
  return;
147
147
  }
148
148
  const isField = entity === FilterEntities.FIELD;
@@ -1,35 +1,45 @@
1
+ import { DataType, DateUtils, NumberUtils, UserInterface } from "@sankhyalabs/core";
1
2
  import { FilterOperand } from "../../../../../lib/@types";
3
+ import FilterItemType from "../../../../snk-filter-bar/filter-item/filter-item-type.enum";
2
4
  export class PersonalizedFilterUtils {
3
5
  /**
4
6
  * Cria uma expressão de filtro a partir de um IExpressionItem.
5
7
  * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
6
8
  * @returns Retorna a expressão de filtro.
7
9
  */
8
- static buildFilterExpression(expressionItem) {
10
+ static buildFilterExpression(expressionItem, ignoreInvalidExpressions = false) {
9
11
  if (expressionItem == undefined) {
10
12
  return;
11
13
  }
12
- const value = this.buildVariableParameterValue(expressionItem);
14
+ if (!this.validateExpressionItem(expressionItem) && ignoreInvalidExpressions) {
15
+ return "";
16
+ }
17
+ let value = this.buildVariableParameterValue(expressionItem);
13
18
  let expression = expressionItem.expression || "";
19
+ let commas = "'";
20
+ if (expressionItem.paramVariable) {
21
+ commas = "";
22
+ }
14
23
  switch (expressionItem.operand) {
15
- case FilterOperand.IN:
16
- expression += ` ${expressionItem.operand} (${value})`;
24
+ case "IN":
25
+ expression += ` ${FilterOperand[expressionItem.operand]} (${value})`;
17
26
  break;
18
- case FilterOperand.NULL:
19
- case FilterOperand.NOT_NULL:
20
- expression += ` IS ${value}`;
27
+ case "NULL":
28
+ case "NOT_NULL":
29
+ expression += ` IS ${FilterOperand[expressionItem.operand]}`;
21
30
  break;
22
- case FilterOperand.LIKE:
23
- expression += ` LIKE '%${value}%'`;
31
+ case "LIKE":
32
+ expression += ` LIKE ${commas}%${value}%${commas}`;
24
33
  break;
25
- case FilterOperand.START_WITH:
26
- expression += ` LIKE '${value}%'`;
34
+ case "START_WITH":
35
+ expression += ` LIKE ${commas}${value}%${commas}`;
27
36
  break;
28
- case FilterOperand.FINISHED_WITH:
29
- expression += ` LIKE '%${value}'`;
37
+ case "FINISHED_WITH":
38
+ expression += ` LIKE ${commas}%${value}${commas}`;
30
39
  break;
31
40
  default:
32
- expression += ` ${expressionItem.operand} ${value}`;
41
+ value = isNaN(value) ? `${commas}${value}${commas}` : value;
42
+ expression += ` ${FilterOperand[expressionItem.operand]} ${value}`;
33
43
  }
34
44
  return expression;
35
45
  }
@@ -39,9 +49,43 @@ export class PersonalizedFilterUtils {
39
49
  * @returns Retorna o valor do parâmetro.
40
50
  */
41
51
  static buildVariableParameterValue(expressionItem) {
42
- if (expressionItem == undefined) {
52
+ var _a;
53
+ if (expressionItem == undefined)
43
54
  return;
55
+ if (expressionItem.paramVariable) {
56
+ return this.proccessVarialbeParameter(expressionItem);
57
+ }
58
+ if (expressionItem.operand !== FilterOperand.NULL && expressionItem.operand !== "NOT_NULL") {
59
+ let value = expressionItem.value;
60
+ const type = expressionItem.type;
61
+ /*
62
+ Precisamos validar o expressionItem.userInterface além do expressionItem.type
63
+ pois para filtros herdados do HTML5 não temos o tipo OBJECT, fazendo com que a expressão
64
+ fique inválida para campos do tipo pesquisa.
65
+ */
66
+ if (UserInterface.SEARCH === expressionItem.userInterface || DataType.OBJECT == type) {
67
+ value = (_a = value === null || value === void 0 ? void 0 : value.value) !== null && _a !== void 0 ? _a : value;
68
+ }
69
+ if (DataType.NUMBER == type && value != undefined) {
70
+ value = NumberUtils.stringToNumber(value);
71
+ this.checkIsValidNumber(value);
72
+ }
73
+ else if (DataType.DATE == type) {
74
+ value = this.convertDataValue(value);
75
+ }
76
+ else if (DataType.BOOLEAN == type) {
77
+ value = value ? "S" : "N";
78
+ }
79
+ return value;
80
+ }
81
+ return expressionItem.operand;
82
+ }
83
+ static checkIsValidNumber(value) {
84
+ if (isNaN(value)) {
85
+ throw new Error('O valor informado não é um número válido.');
44
86
  }
87
+ }
88
+ static proccessVarialbeParameter(expressionItem) {
45
89
  if (expressionItem.systemConfig != undefined) {
46
90
  const systemConfig = expressionItem.systemConfig;
47
91
  return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
@@ -52,4 +96,129 @@ export class PersonalizedFilterUtils {
52
96
  }
53
97
  return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
54
98
  }
99
+ static convertDataValue(value) {
100
+ if (typeof value == 'string') {
101
+ value = new Date(value);
102
+ }
103
+ return DateUtils.formatDate(value);
104
+ }
105
+ /*
106
+ * Cria uma expressão de filtro para um grupo de itens.
107
+ */
108
+ static buildGroupExpression(expressionGroup, ignoreInvalidExpressions = false) {
109
+ var _a, _b;
110
+ if (!((_a = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.items) === null || _a === void 0 ? void 0 : _a.length))
111
+ return "";
112
+ const itemExpressions = expressionGroup.items.map((item) => this.buildFilterExpression(item, ignoreInvalidExpressions)).join(` ${expressionGroup.operand} `);
113
+ if (((_b = expressionGroup === null || expressionGroup === void 0 ? void 0 : expressionGroup.childrenGroups) === null || _b === void 0 ? void 0 : _b.length) > 0) {
114
+ const childGroupExpressions = expressionGroup.childrenGroups.map((children) => this.buildGroupExpression(children)).join(` ${expressionGroup.operand} `);
115
+ return `(${itemExpressions} ${expressionGroup.operand} (${childGroupExpressions}))`;
116
+ }
117
+ return `(${itemExpressions})`;
118
+ }
119
+ /*
120
+ * Valida se os campos das expressão estão válidas para serem criada ou editada.
121
+ */
122
+ static validateFields(expressionGroup) {
123
+ const allItems = this.buildPlainExpressionItems(expressionGroup);
124
+ for (const item of allItems) {
125
+ const isValidItem = this.validateExpressionItem(item);
126
+ if (!isValidItem) {
127
+ return false;
128
+ }
129
+ }
130
+ return true;
131
+ }
132
+ static buildPlainExpressionItems(expressionGroup) {
133
+ const { items = [], childrenGroups = [] } = expressionGroup || {};
134
+ const getItemsFromChildren = (childrenGroup) => {
135
+ return childrenGroup.reduce((listAcc, children) => {
136
+ var _a;
137
+ if (children.items)
138
+ listAcc = listAcc.concat(children.items);
139
+ if ((_a = children.childrenGroups) === null || _a === void 0 ? void 0 : _a.length) {
140
+ listAcc = listAcc.concat(getItemsFromChildren(children.childrenGroups));
141
+ }
142
+ return listAcc;
143
+ }, []);
144
+ };
145
+ return items.concat(getItemsFromChildren(childrenGroups));
146
+ }
147
+ static validateExpressionItem(expressionItem) {
148
+ const requiredFields = {
149
+ fieldName: (value) => !!value,
150
+ value: (value, byPassValue) => {
151
+ if (byPassValue)
152
+ return true;
153
+ return !!value;
154
+ },
155
+ operand: (value) => !!value
156
+ };
157
+ const isAllValidFields = Object.entries(requiredFields).every(entries => {
158
+ const [fieldName, validate] = entries;
159
+ const byPassValue = expressionItem.paramVariable || expressionItem.userInterface === 'SWITCH' || ["NULL", "NOT_NULL"].includes(expressionItem.operand);
160
+ return validate(expressionItem[fieldName], byPassValue);
161
+ });
162
+ return isAllValidFields;
163
+ }
164
+ static getNormalizedValue(params, value) {
165
+ return params.reduce((arrayValues, currentParam, index) => {
166
+ if (currentParam.dataType === DataType.BOOLEAN && (arrayValues == undefined || arrayValues[index] == undefined)) {
167
+ arrayValues = !!arrayValues && !Array.isArray(arrayValues) ? [arrayValues] : arrayValues || [];
168
+ arrayValues[index] = false;
169
+ }
170
+ return arrayValues;
171
+ }, value);
172
+ }
173
+ /*
174
+ * Valida se os filtros personalizados com campo variável são válido.
175
+ */
176
+ static validateVariableValues(config, editorValue) {
177
+ if (!config)
178
+ return true;
179
+ let valuesArray = editorValue || config.value;
180
+ let isValid = true;
181
+ if (config.type === FilterItemType.PERSONALIZED) {
182
+ const activeFilters = (config.groupedItems || []).filter(item => item.visible);
183
+ const allFilterWithVariableParams = activeFilters.filter(activeFilter => { var _a, _b, _c; return !!((_c = (_b = (_a = activeFilter.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) === null || _c === void 0 ? void 0 : _c.length); });
184
+ const allParamsWithValues = allFilterWithVariableParams.flatMap(filter => { var _a; return (_a = filter.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters; });
185
+ const valuesFromParams = allFilterWithVariableParams.flatMap(filter => {
186
+ const isBoolean = filter.props.personalizedFilter.parameters[0].dataType === DataType.BOOLEAN;
187
+ return isBoolean ? false : filter.value;
188
+ });
189
+ valuesArray = this.getNormalizedValue(allParamsWithValues, valuesArray);
190
+ isValid = allParamsWithValues.length === valuesFromParams.length && valuesFromParams.every(value => value != null);
191
+ }
192
+ return isValid;
193
+ }
194
+ /*
195
+ * Constroi uma lista parâmetros para todos os itens de grupos e subgrupos que são
196
+ * do tipo variavel;
197
+ */
198
+ static buildVariableParameters(expressionGroup) {
199
+ var _a, _b, _c, _d;
200
+ const allItems = this.buildPlainExpressionItems(expressionGroup);
201
+ const allParams = [];
202
+ for (const item of allItems) {
203
+ if (!item.paramVariable) {
204
+ continue;
205
+ }
206
+ allParams.push({
207
+ entityName: item.entityName,
208
+ fieldName: item.fieldName,
209
+ dataType: item.type,
210
+ description: item.description,
211
+ userInterface: item.userInterface,
212
+ label: item.fieldLabel,
213
+ searchContext: {
214
+ entity: (_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.find(prop => prop.name == "ENTITYNAME")) === null || _b === void 0 ? void 0 : _b.value,
215
+ entityDescription: (_d = (_c = item.props) === null || _c === void 0 ? void 0 : _c.find(prop => prop.name == "DESCRIPTIONENTITY")) === null || _d === void 0 ? void 0 : _d.value,
216
+ searchOptions: {
217
+ showInactives: false
218
+ }
219
+ }
220
+ });
221
+ }
222
+ return allParams;
223
+ }
55
224
  }
@@ -37,9 +37,11 @@ export var FilterConfigType;
37
37
  export var FilterUserConfigTypes;
38
38
  (function (FilterUserConfigTypes) {
39
39
  FilterUserConfigTypes["DATE"] = "D";
40
+ FilterUserConfigTypes["HORA"] = "H";
40
41
  FilterUserConfigTypes["TEXT"] = "S";
41
42
  FilterUserConfigTypes["INTEGER"] = "I";
42
43
  FilterUserConfigTypes["DECIMAL"] = "F";
44
+ FilterUserConfigTypes["NUMBER"] = "NUMBER";
43
45
  })(FilterUserConfigTypes || (FilterUserConfigTypes = {}));
44
46
  export var FilterOperand;
45
47
  (function (FilterOperand) {
@@ -2,6 +2,7 @@ import { ApplicationContext } from "@sankhyalabs/core";
2
2
  import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fetcher";
3
3
  import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
4
4
  import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
5
+ import PersonalizedFilterFetcher from "../http/data-fetcher/fetchers/personalized-filter-fetcher";
5
6
  const CONFIG_SOURCE = {
6
7
  form: "form",
7
8
  grid: "grid",
@@ -65,6 +66,19 @@ export class ConfigStorage {
65
66
  this.configById.delete(cacheID);
66
67
  return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
67
68
  }
69
+ static async loadPersonalizedFilter(filterId, configName) {
70
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
71
+ }
72
+ static async savePersonalizedFilter(personalizedFilter, configName) {
73
+ //Ao criar ou alterar um filtro personalizado,
74
+ //precisamos remover o cache do status da filterbar.
75
+ const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
76
+ this.configById.delete(cacheID);
77
+ return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
78
+ }
79
+ static async removePersonalizedFilter(personalizedFilter, configName) {
80
+ return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
81
+ }
68
82
  static buildCacheID(name, source) {
69
83
  if (name == undefined) {
70
84
  return `req_${source}_${this.resourceID}`;
@@ -76,3 +90,4 @@ ConfigStorage.configById = new Map();
76
90
  ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
77
91
  ConfigStorage.formConfigFetcher = new FormConfigFetcher();
78
92
  ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
93
+ ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();