@sankhyalabs/sankhyablocks 2.7.0 → 2.8.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/AuthorizationConfig-79ffae4b.js +7 -0
- package/dist/cjs/{SnkMessageBuilder-09b25b0a.js → SnkMessageBuilder-248b5105.js} +7 -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 +15 -1
- package/dist/cjs/snk-configurator_3.cjs.entry.js +6 -38
- package/dist/cjs/{snk-data-exporter_9.cjs.entry.js → snk-data-exporter_8.cjs.entry.js} +83 -155
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +129 -0
- package/dist/collection/components/snk-application/snk-application.js +30 -0
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/email-info-step.js +3 -2
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +29 -6
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +49 -31
- package/dist/collection/components/snk-grid/snk-grid.js +1 -43
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/permission-export-pdf.js +7 -0
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +7 -0
- package/dist/components/SnkMessageBuilder.js +7 -0
- package/dist/components/snk-application2.js +16 -1
- package/dist/components/snk-data-exporter2.js +58 -17
- package/dist/components/snk-exporter-email-sender2.js +18 -13
- package/dist/components/snk-form2.js +10 -4
- package/dist/components/snk-grid2.js +3 -35
- package/dist/components/snk-taskbar2.js +8 -2
- package/dist/esm/AuthorizationConfig-dcbd207a.js +7 -0
- package/dist/esm/{SnkMessageBuilder-47db5d75.js → SnkMessageBuilder-4a060599.js} +7 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +15 -1
- package/dist/esm/snk-configurator_3.entry.js +2 -34
- package/dist/esm/{snk-data-exporter_9.entry.js → snk-data-exporter_8.entry.js} +64 -135
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-exporter-email-sender.entry.js +125 -0
- package/dist/sankhyablocks/{p-d96bf6a7.entry.js → p-3480f2fa.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f8fdd16c.entry.js → p-43eff4d3.entry.js} +5 -5
- package/dist/sankhyablocks/p-48d7ba04.entry.js +1 -0
- package/dist/sankhyablocks/p-97347faf.entry.js +1 -0
- package/dist/sankhyablocks/p-dc36cfbf.js +1 -0
- package/dist/sankhyablocks/p-f5246cd6.entry.js +1 -0
- package/dist/sankhyablocks/{p-1d7a0daf.js → p-f624979d.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +4 -0
- package/dist/types/components/snk-data-exporter/data/export-config.d.ts +1 -1
- package/dist/types/components/snk-data-exporter/exporter-email-sender/email-info-step.d.ts +2 -2
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +5 -5
- package/dist/types/components.d.ts +5 -8
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +5 -1
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/permission-export-pdf.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/data-exporter-option-417da37a.js +0 -19
- package/dist/esm/data-exporter-option-006307dd.js +0 -19
- package/dist/sankhyablocks/p-04581d0c.entry.js +0 -1
- package/dist/sankhyablocks/p-50c8bcb7.entry.js +0 -1
- package/dist/sankhyablocks/p-719e570a.js +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-2cd6f753.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const EmailInfoStep = ({ getMessage, changeInfo, data }) => {
|
|
9
|
+
const { format, email } = data || {};
|
|
10
|
+
return index.h("div", null,
|
|
11
|
+
index.h("ez-text-input", Object.assign({ label: `${getMessage("snkExporter.emailSenderInfoStep_sendTo")} (obrigatório) *`, required: true, value: email === null || email === void 0 ? void 0 : email.to, onEzChange: evt => changeInfo("to", evt.detail) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("sendTo")}` })),
|
|
12
|
+
index.h("ez-text-input", Object.assign({ label: `${getMessage("snkExporter.emailSenderInfoStep_subject")} (obrigatório) *`, required: true, value: email === null || email === void 0 ? void 0 : email.subject, onEzChange: evt => changeInfo("subject", evt.detail) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("subject")}` })),
|
|
13
|
+
index.h("ez-text-area", Object.assign({ label: getMessage("snkExporter.emailSenderInfoStep_message"), value: email === null || email === void 0 ? void 0 : email.message, onEzChange: evt => changeInfo("message", evt.detail) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("message")}` })),
|
|
14
|
+
((email === null || email === void 0 ? void 0 : email.attachments) || [])
|
|
15
|
+
.map((file, index$1) => index.h("ez-file-item", Object.assign({ class: "ez-padding-bottom--large", fileName: `${file.name}.${format}`, fileSize: file.size, canRemove: false }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("fileItem_") + (index$1 + 1)}` }))));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const OptionsStep = ({ getMessage, changeInfo, data }) => {
|
|
19
|
+
const selectionCount = (data === null || data === void 0 ? void 0 : data.selectedRows) || 0;
|
|
20
|
+
const formatOptions = [
|
|
21
|
+
{ label: getMessage("snkExporter.emailSenderOptStep_formatPDF"), value: "pdf" },
|
|
22
|
+
{ label: getMessage("snkExporter.emailSenderOptStep_formatXLSX"), value: "xlsx" }
|
|
23
|
+
];
|
|
24
|
+
const typeOptions = [
|
|
25
|
+
{ label: getMessage("snkExporter.emailSenderOptStep_allData"), value: "all" },
|
|
26
|
+
{ label: getMessage("snkExporter.emailSenderOptStep_currentPage"), value: "page" },
|
|
27
|
+
];
|
|
28
|
+
if (selectionCount > 0) {
|
|
29
|
+
const label = getMessage(selectionCount > 1 ? "snkExporter.emailSenderOptStep_someRecords" : "snkExporter.emailSenderOptStep_oneRecord", { SELECTION_COUNT: selectionCount });
|
|
30
|
+
typeOptions.push({
|
|
31
|
+
label,
|
|
32
|
+
value: "selection"
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return index.h("div", null,
|
|
36
|
+
index.h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("formato")}` }, { label: getMessage("snkExporter.emailSenderOptStep_lblFormat"), direction: "horizontal", value: data === null || data === void 0 ? void 0 : data.format, onEzChange: evt => changeInfo("format", evt.detail), options: formatOptions })),
|
|
37
|
+
index.h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("type")}` }, { label: getMessage("snkExporter.emailSenderOptStep_export"), value: (data === null || data === void 0 ? void 0 : data.type) || "all", onEzChange: evt => changeInfo("type", evt.detail), options: typeOptions })));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const SnkExporterEmailSender = class {
|
|
41
|
+
constructor(hostRef) {
|
|
42
|
+
index.registerInstance(this, hostRef);
|
|
43
|
+
this._stepInfo = [
|
|
44
|
+
{
|
|
45
|
+
subTitle: "snkExporter.emailSenderOptStep_subtitle",
|
|
46
|
+
firstButton: "snkExporter.emailSenderCancelButton",
|
|
47
|
+
secondButton: "snkExporter.emailSenderNextButton",
|
|
48
|
+
firstButtonAction: () => this.close(),
|
|
49
|
+
secondButtonAction: () => this.changeStep(1)
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
subTitle: "snkExporter.emailSenderInfoStep_subtitle",
|
|
53
|
+
firstButton: "snkExporter.emailSenderBackButton",
|
|
54
|
+
secondButton: "snkExporter.emailSenderSendButton",
|
|
55
|
+
firstButtonAction: () => this.changeStep(0),
|
|
56
|
+
secondButtonAction: () => this.send(),
|
|
57
|
+
secondButtonEnabledTester: () => this.isFilled(),
|
|
58
|
+
secondButtonClass: "ez-button--primary"
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
this._opened = false;
|
|
62
|
+
this._currentStep = 0;
|
|
63
|
+
}
|
|
64
|
+
open(config) {
|
|
65
|
+
var _a;
|
|
66
|
+
this._config = Object.assign(Object.assign({}, config), { format: (_a = config === null || config === void 0 ? void 0 : config.format) !== null && _a !== void 0 ? _a : "pdf" });
|
|
67
|
+
this._opened = true;
|
|
68
|
+
this.changeStep(0);
|
|
69
|
+
return new Promise(accept => {
|
|
70
|
+
this._promiseResolver = accept;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
close() {
|
|
74
|
+
this._opened = false;
|
|
75
|
+
return new Promise(accept => {
|
|
76
|
+
this._promiseResolver = accept;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
getStepMessage(key) {
|
|
80
|
+
const stepInfo = this._stepInfo[this._currentStep] || {};
|
|
81
|
+
return this.getMessage(stepInfo[key]);
|
|
82
|
+
}
|
|
83
|
+
executeButtonAction(first) {
|
|
84
|
+
const stepInfo = this._stepInfo[this._currentStep] || {};
|
|
85
|
+
stepInfo[first ? "firstButtonAction" : "secondButtonAction"]();
|
|
86
|
+
}
|
|
87
|
+
checkButtonEnabled(first) {
|
|
88
|
+
const stepInfo = this._stepInfo[this._currentStep] || {};
|
|
89
|
+
const testFunction = stepInfo[first ? "firstButtonEnabledTester" : "secondButtonEnabledTester"];
|
|
90
|
+
if (testFunction) {
|
|
91
|
+
return testFunction();
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
changeStep(index) {
|
|
96
|
+
this._currentStep = index;
|
|
97
|
+
if (this._viewStack) {
|
|
98
|
+
this._viewStack.show(this._currentStep);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
send() {
|
|
102
|
+
const { format, type, email } = this._config;
|
|
103
|
+
this._promiseResolver({ format, type, email, report: undefined });
|
|
104
|
+
}
|
|
105
|
+
isFilled() {
|
|
106
|
+
var _a, _b;
|
|
107
|
+
return ((_a = this._config.email) === null || _a === void 0 ? void 0 : _a.to) && ((_b = this._config.email) === null || _b === void 0 ? void 0 : _b.subject) ? true : false;
|
|
108
|
+
}
|
|
109
|
+
updateEmailInfo(field, value) {
|
|
110
|
+
this._config = Object.assign(Object.assign({}, this._config), { email: Object.assign(Object.assign({}, this._config.email), { [field]: value }) });
|
|
111
|
+
}
|
|
112
|
+
updateConfigInfo(field, value) {
|
|
113
|
+
this._config = Object.assign(Object.assign({}, this._config), { [field]: value });
|
|
114
|
+
}
|
|
115
|
+
getSecondButtonClass() {
|
|
116
|
+
const stepInfo = this._stepInfo[this._currentStep] || {};
|
|
117
|
+
return stepInfo["secondButtonClass"] || "ez-button--secondary";
|
|
118
|
+
}
|
|
119
|
+
render() {
|
|
120
|
+
core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkExporterEmailSender');
|
|
121
|
+
return (index.h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, index.h("ez-modal-container", { onEzModalAction: evt => {
|
|
122
|
+
if (evt.detail === "CLOSE")
|
|
123
|
+
this.close();
|
|
124
|
+
}, modalTitle: this.getMessage("snkExporter.emailSenderTitle"), modalSubTitle: this.getStepMessage("subTitle") }, index.h("ez-view-stack", { ref: ref => this._viewStack = ref }, index.h("stack-item", null, index.h(OptionsStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateConfigInfo(field, value) })), index.h("stack-item", null, index.h(EmailInfoStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateEmailInfo(field, value) }))), index.h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, index.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) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("firstButton")}` })), index.h("ez-button", Object.assign({ class: this.getSecondButtonClass(), label: this.getStepMessage("secondButton"), onClick: () => this.executeButtonAction(false), enabled: this.checkButtonEnabled(false) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${core.ElementIDUtils.getInternalIDInfo("secondButton")}` }))))));
|
|
125
|
+
}
|
|
126
|
+
get _element() { return index.getElement(this); }
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
exports.snk_exporter_email_sender = SnkExporterEmailSender;
|
|
@@ -575,6 +575,20 @@ export class SnkApplication {
|
|
|
575
575
|
accept(window['isDebugMode']);
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Obtém o nome das telas da aplicação
|
|
580
|
+
*/
|
|
581
|
+
async getAppLabel() {
|
|
582
|
+
if ((window === null || window === void 0 ? void 0 : window["workspace"]) == undefined) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
if (window["workspace"].getAppLabel == undefined) {
|
|
586
|
+
window["workspace"].getAppLabel = (resourceID) => {
|
|
587
|
+
return (resourceID || "").split(".").pop();
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
return window["workspace"].getAppLabel(this._resourceID);
|
|
591
|
+
}
|
|
578
592
|
clearContent(container) {
|
|
579
593
|
if (container) {
|
|
580
594
|
Array.from(container.children).forEach(child => {
|
|
@@ -1722,6 +1736,22 @@ export class SnkApplication {
|
|
|
1722
1736
|
"text": "Obt\u00E9m `true` caso a tela esteja em modo de debug.",
|
|
1723
1737
|
"tags": []
|
|
1724
1738
|
}
|
|
1739
|
+
},
|
|
1740
|
+
"getAppLabel": {
|
|
1741
|
+
"complexType": {
|
|
1742
|
+
"signature": "() => Promise<string>",
|
|
1743
|
+
"parameters": [],
|
|
1744
|
+
"references": {
|
|
1745
|
+
"Promise": {
|
|
1746
|
+
"location": "global"
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
"return": "Promise<string>"
|
|
1750
|
+
},
|
|
1751
|
+
"docs": {
|
|
1752
|
+
"text": "Obt\u00E9m o nome das telas da aplica\u00E7\u00E3o",
|
|
1753
|
+
"tags": []
|
|
1754
|
+
}
|
|
1725
1755
|
}
|
|
1726
1756
|
};
|
|
1727
1757
|
}
|
package/dist/collection/components/snk-data-exporter/exporter-email-sender/email-info-step.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
export const EmailInfoStep = ({ getMessage, changeInfo, data }) => {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const { format, email } = data || {};
|
|
5
|
+
return h("div", null, h("ez-text-input", Object.assign({ label: `${getMessage("snkExporter.emailSenderInfoStep_sendTo")} (obrigatório) *`, required: true, value: email === null || email === void 0 ? void 0 : email.to, onEzChange: evt => changeInfo("to", evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("sendTo")}` })), h("ez-text-input", Object.assign({ label: `${getMessage("snkExporter.emailSenderInfoStep_subject")} (obrigatório) *`, required: true, value: email === null || email === void 0 ? void 0 : email.subject, onEzChange: evt => changeInfo("subject", evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("subject")}` })), h("ez-text-area", Object.assign({ label: getMessage("snkExporter.emailSenderInfoStep_message"), value: email === null || email === void 0 ? void 0 : email.message, onEzChange: evt => changeInfo("message", evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("message")}` })), ((email === null || email === void 0 ? void 0 : email.attachments) || [])
|
|
6
|
+
.map((file, index) => h("ez-file-item", Object.assign({ class: "ez-padding-bottom--large", fileName: `${file.name}.${format}`, fileSize: file.size, canRemove: false }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("fileItem_") + (index + 1)}` }))));
|
|
6
7
|
};
|
|
@@ -17,5 +17,5 @@ export const OptionsStep = ({ getMessage, changeInfo, data }) => {
|
|
|
17
17
|
value: "selection"
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
return h("div", null, h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("formato")}` }, { label: getMessage("snkExporter.emailSenderOptStep_lblFormat"), direction: "horizontal", value:
|
|
20
|
+
return h("div", null, h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("formato")}` }, { label: getMessage("snkExporter.emailSenderOptStep_lblFormat"), direction: "horizontal", value: data === null || data === void 0 ? void 0 : data.format, onEzChange: evt => changeInfo("format", evt.detail), options: formatOptions })), h("ez-radio-button", Object.assign({ class: "ez-margin-bottom--large" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("type")}` }, { label: getMessage("snkExporter.emailSenderOptStep_export"), value: (data === null || data === void 0 ? void 0 : data.type) || "all", onEzChange: evt => changeInfo("type", evt.detail), options: typeOptions })));
|
|
21
21
|
};
|
|
@@ -26,13 +26,20 @@ export class SnkExporterEmailSender {
|
|
|
26
26
|
this._currentStep = 0;
|
|
27
27
|
}
|
|
28
28
|
open(config) {
|
|
29
|
-
|
|
29
|
+
var _a;
|
|
30
|
+
this._config = Object.assign(Object.assign({}, config), { format: (_a = config === null || config === void 0 ? void 0 : config.format) !== null && _a !== void 0 ? _a : "pdf" });
|
|
30
31
|
this._opened = true;
|
|
31
32
|
this.changeStep(0);
|
|
32
33
|
return new Promise(accept => {
|
|
33
34
|
this._promiseResolver = accept;
|
|
34
35
|
});
|
|
35
36
|
}
|
|
37
|
+
close() {
|
|
38
|
+
this._opened = false;
|
|
39
|
+
return new Promise(accept => {
|
|
40
|
+
this._promiseResolver = accept;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
36
43
|
getStepMessage(key) {
|
|
37
44
|
const stepInfo = this._stepInfo[this._currentStep] || {};
|
|
38
45
|
return this.getMessage(stepInfo[key]);
|
|
@@ -59,9 +66,6 @@ export class SnkExporterEmailSender {
|
|
|
59
66
|
const { format, type, email } = this._config;
|
|
60
67
|
this._promiseResolver({ format, type, email, report: undefined });
|
|
61
68
|
}
|
|
62
|
-
close() {
|
|
63
|
-
this._opened = false;
|
|
64
|
-
}
|
|
65
69
|
isFilled() {
|
|
66
70
|
var _a, _b;
|
|
67
71
|
return ((_a = this._config.email) === null || _a === void 0 ? void 0 : _a.to) && ((_b = this._config.email) === null || _b === void 0 ? void 0 : _b.subject) ? true : false;
|
|
@@ -77,12 +81,11 @@ export class SnkExporterEmailSender {
|
|
|
77
81
|
return stepInfo["secondButtonClass"] || "ez-button--secondary";
|
|
78
82
|
}
|
|
79
83
|
render() {
|
|
80
|
-
var _a;
|
|
81
84
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkExporterEmailSender');
|
|
82
85
|
return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: evt => {
|
|
83
86
|
if (evt.detail === "CLOSE")
|
|
84
87
|
this.close();
|
|
85
|
-
}, 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:
|
|
88
|
+
}, 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")}` }))))));
|
|
86
89
|
}
|
|
87
90
|
static get is() { return "snk-exporter-email-sender"; }
|
|
88
91
|
static get properties() {
|
|
@@ -139,6 +142,26 @@ export class SnkExporterEmailSender {
|
|
|
139
142
|
"text": "",
|
|
140
143
|
"tags": []
|
|
141
144
|
}
|
|
145
|
+
},
|
|
146
|
+
"close": {
|
|
147
|
+
"complexType": {
|
|
148
|
+
"signature": "() => Promise<IExportResult>",
|
|
149
|
+
"parameters": [],
|
|
150
|
+
"references": {
|
|
151
|
+
"Promise": {
|
|
152
|
+
"location": "global"
|
|
153
|
+
},
|
|
154
|
+
"IExportResult": {
|
|
155
|
+
"location": "import",
|
|
156
|
+
"path": "../data/export-result"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"return": "Promise<IExportResult>"
|
|
160
|
+
},
|
|
161
|
+
"docs": {
|
|
162
|
+
"text": "",
|
|
163
|
+
"tags": []
|
|
164
|
+
}
|
|
142
165
|
}
|
|
143
166
|
};
|
|
144
167
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h, Host } from '@stencil/core';
|
|
3
|
+
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
4
|
import { DataExporterOption } from './enum/data-exporter-option';
|
|
4
5
|
import fetchDataExporter from "../../lib/http/data-fetcher/fetchers/fetchDataExporter";
|
|
5
6
|
import fileViewer from "../../lib/utils/fileViewer";
|
|
@@ -20,6 +21,32 @@ export class SnkDataExporter {
|
|
|
20
21
|
*/
|
|
21
22
|
this.provider = null;
|
|
22
23
|
}
|
|
24
|
+
async exportByEmail() {
|
|
25
|
+
const selectedRows = this._selectedNumber;
|
|
26
|
+
const config = {
|
|
27
|
+
type: selectedRows > 0 ? "selection" : "all",
|
|
28
|
+
selectedRows,
|
|
29
|
+
email: {
|
|
30
|
+
attachments: [
|
|
31
|
+
{ name: this._appLabel }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this._snkEmailSender.open(config)
|
|
36
|
+
.then(({ format, email: { to, subject, message } }) => {
|
|
37
|
+
const methodName = this.getFormatExporter(format);
|
|
38
|
+
this.resolveExporter({ methodName, to, subject, message, fileName: this._appLabel, titleGrid: this._appLabel }, () => {
|
|
39
|
+
this._snkEmailSender.close();
|
|
40
|
+
ApplicationUtils.info(this.getMessage("snkDataExporter.message.emailSuccess"), { iconName: "check" });
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getFormatExporter(format) {
|
|
45
|
+
if (format === "xlsx") {
|
|
46
|
+
return DataExporterOption.EXPORT_XLS_TO_EMAIL;
|
|
47
|
+
}
|
|
48
|
+
return DataExporterOption.EXPORT_PDF_TO_EMAIL;
|
|
49
|
+
}
|
|
23
50
|
/**
|
|
24
51
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
25
52
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -56,24 +83,32 @@ export class SnkDataExporter {
|
|
|
56
83
|
controlDropdown() {
|
|
57
84
|
this._showDropdown = !this._showDropdown;
|
|
58
85
|
}
|
|
86
|
+
resolveExporter(resolveProps, callbackResolver) {
|
|
87
|
+
if (this.provider == undefined) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const filters = this.provider.getFilters();
|
|
91
|
+
const columns = this.provider.getColumnsMetadata();
|
|
92
|
+
const sort = this.provider.getOrders();
|
|
93
|
+
const resourceURI = this.provider.getResourceURI();
|
|
94
|
+
fetchDataExporter(Object.assign({ filters,
|
|
95
|
+
columns,
|
|
96
|
+
sort,
|
|
97
|
+
resourceURI }, resolveProps))
|
|
98
|
+
.then((result) => callbackResolver(result))
|
|
99
|
+
.catch(() => ApplicationUtils.error(this.getMessage("snkDataExporter.title.error"), this.getMessage("snkDataExporter.message.exportError")));
|
|
100
|
+
}
|
|
59
101
|
async processExporter(evt) {
|
|
60
102
|
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
61
103
|
if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
|
|
62
104
|
return;
|
|
63
105
|
}
|
|
64
|
-
if (item.id
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const columns = this.provider.getColumnsMetadata();
|
|
70
|
-
const sort = this.provider.getOrders();
|
|
71
|
-
const resourceURI = this.provider.getResourceURI();
|
|
72
|
-
fetchDataExporter({ filters, columns, sort, resourceURI, methodName: item.id })
|
|
73
|
-
.then((response) => fileViewer(Object.assign(Object.assign({}, response), { fileType: "PDF" })))
|
|
74
|
-
.catch(err => console.log(err));
|
|
106
|
+
if (item.id === DataExporterOption.EXPORT_BY_EMAIL) {
|
|
107
|
+
this.exportByEmail();
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.resolveExporter({ methodName: item.id, fileName: this._appLabel, titleGrid: this._appLabel }, (response) => (fileViewer(Object.assign(Object.assign({}, response), { fileType: "PDF" }))));
|
|
75
111
|
}
|
|
76
|
-
this.ezClickDataExporter.emit(item);
|
|
77
112
|
this._showDropdown = false;
|
|
78
113
|
}
|
|
79
114
|
getItems() {
|
|
@@ -92,6 +127,7 @@ export class SnkDataExporter {
|
|
|
92
127
|
}
|
|
93
128
|
componentWillLoad() {
|
|
94
129
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
130
|
+
this._application.getAppLabel().then(result => this._appLabel = result);
|
|
95
131
|
this.loadDropdown();
|
|
96
132
|
this.setEvents();
|
|
97
133
|
}
|
|
@@ -114,7 +150,7 @@ export class SnkDataExporter {
|
|
|
114
150
|
render() {
|
|
115
151
|
return (h(Host, null, h("div", { class: "snk-data-exporter" }, 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 &&
|
|
116
152
|
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 &&
|
|
117
|
-
h("div", Object.assign({ class: "ez-scrim ez-scrim-light" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("ezScrim")}` }))));
|
|
153
|
+
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) })));
|
|
118
154
|
}
|
|
119
155
|
static get is() { return "snk-data-exporter"; }
|
|
120
156
|
static get encapsulation() { return "scoped"; }
|
|
@@ -159,23 +195,5 @@ export class SnkDataExporter {
|
|
|
159
195
|
"_releasedToExport": {}
|
|
160
196
|
};
|
|
161
197
|
}
|
|
162
|
-
static get events() {
|
|
163
|
-
return [{
|
|
164
|
-
"method": "ezClickDataExporter",
|
|
165
|
-
"name": "ezClickDataExporter",
|
|
166
|
-
"bubbles": true,
|
|
167
|
-
"cancelable": true,
|
|
168
|
-
"composed": true,
|
|
169
|
-
"docs": {
|
|
170
|
-
"tags": [],
|
|
171
|
-
"text": "Evento emitido quando uma op\u00E7\u00E3o de exporta\u00E7\u00E3o for clicada."
|
|
172
|
-
},
|
|
173
|
-
"complexType": {
|
|
174
|
-
"original": "any",
|
|
175
|
-
"resolved": "any",
|
|
176
|
-
"references": {}
|
|
177
|
-
}
|
|
178
|
-
}];
|
|
179
|
-
}
|
|
180
198
|
static get elementRef() { return "_element"; }
|
|
181
199
|
}
|
|
@@ -3,7 +3,6 @@ import { ApplicationContext, DataType, ElementIDUtils } from '@sankhyalabs/core'
|
|
|
3
3
|
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
4
4
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
5
5
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
6
|
-
import { DataExporterOption } from '../snk-data-exporter/enum/data-exporter-option';
|
|
7
6
|
import store from "../../lib/store";
|
|
8
7
|
export class SnkGrid {
|
|
9
8
|
constructor() {
|
|
@@ -44,38 +43,6 @@ export class SnkGrid {
|
|
|
44
43
|
async setConfig(config) {
|
|
45
44
|
this.setGridConfig(config);
|
|
46
45
|
}
|
|
47
|
-
ezClickDataExporterHandler(event) {
|
|
48
|
-
var _a;
|
|
49
|
-
if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.id) === DataExporterOption.EXPORT_BY_EMAIL) {
|
|
50
|
-
// TODO: Quando o exportador de grades for implementado, essa ação
|
|
51
|
-
// vai fazer mostrar as opções disponíveis. Enviar por email será
|
|
52
|
-
// apenas mais uma
|
|
53
|
-
const selectedRows = this._dataState.selectedRecords.length;
|
|
54
|
-
const config = {
|
|
55
|
-
format: "pdf",
|
|
56
|
-
type: selectedRows > 0 ? "selection" : "all",
|
|
57
|
-
selectedRows,
|
|
58
|
-
email: {
|
|
59
|
-
attachments: [
|
|
60
|
-
{ name: "Movimentação Financeira.pdf", size: 1024 * 231 }
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
this._snkEmailSender.open(config)
|
|
65
|
-
.then((result) => {
|
|
66
|
-
this._application.message("resultado", JSON.stringify(result));
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
72
|
-
* através de um pequeno modulo na estrutura da aplicação:
|
|
73
|
-
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
74
|
-
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-grid.msg.ts"
|
|
75
|
-
*/
|
|
76
|
-
getMessage(key, params) {
|
|
77
|
-
return this._application.messagesBuilder.getMessage(key, params);
|
|
78
|
-
}
|
|
79
46
|
openGridConfig() {
|
|
80
47
|
this._grid.getColumnsState()
|
|
81
48
|
.then((gridColumns) => {
|
|
@@ -210,7 +177,7 @@ export class SnkGrid {
|
|
|
210
177
|
if (!this._dataUnit) {
|
|
211
178
|
return undefined;
|
|
212
179
|
}
|
|
213
|
-
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("
|
|
180
|
+
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.saveConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigCancel: () => this.closeGridConfig() }))));
|
|
214
181
|
}
|
|
215
182
|
static get is() { return "snk-grid"; }
|
|
216
183
|
static get encapsulation() { return "scoped"; }
|
|
@@ -444,13 +411,4 @@ export class SnkGrid {
|
|
|
444
411
|
};
|
|
445
412
|
}
|
|
446
413
|
static get elementRef() { return "_element"; }
|
|
447
|
-
static get listeners() {
|
|
448
|
-
return [{
|
|
449
|
-
"name": "ezClickDataExporter",
|
|
450
|
-
"method": "ezClickDataExporterHandler",
|
|
451
|
-
"target": undefined,
|
|
452
|
-
"capture": false,
|
|
453
|
-
"passive": false
|
|
454
|
-
}];
|
|
455
|
-
}
|
|
456
414
|
}
|
package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/permission-export-pdf.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DataFetcher } from '../../DataFetcher';
|
|
2
|
+
export default function permissionExportPdf() {
|
|
3
|
+
return new Promise((resolve, reject) => (DataFetcher.get()
|
|
4
|
+
.callServiceBroker("mge@UsuarioSP.usuarioLogadoPodeExportarPDF", "")
|
|
5
|
+
.then(result => { var _a; return resolve(((_a = result === null || result === void 0 ? void 0 : result.responseBody) === null || _a === void 0 ? void 0 : _a.$) === "S" ? true : false); })
|
|
6
|
+
.catch(error => reject(error))));
|
|
7
|
+
}
|
|
@@ -12,5 +12,12 @@ export const snkDataExporterMessages = {
|
|
|
12
12
|
spreadsheet: "Planilha",
|
|
13
13
|
cube: "Cubo",
|
|
14
14
|
sendByEmail: "Enviar por email",
|
|
15
|
+
},
|
|
16
|
+
message: {
|
|
17
|
+
emailSuccess: "E-mail enviado com sucesso",
|
|
18
|
+
exportError: "Erro ao realizar a exportação",
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
error: "Erro",
|
|
15
22
|
}
|
|
16
23
|
};
|
|
@@ -220,6 +220,13 @@ const snkDataExporterMessages = {
|
|
|
220
220
|
spreadsheet: "Planilha",
|
|
221
221
|
cube: "Cubo",
|
|
222
222
|
sendByEmail: "Enviar por email",
|
|
223
|
+
},
|
|
224
|
+
message: {
|
|
225
|
+
emailSuccess: "E-mail enviado com sucesso",
|
|
226
|
+
exportError: "Erro ao realizar a exportação",
|
|
227
|
+
},
|
|
228
|
+
title: {
|
|
229
|
+
error: "Erro",
|
|
223
230
|
}
|
|
224
231
|
};
|
|
225
232
|
|
|
@@ -1219,6 +1219,20 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1219
1219
|
accept(window['isDebugMode']);
|
|
1220
1220
|
});
|
|
1221
1221
|
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Obtém o nome das telas da aplicação
|
|
1224
|
+
*/
|
|
1225
|
+
async getAppLabel() {
|
|
1226
|
+
if ((window === null || window === void 0 ? void 0 : window["workspace"]) == undefined) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1229
|
+
if (window["workspace"].getAppLabel == undefined) {
|
|
1230
|
+
window["workspace"].getAppLabel = (resourceID) => {
|
|
1231
|
+
return (resourceID || "").split(".").pop();
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
return window["workspace"].getAppLabel(this._resourceID);
|
|
1235
|
+
}
|
|
1222
1236
|
clearContent(container) {
|
|
1223
1237
|
if (container) {
|
|
1224
1238
|
Array.from(container.children).forEach(child => {
|
|
@@ -1319,7 +1333,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1319
1333
|
"getDefaultValue": [64],
|
|
1320
1334
|
"executeSearch": [64],
|
|
1321
1335
|
"executePreparedSearch": [64],
|
|
1322
|
-
"isDebugMode": [64]
|
|
1336
|
+
"isDebugMode": [64],
|
|
1337
|
+
"getAppLabel": [64]
|
|
1323
1338
|
}]);
|
|
1324
1339
|
class RequestListenerLoadingBar {
|
|
1325
1340
|
constructor() {
|