@sankhyalabs/sankhyablocks 8.3.1 → 8.4.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/dist/cjs/{ConfigStorage-c9ca6658.js → ConfigStorage-f0f89379.js} +163 -51
  2. package/dist/cjs/{DataFetcher-7694daf2.js → DataFetcher-4798bac3.js} +78 -234
  3. package/dist/cjs/ISave-d68ce3cd.js +8 -0
  4. package/dist/cjs/PrintUtils-bcaeb82f.js +215 -0
  5. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  6. package/dist/cjs/{SnkFormConfigManager-fb684c0e.js → SnkFormConfigManager-d5fd8800.js} +19 -21
  7. package/dist/cjs/{auth-fetcher-80818a0f.js → auth-fetcher-f2967437.js} +2 -2
  8. package/dist/cjs/{dataunit-fetcher-1acab20d.js → dataunit-fetcher-959c9a00.js} +1 -1
  9. package/dist/cjs/{form-config-fetcher-f10017bf.js → form-config-fetcher-5e3d3b87.js} +66 -3
  10. package/dist/cjs/index-f9e81701.js +4 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-c9d99342.js → pesquisa-fetcher-7973c081.js} +1 -1
  13. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  14. package/dist/cjs/snk-actions-button.cjs.entry.js +19 -11
  15. package/dist/cjs/snk-application.cjs.entry.js +60 -44
  16. package/dist/cjs/snk-attach.cjs.entry.js +9 -14
  17. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  18. package/dist/cjs/snk-crud.cjs.entry.js +28 -11
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -2
  20. package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-7cc1846d.js} +5 -5
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +17 -13
  23. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  24. package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -17
  25. package/dist/cjs/snk-filter-detail.cjs.entry.js +7 -16
  26. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -19
  27. package/dist/cjs/snk-form-config.cjs.entry.js +7 -17
  28. package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
  29. package/dist/cjs/snk-form.cjs.entry.js +13 -8
  30. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -6
  31. package/dist/cjs/snk-grid.cjs.entry.js +23 -22
  32. package/dist/cjs/{snk-guides-viewer-5da253af.js → snk-guides-viewer-b7b680d2.js} +19 -8
  33. package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -9
  34. package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
  35. package/dist/cjs/snk-print-selector.cjs.entry.js +2 -4
  36. package/dist/cjs/snk-simple-crud.cjs.entry.js +43 -85
  37. package/dist/cjs/snk-taskbar-custom-elements.cjs.entry.js +20 -0
  38. package/dist/cjs/snk-taskbar.cjs.entry.js +71 -5
  39. package/dist/cjs/{taskbar-elements-b98dd6e9.js → taskbar-elements-39949c7a.js} +4 -4
  40. package/dist/collection/collection-manifest.json +1 -0
  41. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  42. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  43. package/dist/collection/components/snk-application/snk-application.js +120 -65
  44. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  45. package/dist/collection/components/snk-crud/snk-crud.js +44 -8
  46. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +60 -2
  47. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
  48. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +65 -28
  49. package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -6
  50. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  51. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +8 -13
  52. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  53. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
  55. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  56. package/dist/collection/components/snk-form/snk-form.js +46 -2
  57. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  58. package/dist/collection/components/snk-grid/snk-grid.js +108 -16
  59. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  60. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  61. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -1
  62. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +4 -4
  63. package/dist/collection/components/snk-taskbar/snk-taskbar-custom-elements.js +43 -0
  64. package/dist/collection/components/snk-taskbar/snk-taskbar.css +4 -0
  65. package/dist/collection/components/snk-taskbar/snk-taskbar.js +126 -5
  66. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  67. package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -71
  68. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +47 -32
  69. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  70. package/dist/collection/lib/index.js +10 -0
  71. package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
  72. package/dist/collection/lib/utils/PrintUtils.js +18 -9
  73. package/dist/collection/lib/utils/urlutils.js +29 -0
  74. package/dist/components/ConfigStorage.js +161 -48
  75. package/dist/components/DataFetcher.js +79 -234
  76. package/dist/components/PrintUtils.js +213 -0
  77. package/dist/components/ResourceIDUtils.js +10 -0
  78. package/dist/components/SnkFormConfigManager.js +17 -19
  79. package/dist/components/auth-fetcher.js +1 -1
  80. package/dist/components/form-config-fetcher.js +64 -2
  81. package/dist/components/index.d.ts +1 -0
  82. package/dist/components/index.js +1 -0
  83. package/dist/components/snk-actions-button2.js +23 -9
  84. package/dist/components/snk-application2.js +145 -129
  85. package/dist/components/snk-attach2.js +1 -8
  86. package/dist/components/snk-configurator2.js +3 -1
  87. package/dist/components/snk-crud.js +27 -8
  88. package/dist/components/snk-data-unit2.js +6 -5
  89. package/dist/components/snk-detail-view2.js +26 -10
  90. package/dist/components/snk-entity-list.js +0 -4
  91. package/dist/components/snk-filter-bar2.js +12 -12
  92. package/dist/components/snk-filter-detail2.js +8 -13
  93. package/dist/components/snk-filter-modal-item2.js +5 -16
  94. package/dist/components/snk-form-config2.js +5 -15
  95. package/dist/components/snk-form-view2.js +6 -1
  96. package/dist/components/snk-form.js +9 -2
  97. package/dist/components/snk-grid-config2.js +4 -2
  98. package/dist/components/snk-grid2.js +24 -17
  99. package/dist/components/snk-personalized-filter2.js +11 -11
  100. package/dist/components/snk-print-selector.js +1 -1
  101. package/dist/components/snk-simple-crud2.js +30 -73
  102. package/dist/components/snk-taskbar-custom-elements.d.ts +11 -0
  103. package/dist/components/snk-taskbar-custom-elements.js +35 -0
  104. package/dist/components/snk-taskbar2.js +81 -9
  105. package/dist/esm/{ConfigStorage-6887ede4.js → ConfigStorage-4441aa3d.js} +162 -49
  106. package/dist/esm/{DataFetcher-731430d9.js → DataFetcher-1618bffe.js} +79 -234
  107. package/dist/esm/ISave-4412b20c.js +8 -0
  108. package/dist/esm/PrintUtils-3e4ff0f5.js +213 -0
  109. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  110. package/dist/esm/{SnkFormConfigManager-6acecf9f.js → SnkFormConfigManager-5a5f85a3.js} +19 -21
  111. package/dist/esm/{auth-fetcher-82d89fe6.js → auth-fetcher-7861187e.js} +1 -1
  112. package/dist/esm/{dataunit-fetcher-ad7a1a3e.js → dataunit-fetcher-53c007be.js} +1 -1
  113. package/dist/esm/{form-config-fetcher-9560730a.js → form-config-fetcher-2fe67341.js} +65 -3
  114. package/dist/esm/index-a7d3d3f1.js +4 -0
  115. package/dist/esm/loader.js +1 -1
  116. package/dist/esm/{pesquisa-fetcher-27dc20ed.js → pesquisa-fetcher-19e81fc8.js} +1 -1
  117. package/dist/esm/sankhyablocks.js +1 -1
  118. package/dist/esm/snk-actions-button.entry.js +19 -11
  119. package/dist/esm/snk-application.entry.js +60 -44
  120. package/dist/esm/snk-attach.entry.js +5 -10
  121. package/dist/esm/snk-configurator.entry.js +2 -1
  122. package/dist/esm/snk-crud.entry.js +30 -13
  123. package/dist/esm/snk-data-exporter.entry.js +3 -2
  124. package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-1715d2f1.js} +5 -5
  125. package/dist/esm/snk-data-unit.entry.js +1 -1
  126. package/dist/esm/snk-detail-view.entry.js +17 -13
  127. package/dist/esm/snk-entity-list.entry.js +0 -4
  128. package/dist/esm/snk-filter-bar.entry.js +15 -17
  129. package/dist/esm/snk-filter-detail.entry.js +8 -17
  130. package/dist/esm/snk-filter-modal-item.entry.js +7 -20
  131. package/dist/esm/snk-form-config.entry.js +8 -18
  132. package/dist/esm/snk-form-view.entry.js +6 -1
  133. package/dist/esm/snk-form.entry.js +13 -8
  134. package/dist/esm/snk-grid-config.entry.js +6 -6
  135. package/dist/esm/snk-grid.entry.js +23 -22
  136. package/dist/esm/{snk-guides-viewer-d3623a1f.js → snk-guides-viewer-e4fe884d.js} +19 -8
  137. package/dist/esm/snk-guides-viewer.entry.js +10 -9
  138. package/dist/esm/snk-personalized-filter.entry.js +14 -16
  139. package/dist/esm/snk-print-selector.entry.js +1 -3
  140. package/dist/esm/snk-simple-crud.entry.js +34 -76
  141. package/dist/esm/snk-taskbar-custom-elements.entry.js +16 -0
  142. package/dist/esm/snk-taskbar.entry.js +71 -5
  143. package/dist/esm/{taskbar-elements-2c761819.js → taskbar-elements-0a6b8b95.js} +4 -4
  144. package/dist/sankhyablocks/p-0b99a775.entry.js +1 -0
  145. package/dist/sankhyablocks/p-1e30c376.entry.js +1 -0
  146. package/dist/sankhyablocks/p-1fa3acbe.entry.js +1 -0
  147. package/dist/sankhyablocks/p-27dbbb3a.entry.js +1 -0
  148. package/dist/sankhyablocks/p-29b1d77b.entry.js +11 -0
  149. package/dist/sankhyablocks/p-324ce41e.entry.js +1 -0
  150. package/dist/sankhyablocks/p-34604220.entry.js +1 -0
  151. package/dist/sankhyablocks/p-41820e28.entry.js +1 -0
  152. package/dist/sankhyablocks/p-4352324d.entry.js +1 -0
  153. package/dist/sankhyablocks/{p-f6b98398.js → p-449d25e0.js} +2 -2
  154. package/dist/sankhyablocks/p-5051a23a.entry.js +1 -0
  155. package/dist/sankhyablocks/p-5526ab67.js +1 -0
  156. package/dist/sankhyablocks/p-5b2ee1d3.js +1 -0
  157. package/dist/sankhyablocks/p-5da848bb.js +26 -0
  158. package/dist/sankhyablocks/p-6098d844.entry.js +1 -0
  159. package/dist/sankhyablocks/p-648a7c72.entry.js +1 -0
  160. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  161. package/dist/sankhyablocks/p-72fc257b.entry.js +1 -0
  162. package/dist/sankhyablocks/p-7d6eca73.entry.js +1 -0
  163. package/dist/sankhyablocks/p-81a7f74c.js +1 -0
  164. package/dist/sankhyablocks/p-8d884fab.js +1 -0
  165. package/dist/sankhyablocks/p-90b5d1af.entry.js +1 -0
  166. package/dist/sankhyablocks/p-989937ee.entry.js +1 -0
  167. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  168. package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
  169. package/dist/sankhyablocks/{p-1bed2c42.js → p-a75e892a.js} +1 -1
  170. package/dist/sankhyablocks/p-a81996df.js +1 -0
  171. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  172. package/dist/sankhyablocks/{p-a2493d11.js → p-c9841939.js} +1 -1
  173. package/dist/sankhyablocks/p-ca1522bc.entry.js +1 -0
  174. package/dist/sankhyablocks/p-cbed6235.entry.js +1 -0
  175. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  176. package/dist/sankhyablocks/p-daa687aa.js +56 -0
  177. package/dist/sankhyablocks/p-e1cb1f0b.js +1 -0
  178. package/dist/sankhyablocks/p-eb1a650a.entry.js +1 -0
  179. package/dist/sankhyablocks/p-f784010c.entry.js +1 -0
  180. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  181. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  182. package/dist/types/components/snk-application/snk-application.d.ts +9 -22
  183. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  184. package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
  185. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -0
  186. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
  187. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -2
  188. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
  189. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  190. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  191. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  192. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  193. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  194. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  195. package/dist/types/components/snk-form/snk-form.d.ts +9 -1
  196. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  197. package/dist/types/components/snk-grid/snk-grid.d.ts +17 -1
  198. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  199. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  200. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  201. package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +2 -2
  202. package/dist/types/components/snk-taskbar/snk-taskbar-custom-elements.d.ts +7 -0
  203. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +27 -0
  204. package/dist/types/components.d.ts +203 -22
  205. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  206. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -8
  207. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  208. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  209. package/dist/types/lib/index.d.ts +11 -0
  210. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  211. package/dist/types/lib/utils/PrintUtils.d.ts +1 -0
  212. package/dist/types/lib/utils/urlutils.d.ts +14 -0
  213. package/package.json +2 -2
  214. package/react/components.d.ts +1 -0
  215. package/react/components.js +1 -0
  216. package/react/components.js.map +1 -1
  217. package/dist/cjs/filter-bar-config-fetcher-f13a1aff.js +0 -155
  218. package/dist/cjs/resource-fetcher-a6e6c5fd.js +0 -68
  219. package/dist/components/filter-bar-config-fetcher.js +0 -153
  220. package/dist/components/resource-fetcher.js +0 -66
  221. package/dist/esm/filter-bar-config-fetcher-553c5463.js +0 -153
  222. package/dist/esm/resource-fetcher-0586b1fc.js +0 -66
  223. package/dist/sankhyablocks/p-000d073b.entry.js +0 -1
  224. package/dist/sankhyablocks/p-162f5d21.entry.js +0 -1
  225. package/dist/sankhyablocks/p-1dc76c50.js +0 -1
  226. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  227. package/dist/sankhyablocks/p-24b18442.entry.js +0 -1
  228. package/dist/sankhyablocks/p-301d4e34.js +0 -1
  229. package/dist/sankhyablocks/p-4374bc89.entry.js +0 -1
  230. package/dist/sankhyablocks/p-564efc43.js +0 -1
  231. package/dist/sankhyablocks/p-5fe223c9.entry.js +0 -1
  232. package/dist/sankhyablocks/p-61651a40.entry.js +0 -1
  233. package/dist/sankhyablocks/p-70d4a90a.entry.js +0 -1
  234. package/dist/sankhyablocks/p-7bd353de.entry.js +0 -1
  235. package/dist/sankhyablocks/p-837831c2.js +0 -56
  236. package/dist/sankhyablocks/p-85ec10c9.entry.js +0 -1
  237. package/dist/sankhyablocks/p-89d46727.entry.js +0 -1
  238. package/dist/sankhyablocks/p-8e8b5fc7.js +0 -1
  239. package/dist/sankhyablocks/p-8e96581f.js +0 -17
  240. package/dist/sankhyablocks/p-9b2af526.entry.js +0 -1
  241. package/dist/sankhyablocks/p-9db7e50a.js +0 -10
  242. package/dist/sankhyablocks/p-a2f32d4e.entry.js +0 -1
  243. package/dist/sankhyablocks/p-a7eaea51.entry.js +0 -1
  244. package/dist/sankhyablocks/p-a84b1ca2.entry.js +0 -1
  245. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  246. package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
  247. package/dist/sankhyablocks/p-c3943e7e.entry.js +0 -11
  248. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  249. package/dist/sankhyablocks/p-c7d1e26a.js +0 -1
  250. package/dist/sankhyablocks/p-cd40ab53.entry.js +0 -1
  251. package/dist/sankhyablocks/p-d41198ff.js +0 -1
  252. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  253. package/dist/sankhyablocks/p-f9f385eb.entry.js +0 -1
@@ -16,6 +16,7 @@ import { PrintUtils } from '../../utils/PrintUtils';
16
16
  export class DataFetcher {
17
17
  constructor() {
18
18
  this.GRAPHQL_PATH = `/${window.MGE_MODULE_NAME || 'mgefin-bff'}/graphql`;
19
+ this.ready = true;
19
20
  this.watingRequestsById = new Map();
20
21
  }
21
22
  static get() {
@@ -26,6 +27,9 @@ export class DataFetcher {
26
27
  DataFetcher.instance.resume();
27
28
  }
28
29
  else {
30
+ if (ApplicationContext.getContextValue("__SNK__APPLICATION__LOADING__") === true) {
31
+ DataFetcher.instance.pause();
32
+ }
29
33
  application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
30
34
  application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
31
35
  }
@@ -84,6 +88,10 @@ export class DataFetcher {
84
88
  }
85
89
  async callGraphQL(req) {
86
90
  var _a;
91
+ if (this.ready) {
92
+ this.pause();
93
+ window.requestAnimationFrame(() => this.resume());
94
+ }
87
95
  const reqKey = this.getReqKey(req);
88
96
  req.queryID = reqKey;
89
97
  req.values.queryID = reqKey;
@@ -113,7 +121,7 @@ export class DataFetcher {
113
121
  if (!this.watingRequestsById.has(reqKey)) {
114
122
  this.watingRequestsById.set(reqKey, new WaitingRequest(req));
115
123
  }
116
- return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
124
+ return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
117
125
  }
118
126
  }
119
127
  resolveURL() {
@@ -208,9 +216,9 @@ export class DataFetcher {
208
216
  }
209
217
  }
210
218
  }
211
- processPrinting(payload) {
219
+ async processPrinting(payload) {
212
220
  if ((payload === null || payload === void 0 ? void 0 : payload.pendingPrinting) === 'true') {
213
- PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
221
+ await PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
214
222
  }
215
223
  if ('localPrintings' in payload) {
216
224
  PrintUtils.getInstance().processLocalPrinting(payload === null || payload === void 0 ? void 0 : payload.localPrintings);
@@ -264,6 +272,13 @@ export class DataFetcher {
264
272
  try {
265
273
  const jsonResp = JSON.parse(http.responseText);
266
274
  await this.processServiceBrokerClientEvents({ clientEvents: jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject });
275
+ /**
276
+ * Este trecho difere do projeto HTML5 devido à decisão de adotar uma abordagem síncrona para esta chamada. Isso é justificado pelo fato de que, no cenário em questão, a abordagem assíncrona teria impactos negativos.
277
+ *
278
+ * Descrição do caso de uso:
279
+ * Ao concluir um recebimento com cartão (Movimentação Financeira), é acionado um EzDialog de confirmação. Posteriormente, a PopUp de impressão é exibida, e, ao ser cancelada, gera a invocação de um novo EzDialog.
280
+ */
281
+ await this.processPrinting(jsonResp);
267
282
  if (this.isServiceBrokerError(jsonResp)) {
268
283
  reject(this.processServiceBrokerErrorInfo(jsonResp));
269
284
  }
@@ -276,7 +291,6 @@ export class DataFetcher {
276
291
  (_a = this.application) === null || _a === void 0 ? void 0 : _a.info(jsonResp.statusMessage);
277
292
  }
278
293
  }
279
- this.processPrinting(jsonResp);
280
294
  }
281
295
  catch (err) {
282
296
  console.warn(`Erro ao executar serviço: ${err}`);
@@ -314,42 +328,43 @@ export class DataFetcher {
314
328
  getQueryTemplate(re) {
315
329
  return (re.query || "").replaceAll("$queryAlias$", re.queryID);
316
330
  }
317
- getWatingRequest(reqID) {
318
- return this.watingRequestsById.get(reqID);
319
- }
320
331
  pause() {
321
332
  this.ready = false;
322
333
  }
323
334
  async resume() {
324
335
  this.ready = true;
325
336
  if (this.watingRequestsById.size > 0) {
326
- const requestsBatch = [];
327
- this.watingRequestsById.forEach(async (waitingReq) => {
328
- let query = this.getQueryTemplate(waitingReq.request);
329
- requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
330
- });
331
- let res = undefined;
332
- let dataResponse = [];
333
- let errorsResponse = [];
334
- res = await this.fecthGrapql(requestsBatch);
335
- dataResponse = res.data;
336
- errorsResponse = res.errors;
337
- //Reject promises with errors from query
338
- errorsResponse.forEach((errorResponse) => {
339
- Object.entries(errorResponse).forEach(([_key, val]) => {
340
- var _a;
341
- (((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
342
- });
337
+ const waitinRequests = this.watingRequestsById;
338
+ this.watingRequestsById = new Map();
339
+ this.executePendingRequest(waitinRequests);
340
+ }
341
+ }
342
+ async executePendingRequest(watingRequestsById) {
343
+ const requestsBatch = [];
344
+ watingRequestsById.forEach(async (waitingReq) => {
345
+ let query = this.getQueryTemplate(waitingReq.request);
346
+ requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
347
+ });
348
+ let res = undefined;
349
+ let dataResponse = [];
350
+ let errorsResponse = [];
351
+ res = await this.fecthGrapql(requestsBatch);
352
+ dataResponse = res.data;
353
+ errorsResponse = res.errors;
354
+ //Reject promises with errors from query
355
+ errorsResponse.forEach((errorResponse) => {
356
+ Object.entries(errorResponse).forEach(([_key, val]) => {
357
+ var _a;
358
+ (((_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));
343
359
  });
344
- //Resolve promises with data from query
345
- dataResponse.forEach((data) => {
346
- Object.entries(data).forEach(([key, val]) => {
347
- var _a;
348
- (((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
349
- });
360
+ });
361
+ //Resolve promises with data from query
362
+ dataResponse.forEach((data) => {
363
+ Object.entries(data).forEach(([key, val]) => {
364
+ var _a;
365
+ (((_a = watingRequestsById.get(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
350
366
  });
351
- this.watingRequestsById.clear();
352
- }
367
+ });
353
368
  }
354
369
  async fecthGrapql(request) {
355
370
  let res = undefined;
@@ -91,30 +91,6 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
91
91
  });
92
92
  });
93
93
  }
94
- saveEntityListConfig(item, resourceID, configName) {
95
- return new Promise((accept, reject) => {
96
- this.getConfig(resourceID, configName).then(config => {
97
- const state = config.map(({ id, value, fixed, visible, type, groupedItems }) => {
98
- return Object.assign(Object.assign(Object.assign(Object.assign({ id }, (value && { value: normalizeValue(value, type) })), (fixed && { fixed })), (visible && { visible: true })), { groupedItems });
99
- });
100
- const index = state.findIndex(({ id }) => id === item.id);
101
- const newItem = { id: item.id, value: normalizeValue(item.value, item.type), fixed: item.fixed, visible: true };
102
- if (index > -1) {
103
- state[index] = newItem;
104
- }
105
- else {
106
- state.push(newItem);
107
- }
108
- this.saveResource(state, this.getPath(resourceID, configName)).then(resp => {
109
- accept(resp);
110
- }).catch(exception => {
111
- reject(exception);
112
- });
113
- }).catch(exception => {
114
- reject(exception);
115
- });
116
- });
117
- }
118
94
  buildFieldList(items) {
119
95
  return items.map(item => {
120
96
  var _a, _b;
@@ -2,3 +2,13 @@ export { DataFetcher } from './http/data-fetcher/DataFetcher';
2
2
  export { PesquisaFetcher } from './http/data-fetcher/fetchers/pesquisa-fetcher';
3
3
  export { CrudUtils } from './utils/CrudUtils';
4
4
  export { PresentationMode } from "./@types";
5
+ export { TotalsFetcher } from './http/data-fetcher/fetchers/totals-fetcher';
6
+ export { default as ApplicationConfigFetcher } from './http/data-fetcher/fetchers/application-config-fetcher';
7
+ export { AttachFetcher } from './http/data-fetcher/fetchers/attach-fetcher';
8
+ export { default as DataUnitFetcher } from './http/data-fetcher/fetchers/dataunit-fetcher';
9
+ export { default as FilterBarConfigFetcher } from './http/data-fetcher/fetchers/filter-bar-config-fetcher';
10
+ export { FormConfigFetcher } from './http/data-fetcher/fetchers/form-config-fetcher';
11
+ export { default as GridConfigFetcher } from './http/data-fetcher/fetchers/grid-config-fetcher';
12
+ export { default as ParametersFetcher } from './http/data-fetcher/fetchers/parameters-fecher';
13
+ export { default as PersonalizedFilterFetcher } from './http/data-fetcher/fetchers/personalized-filter-fetcher';
14
+ export { ResourceFetcher } from './http/data-fetcher/fetchers/resource-fetcher';
@@ -0,0 +1,7 @@
1
+ import { ApplicationContext } from "@sankhyalabs/core";
2
+ export default class ResourceIDUtils {
3
+ static async getResourceID() {
4
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
5
+ return application.getResourceID();
6
+ }
7
+ }
@@ -1,8 +1,9 @@
1
- import { StringUtils } from "@sankhyalabs/core";
2
- import { DataFetcher } from "../http/data-fetcher/DataFetcher";
1
+ import { ApplicationContext, StringUtils } from "@sankhyalabs/core";
3
2
  export class PrintUtils {
4
3
  constructor() {
5
4
  this.appletImpressao = new AppletImpressao();
5
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
6
+ application.getDataFetcher().then(result => this.DataFetcher = result);
6
7
  }
7
8
  static getInstance() {
8
9
  if (!PrintUtils.instance) {
@@ -23,12 +24,18 @@ export class PrintUtils {
23
24
  }
24
25
  ]
25
26
  };
26
- const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
27
- const printJobData = this.parsePrintData(response);
28
- const pendingPrints = await this.processDirectPrint(printJobData);
29
- if (!pendingPrints.length)
30
- return;
31
- this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
27
+ Promise.resolve(this.DataFetcher).then(async (res) => {
28
+ res = await Promise.resolve(this.DataFetcher);
29
+ while (!res || !res.application) {
30
+ res = await Promise.resolve(this.DataFetcher);
31
+ }
32
+ const response = await res.application.callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
33
+ const printJobData = this.parsePrintData(response);
34
+ const pendingPrints = await this.processDirectPrint(printJobData);
35
+ if (!pendingPrints.length)
36
+ return;
37
+ this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
38
+ });
32
39
  }
33
40
  getLocalPrinters() {
34
41
  const localPrinters = this.appletImpressao.findLocalPrinters();
@@ -125,7 +132,9 @@ export class PrintUtils {
125
132
  }
126
133
  }
127
134
  };
128
- await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
135
+ Promise.resolve(this.DataFetcher).then(async (res) => {
136
+ await res.application.callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
137
+ });
129
138
  }
130
139
  async processDirectPrint(printJobData) {
131
140
  const isWCRunning = this.appletImpressao.checkWebConnection();
@@ -22,4 +22,33 @@ export default class UrlUtils {
22
22
  return window['mock_url'];
23
23
  return `${location.protocol}//${location.hostname}${location.port ? ":" + location.port : ""}`;
24
24
  }
25
+ /**
26
+ * Extrai da URL o parâmetro que contém o resourceId da tela desejada.
27
+ *
28
+ */
29
+ static getResourceIdFromUrlToken(url) {
30
+ try {
31
+ const parts = url.split('/');
32
+ const encodedValue = parts[1];
33
+ return atob(encodedValue);
34
+ }
35
+ catch (error) {
36
+ throw new Error('Erro ao obter resourceId:' + error);
37
+ }
38
+ }
39
+ /**
40
+ * Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
41
+ *
42
+ */
43
+ static getPkObjectFromUrlToken(url) {
44
+ try {
45
+ const parts = url.split('/');
46
+ const encodedObjectPart = parts[parts.length - 2];
47
+ const decodedObjectPart = atob(encodedObjectPart);
48
+ return JSON.parse(decodedObjectPart);
49
+ }
50
+ catch (error) {
51
+ throw new Error('Erro ao obter a PK do objeto:' + error);
52
+ }
53
+ }
25
54
  }
@@ -1,9 +1,132 @@
1
- import { ApplicationContext } from '@sankhyalabs/core';
2
- import { F as FormConfigFetcher } from './form-config-fetcher.js';
3
- import { R as ResourceFetcher } from './resource-fetcher.js';
4
- import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
1
+ import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum.js';
5
3
  import { d as dist, D as DataFetcher } from './DataFetcher.js';
6
4
 
5
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
6
+ var t = {};
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
8
+ t[p] = s[p];
9
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
10
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
11
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
12
+ t[p[i]] = s[p[i]];
13
+ }
14
+ return t;
15
+ };
16
+ function normalizeValue(value, type) {
17
+ if (value == undefined) {
18
+ return value;
19
+ }
20
+ if (value instanceof Date) {
21
+ return value.toISOString();
22
+ }
23
+ if (typeof value === "object") {
24
+ if (value instanceof Array) {
25
+ return value.map(item => {
26
+ if (FilterItemType.MULTI_LIST === type) {
27
+ const values = __rest(item, ["label"]);
28
+ return normalizeValue(values);
29
+ }
30
+ return normalizeValue(item);
31
+ });
32
+ }
33
+ else {
34
+ const normalized = Object.assign({}, value);
35
+ Object.keys(value).forEach(prop => {
36
+ if (value[prop] !== undefined) {
37
+ normalized[prop] = normalizeValue(value[prop], type);
38
+ }
39
+ else {
40
+ delete normalized[prop];
41
+ }
42
+ });
43
+ return normalized;
44
+ }
45
+ }
46
+ return value;
47
+ }
48
+ class FilterBarConfigFetcher extends ResourceFetcher {
49
+ normalize(items) {
50
+ return items.map(item => {
51
+ const { id, value, fixed, visible, type, groupedItems } = item;
52
+ const stateItem = { id };
53
+ if (value) {
54
+ stateItem["value"] = normalizeValue(value, type);
55
+ }
56
+ if (fixed) {
57
+ stateItem["fixed"] = fixed;
58
+ }
59
+ if (groupedItems) {
60
+ if (groupedItems.length === 0) {
61
+ return;
62
+ }
63
+ if (groupedItems.filter(item => item.visible).length > 0) {
64
+ stateItem["visible"] = true;
65
+ }
66
+ stateItem["groupedItems"] = this.normalize(groupedItems);
67
+ }
68
+ else {
69
+ if (visible) {
70
+ stateItem["visible"] = true;
71
+ }
72
+ }
73
+ return stateItem;
74
+ }).filter(item => item != undefined);
75
+ }
76
+ saveConfig(items, resourceID, configName) {
77
+ return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
78
+ }
79
+ getConfig(resourceID, configName, urlParams) {
80
+ return new Promise((accept, reject) => {
81
+ this.loadResource(this.getPath(resourceID, configName, urlParams))
82
+ .then((configAsString) => {
83
+ let fieldsList;
84
+ if (configAsString) {
85
+ const filterBarConfig = JSON.parse(configAsString);
86
+ fieldsList = this.buildFieldList(filterBarConfig.items);
87
+ }
88
+ accept(fieldsList || []);
89
+ })
90
+ .catch((error) => {
91
+ reject(error);
92
+ });
93
+ });
94
+ }
95
+ buildFieldList(items) {
96
+ return items.map(item => {
97
+ var _a, _b;
98
+ if (item.type === FilterItemType.MULTI_LIST) {
99
+ const multiListValue = item.value;
100
+ item.value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
101
+ }
102
+ return item;
103
+ });
104
+ }
105
+ getPath(resourceID, name, urlParams) {
106
+ let path = `cfg://filter/FilterBarState:${resourceID}`;
107
+ if (name) {
108
+ path += `.${name}`;
109
+ }
110
+ if (urlParams) {
111
+ path += this.buildQueryString(urlParams);
112
+ }
113
+ return path;
114
+ }
115
+ buildQueryString(urlParams) {
116
+ let queryString = '?';
117
+ for (let key in urlParams) {
118
+ if (!urlParams.hasOwnProperty(key)) {
119
+ continue;
120
+ }
121
+ if (queryString.length > 1) {
122
+ queryString += '&';
123
+ }
124
+ queryString += key + '=' + urlParams[key];
125
+ }
126
+ return queryString;
127
+ }
128
+ }
129
+
7
130
  class GridConfigFetcher extends ResourceFetcher {
8
131
  constructor() {
9
132
  super(...arguments);
@@ -218,83 +341,73 @@ const CONFIG_SOURCE = {
218
341
  filterBar: "filterBar"
219
342
  };
220
343
  class ConfigStorage {
221
- static async get() {
222
- if (!ConfigStorage.instance) {
223
- const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
224
- if (application != undefined) {
225
- const configName = application.configName;
226
- const resourceID = await application.getResourceID();
227
- ConfigStorage.instance = new ConfigStorage();
228
- ConfigStorage.resourceID = resourceID;
229
- ConfigStorage.instance.loadFormConfig(configName);
230
- ConfigStorage.instance.loadGridConfig(configName);
231
- }
232
- }
233
- return this.instance;
344
+ static preload(resourceID, configName) {
345
+ ConfigStorage.loadFormConfig(configName, resourceID);
346
+ ConfigStorage.loadGridConfig(configName, resourceID);
234
347
  }
235
- async loadFilterBarConfig(name, urlParams) {
236
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
348
+ static async loadFilterBarConfig(name, resourceID, urlParams) {
349
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
237
350
  if (!ConfigStorage.configById.has(cacheID)) {
238
- ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
351
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
239
352
  }
240
353
  return ConfigStorage.configById.get(cacheID);
241
354
  }
242
- async loadFormConfig(name) {
243
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
355
+ static async loadFormConfig(name, resourceID) {
356
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
244
357
  if (!ConfigStorage.configById.has(cacheID)) {
245
- ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
358
+ ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
246
359
  }
247
360
  return ConfigStorage.configById.get(cacheID);
248
361
  }
249
- async loadGridConfig(name) {
250
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
362
+ static async loadGridConfig(name, resourceID) {
363
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
251
364
  if (!ConfigStorage.configById.has(cacheID)) {
252
- ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
365
+ ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
253
366
  }
254
367
  return ConfigStorage.configById.get(cacheID);
255
368
  }
256
- static async saveFilterBarConfig(config, name) {
257
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
369
+ static async saveFilterBarConfig(config, name, resourceID) {
370
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
258
371
  this.configById.delete(cacheID);
259
- return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
372
+ return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
260
373
  }
261
- static async saveFormConfig(config, name) {
262
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
374
+ static async saveFormConfig(config, name, resourceID) {
375
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
263
376
  this.configById.delete(cacheID);
264
- return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
377
+ return this.formConfigFetcher.saveConfig(config, name, resourceID);
265
378
  }
266
- static async saveCardState(config, name) {
267
- return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
379
+ static async saveCardState(config, name, resourceID) {
380
+ return this.formConfigFetcher.saveCardState(config, name, resourceID);
268
381
  }
269
- static async saveGridConfig(config, name) {
382
+ static async saveGridConfig(config, name, resourceID) {
270
383
  if (config == undefined) {
271
384
  return;
272
385
  }
273
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
386
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
274
387
  this.configById.delete(cacheID);
275
- return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
388
+ return this.gridConfigFetcher.saveConfig(config, name, resourceID);
276
389
  }
277
- static async loadPersonalizedFilter(filterId, configName) {
278
- return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
390
+ static async loadPersonalizedFilter(filterId, resourceID, configName) {
391
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
279
392
  }
280
- static async savePersonalizedFilter(personalizedFilter, configName) {
393
+ static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
281
394
  //Ao criar ou alterar um filtro personalizado,
282
395
  //precisamos remover o cache do status da filterbar.
283
- const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
396
+ const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar, resourceID);
284
397
  this.configById.delete(cacheID);
285
- return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
398
+ return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
286
399
  }
287
- static async removePersonalizedFilter(personalizedFilter, configName) {
288
- return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
400
+ static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
401
+ return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
289
402
  }
290
403
  static async validatePersonalizedFilter(dataUnitName, expression) {
291
404
  return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
292
405
  }
293
- static buildCacheID(name, source) {
406
+ static buildCacheID(name, source, resourceID) {
294
407
  if (name == undefined) {
295
- return `req_${source}_${this.resourceID}`;
408
+ return `req_${source}_${resourceID}`;
296
409
  }
297
- return `req_${source}_${name}_${this.resourceID}`;
410
+ return `req_${source}_${name}_${resourceID}`;
298
411
  }
299
412
  }
300
413
  ConfigStorage.configById = new Map();
@@ -303,4 +416,4 @@ ConfigStorage.formConfigFetcher = new FormConfigFetcher();
303
416
  ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
304
417
  ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
305
418
 
306
- export { ConfigStorage as C, GridConfigFetcher as G, PersonalizedFilterFetcher as P };
419
+ export { ConfigStorage as C, PersonalizedFilterFetcher as P };