@sankhyalabs/sankhyablocks 9.1.0-ms.1 → 9.1.0-ms.3

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 (85) hide show
  1. package/dist/cjs/{ClientSideExporterProvider-0ce2bcd9.js → ClientSideExporterProvider-b7943abc.js} +1 -1
  2. package/dist/cjs/{dataunit-fetcher-a723f0dc.js → dataunit-fetcher-c2aef198.js} +3 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-actions-button_8.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 +1 -1
  9. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  10. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  11. package/dist/cjs/{snk-data-unit-bf45314d.js → snk-data-unit-87c56d62.js} +1 -1
  12. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  13. package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-entity-list.cjs.entry.js +20 -14
  15. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +41 -109
  16. package/dist/cjs/snk-filter-detail.cjs.entry.js +3 -1
  17. package/dist/cjs/snk-grid.cjs.entry.js +2 -2
  18. package/dist/cjs/{snk-guides-viewer-edc0a00a.js → snk-guides-viewer-fedf7ba8.js} +1 -1
  19. package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
  20. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +6 -4
  21. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-simple-crud.cjs.entry.js +2 -2
  23. package/dist/collection/components/snk-entity-list/snk-entity-list.js +40 -15
  24. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-personalized-filter-editor/snk-personalized-filter-editor.js +6 -4
  25. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +3 -1
  26. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.css +4 -0
  27. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +49 -121
  28. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +3 -0
  29. package/dist/components/dataunit-fetcher.js +3 -0
  30. package/dist/components/snk-entity-list.js +21 -15
  31. package/dist/components/snk-filter-detail2.js +3 -1
  32. package/dist/components/snk-filter-item2.js +43 -111
  33. package/dist/components/snk-personalized-filter-editor.js +6 -4
  34. package/dist/esm/{ClientSideExporterProvider-3ed744fd.js → ClientSideExporterProvider-b468acad.js} +1 -1
  35. package/dist/esm/{dataunit-fetcher-0e025732.js → dataunit-fetcher-613a6fb9.js} +3 -0
  36. package/dist/esm/loader.js +1 -1
  37. package/dist/esm/pesquisa-grid_2.entry.js +1 -1
  38. package/dist/esm/sankhyablocks.js +1 -1
  39. package/dist/esm/snk-actions-button_8.entry.js +1 -1
  40. package/dist/esm/snk-application.entry.js +1 -1
  41. package/dist/esm/snk-attach.entry.js +1 -1
  42. package/dist/esm/snk-crud.entry.js +1 -1
  43. package/dist/esm/snk-data-exporter.entry.js +2 -2
  44. package/dist/esm/{snk-data-unit-ba90734a.js → snk-data-unit-8da2d175.js} +1 -1
  45. package/dist/esm/snk-data-unit.entry.js +2 -2
  46. package/dist/esm/snk-detail-view.entry.js +2 -2
  47. package/dist/esm/snk-entity-list.entry.js +20 -14
  48. package/dist/esm/snk-filter-bar_4.entry.js +42 -110
  49. package/dist/esm/snk-filter-detail.entry.js +3 -1
  50. package/dist/esm/snk-grid.entry.js +2 -2
  51. package/dist/esm/{snk-guides-viewer-32f3d3ab.js → snk-guides-viewer-0fc793de.js} +1 -1
  52. package/dist/esm/snk-guides-viewer.entry.js +2 -2
  53. package/dist/esm/snk-personalized-filter-editor.entry.js +6 -4
  54. package/dist/esm/snk-pesquisa.entry.js +1 -1
  55. package/dist/esm/snk-simple-crud.entry.js +2 -2
  56. package/dist/sankhyablocks/{p-1456d7cb.entry.js → p-134414d0.entry.js} +1 -1
  57. package/dist/sankhyablocks/p-162bddae.entry.js +1 -0
  58. package/dist/sankhyablocks/p-25209340.entry.js +1 -0
  59. package/dist/sankhyablocks/p-295b83ae.entry.js +1 -0
  60. package/dist/sankhyablocks/{p-50b68b68.entry.js → p-536dc236.entry.js} +1 -1
  61. package/dist/sankhyablocks/{p-bd665460.entry.js → p-59d84130.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-aa72089a.entry.js → p-5b963f03.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-97bc6983.js → p-6d2c841d.js} +1 -1
  64. package/dist/sankhyablocks/{p-763b04fa.js → p-7bb04271.js} +1 -1
  65. package/dist/sankhyablocks/{p-fc0b609e.js → p-848c0ece.js} +1 -1
  66. package/dist/sankhyablocks/{p-05f3a2da.entry.js → p-8691b78e.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-7993b2e3.js → p-8f8367d5.js} +1 -1
  68. package/dist/sankhyablocks/p-a414a26c.entry.js +1 -0
  69. package/dist/sankhyablocks/{p-3d452f27.entry.js → p-cb4bcf34.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-3bf2f5cd.entry.js → p-d0d8de69.entry.js} +1 -1
  71. package/dist/sankhyablocks/{p-afffa6cb.entry.js → p-e0313142.entry.js} +1 -1
  72. package/dist/sankhyablocks/{p-b31cc92d.entry.js → p-ef2022ac.entry.js} +1 -1
  73. package/dist/sankhyablocks/{p-cfd0a4c6.entry.js → p-efb76b5f.entry.js} +1 -1
  74. package/dist/sankhyablocks/{p-6a1b38d2.entry.js → p-f21325f1.entry.js} +1 -1
  75. package/dist/sankhyablocks/{p-e7cccc45.entry.js → p-fac65ae7.entry.js} +1 -1
  76. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  77. package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +8 -4
  78. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -0
  79. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +10 -20
  80. package/dist/types/components.d.ts +9 -1
  81. package/package.json +1 -1
  82. package/dist/sankhyablocks/p-83c100f2.entry.js +0 -1
  83. package/dist/sankhyablocks/p-90805683.entry.js +0 -1
  84. package/dist/sankhyablocks/p-d9491f6f.entry.js +0 -1
  85. package/dist/sankhyablocks/p-e824d565.entry.js +0 -1
@@ -1,16 +1,9 @@
1
- import { ElementIDUtils, FloatingManager, DateUtils, MaskFormatter } from '@sankhyalabs/core';
1
+ import { ElementIDUtils, DateUtils, MaskFormatter } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
3
  import FilterItemType from './filter-item-type.enum';
4
4
  import { FilterNumberVariation } from './editors/enum/filterNumberVariation';
5
5
  export class SnkFilterItem {
6
6
  constructor() {
7
- this.innerClickCheck = (_floatingContainer, node) => {
8
- if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
9
- return true;
10
- }
11
- this.detailIsVisible = false;
12
- return false;
13
- };
14
7
  this.detailIsVisible = undefined;
15
8
  this.config = undefined;
16
9
  this.getMessage = undefined;
@@ -19,57 +12,28 @@ export class SnkFilterItem {
19
12
  observeDetailIsVisible(value) {
20
13
  this.visibleChanged.emit(value);
21
14
  }
15
+ /**
16
+ * Emitido quando o estado do filtro é alterado.
17
+ */
18
+ filterChangeListener() {
19
+ this.hideDetail();
20
+ }
22
21
  /**
23
22
  * Exibe os detalhes de um item da lista.
24
23
  */
25
24
  async showUp(open = false) {
26
- return new Promise(resolve => {
27
- var _a;
28
- this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
29
- if (open) {
30
- this._closeCallback = resolve;
31
- (_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.blur();
32
- window.requestAnimationFrame(() => {
33
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
34
- this._popover.show();
35
- this.detailIsVisible = true;
36
- });
37
- }
38
- });
39
- }
40
- updatePosition() {
41
- if (this._floatingID == undefined) {
42
- return;
25
+ var _a;
26
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
27
+ if (open) {
28
+ await ((_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.setBlur());
29
+ await this._popover.showUnder(this._chipElement);
43
30
  }
44
- FloatingManager.updateFloatPosition(this._popover, this._popoverContainer, this.getFloatOptions());
45
- }
46
- getFloatOptions() {
47
- return {
48
- autoClose: true,
49
- innerClickTest: this.innerClickCheck,
50
- backClickListener: () => this.onDetailCloseCallback(),
51
- left: this.getOffsetLeft(),
52
- top: this.getOffsetTop(),
53
- useOverlay: true,
54
- overlayClassName: 'ez-scrim ez-scrim--light',
55
- isFixed: true
56
- };
57
- }
58
- getOffsetLeft() {
59
- const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
60
- const rect = this._filterItemElement.getBoundingClientRect();
61
- // Width baseado no conteudo do snk-filter-detail. Nesse momento ele retorna 0px pois ainda não foi criado em tela.
62
- const filterDetailWidth = 430;
63
- const adjustRightPosition = filterDetailWidth - (document.body.clientWidth - rect.left);
64
- return `calc(${rect.x}px + ${padding} - ${adjustRightPosition > 0 ? adjustRightPosition : 0}px)`;
65
31
  }
66
- getOffsetTop() {
67
- const rect = this._filterItemElement.getBoundingClientRect();
68
- return (rect.y + rect.height) + "px";
69
- }
70
- controlScrollPage() {
71
- window.removeEventListener("scroll", this.updatePosition.bind(this));
72
- window.addEventListener("scroll", this.updatePosition.bind(this));
32
+ /**
33
+ * Oculta os detalhes de um item da lista.
34
+ */
35
+ async hideDetail() {
36
+ await this._popover.hide();
73
37
  }
74
38
  getConfigChanges() {
75
39
  var _a;
@@ -82,51 +46,24 @@ export class SnkFilterItem {
82
46
  const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
83
47
  return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
84
48
  }
85
- /**
86
- * Oculta os detalhes de um item da lista.
87
- */
88
- async hideDetail() {
89
- if (this.detailIsVisible) {
90
- if (this._floatingID != undefined) {
91
- FloatingManager.close(this._floatingID);
92
- }
49
+ clearFilter(event) {
50
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
51
+ if (this.canClearFilter()) {
52
+ const configChanged = this.getConfigChanges();
53
+ this.filterChange.emit(configChanged);
93
54
  }
94
- }
95
- onDetailCloseCallback() {
96
- this._floatingID = undefined;
97
- this.detailIsVisible = false;
98
- if (this._closeCallback) {
99
- this._closeCallback();
100
- this._closeCallback = undefined;
55
+ else {
56
+ this.togglePopover();
101
57
  }
102
58
  }
103
- //---------------------------------------------
104
- // Event handlers
105
- //---------------------------------------------
106
- clickListener(evt) {
107
- if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
108
- if (evt.target === this._rightIconElement && this.canClearFilter()) {
109
- const configChanged = this.getConfigChanges();
110
- this.filterChange.emit(configChanged);
111
- }
112
- else {
113
- if (this.detailIsVisible) {
114
- this.hideDetail();
115
- }
116
- else {
117
- this.showUp(true);
118
- }
119
- }
120
- evt.preventDefault();
121
- evt.stopImmediatePropagation();
122
- evt.stopPropagation();
59
+ async togglePopover(event) {
60
+ event === null || event === void 0 ? void 0 : event.preventDefault();
61
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
62
+ if (this.detailIsVisible) {
63
+ await this.hideDetail();
123
64
  }
124
- }
125
- mouseDownListener(evt) {
126
- if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
127
- evt.preventDefault();
128
- evt.stopImmediatePropagation();
129
- evt.stopPropagation();
65
+ else {
66
+ await this.showUp(true);
130
67
  }
131
68
  }
132
69
  getLabel(isTooltipLabel = false) {
@@ -247,20 +184,6 @@ export class SnkFilterItem {
247
184
  ElementIDUtils.addIDInfo(this._filterItemElement);
248
185
  this._idSnkFilterDetail = `filterDetail_${this.config.id}`;
249
186
  }
250
- this.controlScrollPage();
251
- }
252
- componentDidRender() {
253
- if (this._floatingID == undefined) {
254
- if (this._popover) {
255
- this._popover.remove();
256
- }
257
- }
258
- }
259
- /**
260
- * Emitido quando o estado do filtro é alterado.
261
- */
262
- filterChangeListener() {
263
- this.hideDetail();
264
187
  }
265
188
  canClearFilter() {
266
189
  const { value, groupedItems = [] } = this.config;
@@ -291,17 +214,34 @@ export class SnkFilterItem {
291
214
  return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
292
215
  }
293
216
  getEnabledChip() {
217
+ if (this.detailIsVisible) {
218
+ return true;
219
+ }
294
220
  if (this.config.type === FilterItemType.PERSONALIZED) {
295
221
  const { groupedItems = [] } = this.config;
296
222
  return groupedItems.some(item => item.visible);
297
223
  }
298
224
  return this.hasActiveValue(this.config);
299
225
  }
226
+ handleVisibilityPopover(event) {
227
+ this.detailIsVisible = event.detail;
228
+ }
300
229
  render() {
301
230
  const leftIcon = this.getLeftIconName();
302
- return (h(Host, null, this.showChips && (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" })), 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 ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
231
+ 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 }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", 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 }))));
303
232
  }
304
233
  static get is() { return "snk-filter-item"; }
234
+ static get encapsulation() { return "scoped"; }
235
+ static get originalStyleUrls() {
236
+ return {
237
+ "$": ["snk-filter-item.css"]
238
+ };
239
+ }
240
+ static get styleUrls() {
241
+ return {
242
+ "$": ["snk-filter-item.css"]
243
+ };
244
+ }
305
245
  static get properties() {
306
246
  return {
307
247
  "config": {
@@ -448,18 +388,6 @@ export class SnkFilterItem {
448
388
  }
449
389
  static get listeners() {
450
390
  return [{
451
- "name": "click",
452
- "method": "clickListener",
453
- "target": undefined,
454
- "capture": true,
455
- "passive": false
456
- }, {
457
- "name": "mousedown",
458
- "method": "mouseDownListener",
459
- "target": undefined,
460
- "capture": true,
461
- "passive": false
462
- }, {
463
391
  "name": "filterChange",
464
392
  "method": "filterChangeListener",
465
393
  "target": undefined,
@@ -230,6 +230,9 @@ export class DatasetStrategy {
230
230
  if (![UserInterface.SEARCH, UserInterface.SEARCHPLUS].includes(descriptor.userInterface)) {
231
231
  return undefined;
232
232
  }
233
+ if (!descriptor.properties) {
234
+ return undefined;
235
+ }
233
236
  const { ENTITYNAME, mergedFrom, DESCRIPTIONFIELD } = descriptor.properties;
234
237
  if (!StringUtils.isEmpty(DESCRIPTIONFIELD)) {
235
238
  return mergedFrom != undefined ? `${mergedFrom}.${ENTITYNAME}.${DESCRIPTIONFIELD}` : `${ENTITYNAME}.${DESCRIPTIONFIELD}`;
@@ -501,6 +501,9 @@ class DatasetStrategy {
501
501
  if (![UserInterface.SEARCH, UserInterface.SEARCHPLUS].includes(descriptor.userInterface)) {
502
502
  return undefined;
503
503
  }
504
+ if (!descriptor.properties) {
505
+ return undefined;
506
+ }
504
507
  const { ENTITYNAME, mergedFrom, DESCRIPTIONFIELD } = descriptor.properties;
505
508
  if (!StringUtils.isEmpty(DESCRIPTIONFIELD)) {
506
509
  return mergedFrom != undefined ? `${mergedFrom}.${ENTITYNAME}.${DESCRIPTIONFIELD}` : `${ENTITYNAME}.${DESCRIPTIONFIELD}`;
@@ -8,11 +8,11 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
8
8
  super();
9
9
  this.__registerHost();
10
10
  this.valueChanged = createEvent(this, "valueChanged", 7);
11
- this._searchValue = undefined;
12
11
  this._ezListSource = [];
13
12
  this.config = undefined;
14
13
  this.rightListSlotBuilder = undefined;
15
14
  this.maxHeightList = "";
15
+ this.value = undefined;
16
16
  }
17
17
  async reloadList() {
18
18
  this.loadListSource();
@@ -74,18 +74,22 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
74
74
  }
75
75
  onEzSearchChange(evt) {
76
76
  var _a, _b, _c, _d;
77
- if (evt.detail != undefined && ((_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); })) === undefined) {
78
- this.config = Object.assign(Object.assign({}, this.config), { value: [
79
- ...((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : []),
80
- {
81
- id: evt.detail.value,
82
- check: true,
83
- label: evt.detail.label
84
- }
85
- ] });
86
- this.loadListSource();
87
- this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
77
+ const newValueIsEmpty = ObjectUtils.isEmptySafetyCheck(evt.detail);
78
+ 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
+ if (newValueIsEmpty || hasConfingOnList) {
80
+ return;
88
81
  }
82
+ this.config = Object.assign(Object.assign({}, this.config), { value: [
83
+ ...((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : []),
84
+ {
85
+ id: evt.detail.value,
86
+ check: true,
87
+ label: evt.detail.label
88
+ }
89
+ ] });
90
+ this.loadListSource();
91
+ this.value = this.config.value;
92
+ this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
89
93
  }
90
94
  getMessage(key, params) {
91
95
  var _a;
@@ -96,8 +100,10 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
96
100
  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;
97
101
  }
98
102
  render() {
99
- var _a, _b;
100
- return (h(Host, null, h("ez-search", { ref: elem => this._searchElement = elem, optionLoader: argument => this.optionLoader(argument), value: this._searchValue, label: (_a = this.config) === null || _a === void 0 ? void 0 : _a.label, onEzChange: evt => this.onEzSearchChange(evt), suppressEmptyOption: true }), ((_b = this._ezListSource) === null || _b === void 0 ? void 0 : _b.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) }))));
103
+ var _a, _b, _c;
104
+ const isSearchPlus = ((_a = this.config.props) === null || _a === void 0 ? void 0 : _a["useSearchPlus"]) == true;
105
+ const TagName = isSearchPlus ? "ez-search-plus" : "ez-search";
106
+ 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) }))));
101
107
  }
102
108
  static get watchers() { return {
103
109
  "config": ["observeConfig"]
@@ -107,7 +113,7 @@ const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
107
113
  "config": [1040],
108
114
  "rightListSlotBuilder": [1040],
109
115
  "maxHeightList": [1, "max-height-list"],
110
- "_searchValue": [32],
116
+ "value": [1040],
111
117
  "_ezListSource": [32],
112
118
  "reloadList": [64]
113
119
  }]);
@@ -25,6 +25,7 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
25
25
  var _a, _b;
26
26
  this._editor && (this._editor["config"] = newValue);
27
27
  (_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["reloadList"]) === null || _b === void 0 ? void 0 : _b.call(_a);
28
+ this._customElementObject = this.getContentEditor();
28
29
  }
29
30
  componentDidLoad() {
30
31
  if (this._element) {
@@ -161,9 +162,10 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
161
162
  }
162
163
  componentWillLoad() {
163
164
  this.originalConfig = ObjectUtils.copy(this.config);
165
+ this._customElementObject = this.getContentEditor();
164
166
  }
165
167
  render() {
166
- const { tag: CustomElement, props } = this.getContentEditor();
168
+ const { tag: CustomElement, props } = this._customElementObject;
167
169
  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, 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" }))));
168
170
  }
169
171
  get _element() { return this; }
@@ -1,22 +1,17 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { FloatingManager, DateUtils, MaskFormatter, ElementIDUtils } from '@sankhyalabs/core';
2
+ import { DateUtils, MaskFormatter, ElementIDUtils } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum.js';
4
4
  import { F as FilterNumberVariation } from './filterNumberVariation.js';
5
5
  import { d as defineCustomElement$1 } from './snk-filter-detail2.js';
6
6
 
7
+ const snkFilterItemCss = "ez-popover-core.sc-snk-filter-item{--ez-popover__box--z-index:var(--elevation--20, 20);--ez-popover__box--overlay-z-index:var(--elevation--16, 16)}";
8
+
7
9
  const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
10
  constructor() {
9
11
  super();
10
12
  this.__registerHost();
11
13
  this.visibleChanged = createEvent(this, "visibleChanged", 7);
12
14
  this.filterChange = createEvent(this, "filterChange", 3);
13
- this.innerClickCheck = (_floatingContainer, node) => {
14
- if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
15
- return true;
16
- }
17
- this.detailIsVisible = false;
18
- return false;
19
- };
20
15
  this.detailIsVisible = undefined;
21
16
  this.config = undefined;
22
17
  this.getMessage = undefined;
@@ -25,57 +20,28 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
25
20
  observeDetailIsVisible(value) {
26
21
  this.visibleChanged.emit(value);
27
22
  }
23
+ /**
24
+ * Emitido quando o estado do filtro é alterado.
25
+ */
26
+ filterChangeListener() {
27
+ this.hideDetail();
28
+ }
28
29
  /**
29
30
  * Exibe os detalhes de um item da lista.
30
31
  */
31
32
  async showUp(open = false) {
32
- return new Promise(resolve => {
33
- var _a;
34
- this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
35
- if (open) {
36
- this._closeCallback = resolve;
37
- (_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.blur();
38
- window.requestAnimationFrame(() => {
39
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
40
- this._popover.show();
41
- this.detailIsVisible = true;
42
- });
43
- }
44
- });
45
- }
46
- updatePosition() {
47
- if (this._floatingID == undefined) {
48
- return;
33
+ var _a;
34
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
35
+ if (open) {
36
+ await ((_a = this._chipElement) === null || _a === void 0 ? void 0 : _a.setBlur());
37
+ await this._popover.showUnder(this._chipElement);
49
38
  }
50
- FloatingManager.updateFloatPosition(this._popover, this._popoverContainer, this.getFloatOptions());
51
39
  }
52
- getFloatOptions() {
53
- return {
54
- autoClose: true,
55
- innerClickTest: this.innerClickCheck,
56
- backClickListener: () => this.onDetailCloseCallback(),
57
- left: this.getOffsetLeft(),
58
- top: this.getOffsetTop(),
59
- useOverlay: true,
60
- overlayClassName: 'ez-scrim ez-scrim--light',
61
- isFixed: true
62
- };
63
- }
64
- getOffsetLeft() {
65
- const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
66
- const rect = this._filterItemElement.getBoundingClientRect();
67
- // Width baseado no conteudo do snk-filter-detail. Nesse momento ele retorna 0px pois ainda não foi criado em tela.
68
- const filterDetailWidth = 430;
69
- const adjustRightPosition = filterDetailWidth - (document.body.clientWidth - rect.left);
70
- return `calc(${rect.x}px + ${padding} - ${adjustRightPosition > 0 ? adjustRightPosition : 0}px)`;
71
- }
72
- getOffsetTop() {
73
- const rect = this._filterItemElement.getBoundingClientRect();
74
- return (rect.y + rect.height) + "px";
75
- }
76
- controlScrollPage() {
77
- window.removeEventListener("scroll", this.updatePosition.bind(this));
78
- window.addEventListener("scroll", this.updatePosition.bind(this));
40
+ /**
41
+ * Oculta os detalhes de um item da lista.
42
+ */
43
+ async hideDetail() {
44
+ await this._popover.hide();
79
45
  }
80
46
  getConfigChanges() {
81
47
  var _a;
@@ -88,51 +54,24 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
88
54
  const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
89
55
  return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
90
56
  }
91
- /**
92
- * Oculta os detalhes de um item da lista.
93
- */
94
- async hideDetail() {
95
- if (this.detailIsVisible) {
96
- if (this._floatingID != undefined) {
97
- FloatingManager.close(this._floatingID);
98
- }
57
+ clearFilter(event) {
58
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
59
+ if (this.canClearFilter()) {
60
+ const configChanged = this.getConfigChanges();
61
+ this.filterChange.emit(configChanged);
99
62
  }
100
- }
101
- onDetailCloseCallback() {
102
- this._floatingID = undefined;
103
- this.detailIsVisible = false;
104
- if (this._closeCallback) {
105
- this._closeCallback();
106
- this._closeCallback = undefined;
63
+ else {
64
+ this.togglePopover();
107
65
  }
108
66
  }
109
- //---------------------------------------------
110
- // Event handlers
111
- //---------------------------------------------
112
- clickListener(evt) {
113
- if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
114
- if (evt.target === this._rightIconElement && this.canClearFilter()) {
115
- const configChanged = this.getConfigChanges();
116
- this.filterChange.emit(configChanged);
117
- }
118
- else {
119
- if (this.detailIsVisible) {
120
- this.hideDetail();
121
- }
122
- else {
123
- this.showUp(true);
124
- }
125
- }
126
- evt.preventDefault();
127
- evt.stopImmediatePropagation();
128
- evt.stopPropagation();
67
+ async togglePopover(event) {
68
+ event === null || event === void 0 ? void 0 : event.preventDefault();
69
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
70
+ if (this.detailIsVisible) {
71
+ await this.hideDetail();
129
72
  }
130
- }
131
- mouseDownListener(evt) {
132
- if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
133
- evt.preventDefault();
134
- evt.stopImmediatePropagation();
135
- evt.stopPropagation();
73
+ else {
74
+ await this.showUp(true);
136
75
  }
137
76
  }
138
77
  getLabel(isTooltipLabel = false) {
@@ -253,20 +192,6 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
253
192
  ElementIDUtils.addIDInfo(this._filterItemElement);
254
193
  this._idSnkFilterDetail = `filterDetail_${this.config.id}`;
255
194
  }
256
- this.controlScrollPage();
257
- }
258
- componentDidRender() {
259
- if (this._floatingID == undefined) {
260
- if (this._popover) {
261
- this._popover.remove();
262
- }
263
- }
264
- }
265
- /**
266
- * Emitido quando o estado do filtro é alterado.
267
- */
268
- filterChangeListener() {
269
- this.hideDetail();
270
195
  }
271
196
  canClearFilter() {
272
197
  const { value, groupedItems = [] } = this.config;
@@ -297,28 +222,35 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
297
222
  return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
298
223
  }
299
224
  getEnabledChip() {
225
+ if (this.detailIsVisible) {
226
+ return true;
227
+ }
300
228
  if (this.config.type === FilterItemType.PERSONALIZED) {
301
229
  const { groupedItems = [] } = this.config;
302
230
  return groupedItems.some(item => item.visible);
303
231
  }
304
232
  return this.hasActiveValue(this.config);
305
233
  }
234
+ handleVisibilityPopover(event) {
235
+ this.detailIsVisible = event.detail;
236
+ }
306
237
  render() {
307
238
  const leftIcon = this.getLeftIconName();
308
- return (h(Host, null, this.showChips && (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" })), 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 ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
239
+ 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 }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", 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 }))));
309
240
  }
310
241
  get _filterItemElement() { return this; }
311
242
  static get watchers() { return {
312
243
  "detailIsVisible": ["observeDetailIsVisible"]
313
244
  }; }
314
- }, [0, "snk-filter-item", {
245
+ static get style() { return snkFilterItemCss; }
246
+ }, [2, "snk-filter-item", {
315
247
  "config": [1040],
316
248
  "getMessage": [16],
317
249
  "showChips": [4, "show-chips"],
318
250
  "detailIsVisible": [32],
319
251
  "showUp": [64],
320
252
  "hideDetail": [64]
321
- }, [[2, "click", "clickListener"], [2, "mousedown", "mouseDownListener"], [0, "filterChange", "filterChangeListener"]]]);
253
+ }, [[0, "filterChange", "filterChangeListener"]]]);
322
254
  function defineCustomElement() {
323
255
  if (typeof customElements === "undefined") {
324
256
  return;
@@ -79,21 +79,23 @@ const SnkFilterPersonalized = /*@__PURE__*/ proxyCustomElement(class extends HTM
79
79
  var _a, _b;
80
80
  const params = (_b = (_a = parentItem === null || parentItem === void 0 ? void 0 : parentItem.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters;
81
81
  return params.map((param, index) => {
82
- var _a, _b, _c;
82
+ var _a, _b, _c, _d;
83
83
  const formProp = Object.assign(Object.assign({}, param), { id: parentItem.id });
84
84
  const value = (_a = parentItem.value) === null || _a === void 0 ? void 0 : _a[index];
85
85
  const elemId = 'param_' + index;
86
86
  switch (param.userInterface) {
87
87
  case UserInterface.SEARCH:
88
- return h("ez-search", { id: elemId, suppressEmptyOption: true, value: value, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
88
+ const isSearchPlus = ((_b = this.config.props) === null || _b === void 0 ? void 0 : _b["useSearchPlus"]) == true;
89
+ const TagName = isSearchPlus ? "ez-search-plus" : "ez-search";
90
+ return h(TagName, { id: elemId, suppressEmptyOption: true, value: value, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
89
91
  case UserInterface.SWITCH:
90
92
  case UserInterface.CHECKBOX:
91
93
  const mode = UserInterface.SWITCH === param.userInterface ? CheckMode.SWITCH : CheckMode.REGULAR;
92
94
  return h("ez-check", { id: elemId, class: "ez-padding-bottom--medium", mode: mode, value: value, label: param.label, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp) });
93
95
  case UserInterface.DECIMALNUMBER:
94
- return h("ez-number-input", { id: elemId, label: param.label, value: value, precision: ((_b = param.props) === null || _b === void 0 ? void 0 : _b.precision) || 2, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp) });
96
+ return h("ez-number-input", { id: elemId, label: param.label, value: value, precision: ((_c = param.props) === null || _c === void 0 ? void 0 : _c.precision) || 2, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp) });
95
97
  case UserInterface.INTEGERNUMBER:
96
- return h("ez-number-input", { id: elemId, label: param.label, value: value, precision: (_c = param.props) === null || _c === void 0 ? void 0 : _c.precision, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp) });
98
+ return h("ez-number-input", { id: elemId, label: param.label, value: value, precision: (_d = param.props) === null || _d === void 0 ? void 0 : _d.precision, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp) });
97
99
  case UserInterface.OPTIONSELECTOR:
98
100
  return h("ez-combo-box", { id: elemId, label: param.label, value: value, options: param.options, onEzChange: evt => this.handleFilterItemChange(evt.detail, formProp) });
99
101
  case UserInterface.DATE:
@@ -4,7 +4,7 @@ import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, St
4
4
  import { D as DataExporterOption } from './index-b40568ff.js';
5
5
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
6
6
  import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
7
- import { P as PreloadManager } from './dataunit-fetcher-0e025732.js';
7
+ import { P as PreloadManager } from './dataunit-fetcher-613a6fb9.js';
8
8
  import './filter-item-type.enum-d45e026f.js';
9
9
  import './form-config-fetcher-fa208a6c.js';
10
10
  import './constants-7b422de0.js';
@@ -501,6 +501,9 @@ class DatasetStrategy {
501
501
  if (![UserInterface.SEARCH, UserInterface.SEARCHPLUS].includes(descriptor.userInterface)) {
502
502
  return undefined;
503
503
  }
504
+ if (!descriptor.properties) {
505
+ return undefined;
506
+ }
504
507
  const { ENTITYNAME, mergedFrom, DESCRIPTIONFIELD } = descriptor.properties;
505
508
  if (!StringUtils.isEmpty(DESCRIPTIONFIELD)) {
506
509
  return mergedFrom != undefined ? `${mergedFrom}.${ENTITYNAME}.${DESCRIPTIONFIELD}` : `${ENTITYNAME}.${DESCRIPTIONFIELD}`;