@sankhyalabs/sankhyablocks 1.4.0-beta.1 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-7717f1e4.js → SnkMessageBuilder-d8215915.js} +14 -119
- package/dist/cjs/{filter-item-type.enum-e2e1bc5b.js → filter-item-type.enum-3daf58d3.js} +2 -0
- package/dist/cjs/index-84fe3b86.js +20 -0
- package/dist/cjs/index-93965c41.js +141 -0
- package/dist/cjs/{index-02201bc9.js → index-e90ae303.js} +11 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +43 -25
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +10 -18
- package/dist/cjs/snk-filter-bar.cjs.entry.js +334 -146
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +37 -2
- package/dist/cjs/snk-filter-item.cjs.entry.js +34 -11
- package/dist/cjs/snk-filter-list.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-modal.cjs.entry.js +37 -0
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +89 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +2 -2
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-grid.cjs.entry.js +1 -1
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-taskbar.cjs.entry.js +1 -1
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/snk-application/snk-application.js +54 -7
- package/dist/collection/components/snk-crud/snk-crud.js +2 -4
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -27
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +100 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +161 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +2 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +36 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +32 -9
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +196 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +22 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +238 -139
- package/dist/collection/components/snk-grid/snk-grid.js +2 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +18 -10
- package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +14 -2
- package/dist/components/SnkMessageBuilder.js +15 -119
- package/dist/components/filter-item-type.enum.js +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index2.js +11 -1
- package/dist/components/index3.js +139 -0
- package/dist/components/snk-application2.js +39 -19
- package/dist/components/snk-crud.js +15 -9
- package/dist/components/snk-data-unit.js +2 -11
- package/dist/components/snk-filter-bar2.js +340 -146
- package/dist/components/snk-filter-detail2.js +36 -1
- package/dist/components/snk-filter-item2.js +32 -9
- package/dist/components/snk-filter-list2.js +1 -1
- package/dist/components/snk-filter-modal.d.ts +11 -0
- package/dist/components/snk-filter-modal.js +6 -0
- package/dist/components/snk-filter-modal2.js +73 -0
- package/dist/components/snk-filter-personalized.d.ts +11 -0
- package/dist/components/snk-filter-personalized.js +107 -0
- package/dist/components/snk-grid2.js +15 -9
- package/dist/{sankhyablocks/SnkMessageBuilder-a7da466b.js → esm/SnkMessageBuilder-35a20271.js} +15 -119
- package/dist/esm/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
- package/dist/esm/index-5992b7e6.js +139 -0
- package/dist/esm/{index-f1d3e4da.js → index-c683b2b0.js} +11 -1
- package/dist/esm/index-c71285cb.js +17 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +37 -19
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-data-unit.entry.js +3 -11
- package/dist/esm/snk-filter-bar.entry.js +328 -140
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-detail.entry.js +37 -2
- package/dist/esm/snk-filter-item.entry.js +34 -11
- package/dist/esm/snk-filter-list.entry.js +1 -1
- package/dist/esm/snk-filter-modal.entry.js +33 -0
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-filter-period.entry.js +1 -1
- package/dist/esm/snk-filter-personalized.entry.js +85 -0
- package/dist/esm/snk-filter-search.entry.js +2 -2
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-grid.entry.js +1 -1
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +1 -1
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/{esm/SnkMessageBuilder-a7da466b.js → sankhyablocks/SnkMessageBuilder-35a20271.js} +15 -119
- package/dist/sankhyablocks/{filter-item-type.enum-61fbf80a.js → filter-item-type.enum-a79b2fa8.js} +2 -0
- package/dist/sankhyablocks/index-5992b7e6.js +139 -0
- package/dist/sankhyablocks/{index-f1d3e4da.js → index-c683b2b0.js} +11 -1
- package/dist/sankhyablocks/index-c71285cb.js +17 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/sankhyablocks/snk-application.entry.js +37 -19
- package/dist/sankhyablocks/snk-crud.entry.js +1 -1
- package/dist/sankhyablocks/snk-data-unit.entry.js +3 -11
- package/dist/sankhyablocks/snk-filter-bar.entry.js +328 -140
- package/dist/sankhyablocks/snk-filter-binary-select.entry.js +1 -1
- package/dist/sankhyablocks/snk-filter-detail.entry.js +37 -2
- package/dist/sankhyablocks/snk-filter-item.entry.js +34 -11
- package/dist/sankhyablocks/snk-filter-list.entry.js +1 -1
- package/dist/sankhyablocks/snk-filter-modal.entry.js +33 -0
- package/dist/sankhyablocks/snk-filter-multi-select.entry.js +1 -1
- package/dist/sankhyablocks/snk-filter-number.entry.js +1 -1
- package/dist/sankhyablocks/snk-filter-period.entry.js +1 -1
- package/dist/sankhyablocks/snk-filter-personalized.entry.js +85 -0
- package/dist/sankhyablocks/snk-filter-search.entry.js +2 -2
- package/dist/sankhyablocks/snk-form.entry.js +1 -1
- package/dist/sankhyablocks/snk-grid.entry.js +1 -1
- package/dist/sankhyablocks/snk-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/snk-taskbar.entry.js +1 -1
- package/dist/sankhyablocks/teste-pesquisa.entry.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +4 -1
- package/dist/types/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +23 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +3 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +23 -0
- package/dist/types/components.d.ts +56 -8
- package/package.json +3 -3
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +0 -51
|
@@ -1,8 +1,106 @@
|
|
|
1
1
|
import { r as registerInstance, h, f as Host, g as getElement } from './index-2b4d2d14.js';
|
|
2
|
-
import { b as DataType,
|
|
3
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
|
2
|
+
import { t as toString, b as DataType, O as ObjectUtils, S as StringUtils, E as ErrorException, A as ApplicationContext } from './index-c683b2b0.js';
|
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
4
|
+
import { M as ModalAction } from './index-c71285cb.js';
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const buildFilter = (item) => {
|
|
7
|
+
switch (item.type) {
|
|
8
|
+
case FilterItemType.DEFAULT_FILTER:
|
|
9
|
+
return buildDefault(item);
|
|
10
|
+
case FilterItemType.BINARY_SELECT:
|
|
11
|
+
return buildBinary(item);
|
|
12
|
+
case FilterItemType.MULTI_SELECT:
|
|
13
|
+
return buildMultSelect(item);
|
|
14
|
+
case FilterItemType.PERIOD:
|
|
15
|
+
return buildPeriod(item);
|
|
16
|
+
case FilterItemType.SEARCH:
|
|
17
|
+
return buildSearch(item);
|
|
18
|
+
case FilterItemType.TEXT:
|
|
19
|
+
return buildText(item);
|
|
20
|
+
case FilterItemType.NUMBER:
|
|
21
|
+
return buildNumber(item);
|
|
22
|
+
case FilterItemType.PERSONALIZED:
|
|
23
|
+
return buildPersonalized(item);
|
|
24
|
+
default:
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function buildDefault(item) {
|
|
29
|
+
return { name: item.id, expression: item.props.expression, params: [] };
|
|
30
|
+
}
|
|
31
|
+
function buildBinary(item) {
|
|
32
|
+
const { id, value, props } = item;
|
|
33
|
+
const options = props.options;
|
|
34
|
+
const selectedOption = options.find(opt => opt.name === value);
|
|
35
|
+
return { name: id, expression: selectedOption.expression, params: [] };
|
|
36
|
+
}
|
|
37
|
+
function buildMultSelect(item) {
|
|
38
|
+
const { id, value, props } = item;
|
|
39
|
+
return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
|
|
40
|
+
}
|
|
41
|
+
function buildPeriod(item) {
|
|
42
|
+
const { id, value, props } = item;
|
|
43
|
+
let { end, start } = value;
|
|
44
|
+
if (typeof end === "string") {
|
|
45
|
+
end = new Date(end);
|
|
46
|
+
}
|
|
47
|
+
if (typeof start === "string") {
|
|
48
|
+
start = new Date(start);
|
|
49
|
+
}
|
|
50
|
+
const params = [];
|
|
51
|
+
let expression;
|
|
52
|
+
if (end && start) {
|
|
53
|
+
expression = props.expression.fullfill;
|
|
54
|
+
params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
if (start) {
|
|
58
|
+
expression = props.expression.onlystart;
|
|
59
|
+
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
expression = props.expression.onlyend;
|
|
63
|
+
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return { name: id, expression, params };
|
|
67
|
+
}
|
|
68
|
+
function buildSearch(item) {
|
|
69
|
+
const { id, value, props } = item;
|
|
70
|
+
const expression = props.expression;
|
|
71
|
+
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
|
72
|
+
}
|
|
73
|
+
function buildText(item) {
|
|
74
|
+
const { id, value, props } = item;
|
|
75
|
+
const expression = props.expression;
|
|
76
|
+
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
|
77
|
+
}
|
|
78
|
+
function buildNumber(item) {
|
|
79
|
+
const { id, value, props } = item;
|
|
80
|
+
const expression = props.expression;
|
|
81
|
+
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
|
82
|
+
}
|
|
83
|
+
function buildPersonalized(item) {
|
|
84
|
+
var _a;
|
|
85
|
+
const { id, value, props } = item;
|
|
86
|
+
const expression = props.expression;
|
|
87
|
+
return {
|
|
88
|
+
name: id, expression, params: (((_a = props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || []).map((param, index) => {
|
|
89
|
+
const valuesArray = Array.from(value);
|
|
90
|
+
const dataType = param.dataType;
|
|
91
|
+
let paramValue = (index >= 0 && index < valuesArray.length ? valuesArray[index] : null);
|
|
92
|
+
if (paramValue != undefined && typeof paramValue === "object" && "value" in paramValue) {
|
|
93
|
+
paramValue = paramValue["value"];
|
|
94
|
+
}
|
|
95
|
+
if (paramValue == undefined && dataType === DataType.BOOLEAN) {
|
|
96
|
+
paramValue = false;
|
|
97
|
+
}
|
|
98
|
+
return { name: param.name, dataType, value: typeof paramValue === "string" ? paramValue : toString(dataType, paramValue) };
|
|
99
|
+
})
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 1);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;flex-grow:0}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px)}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.preselected.sc-snk-filter-bar{background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{display:flex;flex-direction:row;border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium);width:100%}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:100%;height:100%}";
|
|
6
104
|
|
|
7
105
|
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
8
106
|
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
@@ -11,6 +109,9 @@ const SnkFilterBar = class {
|
|
|
11
109
|
constructor(hostRef) {
|
|
12
110
|
registerInstance(this, hostRef);
|
|
13
111
|
this._updateSequence = [];
|
|
112
|
+
this._loadingPending = false;
|
|
113
|
+
this._configUpdated = false;
|
|
114
|
+
this._pendingFilters = [];
|
|
14
115
|
this._calculateSortIndex = (item) => {
|
|
15
116
|
let index = item.hardFixed ? 1000000 : 0;
|
|
16
117
|
//campos Hard Fixed não variam a ordem
|
|
@@ -25,6 +126,54 @@ const SnkFilterBar = class {
|
|
|
25
126
|
return this._calculateSortIndex(b) - this._calculateSortIndex(a);
|
|
26
127
|
};
|
|
27
128
|
}
|
|
129
|
+
observeFilterConfig(newValue, oldValue) {
|
|
130
|
+
if (oldValue != undefined && newValue == undefined) {
|
|
131
|
+
this._loadingPending = true;
|
|
132
|
+
this._configUpdated = true;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const oldItems = new Map(oldValue ? oldValue.map(item => [item.id, item]) : undefined);
|
|
136
|
+
newValue.forEach(newItem => {
|
|
137
|
+
const oldItem = oldItems.get(newItem.id);
|
|
138
|
+
if (oldItem != undefined) {
|
|
139
|
+
this._configUpdated = this._configUpdated || ObjectUtils.objectToString(oldItem) != ObjectUtils.objectToString(newItem);
|
|
140
|
+
this._loadingPending = this._loadingPending || ObjectUtils.objectToString(oldItem.value) !== ObjectUtils.objectToString(newItem.value);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this._configUpdated = true;
|
|
144
|
+
this._loadingPending = this._loadingPending || newItem.value != undefined;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
this.processAfterUpdateConfig();
|
|
149
|
+
}
|
|
150
|
+
processPendingFilter() {
|
|
151
|
+
if (this._pendingFilters.length > 0 && this._currentPendingFilter == undefined) {
|
|
152
|
+
this._currentPendingFilter = this._element.querySelector("#filter-" + this._pendingFilters.pop());
|
|
153
|
+
if (this._currentPendingFilter) {
|
|
154
|
+
this._currentPendingFilter.showUp(true).then(() => {
|
|
155
|
+
this._currentPendingFilter = undefined;
|
|
156
|
+
this.processPendingFilter();
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (this._currentPendingFilter == undefined) {
|
|
161
|
+
this.processAfterUpdateConfig();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
processAfterUpdateConfig() {
|
|
165
|
+
if (this._pendingFilters.length > 0) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (this._loadingPending) {
|
|
169
|
+
this._loadingPending = false;
|
|
170
|
+
this.dataUnit.loadData();
|
|
171
|
+
}
|
|
172
|
+
if (this._configUpdated) {
|
|
173
|
+
this._configUpdated = false;
|
|
174
|
+
this._application.saveFilterBarConfig(this.filterConfig, this.configName);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
28
177
|
/**
|
|
29
178
|
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
30
179
|
* através de um pequeno modulo na estrutura da aplicação:
|
|
@@ -37,101 +186,21 @@ const SnkFilterBar = class {
|
|
|
37
186
|
getFilter(_dataUnit) {
|
|
38
187
|
var _a;
|
|
39
188
|
const filters = [];
|
|
40
|
-
(_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => item
|
|
41
|
-
const filter =
|
|
189
|
+
(_a = this.filterConfig) === null || _a === void 0 ? void 0 : _a.filter(item => this.isActiveFilter(item)).forEach(item => {
|
|
190
|
+
const filter = buildFilter(item);
|
|
42
191
|
if (filter) {
|
|
43
192
|
filters.push(filter);
|
|
44
193
|
}
|
|
45
194
|
});
|
|
46
195
|
return filters;
|
|
47
196
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (value && visible) {
|
|
51
|
-
if (type === FilterItemType.BINARY_SELECT) {
|
|
52
|
-
const options = props.options;
|
|
53
|
-
const selectedOption = options.find(opt => opt.name === value);
|
|
54
|
-
//FIXME: ajustar o backend para não exigir parametros
|
|
55
|
-
return { name: id, expression: selectedOption.expression, params: [] };
|
|
56
|
-
}
|
|
57
|
-
if (type === FilterItemType.MULTI_SELECT) {
|
|
58
|
-
return { name: id, expression: props.expression, params: [{ name: id, dataType: DataType.TEXT, value }] };
|
|
59
|
-
}
|
|
60
|
-
if (type === FilterItemType.PERIOD) {
|
|
61
|
-
let { end, start } = value;
|
|
62
|
-
if (typeof end === "string") {
|
|
63
|
-
end = new Date(end);
|
|
64
|
-
}
|
|
65
|
-
if (typeof start === "string") {
|
|
66
|
-
start = new Date(start);
|
|
67
|
-
}
|
|
68
|
-
const params = [];
|
|
69
|
-
let expression;
|
|
70
|
-
if (end && start) {
|
|
71
|
-
expression = props.expression.fullfill;
|
|
72
|
-
params.push({ name: `${id}.START`, dataType: DataType.DATE, value: toString(DataType.DATE, start) }, { name: `${id}.END`, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (start) {
|
|
76
|
-
expression = props.expression.onlystart;
|
|
77
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, start) });
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
expression = props.expression.onlyend;
|
|
81
|
-
params.push({ name: id, dataType: DataType.DATE, value: toString(DataType.DATE, end) });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return { name: id, expression, params };
|
|
85
|
-
}
|
|
86
|
-
if (type === FilterItemType.SEARCH) {
|
|
87
|
-
const expression = props.expression;
|
|
88
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value.value) }] };
|
|
89
|
-
}
|
|
90
|
-
if (type === FilterItemType.TEXT) {
|
|
91
|
-
const expression = props.expression;
|
|
92
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.TEXT, value: toString(DataType.TEXT, value) }] };
|
|
93
|
-
}
|
|
94
|
-
if (type === FilterItemType.NUMBER) {
|
|
95
|
-
const expression = props.expression;
|
|
96
|
-
return { name: id, expression, params: [{ name: id, dataType: DataType.NUMBER, value: toString(DataType.NUMBER, value) }] };
|
|
97
|
-
}
|
|
98
|
-
//No mapeamento dos outros tipos precisamos saber o tipo de dado.
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
197
|
+
isActiveFilter(item) {
|
|
198
|
+
return (item.visible && item.value != undefined) || item.type === FilterItemType.DEFAULT_FILTER;
|
|
101
199
|
}
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
if (this.
|
|
105
|
-
this.
|
|
106
|
-
.then((filters) => {
|
|
107
|
-
this.filterConfig = filters;
|
|
108
|
-
})
|
|
109
|
-
.catch(reason => {
|
|
110
|
-
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if (this.dataUnit == undefined) {
|
|
114
|
-
let parent = this._element.parentElement;
|
|
115
|
-
while (parent) {
|
|
116
|
-
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
117
|
-
const snkDataUnit = parent;
|
|
118
|
-
this.dataUnit = snkDataUnit.dataUnit;
|
|
119
|
-
if (this.dataUnit) {
|
|
120
|
-
this.dataUnit.addFilterProvider(this);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
124
|
-
this.dataUnit = evt.detail;
|
|
125
|
-
this.dataUnit.addFilterProvider(this);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
parent = parent.parentElement;
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.dataUnit.addFilterProvider(this);
|
|
200
|
+
registryFilterProvider() {
|
|
201
|
+
this.dataUnit.addFilterProvider(this);
|
|
202
|
+
if (this.filterConfig) {
|
|
203
|
+
this.dataUnit.loadData();
|
|
135
204
|
}
|
|
136
205
|
}
|
|
137
206
|
getFilterItems() {
|
|
@@ -139,9 +208,8 @@ const SnkFilterBar = class {
|
|
|
139
208
|
const unpinnedItems = [];
|
|
140
209
|
this.filterConfig
|
|
141
210
|
.filter(item => item.visible)
|
|
142
|
-
.sort((a, b) => this._filtersComparator(a, b))
|
|
143
211
|
.forEach((item, index) => {
|
|
144
|
-
const filterItem = (h("snk-filter-item", { id: `filter-${item.id}`, config:
|
|
212
|
+
const filterItem = (h("snk-filter-item", { id: `filter-${item.id}`, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
|
145
213
|
if (item.fixed || item.hardFixed) {
|
|
146
214
|
pinnedItems.push(filterItem);
|
|
147
215
|
}
|
|
@@ -164,9 +232,6 @@ const SnkFilterBar = class {
|
|
|
164
232
|
this._updateSequence.push(item.id);
|
|
165
233
|
}
|
|
166
234
|
}
|
|
167
|
-
filterChangeListener(evt) {
|
|
168
|
-
this.updateFilter(evt.detail);
|
|
169
|
-
}
|
|
170
235
|
normalizeItem(item) {
|
|
171
236
|
const normalized = Object.assign({}, item);
|
|
172
237
|
const optionals = ["props", "value", "hardFixed", "fixed"];
|
|
@@ -180,87 +245,207 @@ const SnkFilterBar = class {
|
|
|
180
245
|
}
|
|
181
246
|
return normalized;
|
|
182
247
|
}
|
|
183
|
-
updateFilter(newItem
|
|
184
|
-
let needLoad = false;
|
|
185
|
-
let updated = false;
|
|
248
|
+
updateFilter(newItem) {
|
|
186
249
|
this.filterConfig = this.filterConfig.map(item => {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
return Object.assign(Object.assign({}, item), { value: undefined });
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
if (item.id === newItem.id) {
|
|
196
|
-
const normalizedOne = this.normalizeItem(item);
|
|
197
|
-
const normalizedTwo = this.normalizeItem(newItem);
|
|
198
|
-
updated = ObjectUtils.objectToString(normalizedOne) != ObjectUtils.objectToString(normalizedTwo);
|
|
199
|
-
needLoad = ObjectUtils.objectToString(normalizedOne.value) !== ObjectUtils.objectToString(normalizedTwo.value);
|
|
200
|
-
return newItem;
|
|
250
|
+
newItem = this.normalizeItem(newItem);
|
|
251
|
+
if (item.id === newItem.id) {
|
|
252
|
+
if (ObjectUtils.objectToString(item) != ObjectUtils.objectToString(newItem)) {
|
|
253
|
+
this.calculateUpdateSequence(newItem);
|
|
201
254
|
}
|
|
255
|
+
return newItem;
|
|
202
256
|
}
|
|
203
257
|
return item;
|
|
204
|
-
});
|
|
205
|
-
if (needLoad) {
|
|
206
|
-
this.dataUnit.loadData();
|
|
207
|
-
}
|
|
208
|
-
if (updated) {
|
|
209
|
-
this.calculateUpdateSequence(newItem);
|
|
210
|
-
this._application.saveFilterBarConfig(this.filterConfig, this.configName);
|
|
211
|
-
}
|
|
212
|
-
return needLoad;
|
|
258
|
+
}).sort((a, b) => this._filtersComparator(a, b));
|
|
213
259
|
}
|
|
214
260
|
getAddListItems() {
|
|
215
261
|
const hiddenItems = this.filterConfig
|
|
216
|
-
.filter(item => !item.visible)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
]);
|
|
262
|
+
.filter(item => !item.visible && this.isListable(item));
|
|
263
|
+
const footerItems = [{ name: PERSONALIZED_FILTER, label: this.getMessage("snkFilterBar.customFilter"), iconName: "tune", kind: "FOOTER" }];
|
|
264
|
+
if (this.allowDefault) {
|
|
265
|
+
footerItems.push({ name: DEFAULT_FILTER, label: this.getMessage("snkFilterBar.defaultFilter"), iconName: "configuration", kind: "FOOTER" });
|
|
266
|
+
}
|
|
267
|
+
return hiddenItems.map(filter => { return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null }; })
|
|
268
|
+
.concat(footerItems);
|
|
224
269
|
}
|
|
225
270
|
getActiveClass() {
|
|
226
271
|
const filterApplied = this.filterConfig.filter(item => item.value != undefined).length > 0;
|
|
227
272
|
return filterApplied ? "sc-snk-filter-bar snk-filter-bar__filter-list-items-button--active" : "";
|
|
228
273
|
}
|
|
274
|
+
isListable(item, allowPersonalized = false) {
|
|
275
|
+
return item.type !== FilterItemType.DEFAULT_FILTER && (allowPersonalized || item.type !== FilterItemType.PERSONALIZED);
|
|
276
|
+
}
|
|
229
277
|
getAppliedListItems() {
|
|
230
278
|
const appliedItems = this.filterConfig
|
|
231
|
-
.filter(item => item.
|
|
232
|
-
.sort(this._filtersComparator);
|
|
279
|
+
.filter(item => this.isActiveFilter(item) && this.isListable(item, true));
|
|
233
280
|
return appliedItems.map(filter => {
|
|
234
281
|
return { name: filter.id, label: filter.label, kind: "FILTER", iconName: null };
|
|
235
282
|
}).concat([
|
|
236
283
|
{ name: CLEAR_ALL_FILTERS, label: this.getMessage("snkFilterBar.clearAllFilters"), iconName: "cleaning", kind: "FOOTER" }
|
|
237
284
|
]);
|
|
238
285
|
}
|
|
286
|
+
addPersonalizedFilters(personalizedItems) {
|
|
287
|
+
const activeFilters = {};
|
|
288
|
+
personalizedItems.forEach(item => {
|
|
289
|
+
if (item.active) {
|
|
290
|
+
activeFilters[item.id] = true;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
this.filterConfig = this.filterConfig.map(item => {
|
|
294
|
+
var _a, _b;
|
|
295
|
+
if (item.type === FilterItemType.PERSONALIZED) {
|
|
296
|
+
const visible = activeFilters[item.id];
|
|
297
|
+
if (!item.visible && visible) {
|
|
298
|
+
this.calculateUpdateSequence(item);
|
|
299
|
+
if (((_b = (_a = item.props) === null || _a === void 0 ? void 0 : _a.personalizedFilter) === null || _b === void 0 ? void 0 : _b.parameters) != undefined) {
|
|
300
|
+
this._pendingFilters.push(item.id);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return this.normalizeItem(visible ? Object.assign(Object.assign({}, item), { visible }) : Object.assign(Object.assign({}, item), { visible, value: undefined, fixed: undefined }));
|
|
304
|
+
}
|
|
305
|
+
return item;
|
|
306
|
+
}).sort((a, b) => this._filtersComparator(a, b));
|
|
307
|
+
}
|
|
308
|
+
openDefaultFilterModal() {
|
|
309
|
+
const filterModal = document.createElement("snk-filter-modal");
|
|
310
|
+
const defaultFilter = this.filterConfig.filter(item => item.type === FilterItemType.DEFAULT_FILTER);
|
|
311
|
+
filterModal.getMessage = (key, props) => this.getMessage(key, props);
|
|
312
|
+
filterModal.modalTitle = this.getMessage("snkFilterBar.modalDefaultFilterTitle");
|
|
313
|
+
filterModal.infoText = this.getMessage(defaultFilter.length == 0 ? "snkFilterBar.modalInfoTextCreateDefault" : "snkFilterBar.modalInfoTextEditDefault");
|
|
314
|
+
filterModal.items = defaultFilter.map(item => {
|
|
315
|
+
return { id: item.id, active: true, enabled: false, label: item.label };
|
|
316
|
+
});
|
|
317
|
+
filterModal.processModalAction = (_action) => {
|
|
318
|
+
this._application.closeModal();
|
|
319
|
+
};
|
|
320
|
+
this._application.showModal(filterModal);
|
|
321
|
+
}
|
|
322
|
+
openPersonalizedModal() {
|
|
323
|
+
const filterModal = document.createElement("snk-filter-modal");
|
|
324
|
+
const personalizedFilter = this.filterConfig
|
|
325
|
+
.filter(item => item.type === FilterItemType.PERSONALIZED)
|
|
326
|
+
.sort((itemA, itemB) => StringUtils.compare(itemA.label, itemB.label));
|
|
327
|
+
filterModal.getMessage = (key, props) => this.getMessage(key, props);
|
|
328
|
+
filterModal.modalTitle = this.getMessage("snkFilterBar.modalPersonalizedFilterTitle");
|
|
329
|
+
filterModal.modalSubTitle = this.getMessage("snkFilterBar.modalPersonalizedFilterSubTitle");
|
|
330
|
+
filterModal.okButtonLabel = this.getMessage("snkFilterBar.modalOkButtonLabel");
|
|
331
|
+
filterModal.cancelButtonLabel = this.getMessage("snkFilterBar.modalCancelButtonLabel");
|
|
332
|
+
filterModal.infoText = this.getMessage("snkFilterBar.modalInfoTextCreateEditPersonalized");
|
|
333
|
+
filterModal.useSearch = true;
|
|
334
|
+
filterModal.items = personalizedFilter.map(item => {
|
|
335
|
+
return { id: item.id, active: item.visible, enabled: true, label: item.label };
|
|
336
|
+
});
|
|
337
|
+
filterModal.processModalAction = (action) => {
|
|
338
|
+
if (action === ModalAction.CANCEL) {
|
|
339
|
+
// O Botão de cancelar, tem efeito específico:
|
|
340
|
+
// - Desmarcar todos os filtros personalizados.
|
|
341
|
+
filterModal.items = filterModal.items.map(item => {
|
|
342
|
+
return Object.assign(Object.assign({}, item), { active: false });
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
if (action === ModalAction.OK) {
|
|
347
|
+
this.addPersonalizedFilters(filterModal.items);
|
|
348
|
+
}
|
|
349
|
+
this._application.closeModal();
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
this._application.showModal(filterModal);
|
|
353
|
+
}
|
|
354
|
+
clearFilters() {
|
|
355
|
+
let changed = false;
|
|
356
|
+
this.filterConfig = this.filterConfig.map(item => {
|
|
357
|
+
if (item.value != undefined) {
|
|
358
|
+
changed = true;
|
|
359
|
+
}
|
|
360
|
+
return Object.assign(Object.assign({}, item), { value: undefined });
|
|
361
|
+
}).sort((a, b) => this._filtersComparator(a, b));
|
|
362
|
+
return changed;
|
|
363
|
+
}
|
|
364
|
+
loadPermitions() {
|
|
365
|
+
this._application.isUserSup().then(value => this.allowDefault = value);
|
|
366
|
+
}
|
|
367
|
+
loadConfigFromApplication() {
|
|
368
|
+
this._application.getFilterBarConfig(this.configName)
|
|
369
|
+
.then((filters) => {
|
|
370
|
+
this.filterConfig = filters.map(item => this.normalizeItem(item));
|
|
371
|
+
if (this.dataUnit) {
|
|
372
|
+
this.dataUnit.loadData();
|
|
373
|
+
}
|
|
374
|
+
})
|
|
375
|
+
.catch(reason => {
|
|
376
|
+
throw new ErrorException(this.getMessage("snkFilterBar.failToLoadConfig"), reason);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
attachDataUnit() {
|
|
380
|
+
if (this.dataUnit == undefined) {
|
|
381
|
+
let parent = this._element.parentElement;
|
|
382
|
+
while (parent) {
|
|
383
|
+
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
384
|
+
const snkDataUnit = parent;
|
|
385
|
+
this.dataUnit = snkDataUnit.dataUnit;
|
|
386
|
+
if (this.dataUnit) {
|
|
387
|
+
this.registryFilterProvider();
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
|
391
|
+
this.dataUnit = evt.detail;
|
|
392
|
+
this.registryFilterProvider();
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
parent = parent.parentElement;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
this.registryFilterProvider();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
filterChangeListener(evt) {
|
|
405
|
+
this.updateFilter(evt.detail);
|
|
406
|
+
}
|
|
239
407
|
addFilterHandler(itemName) {
|
|
240
408
|
const filterItem = this.filterConfig.find(currentFilter => currentFilter.id === itemName);
|
|
241
|
-
if (
|
|
409
|
+
if (itemName === PERSONALIZED_FILTER) {
|
|
410
|
+
this.openPersonalizedModal();
|
|
411
|
+
}
|
|
412
|
+
else if (itemName === DEFAULT_FILTER) {
|
|
413
|
+
this.openDefaultFilterModal();
|
|
414
|
+
}
|
|
415
|
+
else if (filterItem) {
|
|
242
416
|
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
243
417
|
window.requestAnimationFrame(() => {
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
|
|
418
|
+
const filterItemElement = this._element.querySelector("#filter-" + itemName);
|
|
419
|
+
if (filterItemElement) {
|
|
420
|
+
filterItemElement.showUp();
|
|
247
421
|
}
|
|
248
422
|
});
|
|
249
423
|
}
|
|
250
424
|
}
|
|
251
425
|
appliedFilterHandler(itemName) {
|
|
252
426
|
if (itemName === CLEAR_ALL_FILTERS) {
|
|
253
|
-
if (this.
|
|
427
|
+
if (this.clearFilters()) {
|
|
254
428
|
this._application.info(this.getMessage("snkFilterBar.successfullyCleaned"), { iconName: "check" });
|
|
255
429
|
}
|
|
256
430
|
}
|
|
257
431
|
else {
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
260
|
-
|
|
432
|
+
const filterItemElement = this._element.querySelector("#filter-" + itemName);
|
|
433
|
+
if (filterItemElement) {
|
|
434
|
+
filterItemElement.showUp(true);
|
|
261
435
|
}
|
|
262
436
|
}
|
|
263
437
|
}
|
|
438
|
+
componentWillLoad() {
|
|
439
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
440
|
+
if (this._application) {
|
|
441
|
+
this.loadPermitions();
|
|
442
|
+
this.loadConfigFromApplication();
|
|
443
|
+
}
|
|
444
|
+
this.attachDataUnit();
|
|
445
|
+
}
|
|
446
|
+
componentDidRender() {
|
|
447
|
+
this.processPendingFilter();
|
|
448
|
+
}
|
|
264
449
|
render() {
|
|
265
450
|
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
266
451
|
return undefined;
|
|
@@ -268,6 +453,9 @@ const SnkFilterBar = class {
|
|
|
268
453
|
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
269
454
|
}
|
|
270
455
|
get _element() { return getElement(this); }
|
|
456
|
+
static get watchers() { return {
|
|
457
|
+
"filterConfig": ["observeFilterConfig"]
|
|
458
|
+
}; }
|
|
271
459
|
};
|
|
272
460
|
SnkFilterBar.style = snkFilterBarCss;
|
|
273
461
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, f as Host } from './index-2b4d2d14.js';
|
|
2
|
-
import { F as FilterItemType } from './filter-item-type.enum-
|
|
2
|
+
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
3
3
|
|
|
4
4
|
const SnkFilterBinarySelect = class {
|
|
5
5
|
constructor(hostRef) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, e as createEvent, h, f as Host } from './index-2b4d2d14.js';
|
|
2
|
-
import {
|
|
2
|
+
import { A as ApplicationUtils } from './index-5992b7e6.js';
|
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
3
4
|
|
|
4
5
|
const SnkFilterDetail = class {
|
|
5
6
|
constructor(hostRef) {
|
|
@@ -21,6 +22,8 @@ const SnkFilterDetail = class {
|
|
|
21
22
|
return "snk-filter-search";
|
|
22
23
|
case FilterItemType.NUMBER:
|
|
23
24
|
return "snk-filter-number";
|
|
25
|
+
case FilterItemType.PERSONALIZED:
|
|
26
|
+
return "snk-filter-personalized";
|
|
24
27
|
}
|
|
25
28
|
return "snk-filter-text";
|
|
26
29
|
}
|
|
@@ -36,9 +39,41 @@ const SnkFilterDetail = class {
|
|
|
36
39
|
h("ez-icon", { title: this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), class: "ez-margin-left--small sc-snk-filter-bar snk-filter-item__editor-header-button", iconName: this.config.fixed ? "un-pin" : "push-pin", onClick: () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })) })
|
|
37
40
|
]);
|
|
38
41
|
}
|
|
42
|
+
apply() {
|
|
43
|
+
var _a;
|
|
44
|
+
let isValid = true;
|
|
45
|
+
const value = this._editor["value"];
|
|
46
|
+
/* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
|
|
47
|
+
if (value != undefined && this.config.type === FilterItemType.PERSONALIZED) {
|
|
48
|
+
const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
|
|
49
|
+
if (params.length > 1) {
|
|
50
|
+
if (params.length > value.length) {
|
|
51
|
+
isValid = false;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
value.forEach(item => {
|
|
55
|
+
if (item == undefined) {
|
|
56
|
+
isValid = false;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!isValid) {
|
|
62
|
+
this.keepOpened = true;
|
|
63
|
+
ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.").then(() => setTimeout(() => this.keepOpened = false, 1));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/* WARNING: Temporário.*/
|
|
67
|
+
if (isValid) {
|
|
68
|
+
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
clear() {
|
|
72
|
+
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
73
|
+
}
|
|
39
74
|
render() {
|
|
40
75
|
const ContentEditor = this.getContentEditor();
|
|
41
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.
|
|
76
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
42
77
|
}
|
|
43
78
|
};
|
|
44
79
|
|