@sankhyalabs/sankhyablocks 8.2.0-dev.1 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/cjs/{ConfigStorage-12397f18.js → ConfigStorage-e9d7fa82.js} +51 -163
  2. package/dist/cjs/{DataFetcher-f2da1f79.js → DataFetcher-39b63a1e.js} +29 -67
  3. package/dist/cjs/{SnkFormConfigManager-13f79e37.js → SnkFormConfigManager-2f8eccd9.js} +21 -19
  4. package/dist/cjs/{dataunit-fetcher-e72068c1.js → dataunit-fetcher-15a7cc88.js} +1 -1
  5. package/dist/cjs/filter-bar-config-fetcher-24548cec.js +155 -0
  6. package/dist/cjs/{form-config-fetcher-5d62ab62.js → form-config-fetcher-ab3ce222.js} +3 -66
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-8c363096.js → pesquisa-fetcher-96c042aa.js} +1 -1
  9. package/dist/cjs/resource-fetcher-64102551.js +68 -0
  10. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  11. package/dist/cjs/snk-actions-button.cjs.entry.js +11 -18
  12. package/dist/cjs/snk-application.cjs.entry.js +73 -51
  13. package/dist/cjs/snk-attach.cjs.entry.js +13 -7
  14. package/dist/cjs/snk-configurator.cjs.entry.js +1 -2
  15. package/dist/cjs/snk-crud.cjs.entry.js +9 -28
  16. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  17. package/dist/cjs/{snk-data-unit-80a00ae4.js → snk-data-unit-d5109a08.js} +6 -8
  18. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-detail-view.cjs.entry.js +25 -18
  20. package/dist/cjs/snk-entity-list.cjs.entry.js +4 -0
  21. package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -14
  22. package/dist/cjs/snk-filter-detail.cjs.entry.js +15 -1
  23. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +19 -5
  24. package/dist/cjs/snk-form-config.cjs.entry.js +17 -6
  25. package/dist/cjs/snk-form-view.cjs.entry.js +1 -6
  26. package/dist/cjs/snk-form.cjs.entry.js +8 -12
  27. package/dist/cjs/snk-grid-config.cjs.entry.js +6 -5
  28. package/dist/cjs/snk-grid.cjs.entry.js +20 -20
  29. package/dist/cjs/{snk-guides-viewer-a7cd6fda.js → snk-guides-viewer-8c9693aa.js} +9 -18
  30. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +16 -13
  32. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +80 -22
  34. package/dist/cjs/snk-taskbar.cjs.entry.js +1 -2
  35. package/dist/collection/components/snk-actions-button/actions/index.js +4 -3
  36. package/dist/collection/components/snk-actions-button/snk-actions-button.js +4 -8
  37. package/dist/collection/components/snk-application/snk-application.js +65 -60
  38. package/dist/collection/components/snk-configurator/snk-configurator.js +1 -19
  39. package/dist/collection/components/snk-crud/snk-crud.js +8 -63
  40. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +15 -65
  41. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +1 -27
  42. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +30 -66
  43. package/dist/collection/components/snk-data-unit/snk-data-unit.js +7 -42
  44. package/dist/collection/components/snk-entity-list/snk-entity-list.js +23 -0
  45. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
  46. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
  47. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +16 -21
  48. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +12 -28
  49. package/dist/collection/components/snk-form/SnkFormConfigManager.js +19 -17
  50. package/dist/collection/components/snk-form/snk-form.js +2 -46
  51. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +15 -5
  52. package/dist/collection/components/snk-grid/snk-grid.js +16 -110
  53. package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +1 -19
  54. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +12 -28
  55. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +9 -43
  56. package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -19
  57. package/dist/collection/lib/configs/ConfigStorage.js +44 -33
  58. package/dist/collection/lib/dataUnit/InMemoryLoader.js +59 -2
  59. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +29 -38
  60. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +24 -0
  61. package/dist/collection/lib/index.js +0 -10
  62. package/dist/collection/lib/utils/urlutils.js +0 -29
  63. package/dist/components/ConfigStorage.js +48 -161
  64. package/dist/components/DataFetcher.js +29 -67
  65. package/dist/components/SnkFormConfigManager.js +19 -17
  66. package/dist/components/filter-bar-config-fetcher.js +153 -0
  67. package/dist/components/form-config-fetcher.js +2 -64
  68. package/dist/components/resource-fetcher.js +66 -0
  69. package/dist/components/snk-actions-button2.js +9 -23
  70. package/dist/components/snk-application2.js +154 -132
  71. package/dist/components/snk-attach2.js +8 -1
  72. package/dist/components/snk-configurator2.js +1 -3
  73. package/dist/components/snk-crud.js +7 -29
  74. package/dist/components/snk-data-unit2.js +6 -10
  75. package/dist/components/snk-detail-view2.js +23 -28
  76. package/dist/components/snk-entity-list.js +4 -0
  77. package/dist/components/snk-filter-bar2.js +12 -12
  78. package/dist/components/snk-filter-detail2.js +12 -2
  79. package/dist/components/snk-filter-modal-item2.js +16 -5
  80. package/dist/components/snk-form-config2.js +15 -5
  81. package/dist/components/snk-form-view2.js +1 -6
  82. package/dist/components/snk-form.js +2 -9
  83. package/dist/components/snk-grid-config2.js +2 -4
  84. package/dist/components/snk-grid2.js +16 -23
  85. package/dist/components/snk-personalized-filter2.js +11 -11
  86. package/dist/components/snk-simple-crud2.js +69 -12
  87. package/dist/components/snk-taskbar2.js +1 -3
  88. package/dist/esm/{ConfigStorage-932ab366.js → ConfigStorage-1090289a.js} +49 -162
  89. package/dist/esm/{DataFetcher-7e18aa30.js → DataFetcher-a4ed43e7.js} +29 -67
  90. package/dist/esm/{SnkFormConfigManager-bb9afc3f.js → SnkFormConfigManager-de537eca.js} +21 -19
  91. package/dist/esm/{dataunit-fetcher-91a4eb82.js → dataunit-fetcher-8d0bfa4a.js} +1 -1
  92. package/dist/esm/filter-bar-config-fetcher-2417b8cf.js +153 -0
  93. package/dist/esm/{form-config-fetcher-aaaa79a6.js → form-config-fetcher-4065db9a.js} +3 -65
  94. package/dist/esm/loader.js +1 -1
  95. package/dist/esm/{pesquisa-fetcher-56b30fb4.js → pesquisa-fetcher-7460b876.js} +1 -1
  96. package/dist/esm/resource-fetcher-45a70066.js +66 -0
  97. package/dist/esm/sankhyablocks.js +1 -1
  98. package/dist/esm/snk-actions-button.entry.js +11 -18
  99. package/dist/esm/snk-application.entry.js +71 -49
  100. package/dist/esm/snk-attach.entry.js +9 -3
  101. package/dist/esm/snk-configurator.entry.js +1 -2
  102. package/dist/esm/snk-crud.entry.js +9 -28
  103. package/dist/esm/snk-data-exporter.entry.js +2 -2
  104. package/dist/esm/{snk-data-unit-3ab57d1a.js → snk-data-unit-3a0bbfcb.js} +6 -8
  105. package/dist/esm/snk-data-unit.entry.js +1 -1
  106. package/dist/esm/snk-detail-view.entry.js +25 -18
  107. package/dist/esm/snk-entity-list.entry.js +4 -0
  108. package/dist/esm/snk-filter-bar.entry.js +17 -14
  109. package/dist/esm/snk-filter-detail.entry.js +16 -2
  110. package/dist/esm/snk-filter-modal-item.entry.js +20 -6
  111. package/dist/esm/snk-form-config.entry.js +18 -7
  112. package/dist/esm/snk-form-view.entry.js +1 -6
  113. package/dist/esm/snk-form.entry.js +8 -12
  114. package/dist/esm/snk-grid-config.entry.js +6 -5
  115. package/dist/esm/snk-grid.entry.js +20 -20
  116. package/dist/esm/{snk-guides-viewer-cc709b5f.js → snk-guides-viewer-a6d39c18.js} +9 -18
  117. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  118. package/dist/esm/snk-personalized-filter.entry.js +16 -13
  119. package/dist/esm/snk-print-selector.entry.js +1 -1
  120. package/dist/esm/snk-simple-crud.entry.js +71 -13
  121. package/dist/esm/snk-taskbar.entry.js +1 -2
  122. package/dist/sankhyablocks/p-0fb83448.js +1 -0
  123. package/dist/sankhyablocks/p-15aba6fb.entry.js +11 -0
  124. package/dist/sankhyablocks/p-216f081a.entry.js +1 -0
  125. package/dist/sankhyablocks/p-21e7c08e.entry.js +1 -0
  126. package/dist/sankhyablocks/p-2861d44f.entry.js +1 -0
  127. package/dist/sankhyablocks/p-2d883fe9.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-d13c00b6.entry.js → p-3d6f91c2.entry.js} +1 -1
  129. package/dist/sankhyablocks/{p-f8e6b97e.js → p-44e66c8d.js} +1 -1
  130. package/dist/sankhyablocks/p-4514fc6a.entry.js +1 -0
  131. package/dist/sankhyablocks/p-4f4cd005.entry.js +1 -0
  132. package/dist/sankhyablocks/p-50c13cc8.entry.js +1 -0
  133. package/dist/sankhyablocks/p-52c6b2e7.js +1 -0
  134. package/dist/sankhyablocks/p-5994af77.js +56 -0
  135. package/dist/sankhyablocks/p-5df17074.js +1 -0
  136. package/dist/sankhyablocks/p-6bb904bb.entry.js +1 -0
  137. package/dist/sankhyablocks/p-6f0795c8.entry.js +1 -0
  138. package/dist/sankhyablocks/p-7588f006.entry.js +1 -0
  139. package/dist/sankhyablocks/p-847e6c20.js +17 -0
  140. package/dist/sankhyablocks/p-9471cbc9.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-14eac6fe.js → p-9d18017a.js} +1 -1
  142. package/dist/sankhyablocks/p-9edad923.js +1 -0
  143. package/dist/sankhyablocks/p-a42dd503.entry.js +1 -0
  144. package/dist/sankhyablocks/{p-2d333d22.js → p-b978da60.js} +1 -1
  145. package/dist/sankhyablocks/p-befbc9ee.entry.js +1 -0
  146. package/dist/sankhyablocks/p-c6380ea2.entry.js +1 -0
  147. package/dist/sankhyablocks/{p-03bb1aea.entry.js → p-c6feb995.entry.js} +1 -1
  148. package/dist/sankhyablocks/p-c945318c.entry.js +1 -0
  149. package/dist/sankhyablocks/p-ccbfb1cf.entry.js +1 -0
  150. package/dist/sankhyablocks/p-d7c7a289.entry.js +1 -0
  151. package/dist/sankhyablocks/p-de69b4b0.entry.js +1 -0
  152. package/dist/sankhyablocks/p-f3b7b69e.js +10 -0
  153. package/dist/sankhyablocks/p-f7eded3a.entry.js +1 -0
  154. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  155. package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -2
  156. package/dist/types/components/snk-application/snk-application.d.ts +13 -8
  157. package/dist/types/components/snk-configurator/snk-configurator.d.ts +0 -4
  158. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -10
  159. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -13
  160. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +0 -5
  161. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +2 -13
  162. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +0 -8
  163. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +4 -0
  164. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
  165. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
  166. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +4 -5
  167. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
  168. package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +4 -5
  169. package/dist/types/components/snk-form/snk-form.d.ts +1 -9
  170. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +2 -0
  171. package/dist/types/components/snk-grid/snk-grid.d.ts +1 -18
  172. package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +0 -4
  173. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +1 -5
  174. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -8
  175. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -4
  176. package/dist/types/components.d.ts +21 -189
  177. package/dist/types/lib/configs/ConfigStorage.d.ts +13 -11
  178. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +7 -0
  179. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  180. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +1 -0
  181. package/dist/types/lib/index.d.ts +0 -11
  182. package/dist/types/lib/utils/urlutils.d.ts +0 -14
  183. package/package.json +2 -2
  184. package/dist/cjs/ISave-d68ce3cd.js +0 -8
  185. package/dist/cjs/ResourceIDUtils-5ff86aa7.js +0 -12
  186. package/dist/cjs/auth-fetcher-319a4cb2.js +0 -34
  187. package/dist/collection/lib/resourceid/ResourceIDUtils.js +0 -7
  188. package/dist/components/ResourceIDUtils.js +0 -10
  189. package/dist/components/auth-fetcher.js +0 -32
  190. package/dist/esm/ISave-4412b20c.js +0 -8
  191. package/dist/esm/ResourceIDUtils-a114189a.js +0 -10
  192. package/dist/esm/auth-fetcher-6d9664b7.js +0 -32
  193. package/dist/sankhyablocks/p-01739b21.entry.js +0 -1
  194. package/dist/sankhyablocks/p-05dbc70e.entry.js +0 -1
  195. package/dist/sankhyablocks/p-41e897f1.js +0 -56
  196. package/dist/sankhyablocks/p-48a40939.js +0 -1
  197. package/dist/sankhyablocks/p-611aa624.entry.js +0 -1
  198. package/dist/sankhyablocks/p-66bb8c20.entry.js +0 -1
  199. package/dist/sankhyablocks/p-688dcb4c.js +0 -1
  200. package/dist/sankhyablocks/p-6f154396.entry.js +0 -1
  201. package/dist/sankhyablocks/p-787071a8.js +0 -1
  202. package/dist/sankhyablocks/p-8481bb59.entry.js +0 -1
  203. package/dist/sankhyablocks/p-8818d8f6.entry.js +0 -1
  204. package/dist/sankhyablocks/p-93f6ca04.entry.js +0 -1
  205. package/dist/sankhyablocks/p-9a270401.entry.js +0 -1
  206. package/dist/sankhyablocks/p-9e7d65a4.js +0 -1
  207. package/dist/sankhyablocks/p-a52a6c9d.js +0 -26
  208. package/dist/sankhyablocks/p-b6003974.entry.js +0 -1
  209. package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
  210. package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
  211. package/dist/sankhyablocks/p-d53a9169.entry.js +0 -1
  212. package/dist/sankhyablocks/p-d7638f45.entry.js +0 -11
  213. package/dist/sankhyablocks/p-e086cc2a.entry.js +0 -1
  214. package/dist/sankhyablocks/p-e64f3e17.entry.js +0 -1
  215. package/dist/sankhyablocks/p-ed41b38c.js +0 -1
  216. package/dist/sankhyablocks/p-ed705cbb.entry.js +0 -1
  217. package/dist/sankhyablocks/p-efc10705.entry.js +0 -1
  218. package/dist/sankhyablocks/p-f74fe358.js +0 -1
  219. package/dist/sankhyablocks/p-f91e0c5d.entry.js +0 -1
  220. package/dist/sankhyablocks/p-fa523d6b.entry.js +0 -1
  221. package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +0 -3
@@ -10,6 +10,7 @@ export class SnkEntityList {
10
10
  }
11
11
  async reloadList() {
12
12
  this.loadListSource();
13
+ this.saveConfig.emit(this.config);
13
14
  }
14
15
  observeConfig() {
15
16
  var _a, _b;
@@ -25,6 +26,7 @@ export class SnkEntityList {
25
26
  }
26
27
  });
27
28
  this.config = ObjectUtils.copy(configCopy);
29
+ this.saveConfig.emit(this.config);
28
30
  this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
29
31
  }
30
32
  loadListSource() {
@@ -81,6 +83,7 @@ export class SnkEntityList {
81
83
  }
82
84
  ] });
83
85
  this.loadListSource();
86
+ this.saveConfig.emit(this.config);
84
87
  this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
85
88
  }
86
89
  }
@@ -203,6 +206,26 @@ export class SnkEntityList {
203
206
  }
204
207
  }
205
208
  }
209
+ }, {
210
+ "method": "saveConfig",
211
+ "name": "saveConfig",
212
+ "bubbles": true,
213
+ "cancelable": true,
214
+ "composed": true,
215
+ "docs": {
216
+ "tags": [],
217
+ "text": "Evento emitido ao realizar alguma a\u00E7\u00E3o que altera os dados do config.value permitindo salvar estas informa\u00E7\u00F5es"
218
+ },
219
+ "complexType": {
220
+ "original": "SnkFilterItemConfig",
221
+ "resolved": "SnkFilterItemConfig",
222
+ "references": {
223
+ "SnkFilterItemConfig": {
224
+ "location": "import",
225
+ "path": "../snk-filter-bar/filter-item/snk-filter-item"
226
+ }
227
+ }
228
+ }
206
229
  }];
207
230
  }
208
231
  static get methods() {
@@ -1,7 +1,8 @@
1
1
  import { h, Host, Fragment } from '@stencil/core';
2
2
  import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
3
3
  import FilterItemType from './filter-item-type.enum';
4
- import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
4
+ import { ElementIDUtils, ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
5
+ import FilterBarConfigFetcher from '../../../lib/http/data-fetcher/fetchers/filter-bar-config-fetcher';
5
6
  import { EPresentationMode } from './editors/enum/presentationMode';
6
7
  import { PersonalizedFilterUtils } from '../../snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils';
7
8
  export class SnkFilterDetail {
@@ -23,6 +24,7 @@ export class SnkFilterDetail {
23
24
  }
24
25
  componentDidLoad() {
25
26
  if (this._element) {
27
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
26
28
  ElementIDUtils.addIDInfo(this._element);
27
29
  const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
28
30
  this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
@@ -140,12 +142,20 @@ export class SnkFilterDetail {
140
142
  this.config = ObjectUtils.copy(configCopy);
141
143
  }
142
144
  }
145
+ saveConfig(newConfig) {
146
+ var _a;
147
+ (_a = this._application) === null || _a === void 0 ? void 0 : _a.getResourceID().then(resourceId => {
148
+ const fetcher = new FilterBarConfigFetcher();
149
+ fetcher.saveEntityListConfig(newConfig, resourceId, this._application.configName);
150
+ this.config = newConfig;
151
+ });
152
+ }
143
153
  componentWillLoad() {
144
154
  this.originalConfig = ObjectUtils.copy(this.config);
145
155
  }
146
156
  render() {
147
157
  const { tag: CustomElement, props } = this.getContentEditor();
148
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
158
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, onSaveConfig: evt => this.saveConfig(evt.detail), rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
149
159
  }
150
160
  static get is() { return "snk-filter-detail"; }
151
161
  static get properties() {
@@ -244,7 +244,7 @@ export class SnkFilterModal {
244
244
  "optional": false,
245
245
  "docs": {
246
246
  "tags": [],
247
- "text": "Nome da configura\u00E7\u00E3o. Serve para distinguir v\u00E1rias inst\u00E2ncias do componente."
247
+ "text": "Nome da config para buscar no resourceId"
248
248
  },
249
249
  "attribute": "config-name",
250
250
  "reflect": false
@@ -1,5 +1,5 @@
1
1
  import { h, Host } from '@stencil/core';
2
- import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
2
+ import { ApplicationContext, ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
3
3
  import FilterItemType from '../../filter-item/filter-item-type.enum';
4
4
  import { EPresentationMode } from '../../filter-item/editors/enum/presentationMode';
5
5
  import { ConfigStorage } from '../../../../lib/configs/ConfigStorage';
@@ -8,13 +8,14 @@ export class SnkFilterModalItem {
8
8
  constructor() {
9
9
  this.filterItem = undefined;
10
10
  this.configName = undefined;
11
- this.resourceID = undefined;
12
11
  }
13
12
  observeFilterItem(newValue) {
14
13
  var _a, _b;
15
14
  this._editor && (this._editor["config"] = newValue);
16
15
  (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a['reloadList']) === null || _b === void 0 ? void 0 : _b.call(_a);
17
16
  this.filterChange.emit(newValue);
17
+ //isso faz o filtro salvar o estado precocemente. Caso: Botão limpar filtro dispara dezenas de vezes
18
+ //this.saveConfig();
18
19
  }
19
20
  getContentEditorConfig() {
20
21
  const props = { presentationMode: EPresentationMode.MODAL };
@@ -56,10 +57,11 @@ export class SnkFilterModalItem {
56
57
  else {
57
58
  this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
58
59
  }
60
+ this.saveConfig();
59
61
  }
60
62
  handleDeleteFilter(filter, filterItemType) {
61
63
  if (filterItemType === FilterItemType.PERSONALIZED) {
62
- ConfigStorage.removePersonalizedFilter(filter, this.resourceID, this.configName);
64
+ ConfigStorage.removePersonalizedFilter(filter, this.configName);
63
65
  }
64
66
  }
65
67
  componentDidLoad() {
@@ -67,6 +69,7 @@ export class SnkFilterModalItem {
67
69
  ElementIDUtils.addIDInfo(this._element);
68
70
  const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
69
71
  this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
72
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
70
73
  }
71
74
  }
72
75
  buildRightSlot(item) {
@@ -83,6 +86,15 @@ export class SnkFilterModalItem {
83
86
  const { CUSTOM_FILTER, OTHER_FILTERS } = FilterType;
84
87
  return ![CUSTOM_FILTER, OTHER_FILTERS].includes(this.filterItem.filterType) && this.filterItem.type !== FilterItemType.BINARY_SELECT;
85
88
  }
89
+ saveConfig() {
90
+ //Precisa ser rediscutido... não podemos salvar configuração por conta própria. Não temos autonomia pra isso.
91
+ /*if(FilterItemType.MULTI_LIST !== this.filterItem.type) return;
92
+
93
+ this._application?.getResourceID().then(resourceId => {
94
+ const fetcher = new FilterBarConfigFetcher();
95
+ fetcher.saveEntityListConfig(this.filterItem, resourceId, this._application.configName);
96
+ });*/
97
+ }
86
98
  render() {
87
99
  const { tag: ContentEditor, props } = this.getContentEditorConfig();
88
100
  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)))));
@@ -132,27 +144,10 @@ export class SnkFilterModalItem {
132
144
  "optional": false,
133
145
  "docs": {
134
146
  "tags": [],
135
- "text": "Nome da configura\u00E7\u00E3o. Serve para distinguir v\u00E1rias inst\u00E2ncias do componente."
147
+ "text": "Nome da config para buscar no resourceId"
136
148
  },
137
149
  "attribute": "config-name",
138
150
  "reflect": false
139
- },
140
- "resourceID": {
141
- "type": "string",
142
- "mutable": false,
143
- "complexType": {
144
- "original": "string",
145
- "resolved": "string",
146
- "references": {}
147
- },
148
- "required": false,
149
- "optional": false,
150
- "docs": {
151
- "tags": [],
152
- "text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
153
- },
154
- "attribute": "resource-i-d",
155
- "reflect": false
156
151
  }
157
152
  };
158
153
  }
@@ -28,7 +28,6 @@ export class SnkFilterBar {
28
28
  };
29
29
  this.dataUnit = undefined;
30
30
  this.configName = undefined;
31
- this.resourceID = undefined;
32
31
  this.filterConfig = undefined;
33
32
  this.messagesBuilder = undefined;
34
33
  this.allowDefault = undefined;
@@ -104,11 +103,11 @@ export class SnkFilterBar {
104
103
  return;
105
104
  }
106
105
  this._loadingPending = false;
107
- this.dataUnit.loadData(undefined, undefined, true);
106
+ this.dataUnit.loadData();
108
107
  }
109
108
  if (this._configUpdated) {
110
109
  this._configUpdated = false;
111
- ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName, this.resourceID);
110
+ ConfigStorage.saveFilterBarConfig(this.filterConfig, this.configName);
112
111
  }
113
112
  }
114
113
  /**
@@ -224,13 +223,15 @@ export class SnkFilterBar {
224
223
  }
225
224
  loadConfigFromStorage() {
226
225
  return new Promise(accept => {
227
- ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name })
228
- .then((filters) => {
229
- accept();
230
- this.filterConfig = filters.map(item => this.normalizeItem(item));
231
- })
232
- .catch(reason => {
233
- throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
226
+ ConfigStorage.get().then(instance => {
227
+ instance.loadFilterBarConfig(this.configName, { contextURI: this.dataUnit.name })
228
+ .then((filters) => {
229
+ accept();
230
+ this.filterConfig = filters.map(item => this.normalizeItem(item));
231
+ })
232
+ .catch(reason => {
233
+ throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
234
+ });
234
235
  });
235
236
  });
236
237
  }
@@ -315,7 +316,7 @@ export class SnkFilterBar {
315
316
  return undefined;
316
317
  }
317
318
  if (this.showPersonalizedFilter) {
318
- return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
319
+ return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName });
319
320
  }
320
321
  return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
321
322
  }
@@ -370,23 +371,6 @@ export class SnkFilterBar {
370
371
  "attribute": "config-name",
371
372
  "reflect": false
372
373
  },
373
- "resourceID": {
374
- "type": "string",
375
- "mutable": false,
376
- "complexType": {
377
- "original": "string",
378
- "resolved": "string",
379
- "references": {}
380
- },
381
- "required": false,
382
- "optional": false,
383
- "docs": {
384
- "tags": [],
385
- "text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
386
- },
387
- "attribute": "resource-i-d",
388
- "reflect": false
389
- },
390
374
  "filterConfig": {
391
375
  "type": "unknown",
392
376
  "mutable": true,
@@ -2,27 +2,29 @@ import { ConfigStorage } from "../../lib/configs/ConfigStorage";
2
2
  import { ObjectUtils } from "@sankhyalabs/core";
3
3
  import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
4
4
  export class SnkFormConfigManager {
5
- constructor(configName, resourceID, onConfigChange) {
6
- this._resourceID = resourceID;
5
+ constructor(configName, onConfigChange) {
7
6
  this._configName = configName;
8
7
  this._onConfigChange = onConfigChange;
9
8
  }
10
9
  async loadConfig() {
11
10
  return new Promise(resolve => {
12
- ConfigStorage.loadFormConfig(this._configName, this._resourceID)
13
- .then((config) => {
14
- this.setConfig(config);
15
- resolve(config);
16
- })
17
- .catch((error) => {
18
- console.warn(error);
11
+ ConfigStorage.get()
12
+ .then((configStorage) => {
13
+ configStorage.loadFormConfig(this._configName)
14
+ .then((config) => {
15
+ this.setConfig(config);
16
+ resolve(config);
17
+ })
18
+ .catch((error) => {
19
+ console.warn(error);
20
+ });
19
21
  });
20
22
  });
21
23
  }
22
24
  saveConfig(config) {
23
25
  const configToSave = ObjectUtils.copy(config);
24
26
  return new Promise(accept => {
25
- ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
27
+ ConfigStorage.saveFormConfig(config, this._configName)
26
28
  .then((response) => {
27
29
  this.setConfig(Object.assign(Object.assign({}, configToSave), response));
28
30
  accept(Object.assign(Object.assign({}, configToSave), response));
@@ -37,7 +39,7 @@ export class SnkFormConfigManager {
37
39
  cardsState.set(cardId, propertyChanged === "fixed" ?
38
40
  this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
39
41
  : Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
40
- ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
42
+ ConfigStorage.saveCardState(cardsState, this._configName)
41
43
  .then(savedCardConfig => {
42
44
  this._config = Object.assign(Object.assign({}, this._config), { cardsState });
43
45
  resolve(savedCardConfig);
@@ -113,17 +115,17 @@ export class SnkFormConfigManager {
113
115
  }
114
116
  return this._formConfigFetcher;
115
117
  }
116
- async fetchUserAvailableConfigs() {
118
+ async fetchUserAvailableConfigs(resourceID) {
117
119
  if (this._configName != undefined) {
118
120
  //FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
119
121
  return Promise.resolve(undefined);
120
122
  }
121
- return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
123
+ return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, resourceID);
122
124
  }
123
- async fetchLegacyConfig() {
124
- return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
125
+ async fetchLegacyConfig(resourceID) {
126
+ return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, resourceID);
125
127
  }
126
- async fetchDefaultConfig() {
127
- return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
128
+ async fetchDefaultConfig(resourceID) {
129
+ return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, resourceID);
128
130
  }
129
131
  }
@@ -1,7 +1,6 @@
1
1
  import { ElementIDUtils } from '@sankhyalabs/core';
2
2
  import { h } from '@stencil/core';
3
3
  import { SnkFormConfigManager } from './SnkFormConfigManager';
4
- import ResourceIDUtils from '../../lib/resourceid/ResourceIDUtils';
5
4
  export class SnkForm {
6
5
  constructor() {
7
6
  this._dataUnit = undefined;
@@ -11,7 +10,6 @@ export class SnkForm {
11
10
  this.configName = undefined;
12
11
  this.recordsValidator = undefined;
13
12
  this.messagesBuilder = undefined;
14
- this.resourceID = undefined;
15
13
  }
16
14
  /**
17
15
  * Exibe a janela de configurações do formulário.
@@ -32,7 +30,7 @@ export class SnkForm {
32
30
  const dataInfo = { dataUnit: this._dataUnit };
33
31
  ElementIDUtils.addIDInfo(this._element, null, dataInfo);
34
32
  }
35
- async componentWillLoad() {
33
+ componentWillLoad() {
36
34
  let parent = this._element.parentElement;
37
35
  while (parent) {
38
36
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -54,10 +52,7 @@ export class SnkForm {
54
52
  }
55
53
  parent = parent.parentElement;
56
54
  }
57
- if (this.resourceID == undefined) {
58
- this.resourceID = await ResourceIDUtils.getResourceID();
59
- }
60
- this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
55
+ this._configManager = new SnkFormConfigManager(this.configName);
61
56
  this._configManager.loadConfig();
62
57
  }
63
58
  render() {
@@ -137,23 +132,6 @@ export class SnkForm {
137
132
  "tags": [],
138
133
  "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
139
134
  }
140
- },
141
- "resourceID": {
142
- "type": "string",
143
- "mutable": false,
144
- "complexType": {
145
- "original": "string",
146
- "resolved": "string",
147
- "references": {}
148
- },
149
- "required": false,
150
- "optional": false,
151
- "docs": {
152
- "tags": [],
153
- "text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
154
- },
155
- "attribute": "resource-i-d",
156
- "reflect": false
157
135
  }
158
136
  };
159
137
  }
@@ -196,28 +174,6 @@ export class SnkForm {
196
174
  "resolved": "string",
197
175
  "references": {}
198
176
  }
199
- }, {
200
- "method": "formItemsReady",
201
- "name": "formItemsReady",
202
- "bubbles": true,
203
- "cancelable": true,
204
- "composed": true,
205
- "docs": {
206
- "tags": [],
207
- "text": "Respons\u00E1vel por notificar quando ocorrer a renderiza\u00E7\u00E3o de itens do formul\u00E1rio."
208
- },
209
- "complexType": {
210
- "original": "Array<HTMLElement>",
211
- "resolved": "HTMLElement[]",
212
- "references": {
213
- "Array": {
214
- "location": "global"
215
- },
216
- "HTMLElement": {
217
- "location": "global"
218
- }
219
- }
220
- }
221
177
  }];
222
178
  }
223
179
  static get methods() {
@@ -1,6 +1,6 @@
1
1
  import { h, Host } from "@stencil/core";
2
2
  import { Sortable } from '@shopify/draggable';
3
- import { ObjectUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { ApplicationContext, ObjectUtils, ArrayUtils, ElementIDUtils } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from "@sankhyalabs/ezui/dist/collection/utils";
5
5
  import { ACTION_CONFIG, CONFIG_EVENTS, DEFAULT_TYPE, TAB_NAMES } from "../../../../lib/utils/constants";
6
6
  import { UserConfigType } from "../../../../lib/http/data-fetcher/fetchers/form-config-fetcher";
@@ -446,10 +446,13 @@ export class SnkFormConfig {
446
446
  this._sortableGroup.on(CONFIG_EVENTS.dragStop, (evt) => this.controlStopDraggingGroup(evt));
447
447
  }
448
448
  loadUserConfig() {
449
+ if (this._applicationResourceID == undefined) {
450
+ return;
451
+ }
449
452
  if (this.configManager == undefined) {
450
453
  return;
451
454
  }
452
- this.configManager.fetchUserAvailableConfigs()
455
+ this.configManager.fetchUserAvailableConfigs(this._applicationResourceID)
453
456
  .then((userConfig) => {
454
457
  this._formConfigOptions = userConfig;
455
458
  if (this._formConfigOptions == undefined) {
@@ -503,6 +506,9 @@ export class SnkFormConfig {
503
506
  }
504
507
  }
505
508
  async loadConfigByUser() {
509
+ if (this._applicationResourceID == undefined) {
510
+ return;
511
+ }
506
512
  if (this.configManager == undefined) {
507
513
  return;
508
514
  }
@@ -512,10 +518,10 @@ export class SnkFormConfig {
512
518
  let config;
513
519
  switch (this._optionFormConfigSelected.origin) {
514
520
  case UserConfigType.DEFAULT:
515
- config = await this.configManager.fetchDefaultConfig();
521
+ config = await this.configManager.fetchDefaultConfig(this._applicationResourceID);
516
522
  break;
517
523
  case UserConfigType.DEFAULT:
518
- config = await this.configManager.fetchDefaultConfig();
524
+ config = await this.configManager.fetchDefaultConfig(this._applicationResourceID);
519
525
  break;
520
526
  }
521
527
  if (config != undefined) {
@@ -931,7 +937,11 @@ export class SnkFormConfig {
931
937
  this.controlSortableGroup();
932
938
  }
933
939
  componentWillLoad() {
934
- this.loadConfig();
940
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
941
+ this._application.getResourceID().then(resourceID => {
942
+ this._applicationResourceID = resourceID;
943
+ this.loadConfig();
944
+ });
935
945
  }
936
946
  componentDidLoad() {
937
947
  const dataInfo = { dataUnit: this.dataUnit };