@sankhyalabs/sankhyablocks 8.16.0-dev.9 → 8.16.0-dev.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. package/dist/cjs/{IExporterProvider-597949f9.js → ClientSideExporterProvider-6b781452.js} +136 -24
  2. package/dist/cjs/{ConfigStorage-a343e418.js → ConfigStorage-d024aec8.js} +2 -2
  3. package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-65879b2c.js} +216 -76
  4. package/dist/cjs/{RecordIDUtils-3735135c.js → GetSelectedRecordsIDsInfo-bd50caf1.js} +10 -10
  5. package/dist/cjs/IFetchDataExporterParams-e78ec415.js +8 -0
  6. package/dist/cjs/{SnkFormConfigManager-166cbd1f.js → SnkFormConfigManager-c11d8468.js} +75 -17
  7. package/dist/cjs/{SnkMessageBuilder-897ffd08.js → SnkMessageBuilder-bae64d0d.js} +6 -2
  8. package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-8480751c.js} +1 -1
  9. package/dist/cjs/{constants-35ddd366.js → constants-241934b3.js} +9 -0
  10. package/dist/cjs/{dataunit-fetcher-688d3f05.js → dataunit-fetcher-8291ac21.js} +239 -43
  11. package/dist/cjs/{field-search-f56aa7d6.js → field-search-68e34bf4.js} +5 -1
  12. package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-90126e4c.js} +42 -2
  13. package/dist/cjs/{index-1dfc7a6e.js → index-e3e39724.js} +5 -0
  14. package/dist/cjs/index-f9e81701.js +16 -32
  15. package/dist/cjs/loader.cjs.js +1 -1
  16. package/dist/cjs/pesquisa-fetcher-5c583c93.js +365 -0
  17. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +156 -0
  18. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  19. package/dist/cjs/{snk-actions-button_4.cjs.entry.js → snk-actions-button_5.cjs.entry.js} +139 -43
  20. package/dist/cjs/snk-application.cjs.entry.js +301 -70
  21. package/dist/cjs/snk-attach.cjs.entry.js +49 -36
  22. package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +399 -13
  23. package/dist/cjs/snk-configurator.cjs.entry.js +2 -2
  24. package/dist/cjs/snk-crud.cjs.entry.js +26 -22
  25. package/dist/cjs/snk-data-exporter.cjs.entry.js +38 -29
  26. package/dist/cjs/{snk-data-unit-8fa7917a.js → snk-data-unit-c8096724.js} +55 -31
  27. package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
  28. package/dist/cjs/snk-detail-view.cjs.entry.js +15 -15
  29. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  30. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  31. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +1437 -0
  32. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  34. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  35. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -1
  37. package/dist/cjs/snk-grid.cjs.entry.js +96 -27
  38. package/dist/cjs/{snk-guides-viewer-bdc41281.js → snk-guides-viewer-a029ff50.js} +32 -16
  39. package/dist/cjs/snk-guides-viewer.cjs.entry.js +11 -11
  40. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +4 -4
  41. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  42. package/dist/cjs/snk-pesquisa.cjs.entry.js +111 -31
  43. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  44. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  45. package/dist/cjs/snk-simple-crud.cjs.entry.js +115 -112
  46. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  47. package/dist/cjs/snk-taskbar.cjs.entry.js +72 -40
  48. package/dist/cjs/{taskbar-elements-9ad1f9c0.js → taskbar-elements-7e19882d.js} +1 -1
  49. package/dist/collection/collection-manifest.json +14 -31
  50. package/dist/collection/components/snk-actions-button/actions/index.js +16 -13
  51. package/dist/collection/components/snk-actions-button/interfaces/index.js +1 -0
  52. package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
  53. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +29 -0
  54. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  55. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  56. package/dist/collection/components/snk-application/snk-application.css +36 -0
  57. package/dist/collection/components/snk-application/snk-application.js +323 -65
  58. package/dist/collection/components/snk-attach/snk-attach.js +25 -16
  59. package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
  60. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +2 -4
  61. package/dist/collection/components/snk-configurator/snk-configurator.css +1 -1
  62. package/dist/collection/components/snk-crud/snk-crud.js +147 -14
  63. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +3 -3
  64. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +6 -6
  65. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +72 -6
  66. package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
  67. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +8 -8
  68. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +9 -2
  69. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -1
  70. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +18 -6
  71. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +1 -1
  72. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +10 -9
  73. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
  74. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +4 -4
  75. package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +1 -1
  76. package/dist/collection/components/snk-data-unit/snk-data-unit.js +53 -29
  77. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +3 -3
  78. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +1 -1
  79. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +1 -1
  80. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +1 -1
  81. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +2 -1
  82. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.css +13 -0
  83. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +3 -3
  84. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.js +8 -0
  85. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +9 -4
  86. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +1 -1
  87. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +3 -1
  88. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -6
  89. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +119 -29
  90. package/dist/collection/components/snk-form/snk-form.js +2 -2
  91. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +73 -15
  92. package/dist/collection/components/snk-form-config/snk-form-config.css +8 -3
  93. package/dist/collection/components/snk-form-config/snk-form-config.js +49 -8
  94. package/dist/collection/components/snk-grid/snk-grid.css +8 -0
  95. package/dist/collection/components/snk-grid/snk-grid.js +199 -13
  96. package/dist/collection/components/snk-grid-config/snk-grid-config.css +1 -1
  97. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.css +9 -0
  98. package/dist/collection/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.js +226 -0
  99. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.css +28 -0
  100. package/dist/collection/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.js +208 -0
  101. package/dist/collection/components/snk-pesquisa/pesquisaHelper.js +99 -0
  102. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +35 -6
  103. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +174 -32
  104. package/dist/collection/components/snk-print-selector/snk-print-selector.js +1 -1
  105. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +1 -1
  106. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +1 -1
  107. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +180 -34
  108. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.css +22 -0
  109. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.js +181 -0
  110. package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +5 -1
  111. package/dist/collection/components/snk-taskbar/snk-taskbar.js +112 -38
  112. package/dist/collection/lib/@types/index.js +5 -0
  113. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +3 -3
  114. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -4
  115. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +34 -9
  116. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +29 -21
  117. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
  118. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +59 -14
  119. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +21 -7
  120. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.js +108 -0
  121. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +17 -9
  122. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.js +6 -1
  123. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +45 -5
  124. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +7 -1
  125. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +107 -7
  126. package/dist/collection/lib/index.js +1 -0
  127. package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
  128. package/dist/collection/lib/message/resources/snk-grid.msg.js +5 -1
  129. package/dist/collection/lib/utils/ContinuousInsertUtils.js +31 -0
  130. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  131. package/dist/collection/{components/snk-data-exporter/utils/RecordIDUtils.js → lib/utils/GetSelectedRecordsIDsInfo.js} +9 -9
  132. package/dist/collection/lib/utils/constants.js +9 -0
  133. package/dist/collection/sw.js +46 -0
  134. package/dist/components/{IExporterProvider.js → ContinuousInsertUtils.js} +136 -24
  135. package/dist/components/DataFetcher.js +217 -77
  136. package/dist/{esm/RecordIDUtils-87d02110.js → components/GetSelectedRecordsIDsInfo.js} +10 -10
  137. package/dist/components/ISave.js +367 -1
  138. package/dist/components/SnkFormConfigManager.js +73 -15
  139. package/dist/components/SnkMessageBuilder.js +6 -2
  140. package/dist/components/constants.js +10 -1
  141. package/dist/components/dataunit-fetcher.js +238 -40
  142. package/dist/components/form-config-fetcher.js +41 -1
  143. package/dist/components/index.d.ts +3 -0
  144. package/dist/components/index.js +3 -0
  145. package/dist/components/pesquisa-grid.d.ts +11 -0
  146. package/dist/components/pesquisa-grid.js +6 -0
  147. package/dist/components/pesquisa-grid2.js +102 -0
  148. package/dist/components/pesquisa-tree.d.ts +11 -0
  149. package/dist/components/pesquisa-tree.js +6 -0
  150. package/dist/components/pesquisa-tree2.js +91 -0
  151. package/dist/components/snk-actions-button2.js +44 -40
  152. package/dist/components/snk-application2.js +320 -69
  153. package/dist/components/snk-attach2.js +54 -60
  154. package/dist/components/snk-config-options2.js +1 -1
  155. package/dist/components/snk-configurator2.js +1 -1
  156. package/dist/components/snk-crud.js +86 -71
  157. package/dist/components/snk-data-exporter2.js +37 -23
  158. package/dist/components/snk-data-unit2.js +56 -69
  159. package/dist/components/snk-detail-view2.js +115 -106
  160. package/dist/components/snk-exporter-email-sender2.js +1 -1
  161. package/dist/components/snk-filter-bar2.js +68 -34
  162. package/dist/components/snk-filter-binary-select.js +1 -1
  163. package/dist/components/snk-filter-checkbox-list.js +1 -1
  164. package/dist/components/snk-filter-item2.js +9 -4
  165. package/dist/components/snk-filter-modal.js +4 -2
  166. package/dist/components/snk-filter-number.js +1 -1
  167. package/dist/components/snk-filter-text.js +2 -1
  168. package/dist/components/snk-form-config2.js +35 -10
  169. package/dist/components/snk-form.js +2 -2
  170. package/dist/components/snk-grid-config2.js +1 -1
  171. package/dist/components/snk-grid2.js +92 -18
  172. package/dist/components/snk-personalized-filter-editor.js +4 -4
  173. package/dist/components/snk-pesquisa2.js +125 -33
  174. package/dist/components/snk-print-selector.js +1 -1
  175. package/dist/components/snk-simple-bar2.js +1 -1
  176. package/dist/components/snk-simple-crud2.js +107 -120
  177. package/dist/components/snk-simple-form-config.d.ts +11 -0
  178. package/dist/components/snk-simple-form-config.js +6 -0
  179. package/dist/components/snk-simple-form-config2.js +121 -0
  180. package/dist/components/snk-tab-config2.js +1 -1
  181. package/dist/components/snk-taskbar2.js +72 -40
  182. package/dist/components/teste-pesquisa.js +13 -1
  183. package/dist/esm/{IExporterProvider-63a188b6.js → ClientSideExporterProvider-ff89c7e9.js} +136 -26
  184. package/dist/esm/{ConfigStorage-3806514e.js → ConfigStorage-373bb440.js} +2 -2
  185. package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-5221b992.js} +217 -77
  186. package/dist/esm/GetSelectedRecordsIDsInfo-9fa41508.js +41 -0
  187. package/dist/esm/IFetchDataExporterParams-d73bed3d.js +8 -0
  188. package/dist/esm/{SnkFormConfigManager-31b24066.js → SnkFormConfigManager-5022f87f.js} +75 -17
  189. package/dist/esm/{SnkMessageBuilder-571462fb.js → SnkMessageBuilder-6fff4a4c.js} +6 -2
  190. package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-e32fe8a4.js} +1 -1
  191. package/dist/esm/{constants-8457af36.js → constants-75abb876.js} +10 -1
  192. package/dist/esm/{dataunit-fetcher-264191b2.js → dataunit-fetcher-5247a708.js} +239 -41
  193. package/dist/esm/{field-search-efbe307f.js → field-search-f8b1d91e.js} +5 -1
  194. package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-126e2471.js} +42 -2
  195. package/dist/esm/index-a7d3d3f1.js +16 -32
  196. package/dist/esm/{index-3aa4977a.js → index-b40568ff.js} +6 -1
  197. package/dist/esm/loader.js +1 -1
  198. package/dist/esm/pesquisa-fetcher-4284f2a3.js +362 -0
  199. package/dist/esm/pesquisa-grid_2.entry.js +151 -0
  200. package/dist/esm/sankhyablocks.js +1 -1
  201. package/dist/esm/{snk-actions-button_4.entry.js → snk-actions-button_5.entry.js} +140 -45
  202. package/dist/esm/snk-application.entry.js +303 -72
  203. package/dist/esm/snk-attach.entry.js +49 -36
  204. package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +399 -15
  205. package/dist/esm/snk-configurator.entry.js +2 -2
  206. package/dist/esm/snk-crud.entry.js +26 -22
  207. package/dist/esm/snk-data-exporter.entry.js +38 -29
  208. package/dist/esm/{snk-data-unit-f5cbe64b.js → snk-data-unit-51659955.js} +55 -31
  209. package/dist/esm/snk-data-unit.entry.js +5 -5
  210. package/dist/esm/snk-detail-view.entry.js +15 -15
  211. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  212. package/dist/esm/snk-field-config.entry.js +1 -1
  213. package/dist/esm/snk-filter-bar_4.entry.js +1430 -0
  214. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  215. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  216. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  217. package/dist/esm/snk-filter-number.entry.js +1 -1
  218. package/dist/esm/snk-filter-text.entry.js +2 -1
  219. package/dist/esm/snk-grid.entry.js +91 -22
  220. package/dist/esm/{snk-guides-viewer-dda0fede.js → snk-guides-viewer-fa45714d.js} +32 -16
  221. package/dist/esm/snk-guides-viewer.entry.js +11 -11
  222. package/dist/esm/snk-personalized-filter-editor.entry.js +4 -4
  223. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  224. package/dist/esm/snk-pesquisa.entry.js +111 -31
  225. package/dist/esm/snk-print-selector.entry.js +1 -1
  226. package/dist/esm/snk-simple-bar.entry.js +1 -1
  227. package/dist/esm/snk-simple-crud.entry.js +101 -98
  228. package/dist/esm/snk-tab-config.entry.js +1 -1
  229. package/dist/esm/snk-taskbar.entry.js +73 -41
  230. package/dist/esm/{taskbar-elements-d59867f1.js → taskbar-elements-d2353c64.js} +1 -1
  231. package/dist/sankhyablocks/p-0b00d69c.entry.js +1 -0
  232. package/dist/sankhyablocks/p-0ce56d43.entry.js +1 -0
  233. package/dist/sankhyablocks/p-0f3698af.js +1 -0
  234. package/dist/sankhyablocks/p-1435701f.js +26 -0
  235. package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
  236. package/dist/sankhyablocks/p-172848d4.entry.js +1 -0
  237. package/dist/sankhyablocks/p-17425c72.js +1 -0
  238. package/dist/sankhyablocks/{p-52920496.js → p-19dc71e9.js} +1 -1
  239. package/dist/sankhyablocks/{p-47db7e88.entry.js → p-1cf39cfd.entry.js} +1 -1
  240. package/dist/sankhyablocks/{p-b0ef4383.js → p-1d19a5b0.js} +1 -1
  241. package/dist/sankhyablocks/p-23736d75.js +1 -0
  242. package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-23cd6abf.entry.js} +1 -1
  243. package/dist/sankhyablocks/{p-95df461f.entry.js → p-2953c481.entry.js} +1 -1
  244. package/dist/sankhyablocks/p-38179225.js +60 -0
  245. package/dist/sankhyablocks/p-3ba431c9.js +1 -0
  246. package/dist/sankhyablocks/{p-7e7a7473.js → p-3fc82614.js} +1 -1
  247. package/dist/sankhyablocks/p-40e323f9.js +1 -0
  248. package/dist/sankhyablocks/p-41c3bee5.js +6 -0
  249. package/dist/sankhyablocks/{p-72fc257b.entry.js → p-434817f0.entry.js} +1 -1
  250. package/dist/sankhyablocks/p-47178038.entry.js +1 -0
  251. package/dist/sankhyablocks/{p-7663f597.entry.js → p-4c9adf1c.entry.js} +1 -1
  252. package/dist/sankhyablocks/{p-aaa3ee68.entry.js → p-5f157b09.entry.js} +1 -1
  253. package/dist/sankhyablocks/p-700a4cc3.entry.js +1 -0
  254. package/dist/sankhyablocks/p-79f823f3.entry.js +1 -0
  255. package/dist/sankhyablocks/p-7dd49d15.js +1 -0
  256. package/dist/sankhyablocks/p-82839c9f.js +1 -0
  257. package/dist/sankhyablocks/{p-2c68b3ae.entry.js → p-82ee6dc3.entry.js} +1 -1
  258. package/dist/sankhyablocks/p-89c92727.entry.js +1 -0
  259. package/dist/sankhyablocks/{p-41f8bfa3.entry.js → p-8c235d4c.entry.js} +1 -1
  260. package/dist/sankhyablocks/p-8f3f2306.js +1 -0
  261. package/dist/sankhyablocks/p-a962a3e4.entry.js +1 -0
  262. package/dist/sankhyablocks/p-aa1a0f3e.entry.js +1 -0
  263. package/dist/sankhyablocks/p-b02e58fd.entry.js +1 -0
  264. package/dist/sankhyablocks/p-b0ff53b7.entry.js +1 -0
  265. package/dist/sankhyablocks/p-bee2a6d3.entry.js +1 -0
  266. package/dist/sankhyablocks/p-c021a3a9.entry.js +1 -0
  267. package/dist/sankhyablocks/p-c2e468c9.entry.js +1 -0
  268. package/dist/sankhyablocks/p-c82deea7.entry.js +1 -0
  269. package/dist/sankhyablocks/p-d2d0535f.entry.js +1 -0
  270. package/dist/sankhyablocks/p-d62228fb.js +1 -0
  271. package/dist/sankhyablocks/p-de9da2f2.js +1 -0
  272. package/dist/sankhyablocks/p-e0a6d819.entry.js +1 -0
  273. package/dist/sankhyablocks/p-e10faff0.entry.js +11 -0
  274. package/dist/sankhyablocks/p-e718fb81.entry.js +1 -0
  275. package/dist/sankhyablocks/{p-913a9979.js → p-f0b9303b.js} +1 -1
  276. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  277. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -0
  278. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
  279. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
  280. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  281. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  282. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  283. package/dist/types/components/snk-application/snk-application.d.ts +38 -14
  284. package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
  285. package/dist/types/components/snk-crud/snk-crud.d.ts +26 -0
  286. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +15 -0
  287. package/dist/types/components/snk-data-exporter/data/export-result.d.ts +2 -1
  288. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +1 -0
  289. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +2 -1
  290. package/dist/types/components/snk-data-exporter/interfaces/IRecordID.d.ts +1 -0
  291. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +3 -1
  292. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +3 -3
  293. package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +1 -1
  294. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +2 -0
  295. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type-mask.enum.d.ts +7 -0
  296. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
  297. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +15 -1
  298. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +7 -2
  299. package/dist/types/components/snk-form-config/snk-form-config.d.ts +4 -0
  300. package/dist/types/components/snk-grid/snk-grid.d.ts +33 -0
  301. package/dist/types/components/snk-pesquisa/pesquisa-grid/pesquisa-grid.d.ts +44 -0
  302. package/dist/types/components/snk-pesquisa/pesquisa-tree/pesquisa-tree.d.ts +33 -0
  303. package/dist/types/components/snk-pesquisa/pesquisaHelper.d.ts +24 -0
  304. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +35 -1
  305. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +27 -3
  306. package/dist/types/components/snk-simple-form-config/snk-simple-form-config.d.ts +34 -0
  307. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +1 -0
  308. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  309. package/dist/types/components.d.ts +407 -15
  310. package/dist/types/lib/@types/index.d.ts +4 -0
  311. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +12 -2
  312. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  313. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
  314. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +9 -1
  315. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +4 -0
  316. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/helpers/DataUnitDataLoaderHelper.d.ts +6 -0
  317. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/ILoadingInfo.d.ts +4 -0
  318. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +3 -3
  319. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +6 -2
  320. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +8 -2
  321. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
  322. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +17 -1
  323. package/dist/types/lib/index.d.ts +1 -0
  324. package/dist/types/lib/utils/ContinuousInsertUtils.d.ts +10 -0
  325. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  326. package/dist/types/lib/utils/GetSelectedRecordsIDsInfo.d.ts +3 -0
  327. package/dist/types/lib/utils/constants.d.ts +7 -0
  328. package/package.json +4 -3
  329. package/react/components.d.ts +3 -0
  330. package/react/components.js +3 -0
  331. package/react/components.js.map +1 -1
  332. package/dist/cjs/pesquisa-fetcher-680e198f.js +0 -166
  333. package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
  334. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -714
  335. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
  336. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
  337. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
  338. package/dist/cjs/snk-form.cjs.entry.js +0 -143
  339. package/dist/components/pesquisa-fetcher.js +0 -164
  340. package/dist/esm/pesquisa-fetcher-03c8f919.js +0 -164
  341. package/dist/esm/snk-config-options.entry.js +0 -235
  342. package/dist/esm/snk-filter-bar.entry.js +0 -710
  343. package/dist/esm/snk-filter-item.entry.js +0 -308
  344. package/dist/esm/snk-filter-list.entry.js +0 -148
  345. package/dist/esm/snk-filter-modal.entry.js +0 -245
  346. package/dist/esm/snk-form.entry.js +0 -139
  347. package/dist/sankhyablocks/p-01ba23cd.entry.js +0 -1
  348. package/dist/sankhyablocks/p-17def7cd.js +0 -1
  349. package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
  350. package/dist/sankhyablocks/p-2a408684.js +0 -1
  351. package/dist/sankhyablocks/p-30cf616e.js +0 -1
  352. package/dist/sankhyablocks/p-3a212712.js +0 -1
  353. package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
  354. package/dist/sankhyablocks/p-450c60e4.entry.js +0 -1
  355. package/dist/sankhyablocks/p-4e5e1313.entry.js +0 -1
  356. package/dist/sankhyablocks/p-62ba211a.entry.js +0 -1
  357. package/dist/sankhyablocks/p-6bb2f3e9.entry.js +0 -1
  358. package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
  359. package/dist/sankhyablocks/p-7505da04.entry.js +0 -1
  360. package/dist/sankhyablocks/p-75e674ed.entry.js +0 -1
  361. package/dist/sankhyablocks/p-7619bdb1.entry.js +0 -11
  362. package/dist/sankhyablocks/p-7a85fd49.entry.js +0 -1
  363. package/dist/sankhyablocks/p-7ef9c55c.js +0 -1
  364. package/dist/sankhyablocks/p-80042dc6.entry.js +0 -1
  365. package/dist/sankhyablocks/p-871aa14e.entry.js +0 -1
  366. package/dist/sankhyablocks/p-88aa931b.entry.js +0 -1
  367. package/dist/sankhyablocks/p-8c59edd7.entry.js +0 -1
  368. package/dist/sankhyablocks/p-96a89d58.entry.js +0 -1
  369. package/dist/sankhyablocks/p-9863d682.js +0 -1
  370. package/dist/sankhyablocks/p-af8efd95.js +0 -6
  371. package/dist/sankhyablocks/p-b05d8893.entry.js +0 -1
  372. package/dist/sankhyablocks/p-b11aa1e0.entry.js +0 -1
  373. package/dist/sankhyablocks/p-c2495304.js +0 -1
  374. package/dist/sankhyablocks/p-d1791da2.entry.js +0 -1
  375. package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
  376. package/dist/sankhyablocks/p-d6e26ea8.entry.js +0 -1
  377. package/dist/sankhyablocks/p-dc7c9047.js +0 -1
  378. package/dist/sankhyablocks/p-df5451c7.js +0 -26
  379. package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
  380. package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
  381. package/dist/sankhyablocks/p-fa4d8cb4.js +0 -1
  382. package/dist/sankhyablocks/p-fe79f83a.js +0 -60
  383. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +0 -3
@@ -29,12 +29,16 @@ export default class TaskbarProcessor {
29
29
  });
30
30
  }
31
31
  getButtonsArray(taskbarId, taskbarManager, dataState) {
32
- const defaults = this._defaultButtons[taskbarId];
32
+ const defaults = this.getButtonsFromKey(taskbarId);
33
33
  if (taskbarManager) {
34
34
  return taskbarManager.getButtons(taskbarId, dataState, [...defaults]);
35
35
  }
36
36
  return defaults;
37
37
  }
38
+ getButtonsFromKey(taskbarId) {
39
+ const btnsValue = this._defaultButtons[taskbarId];
40
+ return typeof btnsValue === 'function' ? btnsValue() : btnsValue;
41
+ }
38
42
  isEnabled(taskbarId, taskbarManager, buttonName, dataState, disabled) {
39
43
  const originalValue = disabled.includes(buttonName) ? false : true;
40
44
  if (taskbarManager && taskbarManager.isEnabled) {
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME } from '@sankhyalabs/core';
1
+ import { ApplicationContext, ElementIDUtils, OverflowDirection, OverflowWatcher, StringUtils, OVERFLOWED_CLASS_NAME, LockManager, LockManagerOperation, SilentException } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
3
  import { AuthorizationConfig } from '../snk-configurator/AuthorizationConfig';
4
4
  import { AuthorizationElements, buildCustomButton, buildElem, TaskbarElement, VisibleWhenForbidden, } from './elements/taskbar-elements';
@@ -29,8 +29,10 @@ export class SnkTaskbar {
29
29
  this.onSaveEvent = (action) => {
30
30
  switch (action.type) {
31
31
  case DUAction.FIELD_INVALIDATED:
32
+ case DUAction.INVALIDATE_CLEAN:
32
33
  case DUAction.DATA_SAVED:
33
34
  case DUAction.SAVING_ERROR:
35
+ case DUAction.SAVING_CANCELED:
34
36
  this._isWaitingForSave = false;
35
37
  break;
36
38
  case DUAction.SAVING_DATA:
@@ -67,6 +69,16 @@ export class SnkTaskbar {
67
69
  this.getCustomElements(true);
68
70
  }
69
71
  }
72
+ handleTaskbarSaveLocker() {
73
+ if (this._isWaitingForSave !== true) {
74
+ this._isWaitingForSave = true;
75
+ }
76
+ }
77
+ handleTaskbarSaveUnlocker() {
78
+ if (this._isWaitingForSave === true) {
79
+ this._isWaitingForSave = false;
80
+ }
81
+ }
70
82
  hasToSearchCustomElements(event) {
71
83
  return this.customSlotId === event.detail && !this._slotContainer;
72
84
  }
@@ -85,6 +97,14 @@ export class SnkTaskbar {
85
97
  this._hasToUpdateOverFlow = true;
86
98
  }
87
99
  }
100
+ observeIsWaitingForSave(newValue, oldValue) {
101
+ if (newValue == true && oldValue == false) {
102
+ this.taskbarSaveLocker.emit();
103
+ }
104
+ if (newValue == false && oldValue == true) {
105
+ this.taskbarSaveUnlocker.emit();
106
+ }
107
+ }
88
108
  // Internal methods
89
109
  elementsFromString(strButtons) {
90
110
  const elements = [];
@@ -129,42 +149,50 @@ export class SnkTaskbar {
129
149
  return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
130
150
  }
131
151
  elementClick(elem) {
132
- if (this.dataUnit) {
133
- switch (elem) {
134
- case TaskbarElement.PREVIOUS:
135
- this.dataUnit.previousRecord();
136
- break;
137
- case TaskbarElement.NEXT:
138
- this.dataUnit.nextRecord();
139
- break;
140
- case TaskbarElement.REFRESH:
141
- this.dataUnit.loadData();
142
- break;
143
- case TaskbarElement.CLONE:
144
- this.dataUnit.copySelected();
145
- break;
146
- case TaskbarElement.REMOVE:
147
- this.dataUnit.removeSelectedRecords();
148
- break;
149
- case TaskbarElement.INSERT:
150
- this.dataUnit.addRecord();
151
- break;
152
- case TaskbarElement.CANCEL:
153
- this.dataUnit.cancelEdition();
154
- break;
155
- case TaskbarElement.SAVE:
156
- if (!this._isWaitingForSave) {
157
- this._isWaitingForSave = true;
158
- this.dataUnit.saveData()
159
- .finally(() => {
160
- this._isWaitingForSave = false;
161
- });
162
- }
163
- break;
152
+ LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
153
+ if (this.dataUnit) {
154
+ switch (elem) {
155
+ case TaskbarElement.PREVIOUS:
156
+ this.dataUnit.previousRecord();
157
+ break;
158
+ case TaskbarElement.NEXT:
159
+ this.dataUnit.nextRecord();
160
+ break;
161
+ case TaskbarElement.REFRESH:
162
+ this.dataUnit.loadData();
163
+ break;
164
+ case TaskbarElement.CLONE:
165
+ this.dataUnit.copySelected();
166
+ break;
167
+ case TaskbarElement.REMOVE:
168
+ this.dataUnit.removeSelectedRecords();
169
+ break;
170
+ case TaskbarElement.INSERT:
171
+ this.dataUnit.addRecord();
172
+ break;
173
+ case TaskbarElement.CANCEL:
174
+ this.dataUnit.cancelEdition();
175
+ break;
176
+ case TaskbarElement.SAVE:
177
+ if (!this._isWaitingForSave) {
178
+ this._isWaitingForSave = true;
179
+ this.dataUnit.saveData().catch((err) => {
180
+ if (err instanceof SilentException) {
181
+ return;
182
+ }
183
+ else {
184
+ throw err;
185
+ }
186
+ }).finally(() => {
187
+ this._isWaitingForSave = false;
188
+ });
189
+ }
190
+ break;
191
+ }
164
192
  }
165
- }
166
- if (this.isEnabled(elem))
167
- this.actionClick.emit(elem);
193
+ if (this.isEnabled(elem))
194
+ this.actionClick.emit(elem);
195
+ });
168
196
  }
169
197
  isEnabled(elem) {
170
198
  if (!this.isAllowed(elem)) {
@@ -368,9 +396,10 @@ export class SnkTaskbar {
368
396
  this._lastWidth = this._element.getBoundingClientRect().width;
369
397
  }
370
398
  disconnectedCallback() {
371
- var _a;
399
+ var _a, _b;
400
+ (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.unsubscribe(this.onSaveEvent);
372
401
  this.unlinkAllCustomElements();
373
- (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
402
+ (_b = this._overFlowWatcher) === null || _b === void 0 ? void 0 : _b.destroy();
374
403
  }
375
404
  unlinkAllCustomElements() {
376
405
  var _a;
@@ -719,6 +748,36 @@ export class SnkTaskbar {
719
748
  "resolved": "string",
720
749
  "references": {}
721
750
  }
751
+ }, {
752
+ "method": "taskbarSaveLocker",
753
+ "name": "taskbarSaveLocker",
754
+ "bubbles": true,
755
+ "cancelable": true,
756
+ "composed": true,
757
+ "docs": {
758
+ "tags": [],
759
+ "text": "Emitido sempre que um save \u00E9 iniciado pela taskbar."
760
+ },
761
+ "complexType": {
762
+ "original": "void",
763
+ "resolved": "void",
764
+ "references": {}
765
+ }
766
+ }, {
767
+ "method": "taskbarSaveUnlocker",
768
+ "name": "taskbarSaveUnlocker",
769
+ "bubbles": true,
770
+ "cancelable": true,
771
+ "composed": true,
772
+ "docs": {
773
+ "tags": [],
774
+ "text": "Emitido sempre que o ocorre alguma action que libera o save."
775
+ },
776
+ "complexType": {
777
+ "original": "void",
778
+ "resolved": "void",
779
+ "references": {}
780
+ }
722
781
  }];
723
782
  }
724
783
  static get elementRef() { return "_element"; }
@@ -732,6 +791,9 @@ export class SnkTaskbar {
732
791
  }, {
733
792
  "propName": "_lastWidth",
734
793
  "methodName": "observeLastWidth"
794
+ }, {
795
+ "propName": "_isWaitingForSave",
796
+ "methodName": "observeIsWaitingForSave"
735
797
  }];
736
798
  }
737
799
  static get listeners() {
@@ -741,6 +803,18 @@ export class SnkTaskbar {
741
803
  "target": "window",
742
804
  "capture": false,
743
805
  "passive": false
806
+ }, {
807
+ "name": "taskbarSaveLocker",
808
+ "method": "handleTaskbarSaveLocker",
809
+ "target": "window",
810
+ "capture": false,
811
+ "passive": false
812
+ }, {
813
+ "name": "taskbarSaveUnlocker",
814
+ "method": "handleTaskbarSaveUnlocker",
815
+ "target": "window",
816
+ "capture": false,
817
+ "passive": false
744
818
  }];
745
819
  }
746
820
  }
@@ -35,3 +35,8 @@ export var DataExporterType;
35
35
  DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
36
36
  DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
37
37
  })(DataExporterType || (DataExporterType = {}));
38
+ export var ExporterStrategy;
39
+ (function (ExporterStrategy) {
40
+ ExporterStrategy["SERVER_SIDE"] = "ServerSideExporterStrategy";
41
+ ExporterStrategy["CLIENT_SIDE"] = "ClientSideExporterStrategy";
42
+ })(ExporterStrategy || (ExporterStrategy = {}));
@@ -1,4 +1,4 @@
1
- import { NumberUtils, ObjectUtils } from "@sankhyalabs/core";
1
+ import { NumberUtils, ObjectUtils, StringUtils } from "@sankhyalabs/core";
2
2
  export default class RmPrecisionCustomValueFormatter {
3
3
  setGrid(grid) {
4
4
  if (this._grid) {
@@ -8,7 +8,7 @@ export default class RmPrecisionCustomValueFormatter {
8
8
  this.refreshSelectedRows();
9
9
  }
10
10
  setDataState(dataState) {
11
- if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
11
+ if (this._dataState && ObjectUtils.equals(dataState === null || dataState === void 0 ? void 0 : dataState.metadataByRow, this._dataState.metadataByRow)) {
12
12
  return;
13
13
  }
14
14
  this._dataState = dataState;
@@ -16,7 +16,7 @@ export default class RmPrecisionCustomValueFormatter {
16
16
  }
17
17
  format(currentValue, column, recordId) {
18
18
  var _a;
19
- if (!currentValue) {
19
+ if (StringUtils.isEmpty(currentValue)) {
20
20
  return currentValue;
21
21
  }
22
22
  const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
@@ -1,5 +1,5 @@
1
1
  import { ChangeOperation, DataType, DataUnit, DateUtils, StringUtils, } from '@sankhyalabs/core';
2
- import { applyFilter, applySorting, buildPaginationInfo } from './dataUnitInMemoryUtils';
2
+ import { buildLoadDataResponse } from './dataUnitInMemoryUtils';
3
3
  export default class InMemoryLoader {
4
4
  constructor(metadata, records, config) {
5
5
  this.metadata = metadata;
@@ -82,9 +82,7 @@ export default class InMemoryLoader {
82
82
  return StringUtils.generateUUID();
83
83
  }
84
84
  inMemoryLoader(dataUnit, request, recordsIn) {
85
- let records = applyFilter(recordsIn, dataUnit, request.filters);
86
- records = applySorting(records, dataUnit, request.sort);
87
- return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
85
+ return buildLoadDataResponse(recordsIn, dataUnit, request);
88
86
  }
89
87
  metadaLoader() {
90
88
  return Promise.resolve(this._metadata);
@@ -11,6 +11,21 @@ export function applyFilter(records, dataUnit, filters) {
11
11
  }
12
12
  return records.filter(filterFunction);
13
13
  }
14
+ export function buildLoadDataResponse(recordsIn, dataUnit, request) {
15
+ let records = recordsIn ? [...recordsIn] : [];
16
+ records = applyFilter(records, dataUnit, request.filters);
17
+ records = applySorting(records, dataUnit, request.sort);
18
+ const { offset, limit } = request;
19
+ const paginationInfoBuilderParams = {
20
+ recordsLength: records.length,
21
+ offset,
22
+ recordsPerPage: limit,
23
+ };
24
+ return Promise.resolve({
25
+ records: getPagesByRecords(records, offset, limit),
26
+ paginationInfo: dataUnit.pageSize ? buildPaginationInfo(paginationInfoBuilderParams) : undefined,
27
+ });
28
+ }
14
29
  export function applySorting(records, dataUnit, sorting) {
15
30
  if (sorting == undefined || sorting.length == 0) {
16
31
  return records;
@@ -21,17 +36,27 @@ export function applySorting(records, dataUnit, sorting) {
21
36
  }
22
37
  return records.sort(sortingFunction);
23
38
  }
24
- export function buildPaginationInfo(records, offset = 0, limit = 0) {
25
- if (records === undefined) {
26
- return undefined;
39
+ function hasValidLimitAndOffset(offset, limit) {
40
+ return offset >= 0 && limit >= 0;
41
+ }
42
+ export function getPagesByRecords(records, offset = 0, limit = 0) {
43
+ if (!records || !records.length || !hasValidLimitAndOffset(offset, limit))
44
+ return [];
45
+ if (limit === 0 && offset === 0)
46
+ return records;
47
+ return records.slice(offset, offset + limit);
48
+ }
49
+ export function buildPaginationInfo({ recordsLength = 0, offset = 0, recordsPerPage = 0 }) {
50
+ if (!recordsLength) {
51
+ return { currentPage: 0, firstRecord: 0, lastRecord: 0, total: 0, hasMore: false };
27
52
  }
28
- const total = (records === null || records === void 0 ? void 0 : records.length) || 0;
29
- const lastRecord = Math.min(offset + limit, total);
53
+ const lastRecordIndex = offset + recordsPerPage;
54
+ const lastRecord = lastRecordIndex ? Math.min(lastRecordIndex, recordsLength) : recordsLength;
30
55
  return {
31
- currentPage: limit === 0 ? 0 : Math.ceil(offset / limit),
32
- firstRecord: offset,
56
+ currentPage: recordsPerPage === 0 ? 0 : Math.ceil(offset / recordsPerPage),
57
+ firstRecord: offset + 1,
33
58
  lastRecord: lastRecord,
34
- total: total,
35
- hasMore: !!(total - lastRecord),
59
+ total: recordsLength,
60
+ hasMore: lastRecord < recordsLength,
36
61
  };
37
62
  }
@@ -6,7 +6,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
6
6
  function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
7
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
8
8
  };
9
- import { ApplicationContext, ErrorException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
9
+ import { ApplicationContext, ErrorException, ObjectUtils, ServiceCanceledException, StringUtils, WarningException } from '@sankhyalabs/core';
10
10
  import { batchRequests } from 'graphql-request';
11
11
  import UrlUtils from "../../../lib/utils/urlutils";
12
12
  import { PrintUtils } from '../../utils/PrintUtils';
@@ -266,7 +266,8 @@ export class DataFetcher {
266
266
  }
267
267
  payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
268
268
  }
269
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
269
+ const requestId = StringUtils.generateUUID();
270
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
270
271
  http.open("POST", url, true);
271
272
  http.withCredentials = true;
272
273
  http.send(ObjectUtils.objectToString(payloadJson));
@@ -306,7 +307,7 @@ export class DataFetcher {
306
307
  else if (http.readyState == 4 && http.status != 200) {
307
308
  reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
308
309
  }
309
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
310
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
310
311
  };
311
312
  });
312
313
  }
@@ -352,6 +353,7 @@ export class DataFetcher {
352
353
  }
353
354
  }
354
355
  async executePendingRequest(watingRequestsById) {
356
+ var _a, _b;
355
357
  const requestsBatch = [];
356
358
  let quietMode = true;
357
359
  watingRequestsById.forEach((waitingReq) => {
@@ -362,31 +364,36 @@ export class DataFetcher {
362
364
  const response = await this.fecthGraphQL(requestsBatch, quietMode);
363
365
  const { data: dataResponse, errors: errorsResponse, extensions } = response;
364
366
  //Reject promises with errors from query
365
- errorsResponse.forEach((errorResponse) => {
366
- Object.entries(errorResponse).forEach(async ([key, val]) => {
367
- const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
367
+ for (const errorResponse of errorsResponse) {
368
+ const values = Object.values(errorResponse);
369
+ for (const value of values) {
370
+ const waitingRequest = watingRequestsById.get(value.request.variables[value.index].queryID);
368
371
  const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
369
- Promise.race([
372
+ const data = await Promise.race([
370
373
  waitingRequest.promise,
371
374
  new Promise((resolve) => {
372
375
  resolve(false);
373
376
  })
374
- ]).then((data) => {
375
- var _a;
376
- if (!hasClientEvent || data === false) {
377
- (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
377
+ ]);
378
+ if (!hasClientEvent || data === false) {
379
+ if (Object.keys(errorResponse[0].extensions).includes("SERVICE_CANCELED") || Object.keys(extensions).includes("isServiceCancelled")) {
380
+ (((_a = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ServiceCanceledException("Service canceled", value.message));
378
381
  }
379
- });
380
- });
381
- });
382
+ else {
383
+ (((_b = watingRequestsById.get(value.request.variables[value.index].queryID)) === null || _b === void 0 ? void 0 : _b.reject) || Promise.reject)(new ErrorException("Falha detectada", value.message));
384
+ }
385
+ }
386
+ }
387
+ }
382
388
  //Resolve promises with data from query
383
- dataResponse.forEach((data) => {
384
- Object.entries(data).forEach(async ([key, val]) => {
389
+ for (const data of dataResponse) {
390
+ const entries = Object.entries(data);
391
+ for (const [key, val] of entries) {
385
392
  const waitingRequest = watingRequestsById.get(key);
386
393
  await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
387
394
  ((waitingRequest === null || waitingRequest === void 0 ? void 0 : waitingRequest.resolve) || Promise.resolve)(val);
388
- });
389
- });
395
+ }
396
+ }
390
397
  }
391
398
  buildGraphQlURL(quietMode) {
392
399
  const urlParams = UrlUtils.getQueryParams(location.search);
@@ -405,7 +412,8 @@ export class DataFetcher {
405
412
  const errorsResponse = [];
406
413
  const responseExtensions = [];
407
414
  const url = this.buildGraphQlURL(quietMode);
408
- DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request }));
415
+ const requestId = StringUtils.generateUUID();
416
+ DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
409
417
  try {
410
418
  const response = await batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
411
419
  response.forEach((resItem, index) => {
@@ -439,11 +447,11 @@ export class DataFetcher {
439
447
  });
440
448
  }
441
449
  else {
442
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
450
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
443
451
  throw new ErrorException("Falha de comunicação", err.message);
444
452
  }
445
453
  }
446
- DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
454
+ DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
447
455
  return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
448
456
  }
449
457
  isHttpError(err) {
@@ -6,21 +6,23 @@ const SERVICE = {
6
6
  download: "AnexoSistemaSP.baixar",
7
7
  };
8
8
  export class AnexoSistemaFetcher {
9
- constructor(entityName, registerKey, dataUnitName) {
9
+ constructor(entityName, dataUnitName) {
10
10
  var _a;
11
11
  this.entityName = entityName;
12
- this.registerKey = registerKey;
13
12
  this.dataUnitName = dataUnitName;
14
13
  this.validateFields = (fields) => {
15
14
  if (!!fields.LINK && !!fields.NOMEARQUIVO)
16
15
  throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
17
16
  if (!fields.LINK && !fields.NOMEARQUIVO)
18
17
  throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
19
- if (!this.registerKey)
18
+ if (!this._registerKey)
20
19
  throw new Error('Register key can not be null');
21
20
  };
22
21
  this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
23
22
  }
23
+ set registerKey(registerKey) {
24
+ this._registerKey = registerKey;
25
+ }
24
26
  async save(change) {
25
27
  var _a, _b;
26
28
  let { updatingFields: fields } = change;
@@ -39,7 +41,7 @@ export class AnexoSistemaFetcher {
39
41
  nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
40
42
  link: fields.LINK,
41
43
  nameEntity: this.entityName,
42
- pkEntity: this.registerKey,
44
+ pkEntity: this._registerKey,
43
45
  typeAcess: fields.TIPOACESSO,
44
46
  typeApres: fields.TIPOAPRES,
45
47
  }
@@ -79,7 +81,7 @@ export class AnexoSistemaFetcher {
79
81
  nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
80
82
  link: fields.LINK,
81
83
  nameEntity: this.entityName,
82
- pkEntity: this.registerKey,
84
+ pkEntity: this._registerKey,
83
85
  typeAcess: fields.TIPOACESSO,
84
86
  typeApres: fields.TIPOAPRES,
85
87
  }
@@ -1,6 +1,8 @@
1
1
  import PreloadManager from "./cache/PreloadManager";
2
2
  import { DatasetStrategy } from "./loadstrategy/DatasetStrategy";
3
+ import { CancelPaginationResponse, showAskCancelPaginationPopup } from './helpers/DataUnitDataLoaderHelper';
3
4
  export default class DataUnitDataLoader {
5
+ constructor() { }
4
6
  static async debounce(dataUnit, callBack) {
5
7
  const duName = dataUnit.name;
6
8
  if (DataUnitDataLoader._debouncingTimeouts[duName]) {
@@ -46,25 +48,67 @@ export default class DataUnitDataLoader {
46
48
  }
47
49
  static async callLoader(dataUnit, request, requestLoadingInfo, dataLoader) {
48
50
  if (dataLoader == undefined) {
49
- //dataLoader = new DataUnitStrategy();
50
51
  dataLoader = new DatasetStrategy();
51
52
  }
52
53
  const result = await dataLoader.load(dataUnit, request, requestLoadingInfo);
53
- const { records, loadingInfo: responseLoadingInfo } = result;
54
- if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo)) {
54
+ const responseLoadingInfo = result.loadingInfo;
55
+ if (DataUnitDataLoader.isOldRequest(dataUnit, responseLoadingInfo))
55
56
  return Promise.resolve(undefined);
57
+ this.handleCache(dataLoader, responseLoadingInfo, dataUnit, result.records);
58
+ if (dataUnit.cancelPagination)
59
+ return this.handlePaginationCanceled(dataUnit, result);
60
+ //Não existem mais páginas a serem carregadas
61
+ if (this.canFinishPagination(dataUnit, responseLoadingInfo))
62
+ return Promise.resolve(result);
63
+ const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
64
+ let newLoadingInfo = this.buildNewLoadingInfo(responseLoadingInfo);
65
+ if (this.canProceedPagination(responseLoadingInfo))
66
+ return this.recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result);
67
+ const confirm = await showAskCancelPaginationPopup();
68
+ if (confirm === CancelPaginationResponse.CANCEL)
69
+ return this.handlePaginationCanceled(dataUnit, result);
70
+ if (confirm === CancelPaginationResponse.LOAD_ALL) {
71
+ newLoadingInfo = Object.assign(Object.assign({}, newLoadingInfo), { loadAllRecords: true });
56
72
  }
73
+ newLoadingInfo = Object.assign(Object.assign({}, newLoadingInfo), { lastRowLimitAsked: newLoadingInfo.count });
74
+ return this.recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result);
75
+ }
76
+ static buildNewLoadingInfo(responseLoadingInfo) {
77
+ let newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
78
+ return newLoadingInfo;
79
+ }
80
+ static handleCache(dataLoader, responseLoadingInfo, dataUnit, records) {
57
81
  const recreateCache = !dataLoader.canSlice() || responseLoadingInfo.count === 0;
58
82
  PreloadManager.cacheRecords(dataUnit, records, recreateCache, responseLoadingInfo.loadingInProgress);
59
- if (PreloadManager.isCacheEnabled(dataUnit) && responseLoadingInfo.loadingInProgress) {
60
- const newRequest = Object.assign(Object.assign({}, request), { offset: responseLoadingInfo.count });
61
- const newLoadingInfo = Object.assign(Object.assign({}, responseLoadingInfo), { pageNumber: (responseLoadingInfo.pageNumber || 0) + 1, quiet: true });
62
- this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
63
- .then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
64
- .catch(reason => console.error(reason));
65
- }
83
+ }
84
+ static recallLoader(dataUnit, newRequest, newLoadingInfo, dataLoader, result) {
85
+ this.callLoader(dataUnit, newRequest, newLoadingInfo, dataLoader)
86
+ .then(result => DataUnitDataLoader.afterLoadingPage(dataUnit, result.loadingInfo))
87
+ .catch(reason => console.error(reason));
66
88
  return Promise.resolve(result);
67
89
  }
90
+ static canFinishPagination(dataUnit, responseLoadingInfo) {
91
+ return !PreloadManager.isCacheEnabled(dataUnit) || !responseLoadingInfo.loadingInProgress;
92
+ }
93
+ static canProceedPagination(info) {
94
+ const { count, askRowsLimit, loadAllRecords, lastRowLimitAsked } = info;
95
+ if (loadAllRecords)
96
+ return true;
97
+ if (!count || !askRowsLimit)
98
+ return true;
99
+ const askRowLimitNumber = Number(askRowsLimit);
100
+ if (count < askRowLimitNumber)
101
+ return true;
102
+ const nextLimitToAsk = askRowLimitNumber + (lastRowLimitAsked ? lastRowLimitAsked : 0);
103
+ return count < nextLimitToAsk;
104
+ }
105
+ static handlePaginationCanceled(dataUnit, result) {
106
+ dataUnit.cancelPagination = false;
107
+ let loadingInfo = result.loadingInfo;
108
+ loadingInfo = Object.assign(Object.assign({}, loadingInfo), { total: loadingInfo.count, loadingInProgress: false, pagerId: undefined, needReload: loadingInfo.hasLocalSorting });
109
+ const loadDataResult = { records: result.records, loadingInfo };
110
+ return Promise.resolve(loadDataResult);
111
+ }
68
112
  static afterLoadingPage(dataUnit, loadingInfo) {
69
113
  PreloadManager.setLoadingStatus(dataUnit, loadingInfo.loadingInProgress);
70
114
  const dataUnitPagination = dataUnit.getPaginationInfo();
@@ -73,7 +117,7 @@ export default class DataUnitDataLoader {
73
117
  }
74
118
  const count = loadingInfo.count;
75
119
  if (loadingInfo.loadingInProgress) {
76
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
120
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count, loadingInProgress: true }));
77
121
  return;
78
122
  }
79
123
  if (loadingInfo.needReload) {
@@ -81,7 +125,7 @@ export default class DataUnitDataLoader {
81
125
  dataUnit.gotoPage(0);
82
126
  return;
83
127
  }
84
- dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
128
+ dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count, loadingInProgress: false }));
85
129
  }
86
130
  static registryLoading(dataUnit, loadingInfo) {
87
131
  if (loadingInfo == undefined) {
@@ -104,7 +148,7 @@ export default class DataUnitDataLoader {
104
148
  // controle de paginação voltar pra primeira página.
105
149
  offset = 0;
106
150
  }
107
- const { total, count, loadingInProgress } = loadingInfo;
151
+ const { total, count, loadingInProgress, askRowsLimit } = loadingInfo;
108
152
  const firstRecord = (count === 0 || pageSize === 0) ? 0 : offset + 1;
109
153
  const lastRecord = offset + Math.min(pageSize, limit);
110
154
  return {
@@ -113,7 +157,8 @@ export default class DataUnitDataLoader {
113
157
  lastRecord,
114
158
  firstRecord,
115
159
  currentPage: offset / limit,
116
- hasMore: lastRecord < count || loadingInProgress
160
+ hasMore: lastRecord < count || loadingInProgress,
161
+ askRowsLimit
117
162
  };
118
163
  }
119
164
  }