@sankhyalabs/sankhyablocks 8.1.0-dev.10 → 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 (168) hide show
  1. package/dist/cjs/{ConfigStorage-e32e1391.js → ConfigStorage-d688c739.js} +160 -47
  2. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
  3. package/dist/cjs/{SnkFormConfigManager-5e61b0a9.js → SnkFormConfigManager-29b73c81.js} +18 -20
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button.cjs.entry.js +11 -8
  7. package/dist/cjs/snk-application.cjs.entry.js +42 -38
  8. package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
  9. package/dist/cjs/snk-crud.cjs.entry.js +16 -5
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
  11. package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-80a00ae4.js} +4 -3
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +6 -6
  14. package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
  15. package/dist/cjs/snk-filter-bar.cjs.entry.js +11 -13
  16. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
  17. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -16
  18. package/dist/cjs/snk-form-config.cjs.entry.js +4 -14
  19. package/dist/cjs/snk-form.cjs.entry.js +9 -5
  20. package/dist/cjs/snk-grid-config.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-grid.cjs.entry.js +11 -14
  22. package/dist/cjs/{snk-guides-viewer-eb0a79a4.js → snk-guides-viewer-f67f9cea.js} +9 -5
  23. package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
  24. package/dist/cjs/snk-personalized-filter.cjs.entry.js +11 -13
  25. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
  26. package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
  27. package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
  28. package/dist/collection/components/snk-application/snk-application.js +58 -65
  29. package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
  30. package/dist/collection/components/snk-crud/snk-crud.js +18 -6
  31. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +20 -2
  32. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +25 -28
  33. package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -4
  34. package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
  35. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
  36. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  37. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +21 -16
  38. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +27 -11
  39. package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
  40. package/dist/collection/components/snk-form/snk-form.js +24 -2
  41. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
  42. package/dist/collection/components/snk-grid/snk-grid.js +27 -12
  43. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
  44. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
  45. package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
  46. package/dist/collection/lib/configs/ConfigStorage.js +33 -44
  47. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
  48. package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
  49. package/dist/components/ConfigStorage.js +161 -48
  50. package/dist/components/ResourceIDUtils.js +10 -0
  51. package/dist/components/SnkFormConfigManager.js +17 -19
  52. package/dist/components/auth-fetcher.js +1 -1
  53. package/dist/components/form-config-fetcher.js +64 -2
  54. package/dist/components/snk-actions-button2.js +11 -8
  55. package/dist/components/snk-application2.js +42 -38
  56. package/dist/components/snk-configurator2.js +3 -1
  57. package/dist/components/snk-crud.js +17 -5
  58. package/dist/components/snk-data-unit2.js +5 -3
  59. package/dist/components/snk-detail-view2.js +13 -7
  60. package/dist/components/snk-entity-list.js +0 -4
  61. package/dist/components/snk-filter-bar2.js +11 -11
  62. package/dist/components/snk-filter-detail2.js +2 -12
  63. package/dist/components/snk-filter-modal-item2.js +5 -16
  64. package/dist/components/snk-form-config2.js +5 -15
  65. package/dist/components/snk-form.js +8 -2
  66. package/dist/components/snk-grid-config2.js +4 -2
  67. package/dist/components/snk-grid2.js +11 -12
  68. package/dist/components/snk-personalized-filter2.js +11 -11
  69. package/dist/components/snk-taskbar2.js +3 -1
  70. package/dist/esm/{ConfigStorage-b6aefe42.js → ConfigStorage-cfe03e99.js} +160 -46
  71. package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
  72. package/dist/esm/{SnkFormConfigManager-80901f2d.js → SnkFormConfigManager-bfd8eabd.js} +18 -20
  73. package/dist/esm/loader.js +1 -1
  74. package/dist/esm/sankhyablocks.js +1 -1
  75. package/dist/esm/snk-actions-button.entry.js +11 -8
  76. package/dist/esm/snk-application.entry.js +42 -38
  77. package/dist/esm/snk-configurator.entry.js +2 -1
  78. package/dist/esm/snk-crud.entry.js +16 -5
  79. package/dist/esm/snk-data-exporter.entry.js +1 -1
  80. package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-3ab57d1a.js} +4 -3
  81. package/dist/esm/snk-data-unit.entry.js +1 -1
  82. package/dist/esm/snk-detail-view.entry.js +6 -6
  83. package/dist/esm/snk-entity-list.entry.js +0 -4
  84. package/dist/esm/snk-filter-bar.entry.js +11 -13
  85. package/dist/esm/snk-filter-detail.entry.js +2 -16
  86. package/dist/esm/snk-filter-modal-item.entry.js +4 -17
  87. package/dist/esm/snk-form-config.entry.js +5 -15
  88. package/dist/esm/snk-form.entry.js +9 -5
  89. package/dist/esm/snk-grid-config.entry.js +3 -3
  90. package/dist/esm/snk-grid.entry.js +11 -14
  91. package/dist/esm/{snk-guides-viewer-ee42eb53.js → snk-guides-viewer-3ea14ab4.js} +9 -5
  92. package/dist/esm/snk-guides-viewer.entry.js +3 -4
  93. package/dist/esm/snk-personalized-filter.entry.js +11 -13
  94. package/dist/esm/snk-taskbar.entry.js +2 -1
  95. package/dist/sankhyablocks/p-0ae5b923.entry.js +1 -0
  96. package/dist/sankhyablocks/p-15230263.js +1 -0
  97. package/dist/sankhyablocks/p-18fa618e.entry.js +1 -0
  98. package/dist/sankhyablocks/p-48a40939.js +1 -0
  99. package/dist/sankhyablocks/p-4c33a77c.entry.js +1 -0
  100. package/dist/sankhyablocks/p-53884b5f.entry.js +1 -0
  101. package/dist/sankhyablocks/p-688dcb4c.js +1 -0
  102. package/dist/sankhyablocks/p-70e785db.entry.js +1 -0
  103. package/dist/sankhyablocks/p-861a3495.entry.js +1 -0
  104. package/dist/sankhyablocks/p-878b0dd3.entry.js +1 -0
  105. package/dist/sankhyablocks/p-97d2fbd9.entry.js +1 -0
  106. package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
  107. package/dist/sankhyablocks/p-9d591463.js +1 -0
  108. package/dist/sankhyablocks/p-9d93da18.js +56 -0
  109. package/dist/sankhyablocks/{p-77ecc583.entry.js → p-9f387187.entry.js} +1 -1
  110. package/dist/sankhyablocks/p-aa4c112f.entry.js +11 -0
  111. package/dist/sankhyablocks/p-bae87498.entry.js +1 -0
  112. package/dist/sankhyablocks/p-cc67bd06.entry.js +1 -0
  113. package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
  114. package/dist/sankhyablocks/p-e070d7a3.entry.js +1 -0
  115. package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
  116. package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
  117. package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
  118. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  119. package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
  120. package/dist/types/components/snk-application/snk-application.d.ts +8 -13
  121. package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
  122. package/dist/types/components/snk-crud/snk-crud.d.ts +1 -0
  123. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +4 -0
  124. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -2
  125. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
  126. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
  127. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
  128. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  129. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +5 -4
  130. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  131. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
  132. package/dist/types/components/snk-form/snk-form.d.ts +5 -1
  133. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
  134. package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
  135. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
  136. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
  137. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
  138. package/dist/types/components.d.ts +99 -21
  139. package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
  140. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
  141. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
  142. package/package.json +1 -1
  143. package/dist/cjs/filter-bar-config-fetcher-80b033ce.js +0 -155
  144. package/dist/components/filter-bar-config-fetcher.js +0 -153
  145. package/dist/components/resource-fetcher.js +0 -66
  146. package/dist/esm/filter-bar-config-fetcher-317cb6bf.js +0 -153
  147. package/dist/sankhyablocks/p-0b64f036.entry.js +0 -1
  148. package/dist/sankhyablocks/p-0e97ec46.entry.js +0 -1
  149. package/dist/sankhyablocks/p-35ecafcb.entry.js +0 -1
  150. package/dist/sankhyablocks/p-42843f0e.js +0 -1
  151. package/dist/sankhyablocks/p-459d4267.entry.js +0 -1
  152. package/dist/sankhyablocks/p-557affc8.entry.js +0 -1
  153. package/dist/sankhyablocks/p-564efc43.js +0 -1
  154. package/dist/sankhyablocks/p-6295424d.entry.js +0 -1
  155. package/dist/sankhyablocks/p-803b79d6.js +0 -1
  156. package/dist/sankhyablocks/p-80729c9b.entry.js +0 -11
  157. package/dist/sankhyablocks/p-95fa8af6.entry.js +0 -1
  158. package/dist/sankhyablocks/p-96c1ae78.entry.js +0 -1
  159. package/dist/sankhyablocks/p-b556fadc.entry.js +0 -1
  160. package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
  161. package/dist/sankhyablocks/p-bf3bd954.entry.js +0 -1
  162. package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
  163. package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
  164. package/dist/sankhyablocks/p-dd1fa35d.js +0 -56
  165. package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
  166. package/dist/sankhyablocks/p-e42f1f2a.js +0 -1
  167. package/dist/sankhyablocks/p-f24c4bc7.entry.js +0 -1
  168. package/dist/sankhyablocks/p-fd69eab9.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { ElementIDUtils, ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
2
+ import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum.js';
4
4
  import { E as EPresentationMode } from './presentationMode.js';
5
5
  import { C as ConfigStorage } from './ConfigStorage.js';
@@ -23,14 +23,13 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
23
23
  this.addPersonalizedFilter = createEvent(this, "addPersonalizedFilter", 7);
24
24
  this.filterItem = undefined;
25
25
  this.configName = undefined;
26
+ this.resourceID = undefined;
26
27
  }
27
28
  observeFilterItem(newValue) {
28
29
  var _a, _b;
29
30
  this._editor && (this._editor["config"] = newValue);
30
31
  (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
31
32
  this.filterChange.emit(newValue);
32
- //isso faz o filtro salvar o estado precocemente. Caso: Botão limpar filtro dispara dezenas de vezes
33
- //this.saveConfig();
34
33
  }
35
34
  getContentEditorConfig() {
36
35
  const props = { presentationMode: EPresentationMode.MODAL };
@@ -72,11 +71,10 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
72
71
  else {
73
72
  this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
74
73
  }
75
- this.saveConfig();
76
74
  }
77
75
  handleDeleteFilter(filter, filterItemType) {
78
76
  if (filterItemType === FilterItemType.PERSONALIZED) {
79
- ConfigStorage.removePersonalizedFilter(filter, this.configName);
77
+ ConfigStorage.removePersonalizedFilter(filter, this.resourceID, this.configName);
80
78
  }
81
79
  }
82
80
  componentDidLoad() {
@@ -84,7 +82,6 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
84
82
  ElementIDUtils.addIDInfo(this._element);
85
83
  const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
86
84
  this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
87
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
88
85
  }
89
86
  }
90
87
  buildRightSlot(item) {
@@ -101,15 +98,6 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
101
98
  const { CUSTOM_FILTER, OTHER_FILTERS } = FilterType$1;
102
99
  return ![CUSTOM_FILTER, OTHER_FILTERS].includes(this.filterItem.filterType) && this.filterItem.type !== FilterItemType.BINARY_SELECT;
103
100
  }
104
- saveConfig() {
105
- //Precisa ser rediscutido... não podemos salvar configuração por conta própria. Não temos autonomia pra isso.
106
- /*if(FilterItemType.MULTI_LIST !== this.filterItem.type) return;
107
-
108
- this._application?.getResourceID().then(resourceId => {
109
- const fetcher = new FilterBarConfigFetcher();
110
- fetcher.saveEntityListConfig(this.filterItem, resourceId, this._application.configName);
111
- });*/
112
- }
113
101
  render() {
114
102
  const { tag: ContentEditor, props } = this.getContentEditorConfig();
115
103
  return (h(Host, null, h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-title ez-title--small ez-title--primary grow" }, this.filterItem.detailModal))), h(ContentEditor, Object.assign({ ref: ref => this._editor = ref, config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, props)))));
@@ -121,7 +109,8 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
121
109
  static get style() { return snkFilterModalItemCss; }
122
110
  }, [0, "snk-filter-modal-item", {
123
111
  "filterItem": [1040],
124
- "configName": [1025, "config-name"]
112
+ "configName": [1025, "config-name"],
113
+ "resourceID": [1, "resource-i-d"]
125
114
  }]);
126
115
  function defineCustomElement() {
127
116
  if (typeof customElements === "undefined") {
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { a as draggable_bundle, d as defineCustomElement$1 } from './snk-tab-config2.js';
3
- import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
3
+ import { ObjectUtils, ElementIDUtils, ArrayUtils } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { C as CONFIG_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
6
6
  import { U as UserConfigType } from './form-config-fetcher.js';
@@ -452,13 +452,10 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
452
452
  this._sortableGroup.on(CONFIG_EVENTS.dragStop, (evt) => this.controlStopDraggingGroup(evt));
453
453
  }
454
454
  loadUserConfig() {
455
- if (this._applicationResourceID == undefined) {
456
- return;
457
- }
458
455
  if (this.configManager == undefined) {
459
456
  return;
460
457
  }
461
- this.configManager.fetchUserAvailableConfigs(this._applicationResourceID)
458
+ this.configManager.fetchUserAvailableConfigs()
462
459
  .then((userConfig) => {
463
460
  this._formConfigOptions = userConfig;
464
461
  if (this._formConfigOptions == undefined) {
@@ -512,9 +509,6 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
512
509
  }
513
510
  }
514
511
  async loadConfigByUser() {
515
- if (this._applicationResourceID == undefined) {
516
- return;
517
- }
518
512
  if (this.configManager == undefined) {
519
513
  return;
520
514
  }
@@ -524,10 +518,10 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
524
518
  let config;
525
519
  switch (this._optionFormConfigSelected.origin) {
526
520
  case UserConfigType.DEFAULT:
527
- config = await this.configManager.fetchDefaultConfig(this._applicationResourceID);
521
+ config = await this.configManager.fetchDefaultConfig();
528
522
  break;
529
523
  case UserConfigType.DEFAULT:
530
- config = await this.configManager.fetchDefaultConfig(this._applicationResourceID);
524
+ config = await this.configManager.fetchDefaultConfig();
531
525
  break;
532
526
  }
533
527
  if (config != undefined) {
@@ -943,11 +937,7 @@ const SnkFormConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
943
937
  this.controlSortableGroup();
944
938
  }
945
939
  componentWillLoad() {
946
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
947
- this._application.getResourceID().then(resourceID => {
948
- this._applicationResourceID = resourceID;
949
- this.loadConfig();
950
- });
940
+ this.loadConfig();
951
941
  }
952
942
  componentDidLoad() {
953
943
  const dataInfo = { dataUnit: this.dataUnit };
@@ -1,6 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
4
+ import { R as ResourceIDUtils } from './ResourceIDUtils.js';
4
5
  import { d as defineCustomElement$5 } from './snk-config-options2.js';
5
6
  import { d as defineCustomElement$4 } from './snk-field-config2.js';
6
7
  import { d as defineCustomElement$3 } from './snk-form-config2.js';
@@ -22,6 +23,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
22
23
  this.configName = undefined;
23
24
  this.recordsValidator = undefined;
24
25
  this.messagesBuilder = undefined;
26
+ this.resourceID = undefined;
25
27
  }
26
28
  /**
27
29
  * Exibe a janela de configurações do formulário.
@@ -42,7 +44,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
42
44
  const dataInfo = { dataUnit: this._dataUnit };
43
45
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
44
46
  }
45
- componentWillLoad() {
47
+ async componentWillLoad() {
46
48
  let parent = this._element.parentElement;
47
49
  while (parent) {
48
50
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -64,7 +66,10 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
64
66
  }
65
67
  parent = parent.parentElement;
66
68
  }
67
- this._configManager = new SnkFormConfigManager(this.configName);
69
+ if (this.resourceID == undefined) {
70
+ this.resourceID = await ResourceIDUtils.getResourceID();
71
+ }
72
+ this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
68
73
  this._configManager.loadConfig();
69
74
  }
70
75
  render() {
@@ -80,6 +85,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
80
85
  "configName": [1, "config-name"],
81
86
  "recordsValidator": [16],
82
87
  "messagesBuilder": [1040],
88
+ "resourceID": [1, "resource-i-d"],
83
89
  "_dataUnit": [32],
84
90
  "_dataState": [32],
85
91
  "_showFormConfig": [32],
@@ -25,6 +25,7 @@ const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
25
25
  this.columns = undefined;
26
26
  this.config = undefined;
27
27
  this.configName = undefined;
28
+ this.resourceID = undefined;
28
29
  }
29
30
  /* Creation Methods */
30
31
  /**
@@ -248,7 +249,7 @@ const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
248
249
  }
249
250
  }
250
251
  _newConfig.columns = _newColumnConfigList;
251
- ConfigStorage.saveGridConfig(_newConfig, this.configName)
252
+ ConfigStorage.saveGridConfig(_newConfig, this.configName, this.resourceID)
252
253
  .then((savedConfig) => {
253
254
  this.configChange.emit(savedConfig);
254
255
  this._orderList.clearHistory();
@@ -475,7 +476,8 @@ const SnkGridConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
475
476
  "application": [16],
476
477
  "columns": [1040],
477
478
  "config": [1040],
478
- "configName": [1, "config-name"]
479
+ "configName": [1, "config-name"],
480
+ "resourceID": [1, "resource-i-d"]
479
481
  }]);
480
482
  function defineCustomElement() {
481
483
  if (typeof customElements === "undefined") {
@@ -50,6 +50,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
50
50
  this._popUpGridConfig = false;
51
51
  this.columnFilterDataSource = new SnkMultiSelectionListDataSource();
52
52
  this.configName = undefined;
53
+ this.resourceID = undefined;
53
54
  this.selectionToastConfig = undefined;
54
55
  this.actionsList = undefined;
55
56
  this.isDetail = undefined;
@@ -108,20 +109,17 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
108
109
  this._gridConfig = config;
109
110
  }
110
111
  loadConfig() {
111
- ConfigStorage.get()
112
- .then((instance) => {
113
- instance.loadGridConfig(this.configName)
114
- .then((config) => {
115
- this.setGridConfig(config);
116
- })
117
- .catch((error) => {
118
- console.warn(error);
119
- });
112
+ ConfigStorage.loadGridConfig(this.configName, this.resourceID)
113
+ .then((config) => {
114
+ this.setGridConfig(config);
115
+ })
116
+ .catch((error) => {
117
+ console.warn(error);
120
118
  });
121
119
  }
122
120
  gridConfigChangeHandler(evt) {
123
121
  const config = evt.detail;
124
- ConfigStorage.saveGridConfig(config, this.configName);
122
+ ConfigStorage.saveGridConfig(config, this.configName, this.resourceID);
125
123
  evt.stopPropagation();
126
124
  }
127
125
  modalConfigChangeHandler(evt) {
@@ -329,14 +327,15 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
329
327
  if (!this._dataUnit) {
330
328
  return undefined;
331
329
  }
332
- return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
333
- h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton() })), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, onComponentReady: () => this.onEzGridReady(), columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig() }))));
330
+ return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
331
+ h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID })), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, onComponentReady: () => this.onEzGridReady(), columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList, resourceID: this.resourceID })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
334
332
  }
335
333
  get _element() { return this; }
336
334
  static get style() { return snkGridCss; }
337
335
  }, [6, "snk-grid", {
338
336
  "columnFilterDataSource": [1040],
339
337
  "configName": [1, "config-name"],
338
+ "resourceID": [1, "resource-i-d"],
340
339
  "selectionToastConfig": [16],
341
340
  "actionsList": [16],
342
341
  "isDetail": [4, "is-detail"],
@@ -41,6 +41,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
41
41
  this.entityUri = undefined;
42
42
  this.filterId = undefined;
43
43
  this.configName = undefined;
44
+ this.resourceID = undefined;
44
45
  }
45
46
  /*
46
47
  * Cria um novo filtro se não houver nenhum filtro existente
@@ -77,17 +78,15 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
77
78
  this._filterAssistent = ObjectUtils.copy(newPersonalizedFilter);
78
79
  }
79
80
  loadFilter(newValue, oldValue) {
80
- if (newValue == null || oldValue == newValue) {
81
+ if (newValue == null || oldValue == newValue || this.resourceID == undefined) {
81
82
  return;
82
83
  }
83
- ConfigStorage.get().then((_instance) => {
84
- ConfigStorage.loadPersonalizedFilter(newValue, this.configName)
85
- .then((resp) => {
86
- const personalizedFilter = this.addLabelToItems(resp);
87
- this._filterAssistent = personalizedFilter;
88
- this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
89
- this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
90
- });
84
+ ConfigStorage.loadPersonalizedFilter(newValue, this.resourceID, this.configName)
85
+ .then((resp) => {
86
+ const personalizedFilter = this.addLabelToItems(resp);
87
+ this._filterAssistent = personalizedFilter;
88
+ this._originalFilterAssistent = ObjectUtils.copy(personalizedFilter);
89
+ this._filterAssistentMode = this._filterAssistent.hasOwnProperty("assistent") && this._filterAssistent.assistent != undefined;
91
90
  });
92
91
  }
93
92
  componentWillLoad() {
@@ -112,7 +111,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
112
111
  return this._application.messagesBuilder.getMessage(key, params);
113
112
  }
114
113
  saveFilter() {
115
- ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.configName).then((personalizedFilter) => {
114
+ ConfigStorage.savePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName).then((personalizedFilter) => {
116
115
  this._elButtonSave.enabled = false;
117
116
  const messageToken = !!this._filterAssistent.id ? 'confirmEdit' : 'confirmSave';
118
117
  ApplicationUtils.info(this.getMessage(`snkPersonalizedFilter.${messageToken}.title`), { iconName: "check" });
@@ -123,7 +122,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
123
122
  });
124
123
  }
125
124
  removeFilter() {
126
- ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.configName);
125
+ ConfigStorage.removePersonalizedFilter(this._filterAssistent, this.resourceID, this.configName);
127
126
  }
128
127
  hasChangesToSave() {
129
128
  return JSON.stringify(this._filterAssistent) === JSON.stringify(this._originalFilterAssistent);
@@ -301,6 +300,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
301
300
  "entityUri": [1025, "entity-uri"],
302
301
  "filterId": [1025, "filter-id"],
303
302
  "configName": [1025, "config-name"],
303
+ "resourceID": [1, "resource-i-d"],
304
304
  "_filterAssistentMode": [32],
305
305
  "_filterAssistent": [32],
306
306
  "createPersonalizedFilter": [64]
@@ -145,6 +145,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
145
145
  };
146
146
  this._permissions = undefined;
147
147
  this.configName = undefined;
148
+ this.resourceID = undefined;
148
149
  this.buttons = undefined;
149
150
  this.customButtons = undefined;
150
151
  this.actionsList = undefined;
@@ -286,7 +287,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
286
287
  componentWillLoad() {
287
288
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
288
289
  if (this._application) {
289
- this._application.getAllAccess().then(access => this._permissions = access);
290
+ this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
290
291
  }
291
292
  else {
292
293
  this._permissions = {};
@@ -330,6 +331,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
330
331
  static get style() { return snkTaskbarCss; }
331
332
  }, [6, "snk-taskbar", {
332
333
  "configName": [1, "config-name"],
334
+ "resourceID": [1, "resource-i-d"],
333
335
  "buttons": [1],
334
336
  "customButtons": [16],
335
337
  "actionsList": [16],
@@ -1,7 +1,6 @@
1
- import { ApplicationContext } from '@sankhyalabs/core';
2
1
  import { F as FormConfigFetcher } from './form-config-fetcher-4a34b86a.js';
3
2
  import { R as ResourceFetcher } from './resource-fetcher-b36ac145.js';
4
- import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher-317cb6bf.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
5
4
  import { d as dist, D as DataFetcher } from './DataFetcher-aaaff866.js';
6
5
 
7
6
  class GridConfigFetcher extends ResourceFetcher {
@@ -44,6 +43,131 @@ class GridConfigFetcher extends ResourceFetcher {
44
43
  }
45
44
  }
46
45
 
46
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
47
+ var t = {};
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
+ t[p] = s[p];
50
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
+ t[p[i]] = s[p[i]];
54
+ }
55
+ return t;
56
+ };
57
+ function normalizeValue(value, type) {
58
+ if (value == undefined) {
59
+ return value;
60
+ }
61
+ if (value instanceof Date) {
62
+ return value.toISOString();
63
+ }
64
+ if (typeof value === "object") {
65
+ if (value instanceof Array) {
66
+ return value.map(item => {
67
+ if (FilterItemType.MULTI_LIST === type) {
68
+ const values = __rest(item, ["label"]);
69
+ return normalizeValue(values);
70
+ }
71
+ return normalizeValue(item);
72
+ });
73
+ }
74
+ else {
75
+ const normalized = Object.assign({}, value);
76
+ Object.keys(value).forEach(prop => {
77
+ if (value[prop] !== undefined) {
78
+ normalized[prop] = normalizeValue(value[prop], type);
79
+ }
80
+ else {
81
+ delete normalized[prop];
82
+ }
83
+ });
84
+ return normalized;
85
+ }
86
+ }
87
+ return value;
88
+ }
89
+ class FilterBarConfigFetcher extends ResourceFetcher {
90
+ normalize(items) {
91
+ return items.map(item => {
92
+ const { id, value, fixed, visible, type, groupedItems } = item;
93
+ const stateItem = { id };
94
+ if (value) {
95
+ stateItem["value"] = normalizeValue(value, type);
96
+ }
97
+ if (fixed) {
98
+ stateItem["fixed"] = fixed;
99
+ }
100
+ if (groupedItems) {
101
+ if (groupedItems.length === 0) {
102
+ return;
103
+ }
104
+ if (groupedItems.filter(item => item.visible).length > 0) {
105
+ stateItem["visible"] = true;
106
+ }
107
+ stateItem["groupedItems"] = this.normalize(groupedItems);
108
+ }
109
+ else {
110
+ if (visible) {
111
+ stateItem["visible"] = true;
112
+ }
113
+ }
114
+ return stateItem;
115
+ }).filter(item => item != undefined);
116
+ }
117
+ saveConfig(items, resourceID, configName) {
118
+ return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
119
+ }
120
+ getConfig(resourceID, configName, urlParams) {
121
+ return new Promise((accept, reject) => {
122
+ this.loadResource(this.getPath(resourceID, configName, urlParams))
123
+ .then((configAsString) => {
124
+ let fieldsList;
125
+ if (configAsString) {
126
+ const filterBarConfig = JSON.parse(configAsString);
127
+ fieldsList = this.buildFieldList(filterBarConfig.items);
128
+ }
129
+ accept(fieldsList || []);
130
+ })
131
+ .catch((error) => {
132
+ reject(error);
133
+ });
134
+ });
135
+ }
136
+ buildFieldList(items) {
137
+ return items.map(item => {
138
+ var _a, _b;
139
+ if (item.type === FilterItemType.MULTI_LIST) {
140
+ const multiListValue = item.value;
141
+ item.value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
142
+ }
143
+ return item;
144
+ });
145
+ }
146
+ getPath(resourceID, name, urlParams) {
147
+ let path = `cfg://filter/FilterBarState:${resourceID}`;
148
+ if (name) {
149
+ path += `.${name}`;
150
+ }
151
+ if (urlParams) {
152
+ path += this.buildQueryString(urlParams);
153
+ }
154
+ return path;
155
+ }
156
+ buildQueryString(urlParams) {
157
+ let queryString = '?';
158
+ for (let key in urlParams) {
159
+ if (!urlParams.hasOwnProperty(key)) {
160
+ continue;
161
+ }
162
+ if (queryString.length > 1) {
163
+ queryString += '&';
164
+ }
165
+ queryString += key + '=' + urlParams[key];
166
+ }
167
+ return queryString;
168
+ }
169
+ }
170
+
47
171
  class PersonalizedFilterFetcher {
48
172
  constructor() {
49
173
  this.templateByQuery = new Map();
@@ -218,83 +342,73 @@ const CONFIG_SOURCE = {
218
342
  filterBar: "filterBar"
219
343
  };
220
344
  class ConfigStorage {
221
- static async get() {
222
- if (!ConfigStorage.instance) {
223
- const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
224
- if (application != undefined) {
225
- const configName = application.configName;
226
- const resourceID = await application.getResourceID();
227
- ConfigStorage.instance = new ConfigStorage();
228
- ConfigStorage.resourceID = resourceID;
229
- ConfigStorage.instance.loadFormConfig(configName);
230
- ConfigStorage.instance.loadGridConfig(configName);
231
- }
232
- }
233
- return this.instance;
345
+ static preload(resourceID, configName) {
346
+ ConfigStorage.loadFormConfig(configName, resourceID);
347
+ ConfigStorage.loadGridConfig(configName, resourceID);
234
348
  }
235
- async loadFilterBarConfig(name, urlParams) {
236
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
349
+ static async loadFilterBarConfig(name, resourceID, urlParams) {
350
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
237
351
  if (!ConfigStorage.configById.has(cacheID)) {
238
- ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
352
+ ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
239
353
  }
240
354
  return ConfigStorage.configById.get(cacheID);
241
355
  }
242
- async loadFormConfig(name) {
243
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
356
+ static async loadFormConfig(name, resourceID) {
357
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
244
358
  if (!ConfigStorage.configById.has(cacheID)) {
245
- ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
359
+ ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
246
360
  }
247
361
  return ConfigStorage.configById.get(cacheID);
248
362
  }
249
- async loadGridConfig(name) {
250
- const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
363
+ static async loadGridConfig(name, resourceID) {
364
+ const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
251
365
  if (!ConfigStorage.configById.has(cacheID)) {
252
- ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
366
+ ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
253
367
  }
254
368
  return ConfigStorage.configById.get(cacheID);
255
369
  }
256
- static async saveFilterBarConfig(config, name) {
257
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
370
+ static async saveFilterBarConfig(config, name, resourceID) {
371
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
258
372
  this.configById.delete(cacheID);
259
- return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
373
+ return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
260
374
  }
261
- static async saveFormConfig(config, name) {
262
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
375
+ static async saveFormConfig(config, name, resourceID) {
376
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
263
377
  this.configById.delete(cacheID);
264
- return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
378
+ return this.formConfigFetcher.saveConfig(config, name, resourceID);
265
379
  }
266
- static async saveCardState(config, name) {
267
- return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
380
+ static async saveCardState(config, name, resourceID) {
381
+ return this.formConfigFetcher.saveCardState(config, name, resourceID);
268
382
  }
269
- static async saveGridConfig(config, name) {
383
+ static async saveGridConfig(config, name, resourceID) {
270
384
  if (config == undefined) {
271
385
  return;
272
386
  }
273
- const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
387
+ const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
274
388
  this.configById.delete(cacheID);
275
- return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
389
+ return this.gridConfigFetcher.saveConfig(config, name, resourceID);
276
390
  }
277
- static async loadPersonalizedFilter(filterId, configName) {
278
- return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
391
+ static async loadPersonalizedFilter(filterId, resourceID, configName) {
392
+ return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
279
393
  }
280
- static async savePersonalizedFilter(personalizedFilter, configName) {
394
+ static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
281
395
  //Ao criar ou alterar um filtro personalizado,
282
396
  //precisamos remover o cache do status da filterbar.
283
- const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
397
+ const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar, resourceID);
284
398
  this.configById.delete(cacheID);
285
- return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
399
+ return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
286
400
  }
287
- static async removePersonalizedFilter(personalizedFilter, configName) {
288
- return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
401
+ static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
402
+ return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
289
403
  }
290
404
  static async validatePersonalizedFilter(dataUnitName, expression) {
291
405
  return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
292
406
  }
293
- static buildCacheID(name, source) {
407
+ static buildCacheID(name, source, resourceID) {
294
408
  if (name == undefined) {
295
- return `req_${source}_${this.resourceID}`;
409
+ return `req_${source}_${resourceID}`;
296
410
  }
297
- return `req_${source}_${name}_${this.resourceID}`;
411
+ return `req_${source}_${name}_${resourceID}`;
298
412
  }
299
413
  }
300
414
  ConfigStorage.configById = new Map();
@@ -303,4 +417,4 @@ ConfigStorage.formConfigFetcher = new FormConfigFetcher();
303
417
  ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
304
418
  ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
305
419
 
306
- export { ConfigStorage as C, GridConfigFetcher as G, PersonalizedFilterFetcher as P };
420
+ export { ConfigStorage as C, PersonalizedFilterFetcher as P };
@@ -0,0 +1,10 @@
1
+ import { ApplicationContext } from '@sankhyalabs/core';
2
+
3
+ class ResourceIDUtils {
4
+ static async getResourceID() {
5
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
6
+ return application.getResourceID();
7
+ }
8
+ }
9
+
10
+ export { ResourceIDUtils as R };