@sankhyalabs/sankhyablocks 1.4.0-beta.8 → 2.0.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/{constants-aebcc2f5.js → constants-9056ca9e.js} +15 -0
- package/dist/cjs/{index-188190ee.js → index-20e8b68a.js} +48 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +27 -21
- package/dist/cjs/snk-config-modal.cjs.entry.js +3 -3
- package/dist/cjs/snk-config-options.cjs.entry.js +139 -72
- package/dist/cjs/snk-configurator_6.cjs.entry.js +5 -5
- package/dist/cjs/snk-crud.cjs.entry.js +3 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-field-config_2.cjs.entry.js +8 -3
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
- 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 +3 -2
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +29 -18
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-tab-config.cjs.entry.js +3 -3
- package/dist/cjs/{taskbar-elements-4c2c6704.js → taskbar-elements-9a4b1e19.js} +1 -1
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +27 -5
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +2 -1
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +3 -2
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +139 -72
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +26 -1
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +1 -1
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +27 -16
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +1 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/parameters-fecher.js +15 -15
- package/dist/collection/lib/utils/constants.js +14 -0
- package/dist/components/constants.js +15 -1
- package/dist/components/snk-application2.js +27 -20
- package/dist/components/snk-config-modal2.js +1 -1
- package/dist/components/snk-config-options2.js +139 -72
- package/dist/components/snk-data-unit.js +1 -1
- package/dist/components/snk-field-config2.js +8 -2
- package/dist/components/snk-filter-modal2.js +3 -2
- package/dist/components/snk-filter-personalized.js +2 -1
- package/dist/components/snk-form-config2.js +28 -17
- package/dist/components/snk-tab-config2.js +2 -2
- package/dist/esm/{constants-c4e3341e.js → constants-c6039d3d.js} +15 -1
- package/dist/esm/{index-bafb2cef.js → index-e4121713.js} +48 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +27 -21
- package/dist/esm/snk-config-modal.entry.js +3 -3
- package/dist/esm/snk-config-options.entry.js +140 -73
- package/dist/esm/snk-configurator_6.entry.js +6 -6
- package/dist/esm/snk-crud.entry.js +3 -3
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-field-config_2.entry.js +8 -3
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-detail.entry.js +1 -1
- 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 +3 -2
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +29 -18
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-tab-config.entry.js +3 -3
- package/dist/esm/{taskbar-elements-2035b1c7.js → taskbar-elements-e2ed0536.js} +1 -1
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/{p-8cd8977c.entry.js → p-029ae4e4.entry.js} +1 -1
- package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
- package/dist/sankhyablocks/{p-1963b46f.entry.js → p-2b891c4a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d1ae76ec.entry.js → p-2dc76d79.entry.js} +1 -1
- package/dist/sankhyablocks/{p-916068ff.entry.js → p-3a276f3d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-31631fb6.entry.js → p-400cc777.entry.js} +1 -1
- package/dist/sankhyablocks/p-4392f13f.entry.js +1 -0
- package/dist/sankhyablocks/{p-ccdf59eb.entry.js → p-44ce5b90.entry.js} +1 -1
- package/dist/sankhyablocks/p-521c96f0.entry.js +1 -0
- package/dist/sankhyablocks/p-60eef7cd.entry.js +1 -0
- package/dist/sankhyablocks/{p-6c61416a.entry.js → p-6988f4a6.entry.js} +1 -1
- package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
- package/dist/sankhyablocks/{p-cc85ba53.entry.js → p-9dc4426d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ee906940.entry.js → p-a17a4fca.entry.js} +1 -1
- package/dist/sankhyablocks/p-a5b26df2.js +1 -0
- package/dist/sankhyablocks/{p-f9084ecb.entry.js → p-cc4bef9f.entry.js} +1 -1
- package/dist/sankhyablocks/p-d690b6b5.entry.js +75 -0
- package/dist/sankhyablocks/{p-ad658f44.js → p-d9fbb26f.js} +1 -1
- package/dist/sankhyablocks/{p-857c4735.entry.js → p-deb1f523.entry.js} +1 -1
- package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
- package/dist/sankhyablocks/{p-04ad681a.entry.js → p-e9beab79.entry.js} +1 -1
- package/dist/sankhyablocks/p-eb23420d.entry.js +1 -0
- package/dist/sankhyablocks/p-f37cdeb5.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +4 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +17 -7
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +6 -0
- package/dist/types/components.d.ts +12 -0
- package/dist/types/lib/http/data-fetcher/fetchers/parameters-fecher.d.ts +7 -7
- package/dist/types/lib/utils/constants.d.ts +14 -0
- package/package.json +5 -5
- package/dist/sankhyablocks/p-26c503a6.entry.js +0 -1
- package/dist/sankhyablocks/p-434e0dcf.entry.js +0 -1
- package/dist/sankhyablocks/p-9f2c5fac.entry.js +0 -1
- package/dist/sankhyablocks/p-ae302037.entry.js +0 -75
- package/dist/sankhyablocks/p-af11b0e7.js +0 -1
- package/dist/sankhyablocks/p-af306302.entry.js +0 -1
- package/dist/sankhyablocks/p-ce789145.entry.js +0 -1
- package/dist/sankhyablocks/p-cf81e313.entry.js +0 -1
- package/dist/sankhyablocks/p-ddb03141.js +0 -2
- package/dist/sankhyablocks/p-fa75fba5.entry.js +0 -1
package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
-
import { formFieldBuilder } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
2
|
+
import { ApplicationContext, UserInterface, ObjectUtils } from '@sankhyalabs/core';
|
|
4
3
|
import { DataType, getConvertedValue } from "@sankhyalabs/core/dist/dataunit/metadata/DataType";
|
|
5
|
-
import {
|
|
4
|
+
import { CheckMode } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
5
|
+
import { DEFAULT_TYPE, TAGS_BY_TYPE, VARS_BY_TYPE } from "../../../../lib/utils/constants";
|
|
6
6
|
export class SnkConfigOptions {
|
|
7
7
|
constructor() {
|
|
8
8
|
/**
|
|
@@ -27,71 +27,20 @@ export class SnkConfigOptions {
|
|
|
27
27
|
enabledValueDefault() {
|
|
28
28
|
var _a, _b, _c;
|
|
29
29
|
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
30
|
-
|
|
30
|
+
const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
|
|
31
|
+
const hasVariableVar = VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface);
|
|
32
|
+
if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
|
|
31
33
|
return true;
|
|
32
34
|
}
|
|
33
35
|
return false;
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
var _a;
|
|
37
|
-
if (field != undefined) {
|
|
38
|
-
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
getMessage(key, params) {
|
|
42
|
-
return this._application.messagesBuilder.getMessage(key, params);
|
|
43
|
-
}
|
|
44
|
-
getDefaultType() {
|
|
45
|
-
var _a;
|
|
46
|
-
return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
|
|
47
|
-
}
|
|
48
|
-
getValidatedValue(fieldValue) {
|
|
37
|
+
isAllowDefault() {
|
|
49
38
|
var _a, _b;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
54
|
-
const dataType = field === null || field === void 0 ? void 0 : field.dataType;
|
|
55
|
-
if (dataType == undefined) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const value = dataType !== DataType.OBJECT && dataType !== DataType.DATE
|
|
59
|
-
&& typeof fieldValue === "object" && "value" in fieldValue
|
|
60
|
-
? fieldValue.value
|
|
61
|
-
: fieldValue;
|
|
62
|
-
return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
|
|
63
|
-
}
|
|
64
|
-
onChange(evt) {
|
|
65
|
-
this.fieldConfig.defaultValue.value = this.getValidatedValue(evt === null || evt === void 0 ? void 0 : evt.detail);
|
|
66
|
-
this.configOptionsChanged.emit(this.fieldConfig);
|
|
67
|
-
}
|
|
68
|
-
onSearch(searchArgument) {
|
|
69
|
-
if (this._application != undefined && this.fieldConfig != undefined) {
|
|
70
|
-
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
|
|
39
|
+
const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
|
|
40
|
+
if (allowDefault == undefined) {
|
|
41
|
+
return true;
|
|
71
42
|
}
|
|
72
|
-
|
|
73
|
-
loadDataField() {
|
|
74
|
-
this._element.querySelectorAll("[data-field-name]")
|
|
75
|
-
.forEach((field) => {
|
|
76
|
-
var _a, _b, _c, _d;
|
|
77
|
-
field.enabled = ((_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault) === "true";
|
|
78
|
-
if (field.enabled) {
|
|
79
|
-
const value = this.fieldConfig.defaultValue.value;
|
|
80
|
-
if (value != undefined) {
|
|
81
|
-
const fieldName = field.dataset.fieldName;
|
|
82
|
-
const dataType = (_d = (_c = this.dataUnit) === null || _c === void 0 ? void 0 : _c.getField(fieldName)) === null || _d === void 0 ? void 0 : _d.dataType;
|
|
83
|
-
field.value = getConvertedValue(dataType, value);
|
|
84
|
-
}
|
|
85
|
-
field.addEventListener(CONFIG_EVENTS.fieldChanged, (evt) => {
|
|
86
|
-
return this.onChange(evt);
|
|
87
|
-
});
|
|
88
|
-
if (field.tagName === "EZ-SEARCH") {
|
|
89
|
-
field.optionLoader = (searchArgument) => {
|
|
90
|
-
return this.onSearch(searchArgument);
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
});
|
|
43
|
+
return allowDefault === "true";
|
|
95
44
|
}
|
|
96
45
|
loadDefaultValue() {
|
|
97
46
|
var _a;
|
|
@@ -113,6 +62,19 @@ export class SnkConfigOptions {
|
|
|
113
62
|
this._defaultType = this.fieldConfig.defaultValue.type;
|
|
114
63
|
}
|
|
115
64
|
}
|
|
65
|
+
getFieldProperties(field) {
|
|
66
|
+
var _a;
|
|
67
|
+
if (field != undefined) {
|
|
68
|
+
return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
getMessage(key, params) {
|
|
72
|
+
return this._application.messagesBuilder.getMessage(key, params);
|
|
73
|
+
}
|
|
74
|
+
getDefaultType() {
|
|
75
|
+
var _a;
|
|
76
|
+
return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
|
|
77
|
+
}
|
|
116
78
|
getEnabledByProperty(property) {
|
|
117
79
|
const properties = this._fieldProperties;
|
|
118
80
|
if (properties != undefined && properties[property] === true) {
|
|
@@ -127,25 +89,130 @@ export class SnkConfigOptions {
|
|
|
127
89
|
}
|
|
128
90
|
return this.fieldConfig[property];
|
|
129
91
|
}
|
|
92
|
+
getValidatedValue(fieldValue) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (fieldValue == undefined) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
|
|
98
|
+
const dataType = field === null || field === void 0 ? void 0 : field.dataType;
|
|
99
|
+
if (dataType == undefined) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
|
|
103
|
+
dataType !== DataType.OBJECT && dataType !== DataType.DATE
|
|
104
|
+
&& typeof fieldValue === "object"
|
|
105
|
+
? fieldValue.value
|
|
106
|
+
: fieldValue;
|
|
107
|
+
return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
|
|
108
|
+
}
|
|
109
|
+
buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
|
|
110
|
+
let options;
|
|
111
|
+
let precision = 0;
|
|
112
|
+
let prettyPrecision = 0;
|
|
113
|
+
const TagName = userInterface == undefined || TAGS_BY_TYPE[userInterface] == undefined
|
|
114
|
+
? TAGS_BY_TYPE.DEFAULT
|
|
115
|
+
: TAGS_BY_TYPE[userInterface];
|
|
116
|
+
if (userInterface === UserInterface.OPTIONSELECTOR) {
|
|
117
|
+
const prop = properties === null || properties === void 0 ? void 0 : properties.options;
|
|
118
|
+
if (typeof prop === "string") {
|
|
119
|
+
const parsed = ObjectUtils.stringToObject(prop);
|
|
120
|
+
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
options = prop;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (userInterface === UserInterface.DECIMALNUMBER) {
|
|
127
|
+
precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
128
|
+
prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
|
|
129
|
+
}
|
|
130
|
+
return h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
|
|
131
|
+
}
|
|
132
|
+
getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
|
|
133
|
+
switch (userInterface) {
|
|
134
|
+
case UserInterface.SEARCH:
|
|
135
|
+
return {
|
|
136
|
+
suppressEmptyOption: required,
|
|
137
|
+
optionLoader: (searchArgument) => this.onSearch(searchArgument)
|
|
138
|
+
};
|
|
139
|
+
case UserInterface.OPTIONSELECTOR:
|
|
140
|
+
return {
|
|
141
|
+
suppressEmptyOption: required,
|
|
142
|
+
options
|
|
143
|
+
};
|
|
144
|
+
case UserInterface.CHECKBOX:
|
|
145
|
+
case UserInterface.SWITCH:
|
|
146
|
+
return {
|
|
147
|
+
mode
|
|
148
|
+
};
|
|
149
|
+
case UserInterface.INTEGERNUMBER:
|
|
150
|
+
case UserInterface.DECIMALNUMBER:
|
|
151
|
+
return {
|
|
152
|
+
precision,
|
|
153
|
+
prettyPrecision,
|
|
154
|
+
onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
|
|
155
|
+
};
|
|
156
|
+
case UserInterface.DATE:
|
|
157
|
+
case UserInterface.DATETIME:
|
|
158
|
+
case UserInterface.TIME:
|
|
159
|
+
return {
|
|
160
|
+
onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
|
|
161
|
+
};
|
|
162
|
+
default:
|
|
163
|
+
return {};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
onChange(fieldValue) {
|
|
167
|
+
this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
|
|
168
|
+
this.configOptionsChanged.emit(this.fieldConfig);
|
|
169
|
+
}
|
|
170
|
+
onSearch(searchArgument) {
|
|
171
|
+
if (this._application != undefined && this.fieldConfig != undefined) {
|
|
172
|
+
return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
buildField(field) {
|
|
176
|
+
const { config, descriptor } = field;
|
|
177
|
+
const { name, label, readOnly, required, defaultValue } = config;
|
|
178
|
+
const { userInterface, properties } = descriptor;
|
|
179
|
+
const enabled = (properties === null || properties === void 0 ? void 0 : properties.allowDefault) != undefined ? properties.allowDefault === "true" : !readOnly;
|
|
180
|
+
let value;
|
|
181
|
+
if (enabled) {
|
|
182
|
+
value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
|
|
183
|
+
if (value != undefined) {
|
|
184
|
+
value = getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const configField = { value, enabled, label, name, required, userInterface };
|
|
188
|
+
switch (userInterface) {
|
|
189
|
+
case UserInterface.SWITCH:
|
|
190
|
+
return this.buildInputDefault(configField, undefined, CheckMode.SWITCH);
|
|
191
|
+
case UserInterface.CHECKBOX:
|
|
192
|
+
return this.buildInputDefault(configField, undefined, CheckMode.REGULAR);
|
|
193
|
+
case UserInterface.OPTIONSELECTOR:
|
|
194
|
+
case UserInterface.DECIMALNUMBER:
|
|
195
|
+
return this.buildInputDefault(configField, properties);
|
|
196
|
+
default:
|
|
197
|
+
return this.buildInputDefault(configField);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
130
200
|
componentWillLoad() {
|
|
131
201
|
var _a;
|
|
132
|
-
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
133
202
|
this.loadDefaultValue();
|
|
203
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
134
204
|
this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
|
135
205
|
}
|
|
136
|
-
componentDidRender() {
|
|
137
|
-
this.loadDataField();
|
|
138
|
-
}
|
|
139
206
|
render() {
|
|
140
|
-
var _a, _b
|
|
141
|
-
return (h(Host, null, h("div", { id: this.idConfig }, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled:
|
|
142
|
-
h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.
|
|
207
|
+
var _a, _b;
|
|
208
|
+
return (h(Host, null, h("div", { id: this.idConfig }, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, h("option", { value: DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), h("option", { value: DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === DEFAULT_TYPE.variable ?
|
|
209
|
+
h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.isAllowDefault(), onEzChange: (evt) => { var _a; this.fieldConfig.defaultValue.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value; this.configOptionsChanged.emit(this.fieldConfig); }, value: this.fieldConfig.defaultValue.value, options: this.buildOptions() })
|
|
143
210
|
:
|
|
144
|
-
((
|
|
145
|
-
|
|
211
|
+
((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
|
|
212
|
+
this.buildField({
|
|
146
213
|
descriptor: this._fieldProperties,
|
|
147
214
|
config: this.fieldConfig
|
|
148
|
-
})
|
|
215
|
+
}))), h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
|
|
149
216
|
}
|
|
150
217
|
static get is() { return "snk-config-options"; }
|
|
151
218
|
static get encapsulation() { return "scoped"; }
|
package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js
CHANGED
|
@@ -30,6 +30,11 @@ export class SnkFieldConfig {
|
|
|
30
30
|
getMessage(key) {
|
|
31
31
|
return this._application.messagesBuilder.getMessage(key, {});
|
|
32
32
|
}
|
|
33
|
+
isRequired() {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const fieldMD = this.dataUnit && this.dataUnit.getField((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
|
36
|
+
return (fieldMD === null || fieldMD === void 0 ? void 0 : fieldMD.required) === true || ((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.required) === true;
|
|
37
|
+
}
|
|
33
38
|
componentWillLoad() {
|
|
34
39
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
35
40
|
}
|
|
@@ -37,7 +42,7 @@ export class SnkFieldConfig {
|
|
|
37
42
|
if (this.fieldConfig == undefined) {
|
|
38
43
|
return;
|
|
39
44
|
}
|
|
40
|
-
return (h(Host, null, h("div", { class: "field-config" }, h("div", { class: "field-config__draggable" }, h("ez-icon", { iconName: "drag-indicator", size: "small" })), h("div", null, this.fieldConfig.label, this.
|
|
45
|
+
return (h(Host, null, h("div", { class: "field-config" }, h("div", { class: "field-config__draggable" }, h("ez-icon", { iconName: "drag-indicator", size: "small" })), h("div", null, this.fieldConfig.label, this.isRequired() && h("span", { class: "field-config__required-label" }, "*")), this.modeInsertion ?
|
|
41
46
|
h("div", { class: "field-config__add" }, h("ez-button", { onClick: (evt) => this.handleAction(evt, ACTION_CONFIG.add), mode: "icon", class: "ez-button--tertiary", iconName: "plus", size: "large", title: this.getMessage("snkFieldConfig.titleAdd") })) :
|
|
42
47
|
h("div", { class: "field-config__options" + (this.isConfigActive ? " field-config__options--is-active" : " ") }, h("ez-button", { mode: "icon", class: "ez-button--tertiary field-config__remove-icon", onClick: (evt) => this.handleAction(evt, ACTION_CONFIG.remove), iconName: "minus", size: "large", title: this.getMessage("snkFieldConfig.titleRemove") }), h("ez-button", { id: "buttonConfig_" + this.fieldConfig.name, mode: "icon", class: "ez-button--tertiary", onClick: (evt) => this.handleAction(evt, ACTION_CONFIG.configuration), iconName: this.isConfigActive ? "chevron-up" : "settings-inverted", size: "large", title: this.getMessage("snkFieldConfig.titleConfigurations") }))), this.isConfigActive && h("div", { class: "field-config__config-popover" }, h("div", { class: "field-config__config-outer-arrow" }, h("div", { class: "field-config__config-inner-arrow" })))));
|
|
43
48
|
}
|
|
@@ -112,6 +117,26 @@ export class SnkFieldConfig {
|
|
|
112
117
|
"attribute": "mode-insertion",
|
|
113
118
|
"reflect": true,
|
|
114
119
|
"defaultValue": "true"
|
|
120
|
+
},
|
|
121
|
+
"dataUnit": {
|
|
122
|
+
"type": "unknown",
|
|
123
|
+
"mutable": false,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "DataUnit",
|
|
126
|
+
"resolved": "DataUnit",
|
|
127
|
+
"references": {
|
|
128
|
+
"DataUnit": {
|
|
129
|
+
"location": "import",
|
|
130
|
+
"path": "@sankhyalabs/core"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "Reposit\u00F3rio de dados, controla a manipula\u00E7\u00E3o dos dados"
|
|
139
|
+
}
|
|
115
140
|
}
|
|
116
141
|
};
|
|
117
142
|
}
|
package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
/* Título */
|
|
3
3
|
/*@doc Define o estilo da mensagem exibida no título.*/
|
|
4
|
-
--snk-form-config__title--font-pattern: var(--font-pattern, "
|
|
4
|
+
--snk-form-config__title--font-pattern: var(--font-pattern, "Roboto");
|
|
5
5
|
/*@doc Define o peso do título.*/
|
|
6
6
|
--snk-form-config__title--weight--large: var(--text-weight--large, 600);
|
|
7
7
|
|
package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js
CHANGED
|
@@ -2,7 +2,7 @@ import { h, Host } from "@stencil/core";
|
|
|
2
2
|
import { Sortable } from '@shopify/draggable';
|
|
3
3
|
import { ApplicationContext, ObjectUtils, ArrayUtils } from '@sankhyalabs/core';
|
|
4
4
|
import { ApplicationUtils, DialogType } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
5
|
-
import { ACTION_CONFIG, CONFIG_EVENTS, TAB_NAMES } from "../../../../lib/utils/constants";
|
|
5
|
+
import { ACTION_CONFIG, CONFIG_EVENTS, DEFAULT_TYPE, TAB_NAMES } from "../../../../lib/utils/constants";
|
|
6
6
|
import { UserConfigType } from "../../../../lib/http/data-fetcher/fetchers/form-config-fetcher";
|
|
7
7
|
const CONTAINER_ID = {
|
|
8
8
|
collapsibleBox: "EZ-COLLAPSIBLE-BOX",
|
|
@@ -121,19 +121,30 @@ export class SnkFormConfig {
|
|
|
121
121
|
const snkFieldConfigs = this._formContainer.querySelectorAll('snk-field-config');
|
|
122
122
|
snkFieldConfigs.forEach((snkField) => {
|
|
123
123
|
const fieldConfig = snkField.fieldConfig;
|
|
124
|
-
if (fieldConfig) {
|
|
125
|
-
|
|
126
|
-
cleanOnCopy: fieldConfig.cleanOnCopy || false,
|
|
127
|
-
group: fieldConfig.group,
|
|
128
|
-
label: fieldConfig.label,
|
|
129
|
-
name: fieldConfig.name,
|
|
130
|
-
required: fieldConfig.required,
|
|
131
|
-
readOnly: fieldConfig.readOnly,
|
|
132
|
-
tab: fieldConfig.tab,
|
|
133
|
-
defaultValue: fieldConfig.defaultValue
|
|
134
|
-
};
|
|
135
|
-
fields.push(fieldToSave);
|
|
124
|
+
if (fieldConfig == undefined) {
|
|
125
|
+
return;
|
|
136
126
|
}
|
|
127
|
+
const fieldToSave = {
|
|
128
|
+
cleanOnCopy: fieldConfig.cleanOnCopy || false,
|
|
129
|
+
group: fieldConfig.group,
|
|
130
|
+
label: fieldConfig.label,
|
|
131
|
+
name: fieldConfig.name,
|
|
132
|
+
required: fieldConfig.required,
|
|
133
|
+
readOnly: fieldConfig.readOnly,
|
|
134
|
+
tab: fieldConfig.tab
|
|
135
|
+
};
|
|
136
|
+
if (fieldConfig.defaultValue != undefined) {
|
|
137
|
+
if (fieldConfig.defaultValue.type == undefined) {
|
|
138
|
+
fieldToSave.defaultValue = {
|
|
139
|
+
type: DEFAULT_TYPE.fixed,
|
|
140
|
+
value: fieldConfig.defaultValue
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
fieldToSave.defaultValue = fieldConfig.defaultValue;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
fields.push(fieldToSave);
|
|
137
148
|
});
|
|
138
149
|
return fields;
|
|
139
150
|
}
|
|
@@ -210,8 +221,8 @@ export class SnkFormConfig {
|
|
|
210
221
|
var _a;
|
|
211
222
|
return ((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? group.fields.map((field) => {
|
|
212
223
|
var _a, _b;
|
|
213
|
-
return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
|
214
|
-
h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, onConfigOptionsChanged: (
|
|
224
|
+
return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
|
225
|
+
h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
|
|
215
226
|
}) : h("div", { class: "form-config__add-group-container" }, h("div", { class: "form-config__add-group-content" }, h("div", { class: "form-config__add-group-label" }, h("label", { class: "ez-text ez-text--center ez-text--medium ez-text--primary ez-text--bold" }, this.getMessage("snkFormConfig.form.labelDropField")))));
|
|
216
227
|
}
|
|
217
228
|
handleconfigOptionsChanged(fieldEdited) {
|
|
@@ -939,7 +950,7 @@ export class SnkFormConfig {
|
|
|
939
950
|
return h("div", { class: "ez-flex ez-flex--column ez-size-width--full" }, h("label", { class: "ez-text ez-text--secondary ez-margin-vertical--small" }, this.getMessage("snkFormConfig.form.subTitleInfo")), h("div", { id: CONTAINER_ID.withoutGroup, class: "ez-row", "data-draggable-parent": "field" }, this.getFieldsByGroup(group)), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" }));
|
|
940
951
|
}
|
|
941
952
|
}), this.renderTempGroupByTab(tab.tab))), h("div", { class: "form-config__btn-add-group ez-row" }, h("div", { class: "form-config__btn-add-group-container ez-col ez-col--sd-12 ez-col--tb-12 ez-align--center" }, h("ez-button", { label: this.getMessage("snkFormConfig.form.labelNewGroup"), class: "ez-padding-horizontal--small ez-button--primary", size: "small", onClick: () => this.addNewGroup() }, h("ez-icon", { class: "ez-margin-right--small", slot: "leftIcon", iconName: "plus" })))))), h("div", { class: "form-config__fields-available ez-col ez-col--sd-3 ez-col--tb-3" }, h("section", { class: "ez-box__container ez-col ez-col--pn-12" }, h("h1", { class: "ez-title ez-title--large ez-title--primary ez-padding-bottom--medium" }, this.getMessage("snkFormConfig.availableFields.title")), h("ez-filter-input", { ref: ref => this._filterFieldsAvailable = ref, label: this.getMessage("snkFormConfig.availableFields.labelSearchField"), onEzChange: evt => this.onFilterChange(evt.detail) }), h("span", { class: "ez-box__label-counter ez-text ez-text--medium ez-text--primary ez-margin-bottom--medium" }, this.handleLabelCounter((_c = this._fieldsAvailable) === null || _c === void 0 ? void 0 : _c.length)), ((_d = this._layoutFormConfig) === null || _d === void 0 ? void 0 : _d.length) > 0 &&
|
|
942
|
-
h("div", { id: CONTAINER_ID.fieldsAvailable, class: "ez-row", "data-draggable-parent": "field" }, this.orderFieldsAvailable(this._fieldsAvailable).map((field) => h("div", { key: field.name, class: this._fieldsAvailableStyle, "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, fieldConfig: field })))))))));
|
|
953
|
+
h("div", { id: CONTAINER_ID.fieldsAvailable, class: "ez-row", "data-draggable-parent": "field" }, this.orderFieldsAvailable(this._fieldsAvailable).map((field) => h("div", { key: field.name, class: this._fieldsAvailableStyle, "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, dataUnit: this.dataUnit, fieldConfig: field })))))))));
|
|
943
954
|
}
|
|
944
955
|
static get is() { return "snk-form-config"; }
|
|
945
956
|
static get encapsulation() { return "scoped"; }
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
|
|
65
65
|
/*public*/
|
|
66
66
|
color: var(--text--primary, #626e82);
|
|
67
|
-
font-family: var(--font-pattern, "
|
|
67
|
+
font-family: var(--font-pattern, "Roboto");
|
|
68
68
|
font-size: var(--title--small, 14px);
|
|
69
69
|
padding: var(--space--small, 6px) var(--space--medium, 12px);
|
|
70
70
|
}
|
|
@@ -14,35 +14,35 @@ export default class ParametersFetcher {
|
|
|
14
14
|
}
|
|
15
15
|
}`);
|
|
16
16
|
}
|
|
17
|
-
async getParam(name
|
|
18
|
-
const completPath = `param
|
|
17
|
+
async getParam(name) {
|
|
18
|
+
const completPath = `param://application?params=${name}`;
|
|
19
19
|
return DataFetcher.get().callGraphQL({
|
|
20
20
|
values: { name: completPath },
|
|
21
21
|
query: this.templateByQuery.get("fetchParam"),
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
async asString(name
|
|
25
|
-
const paramArr = await this.getParam(name
|
|
24
|
+
async asString(name) {
|
|
25
|
+
const paramArr = await this.getParam(name);
|
|
26
26
|
return this.getValue(paramArr);
|
|
27
27
|
}
|
|
28
|
-
async asInteger(name
|
|
29
|
-
const paramArr = await this.getParam(name
|
|
28
|
+
async asInteger(name) {
|
|
29
|
+
const paramArr = await this.getParam(name);
|
|
30
30
|
return parseInt(this.getValue(paramArr));
|
|
31
31
|
}
|
|
32
|
-
async asFloat(name
|
|
33
|
-
const paramArr = await this.getParam(name
|
|
32
|
+
async asFloat(name) {
|
|
33
|
+
const paramArr = await this.getParam(name);
|
|
34
34
|
return parseFloat(this.getValue(paramArr));
|
|
35
35
|
}
|
|
36
|
-
async asBoolean(name
|
|
37
|
-
const paramArr = await this.getParam(name
|
|
38
|
-
return this.getValue(paramArr)
|
|
36
|
+
async asBoolean(name) {
|
|
37
|
+
const paramArr = await this.getParam(name);
|
|
38
|
+
return this.getValue(paramArr).includes('"S"');
|
|
39
39
|
}
|
|
40
|
-
async asDate(name
|
|
41
|
-
const paramArr = await this.getParam(name
|
|
40
|
+
async asDate(name) {
|
|
41
|
+
const paramArr = await this.getParam(name);
|
|
42
42
|
return DateUtils.strToDate(this.getValue(paramArr));
|
|
43
43
|
}
|
|
44
|
-
async getBatchParams(names
|
|
45
|
-
const paramArr = await this.getParam(names.join(",")
|
|
44
|
+
async getBatchParams(names) {
|
|
45
|
+
const paramArr = await this.getParam(names.join(","));
|
|
46
46
|
//TODO: try to typed params val?
|
|
47
47
|
const response = {};
|
|
48
48
|
paramArr.forEach((param) => (response[param.name] = param.resource));
|
|
@@ -56,3 +56,17 @@ export const TYPE_ACTIONS = {
|
|
|
56
56
|
export const TAB_NAMES = {
|
|
57
57
|
main: "__main"
|
|
58
58
|
};
|
|
59
|
+
export const TAGS_BY_TYPE = {
|
|
60
|
+
LONGTEXT: "ez-text-area",
|
|
61
|
+
FILE: "ez-upload",
|
|
62
|
+
DATE: "ez-date-input",
|
|
63
|
+
TIME: "ez-time",
|
|
64
|
+
DATETIME: "ez-date-time-input",
|
|
65
|
+
DEFAULT: "ez-text-input",
|
|
66
|
+
SWITCH: "ez-check",
|
|
67
|
+
CHECKBOX: "ez-check",
|
|
68
|
+
OPTIONSELECTOR: "ez-combo-box",
|
|
69
|
+
SEARCH: "ez-search",
|
|
70
|
+
INTEGERNUMBER: "ez-number-input",
|
|
71
|
+
DECIMALNUMBER: "ez-number-input"
|
|
72
|
+
};
|
|
@@ -56,5 +56,19 @@ const TYPE_ACTIONS = {
|
|
|
56
56
|
const TAB_NAMES = {
|
|
57
57
|
main: "__main"
|
|
58
58
|
};
|
|
59
|
+
const TAGS_BY_TYPE = {
|
|
60
|
+
LONGTEXT: "ez-text-area",
|
|
61
|
+
FILE: "ez-upload",
|
|
62
|
+
DATE: "ez-date-input",
|
|
63
|
+
TIME: "ez-time",
|
|
64
|
+
DATETIME: "ez-date-time-input",
|
|
65
|
+
DEFAULT: "ez-text-input",
|
|
66
|
+
SWITCH: "ez-check",
|
|
67
|
+
CHECKBOX: "ez-check",
|
|
68
|
+
OPTIONSELECTOR: "ez-combo-box",
|
|
69
|
+
SEARCH: "ez-search",
|
|
70
|
+
INTEGERNUMBER: "ez-number-input",
|
|
71
|
+
DECIMALNUMBER: "ez-number-input"
|
|
72
|
+
};
|
|
59
73
|
|
|
60
|
-
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K,
|
|
74
|
+
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, TAGS_BY_TYPE as T, VIEW_MODE as V, VARS_BY_TYPE as a, TAB_NAMES as b, TYPE_ACTIONS as c };
|
|
@@ -489,35 +489,35 @@ class ParametersFetcher {
|
|
|
489
489
|
}
|
|
490
490
|
}`);
|
|
491
491
|
}
|
|
492
|
-
async getParam(name
|
|
493
|
-
const completPath = `param
|
|
492
|
+
async getParam(name) {
|
|
493
|
+
const completPath = `param://application?params=${name}`;
|
|
494
494
|
return DataFetcher.get().callGraphQL({
|
|
495
495
|
values: { name: completPath },
|
|
496
496
|
query: this.templateByQuery.get("fetchParam"),
|
|
497
497
|
});
|
|
498
498
|
}
|
|
499
|
-
async asString(name
|
|
500
|
-
const paramArr = await this.getParam(name
|
|
499
|
+
async asString(name) {
|
|
500
|
+
const paramArr = await this.getParam(name);
|
|
501
501
|
return this.getValue(paramArr);
|
|
502
502
|
}
|
|
503
|
-
async asInteger(name
|
|
504
|
-
const paramArr = await this.getParam(name
|
|
503
|
+
async asInteger(name) {
|
|
504
|
+
const paramArr = await this.getParam(name);
|
|
505
505
|
return parseInt(this.getValue(paramArr));
|
|
506
506
|
}
|
|
507
|
-
async asFloat(name
|
|
508
|
-
const paramArr = await this.getParam(name
|
|
507
|
+
async asFloat(name) {
|
|
508
|
+
const paramArr = await this.getParam(name);
|
|
509
509
|
return parseFloat(this.getValue(paramArr));
|
|
510
510
|
}
|
|
511
|
-
async asBoolean(name
|
|
512
|
-
const paramArr = await this.getParam(name
|
|
513
|
-
return this.getValue(paramArr)
|
|
511
|
+
async asBoolean(name) {
|
|
512
|
+
const paramArr = await this.getParam(name);
|
|
513
|
+
return this.getValue(paramArr).includes('"S"');
|
|
514
514
|
}
|
|
515
|
-
async asDate(name
|
|
516
|
-
const paramArr = await this.getParam(name
|
|
515
|
+
async asDate(name) {
|
|
516
|
+
const paramArr = await this.getParam(name);
|
|
517
517
|
return DateUtils.strToDate(this.getValue(paramArr));
|
|
518
518
|
}
|
|
519
|
-
async getBatchParams(names
|
|
520
|
-
const paramArr = await this.getParam(names.join(",")
|
|
519
|
+
async getBatchParams(names) {
|
|
520
|
+
const paramArr = await this.getParam(names.join(","));
|
|
521
521
|
//TODO: try to typed params val?
|
|
522
522
|
const response = {};
|
|
523
523
|
paramArr.forEach((param) => (response[param.name] = param.resource));
|
|
@@ -755,31 +755,31 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
755
755
|
* Retorna o valor de um parâmetro do tipo string.
|
|
756
756
|
*/
|
|
757
757
|
async getStringParam(name) {
|
|
758
|
-
return this.parameters.asString(name
|
|
758
|
+
return this.parameters.asString(name);
|
|
759
759
|
}
|
|
760
760
|
/**
|
|
761
761
|
* Retorna o valor de um parâmetro do tipo Inteiro.
|
|
762
762
|
*/
|
|
763
763
|
async getIntParam(name) {
|
|
764
|
-
return this.parameters.asInteger(name
|
|
764
|
+
return this.parameters.asInteger(name);
|
|
765
765
|
}
|
|
766
766
|
/**
|
|
767
767
|
* Retorna o valor de um parâmetro do tipo Decimal.
|
|
768
768
|
*/
|
|
769
769
|
async getFloatParam(name) {
|
|
770
|
-
return this.parameters.asFloat(name
|
|
770
|
+
return this.parameters.asFloat(name);
|
|
771
771
|
}
|
|
772
772
|
/**
|
|
773
773
|
* Retorna o valor de um parâmetro do tipo booleano.
|
|
774
774
|
*/
|
|
775
775
|
async getBooleanParam(name) {
|
|
776
|
-
return this.parameters.asBoolean(name
|
|
776
|
+
return this.parameters.asBoolean(name);
|
|
777
777
|
}
|
|
778
778
|
/**
|
|
779
779
|
* Retorna o valor de um parâmetro do tipo data.
|
|
780
780
|
*/
|
|
781
781
|
async getDateParam(name) {
|
|
782
|
-
return this.parameters.asDate(name
|
|
782
|
+
return this.parameters.asDate(name);
|
|
783
783
|
}
|
|
784
784
|
/**
|
|
785
785
|
* Mostra o conteúdo passado em um Popup
|
|
@@ -950,6 +950,12 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
950
950
|
async getResourceID() {
|
|
951
951
|
return Promise.resolve(this.resourceID);
|
|
952
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Retorna o resourceID da tela em questão.
|
|
955
|
+
*/
|
|
956
|
+
async getUserID() {
|
|
957
|
+
return Promise.resolve(window["UID"]);
|
|
958
|
+
}
|
|
953
959
|
/**
|
|
954
960
|
* Mostra o diálogo de alerta de acordo com os parâmetros passados.
|
|
955
961
|
*/
|
|
@@ -1246,6 +1252,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1246
1252
|
"createDataunit": [64],
|
|
1247
1253
|
"getDataUnit": [64],
|
|
1248
1254
|
"getResourceID": [64],
|
|
1255
|
+
"getUserID": [64],
|
|
1249
1256
|
"alert": [64],
|
|
1250
1257
|
"error": [64],
|
|
1251
1258
|
"success": [64],
|
|
@@ -19,7 +19,7 @@ class ConfigurableElementsStorage {
|
|
|
19
19
|
ConfigurableElementsStorage._gridById = new Map();
|
|
20
20
|
ConfigurableElementsStorage._formById = new Map();
|
|
21
21
|
|
|
22
|
-
const snkConfigModalCss = ".sc-snk-config-modal-h{--snk-config-modal__button-close--padding-left:var(--space--medium, 12px);--snk-config-modal__title--color:var(--title--primary, #2B3A54);--snk-config-modal__title--font-family:var(--font-pattern, \"
|
|
22
|
+
const snkConfigModalCss = ".sc-snk-config-modal-h{--snk-config-modal__button-close--padding-left:var(--space--medium, 12px);--snk-config-modal__title--color:var(--title--primary, #2B3A54);--snk-config-modal__title--font-family:var(--font-pattern, \"Roboto\");--snk-config-modal__title--font-size:var(--title--large, 20px);--snk-config-modal__title--font-weight:var(--text-weight--extra-large, 700);--snk-config-modal__subtitle--color:var(--title--primary, #2B3A54);--snk-config-modal__subtitle--font-family:var(--font-pattern, \"Roboto\");--snk-config-modal__subtitle--font-size:var(--text--medium, 14px);--snk-config-modal__subtitle--font-weight:var(--text-weight--large, 600);--snk-config-modal__scrollbar--border-radius:var(--border--radius-small, 6px);--snk-config-modal__scrollbar--width:var(--space--medium, 12px);--snk-config-modal__scrollbar--background-color-primary:var(--scrollbar--primary, #2B3A54);--snk-config-modal__scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);display:grid;grid-template-rows:auto 1fr auto;max-height:100%;width:100%}@media screen and (min-width: 480px){.sc-snk-config-modal-h{width:359px;max-width:359px}}.snk-config-modal__button-config.sc-snk-config-modal{--ez-button--min-width:100%}.snk-config-modal__header.sc-snk-config-modal{display:flex;justify-content:space-between;align-items:center;width:100%}.snk-config-modal__title.sc-snk-config-modal{display:flex;margin:0;line-height:normal;letter-spacing:0em;text-align:left;color:var(--snk-config-modal__title--color);font-size:var(--snk-config-modal__title--font-size);font-family:var(--snk-config-modal__title--font-family);font-weight:var(--snk-config-modal__title--font-weight)}.snk-config-modal__subtitle.sc-snk-config-modal{display:flex;margin:0;padding-top:var(--space--medium);padding-bottom:var(--space--small);color:var(--snk-config-modal__subtitle--color);font-size:var(--snk-config-modal__subtitle--font-size);font-family:var(--snk-config-modal__subtitle--font-family);font-weight:var(--snk-config-modal__subtitle--font-weight)}.snk-config-modal__button-close.sc-snk-config-modal{padding-left:var(--snk-config-modal__button-close--padding-left)}.snk-config-modal__main.sc-snk-config-modal{overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--snk-config-modal__scrollbar--background-color-primary) var(--snk-config-modal__scrollbar--background-color-secondary)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar-track{background-color:var(--snk-config-modal__scrollbar--background-color-secondary)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar-thumb{background-color:var(--snk-config-modal__scrollbar--background-color-primary);border-radius:var(--snk-config-modal__scrollbar--border-radius)}.snk-config-modal__main.sc-snk-config-modal::-webkit-scrollbar{background-color:var(--snk-config-modal__scrollbar--background-color-secondary);width:var(--snk-config-modal__scrollbar--width);max-width:var(--snk-config-modal__scrollbar--width);min-width:var(--snk-config-modal__scrollbar--width)}";
|
|
23
23
|
|
|
24
24
|
const GRID_MODE = VIEW_MODE.grid;
|
|
25
25
|
const FORM_MODE = VIEW_MODE.form;
|