@sankhyalabs/sankhyablocks 5.6.0 → 5.7.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 (136) hide show
  1. package/dist/cjs/{SnkMessageBuilder-e64dce7f.js → SnkMessageBuilder-056d1c24.js} +9 -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-289081c4.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 +8 -1
  14. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-filter-item.cjs.entry.js +1 -1
  16. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +66 -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 +11 -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/collection/collection-manifest.json +1 -0
  25. package/dist/collection/components/snk-filter-bar/filter-item/editors/enum/presentationMode.js +5 -0
  26. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +47 -0
  27. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +19 -0
  28. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +19 -0
  29. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +50 -1
  30. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +19 -0
  31. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +19 -0
  32. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +19 -0
  33. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
  34. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +31 -2
  35. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +116 -156
  36. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.css +4 -0
  37. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +115 -0
  38. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +19 -142
  39. package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +7 -0
  40. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +36 -0
  41. package/dist/collection/components/snk-filter-bar/utils/filters-mock.js +315 -0
  42. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +9 -1
  43. package/dist/components/SnkMessageBuilder.js +9 -1
  44. package/dist/components/filter-item-type.enum.js +1 -0
  45. package/dist/components/index.d.ts +1 -0
  46. package/dist/components/index.js +1 -0
  47. package/dist/components/presentationMode.js +7 -0
  48. package/dist/components/snk-crud.js +22 -34
  49. package/dist/components/snk-detail-view2.js +24 -46
  50. package/dist/components/snk-filter-bar2.js +57 -157
  51. package/dist/components/snk-filter-binary-select.js +9 -1
  52. package/dist/components/snk-filter-list.js +171 -1
  53. package/dist/components/snk-filter-modal-item.d.ts +11 -0
  54. package/dist/components/snk-filter-modal-item.js +6 -0
  55. package/dist/components/snk-filter-modal-item2.js +85 -0
  56. package/dist/components/snk-filter-modal.js +118 -1
  57. package/dist/components/snk-filter-multi-select.js +3 -1
  58. package/dist/components/snk-filter-number.js +3 -1
  59. package/dist/components/snk-filter-period.js +12 -2
  60. package/dist/components/snk-filter-personalized.js +3 -1
  61. package/dist/components/snk-filter-search.js +3 -1
  62. package/dist/components/snk-filter-text.js +3 -1
  63. package/dist/components/snk-grid2.js +10 -22
  64. package/dist/esm/{SnkMessageBuilder-f3590f65.js → SnkMessageBuilder-23272e07.js} +9 -1
  65. package/dist/esm/{filter-item-type.enum-a79b2fa8.js → filter-item-type.enum-5028ed3f.js} +1 -0
  66. package/dist/esm/filter-type.enum-a80c1b6b.js +9 -0
  67. package/dist/esm/loader.js +1 -1
  68. package/dist/esm/presentationMode-783bbf9d.js +7 -0
  69. package/dist/esm/sankhyablocks.js +1 -1
  70. package/dist/esm/snk-application.entry.js +1 -1
  71. package/dist/esm/snk-data-exporter.entry.js +2 -2
  72. package/dist/esm/{snk-data-unit-50b1660c.js → snk-data-unit-34dc5371.js} +1 -1
  73. package/dist/esm/snk-data-unit.entry.js +2 -2
  74. package/dist/esm/snk-detail-view.entry.js +1 -1
  75. package/dist/esm/snk-filter-bar.entry.js +53 -141
  76. package/dist/esm/snk-filter-binary-select.entry.js +9 -2
  77. package/dist/esm/snk-filter-detail.entry.js +1 -1
  78. package/dist/esm/snk-filter-item.entry.js +1 -1
  79. package/dist/esm/snk-filter-modal-item.entry.js +62 -0
  80. package/dist/esm/snk-filter-modal.entry.js +73 -50
  81. package/dist/esm/snk-filter-multi-select.entry.js +4 -2
  82. package/dist/esm/snk-filter-number.entry.js +4 -2
  83. package/dist/esm/snk-filter-period.entry.js +12 -3
  84. package/dist/esm/snk-filter-personalized.entry.js +4 -2
  85. package/dist/esm/snk-filter-search.entry.js +4 -2
  86. package/dist/esm/snk-filter-text.entry.js +3 -1
  87. package/dist/sankhyablocks/{p-f344b811.entry.js → p-0110b7da.entry.js} +1 -1
  88. package/dist/sankhyablocks/p-1a68fb59.js +1 -0
  89. package/dist/sankhyablocks/{p-3d3263b4.js → p-3db1d3de.js} +1 -1
  90. package/dist/sankhyablocks/p-45ee8b22.entry.js +1 -0
  91. package/dist/sankhyablocks/p-4ce96831.entry.js +1 -0
  92. package/dist/sankhyablocks/{p-9dd2b8cb.js → p-584d7212.js} +1 -1
  93. package/dist/sankhyablocks/{p-c4417efb.entry.js → p-64b03506.entry.js} +1 -1
  94. package/dist/sankhyablocks/p-7695c404.entry.js +1 -0
  95. package/dist/sankhyablocks/p-786ae316.entry.js +1 -0
  96. package/dist/sankhyablocks/p-82bc97da.entry.js +1 -0
  97. package/dist/sankhyablocks/p-8efb0f47.entry.js +1 -0
  98. package/dist/sankhyablocks/p-9af04fc7.entry.js +1 -0
  99. package/dist/sankhyablocks/{p-3a2ce158.entry.js → p-a1c58536.entry.js} +1 -1
  100. package/dist/sankhyablocks/{p-afba9bbe.entry.js → p-bdbb2672.entry.js} +1 -1
  101. package/dist/sankhyablocks/{p-3fbe2d69.entry.js → p-c1ab16d0.entry.js} +2 -2
  102. package/dist/sankhyablocks/p-d9804798.js +1 -0
  103. package/dist/sankhyablocks/p-e2bb9c9a.entry.js +1 -0
  104. package/dist/sankhyablocks/p-ed3d6ab4.entry.js +1 -0
  105. package/dist/sankhyablocks/p-ee1381f4.entry.js +1 -0
  106. package/dist/sankhyablocks/p-f5f36fbb.js +1 -0
  107. package/dist/sankhyablocks/p-ffac37d5.entry.js +1 -0
  108. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  109. package/dist/types/components/snk-filter-bar/filter-item/editors/enum/presentationMode.d.ts +4 -0
  110. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +5 -0
  111. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
  112. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +3 -0
  113. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +37 -0
  114. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +17 -0
  115. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +2 -11
  116. package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +6 -0
  117. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +20 -0
  118. package/dist/types/components/snk-filter-bar/utils/filters-mock.d.ts +186 -0
  119. package/dist/types/components.d.ts +113 -54
  120. package/package.json +1 -1
  121. package/react/components.d.ts +1 -0
  122. package/react/components.js +1 -0
  123. package/react/components.js.map +1 -1
  124. package/dist/components/snk-filter-list2.js +0 -173
  125. package/dist/components/snk-filter-modal2.js +0 -97
  126. package/dist/sankhyablocks/p-1dcfd32a.entry.js +0 -1
  127. package/dist/sankhyablocks/p-5e62a17b.entry.js +0 -1
  128. package/dist/sankhyablocks/p-5fc55684.entry.js +0 -1
  129. package/dist/sankhyablocks/p-73e830cf.entry.js +0 -1
  130. package/dist/sankhyablocks/p-86d29b6f.entry.js +0 -1
  131. package/dist/sankhyablocks/p-ad51bf1c.entry.js +0 -1
  132. package/dist/sankhyablocks/p-c336170d.entry.js +0 -1
  133. package/dist/sankhyablocks/p-c9477950.js +0 -1
  134. package/dist/sankhyablocks/p-d5c9c1f8.entry.js +0 -1
  135. package/dist/sankhyablocks/p-ee82c157.entry.js +0 -1
  136. package/dist/sankhyablocks/p-fac37198.entry.js +0 -1
@@ -4,71 +4,94 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
7
- const core = require('@sankhyalabs/core');
8
- const utils = require('@sankhyalabs/ezui/dist/collection/utils');
7
+ const filterType_enum = require('./filter-type.enum-b14ce507.js');
8
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
9
9
 
10
- const snkFilterModalCss = ".snk-filter__modal-container{width:359px;max-width:359px}";
10
+ 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)}";
11
11
 
12
12
  const SnkFilterModal = class {
13
13
  constructor(hostRef) {
14
14
  index.registerInstance(this, hostRef);
15
- this._filterArgument = undefined;
16
15
  this.getMessage = undefined;
17
- this.items = undefined;
18
- this.modalTitle = undefined;
19
- this.modalSubTitle = undefined;
20
- this.cancelButtonLabel = undefined;
21
- this.okButtonLabel = undefined;
22
- this.infoText = undefined;
23
- this.useSearch = undefined;
24
- this.processModalAction = undefined;
16
+ this.filters = undefined;
17
+ this.applyFilters = undefined;
18
+ this.clearAll = undefined;
19
+ this.closeModal = undefined;
25
20
  }
26
- updateValue(id, value = undefined) {
27
- this.items = this.items.map(item => {
28
- if (item.id === id && item.enabled) {
29
- if (value == undefined) {
30
- value = !item.active;
31
- }
32
- return Object.assign(Object.assign({}, item), { active: value });
33
- }
34
- return item;
35
- });
21
+ getCustomMessage(key, params) {
22
+ var _a;
23
+ return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
24
+ }
25
+ handleClearAll() {
26
+ const cleanedFilters = this.clearAll(this.filters);
27
+ this.filters = cleanedFilters;
36
28
  }
37
- getActiveFiltersMsg() {
38
- const activeFilters = this.items.filter(item => item.active).length;
39
- if (activeFilters === 0) {
40
- return this.getMessage("snkFilterBar.noActiveFilters");
29
+ modalActionListener(evt) {
30
+ const modalAction = evt.detail;
31
+ switch (modalAction) {
32
+ case ezModalContainer.ModalAction.CANCEL:
33
+ this.handleClearAll();
34
+ break;
35
+ case ezModalContainer.ModalAction.OK:
36
+ this.applyFilters(this.filters);
37
+ case ezModalContainer.ModalAction.CLOSE:
38
+ this.closeModal();
41
39
  }
42
- return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
43
40
  }
44
- buildItems(list) {
45
- return list.map(item => {
46
- return (index.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" }, index.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: utils.CheckMode.SWITCH }), index.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)));
47
- });
41
+ handleFilterChange(filterConfig) {
42
+ this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
48
43
  }
49
- itemKeyBoardSelect(event, item) {
50
- if (event.key === "Enter" || event.key === " ") {
51
- this.updateValue(item.id);
52
- }
44
+ handleClearFilters(filterList) {
45
+ this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
53
46
  }
54
- modalActionListener(evt) {
55
- const modalAction = evt.detail;
56
- if (modalAction === ezModalContainer.ModalAction.LOAD) {
57
- if (this._filterInput) {
58
- this._filterInput.setFocus();
47
+ renderFilterItem(filterItem, fullRow) {
48
+ return (index.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) }));
49
+ }
50
+ mountFiltersLines(filters) {
51
+ const MAX_LINE_LENGTH = 2;
52
+ let currentLine = 0;
53
+ let forceAddCurrent = false;
54
+ const filtersLines = {};
55
+ for (let curr = 0; curr < filters.length; curr++) {
56
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
57
+ const item = filters[curr];
58
+ const isLast = curr === filters.length - 1;
59
+ const currentItemMatch = [filterItemType_enum.FilterItemType.TEXT, filterItemType_enum.FilterItemType.NUMBER].includes(item.type);
60
+ const nextItemMatch = isLast ? false : [filterItemType_enum.FilterItemType.TEXT, filterItemType_enum.FilterItemType.NUMBER].includes(filters[curr + 1].type);
61
+ if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
62
+ filtersLines[currentLine].push(item);
63
+ forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
64
+ if (filtersLines[currentLine].length === MAX_LINE_LENGTH)
65
+ ++currentLine;
66
+ continue;
59
67
  }
68
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
69
+ filtersLines[currentLine].push(item);
70
+ ++currentLine;
60
71
  }
61
- else {
62
- this.processModalAction(modalAction);
63
- }
72
+ return Object.values(filtersLines);
73
+ }
74
+ renderFilterLine(filters) {
75
+ const fullLine = filters.length === 1;
76
+ return (index.h("div", { class: "ez-row" }, filters.map((filter) => this.renderFilterItem(filter, fullLine))));
77
+ }
78
+ renderCollapsibleFilterBox(label, listItems) {
79
+ if (!listItems.length)
80
+ return null;
81
+ const appliedFilters = listItems.filter(filterItem => !!filterItem.value).length;
82
+ const lines = this.mountFiltersLines(listItems);
83
+ return (index.h("ez-collapsible-box", { className: "snk-filter__modal-collapsible-box ez-padding--medium", headerSize: "medium", value: true, label: label }, !!appliedFilters && (index.h("ez-badge", { className: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters })), lines.map(this.renderFilterLine.bind(this)), index.h("div", { class: "ez-flex ez-flex--justify-end grow" }, index.h("ez-button", { className: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => this.handleClearFilters(listItems) }))));
84
+ }
85
+ componentWillRender() {
86
+ this._modalTitle = this.getCustomMessage('title');
87
+ this._okButtonLabel = this.getCustomMessage('okButtonLabel');
88
+ this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
64
89
  }
65
90
  render() {
66
- const allowCancel = this.items.filter(item => item.active).length > 0;
67
- const items = (this.items ? core.ArrayUtils.applyStringFilter(this._filterArgument, this.items) : []);
68
- return (index.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 ? ezModalContainer.ModalButtonStatus.ENABLED : ezModalContainer.ModalButtonStatus.DISABLED }, index.h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, index.h("div", null, this.useSearch ?
69
- index.h("ez-filter-input", { ref: ref => this._filterInput = ref, label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail })
70
- :
71
- undefined), items.length > 0 ? index.h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, index.h("div", null, this.buildItems(items)), index.h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
91
+ const customFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.CUSTOM_FILTER);
92
+ const quickFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.QUICK_FILTER);
93
+ const otherFilters = this.filters.filter(filter => filter.filterType === filterType_enum.FilterType.OTHER_FILTERS);
94
+ return (index.h("ez-modal-container", { class: "snk-filter__modal-container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, index.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])))));
72
95
  }
73
96
  };
74
97
  SnkFilterModal.style = snkFilterModalCss;
@@ -4,11 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
8
8
 
9
9
  const SnkFilterMultiSelect = class {
10
10
  constructor(hostRef) {
11
11
  index.registerInstance(this, hostRef);
12
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
12
13
  this.value = undefined;
13
14
  this.config = undefined;
14
15
  }
@@ -17,6 +18,7 @@ const SnkFilterMultiSelect = class {
17
18
  */
18
19
  ezChangeListener(evt) {
19
20
  this.value = evt.detail.value;
21
+ this.valueChanged.emit(this.value);
20
22
  }
21
23
  /**
22
24
  * Exibe o componente snk-filter-multi-select
@@ -4,11 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
8
8
 
9
9
  const SnkFilterPeriod = class {
10
10
  constructor(hostRef) {
11
11
  index.registerInstance(this, hostRef);
12
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
12
13
  this.config = undefined;
13
14
  this.value = undefined;
14
15
  }
@@ -17,6 +18,7 @@ const SnkFilterPeriod = class {
17
18
  */
18
19
  ezChangeListener(evt) {
19
20
  this.value = evt.detail;
21
+ this.valueChanged.emit(this.value);
20
22
  }
21
23
  /**
22
24
  * Exibe o componente snk-filter-number
@@ -4,13 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
8
+ const presentationMode = require('./presentationMode-52ec3bdd.js');
8
9
 
9
10
  const SnkFilterPeriod = class {
10
11
  constructor(hostRef) {
11
12
  index.registerInstance(this, hostRef);
13
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
12
14
  this.config = undefined;
13
15
  this.value = undefined;
16
+ this.presentationMode = presentationMode.EPresentationMode.CHIP;
14
17
  }
15
18
  /**
16
19
  * Emitido quando acontece a alteração de valor do componente snk-filter-period
@@ -19,6 +22,7 @@ const SnkFilterPeriod = class {
19
22
  const start = this._startDate.value;
20
23
  const end = this._endDate.value;
21
24
  this.value = (start || end ? { start, end } : undefined);
25
+ this.valueChanged.emit(this.value);
22
26
  }
23
27
  componentDidLoad() {
24
28
  if (this._element) {
@@ -43,11 +47,16 @@ const SnkFilterPeriod = class {
43
47
  async show() {
44
48
  this._startDate.setFocus();
45
49
  }
50
+ buildLabel() {
51
+ if (this.presentationMode === presentationMode.EPresentationMode.CHIP) {
52
+ return index.h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9");
53
+ }
54
+ }
46
55
  render() {
47
56
  if (!this.config || this.config.type !== filterItemType_enum.FilterItemType.PERIOD) {
48
57
  return undefined;
49
58
  }
50
- return (index.h("div", { class: "ez-col ez-col--nowrap" }, index.h("ez-date-input", { id: `${this.config.id}_start`, label: this.config.label, ref: ref => this._startDate = ref, value: this.getDate("start") }), index.h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9"), index.h("ez-date-input", { id: `${this.config.id}_end`, label: this.config.label, ref: ref => this._endDate = ref, value: this.getDate("end") })));
59
+ return (index.h("div", { class: "ez-col ez-col--nowrap" }, index.h("ez-date-input", { id: `${this.config.id}_start`, class: this.presentationMode === presentationMode.EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this.config.label, ref: ref => this._startDate = ref, value: this.getDate("start") }), this.buildLabel(), index.h("ez-date-input", { id: `${this.config.id}_end`, class: this.presentationMode === presentationMode.EPresentationMode.MODAL ? 'ez-padding--small' : '', label: this.config.label, ref: ref => this._endDate = ref, value: this.getDate("end") })));
51
60
  }
52
61
  get _element() { return index.getElement(this); }
53
62
  };
@@ -6,11 +6,12 @@ const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
8
8
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
9
- const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
9
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
10
10
 
11
11
  const SnkFilterPersonalized = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
14
15
  this.config = undefined;
15
16
  this.value = undefined;
16
17
  this.fix = undefined;
@@ -42,6 +43,7 @@ const SnkFilterPersonalized = class {
42
43
  if (this.value.filter(item => item != undefined).length == 0) {
43
44
  this.value = null;
44
45
  }
46
+ this.valueChanged.emit(this.value || []);
45
47
  }
46
48
  doSearch(mode, argument, param) {
47
49
  const application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -4,11 +4,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-21bd01e1.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const filterItemType_enum = require('./filter-item-type.enum-3daf58d3.js');
7
+ const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
8
8
 
9
9
  const SnkFilterSearch = class {
10
10
  constructor(hostRef) {
11
11
  index.registerInstance(this, hostRef);
12
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
12
13
  this.config = undefined;
13
14
  this.value = undefined;
14
15
  }
@@ -17,6 +18,7 @@ const SnkFilterSearch = class {
17
18
  */
18
19
  ezChangeListener(_evt) {
19
20
  this.value = this._searchInput.value;
21
+ this.valueChanged.emit(this.value);
20
22
  }
21
23
  componentDidLoad() {
22
24
  if (this._element) {
@@ -8,6 +8,7 @@ const core = require('@sankhyalabs/core');
8
8
  const SnkFilterText = class {
9
9
  constructor(hostRef) {
10
10
  index.registerInstance(this, hostRef);
11
+ this.valueChanged = index.createEvent(this, "valueChanged", 7);
11
12
  this.config = undefined;
12
13
  this.value = undefined;
13
14
  }
@@ -16,6 +17,7 @@ const SnkFilterText = class {
16
17
  */
17
18
  ezChangeListener(evt) {
18
19
  this.value = evt.detail;
20
+ this.valueChanged.emit(this.value);
19
21
  }
20
22
  componentDidLoad() {
21
23
  if (this._element) {
@@ -26,6 +26,7 @@
26
26
  "./components/snk-filter-bar/filter-item/editors/snk-filter-period.js",
27
27
  "./components/snk-filter-bar/filter-item/editors/snk-filter-search.js",
28
28
  "./components/snk-filter-bar/filter-item/editors/snk-filter-text.js",
29
+ "./components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js",
29
30
  "./components/snk-filter-field-search/snk-filter-field-search.js",
30
31
  "./components/snk-form/snk-form.js",
31
32
  "./components/snk-form/subcomponents/snk-config-options/snk-config-options.js",
@@ -0,0 +1,5 @@
1
+ export var EPresentationMode;
2
+ (function (EPresentationMode) {
3
+ EPresentationMode[EPresentationMode["CHIP"] = 0] = "CHIP";
4
+ EPresentationMode[EPresentationMode["MODAL"] = 1] = "MODAL";
5
+ })(EPresentationMode || (EPresentationMode = {}));
@@ -1,10 +1,12 @@
1
1
  import { ElementIDUtils } from '@sankhyalabs/core';
2
2
  import { h, Host } from '@stencil/core';
3
3
  import FilterItemType from '../filter-item-type.enum';
4
+ import { EPresentationMode } from './enum/presentationMode';
4
5
  export class SnkFilterBinarySelect {
5
6
  constructor() {
6
7
  this.value = undefined;
7
8
  this.config = undefined;
9
+ this.presentationMode = EPresentationMode.CHIP;
8
10
  }
9
11
  isSelected(option) {
10
12
  return this.value == undefined || this.value === option;
@@ -39,6 +41,7 @@ export class SnkFilterBinarySelect {
39
41
  else {
40
42
  this.value = undefined;
41
43
  }
44
+ this.valueChanged.emit(this.value);
42
45
  }
43
46
  /**
44
47
  * Exibe o componente snk-filter-binary-select
@@ -51,6 +54,9 @@ export class SnkFilterBinarySelect {
51
54
  return undefined;
52
55
  }
53
56
  const [optOne, optTwo] = this.config.props.options;
57
+ if (this.presentationMode === EPresentationMode.MODAL) {
58
+ return (h(Host, null, h("div", { class: "ez-flex ez-flex--row ez-flex--align-items-center" }, h("label", { class: "ez-text ez-text--medium ez-text--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) }))));
59
+ }
54
60
  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) })));
55
61
  }
56
62
  static get is() { return "snk-filter-binary-select"; }
@@ -92,9 +98,50 @@ export class SnkFilterBinarySelect {
92
98
  "tags": [],
93
99
  "text": "Define as configura\u00E7\u00F5es do componente snk-filter-binary-select"
94
100
  }
101
+ },
102
+ "presentationMode": {
103
+ "type": "number",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "EPresentationMode",
107
+ "resolved": "EPresentationMode.CHIP | EPresentationMode.MODAL",
108
+ "references": {
109
+ "EPresentationMode": {
110
+ "location": "import",
111
+ "path": "./enum/presentationMode"
112
+ }
113
+ }
114
+ },
115
+ "required": false,
116
+ "optional": false,
117
+ "docs": {
118
+ "tags": [],
119
+ "text": "Define a varia\u00E7\u00E3o do componente"
120
+ },
121
+ "attribute": "presentation-mode",
122
+ "reflect": false,
123
+ "defaultValue": "EPresentationMode.CHIP"
95
124
  }
96
125
  };
97
126
  }
127
+ static get events() {
128
+ return [{
129
+ "method": "valueChanged",
130
+ "name": "valueChanged",
131
+ "bubbles": true,
132
+ "cancelable": true,
133
+ "composed": true,
134
+ "docs": {
135
+ "tags": [],
136
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
137
+ },
138
+ "complexType": {
139
+ "original": "any",
140
+ "resolved": "any",
141
+ "references": {}
142
+ }
143
+ }];
144
+ }
98
145
  static get methods() {
99
146
  return {
100
147
  "show": {
@@ -11,6 +11,7 @@ export class SnkFilterMultiSelect {
11
11
  */
12
12
  ezChangeListener(evt) {
13
13
  this.value = evt.detail.value;
14
+ this.valueChanged.emit(this.value);
14
15
  }
15
16
  /**
16
17
  * Exibe o componente snk-filter-multi-select
@@ -71,6 +72,24 @@ export class SnkFilterMultiSelect {
71
72
  }
72
73
  };
73
74
  }
75
+ static get events() {
76
+ return [{
77
+ "method": "valueChanged",
78
+ "name": "valueChanged",
79
+ "bubbles": true,
80
+ "cancelable": true,
81
+ "composed": true,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
85
+ },
86
+ "complexType": {
87
+ "original": "any",
88
+ "resolved": "any",
89
+ "references": {}
90
+ }
91
+ }];
92
+ }
74
93
  static get methods() {
75
94
  return {
76
95
  "show": {
@@ -11,6 +11,7 @@ export class SnkFilterPeriod {
11
11
  */
12
12
  ezChangeListener(evt) {
13
13
  this.value = evt.detail;
14
+ this.valueChanged.emit(this.value);
14
15
  }
15
16
  /**
16
17
  * Exibe o componente snk-filter-number
@@ -72,6 +73,24 @@ export class SnkFilterPeriod {
72
73
  }
73
74
  };
74
75
  }
76
+ static get events() {
77
+ return [{
78
+ "method": "valueChanged",
79
+ "name": "valueChanged",
80
+ "bubbles": true,
81
+ "cancelable": true,
82
+ "composed": true,
83
+ "docs": {
84
+ "tags": [],
85
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
86
+ },
87
+ "complexType": {
88
+ "original": "any",
89
+ "resolved": "any",
90
+ "references": {}
91
+ }
92
+ }];
93
+ }
75
94
  static get methods() {
76
95
  return {
77
96
  "show": {
@@ -1,10 +1,12 @@
1
1
  import { ElementIDUtils } from '@sankhyalabs/core';
2
2
  import { h } from '@stencil/core';
3
3
  import FilterItemType from '../filter-item-type.enum';
4
+ import { EPresentationMode } from './enum/presentationMode';
4
5
  export class SnkFilterPeriod {
5
6
  constructor() {
6
7
  this.config = undefined;
7
8
  this.value = undefined;
9
+ this.presentationMode = EPresentationMode.CHIP;
8
10
  }
9
11
  /**
10
12
  * Emitido quando acontece a alteração de valor do componente snk-filter-period
@@ -13,6 +15,7 @@ export class SnkFilterPeriod {
13
15
  const start = this._startDate.value;
14
16
  const end = this._endDate.value;
15
17
  this.value = (start || end ? { start, end } : undefined);
18
+ this.valueChanged.emit(this.value);
16
19
  }
17
20
  componentDidLoad() {
18
21
  if (this._element) {
@@ -37,11 +40,16 @@ export class SnkFilterPeriod {
37
40
  async show() {
38
41
  this._startDate.setFocus();
39
42
  }
43
+ buildLabel() {
44
+ if (this.presentationMode === EPresentationMode.CHIP) {
45
+ return h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9");
46
+ }
47
+ }
40
48
  render() {
41
49
  if (!this.config || this.config.type !== FilterItemType.PERIOD) {
42
50
  return undefined;
43
51
  }
44
- 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") })));
52
+ 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.config.label, 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.config.label, ref: ref => this._endDate = ref, value: this.getDate("end") })));
45
53
  }
46
54
  static get is() { return "snk-filter-period"; }
47
55
  static get properties() {
@@ -82,9 +90,50 @@ export class SnkFilterPeriod {
82
90
  },
83
91
  "attribute": "value",
84
92
  "reflect": false
93
+ },
94
+ "presentationMode": {
95
+ "type": "number",
96
+ "mutable": false,
97
+ "complexType": {
98
+ "original": "EPresentationMode",
99
+ "resolved": "EPresentationMode.CHIP | EPresentationMode.MODAL",
100
+ "references": {
101
+ "EPresentationMode": {
102
+ "location": "import",
103
+ "path": "./enum/presentationMode"
104
+ }
105
+ }
106
+ },
107
+ "required": false,
108
+ "optional": false,
109
+ "docs": {
110
+ "tags": [],
111
+ "text": "Define a varia\u00E7\u00E3o do componente"
112
+ },
113
+ "attribute": "presentation-mode",
114
+ "reflect": false,
115
+ "defaultValue": "EPresentationMode.CHIP"
85
116
  }
86
117
  };
87
118
  }
119
+ static get events() {
120
+ return [{
121
+ "method": "valueChanged",
122
+ "name": "valueChanged",
123
+ "bubbles": true,
124
+ "cancelable": true,
125
+ "composed": true,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
129
+ },
130
+ "complexType": {
131
+ "original": "any",
132
+ "resolved": "any",
133
+ "references": {}
134
+ }
135
+ }];
136
+ }
88
137
  static get methods() {
89
138
  return {
90
139
  "show": {
@@ -36,6 +36,7 @@ export class SnkFilterPersonalized {
36
36
  if (this.value.filter(item => item != undefined).length == 0) {
37
37
  this.value = null;
38
38
  }
39
+ this.valueChanged.emit(this.value || []);
39
40
  }
40
41
  doSearch(mode, argument, param) {
41
42
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
@@ -171,6 +172,24 @@ export class SnkFilterPersonalized {
171
172
  }
172
173
  };
173
174
  }
175
+ static get events() {
176
+ return [{
177
+ "method": "valueChanged",
178
+ "name": "valueChanged",
179
+ "bubbles": true,
180
+ "cancelable": true,
181
+ "composed": true,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
185
+ },
186
+ "complexType": {
187
+ "original": "any",
188
+ "resolved": "any",
189
+ "references": {}
190
+ }
191
+ }];
192
+ }
174
193
  static get methods() {
175
194
  return {
176
195
  "show": {
@@ -11,6 +11,7 @@ export class SnkFilterSearch {
11
11
  */
12
12
  ezChangeListener(_evt) {
13
13
  this.value = this._searchInput.value;
14
+ this.valueChanged.emit(this.value);
14
15
  }
15
16
  componentDidLoad() {
16
17
  if (this._element) {
@@ -85,6 +86,24 @@ export class SnkFilterSearch {
85
86
  }
86
87
  };
87
88
  }
89
+ static get events() {
90
+ return [{
91
+ "method": "valueChanged",
92
+ "name": "valueChanged",
93
+ "bubbles": true,
94
+ "cancelable": true,
95
+ "composed": true,
96
+ "docs": {
97
+ "tags": [],
98
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
99
+ },
100
+ "complexType": {
101
+ "original": "any",
102
+ "resolved": "any",
103
+ "references": {}
104
+ }
105
+ }];
106
+ }
88
107
  static get methods() {
89
108
  return {
90
109
  "show": {
@@ -10,6 +10,7 @@ export class SnkFilterText {
10
10
  */
11
11
  ezChangeListener(evt) {
12
12
  this.value = evt.detail;
13
+ this.valueChanged.emit(this.value);
13
14
  }
14
15
  componentDidLoad() {
15
16
  if (this._element) {
@@ -64,6 +65,24 @@ export class SnkFilterText {
64
65
  }
65
66
  };
66
67
  }
68
+ static get events() {
69
+ return [{
70
+ "method": "valueChanged",
71
+ "name": "valueChanged",
72
+ "bubbles": true,
73
+ "cancelable": true,
74
+ "composed": true,
75
+ "docs": {
76
+ "tags": [],
77
+ "text": "Emitido quando o valor do filtro \u00E9 alterado."
78
+ },
79
+ "complexType": {
80
+ "original": "any",
81
+ "resolved": "any",
82
+ "references": {}
83
+ }
84
+ }];
85
+ }
67
86
  static get elementRef() { return "_element"; }
68
87
  static get listeners() {
69
88
  return [{