@sankhyalabs/ezui 1.1.77 → 1.1.80
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/{AssetsUtils-dd585fba.js → AssetsUtils-02db4f46.js} +1 -1
- package/dist/cjs/CSSVarsUtils-66e86394.js +18 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -3
- package/dist/cjs/ez-button_3.cjs.entry.js +520 -0
- package/dist/cjs/ez-calendar_13.cjs.entry.js +2421 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +26 -37
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +14 -1410
- package/dist/cjs/ez-icon.cjs.entry.js +30 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +370 -0
- package/dist/cjs/ez-popover.cjs.entry.js +2 -2
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +4 -4
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-4e4bae01.js → index-2003dec4.js} +0 -10
- package/dist/cjs/{index-262d703b.js → index-a2266984.js} +18 -43
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +0 -2
- package/dist/collection/components/ez-application/ez-application.js +0 -2
- package/dist/collection/components/ez-calendar/ez-calendar.js +7 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +0 -5
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +4 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +2 -2
- package/dist/collection/components/ez-date-input/ez-date-input.js +1 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +0 -5
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +23 -34
- package/dist/collection/components/ez-form/DataBinder.js +44 -0
- package/dist/collection/components/ez-form/ez-form.css +1 -15
- package/dist/collection/components/ez-form/ez-form.js +112 -427
- package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +45 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +11 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +14 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +13 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +5 -0
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +5 -0
- package/dist/collection/components/ez-form/store/form.slice.js +38 -0
- package/dist/collection/components/ez-form/structure/FormItem.js +11 -0
- package/dist/collection/components/ez-form/structure/FormSheet.js +5 -0
- package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +86 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +0 -9
- package/dist/collection/components/ez-number-input/ez-number-input.js +20 -115
- package/dist/collection/components/ez-search/ez-search.js +6 -1
- package/dist/collection/components/test-du/test-du.js +65 -23
- package/dist/collection/utils/CSSVarsUtils.js +6 -6
- package/dist/custom-elements/index.d.ts +0 -12
- package/dist/custom-elements/index.js +530 -2278
- package/dist/esm/{AssetsUtils-3803e935.js → AssetsUtils-76ca41e1.js} +1 -1
- package/dist/esm/CSSVarsUtils-aeee9825.js +16 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -3
- package/dist/esm/ez-button_3.entry.js +514 -0
- package/dist/esm/ez-calendar_13.entry.js +2405 -0
- package/dist/esm/ez-date-time-input.entry.js +26 -37
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +4 -1390
- package/dist/esm/ez-icon.entry.js +26 -0
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-modal_2.entry.js +365 -0
- package/dist/esm/ez-popover.entry.js +2 -2
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +4 -4
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-1dacecd3.js → index-077c7fcf.js} +0 -10
- package/dist/esm/{index-cfd5e193.js → index-afe19542.js} +17 -40
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-00b837e2.js +1 -0
- package/dist/ezui/{p-516d0e0f.entry.js → p-0a2056d9.entry.js} +1 -1
- package/dist/ezui/p-0d8368fc.entry.js +1 -0
- package/dist/ezui/p-1e36e3ff.entry.js +1 -0
- package/dist/ezui/p-446ec85b.js +1 -0
- package/dist/ezui/p-49f3432a.entry.js +1 -0
- package/dist/ezui/{p-1ea8187e.entry.js → p-5509ee41.entry.js} +46 -46
- package/dist/ezui/{p-a18a2d7b.entry.js → p-57ea4b84.entry.js} +1 -1
- package/dist/ezui/{p-5a86e18a.entry.js → p-6d157776.entry.js} +1 -1
- package/dist/ezui/{p-8c51a6aa.entry.js → p-7a1f2e0e.entry.js} +1 -1
- package/dist/ezui/p-7de3c95d.js +1 -0
- package/dist/ezui/{p-7ef97c5f.entry.js → p-857ead8e.entry.js} +1 -1
- package/dist/ezui/p-8b099482.js +1 -0
- package/dist/ezui/{p-c6d469fc.entry.js → p-920bb8c9.entry.js} +1 -1
- package/dist/ezui/p-a4a39579.entry.js +1 -0
- package/dist/ezui/p-d5699f29.entry.js +1 -0
- package/dist/ezui/p-d64a3939.entry.js +1 -0
- package/dist/ezui/{p-5da66d3e.entry.js → p-da31cd21.entry.js} +1 -1
- package/dist/types/components/ez-application/ez-application.d.ts +0 -2
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -0
- package/dist/types/components/ez-form/DataBinder.d.ts +10 -0
- package/dist/types/components/ez-form/ez-form.d.ts +25 -32
- package/dist/types/components/ez-form/fieldbuilder/FieldBuilder.d.ts +2 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.d.ts +3 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +8 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +4 -0
- package/dist/types/components/ez-form/store/form.slice.d.ts +24 -0
- package/dist/types/components/ez-form/structure/FormItem.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheet.d.ts +9 -0
- package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +27 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -20
- package/dist/types/components/ez-search/ez-search.d.ts +2 -0
- package/dist/types/components/test-du/test-du.d.ts +8 -2
- package/dist/types/components.d.ts +12 -82
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +0 -2
- package/react/components.js +0 -2
- package/react/components.js.map +1 -1
- package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
- package/dist/cjs/CSSVarsUtils-f8827674.js +0 -18
- package/dist/cjs/DataUnit-fdd7c70e.js +0 -474
- package/dist/cjs/ez-calendar.cjs.entry.js +0 -212
- package/dist/cjs/ez-collapsible-box_6.cjs.entry.js +0 -630
- package/dist/cjs/ez-combo-box.cjs.entry.js +0 -250
- package/dist/cjs/ez-form.cjs.entry.js +0 -1838
- package/dist/cjs/ez-number-input.cjs.entry.js +0 -121
- package/dist/cjs/form-metadata.cjs.entry.js +0 -129
- package/dist/collection/components/ez-form/assets/trash-can-outline.svg +0 -3
- package/dist/collection/components/ez-form/store/Form.actions.js +0 -132
- package/dist/collection/components/ez-form/store/Form.reducer.js +0 -194
- package/dist/collection/components/ez-form/store/Form.selectors.js +0 -44
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +0 -301
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +0 -8
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +0 -24
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +0 -227
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +0 -14
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +0 -95
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +0 -27
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +0 -41
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +0 -37
- package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
- package/dist/esm/CSSVarsUtils-e0128b01.js +0 -16
- package/dist/esm/DataUnit-1cd45202.js +0 -464
- package/dist/esm/ez-calendar.entry.js +0 -208
- package/dist/esm/ez-collapsible-box_6.entry.js +0 -621
- package/dist/esm/ez-combo-box.entry.js +0 -246
- package/dist/esm/ez-form.entry.js +0 -1834
- package/dist/esm/ez-number-input.entry.js +0 -117
- package/dist/esm/form-metadata.entry.js +0 -125
- package/dist/ezui/assets/trash-can-outline.svg +0 -3
- package/dist/ezui/p-37a611ea.js +0 -1
- package/dist/ezui/p-45689464.entry.js +0 -1
- package/dist/ezui/p-57291f97.entry.js +0 -1
- package/dist/ezui/p-69416bec.entry.js +0 -1
- package/dist/ezui/p-7107d7ef.js +0 -1
- package/dist/ezui/p-88f45a83.entry.js +0 -1
- package/dist/ezui/p-8f4851a6.js +0 -1
- package/dist/ezui/p-9dfd537e.js +0 -1
- package/dist/ezui/p-a223eed8.entry.js +0 -1
- package/dist/ezui/p-b36308e7.js +0 -1
- package/dist/ezui/p-c0af195b.entry.js +0 -1
- package/dist/ezui/p-d1889704.js +0 -1
- package/dist/ezui/p-e7ee2836.entry.js +0 -1
- package/dist/ezui/p-f7b835cf.entry.js +0 -1
- package/dist/types/components/ez-form/store/Form.actions.d.ts +0 -111
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +0 -20
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +0 -91
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +0 -24
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +0 -16
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +0 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +0 -11
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +0 -13
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +0 -14
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +0 -19
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const buildComboBox = ({ name, label }, properties) => {
|
|
3
|
+
const prop = properties === null || properties === void 0 ? void 0 : properties.options;
|
|
4
|
+
let options;
|
|
5
|
+
if (typeof prop === "string") {
|
|
6
|
+
const parsed = JSON.parse(prop);
|
|
7
|
+
options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
options = prop;
|
|
11
|
+
}
|
|
12
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
13
|
+
h("ez-combo-box", { label: label, "data-field-name": name, key: name, options: options })));
|
|
14
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const buildFile = ({ name, label }) => {
|
|
3
|
+
return (h("div", { class: "col col--sd-12 padding--small" },
|
|
4
|
+
h("ez-upload", { label: label, urlUpload: "", requestHeaders: "", maxFiles: 10, "data-field-name": name, key: name })));
|
|
5
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const buildDecimal = ({ name, label }, properties) => {
|
|
3
|
+
const precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
|
|
4
|
+
const prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
|
|
5
|
+
return buildNumeric(name, label, precision, prettyPrecision);
|
|
6
|
+
};
|
|
7
|
+
export const buildInteger = ({ name, label }) => {
|
|
8
|
+
return buildNumeric(name, label, 0, 0);
|
|
9
|
+
};
|
|
10
|
+
function buildNumeric(fieldName, fieldLabel, precision, prettyPrecision) {
|
|
11
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
12
|
+
h("ez-number-input", { label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, key: fieldName })));
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const buildSearch = ({ name, label }) => {
|
|
3
|
+
return (h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
|
|
4
|
+
h("ez-search", { label: label, optionLoader: (_argument) => { }, "data-field-name": name, key: name })));
|
|
5
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const inicialState = {};
|
|
2
|
+
/////////////////////////////// REDUCERS ///////////////////////////////
|
|
3
|
+
export function formReducer(state = inicialState, action) {
|
|
4
|
+
switch (action.type) {
|
|
5
|
+
case FormActions.METADATA_LOADED:
|
|
6
|
+
return Object.assign(Object.assign({}, state), { formMetadata: action.payload });
|
|
7
|
+
case FormActions.CHANGE_TAB:
|
|
8
|
+
return Object.assign(Object.assign({}, state), { currentSheet: action.payload });
|
|
9
|
+
default:
|
|
10
|
+
return state;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/////////////////////////////// ACTION CREATORS ///////////////////////////////
|
|
14
|
+
export function loadMetadata(formMetadata) {
|
|
15
|
+
return {
|
|
16
|
+
type: FormActions.METADATA_LOADED,
|
|
17
|
+
payload: formMetadata
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function changeTab(currentSheet) {
|
|
21
|
+
return {
|
|
22
|
+
type: FormActions.CHANGE_TAB,
|
|
23
|
+
payload: currentSheet
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/////////////////////////////// SELECTORS ///////////////////////////////
|
|
27
|
+
export function selectFormMetadata(state) {
|
|
28
|
+
return state.formMetadata;
|
|
29
|
+
}
|
|
30
|
+
export function selectCurrentSheet(state) {
|
|
31
|
+
return state.currentSheet ? state.formMetadata.getSheet(state.currentSheet) : Array.from(state.formMetadata.getAllSheets().values())[0];
|
|
32
|
+
}
|
|
33
|
+
/////////////////////////////// TYPES ///////////////////////////////
|
|
34
|
+
var FormActions;
|
|
35
|
+
(function (FormActions) {
|
|
36
|
+
FormActions["METADATA_LOADED"] = "FORM/METADATA_LOADED";
|
|
37
|
+
FormActions["CHANGE_TAB"] = "FORM/CHANGE_TAB";
|
|
38
|
+
})(FormActions || (FormActions = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { buildField } from "../fieldbuilder/FieldBuilder";
|
|
3
|
+
export const FormItem = ({ source }) => {
|
|
4
|
+
if ("items" in source) {
|
|
5
|
+
const fieldSet = source;
|
|
6
|
+
return h("ez-collapsible-box", { label: source.label }, fieldSet.items.map(fi => buildField(fi)));
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return buildField(source);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export class FormMetadata {
|
|
2
|
+
constructor() {
|
|
3
|
+
this._sheets = new Map();
|
|
4
|
+
this._requiredFields = [];
|
|
5
|
+
}
|
|
6
|
+
getSheet(name) {
|
|
7
|
+
return this._sheets.get(name);
|
|
8
|
+
}
|
|
9
|
+
getAllSheets() {
|
|
10
|
+
return this._sheets;
|
|
11
|
+
}
|
|
12
|
+
addSheet(sheet) {
|
|
13
|
+
this._sheets.set(sheet.name, sheet);
|
|
14
|
+
this._requiredFields = this._requiredFields.concat(sheet.requiredFields);
|
|
15
|
+
}
|
|
16
|
+
getRequiredFields() {
|
|
17
|
+
return this._requiredFields;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const buildFromDataUnit = (dataUnit) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const unitMD = dataUnit.metadata;
|
|
23
|
+
const metadata = new FormMetadata();
|
|
24
|
+
if (unitMD) {
|
|
25
|
+
const visibleFields = (_a = unitMD.fields) === null || _a === void 0 ? void 0 : _a.filter(descriptor => descriptor.visible !== false);
|
|
26
|
+
metadata.addSheet({
|
|
27
|
+
label: unitMD.label,
|
|
28
|
+
name: unitMD.name,
|
|
29
|
+
items: visibleFields.map(descriptor => { return { descriptor }; }),
|
|
30
|
+
requiredFields: visibleFields
|
|
31
|
+
.filter(descriptor => descriptor.required)
|
|
32
|
+
.map(descriptor => descriptor.name)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return metadata;
|
|
36
|
+
};
|
|
37
|
+
export const buildFromConfig = (fields, dataUnit) => {
|
|
38
|
+
const sheets = new Map();
|
|
39
|
+
const requiredFields = [];
|
|
40
|
+
fields.forEach(config => {
|
|
41
|
+
if (config.visible !== false) {
|
|
42
|
+
const tab = config.tab || "Geral";
|
|
43
|
+
const descriptor = dataUnit.getField(config.name);
|
|
44
|
+
if (!sheets.has(tab)) {
|
|
45
|
+
sheets.set(tab, new Map());
|
|
46
|
+
}
|
|
47
|
+
let isRequired = false;
|
|
48
|
+
if (config.required === undefined) {
|
|
49
|
+
if (descriptor) {
|
|
50
|
+
isRequired = descriptor.required;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
isRequired = config.required;
|
|
55
|
+
}
|
|
56
|
+
if (isRequired) {
|
|
57
|
+
requiredFields.push(config.name);
|
|
58
|
+
}
|
|
59
|
+
const tabItens = sheets.get(tab);
|
|
60
|
+
const fieldMD = { config, descriptor };
|
|
61
|
+
const group = config.group;
|
|
62
|
+
if (group) {
|
|
63
|
+
const key = `group::${group}`;
|
|
64
|
+
if (!tabItens.has(key)) {
|
|
65
|
+
tabItens.set(key, { label: group, items: [fieldMD] });
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
tabItens.get(key).items.push(fieldMD);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
tabItens.set(config.name, fieldMD);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const metadata = new FormMetadata();
|
|
77
|
+
sheets.forEach((value, key) => {
|
|
78
|
+
metadata.addSheet({
|
|
79
|
+
label: key,
|
|
80
|
+
name: key,
|
|
81
|
+
items: Array.from(value.values()),
|
|
82
|
+
requiredFields
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
return metadata;
|
|
86
|
+
};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
|
-
/*@doc Define a cor de fundo do input.*/
|
|
5
|
-
--ez-number-input__input--background-color: var(--background--medium, #e0e0e0);
|
|
6
|
-
/*@doc Define a cor da borda do input.*/
|
|
7
|
-
--ez-number-input__input--border-color: var(--ez-number-input__input--background-color);
|
|
8
4
|
}
|
|
9
|
-
|
|
10
|
-
.text-input {
|
|
11
|
-
--ez-number-input__input--background-color: inherit;
|
|
12
|
-
--ez-number-input__input--border-color: inherit;
|
|
13
|
-
}
|
|
@@ -1,22 +1,12 @@
|
|
|
1
1
|
import { NumberUtils } from "@sankhyalabs/core";
|
|
2
|
-
import { Component, h, Event, Prop, Watch,
|
|
2
|
+
import { Component, h, Event, Prop, Watch, Element } from "@stencil/core";
|
|
3
|
+
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
3
4
|
export class EzNumberInput {
|
|
4
5
|
constructor() {
|
|
5
6
|
/**
|
|
6
7
|
* Deixa o campo disponível ou não para uso.
|
|
7
8
|
*/
|
|
8
9
|
this.enabled = true;
|
|
9
|
-
/**
|
|
10
|
-
* Configura o alinhamento do texto.
|
|
11
|
-
*/
|
|
12
|
-
this.textleft = false;
|
|
13
|
-
/**
|
|
14
|
-
* Opção de configurar a transformação de string to number entre formatação pt-BR e en-US
|
|
15
|
-
* (formatação de ENTRADA e SAÍDA do componente: pt-BR="###.###,##" en-US="###,###.##"; Default: "pt-BR")
|
|
16
|
-
* Qualquer outro valor que não seja "en-US", adotará a formatação "pt-BR"
|
|
17
|
-
* Não é case sensitive
|
|
18
|
-
*/
|
|
19
|
-
this.formatNumber = "PT-BR";
|
|
20
10
|
}
|
|
21
11
|
setLabel() {
|
|
22
12
|
this._textInput.label = this.label;
|
|
@@ -29,22 +19,11 @@ export class EzNumberInput {
|
|
|
29
19
|
this._textInput.value = this.getTextValue(this.value);
|
|
30
20
|
}
|
|
31
21
|
}
|
|
32
|
-
onPrecisionChanged(newPrecision) {
|
|
33
|
-
if (isNaN(newPrecision)) {
|
|
34
|
-
this.precision = 0;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
onPrettyPrecisionChanged(newPrettyPrecision) {
|
|
38
|
-
if (isNaN(newPrettyPrecision)) {
|
|
39
|
-
this.prettyPrecision = 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
22
|
changeValue(newValue) {
|
|
43
23
|
this.errorMessage = "";
|
|
44
24
|
if (newValue && newValue !== this.value) {
|
|
45
25
|
this.value = newValue;
|
|
46
|
-
this.
|
|
47
|
-
this.ezChange.emit();
|
|
26
|
+
this.ezChange.emit(this.value);
|
|
48
27
|
}
|
|
49
28
|
}
|
|
50
29
|
parseNumber() {
|
|
@@ -63,45 +42,16 @@ export class EzNumberInput {
|
|
|
63
42
|
}
|
|
64
43
|
}
|
|
65
44
|
getTextValue(value) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.errorMessage = "O valor digitado não é um número válido";
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return this.formatNumber.toUpperCase() !== "EN-US" ? NumberUtils.format(value.toString(), this.precision, this.prettyPrecision) : NumberUtils.changeFormat(NumberUtils.format(value.toString(), this.precision, this.prettyPrecision));
|
|
45
|
+
if (value) {
|
|
46
|
+
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
72
47
|
}
|
|
73
|
-
return
|
|
48
|
+
return null;
|
|
74
49
|
}
|
|
75
50
|
componentDidLoad() {
|
|
76
|
-
|
|
77
|
-
this._textInput.shadowRoot.querySelector('input').classList.add('text--right');
|
|
78
|
-
}
|
|
79
|
-
let rightItem;
|
|
80
|
-
let letfItem;
|
|
81
|
-
for (const key in this._hostElement.children) {
|
|
82
|
-
if (Object.prototype.hasOwnProperty.call(this._hostElement.children, key)) {
|
|
83
|
-
const element = this._hostElement.children[key];
|
|
84
|
-
if (element.getAttribute('slot') === 'rightIcon') {
|
|
85
|
-
rightItem = element;
|
|
86
|
-
}
|
|
87
|
-
else if (element.getAttribute('slot') === 'leftIcon') {
|
|
88
|
-
letfItem = element;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
this._leftSlotItem = letfItem;
|
|
93
|
-
this._rightSlotItem = rightItem;
|
|
94
|
-
this.slotElement;
|
|
95
|
-
}
|
|
96
|
-
componentWillLoad() {
|
|
97
|
-
this.onPrecisionChanged(this.precision);
|
|
98
|
-
this.onPrettyPrecisionChanged(this.prettyPrecision);
|
|
51
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
99
52
|
}
|
|
100
53
|
render() {
|
|
101
|
-
return (h(
|
|
102
|
-
h("ez-text-input", { class: "text-input", ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789-,.", enabled: this.enabled, errorMessage: this.errorMessage },
|
|
103
|
-
this._rightSlotItem ? h("slot", { name: "rightIcon", slot: "rightIcon" }) : undefined,
|
|
104
|
-
this._leftSlotItem ? h("slot", { name: "leftIcon", slot: "leftIcon" }) : undefined)));
|
|
54
|
+
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage }));
|
|
105
55
|
}
|
|
106
56
|
static get is() { return "ez-number-input"; }
|
|
107
57
|
static get encapsulation() { return "shadow"; }
|
|
@@ -127,14 +77,14 @@ export class EzNumberInput {
|
|
|
127
77
|
"text": "T\u00EDtulo do campo"
|
|
128
78
|
},
|
|
129
79
|
"attribute": "label",
|
|
130
|
-
"reflect":
|
|
80
|
+
"reflect": false
|
|
131
81
|
},
|
|
132
82
|
"value": {
|
|
133
|
-
"type": "
|
|
83
|
+
"type": "number",
|
|
134
84
|
"mutable": true,
|
|
135
85
|
"complexType": {
|
|
136
|
-
"original": "
|
|
137
|
-
"resolved": "number
|
|
86
|
+
"original": "number",
|
|
87
|
+
"resolved": "number",
|
|
138
88
|
"references": {}
|
|
139
89
|
},
|
|
140
90
|
"required": false,
|
|
@@ -161,7 +111,7 @@ export class EzNumberInput {
|
|
|
161
111
|
"text": "Deixa o campo dispon\u00EDvel ou n\u00E3o para uso."
|
|
162
112
|
},
|
|
163
113
|
"attribute": "enabled",
|
|
164
|
-
"reflect":
|
|
114
|
+
"reflect": false,
|
|
165
115
|
"defaultValue": "true"
|
|
166
116
|
},
|
|
167
117
|
"errorMessage": {
|
|
@@ -183,7 +133,7 @@ export class EzNumberInput {
|
|
|
183
133
|
},
|
|
184
134
|
"precision": {
|
|
185
135
|
"type": "number",
|
|
186
|
-
"mutable":
|
|
136
|
+
"mutable": false,
|
|
187
137
|
"complexType": {
|
|
188
138
|
"original": "number",
|
|
189
139
|
"resolved": "number",
|
|
@@ -196,11 +146,11 @@ export class EzNumberInput {
|
|
|
196
146
|
"text": "Precis\u00E3o decimal, ou seja, quantas casas decimais podem ser exibidas. Caso a\nquantidade de casas decimais do valor seja maior que precision, haver\u00E1 arredondamento"
|
|
197
147
|
},
|
|
198
148
|
"attribute": "precision",
|
|
199
|
-
"reflect":
|
|
149
|
+
"reflect": false
|
|
200
150
|
},
|
|
201
151
|
"prettyPrecision": {
|
|
202
152
|
"type": "number",
|
|
203
|
-
"mutable":
|
|
153
|
+
"mutable": false,
|
|
204
154
|
"complexType": {
|
|
205
155
|
"original": "number",
|
|
206
156
|
"resolved": "number",
|
|
@@ -213,49 +163,9 @@ export class EzNumberInput {
|
|
|
213
163
|
"text": "Esse atributo determina qual \u00E9 o n\u00FAmero m\u00EDnimo de casas depois da v\u00EDrgula.\nExemplo: Digamos que a precision seja igual a 4, assim qualquer n\u00FAmero ser\u00E1 \nrepresentado com 4 casas decimais mesmo que iguais a zero: 1,0100.\nSe prettiprecision igual a 2, como n\u00E3o h\u00E1 necessidade de mais de duas casas decimais\no valor exibido ser\u00E1 1,01. Por outro lado, at\u00E9 a quarta casa n\u00E3o haver\u00E1 arredondamento\n(1,1234 = 1,1234) mas a partir da quinta casa sim (1,12345 = 1,1235)."
|
|
214
164
|
},
|
|
215
165
|
"attribute": "pretty-precision",
|
|
216
|
-
"reflect":
|
|
217
|
-
},
|
|
218
|
-
"textleft": {
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"mutable": false,
|
|
221
|
-
"complexType": {
|
|
222
|
-
"original": "boolean",
|
|
223
|
-
"resolved": "boolean",
|
|
224
|
-
"references": {}
|
|
225
|
-
},
|
|
226
|
-
"required": false,
|
|
227
|
-
"optional": false,
|
|
228
|
-
"docs": {
|
|
229
|
-
"tags": [],
|
|
230
|
-
"text": "Configura o alinhamento do texto."
|
|
231
|
-
},
|
|
232
|
-
"attribute": "textleft",
|
|
233
|
-
"reflect": true,
|
|
234
|
-
"defaultValue": "false"
|
|
235
|
-
},
|
|
236
|
-
"formatNumber": {
|
|
237
|
-
"type": "string",
|
|
238
|
-
"mutable": false,
|
|
239
|
-
"complexType": {
|
|
240
|
-
"original": "string",
|
|
241
|
-
"resolved": "string",
|
|
242
|
-
"references": {}
|
|
243
|
-
},
|
|
244
|
-
"required": false,
|
|
245
|
-
"optional": false,
|
|
246
|
-
"docs": {
|
|
247
|
-
"tags": [],
|
|
248
|
-
"text": "Op\u00E7\u00E3o de configurar a transforma\u00E7\u00E3o de string to number entre formata\u00E7\u00E3o pt-BR e en-US\n(formata\u00E7\u00E3o de ENTRADA e SA\u00CDDA do componente: pt-BR=\"###.###,##\" en-US=\"###,###.##\"; Default: \"pt-BR\")\nQualquer outro valor que n\u00E3o seja \"en-US\", adotar\u00E1 a formata\u00E7\u00E3o \"pt-BR\"\nN\u00E3o \u00E9 case sensitive"
|
|
249
|
-
},
|
|
250
|
-
"attribute": "format-number",
|
|
251
|
-
"reflect": true,
|
|
252
|
-
"defaultValue": "\"PT-BR\""
|
|
166
|
+
"reflect": false
|
|
253
167
|
}
|
|
254
168
|
}; }
|
|
255
|
-
static get states() { return {
|
|
256
|
-
"_leftSlotItem": {},
|
|
257
|
-
"_rightSlotItem": {}
|
|
258
|
-
}; }
|
|
259
169
|
static get events() { return [{
|
|
260
170
|
"method": "ezChange",
|
|
261
171
|
"name": "ezChange",
|
|
@@ -267,11 +177,12 @@ export class EzNumberInput {
|
|
|
267
177
|
"text": "Evento disparado quando o estado do componente \u00E9 alterado (onEzChange)."
|
|
268
178
|
},
|
|
269
179
|
"complexType": {
|
|
270
|
-
"original": "
|
|
271
|
-
"resolved": "
|
|
180
|
+
"original": "number",
|
|
181
|
+
"resolved": "number",
|
|
272
182
|
"references": {}
|
|
273
183
|
}
|
|
274
184
|
}]; }
|
|
185
|
+
static get elementRef() { return "_elem"; }
|
|
275
186
|
static get watchers() { return [{
|
|
276
187
|
"propName": "label",
|
|
277
188
|
"methodName": "setLabel"
|
|
@@ -281,11 +192,5 @@ export class EzNumberInput {
|
|
|
281
192
|
}, {
|
|
282
193
|
"propName": "value",
|
|
283
194
|
"methodName": "applyValueToInput"
|
|
284
|
-
}, {
|
|
285
|
-
"propName": "precision",
|
|
286
|
-
"methodName": "onPrecisionChanged"
|
|
287
|
-
}, {
|
|
288
|
-
"propName": "prettyPrecision",
|
|
289
|
-
"methodName": "onPrettyPrecisionChanged"
|
|
290
195
|
}]; }
|
|
291
196
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Component, Event, h, Prop, Watch } from "@stencil/core";
|
|
1
|
+
import { Component, Event, h, Prop, Watch, Element } from "@stencil/core";
|
|
2
|
+
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
2
3
|
export class EzSearch {
|
|
3
4
|
constructor() {
|
|
4
5
|
/**
|
|
@@ -24,6 +25,9 @@ export class EzSearch {
|
|
|
24
25
|
this.value = evt.detail;
|
|
25
26
|
this.ezChange.emit(evt.detail);
|
|
26
27
|
}
|
|
28
|
+
componentDidLoad() {
|
|
29
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
|
|
30
|
+
}
|
|
27
31
|
render() {
|
|
28
32
|
return (h("ez-combo-box", { ref: elem => this._comboElement = elem, value: this.value, label: this.label, enabled: this.enabled, errorMessage: this.errorMessage, optionLoader: this.optionLoader, searchMode: true, onEzChange: evt => this.onComboChange(evt), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue }));
|
|
29
33
|
}
|
|
@@ -203,6 +207,7 @@ export class EzSearch {
|
|
|
203
207
|
"references": {}
|
|
204
208
|
}
|
|
205
209
|
}]; }
|
|
210
|
+
static get elementRef() { return "_elem"; }
|
|
206
211
|
static get watchers() { return [{
|
|
207
212
|
"propName": "value",
|
|
208
213
|
"methodName": "updateValue"
|
|
@@ -1,39 +1,81 @@
|
|
|
1
1
|
import { Component, h } from '@stencil/core';
|
|
2
|
-
import { DataUnit, DataType } from '@sankhyalabs/core';
|
|
2
|
+
import { DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
|
|
3
3
|
export class TestDu {
|
|
4
|
-
|
|
5
|
-
this.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this._dataUnit.dataLoader = (_dataUnit, _sort, _filters) => {
|
|
9
|
-
return Promise.resolve([
|
|
10
|
-
{ __record__id__: "registro1", CODPARC: 10, NOMEPARC: "Parceiro 10" },
|
|
11
|
-
{ __record__id__: "registro2", CODPARC: 20, NOMEPARC: "Parceiro 20" }
|
|
12
|
-
]);
|
|
13
|
-
};
|
|
14
|
-
this._dataUnit.metadata = {
|
|
15
|
-
name: "Parceiro",
|
|
4
|
+
componentWillLoad() {
|
|
5
|
+
this.dataUnit = new DataUnit("testes_com_formulario");
|
|
6
|
+
this.dataUnit.metadata = {
|
|
7
|
+
name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
|
|
16
8
|
label: "Parceiro",
|
|
17
9
|
fields: [
|
|
18
10
|
{
|
|
19
11
|
name: "CODPARC",
|
|
20
|
-
label: "
|
|
21
|
-
dataType: DataType.NUMBER
|
|
12
|
+
label: "Parceiro",
|
|
13
|
+
dataType: DataType.NUMBER,
|
|
14
|
+
userInterface: UserInterface.SEARCH,
|
|
15
|
+
required: true,
|
|
16
|
+
properties: {}
|
|
22
17
|
},
|
|
23
18
|
{
|
|
24
|
-
name: "
|
|
25
|
-
label: "
|
|
26
|
-
dataType: DataType.TEXT
|
|
19
|
+
name: "RECDESP",
|
|
20
|
+
label: "Receita/Despesa",
|
|
21
|
+
dataType: DataType.TEXT,
|
|
22
|
+
userInterface: UserInterface.OPTIONSELECTOR,
|
|
23
|
+
required: true,
|
|
24
|
+
properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "P",
|
|
28
|
+
label: "pera",
|
|
29
|
+
dataType: DataType.TEXT,
|
|
30
|
+
userInterface: UserInterface.OPTIONSELECTOR,
|
|
31
|
+
properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "ME",
|
|
35
|
+
label: "ME",
|
|
36
|
+
dataType: DataType.NUMBER,
|
|
37
|
+
userInterface: UserInterface.DECIMALNUMBER,
|
|
38
|
+
properties: { precision: 4, prettyPrecision: 1 }
|
|
27
39
|
}
|
|
28
40
|
]
|
|
29
41
|
};
|
|
42
|
+
this.formConfig = [
|
|
43
|
+
{ name: "CODPARC", label: "Parceiro" },
|
|
44
|
+
{ name: "NOMEPARC", label: "Mamão" },
|
|
45
|
+
{ name: "P", label: "Pêra", group: "Grupo 1" },
|
|
46
|
+
{ name: "ME", label: "Melancia", tab: "aba 1", group: "Grupo 2" },
|
|
47
|
+
{ name: "L", label: "Laranja", tab: "aba 1", group: "Grupo 1" },
|
|
48
|
+
{ name: "LI", label: "Limão", tab: "aba 1", group: "Grupo 2" }
|
|
49
|
+
];
|
|
50
|
+
this.dataUnit.records = [
|
|
51
|
+
{
|
|
52
|
+
__record__id__: "1321321321321321",
|
|
53
|
+
CODPARC: 10,
|
|
54
|
+
NOMEPARC: "Parceiro 10",
|
|
55
|
+
P: "M",
|
|
56
|
+
L: "Bagaço",
|
|
57
|
+
LI: "Azedo"
|
|
58
|
+
}
|
|
59
|
+
];
|
|
30
60
|
}
|
|
31
61
|
render() {
|
|
32
|
-
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
62
|
+
//return this.conteudoEstatico();
|
|
63
|
+
//return this.somenteDataUnit();
|
|
64
|
+
return this.configurado();
|
|
65
|
+
}
|
|
66
|
+
conteudoEstatico() {
|
|
67
|
+
return (h("div", null,
|
|
68
|
+
h("button", { onClick: () => this.form.validate() }, "Validate"),
|
|
69
|
+
h("ez-form", { ref: ref => this.form = ref },
|
|
70
|
+
h("div", null,
|
|
71
|
+
h("ez-text-input", { label: "Nome (Label est\u00E1tico)", "data-field-name": "NOMEPARC", "data-required": "true" }),
|
|
72
|
+
h("ez-text-input", { label: "C\u00F3d parc (Label est\u00E1tico)", "data-field-name": "CODPARC", "data-required": "true" })))));
|
|
73
|
+
}
|
|
74
|
+
somenteDataUnit() {
|
|
75
|
+
return (h("ez-form", { dataUnit: this.dataUnit }));
|
|
76
|
+
}
|
|
77
|
+
configurado() {
|
|
78
|
+
return (h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig, ref: ref => this.form = ref }));
|
|
37
79
|
}
|
|
38
80
|
static get is() { return "test-du"; }
|
|
39
81
|
static get originalStyleUrls() { return {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default class CSSVarsUtils {
|
|
2
|
-
static applyVarsTextInput(host,
|
|
3
|
-
if (
|
|
4
|
-
CSSVarsUtils.applyIfExists(host,
|
|
5
|
-
CSSVarsUtils.applyIfExists(host,
|
|
2
|
+
static applyVarsTextInput(host, child) {
|
|
3
|
+
if (child) {
|
|
4
|
+
CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--background-color');
|
|
5
|
+
CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--border-color');
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
static applyIfExists(host,
|
|
8
|
+
static applyIfExists(host, element, varName) {
|
|
9
9
|
const prop = getComputedStyle(host).getPropertyValue(varName);
|
|
10
10
|
if (prop) {
|
|
11
|
-
|
|
11
|
+
element.style.setProperty(varName, prop);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -158,24 +158,12 @@ export const EzUpload: {
|
|
|
158
158
|
new (): EzUpload;
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
interface FormMetadata extends Components.FormMetadata, HTMLElement {}
|
|
162
|
-
export const FormMetadata: {
|
|
163
|
-
prototype: FormMetadata;
|
|
164
|
-
new (): FormMetadata;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
161
|
interface GridConfig extends Components.GridConfig, HTMLElement {}
|
|
168
162
|
export const GridConfig: {
|
|
169
163
|
prototype: GridConfig;
|
|
170
164
|
new (): GridConfig;
|
|
171
165
|
};
|
|
172
166
|
|
|
173
|
-
interface PlaceHolder extends Components.PlaceHolder, HTMLElement {}
|
|
174
|
-
export const PlaceHolder: {
|
|
175
|
-
prototype: PlaceHolder;
|
|
176
|
-
new (): PlaceHolder;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
167
|
interface SelectBox extends Components.SelectBox, HTMLElement {}
|
|
180
168
|
export const SelectBox: {
|
|
181
169
|
prototype: SelectBox;
|