@sankhyalabs/sankhyablocks 8.15.1 → 8.16.0-dev.2

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 (216) hide show
  1. package/dist/cjs/{SnkMultiSelectionListDataSource-303e85d1.js → IExporterProvider-9479f618.js} +94 -4
  2. package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
  3. package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-1b13bacd.js} +6 -3
  4. package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-722b104e.js} +8 -12
  5. package/dist/cjs/{pesquisa-fetcher-213797ec.js → dataunit-fetcher-0c7106a0.js} +88 -180
  6. package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/pesquisa-fetcher-680e198f.js +166 -0
  9. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  10. package/dist/cjs/snk-actions-button_4.cjs.entry.js +4 -2
  11. package/dist/cjs/snk-application.cjs.entry.js +34 -11
  12. package/dist/cjs/snk-attach.cjs.entry.js +71 -46
  13. package/dist/cjs/snk-crud.cjs.entry.js +96 -10
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
  15. package/dist/cjs/snk-data-unit-16791a2f.js +679 -0
  16. package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
  17. package/dist/cjs/snk-detail-view.cjs.entry.js +48 -7
  18. package/dist/cjs/snk-filter-bar.cjs.entry.js +5 -1
  19. package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
  20. package/dist/cjs/snk-form.cjs.entry.js +51 -6
  21. package/dist/cjs/snk-grid.cjs.entry.js +164 -107
  22. package/dist/cjs/{snk-guides-viewer-4b6ecda8.js → snk-guides-viewer-d82746e8.js} +36 -8
  23. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -6
  24. package/dist/cjs/snk-simple-crud.cjs.entry.js +264 -37
  25. package/dist/cjs/snk-taskbar.cjs.entry.js +4 -3
  26. package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-9ad1f9c0.js} +3 -3
  27. package/dist/collection/collection-manifest.json +1 -1
  28. package/dist/collection/components/snk-application/snk-application.js +35 -11
  29. package/dist/collection/components/snk-attach/snk-attach.js +67 -44
  30. package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
  31. package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
  32. package/dist/collection/components/snk-crud/snk-crud.js +249 -7
  33. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +135 -0
  34. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
  35. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +112 -5
  36. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +97 -0
  37. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +74 -0
  38. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +54 -1
  39. package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
  40. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +58 -0
  41. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
  42. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +59 -52
  43. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
  44. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
  45. package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
  46. package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
  47. package/dist/collection/components/snk-data-unit/snk-data-unit.js +507 -214
  48. package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
  49. package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +18 -0
  50. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
  51. package/dist/collection/components/snk-form/snk-form.js +102 -5
  52. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -3
  53. package/dist/collection/components/snk-grid/snk-grid.js +240 -101
  54. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +386 -18
  55. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
  56. package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
  57. package/dist/collection/lib/@types/index.js +5 -0
  58. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
  59. package/dist/collection/lib/dataUnit/InMemoryLoader.js +8 -3
  60. package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
  61. package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
  62. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
  63. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
  64. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
  65. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
  66. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
  67. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
  68. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +53 -4
  69. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
  70. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
  71. package/dist/collection/lib/message/SnkMessageBuilder.js +5 -12
  72. package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
  73. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
  74. package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
  75. package/dist/components/ISave.js +47 -0
  76. package/dist/components/SnkFormConfigManager.js +6 -3
  77. package/dist/components/SnkMessageBuilder.js +8 -12
  78. package/dist/components/dataunit-fetcher.js +85 -182
  79. package/dist/components/index2.js +198 -33
  80. package/dist/components/pesquisa-fetcher.js +164 -0
  81. package/dist/components/snk-actions-button2.js +4 -11
  82. package/dist/components/snk-application2.js +31 -9
  83. package/dist/components/snk-attach2.js +65 -41
  84. package/dist/components/snk-crud.js +103 -11
  85. package/dist/components/snk-data-exporter2.js +309 -85
  86. package/dist/components/snk-data-unit2.js +470 -212
  87. package/dist/components/snk-detail-view2.js +87 -10
  88. package/dist/components/snk-expression-item2.js +1 -1
  89. package/dist/components/snk-filter-bar2.js +6 -1
  90. package/dist/components/snk-form-view2.js +72 -1
  91. package/dist/components/snk-form.js +53 -6
  92. package/dist/components/snk-grid2.js +168 -106
  93. package/dist/components/snk-personalized-filter2.js +1 -1
  94. package/dist/components/snk-simple-crud2.js +259 -23
  95. package/dist/components/snk-taskbar2.js +6 -5
  96. package/dist/esm/{SnkMultiSelectionListDataSource-36918dbf.js → IExporterProvider-5a858363.js} +93 -5
  97. package/dist/esm/RecordIDUtils-87d02110.js +41 -0
  98. package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-d4554df9.js} +6 -3
  99. package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-89925609.js} +8 -12
  100. package/dist/esm/{pesquisa-fetcher-fe6f3826.js → dataunit-fetcher-f7e0ffc0.js} +84 -181
  101. package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
  102. package/dist/esm/loader.js +1 -1
  103. package/dist/esm/pesquisa-fetcher-03c8f919.js +164 -0
  104. package/dist/esm/sankhyablocks.js +1 -1
  105. package/dist/esm/snk-actions-button_4.entry.js +4 -2
  106. package/dist/esm/snk-application.entry.js +33 -10
  107. package/dist/esm/snk-attach.entry.js +66 -41
  108. package/dist/esm/snk-crud.entry.js +96 -10
  109. package/dist/esm/snk-data-exporter.entry.js +316 -86
  110. package/dist/esm/snk-data-unit-a327d22c.js +677 -0
  111. package/dist/esm/snk-data-unit.entry.js +12 -2
  112. package/dist/esm/snk-detail-view.entry.js +48 -7
  113. package/dist/esm/snk-filter-bar.entry.js +5 -1
  114. package/dist/esm/snk-form-view.entry.js +67 -0
  115. package/dist/esm/snk-form.entry.js +51 -6
  116. package/dist/esm/snk-grid.entry.js +162 -105
  117. package/dist/esm/{snk-guides-viewer-113be3fd.js → snk-guides-viewer-874da66f.js} +36 -8
  118. package/dist/esm/snk-guides-viewer.entry.js +8 -6
  119. package/dist/esm/snk-simple-crud.entry.js +252 -25
  120. package/dist/esm/snk-taskbar.entry.js +4 -3
  121. package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-d59867f1.js} +3 -3
  122. package/dist/sankhyablocks/p-0046959e.entry.js +1 -0
  123. package/dist/sankhyablocks/p-0e11ee18.entry.js +1 -0
  124. package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
  125. package/dist/sankhyablocks/p-30cf616e.js +1 -0
  126. package/dist/sankhyablocks/p-47b60deb.entry.js +1 -0
  127. package/dist/sankhyablocks/p-60e46675.entry.js +11 -0
  128. package/dist/sankhyablocks/p-6d4f4614.js +60 -0
  129. package/dist/sankhyablocks/p-6ded2076.entry.js +1 -0
  130. package/dist/sankhyablocks/p-7a337364.js +1 -0
  131. package/dist/sankhyablocks/p-7d9baaf4.entry.js +1 -0
  132. package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
  133. package/dist/sankhyablocks/p-829d4045.js +1 -0
  134. package/dist/sankhyablocks/p-8c6b44ea.entry.js +1 -0
  135. package/dist/sankhyablocks/p-8fc470e5.entry.js +1 -0
  136. package/dist/sankhyablocks/p-9863d682.js +1 -0
  137. package/dist/sankhyablocks/p-a4b1f1eb.js +1 -0
  138. package/dist/sankhyablocks/p-af8efd95.js +6 -0
  139. package/dist/sankhyablocks/p-b7c4feeb.entry.js +1 -0
  140. package/dist/sankhyablocks/p-b8cde0d8.entry.js +1 -0
  141. package/dist/sankhyablocks/p-c7cbad38.js +1 -0
  142. package/dist/sankhyablocks/p-e0b9f59a.entry.js +1 -0
  143. package/dist/sankhyablocks/p-e6210aec.js +1 -0
  144. package/dist/sankhyablocks/p-e9bbc3d5.entry.js +1 -0
  145. package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
  146. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  147. package/dist/types/components/snk-application/snk-application.d.ts +7 -3
  148. package/dist/types/components/snk-attach/snk-attach.d.ts +11 -9
  149. package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
  150. package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
  151. package/dist/types/components/snk-crud/snk-crud.d.ts +36 -1
  152. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
  153. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
  154. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +19 -0
  155. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +14 -0
  156. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +12 -0
  157. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +24 -4
  158. package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
  159. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
  160. package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
  161. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +4 -1
  162. package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
  163. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
  164. package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
  165. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  166. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +61 -2
  167. package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
  168. package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +3 -0
  169. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  170. package/dist/types/components/snk-form/snk-form.d.ts +14 -0
  171. package/dist/types/components/snk-grid/snk-grid.d.ts +46 -6
  172. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +58 -4
  173. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
  174. package/dist/types/components.d.ts +220 -4
  175. package/dist/types/lib/@types/index.d.ts +5 -0
  176. package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
  177. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
  178. package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
  179. package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
  180. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
  181. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
  182. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  183. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
  184. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
  185. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
  186. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
  187. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +3 -0
  188. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
  189. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
  190. package/package.json +1 -1
  191. package/dist/cjs/snk-data-unit-41c29713.js +0 -462
  192. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
  193. package/dist/components/index3.js +0 -199
  194. package/dist/esm/snk-data-unit-de1d140d.js +0 -460
  195. package/dist/sankhyablocks/p-032fe52e.js +0 -1
  196. package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
  197. package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
  198. package/dist/sankhyablocks/p-0899e0b5.entry.js +0 -1
  199. package/dist/sankhyablocks/p-154a7f33.entry.js +0 -1
  200. package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
  201. package/dist/sankhyablocks/p-164666b1.js +0 -65
  202. package/dist/sankhyablocks/p-32556aa6.js +0 -1
  203. package/dist/sankhyablocks/p-328585d0.entry.js +0 -1
  204. package/dist/sankhyablocks/p-38289a55.js +0 -1
  205. package/dist/sankhyablocks/p-52c8e589.js +0 -1
  206. package/dist/sankhyablocks/p-5cb07080.js +0 -1
  207. package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
  208. package/dist/sankhyablocks/p-7fe120b8.entry.js +0 -11
  209. package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
  210. package/dist/sankhyablocks/p-af1ac81f.entry.js +0 -1
  211. package/dist/sankhyablocks/p-b4525fc0.entry.js +0 -1
  212. package/dist/sankhyablocks/p-cce0865d.js +0 -1
  213. package/dist/sankhyablocks/p-dec65f6c.entry.js +0 -1
  214. package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
  215. package/dist/sankhyablocks/p-f13f7616.entry.js +0 -1
  216. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
@@ -2,51 +2,111 @@
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
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const constants = require('./constants-35ddd366.js');
9
- const taskbarElements = require('./taskbar-elements-3ecd1278.js');
9
+ const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
10
10
  require('./DataFetcher-313debd8.js');
11
- const pesquisaFetcher = require('./pesquisa-fetcher-213797ec.js');
12
- const SnkMultiSelectionListDataSource = require('./SnkMultiSelectionListDataSource-303e85d1.js');
13
- const index$1 = require('./index-0922807b.js');
11
+ require('./pesquisa-fetcher-680e198f.js');
12
+ const IExporterProvider = require('./IExporterProvider-9479f618.js');
13
+ const index = require('./index-1dfc7a6e.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
+ const dataunitFetcher = require('./dataunit-fetcher-0c7106a0.js');
17
18
  require('./filter-item-type.enum-a7ffdaa6.js');
18
19
  const formConfigFetcher = require('./form-config-fetcher-2dd00e5b.js');
19
20
  const fieldSearch = require('./field-search-f56aa7d6.js');
20
21
  const ConfigStorage = require('./ConfigStorage-942ce74b.js');
21
- const SnkFormConfigManager = require('./SnkFormConfigManager-f9dc0d28.js');
22
- require('./index-102ba62d.js');
22
+ const SnkFormConfigManager = require('./SnkFormConfigManager-1b13bacd.js');
23
+ const RecordIDUtils = require('./RecordIDUtils-3735135c.js');
24
+ const index$2 = require('./index-102ba62d.js');
23
25
  require('./PrintUtils-bcaeb82f.js');
26
+ require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
24
27
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
28
+ require('@sankhyalabs/core/dist/utils/SortingUtils');
25
29
  require('./ResourceIDUtils-5ff86aa7.js');
26
- require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
27
30
 
28
31
  const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
29
32
  const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
30
33
 
34
+ class ClientSideExporterProvider extends IExporterProvider.CommonsExporter {
35
+ getSelectedNumber() {
36
+ return this.dataUnit.getSelectionInfo().length;
37
+ }
38
+ getTotalRecords() {
39
+ var _a, _b, _c;
40
+ const { total } = ((_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getPaginationInfo()) || {};
41
+ return total !== null && total !== void 0 ? total : (_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.records) === null || _c === void 0 ? void 0 : _c.length;
42
+ }
43
+ getSelectedIDs() {
44
+ return RecordIDUtils.getSelectedIDs(this.dataUnit);
45
+ }
46
+ getRecordID() {
47
+ var _a, _b, _c;
48
+ 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__;
49
+ }
50
+ async getRecords() {
51
+ if (this.dataUnit.records.length === 0) {
52
+ return Promise.resolve([]);
53
+ }
54
+ const selectionInfo = this.dataUnit.getSelectionInfo();
55
+ const records = selectionInfo.isEmpty() || selectionInfo.isAllRecords() ? await selectionInfo.getAllRecords() : selectionInfo.records;
56
+ return Promise.resolve(records == undefined ? [] : records);
57
+ }
58
+ getHiddenOptions() {
59
+ return [
60
+ index.DataExporterOption.EXPORT_BY_EMAIL,
61
+ index.DataExporterOption.EXPORT_PDF_TO_EMAIL,
62
+ index.DataExporterOption.EXPORT_XLS_TO_EMAIL,
63
+ index.DataExporterOption.EXPORT_PAGE_TO_PDF,
64
+ index.DataExporterOption.EXPORT_PAGE_TO_XLS
65
+ ];
66
+ }
67
+ formatValue(record, column) {
68
+ const { id, descriptionFrom } = column;
69
+ const value = record[descriptionFrom || id];
70
+ if (value == undefined) {
71
+ return "";
72
+ }
73
+ if (descriptionFrom != undefined) {
74
+ return value.label;
75
+ }
76
+ const fieldDescriptor = this.dataUnit.getField(id);
77
+ if (fieldDescriptor.userInterface === core.UserInterface.SEARCH) {
78
+ return value.value;
79
+ }
80
+ if (column.customFormatter) {
81
+ const ezGridColumn = this.getColumnsState().find(columnState => column.id === columnState.name);
82
+ const formattedValue = column.customFormatter.format(value, ezGridColumn, record.__record__id__);
83
+ return formattedValue;
84
+ }
85
+ return this.dataUnit.getFormattedValue(id, value);
86
+ }
87
+ }
88
+
31
89
  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}";
32
90
 
33
91
  const SnkSimpleCrud = class {
34
92
  constructor(hostRef) {
35
- index.registerInstance(this, hostRef);
36
- this.dataStateChange = index.createEvent(this, "dataStateChange", 3);
37
- this.dataUnitReady = index.createEvent(this, "dataUnitReady", 3);
38
- this.actionClick = index.createEvent(this, "actionClick", 7);
39
- this.formItemsReady = index.createEvent(this, "formItemsReady", 7);
40
- this.configuratorSave = index.createEvent(this, "configuratorSave", 7);
41
- this.configuratorCancel = index.createEvent(this, "configuratorCancel", 7);
42
- this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource.SnkMultiSelectionListDataSource();
93
+ index$1.registerInstance(this, hostRef);
94
+ this.dataStateChange = index$1.createEvent(this, "dataStateChange", 3);
95
+ this.dataUnitReady = index$1.createEvent(this, "dataUnitReady", 3);
96
+ this.actionClick = index$1.createEvent(this, "actionClick", 7);
97
+ this.formItemsReady = index$1.createEvent(this, "formItemsReady", 7);
98
+ this.configuratorSave = index$1.createEvent(this, "configuratorSave", 7);
99
+ this.configuratorCancel = index$1.createEvent(this, "configuratorCancel", 7);
100
+ this._multiSelectionListDataSource = new IExporterProvider.SnkMultiSelectionListDataSource();
43
101
  this._keyDownHandler = (event) => this.keyDownListener(event);
44
102
  this._formConfigFetcher = new formConfigFetcher.FormConfigFetcher();
103
+ this._customEditors = new Map();
104
+ this._customRenders = new Map();
45
105
  this._taskbarProcessor = new fieldSearch.TaskbarProcessor({
46
- "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, taskbarElements.TaskbarElement.GRID_MODE),
47
- "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, taskbarElements.TaskbarElement.FORM_MODE),
48
- "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, taskbarElements.TaskbarElement.GRID_MODE),
49
- "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, taskbarElements.TaskbarElement.FORM_MODE),
106
+ "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [taskbarElements.TaskbarElement.GRID_MODE]),
107
+ "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
108
+ "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [taskbarElements.TaskbarElement.GRID_MODE]),
109
+ "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [taskbarElements.TaskbarElement.DATA_EXPORTER, taskbarElements.TaskbarElement.FORM_MODE]),
50
110
  "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
51
111
  });
52
112
  this._showPopUpGridConfig = false;
@@ -57,12 +117,15 @@ const SnkSimpleCrud = class {
57
117
  this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${core.StringUtils.generateUUID()}`;
58
118
  this.dataState = undefined;
59
119
  this.dataUnit = undefined;
120
+ this.entityName = undefined;
60
121
  this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
61
122
  this.gridConfig = undefined;
62
123
  this.formConfig = undefined;
63
124
  this._formFields = [];
125
+ this._fieldsProps = new Map();
64
126
  this.multipleSelection = undefined;
65
127
  this.useCancelConfirm = true;
128
+ this.pageSize = 150;
66
129
  this.resourceID = undefined;
67
130
  this.taskbarManager = undefined;
68
131
  this.messagesBuilder = undefined;
@@ -73,6 +136,33 @@ const SnkSimpleCrud = class {
73
136
  this.gridLegacyConfigName = undefined;
74
137
  this.formLegacyConfigName = undefined;
75
138
  this.ignoreReadOnlyFormFields = false;
139
+ this.autoFocus = true;
140
+ this.autoLoad = undefined;
141
+ }
142
+ /**
143
+ * Registra um editor customizado para campos da grade e formulário.
144
+ */
145
+ async addCustomEditor(fieldName, customEditor) {
146
+ if (this._grid && this._form) {
147
+ this._grid.addCustomEditor(fieldName, customEditor);
148
+ this._form.addCustomEditor(fieldName, customEditor);
149
+ return;
150
+ }
151
+ const newCustomEditors = new Map(this._customEditors);
152
+ newCustomEditors.set(fieldName, customEditor);
153
+ this._customEditors = newCustomEditors;
154
+ }
155
+ /**
156
+ * Registra um render customizado para colunas da grid.
157
+ */
158
+ async addGridCustomRender(fieldName, customRender) {
159
+ if (this._grid) {
160
+ this._grid.addGridCustomRender(fieldName, customRender);
161
+ return;
162
+ }
163
+ const newCustomRenders = new Map(this._customRenders);
164
+ newCustomRenders.set(fieldName, customRender);
165
+ this._customRenders = newCustomRenders;
76
166
  }
77
167
  handleResourceIDChanged(newValue, oldValue) {
78
168
  if (core.StringUtils.isEmpty(newValue)) {
@@ -84,9 +174,30 @@ const SnkSimpleCrud = class {
84
174
  this.loadFormConfig(true);
85
175
  this.loadGridConfig(true);
86
176
  }
87
- getButtons(selected, changeModeBtn) {
177
+ /**
178
+ * Registra um formatador de valores para uma coluna da grid.
179
+ */
180
+ async addCustomValueFormatter(columnName, customFormatter) {
181
+ this._grid.addCustomValueFormatter(columnName, customFormatter);
182
+ }
183
+ /**
184
+ * Remove o formatador de valores de uma coluna da grid.
185
+ */
186
+ async removeCustomValueFormatter(columnName) {
187
+ this._grid.removeCustomValueFormatter(columnName);
188
+ }
189
+ /**
190
+ * Altera/adiciona uma propriedade nos metadados do campo.
191
+ */
192
+ async setFieldProp(fieldName, propName, value) {
193
+ const newCustomFieldProps = new Map(this._fieldsProps);
194
+ const currentProps = this._fieldsProps.get(fieldName);
195
+ newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
196
+ this._fieldsProps = newCustomFieldProps;
197
+ }
198
+ getButtons(selected, extraButtons) {
88
199
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
89
- .concat(changeModeBtn));
200
+ .concat(extraButtons));
90
201
  }
91
202
  addConfigButton(buttons) {
92
203
  if (this.configName === undefined) {
@@ -126,15 +237,19 @@ const SnkSimpleCrud = class {
126
237
  }
127
238
  evt.stopPropagation();
128
239
  }
240
+ async onChangeEntityName(newValue) {
241
+ if (this.dataUnit)
242
+ return;
243
+ const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
244
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
245
+ }
129
246
  onModeChange() {
130
247
  if (this.mode == constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
131
248
  this.initInMemoryDataUnit();
132
249
  }
133
250
  }
134
251
  observeDataState(newValue, oldValue) {
135
- if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
136
- this.dataStateChange.emit(newValue);
137
- }
252
+ this.handleDataStateChange(newValue, oldValue);
138
253
  }
139
254
  async observeFormLegacy(newValue, oldValue) {
140
255
  await this.handleUpdateFormLegacyConfig(newValue, oldValue);
@@ -142,6 +257,28 @@ const SnkSimpleCrud = class {
142
257
  async observeGridLegacy(newValue, oldValue) {
143
258
  await this.handleUpdateGridLegacyConfig(newValue, oldValue);
144
259
  }
260
+ async handleDataStateChange(newValue, oldValue) {
261
+ if (core.ObjectUtils.objectToString(oldValue) != core.ObjectUtils.objectToString(newValue)) {
262
+ this.dataStateChange.emit(newValue);
263
+ }
264
+ await this.processRmPrecision();
265
+ }
266
+ async processRmPrecision() {
267
+ var _a, _b;
268
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
269
+ for (const field of fieldsWithRmPrecision || []) {
270
+ if (!field) {
271
+ continue;
272
+ }
273
+ const rmPrecision = (_b = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata) === null || _b === void 0 ? void 0 : _b.getProp('rm_precision', field);
274
+ if (!rmPrecision && rmPrecision !== 0) {
275
+ continue;
276
+ }
277
+ await this.setFieldProp(field, 'precision', rmPrecision);
278
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
279
+ }
280
+ this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
281
+ }
145
282
  async handleUpdateGridLegacyConfig(newValue, oldValue) {
146
283
  if (newValue == undefined || newValue == oldValue) {
147
284
  return;
@@ -238,6 +375,7 @@ const SnkSimpleCrud = class {
238
375
  }
239
376
  async componentWillRender() {
240
377
  this._resourceID = await this.application.getResourceID();
378
+ this.dataExporterProviderStore();
241
379
  this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
242
380
  if (this.configName === undefined) {
243
381
  return;
@@ -249,32 +387,70 @@ const SnkSimpleCrud = class {
249
387
  this.loadGridConfig();
250
388
  this.loadFormConfig();
251
389
  }
390
+ componentDidRender() {
391
+ this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
392
+ this.addGridCustomValueFormattters();
393
+ this.setFieldsProps();
394
+ this.setCustomRenders();
395
+ this.setCustomEditors();
396
+ }
252
397
  componentWillLoad() {
253
398
  this.processMetadata();
254
399
  this.onModeChange();
255
400
  this.configDatasource();
401
+ this._rmPrecisionCustomValueFormatter = new IExporterProvider.RmPrecisionCustomValueFormatter();
256
402
  }
257
403
  componentDidLoad() {
258
404
  utils.CSSVarsUtils.applyVarsGrid(this._element, this._grid);
259
405
  }
406
+ setCustomRenders() {
407
+ if (!this._grid) {
408
+ return;
409
+ }
410
+ for (const [fieldName, customRender] of this._customRenders) {
411
+ this._grid.addGridCustomRender(fieldName, customRender);
412
+ this._customRenders.delete(fieldName);
413
+ }
414
+ }
415
+ setCustomEditors() {
416
+ if (!this._grid || !this._form) {
417
+ return;
418
+ }
419
+ for (const [fieldName, customEditor] of this._customEditors) {
420
+ this._grid.addCustomEditor(fieldName, customEditor);
421
+ this._form.addCustomEditor(fieldName, customEditor);
422
+ this._customEditors.delete(fieldName);
423
+ }
424
+ }
260
425
  configDatasource() {
261
426
  this._multiSelectionListDataSource.setApplication(this.application);
262
427
  this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
263
428
  }
429
+ setFieldsProps() {
430
+ if (!this._form) {
431
+ return;
432
+ }
433
+ for (const [fieldName, props] of this._fieldsProps) {
434
+ for (const prop in props) {
435
+ this._form.setFieldProp(fieldName, prop, props[prop]);
436
+ }
437
+ this._fieldsProps.delete(fieldName);
438
+ }
439
+ }
264
440
  getTaskBarId() {
265
- var _a, _b, _c;
441
+ var _a, _b;
266
442
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
267
443
  return "snkSimpleCrudTaskbar.finish_edition";
268
444
  }
269
445
  if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
270
446
  !this.dataState.selectionInfo.isAllRecords() &&
271
- ((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
447
+ this.dataState.selectionInfo.length > 0) {
272
448
  return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
273
449
  }
274
450
  return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
275
451
  }
276
452
  initInMemoryDataUnit() {
277
- this._inMemoryLoader = new pesquisaFetcher.InMemoryLoader(this._metadata);
453
+ this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
278
454
  this.dataUnit = this._inMemoryLoader.dataUnit;
279
455
  this.dataUnitReady.emit(this.dataUnit);
280
456
  }
@@ -313,12 +489,11 @@ const SnkSimpleCrud = class {
313
489
  var _a;
314
490
  (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
315
491
  }
316
- updateConfig() {
492
+ async updateConfig() {
317
493
  if (this._formConfigManager == undefined) {
318
494
  this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
319
495
  }
320
496
  this._formConfigManager.setConfig(this.formConfig);
321
- return;
322
497
  }
323
498
  processMetadata() {
324
499
  const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
@@ -350,11 +525,28 @@ const SnkSimpleCrud = class {
350
525
  };
351
526
  }
352
527
  }
528
+ addGridCustomValueFormattters() {
529
+ var _a, _b, _c;
530
+ const metadataFields = ((_a = this._metadata) === null || _a === void 0 ? void 0 : _a.fields) || ((_c = (_b = this.dataUnit) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.fields);
531
+ if (!metadataFields) {
532
+ return;
533
+ }
534
+ const fieldsWithRmPrecision = [];
535
+ metadataFields.forEach((field) => {
536
+ var _a;
537
+ if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
538
+ fieldsWithRmPrecision.push(field.name);
539
+ }
540
+ });
541
+ fieldsWithRmPrecision.forEach(field => {
542
+ this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
543
+ });
544
+ }
353
545
  onDataStateChange(evt) {
354
546
  this.dataState = Object.assign({}, evt.detail);
355
547
  }
356
548
  getTaskBarDisabledButtons() {
357
- var _a, _b, _c, _d;
549
+ var _a, _b, _c, _d, _e, _f;
358
550
  const disabledButtons = [];
359
551
  if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
360
552
  disabledButtons.push(taskbarElements.TaskbarElement.NEXT);
@@ -365,6 +557,9 @@ const SnkSimpleCrud = class {
365
557
  if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
366
558
  disabledButtons.push(taskbarElements.TaskbarElement.FORM_MODE);
367
559
  }
560
+ if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
561
+ disabledButtons.push(taskbarElements.TaskbarElement.CLONE);
562
+ }
368
563
  return disabledButtons;
369
564
  }
370
565
  handleCancelEdit() {
@@ -457,8 +652,8 @@ const SnkSimpleCrud = class {
457
652
  }
458
653
  getTopTaskBarId() {
459
654
  var _a;
460
- return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index$1.PresentationMode.PRIMARY}` :
461
- `snkGridTopTaskbar.regular${index$1.PresentationMode.PRIMARY}`;
655
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index.PresentationMode.PRIMARY}` :
656
+ `snkGridTopTaskbar.regular${index.PresentationMode.PRIMARY}`;
462
657
  }
463
658
  async keyDownListener(event) {
464
659
  if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
@@ -508,12 +703,26 @@ const SnkSimpleCrud = class {
508
703
  .then(() => {
509
704
  this.setGridConfig(config);
510
705
  this.closeGridConfig();
706
+ this.dataExporterProviderStore();
511
707
  });
512
708
  evt.stopPropagation();
513
709
  }
710
+ async dataExporterProviderStore() {
711
+ if (this.dataUnit == undefined) {
712
+ return;
713
+ }
714
+ if (this._grid == undefined) {
715
+ return;
716
+ }
717
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
718
+ index$2.store.set("exporterProviders", Object.assign(Object.assign({}, index$2.store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
719
+ }
720
+ getDataExporterStoreKey() {
721
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
722
+ }
514
723
  setGridConfig(config) {
515
724
  this.gridConfig = config;
516
- SnkMultiSelectionListDataSource.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
725
+ IExporterProvider.CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
517
726
  }
518
727
  setFormConfig(config, forceUpdate) {
519
728
  if (this.formConfig && !forceUpdate)
@@ -526,6 +735,15 @@ const SnkSimpleCrud = class {
526
735
  closeFormConfig() {
527
736
  this._showFormConfig = false;
528
737
  }
738
+ getPageSize() {
739
+ if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
740
+ return 0;
741
+ }
742
+ if (this.pageSize == undefined) {
743
+ return 150;
744
+ }
745
+ return this.pageSize;
746
+ }
529
747
  //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
530
748
  handleShowFormConfig() {
531
749
  return this._showFormConfig && !this.formLegacyConfigName;
@@ -541,19 +759,28 @@ const SnkSimpleCrud = class {
541
759
  }
542
760
  return configFromManager;
543
761
  }
762
+ updateFormConfig() {
763
+ const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
764
+ this.setFormConfig(newConfig, true);
765
+ if (this._formConfigManager == undefined) {
766
+ this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
767
+ }
768
+ this._formConfigManager.setConfig(this.formConfig);
769
+ }
544
770
  /* istanbul ignore next */
545
771
  render() {
546
772
  var _a;
547
773
  if (this.dataUnit == undefined) {
548
774
  return;
549
775
  }
550
- 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)
776
+ return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, 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, onDataUnitFieldsHidded: this.updateFormConfig.bind(this) }, 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(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
551
777
  ? undefined
552
- : 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: this.getFormConfig(), 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() }))));
778
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, index$1.h("ez-form", { ref: (ref) => this._form = ref, 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() }))));
553
779
  }
554
- get _element() { return index.getElement(this); }
780
+ get _element() { return index$1.getElement(this); }
555
781
  static get watchers() { return {
556
782
  "resourceID": ["handleResourceIDChanged"],
783
+ "entityName": ["onChangeEntityName"],
557
784
  "mode": ["onModeChange"],
558
785
  "dataState": ["observeDataState"],
559
786
  "formLegacyConfigName": ["observeFormLegacy"],
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
8
- const taskbarElements = require('./taskbar-elements-3ecd1278.js');
9
- const index$1 = require('./index-0922807b.js');
8
+ const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
9
+ const index$1 = require('./index-1dfc7a6e.js');
10
10
  require('./index-102ba62d.js');
11
11
 
12
12
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";
@@ -193,8 +193,9 @@ const SnkTaskbar = class {
193
193
  className += "ez-padding-left--medium";
194
194
  }
195
195
  const taskbarElement = taskbarElements.TaskbarElement[def.toString()];
196
+ const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
196
197
  if (taskbarElement) {
197
- return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), this.configName, this.presentationMode);
198
+ return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
198
199
  }
199
200
  else {
200
201
  return taskbarElements.buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
- const index$2 = require('./index-0922807b.js');
4
+ const index$2 = require('./index-1dfc7a6e.js');
5
5
  const index$1 = require('./index-102ba62d.js');
6
6
 
7
7
  exports.TaskbarElement = void 0;
@@ -50,7 +50,7 @@ const buildCustomButton = (def, className, dataElementId, action, isEnabled) =>
50
50
  return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
51
51
  }
52
52
  };
53
- const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, configName, presentationMode) => {
53
+ const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
54
54
  var _a;
55
55
  const title = getTitle(element);
56
56
  switch (element) {
@@ -93,7 +93,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
93
93
  case exports.TaskbarElement.DIVIDER:
94
94
  return index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
95
95
  case exports.TaskbarElement.DATA_EXPORTER:
96
- const provider = (_a = index$1.store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
96
+ const provider = (_a = index$1.store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
97
97
  return index.h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
98
98
  case exports.TaskbarElement.ATTACH:
99
99
  return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "entries": [
3
3
  "./components/snk-filter-bar/filter-item/snk-filter-item.js",
4
- "./components/snk-application/snk-application.js",
5
4
  "./components/snk-data-unit/snk-data-unit.js",
5
+ "./components/snk-application/snk-application.js",
6
6
  "./components/snk-taskbar/snk-taskbar.js",
7
7
  "./components/snk-filter-bar/filter-list/snk-filter-list.js",
8
8
  "./components/snk-print-selector/snk-print-selector.js",
@@ -30,6 +30,7 @@ export class SnkApplication {
30
30
  this._duPromises = new Map();
31
31
  this._requestListener = new RequestListenerLoadingBar();
32
32
  this._pendingActions = new Map;
33
+ this._loadPkParameter = null;
33
34
  this._isLoadedByPk = false;
34
35
  this.messagesBuilder = undefined;
35
36
  this.configName = undefined;
@@ -87,6 +88,12 @@ export class SnkApplication {
87
88
  });
88
89
  }
89
90
  }
91
+ watchPropHandler(newValue, _) {
92
+ if (newValue && this._loadPkParameter) {
93
+ this.loadByPK(this._loadPkParameter.pk, this._loadPkParameter.redirect);
94
+ this._loadPkParameter = null;
95
+ }
96
+ }
90
97
  /**
91
98
  * Obtém o controlador de teclado.
92
99
  *
@@ -361,12 +368,7 @@ export class SnkApplication {
361
368
  if (!waitingDu) {
362
369
  const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, resourceID, parentDataUnit, configName);
363
370
  dataUnit.loadMetadata().then(() => {
364
- if (dataUnitName) {
365
- this.updateDataunitCache(undefined, dataUnitName, dataUnit);
366
- }
367
- while (duPromisses.length > 0) {
368
- duPromisses.pop().resolve(dataUnit);
369
- }
371
+ this.processResolveDataUnit(dataUnit, dataUnitName, duPromisses);
370
372
  }).catch(reason => {
371
373
  while (duPromisses.length > 0) {
372
374
  duPromisses.pop().reject(reason);
@@ -375,6 +377,14 @@ export class SnkApplication {
375
377
  }
376
378
  });
377
379
  }
380
+ processResolveDataUnit(dataUnit, dataUnitName, duPromisses) {
381
+ if (dataUnitName) {
382
+ this.updateDataunitCache(undefined, dataUnitName, dataUnit);
383
+ }
384
+ while (duPromisses.length > 0) {
385
+ duPromisses.pop().resolve(dataUnit);
386
+ }
387
+ }
378
388
  /**
379
389
  * Atualiza o cache de dataunits da aplicação.
380
390
  * @param oldName - Nome do dataunit que está em cache.
@@ -790,15 +800,23 @@ export class SnkApplication {
790
800
  return;
791
801
  const resourceIDfromUrl = this.getResourceIdFromToken();
792
802
  const pkObject = UrlUtils.getPkObjectFromUrlToken(top.window.location.hash);
793
- if (pkObject == undefined || resourceIDfromUrl !== this.applicationResourceID)
803
+ const redirectFrom = window["redirectFrom"];
804
+ if (pkObject === undefined) {
794
805
  return;
806
+ }
807
+ if (!redirectFrom || redirectFrom.split("_")[0].indexOf(resourceIDfromUrl.split("_")[0]) === -1) {
808
+ if (resourceIDfromUrl !== this.applicationResourceID) {
809
+ return;
810
+ }
811
+ }
795
812
  const pkParam = { pk: pkObject };
796
813
  this._isLoadedByPk = true;
797
814
  if (this.loadByPK) {
798
- this.loadByPK(pkParam);
815
+ this.loadByPK(pkParam, redirectFrom);
799
816
  this._currentPkParameter = pkHash;
800
817
  return;
801
818
  }
819
+ this._loadPkParameter = { pk: pkParam, redirect: redirectFrom };
802
820
  this.defaultLoadByPK(pkParam, pkHash);
803
821
  }
804
822
  getResourceIdFromToken() {
@@ -1077,10 +1095,10 @@ export class SnkApplication {
1077
1095
  "type": "unknown",
1078
1096
  "mutable": false,
1079
1097
  "complexType": {
1080
- "original": "(objPK :{pk: Record<string, any>}) => void",
1081
- "resolved": "(objPK: { pk: Record<string, any>; }) => void",
1098
+ "original": "LoadByPkHandler",
1099
+ "resolved": "(objPK: { pk: Record<string, any>; }, redirectFrom?: string) => void",
1082
1100
  "references": {
1083
- "Record": {
1101
+ "LoadByPkHandler": {
1084
1102
  "location": "global"
1085
1103
  }
1086
1104
  }
@@ -2488,6 +2506,12 @@ export class SnkApplication {
2488
2506
  };
2489
2507
  }
2490
2508
  static get elementRef() { return "_element"; }
2509
+ static get watchers() {
2510
+ return [{
2511
+ "propName": "loadByPK",
2512
+ "methodName": "watchPropHandler"
2513
+ }];
2514
+ }
2491
2515
  }
2492
2516
  class RequestListenerLoadingBar {
2493
2517
  constructor() {