@sankhyalabs/sankhyablocks 8.1.0-dev.1 → 8.1.0-dev.11

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 (212) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/{ConfigStorage-73e7afff.js → ConfigStorage-d688c739.js} +163 -50
  3. package/dist/cjs/{DataFetcher-004811c6.js → DataFetcher-d2c6ae38.js} +29 -0
  4. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  5. package/dist/cjs/{SnkFormConfigManager-d1f1a222.js → SnkFormConfigManager-29b73c81.js} +19 -21
  6. package/dist/cjs/{auth-fetcher-58237931.js → auth-fetcher-da975ac5.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-029eafbd.js → dataunit-fetcher-58ad78a7.js} +1 -1
  8. package/dist/cjs/{form-config-fetcher-181767c9.js → form-config-fetcher-761994b9.js} +2 -2
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-9a97994a.js → pesquisa-fetcher-bb0bb679.js} +1 -1
  11. package/dist/cjs/{resource-fetcher-c0332609.js → resource-fetcher-95d24dff.js} +1 -1
  12. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  13. package/dist/cjs/snk-actions-button.cjs.entry.js +13 -10
  14. package/dist/cjs/snk-application.cjs.entry.js +48 -44
  15. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  17. package/dist/cjs/snk-crud.cjs.entry.js +21 -9
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  19. package/dist/cjs/{snk-data-unit-cc7a7ed0.js → snk-data-unit-80a00ae4.js} +4 -4
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +11 -10
  22. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  23. package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -17
  24. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -19
  26. package/dist/cjs/snk-form-config.cjs.entry.js +7 -17
  27. package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
  28. package/dist/cjs/snk-form.cjs.entry.js +13 -8
  29. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -6
  30. package/dist/cjs/snk-grid.cjs.entry.js +18 -20
  31. package/dist/cjs/{snk-guides-viewer-27f87d90.js → snk-guides-viewer-f67f9cea.js} +12 -7
  32. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
  33. package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
  34. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  35. package/dist/cjs/snk-simple-crud.cjs.entry.js +15 -71
  36. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
  37. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  38. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  39. package/dist/collection/components/snk-application/snk-application.js +58 -65
  40. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  41. package/dist/collection/components/snk-crud/snk-crud.js +40 -6
  42. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +42 -2
  43. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
  44. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +47 -28
  45. package/dist/collection/components/snk-data-unit/snk-data-unit.js +7 -8
  46. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  47. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
  48. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  49. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  50. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
  51. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  52. package/dist/collection/components/snk-form/snk-form.js +46 -2
  53. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  54. package/dist/collection/components/snk-grid/snk-grid.js +51 -15
  55. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  56. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  57. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +22 -0
  58. package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
  59. package/dist/collection/components/teste-pesquisa/teste-pesquisa.css +1 -1
  60. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  61. package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -59
  62. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  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 +29 -0
  67. package/dist/components/ResourceIDUtils.js +10 -0
  68. package/dist/components/SnkFormConfigManager.js +17 -19
  69. package/dist/components/auth-fetcher.js +1 -1
  70. package/dist/components/form-config-fetcher.js +64 -2
  71. package/dist/components/snk-actions-button2.js +11 -8
  72. package/dist/components/snk-application2.js +42 -38
  73. package/dist/components/snk-configurator2.js +3 -1
  74. package/dist/components/snk-crud.js +18 -5
  75. package/dist/components/snk-data-unit2.js +5 -4
  76. package/dist/components/snk-detail-view2.js +15 -7
  77. package/dist/components/snk-entity-list.js +0 -4
  78. package/dist/components/snk-filter-bar2.js +12 -12
  79. package/dist/components/snk-filter-detail2.js +2 -12
  80. package/dist/components/snk-filter-modal-item2.js +5 -16
  81. package/dist/components/snk-form-config2.js +5 -15
  82. package/dist/components/snk-form-view2.js +6 -1
  83. package/dist/components/snk-form.js +9 -2
  84. package/dist/components/snk-grid-config2.js +4 -2
  85. package/dist/components/snk-grid2.js +17 -16
  86. package/dist/components/snk-personalized-filter2.js +11 -11
  87. package/dist/components/snk-simple-crud2.js +3 -59
  88. package/dist/components/snk-taskbar2.js +3 -1
  89. package/dist/esm/{ConfigStorage-19a7260b.js → ConfigStorage-cfe03e99.js} +163 -49
  90. package/dist/esm/{DataFetcher-e0fc5549.js → DataFetcher-aaaff866.js} +29 -0
  91. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  92. package/dist/esm/{SnkFormConfigManager-1a42eb02.js → SnkFormConfigManager-bfd8eabd.js} +19 -21
  93. package/dist/esm/{auth-fetcher-83a946f8.js → auth-fetcher-7860d777.js} +1 -1
  94. package/dist/esm/{dataunit-fetcher-6a695723.js → dataunit-fetcher-9dfcdb1d.js} +1 -1
  95. package/dist/esm/{form-config-fetcher-9e167008.js → form-config-fetcher-4a34b86a.js} +2 -2
  96. package/dist/esm/loader.js +1 -1
  97. package/dist/esm/{pesquisa-fetcher-9118eb7a.js → pesquisa-fetcher-01d058e6.js} +1 -1
  98. package/dist/{components/resource-fetcher.js → esm/resource-fetcher-b36ac145.js} +1 -1
  99. package/dist/esm/sankhyablocks.js +1 -1
  100. package/dist/esm/snk-actions-button.entry.js +13 -10
  101. package/dist/esm/snk-application.entry.js +48 -44
  102. package/dist/esm/snk-attach.entry.js +2 -2
  103. package/dist/esm/snk-configurator.entry.js +2 -1
  104. package/dist/esm/snk-crud.entry.js +21 -9
  105. package/dist/esm/snk-data-exporter.entry.js +2 -2
  106. package/dist/esm/{snk-data-unit-77508763.js → snk-data-unit-3ab57d1a.js} +4 -4
  107. package/dist/esm/snk-data-unit.entry.js +1 -1
  108. package/dist/esm/snk-detail-view.entry.js +11 -10
  109. package/dist/esm/snk-entity-list.entry.js +0 -4
  110. package/dist/esm/snk-filter-bar.entry.js +15 -17
  111. package/dist/esm/snk-filter-detail.entry.js +2 -16
  112. package/dist/esm/snk-filter-modal-item.entry.js +7 -20
  113. package/dist/esm/snk-form-config.entry.js +8 -18
  114. package/dist/esm/snk-form-view.entry.js +6 -1
  115. package/dist/esm/snk-form.entry.js +13 -8
  116. package/dist/esm/snk-grid-config.entry.js +6 -6
  117. package/dist/esm/snk-grid.entry.js +18 -20
  118. package/dist/esm/{snk-guides-viewer-c47cd45e.js → snk-guides-viewer-3ea14ab4.js} +12 -7
  119. package/dist/esm/snk-guides-viewer.entry.js +7 -8
  120. package/dist/esm/snk-personalized-filter.entry.js +14 -16
  121. package/dist/esm/snk-print-selector.entry.js +1 -1
  122. package/dist/esm/snk-simple-crud.entry.js +5 -61
  123. package/dist/esm/snk-taskbar.entry.js +2 -1
  124. package/dist/sankhyablocks/{p-e7e54737.entry.js → p-05bcad8a.entry.js} +1 -1
  125. package/dist/sankhyablocks/p-0ae5b923.entry.js +1 -0
  126. package/dist/sankhyablocks/p-15230263.js +1 -0
  127. package/dist/sankhyablocks/p-18fa618e.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-0ed0fc02.entry.js → p-1b81c379.entry.js} +1 -1
  129. package/dist/sankhyablocks/{p-98f9d076.js → p-2dd0f891.js} +2 -2
  130. package/dist/sankhyablocks/p-330f584a.entry.js +1 -0
  131. package/dist/sankhyablocks/{p-968741cc.js → p-48a40939.js} +1 -1
  132. package/dist/sankhyablocks/p-4c33a77c.entry.js +1 -0
  133. package/dist/sankhyablocks/p-53884b5f.entry.js +1 -0
  134. package/dist/sankhyablocks/{p-df8621b4.js → p-60791bb6.js} +1 -1
  135. package/dist/sankhyablocks/{p-f88c45bf.js → p-64c2cec3.js} +1 -1
  136. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  137. package/dist/sankhyablocks/p-70e785db.entry.js +1 -0
  138. package/dist/sankhyablocks/{p-0a4c753d.js → p-85affa29.js} +1 -1
  139. package/dist/sankhyablocks/p-861a3495.entry.js +1 -0
  140. package/dist/sankhyablocks/p-878b0dd3.entry.js +1 -0
  141. package/dist/sankhyablocks/p-97d2fbd9.entry.js +1 -0
  142. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  143. package/dist/sankhyablocks/p-9d591463.js +1 -0
  144. package/dist/sankhyablocks/p-9d93da18.js +56 -0
  145. package/dist/sankhyablocks/{p-34085ced.entry.js → p-9f387187.entry.js} +1 -1
  146. package/dist/sankhyablocks/p-aa4c112f.entry.js +11 -0
  147. package/dist/sankhyablocks/p-bae87498.entry.js +1 -0
  148. package/dist/sankhyablocks/{p-2ac9c585.js → p-bee6b5d7.js} +1 -1
  149. package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
  150. package/dist/sankhyablocks/p-cc67bd06.entry.js +1 -0
  151. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  152. package/dist/sankhyablocks/p-e070d7a3.entry.js +1 -0
  153. package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
  154. package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
  155. package/dist/sankhyablocks/{p-7b8b8ae9.js → p-f737f7e1.js} +1 -1
  156. package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
  157. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  158. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  159. package/dist/types/components/snk-application/snk-application.d.ts +8 -13
  160. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  161. package/dist/types/components/snk-crud/snk-crud.d.ts +5 -0
  162. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +8 -0
  163. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
  164. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +9 -2
  165. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +2 -2
  166. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  167. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  168. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  169. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  170. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  171. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  172. package/dist/types/components/snk-form/snk-form.d.ts +9 -1
  173. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  174. package/dist/types/components/snk-grid/snk-grid.d.ts +5 -1
  175. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  176. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  177. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
  178. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
  179. package/dist/types/components.d.ts +125 -21
  180. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  181. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -7
  182. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  183. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  184. package/dist/types/lib/utils/urlutils.d.ts +14 -0
  185. package/package.json +3 -3
  186. package/dist/cjs/filter-bar-config-fetcher-2b8ed9d0.js +0 -155
  187. package/dist/components/filter-bar-config-fetcher.js +0 -153
  188. package/dist/esm/filter-bar-config-fetcher-06e02851.js +0 -153
  189. package/dist/esm/resource-fetcher-768d5556.js +0 -66
  190. package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
  191. package/dist/sankhyablocks/p-22c6fe1a.entry.js +0 -1
  192. package/dist/sankhyablocks/p-34a1357a.entry.js +0 -1
  193. package/dist/sankhyablocks/p-4721c3db.js +0 -1
  194. package/dist/sankhyablocks/p-6759adae.entry.js +0 -1
  195. package/dist/sankhyablocks/p-7e285d6c.entry.js +0 -11
  196. package/dist/sankhyablocks/p-815a42c0.entry.js +0 -1
  197. package/dist/sankhyablocks/p-8a41172a.entry.js +0 -1
  198. package/dist/sankhyablocks/p-8f8184ff.js +0 -56
  199. package/dist/sankhyablocks/p-976e56e9.js +0 -1
  200. package/dist/sankhyablocks/p-bc735728.entry.js +0 -1
  201. package/dist/sankhyablocks/p-be684b38.entry.js +0 -1
  202. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  203. package/dist/sankhyablocks/p-c0f656af.entry.js +0 -1
  204. package/dist/sankhyablocks/p-c44f6aaf.entry.js +0 -1
  205. package/dist/sankhyablocks/p-c57bd935.entry.js +0 -1
  206. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  207. package/dist/sankhyablocks/p-cfd7da4a.entry.js +0 -1
  208. package/dist/sankhyablocks/p-d1b89765.js +0 -1
  209. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  210. package/dist/sankhyablocks/p-e28129aa.entry.js +0 -1
  211. package/dist/sankhyablocks/p-f31bfdee.entry.js +0 -1
  212. package/dist/sankhyablocks/p-fe010e54.entry.js +0 -1
@@ -2,17 +2,16 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-27f87d90.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-f67f9cea.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-d1f1a222.js');
9
- require('./ConfigStorage-73e7afff.js');
10
- require('./form-config-fetcher-181767c9.js');
11
- require('./DataFetcher-004811c6.js');
8
+ require('./SnkFormConfigManager-29b73c81.js');
9
+ require('./ConfigStorage-d688c739.js');
10
+ require('./form-config-fetcher-761994b9.js');
11
+ require('./DataFetcher-d2c6ae38.js');
12
12
  require('./_commonjsHelpers-537d719a.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
- require('./resource-fetcher-c0332609.js');
15
- require('./filter-bar-config-fetcher-2b8ed9d0.js');
14
+ require('./resource-fetcher-95d24dff.js');
16
15
  require('./filter-item-type.enum-aa823a00.js');
17
16
  require('@sankhyalabs/ezui/dist/collection/utils/form');
18
17
  require('./taskbar-processor-bce3f499.js');
@@ -20,7 +19,7 @@ require('./taskbar-elements-b98dd6e9.js');
20
19
  require('./index-0e663819.js');
21
20
  require('./index-102ba62d.js');
22
21
  require('./constants-d187e03e.js');
23
- require('./pesquisa-fetcher-9a97994a.js');
22
+ require('./pesquisa-fetcher-bb0bb679.js');
24
23
  require('@sankhyalabs/core/dist/dataunit/DataUnit');
25
24
 
26
25
 
@@ -5,17 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-1aeb625d.js');
8
- const ConfigStorage = require('./ConfigStorage-73e7afff.js');
8
+ const ConfigStorage = require('./ConfigStorage-d688c739.js');
9
9
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  const index$1 = require('./index-c5771aba.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
12
  require('./filter-item-type.enum-aa823a00.js');
13
- require('./form-config-fetcher-181767c9.js');
14
- require('./DataFetcher-004811c6.js');
13
+ require('./form-config-fetcher-761994b9.js');
14
+ require('./DataFetcher-d2c6ae38.js');
15
15
  require('./_commonjsHelpers-537d719a.js');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
- require('./resource-fetcher-c0332609.js');
18
- require('./filter-bar-config-fetcher-2b8ed9d0.js');
17
+ require('./resource-fetcher-95d24dff.js');
19
18
 
20
19
  const snkPersonalizedFilterCss = ".sc-snk-personalized-filter-h{display:flex;height:100%;padding:var(--space--large, 24px);--snk-personalized-filter--width:100%;--snk-personalized-filter--height:100%;--snk-personalized-filter--background-color-line:var(--color--disable-secondary);--snk-personalized-filter--margin-line:var(--border--radius-medium, 12px)}.snk-personalized-filter.sc-snk-personalized-filter{height:var(--snk-personalized-filter--width);width:var(--snk-personalized-filter--height)}.snk-personalized-filter__header-actions.sc-snk-personalized-filter{display:flex;gap:var(--space--medium)}.snk-personalized-filter__group.sc-snk-personalized-filter{flex:1}.snk-personalized-filter__expression-input--line.sc-snk-personalized-filter{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}.ez-box__main.sc-snk-personalized-filter{height:90%}.snk-personalized-filter__button-mode.sc-snk-personalized-filter{height:35px}";
21
20
 
@@ -45,6 +44,7 @@ const SnkPersonalizedFilter = class {
45
44
  this.entityUri = undefined;
46
45
  this.filterId = undefined;
47
46
  this.configName = undefined;
47
+ this.resourceID = undefined;
48
48
  }
49
49
  /*
50
50
  * Cria um novo filtro se não houver nenhum filtro existente
@@ -81,17 +81,15 @@ const SnkPersonalizedFilter = class {
81
81
  this._filterAssistent = core.ObjectUtils.copy(newPersonalizedFilter);
82
82
  }
83
83
  loadFilter(newValue, oldValue) {
84
- if (newValue == null || oldValue == newValue) {
84
+ if (newValue == null || oldValue == newValue || this.resourceID == undefined) {
85
85
  return;
86
86
  }
87
- ConfigStorage.ConfigStorage.get().then((_instance) => {
88
- ConfigStorage.ConfigStorage.loadPersonalizedFilter(newValue, this.configName)
89
- .then((resp) => {
90
- const personalizedFilter = this.addLabelToItems(resp);
91
- this._filterAssistent = personalizedFilter;
92
- this._originalFilterAssistent = core.ObjectUtils.copy(personalizedFilter);
93
- this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
94
- });
87
+ ConfigStorage.ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
88
+ .then((resp) => {
89
+ const personalizedFilter = this.addLabelToItems(resp);
90
+ this._filterAssistent = personalizedFilter;
91
+ this._originalFilterAssistent = core.ObjectUtils.copy(personalizedFilter);
92
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
95
93
  });
96
94
  }
97
95
  componentWillLoad() {
@@ -116,7 +114,7 @@ const SnkPersonalizedFilter = class {
116
114
  return this._application.messagesBuilder.getMessage(key, params);
117
115
  }
118
116
  saveFilter() {
119
- ConfigStorage.ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.configName).then((personalizedFilter) => {
117
+ ConfigStorage.ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName).then((personalizedFilter) => {
120
118
  this._elButtonSave.enabled = false;
121
119
  const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
122
120
  utils.ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
@@ -127,7 +125,7 @@ const SnkPersonalizedFilter = class {
127
125
  });
128
126
  }
129
127
  removeFilter() {
130
- ConfigStorage.ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
128
+ ConfigStorage.ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
131
129
  }
132
130
  hasChangesToSave() {
133
131
  return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
- const DataFetcher = require('./DataFetcher-004811c6.js');
6
+ const DataFetcher = require('./DataFetcher-d2c6ae38.js');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const core = require('@sankhyalabs/core');
9
9
  const ModalButtonStatus = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container/modal-button-status');
@@ -4,13 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const constants$1 = require('./constants-d187e03e.js');
7
+ const constants = require('./constants-d187e03e.js');
8
8
  const taskbarElements = require('./taskbar-elements-b98dd6e9.js');
9
- require('./DataFetcher-004811c6.js');
10
- require('./pesquisa-fetcher-9a97994a.js');
9
+ require('./DataFetcher-d2c6ae38.js');
10
+ require('./pesquisa-fetcher-bb0bb679.js');
11
11
  const index$1 = require('./index-0e663819.js');
12
12
  const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
13
- const constants = require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
13
  const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-804ff4c7.js');
15
14
  require('./index-102ba62d.js');
16
15
  require('./_commonjsHelpers-537d719a.js');
@@ -22,7 +21,7 @@ class InMemoryLoader {
22
21
  this.metadata = metadata;
23
22
  this._dataUnit = new core.DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
24
23
  this._dataUnit.metadataLoader = () => this.metadaLoader();
25
- this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
24
+ this._dataUnit.dataLoader = (dataUnit, request) => core.defaultDataLoader(dataUnit, request, this._records);
26
25
  this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
27
26
  this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
28
27
  this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
@@ -59,62 +58,6 @@ class InMemoryLoader {
59
58
  metadaLoader() {
60
59
  return Promise.resolve(this._metadata);
61
60
  }
62
- dataLoader(dataUnit, request) {
63
- const filters = this.getColumnFilters(dataUnit);
64
- let records = this.applyFilters(filters);
65
- if (request.sort) {
66
- request.sort.forEach(sort => {
67
- records = records.sort((recordA, recordB) => {
68
- const fieldA = recordA[sort.field];
69
- const fieldB = recordB[sort.field];
70
- const sortFn = this.getSortFn(sort.dataType);
71
- return sortFn(fieldA, fieldB) * (sort.mode == core.SortMode.ASC ? 1 : -1);
72
- });
73
- });
74
- }
75
- return Promise.resolve({ records: records });
76
- }
77
- applyFilters(filters) {
78
- let records = [...this._records];
79
- filters.forEach(filter => {
80
- records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
81
- });
82
- return records;
83
- }
84
- getColumnFilters(dataUnit) {
85
- var _a, _b;
86
- const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
87
- const columnFilters = (_b = allFilters.filter(filter => { var _a; return (_a = filter.name) === null || _a === void 0 ? void 0 : _a.includes(constants.DISTINCT_FILTER_NAME_PREFIX); })) !== null && _b !== void 0 ? _b : [];
88
- return columnFilters.map(filter => {
89
- var _a, _b;
90
- return {
91
- column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(constants.DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
92
- values: filter.params.map(param => param.value),
93
- };
94
- });
95
- }
96
- getSortFn(type) {
97
- switch (type) {
98
- case core.DataType.NUMBER:
99
- return this.sortNumber;
100
- case core.DataType.DATE:
101
- return this.sortDate;
102
- case core.DataType.OBJECT:
103
- return this.sortObject;
104
- default:
105
- return core.StringUtils.compare;
106
- }
107
- }
108
- sortObject(a, b) {
109
- return core.StringUtils.compare(a === null || a === void 0 ? void 0 : a["label"], b === null || b === void 0 ? void 0 : b["label"]);
110
- }
111
- sortNumber(a, b) {
112
- return a - b;
113
- }
114
- sortDate(a, b) {
115
- let timeA = a.getTime(), timeB = b.getTime();
116
- return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
117
- }
118
61
  saveLoader(_dataUnit, changes) {
119
62
  return new Promise((resolve) => {
120
63
  let dataUnitRecords = [];
@@ -157,6 +100,7 @@ const SnkSimpleCrud = class {
157
100
  this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
158
101
  this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
159
102
  this.actionClick = index.createEvent(this, "actionClick", 7);
103
+ this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
160
104
  this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER"];
161
105
  this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER"];
162
106
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
@@ -167,11 +111,11 @@ const SnkSimpleCrud = class {
167
111
  "snkSimpleCrudTaskbar.grid_selected": this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(taskbarElements.TaskbarElement.FORM_MODE),
168
112
  "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
169
113
  });
170
- this._currentViewMode = constants$1.VIEW_MODE.GRID;
114
+ this._currentViewMode = constants.VIEW_MODE.GRID;
171
115
  this._config = undefined;
172
116
  this.dataState = undefined;
173
117
  this.dataUnit = undefined;
174
- this.mode = constants$1.SIMPLE_CRUD_MODE.SERVER;
118
+ this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
175
119
  this.gridConfig = undefined;
176
120
  this.formConfig = undefined;
177
121
  this.multipleSelection = undefined;
@@ -182,7 +126,7 @@ const SnkSimpleCrud = class {
182
126
  }
183
127
  resolveInMemoryBtns(taskbarButtons) {
184
128
  const newTaskBarConfig = [...taskbarButtons];
185
- if (this.mode === constants$1.SIMPLE_CRUD_MODE.IN_MEMORY) {
129
+ if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
186
130
  newTaskBarConfig.splice(1, 1);
187
131
  }
188
132
  return newTaskBarConfig;
@@ -199,15 +143,15 @@ const SnkSimpleCrud = class {
199
143
  actionClickListener(evt) {
200
144
  const act = evt.detail;
201
145
  if (act === taskbarElements.TaskbarElement.GRID_MODE) {
202
- this.goToView(constants$1.VIEW_MODE.GRID);
146
+ this.goToView(constants.VIEW_MODE.GRID);
203
147
  }
204
148
  else if (act === taskbarElements.TaskbarElement.FORM_MODE) {
205
- this.goToView(constants$1.VIEW_MODE.FORM);
149
+ this.goToView(constants.VIEW_MODE.FORM);
206
150
  }
207
151
  evt.stopPropagation();
208
152
  }
209
153
  onModeChange() {
210
- if (this.mode == constants$1.SIMPLE_CRUD_MODE.IN_MEMORY) {
154
+ if (this.mode == constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
211
155
  this.initInMemoryDataUnit();
212
156
  }
213
157
  }
@@ -237,9 +181,9 @@ const SnkSimpleCrud = class {
237
181
  if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
238
182
  !this.dataState.selectionInfo.isAllRecords() &&
239
183
  ((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
240
- return this._currentViewMode === constants$1.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
184
+ return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
241
185
  }
242
- return this._currentViewMode === constants$1.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
186
+ return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
243
187
  }
244
188
  initInMemoryDataUnit() {
245
189
  this._inMemoryLoader = new InMemoryLoader(this._metadata);
@@ -317,13 +261,13 @@ const SnkSimpleCrud = class {
317
261
  handleCancelEdit() {
318
262
  var _a;
319
263
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.recordsIsEmpty) {
320
- this.goToView(constants$1.VIEW_MODE.GRID);
264
+ this.goToView(constants.VIEW_MODE.GRID);
321
265
  this.dataUnit.clearSelection();
322
266
  }
323
267
  }
324
268
  render() {
325
269
  var _a;
326
- return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(constants$1.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants$1.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-flex ez-box ez-box--shadow" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }), index.h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants$1.VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
270
+ return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-flex ez-box ez-box--shadow" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }), index.h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
327
271
  ? undefined
328
272
  : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
329
273
  }
@@ -33,6 +33,7 @@ const SnkTaskbar = class {
33
33
  };
34
34
  this._permissions = undefined;
35
35
  this.configName = undefined;
36
+ this.resourceID = undefined;
36
37
  this.buttons = undefined;
37
38
  this.customButtons = undefined;
38
39
  this.actionsList = undefined;
@@ -174,7 +175,7 @@ const SnkTaskbar = class {
174
175
  componentWillLoad() {
175
176
  this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
176
177
  if (this._application) {
177
- this._application.getAllAccess().then(access => this._permissions = access);
178
+ this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
178
179
  }
179
180
  else {
180
181
  this._permissions = {};
@@ -8,13 +8,14 @@ const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
8
8
  const NUFIN_COLUMN = 'NUFIN';
9
9
  const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
10
10
  export default class Actions {
11
- constructor(actionsExecuteInterface, dataUnit) {
11
+ constructor(actionsExecuteInterface, dataUnit, appResourceId) {
12
12
  var _a;
13
13
  this._lastValuesCache = {};
14
14
  this._actionsExecuteInterface = actionsExecuteInterface;
15
15
  this._dataUnit = dataUnit;
16
16
  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;
17
17
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
18
+ this._appResourceId = appResourceId;
18
19
  }
19
20
  apply(action, hasParamsToSave) {
20
21
  this._application.closePopUp();
@@ -277,9 +278,7 @@ export default class Actions {
277
278
  }
278
279
  }
279
280
  async buildResourceId(actionId) {
280
- let appResId = '';
281
- appResId = await this._application.getResourceID();
282
- return appResId + '.actionconfig.' + actionId;
281
+ return this._appResourceId + '.actionconfig.' + actionId;
283
282
  }
284
283
  prepareAndExecute(execSource, executeAction) {
285
284
  this.addRows(execSource);
@@ -4,13 +4,14 @@ import { DataFetcher } from '../../lib/http/data-fetcher/DataFetcher';
4
4
  import ExecutorFactory from './actions/factory/executor.factory';
5
5
  import Actions from './actions';
6
6
  import ClientEventConfirm from './clientEvent';
7
+ import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
7
8
  export class SnkActionsButton {
8
9
  constructor() {
9
10
  this.CLIENT_EVENT_CONFIRM_NAME = "br.com.sankhya.actionbutton.clientconfirm";
10
11
  this.handleClick = (evt) => {
11
12
  const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
12
13
  const executor = new ExecutorFactory(selectedAction.type).executor;
13
- const action = new Actions(executor, this._dataUnit);
14
+ const action = new Actions(executor, this._dataUnit, this._resourceID);
14
15
  action.execute(Object.assign({}, selectedAction));
15
16
  this._showDropdown = false;
16
17
  };
@@ -68,12 +69,15 @@ export class SnkActionsButton {
68
69
  document.addEventListener("scroll", this.positionDropdown.bind(this));
69
70
  }
70
71
  async componentWillLoad() {
71
- var _a;
72
72
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
73
- this._resourceID = await this._application.getResourceID();
74
73
  this._isOrderActions = await this._application.getBooleanParam('global.ordenar.acoes.personalizadas');
75
- this._dataUnit = (_a = this._element.parentElement) === null || _a === void 0 ? void 0 : _a.dataUnit;
74
+ const snkDataUnit = this._element.parentElement;
75
+ this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
76
+ this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
76
77
  this._entityName = this._dataUnit.name.split('/')[2];
78
+ if (this._resourceID == undefined) {
79
+ this._resourceID = await ResourceIDUtils.getResourceID();
80
+ }
77
81
  this.setEvents();
78
82
  this.getActions().then(() => {
79
83
  this.loadItems();
@@ -13,7 +13,6 @@ import Workspace from "../../lib/workspace/workspace";
13
13
  import AppletCaller from "../../lib/applet-caller/applet-caller";
14
14
  import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
15
15
  import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
16
- import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
17
16
  import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
18
17
  import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
19
18
  /**
@@ -36,16 +35,21 @@ export class SnkApplication {
36
35
  }
37
36
  return this._parameters;
38
37
  }
39
- get resourceID() {
40
- if (!this._resourceID) {
41
- this._resourceID = this.urlParams.get("workspaceResourceID") ||
42
- this.urlParams.get("resourceID") ||
43
- Workspace.resourceID ||
44
- "unknown.resource.id";
38
+ async getAuth(resourceID) {
39
+ if (resourceID == undefined) {
40
+ return this.getApplicationAuth();
41
+ }
42
+ else {
43
+ return new Promise((resolve, reject) => {
44
+ this.authFetcher.getData(resourceID).then((authList) => {
45
+ resolve(authList);
46
+ }).catch(error => {
47
+ reject(error);
48
+ });
49
+ });
45
50
  }
46
- return this._resourceID;
47
51
  }
48
- get auth() {
52
+ async getApplicationAuth() {
49
53
  if (this._auth) {
50
54
  return Promise.resolve(this._auth);
51
55
  }
@@ -54,7 +58,7 @@ export class SnkApplication {
54
58
  const waitingAuth = this._authPromises.length > 0;
55
59
  this._authPromises.push(new PendingPromise(resolve, reject));
56
60
  if (!waitingAuth) {
57
- this.authFetcher.getData(this.resourceID).then((authList) => {
61
+ this.authFetcher.getData(this.applicationResourceID).then((authList) => {
58
62
  this._auth = authList;
59
63
  while (this._authPromises.length > 0) {
60
64
  this._authPromises.pop().resolve(this._auth);
@@ -73,7 +77,7 @@ export class SnkApplication {
73
77
  */
74
78
  async isUserSup() {
75
79
  return new Promise((resolve, reject) => {
76
- this.auth.then((authorization) => {
80
+ this.getAuth().then((authorization) => {
77
81
  this.getAuthList(authorization).then((auths) => {
78
82
  resolve(auths.isSup);
79
83
  }).catch(error => reject(error));
@@ -87,9 +91,9 @@ export class SnkApplication {
87
91
  /**
88
92
  * Obtém `true` caso o usuário logado tem permissão pra determinada ação.
89
93
  */
90
- async hasAccess(access) {
94
+ async hasAccess(access, resourceID) {
91
95
  return new Promise((resolve, reject) => {
92
- this.auth.then((authorization) => {
96
+ this.getAuth(resourceID).then((authorization) => {
93
97
  this.getAuthList(authorization).then((auths) => {
94
98
  resolve(auths.isSup || auths.actions[access]);
95
99
  }).catch(error => reject(error));
@@ -99,9 +103,9 @@ export class SnkApplication {
99
103
  /**
100
104
  * Obtém todos os acessos do usuário logado.
101
105
  */
102
- async getAllAccess() {
106
+ async getAllAccess(resourceID) {
103
107
  return new Promise((resolve, reject) => {
104
- this.auth.then((authorization) => {
108
+ this.getAuth(resourceID).then((authorization) => {
105
109
  this.getAuthList(authorization).then((auths) => {
106
110
  const allAccess = {};
107
111
  allAccess['isSup'] = auths.isSup;
@@ -285,13 +289,16 @@ export class SnkApplication {
285
289
  * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
286
290
  * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
287
291
  */
288
- async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
292
+ async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
293
+ if (resourceID == undefined) {
294
+ resourceID = this.applicationResourceID;
295
+ }
289
296
  return new Promise((resolve, reject) => {
290
297
  const duPromisses = this.getDuPromissesStack(dataUnitName);
291
298
  const waitingDu = duPromisses.length > 0;
292
299
  duPromisses.push(new PendingPromise(resolve, reject));
293
300
  if (!waitingDu) {
294
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID, parentDataUnit, configName);
301
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
295
302
  dataUnit.loadMetadata().then(() => {
296
303
  if (dataUnitName) {
297
304
  this.updateDataunitCache(undefined, dataUnitName, dataUnit);
@@ -322,14 +329,14 @@ export class SnkApplication {
322
329
  /**
323
330
  * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
324
331
  */
325
- async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
332
+ async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
326
333
  return new Promise((resolve, reject) => {
327
334
  const dataUnit = this._duCache.get(dataUnitName);
328
335
  if (dataUnit) {
329
336
  resolve(dataUnit);
330
337
  }
331
338
  else {
332
- this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
339
+ this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
333
340
  resolve(dataUnit);
334
341
  }).catch(reason => reject(reason));
335
342
  }
@@ -378,11 +385,20 @@ export class SnkApplication {
378
385
  async callServiceBroker(serviceName, payload, options) {
379
386
  return DataFetcher.get().callServiceBroker(serviceName, payload, options);
380
387
  }
388
+ get applicationResourceID() {
389
+ if (!this._applicationResourceID) {
390
+ this._applicationResourceID = this.urlParams.get("workspaceResourceID") ||
391
+ this.urlParams.get("resourceID") ||
392
+ Workspace.resourceID ||
393
+ "unknown.resource.id";
394
+ }
395
+ return this._applicationResourceID;
396
+ }
381
397
  /**
382
398
  * Obtém o resourceID da tela em questão.
383
399
  */
384
400
  async getResourceID() {
385
- return Promise.resolve(this.resourceID);
401
+ return Promise.resolve(this.applicationResourceID);
386
402
  }
387
403
  /**
388
404
  * Obtém o UserId da tela em questão.
@@ -426,20 +442,14 @@ export class SnkApplication {
426
442
  async info(message, options) {
427
443
  return ApplicationUtils.info(message, options);
428
444
  }
429
- /**
430
- * Obtém a configuração de grade.
431
- */
432
- async loadGridConfig(name) {
433
- return this.gridConfigFetcher.getConfig(name, this.resourceID);
434
- }
435
445
  /**
436
446
  * Obtém os totalizadores da grade.
437
447
  */
438
448
  async loadTotals(name, resourceID, filters) {
439
449
  return this.totalsFetcher.fetchTotals(name, resourceID, filters);
440
450
  }
441
- async getAuthList(_auth) {
442
- return await (new MGEAuthorization()).parseFromJSON(_auth);
451
+ async getAuthList(auth) {
452
+ return await (new MGEAuthorization()).parseFromJSON(auth);
443
453
  }
444
454
  get urlParams() {
445
455
  if (!this._urlParams) {
@@ -453,12 +463,6 @@ export class SnkApplication {
453
463
  }
454
464
  return this._dataUnitFetcher;
455
465
  }
456
- get gridConfigFetcher() {
457
- if (!this._gridConfigFetcher) {
458
- this._gridConfigFetcher = new GridConfigFetcher();
459
- }
460
- return this._gridConfigFetcher;
461
- }
462
466
  get totalsFetcher() {
463
467
  if (!this._totalsFetcher) {
464
468
  this._totalsFetcher = new TotalsFetcher();
@@ -558,7 +562,7 @@ export class SnkApplication {
558
562
  * Obtém o nome das telas da aplicação
559
563
  */
560
564
  async getAppLabel() {
561
- return Workspace.getAppLabel(this._resourceID);
565
+ return Workspace.getAppLabel(this.applicationResourceID);
562
566
  }
563
567
  /**
564
568
  * Adiciona um listener no fetcher de Pesquisa
@@ -638,7 +642,7 @@ export class SnkApplication {
638
642
  });
639
643
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
640
644
  ErrorTracking.init();
641
- ConfigStorage.get();
645
+ ConfigStorage.preload(this.applicationResourceID, this.configName);
642
646
  }
643
647
  connectedCallback() {
644
648
  ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -652,7 +656,7 @@ export class SnkApplication {
652
656
  window.requestAnimationFrame(() => {
653
657
  this.applicationLoaded.emit(true);
654
658
  });
655
- ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
659
+ ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
656
660
  }
657
661
  render() {
658
662
  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 })));
@@ -782,10 +786,13 @@ export class SnkApplication {
782
786
  },
783
787
  "hasAccess": {
784
788
  "complexType": {
785
- "signature": "(access: AutorizationType) => Promise<boolean>",
789
+ "signature": "(access: AutorizationType, resourceID?: string) => Promise<boolean>",
786
790
  "parameters": [{
787
791
  "tags": [],
788
792
  "text": ""
793
+ }, {
794
+ "tags": [],
795
+ "text": ""
789
796
  }],
790
797
  "references": {
791
798
  "Promise": {
@@ -805,8 +812,11 @@ export class SnkApplication {
805
812
  },
806
813
  "getAllAccess": {
807
814
  "complexType": {
808
- "signature": "() => Promise<any>",
809
- "parameters": [],
815
+ "signature": "(resourceID?: string) => Promise<any>",
816
+ "parameters": [{
817
+ "tags": [],
818
+ "text": ""
819
+ }],
810
820
  "references": {
811
821
  "Promise": {
812
822
  "location": "global"
@@ -1155,7 +1165,7 @@ export class SnkApplication {
1155
1165
  },
1156
1166
  "createDataunit": {
1157
1167
  "complexType": {
1158
- "signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string) => Promise<DataUnit>",
1168
+ "signature": "(entityName: string, dataUnitName?: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
1159
1169
  "parameters": [{
1160
1170
  "tags": [],
1161
1171
  "text": ""
@@ -1168,6 +1178,9 @@ export class SnkApplication {
1168
1178
  }, {
1169
1179
  "tags": [],
1170
1180
  "text": ""
1181
+ }, {
1182
+ "tags": [],
1183
+ "text": ""
1171
1184
  }],
1172
1185
  "references": {
1173
1186
  "Promise": {
@@ -1234,7 +1247,7 @@ export class SnkApplication {
1234
1247
  },
1235
1248
  "getDataUnit": {
1236
1249
  "complexType": {
1237
- "signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string) => Promise<DataUnit>",
1250
+ "signature": "(entityName: string, dataUnitName: string, parentDataUnit?: DataUnit, configName?: string, resourceID?: string) => Promise<DataUnit>",
1238
1251
  "parameters": [{
1239
1252
  "tags": [],
1240
1253
  "text": ""
@@ -1247,6 +1260,9 @@ export class SnkApplication {
1247
1260
  }, {
1248
1261
  "tags": [],
1249
1262
  "text": ""
1263
+ }, {
1264
+ "tags": [],
1265
+ "text": ""
1250
1266
  }],
1251
1267
  "references": {
1252
1268
  "Promise": {
@@ -1640,29 +1656,6 @@ export class SnkApplication {
1640
1656
  "tags": []
1641
1657
  }
1642
1658
  },
1643
- "loadGridConfig": {
1644
- "complexType": {
1645
- "signature": "(name: string) => Promise<IGridConfig>",
1646
- "parameters": [{
1647
- "tags": [],
1648
- "text": ""
1649
- }],
1650
- "references": {
1651
- "Promise": {
1652
- "location": "global"
1653
- },
1654
- "IGridConfig": {
1655
- "location": "import",
1656
- "path": "@sankhyalabs/ezui/dist/types/components/ez-grid/controller/EzGridController"
1657
- }
1658
- },
1659
- "return": "Promise<IGridConfig>"
1660
- },
1661
- "docs": {
1662
- "text": "Obt\u00E9m a configura\u00E7\u00E3o de grade.",
1663
- "tags": []
1664
- }
1665
- },
1666
1659
  "loadTotals": {
1667
1660
  "complexType": {
1668
1661
  "signature": "(name: string, resourceID: string, filters: Array<Filter>) => Promise<Map<string, number>>",