@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
@@ -4,25 +4,80 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
8
- const taskbarElements = require('./taskbar-elements-3ecd1278.js');
9
- const ConfigStorage = require('./ConfigStorage-8d4e9d53.js');
7
+ const taskbarElements = require('./taskbar-elements-d9392685.js');
8
+ const ConfigStorage = require('./ConfigStorage-085c7117.js');
10
9
  const index$1 = require('./index-0922807b.js');
11
10
  const fieldSearch = require('./field-search-f56aa7d6.js');
12
11
  const index$2 = require('./index-102ba62d.js');
13
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-1438f8f2.js');
12
+ const IExporterProvider = require('./IExporterProvider-f50b6846.js');
14
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
15
- require('./DataFetcher-99f0f6ed.js');
16
- require('./pesquisa-fetcher-94f6b316.js');
14
+ require('./form-config-fetcher-cdd644a7.js');
15
+ require('./pesquisa-fetcher-90b801fb.js');
17
16
  require('./ISave-e91b70a7.js');
18
17
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
18
+ require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
19
19
  require('./filter-item-type.enum-a7ffdaa6.js');
20
- require('./form-config-fetcher-d73f4449.js');
20
+ const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
21
21
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
22
22
  require('./PrintUtils-bcaeb82f.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
24
+ require('@sankhyalabs/core/dist/utils/SortingUtils');
24
25
  require('./ResourceIDUtils-5ff86aa7.js');
25
26
 
27
+ class ServerSideExporterProvider extends IExporterProvider.CommonsExporter {
28
+ getFilters() {
29
+ var _a;
30
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
31
+ }
32
+ getOrders() {
33
+ var _a;
34
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
35
+ }
36
+ getResourceURI() {
37
+ var _a;
38
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name;
39
+ }
40
+ getSelectedNumber() {
41
+ return this.dataUnit.getSelectionInfo().length;
42
+ }
43
+ getTotalRecords() {
44
+ var _a, _b, _c;
45
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
46
+ 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;
47
+ }
48
+ getSelectedIDs() {
49
+ return RecordIDUtils.getSelectedIDs(this.dataUnit);
50
+ }
51
+ getOffset() {
52
+ return this.getExporterOffset(this.getPaginationInfo());
53
+ }
54
+ getPageSize() {
55
+ var _a;
56
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
57
+ }
58
+ getExportLimit() {
59
+ return 5000;
60
+ }
61
+ getRecordID() {
62
+ var _a, _b, _c;
63
+ 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__;
64
+ }
65
+ getPaginationInfo() {
66
+ var _a;
67
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
68
+ }
69
+ getExporterOffset(paginationInfo) {
70
+ if (paginationInfo == undefined) {
71
+ return;
72
+ }
73
+ const offset = paginationInfo.firstRecord;
74
+ if (offset > 0) {
75
+ return (offset - 1);
76
+ }
77
+ return offset;
78
+ }
79
+ }
80
+
26
81
  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}";
27
82
 
28
83
  const SnkGrid = class {
@@ -54,7 +109,7 @@ const SnkGrid = class {
54
109
  this._gridConfig = undefined;
55
110
  this._popUpGridConfig = false;
56
111
  this._showSnkFilterBar = true;
57
- this.columnFilterDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
112
+ this.columnFilterDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
58
113
  this.configName = undefined;
59
114
  this.filterBarTitle = undefined;
60
115
  this.resourceID = undefined;
@@ -142,7 +197,7 @@ const SnkGrid = class {
142
197
  }
143
198
  setGridConfig(config) {
144
199
  this._gridConfig = config;
145
- SnkMultiSelectionListDataSource.CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
200
+ IExporterProvider.CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
146
201
  }
147
202
  loadConfig() {
148
203
  ConfigStorage.ConfigStorage.loadGridConfig(this.configName, this.resourceID)
@@ -173,99 +228,8 @@ const SnkGrid = class {
173
228
  });
174
229
  evt.stopPropagation();
175
230
  }
176
- buildColumnsMetadata(gridColumns) {
177
- const columnsMetadata = [];
178
- gridColumns === null || gridColumns === void 0 ? void 0 : gridColumns.forEach((column) => {
179
- var _a, _b;
180
- /**
181
- * TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
182
- */
183
- if (column.hidden && column.name !== "RECDESP") {
184
- return;
185
- }
186
- const fieldData = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
187
- const columnData = {
188
- label: column.label,
189
- id: column.name,
190
- width: column.width,
191
- type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
192
- userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface
193
- };
194
- columnsMetadata.push(columnData);
195
- if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
196
- const mergedFrom = fieldData.properties.mergedFrom;
197
- const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
198
- const descriptionColumn = {
199
- label: fieldData.properties.DESCRIPTIONENTITY,
200
- id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
201
- width: 200,
202
- type: core.DataType.TEXT,
203
- userInterface: UnitMetadata.UserInterface.LONGTEXT
204
- };
205
- columnsMetadata.push(descriptionColumn);
206
- }
207
- });
208
- return columnsMetadata || [];
209
- }
210
- getPaginationInfo() {
211
- var _a;
212
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo();
213
- }
214
- getExporterOffset(paginationInfo) {
215
- if (paginationInfo == undefined) {
216
- return;
217
- }
218
- const offset = paginationInfo.firstRecord;
219
- if (offset > 0) {
220
- return (offset - 1);
221
- }
222
- return offset;
223
- }
224
231
  async dataExporterProviderStore() {
225
- var _a;
226
- const selectedIDs = await ((_a = this._snkDataUnit) === null || _a === void 0 ? void 0 : _a.getSelectedRecordsIDsInfo());
227
- const dataExporterProvider = {
228
- getFilters: () => {
229
- var _a;
230
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getAppliedFilters();
231
- },
232
- getColumnsMetadata: async () => {
233
- var _a;
234
- const columnsState = await ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.getColumnsState());
235
- return this.buildColumnsMetadata(columnsState);
236
- },
237
- getOrders: () => {
238
- var _a;
239
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getSort();
240
- },
241
- getResourceURI: () => {
242
- var _a;
243
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.name;
244
- },
245
- getSelectedNumber: () => {
246
- var _a, _b;
247
- return (_b = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) === null || _b === void 0 ? void 0 : _b.length;
248
- },
249
- getTotalRecords: () => {
250
- var _a, _b, _c;
251
- const { total } = ((_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
252
- 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;
253
- },
254
- getSelectedIDs: () => {
255
- return selectedIDs || [];
256
- },
257
- getOffset: () => {
258
- return this.getExporterOffset(this.getPaginationInfo());
259
- },
260
- getLimit: () => {
261
- var _a;
262
- return (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.pageSize;
263
- },
264
- getRecordID: () => {
265
- var _a, _b, _c;
266
- 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__;
267
- }
268
- };
232
+ const dataExporterProvider = new ServerSideExporterProvider(this._dataUnit, this._grid);
269
233
  index$2.store.set("exporterProviders", Object.assign(Object.assign({}, index$2.store.get("exporterProviders")), { [this.configName]: dataExporterProvider }));
270
234
  }
271
235
  addElementID() {
@@ -273,7 +237,7 @@ const SnkGrid = class {
273
237
  core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
274
238
  }
275
239
  finshLoading() {
276
- SnkMultiSelectionListDataSource.CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
240
+ IExporterProvider.CrudUtils.assertDefaultSorting(this._gridConfig, this._dataUnit);
277
241
  this.addElementID();
278
242
  if (this.columnFilterDataSource != undefined) {
279
243
  this.columnFilterDataSource.setApplication(this._application);
@@ -2,19 +2,18 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-33995e92.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-8986431f.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const fieldSearch = require('./field-search-f56aa7d6.js');
8
- const taskbarElements = require('./taskbar-elements-3ecd1278.js');
8
+ const taskbarElements = require('./taskbar-elements-d9392685.js');
9
9
  const constants = require('./constants-35ddd366.js');
10
- require('./DataFetcher-99f0f6ed.js');
11
- require('./pesquisa-fetcher-94f6b316.js');
10
+ require('./form-config-fetcher-cdd644a7.js');
11
+ require('./pesquisa-fetcher-90b801fb.js');
12
12
  const index$1 = require('./index-0922807b.js');
13
13
  require('./ISave-e91b70a7.js');
14
14
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
- require('./form-config-fetcher-d73f4449.js');
18
17
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
19
18
 
20
19
  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}";
@@ -2,25 +2,25 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-25721856.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-e4c8ee66.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-33995e92.js');
9
- require('./ConfigStorage-8d4e9d53.js');
10
- require('./form-config-fetcher-d73f4449.js');
11
- require('./DataFetcher-99f0f6ed.js');
8
+ require('./SnkFormConfigManager-8986431f.js');
9
+ require('./ConfigStorage-085c7117.js');
10
+ require('./form-config-fetcher-cdd644a7.js');
12
11
  require('./PrintUtils-bcaeb82f.js');
13
12
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
14
13
  require('./filter-item-type.enum-a7ffdaa6.js');
15
14
  require('@sankhyalabs/ezui/dist/collection/utils/form');
16
15
  require('./field-search-f56aa7d6.js');
17
- require('./taskbar-elements-3ecd1278.js');
16
+ require('./taskbar-elements-d9392685.js');
18
17
  require('./index-0922807b.js');
19
18
  require('./index-102ba62d.js');
20
19
  require('./constants-35ddd366.js');
21
- require('./pesquisa-fetcher-94f6b316.js');
20
+ require('./pesquisa-fetcher-90b801fb.js');
22
21
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
23
22
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
23
+ require('@sankhyalabs/core/dist/utils/SortingUtils');
24
24
  require('./ResourceIDUtils-5ff86aa7.js');
25
25
  require('./ISave-e91b70a7.js');
26
26
  require('@sankhyalabs/core/dist/dataunit/DataUnit');
@@ -5,13 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
8
- const ConfigStorage = require('./ConfigStorage-8d4e9d53.js');
8
+ const ConfigStorage = require('./ConfigStorage-085c7117.js');
9
9
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  const index$1 = require('./index-c5771aba.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
12
  require('./filter-item-type.enum-a7ffdaa6.js');
13
- require('./form-config-fetcher-d73f4449.js');
14
- require('./DataFetcher-99f0f6ed.js');
13
+ require('./form-config-fetcher-cdd644a7.js');
15
14
  require('./PrintUtils-bcaeb82f.js');
16
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
16
 
@@ -2,50 +2,102 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-f9e81701.js');
5
+ const index$1 = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
7
8
  const constants = require('./constants-35ddd366.js');
8
- const taskbarElements = require('./taskbar-elements-3ecd1278.js');
9
- require('./DataFetcher-99f0f6ed.js');
10
- const pesquisaFetcher = require('./pesquisa-fetcher-94f6b316.js');
11
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-1438f8f2.js');
12
- const index$1 = require('./index-0922807b.js');
9
+ const taskbarElements = require('./taskbar-elements-d9392685.js');
10
+ const formConfigFetcher = require('./form-config-fetcher-cdd644a7.js');
11
+ const pesquisaFetcher = require('./pesquisa-fetcher-90b801fb.js');
12
+ const IExporterProvider = require('./IExporterProvider-f50b6846.js');
13
+ const index = require('./index-0922807b.js');
13
14
  require('./ISave-e91b70a7.js');
14
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
17
  require('./filter-item-type.enum-a7ffdaa6.js');
17
- const formConfigFetcher = require('./form-config-fetcher-d73f4449.js');
18
18
  const fieldSearch = require('./field-search-f56aa7d6.js');
19
- const ConfigStorage = require('./ConfigStorage-8d4e9d53.js');
20
- const SnkFormConfigManager = require('./SnkFormConfigManager-33995e92.js');
21
- require('./index-102ba62d.js');
19
+ const ConfigStorage = require('./ConfigStorage-085c7117.js');
20
+ const SnkFormConfigManager = require('./SnkFormConfigManager-8986431f.js');
21
+ const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
22
+ const index$2 = require('./index-102ba62d.js');
22
23
  require('./PrintUtils-bcaeb82f.js');
23
24
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
25
+ require('@sankhyalabs/core/dist/utils/SortingUtils');
24
26
  require('./ResourceIDUtils-5ff86aa7.js');
25
27
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
26
28
 
27
29
  const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
28
30
  const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
29
31
 
30
- 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}";
32
+ class ClientSideExporterProvider extends IExporterProvider.CommonsExporter {
33
+ getSelectedNumber() {
34
+ return this.dataUnit.getSelectionInfo().length;
35
+ }
36
+ getTotalRecords() {
37
+ var _a, _b, _c;
38
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
39
+ 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;
40
+ }
41
+ getSelectedIDs() {
42
+ return RecordIDUtils.getSelectedIDs(this.dataUnit);
43
+ }
44
+ getRecordID() {
45
+ var _a, _b, _c;
46
+ 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__;
47
+ }
48
+ async getRecords() {
49
+ if (this.dataUnit.records.length === 0) {
50
+ return Promise.resolve([]);
51
+ }
52
+ const selectionInfo = this.dataUnit.getSelectionInfo();
53
+ const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
54
+ return Promise.resolve(records == undefined ? [] : records);
55
+ }
56
+ getHiddenOptions() {
57
+ return [
58
+ index.DataExporterOption.EXPORT_BY_EMAIL,
59
+ index.DataExporterOption.EXPORT_PDF_TO_EMAIL,
60
+ index.DataExporterOption.EXPORT_XLS_TO_EMAIL,
61
+ index.DataExporterOption.EXPORT_PAGE_TO_PDF,
62
+ index.DataExporterOption.EXPORT_PAGE_TO_XLS
63
+ ];
64
+ }
65
+ formatValue(record, column) {
66
+ const { id, descriptionFrom } = column;
67
+ const value = record[descriptionFrom || id];
68
+ if (value == undefined) {
69
+ return "";
70
+ }
71
+ if (descriptionFrom != undefined) {
72
+ return value.label;
73
+ }
74
+ const fieldDescriptor = this.dataUnit.getField(id);
75
+ if (fieldDescriptor.userInterface === core.UserInterface.SEARCH) {
76
+ return value.value;
77
+ }
78
+ return this.dataUnit.getFormattedValue(id, value);
79
+ }
80
+ }
81
+
82
+ 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}";
31
83
 
32
84
  const SnkSimpleCrud = class {
33
85
  constructor(hostRef) {
34
- index.registerInstance(this, hostRef);
35
- this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
36
- this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
37
- this.actionClick = index.createEvent(this, "actionClick", 7);
38
- this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
39
- this.configuratorSave = index.createEvent(this, "configuratorSave", 7);
40
- this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
41
- this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
86
+ index$1.registerInstance(this, hostRef);
87
+ this.dataStateChange = index$1.createEvent(this, "dataStateChange", 3);
88
+ this.dataUnitReady = index$1.createEvent(this, "dataUnitReady", 3);
89
+ this.actionClick = index$1.createEvent(this, "actionClick", 7);
90
+ this.formItemsReady = index$1.createEvent(this, "formItemsReady", 7);
91
+ this.configuratorSave = index$1.createEvent(this, "configuratorSave", 7);
92
+ this.configuratorCancel = index$1.createEvent(this, "configuratorCancel", 7);
93
+ this._multiSelectionListDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
42
94
  this._keyDownHandler = (event) => this.keyDownListener(event);
43
95
  this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
44
96
  this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
45
- "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, taskbarElements.TaskbarElement.GRID_MODE),
46
- "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, taskbarElements.TaskbarElement.FORM_MODE),
47
- "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, taskbarElements.TaskbarElement.GRID_MODE),
48
- "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, taskbarElements.TaskbarElement.FORM_MODE),
97
+ "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE]),
98
+ "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
99
+ "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE]),
100
+ "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
49
101
  "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
50
102
  });
51
103
  this._showPopUpGridConfig = false;
@@ -56,12 +108,14 @@ const SnkSimpleCrud = class {
56
108
  this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${core.StringUtils.generateUUID()}`;
57
109
  this.dataState = undefined;
58
110
  this.dataUnit = undefined;
111
+ this.entityName = undefined;
59
112
  this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
60
113
  this.gridConfig = undefined;
61
114
  this.formConfig = undefined;
62
115
  this._formFields = [];
63
116
  this.multipleSelection = undefined;
64
117
  this.useCancelConfirm = true;
118
+ this.pageSize = 150;
65
119
  this.resourceID = undefined;
66
120
  this.taskbarManager = undefined;
67
121
  this.messagesBuilder = undefined;
@@ -83,9 +137,9 @@ const SnkSimpleCrud = class {
83
137
  this.loadFormConfig(true);
84
138
  this.loadGridConfig(true);
85
139
  }
86
- getButtons(selected, changeModeBtn) {
140
+ getButtons(selected, extraButtons) {
87
141
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
88
- .concat(changeModeBtn));
142
+ .concat(extraButtons));
89
143
  }
90
144
  addConfigButton(buttons) {
91
145
  if (this.configName === undefined) {
@@ -125,6 +179,12 @@ const SnkSimpleCrud = class {
125
179
  }
126
180
  evt.stopPropagation();
127
181
  }
182
+ async onChangeEntityName(newValue) {
183
+ if (this.dataUnit)
184
+ return;
185
+ const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
186
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
187
+ }
128
188
  onModeChange() {
129
189
  if (this.mode == constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
130
190
  this.initInMemoryDataUnit();
@@ -176,10 +236,15 @@ const SnkSimpleCrud = class {
176
236
  this._showPopUpGridConfig = true;
177
237
  });
178
238
  }
179
- openFormConfig() {
239
+ async openFormConfig() {
240
+ var _a, _b;
180
241
  //No momento não daremos suporte para configuraçao de formulário quando houver legacy config
181
- if (this.formLegacyConfigName)
242
+ if (this.formLegacyConfigName) {
243
+ const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
244
+ const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
245
+ await this.application.alert(title, message);
182
246
  return;
247
+ }
183
248
  this._showFormConfig = true;
184
249
  }
185
250
  addGridLegacyConfigName() {
@@ -232,6 +297,7 @@ const SnkSimpleCrud = class {
232
297
  }
233
298
  async componentWillRender() {
234
299
  this._resourceID = await this.application.getResourceID();
300
+ this.dataExporterProviderStore();
235
301
  this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
236
302
  if (this.configName === undefined) {
237
303
  return;
@@ -248,18 +314,21 @@ const SnkSimpleCrud = class {
248
314
  this.onModeChange();
249
315
  this.configDatasource();
250
316
  }
317
+ componentDidLoad() {
318
+ utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
319
+ }
251
320
  configDatasource() {
252
321
  this._multiSelectionListDataSource.setApplication(this.application);
253
322
  this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
254
323
  }
255
324
  getTaskBarId() {
256
- var _a, _b, _c;
325
+ var _a, _b;
257
326
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
258
327
  return "snkSimpleCrudTaskbar.finish_edition";
259
328
  }
260
329
  if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
261
330
  !this.dataState.selectionInfo.isAllRecords() &&
262
- ((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
331
+ this.dataState.selectionInfo.length > 0) {
263
332
  return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
264
333
  }
265
334
  return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
@@ -304,6 +373,13 @@ const SnkSimpleCrud = class {
304
373
  var _a;
305
374
  (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
306
375
  }
376
+ updateConfig() {
377
+ if (this._formConfigManager == undefined) {
378
+ this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
379
+ }
380
+ this._formConfigManager.setConfig(this.formConfig);
381
+ return;
382
+ }
307
383
  processMetadata() {
308
384
  const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
309
385
  const fieldMetadata = [];
@@ -441,8 +517,8 @@ const SnkSimpleCrud = class {
441
517
  }
442
518
  getTopTaskBarId() {
443
519
  var _a;
444
- return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index$1.PresentationMode.PRIMARY}` :
445
- `snkGridTopTaskbar.regular${index$1.PresentationMode.PRIMARY}`;
520
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index.PresentationMode.PRIMARY}` :
521
+ `snkGridTopTaskbar.regular${index.PresentationMode.PRIMARY}`;
446
522
  }
447
523
  async keyDownListener(event) {
448
524
  if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
@@ -492,12 +568,26 @@ const SnkSimpleCrud = class {
492
568
  .then(() => {
493
569
  this.setGridConfig(config);
494
570
  this.closeGridConfig();
571
+ this.dataExporterProviderStore();
495
572
  });
496
573
  evt.stopPropagation();
497
574
  }
575
+ async dataExporterProviderStore() {
576
+ if (this.dataUnit == undefined) {
577
+ return;
578
+ }
579
+ if (this._grid == undefined) {
580
+ return;
581
+ }
582
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
583
+ index$2.store.set("exporterProviders", Object.assign(Object.assign({}, index$2.store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
584
+ }
585
+ getDataExporterStoreKey() {
586
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
587
+ }
498
588
  setGridConfig(config) {
499
589
  this.gridConfig = config;
500
- SnkMultiSelectionListDataSource.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
590
+ IExporterProvider.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
501
591
  }
502
592
  setFormConfig(config, forceUpdate) {
503
593
  if (this.formConfig && !forceUpdate)
@@ -510,6 +600,15 @@ const SnkSimpleCrud = class {
510
600
  closeFormConfig() {
511
601
  this._showFormConfig = false;
512
602
  }
603
+ getPageSize() {
604
+ if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
605
+ return 0;
606
+ }
607
+ if (this.pageSize == undefined) {
608
+ return 150;
609
+ }
610
+ return this.pageSize;
611
+ }
513
612
  //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
514
613
  handleShowFormConfig() {
515
614
  return this._showFormConfig && !this.formLegacyConfigName;
@@ -517,19 +616,28 @@ const SnkSimpleCrud = class {
517
616
  resolveResourceID() {
518
617
  return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
519
618
  }
619
+ getFormConfig() {
620
+ var _a, _b;
621
+ 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);
622
+ if (!this.configName && !configFromManager) {
623
+ return this.formConfig;
624
+ }
625
+ return configFromManager;
626
+ }
520
627
  /* istanbul ignore next */
521
628
  render() {
522
- var _a, _b, _c;
629
+ var _a;
523
630
  if (this.dataUnit == undefined) {
524
631
  return;
525
632
  }
526
- return (index.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.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: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.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(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
633
+ return (index$1.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(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.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: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.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(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
527
634
  ? undefined
528
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.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() && index.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index.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 })), index.h("div", { id: `${this._customContainerId}` }, index.h("slot", { name: "SnkConfigContainerSlot" }))), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
635
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.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() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.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 })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
529
636
  }
530
- get _element() { return index.getElement(this); }
637
+ get _element() { return index$1.getElement(this); }
531
638
  static get watchers() { return {
532
639
  "resourceID": ["handleResourceIDChanged"],
640
+ "entityName": ["onChangeEntityName"],
533
641
  "mode": ["onModeChange"],
534
642
  "dataState": ["observeDataState"],
535
643
  "formLegacyConfigName": ["observeFormLegacy"],