@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,8 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
+ import { d as defineCustomElement$8 } from './snk-filter-bar2.js';
3
+ import { d as defineCustomElement$7 } from './snk-filter-detail2.js';
4
+ import { d as defineCustomElement$6 } from './snk-filter-item2.js';
5
+ import { d as defineCustomElement$5 } from './snk-filter-list2.js';
2
6
  import { d as defineCustomElement$4 } from './snk-form2.js';
3
7
  import { d as defineCustomElement$3 } from './snk-grid2.js';
4
8
  import { d as defineCustomElement$2 } from './snk-taskbar2.js';
@@ -70,13 +74,33 @@ function defineCustomElement$1() {
70
74
  if (typeof customElements === "undefined") {
71
75
  return;
72
76
  }
73
- const components = ["snk-crud", "snk-form", "snk-grid", "snk-taskbar"];
77
+ const components = ["snk-crud", "snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list", "snk-form", "snk-grid", "snk-taskbar"];
74
78
  components.forEach(tagName => { switch (tagName) {
75
79
  case "snk-crud":
76
80
  if (!customElements.get(tagName)) {
77
81
  customElements.define(tagName, SnkCrud$1);
78
82
  }
79
83
  break;
84
+ case "snk-filter-bar":
85
+ if (!customElements.get(tagName)) {
86
+ defineCustomElement$8();
87
+ }
88
+ break;
89
+ case "snk-filter-detail":
90
+ if (!customElements.get(tagName)) {
91
+ defineCustomElement$7();
92
+ }
93
+ break;
94
+ case "snk-filter-item":
95
+ if (!customElements.get(tagName)) {
96
+ defineCustomElement$6();
97
+ }
98
+ break;
99
+ case "snk-filter-list":
100
+ if (!customElements.get(tagName)) {
101
+ defineCustomElement$5();
102
+ }
103
+ break;
80
104
  case "snk-form":
81
105
  if (!customElements.get(tagName)) {
82
106
  defineCustomElement$4();
@@ -1,7 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { Action, ApplicationContext } from '@sankhyalabs/core';
3
- import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { O as OperationMap } from './SnkMessageBuilder.js';
2
+ import { A as Action, a as ApplicationContext } from './index2.js';
3
+ import { A as ApplicationUtils, D as DialogType, O as OperationMap } from './SnkMessageBuilder.js';
5
4
 
6
5
  const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
7
6
 
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkFilterBar extends Components.SnkFilterBar, HTMLElement {}
4
+ export const SnkFilterBar: {
5
+ prototype: SnkFilterBar;
6
+ new (): SnkFilterBar;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkFilterBar$1, d as defineCustomElement$1 } from './snk-filter-bar2.js';
2
+
3
+ const SnkFilterBar = SnkFilterBar$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkFilterBar, defineCustomElement };
@@ -0,0 +1,230 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { b as DataType, t as toString, a as ApplicationContext, E as ErrorException, O as ObjectUtils } from './index2.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum.js';
4
+ import { d as defineCustomElement$3 } from './snk-filter-detail2.js';
5
+ import { d as defineCustomElement$2 } from './snk-filter-item2.js';
6
+ import { d as defineCustomElement$1 } from './snk-filter-list2.js';
7
+
8
+ 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}";
9
+
10
+ const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
11
+ const DEFAULT_FILTER = "DEFAULT_FILTER";
12
+ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ this.__registerHost();
16
+ this._updateSequence = [];
17
+ this._calculateSortIndex = (item) => {
18
+ let index = item.hardFixed ? 1000000 : 0;
19
+ //campos Hard Fixed não variam a ordem
20
+ if (!item.hardFixed) {
21
+ index += item.fixed ? 100000 : 0;
22
+ index += item.value == undefined ? 0 : 10000;
23
+ index += this._updateSequence.lastIndexOf(item.id) + 1;
24
+ }
25
+ return index;
26
+ };
27
+ this._filtersComparator = (a, b) => {
28
+ return this._calculateSortIndex(b) - this._calculateSortIndex(a);
29
+ };
30
+ }
31
+ /**
32
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
33
+ * através de um pequeno modulo na estrutura da aplicação:
34
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
35
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-bar.msg.ts"
36
+ */
37
+ getMessage(key, params) {
38
+ return this._application.messagesBuilder.getMessage(key, params);
39
+ }
40
+ getFilter(_dataUnit) {
41
+ const filters = [];
42
+ this.filterConfig.filter(item => item.value).forEach(item => {
43
+ const filter = this.buildDUFilter(item);
44
+ if (filter) {
45
+ filters.push(filter);
46
+ }
47
+ });
48
+ return filters;
49
+ }
50
+ buildDUFilter(item) {
51
+ const { id, value, type, props, visible } = item;
52
+ if (value && visible) {
53
+ if (type === FilterItemType.BINARY_SELECT) {
54
+ const options = props.options;
55
+ const selectedOption = options.find(opt => opt.name === value);
56
+ //FIXME: ajustar o backend para não exigir parametros
57
+ return { name: id, expression: selectedOption.expression, params: [] };
58
+ }
59
+ if (type === FilterItemType.PERIOD) {
60
+ const { end, start } = value;
61
+ const params = [];
62
+ let expression;
63
+ if (end && start) {
64
+ expression = props.expression.fullfill;
65
+ params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
66
+ }
67
+ else {
68
+ if (start) {
69
+ expression = props.expression.onlystart;
70
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
71
+ }
72
+ else {
73
+ expression = props.expression.onlyend;
74
+ params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
75
+ }
76
+ }
77
+ return { name: id, expression, params };
78
+ }
79
+ if (type === FilterItemType.SEARCH) {
80
+ const expression = props.expression;
81
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
82
+ }
83
+ if (type === FilterItemType.TEXT) {
84
+ const expression = props.expression;
85
+ return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
86
+ }
87
+ if (type === FilterItemType.NUMBER) {
88
+ const expression = props.expression;
89
+ return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
90
+ }
91
+ //No mapeamento dos outros tipos precisamos saber o tipo de dado.
92
+ }
93
+ return undefined;
94
+ }
95
+ componentWillLoad() {
96
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
97
+ if (this._application) {
98
+ this._application.getFilterBarConfig()
99
+ .then((filters) => {
100
+ this.filterConfig = filters;
101
+ })
102
+ .catch(reason => {
103
+ throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
104
+ });
105
+ }
106
+ if (this.dataUnit == undefined) {
107
+ let parent = this._element.parentElement;
108
+ while (parent) {
109
+ if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
110
+ const snkDataUnit = parent;
111
+ this.dataUnit = snkDataUnit.dataUnit;
112
+ if (this.dataUnit) {
113
+ this.dataUnit.addFilterProvider(this);
114
+ }
115
+ else {
116
+ snkDataUnit.addEventListener("dataUnitReady", (evt) => {
117
+ this.dataUnit = evt.detail;
118
+ this.dataUnit.addFilterProvider(this);
119
+ });
120
+ }
121
+ break;
122
+ }
123
+ parent = parent.parentElement;
124
+ }
125
+ }
126
+ }
127
+ getFilterItems() {
128
+ const pinnedItems = [];
129
+ const unpinnedItems = [];
130
+ this._items = this.filterConfig
131
+ .filter(item => item.visible)
132
+ .sort((a, b) => this._filtersComparator(a, b))
133
+ .map((item, index) => {
134
+ 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 }));
135
+ if (item.fixed || item.hardFixed) {
136
+ pinnedItems.push(filterItem);
137
+ }
138
+ else {
139
+ unpinnedItems.push(filterItem);
140
+ }
141
+ return filterItem;
142
+ });
143
+ const elements = [];
144
+ elements.push(...pinnedItems);
145
+ if (pinnedItems.length > 0 && unpinnedItems.length > 0) {
146
+ elements.push(h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-filter-bar__divider" }));
147
+ }
148
+ elements.push(...unpinnedItems);
149
+ return elements;
150
+ }
151
+ calculateUpdateSequence(item) {
152
+ this._updateSequence = this._updateSequence.filter(itemId => item.id !== itemId);
153
+ this._updateSequence.push(item.id);
154
+ }
155
+ filterChangeListener(evt) {
156
+ this.updateFilter(evt.detail);
157
+ }
158
+ updateFilter(newItem) {
159
+ this.calculateUpdateSequence(newItem);
160
+ let needRefresh = false;
161
+ this.filterConfig = this.filterConfig.map(item => {
162
+ if (item.id === newItem.id) {
163
+ needRefresh = ObjectUtils.objectToString(item.value) !== ObjectUtils.objectToString(newItem.value);
164
+ return newItem;
165
+ }
166
+ return item;
167
+ });
168
+ if (needRefresh) {
169
+ this.dataUnit.loadData();
170
+ }
171
+ }
172
+ getAddListItems() {
173
+ const hiddenItems = this.filterConfig
174
+ .filter(item => !item.visible)
175
+ .sort(this._filtersComparator);
176
+ return hiddenItems.map(filter => {
177
+ return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
178
+ }).concat([
179
+ { name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" },
180
+ { name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" }
181
+ ]);
182
+ }
183
+ addFilterHandler(itemName) {
184
+ const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
185
+ if (filterItem) {
186
+ this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
187
+ }
188
+ }
189
+ render() {
190
+ if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
191
+ return undefined;
192
+ }
193
+ 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" }))));
194
+ }
195
+ get _element() { return this; }
196
+ static get style() { return snkFilterBarCss; }
197
+ }, [2, "snk-filter-bar", {
198
+ "dataUnit": [1040],
199
+ "filterConfig": [1040]
200
+ }, [[0, "filterChange", "filterChangeListener"]]]);
201
+ function defineCustomElement() {
202
+ if (typeof customElements === "undefined") {
203
+ return;
204
+ }
205
+ const components = ["snk-filter-bar", "snk-filter-detail", "snk-filter-item", "snk-filter-list"];
206
+ components.forEach(tagName => { switch (tagName) {
207
+ case "snk-filter-bar":
208
+ if (!customElements.get(tagName)) {
209
+ customElements.define(tagName, SnkFilterBar);
210
+ }
211
+ break;
212
+ case "snk-filter-detail":
213
+ if (!customElements.get(tagName)) {
214
+ defineCustomElement$3();
215
+ }
216
+ break;
217
+ case "snk-filter-item":
218
+ if (!customElements.get(tagName)) {
219
+ defineCustomElement$2();
220
+ }
221
+ break;
222
+ case "snk-filter-list":
223
+ if (!customElements.get(tagName)) {
224
+ defineCustomElement$1();
225
+ }
226
+ break;
227
+ } });
228
+ }
229
+
230
+ export { SnkFilterBar as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkFilterBinarySelect extends Components.SnkFilterBinarySelect, HTMLElement {}
4
+ export const SnkFilterBinarySelect: {
5
+ prototype: SnkFilterBinarySelect;
6
+ new (): SnkFilterBinarySelect;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,63 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { F as FilterItemType } from './filter-item-type.enum.js';
3
+
4
+ const SnkFilterBinarySelect$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.__registerHost();
8
+ }
9
+ isSelected(option) {
10
+ return this.config.value == undefined || this.config.value === option;
11
+ }
12
+ ezChangeListener(evt) {
13
+ if (!evt.detail) {
14
+ this.assertCheckedOption(evt.target);
15
+ }
16
+ this.updateValue();
17
+ }
18
+ assertCheckedOption(updatingCheck) {
19
+ if (updatingCheck === this._checkOne) {
20
+ this._checkTwo.value = true;
21
+ }
22
+ else {
23
+ this._checkOne.value = true;
24
+ }
25
+ }
26
+ updateValue() {
27
+ if (!this._checkOne.value || !this._checkTwo.value) {
28
+ const [optOne, optTwo] = this.config.props.options;
29
+ this.value = this._checkOne.value ? optOne.name : optTwo.name;
30
+ }
31
+ else {
32
+ this.value = undefined;
33
+ }
34
+ }
35
+ render() {
36
+ if (!this.config || this.config.type !== FilterItemType.BINARY_SELECT) {
37
+ return undefined;
38
+ }
39
+ const [optOne, optTwo] = this.config.props.options;
40
+ 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) })));
41
+ }
42
+ }, [0, "snk-filter-binary-select", {
43
+ "value": [1544],
44
+ "config": [16]
45
+ }, [[0, "ezChange", "ezChangeListener"]]]);
46
+ function defineCustomElement$1() {
47
+ if (typeof customElements === "undefined") {
48
+ return;
49
+ }
50
+ const components = ["snk-filter-binary-select"];
51
+ components.forEach(tagName => { switch (tagName) {
52
+ case "snk-filter-binary-select":
53
+ if (!customElements.get(tagName)) {
54
+ customElements.define(tagName, SnkFilterBinarySelect$1);
55
+ }
56
+ break;
57
+ } });
58
+ }
59
+
60
+ const SnkFilterBinarySelect = SnkFilterBinarySelect$1;
61
+ const defineCustomElement = defineCustomElement$1;
62
+
63
+ export { SnkFilterBinarySelect, defineCustomElement };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkFilterDetail extends Components.SnkFilterDetail, HTMLElement {}
4
+ export const SnkFilterDetail: {
5
+ prototype: SnkFilterDetail;
6
+ new (): SnkFilterDetail;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkFilterDetail$1, d as defineCustomElement$1 } from './snk-filter-detail2.js';
2
+
3
+ const SnkFilterDetail = SnkFilterDetail$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkFilterDetail, defineCustomElement };
@@ -0,0 +1,58 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { F as FilterItemType } from './filter-item-type.enum.js';
3
+
4
+ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ this.__registerHost();
8
+ this.filterChange = createEvent(this, "filterChange", 7);
9
+ }
10
+ changeConfig(newConfig) {
11
+ this.filterChange.emit(newConfig);
12
+ }
13
+ getContentEditor() {
14
+ switch (this.config.type) {
15
+ case FilterItemType.BINARY_SELECT:
16
+ return "snk-filter-binary-select";
17
+ case FilterItemType.PERIOD:
18
+ return "snk-filter-period";
19
+ case FilterItemType.SEARCH:
20
+ return "snk-filter-search";
21
+ case FilterItemType.NUMBER:
22
+ return "snk-filter-number";
23
+ }
24
+ return "snk-filter-text";
25
+ }
26
+ getPopUpHeaderButtons() {
27
+ if (this.config.hardFixed) {
28
+ return undefined;
29
+ }
30
+ return ([
31
+ 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 })) }),
32
+ 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 })) })
33
+ ]);
34
+ }
35
+ render() {
36
+ const ContentEditor = this.getContentEditor();
37
+ 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" }))));
38
+ }
39
+ }, [0, "snk-filter-detail", {
40
+ "config": [1040],
41
+ "keepOpened": [1028, "keep-opened"],
42
+ "getMessage": [16]
43
+ }]);
44
+ function defineCustomElement() {
45
+ if (typeof customElements === "undefined") {
46
+ return;
47
+ }
48
+ const components = ["snk-filter-detail"];
49
+ components.forEach(tagName => { switch (tagName) {
50
+ case "snk-filter-detail":
51
+ if (!customElements.get(tagName)) {
52
+ customElements.define(tagName, SnkFilterDetail);
53
+ }
54
+ break;
55
+ } });
56
+ }
57
+
58
+ export { SnkFilterDetail as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkFilterItem extends Components.SnkFilterItem, HTMLElement {}
4
+ export const SnkFilterItem: {
5
+ prototype: SnkFilterItem;
6
+ new (): SnkFilterItem;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkFilterItem$1, d as defineCustomElement$1 } from './snk-filter-item2.js';
2
+
3
+ const SnkFilterItem = SnkFilterItem$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkFilterItem, defineCustomElement };
@@ -0,0 +1,151 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { F as FloatingManager } from './index2.js';
3
+ import { F as FilterItemType } from './filter-item-type.enum.js';
4
+ import { d as defineCustomElement$1 } from './snk-filter-detail2.js';
5
+
6
+ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.filterChange = createEvent(this, "filterChange", 7);
11
+ this.innerClickCheck = (floatingContainer, node) => {
12
+ if (this._popover.keepOpened) {
13
+ return true;
14
+ }
15
+ if (node && floatingContainer) {
16
+ if (!node.offsetParent) {
17
+ return true;
18
+ }
19
+ let current = node;
20
+ do {
21
+ if (current === floatingContainer) {
22
+ return true;
23
+ }
24
+ } while ((current = current.offsetParent) != null);
25
+ }
26
+ this.detailIsVisible = false;
27
+ return false;
28
+ };
29
+ }
30
+ showDetail() {
31
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
32
+ this.detailIsVisible = true;
33
+ }
34
+ getScrollOffset() {
35
+ return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
36
+ }
37
+ hideDetail() {
38
+ if (this._floatingID != undefined) {
39
+ FloatingManager.close(this._floatingID);
40
+ }
41
+ this._floatingID = undefined;
42
+ this.detailIsVisible = false;
43
+ }
44
+ //---------------------------------------------
45
+ // Event handlers
46
+ //---------------------------------------------
47
+ clickListener(evt) {
48
+ if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
49
+ if (evt.target === this._rightIconElement && this.config.value != undefined) {
50
+ this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
51
+ }
52
+ else {
53
+ if (this.detailIsVisible) {
54
+ this.hideDetail();
55
+ }
56
+ else {
57
+ this.showDetail();
58
+ }
59
+ }
60
+ evt.preventDefault();
61
+ evt.stopImmediatePropagation();
62
+ evt.stopPropagation();
63
+ }
64
+ }
65
+ mouseDownListener(evt) {
66
+ if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
67
+ evt.preventDefault();
68
+ evt.stopImmediatePropagation();
69
+ evt.stopPropagation();
70
+ }
71
+ }
72
+ getLabel() {
73
+ const { type, value, label, props } = this.config;
74
+ if (value) {
75
+ if (type === FilterItemType.BINARY_SELECT) {
76
+ const [optOne, optTwo] = props.options;
77
+ if (optOne.name === value) {
78
+ return optOne.label;
79
+ }
80
+ if (optTwo.name === value) {
81
+ return optTwo.label;
82
+ }
83
+ }
84
+ if (type === FilterItemType.PERIOD) {
85
+ const period = value;
86
+ const dateFormater = new Intl.DateTimeFormat("pt-BR");
87
+ if (period.end && period.start) {
88
+ return `${label}: ${dateFormater.format(period.start)} a ${dateFormater.format(period.end)}`;
89
+ }
90
+ else {
91
+ if (period.start) {
92
+ return `${label}: A partir de ${dateFormater.format(period.end)}`;
93
+ }
94
+ else {
95
+ return `${label}: Até ${dateFormater.format(period.end)}`;
96
+ }
97
+ }
98
+ }
99
+ if (type === FilterItemType.SEARCH) {
100
+ return `${label}: ${value.value} - ${value.label}`;
101
+ }
102
+ return `${label}: ${value}`;
103
+ }
104
+ return label;
105
+ }
106
+ componentDidRender() {
107
+ if (this._floatingID == undefined) {
108
+ if (this._popover) {
109
+ this._popover.remove();
110
+ }
111
+ }
112
+ }
113
+ filterChangeListener() {
114
+ this.hideDetail();
115
+ }
116
+ getIconName() {
117
+ if (this.config.value != undefined) {
118
+ return "close";
119
+ }
120
+ return this.detailIsVisible ? "chevron-up" : "chevron-down";
121
+ }
122
+ render() {
123
+ const leftIcon = this.config.type === FilterItemType.PERIOD ? "calendar" : undefined;
124
+ 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 }))));
125
+ }
126
+ get _filterItemElement() { return this; }
127
+ }, [0, "snk-filter-item", {
128
+ "config": [1040],
129
+ "getMessage": [16],
130
+ "detailIsVisible": [32]
131
+ }, [[2, "click", "clickListener"], [2, "mousedown", "mouseDownListener"], [0, "filterChange", "filterChangeListener"]]]);
132
+ function defineCustomElement() {
133
+ if (typeof customElements === "undefined") {
134
+ return;
135
+ }
136
+ const components = ["snk-filter-item", "snk-filter-detail"];
137
+ components.forEach(tagName => { switch (tagName) {
138
+ case "snk-filter-item":
139
+ if (!customElements.get(tagName)) {
140
+ customElements.define(tagName, SnkFilterItem);
141
+ }
142
+ break;
143
+ case "snk-filter-detail":
144
+ if (!customElements.get(tagName)) {
145
+ defineCustomElement$1();
146
+ }
147
+ break;
148
+ } });
149
+ }
150
+
151
+ export { SnkFilterItem as S, defineCustomElement as d };
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SnkFilterList extends Components.SnkFilterList, HTMLElement {}
4
+ export const SnkFilterList: {
5
+ prototype: SnkFilterList;
6
+ new (): SnkFilterList;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,6 @@
1
+ import { S as SnkFilterList$1, d as defineCustomElement$1 } from './snk-filter-list2.js';
2
+
3
+ const SnkFilterList = SnkFilterList$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { SnkFilterList, defineCustomElement };