@sankhyalabs/sankhyablocks 2.5.2 → 2.6.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/{SnkMessageBuilder-370e23ae.js → SnkMessageBuilder-09b25b0a.js} +20 -1
- package/dist/cjs/data-exporter-option-417da37a.js +19 -0
- package/dist/cjs/{index-20e8b68a.js → index-2cd6f753.js} +26 -0
- package/dist/cjs/index-696b5c3b.js +200 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +2 -2
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator_3.cjs.entry.js +71 -13
- package/dist/cjs/snk-crud.cjs.entry.js +3 -2
- package/dist/cjs/{snk-exporter-email-sender_8.cjs.entry.js → snk-data-exporter_9.cjs.entry.js} +305 -8
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- 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-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/{taskbar-elements-3807c809.js → taskbar-elements-bbb89cdb.js} +8 -5
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-crud/snk-crud.js +4 -2
- package/dist/collection/components/snk-data-exporter/enum/data-exporter-option.js +11 -0
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +4 -4
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +1 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.css +19 -0
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +181 -0
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +140 -0
- package/dist/collection/components/snk-form/snk-form.js +4 -2
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +3 -1
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +4 -2
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +3 -1
- package/dist/collection/components/snk-grid/snk-grid.js +69 -10
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +7 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +33 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterResponse.js +1 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +16 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
- package/dist/collection/lib/store/index.js +5 -0
- package/dist/collection/lib/utils/fileViewer/index.js +3 -0
- package/dist/collection/lib/utils/fileViewer/interfaces/IFileViewerParams.js +1 -0
- package/dist/components/ConfigStorage.js +3 -6694
- package/dist/components/DataFetcher.js +6695 -0
- package/dist/components/SnkMessageBuilder.js +20 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-application2.js +2 -1
- package/dist/components/snk-config-options2.js +1 -1
- package/dist/components/snk-crud.js +11 -5
- package/dist/components/snk-data-exporter.d.ts +11 -0
- package/dist/components/snk-data-exporter.js +6 -0
- package/dist/components/snk-data-exporter2.js +330 -0
- package/dist/components/snk-field-config2.js +1 -1
- package/dist/components/snk-form-config2.js +2 -2
- package/dist/components/snk-form2.js +9 -3
- package/dist/components/snk-grid2.js +74 -10
- package/dist/components/snk-taskbar2.js +212 -9
- package/dist/esm/{SnkMessageBuilder-7d583c9a.js → SnkMessageBuilder-47db5d75.js} +20 -1
- package/dist/esm/data-exporter-option-006307dd.js +19 -0
- package/dist/esm/{index-e4121713.js → index-a77b6f35.js} +25 -1
- package/dist/esm/index-d89e384f.js +198 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +2 -2
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/snk-configurator_3.entry.js +68 -10
- package/dist/esm/snk-crud.entry.js +3 -2
- package/dist/esm/{snk-exporter-email-sender_8.entry.js → snk-data-exporter_9.entry.js} +304 -8
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-detail.entry.js +1 -1
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-filter-period.entry.js +1 -1
- package/dist/esm/snk-filter-personalized.entry.js +1 -1
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/{taskbar-elements-b2bbe275.js → taskbar-elements-beec3b27.js} +8 -5
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-a3871147.entry.js → p-02d430a7.entry.js} +3 -3
- package/dist/sankhyablocks/p-04581d0c.entry.js +1 -0
- package/dist/sankhyablocks/p-112bb324.js +1 -0
- package/dist/sankhyablocks/{p-c17be74f.entry.js → p-12ebe36a.entry.js} +1 -1
- package/dist/sankhyablocks/p-13116d05.entry.js +1 -0
- package/dist/sankhyablocks/{p-14af45cc.entry.js → p-187b0d06.entry.js} +1 -1
- package/dist/sankhyablocks/{p-570cc474.entry.js → p-1a2533d0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fd3b562d.entry.js → p-1ccaea51.entry.js} +1 -1
- package/dist/sankhyablocks/p-1d7a0daf.js +1 -0
- package/dist/sankhyablocks/p-50c8bcb7.entry.js +1 -0
- package/dist/sankhyablocks/{p-44ce5b90.entry.js → p-57895452.entry.js} +1 -1
- package/dist/sankhyablocks/{p-48bbbd2c.entry.js → p-68fcc226.entry.js} +1 -1
- package/dist/sankhyablocks/p-719e570a.js +1 -0
- package/dist/sankhyablocks/{p-00b3c5d8.entry.js → p-772f1c44.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c30d0966.entry.js → p-82e20fc0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-eff899b0.entry.js → p-91c23d20.entry.js} +1 -1
- package/dist/sankhyablocks/p-a77dd79a.js +2 -0
- package/dist/sankhyablocks/{p-f50c6ef6.entry.js → p-ab4ff312.entry.js} +1 -1
- package/dist/sankhyablocks/p-c8327a5c.js +1 -0
- package/dist/sankhyablocks/{p-2664ae24.entry.js → p-d3e402d3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9593c937.entry.js → p-d7ae56ce.entry.js} +1 -1
- package/dist/sankhyablocks/{p-70e52fee.entry.js → p-d96bf6a7.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b0a0222f.entry.js → p-df5d94c6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-db111acd.entry.js → p-e075dba7.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-exporter/data/attachment.d.ts +1 -1
- package/dist/types/components/snk-data-exporter/data/email.d.ts +3 -3
- package/dist/types/components/snk-data-exporter/data/export-config.d.ts +5 -5
- package/dist/types/components/snk-data-exporter/data/export-result.d.ts +5 -5
- package/dist/types/components/snk-data-exporter/data/report.d.ts +1 -1
- package/dist/types/components/snk-data-exporter/enum/data-exporter-option.d.ts +10 -0
- package/dist/types/components/snk-data-exporter/exporter-email-sender/email-info-step.d.ts +4 -4
- package/dist/types/components/snk-data-exporter/exporter-email-sender/options-step.d.ts +4 -4
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +9 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +40 -0
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +61 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -1
- package/dist/types/components.d.ts +33 -3
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +14 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterResponse.d.ts +7 -0
- package/dist/types/lib/message/resources/snk-data-exporter.msg.d.ts +1 -0
- package/dist/types/lib/store/index.d.ts +4 -0
- package/dist/types/lib/utils/fileViewer/index.d.ts +2 -0
- package/dist/types/lib/utils/fileViewer/interfaces/IFileViewerParams.d.ts +4 -0
- package/package.json +2 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/AuthorizationConfig-79ffae4b.js +0 -7
- package/dist/esm/AuthorizationConfig-dcbd207a.js +0 -7
- package/dist/sankhyablocks/p-8a872a35.entry.js +0 -1
- package/dist/sankhyablocks/p-9ba3df4c.js +0 -2
- package/dist/sankhyablocks/p-9e67cf79.entry.js +0 -1
- package/dist/sankhyablocks/p-c118ef2a.entry.js +0 -1
- package/dist/sankhyablocks/p-dbaad88c.js +0 -1
- package/dist/sankhyablocks/p-dc36cfbf.js +0 -1
- package/dist/sankhyablocks/p-e7f772ed.js +0 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { h, Host } from '@stencil/core';
|
|
3
|
+
import { DataExporterOption } from './enum/data-exporter-option';
|
|
4
|
+
import fetchDataExporter from "../../lib/http/data-fetcher/fetchers/fetchDataExporter";
|
|
5
|
+
import fileViewer from "../../lib/utils/fileViewer";
|
|
6
|
+
import { ItemBuilder } from './structure/ItemBuilder';
|
|
7
|
+
export class SnkDataExporter {
|
|
8
|
+
constructor() {
|
|
9
|
+
this._items = [];
|
|
10
|
+
this._selectedNumber = 0;
|
|
11
|
+
this._showDropdown = false;
|
|
12
|
+
this._releasedToExport = [
|
|
13
|
+
DataExporterOption.EXPORT_TO_PDF,
|
|
14
|
+
DataExporterOption.EXPORT_BY_EMAIL,
|
|
15
|
+
DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
|
16
|
+
DataExporterOption.EXPORT_XLS_TO_EMAIL
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Provedor das informações para exportação dos dados.
|
|
20
|
+
*/
|
|
21
|
+
this.provider = null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
25
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
26
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
27
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-data-exporter.msg.ts"
|
|
28
|
+
*/
|
|
29
|
+
getMessage(key, params) {
|
|
30
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
31
|
+
}
|
|
32
|
+
positionDropdown() {
|
|
33
|
+
var _a;
|
|
34
|
+
const bounding = (_a = this._ezButton) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
35
|
+
if (bounding == undefined || this._ezDropdown == undefined) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this._ezDropdown.style.top = (bounding.y + bounding.height + 5) + "px";
|
|
39
|
+
this._ezDropdown.style.left = bounding.x + "px";
|
|
40
|
+
}
|
|
41
|
+
closeDropdown(evt) {
|
|
42
|
+
const target = evt === null || evt === void 0 ? void 0 : evt.target;
|
|
43
|
+
if (target == undefined) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!target.closest(".snk-data-exporter")) {
|
|
47
|
+
this._showDropdown = false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
setEvents() {
|
|
51
|
+
document.removeEventListener("click", this.closeDropdown.bind(this));
|
|
52
|
+
document.addEventListener("click", this.closeDropdown.bind(this));
|
|
53
|
+
document.removeEventListener("scroll", this.positionDropdown.bind(this));
|
|
54
|
+
document.addEventListener("scroll", this.positionDropdown.bind(this));
|
|
55
|
+
}
|
|
56
|
+
controlDropdown() {
|
|
57
|
+
this._showDropdown = !this._showDropdown;
|
|
58
|
+
}
|
|
59
|
+
async processExporter(evt) {
|
|
60
|
+
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
61
|
+
if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (item.id !== DataExporterOption.EXPORT_BY_EMAIL) {
|
|
65
|
+
if (this.provider == undefined) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const filters = this.provider.getFilters();
|
|
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));
|
|
75
|
+
}
|
|
76
|
+
this.ezClickDataExporter.emit(item);
|
|
77
|
+
this._showDropdown = false;
|
|
78
|
+
}
|
|
79
|
+
getItems() {
|
|
80
|
+
const items = [];
|
|
81
|
+
this._releasedToExport
|
|
82
|
+
.forEach((option) => {
|
|
83
|
+
this._itemBuilder.setExportOption(option, items);
|
|
84
|
+
});
|
|
85
|
+
return items;
|
|
86
|
+
}
|
|
87
|
+
loadDropdown() {
|
|
88
|
+
var _a;
|
|
89
|
+
this._selectedNumber = ((_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedNumber()) || 0;
|
|
90
|
+
this._itemBuilder = new ItemBuilder(this.getMessage.bind(this), this._selectedNumber);
|
|
91
|
+
this._items = this.getItems();
|
|
92
|
+
}
|
|
93
|
+
componentWillLoad() {
|
|
94
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
95
|
+
this.loadDropdown();
|
|
96
|
+
this.setEvents();
|
|
97
|
+
}
|
|
98
|
+
componentDidLoad() {
|
|
99
|
+
if (this._element == undefined) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
ElementIDUtils.addIDInfo(this._element);
|
|
103
|
+
}
|
|
104
|
+
componentWillUpdate() {
|
|
105
|
+
if (this._showDropdown) {
|
|
106
|
+
this.loadDropdown();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
componentDidUpdate() {
|
|
110
|
+
if (this._showDropdown) {
|
|
111
|
+
this.positionDropdown();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
render() {
|
|
115
|
+
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
|
+
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")}` }))));
|
|
118
|
+
}
|
|
119
|
+
static get is() { return "snk-data-exporter"; }
|
|
120
|
+
static get encapsulation() { return "scoped"; }
|
|
121
|
+
static get originalStyleUrls() {
|
|
122
|
+
return {
|
|
123
|
+
"$": ["snk-data-exporter.css"]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
static get styleUrls() {
|
|
127
|
+
return {
|
|
128
|
+
"$": ["snk-data-exporter.css"]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
static get properties() {
|
|
132
|
+
return {
|
|
133
|
+
"provider": {
|
|
134
|
+
"type": "unknown",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "IExporterProvider",
|
|
138
|
+
"resolved": "IExporterProvider",
|
|
139
|
+
"references": {
|
|
140
|
+
"IExporterProvider": {
|
|
141
|
+
"location": "import",
|
|
142
|
+
"path": "./interfaces/IExporterProvider"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "Provedor das informa\u00E7\u00F5es para exporta\u00E7\u00E3o dos dados."
|
|
151
|
+
},
|
|
152
|
+
"defaultValue": "null"
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
static get states() {
|
|
157
|
+
return {
|
|
158
|
+
"_showDropdown": {},
|
|
159
|
+
"_releasedToExport": {}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
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
|
+
static get elementRef() { return "_element"; }
|
|
181
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { DataExporterOption } from "../enum/data-exporter-option";
|
|
2
|
+
export class ItemBuilder {
|
|
3
|
+
constructor(getMessage, selectedNumber) {
|
|
4
|
+
this._selectedNumber = 0;
|
|
5
|
+
this._getMessage = getMessage;
|
|
6
|
+
this._selectedNumber = selectedNumber;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Método responsável por inserir os items no array de opções.
|
|
10
|
+
* @param option - Nome da opção que será inserida no array.
|
|
11
|
+
* @param items - Array que será alimentado com as opções permitidas.
|
|
12
|
+
*/
|
|
13
|
+
setExportOption(option, items) {
|
|
14
|
+
const groupName = this.getExportGroupName();
|
|
15
|
+
if (option === DataExporterOption.EXPORT_TO_PDF) {
|
|
16
|
+
items.push(this.getExportToPDF(groupName));
|
|
17
|
+
}
|
|
18
|
+
if (option === DataExporterOption.EXPORT_TO_XLS) {
|
|
19
|
+
items.push(this.getExportToXLS(groupName));
|
|
20
|
+
}
|
|
21
|
+
this.setExportCurrentPage(option, items);
|
|
22
|
+
this.setExportByEmail(option, items);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Método responsável por inserir os itens de exportação personalizada.
|
|
26
|
+
* @param option - Nome da opção que será inserida no array.
|
|
27
|
+
* @param items - Array que será alimentado com as opções permitidas.
|
|
28
|
+
*/
|
|
29
|
+
setExportCurrentPage(option, items) {
|
|
30
|
+
var _a;
|
|
31
|
+
const pageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
|
|
32
|
+
if (option === DataExporterOption.EXPORT_CURRENT_PAGE) {
|
|
33
|
+
items.push(this.getCurrentPage());
|
|
34
|
+
}
|
|
35
|
+
if (pageOptions.includes(option)) {
|
|
36
|
+
let item = items.find((item) => item.id === DataExporterOption.EXPORT_CURRENT_PAGE);
|
|
37
|
+
if (item == undefined) {
|
|
38
|
+
items.push(this.getCurrentPage());
|
|
39
|
+
item = items.find((item) => item.id === DataExporterOption.EXPORT_CURRENT_PAGE);
|
|
40
|
+
}
|
|
41
|
+
if (!((_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
42
|
+
item.children = [];
|
|
43
|
+
}
|
|
44
|
+
if (option === DataExporterOption.EXPORT_PAGE_TO_PDF) {
|
|
45
|
+
item.children.push(this.getExportPageToPDF());
|
|
46
|
+
}
|
|
47
|
+
if (option === DataExporterOption.EXPORT_PAGE_TO_XLS) {
|
|
48
|
+
item.children.push(this.getExportPageToXLS());
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Método responsável por inserir os itens de exportação por e-mail.
|
|
54
|
+
* @param option - Nome da opção que será inserida no array.
|
|
55
|
+
* @param items - Array que será alimentado com as opções permitidas.
|
|
56
|
+
*/
|
|
57
|
+
setExportByEmail(option, items) {
|
|
58
|
+
if (option === DataExporterOption.EXPORT_BY_EMAIL) {
|
|
59
|
+
items.push(this.getExportByEmail());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Método responsável por capturar o objeto com os dados de exportação em PDF.
|
|
64
|
+
* @param groupName - Nome do grupo da opção que será inserida na lista.
|
|
65
|
+
* @returns Retorna o objeto com os dados de exportação em PDF.
|
|
66
|
+
*/
|
|
67
|
+
getExportToPDF(groupName) {
|
|
68
|
+
return {
|
|
69
|
+
id: DataExporterOption.EXPORT_TO_PDF,
|
|
70
|
+
label: "PDF (.pdf)",
|
|
71
|
+
group: groupName
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Método responsável por capturar o objeto com os dados de exportação em XLS.
|
|
76
|
+
* @param groupName - Nome do grupo da opção que será inserida na lista.
|
|
77
|
+
* @returns Retorna o objeto com os dados de exportação em XLS.
|
|
78
|
+
*/
|
|
79
|
+
getExportToXLS(groupName) {
|
|
80
|
+
return {
|
|
81
|
+
id: DataExporterOption.EXPORT_TO_XLS,
|
|
82
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`,
|
|
83
|
+
group: groupName
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Método responsável por capturar o objeto com os dados de exportação personalizada.
|
|
88
|
+
* @returns Retorna o objeto com os dados de exportação personalizada.
|
|
89
|
+
*/
|
|
90
|
+
getCurrentPage() {
|
|
91
|
+
return {
|
|
92
|
+
id: DataExporterOption.EXPORT_CURRENT_PAGE,
|
|
93
|
+
label: this._getMessage("snkDataExporter.label.currentPage"),
|
|
94
|
+
group: this._getMessage("snkDataExporter.group.custom")
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Método responsável por capturar o objeto com os dados de exportação personalizada em PDF.
|
|
99
|
+
* @returns Retorna o objeto com os dados de exportação personalizada em PDF.
|
|
100
|
+
*/
|
|
101
|
+
getExportPageToPDF() {
|
|
102
|
+
return {
|
|
103
|
+
id: DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
104
|
+
label: "PDF (.pdf)"
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Método responsável por capturar o objeto com os dados de exportação personalizada em XLS.
|
|
109
|
+
* @returns Retorna o objeto com os dados de exportação personalizada em XLS.
|
|
110
|
+
*/
|
|
111
|
+
getExportPageToXLS() {
|
|
112
|
+
return {
|
|
113
|
+
id: DataExporterOption.EXPORT_PAGE_TO_XLS,
|
|
114
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Método responsável por capturar o objeto com os dados de exportação por e-mail.
|
|
119
|
+
* @returns Retorna o objeto com os dados de exportação por e-mail.
|
|
120
|
+
*/
|
|
121
|
+
getExportByEmail() {
|
|
122
|
+
return {
|
|
123
|
+
id: DataExporterOption.EXPORT_BY_EMAIL,
|
|
124
|
+
label: `${this._getMessage("snkDataExporter.label.sendByEmail")}...`
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Método responsável por capturar o nome do grupo da opção que será inserida na lista.
|
|
129
|
+
* @returns Retorna o nome do grupo da opção que será inserida na lista.
|
|
130
|
+
*/
|
|
131
|
+
getExportGroupName() {
|
|
132
|
+
if (this._selectedNumber === 1) {
|
|
133
|
+
return this._getMessage("snkDataExporter.group.export.selectedLine");
|
|
134
|
+
}
|
|
135
|
+
if (this._selectedNumber > 1) {
|
|
136
|
+
return this._getMessage("snkDataExporter.group.export.multiSelected").replace('{0}', this._selectedNumber.toString());
|
|
137
|
+
}
|
|
138
|
+
return this._getMessage("snkDataExporter.group.export.default");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -221,7 +221,7 @@ export class SnkForm {
|
|
|
221
221
|
"reflect": false
|
|
222
222
|
},
|
|
223
223
|
"recordsValidator": {
|
|
224
|
-
"type": "
|
|
224
|
+
"type": "any",
|
|
225
225
|
"mutable": false,
|
|
226
226
|
"complexType": {
|
|
227
227
|
"original": "IRecordValidator",
|
|
@@ -238,7 +238,9 @@ export class SnkForm {
|
|
|
238
238
|
"docs": {
|
|
239
239
|
"tags": [],
|
|
240
240
|
"text": "Validador respons\u00E1vel por checar a integridade das informa\u00E7\u00F5es do registro."
|
|
241
|
-
}
|
|
241
|
+
},
|
|
242
|
+
"attribute": "records-validator",
|
|
243
|
+
"reflect": false
|
|
242
244
|
},
|
|
243
245
|
"actionsList": {
|
|
244
246
|
"type": "unknown",
|
package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js
CHANGED
|
@@ -240,7 +240,7 @@ export class SnkConfigOptions {
|
|
|
240
240
|
static get properties() {
|
|
241
241
|
return {
|
|
242
242
|
"fieldConfig": {
|
|
243
|
-
"type": "
|
|
243
|
+
"type": "any",
|
|
244
244
|
"mutable": false,
|
|
245
245
|
"complexType": {
|
|
246
246
|
"original": "IFieldConfig",
|
|
@@ -258,6 +258,8 @@ export class SnkConfigOptions {
|
|
|
258
258
|
"tags": [],
|
|
259
259
|
"text": "Armazena as propriedades do campo."
|
|
260
260
|
},
|
|
261
|
+
"attribute": "field-config",
|
|
262
|
+
"reflect": true,
|
|
261
263
|
"defaultValue": "{} as IFieldConfig"
|
|
262
264
|
},
|
|
263
265
|
"idConfig": {
|
package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js
CHANGED
|
@@ -84,7 +84,7 @@ export class SnkFieldConfig {
|
|
|
84
84
|
"defaultValue": "false"
|
|
85
85
|
},
|
|
86
86
|
"fieldConfig": {
|
|
87
|
-
"type": "
|
|
87
|
+
"type": "any",
|
|
88
88
|
"mutable": false,
|
|
89
89
|
"complexType": {
|
|
90
90
|
"original": "IFieldConfig",
|
|
@@ -101,7 +101,9 @@ export class SnkFieldConfig {
|
|
|
101
101
|
"docs": {
|
|
102
102
|
"tags": [],
|
|
103
103
|
"text": "Armazena as propriedades do campo."
|
|
104
|
-
}
|
|
104
|
+
},
|
|
105
|
+
"attribute": "field-config",
|
|
106
|
+
"reflect": true
|
|
105
107
|
},
|
|
106
108
|
"modeInsertion": {
|
|
107
109
|
"type": "boolean",
|
package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js
CHANGED
|
@@ -1001,7 +1001,7 @@ export class SnkFormConfig {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
},
|
|
1003
1003
|
"formConfig": {
|
|
1004
|
-
"type": "
|
|
1004
|
+
"type": "any",
|
|
1005
1005
|
"mutable": false,
|
|
1006
1006
|
"complexType": {
|
|
1007
1007
|
"original": "IFormConfig",
|
|
@@ -1019,6 +1019,8 @@ export class SnkFormConfig {
|
|
|
1019
1019
|
"tags": [],
|
|
1020
1020
|
"text": "Campos de configura\u00E7\u00E3o de formul\u00E1rio."
|
|
1021
1021
|
},
|
|
1022
|
+
"attribute": "form-config",
|
|
1023
|
+
"reflect": true,
|
|
1022
1024
|
"defaultValue": "{} as IFormConfig"
|
|
1023
1025
|
},
|
|
1024
1026
|
"configName": {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
|
-
import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { ApplicationContext, DataType, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
3
4
|
import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
|
|
4
5
|
import { ConfigStorage } from '../../lib/configs/ConfigStorage';
|
|
5
|
-
import {
|
|
6
|
+
import { DataExporterOption } from '../snk-data-exporter/enum/data-exporter-option';
|
|
7
|
+
import store from "../../lib/store";
|
|
6
8
|
export class SnkGrid {
|
|
7
9
|
constructor() {
|
|
8
10
|
this._topTaskbarProcessor = new TaskbarProcessor({
|
|
9
11
|
"snkGridTopTaskbar": ["FORM_MODE", "CONFIGURATOR", "INSERT"]
|
|
10
12
|
});
|
|
11
13
|
this._headerTaskbarProcessor = new TaskbarProcessor({
|
|
12
|
-
"snkGridHeaderTaskbar.unselected": ["REFRESH", "
|
|
13
|
-
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH", "
|
|
14
|
+
"snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER"],
|
|
15
|
+
"snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH", "DATA_EXPORTER"]
|
|
14
16
|
});
|
|
15
17
|
this._popUpGridConfig = false;
|
|
16
18
|
/**
|
|
@@ -42,8 +44,9 @@ export class SnkGrid {
|
|
|
42
44
|
async setConfig(config) {
|
|
43
45
|
this.setGridConfig(config);
|
|
44
46
|
}
|
|
45
|
-
|
|
46
|
-
|
|
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) {
|
|
47
50
|
// TODO: Quando o exportador de grades for implementado, essa ação
|
|
48
51
|
// vai fazer mostrar as opções disponíveis. Enviar por email será
|
|
49
52
|
// apenas mais uma
|
|
@@ -112,6 +115,61 @@ export class SnkGrid {
|
|
|
112
115
|
this.closeGridConfig();
|
|
113
116
|
});
|
|
114
117
|
}
|
|
118
|
+
buildColumnsMetadata(columnsMetadata, gridColumns) {
|
|
119
|
+
gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
|
|
120
|
+
var _a, _b, _c, _d, _e;
|
|
121
|
+
if (column.hidden) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const fieldData = (_d = (_c = (_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.filter((field) => field.name === column.name)) === null || _d === void 0 ? void 0 : _d[0];
|
|
125
|
+
const columnData = {
|
|
126
|
+
label: column.label,
|
|
127
|
+
id: column.name,
|
|
128
|
+
width: column.width,
|
|
129
|
+
dataType: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
|
130
|
+
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
|
|
131
|
+
};
|
|
132
|
+
columnsMetadata.push(columnData);
|
|
133
|
+
if (((_e = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _e === void 0 ? void 0 : _e.DESCRIPTIONFIELD) != undefined) {
|
|
134
|
+
const descriptionColumn = {
|
|
135
|
+
label: fieldData.properties.DESCRIPTIONENTITY,
|
|
136
|
+
id: fieldData.properties.ENTITYNAME + "." + fieldData.properties.DESCRIPTIONFIELD,
|
|
137
|
+
width: 200,
|
|
138
|
+
dataType: DataType.TEXT,
|
|
139
|
+
userInterface: UserInterface.LONGTEXT
|
|
140
|
+
};
|
|
141
|
+
columnsMetadata.push(descriptionColumn);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return columnsMetadata || [];
|
|
145
|
+
}
|
|
146
|
+
async dataExporterProviderStore() {
|
|
147
|
+
var _a;
|
|
148
|
+
const columnsMetadata = [];
|
|
149
|
+
await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState().then(this.buildColumnsMetadata.bind(this, columnsMetadata)));
|
|
150
|
+
const dataExporterProvider = {
|
|
151
|
+
getFilters: () => {
|
|
152
|
+
var _a;
|
|
153
|
+
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getFilters();
|
|
154
|
+
},
|
|
155
|
+
getColumnsMetadata: () => {
|
|
156
|
+
return columnsMetadata;
|
|
157
|
+
},
|
|
158
|
+
getOrders: () => {
|
|
159
|
+
var _a;
|
|
160
|
+
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
|
|
161
|
+
},
|
|
162
|
+
getResourceURI: () => {
|
|
163
|
+
var _a;
|
|
164
|
+
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
165
|
+
},
|
|
166
|
+
getSelectedNumber: () => {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) === null || _b === void 0 ? void 0 : _b.length;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
|
|
172
|
+
}
|
|
115
173
|
componentWillLoad() {
|
|
116
174
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
117
175
|
let parent = this._element.parentElement;
|
|
@@ -138,10 +196,11 @@ export class SnkGrid {
|
|
|
138
196
|
this.loadConfig();
|
|
139
197
|
}
|
|
140
198
|
componentWillRender() {
|
|
141
|
-
const invisibleButtons = this.enableDataExporter ? [] : ["
|
|
199
|
+
const invisibleButtons = this.enableDataExporter && this._dataUnit && this._dataUnit.records.length > 0 ? [] : ["DATA_EXPORTER"];
|
|
142
200
|
const headerTaskbarId = this._dataState && this._dataState.selectedRecords.length > 0 ? "snkGridHeaderTaskbar.selected" : "snkGridHeaderTaskbar.unselected";
|
|
143
201
|
this._headerTaskbarProcessor.process(headerTaskbarId, this.taskbarManager, this._dataState, undefined, invisibleButtons);
|
|
144
202
|
this._topTaskbarProcessor.process("snkGridTopTaskbar", this.taskbarManager, this._dataState, undefined, invisibleButtons);
|
|
203
|
+
this.dataExporterProviderStore();
|
|
145
204
|
}
|
|
146
205
|
addElementID() {
|
|
147
206
|
const dataInfo = { dataUnit: this._dataUnit };
|
|
@@ -151,7 +210,7 @@ export class SnkGrid {
|
|
|
151
210
|
if (!this._dataUnit) {
|
|
152
211
|
return undefined;
|
|
153
212
|
}
|
|
154
|
-
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, "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("snk-exporter-email-sender", { ref: ref => this._snkEmailSender = ref, getMessage: (key, params) => this.getMessage(key, params) }), 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() }))));
|
|
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("snk-exporter-email-sender", { ref: ref => this._snkEmailSender = ref, getMessage: (key, params) => this.getMessage(key, params) }), 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() }))));
|
|
155
214
|
}
|
|
156
215
|
static get is() { return "snk-grid"; }
|
|
157
216
|
static get encapsulation() { return "scoped"; }
|
|
@@ -387,8 +446,8 @@ export class SnkGrid {
|
|
|
387
446
|
static get elementRef() { return "_element"; }
|
|
388
447
|
static get listeners() {
|
|
389
448
|
return [{
|
|
390
|
-
"name": "
|
|
391
|
-
"method": "
|
|
449
|
+
"name": "ezClickDataExporter",
|
|
450
|
+
"method": "ezClickDataExporterHandler",
|
|
392
451
|
"target": undefined,
|
|
393
452
|
"capture": false,
|
|
394
453
|
"passive": false
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
+
import store from "../../../lib/store";
|
|
2
3
|
export var TaskbarElement;
|
|
3
4
|
(function (TaskbarElement) {
|
|
4
5
|
TaskbarElement["PREVIOUS"] = "PREVIOUS";
|
|
@@ -15,7 +16,7 @@ export var TaskbarElement;
|
|
|
15
16
|
TaskbarElement["MORE_OPTIONS"] = "MORE_OPTIONS";
|
|
16
17
|
TaskbarElement["DIVIDER"] = "DIVIDER";
|
|
17
18
|
TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
|
|
18
|
-
TaskbarElement["
|
|
19
|
+
TaskbarElement["DATA_EXPORTER"] = "DATA_EXPORTER";
|
|
19
20
|
})(TaskbarElement || (TaskbarElement = {}));
|
|
20
21
|
export var AuthorizationElements;
|
|
21
22
|
(function (AuthorizationElements) {
|
|
@@ -43,7 +44,8 @@ export const buildCustomButton = (def, className, dataElementId, action, isEnabl
|
|
|
43
44
|
return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
|
-
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions) => {
|
|
47
|
+
export const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, configName) => {
|
|
48
|
+
var _a;
|
|
47
49
|
const title = getTitle(element);
|
|
48
50
|
switch (element) {
|
|
49
51
|
case TaskbarElement.PREVIOUS:
|
|
@@ -70,12 +72,13 @@ export const buildElem = (element, className, dataElementId, getTitle, action, i
|
|
|
70
72
|
return iconButton("list", element, className, dataElementId, title, action, isEnabled);
|
|
71
73
|
case TaskbarElement.CONFIGURATOR:
|
|
72
74
|
return iconButton("settings-inverted", element, className, dataElementId, title, action, isEnabled);
|
|
73
|
-
case TaskbarElement.EXPORT:
|
|
74
|
-
return iconButton("file-download", element, className, dataElementId, title, action, isEnabled);
|
|
75
75
|
case TaskbarElement.MORE_OPTIONS:
|
|
76
76
|
return actionButton(element, className, dataElementId, title, action, isEnabled, actions);
|
|
77
77
|
case TaskbarElement.DIVIDER:
|
|
78
78
|
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium", "data-taskbar-divider": true });
|
|
79
|
+
case TaskbarElement.DATA_EXPORTER:
|
|
80
|
+
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
|
|
81
|
+
return h("snk-data-exporter", { class: className, title: title, provider: provider, "data-element-id": dataElementId });
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
84
|
function textButton(name, className, dataElementId, text, title, action, isEnabled) {
|
|
@@ -18,7 +18,7 @@ export class SnkTaskbar {
|
|
|
18
18
|
[TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
|
|
19
19
|
[TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
|
|
20
20
|
[TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
|
|
21
|
-
[TaskbarElement.
|
|
21
|
+
[TaskbarElement.DATA_EXPORTER]: "snkTaskbar.titleDataExporter"
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
observeButtons() {
|
|
@@ -109,7 +109,7 @@ export class SnkTaskbar {
|
|
|
109
109
|
className += "ez-padding-left--medium";
|
|
110
110
|
}
|
|
111
111
|
if (TaskbarElement[def.toString()]) {
|
|
112
|
-
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
|
|
112
|
+
return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList, this.configName);
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
115
|
return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { ObjectUtils } from "@sankhyalabs/core";
|
|
14
|
+
import { DataFetcher } from '../../DataFetcher';
|
|
15
|
+
export default function fetchDataExporter(_a) {
|
|
16
|
+
var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
|
|
17
|
+
const serviceName = `DataExporterSPBean.${methodName}`;
|
|
18
|
+
const payload = { serviceName, requestBody };
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
DataFetcher.get()
|
|
21
|
+
.callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
|
|
22
|
+
.then(result => resolve(getFormatResponse(result)))
|
|
23
|
+
.catch(error => reject(error));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function getFormatResponse(result) {
|
|
27
|
+
var _a;
|
|
28
|
+
const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
|
|
29
|
+
if (response == undefined) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
return ObjectUtils.stringToObject(response);
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,6 +6,7 @@ import snkExporterMessages from "./resources/snk-exporter.msg.js";
|
|
|
6
6
|
import { snkFormMessages, snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg.js";
|
|
7
7
|
import { snkConfiguratorMessages } from "./resources/snk-configurator.msg.js";
|
|
8
8
|
import { snkGridMessages, snkGridConfigMessages } from "./resources/snk-grid.msg.js";
|
|
9
|
+
import { snkDataExporterMessages } from "./resources/snk-data-exporter.msg.js";
|
|
9
10
|
export class SnkMessageBuilder {
|
|
10
11
|
constructor() {
|
|
11
12
|
this._defaults = {
|
|
@@ -21,7 +22,8 @@ export class SnkMessageBuilder {
|
|
|
21
22
|
crudUtils: crudUtilsMessages,
|
|
22
23
|
snkGrid: snkGridMessages,
|
|
23
24
|
snkGridConfig: snkGridConfigMessages,
|
|
24
|
-
snkExporter: snkExporterMessages
|
|
25
|
+
snkExporter: snkExporterMessages,
|
|
26
|
+
snkDataExporter: snkDataExporterMessages
|
|
25
27
|
};
|
|
26
28
|
this._currentOperation = OperationMap.CLEAN;
|
|
27
29
|
this.loadAppMessages().then((msgs) => {
|