@sankhyalabs/sankhyablocks 9.2.0-dev.17 → 9.2.0-dev.19

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 (189) hide show
  1. package/dist/cjs/{ConfigStorage-0ebc800f.js → ConfigStorage-52c38bb9.js} +2 -2
  2. package/dist/cjs/{DataFetcher-602cdc72.js → DataFetcher-9af55840.js} +15 -0
  3. package/dist/cjs/{ISave-18205d86.js → ISave-c4918000.js} +1 -1
  4. package/dist/cjs/{SnkFormConfigManager-4b651537.js → SnkFormConfigManager-cef663d1.js} +2 -2
  5. package/dist/cjs/{ClientSideExporterProvider-bb0b2273.js → SnkMultiSelectionListDataSource-58ded10c.js} +78 -78
  6. package/dist/cjs/{auth-fetcher-82317d4d.js → auth-fetcher-a3a3bb16.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-93077a2f.js → dataunit-fetcher-ae454648.js} +1 -1
  8. package/dist/cjs/filter-validate-6993f6f2.js +30 -0
  9. package/dist/cjs/{form-config-fetcher-05d210e7.js → form-config-fetcher-d7bb4f41.js} +1 -1
  10. package/dist/cjs/index-1cf293c1.js +8 -8
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
  13. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  14. package/dist/cjs/snk-actions-button_8.cjs.entry.js +5 -5
  15. package/dist/cjs/snk-application.cjs.entry.js +6 -6
  16. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  19. package/dist/cjs/{snk-data-unit-28d629e4.js → snk-data-unit-a59a7ade.js} +2 -2
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  22. package/dist/cjs/snk-entity-list.cjs.entry.js +10 -3
  23. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +164 -100
  24. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +23 -2
  25. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +20 -2
  26. package/dist/cjs/snk-filter-detail.cjs.entry.js +25 -8
  27. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +9 -14
  28. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +16 -3
  29. package/dist/cjs/snk-filter-number.cjs.entry.js +34 -3
  30. package/dist/cjs/snk-filter-period.cjs.entry.js +59 -14
  31. package/dist/cjs/snk-filter-search.cjs.entry.js +14 -3
  32. package/dist/cjs/snk-filter-text.cjs.entry.js +18 -1
  33. package/dist/cjs/snk-form_2.cjs.entry.js +4 -4
  34. package/dist/cjs/snk-grid.cjs.entry.js +38 -21
  35. package/dist/cjs/{snk-guides-viewer-73d40f42.js → snk-guides-viewer-e7c08c71.js} +5 -5
  36. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  37. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  38. package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
  39. package/dist/cjs/snk-simple-crud.cjs.entry.js +13 -13
  40. package/dist/collection/components/snk-entity-list/snk-entity-list.js +28 -4
  41. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +72 -2
  42. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +73 -2
  43. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +51 -5
  44. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +83 -3
  45. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +118 -27
  46. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +49 -5
  47. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +71 -1
  48. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +62 -11
  49. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +70 -8
  50. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +0 -4
  51. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +112 -16
  52. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +8 -16
  53. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +106 -52
  54. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +3 -1
  55. package/dist/collection/components/snk-filter-bar/utils/filter-validate.js +24 -0
  56. package/dist/collection/components/snk-grid/snk-grid.js +89 -11
  57. package/dist/collection/lib/message/resources/en-us/snk-filter-bar.msg.js +1 -0
  58. package/dist/collection/lib/message/resources/en-us/snk-grid.msg.js +4 -0
  59. package/dist/collection/lib/message/resources/es-es/snk-filter-bar.msg.js +1 -0
  60. package/dist/collection/lib/message/resources/es-es/snk-grid.msg.js +4 -0
  61. package/dist/collection/lib/message/resources/pt-br/snk-filter-bar.msg.js +1 -0
  62. package/dist/collection/lib/message/resources/pt-br/snk-grid.msg.js +4 -0
  63. package/dist/components/DataFetcher.js +15 -0
  64. package/dist/components/snk-crud.js +62 -44
  65. package/dist/components/snk-detail-view2.js +89 -56
  66. package/dist/components/snk-entity-list.js +11 -3
  67. package/dist/components/snk-filter-bar2.js +77 -93
  68. package/dist/components/snk-filter-binary-select.js +27 -3
  69. package/dist/components/snk-filter-checkbox-list.js +24 -3
  70. package/dist/components/snk-filter-detail2.js +28 -9
  71. package/dist/components/snk-filter-item2.js +70 -8
  72. package/dist/components/snk-filter-modal-item2.js +7 -12
  73. package/dist/components/snk-filter-modal.js +1 -325
  74. package/dist/components/snk-filter-modal2.js +391 -0
  75. package/dist/components/snk-filter-multi-select.js +19 -4
  76. package/dist/components/snk-filter-number.js +38 -4
  77. package/dist/components/snk-filter-period.js +64 -16
  78. package/dist/components/snk-filter-search.js +17 -4
  79. package/dist/components/snk-filter-text.js +22 -2
  80. package/dist/components/snk-grid2.js +65 -29
  81. package/dist/esm/{ConfigStorage-fc4e3a42.js → ConfigStorage-1e758486.js} +2 -2
  82. package/dist/esm/{DataFetcher-01ce1a4f.js → DataFetcher-2f7ba7ae.js} +15 -0
  83. package/dist/esm/{ISave-d36bade4.js → ISave-4c9742c1.js} +1 -1
  84. package/dist/esm/{SnkFormConfigManager-71dae34e.js → SnkFormConfigManager-d7031fcb.js} +2 -2
  85. package/dist/esm/{ClientSideExporterProvider-21a99af1.js → SnkMultiSelectionListDataSource-eace25fd.js} +83 -83
  86. package/dist/esm/{auth-fetcher-2e565c35.js → auth-fetcher-d8169b9c.js} +1 -1
  87. package/dist/esm/{dataunit-fetcher-14ba162b.js → dataunit-fetcher-1f7a73df.js} +1 -1
  88. package/dist/esm/filter-validate-d765d450.js +27 -0
  89. package/dist/esm/{form-config-fetcher-a1ccc944.js → form-config-fetcher-eb03ac08.js} +1 -1
  90. package/dist/esm/index-479e1293.js +8 -8
  91. package/dist/esm/loader.js +1 -1
  92. package/dist/esm/pesquisa-grid_2.entry.js +4 -4
  93. package/dist/esm/sankhyablocks.js +1 -1
  94. package/dist/esm/snk-actions-button_8.entry.js +5 -5
  95. package/dist/esm/snk-application.entry.js +6 -6
  96. package/dist/esm/snk-attach.entry.js +5 -5
  97. package/dist/esm/snk-crud.entry.js +5 -5
  98. package/dist/esm/snk-data-exporter.entry.js +5 -5
  99. package/dist/esm/{snk-data-unit-3977725e.js → snk-data-unit-a94dd52a.js} +2 -2
  100. package/dist/esm/snk-data-unit.entry.js +3 -3
  101. package/dist/esm/snk-detail-view.entry.js +7 -7
  102. package/dist/esm/snk-entity-list.entry.js +10 -3
  103. package/dist/esm/snk-filter-bar_4.entry.js +165 -101
  104. package/dist/esm/snk-filter-binary-select.entry.js +23 -2
  105. package/dist/esm/snk-filter-checkbox-list.entry.js +20 -2
  106. package/dist/esm/snk-filter-detail.entry.js +25 -8
  107. package/dist/esm/snk-filter-modal-item.entry.js +9 -14
  108. package/dist/esm/snk-filter-multi-select.entry.js +16 -3
  109. package/dist/esm/snk-filter-number.entry.js +34 -3
  110. package/dist/esm/snk-filter-period.entry.js +59 -14
  111. package/dist/esm/snk-filter-search.entry.js +14 -3
  112. package/dist/esm/snk-filter-text.entry.js +18 -1
  113. package/dist/esm/snk-form_2.entry.js +4 -4
  114. package/dist/esm/snk-grid.entry.js +31 -14
  115. package/dist/esm/{snk-guides-viewer-f800c9aa.js → snk-guides-viewer-e716659f.js} +5 -5
  116. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  117. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  118. package/dist/esm/snk-pesquisa.entry.js +4 -4
  119. package/dist/esm/snk-simple-crud.entry.js +8 -8
  120. package/dist/sankhyablocks/p-093f58fa.entry.js +1 -0
  121. package/dist/sankhyablocks/{p-e63cc25f.js → p-0dc071de.js} +1 -1
  122. package/dist/sankhyablocks/{p-f4bf0517.entry.js → p-0f6f2a84.entry.js} +1 -1
  123. package/dist/sankhyablocks/{p-2b2c2718.js → p-1129ded7.js} +1 -1
  124. package/dist/sankhyablocks/p-12cba660.entry.js +1 -0
  125. package/dist/sankhyablocks/{p-51209229.js → p-12db5588.js} +1 -1
  126. package/dist/sankhyablocks/{p-65517fcf.js → p-3d4a3965.js} +1 -1
  127. package/dist/sankhyablocks/p-3ed04f0d.entry.js +1 -0
  128. package/dist/sankhyablocks/{p-b6b42620.entry.js → p-4033a6e3.entry.js} +1 -1
  129. package/dist/sankhyablocks/p-49ddc27a.entry.js +1 -0
  130. package/dist/sankhyablocks/{p-c3eea705.entry.js → p-4a42d004.entry.js} +1 -1
  131. package/dist/sankhyablocks/p-4c763b10.entry.js +1 -0
  132. package/dist/sankhyablocks/p-4eeb06fc.js +1 -0
  133. package/dist/sankhyablocks/{p-dc8bb41f.js → p-552bdfdc.js} +1 -1
  134. package/dist/sankhyablocks/{p-3cdfd7fb.js → p-66e6569e.js} +1 -1
  135. package/dist/sankhyablocks/p-6909c146.entry.js +1 -0
  136. package/dist/sankhyablocks/p-69d0afa4.js +1 -0
  137. package/dist/sankhyablocks/{p-c3bab5f4.js → p-75b80a92.js} +1 -1
  138. package/dist/sankhyablocks/p-7f7fe6c4.entry.js +1 -0
  139. package/dist/sankhyablocks/{p-e5571279.entry.js → p-86009ea5.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-7b97f9af.entry.js → p-864066bb.entry.js} +1 -1
  141. package/dist/sankhyablocks/p-96d45943.entry.js +1 -0
  142. package/dist/sankhyablocks/{p-34222890.entry.js → p-a0b4c940.entry.js} +1 -1
  143. package/dist/sankhyablocks/{p-a60028f1.entry.js → p-a4be272f.entry.js} +1 -1
  144. package/dist/sankhyablocks/p-ab2ba522.entry.js +1 -0
  145. package/dist/sankhyablocks/p-ac9488fd.entry.js +1 -0
  146. package/dist/sankhyablocks/{p-7a1d3cb6.entry.js → p-b1d8cbf7.entry.js} +1 -1
  147. package/dist/sankhyablocks/{p-7535d592.js → p-b393f1df.js} +1 -1
  148. package/dist/sankhyablocks/{p-dfbe4d7f.entry.js → p-c5d281ad.entry.js} +1 -1
  149. package/dist/sankhyablocks/{p-41e5a485.entry.js → p-c6d8c86b.entry.js} +1 -1
  150. package/dist/sankhyablocks/p-cb4343c4.entry.js +1 -0
  151. package/dist/sankhyablocks/p-d235314c.entry.js +1 -0
  152. package/dist/sankhyablocks/{p-dde9da7a.entry.js → p-d76f1aa5.entry.js} +1 -1
  153. package/dist/sankhyablocks/{p-aba06047.entry.js → p-de58a26f.entry.js} +1 -1
  154. package/dist/sankhyablocks/p-e258de96.entry.js +1 -0
  155. package/dist/sankhyablocks/p-fd8047b8.js +1 -0
  156. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  157. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +8 -4
  158. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
  159. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.d.ts +12 -0
  160. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +12 -4
  161. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +16 -4
  162. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +17 -3
  163. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +10 -2
  164. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +12 -0
  165. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +8 -3
  166. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +27 -4
  167. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +17 -3
  168. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +2 -3
  169. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +15 -2
  170. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +4 -2
  171. package/dist/types/components/snk-filter-bar/utils/filter-validate.d.ts +11 -0
  172. package/dist/types/components/snk-grid/snk-grid.d.ts +21 -8
  173. package/dist/types/components.d.ts +202 -17
  174. package/package.json +1 -1
  175. package/dist/sankhyablocks/p-07b14811.entry.js +0 -1
  176. package/dist/sankhyablocks/p-082e7ba8.entry.js +0 -1
  177. package/dist/sankhyablocks/p-25209340.entry.js +0 -1
  178. package/dist/sankhyablocks/p-295b83ae.entry.js +0 -1
  179. package/dist/sankhyablocks/p-3143bb44.entry.js +0 -1
  180. package/dist/sankhyablocks/p-353b4a74.js +0 -1
  181. package/dist/sankhyablocks/p-398cdd67.entry.js +0 -1
  182. package/dist/sankhyablocks/p-5bab470d.entry.js +0 -1
  183. package/dist/sankhyablocks/p-9fd87bfd.entry.js +0 -1
  184. package/dist/sankhyablocks/p-a76e6d51.entry.js +0 -1
  185. package/dist/sankhyablocks/p-ae2ebab7.js +0 -1
  186. package/dist/sankhyablocks/p-b21aa190.entry.js +0 -1
  187. package/dist/sankhyablocks/p-c6a8a8bc.entry.js +0 -1
  188. package/dist/sankhyablocks/p-c8932b14.entry.js +0 -1
  189. package/dist/sankhyablocks/p-dff65083.entry.js +0 -1
@@ -12,6 +12,7 @@ const SnkEntityList = class {
12
12
  this.rightListSlotBuilder = undefined;
13
13
  this.maxHeightList = "";
14
14
  this.value = undefined;
15
+ this.errorMessage = undefined;
15
16
  }
16
17
  async reloadList() {
17
18
  this.loadListSource();
@@ -22,6 +23,7 @@ const SnkEntityList = class {
22
23
  }
23
24
  ezListChangeListener(evt) {
24
25
  var _a, _b;
26
+ this.errorMessage = undefined;
25
27
  const configCopy = ObjectUtils.copy(this.config);
26
28
  (_a = (this.getListConfigValue(configCopy))) === null || _a === void 0 ? void 0 : _a.forEach(value => {
27
29
  var _a, _b;
@@ -74,7 +76,11 @@ const SnkEntityList = class {
74
76
  onEzSearchChange(evt) {
75
77
  var _a, _b, _c, _d;
76
78
  const newValueIsEmpty = ObjectUtils.isEmptySafetyCheck(evt.detail);
77
- const hasConfingOnList = (_a = this.getListConfigValue(this.config)) === null || _a === void 0 ? void 0 : _a.find((i) => { var _a; return (i === null || i === void 0 ? void 0 : i.id) === ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); });
79
+ const hasConfingOnList = (_a = this.getListConfigValue(this.config)) === null || _a === void 0 ? void 0 : _a.find((item) => {
80
+ var _a;
81
+ const itemId = typeof item.id === 'number' ? String(item.id) : item.id;
82
+ return itemId === ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value);
83
+ });
78
84
  if (newValueIsEmpty || hasConfingOnList) {
79
85
  return;
80
86
  }
@@ -99,10 +105,11 @@ const SnkEntityList = class {
99
105
  return (_d = (_b = (_a = config.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : (_c = config === null || config === void 0 ? void 0 : config.value) === null || _c === void 0 ? void 0 : _c.members) !== null && _d !== void 0 ? _d : config === null || config === void 0 ? void 0 : config.value;
100
106
  }
101
107
  render() {
102
- var _a, _b, _c;
108
+ var _a, _b, _c, _d, _e;
103
109
  const isSearchPlus = ((_a = this.config.props) === null || _a === void 0 ? void 0 : _a["useSearchPlus"]) == true;
104
110
  const TagName = isSearchPlus ? "ez-search-plus" : "ez-search";
105
- return (h(Host, null, h(TagName, { ref: elem => this._searchElement = elem, optionLoader: argument => this.optionLoader(argument), label: (_b = this.config) === null || _b === void 0 ? void 0 : _b.label, onEzChange: evt => this.onEzSearchChange(evt), suppressEmptyOption: true, stopPropagateEnterKeyEvent: true }), ((_c = this._ezListSource) === null || _c === void 0 ? void 0 : _c.length) > 0 && (h("label", { class: "label" }, this.getMessage("snkEntityList.selected"))), h("div", { style: this.maxHeightList ? { 'max-height': this.maxHeightList } : {}, class: { "snk-entity-list--overflow": !!this.maxHeightList } }, h("ez-list", { ref: (el) => this._ezList = el, id: "snkEntityList", listMode: "check", dataSource: this._ezListSource, hoverFeedback: true, itemSlotBuilder: this.rightListSlotBuilder, onEzCheckChange: evt => this.ezListChangeListener(evt) }))));
111
+ return (h(Host, null, h("ez-tooltip", { active: !this.config.enabled, message: this.config.disabledMessage, type: 'warning' }, h(TagName, { ref: elem => this._searchElement = elem, optionLoader: argument => this.optionLoader(argument), label: (_b = this.config) === null || _b === void 0 ? void 0 : _b.label, enabled: (_c = this.config) === null || _c === void 0 ? void 0 : _c.enabled, onEzChange: evt => this.onEzSearchChange(evt), suppressEmptyOption: true, stopPropagateEnterKeyEvent: true }), ((_d = this._ezListSource) === null || _d === void 0 ? void 0 : _d.length) > 0 && (h("label", { class: "label" }, this.getMessage("snkEntityList.selected"))), h("div", { style: this.maxHeightList ? { 'max-height': this.maxHeightList } : {}, class: { "snk-entity-list--overflow": !!this.maxHeightList } }, h("ez-list", { ref: (el) => this._ezList = el, id: "snkEntityList", enabled: (_e = this.config) === null || _e === void 0 ? void 0 : _e.enabled, listMode: "check", dataSource: this._ezListSource, hoverFeedback: true, itemSlotBuilder: this.rightListSlotBuilder, onEzCheckChange: evt => this.ezListChangeListener(evt) })), this.errorMessage &&
112
+ h("span", { class: 'ez-text ez-text--small ez-text--error ez-margin-horizontal--medium' }, this.errorMessage))));
106
113
  }
107
114
  static get watchers() { return {
108
115
  "config": ["observeConfig"]
@@ -1,18 +1,19 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-479e1293.js';
2
- import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext, LockManager, LockManagerOperation, DateUtils, MaskFormatter, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
2
+ import { DataType, StringUtils, ObjectUtils, ElementIDUtils, ErrorException, ApplicationContext, LockManager, LockManagerOperation, DateUtils, MaskFormatter, KeyboardManager, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
3
3
  import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
4
- import { C as ConfigStorage } from './ConfigStorage-fc4e3a42.js';
4
+ import { C as ConfigStorage } from './ConfigStorage-1e758486.js';
5
+ import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-2db38ff2.js';
5
6
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
7
  import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
7
8
  import { F as FilterOperand, D as DefaultFilter } from './index-8acbae97.js';
8
9
  import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
9
- import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
10
- import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-2db38ff2.js';
11
10
  import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
12
- import { F as FilterType } from './filter-type.enum-f6a8fe23.js';
11
+ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
13
12
  import { A as ActionDefaultFilter } from './default-filters-50105e43.js';
14
- import './form-config-fetcher-a1ccc944.js';
15
- import './DataFetcher-01ce1a4f.js';
13
+ import { F as FilterType } from './filter-type.enum-f6a8fe23.js';
14
+ import { g as getInvalidFilters } from './filter-validate-d765d450.js';
15
+ import './form-config-fetcher-eb03ac08.js';
16
+ import './DataFetcher-2f7ba7ae.js';
16
17
  import './PrintUtils-3e4ff0f5.js';
17
18
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
18
19
 
@@ -206,51 +207,6 @@ function buildPersonalized(item) {
206
207
  return { name: id, expression, params };
207
208
  }
208
209
 
209
- class SnkFilterModalFactory {
210
- constructor({ filterConfig, configName, onComplete, getMessage, disablePersonalizedFilter, onAddPersonalizedFilter, onEditPersonalizedFilter, onDeletePersonalizedFilter }) {
211
- this._filterConfig = filterConfig;
212
- this._configName = configName;
213
- this._onComplete = onComplete;
214
- this._getMessage = getMessage;
215
- this._disablePersonalizedFilter = disablePersonalizedFilter;
216
- this._addPersonalizedFilterFn = onAddPersonalizedFilter;
217
- this._editPersonalizedFilterFn = onEditPersonalizedFilter;
218
- this._onDeletePersonalizedFilter = onDeletePersonalizedFilter;
219
- }
220
- applyFilters(newFilterConfig) {
221
- this._onComplete(newFilterConfig);
222
- this._closeModal();
223
- }
224
- buildFilterModal() {
225
- const filterModal = document.createElement("snk-filter-modal");
226
- filterModal.className = "ez-size-height--full";
227
- filterModal.filters = this._filterConfig;
228
- filterModal.configName = this._configName;
229
- filterModal.disablePersonalizedFilter = this._disablePersonalizedFilter;
230
- filterModal.getMessage = this._getMessage.bind(this);
231
- filterModal.applyFilters = this.applyFilters.bind(this);
232
- filterModal.closeModal = () => this._closeModal();
233
- filterModal.addPersonalizedFilter = (isDefault) => this._addPersonalizedFilterFn(isDefault);
234
- filterModal.editPersonalizedFilter = (id, isDefault) => this._editPersonalizedFilterFn(id, isDefault);
235
- filterModal.deletePersonalizedFilter = (filter, configName, isDefault) => this._onDeletePersonalizedFilter(filter, configName, isDefault);
236
- return filterModal;
237
- }
238
- async showModal() {
239
- const filterModal = this.buildFilterModal();
240
- const modalProps = {
241
- content: filterModal,
242
- position: 'right',
243
- heightMode: 'full',
244
- closeOutsideClick: false,
245
- useScrimLight: true
246
- };
247
- this._closeModal = await ApplicationUtils.showModal(modalProps);
248
- }
249
- async closeModal() {
250
- this._closeModal();
251
- }
252
- }
253
-
254
210
  const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:1fr minmax(100px, 100%) 1fr 1fr;--snk-personalized-filter--z-index:var(--elevation--20, 20);--snk-personalized-filter--background-color:var(--background--xlight, #fff)}.snk-filter-bar__title.sc-snk-filter-bar{max-width:260px;display:inline-block;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:16px;font-family:var(--font-pattern, Arial);font-weight:var(--text-weight--large, 600);color:var(--color--title-primary, #2B3A54);margin-top:12px}[data-mode=\"hidden\"].sc-snk-filter-bar-h{width:0px;height:0px}[data-mode=\"button\"].sc-snk-filter-bar-h{grid-template-columns:1fr;width:fit-content}.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;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);height:80%}.snk-filter-bar__filter-item-container.sc-snk-filter-bar{display:flex;align-items:start;margin:var(--space--2, 2px) 0}.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%}";
255
211
 
256
212
  const SnkFilterBar = class {
@@ -291,10 +247,13 @@ const SnkFilterBar = class {
291
247
  this.filterBarLegacyConfigName = undefined;
292
248
  this.autoLoad = undefined;
293
249
  this.afterApplyConfig = undefined;
250
+ this.filterCustomConfig = undefined;
251
+ this.filterCustomConfigInterceptor = undefined;
294
252
  this.allowDefault = undefined;
295
253
  this.scrollerLocked = false;
296
254
  this.showPersonalizedFilter = false;
297
255
  this.personalizedFilterId = undefined;
256
+ this.isFilterModalOpen = false;
298
257
  }
299
258
  hasValidValue(item) {
300
259
  if (item.value === undefined || item.value === null)
@@ -442,7 +401,7 @@ const SnkFilterBar = class {
442
401
  return;
443
402
  }
444
403
  this._loadingPending = false;
445
- this.doLoadData(this.dataUnit.getLastLoadRequest() != undefined);
404
+ this.doLoadData();
446
405
  }
447
406
  if (this._configUpdated) {
448
407
  this._configUpdated = false;
@@ -541,11 +500,11 @@ const SnkFilterBar = class {
541
500
  const unpinnedItems = [];
542
501
  this.filterConfig.sort((a, b) => this._filtersComparator(a, b))
543
502
  .filter(this.filterActiveFilter)
544
- .forEach((item, index) => {
503
+ .forEach((item) => {
545
504
  item = ObjectUtils.copy(item);
546
505
  const itemId = `filter-${item.id}`;
547
- 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 }));
548
- if (item.fixed || item.hardFixed) {
506
+ 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: "ez-margin-horizontal--extra-small", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
507
+ if (item.fixed || item.hardFixed || item.required) {
549
508
  pinnedItems.push(filterItem);
550
509
  }
551
510
  else {
@@ -554,9 +513,9 @@ const SnkFilterBar = class {
554
513
  return filterItem;
555
514
  });
556
515
  const elements = [];
557
- elements.push(...pinnedItems);
516
+ elements.push(...pinnedItems.reverse());
558
517
  if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
559
- elements.push(h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
518
+ elements.push(h("hr", { class: "ez-margin-horizontal--small ez-margin-vertical--auto ez-divider-vertical ez-divider--dark snk-filter-bar__divider" }));
560
519
  }
561
520
  elements.push(...unpinnedItems);
562
521
  return elements;
@@ -581,7 +540,7 @@ const SnkFilterBar = class {
581
540
  return normalized;
582
541
  }
583
542
  updateFilter(newItem) {
584
- this.filterConfig = this.filterConfig.map(item => {
543
+ let config = this.filterConfig.map(item => {
585
544
  newItem = this.normalizeItem(newItem);
586
545
  if (item.id === newItem.id) {
587
546
  if (ObjectUtils.objectToString(item) != ObjectUtils.objectToString(newItem)) {
@@ -591,6 +550,10 @@ const SnkFilterBar = class {
591
550
  }
592
551
  return item;
593
552
  }).sort((a, b) => this._filtersComparator(a, b));
553
+ if (this.filterCustomConfigInterceptor) {
554
+ config = this.filterCustomConfigInterceptor(config);
555
+ }
556
+ this.filterConfig = config;
594
557
  }
595
558
  loadPermitions() {
596
559
  this._application.isUserSup().then(value => this.allowDefault = value);
@@ -612,6 +575,12 @@ const SnkFilterBar = class {
612
575
  else {
613
576
  config = await ConfigStorage.loadFilterBarConfig(this.configName, this.resourceID, { contextURI: this.dataUnit.name });
614
577
  }
578
+ if (this.filterCustomConfig) {
579
+ config = [...this.filterCustomConfig, ...config];
580
+ }
581
+ if (this.filterCustomConfigInterceptor) {
582
+ config = this.filterCustomConfigInterceptor(config);
583
+ }
615
584
  this.filterConfig = config.map(item => this.normalizeItem(item));
616
585
  this.filterConfig.sort((a, b) => this._filtersComparator(a, b));
617
586
  }
@@ -655,30 +624,13 @@ const SnkFilterBar = class {
655
624
  * @async
656
625
  */
657
626
  async showFilterModal() {
658
- const callbackOnApplyFilter = (filters) => {
659
- var _a;
660
- this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
661
- (_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
662
- };
663
- let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
664
- filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
665
- return itemA.originOrder - itemB.originOrder;
666
- });
667
- const factoryParams = {
668
- filterConfig: filtersConfigCopy,
669
- configName: this.configName,
670
- onComplete: callbackOnApplyFilter,
671
- disablePersonalizedFilter: this.disablePersonalizedFilter,
672
- getMessage: (key, props) => this.getMessage(key, props),
673
- onAddPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault),
674
- onEditPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault),
675
- onDeletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName, isDefault),
676
- };
677
- this._filterModalFactory = new SnkFilterModalFactory(factoryParams);
678
- await this._filterModalFactory.showModal();
627
+ if (this.isFilterModalOpen) {
628
+ return; // Evita abrir múltiplos modais
629
+ }
630
+ this.isFilterModalOpen = true;
679
631
  }
680
632
  addPersonalizedFilter(isDefault = false) {
681
- this._filterModalFactory.closeModal();
633
+ this.isFilterModalOpen = false;
682
634
  this._isDefaultFilter = isDefault;
683
635
  this.personalizedFilterId = undefined;
684
636
  this.showPersonalizedFilter = true;
@@ -687,7 +639,7 @@ const SnkFilterBar = class {
687
639
  });
688
640
  }
689
641
  editPersonalizedFilter(id, isDefault = false) {
690
- this._filterModalFactory.closeModal();
642
+ this.isFilterModalOpen = false;
691
643
  this._isDefaultFilter = isDefault;
692
644
  this.showPersonalizedFilter = true;
693
645
  this.personalizedFilterId = id;
@@ -702,6 +654,15 @@ const SnkFilterBar = class {
702
654
  ConfigStorage.removePersonalizedFilter(filter, this.resourceID, configName);
703
655
  }
704
656
  }
657
+ closeFilterModal() {
658
+ this.isFilterModalOpen = false;
659
+ }
660
+ applyFiltersFromModal(filters) {
661
+ var _a;
662
+ this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
663
+ (_a = this.afterApplyConfig) === null || _a === void 0 ? void 0 : _a.call(this);
664
+ this.isFilterModalOpen = false;
665
+ }
705
666
  handleHidePersonalizedFilter(reloadFilterBar) {
706
667
  if (reloadFilterBar) {
707
668
  this.loadConfigFromStorage().then(() => {
@@ -748,10 +709,14 @@ const SnkFilterBar = class {
748
709
  if (this.showPersonalizedFilter) {
749
710
  return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, isDefaultFilter: this._isDefaultFilter, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
750
711
  }
712
+ let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
713
+ filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
714
+ return itemA.originOrder - itemB.originOrder;
715
+ });
751
716
  if (this.mode !== "regular") {
752
- return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) }))));
717
+ return (h(Host, { "data-mode": this.mode }, this.getPersonalizedFilterVariableItems(), this.mode === 'button' && (h("ez-button", { class: "ez-margin-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) })), h("snk-filter-modal", { opened: this.isFilterModalOpen, filterConfig: this.filterConfig, configName: this.configName, disablePersonalizedFilter: this.disablePersonalizedFilter, getMessage: (key, props) => this.getMessage(key, props), applyFilters: (filters) => this.applyFiltersFromModal(filters), closeModal: () => this.closeFilterModal(), addPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault), editPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault), deletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName, isDefault), filterCustomConfigInterceptor: this.filterCustomConfigInterceptor })));
753
718
  }
754
- return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), 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 ez-margin-top--extra-small", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
719
+ return (h(Host, null, h("div", null, h("span", { class: "snk-filter-bar__title", title: this.title, "data-tooltip": this.title, "data-flow": "bottom" }, this.title)), 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 ez-margin-top--extra-small", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, this.getMessage("snkFilterBar.filters")), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" })), h("snk-filter-modal", { opened: this.isFilterModalOpen, filterConfig: this.filterConfig, configName: this.configName, disablePersonalizedFilter: this.disablePersonalizedFilter, getMessage: (key, props) => this.getMessage(key, props), applyFilters: (filters) => this.applyFiltersFromModal(filters), closeModal: () => this.closeFilterModal(), addPersonalizedFilter: (isDefault) => this.addPersonalizedFilter(isDefault), editPersonalizedFilter: (id, isDefault) => this.editPersonalizedFilter(id, isDefault), deletePersonalizedFilter: (filter, configName, isDefault) => this.deletePersonalizedFilter(filter, FilterItemType.PERSONALIZED, configName, isDefault), filterCustomConfigInterceptor: this.filterCustomConfigInterceptor })));
755
720
  }
756
721
  get _element() { return getElement(this); }
757
722
  static get watchers() { return {
@@ -767,6 +732,7 @@ const SnkFilterItem = class {
767
732
  registerInstance(this, hostRef);
768
733
  this.visibleChanged = createEvent(this, "visibleChanged", 7);
769
734
  this.filterChange = createEvent(this, "filterChange", 3);
735
+ this._keyboardManager = undefined;
770
736
  this.detailIsVisible = undefined;
771
737
  this.config = undefined;
772
738
  this.getMessage = undefined;
@@ -790,13 +756,15 @@ const SnkFilterItem = class {
790
756
  if (open) {
791
757
  await ((_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.setBlur());
792
758
  await this._popover.showUnder(this._chipElement);
759
+ await this._filterDetail.setFocusField();
793
760
  }
794
761
  }
795
762
  /**
796
763
  * Oculta os detalhes de um item da lista.
797
764
  */
798
765
  async hideDetail() {
799
- await this._popover.hide();
766
+ var _a;
767
+ await ((_a = this._popover) === null || _a === void 0 ? void 0 : _a.hide());
800
768
  }
801
769
  getConfigChanges() {
802
770
  var _a;
@@ -816,12 +784,15 @@ const SnkFilterItem = class {
816
784
  this.filterChange.emit(configChanged);
817
785
  }
818
786
  else {
819
- this.togglePopover();
787
+ this.togglePopover(event);
820
788
  }
821
789
  }
822
790
  async togglePopover(event) {
823
791
  event === null || event === void 0 ? void 0 : event.preventDefault();
824
792
  event === null || event === void 0 ? void 0 : event.stopPropagation();
793
+ if (this.config.enabled === false) {
794
+ return;
795
+ }
825
796
  if (this.detailIsVisible) {
826
797
  await this.hideDetail();
827
798
  }
@@ -970,8 +941,9 @@ const SnkFilterItem = class {
970
941
  return undefined;
971
942
  }
972
943
  hasActiveElements(value) {
973
- var _a, _b, _c;
974
- return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
944
+ var _a;
945
+ const list = Array.isArray(value) ? value : value === null || value === void 0 ? void 0 : value.elements;
946
+ return ((_a = list === null || list === void 0 ? void 0 : list.filter((val) => val === null || val === void 0 ? void 0 : val.check)) === null || _a === void 0 ? void 0 : _a.length) > 0;
975
947
  }
976
948
  hasActiveValue(config) {
977
949
  return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
@@ -986,12 +958,67 @@ const SnkFilterItem = class {
986
958
  }
987
959
  return this.hasActiveValue(this.config);
988
960
  }
989
- handleVisibilityPopover(event) {
961
+ async handleVisibilityPopover(event) {
990
962
  this.detailIsVisible = event.detail;
963
+ if (!this.detailIsVisible) {
964
+ await this._filterDetail.clearValue();
965
+ }
966
+ }
967
+ getCustomMessage(key, params) {
968
+ var _a;
969
+ return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
970
+ }
971
+ hasValue() {
972
+ if (this.config.type === FilterItemType.MULTI_LIST) {
973
+ return this.hasActiveElements(this.config.value);
974
+ }
975
+ return this.config.value !== undefined && this.config.value !== null;
976
+ }
977
+ getTooltipMessage() {
978
+ var _a, _b;
979
+ if (this.config.required && !this.hasValue()) {
980
+ return {
981
+ message: (_a = this.config.requiredMessage) !== null && _a !== void 0 ? _a : this.getCustomMessage('validations.requiredFilter'),
982
+ type: 'error'
983
+ };
984
+ }
985
+ if (this.config.enabled === false && this.config.disabledMessage) {
986
+ return { message: this.config.disabledMessage, type: 'warning' };
987
+ }
988
+ return {
989
+ message: (_b = this.config.defaultMessage) !== null && _b !== void 0 ? _b : this.getLabel(true),
990
+ type: 'default'
991
+ };
992
+ }
993
+ getTypeChip(type) {
994
+ switch (type) {
995
+ case 'default':
996
+ return 'secondary';
997
+ case 'warning':
998
+ return 'warning-light';
999
+ case 'error':
1000
+ return 'error-light';
1001
+ case 'success':
1002
+ return 'success-light';
1003
+ default:
1004
+ return type;
1005
+ }
1006
+ }
1007
+ initKeyboardManager() {
1008
+ this._keyboardManager = new KeyboardManager({ element: this._filterItemElement, propagate: true });
1009
+ this._keyboardManager
1010
+ .bind("Escape", () => this.hideDetail());
1011
+ }
1012
+ connectedCallback() {
1013
+ this.initKeyboardManager();
1014
+ }
1015
+ disconnectedCallback() {
1016
+ this._keyboardManager.unbindAllShortcutKeys();
991
1017
  }
992
1018
  render() {
993
1019
  const leftIcon = this.getLeftIconName();
994
- return (h(Host, null, this.showChips && (h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip(), onClick: (event) => this.togglePopover(event), disableAutoUpdateValue: true, type: "secondary" }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), slot: "rightIcon", id: "removeFilter", onClick: (event) => this.clearFilter(event) }))), h("ez-popover-core", { ref: elem => this._popover = elem, onEzVisibilityChange: (event) => this.handleVisibilityPopover(event) }, h("snk-filter-detail", { key: this.config.id, config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
1020
+ const { type, message } = this.getTooltipMessage();
1021
+ return (h(Host, null, this.showChips && (h("ez-tooltip", { id: this.config.id, message: message, type: type, active: !this.detailIsVisible, strategy: "fixed" }, h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip(), onClick: (event) => this.togglePopover(event), disableAutoUpdateValue: true, type: this.getTypeChip(type), enabled: this.config.enabled }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), slot: "rightIcon", id: "removeFilter", onClick: (event) => this.clearFilter(event) })))), h("ez-popover-core", { ref: elem => this._popover = elem, onEzVisibilityChange: (event) => this.handleVisibilityPopover(event) }, h("snk-filter-detail", { ref: ref => this._filterDetail = ref, key: this.config.id, config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips && !this.config.required, removalBlocked: this.config.required }))));
995
1022
  }
996
1023
  get _filterItemElement() { return getElement(this); }
997
1024
  static get watchers() { return {
@@ -1144,14 +1171,17 @@ const SnkFilterList = class {
1144
1171
  get _element() { return getElement(this); }
1145
1172
  };
1146
1173
 
1147
- const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:hidden;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
1174
+ const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
1148
1175
 
1149
1176
  const SnkFilterModal = class {
1150
1177
  constructor(hostRef) {
1151
1178
  registerInstance(this, hostRef);
1179
+ this.filters = [];
1180
+ this.filtersWithError = [];
1152
1181
  this.getMessage = undefined;
1153
1182
  this.configName = undefined;
1154
- this.filters = undefined;
1183
+ this.filterConfig = undefined;
1184
+ this.opened = false;
1155
1185
  this.applyFilters = undefined;
1156
1186
  this.closeModal = undefined;
1157
1187
  this.addPersonalizedFilter = undefined;
@@ -1160,6 +1190,11 @@ const SnkFilterModal = class {
1160
1190
  this.filtersToDelete = [];
1161
1191
  this.filterDefaultToDelete = undefined;
1162
1192
  this.disablePersonalizedFilter = undefined;
1193
+ this.filterCustomConfigInterceptor = undefined;
1194
+ }
1195
+ filterConfigChangeHandler(newValue) {
1196
+ this.filters = ObjectUtils.copy(newValue);
1197
+ this.validateFilters();
1163
1198
  }
1164
1199
  /**
1165
1200
  * Emitido quando um filtro personalizado é deletado.
@@ -1218,7 +1253,7 @@ const SnkFilterModal = class {
1218
1253
  });
1219
1254
  }
1220
1255
  hasChangeToSave() {
1221
- const hasChangesPersonalizedFilters = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
1256
+ const hasChangesPersonalizedFilters = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this.filters);
1222
1257
  return hasChangesPersonalizedFilters;
1223
1258
  }
1224
1259
  handleClose() {
@@ -1233,6 +1268,9 @@ const SnkFilterModal = class {
1233
1268
  });
1234
1269
  }
1235
1270
  handleApplyFilters() {
1271
+ if (!this.validateFilters()) {
1272
+ return;
1273
+ }
1236
1274
  const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER || filter.filterType === FilterType.DEFAULT_FILTER);
1237
1275
  if (this.isValidCustomFilter(filterPersonalized)) {
1238
1276
  this.applyFilters(this.filters);
@@ -1271,8 +1309,14 @@ const SnkFilterModal = class {
1271
1309
  break;
1272
1310
  }
1273
1311
  }
1274
- handleFilterChange(filterConfig) {
1275
- this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
1312
+ handleFilterChange(event) {
1313
+ event.stopPropagation();
1314
+ const filterConfig = event.detail;
1315
+ let config = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
1316
+ if (this.filterCustomConfigInterceptor) {
1317
+ config = this.filterCustomConfigInterceptor(config);
1318
+ }
1319
+ this.filters = ObjectUtils.copy(config);
1276
1320
  }
1277
1321
  handleClearFilterList(filterList) {
1278
1322
  this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
@@ -1305,8 +1349,22 @@ const SnkFilterModal = class {
1305
1349
  });
1306
1350
  return valueList;
1307
1351
  }
1352
+ validateFilters() {
1353
+ const notValidFilters = getInvalidFilters(this.filters);
1354
+ this.filtersWithError = notValidFilters.map(item => item.id);
1355
+ if (notValidFilters.length === 0) {
1356
+ return true;
1357
+ }
1358
+ notValidFilters.forEach(item => {
1359
+ const filterItem = this._element.querySelector(`#filter-item-${item.id}`);
1360
+ if (filterItem) {
1361
+ filterItem["errorMessage"] = item.requiredMessage || this.getCustomMessage('validations.requiredFilter');
1362
+ }
1363
+ });
1364
+ return false;
1365
+ }
1308
1366
  renderFilterItem(filterItem, fullRow) {
1309
- return (h("snk-filter-modal-item", { class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event.detail), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
1367
+ return (h("snk-filter-modal-item", { key: `modal-item-${filterItem.id}`, class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
1310
1368
  }
1311
1369
  isDefaultFilterNumberVariation(filter) {
1312
1370
  var _a;
@@ -1343,8 +1401,9 @@ const SnkFilterModal = class {
1343
1401
  }
1344
1402
  getIformedFiltersCount(listItems) {
1345
1403
  let countInformedItens = 0;
1346
- listItems.forEach(item => {
1404
+ listItems.forEach(localItem => {
1347
1405
  var _a, _b, _c, _d, _e, _f;
1406
+ const item = this.filterConfig.find(filter => filter.id === localItem.id);
1348
1407
  if (FilterItemType.MULTI_LIST === item.type) {
1349
1408
  countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
1350
1409
  return;
@@ -1370,7 +1429,8 @@ const SnkFilterModal = class {
1370
1429
  return null;
1371
1430
  const appliedFilters = this.getIformedFiltersCount(listItems);
1372
1431
  const lines = this.mountFiltersLines(listItems);
1373
- return (h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (h("ez-badge", { class: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: this.getCustomMessage("clearModal"), onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
1432
+ const countFiltersWithError = this.filtersWithError.filter(item => listItems.some(filter => filter.id === item)).length;
1433
+ return (h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, h("div", { class: "ez-flex ez-flex--justify-end grow", slot: "rightSlot" }, !!appliedFilters && (h("ez-badge", { class: "ez-badge--primary-subtle", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), !!countFiltersWithError && (h("ez-badge", { class: "ez-badge--error-subtle", label: countFiltersWithError === null || countFiltersWithError === void 0 ? void 0 : countFiltersWithError.toString() }))), h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: this.getCustomMessage("clearModal"), onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
1374
1434
  }
1375
1435
  handleDeleteFilter() {
1376
1436
  this._application.confirm(this.getMessage('snkPersonalizedFilter.deleteConfirm.title'), this.getMessage('snkPersonalizedFilter.info.deleteDefaultFilterConfirm'), "alert-circle-inverted", "critical").then((actionConfirmed) => {
@@ -1404,6 +1464,7 @@ const SnkFilterModal = class {
1404
1464
  }
1405
1465
  componentWillLoad() {
1406
1466
  this._application = ApplicationContext.getContextValue('__SNK__APPLICATION__');
1467
+ this.filters = ObjectUtils.copy(this.filterConfig);
1407
1468
  }
1408
1469
  componentWillRender() {
1409
1470
  this._modalTitle = this.getCustomMessage('title');
@@ -1411,16 +1472,19 @@ const SnkFilterModal = class {
1411
1472
  this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
1412
1473
  }
1413
1474
  componentDidLoad() {
1414
- if (!this._originalFilterConfig)
1415
- this._originalFilterConfig = this.filters;
1475
+ this.validateFilters();
1416
1476
  }
1417
1477
  render() {
1418
1478
  this._defaultFilter = this.getDefaultFilter(this.filters);
1419
1479
  const customFilters = this.getCustomFilter(this.filters);
1420
1480
  const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
1421
1481
  const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
1422
- return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, h("snk-default-filter", { getMessage: this.getCustomMessage.bind(this), hasDefaultFilter: !!this._defaultFilter, onActionSelected: this.handleActionSelectedDefaultFilter.bind(this) }), !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
1482
+ return (h("ez-modal", { opened: this.opened, modalSize: "col--sd-3", align: "right", heightMode: "full", closeEsc: true }, h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, h("snk-default-filter", { getMessage: this.getCustomMessage.bind(this), hasDefaultFilter: !!this._defaultFilter, onActionSelected: this.handleActionSelectedDefaultFilter.bind(this) }), !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true))))));
1423
1483
  }
1484
+ get _element() { return getElement(this); }
1485
+ static get watchers() { return {
1486
+ "filterConfig": ["filterConfigChangeHandler"]
1487
+ }; }
1424
1488
  };
1425
1489
  SnkFilterModal.style = snkFilterModalCss;
1426
1490
 
@@ -12,6 +12,7 @@ const SnkFilterBinarySelect = class {
12
12
  this.value = undefined;
13
13
  this.config = undefined;
14
14
  this.presentationMode = EPresentationMode.CHIP;
15
+ this.errorMessage = undefined;
15
16
  }
16
17
  isSelected(option) {
17
18
  return this.value == undefined || this.value === option;
@@ -20,6 +21,7 @@ const SnkFilterBinarySelect = class {
20
21
  * Emitido quando acontece a alteração de valor do componente snk-filter-binary-select
21
22
  */
22
23
  ezChangeListener(evt) {
24
+ this.errorMessage = undefined;
23
25
  if (this.presentationMode === EPresentationMode.MODAL) {
24
26
  if (!evt.detail) {
25
27
  this.assertCheckedOption(evt.target);
@@ -36,6 +38,23 @@ const SnkFilterBinarySelect = class {
36
38
  async resetValues() {
37
39
  this.ezChangeListener({ detail: this._noOptionValue });
38
40
  }
41
+ /**
42
+ * Limpa o valor do componente restaurando o valor original da configuração.
43
+ */
44
+ async clearValue() {
45
+ this.value = this.config.value;
46
+ this._radioButtonValue = this.value || this._noOptionValue;
47
+ }
48
+ /**
49
+ * Define o foco no componente snk-filter-binary-select.
50
+ */
51
+ async setFocus() {
52
+ if (this.presentationMode === EPresentationMode.MODAL) {
53
+ this._checkOne.setFocus();
54
+ return;
55
+ }
56
+ this._element.querySelector('ez-radio-button').focus();
57
+ }
39
58
  assertCheckedOption(updatingCheck) {
40
59
  if (updatingCheck === this._checkOne) {
41
60
  this._checkTwo.value = true;
@@ -77,9 +96,11 @@ const SnkFilterBinarySelect = class {
77
96
  }
78
97
  const [optOne, optTwo] = this.config.props.options;
79
98
  if (this.presentationMode === EPresentationMode.MODAL) {
80
- return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: this.isSelected(optOne.name) })), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkTwo = ref, id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: this.isSelected(optTwo.name) })))));
99
+ return (h(Host, null, h("div", { class: "ez-row ez-size-height--full" }, h("label", { class: "ez-text ez-title--small ez-title--primary ez-size-height--full ez-flex ez-flex--row ez-flex--align-items-center ez-col ez-col--sd-4" }, this.config.detailModal), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkOne = ref, id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, enabled: this.config.enabled, value: this.isSelected(optOne.name) })), h("div", { class: "ez-col ez-col--sd-4" }, h("ez-check", { ref: (ref) => this._checkTwo = ref, id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, enabled: this.config.enabled, value: this.isSelected(optTwo.name) })), this.errorMessage &&
100
+ h("span", { class: 'ez-text ez-text--small ez-text--error ez-margin--small' }, this.errorMessage))));
81
101
  }
82
- return (h(Host, null, h("ez-radio-button", { value: this._radioButtonValue }, h("ez-radio-button-option", { id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: optOne.name }), h("ez-radio-button-option", { id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: optTwo.name }), h("ez-radio-button-option", { id: `${this.config.id}_option3`, class: "sc-snk-filter-bar editor__ez-check", label: `${optOne.label} + ${optTwo.label}`, value: this._noOptionValue }))));
102
+ return (h(Host, null, h("ez-tooltip", { active: this.config.enabled === false, message: this.config.disabledMessage, type: 'warning' }, h("ez-radio-button", { value: this._radioButtonValue }, h("ez-radio-button-option", { id: `${this.config.id}_${optOne.name || "option1"}`, class: "sc-snk-filter-bar editor__ez-check", label: optOne.label, value: optOne.name }), h("ez-radio-button-option", { id: `${this.config.id}_${optTwo.name || "option2"}`, class: "sc-snk-filter-bar editor__ez-check", label: optTwo.label, value: optTwo.name }), h("ez-radio-button-option", { id: `${this.config.id}_option3`, class: "sc-snk-filter-bar editor__ez-check", label: `${optOne.label} + ${optTwo.label}`, value: this._noOptionValue })), this.errorMessage &&
103
+ h("span", { class: 'ez-text ez-text--small ez-text--error ez-margin--small' }, this.errorMessage))));
83
104
  }
84
105
  get _element() { return getElement(this); }
85
106
  };