@sankhyalabs/sankhyablocks 8.15.0-dev.82 → 8.15.0-dev.83
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/{IExporterProvider-0c814e9a.js → IExporterProvider-c78cb1b8.js} +3 -3
- package/dist/cjs/{SnkMessageBuilder-4a95fe86.js → SnkMessageBuilder-722b104e.js} +2 -0
- package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter.cjs.entry.js +114 -11
- package/dist/cjs/{snk-data-unit-5be491da.js → snk-data-unit-56babf28.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +3 -3
- package/dist/cjs/{snk-guides-viewer-5d5f0f25.js → snk-guides-viewer-9867335b.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +3 -3
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-d9392685.js → taskbar-elements-9ad1f9c0.js} +1 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +7 -1
- package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +7 -1
- package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +2 -2
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +23 -6
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
- package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +13 -0
- package/dist/collection/lib/@types/index.js +5 -0
- package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
- package/dist/components/IExporterProvider.js +2 -2
- package/dist/components/ISave.js +5 -0
- package/dist/components/SnkMessageBuilder.js +2 -0
- package/dist/components/snk-data-exporter2.js +111 -8
- package/dist/esm/{IExporterProvider-c0194569.js → IExporterProvider-1deb5d0a.js} +3 -3
- package/dist/esm/{SnkMessageBuilder-3a767111.js → SnkMessageBuilder-89925609.js} +2 -0
- package/dist/esm/{index-0ece87a6.js → index-88d0c8ad.js} +5 -0
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-exporter.entry.js +114 -11
- package/dist/esm/{snk-data-unit-9110a07b.js → snk-data-unit-56b5efc4.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +3 -3
- package/dist/esm/{snk-guides-viewer-ef8c4eec.js → snk-guides-viewer-7ae1b358.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +3 -3
- package/dist/esm/snk-taskbar.entry.js +2 -2
- package/dist/esm/{taskbar-elements-ad766858.js → taskbar-elements-da72aae0.js} +1 -1
- package/dist/sankhyablocks/{p-9b1c0824.entry.js → p-0f4de966.entry.js} +1 -1
- package/dist/sankhyablocks/{p-294df368.entry.js → p-26e34ba3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3f1efb97.entry.js → p-32097e8a.entry.js} +1 -1
- package/dist/sankhyablocks/p-6071f6b4.entry.js +1 -0
- package/dist/sankhyablocks/p-7a337364.js +1 -0
- package/dist/sankhyablocks/{p-2ac8bd11.entry.js → p-8323db5f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-543537ca.js → p-88a77075.js} +1 -1
- package/dist/sankhyablocks/{p-039c7148.entry.js → p-9bdd4e27.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8322ccdb.entry.js → p-9cb8a77b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-58687027.entry.js → p-a0edbed5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-babe7665.js → p-a7717247.js} +1 -1
- package/dist/sankhyablocks/{p-5646ee8c.entry.js → p-b1ee6b27.entry.js} +1 -1
- package/dist/sankhyablocks/p-b9e318a8.js +1 -0
- package/dist/sankhyablocks/{p-a64baa0f.entry.js → p-c5b18d02.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d26365ad.js → p-c65bbb31.js} +1 -1
- package/dist/sankhyablocks/{p-61dd89eb.js → p-ef402237.js} +1 -1
- package/dist/sankhyablocks/{p-04821c60.entry.js → p-f9815cc4.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +1 -0
- package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
- package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +2 -0
- package/dist/types/lib/@types/index.d.ts +5 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-38289a55.js +0 -1
- package/dist/sankhyablocks/p-4ce73e88.js +0 -1
- package/dist/sankhyablocks/p-70a6e662.entry.js +0 -1
@@ -19,6 +19,9 @@ export class ItemBuilder {
|
|
19
19
|
items.push(this.getExportToXLS(groupName));
|
20
20
|
}
|
21
21
|
this.setExportCurrentPage(option, items);
|
22
|
+
if (this._selectedNumber > 0) {
|
23
|
+
this.setExportAllRecords(option, items);
|
24
|
+
}
|
22
25
|
this.setExportByEmail(option, items);
|
23
26
|
}
|
24
27
|
/**
|
@@ -49,6 +52,34 @@ export class ItemBuilder {
|
|
49
52
|
}
|
50
53
|
}
|
51
54
|
}
|
55
|
+
/**
|
56
|
+
* Método responsável por inserir os itens de exportação para todos os registros.
|
57
|
+
* @param option - Nome da opção que será inserida no array.
|
58
|
+
* @param items - Array que será alimentado com as opções permitidas.
|
59
|
+
*/
|
60
|
+
setExportAllRecords(option, items) {
|
61
|
+
var _a;
|
62
|
+
const pageOptions = [DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF, DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS];
|
63
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS) {
|
64
|
+
items.push(this.getAllRecords());
|
65
|
+
}
|
66
|
+
if (pageOptions.includes(option)) {
|
67
|
+
let item = items.find((item) => item.id === DataExporterOption.EXPORT_ALL_RECORDS);
|
68
|
+
if (item == undefined) {
|
69
|
+
items.push(this.getAllRecords());
|
70
|
+
item = items.find((item) => item.id === DataExporterOption.EXPORT_ALL_RECORDS);
|
71
|
+
}
|
72
|
+
if (!((_a = item.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
73
|
+
item.children = [];
|
74
|
+
}
|
75
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF) {
|
76
|
+
item.children.push(this.getExportAllRecordsToPDF());
|
77
|
+
}
|
78
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS) {
|
79
|
+
item.children.push(this.getExportAllRecordsToXLS());
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
52
83
|
/**
|
53
84
|
* Método responsável por inserir os itens de exportação por e-mail.
|
54
85
|
* @param option - Nome da opção que será inserida no array.
|
@@ -94,6 +125,17 @@ export class ItemBuilder {
|
|
94
125
|
group: this._getMessage("snkDataExporter.group.custom")
|
95
126
|
};
|
96
127
|
}
|
128
|
+
/**
|
129
|
+
* Método responsável por capturar o objeto com todos os dados de exportação.
|
130
|
+
* @returns Retorna o objeto com todos os dados de exportação.
|
131
|
+
*/
|
132
|
+
getAllRecords() {
|
133
|
+
return {
|
134
|
+
id: DataExporterOption.EXPORT_ALL_RECORDS,
|
135
|
+
label: this._getMessage("snkDataExporter.label.allRecords"),
|
136
|
+
group: this._getMessage("snkDataExporter.group.custom")
|
137
|
+
};
|
138
|
+
}
|
97
139
|
/**
|
98
140
|
* Método responsável por capturar o objeto com os dados de exportação personalizada em PDF.
|
99
141
|
* @returns Retorna o objeto com os dados de exportação personalizada em PDF.
|
@@ -114,6 +156,26 @@ export class ItemBuilder {
|
|
114
156
|
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
|
115
157
|
};
|
116
158
|
}
|
159
|
+
/**
|
160
|
+
* Método responsável por capturar o objeto com todos os dados de exportação em PDF.
|
161
|
+
* @returns Retorna o objeto com todos os dados de exportação em PDF.
|
162
|
+
*/
|
163
|
+
getExportAllRecordsToPDF() {
|
164
|
+
return {
|
165
|
+
id: DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF,
|
166
|
+
label: "PDF (.pdf)"
|
167
|
+
};
|
168
|
+
}
|
169
|
+
/**
|
170
|
+
* Método responsável por capturar o objeto com todos os dados de exportação em XLS.
|
171
|
+
* @returns Retorna o objeto com todos os dados de exportação em XLS.
|
172
|
+
*/
|
173
|
+
getExportAllRecordsToXLS() {
|
174
|
+
return {
|
175
|
+
id: DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS,
|
176
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
|
177
|
+
};
|
178
|
+
}
|
117
179
|
/**
|
118
180
|
* Método responsável por capturar o objeto com os dados de exportação por e-mail.
|
119
181
|
* @returns Retorna o objeto com os dados de exportação por e-mail.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
const DOC_MAX_WIDTH = 800;
|
2
|
+
export function getVisibleColumns(columns) {
|
3
|
+
const visibleColumns = [];
|
4
|
+
let totalWidth = 0;
|
5
|
+
for (const column of columns) {
|
6
|
+
totalWidth += column.width;
|
7
|
+
if (totalWidth >= DOC_MAX_WIDTH) {
|
8
|
+
break;
|
9
|
+
}
|
10
|
+
visibleColumns.push(column);
|
11
|
+
}
|
12
|
+
return visibleColumns;
|
13
|
+
}
|
@@ -9,8 +9,11 @@ export var DataExporterOption;
|
|
9
9
|
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
10
10
|
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
11
11
|
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
12
|
+
DataExporterOption["EXPORT_ALL_RECORDS"] = "exportAllRecords";
|
12
13
|
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
13
14
|
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
15
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_PDF"] = "exportAllRecordsToPDF";
|
16
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_XLS"] = "exportAllRecordsToXLS";
|
14
17
|
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
15
18
|
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
16
19
|
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
@@ -27,6 +30,8 @@ export var DataExporterType;
|
|
27
30
|
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
28
31
|
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
29
32
|
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
33
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_PDF"] = "PDF";
|
34
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_XLS"] = "XLS";
|
30
35
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
31
36
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
32
37
|
})(DataExporterType || (DataExporterType = {}));
|
@@ -10,6 +10,7 @@ export const snkDataExporterMessages = {
|
|
10
10
|
},
|
11
11
|
label: {
|
12
12
|
currentPage: "Somente a página atual",
|
13
|
+
allRecords: "Todos os registros",
|
13
14
|
spreadsheet: "Planilha",
|
14
15
|
cube: "Cubo",
|
15
16
|
sendByEmail: "Enviar por email",
|
@@ -22,6 +23,7 @@ export const snkDataExporterMessages = {
|
|
22
23
|
},
|
23
24
|
title: {
|
24
25
|
error: "Erro",
|
26
|
+
permission: "Falha detectada",
|
25
27
|
},
|
26
28
|
limitExceeded: {
|
27
29
|
title: "Atenção",
|
@@ -271,7 +271,7 @@ class CommonsExporter {
|
|
271
271
|
const columnData = {
|
272
272
|
label: column.label,
|
273
273
|
id: column.name,
|
274
|
-
width:
|
274
|
+
width: column.width,
|
275
275
|
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
276
276
|
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
277
277
|
customFormatter
|
@@ -283,7 +283,7 @@ class CommonsExporter {
|
|
283
283
|
const descriptionColumn = {
|
284
284
|
label: fieldData.properties.DESCRIPTIONENTITY,
|
285
285
|
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
286
|
-
width:
|
286
|
+
width: column.width,
|
287
287
|
type: DataType.TEXT,
|
288
288
|
userInterface: UserInterface$1.LONGTEXT,
|
289
289
|
descriptionFrom: fieldData.name
|
package/dist/components/ISave.js
CHANGED
@@ -9,8 +9,11 @@ var DataExporterOption;
|
|
9
9
|
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
10
10
|
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
11
11
|
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
12
|
+
DataExporterOption["EXPORT_ALL_RECORDS"] = "exportAllRecords";
|
12
13
|
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
13
14
|
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
15
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_PDF"] = "exportAllRecordsToPDF";
|
16
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_XLS"] = "exportAllRecordsToXLS";
|
14
17
|
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
15
18
|
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
16
19
|
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
@@ -27,6 +30,8 @@ var DataExporterType;
|
|
27
30
|
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
28
31
|
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
29
32
|
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
33
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_PDF"] = "PDF";
|
34
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_XLS"] = "XLS";
|
30
35
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
31
36
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
32
37
|
})(DataExporterType || (DataExporterType = {}));
|
@@ -285,6 +285,7 @@ const snkDataExporterMessages = {
|
|
285
285
|
},
|
286
286
|
label: {
|
287
287
|
currentPage: "Somente a página atual",
|
288
|
+
allRecords: "Todos os registros",
|
288
289
|
spreadsheet: "Planilha",
|
289
290
|
cube: "Cubo",
|
290
291
|
sendByEmail: "Enviar por email",
|
@@ -297,6 +298,7 @@ const snkDataExporterMessages = {
|
|
297
298
|
},
|
298
299
|
title: {
|
299
300
|
error: "Erro",
|
301
|
+
permission: "Falha detectada",
|
300
302
|
},
|
301
303
|
limitExceeded: {
|
302
304
|
title: "Atenção",
|
@@ -33,6 +33,9 @@ class ItemBuilder {
|
|
33
33
|
items.push(this.getExportToXLS(groupName));
|
34
34
|
}
|
35
35
|
this.setExportCurrentPage(option, items);
|
36
|
+
if (this._selectedNumber > 0) {
|
37
|
+
this.setExportAllRecords(option, items);
|
38
|
+
}
|
36
39
|
this.setExportByEmail(option, items);
|
37
40
|
}
|
38
41
|
/**
|
@@ -63,6 +66,34 @@ class ItemBuilder {
|
|
63
66
|
}
|
64
67
|
}
|
65
68
|
}
|
69
|
+
/**
|
70
|
+
* Método responsável por inserir os itens de exportação para todos os registros.
|
71
|
+
* @param option - Nome da opção que será inserida no array.
|
72
|
+
* @param items - Array que será alimentado com as opções permitidas.
|
73
|
+
*/
|
74
|
+
setExportAllRecords(option, items) {
|
75
|
+
var _a;
|
76
|
+
const pageOptions = [DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF, DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS];
|
77
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS) {
|
78
|
+
items.push(this.getAllRecords());
|
79
|
+
}
|
80
|
+
if (pageOptions.includes(option)) {
|
81
|
+
let item = items.find((item) => item.id === DataExporterOption.EXPORT_ALL_RECORDS);
|
82
|
+
if (item == undefined) {
|
83
|
+
items.push(this.getAllRecords());
|
84
|
+
item = items.find((item) => item.id === DataExporterOption.EXPORT_ALL_RECORDS);
|
85
|
+
}
|
86
|
+
if (!((_a = item.children) === null || _a === void 0 ? void 0 : _a.length)) {
|
87
|
+
item.children = [];
|
88
|
+
}
|
89
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF) {
|
90
|
+
item.children.push(this.getExportAllRecordsToPDF());
|
91
|
+
}
|
92
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS) {
|
93
|
+
item.children.push(this.getExportAllRecordsToXLS());
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
66
97
|
/**
|
67
98
|
* Método responsável por inserir os itens de exportação por e-mail.
|
68
99
|
* @param option - Nome da opção que será inserida no array.
|
@@ -108,6 +139,17 @@ class ItemBuilder {
|
|
108
139
|
group: this._getMessage("snkDataExporter.group.custom")
|
109
140
|
};
|
110
141
|
}
|
142
|
+
/**
|
143
|
+
* Método responsável por capturar o objeto com todos os dados de exportação.
|
144
|
+
* @returns Retorna o objeto com todos os dados de exportação.
|
145
|
+
*/
|
146
|
+
getAllRecords() {
|
147
|
+
return {
|
148
|
+
id: DataExporterOption.EXPORT_ALL_RECORDS,
|
149
|
+
label: this._getMessage("snkDataExporter.label.allRecords"),
|
150
|
+
group: this._getMessage("snkDataExporter.group.custom")
|
151
|
+
};
|
152
|
+
}
|
111
153
|
/**
|
112
154
|
* Método responsável por capturar o objeto com os dados de exportação personalizada em PDF.
|
113
155
|
* @returns Retorna o objeto com os dados de exportação personalizada em PDF.
|
@@ -128,6 +170,26 @@ class ItemBuilder {
|
|
128
170
|
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
|
129
171
|
};
|
130
172
|
}
|
173
|
+
/**
|
174
|
+
* Método responsável por capturar o objeto com todos os dados de exportação em PDF.
|
175
|
+
* @returns Retorna o objeto com todos os dados de exportação em PDF.
|
176
|
+
*/
|
177
|
+
getExportAllRecordsToPDF() {
|
178
|
+
return {
|
179
|
+
id: DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF,
|
180
|
+
label: "PDF (.pdf)"
|
181
|
+
};
|
182
|
+
}
|
183
|
+
/**
|
184
|
+
* Método responsável por capturar o objeto com todos os dados de exportação em XLS.
|
185
|
+
* @returns Retorna o objeto com todos os dados de exportação em XLS.
|
186
|
+
*/
|
187
|
+
getExportAllRecordsToXLS() {
|
188
|
+
return {
|
189
|
+
id: DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS,
|
190
|
+
label: `${this._getMessage("snkDataExporter.label.spreadsheet")} (.xlsx)`
|
191
|
+
};
|
192
|
+
}
|
131
193
|
/**
|
132
194
|
* Método responsável por capturar o objeto com os dados de exportação por e-mail.
|
133
195
|
* @returns Retorna o objeto com os dados de exportação por e-mail.
|
@@ -181,6 +243,20 @@ function getFormatResponse(result) {
|
|
181
243
|
return ObjectUtils.stringToObject(response);
|
182
244
|
}
|
183
245
|
|
246
|
+
const DOC_MAX_WIDTH = 800;
|
247
|
+
function getVisibleColumns(columns) {
|
248
|
+
const visibleColumns = [];
|
249
|
+
let totalWidth = 0;
|
250
|
+
for (const column of columns) {
|
251
|
+
totalWidth += column.width;
|
252
|
+
if (totalWidth >= DOC_MAX_WIDTH) {
|
253
|
+
break;
|
254
|
+
}
|
255
|
+
visibleColumns.push(column);
|
256
|
+
}
|
257
|
+
return visibleColumns;
|
258
|
+
}
|
259
|
+
|
184
260
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
185
261
|
var t = {};
|
186
262
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
@@ -196,10 +272,15 @@ class ServerSideExporterStrategy {
|
|
196
272
|
constructor(provider) {
|
197
273
|
this._provider = provider;
|
198
274
|
}
|
275
|
+
async getParsedColumns() {
|
276
|
+
const columns = await this._provider.getColumnsMetadata();
|
277
|
+
const visibleColumns = getVisibleColumns(columns);
|
278
|
+
return visibleColumns;
|
279
|
+
}
|
199
280
|
async getParams(resolveProps) {
|
200
281
|
var _a, _b, _c, _d, _e, _f;
|
201
282
|
const filters = (_b = (_a = this._provider).getFilters) === null || _b === void 0 ? void 0 : _b.call(_a);
|
202
|
-
const columns = await this.
|
283
|
+
const columns = await this.getParsedColumns();
|
203
284
|
const sort = (_d = (_c = this._provider).getOrders) === null || _d === void 0 ? void 0 : _d.call(_c);
|
204
285
|
const resourceURI = (_f = (_e = this._provider).getResourceURI) === null || _f === void 0 ? void 0 : _f.call(_e);
|
205
286
|
const selectedIDs = this._provider.getSelectedIDs();
|
@@ -250,10 +331,15 @@ class ClientSideExporterStrategy {
|
|
250
331
|
constructor(provider) {
|
251
332
|
this._provider = provider;
|
252
333
|
}
|
334
|
+
async getParsedColumns() {
|
335
|
+
const columns = await this._provider.getColumnsMetadata();
|
336
|
+
const visibleColumns = getVisibleColumns(columns);
|
337
|
+
return visibleColumns;
|
338
|
+
}
|
253
339
|
async executeExport(resolveProps) {
|
254
340
|
const { methodName, titleGrid } = resolveProps;
|
255
341
|
const records = await this._provider.getRecords();
|
256
|
-
const columns = await this.
|
342
|
+
const columns = await this.getParsedColumns();
|
257
343
|
const [serviceName, processor] = this.getExecutor(methodName);
|
258
344
|
const payload = {
|
259
345
|
serviceName,
|
@@ -348,7 +434,9 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
348
434
|
DataExporterOption.EXPORT_PDF_TO_EMAIL,
|
349
435
|
DataExporterOption.EXPORT_XLS_TO_EMAIL,
|
350
436
|
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
351
|
-
DataExporterOption.EXPORT_PAGE_TO_XLS
|
437
|
+
DataExporterOption.EXPORT_PAGE_TO_XLS,
|
438
|
+
DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF,
|
439
|
+
DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS,
|
352
440
|
];
|
353
441
|
this._items = [];
|
354
442
|
this._showDropdown = false;
|
@@ -439,7 +527,16 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
439
527
|
return DataExporterOption[key] === option;
|
440
528
|
});
|
441
529
|
}
|
442
|
-
|
530
|
+
getExportType(option) {
|
531
|
+
if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF || option === DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS) {
|
532
|
+
return 'all';
|
533
|
+
}
|
534
|
+
if (option === DataExporterOption.EXPORT_PAGE_TO_PDF || option === DataExporterOption.EXPORT_PAGE_TO_XLS) {
|
535
|
+
return 'page';
|
536
|
+
}
|
537
|
+
return 'selection';
|
538
|
+
}
|
539
|
+
async dispatchExporter(option) {
|
443
540
|
var _a, _b, _c;
|
444
541
|
const optionKey = this.getOptionKey(option);
|
445
542
|
const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
|
@@ -449,11 +546,17 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
449
546
|
fileName: this._appLabel,
|
450
547
|
titleGrid: this._appLabel,
|
451
548
|
exportOption: option,
|
452
|
-
limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b)
|
549
|
+
limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b),
|
550
|
+
type: this.getExportType(option),
|
453
551
|
};
|
454
|
-
this.resolveExporter(params, (response) => {
|
455
|
-
|
456
|
-
|
552
|
+
await this.resolveExporter(params, (response) => {
|
553
|
+
if (response.canExport) {
|
554
|
+
fileViewer(Object.assign(Object.assign({}, response), { fileType,
|
555
|
+
isDownload }));
|
556
|
+
}
|
557
|
+
else {
|
558
|
+
ApplicationUtils.error(this.getMessage("snkDataExporter.title.permission"), this.getMessage("snkDataExporter.message.exportPermission"));
|
559
|
+
}
|
457
560
|
});
|
458
561
|
}
|
459
562
|
async processExporter(evt) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
|
2
2
|
import './pesquisa-fetcher-03c8f919.js';
|
3
3
|
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
4
|
-
import './index-
|
4
|
+
import './index-88d0c8ad.js';
|
5
5
|
import './ISave-d8c8bc59.js';
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
7
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -194,7 +194,7 @@ class CommonsExporter {
|
|
194
194
|
const columnData = {
|
195
195
|
label: column.label,
|
196
196
|
id: column.name,
|
197
|
-
width:
|
197
|
+
width: column.width,
|
198
198
|
type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
|
199
199
|
userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
|
200
200
|
customFormatter
|
@@ -206,7 +206,7 @@ class CommonsExporter {
|
|
206
206
|
const descriptionColumn = {
|
207
207
|
label: fieldData.properties.DESCRIPTIONENTITY,
|
208
208
|
id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
|
209
|
-
width:
|
209
|
+
width: column.width,
|
210
210
|
type: DataType.TEXT,
|
211
211
|
userInterface: UserInterface$1.LONGTEXT,
|
212
212
|
descriptionFrom: fieldData.name
|
@@ -285,6 +285,7 @@ const snkDataExporterMessages = {
|
|
285
285
|
},
|
286
286
|
label: {
|
287
287
|
currentPage: "Somente a página atual",
|
288
|
+
allRecords: "Todos os registros",
|
288
289
|
spreadsheet: "Planilha",
|
289
290
|
cube: "Cubo",
|
290
291
|
sendByEmail: "Enviar por email",
|
@@ -297,6 +298,7 @@ const snkDataExporterMessages = {
|
|
297
298
|
},
|
298
299
|
title: {
|
299
300
|
error: "Erro",
|
301
|
+
permission: "Falha detectada",
|
300
302
|
},
|
301
303
|
limitExceeded: {
|
302
304
|
title: "Atenção",
|
@@ -9,8 +9,11 @@ var DataExporterOption;
|
|
9
9
|
DataExporterOption["EXPORT_TO_PDF"] = "exportToPDF";
|
10
10
|
DataExporterOption["EXPORT_TO_XLS"] = "exportToXLS";
|
11
11
|
DataExporterOption["EXPORT_CURRENT_PAGE"] = "exportCurrentPage";
|
12
|
+
DataExporterOption["EXPORT_ALL_RECORDS"] = "exportAllRecords";
|
12
13
|
DataExporterOption["EXPORT_PAGE_TO_PDF"] = "exportPageToPDF";
|
13
14
|
DataExporterOption["EXPORT_PAGE_TO_XLS"] = "exportPageToXLS";
|
15
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_PDF"] = "exportAllRecordsToPDF";
|
16
|
+
DataExporterOption["EXPORT_ALL_RECORDS_TO_XLS"] = "exportAllRecordsToXLS";
|
14
17
|
DataExporterOption["EXPORT_BY_EMAIL"] = "exportToEmail";
|
15
18
|
DataExporterOption["EXPORT_PDF_TO_EMAIL"] = "exportPDFToEmail";
|
16
19
|
DataExporterOption["EXPORT_XLS_TO_EMAIL"] = "exportXLSToEmail";
|
@@ -27,6 +30,8 @@ var DataExporterType;
|
|
27
30
|
DataExporterType["EXPORT_TO_XLS"] = "XLS";
|
28
31
|
DataExporterType["EXPORT_PAGE_TO_PDF"] = "PDF";
|
29
32
|
DataExporterType["EXPORT_PAGE_TO_XLS"] = "XLS";
|
33
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_PDF"] = "PDF";
|
34
|
+
DataExporterType["EXPORT_ALL_RECORDS_TO_XLS"] = "XLS";
|
30
35
|
DataExporterType["EXPORT_PDF_TO_EMAIL"] = "PDF";
|
31
36
|
DataExporterType["EXPORT_XLS_TO_EMAIL"] = "XLS";
|
32
37
|
})(DataExporterType || (DataExporterType = {}));
|
@@ -3,7 +3,7 @@ import { ApplicationContext, StringUtils, ErrorException, WarningException, Obje
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
|
4
4
|
import { P as ParamType } from './ParamType-d5152b06.js';
|
5
5
|
import './pesquisa-fetcher-03c8f919.js';
|
6
|
-
import './index-
|
6
|
+
import './index-88d0c8ad.js';
|
7
7
|
import './ISave-d8c8bc59.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -6,7 +6,7 @@ import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-c1baf6
|
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-039abba3.js';
|
7
7
|
import { D as DataUnitFetcher } from './dataunit-fetcher-3fbf9d12.js';
|
8
8
|
import { P as PesquisaFetcher } from './pesquisa-fetcher-03c8f919.js';
|
9
|
-
import { S as SnkMessageBuilder } from './SnkMessageBuilder-
|
9
|
+
import { S as SnkMessageBuilder } from './SnkMessageBuilder-89925609.js';
|
10
10
|
import './form-config-fetcher-30fb808f.js';
|
11
11
|
import './filter-item-type.enum-d45e026f.js';
|
12
12
|
import './PrintUtils-3e4ff0f5.js';
|
@@ -2,14 +2,14 @@ import { r as registerInstance, c as createEvent, h } from './index-a7d3d3f1.js'
|
|
2
2
|
import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
|
3
3
|
import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
|
4
4
|
import './pesquisa-fetcher-03c8f919.js';
|
5
|
-
import './index-
|
5
|
+
import './index-88d0c8ad.js';
|
6
6
|
import { S as SaveErrorsEnum } from './ISave-d8c8bc59.js';
|
7
7
|
import { P as PreloadManager, b as applyFilter, c as applySorting, d as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './dataunit-fetcher-3fbf9d12.js';
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
9
9
|
import './form-config-fetcher-30fb808f.js';
|
10
10
|
import { d as VIEW_MODE } from './constants-8457af36.js';
|
11
11
|
import { A as AutorizationType } from './auth-fetcher-039abba3.js';
|
12
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
12
|
+
import { T as TaskbarElement } from './taskbar-elements-da72aae0.js';
|
13
13
|
import './PrintUtils-3e4ff0f5.js';
|
14
14
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
15
15
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
|
2
2
|
import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
|
3
|
-
import { T as TaskbarElement } from './taskbar-elements-
|
3
|
+
import { T as TaskbarElement } from './taskbar-elements-da72aae0.js';
|
4
4
|
import './DataFetcher-c1baf61d.js';
|
5
5
|
import './pesquisa-fetcher-03c8f919.js';
|
6
|
-
import { P as PresentationMode } from './index-
|
6
|
+
import { P as PresentationMode } from './index-88d0c8ad.js';
|
7
7
|
import './ISave-d8c8bc59.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|