@sankhyalabs/sankhyablocks 8.15.0-dev.9 → 8.15.0-rc.2
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/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
- package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-e7dcf408.js} +13 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dataunit-fetcher-353e4af2.js → pesquisa-fetcher-e4a7c4c3.js} +215 -26
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_2.cjs.entry.js +5 -4
- package/dist/cjs/snk-application.cjs.entry.js +33 -4
- package/dist/cjs/snk-attach.cjs.entry.js +388 -57
- package/dist/cjs/snk-crud.cjs.entry.js +2 -3
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-82c08a8c.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -5
- package/dist/cjs/snk-filter-bar.cjs.entry.js +25 -3
- package/dist/cjs/snk-filter-item.cjs.entry.js +4 -47
- package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
- package/dist/cjs/{snk-guides-viewer-e60ccc5e.js → snk-guides-viewer-d32c096f.js} +2 -3
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -4
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +17 -6
- package/dist/collection/components/snk-application/snk-application.js +52 -9
- package/dist/collection/components/snk-attach/snk-attach.js +188 -39
- package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
- package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
- package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
- package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
- package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +111 -0
- package/dist/collection/components/snk-attach/structure/index.js +6 -3
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +4 -47
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +19 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +39 -2
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +53 -1
- package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +3 -1
- package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +17 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +29 -22
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +21 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +7 -1
- package/dist/collection/lib/index.js +1 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
- package/dist/components/SnkMessageBuilder.js +13 -0
- package/dist/components/dataunit-fetcher.js +54 -27
- package/dist/components/snk-actions-button2.js +1 -0
- package/dist/components/snk-application2.js +32 -1
- package/dist/components/snk-attach2.js +394 -57
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-filter-bar2.js +26 -3
- package/dist/components/snk-filter-item2.js +4 -47
- package/dist/components/snk-filter-modal.js +4 -2
- package/dist/components/snk-filter-multi-select.js +2 -1
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-simple-crud2.js +15 -1
- package/dist/components/taskbar-actions-button2.js +3 -1
- package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
- package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dataunit-fetcher-0fc935a0.js → pesquisa-fetcher-fa0c2540.js} +215 -27
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_2.entry.js +5 -4
- package/dist/esm/snk-application.entry.js +32 -3
- package/dist/esm/snk-attach.entry.js +389 -58
- package/dist/esm/snk-crud.entry.js +2 -3
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -5
- package/dist/esm/snk-filter-bar.entry.js +25 -3
- package/dist/esm/snk-filter-item.entry.js +4 -47
- package/dist/esm/snk-filter-modal.entry.js +2 -1
- package/dist/esm/snk-filter-multi-select.entry.js +2 -1
- package/dist/esm/{snk-guides-viewer-98a8e45e.js → snk-guides-viewer-f49613c6.js} +2 -3
- package/dist/esm/snk-guides-viewer.entry.js +3 -4
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +15 -4
- package/dist/sankhyablocks/p-02e3a45b.entry.js +1 -0
- package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
- package/dist/sankhyablocks/p-0ec5b2e5.js +1 -0
- package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
- package/dist/sankhyablocks/p-2582537c.entry.js +1 -0
- package/dist/sankhyablocks/p-282789a6.entry.js +1 -0
- package/dist/sankhyablocks/p-3b0e4e08.js +65 -0
- package/dist/sankhyablocks/{p-0874adb5.entry.js → p-40915359.entry.js} +1 -1
- package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
- package/dist/sankhyablocks/p-86801b08.entry.js +1 -0
- package/dist/sankhyablocks/p-96ef14f9.entry.js +1 -0
- package/dist/sankhyablocks/p-9b5944a4.entry.js +1 -0
- package/dist/sankhyablocks/p-9bdbc7d8.entry.js +1 -0
- package/dist/sankhyablocks/{p-90f9b4db.entry.js → p-a52b9254.entry.js} +3 -3
- package/dist/sankhyablocks/p-ac384baf.entry.js +1 -0
- package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
- package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
- package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
- package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +7 -0
- package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
- package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +27 -6
- package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
- package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +31 -0
- package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
- package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
- package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +15 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -2
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -1
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
- package/dist/types/components.d.ts +74 -2
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
- package/dist/types/lib/index.d.ts +1 -1
- package/package.json +5 -5
- package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
- package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
- package/dist/sankhyablocks/p-20726710.entry.js +0 -1
- package/dist/sankhyablocks/p-41560fd8.entry.js +0 -1
- package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
- package/dist/sankhyablocks/p-6678d5d4.entry.js +0 -1
- package/dist/sankhyablocks/p-71439fd9.entry.js +0 -1
- package/dist/sankhyablocks/p-7d8d7fe9.entry.js +0 -1
- package/dist/sankhyablocks/p-a91bb13d.js +0 -1
- package/dist/sankhyablocks/p-a9e5b094.entry.js +0 -1
- package/dist/sankhyablocks/p-abfa8101.entry.js +0 -1
- package/dist/sankhyablocks/p-b3020263.entry.js +0 -1
- package/dist/sankhyablocks/p-bf93a748.js +0 -60
- package/dist/sankhyablocks/p-c6f89389.entry.js +0 -1
- package/dist/sankhyablocks/p-cebae710.entry.js +0 -1
- package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
- /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
- /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
- /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
@@ -6,30 +6,39 @@ export class DatasetStrategy {
|
|
6
6
|
canSlice() {
|
7
7
|
return false;
|
8
8
|
}
|
9
|
+
processSortingSide(request, dataUnit, serverSideFilters) {
|
10
|
+
const localSorting = [];
|
11
|
+
const serverSorting = [];
|
12
|
+
if (request.sort != undefined) {
|
13
|
+
if (serverSideFilters.length === 0) {
|
14
|
+
return { localSorting: request.sort, serverSorting: [] };
|
15
|
+
}
|
16
|
+
for (const sort of request.sort) {
|
17
|
+
const descriptor = dataUnit.getField(sort.field);
|
18
|
+
const local = descriptor != undefined
|
19
|
+
&& descriptor.properties != undefined
|
20
|
+
&& descriptor.properties.calculated === "true";
|
21
|
+
if (local) {
|
22
|
+
localSorting.push(sort);
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
serverSorting.push(sort);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
return { localSorting, serverSorting };
|
30
|
+
}
|
9
31
|
async load(dataUnit, request, loadingInfo) {
|
32
|
+
var _a, _b;
|
10
33
|
if (dataUnit.metadata == undefined) {
|
11
34
|
return Promise.resolve({ records: [], loadingInfo });
|
12
35
|
}
|
13
36
|
try {
|
14
|
-
const
|
15
|
-
const serverSorting =
|
16
|
-
if (request.sort != undefined) {
|
17
|
-
for (const sort of request.sort) {
|
18
|
-
const descriptor = dataUnit.getField(sort.field);
|
19
|
-
const local = descriptor != undefined
|
20
|
-
&& descriptor.properties != undefined
|
21
|
-
&& descriptor.properties.calculated === "true";
|
22
|
-
if (local) {
|
23
|
-
localSorting.push(sort);
|
24
|
-
}
|
25
|
-
else {
|
26
|
-
serverSorting.push(sort);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
37
|
+
const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
|
38
|
+
const { localSorting, serverSorting } = this.processSortingSide(request, dataUnit, serverSideFilters);
|
30
39
|
const fields = this.getFieldsList(dataUnit);
|
31
40
|
const serviceName = "DatasetSP.loadRecords";
|
32
|
-
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting);
|
41
|
+
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
|
33
42
|
const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
|
34
43
|
const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
|
35
44
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
@@ -73,7 +82,7 @@ export class DatasetStrategy {
|
|
73
82
|
}
|
74
83
|
return [descriptor.name, descriptionField];
|
75
84
|
}
|
76
|
-
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting) {
|
85
|
+
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting, serverSideFilters) {
|
77
86
|
const dataSetID = dataUnit.dataUnitId;
|
78
87
|
const dataUnitName = dataUnit.name;
|
79
88
|
const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
|
@@ -92,7 +101,7 @@ export class DatasetStrategy {
|
|
92
101
|
tryJoinedFields: true,
|
93
102
|
parallelLoader: useParallelLoader,
|
94
103
|
crudListener: `br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,
|
95
|
-
txProperties: this.getTxProperties(dataUnit, request, sorting),
|
104
|
+
txProperties: this.getTxProperties(dataUnit, request, sorting, serverSideFilters),
|
96
105
|
useDefaultRowsLimit: false
|
97
106
|
}
|
98
107
|
};
|
@@ -103,12 +112,10 @@ export class DatasetStrategy {
|
|
103
112
|
const moduleName = app.getModuleName();
|
104
113
|
return moduleName.replace("-bff", "");
|
105
114
|
}
|
106
|
-
getTxProperties(dataUnit, request, sorting) {
|
107
|
-
var _a, _b;
|
115
|
+
getTxProperties(dataUnit, request, sorting, serverSideFilters) {
|
108
116
|
const txProperties = {
|
109
117
|
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnit.name
|
110
118
|
};
|
111
|
-
const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
|
112
119
|
if (serverSideFilters.length !== 0) {
|
113
120
|
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
114
121
|
}
|
@@ -3,7 +3,22 @@ import { DateUtils, StringUtils, ObjectUtils } from "@sankhyalabs/core";
|
|
3
3
|
import { DataFetcher } from "../DataFetcher";
|
4
4
|
export default class ParametersFetcher {
|
5
5
|
constructor() {
|
6
|
+
this._embeddedParams = new Map();
|
6
7
|
this.templateByQuery = new Map();
|
8
|
+
try {
|
9
|
+
if (window["MGE_PARAMS"] != undefined) {
|
10
|
+
const source = atob(window['MGE_PARAMS']);
|
11
|
+
const params = source.split('__;__');
|
12
|
+
params.forEach(param => {
|
13
|
+
const [key, value] = param.split("__=__");
|
14
|
+
this._embeddedParams.set(key, value);
|
15
|
+
});
|
16
|
+
}
|
17
|
+
}
|
18
|
+
catch (error) {
|
19
|
+
console.error("Problemas ao obter parâmetros embarcados");
|
20
|
+
console.error(error);
|
21
|
+
}
|
7
22
|
this.buldTemplates();
|
8
23
|
}
|
9
24
|
buldTemplates() {
|
@@ -15,6 +30,9 @@ export default class ParametersFetcher {
|
|
15
30
|
}`);
|
16
31
|
}
|
17
32
|
async getParam(name) {
|
33
|
+
if (this._embeddedParams.has(name)) {
|
34
|
+
return Promise.resolve(this._embeddedParams.get(name));
|
35
|
+
}
|
18
36
|
const completPath = `param://application?params=${name}`;
|
19
37
|
return DataFetcher.get().callGraphQL({
|
20
38
|
values: { name: completPath },
|
@@ -52,6 +70,9 @@ export default class ParametersFetcher {
|
|
52
70
|
if (Array.isArray(obj) && obj.length > 0) {
|
53
71
|
obj = obj[0];
|
54
72
|
}
|
73
|
+
if (typeof obj === "string") {
|
74
|
+
return obj;
|
75
|
+
}
|
55
76
|
if (StringUtils.isEmpty(obj.resource))
|
56
77
|
return "";
|
57
78
|
try {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType } from "@sankhyalabs/core";
|
1
|
+
import { ApplicationContext, DataType } from "@sankhyalabs/core";
|
2
2
|
import { gql } from "graphql-request";
|
3
3
|
import { DataFetcher } from "../DataFetcher";
|
4
4
|
export class PesquisaFetcher {
|
@@ -67,6 +67,12 @@ export class PesquisaFetcher {
|
|
67
67
|
externalCriteria.params = {
|
68
68
|
param: values.criteria.params.map(param => {
|
69
69
|
let value = param.value;
|
70
|
+
if (typeof value === "string") {
|
71
|
+
const match = /CTX\{([^}]+)\}/.exec(value);
|
72
|
+
if (match) {
|
73
|
+
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
74
|
+
}
|
75
|
+
}
|
70
76
|
let type = param.dataType;
|
71
77
|
if (type === DataType.OBJECT) {
|
72
78
|
value = value.value;
|
@@ -4,7 +4,7 @@ export { CrudUtils } from './utils/CrudUtils';
|
|
4
4
|
export { PresentationMode } from "./@types";
|
5
5
|
export { TotalsFetcher } from './http/data-fetcher/fetchers/totals-fetcher';
|
6
6
|
export { default as ApplicationConfigFetcher } from './http/data-fetcher/fetchers/application-config-fetcher';
|
7
|
-
export { AttachFetcher } from './http/data-fetcher/fetchers/
|
7
|
+
export { AttachFetcher, AnexoSistemaFetcher } from './http/data-fetcher/fetchers/AttachFetcher';
|
8
8
|
export { default as DataUnitFetcher } from './http/data-fetcher/fetchers/data-unit/dataunit-fetcher';
|
9
9
|
export { default as FilterBarConfigFetcher } from './http/data-fetcher/fetchers/filter-bar-config-fetcher';
|
10
10
|
export { FormConfigFetcher } from './http/data-fetcher/fetchers/form-config-fetcher';
|
@@ -17,11 +17,24 @@ export const snkAttachMessages = {
|
|
17
17
|
anyLinkOrFileFilled: {
|
18
18
|
title: "Atenção",
|
19
19
|
message: `É necessário preencher o campo "Link" ou anexar um arquivo.`
|
20
|
+
},
|
21
|
+
descriptionCannotBeChanged: {
|
22
|
+
title: "Atenção",
|
23
|
+
message: "O campo 'Descrição' não pode ser alterado."
|
20
24
|
}
|
21
25
|
},
|
22
26
|
taskbar: {
|
23
27
|
titleDownload: "Fazer download",
|
24
28
|
titleLink: "Abrir link",
|
29
|
+
},
|
30
|
+
attachMetadata: {
|
31
|
+
lblCode: "Código",
|
32
|
+
lblDescription: "Descrição",
|
33
|
+
lblFileOrLink: "Arquivo / Link",
|
34
|
+
lblUser: "Usuário",
|
35
|
+
lblDate: "Data de alteração",
|
36
|
+
lblFile: "Arquivo",
|
37
|
+
lblSubTitle: "Clique para selecionar um arquivo",
|
25
38
|
}
|
26
39
|
};
|
27
40
|
export default snkAttachMessages;
|
@@ -351,11 +351,24 @@ const snkAttachMessages = {
|
|
351
351
|
anyLinkOrFileFilled: {
|
352
352
|
title: "Atenção",
|
353
353
|
message: `É necessário preencher o campo "Link" ou anexar um arquivo.`
|
354
|
+
},
|
355
|
+
descriptionCannotBeChanged: {
|
356
|
+
title: "Atenção",
|
357
|
+
message: "O campo 'Descrição' não pode ser alterado."
|
354
358
|
}
|
355
359
|
},
|
356
360
|
taskbar: {
|
357
361
|
titleDownload: "Fazer download",
|
358
362
|
titleLink: "Abrir link",
|
363
|
+
},
|
364
|
+
attachMetadata: {
|
365
|
+
lblCode: "Código",
|
366
|
+
lblDescription: "Descrição",
|
367
|
+
lblFileOrLink: "Arquivo / Link",
|
368
|
+
lblUser: "Usuário",
|
369
|
+
lblDate: "Data de alteração",
|
370
|
+
lblFile: "Arquivo",
|
371
|
+
lblSubTitle: "Clique para selecionar um arquivo",
|
359
372
|
}
|
360
373
|
};
|
361
374
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { DataType, FieldComparator, SortMode, DataUnit, DateUtils, StringUtils, ChangeOperation,
|
1
|
+
import { DataType, ApplicationContext, FieldComparator, SortMode, DataUnit, DateUtils, StringUtils, ChangeOperation, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
2
2
|
import { d as dist, D as DataFetcher } from './DataFetcher.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';
|
@@ -71,6 +71,12 @@ class PesquisaFetcher {
|
|
71
71
|
externalCriteria.params = {
|
72
72
|
param: values.criteria.params.map(param => {
|
73
73
|
let value = param.value;
|
74
|
+
if (typeof value === "string") {
|
75
|
+
const match = /CTX\{([^}]+)\}/.exec(value);
|
76
|
+
if (match) {
|
77
|
+
value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
|
78
|
+
}
|
79
|
+
}
|
74
80
|
let type = param.dataType;
|
75
81
|
if (type === DataType.OBJECT) {
|
76
82
|
value = value.value;
|
@@ -396,7 +402,7 @@ class InMemoryLoader {
|
|
396
402
|
this.dataUnit.loadMetadata().then(() => this.dataUnit.loadData());
|
397
403
|
}
|
398
404
|
getRecordsToLoad() {
|
399
|
-
if (this._initialRecords == undefined
|
405
|
+
if (this._initialRecords == undefined || this.dataUnit.records.length > 0) {
|
400
406
|
this._initialRecords = this.dataUnit.records;
|
401
407
|
}
|
402
408
|
return this._initialRecords;
|
@@ -531,30 +537,39 @@ class DatasetStrategy {
|
|
531
537
|
canSlice() {
|
532
538
|
return false;
|
533
539
|
}
|
540
|
+
processSortingSide(request, dataUnit, serverSideFilters) {
|
541
|
+
const localSorting = [];
|
542
|
+
const serverSorting = [];
|
543
|
+
if (request.sort != undefined) {
|
544
|
+
if (serverSideFilters.length === 0) {
|
545
|
+
return { localSorting: request.sort, serverSorting: [] };
|
546
|
+
}
|
547
|
+
for (const sort of request.sort) {
|
548
|
+
const descriptor = dataUnit.getField(sort.field);
|
549
|
+
const local = descriptor != undefined
|
550
|
+
&& descriptor.properties != undefined
|
551
|
+
&& descriptor.properties.calculated === "true";
|
552
|
+
if (local) {
|
553
|
+
localSorting.push(sort);
|
554
|
+
}
|
555
|
+
else {
|
556
|
+
serverSorting.push(sort);
|
557
|
+
}
|
558
|
+
}
|
559
|
+
}
|
560
|
+
return { localSorting, serverSorting };
|
561
|
+
}
|
534
562
|
async load(dataUnit, request, loadingInfo) {
|
563
|
+
var _a, _b;
|
535
564
|
if (dataUnit.metadata == undefined) {
|
536
565
|
return Promise.resolve({ records: [], loadingInfo });
|
537
566
|
}
|
538
567
|
try {
|
539
|
-
const
|
540
|
-
const serverSorting =
|
541
|
-
if (request.sort != undefined) {
|
542
|
-
for (const sort of request.sort) {
|
543
|
-
const descriptor = dataUnit.getField(sort.field);
|
544
|
-
const local = descriptor != undefined
|
545
|
-
&& descriptor.properties != undefined
|
546
|
-
&& descriptor.properties.calculated === "true";
|
547
|
-
if (local) {
|
548
|
-
localSorting.push(sort);
|
549
|
-
}
|
550
|
-
else {
|
551
|
-
serverSorting.push(sort);
|
552
|
-
}
|
553
|
-
}
|
554
|
-
}
|
568
|
+
const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
|
569
|
+
const { localSorting, serverSorting } = this.processSortingSide(request, dataUnit, serverSideFilters);
|
555
570
|
const fields = this.getFieldsList(dataUnit);
|
556
571
|
const serviceName = "DatasetSP.loadRecords";
|
557
|
-
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting);
|
572
|
+
const requestBody = this.buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, serverSorting, serverSideFilters);
|
558
573
|
const params = loadingInfo.quiet ? { urlParams: { quietMode: "true" } } : undefined;
|
559
574
|
const { result: responseRecords, pagerID: pagerId } = await DataFetcher.get().callServiceBroker(serviceName, requestBody, params);
|
560
575
|
const records = this.processRecords(dataUnit, fields, responseRecords);
|
@@ -598,7 +613,7 @@ class DatasetStrategy {
|
|
598
613
|
}
|
599
614
|
return [descriptor.name, descriptionField];
|
600
615
|
}
|
601
|
-
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting) {
|
616
|
+
buildRequestBody(serviceName, fields, dataUnit, request, loadingInfo, sorting, serverSideFilters) {
|
602
617
|
const dataSetID = dataUnit.dataUnitId;
|
603
618
|
const dataUnitName = dataUnit.name;
|
604
619
|
const entityName = DataUnitFetcher.parseDataUnitName(dataUnitName).entityName;
|
@@ -617,7 +632,7 @@ class DatasetStrategy {
|
|
617
632
|
tryJoinedFields: true,
|
618
633
|
parallelLoader: useParallelLoader,
|
619
634
|
crudListener: `br.com.sankhya.bff.${this.getModuleName()}.BFFDataUnitDatasetAdapter`,
|
620
|
-
txProperties: this.getTxProperties(dataUnit, request, sorting),
|
635
|
+
txProperties: this.getTxProperties(dataUnit, request, sorting, serverSideFilters),
|
621
636
|
useDefaultRowsLimit: false
|
622
637
|
}
|
623
638
|
};
|
@@ -628,12 +643,10 @@ class DatasetStrategy {
|
|
628
643
|
const moduleName = app.getModuleName();
|
629
644
|
return moduleName.replace("-bff", "");
|
630
645
|
}
|
631
|
-
getTxProperties(dataUnit, request, sorting) {
|
632
|
-
var _a, _b;
|
646
|
+
getTxProperties(dataUnit, request, sorting, serverSideFilters) {
|
633
647
|
const txProperties = {
|
634
648
|
"__DATA_UNIT_ADAPTER__[dataUnitName]": dataUnit.name
|
635
649
|
};
|
636
|
-
const serverSideFilters = (_b = (_a = request.filters) === null || _a === void 0 ? void 0 : _a.filter(filter => !filter.name.startsWith("FILTRO_COLUNA_"))) !== null && _b !== void 0 ? _b : [];
|
637
650
|
if (serverSideFilters.length !== 0) {
|
638
651
|
txProperties["__DATA_UNIT_ADAPTER__[criteria]"] = JSON.stringify(serverSideFilters);
|
639
652
|
}
|
@@ -992,15 +1005,29 @@ class DataUnitFetcher {
|
|
992
1005
|
});
|
993
1006
|
return updatingFields;
|
994
1007
|
}
|
1008
|
+
getUpdatingFields(dataUnit, originalUpdatingFields) {
|
1009
|
+
if (originalUpdatingFields == undefined) {
|
1010
|
+
return;
|
1011
|
+
}
|
1012
|
+
const updatingFields = Object.assign({}, originalUpdatingFields);
|
1013
|
+
Object.keys(updatingFields).forEach(key => {
|
1014
|
+
const descriptor = dataUnit.getField(key);
|
1015
|
+
if (descriptor != undefined && descriptor.standAlone) {
|
1016
|
+
delete updatingFields[key];
|
1017
|
+
}
|
1018
|
+
});
|
1019
|
+
return this.addTransientProperties(dataUnit, updatingFields);
|
1020
|
+
}
|
995
1021
|
saveData(dataUnit, duChanges) {
|
996
1022
|
const updatedRecordsIds = [];
|
997
1023
|
const addedRecordsIds = [];
|
998
1024
|
const changes = duChanges.map((change) => {
|
999
|
-
const { dataUnit: changeDU, record,
|
1025
|
+
const { dataUnit: changeDU, record, operation } = change;
|
1000
1026
|
const dataUnitInstance = DataUnitStorage.get(changeDU);
|
1027
|
+
const updatingFields = this.getUpdatingFields(dataUnitInstance, change.updatingFields);
|
1001
1028
|
let parsedUpdatingFields;
|
1002
|
-
if (updatingFields) {
|
1003
|
-
parsedUpdatingFields = Object.entries(
|
1029
|
+
if (updatingFields != undefined) {
|
1030
|
+
parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
|
1004
1031
|
const descriptor = dataUnitInstance.getField(fieldName);
|
1005
1032
|
const dataType = descriptor ? descriptor.dataType : DataType.TEXT;
|
1006
1033
|
return { fieldName, dataType, value: dataUnitInstance.valueToString(fieldName, value) };
|
@@ -163,6 +163,7 @@ var SaveErrorsEnum;
|
|
163
163
|
SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
|
164
164
|
SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
|
165
165
|
SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
|
166
|
+
SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
|
166
167
|
})(SaveErrorsEnum || (SaveErrorsEnum = {}));
|
167
168
|
|
168
169
|
const MASTER_ROW_PROPERTY = "__MASTER_ROW__";
|
@@ -72,7 +72,22 @@ class TotalsFetcher {
|
|
72
72
|
|
73
73
|
class ParametersFetcher {
|
74
74
|
constructor() {
|
75
|
+
this._embeddedParams = new Map();
|
75
76
|
this.templateByQuery = new Map();
|
77
|
+
try {
|
78
|
+
if (window["MGE_PARAMS"] != undefined) {
|
79
|
+
const source = atob(window['MGE_PARAMS']);
|
80
|
+
const params = source.split('__;__');
|
81
|
+
params.forEach(param => {
|
82
|
+
const [key, value] = param.split("__=__");
|
83
|
+
this._embeddedParams.set(key, value);
|
84
|
+
});
|
85
|
+
}
|
86
|
+
}
|
87
|
+
catch (error) {
|
88
|
+
console.error("Problemas ao obter parâmetros embarcados");
|
89
|
+
console.error(error);
|
90
|
+
}
|
76
91
|
this.buldTemplates();
|
77
92
|
}
|
78
93
|
buldTemplates() {
|
@@ -84,6 +99,9 @@ class ParametersFetcher {
|
|
84
99
|
}`);
|
85
100
|
}
|
86
101
|
async getParam(name) {
|
102
|
+
if (this._embeddedParams.has(name)) {
|
103
|
+
return Promise.resolve(this._embeddedParams.get(name));
|
104
|
+
}
|
87
105
|
const completPath = `param://application?params=${name}`;
|
88
106
|
return DataFetcher.get().callGraphQL({
|
89
107
|
values: { name: completPath },
|
@@ -121,6 +139,9 @@ class ParametersFetcher {
|
|
121
139
|
if (Array.isArray(obj) && obj.length > 0) {
|
122
140
|
obj = obj[0];
|
123
141
|
}
|
142
|
+
if (typeof obj === "string") {
|
143
|
+
return obj;
|
144
|
+
}
|
124
145
|
if (StringUtils.isEmpty(obj.resource))
|
125
146
|
return "";
|
126
147
|
try {
|
@@ -993,6 +1014,15 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
993
1014
|
this._waitingAppReady.push(() => resolve(this));
|
994
1015
|
});
|
995
1016
|
}
|
1017
|
+
/**
|
1018
|
+
* Atribui valor para parâmetros de contexto no componente de pesquisa.
|
1019
|
+
*
|
1020
|
+
* @param name - Nome do parâmetro
|
1021
|
+
* @param value - String conversível de acordo com o tipo do parâmetro
|
1022
|
+
*/
|
1023
|
+
async setSearchFilterContext(name, value) {
|
1024
|
+
ApplicationContext.setContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${name})__`, value);
|
1025
|
+
}
|
996
1026
|
clearContent(container) {
|
997
1027
|
if (container) {
|
998
1028
|
Array.from(container.children).forEach(child => {
|
@@ -1260,7 +1290,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1260
1290
|
"getApplicationPath": [64],
|
1261
1291
|
"executeSelectDistinct": [64],
|
1262
1292
|
"getDataFetcher": [64],
|
1263
|
-
"whenApplicationReady": [64]
|
1293
|
+
"whenApplicationReady": [64],
|
1294
|
+
"setSearchFilterContext": [64]
|
1264
1295
|
}]);
|
1265
1296
|
class RequestListenerLoadingBar {
|
1266
1297
|
constructor() {
|