@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,24 +1,78 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-a7d3d3f1.js';
2
- import { ElementIDUtils, ApplicationContext, StringUtils, DataType } from '@sankhyalabs/core';
3
- import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
- import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
5
- import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
2
+ import { ElementIDUtils, ApplicationContext, StringUtils } from '@sankhyalabs/core';
3
+ import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-cc3f3dd3.js';
6
5
  import { P as PresentationMode } from './index-0ece87a6.js';
7
6
  import { T as TaskbarProcessor, o as openFieldSearch, b as buildFieldSearch } from './field-search-efbe307f.js';
8
7
  import { s as store } from './index-bdf75557.js';
9
- import { S as SnkMultiSelectionListDataSource, C as CrudUtils } from './SnkMultiSelectionListDataSource-7084f3b3.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-6ebf47ab.js';
10
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
11
- import './DataFetcher-a650ae58.js';
12
- import './pesquisa-fetcher-96d2f351.js';
10
+ import './form-config-fetcher-13cd3285.js';
11
+ import './pesquisa-fetcher-4eed47c6.js';
13
12
  import './ISave-d8c8bc59.js';
14
13
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
14
+ import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
15
15
  import './filter-item-type.enum-d45e026f.js';
16
- import './form-config-fetcher-765b8498.js';
16
+ import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
17
17
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
18
18
  import './PrintUtils-3e4ff0f5.js';
19
19
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
20
20
  import './ResourceIDUtils-a114189a.js';
21
21
 
22
+ class ServerSideExporterProvider extends CommonsExporter {
23
+ getFilters() {
24
+ var _a;
25
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
26
+ }
27
+ getOrders() {
28
+ var _a;
29
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
30
+ }
31
+ getResourceURI() {
32
+ var _a;
33
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name;
34
+ }
35
+ getSelectedNumber() {
36
+ return this.dataUnit.getSelectionInfo().length;
37
+ }
38
+ getTotalRecords() {
39
+ var _a, _b, _c;
40
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
41
+ 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;
42
+ }
43
+ getSelectedIDs() {
44
+ return getSelectedIDs(this.dataUnit);
45
+ }
46
+ getOffset() {
47
+ return this.getExporterOffset(this.getPaginationInfo());
48
+ }
49
+ getPageSize() {
50
+ var _a;
51
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
52
+ }
53
+ getExportLimit() {
54
+ return 5000;
55
+ }
56
+ getRecordID() {
57
+ var _a, _b, _c;
58
+ 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__;
59
+ }
60
+ getPaginationInfo() {
61
+ var _a;
62
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
63
+ }
64
+ getExporterOffset(paginationInfo) {
65
+ if (paginationInfo == undefined) {
66
+ return;
67
+ }
68
+ const offset = paginationInfo.firstRecord;
69
+ if (offset > 0) {
70
+ return (offset - 1);
71
+ }
72
+ return offset;
73
+ }
74
+ }
75
+
22
76
  const snkGridCss = ".sc-snk-grid-h{--snk-grid-min-height:300px}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}";
23
77
 
24
78
  const SnkGrid = class {
@@ -169,99 +223,8 @@ const SnkGrid = class {
169
223
  });
170
224
  evt.stopPropagation();
171
225
  }
172
- buildColumnsMetadata(gridColumns) {
173
- const columnsMetadata = [];
174
- gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
175
- var _a, _b;
176
- /**
177
- * TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
178
- */
179
- if (column.hidden && column.name !== "RECDESP") {
180
- return;
181
- }
182
- const fieldData = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
183
- const columnData = {
184
- label: column.label,
185
- id: column.name,
186
- width: column.width,
187
- type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
188
- userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
189
- };
190
- columnsMetadata.push(columnData);
191
- if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
192
- const mergedFrom = fieldData.properties.mergedFrom;
193
- const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
194
- const descriptionColumn = {
195
- label: fieldData.properties.DESCRIPTIONENTITY,
196
- id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
197
- width: 200,
198
- type: DataType.TEXT,
199
- userInterface: UserInterface.LONGTEXT
200
- };
201
- columnsMetadata.push(descriptionColumn);
202
- }
203
- });
204
- return columnsMetadata || [];
205
- }
206
- getPaginationInfo() {
207
- var _a;
208
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
209
- }
210
- getExporterOffset(paginationInfo) {
211
- if (paginationInfo == undefined) {
212
- return;
213
- }
214
- const offset = paginationInfo.firstRecord;
215
- if (offset > 0) {
216
- return (offset - 1);
217
- }
218
- return offset;
219
- }
220
226
  async dataExporterProviderStore() {
221
- var _a;
222
- const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
223
- const dataExporterProvider = {
224
- getFilters: () => {
225
- var _a;
226
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
227
- },
228
- getColumnsMetadata: async () => {
229
- var _a;
230
- const columnsState = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
231
- return this.buildColumnsMetadata(columnsState);
232
- },
233
- getOrders: () => {
234
- var _a;
235
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
236
- },
237
- getResourceURI: () => {
238
- var _a;
239
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
240
- },
241
- getSelectedNumber: () => {
242
- var _a, _b;
243
- return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
244
- },
245
- getTotalRecords: () => {
246
- var _a, _b, _c;
247
- const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
248
- 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;
249
- },
250
- getSelectedIDs: () => {
251
- return selectedIDs || [];
252
- },
253
- getOffset: () => {
254
- return this.getExporterOffset(this.getPaginationInfo());
255
- },
256
- getLimit: () => {
257
- var _a;
258
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
259
- },
260
- getRecordID: () => {
261
- var _a, _b, _c;
262
- 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__;
263
- }
264
- };
227
+ const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
265
228
  store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
266
229
  }
267
230
  addElementID() {
@@ -1,18 +1,17 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment } from './index-a7d3d3f1.js';
2
2
  import { Action, 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 { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
5
  import { o as openFieldSearch, T as TaskbarProcessor, b as buildFieldSearch } from './field-search-efbe307f.js';
6
- import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
6
+ import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
7
7
  import { d as VIEW_MODE } from './constants-8457af36.js';
8
- import './DataFetcher-a650ae58.js';
9
- import './pesquisa-fetcher-96d2f351.js';
8
+ import './form-config-fetcher-13cd3285.js';
9
+ import './pesquisa-fetcher-4eed47c6.js';
10
10
  import { P as PresentationMode } from './index-0ece87a6.js';
11
11
  import './ISave-d8c8bc59.js';
12
12
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
13
13
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
14
14
  import './filter-item-type.enum-d45e026f.js';
15
- import './form-config-fetcher-765b8498.js';
16
15
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
17
16
 
18
17
  const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
@@ -1,20 +1,19 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-131e9660.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-2742a9db.js';
2
2
  import './index-a7d3d3f1.js';
3
3
  import '@sankhyalabs/core';
4
- import './SnkFormConfigManager-7a4e678f.js';
5
- import './ConfigStorage-6e241cd7.js';
6
- import './form-config-fetcher-765b8498.js';
7
- import './DataFetcher-a650ae58.js';
4
+ import './SnkFormConfigManager-7edda7eb.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';
11
10
  import '@sankhyalabs/ezui/dist/collection/utils/form';
12
11
  import './field-search-efbe307f.js';
13
- import './taskbar-elements-2473c8ac.js';
12
+ import './taskbar-elements-ad766858.js';
14
13
  import './index-0ece87a6.js';
15
14
  import './index-bdf75557.js';
16
15
  import './constants-8457af36.js';
17
- import './pesquisa-fetcher-96d2f351.js';
16
+ import './pesquisa-fetcher-4eed47c6.js';
18
17
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
19
18
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
20
19
  import './ResourceIDUtils-a114189a.js';
@@ -1,13 +1,12 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
4
- import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
4
+ import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-cc3f3dd3.js';
5
5
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
6
6
  import { a as FilterGroupCondition } from './index-ae591a44.js';
7
7
  import { s as store } from './index-bdf75557.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
- import './form-config-fetcher-765b8498.js';
10
- import './DataFetcher-a650ae58.js';
9
+ import './form-config-fetcher-13cd3285.js';
11
10
  import './PrintUtils-3e4ff0f5.js';
12
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
12
 
@@ -1,21 +1,21 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a7d3d3f1.js';
2
- import { StringUtils, ApplicationContext, ObjectUtils, DataType, UserInterface, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
5
- import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
6
- import './DataFetcher-a650ae58.js';
7
- import { I as InMemoryLoader } from './pesquisa-fetcher-96d2f351.js';
8
- import { S as SnkMultiSelectionListDataSource, C as CrudUtils } from './SnkMultiSelectionListDataSource-7084f3b3.js';
9
- import { P as PresentationMode } from './index-0ece87a6.js';
5
+ import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
6
+ import { F as FormConfigFetcher } from './form-config-fetcher-13cd3285.js';
7
+ import { I as InMemoryLoader } from './pesquisa-fetcher-4eed47c6.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-6ebf47ab.js';
9
+ import { D as DataExporterOption, P as PresentationMode } from './index-0ece87a6.js';
10
10
  import './ISave-d8c8bc59.js';
11
11
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
13
13
  import './filter-item-type.enum-d45e026f.js';
14
- import { F as FormConfigFetcher } from './form-config-fetcher-765b8498.js';
15
14
  import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
16
- import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
17
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-7a4e678f.js';
18
- import './index-bdf75557.js';
15
+ import { C as ConfigStorage } from './ConfigStorage-cc3f3dd3.js';
16
+ import { S as SnkFormConfigManager } from './SnkFormConfigManager-7edda7eb.js';
17
+ import { g as getSelectedIDs } from './RecordIDUtils-87d02110.js';
18
+ import { s as store } from './index-bdf75557.js';
19
19
  import './PrintUtils-3e4ff0f5.js';
20
20
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
21
21
  import './ResourceIDUtils-a114189a.js';
@@ -24,6 +24,56 @@ import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilte
24
24
  const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
25
25
  const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
26
26
 
27
+ class ClientSideExporterProvider extends CommonsExporter {
28
+ getSelectedNumber() {
29
+ return this.dataUnit.getSelectionInfo().length;
30
+ }
31
+ getTotalRecords() {
32
+ var _a, _b, _c;
33
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
34
+ 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;
35
+ }
36
+ getSelectedIDs() {
37
+ return getSelectedIDs(this.dataUnit);
38
+ }
39
+ getRecordID() {
40
+ var _a, _b, _c;
41
+ 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__;
42
+ }
43
+ async getRecords() {
44
+ if (this.dataUnit.records.length === 0) {
45
+ return Promise.resolve([]);
46
+ }
47
+ const selectionInfo = this.dataUnit.getSelectionInfo();
48
+ const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
49
+ return Promise.resolve(records == undefined ? [] : records);
50
+ }
51
+ getHiddenOptions() {
52
+ return [
53
+ DataExporterOption.EXPORT_BY_EMAIL,
54
+ DataExporterOption.EXPORT_PDF_TO_EMAIL,
55
+ DataExporterOption.EXPORT_XLS_TO_EMAIL,
56
+ DataExporterOption.EXPORT_PAGE_TO_PDF,
57
+ DataExporterOption.EXPORT_PAGE_TO_XLS
58
+ ];
59
+ }
60
+ formatValue(record, column) {
61
+ const { id, descriptionFrom } = column;
62
+ const value = record[descriptionFrom || id];
63
+ if (value == undefined) {
64
+ return "";
65
+ }
66
+ if (descriptionFrom != undefined) {
67
+ return value.label;
68
+ }
69
+ const fieldDescriptor = this.dataUnit.getField(id);
70
+ if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
71
+ return value.value;
72
+ }
73
+ return this.dataUnit.getFormattedValue(id, value);
74
+ }
75
+ }
76
+
27
77
  const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%;--snk-simple-crud-grid--min-height:300px}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:auto 1fr;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;--ez-grid--min-height:var(--snk-simple-crud-grid--min-height)}ez-form.sc-snk-simple-crud{min-height:300px}";
28
78
 
29
79
  const SnkSimpleCrud = class {
@@ -39,10 +89,10 @@ const SnkSimpleCrud = class {
39
89
  this._keyDownHandler = (event) => this.keyDownListener(event);
40
90
  this._formConfigFetcher = new FormConfigFetcher();
41
91
  this._taskbarProcessor = new TaskbarProcessor({
42
- "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
43
- "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
44
- "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
45
- "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
92
+ "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
93
+ "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
94
+ "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
95
+ "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
46
96
  "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
47
97
  });
48
98
  this._showPopUpGridConfig = false;
@@ -53,12 +103,14 @@ const SnkSimpleCrud = class {
53
103
  this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
54
104
  this.dataState = undefined;
55
105
  this.dataUnit = undefined;
106
+ this.entityName = undefined;
56
107
  this.mode = SIMPLE_CRUD_MODE.SERVER;
57
108
  this.gridConfig = undefined;
58
109
  this.formConfig = undefined;
59
110
  this._formFields = [];
60
111
  this.multipleSelection = undefined;
61
112
  this.useCancelConfirm = true;
113
+ this.pageSize = 150;
62
114
  this.resourceID = undefined;
63
115
  this.taskbarManager = undefined;
64
116
  this.messagesBuilder = undefined;
@@ -80,9 +132,9 @@ const SnkSimpleCrud = class {
80
132
  this.loadFormConfig(true);
81
133
  this.loadGridConfig(true);
82
134
  }
83
- getButtons(selected, changeModeBtn) {
135
+ getButtons(selected, extraButtons) {
84
136
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
85
- .concat(changeModeBtn));
137
+ .concat(extraButtons));
86
138
  }
87
139
  addConfigButton(buttons) {
88
140
  if (this.configName === undefined) {
@@ -122,6 +174,12 @@ const SnkSimpleCrud = class {
122
174
  }
123
175
  evt.stopPropagation();
124
176
  }
177
+ async onChangeEntityName(newValue) {
178
+ if (this.dataUnit)
179
+ return;
180
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
181
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
182
+ }
125
183
  onModeChange() {
126
184
  if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
127
185
  this.initInMemoryDataUnit();
@@ -234,6 +292,7 @@ const SnkSimpleCrud = class {
234
292
  }
235
293
  async componentWillRender() {
236
294
  this._resourceID = await this.application.getResourceID();
295
+ this.dataExporterProviderStore();
237
296
  this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
238
297
  if (this.configName === undefined) {
239
298
  return;
@@ -258,13 +317,13 @@ const SnkSimpleCrud = class {
258
317
  this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
259
318
  }
260
319
  getTaskBarId() {
261
- var _a, _b, _c;
320
+ var _a, _b;
262
321
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
263
322
  return "snkSimpleCrudTaskbar.finish_edition";
264
323
  }
265
324
  if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
266
325
  !this.dataState.selectionInfo.isAllRecords() &&
267
- ((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
326
+ this.dataState.selectionInfo.length > 0) {
268
327
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
269
328
  }
270
329
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
@@ -504,9 +563,23 @@ const SnkSimpleCrud = class {
504
563
  .then(() => {
505
564
  this.setGridConfig(config);
506
565
  this.closeGridConfig();
566
+ this.dataExporterProviderStore();
507
567
  });
508
568
  evt.stopPropagation();
509
569
  }
570
+ async dataExporterProviderStore() {
571
+ if (this.dataUnit == undefined) {
572
+ return;
573
+ }
574
+ if (this._grid == undefined) {
575
+ return;
576
+ }
577
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
578
+ store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
579
+ }
580
+ getDataExporterStoreKey() {
581
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
582
+ }
510
583
  setGridConfig(config) {
511
584
  this.gridConfig = config;
512
585
  CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
@@ -522,6 +595,15 @@ const SnkSimpleCrud = class {
522
595
  closeFormConfig() {
523
596
  this._showFormConfig = false;
524
597
  }
598
+ getPageSize() {
599
+ if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
600
+ return 0;
601
+ }
602
+ if (this.pageSize == undefined) {
603
+ return 150;
604
+ }
605
+ return this.pageSize;
606
+ }
525
607
  //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
526
608
  handleShowFormConfig() {
527
609
  return this._showFormConfig && !this.formLegacyConfigName;
@@ -543,13 +625,14 @@ const SnkSimpleCrud = class {
543
625
  if (this.dataUnit == undefined) {
544
626
  return;
545
627
  }
546
- return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
628
+ return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
547
629
  ? undefined
548
630
  : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
549
631
  }
550
632
  get _element() { return getElement(this); }
551
633
  static get watchers() { return {
552
634
  "resourceID": ["handleResourceIDChanged"],
635
+ "entityName": ["onChangeEntityName"],
553
636
  "mode": ["onModeChange"],
554
637
  "dataState": ["observeDataState"],
555
638
  "formLegacyConfigName": ["observeFormLegacy"],
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
2
  import { StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
4
- import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-2473c8ac.js';
4
+ import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-ad766858.js';
5
5
  import { P as PresentationMode } from './index-0ece87a6.js';
6
6
  import './index-bdf75557.js';
7
7
 
@@ -162,8 +162,9 @@ const SnkTaskbar = class {
162
162
  className += "ez-padding-left--medium";
163
163
  }
164
164
  const taskbarElement = TaskbarElement[def.toString()];
165
+ const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
165
166
  if (taskbarElement) {
166
- return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), this.configName, this.presentationMode);
167
+ return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
167
168
  }
168
169
  else {
169
170
  return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -48,7 +48,7 @@ const buildCustomButton = (def, className, dataElementId, action, isEnabled) =>
48
48
  return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
49
49
  }
50
50
  };
51
- const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, configName, presentationMode) => {
51
+ const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
52
52
  var _a;
53
53
  const title = getTitle(element);
54
54
  switch (element) {
@@ -91,7 +91,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
91
91
  case TaskbarElement.DIVIDER:
92
92
  return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
93
93
  case TaskbarElement.DATA_EXPORTER:
94
- const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
94
+ const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
95
95
  return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
96
96
  case TaskbarElement.ATTACH:
97
97
  return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s,g as e,H as n}from"./p-d2d301a6.js";import{Action as o,ObjectUtils as a,DataUnitAction as h,ApplicationContext as r}from"@sankhyalabs/core";import{ApplicationUtils as l,DialogType as d}from"@sankhyalabs/ezui/dist/collection/utils";import{O as c,S as v}from"./p-32556aa6.js";import{g as u}from"./p-9863d682.js";const f=class{constructor(s){t(this,s),this.dataStateChange=i(this,"dataStateChange",3),this.dataUnitReady=i(this,"dataUnitReady",3),this.messagesBuilderUpdated=i(this,"messagesBuilderUpdated",3),this.insertionMode=i(this,"insertionMode",3),this.cancelEdition=i(this,"cancelEdition",3),this._onDataUnitResolve=[],this._openedAlert=!1,this._dataUnitObserver=t=>{var i,s;const e=this.buildDataState();if(this.dataState=e,t.type===o.DATA_SAVED){if(this.ignoreSaveMessage)return;const i=this.getMessage("snkDataUnit.saveInfo",t.payload.records[0]);null!=i&&this.showSuccessMessage(i)}if(t.type!==o.RECORDS_ADDED&&t.type!==o.RECORDS_COPIED||this.insertionMode.emit(),t.type===o.EDITION_CANCELED&&this.cancelEdition.emit(),t.type===o.RECORDS_REMOVED){const e=t.payload.cachedRecords;let n;n=(null==e?void 0:e.length)>1?this.getMessage("snkDataUnit.removeAllInfo",{size:e.length}):this.getMessage("snkDataUnit.removeInfo",t.payload.cachedRecords[0]),null!=n&&this.showSuccessMessage(n);const o=null!==(s=null===(i=this.dataUnit.records)||void 0===i?void 0:i.length)&&void 0!==s?s:0,a=this.dataUnit.getPaginationInfo();a&&this.dataUnit.gotoPage(o>0||a.hasMore?a.currentPage:0)}this.messagesBuilder.currentOperation=this.getMessageOperation()},this.dataState=void 0,this.messagesBuilder=void 0,this.dataUnitName=void 0,this.entityName=void 0,this.pageSize=150,this.dataUnit=void 0,this.beforeSave=void 0,this.afterSave=void 0,this.useCancelConfirm=!0,this.ignoreSaveMessage=void 0,this.configName=void 0,this.resourceID=void 0}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,i){i!=t&&(this.dataUnit?this._application.updateDataunitCache(i,this.dataUnitName,this.dataUnit):this.loadDataUnit())}observeEntityName(t,i){i!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,i){a.objectToString(i)!=a.objectToString(t)&&this.dataStateChange.emit(t)}observeDataUnit(){this.handlerLinkFields(),this.dataUnitReady.emit(this.dataUnit)}observeMessagesBuilder(t){t&&this.messagesBuilderUpdated.emit(t)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async getSelectedRecordsIDsInfo(){return Promise.resolve(u(this.dataUnit))}getCleanOnCopyFields(){var t;return null===(t=this.dataUnit.metadata)||void 0===t?void 0:t.fields.filter((t=>{var i;return null===(i=t.properties)||void 0===i?void 0:i.cleanOnCopy})).map((t=>t.name))}async interceptAction(t){return new Promise((i=>{var s,e,n,a,r;switch(t.type){case o.RECORDS_ADDED:this.isAllowed("INSERT")?i(t):l.info(this.getMessage("snkDataUnit.forbiddenInsert"));break;case o.RECORDS_COPIED:if(this.isAllowed("CLONE")){const s=this.getCleanOnCopyFields();s.length>0&&(t=new h(o.RECORDS_COPIED,t.payload.map((t=>{const i=Object.assign({},t);return s.forEach((t=>delete i[t])),i})))),i(t)}else l.info(this.getMessage("snkDataUnit.forbiddenClone"));break;case o.DATA_CHANGED:case o.CHANGING_DATA:if(this.isAllowed("UPDATE"))return i(t);if(this._openedAlert)return this.dataUnit.cancelEdition();this._openedAlert=!0,this.dataUnit.cancelEdition(),l.alert(this.getMessage("snkDataUnit.forbidden"),this.getMessage("snkDataUnit.forbiddenUpdate")).then((()=>{this._openedAlert=!1}));break;case o.SAVING_DATA:if(this.beforeSave){const s=this.beforeSave(this.dataUnit);s instanceof Promise?s.then((s=>i(s?t:void 0))):i(s?t:void 0)}else i(t);break;case o.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):i(t);break;case o.EDITION_CANCELED:if(!this.useCancelConfirm)return i(t);if(this.dataState.hasDirtyRecords){const n=this.getMessage("snkDataUnit.cancelConfirmation");if((null===(s=t.payload)||void 0===s?void 0:s.fromParent)||(null===(e=t.payload)||void 0===e?void 0:e.silent))return void i(t);if(null==n)this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo")),i(t);else{const s=this.getMessage("snkDataUnit.cancelConfirmationTitle");l.confirm(s,n).then((s=>{s&&this.showSuccessMessage(this.getMessage("snkDataUnit.cancelInfo")),i(s?t:void 0)}))}}else i(t);break;case o.REMOVING_RECORDS:if(this.isAllowed("REMOVE")){let s=!1,e=!(null===(n=t.payload)||void 0===n?void 0:n.silent)&&this.getMessage("snkDataUnit.removeConfirmation");const o=null===(a=this.dataUnit)||void 0===a?void 0:a.getSelectionInfo();if(!(null===(r=t.payload)||void 0===r?void 0:r.silent)&&(null==o?void 0:o.length)>1&&(e=this.getMessage("snkDataUnit.removeAllConfirmation",{size:o.length}),s=!0),e){const n={canClose:!1,labelCancel:this.getMessage("snkDataUnit.confirm."+(s?"no":"cancel")),labelConfirm:this.getMessage("snkDataUnit.confirm."+(s?"yes":"delete")),btnConfirmDanger:!1},o=this.getMessage("snkDataUnit.removeConfirmationTitle");l.confirm(o,e,null,d.WARN,n).then((s=>i(s?t:void 0)))}else i(t)}else l.info(this.getMessage("snkDataUnit.forbiddenRemove"));break;default:i(t)}}))}showSuccessMessage(t){l.info(t,{iconName:"check"})}isAllowed(t){return!!this._permissions&&(this._permissions.isSup||this._permissions[t])}buildDataState(){const t=this.dataUnit.getSelectionInfo(),i=(this.dataUnit.hasDirtyRecords()||this.dataUnit.hasWaitingChanges())&&(null==t?void 0:t.isEmpty());return new m({insertionMode:this.dataUnit.hasNewRecord(),isStartingInsertionMode:i,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:this.dataUnit.hasCopiedRecord(),isDirty:this.dataUnit.isDirty(),hasDirtyRecords:this.dataUnit.hasDirtyRecords(),selectedRecords:void 0,selectionInfo:t,selectedRecord:this.dataUnit.getSelectedRecord(),recordsIsEmpty:0===this.dataUnit.records.length})}getMessage(t,i){return i||(i=this.getMessageParams()),this.messagesBuilder.getMessage(t,i)}getMessageParams(){return this.dataState.selectedRecord}getMessageOperation(){return this.dataState.copyMode?c.CLONE:this.dataState.insertionMode||this.dataState.isStartingInsertionMode?c.INSERT:this.dataState.isDirty?c.UPDATE:c.CLEAN}async getDataUnitParentOrChild(){var t;const i=this.dataUnitName?this.dataUnitName:this.entityName;return this._parentSnkDataUnit?(this._parentDataUnit=await(null===(t=this._parentSnkDataUnit)||void 0===t?void 0:t.getDataUnit()),await this._application.getDataUnit(this.entityName,i,this._parentDataUnit,this.configName,this.resourceID)):await this._application.getDataUnit(this.entityName,i,null,this.configName,this.resourceID)}async loadDataUnit(){if(null==this.dataUnit&&this._application&&this.entityName&&(this.dataUnit=await this.getDataUnitParentOrChild()),this.dataUnit){let t;for(this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver),this.dataState=this.buildDataState();t=this._onDataUnitResolve.pop();)t(this.dataUnit)}}getParentSnkDataUnit(){let t=this.element;for(;t.parentNode;){if("SNK-DATA-UNIT"===t.parentNode.nodeName)return t.parentNode;t=t.parentNode}}handlerLinkFields(){var t,i;const s=Object.assign({},this.dataUnit.metadata);if(!this._parentDataUnit)return;const e=this._parentDataUnit.getChildInfo(this.entityName);if(!e)return;const n=null===(t=null==e?void 0:e.links)||void 0===t?void 0:t.map((t=>t.target));null===(i=null==s?void 0:s.fields)||void 0===i||i.forEach((t=>{(null==n?void 0:n.includes(t.name))&&(t.visible=!1)})),this.dataUnit.metadata=s}static getNearestInstance(t){let i=t.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase())return i;i=i.parentElement}}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)),this._parentSnkDataUnit=this.getParentSnkDataUnit(),null==this.messagesBuilder&&(this.messagesBuilder=new v(this.entityName))}disconnectedCallback(){this.dataUnit&&this.dataUnit.releaseCallbacks()}componentDidLoad(){this.loadDataUnit()}render(){return s(n,null)}get element(){return e(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"],messagesBuilder:["observeMessagesBuilder"]}}};class m{constructor(t){this.copyMode=t.copyMode,this.insertionMode=t.insertionMode,this.isStartingInsertionMode=t.isStartingInsertionMode,this.isDirty=t.isDirty,this.hasDirtyRecords=t.hasDirtyRecords,this.hasNext=t.hasNext,this.hasPrevious=t.hasPrevious,this.selectionInfo=t.selectionInfo,this.selectedRecord=t.selectedRecord,this.recordsIsEmpty=t.recordsIsEmpty}get selectedRecords(){var t;if(console.warn("SnkDataUnit: O método `selectedRecords` foi descontinuado. Use o método `selectionInfo`."),null===(t=this.selectionInfo)||void 0===t?void 0:t.isAllRecords())throw new Error("Erro interno: Impossível obter os registros selecionados. A seleção atual é virtual. Use o atributo `selectionInfo`.");return this.selectionInfo.records}}export{f as S}