@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-50737.1 → 0.0.0-bugfix-dev-KB-53946.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/cjs/{ConfigStorage-8d4e9d53.js → ConfigStorage-085c7117.js} +11 -12
  2. package/dist/cjs/{SnkMultiSelectionListDataSource-1438f8f2.js → IExporterProvider-f50b6846.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/{SnkMessageBuilder-141aa18d.js → SnkMessageBuilder-66aa2557.js} +4 -0
  6. package/dist/cjs/{auth-fetcher-bb8e9ae4.js → auth-fetcher-eddaf17f.js} +1 -1
  7. package/dist/cjs/{DataFetcher-99f0f6ed.js → form-config-fetcher-cdd644a7.js} +251 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/{pesquisa-fetcher-94f6b316.js → pesquisa-fetcher-90b801fb.js} +79 -55
  10. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  11. package/dist/cjs/snk-actions-button_4.cjs.entry.js +9 -9
  12. package/dist/cjs/snk-application.cjs.entry.js +24 -24
  13. package/dist/cjs/snk-attach.cjs.entry.js +73 -52
  14. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  15. package/dist/cjs/snk-data-exporter.cjs.entry.js +199 -81
  16. package/dist/cjs/{snk-data-unit-6026a9f7.js → snk-data-unit-abd2113f.js} +3 -38
  17. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -2
  18. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
  19. package/dist/cjs/snk-filter-bar.cjs.entry.js +7 -3
  20. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
  21. package/dist/cjs/snk-form-config.cjs.entry.js +1 -2
  22. package/dist/cjs/snk-form.cjs.entry.js +3 -4
  23. package/dist/cjs/snk-grid.cjs.entry.js +66 -102
  24. package/dist/cjs/{snk-guides-viewer-25721856.js → snk-guides-viewer-e4c8ee66.js} +4 -5
  25. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  26. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
  27. package/dist/cjs/snk-simple-crud.cjs.entry.js +144 -36
  28. package/dist/cjs/snk-taskbar.cjs.entry.js +27 -4
  29. package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-d9392685.js} +2 -2
  30. package/dist/collection/components/snk-attach/snk-attach.js +39 -24
  31. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +1 -1
  32. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +29 -22
  33. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
  34. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
  35. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
  36. package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
  37. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
  38. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
  39. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +37 -47
  40. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
  41. package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
  42. package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
  43. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +5 -0
  44. package/dist/collection/components/snk-grid/snk-grid.js +3 -94
  45. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +5 -2
  46. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +126 -14
  47. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
  48. package/dist/collection/components/snk-taskbar/snk-taskbar.js +30 -3
  49. package/dist/collection/lib/dataUnit/InMemoryLoader.js +10 -41
  50. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
  51. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
  52. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
  53. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +10 -2
  54. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
  55. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
  56. package/dist/components/ConfigStorage.js +1 -2
  57. package/dist/components/{field-search.js → IExporterProvider.js} +52 -7
  58. package/dist/components/ISave.js +42 -0
  59. package/dist/components/SnkMessageBuilder.js +4 -0
  60. package/dist/components/dataunit-fetcher.js +61 -44
  61. package/dist/components/form-config-fetcher.js +7022 -3
  62. package/dist/components/index2.js +198 -33
  63. package/dist/components/snk-actions-button2.js +3 -12
  64. package/dist/components/snk-application2.js +1 -1
  65. package/dist/components/snk-attach2.js +64 -44
  66. package/dist/components/snk-crud.js +3 -4
  67. package/dist/components/snk-data-exporter2.js +194 -81
  68. package/dist/components/snk-data-unit2.js +41 -39
  69. package/dist/components/snk-detail-view2.js +4 -5
  70. package/dist/components/snk-expression-item2.js +1 -1
  71. package/dist/components/snk-filter-bar2.js +5 -0
  72. package/dist/components/snk-form-config2.js +1 -1
  73. package/dist/components/snk-grid2.js +63 -100
  74. package/dist/components/snk-personalized-filter2.js +1 -1
  75. package/dist/components/snk-simple-crud2.js +133 -23
  76. package/dist/components/snk-taskbar2.js +33 -8
  77. package/dist/esm/{ConfigStorage-6e241cd7.js → ConfigStorage-cc3f3dd3.js} +1 -2
  78. package/dist/esm/{SnkMultiSelectionListDataSource-aad5d4ff.js → IExporterProvider-9e6e0071.js} +52 -6
  79. package/dist/esm/RecordIDUtils-87d02110.js +41 -0
  80. package/dist/esm/{SnkFormConfigManager-7a4e678f.js → SnkFormConfigManager-7edda7eb.js} +2 -2
  81. package/dist/esm/{SnkMessageBuilder-9747ddd2.js → SnkMessageBuilder-0a4becdd.js} +4 -0
  82. package/dist/esm/{auth-fetcher-8ec448b0.js → auth-fetcher-11dd9cae.js} +1 -1
  83. package/dist/esm/{DataFetcher-a650ae58.js → form-config-fetcher-13cd3285.js} +250 -1
  84. package/dist/esm/loader.js +1 -1
  85. package/dist/esm/{pesquisa-fetcher-f05a12ca.js → pesquisa-fetcher-d785663b.js} +61 -44
  86. package/dist/esm/sankhyablocks.js +1 -1
  87. package/dist/esm/snk-actions-button_4.entry.js +4 -4
  88. package/dist/esm/snk-application.entry.js +6 -6
  89. package/dist/esm/snk-attach.entry.js +65 -44
  90. package/dist/esm/snk-crud.entry.js +5 -5
  91. package/dist/esm/snk-data-exporter.entry.js +199 -81
  92. package/dist/esm/{snk-data-unit-4c343635.js → snk-data-unit-29eba11a.js} +4 -39
  93. package/dist/esm/snk-data-unit.entry.js +3 -2
  94. package/dist/esm/snk-detail-view.entry.js +8 -8
  95. package/dist/esm/snk-filter-bar.entry.js +7 -3
  96. package/dist/esm/snk-filter-modal-item.entry.js +2 -3
  97. package/dist/esm/snk-form-config.entry.js +1 -2
  98. package/dist/esm/snk-form.entry.js +3 -4
  99. package/dist/esm/snk-grid.entry.js +64 -100
  100. package/dist/esm/{snk-guides-viewer-b94752f2.js → snk-guides-viewer-8fc16590.js} +4 -5
  101. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  102. package/dist/esm/snk-personalized-filter.entry.js +2 -3
  103. package/dist/esm/snk-simple-crud.entry.js +132 -24
  104. package/dist/esm/snk-taskbar.entry.js +27 -4
  105. package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-ad766858.js} +2 -2
  106. package/dist/sankhyablocks/p-07825198.js +1 -0
  107. package/dist/sankhyablocks/p-0ba97458.js +65 -0
  108. package/dist/sankhyablocks/p-1650f66b.entry.js +1 -0
  109. package/dist/sankhyablocks/p-1d1aa052.js +1 -0
  110. package/dist/sankhyablocks/p-1d9d07b4.entry.js +1 -0
  111. package/dist/sankhyablocks/p-250149af.entry.js +1 -0
  112. package/dist/sankhyablocks/p-2cfa05b0.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-400097f2.entry.js → p-2daa70f9.entry.js} +3 -3
  114. package/dist/sankhyablocks/p-32556aa6.js +1 -0
  115. package/dist/sankhyablocks/p-33a6728e.js +26 -0
  116. package/dist/sankhyablocks/p-5b6c4f46.entry.js +1 -0
  117. package/dist/sankhyablocks/p-5d9456dc.js +1 -0
  118. package/dist/sankhyablocks/{p-0624f62d.js → p-8a4c4b54.js} +6 -6
  119. package/dist/sankhyablocks/p-9863d682.js +1 -0
  120. package/dist/sankhyablocks/{p-125bb902.js → p-99b51d06.js} +1 -1
  121. package/dist/sankhyablocks/p-9c283890.entry.js +1 -0
  122. package/dist/sankhyablocks/p-9ee96756.entry.js +1 -0
  123. package/dist/sankhyablocks/p-a4c94582.entry.js +1 -0
  124. package/dist/sankhyablocks/p-c2e3a71c.entry.js +1 -0
  125. package/dist/sankhyablocks/p-c2f3ebf3.entry.js +1 -0
  126. package/dist/sankhyablocks/p-ce37e3d3.entry.js +1 -0
  127. package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-efeca7ba.js → p-d24c9dc6.js} +1 -1
  129. package/dist/sankhyablocks/p-edd9dd1c.entry.js +1 -0
  130. package/dist/sankhyablocks/p-f51af6dd.entry.js +1 -0
  131. package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
  132. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  133. package/dist/types/components/snk-attach/snk-attach.d.ts +2 -1
  134. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +10 -1
  135. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +5 -4
  136. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
  137. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
  138. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
  139. package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
  140. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
  141. package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
  142. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
  143. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
  144. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  145. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
  146. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -3
  147. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +17 -2
  148. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
  149. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -0
  150. package/dist/types/components.d.ts +17 -0
  151. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
  152. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
  153. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
  154. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
  155. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  156. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
  157. package/package.json +1 -1
  158. package/dist/cjs/form-config-fetcher-d73f4449.js +0 -256
  159. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
  160. package/dist/components/DataFetcher.js +0 -7023
  161. package/dist/components/index3.js +0 -199
  162. package/dist/esm/form-config-fetcher-765b8498.js +0 -253
  163. package/dist/sankhyablocks/p-004c356e.js +0 -26
  164. package/dist/sankhyablocks/p-0bba5c9f.entry.js +0 -1
  165. package/dist/sankhyablocks/p-1048bd26.entry.js +0 -1
  166. package/dist/sankhyablocks/p-20b46647.entry.js +0 -1
  167. package/dist/sankhyablocks/p-24ed6ad6.entry.js +0 -1
  168. package/dist/sankhyablocks/p-2936303b.js +0 -1
  169. package/dist/sankhyablocks/p-6c9adfca.js +0 -1
  170. package/dist/sankhyablocks/p-85af23fe.entry.js +0 -1
  171. package/dist/sankhyablocks/p-85ba3d6b.entry.js +0 -1
  172. package/dist/sankhyablocks/p-88b29791.js +0 -1
  173. package/dist/sankhyablocks/p-9a5d1b39.js +0 -1
  174. package/dist/sankhyablocks/p-9e8618ec.entry.js +0 -1
  175. package/dist/sankhyablocks/p-a043314f.entry.js +0 -1
  176. package/dist/sankhyablocks/p-a1642e7c.entry.js +0 -1
  177. package/dist/sankhyablocks/p-ac77949b.entry.js +0 -1
  178. package/dist/sankhyablocks/p-b47c2963.entry.js +0 -1
  179. package/dist/sankhyablocks/p-be75153c.js +0 -1
  180. package/dist/sankhyablocks/p-bf39bdb8.entry.js +0 -1
  181. package/dist/sankhyablocks/p-d304659d.entry.js +0 -1
  182. package/dist/sankhyablocks/p-d5cb4b5a.entry.js +0 -1
  183. package/dist/sankhyablocks/p-d78d4062.js +0 -65
  184. package/dist/sankhyablocks/p-e7dbe53a.entry.js +0 -1
  185. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
  186. /package/dist/sankhyablocks/{p-ae4fc9a9.js → p-61dd89eb.js} +0 -0
@@ -4,17 +4,15 @@ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/
4
4
  import { ItemBuilder } from './structure/ItemBuilder';
5
5
  import { DataExporterFormat, DataExporterOption, DataExporterType } from '../../lib/@types';
6
6
  import { REPORT_LAUNCHER_RESOURCE_ID } from '../../lib/utils/constants';
7
- import fetchDataExporter from '../../lib/http/data-fetcher/fetchers/fetchDataExporter';
8
7
  import fileViewer from '../../lib/utils/fileViewer';
9
8
  import getPersonalizedReports from '../../lib/http/data-fetcher/fetchers/fetchDataExporter/personalized-reports-fetcher';
10
9
  import { SnkDataUnit } from '../snk-data-unit/snk-data-unit';
11
- const LIMIT_PER_EXPORT = 5000;
10
+ import ServerSideExporterStrategy from './exporter-strategy/ServerSideExporterStrategy';
11
+ import ClientSideExporterStrategy from './exporter-strategy/ClientSideExporterStrategy';
12
12
  export class SnkDataExporter {
13
13
  constructor() {
14
14
  this._selectedNumber = 0;
15
15
  this._customPrefix = "$custom$";
16
- this._items = [];
17
- this._showDropdown = false;
18
16
  this._releasedToExport = [
19
17
  DataExporterOption.EXPORT_TO_PDF,
20
18
  DataExporterOption.EXPORT_TO_XLS,
@@ -24,6 +22,8 @@ export class SnkDataExporter {
24
22
  DataExporterOption.EXPORT_PAGE_TO_PDF,
25
23
  DataExporterOption.EXPORT_PAGE_TO_XLS
26
24
  ];
25
+ this._items = [];
26
+ this._showDropdown = false;
27
27
  this.provider = null;
28
28
  this.messagesBuilder = undefined;
29
29
  }
@@ -94,31 +94,7 @@ export class SnkDataExporter {
94
94
  if (this.provider == undefined || resolveProps == undefined || callbackResolver == undefined) {
95
95
  return;
96
96
  }
97
- const filters = this.provider.getFilters();
98
- const columns = await this.provider.getColumnsMetadata();
99
- const sort = this.provider.getOrders();
100
- const resourceURI = this.provider.getResourceURI();
101
- const selectedIDs = this.provider.getSelectedIDs();
102
- const option = resolveProps.exportOption;
103
- const currentPageOptions = [
104
- DataExporterOption.EXPORT_PAGE_TO_PDF,
105
- DataExporterOption.EXPORT_PAGE_TO_XLS
106
- ];
107
- delete resolveProps.exportOption;
108
- let params = Object.assign({ filters,
109
- columns,
110
- sort,
111
- resourceURI, selectedIDs: selectedIDs.slice(0, LIMIT_PER_EXPORT) }, resolveProps);
112
- if (currentPageOptions.includes(option) || resolveProps.type == "page") {
113
- const offset = this.provider.getOffset();
114
- const limit = this.provider.getLimit();
115
- params = Object.assign(Object.assign({}, params), { offset,
116
- limit, selectedIDs: [] });
117
- }
118
- else if (resolveProps.type == "all") {
119
- params = Object.assign(Object.assign({}, params), { offset: 0, limit: LIMIT_PER_EXPORT, selectedIDs: [] });
120
- }
121
- fetchDataExporter(params)
97
+ this.getExporterStrategy().executeExport(resolveProps)
122
98
  .then((result) => callbackResolver(result))
123
99
  .catch((exception) => {
124
100
  console.error(exception);
@@ -126,6 +102,9 @@ export class SnkDataExporter {
126
102
  ApplicationUtils.error(title || this.getMessage("snkDataExporter.message.exportError"), statusMessage || message || this.getMessage("snkDataExporter.message.unknownFailure"));
127
103
  });
128
104
  }
105
+ getExporterStrategy() {
106
+ return this.provider.getRecords == undefined ? new ServerSideExporterStrategy(this.provider) : new ClientSideExporterStrategy(this.provider);
107
+ }
129
108
  getOptionKey(option) {
130
109
  return Object.keys(DataExporterOption)
131
110
  .find((key) => {
@@ -133,7 +112,7 @@ export class SnkDataExporter {
133
112
  });
134
113
  }
135
114
  dispatchExporter(option) {
136
- var _a;
115
+ var _a, _b, _c;
137
116
  const optionKey = this.getOptionKey(option);
138
117
  const fileType = (_a = DataExporterType[optionKey]) !== null && _a !== void 0 ? _a : DataExporterType.EXPORT_TO_PDF;
139
118
  const isDownload = DataExporterType[optionKey] === DataExporterType.EXPORT_TO_XLS;
@@ -142,7 +121,7 @@ export class SnkDataExporter {
142
121
  fileName: this._appLabel,
143
122
  titleGrid: this._appLabel,
144
123
  exportOption: option,
145
- limit: LIMIT_PER_EXPORT
124
+ limit: (_c = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getExportLimit) === null || _c === void 0 ? void 0 : _c.call(_b)
146
125
  };
147
126
  this.resolveExporter(params, (response) => {
148
127
  fileViewer(Object.assign(Object.assign({}, response), { fileType,
@@ -150,7 +129,7 @@ export class SnkDataExporter {
150
129
  });
151
130
  }
152
131
  async processExporter(evt) {
153
- var _a, _b, _c, _d;
132
+ var _a, _b, _c, _d, _e, _f, _g;
154
133
  const item = evt === null || evt === void 0 ? void 0 : evt.detail;
155
134
  const exportCurrentPageOptions = [DataExporterOption.EXPORT_PAGE_TO_PDF, DataExporterOption.EXPORT_PAGE_TO_XLS];
156
135
  const isCustomReport = (_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.includes(this._customPrefix);
@@ -158,18 +137,19 @@ export class SnkDataExporter {
158
137
  return;
159
138
  const selectedRecords = (_b = this.provider) === null || _b === void 0 ? void 0 : _b.getSelectedIDs();
160
139
  const totalRecords = (_c = this.provider) === null || _c === void 0 ? void 0 : _c.getTotalRecords();
161
- const totalPerPage = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getLimit();
140
+ const totalPerPage = (_e = (_d = this.provider) === null || _d === void 0 ? void 0 : _d.getPageSize) === null || _e === void 0 ? void 0 : _e.call(_d);
141
+ const exportLimit = (_g = (_f = this.provider) === null || _f === void 0 ? void 0 : _f.getExportLimit) === null || _g === void 0 ? void 0 : _g.call(_f);
162
142
  let limitExceeded = false;
163
- if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= LIMIT_PER_EXPORT) || isCustomReport) {
143
+ if ((exportCurrentPageOptions.includes(item === null || item === void 0 ? void 0 : item.id) && totalPerPage <= exportLimit) || isCustomReport) {
164
144
  limitExceeded = false;
165
145
  }
166
146
  else if (selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) {
167
- limitExceeded = selectedRecords.length > LIMIT_PER_EXPORT;
147
+ limitExceeded = selectedRecords.length > exportLimit;
168
148
  }
169
- else if (totalRecords > LIMIT_PER_EXPORT)
149
+ else if (totalRecords > exportLimit)
170
150
  limitExceeded = true;
171
151
  if (limitExceeded) {
172
- const formattedLimit = LIMIT_PER_EXPORT.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
152
+ const formattedLimit = exportLimit.toLocaleString('pt-BR', { minimumFractionDigits: 0 });
173
153
  const limitModalMessages = {
174
154
  title: this.getMessage("snkDataExporter.limitExceeded.title"),
175
155
  description: `
@@ -194,7 +174,7 @@ export class SnkDataExporter {
194
174
  this._showDropdown = false;
195
175
  return;
196
176
  }
197
- if (!this._releasedToExport.includes(item === null || item === void 0 ? void 0 : item.id)) {
177
+ if (!this.getFilteredReleasedToExport().includes(item === null || item === void 0 ? void 0 : item.id)) {
198
178
  return;
199
179
  }
200
180
  if (item.id === DataExporterOption.EXPORT_BY_EMAIL) {
@@ -205,9 +185,20 @@ export class SnkDataExporter {
205
185
  }
206
186
  this._showDropdown = false;
207
187
  }
188
+ getFilteredReleasedToExport() {
189
+ var _a, _b;
190
+ if (this.provider == undefined) {
191
+ return this._releasedToExport;
192
+ }
193
+ const hiddenOptions = (_b = (_a = this.provider).getHiddenOptions) === null || _b === void 0 ? void 0 : _b.call(_a);
194
+ if (hiddenOptions == undefined) {
195
+ return this._releasedToExport;
196
+ }
197
+ return this._releasedToExport.filter(option => !hiddenOptions.includes(option));
198
+ }
208
199
  loadItems() {
209
200
  const items = [];
210
- this._releasedToExport
201
+ this.getFilteredReleasedToExport()
211
202
  .forEach((option) => {
212
203
  var _a;
213
204
  (_a = this._itemBuilder) === null || _a === void 0 ? void 0 : _a.setExportOption(option, items);
@@ -215,8 +206,8 @@ export class SnkDataExporter {
215
206
  this.loadPersonalizedItems(items);
216
207
  }
217
208
  async loadPersonalizedItems(items) {
218
- var _a;
219
- const recordID = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getRecordID();
209
+ var _a, _b;
210
+ const recordID = (_b = (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getRecordID) === null || _b === void 0 ? void 0 : _b.call(_a);
220
211
  if (recordID == undefined) {
221
212
  this._items = items;
222
213
  return;
@@ -232,18 +223,18 @@ export class SnkDataExporter {
232
223
  this._items = items;
233
224
  }
234
225
  openPersonalizedReports(option) {
235
- var _a;
226
+ var _a, _b;
236
227
  const pkObject = [];
237
228
  const appId = (option === null || option === void 0 ? void 0 : option.replace(this._customPrefix, "")) || "";
238
- (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedIDs().forEach(({ name, type, value }, index) => {
239
- const fields = [];
229
+ (_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) => {
230
+ const fields = {};
240
231
  fields['fields'] = [];
241
232
  // Se for o primeiro elemento, adiciona essa primeira PK
242
233
  if (index === 0) {
243
234
  pkObject[`PK_${name}`] = { type: this.parseDataType(type), value };
244
235
  pkObject['pks'] = [];
245
236
  }
246
- const dataFields = { nome: name, tipo: this.parseDataType(type), valor: value };
237
+ const dataFields = { nome: `PK_${name}`, tipo: this.parseDataType(type), valor: value };
247
238
  fields['fields'].push(dataFields);
248
239
  pkObject['pks'].push(fields);
249
240
  });
@@ -371,8 +362,7 @@ export class SnkDataExporter {
371
362
  static get states() {
372
363
  return {
373
364
  "_items": {},
374
- "_showDropdown": {},
375
- "_releasedToExport": {}
365
+ "_showDropdown": {}
376
366
  };
377
367
  }
378
368
  static get elementRef() { return "_element"; }
@@ -0,0 +1,88 @@
1
+ import { DataType, StringUtils } from "@sankhyalabs/core";
2
+ export const testMetadata = {
3
+ name: 'metadataName',
4
+ label: 'metadataLabel',
5
+ fields: [{
6
+ name: 'TESTFIELD',
7
+ label: 'Test label',
8
+ dataType: DataType.TEXT,
9
+ }]
10
+ };
11
+ export const recordId1 = StringUtils.generateUUID();
12
+ export const recordId2 = StringUtils.generateUUID();
13
+ export const testRecords = [
14
+ {
15
+ __record__id__: recordId1,
16
+ TESTFIELD: 'TESTVALUE'
17
+ },
18
+ {
19
+ __record__id__: recordId2,
20
+ TESTFIELD: 'TESTVALUE2'
21
+ },
22
+ ];
23
+ export const dataFetcherPDFResponse = {
24
+ chavePDF: {
25
+ valor: 'KEYPDF'
26
+ },
27
+ permiteImprimir: {
28
+ valor: "S"
29
+ },
30
+ permiteExportar: {
31
+ valor: "S"
32
+ },
33
+ canSendEmail: {
34
+ valor: "S"
35
+ },
36
+ };
37
+ export const dataFetcherXLSResponse = {
38
+ chaveXLS: {
39
+ valor: 'KEYXLS'
40
+ },
41
+ };
42
+ export const exportPDFParams = {
43
+ methodName: 'exportToPDF',
44
+ fileName: '',
45
+ titleGrid: '',
46
+ };
47
+ export const exportXLSParams = {
48
+ methodName: 'exportToXLS',
49
+ fileName: '',
50
+ titleGrid: '',
51
+ };
52
+ export const serviceNamePDF = "GridPDFBuilderSP.buildPDFFromJson";
53
+ export const serviceNameXLS = "GridXLSBuilderSP.buildXLSFromJson";
54
+ export function buildExpectedResponse({ serviceName, titleGrid, value, align = 'left', type = 'S' }) {
55
+ return {
56
+ serviceName: serviceName,
57
+ requestBody: {
58
+ grid: {
59
+ titleGrid: titleGrid,
60
+ columns: {
61
+ column: [
62
+ {
63
+ align: align,
64
+ id: "TESTFIELD",
65
+ index: 1,
66
+ label: "Test label",
67
+ presentationType: "P",
68
+ type: type,
69
+ width: undefined,
70
+ }
71
+ ]
72
+ },
73
+ customOptions: {
74
+ xlsxExtension: false
75
+ },
76
+ rows: {
77
+ row: [
78
+ {
79
+ c1: {
80
+ $: value
81
+ }
82
+ }
83
+ ]
84
+ }
85
+ }
86
+ }
87
+ };
88
+ }
@@ -0,0 +1,38 @@
1
+ import { DataType, JSUtils } from "@sankhyalabs/core";
2
+ export const getSelectedIDs = (dataUnit) => {
3
+ const selectionInfo = dataUnit.getSelectionInfo();
4
+ if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
5
+ return [];
6
+ }
7
+ const selectedRecordsIDsInfo = [];
8
+ const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.recordIds;
9
+ if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
10
+ selectedRecords.forEach(recordId => {
11
+ if (!dataUnit.isNewRecord(recordId)) {
12
+ /*
13
+ Esse if foi necessário para tratar corretamente o ID
14
+ do record quando está sendo utilizado no modo standAlone
15
+ isso não faz a exportação da grid funcionar no modo standAlone
16
+ mas deixa de causar erro nas oprações de CRUD.
17
+ */
18
+ if (!JSUtils.isBase64(recordId)) {
19
+ selectedRecordsIDsInfo.push({
20
+ name: "__record__id__",
21
+ type: DataType.TEXT,
22
+ value: recordId
23
+ });
24
+ return;
25
+ }
26
+ const revertBase64ToObject = JSON.parse(window.atob(recordId));
27
+ Object.entries(revertBase64ToObject).forEach(([name, value]) => {
28
+ const metadataField = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(name);
29
+ if (metadataField == undefined) {
30
+ return;
31
+ }
32
+ selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
33
+ });
34
+ }
35
+ });
36
+ }
37
+ return selectedRecordsIDsInfo;
38
+ };
@@ -1,7 +1,8 @@
1
1
  import { Host, h } from '@stencil/core';
2
- import { Action, ApplicationContext, DataUnitAction, ObjectUtils, DataType, JSUtils } from '@sankhyalabs/core';
2
+ import { Action, ApplicationContext, DataUnitAction, ObjectUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { OperationMap, SnkMessageBuilder } from '../../lib/message/SnkMessageBuilder';
5
+ import { getSelectedIDs } from '../snk-data-exporter/utils/RecordIDUtils';
5
6
  export class SnkDataUnit {
6
7
  constructor() {
7
8
  this._onDataUnitResolve = [];
@@ -117,43 +118,7 @@ export class SnkDataUnit {
117
118
  * @returns Retorna a lista de IDs dos registros selecionados.
118
119
  */
119
120
  async getSelectedRecordsIDsInfo() {
120
- var _a;
121
- const selectionInfo = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSelectionInfo();
122
- if (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isAllRecords()) {
123
- return [];
124
- }
125
- const selectedRecordsIDsInfo = [];
126
- const selectedRecords = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.records;
127
- if ((selectedRecords === null || selectedRecords === void 0 ? void 0 : selectedRecords.length) > 0) {
128
- selectedRecords.forEach(({ __record__id__ }) => {
129
- if (!this.dataUnit.isNewRecord(__record__id__)) {
130
- /*
131
- Esse if foi necessário para tratar corretamente o ID
132
- do record quando está sendo utilizado no modo standAlone
133
- isso não faz a exportação da grid funcionar no modo standAlone
134
- mas deixa de causar erro nas oprações de CRUD.
135
- */
136
- if (!JSUtils.isBase64(__record__id__)) {
137
- selectedRecordsIDsInfo.push({
138
- name: "__record__id__",
139
- type: DataType.TEXT,
140
- value: __record__id__
141
- });
142
- return;
143
- }
144
- const revertBase64ToObject = JSON.parse(window.atob(__record__id__));
145
- Object.entries(revertBase64ToObject).forEach(([name, value]) => {
146
- var _a;
147
- const metadataField = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
148
- if (metadataField == undefined) {
149
- return;
150
- }
151
- selectedRecordsIDsInfo.push(Object.assign({ name, type: metadataField.dataType }, value));
152
- });
153
- }
154
- });
155
- }
156
- return selectedRecordsIDsInfo;
121
+ return Promise.resolve(getSelectedIDs(this.dataUnit));
157
122
  }
158
123
  getCleanOnCopyFields() {
159
124
  var _a;
@@ -774,10 +739,6 @@ export class SnkDataUnit {
774
739
  },
775
740
  "Array": {
776
741
  "location": "global"
777
- },
778
- "Record": {
779
- "location": "import",
780
- "path": "@sankhyalabs/core"
781
742
  }
782
743
  },
783
744
  "return": "Promise<IRecordID[]>"
@@ -42,6 +42,11 @@ export class SnkFilterBar {
42
42
  this.personalizedFilterId = undefined;
43
43
  }
44
44
  observeFilterConfig(newValue, oldValue) {
45
+ if (ObjectUtils.equals(newValue, oldValue))
46
+ return;
47
+ this.handleFilterConfigsChanged(oldValue, newValue);
48
+ }
49
+ handleFilterConfigsChanged(oldValue, newValue) {
45
50
  if (oldValue != undefined && newValue == undefined) {
46
51
  this._loadingPending = true;
47
52
  this._configUpdated = true;
@@ -1,6 +1,5 @@
1
1
  import { h, Fragment } from '@stencil/core';
2
- import { ApplicationContext, DataType, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
3
- import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
2
+ import { ApplicationContext, ElementIDUtils, StringUtils } from '@sankhyalabs/core';
4
3
  import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
5
4
  import { ConfigStorage } from '../../lib/configs/ConfigStorage';
6
5
  import { PresentationMode } from '../../lib/@types';
@@ -10,6 +9,7 @@ import SnkMultiSelectionListDataSource from './filtercolumn/SnkMultiSelectionLis
10
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
11
10
  import { buildFieldSearch, openFieldSearch } from '../snk-taskbar/subcomponents/field-search';
12
11
  import { CrudUtils } from '../../lib';
12
+ import ServerSideExporterProvider from '../snk-data-exporter/providers/ServerSideExporterProvider';
13
13
  export class SnkGrid {
14
14
  constructor() {
15
15
  this._topTaskbarProcessor = new TaskbarProcessor({
@@ -155,99 +155,8 @@ export class SnkGrid {
155
155
  });
156
156
  evt.stopPropagation();
157
157
  }
158
- buildColumnsMetadata(gridColumns) {
159
- const columnsMetadata = [];
160
- gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
161
- var _a, _b;
162
- /**
163
- * TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
164
- */
165
- if (column.hidden && column.name !== "RECDESP") {
166
- return;
167
- }
168
- const fieldData = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
169
- const columnData = {
170
- label: column.label,
171
- id: column.name,
172
- width: column.width,
173
- type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
174
- userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
175
- };
176
- columnsMetadata.push(columnData);
177
- if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
178
- const mergedFrom = fieldData.properties.mergedFrom;
179
- const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
180
- const descriptionColumn = {
181
- label: fieldData.properties.DESCRIPTIONENTITY,
182
- id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
183
- width: 200,
184
- type: DataType.TEXT,
185
- userInterface: UserInterface.LONGTEXT
186
- };
187
- columnsMetadata.push(descriptionColumn);
188
- }
189
- });
190
- return columnsMetadata || [];
191
- }
192
- getPaginationInfo() {
193
- var _a;
194
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
195
- }
196
- getExporterOffset(paginationInfo) {
197
- if (paginationInfo == undefined) {
198
- return;
199
- }
200
- const offset = paginationInfo.firstRecord;
201
- if (offset > 0) {
202
- return (offset - 1);
203
- }
204
- return offset;
205
- }
206
158
  async dataExporterProviderStore() {
207
- var _a;
208
- const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
209
- const dataExporterProvider = {
210
- getFilters: () => {
211
- var _a;
212
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
213
- },
214
- getColumnsMetadata: async () => {
215
- var _a;
216
- const columnsState = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
217
- return this.buildColumnsMetadata(columnsState);
218
- },
219
- getOrders: () => {
220
- var _a;
221
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
222
- },
223
- getResourceURI: () => {
224
- var _a;
225
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
226
- },
227
- getSelectedNumber: () => {
228
- var _a, _b;
229
- return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
230
- },
231
- getTotalRecords: () => {
232
- var _a, _b, _c;
233
- const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
234
- return total !== null && total !== void 0 ? total : (_c = (_b = this._dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
235
- },
236
- getSelectedIDs: () => {
237
- return selectedIDs || [];
238
- },
239
- getOffset: () => {
240
- return this.getExporterOffset(this.getPaginationInfo());
241
- },
242
- getLimit: () => {
243
- var _a;
244
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
245
- },
246
- getRecordID: () => {
247
- var _a, _b, _c;
248
- return (_c = (_b = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
249
- }
250
- };
159
+ const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
251
160
  store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
252
161
  }
253
162
  addElementID() {
@@ -2,11 +2,14 @@
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
5
+
6
+ /*@doc Define a altura minima da grid.*/
7
+ --snk-simple-crud-grid--min-height: 300px;
5
8
  }
6
9
 
7
10
  .simple-crud__container {
8
11
  display: grid;
9
- grid-template-rows: max-content;
12
+ grid-template-rows: auto 1fr;
10
13
  row-gap: 12px;
11
14
  height: 100%;
12
15
  width: 100%;
@@ -23,7 +26,7 @@
23
26
 
24
27
  ez-grid {
25
28
  --ez-grid__container--shadow: none;
26
- min-height: 300px;
29
+ --ez-grid--min-height: var(--snk-simple-crud-grid--min-height);
27
30
  }
28
31
 
29
32
  ez-form {