@sankhyalabs/sankhyablocks 8.15.0-dev.52 → 8.15.0-dev.54

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 (166) hide show
  1. package/dist/cjs/{ConfigStorage-8d4e9d53.js → ConfigStorage-085c7117.js} +11 -12
  2. package/dist/cjs/{SnkMultiSelectionListDataSource-d15f7aac.js → IExporterProvider-955812ad.js} +52 -5
  3. package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
  4. package/dist/cjs/{SnkFormConfigManager-33995e92.js → SnkFormConfigManager-8986431f.js} +2 -2
  5. package/dist/cjs/{auth-fetcher-bb8e9ae4.js → auth-fetcher-eddaf17f.js} +1 -1
  6. package/dist/cjs/{DataFetcher-99f0f6ed.js → form-config-fetcher-cdd644a7.js} +251 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-bdbbe9ac.js → pesquisa-fetcher-6e934fb5.js} +30 -16
  9. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  10. package/dist/cjs/snk-actions-button_4.cjs.entry.js +8 -9
  11. package/dist/cjs/snk-application.cjs.entry.js +22 -23
  12. package/dist/cjs/snk-attach.cjs.entry.js +12 -13
  13. package/dist/cjs/snk-crud.cjs.entry.js +4 -5
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +195 -78
  15. package/dist/cjs/{snk-data-unit-41c29713.js → snk-data-unit-abd2113f.js} +2 -37
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -1
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +6 -7
  18. package/dist/cjs/snk-filter-bar.cjs.entry.js +2 -3
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
  20. package/dist/cjs/snk-form-config.cjs.entry.js +1 -2
  21. package/dist/cjs/snk-form.cjs.entry.js +3 -4
  22. package/dist/cjs/snk-grid.cjs.entry.js +65 -102
  23. package/dist/cjs/{snk-guides-viewer-a8dd24a3.js → snk-guides-viewer-4e8b517b.js} +4 -5
  24. package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -7
  25. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
  26. package/dist/cjs/snk-simple-crud.cjs.entry.js +124 -33
  27. package/dist/cjs/snk-taskbar.cjs.entry.js +3 -2
  28. package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
  29. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
  30. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
  31. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
  32. package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
  33. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
  34. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
  35. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +35 -45
  36. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
  37. package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
  38. package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
  39. package/dist/collection/components/snk-grid/snk-grid.js +3 -94
  40. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +91 -11
  41. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
  42. package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
  43. package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
  44. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
  45. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
  46. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +8 -1
  47. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
  48. package/dist/components/ConfigStorage.js +1 -2
  49. package/dist/components/{field-search.js → IExporterProvider.js} +52 -7
  50. package/dist/components/ISave.js +42 -0
  51. package/dist/components/dataunit-fetcher.js +18 -4
  52. package/dist/components/form-config-fetcher.js +7022 -3
  53. package/dist/components/index2.js +198 -33
  54. package/dist/components/snk-actions-button2.js +3 -12
  55. package/dist/components/snk-application2.js +1 -1
  56. package/dist/components/snk-attach2.js +3 -4
  57. package/dist/components/snk-crud.js +3 -4
  58. package/dist/components/snk-data-exporter2.js +192 -79
  59. package/dist/components/snk-data-unit2.js +41 -39
  60. package/dist/components/snk-detail-view2.js +4 -5
  61. package/dist/components/snk-expression-item2.js +1 -1
  62. package/dist/components/snk-form-config2.js +1 -1
  63. package/dist/components/snk-grid2.js +63 -100
  64. package/dist/components/snk-personalized-filter2.js +1 -1
  65. package/dist/components/snk-simple-crud2.js +111 -18
  66. package/dist/components/snk-taskbar2.js +6 -5
  67. package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
  68. package/dist/esm/{SnkMultiSelectionListDataSource-7084f3b3.js → IExporterProvider-6ebf47ab.js} +52 -6
  69. package/dist/esm/RecordIDUtils-87d02110.js +41 -0
  70. package/dist/esm/{SnkFormConfigManager-7a4e678f.js → SnkFormConfigManager-7edda7eb.js} +2 -2
  71. package/dist/esm/{auth-fetcher-8ec448b0.js → auth-fetcher-11dd9cae.js} +1 -1
  72. package/dist/esm/{DataFetcher-a650ae58.js → form-config-fetcher-13cd3285.js} +250 -1
  73. package/dist/esm/loader.js +1 -1
  74. package/dist/esm/{pesquisa-fetcher-96d2f351.js → pesquisa-fetcher-4eed47c6.js} +18 -4
  75. package/dist/esm/sankhyablocks.js +1 -1
  76. package/dist/esm/snk-actions-button_4.entry.js +3 -4
  77. package/dist/esm/snk-application.entry.js +4 -5
  78. package/dist/esm/snk-attach.entry.js +4 -5
  79. package/dist/esm/snk-crud.entry.js +4 -5
  80. package/dist/esm/snk-data-exporter.entry.js +195 -78
  81. package/dist/esm/{snk-data-unit-de1d140d.js → snk-data-unit-29eba11a.js} +3 -38
  82. package/dist/esm/snk-data-unit.entry.js +2 -1
  83. package/dist/esm/snk-detail-view.entry.js +6 -7
  84. package/dist/esm/snk-filter-bar.entry.js +2 -3
  85. package/dist/esm/snk-filter-modal-item.entry.js +2 -3
  86. package/dist/esm/snk-form-config.entry.js +1 -2
  87. package/dist/esm/snk-form.entry.js +3 -4
  88. package/dist/esm/snk-grid.entry.js +63 -100
  89. package/dist/esm/{snk-guides-viewer-131e9660.js → snk-guides-viewer-2742a9db.js} +4 -5
  90. package/dist/esm/snk-guides-viewer.entry.js +6 -7
  91. package/dist/esm/snk-personalized-filter.entry.js +2 -3
  92. package/dist/esm/snk-simple-crud.entry.js +112 -21
  93. package/dist/esm/snk-taskbar.entry.js +3 -2
  94. package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-ad766858.js} +2 -2
  95. package/dist/sankhyablocks/p-07825198.js +1 -0
  96. package/dist/sankhyablocks/p-1d9d07b4.entry.js +1 -0
  97. package/dist/sankhyablocks/p-201e5588.entry.js +1 -0
  98. package/dist/sankhyablocks/p-33a6728e.js +26 -0
  99. package/dist/sankhyablocks/p-37afb96a.js +1 -0
  100. package/dist/sankhyablocks/p-411fe937.entry.js +1 -0
  101. package/dist/sankhyablocks/p-44d52fc6.js +1 -0
  102. package/dist/sankhyablocks/p-4ddf7add.entry.js +1 -0
  103. package/dist/sankhyablocks/p-7b797d8f.entry.js +1 -0
  104. package/dist/sankhyablocks/p-87cb937d.js +65 -0
  105. package/dist/sankhyablocks/{p-0624f62d.js → p-8a4c4b54.js} +6 -6
  106. package/dist/sankhyablocks/p-9863d682.js +1 -0
  107. package/dist/sankhyablocks/{p-125bb902.js → p-99b51d06.js} +1 -1
  108. package/dist/sankhyablocks/p-9ee96756.entry.js +1 -0
  109. package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
  110. package/dist/sankhyablocks/p-bf209f48.entry.js +1 -0
  111. package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
  112. package/dist/sankhyablocks/p-c3c0ad0b.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-619c5f6f.entry.js → p-c801a38a.entry.js} +2 -2
  114. package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
  115. package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
  116. package/dist/sankhyablocks/p-e4225e8b.entry.js +1 -0
  117. package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
  118. package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
  119. package/dist/sankhyablocks/p-fd44c905.entry.js +1 -0
  120. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  121. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
  122. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
  123. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
  124. package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
  125. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
  126. package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
  127. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
  128. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
  129. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  130. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -3
  131. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +15 -2
  132. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
  133. package/dist/types/components.d.ts +16 -0
  134. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
  135. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
  136. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  137. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
  138. package/package.json +1 -1
  139. package/dist/cjs/form-config-fetcher-d73f4449.js +0 -256
  140. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
  141. package/dist/components/DataFetcher.js +0 -7023
  142. package/dist/components/index3.js +0 -199
  143. package/dist/esm/form-config-fetcher-765b8498.js +0 -253
  144. package/dist/sankhyablocks/p-004c356e.js +0 -26
  145. package/dist/sankhyablocks/p-075bba4c.entry.js +0 -1
  146. package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
  147. package/dist/sankhyablocks/p-103c5956.entry.js +0 -1
  148. package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
  149. package/dist/sankhyablocks/p-13ae1a89.entry.js +0 -1
  150. package/dist/sankhyablocks/p-19a56978.entry.js +0 -1
  151. package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
  152. package/dist/sankhyablocks/p-34a7f2ab.js +0 -65
  153. package/dist/sankhyablocks/p-52c8e589.js +0 -1
  154. package/dist/sankhyablocks/p-5833cff9.js +0 -1
  155. package/dist/sankhyablocks/p-5a2e016a.entry.js +0 -1
  156. package/dist/sankhyablocks/p-6f560924.entry.js +0 -1
  157. package/dist/sankhyablocks/p-8967fa78.js +0 -1
  158. package/dist/sankhyablocks/p-a87149e4.entry.js +0 -1
  159. package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
  160. package/dist/sankhyablocks/p-b10b9934.entry.js +0 -1
  161. package/dist/sankhyablocks/p-be75153c.js +0 -1
  162. package/dist/sankhyablocks/p-bf39bdb8.entry.js +0 -1
  163. package/dist/sankhyablocks/p-f7d0fab9.entry.js +0 -1
  164. package/dist/sankhyablocks/p-f7d9d148.entry.js +0 -1
  165. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
  166. /package/dist/sankhyablocks/{p-ae4fc9a9.js → p-61dd89eb.js} +0 -0
@@ -1,10 +1,14 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { ApplicationContext, ObjectUtils, DataType, ElementIDUtils } from '@sankhyalabs/core';
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 './index2.js';
4
+ import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './ISave.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants.js';
6
- import { D as DataFetcher } from './DataFetcher.js';
6
+ import { D as DataFetcher } from './form-config-fetcher.js';
7
7
  import { S as SnkDataUnit } from './snk-data-unit2.js';
8
+ import './dataunit-fetcher.js';
9
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
+ import './filter-item-type.enum.js';
8
12
  import { d as defineCustomElement$1 } from './snk-exporter-email-sender2.js';
9
13
 
10
14
  class ItemBuilder {
@@ -147,38 +151,6 @@ class ItemBuilder {
147
151
  }
148
152
  }
149
153
 
150
- var __rest = (undefined && undefined.__rest) || function (s, e) {
151
- var t = {};
152
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
153
- t[p] = s[p];
154
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
155
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
156
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
157
- t[p[i]] = s[p[i]];
158
- }
159
- return t;
160
- };
161
- function fetchDataExporter(_a) {
162
- var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
163
- const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
164
- const serviceName = `${application.getModuleName()}@DataExporterSPBean.${methodName}`;
165
- const payload = { serviceName, requestBody };
166
- return new Promise((resolve, reject) => {
167
- DataFetcher.get()
168
- .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
169
- .then(result => resolve(getFormatResponse$1(result)))
170
- .catch(error => reject(error));
171
- });
172
- }
173
- function getFormatResponse$1(result) {
174
- var _a;
175
- const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
176
- if (response == undefined) {
177
- return;
178
- }
179
- return ObjectUtils.stringToObject(response);
180
- }
181
-
182
154
  function getMessage(application, key, params) {
183
155
  var _a;
184
156
  return (_a = application === null || application === void 0 ? void 0 : application.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
@@ -207,17 +179,166 @@ function getFormatResponse(result) {
207
179
  return ObjectUtils.stringToObject(response);
208
180
  }
209
181
 
182
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
183
+ var t = {};
184
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
185
+ t[p] = s[p];
186
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
187
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
188
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
189
+ t[p[i]] = s[p[i]];
190
+ }
191
+ return t;
192
+ };
193
+ class ServerSideExporterStrategy {
194
+ constructor(provider) {
195
+ this._provider = provider;
196
+ }
197
+ async getParams(resolveProps) {
198
+ var _a, _b, _c, _d, _e, _f;
199
+ const filters = (_b = (_a = this._provider).getFilters) === null || _b === void 0 ? void 0 : _b.call(_a);
200
+ const columns = await this._provider.getColumnsMetadata();
201
+ const sort = (_d = (_c = this._provider).getOrders) === null || _d === void 0 ? void 0 : _d.call(_c);
202
+ const resourceURI = (_f = (_e = this._provider).getResourceURI) === null || _f === void 0 ? void 0 : _f.call(_e);
203
+ const selectedIDs = this._provider.getSelectedIDs();
204
+ const option = resolveProps.exportOption;
205
+ const currentPageOptions = [
206
+ DataExporterOption.EXPORT_PAGE_TO_PDF,
207
+ DataExporterOption.EXPORT_PAGE_TO_XLS
208
+ ];
209
+ delete resolveProps.exportOption;
210
+ let params = Object.assign({ filters,
211
+ columns,
212
+ sort,
213
+ resourceURI, selectedIDs: selectedIDs.slice(0, this._provider.getExportLimit()) }, resolveProps);
214
+ if (currentPageOptions.includes(option) || resolveProps.type == "page") {
215
+ const offset = this._provider.getOffset();
216
+ const limit = this._provider.getPageSize();
217
+ params = Object.assign(Object.assign({}, params), { offset,
218
+ limit, selectedIDs: [] });
219
+ }
220
+ else if (resolveProps.type == "all") {
221
+ params = Object.assign(Object.assign({}, params), { offset: 0, limit: this._provider.getExportLimit(), selectedIDs: [] });
222
+ }
223
+ return Promise.resolve(params);
224
+ }
225
+ async executeExport(resolveProps) {
226
+ const _a = await this.getParams(resolveProps), { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
227
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
228
+ const serviceName = `${application.getModuleName()}@DataExporterSPBean.${methodName}`;
229
+ const payload = { serviceName, requestBody };
230
+ return new Promise((resolve, reject) => {
231
+ DataFetcher.get()
232
+ .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
233
+ .then(result => resolve(this.getFormatResponse(result)))
234
+ .catch(error => reject(error));
235
+ });
236
+ }
237
+ getFormatResponse(result) {
238
+ var _a;
239
+ const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
240
+ if (response == undefined) {
241
+ return;
242
+ }
243
+ return ObjectUtils.stringToObject(response);
244
+ }
245
+ }
246
+
247
+ class ClientSideExporterStrategy {
248
+ constructor(provider) {
249
+ this._provider = provider;
250
+ }
251
+ async executeExport(resolveProps) {
252
+ const { methodName, titleGrid } = resolveProps;
253
+ const records = await this._provider.getRecords();
254
+ const columns = await this._provider.getColumnsMetadata();
255
+ const [serviceName, processor] = this.getExecutor(methodName);
256
+ const payload = {
257
+ serviceName,
258
+ requestBody: {
259
+ grid: {
260
+ titleGrid,
261
+ columns: this.buildColumnsObject(columns),
262
+ rows: this.buildRowsObject(columns, records),
263
+ customOptions: { xlsxExtension: false }
264
+ }
265
+ }
266
+ };
267
+ return new Promise((resolve, reject) => {
268
+ DataFetcher.get()
269
+ .callServiceBroker(serviceName, payload)
270
+ .then(result => resolve(processor(result)))
271
+ .catch(error => reject(error));
272
+ });
273
+ }
274
+ getExecutor(methodName) {
275
+ if (methodName === "exportToPDF") {
276
+ return [
277
+ "GridPDFBuilderSP.buildPDFFromJson",
278
+ responseBody => ({
279
+ fileSessionKey: responseBody.chavePDF.valor,
280
+ canPrint: responseBody.permiteImprimir.valor === "S",
281
+ canExport: responseBody.permiteExportar.valor === "S",
282
+ canSendEmail: responseBody.canSendEmail.valor === "S",
283
+ useAppPrint: true
284
+ })
285
+ ];
286
+ }
287
+ return [
288
+ "GridXLSBuilderSP.buildXLSFromJson",
289
+ responseBody => ({
290
+ fileSessionKey: responseBody.chaveXLS.valor,
291
+ canPrint: false,
292
+ canExport: false,
293
+ useAppPrint: false,
294
+ canSendEmail: false
295
+ })
296
+ ];
297
+ }
298
+ buildColumnsObject(columns) {
299
+ return {
300
+ column: columns.map((column, index) => {
301
+ const { label, id, width, userInterface } = column;
302
+ return Object.assign({ index: index + 1, id,
303
+ label,
304
+ width, presentationType: "P" }, (TYPE_MAP[userInterface] || { type: "S", align: "left" }));
305
+ })
306
+ };
307
+ }
308
+ buildRowsObject(columns, records) {
309
+ return {
310
+ row: records.map(rawRecord => {
311
+ const record = {};
312
+ columns.forEach((column, index) => record["c" + (index + 1)] = { $: this.formatValue(rawRecord, column) });
313
+ return record;
314
+ })
315
+ };
316
+ }
317
+ formatValue(record, column) {
318
+ if (this._provider.formatValue != undefined) {
319
+ return this._provider.formatValue(record, column);
320
+ }
321
+ return record[column.id] || "";
322
+ }
323
+ }
324
+ const TYPE_MAP = {
325
+ [UserInterface.DATE]: { type: "D", align: "center" },
326
+ [UserInterface.DATETIME]: { type: "H", align: "center" },
327
+ [UserInterface.TIME]: { type: "I", align: "right" },
328
+ [UserInterface.ELAPSEDTIME]: { type: "I", align: "right" },
329
+ [UserInterface.DECIMALNUMBER]: { type: "F", align: "right" },
330
+ [UserInterface.INTEGERNUMBER]: { type: "I", align: "right" },
331
+ [UserInterface.SEARCH]: { type: "S", align: "right" }
332
+ };
333
+
210
334
  const snkDataExporterCss = ".sc-snk-data-exporter-h{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__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}";
211
335
 
212
- const LIMIT_PER_EXPORT = 5000;
213
336
  const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
214
337
  constructor() {
215
338
  super();
216
339
  this.__registerHost();
217
340
  this._selectedNumber = 0;
218
341
  this._customPrefix = "$custom$";
219
- this._items = [];
220
- this._showDropdown = false;
221
342
  this._releasedToExport = [
222
343
  DataExporterOption.EXPORT_TO_PDF,
223
344
  DataExporterOption.EXPORT_TO_XLS,
@@ -227,6 +348,8 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
227
348
  DataExporterOption.EXPORT_PAGE_TO_PDF,
228
349
  DataExporterOption.EXPORT_PAGE_TO_XLS
229
350
  ];
351
+ this._items = [];
352
+ this._showDropdown = false;
230
353
  this.provider = null;
231
354
  this.messagesBuilder = undefined;
232
355
  }
@@ -297,31 +420,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
297
420
  if (this.provider == undefined || resolveProps == undefined || callbackResolver == undefined) {
298
421
  return;
299
422
  }
300
- const filters = this.provider.getFilters();
301
- const columns = await this.provider.getColumnsMetadata();
302
- const sort = this.provider.getOrders();
303
- const resourceURI = this.provider.getResourceURI();
304
- const selectedIDs = this.provider.getSelectedIDs();
305
- const option = resolveProps.exportOption;
306
- const currentPageOptions = [
307
- DataExporterOption.EXPORT_PAGE_TO_PDF,
308
- DataExporterOption.EXPORT_PAGE_TO_XLS
309
- ];
310
- delete resolveProps.exportOption;
311
- let params = Object.assign({ filters,
312
- columns,
313
- sort,
314
- resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
315
- if (currentPageOptions.includes(option) || resolveProps.type == "page") {
316
- const offset = this.provider.getOffset();
317
- const limit = this.provider.getLimit();
318
- params = Object.assign(Object.assign({}, params), { offset,
319
- limit, selectedIDs: [] });
320
- }
321
- else if (resolveProps.type == "all") {
322
- params = Object.assign(Object.assign({}, params), { offset: 0, limit: LIMIT_PER_EXPORT, selectedIDs: [] });
323
- }
324
- fetchDataExporter(params)
423
+ this.getExporterStrategy().executeExport(resolveProps)
325
424
  .then((result) => callbackResolver(result))
326
425
  .catch((exception) => {
327
426
  console.error(exception);
@@ -329,6 +428,9 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
329
428
  ApplicationUtils.error(title || this.getMessage("snkDataExporter.message.exportError"), statusMessage || message || this.getMessage("snkDataExporter.message.unknownFailure"));
330
429
  });
331
430
  }
431
+ getExporterStrategy() {
432
+ return this.provider.getRecords == undefined ? new ServerSideExporterStrategy(this.provider) : new ClientSideExporterStrategy(this.provider);
433
+ }
332
434
  getOptionKey(option) {
333
435
  return Object.keys(DataExporterOption)
334
436
  .find((key) => {
@@ -336,7 +438,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
336
438
  });
337
439
  }
338
440
  dispatchExporter(option) {
339
- var _a;
441
+ var _a, _b, _c;
340
442
  const optionKey = this.getOptionKey(option);
341
443
  const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
342
444
  const isDownload = DataExporterType[optionKey] === DataExporterType.EXPORT_TO_XLS;
@@ -345,7 +447,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
345
447
  fileName: this._appLabel,
346
448
  titleGrid: this._appLabel,
347
449
  exportOption: option,
348
- limit: LIMIT_PER_EXPORT
450
+ limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b)
349
451
  };
350
452
  this.resolveExporter(params, (response) => {
351
453
  fileViewer(Object.assign(Object.assign({}, response), { fileType,
@@ -353,7 +455,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
353
455
  });
354
456
  }
355
457
  async processExporter(evt) {
356
- var _a, _b, _c, _d;
458
+ var _a, _b, _c, _d, _e, _f, _g;
357
459
  const item = evt === null || evt === void 0 ? void 0 : evt.detail;
358
460
  const exportCurrentPageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
359
461
  const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
@@ -361,18 +463,19 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
361
463
  return;
362
464
  const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
363
465
  const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
364
- const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
466
+ const totalPerPage = (_e = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getPageSize) === null || _e === void 0 ? void 0 : _e.call(_d);
467
+ const exportLimit = (_g = (_f = this.provider) === null || _f === void 0 ? void 0 : _f.getExportLimit) === null || _g === void 0 ? void 0 : _g.call(_f);
365
468
  let limitExceeded = false;
366
- if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
469
+ if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= exportLimit) || isCustomReport) {
367
470
  limitExceeded = false;
368
471
  }
369
472
  else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
370
- limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
473
+ limitExceeded = selectedRecords.length > exportLimit;
371
474
  }
372
- else if (totalRecords > LIMIT_PER_EXPORT)
475
+ else if (totalRecords > exportLimit)
373
476
  limitExceeded = true;
374
477
  if (limitExceeded) {
375
- const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
478
+ const formattedLimit = exportLimit.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
376
479
  const limitModalMessages = {
377
480
  title: this.getMessage("snkDataExporter.limitExceeded.title"),
378
481
  description: `
@@ -397,7 +500,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
397
500
  this._showDropdown = false;
398
501
  return;
399
502
  }
400
- if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
503
+ if (!this.getFilteredReleasedToExport().includes(item === null || item === void 0 ? void 0 : item.id)) {
401
504
  return;
402
505
  }
403
506
  if (item.id === DataExporterOption.EXPORT_BY_EMAIL) {
@@ -408,9 +511,20 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
408
511
  }
409
512
  this._showDropdown = false;
410
513
  }
514
+ getFilteredReleasedToExport() {
515
+ var _a, _b;
516
+ if (this.provider == undefined) {
517
+ return this._releasedToExport;
518
+ }
519
+ const hiddenOptions = (_b = (_a = this.provider).getHiddenOptions) === null || _b === void 0 ? void 0 : _b.call(_a);
520
+ if (hiddenOptions == undefined) {
521
+ return this._releasedToExport;
522
+ }
523
+ return this._releasedToExport.filter(option => !hiddenOptions.includes(option));
524
+ }
411
525
  loadItems() {
412
526
  const items = [];
413
- this._releasedToExport
527
+ this.getFilteredReleasedToExport()
414
528
  .forEach((option) => {
415
529
  var _a;
416
530
  (_a = this._itemBuilder) === null || _a === void 0 ? void 0 : _a.setExportOption(option, items);
@@ -418,8 +532,8 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
418
532
  this.loadPersonalizedItems(items);
419
533
  }
420
534
  async loadPersonalizedItems(items) {
421
- var _a;
422
- const recordID = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getRecordID();
535
+ var _a, _b;
536
+ const recordID = (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getRecordID) === null || _b === void 0 ? void 0 : _b.call(_a);
423
537
  if (recordID == undefined) {
424
538
  this._items = items;
425
539
  return;
@@ -435,10 +549,10 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
435
549
  this._items = items;
436
550
  }
437
551
  openPersonalizedReports(option) {
438
- var _a;
552
+ var _a, _b;
439
553
  const pkObject = [];
440
554
  const appId = (option === null || option === void 0 ? void 0 : option.replace(this._customPrefix, "")) || "";
441
- (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedIDs().forEach(({ name, type, value }, index) => {
555
+ (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedIDs) === null || _b === void 0 ? void 0 : _b.call(_a).forEach(({ name, type, value }, index) => {
442
556
  const fields = {};
443
557
  fields['fields'] = [];
444
558
  // Se for o primeiro elemento, adiciona essa primeira PK
@@ -520,8 +634,7 @@ const SnkDataExporter = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
520
634
  "provider": [16],
521
635
  "messagesBuilder": [1040],
522
636
  "_items": [32],
523
- "_showDropdown": [32],
524
- "_releasedToExport": [32]
637
+ "_showDropdown": [32]
525
638
  }]);
526
639
  function defineCustomElement() {
527
640
  if (typeof customElements === "undefined") {
@@ -1,8 +1,46 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { Action, ObjectUtils, JSUtils, DataUnitAction, ApplicationContext, DataType } from '@sankhyalabs/core';
2
+ import { JSUtils, DataType, Action, ObjectUtils, DataUnitAction, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { O as OperationMap, S as SnkMessageBuilder } from './SnkMessageBuilder.js';
5
5
 
6
+ const getSelectedIDs = (dataUnit) => {
7
+ const selectionInfo = dataUnit.getSelectionInfo();
8
+ if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
9
+ return [];
10
+ }
11
+ const selectedRecordsIDsInfo = [];
12
+ const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
13
+ if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
14
+ selectedRecords.forEach(recordId => {
15
+ if (!dataUnit.isNewRecord(recordId)) {
16
+ /*
17
+ Esse if foi necessário para tratar corretamente o ID
18
+ do record quando está sendo utilizado no modo standAlone
19
+ isso não faz a exportação da grid funcionar no modo standAlone
20
+ mas deixa de causar erro nas oprações de CRUD.
21
+ */
22
+ if (!JSUtils.isBase64(recordId)) {
23
+ selectedRecordsIDsInfo.push({
24
+ name: "__record__id__",
25
+ type: DataType.TEXT,
26
+ value: recordId
27
+ });
28
+ return;
29
+ }
30
+ const revertBase64ToObject = JSON.parse(window.atob(recordId));
31
+ Object.entries(revertBase64ToObject).forEach(([name, value]) => {
32
+ const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
33
+ if (metadataField == undefined) {
34
+ return;
35
+ }
36
+ selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
37
+ });
38
+ }
39
+ });
40
+ }
41
+ return selectedRecordsIDsInfo;
42
+ };
43
+
6
44
  const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
45
  constructor() {
8
46
  super();
@@ -125,43 +163,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
125
163
  * @returns Retorna a lista de IDs dos registros selecionados.
126
164
  */
127
165
  async getSelectedRecordsIDsInfo() {
128
- var _a;
129
- const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
130
- if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
131
- return [];
132
- }
133
- const selectedRecordsIDsInfo = [];
134
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
135
- if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
136
- selectedRecords.forEach(({ __record__id__ }) => {
137
- if (!this.dataUnit.isNewRecord(__record__id__)) {
138
- /*
139
- Esse if foi necessário para tratar corretamente o ID
140
- do record quando está sendo utilizado no modo standAlone
141
- isso não faz a exportação da grid funcionar no modo standAlone
142
- mas deixa de causar erro nas oprações de CRUD.
143
- */
144
- if (!JSUtils.isBase64(__record__id__)) {
145
- selectedRecordsIDsInfo.push({
146
- name: "__record__id__",
147
- type: DataType.TEXT,
148
- value: __record__id__
149
- });
150
- return;
151
- }
152
- const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
153
- Object.entries(revertBase64ToObject).forEach(([name, value]) => {
154
- var _a;
155
- const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
156
- if (metadataField == undefined) {
157
- return;
158
- }
159
- selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
160
- });
161
- }
162
- });
163
- }
164
- return selectedRecordsIDsInfo;
166
+ return Promise.resolve(getSelectedIDs(this.dataUnit));
165
167
  }
166
168
  getCleanOnCopyFields() {
167
169
  var _a;
@@ -486,4 +488,4 @@ function defineCustomElement() {
486
488
  } });
487
489
  }
488
490
 
489
- export { SnkDataUnit as S, defineCustomElement as d };
491
+ export { SnkDataUnit as S, defineCustomElement as d, getSelectedIDs as g };
@@ -2,18 +2,17 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, forceUpdate,
2
2
  import { Action, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
4
4
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
- import './DataFetcher.js';
5
+ import './form-config-fetcher.js';
6
6
  import './dataunit-fetcher.js';
7
- import { P as PresentationMode } from './index2.js';
8
- import { d as defineCustomElement$u } from './snk-actions-button2.js';
7
+ import { P as PresentationMode } from './ISave.js';
9
8
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
10
  import './filter-item-type.enum.js';
12
- import './form-config-fetcher.js';
13
11
  import { T as TaskbarElement, d as defineCustomElement$3 } from './snk-taskbar2.js';
14
12
  import { V as VIEW_MODE } from './constants.js';
15
- import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './field-search.js';
13
+ import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './IExporterProvider.js';
16
14
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
15
+ import { d as defineCustomElement$u } from './snk-actions-button2.js';
17
16
  import { d as defineCustomElement$t } from './snk-attach2.js';
18
17
  import { d as defineCustomElement$s } from './snk-config-options2.js';
19
18
  import { d as defineCustomElement$r } from './snk-configurator2.js';
@@ -4,7 +4,7 @@ import { a as SelectedItemType, d as defineCustomElement$2 } from './snk-filter-
4
4
  import { ApplicationUtils, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { fieldBuilder } from '@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder';
6
6
  import { a as FilterOperand } from './PersonalizedFilterUtils.js';
7
- import { s as store } from './index3.js';
7
+ import { s as store } from './index2.js';
8
8
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
9
9
  import { d as defineCustomElement$1 } from './snk-filter-param-config2.js';
10
10
 
@@ -3,7 +3,7 @@ import { a as Sortable, d as defineCustomElement$1 } from './snk-tab-config2.js'
3
3
  import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { C as CONFIG_EVENTS, b as CONFIG_SORTABLE_EVENTS, c as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants.js';
6
- import { U as UserConfigType } from './form-config-fetcher.js';
6
+ import { a as UserConfigType } from './form-config-fetcher.js';
7
7
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
8
8
  import { d as defineCustomElement$3 } from './snk-config-options2.js';
9
9
  import { d as defineCustomElement$2 } from './snk-field-config2.js';