@sankhyalabs/sankhyablocks 1.3.34 → 1.4.0-beta.1
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.
- package/dist/cjs/SnkMessageBuilder-7717f1e4.js +326 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/css-shim-b8158822.js +6 -0
- package/dist/cjs/dom-36862b77.js +75 -0
- package/dist/cjs/filter-item-type.enum-e2e1bc5b.js +14 -0
- package/dist/cjs/index-02201bc9.js +2397 -0
- package/dist/cjs/index-b0b676c5.js +3298 -0
- package/dist/cjs/loader.cjs.js +19 -3
- package/dist/cjs/sankhyablocks.cjs.js +117 -5
- package/dist/cjs/shadow-css-346c0795.js +389 -0
- package/dist/cjs/snk-application.cjs.entry.js +720 -168
- package/dist/cjs/snk-crud.cjs.entry.js +70 -0
- package/dist/cjs/snk-data-unit.cjs.entry.js +280 -0
- package/dist/cjs/snk-filter-bar.cjs.entry.js +278 -0
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +47 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +49 -0
- package/dist/cjs/snk-filter-item.cjs.entry.js +154 -0
- package/dist/cjs/snk-filter-list.cjs.entry.js +91 -0
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +23 -0
- package/dist/cjs/snk-filter-number.cjs.entry.js +24 -0
- package/dist/cjs/snk-filter-period.cjs.entry.js +37 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +44 -0
- package/dist/cjs/snk-filter-text.cjs.entry.js +22 -0
- package/dist/cjs/snk-form.cjs.entry.js +133 -0
- package/dist/cjs/snk-grid.cjs.entry.js +79 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
- package/dist/cjs/snk-taskbar.cjs.entry.js +160 -0
- package/dist/cjs/taskbar-elements-283c737e.js +93 -0
- package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
- package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +17 -2
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +9 -2
- package/dist/collection/components/snk-application/snk-application.js +1126 -621
- package/dist/collection/components/snk-crud/snk-crud.css +6 -0
- package/dist/collection/components/snk-crud/snk-crud.js +203 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.css +6 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +544 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +88 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +64 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +65 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +78 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +118 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +63 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +10 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +118 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +255 -0
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +233 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +114 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +353 -0
- package/dist/collection/components/snk-form/snk-form.css +34 -0
- package/dist/collection/components/snk-form/snk-form.js +258 -0
- package/dist/collection/components/snk-grid/snk-grid.css +18 -0
- package/dist/collection/components/snk-grid/snk-grid.js +205 -0
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +80 -79
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +86 -0
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.css +3 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +307 -0
- package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +12 -9
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +37 -12
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +52 -21
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +54 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +4 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/totals-fetcher.js +47 -0
- package/dist/collection/lib/index.js +1 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +121 -0
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +23 -0
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +18 -0
- package/dist/collection/lib/message/resources/snk-form.msg.js +10 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +17 -0
- package/dist/components/SnkMessageBuilder.js +303 -0
- package/dist/components/filter-item-type.enum.js +12 -0
- package/dist/components/index.d.ts +18 -5
- package/dist/components/index.js +22 -0
- package/dist/components/index2.js +2384 -0
- package/dist/components/snk-application2.js +700 -139
- package/dist/components/snk-crud.d.ts +11 -0
- package/dist/components/snk-crud.js +133 -0
- package/dist/components/snk-data-unit.d.ts +11 -0
- package/dist/components/snk-data-unit.js +303 -0
- package/dist/components/snk-filter-bar.d.ts +11 -0
- package/dist/components/snk-filter-bar.js +6 -0
- package/dist/components/snk-filter-bar2.js +310 -0
- package/dist/components/snk-filter-binary-select.d.ts +11 -0
- package/dist/components/snk-filter-binary-select.js +63 -0
- package/dist/components/snk-filter-detail.d.ts +11 -0
- package/dist/components/snk-filter-detail.js +6 -0
- package/dist/components/snk-filter-detail2.js +63 -0
- package/dist/components/snk-filter-item.d.ts +11 -0
- package/dist/components/snk-filter-item.js +6 -0
- package/dist/components/snk-filter-item2.js +175 -0
- package/dist/components/snk-filter-list.d.ts +11 -0
- package/dist/components/snk-filter-list.js +6 -0
- package/dist/components/snk-filter-list2.js +111 -0
- package/dist/components/snk-filter-multi-select.d.ts +11 -0
- package/dist/components/snk-filter-multi-select.js +39 -0
- package/dist/components/snk-filter-number.d.ts +11 -0
- package/dist/components/snk-filter-number.js +40 -0
- package/dist/components/snk-filter-period.d.ts +11 -0
- package/dist/components/snk-filter-period.js +53 -0
- package/dist/components/snk-filter-search.d.ts +11 -0
- package/dist/components/snk-filter-search.js +62 -0
- package/dist/components/snk-filter-text.d.ts +11 -0
- package/dist/components/snk-filter-text.js +38 -0
- package/dist/components/snk-form.d.ts +11 -0
- package/dist/components/snk-form.js +6 -0
- package/dist/components/snk-form2.js +159 -0
- package/dist/components/snk-grid.d.ts +11 -0
- package/dist/components/snk-grid.js +6 -0
- package/dist/components/snk-grid2.js +127 -0
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-taskbar.d.ts +11 -0
- package/dist/components/snk-taskbar.js +6 -0
- package/dist/components/snk-taskbar2.js +264 -0
- package/dist/components/taskbar-processor.js +45 -0
- package/dist/components/teste-pesquisa.js +1 -1
- package/dist/esm/SnkMessageBuilder-a7da466b.js +303 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/css-shim-b3f2ee8d.js +4 -0
- package/dist/esm/dom-665d6011.js +73 -0
- package/dist/esm/filter-item-type.enum-61fbf80a.js +12 -0
- package/dist/esm/index-2b4d2d14.js +3262 -0
- package/dist/esm/index-f1d3e4da.js +2384 -0
- package/dist/esm/loader.js +19 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/sankhyablocks.js +117 -5
- package/dist/esm/shadow-css-b18e99d7.js +387 -0
- package/dist/esm/snk-application.entry.js +692 -140
- package/dist/esm/snk-crud.entry.js +66 -0
- package/dist/esm/snk-data-unit.entry.js +276 -0
- package/dist/esm/snk-filter-bar.entry.js +274 -0
- package/dist/esm/snk-filter-binary-select.entry.js +43 -0
- package/dist/esm/snk-filter-detail.entry.js +45 -0
- package/dist/esm/snk-filter-item.entry.js +150 -0
- package/dist/esm/snk-filter-list.entry.js +87 -0
- package/dist/esm/snk-filter-multi-select.entry.js +19 -0
- package/dist/esm/snk-filter-number.entry.js +20 -0
- package/dist/esm/snk-filter-period.entry.js +33 -0
- package/dist/esm/snk-filter-search.entry.js +40 -0
- package/dist/esm/snk-filter-text.entry.js +18 -0
- package/dist/esm/snk-form.entry.js +129 -0
- package/dist/esm/snk-grid.entry.js +75 -0
- package/dist/esm/snk-pesquisa.entry.js +2 -2
- package/dist/esm/snk-taskbar.entry.js +156 -0
- package/dist/esm/taskbar-elements-35d64ff9.js +90 -0
- package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
- package/dist/esm/teste-pesquisa.entry.js +2 -2
- package/dist/sankhyablocks/SnkMessageBuilder-a7da466b.js +303 -0
- package/dist/sankhyablocks/app-globals-0f993ce5.js +3 -0
- package/dist/sankhyablocks/css-shim-b3f2ee8d.js +4 -0
- package/dist/sankhyablocks/dom-665d6011.js +73 -0
- package/dist/sankhyablocks/filter-item-type.enum-61fbf80a.js +12 -0
- package/dist/sankhyablocks/index-2b4d2d14.js +3262 -0
- package/dist/sankhyablocks/index-f1d3e4da.js +2384 -0
- package/dist/sankhyablocks/index.esm.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +129 -1
- package/dist/sankhyablocks/shadow-css-b18e99d7.js +387 -0
- package/dist/sankhyablocks/snk-application.entry.js +8148 -0
- package/dist/sankhyablocks/snk-crud.entry.js +66 -0
- package/dist/sankhyablocks/snk-data-unit.entry.js +276 -0
- package/dist/sankhyablocks/snk-filter-bar.entry.js +274 -0
- package/dist/sankhyablocks/snk-filter-binary-select.entry.js +43 -0
- package/dist/sankhyablocks/snk-filter-detail.entry.js +45 -0
- package/dist/sankhyablocks/snk-filter-item.entry.js +150 -0
- package/dist/sankhyablocks/snk-filter-list.entry.js +87 -0
- package/dist/sankhyablocks/snk-filter-multi-select.entry.js +19 -0
- package/dist/sankhyablocks/snk-filter-number.entry.js +20 -0
- package/dist/sankhyablocks/snk-filter-period.entry.js +33 -0
- package/dist/sankhyablocks/snk-filter-search.entry.js +40 -0
- package/dist/sankhyablocks/snk-filter-text.entry.js +18 -0
- package/dist/sankhyablocks/snk-form.entry.js +129 -0
- package/dist/sankhyablocks/snk-grid.entry.js +75 -0
- package/dist/sankhyablocks/snk-pesquisa.entry.js +311 -0
- package/dist/sankhyablocks/snk-taskbar.entry.js +156 -0
- package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +90 -0
- package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +45 -0
- package/dist/sankhyablocks/teste-pesquisa.entry.js +33 -0
- package/dist/types/components/snk-application/errorhandler/snk-error-handler.d.ts +1 -0
- package/dist/types/components/snk-application/snk-application.d.ts +145 -15
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +14 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +12 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +7 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +9 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +14 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +40 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +51 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +29 -0
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +84 -0
- package/dist/types/components.d.ts +696 -8
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -6
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +2 -0
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +6 -0
- package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
- package/dist/types/lib/http/data-fetcher/fetchers/totals-fetcher.d.ts +8 -0
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/message/SnkMessageBuilder.d.ts +42 -0
- package/dist/types/lib/message/resources/snk-data-unit.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-form.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-taskbar.msg.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +15 -4
- package/loader/package.json +1 -0
- package/package.json +5 -5
- package/react/components.d.ts +0 -2
- package/react/components.js +0 -2
- package/react/components.js.map +1 -1
- package/dist/cjs/index-1133bc2a.js +0 -1235
- package/dist/esm/index-ffda6382.js +0 -1208
- package/dist/sankhyablocks/p-2a7b4cb3.entry.js +0 -1
- package/dist/sankhyablocks/p-9520d78a.entry.js +0 -1
- package/dist/sankhyablocks/p-98e8490d.entry.js +0 -69
- package/dist/sankhyablocks/p-edcb9d8e.js +0 -2
|
@@ -0,0 +1,255 @@
|
|
|
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
|
+
async showUp(open = false) {
|
|
26
|
+
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
27
|
+
if (open) {
|
|
28
|
+
window.requestAnimationFrame(() => {
|
|
29
|
+
this.showDetail();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
showDetail() {
|
|
34
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset() });
|
|
35
|
+
this.detailIsVisible = true;
|
|
36
|
+
}
|
|
37
|
+
getScrollOffset() {
|
|
38
|
+
return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
|
|
39
|
+
}
|
|
40
|
+
hideDetail() {
|
|
41
|
+
if (this._floatingID != undefined) {
|
|
42
|
+
FloatingManager.close(this._floatingID);
|
|
43
|
+
}
|
|
44
|
+
this._floatingID = undefined;
|
|
45
|
+
this.detailIsVisible = false;
|
|
46
|
+
}
|
|
47
|
+
//---------------------------------------------
|
|
48
|
+
// Event handlers
|
|
49
|
+
//---------------------------------------------
|
|
50
|
+
clickListener(evt) {
|
|
51
|
+
if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
52
|
+
if (evt.target === this._rightIconElement && this.config.value != undefined) {
|
|
53
|
+
this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
if (this.detailIsVisible) {
|
|
57
|
+
this.hideDetail();
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.showDetail();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
evt.preventDefault();
|
|
64
|
+
evt.stopImmediatePropagation();
|
|
65
|
+
evt.stopPropagation();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
mouseDownListener(evt) {
|
|
69
|
+
if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
|
|
70
|
+
evt.preventDefault();
|
|
71
|
+
evt.stopImmediatePropagation();
|
|
72
|
+
evt.stopPropagation();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
getLabel() {
|
|
76
|
+
const { type, value, label, props } = this.config;
|
|
77
|
+
if (value) {
|
|
78
|
+
if (type === FilterItemType.BINARY_SELECT) {
|
|
79
|
+
const [optOne, optTwo] = props.options;
|
|
80
|
+
if (optOne.name === value) {
|
|
81
|
+
return optOne.label;
|
|
82
|
+
}
|
|
83
|
+
if (optTwo.name === value) {
|
|
84
|
+
return optTwo.label;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (type === FilterItemType.MULTI_SELECT) {
|
|
88
|
+
const opt = props.options.find(opt => opt.value === value);
|
|
89
|
+
return `${label}: ${opt.label}`;
|
|
90
|
+
}
|
|
91
|
+
if (type === FilterItemType.PERIOD) {
|
|
92
|
+
let { end, start } = value;
|
|
93
|
+
if (typeof end === "string") {
|
|
94
|
+
end = new Date(end);
|
|
95
|
+
end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
|
|
96
|
+
}
|
|
97
|
+
if (typeof start === "string") {
|
|
98
|
+
start = new Date(start);
|
|
99
|
+
start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
|
|
100
|
+
}
|
|
101
|
+
const dateFormater = new Intl.DateTimeFormat("pt-BR");
|
|
102
|
+
if (end && start) {
|
|
103
|
+
return `${label}: ${dateFormater.format(start)} a ${dateFormater.format(end)}`;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (start) {
|
|
107
|
+
return `${label}: A partir de ${dateFormater.format(start)}`;
|
|
108
|
+
}
|
|
109
|
+
else if (end) {
|
|
110
|
+
return `${label}: Até ${dateFormater.format(end)}`;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
return label;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (type === FilterItemType.SEARCH) {
|
|
118
|
+
return `${label}: ${value.value} - ${value.label}`;
|
|
119
|
+
}
|
|
120
|
+
return `${label}: ${value}`;
|
|
121
|
+
}
|
|
122
|
+
return label;
|
|
123
|
+
}
|
|
124
|
+
componentDidRender() {
|
|
125
|
+
if (this._floatingID == undefined) {
|
|
126
|
+
if (this._popover) {
|
|
127
|
+
this._popover.remove();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
filterChangeListener() {
|
|
132
|
+
this.hideDetail();
|
|
133
|
+
}
|
|
134
|
+
getIconName() {
|
|
135
|
+
if (this.config.value != undefined) {
|
|
136
|
+
return "close";
|
|
137
|
+
}
|
|
138
|
+
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
const leftIcon = this.config.type === FilterItemType.PERIOD ? "calendar" : undefined;
|
|
142
|
+
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 }))));
|
|
143
|
+
}
|
|
144
|
+
static get is() { return "snk-filter-item"; }
|
|
145
|
+
static get properties() {
|
|
146
|
+
return {
|
|
147
|
+
"config": {
|
|
148
|
+
"type": "unknown",
|
|
149
|
+
"mutable": true,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "SnkFilterItemConfig",
|
|
152
|
+
"resolved": "SnkFilterItemConfig",
|
|
153
|
+
"references": {
|
|
154
|
+
"SnkFilterItemConfig": {
|
|
155
|
+
"location": "local"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"required": false,
|
|
160
|
+
"optional": false,
|
|
161
|
+
"docs": {
|
|
162
|
+
"tags": [],
|
|
163
|
+
"text": ""
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"getMessage": {
|
|
167
|
+
"type": "unknown",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "(key: string, props?: any) => string",
|
|
171
|
+
"resolved": "(key: string, props?: any) => string",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [],
|
|
178
|
+
"text": ""
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
static get states() {
|
|
184
|
+
return {
|
|
185
|
+
"detailIsVisible": {}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
static get events() {
|
|
189
|
+
return [{
|
|
190
|
+
"method": "filterChange",
|
|
191
|
+
"name": "filterChange",
|
|
192
|
+
"bubbles": true,
|
|
193
|
+
"cancelable": true,
|
|
194
|
+
"composed": true,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": ""
|
|
198
|
+
},
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "SnkFilterItemConfig",
|
|
201
|
+
"resolved": "SnkFilterItemConfig",
|
|
202
|
+
"references": {
|
|
203
|
+
"SnkFilterItemConfig": {
|
|
204
|
+
"location": "local"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}];
|
|
209
|
+
}
|
|
210
|
+
static get methods() {
|
|
211
|
+
return {
|
|
212
|
+
"showUp": {
|
|
213
|
+
"complexType": {
|
|
214
|
+
"signature": "(open?: boolean) => Promise<void>",
|
|
215
|
+
"parameters": [{
|
|
216
|
+
"tags": [],
|
|
217
|
+
"text": ""
|
|
218
|
+
}],
|
|
219
|
+
"references": {
|
|
220
|
+
"Promise": {
|
|
221
|
+
"location": "global"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"return": "Promise<void>"
|
|
225
|
+
},
|
|
226
|
+
"docs": {
|
|
227
|
+
"text": "",
|
|
228
|
+
"tags": []
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
static get elementRef() { return "_filterItemElement"; }
|
|
234
|
+
static get listeners() {
|
|
235
|
+
return [{
|
|
236
|
+
"name": "click",
|
|
237
|
+
"method": "clickListener",
|
|
238
|
+
"target": undefined,
|
|
239
|
+
"capture": true,
|
|
240
|
+
"passive": false
|
|
241
|
+
}, {
|
|
242
|
+
"name": "mousedown",
|
|
243
|
+
"method": "mouseDownListener",
|
|
244
|
+
"target": undefined,
|
|
245
|
+
"capture": true,
|
|
246
|
+
"passive": false
|
|
247
|
+
}, {
|
|
248
|
+
"name": "filterChange",
|
|
249
|
+
"method": "filterChangeListener",
|
|
250
|
+
"target": undefined,
|
|
251
|
+
"capture": false,
|
|
252
|
+
"passive": false
|
|
253
|
+
}];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { ArrayUtils, FloatingManager } from '@sankhyalabs/core';
|
|
2
|
+
import { h, Host } from '@stencil/core';
|
|
3
|
+
const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
|
|
4
|
+
const MAX_FILTERS = 5;
|
|
5
|
+
export class SnkFilterList {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.innerClickCheck = (floatingContainer, node) => {
|
|
8
|
+
if (node && floatingContainer) {
|
|
9
|
+
if (!node.offsetParent) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
let current = node;
|
|
13
|
+
do {
|
|
14
|
+
if (current === floatingContainer || current === this._element) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
} while ((current = current.offsetParent) != null);
|
|
18
|
+
}
|
|
19
|
+
this._detailIsVisible = false;
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
showList() {
|
|
24
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck });
|
|
25
|
+
this._detailIsVisible = true;
|
|
26
|
+
this._showAll = false;
|
|
27
|
+
this._filterArgument = "";
|
|
28
|
+
}
|
|
29
|
+
hideList() {
|
|
30
|
+
if (this._floatingID != undefined) {
|
|
31
|
+
FloatingManager.close(this._floatingID);
|
|
32
|
+
}
|
|
33
|
+
this._floatingID = undefined;
|
|
34
|
+
this._detailIsVisible = false;
|
|
35
|
+
}
|
|
36
|
+
buttonClick() {
|
|
37
|
+
if (this._detailIsVisible) {
|
|
38
|
+
this.hideList();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.showList();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
componentDidRender() {
|
|
45
|
+
if (this._floatingID == undefined) {
|
|
46
|
+
if (this._popover) {
|
|
47
|
+
this._popover.remove();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
buildItemElement(item) {
|
|
52
|
+
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)));
|
|
53
|
+
}
|
|
54
|
+
itemSelected(itemName) {
|
|
55
|
+
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
56
|
+
this._showAll = true;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.hideList();
|
|
60
|
+
this.snkItemSelected.emit(itemName);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
getFilterItems() {
|
|
64
|
+
const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
|
|
65
|
+
if (items.length === 0) {
|
|
66
|
+
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.emptyText);
|
|
67
|
+
}
|
|
68
|
+
const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
|
|
69
|
+
if (hideItems) {
|
|
70
|
+
items.splice(MAX_FILTERS);
|
|
71
|
+
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" });
|
|
72
|
+
}
|
|
73
|
+
return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
|
|
74
|
+
}
|
|
75
|
+
getFooterItems() {
|
|
76
|
+
return this.items.filter(item => item.kind === "FOOTER");
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, 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.findFilterText, 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))));
|
|
80
|
+
}
|
|
81
|
+
static get is() { return "snk-filter-list"; }
|
|
82
|
+
static get properties() {
|
|
83
|
+
return {
|
|
84
|
+
"label": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "string",
|
|
89
|
+
"resolved": "string",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": ""
|
|
97
|
+
},
|
|
98
|
+
"attribute": "label",
|
|
99
|
+
"reflect": false
|
|
100
|
+
},
|
|
101
|
+
"iconName": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string",
|
|
106
|
+
"resolved": "string",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
},
|
|
115
|
+
"attribute": "icon-name",
|
|
116
|
+
"reflect": false
|
|
117
|
+
},
|
|
118
|
+
"items": {
|
|
119
|
+
"type": "unknown",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "Array<ListItem>",
|
|
123
|
+
"resolved": "ListItem[]",
|
|
124
|
+
"references": {
|
|
125
|
+
"Array": {
|
|
126
|
+
"location": "global"
|
|
127
|
+
},
|
|
128
|
+
"ListItem": {
|
|
129
|
+
"location": "local"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"getMessage": {
|
|
141
|
+
"type": "unknown",
|
|
142
|
+
"mutable": false,
|
|
143
|
+
"complexType": {
|
|
144
|
+
"original": "(key: string, props?: any) => string",
|
|
145
|
+
"resolved": "(key: string, props?: any) => string",
|
|
146
|
+
"references": {}
|
|
147
|
+
},
|
|
148
|
+
"required": false,
|
|
149
|
+
"optional": false,
|
|
150
|
+
"docs": {
|
|
151
|
+
"tags": [],
|
|
152
|
+
"text": ""
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"emptyText": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "string",
|
|
160
|
+
"resolved": "string",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": ""
|
|
168
|
+
},
|
|
169
|
+
"attribute": "empty-text",
|
|
170
|
+
"reflect": false
|
|
171
|
+
},
|
|
172
|
+
"findFilterText": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "string",
|
|
177
|
+
"resolved": "string",
|
|
178
|
+
"references": {}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": ""
|
|
185
|
+
},
|
|
186
|
+
"attribute": "find-filter-text",
|
|
187
|
+
"reflect": false
|
|
188
|
+
},
|
|
189
|
+
"buttonClass": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"mutable": false,
|
|
192
|
+
"complexType": {
|
|
193
|
+
"original": "string",
|
|
194
|
+
"resolved": "string",
|
|
195
|
+
"references": {}
|
|
196
|
+
},
|
|
197
|
+
"required": false,
|
|
198
|
+
"optional": false,
|
|
199
|
+
"docs": {
|
|
200
|
+
"tags": [],
|
|
201
|
+
"text": ""
|
|
202
|
+
},
|
|
203
|
+
"attribute": "button-class",
|
|
204
|
+
"reflect": false
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
static get states() {
|
|
209
|
+
return {
|
|
210
|
+
"_filterArgument": {},
|
|
211
|
+
"_showAll": {}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
static get events() {
|
|
215
|
+
return [{
|
|
216
|
+
"method": "snkItemSelected",
|
|
217
|
+
"name": "snkItemSelected",
|
|
218
|
+
"bubbles": true,
|
|
219
|
+
"cancelable": true,
|
|
220
|
+
"composed": true,
|
|
221
|
+
"docs": {
|
|
222
|
+
"tags": [],
|
|
223
|
+
"text": ""
|
|
224
|
+
},
|
|
225
|
+
"complexType": {
|
|
226
|
+
"original": "string",
|
|
227
|
+
"resolved": "string",
|
|
228
|
+
"references": {}
|
|
229
|
+
}
|
|
230
|
+
}];
|
|
231
|
+
}
|
|
232
|
+
static get elementRef() { return "_element"; }
|
|
233
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: minmax(100px, 100%) 1fr 1fr;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.snk-filter__popover-container{
|
|
7
|
+
/*private*/
|
|
8
|
+
display: flex;
|
|
9
|
+
cursor: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.snk-filter__popover{
|
|
13
|
+
/*private*/
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
position: absolute;
|
|
17
|
+
width: fit-content;
|
|
18
|
+
height: fit-content;
|
|
19
|
+
min-width: 265px;
|
|
20
|
+
|
|
21
|
+
/*public*/
|
|
22
|
+
z-index: var(--more-visible, 1);
|
|
23
|
+
background-color: var(--background--xlight, #fff);
|
|
24
|
+
border-radius: var(--border--radius-medium, 12px);
|
|
25
|
+
box-shadow: var(--shadow, 0px 0px 16px 0px #000);
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.snk-filter-item__editor-header{
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
font-weight: var(--text-weight--medium, 400);
|
|
32
|
+
color: var(--color--title-primary, #2B3A54);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.snk-filter__popover-rule{
|
|
36
|
+
border-style: solid;
|
|
37
|
+
border-color: var(--color--disable-secondary, #F2F5F8);
|
|
38
|
+
border-radius: 1px;
|
|
39
|
+
border-width: 1px;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.editor__ez-check{
|
|
44
|
+
--ez-check__label--padding-left: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.snk-filter-item__editor-header-button{
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
flex-grow: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.snk-filter-bar__divider{
|
|
53
|
+
margin-bottom: var(--space--small);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.snk-filter-bar__filter-list-items-container{
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
max-height: 360px;
|
|
59
|
+
margin-top: var(--space--small, 6px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.snk-filter-bar__filter-list-item{
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
border-radius: var(--border--radius-small, 6px);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.snk-filter-bar__filter-list-item__label{
|
|
68
|
+
color: var(--title--primary);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.snk-filter-bar__filter-list-item__label--secondary{
|
|
72
|
+
color: var(--text--primary);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.snk-filter-bar__filter-list-item__icon{
|
|
76
|
+
--ez-icon--color: var(--title--primary);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.snk-filter-bar__filter-list-item__icon--secondary{
|
|
80
|
+
--ez-icon--color: var(--text--secondary);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.snk-filter-bar__filter-list-item.preselected {
|
|
84
|
+
|
|
85
|
+
background-color: var(--background--medium);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.snk-filter-bar__filter-list-item:hover{
|
|
89
|
+
background-color: var(--background--medium);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.snk-filter-bar__filter-list-items-container--empty{
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100px;
|
|
95
|
+
display: flex;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
align-self: center;
|
|
98
|
+
align-items: center;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.snk-filter-bar__filter-list-items-button--active{
|
|
102
|
+
position: relative;
|
|
103
|
+
}
|
|
104
|
+
.snk-filter-bar__filter-list-items-button--active::after{
|
|
105
|
+
display: flex;
|
|
106
|
+
position: absolute;
|
|
107
|
+
content: "";
|
|
108
|
+
width: 8px;
|
|
109
|
+
height: 8px;
|
|
110
|
+
top: 7px;
|
|
111
|
+
left: 17px;
|
|
112
|
+
background-color: var(--icon--alert--color, #008561);
|
|
113
|
+
border-radius: 50%;
|
|
114
|
+
}
|