@sankhyalabs/sankhyablocks 8.1.0 → 8.2.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/cjs/{ConfigStorage-73e7afff.js → ConfigStorage-12397f18.js} +163 -51
  2. package/dist/cjs/{DataFetcher-004811c6.js → DataFetcher-f2da1f79.js} +68 -30
  3. package/dist/cjs/ISave-d68ce3cd.js +8 -0
  4. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  5. package/dist/cjs/{SnkFormConfigManager-d1f1a222.js → SnkFormConfigManager-13f79e37.js} +19 -21
  6. package/dist/cjs/auth-fetcher-319a4cb2.js +34 -0
  7. package/dist/cjs/{dataunit-fetcher-029eafbd.js → dataunit-fetcher-e72068c1.js} +1 -1
  8. package/dist/cjs/{form-config-fetcher-181767c9.js → form-config-fetcher-5d62ab62.js} +66 -3
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-9a97994a.js → pesquisa-fetcher-8c363096.js} +1 -1
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button.cjs.entry.js +18 -11
  13. package/dist/cjs/snk-application.cjs.entry.js +51 -73
  14. package/dist/cjs/snk-attach.cjs.entry.js +7 -13
  15. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  16. package/dist/cjs/snk-crud.cjs.entry.js +28 -9
  17. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  18. package/dist/cjs/{snk-data-unit-d5109a08.js → snk-data-unit-80a00ae4.js} +8 -6
  19. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-detail-view.cjs.entry.js +18 -25
  21. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +14 -17
  23. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
  24. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -19
  25. package/dist/cjs/snk-form-config.cjs.entry.js +6 -17
  26. package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
  27. package/dist/cjs/snk-form.cjs.entry.js +12 -8
  28. package/dist/cjs/snk-grid-config.cjs.entry.js +5 -6
  29. package/dist/cjs/snk-grid.cjs.entry.js +20 -20
  30. package/dist/cjs/{snk-guides-viewer-aa3e3bfa.js → snk-guides-viewer-a7cd6fda.js} +18 -9
  31. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  32. package/dist/cjs/snk-personalized-filter.cjs.entry.js +13 -16
  33. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  34. package/dist/cjs/snk-simple-crud.cjs.entry.js +22 -80
  35. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
  36. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  37. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  38. package/dist/collection/components/snk-application/snk-application.js +60 -65
  39. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  40. package/dist/collection/components/snk-crud/snk-crud.js +63 -8
  41. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +65 -15
  42. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
  43. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +66 -30
  44. package/dist/collection/components/snk-data-unit/snk-data-unit.js +42 -7
  45. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  46. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
  47. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  48. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  49. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
  50. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  51. package/dist/collection/components/snk-form/snk-form.js +46 -2
  52. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  53. package/dist/collection/components/snk-grid/snk-grid.js +110 -16
  54. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  55. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  56. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +43 -9
  57. package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
  58. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  59. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -59
  60. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +39 -30
  61. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  62. package/dist/collection/lib/index.js +10 -0
  63. package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
  64. package/dist/collection/lib/utils/urlutils.js +29 -0
  65. package/dist/components/ConfigStorage.js +161 -48
  66. package/dist/components/DataFetcher.js +68 -30
  67. package/dist/components/ResourceIDUtils.js +10 -0
  68. package/dist/components/SnkFormConfigManager.js +17 -19
  69. package/dist/components/auth-fetcher.js +32 -0
  70. package/dist/components/form-config-fetcher.js +64 -2
  71. package/dist/components/snk-actions-button2.js +23 -9
  72. package/dist/components/snk-application2.js +132 -154
  73. package/dist/components/snk-attach2.js +1 -8
  74. package/dist/components/snk-configurator2.js +3 -1
  75. package/dist/components/snk-crud.js +29 -7
  76. package/dist/components/snk-data-unit2.js +10 -6
  77. package/dist/components/snk-detail-view2.js +28 -23
  78. package/dist/components/snk-entity-list.js +0 -4
  79. package/dist/components/snk-filter-bar2.js +12 -12
  80. package/dist/components/snk-filter-detail2.js +2 -12
  81. package/dist/components/snk-filter-modal-item2.js +5 -16
  82. package/dist/components/snk-form-config2.js +5 -15
  83. package/dist/components/snk-form-view2.js +6 -1
  84. package/dist/components/snk-form.js +9 -2
  85. package/dist/components/snk-grid-config2.js +4 -2
  86. package/dist/components/snk-grid2.js +23 -16
  87. package/dist/components/snk-personalized-filter2.js +11 -11
  88. package/dist/components/snk-simple-crud2.js +12 -69
  89. package/dist/components/snk-taskbar2.js +3 -1
  90. package/dist/esm/{ConfigStorage-19a7260b.js → ConfigStorage-932ab366.js} +162 -49
  91. package/dist/esm/{DataFetcher-e0fc5549.js → DataFetcher-7e18aa30.js} +68 -30
  92. package/dist/esm/ISave-4412b20c.js +8 -0
  93. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  94. package/dist/esm/{SnkFormConfigManager-1a42eb02.js → SnkFormConfigManager-bb9afc3f.js} +19 -21
  95. package/dist/esm/auth-fetcher-6d9664b7.js +32 -0
  96. package/dist/esm/{dataunit-fetcher-6a695723.js → dataunit-fetcher-91a4eb82.js} +1 -1
  97. package/dist/esm/{form-config-fetcher-9e167008.js → form-config-fetcher-aaaa79a6.js} +65 -3
  98. package/dist/esm/loader.js +1 -1
  99. package/dist/esm/{pesquisa-fetcher-9118eb7a.js → pesquisa-fetcher-56b30fb4.js} +1 -1
  100. package/dist/esm/sankhyablocks.js +1 -1
  101. package/dist/esm/snk-actions-button.entry.js +18 -11
  102. package/dist/esm/snk-application.entry.js +49 -71
  103. package/dist/esm/snk-attach.entry.js +3 -9
  104. package/dist/esm/snk-configurator.entry.js +2 -1
  105. package/dist/esm/snk-crud.entry.js +28 -9
  106. package/dist/esm/snk-data-exporter.entry.js +2 -2
  107. package/dist/esm/{snk-data-unit-3a0bbfcb.js → snk-data-unit-3ab57d1a.js} +8 -6
  108. package/dist/esm/snk-data-unit.entry.js +1 -1
  109. package/dist/esm/snk-detail-view.entry.js +18 -25
  110. package/dist/esm/snk-entity-list.entry.js +0 -4
  111. package/dist/esm/snk-filter-bar.entry.js +14 -17
  112. package/dist/esm/snk-filter-detail.entry.js +2 -16
  113. package/dist/esm/snk-filter-modal-item.entry.js +6 -20
  114. package/dist/esm/snk-form-config.entry.js +7 -18
  115. package/dist/esm/snk-form-view.entry.js +6 -1
  116. package/dist/esm/snk-form.entry.js +12 -8
  117. package/dist/esm/snk-grid-config.entry.js +5 -6
  118. package/dist/esm/snk-grid.entry.js +20 -20
  119. package/dist/esm/{snk-guides-viewer-aa386f6e.js → snk-guides-viewer-cc709b5f.js} +18 -9
  120. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  121. package/dist/esm/snk-personalized-filter.entry.js +13 -16
  122. package/dist/esm/snk-print-selector.entry.js +1 -1
  123. package/dist/esm/snk-simple-crud.entry.js +13 -71
  124. package/dist/esm/snk-taskbar.entry.js +2 -1
  125. package/dist/sankhyablocks/p-01739b21.entry.js +1 -0
  126. package/dist/sankhyablocks/{p-e7e54737.entry.js → p-03bb1aea.entry.js} +1 -1
  127. package/dist/sankhyablocks/p-05dbc70e.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-0a4c753d.js → p-14eac6fe.js} +1 -1
  129. package/dist/sankhyablocks/{p-2ac9c585.js → p-2d333d22.js} +1 -1
  130. package/dist/sankhyablocks/p-41e897f1.js +56 -0
  131. package/dist/sankhyablocks/p-48a40939.js +1 -0
  132. package/dist/sankhyablocks/p-611aa624.entry.js +1 -0
  133. package/dist/sankhyablocks/p-66bb8c20.entry.js +1 -0
  134. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  135. package/dist/sankhyablocks/p-6f154396.entry.js +1 -0
  136. package/dist/sankhyablocks/p-787071a8.js +1 -0
  137. package/dist/sankhyablocks/p-8481bb59.entry.js +1 -0
  138. package/dist/sankhyablocks/p-8818d8f6.entry.js +1 -0
  139. package/dist/sankhyablocks/p-93f6ca04.entry.js +1 -0
  140. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  141. package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
  142. package/dist/sankhyablocks/p-a52a6c9d.js +26 -0
  143. package/dist/sankhyablocks/p-b6003974.entry.js +1 -0
  144. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  145. package/dist/sankhyablocks/{p-7c7764bf.entry.js → p-d13c00b6.entry.js} +1 -1
  146. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  147. package/dist/sankhyablocks/p-d53a9169.entry.js +1 -0
  148. package/dist/sankhyablocks/p-d7638f45.entry.js +11 -0
  149. package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
  150. package/dist/sankhyablocks/p-e64f3e17.entry.js +1 -0
  151. package/dist/sankhyablocks/p-ed41b38c.js +1 -0
  152. package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
  153. package/dist/sankhyablocks/p-efc10705.entry.js +1 -0
  154. package/dist/sankhyablocks/p-f74fe358.js +1 -0
  155. package/dist/sankhyablocks/{p-df8621b4.js → p-f8e6b97e.js} +1 -1
  156. package/dist/sankhyablocks/p-f91e0c5d.entry.js +1 -0
  157. package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
  158. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  159. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  160. package/dist/types/components/snk-application/snk-application.d.ts +8 -13
  161. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  162. package/dist/types/components/snk-crud/snk-crud.d.ts +10 -0
  163. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +13 -0
  164. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
  165. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +13 -2
  166. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +8 -0
  167. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  168. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  169. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  170. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  171. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  172. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  173. package/dist/types/components/snk-form/snk-form.d.ts +9 -1
  174. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  175. package/dist/types/components/snk-grid/snk-grid.d.ts +18 -1
  176. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  177. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  178. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +8 -0
  179. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
  180. package/dist/types/components.d.ts +189 -21
  181. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  182. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -7
  183. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  184. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  185. package/dist/types/lib/index.d.ts +11 -0
  186. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  187. package/dist/types/lib/utils/urlutils.d.ts +14 -0
  188. package/package.json +2 -2
  189. package/dist/cjs/filter-bar-config-fetcher-2b8ed9d0.js +0 -155
  190. package/dist/cjs/resource-fetcher-c0332609.js +0 -68
  191. package/dist/components/filter-bar-config-fetcher.js +0 -153
  192. package/dist/components/resource-fetcher.js +0 -66
  193. package/dist/esm/filter-bar-config-fetcher-06e02851.js +0 -153
  194. package/dist/esm/resource-fetcher-768d5556.js +0 -66
  195. package/dist/sankhyablocks/p-0a94fdbd.entry.js +0 -1
  196. package/dist/sankhyablocks/p-0ed0fc02.entry.js +0 -1
  197. package/dist/sankhyablocks/p-1e0189ff.entry.js +0 -1
  198. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  199. package/dist/sankhyablocks/p-50d72261.entry.js +0 -1
  200. package/dist/sankhyablocks/p-6759adae.entry.js +0 -1
  201. package/dist/sankhyablocks/p-7b8b8ae9.js +0 -10
  202. package/dist/sankhyablocks/p-815a42c0.entry.js +0 -1
  203. package/dist/sankhyablocks/p-8a41172a.entry.js +0 -1
  204. package/dist/sankhyablocks/p-8f8184ff.js +0 -56
  205. package/dist/sankhyablocks/p-8fdc3108.js +0 -1
  206. package/dist/sankhyablocks/p-976e56e9.js +0 -1
  207. package/dist/sankhyablocks/p-98f9d076.js +0 -17
  208. package/dist/sankhyablocks/p-9edad923.js +0 -1
  209. package/dist/sankhyablocks/p-abdcac04.entry.js +0 -1
  210. package/dist/sankhyablocks/p-b0847056.entry.js +0 -1
  211. package/dist/sankhyablocks/p-bc735728.entry.js +0 -1
  212. package/dist/sankhyablocks/p-be684b38.entry.js +0 -1
  213. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  214. package/dist/sankhyablocks/p-c0f656af.entry.js +0 -1
  215. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  216. package/dist/sankhyablocks/p-ccbfb1cf.entry.js +0 -1
  217. package/dist/sankhyablocks/p-d1b89765.js +0 -1
  218. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  219. package/dist/sankhyablocks/p-e28129aa.entry.js +0 -1
  220. package/dist/sankhyablocks/p-f31bfdee.entry.js +0 -1
  221. package/dist/sankhyablocks/p-f92fda53.entry.js +0 -11
@@ -4,6 +4,11 @@ import { D as DataFetcher } from './DataFetcher.js';
4
4
  import { P as ParamType } from './ParamType.js';
5
5
  import './pesquisa-fetcher.js';
6
6
  import './index2.js';
7
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
8
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
9
+ import './filter-item-type.enum.js';
10
+ import './form-config-fetcher.js';
11
+ import { R as ResourceIDUtils } from './ResourceIDUtils.js';
7
12
 
8
13
  const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
9
14
  class JavaExecutor {
@@ -153,18 +158,26 @@ var RefreshType;
153
158
  RefreshType["ALL"] = "ALL";
154
159
  })(RefreshType || (RefreshType = {}));
155
160
 
161
+ var SaveErrorsEnum;
162
+ (function (SaveErrorsEnum) {
163
+ SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
164
+ SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
165
+ SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
166
+ })(SaveErrorsEnum || (SaveErrorsEnum = {}));
167
+
156
168
  const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
157
169
  const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
158
170
  const NUFIN_COLUMN = 'NUFIN';
159
171
  const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
160
172
  class Actions {
161
- constructor(actionsExecuteInterface, dataUnit) {
173
+ constructor(actionsExecuteInterface, dataUnit, appResourceId) {
162
174
  var _a;
163
175
  this._lastValuesCache = {};
164
176
  this._actionsExecuteInterface = actionsExecuteInterface;
165
177
  this._dataUnit = dataUnit;
166
178
  this._selectedRows = ((_a = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo()) === null || _a === void 0 ? void 0 : _a.isAllRecords()) ? [] : dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getSelectionInfo().records;
167
179
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
180
+ this._appResourceId = appResourceId;
168
181
  }
169
182
  apply(action, hasParamsToSave) {
170
183
  this._application.closePopUp();
@@ -427,9 +440,7 @@ class Actions {
427
440
  }
428
441
  }
429
442
  async buildResourceId(actionId) {
430
- let appResId = '';
431
- appResId = await this._application.getResourceID();
432
- return appResId + '.actionconfig.' + actionId;
443
+ return this._appResourceId + '.actionconfig.' + actionId;
433
444
  }
434
445
  prepareAndExecute(execSource, executeAction) {
435
446
  this.addRows(execSource);
@@ -588,7 +599,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
588
599
  this.handleClick = (evt) => {
589
600
  const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
590
601
  const executor = new ExecutorFactory(selectedAction.type).executor;
591
- const action = new Actions(executor, this._dataUnit);
602
+ const action = new Actions(executor, this._dataUnit, this._resourceID);
592
603
  action.execute(Object.assign({}, selectedAction));
593
604
  this._showDropdown = false;
594
605
  };
@@ -646,12 +657,15 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
646
657
  document.addEventListener("scroll", this.positionDropdown.bind(this));
647
658
  }
648
659
  async componentWillLoad() {
649
- var _a;
650
660
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
651
- this._resourceID = await this._application.getResourceID();
652
661
  this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
653
- this._dataUnit = (_a = this._element.parentElement) === null || _a === void 0 ? void 0 : _a.dataUnit;
662
+ const snkDataUnit = this._element.parentElement;
663
+ this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
664
+ this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
654
665
  this._entityName = this._dataUnit.name.split('/')[2];
666
+ if (this._resourceID == undefined) {
667
+ this._resourceID = await ResourceIDUtils.getResourceID();
668
+ }
655
669
  this.setEvents();
656
670
  this.getActions().then(() => {
657
671
  this.loadItems();
@@ -715,4 +729,4 @@ function defineCustomElement() {
715
729
  } });
716
730
  }
717
731
 
718
- export { SnkActionsButton as S, defineCustomElement as d };
732
+ export { SnkActionsButton as S, SaveErrorsEnum as a, defineCustomElement as d };
@@ -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
- import { R as ResourceFetcher } from './resource-fetcher.js';
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,35 +135,96 @@ class ParametersFetcher {
224
135
  }
225
136
  }
226
137
 
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);
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
+ }
238
192
  }
239
- }).catch((error) => {
240
- reject(error);
241
193
  });
242
- });
194
+ }
243
195
  }
244
196
  }
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 = {}));
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
+ 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'];}}
256
228
 
257
229
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
258
230
 
@@ -275,16 +247,21 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
275
247
  }
276
248
  return this._parameters;
277
249
  }
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";
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
+ });
284
262
  }
285
- return this._resourceID;
286
263
  }
287
- get auth() {
264
+ async getApplicationAuth() {
288
265
  if (this._auth) {
289
266
  return Promise.resolve(this._auth);
290
267
  }
@@ -293,7 +270,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
293
270
  const waitingAuth = this._authPromises.length > 0;
294
271
  this._authPromises.push(new PendingPromise(resolve, reject));
295
272
  if (!waitingAuth) {
296
- this.authFetcher.getData(this.resourceID).then((authList) => {
273
+ this.authFetcher.getData(this.applicationResourceID).then((authList) => {
297
274
  this._auth = authList;
298
275
  while (this._authPromises.length > 0) {
299
276
  this._authPromises.pop().resolve(this._auth);
@@ -312,7 +289,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
312
289
  */
313
290
  async isUserSup() {
314
291
  return new Promise((resolve, reject) => {
315
- this.auth.then((authorization) => {
292
+ this.getAuth().then((authorization) => {
316
293
  this.getAuthList(authorization).then((auths) => {
317
294
  resolve(auths.isSup);
318
295
  }).catch(error => reject(error));
@@ -326,9 +303,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
326
303
  /**
327
304
  * Obtém `true` caso o usuário logado tem permissão pra determinada ação.
328
305
  */
329
- async hasAccess(access) {
306
+ async hasAccess(access, resourceID) {
330
307
  return new Promise((resolve, reject) => {
331
- this.auth.then((authorization) => {
308
+ this.getAuth(resourceID).then((authorization) => {
332
309
  this.getAuthList(authorization).then((auths) => {
333
310
  resolve(auths.isSup || auths.actions[access]);
334
311
  }).catch(error => reject(error));
@@ -338,9 +315,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
338
315
  /**
339
316
  * Obtém todos os acessos do usuário logado.
340
317
  */
341
- async getAllAccess() {
318
+ async getAllAccess(resourceID) {
342
319
  return new Promise((resolve, reject) => {
343
- this.auth.then((authorization) => {
320
+ this.getAuth(resourceID).then((authorization) => {
344
321
  this.getAuthList(authorization).then((auths) => {
345
322
  const allAccess = {};
346
323
  allAccess['isSup'] = auths.isSup;
@@ -524,13 +501,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
524
501
  * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
525
502
  * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
526
503
  */
527
- async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
504
+ async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
505
+ if (resourceID == undefined) {
506
+ resourceID = this.applicationResourceID;
507
+ }
528
508
  return new Promise((resolve, reject) => {
529
509
  const duPromisses = this.getDuPromissesStack(dataUnitName);
530
510
  const waitingDu = duPromisses.length > 0;
531
511
  duPromisses.push(new PendingPromise(resolve, reject));
532
512
  if (!waitingDu) {
533
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID, parentDataUnit, configName);
513
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
534
514
  dataUnit.loadMetadata().then(() => {
535
515
  if (dataUnitName) {
536
516
  this.updateDataunitCache(undefined, dataUnitName, dataUnit);
@@ -561,14 +541,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
561
541
  /**
562
542
  * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
563
543
  */
564
- async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
544
+ async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
565
545
  return new Promise((resolve, reject) => {
566
546
  const dataUnit = this._duCache.get(dataUnitName);
567
547
  if (dataUnit) {
568
548
  resolve(dataUnit);
569
549
  }
570
550
  else {
571
- this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
551
+ this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
572
552
  resolve(dataUnit);
573
553
  }).catch(reason => reject(reason));
574
554
  }
@@ -617,11 +597,20 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
617
597
  async callServiceBroker(serviceName, payload, options) {
618
598
  return DataFetcher.get().callServiceBroker(serviceName, payload, options);
619
599
  }
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
+ }
620
609
  /**
621
610
  * Obtém o resourceID da tela em questão.
622
611
  */
623
612
  async getResourceID() {
624
- return Promise.resolve(this.resourceID);
613
+ return Promise.resolve(this.applicationResourceID);
625
614
  }
626
615
  /**
627
616
  * Obtém o UserId da tela em questão.
@@ -665,20 +654,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
665
654
  async info(message, options) {
666
655
  return ApplicationUtils.info(message, options);
667
656
  }
668
- /**
669
- * Obtém a configuração de grade.
670
- */
671
- async loadGridConfig(name) {
672
- return this.gridConfigFetcher.getConfig(name, this.resourceID);
673
- }
674
657
  /**
675
658
  * Obtém os totalizadores da grade.
676
659
  */
677
660
  async loadTotals(name, resourceID, filters) {
678
661
  return this.totalsFetcher.fetchTotals(name, resourceID, filters);
679
662
  }
680
- async getAuthList(_auth) {
681
- return await (new MGEAuthorization()).parseFromJSON(_auth);
663
+ async getAuthList(auth) {
664
+ return await (new MGEAuthorization()).parseFromJSON(auth);
682
665
  }
683
666
  get urlParams() {
684
667
  if (!this._urlParams) {
@@ -692,12 +675,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
692
675
  }
693
676
  return this._dataUnitFetcher;
694
677
  }
695
- get gridConfigFetcher() {
696
- if (!this._gridConfigFetcher) {
697
- this._gridConfigFetcher = new GridConfigFetcher();
698
- }
699
- return this._gridConfigFetcher;
700
- }
701
678
  get totalsFetcher() {
702
679
  if (!this._totalsFetcher) {
703
680
  this._totalsFetcher = new TotalsFetcher();
@@ -795,7 +772,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
795
772
  * Obtém o nome das telas da aplicação
796
773
  */
797
774
  async getAppLabel() {
798
- return Workspace.getAppLabel(this._resourceID);
775
+ return Workspace.getAppLabel(this.applicationResourceID);
799
776
  }
800
777
  /**
801
778
  * Adiciona um listener no fetcher de Pesquisa
@@ -867,6 +844,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
867
844
  this._popUp.ezTitle = title;
868
845
  }
869
846
  componentWillLoad() {
847
+ ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", true);
870
848
  this._errorHandler = new SnkErrorHandler(this);
871
849
  this.messagesBuilder = new SnkMessageBuilder();
872
850
  ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", `${UrlUtils.getUrlBase()}/mge/upload/file`);
@@ -875,7 +853,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
875
853
  });
876
854
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
877
855
  ErrorTracking.init();
878
- ConfigStorage.get();
856
+ ConfigStorage.preload(this.applicationResourceID, this.configName);
879
857
  }
880
858
  connectedCallback() {
881
859
  ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -887,9 +865,10 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
887
865
  componentDidLoad() {
888
866
  this.applicationLoading.emit(true);
889
867
  window.requestAnimationFrame(() => {
868
+ ApplicationContext.setContextValue("__SNK__APPLICATION__LOADING__", false);
890
869
  this.applicationLoaded.emit(true);
891
870
  });
892
- ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
871
+ ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
893
872
  }
894
873
  render() {
895
874
  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 })));
@@ -933,7 +912,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
933
912
  "message": [64],
934
913
  "confirm": [64],
935
914
  "info": [64],
936
- "loadGridConfig": [64],
937
915
  "loadTotals": [64],
938
916
  "executeSearch": [64],
939
917
  "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],