@sankhyalabs/sankhyablocks 8.15.3 → 8.16.0-dev.10

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 (234) hide show
  1. package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-a343e418.js} +1 -0
  2. package/dist/cjs/{SnkMultiSelectionListDataSource-3c08d25c.js → IExporterProvider-597949f9.js} +94 -4
  3. package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
  4. package/dist/cjs/{SnkFormConfigManager-f9dc0d28.js → SnkFormConfigManager-166cbd1f.js} +8 -7
  5. package/dist/cjs/{SnkMessageBuilder-66aa2557.js → SnkMessageBuilder-897ffd08.js} +9 -13
  6. package/dist/cjs/{pesquisa-fetcher-562d281f.js → dataunit-fetcher-688d3f05.js} +87 -180
  7. package/dist/cjs/{index-0922807b.js → index-1dfc7a6e.js} +5 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/pesquisa-fetcher-680e198f.js +166 -0
  10. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  11. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -3
  12. package/dist/cjs/snk-application.cjs.entry.js +35 -12
  13. package/dist/cjs/snk-attach.cjs.entry.js +71 -46
  14. package/dist/cjs/snk-crud.cjs.entry.js +101 -10
  15. package/dist/cjs/snk-data-exporter.cjs.entry.js +315 -85
  16. package/dist/cjs/snk-data-unit-8fa7917a.js +689 -0
  17. package/dist/cjs/snk-data-unit.cjs.entry.js +12 -2
  18. package/dist/cjs/snk-detail-view.cjs.entry.js +50 -10
  19. package/dist/cjs/snk-filter-bar.cjs.entry.js +6 -2
  20. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-form-view.cjs.entry.js +67 -0
  23. package/dist/cjs/snk-form.cjs.entry.js +52 -7
  24. package/dist/cjs/snk-grid.cjs.entry.js +165 -108
  25. package/dist/cjs/{snk-guides-viewer-bb6087cd.js → snk-guides-viewer-9c682034.js} +43 -10
  26. package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -7
  27. package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
  28. package/dist/cjs/snk-simple-crud.cjs.entry.js +268 -40
  29. package/dist/cjs/snk-taskbar.cjs.entry.js +4 -3
  30. package/dist/cjs/{taskbar-elements-3ecd1278.js → taskbar-elements-9ad1f9c0.js} +3 -3
  31. package/dist/collection/collection-manifest.json +1 -1
  32. package/dist/collection/components/snk-application/snk-application.js +35 -11
  33. package/dist/collection/components/snk-attach/snk-attach.js +67 -44
  34. package/dist/collection/components/snk-crud/interfaces/PropsCustomEditor.js +1 -0
  35. package/dist/collection/components/snk-crud/interfaces/PropsCustomRender.js +1 -0
  36. package/dist/collection/components/snk-crud/snk-crud.js +305 -7
  37. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +136 -2
  38. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +161 -0
  39. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +134 -7
  40. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +97 -0
  41. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +74 -0
  42. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +54 -1
  43. package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
  44. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +58 -0
  45. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
  46. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +59 -52
  47. package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +62 -0
  48. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
  49. package/dist/collection/components/snk-data-exporter/utils/ParserExport.js +20 -0
  50. package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
  51. package/dist/collection/components/snk-data-unit/snk-data-unit.js +538 -218
  52. package/dist/collection/components/snk-data-unit/test/resources/metadataMock.js +24 -0
  53. package/dist/collection/components/snk-data-unit/test/resources/parentMetadataMock.js +18 -0
  54. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +22 -1
  55. package/dist/collection/components/snk-form/snk-form.js +102 -5
  56. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +7 -6
  57. package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
  58. package/dist/collection/components/snk-grid/snk-grid.js +240 -101
  59. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +406 -20
  60. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +2 -2
  61. package/dist/collection/components/snk-taskbar/snk-taskbar.js +2 -1
  62. package/dist/collection/lib/@types/index.js +5 -0
  63. package/dist/collection/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.js +35 -0
  64. package/dist/collection/lib/configs/ConfigStorage.js +1 -0
  65. package/dist/collection/lib/dataUnit/InMemoryLoader.js +7 -3
  66. package/dist/collection/lib/dataUnit/ValueFormatter.js +4 -0
  67. package/dist/collection/lib/dataUnit/interfaces/InMemoryLoaderConfig.js +1 -0
  68. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
  69. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
  70. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
  71. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +1 -0
  72. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.js +1 -0
  73. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.js +1 -0
  74. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +53 -4
  75. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.js +22 -0
  76. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -4
  77. package/dist/collection/lib/message/SnkMessageBuilder.js +5 -12
  78. package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -0
  79. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +2 -1
  80. package/dist/components/ConfigStorage.js +1 -0
  81. package/dist/components/{field-search.js → IExporterProvider.js} +93 -6
  82. package/dist/components/ISave.js +47 -0
  83. package/dist/components/SnkFormConfigManager.js +7 -6
  84. package/dist/components/SnkMessageBuilder.js +9 -13
  85. package/dist/components/dataunit-fetcher.js +84 -182
  86. package/dist/components/index2.js +198 -33
  87. package/dist/components/pesquisa-fetcher.js +164 -0
  88. package/dist/components/snk-actions-button2.js +4 -11
  89. package/dist/components/snk-application2.js +31 -9
  90. package/dist/components/snk-attach2.js +65 -41
  91. package/dist/components/snk-crud.js +110 -11
  92. package/dist/components/snk-data-exporter2.js +309 -85
  93. package/dist/components/snk-data-unit2.js +485 -216
  94. package/dist/components/snk-detail-view2.js +96 -14
  95. package/dist/components/snk-expression-item2.js +1 -1
  96. package/dist/components/snk-filter-bar2.js +6 -1
  97. package/dist/components/snk-form-config2.js +1 -1
  98. package/dist/components/snk-form-view2.js +72 -1
  99. package/dist/components/snk-form.js +53 -6
  100. package/dist/components/snk-grid2.js +168 -106
  101. package/dist/components/snk-personalized-filter2.js +1 -1
  102. package/dist/components/snk-simple-crud2.js +263 -25
  103. package/dist/components/snk-taskbar2.js +6 -5
  104. package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-3806514e.js} +1 -0
  105. package/dist/esm/{SnkMultiSelectionListDataSource-6a879955.js → IExporterProvider-63a188b6.js} +93 -5
  106. package/dist/esm/RecordIDUtils-87d02110.js +41 -0
  107. package/dist/esm/{SnkFormConfigManager-f53f9f87.js → SnkFormConfigManager-31b24066.js} +8 -7
  108. package/dist/esm/{SnkMessageBuilder-0a4becdd.js → SnkMessageBuilder-571462fb.js} +9 -13
  109. package/dist/esm/{pesquisa-fetcher-c7ce8ee7.js → dataunit-fetcher-264191b2.js} +83 -181
  110. package/dist/esm/{index-0ece87a6.js → index-3aa4977a.js} +6 -1
  111. package/dist/esm/loader.js +1 -1
  112. package/dist/esm/pesquisa-fetcher-03c8f919.js +164 -0
  113. package/dist/esm/sankhyablocks.js +1 -1
  114. package/dist/esm/snk-actions-button_4.entry.js +5 -3
  115. package/dist/esm/snk-application.entry.js +34 -11
  116. package/dist/esm/snk-attach.entry.js +66 -41
  117. package/dist/esm/snk-crud.entry.js +101 -10
  118. package/dist/esm/snk-data-exporter.entry.js +316 -86
  119. package/dist/esm/snk-data-unit-f5cbe64b.js +687 -0
  120. package/dist/esm/snk-data-unit.entry.js +12 -2
  121. package/dist/esm/snk-detail-view.entry.js +50 -10
  122. package/dist/esm/snk-filter-bar.entry.js +6 -2
  123. package/dist/esm/snk-filter-modal-item.entry.js +1 -1
  124. package/dist/esm/snk-form-config.entry.js +1 -1
  125. package/dist/esm/snk-form-view.entry.js +67 -0
  126. package/dist/esm/snk-form.entry.js +52 -7
  127. package/dist/esm/snk-grid.entry.js +163 -106
  128. package/dist/esm/{snk-guides-viewer-1d95ebf2.js → snk-guides-viewer-8f6960a2.js} +43 -10
  129. package/dist/esm/snk-guides-viewer.entry.js +9 -7
  130. package/dist/esm/snk-personalized-filter.entry.js +1 -1
  131. package/dist/esm/snk-simple-crud.entry.js +256 -28
  132. package/dist/esm/snk-taskbar.entry.js +4 -3
  133. package/dist/esm/{taskbar-elements-2473c8ac.js → taskbar-elements-d59867f1.js} +3 -3
  134. package/dist/sankhyablocks/p-17def7cd.js +1 -0
  135. package/dist/sankhyablocks/p-1db45d26.entry.js +1 -0
  136. package/dist/sankhyablocks/p-28ee0972.js +1 -0
  137. package/dist/sankhyablocks/p-2a408684.js +1 -0
  138. package/dist/sankhyablocks/{p-eae7a817.entry.js → p-2c68b3ae.entry.js} +1 -1
  139. package/dist/sankhyablocks/p-30cf616e.js +1 -0
  140. package/dist/sankhyablocks/p-3a212712.js +1 -0
  141. package/dist/sankhyablocks/p-450c60e4.entry.js +1 -0
  142. package/dist/sankhyablocks/{p-a1d72395.entry.js → p-47db7e88.entry.js} +1 -1
  143. package/dist/sankhyablocks/p-4e5e1313.entry.js +1 -0
  144. package/dist/sankhyablocks/{p-aff76a53.js → p-52920496.js} +1 -1
  145. package/dist/sankhyablocks/p-62ba211a.entry.js +1 -0
  146. package/dist/sankhyablocks/p-6bb2f3e9.entry.js +1 -0
  147. package/dist/sankhyablocks/p-7505da04.entry.js +1 -0
  148. package/dist/sankhyablocks/p-7619bdb1.entry.js +11 -0
  149. package/dist/sankhyablocks/p-7a85fd49.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-ae4fc9a9.js → p-7e7a7473.js} +1 -1
  151. package/dist/sankhyablocks/p-7ef9c55c.js +1 -0
  152. package/dist/sankhyablocks/p-80042dc6.entry.js +1 -0
  153. package/dist/sankhyablocks/p-8c59edd7.entry.js +1 -0
  154. package/dist/sankhyablocks/p-9606509c.entry.js +1 -0
  155. package/dist/sankhyablocks/p-9863d682.js +1 -0
  156. package/dist/sankhyablocks/p-ae93d46a.entry.js +1 -0
  157. package/dist/sankhyablocks/p-af8efd95.js +6 -0
  158. package/dist/sankhyablocks/p-d6e26ea8.entry.js +1 -0
  159. package/dist/sankhyablocks/p-f2809746.entry.js +1 -0
  160. package/dist/sankhyablocks/p-f4450320.entry.js +1 -0
  161. package/dist/sankhyablocks/p-fe79f83a.js +60 -0
  162. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  163. package/dist/types/components/snk-application/snk-application.d.ts +7 -3
  164. package/dist/types/components/snk-attach/snk-attach.d.ts +11 -9
  165. package/dist/types/components/snk-crud/interfaces/PropsCustomEditor.d.ts +4 -0
  166. package/dist/types/components/snk-crud/interfaces/PropsCustomRender.d.ts +4 -0
  167. package/dist/types/components/snk-crud/snk-crud.d.ts +45 -1
  168. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +23 -0
  169. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +28 -3
  170. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +24 -0
  171. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +14 -0
  172. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +12 -0
  173. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +24 -4
  174. package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
  175. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
  176. package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
  177. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +4 -1
  178. package/dist/types/components/snk-data-exporter/structure/ItemBuilder.d.ts +21 -0
  179. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
  180. package/dist/types/components/snk-data-exporter/utils/ParserExport.d.ts +4 -0
  181. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  182. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +66 -2
  183. package/dist/types/components/snk-data-unit/test/resources/metadataMock.d.ts +3 -0
  184. package/dist/types/components/snk-data-unit/test/resources/parentMetadataMock.d.ts +3 -0
  185. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
  186. package/dist/types/components/snk-form/snk-form.d.ts +14 -0
  187. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
  188. package/dist/types/components/snk-grid/snk-grid.d.ts +46 -6
  189. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +62 -4
  190. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
  191. package/dist/types/components.d.ts +261 -4
  192. package/dist/types/lib/@types/index.d.ts +5 -0
  193. package/dist/types/lib/DefaultCustomFormatters/RmPrecisionCustomValueFormatter.d.ts +11 -0
  194. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +2 -1
  195. package/dist/types/lib/dataUnit/ValueFormatter.d.ts +2 -0
  196. package/dist/types/lib/dataUnit/interfaces/InMemoryLoaderConfig.d.ts +3 -0
  197. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
  198. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
  199. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  200. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IBuildRequestBodyLoadRowMetadata.d.ts +10 -0
  201. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/interfaces/IRowMetadata.d.ts +7 -0
  202. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +6 -0
  203. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/test/resources/metadataMock.d.ts +20 -0
  204. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +3 -0
  205. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IFetchDataExporterParams.d.ts +2 -1
  206. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +1 -0
  207. package/package.json +1 -1
  208. package/dist/cjs/snk-data-unit-41c29713.js +0 -462
  209. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
  210. package/dist/components/index3.js +0 -199
  211. package/dist/esm/snk-data-unit-de1d140d.js +0 -460
  212. package/dist/sankhyablocks/p-032fe52e.js +0 -1
  213. package/dist/sankhyablocks/p-03dcc5ff.entry.js +0 -1
  214. package/dist/sankhyablocks/p-0594db5a.entry.js +0 -1
  215. package/dist/sankhyablocks/p-06e13db2.js +0 -1
  216. package/dist/sankhyablocks/p-07a61550.entry.js +0 -1
  217. package/dist/sankhyablocks/p-1403a4b6.entry.js +0 -1
  218. package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
  219. package/dist/sankhyablocks/p-15802c59.entry.js +0 -1
  220. package/dist/sankhyablocks/p-235dc7b1.js +0 -65
  221. package/dist/sankhyablocks/p-32556aa6.js +0 -1
  222. package/dist/sankhyablocks/p-38289a55.js +0 -1
  223. package/dist/sankhyablocks/p-3c632d48.js +0 -1
  224. package/dist/sankhyablocks/p-3f833983.entry.js +0 -1
  225. package/dist/sankhyablocks/p-52c8e589.js +0 -1
  226. package/dist/sankhyablocks/p-5e1502b6.entry.js +0 -11
  227. package/dist/sankhyablocks/p-74d349c3.entry.js +0 -1
  228. package/dist/sankhyablocks/p-93167e28.entry.js +0 -1
  229. package/dist/sankhyablocks/p-add17f6a.entry.js +0 -1
  230. package/dist/sankhyablocks/p-bd47dd16.entry.js +0 -1
  231. package/dist/sankhyablocks/p-c1f88236.entry.js +0 -1
  232. package/dist/sankhyablocks/p-ccdd5332.entry.js +0 -1
  233. package/dist/sankhyablocks/p-ee9536bc.entry.js +0 -1
  234. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
@@ -1,23 +1,25 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { StringUtils, ApplicationContext, ObjectUtils, DataType, UserInterface, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
4
  import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
5
5
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
6
6
  import './DataFetcher.js';
7
- import { I as InMemoryLoader } from './dataunit-fetcher.js';
8
- import { S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, b as buildFieldSearch, o as openFieldSearch, C as CrudUtils } from './field-search.js';
9
- import { P as PresentationMode } from './index2.js';
10
- import { d as defineCustomElement$d } from './snk-actions-button2.js';
7
+ import './pesquisa-fetcher.js';
8
+ import { C as CommonsExporter, S as SnkMultiSelectionListDataSource, T as TaskbarProcessor, R as RmPrecisionCustomValueFormatter, b as buildFieldSearch, o as openFieldSearch, a as CrudUtils } from './IExporterProvider.js';
9
+ import { D as DataExporterOption, P as PresentationMode } from './ISave.js';
11
10
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
11
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
12
+ import { I as InMemoryLoader } from './dataunit-fetcher.js';
13
13
  import './filter-item-type.enum.js';
14
14
  import { F as FormConfigFetcher } from './form-config-fetcher.js';
15
15
  import { C as ConfigStorage } from './ConfigStorage.js';
16
16
  import { S as SnkFormConfigManager } from './SnkFormConfigManager.js';
17
+ import { g as getSelectedIDs, d as defineCustomElement$9 } from './snk-data-unit2.js';
18
+ import { s as store } from './index2.js';
19
+ import { d as defineCustomElement$d } from './snk-actions-button2.js';
17
20
  import { d as defineCustomElement$c } from './snk-config-options2.js';
18
21
  import { d as defineCustomElement$b } from './snk-configurator2.js';
19
22
  import { d as defineCustomElement$a } from './snk-data-exporter2.js';
20
- import { d as defineCustomElement$9 } from './snk-data-unit2.js';
21
23
  import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
22
24
  import { d as defineCustomElement$7 } from './snk-field-config2.js';
23
25
  import { d as defineCustomElement$6 } from './snk-form-config2.js';
@@ -29,6 +31,61 @@ import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
29
31
  const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
30
32
  const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
31
33
 
34
+ class ClientSideExporterProvider extends 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 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
+ DataExporterOption.EXPORT_BY_EMAIL,
61
+ DataExporterOption.EXPORT_PDF_TO_EMAIL,
62
+ DataExporterOption.EXPORT_XLS_TO_EMAIL,
63
+ DataExporterOption.EXPORT_PAGE_TO_PDF,
64
+ 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 === 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
+
32
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}";
33
90
 
34
91
  const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -44,11 +101,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
44
101
  this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
45
102
  this._keyDownHandler = (event) => this.keyDownListener(event);
46
103
  this._formConfigFetcher = new FormConfigFetcher();
104
+ this._customEditors = new Map();
105
+ this._customRenders = new Map();
47
106
  this._taskbarProcessor = new TaskbarProcessor({
48
- "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, TaskbarElement.GRID_MODE),
49
- "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, TaskbarElement.FORM_MODE),
50
- "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, TaskbarElement.GRID_MODE),
51
- "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, TaskbarElement.FORM_MODE),
107
+ "snkSimpleCrudTaskbar.form_regular": this.getButtons(false, [TaskbarElement.GRID_MODE]),
108
+ "snkSimpleCrudTaskbar.grid_regular": this.getButtons(false, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
109
+ "snkSimpleCrudTaskbar.form_selected": this.getButtons(true, [TaskbarElement.GRID_MODE]),
110
+ "snkSimpleCrudTaskbar.grid_selected": this.getButtons(true, [TaskbarElement.DATA_EXPORTER, TaskbarElement.FORM_MODE]),
52
111
  "snkSimpleCrudTaskbar.finish_edition": ["CANCEL", "SAVE"]
53
112
  });
54
113
  this._showPopUpGridConfig = false;
@@ -59,12 +118,15 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
59
118
  this._customContainerId = `SNK-SIMPLE-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
60
119
  this.dataState = undefined;
61
120
  this.dataUnit = undefined;
121
+ this.entityName = undefined;
62
122
  this.mode = SIMPLE_CRUD_MODE.SERVER;
63
123
  this.gridConfig = undefined;
64
124
  this.formConfig = undefined;
65
125
  this._formFields = [];
126
+ this._fieldsProps = new Map();
66
127
  this.multipleSelection = undefined;
67
128
  this.useCancelConfirm = true;
129
+ this.pageSize = 150;
68
130
  this.resourceID = undefined;
69
131
  this.taskbarManager = undefined;
70
132
  this.messagesBuilder = undefined;
@@ -75,6 +137,34 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
75
137
  this.gridLegacyConfigName = undefined;
76
138
  this.formLegacyConfigName = undefined;
77
139
  this.ignoreReadOnlyFormFields = false;
140
+ this.autoFocus = true;
141
+ this.domainMessagesBuilder = undefined;
142
+ this.autoLoad = undefined;
143
+ }
144
+ /**
145
+ * Registra um editor customizado para campos da grade e formulário.
146
+ */
147
+ async addCustomEditor(fieldName, customEditor) {
148
+ if (this._grid && this._form) {
149
+ this._grid.addCustomEditor(fieldName, customEditor);
150
+ this._form.addCustomEditor(fieldName, customEditor);
151
+ return;
152
+ }
153
+ const newCustomEditors = new Map(this._customEditors);
154
+ newCustomEditors.set(fieldName, customEditor);
155
+ this._customEditors = newCustomEditors;
156
+ }
157
+ /**
158
+ * Registra um render customizado para colunas da grid.
159
+ */
160
+ async addGridCustomRender(fieldName, customRender) {
161
+ if (this._grid) {
162
+ this._grid.addGridCustomRender(fieldName, customRender);
163
+ return;
164
+ }
165
+ const newCustomRenders = new Map(this._customRenders);
166
+ newCustomRenders.set(fieldName, customRender);
167
+ this._customRenders = newCustomRenders;
78
168
  }
79
169
  handleResourceIDChanged(newValue, oldValue) {
80
170
  if (StringUtils.isEmpty(newValue)) {
@@ -86,9 +176,30 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
86
176
  this.loadFormConfig(true);
87
177
  this.loadGridConfig(true);
88
178
  }
89
- getButtons(selected, changeModeBtn) {
179
+ /**
180
+ * Registra um formatador de valores para uma coluna da grid.
181
+ */
182
+ async addCustomValueFormatter(columnName, customFormatter) {
183
+ this._grid.addCustomValueFormatter(columnName, customFormatter);
184
+ }
185
+ /**
186
+ * Remove o formatador de valores de uma coluna da grid.
187
+ */
188
+ async removeCustomValueFormatter(columnName) {
189
+ this._grid.removeCustomValueFormatter(columnName);
190
+ }
191
+ /**
192
+ * Altera/adiciona uma propriedade nos metadados do campo.
193
+ */
194
+ async setFieldProp(fieldName, propName, value) {
195
+ const newCustomFieldProps = new Map(this._fieldsProps);
196
+ const currentProps = this._fieldsProps.get(fieldName);
197
+ newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
198
+ this._fieldsProps = newCustomFieldProps;
199
+ }
200
+ getButtons(selected, extraButtons) {
90
201
  return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
91
- .concat(changeModeBtn));
202
+ .concat(extraButtons));
92
203
  }
93
204
  addConfigButton(buttons) {
94
205
  if (this.configName === undefined) {
@@ -128,15 +239,19 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
128
239
  }
129
240
  evt.stopPropagation();
130
241
  }
242
+ async onChangeEntityName(newValue) {
243
+ if (this.dataUnit)
244
+ return;
245
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
246
+ this.dataUnit = await application.getDataUnit(newValue, null, null, this.configName);
247
+ }
131
248
  onModeChange() {
132
249
  if (this.mode == SIMPLE_CRUD_MODE.IN_MEMORY) {
133
250
  this.initInMemoryDataUnit();
134
251
  }
135
252
  }
136
253
  observeDataState(newValue, oldValue) {
137
- if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
138
- this.dataStateChange.emit(newValue);
139
- }
254
+ this.handleDataStateChange(newValue, oldValue);
140
255
  }
141
256
  async observeFormLegacy(newValue, oldValue) {
142
257
  await this.handleUpdateFormLegacyConfig(newValue, oldValue);
@@ -144,6 +259,28 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
144
259
  async observeGridLegacy(newValue, oldValue) {
145
260
  await this.handleUpdateGridLegacyConfig(newValue, oldValue);
146
261
  }
262
+ async handleDataStateChange(newValue, oldValue) {
263
+ if (ObjectUtils.objectToString(oldValue) != ObjectUtils.objectToString(newValue)) {
264
+ this.dataStateChange.emit(newValue);
265
+ }
266
+ await this.processRmPrecision();
267
+ }
268
+ async processRmPrecision() {
269
+ var _a, _b;
270
+ const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
271
+ for (const field of fieldsWithRmPrecision || []) {
272
+ if (!field) {
273
+ continue;
274
+ }
275
+ 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);
276
+ if (!rmPrecision && rmPrecision !== 0) {
277
+ continue;
278
+ }
279
+ await this.setFieldProp(field, 'precision', rmPrecision);
280
+ await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
281
+ }
282
+ this._rmPrecisionCustomValueFormatter.setDataState(this.dataState);
283
+ }
147
284
  async handleUpdateGridLegacyConfig(newValue, oldValue) {
148
285
  if (newValue == undefined || newValue == oldValue) {
149
286
  return;
@@ -240,6 +377,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
240
377
  }
241
378
  async componentWillRender() {
242
379
  this._resourceID = await this.application.getResourceID();
380
+ this.dataExporterProviderStore();
243
381
  this._taskbarProcessor.process(this.getTaskBarId(), this.taskbarManager, this.dataState, this.getTaskBarDisabledButtons());
244
382
  if (this.configName === undefined) {
245
383
  return;
@@ -251,32 +389,70 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
251
389
  this.loadGridConfig();
252
390
  this.loadFormConfig();
253
391
  }
392
+ componentDidRender() {
393
+ this._rmPrecisionCustomValueFormatter.setGrid(this._grid);
394
+ this.addGridCustomValueFormattters();
395
+ this.setFieldsProps();
396
+ this.setCustomRenders();
397
+ this.setCustomEditors();
398
+ }
254
399
  componentWillLoad() {
255
400
  this.processMetadata();
256
401
  this.onModeChange();
257
402
  this.configDatasource();
403
+ this._rmPrecisionCustomValueFormatter = new RmPrecisionCustomValueFormatter();
258
404
  }
259
405
  componentDidLoad() {
260
406
  CSSVarsUtils.applyVarsGrid(this._element, this._grid);
261
407
  }
408
+ setCustomRenders() {
409
+ if (!this._grid) {
410
+ return;
411
+ }
412
+ for (const [fieldName, customRender] of this._customRenders) {
413
+ this._grid.addGridCustomRender(fieldName, customRender);
414
+ this._customRenders.delete(fieldName);
415
+ }
416
+ }
417
+ setCustomEditors() {
418
+ if (!this._grid || !this._form) {
419
+ return;
420
+ }
421
+ for (const [fieldName, customEditor] of this._customEditors) {
422
+ this._grid.addCustomEditor(fieldName, customEditor);
423
+ this._form.addCustomEditor(fieldName, customEditor);
424
+ this._customEditors.delete(fieldName);
425
+ }
426
+ }
262
427
  configDatasource() {
263
428
  this._multiSelectionListDataSource.setApplication(this.application);
264
429
  this._multiSelectionListDataSource.setDataUnit(this.dataUnit);
265
430
  }
431
+ setFieldsProps() {
432
+ if (!this._form) {
433
+ return;
434
+ }
435
+ for (const [fieldName, props] of this._fieldsProps) {
436
+ for (const prop in props) {
437
+ this._form.setFieldProp(fieldName, prop, props[prop]);
438
+ }
439
+ this._fieldsProps.delete(fieldName);
440
+ }
441
+ }
266
442
  getTaskBarId() {
267
- var _a, _b, _c;
443
+ var _a, _b;
268
444
  if ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) {
269
445
  return "snkSimpleCrudTaskbar.finish_edition";
270
446
  }
271
447
  if (((_b = this.dataState) === null || _b === void 0 ? void 0 : _b.selectionInfo) &&
272
448
  !this.dataState.selectionInfo.isAllRecords() &&
273
- ((_c = this.dataState.selectionInfo.records) === null || _c === void 0 ? void 0 : _c.length) > 0) {
449
+ this.dataState.selectionInfo.length > 0) {
274
450
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_selected" : "snkSimpleCrudTaskbar.form_selected";
275
451
  }
276
452
  return this._currentViewMode === VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
277
453
  }
278
454
  initInMemoryDataUnit() {
279
- this._inMemoryLoader = new InMemoryLoader(this._metadata);
455
+ this._inMemoryLoader = new InMemoryLoader(this._metadata, undefined, { autoLoad: this.autoLoad });
280
456
  this.dataUnit = this._inMemoryLoader.dataUnit;
281
457
  this.dataUnitReady.emit(this.dataUnit);
282
458
  }
@@ -315,12 +491,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
315
491
  var _a;
316
492
  (_a = this._snkConfigurator) === null || _a === void 0 ? void 0 : _a.close();
317
493
  }
318
- updateConfig() {
494
+ async updateConfig() {
319
495
  if (this._formConfigManager == undefined) {
320
496
  this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
321
497
  }
322
498
  this._formConfigManager.setConfig(this.formConfig);
323
- return;
324
499
  }
325
500
  processMetadata() {
326
501
  const fieldsMetadataElem = this._element.querySelectorAll("snk-field-metadata");
@@ -352,11 +527,28 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
352
527
  };
353
528
  }
354
529
  }
530
+ addGridCustomValueFormattters() {
531
+ var _a, _b, _c;
532
+ 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);
533
+ if (!metadataFields) {
534
+ return;
535
+ }
536
+ const fieldsWithRmPrecision = [];
537
+ metadataFields.forEach((field) => {
538
+ var _a;
539
+ if (((_a = field.properties) === null || _a === void 0 ? void 0 : _a.rm_precision) && !fieldsWithRmPrecision.includes(field.name)) {
540
+ fieldsWithRmPrecision.push(field.name);
541
+ }
542
+ });
543
+ fieldsWithRmPrecision.forEach(field => {
544
+ this.addCustomValueFormatter(field, this._rmPrecisionCustomValueFormatter);
545
+ });
546
+ }
355
547
  onDataStateChange(evt) {
356
548
  this.dataState = Object.assign({}, evt.detail);
357
549
  }
358
550
  getTaskBarDisabledButtons() {
359
- var _a, _b, _c, _d;
551
+ var _a, _b, _c, _d, _e, _f;
360
552
  const disabledButtons = [];
361
553
  if (!((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.hasNext)) {
362
554
  disabledButtons.push(TaskbarElement.NEXT);
@@ -367,6 +559,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
367
559
  if ((_d = (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.selectionInfo) === null || _d === void 0 ? void 0 : _d.isEmpty()) {
368
560
  disabledButtons.push(TaskbarElement.FORM_MODE);
369
561
  }
562
+ if (((_f = (_e = this.dataState) === null || _e === void 0 ? void 0 : _e.selectionInfo) === null || _f === void 0 ? void 0 : _f.length) > 1) {
563
+ disabledButtons.push(TaskbarElement.CLONE);
564
+ }
370
565
  return disabledButtons;
371
566
  }
372
567
  handleCancelEdit() {
@@ -510,9 +705,23 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
510
705
  .then(() => {
511
706
  this.setGridConfig(config);
512
707
  this.closeGridConfig();
708
+ this.dataExporterProviderStore();
513
709
  });
514
710
  evt.stopPropagation();
515
711
  }
712
+ async dataExporterProviderStore() {
713
+ if (this.dataUnit == undefined) {
714
+ return;
715
+ }
716
+ if (this._grid == undefined) {
717
+ return;
718
+ }
719
+ const dataExporterProvider = new ClientSideExporterProvider(this.dataUnit, this._grid);
720
+ store.set("exporterProviders", Object.assign(Object.assign({}, store.get("exporterProviders")), { [this.getDataExporterStoreKey()]: dataExporterProvider }));
721
+ }
722
+ getDataExporterStoreKey() {
723
+ return `SnkSimpleCrudDataExporter:${this.configName == undefined ? this.dataUnit.name : this.configName}`;
724
+ }
516
725
  setGridConfig(config) {
517
726
  this.gridConfig = config;
518
727
  CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
@@ -528,6 +737,15 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
528
737
  closeFormConfig() {
529
738
  this._showFormConfig = false;
530
739
  }
740
+ getPageSize() {
741
+ if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
742
+ return 0;
743
+ }
744
+ if (this.pageSize == undefined) {
745
+ return 150;
746
+ }
747
+ return this.pageSize;
748
+ }
531
749
  //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
532
750
  handleShowFormConfig() {
533
751
  return this._showFormConfig && !this.formLegacyConfigName;
@@ -536,26 +754,35 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
536
754
  return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
537
755
  }
538
756
  getFormConfig() {
539
- var _a, _b;
540
- 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);
757
+ var _a;
758
+ const configFromManager = (_a = this._formConfigManager) === null || _a === void 0 ? void 0 : _a.getConfig(this.dataUnit, this.ignoreReadOnlyFormFields);
541
759
  if (!this.configName && !configFromManager) {
542
760
  return this.formConfig;
543
761
  }
544
762
  return configFromManager;
545
763
  }
764
+ updateFormConfig() {
765
+ const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
766
+ this.setFormConfig(newConfig, true);
767
+ if (this._formConfigManager == undefined) {
768
+ this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
769
+ }
770
+ this._formConfigManager.setConfig(this.formConfig);
771
+ }
546
772
  /* istanbul ignore next */
547
773
  render() {
548
774
  var _a;
549
775
  if (this.dataUnit == undefined) {
550
776
  return;
551
777
  }
552
- return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
778
+ return (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(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
553
779
  ? undefined
554
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
780
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, 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() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
555
781
  }
556
782
  get _element() { return this; }
557
783
  static get watchers() { return {
558
784
  "resourceID": ["handleResourceIDChanged"],
785
+ "entityName": ["onChangeEntityName"],
559
786
  "mode": ["onModeChange"],
560
787
  "dataState": ["observeDataState"],
561
788
  "formLegacyConfigName": ["observeFormLegacy"],
@@ -565,11 +792,13 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
565
792
  }, [6, "snk-simple-crud", {
566
793
  "dataState": [16],
567
794
  "dataUnit": [16],
795
+ "entityName": [1, "entity-name"],
568
796
  "mode": [2],
569
797
  "gridConfig": [1040],
570
798
  "formConfig": [1040],
571
799
  "multipleSelection": [4, "multiple-selection"],
572
800
  "useCancelConfirm": [4, "use-cancel-confirm"],
801
+ "pageSize": [2, "page-size"],
573
802
  "resourceID": [1, "resource-i-d"],
574
803
  "taskbarManager": [16],
575
804
  "messagesBuilder": [1040],
@@ -580,6 +809,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
580
809
  "gridLegacyConfigName": [1, "grid-legacy-config-name"],
581
810
  "formLegacyConfigName": [1, "form-legacy-config-name"],
582
811
  "ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
812
+ "autoFocus": [4, "auto-focus"],
813
+ "domainMessagesBuilder": [1, "domain-messages-builder"],
814
+ "autoLoad": [4, "auto-load"],
583
815
  "_showPopUpGridConfig": [32],
584
816
  "_showFormConfig": [32],
585
817
  "_currentViewMode": [32],
@@ -587,6 +819,12 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
587
819
  "_fieldToGetFocus": [32],
588
820
  "_customContainerId": [32],
589
821
  "_formFields": [32],
822
+ "_fieldsProps": [32],
823
+ "addCustomEditor": [64],
824
+ "addGridCustomRender": [64],
825
+ "addCustomValueFormatter": [64],
826
+ "removeCustomValueFormatter": [64],
827
+ "setFieldProp": [64],
590
828
  "goToView": [64],
591
829
  "setMetadata": [64],
592
830
  "setRecords": [64],
@@ -1,8 +1,8 @@
1
1
  import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
2
2
  import { Action, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { A as AuthorizationConfig } from './AuthorizationConfig.js';
4
- import { P as PresentationMode } from './index2.js';
5
- import { s as store } from './index3.js';
4
+ import { P as PresentationMode } from './ISave.js';
5
+ import { s as store } from './index2.js';
6
6
  import { d as defineCustomElement$4 } from './snk-actions-button2.js';
7
7
  import { d as defineCustomElement$3 } from './snk-data-exporter2.js';
8
8
  import { d as defineCustomElement$2 } from './snk-exporter-email-sender2.js';
@@ -54,7 +54,7 @@ const buildCustomButton = (def, className, dataElementId, action, isEnabled) =>
54
54
  return textButton(def.name, className, dataElementId, text, hint, action, isEnabled);
55
55
  }
56
56
  };
57
- const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, configName, presentationMode) => {
57
+ const buildElem = (element, className, dataElementId, getTitle, action, isEnabled, actions, dataExporterStoreKey, presentationMode) => {
58
58
  var _a;
59
59
  const title = getTitle(element);
60
60
  switch (element) {
@@ -97,7 +97,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
97
97
  case TaskbarElement.DIVIDER:
98
98
  return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
99
99
  case TaskbarElement.DATA_EXPORTER:
100
- const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
100
+ const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[dataExporterStoreKey];
101
101
  return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
102
102
  case TaskbarElement.ATTACH:
103
103
  return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
@@ -306,8 +306,9 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
306
306
  className += "ez-padding-left--medium";
307
307
  }
308
308
  const taskbarElement = TaskbarElement[def.toString()];
309
+ const dataExporterStoreKey = this._element.dataset.exporterStoreKey || this.configName;
309
310
  if (taskbarElement) {
310
- return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), this.configName, this.presentationMode);
311
+ return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.buildDynamicActionsList(), dataExporterStoreKey, this.presentationMode);
311
312
  }
312
313
  else {
313
314
  return buildCustomButton(def, className, this.getIdElemBtnCustom(def), elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -423,6 +423,7 @@ class ConfigStorage {
423
423
  if (config == undefined) {
424
424
  return;
425
425
  }
426
+ name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
426
427
  await this.deleteGridConfigCache(name, resourceID);
427
428
  return this.gridConfigFetcher.saveConfig(config, name, resourceID);
428
429
  }
@@ -1,10 +1,11 @@
1
1
  import { D as DataFetcher } from './DataFetcher-c1baf61d.js';
2
- import { a as PreloadManager } from './pesquisa-fetcher-c7ce8ee7.js';
3
- import { SortMode, ApplicationContext, UserInterface, DateUtils } from '@sankhyalabs/core';
4
- import './index-0ece87a6.js';
2
+ import './pesquisa-fetcher-03c8f919.js';
3
+ import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, NumberUtils, DataType } from '@sankhyalabs/core';
4
+ import './index-3aa4977a.js';
5
5
  import './ISave-d8c8bc59.js';
6
6
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
7
- import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
7
+ import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
8
+ import { P as PreloadManager } from './dataunit-fetcher-264191b2.js';
8
9
  import './filter-item-type.enum-d45e026f.js';
9
10
  import './form-config-fetcher-30fb808f.js';
10
11
  import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
@@ -130,4 +131,91 @@ class SnkMultiSelectionListDataSource {
130
131
  }
131
132
  }
132
133
 
133
- export { CrudUtils as C, SnkMultiSelectionListDataSource as S };
134
+ class RmPrecisionCustomValueFormatter {
135
+ setGrid(grid) {
136
+ if (this._grid) {
137
+ return;
138
+ }
139
+ this._grid = grid;
140
+ this.refreshSelectedRows();
141
+ }
142
+ setDataState(dataState) {
143
+ if (ObjectUtils.objectToString(dataState) === ObjectUtils.objectToString(this._dataState)) {
144
+ return;
145
+ }
146
+ this._dataState = dataState;
147
+ this.refreshSelectedRows();
148
+ }
149
+ format(currentValue, column, recordId) {
150
+ var _a;
151
+ if (!currentValue) {
152
+ return currentValue;
153
+ }
154
+ const rowMetadata = (_a = this._dataState) === null || _a === void 0 ? void 0 : _a.metadataByRow.get(recordId);
155
+ const rmPrecision = rowMetadata === null || rowMetadata === void 0 ? void 0 : rowMetadata.getProp('rm_precision', column.name);
156
+ if (rmPrecision || rmPrecision === 0) {
157
+ return NumberUtils.format(currentValue, rmPrecision, rmPrecision);
158
+ }
159
+ else {
160
+ return currentValue;
161
+ }
162
+ }
163
+ refreshSelectedRows() {
164
+ var _a;
165
+ (_a = this._grid) === null || _a === void 0 ? void 0 : _a.refreshSelectedRows();
166
+ }
167
+ }
168
+
169
+ class CommonsExporter {
170
+ constructor(dataUnit, grid) {
171
+ this.dataUnit = dataUnit;
172
+ this.grid = grid;
173
+ }
174
+ async getColumnsMetadata() {
175
+ var _a;
176
+ this.columnsState = await ((_a = this.grid) === null || _a === void 0 ? void 0 : _a.getColumnsState()) || [];
177
+ return await this.buildColumnsMetadata(this.columnsState);
178
+ }
179
+ getColumnsState() {
180
+ return this.columnsState;
181
+ }
182
+ async buildColumnsMetadata(gridColumns) {
183
+ var _a, _b;
184
+ const columnsMetadata = [];
185
+ for (const column of gridColumns) {
186
+ /**
187
+ * TODO: Analisar e criar uma melhor forma de tratar essa validação do "RECDESP".
188
+ */
189
+ if (column.hidden && column.name !== "RECDESP") {
190
+ continue;
191
+ }
192
+ const fieldData = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(column.name);
193
+ const customFormatter = await this.grid.getCustomValueFormatter(column.name);
194
+ const columnData = {
195
+ label: column.label,
196
+ id: column.name,
197
+ width: column.width,
198
+ type: fieldData === null || fieldData === void 0 ? void 0 : fieldData.dataType,
199
+ userInterface: fieldData === null || fieldData === void 0 ? void 0 : fieldData.userInterface,
200
+ customFormatter
201
+ };
202
+ columnsMetadata.push(columnData);
203
+ if (((_b = fieldData === null || fieldData === void 0 ? void 0 : fieldData.properties) === null || _b === void 0 ? void 0 : _b.DESCRIPTIONFIELD) != undefined) {
204
+ const mergedFrom = fieldData.properties.mergedFrom;
205
+ const descriptionField = `${fieldData.properties.ENTITYNAME}.${fieldData.properties.DESCRIPTIONFIELD}`;
206
+ const descriptionColumn = {
207
+ label: fieldData.properties.DESCRIPTIONENTITY,
208
+ id: `${mergedFrom ? (mergedFrom + ".") : ""}${descriptionField}`,
209
+ width: column.width,
210
+ type: DataType.TEXT,
211
+ userInterface: UserInterface$1.LONGTEXT,
212
+ descriptionFrom: fieldData.name
213
+ };
214
+ columnsMetadata.push(descriptionColumn);
215
+ }
216
+ }
217
+ return columnsMetadata || [];
218
+ }
219
+ }
220
+
221
+ export { CommonsExporter as C, RmPrecisionCustomValueFormatter as R, SnkMultiSelectionListDataSource as S, CrudUtils as a };