@sankhyalabs/sankhyablocks 8.3.2 → 8.4.0-dev.2

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-4dd5e72c.js → ConfigStorage-0e4275f5.js} +163 -51
  2. package/dist/cjs/{DataFetcher-65199c00.js → DataFetcher-bd3d53a8.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-44717597.js → SnkFormConfigManager-5b485cd4.js} +19 -21
  7. package/dist/cjs/{auth-fetcher-7ed6d3e3.js → auth-fetcher-1583fe43.js} +2 -2
  8. package/dist/cjs/{dataunit-fetcher-102030d8.js → dataunit-fetcher-910be4ce.js} +1 -1
  9. package/dist/cjs/{form-config-fetcher-49993843.js → form-config-fetcher-f6cb55e6.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-23adae20.js → pesquisa-fetcher-3356b3df.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-83cd2f15.js → snk-guides-viewer-5e22097d.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-d0e26692.js → ConfigStorage-f359573c.js} +162 -49
  106. package/dist/esm/{DataFetcher-4f5ad71c.js → DataFetcher-8daff9ad.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-457554ca.js → SnkFormConfigManager-35876bad.js} +19 -21
  111. package/dist/esm/{auth-fetcher-852e26c9.js → auth-fetcher-299fed55.js} +1 -1
  112. package/dist/esm/{dataunit-fetcher-97dd5148.js → dataunit-fetcher-bd8f9572.js} +1 -1
  113. package/dist/esm/{form-config-fetcher-ff72a867.js → form-config-fetcher-8ef7be16.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-d82df64b.js → pesquisa-fetcher-27819123.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-202c3c4d.js → snk-guides-viewer-b0e32a7d.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-0df2ead8.entry.js +11 -0
  145. package/dist/sankhyablocks/p-324ce41e.entry.js +1 -0
  146. package/dist/sankhyablocks/p-34604220.entry.js +1 -0
  147. package/dist/sankhyablocks/p-648a7c72.entry.js +1 -0
  148. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  149. package/dist/sankhyablocks/p-6a38bda5.entry.js +1 -0
  150. package/dist/sankhyablocks/p-72fc257b.entry.js +1 -0
  151. package/dist/sankhyablocks/p-7bcd2f89.js +56 -0
  152. package/dist/sankhyablocks/p-7bd5aea7.js +1 -0
  153. package/dist/sankhyablocks/p-8014cc25.entry.js +1 -0
  154. package/dist/sankhyablocks/p-8d884fab.js +1 -0
  155. package/dist/sankhyablocks/p-928efcaa.entry.js +1 -0
  156. package/dist/sankhyablocks/p-989937ee.entry.js +1 -0
  157. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  158. package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
  159. package/dist/sankhyablocks/p-a7ee0e6f.entry.js +1 -0
  160. package/dist/sankhyablocks/p-ac0556a3.js +1 -0
  161. package/dist/sankhyablocks/p-af2d9aea.entry.js +1 -0
  162. package/dist/sankhyablocks/{p-435259af.js → p-b13cb8b5.js} +2 -2
  163. package/dist/sankhyablocks/p-b244640b.js +1 -0
  164. package/dist/sankhyablocks/p-bba91710.entry.js +1 -0
  165. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  166. package/dist/sankhyablocks/p-c870b530.js +26 -0
  167. package/dist/sankhyablocks/{p-a2493d11.js → p-c9841939.js} +1 -1
  168. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  169. package/dist/sankhyablocks/p-d708b4ab.entry.js +1 -0
  170. package/dist/sankhyablocks/p-d84bc5c1.js +1 -0
  171. package/dist/sankhyablocks/{p-7d9302e2.js → p-de76b8a8.js} +1 -1
  172. package/dist/sankhyablocks/p-e19014a9.entry.js +1 -0
  173. package/dist/sankhyablocks/p-e1cb1f0b.js +1 -0
  174. package/dist/sankhyablocks/p-e9b53a9a.entry.js +1 -0
  175. package/dist/sankhyablocks/p-ebf8c5df.entry.js +1 -0
  176. package/dist/sankhyablocks/p-ed5f1204.entry.js +1 -0
  177. package/dist/sankhyablocks/p-f94b999e.entry.js +1 -0
  178. package/dist/sankhyablocks/p-fb1ecd0b.entry.js +1 -0
  179. package/dist/sankhyablocks/p-fd15aaac.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-2ab64f92.js +0 -155
  218. package/dist/cjs/resource-fetcher-8d12fee7.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-1093db95.js +0 -153
  222. package/dist/esm/resource-fetcher-be4d1ba4.js +0 -66
  223. package/dist/sankhyablocks/p-030a2da4.entry.js +0 -1
  224. package/dist/sankhyablocks/p-1208becf.entry.js +0 -1
  225. package/dist/sankhyablocks/p-17724bee.entry.js +0 -1
  226. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  227. package/dist/sankhyablocks/p-37b17041.js +0 -1
  228. package/dist/sankhyablocks/p-3916c825.entry.js +0 -1
  229. package/dist/sankhyablocks/p-3ffad8ca.entry.js +0 -1
  230. package/dist/sankhyablocks/p-44fe945a.entry.js +0 -1
  231. package/dist/sankhyablocks/p-4fc5a0db.entry.js +0 -1
  232. package/dist/sankhyablocks/p-564efc43.js +0 -1
  233. package/dist/sankhyablocks/p-5add4151.entry.js +0 -1
  234. package/dist/sankhyablocks/p-5de83141.entry.js +0 -1
  235. package/dist/sankhyablocks/p-6be9191f.entry.js +0 -1
  236. package/dist/sankhyablocks/p-6ee5d42c.js +0 -1
  237. package/dist/sankhyablocks/p-72d7f00c.js +0 -56
  238. package/dist/sankhyablocks/p-7352acf8.entry.js +0 -1
  239. package/dist/sankhyablocks/p-8115f7a2.js +0 -1
  240. package/dist/sankhyablocks/p-8903ffc6.js +0 -1
  241. package/dist/sankhyablocks/p-8dbb4c6c.entry.js +0 -11
  242. package/dist/sankhyablocks/p-935bfc1c.entry.js +0 -1
  243. package/dist/sankhyablocks/p-9395cf73.entry.js +0 -1
  244. package/dist/sankhyablocks/p-9d36d914.js +0 -17
  245. package/dist/sankhyablocks/p-aa6f27bd.entry.js +0 -1
  246. package/dist/sankhyablocks/p-aeaa5253.js +0 -10
  247. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  248. package/dist/sankhyablocks/p-c1273e40.js +0 -1
  249. package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
  250. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  251. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  252. package/dist/sankhyablocks/p-f5c33da3.entry.js +0 -1
  253. package/dist/sankhyablocks/p-f847d53a.entry.js +0 -1
@@ -1,8 +1,6 @@
1
- import { ApplicationContext } from '@sankhyalabs/core';
2
- import { F as FormConfigFetcher } from './form-config-fetcher-ff72a867.js';
3
- import { R as ResourceFetcher } from './resource-fetcher-be4d1ba4.js';
4
- import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher-1093db95.js';
5
- import { d as dist, D as DataFetcher } from './DataFetcher-4f5ad71c.js';
1
+ import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-8ef7be16.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
3
+ import { d as dist, D as DataFetcher } from './DataFetcher-8daff9ad.js';
6
4
 
7
5
  class GridConfigFetcher extends ResourceFetcher {
8
6
  constructor() {
@@ -44,6 +42,131 @@ class GridConfigFetcher extends ResourceFetcher {
44
42
  }
45
43
  }
46
44
 
45
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ function normalizeValue(value, type) {
57
+ if (value == undefined) {
58
+ return value;
59
+ }
60
+ if (value instanceof Date) {
61
+ return value.toISOString();
62
+ }
63
+ if (typeof value === "object") {
64
+ if (value instanceof Array) {
65
+ return value.map(item => {
66
+ if (FilterItemType.MULTI_LIST === type) {
67
+ const values = __rest(item, ["label"]);
68
+ return normalizeValue(values);
69
+ }
70
+ return normalizeValue(item);
71
+ });
72
+ }
73
+ else {
74
+ const normalized = Object.assign({}, value);
75
+ Object.keys(value).forEach(prop => {
76
+ if (value[prop] !== undefined) {
77
+ normalized[prop] = normalizeValue(value[prop], type);
78
+ }
79
+ else {
80
+ delete normalized[prop];
81
+ }
82
+ });
83
+ return normalized;
84
+ }
85
+ }
86
+ return value;
87
+ }
88
+ class FilterBarConfigFetcher extends ResourceFetcher {
89
+ normalize(items) {
90
+ return items.map(item => {
91
+ const { id, value, fixed, visible, type, groupedItems } = item;
92
+ const stateItem = { id };
93
+ if (value) {
94
+ stateItem["value"] = normalizeValue(value, type);
95
+ }
96
+ if (fixed) {
97
+ stateItem["fixed"] = fixed;
98
+ }
99
+ if (groupedItems) {
100
+ if (groupedItems.length === 0) {
101
+ return;
102
+ }
103
+ if (groupedItems.filter(item => item.visible).length > 0) {
104
+ stateItem["visible"] = true;
105
+ }
106
+ stateItem["groupedItems"] = this.normalize(groupedItems);
107
+ }
108
+ else {
109
+ if (visible) {
110
+ stateItem["visible"] = true;
111
+ }
112
+ }
113
+ return stateItem;
114
+ }).filter(item => item != undefined);
115
+ }
116
+ saveConfig(items, resourceID, configName) {
117
+ return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
118
+ }
119
+ getConfig(resourceID, configName, urlParams) {
120
+ return new Promise((accept, reject) => {
121
+ this.loadResource(this.getPath(resourceID, configName, urlParams))
122
+ .then((configAsString) => {
123
+ let fieldsList;
124
+ if (configAsString) {
125
+ const filterBarConfig = JSON.parse(configAsString);
126
+ fieldsList = this.buildFieldList(filterBarConfig.items);
127
+ }
128
+ accept(fieldsList || []);
129
+ })
130
+ .catch((error) => {
131
+ reject(error);
132
+ });
133
+ });
134
+ }
135
+ buildFieldList(items) {
136
+ return items.map(item => {
137
+ var _a, _b;
138
+ if (item.type === FilterItemType.MULTI_LIST) {
139
+ const multiListValue = item.value;
140
+ 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;
141
+ }
142
+ return item;
143
+ });
144
+ }
145
+ getPath(resourceID, name, urlParams) {
146
+ let path = `cfg://filter/FilterBarState:${resourceID}`;
147
+ if (name) {
148
+ path += `.${name}`;
149
+ }
150
+ if (urlParams) {
151
+ path += this.buildQueryString(urlParams);
152
+ }
153
+ return path;
154
+ }
155
+ buildQueryString(urlParams) {
156
+ let queryString = '?';
157
+ for (let key in urlParams) {
158
+ if (!urlParams.hasOwnProperty(key)) {
159
+ continue;
160
+ }
161
+ if (queryString.length > 1) {
162
+ queryString += '&';
163
+ }
164
+ queryString += key + '=' + urlParams[key];
165
+ }
166
+ return queryString;
167
+ }
168
+ }
169
+
47
170
  class PersonalizedFilterFetcher {
48
171
  constructor() {
49
172
  this.templateByQuery = new Map();
@@ -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 };
@@ -1,6 +1,7 @@
1
- import { DataType, StringUtils, ApplicationContext, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
1
+ import { DataType, ApplicationContext, ErrorException, WarningException, ObjectUtils, StringUtils } from '@sankhyalabs/core';
2
2
  import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-9943807e.js';
3
3
  import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
+ import { P as PrintUtils } from './PrintUtils-3e4ff0f5.js';
4
5
 
5
6
  var browserPonyfill = createCommonjsModule(function (module, exports) {
6
7
  var global = typeof self !== 'undefined' ? self : commonjsGlobal;
@@ -6434,6 +6435,35 @@ class UrlUtils {
6434
6435
  return window['mock_url'];
6435
6436
  return `${location.protocol}//${location.hostname}${location.port ? ":" + location.port : ""}`;
6436
6437
  }
6438
+ /**
6439
+ * Extrai da URL o parâmetro que contém o resourceId da tela desejada.
6440
+ *
6441
+ */
6442
+ static getResourceIdFromUrlToken(url) {
6443
+ try {
6444
+ const parts = url.split('/');
6445
+ const encodedValue = parts[1];
6446
+ return atob(encodedValue);
6447
+ }
6448
+ catch (error) {
6449
+ throw new Error('Erro ao obter resourceId:' + error);
6450
+ }
6451
+ }
6452
+ /**
6453
+ * Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
6454
+ *
6455
+ */
6456
+ static getPkObjectFromUrlToken(url) {
6457
+ try {
6458
+ const parts = url.split('/');
6459
+ const encodedObjectPart = parts[parts.length - 2];
6460
+ const decodedObjectPart = atob(encodedObjectPart);
6461
+ return JSON.parse(decodedObjectPart);
6462
+ }
6463
+ catch (error) {
6464
+ throw new Error('Erro ao obter a PK do objeto:' + error);
6465
+ }
6466
+ }
6437
6467
  }
6438
6468
 
6439
6469
  class ServiceBrokerRecaller {
@@ -6477,206 +6507,6 @@ class GraphQLRecaller {
6477
6507
  }
6478
6508
  }
6479
6509
 
6480
- class PrintUtils {
6481
- constructor() {
6482
- this.appletImpressao = new AppletImpressao();
6483
- }
6484
- static getInstance() {
6485
- if (!PrintUtils.instance) {
6486
- PrintUtils.instance = new PrintUtils();
6487
- }
6488
- return PrintUtils.instance;
6489
- }
6490
- async processPendingPrinting(transactionId) {
6491
- await this.findPendingPrints(transactionId);
6492
- }
6493
- async findPendingPrints(transactionId) {
6494
- const requestBody = {
6495
- transactionIds: [
6496
- {
6497
- transactionId: {
6498
- $: transactionId
6499
- }
6500
- }
6501
- ]
6502
- };
6503
- const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
6504
- const printJobData = this.parsePrintData(response);
6505
- const pendingPrints = await this.processDirectPrint(printJobData);
6506
- if (!pendingPrints.length)
6507
- return;
6508
- this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
6509
- }
6510
- getLocalPrinters() {
6511
- const localPrinters = this.appletImpressao.findLocalPrinters();
6512
- const printers = [];
6513
- for (const printerName of localPrinters) {
6514
- printers.push({
6515
- nome: printerName,
6516
- printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
6517
- isLocal: true
6518
- });
6519
- }
6520
- return printers;
6521
- }
6522
- parsePrintData(payload) {
6523
- const pendingPrintJobData = payload.pendindPrintJobData;
6524
- if (!pendingPrintJobData)
6525
- return undefined;
6526
- let { printServers: { printServer }, pendingPrinters: { pendingPrinter } } = pendingPrintJobData;
6527
- printServer = printServer ? (Array.isArray(printServer) ? printServer : [printServer]) : [];
6528
- pendingPrinter = pendingPrinter ? (Array.isArray(pendingPrinter) ? pendingPrinter : [pendingPrinter]) : [];
6529
- const normalizedPrintServer = printServer.map(item => {
6530
- const printerList = Array.isArray(item.printerLocation) ? item.printerLocation : [item.printerLocation];
6531
- return {
6532
- printServerUri: item.printServerUri,
6533
- printerList: printerList.map(this.normalize)
6534
- };
6535
- });
6536
- const normalizedPendingPrinter = pendingPrinter.map(this.normalize);
6537
- return {
6538
- transactionId: pendingPrintJobData.transactionId.$,
6539
- printServers: normalizedPrintServer,
6540
- pendingPrinters: normalizedPendingPrinter,
6541
- printServerActive: pendingPrintJobData.printServers.printServerActive === 'true'
6542
- };
6543
- }
6544
- normalize(object) {
6545
- const normalizedObject = {};
6546
- Object.keys(object).forEach((key) => {
6547
- normalizedObject[key] = PrintUtils.ENCODED_PROPERTIES.includes(key) ? window.atob(object[key].$) : object[key].$;
6548
- });
6549
- return normalizedObject;
6550
- }
6551
- processLocalPrinting(localPrintings) {
6552
- const transactionIds = localPrintings.map((item) => item.transactionId);
6553
- this.appletImpressao.doLocalPrinting(transactionIds.join());
6554
- }
6555
- async openSnkPrintSelector(printJobData) {
6556
- let printSelector = document.querySelector('snk-print-selector');
6557
- if (!printSelector) {
6558
- printSelector = document.createElement('snk-print-selector');
6559
- printSelector.setAttribute('id', StringUtils.generateUUID());
6560
- window.document.body.appendChild(printSelector);
6561
- }
6562
- const { selectedPrinter, saveSubstitute } = await printSelector.openPrintSelector(printJobData);
6563
- if (!selectedPrinter)
6564
- return;
6565
- const params = {
6566
- transactionId: printJobData.transactionId,
6567
- pendingPrinters: printJobData.pendingPrinters,
6568
- printerUri: selectedPrinter.printerUri,
6569
- saveSubstitutePrinters: saveSubstitute
6570
- };
6571
- await this.saveSubstitutePrinter(params);
6572
- }
6573
- async saveSubstitutePrinter(params) {
6574
- const { transactionId, pendingPrinters, printerUri, saveSubstitutePrinters = false } = params;
6575
- const parsedPendingPrinters = pendingPrinters.map((item) => ({
6576
- printerUri: {
6577
- $: item.printerUri || printerUri
6578
- },
6579
- originalPrinterName: {
6580
- $: item.originalPrinterName
6581
- },
6582
- printJobCount: {
6583
- $: item.printJobCount
6584
- },
6585
- docType: {
6586
- $: item.docType
6587
- },
6588
- docTypeDescription: {
6589
- $: item.docTypeDescription
6590
- }
6591
- }));
6592
- const requestBody = {
6593
- substitutePrintersRequest: {
6594
- substitutePrinters: {
6595
- pendingPrinter: parsedPendingPrinters
6596
- },
6597
- saveSubstitutePrinters: {
6598
- $: saveSubstitutePrinters.toString()
6599
- },
6600
- transactionId: {
6601
- $: transactionId
6602
- }
6603
- }
6604
- };
6605
- await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
6606
- }
6607
- async processDirectPrint(printJobData) {
6608
- const isWCRunning = this.appletImpressao.checkWebConnection();
6609
- if (!isWCRunning) {
6610
- return [];
6611
- }
6612
- const localPrinters = this.getLocalPrinters();
6613
- if (!localPrinters.length)
6614
- return [];
6615
- const directPendingPrints = [];
6616
- const pendingPrints = printJobData.pendingPrinters.filter(item => {
6617
- const defaultPrinterName = this.getDefaultPrinterName(item.originalPrinterName);
6618
- const isDirectPrint = !!localPrinters.find(localPrinter => localPrinter.nome === defaultPrinterName) || this.isPrinterNameAFile(defaultPrinterName);
6619
- if (isDirectPrint) {
6620
- directPendingPrints.push(Object.assign(Object.assign({}, item), { printerUri: PrintUtils.LOCAL_SERVER_URI + defaultPrinterName }));
6621
- return false;
6622
- }
6623
- return true;
6624
- });
6625
- if (!directPendingPrints.length)
6626
- return pendingPrints;
6627
- const params = {
6628
- transactionId: printJobData.transactionId,
6629
- pendingPrinters: directPendingPrints
6630
- };
6631
- await this.saveSubstitutePrinter(params);
6632
- return pendingPrints;
6633
- }
6634
- getDefaultPrinterName(printerName) {
6635
- const defaultPrinterName = this.appletImpressao.getDefaultPrinter();
6636
- const isDefaultPrinterName = /padr[aã]o/ig.test(printerName);
6637
- return (defaultPrinterName && isDefaultPrinterName) ? defaultPrinterName : printerName;
6638
- }
6639
- isPrinterNameAFile(printerName) {
6640
- const regExp = new RegExp("^(\w:)?[/\\\w\s]+?\.\w{3}$", "mis");
6641
- return regExp.test(printerName);
6642
- }
6643
- }
6644
- PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
6645
- PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
6646
- PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
6647
- PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
6648
- class AppletImpressao {
6649
- constructor() {
6650
- this.appletImpressao = document.getElementById('centralNotaAppletImpressao');
6651
- }
6652
- checkWebConnection() {
6653
- if (!this.appletImpressao)
6654
- return false;
6655
- if (!this.appletImpressao.testRunningWC)
6656
- return false;
6657
- const isRunning = this.appletImpressao.testRunningWC();
6658
- return !!isRunning;
6659
- }
6660
- findLocalPrinters() {
6661
- if (!this.appletImpressao)
6662
- return [];
6663
- const localPrinters = this.appletImpressao.getLocalPrinters();
6664
- if (!localPrinters)
6665
- return [];
6666
- return localPrinters.split(",");
6667
- }
6668
- doLocalPrinting(transactionIds) {
6669
- if (!this.appletImpressao)
6670
- return;
6671
- this.appletImpressao.doLocalPrinting(transactionIds);
6672
- }
6673
- getDefaultPrinter() {
6674
- if (!this.appletImpressao)
6675
- return '';
6676
- return this.appletImpressao.getPrintDefault();
6677
- }
6678
- }
6679
-
6680
6510
  var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
6681
6511
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
6682
6512
  var m = o[Symbol.asyncIterator], i;
@@ -6687,6 +6517,7 @@ var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
6687
6517
  class DataFetcher {
6688
6518
  constructor() {
6689
6519
  this.GRAPHQL_PATH = `/${window.MGE_MODULE_NAME || 'mgefin-bff'}/graphql`;
6520
+ this.ready = true;
6690
6521
  this.watingRequestsById = new Map();
6691
6522
  }
6692
6523
  static get() {
@@ -6697,6 +6528,9 @@ class DataFetcher {
6697
6528
  DataFetcher.instance.resume();
6698
6529
  }
6699
6530
  else {
6531
+ if (ApplicationContext.getContextValue("__SNK__APPLICATION__LOADING__") === true) {
6532
+ DataFetcher.instance.pause();
6533
+ }
6700
6534
  application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
6701
6535
  application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
6702
6536
  }
@@ -6755,6 +6589,10 @@ class DataFetcher {
6755
6589
  }
6756
6590
  async callGraphQL(req) {
6757
6591
  var _a;
6592
+ if (this.ready) {
6593
+ this.pause();
6594
+ window.requestAnimationFrame(() => this.resume());
6595
+ }
6758
6596
  const reqKey = this.getReqKey(req);
6759
6597
  req.queryID = reqKey;
6760
6598
  req.values.queryID = reqKey;
@@ -6784,7 +6622,7 @@ class DataFetcher {
6784
6622
  if (!this.watingRequestsById.has(reqKey)) {
6785
6623
  this.watingRequestsById.set(reqKey, new WaitingRequest(req));
6786
6624
  }
6787
- return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6625
+ return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6788
6626
  }
6789
6627
  }
6790
6628
  resolveURL() {
@@ -6867,9 +6705,9 @@ class DataFetcher {
6867
6705
  finally { if (e_1) throw e_1.error; }
6868
6706
  }
6869
6707
  }
6870
- processPrinting(payload) {
6708
+ async processPrinting(payload) {
6871
6709
  if ((payload === null || payload === void 0 ? void 0 : payload.pendingPrinting) === 'true') {
6872
- PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
6710
+ await PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
6873
6711
  }
6874
6712
  if ('localPrintings' in payload) {
6875
6713
  PrintUtils.getInstance().processLocalPrinting(payload === null || payload === void 0 ? void 0 : payload.localPrintings);
@@ -6923,6 +6761,13 @@ class DataFetcher {
6923
6761
  try {
6924
6762
  const jsonResp = JSON.parse(http.responseText);
6925
6763
  await this.processServiceBrokerClientEvents({ clientEvents: jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject });
6764
+ /**
6765
+ * 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.
6766
+ *
6767
+ * Descrição do caso de uso:
6768
+ * 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.
6769
+ */
6770
+ await this.processPrinting(jsonResp);
6926
6771
  if (this.isServiceBrokerError(jsonResp)) {
6927
6772
  reject(this.processServiceBrokerErrorInfo(jsonResp));
6928
6773
  }
@@ -6935,7 +6780,6 @@ class DataFetcher {
6935
6780
  (_a = this.application) === null || _a === void 0 ? void 0 : _a.info(jsonResp.statusMessage);
6936
6781
  }
6937
6782
  }
6938
- this.processPrinting(jsonResp);
6939
6783
  }
6940
6784
  catch (err) {
6941
6785
  console.warn(`Erro ao executar serviço: ${err}`);
@@ -6979,42 +6823,43 @@ class DataFetcher {
6979
6823
  getQueryTemplate(re) {
6980
6824
  return (re.query || "").replaceAll("$queryAlias$", re.queryID);
6981
6825
  }
6982
- getWatingRequest(reqID) {
6983
- return this.watingRequestsById.get(reqID);
6984
- }
6985
6826
  pause() {
6986
6827
  this.ready = false;
6987
6828
  }
6988
6829
  async resume() {
6989
6830
  this.ready = true;
6990
6831
  if (this.watingRequestsById.size > 0) {
6991
- const requestsBatch = [];
6992
- this.watingRequestsById.forEach(async (waitingReq) => {
6993
- let query = this.getQueryTemplate(waitingReq.request);
6994
- requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6995
- });
6996
- let res = undefined;
6997
- let dataResponse = [];
6998
- let errorsResponse = [];
6999
- res = await this.fecthGrapql(requestsBatch);
7000
- dataResponse = res.data;
7001
- errorsResponse = res.errors;
7002
- //Reject promises with errors from query
7003
- errorsResponse.forEach((errorResponse) => {
7004
- Object.entries(errorResponse).forEach(([_key, val]) => {
7005
- var _a;
7006
- (((_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));
7007
- });
6832
+ const waitinRequests = this.watingRequestsById;
6833
+ this.watingRequestsById = new Map();
6834
+ this.executePendingRequest(waitinRequests);
6835
+ }
6836
+ }
6837
+ async executePendingRequest(watingRequestsById) {
6838
+ const requestsBatch = [];
6839
+ watingRequestsById.forEach(async (waitingReq) => {
6840
+ let query = this.getQueryTemplate(waitingReq.request);
6841
+ requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6842
+ });
6843
+ let res = undefined;
6844
+ let dataResponse = [];
6845
+ let errorsResponse = [];
6846
+ res = await this.fecthGrapql(requestsBatch);
6847
+ dataResponse = res.data;
6848
+ errorsResponse = res.errors;
6849
+ //Reject promises with errors from query
6850
+ errorsResponse.forEach((errorResponse) => {
6851
+ Object.entries(errorResponse).forEach(([_key, val]) => {
6852
+ var _a;
6853
+ (((_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));
7008
6854
  });
7009
- //Resolve promises with data from query
7010
- dataResponse.forEach((data) => {
7011
- Object.entries(data).forEach(([key, val]) => {
7012
- var _a;
7013
- (((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
7014
- });
6855
+ });
6856
+ //Resolve promises with data from query
6857
+ dataResponse.forEach((data) => {
6858
+ Object.entries(data).forEach(([key, val]) => {
6859
+ var _a;
6860
+ (((_a = watingRequestsById.get(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
7015
6861
  });
7016
- this.watingRequestsById.clear();
7017
- }
6862
+ });
7018
6863
  }
7019
6864
  async fecthGrapql(request) {
7020
6865
  let res = undefined;
@@ -7133,4 +6978,4 @@ class WaitingRequest {
7133
6978
  }
7134
6979
  }
7135
6980
 
7136
- export { DataFetcher as D, PrintUtils as P, UrlUtils as U, dist as d };
6981
+ export { DataFetcher as D, UrlUtils as U, dist as d };
@@ -0,0 +1,8 @@
1
+ var SaveErrorsEnum;
2
+ (function (SaveErrorsEnum) {
3
+ SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
4
+ SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
5
+ SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
6
+ })(SaveErrorsEnum || (SaveErrorsEnum = {}));
7
+
8
+ export { SaveErrorsEnum as S };