@sankhyalabs/sankhyablocks 8.3.0 → 8.4.0-dev.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-e9d7fa82.js → ConfigStorage-f0f89379.js} +163 -51
- package/dist/cjs/{DataFetcher-39b63a1e.js → DataFetcher-4798bac3.js} +136 -244
- package/dist/cjs/ISave-d68ce3cd.js +8 -0
- package/dist/cjs/PrintUtils-bcaeb82f.js +215 -0
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
- package/dist/cjs/{SnkFormConfigManager-2f8eccd9.js → SnkFormConfigManager-d5fd8800.js} +19 -21
- package/dist/cjs/{auth-fetcher-d407c31c.js → auth-fetcher-f2967437.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-15a7cc88.js → dataunit-fetcher-959c9a00.js} +1 -1
- package/dist/cjs/{form-config-fetcher-ab3ce222.js → form-config-fetcher-5e3d3b87.js} +66 -3
- package/dist/cjs/index-f9e81701.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-96c042aa.js → pesquisa-fetcher-7973c081.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +19 -11
- package/dist/cjs/snk-application.cjs.entry.js +60 -44
- package/dist/cjs/snk-attach.cjs.entry.js +9 -14
- package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +28 -11
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -2
- package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-7cc1846d.js} +5 -5
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +17 -13
- 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 +7 -16
- 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 +23 -22
- package/dist/cjs/{snk-guides-viewer-8518c61b.js → snk-guides-viewer-b7b680d2.js} +19 -8
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +10 -9
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +14 -16
- package/dist/cjs/snk-print-selector.cjs.entry.js +2 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +43 -85
- package/dist/cjs/snk-taskbar-custom-elements.cjs.entry.js +20 -0
- package/dist/cjs/snk-taskbar.cjs.entry.js +71 -5
- package/dist/cjs/{taskbar-elements-b98dd6e9.js → taskbar-elements-39949c7a.js} +4 -4
- package/dist/collection/collection-manifest.json +1 -0
- 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 +120 -65
- package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
- package/dist/collection/components/snk-crud/snk-crud.js +44 -8
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +60 -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 +65 -28
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +22 -6
- 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 +8 -13
- 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 +108 -16
- 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 +23 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +4 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar-custom-elements.js +43 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +4 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +126 -5
- package/dist/collection/lib/configs/ConfigStorage.js +33 -44
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +23 -71
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +118 -42
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +0 -24
- package/dist/collection/lib/index.js +10 -0
- package/dist/collection/lib/resourceid/ResourceIDUtils.js +7 -0
- package/dist/collection/lib/utils/PrintUtils.js +18 -9
- package/dist/collection/lib/utils/urlutils.js +29 -0
- package/dist/components/ConfigStorage.js +161 -48
- package/dist/components/DataFetcher.js +137 -244
- package/dist/components/PrintUtils.js +213 -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/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-actions-button2.js +23 -9
- package/dist/components/snk-application2.js +145 -129
- package/dist/components/snk-attach2.js +1 -8
- package/dist/components/snk-configurator2.js +3 -1
- package/dist/components/snk-crud.js +27 -8
- package/dist/components/snk-data-unit2.js +6 -5
- package/dist/components/snk-detail-view2.js +26 -10
- 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 +8 -13
- 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 +24 -17
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-print-selector.js +1 -1
- package/dist/components/snk-simple-crud2.js +30 -73
- package/dist/components/snk-taskbar-custom-elements.d.ts +11 -0
- package/dist/components/snk-taskbar-custom-elements.js +35 -0
- package/dist/components/snk-taskbar2.js +81 -9
- package/dist/esm/{ConfigStorage-1090289a.js → ConfigStorage-4441aa3d.js} +162 -49
- package/dist/esm/{DataFetcher-a4ed43e7.js → DataFetcher-1618bffe.js} +137 -244
- package/dist/esm/ISave-4412b20c.js +8 -0
- package/dist/esm/PrintUtils-3e4ff0f5.js +213 -0
- package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
- package/dist/esm/{SnkFormConfigManager-de537eca.js → SnkFormConfigManager-5a5f85a3.js} +19 -21
- package/dist/esm/{auth-fetcher-c53e0d6c.js → auth-fetcher-7861187e.js} +1 -1
- package/dist/esm/{dataunit-fetcher-8d0bfa4a.js → dataunit-fetcher-53c007be.js} +1 -1
- package/dist/esm/{form-config-fetcher-4065db9a.js → form-config-fetcher-2fe67341.js} +65 -3
- package/dist/esm/index-a7d3d3f1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-7460b876.js → pesquisa-fetcher-19e81fc8.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +19 -11
- package/dist/esm/snk-application.entry.js +60 -44
- package/dist/esm/snk-attach.entry.js +5 -10
- package/dist/esm/snk-configurator.entry.js +2 -1
- package/dist/esm/snk-crud.entry.js +30 -13
- package/dist/esm/snk-data-exporter.entry.js +3 -2
- package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-1715d2f1.js} +5 -5
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +17 -13
- 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 +8 -17
- 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 +23 -22
- package/dist/esm/{snk-guides-viewer-cdecff6e.js → snk-guides-viewer-e4fe884d.js} +19 -8
- package/dist/esm/snk-guides-viewer.entry.js +10 -9
- package/dist/esm/snk-personalized-filter.entry.js +14 -16
- package/dist/esm/snk-print-selector.entry.js +1 -3
- package/dist/esm/snk-simple-crud.entry.js +34 -76
- package/dist/esm/snk-taskbar-custom-elements.entry.js +16 -0
- package/dist/esm/snk-taskbar.entry.js +71 -5
- package/dist/esm/{taskbar-elements-2c761819.js → taskbar-elements-0a6b8b95.js} +4 -4
- package/dist/sankhyablocks/p-0b99a775.entry.js +1 -0
- package/dist/sankhyablocks/p-1e30c376.entry.js +1 -0
- package/dist/sankhyablocks/p-1fa3acbe.entry.js +1 -0
- package/dist/sankhyablocks/p-27dbbb3a.entry.js +1 -0
- package/dist/sankhyablocks/p-29b1d77b.entry.js +11 -0
- package/dist/sankhyablocks/p-324ce41e.entry.js +1 -0
- package/dist/sankhyablocks/p-34604220.entry.js +1 -0
- package/dist/sankhyablocks/p-41820e28.entry.js +1 -0
- package/dist/sankhyablocks/p-4352324d.entry.js +1 -0
- package/dist/sankhyablocks/{p-9d18017a.js → p-449d25e0.js} +2 -2
- package/dist/sankhyablocks/p-5051a23a.entry.js +1 -0
- package/dist/sankhyablocks/p-5526ab67.js +1 -0
- package/dist/sankhyablocks/p-5b2ee1d3.js +1 -0
- package/dist/sankhyablocks/p-5da848bb.js +26 -0
- package/dist/sankhyablocks/p-6098d844.entry.js +1 -0
- package/dist/sankhyablocks/p-648a7c72.entry.js +1 -0
- package/dist/sankhyablocks/p-688dcb4c.js +1 -0
- package/dist/sankhyablocks/p-72fc257b.entry.js +1 -0
- package/dist/sankhyablocks/p-7d6eca73.entry.js +1 -0
- package/dist/sankhyablocks/p-81a7f74c.js +1 -0
- package/dist/sankhyablocks/p-8d884fab.js +1 -0
- package/dist/sankhyablocks/p-90b5d1af.entry.js +1 -0
- package/dist/sankhyablocks/p-989937ee.entry.js +1 -0
- package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
- package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
- package/dist/sankhyablocks/{p-b978da60.js → p-a75e892a.js} +1 -1
- package/dist/sankhyablocks/p-a81996df.js +1 -0
- package/dist/sankhyablocks/p-c555075c.entry.js +1 -0
- package/dist/sankhyablocks/{p-a2493d11.js → p-c9841939.js} +1 -1
- package/dist/sankhyablocks/p-ca1522bc.entry.js +1 -0
- package/dist/sankhyablocks/p-cbed6235.entry.js +1 -0
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
- package/dist/sankhyablocks/p-daa687aa.js +56 -0
- package/dist/sankhyablocks/p-e1cb1f0b.js +1 -0
- package/dist/sankhyablocks/p-eb1a650a.entry.js +1 -0
- package/dist/sankhyablocks/p-f784010c.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 +9 -22
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +4 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +12 -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 +13 -2
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +4 -0
- 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 +17 -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/processor/taskbar-processor.d.ts +2 -2
- package/dist/types/components/snk-taskbar/snk-taskbar-custom-elements.d.ts +7 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +27 -0
- package/dist/types/components.d.ts +203 -22
- package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
- package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -8
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +2 -2
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +0 -1
- package/dist/types/lib/index.d.ts +11 -0
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
- package/dist/types/lib/utils/PrintUtils.d.ts +1 -0
- package/dist/types/lib/utils/urlutils.d.ts +14 -0
- package/package.json +2 -2
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/filter-bar-config-fetcher-24548cec.js +0 -155
- package/dist/cjs/resource-fetcher-64102551.js +0 -68
- package/dist/components/filter-bar-config-fetcher.js +0 -153
- package/dist/components/resource-fetcher.js +0 -66
- package/dist/esm/filter-bar-config-fetcher-2417b8cf.js +0 -153
- package/dist/esm/resource-fetcher-45a70066.js +0 -66
- package/dist/sankhyablocks/p-0848ee4d.entry.js +0 -1
- package/dist/sankhyablocks/p-0bd9c412.js +0 -1
- package/dist/sankhyablocks/p-0fb83448.js +0 -1
- package/dist/sankhyablocks/p-10b2aedc.entry.js +0 -1
- package/dist/sankhyablocks/p-1f63dcd4.entry.js +0 -1
- package/dist/sankhyablocks/p-216b2102.entry.js +0 -1
- package/dist/sankhyablocks/p-216f081a.entry.js +0 -1
- package/dist/sankhyablocks/p-44e66c8d.js +0 -1
- package/dist/sankhyablocks/p-4514fc6a.entry.js +0 -1
- package/dist/sankhyablocks/p-50c13cc8.entry.js +0 -1
- package/dist/sankhyablocks/p-52c6b2e7.js +0 -1
- package/dist/sankhyablocks/p-564efc43.js +0 -1
- package/dist/sankhyablocks/p-5994af77.js +0 -56
- package/dist/sankhyablocks/p-6bb904bb.entry.js +0 -1
- package/dist/sankhyablocks/p-6e06175e.entry.js +0 -1
- package/dist/sankhyablocks/p-6f0795c8.entry.js +0 -1
- package/dist/sankhyablocks/p-7588f006.entry.js +0 -1
- package/dist/sankhyablocks/p-847e6c20.js +0 -17
- package/dist/sankhyablocks/p-8f3652bf.entry.js +0 -11
- package/dist/sankhyablocks/p-9471cbc9.entry.js +0 -1
- package/dist/sankhyablocks/p-a42dd503.entry.js +0 -1
- package/dist/sankhyablocks/p-b04fb9d4.js +0 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
- package/dist/sankhyablocks/p-c32b9d7c.entry.js +0 -1
- package/dist/sankhyablocks/p-c6380ea2.entry.js +0 -1
- package/dist/sankhyablocks/p-c6feb995.entry.js +0 -1
- package/dist/sankhyablocks/p-d7c7a289.entry.js +0 -1
- package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
- package/dist/sankhyablocks/p-f3b7b69e.js +0 -10
- package/dist/sankhyablocks/p-f7eded3a.entry.js +0 -1
- package/dist/sankhyablocks/p-ff7383b0.entry.js +0 -1
@@ -1,8 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import { F as
|
3
|
-
import {
|
4
|
-
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher-2417b8cf.js';
|
5
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-a4ed43e7.js';
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-2fe67341.js';
|
2
|
+
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
3
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-1618bffe.js';
|
6
4
|
|
7
5
|
class GridConfigFetcher extends ResourceFetcher {
|
8
6
|
constructor() {
|
@@ -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 };
|