@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,76 +1,14 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DateUtils, StringUtils, OnboardingUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking, DataType } from '@sankhyalabs/core';
2
+ import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, OnboardingUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking, DataType } from '@sankhyalabs/core';
3
3
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
4
4
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
6
- import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
6
+ import { C as ConfigStorage } from './ConfigStorage.js';
7
7
  import { D as DataUnitFetcher } from './dataunit-fetcher.js';
8
8
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
10
10
  import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
11
11
 
12
- class SnkErrorHandler {
13
- constructor(app) {
14
- this._app = app;
15
- window.addEventListener("error", evt => this.errorHandler(evt));
16
- window.addEventListener("unhandledrejection", evt => this.rejectionHandler(evt));
17
- }
18
- rejectionHandler(evt) {
19
- const reason = evt.reason;
20
- //Promisse rejeitada com WaitingChangeException, não precisam
21
- //ser notificadas pelo usuário.
22
- if (!(reason instanceof WaitingChangeException)) {
23
- if (reason) {
24
- this.processException(reason);
25
- }
26
- else {
27
- this._app.isDebugMode().then((isDebug) => {
28
- if (isDebug) {
29
- this._app.error("Promise rejeitada", "Erro interno: Uma promise foi rejeitada sem razão determinada.");
30
- }
31
- });
32
- }
33
- }
34
- }
35
- errorHandler(evt) {
36
- this.processException(evt.error);
37
- }
38
- buildErrorCodeHTML(errorCode) {
39
- const onclick = 'try{window.workspace.openHelp(\'_tbcode:' + errorCode + '\')} catch(e){alert(\'Não é possível abrir a ajuda fora do workspace Sankhya\');}';
40
- return '<br><a href="#" onclick="' + onclick + '">Código: ' + errorCode + '</a>';
41
- }
42
- processException(exception) {
43
- if (exception.errorCode) {
44
- exception.message += this.buildErrorCodeHTML(exception.errorCode);
45
- }
46
- if (exception instanceof WaitingChangeException) {
47
- this._app.alert(exception.title, exception.message);
48
- }
49
- else if (exception instanceof WarningException) {
50
- this._app.alert(exception.title, exception.message);
51
- }
52
- else if (exception instanceof ErrorException) {
53
- this._app.error(exception.title, exception.message);
54
- }
55
- else {
56
- this._app.isDebugMode().then(isDebug => {
57
- if (isDebug) {
58
- if (exception instanceof Error) {
59
- this._app.error(exception.name, exception.message);
60
- }
61
- else {
62
- const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
63
- const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${ObjectUtils.objectToString(exception)}"`;
64
- this._app.error(title, message);
65
- }
66
- }
67
- });
68
- }
69
- }
70
- }
71
-
72
- function _0x53e1(){const _0x340df8=['2909523kXwted','CompanyName=Sankhya\x20Jiva\x20Tecnologia\x20e\x20Inovao\x20Ltda,LicensedApplication=Sankhya\x20Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869','1131048CARoeW','502909mLEPmu','447255iQEXuN','428UHbJwW','270AFTxAV','194369jhGqTI','1540nWuTrj','2044062GicUQI','30CkXPWg'];_0x53e1=function(){return _0x340df8;};return _0x53e1();}const _0xc7632f=_0x15c2;function _0x15c2(_0x353a9c,_0x3e4a5a){const _0x53e110=_0x53e1();return _0x15c2=function(_0x15c2aa,_0x219858){_0x15c2aa=_0x15c2aa-0x188;let _0x307231=_0x53e110[_0x15c2aa];return _0x307231;},_0x15c2(_0x353a9c,_0x3e4a5a);}(function(_0x42617e,_0x57debe){const _0x31061a=_0x15c2,_0x128d7d=_0x42617e();while(!![]){try{const _0x1c9bb1=-parseInt(_0x31061a(0x18e))/0x1+-parseInt(_0x31061a(0x189))/0x2+parseInt(_0x31061a(0x18b))/0x3+-parseInt(_0x31061a(0x190))/0x4*(parseInt(_0x31061a(0x188))/0x5)+-parseInt(_0x31061a(0x191))/0x6*(-parseInt(_0x31061a(0x192))/0x7)+parseInt(_0x31061a(0x18d))/0x8+-parseInt(_0x31061a(0x18f))/0x9*(-parseInt(_0x31061a(0x18a))/0xa);if(_0x1c9bb1===_0x57debe)break;else _0x128d7d['push'](_0x128d7d['shift']());}catch(_0x1bd816){_0x128d7d['push'](_0x128d7d['shift']());}}}(_0x53e1,0xe8676));const agGridLicense=_0xc7632f(0x18c);
73
-
74
12
  class TotalsFetcher {
75
13
  constructor() {
76
14
  this.templateByQuery = new Map();
@@ -133,33 +71,6 @@ class TotalsFetcher {
133
71
  }
134
72
  }
135
73
 
136
- var _a;
137
- class Workspace {
138
- static openAppActivity(resourceId, pkObject) {
139
- var _a;
140
- (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
141
- }
142
- static getAppLabel(resourceID) {
143
- if ((window === null || window === void 0 ? void 0 : window["workspace"]) == undefined) {
144
- return;
145
- }
146
- if (window["workspace"].getAppLabel == undefined) {
147
- window["workspace"].getAppLabel = (id) => {
148
- return (id || "").split(".").pop();
149
- };
150
- }
151
- return window["workspace"].getAppLabel(resourceID);
152
- }
153
- }
154
- Workspace.resourceID = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID;
155
-
156
- class AppletCaller {
157
- static webConnectionCaller(port, methodName, params) {
158
- var _a;
159
- (_a = window["AppletCaller"]) === null || _a === void 0 ? void 0 : _a.webConnectionCaller(port, methodName, params);
160
- }
161
- }
162
-
163
74
  class ParametersFetcher {
164
75
  constructor() {
165
76
  this.templateByQuery = new Map();
@@ -224,6 +135,95 @@ class ParametersFetcher {
224
135
  }
225
136
  }
226
137
 
138
+ class SnkErrorHandler {
139
+ constructor(app) {
140
+ this._app = app;
141
+ window.addEventListener("error", evt => this.errorHandler(evt));
142
+ window.addEventListener("unhandledrejection", evt => this.rejectionHandler(evt));
143
+ }
144
+ rejectionHandler(evt) {
145
+ const reason = evt.reason;
146
+ //Promisse rejeitada com WaitingChangeException, não precisam
147
+ //ser notificadas pelo usuário.
148
+ if (!(reason instanceof WaitingChangeException)) {
149
+ if (reason) {
150
+ this.processException(reason);
151
+ }
152
+ else {
153
+ this._app.isDebugMode().then((isDebug) => {
154
+ if (isDebug) {
155
+ this._app.error("Promise rejeitada", "Erro interno: Uma promise foi rejeitada sem razão determinada.");
156
+ }
157
+ });
158
+ }
159
+ }
160
+ }
161
+ errorHandler(evt) {
162
+ this.processException(evt.error);
163
+ }
164
+ buildErrorCodeHTML(errorCode) {
165
+ const onclick = 'try{window.workspace.openHelp(\'_tbcode:' + errorCode + '\')} catch(e){alert(\'Não é possível abrir a ajuda fora do workspace Sankhya\');}';
166
+ return '<br><a href="#" onclick="' + onclick + '">Código: ' + errorCode + '</a>';
167
+ }
168
+ processException(exception) {
169
+ if (exception.errorCode) {
170
+ exception.message += this.buildErrorCodeHTML(exception.errorCode);
171
+ }
172
+ if (exception instanceof WaitingChangeException) {
173
+ this._app.alert(exception.title, exception.message);
174
+ }
175
+ else if (exception instanceof WarningException) {
176
+ this._app.alert(exception.title, exception.message);
177
+ }
178
+ else if (exception instanceof ErrorException) {
179
+ this._app.error(exception.title, exception.message);
180
+ }
181
+ else {
182
+ this._app.isDebugMode().then(isDebug => {
183
+ if (isDebug) {
184
+ if (exception instanceof Error) {
185
+ this._app.error(exception.name, exception.message);
186
+ }
187
+ else {
188
+ const title = (exception === null || exception === void 0 ? void 0 : exception.title) || "Erro detectado";
189
+ const message = (typeof exception === "string") ? exception : exception.message || `Erro interno "${ObjectUtils.objectToString(exception)}"`;
190
+ this._app.error(title, message);
191
+ }
192
+ }
193
+ });
194
+ }
195
+ }
196
+ }
197
+
198
+ function _0x53e1(){const _0x340df8=['2909523kXwted','CompanyName=Sankhya\x20Jiva\x20Tecnologia\x20e\x20Inovao\x20Ltda,LicensedApplication=Sankhya\x20Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869','1131048CARoeW','502909mLEPmu','447255iQEXuN','428UHbJwW','270AFTxAV','194369jhGqTI','1540nWuTrj','2044062GicUQI','30CkXPWg'];_0x53e1=function(){return _0x340df8;};return _0x53e1();}const _0xc7632f=_0x15c2;function _0x15c2(_0x353a9c,_0x3e4a5a){const _0x53e110=_0x53e1();return _0x15c2=function(_0x15c2aa,_0x219858){_0x15c2aa=_0x15c2aa-0x188;let _0x307231=_0x53e110[_0x15c2aa];return _0x307231;},_0x15c2(_0x353a9c,_0x3e4a5a);}(function(_0x42617e,_0x57debe){const _0x31061a=_0x15c2,_0x128d7d=_0x42617e();while(!![]){try{const _0x1c9bb1=-parseInt(_0x31061a(0x18e))/0x1+-parseInt(_0x31061a(0x189))/0x2+parseInt(_0x31061a(0x18b))/0x3+-parseInt(_0x31061a(0x190))/0x4*(parseInt(_0x31061a(0x188))/0x5)+-parseInt(_0x31061a(0x191))/0x6*(-parseInt(_0x31061a(0x192))/0x7)+parseInt(_0x31061a(0x18d))/0x8+-parseInt(_0x31061a(0x18f))/0x9*(-parseInt(_0x31061a(0x18a))/0xa);if(_0x1c9bb1===_0x57debe)break;else _0x128d7d['push'](_0x128d7d['shift']());}catch(_0x1bd816){_0x128d7d['push'](_0x128d7d['shift']());}}}(_0x53e1,0xe8676));const agGridLicense=_0xc7632f(0x18c);
199
+
200
+ var _a;
201
+ class Workspace {
202
+ static openAppActivity(resourceId, pkObject) {
203
+ var _a;
204
+ (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
205
+ }
206
+ static getAppLabel(resourceID) {
207
+ if ((window === null || window === void 0 ? void 0 : window["workspace"]) == undefined) {
208
+ return;
209
+ }
210
+ if (window["workspace"].getAppLabel == undefined) {
211
+ window["workspace"].getAppLabel = (id) => {
212
+ return (id || "").split(".").pop();
213
+ };
214
+ }
215
+ return window["workspace"].getAppLabel(resourceID);
216
+ }
217
+ }
218
+ Workspace.resourceID = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID;
219
+
220
+ class AppletCaller {
221
+ static webConnectionCaller(port, methodName, params) {
222
+ var _a;
223
+ (_a = window["AppletCaller"]) === null || _a === void 0 ? void 0 : _a.webConnectionCaller(port, methodName, params);
224
+ }
225
+ }
226
+
227
227
  const _0x5b7870=_0x2202;(function(_0x42e134,_0x5d9727){const _0x185c97=_0x2202,_0x5854c7=_0x42e134();while(!![]){try{const _0x129d35=parseInt(_0x185c97(0x18f))/0x1*(-parseInt(_0x185c97(0x183))/0x2)+-parseInt(_0x185c97(0x191))/0x3+parseInt(_0x185c97(0x17d))/0x4*(-parseInt(_0x185c97(0x185))/0x5)+parseInt(_0x185c97(0x184))/0x6*(-parseInt(_0x185c97(0x182))/0x7)+parseInt(_0x185c97(0x17b))/0x8+parseInt(_0x185c97(0x18c))/0x9+parseInt(_0x185c97(0x17f))/0xa;if(_0x129d35===_0x5d9727)break;else _0x5854c7['push'](_0x5854c7['shift']());}catch(_0x4becb4){_0x5854c7['push'](_0x5854c7['shift']());}}}(_0xdfb1,0x44ac7));function _0x2202(_0x2eac1f,_0x170d27){const _0xdfb1b4=_0xdfb1();return _0x2202=function(_0x2202d7,_0x224df5){_0x2202d7=_0x2202d7-0x17a;let _0x4d54a9=_0xdfb1b4[_0x2202d7];return _0x4d54a9;},_0x2202(_0x2eac1f,_0x170d27);}function _0xdfb1(){const _0x2b9dc4=['true','863GKWjmo','parse','56355fjjjAm','isSup','putAccess','4324480sjuCdS','hasOwnProperty','239748okvJLB','name','6055770tXeRaU','actions','forEach','7RPRvzn','1042CHxkUw','2988126NIwRMm','20MTNzmH','authorizationSf','item','string','hasAccess','isArray','Objeto\x20não\x20pode\x20ser\x20indefinido.','3071943fWslZp','parseFromJSON'];_0xdfb1=function(){return _0x2b9dc4;};return _0xdfb1();}class MGEAuthorization{[_0x5b7870(0x18d)](_0x37e96b){const _0x580407=_0x5b7870;_0x37e96b=utxt(_0x37e96b[_0x580407(0x186)]);typeof _0x37e96b==_0x580407(0x188)&&(_0x37e96b=JSON[_0x580407(0x190)](_0x37e96b));if(_0x37e96b==undefined)throw Error(_0x580407(0x18b));const _0x291d34=new MGEAuthorizationData(_0x37e96b[_0x580407(0x192)]==='S'||_0x37e96b[_0x580407(0x192)]===!![]);return Array[_0x580407(0x18a)](_0x37e96b[_0x580407(0x187)])&&_0x37e96b[_0x580407(0x187)][_0x580407(0x181)](_0x58a748=>_0x291d34['putAccess'](_0x58a748[_0x580407(0x17e)],String(_0x58a748['status'])==_0x580407(0x18e))),_0x291d34;}}class MGEAuthorizationData{constructor(_0x51ec5d){const _0x2c8472=_0x5b7870;this['isSup']=_0x51ec5d,this[_0x2c8472(0x180)]={};}[_0x5b7870(0x17a)](_0x5bd0f2,_0x2ef465){const _0x40d701=_0x5b7870;this[_0x40d701(0x180)][_0x5bd0f2]=_0x2ef465;}[_0x5b7870(0x189)](_0x4fd772){const _0x3707c1=_0x5b7870;if(this[_0x3707c1(0x192)])return !![];let _0x25e60a=!![];return this[_0x3707c1(0x180)][_0x3707c1(0x17c)](_0x4fd772)&&(_0x25e60a=this['actions'][_0x4fd772]),_0x25e60a;}['isUserSup'](){return this['isSup'];}}
228
228
 
229
229
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
@@ -247,16 +247,21 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
247
247
  }
248
248
  return this._parameters;
249
249
  }
250
- get resourceID() {
251
- if (!this._resourceID) {
252
- this._resourceID = this.urlParams.get("workspaceResourceID") ||
253
- this.urlParams.get("resourceID") ||
254
- Workspace.resourceID ||
255
- "unknown.resource.id";
250
+ async getAuth(resourceID) {
251
+ if (resourceID == undefined) {
252
+ return this.getApplicationAuth();
253
+ }
254
+ else {
255
+ return new Promise((resolve, reject) => {
256
+ this.authFetcher.getData(resourceID).then((authList) => {
257
+ resolve(authList);
258
+ }).catch(error => {
259
+ reject(error);
260
+ });
261
+ });
256
262
  }
257
- return this._resourceID;
258
263
  }
259
- get auth() {
264
+ async getApplicationAuth() {
260
265
  if (this._auth) {
261
266
  return Promise.resolve(this._auth);
262
267
  }
@@ -265,7 +270,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
265
270
  const waitingAuth = this._authPromises.length > 0;
266
271
  this._authPromises.push(new PendingPromise(resolve, reject));
267
272
  if (!waitingAuth) {
268
- this.authFetcher.getData(this.resourceID).then((authList) => {
273
+ this.authFetcher.getData(this.applicationResourceID).then((authList) => {
269
274
  this._auth = authList;
270
275
  while (this._authPromises.length > 0) {
271
276
  this._authPromises.pop().resolve(this._auth);
@@ -284,13 +289,23 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
284
289
  */
285
290
  async isUserSup() {
286
291
  return new Promise((resolve, reject) => {
287
- this.auth.then((authorization) => {
292
+ this.getAuth().then((authorization) => {
288
293
  this.getAuthList(authorization).then((auths) => {
289
294
  resolve(auths.isSup);
290
295
  }).catch(error => reject(error));
291
296
  });
292
297
  });
293
298
  }
299
+ /**
300
+ * Realiza a chamada ao Service Broker conforme o nome do serviço.
301
+ *
302
+ * @param serviceName - Nome do serviço
303
+ * @param payload - Dados que serão processados na ação
304
+ * @param options - Parâmetros de URL
305
+ */
306
+ async callServiceBroker(serviceName, payload, options) {
307
+ return DataFetcher.get().callServiceBroker(serviceName, payload, options);
308
+ }
294
309
  initOnboarding(onboardingKey) {
295
310
  OnboardingUtils.getInstance().init(onboardingKey, window.envContext);
296
311
  return Promise.resolve();
@@ -298,9 +313,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
298
313
  /**
299
314
  * Obtém `true` caso o usuário logado tem permissão pra determinada ação.
300
315
  */
301
- async hasAccess(access) {
316
+ async hasAccess(access, resourceID) {
302
317
  return new Promise((resolve, reject) => {
303
- this.auth.then((authorization) => {
318
+ this.getAuth(resourceID).then((authorization) => {
304
319
  this.getAuthList(authorization).then((auths) => {
305
320
  resolve(auths.isSup || auths.actions[access]);
306
321
  }).catch(error => reject(error));
@@ -310,9 +325,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
310
325
  /**
311
326
  * Obtém todos os acessos do usuário logado.
312
327
  */
313
- async getAllAccess() {
328
+ async getAllAccess(resourceID) {
314
329
  return new Promise((resolve, reject) => {
315
- this.auth.then((authorization) => {
330
+ this.getAuth(resourceID).then((authorization) => {
316
331
  this.getAuthList(authorization).then((auths) => {
317
332
  const allAccess = {};
318
333
  allAccess['isSup'] = auths.isSup;
@@ -496,13 +511,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
496
511
  * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
497
512
  * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
498
513
  */
499
- async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
514
+ async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
515
+ if (resourceID == undefined) {
516
+ resourceID = this.applicationResourceID;
517
+ }
500
518
  return new Promise((resolve, reject) => {
501
519
  const duPromisses = this.getDuPromissesStack(dataUnitName);
502
520
  const waitingDu = duPromisses.length > 0;
503
521
  duPromisses.push(new PendingPromise(resolve, reject));
504
522
  if (!waitingDu) {
505
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID, parentDataUnit, configName);
523
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
506
524
  dataUnit.loadMetadata().then(() => {
507
525
  if (dataUnitName) {
508
526
  this.updateDataunitCache(undefined, dataUnitName, dataUnit);
@@ -533,14 +551,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
533
551
  /**
534
552
  * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
535
553
  */
536
- async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
554
+ async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
537
555
  return new Promise((resolve, reject) => {
538
556
  const dataUnit = this._duCache.get(dataUnitName);
539
557
  if (dataUnit) {
540
558
  resolve(dataUnit);
541
559
  }
542
560
  else {
543
- this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
561
+ this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
544
562
  resolve(dataUnit);
545
563
  }).catch(reason => reject(reason));
546
564
  }
@@ -589,11 +607,20 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
589
607
  async callServiceBroker(serviceName, payload, options) {
590
608
  return DataFetcher.get().callServiceBroker(serviceName, payload, options);
591
609
  }
610
+ get applicationResourceID() {
611
+ if (!this._applicationResourceID) {
612
+ this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
613
+ this.urlParams.get("resourceID") ||
614
+ Workspace.resourceID ||
615
+ "unknown.resource.id";
616
+ }
617
+ return this._applicationResourceID;
618
+ }
592
619
  /**
593
620
  * Obtém o resourceID da tela em questão.
594
621
  */
595
622
  async getResourceID() {
596
- return Promise.resolve(this.resourceID);
623
+ return Promise.resolve(this.applicationResourceID);
597
624
  }
598
625
  /**
599
626
  * Obtém o UserId da tela em questão.
@@ -637,20 +664,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
637
664
  async info(message, options) {
638
665
  return ApplicationUtils.info(message, options);
639
666
  }
640
- /**
641
- * Obtém a configuração de grade.
642
- */
643
- async loadGridConfig(name) {
644
- return this.gridConfigFetcher.getConfig(name, this.resourceID);
645
- }
646
667
  /**
647
668
  * Obtém os totalizadores da grade.
648
669
  */
649
670
  async loadTotals(name, resourceID, filters) {
650
671
  return this.totalsFetcher.fetchTotals(name, resourceID, filters);
651
672
  }
652
- async getAuthList(_auth) {
653
- return await (new MGEAuthorization()).parseFromJSON(_auth);
673
+ async getAuthList(auth) {
674
+ return await (new MGEAuthorization()).parseFromJSON(auth);
654
675
  }
655
676
  get urlParams() {
656
677
  if (!this._urlParams) {
@@ -664,12 +685,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
664
685
  }
665
686
  return this._dataUnitFetcher;
666
687
  }
667
- get gridConfigFetcher() {
668
- if (!this._gridConfigFetcher) {
669
- this._gridConfigFetcher = new GridConfigFetcher();
670
- }
671
- return this._gridConfigFetcher;
672
- }
673
688
  get totalsFetcher() {
674
689
  if (!this._totalsFetcher) {
675
690
  this._totalsFetcher = new TotalsFetcher();
@@ -767,7 +782,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
767
782
  * Obtém o nome das telas da aplicação
768
783
  */
769
784
  async getAppLabel() {
770
- return Workspace.getAppLabel(this._resourceID);
785
+ return Workspace.getAppLabel(this.applicationResourceID);
771
786
  }
772
787
  /**
773
788
  * Adiciona um listener no fetcher de Pesquisa
@@ -839,6 +854,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
839
854
  this._popUp.ezTitle = title;
840
855
  }
841
856
  componentWillLoad() {
857
+ ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
842
858
  this._errorHandler = new SnkErrorHandler(this);
843
859
  this.messagesBuilder = new SnkMessageBuilder();
844
860
  ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
@@ -847,7 +863,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
847
863
  });
848
864
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
849
865
  ErrorTracking.init();
850
- ConfigStorage.get();
866
+ ConfigStorage.preload(this.applicationResourceID, this.configName);
851
867
  }
852
868
  connectedCallback() {
853
869
  ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -859,9 +875,10 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
859
875
  componentDidLoad() {
860
876
  this.applicationLoading.emit(true);
861
877
  window.requestAnimationFrame(() => {
878
+ ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", false);
862
879
  this.applicationLoaded.emit(true);
863
880
  });
864
- ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
881
+ ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
865
882
  }
866
883
  render() {
867
884
  return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
@@ -872,6 +889,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
872
889
  "messagesBuilder": [1040],
873
890
  "configName": [1, "config-name"],
874
891
  "isUserSup": [64],
892
+ "callServiceBroker": [64],
875
893
  "initOnboarding": [64],
876
894
  "hasAccess": [64],
877
895
  "getAllAccess": [64],
@@ -896,7 +914,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
896
914
  "addClientEvent": [64],
897
915
  "removeClientEvent": [64],
898
916
  "hasClientEvent": [64],
899
- "callServiceBroker": [64],
900
917
  "getResourceID": [64],
901
918
  "getUserID": [64],
902
919
  "alert": [64],
@@ -905,7 +922,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
905
922
  "message": [64],
906
923
  "confirm": [64],
907
924
  "info": [64],
908
- "loadGridConfig": [64],
909
925
  "loadTotals": [64],
910
926
  "executeSearch": [64],
911
927
  "executePreparedSearch": [64],
@@ -1,23 +1,16 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext, DataType, Action } from '@sankhyalabs/core';
3
3
  import { D as DataFetcher } from './DataFetcher.js';
4
+ import { a as SaveErrorsEnum, d as defineCustomElement$7 } from './snk-actions-button2.js';
4
5
  import { V as VIEW_MODE } from './constants.js';
5
6
  import { D as DataUnitFetcher } from './dataunit-fetcher.js';
6
7
  import { T as TaskbarElement, d as defineCustomElement$1 } from './snk-taskbar2.js';
7
- import { d as defineCustomElement$7 } from './snk-actions-button2.js';
8
8
  import { d as defineCustomElement$6 } from './snk-data-exporter2.js';
9
9
  import { d as defineCustomElement$5 } from './snk-data-unit2.js';
10
10
  import { d as defineCustomElement$4 } from './snk-exporter-email-sender2.js';
11
11
  import { d as defineCustomElement$3 } from './snk-simple-bar2.js';
12
12
  import { d as defineCustomElement$2 } from './snk-simple-crud2.js';
13
13
 
14
- var SaveErrorsEnum;
15
- (function (SaveErrorsEnum) {
16
- SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
17
- SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
18
- SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
19
- })(SaveErrorsEnum || (SaveErrorsEnum = {}));
20
-
21
14
  class AttachFetcher {
22
15
  constructor(entityName, registerKey, dataUnitName) {
23
16
  var _a;
@@ -17,6 +17,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
17
17
  this._permissions = undefined;
18
18
  this.showActionButtons = false;
19
19
  this.configName = undefined;
20
+ this.resourceID = undefined;
20
21
  this.viewMode = VIEW_MODE.GRID;
21
22
  this.messagesBuilder = undefined;
22
23
  }
@@ -81,7 +82,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
81
82
  componentWillLoad() {
82
83
  this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
83
84
  if (this._application) {
84
- this._application.getAllAccess().then(access => (this._permissions = access));
85
+ this._application.getAllAccess(this.resourceID).then(access => (this._permissions = access));
85
86
  }
86
87
  else {
87
88
  this._permissions = {};
@@ -94,6 +95,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
94
95
  }, [6, "snk-configurator", {
95
96
  "showActionButtons": [4, "show-action-buttons"],
96
97
  "configName": [1, "config-name"],
98
+ "resourceID": [1, "resource-i-d"],
97
99
  "viewMode": [2, "view-mode"],
98
100
  "messagesBuilder": [1040],
99
101
  "_opened": [32],
@@ -1,12 +1,16 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { StringUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
4
4
  import './DataFetcher.js';
5
5
  import './pesquisa-fetcher.js';
6
6
  import { P as PresentationMode } from './index2.js';
7
+ import { d as defineCustomElement$v } from './snk-actions-button2.js';
8
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
+ import './filter-item-type.enum.js';
11
+ import './form-config-fetcher.js';
7
12
  import { V as VIEW_MODE } from './constants.js';
8
13
  import { A as AutorizationType } from './auth-fetcher.js';
9
- import { d as defineCustomElement$v } from './snk-actions-button2.js';
10
14
  import { d as defineCustomElement$u } from './snk-attach2.js';
11
15
  import { d as defineCustomElement$t } from './snk-config-options2.js';
12
16
  import { d as defineCustomElement$s } from './snk-configurator2.js';
@@ -44,12 +48,14 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
44
48
  this.actionClick = createEvent(this, "actionClick", 7);
45
49
  this.configuratorSave = createEvent(this, "configuratorSave", 7);
46
50
  this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
51
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
47
52
  this._viewHistory = [];
48
53
  this._dataUnit = undefined;
49
54
  this._dataState = undefined;
50
55
  this.attachmentRegisterKey = undefined;
51
56
  this._currentViewMode = VIEW_MODE.GRID;
52
57
  this._canEdit = undefined;
58
+ this._resourceID = undefined;
53
59
  this.configName = undefined;
54
60
  this.selectionToastConfig = undefined;
55
61
  this.showActionButtons = false;
@@ -61,6 +67,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
61
67
  this.presentationMode = PresentationMode.PRIMARY;
62
68
  this.messagesBuilder = undefined;
63
69
  this.useEnterLikeTab = false;
70
+ this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
64
71
  }
65
72
  /**
66
73
  * Usado para alternar a visão entre GRID e FORM externamente.
@@ -144,7 +151,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
144
151
  }
145
152
  componentWillLoad() {
146
153
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
147
- application.hasAccess(AutorizationType.UPDATE).then(canEdit => this._canEdit = canEdit);
154
+ application.hasAccess(AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
148
155
  let parent = this._element.parentElement;
149
156
  while (parent) {
150
157
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -156,11 +163,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
156
163
  if (!this._dataUnit) {
157
164
  this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
158
165
  this._dataUnit = evt.detail;
159
- this.initDataUnit();
166
+ this.initDataUnit(application);
160
167
  });
161
168
  }
162
169
  else {
163
- this.initDataUnit();
170
+ this.initDataUnit(application);
164
171
  }
165
172
  this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
166
173
  this._dataState = dataState;
@@ -176,11 +183,18 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
176
183
  this.configName = application.configName;
177
184
  }
178
185
  }
179
- initDataUnit() {
186
+ async initDataUnit(application) {
180
187
  this.addDataElementID();
181
188
  if (!this.messagesBuilder) {
182
189
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
183
190
  }
191
+ if (this._resourceID == undefined) {
192
+ //Tenta pegar o resourceID do snkDataUnit;
193
+ this._resourceID = this._snkDataUnit.resourceID;
194
+ if (this._resourceID == undefined) {
195
+ this._resourceID = await application.getResourceID();
196
+ }
197
+ }
184
198
  }
185
199
  handleConfiguratorEvent(evt, type) {
186
200
  evt.stopImmediatePropagation();
@@ -191,8 +205,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
191
205
  this.configuratorCancel.emit();
192
206
  }
193
207
  render() {
208
+ if (this._resourceID == undefined) {
209
+ return;
210
+ }
194
211
  this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
195
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL') }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
212
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
196
213
  }
197
214
  get _element() { return this; }
198
215
  static get watchers() { return {
@@ -216,6 +233,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
216
233
  "attachmentRegisterKey": [32],
217
234
  "_currentViewMode": [32],
218
235
  "_canEdit": [32],
236
+ "_resourceID": [32],
237
+ "customContainerId": [32],
219
238
  "goToView": [64],
220
239
  "openConfigurator": [64],
221
240
  "closeConfigurator": [64],
@@ -71,6 +71,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
71
71
  this.useCancelConfirm = true;
72
72
  this.ignoreSaveMessage = undefined;
73
73
  this.configName = undefined;
74
+ this.resourceID = undefined;
74
75
  }
75
76
  observePageSize() {
76
77
  if (this.dataUnit) {
@@ -334,10 +335,10 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
334
335
  const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
335
336
  if (this._parentSnkDataUnit) {
336
337
  this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
337
- return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName);
338
+ return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
338
339
  }
339
340
  else {
340
- return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName);
341
+ return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
341
342
  }
342
343
  }
343
344
  async loadDataUnit() {
@@ -396,7 +397,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
396
397
  //---------------------------------------------
397
398
  componentWillLoad() {
398
399
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
399
- this._application.getAllAccess().then(access => this._permissions = access);
400
+ this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
400
401
  this._parentSnkDataUnit = this.getParentSnkDataUnit();
401
402
  if (this.messagesBuilder == undefined) {
402
403
  this.messagesBuilder = new SnkMessageBuilder(this.entityName);
@@ -404,8 +405,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
404
405
  }
405
406
  disconnectedCallback() {
406
407
  if (this.dataUnit) {
407
- this.dataUnit.unsubscribe(this._dataUnitObserver);
408
- this.dataUnit.removeInterceptor(this);
408
+ this.dataUnit.releaseCallbacks();
409
409
  }
410
410
  }
411
411
  componentDidLoad() {
@@ -436,6 +436,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
436
436
  "useCancelConfirm": [4, "use-cancel-confirm"],
437
437
  "ignoreSaveMessage": [4, "ignore-save-message"],
438
438
  "configName": [1, "config-name"],
439
+ "resourceID": [1, "resource-i-d"],
439
440
  "getDataUnit": [64],
440
441
  "getSelectedRecordsIDsInfo": [64]
441
442
  }]);