@sankhyalabs/sankhyablocks 8.15.0-dev.2 → 8.15.0-dev.21

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 (231) hide show
  1. package/dist/cjs/{ConfigStorage-0d507a8f.js → ConfigStorage-302bbbd4.js} +25 -15
  2. package/dist/cjs/{ISave-d68ce3cd.js → ISave-e91b70a7.js} +1 -0
  3. package/dist/cjs/{SnkFormConfigManager-467907f6.js → SnkFormConfigManager-71c4768e.js} +1 -1
  4. package/dist/cjs/{SnkMessageBuilder-7293d0ad.js → SnkMessageBuilder-e7dcf408.js} +13 -0
  5. package/dist/cjs/{index-0e663819.js → index-0922807b.js} +1 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/{dataunit-fetcher-bdaf9482.js → pesquisa-fetcher-c790ffb7.js} +254 -34
  8. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  9. package/dist/cjs/snk-actions-button_2.cjs.entry.js +23 -5
  10. package/dist/cjs/snk-application.cjs.entry.js +95 -6
  11. package/dist/cjs/snk-attach.cjs.entry.js +395 -57
  12. package/dist/cjs/snk-crud.cjs.entry.js +10 -8
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +4 -4
  14. package/dist/cjs/{snk-data-unit-1bc69073.js → snk-data-unit-82c08a8c.js} +1 -1
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -9
  17. package/dist/cjs/snk-entity-list.cjs.entry.js +5 -3
  18. package/dist/cjs/snk-filter-bar.cjs.entry.js +57 -7
  19. package/dist/cjs/snk-filter-item.cjs.entry.js +3 -0
  20. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -2
  21. package/dist/cjs/snk-filter-modal.cjs.entry.js +16 -1
  22. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
  23. package/dist/cjs/snk-form.cjs.entry.js +2 -2
  24. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-grid.cjs.entry.js +42 -18
  26. package/dist/cjs/{snk-guides-viewer-9342bca1.js → snk-guides-viewer-32c1d35d.js} +9 -10
  27. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
  28. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  29. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  30. package/dist/cjs/snk-simple-crud.cjs.entry.js +19 -8
  31. package/dist/cjs/snk-taskbar.cjs.entry.js +53 -5
  32. package/dist/cjs/{taskbar-elements-b8c428a9.js → taskbar-elements-01b85b99.js} +1 -1
  33. package/dist/collection/collection-manifest.json +1 -1
  34. package/dist/collection/components/snk-application/__mocks__/snk-application.js +7 -0
  35. package/dist/collection/components/snk-application/snk-application.js +111 -5
  36. package/dist/collection/components/snk-attach/snk-attach.js +194 -38
  37. package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
  38. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
  39. package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
  40. package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
  41. package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
  42. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +111 -0
  43. package/dist/collection/components/snk-attach/structure/index.js +6 -3
  44. package/dist/collection/components/snk-crud/snk-crud.js +24 -4
  45. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.css +11 -2
  46. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +4 -4
  47. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
  48. package/dist/collection/components/snk-entity-list/snk-entity-list.js +5 -3
  49. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
  50. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -0
  51. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +84 -2
  52. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +0 -1
  53. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +101 -5
  54. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +5 -1
  55. package/dist/collection/components/snk-grid/snk-grid.js +57 -16
  56. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +1 -1
  57. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
  58. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +53 -1
  59. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +26 -1
  60. package/dist/collection/components/snk-taskbar/snk-taskbar.css +17 -0
  61. package/dist/collection/components/snk-taskbar/snk-taskbar.js +89 -4
  62. package/dist/collection/lib/@types/index.js +1 -0
  63. package/dist/collection/lib/configs/ConfigStorage.js +24 -14
  64. package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
  65. package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
  66. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
  67. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
  68. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
  69. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
  70. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
  71. package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
  72. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +31 -3
  73. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +55 -31
  74. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +1 -1
  75. package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +21 -0
  76. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +10 -4
  77. package/dist/collection/lib/index.js +1 -1
  78. package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
  79. package/dist/components/ConfigStorage.js +25 -15
  80. package/dist/components/SnkMessageBuilder.js +13 -0
  81. package/dist/components/dataunit-fetcher.js +96 -38
  82. package/dist/components/index2.js +1 -0
  83. package/dist/components/snk-actions-button2.js +1 -0
  84. package/dist/components/snk-application2.js +94 -3
  85. package/dist/components/snk-attach2.js +400 -56
  86. package/dist/components/snk-crud.js +7 -3
  87. package/dist/components/snk-data-exporter2.js +1 -1
  88. package/dist/components/snk-detail-view2.js +4 -4
  89. package/dist/components/snk-entity-list.js +5 -3
  90. package/dist/components/snk-filter-bar2.js +59 -7
  91. package/dist/components/snk-filter-item2.js +3 -0
  92. package/dist/components/snk-filter-modal-item2.js +0 -1
  93. package/dist/components/snk-filter-modal.js +21 -3
  94. package/dist/components/snk-filter-multi-select.js +2 -1
  95. package/dist/components/snk-grid2.js +40 -15
  96. package/dist/components/snk-personalized-filter2.js +1 -1
  97. package/dist/components/snk-pesquisa2.js +1 -1
  98. package/dist/components/snk-simple-crud2.js +15 -1
  99. package/dist/components/snk-taskbar2.js +55 -4
  100. package/dist/components/taskbar-actions-button2.js +21 -2
  101. package/dist/esm/{ConfigStorage-379a9cba.js → ConfigStorage-4151acc8.js} +25 -15
  102. package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
  103. package/dist/esm/{SnkFormConfigManager-587e9030.js → SnkFormConfigManager-5c7d3771.js} +1 -1
  104. package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
  105. package/dist/esm/{index-1564817d.js → index-0ece87a6.js} +1 -0
  106. package/dist/esm/loader.js +1 -1
  107. package/dist/esm/{dataunit-fetcher-cc1650eb.js → pesquisa-fetcher-4000d0b8.js} +255 -36
  108. package/dist/esm/sankhyablocks.js +1 -1
  109. package/dist/esm/snk-actions-button_2.entry.js +23 -5
  110. package/dist/esm/snk-application.entry.js +95 -6
  111. package/dist/esm/snk-attach.entry.js +396 -58
  112. package/dist/esm/snk-crud.entry.js +10 -8
  113. package/dist/esm/snk-data-exporter.entry.js +4 -4
  114. package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
  115. package/dist/esm/snk-data-unit.entry.js +2 -2
  116. package/dist/esm/snk-detail-view.entry.js +8 -9
  117. package/dist/esm/snk-entity-list.entry.js +5 -3
  118. package/dist/esm/snk-filter-bar.entry.js +57 -7
  119. package/dist/esm/snk-filter-item.entry.js +3 -0
  120. package/dist/esm/snk-filter-modal-item.entry.js +1 -2
  121. package/dist/esm/snk-filter-modal.entry.js +16 -1
  122. package/dist/esm/snk-filter-multi-select.entry.js +2 -1
  123. package/dist/esm/snk-form.entry.js +2 -2
  124. package/dist/esm/snk-grid-config.entry.js +1 -1
  125. package/dist/esm/snk-grid.entry.js +42 -18
  126. package/dist/esm/{snk-guides-viewer-9ce9588c.js → snk-guides-viewer-8adacfd4.js} +9 -10
  127. package/dist/esm/snk-guides-viewer.entry.js +7 -8
  128. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  129. package/dist/esm/snk-pesquisa.entry.js +1 -1
  130. package/dist/esm/snk-simple-crud.entry.js +17 -6
  131. package/dist/esm/snk-taskbar.entry.js +54 -6
  132. package/dist/esm/{taskbar-elements-26c981af.js → taskbar-elements-d4d0b424.js} +1 -1
  133. package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
  134. package/dist/sankhyablocks/p-0574c231.entry.js +1 -0
  135. package/dist/sankhyablocks/p-0eb1ff03.js +65 -0
  136. package/dist/sankhyablocks/p-11bbb65e.entry.js +1 -0
  137. package/dist/sankhyablocks/{p-729f5f5b.entry.js → p-1d75d9f9.entry.js} +1 -1
  138. package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
  139. package/dist/sankhyablocks/p-2419f19f.js +1 -0
  140. package/dist/sankhyablocks/p-33718dfc.entry.js +1 -0
  141. package/dist/sankhyablocks/p-374d03f6.js +1 -0
  142. package/dist/sankhyablocks/p-38289a55.js +1 -0
  143. package/dist/sankhyablocks/p-3838d2ff.entry.js +1 -0
  144. package/dist/sankhyablocks/{p-35fe6e61.entry.js → p-40915359.entry.js} +1 -1
  145. package/dist/sankhyablocks/p-45d82274.entry.js +1 -0
  146. package/dist/sankhyablocks/{p-2028633c.js → p-573a07c5.js} +1 -1
  147. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  148. package/dist/sankhyablocks/{p-aaa1438e.entry.js → p-761ed32f.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-79b4b271.entry.js +1 -0
  150. package/dist/sankhyablocks/p-7f3c7b09.entry.js +1 -0
  151. package/dist/sankhyablocks/{p-6977a26c.entry.js → p-86801b08.entry.js} +1 -1
  152. package/dist/sankhyablocks/p-96ef14f9.entry.js +1 -0
  153. package/dist/sankhyablocks/p-aa95fb2c.js +56 -0
  154. package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
  155. package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
  156. package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
  157. package/dist/sankhyablocks/p-db4edd06.entry.js +11 -0
  158. package/dist/sankhyablocks/p-df2b84c4.entry.js +1 -0
  159. package/dist/sankhyablocks/p-e0b23084.entry.js +1 -0
  160. package/dist/sankhyablocks/p-e0fd9555.entry.js +1 -0
  161. package/dist/sankhyablocks/p-ed2dce4b.entry.js +1 -0
  162. package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
  163. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  164. package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
  165. package/dist/types/components/snk-application/__mocks__/snk-application.d.ts +3 -0
  166. package/dist/types/components/snk-application/snk-application.d.ts +12 -2
  167. package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
  168. package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
  169. package/dist/types/components/snk-attach/snk-attach.d.ts +28 -6
  170. package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
  171. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +31 -0
  172. package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
  173. package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
  174. package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
  175. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +15 -0
  176. package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
  177. package/dist/types/components/snk-crud/snk-crud.d.ts +5 -0
  178. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
  179. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +19 -1
  180. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +18 -0
  181. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +7 -1
  182. package/dist/types/components/snk-grid/snk-grid.d.ts +6 -0
  183. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
  184. package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +2 -0
  185. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +20 -1
  186. package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +1 -0
  187. package/dist/types/components.d.ts +140 -13
  188. package/dist/types/lib/@types/index.d.ts +2 -1
  189. package/dist/types/lib/configs/ConfigStorage.d.ts +4 -0
  190. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  191. package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
  192. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
  193. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
  194. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
  195. package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
  196. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -0
  197. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +4 -1
  198. package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +1 -0
  199. package/dist/types/lib/index.d.ts +1 -1
  200. package/package.json +15 -6
  201. package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
  202. package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
  203. package/dist/sankhyablocks/p-145c4434.js +0 -1
  204. package/dist/sankhyablocks/p-17dda7a2.entry.js +0 -1
  205. package/dist/sankhyablocks/p-19f51c6b.entry.js +0 -11
  206. package/dist/sankhyablocks/p-20726710.entry.js +0 -1
  207. package/dist/sankhyablocks/p-311c6173.entry.js +0 -1
  208. package/dist/sankhyablocks/p-4396d1a6.js +0 -56
  209. package/dist/sankhyablocks/p-44e894af.entry.js +0 -1
  210. package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
  211. package/dist/sankhyablocks/p-4b0ea83f.entry.js +0 -1
  212. package/dist/sankhyablocks/p-5534e08c.js +0 -1
  213. package/dist/sankhyablocks/p-78777ae0.entry.js +0 -1
  214. package/dist/sankhyablocks/p-953346b9.entry.js +0 -1
  215. package/dist/sankhyablocks/p-9c3229fc.entry.js +0 -1
  216. package/dist/sankhyablocks/p-a037f5b4.entry.js +0 -1
  217. package/dist/sankhyablocks/p-a702a1a2.js +0 -60
  218. package/dist/sankhyablocks/p-c259545b.entry.js +0 -1
  219. package/dist/sankhyablocks/p-d1677df0.entry.js +0 -1
  220. package/dist/sankhyablocks/p-d4f9ee17.entry.js +0 -1
  221. package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
  222. package/dist/sankhyablocks/p-dd6a8377.js +0 -1
  223. package/dist/sankhyablocks/p-e138e7d4.entry.js +0 -1
  224. package/dist/sankhyablocks/p-e1b29d4c.entry.js +0 -1
  225. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
  226. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
  227. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
  228. /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
  229. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
  230. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
  231. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
@@ -21,5 +21,9 @@ export declare class ConfigStorage {
21
21
  static savePersonalizedFilter(personalizedFilter: IPersonalizedFilter, resourceID: string, configName?: string): Promise<IPersonalizedFilter>;
22
22
  static removePersonalizedFilter(personalizedFilter: IPersonalizedFilter, resourceID: string, configName?: string): Promise<IPersonalizedFilter>;
23
23
  static validatePersonalizedFilter(dataUnitName: string, expression: string): Promise<IValidateFilter>;
24
+ static deleteGridConfigCache(name: string, resourceID: string): Promise<void>;
25
+ static deleteFormConfigCache(name: string, resourceID: string): Promise<void>;
26
+ static deleteFilterBarConfigCache(name: string, resourceID: string): Promise<void>;
27
+ private static deleteConfigCache;
24
28
  private static buildCacheID;
25
29
  }
@@ -1,6 +1,5 @@
1
1
  import { IClientEventResponse } from './interfaces/IClientEventResponse';
2
2
  import { IDataFetcherRecaller } from './recaller/IDataFetcherRecaller';
3
- type ClientEventHandler = (clientEvent: IClientEventResponse, dataFetcherReacaller: IDataFetcherRecaller) => Promise<void>;
4
3
  export declare class DataFetcher {
5
4
  private static appTagName;
6
5
  private static instance;
@@ -39,6 +38,7 @@ export declare class DataFetcher {
39
38
  static hasClientEvent(eventID: String): boolean;
40
39
  static removeClientEvent(eventID: String): boolean;
41
40
  }
41
+ type ClientEventHandler = (clientEvent: IClientEventResponse, dataFetcherReacaller: IDataFetcherRecaller) => void | Promise<void>;
42
42
  export interface RequestListener {
43
43
  onRequestStart(param: RequestListenerParams): void;
44
44
  onRequestEnd(param: RequestListenerParams): void;
@@ -1,6 +1,7 @@
1
1
  import { Change, Record } from "@sankhyalabs/core";
2
- import { SaveResponse, DeleteResponse, DownloadKeyResponse } from "./fecthAttach/interfaces";
3
- export declare class AttachFetcher {
2
+ import { DeleteResponse, DownloadKeyResponse, SaveResponse } from "./interfaces";
3
+ import { AttachFetcherFacadeInterface } from "./facade/attach-fetcher.facade";
4
+ export declare class AnexoSistemaFetcher implements AttachFetcherFacadeInterface {
4
5
  private entityName;
5
6
  private registerKey;
6
7
  private dataUnitName;
@@ -0,0 +1,11 @@
1
+ import { Change, Record } from "@sankhyalabs/core";
2
+ import { SaveResponse, DeleteResponse, DownloadKeyResponse } from "./interfaces";
3
+ import { AttachFetcherFacadeInterface } from "./facade/attach-fetcher.facade";
4
+ export declare class AttachFetcher implements AttachFetcherFacadeInterface {
5
+ private dataUnitName?;
6
+ constructor(dataUnitName?: string);
7
+ save({ dataUnit: dataUnitName, record, updatingFields: fields, operation }: Change): Promise<Array<SaveResponse>>;
8
+ edit(change: Change): Promise<SaveResponse[]>;
9
+ delete(record: Record): Promise<DeleteResponse>;
10
+ getDownloadKey(record: Record): Promise<DownloadKeyResponse>;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { Change, Record } from '@sankhyalabs/core';
2
+ import { DeleteResponse, DownloadKeyResponse, SaveResponse } from '../interfaces';
3
+ export interface AttachFetcherFacadeInterface {
4
+ save(change: Change): Promise<Array<SaveResponse>>;
5
+ edit(change: Change): Promise<Array<SaveResponse>>;
6
+ delete(record: Record): Promise<DeleteResponse>;
7
+ getDownloadKey(record: Record): Promise<DownloadKeyResponse>;
8
+ }
@@ -0,0 +1,3 @@
1
+ export { AttachFetcherFacadeInterface } from "./facade/attach-fetcher.facade";
2
+ export { AttachFetcher } from "./attach-fetcher";
3
+ export { AnexoSistemaFetcher } from "./anexo-sistema-fetcher";
@@ -22,5 +22,6 @@ export type SaveResponse = {
22
22
  export declare enum SaveErrorsEnum {
23
23
  LINK_AND_FILE_AT_THE_SAME_TIME = "LINK_AND_FILE_AT_THE_SAME_TIME",
24
24
  ANY_LINK_OR_FILE_FILLED = "ANY_LINK_OR_FILE_FILLED",
25
- UNKNOWN = "UNKNOWN"
25
+ UNKNOWN = "UNKNOWN",
26
+ DESCRIPTION_CANNOT_BE_CHANGED = "DESCRIPTION_CANNOT_BE_CHANGED"
26
27
  }
@@ -10,6 +10,8 @@ export default class DataUnitFetcher {
10
10
  getDataUnit(entityName: string, resourceID: string, parentDataUnit?: DataUnit, configName?: string): DataUnit;
11
11
  private loadMetadata;
12
12
  loadSelectDistinct(dataUnit: DataUnit, fieldName: string, argument: string): Promise<Array<string>>;
13
+ private addTransientProperties;
14
+ private getUpdatingFields;
13
15
  private saveData;
14
16
  private updateCache;
15
17
  private getTransientInfo;
@@ -1,13 +1,16 @@
1
- import { DataUnit, LoadDataRequest } from "@sankhyalabs/core";
1
+ import { DataUnit, LoadDataRequest } from '@sankhyalabs/core';
2
2
  import { ILoadDataResult } from "../interfaces/ILoadDataResult";
3
3
  import { ILoadDataStrategy } from "../interfaces/ILoadDataStrategy";
4
4
  import { ILoadingInfo } from "../interfaces/ILoadingInfo";
5
5
  export declare class DatasetStrategy implements ILoadDataStrategy {
6
6
  canSlice(): boolean;
7
+ private processSortingSide;
7
8
  load(dataUnit: DataUnit, request: LoadDataRequest, loadingInfo: ILoadingInfo): Promise<ILoadDataResult>;
8
9
  private getFieldsList;
10
+ private getStandAloneFieldsList;
9
11
  private getFieldNames;
10
12
  private buildRequestBody;
13
+ private getModuleName;
11
14
  private getTxProperties;
12
15
  private processRecords;
13
16
  private buildFieldValue;
@@ -1,4 +1,5 @@
1
1
  export default class ParametersFetcher {
2
+ private _embeddedParams;
2
3
  private templateByQuery;
3
4
  constructor();
4
5
  private buldTemplates;
@@ -4,7 +4,7 @@ export { CrudUtils } from './utils/CrudUtils';
4
4
  export { PresentationMode } from "./@types";
5
5
  export { TotalsFetcher } from './http/data-fetcher/fetchers/totals-fetcher';
6
6
  export { default as ApplicationConfigFetcher } from './http/data-fetcher/fetchers/application-config-fetcher';
7
- export { AttachFetcher } from './http/data-fetcher/fetchers/attach-fetcher';
7
+ export { AttachFetcher, AnexoSistemaFetcher, AttachFetcherFacadeInterface } from './http/data-fetcher/fetchers/AttachFetcher';
8
8
  export { Authorization } from './http/data-fetcher/fetchers/auth-fetcher';
9
9
  export { default as DataUnitFetcher } from './http/data-fetcher/fetchers/data-unit/dataunit-fetcher';
10
10
  export { default as FilterBarConfigFetcher } from './http/data-fetcher/fetchers/filter-bar-config-fetcher';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/sankhyablocks",
3
- "version": "8.15.0-dev.2",
3
+ "version": "8.15.0-dev.21",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -20,11 +20,12 @@
20
20
  "react/"
21
21
  ],
22
22
  "scripts": {
23
+ "prebuild": "(test -f ./src/components.d.ts && git checkout ./src/components.d.ts) || true",
23
24
  "build": "stencil build --docs",
24
- "build.prod": "stencil build --docs --prod",
25
+ "build.prod": "npm run prebuild && stencil build --docs --prod",
25
26
  "build.with.peerdeps": "stencil build --docs --prod --force-peer-deps",
26
27
  "start": "stencil build --dev --watch --serve --force-peer-deps",
27
- "test": "stencil test --spec --e2e",
28
+ "test": "stencil test --spec --e2e --coverage --silent --testResultsProcessor jest-sonar-reporter",
28
29
  "test.watch": "stencil test --spec --e2e --watchAll",
29
30
  "generate": "stencil generate",
30
31
  "build.css.docs": "node docscsstask.js",
@@ -42,9 +43,9 @@
42
43
  "@babel/preset-env": "^7.18.2",
43
44
  "@commitlint/cli": "^18.4.3",
44
45
  "@commitlint/config-conventional": "^18.4.3",
45
- "@sankhyalabs/core": "^5.11.0",
46
+ "@sankhyalabs/core": "^5.16.0",
46
47
  "@sankhyalabs/docscss": "^1.0.4",
47
- "@sankhyalabs/ezui": "^5.14.0",
48
+ "@sankhyalabs/ezui": "^5.19.4",
48
49
  "@sankhyalabs/skippeerdeps": "^1.0.2",
49
50
  "@stencil/core": "^2.13.0",
50
51
  "@stencil/react-output-target": "0.0.9",
@@ -57,11 +58,19 @@
57
58
  "husky": "^8.0.3",
58
59
  "jest": "^27.4.5",
59
60
  "jest-cli": "^27.4.5",
61
+ "jest-sonar-reporter": "^2.0.0",
60
62
  "puppeteer": "^10.0.0",
61
63
  "redux": "^4.1.2"
62
64
  },
63
65
  "jest": {
64
- "verbose": true
66
+ "verbose": true,
67
+ "testResultsProcessor": "jest-sonar-reporter"
68
+ },
69
+ "jestSonar": {
70
+ "sonar56x": true,
71
+ "reportPath": "reports",
72
+ "reportFile": "test-report.xml",
73
+ "indent": 4
65
74
  },
66
75
  "peerDependencies": {
67
76
  "@sankhyalabs/core": "^5.0.0",
@@ -1,167 +0,0 @@
1
- 'use strict';
2
-
3
- const core = require('@sankhyalabs/core');
4
- const DataFetcher = require('./DataFetcher-ba94ed5b.js');
5
-
6
- class PesquisaFetcher {
7
- constructor() {
8
- this._defaultPageSize = 100;
9
- this._templateByQuery = new Map();
10
- this._searchListenersByDataUnit = new Map();
11
- this.buldTemplates();
12
- }
13
- buldTemplates() {
14
- this._templateByQuery.set("search", DataFetcher.dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
15
- $queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
16
- value
17
- label
18
- }
19
- }`);
20
- }
21
- loadSearchOptions(entityName, argument, criteria, options) {
22
- var _a;
23
- const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
24
- argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
25
- criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
26
- if (param.dataType === core.DataType.OBJECT) {
27
- param.value = JSON.stringify(param.value);
28
- }
29
- });
30
- const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
31
- const values = {
32
- argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
33
- entityName,
34
- criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
35
- options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
36
- };
37
- if (values.options) {
38
- (_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
39
- }
40
- return new Promise((resolve, reject) => {
41
- DataFetcher.DataFetcher.get()
42
- .callGraphQL({
43
- values,
44
- query: this._templateByQuery.get("search"),
45
- })
46
- .then((result) => {
47
- resolve(result);
48
- })
49
- .catch((error) => {
50
- reject(error);
51
- });
52
- });
53
- }
54
- loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
55
- var _a, _b, _c;
56
- const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
57
- const values = {
58
- argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
59
- criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
60
- searchOptions: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || searchOptions,
61
- };
62
- const serviceName = "PesquisaSP.getSuggestion";
63
- const externalCriteria = {
64
- query: {
65
- $: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
66
- }
67
- };
68
- if (((_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params.length) > 0) {
69
- externalCriteria.params = {
70
- param: values.criteria.params.map(param => {
71
- let value = param.value;
72
- let type = param.dataType;
73
- if (type === core.DataType.OBJECT) {
74
- value = value.value;
75
- type = "S";
76
- }
77
- else {
78
- type = convertParamType(param.dataType);
79
- }
80
- return { $: value, type };
81
- })
82
- };
83
- }
84
- const options = searchOptions != undefined
85
- ? {
86
- "pkFieldName": searchOptions.codeFieldName,
87
- "label": searchOptions.descriptionFieldName,
88
- "fieldName": searchOptions.codeFieldName,
89
- "useDescriptionOptions": false,
90
- "enableRowsCounter": true
91
- }
92
- : undefined;
93
- const reqBody = {
94
- "serviceName": serviceName,
95
- "requestBody": {
96
- "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_c = values.searchOptions) === null || _c === void 0 ? void 0 : _c.rootEntity }, { options }),
97
- "clientEventList": {
98
- "clientEvent": []
99
- }
100
- }
101
- };
102
- return new Promise((resolve, reject) => {
103
- DataFetcher.DataFetcher.get()
104
- .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
105
- .then(result => resolve(result))
106
- .catch(error => reject(error));
107
- });
108
- }
109
- addSearchListener(entityName, dataUnitID, listener) {
110
- var _a;
111
- const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
112
- const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
113
- if (!entityListener) {
114
- this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
115
- }
116
- else {
117
- for (const type of Object.keys(listener)) {
118
- if (type in entityListener.listener) {
119
- const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
120
- if (listenerFunctionIsEquals)
121
- continue;
122
- entityListener.listener[type] = listener[type];
123
- }
124
- }
125
- }
126
- return () => {
127
- const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
128
- if (!newListeners.length) {
129
- this._searchListenersByDataUnit.delete(dataUnitID);
130
- return;
131
- }
132
- this._searchListenersByDataUnit.set(dataUnitID, newListeners);
133
- };
134
- }
135
- applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
136
- var _a;
137
- const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
138
- if (!dataUnitId)
139
- return;
140
- const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
141
- if (!entityListener)
142
- return;
143
- const { listener } = entityListener;
144
- if (!(listenerType in listener))
145
- return;
146
- return listener[listenerType]({ argument, criteria, searchOptions });
147
- }
148
- }
149
- function convertParamType(dataType) {
150
- //Alerta: Cuidado pra não contaminar o DataType com a implementação
151
- //atual da pesquisa... em geral, somente inteiros,
152
- //data (com ou sem hora) e string são realmente relevantes
153
- switch (dataType) {
154
- case core.DataType.NUMBER:
155
- return "I";
156
- case core.DataType.DATE:
157
- return "D";
158
- default:
159
- return "S";
160
- }
161
- }
162
- var SearchListenerType;
163
- (function (SearchListenerType) {
164
- SearchListenerType["beforeSearch"] = "beforeSearch";
165
- })(SearchListenerType || (SearchListenerType = {}));
166
-
167
- exports.PesquisaFetcher = PesquisaFetcher;
@@ -1,165 +0,0 @@
1
- import { DataType } from '@sankhyalabs/core';
2
- import { d as dist, D as DataFetcher } from './DataFetcher-aa159c5a.js';
3
-
4
- class PesquisaFetcher {
5
- constructor() {
6
- this._defaultPageSize = 100;
7
- this._templateByQuery = new Map();
8
- this._searchListenersByDataUnit = new Map();
9
- this.buldTemplates();
10
- }
11
- buldTemplates() {
12
- this._templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
13
- $queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
14
- value
15
- label
16
- }
17
- }`);
18
- }
19
- loadSearchOptions(entityName, argument, criteria, options) {
20
- var _a;
21
- const cleanText = (argument === null || argument === void 0 ? void 0 : argument.toString().trim()) || undefined;
22
- argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
23
- criteria === null || criteria === void 0 ? void 0 : criteria.params.forEach(param => {
24
- if (param.dataType === DataType.OBJECT) {
25
- param.value = JSON.stringify(param.value);
26
- }
27
- });
28
- const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, options);
29
- const values = {
30
- argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
31
- entityName,
32
- criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
33
- options: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || options,
34
- };
35
- if (values.options) {
36
- (_a = values.options) === null || _a === void 0 ? true : delete _a.dataUnitId;
37
- }
38
- return new Promise((resolve, reject) => {
39
- DataFetcher.get()
40
- .callGraphQL({
41
- values,
42
- query: this._templateByQuery.get("search"),
43
- })
44
- .then((result) => {
45
- resolve(result);
46
- })
47
- .catch((error) => {
48
- reject(error);
49
- });
50
- });
51
- }
52
- loadAdvancedSearch(entityName, argument, criteria, searchOptions) {
53
- var _a, _b, _c;
54
- const listenerResult = this.applySearchListener(SearchListenerType.beforeSearch, entityName, argument, criteria, searchOptions);
55
- const values = {
56
- argument: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.argument) || argument,
57
- criteria: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.criteria) || criteria,
58
- searchOptions: (listenerResult === null || listenerResult === void 0 ? void 0 : listenerResult.searchOptions) || searchOptions,
59
- };
60
- const serviceName = "PesquisaSP.getSuggestion";
61
- const externalCriteria = {
62
- query: {
63
- $: (_a = values.criteria) === null || _a === void 0 ? void 0 : _a.expression
64
- }
65
- };
66
- if (((_b = values.criteria) === null || _b === void 0 ? void 0 : _b.params.length) > 0) {
67
- externalCriteria.params = {
68
- param: values.criteria.params.map(param => {
69
- let value = param.value;
70
- let type = param.dataType;
71
- if (type === DataType.OBJECT) {
72
- value = value.value;
73
- type = "S";
74
- }
75
- else {
76
- type = convertParamType(param.dataType);
77
- }
78
- return { $: value, type };
79
- })
80
- };
81
- }
82
- const options = searchOptions != undefined
83
- ? {
84
- "pkFieldName": searchOptions.codeFieldName,
85
- "label": searchOptions.descriptionFieldName,
86
- "fieldName": searchOptions.codeFieldName,
87
- "useDescriptionOptions": false,
88
- "enableRowsCounter": true
89
- }
90
- : undefined;
91
- const reqBody = {
92
- "serviceName": serviceName,
93
- "requestBody": {
94
- "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": values.argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": (_c = values.searchOptions) === null || _c === void 0 ? void 0 : _c.rootEntity }, { options }),
95
- "clientEventList": {
96
- "clientEvent": []
97
- }
98
- }
99
- };
100
- return new Promise((resolve, reject) => {
101
- DataFetcher.get()
102
- .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
103
- .then(result => resolve(result))
104
- .catch(error => reject(error));
105
- });
106
- }
107
- addSearchListener(entityName, dataUnitID, listener) {
108
- var _a;
109
- const dataUnitSearchListeners = this._searchListenersByDataUnit.get(dataUnitID) || [];
110
- const entityListener = dataUnitSearchListeners.find(currentListener => currentListener.entity === entityName);
111
- if (!entityListener) {
112
- this._searchListenersByDataUnit.set(dataUnitID, [...dataUnitSearchListeners, { entity: entityName, listener }]);
113
- }
114
- else {
115
- for (const type of Object.keys(listener)) {
116
- if (type in entityListener.listener) {
117
- const listenerFunctionIsEquals = ((_a = entityListener.listener[type]) === null || _a === void 0 ? void 0 : _a.toString()) === listener[type].toString();
118
- if (listenerFunctionIsEquals)
119
- continue;
120
- entityListener.listener[type] = listener[type];
121
- }
122
- }
123
- }
124
- return () => {
125
- const newListeners = dataUnitSearchListeners.filter(currentListener => currentListener.entity !== entityName);
126
- if (!newListeners.length) {
127
- this._searchListenersByDataUnit.delete(dataUnitID);
128
- return;
129
- }
130
- this._searchListenersByDataUnit.set(dataUnitID, newListeners);
131
- };
132
- }
133
- applySearchListener(listenerType, entityName, argument, criteria, searchOptions) {
134
- var _a;
135
- const dataUnitId = searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.dataUnitId;
136
- if (!dataUnitId)
137
- return;
138
- const entityListener = (_a = this._searchListenersByDataUnit.get(dataUnitId)) === null || _a === void 0 ? void 0 : _a.find(({ entity }) => entity === entityName);
139
- if (!entityListener)
140
- return;
141
- const { listener } = entityListener;
142
- if (!(listenerType in listener))
143
- return;
144
- return listener[listenerType]({ argument, criteria, searchOptions });
145
- }
146
- }
147
- function convertParamType(dataType) {
148
- //Alerta: Cuidado pra não contaminar o DataType com a implementação
149
- //atual da pesquisa... em geral, somente inteiros,
150
- //data (com ou sem hora) e string são realmente relevantes
151
- switch (dataType) {
152
- case DataType.NUMBER:
153
- return "I";
154
- case DataType.DATE:
155
- return "D";
156
- default:
157
- return "S";
158
- }
159
- }
160
- var SearchListenerType;
161
- (function (SearchListenerType) {
162
- SearchListenerType["beforeSearch"] = "beforeSearch";
163
- })(SearchListenerType || (SearchListenerType = {}));
164
-
165
- export { PesquisaFetcher as P };
@@ -1 +0,0 @@
1
- import{h as e}from"./p-d2d301a6.js";import{P as t}from"./p-5534e08c.js";import{s as n}from"./p-6dc031de.js";var a,r,s;!function(e){e.PREVIOUS="PREVIOUS",e.NEXT="NEXT",e.REFRESH="REFRESH",e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CANCEL="CANCEL",e.SAVE="SAVE",e.GRID_MODE="GRID_MODE",e.FORM_MODE="FORM_MODE",e.MORE_OPTIONS="MORE_OPTIONS",e.DIVIDER="DIVIDER",e.CONFIGURATOR="CONFIGURATOR",e.DATA_EXPORTER="DATA_EXPORTER",e.ATTACH="ATTACH",e.ACTIONS_BUTTON="ACTIONS_BUTTON"}(a||(a={})),function(e){e.UPDATE="UPDATE",e.CLONE="CLONE",e.REMOVE="REMOVE",e.INSERT="INSERT",e.CONFIGURATOR="CONFIGURATOR"}(r||(r={})),function(e){e.CONFIGURATOR="CONFIGURATOR"}(s||(s={}));const i=(e,t,n,a,r)=>{const{hint:s,text:i,iconName:c}=e;return c?i?d(c,e.name,t,n,s,i,a,r):l(c,e.name,t,n,s,a,r):o(e.name,t,n,i,s,a,r)},c=(r,s,i,c,u,m,E,O,R)=>{var T;const b=c(r);switch(r){case a.PREVIOUS:return l("chevron-left",r,s,i,b,u,m);case a.NEXT:return l("chevron-right",r,s,i,b,u,m);case a.REFRESH:return l("sync",r,s,i,b,u,m);case a.UPDATE:return l("edit",r,s,i,b,u,m);case a.CLONE:return l("copy",r,s,i,b,u,m);case a.REMOVE:return l("delete",r,s,i,b,u,m);case a.INSERT:return R===t.PRIMARY?d("plus",r,s,i,b,b,u,m):l("plus",r,s,i,b,u,m);case a.CANCEL:return o(r,s,i,b,b,u,m);case a.SAVE:return R===t.PRIMARY?d("save",r,s,i,b,b,u,m):l("save",r,s,i,b,u,m);case a.GRID_MODE:return l("table",r,s,i,b,u,m);case a.FORM_MODE:return l("list",r,s,i,b,u,m);case a.CONFIGURATOR:return l("settings-inverted",r,s,i,b,u,m);case a.MORE_OPTIONS:return function(t,n,a,r,s,i){return s&&s.length>0?e("taskbar-actions-button",{key:n,title:a,"data-element-id":n,enabled:r(t),actions:s,onTaskbarActionSelected:e=>i(e.detail.value)}):void 0}(r,i,b,m,E,u);case a.DIVIDER:return e("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-horizontal--medium","data-taskbar-divider":!0});case a.DATA_EXPORTER:const c=null===(T=n.get("exporterProviders"))||void 0===T?void 0:T[O];return e("snk-data-exporter",{class:s,provider:c,"data-element-id":i});case a.ATTACH:return l("anexo",r,s,i,b,u,m);case a.ACTIONS_BUTTON:return e("snk-actions-button",{"data-element-id":i})}};function o(t,n,a,r,s,i,c){return e("ez-button",{key:a,title:s,label:r,size:"small",class:n,"data-element-id":a,enabled:c(t),onClick:()=>i(t)})}function l(t,n,a,r,s,i,c){return e("ez-button",{key:r,title:s,mode:"icon",size:"small",class:a,"data-element-id":r,iconName:t,enabled:c(n),onClick:()=>i(n)})}function d(t,n,a,r,s,i,c,o){return e("ez-button",{key:r,title:i,label:s,size:"small",class:a,"data-element-id":r,enabled:o(n),onClick:()=>c(n)},e("ez-icon",{class:"ez-padding-right--small",slot:"leftIcon",iconName:t}))}export{r as A,a as T,s as V,i as a,c as b}
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as s,g as e}from"./p-d2d301a6.js";import{ObjectUtils as a,ApplicationContext as n,DataType as o,UserInterface as r,StringUtils as l,JSUtils as d,FloatingManager as h}from"@sankhyalabs/core";import{d as u,S as c}from"./p-b0ef4383.js";import{T as m}from"./p-145c4434.js";import"./p-9695f78b.js";import"./p-d9bb09b3.js";import{P as p}from"./p-5534e08c.js";import"./p-9e7d65a4.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import{I as v}from"./p-a702a1a2.js";import"./p-c22c1d8e.js";import"./p-ff1990ad.js";import"./p-0d7863ed.js";import{T as b,b as k,o as g}from"./p-c2495304.js";import{S}from"./p-094c30cb.js";import"./p-6dc031de.js";import"./p-8d884fab.js";import"./p-688dcb4c.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";const f=class{constructor(s){i(this,s),this.dataStateChange=t(this,"dataStateChange",3),this.dataUnitReady=t(this,"dataUnitReady",3),this.actionClick=t(this,"actionClick",7),this.formItemsReady=t(this,"formItemsReady",7),this.REGULAR_DEFAULT_BTNS=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","MORE_OPTIONS"],this.REGULAR_SELECTED_BTNS=["INSERT","REFRESH","PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","DIVIDER","MORE_OPTIONS"],this._multiSelectionListDataSource=new S,this._keyDownHandler=i=>this.keyDownListener(i),this._taskbarProcessor=new b({"snkSimpleCrudTaskbar.form_regular":this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(m.GRID_MODE),"snkSimpleCrudTaskbar.grid_regular":this.resolveInMemoryBtns(this.REGULAR_DEFAULT_BTNS).concat(m.FORM_MODE),"snkSimpleCrudTaskbar.form_selected":this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(m.GRID_MODE),"snkSimpleCrudTaskbar.grid_selected":this.resolveInMemoryBtns(this.REGULAR_SELECTED_BTNS).concat(m.FORM_MODE),"snkSimpleCrudTaskbar.finish_edition":["CANCEL","SAVE"]}),this._currentViewMode=u.GRID,this._config=void 0,this._fieldToGetFocus=void 0,this.dataState=void 0,this.dataUnit=void 0,this.mode=c.SERVER,this.gridConfig=void 0,this.formConfig=void 0,this._formFields=[],this.multipleSelection=void 0,this.useCancelConfirm=!0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.useEnterLikeTab=!1}resolveInMemoryBtns(i){const t=[...i];return this.mode===c.IN_MEMORY&&t.splice(1,1),t}async goToView(i){this._currentViewMode=i,this._viewStack&&this._viewStack.show(i)}actionClickListener(i){const t=i.detail;t===m.GRID_MODE?this.goToView(u.GRID):t===m.FORM_MODE&&this.goToView(u.FORM),i.stopPropagation()}onModeChange(){this.mode==c.IN_MEMORY&&this.initInMemoryDataUnit()}observeDataState(i,t){a.objectToString(t)!=a.objectToString(i)&&this.dataStateChange.emit(i)}componentWillRender(){this._taskbarProcessor.process(this.getTaskBarId(),this.taskbarManager,this.dataState,this.getTaskBarDisabledButtons())}componentWillLoad(){this.processMetadata(),this.onModeChange(),this.configDatasource()}configDatasource(){const i=n.getContextValue("__SNK__APPLICATION__");this._multiSelectionListDataSource.setApplication(i),this._multiSelectionListDataSource.setDataUnit(this.dataUnit)}getTaskBarId(){var i,t,s;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkSimpleCrudTaskbar.finish_edition":(null===(t=this.dataState)||void 0===t?void 0:t.selectionInfo)&&!this.dataState.selectionInfo.isAllRecords()&&(null===(s=this.dataState.selectionInfo.records)||void 0===s?void 0:s.length)>0?this._currentViewMode===u.GRID?"snkSimpleCrudTaskbar.grid_selected":"snkSimpleCrudTaskbar.form_selected":this._currentViewMode===u.GRID?"snkSimpleCrudTaskbar.grid_regular":"snkSimpleCrudTaskbar.form_regular"}initInMemoryDataUnit(){this._inMemoryLoader=new v(this._metadata),this.dataUnit=this._inMemoryLoader.dataUnit,this.dataUnitReady.emit(this.dataUnit)}setMetadata(i){return this._inMemoryLoader?this._inMemoryLoader.metadata=i:this.dataUnit&&(this.dataUnit.metadata=i),Promise.resolve()}setRecords(i){return this._inMemoryLoader?this._inMemoryLoader.records=i:this.dataUnit&&(this.dataUnit.records=i),Promise.resolve()}getRecords(){return Promise.resolve(this.dataUnit.records)}processMetadata(){const i=this._element.querySelectorAll("snk-field-metadata"),t=[],s={fields:[],emptyConfig:!1};i.forEach((i=>{const e={name:i.getAttribute("name")||i.getAttribute("label"),label:i.getAttribute("label"),dataType:o[i.getAttribute("dataType")]||o.TEXT,userInterface:r[i.getAttribute("userInterface")]||r.SHORTTEXT,readOnly:"true"==i.getAttribute("readOnly"),required:"true"==i.getAttribute("required"),tab:i.getAttribute("tab")||void 0,visible:"false"!=i.getAttribute("visible")};s.fields.push({name:e.name,tab:e.tab,visible:e.visible}),t.push(e)})),t.length>0&&(this.formConfig||(this.formConfig=s),this._metadata={name:"SimpleCrud",label:"SimpleCrud",fields:t})}onDataStateChange(i){this.dataState=Object.assign({},i.detail)}getTaskBarDisabledButtons(){var i,t,s,e;const a=[];return(null===(i=this.dataState)||void 0===i?void 0:i.hasNext)||a.push(m.NEXT),(null===(t=this.dataState)||void 0===t?void 0:t.hasPrevious)||a.push(m.PREVIOUS),(null===(e=null===(s=this.dataState)||void 0===s?void 0:s.selectionInfo)||void 0===e?void 0:e.isEmpty())&&a.push(m.FORM_MODE),a}handleCancelEdit(){var i;(null===(i=this.dataState)||void 0===i?void 0:i.recordsIsEmpty)&&(this.goToView(u.GRID),this.dataUnit.clearSelection())}getColumnSearch(i,t){return null!=this._columnSearch||(this._moreOptions=i,this._columnSearch=k(t,(({argument:i})=>new Promise((t=>{this._grid.filterColumns(i).then((i=>{t(i.filter((i=>!i.hidden)).map((i=>({label:i.label,value:i.name}))))}))}))),(t=>{var s;null!=t&&(this._grid.locateColumn(t.value),null===(s=i.hideActions)||void 0===s||s.call(i))}))),this._columnSearch}onSelectField(i,t){null!=i&&(this._fieldToGetFocus=i.value,t.hideActions())}getFieldSearch(i,t){return null!=this._fieldSearch||(this._moreOptions=i,i.addEventListener("ezPopoverOpen",(()=>this.findField())),this._fieldSearch=k(t,(({argument:i})=>this.fieldsOptionLoader(i)),(t=>this.onSelectField(t,i)))),this._fieldSearch}getFormFields(){var i,t;return null!==(t=null===(i=this.formConfig)||void 0===i?void 0:i.fields)&&void 0!==t?t:this._formFields}handleFormSetFields(i){this._formFields=null!=i?i:[]}fieldsOptionLoader(i){const t=null==i?void 0:i.toLowerCase(),s=this.getFormFields().map((i=>{var t;return null===(t=this.dataUnit)||void 0===t?void 0:t.getField(i.name)})).filter((i=>{var s,e;return(null===(s=i.name)||void 0===s?void 0:s.toLowerCase().includes(t))||(null===(e=i.label)||void 0===e?void 0:e.toLowerCase().includes(t))})).map((i=>({value:i.name,label:i.label})));return Promise.resolve(s)}getActionsList(){var i,t;return[{value:l.generateUUID(),label:null!==(t=null===(i=this.messagesBuilder)||void 0===i?void 0:i.getMessage("snkSimpleCrud.findColumn",void 0))&&void 0!==t?t:"Buscar",disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this._currentViewMode===u.GRID?this.getColumnSearch(i,t):this.getFieldSearch(i,t)}]}async keyDownListener(i){i.ctrlKey&&null!=i.key&&"F"===i.key.toUpperCase()&&null!=this._element&&(d.isHiddenElement(this._element)||(h.closeAll(),this._currentViewMode===u.GRID?await this.findColumn():await this.findField(),i.preventDefault()))}async findField(){await this.openSeach(this._fieldSearch)}async findColumn(){await this.openSeach(this._columnSearch)}async openSeach(i){await g(this._moreOptions,i)}clearFieldToFocusHandler(){this._fieldToGetFocus=void 0}connectedCallback(){window.addEventListener("keydown",this._keyDownHandler,{capture:!0})}disconnectedCallback(){window.removeEventListener("keydown",this._keyDownHandler)}render(){var i;return s("snk-data-unit",{class:"simple-crud__container",dataUnit:this.dataUnit,useCancelConfirm:this.useCancelConfirm,onDataStateChange:i=>this.onDataStateChange(i),onCancelEdition:this.handleCancelEdit.bind(this),onInsertionMode:()=>this.goToView(u.FORM),onDataUnitReady:i=>this.dataUnitReady.emit(i.detail),ignoreSaveMessage:this._currentViewMode===u.GRID,onMessagesBuilderUpdated:i=>this.messagesBuilder=i.detail},s("header",null,s("slot",{name:"snkSimpleCrudHeader"})),s("section",{class:"ez-box ez-box--shadow simple-crud__container-section"},s("snk-taskbar",{class:"ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large",dataUnit:this.dataUnit,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.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:p.SECONDARY},s("slot",{name:"TASKBAR_CUSTOM_ELEMENTS"})),s("ez-view-stack",{ref:i=>this._viewStack=i,"data-element-id":"simple-crud"},s("stack-item",null,s("ez-grid",{ref:i=>this._grid=i,dataUnit:this.dataUnit,config:this.gridConfig,"no-header":!0,multipleSelection:this.multipleSelection,onEzDoubleClick:()=>this.goToView(u.FORM),columnfilterDataSource:this.dataUnit.name.includes(v.IN_MEMORY_DATA_UNIT_NAME)?void 0:this._multiSelectionListDataSource,useEnterLikeTab:this.useEnterLikeTab},s("div",{slot:"footer"},s("slot",{name:"snkSimpleCrudFooter"})))),s("stack-item",null,s("ez-form",{dataUnit:this.dataUnit,config:this.formConfig,fieldToFocus:this._fieldToGetFocus,onEzFormSetFields:i=>this.handleFormSetFields(i.detail),onEzFormRequestClearFieldToFocus:this.clearFieldToFocusHandler.bind(this)})))))}get _element(){return e(this)}static get watchers(){return{mode:["onModeChange"],dataState:["observeDataState"]}}};f.style=".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:max-content;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";export{f as snk_simple_crud}
@@ -1,11 +0,0 @@
1
- import{r as t,c as s,h as e,g as i}from"./p-d2d301a6.js";import{DateUtils as n,StringUtils as r,ObjectUtils as a,WaitingChangeException as o,WarningException as c,ErrorException as h,KeyboardManager as u,OnboardingUtils as l,DependencyType as p,ElementIDUtils as d,ApplicationContext as m,DataType as w,ErrorTracking as y}from"@sankhyalabs/core";import{ApplicationUtils as f}from"@sankhyalabs/ezui/dist/collection/utils";import{C as P}from"./p-4396d1a6.js";import{d as v,D as g,U as A}from"./p-9695f78b.js";import{A as _,a as I}from"./p-e6380c60.js";import{D as S}from"./p-a702a1a2.js";import{P as N}from"./p-d9bb09b3.js";import{S as b}from"./p-ff6064e7.js";import"./p-0d7863ed.js";import"./p-ff1990ad.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-c22c1d8e.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"./p-688dcb4c.js";class D{static webConnectionCaller(t,s,e){var i;null===(i=window.AppletCaller)||void 0===i||i.webConnectionCaller(t,s,e)}}const C=k;function k(t,s){const e=E();return(k=function(t){return e[t-=378]})(t,s)}function E(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(E=function(){return t})()}!function(){const t=k,s=E();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class L{[C(397)](t){const s=C;if(typeof(t=utxt(t[s(390)]))==s(392)&&(t=JSON[s(400)](t)),null==t)throw Error(s(395));const e=new T("S"===t[s(402)]||!0===t[s(402)]);return Array[s(394)](t[s(391)])&&t[s(391)][s(385)]((t=>e.putAccess(t[s(382)],String(t.status)==s(398)))),e}}class T{constructor(t){const s=C;this.isSup=t,this[s(384)]={}}[C(378)](t,s){this[C(384)][t]=s}[C(393)](t){const s=C;if(this[s(402)])return!0;let e=!0;return this[s(384)][s(380)](t)&&(e=this.actions[t]),e}isUserSup(){return this.isSup}}class O{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",v.gql`query($name: String!) {
2
- $queryAlias$: fetchResource(name: $name){
3
- name
4
- resource
5
- }
6
- }`)}async getParam(t){const s=`param://application?params=${t}`;return g.get().callGraphQL({values:{name:s},query:this.templateByQuery.get("fetchParam")})}async asString(t){const s=await this.getParam(t);return this.getValue(s)}async asInteger(t){const s=await this.getParam(t);return parseInt(this.getValue(s))}async asFloat(t){const s=await this.getParam(t);return parseFloat(this.getValue(s))}async asBoolean(t){const s=await this.getParam(t);return"S"===this.getValue(s)}async asDate(t){const s=await this.getParam(t);return n.strToDate(this.getValue(s))}async getBatchParams(t){const s=await this.getParam(t.join(",")),e={};return s.forEach((t=>e[t.name]=t.resource)),e}getValue(t={}){if(Array.isArray(t)&&t.length>0&&(t=t[0]),r.isEmpty(t.resource))return"";try{const s=a.stringToObject(t.resource),[e]=Object.keys(s);return s[e]}catch(t){console.warn("Erro ao converter string JSON.")}}}class j{constructor(){this.templateByQuery=new Map,this.cancel=[],this.buildTemplates()}buildTemplates(){this.templateByQuery.set("fetchTotals",v.gql`query($filters: [InputFilter!] $name: String!) {
7
- $queryAlias$: fetchTotals(name: $name, filters: $filters ){
8
- name
9
- value
10
- }
11
- }`)}fetchTotals(t,s,e=[]){const i=`${t}_${s}`,n=this.cancel.findIndex((t=>t[i]));return n>=0&&(this.cancel[n][i](),this.cancel.splice(n,1)),Promise.race([new Promise((t=>this.cancel.push({[i]:t}))),this.getTotals(t,s,e)]).then((t=>{let s=new Map;if(t){s=t;const e=this.cancel.findIndex((t=>t[i]));e>=0&&this.cancel.splice(e,1)}return s}))}getTotals(t,s,e=[]){return new Promise(((i,n)=>{g.get().callGraphQL({query:this.templateByQuery.get("fetchTotals"),values:{name:`totals://${t}/${s}`,filters:e}}).then((t=>{if(t.length>0){const s=new Map;return t.forEach((t=>s.set(t.name,parseFloat(t.value)))),i(s)}return n("Não foi possível recuperar os totalizadores")})).catch(n)}))}}function U(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(U=function(){return t})()}const M=$;function $(t,s){const e=U();return($=function(t){return e[t-=392]})(t,s)}!function(){const t=$,s=U();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const R=M(396);var F;class q{static openAppActivity(t,s){var e;null===(e=window.workspace)||void 0===e||e.openAppActivity(t,s)}static getAppLabel(t){if(null!=(null===window||void 0===window?void 0:window.workspace))return null==window.workspace.getAppLabel&&(window.workspace.getAppLabel=t=>(t||"").split(".").pop()),window.workspace.getAppLabel(t)}static setScreenToUseV3Layout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseV3Layout()}static setScreenToUseOldLayout(){var t;null===(t=window.workspace)||void 0===t||t.setScreenToUseOldLayout()}static showDesktop(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.showDesktop)||void 0===s||s.call(t)}static searchApp(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.searchApp)||void 0===s||s.call(t)}static openHelp(){var t,s;null===(s=null===(t=window.workspace)||void 0===t?void 0:t.openHelp)||void 0===s||s.call(t)}static applicationClick(){var t,s;(null===(t=window.workspace)||void 0===t?void 0:t.applicationClick)&&(null===(s=window.workspace)||void 0===s||s.applicationClick())}}q.resourceID=null===(F=window.workspace)||void 0===F?void 0:F.resourceID;class z{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const s=t.reason;s instanceof o||(s?this.processException(s):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t.errorCode)),t instanceof o||t instanceof c?this._app.alert(t.title,t.message):t instanceof h?this._app.error(t.title,t.message):this._app.isDebugMode().then((s=>{if(s)if(t instanceof Error)this._app.error(t.name,t.message);else{const s=(null==t?void 0:t.title)||"Erro detectado",e="string"==typeof t?t:t.message||`Erro interno "${a.objectToString(t)}"`;this._app.error(s,e)}}))}}const x=class{constructor(e){t(this,e),this.applicationLoaded=s(this,"applicationLoaded",7),this.applicationLoading=s(this,"applicationLoading",7),this.NEW_VERSION_POPUP_LOCKER="NEW_VERSION_POPUP_LOCKER",this._authPromises=[],this._keyboardManager=new u,this._waitingAppReady=new Array,this._duCache=new Map,this._duPromises=new Map,this._requestListener=new B,this._pendingActions=new Map,this._isLoadedByPk=!1,this.messagesBuilder=void 0,this.configName=void 0,this.loadByPK=void 0}async processPendingActions(t){const s=this._pendingActions.get(t);s&&s.length&&(s.forEach((t=>t())),this._pendingActions.set(t,[]))}get parameters(){return this._parameters||(this._parameters=new O),this._parameters}async getAuth(t){return null==t?this.getApplicationAuth():new Promise(((s,e)=>{this.authFetcher.getData(t).then((t=>{s(t)})).catch((t=>{e(t)}))}))}async getApplicationAuth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,s)=>{const e=this._authPromises.length>0;this._authPromises.push(new K(t,s)),e||this.authFetcher.getData(this.applicationResourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async getKeyboardManager(){return Promise.resolve(this._keyboardManager)}async isUserSup(){return new Promise(((t,s)=>{this.getAuth().then((e=>{this.getAuthList(e).then((s=>{t(s.isSup)})).catch((t=>s(t)))}))}))}async addPendingAction(t,s){var e;const i=null!==(e=this._pendingActions.get(t))&&void 0!==e?e:[];this._pendingActions.set(t,[...i,s])}async callServiceBroker(t,s,e){return g.get().callServiceBroker(t,s,e)}async initOnboarding(t){this.hasToShowNewVersionPopup()?await this.addPendingAction(this.NEW_VERSION_POPUP_LOCKER,(()=>this.doInitOnboarding(t))):this.doInitOnboarding(t)}doInitOnboarding(t){l.getInstance().init(t,window.envContext)}async hasAccess(t,s){return new Promise(((e,i)=>{this.getAuth(s).then((s=>{this.getAuthList(s).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>i(t)))}))}))}async getAllAccess(t){return new Promise(((s,e)=>{this.getAuth(t).then((t=>{this.getAuthList(t).then((t=>{const e={};e.isSup=t.isSup,Object.entries(_).forEach((s=>{e[s[0]]=t.actions[s[1]]||!1})),s(e)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,s="full",e=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=s,this._popUp.useHeader=e,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}showAlerts(t){return f.showAlerts({alerts:t})}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const s=t.split(",");return new Promise(((t,e)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(s.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((s=>{t(s.includes("1"))})).catch((t=>{e(t)}))})).catch((t=>{e(t)}))}))}async getConfig(t){let s={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,e)=>{g.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(s)).then((s=>{var e;return t(null===(e=s.config)||void 0===e?void 0:e.data)})).catch((t=>e(t)))}))}async saveConfig(t,s){let e={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:s}}};return new Promise(((t,s)=>{g.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(e)).then((s=>t(s))).catch((t=>s(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,s){q.openAppActivity(t,s)}async webConnection(t,s,e){this.getStringParam(t).then((t=>{D.webConnectionCaller(t,s,e)}))}getDuPromissesStack(t){let s;return t&&(s=this._duPromises.get(t),s||(s=[],this._duPromises.set(t,s))),s||[]}async createDataunit(t,s,e,i,n){return null==n&&(n=this.applicationResourceID),new Promise(((r,a)=>{const o=this.getDuPromissesStack(s),c=o.length>0;if(o.push(new K(r,a)),!c){const r=this.dataUnitFetcher.getDataUnit(t,n,e,i);r.loadMetadata().then((()=>{for(s&&this.updateDataunitCache(void 0,s,r);o.length>0;)o.pop().resolve(r)})).catch((t=>{for(;o.length>0;)o.pop().reject(t)}))}}))}async updateDataunitCache(t,s,e){t&&this._duCache.delete(t),this._duCache.set(s,e)}async getDataUnit(t,s,e,i,n){return new Promise(((r,a)=>{const o=this._duCache.get(s);o?r(o):this.createDataunit(t,s,e,i,n).then((t=>{r(t)})).catch((t=>a(t)))}))}async addClientEvent(t,s){return new Promise((e=>{g.addClientEvent(t,s),e()}))}async removeClientEvent(t){return new Promise((s=>{g.removeClientEvent(t),s()}))}async hasClientEvent(t){return new Promise((s=>{s(g.hasClientEvent(t))}))}get applicationResourceID(){return this._applicationResourceID||(this._applicationResourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||q.resourceID||"unknown.resource.id"),this._applicationResourceID}async getResourceID(){return Promise.resolve(this.applicationResourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,s,e,i){return f.alert(t,s,e,i)}async error(t,s,e,i){return f.error(t,s,e,i)}async success(t,s,e,i){return f.success(t,s,e,i)}async message(t,s,e,i){return f.message(t,s,e,i)}async confirm(t,s,e,i,n){return f.confirm(t,s,e,i,n)}async info(t,s){return f.info(t,s)}async loadTotals(t,s,e){return this.totalsFetcher.fetchTotals(t,s,e)}async isLoadedByPk(){return Promise.resolve(this._isLoadedByPk)}async getAuthList(t){return await(new L).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=A.getQueryParams(location.search)),this._urlParams}getMessage(t,s){var e;return null===(e=this.messagesBuilder)||void 0===e?void 0:e.getMessage(t,s)}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new S),this._dataUnitFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new j),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new N),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new I),this._authFetcher}async executeSearch(t,s,e){const i=null==e?void 0:e.getField(s);if(i){const{mode:s,argument:n}=t,{ENTITYNAME:r,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,u=i.dependencies;let l;const d={rootEntity:c,descriptionFieldName:o,codeFieldName:a,showInactives:!1,dataUnitId:e.dataUnitId};return null==u||u.filter((t=>t.masterFields)).forEach((t=>{var s;t.type===p.SEARCHING&&(null===(s=t.masterFields)||void 0===s?void 0:s.length)>0&&(l={expression:t.expression,params:t.masterFields.map((t=>{const s=e.getField(t),i=(null==s?void 0:s.dataType)||w.TEXT,n=e.getFieldValue(t);if(null==n)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${s.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${s.label} para executar a pesquisa.`);return{name:t,value:n,dataType:i}}))})})),this.executePreparedSearch(s,n,{entity:r,entityDescription:h,criteria:l,searchOptions:d})}}async executePreparedSearch(t,s,e){const{entity:i,entityDescription:n,criteria:r,searchOptions:a}=e;return"ADVANCED"===t?new Promise((t=>{const e=document.createElement("snk-pesquisa");e[d.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,e.argument=s,e.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,r,a),e.selectItem=s=>{t(s),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(n),this.showPopUp(e)})):this.pesquisaFetcher.loadSearchOptions(i,s,r,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return q.getAppLabel(this.applicationResourceID)}addSearchListener(t,s,e){return new Promise((i=>{i(this.pesquisaFetcher.addSearchListener(t,s.dataUnitId,e))}))}importScript(t){return new Promise((s=>{this.getApplicationPath().then((e=>{let i=[];Array.isArray(t)||(i=[t]),i.forEach((t=>{const s=document.createElement("script");s.src=`${e}/${t}`,s.async=!0,document.body.appendChild(s)})),s()}))}))}async getApplicationPath(){return new Promise((t=>{"dev"===window.applicationenv?t(""):t(`/${this.getModuleName()}/labsApps/${window.APPLICATION_NAME}/build`)}))}getModuleName(){return window.MGE_MODULE_NAME||"mgefin-bff"}executeSelectDistinct(t,s,e){return this.dataUnitFetcher.loadSelectDistinct(t,s,e)}getDataFetcher(){return Promise.resolve(g.get())}async whenApplicationReady(){return m.getContextValue("__SNK__APPLICATION__LOADING__")?Promise.resolve(this):new Promise((t=>{this._waitingAppReady.push((()=>t(this)))}))}clearContent(t){t&&Array.from(t.children).forEach((s=>{t.removeChild(s)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}async pkChangeListener(){const t=top.window.location.hash.split("/")[2];if(this._currentPkParameter===t)return;const s=this.getResourceIdFromToken(),e=A.getPkObjectFromUrlToken(top.window.location.hash);if(null==e||s!==this.applicationResourceID)return;const i={pk:e};if(this._isLoadedByPk=!0,this.loadByPK)return this.loadByPK(i),void(this._currentPkParameter=t);this.defaultLoadByPK(i,t)}getResourceIdFromToken(){return top.window.location.pathname.indexOf("tabContent.jsp")>-1?A.getResourceIdFromUrlToken(window.location.generateHash(window.location.hash)):A.getResourceIdFromUrlToken(top.window.location.hash)}defaultLoadByPK(t,s){if(!(null==t?void 0:t.pk))return;const e=this.getFirstDataUnitFromDOM(),i=e.dataUnit;if(!i)return console.warn("Dataunit não inicializado"),void e.addEventListener("dataUnitReady",(e=>{this.loadDataWithPKFilter(t,e.detail),this._currentPkParameter=s}));this.loadDataWithPKFilter(t,i),this._currentPkParameter=s}loadDataWithPKFilter(t,s){const e={term:"",filter:{name:"LOAD_BY_PK_FILTER",expression:this.buildFilterExpressionByPkObject(t),params:this.getFilterParamsFromPkObject(t,s)}};s.loadData(e)}getFirstDataUnitFromDOM(){let t=this._element.querySelector("snk-data-unit[data-load-by-pk]");if(t||(t=this._element.querySelector("snk-data-unit")),t)return t}getFilterParamsFromPkObject(t,s){var e;const i=[];for(const n in t.pk)t.pk.hasOwnProperty(n)&&!Array.isArray(t.pk[n])&&i.push({name:n,dataType:(null===(e=s.getField(n))||void 0===e?void 0:e.dataType)||this.getDefaultDataTypeLoadByPK(t.pk[n]),value:t.pk[n]});return i}getDefaultDataTypeLoadByPK(t){return"number"==typeof t||t instanceof Number?w.NUMBER:"boolean"==typeof t||t instanceof Boolean?w.BOOLEAN:t instanceof Date?w.DATE:w.TEXT}buildFilterExpressionByPkObject(t){let s="";for(const e in t.pk)r.isEmpty(s)||(s+=" AND "),Array.isArray(t.pk[e])?s+=`${e} IN (${t.pk[e].toString()})`:s+=`${e} = :${e}`;return s}async showNewVersionPopup(){const t=document.createElement("ez-modal-container"),s=await this.getAppLabel();t.modalTitle=this.getMessage("snkApplication.newVersionPopup.title",{screenName:s}),t.okButtonLabel=this.getMessage("snkApplication.newVersionPopup.okButton"),t.cancelButtonLabel=this.getMessage("snkApplication.newVersionPopup.cancelButton");const e=document.createElement("p");e.innerText=this.getMessage("snkApplication.newVersionPopup.info"),e.className="ez-text",t.appendChild(e),t.addEventListener("ezModalAction",this.newVersionPopupEventListener.bind(this));const i=await f.showPopup({content:t});this._removeVersionLayoutPopup=async()=>{await i(),await this.processPendingActions(this.NEW_VERSION_POPUP_LOCKER)}}async newVersionPopupEventListener(t){"LOAD"!==t.detail&&("OK"===t.detail&&q.setScreenToUseV3Layout(),"CANCEL"===t.detail&&q.setScreenToUseOldLayout(),this._popUp.opened=!1,this._removeVersionLayoutPopup&&await this._removeVersionLayoutPopup())}async handleShowNewVersionPopup(){this.hasToShowNewVersionPopup()&&await this.showNewVersionPopup()}hasToShowNewVersionPopup(){const t=new URLSearchParams(window.location.search).get("firstLoadConv");return t&&"S"===t}registerPkChangeListener(){window.hasOwnProperty("onhashchange")?window.onhashchange=this.pkChangeListener.bind(this):setInterval(this.pkChangeListener.bind(this),100)}componentWillLoad(){m.setContextValue("__SNK__APPLICATION__LOADING__",!0),this._errorHandler=new z(this),this.messagesBuilder=new b,m.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${A.getUrlBase()}/mge/upload/file`),m.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,s,e)=>this.executeSearch(t,s,e))),m.setContextValue("__EZUI__GRID_LICENSE__",R),this.registerPkChangeListener(),y.init(),P.preload(this.applicationResourceID,this.configName),document.addEventListener("click",(()=>q.applicationClick())),this._waitingAppReady.forEach((t=>t()))}connectedCallback(){m.setContextValue("__SNK__APPLICATION__",this),g.addRequestListener(this._requestListener)}disconnectedCallback(){g.removeRequestListener(this._requestListener),this.removeShortcuts()}async componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{m.setContextValue("__SNK__APPLICATION__LOADING__",!1),this.applicationLoaded.emit(!0),this.pkChangeListener()})),d.addIDInfo(this._element,`resource_${this.applicationResourceID}`),await this.handleShowNewVersionPopup(),this.initKeyboardManager()}initKeyboardManager(){this._keyboardManager.bind("ctrl + g",q.searchApp.bind(this),{description:"Pesquisar por telas"}).bind("ctrl + d",q.showDesktop.bind(this),{description:"Mostrar o desktop"}).bind("F1",q.openHelp.bind(this),{description:"Abrir ajuda"})}removeShortcuts(){this._keyboardManager.unbind("ctrl + g").unbind("ctrl + d").unbind("F1")}render(){return e("div",null,e("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),e("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),e("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class B{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){if(null==t)return!1;if(t.url.includes("quietMode=true"))return!0;if(null==t.requestBody)return!1;if(1==t.requestBody.length){const{name:s}=t.requestBody[0].variables;if(s){const t=s.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class K{constructor(t,s){this.resolve=t,this.reject=s}}x.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{x as snk_application}
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,g as e}from"./p-d2d301a6.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{F as h}from"./p-ff1990ad.js";const r=class{constructor(i){t(this,i),this.valueChanged=s(this,"valueChanged",7),this.value=void 0,this.config=void 0}ezChangeListener(t){this.value=t.detail.value,this.valueChanged.emit(this.value)}async show(){this._comboElement.setFocus()}componentDidLoad(){this._element&&o.addIDInfo(this._element,"filterContentEditor")}render(){if(this.config&&this.config.type===h.MULTI_SELECT)return i("ez-combo-box",{id:this.config.id,ref:t=>this._comboElement=t,label:this.config.label,value:this.config.value,options:this.config.props.options})}get _element(){return e(this)}};export{r as snk_filter_multi_select}