@sankhyalabs/sankhyablocks 6.9.2 → 7.0.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 (188) hide show
  1. package/dist/cjs/{ConfigStorage-3aaa8a9f.js → ConfigStorage-97468a0f.js} +31 -25
  2. package/dist/cjs/{DataFetcher-093c47ae.js → DataFetcher-04c70ba9.js} +88 -24
  3. package/dist/cjs/{PersonalizedFilterUtils-cfcd9af2.js → PersonalizedFilterUtils-9848e09b.js} +18 -64
  4. package/dist/cjs/{SnkFormConfigManager-ddad3cbb.js → SnkFormConfigManager-bef6e022.js} +2 -2
  5. package/dist/cjs/{SnkMessageBuilder-e55c7afa.js → SnkMessageBuilder-f40df6d4.js} +20 -3
  6. package/dist/cjs/{dataunit-fetcher-2f67ac79.js → dataunit-fetcher-4102080d.js} +1 -1
  7. package/dist/cjs/{filter-bar-config-fetcher-81868495.js → filter-bar-config-fetcher-a7747f69.js} +23 -6
  8. package/dist/cjs/{form-config-fetcher-affb0b28.js → form-config-fetcher-56442594.js} +2 -2
  9. package/dist/cjs/index-8d94b7e0.js +7 -0
  10. package/dist/cjs/index-c5771aba.js +44 -0
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{pesquisa-fetcher-21c3afc9.js → pesquisa-fetcher-cab451b6.js} +1 -1
  13. package/dist/cjs/{resource-fetcher-e71a11b8.js → resource-fetcher-260e98a4.js} +1 -1
  14. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  15. package/dist/cjs/snk-actions-button.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-application.cjs.entry.js +8 -8
  17. package/dist/cjs/snk-attach.cjs.entry.js +2 -2
  18. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  19. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  20. package/dist/cjs/{snk-data-unit-26cf970c.js → snk-data-unit-b0cc2d42.js} +1 -1
  21. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  22. package/dist/cjs/snk-detail-view.cjs.entry.js +9 -9
  23. package/dist/cjs/snk-expression-group_2.cjs.entry.js +542 -0
  24. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +66 -0
  25. package/dist/cjs/snk-filter-bar.cjs.entry.js +17 -17
  26. package/dist/cjs/snk-filter-detail.cjs.entry.js +5 -5
  27. package/dist/cjs/{snk-expression-item_3.cjs.entry.js → snk-filter-field-search_2.cjs.entry.js} +23 -315
  28. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -5
  29. package/dist/cjs/snk-filter-modal.cjs.entry.js +2 -2
  30. package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
  31. package/dist/cjs/snk-form.cjs.entry.js +6 -6
  32. package/dist/cjs/snk-grid-config.cjs.entry.js +5 -5
  33. package/dist/cjs/snk-grid.cjs.entry.js +5 -5
  34. package/dist/cjs/{snk-guides-viewer-b0f98cf4.js → snk-guides-viewer-897368ea.js} +3 -3
  35. package/dist/cjs/snk-guides-viewer.cjs.entry.js +8 -8
  36. package/dist/cjs/snk-personalized-filter.cjs.entry.js +125 -34
  37. package/dist/cjs/snk-print-selector.cjs.entry.js +15 -11
  38. package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
  39. package/dist/collection/collection-manifest.json +2 -0
  40. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +1 -1
  41. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +5 -1
  42. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +114 -23
  43. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +4 -6
  44. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +2 -1
  45. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.css +10 -0
  46. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.js +95 -0
  47. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.css +66 -0
  48. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +158 -0
  49. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +8 -2
  50. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +14 -23
  51. package/dist/collection/components/snk-print-selector/snk-print-selector.css +9 -1
  52. package/dist/collection/components/snk-print-selector/snk-print-selector.js +17 -14
  53. package/dist/collection/lib/configs/ConfigStorage.js +5 -3
  54. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +22 -5
  55. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +22 -18
  56. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +18 -2
  57. package/dist/collection/lib/message/resources/snk-print-selector.msg.js +2 -1
  58. package/dist/collection/lib/utils/PrintUtils.js +88 -24
  59. package/dist/components/ConfigStorage.js +27 -21
  60. package/dist/components/DataFetcher.js +88 -24
  61. package/dist/components/PersonalizedFilterUtils.js +14 -23
  62. package/dist/components/SnkMessageBuilder.js +20 -3
  63. package/dist/components/filter-bar-config-fetcher.js +22 -5
  64. package/dist/components/index.d.ts +2 -0
  65. package/dist/components/index.js +2 -0
  66. package/dist/components/snk-crud.js +34 -22
  67. package/dist/components/snk-detail-view2.js +49 -27
  68. package/dist/components/snk-expression-group2.js +4 -6
  69. package/dist/components/snk-expression-item2.js +2 -1
  70. package/dist/components/snk-filter-advanced-mode.d.ts +11 -0
  71. package/dist/components/snk-filter-advanced-mode.js +6 -0
  72. package/dist/components/snk-filter-advanced-mode2.js +46 -0
  73. package/dist/components/snk-filter-assistent-mode.d.ts +11 -0
  74. package/dist/components/snk-filter-assistent-mode.js +6 -0
  75. package/dist/components/snk-filter-assistent-mode2.js +77 -0
  76. package/dist/components/snk-filter-bar2.js +17 -5
  77. package/dist/components/snk-filter-param-config2.js +6 -0
  78. package/dist/components/snk-grid2.js +22 -10
  79. package/dist/components/snk-personalized-filter2.js +131 -28
  80. package/dist/components/snk-print-selector.js +14 -10
  81. package/dist/esm/{ConfigStorage-24b221ba.js → ConfigStorage-02f17a26.js} +31 -25
  82. package/dist/esm/{DataFetcher-6153ff3e.js → DataFetcher-fddeb917.js} +88 -24
  83. package/dist/esm/{PersonalizedFilterUtils-1a167d89.js → PersonalizedFilterUtils-731cae01.js} +16 -62
  84. package/dist/esm/{SnkFormConfigManager-fcbefc1a.js → SnkFormConfigManager-cd9e6cab.js} +2 -2
  85. package/dist/esm/{SnkMessageBuilder-96e66d9c.js → SnkMessageBuilder-5be56185.js} +20 -3
  86. package/dist/esm/{dataunit-fetcher-09586248.js → dataunit-fetcher-66f42154.js} +1 -1
  87. package/dist/esm/{filter-bar-config-fetcher-73ebc12f.js → filter-bar-config-fetcher-790283d8.js} +23 -6
  88. package/dist/esm/{form-config-fetcher-01e9985d.js → form-config-fetcher-533b895e.js} +2 -2
  89. package/dist/esm/index-620ac460.js +7 -0
  90. package/dist/esm/index-ae591a44.js +44 -0
  91. package/dist/esm/loader.js +1 -1
  92. package/dist/esm/{pesquisa-fetcher-829ec5a9.js → pesquisa-fetcher-4a702655.js} +1 -1
  93. package/dist/esm/{resource-fetcher-d053e214.js → resource-fetcher-0f20a072.js} +1 -1
  94. package/dist/esm/sankhyablocks.js +1 -1
  95. package/dist/esm/snk-actions-button.entry.js +2 -2
  96. package/dist/esm/snk-application.entry.js +8 -8
  97. package/dist/esm/snk-attach.entry.js +2 -2
  98. package/dist/esm/snk-crud.entry.js +2 -2
  99. package/dist/esm/snk-data-exporter.entry.js +3 -3
  100. package/dist/esm/{snk-data-unit-0f2d3c74.js → snk-data-unit-b9b4bb5f.js} +1 -1
  101. package/dist/esm/snk-data-unit.entry.js +2 -2
  102. package/dist/esm/snk-detail-view.entry.js +9 -9
  103. package/dist/esm/snk-expression-group_2.entry.js +537 -0
  104. package/dist/esm/snk-filter-advanced-mode_2.entry.js +61 -0
  105. package/dist/esm/snk-filter-bar.entry.js +8 -8
  106. package/dist/esm/snk-filter-detail.entry.js +5 -5
  107. package/dist/esm/{snk-expression-item_3.entry.js → snk-filter-field-search_2.entry.js} +12 -303
  108. package/dist/esm/snk-filter-modal-item.entry.js +5 -5
  109. package/dist/esm/snk-filter-modal.entry.js +2 -2
  110. package/dist/esm/snk-form-config.entry.js +3 -3
  111. package/dist/esm/snk-form.entry.js +6 -6
  112. package/dist/esm/snk-grid-config.entry.js +5 -5
  113. package/dist/esm/snk-grid.entry.js +5 -5
  114. package/dist/esm/{snk-guides-viewer-ab5c376c.js → snk-guides-viewer-579c70cc.js} +3 -3
  115. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  116. package/dist/esm/snk-personalized-filter.entry.js +122 -31
  117. package/dist/esm/snk-print-selector.entry.js +15 -11
  118. package/dist/esm/snk-simple-crud.entry.js +2 -2
  119. package/dist/sankhyablocks/{p-e665c93f.entry.js → p-19fdcf88.entry.js} +1 -1
  120. package/dist/sankhyablocks/{p-4ab8d0ee.entry.js → p-1fe2976e.entry.js} +1 -1
  121. package/dist/sankhyablocks/p-2227bb94.js +1 -0
  122. package/dist/sankhyablocks/{p-85e6068d.entry.js → p-2ddf3e87.entry.js} +1 -1
  123. package/dist/sankhyablocks/p-386102a7.entry.js +1 -0
  124. package/dist/sankhyablocks/{p-eaec700d.js → p-3b059f4e.js} +1 -1
  125. package/dist/sankhyablocks/p-4af6cbef.entry.js +1 -0
  126. package/dist/sankhyablocks/p-4bbc7aac.entry.js +1 -0
  127. package/dist/sankhyablocks/p-4f550a1a.js +1 -0
  128. package/dist/sankhyablocks/{p-7dd92fb8.entry.js → p-4f687570.entry.js} +1 -1
  129. package/dist/sankhyablocks/p-5098f618.js +1 -0
  130. package/dist/sankhyablocks/{p-16ad23d5.entry.js → p-5596a2dd.entry.js} +1 -1
  131. package/dist/sankhyablocks/p-7e636457.entry.js +1 -0
  132. package/dist/sankhyablocks/p-7f1c4687.js +56 -0
  133. package/dist/sankhyablocks/p-82800006.entry.js +1 -0
  134. package/dist/sankhyablocks/{p-05d82333.entry.js → p-88f4ef73.entry.js} +1 -1
  135. package/dist/sankhyablocks/{p-d20e2ce3.js → p-8f484733.js} +1 -1
  136. package/dist/sankhyablocks/{p-eb0c9f4c.js → p-90a926c7.js} +1 -1
  137. package/dist/sankhyablocks/{p-432dd007.entry.js → p-90e7c3a2.entry.js} +1 -1
  138. package/dist/sankhyablocks/p-933c0c0b.js +1 -0
  139. package/dist/sankhyablocks/p-9666c0d0.entry.js +1 -0
  140. package/dist/sankhyablocks/p-97720467.entry.js +1 -0
  141. package/dist/sankhyablocks/{p-a4cd60bf.entry.js → p-97c586ab.entry.js} +1 -1
  142. package/dist/sankhyablocks/{p-814f9247.js → p-982107dc.js} +1 -1
  143. package/dist/sankhyablocks/{p-354ce206.entry.js → p-9fa9331b.entry.js} +1 -1
  144. package/dist/sankhyablocks/{p-07cb8a03.entry.js → p-a357d13c.entry.js} +1 -1
  145. package/dist/sankhyablocks/{p-bfe8b96d.js → p-acd8b97b.js} +1 -1
  146. package/dist/sankhyablocks/{p-40a5d35e.entry.js → p-ad6673fb.entry.js} +1 -1
  147. package/dist/sankhyablocks/{p-3e8748b1.entry.js → p-af8ed6d5.entry.js} +1 -1
  148. package/dist/sankhyablocks/{p-bd1f8640.entry.js → p-bc19b890.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-bd86c9d3.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-1b596ea1.entry.js → p-cdbdcf13.entry.js} +1 -1
  151. package/dist/sankhyablocks/{p-89fb7531.js → p-d97eb781.js} +2 -2
  152. package/dist/sankhyablocks/{p-60ad0dea.js → p-f034254e.js} +1 -1
  153. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  154. package/dist/sankhyablocks/{p-9a7aafe4.js → p-fb1e5b6d.js} +1 -1
  155. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  156. package/dist/types/components/snk-personalized-filter/interfaces/IPersonalizedFilter.d.ts +4 -0
  157. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +17 -6
  158. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +2 -2
  159. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-advanced-mode/snk-filter-advanced-mode.d.ts +20 -0
  160. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +31 -0
  161. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +6 -0
  162. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +2 -2
  163. package/dist/types/components/snk-print-selector/snk-print-selector.d.ts +7 -1
  164. package/dist/types/components.d.ts +106 -4
  165. package/dist/types/lib/configs/ConfigStorage.d.ts +3 -2
  166. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +2 -1
  167. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
  168. package/dist/types/lib/utils/PrintUtils.d.ts +5 -2
  169. package/package.json +1 -1
  170. package/react/components.d.ts +2 -0
  171. package/react/components.js +2 -0
  172. package/react/components.js.map +1 -1
  173. package/dist/cjs/IExpressionItem-0e32ebb7.js +0 -7
  174. package/dist/cjs/snk-expression-group.cjs.entry.js +0 -250
  175. package/dist/esm/IExpressionItem-21f225bf.js +0 -7
  176. package/dist/esm/snk-expression-group.entry.js +0 -246
  177. package/dist/sankhyablocks/p-13f0ed88.entry.js +0 -1
  178. package/dist/sankhyablocks/p-2b449454.js +0 -1
  179. package/dist/sankhyablocks/p-63bff2a8.js +0 -1
  180. package/dist/sankhyablocks/p-6f49f5d4.entry.js +0 -1
  181. package/dist/sankhyablocks/p-744d0fd2.js +0 -1
  182. package/dist/sankhyablocks/p-7d68a43a.js +0 -1
  183. package/dist/sankhyablocks/p-9404ad4d.entry.js +0 -1
  184. package/dist/sankhyablocks/p-ad4bb9d2.entry.js +0 -1
  185. package/dist/sankhyablocks/p-d9586ead.entry.js +0 -1
  186. package/dist/sankhyablocks/p-e789eb2d.js +0 -68
  187. package/dist/sankhyablocks/p-f8ce17d3.entry.js +0 -1
  188. package/dist/sankhyablocks/p-feb6963e.entry.js +0 -1
@@ -0,0 +1,542 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-f9e81701.js');
6
+ const index$1 = require('./index-c5771aba.js');
7
+ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
+ const core = require('@sankhyalabs/core');
9
+ const index$3 = require('./index-8d94b7e0.js');
10
+ const FieldBuilder = require('@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder');
11
+ const index$2 = require('./index-102ba62d.js');
12
+ const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
13
+
14
+ const snkExpressionGroupCss = ".sc-snk-expression-group-h{display:block;--snk-expression-group--container-condition--width:184px;--snk-expression-group--container-condition--height:38px;--snk-expression-group--container-condition--border-radius:var(--border--radius-medium, 12px);--snk-expression-group--container-option--width:85px;--snk-expression-group__container-condition--background-and:#66B6A0;--snk-expression-group__container-condition--background-or:#EBC65E;--snk-expression-group__container-expression--padding-left:26px;--snk-expression-group__background-color-dashed:var(--background--body, #fafcff)}.snk-expression-group__container-condition.sc-snk-expression-group{width:var(--snk-expression-group--container-condition--width);height:var(--snk-expression-group--container-condition--height);border-radius:var(--snk-expression-group--container-condition--border-radius);z-index:var(--more-visible--2x, 3)}.snk-expression-group__container-option.sc-snk-expression-group{width:var(--snk-expression-group--container-option--width)}.snk-expression-group__container-condition[data-condition=\"AND\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-and)}.snk-expression-group__container-condition[data-condition=\"OR\"].sc-snk-expression-group{background-color:var(--snk-expression-group__container-condition--background-or)}.snk-expression-group__container-expression.sc-snk-expression-group{padding-left:var(--snk-expression-group__container-expression--padding-left)}.dashes.sc-snk-expression-group{z-index:var(--visible, 1);background:var(--snk-expression-group__background-color-dashed);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:58px;margin-left:-15px;margin-top:-36.5px}.horizontal-dashes.sc-snk-expression-group{z-index:var(--more-visible, 2);border-bottom:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:54px;margin-left:-15px;margin-top:-33.5px}.hidden.sc-snk-expression-group{display:none}";
15
+
16
+ const SnkExpressionGroup = class {
17
+ constructor(hostRef) {
18
+ index.registerInstance(this, hostRef);
19
+ this.ezFilterGroupChange = index.createEvent(this, "ezFilterGroupChange", 7);
20
+ this.ezFilterGroupRemove = index.createEvent(this, "ezFilterGroupRemove", 7);
21
+ this.ezExpressionGroupLayoutChanged = index.createEvent(this, "ezExpressionLayoutChanged", 7);
22
+ this.FIRST_LEVEL = "0";
23
+ this.LIMIT_GROUP_LEVEL = 4;
24
+ this.application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
25
+ this._conditionOperator = index$1.FilterGroupCondition.AND;
26
+ this._group = undefined;
27
+ this._selfTop = 0;
28
+ this.canAddExpression = true;
29
+ this._showDashes = true;
30
+ this.parentTop = 0;
31
+ this.group = undefined;
32
+ this.messagesBuilder = undefined;
33
+ this.filterId = undefined;
34
+ this.entityURI = undefined;
35
+ }
36
+ /**
37
+ * Listener para capturar adição e remoção de grupos e items de expressão.
38
+ */
39
+ todoCompletedHandler(_) {
40
+ this.updateDashes();
41
+ }
42
+ /*
43
+ * Retorna o grupo da expressão.
44
+ */
45
+ async getExpressionGroup() {
46
+ return this._group;
47
+ }
48
+ watchGroup(newValue) {
49
+ this._group = newValue;
50
+ this._conditionOperator = this.getOperand();
51
+ }
52
+ componentWillLoad() {
53
+ this._group = this.group;
54
+ this._conditionOperator = this.getOperand();
55
+ if (!this.getDataGroupLevel()) {
56
+ this._element.setAttribute('data-group-level', this.FIRST_LEVEL);
57
+ }
58
+ this.canAddExpression = this.group.items.every(this.isFilledItem);
59
+ }
60
+ componentDidRender() {
61
+ this.setSelfTop();
62
+ }
63
+ changeHandler() {
64
+ this.ezExpressionGroupLayoutChanged.emit();
65
+ }
66
+ /**
67
+ * Função que define o valor atualizado da propriedade top do elemento em tela para calcular o tamanho do tracejado.
68
+ */
69
+ setSelfTop() {
70
+ this._selfTop = this._element.getBoundingClientRect().top;
71
+ }
72
+ /**
73
+ * Função que calcula o tamanho que deve ter o tracejado.
74
+ */
75
+ getDashedHeight() {
76
+ return this._selfTop - this.parentTop;
77
+ }
78
+ getOperand() {
79
+ return !this._group.operand ? index$1.FilterGroupCondition.AND : this._group.operand;
80
+ }
81
+ getMessage(key, params) {
82
+ return this.application.messagesBuilder.getMessage(key, params);
83
+ }
84
+ updateDashes() {
85
+ this._showDashes = false;
86
+ this.setSelfTop();
87
+ this._showDashes = true;
88
+ }
89
+ renderExpressionItems() {
90
+ var _a;
91
+ return (_a = this._group.items) === null || _a === void 0 ? void 0 : _a.map((item) => (index.h("snk-expression-item", { key: item.id, class: "ez-padding-top--small snk-expression-group__item", expression: item, canRemove: this._group.items.length > 1, onEzFilterItemChange: () => this.handleFilterItemChange(), onEzFilterItemRemove: (evt) => this.handleFilterItemRemove(evt, item.id), messagesBuilder: this.messagesBuilder, entityURI: this.entityURI })));
92
+ }
93
+ renderGroups() {
94
+ var _a;
95
+ const currentLevel = parseInt(this.getDataGroupLevel() || '0');
96
+ const newLevel = currentLevel + 1;
97
+ return (_a = this._group.childrenGroups) === null || _a === void 0 ? void 0 : _a.map((group) => (index.h("snk-expression-group", { key: group.id, group: group, messagesBuilder: this.messagesBuilder, parentTop: this._selfTop, "data-group-level": newLevel, onEzFilterGroupRemove: (evt) => this.handleFilterGroupRemove(evt, group.id), entityURI: this.entityURI })));
98
+ }
99
+ handleFilterGroupRemove(evt, groupId) {
100
+ this.onStopPropagation(evt);
101
+ this._group.childrenGroups = this._group.childrenGroups.filter(group => group.id !== groupId);
102
+ index.forceUpdate(this);
103
+ this.ezFilterGroupChange.emit(this._group);
104
+ this.changeHandler();
105
+ }
106
+ handleFilterItemRemove(evt, itemId) {
107
+ this.onStopPropagation(evt);
108
+ this._group.items = this._group.items.filter(item => item.id !== itemId);
109
+ index.forceUpdate(this);
110
+ this.ezFilterGroupChange.emit(this._group);
111
+ this.changeHandler();
112
+ this.canAddExpression = true;
113
+ }
114
+ isFilledItem(item) {
115
+ if (!item.fieldName || !item.operand)
116
+ return false;
117
+ if (item.operand === 'NULL' || item.operand === 'NOT_NULL') {
118
+ return true;
119
+ }
120
+ else {
121
+ return item.paramVariable || (item.userInterface === 'SWITCH') ? true : !!item.value;
122
+ }
123
+ }
124
+ handleFilterItemChange() {
125
+ this.ezFilterGroupChange.emit(this._group);
126
+ this.canAddExpression = this.group.items.every(this.isFilledItem);
127
+ }
128
+ handleAddExpression() {
129
+ const newItem = {
130
+ id: core.StringUtils.generateUUID(),
131
+ entityName: "",
132
+ fieldName: "",
133
+ description: "",
134
+ label: "Valor",
135
+ type: undefined,
136
+ expression: undefined,
137
+ operand: undefined,
138
+ paramVariable: false,
139
+ value: undefined,
140
+ systemConfig: null,
141
+ userConfig: null
142
+ };
143
+ this._group.items.push(newItem);
144
+ index.forceUpdate(this);
145
+ this.ezFilterGroupChange.emit(this.group);
146
+ this.changeHandler();
147
+ this.canAddExpression = false;
148
+ }
149
+ handleAddGroup() {
150
+ var _a;
151
+ const newGroup = {
152
+ id: core.StringUtils.generateUUID(),
153
+ items: [
154
+ {
155
+ id: core.StringUtils.generateUUID(),
156
+ entityName: "",
157
+ fieldName: "",
158
+ description: "",
159
+ label: "Valor",
160
+ type: undefined,
161
+ expression: undefined,
162
+ operand: undefined,
163
+ paramVariable: false,
164
+ value: undefined,
165
+ systemConfig: null,
166
+ userConfig: null
167
+ }
168
+ ],
169
+ childrenGroups: [],
170
+ operand: index$1.FilterGroupCondition.AND
171
+ };
172
+ this._group.childrenGroups = (_a = this._group.childrenGroups) !== null && _a !== void 0 ? _a : [];
173
+ this._group.childrenGroups.push(newGroup);
174
+ index.forceUpdate(this);
175
+ this.ezFilterGroupChange.emit(this.group);
176
+ this.changeHandler();
177
+ }
178
+ buildGroupStyle() {
179
+ return {
180
+ height: `${this.getDashedHeight()}px`,
181
+ marginTop: `${-(this.getDashedHeight()) + 20}px`,
182
+ };
183
+ }
184
+ handleConditionOperatorChange(newOperator) {
185
+ this._conditionOperator = newOperator;
186
+ this._group.operand = index$1.FilterGroupCondition[newOperator];
187
+ this.ezFilterGroupChange.emit(this._group);
188
+ }
189
+ confirmRemoveGroup(evt) {
190
+ this.onStopPropagation(evt);
191
+ utils.ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmGroup.title"), this.getMessage("snkPersonalizedFilter.confirmGroup.description"))
192
+ .then((canRemove) => {
193
+ if (canRemove) {
194
+ this.ezFilterGroupRemove.emit(this._group);
195
+ }
196
+ });
197
+ }
198
+ getTooltipMessageForOperator() {
199
+ const groupLevel = this.getDataGroupLevel();
200
+ if (groupLevel === this.FIRST_LEVEL && this._group.items.length === 1) {
201
+ return this.getMessage("snkPersonalizedFilter.operador.firstLevel");
202
+ }
203
+ if (this._conditionOperator === index$1.FilterGroupCondition.AND) {
204
+ return this.getMessage("snkPersonalizedFilter.operador.and");
205
+ }
206
+ else if (this._conditionOperator === index$1.FilterGroupCondition.OR) {
207
+ return this.getMessage("snkPersonalizedFilter.operador.or");
208
+ }
209
+ }
210
+ getDataGroupLevel() {
211
+ return this._element.getAttribute('data-group-level');
212
+ }
213
+ canAddGroup() {
214
+ const dataGroupLevel = Number(this.getDataGroupLevel() || this.FIRST_LEVEL);
215
+ return dataGroupLevel < this.LIMIT_GROUP_LEVEL;
216
+ }
217
+ isFirstLevel() {
218
+ return Boolean(this.getDataGroupLevel() === this.FIRST_LEVEL);
219
+ }
220
+ onStopPropagation(evt) {
221
+ evt.preventDefault();
222
+ evt.stopPropagation();
223
+ }
224
+ getMessageAddTooltip() {
225
+ if (this.isFirstLevel()) {
226
+ const allValidItems = this.group.items.every(item => {
227
+ if (!item.fieldName || !item.operand)
228
+ return false;
229
+ return item.paramVariable || !!item.value;
230
+ });
231
+ return allValidItems ? this.getMessage("snkPersonalizedFilter.info.labelAddNewExpression") : this.getMessage("snkPersonalizedFilter.info.labelDisabledAddExpressionButton");
232
+ }
233
+ else {
234
+ return this.canAddExpression ? this.getMessage("snkPersonalizedFilter.info.labelAddNewExpression") : this.getMessage("snkPersonalizedFilter.info.labelDisabledAddExpressionButton");
235
+ }
236
+ }
237
+ canChangeGroupCondition() {
238
+ const membersCount = this._group.items.length + this._group.childrenGroups.length;
239
+ return membersCount > 1;
240
+ }
241
+ render() {
242
+ const canAddGroup = this.canAddGroup();
243
+ return (index.h(index.Host, null, index.h("div", { class: !this.isFirstLevel() && this._showDashes ? 'dashes' : 'hidden', style: this.buildGroupStyle() }), index.h("div", { class: !this.isFirstLevel() && this._showDashes ? 'horizontal-dashes' : 'hidden' }), index.h("div", { class: 'ez-flex ez-flex--align-items-center' }, index.h("div", { class: 'snk-expression-group__container-condition ez-flex ez-flex-item--align-center ez-flex--align-items-center', "data-condition": this._conditionOperator, title: this.getTooltipMessageForOperator() }, index.h("label", { class: "ez-label ez-padding-right--medium ez-padding-left--medium ez-title--primary" }, this.getMessage("snkPersonalizedFilter.info.condition")), index.h("div", null, index.h("ez-combo-box", Object.assign({ class: "snk-expression-group__container-option", canShowError: false, mode: "slim", suppressEmptyOption: true, enabled: this.canChangeGroupCondition(), value: this._conditionOperator, onEzChange: (evt) => this.handleConditionOperatorChange(evt.detail.value) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxConditions_level_${this.getDataGroupLevel()}` }), index.h("option", { value: index$1.FilterGroupCondition.AND }, "E"), index.h("option", { value: index$1.FilterGroupCondition.OR }, "OU")))), index.h("ez-button", { class: "ez-padding-right--medium ez-padding-left--medium", mode: "icon", iconName: "plus", size: "small", enabled: this.canAddExpression, title: this.getMessageAddTooltip(), onClick: () => this.handleAddExpression() }), index.h("ez-button", { label: this.getMessage("snkPersonalizedFilter.info.addGroup"), size: "small", enabled: canAddGroup, title: !canAddGroup ? this.getMessage('snkPersonalizedFilter.info.labelDisabledAddGroupButton', { LIMIT_GROUP_LEVEL: this.LIMIT_GROUP_LEVEL + 1 }) : '', onClick: () => this.handleAddGroup() }, index.h("ez-icon", { class: "ez-padding-right--small", slot: "leftIcon", iconName: "plus" })), !this.isFirstLevel() && index.h("ez-button", { title: this.getMessage("snkPersonalizedFilter.info.labelDeleteExpression"), class: "ez-padding-left--medium", mode: "icon", iconName: "delete", size: "small", onClick: (evt) => this.confirmRemoveGroup(evt) })), index.h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, index.h("div", { class: "ez-padding-top--small" }, this.renderExpressionItems())), index.h("div", { class: "ez-padding-top--small snk-expression-group__container-expression" }, index.h("div", { class: "ez-padding-top--small" }, this.renderGroups()))));
244
+ }
245
+ get _element() { return index.getElement(this); }
246
+ static get watchers() { return {
247
+ "group": ["watchGroup"]
248
+ }; }
249
+ };
250
+ SnkExpressionGroup.style = snkExpressionGroupCss;
251
+
252
+ const defaultsOperand = [
253
+ { label: "Igual (=)", value: "EQUAL" },
254
+ { label: "Diferente (<>)", value: "DIFFERENT" },
255
+ { label: "Contendo (LIKE)", value: "LIKE" },
256
+ { label: "Contido em (IN)", value: "IN" },
257
+ { label: "Iniciado com (%?)", value: "START_WITH" },
258
+ { label: "Terminado com (?%)", value: "FINISHED_WITH" },
259
+ { label: "Vazio (NULL)", value: "NULL" },
260
+ { label: "Não Vazio (NOT NULL)", value: "NOT_NULL" },
261
+ ];
262
+ const FilterOperandDefault = defaultsOperand.concat([
263
+ { label: "Maior (>)", value: "LARGER" },
264
+ { label: "Maior ou Igual (>=)", value: "LARGER_EQUAL" },
265
+ { label: "Menor (<)", value: "SMALLER" },
266
+ { label: "Menor ou Igual (<=)", value: "SMALLER_EQUAL" }
267
+ ]);
268
+ const FilterOperandTypeTextSearch = defaultsOperand;
269
+ const FIELD_TYPE_SEARCH_AND_TEXT = [
270
+ core.UserInterface.SEARCH,
271
+ core.UserInterface.SHORTTEXT,
272
+ core.UserInterface.PASSWORD,
273
+ core.UserInterface.MASKEDTEXT,
274
+ core.UserInterface.LONGTEXT,
275
+ core.UserInterface.HTML
276
+ ];
277
+
278
+ const snkExpressionItemCss = ".sc-snk-expression-item-h{display:flex;width:100%;--snk-expression-item--background-color:var(--background--xlight, #fff);--snk-expression-item__itens--padding:var(--space--small, 6px);--snk-expression-item__width--input-operator:220px;--snk-expression-item__width--input-value:240px;--snk-expression-item__width--input-value-variable:176px;--snk-expression-item--border-radius:var(--border--radius-medium, 12px);--snk-expression-item--border-color:var(--color--strokes, #DCE0E8);--snk-expression-item--border-style:var(--border--small, 1px solid);--snk-expression-item__background-color-dashed:var(--background--body, #fafcff)}.box.sc-snk-expression-item{width:100%;height:56px;background:var(--snk-expression-item--background-color);border:var(--snk-expression-item--border-color) var(--snk-expression-item--border-style);border-radius:var(--snk-expression-item--border-radius)}.box__container.sc-snk-expression-item{display:flex;align-items:center;justify-content:space-between;white-space:nowrap;margin:var(--space--small, 6px)}.box__container--input-filter.sc-snk-expression-item{width:100%}.box__container--input-operator.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-operator);min-width:var(--snk-expression-item__width--input-operator)}.box__container--input-value.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value);min-width:var(--snk-expression-item__width--input-value)}.box__container--input-value-variable.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value-variable);min-width:var(--snk-expression-item__width--input-value-variable)}.box__container--button-delete.sc-snk-expression-item{display:flex}.box__container.sc-snk-expression-item>div.sc-snk-expression-item{padding-left:var(--snk-expression-item__itens--padding);padding-right:var(--snk-expression-item__itens--padding)}.box__container--button-delete--icon.sc-snk-expression-item{width:42px;min-width:42px}.box__container--input-value-variable--icon.sc-snk-expression-item{cursor:pointer}.dashes.sc-snk-expression-item{z-index:var(--more-visible, 2);background:var(--snk-expression-item__background-color-dashed);border-bottom:2px dashed var(--text-secondary, #A2ABB9);border-left:2px dashed var(--text-secondary, #A2ABB9);position:absolute;width:15px;height:62px;margin-left:-15px;margin-top:-33.5px}";
279
+
280
+ const SnkExpressionItem = class {
281
+ constructor(hostRef) {
282
+ index.registerInstance(this, hostRef);
283
+ this.ezFilterItemChange = index.createEvent(this, "ezFilterItemChange", 7);
284
+ this.ezFilterItemRemove = index.createEvent(this, "ezFilterItemRemove", 7);
285
+ this.application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
286
+ this.filterOperandDefault = FilterOperandDefault;
287
+ this.filterOperandTypeTextSearch = FilterOperandTypeTextSearch;
288
+ this.DEFAULT_FIELD_NAME = 'NOT_DEFINED';
289
+ this._showValueVariable = false;
290
+ this._fieldSelected = undefined;
291
+ this._optionNotNull = false;
292
+ this.expression = undefined;
293
+ this.canRemove = true;
294
+ this.messagesBuilder = undefined;
295
+ this.entityURI = undefined;
296
+ }
297
+ expressionChanged(newValue, oldValue) {
298
+ if (newValue !== oldValue) {
299
+ this.ezFilterItemChange.emit(newValue);
300
+ this.updateFieldSelected();
301
+ }
302
+ }
303
+ componentWillLoad() {
304
+ this._dataSourceFetcher = index$2.store.get(`filterFieldsDataSource.${this.entityURI}`);
305
+ index$2.store.onChange(`filterFieldsDataSource.${this.entityURI}`, () => {
306
+ this._dataSourceFetcher = index$2.store.get(`filterFieldsDataSource.${this.entityURI}`);
307
+ });
308
+ if (this.expression) {
309
+ this.updateFieldSelected();
310
+ this._optionNotNull = this.expression.operand === 'NULL' || this.expression.operand === 'NOT_NULL';
311
+ }
312
+ }
313
+ componentDidRender() {
314
+ var _a;
315
+ this._showValueVariable = (_a = this._elValueVariable) === null || _a === void 0 ? void 0 : _a.value;
316
+ }
317
+ updateFieldSelected() {
318
+ const field = {
319
+ dataType: this.expression.type,
320
+ description: this.expression.description,
321
+ name: this.expression.fieldName,
322
+ label: this.expression.fieldLabel,
323
+ entityName: this.expression.entityName,
324
+ onlyDate: false,
325
+ path: this.expression.description,
326
+ properties: this.expressionPropsToFieldProps(this.expression.props),
327
+ type: index$3.SelectedItemType.FIELD,
328
+ uri: "",
329
+ userInterface: this.expression.userInterface
330
+ };
331
+ this._fieldSelected = field;
332
+ }
333
+ buildExpression(entityName, fieldName, entityPath) {
334
+ if (entityPath.length > 0) {
335
+ entityPath.shift();
336
+ }
337
+ return entityPath.length > 0 ? `${entityPath.join("->")}->${fieldName}` : `${entityName}.${fieldName}`;
338
+ }
339
+ setValueExpression(key, value) {
340
+ if (key === "fieldName") {
341
+ this.expression.description = value.path;
342
+ this.expression.expression = this.buildExpression(value.entityName, value.name, value.entityPath);
343
+ this.expression.fieldName = value.name;
344
+ this.expression.fieldLabel = value.label;
345
+ this.expression.type = value.dataType;
346
+ this.expression.userInterface = value.userInterface;
347
+ this.expression.entityName = value.entityName;
348
+ this.expression.value = undefined;
349
+ this.expression.props = this.fieldPropsToExpressionProps(value.properties);
350
+ }
351
+ else {
352
+ this.expression[key] = value;
353
+ }
354
+ this.expressionChanged(this.expression);
355
+ }
356
+ fieldPropsToExpressionProps(properties) {
357
+ const parsedProps = [];
358
+ if (!properties) {
359
+ return parsedProps;
360
+ }
361
+ for (const key in properties) {
362
+ let propValue = properties[key];
363
+ if (typeof propValue == "object") {
364
+ propValue = JSON.stringify(propValue);
365
+ }
366
+ parsedProps.push({ name: key, value: propValue });
367
+ }
368
+ return parsedProps;
369
+ }
370
+ expressionPropsToFieldProps(properties) {
371
+ const parsedProps = {};
372
+ if (!properties) {
373
+ return parsedProps;
374
+ }
375
+ properties.forEach(prop => {
376
+ try {
377
+ parsedProps[prop.name] = JSON.parse(prop.value);
378
+ }
379
+ catch (_a) {
380
+ parsedProps[prop.name] = prop.value;
381
+ }
382
+ });
383
+ return parsedProps;
384
+ }
385
+ getMessage(key, params) {
386
+ return this.application.messagesBuilder.getMessage(key, params);
387
+ }
388
+ handleSelectItem(filterField) {
389
+ if (this.hasNoChanges(filterField)) {
390
+ this._elFilterInput.value = filterField.path;
391
+ return;
392
+ }
393
+ if (filterField.type === index$3.SelectedItemType.FIELD) {
394
+ const field = filterField;
395
+ this._fieldSelected = field;
396
+ this.setValueExpression("fieldName", field);
397
+ }
398
+ }
399
+ hasNoChanges(filterField) {
400
+ return filterField.name === this.expression.fieldName && filterField.path === this.expression.description;
401
+ }
402
+ handleFocus() {
403
+ if (this._elFilterFieldSearch)
404
+ this._elFilterFieldSearch.show();
405
+ }
406
+ handleChangeFilterInput(evt) {
407
+ this._elFilterFieldSearch.applyFilter(evt.detail);
408
+ }
409
+ handleChangeValueVariable(showValueVariable) {
410
+ this._showValueVariable = showValueVariable;
411
+ if (this._elFieldDynamic) {
412
+ this._elFieldDynamic.value = undefined;
413
+ this._elFieldDynamic.enabled = !showValueVariable;
414
+ }
415
+ this.expression["paramVariable"] = showValueVariable;
416
+ this.expressionChanged(this.expression);
417
+ }
418
+ openSnkFilterParamConfig() {
419
+ var _a;
420
+ (_a = this._elFilterParamConfigRef) === null || _a === void 0 ? void 0 : _a.open(this.expression).then(this.onOpenPromiseReady.bind(this)).catch(error => {
421
+ console.error(error);
422
+ });
423
+ }
424
+ onOpenPromiseReady(changes) {
425
+ this.expression = changes;
426
+ }
427
+ buildOptionsOperator() {
428
+ var _a;
429
+ if (FIELD_TYPE_SEARCH_AND_TEXT.includes((_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.userInterface)) {
430
+ return this.filterOperandTypeTextSearch;
431
+ }
432
+ else {
433
+ return this.filterOperandDefault;
434
+ }
435
+ }
436
+ handleChangeOperator(optionSelected) {
437
+ this.checkOptionIsNull(optionSelected);
438
+ this.setValueExpression("operand", optionSelected);
439
+ }
440
+ checkOptionIsNull(optionSelected) {
441
+ const filterOperandValue = index$1.FilterOperand[optionSelected];
442
+ if ([index$1.FilterOperand.NULL, index$1.FilterOperand.NOT_NULL].includes(filterOperandValue)) {
443
+ this._optionNotNull = true;
444
+ if (this._elFieldDynamic) {
445
+ this._elFieldDynamic.enabled = false;
446
+ this._elFieldDynamic.value = undefined;
447
+ }
448
+ }
449
+ else {
450
+ this._optionNotNull = false;
451
+ if (this._elFieldDynamic) {
452
+ this._elFieldDynamic.enabled = this._showValueVariable ? false : true;
453
+ }
454
+ }
455
+ }
456
+ confirmRemove(evt) {
457
+ evt.preventDefault();
458
+ evt.stopPropagation();
459
+ utils.ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirmExpression.title"), this.getMessage("snkPersonalizedFilter.confirmExpression.description"))
460
+ .then((canRemove) => {
461
+ if (canRemove) {
462
+ this.ezFilterItemRemove.emit(this.expression);
463
+ }
464
+ });
465
+ }
466
+ buildFieldByType() {
467
+ var _a, _b, _c;
468
+ if (!this._fieldSelected)
469
+ return;
470
+ const inputFieldData = (_a = FieldBuilder.fieldBuilder(this.configureFieldByType())) === null || _a === void 0 ? void 0 : _a.$children$.shift();
471
+ if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData || this.expression.paramVariable || this._showValueVariable || !((_c = this._fieldSelected) === null || _c === void 0 ? void 0 : _c.dataType)) {
472
+ inputFieldData.$attrs$.enabled = false;
473
+ }
474
+ if (this.expression.value != undefined) {
475
+ inputFieldData.$attrs$.value = this.getExpressiontValue(this.expression);
476
+ }
477
+ inputFieldData.$attrs$.onEzChange = (event) => {
478
+ this.setValueExpression("value", event.target.value);
479
+ };
480
+ if (this.expression.userInterface === 'SWITCH' && this.expression.value == undefined) {
481
+ this.setValueExpression("value", false);
482
+ }
483
+ return index.h(inputFieldData.$tag$, Object.assign(Object.assign({}, inputFieldData.$attrs$), { ref: (el) => {
484
+ this._elFieldDynamic = el;
485
+ }, label: this.expression.fieldLabel || this._fieldSelected.label }));
486
+ }
487
+ getExpressiontValue(expression) {
488
+ return DataType.convertType(expression.type, expression.value);
489
+ }
490
+ configureFieldByType() {
491
+ var _a, _b;
492
+ const field = {
493
+ userInterface: this._fieldSelected.userInterface,
494
+ name: this._fieldSelected.name,
495
+ label: this._fieldSelected.label,
496
+ canShowError: false
497
+ };
498
+ switch (field.userInterface) {
499
+ case core.UserInterface.OPTIONSELECTOR:
500
+ field.props = {
501
+ options: (_b = (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.options,
502
+ };
503
+ break;
504
+ case core.UserInterface.LONGTEXT:
505
+ field.rows = 1;
506
+ break;
507
+ case core.UserInterface.SEARCH:
508
+ field.optionLoader = searchArgument => this.setCriteriaSearch(searchArgument, this.application);
509
+ break;
510
+ }
511
+ return field;
512
+ }
513
+ setCriteriaSearch({ mode, argument }, application) {
514
+ var _a, _b;
515
+ if (application == undefined)
516
+ return;
517
+ const searchOptions = {
518
+ showInactives: false
519
+ };
520
+ const options = {
521
+ entity: (_b = (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.ENTITYNAME,
522
+ searchOptions,
523
+ entityDescription: this._fieldSelected.description
524
+ };
525
+ return application.executePreparedSearch(mode, argument, options);
526
+ }
527
+ render() {
528
+ var _a;
529
+ return (index.h(index.Host, null, index.h("div", { class: "dashes" }), index.h("div", { class: "box" }, index.h("div", { class: "box__container" }, index.h("div", { class: "box__container--input-filter" }, index.h("ez-filter-input", Object.assign({ ref: ref => this._elFilterInput = ref, value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `expressionFilterInput_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` })), index.h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), index.h("div", { class: "box__container--input-operator" }, index.h("ez-combo-box", Object.assign({ label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), value: this.expression.operand, canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => { var _a; return this.handleChangeOperator((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, suppressEmptyOption: true }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `comboBoxOperand_${this.expression.fieldName || this.DEFAULT_FIELD_NAME}` }))), index.h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
530
+ index.h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
531
+ this.buildFieldByType()), index.h("div", { class: "box__container--input-value-variable" }, !this._optionNotNull &&
532
+ index.h("ez-check", { ref: ref => this._elValueVariable = ref, value: this.expression.paramVariable, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: utils.CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
533
+ index.h("ez-icon", Object.assign({ class: "box__container--input-value-variable--icon", size: "large", iconName: "settings-inverted" }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: 'iconConfig' }, { title: this.getMessage("snkPersonalizedFilter.info.titleTooltip"), onClick: () => this.openSnkFilterParamConfig() })), index.h("snk-filter-param-config", { ref: (el) => this._elFilterParamConfigRef = el, messagesBuilder: this.messagesBuilder })), index.h("div", { class: "box__container--button-delete" }, index.h("div", { class: "box__container--button-delete--icon" }, index.h("ez-button", { mode: "icon", iconName: "delete", enabled: this.canRemove, label: this.getMessage("snkPersonalizedFilter.info.labelDeleteItem"), onClick: (evt) => this.confirmRemove(evt) })))))));
534
+ }
535
+ static get watchers() { return {
536
+ "expression": ["expressionChanged"]
537
+ }; }
538
+ };
539
+ SnkExpressionItem.style = snkExpressionItemCss;
540
+
541
+ exports.snk_expression_group = SnkExpressionGroup;
542
+ exports.snk_expression_item = SnkExpressionItem;
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-f9e81701.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-9848e09b.js');
8
+ require('./index-c5771aba.js');
9
+ require('./filter-item-type.enum-aa823a00.js');
10
+
11
+ const snkFilterAdvancedModeCss = ".sc-snk-filter-advanced-mode-h{display:block;--snk-personalized-filter--title--color:var(--title--primary, #2B3A54)}.snk-filter-advanced-mode__title.sc-snk-filter-advanced-mode{color:var(--snk-personalized-filter--title--color)}";
12
+
13
+ const SnkFilterAdvancedMode = class {
14
+ constructor(hostRef) {
15
+ index.registerInstance(this, hostRef);
16
+ this.ezExpressionChange = index.createEvent(this, "ezExpressionChange", 7);
17
+ this.filterAssistent = undefined;
18
+ this.application = undefined;
19
+ }
20
+ getMessage(key, params) {
21
+ return this.application.messagesBuilder.getMessage(key, params);
22
+ }
23
+ getWarningMessageComponent() {
24
+ var _a;
25
+ if (core.StringUtils.isEmpty((_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.warningMessage))
26
+ return undefined;
27
+ return (index.h("div", { class: "ez-flex" }, index.h("ez-alert", { alertType: "warn" }, this.filterAssistent.warningMessage)));
28
+ }
29
+ render() {
30
+ var _a;
31
+ return (index.h(index.Host, null, index.h("span", { class: "ez-title ez-title--small ez-padding-bottom--small snk-filter-advanced-mode__title" }, this.getMessage("snkPersonalizedFilter.info.applyExpression")), index.h("ez-text-area", { rows: 9, label: this.getMessage("snkPersonalizedFilter.info.labelExpression"), value: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.expression, onEzChange: (evt) => this.ezExpressionChange.emit(evt.detail) }), this.getWarningMessageComponent()));
32
+ }
33
+ };
34
+ SnkFilterAdvancedMode.style = snkFilterAdvancedModeCss;
35
+
36
+ const snkFilterAssistentModeCss = ".sc-snk-filter-assistent-mode-h{display:flex;flex-direction:column;height:100%;--text-area--font-family:var(--font-pattern, Arial);--text-area__label--floating--top:var(--space--small, 6px);--snk-filter-assistent-mode__container--border-radius:var(--border--radius-medium, 12px);--snk-filter-assistent-mode__container--background:var(--background--medium, #f0f3f7);--snk-filter-assistent-mode__container--margin:var(--space--small, 6px) var(--space--medium, 12px)}.ez-box__container--external.sc-snk-filter-assistent-mode{height:100px;width:100%;overflow-y:auto;background-color:var(--snk-filter-assistent-mode__container--background);border-radius:var(--snk-filter-assistent-mode__container--border-radius)}.ez-box__container--internal.sc-snk-filter-assistent-mode{margin:var(--snk-filter-assistent-mode__container--margin)}.ez-box__container--title.sc-snk-filter-assistent-mode{display:block;user-select:none;font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--title--primary);top:var(--text-area__label--floating--top)}.ez-box__container--expression.sc-snk-filter-assistent-mode{display:block;font-family:var(--text-area--font-family);font-size:var(--text--medium);color:var(--title--primary);top:var(--text-area__label--floating--top)}.snk-personalized-filter__expression-input--line.sc-snk-filter-assistent-mode{width:100%;height:2px;background-color:var(--snk-personalized-filter--background-color-line);margin-top:var(--snk-personalized-filter--margin-line);margin-bottom:var(--snk-personalized-filter--margin-line)}";
37
+
38
+ const SnkFilterAssistentMode = class {
39
+ constructor(hostRef) {
40
+ index.registerInstance(this, hostRef);
41
+ this.ezChangeFilter = index.createEvent(this, "ezChangeFilter", 7);
42
+ this.filterAssistent = undefined;
43
+ this.messagesBuilder = undefined;
44
+ this.filterId = undefined;
45
+ this.entityUri = undefined;
46
+ this.application = undefined;
47
+ }
48
+ getMessage(key, params) {
49
+ return this.application.messagesBuilder.getMessage(key, params);
50
+ }
51
+ async handleFilterGroupChange() {
52
+ const assistent = await this._mainExpressionGroup.getExpressionGroup();
53
+ this.filterAssistent = Object.assign(Object.assign({}, this.filterAssistent), { assistent });
54
+ this.filterAssistent.parameters = PersonalizedFilterUtils.PersonalizedFilterUtils.buildVariableParameters(this.filterAssistent.assistent);
55
+ this.filterAssistent.expression = PersonalizedFilterUtils.PersonalizedFilterUtils.buildGroupExpression(this.filterAssistent.assistent);
56
+ this.ezChangeFilter.emit(this.filterAssistent);
57
+ }
58
+ render() {
59
+ var _a, _b;
60
+ return (index.h(index.Host, null, index.h("div", { class: "ez-padding-top--small snk-personalized-filter__group" }, index.h("snk-expression-group", { ref: (el) => this._mainExpressionGroup = el, group: (_a = this.filterAssistent) === null || _a === void 0 ? void 0 : _a.assistent, messagesBuilder: this.messagesBuilder, onEzFilterGroupChange: this.handleFilterGroupChange.bind(this), filterId: this.filterId, entityURI: this.entityUri })), index.h("div", { class: "ez-margin-top--auto" }, index.h("div", { class: "snk-personalized-filter__expression-input--line" }), index.h("ez-collapsible-box", { label: this.getMessage("snkPersonalizedFilter.info.titleCollapsible"), headerSize: "medium", value: true }, index.h("div", { class: "ez-box" }, index.h("div", { class: "ez-box__container--external" }, index.h("div", { class: "ez-box__container--internal" }, index.h("span", { class: "ez-box__container--title" }, this.getMessage("snkPersonalizedFilter.info.labelExpression")), index.h("span", { class: "ez-box__container--expression" }, (_b = this.filterAssistent) === null || _b === void 0 ? void 0 : _b.expression))))))));
61
+ }
62
+ };
63
+ SnkFilterAssistentMode.style = snkFilterAssistentModeCss;
64
+
65
+ exports.snk_filter_advanced_mode = SnkFilterAdvancedMode;
66
+ exports.snk_filter_assistent_mode = SnkFilterAssistentMode;