@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
@@ -0,0 +1,435 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-21bd01e1.js');
6
+ const index$1 = require('./index-8d94b7e0.js');
7
+ const core = require('@sankhyalabs/core');
8
+ const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
9
+ const index$2 = require('./index-f400b1d6.js');
10
+
11
+ const ICON_MODES = {
12
+ [core.UserInterface.SHORTTEXT]: 'text',
13
+ [core.UserInterface.LONGTEXT]: 'text',
14
+ [core.UserInterface.INTEGERNUMBER]: 'number',
15
+ [core.UserInterface.DECIMALNUMBER]: 'number',
16
+ [core.UserInterface.DATE]: 'calendar',
17
+ [core.UserInterface.DATETIME]: 'calendar',
18
+ [core.UserInterface.SWITCH]: 'boolean',
19
+ [core.UserInterface.CHECKBOX]: 'check-circle-inverted',
20
+ [core.UserInterface.OPTIONSELECTOR]: 'list',
21
+ [core.UserInterface.SEARCH]: 'search',
22
+ [core.UserInterface.HTML]: 'tag_code',
23
+ [core.UserInterface.IMAGE]: 'png',
24
+ [core.UserInterface.FILE]: 'edit-file',
25
+ [core.UserInterface.TIME]: 'timer-outline',
26
+ [core.UserInterface.ELAPSEDTIME]: 'timer',
27
+ [core.UserInterface.MASKEDTEXT]: 'text',
28
+ [core.UserInterface.PASSWORD]: 'email',
29
+ };
30
+ const ListItem = ({ userInterface, description }) => {
31
+ return (index.h("ez-icon", { iconName: ICON_MODES[userInterface], className: "ez-padding-left--small", title: description }));
32
+ };
33
+
34
+ const snkFilterFieldSearchCss = ".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";
35
+
36
+ const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
37
+ const SnkFilterFieldSearch = class {
38
+ constructor(hostRef) {
39
+ index.registerInstance(this, hostRef);
40
+ this.ezSelectFilterItem = index.createEvent(this, "ezSelectFilterItem", 7);
41
+ this._filterMetadataStorage = new Map();
42
+ this._currentMetadata = null;
43
+ this._filterText = "";
44
+ this._isLoading = false;
45
+ this.searchable = true;
46
+ this.fieldsDataSource = undefined;
47
+ this.breadcrumbItems = [];
48
+ this.linkItems = [];
49
+ this.fieldItems = [];
50
+ }
51
+ /**
52
+ * Realiza a abertura do componente e faz a primeira carga
53
+ * de dados.
54
+ * */
55
+ async show() {
56
+ var _a;
57
+ (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
58
+ return this.loadData();
59
+ }
60
+ /**
61
+ * Filtra a fonte de dados do componente.
62
+ * @param {string} filterText - Texto para filtrar a fonte de dados.
63
+ * @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
64
+ */
65
+ async applyFilter(filterText) {
66
+ if (this.searchable)
67
+ throw new Error('This method is not available when searchable is true');
68
+ this.handleFilterChange(filterText);
69
+ }
70
+ async loadData() {
71
+ this._isLoading = true;
72
+ let metadata;
73
+ if (this._currentLink != undefined) {
74
+ metadata = this._filterMetadataStorage.get(this._currentLink.uri);
75
+ }
76
+ if (!metadata) {
77
+ metadata = await this.fieldsDataSource.fetchData(this._currentLink);
78
+ this._currentLink = metadata.currentLink;
79
+ this._filterMetadataStorage.set(this._currentLink.uri, metadata);
80
+ }
81
+ const { fields, links } = metadata || {};
82
+ if (!Array.isArray(fields) || !Array.isArray(links))
83
+ throw new Error('Invalid metadata');
84
+ this._currentMetadata = metadata;
85
+ this.mapDataSourceToLinkItems();
86
+ this.mapDataSourceToFieldItems();
87
+ this._isLoading = false;
88
+ this._ezFieldList.scrollToTop();
89
+ this._ezLinkList.scrollToTop();
90
+ }
91
+ mapDataSourceToLinkItems() {
92
+ var _a;
93
+ const { links } = this._currentMetadata;
94
+ const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
95
+ const items = links.map(link => (Object.assign({ label: link.description }, link)));
96
+ this.linkItems = [{
97
+ group: filterLinkLabelMessage,
98
+ items,
99
+ }];
100
+ if (this.breadcrumbItems.length === 0) {
101
+ this.breadcrumbItems = [Object.assign({ id: core.JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
102
+ }
103
+ }
104
+ mapDataSourceToFieldItems() {
105
+ var _a;
106
+ const { fields } = this._currentMetadata;
107
+ const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
108
+ const filteredFields = fields.filter(field => {
109
+ if (!this._currentLink)
110
+ return true;
111
+ const searchableByDescription = field.description.toLowerCase().includes(this._filterText.toLowerCase());
112
+ const searchableByName = field.name.toLowerCase().includes(this._filterText.toLowerCase());
113
+ return searchableByDescription || searchableByName;
114
+ });
115
+ const items = filteredFields.map(field => (Object.assign({ label: field.description }, field)));
116
+ this.fieldItems = [{
117
+ group: filterFieldLabelMessage,
118
+ items
119
+ }];
120
+ }
121
+ handleFilterChange(filterText) {
122
+ if (this._isLoading)
123
+ return;
124
+ this._filterText = filterText;
125
+ this.mapDataSourceToFieldItems();
126
+ }
127
+ handleSelectLink({ detail: item }) {
128
+ if (this._isLoading)
129
+ return;
130
+ const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
131
+ item.cache = this._filterMetadataStorage.has(item.uri);
132
+ if (breadcrumbByIndex > -1) {
133
+ this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
134
+ }
135
+ else {
136
+ this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: core.JSUtils.generateUUID(), label: item.description }, item)];
137
+ }
138
+ const selectedItem = Object.assign(Object.assign({}, item), { type: index$1.SelectedItemType.LINK });
139
+ this._currentLink = selectedItem;
140
+ this.ezSelectFilterItem.emit(selectedItem);
141
+ this.loadData();
142
+ }
143
+ handleSelectField({ detail: item }) {
144
+ var _a;
145
+ const breadcrumbPath = this.breadcrumbItems.map(breadcrumbItem => breadcrumbItem.label).join('>>');
146
+ const selectedField = Object.assign(Object.assign({}, item), { type: index$1.SelectedItemType.FIELD, path: `${breadcrumbPath} >> ${item.description}` });
147
+ this.ezSelectFilterItem.emit(selectedField);
148
+ (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
149
+ }
150
+ getElementID(sufix) {
151
+ return {
152
+ [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(sufix)
153
+ };
154
+ }
155
+ /**
156
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
157
+ * através de um pequeno modulo na estrutura da aplicação:
158
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
159
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-field-search.msg.ts"
160
+ */
161
+ getMessage(key, params) {
162
+ var _a, _b, _c;
163
+ if (!this._application)
164
+ this._application = core.ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
165
+ return (_c = (_b = (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage) === null || _c === void 0 ? void 0 : _c.call(_b, key, params);
166
+ }
167
+ ;
168
+ componentWillLoad() {
169
+ this._application = core.ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
170
+ }
171
+ componentDidLoad() {
172
+ core.ElementIDUtils.addIDInfoIfNotExists(this._ezPopover, 'popover');
173
+ }
174
+ disconnectedCallback() {
175
+ var _a;
176
+ this._filterMetadataStorage.clear();
177
+ (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
178
+ }
179
+ render() {
180
+ var _a;
181
+ const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
182
+ return (index.h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", overlayType: "none", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), index.h("div", { class: "snk-filter-field-search__container" }, index.h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (index.h("ez-filter-input", Object.assign({ class: "snk-filter-field-search__input", label: searchLabelMessage, asyncSearch: true, canShowError: false, onEzSearching: (event) => this.handleFilterChange.bind(this)(event.detail), "aria-label": searchLabelMessage, "aria-required": "false", "aria-invalid": "false" }, this.getElementID('EzFilterInput')))), this.breadcrumbItems.length > 0 && (index.h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), index.h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), index.h("section", { class: "snk-filter-field-search__section" }, index.h("ez-list", Object.assign({ ref: (el) => this._ezLinkList = el, class: "snk-filter-field-search__list", id: "filterLinkList", useGroups: true, dataSource: this.linkItems, onEzSelectItem: this.handleSelectLink.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ({ fieldCount }) => index.h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), index.h("ez-list", Object.assign({ ref: (el) => this._ezFieldList = el, class: "snk-filter-field-search__list", id: "filterFieldList", useGroups: true, dataSource: this.fieldItems, onEzSelectItem: this.handleSelectField.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ListItem, "aria-describedby": "filterFieldLabel" }, this.getElementID('EzListFields')))))));
183
+ }
184
+ };
185
+ SnkFilterFieldSearch.style = snkFilterFieldSearchCss;
186
+
187
+ class PersonalizedFilterUtils {
188
+ /**
189
+ * Cria uma expressão de filtro a partir de um IExpressionItem.
190
+ * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
191
+ * @returns Retorna a expressão de filtro.
192
+ */
193
+ static buildFilterExpression(expressionItem) {
194
+ if (expressionItem == undefined) {
195
+ return;
196
+ }
197
+ const value = this.buildVariableParameterValue(expressionItem);
198
+ let expression = expressionItem.expression || "";
199
+ switch (expressionItem.operand) {
200
+ case index$2.FilterOperand.IN:
201
+ expression += ` ${expressionItem.operand} (${value})`;
202
+ break;
203
+ case index$2.FilterOperand.NULL:
204
+ case index$2.FilterOperand.NOT_NULL:
205
+ expression += ` IS ${value}`;
206
+ break;
207
+ case index$2.FilterOperand.LIKE:
208
+ expression += ` LIKE '%${value}%'`;
209
+ break;
210
+ case index$2.FilterOperand.START_WITH:
211
+ expression += ` LIKE '${value}%'`;
212
+ break;
213
+ case index$2.FilterOperand.FINISHED_WITH:
214
+ expression += ` LIKE '%${value}'`;
215
+ break;
216
+ default:
217
+ expression += ` ${expressionItem.operand} ${value}`;
218
+ }
219
+ return expression;
220
+ }
221
+ /**
222
+ * Obtém o valor do parâmetro a partir de um IExpressionItem.
223
+ * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
224
+ * @returns Retorna o valor do parâmetro.
225
+ */
226
+ static buildVariableParameterValue(expressionItem) {
227
+ if (expressionItem == undefined) {
228
+ return;
229
+ }
230
+ if (expressionItem.systemConfig != undefined) {
231
+ const systemConfig = expressionItem.systemConfig;
232
+ return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
233
+ }
234
+ if (expressionItem.userConfig != undefined) {
235
+ const userConfig = expressionItem.userConfig;
236
+ return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
237
+ }
238
+ return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
239
+ }
240
+ }
241
+
242
+ const snkFilterParamConfigCss = ":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
243
+
244
+ const SnkFilterParamConfig = class {
245
+ constructor(hostRef) {
246
+ index.registerInstance(this, hostRef);
247
+ this._opened = false;
248
+ this._configType = index$2.FilterConfigType.SYSTEM_CONFIG;
249
+ this._expressionItem = undefined;
250
+ this._informedInstance = false;
251
+ this._canSave = false;
252
+ this.messagesBuilder = undefined;
253
+ }
254
+ open(expressionItem) {
255
+ this._opened = true;
256
+ this._expressionItem = expressionItem;
257
+ this.loadValues();
258
+ return new Promise(accept => {
259
+ this._promiseResolver = accept;
260
+ });
261
+ }
262
+ close() {
263
+ this._opened = false;
264
+ return new Promise(accept => {
265
+ this._promiseResolver = accept;
266
+ });
267
+ }
268
+ /**
269
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
270
+ * através de um pequeno modulo na estrutura da aplicação:
271
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
272
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
273
+ */
274
+ getMessage(key, params) {
275
+ var _a;
276
+ return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
277
+ }
278
+ getConfigValue(configName, inputName, inputAlias = "") {
279
+ var _a, _b, _c;
280
+ return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
281
+ || ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
282
+ }
283
+ loadValues() {
284
+ var _a;
285
+ const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
286
+ const fieldName = this.getConfigValue("systemConfig", "fieldName");
287
+ const description = this.getConfigValue("userConfig", "description");
288
+ const type = this.getConfigValue("userConfig", "type");
289
+ if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
290
+ this._configType = index$2.FilterConfigType.USER_CONFIG;
291
+ }
292
+ else {
293
+ this._configType = index$2.FilterConfigType.SYSTEM_CONFIG;
294
+ }
295
+ if (!core.StringUtils.isEmpty(entityName) && !core.StringUtils.isEmpty(fieldName)) {
296
+ this._instanceElement.value = { value: entityName, label: "" };
297
+ this._fieldElement.value = { value: fieldName, label: "" };
298
+ }
299
+ if (!core.StringUtils.isEmpty(description) && !core.StringUtils.isEmpty(type)) {
300
+ this._descriptionElement.value = description;
301
+ this._typeElement.value = type;
302
+ }
303
+ this.buildFilterExpression();
304
+ }
305
+ changeDefinitionUsed(option) {
306
+ this._configType = option !== null && option !== void 0 ? option : index$2.FilterConfigType.SYSTEM_CONFIG;
307
+ if (this._configType === index$2.FilterConfigType.SYSTEM_CONFIG) {
308
+ const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
309
+ const fieldName = this.getConfigValue("systemConfig", "fieldName");
310
+ this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
311
+ this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
312
+ }
313
+ else if (this._configType === index$2.FilterConfigType.USER_CONFIG) {
314
+ const description = this.getConfigValue("userConfig", "description");
315
+ const type = this.getConfigValue("userConfig", "type");
316
+ this._descriptionElement.value = this._descriptionElement.value || description;
317
+ this._typeElement.value = this._typeElement.value || type;
318
+ }
319
+ this.buildFilterExpression();
320
+ }
321
+ getTypeValue() {
322
+ var _a;
323
+ const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
324
+ return ((value === null || value === void 0 ? void 0 : value.value) || value);
325
+ }
326
+ getExpressionValues() {
327
+ var _a, _b, _c, _d, _e;
328
+ let systemConfig;
329
+ let userConfig;
330
+ if (this._configType === index$2.FilterConfigType.SYSTEM_CONFIG) {
331
+ const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
332
+ const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
333
+ systemConfig = { entity, fieldName };
334
+ }
335
+ else if (this._configType === index$2.FilterConfigType.USER_CONFIG) {
336
+ const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
337
+ const type = this.getTypeValue();
338
+ userConfig = { description, type };
339
+ }
340
+ return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
341
+ }
342
+ isEnabled(value) {
343
+ return this._configType === value;
344
+ }
345
+ isInformedInstance() {
346
+ var _a, _b;
347
+ return !core.StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
348
+ }
349
+ save() {
350
+ var _a;
351
+ this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
352
+ this._promiseResolver(this._expressionItem);
353
+ this._opened = false;
354
+ }
355
+ buildFilterExpression() {
356
+ var _a;
357
+ this._informedInstance = this.isInformedInstance();
358
+ const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
359
+ this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
360
+ this._canSave = this.getCanSave();
361
+ }
362
+ handleChangeInstance() {
363
+ this._informedInstance = this.isInformedInstance();
364
+ if (this._fieldElement != undefined && !core.StringUtils.isEmpty(this._fieldElement.value)) {
365
+ this._fieldElement.value = null;
366
+ }
367
+ this.buildFilterExpression();
368
+ }
369
+ getInstanceCriteria() {
370
+ var _a, _b;
371
+ const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
372
+ return {
373
+ expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
374
+ params: [
375
+ {
376
+ name: "NOMEINSTANCIA",
377
+ dataType: core.DataType.TEXT,
378
+ value
379
+ }
380
+ ]
381
+ };
382
+ }
383
+ onSearch({ mode, argument }, entity) {
384
+ if (this._application == undefined) {
385
+ return;
386
+ }
387
+ const isField = entity === index$2.FilterEntities.FIELD;
388
+ const criteria = isField ? this.getInstanceCriteria() : undefined;
389
+ const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
390
+ const entityDescription = this.getMessage(messageKey);
391
+ const searchOptions = {
392
+ descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
393
+ codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
394
+ showInactives: false
395
+ };
396
+ const options = {
397
+ entity,
398
+ entityDescription,
399
+ criteria,
400
+ searchOptions
401
+ };
402
+ return this._application.executePreparedSearch(mode, argument, options);
403
+ }
404
+ getElementID(sufix) {
405
+ return {
406
+ [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(sufix)
407
+ };
408
+ }
409
+ getCanSave() {
410
+ var _a;
411
+ if (this._configType === index$2.FilterConfigType.USER_CONFIG) {
412
+ const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
413
+ const type = this.getTypeValue();
414
+ return !core.StringUtils.isEmpty(description) && !core.StringUtils.isEmpty(type);
415
+ }
416
+ return true;
417
+ }
418
+ componentWillLoad() {
419
+ this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
420
+ }
421
+ render() {
422
+ core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
423
+ return (index.h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), index.h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
424
+ if (evt.detail === ezModalContainer.ModalAction.CLOSE)
425
+ this.close();
426
+ }, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), index.h("div", { class: "ez-flex" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, index.h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), index.h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: index$2.FilterConfigType.SYSTEM_CONFIG })), index.h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(index$2.FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, index$2.FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), index.h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(index$2.FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, index$2.FilterEntities.FIELD) }, this.getElementID("configFindField")))), index.h("div", { class: "ez-flex ez-padding--medium" }, index.h("hr", { class: "ez-divider-vertical" })), index.h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, index.h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), index.h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: index$2.FilterConfigType.USER_CONFIG })), index.h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(index$2.FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), index.h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(index$2.FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(index$2.FilterUserConfigTypes).map((configType) => {
427
+ return (index.h("option", { value: index$2.FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
428
+ })))), index.h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), index.h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, index.h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), index.h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
429
+ }
430
+ get _element() { return index.getElement(this); }
431
+ };
432
+ SnkFilterParamConfig.style = snkFilterParamConfigCss;
433
+
434
+ exports.snk_filter_field_search = SnkFilterFieldSearch;
435
+ exports.snk_filter_param_config = SnkFilterParamConfig;
@@ -6,7 +6,7 @@ const index = require('./index-21bd01e1.js');
6
6
  const draggable_bundle = require('./draggable.bundle-82a25c06.js');
7
7
  const core = require('@sankhyalabs/core');
8
8
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
9
- const constants = require('./constants-ae0ed870.js');
9
+ const constants = require('./constants-3787fa32.js');
10
10
  const formConfigFetcher = require('./form-config-fetcher-fa19680a.js');
11
11
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
12
12
  require('./_commonjsHelpers-537d719a.js');
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
8
  const CheckMode = require('@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode');
9
9
  const ConfigStorage = require('./ConfigStorage-91adf3fe.js');
10
- const constants = require('./constants-ae0ed870.js');
10
+ const constants = require('./constants-3787fa32.js');
11
11
  require('./form-config-fetcher-fa19680a.js');
12
12
  require('./DataFetcher-a9d0228f.js');
13
13
  require('./_commonjsHelpers-537d719a.js');
@@ -5,10 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
8
+ const taskbarElements = require('./taskbar-elements-bc2598f9.js');
8
9
  const ConfigStorage = require('./ConfigStorage-91adf3fe.js');
9
10
  const index$1 = require('./index-f400b1d6.js');
10
11
  const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
11
- const index$2 = require('./index-fc7ca86c.js');
12
+ const index$2 = require('./index-de79181a.js');
12
13
  require('./form-config-fetcher-fa19680a.js');
13
14
  require('./DataFetcher-a9d0228f.js');
14
15
  require('./_commonjsHelpers-537d719a.js');
@@ -28,7 +29,7 @@ const SnkGrid = class {
28
29
  });
29
30
  this._headerTaskbarProcessor = new taskbarProcessor.TaskbarProcessor({
30
31
  "snkGridHeaderTaskbar.unselected": ["REFRESH", "DATA_EXPORTER"],
31
- "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH", "DATA_EXPORTER"],
32
+ "snkGridHeaderTaskbar.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", this.getAttachAvailable(), "REFRESH", "DATA_EXPORTER"],
32
33
  "snkGridHeaderTaskbar.detail.unselected": ["REFRESH"],
33
34
  "snkGridHeaderTaskbar.detail.selected": ["UPDATE", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "REFRESH"]
34
35
  });
@@ -69,6 +70,13 @@ const SnkGrid = class {
69
70
  async setConfig(config) {
70
71
  this.setGridConfig(config);
71
72
  }
73
+ getAttachAvailable() {
74
+ var _a;
75
+ const isValidVersion = core.VersionUtils.isRequiredVersion((_a = window.envContext) === null || _a === void 0 ? void 0 : _a.sysVersion, '4.22');
76
+ if (isValidVersion)
77
+ return taskbarElements.TaskbarElement.ATTACH;
78
+ return "";
79
+ }
72
80
  openGridConfig() {
73
81
  this._grid.getColumnsState()
74
82
  .then((gridColumns) => {
@@ -238,7 +246,7 @@ const SnkGrid = class {
238
246
  const disabledButtons = [];
239
247
  if ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectionInfo) {
240
248
  if (this._dataState.selectionInfo.length > 1) {
241
- disabledButtons.push("CLONE");
249
+ disabledButtons.push(taskbarElements.TaskbarElement.CLONE, "ATTACH");
242
250
  }
243
251
  if (this._dataState.selectionInfo.isAllRecords()) {
244
252
  disabledButtons.push("REMOVE");
@@ -5,8 +5,8 @@ const core = require('@sankhyalabs/core');
5
5
  const SnkFormConfigManager = require('./SnkFormConfigManager-e1a10283.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const taskbarProcessor = require('./taskbar-processor-bce3f499.js');
8
- const taskbarElements = require('./taskbar-elements-5e87cf44.js');
9
- const constants = require('./constants-ae0ed870.js');
8
+ const taskbarElements = require('./taskbar-elements-bc2598f9.js');
9
+ const constants = require('./constants-3787fa32.js');
10
10
  require('./DataFetcher-a9d0228f.js');
11
11
  require('./pesquisa-fetcher-954b74c3.js');
12
12
  const index$1 = require('./index-f400b1d6.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-7db960c2.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-9784c527.js');
6
6
  require('./index-21bd01e1.js');
7
7
  require('@sankhyalabs/core');
8
8
  require('./SnkFormConfigManager-e1a10283.js');
@@ -12,10 +12,10 @@ require('./DataFetcher-a9d0228f.js');
12
12
  require('./_commonjsHelpers-537d719a.js');
13
13
  require('@sankhyalabs/ezui/dist/collection/utils/form');
14
14
  require('./taskbar-processor-bce3f499.js');
15
- require('./taskbar-elements-5e87cf44.js');
15
+ require('./taskbar-elements-bc2598f9.js');
16
16
  require('./index-f400b1d6.js');
17
- require('./index-fc7ca86c.js');
18
- require('./constants-ae0ed870.js');
17
+ require('./index-de79181a.js');
18
+ require('./constants-3787fa32.js');
19
19
  require('./pesquisa-fetcher-954b74c3.js');
20
20
 
21
21
 
@@ -0,0 +1,126 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-21bd01e1.js');
6
+ const DataFetcher = require('./DataFetcher-a9d0228f.js');
7
+ const index$1 = require('./index-f400b1d6.js');
8
+ const index$2 = require('./index-de79181a.js');
9
+ const core = require('@sankhyalabs/core');
10
+ require('./_commonjsHelpers-537d719a.js');
11
+
12
+ class PersonalizedFilterFetcher {
13
+ constructor() {
14
+ this.templateByQuery = new Map();
15
+ this.buildTemplates();
16
+ }
17
+ buildTemplates() {
18
+ const query = DataFetcher.dist.gql `
19
+ query($name: String!) {
20
+ $queryAlias$: fetchFilterFields(name: $name){
21
+ currentLink {
22
+ description
23
+ uri
24
+ }
25
+ links {
26
+ description
27
+ uri
28
+ fieldCount
29
+ }
30
+ fields {
31
+ name
32
+ description
33
+ uri
34
+ onlyDate
35
+ dataType
36
+ userInterface
37
+ properties {
38
+ name
39
+ value
40
+ }
41
+ }
42
+ }
43
+ }
44
+ `;
45
+ this.templateByQuery.set("fetchFilterFields", query);
46
+ }
47
+ loadFields(uri) {
48
+ return new Promise((resolve, reject) => {
49
+ DataFetcher.DataFetcher.get()
50
+ .callGraphQL({
51
+ values: { name: uri },
52
+ query: this.templateByQuery.get("fetchFilterFields"),
53
+ })
54
+ .then((resp) => {
55
+ let fields = resp.fields;
56
+ for (const field of fields) {
57
+ if (Array.isArray(field.properties) && field.properties.length > 0 && field.userInterface === "SEARCH") {
58
+ const propertiesConvertedObject = field.properties.reduce((accumulator, prop) => {
59
+ accumulator[prop.name] = prop.value;
60
+ return accumulator;
61
+ }, {});
62
+ field.properties = propertiesConvertedObject;
63
+ }
64
+ }
65
+ resolve(Object.assign(Object.assign({}, resp), { fields: fields }));
66
+ })
67
+ .catch((error) => {
68
+ reject(error);
69
+ });
70
+ });
71
+ }
72
+ }
73
+
74
+ const snkPersonalizedFilterCss = ":host{display:flex}";
75
+
76
+ const SnkPersonalizedFilter = class {
77
+ constructor(hostRef) {
78
+ index.registerInstance(this, hostRef);
79
+ this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
80
+ this._dataSourceFetcher = {
81
+ fetchData: async (entity) => {
82
+ let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
83
+ if (core.StringUtils.isEmpty(entityURI)) {
84
+ entityURI = "dd://Financeiro/br.com.sankhya.fin.cad.receber"; //TODO: Receber como prop
85
+ }
86
+ return await this._personalizedFilterFetcher.loadFields(entityURI);
87
+ }
88
+ };
89
+ this.items = {
90
+ entityName: "Financeiro",
91
+ fieldName: "CODBCO",
92
+ description: "Financeiro >> Banco",
93
+ type: index$1.FilterUserConfigTypes.DECIMAL,
94
+ expression: "Financeiro.CODBCO",
95
+ operand: index$1.FilterOperand.EQUAL,
96
+ paramVariable: false,
97
+ value: "61",
98
+ systemConfig: null,
99
+ userConfig: null
100
+ };
101
+ this.handleFilterItemChange = (changes) => {
102
+ console.log("Campo do ExpressionItem alterado");
103
+ console.log(changes);
104
+ };
105
+ this.handleFilterItemRemove = (expression) => {
106
+ console.log("Event de deleção disparado");
107
+ console.log(expression);
108
+ };
109
+ this.messagesBuilder = undefined;
110
+ }
111
+ componentWillLoad() {
112
+ if (index$2.store.get("filterFieldsDataSource") == undefined) {
113
+ index$2.store.set("filterFieldsDataSource", this._dataSourceFetcher);
114
+ }
115
+ if (!this.messagesBuilder) {
116
+ const snkApp = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
117
+ this.messagesBuilder = snkApp === null || snkApp === void 0 ? void 0 : snkApp.messagesBuilder;
118
+ }
119
+ }
120
+ render() {
121
+ return (index.h(index.Host, null, index.h("div", null, index.h("snk-expression-item", { expression: this.items, canRemove: true, onEzFilterItemChange: (evt) => this.handleFilterItemChange(evt.detail), onEzFilterItemRemove: (evt) => this.handleFilterItemRemove(evt.detail), messagesBuilder: this.messagesBuilder }))));
122
+ }
123
+ };
124
+ SnkPersonalizedFilter.style = snkPersonalizedFilterCss;
125
+
126
+ exports.snk_personalized_filter = SnkPersonalizedFilter;