@sankhyalabs/sankhyablocks 8.15.0-rc.9 → 8.15.0

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 (230) hide show
  1. package/dist/cjs/{ConfigStorage-d4c99a5e.js → ConfigStorage-942ce74b.js} +70 -7
  2. package/dist/cjs/{DataFetcher-99f0f6ed.js → DataFetcher-313debd8.js} +13 -5
  3. package/dist/cjs/{SnkFormConfigManager-3621bfc4.js → SnkFormConfigManager-f9dc0d28.js} +21 -13
  4. package/dist/cjs/{SnkMessageBuilder-141aa18d.js → SnkMessageBuilder-66aa2557.js} +4 -0
  5. package/dist/cjs/SnkMultiSelectionListDataSource-303e85d1.js +140 -0
  6. package/dist/cjs/{auth-fetcher-5161d082.js → auth-fetcher-54f5ff9d.js} +1 -1
  7. package/dist/cjs/{form-config-fetcher-9f1a13ca.js → form-config-fetcher-2dd00e5b.js} +13 -1
  8. package/dist/cjs/index-f9e81701.js +2 -10
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-8bbee432.js → pesquisa-fetcher-213797ec.js} +273 -50
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/{snk-actions-button_2.cjs.entry.js → snk-actions-button_4.cjs.entry.js} +519 -4
  13. package/dist/cjs/snk-application.cjs.entry.js +13 -8
  14. package/dist/cjs/snk-attach.cjs.entry.js +66 -46
  15. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-crud.cjs.entry.js +25 -17
  17. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +6 -2
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  19. package/dist/cjs/{snk-data-unit-6026a9f7.js → snk-data-unit-41c29713.js} +1 -1
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -9
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +31 -7
  23. package/dist/cjs/snk-filter-detail.cjs.entry.js +4 -1
  24. package/dist/cjs/snk-filter-item.cjs.entry.js +10 -6
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  26. package/dist/cjs/snk-form-config.cjs.entry.js +8 -2
  27. package/dist/cjs/snk-form.cjs.entry.js +11 -4
  28. package/dist/cjs/snk-grid.cjs.entry.js +40 -21
  29. package/dist/cjs/{snk-guides-viewer-e87f01b9.js → snk-guides-viewer-4b6ecda8.js} +20 -11
  30. package/dist/cjs/snk-guides-viewer.cjs.entry.js +6 -7
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  32. package/dist/cjs/snk-simple-crud.cjs.entry.js +255 -21
  33. package/dist/cjs/snk-taskbar.cjs.entry.js +69 -8
  34. package/dist/collection/collection-manifest.json +6 -6
  35. package/dist/collection/components/snk-application/snk-application.js +42 -2
  36. package/dist/collection/components/snk-attach/snk-attach.js +39 -24
  37. package/dist/collection/components/snk-attach/structure/builder/attach-crud-config.builder.js +1 -1
  38. package/dist/collection/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.js +29 -22
  39. package/dist/collection/components/snk-configurator/snk-configurator.js +1 -1
  40. package/dist/collection/components/snk-crud/snk-crud.js +71 -11
  41. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -2
  42. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +50 -7
  43. package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.css +1 -1
  44. package/dist/collection/components/snk-custom-slot-elements/snk-custom-slot-elements.js +22 -1
  45. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +2 -2
  46. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +22 -1
  47. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +28 -6
  48. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +2 -1
  49. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +44 -3
  50. package/dist/collection/components/snk-form/snk-form.js +25 -1
  51. package/dist/collection/components/{snk-form → snk-form-config}/SnkFormConfigManager.js +20 -12
  52. package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.js +11 -5
  53. package/dist/collection/components/snk-grid/snk-grid.js +86 -16
  54. package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.js +130 -123
  55. package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.js +1 -1
  56. package/dist/collection/components/snk-simple-crud/regular-buttons.js +3 -0
  57. package/dist/collection/components/snk-simple-crud/snk-simple-crud.css +10 -2
  58. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +421 -17
  59. package/dist/collection/components/snk-taskbar/snk-taskbar.js +86 -8
  60. package/dist/collection/lib/configs/ConfigStorage.js +63 -3
  61. package/dist/collection/lib/dataUnit/InMemoryLoader.js +9 -40
  62. package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +33 -0
  63. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +13 -5
  64. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +12 -0
  65. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
  66. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +4 -0
  67. package/dist/collection/lib/utils/CrudUtils.js +13 -1
  68. package/dist/components/ConfigStorage.js +68 -5
  69. package/dist/components/DataFetcher.js +13 -5
  70. package/dist/components/SnkFormConfigManager.js +19 -11
  71. package/dist/components/SnkMessageBuilder.js +4 -0
  72. package/dist/components/dataunit-fetcher.js +41 -39
  73. package/dist/components/field-search.js +93 -3
  74. package/dist/components/form-config-fetcher.js +12 -0
  75. package/dist/components/index.d.ts +6 -6
  76. package/dist/components/snk-application2.js +9 -1
  77. package/dist/components/snk-attach2.js +115 -52
  78. package/dist/components/snk-configurator2.js +1 -1
  79. package/dist/components/snk-crud.js +23 -11
  80. package/dist/components/snk-custom-slot-elements.js +7 -3
  81. package/dist/components/snk-data-exporter2.js +2 -2
  82. package/dist/components/snk-detail-view2.js +48 -11
  83. package/dist/components/snk-filter-bar2.js +29 -4
  84. package/dist/components/snk-filter-detail2.js +5 -1
  85. package/dist/components/snk-filter-item2.js +11 -6
  86. package/dist/components/snk-form-config2.js +7 -1
  87. package/dist/components/snk-form.js +8 -0
  88. package/dist/components/snk-grid-config2.js +128 -102
  89. package/dist/components/snk-grid2.js +42 -18
  90. package/dist/components/snk-simple-crud2.js +317 -29
  91. package/dist/components/snk-taskbar2.js +75 -11
  92. package/dist/esm/{ConfigStorage-39ed8aeb.js → ConfigStorage-86187da3.js} +70 -7
  93. package/dist/esm/{DataFetcher-a650ae58.js → DataFetcher-c1baf61d.js} +13 -5
  94. package/dist/esm/{SnkFormConfigManager-692e20c7.js → SnkFormConfigManager-f53f9f87.js} +21 -13
  95. package/dist/esm/{SnkMessageBuilder-9747ddd2.js → SnkMessageBuilder-0a4becdd.js} +4 -0
  96. package/dist/esm/SnkMultiSelectionListDataSource-36918dbf.js +133 -0
  97. package/dist/esm/{auth-fetcher-17dc5b5e.js → auth-fetcher-039abba3.js} +1 -1
  98. package/dist/esm/{form-config-fetcher-f121f880.js → form-config-fetcher-30fb808f.js} +13 -1
  99. package/dist/esm/index-a7d3d3f1.js +2 -10
  100. package/dist/esm/loader.js +1 -1
  101. package/dist/esm/{pesquisa-fetcher-5a8cae10.js → pesquisa-fetcher-fe6f3826.js} +262 -43
  102. package/dist/esm/sankhyablocks.js +1 -1
  103. package/dist/esm/{snk-actions-button_2.entry.js → snk-actions-button_4.entry.js} +518 -5
  104. package/dist/esm/snk-application.entry.js +13 -8
  105. package/dist/esm/snk-attach.entry.js +65 -45
  106. package/dist/esm/snk-configurator.entry.js +1 -1
  107. package/dist/esm/snk-crud.entry.js +25 -17
  108. package/dist/esm/snk-custom-slot-elements.entry.js +7 -3
  109. package/dist/esm/snk-data-exporter.entry.js +5 -5
  110. package/dist/esm/{snk-data-unit-4c343635.js → snk-data-unit-de1d140d.js} +1 -1
  111. package/dist/esm/snk-data-unit.entry.js +2 -2
  112. package/dist/esm/snk-detail-view.entry.js +8 -9
  113. package/dist/esm/snk-filter-bar.entry.js +31 -7
  114. package/dist/esm/snk-filter-detail.entry.js +4 -1
  115. package/dist/esm/snk-filter-item.entry.js +10 -6
  116. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  117. package/dist/esm/snk-form-config.entry.js +9 -3
  118. package/dist/esm/snk-form.entry.js +11 -4
  119. package/dist/esm/snk-grid.entry.js +41 -22
  120. package/dist/esm/{snk-guides-viewer-ba8ce538.js → snk-guides-viewer-113be3fd.js} +20 -11
  121. package/dist/esm/snk-guides-viewer.entry.js +6 -7
  122. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  123. package/dist/esm/snk-simple-crud.entry.js +256 -22
  124. package/dist/esm/snk-taskbar.entry.js +70 -9
  125. package/dist/sankhyablocks/p-032fe52e.js +1 -0
  126. package/dist/sankhyablocks/p-07a61550.entry.js +1 -0
  127. package/dist/sankhyablocks/p-0899e0b5.entry.js +1 -0
  128. package/dist/sankhyablocks/p-14a08904.entry.js +1 -0
  129. package/dist/sankhyablocks/p-154a7f33.entry.js +1 -0
  130. package/dist/sankhyablocks/p-15802c59.entry.js +1 -0
  131. package/dist/sankhyablocks/p-164666b1.js +65 -0
  132. package/dist/sankhyablocks/p-21a81901.entry.js +1 -0
  133. package/dist/sankhyablocks/p-32556aa6.js +1 -0
  134. package/dist/sankhyablocks/p-328585d0.entry.js +1 -0
  135. package/dist/sankhyablocks/p-47bad461.entry.js +11 -0
  136. package/dist/sankhyablocks/{p-9a5d1b39.js → p-52c8e589.js} +1 -1
  137. package/dist/sankhyablocks/p-54a5d52a.entry.js +1 -0
  138. package/dist/sankhyablocks/p-5cb07080.js +1 -0
  139. package/dist/sankhyablocks/p-74d349c3.entry.js +1 -0
  140. package/dist/sankhyablocks/p-7663f597.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-50783a8b.js → p-913a9979.js} +1 -1
  142. package/dist/sankhyablocks/{p-827e4b01.entry.js → p-a1d72395.entry.js} +1 -1
  143. package/dist/sankhyablocks/p-add17f6a.entry.js +1 -0
  144. package/dist/sankhyablocks/p-af1ac81f.entry.js +1 -0
  145. package/dist/sankhyablocks/p-aff76a53.js +56 -0
  146. package/dist/sankhyablocks/p-b4525fc0.entry.js +1 -0
  147. package/dist/sankhyablocks/p-cce0865d.js +1 -0
  148. package/dist/sankhyablocks/{p-be75153c.js → p-dc7c9047.js} +1 -1
  149. package/dist/sankhyablocks/p-dec65f6c.entry.js +1 -0
  150. package/dist/sankhyablocks/p-df5451c7.js +26 -0
  151. package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
  152. package/dist/sankhyablocks/{p-9d608b62.entry.js → p-eae7a817.entry.js} +1 -1
  153. package/dist/sankhyablocks/{p-20b46647.entry.js → p-ee9536bc.entry.js} +1 -1
  154. package/dist/sankhyablocks/p-f13f7616.entry.js +1 -0
  155. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  156. package/dist/types/components/snk-application/snk-application.d.ts +8 -0
  157. package/dist/types/components/snk-attach/snk-attach.d.ts +2 -1
  158. package/dist/types/components/snk-attach/structure/builder/attach-crud-config.builder.d.ts +10 -1
  159. package/dist/types/components/snk-attach/structure/fetcher/factory/attach-fetcher-data-unit.factory.d.ts +5 -4
  160. package/dist/types/components/snk-crud/snk-crud.d.ts +12 -0
  161. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +1 -1
  162. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +11 -1
  163. package/dist/types/components/snk-custom-slot-elements/snk-custom-slot-elements.d.ts +6 -0
  164. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
  165. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +6 -2
  166. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +8 -0
  167. package/dist/types/components/snk-form/snk-form.d.ts +6 -1
  168. package/dist/types/components/{snk-form → snk-form-config}/SnkFormConfigManager.d.ts +2 -1
  169. package/dist/types/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.d.ts +4 -3
  170. package/dist/types/components/snk-grid/snk-grid.d.ts +14 -1
  171. package/dist/types/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.d.ts +11 -6
  172. package/dist/types/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.d.ts +1 -1
  173. package/dist/types/components/snk-simple-crud/regular-buttons.d.ts +3 -0
  174. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +76 -3
  175. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
  176. package/dist/types/components.d.ts +171 -10
  177. package/dist/types/lib/configs/ConfigStorage.d.ts +21 -1
  178. package/dist/types/lib/dataUnit/InMemoryLoader.d.ts +0 -2
  179. package/dist/types/lib/dataUnit/dataUnitInMemoryUtils.d.ts +4 -0
  180. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +2 -0
  181. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  182. package/dist/types/lib/utils/CrudUtils.d.ts +3 -0
  183. package/package.json +1 -1
  184. package/dist/cjs/PreloadManager-84466da6.js +0 -224
  185. package/dist/cjs/SnkMultiSelectionListDataSource-ba5838c2.js +0 -49
  186. package/dist/cjs/snk-grid-config.cjs.entry.js +0 -483
  187. package/dist/cjs/snk-select-box.cjs.entry.js +0 -25
  188. package/dist/esm/PreloadManager-c1c2f2b4.js +0 -222
  189. package/dist/esm/SnkMultiSelectionListDataSource-44494b0e.js +0 -43
  190. package/dist/esm/snk-grid-config.entry.js +0 -479
  191. package/dist/esm/snk-select-box.entry.js +0 -21
  192. package/dist/sankhyablocks/p-094c30cb.js +0 -1
  193. package/dist/sankhyablocks/p-1c55becf.entry.js +0 -1
  194. package/dist/sankhyablocks/p-230f5148.entry.js +0 -1
  195. package/dist/sankhyablocks/p-2936303b.js +0 -1
  196. package/dist/sankhyablocks/p-2e4eb644.entry.js +0 -1
  197. package/dist/sankhyablocks/p-3e2e2424.entry.js +0 -1
  198. package/dist/sankhyablocks/p-3e91d5ea.entry.js +0 -1
  199. package/dist/sankhyablocks/p-43de1258.entry.js +0 -1
  200. package/dist/sankhyablocks/p-4ce6cb02.entry.js +0 -11
  201. package/dist/sankhyablocks/p-5e681b7b.js +0 -65
  202. package/dist/sankhyablocks/p-5f74c859.entry.js +0 -1
  203. package/dist/sankhyablocks/p-67aedbe0.js +0 -56
  204. package/dist/sankhyablocks/p-69754d94.entry.js +0 -1
  205. package/dist/sankhyablocks/p-725d04ba.js +0 -1
  206. package/dist/sankhyablocks/p-86801b08.entry.js +0 -1
  207. package/dist/sankhyablocks/p-8a3a2631.entry.js +0 -1
  208. package/dist/sankhyablocks/p-965b79a9.js +0 -1
  209. package/dist/sankhyablocks/p-98674137.entry.js +0 -1
  210. package/dist/sankhyablocks/p-a13ccb86.js +0 -26
  211. package/dist/sankhyablocks/p-aba0e87f.entry.js +0 -1
  212. package/dist/sankhyablocks/p-c22c1d8e.js +0 -1
  213. package/dist/sankhyablocks/p-d26e0a02.entry.js +0 -1
  214. package/dist/sankhyablocks/p-d6317851.entry.js +0 -1
  215. package/dist/sankhyablocks/p-d7d85fa9.entry.js +0 -1
  216. package/dist/sankhyablocks/p-e3bd000e.entry.js +0 -1
  217. package/dist/sankhyablocks/p-e7dbe53a.entry.js +0 -1
  218. package/dist/sankhyablocks/p-fcdcb0e2.entry.js +0 -1
  219. /package/dist/collection/components/{snk-form/subcomponents/snk-form-config → snk-form-config}/snk-form-config.css +0 -0
  220. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.css +0 -0
  221. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.js +0 -0
  222. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.css +0 -0
  223. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.js +0 -0
  224. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.css +0 -0
  225. /package/dist/collection/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.js +0 -0
  226. /package/dist/collection/components/{snk-grid/subcomponents/snk-grid-config → snk-grid-config}/snk-grid-config.css +0 -0
  227. /package/dist/collection/components/{snk-grid/subcomponents → snk-grid-config}/snk-select-box/snk-select-box.css +0 -0
  228. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-config-options/snk-config-options.d.ts +0 -0
  229. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-field-config/snk-field-config.d.ts +0 -0
  230. /package/dist/types/components/{snk-form → snk-form-config}/subcomponents/snk-tab-config/snk-tab-config.d.ts +0 -0
@@ -1,8 +1,9 @@
1
1
  import { h } from "@stencil/core";
2
- import { DataUnit, ApplicationContext } from "@sankhyalabs/core";
2
+ import { DataUnit, ApplicationContext, Action } from "@sankhyalabs/core";
3
3
  import { AnexoSistemaFetcher, AttachFetcher, DataUnitFetcher } from "../../lib";
4
4
  import { VIEW_MODE } from "../../lib/utils/constants";
5
5
  import { AnexoSistemaDataUnitFactory, AttachFetcherDataUnitFactory, buildTaskBarManager, anexoSistemaCrudConfig, attachCrudConfig } from "./structure";
6
+ import InMemoryLoader from "../../lib/dataUnit/InMemoryLoader";
6
7
  const RESOURCE_ID = 'AnexoSistema';
7
8
  const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
8
9
  export class SnkAttach {
@@ -28,7 +29,7 @@ export class SnkAttach {
28
29
  this.back.emit();
29
30
  });
30
31
  };
31
- this.fetcherType = "AnexoSistema";
32
+ this.fetcherType = undefined;
32
33
  this.fetcher = undefined;
33
34
  this.dataUnit = undefined;
34
35
  this.dataUnitBuilder = undefined;
@@ -40,8 +41,8 @@ export class SnkAttach {
40
41
  this.crudConfig = undefined;
41
42
  }
42
43
  registerKeyWatcher(newRegisterKey, oldRegisterKey) {
43
- var _a, _b, _c, _d;
44
- if (this._currentDataUnit == null) {
44
+ var _a, _b, _c, _d, _e, _f;
45
+ if (!this._currentDataUnit) {
45
46
  this.loadAttachmentDataUnit();
46
47
  }
47
48
  if (oldRegisterKey !== newRegisterKey) {
@@ -56,11 +57,7 @@ export class SnkAttach {
56
57
  if (hasMoreOneItem)
57
58
  return;
58
59
  }
59
- return this._currentDataUnit
60
- .loadMetadata()
61
- .then(() => {
62
- this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
63
- });
60
+ return (_f = (_e = this._currentDataUnit) === null || _e === void 0 ? void 0 : _e.loadMetadata()) === null || _f === void 0 ? void 0 : _f.then(this._currentDataUnit.loadData.bind(undefined, undefined, true, this.registerKey));
64
61
  }
65
62
  }
66
63
  /**
@@ -126,7 +123,7 @@ export class SnkAttach {
126
123
  if (!this._currentDataUnit.metadata) {
127
124
  this._currentDataUnit
128
125
  .loadMetadata()
129
- .then(() => this.crudConfig = anexoSistemaCrudConfig);
126
+ .then(() => this.crudConfig = Object.assign({}, anexoSistemaCrudConfig));
130
127
  }
131
128
  this._currentDataUnitBuilder = new AnexoSistemaDataUnitFactory(this.entityName, this.getMessage.bind(this));
132
129
  this._currentDataUnit.addFilterProvider({
@@ -138,25 +135,29 @@ export class SnkAttach {
138
135
  this._currentDataUnit.loadData().then(this.disableEditFieldsNotInForm.bind(this));
139
136
  }
140
137
  loadAttach() {
141
- var _a;
138
+ var _a, _b, _c;
142
139
  this._currentFetcher = new AttachFetcher();
143
- this._currentDataUnit = new DataUnit();
140
+ this._currentDataUnit = new DataUnit(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME);
144
141
  this._currentDataUnit.addInterceptor({
145
- interceptAction: (action) => this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement)
142
+ interceptAction: (action) => {
143
+ var _a;
144
+ if (action.type === Action.METADATA_LOADED) {
145
+ this.crudConfig = Object.assign({}, attachCrudConfig);
146
+ (_a = this._crudElement) === null || _a === void 0 ? void 0 : _a.updateConfig();
147
+ }
148
+ return this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit, action, this._crudElement);
149
+ }
146
150
  });
147
151
  this._currentDataUnitBuilder = new AttachFetcherDataUnitFactory(this.getMessage.bind(this));
148
152
  (_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
153
  this.returnToGridMode();
154
+ await this._currentDataUnit.loadData(undefined, undefined, true, this.registerKey);
151
155
  });
152
156
  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));
157
+ (_c = (_b = this._currentDataUnit) === null || _b === void 0 ? void 0 : _b.loadMetadata()) === null || _c === void 0 ? void 0 : _c.then(() => {
158
+ var _a, _b;
159
+ this.crudConfig = Object.assign({}, attachCrudConfig);
160
+ (_b = (_a = this._currentDataUnit) === null || _a === void 0 ? void 0 : _a.loadData(undefined, undefined, true, this.registerKey)) === null || _b === void 0 ? void 0 : _b.then(this.disableEditFieldsNotInForm.bind(this));
160
161
  });
161
162
  }
162
163
  }
@@ -174,15 +175,30 @@ export class SnkAttach {
174
175
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
175
176
  }
176
177
  componentWillRender() {
178
+ if (!this.fetcherType) {
179
+ this.fetcherType = "AnexoSistema";
180
+ }
177
181
  if (this._currentDataUnit == null) {
178
182
  this.loadAttachmentDataUnit();
179
183
  }
180
184
  }
185
+ async handleOnDataStateChange({ detail }) {
186
+ if (this.fetcherType !== 'Attach')
187
+ return;
188
+ if (!detail.insertionMode) {
189
+ this._currentDataUnit.disableField('DESCRICAO');
190
+ }
191
+ else {
192
+ this._currentDataUnit.enableField('DESCRICAO');
193
+ }
194
+ await this._currentDataUnit.loadMetadata();
195
+ }
196
+ ;
181
197
  render() {
182
198
  var _a, _b;
183
199
  if (!this._currentDataUnit)
184
200
  return null;
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")))))))));
201
+ return (h("main", { class: "snk-attach__main" }, h("header", { class: "snk-attach__header" }, h("snk-simple-bar", { onExit: this.handleBack, messagesBuilder: this.messagesBuilder }, h("div", { slot: "rightSlot" }, h("ez-button", { class: "ez-button--primary", label: this.getMessage("snkAttach.finish"), onClick: this.handleFinish })))), h("div", { class: "snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column" }, h("div", { class: "ez-box__container" }, h("snk-simple-crud", { ref: (el) => this._crudElement = el, dataUnit: this._currentDataUnit, taskbarManager: buildTaskBarManager(), gridConfig: (_a = this.crudConfig) === null || _a === void 0 ? void 0 : _a.grid, formConfig: (_b = this.crudConfig) === null || _b === void 0 ? void 0 : _b.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick, messagesBuilder: this.messagesBuilder, onDataStateChange: this.handleOnDataStateChange.bind(this) }, h("div", { slot: "snkSimpleCrudHeader" }, h("div", { class: "ez-flex ez-flex--column" }, h("span", { class: "ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium" }, this.getMessage("snkAttach.title")), h("span", { class: "ez-text ez-text--medium ez-text--secondary" }, this.getMessage("snkAttach.description")))))))));
186
202
  }
187
203
  static get is() { return "snk-attach"; }
188
204
  static get encapsulation() { return "scoped"; }
@@ -218,8 +234,7 @@ export class SnkAttach {
218
234
  "text": "FetcherType define o tipo de fetcher respons\u00E1vel por carregar os dados do DataUnit."
219
235
  },
220
236
  "attribute": "fetcher-type",
221
- "reflect": false,
222
- "defaultValue": "\"AnexoSistema\""
237
+ "reflect": false
223
238
  },
224
239
  "fetcher": {
225
240
  "type": "unknown",
@@ -39,7 +39,7 @@ export const attachFetcherMetadataBuilder = {
39
39
  label: "Attach List",
40
40
  fields: [
41
41
  { name: "CODATA", label: getMessage("snkAttach.attachMetadata.lblCode"), dataType: DataType.TEXT },
42
- { name: "DESCRICAO", label: getMessage("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT },
42
+ { name: "DESCRICAO", label: getMessage("snkAttach.attachMetadata.lblDescription"), dataType: DataType.TEXT, readOnly: false },
43
43
  { name: "ARQUIVO", label: getMessage("snkAttach.attachMetadata.lblFileOrLink"), dataType: DataType.TEXT },
44
44
  { name: "USUARIO", label: getMessage("snkAttach.attachMetadata.lblUser"), dataType: DataType.TEXT },
45
45
  { name: "DTALTER", label: getMessage("snkAttach.attachMetadata.lblDate"), dataType: DataType.TEXT },
@@ -1,12 +1,14 @@
1
- import { Action, ApplicationContext, StringUtils } from "@sankhyalabs/core";
2
- import { SaveErrorsEnum } from "../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces";
3
- import { AutorizationType } from "../../../../../lib/http/data-fetcher/fetchers/auth-fetcher";
4
- import { attachFetcherMetadataBuilder } from "../../builder/attach-crud-config.builder";
5
- import { VIEW_MODE } from "../../../../../lib/utils/constants";
1
+ import { Action, ApplicationContext, StringUtils, } from '@sankhyalabs/core';
2
+ import { SaveErrorsEnum } from '../../../../../lib/http/data-fetcher/fetchers/AttachFetcher/interfaces';
3
+ import { AutorizationType } from '../../../../../lib/http/data-fetcher/fetchers/auth-fetcher';
4
+ import { attachFetcherMetadataBuilder } from '../../builder/attach-crud-config.builder';
5
+ import { VIEW_MODE } from '../../../../../lib/utils/constants';
6
+ import { applyFilter, applySorting, buildPaginationInfo } from '../../../../../lib/dataUnit/dataUnitInMemoryUtils';
6
7
  const SERVICE_LOAD = "Attach.load";
7
8
  export class AttachFetcherDataUnitFactory {
8
9
  constructor(getMessage) {
9
10
  this.getMessage = getMessage;
11
+ this._records = [];
10
12
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
11
13
  }
12
14
  initLoaders(dataUnit, fetcher, onSuccess) {
@@ -26,25 +28,30 @@ export class AttachFetcherDataUnitFactory {
26
28
  metadataLoader(_) {
27
29
  return Promise.resolve(attachFetcherMetadataBuilder);
28
30
  }
29
- async dataLoader(_, request) {
31
+ async dataLoader(dataUnit, request) {
30
32
  if (!request.source) {
31
- return Promise.resolve({ records: [] });
33
+ return Promise.resolve({ records: this._records });
32
34
  }
33
- const criteria = {
34
- criteria: {
35
- codata: request.source,
36
- tipoAnexo: "N"
37
- }
38
- };
39
- const applicationDataFetcher = await this._application.getDataFetcher();
40
- const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
41
- const records = [];
42
- anexo.forEach((param) => {
43
- records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
44
- name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
45
- }] }, param));
46
- });
47
- return Promise.resolve({ records });
35
+ if (!Number.isNaN(Number(request.source))) {
36
+ const criteria = {
37
+ criteria: {
38
+ codata: request.source,
39
+ tipoAnexo: "N"
40
+ }
41
+ };
42
+ const applicationDataFetcher = await this._application.getDataFetcher();
43
+ const { anexos: { anexo = [] } } = await applicationDataFetcher.callServiceBroker(SERVICE_LOAD, JSON.stringify(criteria));
44
+ const records = [];
45
+ anexo.forEach((param) => {
46
+ records.push(Object.assign({ __record__id__: StringUtils.generateUUID(), CAMINHO_ARQUIVO: [{
47
+ name: param === null || param === void 0 ? void 0 : param.ARQUIVO,
48
+ }] }, param));
49
+ });
50
+ this._records = records;
51
+ }
52
+ let records = applyFilter(this._records, dataUnit, request.filters);
53
+ records = applySorting(records, dataUnit, request.sort);
54
+ return Promise.resolve({ records, paginationInfo: buildPaginationInfo(records, request.offset, request.limit) });
48
55
  }
49
56
  saveLoader(changes, fetcher) {
50
57
  return new Promise((resolve) => {
@@ -87,7 +87,7 @@ export class SnkConfigurator {
87
87
  const customElements = container === null || container === void 0 ? void 0 : container.querySelector('#SnkConfigContainerSlot');
88
88
  if (!customElements)
89
89
  return;
90
- const configuratorCustomElement = customElements.firstChild;
90
+ const configuratorCustomElement = customElements.firstElementChild;
91
91
  if (!configuratorCustomElement)
92
92
  return;
93
93
  const insideCustomElementsContainer = this._element.querySelector("#slotContainer");
@@ -31,6 +31,9 @@ export class SnkCrud {
31
31
  this.presentationMode = PresentationMode.PRIMARY;
32
32
  this.messagesBuilder = undefined;
33
33
  this.useEnterLikeTab = false;
34
+ this.gridLegacyConfigName = undefined;
35
+ this.filterBarLegacyConfigName = undefined;
36
+ this.formLegacyConfigName = undefined;
34
37
  this.disablePersonalizedFilter = undefined;
35
38
  this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
36
39
  }
@@ -91,6 +94,12 @@ export class SnkCrud {
91
94
  setViewMode(viewMode) {
92
95
  this._viewStack.show(viewMode);
93
96
  this._currentViewMode = viewMode;
97
+ if (viewMode === VIEW_MODE.GRID) {
98
+ this._snkGrid.setFocus();
99
+ }
100
+ else if (viewMode === VIEW_MODE.FORM) {
101
+ this._guidesViewer.setFocus();
102
+ }
94
103
  }
95
104
  openConfig(viewMode) {
96
105
  this._snkConfigurator.close();
@@ -182,34 +191,34 @@ export class SnkCrud {
182
191
  element.focus();
183
192
  }
184
193
  keyboardManager
185
- .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade." })
186
- .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados." })
187
- .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados." })
188
- .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro." })
189
- .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado." })
190
- .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado." })
194
+ .bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade.", element: this._element })
195
+ .bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
196
+ .bind("ctrl + \\", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
197
+ .bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
198
+ .bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
199
+ .bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
191
200
  .bind("ctrl + .", () => {
192
201
  if (dataUnit.getSelectionInfo().records.length === 0) {
193
202
  return dataUnit.selectFirst();
194
203
  }
195
204
  return dataUnit.nextRecord();
196
205
  }, {
197
- description: "Avança para o próximo registro."
206
+ description: "Avança para o próximo registro.", element: this._element
198
207
  })
199
- .bind("ctrl + ,", dataUnit.previousRecord.bind(dataUnit), { description: "Retorna ao registro anterior." })
208
+ .bind("ctrl + ,", dataUnit.previousRecord.bind(dataUnit), { description: "Retorna ao registro anterior.", element: this._element })
200
209
  .bind("F5", async () => {
201
210
  const currentView = await this._viewStack.getSelectedIndex();
202
211
  if (VIEW_MODE.GRID === currentView) {
203
212
  dataUnit.loadData();
204
213
  }
205
- }, { description: "Atualiza os dados." })
214
+ }, { description: "Atualiza os dados.", element: this._element })
206
215
  .bind("Escape", () => {
207
216
  if (dataUnit.isDirty()) {
208
217
  dataUnit.cancelEdition();
209
218
  }
210
219
  }, {
211
220
  debounceTime: 1000,
212
- description: "Cancela uma ação."
221
+ description: "Cancela uma ação.", element: this._element
213
222
  });
214
223
  }
215
224
  }
@@ -282,7 +291,7 @@ export class SnkCrud {
282
291
  return;
283
292
  }
284
293
  this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
285
- return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
294
+ return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
286
295
  }
287
296
  static get is() { return "snk-crud"; }
288
297
  static get encapsulation() { return "scoped"; }
@@ -536,6 +545,57 @@ export class SnkCrud {
536
545
  "reflect": false,
537
546
  "defaultValue": "false"
538
547
  },
548
+ "gridLegacyConfigName": {
549
+ "type": "string",
550
+ "mutable": false,
551
+ "complexType": {
552
+ "original": "string",
553
+ "resolved": "string",
554
+ "references": {}
555
+ },
556
+ "required": false,
557
+ "optional": false,
558
+ "docs": {
559
+ "tags": [],
560
+ "text": "Chave da configura\u00E7\u00E3o legado da grade."
561
+ },
562
+ "attribute": "grid-legacy-config-name",
563
+ "reflect": false
564
+ },
565
+ "filterBarLegacyConfigName": {
566
+ "type": "string",
567
+ "mutable": false,
568
+ "complexType": {
569
+ "original": "string",
570
+ "resolved": "string",
571
+ "references": {}
572
+ },
573
+ "required": false,
574
+ "optional": false,
575
+ "docs": {
576
+ "tags": [],
577
+ "text": "Chave da configura\u00E7\u00E3o legado da barra de filtros."
578
+ },
579
+ "attribute": "filter-bar-legacy-config-name",
580
+ "reflect": false
581
+ },
582
+ "formLegacyConfigName": {
583
+ "type": "string",
584
+ "mutable": false,
585
+ "complexType": {
586
+ "original": "string",
587
+ "resolved": "string",
588
+ "references": {}
589
+ },
590
+ "required": false,
591
+ "optional": false,
592
+ "docs": {
593
+ "tags": [],
594
+ "text": "Chave da configura\u00E7\u00E3o legado do formul\u00E1rio."
595
+ },
596
+ "attribute": "form-legacy-config-name",
597
+ "reflect": false
598
+ },
539
599
  "disablePersonalizedFilter": {
540
600
  "type": "boolean",
541
601
  "mutable": false,
@@ -1,6 +1,6 @@
1
1
  import { Action } from '@sankhyalabs/core';
2
2
  import { Host, forceUpdate, h } from '@stencil/core';
3
- import { SnkFormConfigManager } from '../../../snk-form/SnkFormConfigManager';
3
+ import { SnkFormConfigManager } from '../../../snk-form-config/SnkFormConfigManager';
4
4
  import { buildFormMetadata } from "@sankhyalabs/ezui/dist/collection/utils/form";
5
5
  import { PresentationMode } from '../../../../lib';
6
6
  import { TaskbarElement } from '../../../snk-taskbar/elements/taskbar-elements';
@@ -236,7 +236,7 @@ export class SnkDetailView {
236
236
  "references": {
237
237
  "SnkFormConfigManager": {
238
238
  "location": "import",
239
- "path": "../../../snk-form/SnkFormConfigManager"
239
+ "path": "../../../snk-form-config/SnkFormConfigManager"
240
240
  }
241
241
  }
242
242
  },
@@ -1,6 +1,6 @@
1
1
  import { Action as DUAction, ElementIDUtils } from '@sankhyalabs/core';
2
2
  import { Fragment, h } from '@stencil/core';
3
- import { SnkFormConfigManager } from '../../snk-form/SnkFormConfigManager';
3
+ import { SnkFormConfigManager } from '../../snk-form-config/SnkFormConfigManager';
4
4
  import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
5
5
  import TaskbarProcessor from '../../snk-taskbar/processor/taskbar-processor';
6
6
  import { TaskbarElement } from '../../snk-taskbar/elements/taskbar-elements';
@@ -26,6 +26,7 @@ export class SnkGuidesViewer {
26
26
  this.presentationMode = undefined;
27
27
  this.resourceID = undefined;
28
28
  this.detailTaskbarCustomContainerId = undefined;
29
+ this.formLegacyConfigName = undefined;
29
30
  this._hasToCreateFieldSearch = true;
30
31
  this._breadcrumbItems = [];
31
32
  this._guides = undefined;
@@ -62,6 +63,12 @@ export class SnkGuidesViewer {
62
63
  async findField() {
63
64
  await openFieldSearch(this._moreOptions, this._fieldSearch);
64
65
  }
66
+ /**
67
+ * Atribui o foco para o componente.
68
+ */
69
+ async setFocus() {
70
+ this._container.focus();
71
+ }
65
72
  exitViewer() {
66
73
  if (this.dataUnit.isDirty()) {
67
74
  this.dataUnit.cancelEdition({ after: () => this.exit.emit() });
@@ -323,11 +330,17 @@ export class SnkGuidesViewer {
323
330
  var _a;
324
331
  return this.selectedGuide === undefined || '__main' === ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id);
325
332
  }
333
+ addFormLegacyConfigName() {
334
+ if (this.formLegacyConfigName) {
335
+ this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
336
+ }
337
+ }
326
338
  componentWillLoad() {
327
339
  if (this.resourceID == undefined) {
328
340
  throw new Error("Erro interno: resourceID não informado");
329
341
  }
330
342
  this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
343
+ this.addFormLegacyConfigName();
331
344
  this._configManager.loadConfig();
332
345
  }
333
346
  componentDidRender() {
@@ -432,17 +445,14 @@ export class SnkGuidesViewer {
432
445
  render() {
433
446
  var _a, _b;
434
447
  if (this._formEditorConfigManager != undefined) {
435
- return (h("snk-form-config", { dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null }));
448
+ return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null }));
436
449
  }
437
- if (!this.dataUnit) {
438
- return;
439
- }
440
- if (!this._configManager.isLoaded) {
450
+ if (!this.dataUnit || !this._configManager.isLoaded) {
441
451
  return;
442
452
  }
443
453
  this.loadTaskbarProcessor();
444
454
  const showGuides = this._guides && (this._guides.length > 1);
445
- return (h("section", { class: "snk-guides-viewer" }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getMessage("snkCrud.title")), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
455
+ return (h("section", { class: "snk-guides-viewer", ref: ref => this._container = ref, tabindex: -1 }, h("div", { class: "ez-row snk-guides-viewer__header" }, h("div", { class: "snk-guides-viewer__header-breadcrumb ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large", key: "header" }, h("ez-button", { onClick: () => this.exitViewer(), title: this.getMessage("snkCrud.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small" }), h("div", { class: "ez-flex ez-flex--column ez-flex-item--auto" }, h("h1", { class: "ez-title ez-title--primary ez-title--xlarge" }, this.getMessage("snkCrud.title")), ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) > 1 &&
446
456
  h("div", { class: "ez-margin-top--extra-small" }, h("ez-breadcrumb", Object.assign({ items: this._breadcrumbItems, onSelectedItem: (evt) => this.onBreadcrumbClickHandler(evt === null || evt === void 0 ? void 0 : evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("breadcrumb")}` }))))), this.presentationMode != PresentationMode.SECONDARY && this.buildTaskBar()), h("div", { class: "snk-guides-viewer__container" }, showGuides ?
447
457
  h("ez-guide-navigator", { ref: (ref) => this._guideNavigator = ref, class: "snk-guides-viewer__guide-navigator", items: this._guides, selectedId: this.selectedGuide ? this.selectedGuide.id : undefined, onEzSelectionChange: evt => this.updateSelectedGuideHandler(evt.detail) })
448
458
  :
@@ -740,6 +750,23 @@ export class SnkGuidesViewer {
740
750
  },
741
751
  "attribute": "detail-taskbar-custom-container-id",
742
752
  "reflect": false
753
+ },
754
+ "formLegacyConfigName": {
755
+ "type": "string",
756
+ "mutable": false,
757
+ "complexType": {
758
+ "original": "string",
759
+ "resolved": "string",
760
+ "references": {}
761
+ },
762
+ "required": false,
763
+ "optional": false,
764
+ "docs": {
765
+ "tags": [],
766
+ "text": "Chave da configura\u00E7\u00E3o legado do formul\u00E1rio."
767
+ },
768
+ "attribute": "form-legacy-config-name",
769
+ "reflect": false
743
770
  }
744
771
  };
745
772
  }
@@ -850,6 +877,22 @@ export class SnkGuidesViewer {
850
877
  "text": "Abre o localizador de campos",
851
878
  "tags": []
852
879
  }
880
+ },
881
+ "setFocus": {
882
+ "complexType": {
883
+ "signature": "() => Promise<void>",
884
+ "parameters": [],
885
+ "references": {
886
+ "Promise": {
887
+ "location": "global"
888
+ }
889
+ },
890
+ "return": "Promise<void>"
891
+ },
892
+ "docs": {
893
+ "text": "Atribui o foco para o componente.",
894
+ "tags": []
895
+ }
853
896
  }
854
897
  };
855
898
  }
@@ -1,3 +1,3 @@
1
- .custom-slot-elements-container{
1
+ :host{
2
2
  display: none;
3
3
  }
@@ -3,8 +3,11 @@ export class SnkCustomSlotElements {
3
3
  constructor() {
4
4
  this.slotName = 'CUSTOM_SLOT_ELEMENTS';
5
5
  }
6
+ componentDidLoad() {
7
+ this.snkCustomSlotElementsLoaded.emit(this.slotName);
8
+ }
6
9
  render() {
7
- return (h(Host, { slot: this.slotName }, h("div", { id: this.slotName, class: "custom-slot-elements-container" }, h("slot", null))));
10
+ return (h(Host, { slot: this.slotName, id: this.slotName, class: "custom-slot-elements-container" }, h("slot", null)));
8
11
  }
9
12
  static get is() { return "snk-custom-slot-elements"; }
10
13
  static get encapsulation() { return "scoped"; }
@@ -40,4 +43,22 @@ export class SnkCustomSlotElements {
40
43
  }
41
44
  };
42
45
  }
46
+ static get events() {
47
+ return [{
48
+ "method": "snkCustomSlotElementsLoaded",
49
+ "name": "snkCustomSlotElementsLoaded",
50
+ "bubbles": true,
51
+ "cancelable": true,
52
+ "composed": true,
53
+ "docs": {
54
+ "tags": [],
55
+ "text": "Emitido quando elemento \u00E9 carregado na tela."
56
+ },
57
+ "complexType": {
58
+ "original": "string",
59
+ "resolved": "string",
60
+ "references": {}
61
+ }
62
+ }];
63
+ }
43
64
  }
@@ -236,14 +236,14 @@ export class SnkDataExporter {
236
236
  const pkObject = [];
237
237
  const appId = (option === null || option === void 0 ? void 0 : option.replace(this._customPrefix, "")) || "";
238
238
  (_a = this.provider) === null || _a === void 0 ? void 0 : _a.getSelectedIDs().forEach(({ name, type, value }, index) => {
239
- const fields = [];
239
+ const fields = {};
240
240
  fields['fields'] = [];
241
241
  // Se for o primeiro elemento, adiciona essa primeira PK
242
242
  if (index === 0) {
243
243
  pkObject[`PK_${name}`] = { type: this.parseDataType(type), value };
244
244
  pkObject['pks'] = [];
245
245
  }
246
- const dataFields = { nome: name, tipo: this.parseDataType(type), valor: value };
246
+ const dataFields = { nome: `PK_${name}`, tipo: this.parseDataType(type), valor: value };
247
247
  fields['fields'].push(dataFields);
248
248
  pkObject['pks'].push(fields);
249
249
  });
@@ -8,6 +8,7 @@ export class SnkFilterDetail {
8
8
  constructor() {
9
9
  this.config = undefined;
10
10
  this.getMessage = undefined;
11
+ this.showHardFixed = true;
11
12
  }
12
13
  /**
13
14
  * Exibe o componente snk-filter-detail.
@@ -85,7 +86,9 @@ export class SnkFilterDetail {
85
86
  return Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined });
86
87
  }
87
88
  getPopUpHeaderButtons() {
88
- return (h(Fragment, null, !this.config.removalBlocked && this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), !this.config.hardFixed && this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
89
+ return (h(Fragment, null, !this.config.removalBlocked &&
90
+ this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), this.showHardFixed && !this.config.hardFixed &&
91
+ this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
89
92
  }
90
93
  buildIcon(title, iconName, action) {
91
94
  return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", ref: elem => elem && this.buildIdButton(elem, title) }, h("ez-icon", Object.assign({ title: title, iconName: iconName }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`_${title}`)}` }))));
@@ -196,6 +199,24 @@ export class SnkFilterDetail {
196
199
  "tags": [],
197
200
  "text": "Usado pra flexibilizar os verbetes e mensagens de acordo com o SnkMessageBuilder."
198
201
  }
202
+ },
203
+ "showHardFixed": {
204
+ "type": "boolean",
205
+ "mutable": false,
206
+ "complexType": {
207
+ "original": "boolean",
208
+ "resolved": "boolean",
209
+ "references": {}
210
+ },
211
+ "required": false,
212
+ "optional": false,
213
+ "docs": {
214
+ "tags": [],
215
+ "text": "Controla a visibilidade do bot\u00E3o de fixar elemento"
216
+ },
217
+ "attribute": "show-hard-fixed",
218
+ "reflect": false,
219
+ "defaultValue": "true"
199
220
  }
200
221
  };
201
222
  }