@sankhyalabs/sankhyablocks 3.3.0 → 3.4.1
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/{ConfigStorage-8b5e3261.js → ConfigStorage-0a2db8e7.js} +61 -1
- package/dist/cjs/{SnkMessageBuilder-424f02f7.js → SnkMessageBuilder-e6dee2c2.js} +21 -1
- package/dist/cjs/{index-0e663819.js → index-f400b1d6.js} +34 -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 +12 -12
- package/dist/cjs/snk-configurator_3.cjs.entry.js +2 -2
- package/dist/cjs/snk-crud.cjs.entry.js +2 -2
- package/dist/cjs/snk-data-exporter_8.cjs.entry.js +3 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +3 -2
- package/dist/cjs/snk-filter-param-config.cjs.entry.js +255 -0
- package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +2 -2
- package/dist/cjs/{taskbar-elements-d7eb170e.js → taskbar-elements-5e87cf44.js} +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +3 -2
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.js +1 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/ISystemFilterConfig.js +1 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IUserFilterConfig.js +1 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.css +12 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +258 -0
- package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +55 -0
- package/dist/collection/lib/@types/index.js +34 -0
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +49 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +10 -10
- package/dist/collection/lib/http/data-fetcher/interfaces/IClientEventResponse.js +1 -0
- package/dist/collection/lib/http/data-fetcher/recaller/DataFetcherRecaller.js +14 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-filter-param-config.msg.js +18 -0
- package/dist/components/DataFetcher.js +62 -2
- package/dist/components/SnkMessageBuilder.js +21 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/{esm/index-1564817d.js → components/index2.js} +35 -1
- package/dist/components/snk-application2.js +10 -10
- package/dist/components/snk-crud.js +2 -1
- package/dist/components/snk-data-exporter2.js +2 -33
- package/dist/components/snk-exporter-email-sender2.js +3 -2
- package/dist/components/snk-filter-param-config.d.ts +11 -0
- package/dist/components/snk-filter-param-config.js +276 -0
- package/dist/components/snk-form2.js +2 -1
- package/dist/components/snk-grid2.js +2 -1
- package/dist/components/snk-taskbar2.js +2 -1
- package/dist/esm/{ConfigStorage-4654f57b.js → ConfigStorage-f9eaa4bc.js} +62 -2
- package/dist/esm/{SnkMessageBuilder-64821b88.js → SnkMessageBuilder-f0d50bd6.js} +21 -1
- package/dist/esm/index-bd13bdcf.js +67 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +12 -12
- package/dist/esm/snk-configurator_3.entry.js +2 -2
- package/dist/esm/snk-crud.entry.js +2 -2
- package/dist/esm/snk-data-exporter_8.entry.js +3 -3
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-exporter-email-sender.entry.js +3 -2
- package/dist/esm/snk-filter-param-config.entry.js +251 -0
- package/dist/esm/snk-form-config.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +2 -2
- package/dist/esm/{taskbar-elements-dc968d8f.js → taskbar-elements-8400dbe7.js} +1 -1
- package/dist/sankhyablocks/p-22e44b9d.entry.js +1 -0
- package/dist/sankhyablocks/{p-a22a3a7a.entry.js → p-231da738.entry.js} +4 -4
- package/dist/sankhyablocks/{p-554db79e.entry.js → p-24a74ea9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d3fb34cb.js → p-32d02fa4.js} +1 -1
- package/dist/sankhyablocks/{p-6878464e.entry.js → p-445ff0af.entry.js} +1 -1
- package/dist/sankhyablocks/p-69562bcf.js +1 -0
- package/dist/sankhyablocks/{p-71b8562d.entry.js → p-69738f28.entry.js} +1 -1
- package/dist/sankhyablocks/{p-31b3217d.entry.js → p-7f195b37.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d9c43eca.js → p-93c271e2.js} +1 -1
- package/dist/sankhyablocks/{p-afea1284.entry.js → p-943b9c98.entry.js} +1 -1
- package/dist/sankhyablocks/{p-93d8ea09.js → p-a0258616.js} +6 -6
- package/dist/sankhyablocks/{p-125c2d01.entry.js → p-bb445357.entry.js} +1 -1
- package/dist/sankhyablocks/p-c81ced8a.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +13 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/ISystemFilterConfig.d.ts +4 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IUserFilterConfig.d.ts +5 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +41 -0
- package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +15 -0
- package/dist/types/components.d.ts +16 -0
- package/dist/types/lib/@types/index.d.ts +30 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -1
- package/dist/types/lib/http/data-fetcher/interfaces/IClientEventResponse.d.ts +4 -0
- package/dist/types/lib/http/data-fetcher/recaller/DataFetcherRecaller.d.ts +7 -0
- package/dist/types/lib/message/resources/snk-filter-param-config.msg.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-5534e08c.js +0 -1
- package/dist/sankhyablocks/p-eb08de68.entry.js +0 -1
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index$1 = require('./index-21bd01e1.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
|
|
8
|
+
const index = require('./index-f400b1d6.js');
|
|
9
|
+
|
|
10
|
+
class PersonalizedFilterUtils {
|
|
11
|
+
/**
|
|
12
|
+
* Cria uma expressão de filtro a partir de um IExpressionItem.
|
|
13
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
|
14
|
+
* @returns Retorna a expressão de filtro.
|
|
15
|
+
*/
|
|
16
|
+
static buildFilterExpression(expressionItem) {
|
|
17
|
+
if (expressionItem == undefined) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const value = this.buildVariableParameterValue(expressionItem);
|
|
21
|
+
let expression = expressionItem.expression || "";
|
|
22
|
+
switch (expressionItem.operand) {
|
|
23
|
+
case index.FilterOperand.IN:
|
|
24
|
+
expression += ` ${expressionItem.operand} (${value})`;
|
|
25
|
+
break;
|
|
26
|
+
case index.FilterOperand.NULL:
|
|
27
|
+
case index.FilterOperand.NOT_NULL:
|
|
28
|
+
expression += ` IS ${value}`;
|
|
29
|
+
break;
|
|
30
|
+
case index.FilterOperand.LIKE:
|
|
31
|
+
expression += ` LIKE '%${value}%'`;
|
|
32
|
+
break;
|
|
33
|
+
case index.FilterOperand.START_WITH:
|
|
34
|
+
expression += ` LIKE '${value}%'`;
|
|
35
|
+
break;
|
|
36
|
+
case index.FilterOperand.FINISHED_WITH:
|
|
37
|
+
expression += ` LIKE '%${value}'`;
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
expression += ` ${expressionItem.operand} ${value}`;
|
|
41
|
+
}
|
|
42
|
+
return expression;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Obtém o valor do parâmetro a partir de um IExpressionItem.
|
|
46
|
+
* @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
|
|
47
|
+
* @returns Retorna o valor do parâmetro.
|
|
48
|
+
*/
|
|
49
|
+
static buildVariableParameterValue(expressionItem) {
|
|
50
|
+
if (expressionItem == undefined) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (expressionItem.systemConfig != undefined) {
|
|
54
|
+
const systemConfig = expressionItem.systemConfig;
|
|
55
|
+
return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
|
|
56
|
+
}
|
|
57
|
+
if (expressionItem.userConfig != undefined) {
|
|
58
|
+
const userConfig = expressionItem.userConfig;
|
|
59
|
+
return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
|
|
60
|
+
}
|
|
61
|
+
return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const snkFilterParamConfigCss = ".sc-snk-filter-param-config-h{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression.sc-snk-filter-param-config{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
|
|
66
|
+
|
|
67
|
+
const SnkFilterParamConfig = class {
|
|
68
|
+
constructor(hostRef) {
|
|
69
|
+
index$1.registerInstance(this, hostRef);
|
|
70
|
+
this._opened = false;
|
|
71
|
+
this._configType = index.FilterConfigType.SYSTEM_CONFIG;
|
|
72
|
+
this._expressionItem = undefined;
|
|
73
|
+
this._informedInstance = false;
|
|
74
|
+
this._canSave = false;
|
|
75
|
+
}
|
|
76
|
+
open(expressionItem) {
|
|
77
|
+
this._opened = true;
|
|
78
|
+
this._expressionItem = expressionItem;
|
|
79
|
+
this.loadValues();
|
|
80
|
+
return new Promise(accept => {
|
|
81
|
+
this._promiseResolver = accept;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
close() {
|
|
85
|
+
this._opened = false;
|
|
86
|
+
return new Promise(accept => {
|
|
87
|
+
this._promiseResolver = accept;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
92
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
93
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
94
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
|
|
95
|
+
*/
|
|
96
|
+
getMessage(key, params) {
|
|
97
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
98
|
+
}
|
|
99
|
+
getConfigValue(configName, inputName, inputAlias = "") {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
|
|
102
|
+
|| ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
|
|
103
|
+
}
|
|
104
|
+
loadValues() {
|
|
105
|
+
var _a;
|
|
106
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
|
107
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
|
108
|
+
const description = this.getConfigValue("userConfig", "description");
|
|
109
|
+
const type = this.getConfigValue("userConfig", "type");
|
|
110
|
+
if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
|
|
111
|
+
this._configType = index.FilterConfigType.USER_CONFIG;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this._configType = index.FilterConfigType.SYSTEM_CONFIG;
|
|
115
|
+
}
|
|
116
|
+
if (!core.StringUtils.isEmpty(entityName) && !core.StringUtils.isEmpty(fieldName)) {
|
|
117
|
+
this._instanceElement.value = { value: entityName, label: "" };
|
|
118
|
+
this._fieldElement.value = { value: fieldName, label: "" };
|
|
119
|
+
}
|
|
120
|
+
if (!core.StringUtils.isEmpty(description) && !core.StringUtils.isEmpty(type)) {
|
|
121
|
+
this._descriptionElement.value = description;
|
|
122
|
+
this._typeElement.value = type;
|
|
123
|
+
}
|
|
124
|
+
this.buildFilterExpression();
|
|
125
|
+
}
|
|
126
|
+
changeDefinitionUsed(option) {
|
|
127
|
+
this._configType = option !== null && option !== void 0 ? option : index.FilterConfigType.SYSTEM_CONFIG;
|
|
128
|
+
if (this._configType === index.FilterConfigType.SYSTEM_CONFIG) {
|
|
129
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
|
130
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
|
131
|
+
this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
|
|
132
|
+
this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
|
|
133
|
+
}
|
|
134
|
+
else if (this._configType === index.FilterConfigType.USER_CONFIG) {
|
|
135
|
+
const description = this.getConfigValue("userConfig", "description");
|
|
136
|
+
const type = this.getConfigValue("userConfig", "type");
|
|
137
|
+
this._descriptionElement.value = this._descriptionElement.value || description;
|
|
138
|
+
this._typeElement.value = this._typeElement.value || type;
|
|
139
|
+
}
|
|
140
|
+
this.buildFilterExpression();
|
|
141
|
+
}
|
|
142
|
+
getTypeValue() {
|
|
143
|
+
var _a;
|
|
144
|
+
const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
|
|
145
|
+
return ((value === null || value === void 0 ? void 0 : value.value) || value);
|
|
146
|
+
}
|
|
147
|
+
getExpressionValues() {
|
|
148
|
+
var _a, _b, _c, _d, _e;
|
|
149
|
+
let systemConfig;
|
|
150
|
+
let userConfig;
|
|
151
|
+
if (this._configType === index.FilterConfigType.SYSTEM_CONFIG) {
|
|
152
|
+
const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
|
153
|
+
const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
|
|
154
|
+
systemConfig = { entity, fieldName };
|
|
155
|
+
}
|
|
156
|
+
else if (this._configType === index.FilterConfigType.USER_CONFIG) {
|
|
157
|
+
const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
|
|
158
|
+
const type = this.getTypeValue();
|
|
159
|
+
userConfig = { description, type };
|
|
160
|
+
}
|
|
161
|
+
return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
|
|
162
|
+
}
|
|
163
|
+
isEnabled(value) {
|
|
164
|
+
return this._configType === value;
|
|
165
|
+
}
|
|
166
|
+
isInformedInstance() {
|
|
167
|
+
var _a, _b;
|
|
168
|
+
return !core.StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
|
|
169
|
+
}
|
|
170
|
+
save() {
|
|
171
|
+
var _a;
|
|
172
|
+
this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
|
|
173
|
+
this._promiseResolver(this._expressionItem);
|
|
174
|
+
this._opened = false;
|
|
175
|
+
}
|
|
176
|
+
buildFilterExpression() {
|
|
177
|
+
var _a;
|
|
178
|
+
this._informedInstance = this.isInformedInstance();
|
|
179
|
+
const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
|
|
180
|
+
this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
|
|
181
|
+
this._canSave = this.getCanSave();
|
|
182
|
+
}
|
|
183
|
+
handleChangeInstance() {
|
|
184
|
+
this._informedInstance = this.isInformedInstance();
|
|
185
|
+
if (this._fieldElement != undefined && !core.StringUtils.isEmpty(this._fieldElement.value)) {
|
|
186
|
+
this._fieldElement.value = null;
|
|
187
|
+
}
|
|
188
|
+
this.buildFilterExpression();
|
|
189
|
+
}
|
|
190
|
+
getInstanceCriteria() {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
|
193
|
+
return {
|
|
194
|
+
expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
|
|
195
|
+
params: [
|
|
196
|
+
{
|
|
197
|
+
name: "NOMEINSTANCIA",
|
|
198
|
+
dataType: core.DataType.TEXT,
|
|
199
|
+
value
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
onSearch({ mode, argument }, entity) {
|
|
205
|
+
if (this._application == undefined) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const isField = entity === index.FilterEntities.FIELD;
|
|
209
|
+
const criteria = isField ? this.getInstanceCriteria() : undefined;
|
|
210
|
+
const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
|
|
211
|
+
const entityDescription = this.getMessage(messageKey);
|
|
212
|
+
const searchOptions = {
|
|
213
|
+
descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
|
|
214
|
+
codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
|
|
215
|
+
showInactives: false
|
|
216
|
+
};
|
|
217
|
+
const options = {
|
|
218
|
+
entity,
|
|
219
|
+
entityDescription,
|
|
220
|
+
criteria,
|
|
221
|
+
searchOptions
|
|
222
|
+
};
|
|
223
|
+
return this._application.executePreparedSearch(mode, argument, options);
|
|
224
|
+
}
|
|
225
|
+
getElementID(sufix) {
|
|
226
|
+
return {
|
|
227
|
+
[core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(sufix)
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
getCanSave() {
|
|
231
|
+
var _a;
|
|
232
|
+
if (this._configType === index.FilterConfigType.USER_CONFIG) {
|
|
233
|
+
const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
|
|
234
|
+
const type = this.getTypeValue();
|
|
235
|
+
return !core.StringUtils.isEmpty(description) && !core.StringUtils.isEmpty(type);
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
componentWillLoad() {
|
|
240
|
+
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
241
|
+
}
|
|
242
|
+
render() {
|
|
243
|
+
core.ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
|
|
244
|
+
return (index$1.h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), index$1.h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
|
|
245
|
+
if (evt.detail === ezModalContainer.ModalAction.CLOSE)
|
|
246
|
+
this.close();
|
|
247
|
+
}, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), index$1.h("div", { class: "ez-flex" }, index$1.h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, index$1.h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), index$1.h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: index.FilterConfigType.SYSTEM_CONFIG })), index$1.h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(index.FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, index.FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), index$1.h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(index.FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, index.FilterEntities.FIELD) }, this.getElementID("configFindField")))), index$1.h("div", { class: "ez-flex ez-padding--medium" }, index$1.h("hr", { class: "ez-divider-vertical" })), index$1.h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, index$1.h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), index$1.h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: index.FilterConfigType.USER_CONFIG })), index$1.h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(index.FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), index$1.h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(index.FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(index.FilterUserConfigTypes).map((configType) => {
|
|
248
|
+
return (index$1.h("option", { value: index.FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
|
|
249
|
+
})))), index$1.h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), index$1.h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, index$1.h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), index$1.h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
|
|
250
|
+
}
|
|
251
|
+
get _element() { return index$1.getElement(this); }
|
|
252
|
+
};
|
|
253
|
+
SnkFilterParamConfig.style = snkFilterParamConfigCss;
|
|
254
|
+
|
|
255
|
+
exports.snk_filter_param_config = SnkFilterParamConfig;
|
|
@@ -7,7 +7,7 @@ const draggable_bundle = require('./draggable.bundle-82a25c06.js');
|
|
|
7
7
|
const core = require('@sankhyalabs/core');
|
|
8
8
|
const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
9
9
|
const constants = require('./constants-8f3504ec.js');
|
|
10
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
10
|
+
const ConfigStorage = require('./ConfigStorage-0a2db8e7.js');
|
|
11
11
|
require('./_commonjsHelpers-537d719a.js');
|
|
12
12
|
|
|
13
13
|
const snkFormConfigCss = ".sc-snk-form-config-h{--snk-form-config--z-index:var(--more-visible, 2);--snk-form-config--background-color:var(--background--xlight, #fff);--snk-form-config__icon--color:var(--text--disable, #AFB6C0);--snk-form-config__label-counter--font-weight:var(--text-weight--extra-small, 200);--snk-form-config__add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__add-group-container--background-color:var(--background--medium, #d2dce9);--snk-form-config__add-group-container--padding:var(--space--small, 6px);--snk-form-config__add-group-content--border:2px dashed var(--color-strokes, #DCE0E8);--snk-form-config__add-group-content--border-radius:var(--border--radius-small, 6px);--snk-form-config__add-group-label--padding:var(--space--large, 24px);--snk-form-config__btn-add-group--padding:var(--space--large, 24px) var(--space--medium, 12px) 0;--snk-form-config__btn-add-group-container--padding:var(--space--medium, 12px);--snk-form-config__btn-add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__btn-add-group-container--border:2px solid var(--color-strokes, #DCE0E8);--snk-form-config__btn-add-group-container--background-color:var(--background--body, #fafcff);display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--snk-form-config--z-index);background-color:var(--snk-form-config--background-color)}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--snk-form-config__icon--color)}.ez-box__label-counter.sc-snk-form-config{margin-top:-7px;font-weight:var(--snk-form-config__label-counter--font-weight)}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:var(--snk-form-config--background-color)}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--snk-form-config--z-index)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--snk-form-config__add-group-container--border-radius);background-color:var(--snk-form-config__add-group-container--background-color);padding:var(--snk-form-config__add-group-container--padding)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:var(--snk-form-config__add-group-content--border);border-radius:var(--snk-form-config__add-group-content--border-radius)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--snk-form-config__add-group-label--padding)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--snk-form-config__btn-add-group--padding)}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--snk-form-config__btn-add-group-container--padding);border-radius:var(--snk-form-config__btn-add-group-container--border-radius);border:var(--snk-form-config__btn-add-group-container--border);background-color:var(--snk-form-config__btn-add-group-container--background-color)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:var(--snk-form-config--background-color)}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{transform:translate(calc(100% / 3 * -1))}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{transform:translate(calc(100% / 3 * -2))}}";
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-21bd01e1.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const ConfigStorage = require('./ConfigStorage-
|
|
8
|
-
const index$1 = require('./index-
|
|
7
|
+
const ConfigStorage = require('./ConfigStorage-0a2db8e7.js');
|
|
8
|
+
const index$1 = require('./index-f400b1d6.js');
|
|
9
9
|
const taskbarProcessor = require('./taskbar-processor-6f3d2a75.js');
|
|
10
10
|
require('./_commonjsHelpers-537d719a.js');
|
|
11
11
|
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"./components/snk-grid/snk-grid.js",
|
|
28
28
|
"./components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js",
|
|
29
29
|
"./components/snk-grid/subcomponents/snk-select-box/snk-select-box.js",
|
|
30
|
+
"./components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js",
|
|
30
31
|
"./components/snk-pesquisa/snk-pesquisa.js",
|
|
31
32
|
"./components/teste-pesquisa/teste-pesquisa.js"
|
|
32
33
|
],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
2
|
import { h } from '@stencil/core';
|
|
3
|
+
import { ModalAction } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
|
|
3
4
|
import { EmailInfoStep } from './email-info-step';
|
|
4
5
|
import { OptionsStep } from './options-step';
|
|
5
6
|
export class SnkExporterEmailSender {
|
|
@@ -84,8 +85,8 @@ export class SnkExporterEmailSender {
|
|
|
84
85
|
}
|
|
85
86
|
render() {
|
|
86
87
|
ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkExporterEmailSender');
|
|
87
|
-
return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: evt => {
|
|
88
|
-
if (evt.detail ===
|
|
88
|
+
return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: (evt) => {
|
|
89
|
+
if (evt.detail === ModalAction.CLOSE)
|
|
89
90
|
this.close();
|
|
90
91
|
}, modalTitle: this.getMessage("snkExporter.emailSenderTitle"), modalSubTitle: this.getStepMessage("subTitle") }, h("ez-view-stack", { ref: ref => this._viewStack = ref }, h("stack-item", null, h(OptionsStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateConfigInfo(field, value) })), h("stack-item", null, h(EmailInfoStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateEmailInfo(field, value) }))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-button--tertiary ez-padding-right--medium", label: this.getStepMessage("firstButton"), onClick: () => this.executeButtonAction(true), enabled: this.checkButtonEnabled(true) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("firstButton")}` })), h("ez-button", Object.assign({ class: this.getSecondButtonClass(), label: this.getStepMessage("secondButton"), onClick: () => this.executeButtonAction(false), enabled: this.checkButtonEnabled(false) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("secondButton")}` }))))));
|
|
91
92
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/*@doc Define a cor do campo de expressão do componente.*/
|
|
3
|
+
--snk-filter-param-config__expression--color: var(--title--primary, #2b3a54);
|
|
4
|
+
|
|
5
|
+
/*private*/
|
|
6
|
+
display: flex;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.snk-filter-param-config__expression {
|
|
11
|
+
--text-area__input--disabled--color: var(--snk-filter-param-config__expression--color);
|
|
12
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { ApplicationContext, DataType, ElementIDUtils, StringUtils } from "@sankhyalabs/core";
|
|
3
|
+
import { ModalAction } from "@sankhyalabs/ezui/dist/collection/components/ez-modal-container";
|
|
4
|
+
import { FilterConfigType, FilterEntities, FilterUserConfigTypes } from "../../../../lib/@types";
|
|
5
|
+
import { PersonalizedFilterUtils } from "./utils/PersonalizedFilterUtils";
|
|
6
|
+
export class SnkFilterParamConfig {
|
|
7
|
+
constructor() {
|
|
8
|
+
this._opened = false;
|
|
9
|
+
this._configType = FilterConfigType.SYSTEM_CONFIG;
|
|
10
|
+
this._expressionItem = undefined;
|
|
11
|
+
this._informedInstance = false;
|
|
12
|
+
this._canSave = false;
|
|
13
|
+
}
|
|
14
|
+
open(expressionItem) {
|
|
15
|
+
this._opened = true;
|
|
16
|
+
this._expressionItem = expressionItem;
|
|
17
|
+
this.loadValues();
|
|
18
|
+
return new Promise(accept => {
|
|
19
|
+
this._promiseResolver = accept;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
close() {
|
|
23
|
+
this._opened = false;
|
|
24
|
+
return new Promise(accept => {
|
|
25
|
+
this._promiseResolver = accept;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
30
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
31
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
32
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
|
|
33
|
+
*/
|
|
34
|
+
getMessage(key, params) {
|
|
35
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
36
|
+
}
|
|
37
|
+
getConfigValue(configName, inputName, inputAlias = "") {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
|
|
40
|
+
|| ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
|
|
41
|
+
}
|
|
42
|
+
loadValues() {
|
|
43
|
+
var _a;
|
|
44
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
|
45
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
|
46
|
+
const description = this.getConfigValue("userConfig", "description");
|
|
47
|
+
const type = this.getConfigValue("userConfig", "type");
|
|
48
|
+
if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
|
|
49
|
+
this._configType = FilterConfigType.USER_CONFIG;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this._configType = FilterConfigType.SYSTEM_CONFIG;
|
|
53
|
+
}
|
|
54
|
+
if (!StringUtils.isEmpty(entityName) && !StringUtils.isEmpty(fieldName)) {
|
|
55
|
+
this._instanceElement.value = { value: entityName, label: "" };
|
|
56
|
+
this._fieldElement.value = { value: fieldName, label: "" };
|
|
57
|
+
}
|
|
58
|
+
if (!StringUtils.isEmpty(description) && !StringUtils.isEmpty(type)) {
|
|
59
|
+
this._descriptionElement.value = description;
|
|
60
|
+
this._typeElement.value = type;
|
|
61
|
+
}
|
|
62
|
+
this.buildFilterExpression();
|
|
63
|
+
}
|
|
64
|
+
changeDefinitionUsed(option) {
|
|
65
|
+
this._configType = option !== null && option !== void 0 ? option : FilterConfigType.SYSTEM_CONFIG;
|
|
66
|
+
if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
|
|
67
|
+
const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
|
|
68
|
+
const fieldName = this.getConfigValue("systemConfig", "fieldName");
|
|
69
|
+
this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
|
|
70
|
+
this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
|
|
71
|
+
}
|
|
72
|
+
else if (this._configType === FilterConfigType.USER_CONFIG) {
|
|
73
|
+
const description = this.getConfigValue("userConfig", "description");
|
|
74
|
+
const type = this.getConfigValue("userConfig", "type");
|
|
75
|
+
this._descriptionElement.value = this._descriptionElement.value || description;
|
|
76
|
+
this._typeElement.value = this._typeElement.value || type;
|
|
77
|
+
}
|
|
78
|
+
this.buildFilterExpression();
|
|
79
|
+
}
|
|
80
|
+
getTypeValue() {
|
|
81
|
+
var _a;
|
|
82
|
+
const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
|
|
83
|
+
return ((value === null || value === void 0 ? void 0 : value.value) || value);
|
|
84
|
+
}
|
|
85
|
+
getExpressionValues() {
|
|
86
|
+
var _a, _b, _c, _d, _e;
|
|
87
|
+
let systemConfig;
|
|
88
|
+
let userConfig;
|
|
89
|
+
if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
|
|
90
|
+
const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
|
91
|
+
const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
|
|
92
|
+
systemConfig = { entity, fieldName };
|
|
93
|
+
}
|
|
94
|
+
else if (this._configType === FilterConfigType.USER_CONFIG) {
|
|
95
|
+
const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
|
|
96
|
+
const type = this.getTypeValue();
|
|
97
|
+
userConfig = { description, type };
|
|
98
|
+
}
|
|
99
|
+
return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
|
|
100
|
+
}
|
|
101
|
+
isEnabled(value) {
|
|
102
|
+
return this._configType === value;
|
|
103
|
+
}
|
|
104
|
+
isInformedInstance() {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
return !StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
|
|
107
|
+
}
|
|
108
|
+
save() {
|
|
109
|
+
var _a;
|
|
110
|
+
this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
|
|
111
|
+
this._promiseResolver(this._expressionItem);
|
|
112
|
+
this._opened = false;
|
|
113
|
+
}
|
|
114
|
+
buildFilterExpression() {
|
|
115
|
+
var _a;
|
|
116
|
+
this._informedInstance = this.isInformedInstance();
|
|
117
|
+
const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
|
|
118
|
+
this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
|
|
119
|
+
this._canSave = this.getCanSave();
|
|
120
|
+
}
|
|
121
|
+
handleChangeInstance() {
|
|
122
|
+
this._informedInstance = this.isInformedInstance();
|
|
123
|
+
if (this._fieldElement != undefined && !StringUtils.isEmpty(this._fieldElement.value)) {
|
|
124
|
+
this._fieldElement.value = null;
|
|
125
|
+
}
|
|
126
|
+
this.buildFilterExpression();
|
|
127
|
+
}
|
|
128
|
+
getInstanceCriteria() {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
|
|
131
|
+
return {
|
|
132
|
+
expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
|
|
133
|
+
params: [
|
|
134
|
+
{
|
|
135
|
+
name: "NOMEINSTANCIA",
|
|
136
|
+
dataType: DataType.TEXT,
|
|
137
|
+
value
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
onSearch({ mode, argument }, entity) {
|
|
143
|
+
if (this._application == undefined) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const isField = entity === FilterEntities.FIELD;
|
|
147
|
+
const criteria = isField ? this.getInstanceCriteria() : undefined;
|
|
148
|
+
const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
|
|
149
|
+
const entityDescription = this.getMessage(messageKey);
|
|
150
|
+
const searchOptions = {
|
|
151
|
+
descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
|
|
152
|
+
codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
|
|
153
|
+
showInactives: false
|
|
154
|
+
};
|
|
155
|
+
const options = {
|
|
156
|
+
entity,
|
|
157
|
+
entityDescription,
|
|
158
|
+
criteria,
|
|
159
|
+
searchOptions
|
|
160
|
+
};
|
|
161
|
+
return this._application.executePreparedSearch(mode, argument, options);
|
|
162
|
+
}
|
|
163
|
+
getElementID(sufix) {
|
|
164
|
+
return {
|
|
165
|
+
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
getCanSave() {
|
|
169
|
+
var _a;
|
|
170
|
+
if (this._configType === FilterConfigType.USER_CONFIG) {
|
|
171
|
+
const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
|
|
172
|
+
const type = this.getTypeValue();
|
|
173
|
+
return !StringUtils.isEmpty(description) && !StringUtils.isEmpty(type);
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
componentWillLoad() {
|
|
178
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
|
|
182
|
+
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) => {
|
|
183
|
+
if (evt.detail === ModalAction.CLOSE)
|
|
184
|
+
this.close();
|
|
185
|
+
}, 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) => {
|
|
186
|
+
return (h("option", { value: FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
|
|
187
|
+
})))), 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")))))));
|
|
188
|
+
}
|
|
189
|
+
static get is() { return "snk-filter-param-config"; }
|
|
190
|
+
static get encapsulation() { return "scoped"; }
|
|
191
|
+
static get originalStyleUrls() {
|
|
192
|
+
return {
|
|
193
|
+
"$": ["snk-filter-param-config.css"]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static get styleUrls() {
|
|
197
|
+
return {
|
|
198
|
+
"$": ["snk-filter-param-config.css"]
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
static get states() {
|
|
202
|
+
return {
|
|
203
|
+
"_opened": {},
|
|
204
|
+
"_configType": {},
|
|
205
|
+
"_expressionItem": {},
|
|
206
|
+
"_informedInstance": {},
|
|
207
|
+
"_canSave": {}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
static get methods() {
|
|
211
|
+
return {
|
|
212
|
+
"open": {
|
|
213
|
+
"complexType": {
|
|
214
|
+
"signature": "(expressionItem: IExpressionItem) => Promise<IExpressionItem>",
|
|
215
|
+
"parameters": [{
|
|
216
|
+
"tags": [],
|
|
217
|
+
"text": ""
|
|
218
|
+
}],
|
|
219
|
+
"references": {
|
|
220
|
+
"Promise": {
|
|
221
|
+
"location": "global"
|
|
222
|
+
},
|
|
223
|
+
"IExpressionItem": {
|
|
224
|
+
"location": "import",
|
|
225
|
+
"path": "./interfaces/IExpressionItem"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"return": "Promise<IExpressionItem>"
|
|
229
|
+
},
|
|
230
|
+
"docs": {
|
|
231
|
+
"text": "",
|
|
232
|
+
"tags": []
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"close": {
|
|
236
|
+
"complexType": {
|
|
237
|
+
"signature": "() => Promise<IExpressionItem>",
|
|
238
|
+
"parameters": [],
|
|
239
|
+
"references": {
|
|
240
|
+
"Promise": {
|
|
241
|
+
"location": "global"
|
|
242
|
+
},
|
|
243
|
+
"IExpressionItem": {
|
|
244
|
+
"location": "import",
|
|
245
|
+
"path": "./interfaces/IExpressionItem"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"return": "Promise<IExpressionItem>"
|
|
249
|
+
},
|
|
250
|
+
"docs": {
|
|
251
|
+
"text": "",
|
|
252
|
+
"tags": []
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
static get elementRef() { return "_element"; }
|
|
258
|
+
}
|