@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
@@ -3,29 +3,27 @@ import { ObjectUtils } from '@sankhyalabs/core';
3
3
  import { F as FormConfigFetcher } from './form-config-fetcher.js';
4
4
 
5
5
  class SnkFormConfigManager {
6
- constructor(configName, onConfigChange) {
6
+ constructor(configName, resourceID, onConfigChange) {
7
+ this._resourceID = resourceID;
7
8
  this._configName = configName;
8
9
  this._onConfigChange = onConfigChange;
9
10
  }
10
11
  async loadConfig() {
11
12
  return new Promise(resolve => {
12
- ConfigStorage.get()
13
- .then((configStorage) => {
14
- configStorage.loadFormConfig(this._configName)
15
- .then((config) => {
16
- this.setConfig(config);
17
- resolve(config);
18
- })
19
- .catch((error) => {
20
- console.warn(error);
21
- });
13
+ ConfigStorage.loadFormConfig(this._configName, this._resourceID)
14
+ .then((config) => {
15
+ this.setConfig(config);
16
+ resolve(config);
17
+ })
18
+ .catch((error) => {
19
+ console.warn(error);
22
20
  });
23
21
  });
24
22
  }
25
23
  saveConfig(config) {
26
24
  const configToSave = ObjectUtils.copy(config);
27
25
  return new Promise(accept => {
28
- ConfigStorage.saveFormConfig(config, this._configName)
26
+ ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
29
27
  .then((response) => {
30
28
  this.setConfig(Object.assign(Object.assign({}, configToSave), response));
31
29
  accept(Object.assign(Object.assign({}, configToSave), response));
@@ -40,7 +38,7 @@ class SnkFormConfigManager {
40
38
  cardsState.set(cardId, propertyChanged === "fixed" ?
41
39
  this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
42
40
  : Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
43
- ConfigStorage.saveCardState(cardsState, this._configName)
41
+ ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
44
42
  .then(savedCardConfig => {
45
43
  this._config = Object.assign(Object.assign({}, this._config), { cardsState });
46
44
  resolve(savedCardConfig);
@@ -116,18 +114,18 @@ class SnkFormConfigManager {
116
114
  }
117
115
  return this._formConfigFetcher;
118
116
  }
119
- async fetchUserAvailableConfigs(resourceID) {
117
+ async fetchUserAvailableConfigs() {
120
118
  if (this._configName != undefined) {
121
119
  //FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
122
120
  return Promise.resolve(undefined);
123
121
  }
124
- return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, resourceID);
122
+ return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
125
123
  }
126
- async fetchLegacyConfig(resourceID) {
127
- return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, resourceID);
124
+ async fetchLegacyConfig() {
125
+ return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
128
126
  }
129
- async fetchDefaultConfig(resourceID) {
130
- return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, resourceID);
127
+ async fetchDefaultConfig() {
128
+ return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
131
129
  }
132
130
  }
133
131
 
@@ -1,5 +1,5 @@
1
1
  import { ObjectUtils } from '@sankhyalabs/core';
2
- import { R as ResourceFetcher } from './resource-fetcher.js';
2
+ import { R as ResourceFetcher } from './form-config-fetcher.js';
3
3
 
4
4
  class AuthFetcher extends ResourceFetcher {
5
5
  getData(resourceID) {
@@ -1,6 +1,68 @@
1
1
  import { d as dist, D as DataFetcher } from './DataFetcher.js';
2
2
  import { ObjectUtils } from '@sankhyalabs/core';
3
- import { R as ResourceFetcher } from './resource-fetcher.js';
3
+
4
+ class ResourceFetcher {
5
+ constructor() {
6
+ this.templateByQuery = new Map();
7
+ this.buldTemplates();
8
+ }
9
+ buldTemplates() {
10
+ this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
11
+ $queryAlias$: fetchResource(name: $name){
12
+ resource
13
+ }
14
+ }`);
15
+ this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
16
+ $queryAlias$: saveResource(resource: $resource){
17
+ name
18
+ resource
19
+ }
20
+ }`);
21
+ }
22
+ loadResource(name) {
23
+ if (ResourceFetcher._loadingResource.has(name)) {
24
+ return ResourceFetcher._loadingResource.get(name);
25
+ }
26
+ const promiseLoadResource = new Promise((resolve, reject) => {
27
+ DataFetcher.get()
28
+ .callGraphQL({
29
+ values: { name },
30
+ query: this.templateByQuery.get("fetchResource"),
31
+ })
32
+ .then((result) => {
33
+ resolve(result === null || result === void 0 ? void 0 : result.resource);
34
+ ResourceFetcher._loadingResource.delete(name);
35
+ })
36
+ .catch((error) => {
37
+ reject(error);
38
+ ResourceFetcher._loadingResource.delete(name);
39
+ });
40
+ });
41
+ ResourceFetcher._loadingResource.set(name, promiseLoadResource);
42
+ return promiseLoadResource;
43
+ }
44
+ saveResource(resource, name) {
45
+ return new Promise((resolve, reject) => {
46
+ DataFetcher.get()
47
+ .callGraphQL({
48
+ values: {
49
+ resource: {
50
+ name: name,
51
+ resource: JSON.stringify(resource)
52
+ }
53
+ },
54
+ query: this.templateByQuery.get("saveResource")
55
+ })
56
+ .then((resp) => {
57
+ resolve(resp);
58
+ })
59
+ .catch((error) => {
60
+ reject(error);
61
+ });
62
+ });
63
+ }
64
+ }
65
+ ResourceFetcher._loadingResource = new Map();
4
66
 
5
67
  class FormConfigFetcher extends ResourceFetcher {
6
68
  constructor() {
@@ -176,4 +238,4 @@ var UserConfigType;
176
238
  UserConfigType["SHARED"] = "SHARED";
177
239
  })(UserConfigType || (UserConfigType = {}));
178
240
 
179
- export { FormConfigFetcher as F, UserConfigType as U };
241
+ export { FormConfigFetcher as F, ResourceFetcher as R, UserConfigType as U };
@@ -4,6 +4,7 @@ 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 { R as ResourceIDUtils } from './ResourceIDUtils.js';
7
8
 
8
9
  const SERVICE_ACTION_EXECUTE_JAVA = 'ActionButtonsSP.executeJava';
9
10
  class JavaExecutor {
@@ -158,13 +159,14 @@ const ENTITY_NAME_PROPERTY = '__ENTITY_NAME__';
158
159
  const NUFIN_COLUMN = 'NUFIN';
159
160
  const SERVICE_GET_CONFIGURATIONS = 'SystemUtilsSP.getConf';
160
161
  class Actions {
161
- constructor(actionsExecuteInterface, dataUnit) {
162
+ constructor(actionsExecuteInterface, dataUnit, appResourceId) {
162
163
  var _a;
163
164
  this._lastValuesCache = {};
164
165
  this._actionsExecuteInterface = actionsExecuteInterface;
165
166
  this._dataUnit = dataUnit;
166
167
  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
168
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
169
+ this._appResourceId = appResourceId;
168
170
  }
169
171
  apply(action, hasParamsToSave) {
170
172
  this._application.closePopUp();
@@ -427,9 +429,7 @@ class Actions {
427
429
  }
428
430
  }
429
431
  async buildResourceId(actionId) {
430
- let appResId = '';
431
- appResId = await this._application.getResourceID();
432
- return appResId + '.actionconfig.' + actionId;
432
+ return this._appResourceId + '.actionconfig.' + actionId;
433
433
  }
434
434
  prepareAndExecute(execSource, executeAction) {
435
435
  this.addRows(execSource);
@@ -588,7 +588,7 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
588
588
  this.handleClick = (evt) => {
589
589
  const selectedAction = this._actions.find((action) => action.actionID == evt.detail.id);
590
590
  const executor = new ExecutorFactory(selectedAction.type).executor;
591
- const action = new Actions(executor, this._dataUnit);
591
+ const action = new Actions(executor, this._dataUnit, this._resourceID);
592
592
  action.execute(Object.assign({}, selectedAction));
593
593
  this._showDropdown = false;
594
594
  };
@@ -646,12 +646,15 @@ const SnkActionsButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
646
646
  document.addEventListener("scroll", this.positionDropdown.bind(this));
647
647
  }
648
648
  async componentWillLoad() {
649
- var _a;
650
649
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
651
- this._resourceID = await this._application.getResourceID();
652
650
  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;
651
+ const snkDataUnit = this._element.parentElement;
652
+ this._dataUnit = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.dataUnit;
653
+ this._resourceID = snkDataUnit === null || snkDataUnit === void 0 ? void 0 : snkDataUnit.resourceID;
654
654
  this._entityName = this._dataUnit.name.split('/')[2];
655
+ if (this._resourceID == undefined) {
656
+ this._resourceID = await ResourceIDUtils.getResourceID();
657
+ }
655
658
  this.setEvents();
656
659
  this.getActions().then(() => {
657
660
  this.loadItems();
@@ -3,7 +3,7 @@ import { WaitingChangeException, WarningException, ErrorException, ObjectUtils,
3
3
  import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
4
4
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
6
- import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
6
+ import { C as ConfigStorage } from './ConfigStorage.js';
7
7
  import { D as DataUnitFetcher } from './dataunit-fetcher.js';
8
8
  import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher.js';
9
9
  import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
@@ -247,16 +247,21 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
247
247
  }
248
248
  return this._parameters;
249
249
  }
250
- get resourceID() {
251
- if (!this._resourceID) {
252
- this._resourceID = this.urlParams.get("workspaceResourceID") ||
253
- this.urlParams.get("resourceID") ||
254
- Workspace.resourceID ||
255
- "unknown.resource.id";
250
+ async getAuth(resourceID) {
251
+ if (resourceID == undefined) {
252
+ return this.getApplicationAuth();
253
+ }
254
+ else {
255
+ return new Promise((resolve, reject) => {
256
+ this.authFetcher.getData(resourceID).then((authList) => {
257
+ resolve(authList);
258
+ }).catch(error => {
259
+ reject(error);
260
+ });
261
+ });
256
262
  }
257
- return this._resourceID;
258
263
  }
259
- get auth() {
264
+ async getApplicationAuth() {
260
265
  if (this._auth) {
261
266
  return Promise.resolve(this._auth);
262
267
  }
@@ -265,7 +270,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
265
270
  const waitingAuth = this._authPromises.length > 0;
266
271
  this._authPromises.push(new PendingPromise(resolve, reject));
267
272
  if (!waitingAuth) {
268
- this.authFetcher.getData(this.resourceID).then((authList) => {
273
+ this.authFetcher.getData(this.applicationResourceID).then((authList) => {
269
274
  this._auth = authList;
270
275
  while (this._authPromises.length > 0) {
271
276
  this._authPromises.pop().resolve(this._auth);
@@ -284,7 +289,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
284
289
  */
285
290
  async isUserSup() {
286
291
  return new Promise((resolve, reject) => {
287
- this.auth.then((authorization) => {
292
+ this.getAuth().then((authorization) => {
288
293
  this.getAuthList(authorization).then((auths) => {
289
294
  resolve(auths.isSup);
290
295
  }).catch(error => reject(error));
@@ -298,9 +303,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
298
303
  /**
299
304
  * Obtém `true` caso o usuário logado tem permissão pra determinada ação.
300
305
  */
301
- async hasAccess(access) {
306
+ async hasAccess(access, resourceID) {
302
307
  return new Promise((resolve, reject) => {
303
- this.auth.then((authorization) => {
308
+ this.getAuth(resourceID).then((authorization) => {
304
309
  this.getAuthList(authorization).then((auths) => {
305
310
  resolve(auths.isSup || auths.actions[access]);
306
311
  }).catch(error => reject(error));
@@ -310,9 +315,9 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
310
315
  /**
311
316
  * Obtém todos os acessos do usuário logado.
312
317
  */
313
- async getAllAccess() {
318
+ async getAllAccess(resourceID) {
314
319
  return new Promise((resolve, reject) => {
315
- this.auth.then((authorization) => {
320
+ this.getAuth(resourceID).then((authorization) => {
316
321
  this.getAuthList(authorization).then((auths) => {
317
322
  const allAccess = {};
318
323
  allAccess['isSup'] = auths.isSup;
@@ -496,13 +501,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
496
501
  * Cria o DataUnit a partir do nome da entidade. É possível armazená-lo no cache
497
502
  * passando o dataUnitName, assim, se mais de uma chamada for feita, o mesmo DataUnit será usado.
498
503
  */
499
- async createDataunit(entityName, dataUnitName, parentDataUnit, configName) {
504
+ async createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
505
+ if (resourceID == undefined) {
506
+ resourceID = this.applicationResourceID;
507
+ }
500
508
  return new Promise((resolve, reject) => {
501
509
  const duPromisses = this.getDuPromissesStack(dataUnitName);
502
510
  const waitingDu = duPromisses.length > 0;
503
511
  duPromisses.push(new PendingPromise(resolve, reject));
504
512
  if (!waitingDu) {
505
- const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID, parentDataUnit, configName);
513
+ const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
506
514
  dataUnit.loadMetadata().then(() => {
507
515
  if (dataUnitName) {
508
516
  this.updateDataunitCache(undefined, dataUnitName, dataUnit);
@@ -533,14 +541,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
533
541
  /**
534
542
  * Obtem um DataUnit do cache ou cria um caso ainda não tenha sido criado.
535
543
  */
536
- async getDataUnit(entityName, dataUnitName, parentDataUnit, configName) {
544
+ async getDataUnit(entityName, dataUnitName, parentDataUnit, configName, resourceID) {
537
545
  return new Promise((resolve, reject) => {
538
546
  const dataUnit = this._duCache.get(dataUnitName);
539
547
  if (dataUnit) {
540
548
  resolve(dataUnit);
541
549
  }
542
550
  else {
543
- this.createDataunit(entityName, dataUnitName, parentDataUnit, configName).then(dataUnit => {
551
+ this.createDataunit(entityName, dataUnitName, parentDataUnit, configName, resourceID).then(dataUnit => {
544
552
  resolve(dataUnit);
545
553
  }).catch(reason => reject(reason));
546
554
  }
@@ -589,11 +597,20 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
589
597
  async callServiceBroker(serviceName, payload, options) {
590
598
  return DataFetcher.get().callServiceBroker(serviceName, payload, options);
591
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
+ }
592
609
  /**
593
610
  * Obtém o resourceID da tela em questão.
594
611
  */
595
612
  async getResourceID() {
596
- return Promise.resolve(this.resourceID);
613
+ return Promise.resolve(this.applicationResourceID);
597
614
  }
598
615
  /**
599
616
  * Obtém o UserId da tela em questão.
@@ -637,20 +654,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
637
654
  async info(message, options) {
638
655
  return ApplicationUtils.info(message, options);
639
656
  }
640
- /**
641
- * Obtém a configuração de grade.
642
- */
643
- async loadGridConfig(name) {
644
- return this.gridConfigFetcher.getConfig(name, this.resourceID);
645
- }
646
657
  /**
647
658
  * Obtém os totalizadores da grade.
648
659
  */
649
660
  async loadTotals(name, resourceID, filters) {
650
661
  return this.totalsFetcher.fetchTotals(name, resourceID, filters);
651
662
  }
652
- async getAuthList(_auth) {
653
- return await (new MGEAuthorization()).parseFromJSON(_auth);
663
+ async getAuthList(auth) {
664
+ return await (new MGEAuthorization()).parseFromJSON(auth);
654
665
  }
655
666
  get urlParams() {
656
667
  if (!this._urlParams) {
@@ -664,12 +675,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
664
675
  }
665
676
  return this._dataUnitFetcher;
666
677
  }
667
- get gridConfigFetcher() {
668
- if (!this._gridConfigFetcher) {
669
- this._gridConfigFetcher = new GridConfigFetcher();
670
- }
671
- return this._gridConfigFetcher;
672
- }
673
678
  get totalsFetcher() {
674
679
  if (!this._totalsFetcher) {
675
680
  this._totalsFetcher = new TotalsFetcher();
@@ -767,7 +772,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
767
772
  * Obtém o nome das telas da aplicação
768
773
  */
769
774
  async getAppLabel() {
770
- return Workspace.getAppLabel(this._resourceID);
775
+ return Workspace.getAppLabel(this.applicationResourceID);
771
776
  }
772
777
  /**
773
778
  * Adiciona um listener no fetcher de Pesquisa
@@ -847,7 +852,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
847
852
  });
848
853
  ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
849
854
  ErrorTracking.init();
850
- ConfigStorage.get();
855
+ ConfigStorage.preload(this.applicationResourceID, this.configName);
851
856
  }
852
857
  connectedCallback() {
853
858
  ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -861,7 +866,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
861
866
  window.requestAnimationFrame(() => {
862
867
  this.applicationLoaded.emit(true);
863
868
  });
864
- ElementIDUtils.addIDInfo(this._element, `resource_${this._resourceID}`);
869
+ ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
865
870
  }
866
871
  render() {
867
872
  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 })));
@@ -905,7 +910,6 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
905
910
  "message": [64],
906
911
  "confirm": [64],
907
912
  "info": [64],
908
- "loadGridConfig": [64],
909
913
  "loadTotals": [64],
910
914
  "executeSearch": [64],
911
915
  "executePreparedSearch": [64],
@@ -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],
@@ -44,12 +44,14 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
44
44
  this.actionClick = createEvent(this, "actionClick", 7);
45
45
  this.configuratorSave = createEvent(this, "configuratorSave", 7);
46
46
  this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
47
+ this.formItemsReady = createEvent(this, "formItemsReady", 7);
47
48
  this._viewHistory = [];
48
49
  this._dataUnit = undefined;
49
50
  this._dataState = undefined;
50
51
  this.attachmentRegisterKey = undefined;
51
52
  this._currentViewMode = VIEW_MODE.GRID;
52
53
  this._canEdit = undefined;
54
+ this._resourceID = undefined;
53
55
  this.configName = undefined;
54
56
  this.selectionToastConfig = undefined;
55
57
  this.showActionButtons = false;
@@ -144,7 +146,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
144
146
  }
145
147
  componentWillLoad() {
146
148
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
147
- application.hasAccess(AutorizationType.UPDATE).then(canEdit => this._canEdit = canEdit);
149
+ application.hasAccess(AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
148
150
  let parent = this._element.parentElement;
149
151
  while (parent) {
150
152
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -156,11 +158,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
156
158
  if (!this._dataUnit) {
157
159
  this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
158
160
  this._dataUnit = evt.detail;
159
- this.initDataUnit();
161
+ this.initDataUnit(application);
160
162
  });
161
163
  }
162
164
  else {
163
- this.initDataUnit();
165
+ this.initDataUnit(application);
164
166
  }
165
167
  this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
166
168
  this._dataState = dataState;
@@ -176,11 +178,18 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
176
178
  this.configName = application.configName;
177
179
  }
178
180
  }
179
- initDataUnit() {
181
+ async initDataUnit(application) {
180
182
  this.addDataElementID();
181
183
  if (!this.messagesBuilder) {
182
184
  this.messagesBuilder = this._snkDataUnit.messagesBuilder;
183
185
  }
186
+ if (this._resourceID == undefined) {
187
+ //Tenta pegar o resourceID do snkDataUnit;
188
+ this._resourceID = this._snkDataUnit.resourceID;
189
+ if (this._resourceID == undefined) {
190
+ this._resourceID = await application.getResourceID();
191
+ }
192
+ }
184
193
  }
185
194
  handleConfiguratorEvent(evt, type) {
186
195
  evt.stopImmediatePropagation();
@@ -191,8 +200,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
191
200
  this.configuratorCancel.emit();
192
201
  }
193
202
  render() {
203
+ if (this._resourceID == undefined) {
204
+ return;
205
+ }
194
206
  this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
195
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL') }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
207
+ return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, resourceID: this._resourceID }, h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID }, h("div", { slot: "SnkConfigContainerSlot" }, h("slot", { name: "SnkConfigContainerSlot" })))));
196
208
  }
197
209
  get _element() { return this; }
198
210
  static get watchers() { return {
@@ -216,6 +228,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
216
228
  "attachmentRegisterKey": [32],
217
229
  "_currentViewMode": [32],
218
230
  "_canEdit": [32],
231
+ "_resourceID": [32],
219
232
  "goToView": [64],
220
233
  "openConfigurator": [64],
221
234
  "closeConfigurator": [64],
@@ -71,7 +71,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
71
71
  this.useCancelConfirm = true;
72
72
  this.ignoreSaveMessage = undefined;
73
73
  this.configName = undefined;
74
- this.configName = undefined;
74
+ this.resourceID = undefined;
75
75
  }
76
76
  observePageSize() {
77
77
  if (this.dataUnit) {
@@ -335,10 +335,10 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
335
335
  const cacheName = this.dataUnitName ? this.dataUnitName : this.entityName;
336
336
  if (this._parentSnkDataUnit) {
337
337
  this._parentDataUnit = await ((_a = this._parentSnkDataUnit) === null || _a === void 0 ? void 0 : _a.getDataUnit());
338
- return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName);
338
+ return await this._application.getDataUnit(this.entityName, cacheName, this._parentDataUnit, this.configName, this.resourceID);
339
339
  }
340
340
  else {
341
- return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName);
341
+ return await this._application.getDataUnit(this.entityName, cacheName, null, this.configName, this.resourceID);
342
342
  }
343
343
  }
344
344
  async loadDataUnit() {
@@ -397,7 +397,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
397
397
  //---------------------------------------------
398
398
  componentWillLoad() {
399
399
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
400
- this._application.getAllAccess().then(access => this._permissions = access);
400
+ this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
401
401
  this._parentSnkDataUnit = this.getParentSnkDataUnit();
402
402
  if (this.messagesBuilder == undefined) {
403
403
  this.messagesBuilder = new SnkMessageBuilder(this.entityName);
@@ -437,6 +437,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
437
437
  "useCancelConfirm": [4, "use-cancel-confirm"],
438
438
  "ignoreSaveMessage": [4, "ignore-save-message"],
439
439
  "configName": [1, "config-name"],
440
+ "resourceID": [1, "resource-i-d"],
440
441
  "getDataUnit": [64],
441
442
  "getSelectedRecordsIDsInfo": [64]
442
443
  }]);