@sankhyalabs/sankhyablocks 8.3.1 → 8.4.0-rc.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
@@ -1,12 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const core = require('@sankhyalabs/core');
4
- const formConfigFetcher = require('./form-config-fetcher-f10017bf.js');
5
- const resourceFetcher = require('./resource-fetcher-a6e6c5fd.js');
6
- const filterBarConfigFetcher = require('./filter-bar-config-fetcher-f13a1aff.js');
7
- const DataFetcher = require('./DataFetcher-7694daf2.js');
3
+ const formConfigFetcher = require('./form-config-fetcher-5e3d3b87.js');
4
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
5
+ const DataFetcher = require('./DataFetcher-4798bac3.js');
8
6
 
9
- class GridConfigFetcher extends resourceFetcher.ResourceFetcher {
7
+ class GridConfigFetcher extends formConfigFetcher.ResourceFetcher {
10
8
  constructor() {
11
9
  super(...arguments);
12
10
  this.GRID_CONFIG_VERSION = "V3:";
@@ -46,6 +44,131 @@ class GridConfigFetcher extends resourceFetcher.ResourceFetcher {
46
44
  }
47
45
  }
48
46
 
47
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ };
58
+ function normalizeValue(value, type) {
59
+ if (value == undefined) {
60
+ return value;
61
+ }
62
+ if (value instanceof Date) {
63
+ return value.toISOString();
64
+ }
65
+ if (typeof value === "object") {
66
+ if (value instanceof Array) {
67
+ return value.map(item => {
68
+ if (filterItemType_enum.FilterItemType.MULTI_LIST === type) {
69
+ const values = __rest(item, ["label"]);
70
+ return normalizeValue(values);
71
+ }
72
+ return normalizeValue(item);
73
+ });
74
+ }
75
+ else {
76
+ const normalized = Object.assign({}, value);
77
+ Object.keys(value).forEach(prop => {
78
+ if (value[prop] !== undefined) {
79
+ normalized[prop] = normalizeValue(value[prop], type);
80
+ }
81
+ else {
82
+ delete normalized[prop];
83
+ }
84
+ });
85
+ return normalized;
86
+ }
87
+ }
88
+ return value;
89
+ }
90
+ class FilterBarConfigFetcher extends formConfigFetcher.ResourceFetcher {
91
+ normalize(items) {
92
+ return items.map(item => {
93
+ const { id, value, fixed, visible, type, groupedItems } = item;
94
+ const stateItem = { id };
95
+ if (value) {
96
+ stateItem["value"] = normalizeValue(value, type);
97
+ }
98
+ if (fixed) {
99
+ stateItem["fixed"] = fixed;
100
+ }
101
+ if (groupedItems) {
102
+ if (groupedItems.length === 0) {
103
+ return;
104
+ }
105
+ if (groupedItems.filter(item => item.visible).length > 0) {
106
+ stateItem["visible"] = true;
107
+ }
108
+ stateItem["groupedItems"] = this.normalize(groupedItems);
109
+ }
110
+ else {
111
+ if (visible) {
112
+ stateItem["visible"] = true;
113
+ }
114
+ }
115
+ return stateItem;
116
+ }).filter(item => item != undefined);
117
+ }
118
+ saveConfig(items, resourceID, configName) {
119
+ return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
120
+ }
121
+ getConfig(resourceID, configName, urlParams) {
122
+ return new Promise((accept, reject) => {
123
+ this.loadResource(this.getPath(resourceID, configName, urlParams))
124
+ .then((configAsString) => {
125
+ let fieldsList;
126
+ if (configAsString) {
127
+ const filterBarConfig = JSON.parse(configAsString);
128
+ fieldsList = this.buildFieldList(filterBarConfig.items);
129
+ }
130
+ accept(fieldsList || []);
131
+ })
132
+ .catch((error) => {
133
+ reject(error);
134
+ });
135
+ });
136
+ }
137
+ buildFieldList(items) {
138
+ return items.map(item => {
139
+ var _a, _b;
140
+ if (item.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
141
+ const multiListValue = item.value;
142
+ 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;
143
+ }
144
+ return item;
145
+ });
146
+ }
147
+ getPath(resourceID, name, urlParams) {
148
+ let path = `cfg://filter/FilterBarState:${resourceID}`;
149
+ if (name) {
150
+ path += `.${name}`;
151
+ }
152
+ if (urlParams) {
153
+ path += this.buildQueryString(urlParams);
154
+ }
155
+ return path;
156
+ }
157
+ buildQueryString(urlParams) {
158
+ let queryString = '?';
159
+ for (let key in urlParams) {
160
+ if (!urlParams.hasOwnProperty(key)) {
161
+ continue;
162
+ }
163
+ if (queryString.length > 1) {
164
+ queryString += '&';
165
+ }
166
+ queryString += key + '=' + urlParams[key];
167
+ }
168
+ return queryString;
169
+ }
170
+ }
171
+
49
172
  class PersonalizedFilterFetcher {
50
173
  constructor() {
51
174
  this.templateByQuery = new Map();
@@ -220,91 +343,80 @@ const CONFIG_SOURCE = {
220
343
  filterBar: "filterBar"
221
344
  };
222
345
  class ConfigStorage {
223
- static async get() {
224
- if (!ConfigStorage.instance) {
225
- const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
226
- if (application != undefined) {
227
- const configName = application.configName;
228
- const resourceID = await application.getResourceID();
229
- ConfigStorage.instance = new ConfigStorage();
230
- ConfigStorage.resourceID = resourceID;
231
- ConfigStorage.instance.loadFormConfig(configName);
232
- ConfigStorage.instance.loadGridConfig(configName);
233
- }
234
- }
235
- return this.instance;
346
+ static preload(resourceID, configName) {
347
+ ConfigStorage.loadFormConfig(configName, resourceID);
348
+ ConfigStorage.loadGridConfig(configName, resourceID);
236
349
  }
237
- async loadFilterBarConfig(name, urlParams) {
238
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
350
+ static async loadFilterBarConfig(name, resourceID, urlParams) {
351
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
239
352
  if (!ConfigStorage.configById.has(cacheID)) {
240
- ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
353
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
241
354
  }
242
355
  return ConfigStorage.configById.get(cacheID);
243
356
  }
244
- async loadFormConfig(name) {
245
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
357
+ static async loadFormConfig(name, resourceID) {
358
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
246
359
  if (!ConfigStorage.configById.has(cacheID)) {
247
- ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
360
+ ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
248
361
  }
249
362
  return ConfigStorage.configById.get(cacheID);
250
363
  }
251
- async loadGridConfig(name) {
252
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
364
+ static async loadGridConfig(name, resourceID) {
365
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
253
366
  if (!ConfigStorage.configById.has(cacheID)) {
254
- ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
367
+ ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
255
368
  }
256
369
  return ConfigStorage.configById.get(cacheID);
257
370
  }
258
- static async saveFilterBarConfig(config, name) {
259
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
371
+ static async saveFilterBarConfig(config, name, resourceID) {
372
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
260
373
  this.configById.delete(cacheID);
261
- return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
374
+ return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
262
375
  }
263
- static async saveFormConfig(config, name) {
264
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
376
+ static async saveFormConfig(config, name, resourceID) {
377
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
265
378
  this.configById.delete(cacheID);
266
- return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
379
+ return this.formConfigFetcher.saveConfig(config, name, resourceID);
267
380
  }
268
- static async saveCardState(config, name) {
269
- return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
381
+ static async saveCardState(config, name, resourceID) {
382
+ return this.formConfigFetcher.saveCardState(config, name, resourceID);
270
383
  }
271
- static async saveGridConfig(config, name) {
384
+ static async saveGridConfig(config, name, resourceID) {
272
385
  if (config == undefined) {
273
386
  return;
274
387
  }
275
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
388
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
276
389
  this.configById.delete(cacheID);
277
- return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
390
+ return this.gridConfigFetcher.saveConfig(config, name, resourceID);
278
391
  }
279
- static async loadPersonalizedFilter(filterId, configName) {
280
- return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
392
+ static async loadPersonalizedFilter(filterId, resourceID, configName) {
393
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
281
394
  }
282
- static async savePersonalizedFilter(personalizedFilter, configName) {
395
+ static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
283
396
  //Ao criar ou alterar um filtro personalizado,
284
397
  //precisamos remover o cache do status da filterbar.
285
- const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
398
+ const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar, resourceID);
286
399
  this.configById.delete(cacheID);
287
- return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
400
+ return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
288
401
  }
289
- static async removePersonalizedFilter(personalizedFilter, configName) {
290
- return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
402
+ static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
403
+ return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
291
404
  }
292
405
  static async validatePersonalizedFilter(dataUnitName, expression) {
293
406
  return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
294
407
  }
295
- static buildCacheID(name, source) {
408
+ static buildCacheID(name, source, resourceID) {
296
409
  if (name == undefined) {
297
- return `req_${source}_${this.resourceID}`;
410
+ return `req_${source}_${resourceID}`;
298
411
  }
299
- return `req_${source}_${name}_${this.resourceID}`;
412
+ return `req_${source}_${name}_${resourceID}`;
300
413
  }
301
414
  }
302
415
  ConfigStorage.configById = new Map();
303
- ConfigStorage.filterBarConfigFetcher = new filterBarConfigFetcher.FilterBarConfigFetcher();
416
+ ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
304
417
  ConfigStorage.formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
305
418
  ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
306
419
  ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
307
420
 
308
421
  exports.ConfigStorage = ConfigStorage;
309
- exports.GridConfigFetcher = GridConfigFetcher;
310
422
  exports.PersonalizedFilterFetcher = PersonalizedFilterFetcher;
@@ -3,6 +3,7 @@
3
3
  const core = require('@sankhyalabs/core');
4
4
  const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
5
5
  const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
6
+ const PrintUtils = require('./PrintUtils-bcaeb82f.js');
6
7
 
7
8
  var browserPonyfill = _commonjsHelpers.createCommonjsModule(function (module, exports) {
8
9
  var global = typeof self !== 'undefined' ? self : _commonjsHelpers.commonjsGlobal;
@@ -6436,6 +6437,35 @@ class UrlUtils {
6436
6437
  return window['mock_url'];
6437
6438
  return `${location.protocol}//${location.hostname}${location.port ? ":" + location.port : ""}`;
6438
6439
  }
6440
+ /**
6441
+ * Extrai da URL o parâmetro que contém o resourceId da tela desejada.
6442
+ *
6443
+ */
6444
+ static getResourceIdFromUrlToken(url) {
6445
+ try {
6446
+ const parts = url.split('/');
6447
+ const encodedValue = parts[1];
6448
+ return atob(encodedValue);
6449
+ }
6450
+ catch (error) {
6451
+ throw new Error('Erro ao obter resourceId:' + error);
6452
+ }
6453
+ }
6454
+ /**
6455
+ * Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
6456
+ *
6457
+ */
6458
+ static getPkObjectFromUrlToken(url) {
6459
+ try {
6460
+ const parts = url.split('/');
6461
+ const encodedObjectPart = parts[parts.length - 2];
6462
+ const decodedObjectPart = atob(encodedObjectPart);
6463
+ return JSON.parse(decodedObjectPart);
6464
+ }
6465
+ catch (error) {
6466
+ throw new Error('Erro ao obter a PK do objeto:' + error);
6467
+ }
6468
+ }
6439
6469
  }
6440
6470
 
6441
6471
  class ServiceBrokerRecaller {
@@ -6479,206 +6509,6 @@ class GraphQLRecaller {
6479
6509
  }
6480
6510
  }
6481
6511
 
6482
- class PrintUtils {
6483
- constructor() {
6484
- this.appletImpressao = new AppletImpressao();
6485
- }
6486
- static getInstance() {
6487
- if (!PrintUtils.instance) {
6488
- PrintUtils.instance = new PrintUtils();
6489
- }
6490
- return PrintUtils.instance;
6491
- }
6492
- async processPendingPrinting(transactionId) {
6493
- await this.findPendingPrints(transactionId);
6494
- }
6495
- async findPendingPrints(transactionId) {
6496
- const requestBody = {
6497
- transactionIds: [
6498
- {
6499
- transactionId: {
6500
- $: transactionId
6501
- }
6502
- }
6503
- ]
6504
- };
6505
- const response = await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_FIND_PENDING_PRINTS, JSON.stringify(requestBody));
6506
- const printJobData = this.parsePrintData(response);
6507
- const pendingPrints = await this.processDirectPrint(printJobData);
6508
- if (!pendingPrints.length)
6509
- return;
6510
- this.openSnkPrintSelector(Object.assign(Object.assign({}, printJobData), { pendingPrinters: pendingPrints }));
6511
- }
6512
- getLocalPrinters() {
6513
- const localPrinters = this.appletImpressao.findLocalPrinters();
6514
- const printers = [];
6515
- for (const printerName of localPrinters) {
6516
- printers.push({
6517
- nome: printerName,
6518
- printerUri: PrintUtils.LOCAL_SERVER_URI + printerName,
6519
- isLocal: true
6520
- });
6521
- }
6522
- return printers;
6523
- }
6524
- parsePrintData(payload) {
6525
- const pendingPrintJobData = payload.pendindPrintJobData;
6526
- if (!pendingPrintJobData)
6527
- return undefined;
6528
- let { printServers: { printServer }, pendingPrinters: { pendingPrinter } } = pendingPrintJobData;
6529
- printServer = printServer ? (Array.isArray(printServer) ? printServer : [printServer]) : [];
6530
- pendingPrinter = pendingPrinter ? (Array.isArray(pendingPrinter) ? pendingPrinter : [pendingPrinter]) : [];
6531
- const normalizedPrintServer = printServer.map(item => {
6532
- const printerList = Array.isArray(item.printerLocation) ? item.printerLocation : [item.printerLocation];
6533
- return {
6534
- printServerUri: item.printServerUri,
6535
- printerList: printerList.map(this.normalize)
6536
- };
6537
- });
6538
- const normalizedPendingPrinter = pendingPrinter.map(this.normalize);
6539
- return {
6540
- transactionId: pendingPrintJobData.transactionId.$,
6541
- printServers: normalizedPrintServer,
6542
- pendingPrinters: normalizedPendingPrinter,
6543
- printServerActive: pendingPrintJobData.printServers.printServerActive === 'true'
6544
- };
6545
- }
6546
- normalize(object) {
6547
- const normalizedObject = {};
6548
- Object.keys(object).forEach((key) => {
6549
- normalizedObject[key] = PrintUtils.ENCODED_PROPERTIES.includes(key) ? window.atob(object[key].$) : object[key].$;
6550
- });
6551
- return normalizedObject;
6552
- }
6553
- processLocalPrinting(localPrintings) {
6554
- const transactionIds = localPrintings.map((item) => item.transactionId);
6555
- this.appletImpressao.doLocalPrinting(transactionIds.join());
6556
- }
6557
- async openSnkPrintSelector(printJobData) {
6558
- let printSelector = document.querySelector('snk-print-selector');
6559
- if (!printSelector) {
6560
- printSelector = document.createElement('snk-print-selector');
6561
- printSelector.setAttribute('id', core.StringUtils.generateUUID());
6562
- window.document.body.appendChild(printSelector);
6563
- }
6564
- const { selectedPrinter, saveSubstitute } = await printSelector.openPrintSelector(printJobData);
6565
- if (!selectedPrinter)
6566
- return;
6567
- const params = {
6568
- transactionId: printJobData.transactionId,
6569
- pendingPrinters: printJobData.pendingPrinters,
6570
- printerUri: selectedPrinter.printerUri,
6571
- saveSubstitutePrinters: saveSubstitute
6572
- };
6573
- await this.saveSubstitutePrinter(params);
6574
- }
6575
- async saveSubstitutePrinter(params) {
6576
- const { transactionId, pendingPrinters, printerUri, saveSubstitutePrinters = false } = params;
6577
- const parsedPendingPrinters = pendingPrinters.map((item) => ({
6578
- printerUri: {
6579
- $: item.printerUri || printerUri
6580
- },
6581
- originalPrinterName: {
6582
- $: item.originalPrinterName
6583
- },
6584
- printJobCount: {
6585
- $: item.printJobCount
6586
- },
6587
- docType: {
6588
- $: item.docType
6589
- },
6590
- docTypeDescription: {
6591
- $: item.docTypeDescription
6592
- }
6593
- }));
6594
- const requestBody = {
6595
- substitutePrintersRequest: {
6596
- substitutePrinters: {
6597
- pendingPrinter: parsedPendingPrinters
6598
- },
6599
- saveSubstitutePrinters: {
6600
- $: saveSubstitutePrinters.toString()
6601
- },
6602
- transactionId: {
6603
- $: transactionId
6604
- }
6605
- }
6606
- };
6607
- await DataFetcher.get().callServiceBroker(PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER, JSON.stringify(requestBody));
6608
- }
6609
- async processDirectPrint(printJobData) {
6610
- const isWCRunning = this.appletImpressao.checkWebConnection();
6611
- if (!isWCRunning) {
6612
- return [];
6613
- }
6614
- const localPrinters = this.getLocalPrinters();
6615
- if (!localPrinters.length)
6616
- return [];
6617
- const directPendingPrints = [];
6618
- const pendingPrints = printJobData.pendingPrinters.filter(item => {
6619
- const defaultPrinterName = this.getDefaultPrinterName(item.originalPrinterName);
6620
- const isDirectPrint = !!localPrinters.find(localPrinter => localPrinter.nome === defaultPrinterName) || this.isPrinterNameAFile(defaultPrinterName);
6621
- if (isDirectPrint) {
6622
- directPendingPrints.push(Object.assign(Object.assign({}, item), { printerUri: PrintUtils.LOCAL_SERVER_URI + defaultPrinterName }));
6623
- return false;
6624
- }
6625
- return true;
6626
- });
6627
- if (!directPendingPrints.length)
6628
- return pendingPrints;
6629
- const params = {
6630
- transactionId: printJobData.transactionId,
6631
- pendingPrinters: directPendingPrints
6632
- };
6633
- await this.saveSubstitutePrinter(params);
6634
- return pendingPrints;
6635
- }
6636
- getDefaultPrinterName(printerName) {
6637
- const defaultPrinterName = this.appletImpressao.getDefaultPrinter();
6638
- const isDefaultPrinterName = /padr[aã]o/ig.test(printerName);
6639
- return (defaultPrinterName && isDefaultPrinterName) ? defaultPrinterName : printerName;
6640
- }
6641
- isPrinterNameAFile(printerName) {
6642
- const regExp = new RegExp("^(\w:)?[/\\\w\s]+?\.\w{3}$", "mis");
6643
- return regExp.test(printerName);
6644
- }
6645
- }
6646
- PrintUtils.SERVICE_FIND_PENDING_PRINTS = 'mge@PrintServiceSP.findPendingPrinters';
6647
- PrintUtils.SERVICE_SAVE_SUBSTITUTE_PRINTER = 'mge@PrintServiceSP.saveSubstitutePrinter';
6648
- PrintUtils.LOCAL_SERVER_URI = 'LOCAL:0/';
6649
- PrintUtils.ENCODED_PROPERTIES = ['printerName', 'printerUri'];
6650
- class AppletImpressao {
6651
- constructor() {
6652
- this.appletImpressao = document.getElementById('centralNotaAppletImpressao');
6653
- }
6654
- checkWebConnection() {
6655
- if (!this.appletImpressao)
6656
- return false;
6657
- if (!this.appletImpressao.testRunningWC)
6658
- return false;
6659
- const isRunning = this.appletImpressao.testRunningWC();
6660
- return !!isRunning;
6661
- }
6662
- findLocalPrinters() {
6663
- if (!this.appletImpressao)
6664
- return [];
6665
- const localPrinters = this.appletImpressao.getLocalPrinters();
6666
- if (!localPrinters)
6667
- return [];
6668
- return localPrinters.split(",");
6669
- }
6670
- doLocalPrinting(transactionIds) {
6671
- if (!this.appletImpressao)
6672
- return;
6673
- this.appletImpressao.doLocalPrinting(transactionIds);
6674
- }
6675
- getDefaultPrinter() {
6676
- if (!this.appletImpressao)
6677
- return '';
6678
- return this.appletImpressao.getPrintDefault();
6679
- }
6680
- }
6681
-
6682
6512
  var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
6683
6513
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
6684
6514
  var m = o[Symbol.asyncIterator], i;
@@ -6689,6 +6519,7 @@ var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
6689
6519
  class DataFetcher {
6690
6520
  constructor() {
6691
6521
  this.GRAPHQL_PATH = `/${window.MGE_MODULE_NAME || 'mgefin-bff'}/graphql`;
6522
+ this.ready = true;
6692
6523
  this.watingRequestsById = new Map();
6693
6524
  }
6694
6525
  static get() {
@@ -6699,6 +6530,9 @@ class DataFetcher {
6699
6530
  DataFetcher.instance.resume();
6700
6531
  }
6701
6532
  else {
6533
+ if (core.ApplicationContext.getContextValue("__SNK__APPLICATION__LOADING__") === true) {
6534
+ DataFetcher.instance.pause();
6535
+ }
6702
6536
  application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
6703
6537
  application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
6704
6538
  }
@@ -6757,6 +6591,10 @@ class DataFetcher {
6757
6591
  }
6758
6592
  async callGraphQL(req) {
6759
6593
  var _a;
6594
+ if (this.ready) {
6595
+ this.pause();
6596
+ window.requestAnimationFrame(() => this.resume());
6597
+ }
6760
6598
  const reqKey = this.getReqKey(req);
6761
6599
  req.queryID = reqKey;
6762
6600
  req.values.queryID = reqKey;
@@ -6786,7 +6624,7 @@ class DataFetcher {
6786
6624
  if (!this.watingRequestsById.has(reqKey)) {
6787
6625
  this.watingRequestsById.set(reqKey, new WaitingRequest(req));
6788
6626
  }
6789
- return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6627
+ return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6790
6628
  }
6791
6629
  }
6792
6630
  resolveURL() {
@@ -6869,12 +6707,12 @@ class DataFetcher {
6869
6707
  finally { if (e_1) throw e_1.error; }
6870
6708
  }
6871
6709
  }
6872
- processPrinting(payload) {
6710
+ async processPrinting(payload) {
6873
6711
  if ((payload === null || payload === void 0 ? void 0 : payload.pendingPrinting) === 'true') {
6874
- PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
6712
+ await PrintUtils.PrintUtils.getInstance().processPendingPrinting(payload === null || payload === void 0 ? void 0 : payload.transactionId);
6875
6713
  }
6876
6714
  if ('localPrintings' in payload) {
6877
- PrintUtils.getInstance().processLocalPrinting(payload === null || payload === void 0 ? void 0 : payload.localPrintings);
6715
+ PrintUtils.PrintUtils.getInstance().processLocalPrinting(payload === null || payload === void 0 ? void 0 : payload.localPrintings);
6878
6716
  }
6879
6717
  }
6880
6718
  getContext(module) {
@@ -6925,6 +6763,13 @@ class DataFetcher {
6925
6763
  try {
6926
6764
  const jsonResp = JSON.parse(http.responseText);
6927
6765
  await this.processServiceBrokerClientEvents({ clientEvents: jsonResp === null || jsonResp === void 0 ? void 0 : jsonResp.clientEvents, serviceName, payloadJson, accept, reject });
6766
+ /**
6767
+ * 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.
6768
+ *
6769
+ * Descrição do caso de uso:
6770
+ * 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.
6771
+ */
6772
+ await this.processPrinting(jsonResp);
6928
6773
  if (this.isServiceBrokerError(jsonResp)) {
6929
6774
  reject(this.processServiceBrokerErrorInfo(jsonResp));
6930
6775
  }
@@ -6937,7 +6782,6 @@ class DataFetcher {
6937
6782
  (_a = this.application) === null || _a === void 0 ? void 0 : _a.info(jsonResp.statusMessage);
6938
6783
  }
6939
6784
  }
6940
- this.processPrinting(jsonResp);
6941
6785
  }
6942
6786
  catch (err) {
6943
6787
  console.warn(`Erro ao executar serviço: ${err}`);
@@ -6975,42 +6819,43 @@ class DataFetcher {
6975
6819
  getQueryTemplate(re) {
6976
6820
  return (re.query || "").replaceAll("$queryAlias$", re.queryID);
6977
6821
  }
6978
- getWatingRequest(reqID) {
6979
- return this.watingRequestsById.get(reqID);
6980
- }
6981
6822
  pause() {
6982
6823
  this.ready = false;
6983
6824
  }
6984
6825
  async resume() {
6985
6826
  this.ready = true;
6986
6827
  if (this.watingRequestsById.size > 0) {
6987
- const requestsBatch = [];
6988
- this.watingRequestsById.forEach(async (waitingReq) => {
6989
- let query = this.getQueryTemplate(waitingReq.request);
6990
- requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6991
- });
6992
- let res = undefined;
6993
- let dataResponse = [];
6994
- let errorsResponse = [];
6995
- res = await this.fecthGrapql(requestsBatch);
6996
- dataResponse = res.data;
6997
- errorsResponse = res.errors;
6998
- //Reject promises with errors from query
6999
- errorsResponse.forEach((errorResponse) => {
7000
- Object.entries(errorResponse).forEach(([_key, val]) => {
7001
- var _a;
7002
- (((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new core.ErrorException("Falha detectada", val.message));
7003
- });
6828
+ const waitinRequests = this.watingRequestsById;
6829
+ this.watingRequestsById = new Map();
6830
+ this.executePendingRequest(waitinRequests);
6831
+ }
6832
+ }
6833
+ async executePendingRequest(watingRequestsById) {
6834
+ const requestsBatch = [];
6835
+ watingRequestsById.forEach(async (waitingReq) => {
6836
+ let query = this.getQueryTemplate(waitingReq.request);
6837
+ requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
6838
+ });
6839
+ let res = undefined;
6840
+ let dataResponse = [];
6841
+ let errorsResponse = [];
6842
+ res = await this.fecthGrapql(requestsBatch);
6843
+ dataResponse = res.data;
6844
+ errorsResponse = res.errors;
6845
+ //Reject promises with errors from query
6846
+ errorsResponse.forEach((errorResponse) => {
6847
+ Object.entries(errorResponse).forEach(([_key, val]) => {
6848
+ var _a;
6849
+ (((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new core.ErrorException("Falha detectada", val.message));
7004
6850
  });
7005
- //Resolve promises with data from query
7006
- dataResponse.forEach((data) => {
7007
- Object.entries(data).forEach(([key, val]) => {
7008
- var _a;
7009
- (((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
7010
- });
6851
+ });
6852
+ //Resolve promises with data from query
6853
+ dataResponse.forEach((data) => {
6854
+ Object.entries(data).forEach(([key, val]) => {
6855
+ var _a;
6856
+ (((_a = watingRequestsById.get(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
7011
6857
  });
7012
- this.watingRequestsById.clear();
7013
- }
6858
+ });
7014
6859
  }
7015
6860
  async fecthGrapql(request) {
7016
6861
  let res = undefined;
@@ -7130,6 +6975,5 @@ class WaitingRequest {
7130
6975
  }
7131
6976
 
7132
6977
  exports.DataFetcher = DataFetcher;
7133
- exports.PrintUtils = PrintUtils;
7134
6978
  exports.UrlUtils = UrlUtils;
7135
6979
  exports.dist = dist;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ exports.SaveErrorsEnum = void 0;
4
+ (function (SaveErrorsEnum) {
5
+ SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
6
+ SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
7
+ SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
8
+ })(exports.SaveErrorsEnum || (exports.SaveErrorsEnum = {}));