@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,435 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
const index = require('./index-21bd01e1.js');
|
6
|
+
const index$1 = require('./index-8d94b7e0.js');
|
7
|
+
const core = require('@sankhyalabs/core');
|
8
|
+
const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
|
9
|
+
const index$2 = require('./index-f400b1d6.js');
|
10
|
+
|
11
|
+
const ICON_MODES = {
|
12
|
+
[core.UserInterface.SHORTTEXT]: 'text',
|
13
|
+
[core.UserInterface.LONGTEXT]: 'text',
|
14
|
+
[core.UserInterface.INTEGERNUMBER]: 'number',
|
15
|
+
[core.UserInterface.DECIMALNUMBER]: 'number',
|
16
|
+
[core.UserInterface.DATE]: 'calendar',
|
17
|
+
[core.UserInterface.DATETIME]: 'calendar',
|
18
|
+
[core.UserInterface.SWITCH]: 'boolean',
|
19
|
+
[core.UserInterface.CHECKBOX]: 'check-circle-inverted',
|
20
|
+
[core.UserInterface.OPTIONSELECTOR]: 'list',
|
21
|
+
[core.UserInterface.SEARCH]: 'search',
|
22
|
+
[core.UserInterface.HTML]: 'tag_code',
|
23
|
+
[core.UserInterface.IMAGE]: 'png',
|
24
|
+
[core.UserInterface.FILE]: 'edit-file',
|
25
|
+
[core.UserInterface.TIME]: 'timer-outline',
|
26
|
+
[core.UserInterface.ELAPSEDTIME]: 'timer',
|
27
|
+
[core.UserInterface.MASKEDTEXT]: 'text',
|
28
|
+
[core.UserInterface.PASSWORD]: 'email',
|
29
|
+
};
|
30
|
+
const ListItem = ({ userInterface, description }) => {
|
31
|
+
return (index.h("ez-icon", { iconName: ICON_MODES[userInterface], className: "ez-padding-left--small", title: description }));
|
32
|
+
};
|
33
|
+
|
34
|
+
const snkFilterFieldSearchCss = ".sc-snk-filter-field-search-h{--snk-filter-field-search--container-width:468px;--snk-filter-field-search--container-height:322px}.snk-filter-field-search__container.sc-snk-filter-field-search{display:flex;flex-direction:column;padding:var(--space--medium);width:var(--snk-filter-field-search--container-width);height:var(--snk-filter-field-search--container-height)}.snk-filter-field-search__section.sc-snk-filter-field-search{display:grid;grid-template-columns:1fr 1fr;place-items:flex-start;overflow:hidden;gap:var(--space--small)}.snk-filter-field-search__input.sc-snk-filter-field-search{margin-bottom:var(--space--medium)}.snk-filter-field-search__list_container.sc-snk-filter-field-search{display:flex;flex-direction:column}.snk-filter-field-search__list.sc-snk-filter-field-search{overflow-y:auto}";
|
35
|
+
|
36
|
+
const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
|
37
|
+
const SnkFilterFieldSearch = class {
|
38
|
+
constructor(hostRef) {
|
39
|
+
index.registerInstance(this, hostRef);
|
40
|
+
this.ezSelectFilterItem = index.createEvent(this, "ezSelectFilterItem", 7);
|
41
|
+
this._filterMetadataStorage = new Map();
|
42
|
+
this._currentMetadata = null;
|
43
|
+
this._filterText = "";
|
44
|
+
this._isLoading = false;
|
45
|
+
this.searchable = true;
|
46
|
+
this.fieldsDataSource = undefined;
|
47
|
+
this.breadcrumbItems = [];
|
48
|
+
this.linkItems = [];
|
49
|
+
this.fieldItems = [];
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Realiza a abertura do componente e faz a primeira carga
|
53
|
+
* de dados.
|
54
|
+
* */
|
55
|
+
async show() {
|
56
|
+
var _a;
|
57
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
|
58
|
+
return this.loadData();
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Filtra a fonte de dados do componente.
|
62
|
+
* @param {string} filterText - Texto para filtrar a fonte de dados.
|
63
|
+
* @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
|
64
|
+
*/
|
65
|
+
async applyFilter(filterText) {
|
66
|
+
if (this.searchable)
|
67
|
+
throw new Error('This method is not available when searchable is true');
|
68
|
+
this.handleFilterChange(filterText);
|
69
|
+
}
|
70
|
+
async loadData() {
|
71
|
+
this._isLoading = true;
|
72
|
+
let metadata;
|
73
|
+
if (this._currentLink != undefined) {
|
74
|
+
metadata = this._filterMetadataStorage.get(this._currentLink.uri);
|
75
|
+
}
|
76
|
+
if (!metadata) {
|
77
|
+
metadata = await this.fieldsDataSource.fetchData(this._currentLink);
|
78
|
+
this._currentLink = metadata.currentLink;
|
79
|
+
this._filterMetadataStorage.set(this._currentLink.uri, metadata);
|
80
|
+
}
|
81
|
+
const { fields, links } = metadata || {};
|
82
|
+
if (!Array.isArray(fields) || !Array.isArray(links))
|
83
|
+
throw new Error('Invalid metadata');
|
84
|
+
this._currentMetadata = metadata;
|
85
|
+
this.mapDataSourceToLinkItems();
|
86
|
+
this.mapDataSourceToFieldItems();
|
87
|
+
this._isLoading = false;
|
88
|
+
this._ezFieldList.scrollToTop();
|
89
|
+
this._ezLinkList.scrollToTop();
|
90
|
+
}
|
91
|
+
mapDataSourceToLinkItems() {
|
92
|
+
var _a;
|
93
|
+
const { links } = this._currentMetadata;
|
94
|
+
const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
|
95
|
+
const items = links.map(link => (Object.assign({ label: link.description }, link)));
|
96
|
+
this.linkItems = [{
|
97
|
+
group: filterLinkLabelMessage,
|
98
|
+
items,
|
99
|
+
}];
|
100
|
+
if (this.breadcrumbItems.length === 0) {
|
101
|
+
this.breadcrumbItems = [Object.assign({ id: core.JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
|
102
|
+
}
|
103
|
+
}
|
104
|
+
mapDataSourceToFieldItems() {
|
105
|
+
var _a;
|
106
|
+
const { fields } = this._currentMetadata;
|
107
|
+
const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
|
108
|
+
const filteredFields = fields.filter(field => {
|
109
|
+
if (!this._currentLink)
|
110
|
+
return true;
|
111
|
+
const searchableByDescription = field.description.toLowerCase().includes(this._filterText.toLowerCase());
|
112
|
+
const searchableByName = field.name.toLowerCase().includes(this._filterText.toLowerCase());
|
113
|
+
return searchableByDescription || searchableByName;
|
114
|
+
});
|
115
|
+
const items = filteredFields.map(field => (Object.assign({ label: field.description }, field)));
|
116
|
+
this.fieldItems = [{
|
117
|
+
group: filterFieldLabelMessage,
|
118
|
+
items
|
119
|
+
}];
|
120
|
+
}
|
121
|
+
handleFilterChange(filterText) {
|
122
|
+
if (this._isLoading)
|
123
|
+
return;
|
124
|
+
this._filterText = filterText;
|
125
|
+
this.mapDataSourceToFieldItems();
|
126
|
+
}
|
127
|
+
handleSelectLink({ detail: item }) {
|
128
|
+
if (this._isLoading)
|
129
|
+
return;
|
130
|
+
const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
|
131
|
+
item.cache = this._filterMetadataStorage.has(item.uri);
|
132
|
+
if (breadcrumbByIndex > -1) {
|
133
|
+
this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
|
134
|
+
}
|
135
|
+
else {
|
136
|
+
this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: core.JSUtils.generateUUID(), label: item.description }, item)];
|
137
|
+
}
|
138
|
+
const selectedItem = Object.assign(Object.assign({}, item), { type: index$1.SelectedItemType.LINK });
|
139
|
+
this._currentLink = selectedItem;
|
140
|
+
this.ezSelectFilterItem.emit(selectedItem);
|
141
|
+
this.loadData();
|
142
|
+
}
|
143
|
+
handleSelectField({ detail: item }) {
|
144
|
+
var _a;
|
145
|
+
const breadcrumbPath = this.breadcrumbItems.map(breadcrumbItem => breadcrumbItem.label).join('>>');
|
146
|
+
const selectedField = Object.assign(Object.assign({}, item), { type: index$1.SelectedItemType.FIELD, path: `${breadcrumbPath} >> ${item.description}` });
|
147
|
+
this.ezSelectFilterItem.emit(selectedField);
|
148
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
|
149
|
+
}
|
150
|
+
getElementID(sufix) {
|
151
|
+
return {
|
152
|
+
[core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(sufix)
|
153
|
+
};
|
154
|
+
}
|
155
|
+
/**
|
156
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
157
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
158
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
159
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-field-search.msg.ts"
|
160
|
+
*/
|
161
|
+
getMessage(key, params) {
|
162
|
+
var _a, _b, _c;
|
163
|
+
if (!this._application)
|
164
|
+
this._application = core.ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
|
165
|
+
return (_c = (_b = (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage) === null || _c === void 0 ? void 0 : _c.call(_b, key, params);
|
166
|
+
}
|
167
|
+
;
|
168
|
+
componentWillLoad() {
|
169
|
+
this._application = core.ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
|
170
|
+
}
|
171
|
+
componentDidLoad() {
|
172
|
+
core.ElementIDUtils.addIDInfoIfNotExists(this._ezPopover, 'popover');
|
173
|
+
}
|
174
|
+
disconnectedCallback() {
|
175
|
+
var _a;
|
176
|
+
this._filterMetadataStorage.clear();
|
177
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
|
178
|
+
}
|
179
|
+
render() {
|
180
|
+
var _a;
|
181
|
+
const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
|
182
|
+
return (index.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')), index.h("div", { class: "snk-filter-field-search__container" }, index.h("header", { class: "snk-filter-field-search__header" }, this.searchable && !!searchLabelMessage && (index.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 && (index.h("ez-breadcrumb", Object.assign({ items: this.breadcrumbItems, onSelectedItem: this.handleSelectLink.bind(this), role: "navigation", "aria-current": "step" }, this.getElementID('EzBreadcrumb')))), index.h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" })), index.h("section", { class: "snk-filter-field-search__section" }, index.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 }) => index.h("ez-badge", { label: fieldCount }), "aria-describedby": "filterLinkLabel" }, this.getElementID('EzListLinks'))), index.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')))))));
|
183
|
+
}
|
184
|
+
};
|
185
|
+
SnkFilterFieldSearch.style = snkFilterFieldSearchCss;
|
186
|
+
|
187
|
+
class PersonalizedFilterUtils {
|
188
|
+
/**
|
189
|
+
* Cria uma expressão de filtro a partir de um IExpressionItem.
|
190
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
191
|
+
* @returns Retorna a expressão de filtro.
|
192
|
+
*/
|
193
|
+
static buildFilterExpression(expressionItem) {
|
194
|
+
if (expressionItem == undefined) {
|
195
|
+
return;
|
196
|
+
}
|
197
|
+
const value = this.buildVariableParameterValue(expressionItem);
|
198
|
+
let expression = expressionItem.expression || "";
|
199
|
+
switch (expressionItem.operand) {
|
200
|
+
case index$2.FilterOperand.IN:
|
201
|
+
expression += ` ${expressionItem.operand} (${value})`;
|
202
|
+
break;
|
203
|
+
case index$2.FilterOperand.NULL:
|
204
|
+
case index$2.FilterOperand.NOT_NULL:
|
205
|
+
expression += ` IS ${value}`;
|
206
|
+
break;
|
207
|
+
case index$2.FilterOperand.LIKE:
|
208
|
+
expression += ` LIKE '%${value}%'`;
|
209
|
+
break;
|
210
|
+
case index$2.FilterOperand.START_WITH:
|
211
|
+
expression += ` LIKE '${value}%'`;
|
212
|
+
break;
|
213
|
+
case index$2.FilterOperand.FINISHED_WITH:
|
214
|
+
expression += ` LIKE '%${value}'`;
|
215
|
+
break;
|
216
|
+
default:
|
217
|
+
expression += ` ${expressionItem.operand} ${value}`;
|
218
|
+
}
|
219
|
+
return expression;
|
220
|
+
}
|
221
|
+
/**
|
222
|
+
* Obtém o valor do parâmetro a partir de um IExpressionItem.
|
223
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
224
|
+
* @returns Retorna o valor do parâmetro.
|
225
|
+
*/
|
226
|
+
static buildVariableParameterValue(expressionItem) {
|
227
|
+
if (expressionItem == undefined) {
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
if (expressionItem.systemConfig != undefined) {
|
231
|
+
const systemConfig = expressionItem.systemConfig;
|
232
|
+
return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
|
233
|
+
}
|
234
|
+
if (expressionItem.userConfig != undefined) {
|
235
|
+
const userConfig = expressionItem.userConfig;
|
236
|
+
return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
|
237
|
+
}
|
238
|
+
return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
const snkFilterParamConfigCss = ":host{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
|
243
|
+
|
244
|
+
const SnkFilterParamConfig = class {
|
245
|
+
constructor(hostRef) {
|
246
|
+
index.registerInstance(this, hostRef);
|
247
|
+
this._opened = false;
|
248
|
+
this._configType = index$2.FilterConfigType.SYSTEM_CONFIG;
|
249
|
+
this._expressionItem = undefined;
|
250
|
+
this._informedInstance = false;
|
251
|
+
this._canSave = false;
|
252
|
+
this.messagesBuilder = undefined;
|
253
|
+
}
|
254
|
+
open(expressionItem) {
|
255
|
+
this._opened = true;
|
256
|
+
this._expressionItem = expressionItem;
|
257
|
+
this.loadValues();
|
258
|
+
return new Promise(accept => {
|
259
|
+
this._promiseResolver = accept;
|
260
|
+
});
|
261
|
+
}
|
262
|
+
close() {
|
263
|
+
this._opened = false;
|
264
|
+
return new Promise(accept => {
|
265
|
+
this._promiseResolver = accept;
|
266
|
+
});
|
267
|
+
}
|
268
|
+
/**
|
269
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
270
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
271
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
272
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
|
273
|
+
*/
|
274
|
+
getMessage(key, params) {
|
275
|
+
var _a;
|
276
|
+
return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
|
277
|
+
}
|
278
|
+
getConfigValue(configName, inputName, inputAlias = "") {
|
279
|
+
var _a, _b, _c;
|
280
|
+
return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
|
281
|
+
|| ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
|
282
|
+
}
|
283
|
+
loadValues() {
|
284
|
+
var _a;
|
285
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
286
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
287
|
+
const description = this.getConfigValue("userConfig", "description");
|
288
|
+
const type = this.getConfigValue("userConfig", "type");
|
289
|
+
if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
|
290
|
+
this._configType = index$2.FilterConfigType.USER_CONFIG;
|
291
|
+
}
|
292
|
+
else {
|
293
|
+
this._configType = index$2.FilterConfigType.SYSTEM_CONFIG;
|
294
|
+
}
|
295
|
+
if (!core.StringUtils.isEmpty(entityName) && !core.StringUtils.isEmpty(fieldName)) {
|
296
|
+
this._instanceElement.value = { value: entityName, label: "" };
|
297
|
+
this._fieldElement.value = { value: fieldName, label: "" };
|
298
|
+
}
|
299
|
+
if (!core.StringUtils.isEmpty(description) && !core.StringUtils.isEmpty(type)) {
|
300
|
+
this._descriptionElement.value = description;
|
301
|
+
this._typeElement.value = type;
|
302
|
+
}
|
303
|
+
this.buildFilterExpression();
|
304
|
+
}
|
305
|
+
changeDefinitionUsed(option) {
|
306
|
+
this._configType = option !== null && option !== void 0 ? option : index$2.FilterConfigType.SYSTEM_CONFIG;
|
307
|
+
if (this._configType === index$2.FilterConfigType.SYSTEM_CONFIG) {
|
308
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
309
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
310
|
+
this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
|
311
|
+
this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
|
312
|
+
}
|
313
|
+
else if (this._configType === index$2.FilterConfigType.USER_CONFIG) {
|
314
|
+
const description = this.getConfigValue("userConfig", "description");
|
315
|
+
const type = this.getConfigValue("userConfig", "type");
|
316
|
+
this._descriptionElement.value = this._descriptionElement.value || description;
|
317
|
+
this._typeElement.value = this._typeElement.value || type;
|
318
|
+
}
|
319
|
+
this.buildFilterExpression();
|
320
|
+
}
|
321
|
+
getTypeValue() {
|
322
|
+
var _a;
|
323
|
+
const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
|
324
|
+
return ((value === null || value === void 0 ? void 0 : value.value) || value);
|
325
|
+
}
|
326
|
+
getExpressionValues() {
|
327
|
+
var _a, _b, _c, _d, _e;
|
328
|
+
let systemConfig;
|
329
|
+
let userConfig;
|
330
|
+
if (this._configType === index$2.FilterConfigType.SYSTEM_CONFIG) {
|
331
|
+
const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
332
|
+
const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
|
333
|
+
systemConfig = { entity, fieldName };
|
334
|
+
}
|
335
|
+
else if (this._configType === index$2.FilterConfigType.USER_CONFIG) {
|
336
|
+
const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
|
337
|
+
const type = this.getTypeValue();
|
338
|
+
userConfig = { description, type };
|
339
|
+
}
|
340
|
+
return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
|
341
|
+
}
|
342
|
+
isEnabled(value) {
|
343
|
+
return this._configType === value;
|
344
|
+
}
|
345
|
+
isInformedInstance() {
|
346
|
+
var _a, _b;
|
347
|
+
return !core.StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
|
348
|
+
}
|
349
|
+
save() {
|
350
|
+
var _a;
|
351
|
+
this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
|
352
|
+
this._promiseResolver(this._expressionItem);
|
353
|
+
this._opened = false;
|
354
|
+
}
|
355
|
+
buildFilterExpression() {
|
356
|
+
var _a;
|
357
|
+
this._informedInstance = this.isInformedInstance();
|
358
|
+
const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
|
359
|
+
this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
|
360
|
+
this._canSave = this.getCanSave();
|
361
|
+
}
|
362
|
+
handleChangeInstance() {
|
363
|
+
this._informedInstance = this.isInformedInstance();
|
364
|
+
if (this._fieldElement != undefined && !core.StringUtils.isEmpty(this._fieldElement.value)) {
|
365
|
+
this._fieldElement.value = null;
|
366
|
+
}
|
367
|
+
this.buildFilterExpression();
|
368
|
+
}
|
369
|
+
getInstanceCriteria() {
|
370
|
+
var _a, _b;
|
371
|
+
const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
372
|
+
return {
|
373
|
+
expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
|
374
|
+
params: [
|
375
|
+
{
|
376
|
+
name: "NOMEINSTANCIA",
|
377
|
+
dataType: core.DataType.TEXT,
|
378
|
+
value
|
379
|
+
}
|
380
|
+
]
|
381
|
+
};
|
382
|
+
}
|
383
|
+
onSearch({ mode, argument }, entity) {
|
384
|
+
if (this._application == undefined) {
|
385
|
+
return;
|
386
|
+
}
|
387
|
+
const isField = entity === index$2.FilterEntities.FIELD;
|
388
|
+
const criteria = isField ? this.getInstanceCriteria() : undefined;
|
389
|
+
const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
|
390
|
+
const entityDescription = this.getMessage(messageKey);
|
391
|
+
const searchOptions = {
|
392
|
+
descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
|
393
|
+
codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
|
394
|
+
showInactives: false
|
395
|
+
};
|
396
|
+
const options = {
|
397
|
+
entity,
|
398
|
+
entityDescription,
|
399
|
+
criteria,
|
400
|
+
searchOptions
|
401
|
+
};
|
402
|
+
return this._application.executePreparedSearch(mode, argument, options);
|
403
|
+
}
|
404
|
+
getElementID(sufix) {
|
405
|
+
return {
|
406
|
+
[core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(sufix)
|
407
|
+
};
|
408
|
+
}
|
409
|
+
getCanSave() {
|
410
|
+
var _a;
|
411
|
+
if (this._configType === index$2.FilterConfigType.USER_CONFIG) {
|
412
|
+
const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
|
413
|
+
const type = this.getTypeValue();
|
414
|
+
return !core.StringUtils.isEmpty(description) && !core.StringUtils.isEmpty(type);
|
415
|
+
}
|
416
|
+
return true;
|
417
|
+
}
|
418
|
+
componentWillLoad() {
|
419
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
420
|
+
}
|
421
|
+
render() {
|
422
|
+
core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
|
423
|
+
return (index.h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), index.h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
|
424
|
+
if (evt.detail === ezModalContainer.ModalAction.CLOSE)
|
425
|
+
this.close();
|
426
|
+
}, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), index.h("div", { class: "ez-flex" }, index.h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, index.h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), index.h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: index$2.FilterConfigType.SYSTEM_CONFIG })), index.h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(index$2.FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, index$2.FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), index.h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(index$2.FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, index$2.FilterEntities.FIELD) }, this.getElementID("configFindField")))), index.h("div", { class: "ez-flex ez-padding--medium" }, index.h("hr", { class: "ez-divider-vertical" })), index.h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, index.h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), index.h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: index$2.FilterConfigType.USER_CONFIG })), index.h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(index$2.FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), index.h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(index$2.FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(index$2.FilterUserConfigTypes).map((configType) => {
|
427
|
+
return (index.h("option", { value: index$2.FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
|
428
|
+
})))), index.h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), index.h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, index.h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), index.h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
|
429
|
+
}
|
430
|
+
get _element() { return index.getElement(this); }
|
431
|
+
};
|
432
|
+
SnkFilterParamConfig.style = snkFilterParamConfigCss;
|
433
|
+
|
434
|
+
exports.snk_filter_field_search = SnkFilterFieldSearch;
|
435
|
+
exports.snk_filter_param_config = SnkFilterParamConfig;
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
const index = require('./index-21bd01e1.js');
|
6
6
|
const core = require('@sankhyalabs/core');
|
7
|
-
const filterItemType_enum = require('./filter-item-type.enum-
|
7
|
+
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
8
8
|
|
9
9
|
const SnkFilterItem = class {
|
10
10
|
constructor(hostRef) {
|
@@ -0,0 +1,66 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
const index = require('./index-21bd01e1.js');
|
6
|
+
const core = require('@sankhyalabs/core');
|
7
|
+
const filterItemType_enum = require('./filter-item-type.enum-aa823a00.js');
|
8
|
+
const filterType_enum = require('./filter-type.enum-b14ce507.js');
|
9
|
+
const presentationMode = require('./presentationMode-52ec3bdd.js');
|
10
|
+
|
11
|
+
const snkFilterModalItemCss = ".grow{flex-grow:1}";
|
12
|
+
|
13
|
+
const SnkFilterModalItem = class {
|
14
|
+
constructor(hostRef) {
|
15
|
+
index.registerInstance(this, hostRef);
|
16
|
+
this.filterChange = index.createEvent(this, "filterChange", 7);
|
17
|
+
this.filterItem = undefined;
|
18
|
+
}
|
19
|
+
observeFilterItem(newValue) {
|
20
|
+
this.filterChange.emit(newValue);
|
21
|
+
}
|
22
|
+
getContentEditorConfig() {
|
23
|
+
const variations = { presentationMode: presentationMode.EPresentationMode.MODAL };
|
24
|
+
switch (this.filterItem.type) {
|
25
|
+
case filterItemType_enum.FilterItemType.BINARY_SELECT:
|
26
|
+
return { tag: "snk-filter-binary-select", variations };
|
27
|
+
case filterItemType_enum.FilterItemType.MULTI_SELECT:
|
28
|
+
return { tag: "snk-filter-multi-select" };
|
29
|
+
case filterItemType_enum.FilterItemType.PERIOD:
|
30
|
+
return { tag: "snk-filter-period", variations };
|
31
|
+
case filterItemType_enum.FilterItemType.SEARCH:
|
32
|
+
return { tag: "snk-filter-search" };
|
33
|
+
case filterItemType_enum.FilterItemType.NUMBER:
|
34
|
+
return { tag: "snk-filter-number" };
|
35
|
+
case filterItemType_enum.FilterItemType.PERSONALIZED:
|
36
|
+
return { tag: "snk-filter-personalized" };
|
37
|
+
case filterItemType_enum.FilterItemType.MULTI_LIST:
|
38
|
+
return { tag: "snk-entity-list" };
|
39
|
+
}
|
40
|
+
return { tag: "snk-filter-text" };
|
41
|
+
}
|
42
|
+
updateFilterValue(newValue) {
|
43
|
+
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: newValue });
|
44
|
+
}
|
45
|
+
canShowDetailModal() {
|
46
|
+
return this.filterItem.filterType !== filterType_enum.FilterType.OTHER_FILTERS && this.filterItem.type !== filterItemType_enum.FilterItemType.BINARY_SELECT;
|
47
|
+
}
|
48
|
+
componentDidLoad() {
|
49
|
+
if (this._element) {
|
50
|
+
core.ElementIDUtils.addIDInfo(this._element);
|
51
|
+
const dataElementIdDoFilterItem = this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
52
|
+
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.filterItem.id}`;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
render() {
|
56
|
+
const { tag: ContentEditor, variations } = this.getContentEditorConfig();
|
57
|
+
return (index.h(index.Host, null, index.h("div", { class: "ez-flex ez-flex--column grow" }, this.canShowDetailModal() && (index.h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, index.h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.filterItem.detailModal))), index.h(ContentEditor, Object.assign({ config: this.filterItem, value: this.filterItem.value, onValueChanged: (event) => this.updateFilterValue(event.detail), "data-element-id": this._idContentEditor }, variations)))));
|
58
|
+
}
|
59
|
+
get _element() { return index.getElement(this); }
|
60
|
+
static get watchers() { return {
|
61
|
+
"filterItem": ["observeFilterItem"]
|
62
|
+
}; }
|
63
|
+
};
|
64
|
+
SnkFilterModalItem.style = snkFilterModalItemCss;
|
65
|
+
|
66
|
+
exports.snk_filter_modal_item = SnkFilterModalItem;
|