@sankhyalabs/sankhyablocks 1.4.0-beta.7 → 1.4.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{SnkMessageBuilder-b54dfb89.js → SnkMessageBuilder-6c2f7bcd.js} +87 -11
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/configurableElementsStorage-93459c72.js +20 -0
- package/dist/cjs/constants-aebcc2f5.js +69 -0
- package/dist/cjs/draggable.bundle-82a25c06.js +6886 -0
- package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
- package/dist/cjs/{index-6fcf07f3.js → index-188190ee.js} +2 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +209 -6976
- package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
- package/dist/cjs/snk-config-options.cjs.entry.js +163 -0
- package/dist/cjs/{snk-filter-bar_5.cjs.entry.js → snk-configurator_6.cjs.entry.js} +193 -6
- package/dist/cjs/snk-crud.cjs.entry.js +13 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
- 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 +1 -1
- 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 +957 -0
- package/dist/cjs/snk-form.cjs.entry.js +146 -0
- package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
- package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
- package/dist/cjs/{taskbar-elements-aedfeae6.js → taskbar-elements-4c2c6704.js} +10 -6
- package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
- package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +27 -1
- package/dist/collection/components/snk-application/snk-application.js +144 -23
- package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
- package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
- package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
- package/dist/collection/components/snk-crud/snk-crud.js +15 -13
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +33 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +3 -3
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-form/snk-form.css +4 -0
- package/dist/collection/components/snk-form/snk-form.js +108 -30
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +248 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
- package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
- package/dist/collection/components/snk-grid/snk-grid.js +92 -22
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
- package/dist/collection/lib/message/SnkMessageBuilder.js +8 -1
- package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
- package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
- package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
- package/dist/collection/lib/utils/constants.js +58 -0
- package/dist/components/SnkMessageBuilder.js +87 -11
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/constants.js +60 -0
- package/dist/components/form-config-fetcher.js +6889 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/components/snk-application2.js +221 -6985
- package/dist/components/snk-config-modal.d.ts +11 -0
- package/dist/components/snk-config-modal.js +6 -0
- package/dist/components/snk-config-modal2.js +91 -0
- package/dist/components/snk-config-options.d.ts +11 -0
- package/dist/components/snk-config-options.js +6 -0
- package/dist/components/snk-config-options2.js +178 -0
- package/dist/components/snk-configurator.d.ts +11 -0
- package/dist/components/snk-configurator.js +6 -0
- package/dist/components/snk-configurator2.js +212 -0
- package/dist/components/snk-crud.js +62 -25
- package/dist/components/snk-field-config.d.ts +11 -0
- package/dist/components/snk-field-config.js +6 -0
- package/dist/components/snk-field-config2.js +70 -0
- package/dist/components/snk-filter-bar2.js +1 -1
- package/dist/components/snk-filter-personalized.js +2 -0
- package/dist/components/snk-form-config.d.ts +11 -0
- package/dist/components/snk-form-config.js +6 -0
- package/dist/components/snk-form-config2.js +996 -0
- package/dist/components/snk-form2.js +79 -29
- package/dist/components/snk-grid2.js +43 -24
- package/dist/components/snk-tab-config.d.ts +11 -0
- package/dist/components/snk-tab-config.js +6 -0
- package/dist/components/snk-tab-config2.js +7220 -0
- package/dist/components/snk-taskbar2.js +27 -9
- package/dist/esm/{SnkMessageBuilder-d440381c.js → SnkMessageBuilder-5792c260.js} +87 -11
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
- package/dist/esm/constants-c4e3341e.js +60 -0
- package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
- package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
- package/dist/esm/{index-81dda3cf.js → index-bafb2cef.js} +2 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +220 -6987
- package/dist/esm/snk-config-modal.entry.js +58 -0
- package/dist/esm/snk-config-options.entry.js +159 -0
- package/dist/esm/{snk-filter-bar_5.entry.js → snk-configurator_6.entry.js} +194 -8
- package/dist/esm/snk-crud.entry.js +13 -11
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-field-config_2.entry.js +130 -0
- 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 +1 -1
- 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 +953 -0
- package/dist/esm/snk-form.entry.js +142 -0
- package/dist/esm/snk-pesquisa.entry.js +1 -1
- package/dist/esm/snk-tab-config.entry.js +317 -0
- package/dist/esm/{taskbar-elements-38eb5d51.js → taskbar-elements-2035b1c7.js} +10 -6
- package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
- package/dist/esm/teste-pesquisa.entry.js +1 -1
- package/dist/sankhyablocks/p-03f9c407.js +1 -0
- package/dist/sankhyablocks/{p-ba426ea9.entry.js → p-04ad681a.entry.js} +1 -1
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-1963b46f.entry.js +1 -0
- package/dist/sankhyablocks/p-21c8929b.js +1 -0
- package/dist/sankhyablocks/p-26c503a6.entry.js +1 -0
- package/dist/sankhyablocks/{p-2e49afef.entry.js → p-31631fb6.entry.js} +1 -1
- package/dist/sankhyablocks/p-361299e8.js +26 -0
- package/dist/sankhyablocks/p-434e0dcf.entry.js +1 -0
- package/dist/sankhyablocks/{p-aecf3e0a.entry.js → p-6c61416a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-49580cdd.entry.js → p-857c4735.entry.js} +1 -1
- package/dist/sankhyablocks/{p-4574a955.entry.js → p-8cd8977c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6386d720.entry.js → p-916068ff.entry.js} +1 -1
- package/dist/sankhyablocks/p-9f2c5fac.entry.js +1 -0
- package/dist/sankhyablocks/p-ad658f44.js +1 -0
- package/dist/sankhyablocks/p-ae302037.entry.js +75 -0
- package/dist/sankhyablocks/p-af11b0e7.js +1 -0
- package/dist/sankhyablocks/p-af306302.entry.js +1 -0
- package/dist/sankhyablocks/p-b6d6b172.js +1 -0
- package/dist/sankhyablocks/{p-40b27004.entry.js → p-cc85ba53.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0352c0e2.entry.js → p-ccdf59eb.entry.js} +1 -1
- package/dist/sankhyablocks/p-ce789145.entry.js +1 -0
- package/dist/sankhyablocks/p-cf81e313.entry.js +1 -0
- package/dist/sankhyablocks/{p-0ea25487.entry.js → p-d1ae76ec.entry.js} +1 -1
- package/dist/sankhyablocks/p-d50651a3.js +1 -0
- package/dist/sankhyablocks/{p-fac2b6a9.js → p-ddb03141.js} +2 -2
- package/dist/sankhyablocks/p-ee906940.entry.js +1 -0
- package/dist/sankhyablocks/{p-5bdb8452.entry.js → p-f9084ecb.entry.js} +1 -1
- package/dist/sankhyablocks/p-fa75fba5.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +29 -14
- package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
- package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
- package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +8 -6
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +3 -3
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +65 -0
- package/dist/types/components/snk-form/snk-form.d.ts +71 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +41 -0
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
- package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
- package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
- package/dist/types/components.d.ts +358 -13
- package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
- package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
- package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
- package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
- package/dist/types/lib/utils/constants.d.ts +62 -0
- package/dist/types/lib/utils/pesquisa.d.ts +2 -1
- package/package.json +4 -3
- package/react/components.d.ts +6 -0
- package/react/components.js +6 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/snk-form_2.cjs.entry.js +0 -247
- package/dist/esm/snk-form_2.entry.js +0 -242
- package/dist/sankhyablocks/p-21e940aa.entry.js +0 -1
- package/dist/sankhyablocks/p-2eea7eea.js +0 -1
- package/dist/sankhyablocks/p-42036db1.entry.js +0 -84
- package/dist/sankhyablocks/p-77216252.entry.js +0 -1
- package/dist/sankhyablocks/p-86f15ffe.js +0 -1
- package/dist/sankhyablocks/p-97009a2c.entry.js +0 -1
- package/dist/sankhyablocks/p-a14c49db.entry.js +0 -1
package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { formFieldBuilder } from "@sankhyalabs/ezui/dist/collection/utils";
|
|
4
|
+
import { DataType, getConvertedValue } from "@sankhyalabs/core/dist/dataunit/metadata/DataType";
|
|
5
|
+
import { CONFIG_EVENTS, DEFAULT_TYPE, VARS_BY_TYPE } from "../../../../lib/utils/constants";
|
|
6
|
+
export class SnkConfigOptions {
|
|
7
|
+
constructor() {
|
|
8
|
+
/**
|
|
9
|
+
* Armazena as propriedades do campo
|
|
10
|
+
*/
|
|
11
|
+
this.fieldConfig = {};
|
|
12
|
+
}
|
|
13
|
+
onConfigDefault(optionSelected) {
|
|
14
|
+
if (optionSelected != undefined) {
|
|
15
|
+
this._defaultType = optionSelected;
|
|
16
|
+
this.fieldConfig.defaultValue = {
|
|
17
|
+
type: this._defaultType
|
|
18
|
+
};
|
|
19
|
+
this.configOptionsChanged.emit(this.fieldConfig);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
buildOptions() {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
const interfaceField = (_c = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name)) === null || _c === void 0 ? void 0 : _c.userInterface;
|
|
25
|
+
return VARS_BY_TYPE.UserInterface[interfaceField];
|
|
26
|
+
}
|
|
27
|
+
enabledValueDefault() {
|
|
28
|
+
var _a, _b, _c;
|
|
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
|
+
if (((_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault) === "true" && VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
getFieldProperties(field) {
|
|
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) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
if (fieldValue == undefined) {
|
|
51
|
+
return;
|
|
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);
|
|
71
|
+
}
|
|
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
|
+
});
|
|
95
|
+
}
|
|
96
|
+
loadDefaultValue() {
|
|
97
|
+
var _a;
|
|
98
|
+
if (this.fieldConfig == undefined) {
|
|
99
|
+
this._defaultType = DEFAULT_TYPE.fixed;
|
|
100
|
+
this.fieldConfig = {
|
|
101
|
+
defaultValue: {
|
|
102
|
+
type: this._defaultType
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
|
|
107
|
+
this._defaultType = DEFAULT_TYPE.fixed;
|
|
108
|
+
this.fieldConfig.defaultValue = {
|
|
109
|
+
type: this._defaultType
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this._defaultType = this.fieldConfig.defaultValue.type;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
getEnabledByProperty(property) {
|
|
117
|
+
const properties = this._fieldProperties;
|
|
118
|
+
if (properties != undefined && properties[property] === true) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
getValueByProperty(property) {
|
|
124
|
+
const properties = this._fieldProperties;
|
|
125
|
+
if (properties != undefined && properties[property] === true) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return this.fieldConfig[property];
|
|
129
|
+
}
|
|
130
|
+
componentWillLoad() {
|
|
131
|
+
var _a;
|
|
132
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
133
|
+
this.loadDefaultValue();
|
|
134
|
+
this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
|
|
135
|
+
}
|
|
136
|
+
componentDidRender() {
|
|
137
|
+
this.loadDataField();
|
|
138
|
+
}
|
|
139
|
+
render() {
|
|
140
|
+
var _a, _b, _c, _d;
|
|
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: ((_c = (_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c.allowDefault) === "true", 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 ?
|
|
142
|
+
h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.enabledValueDefault(), 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
|
+
:
|
|
144
|
+
((_d = this._fieldProperties) === null || _d === void 0 ? void 0 : _d.userInterface) &&
|
|
145
|
+
formFieldBuilder({
|
|
146
|
+
descriptor: this._fieldProperties,
|
|
147
|
+
config: this.fieldConfig
|
|
148
|
+
}).$children$)), 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: "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: "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: "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
|
+
}
|
|
150
|
+
static get is() { return "snk-config-options"; }
|
|
151
|
+
static get encapsulation() { return "scoped"; }
|
|
152
|
+
static get originalStyleUrls() {
|
|
153
|
+
return {
|
|
154
|
+
"$": ["snk-config-options.css"]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
static get styleUrls() {
|
|
158
|
+
return {
|
|
159
|
+
"$": ["snk-config-options.css"]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
static get properties() {
|
|
163
|
+
return {
|
|
164
|
+
"fieldConfig": {
|
|
165
|
+
"type": "unknown",
|
|
166
|
+
"mutable": false,
|
|
167
|
+
"complexType": {
|
|
168
|
+
"original": "IFieldConfig",
|
|
169
|
+
"resolved": "IFieldConfig",
|
|
170
|
+
"references": {
|
|
171
|
+
"IFieldConfig": {
|
|
172
|
+
"location": "import",
|
|
173
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "Armazena as propriedades do campo"
|
|
182
|
+
},
|
|
183
|
+
"defaultValue": "{} as IFieldConfig"
|
|
184
|
+
},
|
|
185
|
+
"idConfig": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "string",
|
|
190
|
+
"resolved": "string",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "Armazena a chave de op\u00E7\u00F5es de configura\u00E7\u00E3o"
|
|
198
|
+
},
|
|
199
|
+
"attribute": "id-config",
|
|
200
|
+
"reflect": true
|
|
201
|
+
},
|
|
202
|
+
"dataUnit": {
|
|
203
|
+
"type": "unknown",
|
|
204
|
+
"mutable": false,
|
|
205
|
+
"complexType": {
|
|
206
|
+
"original": "DataUnit",
|
|
207
|
+
"resolved": "DataUnit",
|
|
208
|
+
"references": {
|
|
209
|
+
"DataUnit": {
|
|
210
|
+
"location": "import",
|
|
211
|
+
"path": "@sankhyalabs/core"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"required": false,
|
|
216
|
+
"optional": false,
|
|
217
|
+
"docs": {
|
|
218
|
+
"tags": [],
|
|
219
|
+
"text": "Reposit\u00F3rio de dados respons\u00E1vel por controlar a manipula\u00E7\u00E3o dos dados"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
static get states() {
|
|
225
|
+
return {
|
|
226
|
+
"_defaultType": {}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
static get events() {
|
|
230
|
+
return [{
|
|
231
|
+
"method": "configOptionsChanged",
|
|
232
|
+
"name": "configOptionsChanged",
|
|
233
|
+
"bubbles": true,
|
|
234
|
+
"cancelable": true,
|
|
235
|
+
"composed": true,
|
|
236
|
+
"docs": {
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": "Evento disparado ao realizar alguma altera\u00E7\u00E3o nos campos"
|
|
239
|
+
},
|
|
240
|
+
"complexType": {
|
|
241
|
+
"original": "any",
|
|
242
|
+
"resolved": "any",
|
|
243
|
+
"references": {}
|
|
244
|
+
}
|
|
245
|
+
}];
|
|
246
|
+
}
|
|
247
|
+
static get elementRef() { return "_element"; }
|
|
248
|
+
}
|
package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/* dimensions */
|
|
3
|
+
/*@doc Define a altura do componente.*/
|
|
4
|
+
--snk-field-config--height: 42px;
|
|
5
|
+
/*@doc Define a largura do componente.*/
|
|
6
|
+
--snk-field-config--width: 100%;
|
|
7
|
+
/*@doc Define a largura do slot que contém o ícone.*/
|
|
8
|
+
--snk-field-config__icon--width: 48px;
|
|
9
|
+
/*@doc Define a altura do componente em modo "slim".*/
|
|
10
|
+
--snk-field-config--height--slim: 32px;
|
|
11
|
+
|
|
12
|
+
/* general */
|
|
13
|
+
/*@doc Define o raio da borda do input do componente.*/
|
|
14
|
+
--snk-field-config--border-radius: var(--border--radius-medium, 12px);
|
|
15
|
+
/*@doc Define o tamanho da fonte do input e label do componente.*/
|
|
16
|
+
--snk-field-config--font-size: var(--text--medium, 14px);
|
|
17
|
+
/*@doc Define a família da fonte do input, label e caixa de mensagem do componente.*/
|
|
18
|
+
--snk-field-config--font-family: var(--font-pattern, Arial);
|
|
19
|
+
/*@doc Define o peso da fonte do label do componente.*/
|
|
20
|
+
--snk-field-config--font-weight: var(--text-weight--medium, 400);
|
|
21
|
+
/*@doc Define a cor da fonte do input e label do componente.*/
|
|
22
|
+
--snk-field-config--color: var(--title--primary, #000);
|
|
23
|
+
|
|
24
|
+
/* input */
|
|
25
|
+
/*@doc Define a cor de fundo do input.*/
|
|
26
|
+
--snk-field-config__input--background-color: var(--background--medium, #e0e0e0);
|
|
27
|
+
/*@doc Define o estilo da borda do input.*/
|
|
28
|
+
--snk-field-config__input--border: var(--border--medium, 2px solid);
|
|
29
|
+
/*@doc Define a cor da borda do input.*/
|
|
30
|
+
--snk-field-config__input--border-color: var(--background--xlight, #fff);
|
|
31
|
+
/*no modo normal usamos a borda com a mesma cor do bg*/
|
|
32
|
+
--snk-field-config__required--color: var(--color--error, #FF0000);
|
|
33
|
+
|
|
34
|
+
/*no modo normal usamos a borda com a mesma cor do bg*/
|
|
35
|
+
--snk-field-config__transition--visibility: var(--transition, 0.2s linear);
|
|
36
|
+
--snk-field-config__transition--opacity: var(--transition, 0.15s linear);
|
|
37
|
+
|
|
38
|
+
/***************
|
|
39
|
+
host style
|
|
40
|
+
***************/
|
|
41
|
+
/*private*/
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
position: relative;
|
|
45
|
+
|
|
46
|
+
/*public*/
|
|
47
|
+
width: var(--snk-field-config--width);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.field-config {
|
|
51
|
+
/*private*/
|
|
52
|
+
width: 100%;
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
|
|
57
|
+
/*public*/
|
|
58
|
+
padding-left: var(--space--medium, 6px);
|
|
59
|
+
font-weight: var(--snk-field-config--font-weight);
|
|
60
|
+
height: var(--snk-field-config--height);
|
|
61
|
+
border-radius: var(--snk-field-config--border-radius);
|
|
62
|
+
font-family: var(--snk-field-config--font-family);
|
|
63
|
+
font-size: var(--snk-field-config--font-size);
|
|
64
|
+
border: var(--snk-field-config__input--border);
|
|
65
|
+
border-color: var(--snk-field-config__input--border-color);
|
|
66
|
+
background-color: var(--snk-field-config__input--background-color);
|
|
67
|
+
color: var(--snk-field-config--color);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.field-config__config-popover {
|
|
71
|
+
width: 40px;
|
|
72
|
+
margin-left: auto;
|
|
73
|
+
z-index: var(--more-visible, 2);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.field-config__required-label {
|
|
77
|
+
padding-left: var(--space--extra-small, 3px);
|
|
78
|
+
|
|
79
|
+
/*public*/
|
|
80
|
+
color: var(--snk-field-config__required--color);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.field-config__add {
|
|
84
|
+
display: flex;
|
|
85
|
+
margin-left: auto;
|
|
86
|
+
|
|
87
|
+
visibility:hidden;
|
|
88
|
+
opacity:0;
|
|
89
|
+
transition: visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
.field-config__options {
|
|
94
|
+
display: flex;
|
|
95
|
+
margin-left: auto;
|
|
96
|
+
|
|
97
|
+
visibility:hidden;
|
|
98
|
+
opacity:0;
|
|
99
|
+
transition: visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.field-config__options--is-active {
|
|
103
|
+
display: flex;
|
|
104
|
+
visibility:visible;
|
|
105
|
+
opacity:1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.field-config__remove-icon {
|
|
109
|
+
margin-right: -15px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.field-config:hover .field-config__options {
|
|
113
|
+
display: flex;
|
|
114
|
+
visibility:visible;
|
|
115
|
+
opacity:1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.field-config:hover .field-config__add {
|
|
119
|
+
visibility:visible;
|
|
120
|
+
opacity:1;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
.field-config__draggable {
|
|
125
|
+
padding-right: var(--space--small, 6px);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.field-config__config-outer-arrow {
|
|
129
|
+
background-color: var(--color--secondary-200);
|
|
130
|
+
clip-path: polygon(50% 0, 90% 100%, 10% 100%);
|
|
131
|
+
border-radius: 0.25em 0 0 0;
|
|
132
|
+
width: 30px;
|
|
133
|
+
height: 15px;
|
|
134
|
+
padding-top: 3px;
|
|
135
|
+
border-bottom: 1px solid #FFFFFF;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.field-config__config-inner-arrow {
|
|
139
|
+
background-color: #FFFFFF;
|
|
140
|
+
clip-path: polygon(50% 0, 90% 100%, 10% 100%);
|
|
141
|
+
border-radius: 0.25em 0 0 0;
|
|
142
|
+
width: 30px;
|
|
143
|
+
height: 15px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ez-box__container ez-collapsible-box {
|
|
147
|
+
--snk-collapsible-box__header--padding-left: 6px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
ez-icon {
|
|
151
|
+
/*public*/
|
|
152
|
+
--snk-icon--color: var(--snk-field-config--color)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
ez-popover {
|
|
156
|
+
--snk-popover__box--background-color: transparent;
|
|
157
|
+
--snk-popover__box--box-shadow: none
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.field-config__options ez-button {
|
|
161
|
+
--snk-button--background-color: transparent;
|
|
162
|
+
--snk-button--focus--border: none;
|
|
163
|
+
--snk-button--focus--box-shadow: none;
|
|
164
|
+
}
|
package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { ApplicationContext } from "@sankhyalabs/core";
|
|
2
|
+
import { h, Host } from "@stencil/core";
|
|
3
|
+
import { ACTION_CONFIG } from "../../../../lib/utils/constants";
|
|
4
|
+
export class SnkFieldConfig {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Define se o popover de configuração está ativo.
|
|
8
|
+
*/
|
|
9
|
+
this.isConfigActive = false;
|
|
10
|
+
/**
|
|
11
|
+
* Define se o componente está em modo de inserção
|
|
12
|
+
*/
|
|
13
|
+
this.modeInsertion = true;
|
|
14
|
+
}
|
|
15
|
+
handleAction(evt, type) {
|
|
16
|
+
evt.preventDefault();
|
|
17
|
+
evt.stopPropagation();
|
|
18
|
+
const field = this.fieldConfig;
|
|
19
|
+
if (type !== ACTION_CONFIG.configuration) {
|
|
20
|
+
field.group = undefined;
|
|
21
|
+
}
|
|
22
|
+
this.ezClickIcon.emit({ field, type });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
|
|
26
|
+
* através de um pequeno modulo na estrutura da aplicação:
|
|
27
|
+
* - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
|
|
28
|
+
* Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
|
|
29
|
+
*/
|
|
30
|
+
getMessage(key) {
|
|
31
|
+
return this._application.messagesBuilder.getMessage(key, {});
|
|
32
|
+
}
|
|
33
|
+
componentWillLoad() {
|
|
34
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
if (this.fieldConfig == undefined) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
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.fieldConfig.required && h("span", { class: "field-config__required-label" }, "*")), this.modeInsertion ?
|
|
41
|
+
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
|
+
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
|
+
}
|
|
44
|
+
static get is() { return "snk-field-config"; }
|
|
45
|
+
static get encapsulation() { return "scoped"; }
|
|
46
|
+
static get originalStyleUrls() {
|
|
47
|
+
return {
|
|
48
|
+
"$": ["snk-field-config.css"]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
static get styleUrls() {
|
|
52
|
+
return {
|
|
53
|
+
"$": ["snk-field-config.css"]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
static get properties() {
|
|
57
|
+
return {
|
|
58
|
+
"isConfigActive": {
|
|
59
|
+
"type": "unknown",
|
|
60
|
+
"mutable": false,
|
|
61
|
+
"complexType": {
|
|
62
|
+
"original": "Boolean",
|
|
63
|
+
"resolved": "Boolean",
|
|
64
|
+
"references": {
|
|
65
|
+
"Boolean": {
|
|
66
|
+
"location": "global"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"required": false,
|
|
71
|
+
"optional": false,
|
|
72
|
+
"docs": {
|
|
73
|
+
"tags": [],
|
|
74
|
+
"text": "Define se o popover de configura\u00E7\u00E3o est\u00E1 ativo."
|
|
75
|
+
},
|
|
76
|
+
"defaultValue": "false"
|
|
77
|
+
},
|
|
78
|
+
"fieldConfig": {
|
|
79
|
+
"type": "unknown",
|
|
80
|
+
"mutable": false,
|
|
81
|
+
"complexType": {
|
|
82
|
+
"original": "IFieldConfig",
|
|
83
|
+
"resolved": "IFieldConfig",
|
|
84
|
+
"references": {
|
|
85
|
+
"IFieldConfig": {
|
|
86
|
+
"location": "import",
|
|
87
|
+
"path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"required": false,
|
|
92
|
+
"optional": false,
|
|
93
|
+
"docs": {
|
|
94
|
+
"tags": [],
|
|
95
|
+
"text": "Armazena as propriedades do campo"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"modeInsertion": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"mutable": false,
|
|
101
|
+
"complexType": {
|
|
102
|
+
"original": "boolean",
|
|
103
|
+
"resolved": "boolean",
|
|
104
|
+
"references": {}
|
|
105
|
+
},
|
|
106
|
+
"required": false,
|
|
107
|
+
"optional": false,
|
|
108
|
+
"docs": {
|
|
109
|
+
"tags": [],
|
|
110
|
+
"text": "Define se o componente est\u00E1 em modo de inser\u00E7\u00E3o"
|
|
111
|
+
},
|
|
112
|
+
"attribute": "mode-insertion",
|
|
113
|
+
"reflect": true,
|
|
114
|
+
"defaultValue": "true"
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
static get events() {
|
|
119
|
+
return [{
|
|
120
|
+
"method": "ezClickIcon",
|
|
121
|
+
"name": "ezClickIcon",
|
|
122
|
+
"bubbles": true,
|
|
123
|
+
"cancelable": true,
|
|
124
|
+
"composed": true,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "Evento disparado ao pressionar button icon(onEzClickIcon)"
|
|
128
|
+
},
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "Object",
|
|
131
|
+
"resolved": "Object",
|
|
132
|
+
"references": {
|
|
133
|
+
"Object": {
|
|
134
|
+
"location": "global"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}];
|
|
139
|
+
}
|
|
140
|
+
}
|