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

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 (215) 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-e4a7c4c3.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 +74 -6
  11. package/dist/cjs/snk-attach.cjs.entry.js +395 -57
  12. package/dist/cjs/snk-crud.cjs.entry.js +5 -6
  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-filter-bar.cjs.entry.js +40 -5
  18. package/dist/cjs/snk-filter-item.cjs.entry.js +3 -0
  19. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -2
  20. package/dist/cjs/snk-filter-modal.cjs.entry.js +16 -1
  21. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +2 -1
  22. package/dist/cjs/snk-form.cjs.entry.js +2 -2
  23. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  24. package/dist/cjs/snk-grid.cjs.entry.js +41 -18
  25. package/dist/cjs/{snk-guides-viewer-9342bca1.js → snk-guides-viewer-d32c096f.js} +6 -7
  26. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -8
  27. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  28. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-simple-crud.cjs.entry.js +19 -8
  30. package/dist/cjs/snk-taskbar.cjs.entry.js +2 -2
  31. package/dist/cjs/{taskbar-elements-b8c428a9.js → taskbar-elements-01b85b99.js} +1 -1
  32. package/dist/collection/collection-manifest.json +1 -1
  33. package/dist/collection/components/snk-application/snk-application.js +119 -13
  34. package/dist/collection/components/snk-attach/snk-attach.js +194 -38
  35. package/dist/collection/components/snk-attach/structure/{crud-config-builder.js → builder/anexo-sistema-crud-config.builder.js} +1 -1
  36. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +62 -0
  37. package/dist/collection/components/snk-attach/structure/{taskbar-builder.js → builder/taskbar-builder.js} +1 -1
  38. package/dist/collection/components/snk-attach/structure/fetcher/facade/fetcher.facade.js +1 -0
  39. package/dist/collection/components/snk-attach/structure/{data-unit-builder.js → fetcher/factory/anexo-sistema-data-unit.factory.js} +14 -11
  40. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +111 -0
  41. package/dist/collection/components/snk-attach/structure/index.js +6 -3
  42. package/dist/collection/components/snk-crud/snk-crud.js +2 -2
  43. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +2 -2
  44. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -1
  45. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +2 -1
  46. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -0
  47. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +84 -2
  48. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +0 -1
  49. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +84 -3
  50. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +5 -1
  51. package/dist/collection/components/snk-grid/snk-grid.js +39 -16
  52. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +1 -1
  53. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +2 -4
  54. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +53 -1
  55. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +26 -1
  56. package/dist/collection/components/snk-taskbar/snk-taskbar.js +1 -1
  57. package/dist/collection/lib/@types/index.js +1 -0
  58. package/dist/collection/lib/configs/ConfigStorage.js +24 -14
  59. package/dist/collection/lib/dataUnit/InMemoryLoader.js +1 -1
  60. package/dist/collection/lib/http/data-fetcher/fetchers/{attach-fetcher.js → AttachFetcher/anexo-sistema-fetcher.js} +16 -15
  61. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.js +90 -0
  62. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.js +1 -0
  63. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/index.js +2 -0
  64. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDelete.js +1 -0
  65. package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/interfaces/IDownloadKey.js +1 -0
  66. package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.js +1 -0
  67. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.js +31 -3
  68. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +55 -31
  69. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +1 -1
  70. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +7 -1
  71. package/dist/collection/lib/index.js +1 -1
  72. package/dist/collection/lib/message/resources/snk-attach.msg.js +13 -0
  73. package/dist/components/ConfigStorage.js +25 -15
  74. package/dist/components/SnkMessageBuilder.js +13 -0
  75. package/dist/components/dataunit-fetcher.js +93 -35
  76. package/dist/components/index2.js +1 -0
  77. package/dist/components/snk-actions-button2.js +1 -0
  78. package/dist/components/snk-application2.js +73 -3
  79. package/dist/components/snk-attach2.js +400 -56
  80. package/dist/components/snk-crud.js +1 -1
  81. package/dist/components/snk-data-exporter2.js +1 -1
  82. package/dist/components/snk-detail-view2.js +1 -1
  83. package/dist/components/snk-filter-bar2.js +42 -5
  84. package/dist/components/snk-filter-item2.js +3 -0
  85. package/dist/components/snk-filter-modal-item2.js +0 -1
  86. package/dist/components/snk-filter-modal.js +21 -3
  87. package/dist/components/snk-filter-multi-select.js +2 -1
  88. package/dist/components/snk-grid2.js +38 -15
  89. package/dist/components/snk-personalized-filter2.js +1 -1
  90. package/dist/components/snk-pesquisa2.js +1 -1
  91. package/dist/components/snk-simple-crud2.js +15 -1
  92. package/dist/components/taskbar-actions-button2.js +21 -2
  93. package/dist/esm/{ConfigStorage-379a9cba.js → ConfigStorage-4151acc8.js} +25 -15
  94. package/dist/esm/{ISave-4412b20c.js → ISave-d8c8bc59.js} +1 -0
  95. package/dist/esm/{SnkFormConfigManager-587e9030.js → SnkFormConfigManager-5c7d3771.js} +1 -1
  96. package/dist/esm/{SnkMessageBuilder-ca843d1b.js → SnkMessageBuilder-0fb796b9.js} +13 -0
  97. package/dist/esm/{index-1564817d.js → index-0ece87a6.js} +1 -0
  98. package/dist/esm/loader.js +1 -1
  99. package/dist/esm/{dataunit-fetcher-cc1650eb.js → pesquisa-fetcher-fa0c2540.js} +255 -36
  100. package/dist/esm/sankhyablocks.js +1 -1
  101. package/dist/esm/snk-actions-button_2.entry.js +23 -5
  102. package/dist/esm/snk-application.entry.js +74 -6
  103. package/dist/esm/snk-attach.entry.js +396 -58
  104. package/dist/esm/snk-crud.entry.js +5 -6
  105. package/dist/esm/snk-data-exporter.entry.js +4 -4
  106. package/dist/esm/{snk-data-unit-6208ebf0.js → snk-data-unit-5d201fb3.js} +1 -1
  107. package/dist/esm/snk-data-unit.entry.js +2 -2
  108. package/dist/esm/snk-detail-view.entry.js +8 -9
  109. package/dist/esm/snk-filter-bar.entry.js +40 -5
  110. package/dist/esm/snk-filter-item.entry.js +3 -0
  111. package/dist/esm/snk-filter-modal-item.entry.js +1 -2
  112. package/dist/esm/snk-filter-modal.entry.js +16 -1
  113. package/dist/esm/snk-filter-multi-select.entry.js +2 -1
  114. package/dist/esm/snk-form.entry.js +2 -2
  115. package/dist/esm/snk-grid-config.entry.js +1 -1
  116. package/dist/esm/snk-grid.entry.js +41 -18
  117. package/dist/esm/{snk-guides-viewer-9ce9588c.js → snk-guides-viewer-f49613c6.js} +6 -7
  118. package/dist/esm/snk-guides-viewer.entry.js +7 -8
  119. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  120. package/dist/esm/snk-pesquisa.entry.js +1 -1
  121. package/dist/esm/snk-simple-crud.entry.js +17 -6
  122. package/dist/esm/snk-taskbar.entry.js +2 -2
  123. package/dist/esm/{taskbar-elements-26c981af.js → taskbar-elements-d4d0b424.js} +1 -1
  124. package/dist/sankhyablocks/p-02e3a45b.entry.js +1 -0
  125. package/dist/sankhyablocks/{p-ff6064e7.js → p-05243555.js} +1 -1
  126. package/dist/sankhyablocks/p-0ec5b2e5.js +1 -0
  127. package/dist/sankhyablocks/{p-729f5f5b.entry.js → p-1d75d9f9.entry.js} +1 -1
  128. package/dist/sankhyablocks/{p-9e7d65a4.js → p-21749402.js} +1 -1
  129. package/dist/sankhyablocks/p-2582537c.entry.js +1 -0
  130. package/dist/sankhyablocks/p-282789a6.entry.js +1 -0
  131. package/dist/sankhyablocks/p-374d03f6.js +1 -0
  132. package/dist/sankhyablocks/p-38289a55.js +1 -0
  133. package/dist/sankhyablocks/p-3b0e4e08.js +65 -0
  134. package/dist/sankhyablocks/{p-35fe6e61.entry.js → p-40915359.entry.js} +1 -1
  135. package/dist/sankhyablocks/{p-2028633c.js → p-573a07c5.js} +1 -1
  136. package/dist/sankhyablocks/p-62896624.entry.js +1 -0
  137. package/dist/sankhyablocks/{p-953346b9.entry.js → p-69efa80d.entry.js} +1 -1
  138. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  139. package/dist/sankhyablocks/{p-aaa1438e.entry.js → p-761ed32f.entry.js} +1 -1
  140. package/dist/sankhyablocks/p-7f3c7b09.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-6977a26c.entry.js → p-86801b08.entry.js} +1 -1
  142. package/dist/sankhyablocks/p-9b5944a4.entry.js +1 -0
  143. package/dist/sankhyablocks/p-9bdbc7d8.entry.js +1 -0
  144. package/dist/sankhyablocks/p-aa95fb2c.js +56 -0
  145. package/dist/sankhyablocks/p-ac384baf.entry.js +1 -0
  146. package/dist/sankhyablocks/p-b05ab13d.entry.js +1 -0
  147. package/dist/sankhyablocks/p-bf2acf72.entry.js +1 -0
  148. package/dist/sankhyablocks/p-c4874327.entry.js +1 -0
  149. package/dist/sankhyablocks/{p-247a8b36.entry.js → p-d1791da2.entry.js} +1 -1
  150. package/dist/sankhyablocks/p-e0fd9555.entry.js +1 -0
  151. package/dist/sankhyablocks/p-e817f254.entry.js +11 -0
  152. package/dist/sankhyablocks/{p-32f0935f.js → p-f3d1c48e.js} +1 -1
  153. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  154. package/dist/types/components/snk-actions-button/subcomponents/snk-actions-form.d.ts +1 -1
  155. package/dist/types/components/snk-application/snk-application.d.ts +12 -2
  156. package/dist/types/components/snk-attach/{structure/crud-config-builder.d.ts → interfaces/ICrudConfig.d.ts} +1 -2
  157. package/dist/types/components/snk-attach/interfaces/TFetcherType.d.ts +1 -0
  158. package/dist/types/components/snk-attach/snk-attach.d.ts +28 -6
  159. package/dist/types/components/snk-attach/structure/builder/anexo-sistema-crud-config.builder.d.ts +2 -0
  160. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +31 -0
  161. package/dist/types/components/snk-attach/structure/{taskbar-builder.d.ts → builder/taskbar-builder.d.ts} +1 -1
  162. package/dist/types/components/snk-attach/structure/fetcher/facade/fetcher.facade.d.ts +11 -0
  163. package/dist/types/components/snk-attach/structure/fetcher/factory/anexo-sistema-data-unit.factory.d.ts +17 -0
  164. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +15 -0
  165. package/dist/types/components/snk-attach/structure/index.d.ts +6 -3
  166. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +1 -1
  167. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +19 -1
  168. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +16 -0
  169. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +7 -1
  170. package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
  171. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +10 -1
  172. package/dist/types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.d.ts +2 -0
  173. package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +1 -0
  174. package/dist/types/components.d.ts +108 -13
  175. package/dist/types/lib/@types/index.d.ts +2 -1
  176. package/dist/types/lib/configs/ConfigStorage.d.ts +4 -0
  177. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -1
  178. package/dist/types/lib/http/data-fetcher/fetchers/{attach-fetcher.d.ts → AttachFetcher/anexo-sistema-fetcher.d.ts} +3 -2
  179. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/attach-fetcher.d.ts +11 -0
  180. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/facade/attach-fetcher.facade.d.ts +8 -0
  181. package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/index.d.ts +3 -0
  182. package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/ISave.d.ts +2 -1
  183. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher.d.ts +2 -0
  184. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.d.ts +4 -1
  185. package/dist/types/lib/index.d.ts +1 -1
  186. package/package.json +15 -6
  187. package/dist/cjs/pesquisa-fetcher-ef050a47.js +0 -167
  188. package/dist/esm/pesquisa-fetcher-dd3ca0a5.js +0 -165
  189. package/dist/sankhyablocks/p-145c4434.js +0 -1
  190. package/dist/sankhyablocks/p-17dda7a2.entry.js +0 -1
  191. package/dist/sankhyablocks/p-19f51c6b.entry.js +0 -11
  192. package/dist/sankhyablocks/p-20726710.entry.js +0 -1
  193. package/dist/sankhyablocks/p-311c6173.entry.js +0 -1
  194. package/dist/sankhyablocks/p-4396d1a6.js +0 -56
  195. package/dist/sankhyablocks/p-44e894af.entry.js +0 -1
  196. package/dist/sankhyablocks/p-4775a293.entry.js +0 -1
  197. package/dist/sankhyablocks/p-4b0ea83f.entry.js +0 -1
  198. package/dist/sankhyablocks/p-5534e08c.js +0 -1
  199. package/dist/sankhyablocks/p-78777ae0.entry.js +0 -1
  200. package/dist/sankhyablocks/p-9c3229fc.entry.js +0 -1
  201. package/dist/sankhyablocks/p-a037f5b4.entry.js +0 -1
  202. package/dist/sankhyablocks/p-a702a1a2.js +0 -60
  203. package/dist/sankhyablocks/p-c259545b.entry.js +0 -1
  204. package/dist/sankhyablocks/p-d1677df0.entry.js +0 -1
  205. package/dist/sankhyablocks/p-d9bb09b3.js +0 -6
  206. package/dist/sankhyablocks/p-dd6a8377.js +0 -1
  207. package/dist/sankhyablocks/p-e138e7d4.entry.js +0 -1
  208. package/dist/sankhyablocks/p-e1b29d4c.entry.js +0 -1
  209. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +0 -15
  210. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js → components/snk-attach/interfaces/ICrudConfig.js} +0 -0
  211. /package/dist/collection/{lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js → components/snk-attach/interfaces/TFetcherType.js} +0 -0
  212. /package/dist/collection/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.js +0 -0
  213. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDelete.d.ts +0 -0
  214. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/IDownloadKey.d.ts +0 -0
  215. /package/dist/types/lib/http/data-fetcher/fetchers/{fecthAttach → AttachFetcher}/interfaces/index.d.ts +0 -0
@@ -5,14 +5,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const constants = require('./constants-35ddd366.js');
8
- const taskbarElements = require('./taskbar-elements-b8c428a9.js');
8
+ const taskbarElements = require('./taskbar-elements-01b85b99.js');
9
9
  require('./DataFetcher-ba94ed5b.js');
10
- require('./pesquisa-fetcher-ef050a47.js');
11
- const index$1 = require('./index-0e663819.js');
12
- require('./ISave-d68ce3cd.js');
10
+ const pesquisaFetcher = require('./pesquisa-fetcher-e4a7c4c3.js');
11
+ const index$1 = require('./index-0922807b.js');
12
+ require('./ISave-e91b70a7.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
- const dataunitFetcher = require('./dataunit-fetcher-bdaf9482.js');
16
15
  require('./PreloadManager-84466da6.js');
17
16
  require('./filter-item-type.enum-a7ffdaa6.js');
18
17
  require('./form-config-fetcher-df043d3d.js');
@@ -58,6 +57,8 @@ const SnkSimpleCrud = class {
58
57
  this.taskbarManager = undefined;
59
58
  this.messagesBuilder = undefined;
60
59
  this.useEnterLikeTab = false;
60
+ this.actionsList = undefined;
61
+ this.configName = undefined;
61
62
  }
62
63
  resolveInMemoryBtns(taskbarButtons) {
63
64
  const newTaskBarConfig = [...taskbarButtons];
@@ -121,7 +122,7 @@ const SnkSimpleCrud = class {
121
122
  return this._currentViewMode === constants.VIEW_MODE.GRID ? "snkSimpleCrudTaskbar.grid_regular" : "snkSimpleCrudTaskbar.form_regular";
122
123
  }
123
124
  initInMemoryDataUnit() {
124
- this._inMemoryLoader = new dataunitFetcher.InMemoryLoader(this._metadata);
125
+ this._inMemoryLoader = new pesquisaFetcher.InMemoryLoader(this._metadata);
125
126
  this.dataUnit = this._inMemoryLoader.dataUnit;
126
127
  this.dataUnitReady.emit(this.dataUnit);
127
128
  }
@@ -256,7 +257,7 @@ const SnkSimpleCrud = class {
256
257
  }
257
258
  getActionsList() {
258
259
  var _a, _b;
259
- return [{
260
+ const hardList = [{
260
261
  value: core.StringUtils.generateUUID(),
261
262
  label: (_b = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.findColumn", undefined)) !== null && _b !== void 0 ? _b : "Buscar",
262
263
  disableCloseOnSelect: true,
@@ -265,6 +266,16 @@ const SnkSimpleCrud = class {
265
266
  ? this.getColumnSearch(actionButton, item)
266
267
  : this.getFieldSearch(actionButton, item)
267
268
  }];
269
+ if (this.taskbarManager != undefined && this.taskbarManager.getMoreOptions != undefined) {
270
+ const taskbarID = this.getTopTaskBarId();
271
+ return hardList.concat(this.taskbarManager.getMoreOptions(taskbarID, this.configName, this.dataState, this.actionsList));
272
+ }
273
+ return hardList.concat(this.actionsList);
274
+ }
275
+ getTopTaskBarId() {
276
+ var _a;
277
+ return ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? `snkGridTopTaskbar.finish_edition${index$1.PresentationMode.PRIMARY}` :
278
+ `snkGridTopTaskbar.regular${index$1.PresentationMode.PRIMARY}`;
268
279
  }
269
280
  async keyDownListener(event) {
270
281
  if (!event.ctrlKey || event.key == undefined || event.key.toUpperCase() !== "F") {
@@ -305,7 +316,7 @@ const SnkSimpleCrud = class {
305
316
  }
306
317
  render() {
307
318
  var _a;
308
- return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
319
+ return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index.h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium ez-margin-bottom--large", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }, index.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), columnfilterDataSource: this.dataUnit.name.includes(pesquisaFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
309
320
  ? undefined
310
321
  : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }))))));
311
322
  }
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
8
- const taskbarElements = require('./taskbar-elements-b8c428a9.js');
9
- const index$1 = require('./index-0e663819.js');
8
+ const taskbarElements = require('./taskbar-elements-01b85b99.js');
9
+ const index$1 = require('./index-0922807b.js');
10
10
  require('./index-102ba62d.js');
11
11
 
12
12
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
- const index$2 = require('./index-0e663819.js');
4
+ const index$2 = require('./index-0922807b.js');
5
5
  const index$1 = require('./index-102ba62d.js');
6
6
 
7
7
  exports.TaskbarElement = void 0;
@@ -5,6 +5,7 @@
5
5
  "./components/snk-data-unit/snk-data-unit.js",
6
6
  "./components/snk-taskbar/snk-taskbar.js",
7
7
  "./components/snk-filter-bar/filter-list/snk-filter-list.js",
8
+ "./components/snk-print-selector/snk-print-selector.js",
8
9
  "./components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js",
9
10
  "./components/snk-actions-button/snk-actions-button.js",
10
11
  "./components/snk-actions-button/subcomponents/snk-actions-form.js",
@@ -47,7 +48,6 @@
47
48
  "./components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js",
48
49
  "./components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js",
49
50
  "./components/snk-pesquisa/snk-pesquisa.js",
50
- "./components/snk-print-selector/snk-print-selector.js",
51
51
  "./components/snk-simple-bar/snk-simple-bar.js",
52
52
  "./components/snk-simple-crud/snk-simple-crud.js",
53
53
  "./components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js",
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, DataType, DependencyType, ElementIDUtils, ErrorTracking, OnboardingUtils, StringUtils, KeyboardManager } from "@sankhyalabs/core";
1
+ import { ApplicationContext, DataType, DependencyType, ElementIDUtils, ErrorTracking, OnboardingUtils, StringUtils, KeyboardManager, ObjectUtils, ArrayUtils, SearchUtils } from "@sankhyalabs/core";
2
2
  import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
3
3
  import { h } from "@stencil/core";
4
4
  import AppletCaller from "../../lib/applet-caller/applet-caller";
@@ -582,11 +582,53 @@ export class SnkApplication {
582
582
  return this.executePreparedSearch(mode, argument, { entity: ENTITYNAME, entityDescription: DESCRIPTIONENTITY, criteria, searchOptions });
583
583
  }
584
584
  }
585
+ filterInvalidFields(resp, item, mdByName) {
586
+ let fieldsMetadata = resp.fieldsMetadata.filter((field) => {
587
+ let accept = !StringUtils.isEmpty(item[field.fieldName]) &&
588
+ field.visible !== false &&
589
+ field.type !== 'B' &&
590
+ resp.pkField !== field.fieldName &&
591
+ resp.descriptionField !== field.fieldName &&
592
+ (field.isPrimaryKey || !field.isLinkField) &&
593
+ !(field.type === 'S' && field.presentationType === 'H');
594
+ if (accept) {
595
+ mdByName[field.fieldName] = field;
596
+ }
597
+ //Condição que trata o problema de trazer imagem no entityCard na pesquisa de registros
598
+ if (typeof item[field.fieldName] === 'string' && (item[field.fieldName].indexOf('<img') > -1 || item[field.fieldName].indexOf('<svg') > -1)) {
599
+ return false;
600
+ }
601
+ return accept;
602
+ });
603
+ return fieldsMetadata;
604
+ }
605
+ filterMathFields(matchFields, fields, qtyFields, mdByName) {
606
+ if (matchFields && Array.isArray(matchFields)) {
607
+ matchFields.forEach((matchField) => {
608
+ let fieldMD = ArrayUtils.removeReference(fields, mdByName[matchField]);
609
+ if (fieldMD) {
610
+ fields.unshift(fieldMD);
611
+ }
612
+ });
613
+ }
614
+ fields = fields.slice(0, qtyFields);
615
+ return fields;
616
+ }
617
+ builOptionItem(argument, item, fields, descriptionField, pkField) {
618
+ var _a;
619
+ let exibitionItem = {
620
+ value: StringUtils.highlightValue(argument, item['__matchFields'], (_a = item[pkField]) === null || _a === void 0 ? void 0 : _a.toString(), fields, true),
621
+ label: descriptionField ? StringUtils.highlightValue(argument, item['__matchFields'], item[descriptionField], fields, true) : "",
622
+ details: SearchUtils.buildDetails(argument, fields, item)
623
+ };
624
+ return exibitionItem;
625
+ }
585
626
  /**
586
627
  * Obtém as opções em componentes de pesquisa
587
628
  * Ex.: snk-config-options
588
629
  */
589
630
  async executePreparedSearch(mode, argument, options) {
631
+ const mdByName = {};
590
632
  const { entity, entityDescription, criteria, searchOptions } = options;
591
633
  if (mode === "ADVANCED") {
592
634
  return new Promise(accept => {
@@ -604,7 +646,25 @@ export class SnkApplication {
604
646
  });
605
647
  }
606
648
  else {
607
- return this.pesquisaFetcher.loadSearchOptions(entity, argument, criteria, searchOptions);
649
+ return new Promise((resolve, reject) => {
650
+ this.pesquisaFetcher.loadAdvancedSearch(entity, argument, criteria, searchOptions)
651
+ .then(result => {
652
+ result = ObjectUtils.stringToObject(result.json.$);
653
+ let descriptionField = result.descriptionField;
654
+ let pkField = result.pkField;
655
+ const list = [];
656
+ result.data.forEach((item) => {
657
+ let fieldsMetadata = this.filterInvalidFields(result, item, mdByName);
658
+ let qtyFields = 6;
659
+ let fields = this.filterMathFields(item['__matchFields'], fieldsMetadata, qtyFields, mdByName);
660
+ list.push(this.builOptionItem(argument, item, fields, descriptionField, pkField));
661
+ });
662
+ resolve(list);
663
+ })
664
+ .catch(error => {
665
+ reject(error);
666
+ });
667
+ });
608
668
  }
609
669
  }
610
670
  /**
@@ -697,6 +757,15 @@ export class SnkApplication {
697
757
  this._waitingAppReady.push(() => resolve(this));
698
758
  });
699
759
  }
760
+ /**
761
+ * Atribui valor para parâmetros de contexto no componente de pesquisa.
762
+ *
763
+ * @param name - Nome do parâmetro
764
+ * @param value - String conversível de acordo com o tipo do parâmetro
765
+ */
766
+ async setSearchFilterContext(name, value) {
767
+ ApplicationContext.setContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${name})__`, value);
768
+ }
700
769
  clearContent(container) {
701
770
  if (container) {
702
771
  Array.from(container.children).forEach(child => {
@@ -1363,6 +1432,9 @@ export class SnkApplication {
1363
1432
  "text": ""
1364
1433
  }],
1365
1434
  "references": {
1435
+ "Promise": {
1436
+ "location": "global"
1437
+ },
1366
1438
  "Array": {
1367
1439
  "location": "global"
1368
1440
  },
@@ -2078,13 +2150,9 @@ export class SnkApplication {
2078
2150
  "Promise": {
2079
2151
  "location": "global"
2080
2152
  },
2081
- "IOption": {
2082
- "location": "import",
2083
- "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
2084
- },
2085
2153
  "ISearchArgument": {
2086
2154
  "location": "import",
2087
- "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
2155
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
2088
2156
  },
2089
2157
  "DataUnit": {
2090
2158
  "location": "import",
@@ -2093,12 +2161,16 @@ export class SnkApplication {
2093
2161
  "Array": {
2094
2162
  "location": "global"
2095
2163
  },
2164
+ "IOption": {
2165
+ "location": "import",
2166
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
2167
+ },
2096
2168
  "SearchCriteria": {
2097
2169
  "location": "import",
2098
2170
  "path": "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher"
2099
2171
  }
2100
2172
  },
2101
- "return": "Promise<IOption | IOption[]>"
2173
+ "return": "Promise<any>"
2102
2174
  },
2103
2175
  "docs": {
2104
2176
  "text": "Obt\u00E9m as op\u00E7\u00F5es em componentes de pesquisa\nEx.: snk-config-options",
@@ -2122,18 +2194,18 @@ export class SnkApplication {
2122
2194
  "Promise": {
2123
2195
  "location": "global"
2124
2196
  },
2125
- "IOption": {
2126
- "location": "import",
2127
- "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
2128
- },
2129
2197
  "Array": {
2130
2198
  "location": "global"
2131
2199
  },
2200
+ "IOption": {
2201
+ "location": "import",
2202
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-search/ez-search"
2203
+ },
2132
2204
  "HTMLSnkPesquisaElement": {
2133
2205
  "location": "global"
2134
2206
  }
2135
2207
  },
2136
- "return": "Promise<IOption | IOption[]>"
2208
+ "return": "Promise<any>"
2137
2209
  },
2138
2210
  "docs": {
2139
2211
  "text": "Obt\u00E9m as op\u00E7\u00F5es em componentes de pesquisa\nEx.: snk-config-options",
@@ -2329,6 +2401,40 @@ export class SnkApplication {
2329
2401
  "text": "SnkApplication carregado."
2330
2402
  }]
2331
2403
  }
2404
+ },
2405
+ "setSearchFilterContext": {
2406
+ "complexType": {
2407
+ "signature": "(name: string, value: string) => Promise<void>",
2408
+ "parameters": [{
2409
+ "tags": [{
2410
+ "name": "param",
2411
+ "text": "name - Nome do par\u00E2metro"
2412
+ }],
2413
+ "text": "- Nome do par\u00E2metro"
2414
+ }, {
2415
+ "tags": [{
2416
+ "name": "param",
2417
+ "text": "value - String convers\u00EDvel de acordo com o tipo do par\u00E2metro"
2418
+ }],
2419
+ "text": "- String convers\u00EDvel de acordo com o tipo do par\u00E2metro"
2420
+ }],
2421
+ "references": {
2422
+ "Promise": {
2423
+ "location": "global"
2424
+ }
2425
+ },
2426
+ "return": "Promise<void>"
2427
+ },
2428
+ "docs": {
2429
+ "text": "Atribui valor para par\u00E2metros de contexto no componente de pesquisa.",
2430
+ "tags": [{
2431
+ "name": "param",
2432
+ "text": "name - Nome do par\u00E2metro"
2433
+ }, {
2434
+ "name": "param",
2435
+ "text": "value - String convers\u00EDvel de acordo com o tipo do par\u00E2metro"
2436
+ }]
2437
+ }
2332
2438
  }
2333
2439
  };
2334
2440
  }
@@ -1,44 +1,66 @@
1
1
  import { h } from "@stencil/core";
2
- import { ApplicationContext } from "@sankhyalabs/core";
3
- import { AttachFetcher } from "../../lib/http/data-fetcher/fetchers/attach-fetcher";
2
+ import { DataUnit, ApplicationContext } from "@sankhyalabs/core";
3
+ import { AnexoSistemaFetcher, AttachFetcher, DataUnitFetcher } from "../../lib";
4
4
  import { VIEW_MODE } from "../../lib/utils/constants";
5
- import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/data-unit/dataunit-fetcher";
6
- import { AttachmentDataUnitBuilder, buildTaskBarManager, crudConfig } from "./structure";
5
+ import { AnexoSistemaDataUnitFactory, AttachFetcherDataUnitFactory, buildTaskBarManager, anexoSistemaCrudConfig, attachCrudConfig } from "./structure";
7
6
  const RESOURCE_ID = 'AnexoSistema';
8
7
  const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
9
8
  export class SnkAttach {
10
9
  constructor() {
11
- this.handleTaskbarClick = ({ detail: taskbar }) => {
10
+ this.handleTaskbarClick = async ({ detail: taskbar }) => {
12
11
  if (["DOWNLOAD", "LINK"].includes(taskbar))
13
- return this.downloadAttachment(this.dataUnit.getSelectedRecord());
12
+ return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());
13
+ if (this.fetcherType === "Attach" && ["SAVE"].includes(taskbar) && this._currentDataUnit.isDirty()) {
14
+ await this._currentDataUnit.setFieldValue("REGISTER_KEY", this.registerKey);
15
+ }
14
16
  };
15
17
  this.handleBack = () => {
16
- this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
18
+ this._currentDataUnit.cancelEdition().then((cancelationConfirmed) => {
17
19
  if (cancelationConfirmed)
18
20
  this.back.emit();
19
21
  });
20
22
  };
21
23
  this.handleFinish = () => {
22
- if (!this.dataUnit.isDirty())
24
+ if (!this._currentDataUnit.isDirty())
23
25
  return this.back.emit();
24
- this.dataUnit.saveData().then(() => {
26
+ this._currentDataUnit.saveData().then(() => {
25
27
  this.showFinishedToast();
26
28
  this.back.emit();
27
29
  });
28
30
  };
31
+ this.fetcherType = "AnexoSistema";
32
+ this.fetcher = undefined;
33
+ this.dataUnit = undefined;
34
+ this.dataUnitBuilder = undefined;
29
35
  this.registerKey = undefined;
30
36
  this.entityName = undefined;
31
37
  this.messagesBuilder = undefined;
32
- this.dataUnit = undefined;
38
+ this._currentFetcher = undefined;
39
+ this._currentDataUnit = undefined;
33
40
  this.crudConfig = undefined;
34
41
  }
35
42
  registerKeyWatcher(newRegisterKey, oldRegisterKey) {
36
- var _a;
43
+ var _a, _b, _c, _d;
44
+ if (this._currentDataUnit == null) {
45
+ this.loadAttachmentDataUnit();
46
+ }
37
47
  if (oldRegisterKey !== newRegisterKey) {
38
48
  this.returnToGridMode();
39
- this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
40
- this._dataUnitBuilder.initLoaders(this.dataUnit, this._attachFetcher, () => { this.returnToGridMode(); });
41
- this.dataUnit.loadData();
49
+ if (this.fetcherType === "AnexoSistema") {
50
+ this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
51
+ (_b = this._currentDataUnitBuilder) === null || _b === void 0 ? void 0 : _b.initLoaders(this._currentDataUnit, this._currentFetcher, this.returnToGridMode.bind(this));
52
+ return (_c = this._currentDataUnit) === null || _c === void 0 ? void 0 : _c.loadData();
53
+ }
54
+ if (this.fetcherType === "Attach") {
55
+ const hasMoreOneItem = ((_d = this.registerKey) === null || _d === void 0 ? void 0 : _d.split("_").length) > 1;
56
+ if (hasMoreOneItem)
57
+ return;
58
+ }
59
+ return this._currentDataUnit
60
+ .loadMetadata()
61
+ .then(() => {
62
+ this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
63
+ });
42
64
  }
43
65
  }
44
66
  /**
@@ -61,56 +83,106 @@ export class SnkAttach {
61
83
  window.open(`${selectedRecord.LINK}`);
62
84
  return;
63
85
  }
64
- this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
65
- window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
86
+ this._currentFetcher
87
+ .getDownloadKey(selectedRecord)
88
+ .then(({ chave }) => {
89
+ var _a;
90
+ let forceDownload = false;
91
+ if (!((_a = selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.ARQUIVO) === null || _a === void 0 ? void 0 : _a.endsWith(".pdf"))) {
92
+ forceDownload = true;
93
+ }
94
+ window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}${forceDownload ? "&forcarDownload=S" : ""}`);
66
95
  });
67
96
  }
68
97
  returnToGridMode() {
69
- this.dataUnit.clearSelection();
98
+ var _a;
99
+ (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.clearSelection();
70
100
  if (this._crudElement)
71
101
  this._crudElement.goToView(VIEW_MODE.GRID);
72
102
  }
73
103
  loadAttachmentDataUnit() {
74
- var _a;
75
104
  try {
76
- const dataUnit = this.dataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
77
- this._attachFetcher = new AttachFetcher(this.entityName, this.registerKey, (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.name);
78
- if (!dataUnit.metadata)
79
- dataUnit.loadMetadata().then(() => {
80
- this.crudConfig = crudConfig;
81
- });
82
- this._dataUnitBuilder = new AttachmentDataUnitBuilder(this.entityName, this.getMessage.bind(this));
83
- dataUnit.addFilterProvider({ getFilter: () => this._dataUnitBuilder.getFilters(this.registerKey) });
84
- dataUnit.addInterceptor({ interceptAction: (action) => this._dataUnitBuilder.getInterceptions(dataUnit, action, this._crudElement) });
85
- this.dataUnit = dataUnit;
86
- this.dataUnit.loadData().then(() => {
87
- this.disableEditFieldsNotInForm();
88
- });
89
- return this.dataUnit;
105
+ switch (this.fetcherType) {
106
+ case "AnexoSistema":
107
+ this.loadAnexoSistema();
108
+ break;
109
+ case "Attach":
110
+ this.loadAttach();
111
+ break;
112
+ default:
113
+ this._currentFetcher = this.fetcher;
114
+ this._currentDataUnit = this.dataUnit;
115
+ this._currentDataUnitBuilder = this.dataUnitBuilder;
116
+ }
90
117
  }
91
118
  catch (error) {
92
119
  throw new Error('There was an error while creating the data unit');
93
120
  }
94
121
  }
122
+ loadAnexoSistema() {
123
+ var _a;
124
+ this._currentDataUnit = this._currentDataUnit || new DataUnitFetcher().getDataUnit(RESOURCE_ID, DATA_UNIT_NAME);
125
+ this._currentFetcher = new AnexoSistemaFetcher(this.entityName, this.registerKey, (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.name);
126
+ if (!this._currentDataUnit.metadata) {
127
+ this._currentDataUnit
128
+ .loadMetadata()
129
+ .then(() => this.crudConfig = anexoSistemaCrudConfig);
130
+ }
131
+ this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
132
+ this._currentDataUnit.addFilterProvider({
133
+ getFilter: () => this._currentDataUnitBuilder.getFilters(this.registerKey)
134
+ });
135
+ this._currentDataUnit.addInterceptor({
136
+ interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
137
+ });
138
+ this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
139
+ }
140
+ loadAttach() {
141
+ var _a;
142
+ this._currentFetcher = new AttachFetcher();
143
+ this._currentDataUnit = new DataUnit();
144
+ this._currentDataUnit.addInterceptor({
145
+ interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
146
+ });
147
+ this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
148
+ (_a = this._currentDataUnitBuilder) === null || _a === void 0 ? void 0 : _a.initLoaders(this._currentDataUnit, this._currentFetcher, async () => {
149
+ await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
150
+ this.returnToGridMode();
151
+ });
152
+ if (!this._currentDataUnit.metadata) {
153
+ this._currentDataUnit
154
+ .loadMetadata()
155
+ .then(() => {
156
+ this.crudConfig = attachCrudConfig;
157
+ this._currentDataUnit
158
+ .loadData(undefined, undefined, true, this.registerKey)
159
+ .then(this.disableEditFieldsNotInForm.bind(this));
160
+ });
161
+ }
162
+ }
95
163
  disableEditFieldsNotInForm() {
96
164
  var _a;
97
165
  (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid.columns.forEach(column => {
98
166
  var _a;
99
167
  const fieldName = column.name;
100
168
  if (!((_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.form.fields.some(field => field.name === fieldName))) {
101
- this.dataUnit.disableField(fieldName);
169
+ this._currentDataUnit.disableField(fieldName);
102
170
  }
103
171
  });
104
172
  }
105
173
  componentWillLoad() {
106
174
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
107
- this.loadAttachmentDataUnit();
175
+ }
176
+ componentWillRender() {
177
+ if (this._currentDataUnit == null) {
178
+ this.loadAttachmentDataUnit();
179
+ }
108
180
  }
109
181
  render() {
110
182
  var _a, _b;
111
- if (!this.dataUnit)
183
+ if (!this._currentDataUnit)
112
184
  return null;
113
- 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")))))))));
185
+ 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 }, 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")))))))));
114
186
  }
115
187
  static get is() { return "snk-attach"; }
116
188
  static get encapsulation() { return "scoped"; }
@@ -126,6 +198,89 @@ export class SnkAttach {
126
198
  }
127
199
  static get properties() {
128
200
  return {
201
+ "fetcherType": {
202
+ "type": "string",
203
+ "mutable": false,
204
+ "complexType": {
205
+ "original": "TFetcherType",
206
+ "resolved": "\"AnexoSistema\" | \"Another\" | \"Attach\"",
207
+ "references": {
208
+ "TFetcherType": {
209
+ "location": "import",
210
+ "path": "./interfaces/TFetcherType"
211
+ }
212
+ }
213
+ },
214
+ "required": false,
215
+ "optional": false,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": "FetcherType define o tipo de fetcher respons\u00E1vel por carregar os dados do DataUnit."
219
+ },
220
+ "attribute": "fetcher-type",
221
+ "reflect": false,
222
+ "defaultValue": "\"AnexoSistema\""
223
+ },
224
+ "fetcher": {
225
+ "type": "unknown",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "AttachFetcherFacadeInterface",
229
+ "resolved": "AttachFetcherFacadeInterface",
230
+ "references": {
231
+ "AttachFetcherFacadeInterface": {
232
+ "location": "import",
233
+ "path": "../../lib"
234
+ }
235
+ }
236
+ },
237
+ "required": false,
238
+ "optional": false,
239
+ "docs": {
240
+ "tags": [],
241
+ "text": "Fetcher respons\u00E1vel por carregar os dados do DataUnit."
242
+ }
243
+ },
244
+ "dataUnit": {
245
+ "type": "unknown",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "DataUnit",
249
+ "resolved": "DataUnit",
250
+ "references": {
251
+ "DataUnit": {
252
+ "location": "import",
253
+ "path": "@sankhyalabs/core"
254
+ }
255
+ }
256
+ },
257
+ "required": false,
258
+ "optional": false,
259
+ "docs": {
260
+ "tags": [],
261
+ "text": "DataUnit respons\u00E1vel por carregar os dados."
262
+ }
263
+ },
264
+ "dataUnitBuilder": {
265
+ "type": "unknown",
266
+ "mutable": false,
267
+ "complexType": {
268
+ "original": "FetcherFacade",
269
+ "resolved": "FetcherFacade",
270
+ "references": {
271
+ "FetcherFacade": {
272
+ "location": "import",
273
+ "path": "./structure"
274
+ }
275
+ }
276
+ },
277
+ "required": false,
278
+ "optional": false,
279
+ "docs": {
280
+ "tags": [],
281
+ "text": "DataUnitBuilder respons\u00E1vel por implementar dados a serem utilizados no DataUnit."
282
+ }
283
+ },
129
284
  "registerKey": {
130
285
  "type": "string",
131
286
  "mutable": false,
@@ -151,7 +306,7 @@ export class SnkAttach {
151
306
  "resolved": "string",
152
307
  "references": {}
153
308
  },
154
- "required": true,
309
+ "required": false,
155
310
  "optional": false,
156
311
  "docs": {
157
312
  "tags": [],
@@ -184,7 +339,8 @@ export class SnkAttach {
184
339
  }
185
340
  static get states() {
186
341
  return {
187
- "dataUnit": {},
342
+ "_currentFetcher": {},
343
+ "_currentDataUnit": {},
188
344
  "crudConfig": {}
189
345
  };
190
346
  }
@@ -1,4 +1,4 @@
1
- export const crudConfig = {
1
+ export const anexoSistemaCrudConfig = {
2
2
  grid: {
3
3
  columns: [
4
4
  { name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },