@sankhyalabs/sankhyablocks 2.11.1 → 2.12.0
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/{SnkMessageBuilder-248b5105.js → SnkMessageBuilder-b1e5ee65.js} +1 -0
- package/dist/cjs/{constants-a47a5190.js → constants-0069b951.js} +14 -0
- package/dist/cjs/index-0e663819.js +33 -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 +48 -27
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator_3.cjs.entry.js +41 -10
- package/dist/cjs/snk-crud.cjs.entry.js +4 -8
- package/dist/cjs/snk-data-exporter_8.cjs.entry.js +182 -138
- package/dist/cjs/snk-data-unit.cjs.entry.js +6 -6
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/{taskbar-elements-89bf9399.js → taskbar-elements-fec33533.js} +1 -1
- package/dist/collection/components/snk-application/snk-application.js +60 -10
- package/dist/collection/components/snk-crud/snk-crud.js +1 -23
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.css +5 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +54 -18
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +1 -1
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +5 -5
- package/dist/collection/components/snk-grid/snk-grid.js +39 -26
- package/dist/collection/lib/@types/index.js +26 -0
- package/dist/collection/lib/applet-caller/applet-caller.js +6 -0
- package/dist/collection/lib/applet-caller/interfaces/IAppletCallerParams.js +1 -0
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +1 -0
- package/dist/collection/lib/utils/constants.js +12 -0
- package/dist/collection/lib/utils/fileViewer/index.js +24 -2
- package/dist/collection/lib/workspace/workspace.js +11 -0
- package/dist/components/SnkMessageBuilder.js +1 -0
- package/dist/components/constants.js +13 -1
- package/dist/components/snk-application2.js +48 -26
- package/dist/components/snk-crud.js +3 -8
- package/dist/components/snk-data-exporter2.js +130 -53
- package/dist/components/snk-data-unit.js +5 -5
- package/dist/components/snk-form2.js +2 -2
- package/dist/components/snk-grid2.js +41 -11
- package/dist/components/snk-tab-config2.js +1 -1
- package/dist/components/snk-taskbar2.js +2 -8
- package/dist/esm/{SnkMessageBuilder-4a060599.js → SnkMessageBuilder-608c038f.js} +1 -0
- package/dist/esm/{constants-babe1a08.js → constants-8ad13317.js} +13 -1
- package/dist/esm/index-1564817d.js +33 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +48 -27
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/snk-configurator_3.entry.js +41 -10
- package/dist/esm/snk-crud.entry.js +4 -8
- package/dist/esm/snk-data-exporter_8.entry.js +111 -67
- package/dist/esm/snk-data-unit.entry.js +6 -6
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/{taskbar-elements-c8966343.js → taskbar-elements-e4006db7.js} +1 -1
- package/dist/sankhyablocks/{p-a65d6ba3.entry.js → p-223d1bd9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4c759619.entry.js → p-392d3c18.entry.js} +1 -1
- package/dist/sankhyablocks/p-5534e08c.js +1 -0
- package/dist/sankhyablocks/p-6671b0e1.entry.js +1 -0
- package/dist/sankhyablocks/{p-9b858e3a.entry.js → p-7ba9d7c7.entry.js} +1 -1
- package/dist/sankhyablocks/p-847d06a3.entry.js +1 -0
- package/dist/sankhyablocks/p-ad2026bb.js +1 -0
- package/dist/sankhyablocks/{p-420d07c4.js → p-b03ff65b.js} +1 -1
- package/dist/sankhyablocks/p-b7a379bf.entry.js +83 -0
- package/dist/sankhyablocks/{p-f624979d.js → p-c422cbd2.js} +1 -1
- package/dist/sankhyablocks/p-c613957d.entry.js +1 -0
- package/dist/sankhyablocks/{p-4a5c1d36.entry.js → p-e24e488b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cd19bd29.entry.js → p-f6f71be7.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +9 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +2 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +2 -1
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +1 -1
- package/dist/types/components.d.ts +7 -16
- package/dist/types/lib/@types/index.d.ts +23 -0
- package/dist/types/lib/applet-caller/applet-caller.d.ts +4 -0
- package/dist/types/lib/applet-caller/interfaces/IAppletCallerParams.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterResponse.d.ts +5 -4
- package/dist/types/lib/utils/constants.d.ts +12 -0
- package/dist/types/lib/utils/fileViewer/index.d.ts +2 -2
- package/dist/types/lib/workspace/workspace.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/index-9c584423.js +0 -7
- package/dist/collection/components/snk-data-exporter/enum/data-exporter-option.js +0 -11
- package/dist/esm/index-de5f37a6.js +0 -7
- package/dist/sankhyablocks/p-014615a3.entry.js +0 -83
- package/dist/sankhyablocks/p-01c361bb.entry.js +0 -1
- package/dist/sankhyablocks/p-05fadb77.js +0 -1
- package/dist/sankhyablocks/p-3ee68d78.entry.js +0 -1
- package/dist/sankhyablocks/p-6673c77c.js +0 -1
- package/dist/sankhyablocks/p-c32cfc29.entry.js +0 -1
- package/dist/types/components/snk-data-exporter/enum/data-exporter-option.d.ts +0 -10
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
2
|
+
import { KEY_PORT_EXPORT, WEB_CONNECTION } from '../constants.js';
|
|
3
|
+
export default function fileViewer({ fileSessionKey, canPrint, canExport, useAppPrint, isDownload }) {
|
|
4
|
+
if (useAppPrint && !isDownload) {
|
|
5
|
+
webConnection(fileSessionKey, canPrint, canExport);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${fileSessionKey}${isDownload ? "&download=S" : ""}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function webConnection(fileSessionKey, canPrint, canExport) {
|
|
12
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
13
|
+
if (application == undefined) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const keyPort = KEY_PORT_EXPORT;
|
|
17
|
+
const methodName = WEB_CONNECTION.methods.PDF_VIEWER;
|
|
18
|
+
const params = {
|
|
19
|
+
chaveArquivo: fileSessionKey,
|
|
20
|
+
permiteImprimir: canPrint ? "S" : "N",
|
|
21
|
+
permiteExportar: canExport ? "S" : "N",
|
|
22
|
+
contentType: "S"
|
|
23
|
+
};
|
|
24
|
+
application.webConnection(keyPort, methodName, params);
|
|
3
25
|
}
|
|
@@ -4,5 +4,16 @@ export default class Workspace {
|
|
|
4
4
|
var _a;
|
|
5
5
|
(_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
|
|
6
6
|
}
|
|
7
|
+
static getAppLabel(resourceID) {
|
|
8
|
+
if ((window === null || window === void 0 ? void 0 : window["workspace"]) == undefined) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (window["workspace"].getAppLabel == undefined) {
|
|
12
|
+
window["workspace"].getAppLabel = (id) => {
|
|
13
|
+
return (id || "").split(".").pop();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return window["workspace"].getAppLabel(resourceID);
|
|
17
|
+
}
|
|
7
18
|
}
|
|
8
19
|
Workspace.resourceID = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const KEY_PORT_EXPORT = "global.porta.app.impressao";
|
|
1
2
|
const VIEW_MODE = {
|
|
2
3
|
grid: {
|
|
3
4
|
index: 0,
|
|
@@ -84,5 +85,16 @@ const ORDER_VALUES = {
|
|
|
84
85
|
label: "Z-A"
|
|
85
86
|
}
|
|
86
87
|
};
|
|
88
|
+
const WEB_CONNECTION = {
|
|
89
|
+
methods: {
|
|
90
|
+
PRINTERS_LIST: "pList",
|
|
91
|
+
LOCAL_PRINTING: "localPrinting",
|
|
92
|
+
IMPRESSAO_DIRETA: "impressaoDireta",
|
|
93
|
+
IMPRESSAO_DIRETA_TEXTO: "impressaoDiretaTexto",
|
|
94
|
+
INFO: "info",
|
|
95
|
+
PDF_VIEWER: "pdfViewer",
|
|
96
|
+
IMPORT_IMAGE: "importImage"
|
|
97
|
+
}
|
|
98
|
+
};
|
|
87
99
|
|
|
88
|
-
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D,
|
|
100
|
+
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_PORT_EXPORT as K, ORDER_VALUES as O, TAGS_BY_TYPE as T, VIEW_MODE as V, WEB_CONNECTION as W, VARS_BY_TYPE as a, TAB_NAMES as b, KEY_EVENTS as c, TYPE_ACTIONS as d };
|
|
@@ -208,6 +208,23 @@ class TotalsFetcher {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
class DefaultValuesFetcher extends ResourceFetcher {
|
|
212
|
+
getDefaultValues(resourceID) {
|
|
213
|
+
return new Promise((resolve, reject) => {
|
|
214
|
+
this.loadResource(`cfg://defaultValues/${resourceID}`)
|
|
215
|
+
.then(loadedResource => {
|
|
216
|
+
let value;
|
|
217
|
+
if (loadedResource) {
|
|
218
|
+
value = JSON.parse(loadedResource);
|
|
219
|
+
}
|
|
220
|
+
resolve(value);
|
|
221
|
+
}).catch((error) => {
|
|
222
|
+
reject(error);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
211
228
|
class DataUnitFetcher {
|
|
212
229
|
constructor() {
|
|
213
230
|
this.templateByQuery = new Map();
|
|
@@ -498,9 +515,27 @@ class Workspace {
|
|
|
498
515
|
var _a;
|
|
499
516
|
(_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
|
|
500
517
|
}
|
|
518
|
+
static getAppLabel(resourceID) {
|
|
519
|
+
if ((window === null || window === void 0 ? void 0 : window["workspace"]) == undefined) {
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
if (window["workspace"].getAppLabel == undefined) {
|
|
523
|
+
window["workspace"].getAppLabel = (id) => {
|
|
524
|
+
return (id || "").split(".").pop();
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
return window["workspace"].getAppLabel(resourceID);
|
|
528
|
+
}
|
|
501
529
|
}
|
|
502
530
|
Workspace.resourceID = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID;
|
|
503
531
|
|
|
532
|
+
class AppletCaller {
|
|
533
|
+
static webConnectionCaller(port, methodName, params) {
|
|
534
|
+
var _a;
|
|
535
|
+
(_a = window["AppletCaller"]) === null || _a === void 0 ? void 0 : _a.webConnectionCaller(port, methodName, params);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
504
539
|
class ParametersFetcher {
|
|
505
540
|
constructor() {
|
|
506
541
|
this.templateByQuery = new Map();
|
|
@@ -650,23 +685,6 @@ class FilterBarConfigFetcher extends ResourceFetcher {
|
|
|
650
685
|
}
|
|
651
686
|
}
|
|
652
687
|
|
|
653
|
-
class DefaultValuesFetcher extends ResourceFetcher {
|
|
654
|
-
getDefaultValues(resourceID) {
|
|
655
|
-
return new Promise((resolve, reject) => {
|
|
656
|
-
this.loadResource(`cfg://defaultValues/${resourceID}`)
|
|
657
|
-
.then(loadedResource => {
|
|
658
|
-
let value;
|
|
659
|
-
if (loadedResource) {
|
|
660
|
-
value = JSON.parse(loadedResource);
|
|
661
|
-
}
|
|
662
|
-
resolve(value);
|
|
663
|
-
}).catch((error) => {
|
|
664
|
-
reject(error);
|
|
665
|
-
});
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
|
|
670
688
|
const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
|
|
671
689
|
|
|
672
690
|
const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -905,6 +923,17 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
905
923
|
async openApp(resourceId, pkObject) {
|
|
906
924
|
Workspace.openAppActivity(resourceId, pkObject);
|
|
907
925
|
}
|
|
926
|
+
/**
|
|
927
|
+
* Realiza a chamada do WebConnection para realizar a exportação de arquivo.
|
|
928
|
+
* @param keyPort - Chave da porta que será requisitada.
|
|
929
|
+
* @param methodName - Nome do tipo de exportação de arquivo que será realizado.
|
|
930
|
+
* @param params - Parâmetros necessários para realizar a exportação do arquivo.
|
|
931
|
+
*/
|
|
932
|
+
async webConnection(keyPort, methodName, params) {
|
|
933
|
+
this.getStringParam(keyPort).then((port) => {
|
|
934
|
+
AppletCaller.webConnectionCaller(port, methodName, params);
|
|
935
|
+
});
|
|
936
|
+
}
|
|
908
937
|
getDuPromissesStack(dataUnitName) {
|
|
909
938
|
let stack;
|
|
910
939
|
if (dataUnitName) {
|
|
@@ -1227,15 +1256,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1227
1256
|
* Obtém o nome das telas da aplicação
|
|
1228
1257
|
*/
|
|
1229
1258
|
async getAppLabel() {
|
|
1230
|
-
|
|
1231
|
-
return;
|
|
1232
|
-
}
|
|
1233
|
-
if (window["workspace"].getAppLabel == undefined) {
|
|
1234
|
-
window["workspace"].getAppLabel = (resourceID) => {
|
|
1235
|
-
return (resourceID || "").split(".").pop();
|
|
1236
|
-
};
|
|
1237
|
-
}
|
|
1238
|
-
return window["workspace"].getAppLabel(this._resourceID);
|
|
1259
|
+
return Workspace.getAppLabel(this._resourceID);
|
|
1239
1260
|
}
|
|
1240
1261
|
clearContent(container) {
|
|
1241
1262
|
if (container) {
|
|
@@ -1313,6 +1334,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1313
1334
|
"saveConfig": [64],
|
|
1314
1335
|
"getAttributeFromHTMLWrapper": [64],
|
|
1315
1336
|
"openApp": [64],
|
|
1337
|
+
"webConnection": [64],
|
|
1316
1338
|
"createDataunit": [64],
|
|
1317
1339
|
"getDataUnit": [64],
|
|
1318
1340
|
"getResourceID": [64],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { V as VIEW_MODE } from './constants.js';
|
|
4
|
-
import {
|
|
4
|
+
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
5
|
+
import { P as PresentationMode, d as defineCustomElement$g } from './snk-data-exporter2.js';
|
|
5
6
|
import { d as defineCustomElement$i } from './snk-config-options2.js';
|
|
6
7
|
import { d as defineCustomElement$h } from './snk-configurator2.js';
|
|
7
|
-
import { d as defineCustomElement$g } from './snk-data-exporter2.js';
|
|
8
8
|
import { d as defineCustomElement$f } from './snk-exporter-email-sender2.js';
|
|
9
9
|
import { d as defineCustomElement$e } from './snk-field-config2.js';
|
|
10
10
|
import { d as defineCustomElement$d } from './snk-filter-bar2.js';
|
|
@@ -33,10 +33,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
33
|
* Determina se pode haver mais de uma linha selecionada na grade.
|
|
34
34
|
*/
|
|
35
35
|
this.multipleSelection = true;
|
|
36
|
-
/**
|
|
37
|
-
* Determina se haverá exportação de dados
|
|
38
|
-
*/
|
|
39
|
-
this.enableDataExporter = false;
|
|
40
36
|
/**
|
|
41
37
|
* Altera o modo de apresentação dos botões do snk-taskbar.
|
|
42
38
|
*/
|
|
@@ -128,7 +124,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
124
|
this.validatePresentationMode();
|
|
129
125
|
}
|
|
130
126
|
render() {
|
|
131
|
-
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection,
|
|
127
|
+
return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { ref: (ref) => this._snkForm = ref, "data-element-id": "crud_form", configName: this.configName, actionsList: this.actionsList, onExit: () => this.setViewMode(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode }, h("slot", { name: "SnkFormTaskBar" }))), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._viewMode, onConfigSelected: (evt) => this.executeAction(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail) })));
|
|
132
128
|
}
|
|
133
129
|
get _element() { return this; }
|
|
134
130
|
static get style() { return snkCrudCss; }
|
|
@@ -139,7 +135,6 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
139
135
|
"recordsValidator": [16],
|
|
140
136
|
"statusResolver": [16],
|
|
141
137
|
"multipleSelection": [4, "multiple-selection"],
|
|
142
|
-
"enableDataExporter": [4, "enable-data-exporter"],
|
|
143
138
|
"presentationMode": [1, "presentation-mode"],
|
|
144
139
|
"_dataUnit": [32],
|
|
145
140
|
"_dataState": [32],
|
|
@@ -2,8 +2,14 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal
|
|
|
2
2
|
import { ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
5
|
+
import { K as KEY_PORT_EXPORT, W as WEB_CONNECTION } from './constants.js';
|
|
5
6
|
import { d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
|
|
6
7
|
|
|
8
|
+
var PresentationMode;
|
|
9
|
+
(function (PresentationMode) {
|
|
10
|
+
PresentationMode["PRIMARY"] = "primary";
|
|
11
|
+
PresentationMode["SECONDARY"] = "secondary";
|
|
12
|
+
})(PresentationMode || (PresentationMode = {}));
|
|
7
13
|
var DataExporterOption;
|
|
8
14
|
(function (DataExporterOption) {
|
|
9
15
|
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
|
@@ -15,41 +21,21 @@ var DataExporterOption;
|
|
|
15
21
|
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
|
16
22
|
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
|
17
23
|
})(DataExporterOption || (DataExporterOption = {}));
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const payload = { serviceName, requestBody };
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
DataFetcher.get()
|
|
36
|
-
.callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
|
|
37
|
-
.then(result => resolve(getFormatResponse(result)))
|
|
38
|
-
.catch(error => reject(error));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
function getFormatResponse(result) {
|
|
42
|
-
var _a;
|
|
43
|
-
const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
|
|
44
|
-
if (response == undefined) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
return ObjectUtils.stringToObject(response);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function fileViewer({ fileSessionKey }) {
|
|
51
|
-
window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${fileSessionKey}&download=S`);
|
|
52
|
-
}
|
|
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 = {}));
|
|
53
39
|
|
|
54
40
|
class ItemBuilder {
|
|
55
41
|
constructor(getMessage, selectedNumber) {
|
|
@@ -191,7 +177,62 @@ class ItemBuilder {
|
|
|
191
177
|
}
|
|
192
178
|
}
|
|
193
179
|
|
|
194
|
-
|
|
180
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
181
|
+
var t = {};
|
|
182
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
183
|
+
t[p] = s[p];
|
|
184
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
185
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
186
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
187
|
+
t[p[i]] = s[p[i]];
|
|
188
|
+
}
|
|
189
|
+
return t;
|
|
190
|
+
};
|
|
191
|
+
function fetchDataExporter(_a) {
|
|
192
|
+
var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
|
|
193
|
+
const serviceName = `DataExporterSPBean.${methodName}`;
|
|
194
|
+
const payload = { serviceName, requestBody };
|
|
195
|
+
return new Promise((resolve, reject) => {
|
|
196
|
+
DataFetcher.get()
|
|
197
|
+
.callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
|
|
198
|
+
.then(result => resolve(getFormatResponse(result)))
|
|
199
|
+
.catch(error => reject(error));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function getFormatResponse(result) {
|
|
203
|
+
var _a;
|
|
204
|
+
const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
|
|
205
|
+
if (response == undefined) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
return ObjectUtils.stringToObject(response);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function fileViewer({ fileSessionKey, canPrint, canExport, useAppPrint, isDownload }) {
|
|
212
|
+
if (useAppPrint && !isDownload) {
|
|
213
|
+
webConnection(fileSessionKey, canPrint, canExport);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
window.open(`${window.location.protocol}//${window.location.hostname}:${window.location.port}/mge/visualizadorArquivos.mge?chaveArquivo=${fileSessionKey}${isDownload ? "&download=S" : ""}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function webConnection(fileSessionKey, canPrint, canExport) {
|
|
220
|
+
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
221
|
+
if (application == undefined) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const keyPort = KEY_PORT_EXPORT;
|
|
225
|
+
const methodName = WEB_CONNECTION.methods.PDF_VIEWER;
|
|
226
|
+
const params = {
|
|
227
|
+
chaveArquivo: fileSessionKey,
|
|
228
|
+
permiteImprimir: canPrint ? "S" : "N",
|
|
229
|
+
permiteExportar: canExport ? "S" : "N",
|
|
230
|
+
contentType: "S"
|
|
231
|
+
};
|
|
232
|
+
application.webConnection(keyPort, methodName, params);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const snkDataExporterCss = ".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown--hide.sc-snk-data-exporter{display:none}";
|
|
195
236
|
|
|
196
237
|
const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
197
238
|
constructor() {
|
|
@@ -202,9 +243,12 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
202
243
|
this._showDropdown = false;
|
|
203
244
|
this._releasedToExport = [
|
|
204
245
|
DataExporterOption.EXPORT_TO_PDF,
|
|
246
|
+
DataExporterOption.EXPORT_TO_XLS,
|
|
205
247
|
DataExporterOption.EXPORT_BY_EMAIL,
|
|
206
248
|
DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
|
207
|
-
DataExporterOption.EXPORT_XLS_TO_EMAIL
|
|
249
|
+
DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
|
250
|
+
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
251
|
+
DataExporterOption.EXPORT_PAGE_TO_XLS
|
|
208
252
|
];
|
|
209
253
|
/**
|
|
210
254
|
* Provedor das informações para exportação dos dados.
|
|
@@ -224,19 +268,14 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
224
268
|
};
|
|
225
269
|
this._snkEmailSender.open(config)
|
|
226
270
|
.then(({ format, email: { to, subject, message } }) => {
|
|
227
|
-
|
|
271
|
+
var _a;
|
|
272
|
+
const methodName = (_a = DataExporterFormat[format === null || format === void 0 ? void 0 : format.toUpperCase()]) !== null && _a !== void 0 ? _a : DataExporterFormat.PDF;
|
|
228
273
|
this.resolveExporter({ methodName, to, subject, message, fileName: this._appLabel, titleGrid: this._appLabel }, () => {
|
|
229
274
|
this._snkEmailSender.close();
|
|
230
275
|
ApplicationUtils.info(this.getMessage("snkDataExporter.message.emailSuccess"), { iconName: "check" });
|
|
231
276
|
});
|
|
232
277
|
});
|
|
233
278
|
}
|
|
234
|
-
getFormatExporter(format) {
|
|
235
|
-
if (format === "xlsx") {
|
|
236
|
-
return DataExporterOption.EXPORT_XLS_TO_EMAIL;
|
|
237
|
-
}
|
|
238
|
-
return DataExporterOption.EXPORT_PDF_TO_EMAIL;
|
|
239
|
-
}
|
|
240
279
|
/**
|
|
241
280
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
242
281
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -274,20 +313,56 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
274
313
|
this._showDropdown = !this._showDropdown;
|
|
275
314
|
}
|
|
276
315
|
resolveExporter(resolveProps, callbackResolver) {
|
|
277
|
-
if (this.provider == undefined) {
|
|
316
|
+
if (this.provider == undefined || resolveProps == undefined || callbackResolver == undefined) {
|
|
278
317
|
return;
|
|
279
318
|
}
|
|
280
319
|
const filters = this.provider.getFilters();
|
|
281
320
|
const columns = this.provider.getColumnsMetadata();
|
|
282
321
|
const sort = this.provider.getOrders();
|
|
283
322
|
const resourceURI = this.provider.getResourceURI();
|
|
284
|
-
|
|
323
|
+
const option = resolveProps.exportOption;
|
|
324
|
+
const currentPageOptions = [
|
|
325
|
+
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
326
|
+
DataExporterOption.EXPORT_PAGE_TO_XLS
|
|
327
|
+
];
|
|
328
|
+
delete resolveProps.exportOption;
|
|
329
|
+
let params = Object.assign({ filters,
|
|
285
330
|
columns,
|
|
286
331
|
sort,
|
|
287
|
-
resourceURI }, resolveProps)
|
|
332
|
+
resourceURI }, resolveProps);
|
|
333
|
+
if (currentPageOptions.includes(option)) {
|
|
334
|
+
const offset = this.provider.getOffset();
|
|
335
|
+
const limit = this.provider.getLimit();
|
|
336
|
+
params = Object.assign(Object.assign({}, params), { offset,
|
|
337
|
+
limit });
|
|
338
|
+
}
|
|
339
|
+
fetchDataExporter(params)
|
|
288
340
|
.then((result) => callbackResolver(result))
|
|
289
341
|
.catch(() => ApplicationUtils.error(this.getMessage("snkDataExporter.title.error"), this.getMessage("snkDataExporter.message.exportError")));
|
|
290
342
|
}
|
|
343
|
+
getOptionKey(option) {
|
|
344
|
+
return Object.keys(DataExporterOption)
|
|
345
|
+
.find((key) => {
|
|
346
|
+
return DataExporterOption[key] === option;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
dispatchExporter(option) {
|
|
350
|
+
var _a;
|
|
351
|
+
const optionKey = this.getOptionKey(option);
|
|
352
|
+
const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
|
|
353
|
+
const isDownload = DataExporterType[optionKey] === DataExporterType.EXPORT_TO_XLS;
|
|
354
|
+
const params = {
|
|
355
|
+
methodName: DataExporterOption[`EXPORT_TO_${fileType}`],
|
|
356
|
+
fileName: this._appLabel,
|
|
357
|
+
titleGrid: this._appLabel,
|
|
358
|
+
exportOption: option
|
|
359
|
+
};
|
|
360
|
+
this.resolveExporter(params, (response) => {
|
|
361
|
+
fileViewer(Object.assign(Object.assign({}, response), { fileType,
|
|
362
|
+
isDownload }));
|
|
363
|
+
ApplicationUtils.info(this.getMessage("snkDataExporter.message.exportSuccess"), { iconName: "check" });
|
|
364
|
+
});
|
|
365
|
+
}
|
|
291
366
|
async processExporter(evt) {
|
|
292
367
|
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
293
368
|
if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
|
|
@@ -297,7 +372,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
297
372
|
this.exportByEmail();
|
|
298
373
|
}
|
|
299
374
|
else {
|
|
300
|
-
this.
|
|
375
|
+
this.dispatchExporter(item.id);
|
|
301
376
|
}
|
|
302
377
|
this._showDropdown = false;
|
|
303
378
|
}
|
|
@@ -305,7 +380,8 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
305
380
|
const items = [];
|
|
306
381
|
this._releasedToExport
|
|
307
382
|
.forEach((option) => {
|
|
308
|
-
|
|
383
|
+
var _a;
|
|
384
|
+
(_a = this._itemBuilder) === null || _a === void 0 ? void 0 : _a.setExportOption(option, items);
|
|
309
385
|
});
|
|
310
386
|
return items;
|
|
311
387
|
}
|
|
@@ -316,8 +392,9 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
316
392
|
this._items = this.getItems();
|
|
317
393
|
}
|
|
318
394
|
componentWillLoad() {
|
|
395
|
+
var _a;
|
|
319
396
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
320
|
-
this._application.getAppLabel().then(result => this._appLabel = result);
|
|
397
|
+
(_a = this._application) === null || _a === void 0 ? void 0 : _a.getAppLabel().then(result => this._appLabel = result);
|
|
321
398
|
this.loadDropdown();
|
|
322
399
|
this.setEvents();
|
|
323
400
|
}
|
|
@@ -326,6 +403,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
326
403
|
return;
|
|
327
404
|
}
|
|
328
405
|
ElementIDUtils.addIDInfo(this._element);
|
|
406
|
+
this.positionDropdown();
|
|
329
407
|
}
|
|
330
408
|
componentWillUpdate() {
|
|
331
409
|
if (this._showDropdown) {
|
|
@@ -340,8 +418,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
340
418
|
render() {
|
|
341
419
|
return (h(Host, null, h("div", { class: `snk-data-exporter
|
|
342
420
|
${this._showDropdown ? " snk-data-exporter--overlap" : ""}
|
|
343
|
-
` }, h("ez-button", Object.assign({ ref: (ref) => this._ezButton = ref, iconName: "file-download", size: "small", mode: "icon", onClick: () => this.controlDropdown() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("button")}` })), this._showDropdown &&
|
|
344
|
-
h("ez-dropdown", Object.assign({ ref: (ref) => this._ezDropdown = ref, items: this._items, onEzClick: (evt) => this.processExporter(evt) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("dropdown")}` }))), this._showDropdown &&
|
|
421
|
+
` }, h("ez-button", Object.assign({ ref: (ref) => this._ezButton = ref, iconName: "file-download", size: "small", mode: "icon", onClick: () => this.controlDropdown() }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("button")}` })), h("ez-dropdown", Object.assign({ class: this._showDropdown ? "" : "snk-data-exporter__dropdown--hide", ref: (ref) => this._ezDropdown = ref, items: this._items, onEzClick: (evt) => this.processExporter(evt) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("dropdown")}` }))), this._showDropdown &&
|
|
345
422
|
h("div", Object.assign({ class: "ez-scrim ez-scrim--light" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("ezScrim")}` })), h("snk-exporter-email-sender", { ref: ref => this._snkEmailSender = ref, getMessage: (key, params) => this.getMessage(key, params) })));
|
|
346
423
|
}
|
|
347
424
|
get _element() { return this; }
|
|
@@ -370,4 +447,4 @@ function defineCustomElement() {
|
|
|
370
447
|
} });
|
|
371
448
|
}
|
|
372
449
|
|
|
373
|
-
export { SnkDataExporter as S, defineCustomElement as d };
|
|
450
|
+
export { PresentationMode as P, SnkDataExporter as S, defineCustomElement as d };
|
|
@@ -47,10 +47,6 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
47
47
|
}
|
|
48
48
|
if (action.type === Action.EDITION_CANCELED) {
|
|
49
49
|
this.cancelEdition.emit();
|
|
50
|
-
const cancelFinishMsg = this.getMessage("snkDataUnit.cancelInfo");
|
|
51
|
-
if (cancelFinishMsg != undefined) {
|
|
52
|
-
this.showSuccessMessage(cancelFinishMsg);
|
|
53
|
-
}
|
|
54
50
|
}
|
|
55
51
|
if (action.type === Action.RECORDS_REMOVED) {
|
|
56
52
|
const removeFinishMsg = this.getMessage("snkDataUnit.removeInfo", action.payload.cachedRecords[0]);
|
|
@@ -157,12 +153,16 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
157
153
|
if (this.dataState.hasDirtyRecords) {
|
|
158
154
|
const cancelConfirmation = this.getMessage("snkDataUnit.cancelConfirmation");
|
|
159
155
|
if (cancelConfirmation == undefined) {
|
|
156
|
+
this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
|
160
157
|
resolve(action);
|
|
161
158
|
}
|
|
162
159
|
else {
|
|
163
160
|
const cancelConfirmationTitle = this.getMessage("snkDataUnit.cancelConfirmationTitle");
|
|
164
161
|
ApplicationUtils.confirm(cancelConfirmationTitle, cancelConfirmation)
|
|
165
|
-
.then((result) =>
|
|
162
|
+
.then((result) => {
|
|
163
|
+
this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo"));
|
|
164
|
+
resolve(result ? action : undefined);
|
|
165
|
+
});
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { DateUtils, ObjectUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
|
4
|
-
import { P as PresentationMode, d as defineCustomElement$
|
|
4
|
+
import { P as PresentationMode, d as defineCustomElement$6 } from './snk-data-exporter2.js';
|
|
5
5
|
import { T as TaskbarProcessor } from './taskbar-processor.js';
|
|
6
6
|
import { d as defineCustomElement$7 } from './snk-config-options2.js';
|
|
7
|
-
import { d as defineCustomElement$6 } from './snk-data-exporter2.js';
|
|
8
7
|
import { d as defineCustomElement$5 } from './snk-exporter-email-sender2.js';
|
|
9
8
|
import { d as defineCustomElement$4 } from './snk-field-config2.js';
|
|
10
9
|
import { d as defineCustomElement$3 } from './snk-form-config2.js';
|
|
11
10
|
import { d as defineCustomElement$2 } from './snk-tab-config2.js';
|
|
11
|
+
import { d as defineCustomElement$1 } from './snk-taskbar2.js';
|
|
12
12
|
|
|
13
13
|
const snkFormCss = ".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--visible);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}.snk-form__form--hidden.sc-snk-form{display:none}";
|
|
14
14
|
|