@sankhyalabs/sankhyablocks 5.6.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/cjs/{SnkMessageBuilder-e64dce7f.js → SnkMessageBuilder-1760d2c9.js} +16 -1
  2. package/dist/cjs/{filter-item-type.enum-3daf58d3.js → filter-item-type.enum-aa823a00.js} +1 -0
  3. package/dist/cjs/filter-type.enum-b14ce507.js +11 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/presentationMode-52ec3bdd.js +7 -0
  6. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  7. package/dist/cjs/snk-application.cjs.entry.js +1 -1
  8. package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
  9. package/dist/cjs/{snk-data-unit-85d6565e.js → snk-data-unit-f27603c9.js} +1 -1
  10. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  11. package/dist/cjs/snk-detail-view.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-filter-bar.cjs.entry.js +52 -140
  13. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +26 -15
  14. package/dist/cjs/snk-filter-detail.cjs.entry.js +5 -10
  15. package/dist/cjs/snk-filter-item.cjs.entry.js +36 -8
  16. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +67 -0
  17. package/dist/cjs/snk-filter-modal.cjs.entry.js +72 -49
  18. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +3 -1
  19. package/dist/cjs/snk-filter-number.cjs.entry.js +3 -1
  20. package/dist/cjs/snk-filter-period.cjs.entry.js +18 -2
  21. package/dist/cjs/snk-filter-personalized.cjs.entry.js +3 -1
  22. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -1
  23. package/dist/cjs/snk-filter-text.cjs.entry.js +2 -0
  24. package/dist/cjs/snk-grid.cjs.entry.js +8 -1
  25. package/dist/collection/collection-manifest.json +1 -0
  26. package/dist/collection/components/snk-filter-bar/filter-item/editors/enum/presentationMode.js +5 -0
  27. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +60 -29
  28. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +19 -0
  29. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +19 -0
  30. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +72 -1
  31. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +19 -0
  32. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +19 -0
  33. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +19 -0
  34. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
  35. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +5 -10
  36. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +36 -8
  37. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +32 -2
  38. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +116 -156
  39. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.css +8 -0
  40. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +116 -0
  41. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +19 -142
  42. package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +7 -0
  43. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +36 -0
  44. package/dist/collection/components/snk-filter-bar/utils/filters-mock.js +315 -0
  45. package/dist/collection/components/snk-grid/snk-grid.js +8 -1
  46. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +16 -1
  47. package/dist/components/SnkMessageBuilder.js +16 -1
  48. package/dist/components/filter-item-type.enum.js +1 -0
  49. package/dist/components/index.d.ts +1 -0
  50. package/dist/components/index.js +1 -0
  51. package/dist/components/presentationMode.js +7 -0
  52. package/dist/components/snk-crud.js +22 -34
  53. package/dist/components/snk-detail-view2.js +24 -46
  54. package/dist/components/snk-filter-bar2.js +57 -157
  55. package/dist/components/snk-filter-binary-select.js +27 -16
  56. package/dist/components/snk-filter-detail2.js +5 -10
  57. package/dist/components/snk-filter-item2.js +36 -8
  58. package/dist/components/snk-filter-list.js +171 -1
  59. package/dist/components/snk-filter-modal-item.d.ts +11 -0
  60. package/dist/components/snk-filter-modal-item.js +6 -0
  61. package/dist/components/snk-filter-modal-item2.js +86 -0
  62. package/dist/components/snk-filter-modal.js +118 -1
  63. package/dist/components/snk-filter-multi-select.js +3 -1
  64. package/dist/components/snk-filter-number.js +3 -1
  65. package/dist/components/snk-filter-period.js +20 -2
  66. package/dist/components/snk-filter-personalized.js +3 -1
  67. package/dist/components/snk-filter-search.js +3 -1
  68. package/dist/components/snk-filter-text.js +3 -1
  69. package/dist/components/snk-grid2.js +18 -23
  70. package/dist/esm/{SnkMessageBuilder-f3590f65.js → SnkMessageBuilder-4caf8b4f.js} +16 -1
  71. package/dist/esm/{filter-item-type.enum-a79b2fa8.js → filter-item-type.enum-5028ed3f.js} +1 -0
  72. package/dist/esm/filter-type.enum-a80c1b6b.js +9 -0
  73. package/dist/esm/loader.js +1 -1
  74. package/dist/esm/presentationMode-783bbf9d.js +7 -0
  75. package/dist/esm/sankhyablocks.js +1 -1
  76. package/dist/esm/snk-application.entry.js +1 -1
  77. package/dist/esm/snk-data-exporter.entry.js +2 -2
  78. package/dist/esm/{snk-data-unit-50b1660c.js → snk-data-unit-640399b3.js} +1 -1
  79. package/dist/esm/snk-data-unit.entry.js +2 -2
  80. package/dist/esm/snk-detail-view.entry.js +1 -1
  81. package/dist/esm/snk-filter-bar.entry.js +53 -141
  82. package/dist/esm/snk-filter-binary-select.entry.js +27 -16
  83. package/dist/esm/snk-filter-detail.entry.js +6 -11
  84. package/dist/esm/snk-filter-item.entry.js +37 -9
  85. package/dist/esm/snk-filter-modal-item.entry.js +63 -0
  86. package/dist/esm/snk-filter-modal.entry.js +73 -50
  87. package/dist/esm/snk-filter-multi-select.entry.js +4 -2
  88. package/dist/esm/snk-filter-number.entry.js +4 -2
  89. package/dist/esm/snk-filter-period.entry.js +19 -3
  90. package/dist/esm/snk-filter-personalized.entry.js +4 -2
  91. package/dist/esm/snk-filter-search.entry.js +4 -2
  92. package/dist/esm/snk-filter-text.entry.js +3 -1
  93. package/dist/esm/snk-grid.entry.js +8 -1
  94. package/dist/sankhyablocks/p-08779202.entry.js +1 -0
  95. package/dist/sankhyablocks/p-1465f132.entry.js +1 -0
  96. package/dist/sankhyablocks/p-1a68fb59.js +1 -0
  97. package/dist/sankhyablocks/{p-f344b811.entry.js → p-21c2b733.entry.js} +1 -1
  98. package/dist/sankhyablocks/p-29c1889f.js +1 -0
  99. package/dist/sankhyablocks/p-355e7ab0.entry.js +1 -0
  100. package/dist/sankhyablocks/p-3794686e.entry.js +1 -0
  101. package/dist/sankhyablocks/{p-c4417efb.entry.js → p-4181c36d.entry.js} +1 -1
  102. package/dist/sankhyablocks/p-4ce96831.entry.js +1 -0
  103. package/dist/sankhyablocks/{p-3fbe2d69.entry.js → p-57b74971.entry.js} +1 -1
  104. package/dist/sankhyablocks/{p-9dd2b8cb.js → p-584d7212.js} +1 -1
  105. package/dist/sankhyablocks/p-59705471.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-3d3263b4.js → p-6981c03e.js} +1 -1
  107. package/dist/sankhyablocks/p-786ae316.entry.js +1 -0
  108. package/dist/sankhyablocks/p-80e52e85.entry.js +1 -0
  109. package/dist/sankhyablocks/p-8efb0f47.entry.js +1 -0
  110. package/dist/sankhyablocks/p-9af04fc7.entry.js +1 -0
  111. package/dist/sankhyablocks/{p-df8f13b4.entry.js → p-9c3f0caf.entry.js} +1 -1
  112. package/dist/sankhyablocks/p-9cbc3925.entry.js +1 -0
  113. package/dist/sankhyablocks/p-b9fb86fe.entry.js +1 -0
  114. package/dist/sankhyablocks/p-d9804798.js +1 -0
  115. package/dist/sankhyablocks/p-e2bb9c9a.entry.js +1 -0
  116. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  117. package/dist/types/components/snk-filter-bar/filter-item/editors/enum/presentationMode.d.ts +4 -0
  118. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +5 -0
  119. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
  120. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +11 -1
  121. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +37 -0
  122. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +17 -0
  123. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +2 -11
  124. package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +6 -0
  125. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +20 -0
  126. package/dist/types/components/snk-filter-bar/utils/filters-mock.d.ts +186 -0
  127. package/dist/types/components.d.ts +119 -56
  128. package/package.json +1 -1
  129. package/react/components.d.ts +1 -0
  130. package/react/components.js +1 -0
  131. package/react/components.js.map +1 -1
  132. package/dist/components/snk-filter-list2.js +0 -173
  133. package/dist/components/snk-filter-modal2.js +0 -97
  134. package/dist/sankhyablocks/p-1dcfd32a.entry.js +0 -1
  135. package/dist/sankhyablocks/p-3a2ce158.entry.js +0 -1
  136. package/dist/sankhyablocks/p-5e62a17b.entry.js +0 -1
  137. package/dist/sankhyablocks/p-5fc55684.entry.js +0 -1
  138. package/dist/sankhyablocks/p-73e830cf.entry.js +0 -1
  139. package/dist/sankhyablocks/p-86d29b6f.entry.js +0 -1
  140. package/dist/sankhyablocks/p-ad51bf1c.entry.js +0 -1
  141. package/dist/sankhyablocks/p-afba9bbe.entry.js +0 -1
  142. package/dist/sankhyablocks/p-c336170d.entry.js +0 -1
  143. package/dist/sankhyablocks/p-c9477950.js +0 -1
  144. package/dist/sankhyablocks/p-d5c9c1f8.entry.js +0 -1
  145. package/dist/sankhyablocks/p-ee82c157.entry.js +0 -1
  146. package/dist/sankhyablocks/p-fac37198.entry.js +0 -1
@@ -1,12 +1,17 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
+ import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
4
5
 
5
6
  const SnkFilterBinarySelect = class {
6
7
  constructor(hostRef) {
7
8
  registerInstance(this, hostRef);
9
+ this.valueChanged = createEvent(this, "valueChanged", 7);
10
+ this._noOptionValue = 'NO_VALUE';
11
+ this._radioButtonValue = undefined;
8
12
  this.value = undefined;
9
13
  this.config = undefined;
14
+ this.presentationMode = EPresentationMode.CHIP;
10
15
  }
11
16
  isSelected(option) {
12
17
  return this.value == undefined || this.value === option;
@@ -15,15 +20,15 @@ const SnkFilterBinarySelect = class {
15
20
  * Emitido quando acontece a alteração de valor do componente snk-filter-binary-select
16
21
  */
17
22
  ezChangeListener(evt) {
18
- if (!evt.detail) {
19
- this.assertCheckedOption(evt.target);
20
- }
21
- this.updateValue();
22
- }
23
- componentDidLoad() {
24
- if (this._element) {
25
- ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
23
+ if (this.presentationMode === EPresentationMode.MODAL) {
24
+ if (!evt.detail) {
25
+ this.assertCheckedOption(evt.target);
26
+ }
27
+ this.updateValue();
28
+ return;
26
29
  }
30
+ this.value = evt.detail === this._noOptionValue ? undefined : evt.detail;
31
+ this._radioButtonValue = evt.detail;
27
32
  }
28
33
  assertCheckedOption(updatingCheck) {
29
34
  if (updatingCheck === this._checkOne) {
@@ -41,19 +46,25 @@ const SnkFilterBinarySelect = class {
41
46
  else {
42
47
  this.value = undefined;
43
48
  }
49
+ this.valueChanged.emit(this.value);
44
50
  }
45
- /**
46
- * Exibe o componente snk-filter-binary-select
47
- */
48
- async show() {
49
- this._checkOne.setFocus();
51
+ componentDidLoad() {
52
+ if (this._element) {
53
+ ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
54
+ }
55
+ }
56
+ componentWillLoad() {
57
+ this._radioButtonValue = this.value || this._noOptionValue;
50
58
  }
51
59
  render() {
52
60
  if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
53
61
  return undefined;
54
62
  }
55
63
  const [optOne, optTwo] = this.config.props.options;
56
- return (h(Host, null, h("ez-check", { id: `${this.config.id}_${optOne.name || "option1"}`, label: optOne.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkOne = ref, value: this.isSelected(optOne.name) }), h("ez-check", { id: `${this.config.id}_${optTwo.name || "option2"}`, label: optTwo.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkTwo = ref, value: this.isSelected(optTwo.name) })));
64
+ if (this.presentationMode === EPresentationMode.MODAL) {
65
+ return (h(Host, null, h("div", { class: "ez-flex ez-flex--row ez-flex--align-items-center" }, h("label", { class: "ez-text ez-title--small ez-title--primary", style: { flex: '1 1 0', width: '0px' } }, this.config.detailModal), h("ez-check", { compact: true, style: { flex: '1 1 0', width: '0px' }, id: `${this.config.id}_${optOne.name || "option1"}`, label: optOne.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkOne = ref, value: this.isSelected(optOne.name) }), h("ez-check", { compact: true, style: { flex: '1 1 0', width: '0px' }, id: `${this.config.id}_${optTwo.name || "option2"}`, label: optTwo.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkTwo = ref, value: this.isSelected(optTwo.name) }))));
66
+ }
67
+ 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 }))));
57
68
  }
58
69
  get _element() { return getElement(this); }
59
70
  };
@@ -1,6 +1,6 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
4
  import { ElementIDUtils, DataType } from '@sankhyalabs/core';
5
5
 
6
6
  const SnkFilterDetail = class {
@@ -14,7 +14,8 @@ const SnkFilterDetail = class {
14
14
  * Exibe o componente snk-filter-detail.
15
15
  */
16
16
  async show() {
17
- this._editor["show"]();
17
+ var _a, _b;
18
+ (_b = (_a = this._editor)["show"]) === null || _b === void 0 ? void 0 : _b.call(_a);
18
19
  }
19
20
  componentDidLoad() {
20
21
  if (this._element) {
@@ -47,13 +48,7 @@ const SnkFilterDetail = class {
47
48
  this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
48
49
  }
49
50
  getPopUpHeaderButtons() {
50
- if (this.config.hardFixed) {
51
- return undefined;
52
- }
53
- return ([
54
- this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()),
55
- this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))
56
- ]);
51
+ return (h(Fragment, null, !this.config.removalBlocked && this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()), !this.config.hardFixed && this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))));
57
52
  }
58
53
  buildIcon(title, iconName, action) {
59
54
  return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", ref: elem => elem && this.buildIdButton(elem, title) }, h("ez-icon", Object.assign({ title: title, iconName: iconName }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`_${title}`)}` }))));
@@ -125,7 +120,7 @@ const SnkFilterDetail = class {
125
120
  }
126
121
  render() {
127
122
  const ContentEditor = this.getContentEditor();
128
- 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(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, 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" }))));
123
+ 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(ContentEditor, { 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 }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, 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" }))));
129
124
  }
130
125
  get _element() { return getElement(this); }
131
126
  };
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
2
- import { FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
2
+ import { FloatingManager, DateUtils, ElementIDUtils } from '@sankhyalabs/core';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
4
 
5
5
  const SnkFilterItem = class {
6
6
  constructor(hostRef) {
@@ -114,16 +114,17 @@ const SnkFilterItem = class {
114
114
  evt.stopPropagation();
115
115
  }
116
116
  }
117
- getLabel() {
117
+ getLabel(isTooltipLabel = false) {
118
118
  const { type, value, label, props } = this.config;
119
119
  if (value) {
120
120
  if (type === FilterItemType.BINARY_SELECT) {
121
121
  const [optOne, optTwo] = props.options;
122
+ const tooltip = this.getMessage('snkFilterBar.binarySelectTooltip');
122
123
  if (optOne.name === value) {
123
- return optOne.label;
124
+ return isTooltipLabel ? `${tooltip} ${String(optOne.label).toLowerCase()}` : optOne.label;
124
125
  }
125
126
  if (optTwo.name === value) {
126
- return optTwo.label;
127
+ return isTooltipLabel ? `${tooltip} ${String(optTwo.label).toLowerCase()}` : optTwo.label;
127
128
  }
128
129
  }
129
130
  if (type === FilterItemType.MULTI_SELECT) {
@@ -142,14 +143,21 @@ const SnkFilterItem = class {
142
143
  }
143
144
  const dateFormater = new Intl.DateTimeFormat("pt-BR");
144
145
  if (end && start) {
145
- return `${label}: ${dateFormater.format(start)} a ${dateFormater.format(end)}`;
146
+ const isSameYear = start.getFullYear() === end.getFullYear();
147
+ const formatOptions = Object.assign({ day: '2-digit', month: '2-digit' }, ((!isSameYear || isTooltipLabel) && { year: '2-digit' }));
148
+ const startLabel = DateUtils.formatDate(start, formatOptions);
149
+ const endLabel = DateUtils.formatDate(end, formatOptions);
150
+ if (isTooltipLabel) {
151
+ return this.getMessage('snkFilterBar.fullPeriodTooltip', { LABEL: label, START_LABEL: startLabel, END_LABEL: endLabel });
152
+ }
153
+ return `${label}: ${startLabel} \u2192 ${endLabel}`;
146
154
  }
147
155
  else {
148
156
  if (start) {
149
- return `${label}: A partir de ${dateFormater.format(start)}`;
157
+ return `${label}: ${this.getMessage('snkFilterBar.onlyStartPeriodToltip')} ${dateFormater.format(start)}`;
150
158
  }
151
159
  else if (end) {
152
- return `${label}: Até ${dateFormater.format(end)}`;
160
+ return `${label}: ${this.getMessage('snkFilterBar.onlyEndPeriodToltip')} ${dateFormater.format(end)}`;
153
161
  }
154
162
  else {
155
163
  return label;
@@ -162,10 +170,30 @@ const SnkFilterItem = class {
162
170
  if (type === FilterItemType.PERSONALIZED) {
163
171
  return label;
164
172
  }
173
+ if (type === FilterItemType.MULTI_LIST) {
174
+ const selectedOptions = value.filter(item => item.check);
175
+ const checkedAmount = selectedOptions.length;
176
+ if (checkedAmount > 1) {
177
+ if (isTooltipLabel) {
178
+ const selectedOptionsDescrptions = selectedOptions.map(item => item.description);
179
+ return `${label}: ${selectedOptionsDescrptions.join(',')}`;
180
+ }
181
+ return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
182
+ }
183
+ return `${label}: ${value.description}`;
184
+ }
165
185
  return `${label}: ${value}`;
166
186
  }
167
187
  return label;
168
188
  }
189
+ applyTooltip() {
190
+ if (!this.config.value)
191
+ return undefined;
192
+ return {
193
+ 'data-tooltip': this.getLabel(true),
194
+ 'data-flow': 'bottom'
195
+ };
196
+ }
169
197
  componentDidLoad() {
170
198
  if (this._filterItemElement) {
171
199
  ElementIDUtils.addIDInfo(this._filterItemElement);
@@ -203,7 +231,7 @@ const SnkFilterItem = class {
203
231
  }
204
232
  render() {
205
233
  const leftIcon = this.getLeftIconName();
206
- return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined, id: this.config.id }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
234
+ return (h(Host, Object.assign({}, this.applyTooltip()), h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
207
235
  }
208
236
  get _filterItemElement() { return getElement(this); }
209
237
  static get watchers() { return {
@@ -0,0 +1,63 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
2
+ import { ElementIDUtils } from '@sankhyalabs/core';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
+ import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
5
+ import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
6
+
7
+ const snkFilterModalItemCss = ".grow{flex-grow:1}.gap{gap:4px}";
8
+
9
+ const SnkFilterModalItem = class {
10
+ constructor(hostRef) {
11
+ registerInstance(this, hostRef);
12
+ this.filterChange = createEvent(this, "filterChange", 7);
13
+ this.filterItem = undefined;
14
+ }
15
+ observeFilterItem(newValue) {
16
+ this.filterChange.emit(newValue);
17
+ }
18
+ getContentEditorConfig() {
19
+ const variations = { presentationMode: EPresentationMode.MODAL };
20
+ switch (this.filterItem.type) {
21
+ case FilterItemType.BINARY_SELECT:
22
+ return { tag: "snk-filter-binary-select", variations };
23
+ case FilterItemType.MULTI_SELECT:
24
+ return { tag: "snk-filter-multi-select" };
25
+ case FilterItemType.PERIOD:
26
+ return { tag: "snk-filter-period", variations };
27
+ case FilterItemType.SEARCH:
28
+ return { tag: "snk-filter-search" };
29
+ case FilterItemType.NUMBER:
30
+ return { tag: "snk-filter-number" };
31
+ case FilterItemType.PERSONALIZED:
32
+ return { tag: "snk-filter-personalized" };
33
+ case FilterItemType.MULTI_LIST:
34
+ return { tag: "snk-entity-list" };
35
+ }
36
+ return { tag: "snk-filter-text" };
37
+ }
38
+ updateFilterValue(newValue) {
39
+ const isVisble = !this.filterItem.visible ? newValue !== undefined : true;
40
+ this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: newValue, visible: isVisble });
41
+ }
42
+ canShowDetailModal() {
43
+ return this.filterItem.filterType !== FilterType.OTHER_FILTERS && this.filterItem.type !== FilterItemType.BINARY_SELECT;
44
+ }
45
+ componentDidLoad() {
46
+ if (this._element) {
47
+ ElementIDUtils.addIDInfo(this._element);
48
+ const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
49
+ this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
50
+ }
51
+ }
52
+ render() {
53
+ const { tag: ContentEditor, variations } = this.getContentEditorConfig();
54
+ return (h(Host, null, h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-title ez-title--small ez-title--primary grow" }, this.filterItem.detailModal))), h(ContentEditor, Object.assign({ config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, variations)))));
55
+ }
56
+ get _element() { return getElement(this); }
57
+ static get watchers() { return {
58
+ "filterItem": ["observeFilterItem"]
59
+ }; }
60
+ };
61
+ SnkFilterModalItem.style = snkFilterModalItemCss;
62
+
63
+ export { SnkFilterModalItem as snk_filter_modal_item };
@@ -1,70 +1,93 @@
1
1
  import { r as registerInstance, h } from './index-cfd4bb13.js';
2
- import { ModalAction, ModalButtonStatus } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
3
- import { ArrayUtils } from '@sankhyalabs/core';
4
- import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
2
+ import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
3
+ import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
4
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
5
5
 
6
- const snkFilterModalCss = ".snk-filter__modal-container{width:359px;max-width:359px}";
6
+ const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter__modal-container{width:344px;max-width:344px;overflow:hidden}.snk-filter__modal-content{display:flex;flex-direction:column;gap:12px;max-height:760px;overflow-x:clip;overflow-y:auto;padding-right:4px}.snk-filter__modal-content::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}.snk-filter__modal-collapsible-box{border:1px solid #DCE0E8;border-radius:var(--border--radius-medium);padding:12px 6px}";
7
7
 
8
8
  const SnkFilterModal = class {
9
9
  constructor(hostRef) {
10
10
  registerInstance(this, hostRef);
11
- this._filterArgument = undefined;
12
11
  this.getMessage = undefined;
13
- this.items = undefined;
14
- this.modalTitle = undefined;
15
- this.modalSubTitle = undefined;
16
- this.cancelButtonLabel = undefined;
17
- this.okButtonLabel = undefined;
18
- this.infoText = undefined;
19
- this.useSearch = undefined;
20
- this.processModalAction = undefined;
12
+ this.filters = undefined;
13
+ this.applyFilters = undefined;
14
+ this.clearAll = undefined;
15
+ this.closeModal = undefined;
21
16
  }
22
- updateValue(id, value = undefined) {
23
- this.items = this.items.map(item => {
24
- if (item.id === id && item.enabled) {
25
- if (value == undefined) {
26
- value = !item.active;
27
- }
28
- return Object.assign(Object.assign({}, item), { active: value });
29
- }
30
- return item;
31
- });
17
+ getCustomMessage(key, params) {
18
+ var _a;
19
+ return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
20
+ }
21
+ handleClearAll() {
22
+ const cleanedFilters = this.clearAll(this.filters);
23
+ this.filters = cleanedFilters;
32
24
  }
33
- getActiveFiltersMsg() {
34
- const activeFilters = this.items.filter(item => item.active).length;
35
- if (activeFilters === 0) {
36
- return this.getMessage("snkFilterBar.noActiveFilters");
25
+ modalActionListener(evt) {
26
+ const modalAction = evt.detail;
27
+ switch (modalAction) {
28
+ case ModalAction.CANCEL:
29
+ this.handleClearAll();
30
+ break;
31
+ case ModalAction.OK:
32
+ this.applyFilters(this.filters);
33
+ case ModalAction.CLOSE:
34
+ this.closeModal();
37
35
  }
38
- return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
39
36
  }
40
- buildItems(list) {
41
- return list.map(item => {
42
- return (h("button", { onClick: () => this.updateValue(item.id), class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, h("ez-check", { id: `checkbox_${item.id}`, tabIndex: -1, class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: CheckMode.SWITCH }), h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)));
43
- });
37
+ handleFilterChange(filterConfig) {
38
+ this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
44
39
  }
45
- itemKeyBoardSelect(event, item) {
46
- if (event.key === "Enter" || event.key === " ") {
47
- this.updateValue(item.id);
48
- }
40
+ handleClearFilters(filterList) {
41
+ this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
49
42
  }
50
- modalActionListener(evt) {
51
- const modalAction = evt.detail;
52
- if (modalAction === ModalAction.LOAD) {
53
- if (this._filterInput) {
54
- this._filterInput.setFocus();
43
+ renderFilterItem(filterItem, fullRow) {
44
+ 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, onFilterChange: (event) => this.handleFilterChange(event.detail) }));
45
+ }
46
+ mountFiltersLines(filters) {
47
+ const MAX_LINE_LENGTH = 2;
48
+ let currentLine = 0;
49
+ let forceAddCurrent = false;
50
+ const filtersLines = {};
51
+ for (let curr = 0; curr < filters.length; curr++) {
52
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
53
+ const item = filters[curr];
54
+ const isLast = curr === filters.length - 1;
55
+ const currentItemMatch = [FilterItemType.TEXT, FilterItemType.NUMBER].includes(item.type);
56
+ const nextItemMatch = isLast ? false : [FilterItemType.TEXT, FilterItemType.NUMBER].includes(filters[curr + 1].type);
57
+ if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
58
+ filtersLines[currentLine].push(item);
59
+ forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
60
+ if (filtersLines[currentLine].length === MAX_LINE_LENGTH)
61
+ ++currentLine;
62
+ continue;
55
63
  }
64
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
65
+ filtersLines[currentLine].push(item);
66
+ ++currentLine;
56
67
  }
57
- else {
58
- this.processModalAction(modalAction);
59
- }
68
+ return Object.values(filtersLines);
69
+ }
70
+ renderFilterLine(filters) {
71
+ const fullLine = filters.length === 1;
72
+ return (h("div", { class: "ez-row" }, filters.map((filter) => this.renderFilterItem(filter, fullLine))));
73
+ }
74
+ renderCollapsibleFilterBox(label, listItems) {
75
+ if (!listItems.length)
76
+ return null;
77
+ const appliedFilters = listItems.filter(filterItem => !!filterItem.value).length;
78
+ const lines = this.mountFiltersLines(listItems);
79
+ return (h("ez-collapsible-box", { className: "snk-filter__modal-collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (h("ez-badge", { className: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters })), lines.map(this.renderFilterLine.bind(this)), h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { className: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => this.handleClearFilters(listItems) }))));
80
+ }
81
+ componentWillRender() {
82
+ this._modalTitle = this.getCustomMessage('title');
83
+ this._okButtonLabel = this.getCustomMessage('okButtonLabel');
84
+ this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
60
85
  }
61
86
  render() {
62
- const allowCancel = this.items.filter(item => item.active).length > 0;
63
- const items = (this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : []);
64
- return (h("ez-modal-container", { class: "snk-filter__modal-container", modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.modalActionListener(evt), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ?
65
- h("ez-filter-input", { ref: ref => this._filterInput = ref, label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail })
66
- :
67
- undefined), items.length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.buildItems(items)), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
87
+ const customFilters = this.filters.filter(filter => filter.filterType === FilterType.CUSTOM_FILTER);
88
+ const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
89
+ const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
90
+ 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" }, this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter])))));
68
91
  }
69
92
  };
70
93
  SnkFilterModal.style = snkFilterModalCss;
@@ -1,10 +1,11 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
4
 
5
5
  const SnkFilterMultiSelect = class {
6
6
  constructor(hostRef) {
7
7
  registerInstance(this, hostRef);
8
+ this.valueChanged = createEvent(this, "valueChanged", 7);
8
9
  this.value = undefined;
9
10
  this.config = undefined;
10
11
  }
@@ -13,6 +14,7 @@ const SnkFilterMultiSelect = class {
13
14
  */
14
15
  ezChangeListener(evt) {
15
16
  this.value = evt.detail.value;
17
+ this.valueChanged.emit(this.value);
16
18
  }
17
19
  /**
18
20
  * Exibe o componente snk-filter-multi-select
@@ -1,10 +1,11 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
4
 
5
5
  const SnkFilterPeriod = class {
6
6
  constructor(hostRef) {
7
7
  registerInstance(this, hostRef);
8
+ this.valueChanged = createEvent(this, "valueChanged", 7);
8
9
  this.config = undefined;
9
10
  this.value = undefined;
10
11
  }
@@ -13,6 +14,7 @@ const SnkFilterPeriod = class {
13
14
  */
14
15
  ezChangeListener(evt) {
15
16
  this.value = evt.detail;
17
+ this.valueChanged.emit(this.value);
16
18
  }
17
19
  /**
18
20
  * Exibe o componente snk-filter-number
@@ -1,12 +1,18 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
+ import { E as EPresentationMode } from './presentationMode-783bbf9d.js';
4
5
 
5
6
  const SnkFilterPeriod = class {
6
7
  constructor(hostRef) {
7
8
  registerInstance(this, hostRef);
9
+ this.valueChanged = createEvent(this, "valueChanged", 7);
10
+ this._startDateLabel = 'Inicial';
11
+ this._endDateLabel = 'Final';
8
12
  this.config = undefined;
13
+ this.getMessage = undefined;
9
14
  this.value = undefined;
15
+ this.presentationMode = EPresentationMode.CHIP;
10
16
  }
11
17
  /**
12
18
  * Emitido quando acontece a alteração de valor do componente snk-filter-period
@@ -15,6 +21,7 @@ const SnkFilterPeriod = class {
15
21
  const start = this._startDate.value;
16
22
  const end = this._endDate.value;
17
23
  this.value = (start || end ? { start, end } : undefined);
24
+ this.valueChanged.emit(this.value);
18
25
  }
19
26
  componentDidLoad() {
20
27
  if (this._element) {
@@ -39,11 +46,20 @@ const SnkFilterPeriod = class {
39
46
  async show() {
40
47
  this._startDate.setFocus();
41
48
  }
49
+ buildLabel() {
50
+ if (this.presentationMode === EPresentationMode.CHIP) {
51
+ return h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9");
52
+ }
53
+ }
54
+ componentWillLoad() {
55
+ this._startDateLabel = this.getMessage('snkFilterBar.labelStartDatePeriod');
56
+ this._endDateLabel = this.getMessage('snkFilterBar.labelEndDatePeriod');
57
+ }
42
58
  render() {
43
59
  if (!this.config || this.config.type !== FilterItemType.PERIOD) {
44
60
  return undefined;
45
61
  }
46
- return (h("div", { class: "ez-col ez-col--nowrap" }, h("ez-date-input", { id: `${this.config.id}_start`, label: this.config.label, ref: ref => this._startDate = ref, value: this.getDate("start") }), h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9"), h("ez-date-input", { id: `${this.config.id}_end`, label: this.config.label, ref: ref => this._endDate = ref, value: this.getDate("end") })));
62
+ return (h("div", { class: "ez-col ez-col--nowrap" }, h("ez-date-input", { id: `${this.config.id}_start`, class: this.presentationMode === EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this._startDateLabel, ref: ref => this._startDate = ref, value: this.getDate("start") }), this.buildLabel(), h("ez-date-input", { id: `${this.config.id}_end`, class: this.presentationMode === EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this._endDateLabel, ref: ref => this._endDate = ref, value: this.getDate("end") })));
47
63
  }
48
64
  get _element() { return getElement(this); }
49
65
  };
@@ -1,12 +1,13 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils, UserInterface, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
4
4
  import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
5
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
5
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
6
6
 
7
7
  const SnkFilterPersonalized = class {
8
8
  constructor(hostRef) {
9
9
  registerInstance(this, hostRef);
10
+ this.valueChanged = createEvent(this, "valueChanged", 7);
10
11
  this.config = undefined;
11
12
  this.value = undefined;
12
13
  this.fix = undefined;
@@ -38,6 +39,7 @@ const SnkFilterPersonalized = class {
38
39
  if (this.value.filter(item => item != undefined).length == 0) {
39
40
  this.value = null;
40
41
  }
42
+ this.valueChanged.emit(this.value || []);
41
43
  }
42
44
  doSearch(mode, argument, param) {
43
45
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -1,10 +1,11 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-5028ed3f.js';
4
4
 
5
5
  const SnkFilterSearch = class {
6
6
  constructor(hostRef) {
7
7
  registerInstance(this, hostRef);
8
+ this.valueChanged = createEvent(this, "valueChanged", 7);
8
9
  this.config = undefined;
9
10
  this.value = undefined;
10
11
  }
@@ -13,6 +14,7 @@ const SnkFilterSearch = class {
13
14
  */
14
15
  ezChangeListener(_evt) {
15
16
  this.value = this._searchInput.value;
17
+ this.valueChanged.emit(this.value);
16
18
  }
17
19
  componentDidLoad() {
18
20
  if (this._element) {
@@ -1,9 +1,10 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
3
 
4
4
  const SnkFilterText = class {
5
5
  constructor(hostRef) {
6
6
  registerInstance(this, hostRef);
7
+ this.valueChanged = createEvent(this, "valueChanged", 7);
7
8
  this.config = undefined;
8
9
  this.value = undefined;
9
10
  }
@@ -12,6 +13,7 @@ const SnkFilterText = class {
12
13
  */
13
14
  ezChangeListener(evt) {
14
15
  this.value = evt.detail;
16
+ this.valueChanged.emit(this.value);
15
17
  }
16
18
  componentDidLoad() {
17
19
  if (this._element) {
@@ -222,10 +222,12 @@ const SnkGrid = class {
222
222
  if (!this._dataUnit) {
223
223
  this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
224
224
  this._dataUnit = evt.detail;
225
+ this._dataUnitLoadLockerResolver = this._dataUnit.addLoadingLocker();
225
226
  this.addElementID();
226
227
  });
227
228
  }
228
229
  else {
230
+ this._dataUnitLoadLockerResolver = this._dataUnit.addLoadingLocker();
229
231
  this.addElementID();
230
232
  }
231
233
  this._snkDataUnit.addEventListener("dataStateChange", (evt) => {
@@ -275,13 +277,18 @@ const SnkGrid = class {
275
277
  getPrimaryButton() {
276
278
  return this.presentationMode === PresentationMode.PRIMARY ? "INSERT" : "";
277
279
  }
280
+ onEzGridReady() {
281
+ var _a;
282
+ (_a = this._dataUnitLoadLockerResolver) === null || _a === void 0 ? void 0 : _a.call(this);
283
+ this._dataUnitLoadLockerResolver = undefined;
284
+ }
278
285
  render() {
279
286
  var _a, _b;
280
287
  if (!this._dataUnit) {
281
288
  return undefined;
282
289
  }
283
290
  return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--medium" }, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder }), ((_b = (_a = this._snkFilterBar) === null || _a === void 0 ? void 0 : _a.filterConfig) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
284
- h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton() })), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig() }))));
291
+ h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton() })), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, onComponentReady: () => this.onEzGridReady() }, h("snk-taskbar", { dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), application: this._application, selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig() }))));
285
292
  }
286
293
  get _element() { return getElement(this); }
287
294
  };