@sankhyalabs/sankhyablocks 1.3.31-beta.16 → 1.3.31-beta.17

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 (170) hide show
  1. package/dist/cjs/{SnkMessageBuilder-79cf15c5.js → SnkMessageBuilder-cb132e6d.js} +133 -1
  2. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  3. package/dist/cjs/css-shim-b8158822.js +6 -0
  4. package/dist/cjs/dom-36862b77.js +75 -0
  5. package/dist/cjs/filter-item-type.enum-e2e1bc5b.js +14 -0
  6. package/dist/cjs/index-02201bc9.js +2397 -0
  7. package/dist/cjs/{index-5575fe3d.js → index-b0b676c5.js} +1598 -145
  8. package/dist/cjs/loader.cjs.js +18 -2
  9. package/dist/cjs/sankhyablocks.cjs.js +116 -4
  10. package/dist/cjs/shadow-css-346c0795.js +389 -0
  11. package/dist/cjs/snk-application.cjs.entry.js +542 -66
  12. package/dist/cjs/snk-crud.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-data-unit.cjs.entry.js +23 -24
  14. package/dist/cjs/snk-filter-bar.cjs.entry.js +199 -0
  15. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +47 -0
  16. package/dist/cjs/snk-filter-detail.cjs.entry.js +44 -0
  17. package/dist/cjs/snk-filter-item.cjs.entry.js +131 -0
  18. package/dist/cjs/snk-filter-list.cjs.entry.js +91 -0
  19. package/dist/cjs/snk-filter-number.cjs.entry.js +23 -0
  20. package/dist/cjs/snk-filter-period.cjs.entry.js +26 -0
  21. package/dist/cjs/snk-filter-search.cjs.entry.js +44 -0
  22. package/dist/cjs/snk-filter-text.cjs.entry.js +22 -0
  23. package/dist/cjs/{snk-form_2.cjs.entry.js → snk-form.cjs.entry.js} +3 -65
  24. package/dist/cjs/snk-grid.cjs.entry.js +69 -0
  25. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  26. package/dist/cjs/snk-taskbar.cjs.entry.js +5 -4
  27. package/dist/cjs/{taskbar-elements-2ae0d005.js → taskbar-elements-efa44ff1.js} +1 -1
  28. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  29. package/dist/collection/collection-manifest.json +9 -0
  30. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +7 -0
  31. package/dist/collection/components/snk-application/snk-application.js +89 -17
  32. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +88 -0
  33. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +64 -0
  34. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +69 -0
  35. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +118 -0
  36. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
  37. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +10 -0
  38. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +113 -0
  39. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +209 -0
  40. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +182 -0
  41. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +99 -0
  42. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +257 -0
  43. package/dist/collection/components/snk-grid/snk-grid.css +14 -1
  44. package/dist/collection/components/snk-grid/snk-grid.js +1 -1
  45. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +24 -2
  46. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -1
  47. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +268 -0
  48. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  49. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -0
  50. package/dist/components/SnkMessageBuilder.js +133 -2
  51. package/dist/components/filter-item-type.enum.js +12 -0
  52. package/dist/components/index.d.ts +9 -0
  53. package/dist/components/index.js +13 -0
  54. package/dist/components/index2.js +2384 -0
  55. package/dist/components/snk-application2.js +508 -30
  56. package/dist/components/snk-crud.js +25 -1
  57. package/dist/components/snk-data-unit.js +2 -3
  58. package/dist/components/snk-filter-bar.d.ts +11 -0
  59. package/dist/components/snk-filter-bar.js +6 -0
  60. package/dist/components/snk-filter-bar2.js +230 -0
  61. package/dist/components/snk-filter-binary-select.d.ts +11 -0
  62. package/dist/components/snk-filter-binary-select.js +63 -0
  63. package/dist/components/snk-filter-detail.d.ts +11 -0
  64. package/dist/components/snk-filter-detail.js +6 -0
  65. package/dist/components/snk-filter-detail2.js +58 -0
  66. package/dist/components/snk-filter-item.d.ts +11 -0
  67. package/dist/components/snk-filter-item.js +6 -0
  68. package/dist/components/snk-filter-item2.js +151 -0
  69. package/dist/components/snk-filter-list.d.ts +11 -0
  70. package/dist/components/snk-filter-list.js +6 -0
  71. package/dist/components/snk-filter-list2.js +108 -0
  72. package/dist/components/snk-filter-number.d.ts +11 -0
  73. package/dist/components/snk-filter-number.js +39 -0
  74. package/dist/components/snk-filter-period.d.ts +11 -0
  75. package/dist/components/snk-filter-period.js +42 -0
  76. package/dist/components/snk-filter-search.d.ts +11 -0
  77. package/dist/components/snk-filter-search.js +62 -0
  78. package/dist/components/snk-filter-text.d.ts +11 -0
  79. package/dist/components/snk-filter-text.js +38 -0
  80. package/dist/components/snk-form2.js +1 -1
  81. package/dist/components/snk-grid2.js +28 -4
  82. package/dist/components/snk-pesquisa2.js +1 -1
  83. package/dist/components/snk-taskbar2.js +2 -1
  84. package/dist/components/teste-pesquisa.js +1 -1
  85. package/dist/esm/{SnkMessageBuilder-3cdde541.js → SnkMessageBuilder-cff80920.js} +133 -2
  86. package/dist/esm/app-globals-0f993ce5.js +3 -0
  87. package/dist/esm/css-shim-b3f2ee8d.js +4 -0
  88. package/dist/esm/dom-665d6011.js +73 -0
  89. package/dist/esm/filter-item-type.enum-61fbf80a.js +12 -0
  90. package/dist/esm/index-2b4d2d14.js +3262 -0
  91. package/dist/esm/index-e5b61043.js +2384 -0
  92. package/dist/esm/loader.js +18 -2
  93. package/dist/esm/sankhyablocks.js +116 -4
  94. package/dist/esm/shadow-css-b18e99d7.js +387 -0
  95. package/dist/esm/snk-application.entry.js +507 -31
  96. package/dist/esm/snk-crud.entry.js +1 -1
  97. package/dist/esm/snk-data-unit.entry.js +3 -4
  98. package/dist/esm/snk-filter-bar.entry.js +195 -0
  99. package/dist/esm/snk-filter-binary-select.entry.js +43 -0
  100. package/dist/esm/snk-filter-detail.entry.js +40 -0
  101. package/dist/esm/snk-filter-item.entry.js +127 -0
  102. package/dist/esm/snk-filter-list.entry.js +87 -0
  103. package/dist/esm/snk-filter-number.entry.js +19 -0
  104. package/dist/esm/snk-filter-period.entry.js +22 -0
  105. package/dist/esm/snk-filter-search.entry.js +40 -0
  106. package/dist/esm/snk-filter-text.entry.js +18 -0
  107. package/dist/esm/{snk-form_2.entry.js → snk-form.entry.js} +3 -64
  108. package/dist/esm/snk-grid.entry.js +65 -0
  109. package/dist/esm/snk-pesquisa.entry.js +2 -2
  110. package/dist/esm/snk-taskbar.entry.js +4 -3
  111. package/dist/esm/{taskbar-elements-bcccc0ff.js → taskbar-elements-c119510a.js} +1 -1
  112. package/dist/esm/teste-pesquisa.entry.js +2 -2
  113. package/dist/sankhyablocks/SnkMessageBuilder-cff80920.js +299 -0
  114. package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
  115. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
  116. package/dist/sankhyablocks/dom-665d6011.js +73 -0
  117. package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +12 -0
  118. package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
  119. package/dist/sankhyablocks/index-e5b61043.js +2384 -0
  120. package/dist/sankhyablocks/index.esm.js +1 -0
  121. package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
  122. package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
  123. package/dist/sankhyablocks/snk-application.entry.js +8306 -0
  124. package/dist/sankhyablocks/snk-crud.entry.js +60 -0
  125. package/dist/sankhyablocks/snk-data-unit.entry.js +272 -0
  126. package/dist/sankhyablocks/snk-filter-bar.entry.js +195 -0
  127. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
  128. package/dist/sankhyablocks/snk-filter-detail.entry.js +40 -0
  129. package/dist/sankhyablocks/snk-filter-item.entry.js +127 -0
  130. package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
  131. package/dist/sankhyablocks/snk-filter-number.entry.js +19 -0
  132. package/dist/sankhyablocks/snk-filter-period.entry.js +22 -0
  133. package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
  134. package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
  135. package/dist/sankhyablocks/snk-form.entry.js +111 -0
  136. package/dist/sankhyablocks/snk-grid.entry.js +65 -0
  137. package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
  138. package/dist/sankhyablocks/snk-taskbar.entry.js +153 -0
  139. package/dist/sankhyablocks/taskbar-elements-c119510a.js +72 -0
  140. package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
  141. package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
  142. package/dist/types/components/snk-application/snk-application.d.ts +9 -0
  143. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
  144. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
  145. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +13 -0
  146. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
  147. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
  148. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +9 -0
  149. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +13 -0
  150. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +37 -0
  151. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +43 -0
  152. package/dist/types/components.d.ts +199 -0
  153. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  154. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +5 -0
  155. package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
  156. package/package.json +2 -2
  157. package/react/components.d.ts +0 -7
  158. package/react/components.js +0 -7
  159. package/react/components.js.map +1 -1
  160. package/dist/esm/index-cf91f542.js +0 -1817
  161. package/dist/sankhyablocks/p-1ba29824.entry.js +0 -74
  162. package/dist/sankhyablocks/p-2266555e.entry.js +0 -1
  163. package/dist/sankhyablocks/p-23c4c94f.js +0 -2
  164. package/dist/sankhyablocks/p-2454be94.js +0 -1
  165. package/dist/sankhyablocks/p-49743bc5.js +0 -1
  166. package/dist/sankhyablocks/p-4fa389bd.entry.js +0 -1
  167. package/dist/sankhyablocks/p-5327ba05.entry.js +0 -1
  168. package/dist/sankhyablocks/p-7a922fb4.entry.js +0 -1
  169. package/dist/sankhyablocks/p-92d6f826.entry.js +0 -1
  170. package/dist/sankhyablocks/p-bdeef7f2.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, g as getElement } from './index-cf91f542.js';
1
+ import { r as registerInstance, h, g as getElement } from './index-2b4d2d14.js';
2
2
 
3
3
  const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
4
4
 
@@ -1,7 +1,6 @@
1
- import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-cf91f542.js';
2
- import { Action, ApplicationContext } from '@sankhyalabs/core';
3
- import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { O as OperationMap } from './SnkMessageBuilder-3cdde541.js';
1
+ import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
+ import { A as Action, a as ApplicationContext } from './index-e5b61043.js';
3
+ import { A as ApplicationUtils, D as DialogType, O as OperationMap } from './SnkMessageBuilder-cff80920.js';
5
4
 
6
5
  const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
7
6
 
@@ -0,0 +1,195 @@
1
+ import { r as registerInstance, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
+ import { b as DataType, t as toString, a as ApplicationContext, E as ErrorException, O as ObjectUtils } from './index-e5b61043.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
4
+
5
+ const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 1);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;flex-grow:0}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px)}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.preselected.sc-snk-filter-bar{background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}";
6
+
7
+ const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
8
+ const DEFAULT_FILTER = "DEFAULT_FILTER";
9
+ const SnkFilterBar = class {
10
+ constructor(hostRef) {
11
+ registerInstance(this, hostRef);
12
+ this._updateSequence = [];
13
+ this._calculateSortIndex = (item) => {
14
+ let index = item.hardFixed ? 1000000 : 0;
15
+ //campos Hard Fixed não variam a ordem
16
+ if (!item.hardFixed) {
17
+ index += item.fixed ? 100000 : 0;
18
+ index += item.value == undefined ? 0 : 10000;
19
+ index += this._updateSequence.lastIndexOf(item.id) + 1;
20
+ }
21
+ return index;
22
+ };
23
+ this._filtersComparator = (a, b) => {
24
+ return this._calculateSortIndex(b) - this._calculateSortIndex(a);
25
+ };
26
+ }
27
+ /**
28
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
29
+ * através de um pequeno modulo na estrutura da aplicação:
30
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
31
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
32
+ */
33
+ getMessage(key, params) {
34
+ return this._application.messagesBuilder.getMessage(key, params);
35
+ }
36
+ getFilter(_dataUnit) {
37
+ const filters = [];
38
+ this.filterConfig.filter(item => item.value).forEach(item => {
39
+ const filter = this.buildDUFilter(item);
40
+ if (filter) {
41
+ filters.push(filter);
42
+ }
43
+ });
44
+ return filters;
45
+ }
46
+ buildDUFilter(item) {
47
+ const { id, value, type, props, visible } = item;
48
+ if (value && visible) {
49
+ if (type === FilterItemType.BINARY_SELECT) {
50
+ const options = props.options;
51
+ const selectedOption = options.find(opt => opt.name === value);
52
+ //FIXME: ajustar o backend para não exigir parametros
53
+ return { name: id, expression: selectedOption.expression, params: [] };
54
+ }
55
+ if (type === FilterItemType.PERIOD) {
56
+ const { end, start } = value;
57
+ const params = [];
58
+ let expression;
59
+ if (end && start) {
60
+ expression = props.expression.fullfill;
61
+ params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
62
+ }
63
+ else {
64
+ if (start) {
65
+ expression = props.expression.onlystart;
66
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
67
+ }
68
+ else {
69
+ expression = props.expression.onlyend;
70
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
71
+ }
72
+ }
73
+ return { name: id, expression, params };
74
+ }
75
+ if (type === FilterItemType.SEARCH) {
76
+ const expression = props.expression;
77
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
78
+ }
79
+ if (type === FilterItemType.TEXT) {
80
+ const expression = props.expression;
81
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
82
+ }
83
+ if (type === FilterItemType.NUMBER) {
84
+ const expression = props.expression;
85
+ return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
86
+ }
87
+ //No mapeamento dos outros tipos precisamos saber o tipo de dado.
88
+ }
89
+ return undefined;
90
+ }
91
+ componentWillLoad() {
92
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
93
+ if (this._application) {
94
+ this._application.getFilterBarConfig()
95
+ .then((filters) => {
96
+ this.filterConfig = filters;
97
+ })
98
+ .catch(reason => {
99
+ throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
100
+ });
101
+ }
102
+ if (this.dataUnit == undefined) {
103
+ let parent = this._element.parentElement;
104
+ while (parent) {
105
+ if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
106
+ const snkDataUnit = parent;
107
+ this.dataUnit = snkDataUnit.dataUnit;
108
+ if (this.dataUnit) {
109
+ this.dataUnit.addFilterProvider(this);
110
+ }
111
+ else {
112
+ snkDataUnit.addEventListener("dataUnitReady", (evt) => {
113
+ this.dataUnit = evt.detail;
114
+ this.dataUnit.addFilterProvider(this);
115
+ });
116
+ }
117
+ break;
118
+ }
119
+ parent = parent.parentElement;
120
+ }
121
+ }
122
+ }
123
+ getFilterItems() {
124
+ const pinnedItems = [];
125
+ const unpinnedItems = [];
126
+ this._items = this.filterConfig
127
+ .filter(item => item.visible)
128
+ .sort((a, b) => this._filtersComparator(a, b))
129
+ .map((item, index) => {
130
+ const filterItem = (h("snk-filter-item", { config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
131
+ if (item.fixed || item.hardFixed) {
132
+ pinnedItems.push(filterItem);
133
+ }
134
+ else {
135
+ unpinnedItems.push(filterItem);
136
+ }
137
+ return filterItem;
138
+ });
139
+ const elements = [];
140
+ elements.push(...pinnedItems);
141
+ if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
142
+ elements.push(h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
143
+ }
144
+ elements.push(...unpinnedItems);
145
+ return elements;
146
+ }
147
+ calculateUpdateSequence(item) {
148
+ this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
149
+ this._updateSequence.push(item.id);
150
+ }
151
+ filterChangeListener(evt) {
152
+ this.updateFilter(evt.detail);
153
+ }
154
+ updateFilter(newItem) {
155
+ this.calculateUpdateSequence(newItem);
156
+ let needRefresh = false;
157
+ this.filterConfig = this.filterConfig.map(item => {
158
+ if (item.id === newItem.id) {
159
+ needRefresh = ObjectUtils.objectToString(item.value) !== ObjectUtils.objectToString(newItem.value);
160
+ return newItem;
161
+ }
162
+ return item;
163
+ });
164
+ if (needRefresh) {
165
+ this.dataUnit.loadData();
166
+ }
167
+ }
168
+ getAddListItems() {
169
+ const hiddenItems = this.filterConfig
170
+ .filter(item => !item.visible)
171
+ .sort(this._filtersComparator);
172
+ return hiddenItems.map(filter => {
173
+ return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
174
+ }).concat([
175
+ { name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" },
176
+ { name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
177
+ ]);
178
+ }
179
+ addFilterHandler(itemName) {
180
+ const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
181
+ if (filterItem) {
182
+ this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
183
+ }
184
+ }
185
+ render() {
186
+ if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
187
+ return undefined;
188
+ }
189
+ return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("ez-button", { mode: "icon", size: "small", iconName: "filter", class: "ez-padding-left--medium" }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
190
+ }
191
+ get _element() { return getElement(this); }
192
+ };
193
+ SnkFilterBar.style = snkFilterBarCss;
194
+
195
+ export { SnkFilterBar as snk_filter_bar };
@@ -0,0 +1,43 @@
1
+ import { r as registerInstance, h, f as Host } from './index-2b4d2d14.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
3
+
4
+ const SnkFilterBinarySelect = class {
5
+ constructor(hostRef) {
6
+ registerInstance(this, hostRef);
7
+ }
8
+ isSelected(option) {
9
+ return this.config.value == undefined || this.config.value === option;
10
+ }
11
+ ezChangeListener(evt) {
12
+ if (!evt.detail) {
13
+ this.assertCheckedOption(evt.target);
14
+ }
15
+ this.updateValue();
16
+ }
17
+ assertCheckedOption(updatingCheck) {
18
+ if (updatingCheck === this._checkOne) {
19
+ this._checkTwo.value = true;
20
+ }
21
+ else {
22
+ this._checkOne.value = true;
23
+ }
24
+ }
25
+ updateValue() {
26
+ if (!this._checkOne.value || !this._checkTwo.value) {
27
+ const [optOne, optTwo] = this.config.props.options;
28
+ this.value = this._checkOne.value ? optOne.name : optTwo.name;
29
+ }
30
+ else {
31
+ this.value = undefined;
32
+ }
33
+ }
34
+ render() {
35
+ if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
36
+ return undefined;
37
+ }
38
+ const [optOne, optTwo] = this.config.props.options;
39
+ return (h(Host, null, h("ez-check", { label: optOne.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkOne = ref, value: this.isSelected(optOne.name) }), h("ez-check", { label: optTwo.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkTwo = ref, value: this.isSelected(optTwo.name) })));
40
+ }
41
+ };
42
+
43
+ export { SnkFilterBinarySelect as snk_filter_binary_select };
@@ -0,0 +1,40 @@
1
+ import { r as registerInstance, e as createEvent, h, f as Host } from './index-2b4d2d14.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
3
+
4
+ const SnkFilterDetail = class {
5
+ constructor(hostRef) {
6
+ registerInstance(this, hostRef);
7
+ this.filterChange = createEvent(this, "filterChange", 7);
8
+ }
9
+ changeConfig(newConfig) {
10
+ this.filterChange.emit(newConfig);
11
+ }
12
+ getContentEditor() {
13
+ switch (this.config.type) {
14
+ case FilterItemType.BINARY_SELECT:
15
+ return "snk-filter-binary-select";
16
+ case FilterItemType.PERIOD:
17
+ return "snk-filter-period";
18
+ case FilterItemType.SEARCH:
19
+ return "snk-filter-search";
20
+ case FilterItemType.NUMBER:
21
+ return "snk-filter-number";
22
+ }
23
+ return "snk-filter-text";
24
+ }
25
+ getPopUpHeaderButtons() {
26
+ if (this.config.hardFixed) {
27
+ return undefined;
28
+ }
29
+ return ([
30
+ h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false })) }),
31
+ h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
32
+ ]);
33
+ }
34
+ render() {
35
+ const ContentEditor = this.getContentEditor();
36
+ 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, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), 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.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
37
+ }
38
+ };
39
+
40
+ export { SnkFilterDetail as snk_filter_detail };
@@ -0,0 +1,127 @@
1
+ import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
+ import { F as FloatingManager } from './index-e5b61043.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
4
+
5
+ const SnkFilterItem = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.filterChange = createEvent(this, "filterChange", 7);
9
+ this.innerClickCheck = (floatingContainer, node) => {
10
+ if (this._popover.keepOpened) {
11
+ return true;
12
+ }
13
+ if (node && floatingContainer) {
14
+ if (!node.offsetParent) {
15
+ return true;
16
+ }
17
+ let current = node;
18
+ do {
19
+ if (current === floatingContainer) {
20
+ return true;
21
+ }
22
+ } while ((current = current.offsetParent) != null);
23
+ }
24
+ this.detailIsVisible = false;
25
+ return false;
26
+ };
27
+ }
28
+ showDetail() {
29
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
30
+ this.detailIsVisible = true;
31
+ }
32
+ getScrollOffset() {
33
+ return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
34
+ }
35
+ hideDetail() {
36
+ if (this._floatingID != undefined) {
37
+ FloatingManager.close(this._floatingID);
38
+ }
39
+ this._floatingID = undefined;
40
+ this.detailIsVisible = false;
41
+ }
42
+ //---------------------------------------------
43
+ // Event handlers
44
+ //---------------------------------------------
45
+ clickListener(evt) {
46
+ if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
47
+ if (evt.target === this._rightIconElement && this.config.value != undefined) {
48
+ this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
49
+ }
50
+ else {
51
+ if (this.detailIsVisible) {
52
+ this.hideDetail();
53
+ }
54
+ else {
55
+ this.showDetail();
56
+ }
57
+ }
58
+ evt.preventDefault();
59
+ evt.stopImmediatePropagation();
60
+ evt.stopPropagation();
61
+ }
62
+ }
63
+ mouseDownListener(evt) {
64
+ if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
65
+ evt.preventDefault();
66
+ evt.stopImmediatePropagation();
67
+ evt.stopPropagation();
68
+ }
69
+ }
70
+ getLabel() {
71
+ const { type, value, label, props } = this.config;
72
+ if (value) {
73
+ if (type === FilterItemType.BINARY_SELECT) {
74
+ const [optOne, optTwo] = props.options;
75
+ if (optOne.name === value) {
76
+ return optOne.label;
77
+ }
78
+ if (optTwo.name === value) {
79
+ return optTwo.label;
80
+ }
81
+ }
82
+ if (type === FilterItemType.PERIOD) {
83
+ const period = value;
84
+ const dateFormater = new Intl.DateTimeFormat("pt-BR");
85
+ if (period.end && period.start) {
86
+ return `${label}: ${dateFormater.format(period.start)} a ${dateFormater.format(period.end)}`;
87
+ }
88
+ else {
89
+ if (period.start) {
90
+ return `${label}: A partir de ${dateFormater.format(period.end)}`;
91
+ }
92
+ else {
93
+ return `${label}: Até ${dateFormater.format(period.end)}`;
94
+ }
95
+ }
96
+ }
97
+ if (type === FilterItemType.SEARCH) {
98
+ return `${label}: ${value.value} - ${value.label}`;
99
+ }
100
+ return `${label}: ${value}`;
101
+ }
102
+ return label;
103
+ }
104
+ componentDidRender() {
105
+ if (this._floatingID == undefined) {
106
+ if (this._popover) {
107
+ this._popover.remove();
108
+ }
109
+ }
110
+ }
111
+ filterChangeListener() {
112
+ this.hideDetail();
113
+ }
114
+ getIconName() {
115
+ if (this.config.value != undefined) {
116
+ return "close";
117
+ }
118
+ return this.detailIsVisible ? "chevron-up" : "chevron-down";
119
+ }
120
+ render() {
121
+ const leftIcon = this.config.type === FilterItemType.PERIOD ? "calendar" : undefined;
122
+ return (h(Host, null, h("ez-chip", { 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.getIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), 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 }))));
123
+ }
124
+ get _filterItemElement() { return getElement(this); }
125
+ };
126
+
127
+ export { SnkFilterItem as snk_filter_item };
@@ -0,0 +1,87 @@
1
+ import { r as registerInstance, e as createEvent, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
+ import { F as FloatingManager, g as ArrayUtils } from './index-e5b61043.js';
3
+
4
+ const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
5
+ const MAX_FILTERS = 5;
6
+ const SnkFilterList = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
10
+ this.innerClickCheck = (floatingContainer, node) => {
11
+ if (node && floatingContainer) {
12
+ if (!node.offsetParent) {
13
+ return true;
14
+ }
15
+ let current = node;
16
+ do {
17
+ if (current === floatingContainer || current === this._element) {
18
+ return true;
19
+ }
20
+ } while ((current = current.offsetParent) != null);
21
+ }
22
+ this._detailIsVisible = false;
23
+ return false;
24
+ };
25
+ }
26
+ showList() {
27
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
28
+ this._detailIsVisible = true;
29
+ this._showAll = false;
30
+ this._filterArgument = "";
31
+ }
32
+ hideList() {
33
+ if (this._floatingID != undefined) {
34
+ FloatingManager.close(this._floatingID);
35
+ }
36
+ this._floatingID = undefined;
37
+ this._detailIsVisible = false;
38
+ }
39
+ buttonClick() {
40
+ if (this._detailIsVisible) {
41
+ this.hideList();
42
+ }
43
+ else {
44
+ this.showList();
45
+ }
46
+ }
47
+ componentDidRender() {
48
+ if (this._floatingID == undefined) {
49
+ if (this._popover) {
50
+ this._popover.remove();
51
+ }
52
+ }
53
+ }
54
+ buildItemElement(item) {
55
+ return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item", onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
56
+ }
57
+ itemSelected(itemName) {
58
+ if (itemName === SHOW_MORE_ITEM_NAME) {
59
+ this._showAll = true;
60
+ }
61
+ else {
62
+ this.hideList();
63
+ this.snkItemSelected.emit(itemName);
64
+ }
65
+ }
66
+ getFilterItems() {
67
+ const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
68
+ if (items.length === 0) {
69
+ return h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.getMessage("snkFilterBar.emptyFilterList"));
70
+ }
71
+ const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
72
+ if (hideItems) {
73
+ items.splice(MAX_FILTERS);
74
+ items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
75
+ }
76
+ return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
77
+ }
78
+ getFooterItems() {
79
+ return this.items.filter(item => item.kind === "FOOTER");
80
+ }
81
+ render() {
82
+ return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.getMessage("snkFilterBar.findFilter"), value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
83
+ }
84
+ get _element() { return getElement(this); }
85
+ };
86
+
87
+ export { SnkFilterList as snk_filter_list };
@@ -0,0 +1,19 @@
1
+ import { r as registerInstance, h } from './index-2b4d2d14.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
3
+
4
+ const SnkFilterPeriod = class {
5
+ constructor(hostRef) {
6
+ registerInstance(this, hostRef);
7
+ }
8
+ ezChangeListener(evt) {
9
+ this.value = evt.detail;
10
+ }
11
+ render() {
12
+ if (!this.config || this.config.type !== FilterItemType.NUMBER) {
13
+ return undefined;
14
+ }
15
+ return (h("ez-number-input", { label: this.config.label, value: this.config.value }));
16
+ }
17
+ };
18
+
19
+ export { SnkFilterPeriod as snk_filter_number };
@@ -0,0 +1,22 @@
1
+ import { r as registerInstance, h } from './index-2b4d2d14.js';
2
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
3
+
4
+ const SnkFilterPeriod = class {
5
+ constructor(hostRef) {
6
+ registerInstance(this, hostRef);
7
+ }
8
+ ezChangeListener() {
9
+ const start = this._startDate.value;
10
+ const end = this._endDate.value;
11
+ this.value = (start || end ? { start, end } : undefined);
12
+ }
13
+ render() {
14
+ var _a, _b;
15
+ if (!this.config || this.config.type !== FilterItemType.PERIOD) {
16
+ return undefined;
17
+ }
18
+ return (h("div", { class: "ez-col ez-col--nowrap" }, h("ez-date-input", { label: this.config.label, ref: ref => this._startDate = ref, value: (_a = this.config.value) === null || _a === void 0 ? void 0 : _a.start }), h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9"), h("ez-date-input", { label: this.config.label, ref: ref => this._endDate = ref, value: (_b = this.config.value) === null || _b === void 0 ? void 0 : _b.end })));
19
+ }
20
+ };
21
+
22
+ export { SnkFilterPeriod as snk_filter_period };
@@ -0,0 +1,40 @@
1
+ import { r as registerInstance, h } from './index-2b4d2d14.js';
2
+ import { a as ApplicationContext } from './index-e5b61043.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum-61fbf80a.js';
4
+
5
+ const SnkFilterSearch = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ }
9
+ ezChangeListener(_evt) {
10
+ this.value = this._searchInput.value;
11
+ }
12
+ doSearch(mode, argument) {
13
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
14
+ if (this.fix) {
15
+ this.fix();
16
+ }
17
+ return new Promise((resolve, reject) => {
18
+ application.executePreparedSearch(mode, argument, this.config.props.searchContext)
19
+ .then(result => {
20
+ resolve(result);
21
+ if (this.unfix) {
22
+ this.unfix();
23
+ }
24
+ }).catch(reason => {
25
+ reject(reason);
26
+ if (this.unfix) {
27
+ this.unfix();
28
+ }
29
+ });
30
+ });
31
+ }
32
+ render() {
33
+ if (!this.config || this.config.type !== FilterItemType.SEARCH) {
34
+ return undefined;
35
+ }
36
+ return (h("ez-search", { value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
37
+ }
38
+ };
39
+
40
+ export { SnkFilterSearch as snk_filter_search };
@@ -0,0 +1,18 @@
1
+ import { r as registerInstance, h } from './index-2b4d2d14.js';
2
+
3
+ const SnkFilterText = class {
4
+ constructor(hostRef) {
5
+ registerInstance(this, hostRef);
6
+ }
7
+ ezChangeListener(evt) {
8
+ this.value = evt.detail;
9
+ }
10
+ render() {
11
+ if (!this.config) {
12
+ return undefined;
13
+ }
14
+ return (h("ez-text-input", { label: this.config.label, value: this.config.value }));
15
+ }
16
+ };
17
+
18
+ export { SnkFilterText as snk_filter_text };