@sankhyalabs/sankhyablocks 1.3.31-beta.16 → 1.3.31-beta.18
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-79cf15c5.js → SnkMessageBuilder-02c2ca02.js} +137 -1
- 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-5575fe3d.js → index-b0b676c5.js} +1598 -145
- package/dist/cjs/loader.cjs.js +18 -2
- package/dist/cjs/sankhyablocks.cjs.js +116 -4
- package/dist/cjs/shadow-css-346c0795.js +389 -0
- package/dist/cjs/snk-application.cjs.entry.js +662 -66
- package/dist/cjs/snk-crud.cjs.entry.js +3 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +23 -24
- package/dist/cjs/snk-filter-bar.cjs.entry.js +247 -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 +143 -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 +26 -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_2.cjs.entry.js → snk-form.cjs.entry.js} +21 -65
- 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 +17 -13
- package/dist/cjs/{taskbar-elements-2ae0d005.js → taskbar-elements-283c737e.js} +37 -18
- 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 +10 -0
- package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +7 -0
- package/dist/collection/components/snk-application/snk-application.js +89 -17
- package/dist/collection/components/snk-crud/snk-crud.js +41 -3
- 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 +69 -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 +244 -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 +305 -0
- package/dist/collection/components/snk-form/snk-form.js +41 -1
- package/dist/collection/components/snk-grid/snk-grid.css +14 -1
- package/dist/collection/components/snk-grid/snk-grid.js +35 -3
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +35 -17
- package/dist/collection/components/snk-taskbar/processor/taskbar-processor.js +43 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +36 -11
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +24 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +388 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +18 -0
- package/dist/components/SnkMessageBuilder.js +137 -2
- package/dist/components/filter-item-type.enum.js +12 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +14 -0
- package/dist/components/index2.js +2384 -0
- package/dist/components/snk-application2.js +628 -30
- package/dist/components/snk-crud.js +29 -3
- package/dist/components/snk-data-unit.js +2 -3
- 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 +278 -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 +164 -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 +42 -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-form2.js +21 -2
- package/dist/components/snk-grid2.js +42 -7
- package/dist/components/snk-pesquisa2.js +1 -1
- package/dist/components/snk-taskbar2.js +50 -27
- package/dist/components/taskbar-processor.js +45 -0
- package/dist/components/teste-pesquisa.js +1 -1
- package/dist/esm/{SnkMessageBuilder-3cdde541.js → SnkMessageBuilder-65d431bd.js} +137 -2
- 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-e5b61043.js +2384 -0
- package/dist/esm/loader.js +18 -2
- package/dist/esm/sankhyablocks.js +116 -4
- package/dist/esm/shadow-css-b18e99d7.js +387 -0
- package/dist/esm/snk-application.entry.js +627 -31
- package/dist/esm/snk-crud.entry.js +3 -2
- package/dist/esm/snk-data-unit.entry.js +3 -4
- package/dist/esm/snk-filter-bar.entry.js +243 -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 +139 -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 +22 -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_2.entry.js → snk-form.entry.js} +21 -64
- 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 +16 -12
- 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-65d431bd.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-e5b61043.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 +8426 -0
- package/dist/sankhyablocks/snk-crud.entry.js +61 -0
- package/dist/sankhyablocks/snk-data-unit.entry.js +272 -0
- package/dist/sankhyablocks/snk-filter-bar.entry.js +243 -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 +139 -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 +22 -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 +9 -0
- 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 +13 -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 +45 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +3 -2
- package/dist/types/components/snk-taskbar/processor/taskbar-processor.d.ts +12 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +17 -1
- package/dist/types/components.d.ts +277 -2
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +5 -0
- package/dist/types/lib/message/resources/snk-filter-bar.msg.d.ts +2 -0
- package/package.json +2 -2
- package/react/components.d.ts +0 -7
- package/react/components.js +0 -7
- package/react/components.js.map +1 -1
- package/dist/esm/index-cf91f542.js +0 -1817
- package/dist/esm/taskbar-elements-bcccc0ff.js +0 -72
- package/dist/sankhyablocks/p-1ba29824.entry.js +0 -74
- package/dist/sankhyablocks/p-2266555e.entry.js +0 -1
- package/dist/sankhyablocks/p-23c4c94f.js +0 -2
- package/dist/sankhyablocks/p-2454be94.js +0 -1
- package/dist/sankhyablocks/p-49743bc5.js +0 -1
- package/dist/sankhyablocks/p-4fa389bd.entry.js +0 -1
- package/dist/sankhyablocks/p-5327ba05.entry.js +0 -1
- package/dist/sankhyablocks/p-7a922fb4.entry.js +0 -1
- package/dist/sankhyablocks/p-92d6f826.entry.js +0 -1
- package/dist/sankhyablocks/p-bdeef7f2.entry.js +0 -1
|
@@ -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", { suppressEmptyOption: true, 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,118 @@
|
|
|
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.MULTI_SELECT:
|
|
12
|
+
return "snk-filter-multi-select";
|
|
13
|
+
case FilterItemType.PERIOD:
|
|
14
|
+
return "snk-filter-period";
|
|
15
|
+
case FilterItemType.SEARCH:
|
|
16
|
+
return "snk-filter-search";
|
|
17
|
+
case FilterItemType.NUMBER:
|
|
18
|
+
return "snk-filter-number";
|
|
19
|
+
}
|
|
20
|
+
return "snk-filter-text";
|
|
21
|
+
}
|
|
22
|
+
removeItem() {
|
|
23
|
+
this.changeConfig(Object.assign(Object.assign({}, this.config), { visible: false, fixed: false, value: undefined }));
|
|
24
|
+
}
|
|
25
|
+
getPopUpHeaderButtons() {
|
|
26
|
+
if (this.config.hardFixed) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return ([
|
|
30
|
+
h("ez-icon", { title: this.getMessage("snkFilterBar.removeFilter"), class: "sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: "delete", onClick: () => this.removeItem() }),
|
|
31
|
+
h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const ContentEditor = this.getContentEditor();
|
|
36
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined })) }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { value: this._editor["value"] })), class: "ez-button--primary ez-padding-left--medium" }))));
|
|
37
|
+
}
|
|
38
|
+
static get is() { return "snk-filter-detail"; }
|
|
39
|
+
static get properties() {
|
|
40
|
+
return {
|
|
41
|
+
"config": {
|
|
42
|
+
"type": "unknown",
|
|
43
|
+
"mutable": true,
|
|
44
|
+
"complexType": {
|
|
45
|
+
"original": "SnkFilterItemConfig",
|
|
46
|
+
"resolved": "SnkFilterItemConfig",
|
|
47
|
+
"references": {
|
|
48
|
+
"SnkFilterItemConfig": {
|
|
49
|
+
"location": "import",
|
|
50
|
+
"path": "./snk-filter-item"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"required": false,
|
|
55
|
+
"optional": false,
|
|
56
|
+
"docs": {
|
|
57
|
+
"tags": [],
|
|
58
|
+
"text": ""
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"keepOpened": {
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"mutable": true,
|
|
64
|
+
"complexType": {
|
|
65
|
+
"original": "boolean",
|
|
66
|
+
"resolved": "boolean",
|
|
67
|
+
"references": {}
|
|
68
|
+
},
|
|
69
|
+
"required": false,
|
|
70
|
+
"optional": false,
|
|
71
|
+
"docs": {
|
|
72
|
+
"tags": [],
|
|
73
|
+
"text": ""
|
|
74
|
+
},
|
|
75
|
+
"attribute": "keep-opened",
|
|
76
|
+
"reflect": false
|
|
77
|
+
},
|
|
78
|
+
"getMessage": {
|
|
79
|
+
"type": "unknown",
|
|
80
|
+
"mutable": false,
|
|
81
|
+
"complexType": {
|
|
82
|
+
"original": "(key: string, props?: any) => string",
|
|
83
|
+
"resolved": "(key: string, props?: any) => string",
|
|
84
|
+
"references": {}
|
|
85
|
+
},
|
|
86
|
+
"required": false,
|
|
87
|
+
"optional": false,
|
|
88
|
+
"docs": {
|
|
89
|
+
"tags": [],
|
|
90
|
+
"text": ""
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
static get events() {
|
|
96
|
+
return [{
|
|
97
|
+
"method": "filterChange",
|
|
98
|
+
"name": "filterChange",
|
|
99
|
+
"bubbles": true,
|
|
100
|
+
"cancelable": true,
|
|
101
|
+
"composed": true,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": ""
|
|
105
|
+
},
|
|
106
|
+
"complexType": {
|
|
107
|
+
"original": "SnkFilterItemConfig",
|
|
108
|
+
"resolved": "SnkFilterItemConfig",
|
|
109
|
+
"references": {
|
|
110
|
+
"SnkFilterItemConfig": {
|
|
111
|
+
"location": "import",
|
|
112
|
+
"path": "./snk-filter-item"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
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
|
+
const period = value;
|
|
93
|
+
const dateFormater = new Intl.DateTimeFormat("pt-BR");
|
|
94
|
+
if (period.end && period.start) {
|
|
95
|
+
return `${label}: ${dateFormater.format(period.start)} a ${dateFormater.format(period.end)}`;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
if (period.start) {
|
|
99
|
+
return `${label}: A partir de ${dateFormater.format(period.end)}`;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return `${label}: Até ${dateFormater.format(period.end)}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (type === FilterItemType.SEARCH) {
|
|
107
|
+
return `${label}: ${value.value} - ${value.label}`;
|
|
108
|
+
}
|
|
109
|
+
return `${label}: ${value}`;
|
|
110
|
+
}
|
|
111
|
+
return label;
|
|
112
|
+
}
|
|
113
|
+
componentDidRender() {
|
|
114
|
+
if (this._floatingID == undefined) {
|
|
115
|
+
if (this._popover) {
|
|
116
|
+
this._popover.remove();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
filterChangeListener() {
|
|
121
|
+
this.hideDetail();
|
|
122
|
+
}
|
|
123
|
+
getIconName() {
|
|
124
|
+
if (this.config.value != undefined) {
|
|
125
|
+
return "close";
|
|
126
|
+
}
|
|
127
|
+
return this.detailIsVisible ? "chevron-up" : "chevron-down";
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
const leftIcon = this.config.type === FilterItemType.PERIOD ? "calendar" : undefined;
|
|
131
|
+
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 }))));
|
|
132
|
+
}
|
|
133
|
+
static get is() { return "snk-filter-item"; }
|
|
134
|
+
static get properties() {
|
|
135
|
+
return {
|
|
136
|
+
"config": {
|
|
137
|
+
"type": "unknown",
|
|
138
|
+
"mutable": true,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "SnkFilterItemConfig",
|
|
141
|
+
"resolved": "SnkFilterItemConfig",
|
|
142
|
+
"references": {
|
|
143
|
+
"SnkFilterItemConfig": {
|
|
144
|
+
"location": "local"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"required": false,
|
|
149
|
+
"optional": false,
|
|
150
|
+
"docs": {
|
|
151
|
+
"tags": [],
|
|
152
|
+
"text": ""
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"getMessage": {
|
|
156
|
+
"type": "unknown",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "(key: string, props?: any) => string",
|
|
160
|
+
"resolved": "(key: string, props?: any) => string",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": ""
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
static get states() {
|
|
173
|
+
return {
|
|
174
|
+
"detailIsVisible": {}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
static get events() {
|
|
178
|
+
return [{
|
|
179
|
+
"method": "filterChange",
|
|
180
|
+
"name": "filterChange",
|
|
181
|
+
"bubbles": true,
|
|
182
|
+
"cancelable": true,
|
|
183
|
+
"composed": true,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": ""
|
|
187
|
+
},
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "SnkFilterItemConfig",
|
|
190
|
+
"resolved": "SnkFilterItemConfig",
|
|
191
|
+
"references": {
|
|
192
|
+
"SnkFilterItemConfig": {
|
|
193
|
+
"location": "local"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}];
|
|
198
|
+
}
|
|
199
|
+
static get methods() {
|
|
200
|
+
return {
|
|
201
|
+
"showUp": {
|
|
202
|
+
"complexType": {
|
|
203
|
+
"signature": "(open?: boolean) => Promise<void>",
|
|
204
|
+
"parameters": [{
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": ""
|
|
207
|
+
}],
|
|
208
|
+
"references": {
|
|
209
|
+
"Promise": {
|
|
210
|
+
"location": "global"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"return": "Promise<void>"
|
|
214
|
+
},
|
|
215
|
+
"docs": {
|
|
216
|
+
"text": "",
|
|
217
|
+
"tags": []
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
static get elementRef() { return "_filterItemElement"; }
|
|
223
|
+
static get listeners() {
|
|
224
|
+
return [{
|
|
225
|
+
"name": "click",
|
|
226
|
+
"method": "clickListener",
|
|
227
|
+
"target": undefined,
|
|
228
|
+
"capture": true,
|
|
229
|
+
"passive": false
|
|
230
|
+
}, {
|
|
231
|
+
"name": "mousedown",
|
|
232
|
+
"method": "mouseDownListener",
|
|
233
|
+
"target": undefined,
|
|
234
|
+
"capture": true,
|
|
235
|
+
"passive": false
|
|
236
|
+
}, {
|
|
237
|
+
"name": "filterChange",
|
|
238
|
+
"method": "filterChangeListener",
|
|
239
|
+
"target": undefined,
|
|
240
|
+
"capture": false,
|
|
241
|
+
"passive": false
|
|
242
|
+
}];
|
|
243
|
+
}
|
|
244
|
+
}
|