@sankhyalabs/sankhyablocks 5.4.3 → 5.6.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-115e8a80.js → SnkMessageBuilder-e64dce7f.js} +49 -1
- package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
- package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
- package/dist/cjs/index-8d94b7e0.js +7 -0
- package/dist/cjs/{index-fc7ca86c.js → index-de79181a.js} +2 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +3 -315
- package/dist/cjs/snk-attach.cjs.entry.js +450 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
- package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +23 -13
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-85d6565e.js} +4 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
- package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
- package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +11 -3
- package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-9784c527.js} +2 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
- package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
- package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +48 -5
- package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +6 -4
- package/dist/cjs/{taskbar-elements-5e87cf44.js → taskbar-elements-bc2598f9.js} +4 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
- package/dist/collection/components/snk-attach/snk-attach.css +8 -0
- package/dist/collection/components/snk-attach/snk-attach.js +202 -0
- package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
- package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
- package/dist/collection/components/snk-attach/structure/index.js +3 -0
- package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
- package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
- package/dist/collection/components/snk-crud/snk-crud.js +22 -11
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
- package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
- package/dist/collection/components/snk-grid/snk-grid.js +11 -3
- 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/components/snk-simple-bar/snk-simple-bar.js +37 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +7 -1
- package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
- package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
- package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
- package/dist/collection/lib/store/index.js +2 -1
- package/dist/collection/lib/utils/constants.js +1 -0
- package/dist/components/SnkMessageBuilder.js +49 -1
- package/dist/components/constants.js +1 -0
- package/dist/components/dataunit-fetcher.js +317 -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/snk-application2.js +2 -314
- package/dist/components/snk-attach.d.ts +11 -0
- package/dist/components/snk-attach.js +6 -0
- package/dist/components/snk-attach2.js +498 -0
- package/dist/components/snk-crud.js +77 -48
- package/dist/components/snk-data-exporter2.js +1 -1
- package/dist/components/snk-data-unit2.js +4 -0
- 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-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-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-grid2.js +12 -4
- package/dist/components/snk-personalized-filter.d.ts +11 -0
- package/dist/components/snk-personalized-filter.js +158 -0
- package/dist/components/snk-simple-bar.js +1 -41
- package/dist/components/snk-simple-bar2.js +59 -0
- package/dist/components/snk-simple-crud.js +1 -328
- package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
- package/dist/components/snk-taskbar2.js +10 -199
- package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-f3590f65.js} +49 -1
- package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
- package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
- package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
- package/dist/esm/index-620ac460.js +7 -0
- package/dist/esm/{index-e467ade5.js → index-8efbf198.js} +2 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +3 -315
- package/dist/esm/snk-attach.entry.js +446 -0
- package/dist/esm/snk-config-options.entry.js +1 -1
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +25 -15
- package/dist/esm/snk-data-exporter.entry.js +4 -4
- package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-50b1660c.js} +4 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +6 -6
- package/dist/esm/snk-expression-item.entry.js +209 -0
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-grid-config.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +13 -5
- package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-4d12f268.js} +3 -3
- package/dist/esm/snk-guides-viewer.entry.js +5 -5
- package/dist/esm/snk-personalized-filter.entry.js +122 -0
- package/dist/esm/snk-select-box.entry.js +1 -1
- package/dist/esm/snk-simple-bar_2.entry.js +325 -0
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +7 -5
- package/dist/esm/{taskbar-elements-10d80c79.js → taskbar-elements-e6af3e93.js} +5 -2
- package/dist/sankhyablocks/p-17375123.js +1 -0
- package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
- package/dist/sankhyablocks/p-1dcfd32a.entry.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-3d3263b4.js +1 -0
- package/dist/sankhyablocks/p-3fbe2d69.entry.js +11 -0
- package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
- package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
- package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
- package/dist/sankhyablocks/p-6a02e236.js +1 -0
- package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
- package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
- package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-c4417efb.entry.js} +1 -1
- package/dist/sankhyablocks/p-c9477950.js +1 -0
- package/dist/sankhyablocks/{p-703dddb9.js → p-ccd26e3a.js} +1 -1
- package/dist/sankhyablocks/p-d410f45a.js +1 -0
- package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
- package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
- package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
- package/dist/sankhyablocks/{p-1393dc00.entry.js → p-f344b811.entry.js} +1 -1
- package/dist/sankhyablocks/p-f4184ce7.js +1 -0
- package/dist/sankhyablocks/p-f821768b.js +74 -0
- package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
- package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
- package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
- package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
- package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
- package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
- package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
- package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -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/snk-simple-bar/snk-simple-bar.d.ts +14 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
- package/dist/types/components.d.ts +150 -9
- package/dist/types/global.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
- package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
- package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
- package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
- package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
- package/dist/types/lib/store/index.d.ts +1 -0
- package/dist/types/lib/utils/constants.d.ts +2 -1
- 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/snk-simple-bar.cjs.entry.js +0 -30
- package/dist/esm/snk-simple-bar.entry.js +0 -26
- package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
- package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
- package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
- package/dist/sankhyablocks/p-74724fa7.js +0 -1
- package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
- package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
- package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
- package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
- package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
- package/dist/sankhyablocks/p-98f7f796.js +0 -1
- package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
- package/dist/sankhyablocks/p-bc281de0.js +0 -1
- package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
- package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
- package/dist/sankhyablocks/p-f587a454.js +0 -1
- package/dist/types/components/snk-application/snk-application.d.ts +0 -259
- package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
- package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
- package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -0,0 +1,209 @@
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './index-cfd4bb13.js';
|
2
|
+
import { UserInterface, ApplicationContext } from '@sankhyalabs/core';
|
3
|
+
import { S as SelectedItemType } from './index-620ac460.js';
|
4
|
+
import { ApplicationUtils, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
|
+
import { fieldBuilder } from '@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder';
|
6
|
+
import { c as FilterOperand } from './index-507e19ec.js';
|
7
|
+
import { s as store } from './index-8efbf198.js';
|
8
|
+
|
9
|
+
const FilterOperandDefault = [
|
10
|
+
{ value: FilterOperand.EQUAL, label: "Igual (=)" },
|
11
|
+
{ value: FilterOperand.DIFFERENT, label: "Diferente (<>)" },
|
12
|
+
{ value: FilterOperand.LIKE, label: "Contendo (LIKE)" },
|
13
|
+
{ value: FilterOperand.IN, label: "Contido em (IN)" },
|
14
|
+
{ value: FilterOperand.START_WITH, label: "Iniciado com (%?)" },
|
15
|
+
{ value: FilterOperand.FINISHED_WITH, label: "Terminado com (?%)" },
|
16
|
+
{ value: FilterOperand.NULL, label: "Vazio (NULL)" },
|
17
|
+
{ value: FilterOperand.NOT_NULL, label: "Não Vazio (NOT NULL)" },
|
18
|
+
{ value: FilterOperand.LARGER, label: "Maior (>)" },
|
19
|
+
{ value: FilterOperand.LARGER_EQUAL, label: "Maior ou Igual (>=)" },
|
20
|
+
{ value: FilterOperand.SMALLER, label: "Menor (<)" },
|
21
|
+
{ value: FilterOperand.SMALLER_EQUAL, label: "Menor ou Igual (<=)" }
|
22
|
+
];
|
23
|
+
const FilterOperandTypeTextSearch = [
|
24
|
+
{ value: FilterOperand.EQUAL, label: "Igual (=)" },
|
25
|
+
{ value: FilterOperand.DIFFERENT, label: "Diferente (<>)" },
|
26
|
+
{ value: FilterOperand.LIKE, label: "Contendo (LIKE)" },
|
27
|
+
{ value: FilterOperand.IN, label: "Contido em (IN)" },
|
28
|
+
{ value: FilterOperand.START_WITH, label: "Iniciado com (%?)" },
|
29
|
+
{ value: FilterOperand.FINISHED_WITH, label: "Terminado com (?%)" },
|
30
|
+
{ value: FilterOperand.NULL, label: "Vazio (NULL)" },
|
31
|
+
{ value: FilterOperand.NOT_NULL, label: "Não Vazio (NOT NULL)" }
|
32
|
+
];
|
33
|
+
const FIELD_TYPE_SEARCH_AND_TEXT = [
|
34
|
+
UserInterface.SEARCH,
|
35
|
+
UserInterface.SHORTTEXT,
|
36
|
+
UserInterface.PASSWORD,
|
37
|
+
UserInterface.MASKEDTEXT,
|
38
|
+
UserInterface.LONGTEXT,
|
39
|
+
UserInterface.HTML
|
40
|
+
];
|
41
|
+
|
42
|
+
const snkExpressionItemCss = ".sc-snk-expression-item-h{display:flex;width:100%;--snk-expression-item--background-color:var(--background--xlight, #fff);--snk-expression-item__itens--padding:var(--space--small, 6px);--snk-expression-item__width--input-operator:220px;--snk-expression-item__width--input-value:240px;--snk-expression-item__width--input-value-variable:176px;--snk-expression-item--border-radius:var(--border--radius-medium, 12px);--snk-expression-item--border-color:var(--color--strokes, #DCE0E8);--snk-expression-item--border-style:var(--border--small, 1px solid)}.box.sc-snk-expression-item{width:100%;height:100%;background:var(--snk-expression-item--background-color);margin:var(--space--small, 6px);border:var(--snk-expression-item--border-color) var(--snk-expression-item--border-style);border-radius:var(--snk-expression-item--border-radius)}.box__container.sc-snk-expression-item{display:flex;align-items:center;justify-content:space-between;white-space:nowrap;margin:var(--space--small, 6px)}.box__container--input-filter.sc-snk-expression-item{width:100%}.box__container--input-operator.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-operator);min-width:var(--snk-expression-item__width--input-operator)}.box__container--input-value.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value);min-width:var(--snk-expression-item__width--input-value)}.box__container--input-value-variable.sc-snk-expression-item{display:flex;width:var(--snk-expression-item__width--input-value-variable);min-width:var(--snk-expression-item__width--input-value-variable)}.box__container--button-delete.sc-snk-expression-item{display:flex}.box__container.sc-snk-expression-item>div.sc-snk-expression-item{padding-left:var(--snk-expression-item__itens--padding);padding-right:var(--snk-expression-item__itens--padding)}.box__container--button-delete--icon.sc-snk-expression-item{width:42px;min-width:42px}.box__container--input-value-variable--icon.sc-snk-expression-item{cursor:pointer}";
|
43
|
+
|
44
|
+
const SnkExpressionItem = class {
|
45
|
+
constructor(hostRef) {
|
46
|
+
registerInstance(this, hostRef);
|
47
|
+
this.ezFilterItemChange = createEvent(this, "ezFilterItemChange", 7);
|
48
|
+
this.ezFilterItemRemove = createEvent(this, "ezFilterItemRemove", 7);
|
49
|
+
this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
50
|
+
this.filterOperandDefault = FilterOperandDefault;
|
51
|
+
this.filterOperandTypeTextSearch = FilterOperandTypeTextSearch;
|
52
|
+
this._showValueVariable = false;
|
53
|
+
this._fieldSelected = undefined;
|
54
|
+
this._optionNotNull = false;
|
55
|
+
this.expression = undefined;
|
56
|
+
this.canRemove = true;
|
57
|
+
this.messagesBuilder = undefined;
|
58
|
+
}
|
59
|
+
expressionChanged(newValue, oldValue) {
|
60
|
+
if (newValue !== oldValue) {
|
61
|
+
this.ezFilterItemChange.emit(newValue);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
componentWillLoad() {
|
65
|
+
this._dataSourceFetcher = store.get("filterFieldsDataSource");
|
66
|
+
store.onChange('filterFieldsDataSource', () => {
|
67
|
+
this._dataSourceFetcher = store.get("filterFieldsDataSource");
|
68
|
+
});
|
69
|
+
}
|
70
|
+
setValueExpression(key, value) {
|
71
|
+
this.expression[key] = value;
|
72
|
+
this.expressionChanged(this.expression);
|
73
|
+
}
|
74
|
+
getMessage(key, params) {
|
75
|
+
return this.application.messagesBuilder.getMessage(key, params);
|
76
|
+
}
|
77
|
+
handleSelectItem(filterField) {
|
78
|
+
if (filterField.type === SelectedItemType.FIELD) {
|
79
|
+
const field = filterField;
|
80
|
+
this._fieldSelected = field;
|
81
|
+
this.setValueExpression("fieldName", field.name);
|
82
|
+
}
|
83
|
+
}
|
84
|
+
handleFocus() {
|
85
|
+
if (this._elFilterFieldSearch)
|
86
|
+
this._elFilterFieldSearch.show();
|
87
|
+
}
|
88
|
+
handleChangeFilterInput(evt) {
|
89
|
+
this._elFilterFieldSearch.applyFilter(evt.detail);
|
90
|
+
}
|
91
|
+
handleChangeValueVariable(showValueVariable) {
|
92
|
+
this._showValueVariable = showValueVariable;
|
93
|
+
if (this._elFieldDynamic) {
|
94
|
+
this._elFieldDynamic.value = undefined;
|
95
|
+
this._elFieldDynamic.enabled = !showValueVariable;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
openSnkFilterParamConfig() {
|
99
|
+
var _a;
|
100
|
+
(_a = this._elFilterParamConfigRef) === null || _a === void 0 ? void 0 : _a.open(this.expression).then(this.onOpenPromiseReady.bind(this)).catch(error => {
|
101
|
+
console.error(error);
|
102
|
+
});
|
103
|
+
}
|
104
|
+
onOpenPromiseReady(changes) {
|
105
|
+
this.expression = changes;
|
106
|
+
}
|
107
|
+
buildOptionsOperator() {
|
108
|
+
var _a;
|
109
|
+
if (FIELD_TYPE_SEARCH_AND_TEXT.includes((_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.userInterface)) {
|
110
|
+
return this.filterOperandTypeTextSearch;
|
111
|
+
}
|
112
|
+
else {
|
113
|
+
return this.filterOperandDefault;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
handleChangeOperator(optionSelected) {
|
117
|
+
this.checkOptionIsNull(optionSelected);
|
118
|
+
this.setValueExpression("operand", optionSelected);
|
119
|
+
}
|
120
|
+
checkOptionIsNull(optionSelected) {
|
121
|
+
if (optionSelected === FilterOperand.NULL || optionSelected === FilterOperand.NOT_NULL) {
|
122
|
+
this._optionNotNull = true;
|
123
|
+
if (this._elFieldDynamic) {
|
124
|
+
this._elFieldDynamic.enabled = false;
|
125
|
+
this._elFieldDynamic.value = undefined;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
this._optionNotNull = false;
|
130
|
+
if (this._elFieldDynamic) {
|
131
|
+
this._elFieldDynamic.enabled = this._showValueVariable ? false : true;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
confirmRemove(evt) {
|
136
|
+
evt.preventDefault();
|
137
|
+
evt.stopPropagation();
|
138
|
+
ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirm.title"), this.getMessage("snkPersonalizedFilter.confirm.description"))
|
139
|
+
.then((canRemove) => {
|
140
|
+
if (canRemove) {
|
141
|
+
this.ezFilterItemRemove.emit(this.expression);
|
142
|
+
}
|
143
|
+
});
|
144
|
+
}
|
145
|
+
buildFieldByType() {
|
146
|
+
var _a, _b;
|
147
|
+
if (!this._fieldSelected)
|
148
|
+
return;
|
149
|
+
const inputFieldData = (_a = fieldBuilder(this.configureFieldByType())) === null || _a === void 0 ? void 0 : _a.$children$.shift();
|
150
|
+
if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData) {
|
151
|
+
inputFieldData.$attrs$.enabled = false;
|
152
|
+
}
|
153
|
+
return h(inputFieldData.$tag$, Object.assign(Object.assign({}, inputFieldData.$attrs$), { ref: (el) => {
|
154
|
+
this._elFieldDynamic = el;
|
155
|
+
} }));
|
156
|
+
}
|
157
|
+
configureFieldByType() {
|
158
|
+
const field = {
|
159
|
+
userInterface: this._fieldSelected.userInterface,
|
160
|
+
name: this._fieldSelected.name,
|
161
|
+
label: this._fieldSelected.label,
|
162
|
+
canShowError: false
|
163
|
+
};
|
164
|
+
switch (field.userInterface) {
|
165
|
+
case UserInterface.OPTIONSELECTOR:
|
166
|
+
field.props = {
|
167
|
+
options: this._fieldSelected.properties.map(option => ({
|
168
|
+
value: option.value,
|
169
|
+
label: option.name,
|
170
|
+
})),
|
171
|
+
};
|
172
|
+
break;
|
173
|
+
case UserInterface.LONGTEXT:
|
174
|
+
field.rows = 1;
|
175
|
+
break;
|
176
|
+
case UserInterface.SEARCH:
|
177
|
+
field.optionLoader = searchArgument => this.setCriteriaSearch(searchArgument, this.application);
|
178
|
+
break;
|
179
|
+
}
|
180
|
+
return field;
|
181
|
+
}
|
182
|
+
setCriteriaSearch({ mode, argument }, application) {
|
183
|
+
if (application == undefined)
|
184
|
+
return;
|
185
|
+
const searchOptions = {
|
186
|
+
showInactives: false
|
187
|
+
};
|
188
|
+
const options = {
|
189
|
+
entity: this._fieldSelected.properties.ENTITYNAME,
|
190
|
+
searchOptions: searchOptions,
|
191
|
+
entityDescription: this._fieldSelected.label
|
192
|
+
};
|
193
|
+
return application.executePreparedSearch(mode, argument, options);
|
194
|
+
}
|
195
|
+
render() {
|
196
|
+
var _a;
|
197
|
+
return (h(Host, null, h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", { value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", { label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => this.handleChangeOperator(evt.detail.value), suppressEmptyOption: true })), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
|
198
|
+
h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
|
199
|
+
this.buildFieldByType()), h("div", { class: "box__container--input-value-variable", title: this.getMessage("snkPersonalizedFilter.info.titleTooltip") }, !this._optionNotNull &&
|
200
|
+
h("ez-check", { ref: ref => this._elValueVariable = ref, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
|
201
|
+
h("ez-icon", { class: "box__container--input-value-variable--icon", size: "large", iconName: "settings-inverted", onClick: () => this.openSnkFilterParamConfig() }), h("snk-filter-param-config", { ref: (el) => this._elFilterParamConfigRef = el, messagesBuilder: this.messagesBuilder })), h("div", { class: "box__container--button-delete" }, h("div", { class: "box__container--button-delete--icon" }, this.canRemove && h("ez-button", { mode: "icon", iconName: "delete", onClick: (evt) => this.confirmRemove(evt) })))))));
|
202
|
+
}
|
203
|
+
static get watchers() { return {
|
204
|
+
"expression": ["expressionChanged"]
|
205
|
+
}; }
|
206
|
+
};
|
207
|
+
SnkExpressionItem.style = snkExpressionItemCss;
|
208
|
+
|
209
|
+
export { SnkExpressionItem as snk_expression_item };
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-cfd4bb13.js';
|
2
2
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { A as ACTION_CONFIG } from './constants-
|
3
|
+
import { A as ACTION_CONFIG } from './constants-e916ccc3.js';
|
4
4
|
|
5
5
|
const snkFieldConfigCss = ".sc-snk-field-config-h{--snk-field-config--height:42px;--snk-field-config--width:100%;--snk-field-config__icon--width:48px;--snk-field-config-slim--height:32px;--snk-field-config--border-radius:var(--border--radius-medium, 12px);--snk-field-config--font-size:var(--text--medium, 14px);--snk-field-config--font-family:var(--font-pattern, Arial);--snk-field-config--font-weight:var(--text-weight--medium, 400);--snk-field-config--color:var(--title--primary, #000);--snk-field-config--padding-left:var(--space--medium, 6px);--snk-field-config__input--background-color:var(--background--medium, #e0e0e0);--snk-field-config__input--border:var(--border--medium, 2px solid);--snk-field-config__input--border-color:var(--background--xlight, #fff);--snk-field-config__required--color:var(--color--error, #FF0000);--snk-field-config__label--gap:var(--space--extra-small, 3px);--snk-field-config__transition--visibility:var(--transition, 0.2s linear);--snk-field-config__transition--opacity:var(--transition, 0.15s linear);--snk-field-config__config-popover--z-index:var(--more-visible, 2);--snk-field-config__config-outer-arrow--background-color:var(--color--secondary-200, #D2D3DA);--snk-field-config__draggable--padding-right:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--snk-field-config--width)}.field-config.sc-snk-field-config{width:100%;box-sizing:border-box;display:flex;align-items:center;padding-left:var(--snk-field-config--padding-left);font-weight:var(--snk-field-config--font-weight);height:var(--snk-field-config--height);border-radius:var(--snk-field-config--border-radius);font-family:var(--snk-field-config--font-family);font-size:var(--snk-field-config--font-size);border:var(--snk-field-config__input--border);border-color:var(--snk-field-config__input--border-color);background-color:var(--snk-field-config__input--background-color);color:var(--snk-field-config--color)}.field-config__config-popover.sc-snk-field-config{width:40px;margin-left:auto;z-index:var(--snk-field-config__config-popover--z-index)}.field-config__label.sc-snk-field-config{display:flex;flex-direction:row-reverse;line-height:calc(var(--snk-field-config--font-size) + 2px);gap:var(--snk-field-config__label--gap)}.field-config__label-text.sc-snk-field-config{overflow:hidden;-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;height:auto;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;display:-webkit-box;-o-text-overflow:ellipsis;text-overflow:ellipsis;word-break:break-word}.field-config__label-required.sc-snk-field-config{color:var(--snk-field-config__required--color)}.field-config__add.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options.sc-snk-field-config{display:flex;margin-left:auto;visibility:hidden;opacity:0;transition:visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity)}.field-config__options--is-active.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config__remove-icon.sc-snk-field-config{margin-right:-15px}.field-config.sc-snk-field-config:hover .field-config__options.sc-snk-field-config{display:flex;visibility:visible;opacity:1}.field-config.sc-snk-field-config:hover .field-config__add.sc-snk-field-config{visibility:visible;opacity:1}.field-config__draggable.sc-snk-field-config{padding-right:var(--snk-field-config__draggable--padding-right)}.field-config__config-outer-arrow.sc-snk-field-config{clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px;padding-top:3px;border-bottom:1px solid #FFFFFF;background-color:var(--snk-field-config__config-outer-arrow--background-color)}.field-config__config-inner-arrow.sc-snk-field-config{background-color:#FFFFFF;clip-path:polygon(50% 0, 90% 100%, 10% 100%);border-radius:0.25em 0 0 0;width:30px;height:15px}.ez-box__container.sc-snk-field-config ez-collapsible-box.sc-snk-field-config{--snk-collapsible-box__header--padding-left:6px}ez-icon.sc-snk-field-config{--snk-icon--color:var(--snk-field-config--color)}ez-popover.sc-snk-field-config{--snk-popover__box--background-color:transparent;--snk-popover__box--box-shadow:none}.field-config__options.sc-snk-field-config ez-button.sc-snk-field-config{--snk-button--background-color:transparent;--snk-button--focus--border:none;--snk-button--focus--box-shadow:none}@media screen and (min-width: 1200px){.field-config__label.sc-snk-field-config{flex-direction:row}}";
|
6
6
|
|
@@ -0,0 +1,430 @@
|
|
1
|
+
import { h, r as registerInstance, c as createEvent, g as getElement } from './index-cfd4bb13.js';
|
2
|
+
import { S as SelectedItemType } from './index-620ac460.js';
|
3
|
+
import { UserInterface, JSUtils, ElementIDUtils, ApplicationContext, StringUtils, DataType } from '@sankhyalabs/core';
|
4
|
+
import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
5
|
+
import { c as FilterOperand, d as FilterConfigType, e as FilterEntities, F as FilterUserConfigTypes } from './index-507e19ec.js';
|
6
|
+
|
7
|
+
const ICON_MODES = {
|
8
|
+
[UserInterface.SHORTTEXT]: 'text',
|
9
|
+
[UserInterface.LONGTEXT]: 'text',
|
10
|
+
[UserInterface.INTEGERNUMBER]: 'number',
|
11
|
+
[UserInterface.DECIMALNUMBER]: 'number',
|
12
|
+
[UserInterface.DATE]: 'calendar',
|
13
|
+
[UserInterface.DATETIME]: 'calendar',
|
14
|
+
[UserInterface.SWITCH]: 'boolean',
|
15
|
+
[UserInterface.CHECKBOX]: 'check-circle-inverted',
|
16
|
+
[UserInterface.OPTIONSELECTOR]: 'list',
|
17
|
+
[UserInterface.SEARCH]: 'search',
|
18
|
+
[UserInterface.HTML]: 'tag_code',
|
19
|
+
[UserInterface.IMAGE]: 'png',
|
20
|
+
[UserInterface.FILE]: 'edit-file',
|
21
|
+
[UserInterface.TIME]: 'timer-outline',
|
22
|
+
[UserInterface.ELAPSEDTIME]: 'timer',
|
23
|
+
[UserInterface.MASKEDTEXT]: 'text',
|
24
|
+
[UserInterface.PASSWORD]: 'email',
|
25
|
+
};
|
26
|
+
const ListItem = ({ userInterface, description }) => {
|
27
|
+
return (h("ez-icon", { iconName: ICON_MODES[userInterface], className: "ez-padding-left--small", title: description }));
|
28
|
+
};
|
29
|
+
|
30
|
+
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}";
|
31
|
+
|
32
|
+
const SNK_CONTEXT_KEY = "__SNK__APPLICATION__";
|
33
|
+
const SnkFilterFieldSearch = class {
|
34
|
+
constructor(hostRef) {
|
35
|
+
registerInstance(this, hostRef);
|
36
|
+
this.ezSelectFilterItem = createEvent(this, "ezSelectFilterItem", 7);
|
37
|
+
this._filterMetadataStorage = new Map();
|
38
|
+
this._currentMetadata = null;
|
39
|
+
this._filterText = "";
|
40
|
+
this._isLoading = false;
|
41
|
+
this.searchable = true;
|
42
|
+
this.fieldsDataSource = undefined;
|
43
|
+
this.breadcrumbItems = [];
|
44
|
+
this.linkItems = [];
|
45
|
+
this.fieldItems = [];
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Realiza a abertura do componente e faz a primeira carga
|
49
|
+
* de dados.
|
50
|
+
* */
|
51
|
+
async show() {
|
52
|
+
var _a;
|
53
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.show();
|
54
|
+
return this.loadData();
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Filtra a fonte de dados do componente.
|
58
|
+
* @param {string} filterText - Texto para filtrar a fonte de dados.
|
59
|
+
* @throws {Error} - Quando o componente estiver com a propriedade searchable como true.
|
60
|
+
*/
|
61
|
+
async applyFilter(filterText) {
|
62
|
+
if (this.searchable)
|
63
|
+
throw new Error('This method is not available when searchable is true');
|
64
|
+
this.handleFilterChange(filterText);
|
65
|
+
}
|
66
|
+
async loadData() {
|
67
|
+
this._isLoading = true;
|
68
|
+
let metadata;
|
69
|
+
if (this._currentLink != undefined) {
|
70
|
+
metadata = this._filterMetadataStorage.get(this._currentLink.uri);
|
71
|
+
}
|
72
|
+
if (!metadata) {
|
73
|
+
metadata = await this.fieldsDataSource.fetchData(this._currentLink);
|
74
|
+
this._currentLink = metadata.currentLink;
|
75
|
+
this._filterMetadataStorage.set(this._currentLink.uri, metadata);
|
76
|
+
}
|
77
|
+
const { fields, links } = metadata || {};
|
78
|
+
if (!Array.isArray(fields) || !Array.isArray(links))
|
79
|
+
throw new Error('Invalid metadata');
|
80
|
+
this._currentMetadata = metadata;
|
81
|
+
this.mapDataSourceToLinkItems();
|
82
|
+
this.mapDataSourceToFieldItems();
|
83
|
+
this._isLoading = false;
|
84
|
+
this._ezFieldList.scrollToTop();
|
85
|
+
this._ezLinkList.scrollToTop();
|
86
|
+
}
|
87
|
+
mapDataSourceToLinkItems() {
|
88
|
+
var _a;
|
89
|
+
const { links } = this._currentMetadata;
|
90
|
+
const filterLinkLabelMessage = this.getMessage('snkFilterFieldSearch.linkLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
|
91
|
+
const items = links.map(link => (Object.assign({ label: link.description }, link)));
|
92
|
+
this.linkItems = [{
|
93
|
+
group: filterLinkLabelMessage,
|
94
|
+
items,
|
95
|
+
}];
|
96
|
+
if (this.breadcrumbItems.length === 0) {
|
97
|
+
this.breadcrumbItems = [Object.assign({ id: JSUtils.generateUUID(), label: this._currentLink.description }, this._currentLink)];
|
98
|
+
}
|
99
|
+
}
|
100
|
+
mapDataSourceToFieldItems() {
|
101
|
+
var _a;
|
102
|
+
const { fields } = this._currentMetadata;
|
103
|
+
const filterFieldLabelMessage = this.getMessage('snkFilterFieldSearch.fieldLabel', { link: (_a = this._currentLink) === null || _a === void 0 ? void 0 : _a.description });
|
104
|
+
const filteredFields = fields.filter(field => {
|
105
|
+
if (!this._currentLink)
|
106
|
+
return true;
|
107
|
+
const searchableByDescription = field.description.toLowerCase().includes(this._filterText.toLowerCase());
|
108
|
+
const searchableByName = field.name.toLowerCase().includes(this._filterText.toLowerCase());
|
109
|
+
return searchableByDescription || searchableByName;
|
110
|
+
});
|
111
|
+
const items = filteredFields.map(field => (Object.assign({ label: field.description }, field)));
|
112
|
+
this.fieldItems = [{
|
113
|
+
group: filterFieldLabelMessage,
|
114
|
+
items
|
115
|
+
}];
|
116
|
+
}
|
117
|
+
handleFilterChange(filterText) {
|
118
|
+
if (this._isLoading)
|
119
|
+
return;
|
120
|
+
this._filterText = filterText;
|
121
|
+
this.mapDataSourceToFieldItems();
|
122
|
+
}
|
123
|
+
handleSelectLink({ detail: item }) {
|
124
|
+
if (this._isLoading)
|
125
|
+
return;
|
126
|
+
const breadcrumbByIndex = this.breadcrumbItems.findIndex(breadcrumbItem => breadcrumbItem.id === item.id);
|
127
|
+
item.cache = this._filterMetadataStorage.has(item.uri);
|
128
|
+
if (breadcrumbByIndex > -1) {
|
129
|
+
this.breadcrumbItems = this.breadcrumbItems.slice(0, (breadcrumbByIndex + 1));
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
this.breadcrumbItems = [...this.breadcrumbItems, Object.assign({ id: JSUtils.generateUUID(), label: item.description }, item)];
|
133
|
+
}
|
134
|
+
const selectedItem = Object.assign(Object.assign({}, item), { type: SelectedItemType.LINK });
|
135
|
+
this._currentLink = selectedItem;
|
136
|
+
this.ezSelectFilterItem.emit(selectedItem);
|
137
|
+
this.loadData();
|
138
|
+
}
|
139
|
+
handleSelectField({ detail: item }) {
|
140
|
+
var _a;
|
141
|
+
const breadcrumbPath = this.breadcrumbItems.map(breadcrumbItem => breadcrumbItem.label).join('>>');
|
142
|
+
const selectedField = Object.assign(Object.assign({}, item), { type: SelectedItemType.FIELD, path: `${breadcrumbPath} >> ${item.description}` });
|
143
|
+
this.ezSelectFilterItem.emit(selectedField);
|
144
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
|
145
|
+
}
|
146
|
+
getElementID(sufix) {
|
147
|
+
return {
|
148
|
+
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
149
|
+
};
|
150
|
+
}
|
151
|
+
/**
|
152
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
153
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
154
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
155
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-field-search.msg.ts"
|
156
|
+
*/
|
157
|
+
getMessage(key, params) {
|
158
|
+
var _a, _b, _c;
|
159
|
+
if (!this._application)
|
160
|
+
this._application = ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
|
161
|
+
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);
|
162
|
+
}
|
163
|
+
;
|
164
|
+
componentWillLoad() {
|
165
|
+
this._application = ApplicationContext.getContextValue(SNK_CONTEXT_KEY);
|
166
|
+
}
|
167
|
+
componentDidLoad() {
|
168
|
+
ElementIDUtils.addIDInfoIfNotExists(this._ezPopover, 'popover');
|
169
|
+
}
|
170
|
+
disconnectedCallback() {
|
171
|
+
var _a;
|
172
|
+
this._filterMetadataStorage.clear();
|
173
|
+
(_a = this._ezPopover) === null || _a === void 0 ? void 0 : _a.hide();
|
174
|
+
}
|
175
|
+
render() {
|
176
|
+
var _a;
|
177
|
+
const searchLabelMessage = this.getMessage('snkFilterFieldSearch.searchLabel');
|
178
|
+
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')))))));
|
179
|
+
}
|
180
|
+
};
|
181
|
+
SnkFilterFieldSearch.style = snkFilterFieldSearchCss;
|
182
|
+
|
183
|
+
class PersonalizedFilterUtils {
|
184
|
+
/**
|
185
|
+
* Cria uma expressão de filtro a partir de um IExpressionItem.
|
186
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
187
|
+
* @returns Retorna a expressão de filtro.
|
188
|
+
*/
|
189
|
+
static buildFilterExpression(expressionItem) {
|
190
|
+
if (expressionItem == undefined) {
|
191
|
+
return;
|
192
|
+
}
|
193
|
+
const value = this.buildVariableParameterValue(expressionItem);
|
194
|
+
let expression = expressionItem.expression || "";
|
195
|
+
switch (expressionItem.operand) {
|
196
|
+
case FilterOperand.IN:
|
197
|
+
expression += ` ${expressionItem.operand} (${value})`;
|
198
|
+
break;
|
199
|
+
case FilterOperand.NULL:
|
200
|
+
case FilterOperand.NOT_NULL:
|
201
|
+
expression += ` IS ${value}`;
|
202
|
+
break;
|
203
|
+
case FilterOperand.LIKE:
|
204
|
+
expression += ` LIKE '%${value}%'`;
|
205
|
+
break;
|
206
|
+
case FilterOperand.START_WITH:
|
207
|
+
expression += ` LIKE '${value}%'`;
|
208
|
+
break;
|
209
|
+
case FilterOperand.FINISHED_WITH:
|
210
|
+
expression += ` LIKE '%${value}'`;
|
211
|
+
break;
|
212
|
+
default:
|
213
|
+
expression += ` ${expressionItem.operand} ${value}`;
|
214
|
+
}
|
215
|
+
return expression;
|
216
|
+
}
|
217
|
+
/**
|
218
|
+
* Obtém o valor do parâmetro a partir de um IExpressionItem.
|
219
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
220
|
+
* @returns Retorna o valor do parâmetro.
|
221
|
+
*/
|
222
|
+
static buildVariableParameterValue(expressionItem) {
|
223
|
+
if (expressionItem == undefined) {
|
224
|
+
return;
|
225
|
+
}
|
226
|
+
if (expressionItem.systemConfig != undefined) {
|
227
|
+
const systemConfig = expressionItem.systemConfig;
|
228
|
+
return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
|
229
|
+
}
|
230
|
+
if (expressionItem.userConfig != undefined) {
|
231
|
+
const userConfig = expressionItem.userConfig;
|
232
|
+
return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
|
233
|
+
}
|
234
|
+
return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
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)}";
|
239
|
+
|
240
|
+
const SnkFilterParamConfig = class {
|
241
|
+
constructor(hostRef) {
|
242
|
+
registerInstance(this, hostRef);
|
243
|
+
this._opened = false;
|
244
|
+
this._configType = FilterConfigType.SYSTEM_CONFIG;
|
245
|
+
this._expressionItem = undefined;
|
246
|
+
this._informedInstance = false;
|
247
|
+
this._canSave = false;
|
248
|
+
this.messagesBuilder = undefined;
|
249
|
+
}
|
250
|
+
open(expressionItem) {
|
251
|
+
this._opened = true;
|
252
|
+
this._expressionItem = expressionItem;
|
253
|
+
this.loadValues();
|
254
|
+
return new Promise(accept => {
|
255
|
+
this._promiseResolver = accept;
|
256
|
+
});
|
257
|
+
}
|
258
|
+
close() {
|
259
|
+
this._opened = false;
|
260
|
+
return new Promise(accept => {
|
261
|
+
this._promiseResolver = accept;
|
262
|
+
});
|
263
|
+
}
|
264
|
+
/**
|
265
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
266
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
267
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
268
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
|
269
|
+
*/
|
270
|
+
getMessage(key, params) {
|
271
|
+
var _a;
|
272
|
+
return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
|
273
|
+
}
|
274
|
+
getConfigValue(configName, inputName, inputAlias = "") {
|
275
|
+
var _a, _b, _c;
|
276
|
+
return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
|
277
|
+
|| ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
|
278
|
+
}
|
279
|
+
loadValues() {
|
280
|
+
var _a;
|
281
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
282
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
283
|
+
const description = this.getConfigValue("userConfig", "description");
|
284
|
+
const type = this.getConfigValue("userConfig", "type");
|
285
|
+
if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
|
286
|
+
this._configType = FilterConfigType.USER_CONFIG;
|
287
|
+
}
|
288
|
+
else {
|
289
|
+
this._configType = FilterConfigType.SYSTEM_CONFIG;
|
290
|
+
}
|
291
|
+
if (!StringUtils.isEmpty(entityName) && !StringUtils.isEmpty(fieldName)) {
|
292
|
+
this._instanceElement.value = { value: entityName, label: "" };
|
293
|
+
this._fieldElement.value = { value: fieldName, label: "" };
|
294
|
+
}
|
295
|
+
if (!StringUtils.isEmpty(description) && !StringUtils.isEmpty(type)) {
|
296
|
+
this._descriptionElement.value = description;
|
297
|
+
this._typeElement.value = type;
|
298
|
+
}
|
299
|
+
this.buildFilterExpression();
|
300
|
+
}
|
301
|
+
changeDefinitionUsed(option) {
|
302
|
+
this._configType = option !== null && option !== void 0 ? option : FilterConfigType.SYSTEM_CONFIG;
|
303
|
+
if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
|
304
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
305
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
306
|
+
this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
|
307
|
+
this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
|
308
|
+
}
|
309
|
+
else if (this._configType === FilterConfigType.USER_CONFIG) {
|
310
|
+
const description = this.getConfigValue("userConfig", "description");
|
311
|
+
const type = this.getConfigValue("userConfig", "type");
|
312
|
+
this._descriptionElement.value = this._descriptionElement.value || description;
|
313
|
+
this._typeElement.value = this._typeElement.value || type;
|
314
|
+
}
|
315
|
+
this.buildFilterExpression();
|
316
|
+
}
|
317
|
+
getTypeValue() {
|
318
|
+
var _a;
|
319
|
+
const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
|
320
|
+
return ((value === null || value === void 0 ? void 0 : value.value) || value);
|
321
|
+
}
|
322
|
+
getExpressionValues() {
|
323
|
+
var _a, _b, _c, _d, _e;
|
324
|
+
let systemConfig;
|
325
|
+
let userConfig;
|
326
|
+
if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
|
327
|
+
const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
328
|
+
const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
|
329
|
+
systemConfig = { entity, fieldName };
|
330
|
+
}
|
331
|
+
else if (this._configType === FilterConfigType.USER_CONFIG) {
|
332
|
+
const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
|
333
|
+
const type = this.getTypeValue();
|
334
|
+
userConfig = { description, type };
|
335
|
+
}
|
336
|
+
return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
|
337
|
+
}
|
338
|
+
isEnabled(value) {
|
339
|
+
return this._configType === value;
|
340
|
+
}
|
341
|
+
isInformedInstance() {
|
342
|
+
var _a, _b;
|
343
|
+
return !StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
|
344
|
+
}
|
345
|
+
save() {
|
346
|
+
var _a;
|
347
|
+
this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
|
348
|
+
this._promiseResolver(this._expressionItem);
|
349
|
+
this._opened = false;
|
350
|
+
}
|
351
|
+
buildFilterExpression() {
|
352
|
+
var _a;
|
353
|
+
this._informedInstance = this.isInformedInstance();
|
354
|
+
const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
|
355
|
+
this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
|
356
|
+
this._canSave = this.getCanSave();
|
357
|
+
}
|
358
|
+
handleChangeInstance() {
|
359
|
+
this._informedInstance = this.isInformedInstance();
|
360
|
+
if (this._fieldElement != undefined && !StringUtils.isEmpty(this._fieldElement.value)) {
|
361
|
+
this._fieldElement.value = null;
|
362
|
+
}
|
363
|
+
this.buildFilterExpression();
|
364
|
+
}
|
365
|
+
getInstanceCriteria() {
|
366
|
+
var _a, _b;
|
367
|
+
const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
368
|
+
return {
|
369
|
+
expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
|
370
|
+
params: [
|
371
|
+
{
|
372
|
+
name: "NOMEINSTANCIA",
|
373
|
+
dataType: DataType.TEXT,
|
374
|
+
value
|
375
|
+
}
|
376
|
+
]
|
377
|
+
};
|
378
|
+
}
|
379
|
+
onSearch({ mode, argument }, entity) {
|
380
|
+
if (this._application == undefined) {
|
381
|
+
return;
|
382
|
+
}
|
383
|
+
const isField = entity === FilterEntities.FIELD;
|
384
|
+
const criteria = isField ? this.getInstanceCriteria() : undefined;
|
385
|
+
const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
|
386
|
+
const entityDescription = this.getMessage(messageKey);
|
387
|
+
const searchOptions = {
|
388
|
+
descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
|
389
|
+
codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
|
390
|
+
showInactives: false
|
391
|
+
};
|
392
|
+
const options = {
|
393
|
+
entity,
|
394
|
+
entityDescription,
|
395
|
+
criteria,
|
396
|
+
searchOptions
|
397
|
+
};
|
398
|
+
return this._application.executePreparedSearch(mode, argument, options);
|
399
|
+
}
|
400
|
+
getElementID(sufix) {
|
401
|
+
return {
|
402
|
+
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
403
|
+
};
|
404
|
+
}
|
405
|
+
getCanSave() {
|
406
|
+
var _a;
|
407
|
+
if (this._configType === FilterConfigType.USER_CONFIG) {
|
408
|
+
const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
|
409
|
+
const type = this.getTypeValue();
|
410
|
+
return !StringUtils.isEmpty(description) && !StringUtils.isEmpty(type);
|
411
|
+
}
|
412
|
+
return true;
|
413
|
+
}
|
414
|
+
componentWillLoad() {
|
415
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
416
|
+
}
|
417
|
+
render() {
|
418
|
+
ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
|
419
|
+
return (h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
|
420
|
+
if (evt.detail === ModalAction.CLOSE)
|
421
|
+
this.close();
|
422
|
+
}, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), h("div", { class: "ez-flex" }, h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: FilterConfigType.SYSTEM_CONFIG })), h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.FIELD) }, this.getElementID("configFindField")))), h("div", { class: "ez-flex ez-padding--medium" }, h("hr", { class: "ez-divider-vertical" })), h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: FilterConfigType.USER_CONFIG })), h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(FilterUserConfigTypes).map((configType) => {
|
423
|
+
return (h("option", { value: FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
|
424
|
+
})))), 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"))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
|
425
|
+
}
|
426
|
+
get _element() { return getElement(this); }
|
427
|
+
};
|
428
|
+
SnkFilterParamConfig.style = snkFilterParamConfigCss;
|
429
|
+
|
430
|
+
export { SnkFilterFieldSearch as snk_filter_field_search, SnkFilterParamConfig as snk_filter_param_config };
|