@sankhyalabs/sankhyablocks 8.15.0-dev.6 → 8.15.0-dev.60

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 (352) hide show
  1. package/dist/cjs/{ConfigStorage-8009ecb2.js → ConfigStorage-7df9d3bb.js} +102 -30
  2. package/dist/cjs/IExporterProvider-1ed8e92a.js +187 -0
  3. package/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
  4. package/dist/cjs/RecordIDUtils-3735135c.js +43 -0
  5. package/dist/cjs/{SnkFormConfigManager-7d850fbc.js → SnkFormConfigManager-4259edbe.js} +21 -13
  6. package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-66aa2557.js} +19 -1
  7. package/dist/cjs/{auth-fetcher-c8467c07.js → auth-fetcher-e6112be7.js} +1 -1
  8. package/dist/cjs/{DataFetcher-ba94ed5b.js → form-config-fetcher-3c4daeb5.js} +258 -4
  9. package/dist/cjs/index-f9e81701.js +2 -10
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/{dataunit-fetcher-bd4c52da.js → pesquisa-fetcher-cb768be1.js} +520 -86
  12. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  13. package/dist/cjs/{snk-actions-button_2.cjs.entry.js → snk-actions-button_4.cjs.entry.js} +529 -13
  14. package/dist/cjs/snk-application.cjs.entry.js +62 -28
  15. package/dist/cjs/snk-attach.cjs.entry.js +422 -62
  16. package/dist/cjs/snk-crud.cjs.entry.js +17 -12
  17. package/dist/cjs/snk-data-exporter.cjs.entry.js +204 -82
  18. package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-abd2113f.js} +3 -38
  19. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -2
  20. package/dist/cjs/snk-detail-view.cjs.entry.js +10 -12
  21. package/dist/cjs/snk-entity-list.cjs.entry.js +5 -3
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +65 -10
  23. package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
  24. package/dist/cjs/snk-filter-item.cjs.entry.js +13 -6
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -3
  26. package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -1
  27. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
  28. package/dist/cjs/snk-form-config.cjs.entry.js +46 -27
  29. package/dist/cjs/snk-form.cjs.entry.js +10 -4
  30. package/dist/cjs/snk-grid.cjs.entry.js +95 -116
  31. package/dist/cjs/{snk-guides-viewer-cb176c4d.js → snk-guides-viewer-bec9c1a5.js} +15 -11
  32. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -10
  33. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +3 -1
  34. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -3
  35. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-simple-crud.cjs.entry.js +367 -38
  37. package/dist/cjs/snk-taskbar.cjs.entry.js +124 -15
  38. package/dist/cjs/{taskbar-elements-01b85b99.js → taskbar-elements-d9392685.js} +11 -11
  39. package/dist/collection/collection-manifest.json +7 -7
  40. package/dist/collection/components/snk-application/__mocks__/snk-application.js +7 -0
  41. package/dist/collection/components/snk-application/snk-application.js +85 -2
  42. package/dist/collection/components/snk-attach/snk-attach.js +212 -39
  43. package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
  44. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
  45. package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
  46. package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
  47. package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
  48. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +118 -0
  49. package/dist/collection/components/snk-attach/structure/index.js +6 -3
  50. package/dist/collection/components/snk-crud/snk-crud.js +95 -3
  51. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
  52. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +11 -2
  53. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +27 -3
  54. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +90 -0
  55. package/dist/collection/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.js +68 -0
  56. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +48 -1
  57. package/dist/collection/components/snk-data-exporter/interfaces/IExporterStrategy.js +1 -0
  58. package/dist/collection/components/snk-data-exporter/providers/ClientSideExporterProvider.js +53 -0
  59. package/dist/collection/components/snk-data-exporter/providers/ServerSideExporterProvider.js +55 -0
  60. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +42 -48
  61. package/dist/collection/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.js +88 -0
  62. package/dist/collection/components/snk-data-exporter/utils/RecordIDUtils.js +38 -0
  63. package/dist/collection/components/snk-data-unit/snk-data-unit.js +3 -42
  64. package/dist/collection/components/snk-entity-list/snk-entity-list.js +5 -3
  65. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
  66. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +3 -1
  67. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +22 -1
  68. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +31 -6
  69. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +19 -1
  70. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +24 -1
  71. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +159 -5
  72. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
  73. package/dist/collection/components/snk-form/snk-form.js +25 -1
  74. package/dist/collection/components/{snk-form → snk-form-config}/SnkFormConfigManager.js +20 -12
  75. package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.js +50 -30
  76. package/dist/collection/components/snk-grid/snk-grid.js +102 -109
  77. package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.js +130 -123
  78. package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.js +1 -1
  79. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
  80. package/dist/collection/components/snk-simple-crud/regular-buttons.js +3 -0
  81. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +10 -2
  82. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +548 -20
  83. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +4 -2
  84. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +11 -11
  85. package/dist/collection/components/snk-taskbar/snk-taskbar.css +17 -0
  86. package/dist/collection/components/snk-taskbar/snk-taskbar.js +167 -14
  87. package/dist/collection/lib/configs/ConfigStorage.js +86 -16
  88. package/dist/collection/lib/dataUnit/InMemoryLoader.js +9 -40
  89. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
  90. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +7 -4
  91. package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
  92. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
  93. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
  94. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
  95. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
  96. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
  97. package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
  98. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +3 -0
  99. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.js +4 -0
  100. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +11 -13
  101. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +32 -3
  102. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +36 -23
  103. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
  104. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +21 -0
  105. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
  106. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +12 -13
  107. package/dist/collection/lib/index.js +1 -1
  108. package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
  109. package/dist/collection/lib/message/resources/snk-data-exporter.msg.js +2 -1
  110. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
  111. package/dist/collection/lib/utils/CrudUtils.js +13 -1
  112. package/dist/components/ConfigStorage.js +93 -21
  113. package/dist/components/IExporterProvider.js +256 -0
  114. package/dist/components/ISave.js +42 -0
  115. package/dist/components/SnkFormConfigManager.js +19 -11
  116. package/dist/components/SnkMessageBuilder.js +19 -1
  117. package/dist/components/dataunit-fetcher.js +138 -91
  118. package/dist/components/form-config-fetcher.js +7035 -3
  119. package/dist/components/index.d.ts +6 -6
  120. package/dist/components/index2.js +198 -33
  121. package/dist/components/snk-actions-button2.js +3 -11
  122. package/dist/components/snk-application2.js +42 -3
  123. package/dist/components/snk-attach2.js +478 -70
  124. package/dist/components/snk-crud.js +18 -7
  125. package/dist/components/snk-data-exporter2.js +199 -82
  126. package/dist/components/snk-data-unit2.js +41 -39
  127. package/dist/components/snk-detail-view2.js +44 -12
  128. package/dist/components/snk-entity-list.js +5 -3
  129. package/dist/components/snk-expression-item2.js +1 -1
  130. package/dist/components/snk-filter-bar2.js +69 -8
  131. package/dist/components/snk-filter-detail2.js +5 -1
  132. package/dist/components/snk-filter-item2.js +14 -6
  133. package/dist/components/snk-filter-modal.js +4 -2
  134. package/dist/components/snk-filter-multi-select.js +2 -1
  135. package/dist/components/snk-form-config2.js +47 -27
  136. package/dist/components/snk-form.js +8 -0
  137. package/dist/components/snk-grid-config2.js +128 -102
  138. package/dist/components/snk-grid2.js +96 -112
  139. package/dist/components/snk-personalized-filter-editor.js +3 -1
  140. package/dist/components/snk-personalized-filter2.js +1 -1
  141. package/dist/components/snk-pesquisa2.js +1 -1
  142. package/dist/components/snk-simple-crud2.js +421 -34
  143. package/dist/components/snk-taskbar2.js +144 -29
  144. package/dist/components/taskbar-actions-button2.js +4 -2
  145. package/dist/esm/{ConfigStorage-1244b8b0.js → ConfigStorage-928c3bf4.js} +93 -21
  146. package/dist/esm/IExporterProvider-ceabfb7e.js +179 -0
  147. package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
  148. package/dist/esm/RecordIDUtils-87d02110.js +41 -0
  149. package/dist/esm/{SnkFormConfigManager-9be0e7d4.js → SnkFormConfigManager-a87ade7a.js} +21 -13
  150. package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0a4becdd.js} +19 -1
  151. package/dist/esm/{auth-fetcher-c05dc474.js → auth-fetcher-e1cb288f.js} +1 -1
  152. package/dist/esm/{DataFetcher-aa159c5a.js → form-config-fetcher-e3094014.js} +257 -5
  153. package/dist/esm/index-a7d3d3f1.js +2 -10
  154. package/dist/esm/loader.js +1 -1
  155. package/dist/esm/{dataunit-fetcher-65714f21.js → pesquisa-fetcher-72125b13.js} +494 -69
  156. package/dist/esm/sankhyablocks.js +1 -1
  157. package/dist/esm/{snk-actions-button_2.entry.js → snk-actions-button_4.entry.js} +523 -9
  158. package/dist/esm/snk-application.entry.js +43 -9
  159. package/dist/esm/snk-attach.entry.js +422 -62
  160. package/dist/esm/snk-crud.entry.js +17 -12
  161. package/dist/esm/snk-data-exporter.entry.js +204 -82
  162. package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-29eba11a.js} +4 -39
  163. package/dist/esm/snk-data-unit.entry.js +3 -2
  164. package/dist/esm/snk-detail-view.entry.js +10 -12
  165. package/dist/esm/snk-entity-list.entry.js +5 -3
  166. package/dist/esm/snk-filter-bar.entry.js +65 -10
  167. package/dist/esm/snk-filter-detail.entry.js +4 -1
  168. package/dist/esm/snk-filter-item.entry.js +13 -6
  169. package/dist/esm/snk-filter-modal-item.entry.js +2 -3
  170. package/dist/esm/snk-filter-modal.entry.js +2 -1
  171. package/dist/esm/snk-filter-multi-select.entry.js +2 -1
  172. package/dist/esm/snk-form-config.entry.js +47 -28
  173. package/dist/esm/snk-form.entry.js +10 -4
  174. package/dist/esm/snk-grid.entry.js +95 -116
  175. package/dist/esm/{snk-guides-viewer-eeb8f354.js → snk-guides-viewer-303aafb4.js} +15 -11
  176. package/dist/esm/snk-guides-viewer.entry.js +8 -10
  177. package/dist/esm/snk-personalized-filter-editor.entry.js +3 -1
  178. package/dist/esm/snk-personalized-filter.entry.js +2 -3
  179. package/dist/esm/snk-pesquisa.entry.js +1 -1
  180. package/dist/esm/snk-simple-crud.entry.js +359 -30
  181. package/dist/esm/snk-taskbar.entry.js +125 -16
  182. package/dist/esm/{taskbar-elements-d4d0b424.js → taskbar-elements-ad766858.js} +11 -11
  183. package/dist/sankhyablocks/p-029bfc09.js +1 -0
  184. package/dist/sankhyablocks/p-07825198.js +1 -0
  185. package/dist/sankhyablocks/p-0e8702f0.js +1 -0
  186. package/dist/sankhyablocks/p-13ea113d.entry.js +1 -0
  187. package/dist/sankhyablocks/p-1fa244c0.entry.js +1 -0
  188. package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
  189. package/dist/sankhyablocks/p-2d972c2e.entry.js +1 -0
  190. package/dist/sankhyablocks/p-314e2d1a.entry.js +1 -0
  191. package/dist/sankhyablocks/p-32556aa6.js +1 -0
  192. package/dist/sankhyablocks/p-33718dfc.entry.js +1 -0
  193. package/dist/sankhyablocks/p-3494a28e.entry.js +1 -0
  194. package/dist/sankhyablocks/p-35bd4df7.entry.js +1 -0
  195. package/dist/sankhyablocks/p-536eeb16.js +26 -0
  196. package/dist/sankhyablocks/p-54a5d52a.entry.js +1 -0
  197. package/dist/sankhyablocks/p-563701f3.js +1 -0
  198. package/dist/sankhyablocks/p-61984566.entry.js +1 -0
  199. package/dist/sankhyablocks/p-61dd89eb.js +1 -0
  200. package/dist/sankhyablocks/p-64977b22.entry.js +1 -0
  201. package/dist/sankhyablocks/p-65b6dba3.entry.js +1 -0
  202. package/dist/sankhyablocks/p-6bc64fb0.entry.js +1 -0
  203. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  204. package/dist/sankhyablocks/p-9863d682.js +1 -0
  205. package/dist/sankhyablocks/p-aedf37fb.js +65 -0
  206. package/dist/sankhyablocks/p-b11aa1e0.entry.js +1 -0
  207. package/dist/sankhyablocks/p-b233f5aa.entry.js +1 -0
  208. package/dist/sankhyablocks/p-b86ea293.entry.js +1 -0
  209. package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
  210. package/dist/sankhyablocks/p-c73482cf.js +1 -0
  211. package/dist/sankhyablocks/p-cb3c7b4a.entry.js +11 -0
  212. package/dist/sankhyablocks/p-cfb98f51.entry.js +1 -0
  213. package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
  214. package/dist/sankhyablocks/p-d911a023.entry.js +1 -0
  215. package/dist/sankhyablocks/p-e27496ed.js +56 -0
  216. package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
  217. package/dist/sankhyablocks/p-fa84e72f.entry.js +1 -0
  218. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  219. package/dist/types/components/snk-application/__mocks__/snk-application.d.ts +3 -0
  220. package/dist/types/components/snk-application/snk-application.d.ts +15 -0
  221. package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
  222. package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
  223. package/dist/types/components/snk-attach/snk-attach.d.ts +29 -6
  224. package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
  225. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +40 -0
  226. package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
  227. package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
  228. package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
  229. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +16 -0
  230. package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
  231. package/dist/types/components/snk-crud/snk-crud.d.ts +21 -0
  232. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +1 -1
  233. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +6 -1
  234. package/dist/types/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.d.ts +13 -0
  235. package/dist/types/components/snk-data-exporter/exporter-strategy/ServerSideExporterStrategy.d.ts +11 -0
  236. package/dist/types/components/snk-data-exporter/interfaces/IExporterProvider.d.ts +21 -4
  237. package/dist/types/components/snk-data-exporter/interfaces/IExporterStrategy.d.ts +5 -0
  238. package/dist/types/components/snk-data-exporter/providers/ClientSideExporterProvider.d.ts +17 -0
  239. package/dist/types/components/snk-data-exporter/providers/ServerSideExporterProvider.d.ts +17 -0
  240. package/dist/types/components/snk-data-exporter/snk-data-exporter.d.ts +3 -1
  241. package/dist/types/components/snk-data-exporter/test/resources/ClientSideExporterStrategyResources.d.ts +77 -0
  242. package/dist/types/components/snk-data-exporter/utils/RecordIDUtils.d.ts +3 -0
  243. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
  244. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +7 -3
  245. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -0
  246. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +27 -1
  247. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -1
  248. package/dist/types/components/snk-form/snk-form.d.ts +6 -1
  249. package/dist/types/components/{snk-form → snk-form-config}/SnkFormConfigManager.d.ts +2 -1
  250. package/dist/types/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.d.ts +5 -3
  251. package/dist/types/components/snk-grid/snk-grid.d.ts +19 -4
  252. package/dist/types/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.d.ts +11 -6
  253. package/dist/types/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.d.ts +1 -1
  254. package/dist/types/components/snk-simple-crud/regular-buttons.d.ts +3 -0
  255. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +98 -4
  256. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +1 -1
  257. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +34 -1
  258. package/dist/types/components.d.ts +314 -12
  259. package/dist/types/lib/configs/ConfigStorage.d.ts +25 -1
  260. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
  261. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
  262. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  263. package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
  264. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
  265. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
  266. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
  267. package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
  268. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.d.ts +2 -1
  269. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/ArrayRepository.d.ts +1 -0
  270. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -0
  271. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -0
  272. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +1 -0
  273. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/interfaces/IExporterColumnMetadata.d.ts +1 -0
  274. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
  275. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
  276. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  277. package/dist/types/lib/index.d.ts +1 -1
  278. package/dist/types/lib/utils/CrudUtils.d.ts +3 -0
  279. package/package.json +15 -6
  280. package/dist/cjs/PreloadManager-84466da6.js +0 -224
  281. package/dist/cjs/SnkMultiSelectionListDataSource-ba5838c2.js +0 -49
  282. package/dist/cjs/form-config-fetcher-df043d3d.js +0 -244
  283. package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
  284. package/dist/cjs/snk-grid-config.cjs.entry.js +0 -483
  285. package/dist/cjs/snk-select-box.cjs.entry.js +0 -25
  286. package/dist/collection/lib/http/data-fetcher/fetchers/fetchDataExporter/index.js +0 -34
  287. package/dist/components/DataFetcher.js +0 -7021
  288. package/dist/components/field-search.js +0 -121
  289. package/dist/components/index3.js +0 -199
  290. package/dist/esm/PreloadManager-c1c2f2b4.js +0 -222
  291. package/dist/esm/SnkMultiSelectionListDataSource-44494b0e.js +0 -43
  292. package/dist/esm/form-config-fetcher-36219cd3.js +0 -241
  293. package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
  294. package/dist/esm/snk-grid-config.entry.js +0 -479
  295. package/dist/esm/snk-select-box.entry.js +0 -21
  296. package/dist/sankhyablocks/p-0874adb5.entry.js +0 -1
  297. package/dist/sankhyablocks/p-094c30cb.js +0 -1
  298. package/dist/sankhyablocks/p-0d7863ed.js +0 -26
  299. package/dist/sankhyablocks/p-0dca29cb.entry.js +0 -1
  300. package/dist/sankhyablocks/p-11081798.entry.js +0 -1
  301. package/dist/sankhyablocks/p-20726710.entry.js +0 -1
  302. package/dist/sankhyablocks/p-29804fc5.js +0 -60
  303. package/dist/sankhyablocks/p-32f0935f.js +0 -1
  304. package/dist/sankhyablocks/p-3520c088.entry.js +0 -1
  305. package/dist/sankhyablocks/p-374d03f6.js +0 -1
  306. package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
  307. package/dist/sankhyablocks/p-585294ee.js +0 -56
  308. package/dist/sankhyablocks/p-6977a26c.entry.js +0 -1
  309. package/dist/sankhyablocks/p-69efa80d.entry.js +0 -1
  310. package/dist/sankhyablocks/p-6d20d38c.entry.js +0 -1
  311. package/dist/sankhyablocks/p-776ee8e3.js +0 -1
  312. package/dist/sankhyablocks/p-7d51d949.entry.js +0 -11
  313. package/dist/sankhyablocks/p-809f367d.entry.js +0 -1
  314. package/dist/sankhyablocks/p-95a3778f.entry.js +0 -1
  315. package/dist/sankhyablocks/p-9695f78b.js +0 -1
  316. package/dist/sankhyablocks/p-98674137.entry.js +0 -1
  317. package/dist/sankhyablocks/p-a9e5b094.entry.js +0 -1
  318. package/dist/sankhyablocks/p-b146a9f0.entry.js +0 -1
  319. package/dist/sankhyablocks/p-bedb8ad6.entry.js +0 -1
  320. package/dist/sankhyablocks/p-c22c1d8e.js +0 -1
  321. package/dist/sankhyablocks/p-c758265f.entry.js +0 -1
  322. package/dist/sankhyablocks/p-ca4d337a.entry.js +0 -1
  323. package/dist/sankhyablocks/p-cb7419e0.entry.js +0 -1
  324. package/dist/sankhyablocks/p-d1f5bc50.js +0 -1
  325. package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
  326. package/dist/sankhyablocks/p-d6317851.entry.js +0 -1
  327. package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
  328. package/dist/sankhyablocks/p-e6380c60.js +0 -1
  329. package/dist/sankhyablocks/p-f2056f66.entry.js +0 -1
  330. package/dist/sankhyablocks/p-f514913b.entry.js +0 -1
  331. package/dist/sankhyablocks/p-fd8814b9.entry.js +0 -1
  332. package/dist/sankhyablocks/p-ff6064e7.js +0 -1
  333. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
  334. package/dist/types/lib/http/data-fetcher/fetchers/fetchDataExporter/index.d.ts +0 -3
  335. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
  336. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
  337. /package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.css +0 -0
  338. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.css +0 -0
  339. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.js +0 -0
  340. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.css +0 -0
  341. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.js +0 -0
  342. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.css +0 -0
  343. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.js +0 -0
  344. /package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.css +0 -0
  345. /package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.css +0 -0
  346. /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
  347. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.d.ts +0 -0
  348. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.d.ts +0 -0
  349. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.d.ts +0 -0
  350. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
  351. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
  352. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
@@ -1,20 +1,116 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-a7d3d3f1.js';
2
- import { ApplicationContext, DataType, Action } from '@sankhyalabs/core';
3
- import { D as DataFetcher } from './DataFetcher-aa159c5a.js';
4
- import { S as SaveErrorsEnum } from './ISave-4412b20c.js';
2
+ import { ApplicationContext, DataType, Action, UserInterface, StringUtils, DataUnit } from '@sankhyalabs/core';
3
+ import { D as DataFetcher } from './form-config-fetcher-e3094014.js';
4
+ import { a as PreloadManager, b as applyFilter, c as applySorting, d as buildPaginationInfo, D as DataUnitFetcher, I as InMemoryLoader } from './pesquisa-fetcher-72125b13.js';
5
+ import './index-0ece87a6.js';
6
+ import { S as SaveErrorsEnum } from './ISave-d8c8bc59.js';
7
+ import './filter-item-type.enum-d45e026f.js';
5
8
  import { d as VIEW_MODE } from './constants-8457af36.js';
6
- import { D as DataUnitFetcher } from './dataunit-fetcher-65714f21.js';
7
- import { P as PreloadManager } from './PreloadManager-c1c2f2b4.js';
8
- import { T as TaskbarElement } from './taskbar-elements-d4d0b424.js';
9
+ import { A as AutorizationType } from './auth-fetcher-e1cb288f.js';
10
+ import { T as TaskbarElement } from './taskbar-elements-ad766858.js';
9
11
  import './PrintUtils-3e4ff0f5.js';
10
12
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
11
13
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
12
- import './ResourceIDUtils-a114189a.js';
13
14
  import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
14
- import './index-0ece87a6.js';
15
+ import '@sankhyalabs/core/dist/utils/SortingUtils';
16
+ import './ResourceIDUtils-a114189a.js';
15
17
  import './index-bdf75557.js';
16
18
 
19
+ const SERVICE$1 = {
20
+ save: "Attach.save",
21
+ delete: "Attach.remove",
22
+ view: "Attach.view",
23
+ repository: "RepositorioArquivoSP.abreArquivo"
24
+ };
17
25
  class AttachFetcher {
26
+ constructor(dataUnitName) {
27
+ this.dataUnitName = dataUnitName;
28
+ }
29
+ async save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }) {
30
+ var _a, _b;
31
+ const isInsert = operation == "INSERT";
32
+ const dataBody = isInsert ? fields : record;
33
+ if (!isInsert && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) && (fields === null || fields === void 0 ? void 0 : fields.DESCRICAO) !== (record === null || record === void 0 ? void 0 : record.DESCRICAO)) {
34
+ throw new Error(SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED);
35
+ }
36
+ const reqBody = {
37
+ "anexo": {
38
+ "codata": isInsert ? fields === null || fields === void 0 ? void 0 : fields.REGISTER_KEY : record === null || record === void 0 ? void 0 : record.CODATA,
39
+ "sequencia": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.SEQUENCIA) || "0",
40
+ "tipo": (dataBody === null || dataBody === void 0 ? void 0 : dataBody.TIPO) || "N",
41
+ "descricao": dataBody === null || dataBody === void 0 ? void 0 : dataBody.DESCRICAO,
42
+ "arquivo": (_b = (_a = fields.CAMINHO_ARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name,
43
+ "ehInclusao": isInsert ? "S" : "N",
44
+ "ehArquivoRepositorio": "N"
45
+ }
46
+ };
47
+ return new Promise((resolve, reject) => {
48
+ DataFetcher.get().callServiceBroker(SERVICE$1.save, JSON.stringify(reqBody))
49
+ .then(result => {
50
+ var _a;
51
+ return resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { __owner__dataunit__name__: (_a = this.dataUnitName) !== null && _a !== void 0 ? _a : dataUnitName })]);
52
+ })
53
+ .catch(error => reject(error));
54
+ });
55
+ }
56
+ async edit(change) {
57
+ throw new Error("Method not implemented.");
58
+ }
59
+ async delete(record) {
60
+ var request = {
61
+ anexo: {
62
+ codata: record.CODATA,
63
+ tipo: record.TIPO,
64
+ descricao: record.DESCRICAO,
65
+ }
66
+ };
67
+ const result = await DataFetcher.get().callServiceBroker(SERVICE$1.delete, JSON.stringify(request));
68
+ return Promise.resolve(result);
69
+ }
70
+ async getDownloadKey(record) {
71
+ var _a, _b, _c;
72
+ if (record.EHARQUIVOREPOSITORIO == 'S') {
73
+ const request = {
74
+ config: {
75
+ path: record.ARQUIVO,
76
+ tipoconteudo: record.TIPOCONTEUDO
77
+ }
78
+ };
79
+ const result = await DataFetcher.get().callServiceBroker(SERVICE$1.repository, JSON.stringify(request));
80
+ return Promise.resolve({
81
+ chave: {
82
+ valor: (_b = (_a = result === null || result === void 0 ? void 0 : result.responseBody) === null || _a === void 0 ? void 0 : _a.chave) === null || _b === void 0 ? void 0 : _b.valor
83
+ }
84
+ });
85
+ }
86
+ const criteria = {
87
+ anexo: {
88
+ codata: record.CODATA,
89
+ codemp: record.CODEMP,
90
+ sequencia: record.SEQUENCIA,
91
+ tipo: record.TIPO,
92
+ descricao: record.DESCRICAO,
93
+ tipoConteudo: record.TIPOCONTEUDO
94
+ }
95
+ };
96
+ const result = await DataFetcher.get().callServiceBroker(SERVICE$1.view, JSON.stringify(criteria));
97
+ if (result === null || result === void 0 ? void 0 : result.chaveAnexo) {
98
+ return Promise.resolve({
99
+ chave: {
100
+ valor: (_c = result === null || result === void 0 ? void 0 : result.chaveAnexo) === null || _c === void 0 ? void 0 : _c.idChaveAnexo
101
+ }
102
+ });
103
+ }
104
+ return Promise.reject(new Error("File not found."));
105
+ }
106
+ }
107
+
108
+ const SERVICE = {
109
+ save: "AnexoSistemaSP.salvar",
110
+ delete: "AnexoSistemaSP.excluir",
111
+ download: "AnexoSistemaSP.baixar",
112
+ };
113
+ class AnexoSistemaFetcher {
18
114
  constructor(entityName, registerKey, dataUnitName) {
19
115
  var _a;
20
116
  this.entityName = entityName;
@@ -32,14 +128,13 @@ class AttachFetcher {
32
128
  }
33
129
  async save(change) {
34
130
  var _a, _b;
35
- const serviceName = "AnexoSistemaSP.salvar";
36
131
  let { updatingFields: fields } = change;
37
132
  fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
38
133
  try {
39
134
  this.validateFields(fields);
40
135
  const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
41
136
  const reqBody = {
42
- serviceName,
137
+ serviceName: SERVICE.save,
43
138
  requestBody: {
44
139
  params: {
45
140
  resourceID: this.resourceID,
@@ -55,7 +150,7 @@ class AttachFetcher {
55
150
  }
56
151
  }
57
152
  };
58
- const result = await DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
153
+ const result = await DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
59
154
  return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
60
155
  }
61
156
  catch (error) {
@@ -64,7 +159,6 @@ class AttachFetcher {
64
159
  }
65
160
  async edit(change) {
66
161
  var _a, _b, _c;
67
- const serviceName = "AnexoSistemaSP.salvar";
68
162
  let { updatingFields: fields, record } = change;
69
163
  const getFieldValue = (fieldValue) => {
70
164
  if (fields[fieldValue] !== undefined)
@@ -78,7 +172,7 @@ class AttachFetcher {
78
172
  try {
79
173
  this.validateFields(fields);
80
174
  const reqBody = {
81
- serviceName,
175
+ serviceName: SERVICE.save,
82
176
  requestBody: {
83
177
  params: {
84
178
  resourceID: this.resourceID,
@@ -96,7 +190,7 @@ class AttachFetcher {
96
190
  }
97
191
  }
98
192
  };
99
- const result = await DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
193
+ const result = await DataFetcher.get().callServiceBroker(SERVICE.save, JSON.stringify(reqBody));
100
194
  return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
101
195
  }
102
196
  catch (error) {
@@ -105,10 +199,9 @@ class AttachFetcher {
105
199
  }
106
200
  delete(record) {
107
201
  var _a;
108
- const serviceName = "AnexoSistemaSP.excluir";
109
202
  const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
110
203
  const reqBody = {
111
- serviceName,
204
+ serviceName: SERVICE.delete,
112
205
  requestBody: {
113
206
  paramsDelete: {
114
207
  keyAttach: record.CHAVEARQUIVO,
@@ -120,17 +213,16 @@ class AttachFetcher {
120
213
  }
121
214
  };
122
215
  return new Promise((resolve, reject) => {
123
- DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
216
+ DataFetcher.get().callServiceBroker(SERVICE.delete, JSON.stringify(reqBody))
124
217
  .then(result => resolve(result))
125
218
  .catch(error => reject(error));
126
219
  });
127
220
  }
128
221
  getDownloadKey(record) {
129
222
  var _a;
130
- const serviceName = "AnexoSistemaSP.baixar";
131
223
  const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
132
224
  const reqBody = {
133
- serviceName,
225
+ serviceName: SERVICE.download,
134
226
  requestBody: {
135
227
  paramsDown: {
136
228
  nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
@@ -142,34 +234,37 @@ class AttachFetcher {
142
234
  }
143
235
  };
144
236
  return new Promise((resolve, reject) => {
145
- DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
237
+ DataFetcher.get().callServiceBroker(SERVICE.download, JSON.stringify(reqBody))
146
238
  .then(result => resolve(result))
147
239
  .catch(error => reject(error));
148
240
  });
149
241
  }
150
242
  }
151
243
 
152
- class AttachmentDataUnitBuilder {
244
+ class AnexoSistemaDataUnitFactory {
153
245
  constructor(entityName, getMessage) {
154
246
  this.entityName = entityName;
155
247
  this.getMessage = getMessage;
156
248
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
157
249
  }
158
- initLoaders(dataUnit, attachFetcher, onSuccess) {
250
+ initLoaders(dataUnit, fetcher, onSuccess) {
159
251
  if (!this.loader)
160
252
  this.loader = dataUnit.dataLoader;
161
253
  dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
162
- dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, attachFetcher).then((recordIds) => {
254
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
163
255
  if (recordIds.length)
164
256
  onSuccess();
165
257
  return recordIds;
166
258
  });
167
- dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, attachFetcher).then((recordIds) => {
259
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
168
260
  if (recordIds.length)
169
261
  onSuccess();
170
262
  return recordIds;
171
263
  });
172
264
  }
265
+ metadataLoader(dataUnit) {
266
+ throw new Error("Method not implemented.");
267
+ }
173
268
  dataLoader(dataUnit, request) {
174
269
  return new Promise(resolve => {
175
270
  this.loader(dataUnit, request).then(response => {
@@ -185,11 +280,11 @@ class AttachmentDataUnitBuilder {
185
280
  });
186
281
  });
187
282
  }
188
- saveLoader(changes, attachFetcher) {
283
+ saveLoader(changes, fetcher) {
189
284
  return new Promise((resolve) => {
190
285
  var _a;
191
286
  const change = Array.isArray(changes) ? changes[0] : {};
192
- const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? attachFetcher.edit.bind(attachFetcher) : attachFetcher.save.bind(attachFetcher);
287
+ const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? fetcher.edit.bind(fetcher) : fetcher.save.bind(fetcher);
193
288
  savePromise(change).then((records) => {
194
289
  resolve(records);
195
290
  }).catch((error) => {
@@ -209,11 +304,11 @@ class AttachmentDataUnitBuilder {
209
304
  });
210
305
  });
211
306
  }
212
- removeLoader(dataUnit, ids, attachFetcher) {
307
+ removeLoader(dataUnit, ids, fetcher) {
213
308
  return new Promise((resolve) => {
214
309
  const { records } = dataUnit.getSelectionInfo();
215
310
  const recordToDelete = records[0];
216
- attachFetcher.delete(recordToDelete).then(() => {
311
+ fetcher.delete(recordToDelete).then(() => {
217
312
  PreloadManager.removeRecords(dataUnit, [recordToDelete]);
218
313
  return resolve(ids);
219
314
  });
@@ -254,6 +349,181 @@ class AttachmentDataUnitBuilder {
254
349
  }
255
350
  }
256
351
 
352
+ const application$1 = ApplicationContext.getContextValue("__SNK__APPLICATION__");
353
+ const getMessage$1 = (key) => {
354
+ var _a, _b;
355
+ return (_b = (_a = application$1 === null || application$1 === void 0 ? void 0 : application$1.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
356
+ };
357
+ const attachCrudConfig = {
358
+ grid: {
359
+ columns: [
360
+ { name: "CODATA", orderIndex: 0, width: 0 },
361
+ { name: "DESCRICAO", orderIndex: 1, width: 0 },
362
+ { name: "ARQUIVO", orderIndex: 2, width: 0 },
363
+ { name: "DTALTER", orderIndex: 3, width: 0 },
364
+ { name: "USUARIO", orderIndex: 4, width: 0 },
365
+ ],
366
+ },
367
+ form: {
368
+ emptyConfig: false,
369
+ fields: [
370
+ {
371
+ name: "DESCRICAO",
372
+ label: getMessage$1("snkAttach.attachMetadata.lblDescription"),
373
+ visible: true,
374
+ readOnly: false,
375
+ required: true,
376
+ },
377
+ {
378
+ name: "CAMINHO_ARQUIVO",
379
+ label: getMessage$1("snkAttach.attachMetadata.lblFile"),
380
+ visible: true,
381
+ readOnly: false,
382
+ required: true,
383
+ },
384
+ ],
385
+ },
386
+ };
387
+ const attachFetcherMetadataBuilder = {
388
+ name: "Attach",
389
+ label: "Attach List",
390
+ fields: [
391
+ { name: "CODATA", label: getMessage$1("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
392
+ { name: "DESCRICAO", label: getMessage$1("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT, readOnly: false },
393
+ { name: "ARQUIVO", label: getMessage$1("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
394
+ { name: "USUARIO", label: getMessage$1("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
395
+ { name: "DTALTER", label: getMessage$1("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
396
+ {
397
+ name: "CAMINHO_ARQUIVO",
398
+ label: getMessage$1("snkAttach.attachMetadata.lblFileUpload"),
399
+ dataType: DataType.OBJECT,
400
+ userInterface: UserInterface.FILE,
401
+ readOnly: false,
402
+ required: true,
403
+ visible: true,
404
+ properties: {
405
+ subTitle: getMessage$1("snkAttach.attachMetadata.lblSubTitle"),
406
+ MAX_FILES: 1,
407
+ STORAGESTRATEGY: "SESSION",
408
+ INTERNAL_FILENAME: "Attach.upload",
409
+ }
410
+ },
411
+ ],
412
+ };
413
+
414
+ const SERVICE_LOAD = "Attach.load";
415
+ class AttachFetcherDataUnitFactory {
416
+ constructor(getMessage) {
417
+ this.getMessage = getMessage;
418
+ this._records = [];
419
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
420
+ }
421
+ initLoaders(dataUnit, fetcher, onSuccess) {
422
+ dataUnit.metadataLoader = (dataUnit) => this.metadataLoader(dataUnit);
423
+ dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
424
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, fetcher).then((recordIds) => {
425
+ if (recordIds.length)
426
+ onSuccess();
427
+ return recordIds;
428
+ });
429
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, fetcher).then((recordIds) => {
430
+ if (recordIds.length)
431
+ onSuccess();
432
+ return recordIds;
433
+ });
434
+ }
435
+ metadataLoader(_) {
436
+ return Promise.resolve(attachFetcherMetadataBuilder);
437
+ }
438
+ async dataLoader(dataUnit, request) {
439
+ if (!request.source) {
440
+ return Promise.resolve({ records: this._records });
441
+ }
442
+ if (!Number.isNaN(Number(request.source))) {
443
+ const criteria = {
444
+ criteria: {
445
+ codata: request.source,
446
+ tipoAnexo: "N"
447
+ }
448
+ };
449
+ const applicationDataFetcher = await this._application.getDataFetcher();
450
+ const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
451
+ const records = [];
452
+ anexo.forEach((param) => {
453
+ records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
454
+ name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
455
+ }] }, param));
456
+ });
457
+ this._records = records;
458
+ }
459
+ let records = applyFilter(this._records, dataUnit, request.filters);
460
+ records = applySorting(records, dataUnit, request.sort);
461
+ return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
462
+ }
463
+ saveLoader(changes, fetcher) {
464
+ return new Promise((resolve) => {
465
+ const change = Array.isArray(changes) ? changes[0] : {};
466
+ fetcher.save(change)
467
+ .then(resolve)
468
+ .catch((error) => {
469
+ if (error.message === SaveErrorsEnum.DESCRIPTION_CANNOT_BE_CHANGED) {
470
+ this._application.alert(this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.title'), this.getMessage('snkAttach.alertValidation.descriptionCannotBeChanged.message'));
471
+ return resolve([]);
472
+ }
473
+ if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
474
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
475
+ return resolve([]);
476
+ }
477
+ if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
478
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
479
+ return resolve([]);
480
+ }
481
+ if (error.message) {
482
+ this._application.error((error.title || error.name), error.message);
483
+ return resolve([]);
484
+ }
485
+ resolve([]);
486
+ });
487
+ });
488
+ }
489
+ removeLoader(dataUnit, ids, fetcher) {
490
+ return new Promise((resolve) => {
491
+ dataUnit.getSelectionInfo().records.forEach(async (record) => {
492
+ this._application.hasAccess(AutorizationType.REMOVE)
493
+ .then(async (hasAccess) => {
494
+ if (hasAccess) {
495
+ await fetcher.delete(record);
496
+ resolve(ids);
497
+ }
498
+ });
499
+ });
500
+ });
501
+ }
502
+ getFilters() {
503
+ throw new Error('Method not implemented.');
504
+ }
505
+ getInterceptions(dataUnit, action, crudRef) {
506
+ return new Promise((resolve) => {
507
+ if (action.type === Action.EDITION_CANCELED) {
508
+ if (!dataUnit.isDirty())
509
+ return resolve(action);
510
+ return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
511
+ if (cancellationConfirmed) {
512
+ crudRef.goToView(VIEW_MODE.GRID);
513
+ return resolve(action);
514
+ }
515
+ return resolve(undefined);
516
+ });
517
+ }
518
+ if (action.type === Action.DATA_SAVED) {
519
+ dataUnit.loadData();
520
+ return resolve(action);
521
+ }
522
+ resolve(action);
523
+ });
524
+ }
525
+ }
526
+
257
527
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
258
528
  const getMessage = (key) => {
259
529
  var _a, _b;
@@ -300,7 +570,7 @@ const buildTaskBarManager = () => {
300
570
  };
301
571
  };
302
572
 
303
- const crudConfig = {
573
+ const anexoSistemaCrudConfig = {
304
574
  grid: {
305
575
  columns: [
306
576
  { name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
@@ -346,40 +616,56 @@ const SnkAttach = class {
346
616
  constructor(hostRef) {
347
617
  registerInstance(this, hostRef);
348
618
  this.back = createEvent(this, "back", 7);
349
- this.handleTaskbarClick = ({ detail: taskbar }) => {
619
+ this.handleTaskbarClick = async ({ detail: taskbar }) => {
350
620
  if (["DOWNLOAD", "LINK"].includes(taskbar))
351
- return this.downloadAttachment(this.dataUnit.getSelectedRecord());
621
+ return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());
622
+ if (this.fetcherType === "Attach" && ["SAVE"].includes(taskbar) && this._currentDataUnit.isDirty()) {
623
+ await this._currentDataUnit.setFieldValue("REGISTER_KEY", this.registerKey);
624
+ }
352
625
  };
353
626
  this.handleBack = () => {
354
- this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
627
+ this._currentDataUnit.cancelEdition().then((cancelationConfirmed) => {
355
628
  if (cancelationConfirmed)
356
629
  this.back.emit();
357
630
  });
358
631
  };
359
632
  this.handleFinish = () => {
360
- if (!this.dataUnit.isDirty())
633
+ if (!this._currentDataUnit.isDirty())
361
634
  return this.back.emit();
362
- this.dataUnit.saveData().then(() => {
635
+ this._currentDataUnit.saveData().then(() => {
363
636
  this.showFinishedToast();
364
637
  this.back.emit();
365
638
  });
366
639
  };
640
+ this.fetcherType = undefined;
641
+ this.fetcher = undefined;
642
+ this.dataUnit = undefined;
643
+ this.dataUnitBuilder = undefined;
367
644
  this.registerKey = undefined;
368
645
  this.entityName = undefined;
369
646
  this.messagesBuilder = undefined;
370
- this.dataUnit = undefined;
647
+ this._currentFetcher = undefined;
648
+ this._currentDataUnit = undefined;
371
649
  this.crudConfig = undefined;
372
650
  }
373
651
  registerKeyWatcher(newRegisterKey, oldRegisterKey) {
374
- var _a;
375
- if (this.dataUnit == null) {
652
+ var _a, _b, _c, _d, _e, _f;
653
+ if (!this._currentDataUnit) {
376
654
  this.loadAttachmentDataUnit();
377
655
  }
378
656
  if (oldRegisterKey !== newRegisterKey) {
379
657
  this.returnToGridMode();
380
- this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
381
- this._dataUnitBuilder.initLoaders(this.dataUnit, this._attachFetcher, () => { this.returnToGridMode(); });
382
- this.dataUnit.loadData();
658
+ if (this.fetcherType === "AnexoSistema") {
659
+ this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
660
+ (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
661
+ return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
662
+ }
663
+ if (this.fetcherType === "Attach") {
664
+ const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
665
+ if (hasMoreOneItem)
666
+ return;
667
+ }
668
+ return (_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
383
669
  }
384
670
  }
385
671
  /**
@@ -402,44 +688,103 @@ const SnkAttach = class {
402
688
  window.open(`${selectedRecord.LINK}`);
403
689
  return;
404
690
  }
405
- this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
406
- window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
691
+ this._currentFetcher
692
+ .getDownloadKey(selectedRecord)
693
+ .then(({ chave }) => {
694
+ var _a;
695
+ let forceDownload = false;
696
+ if (!((_a = selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.ARQUIVO) === null || _a === void 0 ? void 0 : _a.endsWith(".pdf"))) {
697
+ forceDownload = true;
698
+ }
699
+ window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}${forceDownload ? "&forcarDownload=S" : ""}`);
407
700
  });
408
701
  }
409
702
  returnToGridMode() {
410
- this.dataUnit.clearSelection();
703
+ var _a;
704
+ (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
411
705
  if (this._crudElement)
412
706
  this._crudElement.goToView(VIEW_MODE.GRID);
413
707
  }
414
708
  loadAttachmentDataUnit() {
415
- var _a;
416
709
  try {
417
- const dataUnit = this.dataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
418
- this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
419
- if (!dataUnit.metadata)
420
- dataUnit.loadMetadata().then(() => {
421
- this.crudConfig = crudConfig;
422
- });
423
- this._dataUnitBuilder = new AttachmentDataUnitBuilder(this.entityName, this.getMessage.bind(this));
424
- dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
425
- dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
426
- this.dataUnit = dataUnit;
427
- this.dataUnit.loadData().then(() => {
428
- this.disableEditFieldsNotInForm();
429
- });
430
- return this.dataUnit;
710
+ switch (this.fetcherType) {
711
+ case "AnexoSistema":
712
+ this.loadAnexoSistema();
713
+ break;
714
+ case "Attach":
715
+ this.loadAttach();
716
+ break;
717
+ default:
718
+ this._currentFetcher = this.fetcher;
719
+ this._currentDataUnit = this.dataUnit;
720
+ this._currentDataUnitBuilder = this.dataUnitBuilder;
721
+ }
431
722
  }
432
723
  catch (error) {
433
724
  throw new Error('There was an error while creating the data unit');
434
725
  }
435
726
  }
727
+ loadAnexoSistema() {
728
+ this._currentDataUnit = this._currentDataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
729
+ if (!this._currentDataUnit.metadata) {
730
+ this._currentDataUnit
731
+ .loadMetadata()
732
+ .then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
733
+ }
734
+ this.initDataUnitLoaders();
735
+ this._currentDataUnit.addFilterProvider({
736
+ getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
737
+ });
738
+ this._currentDataUnit.addInterceptor({
739
+ interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
740
+ });
741
+ this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
742
+ }
743
+ loadAttach() {
744
+ var _a, _b;
745
+ this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
746
+ this.initDataUnitLoaders();
747
+ this._currentDataUnit.addInterceptor({
748
+ interceptAction: (action) => {
749
+ var _a;
750
+ if (action.type === Action.METADATA_LOADED) {
751
+ this.crudConfig = Object.assign({}, attachCrudConfig);
752
+ (_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.updateConfig();
753
+ }
754
+ return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
755
+ }
756
+ });
757
+ if (!this._currentDataUnit.metadata) {
758
+ (_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadMetadata()) === null || _b === void 0 ? void 0 : _b.then(() => {
759
+ var _a, _b;
760
+ this.crudConfig = Object.assign({}, attachCrudConfig);
761
+ (_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true, this.registerKey)) === null || _b === void 0 ? void 0 : _b.then(this.disableEditFieldsNotInForm.bind(this));
762
+ });
763
+ }
764
+ }
765
+ initDataUnitLoaders() {
766
+ var _a, _b, _c;
767
+ if (this.fetcherType === "AnexoSistema") {
768
+ this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
769
+ this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
770
+ (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
771
+ }
772
+ if (this.fetcherType === "Attach") {
773
+ this._currentFetcher = new AttachFetcher();
774
+ this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
775
+ (_c = this._currentDataUnitBuilder) === null || _c === void 0 ? void 0 : _c.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
776
+ this.returnToGridMode();
777
+ await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
778
+ });
779
+ }
780
+ }
436
781
  disableEditFieldsNotInForm() {
437
782
  var _a;
438
783
  (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
439
784
  var _a;
440
785
  const fieldName = column.name;
441
786
  if (!((_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form.fields.some(field => field.name === fieldName))) {
442
- this.dataUnit.disableField(fieldName);
787
+ this._currentDataUnit.disableField(fieldName);
443
788
  }
444
789
  });
445
790
  }
@@ -447,15 +792,30 @@ const SnkAttach = class {
447
792
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
448
793
  }
449
794
  componentWillRender() {
450
- if (this.dataUnit == null) {
795
+ if (!this.fetcherType) {
796
+ this.fetcherType = "AnexoSistema";
797
+ }
798
+ if (this._currentDataUnit == null) {
451
799
  this.loadAttachmentDataUnit();
452
800
  }
453
801
  }
802
+ async handleOnDataStateChange({ detail }) {
803
+ if (this.fetcherType !== 'Attach')
804
+ return;
805
+ if (!detail.insertionMode) {
806
+ this._currentDataUnit.disableField('DESCRICAO');
807
+ }
808
+ else {
809
+ this._currentDataUnit.enableField('DESCRICAO');
810
+ }
811
+ await this._currentDataUnit.loadMetadata();
812
+ }
813
+ ;
454
814
  render() {
455
815
  var _a, _b;
456
- if (!this.dataUnit)
816
+ if (!this._currentDataUnit)
457
817
  return null;
458
- return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this.dataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
818
+ return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
459
819
  }
460
820
  static get watchers() { return {
461
821
  "registerKey": ["registerKeyWatcher"]