@sankhyalabs/sankhyablocks 8.1.0-dev.10 → 8.1.0-dev.12
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-e32e1391.js → ConfigStorage-42601579.js} +163 -51
- package/dist/cjs/{DataFetcher-d2c6ae38.js → DataFetcher-370cc8f2.js} +38 -29
- package/dist/cjs/ISave-d68ce3cd.js +8 -0
- package/dist/cjs/ResourceIDUtils-5ff86aa7.js +12 -0
- package/dist/cjs/{SnkFormConfigManager-5e61b0a9.js → SnkFormConfigManager-e5a28b2e.js} +19 -21
- package/dist/cjs/{auth-fetcher-da975ac5.js → auth-fetcher-c42326e9.js} +2 -2
- package/dist/cjs/{dataunit-fetcher-58ad78a7.js → dataunit-fetcher-eab8050e.js} +1 -1
- package/dist/cjs/{form-config-fetcher-761994b9.js → form-config-fetcher-6704319c.js} +66 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-bb0bb679.js → pesquisa-fetcher-84d392c7.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +18 -11
- package/dist/cjs/snk-application.cjs.entry.js +49 -44
- package/dist/cjs/snk-attach.cjs.entry.js +7 -13
- package/dist/cjs/snk-configurator.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +24 -10
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-e89e07bd.js → snk-data-unit-80a00ae4.js} +4 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +13 -12
- package/dist/cjs/snk-entity-list.cjs.entry.js +0 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +13 -16
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -15
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -19
- package/dist/cjs/snk-form-config.cjs.entry.js +6 -17
- package/dist/cjs/snk-form.cjs.entry.js +11 -8
- package/dist/cjs/snk-grid-config.cjs.entry.js +5 -6
- package/dist/cjs/snk-grid.cjs.entry.js +13 -17
- package/dist/cjs/{snk-guides-viewer-eb0a79a4.js → snk-guides-viewer-fd785f55.js} +16 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +13 -16
- package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -3
- 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 +60 -65
- package/dist/collection/components/snk-configurator/snk-configurator.js +19 -1
- package/dist/collection/components/snk-crud/snk-crud.js +18 -6
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +20 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +25 -28
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -4
- 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 +27 -11
- package/dist/collection/components/snk-form/SnkFormConfigManager.js +17 -19
- package/dist/collection/components/snk-form/snk-form.js +24 -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 +27 -12
- 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-taskbar/snk-taskbar.js +19 -1
- package/dist/collection/lib/configs/ConfigStorage.js +33 -44
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +38 -29
- 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/components/ConfigStorage.js +161 -48
- package/dist/components/DataFetcher.js +38 -29
- 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 +23 -9
- package/dist/components/snk-application2.js +134 -128
- package/dist/components/snk-attach2.js +1 -8
- package/dist/components/snk-configurator2.js +3 -1
- package/dist/components/snk-crud.js +22 -6
- package/dist/components/snk-data-unit2.js +5 -3
- package/dist/components/snk-detail-view2.js +18 -8
- package/dist/components/snk-entity-list.js +0 -4
- package/dist/components/snk-filter-bar2.js +11 -11
- 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.js +8 -2
- package/dist/components/snk-grid-config2.js +4 -2
- package/dist/components/snk-grid2.js +11 -12
- package/dist/components/snk-personalized-filter2.js +11 -11
- package/dist/components/snk-simple-crud2.js +5 -1
- package/dist/components/snk-taskbar2.js +3 -1
- package/dist/esm/{ConfigStorage-b6aefe42.js → ConfigStorage-2915a841.js} +162 -49
- package/dist/esm/{DataFetcher-aaaff866.js → DataFetcher-0b121ffb.js} +38 -29
- package/dist/esm/ISave-4412b20c.js +8 -0
- package/dist/esm/ResourceIDUtils-a114189a.js +10 -0
- package/dist/esm/{SnkFormConfigManager-80901f2d.js → SnkFormConfigManager-8005340f.js} +19 -21
- package/dist/esm/{auth-fetcher-7860d777.js → auth-fetcher-643f240e.js} +1 -1
- package/dist/esm/{dataunit-fetcher-9dfcdb1d.js → dataunit-fetcher-6423d6eb.js} +1 -1
- package/dist/esm/{form-config-fetcher-4a34b86a.js → form-config-fetcher-77cdb26c.js} +65 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-01d058e6.js → pesquisa-fetcher-c5a3c564.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +18 -11
- package/dist/esm/snk-application.entry.js +49 -44
- package/dist/esm/snk-attach.entry.js +3 -9
- package/dist/esm/snk-configurator.entry.js +2 -1
- package/dist/esm/snk-crud.entry.js +24 -10
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-8c4d944d.js → snk-data-unit-3ab57d1a.js} +4 -3
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +13 -12
- package/dist/esm/snk-entity-list.entry.js +0 -4
- package/dist/esm/snk-filter-bar.entry.js +13 -16
- package/dist/esm/snk-filter-detail.entry.js +2 -16
- package/dist/esm/snk-filter-modal-item.entry.js +6 -20
- package/dist/esm/snk-form-config.entry.js +7 -18
- package/dist/esm/snk-form.entry.js +11 -8
- package/dist/esm/snk-grid-config.entry.js +5 -6
- package/dist/esm/snk-grid.entry.js +13 -17
- package/dist/esm/{snk-guides-viewer-ee42eb53.js → snk-guides-viewer-43b550a2.js} +16 -7
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +13 -16
- package/dist/esm/snk-print-selector.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +7 -3
- package/dist/esm/snk-taskbar.entry.js +2 -1
- package/dist/sankhyablocks/p-1108ed0e.entry.js +1 -0
- package/dist/sankhyablocks/p-18ead46b.entry.js +1 -0
- package/dist/sankhyablocks/p-1986cfa4.js +26 -0
- package/dist/sankhyablocks/p-1c7b4bad.entry.js +1 -0
- package/dist/sankhyablocks/p-48a40939.js +1 -0
- package/dist/sankhyablocks/p-508822c3.entry.js +1 -0
- package/dist/sankhyablocks/{p-85affa29.js → p-53a7ab6c.js} +1 -1
- package/dist/sankhyablocks/{p-77ecc583.entry.js → p-58b84e45.entry.js} +1 -1
- package/dist/sankhyablocks/p-688dcb4c.js +1 -0
- package/dist/sankhyablocks/{p-05bcad8a.entry.js → p-774afde8.entry.js} +1 -1
- package/dist/sankhyablocks/p-84b9208d.entry.js +1 -0
- package/dist/sankhyablocks/p-85dfb90b.entry.js +1 -0
- package/dist/sankhyablocks/p-86dda34d.js +1 -0
- package/dist/sankhyablocks/p-9a270401.entry.js +1 -0
- package/dist/sankhyablocks/{p-bee6b5d7.js → p-9bfc7124.js} +1 -1
- package/dist/sankhyablocks/p-9d81ad53.entry.js +1 -0
- package/dist/sankhyablocks/p-9e7d65a4.js +1 -0
- package/dist/sankhyablocks/p-a107474c.js +56 -0
- package/dist/sankhyablocks/p-a28470ae.entry.js +1 -0
- package/dist/sankhyablocks/p-b9376677.entry.js +1 -0
- package/dist/sankhyablocks/p-c7c035eb.js +1 -0
- package/dist/sankhyablocks/p-caaef934.js +1 -0
- package/dist/sankhyablocks/p-cf65dbb2.entry.js +1 -0
- package/dist/sankhyablocks/p-d4f9ee17.entry.js +1 -0
- package/dist/sankhyablocks/p-da2422ef.entry.js +11 -0
- package/dist/sankhyablocks/p-e086cc2a.entry.js +1 -0
- package/dist/sankhyablocks/p-ed705cbb.entry.js +1 -0
- package/dist/sankhyablocks/p-f1f5232d.entry.js +1 -0
- package/dist/sankhyablocks/{p-60791bb6.js → p-f88bdc84.js} +1 -1
- package/dist/sankhyablocks/p-fa523d6b.entry.js +1 -0
- package/dist/sankhyablocks/p-fcdd5761.entry.js +1 -0
- package/dist/sankhyablocks/p-fdf6b377.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 +1 -0
- package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +4 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -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 +5 -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 +4 -0
- 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-taskbar/snk-taskbar.d.ts +4 -0
- package/dist/types/components.d.ts +99 -21
- package/dist/types/lib/configs/ConfigStorage.d.ts +11 -13
- 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 +0 -1
- package/dist/types/lib/index.d.ts +11 -0
- package/dist/types/lib/resourceid/ResourceIDUtils.d.ts +3 -0
- package/package.json +1 -1
- package/dist/cjs/filter-bar-config-fetcher-80b033ce.js +0 -155
- package/dist/cjs/resource-fetcher-95d24dff.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-317cb6bf.js +0 -153
- package/dist/esm/resource-fetcher-b36ac145.js +0 -66
- package/dist/sankhyablocks/p-0b64f036.entry.js +0 -1
- package/dist/sankhyablocks/p-0e97ec46.entry.js +0 -1
- package/dist/sankhyablocks/p-1b81c379.entry.js +0 -1
- package/dist/sankhyablocks/p-2dd0f891.js +0 -17
- package/dist/sankhyablocks/p-330f584a.entry.js +0 -1
- package/dist/sankhyablocks/p-35ecafcb.entry.js +0 -1
- package/dist/sankhyablocks/p-42843f0e.js +0 -1
- package/dist/sankhyablocks/p-459d4267.entry.js +0 -1
- package/dist/sankhyablocks/p-557affc8.entry.js +0 -1
- package/dist/sankhyablocks/p-564efc43.js +0 -1
- package/dist/sankhyablocks/p-6295424d.entry.js +0 -1
- package/dist/sankhyablocks/p-64c2cec3.js +0 -1
- package/dist/sankhyablocks/p-803b79d6.js +0 -1
- package/dist/sankhyablocks/p-80729c9b.entry.js +0 -11
- package/dist/sankhyablocks/p-95fa8af6.entry.js +0 -1
- package/dist/sankhyablocks/p-96c1ae78.entry.js +0 -1
- package/dist/sankhyablocks/p-b556fadc.entry.js +0 -1
- package/dist/sankhyablocks/p-befbc9ee.entry.js +0 -1
- package/dist/sankhyablocks/p-bf3bd954.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-dd1fa35d.js +0 -56
- package/dist/sankhyablocks/p-de69b4b0.entry.js +0 -1
- package/dist/sankhyablocks/p-e42f1f2a.js +0 -1
- package/dist/sankhyablocks/p-f24c4bc7.entry.js +0 -1
- package/dist/sankhyablocks/p-f737f7e1.js +0 -10
- package/dist/sankhyablocks/p-fd69eab9.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-317cb6bf.js';
|
5
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-aaaff866.js';
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-77cdb26c.js';
|
2
|
+
import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
|
3
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-0b121ffb.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 };
|
@@ -6709,6 +6709,7 @@ class AppletImpressao {
|
|
6709
6709
|
class DataFetcher {
|
6710
6710
|
constructor() {
|
6711
6711
|
this.GRAPHQL_PATH = "/mgefin-bff/graphql";
|
6712
|
+
this.ready = true;
|
6712
6713
|
this.watingRequestsById = new Map();
|
6713
6714
|
}
|
6714
6715
|
static get() {
|
@@ -6719,6 +6720,9 @@ class DataFetcher {
|
|
6719
6720
|
DataFetcher.instance.resume();
|
6720
6721
|
}
|
6721
6722
|
else {
|
6723
|
+
if (ApplicationContext.getContextValue("__SNK__APPLICATION__LOADING__") === true) {
|
6724
|
+
DataFetcher.instance.pause();
|
6725
|
+
}
|
6722
6726
|
application.addEventListener('applicationLoading', () => DataFetcher.instance.pause());
|
6723
6727
|
application.addEventListener('applicationLoaded', () => DataFetcher.instance.resume());
|
6724
6728
|
}
|
@@ -6777,6 +6781,10 @@ class DataFetcher {
|
|
6777
6781
|
}
|
6778
6782
|
async callGraphQL(req) {
|
6779
6783
|
var _a;
|
6784
|
+
if (this.ready) {
|
6785
|
+
this.pause();
|
6786
|
+
window.requestAnimationFrame(() => this.resume());
|
6787
|
+
}
|
6780
6788
|
const reqKey = this.getReqKey(req);
|
6781
6789
|
req.queryID = reqKey;
|
6782
6790
|
req.values.queryID = reqKey;
|
@@ -6806,7 +6814,7 @@ class DataFetcher {
|
|
6806
6814
|
if (!this.watingRequestsById.has(reqKey)) {
|
6807
6815
|
this.watingRequestsById.set(reqKey, new WaitingRequest(req));
|
6808
6816
|
}
|
6809
|
-
return (_a = this.
|
6817
|
+
return (_a = this.watingRequestsById.get(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
|
6810
6818
|
}
|
6811
6819
|
}
|
6812
6820
|
resolveURL() {
|
@@ -6954,42 +6962,43 @@ class DataFetcher {
|
|
6954
6962
|
getQueryTemplate(re) {
|
6955
6963
|
return (re.query || "").replaceAll("$queryAlias$", re.queryID);
|
6956
6964
|
}
|
6957
|
-
getWatingRequest(reqID) {
|
6958
|
-
return this.watingRequestsById.get(reqID);
|
6959
|
-
}
|
6960
6965
|
pause() {
|
6961
6966
|
this.ready = false;
|
6962
6967
|
}
|
6963
6968
|
async resume() {
|
6964
6969
|
this.ready = true;
|
6965
6970
|
if (this.watingRequestsById.size > 0) {
|
6966
|
-
const
|
6967
|
-
this.watingRequestsById
|
6968
|
-
|
6969
|
-
|
6970
|
-
|
6971
|
-
|
6972
|
-
|
6973
|
-
|
6974
|
-
|
6975
|
-
|
6976
|
-
|
6977
|
-
|
6978
|
-
|
6979
|
-
|
6980
|
-
|
6981
|
-
|
6982
|
-
|
6971
|
+
const waitinRequests = this.watingRequestsById;
|
6972
|
+
this.watingRequestsById = new Map();
|
6973
|
+
this.executePendingRequest(waitinRequests);
|
6974
|
+
}
|
6975
|
+
}
|
6976
|
+
async executePendingRequest(watingRequestsById) {
|
6977
|
+
const requestsBatch = [];
|
6978
|
+
watingRequestsById.forEach(async (waitingReq) => {
|
6979
|
+
let query = this.getQueryTemplate(waitingReq.request);
|
6980
|
+
requestsBatch.push({ document: query, variables: Object.assign({}, waitingReq.request.values) });
|
6981
|
+
});
|
6982
|
+
let res = undefined;
|
6983
|
+
let dataResponse = [];
|
6984
|
+
let errorsResponse = [];
|
6985
|
+
res = await this.fecthGrapql(requestsBatch);
|
6986
|
+
dataResponse = res.data;
|
6987
|
+
errorsResponse = res.errors;
|
6988
|
+
//Reject promises with errors from query
|
6989
|
+
errorsResponse.forEach((errorResponse) => {
|
6990
|
+
Object.entries(errorResponse).forEach(([_key, val]) => {
|
6991
|
+
var _a;
|
6992
|
+
(((_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));
|
6983
6993
|
});
|
6984
|
-
|
6985
|
-
|
6986
|
-
|
6987
|
-
|
6988
|
-
|
6989
|
-
|
6994
|
+
});
|
6995
|
+
//Resolve promises with data from query
|
6996
|
+
dataResponse.forEach((data) => {
|
6997
|
+
Object.entries(data).forEach(([key, val]) => {
|
6998
|
+
var _a;
|
6999
|
+
(((_a = watingRequestsById.get(key)) === null || _a === void 0 ? void 0 : _a.resolve) || Promise.resolve)(val);
|
6990
7000
|
});
|
6991
|
-
|
6992
|
-
}
|
7001
|
+
});
|
6993
7002
|
}
|
6994
7003
|
async fecthGrapql(request) {
|
6995
7004
|
let res = undefined;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
var SaveErrorsEnum;
|
2
|
+
(function (SaveErrorsEnum) {
|
3
|
+
SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
|
4
|
+
SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
|
5
|
+
SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
|
6
|
+
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
7
|
+
|
8
|
+
export { SaveErrorsEnum as S };
|
@@ -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 };
|
@@ -1,31 +1,29 @@
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-2915a841.js';
|
2
2
|
import { ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-77cdb26c.js';
|
4
4
|
|
5
5
|
class SnkFormConfigManager {
|
6
|
-
constructor(configName, onConfigChange) {
|
6
|
+
constructor(configName, resourceID, onConfigChange) {
|
7
|
+
this._resourceID = resourceID;
|
7
8
|
this._configName = configName;
|
8
9
|
this._onConfigChange = onConfigChange;
|
9
10
|
}
|
10
11
|
async loadConfig() {
|
11
12
|
return new Promise(resolve => {
|
12
|
-
ConfigStorage.
|
13
|
-
.then((
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
.catch((error) => {
|
20
|
-
console.warn(error);
|
21
|
-
});
|
13
|
+
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
14
|
+
.then((config) => {
|
15
|
+
this.setConfig(config);
|
16
|
+
resolve(config);
|
17
|
+
})
|
18
|
+
.catch((error) => {
|
19
|
+
console.warn(error);
|
22
20
|
});
|
23
21
|
});
|
24
22
|
}
|
25
23
|
saveConfig(config) {
|
26
24
|
const configToSave = ObjectUtils.copy(config);
|
27
25
|
return new Promise(accept => {
|
28
|
-
ConfigStorage.saveFormConfig(config, this._configName)
|
26
|
+
ConfigStorage.saveFormConfig(config, this._configName, this._resourceID)
|
29
27
|
.then((response) => {
|
30
28
|
this.setConfig(Object.assign(Object.assign({}, configToSave), response));
|
31
29
|
accept(Object.assign(Object.assign({}, configToSave), response));
|
@@ -40,7 +38,7 @@ class SnkFormConfigManager {
|
|
40
38
|
cardsState.set(cardId, propertyChanged === "fixed" ?
|
41
39
|
this.updateFixSequence(Object.assign(Object.assign({}, currentConfig), { fixed: cardConfig.fixed }), cardsState)
|
42
40
|
: Object.assign(Object.assign({}, currentConfig), { [propertyChanged]: cardConfig[propertyChanged] }));
|
43
|
-
ConfigStorage.saveCardState(cardsState, this._configName)
|
41
|
+
ConfigStorage.saveCardState(cardsState, this._configName, this._resourceID)
|
44
42
|
.then(savedCardConfig => {
|
45
43
|
this._config = Object.assign(Object.assign({}, this._config), { cardsState });
|
46
44
|
resolve(savedCardConfig);
|
@@ -116,18 +114,18 @@ class SnkFormConfigManager {
|
|
116
114
|
}
|
117
115
|
return this._formConfigFetcher;
|
118
116
|
}
|
119
|
-
async fetchUserAvailableConfigs(
|
117
|
+
async fetchUserAvailableConfigs() {
|
120
118
|
if (this._configName != undefined) {
|
121
119
|
//FIXME: Precisamos preparar o backend para retornar as configurações disponíveis para details;
|
122
120
|
return Promise.resolve(undefined);
|
123
121
|
}
|
124
|
-
return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName,
|
122
|
+
return this.getFormConfigFetcher().fetchUserAvailableConfigs(this._configName, this._resourceID);
|
125
123
|
}
|
126
|
-
async fetchLegacyConfig(
|
127
|
-
return this.getFormConfigFetcher().fetchLegacyConfig(this._configName,
|
124
|
+
async fetchLegacyConfig() {
|
125
|
+
return this.getFormConfigFetcher().fetchLegacyConfig(this._configName, this._resourceID);
|
128
126
|
}
|
129
|
-
async fetchDefaultConfig(
|
130
|
-
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName,
|
127
|
+
async fetchDefaultConfig() {
|
128
|
+
return this.getFormConfigFetcher().fetchDefaultConfig(this._configName, this._resourceID);
|
131
129
|
}
|
132
130
|
}
|
133
131
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DataUnit, StringUtils, DataType, DataUnitStorage, ChangeOperation } from '@sankhyalabs/core';
|
2
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
2
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-0b121ffb.js';
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
4
4
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
5
5
|
|
@@ -1,6 +1,68 @@
|
|
1
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
1
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-0b121ffb.js';
|
2
2
|
import { ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
|
3
|
+
|
4
|
+
class ResourceFetcher {
|
5
|
+
constructor() {
|
6
|
+
this.templateByQuery = new Map();
|
7
|
+
this.buldTemplates();
|
8
|
+
}
|
9
|
+
buldTemplates() {
|
10
|
+
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
11
|
+
$queryAlias$: fetchResource(name: $name){
|
12
|
+
resource
|
13
|
+
}
|
14
|
+
}`);
|
15
|
+
this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
|
16
|
+
$queryAlias$: saveResource(resource: $resource){
|
17
|
+
name
|
18
|
+
resource
|
19
|
+
}
|
20
|
+
}`);
|
21
|
+
}
|
22
|
+
loadResource(name) {
|
23
|
+
if (ResourceFetcher._loadingResource.has(name)) {
|
24
|
+
return ResourceFetcher._loadingResource.get(name);
|
25
|
+
}
|
26
|
+
const promiseLoadResource = new Promise((resolve, reject) => {
|
27
|
+
DataFetcher.get()
|
28
|
+
.callGraphQL({
|
29
|
+
values: { name },
|
30
|
+
query: this.templateByQuery.get("fetchResource"),
|
31
|
+
})
|
32
|
+
.then((result) => {
|
33
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
34
|
+
ResourceFetcher._loadingResource.delete(name);
|
35
|
+
})
|
36
|
+
.catch((error) => {
|
37
|
+
reject(error);
|
38
|
+
ResourceFetcher._loadingResource.delete(name);
|
39
|
+
});
|
40
|
+
});
|
41
|
+
ResourceFetcher._loadingResource.set(name, promiseLoadResource);
|
42
|
+
return promiseLoadResource;
|
43
|
+
}
|
44
|
+
saveResource(resource, name) {
|
45
|
+
return new Promise((resolve, reject) => {
|
46
|
+
DataFetcher.get()
|
47
|
+
.callGraphQL({
|
48
|
+
values: {
|
49
|
+
resource: {
|
50
|
+
name: name,
|
51
|
+
resource: JSON.stringify(resource)
|
52
|
+
}
|
53
|
+
},
|
54
|
+
query: this.templateByQuery.get("saveResource")
|
55
|
+
})
|
56
|
+
.then((resp) => {
|
57
|
+
resolve(resp);
|
58
|
+
})
|
59
|
+
.catch((error) => {
|
60
|
+
reject(error);
|
61
|
+
});
|
62
|
+
});
|
63
|
+
}
|
64
|
+
}
|
65
|
+
ResourceFetcher._loadingResource = new Map();
|
4
66
|
|
5
67
|
class FormConfigFetcher extends ResourceFetcher {
|
6
68
|
constructor() {
|
@@ -176,4 +238,4 @@ var UserConfigType;
|
|
176
238
|
UserConfigType["SHARED"] = "SHARED";
|
177
239
|
})(UserConfigType || (UserConfigType = {}));
|
178
240
|
|
179
|
-
export { FormConfigFetcher as F, UserConfigType as U };
|
241
|
+
export { FormConfigFetcher as F, ResourceFetcher as R, UserConfigType as U };
|