@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
@@ -0,0 +1,238 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
2
+ import { StringUtils, ObjectUtils, ApplicationContext } from '@sankhyalabs/core';
3
+ import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils.js';
4
+ import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage.js';
5
+ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
6
+ import { F as FilterGroupCondition, d as defineCustomElement$5 } from './snk-expression-group2.js';
7
+ import { s as store } from './index3.js';
8
+ import { d as defineCustomElement$4 } from './snk-expression-item2.js';
9
+ import { d as defineCustomElement$3 } from './snk-filter-field-search2.js';
10
+ import { d as defineCustomElement$2 } from './snk-filter-param-config2.js';
11
+ import { d as defineCustomElement$1 } from './snk-simple-bar2.js';
12
+
13
+ const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}";
14
+
15
+ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
+ constructor() {
17
+ super();
18
+ this.__registerHost();
19
+ this.ezCancel = createEvent(this, "ezCancel", 7);
20
+ this.ezSave = createEvent(this, "ezSave", 7);
21
+ this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
22
+ this._dataSourceFetcher = {
23
+ fetchData: async (entity) => {
24
+ let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
25
+ if (StringUtils.isEmpty(entityURI)) {
26
+ entityURI = this.entityUri;
27
+ }
28
+ return await this._personalizedFilterFetcher.loadFields(entityURI);
29
+ }
30
+ };
31
+ this._filterAssistentMode = true;
32
+ this._filterAssistent = undefined;
33
+ this.messagesBuilder = undefined;
34
+ this.entityUri = undefined;
35
+ this.filterId = undefined;
36
+ this.configName = undefined;
37
+ }
38
+ /*
39
+ * Cria um novo filtro se não houver nenhum filtro existente
40
+ */
41
+ async createPersonalizedFilter() {
42
+ const newPersonalizedFilter = {
43
+ name: "",
44
+ active: true,
45
+ expression: "",
46
+ parameters: [],
47
+ assistent: {
48
+ id: StringUtils.generateUUID(),
49
+ items: [
50
+ {
51
+ id: StringUtils.generateUUID(),
52
+ entityName: "",
53
+ fieldName: "",
54
+ description: "",
55
+ fieldLabel: "Valor",
56
+ type: undefined,
57
+ expression: undefined,
58
+ operand: undefined,
59
+ paramVariable: false,
60
+ value: undefined,
61
+ systemConfig: null,
62
+ userConfig: null
63
+ }
64
+ ],
65
+ childrenGroups: [],
66
+ operand: FilterGroupCondition.AND
67
+ }
68
+ };
69
+ this._originalFilterAssistent = ObjectUtils.copy(newPersonalizedFilter);
70
+ this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
71
+ }
72
+ loadFilter(newValue, oldValue) {
73
+ if (newValue == null || oldValue == newValue) {
74
+ return;
75
+ }
76
+ ConfigStorage.get().then((_instance) => {
77
+ ConfigStorage.loadPersonalizedFilter(newValue, this.configName)
78
+ .then((resp) => {
79
+ const personalizedFilter = this.addLabelToItems(resp);
80
+ this._filterAssistent = personalizedFilter;
81
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
82
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
83
+ });
84
+ });
85
+ }
86
+ componentWillLoad() {
87
+ var _a;
88
+ if (store.get(`filterFieldsDataSource.${this.entityUri}`) == undefined) {
89
+ store.set(`filterFieldsDataSource.${this.entityUri}`, this._dataSourceFetcher);
90
+ }
91
+ if (!this.messagesBuilder) {
92
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
93
+ this.messagesBuilder = (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder;
94
+ }
95
+ this.loadFilter(this.filterId, undefined);
96
+ }
97
+ getMessage(key, params) {
98
+ return this._application.messagesBuilder.getMessage(key, params);
99
+ }
100
+ saveFilter() {
101
+ ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.configName).then((personalizedFilter) => {
102
+ this._elButtonSave.enabled = false;
103
+ ApplicationUtils.info(this.getMessage("snkPersonalizedFilter.confirmSave.title", { name: this._filterAssistent.name }), { iconName: "check" });
104
+ const updatedFilterAssistent = Object.assign(Object.assign({}, personalizedFilter), this._filterAssistent);
105
+ updatedFilterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
106
+ this._originalFilterAssistent = ObjectUtils.copy(updatedFilterAssistent);
107
+ this._filterAssistent = ObjectUtils.copy(updatedFilterAssistent);
108
+ });
109
+ }
110
+ removeFilter() {
111
+ ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
112
+ }
113
+ async handleFilterGroupChange() {
114
+ const assistent = await this._mainExpressionGroup.getExpressionGroup();
115
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { assistent });
116
+ this._filterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
117
+ this._elTextAreaExpression.value = PersonalizedFilterUtils.buildGroupExpression(this._filterAssistent.assistent, true);
118
+ this._elButtonSave.enabled = !this.hasChangesToSave();
119
+ }
120
+ hasChangesToSave() {
121
+ return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
122
+ }
123
+ handleSave() {
124
+ const { assistent, expression } = this._filterAssistent;
125
+ const isValid = PersonalizedFilterUtils.validateFields(assistent);
126
+ if (!isValid || !this._filterAssistent.name)
127
+ return this._application.error(this.getMessage("snkPersonalizedFilter.error.title"), this.getMessage("snkPersonalizedFilter.error.description"));
128
+ const expressionQuery = !!assistent ? PersonalizedFilterUtils.buildGroupExpression(assistent) : expression;
129
+ this._filterAssistent.expression = expressionQuery;
130
+ this.ezSave.emit(expressionQuery);
131
+ this.saveFilter();
132
+ }
133
+ handleCancel() {
134
+ if (this.hasChangesToSave()) {
135
+ return this.ezCancel.emit();
136
+ }
137
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmCancel.title"), this.getMessage("snkPersonalizedFilter.confirmCancel.description"))
138
+ .then((canCancel) => {
139
+ var _a;
140
+ if (canCancel) {
141
+ this._filterAssistent = ObjectUtils.copy((_a = this._originalFilterAssistent) !== null && _a !== void 0 ? _a : {});
142
+ this.ezCancel.emit();
143
+ this._elButtonSave.enabled = false;
144
+ }
145
+ });
146
+ }
147
+ handleTitleChange(name) {
148
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { name });
149
+ this._elButtonSave.enabled = !this.hasChangesToSave();
150
+ }
151
+ addLabelToItems(resp) {
152
+ //Workaround: Alguns filtros foram salvos sem o fieldLabel. Para evitar transtornos
153
+ //tentamos usar o fieldLabel que pode estar informado no parametro.
154
+ if (resp.assistent && resp.assistent.items && resp.assistent.items.length > 0) {
155
+ resp.assistent.items.forEach(item => {
156
+ if (item.fieldLabel == undefined) {
157
+ const param = (resp.parameters || []).find(param => param.fieldName === item.fieldName);
158
+ if (param) {
159
+ item.fieldLabel = param.label;
160
+ }
161
+ }
162
+ });
163
+ }
164
+ return resp;
165
+ }
166
+ handleExpressionChange(expression) {
167
+ this._filterAssistent = Object.assign(Object.assign({}, this._filterAssistent), { expression });
168
+ this._elButtonSave.enabled = !this.hasChangesToSave();
169
+ }
170
+ getWarningMessageComponent() {
171
+ var _a;
172
+ if (StringUtils.isEmpty((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.warningMessage)) {
173
+ return undefined;
174
+ }
175
+ return (h("div", { class: "ez-flex" }, h("ez-alert", { alertType: "warn" }, this._filterAssistent.warningMessage)));
176
+ }
177
+ render() {
178
+ var _a, _b, _c, _d, _e;
179
+ if (!((_a = this._filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent) && this._filterAssistentMode) {
180
+ return;
181
+ }
182
+ return (h(Host, null, h("div", { class: "snk-personalized-filter" }, h("div", null, h("snk-simple-bar", { label: this.filterId ? this.getMessage("snkPersonalizedFilter.info.titleEdit") : this.getMessage("snkPersonalizedFilter.info.titleAdd"), onExit: () => this.handleCancel() }, h("div", { class: "snk-personalized-filter__header-actions", slot: "rightSlot" }, h("ez-button", { size: "small", label: this.getMessage("snkPersonalizedFilter.info.labelCancel"), onClick: () => this.handleCancel() }), h("ez-button", { size: "small", ref: (el) => this._elButtonSave = el, enabled: false, class: "ez-button--primary", label: this.getMessage("snkPersonalizedFilter.info.labelSave"), onClick: this.handleSave.bind(this) })))), h("div", { class: "ez-box ez-margin-bottom--medium ez-box__main" }, h("div", { class: "ez-box__container" }, h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("div", { class: "ez-flex" }, h("ez-text-input", { class: "ez-padding-right--medium", label: this.getMessage("snkPersonalizedFilter.info.labelNameFilter"), value: (_b = this._filterAssistent) === null || _b === void 0 ? void 0 : _b.name, onEzChange: (evt) => this.handleTitleChange(evt.detail) })), this._filterAssistentMode ?
183
+ h(Fragment, null, h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_c = this._filterAssistent) === null || _c === void 0 ? void 0 : _c.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), h("div", null, h("div", { class: "snk-personalized-filter__expression-input--line" }), h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, h("div", { class: "ez-box" }, h("div", { class: "ez-box__container" }, h("ez-text-area", { ref: (el) => this._elTextAreaExpression = el, enabled: false, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_d = this._filterAssistent) === null || _d === void 0 ? void 0 : _d.expression })))))) :
184
+ h(Fragment, null, h("span", { class: "ez-text ez-text--small ez-text--bold ez-padding-bottom--medium" }, "Express\u00E3o a ser aplicada:"), h("ez-text-area", { label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_e = this._filterAssistent) === null || _e === void 0 ? void 0 : _e.expression, onEzChange: (evt) => this.handleExpressionChange(evt.detail) }), this.getWarningMessageComponent())))))));
185
+ }
186
+ static get watchers() { return {
187
+ "filterId": ["loadFilter"]
188
+ }; }
189
+ static get style() { return snkPersonalizedFilterCss; }
190
+ }, [2, "snk-personalized-filter", {
191
+ "messagesBuilder": [1040],
192
+ "entityUri": [1025, "entity-uri"],
193
+ "filterId": [1025, "filter-id"],
194
+ "configName": [1025, "config-name"],
195
+ "_filterAssistentMode": [32],
196
+ "_filterAssistent": [32],
197
+ "createPersonalizedFilter": [64]
198
+ }]);
199
+ function defineCustomElement() {
200
+ if (typeof customElements === "undefined") {
201
+ return;
202
+ }
203
+ const components = ["snk-personalized-filter", "snk-expression-group", "snk-expression-item", "snk-filter-field-search", "snk-filter-param-config", "snk-simple-bar"];
204
+ components.forEach(tagName => { switch (tagName) {
205
+ case "snk-personalized-filter":
206
+ if (!customElements.get(tagName)) {
207
+ customElements.define(tagName, SnkPersonalizedFilter);
208
+ }
209
+ break;
210
+ case "snk-expression-group":
211
+ if (!customElements.get(tagName)) {
212
+ defineCustomElement$5();
213
+ }
214
+ break;
215
+ case "snk-expression-item":
216
+ if (!customElements.get(tagName)) {
217
+ defineCustomElement$4();
218
+ }
219
+ break;
220
+ case "snk-filter-field-search":
221
+ if (!customElements.get(tagName)) {
222
+ defineCustomElement$3();
223
+ }
224
+ break;
225
+ case "snk-filter-param-config":
226
+ if (!customElements.get(tagName)) {
227
+ defineCustomElement$2();
228
+ }
229
+ break;
230
+ case "snk-simple-bar":
231
+ if (!customElements.get(tagName)) {
232
+ defineCustomElement$1();
233
+ }
234
+ break;
235
+ } });
236
+ }
237
+
238
+ export { SnkPersonalizedFilter as S, defineCustomElement as d };
@@ -0,0 +1,300 @@
1
+ import { ApplicationContext } from '@sankhyalabs/core';
2
+ import { F as FormConfigFetcher } from './form-config-fetcher-cac8cd96.js';
3
+ import { R as ResourceFetcher } from './resource-fetcher-02642924.js';
4
+ import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher-bd2070a3.js';
5
+ import { d as dist, D as DataFetcher } from './DataFetcher-b3d8b2d5.js';
6
+
7
+ class GridConfigFetcher extends ResourceFetcher {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.GRID_CONFIG_VERSION = "V3:";
11
+ }
12
+ getConfig(gridName, resourceID) {
13
+ const completePath = this.getPath(resourceID, gridName);
14
+ return new Promise((resolve, reject) => {
15
+ this.loadResource(completePath)
16
+ .then(loadedResource => {
17
+ let config = undefined;
18
+ if (loadedResource) {
19
+ config = JSON.parse(loadedResource);
20
+ }
21
+ resolve(config);
22
+ }).catch((error) => {
23
+ reject(error);
24
+ });
25
+ });
26
+ }
27
+ saveConfig(config, gridName, resourceID) {
28
+ const completePath = this.getPath(resourceID, gridName);
29
+ return new Promise((resolve, reject) => {
30
+ this.saveResource(config, completePath)
31
+ .then((resp) => {
32
+ resolve(JSON.parse(resp.resource));
33
+ })
34
+ .catch((error) => {
35
+ reject(error);
36
+ });
37
+ });
38
+ }
39
+ getPath(resourceID, name) {
40
+ if (name) {
41
+ return `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}/${name}`;
42
+ }
43
+ return `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
44
+ }
45
+ }
46
+
47
+ class PersonalizedFilterFetcher {
48
+ constructor() {
49
+ this.templateByQuery = new Map();
50
+ this.buildTemplates();
51
+ }
52
+ resolveURI(resourceID, configName) {
53
+ let uri = "filter-assistent-config://" + resourceID;
54
+ if (configName) {
55
+ uri += "." + configName;
56
+ }
57
+ return uri;
58
+ }
59
+ buildTemplates() {
60
+ this.templateByQuery.set("fetchFilterFields", dist.gql `
61
+ query($name: String!) {
62
+ $queryAlias$: fetchFilterFields(name: $name){
63
+ currentLink {
64
+ description
65
+ uri
66
+ }
67
+ links {
68
+ description
69
+ uri
70
+ fieldCount
71
+ }
72
+ fields {
73
+ name
74
+ description
75
+ uri
76
+ onlyDate
77
+ dataType
78
+ userInterface
79
+ entityName
80
+ properties {
81
+ name
82
+ value
83
+ }
84
+ }
85
+ }
86
+ }
87
+ `);
88
+ this.templateByQuery.set("fetchFilterAssistent", dist.gql `
89
+ query($name: String!) {
90
+ $queryAlias$: fetchFilterAssistent(name: $name) {
91
+ id
92
+ name
93
+ active
94
+ expression
95
+ warningMessage
96
+ parameters {
97
+ entityName
98
+ fieldName
99
+ dataType
100
+ description
101
+ userInterface
102
+ label
103
+ searchContext {
104
+ entity
105
+ entityDescription
106
+ searchOptions {
107
+ rootEntity
108
+ descriptionFieldName
109
+ codeFieldName
110
+ showInactives
111
+ }
112
+ }
113
+ }
114
+ assistent
115
+ }
116
+ }`);
117
+ this.templateByQuery.set("savePersonalizedFilter", dist.gql `
118
+ mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
119
+ $queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
120
+ id
121
+ name
122
+ }
123
+ }`);
124
+ this.templateByQuery.set("deletePersonalizedFilter", dist.gql `
125
+ mutation($name: String!, $filterId: String!) {
126
+ $queryAlias$: deletePersonalizedFilter(name: $name, filterId: $filterId) {
127
+ id
128
+ name
129
+ }
130
+ }`);
131
+ }
132
+ async loadPersonalizedFilter(resourceID, filterID, configName) {
133
+ return new Promise((resolve, reject) => {
134
+ DataFetcher.get()
135
+ .callGraphQL({
136
+ values: { name: this.resolveURI(resourceID, configName) + "/" + filterID },
137
+ query: this.templateByQuery.get("fetchFilterAssistent"),
138
+ })
139
+ .then((resp) => {
140
+ resp.assistent = JSON.parse(resp.assistent);
141
+ resolve(resp);
142
+ })
143
+ .catch((error) => {
144
+ reject(error);
145
+ });
146
+ });
147
+ }
148
+ async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
149
+ let personalizedFilterParsed = JSON.parse(JSON.stringify(personalizedFilter));
150
+ personalizedFilterParsed.assistent = JSON.stringify(personalizedFilterParsed.assistent);
151
+ return new Promise((resolve, reject) => {
152
+ DataFetcher.get()
153
+ .callGraphQL({
154
+ values: { name: this.resolveURI(resourceID, configName), filterAssistent: personalizedFilterParsed },
155
+ query: this.templateByQuery.get("savePersonalizedFilter"),
156
+ })
157
+ .then((resp) => {
158
+ resolve(resp);
159
+ })
160
+ .catch((error) => {
161
+ reject(error);
162
+ });
163
+ });
164
+ }
165
+ async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
166
+ return new Promise((resolve, reject) => {
167
+ DataFetcher.get()
168
+ .callGraphQL({
169
+ values: { name: this.resolveURI(resourceID, configName), filterId: personalizedFilter.id },
170
+ query: this.templateByQuery.get("deletePersonalizedFilter"),
171
+ })
172
+ .then((resp) => {
173
+ resolve(resp);
174
+ })
175
+ .catch((error) => {
176
+ reject(error);
177
+ });
178
+ });
179
+ }
180
+ loadFields(uri) {
181
+ return new Promise((resolve, reject) => {
182
+ DataFetcher.get()
183
+ .callGraphQL({
184
+ values: { name: uri },
185
+ query: this.templateByQuery.get("fetchFilterFields"),
186
+ })
187
+ .then((resp) => {
188
+ var _a;
189
+ let fields = resp.fields;
190
+ for (const field of fields) {
191
+ if (Array.isArray(field.properties) && field.properties.length > 0) {
192
+ const propertiesConvertedObject = field.properties.reduce((accumulator, prop) => {
193
+ accumulator[prop.name] = prop.value;
194
+ return accumulator;
195
+ }, {});
196
+ field.properties = propertiesConvertedObject;
197
+ }
198
+ if ((_a = field === null || field === void 0 ? void 0 : field.properties) === null || _a === void 0 ? void 0 : _a.options) {
199
+ field.properties.options = JSON.parse(field.properties.options);
200
+ }
201
+ }
202
+ resolve(Object.assign(Object.assign({}, resp), { fields: fields }));
203
+ })
204
+ .catch((error) => {
205
+ reject(error);
206
+ });
207
+ });
208
+ }
209
+ }
210
+
211
+ const CONFIG_SOURCE = {
212
+ form: "form",
213
+ grid: "grid",
214
+ filterBar: "filterBar"
215
+ };
216
+ class ConfigStorage {
217
+ static async get() {
218
+ if (!ConfigStorage.instance) {
219
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
220
+ if (application != undefined) {
221
+ const configName = application.configName;
222
+ const resourceID = await application.getResourceID();
223
+ ConfigStorage.instance = new ConfigStorage();
224
+ ConfigStorage.resourceID = resourceID;
225
+ ConfigStorage.instance.loadFilterBarConfig(configName);
226
+ ConfigStorage.instance.loadFormConfig(configName);
227
+ ConfigStorage.instance.loadGridConfig(configName);
228
+ }
229
+ }
230
+ return this.instance;
231
+ }
232
+ async loadFilterBarConfig(name) {
233
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
234
+ if (!ConfigStorage.configById.has(cacheID)) {
235
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name));
236
+ }
237
+ return ConfigStorage.configById.get(cacheID);
238
+ }
239
+ async loadFormConfig(name) {
240
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
241
+ if (!ConfigStorage.configById.has(cacheID)) {
242
+ ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
243
+ }
244
+ return ConfigStorage.configById.get(cacheID);
245
+ }
246
+ async loadGridConfig(name) {
247
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
248
+ if (!ConfigStorage.configById.has(cacheID)) {
249
+ ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
250
+ }
251
+ return ConfigStorage.configById.get(cacheID);
252
+ }
253
+ static async saveFilterBarConfig(config, name) {
254
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
255
+ this.configById.delete(cacheID);
256
+ return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
257
+ }
258
+ static async saveFormConfig(config, name) {
259
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
260
+ this.configById.delete(cacheID);
261
+ return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
262
+ }
263
+ static async saveCardState(config, name) {
264
+ return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
265
+ }
266
+ static async saveGridConfig(config, name) {
267
+ if (config == undefined) {
268
+ return;
269
+ }
270
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
271
+ this.configById.delete(cacheID);
272
+ return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
273
+ }
274
+ static async loadPersonalizedFilter(filterId, configName) {
275
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
276
+ }
277
+ static async savePersonalizedFilter(personalizedFilter, configName) {
278
+ //Ao criar ou alterar um filtro personalizado,
279
+ //precisamos remover o cache do status da filterbar.
280
+ const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
281
+ this.configById.delete(cacheID);
282
+ return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
283
+ }
284
+ static async removePersonalizedFilter(personalizedFilter, configName) {
285
+ return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
286
+ }
287
+ static buildCacheID(name, source) {
288
+ if (name == undefined) {
289
+ return `req_${source}_${this.resourceID}`;
290
+ }
291
+ return `req_${source}_${name}_${this.resourceID}`;
292
+ }
293
+ }
294
+ ConfigStorage.configById = new Map();
295
+ ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
296
+ ConfigStorage.formConfigFetcher = new FormConfigFetcher();
297
+ ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
298
+ ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
299
+
300
+ export { ConfigStorage as C, GridConfigFetcher as G, PersonalizedFilterFetcher as P };
@@ -0,0 +1,7 @@
1
+ var FilterGroupCondition;
2
+ (function (FilterGroupCondition) {
3
+ FilterGroupCondition["AND"] = "AND";
4
+ FilterGroupCondition["OR"] = "OR";
5
+ })(FilterGroupCondition || (FilterGroupCondition = {}));
6
+
7
+ export { FilterGroupCondition as F };