@sankhyalabs/ezui 1.1.75 → 1.1.76
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/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-button_16.cjs.entry.js +127 -119
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +21 -2
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-4d2896bb.js → index-9431aeeb.js} +2 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/ez-button/ez-button.css +62 -43
- package/dist/collection/components/ez-button/ez-button.js +9 -2
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +34 -34
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.js +12 -12
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +2 -2
- package/dist/collection/components/ez-date-input/ez-date-input.css +17 -3
- package/dist/collection/components/ez-date-input/ez-date-input.js +2 -2
- package/dist/collection/components/ez-form/ez-form.js +37 -35
- package/dist/collection/components/ez-form/store/Form.actions.js +16 -16
- package/dist/collection/components/ez-form/store/Form.reducer.js +17 -17
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +8 -8
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +12 -12
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +1 -1
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +21 -21
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +7 -7
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.css +4 -4
- package/dist/collection/components/ez-text-input/ez-text-input.css +60 -60
- package/dist/collection/components/ez-text-input/ez-text-input.js +16 -16
- package/dist/collection/components/ez-time-input/ez-time-input.js +3 -2
- package/dist/collection/utils/AssetsUtils.js +19 -0
- package/dist/custom-elements/index.js +149 -122
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-button_16.entry.js +127 -119
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +21 -2
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-33153059.js → index-fd3c8023.js} +2 -1
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-67410dfa.entry.js → p-11ae4ae7.entry.js} +1 -1
- package/dist/ezui/{p-50464bdf.entry.js → p-47fa3d6c.entry.js} +1 -1
- package/dist/ezui/{p-0d476efb.entry.js → p-66954a04.entry.js} +1 -1
- package/dist/ezui/{p-47406a6e.entry.js → p-823ff0a0.entry.js} +1 -1
- package/dist/ezui/{p-7f3bc6d9.entry.js → p-8ab6168f.entry.js} +1 -1
- package/dist/ezui/{p-15743b09.entry.js → p-9c1fb51c.entry.js} +1 -1
- package/dist/ezui/{p-061d21ba.entry.js → p-9d85125b.entry.js} +1 -1
- package/dist/ezui/{p-34d288d0.entry.js → p-a0b6eee2.entry.js} +1 -1
- package/dist/ezui/p-a7b546b2.entry.js +1 -0
- package/dist/ezui/p-c833c94f.entry.js +1 -0
- package/dist/ezui/{p-8818da66.entry.js → p-d443f020.entry.js} +1 -1
- package/dist/ezui/{p-4df6f855.js → p-e0ab3746.js} +1 -1
- package/dist/types/components/ez-collapsible-box/ez-collapsible-box.d.ts +3 -3
- package/dist/types/components/ez-form/ez-form.d.ts +9 -9
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +1 -1
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +1 -1
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -1
- package/dist/types/components.d.ts +18 -18
- package/dist/types/utils/AssetsUtils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/ezui/p-46d07e59.entry.js +0 -1
- package/dist/ezui/p-7be54779.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component, Host, h, Element, Prop } from
|
|
2
|
-
import DataUnit from
|
|
1
|
+
import { Component, Host, h, Element, Prop } from "@stencil/core";
|
|
2
|
+
import DataUnit from "./DataUnit";
|
|
3
3
|
export class FormMetadata {
|
|
4
4
|
buildField(element) {
|
|
5
5
|
let label = element.getAttribute("label");
|
|
@@ -11,7 +11,7 @@ export class FormMetadata {
|
|
|
11
11
|
label = "Selecione uma das opções:";
|
|
12
12
|
}
|
|
13
13
|
const objOpts = {};
|
|
14
|
-
Array.from(element.getElementsByTagName(
|
|
14
|
+
Array.from(element.getElementsByTagName("OPTION")).forEach((optElem, index) => {
|
|
15
15
|
const optValue = optElem.getAttribute("value") || index;
|
|
16
16
|
const optLabel = optElem.textContent;
|
|
17
17
|
objOpts[optValue] = optLabel;
|
|
@@ -19,15 +19,15 @@ export class FormMetadata {
|
|
|
19
19
|
properties.push({ name: "options", value: JSON.stringify(objOpts) });
|
|
20
20
|
}
|
|
21
21
|
else if (userInterface === "FILE") {
|
|
22
|
-
const urlElement = element.querySelector(
|
|
23
|
-
const headersElement = element.querySelectorAll(
|
|
22
|
+
const urlElement = element.querySelector("URL");
|
|
23
|
+
const headersElement = element.querySelectorAll("HEADERS>HEADER");
|
|
24
24
|
if (urlElement) {
|
|
25
25
|
properties.push({ name: "URL", value: urlElement.textContent });
|
|
26
26
|
}
|
|
27
27
|
if (headersElement && headersElement.length > 0) {
|
|
28
28
|
const headers = {};
|
|
29
29
|
headersElement.forEach(header => {
|
|
30
|
-
headers[header.getAttribute(
|
|
30
|
+
headers[header.getAttribute("name")] = header.textContent;
|
|
31
31
|
});
|
|
32
32
|
properties.push({ name: "HEADERS", value: JSON.stringify(headers) });
|
|
33
33
|
}
|
|
@@ -53,7 +53,7 @@ export class FormMetadata {
|
|
|
53
53
|
}
|
|
54
54
|
buildFieldSet(dataUnit, element) {
|
|
55
55
|
const label = element.getAttribute("label");
|
|
56
|
-
const fields = Array.from(element.getElementsByTagName(
|
|
56
|
+
const fields = Array.from(element.getElementsByTagName("FIELD")).map(f => {
|
|
57
57
|
const field = this.buildField(f);
|
|
58
58
|
dataUnit.addFieldMetadata(field);
|
|
59
59
|
return { name: field.name };
|
|
@@ -70,7 +70,7 @@ export class FormMetadata {
|
|
|
70
70
|
Array.from(elements).forEach(child => {
|
|
71
71
|
const tagName = child.tagName.toUpperCase();
|
|
72
72
|
switch (tagName) {
|
|
73
|
-
case
|
|
73
|
+
case "FIELD":
|
|
74
74
|
if (!form.items) {
|
|
75
75
|
form.items = [];
|
|
76
76
|
}
|
|
@@ -78,13 +78,13 @@ export class FormMetadata {
|
|
|
78
78
|
dataUnit.addFieldMetadata(f);
|
|
79
79
|
form.items.push({ name: f.name });
|
|
80
80
|
break;
|
|
81
|
-
case
|
|
81
|
+
case "FIELD-SET":
|
|
82
82
|
if (!form.items) {
|
|
83
83
|
form.items = [];
|
|
84
84
|
}
|
|
85
85
|
form.items.push(this.buildFieldSet(dataUnit, child));
|
|
86
86
|
break;
|
|
87
|
-
case
|
|
87
|
+
case "SUB-FORM":
|
|
88
88
|
if (!form.subForms) {
|
|
89
89
|
form.subForms = [];
|
|
90
90
|
}
|
|
@@ -93,7 +93,7 @@ export class FormMetadata {
|
|
|
93
93
|
const subDuName = child.getAttribute("dataunit");
|
|
94
94
|
let subDu;
|
|
95
95
|
if (subDuName) {
|
|
96
|
-
subDu = new DataUnit(subDuName,
|
|
96
|
+
subDu = new DataUnit(subDuName, "noname", child.hasAttribute("many") ? "N" : "1");
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
subDu = dataUnit;
|
|
@@ -108,7 +108,7 @@ export class FormMetadata {
|
|
|
108
108
|
if (!this.dataunit) {
|
|
109
109
|
this.dataunit = "dataunit_" + (this.name || this.label || new Date().getTime());
|
|
110
110
|
}
|
|
111
|
-
const du = new DataUnit(this.dataunit,
|
|
111
|
+
const du = new DataUnit(this.dataunit, "noname", this.many ? "N" : "1");
|
|
112
112
|
this.metadata = this.fromElements(this._host.children, this.label, this.name, du, this.autoload);
|
|
113
113
|
}
|
|
114
114
|
render() {
|
|
@@ -19,19 +19,19 @@ export const Field = ({ dataUnit, field, forceScroll, enabled }) => {
|
|
|
19
19
|
dataUnit.changeValue(name, newValue);
|
|
20
20
|
};
|
|
21
21
|
switch (userInterface) {
|
|
22
|
-
case
|
|
22
|
+
case "LONGTEXT":
|
|
23
23
|
return h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
|
|
24
|
-
h("ez-text-area", { value: value ||
|
|
25
|
-
case
|
|
26
|
-
case
|
|
24
|
+
h("ez-text-area", { value: value || "", label: formattedLabel, onEzChange: evt => changeFieldHandler(evt.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key, enabled: isEnabled }));
|
|
25
|
+
case "CHECKBOX":
|
|
26
|
+
case "SWITCH":
|
|
27
27
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small align--middle padding-bottom--large" }, loadingData ? h("place-holder", null) :
|
|
28
|
-
h("ez-check", { value: value, label: label, enabled: isEnabled, mode: userInterface === "CHECKBOX" ? "regular" : "switch", onEzChange: (event) => changeFieldHandler(event.target[
|
|
29
|
-
case
|
|
30
|
-
const optsObj = properties ? JSON.parse(getProp(properties,
|
|
28
|
+
h("ez-check", { value: value, label: label, enabled: isEnabled, mode: userInterface === "CHECKBOX" ? "regular" : "switch", onEzChange: (event) => changeFieldHandler(event.target["value"]), ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
29
|
+
case "OPTIONSELECTOR":
|
|
30
|
+
const optsObj = properties ? JSON.parse(getProp(properties, "options")) : {};
|
|
31
31
|
const normalized = Object.keys(optsObj).map(key => { return { value: key, label: optsObj[key] }; });
|
|
32
32
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
33
|
-
h("ez-combo-box", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
34
|
-
case
|
|
33
|
+
h("ez-combo-box", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key, options: normalized }));
|
|
34
|
+
case "SEARCH":
|
|
35
35
|
const context = {
|
|
36
36
|
__MAIN_FORM: form,
|
|
37
37
|
__DATA_UNIT: dataUnit.name,
|
|
@@ -55,38 +55,38 @@ export const Field = ({ dataUnit, field, forceScroll, enabled }) => {
|
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
if (criteriaList.length > 0) {
|
|
58
|
-
context[
|
|
58
|
+
context["CRITERIA"] = criteriaList;
|
|
59
59
|
}
|
|
60
60
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
61
|
-
h("ez-search", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
61
|
+
h("ez-search", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, optionLoader: (argument) => {
|
|
62
62
|
if (form) {
|
|
63
63
|
return form.loadSearch(argument, context);
|
|
64
64
|
}
|
|
65
65
|
}, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
66
|
-
case
|
|
67
|
-
const target = getProp(properties,
|
|
68
|
-
const strHeaders = getProp(properties,
|
|
66
|
+
case "FILE":
|
|
67
|
+
const target = getProp(properties, "URL");
|
|
68
|
+
const strHeaders = getProp(properties, "HEADERS");
|
|
69
69
|
const headers = strHeaders ? JSON.parse(strHeaders) : {};
|
|
70
70
|
const maxfiles = Number(getProp(properties, "maxfiles") || 0);
|
|
71
71
|
return (h("div", { class: "col col--sd-12 padding--small" }, loadingData ? h("place-holder", null) :
|
|
72
72
|
h("ez-upload", { value: value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.detail), urlUpload: target, requestHeaders: headers, maxFiles: maxfiles })));
|
|
73
|
-
case
|
|
73
|
+
case "DATE":
|
|
74
74
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
75
|
-
h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
76
|
-
case
|
|
77
|
-
case
|
|
75
|
+
h("ez-date-input", { value: !value ? null : DateUtils.clearTime(value), label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
76
|
+
case "DECIMALNUMBER":
|
|
77
|
+
case "INTEGERNUMBER":
|
|
78
78
|
let precision = 0;
|
|
79
79
|
let prettyPrecision = 0;
|
|
80
|
-
if (userInterface ===
|
|
80
|
+
if (userInterface === "DECIMALNUMBER") {
|
|
81
81
|
precision = Number(getProp(properties, "precision") || 2);
|
|
82
82
|
prettyPrecision = Number(getProp(properties, "prettyprecision") || precision);
|
|
83
83
|
}
|
|
84
84
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
85
|
-
h("ez-numeric-input", { value: !value ? null : value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target[
|
|
85
|
+
h("ez-numeric-input", { value: !value ? null : value, label: formattedLabel, enabled: isEnabled, onEzChange: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, precision: precision, prettyprecision: prettyPrecision, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
86
86
|
//IMAGE, DATETIME, ELAPSEDTIME, PASSWORD, MASKEDTEXT, HTML
|
|
87
87
|
default:
|
|
88
88
|
return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData ? h("place-holder", null) :
|
|
89
|
-
h("ez-text-input", { value: value, label: formattedLabel, enabled: isEnabled, loading: loadingData, onInput: (event) => changeFieldHandler(event.target[
|
|
89
|
+
h("ez-text-input", { value: value, label: formattedLabel, enabled: isEnabled, loading: loadingData, onInput: (event) => changeFieldHandler(event.target["value"]), errorMessage: errorMessage, ref: elem => scrollToView(forceScroll, elem), key: key }));
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
function getProp(properties, name) {
|
|
@@ -23,13 +23,13 @@ export const NavigationBar = ({ dataUnit: du, buttonProps, enabled }) => {
|
|
|
23
23
|
|| buttonProps.cancelVisible
|
|
24
24
|
|| buttonProps.reloadVisible) {
|
|
25
25
|
return h("div", { class: "col col--sd-12 align--right" },
|
|
26
|
-
buttonProps.previousVisible ? h("ez-button", { key: du.name +
|
|
27
|
-
buttonProps.nextVisible ? h("ez-button", { key: du.name +
|
|
28
|
-
buttonProps.removeVisible ? h("ez-button", { key: du.name +
|
|
29
|
-
buttonProps.addVisible ? h("ez-button", { key: du.name +
|
|
30
|
-
buttonProps.reloadVisible ? h("ez-button", { key: du.name +
|
|
31
|
-
buttonProps.cancelVisible ? h("ez-button", { key: du.name +
|
|
32
|
-
buttonProps.saveVisible ? h("ez-button", { key: du.name +
|
|
26
|
+
buttonProps.previousVisible ? h("ez-button", { key: du.name + "_previous", title: "Registro anterior", mode: "icon", enabled: enabled && du.hasPrevious(), onClick: () => du.previous(), image: "/themes/default/images/icons/actions-sprite.svg#previous-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
27
|
+
buttonProps.nextVisible ? h("ez-button", { key: du.name + "_next", title: "Pr\u00F3ximo registro", mode: "icon", enabled: enabled && du.hasNext(), onClick: () => du.next(), image: "/themes/default/images/icons/actions-sprite.svg#next-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
28
|
+
buttonProps.removeVisible ? h("ez-button", { key: du.name + "_remove", label: "Remover", enabled: enabled && du.hasCurrentRecord(), onClick: () => removeHandler(du), image: "/themes/default/images/icons/actions-sprite.svg#minus-circle-inverted", class: "button--secondary margin-right--medium" }) : null,
|
|
29
|
+
buttonProps.addVisible ? h("ez-button", { key: du.name + "_add", label: "Adicionar", enabled: enabled, onClick: () => du.insert(), class: "button--secondary margin-right--medium" }) : null,
|
|
30
|
+
buttonProps.reloadVisible ? h("ez-button", { key: du.name + "_reload", title: "Recarregar", enabled: enabled, mode: "icon", onClick: () => du.load(), image: "/themes/default/images/icons/actions-sprite.svg#rotate", class: "button--secondary margin-right--medium" }) : null,
|
|
31
|
+
buttonProps.cancelVisible ? h("ez-button", { key: du.name + "_cancel", label: "Cancelar", enabled: enabled && du.hasChanges(), onClick: () => du.cancel(), class: "button--secondary margin-right--medium" }) : null,
|
|
32
|
+
buttonProps.saveVisible ? h("ez-button", { key: du.name + "_save", label: "Salvar", enabled: enabled && du.hasChanges(), onClick: () => saveHandler(du), class: "button--primary margin-right--medium" }) : null);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
35
|
return null;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
/*@doc Define a cor de fundo do input.*/
|
|
5
|
-
--
|
|
5
|
+
--ez-text-input__input--background-color: var(--background--medium, #e0e0e0);
|
|
6
6
|
/*@doc Define a cor da borda do input.*/
|
|
7
|
-
--
|
|
7
|
+
--ez-text-input__input--border-color: var(--ez-text-input__input--background-color);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.text-input {
|
|
11
|
-
--
|
|
12
|
-
--
|
|
11
|
+
--ez-text-input__input--background-color: inherit;
|
|
12
|
+
--ez-text-input__input--border-color: inherit;
|
|
13
13
|
}
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
/* dimensions */
|
|
3
3
|
/*@doc Define a altura do componente.*/
|
|
4
|
-
--text-input--height: 42px;
|
|
4
|
+
--ez-text-input--height: 42px;
|
|
5
5
|
/*@doc Define a largura do componente.*/
|
|
6
|
-
--text-input--width: 100%;
|
|
6
|
+
--ez-text-input--width: 100%;
|
|
7
7
|
/*@doc Define a largura do slot que contém o ícone.*/
|
|
8
|
-
--text-input__icon--width: 48px;
|
|
8
|
+
--ez-text-input__icon--width: 48px;
|
|
9
9
|
|
|
10
10
|
/* general */
|
|
11
11
|
/*@doc Define o raio da borda do input do componente.*/
|
|
12
|
-
--text-input--border-radius: var(--border--radius-medium, 12px);
|
|
12
|
+
--ez-text-input--border-radius: var(--border--radius-medium, 12px);
|
|
13
13
|
/*@doc Define o tamanho da fonte do input e label do componente.*/
|
|
14
|
-
--text-input--font-size: var(--text--medium, 14px);
|
|
14
|
+
--ez-text-input--font-size: var(--text--medium, 14px);
|
|
15
15
|
/*@doc Define a família da fonte do input, label e caixa de mensagem do componente.*/
|
|
16
|
-
--text-input--font-family: var(--font-pattern, Arial);
|
|
16
|
+
--ez-text-input--font-family: var(--font-pattern, Arial);
|
|
17
17
|
/*@doc Define o peso da fonte do label do componente.*/
|
|
18
|
-
--text-input--font-weight: var(--text-weight--large, 500);
|
|
18
|
+
--ez-text-input--font-weight: var(--text-weight--large, 500);
|
|
19
19
|
/*@doc Define a cor da fonte do input e label do componente.*/
|
|
20
|
-
--text-input--color: var(--title--primary, #000);
|
|
20
|
+
--ez-text-input--color: var(--title--primary, #000);
|
|
21
21
|
|
|
22
22
|
/* input */
|
|
23
23
|
/*@doc Define a cor de fundo do input.*/
|
|
24
|
-
--text-input__input--background-color: var(--background--medium, #e0e0e0);
|
|
24
|
+
--ez-text-input__input--background-color: var(--background--medium, #e0e0e0);
|
|
25
25
|
/*@doc Define o estilo da borda do input.*/
|
|
26
|
-
--text-input__input--border: var(--border--medium, 2px solid);
|
|
26
|
+
--ez-text-input__input--border: var(--border--medium, 2px solid);
|
|
27
27
|
/*@doc Define a cor da borda do input.*/
|
|
28
|
-
--text-input__input--border-color: var(--text-input__input--background-color);
|
|
28
|
+
--ez-text-input__input--border-color: var(--ez-text-input__input--background-color);
|
|
29
29
|
/*no modo normal usamos a borda com a mesma cor do bg*/
|
|
30
30
|
/*@doc Define a cor da borda do input quando focado.*/
|
|
31
|
-
--text-input__input--focus--border-color: var(--color--alert-cold-800, #042EFF);
|
|
31
|
+
--ez-text-input__input--focus--border-color: var(--color--alert-cold-800, #042EFF);
|
|
32
32
|
/*@doc Define a cor de fundo do input quando desabilitado.*/
|
|
33
|
-
--text-input__input--disabled--background-color: var(--color--disable-secondary, #F2F5F8);
|
|
33
|
+
--ez-text-input__input--disabled--background-color: var(--color--disable-secondary, #F2F5F8);
|
|
34
34
|
/*@doc Define a cor do texto do input.*/
|
|
35
|
-
--text-input__input--disabled--color: var(--text--disable, #AFB6C0);
|
|
35
|
+
--ez-text-input__input--disabled--color: var(--text--disable, #AFB6C0);
|
|
36
36
|
/*@doc Define a cor da borda do input quando com erro.*/
|
|
37
|
-
--text-input__input--error--border-color: #CC2936;
|
|
37
|
+
--ez-text-input__input--error--border-color: #CC2936;
|
|
38
38
|
|
|
39
39
|
/* message box */
|
|
40
40
|
/*@doc Define o tamanho da fonte da mensagem abaixo do input.*/
|
|
41
|
-
--text-input__message_box--font-size: var(--text--small, 12px);
|
|
41
|
+
--ez-text-input__message_box--font-size: var(--text--small, 12px);
|
|
42
42
|
/*@doc Define a cor da fonte da mensagem quando info.*/
|
|
43
|
-
--text-input__message_box--info--color: var(--color--success, #22085d);
|
|
43
|
+
--ez-text-input__message_box--info--color: var(--color--success, #22085d);
|
|
44
44
|
/*@doc Define a cor da fonte da mensagem quando erro.*/
|
|
45
|
-
--text-input__message_box--error--color: var(--color--error, #FF0000);
|
|
45
|
+
--ez-text-input__message_box--error--color: var(--color--error, #FF0000);
|
|
46
46
|
|
|
47
47
|
/* label */
|
|
48
48
|
/*@doc Define o posicionamento do label.*/
|
|
49
|
-
--text-input__label--floating--top: 6px;
|
|
49
|
+
--ez-text-input__label--floating--top: 6px;
|
|
50
50
|
/*@doc Define o posicionamento do label.*/
|
|
51
|
-
--text-input__label--padding-top: 12px;
|
|
51
|
+
--ez-text-input__label--padding-top: 12px;
|
|
52
52
|
/*@doc Define o espaçamento esquerdo do label.*/
|
|
53
|
-
--text-input__label--padding-left: 14px;
|
|
53
|
+
--ez-text-input__label--padding-left: 14px;
|
|
54
54
|
/*@doc Define o espaçamento direito do label.*/
|
|
55
|
-
--text-input__label--padding-right: 12px;
|
|
55
|
+
--ez-text-input__label--padding-right: 12px;
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
/***************
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
flex-wrap: wrap;
|
|
64
64
|
position: relative;
|
|
65
65
|
/*public*/
|
|
66
|
-
width: var(--text-input--width);
|
|
66
|
+
width: var(--ez-text-input--width);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
input {
|
|
@@ -74,40 +74,40 @@ input {
|
|
|
74
74
|
font-weight: var(--text-weight--large, 600);
|
|
75
75
|
|
|
76
76
|
/*public*/
|
|
77
|
-
height: var(--text-input--height);
|
|
78
|
-
border-radius: var(--text-input--border-radius);
|
|
79
|
-
font-family: var(--text-input--font-family);
|
|
80
|
-
font-size: var(--text-input--font-size);
|
|
81
|
-
border: var(--text-input__input--border);
|
|
82
|
-
border-color: var(--text-input__input--border-color);
|
|
83
|
-
background-color: var(--text-input__input--background-color);
|
|
84
|
-
color: var(--text-input--color);
|
|
77
|
+
height: var(--ez-text-input--height);
|
|
78
|
+
border-radius: var(--ez-text-input--border-radius);
|
|
79
|
+
font-family: var(--ez-text-input--font-family);
|
|
80
|
+
font-size: var(--ez-text-input--font-size);
|
|
81
|
+
border: var(--ez-text-input__input--border);
|
|
82
|
+
border-color: var(--ez-text-input__input--border-color);
|
|
83
|
+
background-color: var(--ez-text-input__input--background-color);
|
|
84
|
+
color: var(--ez-text-input--color);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
input:disabled {
|
|
88
88
|
/*public*/
|
|
89
|
-
background-color: var(--text-input__input--disabled--background-color);
|
|
90
|
-
color: var(--text-input__input--disabled--color);
|
|
89
|
+
background-color: var(--ez-text-input__input--disabled--background-color);
|
|
90
|
+
color: var(--ez-text-input__input--disabled--color);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
input:focus {
|
|
94
94
|
/*private*/
|
|
95
95
|
outline: none;
|
|
96
96
|
/*public*/
|
|
97
|
-
border-color: var(--text-input__input--focus--border-color);
|
|
97
|
+
border-color: var(--ez-text-input__input--focus--border-color);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
input.icon--left {
|
|
101
|
-
padding-left: var(--text-input__icon--width);
|
|
101
|
+
padding-left: var(--ez-text-input__icon--width);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
input.icon--right {
|
|
105
|
-
padding-right: var(--text-input__icon--width);
|
|
105
|
+
padding-right: var(--ez-text-input__icon--width);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
input.hasError {
|
|
109
|
-
color: var(--text-input--color);
|
|
110
|
-
border-color: var(--text-input__input--error--border-color);
|
|
109
|
+
color: var(--ez-text-input--color);
|
|
110
|
+
border-color: var(--ez-text-input__input--error--border-color);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
input.text--right {
|
|
@@ -126,14 +126,14 @@ input.text--right {
|
|
|
126
126
|
white-space: nowrap;
|
|
127
127
|
|
|
128
128
|
/*public*/
|
|
129
|
-
font-family: var(--text-input--font-family);
|
|
130
|
-
font-size: var(--text-input__message_box--font-size);
|
|
131
|
-
color: var(--text-input__message_box--info--color);
|
|
129
|
+
font-family: var(--ez-text-input--font-family);
|
|
130
|
+
font-size: var(--ez-text-input__message_box--font-size);
|
|
131
|
+
color: var(--ez-text-input__message_box--info--color);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
.hasError {
|
|
135
135
|
/*public*/
|
|
136
|
-
color: var(--text-input__message_box--error--color);
|
|
136
|
+
color: var(--ez-text-input__message_box--error--color);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
.input__label {
|
|
@@ -146,49 +146,49 @@ input.text--right {
|
|
|
146
146
|
white-space: nowrap;
|
|
147
147
|
-webkit-transition: font-size .05s, top .05s;
|
|
148
148
|
transition: font-size .05s, top .05s;
|
|
149
|
-
width: calc(100% - var(--text-input__label--padding-right));
|
|
150
|
-
left: var(--text-input--space--medium);
|
|
149
|
+
width: calc(100% - var(--ez-text-input__label--padding-right));
|
|
150
|
+
left: var(--ez-text-input--space--medium);
|
|
151
151
|
|
|
152
152
|
/*public*/
|
|
153
|
-
font-family: var(--text-input--font-family);
|
|
154
|
-
font-size: var(--text-input--font-size);
|
|
155
|
-
font-weight: var(--text-input--font-weight);
|
|
156
|
-
color: var(--text-input--color);
|
|
157
|
-
top: var(--text-input__label--padding-top);
|
|
158
|
-
left: var(--text-input__label--padding-left);
|
|
159
|
-
padding-right: var(--text-input__label--padding-right);
|
|
153
|
+
font-family: var(--ez-text-input--font-family);
|
|
154
|
+
font-size: var(--ez-text-input--font-size);
|
|
155
|
+
font-weight: var(--ez-text-input--font-weight);
|
|
156
|
+
color: var(--ez-text-input--color);
|
|
157
|
+
top: var(--ez-text-input__label--padding-top);
|
|
158
|
+
left: var(--ez-text-input__label--padding-left);
|
|
159
|
+
padding-right: var(--ez-text-input__label--padding-right);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
.input__label--floated {
|
|
163
|
-
font-family: var(--text-input--font-family);
|
|
163
|
+
font-family: var(--ez-text-input--font-family);
|
|
164
164
|
font-size: var(--text--extra-small);
|
|
165
165
|
color: var(--text--primary);
|
|
166
|
-
top: var(--text-input__label--floating--top);
|
|
166
|
+
top: var(--ez-text-input__label--floating--top);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
.input__label--disabled {
|
|
170
|
-
color: var(--text-input__input--disabled--color);
|
|
170
|
+
color: var(--ez-text-input__input--disabled--color);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
.input__label--left {
|
|
174
174
|
/*public*/
|
|
175
175
|
text-align: left;
|
|
176
|
-
left: calc(var(--text-input__icon--width) + 2px);
|
|
176
|
+
left: calc(var(--ez-text-input__icon--width) + 2px);
|
|
177
177
|
/*borda*/
|
|
178
|
-
width: calc(100% - var(--text-input__icon--width));
|
|
178
|
+
width: calc(100% - var(--ez-text-input__icon--width));
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
.input__label--right {
|
|
182
182
|
/*public*/
|
|
183
|
-
right: var(--text-input__icon--width);
|
|
184
|
-
width: calc(100% - var(--text-input__icon--width));
|
|
183
|
+
right: var(--ez-text-input__icon--width);
|
|
184
|
+
width: calc(100% - var(--ez-text-input__icon--width));
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/* ISSO TA ERRADO CRIAR INPUT__LABEL--BOTH */
|
|
188
188
|
.input__label--left.input__label--right {
|
|
189
|
-
left: calc(var(--text-input__icon--width) + 2px);
|
|
189
|
+
left: calc(var(--ez-text-input__icon--width) + 2px);
|
|
190
190
|
/*borda*/
|
|
191
|
-
width: calc(100% - var(--text-input__icon--width) * 2);
|
|
191
|
+
width: calc(100% - var(--ez-text-input__icon--width) * 2);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
.input--with--label {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component, Prop, h, Watch, Host, Method, Event, Element } from
|
|
2
|
-
import { MaskFormatter } from
|
|
1
|
+
import { Component, Prop, h, Watch, Host, Method, Event, Element } from "@stencil/core";
|
|
2
|
+
import { MaskFormatter } from "@sankhyalabs/core";
|
|
3
3
|
export class EzTextInput {
|
|
4
4
|
constructor() {
|
|
5
5
|
/**
|
|
@@ -8,14 +8,14 @@ export class EzTextInput {
|
|
|
8
8
|
this.enabled = true;
|
|
9
9
|
}
|
|
10
10
|
showError() {
|
|
11
|
-
const hasError = typeof this.errorMessage ===
|
|
11
|
+
const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
|
|
12
12
|
if (hasError) {
|
|
13
|
-
this._inputElem.classList.add(
|
|
14
|
-
this._messageBoxElem.classList.add(
|
|
13
|
+
this._inputElem.classList.add("hasError");
|
|
14
|
+
this._messageBoxElem.classList.add("hasError");
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
this._inputElem.classList.remove(
|
|
18
|
-
this._messageBoxElem.classList.remove(
|
|
17
|
+
this._inputElem.classList.remove("hasError");
|
|
18
|
+
this._messageBoxElem.classList.remove("hasError");
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
prepareMask() {
|
|
@@ -33,7 +33,7 @@ export class EzTextInput {
|
|
|
33
33
|
this._inputElem.value = this.value;
|
|
34
34
|
}
|
|
35
35
|
this.handleChange();
|
|
36
|
-
this.ezChange.emit();
|
|
36
|
+
this.ezChange.emit(this.value);
|
|
37
37
|
this.adjustFloatingLabel();
|
|
38
38
|
}
|
|
39
39
|
adjustFloatingLabel() {
|
|
@@ -118,22 +118,22 @@ export class EzTextInput {
|
|
|
118
118
|
content.style.justifyContent = "center";
|
|
119
119
|
content.style.overflow = "hidden";
|
|
120
120
|
content.style.top = "0px";
|
|
121
|
-
content.style.width = "var(--text-input__icon--width)";
|
|
122
|
-
content.style.height = "var(--text-input--height)";
|
|
121
|
+
content.style.width = "var(--ez-text-input__icon--width)";
|
|
122
|
+
content.style.height = "var(--ez-text-input--height)";
|
|
123
123
|
if (slot.name == "leftIcon") {
|
|
124
124
|
content.style.left = "0px";
|
|
125
|
-
content.style.borderRadius = "var(--text-input--border-radius) 0 0 var(--text-input--border-radius)";
|
|
126
|
-
this._inputElem.classList.add(
|
|
125
|
+
content.style.borderRadius = "var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)";
|
|
126
|
+
this._inputElem.classList.add("icon--left");
|
|
127
127
|
if (this._labelElem) {
|
|
128
|
-
this._labelElem.classList.add(
|
|
128
|
+
this._labelElem.classList.add("input__label--left");
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
else if (slot.name == "rightIcon") {
|
|
132
132
|
content.style.right = "0px";
|
|
133
|
-
content.style.borderRadius = "0 var(--text-input--border-radius) var(--text-input--border-radius) 0";
|
|
134
|
-
this._inputElem.classList.add(
|
|
133
|
+
content.style.borderRadius = "0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0";
|
|
134
|
+
this._inputElem.classList.add("icon--right");
|
|
135
135
|
if (this._labelElem) {
|
|
136
|
-
this._labelElem.classList.add(
|
|
136
|
+
this._labelElem.classList.add("input__label--right");
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Element, Component, Prop, h, Watch, Host, Method
|
|
1
|
+
import { Element, Component, Prop, h, Watch, Host, Method } from "@stencil/core";
|
|
2
2
|
import { TimeFormatter, MaskFormatter, NumberUtils } from "@sankhyalabs/core";
|
|
3
3
|
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
4
|
+
import { getSpritePath } from "../../utils/AssetsUtils";
|
|
4
5
|
export class EzTimeInput {
|
|
5
6
|
constructor() {
|
|
6
7
|
/**
|
|
@@ -97,7 +98,7 @@ export class EzTimeInput {
|
|
|
97
98
|
render() {
|
|
98
99
|
return (h(Host, null,
|
|
99
100
|
h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage },
|
|
100
|
-
h("ez-icon", { slot: "leftIcon", href:
|
|
101
|
+
h("ez-icon", { slot: "leftIcon", href: getSpritePath("timer-outline") }))));
|
|
101
102
|
}
|
|
102
103
|
static get is() { return "ez-time-input"; }
|
|
103
104
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getAssetPath, setAssetPath } from "@stencil/core";
|
|
2
|
+
export const getSpritePath = (sprite) => `${getContextAssetsPath("../assets/actions-sprite.svg")}#${sprite}`;
|
|
3
|
+
let ctxLoaded = false;
|
|
4
|
+
function getContextAssetsPath(resource) {
|
|
5
|
+
if (!ctxLoaded) {
|
|
6
|
+
const scriptElem = document.querySelector("script[data-ezui-assets-url]");
|
|
7
|
+
if (scriptElem) {
|
|
8
|
+
let assetsPath = scriptElem.dataset.ezuiAssetsUrl;
|
|
9
|
+
if (assetsPath) {
|
|
10
|
+
if (assetsPath.startsWith('/')) {
|
|
11
|
+
assetsPath = window.location.origin + assetsPath;
|
|
12
|
+
}
|
|
13
|
+
setAssetPath(assetsPath);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
ctxLoaded = true;
|
|
17
|
+
}
|
|
18
|
+
return getAssetPath(resource);
|
|
19
|
+
}
|