@sankhyalabs/sankhyablocks 5.5.0 → 5.7.0
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-26da04f7.js → SnkMessageBuilder-056d1c24.js} +23 -1
- package/dist/cjs/{filter-item-type.enum-3daf58d3.js → filter-item-type.enum-aa823a00.js} +1 -0
- package/dist/cjs/filter-type.enum-b14ce507.js +11 -0
- package/dist/cjs/index-8d94b7e0.js +7 -0
- package/dist/cjs/index-de79181a.js +201 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/presentationMode-52ec3bdd.js +7 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +2 -1
- package/dist/cjs/snk-crud.cjs.entry.js +2 -1
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-c43df27b.js → snk-data-unit-289081c4.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -3
- package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
- package/dist/cjs/snk-filter-bar.cjs.entry.js +52 -140
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +8 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
- package/dist/cjs/snk-filter-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +66 -0
- package/dist/cjs/snk-filter-modal.cjs.entry.js +72 -49
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +3 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +3 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +11 -2
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +3 -1
- package/dist/cjs/snk-filter-search.cjs.entry.js +3 -1
- package/dist/cjs/snk-filter-text.cjs.entry.js +2 -0
- package/dist/cjs/snk-grid.cjs.entry.js +3 -2
- package/dist/cjs/{snk-guides-viewer-e6a65393.js → snk-guides-viewer-9784c527.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +3 -2
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
- package/dist/cjs/snk-simple-bar_2.cjs.entry.js +2 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +2 -1
- package/dist/cjs/taskbar-elements-bc2598f9.js +118 -0
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/enum/presentationMode.js +5 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +47 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +50 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.css +31 -2
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +116 -156
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.css +4 -0
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +115 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +19 -142
- package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +7 -0
- package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +36 -0
- package/dist/collection/components/snk-filter-bar/utils/filters-mock.js +315 -0
- package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +2 -0
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +9 -1
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
- package/dist/collection/lib/store/index.js +2 -1
- package/dist/components/SnkMessageBuilder.js +23 -1
- package/dist/components/filter-item-type.enum.js +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index2.js +1 -1
- package/dist/components/index3.js +199 -0
- package/dist/components/presentationMode.js +7 -0
- package/dist/components/snk-crud.js +22 -34
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-detail-view2.js +24 -46
- package/dist/components/snk-expression-item.d.ts +11 -0
- package/dist/components/snk-expression-item.js +6 -0
- package/dist/components/snk-expression-item2.js +241 -0
- package/dist/components/snk-filter-bar2.js +57 -157
- package/dist/components/snk-filter-binary-select.js +9 -1
- package/dist/components/snk-filter-field-search.js +1 -200
- package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
- package/dist/components/snk-filter-list.js +171 -1
- package/dist/components/snk-filter-modal-item.d.ts +11 -0
- package/dist/components/snk-filter-modal-item.js +6 -0
- package/dist/components/snk-filter-modal-item2.js +85 -0
- package/dist/components/snk-filter-modal.js +118 -1
- package/dist/components/snk-filter-multi-select.js +3 -1
- package/dist/components/snk-filter-number.js +3 -1
- package/dist/components/snk-filter-param-config.js +1 -273
- package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
- package/dist/components/snk-filter-period.js +12 -2
- package/dist/components/snk-filter-personalized.js +3 -1
- package/dist/components/snk-filter-search.js +3 -1
- package/dist/components/snk-filter-text.js +3 -1
- package/dist/components/snk-grid2.js +12 -23
- package/dist/components/snk-personalized-filter.d.ts +11 -0
- package/dist/components/snk-personalized-filter.js +158 -0
- package/dist/components/snk-taskbar2.js +3 -197
- package/dist/esm/{SnkMessageBuilder-7a9392e6.js → SnkMessageBuilder-23272e07.js} +23 -1
- package/dist/esm/{filter-item-type.enum-a79b2fa8.js → filter-item-type.enum-5028ed3f.js} +1 -0
- package/dist/esm/filter-type.enum-a80c1b6b.js +9 -0
- package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
- package/dist/esm/index-620ac460.js +7 -0
- package/dist/esm/index-8efbf198.js +199 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/presentationMode-783bbf9d.js +7 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +3 -2
- package/dist/esm/snk-crud.entry.js +3 -2
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-f9e4c694.js → snk-data-unit-34dc5371.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +5 -4
- package/dist/esm/snk-expression-item.entry.js +209 -0
- package/dist/esm/snk-filter-bar.entry.js +53 -141
- package/dist/esm/snk-filter-binary-select.entry.js +9 -2
- package/dist/esm/snk-filter-detail.entry.js +1 -1
- package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
- package/dist/esm/snk-filter-item.entry.js +1 -1
- package/dist/esm/snk-filter-modal-item.entry.js +62 -0
- package/dist/esm/snk-filter-modal.entry.js +73 -50
- package/dist/esm/snk-filter-multi-select.entry.js +4 -2
- package/dist/esm/snk-filter-number.entry.js +4 -2
- package/dist/esm/snk-filter-period.entry.js +12 -3
- package/dist/esm/snk-filter-personalized.entry.js +4 -2
- package/dist/esm/snk-filter-search.entry.js +4 -2
- package/dist/esm/snk-filter-text.entry.js +3 -1
- package/dist/esm/snk-grid.entry.js +3 -2
- package/dist/esm/{snk-guides-viewer-62a9f74d.js → snk-guides-viewer-4d12f268.js} +2 -2
- package/dist/esm/snk-guides-viewer.entry.js +4 -3
- package/dist/esm/snk-personalized-filter.entry.js +122 -0
- package/dist/esm/snk-simple-bar_2.entry.js +3 -2
- package/dist/esm/snk-taskbar.entry.js +3 -2
- package/dist/esm/taskbar-elements-e6af3e93.js +115 -0
- package/dist/sankhyablocks/p-0110b7da.entry.js +1 -0
- package/dist/sankhyablocks/p-1a68fb59.js +1 -0
- package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
- package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
- package/dist/sankhyablocks/{p-f2223502.js → p-3db1d3de.js} +1 -1
- package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
- package/dist/sankhyablocks/p-45ee8b22.entry.js +1 -0
- package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
- package/dist/sankhyablocks/p-4ce96831.entry.js +1 -0
- package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
- package/dist/sankhyablocks/{p-9dd2b8cb.js → p-584d7212.js} +1 -1
- package/dist/sankhyablocks/{p-a412992c.entry.js → p-64b03506.entry.js} +1 -1
- package/dist/sankhyablocks/p-6a02e236.js +1 -0
- package/dist/sankhyablocks/p-7695c404.entry.js +1 -0
- package/dist/sankhyablocks/p-786ae316.entry.js +1 -0
- package/dist/sankhyablocks/p-82bc97da.entry.js +1 -0
- package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
- package/dist/sankhyablocks/p-8efb0f47.entry.js +1 -0
- package/dist/sankhyablocks/p-9af04fc7.entry.js +1 -0
- package/dist/sankhyablocks/{p-3a2ce158.entry.js → p-a1c58536.entry.js} +1 -1
- package/dist/sankhyablocks/{p-afba9bbe.entry.js → p-bdbb2672.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b2523981.entry.js → p-c1ab16d0.entry.js} +2 -2
- package/dist/sankhyablocks/{p-aeffd219.js → p-ccd26e3a.js} +1 -1
- package/dist/sankhyablocks/p-d410f45a.js +1 -0
- package/dist/sankhyablocks/p-d9804798.js +1 -0
- package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
- package/dist/sankhyablocks/p-e2bb9c9a.entry.js +1 -0
- package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
- package/dist/sankhyablocks/p-ed3d6ab4.entry.js +1 -0
- package/dist/sankhyablocks/p-ee1381f4.entry.js +1 -0
- package/dist/sankhyablocks/p-f4184ce7.js +1 -0
- package/dist/sankhyablocks/p-f5f36fbb.js +1 -0
- package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
- package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
- package/dist/sankhyablocks/p-ffac37d5.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/filter-item/editors/enum/presentationMode.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +5 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +37 -0
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +17 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +2 -11
- package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +6 -0
- package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +20 -0
- package/dist/types/components/snk-filter-bar/utils/filters-mock.d.ts +186 -0
- package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
- package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
- package/dist/types/components.d.ts +196 -63
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
- package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
- package/dist/types/lib/store/index.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
- package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
- package/dist/cjs/taskbar-elements-80285601.js +0 -313
- package/dist/components/snk-filter-list2.js +0 -173
- package/dist/components/snk-filter-modal2.js +0 -97
- package/dist/esm/taskbar-elements-055ba1ad.js +0 -309
- package/dist/sankhyablocks/p-4512cc6c.entry.js +0 -1
- package/dist/sankhyablocks/p-5cbbe1f7.entry.js +0 -1
- package/dist/sankhyablocks/p-5e62a17b.entry.js +0 -1
- package/dist/sankhyablocks/p-5fc55684.entry.js +0 -1
- package/dist/sankhyablocks/p-63d01871.entry.js +0 -1
- package/dist/sankhyablocks/p-73e830cf.entry.js +0 -1
- package/dist/sankhyablocks/p-741b00ef.entry.js +0 -1
- package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
- package/dist/sankhyablocks/p-86d29b6f.entry.js +0 -1
- package/dist/sankhyablocks/p-92a0fca4.js +0 -1
- package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
- package/dist/sankhyablocks/p-999d1953.entry.js +0 -1
- package/dist/sankhyablocks/p-ad51bf1c.entry.js +0 -1
- package/dist/sankhyablocks/p-c336170d.entry.js +0 -1
- package/dist/sankhyablocks/p-c3efd4eb.entry.js +0 -1
- package/dist/sankhyablocks/p-d5c9c1f8.entry.js +0 -1
- package/dist/sankhyablocks/p-ebe876f5.entry.js +0 -1
- package/dist/sankhyablocks/p-ed438690.js +0 -1
- package/dist/sankhyablocks/p-ee82c157.entry.js +0 -1
- package/dist/sankhyablocks/p-f3d0c744.entry.js +0 -1
- package/dist/sankhyablocks/p-fac37198.entry.js +0 -1
@@ -0,0 +1,36 @@
|
|
1
|
+
import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
|
2
|
+
class SnkFilterModalFactory {
|
3
|
+
constructor({ filterConfig, onComplete, getMessage }) {
|
4
|
+
this._filterConfig = filterConfig;
|
5
|
+
this._onComplete = onComplete;
|
6
|
+
this._getMessage = getMessage;
|
7
|
+
}
|
8
|
+
applyFilters(newFilterConfig) {
|
9
|
+
this._onComplete(newFilterConfig);
|
10
|
+
this._closeModal();
|
11
|
+
}
|
12
|
+
clearAll(filterConfigSnapshot) {
|
13
|
+
return filterConfigSnapshot.map(filterItem => (Object.assign(Object.assign({}, filterItem), { value: undefined })));
|
14
|
+
}
|
15
|
+
buildFilterModal() {
|
16
|
+
const filterModal = document.createElement("snk-filter-modal");
|
17
|
+
filterModal.filters = this._filterConfig;
|
18
|
+
filterModal.getMessage = this._getMessage.bind(this);
|
19
|
+
filterModal.applyFilters = this.applyFilters.bind(this);
|
20
|
+
filterModal.clearAll = this.clearAll.bind(this);
|
21
|
+
filterModal.closeModal = () => this._closeModal();
|
22
|
+
return filterModal;
|
23
|
+
}
|
24
|
+
async showModal() {
|
25
|
+
const filterModal = this.buildFilterModal();
|
26
|
+
const modalProps = {
|
27
|
+
content: filterModal,
|
28
|
+
position: 'left',
|
29
|
+
heightMode: 'full',
|
30
|
+
closeOutsideClick: false,
|
31
|
+
useScrimLight: true
|
32
|
+
};
|
33
|
+
this._closeModal = await ApplicationUtils.showModal(modalProps);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
export default SnkFilterModalFactory;
|
@@ -0,0 +1,315 @@
|
|
1
|
+
export const filtersMock = [
|
2
|
+
{
|
3
|
+
"id": "RECDESP",
|
4
|
+
"label": "Receitas + Despesas",
|
5
|
+
"detailTitle": "Selecione o que deseja ver",
|
6
|
+
"type": "BINARY_SELECT",
|
7
|
+
"props": {
|
8
|
+
"options": [
|
9
|
+
{
|
10
|
+
"name": "RECEITA",
|
11
|
+
"expression": "this.RECDESP = 1",
|
12
|
+
"label": "Receitas"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"name": "DESPESA",
|
16
|
+
"expression": "this.RECDESP = -1",
|
17
|
+
"label": "Despesas"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
},
|
21
|
+
"value": "DESPESA",
|
22
|
+
"hardFixed": true,
|
23
|
+
"visible": true,
|
24
|
+
"filterType": "QUICK_FILTERS",
|
25
|
+
"detailModal": "Movimento"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"id": "PROVISAO",
|
29
|
+
"label": "Real + Provisão",
|
30
|
+
"detailTitle": "Selecione o que deseja ver",
|
31
|
+
"type": "BINARY_SELECT",
|
32
|
+
"props": {
|
33
|
+
"options": [
|
34
|
+
{
|
35
|
+
"name": "REAL",
|
36
|
+
"expression": "nullvalue(this.PROVISAO, 'N') = 'N'",
|
37
|
+
"label": "Real"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"name": "PROVISAO",
|
41
|
+
"expression": "nullvalue(this.PROVISAO, 'N') = 'S'",
|
42
|
+
"label": "Provisão"
|
43
|
+
}
|
44
|
+
]
|
45
|
+
},
|
46
|
+
"value": "REAL",
|
47
|
+
"hardFixed": true,
|
48
|
+
"visible": true,
|
49
|
+
"filterType": "QUICK_FILTERS",
|
50
|
+
"detailModal": "Lançamento"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"id": "BAIXADO",
|
54
|
+
"label": "Pendentes + Baixados",
|
55
|
+
"detailTitle": "Selecione o que deseja ver",
|
56
|
+
"type": "BINARY_SELECT",
|
57
|
+
"props": {
|
58
|
+
"options": [
|
59
|
+
{
|
60
|
+
"name": "PENDENTE",
|
61
|
+
"expression": "this.DHBAIXA IS NULL",
|
62
|
+
"label": "Pendentes"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"name": "BAIXADO",
|
66
|
+
"expression": "this.DHBAIXA IS NOT NULL AND NOT nullvalue(this.PROVISAO, 'N') = 'S'",
|
67
|
+
"label": "Baixados"
|
68
|
+
}
|
69
|
+
]
|
70
|
+
},
|
71
|
+
"value": "PENDENTE",
|
72
|
+
"hardFixed": true,
|
73
|
+
"visible": true,
|
74
|
+
"filterType": "QUICK_FILTERS",
|
75
|
+
"detailModal": "Status"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"id": "NUMNOTA",
|
79
|
+
"label": "Nr. Nota",
|
80
|
+
"detailTitle": "Informe o número da nota",
|
81
|
+
"type": "NUMBER",
|
82
|
+
"props": {
|
83
|
+
"expression": "this.NUMNOTA = :NUMNOTA"
|
84
|
+
},
|
85
|
+
"visible": true,
|
86
|
+
"filterType": "QUICK_FILTERS"
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"id": "NUFIN",
|
90
|
+
"label": "Nr. único",
|
91
|
+
"detailTitle": "Informe o número único",
|
92
|
+
"type": "NUMBER",
|
93
|
+
"props": {
|
94
|
+
"expression": "this.NUFIN = :NUFIN AND NOT (this.PROVISAO = 'S' AND this.DHBAIXA IS NOT NULL AND this.ORIGEM = 'E')"
|
95
|
+
},
|
96
|
+
"visible": true,
|
97
|
+
"filterType": "QUICK_FILTERS"
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"id": "DTVENC",
|
101
|
+
"label": "Dt. Vencimento",
|
102
|
+
"detailTitle": "Informe a data ou período",
|
103
|
+
"type": "PERIOD",
|
104
|
+
"props": {
|
105
|
+
"expression": {
|
106
|
+
"fullfill": "onlydate(this.DTVENC) >= :DTVENC.START AND onlydate(this.DTVENC) <= :DTVENC.END",
|
107
|
+
"onlystart": "onlydate(this.DTVENC) >= :DTVENC",
|
108
|
+
"onlyend": "onlydate(this.DTVENC) <= :DTVENC"
|
109
|
+
}
|
110
|
+
},
|
111
|
+
"visible": true,
|
112
|
+
"filterType": "QUICK_FILTERS"
|
113
|
+
},
|
114
|
+
{
|
115
|
+
"id": "0",
|
116
|
+
"label": "cartao",
|
117
|
+
"detailTitle": "cartao",
|
118
|
+
"type": "PERSONALIZED",
|
119
|
+
"props": {
|
120
|
+
"expression": "Financeiro.CODTIPTIT = 17",
|
121
|
+
"personalizedFilter": {
|
122
|
+
"parameters": []
|
123
|
+
}
|
124
|
+
},
|
125
|
+
"filterType": "OTHER_FILTERS"
|
126
|
+
},
|
127
|
+
{
|
128
|
+
"id": "1",
|
129
|
+
"label": "Origem Estoque",
|
130
|
+
"detailTitle": "Origem Estoque",
|
131
|
+
"type": "PERSONALIZED",
|
132
|
+
"props": {
|
133
|
+
"expression": "Financeiro.ORIGEM = 'E'",
|
134
|
+
"personalizedFilter": {
|
135
|
+
"parameters": []
|
136
|
+
}
|
137
|
+
},
|
138
|
+
"filterType": "CUSTOM_FILTERS"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"id": "CODPARC",
|
142
|
+
"label": "Parceiro",
|
143
|
+
"detailTitle": "Informe o parceiro",
|
144
|
+
"type": "SEARCH",
|
145
|
+
"props": {
|
146
|
+
"expression": "this.CODPARC = :CODPARC",
|
147
|
+
"searchContext": {
|
148
|
+
"entity": "Parceiro",
|
149
|
+
"entityDescription": "Parceiro",
|
150
|
+
"searchOptions": {
|
151
|
+
"rootEntity": "Financeiro",
|
152
|
+
"descriptionFieldName": "NOMEPARC",
|
153
|
+
"codeFieldName": "CODPARC",
|
154
|
+
"showInactives": false
|
155
|
+
}
|
156
|
+
}
|
157
|
+
},
|
158
|
+
"visible": true,
|
159
|
+
"filterType": "QUICK_FILTERS",
|
160
|
+
"detailModal": "Título"
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"id": "DHBAIXA",
|
164
|
+
"label": "Data da Baixa",
|
165
|
+
"detailTitle": "Informe a data ou período",
|
166
|
+
"type": "PERIOD",
|
167
|
+
"props": {
|
168
|
+
"expression": {
|
169
|
+
"fullfill": "onlydate(this.DHBAIXA) >= :DHBAIXA.START AND onlydate(this.DHBAIXA) <= :DHBAIXA.END",
|
170
|
+
"onlystart": "onlydate(this.DHBAIXA) >= :DHBAIXA",
|
171
|
+
"onlyend": "onlydate(this.DHBAIXA) <= :DHBAIXA"
|
172
|
+
}
|
173
|
+
},
|
174
|
+
"visible": true,
|
175
|
+
"filterType": "OTHER_FILTERS"
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"id": "CODEMP",
|
179
|
+
"label": "Empresa",
|
180
|
+
"detailTitle": "Informe a empresa",
|
181
|
+
"type": "SEARCH",
|
182
|
+
"props": {
|
183
|
+
"expression": "this.CODEMP = :CODEMP",
|
184
|
+
"searchContext": {
|
185
|
+
"entity": "Empresa",
|
186
|
+
"entityDescription": "Empresa",
|
187
|
+
"searchOptions": {
|
188
|
+
"rootEntity": "Financeiro",
|
189
|
+
"descriptionFieldName": "NOMEFANTASIA",
|
190
|
+
"codeFieldName": "CODEMP",
|
191
|
+
"showInactives": false
|
192
|
+
}
|
193
|
+
}
|
194
|
+
},
|
195
|
+
"filterType": "OTHER_FILTERS"
|
196
|
+
},
|
197
|
+
{
|
198
|
+
"id": "CODNAT",
|
199
|
+
"label": "Natureza",
|
200
|
+
"detailTitle": "Informe a natureza",
|
201
|
+
"type": "SEARCH",
|
202
|
+
"props": {
|
203
|
+
"expression": "this.CODNAT = :CODNAT",
|
204
|
+
"searchContext": {
|
205
|
+
"entity": "Natureza",
|
206
|
+
"entityDescription": "Natureza",
|
207
|
+
"searchOptions": {
|
208
|
+
"rootEntity": "Financeiro",
|
209
|
+
"descriptionFieldName": "DESCRNAT",
|
210
|
+
"codeFieldName": "CODNAT",
|
211
|
+
"showInactives": false
|
212
|
+
}
|
213
|
+
}
|
214
|
+
},
|
215
|
+
"filterType": "OTHER_FILTERS"
|
216
|
+
},
|
217
|
+
{
|
218
|
+
"id": "DTNEG",
|
219
|
+
"label": "Dt. Negociação",
|
220
|
+
"detailTitle": "Informe a data ou período",
|
221
|
+
"type": "PERIOD",
|
222
|
+
"props": {
|
223
|
+
"expression": {
|
224
|
+
"fullfill": "onlydate(this.DTNEG) >= :DTNEG.START AND onlydate(this.DTNEG) <= :DTNEG.END",
|
225
|
+
"onlystart": "onlydate(this.DTNEG) >= :DTNEG",
|
226
|
+
"onlyend": "onlydate(this.DTNEG) <= :DTNEG"
|
227
|
+
}
|
228
|
+
}
|
229
|
+
},
|
230
|
+
{
|
231
|
+
"id": "NUNOTA",
|
232
|
+
"label": "Nro Único do Pedido",
|
233
|
+
"detailTitle": "Informe o número único do pedido",
|
234
|
+
"type": "NUMBER",
|
235
|
+
"props": {
|
236
|
+
"expression": "(this.NUPED = :NUNOTA OR EXISTS(SELECT 1 FROM TGFVAR V INNER JOIN TGFCAB C ON(C.NUNOTA = V.NUNOTAORIG) WHERE V.NUNOTA = this.NUNOTA AND C.NUNOTA = :NUNOTA))"
|
237
|
+
}
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"id": "CODCENCUS",
|
241
|
+
"label": "Centro de resultado",
|
242
|
+
"detailTitle": "Informe o centro de resultado",
|
243
|
+
"type": "SEARCH",
|
244
|
+
"props": {
|
245
|
+
"expression": "this.CODCENCUS = :CODCENCUS",
|
246
|
+
"searchContext": {
|
247
|
+
"entity": "CentroResultado",
|
248
|
+
"entityDescription": "Centro de resultado",
|
249
|
+
"searchOptions": {
|
250
|
+
"rootEntity": "Financeiro",
|
251
|
+
"descriptionFieldName": "DESCRCENCUS",
|
252
|
+
"codeFieldName": "CODCENCUS",
|
253
|
+
"showInactives": false
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
},
|
258
|
+
{
|
259
|
+
"id": "CODCTABCOINT",
|
260
|
+
"label": "Conta bancária",
|
261
|
+
"detailTitle": "Informe a conta bancária",
|
262
|
+
"type": "SEARCH",
|
263
|
+
"props": {
|
264
|
+
"expression": "this.CODCTABCOINT = :CODCTABCOINT",
|
265
|
+
"searchContext": {
|
266
|
+
"entity": "ContaBancaria",
|
267
|
+
"entityDescription": "Conta bancária",
|
268
|
+
"searchOptions": {
|
269
|
+
"rootEntity": "Financeiro",
|
270
|
+
"descriptionFieldName": "DESCRICAO",
|
271
|
+
"codeFieldName": "CODCTABCOINT",
|
272
|
+
"showInactives": false
|
273
|
+
}
|
274
|
+
}
|
275
|
+
}
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"id": "CODBCO",
|
279
|
+
"label": "Banco",
|
280
|
+
"detailTitle": "Informe o banco",
|
281
|
+
"type": "SEARCH",
|
282
|
+
"props": {
|
283
|
+
"expression": "this.CODBCO = :CODBCO",
|
284
|
+
"searchContext": {
|
285
|
+
"entity": "Banco",
|
286
|
+
"entityDescription": "Banco",
|
287
|
+
"searchOptions": {
|
288
|
+
"rootEntity": "Financeiro",
|
289
|
+
"descriptionFieldName": "NOMEBCO",
|
290
|
+
"codeFieldName": "CODBCO",
|
291
|
+
"showInactives": false
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
},
|
296
|
+
{
|
297
|
+
"id": "CODPROJ",
|
298
|
+
"label": "Projeto",
|
299
|
+
"detailTitle": "Informe o projeto",
|
300
|
+
"type": "SEARCH",
|
301
|
+
"props": {
|
302
|
+
"expression": "this.CODPROJ = :CODPROJ",
|
303
|
+
"searchContext": {
|
304
|
+
"entity": "Projeto",
|
305
|
+
"entityDescription": "Projeto",
|
306
|
+
"searchOptions": {
|
307
|
+
"rootEntity": "Financeiro",
|
308
|
+
"descriptionFieldName": "IDENTIFICACAO",
|
309
|
+
"codeFieldName": "CODPROJ",
|
310
|
+
"showInactives": false
|
311
|
+
}
|
312
|
+
}
|
313
|
+
}
|
314
|
+
}
|
315
|
+
];
|
@@ -6,61 +6,63 @@ const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
|
|
6
6
|
export class SnkFilterFieldSearch {
|
7
7
|
constructor() {
|
8
8
|
this._filterMetadataStorage = new Map();
|
9
|
-
this.
|
9
|
+
this._currentMetadata = null;
|
10
10
|
this._filterText = "";
|
11
11
|
this._isLoading = false;
|
12
12
|
this.searchable = true;
|
13
|
+
this.fieldsDataSource = undefined;
|
13
14
|
this.breadcrumbItems = [];
|
14
15
|
this.linkItems = [];
|
15
16
|
this.fieldItems = [];
|
16
17
|
}
|
17
18
|
/**
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
|
22
|
-
* @throws {Error} - Quando o link atual não for do tipo link.
|
23
|
-
*/
|
24
|
-
async setDataSource(currentLink, fetchData) {
|
19
|
+
* Realiza a abertura do componente e faz a primeira carga
|
20
|
+
* de dados.
|
21
|
+
* */
|
22
|
+
async show() {
|
25
23
|
var _a;
|
24
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
|
25
|
+
return this.loadData();
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Filtra a fonte de dados do componente.
|
29
|
+
* @param {string} filterText - Texto para filtrar a fonte de dados.
|
30
|
+
* @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
|
31
|
+
*/
|
32
|
+
async applyFilter(filterText) {
|
33
|
+
if (this.searchable)
|
34
|
+
throw new Error('This method is not available when searchable is true');
|
35
|
+
this.handleFilterChange(filterText);
|
36
|
+
}
|
37
|
+
async loadData() {
|
26
38
|
this._isLoading = true;
|
27
|
-
let metadata
|
39
|
+
let metadata;
|
40
|
+
if (this._currentLink != undefined) {
|
41
|
+
metadata = this._filterMetadataStorage.get(this._currentLink.uri);
|
42
|
+
}
|
28
43
|
if (!metadata) {
|
29
|
-
metadata = await fetchData(
|
30
|
-
this.
|
44
|
+
metadata = await this.fieldsDataSource.fetchData(this._currentLink);
|
45
|
+
this._currentLink = metadata.currentLink;
|
46
|
+
this._filterMetadataStorage.set(this._currentLink.uri, metadata);
|
31
47
|
}
|
32
48
|
const { fields, links } = metadata || {};
|
33
49
|
if (!Array.isArray(fields) || !Array.isArray(links))
|
34
50
|
throw new Error('Invalid metadata');
|
35
|
-
|
36
|
-
throw new Error('The current link must be a link type');
|
37
|
-
this._dataSource = metadata;
|
38
|
-
this._currentLink = currentLink;
|
51
|
+
this._currentMetadata = metadata;
|
39
52
|
this.mapDataSourceToLinkItems();
|
40
53
|
this.mapDataSourceToFieldItems();
|
41
54
|
this._isLoading = false;
|
42
|
-
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
|
43
55
|
this._ezFieldList.scrollToTop();
|
44
56
|
this._ezLinkList.scrollToTop();
|
45
57
|
}
|
46
|
-
/**
|
47
|
-
* Filtra a fonte de dados do componente.
|
48
|
-
* @param {string} filterText - Texto para filtrar a fonte de dados.
|
49
|
-
* @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
|
50
|
-
*/
|
51
|
-
async filterDataSource(filterText) {
|
52
|
-
if (this.searchable)
|
53
|
-
throw new Error('This method is not available when searchable is true');
|
54
|
-
this.handleFilterChange(filterText);
|
55
|
-
}
|
56
58
|
mapDataSourceToLinkItems() {
|
57
59
|
var _a;
|
58
|
-
const { links } = this.
|
60
|
+
const { links } = this._currentMetadata;
|
59
61
|
const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
|
60
62
|
const items = links.map(link => (Object.assign({ label: link.description }, link)));
|
61
63
|
this.linkItems = [{
|
62
64
|
group: filterLinkLabelMessage,
|
63
|
-
items
|
65
|
+
items,
|
64
66
|
}];
|
65
67
|
if (this.breadcrumbItems.length === 0) {
|
66
68
|
this.breadcrumbItems = [Object.assign({ id: JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
|
@@ -68,7 +70,7 @@ export class SnkFilterFieldSearch {
|
|
68
70
|
}
|
69
71
|
mapDataSourceToFieldItems() {
|
70
72
|
var _a;
|
71
|
-
const { fields } = this.
|
73
|
+
const { fields } = this._currentMetadata;
|
72
74
|
const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
|
73
75
|
const filteredFields = fields.filter(field => {
|
74
76
|
if (!this._currentLink)
|
@@ -100,7 +102,10 @@ export class SnkFilterFieldSearch {
|
|
100
102
|
else {
|
101
103
|
this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: JSUtils.generateUUID(), label: item.description }, item)];
|
102
104
|
}
|
103
|
-
|
105
|
+
const selectedItem = Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK });
|
106
|
+
this._currentLink = selectedItem;
|
107
|
+
this.ezSelectFilterItem.emit(selectedItem);
|
108
|
+
this.loadData();
|
104
109
|
}
|
105
110
|
handleSelectField({ detail: item }) {
|
106
111
|
var _a;
|
@@ -141,7 +146,7 @@ export class SnkFilterFieldSearch {
|
|
141
146
|
render() {
|
142
147
|
var _a;
|
143
148
|
const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
|
144
|
-
return (h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (h("ez-filter-input", Object.assign({ class: "snk-filter-field-search__input", label: searchLabelMessage, asyncSearch: true, canShowError: false, onEzSearching: (event) => this.handleFilterChange.bind(this)(event.detail), "aria-label": searchLabelMessage, "aria-required": "false", "aria-invalid": "false" }, this.getElementID('EzFilterInput')))), this.breadcrumbItems.length > 0 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, h("ez-list", Object.assign({ ref: (el) => this._ezLinkList = el, class: "snk-filter-field-search__list", id: "filterLinkList", useGroups: true, dataSource: this.linkItems, onEzSelectItem: this.handleSelectLink.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ({ fieldCount }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), h("ez-list", Object.assign({ ref: (el) => this._ezFieldList = el, class: "snk-filter-field-search__list", id: "filterFieldList", useGroups: true, dataSource: this.fieldItems, onEzSelectItem: this.handleSelectField.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ListItem, "aria-describedby": "filterFieldLabel" }, this.getElementID('EzListFields')))))));
|
149
|
+
return (h("ez-popover", Object.assign({ ref: (el) => this._ezPopover = el, role: "dialog", overlayType: "none", "aria-hidden": !((_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.opened) }, this.getElementID('EzPopover')), h("div", { class: "snk-filter-field-search__container" }, h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (h("ez-filter-input", Object.assign({ class: "snk-filter-field-search__input", label: searchLabelMessage, asyncSearch: true, canShowError: false, onEzSearching: (event) => this.handleFilterChange.bind(this)(event.detail), "aria-label": searchLabelMessage, "aria-required": "false", "aria-invalid": "false" }, this.getElementID('EzFilterInput')))), this.breadcrumbItems.length > 0 && (h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), h("section", { class: "snk-filter-field-search__section" }, h("ez-list", Object.assign({ ref: (el) => this._ezLinkList = el, class: "snk-filter-field-search__list", id: "filterLinkList", useGroups: true, dataSource: this.linkItems, onEzSelectItem: this.handleSelectLink.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ({ fieldCount }) => h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), h("ez-list", Object.assign({ ref: (el) => this._ezFieldList = el, class: "snk-filter-field-search__list", id: "filterFieldList", useGroups: true, dataSource: this.fieldItems, onEzSelectItem: this.handleSelectField.bind(this), hoverFeedback: true, ezSelectable: true, itemSlotBuilder: ListItem, "aria-describedby": "filterFieldLabel" }, this.getElementID('EzListFields')))))));
|
145
150
|
}
|
146
151
|
static get is() { return "snk-filter-field-search"; }
|
147
152
|
static get encapsulation() { return "scoped"; }
|
@@ -174,6 +179,26 @@ export class SnkFilterFieldSearch {
|
|
174
179
|
"attribute": "searchable",
|
175
180
|
"reflect": false,
|
176
181
|
"defaultValue": "true"
|
182
|
+
},
|
183
|
+
"fieldsDataSource": {
|
184
|
+
"type": "unknown",
|
185
|
+
"mutable": false,
|
186
|
+
"complexType": {
|
187
|
+
"original": "FilterFieldsDataSource",
|
188
|
+
"resolved": "FilterFieldsDataSource",
|
189
|
+
"references": {
|
190
|
+
"FilterFieldsDataSource": {
|
191
|
+
"location": "import",
|
192
|
+
"path": "./interfaces"
|
193
|
+
}
|
194
|
+
}
|
195
|
+
},
|
196
|
+
"required": false,
|
197
|
+
"optional": false,
|
198
|
+
"docs": {
|
199
|
+
"tags": [],
|
200
|
+
"text": "Define a fonte de dados que o componente vai utilizar\npara carregamento dos campos."
|
201
|
+
}
|
177
202
|
}
|
178
203
|
};
|
179
204
|
}
|
@@ -216,55 +241,23 @@ export class SnkFilterFieldSearch {
|
|
216
241
|
}
|
217
242
|
static get methods() {
|
218
243
|
return {
|
219
|
-
"
|
244
|
+
"show": {
|
220
245
|
"complexType": {
|
221
|
-
"signature": "(
|
222
|
-
"parameters": [
|
223
|
-
"tags": [{
|
224
|
-
"name": "param",
|
225
|
-
"text": "currentLink - Link atual da entidade."
|
226
|
-
}],
|
227
|
-
"text": "- Link atual da entidade."
|
228
|
-
}, {
|
229
|
-
"tags": [{
|
230
|
-
"name": "param",
|
231
|
-
"text": "fetchData - callback que executa a busca de dados."
|
232
|
-
}],
|
233
|
-
"text": "- callback que executa a busca de dados."
|
234
|
-
}],
|
246
|
+
"signature": "() => Promise<void>",
|
247
|
+
"parameters": [],
|
235
248
|
"references": {
|
236
249
|
"Promise": {
|
237
250
|
"location": "global"
|
238
|
-
},
|
239
|
-
"IFilterLink": {
|
240
|
-
"location": "import",
|
241
|
-
"path": "./interfaces"
|
242
|
-
},
|
243
|
-
"DataFetcher": {
|
244
|
-
"location": "import",
|
245
|
-
"path": "./interfaces"
|
246
251
|
}
|
247
252
|
},
|
248
253
|
"return": "Promise<void>"
|
249
254
|
},
|
250
255
|
"docs": {
|
251
|
-
"text": "
|
252
|
-
"tags": [
|
253
|
-
"name": "param",
|
254
|
-
"text": "currentLink - Link atual da entidade."
|
255
|
-
}, {
|
256
|
-
"name": "param",
|
257
|
-
"text": "fetchData - callback que executa a busca de dados."
|
258
|
-
}, {
|
259
|
-
"name": "throws",
|
260
|
-
"text": "{Error} - Quando os metadados n\u00E3o forem v\u00E1lidos."
|
261
|
-
}, {
|
262
|
-
"name": "throws",
|
263
|
-
"text": "{Error} - Quando o link atual n\u00E3o for do tipo link."
|
264
|
-
}]
|
256
|
+
"text": "Realiza a abertura do componente e faz a primeira carga \nde dados.",
|
257
|
+
"tags": []
|
265
258
|
}
|
266
259
|
},
|
267
|
-
"
|
260
|
+
"applyFilter": {
|
268
261
|
"complexType": {
|
269
262
|
"signature": "(filterText: string) => Promise<void>",
|
270
263
|
"parameters": [{
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
2
|
+
import PersonalizedFilterFetcher from "../../lib/http/data-fetcher/fetchers/personalized-filter-fetcher";
|
3
|
+
import { FilterOperand, FilterUserConfigTypes } from "../../lib/@types";
|
4
|
+
import store from '../../lib/store';
|
5
|
+
import { ApplicationContext, StringUtils } from '@sankhyalabs/core';
|
6
|
+
export class SnkPersonalizedFilter {
|
7
|
+
constructor() {
|
8
|
+
this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
|
9
|
+
this._dataSourceFetcher = {
|
10
|
+
fetchData: async (entity) => {
|
11
|
+
let entityURI = entity === null || entity === void 0 ? void 0 : entity.uri;
|
12
|
+
if (StringUtils.isEmpty(entityURI)) {
|
13
|
+
entityURI = "dd://Financeiro/br.com.sankhya.fin.cad.receber"; //TODO: Receber como prop
|
14
|
+
}
|
15
|
+
return await this._personalizedFilterFetcher.loadFields(entityURI);
|
16
|
+
}
|
17
|
+
};
|
18
|
+
this.items = {
|
19
|
+
entityName: "Financeiro",
|
20
|
+
fieldName: "CODBCO",
|
21
|
+
description: "Financeiro >> Banco",
|
22
|
+
type: FilterUserConfigTypes.DECIMAL,
|
23
|
+
expression: "Financeiro.CODBCO",
|
24
|
+
operand: FilterOperand.EQUAL,
|
25
|
+
paramVariable: false,
|
26
|
+
value: "61",
|
27
|
+
systemConfig: null,
|
28
|
+
userConfig: null
|
29
|
+
};
|
30
|
+
this.handleFilterItemChange = (changes) => {
|
31
|
+
console.log("Campo do ExpressionItem alterado");
|
32
|
+
console.log(changes);
|
33
|
+
};
|
34
|
+
this.handleFilterItemRemove = (expression) => {
|
35
|
+
console.log("Event de deleção disparado");
|
36
|
+
console.log(expression);
|
37
|
+
};
|
38
|
+
this.messagesBuilder = undefined;
|
39
|
+
}
|
40
|
+
componentWillLoad() {
|
41
|
+
if (store.get("filterFieldsDataSource") == undefined) {
|
42
|
+
store.set("filterFieldsDataSource", this._dataSourceFetcher);
|
43
|
+
}
|
44
|
+
if (!this.messagesBuilder) {
|
45
|
+
const snkApp = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
46
|
+
this.messagesBuilder = snkApp === null || snkApp === void 0 ? void 0 : snkApp.messagesBuilder;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
render() {
|
50
|
+
return (h(Host, null, h("div", null, h("snk-expression-item", { expression: this.items, canRemove: true, onEzFilterItemChange: (evt) => this.handleFilterItemChange(evt.detail), onEzFilterItemRemove: (evt) => this.handleFilterItemRemove(evt.detail), messagesBuilder: this.messagesBuilder }))));
|
51
|
+
}
|
52
|
+
static get is() { return "snk-personalized-filter"; }
|
53
|
+
static get originalStyleUrls() {
|
54
|
+
return {
|
55
|
+
"$": ["snk-personalized-filter.css"]
|
56
|
+
};
|
57
|
+
}
|
58
|
+
static get styleUrls() {
|
59
|
+
return {
|
60
|
+
"$": ["snk-personalized-filter.css"]
|
61
|
+
};
|
62
|
+
}
|
63
|
+
static get properties() {
|
64
|
+
return {
|
65
|
+
"messagesBuilder": {
|
66
|
+
"type": "unknown",
|
67
|
+
"mutable": true,
|
68
|
+
"complexType": {
|
69
|
+
"original": "SnkMessageBuilder",
|
70
|
+
"resolved": "SnkMessageBuilder",
|
71
|
+
"references": {
|
72
|
+
"SnkMessageBuilder": {
|
73
|
+
"location": "import",
|
74
|
+
"path": "../../lib/message/SnkMessageBuilder"
|
75
|
+
}
|
76
|
+
}
|
77
|
+
},
|
78
|
+
"required": false,
|
79
|
+
"optional": false,
|
80
|
+
"docs": {
|
81
|
+
"tags": [],
|
82
|
+
"text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
|
83
|
+
}
|
84
|
+
}
|
85
|
+
};
|
86
|
+
}
|
87
|
+
}
|