@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
@@ -1,203 +1,4 @@
1
- import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
2
- import { UserInterface, JSUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
-
4
- var SelectedItemType;
5
- (function (SelectedItemType) {
6
- SelectedItemType["LINK"] = "LINK";
7
- SelectedItemType["FIELD"] = "FIELD";
8
- })(SelectedItemType || (SelectedItemType = {}));
9
-
10
- const ICON_MODES = {
11
- [UserInterface.SHORTTEXT]: 'text',
12
- [UserInterface.LONGTEXT]: 'text',
13
- [UserInterface.INTEGERNUMBER]: 'number',
14
- [UserInterface.DECIMALNUMBER]: 'number',
15
- [UserInterface.DATE]: 'calendar',
16
- [UserInterface.DATETIME]: 'calendar',
17
- [UserInterface.SWITCH]: 'boolean',
18
- [UserInterface.CHECKBOX]: 'check-circle-inverted',
19
- [UserInterface.OPTIONSELECTOR]: 'list',
20
- [UserInterface.SEARCH]: 'search',
21
- [UserInterface.HTML]: 'tag_code',
22
- [UserInterface.IMAGE]: 'png',
23
- [UserInterface.FILE]: 'edit-file',
24
- [UserInterface.TIME]: 'timer-outline',
25
- [UserInterface.ELAPSEDTIME]: 'timer',
26
- [UserInterface.MASKEDTEXT]: 'text',
27
- [UserInterface.PASSWORD]: 'email',
28
- };
29
- const ListItem = ({ userInterface, description }) => {
30
- return (h("ez-icon", { iconName: ICON_MODES[userInterface], className: "ez-padding-left--small", title: description }));
31
- };
32
-
33
- 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}";
34
-
35
- const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
36
- const SnkFilterFieldSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
37
- constructor() {
38
- super();
39
- this.__registerHost();
40
- this.ezSelectFilterItem = createEvent(this, "ezSelectFilterItem", 7);
41
- this._filterMetadataStorage = new Map();
42
- this._dataSource = null;
43
- this._filterText = "";
44
- this._isLoading = false;
45
- this.searchable = true;
46
- this.breadcrumbItems = [];
47
- this.linkItems = [];
48
- this.fieldItems = [];
49
- }
50
- /**
51
- * Define a fonte de dados do componente.
52
- * @param {IFilterLink} currentLink - Link atual da entidade.
53
- * @param {IFilterMetadata} fetchData - callback que executa a busca de dados.
54
- * @throws {Error} - Quando os metadados não forem válidos.
55
- * @throws {Error} - Quando o link atual não for do tipo link.
56
- */
57
- async setDataSource(currentLink, fetchData) {
58
- var _a;
59
- this._isLoading = true;
60
- let metadata = this._filterMetadataStorage.get(currentLink.uri);
61
- if (!metadata) {
62
- metadata = await fetchData(currentLink);
63
- this._filterMetadataStorage.set(currentLink.uri, metadata);
64
- }
65
- const { fields, links } = metadata || {};
66
- if (!Array.isArray(fields) || !Array.isArray(links))
67
- throw new Error('Invalid metadata');
68
- if (currentLink.type !== SelectedItemType.LINK)
69
- throw new Error('The current link must be a link type');
70
- this._dataSource = metadata;
71
- this._currentLink = currentLink;
72
- this.mapDataSourceToLinkItems();
73
- this.mapDataSourceToFieldItems();
74
- this._isLoading = false;
75
- (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
76
- this._ezFieldList.scrollToTop();
77
- this._ezLinkList.scrollToTop();
78
- }
79
- /**
80
- * Filtra a fonte de dados do componente.
81
- * @param {string} filterText - Texto para filtrar a fonte de dados.
82
- * @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
83
- */
84
- async filterDataSource(filterText) {
85
- if (this.searchable)
86
- throw new Error('This method is not available when searchable is true');
87
- this.handleFilterChange(filterText);
88
- }
89
- mapDataSourceToLinkItems() {
90
- var _a;
91
- const { links } = this._dataSource;
92
- const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
93
- const items = links.map(link => (Object.assign({ label: link.description }, link)));
94
- this.linkItems = [{
95
- group: filterLinkLabelMessage,
96
- items
97
- }];
98
- if (this.breadcrumbItems.length === 0) {
99
- this.breadcrumbItems = [Object.assign({ id: JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
100
- }
101
- }
102
- mapDataSourceToFieldItems() {
103
- var _a;
104
- const { fields } = this._dataSource;
105
- const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
106
- const filteredFields = fields.filter(field => {
107
- if (!this._currentLink)
108
- return true;
109
- const searchableByDescription = field.description.toLowerCase().includes(this._filterText.toLowerCase());
110
- const searchableByName = field.name.toLowerCase().includes(this._filterText.toLowerCase());
111
- return searchableByDescription || searchableByName;
112
- });
113
- const items = filteredFields.map(field => (Object.assign({ label: field.description }, field)));
114
- this.fieldItems = [{
115
- group: filterFieldLabelMessage,
116
- items
117
- }];
118
- }
119
- handleFilterChange(filterText) {
120
- if (this._isLoading)
121
- return;
122
- this._filterText = filterText;
123
- this.mapDataSourceToFieldItems();
124
- }
125
- handleSelectLink({ detail: item }) {
126
- if (this._isLoading)
127
- return;
128
- const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
129
- item.cache = this._filterMetadataStorage.has(item.uri);
130
- if (breadcrumbByIndex > -1) {
131
- this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
132
- }
133
- else {
134
- this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: JSUtils.generateUUID(), label: item.description }, item)];
135
- }
136
- this.ezSelectFilterItem.emit(Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK }));
137
- }
138
- handleSelectField({ detail: item }) {
139
- var _a;
140
- const breadcrumbPath = this.breadcrumbItems.map(breadcrumbItem => breadcrumbItem.label).join('>>');
141
- const selectedField = Object.assign(Object.assign({}, item), { type: SelectedItemType.FIELD, path: `${breadcrumbPath} >> ${item.description}` });
142
- this.ezSelectFilterItem.emit(selectedField);
143
- (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
144
- }
145
- getElementID(sufix) {
146
- return {
147
- [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
148
- };
149
- }
150
- /**
151
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
152
- * através de um pequeno modulo na estrutura da aplicação:
153
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
154
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-field-search.msg.ts"
155
- */
156
- getMessage(key, params) {
157
- var _a, _b, _c;
158
- if (!this._application)
159
- this._application = ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
160
- 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);
161
- }
162
- ;
163
- componentWillLoad() {
164
- this._application = ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
165
- }
166
- componentDidLoad() {
167
- ElementIDUtils.addIDInfoIfNotExists(this._ezPopover, 'popover');
168
- }
169
- disconnectedCallback() {
170
- var _a;
171
- this._filterMetadataStorage.clear();
172
- (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
173
- }
174
- render() {
175
- var _a;
176
- const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
177
- return (h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (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 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, 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 }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), 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')))))));
178
- }
179
- static get style() { return snkFilterFieldSearchCss; }
180
- }, [2, "snk-filter-field-search", {
181
- "searchable": [4],
182
- "breadcrumbItems": [32],
183
- "linkItems": [32],
184
- "fieldItems": [32],
185
- "setDataSource": [64],
186
- "filterDataSource": [64]
187
- }]);
188
- function defineCustomElement$1() {
189
- if (typeof customElements === "undefined") {
190
- return;
191
- }
192
- const components = ["snk-filter-field-search"];
193
- components.forEach(tagName => { switch (tagName) {
194
- case "snk-filter-field-search":
195
- if (!customElements.get(tagName)) {
196
- customElements.define(tagName, SnkFilterFieldSearch$1);
197
- }
198
- break;
199
- } });
200
- }
1
+ import { S as SnkFilterFieldSearch$1, d as defineCustomElement$1 } from './snk-filter-field-search2.js';
201
2
 
202
3
  const SnkFilterFieldSearch = SnkFilterFieldSearch$1;
203
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { h, r as registerInstance, c as createEvent } from './index-cfd4bb13.js';
1
+ import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
2
2
  import { UserInterface, JSUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
 
4
4
  var SelectedItemType;
@@ -33,66 +33,69 @@ const ListItem = ({ userInterface, description }) => {
33
33
  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}";
34
34
 
35
35
  const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
36
- const SnkFilterFieldSearch = class {
37
- constructor(hostRef) {
38
- registerInstance(this, hostRef);
36
+ const SnkFilterFieldSearch = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
37
+ constructor() {
38
+ super();
39
+ this.__registerHost();
39
40
  this.ezSelectFilterItem = createEvent(this, "ezSelectFilterItem", 7);
40
41
  this._filterMetadataStorage = new Map();
41
- this._dataSource = null;
42
+ this._currentMetadata = null;
42
43
  this._filterText = "";
43
44
  this._isLoading = false;
44
45
  this.searchable = true;
46
+ this.fieldsDataSource = undefined;
45
47
  this.breadcrumbItems = [];
46
48
  this.linkItems = [];
47
49
  this.fieldItems = [];
48
50
  }
49
51
  /**
50
- * Define a fonte de dados do componente.
51
- * @param {IFilterLink} currentLink - Link atual da entidade.
52
- * @param {IFilterMetadata} fetchData - callback que executa a busca de dados.
53
- * @throws {Error} - Quando os metadados não forem válidos.
54
- * @throws {Error} - Quando o link atual não for do tipo link.
55
- */
56
- async setDataSource(currentLink, fetchData) {
52
+ * Realiza a abertura do componente e faz a primeira carga
53
+ * de dados.
54
+ * */
55
+ async show() {
57
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() {
58
71
  this._isLoading = true;
59
- let metadata = this._filterMetadataStorage.get(currentLink.uri);
72
+ let metadata;
73
+ if (this._currentLink != undefined) {
74
+ metadata = this._filterMetadataStorage.get(this._currentLink.uri);
75
+ }
60
76
  if (!metadata) {
61
- metadata = await fetchData(currentLink);
62
- this._filterMetadataStorage.set(currentLink.uri, metadata);
77
+ metadata = await this.fieldsDataSource.fetchData(this._currentLink);
78
+ this._currentLink = metadata.currentLink;
79
+ this._filterMetadataStorage.set(this._currentLink.uri, metadata);
63
80
  }
64
81
  const { fields, links } = metadata || {};
65
82
  if (!Array.isArray(fields) || !Array.isArray(links))
66
83
  throw new Error('Invalid metadata');
67
- if (currentLink.type !== SelectedItemType.LINK)
68
- throw new Error('The current link must be a link type');
69
- this._dataSource = metadata;
70
- this._currentLink = currentLink;
84
+ this._currentMetadata = metadata;
71
85
  this.mapDataSourceToLinkItems();
72
86
  this.mapDataSourceToFieldItems();
73
87
  this._isLoading = false;
74
- (_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
75
88
  this._ezFieldList.scrollToTop();
76
89
  this._ezLinkList.scrollToTop();
77
90
  }
78
- /**
79
- * Filtra a fonte de dados do componente.
80
- * @param {string} filterText - Texto para filtrar a fonte de dados.
81
- * @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
82
- */
83
- async filterDataSource(filterText) {
84
- if (this.searchable)
85
- throw new Error('This method is not available when searchable is true');
86
- this.handleFilterChange(filterText);
87
- }
88
91
  mapDataSourceToLinkItems() {
89
92
  var _a;
90
- const { links } = this._dataSource;
93
+ const { links } = this._currentMetadata;
91
94
  const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
92
95
  const items = links.map(link => (Object.assign({ label: link.description }, link)));
93
96
  this.linkItems = [{
94
97
  group: filterLinkLabelMessage,
95
- items
98
+ items,
96
99
  }];
97
100
  if (this.breadcrumbItems.length === 0) {
98
101
  this.breadcrumbItems = [Object.assign({ id: JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
@@ -100,7 +103,7 @@ const SnkFilterFieldSearch = class {
100
103
  }
101
104
  mapDataSourceToFieldItems() {
102
105
  var _a;
103
- const { fields } = this._dataSource;
106
+ const { fields } = this._currentMetadata;
104
107
  const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
105
108
  const filteredFields = fields.filter(field => {
106
109
  if (!this._currentLink)
@@ -132,7 +135,10 @@ const SnkFilterFieldSearch = class {
132
135
  else {
133
136
  this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: JSUtils.generateUUID(), label: item.description }, item)];
134
137
  }
135
- this.ezSelectFilterItem.emit(Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK }));
138
+ const selectedItem = Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK });
139
+ this._currentLink = selectedItem;
140
+ this.ezSelectFilterItem.emit(selectedItem);
141
+ this.loadData();
136
142
  }
137
143
  handleSelectField({ detail: item }) {
138
144
  var _a;
@@ -173,9 +179,30 @@ const SnkFilterFieldSearch = class {
173
179
  render() {
174
180
  var _a;
175
181
  const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
176
- return (h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (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 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, 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 }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), 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')))))));
182
+ return (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')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (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 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, 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 }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), 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')))))));
177
183
  }
178
- };
179
- SnkFilterFieldSearch.style = snkFilterFieldSearchCss;
184
+ static get style() { return snkFilterFieldSearchCss; }
185
+ }, [2, "snk-filter-field-search", {
186
+ "searchable": [4],
187
+ "fieldsDataSource": [16],
188
+ "breadcrumbItems": [32],
189
+ "linkItems": [32],
190
+ "fieldItems": [32],
191
+ "show": [64],
192
+ "applyFilter": [64]
193
+ }]);
194
+ function defineCustomElement() {
195
+ if (typeof customElements === "undefined") {
196
+ return;
197
+ }
198
+ const components = ["snk-filter-field-search"];
199
+ components.forEach(tagName => { switch (tagName) {
200
+ case "snk-filter-field-search":
201
+ if (!customElements.get(tagName)) {
202
+ customElements.define(tagName, SnkFilterFieldSearch);
203
+ }
204
+ break;
205
+ } });
206
+ }
180
207
 
181
- export { SnkFilterFieldSearch as snk_filter_field_search };
208
+ export { SnkFilterFieldSearch as S, SelectedItemType as a, defineCustomElement as d };
@@ -1,276 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { StringUtils, DataType, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
- import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
4
- import { F as FilterOperand, a as FilterConfigType, b as FilterEntities, c as FilterUserConfigTypes } from './index2.js';
5
-
6
- class PersonalizedFilterUtils {
7
- /**
8
- * Cria uma expressão de filtro a partir de um IExpressionItem.
9
- * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
10
- * @returns Retorna a expressão de filtro.
11
- */
12
- static buildFilterExpression(expressionItem) {
13
- if (expressionItem == undefined) {
14
- return;
15
- }
16
- const value = this.buildVariableParameterValue(expressionItem);
17
- let expression = expressionItem.expression || "";
18
- switch (expressionItem.operand) {
19
- case FilterOperand.IN:
20
- expression += ` ${expressionItem.operand} (${value})`;
21
- break;
22
- case FilterOperand.NULL:
23
- case FilterOperand.NOT_NULL:
24
- expression += ` IS ${value}`;
25
- break;
26
- case FilterOperand.LIKE:
27
- expression += ` LIKE '%${value}%'`;
28
- break;
29
- case FilterOperand.START_WITH:
30
- expression += ` LIKE '${value}%'`;
31
- break;
32
- case FilterOperand.FINISHED_WITH:
33
- expression += ` LIKE '%${value}'`;
34
- break;
35
- default:
36
- expression += ` ${expressionItem.operand} ${value}`;
37
- }
38
- return expression;
39
- }
40
- /**
41
- * Obtém o valor do parâmetro a partir de um IExpressionItem.
42
- * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
43
- * @returns Retorna o valor do parâmetro.
44
- */
45
- static buildVariableParameterValue(expressionItem) {
46
- if (expressionItem == undefined) {
47
- return;
48
- }
49
- if (expressionItem.systemConfig != undefined) {
50
- const systemConfig = expressionItem.systemConfig;
51
- return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
52
- }
53
- if (expressionItem.userConfig != undefined) {
54
- const userConfig = expressionItem.userConfig;
55
- return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
56
- }
57
- return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
58
- }
59
- }
60
-
61
- const snkFilterParamConfigCss = ".sc-snk-filter-param-config-h{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression.sc-snk-filter-param-config{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
62
-
63
- const SnkFilterParamConfig$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
64
- constructor() {
65
- super();
66
- this.__registerHost();
67
- this._opened = false;
68
- this._configType = FilterConfigType.SYSTEM_CONFIG;
69
- this._expressionItem = undefined;
70
- this._informedInstance = false;
71
- this._canSave = false;
72
- this.messagesBuilder = undefined;
73
- }
74
- open(expressionItem) {
75
- this._opened = true;
76
- this._expressionItem = expressionItem;
77
- this.loadValues();
78
- return new Promise(accept => {
79
- this._promiseResolver = accept;
80
- });
81
- }
82
- close() {
83
- this._opened = false;
84
- return new Promise(accept => {
85
- this._promiseResolver = accept;
86
- });
87
- }
88
- /**
89
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
90
- * através de um pequeno modulo na estrutura da aplicação:
91
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
92
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
93
- */
94
- getMessage(key, params) {
95
- return this.messagesBuilder.getMessage(key, params);
96
- }
97
- getConfigValue(configName, inputName, inputAlias = "") {
98
- var _a, _b, _c;
99
- return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
100
- || ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
101
- }
102
- loadValues() {
103
- var _a;
104
- const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
105
- const fieldName = this.getConfigValue("systemConfig", "fieldName");
106
- const description = this.getConfigValue("userConfig", "description");
107
- const type = this.getConfigValue("userConfig", "type");
108
- if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
109
- this._configType = FilterConfigType.USER_CONFIG;
110
- }
111
- else {
112
- this._configType = FilterConfigType.SYSTEM_CONFIG;
113
- }
114
- if (!StringUtils.isEmpty(entityName) && !StringUtils.isEmpty(fieldName)) {
115
- this._instanceElement.value = { value: entityName, label: "" };
116
- this._fieldElement.value = { value: fieldName, label: "" };
117
- }
118
- if (!StringUtils.isEmpty(description) && !StringUtils.isEmpty(type)) {
119
- this._descriptionElement.value = description;
120
- this._typeElement.value = type;
121
- }
122
- this.buildFilterExpression();
123
- }
124
- changeDefinitionUsed(option) {
125
- this._configType = option !== null && option !== void 0 ? option : FilterConfigType.SYSTEM_CONFIG;
126
- if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
127
- const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
128
- const fieldName = this.getConfigValue("systemConfig", "fieldName");
129
- this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
130
- this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
131
- }
132
- else if (this._configType === FilterConfigType.USER_CONFIG) {
133
- const description = this.getConfigValue("userConfig", "description");
134
- const type = this.getConfigValue("userConfig", "type");
135
- this._descriptionElement.value = this._descriptionElement.value || description;
136
- this._typeElement.value = this._typeElement.value || type;
137
- }
138
- this.buildFilterExpression();
139
- }
140
- getTypeValue() {
141
- var _a;
142
- const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
143
- return ((value === null || value === void 0 ? void 0 : value.value) || value);
144
- }
145
- getExpressionValues() {
146
- var _a, _b, _c, _d, _e;
147
- let systemConfig;
148
- let userConfig;
149
- if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
150
- const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
151
- const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
152
- systemConfig = { entity, fieldName };
153
- }
154
- else if (this._configType === FilterConfigType.USER_CONFIG) {
155
- const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
156
- const type = this.getTypeValue();
157
- userConfig = { description, type };
158
- }
159
- return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
160
- }
161
- isEnabled(value) {
162
- return this._configType === value;
163
- }
164
- isInformedInstance() {
165
- var _a, _b;
166
- return !StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
167
- }
168
- save() {
169
- var _a;
170
- this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
171
- this._promiseResolver(this._expressionItem);
172
- this._opened = false;
173
- }
174
- buildFilterExpression() {
175
- var _a;
176
- this._informedInstance = this.isInformedInstance();
177
- const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
178
- this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
179
- this._canSave = this.getCanSave();
180
- }
181
- handleChangeInstance() {
182
- this._informedInstance = this.isInformedInstance();
183
- if (this._fieldElement != undefined && !StringUtils.isEmpty(this._fieldElement.value)) {
184
- this._fieldElement.value = null;
185
- }
186
- this.buildFilterExpression();
187
- }
188
- getInstanceCriteria() {
189
- var _a, _b;
190
- const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
191
- return {
192
- expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
193
- params: [
194
- {
195
- name: "NOMEINSTANCIA",
196
- dataType: DataType.TEXT,
197
- value
198
- }
199
- ]
200
- };
201
- }
202
- onSearch({ mode, argument }, entity) {
203
- if (this._application == undefined) {
204
- return;
205
- }
206
- const isField = entity === FilterEntities.FIELD;
207
- const criteria = isField ? this.getInstanceCriteria() : undefined;
208
- const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
209
- const entityDescription = this.getMessage(messageKey);
210
- const searchOptions = {
211
- descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
212
- codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
213
- showInactives: false
214
- };
215
- const options = {
216
- entity,
217
- entityDescription,
218
- criteria,
219
- searchOptions
220
- };
221
- return this._application.executePreparedSearch(mode, argument, options);
222
- }
223
- getElementID(sufix) {
224
- return {
225
- [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
226
- };
227
- }
228
- getCanSave() {
229
- var _a;
230
- if (this._configType === FilterConfigType.USER_CONFIG) {
231
- const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
232
- const type = this.getTypeValue();
233
- return !StringUtils.isEmpty(description) && !StringUtils.isEmpty(type);
234
- }
235
- return true;
236
- }
237
- componentWillLoad() {
238
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
239
- }
240
- render() {
241
- ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
242
- return (h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
243
- if (evt.detail === ModalAction.CLOSE)
244
- this.close();
245
- }, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), h("div", { class: "ez-flex" }, h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: FilterConfigType.SYSTEM_CONFIG })), h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.FIELD) }, this.getElementID("configFindField")))), h("div", { class: "ez-flex ez-padding--medium" }, h("hr", { class: "ez-divider-vertical" })), h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: FilterConfigType.USER_CONFIG })), h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(FilterUserConfigTypes).map((configType) => {
246
- return (h("option", { value: FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
247
- })))), 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"))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
248
- }
249
- get _element() { return this; }
250
- static get style() { return snkFilterParamConfigCss; }
251
- }, [2, "snk-filter-param-config", {
252
- "messagesBuilder": [1040],
253
- "_opened": [32],
254
- "_configType": [32],
255
- "_expressionItem": [32],
256
- "_informedInstance": [32],
257
- "_canSave": [32],
258
- "open": [64],
259
- "close": [64]
260
- }]);
261
- function defineCustomElement$1() {
262
- if (typeof customElements === "undefined") {
263
- return;
264
- }
265
- const components = ["snk-filter-param-config"];
266
- components.forEach(tagName => { switch (tagName) {
267
- case "snk-filter-param-config":
268
- if (!customElements.get(tagName)) {
269
- customElements.define(tagName, SnkFilterParamConfig$1);
270
- }
271
- break;
272
- } });
273
- }
1
+ import { S as SnkFilterParamConfig$1, d as defineCustomElement$1 } from './snk-filter-param-config2.js';
274
2
 
275
3
  const SnkFilterParamConfig = SnkFilterParamConfig$1;
276
4
  const defineCustomElement = defineCustomElement$1;