@sankhyalabs/sankhyablocks 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-a5fc8ca3.js → SnkMessageBuilder-c596bd9c.js} +7 -0
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator_3.cjs.entry.js +9 -0
- package/dist/cjs/snk-data-exporter_8.cjs.entry.js +44 -4
- package/dist/cjs/snk-data-unit.cjs.entry.js +12 -10
- package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +45 -5
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +11 -9
- package/dist/collection/components/snk-grid/snk-grid.js +9 -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-data-exporter2.js +45 -5
- package/dist/components/snk-data-unit.js +11 -9
- package/dist/components/snk-grid2.js +9 -0
- package/dist/esm/{SnkMessageBuilder-900467ad.js → SnkMessageBuilder-66ddc2f0.js} +7 -0
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-configurator_3.entry.js +9 -0
- package/dist/esm/snk-data-exporter_8.entry.js +45 -5
- package/dist/esm/snk-data-unit.entry.js +12 -10
- package/dist/sankhyablocks/p-1dbe9dd8.entry.js +1 -0
- package/dist/sankhyablocks/{p-9e1e7afb.js → p-3187b31c.js} +1 -1
- package/dist/sankhyablocks/{p-9ffbffb6.entry.js → p-4cec3835.entry.js} +1 -1
- package/dist/sankhyablocks/p-5ebc029c.entry.js +1 -0
- package/dist/sankhyablocks/{p-e728ca22.entry.js → p-c15108d5.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +9 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-f1ae398e.entry.js +0 -1
- package/dist/sankhyablocks/p-fa885483.entry.js +0 -1
|
@@ -249,6 +249,13 @@ const snkDataExporterMessages = {
|
|
|
249
249
|
},
|
|
250
250
|
title: {
|
|
251
251
|
error: "Erro",
|
|
252
|
+
},
|
|
253
|
+
limitExceeded: {
|
|
254
|
+
title: "Atenção",
|
|
255
|
+
description: "Apenas os {{limit}} primeiros registros serão exportados. Deseja continuar?",
|
|
256
|
+
subdescription: "Caso seja necessária uma quantidade maior de registros exportados, utilize o Extrator de Dados através de um Relatório Personalizado.",
|
|
257
|
+
cancel: "Cancelar",
|
|
258
|
+
continue: "Continuar"
|
|
252
259
|
}
|
|
253
260
|
};
|
|
254
261
|
|
|
@@ -6,7 +6,7 @@ const index = require('./index-2cd6f753.js');
|
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const ConfigStorage = require('./ConfigStorage-8b5e3261.js');
|
|
8
8
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
9
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-c596bd9c.js');
|
|
10
10
|
require('./_commonjsHelpers-537d719a.js');
|
|
11
11
|
|
|
12
12
|
class SnkErrorHandler {
|
|
@@ -319,6 +319,15 @@ const SnkGrid = class {
|
|
|
319
319
|
var _a;
|
|
320
320
|
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
321
321
|
},
|
|
322
|
+
getSelectedNumber: () => {
|
|
323
|
+
var _a, _b;
|
|
324
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) === null || _b === void 0 ? void 0 : _b.length;
|
|
325
|
+
},
|
|
326
|
+
getTotalRecords: () => {
|
|
327
|
+
var _a, _b, _c;
|
|
328
|
+
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
329
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
330
|
+
},
|
|
322
331
|
getSelectedIDs: () => {
|
|
323
332
|
return selectedIDs || [];
|
|
324
333
|
},
|
|
@@ -230,6 +230,7 @@ function getFormatResponse(result) {
|
|
|
230
230
|
|
|
231
231
|
const snkDataExporterCss = ".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";
|
|
232
232
|
|
|
233
|
+
const LIMIT_PER_EXPORT = 5000;
|
|
233
234
|
const SnkDataExporter = class {
|
|
234
235
|
constructor(hostRef) {
|
|
235
236
|
index$1.registerInstance(this, hostRef);
|
|
@@ -316,6 +317,7 @@ const SnkDataExporter = class {
|
|
|
316
317
|
const columns = this.provider.getColumnsMetadata();
|
|
317
318
|
const sort = this.provider.getOrders();
|
|
318
319
|
const resourceURI = this.provider.getResourceURI();
|
|
320
|
+
const selectedIDs = this.provider.getSelectedIDs();
|
|
319
321
|
const option = resolveProps.exportOption;
|
|
320
322
|
const currentPageOptions = [
|
|
321
323
|
index.DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
@@ -325,7 +327,7 @@ const SnkDataExporter = class {
|
|
|
325
327
|
let params = Object.assign({ filters,
|
|
326
328
|
columns,
|
|
327
329
|
sort,
|
|
328
|
-
resourceURI }, resolveProps);
|
|
330
|
+
resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
|
|
329
331
|
if (currentPageOptions.includes(option)) {
|
|
330
332
|
const offset = this.provider.getOffset();
|
|
331
333
|
const limit = this.provider.getLimit();
|
|
@@ -351,7 +353,8 @@ const SnkDataExporter = class {
|
|
|
351
353
|
methodName: index.DataExporterOption[`EXPORT_TO_${fileType}`],
|
|
352
354
|
fileName: this._appLabel,
|
|
353
355
|
titleGrid: this._appLabel,
|
|
354
|
-
exportOption: option
|
|
356
|
+
exportOption: option,
|
|
357
|
+
limit: LIMIT_PER_EXPORT
|
|
355
358
|
};
|
|
356
359
|
this.resolveExporter(params, (response) => {
|
|
357
360
|
fileViewer(Object.assign(Object.assign({}, response), { fileType,
|
|
@@ -360,9 +363,46 @@ const SnkDataExporter = class {
|
|
|
360
363
|
});
|
|
361
364
|
}
|
|
362
365
|
async processExporter(evt) {
|
|
363
|
-
var _a;
|
|
366
|
+
var _a, _b, _c, _d;
|
|
364
367
|
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
365
|
-
|
|
368
|
+
const exportCurrentPageOptions = [index.DataExporterOption.EXPORT_PAGE_TO_PDF, index.DataExporterOption.EXPORT_PAGE_TO_XLS];
|
|
369
|
+
const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
|
|
370
|
+
if ((item === null || item === void 0 ? void 0 : item.id) === index.DataExporterOption.EXPORT_CURRENT_PAGE)
|
|
371
|
+
return;
|
|
372
|
+
const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
|
|
373
|
+
const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
|
|
374
|
+
const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
|
|
375
|
+
let limitExceeded = false;
|
|
376
|
+
if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
|
|
377
|
+
limitExceeded = false;
|
|
378
|
+
}
|
|
379
|
+
else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
|
|
380
|
+
limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
|
|
381
|
+
}
|
|
382
|
+
else if (totalRecords > LIMIT_PER_EXPORT)
|
|
383
|
+
limitExceeded = true;
|
|
384
|
+
if (limitExceeded) {
|
|
385
|
+
const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
|
|
386
|
+
const limitModalMessages = {
|
|
387
|
+
title: this.getMessage("snkDataExporter.limitExceeded.title"),
|
|
388
|
+
description: `
|
|
389
|
+
${this.getMessage("snkDataExporter.limitExceeded.description", { limit: formattedLimit })}
|
|
390
|
+
<br/><br/>
|
|
391
|
+
<b>
|
|
392
|
+
${this.getMessage("snkDataExporter.limitExceeded.subdescription")}
|
|
393
|
+
</b>
|
|
394
|
+
`,
|
|
395
|
+
cancel: this.getMessage("snkDataExporter.limitExceeded.cancel"),
|
|
396
|
+
confirm: this.getMessage("snkDataExporter.limitExceeded.continue")
|
|
397
|
+
};
|
|
398
|
+
const isAccepted = await utils.ApplicationUtils.confirm(limitModalMessages.title, limitModalMessages.description, null, utils.DialogType.WARN, {
|
|
399
|
+
labelCancel: limitModalMessages.cancel,
|
|
400
|
+
labelConfirm: limitModalMessages.confirm,
|
|
401
|
+
});
|
|
402
|
+
if (!isAccepted)
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (isCustomReport) {
|
|
366
406
|
this.openPersonalizedReports(item.id);
|
|
367
407
|
this._showDropdown = false;
|
|
368
408
|
return;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-2cd6f753.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
|
-
const SnkMessageBuilder = require('./SnkMessageBuilder-
|
|
8
|
+
const SnkMessageBuilder = require('./SnkMessageBuilder-c596bd9c.js');
|
|
9
9
|
|
|
10
10
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
|
|
11
11
|
|
|
@@ -111,15 +111,17 @@ const SnkDataUnit = class {
|
|
|
111
111
|
const selectedRecords = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecords();
|
|
112
112
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
113
113
|
selectedRecords.forEach(({ __record__id__ }) => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
|
115
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
|
116
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
117
|
+
var _a;
|
|
118
|
+
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
119
|
+
if (metadataField == undefined) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
123
|
+
});
|
|
124
|
+
}
|
|
123
125
|
});
|
|
124
126
|
}
|
|
125
127
|
return selectedRecordsIDsInfo;
|
|
@@ -1,12 +1,13 @@
|
|
|
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
|
+
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { ItemBuilder } from './structure/ItemBuilder';
|
|
5
5
|
import { DataExporterFormat, DataExporterOption, DataExporterType } from '../../lib/@types';
|
|
6
6
|
import { REPORT_LAUNCHER_RESOURCE_ID } from '../../lib/utils/constants';
|
|
7
7
|
import fetchDataExporter from "../../lib/http/data-fetcher/fetchers/fetchDataExporter";
|
|
8
8
|
import fileViewer from "../../lib/utils/fileViewer";
|
|
9
9
|
import getPersonalizedReports from '../../lib/http/data-fetcher/fetchers/fetchDataExporter/personalized-reports-fetcher';
|
|
10
|
+
const LIMIT_PER_EXPORT = 5000;
|
|
10
11
|
export class SnkDataExporter {
|
|
11
12
|
constructor() {
|
|
12
13
|
this._selectedNumber = 0;
|
|
@@ -92,6 +93,7 @@ export class SnkDataExporter {
|
|
|
92
93
|
const columns = this.provider.getColumnsMetadata();
|
|
93
94
|
const sort = this.provider.getOrders();
|
|
94
95
|
const resourceURI = this.provider.getResourceURI();
|
|
96
|
+
const selectedIDs = this.provider.getSelectedIDs();
|
|
95
97
|
const option = resolveProps.exportOption;
|
|
96
98
|
const currentPageOptions = [
|
|
97
99
|
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
@@ -101,7 +103,7 @@ export class SnkDataExporter {
|
|
|
101
103
|
let params = Object.assign({ filters,
|
|
102
104
|
columns,
|
|
103
105
|
sort,
|
|
104
|
-
resourceURI }, resolveProps);
|
|
106
|
+
resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
|
|
105
107
|
if (currentPageOptions.includes(option)) {
|
|
106
108
|
const offset = this.provider.getOffset();
|
|
107
109
|
const limit = this.provider.getLimit();
|
|
@@ -127,7 +129,8 @@ export class SnkDataExporter {
|
|
|
127
129
|
methodName: DataExporterOption[`EXPORT_TO_${fileType}`],
|
|
128
130
|
fileName: this._appLabel,
|
|
129
131
|
titleGrid: this._appLabel,
|
|
130
|
-
exportOption: option
|
|
132
|
+
exportOption: option,
|
|
133
|
+
limit: LIMIT_PER_EXPORT
|
|
131
134
|
};
|
|
132
135
|
this.resolveExporter(params, (response) => {
|
|
133
136
|
fileViewer(Object.assign(Object.assign({}, response), { fileType,
|
|
@@ -136,9 +139,46 @@ export class SnkDataExporter {
|
|
|
136
139
|
});
|
|
137
140
|
}
|
|
138
141
|
async processExporter(evt) {
|
|
139
|
-
var _a;
|
|
142
|
+
var _a, _b, _c, _d;
|
|
140
143
|
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
141
|
-
|
|
144
|
+
const exportCurrentPageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
|
|
145
|
+
const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
|
|
146
|
+
if ((item === null || item === void 0 ? void 0 : item.id) === DataExporterOption.EXPORT_CURRENT_PAGE)
|
|
147
|
+
return;
|
|
148
|
+
const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
|
|
149
|
+
const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
|
|
150
|
+
const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
|
|
151
|
+
let limitExceeded = false;
|
|
152
|
+
if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
|
|
153
|
+
limitExceeded = false;
|
|
154
|
+
}
|
|
155
|
+
else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
|
|
156
|
+
limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
|
|
157
|
+
}
|
|
158
|
+
else if (totalRecords > LIMIT_PER_EXPORT)
|
|
159
|
+
limitExceeded = true;
|
|
160
|
+
if (limitExceeded) {
|
|
161
|
+
const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
|
|
162
|
+
const limitModalMessages = {
|
|
163
|
+
title: this.getMessage("snkDataExporter.limitExceeded.title"),
|
|
164
|
+
description: `
|
|
165
|
+
${this.getMessage("snkDataExporter.limitExceeded.description", { limit: formattedLimit })}
|
|
166
|
+
<br/><br/>
|
|
167
|
+
<b>
|
|
168
|
+
${this.getMessage("snkDataExporter.limitExceeded.subdescription")}
|
|
169
|
+
</b>
|
|
170
|
+
`,
|
|
171
|
+
cancel: this.getMessage("snkDataExporter.limitExceeded.cancel"),
|
|
172
|
+
confirm: this.getMessage("snkDataExporter.limitExceeded.continue")
|
|
173
|
+
};
|
|
174
|
+
const isAccepted = await ApplicationUtils.confirm(limitModalMessages.title, limitModalMessages.description, null, DialogType.WARN, {
|
|
175
|
+
labelCancel: limitModalMessages.cancel,
|
|
176
|
+
labelConfirm: limitModalMessages.confirm,
|
|
177
|
+
});
|
|
178
|
+
if (!isAccepted)
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (isCustomReport) {
|
|
142
182
|
this.openPersonalizedReports(item.id);
|
|
143
183
|
this._showDropdown = false;
|
|
144
184
|
return;
|
|
@@ -99,15 +99,17 @@ export class SnkDataUnit {
|
|
|
99
99
|
const selectedRecords = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecords();
|
|
100
100
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
101
101
|
selectedRecords.forEach(({ __record__id__ }) => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
|
103
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
|
104
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
105
|
+
var _a;
|
|
106
|
+
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
107
|
+
if (metadataField == undefined) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
111
|
+
});
|
|
112
|
+
}
|
|
111
113
|
});
|
|
112
114
|
}
|
|
113
115
|
return selectedRecordsIDsInfo;
|
|
@@ -161,6 +161,15 @@ export class SnkGrid {
|
|
|
161
161
|
var _a;
|
|
162
162
|
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
163
163
|
},
|
|
164
|
+
getSelectedNumber: () => {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) === null || _b === void 0 ? void 0 : _b.length;
|
|
167
|
+
},
|
|
168
|
+
getTotalRecords: () => {
|
|
169
|
+
var _a, _b, _c;
|
|
170
|
+
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
171
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
172
|
+
},
|
|
164
173
|
getSelectedIDs: () => {
|
|
165
174
|
return selectedIDs || [];
|
|
166
175
|
},
|
|
@@ -21,5 +21,12 @@ export const snkDataExporterMessages = {
|
|
|
21
21
|
},
|
|
22
22
|
title: {
|
|
23
23
|
error: "Erro",
|
|
24
|
+
},
|
|
25
|
+
limitExceeded: {
|
|
26
|
+
title: "Atenção",
|
|
27
|
+
description: "Apenas os {{limit}} primeiros registros serão exportados. Deseja continuar?",
|
|
28
|
+
subdescription: "Caso seja necessária uma quantidade maior de registros exportados, utilize o Extrator de Dados através de um Relatório Personalizado.",
|
|
29
|
+
cancel: "Cancelar",
|
|
30
|
+
continue: "Continuar"
|
|
24
31
|
}
|
|
25
32
|
};
|
|
@@ -227,6 +227,13 @@ const snkDataExporterMessages = {
|
|
|
227
227
|
},
|
|
228
228
|
title: {
|
|
229
229
|
error: "Erro",
|
|
230
|
+
},
|
|
231
|
+
limitExceeded: {
|
|
232
|
+
title: "Atenção",
|
|
233
|
+
description: "Apenas os {{limit}} primeiros registros serão exportados. Deseja continuar?",
|
|
234
|
+
subdescription: "Caso seja necessária uma quantidade maior de registros exportados, utilize o Extrator de Dados através de um Relatório Personalizado.",
|
|
235
|
+
cancel: "Cancelar",
|
|
236
|
+
continue: "Continuar"
|
|
230
237
|
}
|
|
231
238
|
};
|
|
232
239
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
|
+
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { K as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID } from './constants.js';
|
|
5
5
|
import { D as DataFetcher } from './DataFetcher.js';
|
|
6
6
|
import { d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
|
|
@@ -251,6 +251,7 @@ function getFormatResponse(result) {
|
|
|
251
251
|
|
|
252
252
|
const snkDataExporterCss = ".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";
|
|
253
253
|
|
|
254
|
+
const LIMIT_PER_EXPORT = 5000;
|
|
254
255
|
const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
255
256
|
constructor() {
|
|
256
257
|
super();
|
|
@@ -338,6 +339,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
338
339
|
const columns = this.provider.getColumnsMetadata();
|
|
339
340
|
const sort = this.provider.getOrders();
|
|
340
341
|
const resourceURI = this.provider.getResourceURI();
|
|
342
|
+
const selectedIDs = this.provider.getSelectedIDs();
|
|
341
343
|
const option = resolveProps.exportOption;
|
|
342
344
|
const currentPageOptions = [
|
|
343
345
|
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
@@ -347,7 +349,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
347
349
|
let params = Object.assign({ filters,
|
|
348
350
|
columns,
|
|
349
351
|
sort,
|
|
350
|
-
resourceURI }, resolveProps);
|
|
352
|
+
resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
|
|
351
353
|
if (currentPageOptions.includes(option)) {
|
|
352
354
|
const offset = this.provider.getOffset();
|
|
353
355
|
const limit = this.provider.getLimit();
|
|
@@ -373,7 +375,8 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
373
375
|
methodName: DataExporterOption[`EXPORT_TO_${fileType}`],
|
|
374
376
|
fileName: this._appLabel,
|
|
375
377
|
titleGrid: this._appLabel,
|
|
376
|
-
exportOption: option
|
|
378
|
+
exportOption: option,
|
|
379
|
+
limit: LIMIT_PER_EXPORT
|
|
377
380
|
};
|
|
378
381
|
this.resolveExporter(params, (response) => {
|
|
379
382
|
fileViewer(Object.assign(Object.assign({}, response), { fileType,
|
|
@@ -382,9 +385,46 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
382
385
|
});
|
|
383
386
|
}
|
|
384
387
|
async processExporter(evt) {
|
|
385
|
-
var _a;
|
|
388
|
+
var _a, _b, _c, _d;
|
|
386
389
|
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
387
|
-
|
|
390
|
+
const exportCurrentPageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
|
|
391
|
+
const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
|
|
392
|
+
if ((item === null || item === void 0 ? void 0 : item.id) === DataExporterOption.EXPORT_CURRENT_PAGE)
|
|
393
|
+
return;
|
|
394
|
+
const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
|
|
395
|
+
const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
|
|
396
|
+
const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
|
|
397
|
+
let limitExceeded = false;
|
|
398
|
+
if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
|
|
399
|
+
limitExceeded = false;
|
|
400
|
+
}
|
|
401
|
+
else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
|
|
402
|
+
limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
|
|
403
|
+
}
|
|
404
|
+
else if (totalRecords > LIMIT_PER_EXPORT)
|
|
405
|
+
limitExceeded = true;
|
|
406
|
+
if (limitExceeded) {
|
|
407
|
+
const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
|
|
408
|
+
const limitModalMessages = {
|
|
409
|
+
title: this.getMessage("snkDataExporter.limitExceeded.title"),
|
|
410
|
+
description: `
|
|
411
|
+
${this.getMessage("snkDataExporter.limitExceeded.description", { limit: formattedLimit })}
|
|
412
|
+
<br/><br/>
|
|
413
|
+
<b>
|
|
414
|
+
${this.getMessage("snkDataExporter.limitExceeded.subdescription")}
|
|
415
|
+
</b>
|
|
416
|
+
`,
|
|
417
|
+
cancel: this.getMessage("snkDataExporter.limitExceeded.cancel"),
|
|
418
|
+
confirm: this.getMessage("snkDataExporter.limitExceeded.continue")
|
|
419
|
+
};
|
|
420
|
+
const isAccepted = await ApplicationUtils.confirm(limitModalMessages.title, limitModalMessages.description, null, DialogType.WARN, {
|
|
421
|
+
labelCancel: limitModalMessages.cancel,
|
|
422
|
+
labelConfirm: limitModalMessages.confirm,
|
|
423
|
+
});
|
|
424
|
+
if (!isAccepted)
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (isCustomReport) {
|
|
388
428
|
this.openPersonalizedReports(item.id);
|
|
389
429
|
this._showDropdown = false;
|
|
390
430
|
return;
|
|
@@ -108,15 +108,17 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
108
108
|
const selectedRecords = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecords();
|
|
109
109
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
110
110
|
selectedRecords.forEach(({ __record__id__ }) => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
|
112
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
|
113
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
114
|
+
var _a;
|
|
115
|
+
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
116
|
+
if (metadataField == undefined) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
120
122
|
});
|
|
121
123
|
}
|
|
122
124
|
return selectedRecordsIDsInfo;
|
|
@@ -176,6 +176,15 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
176
176
|
var _a;
|
|
177
177
|
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
178
178
|
},
|
|
179
|
+
getSelectedNumber: () => {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) === null || _b === void 0 ? void 0 : _b.length;
|
|
182
|
+
},
|
|
183
|
+
getTotalRecords: () => {
|
|
184
|
+
var _a, _b, _c;
|
|
185
|
+
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
186
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
187
|
+
},
|
|
179
188
|
getSelectedIDs: () => {
|
|
180
189
|
return selectedIDs || [];
|
|
181
190
|
},
|
|
@@ -227,6 +227,13 @@ const snkDataExporterMessages = {
|
|
|
227
227
|
},
|
|
228
228
|
title: {
|
|
229
229
|
error: "Erro",
|
|
230
|
+
},
|
|
231
|
+
limitExceeded: {
|
|
232
|
+
title: "Atenção",
|
|
233
|
+
description: "Apenas os {{limit}} primeiros registros serão exportados. Deseja continuar?",
|
|
234
|
+
subdescription: "Caso seja necessária uma quantidade maior de registros exportados, utilize o Extrator de Dados através de um Relatório Personalizado.",
|
|
235
|
+
cancel: "Cancelar",
|
|
236
|
+
continue: "Continuar"
|
|
230
237
|
}
|
|
231
238
|
};
|
|
232
239
|
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, g as getElement } from './i
|
|
|
2
2
|
import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DataType, DataUnit, StringUtils, ChangeOperation, DateUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
|
|
3
3
|
import { d as dist, D as DataFetcher, R as ResourceFetcher, U as UrlUtils, F as FormConfigFetcher, G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage-4654f57b.js';
|
|
4
4
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
|
-
import { S as SnkMessageBuilder } from './SnkMessageBuilder-
|
|
5
|
+
import { S as SnkMessageBuilder } from './SnkMessageBuilder-66ddc2f0.js';
|
|
6
6
|
import './_commonjsHelpers-9943807e.js';
|
|
7
7
|
|
|
8
8
|
class SnkErrorHandler {
|
|
@@ -315,6 +315,15 @@ const SnkGrid = class {
|
|
|
315
315
|
var _a;
|
|
316
316
|
return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
|
|
317
317
|
},
|
|
318
|
+
getSelectedNumber: () => {
|
|
319
|
+
var _a, _b;
|
|
320
|
+
return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) === null || _b === void 0 ? void 0 : _b.length;
|
|
321
|
+
},
|
|
322
|
+
getTotalRecords: () => {
|
|
323
|
+
var _a, _b, _c;
|
|
324
|
+
const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
|
|
325
|
+
return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
|
|
326
|
+
},
|
|
318
327
|
getSelectedIDs: () => {
|
|
319
328
|
return selectedIDs || [];
|
|
320
329
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-a77b6f35.js';
|
|
2
2
|
import { ObjectUtils, ApplicationContext, ElementIDUtils, DataType, StringUtils, ErrorException, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { ApplicationUtils,
|
|
3
|
+
import { ApplicationUtils, DialogType, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType, P as PresentationMode } from './index-1564817d.js';
|
|
5
5
|
import { d as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID, O as ORDER_VALUES } from './constants-965d7a7f.js';
|
|
6
6
|
import { D as DataFetcher, C as ConfigStorage } from './ConfigStorage-4654f57b.js';
|
|
@@ -226,6 +226,7 @@ function getFormatResponse(result) {
|
|
|
226
226
|
|
|
227
227
|
const snkDataExporterCss = ".sc-snk-data-exporter-h{--snk-data-exporter--z-index:var(--most-visible, 3);display:flex;width:fit-content;height:fit-content}.snk-data-exporter.sc-snk-data-exporter{display:flex;width:fit-content;height:fit-content}.snk-data-exporter--overlap.sc-snk-data-exporter{z-index:var(--snk-data-exporter--z-index)}.snk-data-exporter__dropdown.sc-snk-data-exporter{display:none}.snk-data-exporter__dropdown--show.sc-snk-data-exporter{display:flex;flex-direction:column;position:fixed}.snk-data-exporter__dropdown.sc-snk-data-exporter>ez-dropdown.sc-snk-data-exporter{position:relative}";
|
|
228
228
|
|
|
229
|
+
const LIMIT_PER_EXPORT = 5000;
|
|
229
230
|
const SnkDataExporter = class {
|
|
230
231
|
constructor(hostRef) {
|
|
231
232
|
registerInstance(this, hostRef);
|
|
@@ -312,6 +313,7 @@ const SnkDataExporter = class {
|
|
|
312
313
|
const columns = this.provider.getColumnsMetadata();
|
|
313
314
|
const sort = this.provider.getOrders();
|
|
314
315
|
const resourceURI = this.provider.getResourceURI();
|
|
316
|
+
const selectedIDs = this.provider.getSelectedIDs();
|
|
315
317
|
const option = resolveProps.exportOption;
|
|
316
318
|
const currentPageOptions = [
|
|
317
319
|
DataExporterOption.EXPORT_PAGE_TO_PDF,
|
|
@@ -321,7 +323,7 @@ const SnkDataExporter = class {
|
|
|
321
323
|
let params = Object.assign({ filters,
|
|
322
324
|
columns,
|
|
323
325
|
sort,
|
|
324
|
-
resourceURI }, resolveProps);
|
|
326
|
+
resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
|
|
325
327
|
if (currentPageOptions.includes(option)) {
|
|
326
328
|
const offset = this.provider.getOffset();
|
|
327
329
|
const limit = this.provider.getLimit();
|
|
@@ -347,7 +349,8 @@ const SnkDataExporter = class {
|
|
|
347
349
|
methodName: DataExporterOption[`EXPORT_TO_${fileType}`],
|
|
348
350
|
fileName: this._appLabel,
|
|
349
351
|
titleGrid: this._appLabel,
|
|
350
|
-
exportOption: option
|
|
352
|
+
exportOption: option,
|
|
353
|
+
limit: LIMIT_PER_EXPORT
|
|
351
354
|
};
|
|
352
355
|
this.resolveExporter(params, (response) => {
|
|
353
356
|
fileViewer(Object.assign(Object.assign({}, response), { fileType,
|
|
@@ -356,9 +359,46 @@ const SnkDataExporter = class {
|
|
|
356
359
|
});
|
|
357
360
|
}
|
|
358
361
|
async processExporter(evt) {
|
|
359
|
-
var _a;
|
|
362
|
+
var _a, _b, _c, _d;
|
|
360
363
|
const item = evt === null || evt === void 0 ? void 0 : evt.detail;
|
|
361
|
-
|
|
364
|
+
const exportCurrentPageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
|
|
365
|
+
const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
|
|
366
|
+
if ((item === null || item === void 0 ? void 0 : item.id) === DataExporterOption.EXPORT_CURRENT_PAGE)
|
|
367
|
+
return;
|
|
368
|
+
const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
|
|
369
|
+
const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
|
|
370
|
+
const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
|
|
371
|
+
let limitExceeded = false;
|
|
372
|
+
if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
|
|
373
|
+
limitExceeded = false;
|
|
374
|
+
}
|
|
375
|
+
else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
|
|
376
|
+
limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
|
|
377
|
+
}
|
|
378
|
+
else if (totalRecords > LIMIT_PER_EXPORT)
|
|
379
|
+
limitExceeded = true;
|
|
380
|
+
if (limitExceeded) {
|
|
381
|
+
const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
|
|
382
|
+
const limitModalMessages = {
|
|
383
|
+
title: this.getMessage("snkDataExporter.limitExceeded.title"),
|
|
384
|
+
description: `
|
|
385
|
+
${this.getMessage("snkDataExporter.limitExceeded.description", { limit: formattedLimit })}
|
|
386
|
+
<br/><br/>
|
|
387
|
+
<b>
|
|
388
|
+
${this.getMessage("snkDataExporter.limitExceeded.subdescription")}
|
|
389
|
+
</b>
|
|
390
|
+
`,
|
|
391
|
+
cancel: this.getMessage("snkDataExporter.limitExceeded.cancel"),
|
|
392
|
+
confirm: this.getMessage("snkDataExporter.limitExceeded.continue")
|
|
393
|
+
};
|
|
394
|
+
const isAccepted = await ApplicationUtils.confirm(limitModalMessages.title, limitModalMessages.description, null, DialogType.WARN, {
|
|
395
|
+
labelCancel: limitModalMessages.cancel,
|
|
396
|
+
labelConfirm: limitModalMessages.confirm,
|
|
397
|
+
});
|
|
398
|
+
if (!isAccepted)
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (isCustomReport) {
|
|
362
402
|
this.openPersonalizedReports(item.id);
|
|
363
403
|
this._showDropdown = false;
|
|
364
404
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-a77b6f35.js';
|
|
2
2
|
import { Action, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
|
-
import { O as OperationMap } from './SnkMessageBuilder-
|
|
4
|
+
import { O as OperationMap } from './SnkMessageBuilder-66ddc2f0.js';
|
|
5
5
|
|
|
6
6
|
const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
|
|
7
7
|
|
|
@@ -107,15 +107,17 @@ const SnkDataUnit = class {
|
|
|
107
107
|
const selectedRecords = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecords();
|
|
108
108
|
if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
|
|
109
109
|
selectedRecords.forEach(({ __record__id__ }) => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
if (!this.dataUnit.isNewRecord(__record__id__)) {
|
|
111
|
+
const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
|
|
112
|
+
Object.entries(revertBase64ToObject).forEach(([name, value]) => {
|
|
113
|
+
var _a;
|
|
114
|
+
const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
|
|
115
|
+
if (metadataField == undefined) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
119
121
|
});
|
|
120
122
|
}
|
|
121
123
|
return selectedRecordsIDsInfo;
|