@sankhyalabs/sankhyablocks 3.3.0 → 3.4.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-8b5e3261.js → ConfigStorage-0a2db8e7.js} +61 -1
- package/dist/cjs/{SnkMessageBuilder-424f02f7.js → SnkMessageBuilder-e6dee2c2.js} +21 -1
- package/dist/cjs/{index-0e663819.js → index-f400b1d6.js} +34 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +12 -12
- package/dist/cjs/snk-configurator_3.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter_8.cjs.entry.js +3 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +3 -2
- package/dist/cjs/snk-filter-param-config.cjs.entry.js +255 -0
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-d7eb170e.js → taskbar-elements-5e87cf44.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +3 -2
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.js +1 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/ISystemFilterConfig.js +1 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IUserFilterConfig.js +1 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.css +12 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +258 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +55 -0
- package/dist/collection/lib/@types/index.js +34 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +49 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +10 -10
- package/dist/collection/lib/http/data-fetcher/interfaces/IClientEventResponse.js +1 -0
- package/dist/collection/lib/http/data-fetcher/recaller/DataFetcherRecaller.js +14 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-filter-param-config.msg.js +18 -0
- package/dist/components/DataFetcher.js +62 -2
- package/dist/components/SnkMessageBuilder.js +21 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/{esm/index-1564817d.js → components/index2.js} +35 -1
- package/dist/components/snk-application2.js +10 -10
- package/dist/components/snk-crud.js +2 -1
- package/dist/components/snk-data-exporter2.js +2 -33
- package/dist/components/snk-exporter-email-sender2.js +3 -2
- package/dist/components/snk-filter-param-config.d.ts +11 -0
- package/dist/components/snk-filter-param-config.js +276 -0
- package/dist/components/snk-form2.js +2 -1
- package/dist/components/snk-grid2.js +2 -1
- package/dist/components/snk-taskbar2.js +2 -1
- package/dist/esm/{ConfigStorage-4654f57b.js → ConfigStorage-f9eaa4bc.js} +62 -2
- package/dist/esm/{SnkMessageBuilder-64821b88.js → SnkMessageBuilder-f0d50bd6.js} +21 -1
- package/dist/esm/index-bd13bdcf.js +67 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +12 -12
- package/dist/esm/snk-configurator_3.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-exporter_8.entry.js +3 -3
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-exporter-email-sender.entry.js +3 -2
- package/dist/esm/snk-filter-param-config.entry.js +251 -0
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +2 -2
- package/dist/esm/{taskbar-elements-dc968d8f.js → taskbar-elements-8400dbe7.js} +1 -1
- package/dist/sankhyablocks/p-22e44b9d.entry.js +1 -0
- package/dist/sankhyablocks/{p-a22a3a7a.entry.js → p-231da738.entry.js} +4 -4
- package/dist/sankhyablocks/{p-554db79e.entry.js → p-24a74ea9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d3fb34cb.js → p-32d02fa4.js} +1 -1
- package/dist/sankhyablocks/{p-6878464e.entry.js → p-445ff0af.entry.js} +1 -1
- package/dist/sankhyablocks/p-69562bcf.js +1 -0
- package/dist/sankhyablocks/{p-71b8562d.entry.js → p-69738f28.entry.js} +1 -1
- package/dist/sankhyablocks/{p-31b3217d.entry.js → p-7f195b37.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d9c43eca.js → p-93c271e2.js} +1 -1
- package/dist/sankhyablocks/{p-afea1284.entry.js → p-943b9c98.entry.js} +1 -1
- package/dist/sankhyablocks/{p-93d8ea09.js → p-a0258616.js} +6 -6
- package/dist/sankhyablocks/{p-125c2d01.entry.js → p-bb445357.entry.js} +1 -1
- package/dist/sankhyablocks/p-c81ced8a.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +13 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/ISystemFilterConfig.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IUserFilterConfig.d.ts +5 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +41 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +15 -0
- package/dist/types/components.d.ts +16 -0
- package/dist/types/lib/@types/index.d.ts +30 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -1
- package/dist/types/lib/http/data-fetcher/interfaces/IClientEventResponse.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/recaller/DataFetcherRecaller.d.ts +7 -0
- package/dist/types/lib/message/resources/snk-filter-param-config.msg.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-5534e08c.js +0 -1
- package/dist/sankhyablocks/p-eb08de68.entry.js +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FilterOperand } from "../../../../../lib/@types";
|
|
2
|
+
export class PersonalizedFilterUtils {
|
|
3
|
+
/**
|
|
4
|
+
* Cria uma expressão de filtro a partir de um IExpressionItem.
|
|
5
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
|
6
|
+
* @returns Retorna a expressão de filtro.
|
|
7
|
+
*/
|
|
8
|
+
static buildFilterExpression(expressionItem) {
|
|
9
|
+
if (expressionItem == undefined) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const value = this.buildVariableParameterValue(expressionItem);
|
|
13
|
+
let expression = expressionItem.expression || "";
|
|
14
|
+
switch (expressionItem.operand) {
|
|
15
|
+
case FilterOperand.IN:
|
|
16
|
+
expression += ` ${expressionItem.operand} (${value})`;
|
|
17
|
+
break;
|
|
18
|
+
case FilterOperand.NULL:
|
|
19
|
+
case FilterOperand.NOT_NULL:
|
|
20
|
+
expression += ` IS ${value}`;
|
|
21
|
+
break;
|
|
22
|
+
case FilterOperand.LIKE:
|
|
23
|
+
expression += ` LIKE '%${value}%'`;
|
|
24
|
+
break;
|
|
25
|
+
case FilterOperand.START_WITH:
|
|
26
|
+
expression += ` LIKE '${value}%'`;
|
|
27
|
+
break;
|
|
28
|
+
case FilterOperand.FINISHED_WITH:
|
|
29
|
+
expression += ` LIKE '%${value}'`;
|
|
30
|
+
break;
|
|
31
|
+
default:
|
|
32
|
+
expression += ` ${expressionItem.operand} ${value}`;
|
|
33
|
+
}
|
|
34
|
+
return expression;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Obtém o valor do parâmetro a partir de um IExpressionItem.
|
|
38
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
|
39
|
+
* @returns Retorna o valor do parâmetro.
|
|
40
|
+
*/
|
|
41
|
+
static buildVariableParameterValue(expressionItem) {
|
|
42
|
+
if (expressionItem == undefined) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (expressionItem.systemConfig != undefined) {
|
|
46
|
+
const systemConfig = expressionItem.systemConfig;
|
|
47
|
+
return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
|
|
48
|
+
}
|
|
49
|
+
if (expressionItem.userConfig != undefined) {
|
|
50
|
+
const userConfig = expressionItem.userConfig;
|
|
51
|
+
return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
|
|
52
|
+
}
|
|
53
|
+
return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -29,3 +29,37 @@ export var DataExporterType;
|
|
|
29
29
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
|
30
30
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
|
31
31
|
})(DataExporterType || (DataExporterType = {}));
|
|
32
|
+
export var FilterConfigType;
|
|
33
|
+
(function (FilterConfigType) {
|
|
34
|
+
FilterConfigType["SYSTEM_CONFIG"] = "S";
|
|
35
|
+
FilterConfigType["USER_CONFIG"] = "E";
|
|
36
|
+
})(FilterConfigType || (FilterConfigType = {}));
|
|
37
|
+
export var FilterUserConfigTypes;
|
|
38
|
+
(function (FilterUserConfigTypes) {
|
|
39
|
+
FilterUserConfigTypes["DATE"] = "D";
|
|
40
|
+
FilterUserConfigTypes["TEXT"] = "S";
|
|
41
|
+
FilterUserConfigTypes["INTEGER"] = "I";
|
|
42
|
+
FilterUserConfigTypes["DECIMAL"] = "F";
|
|
43
|
+
})(FilterUserConfigTypes || (FilterUserConfigTypes = {}));
|
|
44
|
+
export var FilterOperand;
|
|
45
|
+
(function (FilterOperand) {
|
|
46
|
+
FilterOperand["AND"] = "AND";
|
|
47
|
+
FilterOperand["OR"] = "OR";
|
|
48
|
+
FilterOperand["IN"] = "IN";
|
|
49
|
+
FilterOperand["DIFFERENT"] = "<>";
|
|
50
|
+
FilterOperand["LIKE"] = "LIKE";
|
|
51
|
+
FilterOperand["START_WITH"] = "LIKE_START";
|
|
52
|
+
FilterOperand["FINISHED_WITH"] = "LIKE_END";
|
|
53
|
+
FilterOperand["NULL"] = "NULL";
|
|
54
|
+
FilterOperand["NOT_NULL"] = "NOT NULL";
|
|
55
|
+
FilterOperand["EQUAL"] = "=";
|
|
56
|
+
FilterOperand["LARGER"] = ">";
|
|
57
|
+
FilterOperand["LARGER_EQUAL"] = ">=";
|
|
58
|
+
FilterOperand["SMALLER"] = "<";
|
|
59
|
+
FilterOperand["SMALLER_EQUAL"] = "<=";
|
|
60
|
+
})(FilterOperand || (FilterOperand = {}));
|
|
61
|
+
export var FilterEntities;
|
|
62
|
+
(function (FilterEntities) {
|
|
63
|
+
FilterEntities["FIELD"] = "Campo";
|
|
64
|
+
FilterEntities["INSTANCE"] = "Instancia";
|
|
65
|
+
})(FilterEntities || (FilterEntities = {}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ErrorException, WarningException } from '@sankhyalabs/core';
|
|
1
|
+
import { ErrorException, ObjectUtils, WarningException } from '@sankhyalabs/core';
|
|
2
2
|
import { batchRequests } from 'graphql-request';
|
|
3
3
|
import UrlUtils from "../../../lib/utils/urlutils";
|
|
4
4
|
import { StringUtils } from '@sankhyalabs/core';
|
|
5
|
+
import { DataFetcherRecaller } from './recaller/DataFetcherRecaller';
|
|
5
6
|
export class DataFetcher {
|
|
6
7
|
constructor() {
|
|
7
8
|
this.GRAPHQL_PATH = "/mge/graphql";
|
|
@@ -101,14 +102,44 @@ export class DataFetcher {
|
|
|
101
102
|
const url = `${ctx.baseUrl}?serviceName=${name}&counter=21&application=${ctx.appName}&outputType=json&preventTransform=false&mgeSession=${ctx.mgeSession}&resourceID=${ctx.resourceID}&globalID=${ctx.globalID}&allowConcurrentCalls=true`;
|
|
102
103
|
document.cookie = `JSESSIONID=${ctx.mgeSession};`;
|
|
103
104
|
const http = new XMLHttpRequest();
|
|
105
|
+
var payloadJson = {};
|
|
106
|
+
if ('string' == typeof payload) {
|
|
107
|
+
payload = ObjectUtils.stringToObject(payload);
|
|
108
|
+
}
|
|
109
|
+
if (!payload.hasOwnProperty('requestBody')) {
|
|
110
|
+
payloadJson['requestBody'] = payload;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
payloadJson = payload;
|
|
114
|
+
}
|
|
115
|
+
for (let [key] of DataFetcher.clientEventsByID) {
|
|
116
|
+
if (!payloadJson['requestBody'].hasOwnProperty('clientEventList')) {
|
|
117
|
+
payloadJson['requestBody']['clientEventList'] = {
|
|
118
|
+
clientEvent: []
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
|
|
122
|
+
}
|
|
104
123
|
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
|
|
105
124
|
http.open("POST", url, true);
|
|
106
125
|
http.withCredentials = true;
|
|
107
|
-
http.send(
|
|
126
|
+
http.send(ObjectUtils.objectToString(payloadJson));
|
|
108
127
|
http.onreadystatechange = function () {
|
|
109
128
|
if (this.readyState == 4 && this.status == 200) {
|
|
110
129
|
try {
|
|
111
130
|
const jsonResp = JSON.parse(this.responseText);
|
|
131
|
+
if (jsonResp.hasOwnProperty('clientEvents')) {
|
|
132
|
+
jsonResp.clientEvents.forEach(clientEvent => {
|
|
133
|
+
if (DataFetcher.hasClientEvent(clientEvent.id)) {
|
|
134
|
+
var handlers = DataFetcher.clientEventsByID.get(clientEvent.id);
|
|
135
|
+
handlers.forEach(handler => {
|
|
136
|
+
handler({ id: clientEvent.id, content: clientEvent }, new DataFetcherRecaller(serviceName, payloadJson, accept));
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
if (jsonResp.status == 4)
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
112
143
|
if (jsonResp.status == 1) {
|
|
113
144
|
accept(jsonResp.responseBody);
|
|
114
145
|
}
|
|
@@ -231,9 +262,25 @@ export class DataFetcher {
|
|
|
231
262
|
error.index = Number(requestIndex);
|
|
232
263
|
return error;
|
|
233
264
|
}
|
|
265
|
+
static addClientEvent(eventID, handler) {
|
|
266
|
+
let clientEvent = DataFetcher.clientEventsByID.get(eventID);
|
|
267
|
+
if (clientEvent != undefined) {
|
|
268
|
+
clientEvent.push(handler);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
DataFetcher.clientEventsByID.set(eventID, [handler]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
static hasClientEvent(eventID) {
|
|
275
|
+
return DataFetcher.clientEventsByID.has(eventID);
|
|
276
|
+
}
|
|
277
|
+
static removeClientEvent(eventID) {
|
|
278
|
+
return DataFetcher.clientEventsByID.delete(eventID);
|
|
279
|
+
}
|
|
234
280
|
}
|
|
235
281
|
DataFetcher.appTagName = "snk-application";
|
|
236
282
|
DataFetcher.requestListener = [];
|
|
283
|
+
DataFetcher.clientEventsByID = new Map();
|
|
237
284
|
class WaitingRequest {
|
|
238
285
|
constructor(req) {
|
|
239
286
|
this._resolve = () => { };
|
|
@@ -55,19 +55,19 @@ export class PesquisaFetcher {
|
|
|
55
55
|
})
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
+
const options = searchOptions != undefined
|
|
59
|
+
? {
|
|
60
|
+
"pkFieldName": searchOptions.codeFieldName,
|
|
61
|
+
"label": searchOptions.descriptionFieldName,
|
|
62
|
+
"fieldName": searchOptions.codeFieldName,
|
|
63
|
+
"useDescriptionOptions": false,
|
|
64
|
+
"enableRowsCounter": true
|
|
65
|
+
}
|
|
66
|
+
: undefined;
|
|
58
67
|
const reqBody = {
|
|
59
68
|
"serviceName": serviceName,
|
|
60
69
|
"requestBody": {
|
|
61
|
-
"criteria": {
|
|
62
|
-
"entityName": entityName,
|
|
63
|
-
"compacted": false,
|
|
64
|
-
"ignoreEntityCriteria": false,
|
|
65
|
-
"limit": this._defaultPageSize,
|
|
66
|
-
"query": { "$": argument },
|
|
67
|
-
"orderByDesc": false,
|
|
68
|
-
"externalCriteria": externalCriteria,
|
|
69
|
-
"localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity
|
|
70
|
-
},
|
|
70
|
+
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity }, { options }),
|
|
71
71
|
"clientEventList": {
|
|
72
72
|
"clientEvent": []
|
|
73
73
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataFetcher } from "../DataFetcher";
|
|
2
|
+
export class DataFetcherRecaller {
|
|
3
|
+
constructor(serviceName, requestBody, callback) {
|
|
4
|
+
this.serviceName = serviceName;
|
|
5
|
+
this.requestBody = requestBody;
|
|
6
|
+
this.callback = callback;
|
|
7
|
+
}
|
|
8
|
+
reCall(requestBody) {
|
|
9
|
+
if (requestBody) {
|
|
10
|
+
this.requestBody = requestBody;
|
|
11
|
+
}
|
|
12
|
+
DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -8,6 +8,7 @@ import { snkFormMessages, snkFormConfigMessages, snkConfigOptionsMessages, snkFi
|
|
|
8
8
|
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg.js";
|
|
9
9
|
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg.js";
|
|
10
10
|
import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg.js";
|
|
11
|
+
import { snkFilterParamConfigMessages } from "./resources/snk-filter-param-config.msg.js";
|
|
11
12
|
export class SnkMessageBuilder {
|
|
12
13
|
constructor() {
|
|
13
14
|
this._defaults = {
|
|
@@ -25,7 +26,8 @@ export class SnkMessageBuilder {
|
|
|
25
26
|
snkGridConfig: snkGridConfigMessages,
|
|
26
27
|
snkExporter: snkExporterMessages,
|
|
27
28
|
snkDataExporter: snkDataExporterMessages,
|
|
28
|
-
fileViewer: fileViewerMessages
|
|
29
|
+
fileViewer: fileViewerMessages,
|
|
30
|
+
snkFilterParamConfig: snkFilterParamConfigMessages
|
|
29
31
|
};
|
|
30
32
|
this._currentOperation = OperationMap.CLEAN;
|
|
31
33
|
this.loadAppMessages().then((msgs) => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const snkFilterParamConfigMessages = {
|
|
2
|
+
modalTitle: "Configuração de parâmetro variável",
|
|
3
|
+
labelSystemConfig: "Usar definições do sistema",
|
|
4
|
+
labelUserConfig: "Usar definições personalizadas",
|
|
5
|
+
labelInstance: "Categoria",
|
|
6
|
+
labelField: "Campo",
|
|
7
|
+
labelDescription: "Descrição (obrigatório) *",
|
|
8
|
+
labelType: "Tipo (obrigatório) *",
|
|
9
|
+
labelTypeValues: {
|
|
10
|
+
date: "Data",
|
|
11
|
+
text: "Texto",
|
|
12
|
+
integer: "Número Inteiro",
|
|
13
|
+
decimal: "Número com Decimal",
|
|
14
|
+
},
|
|
15
|
+
labelExpression: "Expressão",
|
|
16
|
+
labelCancel: "Cancelar",
|
|
17
|
+
labelSave: "Salvar"
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorException, WarningException, StringUtils } from '@sankhyalabs/core';
|
|
1
|
+
import { ErrorException, WarningException, ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers.js';
|
|
3
3
|
|
|
4
4
|
var browserPonyfill = createCommonjsModule(function (module, exports) {
|
|
@@ -6435,6 +6435,20 @@ class UrlUtils {
|
|
|
6435
6435
|
}
|
|
6436
6436
|
}
|
|
6437
6437
|
|
|
6438
|
+
class DataFetcherRecaller {
|
|
6439
|
+
constructor(serviceName, requestBody, callback) {
|
|
6440
|
+
this.serviceName = serviceName;
|
|
6441
|
+
this.requestBody = requestBody;
|
|
6442
|
+
this.callback = callback;
|
|
6443
|
+
}
|
|
6444
|
+
reCall(requestBody) {
|
|
6445
|
+
if (requestBody) {
|
|
6446
|
+
this.requestBody = requestBody;
|
|
6447
|
+
}
|
|
6448
|
+
DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody);
|
|
6449
|
+
}
|
|
6450
|
+
}
|
|
6451
|
+
|
|
6438
6452
|
class DataFetcher {
|
|
6439
6453
|
constructor() {
|
|
6440
6454
|
this.GRAPHQL_PATH = "/mge/graphql";
|
|
@@ -6534,14 +6548,44 @@ class DataFetcher {
|
|
|
6534
6548
|
const url = `${ctx.baseUrl}?serviceName=${name}&counter=21&application=${ctx.appName}&outputType=json&preventTransform=false&mgeSession=${ctx.mgeSession}&resourceID=${ctx.resourceID}&globalID=${ctx.globalID}&allowConcurrentCalls=true`;
|
|
6535
6549
|
document.cookie = `JSESSIONID=${ctx.mgeSession};`;
|
|
6536
6550
|
const http = new XMLHttpRequest();
|
|
6551
|
+
var payloadJson = {};
|
|
6552
|
+
if ('string' == typeof payload) {
|
|
6553
|
+
payload = ObjectUtils.stringToObject(payload);
|
|
6554
|
+
}
|
|
6555
|
+
if (!payload.hasOwnProperty('requestBody')) {
|
|
6556
|
+
payloadJson['requestBody'] = payload;
|
|
6557
|
+
}
|
|
6558
|
+
else {
|
|
6559
|
+
payloadJson = payload;
|
|
6560
|
+
}
|
|
6561
|
+
for (let [key] of DataFetcher.clientEventsByID) {
|
|
6562
|
+
if (!payloadJson['requestBody'].hasOwnProperty('clientEventList')) {
|
|
6563
|
+
payloadJson['requestBody']['clientEventList'] = {
|
|
6564
|
+
clientEvent: []
|
|
6565
|
+
};
|
|
6566
|
+
}
|
|
6567
|
+
payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
|
|
6568
|
+
}
|
|
6537
6569
|
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload }));
|
|
6538
6570
|
http.open("POST", url, true);
|
|
6539
6571
|
http.withCredentials = true;
|
|
6540
|
-
http.send(
|
|
6572
|
+
http.send(ObjectUtils.objectToString(payloadJson));
|
|
6541
6573
|
http.onreadystatechange = function () {
|
|
6542
6574
|
if (this.readyState == 4 && this.status == 200) {
|
|
6543
6575
|
try {
|
|
6544
6576
|
const jsonResp = JSON.parse(this.responseText);
|
|
6577
|
+
if (jsonResp.hasOwnProperty('clientEvents')) {
|
|
6578
|
+
jsonResp.clientEvents.forEach(clientEvent => {
|
|
6579
|
+
if (DataFetcher.hasClientEvent(clientEvent.id)) {
|
|
6580
|
+
var handlers = DataFetcher.clientEventsByID.get(clientEvent.id);
|
|
6581
|
+
handlers.forEach(handler => {
|
|
6582
|
+
handler({ id: clientEvent.id, content: clientEvent }, new DataFetcherRecaller(serviceName, payloadJson, accept));
|
|
6583
|
+
});
|
|
6584
|
+
}
|
|
6585
|
+
});
|
|
6586
|
+
if (jsonResp.status == 4)
|
|
6587
|
+
return;
|
|
6588
|
+
}
|
|
6545
6589
|
if (jsonResp.status == 1) {
|
|
6546
6590
|
accept(jsonResp.responseBody);
|
|
6547
6591
|
}
|
|
@@ -6664,9 +6708,25 @@ class DataFetcher {
|
|
|
6664
6708
|
error.index = Number(requestIndex);
|
|
6665
6709
|
return error;
|
|
6666
6710
|
}
|
|
6711
|
+
static addClientEvent(eventID, handler) {
|
|
6712
|
+
let clientEvent = DataFetcher.clientEventsByID.get(eventID);
|
|
6713
|
+
if (clientEvent != undefined) {
|
|
6714
|
+
clientEvent.push(handler);
|
|
6715
|
+
}
|
|
6716
|
+
else {
|
|
6717
|
+
DataFetcher.clientEventsByID.set(eventID, [handler]);
|
|
6718
|
+
}
|
|
6719
|
+
}
|
|
6720
|
+
static hasClientEvent(eventID) {
|
|
6721
|
+
return DataFetcher.clientEventsByID.has(eventID);
|
|
6722
|
+
}
|
|
6723
|
+
static removeClientEvent(eventID) {
|
|
6724
|
+
return DataFetcher.clientEventsByID.delete(eventID);
|
|
6725
|
+
}
|
|
6667
6726
|
}
|
|
6668
6727
|
DataFetcher.appTagName = "snk-application";
|
|
6669
6728
|
DataFetcher.requestListener = [];
|
|
6729
|
+
DataFetcher.clientEventsByID = new Map();
|
|
6670
6730
|
class WaitingRequest {
|
|
6671
6731
|
constructor(req) {
|
|
6672
6732
|
this._resolve = () => { };
|
|
@@ -247,6 +247,25 @@ const snkDataExporterMessages = {
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
+
const snkFilterParamConfigMessages = {
|
|
251
|
+
modalTitle: "Configuração de parâmetro variável",
|
|
252
|
+
labelSystemConfig: "Usar definições do sistema",
|
|
253
|
+
labelUserConfig: "Usar definições personalizadas",
|
|
254
|
+
labelInstance: "Categoria",
|
|
255
|
+
labelField: "Campo",
|
|
256
|
+
labelDescription: "Descrição (obrigatório) *",
|
|
257
|
+
labelType: "Tipo (obrigatório) *",
|
|
258
|
+
labelTypeValues: {
|
|
259
|
+
date: "Data",
|
|
260
|
+
text: "Texto",
|
|
261
|
+
integer: "Número Inteiro",
|
|
262
|
+
decimal: "Número com Decimal",
|
|
263
|
+
},
|
|
264
|
+
labelExpression: "Expressão",
|
|
265
|
+
labelCancel: "Cancelar",
|
|
266
|
+
labelSave: "Salvar"
|
|
267
|
+
};
|
|
268
|
+
|
|
250
269
|
class SnkMessageBuilder {
|
|
251
270
|
constructor() {
|
|
252
271
|
this._defaults = {
|
|
@@ -264,7 +283,8 @@ class SnkMessageBuilder {
|
|
|
264
283
|
snkGridConfig: snkGridConfigMessages,
|
|
265
284
|
snkExporter: snkExporterMessages,
|
|
266
285
|
snkDataExporter: snkDataExporterMessages,
|
|
267
|
-
fileViewer: fileViewerMessages
|
|
286
|
+
fileViewer: fileViewerMessages,
|
|
287
|
+
snkFilterParamConfig: snkFilterParamConfigMessages
|
|
268
288
|
};
|
|
269
289
|
this._currentOperation = OperationMap.CLEAN;
|
|
270
290
|
this.loadAppMessages().then((msgs) => {
|
|
@@ -15,6 +15,7 @@ export { SnkFilterList as SnkFilterList } from '../types/components/snk-filter-b
|
|
|
15
15
|
export { SnkFilterModal as SnkFilterModal } from '../types/components/snk-filter-bar/filter-modal/snk-filter-modal';
|
|
16
16
|
export { SnkFilterMultiSelect as SnkFilterMultiSelect } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select';
|
|
17
17
|
export { SnkFilterPeriod as SnkFilterNumber } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-number';
|
|
18
|
+
export { SnkFilterParamConfig as SnkFilterParamConfig } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config';
|
|
18
19
|
export { SnkFilterPeriod as SnkFilterPeriod } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-period';
|
|
19
20
|
export { SnkFilterPersonalized as SnkFilterPersonalized } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized';
|
|
20
21
|
export { SnkFilterSearch as SnkFilterSearch } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-search';
|
package/dist/components/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { SnkFilterList, defineCustomElement as defineCustomElementSnkFilterList
|
|
|
15
15
|
export { SnkFilterModal, defineCustomElement as defineCustomElementSnkFilterModal } from './snk-filter-modal.js';
|
|
16
16
|
export { SnkFilterMultiSelect, defineCustomElement as defineCustomElementSnkFilterMultiSelect } from './snk-filter-multi-select.js';
|
|
17
17
|
export { SnkFilterNumber, defineCustomElement as defineCustomElementSnkFilterNumber } from './snk-filter-number.js';
|
|
18
|
+
export { SnkFilterParamConfig, defineCustomElement as defineCustomElementSnkFilterParamConfig } from './snk-filter-param-config.js';
|
|
18
19
|
export { SnkFilterPeriod, defineCustomElement as defineCustomElementSnkFilterPeriod } from './snk-filter-period.js';
|
|
19
20
|
export { SnkFilterPersonalized, defineCustomElement as defineCustomElementSnkFilterPersonalized } from './snk-filter-personalized.js';
|
|
20
21
|
export { SnkFilterSearch, defineCustomElement as defineCustomElementSnkFilterSearch } from './snk-filter-search.js';
|
|
@@ -29,5 +29,39 @@ var DataExporterType;
|
|
|
29
29
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
|
30
30
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
|
31
31
|
})(DataExporterType || (DataExporterType = {}));
|
|
32
|
+
var FilterConfigType;
|
|
33
|
+
(function (FilterConfigType) {
|
|
34
|
+
FilterConfigType["SYSTEM_CONFIG"] = "S";
|
|
35
|
+
FilterConfigType["USER_CONFIG"] = "E";
|
|
36
|
+
})(FilterConfigType || (FilterConfigType = {}));
|
|
37
|
+
var FilterUserConfigTypes;
|
|
38
|
+
(function (FilterUserConfigTypes) {
|
|
39
|
+
FilterUserConfigTypes["DATE"] = "D";
|
|
40
|
+
FilterUserConfigTypes["TEXT"] = "S";
|
|
41
|
+
FilterUserConfigTypes["INTEGER"] = "I";
|
|
42
|
+
FilterUserConfigTypes["DECIMAL"] = "F";
|
|
43
|
+
})(FilterUserConfigTypes || (FilterUserConfigTypes = {}));
|
|
44
|
+
var FilterOperand;
|
|
45
|
+
(function (FilterOperand) {
|
|
46
|
+
FilterOperand["AND"] = "AND";
|
|
47
|
+
FilterOperand["OR"] = "OR";
|
|
48
|
+
FilterOperand["IN"] = "IN";
|
|
49
|
+
FilterOperand["DIFFERENT"] = "<>";
|
|
50
|
+
FilterOperand["LIKE"] = "LIKE";
|
|
51
|
+
FilterOperand["START_WITH"] = "LIKE_START";
|
|
52
|
+
FilterOperand["FINISHED_WITH"] = "LIKE_END";
|
|
53
|
+
FilterOperand["NULL"] = "NULL";
|
|
54
|
+
FilterOperand["NOT_NULL"] = "NOT NULL";
|
|
55
|
+
FilterOperand["EQUAL"] = "=";
|
|
56
|
+
FilterOperand["LARGER"] = ">";
|
|
57
|
+
FilterOperand["LARGER_EQUAL"] = ">=";
|
|
58
|
+
FilterOperand["SMALLER"] = "<";
|
|
59
|
+
FilterOperand["SMALLER_EQUAL"] = "<=";
|
|
60
|
+
})(FilterOperand || (FilterOperand = {}));
|
|
61
|
+
var FilterEntities;
|
|
62
|
+
(function (FilterEntities) {
|
|
63
|
+
FilterEntities["FIELD"] = "Campo";
|
|
64
|
+
FilterEntities["INSTANCE"] = "Instancia";
|
|
65
|
+
})(FilterEntities || (FilterEntities = {}));
|
|
32
66
|
|
|
33
|
-
export { DataExporterOption as D, PresentationMode as P,
|
|
67
|
+
export { DataExporterOption as D, FilterOperand as F, PresentationMode as P, FilterConfigType as a, FilterEntities as b, FilterUserConfigTypes as c, DataExporterFormat as d, DataExporterType as e };
|
|
@@ -120,19 +120,19 @@ class PesquisaFetcher {
|
|
|
120
120
|
})
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
+
const options = searchOptions != undefined
|
|
124
|
+
? {
|
|
125
|
+
"pkFieldName": searchOptions.codeFieldName,
|
|
126
|
+
"label": searchOptions.descriptionFieldName,
|
|
127
|
+
"fieldName": searchOptions.codeFieldName,
|
|
128
|
+
"useDescriptionOptions": false,
|
|
129
|
+
"enableRowsCounter": true
|
|
130
|
+
}
|
|
131
|
+
: undefined;
|
|
123
132
|
const reqBody = {
|
|
124
133
|
"serviceName": serviceName,
|
|
125
134
|
"requestBody": {
|
|
126
|
-
"criteria": {
|
|
127
|
-
"entityName": entityName,
|
|
128
|
-
"compacted": false,
|
|
129
|
-
"ignoreEntityCriteria": false,
|
|
130
|
-
"limit": this._defaultPageSize,
|
|
131
|
-
"query": { "$": argument },
|
|
132
|
-
"orderByDesc": false,
|
|
133
|
-
"externalCriteria": externalCriteria,
|
|
134
|
-
"localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity
|
|
135
|
-
},
|
|
135
|
+
"criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity }, { options }),
|
|
136
136
|
"clientEventList": {
|
|
137
137
|
"clientEvent": []
|
|
138
138
|
}
|
|
@@ -2,9 +2,10 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { V as VIEW_MODE } from './constants.js';
|
|
4
4
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
5
|
-
import { P as PresentationMode
|
|
5
|
+
import { P as PresentationMode } from './index2.js';
|
|
6
6
|
import { d as defineCustomElement$i } from './snk-config-options2.js';
|
|
7
7
|
import { d as defineCustomElement$h } from './snk-configurator2.js';
|
|
8
|
+
import { d as defineCustomElement$g } from './snk-data-exporter2.js';
|
|
8
9
|
import { d as defineCustomElement$f } from './snk-exporter-email-sender2.js';
|
|
9
10
|
import { d as defineCustomElement$e } from './snk-field-config2.js';
|
|
10
11
|
import { d as defineCustomElement$d } from './snk-filter-bar2.js';
|
|
@@ -1,42 +1,11 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
+
import { D as DataExporterOption, d as DataExporterFormat, e as DataExporterType } from './index2.js';
|
|
4
5
|
import { K as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID } from './constants.js';
|
|
5
6
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
6
7
|
import { d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
|
|
7
8
|
|
|
8
|
-
var PresentationMode;
|
|
9
|
-
(function (PresentationMode) {
|
|
10
|
-
PresentationMode["PRIMARY"] = "primary";
|
|
11
|
-
PresentationMode["SECONDARY"] = "secondary";
|
|
12
|
-
})(PresentationMode || (PresentationMode = {}));
|
|
13
|
-
var DataExporterOption;
|
|
14
|
-
(function (DataExporterOption) {
|
|
15
|
-
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
|
16
|
-
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
|
17
|
-
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
|
18
|
-
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
|
19
|
-
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
|
20
|
-
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
|
21
|
-
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
|
22
|
-
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
|
23
|
-
})(DataExporterOption || (DataExporterOption = {}));
|
|
24
|
-
var DataExporterFormat;
|
|
25
|
-
(function (DataExporterFormat) {
|
|
26
|
-
DataExporterFormat["PDF"] = "exportPDFToEmail";
|
|
27
|
-
DataExporterFormat["XLS"] = "exportXLSToEmail";
|
|
28
|
-
DataExporterFormat["XLSX"] = "exportXLSToEmail";
|
|
29
|
-
})(DataExporterFormat || (DataExporterFormat = {}));
|
|
30
|
-
var DataExporterType;
|
|
31
|
-
(function (DataExporterType) {
|
|
32
|
-
DataExporterType["EXPORT_TO_PDF"] = "PDF";
|
|
33
|
-
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
|
34
|
-
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
|
35
|
-
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
|
36
|
-
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
|
37
|
-
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
|
38
|
-
})(DataExporterType || (DataExporterType = {}));
|
|
39
|
-
|
|
40
9
|
class ItemBuilder {
|
|
41
10
|
constructor(getMessage, selectedNumber) {
|
|
42
11
|
this._selectedNumber = 0;
|
|
@@ -563,4 +532,4 @@ function defineCustomElement() {
|
|
|
563
532
|
} });
|
|
564
533
|
}
|
|
565
534
|
|
|
566
|
-
export {
|
|
535
|
+
export { SnkDataExporter as S, defineCustomElement as d };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
|
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
|
3
4
|
|
|
4
5
|
const EmailInfoStep = ({ getMessage, changeInfo, data }) => {
|
|
5
6
|
const { format, email } = data || {};
|
|
@@ -117,8 +118,8 @@ const SnkExporterEmailSender = /*@__PURE__*/ proxyCustomElement(class extends HT
|
|
|
117
118
|
}
|
|
118
119
|
render() {
|
|
119
120
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkExporterEmailSender');
|
|
120
|
-
return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: evt => {
|
|
121
|
-
if (evt.detail ===
|
|
121
|
+
return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: (evt) => {
|
|
122
|
+
if (evt.detail === ModalAction.CLOSE)
|
|
122
123
|
this.close();
|
|
123
124
|
}, modalTitle: this.getMessage("snkExporter.emailSenderTitle"), modalSubTitle: this.getStepMessage("subTitle") }, h("ez-view-stack", { ref: ref => this._viewStack = ref }, h("stack-item", null, h(OptionsStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateConfigInfo(field, value) })), h("stack-item", null, h(EmailInfoStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateEmailInfo(field, value) }))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-button--tertiary ez-padding-right--medium", label: this.getStepMessage("firstButton"), onClick: () => this.executeButtonAction(true), enabled: this.checkButtonEnabled(true) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("firstButton")}` })), h("ez-button", Object.assign({ class: this.getSecondButtonClass(), label: this.getStepMessage("secondButton"), onClick: () => this.executeButtonAction(false), enabled: this.checkButtonEnabled(false) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("secondButton")}` }))))));
|
|
124
125
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SnkFilterParamConfig extends Components.SnkFilterParamConfig, HTMLElement {}
|
|
4
|
+
export const SnkFilterParamConfig: {
|
|
5
|
+
prototype: SnkFilterParamConfig;
|
|
6
|
+
new (): SnkFilterParamConfig;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|