@sankhyalabs/sankhyablocks 8.2.0-dev.1 → 8.2.0

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 (221) hide show
  1. package/dist/cjs/{ConfigStorage-12397f18.js → ConfigStorage-e9d7fa82.js} +51 -163
  2. package/dist/cjs/{DataFetcher-f2da1f79.js → DataFetcher-39b63a1e.js} +29 -67
  3. package/dist/cjs/{SnkFormConfigManager-13f79e37.js → SnkFormConfigManager-2f8eccd9.js} +21 -19
  4. package/dist/cjs/{dataunit-fetcher-e72068c1.js → dataunit-fetcher-15a7cc88.js} +1 -1
  5. package/dist/cjs/filter-bar-config-fetcher-24548cec.js +155 -0
  6. package/dist/cjs/{form-config-fetcher-5d62ab62.js → form-config-fetcher-ab3ce222.js} +3 -66
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-8c363096.js → pesquisa-fetcher-96c042aa.js} +1 -1
  9. package/dist/cjs/resource-fetcher-64102551.js +68 -0
  10. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  11. package/dist/cjs/snk-actions-button.cjs.entry.js +11 -18
  12. package/dist/cjs/snk-application.cjs.entry.js +73 -51
  13. package/dist/cjs/snk-attach.cjs.entry.js +13 -7
  14. package/dist/cjs/snk-configurator.cjs.entry.js +1 -2
  15. package/dist/cjs/snk-crud.cjs.entry.js +9 -28
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  17. package/dist/cjs/{snk-data-unit-80a00ae4.js → snk-data-unit-d5109a08.js} +6 -8
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +25 -18
  20. package/dist/cjs/snk-entity-list.cjs.entry.js +4 -0
  21. package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -14
  22. package/dist/cjs/snk-filter-detail.cjs.entry.js +15 -1
  23. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +19 -5
  24. package/dist/cjs/snk-form-config.cjs.entry.js +17 -6
  25. package/dist/cjs/snk-form-view.cjs.entry.js +1 -6
  26. package/dist/cjs/snk-form.cjs.entry.js +8 -12
  27. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -5
  28. package/dist/cjs/snk-grid.cjs.entry.js +20 -20
  29. package/dist/cjs/{snk-guides-viewer-a7cd6fda.js → snk-guides-viewer-8c9693aa.js} +9 -18
  30. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +16 -13
  32. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +80 -22
  34. package/dist/cjs/snk-taskbar.cjs.entry.js +1 -2
  35. package/dist/collection/components/snk-actions-button/actions/index.js +4 -3
  36. package/dist/collection/components/snk-actions-button/snk-actions-button.js +4 -8
  37. package/dist/collection/components/snk-application/snk-application.js +65 -60
  38. package/dist/collection/components/snk-configurator/snk-configurator.js +1 -19
  39. package/dist/collection/components/snk-crud/snk-crud.js +8 -63
  40. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +15 -65
  41. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +1 -27
  42. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +30 -66
  43. package/dist/collection/components/snk-data-unit/snk-data-unit.js +7 -42
  44. package/dist/collection/components/snk-entity-list/snk-entity-list.js +23 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
  46. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  47. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +16 -21
  48. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +12 -28
  49. package/dist/collection/components/snk-form/SnkFormConfigManager.js +19 -17
  50. package/dist/collection/components/snk-form/snk-form.js +2 -46
  51. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +15 -5
  52. package/dist/collection/components/snk-grid/snk-grid.js +16 -110
  53. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +1 -19
  54. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +12 -28
  55. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -43
  56. package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -19
  57. package/dist/collection/lib/configs/ConfigStorage.js +44 -33
  58. package/dist/collection/lib/dataUnit/InMemoryLoader.js +59 -2
  59. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +29 -38
  60. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +24 -0
  61. package/dist/collection/lib/index.js +0 -10
  62. package/dist/collection/lib/utils/urlutils.js +0 -29
  63. package/dist/components/ConfigStorage.js +48 -161
  64. package/dist/components/DataFetcher.js +29 -67
  65. package/dist/components/SnkFormConfigManager.js +19 -17
  66. package/dist/components/filter-bar-config-fetcher.js +153 -0
  67. package/dist/components/form-config-fetcher.js +2 -64
  68. package/dist/components/resource-fetcher.js +66 -0
  69. package/dist/components/snk-actions-button2.js +9 -23
  70. package/dist/components/snk-application2.js +154 -132
  71. package/dist/components/snk-attach2.js +8 -1
  72. package/dist/components/snk-configurator2.js +1 -3
  73. package/dist/components/snk-crud.js +7 -29
  74. package/dist/components/snk-data-unit2.js +6 -10
  75. package/dist/components/snk-detail-view2.js +23 -28
  76. package/dist/components/snk-entity-list.js +4 -0
  77. package/dist/components/snk-filter-bar2.js +12 -12
  78. package/dist/components/snk-filter-detail2.js +12 -2
  79. package/dist/components/snk-filter-modal-item2.js +16 -5
  80. package/dist/components/snk-form-config2.js +15 -5
  81. package/dist/components/snk-form-view2.js +1 -6
  82. package/dist/components/snk-form.js +2 -9
  83. package/dist/components/snk-grid-config2.js +2 -4
  84. package/dist/components/snk-grid2.js +16 -23
  85. package/dist/components/snk-personalized-filter2.js +11 -11
  86. package/dist/components/snk-simple-crud2.js +69 -12
  87. package/dist/components/snk-taskbar2.js +1 -3
  88. package/dist/esm/{ConfigStorage-932ab366.js → ConfigStorage-1090289a.js} +49 -162
  89. package/dist/esm/{DataFetcher-7e18aa30.js → DataFetcher-a4ed43e7.js} +29 -67
  90. package/dist/esm/{SnkFormConfigManager-bb9afc3f.js → SnkFormConfigManager-de537eca.js} +21 -19
  91. package/dist/esm/{dataunit-fetcher-91a4eb82.js → dataunit-fetcher-8d0bfa4a.js} +1 -1
  92. package/dist/esm/filter-bar-config-fetcher-2417b8cf.js +153 -0
  93. package/dist/esm/{form-config-fetcher-aaaa79a6.js → form-config-fetcher-4065db9a.js} +3 -65
  94. package/dist/esm/loader.js +1 -1
  95. package/dist/esm/{pesquisa-fetcher-56b30fb4.js → pesquisa-fetcher-7460b876.js} +1 -1
  96. package/dist/esm/resource-fetcher-45a70066.js +66 -0
  97. package/dist/esm/sankhyablocks.js +1 -1
  98. package/dist/esm/snk-actions-button.entry.js +11 -18
  99. package/dist/esm/snk-application.entry.js +71 -49
  100. package/dist/esm/snk-attach.entry.js +9 -3
  101. package/dist/esm/snk-configurator.entry.js +1 -2
  102. package/dist/esm/snk-crud.entry.js +9 -28
  103. package/dist/esm/snk-data-exporter.entry.js +2 -2
  104. package/dist/esm/{snk-data-unit-3ab57d1a.js → snk-data-unit-3a0bbfcb.js} +6 -8
  105. package/dist/esm/snk-data-unit.entry.js +1 -1
  106. package/dist/esm/snk-detail-view.entry.js +25 -18
  107. package/dist/esm/snk-entity-list.entry.js +4 -0
  108. package/dist/esm/snk-filter-bar.entry.js +17 -14
  109. package/dist/esm/snk-filter-detail.entry.js +16 -2
  110. package/dist/esm/snk-filter-modal-item.entry.js +20 -6
  111. package/dist/esm/snk-form-config.entry.js +18 -7
  112. package/dist/esm/snk-form-view.entry.js +1 -6
  113. package/dist/esm/snk-form.entry.js +8 -12
  114. package/dist/esm/snk-grid-config.entry.js +6 -5
  115. package/dist/esm/snk-grid.entry.js +20 -20
  116. package/dist/esm/{snk-guides-viewer-cc709b5f.js → snk-guides-viewer-a6d39c18.js} +9 -18
  117. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  118. package/dist/esm/snk-personalized-filter.entry.js +16 -13
  119. package/dist/esm/snk-print-selector.entry.js +1 -1
  120. package/dist/esm/snk-simple-crud.entry.js +71 -13
  121. package/dist/esm/snk-taskbar.entry.js +1 -2
  122. package/dist/sankhyablocks/p-0fb83448.js +1 -0
  123. package/dist/sankhyablocks/p-15aba6fb.entry.js +11 -0
  124. package/dist/sankhyablocks/p-216f081a.entry.js +1 -0
  125. package/dist/sankhyablocks/p-21e7c08e.entry.js +1 -0
  126. package/dist/sankhyablocks/p-2861d44f.entry.js +1 -0
  127. package/dist/sankhyablocks/p-2d883fe9.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-d13c00b6.entry.js → p-3d6f91c2.entry.js} +1 -1
  129. package/dist/sankhyablocks/{p-f8e6b97e.js → p-44e66c8d.js} +1 -1
  130. package/dist/sankhyablocks/p-4514fc6a.entry.js +1 -0
  131. package/dist/sankhyablocks/p-4f4cd005.entry.js +1 -0
  132. package/dist/sankhyablocks/p-50c13cc8.entry.js +1 -0
  133. package/dist/sankhyablocks/p-52c6b2e7.js +1 -0
  134. package/dist/sankhyablocks/p-5994af77.js +56 -0
  135. package/dist/sankhyablocks/p-5df17074.js +1 -0
  136. package/dist/sankhyablocks/p-6bb904bb.entry.js +1 -0
  137. package/dist/sankhyablocks/p-6f0795c8.entry.js +1 -0
  138. package/dist/sankhyablocks/p-7588f006.entry.js +1 -0
  139. package/dist/sankhyablocks/p-847e6c20.js +17 -0
  140. package/dist/sankhyablocks/p-9471cbc9.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-14eac6fe.js → p-9d18017a.js} +1 -1
  142. package/dist/sankhyablocks/p-9edad923.js +1 -0
  143. package/dist/sankhyablocks/p-a42dd503.entry.js +1 -0
  144. package/dist/sankhyablocks/{p-2d333d22.js → p-b978da60.js} +1 -1
  145. package/dist/sankhyablocks/p-befbc9ee.entry.js +1 -0
  146. package/dist/sankhyablocks/p-c6380ea2.entry.js +1 -0
  147. package/dist/sankhyablocks/{p-03bb1aea.entry.js → p-c6feb995.entry.js} +1 -1
  148. package/dist/sankhyablocks/p-c945318c.entry.js +1 -0
  149. package/dist/sankhyablocks/p-ccbfb1cf.entry.js +1 -0
  150. package/dist/sankhyablocks/p-d7c7a289.entry.js +1 -0
  151. package/dist/sankhyablocks/p-de69b4b0.entry.js +1 -0
  152. package/dist/sankhyablocks/p-f3b7b69e.js +10 -0
  153. package/dist/sankhyablocks/p-f7eded3a.entry.js +1 -0
  154. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  155. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -2
  156. package/dist/types/components/snk-application/snk-application.d.ts +13 -8
  157. package/dist/types/components/snk-configurator/snk-configurator.d.ts +0 -4
  158. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -10
  159. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -13
  160. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +0 -5
  161. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +2 -13
  162. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +0 -8
  163. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +4 -0
  164. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
  165. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  166. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +4 -5
  167. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
  168. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +4 -5
  169. package/dist/types/components/snk-form/snk-form.d.ts +1 -9
  170. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +2 -0
  171. package/dist/types/components/snk-grid/snk-grid.d.ts +1 -18
  172. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +0 -4
  173. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +1 -5
  174. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -8
  175. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -4
  176. package/dist/types/components.d.ts +21 -189
  177. package/dist/types/lib/configs/ConfigStorage.d.ts +13 -11
  178. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +7 -0
  179. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  180. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +1 -0
  181. package/dist/types/lib/index.d.ts +0 -11
  182. package/dist/types/lib/utils/urlutils.d.ts +0 -14
  183. package/package.json +2 -2
  184. package/dist/cjs/ISave-d68ce3cd.js +0 -8
  185. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +0 -12
  186. package/dist/cjs/auth-fetcher-319a4cb2.js +0 -34
  187. package/dist/collection/lib/resourceid/ResourceIDUtils.js +0 -7
  188. package/dist/components/ResourceIDUtils.js +0 -10
  189. package/dist/components/auth-fetcher.js +0 -32
  190. package/dist/esm/ISave-4412b20c.js +0 -8
  191. package/dist/esm/ResourceIDUtils-a114189a.js +0 -10
  192. package/dist/esm/auth-fetcher-6d9664b7.js +0 -32
  193. package/dist/sankhyablocks/p-01739b21.entry.js +0 -1
  194. package/dist/sankhyablocks/p-05dbc70e.entry.js +0 -1
  195. package/dist/sankhyablocks/p-41e897f1.js +0 -56
  196. package/dist/sankhyablocks/p-48a40939.js +0 -1
  197. package/dist/sankhyablocks/p-611aa624.entry.js +0 -1
  198. package/dist/sankhyablocks/p-66bb8c20.entry.js +0 -1
  199. package/dist/sankhyablocks/p-688dcb4c.js +0 -1
  200. package/dist/sankhyablocks/p-6f154396.entry.js +0 -1
  201. package/dist/sankhyablocks/p-787071a8.js +0 -1
  202. package/dist/sankhyablocks/p-8481bb59.entry.js +0 -1
  203. package/dist/sankhyablocks/p-8818d8f6.entry.js +0 -1
  204. package/dist/sankhyablocks/p-93f6ca04.entry.js +0 -1
  205. package/dist/sankhyablocks/p-9a270401.entry.js +0 -1
  206. package/dist/sankhyablocks/p-9e7d65a4.js +0 -1
  207. package/dist/sankhyablocks/p-a52a6c9d.js +0 -26
  208. package/dist/sankhyablocks/p-b6003974.entry.js +0 -1
  209. package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
  210. package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
  211. package/dist/sankhyablocks/p-d53a9169.entry.js +0 -1
  212. package/dist/sankhyablocks/p-d7638f45.entry.js +0 -11
  213. package/dist/sankhyablocks/p-e086cc2a.entry.js +0 -1
  214. package/dist/sankhyablocks/p-e64f3e17.entry.js +0 -1
  215. package/dist/sankhyablocks/p-ed41b38c.js +0 -1
  216. package/dist/sankhyablocks/p-ed705cbb.entry.js +0 -1
  217. package/dist/sankhyablocks/p-efc10705.entry.js +0 -1
  218. package/dist/sankhyablocks/p-f74fe358.js +0 -1
  219. package/dist/sankhyablocks/p-f91e0c5d.entry.js +0 -1
  220. package/dist/sankhyablocks/p-fa523d6b.entry.js +0 -1
  221. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +0 -3
@@ -1,14 +1,76 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, OnboardingUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking, DataType } from '@sankhyalabs/core';
2
+ import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DateUtils, StringUtils, 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 { C as ConfigStorage } from './ConfigStorage.js';
6
+ import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
7
7
  import { D as DataUnitFetcher } from './dataunit-fetcher.js';
8
- import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
8
+ import { R as ResourceFetcher } from './resource-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
+
12
74
  class TotalsFetcher {
13
75
  constructor() {
14
76
  this.templateByQuery = new Map();
@@ -71,6 +133,33 @@ class TotalsFetcher {
71
133
  }
72
134
  }
73
135
 
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
+
74
163
  class ParametersFetcher {
75
164
  constructor() {
76
165
  this.templateByQuery = new Map();
@@ -135,96 +224,35 @@ class ParametersFetcher {
135
224
  }
136
225
  }
137
226
 
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
- }
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
+
229
+ class AuthFetcher extends ResourceFetcher {
230
+ getData(resourceID) {
231
+ const completePath = `cfg://auth/${resourceID}`;
232
+ return new Promise((resolve, reject) => {
233
+ this.loadResource(completePath)
234
+ .then((loadedResource) => {
235
+ let auth = ObjectUtils.stringToObject(loadedResource);
236
+ if (auth && typeof (auth) === 'object') {
237
+ resolve(auth);
192
238
  }
239
+ }).catch((error) => {
240
+ reject(error);
193
241
  });
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);
242
+ });
224
243
  }
225
244
  }
226
-
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'];}}
245
+ var AutorizationType;
246
+ (function (AutorizationType) {
247
+ AutorizationType["INSERT"] = "I";
248
+ AutorizationType["UPDATE"] = "A";
249
+ AutorizationType["REMOVE"] = "E";
250
+ AutorizationType["SHOW"] = "C";
251
+ AutorizationType["CONFIG"] = "F";
252
+ AutorizationType["CONFIG_NUMBER"] = "N";
253
+ AutorizationType["CLONE"] = "D";
254
+ AutorizationType["CONFIG_GRID"] = "G";
255
+ })(AutorizationType || (AutorizationType = {}));
228
256
 
229
257
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
230
258
 
@@ -247,21 +275,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
247
275
  }
248
276
  return this._parameters;
249
277
  }
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
- });
278
+ get resourceID() {
279
+ if (!this._resourceID) {
280
+ this._resourceID = this.urlParams.get("workspaceResourceID") ||
281
+ this.urlParams.get("resourceID") ||
282
+ Workspace.resourceID ||
283
+ "unknown.resource.id";
262
284
  }
285
+ return this._resourceID;
263
286
  }
264
- async getApplicationAuth() {
287
+ get auth() {
265
288
  if (this._auth) {
266
289
  return Promise.resolve(this._auth);
267
290
  }
@@ -270,7 +293,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
270
293
  const waitingAuth = this._authPromises.length > 0;
271
294
  this._authPromises.push(new PendingPromise(resolve, reject));
272
295
  if (!waitingAuth) {
273
- this.authFetcher.getData(this.applicationResourceID).then((authList) => {
296
+ this.authFetcher.getData(this.resourceID).then((authList) => {
274
297
  this._auth = authList;
275
298
  while (this._authPromises.length > 0) {
276
299
  this._authPromises.pop().resolve(this._auth);
@@ -289,7 +312,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
289
312
  */
290
313
  async isUserSup() {
291
314
  return new Promise((resolve, reject) => {
292
- this.getAuth().then((authorization) => {
315
+ this.auth.then((authorization) => {
293
316
  this.getAuthList(authorization).then((auths) => {
294
317
  resolve(auths.isSup);
295
318
  }).catch(error => reject(error));
@@ -303,9 +326,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
303
326
  /**
304
327
  * Obtém `true` caso o usuário logado tem permissão pra determinada ação.
305
328
  */
306
- async hasAccess(access, resourceID) {
329
+ async hasAccess(access) {
307
330
  return new Promise((resolve, reject) => {
308
- this.getAuth(resourceID).then((authorization) => {
331
+ this.auth.then((authorization) => {
309
332
  this.getAuthList(authorization).then((auths) => {
310
333
  resolve(auths.isSup || auths.actions[access]);
311
334
  }).catch(error => reject(error));
@@ -315,9 +338,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
315
338
  /**
316
339
  * Obtém todos os acessos do usuário logado.
317
340
  */
318
- async getAllAccess(resourceID) {
341
+ async getAllAccess() {
319
342
  return new Promise((resolve, reject) => {
320
- this.getAuth(resourceID).then((authorization) => {
343
+ this.auth.then((authorization) => {
321
344
  this.getAuthList(authorization).then((auths) => {
322
345
  const allAccess = {};
323
346
  allAccess['isSup'] = auths.isSup;
@@ -501,16 +524,13 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
501
524
  * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
502
525
  * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
503
526
  */
504
- async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
505
- if (resourceID == undefined) {
506
- resourceID = this.applicationResourceID;
507
- }
527
+ async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
508
528
  return new Promise((resolve, reject) => {
509
529
  const duPromisses = this.getDuPromissesStack(dataUnitName);
510
530
  const waitingDu = duPromisses.length > 0;
511
531
  duPromisses.push(new PendingPromise(resolve, reject));
512
532
  if (!waitingDu) {
513
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
533
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID, parentDataUnit, configName);
514
534
  dataUnit.loadMetadata().then(() => {
515
535
  if (dataUnitName) {
516
536
  this.updateDataunitCache(undefined, dataUnitName, dataUnit);
@@ -541,14 +561,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
541
561
  /**
542
562
  * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
543
563
  */
544
- async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
564
+ async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
545
565
  return new Promise((resolve, reject) => {
546
566
  const dataUnit = this._duCache.get(dataUnitName);
547
567
  if (dataUnit) {
548
568
  resolve(dataUnit);
549
569
  }
550
570
  else {
551
- this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
571
+ this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
552
572
  resolve(dataUnit);
553
573
  }).catch(reason => reject(reason));
554
574
  }
@@ -597,20 +617,11 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
597
617
  async callServiceBroker(serviceName, payload, options) {
598
618
  return DataFetcher.get().callServiceBroker(serviceName, payload, options);
599
619
  }
600
- get applicationResourceID() {
601
- if (!this._applicationResourceID) {
602
- this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
603
- this.urlParams.get("resourceID") ||
604
- Workspace.resourceID ||
605
- "unknown.resource.id";
606
- }
607
- return this._applicationResourceID;
608
- }
609
620
  /**
610
621
  * Obtém o resourceID da tela em questão.
611
622
  */
612
623
  async getResourceID() {
613
- return Promise.resolve(this.applicationResourceID);
624
+ return Promise.resolve(this.resourceID);
614
625
  }
615
626
  /**
616
627
  * Obtém o UserId da tela em questão.
@@ -654,14 +665,20 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
654
665
  async info(message, options) {
655
666
  return ApplicationUtils.info(message, options);
656
667
  }
668
+ /**
669
+ * Obtém a configuração de grade.
670
+ */
671
+ async loadGridConfig(name) {
672
+ return this.gridConfigFetcher.getConfig(name, this.resourceID);
673
+ }
657
674
  /**
658
675
  * Obtém os totalizadores da grade.
659
676
  */
660
677
  async loadTotals(name, resourceID, filters) {
661
678
  return this.totalsFetcher.fetchTotals(name, resourceID, filters);
662
679
  }
663
- async getAuthList(auth) {
664
- return await (new MGEAuthorization()).parseFromJSON(auth);
680
+ async getAuthList(_auth) {
681
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
665
682
  }
666
683
  get urlParams() {
667
684
  if (!this._urlParams) {
@@ -675,6 +692,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
675
692
  }
676
693
  return this._dataUnitFetcher;
677
694
  }
695
+ get gridConfigFetcher() {
696
+ if (!this._gridConfigFetcher) {
697
+ this._gridConfigFetcher = new GridConfigFetcher();
698
+ }
699
+ return this._gridConfigFetcher;
700
+ }
678
701
  get totalsFetcher() {
679
702
  if (!this._totalsFetcher) {
680
703
  this._totalsFetcher = new TotalsFetcher();
@@ -772,7 +795,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
772
795
  * Obtém o nome das telas da aplicação
773
796
  */
774
797
  async getAppLabel() {
775
- return Workspace.getAppLabel(this.applicationResourceID);
798
+ return Workspace.getAppLabel(this._resourceID);
776
799
  }
777
800
  /**
778
801
  * Adiciona um listener no fetcher de Pesquisa
@@ -844,7 +867,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
844
867
  this._popUp.ezTitle = title;
845
868
  }
846
869
  componentWillLoad() {
847
- ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
848
870
  this._errorHandler = new SnkErrorHandler(this);
849
871
  this.messagesBuilder = new SnkMessageBuilder();
850
872
  ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
@@ -853,7 +875,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
853
875
  });
854
876
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
855
877
  ErrorTracking.init();
856
- ConfigStorage.preload(this.applicationResourceID, this.configName);
878
+ ConfigStorage.get();
857
879
  }
858
880
  connectedCallback() {
859
881
  ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -865,10 +887,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
865
887
  componentDidLoad() {
866
888
  this.applicationLoading.emit(true);
867
889
  window.requestAnimationFrame(() => {
868
- ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", false);
869
890
  this.applicationLoaded.emit(true);
870
891
  });
871
- ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
892
+ ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
872
893
  }
873
894
  render() {
874
895
  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 })));
@@ -912,6 +933,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
912
933
  "message": [64],
913
934
  "confirm": [64],
914
935
  "info": [64],
936
+ "loadGridConfig": [64],
915
937
  "loadTotals": [64],
916
938
  "executeSearch": [64],
917
939
  "executePreparedSearch": [64],
@@ -1,16 +1,23 @@
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';
5
4
  import { V as VIEW_MODE } from './constants.js';
6
5
  import { D as DataUnitFetcher } from './dataunit-fetcher.js';
7
6
  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
+
14
21
  class AttachFetcher {
15
22
  constructor(entityName, registerKey, dataUnitName) {
16
23
  var _a;
@@ -17,7 +17,6 @@ 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;
21
20
  this.viewMode = VIEW_MODE.GRID;
22
21
  this.messagesBuilder = undefined;
23
22
  }
@@ -82,7 +81,7 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
82
81
  componentWillLoad() {
83
82
  this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
84
83
  if (this._application) {
85
- this._application.getAllAccess(this.resourceID).then(access => (this._permissions = access));
84
+ this._application.getAllAccess().then(access => (this._permissions = access));
86
85
  }
87
86
  else {
88
87
  this._permissions = {};
@@ -95,7 +94,6 @@ const SnkConfigurator = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
95
94
  }, [6, "snk-configurator", {
96
95
  "showActionButtons": [4, "show-action-buttons"],
97
96
  "configName": [1, "config-name"],
98
- "resourceID": [1, "resource-i-d"],
99
97
  "viewMode": [2, "view-mode"],
100
98
  "messagesBuilder": [1040],
101
99
  "_opened": [32],
@@ -4,13 +4,8 @@ import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.
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';
12
7
  import { V as VIEW_MODE } from './constants.js';
13
- import { A as AutorizationType } from './auth-fetcher.js';
8
+ import { d as defineCustomElement$v } from './snk-actions-button2.js';
14
9
  import { d as defineCustomElement$u } from './snk-attach2.js';
15
10
  import { d as defineCustomElement$t } from './snk-config-options2.js';
16
11
  import { d as defineCustomElement$s } from './snk-configurator2.js';
@@ -48,14 +43,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
48
43
  this.actionClick = createEvent(this, "actionClick", 7);
49
44
  this.configuratorSave = createEvent(this, "configuratorSave", 7);
50
45
  this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
51
- this.formItemsReady = createEvent(this, "formItemsReady", 7);
52
46
  this._viewHistory = [];
53
47
  this._dataUnit = undefined;
54
48
  this._dataState = undefined;
55
49
  this.attachmentRegisterKey = undefined;
56
50
  this._currentViewMode = VIEW_MODE.GRID;
57
- this._canEdit = undefined;
58
- this._resourceID = undefined;
59
51
  this.configName = undefined;
60
52
  this.selectionToastConfig = undefined;
61
53
  this.showActionButtons = false;
@@ -66,7 +58,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
66
58
  this.multipleSelection = true;
67
59
  this.presentationMode = PresentationMode.PRIMARY;
68
60
  this.messagesBuilder = undefined;
69
- this.useEnterLikeTab = false;
70
61
  }
71
62
  /**
72
63
  * Usado para alternar a visão entre GRID e FORM externamente.
@@ -150,7 +141,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
150
141
  }
151
142
  componentWillLoad() {
152
143
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
153
- application.hasAccess(AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
144
+ // application.hasAccess(AutorizationType.UPDATE).then(canEdit=>this._canEdit = canEdit)
154
145
  let parent = this._element.parentElement;
155
146
  while (parent) {
156
147
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -162,11 +153,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
162
153
  if (!this._dataUnit) {
163
154
  this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
164
155
  this._dataUnit = evt.detail;
165
- this.initDataUnit(application);
156
+ this.initDataUnit();
166
157
  });
167
158
  }
168
159
  else {
169
- this.initDataUnit(application);
160
+ this.initDataUnit();
170
161
  }
171
162
  this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
172
163
  this._dataState = dataState;
@@ -182,18 +173,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
182
173
  this.configName = application.configName;
183
174
  }
184
175
  }
185
- async initDataUnit(application) {
176
+ initDataUnit() {
186
177
  this.addDataElementID();
187
178
  if (!this.messagesBuilder) {
188
179
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
189
180
  }
190
- if (this._resourceID == undefined) {
191
- //Tenta pegar o resourceID do snkDataUnit;
192
- this._resourceID = this._snkDataUnit.resourceID;
193
- if (this._resourceID == undefined) {
194
- this._resourceID = await application.getResourceID();
195
- }
196
- }
197
181
  }
198
182
  handleConfiguratorEvent(evt, type) {
199
183
  evt.stopImmediatePropagation();
@@ -204,11 +188,8 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
204
188
  this.configuratorCancel.emit();
205
189
  }
206
190
  render() {
207
- if (this._resourceID == undefined) {
208
- return;
209
- }
210
- this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
211
- 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, resourceID: this._resourceID }, 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 }, 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" })))));
191
+ // this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
192
+ 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 }, 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" }, 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
193
  }
213
194
  get _element() { return this; }
214
195
  static get watchers() { return {
@@ -226,13 +207,10 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
226
207
  "multipleSelection": [4, "multiple-selection"],
227
208
  "presentationMode": [1, "presentation-mode"],
228
209
  "messagesBuilder": [1040],
229
- "useEnterLikeTab": [4, "use-enter-like-tab"],
230
210
  "_dataUnit": [32],
231
211
  "_dataState": [32],
232
212
  "attachmentRegisterKey": [32],
233
213
  "_currentViewMode": [32],
234
- "_canEdit": [32],
235
- "_resourceID": [32],
236
214
  "goToView": [64],
237
215
  "openConfigurator": [64],
238
216
  "closeConfigurator": [64],