@sankhyalabs/sankhyablocks 8.1.0-dev.1 → 8.1.0-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/{ConfigStorage-73e7afff.js → ConfigStorage-d688c739.js} +163 -50
- package/dist/cjs/{DataFetcher-004811c6.js → DataFetcher-d2c6ae38.js} +29 -0
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
- package/dist/cjs/{SnkFormConfigManager-d1f1a222.js → SnkFormConfigManager-29b73c81.js} +19 -21
- package/dist/cjs/{auth-fetcher-58237931.js → auth-fetcher-da975ac5.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-029eafbd.js → dataunit-fetcher-58ad78a7.js} +1 -1
- package/dist/cjs/{form-config-fetcher-181767c9.js → form-config-fetcher-761994b9.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-9a97994a.js → pesquisa-fetcher-bb0bb679.js} +1 -1
- package/dist/cjs/{resource-fetcher-c0332609.js → resource-fetcher-95d24dff.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +13 -10
- package/dist/cjs/snk-application.cjs.entry.js +48 -44
- package/dist/cjs/snk-attach.cjs.entry.js +2 -2
- package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +21 -9
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-cc7a7ed0.js → snk-data-unit-80a00ae4.js} +4 -4
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +11 -10
- package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +15 -17
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +6 -19
- package/dist/cjs/snk-form-config.cjs.entry.js +7 -17
- package/dist/cjs/snk-form-view.cjs.entry.js +6 -1
- package/dist/cjs/snk-form.cjs.entry.js +13 -8
- package/dist/cjs/snk-grid-config.cjs.entry.js +6 -6
- package/dist/cjs/snk-grid.cjs.entry.js +18 -20
- package/dist/cjs/{snk-guides-viewer-27f87d90.js → snk-guides-viewer-f67f9cea.js} +12 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +15 -71
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
- package/dist/collection/components/snk-actions-button/actions/index.js +3 -4
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +8 -4
- package/dist/collection/components/snk-application/snk-application.js +58 -65
- package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
- package/dist/collection/components/snk-crud/snk-crud.js +40 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +42 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +27 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +47 -28
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +7 -8
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +0 -23
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +2 -12
- 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 +21 -16
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +28 -12
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
- package/dist/collection/components/snk-form/snk-form.js +46 -2
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +5 -15
- package/dist/collection/components/snk-grid/snk-grid.js +51 -15
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +19 -1
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +28 -12
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +22 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +19 -1
- package/dist/collection/components/teste-pesquisa/teste-pesquisa.css +1 -1
- package/dist/collection/lib/configs/ConfigStorage.js +33 -44
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +2 -59
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
- package/dist/collection/lib/utils/urlutils.js +29 -0
- package/dist/components/ConfigStorage.js +161 -48
- package/dist/components/DataFetcher.js +29 -0
- package/dist/components/ResourceIDUtils.js +10 -0
- package/dist/components/SnkFormConfigManager.js +17 -19
- package/dist/components/auth-fetcher.js +1 -1
- package/dist/components/form-config-fetcher.js +64 -2
- package/dist/components/snk-actions-button2.js +11 -8
- package/dist/components/snk-application2.js +42 -38
- package/dist/components/snk-configurator2.js +3 -1
- package/dist/components/snk-crud.js +18 -5
- package/dist/components/snk-data-unit2.js +5 -4
- package/dist/components/snk-detail-view2.js +15 -7
- package/dist/components/snk-entity-list.js +0 -4
- package/dist/components/snk-filter-bar2.js +12 -12
- package/dist/components/snk-filter-detail2.js +2 -12
- package/dist/components/snk-filter-modal-item2.js +5 -16
- package/dist/components/snk-form-config2.js +5 -15
- package/dist/components/snk-form-view2.js +6 -1
- package/dist/components/snk-form.js +9 -2
- package/dist/components/snk-grid-config2.js +4 -2
- package/dist/components/snk-grid2.js +17 -16
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-simple-crud2.js +3 -59
- package/dist/components/snk-taskbar2.js +3 -1
- package/dist/esm/{ConfigStorage-19a7260b.js → ConfigStorage-cfe03e99.js} +163 -49
- package/dist/esm/{DataFetcher-e0fc5549.js → DataFetcher-aaaff866.js} +29 -0
- package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
- package/dist/esm/{SnkFormConfigManager-1a42eb02.js → SnkFormConfigManager-bfd8eabd.js} +19 -21
- package/dist/esm/{auth-fetcher-83a946f8.js → auth-fetcher-7860d777.js} +1 -1
- package/dist/esm/{dataunit-fetcher-6a695723.js → dataunit-fetcher-9dfcdb1d.js} +1 -1
- package/dist/esm/{form-config-fetcher-9e167008.js → form-config-fetcher-4a34b86a.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-9118eb7a.js → pesquisa-fetcher-01d058e6.js} +1 -1
- package/dist/{components/resource-fetcher.js → esm/resource-fetcher-b36ac145.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +13 -10
- package/dist/esm/snk-application.entry.js +48 -44
- package/dist/esm/snk-attach.entry.js +2 -2
- package/dist/esm/snk-configurator.entry.js +2 -1
- package/dist/esm/snk-crud.entry.js +21 -9
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-77508763.js → snk-data-unit-3ab57d1a.js} +4 -4
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +11 -10
- package/dist/esm/snk-entity-list.entry.js +0 -4
- package/dist/esm/snk-filter-bar.entry.js +15 -17
- package/dist/esm/snk-filter-detail.entry.js +2 -16
- package/dist/esm/snk-filter-modal-item.entry.js +7 -20
- package/dist/esm/snk-form-config.entry.js +8 -18
- package/dist/esm/snk-form-view.entry.js +6 -1
- package/dist/esm/snk-form.entry.js +13 -8
- package/dist/esm/snk-grid-config.entry.js +6 -6
- package/dist/esm/snk-grid.entry.js +18 -20
- package/dist/esm/{snk-guides-viewer-c47cd45e.js → snk-guides-viewer-3ea14ab4.js} +12 -7
- package/dist/esm/snk-guides-viewer.entry.js +7 -8
- package/dist/esm/snk-personalized-filter.entry.js +14 -16
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +5 -61
- package/dist/esm/snk-taskbar.entry.js +2 -1
- package/dist/sankhyablocks/{p-e7e54737.entry.js → p-05bcad8a.entry.js} +1 -1
- package/dist/sankhyablocks/p-0ae5b923.entry.js +1 -0
- package/dist/sankhyablocks/p-15230263.js +1 -0
- package/dist/sankhyablocks/p-18fa618e.entry.js +1 -0
- package/dist/sankhyablocks/{p-0ed0fc02.entry.js → p-1b81c379.entry.js} +1 -1
- package/dist/sankhyablocks/{p-98f9d076.js → p-2dd0f891.js} +2 -2
- package/dist/sankhyablocks/p-330f584a.entry.js +1 -0
- package/dist/sankhyablocks/{p-968741cc.js → p-48a40939.js} +1 -1
- package/dist/sankhyablocks/p-4c33a77c.entry.js +1 -0
- package/dist/sankhyablocks/p-53884b5f.entry.js +1 -0
- package/dist/sankhyablocks/{p-df8621b4.js → p-60791bb6.js} +1 -1
- package/dist/sankhyablocks/{p-f88c45bf.js → p-64c2cec3.js} +1 -1
- package/dist/sankhyablocks/p-688dcb4c.js +1 -0
- package/dist/sankhyablocks/p-70e785db.entry.js +1 -0
- package/dist/sankhyablocks/{p-0a4c753d.js → p-85affa29.js} +1 -1
- package/dist/sankhyablocks/p-861a3495.entry.js +1 -0
- package/dist/sankhyablocks/p-878b0dd3.entry.js +1 -0
- package/dist/sankhyablocks/p-97d2fbd9.entry.js +1 -0
- package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
- package/dist/sankhyablocks/p-9d591463.js +1 -0
- package/dist/sankhyablocks/p-9d93da18.js +56 -0
- package/dist/sankhyablocks/{p-34085ced.entry.js → p-9f387187.entry.js} +1 -1
- package/dist/sankhyablocks/p-aa4c112f.entry.js +11 -0
- package/dist/sankhyablocks/p-bae87498.entry.js +1 -0
- package/dist/sankhyablocks/{p-2ac9c585.js → p-bee6b5d7.js} +1 -1
- package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
- package/dist/sankhyablocks/p-cc67bd06.entry.js +1 -0
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
- package/dist/sankhyablocks/p-e070d7a3.entry.js +1 -0
- package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
- package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
- package/dist/sankhyablocks/{p-7b8b8ae9.js → p-f737f7e1.js} +1 -1
- package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/actions/index.d.ts +2 -1
- package/dist/types/components/snk-application/snk-application.d.ts +8 -13
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +5 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +8 -0
- package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +5 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +9 -2
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +2 -2
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +0 -4
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -3
- 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 +5 -4
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-form/SnkFormConfigManager.d.ts +5 -4
- package/dist/types/components/snk-form/snk-form.d.ts +9 -1
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +0 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +5 -1
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +5 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +4 -0
- package/dist/types/components.d.ts +125 -21
- package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -7
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
- package/dist/types/lib/utils/urlutils.d.ts +14 -0
- package/package.json +3 -3
- package/dist/cjs/filter-bar-config-fetcher-2b8ed9d0.js +0 -155
- package/dist/components/filter-bar-config-fetcher.js +0 -153
- package/dist/esm/filter-bar-config-fetcher-06e02851.js +0 -153
- package/dist/esm/resource-fetcher-768d5556.js +0 -66
- package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
- package/dist/sankhyablocks/p-22c6fe1a.entry.js +0 -1
- package/dist/sankhyablocks/p-34a1357a.entry.js +0 -1
- package/dist/sankhyablocks/p-4721c3db.js +0 -1
- package/dist/sankhyablocks/p-6759adae.entry.js +0 -1
- package/dist/sankhyablocks/p-7e285d6c.entry.js +0 -11
- package/dist/sankhyablocks/p-815a42c0.entry.js +0 -1
- package/dist/sankhyablocks/p-8a41172a.entry.js +0 -1
- package/dist/sankhyablocks/p-8f8184ff.js +0 -56
- package/dist/sankhyablocks/p-976e56e9.js +0 -1
- package/dist/sankhyablocks/p-bc735728.entry.js +0 -1
- package/dist/sankhyablocks/p-be684b38.entry.js +0 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
- package/dist/sankhyablocks/p-c0f656af.entry.js +0 -1
- package/dist/sankhyablocks/p-c44f6aaf.entry.js +0 -1
- package/dist/sankhyablocks/p-c57bd935.entry.js +0 -1
- package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
- package/dist/sankhyablocks/p-cfd7da4a.entry.js +0 -1
- package/dist/sankhyablocks/p-d1b89765.js +0 -1
- package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
- package/dist/sankhyablocks/p-e28129aa.entry.js +0 -1
- package/dist/sankhyablocks/p-f31bfdee.entry.js +0 -1
- package/dist/sankhyablocks/p-fe010e54.entry.js +0 -1
@@ -23,6 +23,7 @@ export class SnkTaskbar {
|
|
23
23
|
};
|
24
24
|
this._permissions = undefined;
|
25
25
|
this.configName = undefined;
|
26
|
+
this.resourceID = undefined;
|
26
27
|
this.buttons = undefined;
|
27
28
|
this.customButtons = undefined;
|
28
29
|
this.actionsList = undefined;
|
@@ -164,7 +165,7 @@ export class SnkTaskbar {
|
|
164
165
|
componentWillLoad() {
|
165
166
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
166
167
|
if (this._application) {
|
167
|
-
this._application.getAllAccess().then(access => this._permissions = access);
|
168
|
+
this._application.getAllAccess(this.resourceID).then(access => this._permissions = access);
|
168
169
|
}
|
169
170
|
else {
|
170
171
|
this._permissions = {};
|
@@ -232,6 +233,23 @@ export class SnkTaskbar {
|
|
232
233
|
"attribute": "config-name",
|
233
234
|
"reflect": false
|
234
235
|
},
|
236
|
+
"resourceID": {
|
237
|
+
"type": "string",
|
238
|
+
"mutable": false,
|
239
|
+
"complexType": {
|
240
|
+
"original": "string",
|
241
|
+
"resolved": "string",
|
242
|
+
"references": {}
|
243
|
+
},
|
244
|
+
"required": false,
|
245
|
+
"optional": false,
|
246
|
+
"docs": {
|
247
|
+
"tags": [],
|
248
|
+
"text": "Identificador de recursos como configura\u00E7\u00F5es e acesso."
|
249
|
+
},
|
250
|
+
"attribute": "resource-i-d",
|
251
|
+
"reflect": false
|
252
|
+
},
|
235
253
|
"buttons": {
|
236
254
|
"type": "string",
|
237
255
|
"mutable": false,
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { ApplicationContext } from "@sankhyalabs/core";
|
2
1
|
import { FormConfigFetcher } from "../http/data-fetcher/fetchers/form-config-fetcher";
|
3
2
|
import GridConfigFetcher from "../http/data-fetcher/fetchers/grid-config-fetcher";
|
4
3
|
import FilterBarConfigFetcher from "../http/data-fetcher/fetchers/filter-bar-config-fetcher";
|
@@ -9,83 +8,73 @@ const CONFIG_SOURCE = {
|
|
9
8
|
filterBar: "filterBar"
|
10
9
|
};
|
11
10
|
export class ConfigStorage {
|
12
|
-
static
|
13
|
-
|
14
|
-
|
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;
|
11
|
+
static preload(resourceID, configName) {
|
12
|
+
ConfigStorage.loadFormConfig(configName, resourceID);
|
13
|
+
ConfigStorage.loadGridConfig(configName, resourceID);
|
25
14
|
}
|
26
|
-
async loadFilterBarConfig(name, urlParams) {
|
27
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
15
|
+
static async loadFilterBarConfig(name, resourceID, urlParams) {
|
16
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
|
28
17
|
if (!ConfigStorage.configById.has(cacheID)) {
|
29
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(
|
18
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
30
19
|
}
|
31
20
|
return ConfigStorage.configById.get(cacheID);
|
32
21
|
}
|
33
|
-
async loadFormConfig(name) {
|
34
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
|
22
|
+
static async loadFormConfig(name, resourceID) {
|
23
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
|
35
24
|
if (!ConfigStorage.configById.has(cacheID)) {
|
36
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name,
|
25
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
37
26
|
}
|
38
27
|
return ConfigStorage.configById.get(cacheID);
|
39
28
|
}
|
40
|
-
async loadGridConfig(name) {
|
41
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
|
29
|
+
static async loadGridConfig(name, resourceID) {
|
30
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
|
42
31
|
if (!ConfigStorage.configById.has(cacheID)) {
|
43
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name,
|
32
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
44
33
|
}
|
45
34
|
return ConfigStorage.configById.get(cacheID);
|
46
35
|
}
|
47
|
-
static async saveFilterBarConfig(config, name) {
|
48
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
36
|
+
static async saveFilterBarConfig(config, name, resourceID) {
|
37
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
|
49
38
|
this.configById.delete(cacheID);
|
50
|
-
return this.filterBarConfigFetcher.saveConfig(config,
|
39
|
+
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
51
40
|
}
|
52
|
-
static async saveFormConfig(config, name) {
|
53
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
|
41
|
+
static async saveFormConfig(config, name, resourceID) {
|
42
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
|
54
43
|
this.configById.delete(cacheID);
|
55
|
-
return this.formConfigFetcher.saveConfig(config, name,
|
44
|
+
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
56
45
|
}
|
57
|
-
static async saveCardState(config, name) {
|
58
|
-
return this.formConfigFetcher.saveCardState(config, name,
|
46
|
+
static async saveCardState(config, name, resourceID) {
|
47
|
+
return this.formConfigFetcher.saveCardState(config, name, resourceID);
|
59
48
|
}
|
60
|
-
static async saveGridConfig(config, name) {
|
49
|
+
static async saveGridConfig(config, name, resourceID) {
|
61
50
|
if (config == undefined) {
|
62
51
|
return;
|
63
52
|
}
|
64
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
|
53
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
|
65
54
|
this.configById.delete(cacheID);
|
66
|
-
return this.gridConfigFetcher.saveConfig(config, name,
|
55
|
+
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
67
56
|
}
|
68
|
-
static async loadPersonalizedFilter(filterId, configName) {
|
69
|
-
return this.personalizedFilterFetcher.loadPersonalizedFilter(
|
57
|
+
static async loadPersonalizedFilter(filterId, resourceID, configName) {
|
58
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
|
70
59
|
}
|
71
|
-
static async savePersonalizedFilter(personalizedFilter, configName) {
|
60
|
+
static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
72
61
|
//Ao criar ou alterar um filtro personalizado,
|
73
62
|
//precisamos remover o cache do status da filterbar.
|
74
|
-
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
|
63
|
+
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar, resourceID);
|
75
64
|
this.configById.delete(cacheID);
|
76
|
-
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter,
|
65
|
+
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
|
77
66
|
}
|
78
|
-
static async removePersonalizedFilter(personalizedFilter, configName) {
|
79
|
-
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter,
|
67
|
+
static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
68
|
+
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
|
80
69
|
}
|
81
70
|
static async validatePersonalizedFilter(dataUnitName, expression) {
|
82
71
|
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
83
72
|
}
|
84
|
-
static buildCacheID(name, source) {
|
73
|
+
static buildCacheID(name, source, resourceID) {
|
85
74
|
if (name == undefined) {
|
86
|
-
return `req_${source}_${
|
75
|
+
return `req_${source}_${resourceID}`;
|
87
76
|
}
|
88
|
-
return `req_${source}_${name}_${
|
77
|
+
return `req_${source}_${name}_${resourceID}`;
|
89
78
|
}
|
90
79
|
}
|
91
80
|
ConfigStorage.configById = new Map();
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import { ChangeOperation,
|
2
|
-
import { DISTINCT_FILTER_NAME_PREFIX } from "@sankhyalabs/ezui/dist/collection/utils/constants";
|
1
|
+
import { ChangeOperation, DataUnit, defaultDataLoader, StringUtils, } from '@sankhyalabs/core';
|
3
2
|
export default class InMemoryLoader {
|
4
3
|
constructor(metadata, records) {
|
5
4
|
this.records = records || [];
|
6
5
|
this.metadata = metadata;
|
7
6
|
this._dataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
|
8
7
|
this._dataUnit.metadataLoader = () => this.metadaLoader();
|
9
|
-
this._dataUnit.dataLoader = (dataUnit, request) =>
|
8
|
+
this._dataUnit.dataLoader = (dataUnit, request) => defaultDataLoader(dataUnit, request, this._records);
|
10
9
|
this._dataUnit.saveLoader = (_dataUnit, changes) => this.saveLoader(_dataUnit, changes);
|
11
10
|
this._dataUnit.removeLoader = (_dataUnit, recordIds) => this.removeLoader(_dataUnit, recordIds);
|
12
11
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
@@ -43,62 +42,6 @@ export default class InMemoryLoader {
|
|
43
42
|
metadaLoader() {
|
44
43
|
return Promise.resolve(this._metadata);
|
45
44
|
}
|
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
|
-
}
|
102
45
|
saveLoader(_dataUnit, changes) {
|
103
46
|
return new Promise((resolve) => {
|
104
47
|
let dataUnitRecords = [];
|
@@ -91,30 +91,6 @@ 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
|
-
}
|
118
94
|
buildFieldList(items) {
|
119
95
|
return items.map(item => {
|
120
96
|
var _a, _b;
|
@@ -22,4 +22,33 @@ 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
|
+
}
|
25
54
|
}
|
@@ -1,7 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import { F as
|
3
|
-
import { R as ResourceFetcher } from './resource-fetcher.js';
|
4
|
-
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher.js';
|
2
|
+
import { F as FilterItemType } from './filter-item-type.enum.js';
|
5
3
|
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
6
4
|
|
7
5
|
class GridConfigFetcher extends ResourceFetcher {
|
@@ -44,6 +42,131 @@ class GridConfigFetcher extends ResourceFetcher {
|
|
44
42
|
}
|
45
43
|
}
|
46
44
|
|
45
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
46
|
+
var t = {};
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
48
|
+
t[p] = s[p];
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
52
|
+
t[p[i]] = s[p[i]];
|
53
|
+
}
|
54
|
+
return t;
|
55
|
+
};
|
56
|
+
function normalizeValue(value, type) {
|
57
|
+
if (value == undefined) {
|
58
|
+
return value;
|
59
|
+
}
|
60
|
+
if (value instanceof Date) {
|
61
|
+
return value.toISOString();
|
62
|
+
}
|
63
|
+
if (typeof value === "object") {
|
64
|
+
if (value instanceof Array) {
|
65
|
+
return value.map(item => {
|
66
|
+
if (FilterItemType.MULTI_LIST === type) {
|
67
|
+
const values = __rest(item, ["label"]);
|
68
|
+
return normalizeValue(values);
|
69
|
+
}
|
70
|
+
return normalizeValue(item);
|
71
|
+
});
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
const normalized = Object.assign({}, value);
|
75
|
+
Object.keys(value).forEach(prop => {
|
76
|
+
if (value[prop] !== undefined) {
|
77
|
+
normalized[prop] = normalizeValue(value[prop], type);
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
delete normalized[prop];
|
81
|
+
}
|
82
|
+
});
|
83
|
+
return normalized;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
return value;
|
87
|
+
}
|
88
|
+
class FilterBarConfigFetcher extends ResourceFetcher {
|
89
|
+
normalize(items) {
|
90
|
+
return items.map(item => {
|
91
|
+
const { id, value, fixed, visible, type, groupedItems } = item;
|
92
|
+
const stateItem = { id };
|
93
|
+
if (value) {
|
94
|
+
stateItem["value"] = normalizeValue(value, type);
|
95
|
+
}
|
96
|
+
if (fixed) {
|
97
|
+
stateItem["fixed"] = fixed;
|
98
|
+
}
|
99
|
+
if (groupedItems) {
|
100
|
+
if (groupedItems.length === 0) {
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
if (groupedItems.filter(item => item.visible).length > 0) {
|
104
|
+
stateItem["visible"] = true;
|
105
|
+
}
|
106
|
+
stateItem["groupedItems"] = this.normalize(groupedItems);
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
if (visible) {
|
110
|
+
stateItem["visible"] = true;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
return stateItem;
|
114
|
+
}).filter(item => item != undefined);
|
115
|
+
}
|
116
|
+
saveConfig(items, resourceID, configName) {
|
117
|
+
return this.saveResource(this.normalize(items), this.getPath(resourceID, configName));
|
118
|
+
}
|
119
|
+
getConfig(resourceID, configName, urlParams) {
|
120
|
+
return new Promise((accept, reject) => {
|
121
|
+
this.loadResource(this.getPath(resourceID, configName, urlParams))
|
122
|
+
.then((configAsString) => {
|
123
|
+
let fieldsList;
|
124
|
+
if (configAsString) {
|
125
|
+
const filterBarConfig = JSON.parse(configAsString);
|
126
|
+
fieldsList = this.buildFieldList(filterBarConfig.items);
|
127
|
+
}
|
128
|
+
accept(fieldsList || []);
|
129
|
+
})
|
130
|
+
.catch((error) => {
|
131
|
+
reject(error);
|
132
|
+
});
|
133
|
+
});
|
134
|
+
}
|
135
|
+
buildFieldList(items) {
|
136
|
+
return items.map(item => {
|
137
|
+
var _a, _b;
|
138
|
+
if (item.type === FilterItemType.MULTI_LIST) {
|
139
|
+
const multiListValue = item.value;
|
140
|
+
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;
|
141
|
+
}
|
142
|
+
return item;
|
143
|
+
});
|
144
|
+
}
|
145
|
+
getPath(resourceID, name, urlParams) {
|
146
|
+
let path = `cfg://filter/FilterBarState:${resourceID}`;
|
147
|
+
if (name) {
|
148
|
+
path += `.${name}`;
|
149
|
+
}
|
150
|
+
if (urlParams) {
|
151
|
+
path += this.buildQueryString(urlParams);
|
152
|
+
}
|
153
|
+
return path;
|
154
|
+
}
|
155
|
+
buildQueryString(urlParams) {
|
156
|
+
let queryString = '?';
|
157
|
+
for (let key in urlParams) {
|
158
|
+
if (!urlParams.hasOwnProperty(key)) {
|
159
|
+
continue;
|
160
|
+
}
|
161
|
+
if (queryString.length > 1) {
|
162
|
+
queryString += '&';
|
163
|
+
}
|
164
|
+
queryString += key + '=' + urlParams[key];
|
165
|
+
}
|
166
|
+
return queryString;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
47
170
|
class PersonalizedFilterFetcher {
|
48
171
|
constructor() {
|
49
172
|
this.templateByQuery = new Map();
|
@@ -218,83 +341,73 @@ const CONFIG_SOURCE = {
|
|
218
341
|
filterBar: "filterBar"
|
219
342
|
};
|
220
343
|
class ConfigStorage {
|
221
|
-
static
|
222
|
-
|
223
|
-
|
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;
|
344
|
+
static preload(resourceID, configName) {
|
345
|
+
ConfigStorage.loadFormConfig(configName, resourceID);
|
346
|
+
ConfigStorage.loadGridConfig(configName, resourceID);
|
234
347
|
}
|
235
|
-
async loadFilterBarConfig(name, urlParams) {
|
236
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
348
|
+
static async loadFilterBarConfig(name, resourceID, urlParams) {
|
349
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
|
237
350
|
if (!ConfigStorage.configById.has(cacheID)) {
|
238
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(
|
351
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
239
352
|
}
|
240
353
|
return ConfigStorage.configById.get(cacheID);
|
241
354
|
}
|
242
|
-
async loadFormConfig(name) {
|
243
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form);
|
355
|
+
static async loadFormConfig(name, resourceID) {
|
356
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
|
244
357
|
if (!ConfigStorage.configById.has(cacheID)) {
|
245
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name,
|
358
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
246
359
|
}
|
247
360
|
return ConfigStorage.configById.get(cacheID);
|
248
361
|
}
|
249
|
-
async loadGridConfig(name) {
|
250
|
-
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid);
|
362
|
+
static async loadGridConfig(name, resourceID) {
|
363
|
+
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
|
251
364
|
if (!ConfigStorage.configById.has(cacheID)) {
|
252
|
-
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name,
|
365
|
+
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
253
366
|
}
|
254
367
|
return ConfigStorage.configById.get(cacheID);
|
255
368
|
}
|
256
|
-
static async saveFilterBarConfig(config, name) {
|
257
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar);
|
369
|
+
static async saveFilterBarConfig(config, name, resourceID) {
|
370
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
|
258
371
|
this.configById.delete(cacheID);
|
259
|
-
return this.filterBarConfigFetcher.saveConfig(config,
|
372
|
+
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
260
373
|
}
|
261
|
-
static async saveFormConfig(config, name) {
|
262
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form);
|
374
|
+
static async saveFormConfig(config, name, resourceID) {
|
375
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
|
263
376
|
this.configById.delete(cacheID);
|
264
|
-
return this.formConfigFetcher.saveConfig(config, name,
|
377
|
+
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
265
378
|
}
|
266
|
-
static async saveCardState(config, name) {
|
267
|
-
return this.formConfigFetcher.saveCardState(config, name,
|
379
|
+
static async saveCardState(config, name, resourceID) {
|
380
|
+
return this.formConfigFetcher.saveCardState(config, name, resourceID);
|
268
381
|
}
|
269
|
-
static async saveGridConfig(config, name) {
|
382
|
+
static async saveGridConfig(config, name, resourceID) {
|
270
383
|
if (config == undefined) {
|
271
384
|
return;
|
272
385
|
}
|
273
|
-
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid);
|
386
|
+
const cacheID = this.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
|
274
387
|
this.configById.delete(cacheID);
|
275
|
-
return this.gridConfigFetcher.saveConfig(config, name,
|
388
|
+
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
276
389
|
}
|
277
|
-
static async loadPersonalizedFilter(filterId, configName) {
|
278
|
-
return this.personalizedFilterFetcher.loadPersonalizedFilter(
|
390
|
+
static async loadPersonalizedFilter(filterId, resourceID, configName) {
|
391
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName);
|
279
392
|
}
|
280
|
-
static async savePersonalizedFilter(personalizedFilter, configName) {
|
393
|
+
static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
281
394
|
//Ao criar ou alterar um filtro personalizado,
|
282
395
|
//precisamos remover o cache do status da filterbar.
|
283
|
-
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar);
|
396
|
+
const cacheID = this.buildCacheID(configName, CONFIG_SOURCE.filterBar, resourceID);
|
284
397
|
this.configById.delete(cacheID);
|
285
|
-
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter,
|
398
|
+
return this.personalizedFilterFetcher.savePersonalizedFilter(personalizedFilter, resourceID, configName);
|
286
399
|
}
|
287
|
-
static async removePersonalizedFilter(personalizedFilter, configName) {
|
288
|
-
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter,
|
400
|
+
static async removePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
401
|
+
return this.personalizedFilterFetcher.removePersonalizedFilter(personalizedFilter, resourceID, configName);
|
289
402
|
}
|
290
403
|
static async validatePersonalizedFilter(dataUnitName, expression) {
|
291
404
|
return this.personalizedFilterFetcher.validatePersonalizedFilter(dataUnitName, expression);
|
292
405
|
}
|
293
|
-
static buildCacheID(name, source) {
|
406
|
+
static buildCacheID(name, source, resourceID) {
|
294
407
|
if (name == undefined) {
|
295
|
-
return `req_${source}_${
|
408
|
+
return `req_${source}_${resourceID}`;
|
296
409
|
}
|
297
|
-
return `req_${source}_${name}_${
|
410
|
+
return `req_${source}_${name}_${resourceID}`;
|
298
411
|
}
|
299
412
|
}
|
300
413
|
ConfigStorage.configById = new Map();
|
@@ -303,4 +416,4 @@ ConfigStorage.formConfigFetcher = new FormConfigFetcher();
|
|
303
416
|
ConfigStorage.gridConfigFetcher = new GridConfigFetcher();
|
304
417
|
ConfigStorage.personalizedFilterFetcher = new PersonalizedFilterFetcher();
|
305
418
|
|
306
|
-
export { ConfigStorage as C,
|
419
|
+
export { ConfigStorage as C, PersonalizedFilterFetcher as P };
|
@@ -6434,6 +6434,35 @@ class UrlUtils {
|
|
6434
6434
|
return window['mock_url'];
|
6435
6435
|
return `${location.protocol}//${location.hostname}${location.port ? ":" + location.port : ""}`;
|
6436
6436
|
}
|
6437
|
+
/**
|
6438
|
+
* Extrai da URL o parâmetro que contém o resourceId da tela desejada.
|
6439
|
+
*
|
6440
|
+
*/
|
6441
|
+
static getResourceIdFromUrlToken(url) {
|
6442
|
+
try {
|
6443
|
+
const parts = url.split('/');
|
6444
|
+
const encodedValue = parts[1];
|
6445
|
+
return atob(encodedValue);
|
6446
|
+
}
|
6447
|
+
catch (error) {
|
6448
|
+
throw new Error('Erro ao obter resourceId:' + error);
|
6449
|
+
}
|
6450
|
+
}
|
6451
|
+
/**
|
6452
|
+
* Extrai da URL o parâmetro que contém o o objeto com a PK do registro específico.
|
6453
|
+
*
|
6454
|
+
*/
|
6455
|
+
static getPkObjectFromUrlToken(url) {
|
6456
|
+
try {
|
6457
|
+
const parts = url.split('/');
|
6458
|
+
const encodedObjectPart = parts[parts.length - 2];
|
6459
|
+
const decodedObjectPart = atob(encodedObjectPart);
|
6460
|
+
return JSON.parse(decodedObjectPart);
|
6461
|
+
}
|
6462
|
+
catch (error) {
|
6463
|
+
throw new Error('Erro ao obter a PK do objeto:' + error);
|
6464
|
+
}
|
6465
|
+
}
|
6437
6466
|
}
|
6438
6467
|
|
6439
6468
|
class ServiceBrokerRecaller {
|
@@ -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 };
|