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

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
@@ -1,24 +1,79 @@
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-aad5d4ff.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-9e6e0071.js';
10
9
  import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
11
- import './DataFetcher-a650ae58.js';
12
- import './pesquisa-fetcher-f05a12ca.js';
10
+ import './form-config-fetcher-13cd3285.js';
11
+ import './pesquisa-fetcher-d785663b.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
+ import '@sankhyalabs/core/dist/utils/SortingUtils';
20
21
  import './ResourceIDUtils-a114189a.js';
21
22
 
23
+ class ServerSideExporterProvider extends CommonsExporter {
24
+ getFilters() {
25
+ var _a;
26
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
27
+ }
28
+ getOrders() {
29
+ var _a;
30
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
31
+ }
32
+ getResourceURI() {
33
+ var _a;
34
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name;
35
+ }
36
+ getSelectedNumber() {
37
+ return this.dataUnit.getSelectionInfo().length;
38
+ }
39
+ getTotalRecords() {
40
+ var _a, _b, _c;
41
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
42
+ 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;
43
+ }
44
+ getSelectedIDs() {
45
+ return getSelectedIDs(this.dataUnit);
46
+ }
47
+ getOffset() {
48
+ return this.getExporterOffset(this.getPaginationInfo());
49
+ }
50
+ getPageSize() {
51
+ var _a;
52
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
53
+ }
54
+ getExportLimit() {
55
+ return 5000;
56
+ }
57
+ getRecordID() {
58
+ var _a, _b, _c;
59
+ 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__;
60
+ }
61
+ getPaginationInfo() {
62
+ var _a;
63
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
64
+ }
65
+ getExporterOffset(paginationInfo) {
66
+ if (paginationInfo == undefined) {
67
+ return;
68
+ }
69
+ const offset = paginationInfo.firstRecord;
70
+ if (offset > 0) {
71
+ return (offset - 1);
72
+ }
73
+ return offset;
74
+ }
75
+ }
76
+
22
77
  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
78
 
24
79
  const SnkGrid = class {
@@ -169,99 +224,8 @@ const SnkGrid = class {
169
224
  });
170
225
  evt.stopPropagation();
171
226
  }
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
227
  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
- };
228
+ const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
265
229
  store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
266
230
  }
267
231
  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-f05a12ca.js';
8
+ import './form-config-fetcher-13cd3285.js';
9
+ import './pesquisa-fetcher-d785663b.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,22 +1,22 @@
1
- export { S as snk_guides_viewer } from './snk-guides-viewer-b94752f2.js';
1
+ export { S as snk_guides_viewer } from './snk-guides-viewer-8fc16590.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-f05a12ca.js';
16
+ import './pesquisa-fetcher-d785663b.js';
18
17
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
19
18
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
19
+ import '@sankhyalabs/core/dist/utils/SortingUtils';
20
20
  import './ResourceIDUtils-a114189a.js';
21
21
  import './ISave-d8c8bc59.js';
22
22
  import '@sankhyalabs/core/dist/dataunit/DataUnit';
@@ -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,29 +1,81 @@
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
+ import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
4
  import { d as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-8457af36.js';
4
- import { T as TaskbarElement } from './taskbar-elements-2473c8ac.js';
5
- import './DataFetcher-a650ae58.js';
6
- import { I as InMemoryLoader } from './pesquisa-fetcher-f05a12ca.js';
7
- import { S as SnkMultiSelectionListDataSource, C as CrudUtils } from './SnkMultiSelectionListDataSource-aad5d4ff.js';
8
- 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-d785663b.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, a as CrudUtils } from './IExporterProvider-9e6e0071.js';
9
+ import { D as DataExporterOption, P as PresentationMode } from './index-0ece87a6.js';
9
10
  import './ISave-d8c8bc59.js';
10
11
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
11
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
13
  import './filter-item-type.enum-d45e026f.js';
13
- import { F as FormConfigFetcher } from './form-config-fetcher-765b8498.js';
14
14
  import { T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch } from './field-search-efbe307f.js';
15
- import { C as ConfigStorage } from './ConfigStorage-6e241cd7.js';
16
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-7a4e678f.js';
17
- 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';
18
19
  import './PrintUtils-3e4ff0f5.js';
19
20
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
21
+ import '@sankhyalabs/core/dist/utils/SortingUtils';
20
22
  import './ResourceIDUtils-a114189a.js';
21
23
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
22
24
 
23
25
  const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
24
26
  const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
25
27
 
26
- const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:max-content;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;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";
28
+ class ClientSideExporterProvider extends CommonsExporter {
29
+ getSelectedNumber() {
30
+ return this.dataUnit.getSelectionInfo().length;
31
+ }
32
+ getTotalRecords() {
33
+ var _a, _b, _c;
34
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
35
+ 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;
36
+ }
37
+ getSelectedIDs() {
38
+ return getSelectedIDs(this.dataUnit);
39
+ }
40
+ getRecordID() {
41
+ var _a, _b, _c;
42
+ 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__;
43
+ }
44
+ async getRecords() {
45
+ if (this.dataUnit.records.length === 0) {
46
+ return Promise.resolve([]);
47
+ }
48
+ const selectionInfo = this.dataUnit.getSelectionInfo();
49
+ const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
50
+ return Promise.resolve(records == undefined ? [] : records);
51
+ }
52
+ getHiddenOptions() {
53
+ return [
54
+ DataExporterOption.EXPORT_BY_EMAIL,
55
+ DataExporterOption.EXPORT_PDF_TO_EMAIL,
56
+ DataExporterOption.EXPORT_XLS_TO_EMAIL,
57
+ DataExporterOption.EXPORT_PAGE_TO_PDF,
58
+ DataExporterOption.EXPORT_PAGE_TO_XLS
59
+ ];
60
+ }
61
+ formatValue(record, column) {
62
+ const { id, descriptionFrom } = column;
63
+ const value = record[descriptionFrom || id];
64
+ if (value == undefined) {
65
+ return "";
66
+ }
67
+ if (descriptionFrom != undefined) {
68
+ return value.label;
69
+ }
70
+ const fieldDescriptor = this.dataUnit.getField(id);
71
+ if (fieldDescriptor.userInterface === UserInterface.SEARCH) {
72
+ return value.value;
73
+ }
74
+ return this.dataUnit.getFormattedValue(id, value);
75
+ }
76
+ }
77
+
78
+ 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}";
27
79
 
28
80
  const SnkSimpleCrud = class {
29
81
  constructor(hostRef) {
@@ -38,10 +90,10 @@ const SnkSimpleCrud = class {
38
90
  this._keyDownHandler = (event) => this.keyDownListener(event);
39
91
  this._formConfigFetcher = new FormConfigFetcher();
40
92
  this._taskbarProcessor = new TaskbarProcessor({
41
- "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
42
- "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
43
- "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
44
- "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
93
+ "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
94
+ "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
95
+ "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
96
+ "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
45
97
  "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
46
98
  });
47
99
  this._showPopUpGridConfig = false;
@@ -52,12 +104,14 @@ const SnkSimpleCrud = class {
52
104
  this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
53
105
  this.dataState = undefined;
54
106
  this.dataUnit = undefined;
107
+ this.entityName = undefined;
55
108
  this.mode = SIMPLE_CRUD_MODE.SERVER;
56
109
  this.gridConfig = undefined;
57
110
  this.formConfig = undefined;
58
111
  this._formFields = [];
59
112
  this.multipleSelection = undefined;
60
113
  this.useCancelConfirm = true;
114
+ this.pageSize = 150;
61
115
  this.resourceID = undefined;
62
116
  this.taskbarManager = undefined;
63
117
  this.messagesBuilder = undefined;
@@ -79,9 +133,9 @@ const SnkSimpleCrud = class {
79
133
  this.loadFormConfig(true);
80
134
  this.loadGridConfig(true);
81
135
  }
82
- getButtons(selected, changeModeBtn) {
136
+ getButtons(selected, extraButtons) {
83
137
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
84
- .concat(changeModeBtn));
138
+ .concat(extraButtons));
85
139
  }
86
140
  addConfigButton(buttons) {
87
141
  if (this.configName === undefined) {
@@ -121,6 +175,12 @@ const SnkSimpleCrud = class {
121
175
  }
122
176
  evt.stopPropagation();
123
177
  }
178
+ async onChangeEntityName(newValue) {
179
+ if (this.dataUnit)
180
+ return;
181
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
182
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
183
+ }
124
184
  onModeChange() {
125
185
  if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
126
186
  this.initInMemoryDataUnit();
@@ -172,10 +232,15 @@ const SnkSimpleCrud = class {
172
232
  this._showPopUpGridConfig = true;
173
233
  });
174
234
  }
175
- openFormConfig() {
235
+ async openFormConfig() {
236
+ var _a, _b;
176
237
  //No momento não daremos suporte para configuraçao de formulário quando houver legacy config
177
- if (this.formLegacyConfigName)
238
+ if (this.formLegacyConfigName) {
239
+ const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
240
+ const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
241
+ await this.application.alert(title, message);
178
242
  return;
243
+ }
179
244
  this._showFormConfig = true;
180
245
  }
181
246
  addGridLegacyConfigName() {
@@ -228,6 +293,7 @@ const SnkSimpleCrud = class {
228
293
  }
229
294
  async componentWillRender() {
230
295
  this._resourceID = await this.application.getResourceID();
296
+ this.dataExporterProviderStore();
231
297
  this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
232
298
  if (this.configName === undefined) {
233
299
  return;
@@ -244,18 +310,21 @@ const SnkSimpleCrud = class {
244
310
  this.onModeChange();
245
311
  this.configDatasource();
246
312
  }
313
+ componentDidLoad() {
314
+ CSSVarsUtils.applyVarsGrid(this._element, this._grid);
315
+ }
247
316
  configDatasource() {
248
317
  this._multiSelectionListDataSource.setApplication(this.application);
249
318
  this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
250
319
  }
251
320
  getTaskBarId() {
252
- var _a, _b, _c;
321
+ var _a, _b;
253
322
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
254
323
  return "snkSimpleCrudTaskbar.finish_edition";
255
324
  }
256
325
  if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
257
326
  !this.dataState.selectionInfo.isAllRecords() &&
258
- ((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
327
+ this.dataState.selectionInfo.length > 0) {
259
328
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
260
329
  }
261
330
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
@@ -300,6 +369,13 @@ const SnkSimpleCrud = class {
300
369
  var _a;
301
370
  (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
302
371
  }
372
+ updateConfig() {
373
+ if (this._formConfigManager == undefined) {
374
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
375
+ }
376
+ this._formConfigManager.setConfig(this.formConfig);
377
+ return;
378
+ }
303
379
  processMetadata() {
304
380
  const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
305
381
  const fieldMetadata = [];
@@ -488,9 +564,23 @@ const SnkSimpleCrud = class {
488
564
  .then(() => {
489
565
  this.setGridConfig(config);
490
566
  this.closeGridConfig();
567
+ this.dataExporterProviderStore();
491
568
  });
492
569
  evt.stopPropagation();
493
570
  }
571
+ async dataExporterProviderStore() {
572
+ if (this.dataUnit == undefined) {
573
+ return;
574
+ }
575
+ if (this._grid == undefined) {
576
+ return;
577
+ }
578
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
579
+ store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
580
+ }
581
+ getDataExporterStoreKey() {
582
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
583
+ }
494
584
  setGridConfig(config) {
495
585
  this.gridConfig = config;
496
586
  CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
@@ -506,6 +596,15 @@ const SnkSimpleCrud = class {
506
596
  closeFormConfig() {
507
597
  this._showFormConfig = false;
508
598
  }
599
+ getPageSize() {
600
+ if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
601
+ return 0;
602
+ }
603
+ if (this.pageSize == undefined) {
604
+ return 150;
605
+ }
606
+ return this.pageSize;
607
+ }
509
608
  //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
510
609
  handleShowFormConfig() {
511
610
  return this._showFormConfig && !this.formLegacyConfigName;
@@ -513,19 +612,28 @@ const SnkSimpleCrud = class {
513
612
  resolveResourceID() {
514
613
  return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
515
614
  }
615
+ getFormConfig() {
616
+ var _a, _b;
617
+ const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields);
618
+ if (!this.configName && !configFromManager) {
619
+ return this.formConfig;
620
+ }
621
+ return configFromManager;
622
+ }
516
623
  /* istanbul ignore next */
517
624
  render() {
518
- var _a, _b, _c;
625
+ var _a;
519
626
  if (this.dataUnit == undefined) {
520
627
  return;
521
628
  }
522
- 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)
629
+ 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)
523
630
  ? undefined
524
- : 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: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig((_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode, this.dataUnit, this.ignoreReadOnlyFormFields), 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() }))));
631
+ : 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() }))));
525
632
  }
526
633
  get _element() { return getElement(this); }
527
634
  static get watchers() { return {
528
635
  "resourceID": ["handleResourceIDChanged"],
636
+ "entityName": ["onChangeEntityName"],
529
637
  "mode": ["onModeChange"],
530
638
  "dataState": ["observeDataState"],
531
639
  "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
 
@@ -37,6 +37,8 @@ const SnkTaskbar = class {
37
37
  this._customElementsId = undefined;
38
38
  this._slotContainer = undefined;
39
39
  this._hiddenActionsList = [];
40
+ this._lastWidth = undefined;
41
+ this._hasToUpdateOverFlow = false;
40
42
  this.alignRigth = false;
41
43
  this.customSlotId = "TASKBAR_CUSTOM_ELEMENTS";
42
44
  this.customContainerId = undefined;
@@ -62,6 +64,11 @@ const SnkTaskbar = class {
62
64
  var _a;
63
65
  (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
64
66
  }
67
+ observeLastWidth(newValue, oldValue) {
68
+ if (oldValue === 0 && newValue !== 0) {
69
+ this._hasToUpdateOverFlow = true;
70
+ }
71
+ }
65
72
  // Internal methods
66
73
  elementsFromString(strButtons) {
67
74
  const elements = [];
@@ -155,8 +162,9 @@ const SnkTaskbar = class {
155
162
  className += "ez-padding-left--medium";
156
163
  }
157
164
  const taskbarElement = TaskbarElement[def.toString()];
165
+ const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
158
166
  if (taskbarElement) {
159
- 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);
160
168
  }
161
169
  else {
162
170
  return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -245,10 +253,20 @@ const SnkTaskbar = class {
245
253
  this.getCustomElements();
246
254
  }
247
255
  componentWillRender() {
256
+ this.handleDefinitions();
257
+ this.validatePresentationMode();
258
+ this.updateOverFlowIfNeeded();
259
+ }
260
+ handleDefinitions() {
248
261
  if (this._definitions == undefined && this._permissions) {
249
262
  this._definitions = this.elementsFromString(this.buttons);
250
263
  }
251
- this.validatePresentationMode();
264
+ }
265
+ updateOverFlowIfNeeded() {
266
+ if (this._hasToUpdateOverFlow) {
267
+ requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
268
+ this._hasToUpdateOverFlow = false;
269
+ }
252
270
  }
253
271
  handleOverFlow(overFlowingElements) {
254
272
  const elementsToHandle = overFlowingElements.filter(element => !this.hasToIgnoreOverFlow(element));
@@ -315,6 +333,10 @@ const SnkTaskbar = class {
315
333
  }
316
334
  componentDidRender() {
317
335
  this.appendCustomElementsInTaskbar();
336
+ this.updateLastWidth();
337
+ }
338
+ updateLastWidth() {
339
+ this._lastWidth = this._element.getBoundingClientRect().width;
318
340
  }
319
341
  disconnectedCallback() {
320
342
  var _a;
@@ -361,7 +383,8 @@ const SnkTaskbar = class {
361
383
  get _element() { return getElement(this); }
362
384
  static get watchers() { return {
363
385
  "buttons": ["observeButtons"],
364
- "disabledButtons": ["observeDisabledButtons"]
386
+ "disabledButtons": ["observeDisabledButtons"],
387
+ "_lastWidth": ["observeLastWidth"]
365
388
  }; }
366
389
  };
367
390
  SnkTaskbar.style = snkTaskbarCss;