@sankhyalabs/sankhyablocks 6.0.6 → 6.0.7

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 (184) hide show
  1. package/dist/cjs/{index-59a3e2de.js → index-102ba62d.js} +1 -1
  2. package/dist/cjs/{index-aaaa2af5.js → index-f9e81701.js} +5 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  5. package/dist/cjs/snk-actions-button.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-attach.cjs.entry.js +3 -3
  9. package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
  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 +3 -3
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  14. package/dist/cjs/{snk-data-unit-53fc9200.js → snk-data-unit-ee7f37a4.js} +1 -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-entity-list.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-expression-group.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-expression-item_3.cjs.entry.js +2 -2
  21. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-filter-bar.cjs.entry.js +11 -5
  23. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +17 -2
  24. package/dist/cjs/snk-filter-detail.cjs.entry.js +21 -6
  25. package/dist/cjs/snk-filter-item.cjs.entry.js +21 -6
  26. package/dist/cjs/snk-filter-list.cjs.entry.js +1 -1
  27. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  28. package/dist/cjs/snk-filter-modal.cjs.entry.js +25 -5
  29. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  30. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  31. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  32. package/dist/cjs/snk-filter-personalized.cjs.entry.js +1 -1
  33. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  34. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  35. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  36. package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
  37. package/dist/cjs/snk-form-view.cjs.entry.js +1 -1
  38. package/dist/cjs/snk-form.cjs.entry.js +1 -1
  39. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  40. package/dist/cjs/snk-grid.cjs.entry.js +4 -4
  41. package/dist/cjs/{snk-guides-viewer-42bc7dcc.js → snk-guides-viewer-597756fe.js} +3 -3
  42. package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -5
  43. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  44. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  45. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  46. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  47. package/dist/cjs/snk-simple-crud.cjs.entry.js +4 -4
  48. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  49. package/dist/cjs/snk-taskbar.cjs.entry.js +3 -3
  50. package/dist/cjs/{taskbar-elements-068aa945.js → taskbar-elements-7f91f4cd.js} +2 -2
  51. package/dist/cjs/{taskbar-processor-6442c585.js → taskbar-processor-8f075fa1.js} +1 -1
  52. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  53. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +6 -0
  54. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +39 -1
  55. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +20 -5
  56. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +20 -5
  57. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +24 -4
  58. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +2 -2
  59. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +14 -0
  60. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +3 -3
  61. package/dist/components/snk-filter-bar2.js +10 -4
  62. package/dist/components/snk-filter-binary-select.js +18 -2
  63. package/dist/components/snk-filter-detail2.js +20 -5
  64. package/dist/components/snk-filter-item2.js +20 -5
  65. package/dist/components/snk-filter-modal-item2.js +1 -1
  66. package/dist/components/snk-filter-modal.js +24 -4
  67. package/dist/esm/{index-8c3d76a6.js → index-a7d3d3f1.js} +5 -0
  68. package/dist/esm/{index-d60ca0ac.js → index-bdf75557.js} +1 -1
  69. package/dist/esm/loader.js +3 -3
  70. package/dist/esm/sankhyablocks.js +3 -3
  71. package/dist/esm/snk-actions-button.entry.js +1 -1
  72. package/dist/esm/snk-actions-form.entry.js +1 -1
  73. package/dist/esm/snk-application.entry.js +1 -1
  74. package/dist/esm/snk-attach.entry.js +3 -3
  75. package/dist/esm/snk-client-confirm.entry.js +1 -1
  76. package/dist/esm/snk-config-options.entry.js +1 -1
  77. package/dist/esm/snk-configurator.entry.js +1 -1
  78. package/dist/esm/snk-crud.entry.js +3 -3
  79. package/dist/esm/snk-data-exporter.entry.js +2 -2
  80. package/dist/esm/{snk-data-unit-97824457.js → snk-data-unit-0cee56d5.js} +1 -1
  81. package/dist/esm/snk-data-unit.entry.js +2 -2
  82. package/dist/esm/snk-detail-view.entry.js +5 -5
  83. package/dist/esm/snk-entity-list.entry.js +1 -1
  84. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  85. package/dist/esm/snk-expression-group.entry.js +1 -1
  86. package/dist/esm/snk-expression-item_3.entry.js +2 -2
  87. package/dist/esm/snk-field-config.entry.js +1 -1
  88. package/dist/esm/snk-filter-bar.entry.js +11 -5
  89. package/dist/esm/snk-filter-binary-select.entry.js +17 -2
  90. package/dist/esm/snk-filter-detail.entry.js +21 -6
  91. package/dist/esm/snk-filter-item.entry.js +21 -6
  92. package/dist/esm/snk-filter-list.entry.js +1 -1
  93. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  94. package/dist/esm/snk-filter-modal.entry.js +25 -5
  95. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  96. package/dist/esm/snk-filter-number.entry.js +1 -1
  97. package/dist/esm/snk-filter-period.entry.js +1 -1
  98. package/dist/esm/snk-filter-personalized.entry.js +1 -1
  99. package/dist/esm/snk-filter-search.entry.js +1 -1
  100. package/dist/esm/snk-filter-text.entry.js +1 -1
  101. package/dist/esm/snk-form-config.entry.js +1 -1
  102. package/dist/esm/snk-form-summary.entry.js +1 -1
  103. package/dist/esm/snk-form-view.entry.js +1 -1
  104. package/dist/esm/snk-form.entry.js +1 -1
  105. package/dist/esm/snk-grid-config.entry.js +1 -1
  106. package/dist/esm/snk-grid.entry.js +4 -4
  107. package/dist/esm/{snk-guides-viewer-cc812f72.js → snk-guides-viewer-79b916a2.js} +3 -3
  108. package/dist/esm/snk-guides-viewer.entry.js +5 -5
  109. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  110. package/dist/esm/snk-pesquisa.entry.js +1 -1
  111. package/dist/esm/snk-select-box.entry.js +1 -1
  112. package/dist/esm/snk-simple-bar.entry.js +1 -1
  113. package/dist/esm/snk-simple-crud.entry.js +4 -4
  114. package/dist/esm/snk-tab-config.entry.js +1 -1
  115. package/dist/esm/snk-taskbar.entry.js +3 -3
  116. package/dist/esm/{taskbar-elements-26d0fba3.js → taskbar-elements-139b1058.js} +2 -2
  117. package/dist/esm/{taskbar-processor-dfef41a8.js → taskbar-processor-db6d14c2.js} +1 -1
  118. package/dist/esm/teste-pesquisa.entry.js +1 -1
  119. package/dist/sankhyablocks/{p-fc512cbe.entry.js → p-01c94bf0.entry.js} +1 -1
  120. package/dist/sankhyablocks/p-0364abc8.entry.js +1 -0
  121. package/dist/sankhyablocks/{p-00d1cac4.entry.js → p-0d670404.entry.js} +1 -1
  122. package/dist/sankhyablocks/{p-b940798f.entry.js → p-118e769b.entry.js} +1 -1
  123. package/dist/sankhyablocks/{p-01cd58b6.entry.js → p-12ddc836.entry.js} +1 -1
  124. package/dist/sankhyablocks/p-18e3a2b7.entry.js +1 -0
  125. package/dist/sankhyablocks/{p-e824aef2.entry.js → p-219f888d.entry.js} +1 -1
  126. package/dist/sankhyablocks/{p-49d628d1.entry.js → p-247a8b36.entry.js} +1 -1
  127. package/dist/sankhyablocks/{p-8ccb7b05.entry.js → p-257e3eaf.entry.js} +1 -1
  128. package/dist/sankhyablocks/{p-7a5e1be7.entry.js → p-26b0ce3e.entry.js} +1 -1
  129. package/dist/sankhyablocks/{p-c17e19a2.entry.js → p-2adb4481.entry.js} +1 -1
  130. package/dist/sankhyablocks/{p-50db4bc4.entry.js → p-33fa83b0.entry.js} +1 -1
  131. package/dist/sankhyablocks/{p-b7efc49a.entry.js → p-4374cc15.entry.js} +1 -1
  132. package/dist/sankhyablocks/{p-d5145c3f.entry.js → p-50c3700f.entry.js} +1 -1
  133. package/dist/sankhyablocks/{p-93935de5.entry.js → p-5cc17d75.entry.js} +1 -1
  134. package/dist/sankhyablocks/{p-590d8900.js → p-6dc031de.js} +1 -1
  135. package/dist/sankhyablocks/{p-87b1e966.js → p-7750112a.js} +1 -1
  136. package/dist/sankhyablocks/p-7abb948f.entry.js +1 -0
  137. package/dist/sankhyablocks/{p-6bfa008e.entry.js → p-838f8234.entry.js} +1 -1
  138. package/dist/sankhyablocks/{p-cf90a195.entry.js → p-88aa931b.entry.js} +1 -1
  139. package/dist/sankhyablocks/{p-a8b06801.entry.js → p-9531fd46.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-847b9506.entry.js → p-959e0835.entry.js} +1 -1
  141. package/dist/sankhyablocks/{p-718cc24b.entry.js → p-96a89d58.entry.js} +1 -1
  142. package/dist/sankhyablocks/{p-9f844aa6.entry.js → p-9c853418.entry.js} +1 -1
  143. package/dist/sankhyablocks/{p-ebb8de34.entry.js → p-a149ccee.entry.js} +1 -1
  144. package/dist/sankhyablocks/{p-5427566a.entry.js → p-a1e1b305.entry.js} +1 -1
  145. package/dist/sankhyablocks/p-abc4ae66.entry.js +1 -0
  146. package/dist/sankhyablocks/{p-a655ea15.entry.js → p-ac8d1cd6.entry.js} +1 -1
  147. package/dist/sankhyablocks/{p-c6b9a617.entry.js → p-ad69e220.entry.js} +1 -1
  148. package/dist/sankhyablocks/{p-c0c4a305.entry.js → p-befbc9ee.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-c0cded7d.entry.js +1 -0
  150. package/dist/sankhyablocks/p-c651abc7.js +1 -0
  151. package/dist/sankhyablocks/{p-fced1d89.entry.js → p-cb37982f.entry.js} +1 -1
  152. package/dist/sankhyablocks/{p-708ee8ee.js → p-cd0e4f0d.js} +1 -1
  153. package/dist/sankhyablocks/{p-5a612ab1.entry.js → p-cdbaf62d.entry.js} +1 -1
  154. package/dist/sankhyablocks/{p-04611c09.entry.js → p-cea58f8b.entry.js} +1 -1
  155. package/dist/sankhyablocks/{p-066ee142.js → p-d2d301a6.js} +1 -1
  156. package/dist/sankhyablocks/{p-1a5d1f61.entry.js → p-d2f7dbd8.entry.js} +1 -1
  157. package/dist/sankhyablocks/{p-c772178d.entry.js → p-d3ec3586.entry.js} +1 -1
  158. package/dist/sankhyablocks/{p-6d4169fc.entry.js → p-de69b4b0.entry.js} +1 -1
  159. package/dist/sankhyablocks/{p-253a0498.entry.js → p-e20bf314.entry.js} +1 -1
  160. package/dist/sankhyablocks/{p-67a19b48.entry.js → p-e3a82e1c.entry.js} +1 -1
  161. package/dist/sankhyablocks/p-e962ce72.entry.js +1 -0
  162. package/dist/sankhyablocks/p-eb636e15.entry.js +1 -0
  163. package/dist/sankhyablocks/{p-a49af638.entry.js → p-f07f2c6f.entry.js} +1 -1
  164. package/dist/sankhyablocks/{p-69770075.js → p-f1edaec0.js} +1 -1
  165. package/dist/sankhyablocks/{p-10e0346a.entry.js → p-f30526a7.entry.js} +1 -1
  166. package/dist/sankhyablocks/{p-8d541539.entry.js → p-f827514f.entry.js} +1 -1
  167. package/dist/sankhyablocks/{p-4e5d1ae3.entry.js → p-f8c2efc5.entry.js} +1 -1
  168. package/dist/sankhyablocks/{p-eb24c092.entry.js → p-fe49067d.entry.js} +1 -1
  169. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  170. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +7 -0
  171. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
  172. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
  173. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +1 -0
  174. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +1 -1
  175. package/dist/types/components.d.ts +4 -0
  176. package/package.json +3 -3
  177. package/dist/sankhyablocks/p-09a058ba.entry.js +0 -1
  178. package/dist/sankhyablocks/p-18b34bb4.js +0 -1
  179. package/dist/sankhyablocks/p-34cd4b39.entry.js +0 -1
  180. package/dist/sankhyablocks/p-372e0185.entry.js +0 -1
  181. package/dist/sankhyablocks/p-6c6e936c.entry.js +0 -1
  182. package/dist/sankhyablocks/p-710d9b6f.entry.js +0 -1
  183. package/dist/sankhyablocks/p-bdd61fa8.entry.js +0 -1
  184. package/dist/sankhyablocks/p-fb22ed2d.entry.js +0 -1
@@ -62,7 +62,9 @@ export class SnkFilterDetail {
62
62
  return { tag: "snk-filter-text" };
63
63
  }
64
64
  removeItem() {
65
- const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined });
65
+ const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
66
+ const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
67
+ const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: newValue });
66
68
  if (removedConfig.groupedItems != undefined) {
67
69
  removedConfig.groupedItems = removedConfig.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined })));
68
70
  }
@@ -81,12 +83,19 @@ export class SnkFilterDetail {
81
83
  buttonElement.removeAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
82
84
  ElementIDUtils.addIDInfoIfNotExists(buttonElement, "button", dataElement);
83
85
  }
86
+ clearBinarySelectValues() {
87
+ var _a;
88
+ const editor = this._editor || {};
89
+ (_a = editor.resetValues) === null || _a === void 0 ? void 0 : _a.call(editor);
90
+ this.config = ObjectUtils.copy(this.originalConfig);
91
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
92
+ }
84
93
  apply() {
85
94
  const isValid = PersonalizedFilterUtils.validateVariableValues(this.config, this._editor["value"]);
86
95
  if (!isValid) {
87
96
  return ApplicationUtils.alert(this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.title'), this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.message'));
88
97
  }
89
- const valuesArray = this._editor["value"] || this.config.value;
98
+ const valuesArray = this._editor["value"] !== undefined ? this._editor["value"] : this.config.value;
90
99
  this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: this.isVisible(), value: valuesArray }));
91
100
  }
92
101
  isVisible() {
@@ -97,14 +106,17 @@ export class SnkFilterDetail {
97
106
  }
98
107
  clear() {
99
108
  var _a;
109
+ if (this.config.type === FilterItemType.BINARY_SELECT) {
110
+ this.clearBinarySelectValues();
111
+ return;
112
+ }
100
113
  if (FilterItemType.MULTI_LIST === this.config.type) {
101
114
  const configCopy = ObjectUtils.copy(this.config);
102
115
  (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.forEach(value => !!value && (value.check = false));
103
116
  this.config = ObjectUtils.copy(configCopy);
117
+ return;
104
118
  }
105
- else {
106
- this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
107
- }
119
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
108
120
  }
109
121
  filterCanBeCleared() {
110
122
  return this.config.type !== FilterItemType.PERSONALIZED;
@@ -134,6 +146,9 @@ export class SnkFilterDetail {
134
146
  this.config = newConfig;
135
147
  });
136
148
  }
149
+ componentWillLoad() {
150
+ this.originalConfig = ObjectUtils.copy(this.config);
151
+ }
137
152
  render() {
138
153
  const { tag: CustomElement, props } = this.getContentEditor();
139
154
  return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, onSaveConfig: evt => this.saveConfig(evt.detail), rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
@@ -64,6 +64,17 @@ export class SnkFilterItem {
64
64
  window.removeEventListener("scroll", this.updatePosition.bind(this));
65
65
  window.addEventListener("scroll", this.updatePosition.bind(this));
66
66
  }
67
+ getConfigChanges() {
68
+ var _a;
69
+ const configToBeCleared = this.config;
70
+ if (!!((_a = configToBeCleared.groupedItems) === null || _a === void 0 ? void 0 : _a.length)) {
71
+ configToBeCleared.visible = false;
72
+ configToBeCleared.groupedItems = configToBeCleared.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false })));
73
+ }
74
+ const hasMultiValues = configToBeCleared.type === FilterItemType.MULTI_LIST && Array.isArray(configToBeCleared.value);
75
+ const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
76
+ return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
77
+ }
67
78
  /**
68
79
  * Oculta os detalhes de um item da lista.
69
80
  */
@@ -87,8 +98,9 @@ export class SnkFilterItem {
87
98
  //---------------------------------------------
88
99
  clickListener(evt) {
89
100
  if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
90
- if (evt.target === this._rightIconElement && this.config.value != undefined) {
91
- this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
101
+ if (evt.target === this._rightIconElement && this.canClearFilter()) {
102
+ const configChanged = this.getConfigChanges();
103
+ this.filterChange.emit(configChanged);
92
104
  }
93
105
  else {
94
106
  if (this.detailIsVisible) {
@@ -223,10 +235,13 @@ export class SnkFilterItem {
223
235
  filterChangeListener() {
224
236
  this.hideDetail();
225
237
  }
238
+ canClearFilter() {
239
+ const { value, groupedItems = [] } = this.config;
240
+ return value !== undefined || groupedItems.some(item => item.visible);
241
+ }
226
242
  getRightIconName() {
227
- if (this.config.value != undefined) {
243
+ if (this.canClearFilter())
228
244
  return "close";
229
- }
230
245
  return this.detailIsVisible ? "chevron-up" : "chevron-down";
231
246
  }
232
247
  getLeftIconName() {
@@ -248,7 +263,7 @@ export class SnkFilterItem {
248
263
  }
249
264
  render() {
250
265
  const leftIcon = this.getLeftIconName();
251
- return (h(Host, Object.assign({}, this.applyTooltip()), h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
266
+ return (h(Host, null, h("ez-chip", Object.assign({ id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip(), showNativeTooltip: false }, this.applyTooltip()), leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
252
267
  }
253
268
  static get is() { return "snk-filter-item"; }
254
269
  static get properties() {
@@ -21,12 +21,32 @@ export class SnkFilterModal {
21
21
  }
22
22
  //TODO: tratar clear all dos filtros personalizados
23
23
  handleClearAll() {
24
- const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
25
- const customFilters = this.filters.filter(filter => filter.filterType === FilterType.CUSTOM_FILTER);
26
- const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
24
+ const { customFilters, quickFilters, otherFilters, multiListFilters } = this.filters.reduce((acc, filter) => {
25
+ if (filter.type === FilterItemType.MULTI_LIST) {
26
+ acc.multiListFilters.push(filter);
27
+ return acc;
28
+ }
29
+ if (filter.filterType === FilterType.QUICK_FILTER) {
30
+ acc.quickFilters.push(filter);
31
+ return acc;
32
+ }
33
+ if (filter.filterType === FilterType.CUSTOM_FILTER) {
34
+ acc.customFilters.push(filter);
35
+ return acc;
36
+ }
37
+ if (filter.filterType === FilterType.OTHER_FILTERS) {
38
+ acc.otherFilters.push(filter);
39
+ return acc;
40
+ }
41
+ return acc;
42
+ }, { quickFilters: [], customFilters: [], otherFilters: [], multiListFilters: [] });
27
43
  this.handleClearFilterList(quickFilters);
28
44
  this.handleClearCustomFilters(customFilters);
29
- otherFilters.forEach(this.handleClearSigleFilter.bind(this));
45
+ this.handleClearOthersFilters(otherFilters);
46
+ multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
47
+ }
48
+ handleClearOthersFilters(otherFilters) {
49
+ this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
30
50
  }
31
51
  handleClearCustomFilters(customFilters) {
32
52
  this.filters.forEach((filter, index) => {
@@ -1,6 +1,6 @@
1
1
  import { h, Host } from '@stencil/core';
2
2
  import { ApplicationContext, ElementIDUtils, ObjectUtils } from '@sankhyalabs/core';
3
- import FilterItemType from "../../filter-item/filter-item-type.enum";
3
+ import FilterItemType from '../../filter-item/filter-item-type.enum';
4
4
  import { EPresentationMode } from '../../filter-item/editors/enum/presentationMode';
5
5
  import { ConfigStorage } from '../../../../lib/configs/ConfigStorage';
6
6
  import FilterType from '../../types/filter-type.enum';
@@ -53,7 +53,7 @@ export class SnkFilterModalItem {
53
53
  this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
54
54
  }
55
55
  else {
56
- this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: newValue, visible: this.isVisible(newValue) });
56
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
57
57
  }
58
58
  this.saveConfig();
59
59
  }
@@ -77,6 +77,20 @@
77
77
  margin-bottom: var(--space--small);
78
78
  }
79
79
 
80
+ .snk-filter-bar__scroller {
81
+ height: calc(100% + var(--space-extra-small, 3px));
82
+ }
83
+
84
+ .snk-filter-bar__filter-item-container {
85
+ display: flex;
86
+ align-self: center;
87
+ }
88
+
89
+ .snk-filter-bar__scroller :first-child {
90
+ margin-left: var(--space-extra-small, 3px);
91
+ }
92
+
93
+
80
94
  .snk-filter-bar__filter-list-items-container{
81
95
  overflow-y: auto;
82
96
  max-height: 360px;
@@ -140,7 +140,7 @@ export class SnkFilterBar {
140
140
  if (item.type === FilterItemType.DEFAULT_FILTER) {
141
141
  return true;
142
142
  }
143
- return item.visible && (item.groupedItems || item.value != undefined);
143
+ return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
144
144
  }
145
145
  registryFilterProvider() {
146
146
  this.dataUnit.addFilterProvider(this);
@@ -171,7 +171,7 @@ export class SnkFilterBar {
171
171
  .forEach((item, index) => {
172
172
  item = ObjectUtils.copy(item);
173
173
  const itemId = `filter-${item.id}`;
174
- const filterItem = (h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
174
+ const filterItem = (h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
175
175
  if (item.fixed || item.hardFixed) {
176
176
  pinnedItems.push(filterItem);
177
177
  }
@@ -319,7 +319,7 @@ export class SnkFilterBar {
319
319
  if (this.showPersonalizedFilter) {
320
320
  return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName });
321
321
  }
322
- return h(Host, null, h("ez-scroller", { direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, this.getFilterItems()), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" })));
322
+ return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
323
323
  }
324
324
  static get is() { return "snk-filter-bar"; }
325
325
  static get encapsulation() { return "scoped"; }
@@ -22,6 +22,8 @@ const buildFilter = (item) => {
22
22
  return buildDefault(item);
23
23
  case FilterItemType.BINARY_SELECT:
24
24
  return buildBinary(item);
25
+ case FilterItemType.MULTI_SELECT:
26
+ return buildMultSelect(item);
25
27
  case FilterItemType.MULTI_LIST:
26
28
  return buildMultiList(item);
27
29
  case FilterItemType.PERIOD:
@@ -47,6 +49,10 @@ function buildBinary(item) {
47
49
  const selectedOption = options.find(opt => opt.name === value);
48
50
  return { name: id, expression: selectedOption.expression, params: [] };
49
51
  }
52
+ function buildMultSelect(item) {
53
+ const { id, value, props } = item;
54
+ return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
55
+ }
50
56
  function buildMultiList(item) {
51
57
  const { id, value, props } = item;
52
58
  const parsedValues = parseMultiListValues(value);
@@ -175,7 +181,7 @@ class SnkFilterModalFactory {
175
181
  }
176
182
  }
177
183
 
178
- const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--more-visible, 2);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--most-visible, 3);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
184
+ const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--more-visible, 2);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.filter-bar__personalized-filter.sc-snk-filter-bar{display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;overflow:auto;z-index:var(--snk-personalized-filter--z-index);background-color:var(--snk-personalized-filter--background-color)}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--most-visible, 3);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__scroller.sc-snk-filter-bar{height:calc(100% + var(--space-extra-small, 3px))}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-self:center}.snk-filter-bar__scroller.sc-snk-filter-bar .sc-snk-filter-bar:first-child{margin-left:var(--space-extra-small, 3px)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
179
185
 
180
186
  const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
181
187
  constructor() {
@@ -313,7 +319,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
313
319
  if (item.type === FilterItemType.DEFAULT_FILTER) {
314
320
  return true;
315
321
  }
316
- return item.visible && (item.groupedItems || item.value != undefined);
322
+ return this.filterActiveFilter(item) && (item.groupedItems || item.value != undefined);
317
323
  }
318
324
  registryFilterProvider() {
319
325
  this.dataUnit.addFilterProvider(this);
@@ -344,7 +350,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
344
350
  .forEach((item, index) => {
345
351
  item = ObjectUtils.copy(item);
346
352
  const itemId = `filter-${item.id}`;
347
- const filterItem = (h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
353
+ const filterItem = (h("snk-filter-item", { onVisibleChanged: (evt) => this.scrollerLocked = evt.detail, onFilterChange: (event) => this.updateFilter(event.detail), onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
348
354
  if (item.fixed || item.hardFixed) {
349
355
  pinnedItems.push(filterItem);
350
356
  }
@@ -492,7 +498,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
492
498
  if (this.showPersonalizedFilter) {
493
499
  return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.hidePersonalizedFilter(), entityUri: this.dataUnit.name, configName: this.configName });
494
500
  }
495
- return h(Host, null, h("ez-scroller", { direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, this.getFilterItems()), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" })));
501
+ return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
496
502
  }
497
503
  get _element() { return this; }
498
504
  static get watchers() { return {
@@ -31,6 +31,12 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
31
31
  this.value = evt.detail === this._noOptionValue ? undefined : evt.detail;
32
32
  this._radioButtonValue = evt.detail;
33
33
  }
34
+ /**
35
+ * Redefine os valores padrão do componente.
36
+ */
37
+ async resetValues() {
38
+ this.ezChangeListener({ detail: this._noOptionValue });
39
+ }
34
40
  assertCheckedOption(updatingCheck) {
35
41
  if (updatingCheck === this._checkOne) {
36
42
  this._checkTwo.value = true;
@@ -49,13 +55,22 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
49
55
  }
50
56
  this.valueChanged.emit(this.value);
51
57
  }
58
+ setRadioValue() {
59
+ this._radioButtonValue = this.value || this._noOptionValue;
60
+ }
52
61
  componentDidLoad() {
53
62
  if (this._element) {
54
63
  ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
55
64
  }
56
65
  }
57
66
  componentWillLoad() {
58
- this._radioButtonValue = this.value || this._noOptionValue;
67
+ this.setRadioValue();
68
+ }
69
+ componentShouldUpdate() {
70
+ this.setRadioValue();
71
+ }
72
+ disconnectedCallback() {
73
+ this.value = this.config.value;
59
74
  }
60
75
  render() {
61
76
  if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
@@ -71,7 +86,8 @@ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends H
71
86
  }, [0, "snk-filter-binary-select", {
72
87
  "value": [1544],
73
88
  "config": [16],
74
- "presentationMode": [2, "presentation-mode"]
89
+ "presentationMode": [2, "presentation-mode"],
90
+ "resetValues": [64]
75
91
  }, [[0, "ezChange", "ezChangeListener"]]]);
76
92
  function defineCustomElement$1() {
77
93
  if (typeof customElements === "undefined") {
@@ -66,7 +66,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
66
66
  return { tag: "snk-filter-text" };
67
67
  }
68
68
  removeItem() {
69
- const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined });
69
+ const hasMultiValues = this.config.type === FilterItemType.MULTI_LIST && Array.isArray(this.config.value);
70
+ const newValue = hasMultiValues ? this.config.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
71
+ const removedConfig = Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: newValue });
70
72
  if (removedConfig.groupedItems != undefined) {
71
73
  removedConfig.groupedItems = removedConfig.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false, fixed: false, value: undefined })));
72
74
  }
@@ -85,12 +87,19 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
85
87
  buttonElement.removeAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
86
88
  ElementIDUtils.addIDInfoIfNotExists(buttonElement, "button", dataElement);
87
89
  }
90
+ clearBinarySelectValues() {
91
+ var _a;
92
+ const editor = this._editor || {};
93
+ (_a = editor.resetValues) === null || _a === void 0 ? void 0 : _a.call(editor);
94
+ this.config = ObjectUtils.copy(this.originalConfig);
95
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
96
+ }
88
97
  apply() {
89
98
  const isValid = PersonalizedFilterUtils.validateVariableValues(this.config, this._editor["value"]);
90
99
  if (!isValid) {
91
100
  return ApplicationUtils.alert(this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.title'), this.getMessage('snkFilterBar.filterModal.validations.notFullFilled.message'));
92
101
  }
93
- const valuesArray = this._editor["value"] || this.config.value;
102
+ const valuesArray = this._editor["value"] !== undefined ? this._editor["value"] : this.config.value;
94
103
  this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: this.isVisible(), value: valuesArray }));
95
104
  }
96
105
  isVisible() {
@@ -101,14 +110,17 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
101
110
  }
102
111
  clear() {
103
112
  var _a;
113
+ if (this.config.type === FilterItemType.BINARY_SELECT) {
114
+ this.clearBinarySelectValues();
115
+ return;
116
+ }
104
117
  if (FilterItemType.MULTI_LIST === this.config.type) {
105
118
  const configCopy = ObjectUtils.copy(this.config);
106
119
  (_a = configCopy.value) === null || _a === void 0 ? void 0 : _a.forEach(value => !!value && (value.check = false));
107
120
  this.config = ObjectUtils.copy(configCopy);
121
+ return;
108
122
  }
109
- else {
110
- this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
111
- }
123
+ this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
112
124
  }
113
125
  filterCanBeCleared() {
114
126
  return this.config.type !== FilterItemType.PERSONALIZED;
@@ -138,6 +150,9 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
138
150
  this.config = newConfig;
139
151
  });
140
152
  }
153
+ componentWillLoad() {
154
+ this.originalConfig = ObjectUtils.copy(this.config);
155
+ }
141
156
  render() {
142
157
  const { tag: CustomElement, props } = this.getContentEditor();
143
158
  return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(CustomElement, Object.assign({ maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, onSaveConfig: evt => this.saveConfig(evt.detail), rightListSlotBuilder: item => this.buildRightSlot(item) }, props)), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, this.filterCanBeCleared() && (h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" })), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
@@ -70,6 +70,17 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
70
70
  window.removeEventListener("scroll", this.updatePosition.bind(this));
71
71
  window.addEventListener("scroll", this.updatePosition.bind(this));
72
72
  }
73
+ getConfigChanges() {
74
+ var _a;
75
+ const configToBeCleared = this.config;
76
+ if (!!((_a = configToBeCleared.groupedItems) === null || _a === void 0 ? void 0 : _a.length)) {
77
+ configToBeCleared.visible = false;
78
+ configToBeCleared.groupedItems = configToBeCleared.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false })));
79
+ }
80
+ const hasMultiValues = configToBeCleared.type === FilterItemType.MULTI_LIST && Array.isArray(configToBeCleared.value);
81
+ const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
82
+ return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
83
+ }
73
84
  /**
74
85
  * Oculta os detalhes de um item da lista.
75
86
  */
@@ -93,8 +104,9 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
93
104
  //---------------------------------------------
94
105
  clickListener(evt) {
95
106
  if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
96
- if (evt.target === this._rightIconElement && this.config.value != undefined) {
97
- this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
107
+ if (evt.target === this._rightIconElement && this.canClearFilter()) {
108
+ const configChanged = this.getConfigChanges();
109
+ this.filterChange.emit(configChanged);
98
110
  }
99
111
  else {
100
112
  if (this.detailIsVisible) {
@@ -229,10 +241,13 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
229
241
  filterChangeListener() {
230
242
  this.hideDetail();
231
243
  }
244
+ canClearFilter() {
245
+ const { value, groupedItems = [] } = this.config;
246
+ return value !== undefined || groupedItems.some(item => item.visible);
247
+ }
232
248
  getRightIconName() {
233
- if (this.config.value != undefined) {
249
+ if (this.canClearFilter())
234
250
  return "close";
235
- }
236
251
  return this.detailIsVisible ? "chevron-up" : "chevron-down";
237
252
  }
238
253
  getLeftIconName() {
@@ -254,7 +269,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
254
269
  }
255
270
  render() {
256
271
  const leftIcon = this.getLeftIconName();
257
- return (h(Host, Object.assign({}, this.applyTooltip()), h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
272
+ return (h(Host, null, h("ez-chip", Object.assign({ id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip(), showNativeTooltip: false }, this.applyTooltip()), leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
258
273
  }
259
274
  get _filterItemElement() { return this; }
260
275
  static get watchers() { return {
@@ -68,7 +68,7 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
68
68
  this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
69
69
  }
70
70
  else {
71
- this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: newValue, visible: this.isVisible(newValue) });
71
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
72
72
  }
73
73
  this.saveConfig();
74
74
  }
@@ -26,12 +26,32 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
26
26
  }
27
27
  //TODO: tratar clear all dos filtros personalizados
28
28
  handleClearAll() {
29
- const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
30
- const customFilters = this.filters.filter(filter => filter.filterType === FilterType.CUSTOM_FILTER);
31
- const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
29
+ const { customFilters, quickFilters, otherFilters, multiListFilters } = this.filters.reduce((acc, filter) => {
30
+ if (filter.type === FilterItemType.MULTI_LIST) {
31
+ acc.multiListFilters.push(filter);
32
+ return acc;
33
+ }
34
+ if (filter.filterType === FilterType.QUICK_FILTER) {
35
+ acc.quickFilters.push(filter);
36
+ return acc;
37
+ }
38
+ if (filter.filterType === FilterType.CUSTOM_FILTER) {
39
+ acc.customFilters.push(filter);
40
+ return acc;
41
+ }
42
+ if (filter.filterType === FilterType.OTHER_FILTERS) {
43
+ acc.otherFilters.push(filter);
44
+ return acc;
45
+ }
46
+ return acc;
47
+ }, { quickFilters: [], customFilters: [], otherFilters: [], multiListFilters: [] });
32
48
  this.handleClearFilterList(quickFilters);
33
49
  this.handleClearCustomFilters(customFilters);
34
- otherFilters.forEach(this.handleClearSigleFilter.bind(this));
50
+ this.handleClearOthersFilters(otherFilters);
51
+ multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
52
+ }
53
+ handleClearOthersFilters(otherFilters) {
54
+ this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
35
55
  }
36
56
  handleClearCustomFilters(customFilters) {
37
57
  this.filters.forEach((filter, index) => {
@@ -1547,6 +1547,11 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1547
1547
  }
1548
1548
  }
1549
1549
  if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1550
+ if (instance.componentShouldUpdate) {
1551
+ if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1552
+ return;
1553
+ }
1554
+ }
1550
1555
  // looks like this value actually changed, so we've got work to do!
1551
1556
  // but only if we've already rendered, otherwise just chill out
1552
1557
  // queue that we need to do an update, but don't worry about queuing
@@ -1,4 +1,4 @@
1
- import { a as getRenderingRef, f as forceUpdate } from './index-8c3d76a6.js';
1
+ import { a as getRenderingRef, f as forceUpdate } from './index-a7d3d3f1.js';
2
2
 
3
3
  const appendToMap = (map, propName, value) => {
4
4
  const items = map.get(propName);