@sankhyalabs/sankhyablocks 8.2.0-dev.1 → 8.2.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{ConfigStorage-12397f18.js → ConfigStorage-e9d7fa82.js} +51 -163
- package/dist/cjs/{DataFetcher-f2da1f79.js → DataFetcher-39b63a1e.js} +29 -67
- package/dist/cjs/{SnkFormConfigManager-13f79e37.js → SnkFormConfigManager-2f8eccd9.js} +21 -19
- package/dist/cjs/{auth-fetcher-319a4cb2.js → auth-fetcher-d407c31c.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-e72068c1.js → dataunit-fetcher-15a7cc88.js} +1 -1
- package/dist/cjs/filter-bar-config-fetcher-24548cec.js +155 -0
- package/dist/cjs/{form-config-fetcher-5d62ab62.js → form-config-fetcher-ab3ce222.js} +3 -66
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-8c363096.js → pesquisa-fetcher-96c042aa.js} +1 -1
- package/dist/cjs/resource-fetcher-64102551.js +68 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +11 -18
- package/dist/cjs/snk-application.cjs.entry.js +44 -49
- package/dist/cjs/snk-attach.cjs.entry.js +13 -7
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -2
- package/dist/cjs/snk-crud.cjs.entry.js +10 -25
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-80a00ae4.js → snk-data-unit-e89e07bd.js} +3 -4
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +12 -14
- package/dist/cjs/snk-entity-list.cjs.entry.js +4 -0
- package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -14
- package/dist/cjs/snk-filter-detail.cjs.entry.js +15 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +19 -5
- package/dist/cjs/snk-form-config.cjs.entry.js +17 -6
- package/dist/cjs/snk-form-view.cjs.entry.js +1 -6
- package/dist/cjs/snk-form.cjs.entry.js +8 -12
- package/dist/cjs/snk-grid-config.cjs.entry.js +6 -5
- package/dist/cjs/snk-grid.cjs.entry.js +20 -17
- package/dist/cjs/{snk-guides-viewer-a7cd6fda.js → snk-guides-viewer-8518c61b.js} +7 -17
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +16 -13
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +72 -20
- package/dist/cjs/snk-taskbar.cjs.entry.js +1 -2
- package/dist/collection/components/snk-actions-button/actions/index.js +4 -3
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +4 -8
- package/dist/collection/components/snk-application/snk-application.js +65 -60
- package/dist/collection/components/snk-configurator/snk-configurator.js +1 -19
- package/dist/collection/components/snk-crud/snk-crud.js +6 -40
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -42
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +1 -27
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +28 -47
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +4 -21
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +12 -2
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +16 -21
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +12 -28
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +19 -17
- package/dist/collection/components/snk-form/snk-form.js +2 -46
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +15 -5
- package/dist/collection/components/snk-grid/snk-grid.js +15 -51
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +1 -19
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +12 -28
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +0 -22
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -19
- package/dist/collection/lib/configs/ConfigStorage.js +44 -33
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +59 -2
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +29 -38
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +24 -0
- package/dist/collection/lib/index.js +0 -10
- package/dist/collection/lib/utils/urlutils.js +0 -29
- package/dist/components/ConfigStorage.js +48 -161
- package/dist/components/DataFetcher.js +29 -67
- package/dist/components/SnkFormConfigManager.js +19 -17
- package/dist/components/auth-fetcher.js +1 -1
- package/dist/components/filter-bar-config-fetcher.js +153 -0
- package/dist/components/form-config-fetcher.js +2 -64
- package/dist/components/resource-fetcher.js +66 -0
- package/dist/components/snk-actions-button2.js +9 -23
- package/dist/components/snk-application2.js +128 -134
- package/dist/components/snk-attach2.js +8 -1
- package/dist/components/snk-configurator2.js +1 -3
- package/dist/components/snk-crud.js +6 -23
- package/dist/components/snk-data-unit2.js +3 -5
- package/dist/components/snk-detail-view2.js +8 -20
- package/dist/components/snk-entity-list.js +4 -0
- package/dist/components/snk-filter-bar2.js +12 -12
- package/dist/components/snk-filter-detail2.js +12 -2
- package/dist/components/snk-filter-modal-item2.js +16 -5
- package/dist/components/snk-form-config2.js +15 -5
- package/dist/components/snk-form-view2.js +1 -6
- package/dist/components/snk-form.js +2 -9
- package/dist/components/snk-grid-config2.js +2 -4
- package/dist/components/snk-grid2.js +16 -17
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-simple-crud2.js +60 -8
- package/dist/components/snk-taskbar2.js +1 -3
- package/dist/esm/{ConfigStorage-932ab366.js → ConfigStorage-1090289a.js} +49 -162
- package/dist/esm/{DataFetcher-7e18aa30.js → DataFetcher-a4ed43e7.js} +29 -67
- package/dist/esm/{SnkFormConfigManager-bb9afc3f.js → SnkFormConfigManager-de537eca.js} +21 -19
- package/dist/esm/{auth-fetcher-6d9664b7.js → auth-fetcher-c53e0d6c.js} +1 -1
- package/dist/esm/{dataunit-fetcher-91a4eb82.js → dataunit-fetcher-8d0bfa4a.js} +1 -1
- package/dist/esm/filter-bar-config-fetcher-2417b8cf.js +153 -0
- package/dist/esm/{form-config-fetcher-aaaa79a6.js → form-config-fetcher-4065db9a.js} +3 -65
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-56b30fb4.js → pesquisa-fetcher-7460b876.js} +1 -1
- package/dist/esm/resource-fetcher-45a70066.js +66 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +11 -18
- package/dist/esm/snk-application.entry.js +44 -49
- package/dist/esm/snk-attach.entry.js +9 -3
- package/dist/esm/snk-configurator.entry.js +1 -2
- package/dist/esm/snk-crud.entry.js +10 -25
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-3ab57d1a.js → snk-data-unit-8c4d944d.js} +3 -4
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +12 -14
- package/dist/esm/snk-entity-list.entry.js +4 -0
- package/dist/esm/snk-filter-bar.entry.js +17 -14
- package/dist/esm/snk-filter-detail.entry.js +16 -2
- package/dist/esm/snk-filter-modal-item.entry.js +20 -6
- package/dist/esm/snk-form-config.entry.js +18 -7
- package/dist/esm/snk-form-view.entry.js +1 -6
- package/dist/esm/snk-form.entry.js +8 -12
- package/dist/esm/snk-grid-config.entry.js +6 -5
- package/dist/esm/snk-grid.entry.js +20 -17
- package/dist/esm/{snk-guides-viewer-cc709b5f.js → snk-guides-viewer-cdecff6e.js} +7 -17
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +16 -13
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +62 -10
- package/dist/esm/snk-taskbar.entry.js +1 -2
- package/dist/sankhyablocks/{p-d13c00b6.entry.js → p-0848ee4d.entry.js} +1 -1
- package/dist/sankhyablocks/p-0bd9c412.js +1 -0
- package/dist/sankhyablocks/p-0fb83448.js +1 -0
- package/dist/sankhyablocks/p-10b2aedc.entry.js +1 -0
- package/dist/sankhyablocks/p-1f63dcd4.entry.js +1 -0
- package/dist/sankhyablocks/p-216b2102.entry.js +1 -0
- package/dist/sankhyablocks/p-216f081a.entry.js +1 -0
- package/dist/sankhyablocks/{p-f8e6b97e.js → p-44e66c8d.js} +1 -1
- package/dist/sankhyablocks/p-4514fc6a.entry.js +1 -0
- package/dist/sankhyablocks/p-50c13cc8.entry.js +1 -0
- package/dist/sankhyablocks/p-52c6b2e7.js +1 -0
- package/dist/sankhyablocks/p-564efc43.js +1 -0
- package/dist/sankhyablocks/p-5994af77.js +56 -0
- package/dist/sankhyablocks/p-6bb904bb.entry.js +1 -0
- package/dist/sankhyablocks/p-6e06175e.entry.js +1 -0
- package/dist/sankhyablocks/p-6f0795c8.entry.js +1 -0
- package/dist/sankhyablocks/p-7588f006.entry.js +1 -0
- package/dist/sankhyablocks/p-847e6c20.js +17 -0
- package/dist/sankhyablocks/p-8f3652bf.entry.js +11 -0
- package/dist/sankhyablocks/p-9471cbc9.entry.js +1 -0
- package/dist/sankhyablocks/{p-14eac6fe.js → p-9d18017a.js} +1 -1
- package/dist/sankhyablocks/p-a42dd503.entry.js +1 -0
- package/dist/sankhyablocks/p-b04fb9d4.js +1 -0
- package/dist/sankhyablocks/{p-2d333d22.js → p-b978da60.js} +1 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +1 -0
- package/dist/sankhyablocks/p-c32b9d7c.entry.js +1 -0
- package/dist/sankhyablocks/p-c6380ea2.entry.js +1 -0
- package/dist/sankhyablocks/{p-03bb1aea.entry.js → p-c6feb995.entry.js} +1 -1
- package/dist/sankhyablocks/p-d7c7a289.entry.js +1 -0
- package/dist/sankhyablocks/p-de69b4b0.entry.js +1 -0
- package/dist/sankhyablocks/p-f3b7b69e.js +10 -0
- package/dist/sankhyablocks/p-f7eded3a.entry.js +1 -0
- package/dist/sankhyablocks/p-ff7383b0.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +1 -2
- package/dist/types/components/snk-application/snk-application.d.ts +13 -8
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +0 -4
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -5
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +0 -8
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +0 -5
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +2 -9
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +0 -4
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +4 -5
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -4
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +4 -5
- package/dist/types/components/snk-form/snk-form.d.ts +1 -9
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +2 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -5
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +0 -4
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +1 -5
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -4
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -4
- package/dist/types/components.d.ts +21 -125
- package/dist/types/lib/configs/ConfigStorage.d.ts +13 -11
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +7 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +1 -0
- package/dist/types/lib/index.d.ts +0 -11
- package/dist/types/lib/utils/urlutils.d.ts +0 -14
- package/package.json +2 -2
- package/dist/cjs/ISave-d68ce3cd.js +0 -8
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +0 -12
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +0 -7
- package/dist/components/ResourceIDUtils.js +0 -10
- package/dist/esm/ISave-4412b20c.js +0 -8
- package/dist/esm/ResourceIDUtils-a114189a.js +0 -10
- package/dist/sankhyablocks/p-01739b21.entry.js +0 -1
- package/dist/sankhyablocks/p-05dbc70e.entry.js +0 -1
- package/dist/sankhyablocks/p-41e897f1.js +0 -56
- package/dist/sankhyablocks/p-48a40939.js +0 -1
- package/dist/sankhyablocks/p-611aa624.entry.js +0 -1
- package/dist/sankhyablocks/p-66bb8c20.entry.js +0 -1
- package/dist/sankhyablocks/p-688dcb4c.js +0 -1
- package/dist/sankhyablocks/p-6f154396.entry.js +0 -1
- package/dist/sankhyablocks/p-787071a8.js +0 -1
- package/dist/sankhyablocks/p-8481bb59.entry.js +0 -1
- package/dist/sankhyablocks/p-8818d8f6.entry.js +0 -1
- package/dist/sankhyablocks/p-93f6ca04.entry.js +0 -1
- package/dist/sankhyablocks/p-9a270401.entry.js +0 -1
- package/dist/sankhyablocks/p-9e7d65a4.js +0 -1
- package/dist/sankhyablocks/p-a52a6c9d.js +0 -26
- package/dist/sankhyablocks/p-b6003974.entry.js +0 -1
- package/dist/sankhyablocks/p-c555075c.entry.js +0 -1
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
- package/dist/sankhyablocks/p-d53a9169.entry.js +0 -1
- package/dist/sankhyablocks/p-d7638f45.entry.js +0 -11
- package/dist/sankhyablocks/p-e086cc2a.entry.js +0 -1
- package/dist/sankhyablocks/p-e64f3e17.entry.js +0 -1
- package/dist/sankhyablocks/p-ed41b38c.js +0 -1
- package/dist/sankhyablocks/p-ed705cbb.entry.js +0 -1
- package/dist/sankhyablocks/p-efc10705.entry.js +0 -1
- package/dist/sankhyablocks/p-f74fe358.js +0 -1
- package/dist/sankhyablocks/p-f91e0c5d.entry.js +0 -1
- package/dist/sankhyablocks/p-fa523d6b.entry.js +0 -1
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +0 -3
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ApplicationContext } from "@sankhyalabs/core";
|
1
2
|
import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fetcher";
|
2
3
|
import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
|
3
4
|
import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
|
@@ -8,73 +9,83 @@ const CONFIG_SOURCE = {
|
|
8
9
|
filterBar: "filterBar"
|
9
10
|
};
|
10
11
|
export class ConfigStorage {
|
11
|
-
static
|
12
|
-
ConfigStorage.
|
13
|
-
|
12
|
+
static async get() {
|
13
|
+
if (!ConfigStorage.instance) {
|
14
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
15
|
+
if (application != undefined) {
|
16
|
+
const configName = application.configName;
|
17
|
+
const resourceID = await application.getResourceID();
|
18
|
+
ConfigStorage.instance = new ConfigStorage();
|
19
|
+
ConfigStorage.resourceID = resourceID;
|
20
|
+
ConfigStorage.instance.loadFormConfig(configName);
|
21
|
+
ConfigStorage.instance.loadGridConfig(configName);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return this.instance;
|
14
25
|
}
|
15
|
-
|
16
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar
|
26
|
+
async loadFilterBarConfig(name, urlParams) {
|
27
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
17
28
|
if (!ConfigStorage.configById.has(cacheID)) {
|
18
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
29
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
|
19
30
|
}
|
20
31
|
return ConfigStorage.configById.get(cacheID);
|
21
32
|
}
|
22
|
-
|
23
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form
|
33
|
+
async loadFormConfig(name) {
|
34
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
|
24
35
|
if (!ConfigStorage.configById.has(cacheID)) {
|
25
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
36
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
|
26
37
|
}
|
27
38
|
return ConfigStorage.configById.get(cacheID);
|
28
39
|
}
|
29
|
-
|
30
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid
|
40
|
+
async loadGridConfig(name) {
|
41
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
|
31
42
|
if (!ConfigStorage.configById.has(cacheID)) {
|
32
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
43
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
|
33
44
|
}
|
34
45
|
return ConfigStorage.configById.get(cacheID);
|
35
46
|
}
|
36
|
-
static async saveFilterBarConfig(config, name
|
37
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar
|
47
|
+
static async saveFilterBarConfig(config, name) {
|
48
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
38
49
|
this.configById.delete(cacheID);
|
39
|
-
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
50
|
+
return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
|
40
51
|
}
|
41
|
-
static async saveFormConfig(config, name
|
42
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form
|
52
|
+
static async saveFormConfig(config, name) {
|
53
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
|
43
54
|
this.configById.delete(cacheID);
|
44
|
-
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
55
|
+
return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
|
45
56
|
}
|
46
|
-
static async saveCardState(config, name
|
47
|
-
return this.formConfigFetcher.saveCardState(config, name, resourceID);
|
57
|
+
static async saveCardState(config, name) {
|
58
|
+
return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
|
48
59
|
}
|
49
|
-
static async saveGridConfig(config, name
|
60
|
+
static async saveGridConfig(config, name) {
|
50
61
|
if (config == undefined) {
|
51
62
|
return;
|
52
63
|
}
|
53
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid
|
64
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
|
54
65
|
this.configById.delete(cacheID);
|
55
|
-
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
66
|
+
return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
|
56
67
|
}
|
57
|
-
static async loadPersonalizedFilter(filterId,
|
58
|
-
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
|
68
|
+
static async loadPersonalizedFilter(filterId, configName) {
|
69
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
|
59
70
|
}
|
60
|
-
static async savePersonalizedFilter(personalizedFilter,
|
71
|
+
static async savePersonalizedFilter(personalizedFilter, configName) {
|
61
72
|
//Ao criar ou alterar um filtro personalizado,
|
62
73
|
//precisamos remover o cache do status da filterbar.
|
63
|
-
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar
|
74
|
+
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
|
64
75
|
this.configById.delete(cacheID);
|
65
|
-
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
|
76
|
+
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
66
77
|
}
|
67
|
-
static async removePersonalizedFilter(personalizedFilter,
|
68
|
-
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
|
78
|
+
static async removePersonalizedFilter(personalizedFilter, configName) {
|
79
|
+
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
69
80
|
}
|
70
81
|
static async validatePersonalizedFilter(dataUnitName, expression) {
|
71
82
|
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
72
83
|
}
|
73
|
-
static buildCacheID(name, source
|
84
|
+
static buildCacheID(name, source) {
|
74
85
|
if (name == undefined) {
|
75
|
-
return `req_${source}_${resourceID}`;
|
86
|
+
return `req_${source}_${this.resourceID}`;
|
76
87
|
}
|
77
|
-
return `req_${source}_${name}_${resourceID}`;
|
88
|
+
return `req_${source}_${name}_${this.resourceID}`;
|
78
89
|
}
|
79
90
|
}
|
80
91
|
ConfigStorage.configById = new Map();
|
@@ -1,11 +1,12 @@
|
|
1
|
-
import { ChangeOperation, DataUnit,
|
1
|
+
import { ChangeOperation, DataType, DataUnit, SortMode, StringUtils, } from '@sankhyalabs/core';
|
2
|
+
import { DISTINCT_FILTER_NAME_PREFIX } from "@sankhyalabs/ezui/dist/collection/utils/constants";
|
2
3
|
export default class InMemoryLoader {
|
3
4
|
constructor(metadata, records) {
|
4
5
|
this.records = records || [];
|
5
6
|
this.metadata = metadata;
|
6
7
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
7
8
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
8
|
-
this._dataUnit.dataLoader = (dataUnit, request) =>
|
9
|
+
this._dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
|
9
10
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
10
11
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
11
12
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
@@ -42,6 +43,62 @@ export default class InMemoryLoader {
|
|
42
43
|
metadaLoader() {
|
43
44
|
return Promise.resolve(this._metadata);
|
44
45
|
}
|
46
|
+
dataLoader(dataUnit, request) {
|
47
|
+
const filters = this.getColumnFilters(dataUnit);
|
48
|
+
let records = this.applyFilters(filters);
|
49
|
+
if (request.sort) {
|
50
|
+
request.sort.forEach(sort => {
|
51
|
+
records = records.sort((recordA, recordB) => {
|
52
|
+
const fieldA = recordA[sort.field];
|
53
|
+
const fieldB = recordB[sort.field];
|
54
|
+
const sortFn = this.getSortFn(sort.dataType);
|
55
|
+
return sortFn(fieldA, fieldB) * (sort.mode == SortMode.ASC ? 1 : -1);
|
56
|
+
});
|
57
|
+
});
|
58
|
+
}
|
59
|
+
return Promise.resolve({ records: records });
|
60
|
+
}
|
61
|
+
applyFilters(filters) {
|
62
|
+
let records = [...this._records];
|
63
|
+
filters.forEach(filter => {
|
64
|
+
records = records.filter(record => { var _a; return filter.values.includes((_a = record[filter.column]) === null || _a === void 0 ? void 0 : _a.toString()); });
|
65
|
+
});
|
66
|
+
return records;
|
67
|
+
}
|
68
|
+
getColumnFilters(dataUnit) {
|
69
|
+
var _a, _b;
|
70
|
+
const allFilters = (_a = dataUnit.getFilters()) !== null && _a !== void 0 ? _a : [];
|
71
|
+
const columnFilters = (_b = allFilters.filter(filter => { var _a; return (_a = filter.name) === null || _a === void 0 ? void 0 : _a.includes(DISTINCT_FILTER_NAME_PREFIX); })) !== null && _b !== void 0 ? _b : [];
|
72
|
+
return columnFilters.map(filter => {
|
73
|
+
var _a, _b;
|
74
|
+
return {
|
75
|
+
column: (_b = (_a = filter.name) === null || _a === void 0 ? void 0 : _a.replace(DISTINCT_FILTER_NAME_PREFIX, "")) !== null && _b !== void 0 ? _b : "",
|
76
|
+
values: filter.params.map(param => param.value),
|
77
|
+
};
|
78
|
+
});
|
79
|
+
}
|
80
|
+
getSortFn(type) {
|
81
|
+
switch (type) {
|
82
|
+
case DataType.NUMBER:
|
83
|
+
return this.sortNumber;
|
84
|
+
case DataType.DATE:
|
85
|
+
return this.sortDate;
|
86
|
+
case DataType.OBJECT:
|
87
|
+
return this.sortObject;
|
88
|
+
default:
|
89
|
+
return StringUtils.compare;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
sortObject(a, b) {
|
93
|
+
return StringUtils.compare(a === null || a === void 0 ? void 0 : a["label"], b === null || b === void 0 ? void 0 : b["label"]);
|
94
|
+
}
|
95
|
+
sortNumber(a, b) {
|
96
|
+
return a - b;
|
97
|
+
}
|
98
|
+
sortDate(a, b) {
|
99
|
+
let timeA = a.getTime(), timeB = b.getTime();
|
100
|
+
return timeA === timeB ? 0 : (timeA < timeB ? -1 : 1);
|
101
|
+
}
|
45
102
|
saveLoader(_dataUnit, changes) {
|
46
103
|
return new Promise((resolve) => {
|
47
104
|
let dataUnitRecords = [];
|
@@ -8,7 +8,6 @@ import { PrintUtils } from '../../utils/PrintUtils';
|
|
8
8
|
export class DataFetcher {
|
9
9
|
constructor() {
|
10
10
|
this.GRAPHQL_PATH = `/${window.MGE_MODULE_NAME || 'mgefin-bff'}/graphql`;
|
11
|
-
this.ready = true;
|
12
11
|
this.watingRequestsById = new Map();
|
13
12
|
}
|
14
13
|
static get() {
|
@@ -19,9 +18,6 @@ export class DataFetcher {
|
|
19
18
|
DataFetcher.instance.resume();
|
20
19
|
}
|
21
20
|
else {
|
22
|
-
if (ApplicationContext.getContextValue("__SNK__APPLICATION__LOADING__") === true) {
|
23
|
-
DataFetcher.instance.pause();
|
24
|
-
}
|
25
21
|
application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
|
26
22
|
application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
|
27
23
|
}
|
@@ -80,10 +76,6 @@ export class DataFetcher {
|
|
80
76
|
}
|
81
77
|
async callGraphQL(req) {
|
82
78
|
var _a;
|
83
|
-
if (this.ready) {
|
84
|
-
this.pause();
|
85
|
-
window.requestAnimationFrame(() => this.resume());
|
86
|
-
}
|
87
79
|
const reqKey = this.getReqKey(req);
|
88
80
|
req.queryID = reqKey;
|
89
81
|
req.values.queryID = reqKey;
|
@@ -113,7 +105,7 @@ export class DataFetcher {
|
|
113
105
|
if (!this.watingRequestsById.has(reqKey)) {
|
114
106
|
this.watingRequestsById.set(reqKey, new WaitingRequest(req));
|
115
107
|
}
|
116
|
-
return (_a = this.
|
108
|
+
return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
|
117
109
|
}
|
118
110
|
}
|
119
111
|
resolveURL() {
|
@@ -261,43 +253,42 @@ export class DataFetcher {
|
|
261
253
|
getQueryTemplate(re) {
|
262
254
|
return (re.query || "").replaceAll("$queryAlias$", re.queryID);
|
263
255
|
}
|
256
|
+
getWatingRequest(reqID) {
|
257
|
+
return this.watingRequestsById.get(reqID);
|
258
|
+
}
|
264
259
|
pause() {
|
265
260
|
this.ready = false;
|
266
261
|
}
|
267
262
|
async resume() {
|
268
263
|
this.ready = true;
|
269
264
|
if (this.watingRequestsById.size > 0) {
|
270
|
-
const
|
271
|
-
this.watingRequestsById
|
272
|
-
|
273
|
-
|
274
|
-
}
|
275
|
-
async executePendingRequest(watingRequestsById) {
|
276
|
-
const requestsBatch = [];
|
277
|
-
watingRequestsById.forEach(async (waitingReq) => {
|
278
|
-
let query = this.getQueryTemplate(waitingReq.request);
|
279
|
-
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
280
|
-
});
|
281
|
-
let res = undefined;
|
282
|
-
let dataResponse = [];
|
283
|
-
let errorsResponse = [];
|
284
|
-
res = await this.fecthGrapql(requestsBatch);
|
285
|
-
dataResponse = res.data;
|
286
|
-
errorsResponse = res.errors;
|
287
|
-
//Reject promises with errors from query
|
288
|
-
errorsResponse.forEach((errorResponse) => {
|
289
|
-
Object.entries(errorResponse).forEach(([_key, val]) => {
|
290
|
-
var _a;
|
291
|
-
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
265
|
+
const requestsBatch = [];
|
266
|
+
this.watingRequestsById.forEach(async (waitingReq) => {
|
267
|
+
let query = this.getQueryTemplate(waitingReq.request);
|
268
|
+
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
292
269
|
});
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
270
|
+
let res = undefined;
|
271
|
+
let dataResponse = [];
|
272
|
+
let errorsResponse = [];
|
273
|
+
res = await this.fecthGrapql(requestsBatch);
|
274
|
+
dataResponse = res.data;
|
275
|
+
errorsResponse = res.errors;
|
276
|
+
//Reject promises with errors from query
|
277
|
+
errorsResponse.forEach((errorResponse) => {
|
278
|
+
Object.entries(errorResponse).forEach(([_key, val]) => {
|
279
|
+
var _a;
|
280
|
+
(((_a = this.getWatingRequest(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
281
|
+
});
|
299
282
|
});
|
300
|
-
|
283
|
+
//Resolve promises with data from query
|
284
|
+
dataResponse.forEach((data) => {
|
285
|
+
Object.entries(data).forEach(([key, val]) => {
|
286
|
+
var _a;
|
287
|
+
(((_a = this.getWatingRequest(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
|
288
|
+
});
|
289
|
+
});
|
290
|
+
this.watingRequestsById.clear();
|
291
|
+
}
|
301
292
|
}
|
302
293
|
async fecthGrapql(request) {
|
303
294
|
let res = undefined;
|
@@ -91,6 +91,30 @@ export default class FilterBarConfigFetcher extends ResourceFetcher {
|
|
91
91
|
});
|
92
92
|
});
|
93
93
|
}
|
94
|
+
saveEntityListConfig(item, resourceID, configName) {
|
95
|
+
return new Promise((accept, reject) => {
|
96
|
+
this.getConfig(resourceID, configName).then(config => {
|
97
|
+
const state = config.map(({ id, value, fixed, visible, type, groupedItems }) => {
|
98
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ id }, (value && { value: normalizeValue(value, type) })), (fixed && { fixed })), (visible && { visible: true })), { groupedItems });
|
99
|
+
});
|
100
|
+
const index = state.findIndex(({ id }) => id === item.id);
|
101
|
+
const newItem = { id: item.id, value: normalizeValue(item.value, item.type), fixed: item.fixed, visible: true };
|
102
|
+
if (index > -1) {
|
103
|
+
state[index] = newItem;
|
104
|
+
}
|
105
|
+
else {
|
106
|
+
state.push(newItem);
|
107
|
+
}
|
108
|
+
this.saveResource(state, this.getPath(resourceID, configName)).then(resp => {
|
109
|
+
accept(resp);
|
110
|
+
}).catch(exception => {
|
111
|
+
reject(exception);
|
112
|
+
});
|
113
|
+
}).catch(exception => {
|
114
|
+
reject(exception);
|
115
|
+
});
|
116
|
+
});
|
117
|
+
}
|
94
118
|
buildFieldList(items) {
|
95
119
|
return items.map(item => {
|
96
120
|
var _a, _b;
|
@@ -2,13 +2,3 @@ export { DataFetcher } from './http/data-fetcher/DataFetcher';
|
|
2
2
|
export { PesquisaFetcher } from './http/data-fetcher/fetchers/pesquisa-fetcher';
|
3
3
|
export { CrudUtils } from './utils/CrudUtils';
|
4
4
|
export { PresentationMode } from "./@types";
|
5
|
-
export { TotalsFetcher } from './http/data-fetcher/fetchers/totals-fetcher';
|
6
|
-
export { default as ApplicationConfigFetcher } from './http/data-fetcher/fetchers/application-config-fetcher';
|
7
|
-
export { AttachFetcher } from './http/data-fetcher/fetchers/attach-fetcher';
|
8
|
-
export { default as DataUnitFetcher } from './http/data-fetcher/fetchers/dataunit-fetcher';
|
9
|
-
export { default as FilterBarConfigFetcher } from './http/data-fetcher/fetchers/filter-bar-config-fetcher';
|
10
|
-
export { FormConfigFetcher } from './http/data-fetcher/fetchers/form-config-fetcher';
|
11
|
-
export { default as GridConfigFetcher } from './http/data-fetcher/fetchers/grid-config-fetcher';
|
12
|
-
export { default as ParametersFetcher } from './http/data-fetcher/fetchers/parameters-fecher';
|
13
|
-
export { default as PersonalizedFilterFetcher } from './http/data-fetcher/fetchers/personalized-filter-fetcher';
|
14
|
-
export { ResourceFetcher } from './http/data-fetcher/fetchers/resource-fetcher';
|
@@ -22,33 +22,4 @@ export default class UrlUtils {
|
|
22
22
|
return window['mock_url'];
|
23
23
|
return `${location.protocol}//${location.hostname}${location.port ? ":" + location.port : ""}`;
|
24
24
|
}
|
25
|
-
/**
|
26
|
-
* Extrai da URL o parâmetro que contém o resourceId da tela desejada.
|
27
|
-
*
|
28
|
-
*/
|
29
|
-
static getResourceIdFromUrlToken(url) {
|
30
|
-
try {
|
31
|
-
const parts = url.split('/');
|
32
|
-
const encodedValue = parts[1];
|
33
|
-
return atob(encodedValue);
|
34
|
-
}
|
35
|
-
catch (error) {
|
36
|
-
throw new Error('Erro ao obter resourceId:' + error);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
/**
|
40
|
-
* Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
|
41
|
-
*
|
42
|
-
*/
|
43
|
-
static getPkObjectFromUrlToken(url) {
|
44
|
-
try {
|
45
|
-
const parts = url.split('/');
|
46
|
-
const encodedObjectPart = parts[parts.length - 2];
|
47
|
-
const decodedObjectPart = atob(encodedObjectPart);
|
48
|
-
return JSON.parse(decodedObjectPart);
|
49
|
-
}
|
50
|
-
catch (error) {
|
51
|
-
throw new Error('Erro ao obter a PK do objeto:' + error);
|
52
|
-
}
|
53
|
-
}
|
54
25
|
}
|
@@ -1,132 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import { F as
|
1
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
2
|
+
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
3
|
+
import { R as ResourceFetcher } from './resource-fetcher.js';
|
4
|
+
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
|
3
5
|
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
4
6
|
|
5
|
-
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
6
|
-
var t = {};
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
8
|
-
t[p] = s[p];
|
9
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
10
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
11
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
12
|
-
t[p[i]] = s[p[i]];
|
13
|
-
}
|
14
|
-
return t;
|
15
|
-
};
|
16
|
-
function normalizeValue(value, type) {
|
17
|
-
if (value == undefined) {
|
18
|
-
return value;
|
19
|
-
}
|
20
|
-
if (value instanceof Date) {
|
21
|
-
return value.toISOString();
|
22
|
-
}
|
23
|
-
if (typeof value === "object") {
|
24
|
-
if (value instanceof Array) {
|
25
|
-
return value.map(item => {
|
26
|
-
if (FilterItemType.MULTI_LIST === type) {
|
27
|
-
const values = __rest(item, ["label"]);
|
28
|
-
return normalizeValue(values);
|
29
|
-
}
|
30
|
-
return normalizeValue(item);
|
31
|
-
});
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
const normalized = Object.assign({}, value);
|
35
|
-
Object.keys(value).forEach(prop => {
|
36
|
-
if (value[prop] !== undefined) {
|
37
|
-
normalized[prop] = normalizeValue(value[prop], type);
|
38
|
-
}
|
39
|
-
else {
|
40
|
-
delete normalized[prop];
|
41
|
-
}
|
42
|
-
});
|
43
|
-
return normalized;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
return value;
|
47
|
-
}
|
48
|
-
class FilterBarConfigFetcher extends ResourceFetcher {
|
49
|
-
normalize(items) {
|
50
|
-
return items.map(item => {
|
51
|
-
const { id, value, fixed, visible, type, groupedItems } = item;
|
52
|
-
const stateItem = { id };
|
53
|
-
if (value) {
|
54
|
-
stateItem["value"] = normalizeValue(value, type);
|
55
|
-
}
|
56
|
-
if (fixed) {
|
57
|
-
stateItem["fixed"] = fixed;
|
58
|
-
}
|
59
|
-
if (groupedItems) {
|
60
|
-
if (groupedItems.length === 0) {
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
if (groupedItems.filter(item => item.visible).length > 0) {
|
64
|
-
stateItem["visible"] = true;
|
65
|
-
}
|
66
|
-
stateItem["groupedItems"] = this.normalize(groupedItems);
|
67
|
-
}
|
68
|
-
else {
|
69
|
-
if (visible) {
|
70
|
-
stateItem["visible"] = true;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
return stateItem;
|
74
|
-
}).filter(item => item != undefined);
|
75
|
-
}
|
76
|
-
saveConfig(items, resourceID, configName) {
|
77
|
-
return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
|
78
|
-
}
|
79
|
-
getConfig(resourceID, configName, urlParams) {
|
80
|
-
return new Promise((accept, reject) => {
|
81
|
-
this.loadResource(this.getPath(resourceID, configName, urlParams))
|
82
|
-
.then((configAsString) => {
|
83
|
-
let fieldsList;
|
84
|
-
if (configAsString) {
|
85
|
-
const filterBarConfig = JSON.parse(configAsString);
|
86
|
-
fieldsList = this.buildFieldList(filterBarConfig.items);
|
87
|
-
}
|
88
|
-
accept(fieldsList || []);
|
89
|
-
})
|
90
|
-
.catch((error) => {
|
91
|
-
reject(error);
|
92
|
-
});
|
93
|
-
});
|
94
|
-
}
|
95
|
-
buildFieldList(items) {
|
96
|
-
return items.map(item => {
|
97
|
-
var _a, _b;
|
98
|
-
if (item.type === FilterItemType.MULTI_LIST) {
|
99
|
-
const multiListValue = item.value;
|
100
|
-
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;
|
101
|
-
}
|
102
|
-
return item;
|
103
|
-
});
|
104
|
-
}
|
105
|
-
getPath(resourceID, name, urlParams) {
|
106
|
-
let path = `cfg://filter/FilterBarState:${resourceID}`;
|
107
|
-
if (name) {
|
108
|
-
path += `.${name}`;
|
109
|
-
}
|
110
|
-
if (urlParams) {
|
111
|
-
path += this.buildQueryString(urlParams);
|
112
|
-
}
|
113
|
-
return path;
|
114
|
-
}
|
115
|
-
buildQueryString(urlParams) {
|
116
|
-
let queryString = '?';
|
117
|
-
for (let key in urlParams) {
|
118
|
-
if (!urlParams.hasOwnProperty(key)) {
|
119
|
-
continue;
|
120
|
-
}
|
121
|
-
if (queryString.length > 1) {
|
122
|
-
queryString += '&';
|
123
|
-
}
|
124
|
-
queryString += key + '=' + urlParams[key];
|
125
|
-
}
|
126
|
-
return queryString;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
7
|
class GridConfigFetcher extends ResourceFetcher {
|
131
8
|
constructor() {
|
132
9
|
super(...arguments);
|
@@ -341,73 +218,83 @@ const CONFIG_SOURCE = {
|
|
341
218
|
filterBar: "filterBar"
|
342
219
|
};
|
343
220
|
class ConfigStorage {
|
344
|
-
static
|
345
|
-
ConfigStorage.
|
346
|
-
|
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;
|
347
234
|
}
|
348
|
-
|
349
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar
|
235
|
+
async loadFilterBarConfig(name, urlParams) {
|
236
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
350
237
|
if (!ConfigStorage.configById.has(cacheID)) {
|
351
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
238
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(ConfigStorage.resourceID, name, urlParams));
|
352
239
|
}
|
353
240
|
return ConfigStorage.configById.get(cacheID);
|
354
241
|
}
|
355
|
-
|
356
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form
|
242
|
+
async loadFormConfig(name) {
|
243
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
|
357
244
|
if (!ConfigStorage.configById.has(cacheID)) {
|
358
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
245
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, ConfigStorage.resourceID));
|
359
246
|
}
|
360
247
|
return ConfigStorage.configById.get(cacheID);
|
361
248
|
}
|
362
|
-
|
363
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid
|
249
|
+
async loadGridConfig(name) {
|
250
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
|
364
251
|
if (!ConfigStorage.configById.has(cacheID)) {
|
365
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
252
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, ConfigStorage.resourceID));
|
366
253
|
}
|
367
254
|
return ConfigStorage.configById.get(cacheID);
|
368
255
|
}
|
369
|
-
static async saveFilterBarConfig(config, name
|
370
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar
|
256
|
+
static async saveFilterBarConfig(config, name) {
|
257
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
371
258
|
this.configById.delete(cacheID);
|
372
|
-
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
259
|
+
return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
|
373
260
|
}
|
374
|
-
static async saveFormConfig(config, name
|
375
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form
|
261
|
+
static async saveFormConfig(config, name) {
|
262
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
|
376
263
|
this.configById.delete(cacheID);
|
377
|
-
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
264
|
+
return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
|
378
265
|
}
|
379
|
-
static async saveCardState(config, name
|
380
|
-
return this.formConfigFetcher.saveCardState(config, name, resourceID);
|
266
|
+
static async saveCardState(config, name) {
|
267
|
+
return this.formConfigFetcher.saveCardState(config, name, this.resourceID);
|
381
268
|
}
|
382
|
-
static async saveGridConfig(config, name
|
269
|
+
static async saveGridConfig(config, name) {
|
383
270
|
if (config == undefined) {
|
384
271
|
return;
|
385
272
|
}
|
386
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid
|
273
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
|
387
274
|
this.configById.delete(cacheID);
|
388
|
-
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
275
|
+
return this.gridConfigFetcher.saveConfig(config, name, this.resourceID);
|
389
276
|
}
|
390
|
-
static async loadPersonalizedFilter(filterId,
|
391
|
-
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
|
277
|
+
static async loadPersonalizedFilter(filterId, configName) {
|
278
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(this.resourceID, filterId, configName);
|
392
279
|
}
|
393
|
-
static async savePersonalizedFilter(personalizedFilter,
|
280
|
+
static async savePersonalizedFilter(personalizedFilter, configName) {
|
394
281
|
//Ao criar ou alterar um filtro personalizado,
|
395
282
|
//precisamos remover o cache do status da filterbar.
|
396
|
-
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar
|
283
|
+
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
|
397
284
|
this.configById.delete(cacheID);
|
398
|
-
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
|
285
|
+
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
399
286
|
}
|
400
|
-
static async removePersonalizedFilter(personalizedFilter,
|
401
|
-
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
|
287
|
+
static async removePersonalizedFilter(personalizedFilter, configName) {
|
288
|
+
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, this.resourceID, configName);
|
402
289
|
}
|
403
290
|
static async validatePersonalizedFilter(dataUnitName, expression) {
|
404
291
|
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
405
292
|
}
|
406
|
-
static buildCacheID(name, source
|
293
|
+
static buildCacheID(name, source) {
|
407
294
|
if (name == undefined) {
|
408
|
-
return `req_${source}_${resourceID}`;
|
295
|
+
return `req_${source}_${this.resourceID}`;
|
409
296
|
}
|
410
|
-
return `req_${source}_${name}_${resourceID}`;
|
297
|
+
return `req_${source}_${name}_${this.resourceID}`;
|
411
298
|
}
|
412
299
|
}
|
413
300
|
ConfigStorage.configById = new Map();
|
@@ -416,4 +303,4 @@ ConfigStorage.formConfigFetcher = new FormConfigFetcher();
|
|
416
303
|
ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
|
417
304
|
ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
|
418
305
|
|
419
|
-
export { ConfigStorage as C, PersonalizedFilterFetcher as P };
|
306
|
+
export { ConfigStorage as C, GridConfigFetcher as G, PersonalizedFilterFetcher as P };
|