@sankhyalabs/sankhyablocks 8.15.0-dev.53 → 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 +115 -32
  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 +81 -9
  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 +101 -16
  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 +102 -19
  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 +14 -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-24ed6ad6.entry.js +0 -1
  151. package/dist/sankhyablocks/p-34a7f2ab.js +0 -65
  152. package/dist/sankhyablocks/p-52c8e589.js +0 -1
  153. package/dist/sankhyablocks/p-5833cff9.js +0 -1
  154. package/dist/sankhyablocks/p-5a2e016a.entry.js +0 -1
  155. package/dist/sankhyablocks/p-6f560924.entry.js +0 -1
  156. package/dist/sankhyablocks/p-8967fa78.js +0 -1
  157. package/dist/sankhyablocks/p-9b1beac5.entry.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,16 +1,15 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ElementIDUtils, ApplicationContext, JSUtils, FloatingManager } from '@sankhyalabs/core';
3
- import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
4
- import './DataFetcher-a650ae58.js';
5
- import './pesquisa-fetcher-96d2f351.js';
3
+ import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
4
+ import './form-config-fetcher-13cd3285.js';
5
+ import './pesquisa-fetcher-4eed47c6.js';
6
6
  import { P as PresentationMode } from './index-0ece87a6.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';
10
10
  import './filter-item-type.enum-d45e026f.js';
11
- import './form-config-fetcher-765b8498.js';
12
11
  import { d as VIEW_MODE } from './constants-8457af36.js';
13
- import { A as AutorizationType } from './auth-fetcher-8ec448b0.js';
12
+ import { A as AutorizationType } from './auth-fetcher-11dd9cae.js';
14
13
  import './index-bdf75557.js';
15
14
  import './PrintUtils-3e4ff0f5.js';
16
15
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
@@ -1,13 +1,20 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
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
4
  import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType } from './index-0ece87a6.js';
5
5
  import { R as REPORT_LAUNCHER_RESOURCE_ID } from './constants-8457af36.js';
6
- import { D as DataFetcher } from './DataFetcher-a650ae58.js';
7
- import { S as SnkDataUnit } from './snk-data-unit-de1d140d.js';
8
- import './PrintUtils-3e4ff0f5.js';
6
+ import { D as DataFetcher } from './form-config-fetcher-13cd3285.js';
7
+ import { S as SnkDataUnit } from './snk-data-unit-29eba11a.js';
8
+ import './pesquisa-fetcher-4eed47c6.js';
9
+ import './ISave-d8c8bc59.js';
10
+ import '@sankhyalabs/ezui/dist/collection/utils/constants';
9
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
+ import './filter-item-type.enum-d45e026f.js';
13
+ import './PrintUtils-3e4ff0f5.js';
10
14
  import './SnkMessageBuilder-0a4becdd.js';
15
+ import './RecordIDUtils-87d02110.js';
16
+ import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
17
+ import './ResourceIDUtils-a114189a.js';
11
18
 
12
19
  class ItemBuilder {
13
20
  constructor(getMessage, selectedNumber) {
@@ -149,38 +156,6 @@ class ItemBuilder {
149
156
  }
150
157
  }
151
158
 
152
- var __rest = (undefined && undefined.__rest) || function (s, e) {
153
- var t = {};
154
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
155
- t[p] = s[p];
156
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
157
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
158
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
159
- t[p[i]] = s[p[i]];
160
- }
161
- return t;
162
- };
163
- function fetchDataExporter(_a) {
164
- var { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
165
- const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
166
- const serviceName = `${application.getModuleName()}@DataExporterSPBean.${methodName}`;
167
- const payload = { serviceName, requestBody };
168
- return new Promise((resolve, reject) => {
169
- DataFetcher.get()
170
- .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
171
- .then(result => resolve(getFormatResponse$1(result)))
172
- .catch(error => reject(error));
173
- });
174
- }
175
- function getFormatResponse$1(result) {
176
- var _a;
177
- const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
178
- if (response == undefined) {
179
- return;
180
- }
181
- return ObjectUtils.stringToObject(response);
182
- }
183
-
184
159
  function getMessage(application, key, params) {
185
160
  var _a;
186
161
  return (_a = application === null || application === void 0 ? void 0 : application.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
@@ -209,16 +184,165 @@ function getFormatResponse(result) {
209
184
  return ObjectUtils.stringToObject(response);
210
185
  }
211
186
 
187
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
188
+ var t = {};
189
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
190
+ t[p] = s[p];
191
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
192
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
193
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
194
+ t[p[i]] = s[p[i]];
195
+ }
196
+ return t;
197
+ };
198
+ class ServerSideExporterStrategy {
199
+ constructor(provider) {
200
+ this._provider = provider;
201
+ }
202
+ async getParams(resolveProps) {
203
+ var _a, _b, _c, _d, _e, _f;
204
+ const filters = (_b = (_a = this._provider).getFilters) === null || _b === void 0 ? void 0 : _b.call(_a);
205
+ const columns = await this._provider.getColumnsMetadata();
206
+ const sort = (_d = (_c = this._provider).getOrders) === null || _d === void 0 ? void 0 : _d.call(_c);
207
+ const resourceURI = (_f = (_e = this._provider).getResourceURI) === null || _f === void 0 ? void 0 : _f.call(_e);
208
+ const selectedIDs = this._provider.getSelectedIDs();
209
+ const option = resolveProps.exportOption;
210
+ const currentPageOptions = [
211
+ DataExporterOption.EXPORT_PAGE_TO_PDF,
212
+ DataExporterOption.EXPORT_PAGE_TO_XLS
213
+ ];
214
+ delete resolveProps.exportOption;
215
+ let params = Object.assign({ filters,
216
+ columns,
217
+ sort,
218
+ resourceURI, selectedIDs: selectedIDs.slice(0, this._provider.getExportLimit()) }, resolveProps);
219
+ if (currentPageOptions.includes(option) || resolveProps.type == "page") {
220
+ const offset = this._provider.getOffset();
221
+ const limit = this._provider.getPageSize();
222
+ params = Object.assign(Object.assign({}, params), { offset,
223
+ limit, selectedIDs: [] });
224
+ }
225
+ else if (resolveProps.type == "all") {
226
+ params = Object.assign(Object.assign({}, params), { offset: 0, limit: this._provider.getExportLimit(), selectedIDs: [] });
227
+ }
228
+ return Promise.resolve(params);
229
+ }
230
+ async executeExport(resolveProps) {
231
+ const _a = await this.getParams(resolveProps), { methodName } = _a, requestBody = __rest(_a, ["methodName"]);
232
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
233
+ const serviceName = `${application.getModuleName()}@DataExporterSPBean.${methodName}`;
234
+ const payload = { serviceName, requestBody };
235
+ return new Promise((resolve, reject) => {
236
+ DataFetcher.get()
237
+ .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
238
+ .then(result => resolve(this.getFormatResponse(result)))
239
+ .catch(error => reject(error));
240
+ });
241
+ }
242
+ getFormatResponse(result) {
243
+ var _a;
244
+ const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
245
+ if (response == undefined) {
246
+ return;
247
+ }
248
+ return ObjectUtils.stringToObject(response);
249
+ }
250
+ }
251
+
252
+ class ClientSideExporterStrategy {
253
+ constructor(provider) {
254
+ this._provider = provider;
255
+ }
256
+ async executeExport(resolveProps) {
257
+ const { methodName, titleGrid } = resolveProps;
258
+ const records = await this._provider.getRecords();
259
+ const columns = await this._provider.getColumnsMetadata();
260
+ const [serviceName, processor] = this.getExecutor(methodName);
261
+ const payload = {
262
+ serviceName,
263
+ requestBody: {
264
+ grid: {
265
+ titleGrid,
266
+ columns: this.buildColumnsObject(columns),
267
+ rows: this.buildRowsObject(columns, records),
268
+ customOptions: { xlsxExtension: false }
269
+ }
270
+ }
271
+ };
272
+ return new Promise((resolve, reject) => {
273
+ DataFetcher.get()
274
+ .callServiceBroker(serviceName, payload)
275
+ .then(result => resolve(processor(result)))
276
+ .catch(error => reject(error));
277
+ });
278
+ }
279
+ getExecutor(methodName) {
280
+ if (methodName === "exportToPDF") {
281
+ return [
282
+ "GridPDFBuilderSP.buildPDFFromJson",
283
+ responseBody => ({
284
+ fileSessionKey: responseBody.chavePDF.valor,
285
+ canPrint: responseBody.permiteImprimir.valor === "S",
286
+ canExport: responseBody.permiteExportar.valor === "S",
287
+ canSendEmail: responseBody.canSendEmail.valor === "S",
288
+ useAppPrint: true
289
+ })
290
+ ];
291
+ }
292
+ return [
293
+ "GridXLSBuilderSP.buildXLSFromJson",
294
+ responseBody => ({
295
+ fileSessionKey: responseBody.chaveXLS.valor,
296
+ canPrint: false,
297
+ canExport: false,
298
+ useAppPrint: false,
299
+ canSendEmail: false
300
+ })
301
+ ];
302
+ }
303
+ buildColumnsObject(columns) {
304
+ return {
305
+ column: columns.map((column, index) => {
306
+ const { label, id, width, userInterface } = column;
307
+ return Object.assign({ index: index + 1, id,
308
+ label,
309
+ width, presentationType: "P" }, (TYPE_MAP[userInterface] || { type: "S", align: "left" }));
310
+ })
311
+ };
312
+ }
313
+ buildRowsObject(columns, records) {
314
+ return {
315
+ row: records.map(rawRecord => {
316
+ const record = {};
317
+ columns.forEach((column, index) => record["c" + (index + 1)] = { $: this.formatValue(rawRecord, column) });
318
+ return record;
319
+ })
320
+ };
321
+ }
322
+ formatValue(record, column) {
323
+ if (this._provider.formatValue != undefined) {
324
+ return this._provider.formatValue(record, column);
325
+ }
326
+ return record[column.id] || "";
327
+ }
328
+ }
329
+ const TYPE_MAP = {
330
+ [UserInterface.DATE]: { type: "D", align: "center" },
331
+ [UserInterface.DATETIME]: { type: "H", align: "center" },
332
+ [UserInterface.TIME]: { type: "I", align: "right" },
333
+ [UserInterface.ELAPSEDTIME]: { type: "I", align: "right" },
334
+ [UserInterface.DECIMALNUMBER]: { type: "F", align: "right" },
335
+ [UserInterface.INTEGERNUMBER]: { type: "I", align: "right" },
336
+ [UserInterface.SEARCH]: { type: "S", align: "right" }
337
+ };
338
+
212
339
  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}";
213
340
 
214
- const LIMIT_PER_EXPORT = 5000;
215
341
  const SnkDataExporter = class {
216
342
  constructor(hostRef) {
217
343
  registerInstance(this, hostRef);
218
344
  this._selectedNumber = 0;
219
345
  this._customPrefix = "$custom$";
220
- this._items = [];
221
- this._showDropdown = false;
222
346
  this._releasedToExport = [
223
347
  DataExporterOption.EXPORT_TO_PDF,
224
348
  DataExporterOption.EXPORT_TO_XLS,
@@ -228,6 +352,8 @@ const SnkDataExporter = class {
228
352
  DataExporterOption.EXPORT_PAGE_TO_PDF,
229
353
  DataExporterOption.EXPORT_PAGE_TO_XLS
230
354
  ];
355
+ this._items = [];
356
+ this._showDropdown = false;
231
357
  this.provider = null;
232
358
  this.messagesBuilder = undefined;
233
359
  }
@@ -298,31 +424,7 @@ const SnkDataExporter = class {
298
424
  if (this.provider == undefined || resolveProps == undefined || callbackResolver == undefined) {
299
425
  return;
300
426
  }
301
- const filters = this.provider.getFilters();
302
- const columns = await this.provider.getColumnsMetadata();
303
- const sort = this.provider.getOrders();
304
- const resourceURI = this.provider.getResourceURI();
305
- const selectedIDs = this.provider.getSelectedIDs();
306
- const option = resolveProps.exportOption;
307
- const currentPageOptions = [
308
- DataExporterOption.EXPORT_PAGE_TO_PDF,
309
- DataExporterOption.EXPORT_PAGE_TO_XLS
310
- ];
311
- delete resolveProps.exportOption;
312
- let params = Object.assign({ filters,
313
- columns,
314
- sort,
315
- resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
316
- if (currentPageOptions.includes(option) || resolveProps.type == "page") {
317
- const offset = this.provider.getOffset();
318
- const limit = this.provider.getLimit();
319
- params = Object.assign(Object.assign({}, params), { offset,
320
- limit, selectedIDs: [] });
321
- }
322
- else if (resolveProps.type == "all") {
323
- params = Object.assign(Object.assign({}, params), { offset: 0, limit: LIMIT_PER_EXPORT, selectedIDs: [] });
324
- }
325
- fetchDataExporter(params)
427
+ this.getExporterStrategy().executeExport(resolveProps)
326
428
  .then((result) => callbackResolver(result))
327
429
  .catch((exception) => {
328
430
  console.error(exception);
@@ -330,6 +432,9 @@ const SnkDataExporter = class {
330
432
  ApplicationUtils.error(title || this.getMessage("snkDataExporter.message.exportError"), statusMessage || message || this.getMessage("snkDataExporter.message.unknownFailure"));
331
433
  });
332
434
  }
435
+ getExporterStrategy() {
436
+ return this.provider.getRecords == undefined ? new ServerSideExporterStrategy(this.provider) : new ClientSideExporterStrategy(this.provider);
437
+ }
333
438
  getOptionKey(option) {
334
439
  return Object.keys(DataExporterOption)
335
440
  .find((key) => {
@@ -337,7 +442,7 @@ const SnkDataExporter = class {
337
442
  });
338
443
  }
339
444
  dispatchExporter(option) {
340
- var _a;
445
+ var _a, _b, _c;
341
446
  const optionKey = this.getOptionKey(option);
342
447
  const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
343
448
  const isDownload = DataExporterType[optionKey] === DataExporterType.EXPORT_TO_XLS;
@@ -346,7 +451,7 @@ const SnkDataExporter = class {
346
451
  fileName: this._appLabel,
347
452
  titleGrid: this._appLabel,
348
453
  exportOption: option,
349
- limit: LIMIT_PER_EXPORT
454
+ limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b)
350
455
  };
351
456
  this.resolveExporter(params, (response) => {
352
457
  fileViewer(Object.assign(Object.assign({}, response), { fileType,
@@ -354,7 +459,7 @@ const SnkDataExporter = class {
354
459
  });
355
460
  }
356
461
  async processExporter(evt) {
357
- var _a, _b, _c, _d;
462
+ var _a, _b, _c, _d, _e, _f, _g;
358
463
  const item = evt === null || evt === void 0 ? void 0 : evt.detail;
359
464
  const exportCurrentPageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
360
465
  const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
@@ -362,18 +467,19 @@ const SnkDataExporter = class {
362
467
  return;
363
468
  const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
364
469
  const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
365
- const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
470
+ const totalPerPage = (_e = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getPageSize) === null || _e === void 0 ? void 0 : _e.call(_d);
471
+ const exportLimit = (_g = (_f = this.provider) === null || _f === void 0 ? void 0 : _f.getExportLimit) === null || _g === void 0 ? void 0 : _g.call(_f);
366
472
  let limitExceeded = false;
367
- if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
473
+ if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= exportLimit) || isCustomReport) {
368
474
  limitExceeded = false;
369
475
  }
370
476
  else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
371
- limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
477
+ limitExceeded = selectedRecords.length > exportLimit;
372
478
  }
373
- else if (totalRecords > LIMIT_PER_EXPORT)
479
+ else if (totalRecords > exportLimit)
374
480
  limitExceeded = true;
375
481
  if (limitExceeded) {
376
- const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
482
+ const formattedLimit = exportLimit.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
377
483
  const limitModalMessages = {
378
484
  title: this.getMessage("snkDataExporter.limitExceeded.title"),
379
485
  description: `
@@ -398,7 +504,7 @@ const SnkDataExporter = class {
398
504
  this._showDropdown = false;
399
505
  return;
400
506
  }
401
- if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
507
+ if (!this.getFilteredReleasedToExport().includes(item === null || item === void 0 ? void 0 : item.id)) {
402
508
  return;
403
509
  }
404
510
  if (item.id === DataExporterOption.EXPORT_BY_EMAIL) {
@@ -409,9 +515,20 @@ const SnkDataExporter = class {
409
515
  }
410
516
  this._showDropdown = false;
411
517
  }
518
+ getFilteredReleasedToExport() {
519
+ var _a, _b;
520
+ if (this.provider == undefined) {
521
+ return this._releasedToExport;
522
+ }
523
+ const hiddenOptions = (_b = (_a = this.provider).getHiddenOptions) === null || _b === void 0 ? void 0 : _b.call(_a);
524
+ if (hiddenOptions == undefined) {
525
+ return this._releasedToExport;
526
+ }
527
+ return this._releasedToExport.filter(option => !hiddenOptions.includes(option));
528
+ }
412
529
  loadItems() {
413
530
  const items = [];
414
- this._releasedToExport
531
+ this.getFilteredReleasedToExport()
415
532
  .forEach((option) => {
416
533
  var _a;
417
534
  (_a = this._itemBuilder) === null || _a === void 0 ? void 0 : _a.setExportOption(option, items);
@@ -419,8 +536,8 @@ const SnkDataExporter = class {
419
536
  this.loadPersonalizedItems(items);
420
537
  }
421
538
  async loadPersonalizedItems(items) {
422
- var _a;
423
- const recordID = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getRecordID();
539
+ var _a, _b;
540
+ const recordID = (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getRecordID) === null || _b === void 0 ? void 0 : _b.call(_a);
424
541
  if (recordID == undefined) {
425
542
  this._items = items;
426
543
  return;
@@ -436,10 +553,10 @@ const SnkDataExporter = class {
436
553
  this._items = items;
437
554
  }
438
555
  openPersonalizedReports(option) {
439
- var _a;
556
+ var _a, _b;
440
557
  const pkObject = [];
441
558
  const appId = (option === null || option === void 0 ? void 0 : option.replace(this._customPrefix, "")) || "";
442
- (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedIDs().forEach(({ name, type, value }, index) => {
559
+ (_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) => {
443
560
  const fields = {};
444
561
  fields['fields'] = [];
445
562
  // Se for o primeiro elemento, adiciona essa primeira PK
@@ -1,7 +1,8 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-a7d3d3f1.js';
2
- import { Action, ObjectUtils, JSUtils, DataUnitAction, ApplicationContext, DataType } from '@sankhyalabs/core';
2
+ import { 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-0a4becdd.js';
5
+ import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
5
6
 
6
7
  const SnkDataUnit = class {
7
8
  constructor(hostRef) {
@@ -124,43 +125,7 @@ const SnkDataUnit = class {
124
125
  * @returns Retorna a lista de IDs dos registros selecionados.
125
126
  */
126
127
  async getSelectedRecordsIDsInfo() {
127
- var _a;
128
- const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
129
- if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
130
- return [];
131
- }
132
- const selectedRecordsIDsInfo = [];
133
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
134
- if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
135
- selectedRecords.forEach(({ __record__id__ }) => {
136
- if (!this.dataUnit.isNewRecord(__record__id__)) {
137
- /*
138
- Esse if foi necessário para tratar corretamente o ID
139
- do record quando está sendo utilizado no modo standAlone
140
- isso não faz a exportação da grid funcionar no modo standAlone
141
- mas deixa de causar erro nas oprações de CRUD.
142
- */
143
- if (!JSUtils.isBase64(__record__id__)) {
144
- selectedRecordsIDsInfo.push({
145
- name: "__record__id__",
146
- type: DataType.TEXT,
147
- value: __record__id__
148
- });
149
- return;
150
- }
151
- const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
152
- Object.entries(revertBase64ToObject).forEach(([name, value]) => {
153
- var _a;
154
- const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
155
- if (metadataField == undefined) {
156
- return;
157
- }
158
- selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
159
- });
160
- }
161
- });
162
- }
163
- return selectedRecordsIDsInfo;
128
+ return Promise.resolve(getSelectedIDs(this.dataUnit));
164
129
  }
165
130
  getCleanOnCopyFields() {
166
131
  var _a;
@@ -1,5 +1,6 @@
1
- export { S as snk_data_unit } from './snk-data-unit-de1d140d.js';
1
+ export { S as snk_data_unit } from './snk-data-unit-29eba11a.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
4
  import '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import './SnkMessageBuilder-0a4becdd.js';
6
+ import './RecordIDUtils-87d02110.js';
@@ -1,20 +1,19 @@
1
1
  import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host } from './index-a7d3d3f1.js';
2
2
  import { Action } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-7a4e678f.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-7edda7eb.js';
4
4
  import { FormMetadata, buildFormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
- import './DataFetcher-a650ae58.js';
6
- import './pesquisa-fetcher-96d2f351.js';
5
+ import './form-config-fetcher-13cd3285.js';
6
+ import './pesquisa-fetcher-4eed47c6.js';
7
7
  import { P as PresentationMode } from './index-0ece87a6.js';
8
8
  import './ISave-d8c8bc59.js';
9
9
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
10
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
11
  import './filter-item-type.enum-d45e026f.js';
12
- import './form-config-fetcher-765b8498.js';
13
- import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
12
+ import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
14
13
  import { d as VIEW_MODE } from './constants-8457af36.js';
15
- import { S as SnkGuidesViewer } from './snk-guides-viewer-131e9660.js';
14
+ import { S as SnkGuidesViewer } from './snk-guides-viewer-2742a9db.js';
16
15
  import { S as SnkMessageBuilder } from './SnkMessageBuilder-0a4becdd.js';
17
- import './ConfigStorage-6e241cd7.js';
16
+ import './ConfigStorage-cc3f3dd3.js';
18
17
  import './PrintUtils-3e4ff0f5.js';
19
18
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
20
19
  import './ResourceIDUtils-a114189a.js';
@@ -1,15 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
4
- import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-cc3f3dd3.js';
5
5
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
6
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
7
7
  import { F as FilterOperand } from './index-ae591a44.js';
8
8
  import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
9
9
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
10
10
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
11
- import './form-config-fetcher-765b8498.js';
12
- import './DataFetcher-a650ae58.js';
11
+ import './form-config-fetcher-13cd3285.js';
13
12
  import './PrintUtils-3e4ff0f5.js';
14
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
15
14
 
@@ -2,10 +2,9 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
2
2
  import { ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
4
4
  import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
5
- import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
5
+ import { C as ConfigStorage } from './ConfigStorage-cc3f3dd3.js';
6
6
  import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
7
- import './form-config-fetcher-765b8498.js';
8
- import './DataFetcher-a650ae58.js';
7
+ import './form-config-fetcher-13cd3285.js';
9
8
  import './PrintUtils-3e4ff0f5.js';
10
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
10
 
@@ -3,9 +3,8 @@ import { S as Sortable } from './Sortable-83960219.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, a as CONFIG_SORTABLE_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-8457af36.js';
6
- import { U as UserConfigType } from './form-config-fetcher-765b8498.js';
6
+ import { a as UserConfigType } from './form-config-fetcher-13cd3285.js';
7
7
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
8
- import './DataFetcher-a650ae58.js';
9
8
  import './PrintUtils-3e4ff0f5.js';
10
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
10
 
@@ -1,10 +1,9 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-7a4e678f.js';
3
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-7edda7eb.js';
4
4
  import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
5
- import './ConfigStorage-6e241cd7.js';
6
- import './form-config-fetcher-765b8498.js';
7
- import './DataFetcher-a650ae58.js';
5
+ import './ConfigStorage-cc3f3dd3.js';
6
+ import './form-config-fetcher-13cd3285.js';
8
7
  import './PrintUtils-3e4ff0f5.js';
9
8
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
9
  import './filter-item-type.enum-d45e026f.js';