@sankhyalabs/sankhyablocks 8.15.0-dev.82 → 8.15.0-dev.84

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.
Files changed (87) hide show
  1. package/dist/cjs/{IExporterProvider-0c814e9a.js → IExporterProvider-c78cb1b8.js} +3 -3
  2. package/dist/cjs/{SnkFormConfigManager-52f99b4d.js → SnkFormConfigManager-1b13bacd.js} +6 -3
  3. package/dist/cjs/{SnkMessageBuilder-4a95fe86.js → SnkMessageBuilder-722b104e.js} +2 -0
  4. package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
  5. package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  8. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-data-exporter.cjs.entry.js +120 -11
  10. package/dist/cjs/{snk-data-unit-5be491da.js → snk-data-unit-56babf28.js} +1 -1
  11. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  12. package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-form.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-grid.cjs.entry.js +3 -3
  15. package/dist/cjs/{snk-guides-viewer-5d5f0f25.js → snk-guides-viewer-05a1ba27.js} +3 -3
  16. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  17. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -4
  18. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
  19. package/dist/cjs/{taskbar-elements-d9392685.js → taskbar-elements-9ad1f9c0.js} +1 -1
  20. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +8 -1
  21. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +8 -2
  22. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +2 -2
  23. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +23 -6
  24. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
  25. package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
  26. package/dist/collection/components/snk-form/snk-form.js +1 -1
  27. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -3
  28. package/dist/collection/lib/@types/index.js +5 -0
  29. package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
  30. package/dist/components/IExporterProvider.js +2 -2
  31. package/dist/components/ISave.js +6 -1
  32. package/dist/components/SnkFormConfigManager.js +6 -3
  33. package/dist/components/SnkMessageBuilder.js +2 -0
  34. package/dist/components/snk-data-exporter2.js +118 -9
  35. package/dist/components/snk-form.js +1 -1
  36. package/dist/esm/{IExporterProvider-c0194569.js → IExporterProvider-343272b3.js} +3 -3
  37. package/dist/esm/{SnkFormConfigManager-5b0d69cd.js → SnkFormConfigManager-d4554df9.js} +6 -3
  38. package/dist/esm/{SnkMessageBuilder-3a767111.js → SnkMessageBuilder-89925609.js} +2 -0
  39. package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
  40. package/dist/esm/snk-actions-button_4.entry.js +1 -1
  41. package/dist/esm/snk-application.entry.js +1 -1
  42. package/dist/esm/snk-attach.entry.js +2 -2
  43. package/dist/esm/snk-crud.entry.js +2 -2
  44. package/dist/esm/snk-data-exporter.entry.js +120 -11
  45. package/dist/esm/{snk-data-unit-9110a07b.js → snk-data-unit-56b5efc4.js} +1 -1
  46. package/dist/esm/snk-data-unit.entry.js +2 -2
  47. package/dist/esm/snk-detail-view.entry.js +5 -5
  48. package/dist/esm/snk-form.entry.js +2 -2
  49. package/dist/esm/snk-grid.entry.js +3 -3
  50. package/dist/esm/{snk-guides-viewer-ef8c4eec.js → snk-guides-viewer-aee2cafe.js} +3 -3
  51. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  52. package/dist/esm/snk-simple-crud.entry.js +4 -4
  53. package/dist/esm/snk-taskbar.entry.js +2 -2
  54. package/dist/esm/{taskbar-elements-ad766858.js → taskbar-elements-d59867f1.js} +1 -1
  55. package/dist/sankhyablocks/{p-8322ccdb.entry.js → p-0d91b10f.entry.js} +1 -1
  56. package/dist/sankhyablocks/{p-9b1c0824.entry.js → p-0f4de966.entry.js} +1 -1
  57. package/dist/sankhyablocks/{p-2ac8bd11.entry.js → p-26394a01.entry.js} +1 -1
  58. package/dist/sankhyablocks/{p-039c7148.entry.js → p-2d649237.entry.js} +1 -1
  59. package/dist/sankhyablocks/p-30cf616e.js +1 -0
  60. package/dist/sankhyablocks/p-4e27bead.entry.js +1 -0
  61. package/dist/sankhyablocks/{p-a64baa0f.entry.js → p-4f72727a.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-04821c60.entry.js → p-550fee49.entry.js} +1 -1
  63. package/dist/sankhyablocks/p-7a337364.js +1 -0
  64. package/dist/sankhyablocks/{p-61dd89eb.js → p-7e7a7473.js} +1 -1
  65. package/dist/sankhyablocks/p-829d4045.js +1 -0
  66. package/dist/sankhyablocks/{p-543537ca.js → p-88a77075.js} +1 -1
  67. package/dist/sankhyablocks/{p-3f1efb97.entry.js → p-8a5910a7.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-294df368.entry.js → p-8cc64963.entry.js} +1 -1
  69. package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
  70. package/dist/sankhyablocks/{p-babe7665.js → p-9e99a92a.js} +1 -1
  71. package/dist/sankhyablocks/{p-5646ee8c.entry.js → p-b1ee6b27.entry.js} +1 -1
  72. package/dist/sankhyablocks/{p-d26365ad.js → p-be603a24.js} +1 -1
  73. package/dist/sankhyablocks/{p-58687027.entry.js → p-f2809746.entry.js} +1 -1
  74. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  75. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +1 -0
  76. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +1 -0
  77. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +1 -0
  78. package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
  79. package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
  80. package/dist/types/lib/@types/index.d.ts +5 -0
  81. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
  82. package/package.json +1 -1
  83. package/dist/sankhyablocks/p-060fdb6c.js +0 -1
  84. package/dist/sankhyablocks/p-32062be4.entry.js +0 -1
  85. package/dist/sankhyablocks/p-38289a55.js +0 -1
  86. package/dist/sankhyablocks/p-4ce73e88.js +0 -1
  87. package/dist/sankhyablocks/p-70a6e662.entry.js +0 -1
@@ -20,7 +20,9 @@ export class SnkDataExporter {
20
20
  DataExporterOption.EXPORT_PDF_TO_EMAIL,
21
21
  DataExporterOption.EXPORT_XLS_TO_EMAIL,
22
22
  DataExporterOption.EXPORT_PAGE_TO_PDF,
23
- DataExporterOption.EXPORT_PAGE_TO_XLS
23
+ DataExporterOption.EXPORT_PAGE_TO_XLS,
24
+ DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF,
25
+ DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS,
24
26
  ];
25
27
  this._items = [];
26
28
  this._showDropdown = false;
@@ -111,7 +113,16 @@ export class SnkDataExporter {
111
113
  return DataExporterOption[key] === option;
112
114
  });
113
115
  }
114
- dispatchExporter(option) {
116
+ getExportType(option) {
117
+ if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF || option === DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS) {
118
+ return 'all';
119
+ }
120
+ if (option === DataExporterOption.EXPORT_PAGE_TO_PDF || option === DataExporterOption.EXPORT_PAGE_TO_XLS) {
121
+ return 'page';
122
+ }
123
+ return 'selection';
124
+ }
125
+ async dispatchExporter(option) {
115
126
  var _a, _b, _c;
116
127
  const optionKey = this.getOptionKey(option);
117
128
  const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
@@ -121,11 +132,17 @@ export class SnkDataExporter {
121
132
  fileName: this._appLabel,
122
133
  titleGrid: this._appLabel,
123
134
  exportOption: option,
124
- limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b)
135
+ limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b),
136
+ type: this.getExportType(option),
125
137
  };
126
- this.resolveExporter(params, (response) => {
127
- fileViewer(Object.assign(Object.assign({}, response), { fileType,
128
- isDownload }));
138
+ await this.resolveExporter(params, (response) => {
139
+ if (response.canExport || fileType === DataExporterType.EXPORT_TO_PDF) {
140
+ fileViewer(Object.assign(Object.assign({}, response), { fileType,
141
+ isDownload }));
142
+ }
143
+ else {
144
+ ApplicationUtils.error(this.getMessage("snkDataExporter.title.permission"), this.getMessage("snkDataExporter.message.exportPermission"));
145
+ }
129
146
  });
130
147
  }
131
148
  async processExporter(evt) {
@@ -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,20 @@
1
+ import { DataExporterOption } from "../../../lib/@types";
2
+ const DOC_MAX_WIDTH = 800;
3
+ export function getVisibleColumns(columns) {
4
+ const visibleColumns = [];
5
+ let totalWidth = 0;
6
+ for (const column of columns) {
7
+ totalWidth += column.width;
8
+ if (totalWidth >= DOC_MAX_WIDTH) {
9
+ break;
10
+ }
11
+ visibleColumns.push(column);
12
+ }
13
+ return visibleColumns;
14
+ }
15
+ export function getOptionKey(option) {
16
+ return Object.keys(DataExporterOption)
17
+ .find((key) => {
18
+ return DataExporterOption[key] === option;
19
+ });
20
+ }
@@ -89,7 +89,7 @@ export class SnkForm {
89
89
  }
90
90
  this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
91
91
  this.addFormLegacyConfig();
92
- this._configManager.loadConfig();
92
+ await this._configManager.loadConfig();
93
93
  }
94
94
  async handleDataStateChange(evt) {
95
95
  var _a;
@@ -71,11 +71,14 @@ export class SnkFormConfigManager {
71
71
  var _a;
72
72
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
73
73
  if (fields != undefined && fields.length > 0) {
74
- return fields.map(({ label, name, readOnly, visible }) => {
74
+ return fields.map(({ label, name, readOnly, visible, required }) => {
75
75
  if (label == undefined) {
76
- return dataUnit.getField(name);
76
+ return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
77
+ readOnly,
78
+ visible,
79
+ required });
77
80
  }
78
- return { name, label, readOnly, visible };
81
+ return { name, label, readOnly, visible, required };
79
82
  })
80
83
  .filter(field => this.isFieldVisible(field, descriptionFilter));
81
84
  }
@@ -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: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 30 : column.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: 200,
286
+ width: column.width,
287
287
  type: DataType.TEXT,
288
288
  userInterface: UserInterface$1.LONGTEXT,
289
289
  descriptionFrom: fieldData.name
@@ -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 = {}));
@@ -39,4 +44,4 @@ var SaveErrorsEnum;
39
44
  SaveErrorsEnum["DESCRIPTION_CANNOT_BE_CHANGED"] = "DESCRIPTION_CANNOT_BE_CHANGED";
40
45
  })(SaveErrorsEnum || (SaveErrorsEnum = {}));
41
46
 
42
- export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, DataExporterFormat as a, DataExporterType as b };
47
+ export { DataExporterOption as D, PresentationMode as P, SaveErrorsEnum as S, DataExporterType as a, DataExporterFormat as b };
@@ -72,11 +72,14 @@ class SnkFormConfigManager {
72
72
  var _a;
73
73
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
74
74
  if (fields != undefined && fields.length > 0) {
75
- return fields.map(({ label, name, readOnly, visible }) => {
75
+ return fields.map(({ label, name, readOnly, visible, required }) => {
76
76
  if (label == undefined) {
77
- return dataUnit.getField(name);
77
+ return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
78
+ readOnly,
79
+ visible,
80
+ required });
78
81
  }
79
- return { name, label, readOnly, visible };
82
+ return { name, label, readOnly, visible, required };
80
83
  })
81
84
  .filter(field => this.isFieldVisible(field, descriptionFilter));
82
85
  }
@@ -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",
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { ApplicationContext, ObjectUtils, UserInterface, DataType, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './ISave.js';
4
+ import { D as DataExporterOption, a as DataExporterType, b as DataExporterFormat } from './ISave.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants.js';
6
6
  import { D as DataFetcher } from './DataFetcher.js';
7
7
  import { S as SnkDataUnit } from './snk-data-unit2.js';
@@ -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,26 @@ 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
+ function getOptionKey(option) {
260
+ return Object.keys(DataExporterOption)
261
+ .find((key) => {
262
+ return DataExporterOption[key] === option;
263
+ });
264
+ }
265
+
184
266
  var __rest = (undefined && undefined.__rest) || function (s, e) {
185
267
  var t = {};
186
268
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -196,10 +278,15 @@ class ServerSideExporterStrategy {
196
278
  constructor(provider) {
197
279
  this._provider = provider;
198
280
  }
281
+ async getParsedColumns() {
282
+ const columns = await this._provider.getColumnsMetadata();
283
+ const visibleColumns = getVisibleColumns(columns);
284
+ return visibleColumns;
285
+ }
199
286
  async getParams(resolveProps) {
200
287
  var _a, _b, _c, _d, _e, _f;
201
288
  const filters = (_b = (_a = this._provider).getFilters) === null || _b === void 0 ? void 0 : _b.call(_a);
202
- const columns = await this._provider.getColumnsMetadata();
289
+ const columns = [DataExporterType.EXPORT_TO_PDF, DataExporterType.EXPORT_PAGE_TO_PDF, DataExporterType.EXPORT_PDF_TO_EMAIL, DataExporterType.EXPORT_ALL_RECORDS_TO_PDF].includes(getOptionKey(resolveProps === null || resolveProps === void 0 ? void 0 : resolveProps.exportOption)) ? await this.getParsedColumns() : await this._provider.getColumnsMetadata();
203
290
  const sort = (_d = (_c = this._provider).getOrders) === null || _d === void 0 ? void 0 : _d.call(_c);
204
291
  const resourceURI = (_f = (_e = this._provider).getResourceURI) === null || _f === void 0 ? void 0 : _f.call(_e);
205
292
  const selectedIDs = this._provider.getSelectedIDs();
@@ -250,10 +337,15 @@ class ClientSideExporterStrategy {
250
337
  constructor(provider) {
251
338
  this._provider = provider;
252
339
  }
340
+ async getParsedColumns() {
341
+ const columns = await this._provider.getColumnsMetadata();
342
+ const visibleColumns = getVisibleColumns(columns);
343
+ return visibleColumns;
344
+ }
253
345
  async executeExport(resolveProps) {
254
346
  const { methodName, titleGrid } = resolveProps;
255
347
  const records = await this._provider.getRecords();
256
- const columns = await this._provider.getColumnsMetadata();
348
+ const columns = [DataExporterType.EXPORT_TO_PDF, DataExporterType.EXPORT_PAGE_TO_PDF, DataExporterType.EXPORT_PDF_TO_EMAIL, DataExporterType.EXPORT_ALL_RECORDS_TO_PDF].includes(getOptionKey(resolveProps === null || resolveProps === void 0 ? void 0 : resolveProps.exportOption)) ? await this.getParsedColumns() : await this._provider.getColumnsMetadata();
257
349
  const [serviceName, processor] = this.getExecutor(methodName);
258
350
  const payload = {
259
351
  serviceName,
@@ -348,7 +440,9 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
348
440
  DataExporterOption.EXPORT_PDF_TO_EMAIL,
349
441
  DataExporterOption.EXPORT_XLS_TO_EMAIL,
350
442
  DataExporterOption.EXPORT_PAGE_TO_PDF,
351
- DataExporterOption.EXPORT_PAGE_TO_XLS
443
+ DataExporterOption.EXPORT_PAGE_TO_XLS,
444
+ DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF,
445
+ DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS,
352
446
  ];
353
447
  this._items = [];
354
448
  this._showDropdown = false;
@@ -439,7 +533,16 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
439
533
  return DataExporterOption[key] === option;
440
534
  });
441
535
  }
442
- dispatchExporter(option) {
536
+ getExportType(option) {
537
+ if (option === DataExporterOption.EXPORT_ALL_RECORDS_TO_PDF || option === DataExporterOption.EXPORT_ALL_RECORDS_TO_XLS) {
538
+ return 'all';
539
+ }
540
+ if (option === DataExporterOption.EXPORT_PAGE_TO_PDF || option === DataExporterOption.EXPORT_PAGE_TO_XLS) {
541
+ return 'page';
542
+ }
543
+ return 'selection';
544
+ }
545
+ async dispatchExporter(option) {
443
546
  var _a, _b, _c;
444
547
  const optionKey = this.getOptionKey(option);
445
548
  const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
@@ -449,11 +552,17 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
449
552
  fileName: this._appLabel,
450
553
  titleGrid: this._appLabel,
451
554
  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)
555
+ limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b),
556
+ type: this.getExportType(option),
453
557
  };
454
- this.resolveExporter(params, (response) => {
455
- fileViewer(Object.assign(Object.assign({}, response), { fileType,
456
- isDownload }));
558
+ await this.resolveExporter(params, (response) => {
559
+ if (response.canExport || fileType === DataExporterType.EXPORT_TO_PDF) {
560
+ fileViewer(Object.assign(Object.assign({}, response), { fileType,
561
+ isDownload }));
562
+ }
563
+ else {
564
+ ApplicationUtils.error(this.getMessage("snkDataExporter.title.permission"), this.getMessage("snkDataExporter.message.exportPermission"));
565
+ }
457
566
  });
458
567
  }
459
568
  async processExporter(evt) {
@@ -101,7 +101,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
101
101
  }
102
102
  this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
103
103
  this.addFormLegacyConfig();
104
- this._configManager.loadConfig();
104
+ await this._configManager.loadConfig();
105
105
  }
106
106
  async handleDataStateChange(evt) {
107
107
  var _a;
@@ -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-0ece87a6.js';
4
+ import './index-3aa4977a.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: (fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface) === UserInterface$1.SEARCH ? 30 : column.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: 200,
209
+ width: column.width,
210
210
  type: DataType.TEXT,
211
211
  userInterface: UserInterface$1.LONGTEXT,
212
212
  descriptionFrom: fieldData.name
@@ -72,11 +72,14 @@ class SnkFormConfigManager {
72
72
  var _a;
73
73
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
74
74
  if (fields != undefined && fields.length > 0) {
75
- return fields.map(({ label, name, readOnly, visible }) => {
75
+ return fields.map(({ label, name, readOnly, visible, required }) => {
76
76
  if (label == undefined) {
77
- return dataUnit.getField(name);
77
+ return Object.assign(Object.assign({}, dataUnit.getField(name)), { name,
78
+ readOnly,
79
+ visible,
80
+ required });
78
81
  }
79
- return { name, label, readOnly, visible };
82
+ return { name, label, readOnly, visible, required };
80
83
  })
81
84
  .filter(field => this.isFieldVisible(field, descriptionFilter));
82
85
  }
@@ -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,8 +30,10 @@ 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 = {}));
33
38
 
34
- export { DataExporterOption as D, PresentationMode as P, DataExporterFormat as a, DataExporterType as b };
39
+ export { DataExporterOption as D, PresentationMode as P, DataExporterType as a, DataExporterFormat as b };
@@ -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-0ece87a6.js';
6
+ import './index-3aa4977a.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-3a767111.js';
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-0ece87a6.js';
5
+ import './index-3aa4977a.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-ad766858.js';
12
+ import { T as TaskbarElement } from './taskbar-elements-d59867f1.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';