@sankhyalabs/sankhyablocks 5.4.3 → 5.6.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 (223) hide show
  1. package/dist/cjs/{SnkMessageBuilder-115e8a80.js → SnkMessageBuilder-e64dce7f.js} +49 -1
  2. package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
  3. package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
  4. package/dist/cjs/index-8d94b7e0.js +7 -0
  5. package/dist/cjs/{index-fc7ca86c.js → index-de79181a.js} +2 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-application.cjs.entry.js +3 -315
  9. package/dist/cjs/snk-attach.cjs.entry.js +450 -0
  10. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-crud.cjs.entry.js +23 -13
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  14. package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-85d6565e.js} +4 -1
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
  18. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
  20. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-grid.cjs.entry.js +11 -3
  23. package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-9784c527.js} +2 -2
  24. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  25. package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
  26. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  27. package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +48 -5
  28. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-taskbar.cjs.entry.js +6 -4
  30. package/dist/cjs/{taskbar-elements-5e87cf44.js → taskbar-elements-bc2598f9.js} +4 -1
  31. package/dist/collection/collection-manifest.json +4 -1
  32. package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
  33. package/dist/collection/components/snk-attach/snk-attach.css +8 -0
  34. package/dist/collection/components/snk-attach/snk-attach.js +202 -0
  35. package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
  36. package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
  37. package/dist/collection/components/snk-attach/structure/index.js +3 -0
  38. package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
  39. package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
  40. package/dist/collection/components/snk-crud/snk-crud.js +22 -11
  41. package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
  42. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
  43. package/dist/collection/components/snk-grid/snk-grid.js +11 -3
  44. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
  45. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
  46. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
  47. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
  48. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
  49. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
  50. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +37 -2
  51. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
  52. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
  53. package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
  54. package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
  55. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
  56. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
  57. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
  58. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
  59. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
  60. package/dist/collection/lib/message/SnkMessageBuilder.js +7 -1
  61. package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
  62. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
  63. package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
  64. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  65. package/dist/collection/lib/store/index.js +2 -1
  66. package/dist/collection/lib/utils/constants.js +1 -0
  67. package/dist/components/SnkMessageBuilder.js +49 -1
  68. package/dist/components/constants.js +1 -0
  69. package/dist/components/dataunit-fetcher.js +317 -0
  70. package/dist/components/index.d.ts +3 -0
  71. package/dist/components/index.js +3 -0
  72. package/dist/components/index2.js +1 -1
  73. package/dist/components/index3.js +199 -0
  74. package/dist/components/snk-application2.js +2 -314
  75. package/dist/components/snk-attach.d.ts +11 -0
  76. package/dist/components/snk-attach.js +6 -0
  77. package/dist/components/snk-attach2.js +498 -0
  78. package/dist/components/snk-crud.js +77 -48
  79. package/dist/components/snk-data-exporter2.js +1 -1
  80. package/dist/components/snk-data-unit2.js +4 -0
  81. package/dist/components/snk-expression-item.d.ts +11 -0
  82. package/dist/components/snk-expression-item.js +6 -0
  83. package/dist/components/snk-expression-item2.js +241 -0
  84. package/dist/components/snk-filter-field-search.js +1 -200
  85. package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
  86. package/dist/components/snk-filter-param-config.js +1 -273
  87. package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
  88. package/dist/components/snk-grid2.js +12 -4
  89. package/dist/components/snk-personalized-filter.d.ts +11 -0
  90. package/dist/components/snk-personalized-filter.js +158 -0
  91. package/dist/components/snk-simple-bar.js +1 -41
  92. package/dist/components/snk-simple-bar2.js +59 -0
  93. package/dist/components/snk-simple-crud.js +1 -328
  94. package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
  95. package/dist/components/snk-taskbar2.js +10 -199
  96. package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-f3590f65.js} +49 -1
  97. package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
  98. package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
  99. package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
  100. package/dist/esm/index-620ac460.js +7 -0
  101. package/dist/esm/{index-e467ade5.js → index-8efbf198.js} +2 -1
  102. package/dist/esm/loader.js +1 -1
  103. package/dist/esm/sankhyablocks.js +1 -1
  104. package/dist/esm/snk-application.entry.js +3 -315
  105. package/dist/esm/snk-attach.entry.js +446 -0
  106. package/dist/esm/snk-config-options.entry.js +1 -1
  107. package/dist/esm/snk-configurator.entry.js +1 -1
  108. package/dist/esm/snk-crud.entry.js +25 -15
  109. package/dist/esm/snk-data-exporter.entry.js +4 -4
  110. package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-50b1660c.js} +4 -1
  111. package/dist/esm/snk-data-unit.entry.js +2 -2
  112. package/dist/esm/snk-detail-view.entry.js +6 -6
  113. package/dist/esm/snk-expression-item.entry.js +209 -0
  114. package/dist/esm/snk-field-config.entry.js +1 -1
  115. package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
  116. package/dist/esm/snk-form-config.entry.js +1 -1
  117. package/dist/esm/snk-grid-config.entry.js +1 -1
  118. package/dist/esm/snk-grid.entry.js +13 -5
  119. package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-4d12f268.js} +3 -3
  120. package/dist/esm/snk-guides-viewer.entry.js +5 -5
  121. package/dist/esm/snk-personalized-filter.entry.js +122 -0
  122. package/dist/esm/snk-select-box.entry.js +1 -1
  123. package/dist/esm/snk-simple-bar_2.entry.js +325 -0
  124. package/dist/esm/snk-tab-config.entry.js +1 -1
  125. package/dist/esm/snk-taskbar.entry.js +7 -5
  126. package/dist/esm/{taskbar-elements-10d80c79.js → taskbar-elements-e6af3e93.js} +5 -2
  127. package/dist/sankhyablocks/p-17375123.js +1 -0
  128. package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
  129. package/dist/sankhyablocks/p-1dcfd32a.entry.js +1 -0
  130. package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
  131. package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
  132. package/dist/sankhyablocks/p-3d3263b4.js +1 -0
  133. package/dist/sankhyablocks/p-3fbe2d69.entry.js +11 -0
  134. package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
  135. package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
  136. package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
  137. package/dist/sankhyablocks/p-6a02e236.js +1 -0
  138. package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
  139. package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
  141. package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
  142. package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
  143. package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-c4417efb.entry.js} +1 -1
  144. package/dist/sankhyablocks/p-c9477950.js +1 -0
  145. package/dist/sankhyablocks/{p-703dddb9.js → p-ccd26e3a.js} +1 -1
  146. package/dist/sankhyablocks/p-d410f45a.js +1 -0
  147. package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
  148. package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-1393dc00.entry.js → p-f344b811.entry.js} +1 -1
  151. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  152. package/dist/sankhyablocks/p-f821768b.js +74 -0
  153. package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
  154. package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
  155. package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
  156. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  157. package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
  158. package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
  159. package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
  160. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
  161. package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
  162. package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
  163. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
  164. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
  165. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
  166. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
  167. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
  168. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
  169. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
  170. package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +14 -0
  171. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  172. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
  173. package/dist/types/components.d.ts +150 -9
  174. package/dist/types/global.d.ts +9 -0
  175. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
  176. package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
  177. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
  178. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
  179. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
  180. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
  181. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
  182. package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
  183. package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
  184. package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
  185. package/dist/types/lib/store/index.d.ts +1 -0
  186. package/dist/types/lib/utils/constants.d.ts +2 -1
  187. package/package.json +1 -1
  188. package/react/components.d.ts +3 -0
  189. package/react/components.js +3 -0
  190. package/react/components.js.map +1 -1
  191. package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
  192. package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
  193. package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
  194. package/dist/esm/snk-simple-bar.entry.js +0 -26
  195. package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
  196. package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
  197. package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
  198. package/dist/sankhyablocks/p-74724fa7.js +0 -1
  199. package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
  200. package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
  201. package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
  202. package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
  203. package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
  204. package/dist/sankhyablocks/p-98f7f796.js +0 -1
  205. package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
  206. package/dist/sankhyablocks/p-bc281de0.js +0 -1
  207. package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
  208. package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
  209. package/dist/sankhyablocks/p-f587a454.js +0 -1
  210. package/dist/types/components/snk-application/snk-application.d.ts +0 -259
  211. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
  212. package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
  213. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
  214. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
  215. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
  216. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
  217. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
  218. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
  219. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
  220. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
  221. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
  222. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
  223. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
- const constants = require('./constants-ae0ed870.js');
6
+ const constants = require('./constants-3787fa32.js');
7
7
 
8
8
  const snkSelectBoxCss = "ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";
9
9
 
@@ -4,15 +4,52 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const constants = require('./constants-ae0ed870.js');
8
- const taskbarElements = require('./taskbar-elements-5e87cf44.js');
7
+ const constants = require('./constants-3787fa32.js');
8
+ const taskbarElements = require('./taskbar-elements-bc2598f9.js');
9
9
  require('./DataFetcher-a9d0228f.js');
10
10
  require('./pesquisa-fetcher-954b74c3.js');
11
11
  const index$1 = require('./index-f400b1d6.js');
12
12
  const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
13
- require('./index-fc7ca86c.js');
13
+ require('./index-de79181a.js');
14
14
  require('./_commonjsHelpers-537d719a.js');
15
15
 
16
+ const snkSimpleBarCss = ".sc-snk-simple-bar-h{display:flex;height:100%;width:100%}.simple-bar__container.sc-snk-simple-bar{flex:1;display:flex;align-items:stretch;gap:var(--space--small)}.simple-bar__left-slot.sc-snk-simple-bar{min-width:280px;flex:1;display:flex;align-items:center}.simple-bar__right-slot.sc-snk-simple-bar{flex:1;display:flex;align-items:center;justify-content:flex-end}.simple-bar__column.sc-snk-simple-bar{flex:1;display:flex;flex-direction:column}";
17
+
18
+ const SnkSimpleBar = class {
19
+ constructor(hostRef) {
20
+ index.registerInstance(this, hostRef);
21
+ this.clickBreadcrumbItem = index.createEvent(this, "clickBreadcrumbItem", 3);
22
+ this.exit = index.createEvent(this, "exit", 3);
23
+ this.label = undefined;
24
+ this.breadcrumbItens = undefined;
25
+ this.messagesBuilder = undefined;
26
+ }
27
+ /**
28
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
29
+ * através de um pequeno modulo na estrutura da aplicação:
30
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
31
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-simple-bar.msg.ts"
32
+ */
33
+ getMessage(key, params) {
34
+ var _a;
35
+ if (this.messagesBuilder)
36
+ return this.messagesBuilder.getMessage(key, params);
37
+ if ((_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder)
38
+ return this._application.messagesBuilder.getMessage(key, params);
39
+ }
40
+ componentDidLoad() {
41
+ if (!this._element)
42
+ return;
43
+ core.ElementIDUtils.addIDInfo(this._element);
44
+ this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
45
+ }
46
+ render() {
47
+ return (index.h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, index.h("div", { class: "simple-bar__left-slot" }, index.h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), index.h("div", { class: "simple-bar__column" }, index.h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), index.h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), index.h("div", { class: "simple-bar__right-slot" }, index.h("slot", { name: "rightSlot" }))));
48
+ }
49
+ get _element() { return index.getElement(this); }
50
+ };
51
+ SnkSimpleBar.style = snkSimpleBarCss;
52
+
16
53
  class InMemoryLoader {
17
54
  constructor(metadata, records) {
18
55
  this.records = records || [];
@@ -146,6 +183,9 @@ const SnkSimpleCrud = class {
146
183
  this.dataState = undefined;
147
184
  this.dataUnit = undefined;
148
185
  this.mode = constants.SIMPLE_CRUD_MODE.SERVER;
186
+ this.gridConfig = undefined;
187
+ this.formConfig = undefined;
188
+ this.useCancelConfirm = true;
149
189
  this.taskbarManager = undefined;
150
190
  this.messagesBuilder = undefined;
151
191
  }
@@ -250,7 +290,9 @@ const SnkSimpleCrud = class {
250
290
  fieldMetadata.push(field);
251
291
  });
252
292
  if (fieldMetadata.length > 0) {
253
- this._config = formConfig;
293
+ if (!this.formConfig) {
294
+ this.formConfig = formConfig;
295
+ }
254
296
  this._metadata = {
255
297
  name: "SimpleCrud",
256
298
  label: "SimpleCrud",
@@ -274,7 +316,7 @@ const SnkSimpleCrud = class {
274
316
  }
275
317
  render() {
276
318
  var _a;
277
- return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-flex ez-box ez-box--shadow" }, index.h("snk-taskbar", { class: "simple-crud__taskbar ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }), index.h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), "no-header": true }, index.h("div", { slot: "footer" }, index.h("slot", { name: "snkSimpleCrudFooter" })))), index.h("stack-item", null, index.h("ez-form", { dataUnit: this.dataUnit, config: this._config }))))));
319
+ return (index.h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(constants.VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, index.h("header", null, index.h("slot", { name: "snkSimpleCrudHeader" })), index.h("section", { class: "ez-flex ez-box ez-box--shadow" }, index.h("snk-taskbar", { class: "simple-crud__taskbar ez-box ez-box--shadow ez-padding--medium", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: index$1.PresentationMode.SECONDARY }), index.h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index.h("stack-item", null, index.h("ez-grid", { dataUnit: this.dataUnit, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), config: this.gridConfig, "no-header": true }, 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 }))))));
278
320
  }
279
321
  get _element() { return index.getElement(this); }
280
322
  static get watchers() { return {
@@ -284,4 +326,5 @@ const SnkSimpleCrud = class {
284
326
  };
285
327
  SnkSimpleCrud.style = snkSimpleCrudCss;
286
328
 
329
+ exports.snk_simple_bar = SnkSimpleBar;
287
330
  exports.snk_simple_crud = SnkSimpleCrud;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const draggable_bundle = require('./draggable.bundle-82a25c06.js');
7
7
  const core = require('@sankhyalabs/core');
8
- const constants = require('./constants-ae0ed870.js');
8
+ const constants = require('./constants-3787fa32.js');
9
9
  require('./_commonjsHelpers-537d719a.js');
10
10
 
11
11
  const snkTabConfigCss = "@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}.sc-snk-tab-config-h{--snk-tab-config--backward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--snk-tab-config--forward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--snk-tab-config__lower-bar--background-color:var(--color--disable-primary, #e5eaf0);--snk-tab-config__lower-bar--border:2px solid var(--color--disable-primary, #e5eaf0);--snk-tab-config__tab--color:var(--text--primary, #626e82);--snk-tab-config__tab--font-family:var(--font-pattern, \"Roboto\");--snk-tab-config__tab--font-size:var(--title--small, 14px);--snk-tab-config__tab--padding:var(--space--small, 6px) var(--space--medium, 12px);--snk-tab-config__tab-is-active--color:var(--color--primary, #008561);--snk-tab-config__tab-hover--color:var(--color--secondary, #383c45);--snk-tab-config__tab-is-focused--border:1px dashed var(--color--primary, #008561);--snk-tab-config__tab-label--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--snk-tab-config__tab-label--margin-bottom:var(--space--extra-small, 3px);--snk-tab-config__new-button-icon--color:var(--color--secondary-700, #1C1D22);--snk-tab-config__forward-button--background-color:var(--text--primary, #626e82);--snk-tab-config__forward-button-hover--background-color:var(--color--primary, #008561);--snk-tab-config__left-icon--padding-right:var(--space--small, 6px);--snk-tab-config__left-icon--color:var(--text--disable, #AFB6C0);--snk-tab-config__tab-label-disabled--color:var(--text--disable, #AFB6C0);--snk-tab-config__slot--margin-left:var(--space--small, 6px);display:flex;position:relative;width:100%;overflow:hidden}.tab-config__scroll.sc-snk-tab-config{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.tab-config__lower-bar.sc-snk-tab-config{position:absolute;left:0%;right:0%;top:91%;bottom:0%;border-radius:2px;background-color:var(--snk-tab-config__lower-bar--background-color);border:var(--snk-tab-config__lower-bar--border)}.tab-config__tab.sc-snk-tab-config{display:flex;border:none;background-color:unset;cursor:pointer;align-items:center;justify-content:center;min-width:fit-content;color:var(--snk-tab-config__tab--color);font-family:var(--snk-tab-config__tab--font-family);font-size:var(--snk-tab-config__tab--font-size);padding:var(--snk-tab-config__tab--padding)}.tab-config__tab.sc-snk-tab-config:focus,.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{outline:none}.tab-config__tab--is-active.sc-snk-tab-config{position:relative;color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-active.sc-snk-tab-config::after{content:\"\";position:absolute;width:100%;height:100%;clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out;background-color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-focused.sc-snk-tab-config{border:var(--snk-tab-config__tab-is-focused--border)}.tab-config__tab-label.sc-snk-tab-config{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--snk-tab-config__tab-label--text-shadow);margin-bottom:var(--snk-tab-config__tab-label--margin-bottom)}.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__new-button-icon--color)}.tab-config__backward-button.sc-snk-tab-config{left:0px;box-shadow:10px 10px 5px 5px white;background:white}.tab-config__forward-button.sc-snk-tab-config{box-shadow:10px 10px 5px 20px white;background:white}.tab-config__forward-button.sc-snk-tab-config::after,.tab-config__backward-button.sc-snk-tab-config::after{content:'';display:flex;width:10px;height:16px;background-color:var(--snk-tab-config__forward-button--background-color)}.tab-config__forward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--forward-icon);mask-image:var(--snk-tab-config--forward-icon)}.tab-config__backward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--backward-icon);mask-image:var(--snk-tab-config--backward-icon)}.tab-config__forward-button.sc-snk-tab-config:hover::after,.tab-config__backward-button.sc-snk-tab-config:hover::after{background-color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__new-button.sc-snk-tab-config:hover ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__hidden.sc-snk-tab-config{display:none}.tab-config__scroll.sc-snk-tab-config::-webkit-scrollbar{display:none}.tab-config__left-icon.sc-snk-tab-config{padding-right:var(--snk-tab-config__left-icon--padding-right);--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__left-icon--eye-off.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__right-icon.sc-snk-tab-config{visibility:hidden;padding-left:var(--snk-tab-config__left-icon--padding-right)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{visibility:visible}.tab-config__tab--is-active.sc-snk-tab-config .tab-config__right-icon.sc-snk-tab-config{visibility:visible;--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__actions-button.sc-snk-tab-config{--ez-actions-button__btn-action--min-width:100px;visibility:hidden;opacity:0;transition:visibility 1s linear, opacity 0.3s linear}.tab-config__tab.sc-snk-tab-config:hover .tab-config__actions-button.sc-snk-tab-config{visibility:visible;opacity:1;transition:visibility 0.2s linear, opacity 0.10s linear}[data-draggable-element].sc-snk-tab-config{cursor:grab}.tab-config__tab-label-disabled.sc-snk-tab-config{color:var(--snk-tab-config__tab-label-disabled--color)}.tab-config__slot.sc-snk-tab-config{margin-left:var(--snk-tab-config__slot--margin-left)}";
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const AuthorizationConfig = require('./AuthorizationConfig-79ffae4b.js');
8
- const taskbarElements = require('./taskbar-elements-5e87cf44.js');
8
+ const taskbarElements = require('./taskbar-elements-bc2598f9.js');
9
9
  const index$1 = require('./index-f400b1d6.js');
10
- require('./index-fc7ca86c.js');
10
+ require('./index-de79181a.js');
11
11
 
12
12
  const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
13
13
 
@@ -28,7 +28,8 @@ const SnkTaskbar = class {
28
28
  [taskbarElements.TaskbarElement.SAVE]: "snkTaskbar.titleSave",
29
29
  [taskbarElements.TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
30
30
  [taskbarElements.TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
31
- [taskbarElements.TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator"
31
+ [taskbarElements.TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
32
+ [taskbarElements.TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
32
33
  };
33
34
  this._permissions = undefined;
34
35
  this.configName = undefined;
@@ -135,7 +136,8 @@ const SnkTaskbar = class {
135
136
  if (index > 1) {
136
137
  className += "ez-padding-left--medium";
137
138
  }
138
- if (taskbarElements.TaskbarElement[def.toString()]) {
139
+ const taskbarElement = taskbarElements.TaskbarElement[def.toString()];
140
+ if (taskbarElement) {
139
141
  return taskbarElements.buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList, this.configName, this.presentationMode);
140
142
  }
141
143
  else {
@@ -2,7 +2,7 @@
2
2
 
3
3
  const index = require('./index-21bd01e1.js');
4
4
  const index$2 = require('./index-f400b1d6.js');
5
- const index$1 = require('./index-fc7ca86c.js');
5
+ const index$1 = require('./index-de79181a.js');
6
6
 
7
7
  exports.TaskbarElement = void 0;
8
8
  (function (TaskbarElement) {
@@ -21,6 +21,7 @@ exports.TaskbarElement = void 0;
21
21
  TaskbarElement["DIVIDER"] = "DIVIDER";
22
22
  TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
23
23
  TaskbarElement["DATA_EXPORTER"] = "DATA_EXPORTER";
24
+ TaskbarElement["ATTACH"] = "ATTACH";
24
25
  })(exports.TaskbarElement || (exports.TaskbarElement = {}));
25
26
  exports.AuthorizationElements = void 0;
26
27
  (function (AuthorizationElements) {
@@ -93,6 +94,8 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
93
94
  case exports.TaskbarElement.DATA_EXPORTER:
94
95
  const provider = (_a = index$1.store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
95
96
  return index.h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId });
97
+ case exports.TaskbarElement.ATTACH:
98
+ return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
96
99
  }
97
100
  };
98
101
  function textButton(name, className, dataElementId, text, title, action, isEnabled) {
@@ -7,6 +7,8 @@
7
7
  "./components/snk-filter-bar/filter-list/snk-filter-list.js",
8
8
  "./components/snk-filter-bar/filter-modal/snk-filter-modal.js",
9
9
  "./components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js",
10
+ "./components/snk-simple-crud/snk-simple-crud.js",
11
+ "./components/snk-attach/snk-attach.js",
10
12
  "./components/snk-configurator/snk-configurator.js",
11
13
  "./components/snk-crud/snk-crud.js",
12
14
  "./components/snk-crud/subcomponents/snk-guides-viewer.js",
@@ -32,10 +34,11 @@
32
34
  "./components/snk-grid/snk-grid.js",
33
35
  "./components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js",
34
36
  "./components/snk-grid/subcomponents/snk-select-box/snk-select-box.js",
37
+ "./components/snk-personalized-filter/snk-personalized-filter.js",
38
+ "./components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js",
35
39
  "./components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js",
36
40
  "./components/snk-pesquisa/snk-pesquisa.js",
37
41
  "./components/snk-simple-bar/snk-simple-bar.js",
38
- "./components/snk-simple-crud/snk-simple-crud.js",
39
42
  "./components/teste-pesquisa/teste-pesquisa.js"
40
43
  ],
41
44
  "compiler": {
@@ -0,0 +1,8 @@
1
+ .snk-attach__header, .snk-attach__crud-section {
2
+ padding: 0 var(--space--lg);
3
+ }
4
+
5
+ .snk-attach__file-info {
6
+ padding: var(--space--small);
7
+ max-width: 50%;
8
+ }
@@ -0,0 +1,202 @@
1
+ import { h } from "@stencil/core";
2
+ import { ApplicationContext } from "@sankhyalabs/core";
3
+ import { AttachFetcher } from "../../lib/http/data-fetcher/fetchers/attach-fetcher";
4
+ import { VIEW_MODE } from "../../lib/utils/constants";
5
+ import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
6
+ import { AttachmentDataUnitBuilder, buildTaskBarManager, crudConfig } from "./structure";
7
+ const RESOURCE_ID = 'AnexoSistema';
8
+ const DATA_UNIT_NAME = 'br.com.sankhya.core.v3.anexoSistema';
9
+ export class SnkAttach {
10
+ constructor() {
11
+ this.handleTaskbarClick = ({ detail: taskbar }) => {
12
+ if (["DOWNLOAD", "LINK"].includes(taskbar))
13
+ return this.downloadAttachment(this.dataUnit.getSelectedRecord());
14
+ };
15
+ this.handleBack = () => {
16
+ this.dataUnit.cancelEdition().then((cancelationConfirmed) => {
17
+ if (cancelationConfirmed)
18
+ this.back.emit();
19
+ });
20
+ };
21
+ this.handleFinish = () => {
22
+ if (!this.dataUnit.isDirty())
23
+ return this.back.emit();
24
+ this.dataUnit.saveData().then(() => {
25
+ this.showFinishedToast();
26
+ this.back.emit();
27
+ });
28
+ };
29
+ this.registerKey = undefined;
30
+ this.entityName = undefined;
31
+ this.messagesBuilder = undefined;
32
+ this.dataUnit = undefined;
33
+ this.crudConfig = {};
34
+ }
35
+ registerKeyWatcher(newRegisterKey, oldRegisterKey) {
36
+ var _a;
37
+ if (oldRegisterKey !== newRegisterKey) {
38
+ 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();
42
+ }
43
+ }
44
+ /**
45
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
46
+ * através de um pequeno modulo na estrutura da aplicação:
47
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
48
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-attach.msg.ts"
49
+ */
50
+ getMessage(key, params) {
51
+ if (this.messagesBuilder)
52
+ return this.messagesBuilder.getMessage(key, params);
53
+ }
54
+ showFinishedToast() {
55
+ this._application.info(this.getMessage('snkAttach.finishedMessage'), { iconName: "check" });
56
+ }
57
+ downloadAttachment(selectedRecord) {
58
+ if (!selectedRecord)
59
+ throw new Error('Nenhum registro selecionado');
60
+ if (selectedRecord.LINK) {
61
+ window.open(`${selectedRecord.LINK}`);
62
+ return;
63
+ }
64
+ this._attachFetcher.getDownloadKey(selectedRecord).then(({ chave }) => {
65
+ window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${chave.valor}&forcarDownload=S`);
66
+ });
67
+ }
68
+ returnToGridMode() {
69
+ this.dataUnit.clearSelection();
70
+ if (this._crudElement)
71
+ this._crudElement.goToView(VIEW_MODE.GRID);
72
+ }
73
+ loadAttachmentDataUnit() {
74
+ var _a;
75
+ 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();
87
+ return this.dataUnit;
88
+ }
89
+ catch (error) {
90
+ throw new Error('There was an error while creating the data unit');
91
+ }
92
+ }
93
+ componentWillLoad() {
94
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
95
+ this.loadAttachmentDataUnit();
96
+ }
97
+ render() {
98
+ if (!this.dataUnit)
99
+ return null;
100
+ return (h("main", null, 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: this.crudConfig.grid, formConfig: this.crudConfig.form, useCancelConfirm: false, onActionClick: this.handleTaskbarClick }, 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")))))))));
101
+ }
102
+ static get is() { return "snk-attach"; }
103
+ static get encapsulation() { return "scoped"; }
104
+ static get originalStyleUrls() {
105
+ return {
106
+ "$": ["snk-attach.css"]
107
+ };
108
+ }
109
+ static get styleUrls() {
110
+ return {
111
+ "$": ["snk-attach.css"]
112
+ };
113
+ }
114
+ static get properties() {
115
+ return {
116
+ "registerKey": {
117
+ "type": "string",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "string",
121
+ "resolved": "string",
122
+ "references": {}
123
+ },
124
+ "required": true,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "Identifica\u00E7\u00E3o do registro pai."
129
+ },
130
+ "attribute": "register-key",
131
+ "reflect": false
132
+ },
133
+ "entityName": {
134
+ "type": "string",
135
+ "mutable": false,
136
+ "complexType": {
137
+ "original": "string",
138
+ "resolved": "string",
139
+ "references": {}
140
+ },
141
+ "required": true,
142
+ "optional": false,
143
+ "docs": {
144
+ "tags": [],
145
+ "text": "Nome da entidade \u00E0 ser utilizada para relacionar o anexo ao DataUnit pai."
146
+ },
147
+ "attribute": "entity-name",
148
+ "reflect": false
149
+ },
150
+ "messagesBuilder": {
151
+ "type": "unknown",
152
+ "mutable": true,
153
+ "complexType": {
154
+ "original": "SnkMessageBuilder",
155
+ "resolved": "SnkMessageBuilder",
156
+ "references": {
157
+ "SnkMessageBuilder": {
158
+ "location": "import",
159
+ "path": "../../lib/message/SnkMessageBuilder"
160
+ }
161
+ }
162
+ },
163
+ "required": false,
164
+ "optional": false,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
168
+ }
169
+ }
170
+ };
171
+ }
172
+ static get states() {
173
+ return {
174
+ "dataUnit": {},
175
+ "crudConfig": {}
176
+ };
177
+ }
178
+ static get events() {
179
+ return [{
180
+ "method": "back",
181
+ "name": "back",
182
+ "bubbles": true,
183
+ "cancelable": true,
184
+ "composed": true,
185
+ "docs": {
186
+ "tags": [],
187
+ "text": "Evento disparado quando o usu\u00E1rio clica no bot\u00E3o voltar."
188
+ },
189
+ "complexType": {
190
+ "original": "void",
191
+ "resolved": "void",
192
+ "references": {}
193
+ }
194
+ }];
195
+ }
196
+ static get watchers() {
197
+ return [{
198
+ "propName": "registerKey",
199
+ "methodName": "registerKeyWatcher"
200
+ }];
201
+ }
202
+ }
@@ -0,0 +1,37 @@
1
+ export const crudConfig = {
2
+ grid: {
3
+ columns: [
4
+ { name: "ARQUIVOOULINK", orderIndex: 0, width: 0 },
5
+ { name: "DESCRICAO", orderIndex: 1, width: 0 },
6
+ { name: "DHCAD", orderIndex: 2, width: 0 },
7
+ { name: "DHALTER", orderIndex: 3, width: 0 },
8
+ { name: "TIPOAPRES", orderIndex: 4, width: 0 },
9
+ { name: "TIPOACESSO", orderIndex: 5, width: 0 },
10
+ { name: "CODUSU", orderIndex: 6, width: 0 },
11
+ { name: "CODUSUALT", orderIndex: 7, width: 0 }
12
+ ]
13
+ },
14
+ form: {
15
+ emptyConfig: false,
16
+ fields: [
17
+ {
18
+ name: "DESCRICAO",
19
+ required: true
20
+ },
21
+ {
22
+ name: "TIPOAPRES",
23
+ required: true,
24
+ },
25
+ {
26
+ name: "TIPOACESSO",
27
+ required: true,
28
+ },
29
+ {
30
+ name: "LINK"
31
+ },
32
+ {
33
+ name: "NOMEARQUIVO"
34
+ }
35
+ ]
36
+ },
37
+ };
@@ -0,0 +1,106 @@
1
+ import { Action, ApplicationContext, DataType } from "@sankhyalabs/core";
2
+ import { SaveErrorsEnum } from "../../../lib/http/data-fetcher/fetchers/fecthAttach/interfaces";
3
+ import { VIEW_MODE } from "../../../lib/utils/constants";
4
+ export class AttachmentDataUnitBuilder {
5
+ constructor(entityName, getMessage) {
6
+ this.entityName = entityName;
7
+ this.getMessage = getMessage;
8
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
9
+ }
10
+ initLoaders(dataUnit, attachFetcher, onSuccess) {
11
+ if (!this.loader)
12
+ this.loader = dataUnit.dataLoader;
13
+ dataUnit.dataLoader = (dataUnit, request) => this.dataLoader(dataUnit, request);
14
+ dataUnit.saveLoader = (_, changes) => this.saveLoader(changes, attachFetcher).then((recordIds) => {
15
+ if (recordIds.length)
16
+ onSuccess();
17
+ return recordIds;
18
+ });
19
+ dataUnit.removeLoader = (dataUnit, ids) => this.removeLoader(dataUnit, ids, attachFetcher).then((recordIds) => {
20
+ if (recordIds.length)
21
+ onSuccess();
22
+ return recordIds;
23
+ });
24
+ }
25
+ dataLoader(dataUnit, request) {
26
+ return new Promise(resolve => {
27
+ this.loader(dataUnit, request).then(response => {
28
+ const records = ((response === null || response === void 0 ? void 0 : response.records) || []).map(record => {
29
+ let fileInfo;
30
+ if (!record.LINK)
31
+ fileInfo = [{
32
+ name: record.NOMEARQUIVO,
33
+ }];
34
+ return Object.assign(Object.assign({}, record), { ARQUIVOOULINK: !!record.LINK ? record.LINK : record.NOMEARQUIVO, NOMEARQUIVO: fileInfo });
35
+ });
36
+ resolve(Object.assign(Object.assign({}, response), { records }));
37
+ });
38
+ });
39
+ }
40
+ saveLoader(changes, attachFetcher) {
41
+ return new Promise((resolve) => {
42
+ var _a;
43
+ const change = Array.isArray(changes) ? changes[0] : {};
44
+ const savePromise = ((_a = change === null || change === void 0 ? void 0 : change.record) === null || _a === void 0 ? void 0 : _a.NUATTACH) >= 0 ? attachFetcher.edit.bind(attachFetcher) : attachFetcher.save.bind(attachFetcher);
45
+ savePromise(change).then((records) => {
46
+ resolve(records);
47
+ }).catch((error) => {
48
+ if (error.message === SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME) {
49
+ this._application.alert(this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.title'), this.getMessage('snkAttach.alertValidation.fileAndLinkAtTheSameTime.message'));
50
+ return resolve([]);
51
+ }
52
+ if (error.message === SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED) {
53
+ this._application.alert(this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.title'), this.getMessage('snkAttach.alertValidation.anyLinkOrFileFilled.message'));
54
+ return resolve([]);
55
+ }
56
+ if (error.message) {
57
+ this._application.error((error.title || error.name), error.message);
58
+ return resolve([]);
59
+ }
60
+ resolve([]);
61
+ });
62
+ });
63
+ }
64
+ removeLoader(dataUnit, ids, attachFetcher) {
65
+ return new Promise((resolve) => {
66
+ const { records } = dataUnit.getSelectionInfo();
67
+ attachFetcher.delete(records[0]).then(() => {
68
+ resolve(ids);
69
+ });
70
+ resolve([]);
71
+ });
72
+ }
73
+ getFilters(registerKey) {
74
+ return [
75
+ {
76
+ name: 'AttachmentsByPK',
77
+ expression: 'this.PKREGISTRO = :PKREGISTRO',
78
+ params: [{
79
+ name: "PKREGISTRO",
80
+ dataType: DataType.TEXT,
81
+ value: `${registerKey}_${this.entityName}`
82
+ }]
83
+ }
84
+ ];
85
+ }
86
+ getInterceptions(dataUnit, action, crudRef) {
87
+ return new Promise((resolve) => {
88
+ if (action.type === Action.EDITION_CANCELED) {
89
+ if (!dataUnit.isDirty())
90
+ return resolve(action);
91
+ return this._application.confirm(this.getMessage('snkAttach.cancelConfirmation.title'), this.getMessage('snkAttach.cancelConfirmation.message')).then((cancellationConfirmed) => {
92
+ if (cancellationConfirmed) {
93
+ crudRef.goToView(VIEW_MODE.GRID);
94
+ return resolve(action);
95
+ }
96
+ return resolve(undefined);
97
+ });
98
+ }
99
+ if (action.type === Action.DATA_SAVED) {
100
+ dataUnit.loadData();
101
+ return resolve(action);
102
+ }
103
+ resolve(action);
104
+ });
105
+ }
106
+ }
@@ -0,0 +1,3 @@
1
+ export * from './data-unit-builder';
2
+ export * from './taskbar-builder';
3
+ export * from './crud-config-builder.ts';
@@ -0,0 +1,47 @@
1
+ import { TaskbarElement } from "../../snk-taskbar/elements/taskbar-elements";
2
+ import { ApplicationContext } from "@sankhyalabs/core";
3
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
4
+ const getMessage = (key) => {
5
+ var _a, _b;
6
+ return (_b = (_a = application === null || application === void 0 ? void 0 : application.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage) === null || _b === void 0 ? void 0 : _b.call(_a, key, null);
7
+ };
8
+ export const TaskbarAttachButtons = {
9
+ DOWNLOAD: {
10
+ hint: getMessage("snkAttach.taskbar.titleDownload"),
11
+ name: "DOWNLOAD",
12
+ iconName: 'file-download'
13
+ },
14
+ LINK: {
15
+ hint: getMessage("snkAttach.taskbar.titleLink"),
16
+ name: "LINK",
17
+ iconName: "launch"
18
+ }
19
+ };
20
+ export const buildTaskBarManager = () => {
21
+ const disabledButtonsWithoutSelection = [
22
+ TaskbarElement.REMOVE,
23
+ "DOWNLOAD",
24
+ "LINK"
25
+ ];
26
+ return {
27
+ getButtons: (_, dataState, currentButtons) => {
28
+ if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty))
29
+ return currentButtons.reverse();
30
+ else
31
+ currentButtons.splice(currentButtons.indexOf(TaskbarElement.REFRESH), 1);
32
+ const { selectedRecord } = dataState || {};
33
+ const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
34
+ currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
35
+ const updatedButtons = Array.from(new Set(currentButtons.filter(button => button !== TaskbarElement.CLONE)));
36
+ updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
37
+ return updatedButtons;
38
+ },
39
+ isEnabled: (_, dataState, currentButton) => {
40
+ const hasSelectedRecord = (dataState === null || dataState === void 0 ? void 0 : dataState.selectedRecord) !== undefined;
41
+ const disabledButton = disabledButtonsWithoutSelection.includes(currentButton);
42
+ if (disabledButton && !hasSelectedRecord)
43
+ return false;
44
+ return true;
45
+ }
46
+ };
47
+ };
@@ -117,7 +117,7 @@ export class SnkConfigurator {
117
117
  "mutable": false,
118
118
  "complexType": {
119
119
  "original": "VIEW_MODE",
120
- "resolved": "VIEW_MODE.FORM | VIEW_MODE.GRID",
120
+ "resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
121
121
  "references": {
122
122
  "VIEW_MODE": {
123
123
  "location": "import",
@@ -176,7 +176,7 @@ export class SnkConfigurator {
176
176
  },
177
177
  "complexType": {
178
178
  "original": "VIEW_MODE",
179
- "resolved": "VIEW_MODE.FORM | VIEW_MODE.GRID",
179
+ "resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
180
180
  "references": {
181
181
  "VIEW_MODE": {
182
182
  "location": "import",
@@ -196,7 +196,7 @@ export class SnkConfigurator {
196
196
  },
197
197
  "complexType": {
198
198
  "original": "VIEW_MODE",
199
- "resolved": "VIEW_MODE.FORM | VIEW_MODE.GRID",
199
+ "resolved": "VIEW_MODE.ATTACHMENT | VIEW_MODE.FORM | VIEW_MODE.GRID",
200
200
  "references": {
201
201
  "VIEW_MODE": {
202
202
  "location": "import",