@sankhyalabs/sankhyablocks 1.3.31-beta.14 → 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 (182) hide show
  1. package/dist/cjs/{SnkMessageBuilder-bb55d4c4.js → SnkMessageBuilder-cb132e6d.js} +134 -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-b0b676c5.js +3298 -0
  8. package/dist/cjs/loader.cjs.js +19 -3
  9. package/dist/cjs/sankhyablocks.cjs.js +117 -5
  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-2888ceb6.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 +11 -2
  30. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +7 -0
  31. package/dist/collection/components/snk-application/snk-application.js +775 -695
  32. package/dist/collection/components/snk-crud/snk-crud.js +75 -73
  33. package/dist/collection/components/snk-data-unit/snk-data-unit.js +262 -250
  34. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +88 -0
  35. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +64 -0
  36. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +69 -0
  37. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +118 -0
  38. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
  39. package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +10 -0
  40. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +113 -0
  41. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +209 -0
  42. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +182 -0
  43. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +99 -0
  44. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +257 -0
  45. package/dist/collection/components/snk-form/snk-form.js +111 -111
  46. package/dist/collection/components/snk-grid/snk-grid.css +14 -1
  47. package/dist/collection/components/snk-grid/snk-grid.js +93 -92
  48. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
  49. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -2
  50. package/dist/collection/components/snk-taskbar/snk-taskbar.js +128 -116
  51. package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
  52. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +24 -2
  53. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -1
  54. package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +268 -0
  55. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  56. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -0
  57. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -0
  58. package/dist/components/SnkMessageBuilder.js +134 -2
  59. package/dist/components/filter-item-type.enum.js +12 -0
  60. package/dist/components/index.d.ts +17 -5
  61. package/dist/components/index.js +21 -0
  62. package/dist/components/index2.js +2384 -0
  63. package/dist/components/snk-application2.js +508 -30
  64. package/dist/components/snk-crud.js +25 -1
  65. package/dist/components/snk-data-unit.js +3 -4
  66. package/dist/components/snk-filter-bar.d.ts +11 -0
  67. package/dist/components/snk-filter-bar.js +6 -0
  68. package/dist/components/snk-filter-bar2.js +230 -0
  69. package/dist/components/snk-filter-binary-select.d.ts +11 -0
  70. package/dist/components/snk-filter-binary-select.js +63 -0
  71. package/dist/components/snk-filter-detail.d.ts +11 -0
  72. package/dist/components/snk-filter-detail.js +6 -0
  73. package/dist/components/snk-filter-detail2.js +58 -0
  74. package/dist/components/snk-filter-item.d.ts +11 -0
  75. package/dist/components/snk-filter-item.js +6 -0
  76. package/dist/components/snk-filter-item2.js +151 -0
  77. package/dist/components/snk-filter-list.d.ts +11 -0
  78. package/dist/components/snk-filter-list.js +6 -0
  79. package/dist/components/snk-filter-list2.js +108 -0
  80. package/dist/components/snk-filter-number.d.ts +11 -0
  81. package/dist/components/snk-filter-number.js +39 -0
  82. package/dist/components/snk-filter-period.d.ts +11 -0
  83. package/dist/components/snk-filter-period.js +42 -0
  84. package/dist/components/snk-filter-search.d.ts +11 -0
  85. package/dist/components/snk-filter-search.js +62 -0
  86. package/dist/components/snk-filter-text.d.ts +11 -0
  87. package/dist/components/snk-filter-text.js +38 -0
  88. package/dist/components/snk-form2.js +1 -1
  89. package/dist/components/snk-grid2.js +28 -4
  90. package/dist/components/snk-pesquisa2.js +1 -1
  91. package/dist/components/snk-taskbar2.js +2 -1
  92. package/dist/components/teste-pesquisa.js +1 -1
  93. package/dist/esm/{SnkMessageBuilder-17d91b88.js → SnkMessageBuilder-cff80920.js} +134 -2
  94. package/dist/esm/app-globals-0f993ce5.js +3 -0
  95. package/dist/esm/css-shim-b3f2ee8d.js +4 -0
  96. package/dist/esm/dom-665d6011.js +73 -0
  97. package/dist/esm/filter-item-type.enum-61fbf80a.js +12 -0
  98. package/dist/esm/index-2b4d2d14.js +3262 -0
  99. package/dist/esm/index-e5b61043.js +2384 -0
  100. package/dist/esm/loader.js +19 -3
  101. package/dist/esm/polyfills/css-shim.js +1 -1
  102. package/dist/esm/sankhyablocks.js +117 -5
  103. package/dist/esm/shadow-css-b18e99d7.js +387 -0
  104. package/dist/esm/snk-application.entry.js +507 -31
  105. package/dist/esm/snk-crud.entry.js +1 -1
  106. package/dist/esm/snk-data-unit.entry.js +4 -5
  107. package/dist/esm/snk-filter-bar.entry.js +195 -0
  108. package/dist/esm/snk-filter-binary-select.entry.js +43 -0
  109. package/dist/esm/snk-filter-detail.entry.js +40 -0
  110. package/dist/esm/snk-filter-item.entry.js +127 -0
  111. package/dist/esm/snk-filter-list.entry.js +87 -0
  112. package/dist/esm/snk-filter-number.entry.js +19 -0
  113. package/dist/esm/snk-filter-period.entry.js +22 -0
  114. package/dist/esm/snk-filter-search.entry.js +40 -0
  115. package/dist/esm/snk-filter-text.entry.js +18 -0
  116. package/dist/esm/{snk-form_2.entry.js → snk-form.entry.js} +3 -64
  117. package/dist/esm/snk-grid.entry.js +65 -0
  118. package/dist/esm/snk-pesquisa.entry.js +2 -2
  119. package/dist/esm/snk-taskbar.entry.js +4 -3
  120. package/dist/esm/{taskbar-elements-5ea74223.js → taskbar-elements-c119510a.js} +1 -1
  121. package/dist/esm/teste-pesquisa.entry.js +2 -2
  122. package/dist/sankhyablocks/SnkMessageBuilder-cff80920.js +299 -0
  123. package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
  124. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
  125. package/dist/sankhyablocks/dom-665d6011.js +73 -0
  126. package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +12 -0
  127. package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
  128. package/dist/sankhyablocks/index-e5b61043.js +2384 -0
  129. package/dist/sankhyablocks/index.esm.js +1 -0
  130. package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
  131. package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
  132. package/dist/sankhyablocks/snk-application.entry.js +8306 -0
  133. package/dist/sankhyablocks/snk-crud.entry.js +60 -0
  134. package/dist/sankhyablocks/snk-data-unit.entry.js +272 -0
  135. package/dist/sankhyablocks/snk-filter-bar.entry.js +195 -0
  136. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
  137. package/dist/sankhyablocks/snk-filter-detail.entry.js +40 -0
  138. package/dist/sankhyablocks/snk-filter-item.entry.js +127 -0
  139. package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
  140. package/dist/sankhyablocks/snk-filter-number.entry.js +19 -0
  141. package/dist/sankhyablocks/snk-filter-period.entry.js +22 -0
  142. package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
  143. package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
  144. package/dist/sankhyablocks/snk-form.entry.js +111 -0
  145. package/dist/sankhyablocks/snk-grid.entry.js +65 -0
  146. package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
  147. package/dist/sankhyablocks/snk-taskbar.entry.js +153 -0
  148. package/dist/sankhyablocks/taskbar-elements-c119510a.js +72 -0
  149. package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
  150. package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
  151. package/dist/types/components/snk-application/snk-application.d.ts +9 -0
  152. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
  153. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
  154. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +13 -0
  155. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
  156. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
  157. package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +9 -0
  158. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +13 -0
  159. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +37 -0
  160. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +43 -0
  161. package/dist/types/components.d.ts +199 -0
  162. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  163. package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +5 -0
  164. package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
  165. package/dist/types/stencil-public-runtime.d.ts +15 -4
  166. package/loader/package.json +1 -0
  167. package/package.json +5 -5
  168. package/react/components.d.ts +0 -7
  169. package/react/components.js +0 -7
  170. package/react/components.js.map +1 -1
  171. package/dist/cjs/index-c6671817.js +0 -1642
  172. package/dist/esm/index-6a83ac96.js +0 -1614
  173. package/dist/sankhyablocks/p-4c7b32d6.entry.js +0 -1
  174. package/dist/sankhyablocks/p-56a32417.entry.js +0 -1
  175. package/dist/sankhyablocks/p-825d2c38.entry.js +0 -74
  176. package/dist/sankhyablocks/p-ab694dbc.js +0 -1
  177. package/dist/sankhyablocks/p-b559117b.js +0 -1
  178. package/dist/sankhyablocks/p-cd1dc099.js +0 -2
  179. package/dist/sankhyablocks/p-ce2d1214.entry.js +0 -1
  180. package/dist/sankhyablocks/p-d25637c9.entry.js +0 -1
  181. package/dist/sankhyablocks/p-d25803a1.entry.js +0 -1
  182. package/dist/sankhyablocks/p-edf81d2c.entry.js +0 -1
@@ -0,0 +1,64 @@
1
+ import { h } from '@stencil/core';
2
+ import FilterItemType from '../filter-item-type.enum';
3
+ export class SnkFilterPeriod {
4
+ ezChangeListener(evt) {
5
+ this.value = evt.detail;
6
+ }
7
+ render() {
8
+ if (!this.config || this.config.type !== FilterItemType.NUMBER) {
9
+ return undefined;
10
+ }
11
+ return (h("ez-number-input", { label: this.config.label, value: this.config.value }));
12
+ }
13
+ static get is() { return "snk-filter-number"; }
14
+ static get properties() {
15
+ return {
16
+ "config": {
17
+ "type": "unknown",
18
+ "mutable": false,
19
+ "complexType": {
20
+ "original": "SnkFilterItemConfig",
21
+ "resolved": "SnkFilterItemConfig",
22
+ "references": {
23
+ "SnkFilterItemConfig": {
24
+ "location": "import",
25
+ "path": "../snk-filter-item"
26
+ }
27
+ }
28
+ },
29
+ "required": false,
30
+ "optional": false,
31
+ "docs": {
32
+ "tags": [],
33
+ "text": ""
34
+ }
35
+ },
36
+ "value": {
37
+ "type": "number",
38
+ "mutable": false,
39
+ "complexType": {
40
+ "original": "number",
41
+ "resolved": "number",
42
+ "references": {}
43
+ },
44
+ "required": false,
45
+ "optional": false,
46
+ "docs": {
47
+ "tags": [],
48
+ "text": ""
49
+ },
50
+ "attribute": "value",
51
+ "reflect": false
52
+ }
53
+ };
54
+ }
55
+ static get listeners() {
56
+ return [{
57
+ "name": "ezChange",
58
+ "method": "ezChangeListener",
59
+ "target": undefined,
60
+ "capture": false,
61
+ "passive": false
62
+ }];
63
+ }
64
+ }
@@ -0,0 +1,69 @@
1
+ import { h } from '@stencil/core';
2
+ import FilterItemType from '../filter-item-type.enum';
3
+ export class SnkFilterPeriod {
4
+ ezChangeListener() {
5
+ const start = this._startDate.value;
6
+ const end = this._endDate.value;
7
+ this.value = (start || end ? { start, end } : undefined);
8
+ }
9
+ render() {
10
+ var _a, _b;
11
+ if (!this.config || this.config.type !== FilterItemType.PERIOD) {
12
+ return undefined;
13
+ }
14
+ 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 })));
15
+ }
16
+ static get is() { return "snk-filter-period"; }
17
+ static get properties() {
18
+ return {
19
+ "config": {
20
+ "type": "unknown",
21
+ "mutable": false,
22
+ "complexType": {
23
+ "original": "SnkFilterItemConfig",
24
+ "resolved": "SnkFilterItemConfig",
25
+ "references": {
26
+ "SnkFilterItemConfig": {
27
+ "location": "import",
28
+ "path": "../snk-filter-item"
29
+ }
30
+ }
31
+ },
32
+ "required": false,
33
+ "optional": false,
34
+ "docs": {
35
+ "tags": [],
36
+ "text": ""
37
+ }
38
+ },
39
+ "value": {
40
+ "type": "unknown",
41
+ "mutable": false,
42
+ "complexType": {
43
+ "original": "Period",
44
+ "resolved": "Period",
45
+ "references": {
46
+ "Period": {
47
+ "location": "local"
48
+ }
49
+ }
50
+ },
51
+ "required": false,
52
+ "optional": false,
53
+ "docs": {
54
+ "tags": [],
55
+ "text": ""
56
+ }
57
+ }
58
+ };
59
+ }
60
+ static get listeners() {
61
+ return [{
62
+ "name": "ezChange",
63
+ "method": "ezChangeListener",
64
+ "target": undefined,
65
+ "capture": false,
66
+ "passive": false
67
+ }];
68
+ }
69
+ }
@@ -0,0 +1,118 @@
1
+ import { ApplicationContext } from '@sankhyalabs/core';
2
+ import { h } from '@stencil/core';
3
+ import FilterItemType from '../filter-item-type.enum';
4
+ export class SnkFilterSearch {
5
+ ezChangeListener(_evt) {
6
+ this.value = this._searchInput.value;
7
+ }
8
+ doSearch(mode, argument) {
9
+ const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
10
+ if (this.fix) {
11
+ this.fix();
12
+ }
13
+ return new Promise((resolve, reject) => {
14
+ application.executePreparedSearch(mode, argument, this.config.props.searchContext)
15
+ .then(result => {
16
+ resolve(result);
17
+ if (this.unfix) {
18
+ this.unfix();
19
+ }
20
+ }).catch(reason => {
21
+ reject(reason);
22
+ if (this.unfix) {
23
+ this.unfix();
24
+ }
25
+ });
26
+ });
27
+ }
28
+ render() {
29
+ if (!this.config || this.config.type !== FilterItemType.SEARCH) {
30
+ return undefined;
31
+ }
32
+ return (h("ez-search", { value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
33
+ }
34
+ static get is() { return "snk-filter-search"; }
35
+ static get properties() {
36
+ return {
37
+ "config": {
38
+ "type": "unknown",
39
+ "mutable": false,
40
+ "complexType": {
41
+ "original": "SnkFilterItemConfig",
42
+ "resolved": "SnkFilterItemConfig",
43
+ "references": {
44
+ "SnkFilterItemConfig": {
45
+ "location": "import",
46
+ "path": "../snk-filter-item"
47
+ }
48
+ }
49
+ },
50
+ "required": false,
51
+ "optional": false,
52
+ "docs": {
53
+ "tags": [],
54
+ "text": ""
55
+ }
56
+ },
57
+ "value": {
58
+ "type": "unknown",
59
+ "mutable": false,
60
+ "complexType": {
61
+ "original": "Option",
62
+ "resolved": "Option",
63
+ "references": {
64
+ "Option": {
65
+ "location": "import",
66
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
67
+ }
68
+ }
69
+ },
70
+ "required": false,
71
+ "optional": false,
72
+ "docs": {
73
+ "tags": [],
74
+ "text": ""
75
+ }
76
+ },
77
+ "fix": {
78
+ "type": "unknown",
79
+ "mutable": false,
80
+ "complexType": {
81
+ "original": "()=>void",
82
+ "resolved": "() => void",
83
+ "references": {}
84
+ },
85
+ "required": false,
86
+ "optional": false,
87
+ "docs": {
88
+ "tags": [],
89
+ "text": ""
90
+ }
91
+ },
92
+ "unfix": {
93
+ "type": "unknown",
94
+ "mutable": false,
95
+ "complexType": {
96
+ "original": "()=>void",
97
+ "resolved": "() => void",
98
+ "references": {}
99
+ },
100
+ "required": false,
101
+ "optional": false,
102
+ "docs": {
103
+ "tags": [],
104
+ "text": ""
105
+ }
106
+ }
107
+ };
108
+ }
109
+ static get listeners() {
110
+ return [{
111
+ "name": "ezChange",
112
+ "method": "ezChangeListener",
113
+ "target": undefined,
114
+ "capture": false,
115
+ "passive": false
116
+ }];
117
+ }
118
+ }
@@ -0,0 +1,63 @@
1
+ import { h } from '@stencil/core';
2
+ export class SnkFilterText {
3
+ ezChangeListener(evt) {
4
+ this.value = evt.detail;
5
+ }
6
+ render() {
7
+ if (!this.config) {
8
+ return undefined;
9
+ }
10
+ return (h("ez-text-input", { label: this.config.label, value: this.config.value }));
11
+ }
12
+ static get is() { return "snk-filter-text"; }
13
+ static get properties() {
14
+ return {
15
+ "config": {
16
+ "type": "unknown",
17
+ "mutable": false,
18
+ "complexType": {
19
+ "original": "SnkFilterItemConfig",
20
+ "resolved": "SnkFilterItemConfig",
21
+ "references": {
22
+ "SnkFilterItemConfig": {
23
+ "location": "import",
24
+ "path": "../snk-filter-item"
25
+ }
26
+ }
27
+ },
28
+ "required": false,
29
+ "optional": false,
30
+ "docs": {
31
+ "tags": [],
32
+ "text": ""
33
+ }
34
+ },
35
+ "value": {
36
+ "type": "string",
37
+ "mutable": false,
38
+ "complexType": {
39
+ "original": "string",
40
+ "resolved": "string",
41
+ "references": {}
42
+ },
43
+ "required": false,
44
+ "optional": false,
45
+ "docs": {
46
+ "tags": [],
47
+ "text": ""
48
+ },
49
+ "attribute": "value",
50
+ "reflect": false
51
+ }
52
+ };
53
+ }
54
+ static get listeners() {
55
+ return [{
56
+ "name": "ezChange",
57
+ "method": "ezChangeListener",
58
+ "target": undefined,
59
+ "capture": false,
60
+ "passive": false
61
+ }];
62
+ }
63
+ }
@@ -0,0 +1,10 @@
1
+ var FilterItemType;
2
+ (function (FilterItemType) {
3
+ FilterItemType["MULTI_SELECT"] = "MULTI_SELECT";
4
+ FilterItemType["BINARY_SELECT"] = "BINARY_SELECT";
5
+ FilterItemType["PERIOD"] = "PERIOD";
6
+ FilterItemType["SEARCH"] = "SEARCH";
7
+ FilterItemType["TEXT"] = "TEXT";
8
+ FilterItemType["NUMBER"] = "NUMBER";
9
+ })(FilterItemType || (FilterItemType = {}));
10
+ export default FilterItemType;
@@ -0,0 +1,113 @@
1
+ import { h, Host } from '@stencil/core';
2
+ import FilterItemType from './filter-item-type.enum';
3
+ export class SnkFilterDetail {
4
+ changeConfig(newConfig) {
5
+ this.filterChange.emit(newConfig);
6
+ }
7
+ getContentEditor() {
8
+ switch (this.config.type) {
9
+ case FilterItemType.BINARY_SELECT:
10
+ return "snk-filter-binary-select";
11
+ case FilterItemType.PERIOD:
12
+ return "snk-filter-period";
13
+ case FilterItemType.SEARCH:
14
+ return "snk-filter-search";
15
+ case FilterItemType.NUMBER:
16
+ return "snk-filter-number";
17
+ }
18
+ return "snk-filter-text";
19
+ }
20
+ getPopUpHeaderButtons() {
21
+ if (this.config.hardFixed) {
22
+ return undefined;
23
+ }
24
+ return ([
25
+ 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 })) }),
26
+ 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 })) })
27
+ ]);
28
+ }
29
+ render() {
30
+ const ContentEditor = this.getContentEditor();
31
+ 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" }))));
32
+ }
33
+ static get is() { return "snk-filter-detail"; }
34
+ static get properties() {
35
+ return {
36
+ "config": {
37
+ "type": "unknown",
38
+ "mutable": true,
39
+ "complexType": {
40
+ "original": "SnkFilterItemConfig",
41
+ "resolved": "SnkFilterItemConfig",
42
+ "references": {
43
+ "SnkFilterItemConfig": {
44
+ "location": "import",
45
+ "path": "./snk-filter-item"
46
+ }
47
+ }
48
+ },
49
+ "required": false,
50
+ "optional": false,
51
+ "docs": {
52
+ "tags": [],
53
+ "text": ""
54
+ }
55
+ },
56
+ "keepOpened": {
57
+ "type": "boolean",
58
+ "mutable": true,
59
+ "complexType": {
60
+ "original": "boolean",
61
+ "resolved": "boolean",
62
+ "references": {}
63
+ },
64
+ "required": false,
65
+ "optional": false,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": ""
69
+ },
70
+ "attribute": "keep-opened",
71
+ "reflect": false
72
+ },
73
+ "getMessage": {
74
+ "type": "unknown",
75
+ "mutable": false,
76
+ "complexType": {
77
+ "original": "(key: string, props?: any) => string",
78
+ "resolved": "(key: string, props?: any) => string",
79
+ "references": {}
80
+ },
81
+ "required": false,
82
+ "optional": false,
83
+ "docs": {
84
+ "tags": [],
85
+ "text": ""
86
+ }
87
+ }
88
+ };
89
+ }
90
+ static get events() {
91
+ return [{
92
+ "method": "filterChange",
93
+ "name": "filterChange",
94
+ "bubbles": true,
95
+ "cancelable": true,
96
+ "composed": true,
97
+ "docs": {
98
+ "tags": [],
99
+ "text": ""
100
+ },
101
+ "complexType": {
102
+ "original": "SnkFilterItemConfig",
103
+ "resolved": "SnkFilterItemConfig",
104
+ "references": {
105
+ "SnkFilterItemConfig": {
106
+ "location": "import",
107
+ "path": "./snk-filter-item"
108
+ }
109
+ }
110
+ }
111
+ }];
112
+ }
113
+ }
@@ -0,0 +1,209 @@
1
+ import { FloatingManager } from '@sankhyalabs/core';
2
+ import { h, Host } from '@stencil/core';
3
+ import FilterItemType from './filter-item-type.enum';
4
+ export class SnkFilterItem {
5
+ constructor() {
6
+ this.innerClickCheck = (floatingContainer, node) => {
7
+ if (this._popover.keepOpened) {
8
+ return true;
9
+ }
10
+ if (node && floatingContainer) {
11
+ if (!node.offsetParent) {
12
+ return true;
13
+ }
14
+ let current = node;
15
+ do {
16
+ if (current === floatingContainer) {
17
+ return true;
18
+ }
19
+ } while ((current = current.offsetParent) != null);
20
+ }
21
+ this.detailIsVisible = false;
22
+ return false;
23
+ };
24
+ }
25
+ showDetail() {
26
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
27
+ this.detailIsVisible = true;
28
+ }
29
+ getScrollOffset() {
30
+ return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
31
+ }
32
+ hideDetail() {
33
+ if (this._floatingID != undefined) {
34
+ FloatingManager.close(this._floatingID);
35
+ }
36
+ this._floatingID = undefined;
37
+ this.detailIsVisible = false;
38
+ }
39
+ //---------------------------------------------
40
+ // Event handlers
41
+ //---------------------------------------------
42
+ clickListener(evt) {
43
+ if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
44
+ if (evt.target === this._rightIconElement && this.config.value != undefined) {
45
+ this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
46
+ }
47
+ else {
48
+ if (this.detailIsVisible) {
49
+ this.hideDetail();
50
+ }
51
+ else {
52
+ this.showDetail();
53
+ }
54
+ }
55
+ evt.preventDefault();
56
+ evt.stopImmediatePropagation();
57
+ evt.stopPropagation();
58
+ }
59
+ }
60
+ mouseDownListener(evt) {
61
+ if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
62
+ evt.preventDefault();
63
+ evt.stopImmediatePropagation();
64
+ evt.stopPropagation();
65
+ }
66
+ }
67
+ getLabel() {
68
+ const { type, value, label, props } = this.config;
69
+ if (value) {
70
+ if (type === FilterItemType.BINARY_SELECT) {
71
+ const [optOne, optTwo] = props.options;
72
+ if (optOne.name === value) {
73
+ return optOne.label;
74
+ }
75
+ if (optTwo.name === value) {
76
+ return optTwo.label;
77
+ }
78
+ }
79
+ if (type === FilterItemType.PERIOD) {
80
+ const period = value;
81
+ const dateFormater = new Intl.DateTimeFormat("pt-BR");
82
+ if (period.end && period.start) {
83
+ return `${label}: ${dateFormater.format(period.start)} a ${dateFormater.format(period.end)}`;
84
+ }
85
+ else {
86
+ if (period.start) {
87
+ return `${label}: A partir de ${dateFormater.format(period.end)}`;
88
+ }
89
+ else {
90
+ return `${label}: Até ${dateFormater.format(period.end)}`;
91
+ }
92
+ }
93
+ }
94
+ if (type === FilterItemType.SEARCH) {
95
+ return `${label}: ${value.value} - ${value.label}`;
96
+ }
97
+ return `${label}: ${value}`;
98
+ }
99
+ return label;
100
+ }
101
+ componentDidRender() {
102
+ if (this._floatingID == undefined) {
103
+ if (this._popover) {
104
+ this._popover.remove();
105
+ }
106
+ }
107
+ }
108
+ filterChangeListener() {
109
+ this.hideDetail();
110
+ }
111
+ getIconName() {
112
+ if (this.config.value != undefined) {
113
+ return "close";
114
+ }
115
+ return this.detailIsVisible ? "chevron-up" : "chevron-down";
116
+ }
117
+ render() {
118
+ const leftIcon = this.config.type === FilterItemType.PERIOD ? "calendar" : undefined;
119
+ 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 }))));
120
+ }
121
+ static get is() { return "snk-filter-item"; }
122
+ static get properties() {
123
+ return {
124
+ "config": {
125
+ "type": "unknown",
126
+ "mutable": true,
127
+ "complexType": {
128
+ "original": "SnkFilterItemConfig",
129
+ "resolved": "SnkFilterItemConfig",
130
+ "references": {
131
+ "SnkFilterItemConfig": {
132
+ "location": "local"
133
+ }
134
+ }
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": ""
141
+ }
142
+ },
143
+ "getMessage": {
144
+ "type": "unknown",
145
+ "mutable": false,
146
+ "complexType": {
147
+ "original": "(key: string, props?: any) => string",
148
+ "resolved": "(key: string, props?: any) => string",
149
+ "references": {}
150
+ },
151
+ "required": false,
152
+ "optional": false,
153
+ "docs": {
154
+ "tags": [],
155
+ "text": ""
156
+ }
157
+ }
158
+ };
159
+ }
160
+ static get states() {
161
+ return {
162
+ "detailIsVisible": {}
163
+ };
164
+ }
165
+ static get events() {
166
+ return [{
167
+ "method": "filterChange",
168
+ "name": "filterChange",
169
+ "bubbles": true,
170
+ "cancelable": true,
171
+ "composed": true,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": ""
175
+ },
176
+ "complexType": {
177
+ "original": "SnkFilterItemConfig",
178
+ "resolved": "SnkFilterItemConfig",
179
+ "references": {
180
+ "SnkFilterItemConfig": {
181
+ "location": "local"
182
+ }
183
+ }
184
+ }
185
+ }];
186
+ }
187
+ static get elementRef() { return "_filterItemElement"; }
188
+ static get listeners() {
189
+ return [{
190
+ "name": "click",
191
+ "method": "clickListener",
192
+ "target": undefined,
193
+ "capture": true,
194
+ "passive": false
195
+ }, {
196
+ "name": "mousedown",
197
+ "method": "mouseDownListener",
198
+ "target": undefined,
199
+ "capture": true,
200
+ "passive": false
201
+ }, {
202
+ "name": "filterChange",
203
+ "method": "filterChangeListener",
204
+ "target": undefined,
205
+ "capture": false,
206
+ "passive": false
207
+ }];
208
+ }
209
+ }